@bigcapitalhq/blueprintjs-react-table 0.1.0 → 0.3.1
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 +331 -7
- package/dist/blueprintjs-react-table.cjs +6 -0
- package/dist/blueprintjs-react-table.cjs.map +1 -0
- package/dist/blueprintjs-react-table.js +2681 -0
- package/dist/blueprintjs-react-table.js.map +1 -0
- package/dist/styles.css +1 -0
- package/dist/types/components/BP_Table.d.ts +130 -7
- package/dist/types/components/body/TableBody.d.ts +21 -3
- package/dist/types/components/body/TableBodyCell.d.ts +10 -5
- package/dist/types/components/body/TableGhostCells.d.ts +18 -4
- package/dist/types/components/body/TableRowExpander.d.ts +8 -0
- package/dist/types/components/body/TableRowHeaderCell.d.ts +10 -3
- package/dist/types/components/body/TableRowHeaders.d.ts +16 -1
- package/dist/types/components/body/TableRowSelectionCell.d.ts +19 -0
- package/dist/types/components/common/cell-selection.d.ts +57 -0
- package/dist/types/components/common/cellCoordinates.d.ts +25 -4
- package/dist/types/components/common/classes.d.ts +11 -0
- package/dist/types/components/common/dimensions.d.ts +5 -0
- package/dist/types/components/common/menu-context.d.ts +81 -0
- package/dist/types/components/common/pinning.d.ts +44 -0
- package/dist/types/components/common/region.d.ts +26 -0
- package/dist/types/components/common/table-selection-context.d.ts +3 -3
- package/dist/types/components/container/TableContainer.d.ts +12 -4
- package/dist/types/components/head/TableColumnHeaders.d.ts +4 -1
- package/dist/types/components/head/TableHead.d.ts +3 -1
- package/dist/types/components/head/TableRowSelectionHeaderCell.d.ts +13 -0
- package/dist/types/components/layers/TableRegionLayer.d.ts +10 -2
- package/dist/types/components/layers/TableReorderGuides.d.ts +10 -1
- package/dist/types/components/layers/TableResizeGuides.d.ts +18 -5
- package/dist/types/components/pagination/TablePaginationBar.d.ts +30 -0
- package/dist/types/components/pagination/constants.d.ts +4 -0
- package/dist/types/components/pagination/pagination-row-count-context.d.ts +2 -0
- package/dist/types/components/pagination/withPagination.d.ts +51 -0
- package/dist/types/components/quadrant/TableQuadrant.d.ts +42 -10
- package/dist/types/components/quadrant/TableQuadrantStack.d.ts +39 -0
- package/dist/types/components/quadrant/quadrant-type.d.ts +10 -0
- package/dist/types/hooks/use-bp-table-instance.d.ts +33 -0
- package/dist/types/hooks/use-cell-selection.d.ts +62 -0
- package/dist/types/hooks/use-column-header-height.d.ts +24 -0
- package/dist/types/hooks/use-column-reorder.d.ts +7 -3
- package/dist/types/hooks/use-freeze-pinning.d.ts +25 -0
- package/dist/types/hooks/use-row-resizing.d.ts +5 -1
- package/dist/types/hooks/use-row-virtualizer.d.ts +13 -2
- package/dist/types/hooks/use-uncontrolled.d.ts +20 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/types.d.ts +33 -2
- package/package.json +2 -2
- package/dist/types/components/body/TableStaticBody.d.ts +0 -10
- package/dist/types/components/body/VirtualBody.d.ts +0 -12
- package/dist/types/components/quadrant/TableBottomContainer.d.ts +0 -14
- package/dist/types/components/quadrant/TableTopContainer.d.ts +0 -11
- package/dist/types/hooks/use-cell-focus-selection.d.ts +0 -34
package/README.md
CHANGED
|
@@ -9,6 +9,8 @@ A Blueprint.js-styled data table for React, built on [TanStack Table v9](https:/
|
|
|
9
9
|
### Layout & styling
|
|
10
10
|
|
|
11
11
|
- **Quadrant layout** — frozen column headers, row headers, and a scrollable body, rendered with Blueprint table styles.
|
|
12
|
+
- **Optional row headers** — hide the row-number column and the corner menu with `enableRowHeader={false}`, mirroring Blueprint's `enableRowHeader`; the row-selection checkboxes column and frozen columns are unaffected.
|
|
13
|
+
- **Frozen columns & rows** — freeze the leftmost columns (`numFrozenColumns`) and topmost rows (`numFrozenRows`) in place while the rest of the body scrolls, mirroring Blueprint's frozen areas. The column headers and row headers are always frozen, and frozen areas stay correct across column reordering, column visibility, and sorting.
|
|
12
14
|
- **Blueprint.js v6 skin** — cells, headers, selection overlays, and resize/reorder guides all use Blueprint colors and classes, so the table fits naturally into existing Blueprint apps.
|
|
13
15
|
- **Grouped column headers** — nested column definitions render on additional header rows; each group spans its child columns.
|
|
14
16
|
- **Ghost cells** — when the content is smaller than the viewport, leftover space is filled with empty cells (body, column headers, and row headers) instead of a blank background, and scrolling is disabled on the filled axes (`enableGhostCells`).
|
|
@@ -18,10 +20,13 @@ A Blueprint.js-styled data table for React, built on [TanStack Table v9](https:/
|
|
|
18
20
|
- **Column reordering** — drag column headers to reorder columns (`enableColumnReordering`).
|
|
19
21
|
- **Column resizing** — drag the resize handle on header cells (TanStack's `column.getResizeHandler()`).
|
|
20
22
|
- **Sorting** — hover a column header and use the chevron menu for *Sort Asc* / *Sort Desc* / *Clear Sort* (`enableSorting`); controlled or uncontrolled via `state.sorting` / `onSortingChange`.
|
|
21
|
-
- **Focused cell & keyboard navigation** — click a cell to focus it; arrow keys move focus, Shift+arrows extend the selection,
|
|
22
|
-
- **Region selection** — select cells by dragging, or full rows / columns / the whole table from the headers and corner menu; controlled or uncontrolled (`selectedRegions` / `onSelection`, `selectionModes`).
|
|
23
|
+
- **Focused cell & keyboard navigation** — click a cell to focus it; arrow keys move focus, Shift+arrows extend the selection, Tab moves focus, Cmd/Ctrl+A selects everything, and Escape clears the selection (`enableFocusedCell`).
|
|
24
|
+
- **Region selection** — select cells by dragging, or full rows / columns / the whole table from the headers and corner menu; controlled or uncontrolled (`selectedRegions` / `onSelection`, `selectionModes`). Cell ranges are backed by TanStack Table's `cellSelectionFeature`, so drags, Shift-click extend, and Ctrl/Cmd-click multi-range include/exclude come from the plugin, and the selection survives sorting and reordering (it is keyed by row and column ids).
|
|
25
|
+
- **Row selection (checkboxes)** — opt-in checkboxes in a column right after the row numbers, with a select-all checkbox in the column's header (`showRowSelectionCheckboxes`, `rowSelectionColumnWidth`). Controlled or uncontrolled (`rowSelection` / `defaultRowSelection` + `onRowSelectionChange`, `getRowId`); shift-click selects a range, and checked rows are highlighted. This is independent of the region selection above.
|
|
26
|
+
- **Body context menu** — right-click a cell to open a custom Blueprint `Menu` (`bodyContextMenuRenderer`). A right-click outside the current selection selects the clicked cell first, and the renderer receives the selection (or the clicked cell) as a `BP_MenuContext` that also exposes the TanStack row and cell under the cursor.
|
|
23
27
|
- **Row resizing** — drag the horizontal handle at the bottom of a row header (`enableRowResizing`); controlled or uncontrolled, with configurable min/max heights.
|
|
24
28
|
- **Column visibility** — hide/show columns via the controlled `columnVisibility` prop or TanStack's standard state/`enableHiding` options.
|
|
29
|
+
- **Pagination (HOC)** — the `withPagination` higher-order component adds TanStack row pagination and a Blueprint-styled bar below any table component, keeping pagination out of the core table; client-side or manual/server-side (`manualPagination` + `pageCount` / `rowCount`).
|
|
25
30
|
|
|
26
31
|
### Performance & data
|
|
27
32
|
|
|
@@ -70,7 +75,7 @@ npm run storybook
|
|
|
70
75
|
npm run dev
|
|
71
76
|
```
|
|
72
77
|
|
|
73
|
-
Storybook is the primary way to explore the component: it contains stories for the basic table, column groups, loading states, ghost cells, focus & selection, sorting (controlled and uncontrolled), virtualization with 10,000 rows, column visibility, row resizing (controlled and uncontrolled), and editable cells.
|
|
78
|
+
Storybook is the primary way to explore the component: it contains stories for the basic table, column groups, loading states, ghost cells, focus & selection, checkbox row selection, sorting (controlled and uncontrolled), virtualization with 10,000 rows, column visibility, row resizing (controlled and uncontrolled), and editable cells.
|
|
74
79
|
|
|
75
80
|
## Basic usage
|
|
76
81
|
|
|
@@ -121,6 +126,24 @@ Enable Blueprint-style interactions with a few flags:
|
|
|
121
126
|
/>
|
|
122
127
|
```
|
|
123
128
|
|
|
129
|
+
Freeze the leading columns and rows (the column and row headers are always frozen):
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
<BP_Table
|
|
133
|
+
data={data}
|
|
134
|
+
columns={columns}
|
|
135
|
+
numFrozenColumns={2}
|
|
136
|
+
numFrozenRows={1}
|
|
137
|
+
enableRowVirtualization
|
|
138
|
+
/>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
`numFrozenColumns` and `numFrozenRows` are derived from the table's current state: the frozen
|
|
142
|
+
columns are the first N visible columns of the current column order (hiding a column shifts the
|
|
143
|
+
frozen set, and dropping a column inside the frozen area freezes it), and the frozen rows are the
|
|
144
|
+
first N rows of the current row model (so they follow sorting). Power users can also drive the
|
|
145
|
+
regions directly through TanStack's `columnPinning` / `rowPinning` state and `column.pin()`.
|
|
146
|
+
|
|
124
147
|
State can be controlled from outside the table through the standard TanStack props:
|
|
125
148
|
|
|
126
149
|
```tsx
|
|
@@ -135,23 +158,271 @@ const [sorting, setSorting] = useState<SortingState>([]);
|
|
|
135
158
|
/>;
|
|
136
159
|
```
|
|
137
160
|
|
|
161
|
+
Row selection is opt-in and follows the usual controlled/uncontrolled pattern.
|
|
162
|
+
Pass `getRowId` so selection follows the data when the table is sorted or
|
|
163
|
+
paginated:
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
// Uncontrolled: the table owns the selection, seeded by `defaultRowSelection`;
|
|
167
|
+
// `onRowSelectionChange` still reports every change.
|
|
168
|
+
<BP_Table
|
|
169
|
+
data={data}
|
|
170
|
+
columns={columns}
|
|
171
|
+
showRowSelectionCheckboxes
|
|
172
|
+
defaultRowSelection={{ '2': true }}
|
|
173
|
+
getRowId={(person) => String(person.id)}
|
|
174
|
+
onRowSelectionChange={(selection) => console.log(selection)}
|
|
175
|
+
/>;
|
|
176
|
+
|
|
177
|
+
// Controlled: the caller owns the selection through `rowSelection`.
|
|
178
|
+
const [rowSelection, setRowSelection] = useState<BP_RowSelectionState>({});
|
|
179
|
+
|
|
180
|
+
<BP_Table
|
|
181
|
+
data={data}
|
|
182
|
+
columns={columns}
|
|
183
|
+
showRowSelectionCheckboxes
|
|
184
|
+
getRowId={(person) => String(person.id)}
|
|
185
|
+
rowSelection={rowSelection}
|
|
186
|
+
onRowSelectionChange={setRowSelection}
|
|
187
|
+
/>;
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
`rowSelection` is a convenience alias for `state.rowSelection` (and wins when
|
|
191
|
+
both are provided), and `defaultRowSelection` seeds the uncontrolled mode,
|
|
192
|
+
falling back to `initialState.rowSelection`. `onRowSelectionChange` fires in
|
|
193
|
+
both modes, so an uncontrolled table can still report its selection.
|
|
194
|
+
|
|
195
|
+
`showRowSelectionCheckboxes` renders a checkbox column right after the
|
|
196
|
+
row-number column, with a select-all checkbox (and an indeterminate state) in
|
|
197
|
+
its header. Shift clicking a checkbox selects the inclusive range of rows. The
|
|
198
|
+
column is frozen alongside the row numbers; `rowSelectionColumnWidth` adjusts
|
|
199
|
+
its width (default `30`). Selection is separate from the region selection
|
|
200
|
+
(`selectedRegions`): checked rows are highlighted and can be read back with
|
|
201
|
+
TanStack's `table.getSelectedRowModel()`. Selecting a subset of rows with a
|
|
202
|
+
predicate is a regular table option: `enableRowSelection: (row) => …` disables
|
|
203
|
+
the checkbox of non-selectable rows.
|
|
204
|
+
|
|
205
|
+
### Cell clicks and attributes
|
|
206
|
+
|
|
207
|
+
Use `getCellProps` to set HTML attributes on the data cell. This example opens
|
|
208
|
+
account details from any cell, styles every cell of an inactive account, and
|
|
209
|
+
places the account’s test ID on its account-number cell.
|
|
210
|
+
|
|
211
|
+
```tsx
|
|
212
|
+
<BP_Table
|
|
213
|
+
data={accounts}
|
|
214
|
+
columns={columns}
|
|
215
|
+
getCellProps={({ row, column }) => ({
|
|
216
|
+
className: row.original.active ? undefined : 'account-inactive',
|
|
217
|
+
'data-testid': column.id === 'id' ? `account-row-${row.original.id}` : undefined,
|
|
218
|
+
onClick: () => openAccountDetails(row.original),
|
|
219
|
+
})}
|
|
220
|
+
/>
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Cell classes are merged with the column’s `meta.bodyCellClassName`. The table
|
|
224
|
+
controls each cell’s position and dimensions.
|
|
225
|
+
|
|
226
|
+
### Expandable rows
|
|
227
|
+
|
|
228
|
+
Pass `renderRowDetail` to show additional content beneath a row. The disclosure
|
|
229
|
+
button appears in the first visible data column and supports Enter and Space.
|
|
230
|
+
`rowDetailHeight` sets the panel height in pixels (default 100). Longer content
|
|
231
|
+
scrolls inside the panel. With frozen columns, the panel spans the scrollable
|
|
232
|
+
columns, or the frozen columns if all columns are frozen. The example below
|
|
233
|
+
uses a person record with an optional `bio` field.
|
|
234
|
+
|
|
235
|
+
```tsx
|
|
236
|
+
<BP_Table
|
|
237
|
+
data={data}
|
|
238
|
+
columns={columns}
|
|
239
|
+
getRowId={(person) => String(person.id)}
|
|
240
|
+
getRowCanExpand={(row) => Boolean(row.original.bio)}
|
|
241
|
+
renderRowDetail={(row) => <p>{row.original.bio}</p>}
|
|
242
|
+
initialExpandedRows={{ '1': true }}
|
|
243
|
+
rowDetailHeight={80}
|
|
244
|
+
rowExpanderIconProps={{ size: 16 }}
|
|
245
|
+
rowExpanderButtonProps={(row) => ({
|
|
246
|
+
title: `${row.getIsExpanded() ? 'Hide' : 'Read'} biography for ${row.original.name}`,
|
|
247
|
+
})}
|
|
248
|
+
/>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
The button shows `caret-right` when collapsed and `caret-down` when expanded.
|
|
252
|
+
`rowExpanderIconProps` accepts Blueprint `Icon` props, including `icon`,
|
|
253
|
+
`size`, and `color`. `rowExpanderButtonProps` accepts native button props.
|
|
254
|
+
Both accept a props object or a function of the TanStack row. A custom
|
|
255
|
+
`onClick` runs before the row toggles. Call `event.preventDefault()` to
|
|
256
|
+
cancel the toggle.
|
|
257
|
+
|
|
258
|
+
For a tree with the same columns at every level, supply
|
|
259
|
+
`getSubRows={(record) => record.children}`. Parents get a disclosure button,
|
|
260
|
+
and expanded children appear in the row model. Use stable row IDs for both
|
|
261
|
+
trees and detail panels.
|
|
262
|
+
|
|
263
|
+
Expansion is uncontrolled by default. Pass `initialExpandedRows` to choose
|
|
264
|
+
which rows start open. Pass `expandedRows` to control expansion from a parent.
|
|
265
|
+
|
|
266
|
+
```tsx
|
|
267
|
+
const [expandedRows, setExpandedRows] = useState<BP_ExpandedRowsState>({});
|
|
268
|
+
|
|
269
|
+
<BP_Table
|
|
270
|
+
data={data}
|
|
271
|
+
columns={columns}
|
|
272
|
+
getRowId={(person) => String(person.id)}
|
|
273
|
+
renderRowDetail={(row) => <p>{row.original.bio}</p>}
|
|
274
|
+
expandedRows={expandedRows}
|
|
275
|
+
onExpandedRowsChange={setExpandedRows}
|
|
276
|
+
/>;
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
`onExpandedRowsChange` receives the next expansion value in either mode.
|
|
280
|
+
Use a row-ID map to expand specific rows, `{}` to collapse all rows, or
|
|
281
|
+
`true` to expand every eligible row. The standard TanStack `state.expanded`,
|
|
282
|
+
`initialState.expanded`, and `onExpandedChange` options are also supported.
|
|
283
|
+
The dedicated value and initial-value props take precedence over their
|
|
284
|
+
corresponding state options.
|
|
285
|
+
|
|
286
|
+
Right-click context menus are customized with a renderer that receives the
|
|
287
|
+
Blueprint-style `BP_MenuContext` (the equivalent of Blueprint's `MenuContext`)
|
|
288
|
+
and returns the menu to show:
|
|
289
|
+
|
|
290
|
+
```tsx
|
|
291
|
+
import { Menu, MenuItem } from '@blueprintjs/core';
|
|
292
|
+
|
|
293
|
+
<BP_Table
|
|
294
|
+
data={data}
|
|
295
|
+
columns={columns}
|
|
296
|
+
bodyContextMenuRenderer={(context) => (
|
|
297
|
+
<Menu>
|
|
298
|
+
<MenuItem icon="trash" text={`Delete ${context.getTargetRow()?.original.name ?? 'row'}`} />
|
|
299
|
+
<MenuItem icon="clipboard" text={`Copy ${context.getUniqueCells().length} cells`} />
|
|
300
|
+
</Menu>
|
|
301
|
+
)}
|
|
302
|
+
/>;
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
`getTarget()` / `getTargetRow()` / `getTargetCell()` report the right-clicked
|
|
306
|
+
cell, and `getRegions()` / `getSelectedRegions()` report the user-intended
|
|
307
|
+
regions: the current selection when the right-click landed inside it, otherwise
|
|
308
|
+
just the clicked cell. A right-click outside the current selection moves the
|
|
309
|
+
selection (and the focused cell, when `enableFocusedCell` is enabled) to the
|
|
310
|
+
clicked cell before the menu opens. Right-clicks that don't land on a body cell
|
|
311
|
+
(ghost cells, empty space) fall back to the browser's native context menu.
|
|
312
|
+
Pass `enableBodyContextMenu={false}` to disable the custom menu.
|
|
313
|
+
|
|
314
|
+
## Pagination (HOC)
|
|
315
|
+
|
|
316
|
+
Pagination is layered on top of `BP_Table` by the `withPagination` higher-order
|
|
317
|
+
component, so the core table stays pagination-free. The HOC registers TanStack's
|
|
318
|
+
row pagination feature, owns the page state, and renders a Blueprint-styled bar
|
|
319
|
+
below the table:
|
|
320
|
+
|
|
321
|
+
```tsx
|
|
322
|
+
import { BP_Table, withPagination } from 'blueprintjs-react-table';
|
|
323
|
+
|
|
324
|
+
const PaginatedTable = withPagination(BP_Table);
|
|
325
|
+
|
|
326
|
+
<PaginatedTable data={data} columns={columns} initialPageSize={20} />;
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Pagination options (on top of every `BP_TableProps`):
|
|
330
|
+
|
|
331
|
+
| Prop | Type | Default | Description |
|
|
332
|
+
| --- | --- | --- | --- |
|
|
333
|
+
| `initialPageSize` | `number` | `10` | Initial page size for uncontrolled pagination. |
|
|
334
|
+
| `initialPageIndex` | `number` | `0` | Initial zero-based page index for uncontrolled pagination. |
|
|
335
|
+
| `pageSizeOptions` | `readonly number[]` | `[10, 20, 50, 100]` | Page sizes offered by the bar's select. |
|
|
336
|
+
| `showPaginationBar` | `boolean` | `true` | Hide the bar while keeping the table paginated. |
|
|
337
|
+
| `paginationBarClassName` | `string` | — | Class name(s) for the pagination bar. |
|
|
338
|
+
|
|
339
|
+
Pagination becomes controlled when `state.pagination` is provided; pair it with
|
|
340
|
+
`onPaginationChange`:
|
|
341
|
+
|
|
342
|
+
```tsx
|
|
343
|
+
const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 });
|
|
344
|
+
|
|
345
|
+
<PaginatedTable
|
|
346
|
+
data={data}
|
|
347
|
+
columns={columns}
|
|
348
|
+
state={{ pagination }}
|
|
349
|
+
onPaginationChange={setPagination}
|
|
350
|
+
/>;
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
For server-side pagination, pass `manualPagination` plus `pageCount` (or
|
|
354
|
+
`rowCount`) and hand the table only the current page of rows; the table then
|
|
355
|
+
skips client-side slicing and the bar uses the supplied counts:
|
|
356
|
+
|
|
357
|
+
```tsx
|
|
358
|
+
<PaginatedTable
|
|
359
|
+
data={currentPageRows}
|
|
360
|
+
columns={columns}
|
|
361
|
+
manualPagination
|
|
362
|
+
pageCount={totalPageCount}
|
|
363
|
+
rowCount={totalRowCount}
|
|
364
|
+
state={{ pagination }}
|
|
365
|
+
onPaginationChange={setPagination}
|
|
366
|
+
/>;
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
Notes:
|
|
370
|
+
|
|
371
|
+
- Pagination composes with sorting, row virtualization, frozen rows/columns,
|
|
372
|
+
and row resizing. Sorting (or a `data` change) resets to the first page by
|
|
373
|
+
default, per TanStack's `autoResetPageIndex`.
|
|
374
|
+
- Row numbers, ledger striping, and row resizing are **page-local**: each page
|
|
375
|
+
numbers its rows starting at 1. Cell selections are keyed by row ids, so a
|
|
376
|
+
range can light up on every page it overlaps (TanStack's `cellSelectionFeature`
|
|
377
|
+
semantics); the `onSelection` callback reports regions resolved against the
|
|
378
|
+
currently rendered page's rows.
|
|
379
|
+
|
|
380
|
+
### Pagination bar
|
|
381
|
+
|
|
382
|
+
The bar rendered below the table is the exported `TablePaginationBar` component.
|
|
383
|
+
`withPagination` renders it for you, and it can also be used standalone for a
|
|
384
|
+
custom pagination implementation. It is presentational: page state and
|
|
385
|
+
navigation are owned by the caller.
|
|
386
|
+
|
|
387
|
+
| Prop | Type | Default | Description |
|
|
388
|
+
| --- | --- | --- | --- |
|
|
389
|
+
| `pageIndex` | `number` | — | Zero-based index of the current page. |
|
|
390
|
+
| `pageSize` | `number` | — | Number of rows shown per page. |
|
|
391
|
+
| `pageCount` | `number` | — | Total number of pages. `undefined` means the count is unknown (typical for manual pagination without `rowCount`): "last" navigation is disabled and "next" stays enabled. |
|
|
392
|
+
| `rowCount` | `number` | — | Total number of rows across all pages, used for the "1–10 of 240" summary. When `undefined`, the summary is omitted. |
|
|
393
|
+
| `pageSizeOptions` | `readonly number[]` | `[10, 20, 50, 100]` | Page sizes offered by the rows-per-page select. |
|
|
394
|
+
| `onPageIndexChange` | `(pageIndex: number) => void` | — | Invoked with the requested page index when a navigation control is used. |
|
|
395
|
+
| `onPageSizeChange` | `(pageSize: number) => void` | — | Invoked with the requested page size when the rows-per-page select changes. |
|
|
396
|
+
| `className` | `string` | — | Class name(s) for the bar. |
|
|
397
|
+
|
|
138
398
|
## Core props
|
|
139
399
|
|
|
140
400
|
| Prop | Type | Default | Description |
|
|
141
401
|
| --- | --- | --- | --- |
|
|
142
402
|
| `data` / `columns` | TanStack `TableOptions` | — | Table data and column definitions (full TanStack option set is forwarded). |
|
|
403
|
+
| `getCellProps` | `(cell) => props` | — | HTML attributes and event handlers for each rendered data cell. |
|
|
143
404
|
| `rowHeight` | `number` | `20` | Height of each body row, in pixels. |
|
|
144
405
|
| `rowHeaderWidth` | `number` | `30` | Width of the frozen row-header column, in pixels. |
|
|
406
|
+
| `enableRowHeader` | `boolean` | `true` | Render the row-number column; when `false`, the row headers and the corner menu are hidden (the checkbox column and frozen columns are unaffected). |
|
|
145
407
|
| `columnHeaderHeight` | `number` | `30` | Height of the frozen column-header row(s), in pixels. |
|
|
146
408
|
| `enableColumnReordering` | `boolean` | `false` | Drag column headers to reorder columns. |
|
|
147
409
|
| `enableSorting` | `boolean` | `false` | Chevron sort menu on sortable headers; also enables TanStack sorting. |
|
|
148
|
-
| `enableFocusedCell` | `boolean` | `false` | Focused cell with keyboard navigation and selection. |
|
|
410
|
+
| `enableFocusedCell` | `boolean` | `false` | Focused cell with keyboard navigation and selection (arrow keys, Shift+arrows, Tab, Cmd/Ctrl+A, Escape). |
|
|
149
411
|
| `enableGhostCells` | `boolean` | `false` | Fill leftover viewport space with empty cells (body, column headers, row headers) when the content doesn't overflow; scrolling is disabled on filled axes. |
|
|
150
|
-
| `
|
|
412
|
+
| `bodyContextMenuRenderer` | `(context: BP_MenuContext<TData>) => ReactElement \| null \| undefined` | — | Render a custom context menu when right-clicking a body cell. |
|
|
413
|
+
| `enableBodyContextMenu` | `boolean` | `true` when a renderer is set | Whether the body context menu is enabled. |
|
|
414
|
+
| `onFocusedCell` | `(cell: FocusedCellCoordinates) => void` | — | Fires when the focused cell changes. The focused cell is the active cell of TanStack's cell selection feature; it is not controllable directly. |
|
|
151
415
|
| `onFocusedRegion` | `(region) => void` | — | Fires when the focused region changes. |
|
|
152
|
-
| `selectedRegions` / `onSelection` | `Region[]` / callback | — | Controlled region selection. |
|
|
416
|
+
| `selectedRegions` / `onSelection` | `Region[]` / callback | — | Controlled region selection (`selectedRegions`), backed by TanStack's `cellSelection` state; `onSelection` fires in both modes. Full-row/column/table regions are emulated as ranges spanning all visible rows/columns. |
|
|
153
417
|
| `selectionModes` | `RegionCardinality[]` | all | Restricts which selection types are allowed (cells, rows, columns, table). |
|
|
418
|
+
| `showRowSelectionCheckboxes` | `boolean` | `false` | Checkbox column right after the row numbers, with a select-all checkbox in its header; independent of the region selection. |
|
|
419
|
+
| `rowSelectionColumnWidth` | `number` | `30` | Width of the row-selection checkbox column (only used with `showRowSelectionCheckboxes`). |
|
|
420
|
+
| `rowSelection` | `BP_RowSelectionState` | — | Controlled row selection (`true` = selected). Convenience alias for `state.rowSelection`. |
|
|
421
|
+
| `defaultRowSelection` | `BP_RowSelectionState` | — | Initial row selection for the uncontrolled mode; falls back to `initialState.rowSelection`. |
|
|
422
|
+
| `onRowSelectionChange` | `(selection) => void` | — | Fires whenever the row selection changes, in both the controlled and uncontrolled modes. |
|
|
154
423
|
| `enableRowVirtualization` | `boolean` | `false` | Render only visible rows (plus overscan) — scales to very large data sets. |
|
|
424
|
+
| `numFrozenColumns` | `number` | `0` | Freeze the leftmost N columns in place while the rest scroll; derived from the current column order and visibility. |
|
|
425
|
+
| `numFrozenRows` | `number` | `0` | Freeze the topmost N rows in place while the rest scroll; derived from the current row model (so it follows sorting). |
|
|
155
426
|
| `overscanRowCount` | `number` | `5` | Rows rendered above/below the viewport when virtualizing. |
|
|
156
427
|
| `columnVisibility` | `BP_VisibilityState` | — | Controlled column visibility (`true` = visible). Convenience alias for `state.columnVisibility`. |
|
|
157
428
|
| `enableRowResizing` | `boolean` | `false` | Drag the handle on a row header to resize that row. |
|
|
@@ -159,16 +430,63 @@ const [sorting, setSorting] = useState<SortingState>([]);
|
|
|
159
430
|
| `onRowHeightChanged` | `(index, height) => void` | — | Fires continuously during a row-resize drag (and once when it ends). |
|
|
160
431
|
| `minRowHeight` / `maxRowHeight` | `number` | `6` / `100` | Clamps for row resizing. |
|
|
161
432
|
| `loadingOptions` | `TableLoadingOption[]` | `[]` | Renders skeleton placeholders: `CELLS`, `COLUMN_HEADERS`, `ROW_HEADERS`. |
|
|
433
|
+
| `htmlProps` | `HTMLPropsRef<HTMLDivElement>` | — | Standard HTML attributes spread onto the table's outer container `<div>`; `className` is merged with the container classes, and `ref` points at the container (not the scroll viewport). |
|
|
434
|
+
|
|
435
|
+
## Cell selection
|
|
436
|
+
|
|
437
|
+
Cell-range selection is backed by TanStack Table's built-in
|
|
438
|
+
`cellSelectionFeature` plugin: the plugin owns the selection state and the
|
|
439
|
+
mouse interactions (drag selection, Shift-click extend, Ctrl/Cmd-click
|
|
440
|
+
multi-range include/exclude), and `BP_Table` layers the Blueprint experience on
|
|
441
|
+
top — the `selectedRegions` / `onSelection` / `selectionModes` props, full
|
|
442
|
+
row/column/table selection from the headers and corner menu, keyboard
|
|
443
|
+
navigation, and the `BP_MenuContext` API.
|
|
444
|
+
|
|
445
|
+
Things worth knowing:
|
|
446
|
+
|
|
447
|
+
- **Ranges are keyed by row and column ids**, so a selection follows its rows
|
|
448
|
+
when the table is sorted or columns are reordered. Pair the table with
|
|
449
|
+
`getRowId` for stable ids from your data. A range whose corners are
|
|
450
|
+
filtered out or hidden stays in state (inert) and comes back when its rows
|
|
451
|
+
or columns return.
|
|
452
|
+
- **Full-row/column/table selections are emulated** as ranges spanning all
|
|
453
|
+
currently visible rows and/or columns. The cardinality is inferred back on
|
|
454
|
+
read, so `onSelection` and `BP_MenuContext` still report `FULL_ROWS`,
|
|
455
|
+
`FULL_COLUMNS`, and `FULL_TABLE` regions.
|
|
456
|
+
- **`selectedRegions` control** is translated to the plugin's
|
|
457
|
+
`cellSelection` state; regions outside the current row/column counts are
|
|
458
|
+
ignored. TanStack's native `state.cellSelection` / `onCellSelectionChange`
|
|
459
|
+
also pass straight through for consumers that prefer the plugin's API.
|
|
460
|
+
- **Selection resets when `data` changes**, per the plugin's
|
|
461
|
+
`autoResetCellSelection` (default `true`); pass `autoResetCellSelection: false`
|
|
462
|
+
to keep ranges across data changes.
|
|
463
|
+
- The **focused cell** is the plugin's active cell (the anchor of the most
|
|
464
|
+
recent range), reported through `onFocusedCell` / `onFocusedRegion`. Unlike
|
|
465
|
+
the old custom implementation, it is not separately controllable.
|
|
466
|
+
- **Keyboard navigation** (arrow keys, Shift+arrows, Tab, Cmd/Ctrl+A, Escape)
|
|
467
|
+
drives the plugin's `moveCellSelection` / `extendCellSelection` /
|
|
468
|
+
`selectAllCells` / `resetCellSelection` APIs. `Tab` collapses the selection
|
|
469
|
+
onto the neighboring cell.
|
|
470
|
+
- **Drags start on rendered cells only**: ghost cells and rows scrolled out of
|
|
471
|
+
a virtualized window do not start or extend a drag.
|
|
162
472
|
|
|
163
473
|
## Storybook stories
|
|
164
474
|
|
|
165
475
|
| Story | What it demos |
|
|
166
476
|
| --- | --- |
|
|
167
477
|
| `Basic` | Minimal table with column reordering. |
|
|
478
|
+
| `AccountCellClicks` | Open account details from any data cell and style inactive rows. |
|
|
479
|
+
| `RowDetails` | Expand a person to read their biography. |
|
|
480
|
+
| `ControlledRowDetails` | Control row details with the carets and expand-all or collapse-all buttons. |
|
|
481
|
+
| `ExpandingSubRows` | Expand a parent to see its child rows. |
|
|
168
482
|
| `ColumnGroups` | Nested column definitions on a second header row. |
|
|
169
483
|
| `Loading` | Skeleton placeholders in cells, column headers, and row headers. |
|
|
170
484
|
| `GhostCells` | Empty ghost cells fill leftover space when the table is smaller than its viewport. |
|
|
171
|
-
| `FocusSelection` | Click/drag selection, row/column/corner-header selection, arrow-key focus, Shift+arrows, Cmd/Ctrl+A. |
|
|
485
|
+
| `FocusSelection` | Click/drag selection, Ctrl/Cmd multi-range, row/column/corner-header selection, arrow-key focus, Shift+arrows, Cmd/Ctrl+A, Escape. |
|
|
486
|
+
| `RowHeadersDisabled` | `enableRowHeader={false}` hides the row-number column and the corner menu; the checkbox column is independent and still renders. |
|
|
487
|
+
| `RowSelection` | Uncontrolled checkbox row selection seeded by `defaultRowSelection`, with shift-click ranges, select-all, and a change listener. |
|
|
488
|
+
| `ControlledRowSelection` | Caller-owned `rowSelection` driven by toolbar buttons and the checkboxes. |
|
|
489
|
+
| `BodyContextMenu` | Right-click a cell for a custom Blueprint menu acting on the clicked cell or the current selection. |
|
|
172
490
|
| `Sorting` | Header chevron menu with Sort Asc / Sort Desc / Clear Sort. |
|
|
173
491
|
| `ControlledSorting` | Sorting state owned by the caller via `state` / `onSortingChange`. |
|
|
174
492
|
| `RowVirtualization` | 10,000 rows with only visible rows rendered. |
|
|
@@ -176,6 +494,12 @@ const [sorting, setSorting] = useState<SortingState>([]);
|
|
|
176
494
|
| `RowResizing` | Uncontrolled row resizing with `defaultRowHeights`. |
|
|
177
495
|
| `ControlledRowResizing` | Row heights owned by the caller via `rowHeights` / `onRowHeightChanged`. |
|
|
178
496
|
| `EditableCells` | Custom cell renderers (Blueprint `InputGroup`, `Checkbox`, `Tag`) with `meta.bodyCellClassName` styling. |
|
|
497
|
+
| `FrozenColumnsAndRows` | Frozen columns and rows with focus, selection, resizing, and cross-boundary reordering. |
|
|
498
|
+
| `FrozenColumnsVirtualized` | 10,000 rows with frozen columns/rows and row virtualization. |
|
|
499
|
+
| `FrozenColumnsWithGhostCells` | Ghost cells filling the leftover space around frozen rows/columns. |
|
|
500
|
+
| `Pagination/ClientSide` | `withPagination(BP_Table)` slicing 240 rows client-side, with sorting (resets to page 1) and page-size control. |
|
|
501
|
+
| `Pagination/WithVirtualization` | Paginated pages of a 10,000-row data set, virtualized within the current page. |
|
|
502
|
+
| `Pagination/ManualPagination` | Server-side pagination with `manualPagination`, `pageCount` / `rowCount`, and controlled state. |
|
|
179
503
|
|
|
180
504
|
## Scripts
|
|
181
505
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";var Be=Object.defineProperty;var De=(t,e,n)=>e in t?Be(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ht=(t,e,n)=>De(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),d=require("react"),K=require("@tanstack/react-table"),$e=require("@tanstack/react-virtual"),W=require("@blueprintjs/core"),Fe=require("@blueprintjs/icons");var Ct=(t=>(t.CELLS="cells",t.COLUMN_HEADERS="column-header",t.ROW_HEADERS="row-header",t))(Ct||{});function At(t,e){return t.indexOf(e)!==-1}const Nt=K.tableFeatures({columnSizingFeature:K.columnSizingFeature,columnResizingFeature:K.columnResizingFeature,columnOrderingFeature:K.columnOrderingFeature,columnVisibilityFeature:K.columnVisibilityFeature,columnPinningFeature:K.columnPinningFeature,rowExpandingFeature:K.rowExpandingFeature,rowPinningFeature:K.rowPinningFeature,rowSelectionFeature:K.rowSelectionFeature,cellSelectionFeature:K.cellSelectionFeature,rowSortingFeature:K.rowSortingFeature,expandedRowModel:K.createExpandedRowModel(),sortedRowModel:K.createSortedRowModel(),sortFns:K.sortFns}),be=t=>K.useTable({...t,initialState:t.initialState??{},features:t.features??Nt,columnResizeMode:t.columnResizeMode??"onEnd"});function Ue({table:t,numFrozenColumns:e,numFrozenRows:n}){const o=t.getVisibleLeafColumns(),l=t.getRowModel().rows;d.useLayoutEffect(()=>{var c;if(t.setColumnPinning==null)return;const s=o.slice(0,Math.max(0,e)).map(i=>i.id),r=((c=t.state.columnPinning)==null?void 0:c.start)??[];Ut(r,s)||t.setColumnPinning(i=>({...i,start:s}))},[e,t,o]),d.useLayoutEffect(()=>{var c;if(t.setRowPinning==null)return;const s=l.slice(0,Math.max(0,n)).map(i=>i.id),r=((c=t.state.rowPinning)==null?void 0:c.top)??[];Ut(r,s)||t.setRowPinning(i=>({...i,top:s}))},[n,l,t])}function Ut(t,e){return t.length===e.length&&t.every((n,o)=>n===e[o])}const te=5;function He({table:t,columnHeaderHeight:e,frozenRowCount:n,frozenRowsHeight:o,getRowHeight:l,scrollContainerRef:s,enableRowVirtualization:r,overscanRowCount:c}){const i=Math.max(0,t.getRowModel().rows.length-n),u=$e.useVirtualizer({count:i,getScrollElement:()=>s.current,estimateSize:h=>l(n+h),overscan:c,scrollMargin:e+o,enabled:r});return d.useLayoutEffect(()=>{u.measure()},[n,l,u]),r?u:void 0}function Ht({value:t,initialValue:e,finalValue:n,onChange:o}){const[l,s]=d.useState(e!==void 0?e:n),r=d.useRef(l);return[t!==void 0?t:l,i=>{const u=t!==void 0?t:r.current,h=typeof i=="function"?i(u):i;t===void 0&&(r.current=h,s(()=>h)),o==null||o(h)},t!==void 0]}const ke=20,ze=30,ee=30,Ge=30,kt=150,Pe=50,We=200,jt=d.createContext(void 0);function Ve(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ne={exports:{}};/*!
|
|
2
|
+
Copyright (c) 2018 Jed Watson.
|
|
3
|
+
Licensed under the MIT License (MIT), see
|
|
4
|
+
http://jedwatson.github.io/classnames
|
|
5
|
+
*/(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var s="",r=0;r<arguments.length;r++){var c=arguments[r];c&&(s=l(s,o(c)))}return s}function o(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return n.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var r="";for(var c in s)e.call(s,c)&&s[c]&&(r=l(r,c));return r}function l(s,r){return r?s?s+" "+r:s+r:s}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(ne);var Ye=ne.exports;const k=Ve(Ye),m=W.Classes.getClassNamespace(),Xe=`${m}-table-body-cells`,Ke=`${m}-table-body-virtual-client`,zt=`${m}-table-bottom-container`,se=`${m}-table-cell`,Qe=`${m}-table-cell-client`,qe=`${m}-table-cell-ghost`,oe=`${m}-table-cell-ledger-even`,le=`${m}-table-cell-ledger-odd`,Ze=`${m}-table-column-header-tr`,Je=`${m}-table-column-headers`,yt=`${m}-table-column-header-cell`,re=`${m}-table-column-name`,ce=`${m}-table-column-name-text`,tn=`${m}-table-container`,Tt=`${m}-table-dragging`,ie=`${m}-table-focus-region`,en=`${m}-table-has-reorder-handle`,mt=`${m}-table-header`,nn=`${m}-table-header-active`,ae=`${m}-table-header-content`,sn=`${m}-table-horizontal-guide`,Ot=`${m}-table-last-in-column`,ue=`${m}-table-last-in-row`,on=`${m}-table-menu`,ln=`${m}-table-no-horizontal-scroll`,rn=`${m}-table-no-vertical-scroll`,de=`${m}-table-no-wrap-text`,St=`${m}-table-overlay`,Bt=`${m}-table-overlay-layer`,cn=`${m}-table-pagination-bar`,Gt=`${m}-table-pagination-bar-controls`,Mt=`${m}-table-pagination-bar-text`,an=`${m}-table-pagination-layout`,un=`${m}-table-quadrant`,dn=`${m}-table-quadrant-body-container`,fn=`${m}-table-quadrant-left`,hn=`${m}-table-quadrant-main`,mn=`${m}-table-quadrant-scroll-container`,En=`${m}-table-quadrant-stack`,gn=`${m}-table-quadrant-top`,wn=`${m}-table-quadrant-top-left`,Ln=`${m}-table-region`,Cn=`${m}-table-reorder-handle`,Tn=`${m}-table-reorder-handle-target`,fe=`${m}-table-resize-guides`,he=`${m}-table-resize-handle`,me=`${m}-table-resize-handle-target`,xn=`${m}-table-resize-horizontal`,vn=`${m}-table-resize-vertical`,pn=`${m}-table-row-headers`,Pt=`${m}-table-row-headers-cells-container`,Ee=`${m}-table-row-name`,ge=`${m}-table-row-name-text`,An=`${m}-table-cell-with-expander`,Sn=`${m}-table-row-expander`,Nn=`${m}-table-row-detail`,Dt=`${m}-table-row-selected`,we=`${m}-table-row-selection-cell`,Le=`${m}-table-row-selection-checkbox`,_n=`${m}-table-row-selection-header-cell`,Rn=`${m}-table-selection-enabled`,Ce=`${m}-table-selection-region`,Mn=`${m}-table-th-menu`,In=`${m}-table-th-menu-container`,jn=`${m}-table-th-menu-container-background`,yn=`${m}-table-th-menu-open`,On=`${m}-table-thead`,Bn=`${m}-table-top-container`,Te=`${m}-table-truncated-cell`,xe=`${m}-table-truncated-text`,ve=`${m}-table-vertical-guide`;function pe(t,e){return typeof e=="number"?`${t}${e}`:e.indexOf(t)===0?e:`${t}${e}`}function $t(t){return pe(`${m}-table-cell-col-`,t)}function gt(t){return pe(`${m}-table-cell-row-`,t)}var ot=(t=>(t.CELLS="cells",t.FULL_ROWS="full-rows",t.FULL_COLUMNS="full-columns",t.FULL_TABLE="full-table",t))(ot||{}),Ft=(t=>(t.CELL="cell",t))(Ft||{}),Ae=(t=>(t.UP="up",t.DOWN="down",t.LEFT="left",t.RIGHT="right",t))(Ae||{});class p{static getRegionCardinality(e){return e.cols!=null&&e.rows!=null?"cells":e.cols!=null?"full-columns":e.rows!=null?"full-rows":"full-table"}static cell(e,n,o,l){return{cols:p.normalizeInterval(n,l),rows:p.normalizeInterval(e,o)}}static row(e,n){return{rows:p.normalizeInterval(e,n)}}static column(e,n){return{cols:p.normalizeInterval(e,n)}}static table(){return{}}static copy(e){const n=p.getRegionCardinality(e);return n==="cells"?p.cell(e.rows[0],e.cols[0],e.rows[1],e.cols[1]):n==="full-columns"?p.column(e.cols[0],e.cols[1]):n==="full-rows"?p.row(e.rows[0],e.rows[1]):p.table()}static update(e,n,o){const l=e.slice();return o!=null?l.splice(o,1,n):(l.pop(),l.push(n)),l}static clampRegion(e,n,o){const l=p.copy(e);return e.rows!=null&&(l.rows[0]=p.clamp(e.rows[0],0,n),l.rows[1]=p.clamp(e.rows[1],0,n)),e.cols!=null&&(l.cols[0]=p.clamp(e.cols[0],0,o),l.cols[1]=p.clamp(e.cols[1],0,o)),l}static expandRegion(e,n){const o=p.getRegionCardinality(e),l=p.getRegionCardinality(n);if(l!==o)return n;switch(l){case"full-rows":return p.row(Math.min(e.rows[0],n.rows[0]),Math.max(e.rows[1],n.rows[1]));case"full-columns":return p.column(Math.min(e.cols[0],n.cols[0]),Math.max(e.cols[1],n.cols[1]));case"cells":return p.cell(Math.min(e.rows[0],n.rows[0]),Math.min(e.cols[0],n.cols[0]),Math.max(e.rows[1],n.rows[1]),Math.max(e.cols[1],n.cols[1]));default:return p.table()}}static getRegionFromFocusedRegion(e){return p.cell(e.row,e.col)}static getCellRegionFromRegion(e,n,o){switch(p.getRegionCardinality(e)){case"full-table":return p.cell(0,0,n-1,o-1);case"full-columns":return p.cell(0,e.cols[0],n-1,e.cols[1]);case"full-rows":return p.cell(e.rows[0],0,e.rows[1],o-1);default:return p.cell(e.rows[0],e.cols[0],e.rows[1],e.cols[1])}}static getFocusCellCoordinatesFromRegion(e){switch(p.getRegionCardinality(e)){case"full-table":return{col:0,row:0};case"full-columns":return{col:e.cols[0],row:0};case"full-rows":return{col:0,row:e.rows[0]};default:return{col:e.cols[0],row:e.rows[0]}}}static regionsEqual(e,n){return p.intervalsEqual(e.rows,n.rows)&&p.intervalsEqual(e.cols,n.cols)}static findContainingRegion(e,n){if(e==null)return-1;for(let o=0;o<e.length;o++)if(p.regionContains(e[o],n))return o;return-1}static containsRegion(e,n){return p.overlapsRegion(e,n,!1)}static overlapsRegion(e,n,o=!1){const l=o?p.intervalOverlaps:p.intervalContains;if(e==null||n==null)return!1;for(const s of e)switch(p.getRegionCardinality(s)){case"full-table":return!0;case"full-columns":if(l(s.cols,n.cols))return!0;continue;case"full-rows":if(l(s.rows,n.rows))return!0;continue;case"cells":if(l(s.cols,n.cols)&&l(s.rows,n.rows))return!0;continue}return!1}static enumerateUniqueCells(e,n,o){if(e==null||e.length===0)return[];const l=new Set,s=[];for(const r of e)p.eachCellInRegion(r,n,o,(c,i)=>{const u=`${c}-${i}`;l.has(u)||(l.add(u),s.push({col:i,row:c}))});return s.sort((r,c)=>r.row-c.row||r.col-c.col),s}static joinStyledRegionGroups(e,n){const o=[];return e!=null&&e.length>0&&o.push({className:Ce,regions:e}),n!=null&&o.push({className:ie,regions:[p.getRegionFromFocusedRegion(n)]}),o}static regionContains(e,n){return p.overlapsRegion([e],n,!1)}static intervalContains(e,n){return e==null||n==null?!1:e[0]<=n[0]&&n[1]<=e[1]}static intervalOverlaps(e,n){return e==null||n==null?!1:e[0]<=n[1]&&n[0]<=e[1]}static eachCellInRegion(e,n,o,l){switch(p.getRegionCardinality(e)){case"full-table":for(let s=0;s<n;s++)for(let r=0;r<o;r++)l(s,r);break;case"full-columns":for(let s=0;s<n;s++)for(let r=e.cols[0];r<=e.cols[1];r++)l(s,r);break;case"full-rows":for(let s=e.rows[0];s<=e.rows[1];s++)for(let r=0;r<o;r++)l(s,r);break;case"cells":for(let s=e.rows[0];s<=e.rows[1];s++)for(let r=e.cols[0];r<=e.cols[1];r++)l(s,r);break}}static clamp(e,n,o){return Math.max(n,Math.min(o,e))}static intervalsEqual(e,n){return e==null?n==null:n==null?!1:e[0]===n[0]&&e[1]===n[1]}static normalizeInterval(e,n){return(n==null?[e,e]:[e,n]).sort((l,s)=>l-s)}}function Se(t){switch(t){case"up":return{rows:-1,cols:0};case"down":return{rows:1,cols:0};case"left":return{rows:0,cols:-1};case"right":return{rows:0,cols:1}}}function Dn(t,e){switch(e){case"up":return{...t,focusSelectionIndex:0,row:t.row-1};case"down":return{...t,focusSelectionIndex:0,row:t.row+1};case"left":return{...t,col:t.col-1,focusSelectionIndex:0};case"right":return{...t,col:t.col+1,focusSelectionIndex:0}}}function $n(t,e,n){if(p.getRegionCardinality(t)==="full-table")return t;const o=p.copy(t);let l=0,s=0;if(n!=null){const c=o.rows!=null&&n.row===o.rows[0],i=o.rows!=null&&n.row===o.rows[1],u=o.cols!=null&&n.col===o.cols[0],h=o.cols!=null&&n.col===o.cols[1];e==="up"?l=c&&!i?1:0:e==="down"?l=i&&!c?0:1:e==="left"?s=u&&!h?1:0:s=h&&!u?0:1}else l=e==="down"?1:0,s=e==="right"?1:0;const r=Se(e);return o.rows!=null&&(o.rows[l]+=r.rows),o.cols!=null&&(o.cols[s]+=r.cols),o}function Ne(t){return t.getStartVisibleLeafColumns().length}function dt(t){return t.getTopRows().length}function Et(t){return t.getStartTotalSize()}function xt(t,e){return e==="start"?t.getStartVisibleLeafColumns():t.getCenterVisibleLeafColumns()}function wt(t,e){return e==="start"?t.getStartTotalSize():t.getCenterTotalSize()}function Fn(t,e,n){return e.getIsPinned()==="start"?e.getStart("start"):Et(t)+e.getStart("center")-n}function _t(t,e){return e(dt(t))}function Wt(t,e,n){if(n<0)return;let o=0;const l=xt(t,e);let s=l.length-1;for(;o<=s;){const r=o+s>>1,c=l[r],i=c.getStart(e);if(n<i){s=r-1;continue}if(n>=i+c.getSize()){o=r+1;continue}return c.getIndex()}}function Vt(t,e,n,o,l){const s=dt(t),r=t.getRowModel().rows.length,c=e==="top"?0:s,i=e==="top"?s:r;if(n<0||c>=i)return;const u=o(c);let h=c,f=i-1;for(;h<=f;){const w=h+f>>1,v=o(w)-u;if(n<v){f=w-1;continue}if(n>=v+l(w)){h=w+1;continue}return w}}function bn({table:t,scrollContainerRef:e,rowHeaderWidth:n,columnHeaderHeight:o,getRowTop:l,getRowHeight:s},r,c){const i=e.current;if(i==null)return;const u=i.getBoundingClientRect(),h=r-u.left,f=c-u.top,w=Et(t),v=_t(t,l),S=h-n,L=S-w+i.scrollLeft,C=f-o,T=C-v+i.scrollTop,x=S>=0&&S<w?Wt(t,"start",S):Wt(t,"center",L),E=C>=0&&C<v?Vt(t,"top",C,l,s):Vt(t,"center",T,l,s);if(!(x==null||E==null))return{col:x,row:E}}class Un{constructor({table:e,target:n,selectedRegions:o,numRows:l,numCols:s}){ht(this,"target");ht(this,"regions");ht(this,"selectedRegions");ht(this,"numRows");ht(this,"numCols");ht(this,"targetRow");ht(this,"targetCell");var r;this.target=n,this.selectedRegions=o,this.numRows=l,this.numCols=s,this.regions=p.overlapsRegion(o,n)?o:[n],this.targetRow=e.getRowModel().rows[n.rows[0]],this.targetCell=(r=this.targetRow)==null?void 0:r.getVisibleCells()[n.cols[0]]}getTarget(){return this.target}getRegions(){return this.regions}getSelectedRegions(){return this.selectedRegions}getUniqueCells(){return p.enumerateUniqueCells(this.regions,this.numRows,this.numCols)}getTargetRow(){return this.targetRow}getTargetCell(){return this.targetCell}}function Hn(t){var u,h;const e=t.getVisibleLeafColumns(),n=t.state.columnPinning;if(n==null||(((u=n.start)==null?void 0:u.length)??0)+(((h=n.end)==null?void 0:h.length)??0)===0)return e;const o=new Map(e.map(f=>[f.id,f])),l=(n.start??[]).map(f=>o.get(f)).filter(f=>f!=null),s=(n.end??[]).map(f=>o.get(f)).filter(f=>f!=null),r=new Set(l.map(f=>f.id)),c=new Set(s.map(f=>f.id)),i=e.filter(f=>!r.has(f.id)&&!c.has(f.id));return[...l,...i,...s]}function kn(t,e,n){if(t.length===0)return null;const o=Math.max(0,Math.min(e,t.length-1)),l=Math.max(0,Math.min(n,t.length-1));let s=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(let c=o;c<=l;c++){const i=t[c];i<s&&(s=i),i>r&&(r=i)}return[s,r]}function zn(t,e,n){if(t.length===0)return null;let o=0,l=t.length-1,s=-1;for(;o<=l;){const c=o+l>>1;t[c].getDisplayIndex()>=e?(s=c,l=c-1):o=c+1}if(s<0||t[s].getDisplayIndex()>n)return null;o=s,l=t.length-1;let r=s;for(;o<=l;){const c=o+l>>1;t[c].getDisplayIndex()<=n?(r=c,o=c+1):l=c-1}return[s,r]}function Gn(t,e,n,o){const l=t[0]===0&&t[1]===n-1,s=e[0]===0&&e[1]===o-1;return l&&s?p.table():s?p.row(t[0],t[1]):l?p.column(e[0],e[1]):p.cell(t[0],e[0],t[1],e[1])}function Yt(t){const e=t.getCellSelectionBounds();if(e.length===0)return[];const n=t.getRowModel().rows,l=Hn(t).map(r=>r.getIndex()),s=[];for(const r of e){const c=zn(n,r.minRowIndex,r.maxRowIndex),i=kn(l,r.minColumnIndex,r.maxColumnIndex);c==null||i==null||s.push(Gn(c,i,n.length,l.length))}return s}function Pn(t,e){if(e==null||e.length===0)return[];const n=t.getRowModel().rows,o=t.getVisibleLeafColumns();if(n.length===0||o.length===0)return[];const l=[];for(const s of e){let r,c;switch(p.getRegionCardinality(s)){case ot.FULL_TABLE:r=[0,n.length-1],c=[0,o.length-1];break;case ot.FULL_COLUMNS:r=[0,n.length-1],c=s.cols;break;case ot.FULL_ROWS:r=s.rows,c=[0,o.length-1];break;default:r=s.rows,c=s.cols;break}r[0]<0||r[1]>=n.length||c[0]<0||c[1]>=o.length||l.push({anchorRowId:n[r[0]].id,anchorColumnId:o[c[0]].id,focusRowId:n[r[1]].id,focusColumnId:o[c[1]].id})}return l}function Xt(t){const e=t.getFocusedCell();if(e==null)return;const n=t.getRowModel().rows.indexOf(e.row);if(!(n<0))return{row:n,col:e.column.getIndex()}}function Wn(t,e){const n=t.getRowModel().rows[e.row],o=t.getVisibleLeafColumns()[e.col];if(!(n==null||o==null))return n.getAllCellsByColumnId()[o.id]}function Kt(t){return JSON.stringify(t.map(e=>({rows:e.rows??null,cols:e.cols??null})))}function Vn({table:t,getRowTop:e,getRowHeight:n,scrollContainerRef:o,rowHeaderWidth:l,columnHeaderHeight:s,bodyContextMenuRenderer:r,enableBodyContextMenu:c,enableFocusedCell:i=!1,onFocusedCell:u,onFocusedRegion:h,selectedRegions:f,onSelection:w,selectionModes:v}){const S=f!=null,L=c??r!=null,C=d.useRef(!1),T=d.useRef(void 0),x=d.useCallback(g=>v==null?!0:v.includes(g),[v]),E=t.state.cellSelection,b=t.state.columnPinning,y=t.getRowModel().rows,U=t.getVisibleLeafColumns(),_=d.useMemo(()=>Yt(t),[E,b,y,t,U]),R=d.useMemo(()=>i?Xt(t):void 0,[E,i,y,t]),z=d.useMemo(()=>{const g=[];return _.length>0&&g.push({className:Ce,regions:_}),R!=null&&g.push({className:ie,regions:[p.cell(R.row,R.col)]}),g},[R,_]);d.useEffect(()=>{if(!S)return;const g=Kt(f??[]);T.current!==g&&(T.current=g,t.setCellSelection(Pn(t,f)))},[f,S,t]);const q=d.useRef(null),N=d.useRef(!1);d.useEffect(()=>{const g=Kt(_);if(q.current!==g){if(q.current=g,!N.current){N.current=!0;return}S&&T.current===g||w==null||w(_)}},[S,w,_]);const O=d.useRef(null);d.useEffect(()=>{if(!i)return;const g=R!=null?`${R.row}-${R.col}`:null;O.current!==g&&(O.current=g,R!=null&&(u==null||u(R),h==null||h({type:Ft.CELL,row:R.row,col:R.col,focusSelectionIndex:0})))},[i,R,u,h]);const F=d.useCallback(()=>{var g;i&&((g=o.current)==null||g.focus())},[i,o]),M=d.useCallback(()=>{const g=Xt(t);if(g==null)return;const A=o.current;if(A==null)return;const $=t.getVisibleLeafColumns()[g.col];if($==null)return;const X=Ne(t),Z=Et(t),ct=dt(t),nt=_t(t,e),tt=$.getStart(),it=tt+$.getSize(),ut=e(g.row),P=ut+n(g.row),V=A.clientWidth-l-Z,st=A.clientHeight-s-nt;let et=A.scrollLeft,rt=A.scrollTop;if(g.col>=X){const at=tt-Z,ft=it-Z;at<et?et=Math.max(0,at):ft>et+V&&(et=ft-V)}if(g.row>=ct){const at=ut-nt,ft=P-nt;at<rt?rt=Math.max(0,at):ft>rt+st&&(rt=ft-st)}et!==A.scrollLeft&&(A.scrollLeft=et),rt!==A.scrollTop&&(A.scrollTop=rt)},[s,n,e,l,o,t]);d.useEffect(()=>{C.current&&(C.current=!1,M())},[E,M,t]);const Y=d.useCallback(g=>{const A=g.metaKey||g.ctrlKey,H=g.key;let $;if(H==="ArrowUp"?$="up":H==="ArrowDown"?$="down":H==="ArrowLeft"?$="left":H==="ArrowRight"&&($="right"),$!=null){g.preventDefault(),g.stopPropagation(),g.shiftKey?t.extendCellSelection($):i&&(C.current=!0,t.moveCellSelection($));return}if(H==="Tab"&&i){g.preventDefault(),g.stopPropagation(),C.current=!0,t.moveCellSelection(g.shiftKey?"left":"right");return}if(H==="Escape"){g.preventDefault(),g.stopPropagation(),t.resetCellSelection(!0);return}A&&H.toLowerCase()==="a"&&(g.preventDefault(),g.stopPropagation(),t.selectAllCells())},[i,t]),I=d.useCallback((g,A)=>bn({table:t,scrollContainerRef:o,rowHeaderWidth:l,columnHeaderHeight:s,getRowTop:e,getRowHeight:n},g,A),[s,n,e,l,o,t]),j=d.useCallback(g=>{g.button===0&&F()},[F]),B=d.useCallback(g=>{if(!L)return;const A=I(g.clientX,g.clientY);if(A==null)return;const H=Wn(t,A);H!=null&&(H.getIsSelected()||x(ot.CELLS)&&t.setCellSelection([{anchorRowId:H.row.id,anchorColumnId:H.column.id,focusRowId:H.row.id,focusColumnId:H.column.id}]))},[I,L,x,t]),D=d.useCallback(g=>{if(!L||r==null)return;const A=I(g.clientX,g.clientY);if(A==null)return;const H=new Un({table:t,target:p.cell(A.row,A.col),selectedRegions:Yt(t),numRows:t.getRowModel().rows.length,numCols:t.getVisibleLeafColumns().length});return r(H)??void 0},[r,I,L,t]),G=d.useCallback((g,A)=>{if(!x(ot.FULL_COLUMNS)){t.resetCellSelection(!0),F();return}A.preventDefault(),A.stopPropagation();const H=t.getRowModel().rows,$=t.getVisibleLeafColumns()[g];$==null||H.length===0||(A.shiftKey?t.setCellSelection(X=>{const Z=X[X.length-1];return Z==null?[{anchorRowId:H[0].id,anchorColumnId:$.id,focusRowId:H[H.length-1].id,focusColumnId:$.id}]:[...X.slice(0,-1),{...Z,focusColumnId:$.id}]}):t.setCellSelection([{anchorRowId:H[0].id,anchorColumnId:$.id,focusRowId:H[H.length-1].id,focusColumnId:$.id}]),F())},[F,x,t]),J=d.useCallback((g,A)=>{if(!x(ot.FULL_ROWS)){t.resetCellSelection(!0),F();return}A.preventDefault(),A.stopPropagation();const H=t.getRowModel().rows,$=t.getVisibleLeafColumns(),X=H[g];X==null||$.length===0||(A.shiftKey?t.setCellSelection(Z=>{const ct=Z[Z.length-1];return ct==null?[{anchorRowId:X.id,anchorColumnId:$[0].id,focusRowId:X.id,focusColumnId:$[$.length-1].id}]:[...Z.slice(0,-1),{...ct,focusRowId:X.id}]}):t.setCellSelection([{anchorRowId:X.id,anchorColumnId:$[0].id,focusRowId:X.id,focusColumnId:$[$.length-1].id}]),F())},[F,x,t]),lt=d.useCallback(g=>{if(!x(ot.FULL_TABLE)){t.resetCellSelection(!0),F();return}g.preventDefault(),g.stopPropagation(),t.selectAllCells(),F()},[F,x,t]);return{regionGroups:z,handleBodyContextMenu:B,handleBodyPointerDown:j,handleColumnHeaderMouseDown:G,handleKeyDown:Y,handleMenuMouseDown:lt,handleRowHeaderMouseDown:J,isBodyContextMenuEnabled:L,isSelectionModeEnabled:x,renderBodyContextMenu:D}}function Yn({minHeight:t,headerRowCount:e}){const n=d.useRef(null),[o,l]=d.useState(null);d.useLayoutEffect(()=>{const r=n.current;if(r==null)return;const c=()=>{const u=r.getBoundingClientRect().height;u>0&&l(h=>h===u?h:u)};c();const i=new ResizeObserver(c);return i.observe(r),()=>i.disconnect()},[]);const s=Math.max(0,e)*ee;return{ref:n,height:Math.max(t,s,o??0)}}function Xn({enableGhostCells:t,rowHeight:e,rowHeaderWidth:n,columnHeaderHeight:o,totalWidth:l,totalHeight:s,scrollContainerRef:r}){const[c,i]=d.useState(null);if(d.useLayoutEffect(()=>{const v=r.current;if(v==null)return;const S=()=>{i({width:v.clientWidth,height:v.clientHeight})};S();const L=new ResizeObserver(S);return L.observe(v),()=>L.disconnect()},[r]),!t||c==null)return;const u=c.width-n-l,h=c.height-o-s,f=u>0?Math.min(Math.ceil(u/kt),Pe):0,w=h>0?Math.min(Math.ceil(h/e),We):0;if(!(f===0&&w===0))return{columnCount:f,rowCount:w,columnWidth:kt,rowHeight:e}}function _e(t,e){return e==null?t:t+e.columnCount*e.columnWidth}const Kn=6,Qn=100;function qn({rowHeight:t,rowCount:e,getDetailHeight:n,rowHeights:o,defaultRowHeights:l,enableRowResizing:s=!1,minRowHeight:r=Kn,maxRowHeight:c=Qn,onRowHeightChanged:i}){const u=o!=null,[h,f]=d.useState(l??[]),[w,v]=d.useState(null),[S,L]=d.useState(null),C=d.useRef(null),T=d.useCallback(I=>u?o[I]??t:h[I]??(l==null?void 0:l[I])??t,[l,h,u,t,o]),{rowTops:x,totalHeight:E}=d.useMemo(()=>{const I=new Array(e+1);let j=0;for(let B=0;B<e;B++)I[B]=j,j+=T(B)+((n==null?void 0:n(B))??0);return I[e]=j,{rowTops:I,totalHeight:j}},[n,T,e]),b=d.useCallback(I=>x[I]??0,[x]),y=d.useCallback(I=>x[I+1]-x[I],[x]),U=d.useRef(T);U.current=T;const _=d.useRef(x);_.current=x;const R=d.useRef(s);R.current=s;const z=d.useRef(u);z.current=u;const q=d.useRef(r);q.current=r;const N=d.useRef(c);N.current=c;const O=d.useRef(i);O.current=i;const F=d.useCallback(I=>{var G,J;const j=C.current;if(j==null)return;const B="touches"in I?(G=I.touches[0])==null?void 0:G.clientY:I.clientY;if(B==null)return;const D=Math.min(j.max,Math.max(j.min,j.startHeight+(B-j.startY)));z.current||f(lt=>{const g=lt.slice();return g[j.index]=D,g}),(J=O.current)==null||J.call(O,j.index,D),L(j.rowTop+D)},[]),M=d.useCallback(()=>{C.current=null,v(null),L(null),window.removeEventListener("mousemove",F),window.removeEventListener("mouseup",M),window.removeEventListener("touchmove",F),window.removeEventListener("touchend",M),window.removeEventListener("touchcancel",M)},[F]),Y=d.useCallback((I,j)=>{var J;if(!R.current)return;j.preventDefault(),j.stopPropagation();const B="touches"in j?(J=j.touches[0])==null?void 0:J.clientY:j.clientY;if(B==null)return;const D=_.current[I]??0,G=U.current(I);C.current={index:I,startY:B,startHeight:G,rowTop:D,min:q.current,max:N.current},v(I),L(D+G),window.addEventListener("mousemove",F),window.addEventListener("mouseup",M),window.addEventListener("touchmove",F),window.addEventListener("touchend",M),window.addEventListener("touchcancel",M)},[F,M]);return d.useEffect(()=>()=>{window.removeEventListener("mousemove",F),window.removeEventListener("mouseup",M),window.removeEventListener("touchmove",F),window.removeEventListener("touchend",M),window.removeEventListener("touchcancel",M)},[F,M]),{enabled:s,getRowHeight:T,getRowSpanHeight:y,getRowTop:b,totalHeight:E,resizingRowIndex:w,resizingGuideTop:S,startRowResize:Y}}const Re=d.createContext(null);function vt(){return d.useContext(Re)}const Me=d.createContext(null);function Zn(){return d.useContext(Me)}function Jn(t,e){return e<t?e:t<=e&&e<t+1?t:Math.max(0,e-1)}function ts(t,e,n,o,l){const[s,r]=d.useState(null),[c,i]=d.useState(null),u=d.useRef(null),h=d.useCallback(C=>{var U,_;const T=((U=n.current)==null?void 0:U.getBoundingClientRect().left)??0,x=((_=o.current)==null?void 0:_.scrollLeft)??0,E=Et(t),b=C-T-l;if(b<E){let R=0;for(const z of xt(t,"start"))if(z.getStart("start")+z.getSize()/2<b)R++;else break;return R}let y=Ne(t);for(const R of xt(t,"center"))if(E+R.getStart("center")-x+R.getSize()/2<b)y++;else break;return y},[n,l,o,t]),f=d.useCallback(C=>{var U;const T=u.current;if(u.current=null,r(null),i(null),T==null)return;const x=t.getVisibleLeafColumns(),E=(U=x[T.oldIndex])==null?void 0:U.id;if(E==null)return;const b=Jn(T.oldIndex,h(C)),y=x.map(_=>_.id).filter(_=>_!==E);y.splice(b,0,E),t.setColumnOrder(y)},[h,t]),w=d.useCallback(C=>{u.current!=null&&i(h(C.clientX))},[h]),v=d.useCallback(C=>{f(C.clientX)},[f]),S=d.useCallback((C,T)=>{e&&(T.preventDefault(),u.current={oldIndex:C.getIndex()},r(C.id),i(h(T.clientX)),window.addEventListener("pointermove",w),window.addEventListener("pointerup",v),window.addEventListener("pointercancel",v))},[e,h,w,v]);return d.useEffect(()=>()=>{window.removeEventListener("pointermove",w),window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v)},[w,v]),{contextValue:d.useMemo(()=>({enableColumnReordering:e,reorderingColumnId:s,startReorder:S}),[e,s,S]),guideIndex:c,reorderingColumnId:s}}function es({table:t,reorderingColumnId:e,guideIndex:n,rowHeaderWidth:o,scrollLeft:l}){if(e==null||n==null)return null;const s=t.getVisibleLeafColumns(),r=t.getStartVisibleLeafColumns().length,c=s[n],i=Et(t);let u;return n<=r?u=n<r&&c!=null?c.getStart("start"):i:c!=null?u=i+c.getStart("center")-l:u=i+wt(t,"center")-l,a.jsx("div",{className:k(fe,Bt),children:a.jsx("div",{className:k(St,ve),style:{left:o+u}})})}function ns({table:t,rowHeaderWidth:e,columnHeaderHeight:n,scrollLeft:o,scrollTop:l,frozenRowCount:s,resizingGuideTop:r=null,resizingRowIndex:c=null}){const i=t.state.columnResizing,u=i==null?void 0:i.isResizingColumn,h=u!=null&&u!==!1?t.getColumn(u):void 0,f=h!=null?e+Fn(t,h,o)+h.getSize()+((i==null?void 0:i.deltaOffset)??0):null,w=r!=null&&c!=null?n+r-(c<s?0:l):null;return f==null&&w==null?null:a.jsxs("div",{className:k(fe,Bt),children:[f!=null&&a.jsx("div",{className:k(St,ve),style:{left:f}}),w!=null&&a.jsx("div",{className:k(St,sn),style:{top:w}})]})}function ss({row:t,rowIndex:e,rowExpanderButtonProps:n,rowExpanderIconProps:o}){const l=t.getIsExpanded(),s=typeof n=="function"?n(t):n,r=typeof o=="function"?o(t):o;return a.jsx("button",{type:"button","aria-expanded":l,"aria-label":`${l?"Collapse":"Expand"} row ${e+1}`,...s,className:k(Sn,s==null?void 0:s.className),onMouseDown:c=>{var i;c.stopPropagation(),(i=s==null?void 0:s.onMouseDown)==null||i.call(s,c)},onPointerDown:c=>{var i;c.stopPropagation(),(i=s==null?void 0:s.onPointerDown)==null||i.call(s,c)},onKeyDown:c=>{var i;c.stopPropagation(),(i=s==null?void 0:s.onKeyDown)==null||i.call(s,c)},onClick:c=>{var i;(i=s==null?void 0:s.onClick)==null||i.call(s,c),c.defaultPrevented||t.toggleExpanded()},children:a.jsx(W.Icon,{icon:l?"caret-down":"caret-right",size:14,...r})})}function Lt({loading:t,variableLength:e=!1,children:n}){if(t){const o=e?75-Math.floor(Math.random()*11)*5:100;return a.jsx("div",{className:W.Classes.SKELETON,style:{width:`${o}%`}})}return a.jsx(a.Fragment,{children:n})}function os({table:t,cell:e,cellProps:n,rowIndex:o,rowTop:l,columnRegion:s,rowHeight:r,loading:c,isExpansionCell:i,rowExpanderButtonProps:u,rowExpanderIconProps:h,isLastInRow:f,isLastInColumn:w}){var b,y,U;const v=e.column.getSize(),S=e.column.getStart(s),L=i&&((y=(b=e.row).getCanExpand)==null?void 0:y.call(b)),C=(U=e.column.columnDef.meta)==null?void 0:U.bodyCellClassName,T=L&&!c,x=i&&e.row.depth>0?{paddingInlineStart:e.row.depth*16}:void 0,E=a.jsx("div",{className:k(xe,de),style:T?void 0:x,children:a.jsx(Lt,{loading:c,variableLength:!0,children:a.jsx(t.FlexRender,{cell:e})})});return a.jsx("div",{...n,className:k(se,Te,gt(o),$t(e.column.getIndex()),o%2===0?oe:le,{[ue]:f,[Ot]:w,[W.Classes.LOADING]:c,[Dt]:e.row.getIsSelected()},C,n==null?void 0:n.className),style:{...n==null?void 0:n.style,height:r,left:S,position:"absolute",top:l,width:v},onMouseDown:_=>{var R;(R=n==null?void 0:n.onMouseDown)==null||R.call(n,_),!_.defaultPrevented&&_.button===0&&e.getSelectionStartHandler()(_)},onMouseEnter:_=>{var R;(R=n==null?void 0:n.onMouseEnter)==null||R.call(n,_),_.defaultPrevented||e.getSelectionExtendHandler()(_)},children:T?a.jsxs("div",{className:An,style:x,children:[a.jsx(ss,{row:e.row,rowIndex:o,rowExpanderButtonProps:u,rowExpanderIconProps:h}),E]}):E})}function It({columnIndex:t,rowIndex:e,left:n,top:o,width:l,height:s,loading:r}){return a.jsx("div",{className:k(se,qe,Te,gt(e),$t(t),e%2===0?oe:le,{[W.Classes.LOADING]:r}),style:{height:s,left:n,position:"absolute",top:o,width:l},children:a.jsx("div",{className:k(xe,de),children:a.jsx(Lt,{loading:r,variableLength:!0})})})}function ls({table:t,ghosts:e,loading:n,columnRegion:o,rowRegion:l,rowIndices:s,regionTop:r,regionHeight:c,getRowTop:i,getRowHeight:u}){const h=t.getRowModel().rows,f=t.getVisibleLeafColumns().length,w=wt(t,o),v=xt(t,o),S=o==="center",L=l==="center";return a.jsxs(a.Fragment,{children:[S&&s.map(C=>{var T;return a.jsx(d.Fragment,{children:Array.from({length:e.columnCount}).map((x,E)=>a.jsx(It,{columnIndex:f+E,rowIndex:C,left:w+E*e.columnWidth,top:i(C)-r,width:e.columnWidth,height:u(C),loading:n},`ghost-column-cell-${C}-${E}`))},`ghost-column-cells-${((T=h[C])==null?void 0:T.id)??C}`)}),L&&Array.from({length:e.rowCount}).map((C,T)=>{const x=h.length+T,E=c+T*e.rowHeight;return a.jsxs(d.Fragment,{children:[v.map(b=>a.jsx(It,{columnIndex:b.getIndex(),rowIndex:x,left:b.getStart(o),top:E,width:b.getSize(),height:e.rowHeight,loading:n},`ghost-row-cell-${T}-${b.id}`)),S&&Array.from({length:e.columnCount}).map((b,y)=>a.jsx(It,{columnIndex:f+y,rowIndex:x,left:w+y*e.columnWidth,top:E,width:e.columnWidth,height:e.rowHeight,loading:n},`ghost-corner-cell-${T}-${y}`))]},`ghost-row-cells-${T}`)})]})}function Qt(t,e,n){let o=null,l=0;for(const s of xt(t,e)){const r=s.getIndex();r<n[0]||r>n[1]||(o==null&&(o=s.getStart(e)),l+=s.getSize())}return o==null?null:{offset:o,size:l}}function qt(t,e,n,o,l){const s=dt(t),r=t.getRowModel().rows.length,c=Math.max(n[0],e==="top"?0:s),i=Math.min(n[1],e==="top"?s-1:r-1);if(c>i)return null;const u=e==="center"?rs(t,e,o):0;return{offset:o(c)-u,size:o(i)+l(i)-o(c)}}function rs(t,e,n){return e==="center"?n(dt(t)):0}function cs(t,e,n,o,l,s){const r=p.getRegionCardinality(e),c={offset:0,size:wt(t,n)},i=dt(t),u=t.getRowModel().rows.length,h={offset:0,size:(o==="top"?i:u-i)===0?0:l(o==="top"?i-1:u-1)+s(o==="top"?i-1:u-1)-l(o==="top"?0:i)};let f,w;switch(r){case ot.CELLS:f=Qt(t,n,e.cols),w=qt(t,o,e.rows,l,s);break;case ot.FULL_COLUMNS:f=Qt(t,n,e.cols),w=h;break;case ot.FULL_ROWS:f=c,w=qt(t,o,e.rows,l,s);break;default:f=c,w=h;break}return f==null||w==null||f.size<=0||w.size<=0?null:{height:w.size,left:f.offset,top:w.offset,width:f.size}}function is({table:t,regionGroups:e,columnRegion:n,rowRegion:o,getRowTop:l,getRowHeight:s}){return a.jsx("div",{className:Bt,"aria-hidden":!0,children:e.map((r,c)=>r.regions.map((i,u)=>{const h=cs(t,i,n,o,l,s);return h==null?null:a.jsx("div",{className:k(St,Ln,r.className),style:h},`${c}-${u}`)}))})}function as({table:t,renderRowDetail:e,getCellProps:n,rowExpanderButtonProps:o,rowExpanderIconProps:l,columnRegion:s,rowRegion:r,offsetTop:c=0,offsetLeft:i=0,areCellsLoading:u,rowVirtualizer:h,rowResizing:f,ghosts:w,className:v,...S}){const L=vt(),C=L!=null&&L.isBodyContextMenuEnabled,T=t.getRowModel().rows,x=dt(t),E=r==="top",b=E?x:T.length-x,y=E?0:f.getRowTop(x),U=E?f.getRowTop(x):f.totalHeight-f.getRowTop(x),_=wt(t,s),R=t.getStartVisibleLeafColumns().length>0?"start":"center",z=t.getCenterVisibleLeafColumns().length>0?"center":"start",N=!E&&h!=null?h.getVirtualItems():void 0,O=N!=null?N.map(M=>x+M.index):Array.from({length:b},(M,Y)=>E?Y:x+Y),F=E?x-1:T.length-1;return a.jsx("div",{...S,className:k(dn,v),style:{paddingLeft:i,paddingTop:c},children:a.jsx("div",{children:a.jsxs(W.ContextMenu,{className:k(Ke,Qe),style:{height:U,width:_},onPointerDown:L==null?void 0:L.handleBodyPointerDown,disabled:!C,onContextMenu:C?L==null?void 0:L.handleBodyContextMenu:void 0,content:({mouseEvent:M})=>M==null||L==null?void 0:L.renderBodyContextMenu(M),children:[a.jsxs("div",{className:Xe,children:[O.map(M=>{const Y=T[M];if(Y==null)return null;const I=s==="start"?Y.getStartVisibleCells():Y.getCenterVisibleCells(),j=f.getRowTop(M)-y,B=f.getRowHeight(M),D=f.getRowSpanHeight(M)-B;return a.jsxs(d.Fragment,{children:[I.map((G,J)=>a.jsx(os,{table:t,cell:G,cellProps:n==null?void 0:n(G),rowExpanderButtonProps:o,rowExpanderIconProps:l,isExpansionCell:s===R&&J===0,rowIndex:M,rowTop:j,columnRegion:s,rowHeight:B,loading:u,isLastInRow:J===I.length-1,isLastInColumn:M===F},G.id)),D>0&&s===z&&a.jsx("div",{className:Nn,style:{top:j+B,height:D,width:_},onPointerDown:G=>G.stopPropagation(),onKeyDown:G=>G.stopPropagation(),onContextMenu:G=>G.stopPropagation(),children:e==null?void 0:e(Y)})]},Y.id)}),w!=null&&a.jsx(ls,{table:t,ghosts:w,loading:u,columnRegion:s,rowRegion:r,rowIndices:O,regionTop:y,regionHeight:U,getRowTop:f.getRowTop,getRowHeight:f.getRowHeight})]}),L!=null&&L.regionGroups.length>0&&a.jsx(is,{table:t,regionGroups:L.regionGroups,columnRegion:s,rowRegion:r,getRowTop:f.getRowTop,getRowHeight:f.getRowHeight})]})})})}function us({row:t,rowIndex:e,rowHeight:n,detailHeight:o,loading:l,isLastInColumn:s,isResizing:r=!1,onResizeStart:c,className:i,...u}){const h=vt();return a.jsxs("div",{...u,className:k(mt,gt(e),{[Ot]:s,[W.Classes.LOADING]:l,[Dt]:(t==null?void 0:t.getIsSelected())??!1},i),style:{marginBottom:o,flexBasis:n,height:n,minHeight:0},onMouseDown:f=>h==null?void 0:h.handleRowHeaderMouseDown(e,f),children:[a.jsx("div",{className:Ee,children:a.jsx("div",{className:ge,children:a.jsx(Lt,{loading:l,children:a.jsx("span",{children:e+1})})})}),!l&&c!=null&&a.jsx("div",{className:k(me,xn,{[Tt]:r}),onMouseDown:c,onTouchStart:c,children:a.jsx("div",{className:k(he,{[Tt]:r})})})]})}function ds({row:t,rowIndex:e,rowHeight:n,detailHeight:o,loading:l,isLastInColumn:s}){const r=(t==null?void 0:t.getIsSelected())??!1;return a.jsx("div",{className:k(mt,we,gt(e),{[Ot]:s,[W.Classes.LOADING]:l,[Dt]:r}),style:{marginBottom:o,height:n},children:!l&&t!=null&&a.jsx("div",{className:Le,children:a.jsx(W.Checkbox,{"aria-label":`Select row ${e+1}`,checked:r,disabled:!t.getCanSelect(),onChange:c=>t.getToggleSelectedHandler()(c)})})})}function Zt({table:t,rowRegion:e,rowHeaderWidth:n,enableRowHeader:o=!0,selectionColumnWidth:l=0,areRowHeadersLoading:s,rowVirtualizer:r,rowResizing:c,ghosts:i,className:u,...h}){if(!o&&l===0)return null;const f=t.getRowModel().rows,w=o?n:0,v=dt(t),S=e==="top",L=S?0:v,C=S?v:f.length-v,T=S?c.getRowTop(v):c.totalHeight-c.getRowTop(v),E=!S&&r!=null?r.getVirtualItems():void 0,b=(r==null?void 0:r.options.scrollMargin)??0,y=E!=null&&E.length>0?E[0].start-b:0,U=E!=null&&E.length>0?T-(E[E.length-1].end-b):0,_=E!=null?E.map(N=>v+N.index):Array.from({length:C},(N,O)=>L+O),R=S?v-1:f.length-1,z={height:T,transform:"translateY(0px)",paddingTop:y,paddingBottom:U},q=i!=null&&!S?Array.from({length:i.rowCount},(N,O)=>f.length+O):[];return a.jsx("div",{...h,className:k(pn,u),style:{width:w+l},children:a.jsxs("div",{style:{display:"flex",height:T},children:[o&&a.jsx("div",{style:{flex:"0 0 auto",width:n},children:a.jsxs("div",{className:Pt,style:z,children:[_.map(N=>{var O;return a.jsx(us,{row:f[N],rowIndex:N,rowHeight:c.getRowHeight(N),detailHeight:c.getRowSpanHeight(N)-c.getRowHeight(N),loading:s,isLastInColumn:N===R,isResizing:c.resizingRowIndex===N,onResizeStart:c.enabled?F=>c.startRowResize(N,F):void 0},((O=f[N])==null?void 0:O.id)??N)}),q.map((N,O)=>a.jsx("div",{className:k(mt,gt(N),{[W.Classes.LOADING]:s}),style:{flexBasis:i==null?void 0:i.rowHeight,height:i==null?void 0:i.rowHeight,minHeight:0},children:a.jsx("div",{className:Ee,children:a.jsx("div",{className:ge,children:a.jsx(Lt,{loading:s})})})},`ghost-row-header-${O}`))]})}),l>0&&a.jsx("div",{style:{flex:"0 0 auto",width:l},children:a.jsxs("div",{className:Pt,style:z,children:[_.map(N=>{var O;return a.jsx(ds,{row:f[N],rowIndex:N,rowHeight:c.getRowHeight(N),detailHeight:c.getRowSpanHeight(N)-c.getRowHeight(N),loading:s,isLastInColumn:N===R},((O=f[N])==null?void 0:O.id)??N)}),q.map((N,O)=>a.jsx("div",{className:k(mt,we,gt(N),{[W.Classes.LOADING]:s}),style:{height:i==null?void 0:i.rowHeight}},`ghost-row-selection-${O}`))]})})]})})}function fs({header:t,isOpen:e,onOpenChange:n}){const o=t.column.getIsSorted(),l=r=>{t.column.toggleSorting(r),n(!1)},s=()=>{t.column.clearSorting(),n(!1)};return a.jsxs("div",{className:k(In,{[yn]:e}),children:[a.jsx("div",{className:jn}),a.jsx(W.PopoverNext,{className:Mn,content:a.jsxs(W.Menu,{children:[a.jsx(W.MenuItem,{icon:"sort-asc",text:"Sort Asc",onClick:()=>l(!1)}),a.jsx(W.MenuItem,{icon:"sort-desc",text:"Sort Desc",onClick:()=>l(!0)}),o&&a.jsx(W.MenuItem,{icon:"sort",text:"Clear Sort",onClick:s})]}),isOpen:e,onInteraction:n,placement:"bottom",rootBoundary:"viewport",children:a.jsx(W.Icon,{icon:"chevron-down"})})]})}function hs({table:t,header:e,isLastInRow:n,enableSorting:o=!1,loading:l}){var x;const s=e.getSize(),r=e.column.getIsResizing(),c=e.getResizeHandler(),i=typeof e.column.columnDef.header=="string"?e.column.columnDef.header:void 0,u=Zn(),h=vt(),f=(u==null?void 0:u.enableColumnReordering)??!1,w=(u==null?void 0:u.reorderingColumnId)===e.column.id,v=o&&e.column.getCanSort(),S=(x=e.column.columnDef.meta)==null?void 0:x.headCellClassName,[L,C]=d.useState(!1),T=e.column.getIndex();return a.jsxs("div",{className:k(mt,$t(T),yt,{[ue]:n},{[en]:f},{[nn]:L},{[W.Classes.LOADING]:l},S),style:{flexBasis:s,minWidth:0,width:s},onMouseDown:E=>h==null?void 0:h.handleColumnHeaderMouseDown(T,E),children:[a.jsxs("div",{className:re,title:i,children:[f&&a.jsx("div",{className:k(Tn,{[Tt]:w}),onPointerDown:E=>u==null?void 0:u.startReorder(e.column,E),children:a.jsx("div",{className:Cn,children:a.jsx(Fe.DragHandleVerticalIcon,{title:"Press down to drag"})})}),v&&!l&&a.jsx(fs,{table:t,header:e,isOpen:L,onOpenChange:C}),a.jsx("div",{className:ce,children:a.jsx(Lt,{loading:l,variableLength:!0,children:a.jsx(t.FlexRender,{header:e})})})]}),a.jsx("div",{className:ae}),!l&&a.jsx("div",{className:k(me,vn,{[Tt]:r}),onMouseDown:c,onTouchStart:c,children:a.jsx("div",{className:k(he,{[Tt]:r})})})]})}function ms({table:t,headerGroup:e,columnRegion:n,enableSorting:o=!1,areColumnHeadersLoading:l,ghosts:s}){var i;const r=(i=e.headers[e.headers.length-1])==null?void 0:i.id,c=_e(wt(t,n),s);return a.jsxs("div",{className:k(On,Ze),style:{transform:"translateX(0px)",width:c},children:[e.headers.map(u=>a.jsx(hs,{table:t,header:u,isLastInRow:u.id===r,enableSorting:o,loading:l},u.id)),s!=null&&Array.from({length:s.columnCount}).map((u,h)=>a.jsxs("div",{className:k(mt,yt,{[W.Classes.LOADING]:l}),style:{flexBasis:s.columnWidth,minWidth:0,width:s.columnWidth},children:[a.jsx("div",{className:re,children:a.jsx("div",{className:ce,children:a.jsx(Lt,{loading:l,variableLength:!0})})}),a.jsx("div",{className:ae})]},`ghost-column-header-${h}`))]})}function Es({table:t,columnRegion:e,enableSorting:n=!1,areColumnHeadersLoading:o,ghosts:l,className:s,...r}){const c=e==="start"?t.getStartHeaderGroups():t.getCenterHeaderGroups(),i=e==="center"?l:void 0,u=_e(wt(t,e),i);return a.jsx("div",{...r,className:k(Je,s),children:a.jsx("div",{style:{width:u},children:c.map(h=>a.jsx(ms,{table:t,headerGroup:h,columnRegion:e,enableSorting:n,areColumnHeadersLoading:o,ghosts:i},h.id))})})}function gs({width:t,height:e,className:n,...o}){const l=vt();return a.jsx("div",{...o,className:k(on,n),style:{width:t,height:e},onMouseDown:l==null?void 0:l.handleMenuMouseDown})}function ws({table:t,width:e,height:n,loading:o=!1}){const l=t.getIsAllRowsSelected(),s=t.getIsSomeRowsSelected();return a.jsx("div",{className:k(mt,yt,_n),style:{flex:"0 0 auto",height:n,width:e},children:!o&&a.jsx("div",{className:Le,children:a.jsx(W.Checkbox,{"aria-label":"Select all rows",checked:l,indeterminate:!l&&s,onChange:r=>t.getToggleAllRowsSelectedHandler()(r)})})})}var Q=(t=>(t.MAIN="main",t.TOP="top",t.LEFT="left",t.TOP_LEFT="top-left",t))(Q||{});function Ls(t){switch(t){case Q.MAIN:return hn;case Q.TOP:return gn;case Q.LEFT:return fn;case Q.TOP_LEFT:return wn;default:return}}function pt({quadrantType:t,table:e,renderRowDetail:n,getCellProps:o,rowExpanderButtonProps:l,rowExpanderIconProps:s,rowHeaderWidth:r,enableRowHeader:c=!0,columnHeaderHeight:i,columnHeaderMeasureRef:u,enableSorting:h=!1,areCellsLoading:f,areColumnHeadersLoading:w,areRowHeadersLoading:v,rowResizing:S,rowVirtualizer:L,ghosts:C,scrollContainerRef:T,onScroll:x,onWheel:E,style:b,selectionColumnWidth:y=0}){const U=t===Q.MAIN,_=t===Q.TOP||t===Q.TOP_LEFT,z=t===Q.LEFT||t===Q.TOP_LEFT?"start":"center",q=_?"top":"center",N=t===Q.TOP||t===Q.TOP_LEFT,O=t===Q.TOP_LEFT,F=vt(),M=Et(e),Y=_t(e,S.getRowTop),I=c?r:0,j=(G,J)=>a.jsx(as,{table:e,renderRowDetail:n,getCellProps:o,rowExpanderButtonProps:l,rowExpanderIconProps:s,columnRegion:z,rowRegion:q,offsetTop:G,offsetLeft:J,areCellsLoading:f,rowVirtualizer:L,rowResizing:S,ghosts:C}),B=N?a.jsxs("div",{ref:t===Q.TOP?u:void 0,className:Bn,style:z==="center"?{paddingLeft:M}:void 0,children:[O&&a.jsxs(a.Fragment,{children:[c&&a.jsx(gs,{width:r,height:i}),y>0&&a.jsx(ws,{table:e,width:y,height:i,loading:v})]}),a.jsx(Es,{table:e,columnRegion:z,enableSorting:h,areColumnHeadersLoading:w,ghosts:C})]}):void 0;let D;switch(t){case Q.MAIN:D=j(i+Y,I+y+M);break;case Q.TOP:D=a.jsxs(a.Fragment,{children:[B,j(0,M)]});break;case Q.LEFT:D=a.jsx("div",{style:{paddingTop:Y},children:a.jsxs("div",{className:zt,style:{width:I+y+M},children:[a.jsx(Zt,{table:e,rowRegion:"center",rowHeaderWidth:r,enableRowHeader:c,selectionColumnWidth:y,areRowHeadersLoading:v,rowVirtualizer:L,rowResizing:S,ghosts:C}),j(0,0)]})});break;case Q.TOP_LEFT:D=a.jsxs(a.Fragment,{children:[B,a.jsxs("div",{className:zt,style:{width:I+y+M},children:[a.jsx(Zt,{table:e,rowRegion:"top",rowHeaderWidth:r,enableRowHeader:c,selectionColumnWidth:y,areRowHeadersLoading:v,rowVirtualizer:L,rowResizing:S,ghosts:C}),j(0,0)]})]});break;default:D=void 0}return a.jsx("div",{className:k(un,Ls(t)),style:b,children:a.jsx("div",{ref:T,className:mn,tabIndex:U&&F!=null?0:void 0,onKeyDown:U?F==null?void 0:F.handleKeyDown:void 0,onScroll:x,onWheel:E,children:D})})}function Cs({table:t,renderRowDetail:e,getCellProps:n,rowExpanderButtonProps:o,rowExpanderIconProps:l,rowHeaderWidth:s,enableRowHeader:r=!0,columnHeaderHeight:c,columnHeaderMeasureRef:i,enableColumnReordering:u=!1,enableSorting:h=!1,areCellsLoading:f,areColumnHeadersLoading:w,areRowHeadersLoading:v,selection:S,rowResizing:L,ghosts:C,enableRowVirtualization:T,overscanRowCount:x,scrollContainerRef:E,selectionColumnWidth:b=0}){const y=d.useRef(null),U=d.useRef(null),_=d.useRef(null),R=d.useRef(null),z=Et(t),q=dt(t),N=_t(t,L.getRowTop),O=(r?s:0)+b,F=He({table:t,columnHeaderHeight:c,frozenRowCount:q,frozenRowsHeight:N,getRowHeight:L.getRowSpanHeight,scrollContainerRef:E,enableRowVirtualization:T??!1,overscanRowCount:x??te}),{contextValue:M,guideIndex:Y,reorderingColumnId:I}=ts(t,u,y,E,O),[j,B]=d.useState({left:0,top:0}),D=t.state.columnResizing,G=(D==null?void 0:D.isResizingColumn)!=null&&D.isResizingColumn!==!1,J=L.resizingGuideTop!=null,lt=I!=null,g=d.useRef(!1);g.current=G||J||lt;const[A,H]=d.useState({vertical:0,horizontal:0}),$=d.useCallback(()=>{const P=E.current;P!=null&&(U.current!=null&&(U.current.scrollLeft=P.scrollLeft),_.current!=null&&(_.current.scrollTop=P.scrollTop),R.current!=null&&(R.current.scrollLeft=0,R.current.scrollTop=0))},[E]),X=d.useCallback(()=>{if($(),g.current){const P=E.current;P!=null&&B({left:P.scrollLeft,top:P.scrollTop})}},[E,$]),Z=d.useCallback(()=>{const P=E.current;if(P==null)return;const V=Math.max(0,P.offsetWidth-P.clientWidth),st=Math.max(0,P.offsetHeight-P.clientHeight);H(et=>et.vertical===V&&et.horizontal===st?et:{vertical:V,horizontal:st})},[E]),ct=t.getTotalSize();d.useLayoutEffect(()=>{const P=E.current;if(P==null)return;Z();const V=new ResizeObserver(Z);return V.observe(P),()=>V.disconnect()},[Z,E]),d.useLayoutEffect(()=>{Z()},[c,z,N,Z,L.totalHeight,ct]),d.useLayoutEffect(()=>{$()},[c,z,N,$]),d.useLayoutEffect(()=>{if(!g.current)return;const P=E.current;if(P==null)return;const V=P.scrollLeft,st=P.scrollTop;(V!==j.left||st!==j.top)&&B({left:V,top:st})},[G,lt,J,E,j.left,j.top]);const nt=d.useCallback(P=>{const V=E.current;if(V==null)return;const st=Math.max(0,V.scrollWidth-V.clientWidth),et=Math.max(0,V.scrollHeight-V.clientHeight),rt=Jt(V.scrollLeft+P.deltaX,0,st),at=Jt(V.scrollTop+P.deltaY,0,et);rt!==V.scrollLeft&&(V.scrollLeft=rt),at!==V.scrollTop&&(V.scrollTop=at)},[E]),tt=c+N,it=O+z,ut={table:t,renderRowDetail:e,getCellProps:n,rowExpanderButtonProps:o,rowExpanderIconProps:l,rowHeaderWidth:s,enableRowHeader:r,selectionColumnWidth:b,columnHeaderHeight:c,enableSorting:h,areCellsLoading:f,areColumnHeadersLoading:w,areRowHeadersLoading:v,rowResizing:L,rowVirtualizer:F,ghosts:C};return a.jsx("div",{ref:y,className:En,children:a.jsx(Me.Provider,{value:M,children:a.jsxs(Re.Provider,{value:S,children:[a.jsx(pt,{...ut,quadrantType:Q.MAIN,scrollContainerRef:E,onScroll:X}),a.jsx(pt,{...ut,quadrantType:Q.TOP,columnHeaderMeasureRef:i,scrollContainerRef:U,onWheel:nt,style:{height:tt,left:O,right:A.vertical}}),a.jsx(pt,{...ut,quadrantType:Q.LEFT,scrollContainerRef:_,onWheel:nt,style:{bottom:A.horizontal,top:c,width:it}}),a.jsx(pt,{...ut,quadrantType:Q.TOP_LEFT,scrollContainerRef:R,onWheel:nt,style:{height:tt,width:it}}),a.jsx(ns,{table:t,rowHeaderWidth:O,columnHeaderHeight:c,scrollLeft:j.left,scrollTop:j.top,frozenRowCount:q,resizingGuideTop:L.resizingGuideTop,resizingRowIndex:L.resizingRowIndex}),a.jsx(es,{table:t,reorderingColumnId:I,guideIndex:Y,rowHeaderWidth:O,scrollLeft:j.left})]})})})}function Jt(t,e,n){return Math.max(e,Math.min(n,t))}function Ts({table:t,renderRowDetail:e,getCellProps:n,rowExpanderButtonProps:o,rowExpanderIconProps:l,rowDetailHeight:s,rowHeight:r,rowHeaderWidth:c,enableRowHeader:i=!0,columnHeaderHeight:u,enableColumnReordering:h=!1,enableSorting:f=!1,areCellsLoading:w,areColumnHeadersLoading:v,areRowHeadersLoading:S,enableFocusedCell:L=!1,enableGhostCells:C=!1,bodyContextMenuRenderer:T,enableBodyContextMenu:x,onFocusedCell:E,onFocusedRegion:b,selectedRegions:y,onSelection:U,selectionModes:_,enableRowVirtualization:R,overscanRowCount:z,enableRowResizing:q=!1,rowHeights:N,defaultRowHeights:O,onRowHeightChanged:F,minRowHeight:M,maxRowHeight:Y,selectionColumnWidth:I=0,className:j,...B}){const D=d.useRef(null),G=(i?c:0)+I,{ref:J,height:lt}=Yn({minHeight:u,headerRowCount:t.getHeaderGroups().length}),g=d.useMemo(()=>{var ct;if(!e||!t.options.getIsRowExpanded&&!((ct=t.getIsSomeRowsExpanded)!=null&&ct.call(t)))return;const Z=t.getRowModel().rows;return nt=>{var it;const tt=Z[nt];return(it=tt.getIsExpanded)!=null&&it.call(tt)&&tt.getCanExpand()?Math.max(0,s):0}},[e,s,t]),A=qn({rowHeight:r,rowCount:t.getRowModel().rows.length,getDetailHeight:g,rowHeights:N,defaultRowHeights:O,enableRowResizing:q,minRowHeight:M,maxRowHeight:Y,onRowHeightChanged:F}),H=Vn({table:t,getRowTop:A.getRowTop,getRowHeight:A.getRowHeight,scrollContainerRef:D,rowHeaderWidth:G,columnHeaderHeight:lt,bodyContextMenuRenderer:T,enableBodyContextMenu:x,enableFocusedCell:L,onFocusedCell:E,onFocusedRegion:b,selectedRegions:y,onSelection:U,selectionModes:_}),$=Xn({enableGhostCells:C,rowHeight:r,rowHeaderWidth:G,columnHeaderHeight:lt,totalWidth:t.getTotalSize(),totalHeight:A.totalHeight,scrollContainerRef:D}),X=H.isSelectionModeEnabled(ot.CELLS)?Rn:void 0;return a.jsx("div",{...B,className:k(tn,X,{[ln]:$!=null&&$.columnCount>0,[rn]:$!=null&&$.rowCount>0},j),children:a.jsx(Cs,{table:t,renderRowDetail:e,getCellProps:n,rowExpanderButtonProps:o,rowExpanderIconProps:l,rowHeaderWidth:c,enableRowHeader:i,columnHeaderHeight:lt,columnHeaderMeasureRef:J,enableColumnReordering:h,enableSorting:f,areCellsLoading:w,areColumnHeadersLoading:v,areRowHeadersLoading:S,selection:H,rowResizing:A,ghosts:$,enableRowVirtualization:R,overscanRowCount:z,scrollContainerRef:D,selectionColumnWidth:I})})}const xs=()=>!0;function vs({htmlProps:t,rowHeight:e=ke,expandedRows:n,initialExpandedRows:o,onExpandedRowsChange:l,renderRowDetail:s,getCellProps:r,rowExpanderButtonProps:c,rowExpanderIconProps:i,rowDetailHeight:u=100,showRowSelectionCheckboxes:h=!1,rowSelectionColumnWidth:f=Ge,rowHeaderWidth:w=ze,enableRowHeader:v=!0,columnHeaderHeight:S=ee,enableColumnReordering:L=!1,enableSorting:C=!1,loadingOptions:T=[],enableFocusedCell:x=!1,enableGhostCells:E=!1,bodyContextMenuRenderer:b,enableBodyContextMenu:y,onFocusedCell:U,onFocusedRegion:_,selectedRegions:R,onSelection:z,selectionModes:q,enableRowVirtualization:N=!1,numFrozenColumns:O=0,numFrozenRows:F=0,overscanRowCount:M=te,columnVisibility:Y,enableRowResizing:I=!1,rowHeights:j,defaultRowHeights:B,onRowHeightChanged:D,minRowHeight:G,maxRowHeight:J,rowSelection:lt,defaultRowSelection:g,...A}){var et,rt,at,ft,bt;const[H,$]=Ht({value:lt??((et=A.state)==null?void 0:et.rowSelection),initialValue:g??((rt=A.initialState)==null?void 0:rt.rowSelection),finalValue:{},onChange:A.onRowSelectionChange}),X=(at=A.atoms)==null?void 0:at.expanded,[Z,ct]=Ht({value:(X==null?void 0:X.get())??n??((ft=A.state)==null?void 0:ft.expanded),initialValue:o??((bt=A.initialState)==null?void 0:bt.expanded),finalValue:{},onChange:l}),nt=be({...A,initialState:o===void 0?A.initialState:{...A.initialState,expanded:o},getRowCanExpand:A.getRowCanExpand??(s!=null&&A.enableExpanding!==!1?xs:void 0),enableSorting:C,state:{...A.state,...Y!==void 0?{columnVisibility:Y}:{},rowSelection:H,expanded:Z},onRowSelectionChange:$,onExpandedChange:Rt=>{ct(Rt),A.onExpandedChange?A.onExpandedChange(Rt):X==null||X.set(Oe=>K.functionalUpdate(Rt,Oe))}}),tt=d.useContext(jt),it=tt?nt.getPrePaginatedRowModel().rows.length:void 0;d.useLayoutEffect(()=>{it!==void 0&&(tt==null||tt(it))},[it,tt]),Ue({table:nt,numFrozenColumns:O,numFrozenRows:F});const ut=At(T,Ct.CELLS),P=At(T,Ct.COLUMN_HEADERS),V=At(T,Ct.ROW_HEADERS),st=a.jsx(Ts,{table:nt,rowHeight:e,renderRowDetail:s,getCellProps:r,rowExpanderButtonProps:c,rowExpanderIconProps:i,rowDetailHeight:u,rowHeaderWidth:w,enableRowHeader:v,columnHeaderHeight:S,enableColumnReordering:L,enableSorting:C,areCellsLoading:ut,areColumnHeadersLoading:P,areRowHeadersLoading:V,enableFocusedCell:x,enableGhostCells:E,bodyContextMenuRenderer:b,enableBodyContextMenu:y,onFocusedCell:U,onFocusedRegion:_,selectedRegions:R,onSelection:z,selectionModes:q,enableRowVirtualization:N,overscanRowCount:M,enableRowResizing:I,rowHeights:j,defaultRowHeights:B,onRowHeightChanged:D,minRowHeight:G,maxRowHeight:J,selectionColumnWidth:h?f:0,...t});return tt?a.jsx(jt.Provider,{value:void 0,children:st}):st}const Ie=10,je=[10,20,50,100];function ye({pageIndex:t,pageSize:e,pageCount:n,rowCount:o,pageSizeOptions:l=je,onPageIndexChange:s,onPageSizeChange:r,className:c}){const i=n!=null&&n>=0?n:void 0,u=t>0,h=i===void 0?!0:t<i-1,f=o===void 0||o===0?0:t*e+1,w=o===void 0?void 0:Math.min((t+1)*e,o),v=l.includes(e)?l:[...l,e].sort((S,L)=>S-L);return a.jsxs("div",{className:k(cn,c),children:[a.jsxs("div",{className:Gt,children:[a.jsx("span",{className:Mt,children:"Rows per page:"}),a.jsx(W.HTMLSelect,{"aria-label":"Rows per page",onChange:S=>r(Number(S.currentTarget.value)),options:v,value:e}),o!==void 0&&a.jsxs("span",{className:Mt,children:[f===0?0:`${f}–${w}`," of ",o]})]}),a.jsxs("div",{className:Gt,children:[a.jsxs("span",{className:Mt,children:["Page ",t+1,i!==void 0?` of ${i}`:""]}),a.jsxs(W.ButtonGroup,{children:[a.jsx(W.Button,{"aria-label":"First page",disabled:!u,icon:"double-chevron-left",onClick:()=>s(0)}),a.jsx(W.Button,{"aria-label":"Previous page",disabled:!u,icon:"chevron-left",onClick:()=>s(t-1)}),a.jsx(W.Button,{"aria-label":"Next page",disabled:!h,icon:"chevron-right",onClick:()=>s(t+1)}),a.jsx(W.Button,{"aria-label":"Last page",disabled:i===void 0||!h,icon:"double-chevron-right",onClick:()=>{i!==void 0&&s(i-1)}})]})]})]})}const ps=K.tableFeatures({...Nt,rowPaginationFeature:K.rowPaginationFeature,paginatedRowModel:K.createPaginatedRowModel()});function As(t){function e({data:o,initialState:l,state:s,features:r,onPaginationChange:c,manualPagination:i,pageCount:u,rowCount:h,initialPageIndex:f=0,initialPageSize:w=Ie,pageSizeOptions:v,showPaginationBar:S=!0,paginationBarClassName:L,...C}){const[T,x]=d.useState(()=>{var B,D;return{pageIndex:((B=l==null?void 0:l.pagination)==null?void 0:B.pageIndex)??f,pageSize:((D=l==null?void 0:l.pagination)==null?void 0:D.pageSize)??w}}),E=s==null?void 0:s.pagination,b=E??T,{pageIndex:y,pageSize:U}=b,_=d.useCallback(B=>{c==null||c(B),E===void 0&&x(D=>K.functionalUpdate(B,D))},[E,c]),R=i===!0,[z,q]=d.useState(),N=!R&&C.getSubRows!=null&&C.paginateExpandedRows!==!1,O=N?z:o.length,F=R?h:O,M=d.useMemo(()=>R?u!=null&&u>=0?u:h!=null?Math.ceil(h/U):void 0:O===void 0?void 0:Math.max(1,Math.ceil(O/U)),[O,R,u,U,h]);d.useEffect(()=>{if(M===void 0)return;const B=Math.max(0,M-1);y>B&&_(D=>({...D,pageIndex:B}))},[_,M,y]);const Y=d.useMemo(()=>r==null?ps:K.tableFeatures({...Nt,...r,rowPaginationFeature:K.rowPaginationFeature,paginatedRowModel:K.createPaginatedRowModel()}),[r]),I=d.useCallback(B=>{_(D=>({...D,pageIndex:Math.max(0,B)}))},[_]),j=d.useCallback(B=>{_(D=>({...D,pageIndex:0,pageSize:B}))},[_]);return a.jsxs("div",{className:an,children:[a.jsx(jt.Provider,{value:N?q:void 0,children:a.jsx(t,{...C,data:o,initialState:l,state:{...s,pagination:b},features:Y,onPaginationChange:_,manualPagination:i,pageCount:u,rowCount:h})}),S&&a.jsx(ye,{className:L,onPageIndexChange:I,onPageSizeChange:j,pageCount:M,pageIndex:y,pageSize:U,pageSizeOptions:v,rowCount:F})]})}const n=t.displayName??t.name??"Table";return e.displayName=`withPagination(${n})`,e}exports.BP_Table=vs;exports.DEFAULT_BP_TABLE_FEATURES=Nt;exports.DEFAULT_PAGE_SIZE=Ie;exports.DEFAULT_PAGE_SIZE_OPTIONS=je;exports.Direction=Ae;exports.FocusMode=Ft;exports.RegionCardinality=ot;exports.Regions=p;exports.TableLoadingOption=Ct;exports.TablePaginationBar=ye;exports.directionToDelta=Se;exports.hasLoadingOption=At;exports.moveFocusedCell=Dn;exports.resizeRegion=$n;exports.withPagination=As;
|
|
6
|
+
//# sourceMappingURL=blueprintjs-react-table.cjs.map
|