bolt-table 0.1.40 → 0.1.42
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 +37 -1453
- package/dist/index.d.mts +197 -45
- package/dist/index.d.ts +197 -45
- package/dist/index.js +95 -5484
- package/dist/index.mjs +95 -5454
- package/package.json +7 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import React
|
|
2
|
+
import React, { ReactNode, CSSProperties } from 'react';
|
|
3
3
|
import { Virtualizer } from '@tanstack/react-virtual';
|
|
4
4
|
|
|
5
5
|
/** Customizable icon overrides for BoltTable. */
|
|
6
6
|
interface BoltTableIcons {
|
|
7
|
-
gripVertical?: React
|
|
8
|
-
sortAsc?: React
|
|
9
|
-
sortDesc?: React
|
|
10
|
-
filter?: React
|
|
11
|
-
filterClear?: React
|
|
12
|
-
pin?: React
|
|
13
|
-
pinOff?: React
|
|
14
|
-
eyeOff?: React
|
|
15
|
-
chevronDown?: React
|
|
16
|
-
chevronLeft?: React
|
|
17
|
-
chevronRight?: React
|
|
18
|
-
chevronsLeft?: React
|
|
19
|
-
chevronsRight?: React
|
|
20
|
-
copy?: React
|
|
21
|
-
edit?: React
|
|
22
|
-
search?: React
|
|
23
|
-
columns?: React
|
|
24
|
-
close?: React
|
|
25
|
-
sparkles?: React
|
|
26
|
-
send?: React
|
|
27
|
-
loader?: React
|
|
7
|
+
gripVertical?: React.ReactNode;
|
|
8
|
+
sortAsc?: React.ReactNode;
|
|
9
|
+
sortDesc?: React.ReactNode;
|
|
10
|
+
filter?: React.ReactNode;
|
|
11
|
+
filterClear?: React.ReactNode;
|
|
12
|
+
pin?: React.ReactNode;
|
|
13
|
+
pinOff?: React.ReactNode;
|
|
14
|
+
eyeOff?: React.ReactNode;
|
|
15
|
+
chevronDown?: React.ReactNode;
|
|
16
|
+
chevronLeft?: React.ReactNode;
|
|
17
|
+
chevronRight?: React.ReactNode;
|
|
18
|
+
chevronsLeft?: React.ReactNode;
|
|
19
|
+
chevronsRight?: React.ReactNode;
|
|
20
|
+
copy?: React.ReactNode;
|
|
21
|
+
edit?: React.ReactNode;
|
|
22
|
+
search?: React.ReactNode;
|
|
23
|
+
columns?: React.ReactNode;
|
|
24
|
+
close?: React.ReactNode;
|
|
25
|
+
sparkles?: React.ReactNode;
|
|
26
|
+
send?: React.ReactNode;
|
|
27
|
+
loader?: React.ReactNode;
|
|
28
|
+
maximize?: React.ReactNode;
|
|
29
|
+
minimize?: React.ReactNode;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
/** `'asc'` | `'desc'` | `null` — the direction of a column sort. */
|
|
@@ -52,6 +54,8 @@ interface ColumnType<T = unknown> {
|
|
|
52
54
|
sorter?: boolean | ((a: T, b: T) => number);
|
|
53
55
|
/** Whether this column shows a filter control. Defaults to `true`. */
|
|
54
56
|
filterable?: boolean;
|
|
57
|
+
/** Type of filter UI to show. `"text"` (default) shows a text input, `"dateRange"` shows from/to date pickers, `"numberRange"` shows min/max number inputs. */
|
|
58
|
+
filterType?: "text" | "dateRange" | "numberRange";
|
|
55
59
|
/**
|
|
56
60
|
* Client-side filter predicate. Return `true` to keep the row.
|
|
57
61
|
* Falls back to case-insensitive substring match when not provided.
|
|
@@ -80,6 +84,15 @@ interface ColumnType<T = unknown> {
|
|
|
80
84
|
columnCellContextMenuItems?: CellContextMenuItem<T>[];
|
|
81
85
|
/** When `true`, cells without a custom `render` become inline-editable on double-click. Requires the table-level `onEdit` callback. */
|
|
82
86
|
editable?: boolean;
|
|
87
|
+
/** Type of editor to use for editable cells. Defaults to `"text"`. */
|
|
88
|
+
editorType?: "text" | "number" | "select" | "date" | "toggle";
|
|
89
|
+
/** Options for the `"select"` editor type. Array of `{ label, value }` or plain strings. */
|
|
90
|
+
editorOptions?: Array<string | {
|
|
91
|
+
label: string;
|
|
92
|
+
value: unknown;
|
|
93
|
+
}>;
|
|
94
|
+
/** Lazy data loader for this column. When provided, cell values are loaded asynchronously. Receives the row record and should return the cell value. */
|
|
95
|
+
lazyLoad?: (record: T) => Promise<unknown>;
|
|
83
96
|
/** Nested child columns. When provided, this column acts as a header group and does not render data cells. Only leaf columns (without `children`) render cells. */
|
|
84
97
|
children?: ColumnType<T>[];
|
|
85
98
|
}
|
|
@@ -198,6 +211,53 @@ interface RowPinningConfig {
|
|
|
198
211
|
}
|
|
199
212
|
/** Base type for row records — all row objects must be indexable by string keys. */
|
|
200
213
|
type DataRecord = Record<string, unknown>;
|
|
214
|
+
/** Configuration for displaying data as a tree/hierarchy with parent-child relationships. */
|
|
215
|
+
interface TreeDataConfig<T = unknown> {
|
|
216
|
+
/** Property name on each row that contains child rows. Defaults to `"children"`. */
|
|
217
|
+
childrenKey?: string;
|
|
218
|
+
/** Indentation width in pixels per nesting level. Defaults to `20`. */
|
|
219
|
+
indentSize?: number;
|
|
220
|
+
/** Row keys that are expanded by default. Omit to collapse all initially. */
|
|
221
|
+
defaultExpandedKeys?: React.Key[];
|
|
222
|
+
/** Controlled set of expanded tree node keys. */
|
|
223
|
+
expandedKeys?: React.Key[];
|
|
224
|
+
/** Called when tree expand state changes. */
|
|
225
|
+
onExpandChange?: (expandedKeys: React.Key[]) => void;
|
|
226
|
+
/** When true, all tree nodes are expanded by default. */
|
|
227
|
+
defaultExpandAll?: boolean;
|
|
228
|
+
/** Custom expand/collapse icon. Receives `(expanded, record, level)`. */
|
|
229
|
+
expandIcon?: (expanded: boolean, record: T, level: number) => React.ReactNode;
|
|
230
|
+
}
|
|
231
|
+
/** Aggregation function type for row grouping. */
|
|
232
|
+
type AggregateFunction = "sum" | "avg" | "count" | "min" | "max" | ((values: unknown[]) => unknown);
|
|
233
|
+
/** Configuration for grouping rows by a column value. */
|
|
234
|
+
interface RowGroupingConfig<T = unknown> {
|
|
235
|
+
/** The column key to group rows by. */
|
|
236
|
+
groupBy: string;
|
|
237
|
+
/** Whether groups are collapsed by default. Defaults to `false`. */
|
|
238
|
+
defaultCollapsed?: boolean;
|
|
239
|
+
/** Controlled set of collapsed group keys. */
|
|
240
|
+
collapsedGroups?: Set<string>;
|
|
241
|
+
/** Called when a group's collapse state changes. */
|
|
242
|
+
onGroupToggle?: (groupKey: string, collapsed: boolean) => void;
|
|
243
|
+
/** Per-column aggregation functions shown in group header rows. Map of columnKey → aggregate function. */
|
|
244
|
+
aggregations?: Record<string, AggregateFunction>;
|
|
245
|
+
/** Custom render for the group header row. Receives group key, rows in group, and aggregate values. */
|
|
246
|
+
groupHeaderRender?: (groupKey: string, groupValue: unknown, rows: T[], aggregates: Record<string, unknown>, collapsed: boolean) => React.ReactNode;
|
|
247
|
+
}
|
|
248
|
+
/** A single declarative conditional formatting rule applied to cells or rows. */
|
|
249
|
+
interface ConditionalFormatRule<T = unknown> {
|
|
250
|
+
/** Which column keys this rule applies to. Omit or pass empty to apply to all columns. */
|
|
251
|
+
columns?: string[];
|
|
252
|
+
/** Return `true` when the rule should activate. Receives `(value, record, columnKey)`. */
|
|
253
|
+
condition: (value: unknown, record: T, columnKey: string) => boolean;
|
|
254
|
+
/** Inline styles applied to matching cells (or rows when `applyToRow` is true). */
|
|
255
|
+
style?: React.CSSProperties;
|
|
256
|
+
/** CSS class name applied to matching cells (or rows when `applyToRow` is true). */
|
|
257
|
+
className?: string;
|
|
258
|
+
/** When true, the style/className applies to the entire row instead of individual cells. */
|
|
259
|
+
applyToRow?: boolean;
|
|
260
|
+
}
|
|
201
261
|
/** Configuration for persisting column state to localStorage. */
|
|
202
262
|
interface ColumnPersistenceConfig {
|
|
203
263
|
/** Unique key used as the localStorage key prefix. Required. */
|
|
@@ -309,6 +369,13 @@ interface BoltTableProps<T extends DataRecord = DataRecord> {
|
|
|
309
369
|
readonly maxExpandedRowHeight?: number;
|
|
310
370
|
/** Primary color for interactive elements (sort indicators, selected rows, checkboxes, etc.). */
|
|
311
371
|
readonly accentColor?: string;
|
|
372
|
+
/**
|
|
373
|
+
* Color scheme hint for the table.
|
|
374
|
+
* - `"auto"` (default): inherits from the parent's computed `color-scheme` or the system preference.
|
|
375
|
+
* - `"dark"`: forces dark mode system colors and form controls.
|
|
376
|
+
* - `"light"`: forces light mode system colors and form controls.
|
|
377
|
+
*/
|
|
378
|
+
readonly theme?: "auto" | "dark" | "light";
|
|
312
379
|
/** Additional CSS class name applied to the outermost wrapper div. */
|
|
313
380
|
readonly className?: string;
|
|
314
381
|
/** Granular CSS class name overrides for specific parts of the table. */
|
|
@@ -316,7 +383,7 @@ interface BoltTableProps<T extends DataRecord = DataRecord> {
|
|
|
316
383
|
/** Inline style overrides for specific parts of the table. */
|
|
317
384
|
readonly styles?: StylesTypes;
|
|
318
385
|
/** @deprecated Use `icons.gripVertical` instead. Custom drag grip icon for column headers. */
|
|
319
|
-
readonly gripIcon?: React
|
|
386
|
+
readonly gripIcon?: React.ReactNode;
|
|
320
387
|
/** Custom icon overrides for the table's built-in icons. */
|
|
321
388
|
readonly icons?: BoltTableIcons;
|
|
322
389
|
/** When true, the drag grip icon is hidden from all column headers. */
|
|
@@ -342,7 +409,7 @@ interface BoltTableProps<T extends DataRecord = DataRecord> {
|
|
|
342
409
|
/** Row pinning configuration. Pass `true` for internal state management, or an object for controlled mode. */
|
|
343
410
|
readonly rowPinning?: RowPinningConfig | boolean;
|
|
344
411
|
/** Called when the user pins or unpins a row via the cell context menu. */
|
|
345
|
-
readonly onRowPin?: (rowKey: React
|
|
412
|
+
readonly onRowPin?: (rowKey: React.Key, pinned: "top" | "bottom" | false) => void;
|
|
346
413
|
/** Called when the user scrolls near the bottom of the table. Use for infinite scroll. */
|
|
347
414
|
readonly onEndReached?: () => void;
|
|
348
415
|
/** How many rows from the end of the list should trigger onEndReached. */
|
|
@@ -351,6 +418,13 @@ interface BoltTableProps<T extends DataRecord = DataRecord> {
|
|
|
351
418
|
readonly isLoading?: boolean;
|
|
352
419
|
/** Called when the user changes sort direction. Provide for server-side sorting. */
|
|
353
420
|
readonly onSortChange?: (columnKey: string, direction: SortDirection) => void;
|
|
421
|
+
/** Enable sorting by multiple columns simultaneously. Hold Shift while clicking sort to add columns. */
|
|
422
|
+
readonly multiSort?: boolean;
|
|
423
|
+
/** Called when the multi-sort state changes. Receives the full ordered array of active sorts. Only fires when `multiSort` is true. */
|
|
424
|
+
readonly onMultiSortChange?: (sorts: ReadonlyArray<{
|
|
425
|
+
columnKey: string;
|
|
426
|
+
direction: SortDirection;
|
|
427
|
+
}>) => void;
|
|
354
428
|
/** Called when the user applies or clears a column filter. Provide for server-side filtering. */
|
|
355
429
|
readonly onFilterChange?: (filters: Record<string, string>) => void;
|
|
356
430
|
/** Custom items to append to the column header right-click context menu. */
|
|
@@ -360,11 +434,21 @@ interface BoltTableProps<T extends DataRecord = DataRecord> {
|
|
|
360
434
|
/** When true, renders a full shimmer skeleton layout before column widths are calculated. */
|
|
361
435
|
readonly layoutLoading?: boolean;
|
|
362
436
|
/** Custom React node to render when the table has no data and is not loading. */
|
|
363
|
-
readonly emptyRenderer?: React
|
|
437
|
+
readonly emptyRenderer?: React.ReactNode;
|
|
438
|
+
/** Declarative conditional formatting rules. Each rule applies styles/classNames to cells or rows matching a condition. */
|
|
439
|
+
readonly conditionalFormatting?: ConditionalFormatRule<T>[];
|
|
440
|
+
/** Group rows by a column value, with collapsible headers and optional aggregations. */
|
|
441
|
+
readonly rowGrouping?: RowGroupingConfig<T>;
|
|
442
|
+
/** Display data as a tree hierarchy. Rows with a `children` array (or custom key) are shown as expandable tree nodes. */
|
|
443
|
+
readonly treeData?: TreeDataConfig<T>;
|
|
444
|
+
/** Show an advanced filter builder button in the toolbar. Allows building complex multi-condition filters visually. */
|
|
445
|
+
readonly enableFilterBuilder?: boolean;
|
|
446
|
+
/** Render a detail panel below the table when a row is clicked. Receives the clicked row record and a close function. */
|
|
447
|
+
readonly masterDetail?: (record: T, close: () => void) => React.ReactNode;
|
|
364
448
|
/** Returns a CSS class name for a given row based on its record and index. Useful for Tailwind or any CSS class-based conditional row styling. */
|
|
365
449
|
readonly rowClassName?: (record: T, index: number) => string;
|
|
366
450
|
/** Returns inline CSS styles for a given row based on its record and index. Useful for dynamic per-row styling. */
|
|
367
|
-
readonly rowStyle?: (record: T, index: number) => React
|
|
451
|
+
readonly rowStyle?: (record: T, index: number) => React.CSSProperties;
|
|
368
452
|
/** When true, removes the filter option from all header column context menus. */
|
|
369
453
|
readonly disabledFilters?: boolean;
|
|
370
454
|
/** Called after a cell value is copied to the clipboard via the context menu. */
|
|
@@ -374,7 +458,7 @@ interface BoltTableProps<T extends DataRecord = DataRecord> {
|
|
|
374
458
|
/** Called when a user finishes editing an editable cell. Receives the new value, the row record, the column's `dataIndex`, and the row index. */
|
|
375
459
|
readonly onEdit?: (value: unknown, record: T, dataIndex: string, rowIndex: number) => void;
|
|
376
460
|
/** Called when a row is clicked. When provided, all row cells show a pointer cursor on hover. */
|
|
377
|
-
readonly onRowClick?: (record: T, index: number, event: React
|
|
461
|
+
readonly onRowClick?: (record: T, index: number, event: React.MouseEvent) => void;
|
|
378
462
|
/** Enable horizontal virtualization for tables with many columns. Only visible columns are rendered. */
|
|
379
463
|
readonly enableColumnVirtualization?: boolean;
|
|
380
464
|
/** Enable dynamic row heights based on content. Uses ResizeObserver to measure actual row heights. */
|
|
@@ -390,9 +474,11 @@ interface BoltTableProps<T extends DataRecord = DataRecord> {
|
|
|
390
474
|
/** Called when the global search value changes. */
|
|
391
475
|
readonly onGlobalSearchChange?: (value: string) => void;
|
|
392
476
|
/** Extra content rendered in the toolbar between the search bar and the column-settings button. */
|
|
393
|
-
readonly toolbarContent?: React
|
|
477
|
+
readonly toolbarContent?: React.ReactNode;
|
|
478
|
+
/** Extra content rendered on the right side of the toolbar, after all built-in buttons. */
|
|
479
|
+
readonly toolbarRight?: React.ReactNode;
|
|
394
480
|
/** Label for the column-settings button. Defaults to "Columns". */
|
|
395
|
-
readonly columnSettingsLabel?: React
|
|
481
|
+
readonly columnSettingsLabel?: React.ReactNode;
|
|
396
482
|
/** Enable the AI assistant button in the toolbar. Requires `aiConfig` or `onAIQuery`. */
|
|
397
483
|
readonly aiMode?: boolean;
|
|
398
484
|
/** AI provider configuration (API key, model, etc.). Used by the built-in AI handler. */
|
|
@@ -407,13 +493,31 @@ interface BoltTableProps<T extends DataRecord = DataRecord> {
|
|
|
407
493
|
/** Placeholder text for the AI search bar. */
|
|
408
494
|
readonly aiPlaceholder?: string;
|
|
409
495
|
/** Label for the AI button. Defaults to "Ask AI". */
|
|
410
|
-
readonly aiButtonLabel?: React
|
|
496
|
+
readonly aiButtonLabel?: React.ReactNode;
|
|
497
|
+
/** Enable smooth CSS transitions on rows when data changes (sort, filter, reorder). Adds `transition: top` on cells. */
|
|
498
|
+
readonly enableRowAnimation?: boolean;
|
|
499
|
+
/** Show a status bar at the bottom of the table with row counts, selection info, etc. */
|
|
500
|
+
readonly showStatusBar?: boolean;
|
|
501
|
+
/** Custom renderer for the status bar. Receives `{ totalRows, filteredRows, selectedRows, currentPage, pageSize }`. When omitted, a default status bar is rendered. */
|
|
502
|
+
readonly statusBarContent?: (info: {
|
|
503
|
+
totalRows: number;
|
|
504
|
+
filteredRows: number;
|
|
505
|
+
selectedRows: number;
|
|
506
|
+
currentPage: number;
|
|
507
|
+
pageSize: number;
|
|
508
|
+
}) => React.ReactNode;
|
|
509
|
+
/** Called when the user clicks the "AI Insights" button. Should return a textual analysis of the data. Falls back to the built-in AI if not provided. */
|
|
510
|
+
readonly onAIInsights?: (data: T[], columns: ColumnType<T>[]) => Promise<string>;
|
|
511
|
+
/** Called when the user clicks the "AI Chart" button. Should return a React node with a chart visualization. When omitted and `aiConfig` is set, the built-in AI generates SVG chart markup. */
|
|
512
|
+
readonly onAIChart?: (data: T[], columns: ColumnType<T>[]) => Promise<React.ReactNode>;
|
|
411
513
|
/** Enable row drag-and-drop reordering. When true, shows a grip handle on each row. Requires `onRowReorder`. */
|
|
412
514
|
readonly rowDragEnabled?: boolean;
|
|
413
515
|
/** Called when the user drops a row into a new position. Receives the old and new index. */
|
|
414
516
|
readonly onRowReorder?: (fromIndex: number, toIndex: number) => void;
|
|
415
517
|
}
|
|
416
518
|
interface ClassNamesTypes {
|
|
519
|
+
/** Applied to the outermost wrapper div. */
|
|
520
|
+
wrapper?: string;
|
|
417
521
|
/** Applied to all non-pinned column header cells. */
|
|
418
522
|
header?: string;
|
|
419
523
|
/** Applied to all body cells (both pinned and non-pinned). */
|
|
@@ -430,6 +534,22 @@ interface ClassNamesTypes {
|
|
|
430
534
|
expandedRow?: string;
|
|
431
535
|
/** Applied to each pinned row's wrapper div. */
|
|
432
536
|
pinnedRow?: string;
|
|
537
|
+
/** Applied to the toolbar bar (search + buttons). */
|
|
538
|
+
toolbar?: string;
|
|
539
|
+
/** Applied to the global search input. */
|
|
540
|
+
searchInput?: string;
|
|
541
|
+
/** Applied to the status bar at the bottom. */
|
|
542
|
+
statusBar?: string;
|
|
543
|
+
/** Applied to the filter builder drawer. */
|
|
544
|
+
filterDrawer?: string;
|
|
545
|
+
/** Applied to the AI input/bar area. */
|
|
546
|
+
aiBar?: string;
|
|
547
|
+
/** Applied to the master-detail panel below the table. */
|
|
548
|
+
masterDetailPanel?: string;
|
|
549
|
+
/** Applied to group header rows (row grouping). */
|
|
550
|
+
groupHeader?: string;
|
|
551
|
+
/** Applied to the empty state container. */
|
|
552
|
+
emptyState?: string;
|
|
433
553
|
/** Applied to the pagination footer wrapper. */
|
|
434
554
|
pagination?: string;
|
|
435
555
|
/** Applied to all pagination navigation buttons (first, prev, next, last). */
|
|
@@ -442,6 +562,8 @@ interface ClassNamesTypes {
|
|
|
442
562
|
paginationInfo?: string;
|
|
443
563
|
}
|
|
444
564
|
interface StylesTypes {
|
|
565
|
+
/** Inline styles for the outermost wrapper div. */
|
|
566
|
+
wrapper?: CSSProperties;
|
|
445
567
|
/** Inline styles for all non-pinned column header cells. */
|
|
446
568
|
header?: CSSProperties;
|
|
447
569
|
/** Inline styles for all body cells. */
|
|
@@ -468,6 +590,22 @@ interface StylesTypes {
|
|
|
468
590
|
pinnedBg?: string;
|
|
469
591
|
/** Inline styles applied to built-in context menu items (sort, filter, pin, copy, etc.). */
|
|
470
592
|
contextMenuItem?: CSSProperties;
|
|
593
|
+
/** Inline styles for the toolbar bar (search + buttons). */
|
|
594
|
+
toolbar?: CSSProperties;
|
|
595
|
+
/** Inline styles for the global search input. */
|
|
596
|
+
searchInput?: CSSProperties;
|
|
597
|
+
/** Inline styles for the status bar at the bottom. */
|
|
598
|
+
statusBar?: CSSProperties;
|
|
599
|
+
/** Inline styles for the filter builder drawer. */
|
|
600
|
+
filterDrawer?: CSSProperties;
|
|
601
|
+
/** Inline styles for the AI input/bar area. */
|
|
602
|
+
aiBar?: CSSProperties;
|
|
603
|
+
/** Inline styles for the master-detail panel below the table. */
|
|
604
|
+
masterDetailPanel?: CSSProperties;
|
|
605
|
+
/** Inline styles for group header rows (row grouping). */
|
|
606
|
+
groupHeader?: CSSProperties;
|
|
607
|
+
/** Inline styles for the empty state container. */
|
|
608
|
+
emptyState?: CSSProperties;
|
|
471
609
|
/** Inline styles for the pagination footer wrapper. */
|
|
472
610
|
pagination?: CSSProperties;
|
|
473
611
|
/** Inline styles for all pagination navigation buttons (first, prev, next, last). */
|
|
@@ -479,7 +617,7 @@ interface StylesTypes {
|
|
|
479
617
|
/** Inline styles for the "X–Y of Z" info text. */
|
|
480
618
|
paginationInfo?: CSSProperties;
|
|
481
619
|
}
|
|
482
|
-
declare function BoltTable<T extends DataRecord = DataRecord>({ columns: rawInitialColumns, data: rawData, rowHeight, expandedRowHeight, maxExpandedRowHeight, accentColor, className, classNames, styles, gripIcon, hideGripIcon, icons, pagination, onPaginationChange, onColumnResize, onColumnOrderChange, onColumnPin, onColumnHide, rowSelection, rowPinning, onRowPin, expandable, rowKey, onEndReached, onEndReachedThreshold, isLoading, onSortChange, onFilterChange, columnContextMenuItems, autoHeight, layoutLoading, emptyRenderer, rowClassName, rowStyle, disabledFilters, onCopy, keepPinnedRowsAcrossPages, onEdit, onRowClick, enableColumnVirtualization, enableDynamicRowHeight, columnPersistence, showColumnSettings, hideGlobalSearch, globalSearchValue, onGlobalSearchChange, toolbarContent, columnSettingsLabel, aiMode, aiConfig, onAIQuery, onAIResponse, aiPlaceholder, aiButtonLabel, rowDragEnabled, onRowReorder, }: BoltTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
620
|
+
declare function BoltTable<T extends DataRecord = DataRecord>({ columns: rawInitialColumns, data: rawData, rowHeight, expandedRowHeight, maxExpandedRowHeight, accentColor, theme, className, classNames, styles, gripIcon, hideGripIcon, icons, pagination, onPaginationChange, onColumnResize, onColumnOrderChange, onColumnPin, onColumnHide, rowSelection, rowPinning, onRowPin, expandable, rowKey, onEndReached, onEndReachedThreshold, isLoading, onSortChange, multiSort, onMultiSortChange, onFilterChange, columnContextMenuItems, autoHeight, layoutLoading, emptyRenderer, rowClassName, rowStyle, conditionalFormatting, rowGrouping, treeData, masterDetail, enableFilterBuilder, disabledFilters, onCopy, keepPinnedRowsAcrossPages, onEdit, onRowClick, enableColumnVirtualization, enableDynamicRowHeight, columnPersistence, showColumnSettings, hideGlobalSearch, globalSearchValue, onGlobalSearchChange, toolbarContent, toolbarRight, columnSettingsLabel, aiMode, aiConfig, onAIQuery, onAIResponse, aiPlaceholder, aiButtonLabel, onAIInsights, onAIChart, enableRowAnimation, showStatusBar, statusBarContent, rowDragEnabled, onRowReorder, }: BoltTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
483
621
|
|
|
484
622
|
interface DraggableHeaderProps {
|
|
485
623
|
/** Column definition for this header cell. */
|
|
@@ -489,9 +627,9 @@ interface DraggableHeaderProps {
|
|
|
489
627
|
/** Accent color for indicators and highlights. */
|
|
490
628
|
accentColor?: string;
|
|
491
629
|
/** Called when the user starts resizing this column. */
|
|
492
|
-
onResizeStart?: (columnKey: string, event: React
|
|
630
|
+
onResizeStart?: (columnKey: string, event: React.MouseEvent) => void;
|
|
493
631
|
/** Called when the user starts dragging this column header. */
|
|
494
|
-
onColumnDragStart?: (columnKey: string, event: React
|
|
632
|
+
onColumnDragStart?: (columnKey: string, event: React.PointerEvent) => void;
|
|
495
633
|
/** Shared styling overrides for header cells. */
|
|
496
634
|
styles?: StylesTypes;
|
|
497
635
|
/** Shared CSS class name overrides for header cells. */
|
|
@@ -499,7 +637,7 @@ interface DraggableHeaderProps {
|
|
|
499
637
|
/** When true, the drag grip icon is hidden. */
|
|
500
638
|
hideGripIcon?: boolean;
|
|
501
639
|
/** Custom React node to use as the drag grip icon. */
|
|
502
|
-
gripIcon?: React
|
|
640
|
+
gripIcon?: React.ReactNode;
|
|
503
641
|
/** Pixel offset from the pinned edge for sticky positioning. */
|
|
504
642
|
stickyOffset?: number;
|
|
505
643
|
/** Called when the user pins or unpins this column. */
|
|
@@ -510,8 +648,10 @@ interface DraggableHeaderProps {
|
|
|
510
648
|
isLastColumn?: boolean;
|
|
511
649
|
/** Current sort direction applied to this column. */
|
|
512
650
|
sortDirection?: SortDirection;
|
|
651
|
+
/** 1-based priority of this column in a multi-column sort. Undefined when not multi-sorting or column is not sorted. */
|
|
652
|
+
sortPriority?: number;
|
|
513
653
|
/** Called when the user clicks a sort option in the context menu. */
|
|
514
|
-
onSort?: (columnKey: string, direction?: SortDirection) => void;
|
|
654
|
+
onSort?: (columnKey: string, direction?: SortDirection, additive?: boolean) => void;
|
|
515
655
|
/** Current filter value active on this column. */
|
|
516
656
|
filterValue?: string;
|
|
517
657
|
/** Called when the user submits a filter value via the context menu. */
|
|
@@ -534,8 +674,10 @@ interface DraggableHeaderProps {
|
|
|
534
674
|
isFirstColumn?: boolean;
|
|
535
675
|
/** Called when the user double-clicks the resize handle to auto-fit column width. */
|
|
536
676
|
onAutoFitColumn?: (columnKey: string) => void;
|
|
677
|
+
/** Whether the table is in dark mode — used for portalled elements that can't inherit wrapper styles. */
|
|
678
|
+
isDark?: boolean;
|
|
537
679
|
}
|
|
538
|
-
declare const DraggableHeader: React
|
|
680
|
+
declare const DraggableHeader: React.MemoExoticComponent<({ column, visualIndex, accentColor, onResizeStart, styles, classNames, hideGripIcon, gripIcon, stickyOffset, onTogglePin, onToggleHide, isLastColumn, sortDirection, sortPriority, onSort, filterValue, onFilter, onClearFilter, customContextMenuItems, icons, onColumnDragStart, disabledFilters, headerGridRow, headerHeight, stickyTop, isFirstColumn, onAutoFitColumn, isDark, }: DraggableHeaderProps) => react_jsx_runtime.JSX.Element>;
|
|
539
681
|
|
|
540
682
|
interface ResizeOverlayHandle {
|
|
541
683
|
show: (viewportX: number, columnName: string, areaRect: DOMRect, headerLeftLocal: number, minSize: number, scrollTop: number, scrollLeft: number, initialLineX: number) => void;
|
|
@@ -546,7 +688,7 @@ interface ResizeOverlayProps {
|
|
|
546
688
|
/** @default '#1778ff' */
|
|
547
689
|
accentColor?: string;
|
|
548
690
|
}
|
|
549
|
-
declare const ResizeOverlay: React
|
|
691
|
+
declare const ResizeOverlay: React.ForwardRefExoticComponent<ResizeOverlayProps & React.RefAttributes<ResizeOverlayHandle>>;
|
|
550
692
|
|
|
551
693
|
interface TableBodyProps {
|
|
552
694
|
/** Current page's row data */
|
|
@@ -568,11 +710,11 @@ interface TableBodyProps {
|
|
|
568
710
|
/** Returns the string key for a given row record and index */
|
|
569
711
|
getRowKey?: (record: DataRecord, index: number) => string;
|
|
570
712
|
/** Returns the original-typed key for a given row record and index */
|
|
571
|
-
getRawRowKey?: (record: DataRecord, index: number) => React
|
|
713
|
+
getRawRowKey?: (record: DataRecord, index: number) => React.Key;
|
|
572
714
|
/** Expandable row configuration */
|
|
573
715
|
expandable?: ExpandableConfig<DataRecord>;
|
|
574
716
|
/** Set of currently expanded row keys */
|
|
575
|
-
resolvedExpandedKeys?: Set<React
|
|
717
|
+
resolvedExpandedKeys?: Set<React.Key>;
|
|
576
718
|
/** Height of each regular row in pixels */
|
|
577
719
|
rowHeight?: number;
|
|
578
720
|
/** Total pixel width of all columns combined */
|
|
@@ -582,7 +724,7 @@ interface TableBodyProps {
|
|
|
582
724
|
/** Accent color for the expand toggle button */
|
|
583
725
|
accentColor?: string;
|
|
584
726
|
/** Ref to the scroll container element */
|
|
585
|
-
scrollContainerRef?: React
|
|
727
|
+
scrollContainerRef?: React.RefObject<HTMLDivElement | null>;
|
|
586
728
|
/** When true, cells render as shimmer skeletons */
|
|
587
729
|
isLoading?: boolean;
|
|
588
730
|
/** Called when an expanded row's content height changes */
|
|
@@ -600,7 +742,7 @@ interface TableBodyProps {
|
|
|
600
742
|
/** Returns a CSS class name for a given row based on its record and index */
|
|
601
743
|
rowClassName?: (record: DataRecord, index: number) => string;
|
|
602
744
|
/** Returns inline CSS styles for a given row based on its record and index */
|
|
603
|
-
rowStyle?: (record: DataRecord, index: number) => React
|
|
745
|
+
rowStyle?: (record: DataRecord, index: number) => React.CSSProperties;
|
|
604
746
|
/** CSS grid row index for the body area. Defaults to 2. Set to 3 when column groups add an extra header row. */
|
|
605
747
|
bodyGridRow?: number;
|
|
606
748
|
/** Called when a user finishes editing an editable cell. */
|
|
@@ -619,10 +761,20 @@ interface TableBodyProps {
|
|
|
619
761
|
/** Maps column key → 1-based CSS grid column index in the full (non-virtualized) grid. Required for correct placement when column virtualization is enabled. */
|
|
620
762
|
columnGridIndexMap?: Map<string, number>;
|
|
621
763
|
/** Optional AI cell style function. Returns extra styles for a specific cell. */
|
|
622
|
-
cellStyleFn?: (record: DataRecord, columnKey: string) => React
|
|
764
|
+
cellStyleFn?: (record: DataRecord, columnKey: string) => React.CSSProperties | undefined;
|
|
623
765
|
/** Called when the user starts dragging a row by its grip handle. */
|
|
624
|
-
onRowDragStart?: (rowIndex: number, e: React
|
|
766
|
+
onRowDragStart?: (rowIndex: number, e: React.PointerEvent) => void;
|
|
767
|
+
/** Enable row position animation on data changes. */
|
|
768
|
+
enableRowAnimation?: boolean;
|
|
769
|
+
/** Called when a group header is clicked to toggle collapse. */
|
|
770
|
+
onGroupToggle?: (groupKey: string) => void;
|
|
771
|
+
/** Accent color for group headers. */
|
|
772
|
+
groupAccentColor?: string;
|
|
773
|
+
/** Called when a tree node expand/collapse is toggled. */
|
|
774
|
+
onTreeToggle?: (key: React.Key) => void;
|
|
775
|
+
/** Tree data indent size in pixels per level. */
|
|
776
|
+
treeIndentSize?: number;
|
|
625
777
|
}
|
|
626
|
-
declare const TableBody: React
|
|
778
|
+
declare const TableBody: React.FC<TableBodyProps>;
|
|
627
779
|
|
|
628
|
-
export { type AICellStyleOperation, type AIColumnVisibilityOperation, type AICondition, type AIFilterOperation, type AIOperation, type AIOperator, type AIPinColumnOperation, type AIReorderColumnsOperation, type AIResizeColumnOperation, type AIResponse, type AISetPageOperation, type AISortOperation, type AIStyleOperation, BoltTable, type BoltTableAIConfig, type BoltTableConfig, type BoltTableIcons, type CellContextMenuItem, type ClassNamesTypes, type ColumnContextMenuItem, type ColumnPersistenceConfig, type ColumnType, type DataRecord, DraggableHeader, type ExpandableConfig, type PaginationType, ResizeOverlay, type RowPinningConfig, type RowSelectionConfig, type SortDirection, type StylesTypes, TableBody, defineConfig };
|
|
780
|
+
export { type AICellStyleOperation, type AIColumnVisibilityOperation, type AICondition, type AIFilterOperation, type AIOperation, type AIOperator, type AIPinColumnOperation, type AIReorderColumnsOperation, type AIResizeColumnOperation, type AIResponse, type AISetPageOperation, type AISortOperation, type AIStyleOperation, type AggregateFunction, BoltTable, type BoltTableAIConfig, type BoltTableConfig, type BoltTableIcons, type CellContextMenuItem, type ClassNamesTypes, type ColumnContextMenuItem, type ColumnPersistenceConfig, type ColumnType, type ConditionalFormatRule, type DataRecord, DraggableHeader, type ExpandableConfig, type PaginationType, ResizeOverlay, type RowGroupingConfig, type RowPinningConfig, type RowSelectionConfig, type SortDirection, type StylesTypes, TableBody, type TreeDataConfig, defineConfig };
|