@structyl/data-table 1.0.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.
@@ -0,0 +1,703 @@
1
+ import * as React from 'react';
2
+ import { Row, Column, ColumnDef, Table, Cell, PaginationState, SortingState, ColumnFiltersState, RowSelectionState, VisibilityState, ColumnOrderState, ColumnSizingState, ColumnPinningState, GroupingState } from '@tanstack/react-table';
3
+ export { ColumnDef, ColumnFiltersState, ColumnOrderState, ColumnPinningState, ColumnSizingState, ExpandedState, GroupingState, PaginationState, Row, RowSelectionState, SortingState, Table, VisibilityState, createColumnHelper } from '@tanstack/react-table';
4
+
5
+ type DataTableColumn<TData, TValue = unknown> = ColumnDef<TData, TValue>;
6
+ type DataTableFilterOperator = 'contains' | 'equals' | 'startsWith' | 'endsWith' | 'gt' | 'gte' | 'lt' | 'lte' | 'empty' | 'notEmpty';
7
+ type DataTableFilterLogic = 'and' | 'or';
8
+ type DataTableAggregation = 'sum' | 'avg' | 'min' | 'max' | 'count' | ((values: unknown[], rows: Row<unknown>[]) => React.ReactNode);
9
+ type DataTableLoadingVariant = 'text' | 'skeleton' | 'spinner';
10
+ interface DataTableFilterRule {
11
+ id: string;
12
+ columnId: string;
13
+ operator: DataTableFilterOperator;
14
+ value?: unknown;
15
+ }
16
+ type DataTableFilterItem = DataTableFilterRule | DataTableFilterGroup;
17
+ interface DataTableFilterGroup {
18
+ id: string;
19
+ logic: DataTableFilterLogic;
20
+ items: DataTableFilterItem[];
21
+ }
22
+ interface ServerDataState {
23
+ pagination?: PaginationState;
24
+ sorting?: SortingState;
25
+ filters?: ColumnFiltersState;
26
+ globalFilter?: string;
27
+ advancedFilter?: DataTableFilterGroup;
28
+ rowSelection?: RowSelectionState;
29
+ }
30
+ interface ServerData<TData> {
31
+ rows: TData[];
32
+ total: number;
33
+ }
34
+ interface DataTableLocaleText {
35
+ searchPlaceholder: string;
36
+ filters: string;
37
+ filterColumnLabel: string;
38
+ filterOperatorLabel: string;
39
+ filterValueLabel: string;
40
+ filterLogicLabel: string;
41
+ addFilter: string;
42
+ addFilterGroup: string;
43
+ clearFilters: string;
44
+ removeFilter: string;
45
+ removeFilterGroup: string;
46
+ columns: string;
47
+ columnMenu: string;
48
+ sortAsc: string;
49
+ sortDesc: string;
50
+ clearSort: string;
51
+ hideColumn: string;
52
+ pinLeft: string;
53
+ pinRight: string;
54
+ unpin: string;
55
+ groupBy: string;
56
+ ungroup: string;
57
+ selectColumn: string;
58
+ selectedRows: (selected: number, total: number) => string;
59
+ page: (page: number, pageCount: number) => string;
60
+ previous: string;
61
+ next: string;
62
+ noResults: string;
63
+ loading: string;
64
+ loadingMore: string;
65
+ error: string;
66
+ addRow: string;
67
+ cancel: string;
68
+ save: string;
69
+ rowActions: string;
70
+ rowTotal: string;
71
+ pinRowTop: string;
72
+ pinRowBottom: string;
73
+ total: string;
74
+ expandRow: string;
75
+ collapseRow: string;
76
+ expandAll: string;
77
+ collapseAll: string;
78
+ copyRows: string;
79
+ copyRow: string;
80
+ copyColumn: string;
81
+ density: string;
82
+ densityCompact: string;
83
+ densityStandard: string;
84
+ densityComfortable: string;
85
+ refresh: string;
86
+ exportCsv: string;
87
+ exportJson: string;
88
+ noRows: string;
89
+ rowsPerPage: string;
90
+ totalRows: (count: number) => string;
91
+ goToPage: string;
92
+ firstPage: string;
93
+ lastPage: string;
94
+ bulkActionsTitle: (count: number) => string;
95
+ clearSelection: string;
96
+ rowNumberHeader: string;
97
+ statusBarRows: (count: number) => string;
98
+ statusBarSelected: (count: number) => string;
99
+ printTitle: string;
100
+ enterFullscreen: string;
101
+ exitFullscreen: string;
102
+ autoSizeColumn: string;
103
+ quickFilterPlaceholder: string;
104
+ lockColumn: string;
105
+ unlockColumn: string;
106
+ export?: string;
107
+ exportCSV?: string;
108
+ exportJSON?: string;
109
+ exportSelectedCSV?: string;
110
+ conditionalFormatting?: string;
111
+ }
112
+ interface DataTableInlineCreate {
113
+ fields: Array<{
114
+ id: string;
115
+ label?: React.ReactNode;
116
+ type?: 'text' | 'number';
117
+ placeholder?: string;
118
+ }>;
119
+ onAdd: (values: Record<string, string>) => void;
120
+ label?: React.ReactNode;
121
+ }
122
+ interface DataTableRowTotals<TData> {
123
+ id?: string;
124
+ header?: React.ReactNode;
125
+ columns?: string[];
126
+ format?: (value: number, row: Row<TData>) => React.ReactNode;
127
+ }
128
+ interface DataTableRowPinningState {
129
+ top?: string[];
130
+ bottom?: string[];
131
+ }
132
+ type DataTableColumnType = 'string' | 'number' | 'date' | 'dateTime' | 'boolean' | 'badge' | 'progress' | 'link' | 'avatar' | 'currency' | 'sparkline' | 'rating';
133
+ type DataTableDensity = 'compact' | 'standard' | 'comfortable';
134
+ interface DataTableCellParams<TData, TValue = unknown> {
135
+ row: Row<TData>;
136
+ value: TValue;
137
+ field: string;
138
+ }
139
+ interface DataTableHeaderParams<TData, TValue = unknown> {
140
+ column: Column<TData, TValue>;
141
+ }
142
+ interface DataTableToolbarAction<TData = unknown> {
143
+ id: string;
144
+ icon?: React.ReactNode;
145
+ label?: React.ReactNode;
146
+ tooltip?: string;
147
+ onClick?: (table: Table<TData>) => void;
148
+ render?: (table: Table<TData>) => React.ReactNode;
149
+ disabled?: boolean;
150
+ }
151
+ interface DataTableColumnMenuSlotProps<TData> {
152
+ column: Column<TData, unknown>;
153
+ table: Table<TData>;
154
+ }
155
+ interface DataTableSearchSlotProps {
156
+ value: string;
157
+ onValueChange: (value: string) => void;
158
+ placeholder: string;
159
+ }
160
+ interface DataTableFilterSlotProps<TData> {
161
+ table: Table<TData>;
162
+ filter?: DataTableFilterGroup;
163
+ onFilterChange: (filter: DataTableFilterGroup | undefined) => void;
164
+ localeText: DataTableLocaleText;
165
+ overlayBoundary?: HTMLDivElement | null;
166
+ }
167
+ interface DataTableLoadingSkeletonSlotProps {
168
+ rows: number;
169
+ columns: number;
170
+ }
171
+ interface DataTableLoadingOverlaySlotProps {
172
+ text: string;
173
+ variant: DataTableLoadingVariant;
174
+ }
175
+ /** Slot overrides — provide a component to replace any built-in sub-component. */
176
+ interface DataTableSlots<TData> {
177
+ /** Replace the entire toolbar section. Receives the live TanStack table instance. */
178
+ Toolbar?: React.ComponentType<{
179
+ table: Table<TData>;
180
+ localeText: DataTableLocaleText;
181
+ }>;
182
+ /** Replace the pagination section. */
183
+ Pagination?: React.ComponentType<{
184
+ table: Table<TData>;
185
+ localeText: DataTableLocaleText;
186
+ pageSizeOptions: number[];
187
+ }>;
188
+ /** Replace the column context menu dropdown. */
189
+ ColumnMenu?: React.ComponentType<DataTableColumnMenuSlotProps<TData>>;
190
+ /** Replace the advanced filter button/panel. */
191
+ Filter?: React.ComponentType<DataTableFilterSlotProps<TData>>;
192
+ /** Replace the global search input. */
193
+ Search?: React.ComponentType<DataTableSearchSlotProps>;
194
+ /** Replace the skeleton loading rows. */
195
+ LoadingSkeleton?: React.ComponentType<DataTableLoadingSkeletonSlotProps>;
196
+ /** Replace the loading overlay (spinner / text). */
197
+ LoadingOverlay?: React.ComponentType<DataTableLoadingOverlaySlotProps>;
198
+ /** Shown when the data source has no rows (before any filter). */
199
+ NoRowsOverlay?: React.ComponentType;
200
+ /** Shown when search / filter produce zero results from a non-empty dataset. */
201
+ NoResultsOverlay?: React.ComponentType;
202
+ }
203
+ interface DataTableBulkAction<TData = unknown> {
204
+ id: string;
205
+ label: React.ReactNode;
206
+ icon?: React.ReactNode;
207
+ tooltip?: string;
208
+ onClick: (selectedRows: Row<TData>[], table: Table<TData>) => void;
209
+ disabled?: boolean | ((selectedRows: Row<TData>[]) => boolean);
210
+ variant?: 'default' | 'destructive';
211
+ }
212
+ interface DataTableRowActionItem<TData = unknown> {
213
+ id: string;
214
+ label: React.ReactNode;
215
+ icon?: React.ReactNode;
216
+ tooltip?: string;
217
+ onClick: (row: Row<TData>) => void;
218
+ disabled?: boolean | ((row: Row<TData>) => boolean);
219
+ /** Hide this item for specific rows. */
220
+ hidden?: boolean | ((row: Row<TData>) => boolean);
221
+ variant?: 'default' | 'destructive';
222
+ /** Insert a visual separator above this item. */
223
+ separator?: boolean;
224
+ }
225
+ /**
226
+ * Structyl-extended column definition. All properties are optional so you can use
227
+ * just `field` + `headerName` without satisfying TanStack's union requirements.
228
+ * `normalizeColumnDefs` converts this to a proper TanStack `ColumnDef` before
229
+ * passing it to `useReactTable`.
230
+ */
231
+ type DataTableColumnDef<TData, TValue = unknown> = {
232
+ /** Field key on the data object — maps to `accessorKey`. */
233
+ field?: string;
234
+ /** Stable DB identifier distinct from the display field. */
235
+ fieldId?: string;
236
+ /** Human-readable header label — maps to `header` when a string. */
237
+ headerName?: string;
238
+ /** Data type — drives alignment, filter operators, and format. */
239
+ type?: DataTableColumnType;
240
+ /** Horizontal alignment for header and cells. */
241
+ align?: 'left' | 'center' | 'right';
242
+ /** Flex grow factor; column fills remaining width proportionally. */
243
+ flex?: number;
244
+ /** Read value from a row — maps to `accessorFn`. */
245
+ valueGetter?: (row: TData) => TValue;
246
+ /** Write an edited value back (used by inline editing). */
247
+ valueSetter?: (row: TData, value: TValue, rowIndex: number) => void;
248
+ /** Validation function for inline editing — return an error message string or undefined. */
249
+ validate?: (value: unknown, row: TData) => string | undefined;
250
+ /** Validation function applied to display-mode cells — return an error message or undefined. */
251
+ displayValidate?: (value: unknown, row: TData) => string | undefined;
252
+ /** Mark column as inline-editable. */
253
+ editable?: boolean;
254
+ /** Locale for Intl formatting of this column, e.g. 'en-US', 'de-DE'. Overrides the table-level locale. */
255
+ locale?: string;
256
+ /** DateTimeFormat options for date / dateTime columns. */
257
+ dateFormat?: Intl.DateTimeFormatOptions;
258
+ /** NumberFormat options for number / currency columns. */
259
+ numberFormat?: Intl.NumberFormatOptions;
260
+ /** IANA timezone for dateTime columns, e.g. 'America/New_York'. */
261
+ timezone?: string;
262
+ /** Badge map: value → { label?, color?, textColor? }. Used when type='badge'. */
263
+ badgeMap?: Record<string, {
264
+ label?: string;
265
+ color?: string;
266
+ textColor?: string;
267
+ }>;
268
+ /** ISO currency code, e.g. 'USD'. Used when type='currency'. */
269
+ currencyCode?: string;
270
+ /** Locale for Intl.NumberFormat, e.g. 'en-US'. Used when type='currency'. */
271
+ currencyLocale?: string;
272
+ /** Href for link cells. String = static, function = computed from value+row. */
273
+ linkHref?: string | ((value: unknown, row: TData) => string);
274
+ /** Target attribute for link cells. */
275
+ linkTarget?: '_blank' | '_self';
276
+ /** Function returning image URL from value+row. Used when type='avatar'. */
277
+ avatarSrc?: (value: unknown, row: TData) => string;
278
+ /** Function returning number array for sparkline chart. Used when type='sparkline'. */
279
+ sparklineData?: (row: TData) => number[];
280
+ /** Sparkline chart variant. */
281
+ sparklineType?: 'line' | 'bar' | 'area';
282
+ /** Max value for progress bar. Default 100. Used when type='progress'. */
283
+ progressMax?: number;
284
+ /** Max star count for rating. Default 5. Used when type='rating'. */
285
+ ratingMax?: number;
286
+ /** Custom cell renderer — maps to `cell`. */
287
+ renderCell?: (params: DataTableCellParams<TData, TValue>) => React.ReactNode;
288
+ /** Custom header renderer — maps to `header`. */
289
+ renderHeader?: (params: DataTableHeaderParams<TData, TValue>) => React.ReactNode;
290
+ /** Tooltip shown on the column header. */
291
+ description?: string;
292
+ /** Override the default filter operators for this column. */
293
+ filterOperators?: DataTableFilterOperator[];
294
+ id?: string;
295
+ accessorKey?: string;
296
+ accessorFn?: (originalRow: TData, index: number) => TValue;
297
+ header?: ColumnDef<TData, TValue>['header'];
298
+ cell?: ColumnDef<TData, TValue>['cell'];
299
+ footer?: ColumnDef<TData, TValue>['footer'];
300
+ columns?: DataTableColumnDef<TData, TValue>[];
301
+ size?: number;
302
+ minSize?: number;
303
+ maxSize?: number;
304
+ enableSorting?: boolean;
305
+ enableHiding?: boolean;
306
+ enableResizing?: boolean;
307
+ enableColumnFilter?: boolean;
308
+ enableGlobalFilter?: boolean;
309
+ enableGrouping?: boolean;
310
+ enablePinning?: boolean;
311
+ enableMultiSort?: boolean;
312
+ sortDescFirst?: boolean;
313
+ invertSorting?: boolean;
314
+ meta?: object;
315
+ getGroupingValue?: (row: TData) => unknown;
316
+ };
317
+ interface DataTableConditionalRule {
318
+ id: string;
319
+ columnId: string;
320
+ operator: 'equals' | 'notEquals' | 'contains' | 'gt' | 'gte' | 'lt' | 'lte' | 'empty' | 'notEmpty';
321
+ value?: string;
322
+ backgroundColor?: string;
323
+ textColor?: string;
324
+ }
325
+ /** Cell selection range for `enableCellSelection`. */
326
+ type DataTableCellSelection = {
327
+ startRowIndex: number;
328
+ startColIndex: number;
329
+ endRowIndex: number;
330
+ endColIndex: number;
331
+ };
332
+ /** Pivot table configuration. */
333
+ type DataTablePivotConfig = {
334
+ /** Column whose unique values become row headers. */
335
+ rowGroupField: string;
336
+ /** Column whose unique values become column headers. */
337
+ pivotField: string;
338
+ /** Column whose values are aggregated in each cell. */
339
+ valueField: string;
340
+ /** Aggregation function applied to each pivot cell. */
341
+ aggregation: 'count' | 'sum' | 'avg' | 'min' | 'max';
342
+ };
343
+ /** A saved snapshot of the table's display state. */
344
+ type DataTableSavedView = {
345
+ id: string;
346
+ name: string;
347
+ /** ISO date string. */
348
+ createdAt: string;
349
+ state: {
350
+ sorting?: SortingState;
351
+ columnFilters?: ColumnFiltersState;
352
+ globalFilter?: string;
353
+ columnVisibility?: VisibilityState;
354
+ columnOrder?: ColumnOrderState;
355
+ columnSizing?: ColumnSizingState;
356
+ columnPinning?: ColumnPinningState;
357
+ density?: DataTableDensity;
358
+ grouping?: GroupingState;
359
+ conditionalFormattingRules?: DataTableConditionalRule[];
360
+ };
361
+ };
362
+ /** A cell-level validation error produced by `displayValidate`. */
363
+ type DataTableValidationError = {
364
+ rowId: string;
365
+ field: string;
366
+ value: unknown;
367
+ message: string;
368
+ };
369
+ /** Column statistics computed in the Tool Panel Stats tab. */
370
+ type ColumnStats = {
371
+ count: number;
372
+ nullCount: number;
373
+ uniqueCount: number;
374
+ min?: number;
375
+ max?: number;
376
+ mean?: number;
377
+ median?: number;
378
+ sum?: number;
379
+ minLength?: number;
380
+ maxLength?: number;
381
+ avgLength?: number;
382
+ topValues: Array<{
383
+ value: string;
384
+ count: number;
385
+ pct: number;
386
+ }>;
387
+ };
388
+ interface DataTableProps<TData, TValue = unknown> {
389
+ columns: DataTableColumnDef<TData, TValue>[];
390
+ data: TData[];
391
+ /** Render rows virtually. Specify estimated row height. */
392
+ virtual?: boolean | {
393
+ estimatedRowHeight?: number;
394
+ overscan?: number;
395
+ };
396
+ /** Render leaf columns virtually for wide grids. */
397
+ virtualColumns?: boolean | {
398
+ estimatedColumnWidth?: number;
399
+ overscan?: number;
400
+ };
401
+ enableSorting?: boolean;
402
+ enableFiltering?: boolean;
403
+ enableAdvancedFiltering?: boolean;
404
+ enableGlobalSearch?: boolean;
405
+ enableRowSelection?: boolean | 'single';
406
+ enableColumnSelection?: boolean;
407
+ enablePagination?: boolean;
408
+ enableExpanding?: boolean;
409
+ enableGrouping?: boolean;
410
+ enableColumnResizing?: boolean;
411
+ enableColumnReordering?: boolean;
412
+ enableRowReordering?: boolean;
413
+ enableColumnPinning?: boolean;
414
+ enableRowPinning?: boolean;
415
+ enableColumnConfiguration?: boolean;
416
+ pageSize?: number;
417
+ loading?: boolean;
418
+ loadingMore?: boolean;
419
+ loadingVariant?: DataTableLoadingVariant;
420
+ skeletonRows?: number;
421
+ error?: React.ReactNode;
422
+ emptyState?: React.ReactNode;
423
+ className?: string;
424
+ tableClassName?: string;
425
+ toolbar?: React.ReactNode | ((table: Table<TData>) => React.ReactNode);
426
+ toolbarStart?: React.ReactNode;
427
+ toolbarEnd?: React.ReactNode;
428
+ globalFilter?: string;
429
+ defaultGlobalFilter?: string;
430
+ onGlobalFilterChange?: (value: string) => void;
431
+ globalFilterPlaceholder?: string;
432
+ advancedFilter?: DataTableFilterGroup;
433
+ defaultAdvancedFilter?: DataTableFilterGroup;
434
+ onAdvancedFilterChange?: (filter: DataTableFilterGroup | undefined) => void;
435
+ getAdvancedFilterValue?: (row: TData, columnId: string) => unknown;
436
+ rowActions?: (row: Row<TData>) => React.ReactNode;
437
+ inlineCreateRow?: DataTableInlineCreate;
438
+ aggregations?: Record<string, DataTableAggregation>;
439
+ showColumnTotals?: boolean;
440
+ rowTotals?: boolean | DataTableRowTotals<TData>;
441
+ rowPinning?: DataTableRowPinningState;
442
+ defaultRowPinning?: DataTableRowPinningState;
443
+ onRowPinningChange?: (state: DataTableRowPinningState) => void;
444
+ columnSelection?: string[];
445
+ defaultColumnSelection?: string[];
446
+ onColumnSelectionChange?: (columnIds: string[]) => void;
447
+ renderDetailPanel?: (row: Row<TData>) => React.ReactNode;
448
+ getCellColSpan?: (cell: Cell<TData, unknown>, row: Row<TData>) => number | undefined;
449
+ getCellRowSpan?: (cell: Cell<TData, unknown>, row: Row<TData>) => number | undefined;
450
+ getRowClassName?: (row: Row<TData>) => string | undefined;
451
+ getRowStyle?: (row: Row<TData>) => React.CSSProperties | undefined;
452
+ getRowHeight?: (row: Row<TData>) => number | undefined;
453
+ height?: number | string;
454
+ maxHeight?: number | string;
455
+ fullHeight?: boolean;
456
+ autoHeight?: boolean;
457
+ onLoadMore?: () => void;
458
+ hasMore?: boolean;
459
+ loadMoreThreshold?: number;
460
+ onRowOrderChange?: (rows: TData[], rowIds: string[]) => void;
461
+ onColumnOrderChange?: (columnIds: string[]) => void;
462
+ localeText?: Partial<DataTableLocaleText>;
463
+ /** Server-side data adapter. When provided, internal sort/filter/pagination is disabled. */
464
+ serverSide?: {
465
+ state: ServerDataState;
466
+ onStateChange: (state: ServerDataState) => void;
467
+ rowCount: number;
468
+ };
469
+ getRowId?: (row: TData, index: number) => string;
470
+ getSubRows?: (row: TData) => TData[] | undefined;
471
+ onRowSelectionChange?: (state: RowSelectionState) => void;
472
+ onSortingChange?: (state: SortingState) => void;
473
+ /** Imperative ref exposing the underlying TanStack Table instance. */
474
+ tableRef?: React.MutableRefObject<Table<TData> | null>;
475
+ /** Override any built-in sub-component with your own. */
476
+ slots?: DataTableSlots<TData>;
477
+ /** Page size options shown in the rows-per-page selector. */
478
+ pageSizeOptions?: number[];
479
+ /** Show the total row count in the pagination bar. */
480
+ showTotalRows?: boolean;
481
+ /** Overlay shown when the data source has no rows (before any filter/search). */
482
+ noRowsOverlay?: React.ReactNode;
483
+ /** Overlay shown when filters/search produce no results from a non-empty dataset. */
484
+ noResultsOverlay?: React.ReactNode;
485
+ /** Actions shown in the bulk-action bar when one or more rows are selected. */
486
+ bulkActions?: DataTableBulkAction<TData>[];
487
+ /** Structured row action items rendered as a 3-dot dropdown menu in the action column. */
488
+ rowActionMenu?: DataTableRowActionItem<TData>[];
489
+ /** Structured row action items rendered as inline buttons in the action column. */
490
+ rowActionButtons?: DataTableRowActionItem<TData>[];
491
+ /** Ctrl+C on a row also copies that single row (in addition to multi-row copy). */
492
+ enableRowCopy?: boolean;
493
+ /** Add a "Copy column" item to the column context menu. */
494
+ enableColumnCopy?: boolean;
495
+ /** Row/cell density. */
496
+ density?: DataTableDensity;
497
+ defaultDensity?: DataTableDensity;
498
+ enableDensityToggle?: boolean;
499
+ onDensityChange?: (density: DataTableDensity) => void;
500
+ /** Enable tree data — adds visual indentation based on row depth (use with `getSubRows`). */
501
+ treeData?: boolean;
502
+ /** Enable Ctrl+C to copy selected rows as TSV. */
503
+ enableCopyPaste?: boolean;
504
+ onCopy?: (rows: Row<TData>[], text: string) => void;
505
+ /** Custom toolbar action buttons rendered in the right toolbar section. */
506
+ toolbarActions?: DataTableToolbarAction<TData>[];
507
+ /** Callback for a Refresh toolbar action. */
508
+ onRefresh?: () => void;
509
+ /** Return extra CSS class(es) for a specific cell based on its value and row. */
510
+ getCellClassName?: (cell: Cell<TData, unknown>, row: Row<TData>) => string | undefined;
511
+ /** Show a fixed row-number column as the first column (1, 2, 3…). */
512
+ enableRowNumbers?: boolean;
513
+ /** Alternate row background color for readability. */
514
+ striped?: boolean;
515
+ /** Show the full cell value as a tooltip when the cell content is truncated. */
516
+ enableCellTooltip?: boolean;
517
+ /**
518
+ * Persist column order/visibility/sizing, sort, filters, and pagination to
519
+ * localStorage under this key. Restored on mount.
520
+ */
521
+ stateKey?: string;
522
+ /** Show a status bar below the table with row and selection counts. */
523
+ enableStatusBar?: boolean;
524
+ /** Expand the grid to fill the viewport when true (controlled fullscreen). */
525
+ fullscreen?: boolean;
526
+ /** Callback when the user toggles fullscreen from the toolbar button. */
527
+ onFullscreenChange?: (fullscreen: boolean) => void;
528
+ /** Show a fullscreen toggle button in the toolbar. */
529
+ enableFullscreen?: boolean;
530
+ /** Row IDs that show a loading spinner (async row action in progress). */
531
+ loadingRowIds?: string[];
532
+ /** Callback for a Print toolbar button / helper — called before window.print(). */
533
+ onPrint?: () => void;
534
+ /** Column IDs whose header should show a quick-filter input below the label. */
535
+ quickFilterColumns?: string[];
536
+ /** Show a right-click context menu on cells/rows. */
537
+ onCellContextMenu?: (cell: Cell<TData, unknown>, row: Row<TData>, event: React.MouseEvent) => void;
538
+ onRowContextMenu?: (row: Row<TData>, event: React.MouseEvent) => void;
539
+ /** Double-click a column resize handle to auto-size to content. */
540
+ enableColumnAutoSize?: boolean;
541
+ /** Column IDs that cannot be hidden, reordered, or resized. */
542
+ lockedColumns?: string[];
543
+ /** Fired when the user locks or unlocks a column via the column menu. */
544
+ onLockedColumnsChange?: (columnIds: string[]) => void;
545
+ /** Render rows as label/value cards below this Tailwind breakpoint. */
546
+ mobileBreakpoint?: 'sm' | 'md' | 'lg';
547
+ /** Built-in Export dropdown (CSV, JSON, and XLSX). Set to true or provide custom options. */
548
+ enableExport?: boolean | {
549
+ csv?: boolean;
550
+ json?: boolean;
551
+ selectedCsv?: boolean;
552
+ xlsx?: boolean;
553
+ };
554
+ /** Enable the built-in conditional formatting drawer in the toolbar. */
555
+ enableConditionalFormatting?: boolean;
556
+ /** Controlled conditional formatting rules. */
557
+ conditionalFormattingRules?: DataTableConditionalRule[];
558
+ /** Fired when rules change. */
559
+ onConditionalFormattingRulesChange?: (rules: DataTableConditionalRule[]) => void;
560
+ /** Return a status for a row to show a colored left border. */
561
+ getRowStatus?: (row: Row<TData>) => 'success' | 'warning' | 'error' | 'info' | undefined;
562
+ /** Fixed row height (px) or a function returning height per row. */
563
+ rowHeight?: number | ((row: Row<TData>, index: number) => number);
564
+ /** Show active column-filter chips above the table. */
565
+ enableFilterChips?: boolean;
566
+ /** Enable Ctrl+V paste of TSV data into editable cells. */
567
+ enablePaste?: boolean;
568
+ /** Text direction for the grid. */
569
+ dir?: 'ltr' | 'rtl';
570
+ /** Show a keyboard shortcuts modal when ? is pressed. */
571
+ enableKeyboardShortcuts?: boolean;
572
+ /** Interaction mode to start inline editing. */
573
+ editMode?: 'click' | 'dblclick';
574
+ /** Callback fired after a cell edit is committed via valueSetter. */
575
+ onCellEditCommit?: (params: {
576
+ field: string;
577
+ row: TData;
578
+ oldValue: unknown;
579
+ newValue: unknown;
580
+ }) => void;
581
+ /** Enable Ctrl+Z / Ctrl+Y undo-redo for inline edits. */
582
+ enableUndoRedo?: boolean;
583
+ /** Controlled set of row IDs with unsaved changes. */
584
+ dirtyRows?: Set<string>;
585
+ /** Fired when dirty row set changes. */
586
+ onDirtyRowsChange?: (dirtyRows: Set<string>) => void;
587
+ /** Enable cell-range selection. Disables row-selection click behavior on td. */
588
+ enableCellSelection?: boolean;
589
+ /** Fired when cell selection changes. */
590
+ onCellSelectionChange?: (selection: DataTableCellSelection | null) => void;
591
+ /** Show the collapsible right-side tool panel. */
592
+ enableToolPanel?: boolean;
593
+ /** Which tab to open by default in the tool panel. */
594
+ defaultToolPanelTab?: 'columns' | 'filters' | 'stats';
595
+ /** Enable real-time cell flash when data changes. */
596
+ enableLiveData?: boolean;
597
+ /** Field used as row identity for live-data diffing. Default: 'id'. */
598
+ liveDataKey?: keyof TData;
599
+ /** Fired when live-data diff detects updated rows. */
600
+ onLiveDataUpdate?: (updatedRows: TData[]) => void;
601
+ /** Async loader for detail panel content. Cached after first load. */
602
+ loadDetailPanel?: (row: Row<TData>) => Promise<React.ReactNode>;
603
+ /** Maximum number of cached detail panels (LRU). Default: 20. */
604
+ detailPanelCacheSize?: number;
605
+ /** Inject @media print styles that hide toolbar/pagination. */
606
+ enablePrintStyles?: boolean;
607
+ /** Enable pivot mode. When true, a Pivot toolbar button appears. */
608
+ enablePivot?: boolean;
609
+ /** Controlled pivot configuration. When set alongside enablePivot, renders pivot view. */
610
+ pivotConfig?: DataTablePivotConfig;
611
+ /** Fired when pivot config changes from the toolbar panel. */
612
+ onPivotConfigChange?: (config: DataTablePivotConfig) => void;
613
+ /** Enable saved views toolbar button. */
614
+ enableSavedViews?: boolean;
615
+ /** Controlled saved views list. */
616
+ savedViews?: DataTableSavedView[];
617
+ /** Fired when saved views list changes. */
618
+ onSavedViewsChange?: (views: DataTableSavedView[]) => void;
619
+ /** Accessible label for the grid root element. */
620
+ ariaLabel?: string;
621
+ /** ID of an element that labels the grid. */
622
+ ariaLabelledBy?: string;
623
+ /** Show an aggregated stats row pinned below column headers. */
624
+ enableHeaderStats?: boolean;
625
+ /** Per-column stat type override. key = columnId, value = stat type. Defaults: sum for number, count for others. */
626
+ headerStatsConfig?: Partial<Record<string, 'count' | 'sum' | 'avg' | 'min' | 'max' | 'nullCount' | 'unique'>>;
627
+ /** Enable display-mode cell validation using displayValidate on column defs. */
628
+ enableValidation?: boolean;
629
+ /** Fired when validation errors change. */
630
+ onValidationChange?: (errors: DataTableValidationError[]) => void;
631
+ /** Default locale for all columns (overridden per-column). e.g. 'en-US', 'de-DE'. */
632
+ locale?: string;
633
+ }
634
+ declare function DataTable<TData, TValue = unknown>(props: DataTableProps<TData, TValue>): React.JSX.Element;
635
+ interface DataTablePaginationProps<TData> {
636
+ table: Table<TData>;
637
+ localeText?: DataTableLocaleText;
638
+ pageSizeOptions?: number[];
639
+ showTotalRows?: boolean;
640
+ overlayBoundary?: HTMLDivElement | null;
641
+ }
642
+ declare function DataTablePagination<TData>({ table, localeText, pageSizeOptions, showTotalRows, overlayBoundary, }: DataTablePaginationProps<TData>): React.JSX.Element;
643
+ interface DataTableToolbarProps<TData> {
644
+ table: Table<TData>;
645
+ filterColumnId?: string;
646
+ filterPlaceholder?: string;
647
+ globalFilter?: string;
648
+ onGlobalFilterChange?: (value: string) => void;
649
+ children?: React.ReactNode;
650
+ }
651
+ declare function DataTableToolbar<TData>({ table, filterColumnId, filterPlaceholder, globalFilter, onGlobalFilterChange, children, }: DataTableToolbarProps<TData>): React.JSX.Element;
652
+ interface DataTableAdvancedFilterProps<TData> {
653
+ table: Table<TData>;
654
+ filter?: DataTableFilterGroup;
655
+ onFilterChange: (filter: DataTableFilterGroup | undefined) => void;
656
+ localeText?: DataTableLocaleText;
657
+ overlayBoundary?: HTMLDivElement | null;
658
+ }
659
+ declare function DataTableAdvancedFilter<TData>({ table, filter, onFilterChange, localeText, overlayBoundary, }: DataTableAdvancedFilterProps<TData>): React.JSX.Element;
660
+ interface DataTableColumnFilterProps<TData, TValue = unknown> {
661
+ column: Column<TData, TValue>;
662
+ title?: string;
663
+ }
664
+ declare function DataTableColumnFilter<TData, TValue = unknown>({ column, title, }: DataTableColumnFilterProps<TData, TValue>): React.JSX.Element;
665
+ interface DataTableColumnVisibilityProps<TData> {
666
+ table: Table<TData>;
667
+ }
668
+ declare function DataTableColumnVisibility<TData>({ table }: DataTableColumnVisibilityProps<TData>): React.JSX.Element;
669
+ interface DataTableColumnConfigurationProps<TData> {
670
+ table: Table<TData>;
671
+ selectedColumnIds?: string[];
672
+ onSelectedColumnIdsChange?: (columnIds: string[]) => void;
673
+ localeText?: DataTableLocaleText;
674
+ enableColumnSelection?: boolean;
675
+ enableGrouping?: boolean;
676
+ enableColumnPinning?: boolean;
677
+ overlayBoundary?: HTMLDivElement | null;
678
+ }
679
+ declare function DataTableColumnConfiguration<TData>({ table, selectedColumnIds, onSelectedColumnIdsChange, localeText, enableColumnSelection, enableGrouping, enableColumnPinning, overlayBoundary, }: DataTableColumnConfigurationProps<TData>): React.JSX.Element;
680
+ declare function exportToCSV<TData>(table: Table<TData>, filename?: string, options?: {
681
+ onlySelected?: boolean;
682
+ includeHidden?: boolean;
683
+ }): void;
684
+ declare function exportToJSON<TData>(table: Table<TData>, filename?: string, options?: {
685
+ onlySelected?: boolean;
686
+ }): void;
687
+ interface EditableCellProps {
688
+ value: unknown;
689
+ onCommit: (next: unknown) => void;
690
+ type?: 'text' | 'number';
691
+ }
692
+ declare function EditableCell({ value, onCommit, type }: EditableCellProps): React.JSX.Element;
693
+ declare function exportToXLSX<TData>(table: Table<TData>, options?: {
694
+ filename?: string;
695
+ onlySelected?: boolean;
696
+ sheetName?: string;
697
+ }): void;
698
+ interface DataTableToolbarButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color'> {
699
+ tooltip?: string;
700
+ }
701
+ declare function DataTableToolbarButton({ tooltip, children, className, ...props }: DataTableToolbarButtonProps): React.JSX.Element;
702
+
703
+ export { type ColumnStats, DataTable, DataTableAdvancedFilter, type DataTableAdvancedFilterProps, type DataTableAggregation, type DataTableBulkAction, type DataTableCellParams, type DataTableCellSelection, type DataTableColumn, DataTableColumnConfiguration, type DataTableColumnConfigurationProps, type DataTableColumnDef, DataTableColumnFilter, type DataTableColumnFilterProps, type DataTableColumnMenuSlotProps, type DataTableColumnType, DataTableColumnVisibility, type DataTableColumnVisibilityProps, type DataTableConditionalRule, type DataTableDensity, type DataTableFilterGroup, type DataTableFilterItem, type DataTableFilterLogic, type DataTableFilterOperator, type DataTableFilterRule, type DataTableFilterSlotProps, type DataTableHeaderParams, type DataTableInlineCreate, type DataTableLoadingOverlaySlotProps, type DataTableLoadingSkeletonSlotProps, type DataTableLoadingVariant, type DataTableLocaleText, DataTablePagination, type DataTablePivotConfig, type DataTableProps, type DataTableRowActionItem, type DataTableRowPinningState, type DataTableRowTotals, type DataTableSavedView, type DataTableSearchSlotProps, type DataTableSlots, DataTableToolbar, type DataTableToolbarAction, DataTableToolbarButton, type DataTableToolbarButtonProps, type DataTableToolbarProps, type DataTableValidationError, EditableCell, type EditableCellProps, type ServerData, type ServerDataState, exportToCSV, exportToJSON, exportToXLSX };