bolt-table 0.1.0 → 0.1.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 +45 -112
- package/dist/index.d.mts +61 -10
- package/dist/index.d.ts +61 -10
- package/dist/index.js +1163 -592
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1164 -620
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -8
package/README.md
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# bolt-table
|
|
2
2
|
|
|
3
|
-
A high-performance,
|
|
3
|
+
A high-performance, zero-dependency\* React table component built on [TanStack Virtual](https://tanstack.com/virtual). Only the rows visible in the viewport are ever in the DOM — making it fast for datasets of any size.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
\*Only peer dependency is `@tanstack/react-virtual` (+ React). No Tailwind, no CSS framework, no icon library required.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/bolt-table)
|
|
8
|
+
[](./LICENSE)
|
|
7
9
|
|
|
8
10
|
---
|
|
9
11
|
|
|
10
12
|
## Features
|
|
11
13
|
|
|
12
14
|
- **Row virtualization** — only visible rows are rendered, powered by TanStack Virtual
|
|
13
|
-
- **Drag to reorder columns** —
|
|
15
|
+
- **Drag to reorder columns** — custom zero-dependency drag-and-drop (no @dnd-kit needed)
|
|
14
16
|
- **Column pinning** — pin columns to the left or right edge via right-click
|
|
15
17
|
- **Column resizing** — drag the right edge of any header to resize
|
|
16
18
|
- **Column hiding** — hide/show columns via the right-click context menu
|
|
@@ -24,30 +26,25 @@ A high-performance, fully-featured React table component built on [TanStack Virt
|
|
|
24
26
|
- **Empty state** — custom renderer or default "No data" message
|
|
25
27
|
- **Auto height** — table shrinks/grows to fit rows, capped at 10 rows by default
|
|
26
28
|
- **Right-click context menu** — sort, filter, pin, hide, plus custom items
|
|
27
|
-
- **
|
|
29
|
+
- **Theme-agnostic** — works in light and dark mode out of the box, no CSS variables needed
|
|
30
|
+
- **Custom icons** — override any built-in icon via the `icons` prop
|
|
28
31
|
|
|
29
32
|
---
|
|
30
33
|
|
|
31
34
|
## Installation
|
|
32
35
|
|
|
33
36
|
```bash
|
|
34
|
-
npm install @
|
|
37
|
+
npm install bolt-table @tanstack/react-virtual
|
|
35
38
|
```
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
These must be installed separately in your project:
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
npm install @tanstack/react-virtual @dnd-kit/core @dnd-kit/sortable lucide-react
|
|
43
|
-
```
|
|
40
|
+
That's it. No other peer dependencies.
|
|
44
41
|
|
|
45
42
|
---
|
|
46
43
|
|
|
47
44
|
## Quick start
|
|
48
45
|
|
|
49
46
|
```tsx
|
|
50
|
-
import { BoltTable, ColumnType } from '
|
|
47
|
+
import { BoltTable, ColumnType } from 'bolt-table';
|
|
51
48
|
|
|
52
49
|
interface User {
|
|
53
50
|
id: string;
|
|
@@ -83,20 +80,38 @@ export default function App() {
|
|
|
83
80
|
|
|
84
81
|
## Next.js (App Router)
|
|
85
82
|
|
|
86
|
-
BoltTable uses browser APIs and must be wrapped in a client boundary
|
|
83
|
+
BoltTable uses browser APIs and must be wrapped in a client boundary:
|
|
87
84
|
|
|
88
85
|
```tsx
|
|
89
86
|
'use client';
|
|
90
|
-
import { BoltTable } from '
|
|
87
|
+
import { BoltTable } from 'bolt-table';
|
|
91
88
|
```
|
|
92
89
|
|
|
93
90
|
---
|
|
94
91
|
|
|
95
92
|
## Styling
|
|
96
93
|
|
|
97
|
-
BoltTable uses
|
|
94
|
+
BoltTable uses **inline CSS styles** for all defaults — no Tailwind, no CSS variables, no external stylesheets required. It works out of the box in any React project, light or dark mode.
|
|
95
|
+
|
|
96
|
+
You can customize everything via the `styles` and `classNames` props. If your project uses Tailwind, you can pass Tailwind classes through `classNames` and they'll be applied on top of the inline defaults.
|
|
97
|
+
|
|
98
|
+
### Custom icons
|
|
99
|
+
|
|
100
|
+
All built-in icons are inline SVGs. Override any icon via the `icons` prop:
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
import type { BoltTableIcons } from 'bolt-table';
|
|
104
|
+
|
|
105
|
+
<BoltTable
|
|
106
|
+
icons={{
|
|
107
|
+
gripVertical: <MyGripIcon size={12} />,
|
|
108
|
+
sortAsc: <MySortUpIcon size={12} />,
|
|
109
|
+
chevronsLeft: <MyFirstPageIcon size={12} />,
|
|
110
|
+
}}
|
|
111
|
+
/>
|
|
112
|
+
```
|
|
98
113
|
|
|
99
|
-
|
|
114
|
+
Available icon keys: `gripVertical`, `sortAsc`, `sortDesc`, `filter`, `filterClear`, `pin`, `pinOff`, `eyeOff`, `chevronDown`, `chevronLeft`, `chevronRight`, `chevronsLeft`, `chevronsRight`.
|
|
100
115
|
|
|
101
116
|
---
|
|
102
117
|
|
|
@@ -116,7 +131,8 @@ Make sure your project has Tailwind configured and the Shadcn CSS variables defi
|
|
|
116
131
|
| `className` | `string` | `''` | Class name for the outer wrapper |
|
|
117
132
|
| `classNames` | `ClassNamesTypes` | `{}` | Granular class overrides per table region |
|
|
118
133
|
| `styles` | `StylesTypes` | `{}` | Inline style overrides per table region |
|
|
119
|
-
| `
|
|
134
|
+
| `icons` | `BoltTableIcons` | — | Custom icon overrides for built-in SVG icons |
|
|
135
|
+
| `gripIcon` | `ReactNode` | — | Custom drag grip icon (deprecated, use `icons.gripVertical`) |
|
|
120
136
|
| `hideGripIcon` | `boolean` | `false` | Hide the drag grip icon from all headers |
|
|
121
137
|
| `pagination` | `PaginationType \| false` | — | Pagination config, or `false` to disable |
|
|
122
138
|
| `onPaginationChange` | `(page, pageSize) => void` | — | Called when page or page size changes |
|
|
@@ -172,7 +188,6 @@ const columns: ColumnType<User>[] = [
|
|
|
172
188
|
dataIndex: 'name',
|
|
173
189
|
title: 'Name',
|
|
174
190
|
sortable: true,
|
|
175
|
-
// Optional custom comparator:
|
|
176
191
|
sorter: (a, b) => a.name.localeCompare(b.name),
|
|
177
192
|
},
|
|
178
193
|
{
|
|
@@ -180,7 +195,6 @@ const columns: ColumnType<User>[] = [
|
|
|
180
195
|
dataIndex: 'age',
|
|
181
196
|
title: 'Age',
|
|
182
197
|
sortable: true,
|
|
183
|
-
// Default numeric comparator used when sorter is omitted
|
|
184
198
|
},
|
|
185
199
|
];
|
|
186
200
|
|
|
@@ -217,7 +231,6 @@ const columns: ColumnType<User>[] = [
|
|
|
217
231
|
dataIndex: 'status',
|
|
218
232
|
title: 'Status',
|
|
219
233
|
filterable: true,
|
|
220
|
-
// Exact match instead of default substring:
|
|
221
234
|
filterFn: (value, record) => record.status === value,
|
|
222
235
|
},
|
|
223
236
|
];
|
|
@@ -245,11 +258,9 @@ const columns: ColumnType<User>[] = [
|
|
|
245
258
|
```tsx
|
|
246
259
|
<BoltTable
|
|
247
260
|
columns={columns}
|
|
248
|
-
data={allUsers}
|
|
261
|
+
data={allUsers}
|
|
249
262
|
pagination={{ pageSize: 20 }}
|
|
250
|
-
onPaginationChange={(page, size) =>
|
|
251
|
-
setPage(page);
|
|
252
|
-
}}
|
|
263
|
+
onPaginationChange={(page, size) => setPage(page)}
|
|
253
264
|
/>
|
|
254
265
|
```
|
|
255
266
|
|
|
@@ -258,7 +269,7 @@ const columns: ColumnType<User>[] = [
|
|
|
258
269
|
```tsx
|
|
259
270
|
<BoltTable
|
|
260
271
|
columns={columns}
|
|
261
|
-
data={currentPageData}
|
|
272
|
+
data={currentPageData}
|
|
262
273
|
pagination={{
|
|
263
274
|
current: page,
|
|
264
275
|
pageSize: 20,
|
|
@@ -287,10 +298,9 @@ const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
|
|
|
287
298
|
data={data}
|
|
288
299
|
rowKey="id"
|
|
289
300
|
rowSelection={{
|
|
290
|
-
type: 'checkbox',
|
|
301
|
+
type: 'checkbox',
|
|
291
302
|
selectedRowKeys,
|
|
292
303
|
onChange: (keys, rows) => setSelectedRowKeys(keys),
|
|
293
|
-
// Disable selection for specific rows:
|
|
294
304
|
getCheckboxProps: (record) => ({
|
|
295
305
|
disabled: record.status === 'locked',
|
|
296
306
|
}),
|
|
@@ -315,12 +325,9 @@ const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
|
|
|
315
325
|
<pre>{JSON.stringify(record.details, null, 2)}</pre>
|
|
316
326
|
</div>
|
|
317
327
|
),
|
|
318
|
-
// Optional: control expanded state yourself
|
|
319
|
-
// expandedRowKeys={expandedKeys}
|
|
320
|
-
// onExpandedRowsChange={(keys) => setExpandedKeys(keys)}
|
|
321
328
|
}}
|
|
322
|
-
expandedRowHeight={150}
|
|
323
|
-
maxExpandedRowHeight={400}
|
|
329
|
+
expandedRowHeight={150}
|
|
330
|
+
maxExpandedRowHeight={400}
|
|
324
331
|
/>
|
|
325
332
|
```
|
|
326
333
|
|
|
@@ -353,8 +360,6 @@ const loadMore = async () => {
|
|
|
353
360
|
|
|
354
361
|
### Column pinning
|
|
355
362
|
|
|
356
|
-
Pinning via column definition:
|
|
357
|
-
|
|
358
363
|
```tsx
|
|
359
364
|
const columns: ColumnType<User>[] = [
|
|
360
365
|
{ key: 'name', dataIndex: 'name', title: 'Name', pinned: 'left', width: 200 },
|
|
@@ -367,58 +372,6 @@ Users can also pin/unpin columns at runtime via the right-click context menu.
|
|
|
367
372
|
|
|
368
373
|
---
|
|
369
374
|
|
|
370
|
-
### Custom cell rendering
|
|
371
|
-
|
|
372
|
-
```tsx
|
|
373
|
-
const columns: ColumnType<User>[] = [
|
|
374
|
-
{
|
|
375
|
-
key: 'status',
|
|
376
|
-
dataIndex: 'status',
|
|
377
|
-
title: 'Status',
|
|
378
|
-
width: 120,
|
|
379
|
-
render: (value, record) => (
|
|
380
|
-
<span
|
|
381
|
-
style={{
|
|
382
|
-
padding: '2px 8px',
|
|
383
|
-
borderRadius: 4,
|
|
384
|
-
fontSize: 12,
|
|
385
|
-
backgroundColor: record.status === 'active' ? '#d1fae5' : '#fee2e2',
|
|
386
|
-
color: record.status === 'active' ? '#065f46' : '#991b1b',
|
|
387
|
-
}}
|
|
388
|
-
>
|
|
389
|
-
{String(value)}
|
|
390
|
-
</span>
|
|
391
|
-
),
|
|
392
|
-
},
|
|
393
|
-
];
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
---
|
|
397
|
-
|
|
398
|
-
### Custom context menu items
|
|
399
|
-
|
|
400
|
-
```tsx
|
|
401
|
-
<BoltTable
|
|
402
|
-
columns={columns}
|
|
403
|
-
data={data}
|
|
404
|
-
columnContextMenuItems={[
|
|
405
|
-
{
|
|
406
|
-
key: 'copy',
|
|
407
|
-
label: 'Copy column data',
|
|
408
|
-
icon: <CopyIcon className="h-3 w-3" />,
|
|
409
|
-
onClick: (columnKey) => copyColumnToClipboard(columnKey),
|
|
410
|
-
},
|
|
411
|
-
{
|
|
412
|
-
key: 'reset-width',
|
|
413
|
-
label: 'Reset width',
|
|
414
|
-
onClick: (columnKey) => resetColumnWidth(columnKey),
|
|
415
|
-
},
|
|
416
|
-
]}
|
|
417
|
-
/>
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
---
|
|
421
|
-
|
|
422
375
|
### Styling overrides
|
|
423
376
|
|
|
424
377
|
```tsx
|
|
@@ -443,27 +396,6 @@ const columns: ColumnType<User>[] = [
|
|
|
443
396
|
|
|
444
397
|
---
|
|
445
398
|
|
|
446
|
-
### Loading skeleton
|
|
447
|
-
|
|
448
|
-
```tsx
|
|
449
|
-
// Full skeleton on initial load (no data yet)
|
|
450
|
-
<BoltTable
|
|
451
|
-
columns={columns}
|
|
452
|
-
data={[]}
|
|
453
|
-
isLoading={true}
|
|
454
|
-
pagination={{ pageSize: 20 }}
|
|
455
|
-
/>
|
|
456
|
-
|
|
457
|
-
// Layout skeleton before column widths are known
|
|
458
|
-
<BoltTable
|
|
459
|
-
columns={columns}
|
|
460
|
-
data={[]}
|
|
461
|
-
layoutLoading={true}
|
|
462
|
-
/>
|
|
463
|
-
```
|
|
464
|
-
|
|
465
|
-
---
|
|
466
|
-
|
|
467
399
|
### Fixed height (fill parent)
|
|
468
400
|
|
|
469
401
|
By default, BoltTable auto-sizes to its content. To fill a fixed-height container instead:
|
|
@@ -491,11 +423,12 @@ import type {
|
|
|
491
423
|
PaginationType,
|
|
492
424
|
SortDirection,
|
|
493
425
|
DataRecord,
|
|
494
|
-
|
|
426
|
+
BoltTableIcons,
|
|
427
|
+
} from 'bolt-table';
|
|
495
428
|
```
|
|
496
429
|
|
|
497
430
|
---
|
|
498
431
|
|
|
499
432
|
## License
|
|
500
433
|
|
|
501
|
-
MIT © [Venkatesh Sirigineedi](https://github.com/venkateshsirigineedi)
|
|
434
|
+
MIT © [Venkatesh Sirigineedi](https://github.com/venkateshsirigineedi)
|
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,35 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import React$1, { ReactNode, CSSProperties } from 'react';
|
|
3
3
|
import { Virtualizer } from '@tanstack/react-virtual';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Customizable icon overrides for BoltTable.
|
|
7
|
+
* Pass any of these to the `icons` prop on BoltTable to replace the default SVG icons.
|
|
8
|
+
* Each icon should be a pre-sized React node (e.g. an SVG at 12×12px).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <BoltTable
|
|
12
|
+
* icons={{
|
|
13
|
+
* gripVertical: <MyGripIcon size={12} />,
|
|
14
|
+
* sortAsc: <MySortUpIcon size={12} />,
|
|
15
|
+
* }}
|
|
16
|
+
* />
|
|
17
|
+
*/
|
|
18
|
+
interface BoltTableIcons {
|
|
19
|
+
gripVertical?: React$1.ReactNode;
|
|
20
|
+
sortAsc?: React$1.ReactNode;
|
|
21
|
+
sortDesc?: React$1.ReactNode;
|
|
22
|
+
filter?: React$1.ReactNode;
|
|
23
|
+
filterClear?: React$1.ReactNode;
|
|
24
|
+
pin?: React$1.ReactNode;
|
|
25
|
+
pinOff?: React$1.ReactNode;
|
|
26
|
+
eyeOff?: React$1.ReactNode;
|
|
27
|
+
chevronDown?: React$1.ReactNode;
|
|
28
|
+
chevronLeft?: React$1.ReactNode;
|
|
29
|
+
chevronRight?: React$1.ReactNode;
|
|
30
|
+
chevronsLeft?: React$1.ReactNode;
|
|
31
|
+
chevronsRight?: React$1.ReactNode;
|
|
32
|
+
}
|
|
33
|
+
|
|
5
34
|
/**
|
|
6
35
|
* The direction of a column sort.
|
|
7
36
|
*
|
|
@@ -249,7 +278,7 @@ interface ColumnContextMenuItem {
|
|
|
249
278
|
label: React.ReactNode;
|
|
250
279
|
/**
|
|
251
280
|
* Optional icon shown to the left of the label.
|
|
252
|
-
* Recommended size: 12–14px
|
|
281
|
+
* Recommended size: 12–14px .
|
|
253
282
|
*
|
|
254
283
|
* @example
|
|
255
284
|
* icon: <CopyIcon className="h-3 w-3" />
|
|
@@ -709,13 +738,28 @@ interface BoltTableProps<T extends DataRecord = DataRecord> {
|
|
|
709
738
|
readonly styles?: StylesTypes;
|
|
710
739
|
/**
|
|
711
740
|
* A custom React node to use as the drag grip icon in column headers.
|
|
712
|
-
* When omitted, the default
|
|
741
|
+
* When omitted, the default GripVertical SVG icon is used.
|
|
713
742
|
* Ignored when `hideGripIcon` is `true`.
|
|
714
743
|
*
|
|
744
|
+
* @deprecated Use `icons.gripVertical` instead. This prop is kept for backward compatibility.
|
|
745
|
+
*
|
|
715
746
|
* @example
|
|
716
|
-
* gripIcon={<DragHandleIcon
|
|
747
|
+
* gripIcon={<DragHandleIcon style={{ width: 12, height: 12 }} />}
|
|
717
748
|
*/
|
|
718
749
|
readonly gripIcon?: React$1.ReactNode;
|
|
750
|
+
/**
|
|
751
|
+
* Custom icon overrides for the table's built-in icons.
|
|
752
|
+
* Pass any subset of icons to replace the defaults. Unspecified icons use
|
|
753
|
+
* the built-in SVG icons. Each icon should be a pre-sized React node.
|
|
754
|
+
*
|
|
755
|
+
* @example
|
|
756
|
+
* icons={{
|
|
757
|
+
* gripVertical: <MyGripIcon size={12} />,
|
|
758
|
+
* sortAsc: <MySortUpIcon size={12} />,
|
|
759
|
+
* chevronsLeft: <MyFirstPageIcon size={12} />,
|
|
760
|
+
* }}
|
|
761
|
+
*/
|
|
762
|
+
readonly icons?: BoltTableIcons;
|
|
719
763
|
/**
|
|
720
764
|
* When `true`, the drag grip icon is hidden from all column headers.
|
|
721
765
|
* Columns can still be dragged even without the grip icon.
|
|
@@ -1166,7 +1210,7 @@ interface StylesTypes {
|
|
|
1166
1210
|
* autoHeight={false}
|
|
1167
1211
|
* />
|
|
1168
1212
|
*/
|
|
1169
|
-
declare function BoltTable<T extends DataRecord = DataRecord>({ columns: initialColumns, data, rowHeight, expandedRowHeight, maxExpandedRowHeight, accentColor, className, classNames, styles, gripIcon, hideGripIcon, pagination, onPaginationChange, onColumnResize, onColumnOrderChange, onColumnPin, onColumnHide, rowSelection, expandable, rowKey, onEndReached, onEndReachedThreshold, isLoading, onSortChange, onFilterChange, columnContextMenuItems, autoHeight, layoutLoading, emptyRenderer, }: BoltTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
1213
|
+
declare function BoltTable<T extends DataRecord = DataRecord>({ columns: initialColumns, data, rowHeight, expandedRowHeight, maxExpandedRowHeight, accentColor, className, classNames, styles, gripIcon, hideGripIcon, icons, pagination, onPaginationChange, onColumnResize, onColumnOrderChange, onColumnPin, onColumnHide, rowSelection, expandable, rowKey, onEndReached, onEndReachedThreshold, isLoading, onSortChange, onFilterChange, columnContextMenuItems, autoHeight, layoutLoading, emptyRenderer, }: BoltTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
1170
1214
|
|
|
1171
1215
|
/**
|
|
1172
1216
|
* Props for the DraggableHeader component.
|
|
@@ -1194,11 +1238,13 @@ interface DraggableHeaderProps {
|
|
|
1194
1238
|
/**
|
|
1195
1239
|
* Called when the user presses down on the resize handle at the right edge
|
|
1196
1240
|
* of this header cell. Starts the resize drag operation in BoltTable.
|
|
1197
|
-
*
|
|
1198
|
-
* @param columnKey - The key of the column being resized
|
|
1199
|
-
* @param event - The React mouse event from the resize handle mousedown
|
|
1200
1241
|
*/
|
|
1201
1242
|
onResizeStart?: (columnKey: string, event: React$1.MouseEvent) => void;
|
|
1243
|
+
/**
|
|
1244
|
+
* Called when the user starts dragging this column header to reorder.
|
|
1245
|
+
* BoltTable handles the full drag lifecycle from this point.
|
|
1246
|
+
*/
|
|
1247
|
+
onColumnDragStart?: (columnKey: string, event: React$1.PointerEvent) => void;
|
|
1202
1248
|
/**
|
|
1203
1249
|
* Shared styling overrides for header cells.
|
|
1204
1250
|
* `styles.header` applies to all headers; `styles.pinnedHeader` applies
|
|
@@ -1220,7 +1266,7 @@ interface DraggableHeaderProps {
|
|
|
1220
1266
|
hideGripIcon?: boolean;
|
|
1221
1267
|
/**
|
|
1222
1268
|
* A custom React node to use as the drag grip icon.
|
|
1223
|
-
* When omitted, the default `GripVertical` icon
|
|
1269
|
+
* When omitted, the default `GripVertical` icon is used.
|
|
1224
1270
|
*
|
|
1225
1271
|
* @example
|
|
1226
1272
|
* gripIcon={<MyCustomDragIcon />}
|
|
@@ -1307,6 +1353,11 @@ interface DraggableHeaderProps {
|
|
|
1307
1353
|
* ]}
|
|
1308
1354
|
*/
|
|
1309
1355
|
customContextMenuItems?: ColumnContextMenuItem[];
|
|
1356
|
+
/**
|
|
1357
|
+
* Custom icon overrides from BoltTable's `icons` prop.
|
|
1358
|
+
* Passed through automatically — do not set manually.
|
|
1359
|
+
*/
|
|
1360
|
+
icons?: BoltTableIcons;
|
|
1310
1361
|
}
|
|
1311
1362
|
/**
|
|
1312
1363
|
* DraggableHeader — a single column header cell for BoltTable.
|
|
@@ -1326,7 +1377,7 @@ interface DraggableHeaderProps {
|
|
|
1326
1377
|
*
|
|
1327
1378
|
* @internal This is an internal BoltTable component. Use BoltTable directly.
|
|
1328
1379
|
*/
|
|
1329
|
-
declare const DraggableHeader: React$1.MemoExoticComponent<({ column, visualIndex, accentColor, onResizeStart, styles, classNames, hideGripIcon, gripIcon, stickyOffset, onTogglePin, onToggleHide, isLastColumn, sortDirection, onSort, filterValue, onFilter, onClearFilter, customContextMenuItems, }: DraggableHeaderProps) => react_jsx_runtime.JSX.Element>;
|
|
1380
|
+
declare const DraggableHeader: React$1.MemoExoticComponent<({ column, visualIndex, accentColor, onResizeStart, styles, classNames, hideGripIcon, gripIcon, stickyOffset, onTogglePin, onToggleHide, isLastColumn, sortDirection, onSort, filterValue, onFilter, onClearFilter, customContextMenuItems, icons, onColumnDragStart, }: DraggableHeaderProps) => react_jsx_runtime.JSX.Element>;
|
|
1330
1381
|
|
|
1331
1382
|
/**
|
|
1332
1383
|
* The imperative handle exposed by ResizeOverlay via `ref`.
|
|
@@ -1539,4 +1590,4 @@ interface TableBodyProps {
|
|
|
1539
1590
|
*/
|
|
1540
1591
|
declare const TableBody: React$1.FC<TableBodyProps>;
|
|
1541
1592
|
|
|
1542
|
-
export { BoltTable, type ColumnContextMenuItem, type ColumnType, type DataRecord, DraggableHeader, type ExpandableConfig, type PaginationType, ResizeOverlay, type RowSelectionConfig, type SortDirection, TableBody };
|
|
1593
|
+
export { BoltTable, type BoltTableIcons, type ColumnContextMenuItem, type ColumnType, type DataRecord, DraggableHeader, type ExpandableConfig, type PaginationType, ResizeOverlay, type RowSelectionConfig, type SortDirection, TableBody };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,35 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import React$1, { ReactNode, CSSProperties } from 'react';
|
|
3
3
|
import { Virtualizer } from '@tanstack/react-virtual';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Customizable icon overrides for BoltTable.
|
|
7
|
+
* Pass any of these to the `icons` prop on BoltTable to replace the default SVG icons.
|
|
8
|
+
* Each icon should be a pre-sized React node (e.g. an SVG at 12×12px).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <BoltTable
|
|
12
|
+
* icons={{
|
|
13
|
+
* gripVertical: <MyGripIcon size={12} />,
|
|
14
|
+
* sortAsc: <MySortUpIcon size={12} />,
|
|
15
|
+
* }}
|
|
16
|
+
* />
|
|
17
|
+
*/
|
|
18
|
+
interface BoltTableIcons {
|
|
19
|
+
gripVertical?: React$1.ReactNode;
|
|
20
|
+
sortAsc?: React$1.ReactNode;
|
|
21
|
+
sortDesc?: React$1.ReactNode;
|
|
22
|
+
filter?: React$1.ReactNode;
|
|
23
|
+
filterClear?: React$1.ReactNode;
|
|
24
|
+
pin?: React$1.ReactNode;
|
|
25
|
+
pinOff?: React$1.ReactNode;
|
|
26
|
+
eyeOff?: React$1.ReactNode;
|
|
27
|
+
chevronDown?: React$1.ReactNode;
|
|
28
|
+
chevronLeft?: React$1.ReactNode;
|
|
29
|
+
chevronRight?: React$1.ReactNode;
|
|
30
|
+
chevronsLeft?: React$1.ReactNode;
|
|
31
|
+
chevronsRight?: React$1.ReactNode;
|
|
32
|
+
}
|
|
33
|
+
|
|
5
34
|
/**
|
|
6
35
|
* The direction of a column sort.
|
|
7
36
|
*
|
|
@@ -249,7 +278,7 @@ interface ColumnContextMenuItem {
|
|
|
249
278
|
label: React.ReactNode;
|
|
250
279
|
/**
|
|
251
280
|
* Optional icon shown to the left of the label.
|
|
252
|
-
* Recommended size: 12–14px
|
|
281
|
+
* Recommended size: 12–14px .
|
|
253
282
|
*
|
|
254
283
|
* @example
|
|
255
284
|
* icon: <CopyIcon className="h-3 w-3" />
|
|
@@ -709,13 +738,28 @@ interface BoltTableProps<T extends DataRecord = DataRecord> {
|
|
|
709
738
|
readonly styles?: StylesTypes;
|
|
710
739
|
/**
|
|
711
740
|
* A custom React node to use as the drag grip icon in column headers.
|
|
712
|
-
* When omitted, the default
|
|
741
|
+
* When omitted, the default GripVertical SVG icon is used.
|
|
713
742
|
* Ignored when `hideGripIcon` is `true`.
|
|
714
743
|
*
|
|
744
|
+
* @deprecated Use `icons.gripVertical` instead. This prop is kept for backward compatibility.
|
|
745
|
+
*
|
|
715
746
|
* @example
|
|
716
|
-
* gripIcon={<DragHandleIcon
|
|
747
|
+
* gripIcon={<DragHandleIcon style={{ width: 12, height: 12 }} />}
|
|
717
748
|
*/
|
|
718
749
|
readonly gripIcon?: React$1.ReactNode;
|
|
750
|
+
/**
|
|
751
|
+
* Custom icon overrides for the table's built-in icons.
|
|
752
|
+
* Pass any subset of icons to replace the defaults. Unspecified icons use
|
|
753
|
+
* the built-in SVG icons. Each icon should be a pre-sized React node.
|
|
754
|
+
*
|
|
755
|
+
* @example
|
|
756
|
+
* icons={{
|
|
757
|
+
* gripVertical: <MyGripIcon size={12} />,
|
|
758
|
+
* sortAsc: <MySortUpIcon size={12} />,
|
|
759
|
+
* chevronsLeft: <MyFirstPageIcon size={12} />,
|
|
760
|
+
* }}
|
|
761
|
+
*/
|
|
762
|
+
readonly icons?: BoltTableIcons;
|
|
719
763
|
/**
|
|
720
764
|
* When `true`, the drag grip icon is hidden from all column headers.
|
|
721
765
|
* Columns can still be dragged even without the grip icon.
|
|
@@ -1166,7 +1210,7 @@ interface StylesTypes {
|
|
|
1166
1210
|
* autoHeight={false}
|
|
1167
1211
|
* />
|
|
1168
1212
|
*/
|
|
1169
|
-
declare function BoltTable<T extends DataRecord = DataRecord>({ columns: initialColumns, data, rowHeight, expandedRowHeight, maxExpandedRowHeight, accentColor, className, classNames, styles, gripIcon, hideGripIcon, pagination, onPaginationChange, onColumnResize, onColumnOrderChange, onColumnPin, onColumnHide, rowSelection, expandable, rowKey, onEndReached, onEndReachedThreshold, isLoading, onSortChange, onFilterChange, columnContextMenuItems, autoHeight, layoutLoading, emptyRenderer, }: BoltTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
1213
|
+
declare function BoltTable<T extends DataRecord = DataRecord>({ columns: initialColumns, data, rowHeight, expandedRowHeight, maxExpandedRowHeight, accentColor, className, classNames, styles, gripIcon, hideGripIcon, icons, pagination, onPaginationChange, onColumnResize, onColumnOrderChange, onColumnPin, onColumnHide, rowSelection, expandable, rowKey, onEndReached, onEndReachedThreshold, isLoading, onSortChange, onFilterChange, columnContextMenuItems, autoHeight, layoutLoading, emptyRenderer, }: BoltTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
1170
1214
|
|
|
1171
1215
|
/**
|
|
1172
1216
|
* Props for the DraggableHeader component.
|
|
@@ -1194,11 +1238,13 @@ interface DraggableHeaderProps {
|
|
|
1194
1238
|
/**
|
|
1195
1239
|
* Called when the user presses down on the resize handle at the right edge
|
|
1196
1240
|
* of this header cell. Starts the resize drag operation in BoltTable.
|
|
1197
|
-
*
|
|
1198
|
-
* @param columnKey - The key of the column being resized
|
|
1199
|
-
* @param event - The React mouse event from the resize handle mousedown
|
|
1200
1241
|
*/
|
|
1201
1242
|
onResizeStart?: (columnKey: string, event: React$1.MouseEvent) => void;
|
|
1243
|
+
/**
|
|
1244
|
+
* Called when the user starts dragging this column header to reorder.
|
|
1245
|
+
* BoltTable handles the full drag lifecycle from this point.
|
|
1246
|
+
*/
|
|
1247
|
+
onColumnDragStart?: (columnKey: string, event: React$1.PointerEvent) => void;
|
|
1202
1248
|
/**
|
|
1203
1249
|
* Shared styling overrides for header cells.
|
|
1204
1250
|
* `styles.header` applies to all headers; `styles.pinnedHeader` applies
|
|
@@ -1220,7 +1266,7 @@ interface DraggableHeaderProps {
|
|
|
1220
1266
|
hideGripIcon?: boolean;
|
|
1221
1267
|
/**
|
|
1222
1268
|
* A custom React node to use as the drag grip icon.
|
|
1223
|
-
* When omitted, the default `GripVertical` icon
|
|
1269
|
+
* When omitted, the default `GripVertical` icon is used.
|
|
1224
1270
|
*
|
|
1225
1271
|
* @example
|
|
1226
1272
|
* gripIcon={<MyCustomDragIcon />}
|
|
@@ -1307,6 +1353,11 @@ interface DraggableHeaderProps {
|
|
|
1307
1353
|
* ]}
|
|
1308
1354
|
*/
|
|
1309
1355
|
customContextMenuItems?: ColumnContextMenuItem[];
|
|
1356
|
+
/**
|
|
1357
|
+
* Custom icon overrides from BoltTable's `icons` prop.
|
|
1358
|
+
* Passed through automatically — do not set manually.
|
|
1359
|
+
*/
|
|
1360
|
+
icons?: BoltTableIcons;
|
|
1310
1361
|
}
|
|
1311
1362
|
/**
|
|
1312
1363
|
* DraggableHeader — a single column header cell for BoltTable.
|
|
@@ -1326,7 +1377,7 @@ interface DraggableHeaderProps {
|
|
|
1326
1377
|
*
|
|
1327
1378
|
* @internal This is an internal BoltTable component. Use BoltTable directly.
|
|
1328
1379
|
*/
|
|
1329
|
-
declare const DraggableHeader: React$1.MemoExoticComponent<({ column, visualIndex, accentColor, onResizeStart, styles, classNames, hideGripIcon, gripIcon, stickyOffset, onTogglePin, onToggleHide, isLastColumn, sortDirection, onSort, filterValue, onFilter, onClearFilter, customContextMenuItems, }: DraggableHeaderProps) => react_jsx_runtime.JSX.Element>;
|
|
1380
|
+
declare const DraggableHeader: React$1.MemoExoticComponent<({ column, visualIndex, accentColor, onResizeStart, styles, classNames, hideGripIcon, gripIcon, stickyOffset, onTogglePin, onToggleHide, isLastColumn, sortDirection, onSort, filterValue, onFilter, onClearFilter, customContextMenuItems, icons, onColumnDragStart, }: DraggableHeaderProps) => react_jsx_runtime.JSX.Element>;
|
|
1330
1381
|
|
|
1331
1382
|
/**
|
|
1332
1383
|
* The imperative handle exposed by ResizeOverlay via `ref`.
|
|
@@ -1539,4 +1590,4 @@ interface TableBodyProps {
|
|
|
1539
1590
|
*/
|
|
1540
1591
|
declare const TableBody: React$1.FC<TableBodyProps>;
|
|
1541
1592
|
|
|
1542
|
-
export { BoltTable, type ColumnContextMenuItem, type ColumnType, type DataRecord, DraggableHeader, type ExpandableConfig, type PaginationType, ResizeOverlay, type RowSelectionConfig, type SortDirection, TableBody };
|
|
1593
|
+
export { BoltTable, type BoltTableIcons, type ColumnContextMenuItem, type ColumnType, type DataRecord, DraggableHeader, type ExpandableConfig, type PaginationType, ResizeOverlay, type RowSelectionConfig, type SortDirection, TableBody };
|