@bigcapitalhq/blueprintjs-react-table 0.0.0-stage → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +456 -2
  2. package/dist/blueprintjs-react-table.cjs +6 -0
  3. package/dist/blueprintjs-react-table.cjs.map +1 -0
  4. package/dist/blueprintjs-react-table.js +2533 -0
  5. package/dist/blueprintjs-react-table.js.map +1 -0
  6. package/dist/styles.css +1 -0
  7. package/dist/types/components/BP_Table.d.ts +219 -0
  8. package/dist/types/components/body/TableBody.d.ts +29 -0
  9. package/dist/types/components/body/TableBodyCell.d.ts +18 -0
  10. package/dist/types/components/body/TableGhostCell.d.ts +20 -0
  11. package/dist/types/components/body/TableGhostCells.d.ts +33 -0
  12. package/dist/types/components/body/TableRowHeaderCell.d.ts +19 -0
  13. package/dist/types/components/body/TableRowHeaders.d.ts +28 -0
  14. package/dist/types/components/body/TableRowSelectionCell.d.ts +18 -0
  15. package/dist/types/components/common/LoadableContent.d.ts +19 -0
  16. package/dist/types/components/common/cell-selection.d.ts +57 -0
  17. package/dist/types/components/common/cellCoordinates.d.ts +29 -0
  18. package/dist/types/components/common/classes.d.ts +108 -0
  19. package/dist/types/components/common/dimensions.d.ts +26 -0
  20. package/dist/types/components/common/menu-context.d.ts +81 -0
  21. package/dist/types/components/common/pinning.d.ts +44 -0
  22. package/dist/types/components/common/region.d.ts +89 -0
  23. package/dist/types/components/common/table-selection-context.d.ts +3 -0
  24. package/dist/types/components/container/TableContainer.d.ts +30 -0
  25. package/dist/types/components/head/TableColumnHeaderMenu.d.ts +9 -0
  26. package/dist/types/components/head/TableColumnHeaders.d.ts +12 -0
  27. package/dist/types/components/head/TableHead.d.ts +13 -0
  28. package/dist/types/components/head/TableHeadCell.d.ts +10 -0
  29. package/dist/types/components/head/TableMenu.d.ts +6 -0
  30. package/dist/types/components/head/TableRowSelectionHeaderCell.d.ts +13 -0
  31. package/dist/types/components/head/table-column-reorder-context.d.ts +3 -0
  32. package/dist/types/components/layers/TableRegionLayer.d.ts +18 -0
  33. package/dist/types/components/layers/TableReorderGuides.d.ts +17 -0
  34. package/dist/types/components/layers/TableResizeGuides.d.ts +24 -0
  35. package/dist/types/components/pagination/TablePaginationBar.d.ts +30 -0
  36. package/dist/types/components/pagination/constants.d.ts +4 -0
  37. package/dist/types/components/pagination/withPagination.d.ts +51 -0
  38. package/dist/types/components/quadrant/TableQuadrant.d.ts +48 -0
  39. package/dist/types/components/quadrant/TableQuadrantStack.d.ts +38 -0
  40. package/dist/types/components/quadrant/quadrant-type.d.ts +10 -0
  41. package/dist/types/hooks/use-bp-table-instance.d.ts +33 -0
  42. package/dist/types/hooks/use-cell-selection.d.ts +62 -0
  43. package/dist/types/hooks/use-column-header-height.d.ts +24 -0
  44. package/dist/types/hooks/use-column-reorder.d.ts +20 -0
  45. package/dist/types/hooks/use-freeze-pinning.d.ts +25 -0
  46. package/dist/types/hooks/use-ghost-cells.d.ts +43 -0
  47. package/dist/types/hooks/use-row-resizing.d.ts +57 -0
  48. package/dist/types/hooks/use-row-virtualizer.d.ts +26 -0
  49. package/dist/types/hooks/use-uncontrolled.d.ts +19 -0
  50. package/dist/types/index.d.ts +25 -0
  51. package/dist/types/types.d.ts +76 -0
  52. package/package.json +83 -4
package/README.md CHANGED
@@ -1,3 +1,457 @@
1
- # Temporary Holding Version
1
+ # blueprintjs-react-table
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A Blueprint.js-styled data table for React, built on [TanStack Table v9](https://tanstack.com/table) with row virtualization from [TanStack Virtual](https://tanstack.com/virtual) and the look-and-feel of [Blueprint.js v6](https://blueprintjs.com/).
4
+
5
+ `BP_Table` recreates the classic Blueprint `<Table>` experience — a quadrant layout with frozen column and row headers, drag-to-reorder columns, sort menus, keyboard-driven focus and selection, and drag-to-resize rows — while keeping the full power of TanStack Table's headless API for data, columns, and state management. A Storybook is included to demo every feature.
6
+
7
+ ## Features
8
+
9
+ ### Layout & styling
10
+
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.
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.
15
+ - **Grouped column headers** — nested column definitions render on additional header rows; each group spans its child columns.
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`).
17
+
18
+ ### Interactivity
19
+
20
+ - **Column reordering** — drag column headers to reorder columns (`enableColumnReordering`).
21
+ - **Column resizing** — drag the resize handle on header cells (TanStack's `column.getResizeHandler()`).
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`.
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.
27
+ - **Row resizing** — drag the horizontal handle at the bottom of a row header (`enableRowResizing`); controlled or uncontrolled, with configurable min/max heights.
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`).
30
+
31
+ ### Performance & data
32
+
33
+ - **Row virtualization** — only the visible rows (plus an overscan buffer) are rendered, so the table scales to tens of thousands of rows (`enableRowVirtualization`, `overscanRowCount`).
34
+ - **Full TanStack Table v9 option pass-through** — `columns`, `data`, `state`, `on*Change` callbacks, and every other table option are forwarded to `useReactTable`.
35
+ - **Loading skeletons** — render skeleton placeholders in the cells, column headers, and/or row headers (`loadingOptions`).
36
+ - **Column `meta` classnames** — style individual columns' body and header cells via `meta.bodyCellClassName` / `meta.headCellClassName`.
37
+
38
+ ## Requirements
39
+
40
+ - Node.js 18+
41
+ - React 18
42
+
43
+ ## Getting started
44
+
45
+ ```bash
46
+ npm install blueprintjs-react-table
47
+ ```
48
+
49
+ The table renders with Blueprint's visual language, so your app must already
50
+ be styled with Blueprint and have React 18 installed:
51
+
52
+ ```bash
53
+ npm install @blueprintjs/core @blueprintjs/icons react react-dom @tanstack/react-table @tanstack/react-virtual
54
+ ```
55
+
56
+ Import the compiled table styles once, alongside Blueprint's own styles (if
57
+ you don't already import them):
58
+
59
+ ```tsx
60
+ import '@blueprintjs/core/lib/css/blueprint.css';
61
+ import '@blueprintjs/icons/lib/css/blueprint-icons.css';
62
+ import 'blueprintjs-react-table/styles.css';
63
+
64
+ import { BP_Table } from 'blueprintjs-react-table';
65
+ ```
66
+
67
+ ```bash
68
+ # For developing this library:
69
+ npm install
70
+
71
+ # Run the Storybook with live demos of every feature
72
+ npm run storybook
73
+
74
+ # Run the bare Vite dev app
75
+ npm run dev
76
+ ```
77
+
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.
79
+
80
+ ## Basic usage
81
+
82
+ `BP_Table` is a thin wrapper around TanStack Table: you define columns with `createColumnHelper` and pass `data` + `columns` in, exactly like any TanStack table.
83
+
84
+ ```tsx
85
+ import { BP_Table } from 'blueprintjs-react-table';
86
+ import { createColumnHelper } from '@tanstack/react-table';
87
+ import type { BP_TableFeatures } from 'blueprintjs-react-table';
88
+
89
+ type Person = {
90
+ id: number;
91
+ name: string;
92
+ age: number;
93
+ role: string;
94
+ };
95
+
96
+ const helper = createColumnHelper<BP_TableFeatures, Person>();
97
+
98
+ const columns = helper.columns([
99
+ helper.accessor('id', { header: 'ID' }),
100
+ helper.accessor('name', { header: 'Name' }),
101
+ helper.accessor('age', { header: 'Age' }),
102
+ helper.accessor('role', { header: 'Role' }),
103
+ ]);
104
+
105
+ const data: Person[] = [
106
+ { id: 1, name: 'Ada Lovelace', age: 36, role: 'Mathematician' },
107
+ { id: 2, name: 'Alan Turing', age: 41, role: 'Computer Scientist' },
108
+ { id: 3, name: 'Grace Hopper', age: 85, role: 'Admiral' },
109
+ ];
110
+
111
+ export function PeopleTable() {
112
+ return <BP_Table data={data} columns={columns} />;
113
+ }
114
+ ```
115
+
116
+ Enable Blueprint-style interactions with a few flags:
117
+
118
+ ```tsx
119
+ <BP_Table
120
+ data={data}
121
+ columns={columns}
122
+ enableColumnReordering
123
+ enableSorting
124
+ enableFocusedCell
125
+ enableRowResizing
126
+ />
127
+ ```
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
+
147
+ State can be controlled from outside the table through the standard TanStack props:
148
+
149
+ ```tsx
150
+ const [sorting, setSorting] = useState<SortingState>([]);
151
+
152
+ <BP_Table
153
+ data={data}
154
+ columns={columns}
155
+ enableSorting
156
+ state={{ sorting }}
157
+ onSortingChange={setSorting}
158
+ />;
159
+ ```
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
+ Right-click context menus are customized with a renderer that receives the
206
+ Blueprint-style `BP_MenuContext` (the equivalent of Blueprint's `MenuContext`)
207
+ and returns the menu to show:
208
+
209
+ ```tsx
210
+ import { Menu, MenuItem } from '@blueprintjs/core';
211
+
212
+ <BP_Table
213
+ data={data}
214
+ columns={columns}
215
+ bodyContextMenuRenderer={(context) => (
216
+ <Menu>
217
+ <MenuItem icon="trash" text={`Delete ${context.getTargetRow()?.original.name ?? 'row'}`} />
218
+ <MenuItem icon="clipboard" text={`Copy ${context.getUniqueCells().length} cells`} />
219
+ </Menu>
220
+ )}
221
+ />;
222
+ ```
223
+
224
+ `getTarget()` / `getTargetRow()` / `getTargetCell()` report the right-clicked
225
+ cell, and `getRegions()` / `getSelectedRegions()` report the user-intended
226
+ regions: the current selection when the right-click landed inside it, otherwise
227
+ just the clicked cell. A right-click outside the current selection moves the
228
+ selection (and the focused cell, when `enableFocusedCell` is enabled) to the
229
+ clicked cell before the menu opens. Right-clicks that don't land on a body cell
230
+ (ghost cells, empty space) fall back to the browser's native context menu.
231
+ Pass `enableBodyContextMenu={false}` to disable the custom menu.
232
+
233
+ ## Pagination (HOC)
234
+
235
+ Pagination is layered on top of `BP_Table` by the `withPagination` higher-order
236
+ component, so the core table stays pagination-free. The HOC registers TanStack's
237
+ row pagination feature, owns the page state, and renders a Blueprint-styled bar
238
+ below the table:
239
+
240
+ ```tsx
241
+ import { BP_Table, withPagination } from 'blueprintjs-react-table';
242
+
243
+ const PaginatedTable = withPagination(BP_Table);
244
+
245
+ <PaginatedTable data={data} columns={columns} initialPageSize={20} />;
246
+ ```
247
+
248
+ Pagination options (on top of every `BP_TableProps`):
249
+
250
+ | Prop | Type | Default | Description |
251
+ | --- | --- | --- | --- |
252
+ | `initialPageSize` | `number` | `10` | Initial page size for uncontrolled pagination. |
253
+ | `initialPageIndex` | `number` | `0` | Initial zero-based page index for uncontrolled pagination. |
254
+ | `pageSizeOptions` | `readonly number[]` | `[10, 20, 50, 100]` | Page sizes offered by the bar's select. |
255
+ | `showPaginationBar` | `boolean` | `true` | Hide the bar while keeping the table paginated. |
256
+ | `paginationBarClassName` | `string` | — | Class name(s) for the pagination bar. |
257
+
258
+ Pagination becomes controlled when `state.pagination` is provided; pair it with
259
+ `onPaginationChange`:
260
+
261
+ ```tsx
262
+ const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 });
263
+
264
+ <PaginatedTable
265
+ data={data}
266
+ columns={columns}
267
+ state={{ pagination }}
268
+ onPaginationChange={setPagination}
269
+ />;
270
+ ```
271
+
272
+ For server-side pagination, pass `manualPagination` plus `pageCount` (or
273
+ `rowCount`) and hand the table only the current page of rows; the table then
274
+ skips client-side slicing and the bar uses the supplied counts:
275
+
276
+ ```tsx
277
+ <PaginatedTable
278
+ data={currentPageRows}
279
+ columns={columns}
280
+ manualPagination
281
+ pageCount={totalPageCount}
282
+ rowCount={totalRowCount}
283
+ state={{ pagination }}
284
+ onPaginationChange={setPagination}
285
+ />;
286
+ ```
287
+
288
+ Notes:
289
+
290
+ - Pagination composes with sorting, row virtualization, frozen rows/columns,
291
+ and row resizing. Sorting (or a `data` change) resets to the first page by
292
+ default, per TanStack's `autoResetPageIndex`.
293
+ - Row numbers, ledger striping, and row resizing are **page-local**: each page
294
+ numbers its rows starting at 1. Cell selections are keyed by row ids, so a
295
+ range can light up on every page it overlaps (TanStack's `cellSelectionFeature`
296
+ semantics); the `onSelection` callback reports regions resolved against the
297
+ currently rendered page's rows.
298
+
299
+ ### Pagination bar
300
+
301
+ The bar rendered below the table is the exported `TablePaginationBar` component.
302
+ `withPagination` renders it for you, and it can also be used standalone for a
303
+ custom pagination implementation. It is presentational: page state and
304
+ navigation are owned by the caller.
305
+
306
+ | Prop | Type | Default | Description |
307
+ | --- | --- | --- | --- |
308
+ | `pageIndex` | `number` | — | Zero-based index of the current page. |
309
+ | `pageSize` | `number` | — | Number of rows shown per page. |
310
+ | `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. |
311
+ | `rowCount` | `number` | — | Total number of rows across all pages, used for the "1–10 of 240" summary. When `undefined`, the summary is omitted. |
312
+ | `pageSizeOptions` | `readonly number[]` | `[10, 20, 50, 100]` | Page sizes offered by the rows-per-page select. |
313
+ | `onPageIndexChange` | `(pageIndex: number) => void` | — | Invoked with the requested page index when a navigation control is used. |
314
+ | `onPageSizeChange` | `(pageSize: number) => void` | — | Invoked with the requested page size when the rows-per-page select changes. |
315
+ | `className` | `string` | — | Class name(s) for the bar. |
316
+
317
+ ## Core props
318
+
319
+ | Prop | Type | Default | Description |
320
+ | --- | --- | --- | --- |
321
+ | `data` / `columns` | TanStack `TableOptions` | — | Table data and column definitions (full TanStack option set is forwarded). |
322
+ | `rowHeight` | `number` | `20` | Height of each body row, in pixels. |
323
+ | `rowHeaderWidth` | `number` | `30` | Width of the frozen row-header column, in pixels. |
324
+ | `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). |
325
+ | `columnHeaderHeight` | `number` | `30` | Height of the frozen column-header row(s), in pixels. |
326
+ | `enableColumnReordering` | `boolean` | `false` | Drag column headers to reorder columns. |
327
+ | `enableSorting` | `boolean` | `false` | Chevron sort menu on sortable headers; also enables TanStack sorting. |
328
+ | `enableFocusedCell` | `boolean` | `false` | Focused cell with keyboard navigation and selection (arrow keys, Shift+arrows, Tab, Cmd/Ctrl+A, Escape). |
329
+ | `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. |
330
+ | `bodyContextMenuRenderer` | `(context: BP_MenuContext<TData>) => ReactElement \| null \| undefined` | — | Render a custom context menu when right-clicking a body cell. |
331
+ | `enableBodyContextMenu` | `boolean` | `true` when a renderer is set | Whether the body context menu is enabled. |
332
+ | `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. |
333
+ | `onFocusedRegion` | `(region) => void` | — | Fires when the focused region changes. |
334
+ | `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. |
335
+ | `selectionModes` | `RegionCardinality[]` | all | Restricts which selection types are allowed (cells, rows, columns, table). |
336
+ | `showRowSelectionCheckboxes` | `boolean` | `false` | Checkbox column right after the row numbers, with a select-all checkbox in its header; independent of the region selection. |
337
+ | `rowSelectionColumnWidth` | `number` | `30` | Width of the row-selection checkbox column (only used with `showRowSelectionCheckboxes`). |
338
+ | `rowSelection` | `BP_RowSelectionState` | — | Controlled row selection (`true` = selected). Convenience alias for `state.rowSelection`. |
339
+ | `defaultRowSelection` | `BP_RowSelectionState` | — | Initial row selection for the uncontrolled mode; falls back to `initialState.rowSelection`. |
340
+ | `onRowSelectionChange` | `(selection) => void` | — | Fires whenever the row selection changes, in both the controlled and uncontrolled modes. |
341
+ | `enableRowVirtualization` | `boolean` | `false` | Render only visible rows (plus overscan) — scales to very large data sets. |
342
+ | `numFrozenColumns` | `number` | `0` | Freeze the leftmost N columns in place while the rest scroll; derived from the current column order and visibility. |
343
+ | `numFrozenRows` | `number` | `0` | Freeze the topmost N rows in place while the rest scroll; derived from the current row model (so it follows sorting). |
344
+ | `overscanRowCount` | `number` | `5` | Rows rendered above/below the viewport when virtualizing. |
345
+ | `columnVisibility` | `BP_VisibilityState` | — | Controlled column visibility (`true` = visible). Convenience alias for `state.columnVisibility`. |
346
+ | `enableRowResizing` | `boolean` | `false` | Drag the handle on a row header to resize that row. |
347
+ | `rowHeights` / `defaultRowHeights` | `Array<number \| undefined>` | — | Controlled / initial per-row heights; `undefined` falls back to `rowHeight`. |
348
+ | `onRowHeightChanged` | `(index, height) => void` | — | Fires continuously during a row-resize drag (and once when it ends). |
349
+ | `minRowHeight` / `maxRowHeight` | `number` | `6` / `100` | Clamps for row resizing. |
350
+ | `loadingOptions` | `TableLoadingOption[]` | `[]` | Renders skeleton placeholders: `CELLS`, `COLUMN_HEADERS`, `ROW_HEADERS`. |
351
+ | `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). |
352
+
353
+ ## Cell selection
354
+
355
+ Cell-range selection is backed by TanStack Table's built-in
356
+ `cellSelectionFeature` plugin: the plugin owns the selection state and the
357
+ mouse interactions (drag selection, Shift-click extend, Ctrl/Cmd-click
358
+ multi-range include/exclude), and `BP_Table` layers the Blueprint experience on
359
+ top — the `selectedRegions` / `onSelection` / `selectionModes` props, full
360
+ row/column/table selection from the headers and corner menu, keyboard
361
+ navigation, and the `BP_MenuContext` API.
362
+
363
+ Things worth knowing:
364
+
365
+ - **Ranges are keyed by row and column ids**, so a selection follows its rows
366
+ when the table is sorted or columns are reordered. Pair the table with
367
+ `getRowId` for stable ids from your data. A range whose corners are
368
+ filtered out or hidden stays in state (inert) and comes back when its rows
369
+ or columns return.
370
+ - **Full-row/column/table selections are emulated** as ranges spanning all
371
+ currently visible rows and/or columns. The cardinality is inferred back on
372
+ read, so `onSelection` and `BP_MenuContext` still report `FULL_ROWS`,
373
+ `FULL_COLUMNS`, and `FULL_TABLE` regions.
374
+ - **`selectedRegions` control** is translated to the plugin's
375
+ `cellSelection` state; regions outside the current row/column counts are
376
+ ignored. TanStack's native `state.cellSelection` / `onCellSelectionChange`
377
+ also pass straight through for consumers that prefer the plugin's API.
378
+ - **Selection resets when `data` changes**, per the plugin's
379
+ `autoResetCellSelection` (default `true`); pass `autoResetCellSelection: false`
380
+ to keep ranges across data changes.
381
+ - The **focused cell** is the plugin's active cell (the anchor of the most
382
+ recent range), reported through `onFocusedCell` / `onFocusedRegion`. Unlike
383
+ the old custom implementation, it is not separately controllable.
384
+ - **Keyboard navigation** (arrow keys, Shift+arrows, Tab, Cmd/Ctrl+A, Escape)
385
+ drives the plugin's `moveCellSelection` / `extendCellSelection` /
386
+ `selectAllCells` / `resetCellSelection` APIs. `Tab` collapses the selection
387
+ onto the neighboring cell.
388
+ - **Drags start on rendered cells only**: ghost cells and rows scrolled out of
389
+ a virtualized window do not start or extend a drag.
390
+
391
+ ## Storybook stories
392
+
393
+ | Story | What it demos |
394
+ | --- | --- |
395
+ | `Basic` | Minimal table with column reordering. |
396
+ | `ColumnGroups` | Nested column definitions on a second header row. |
397
+ | `Loading` | Skeleton placeholders in cells, column headers, and row headers. |
398
+ | `GhostCells` | Empty ghost cells fill leftover space when the table is smaller than its viewport. |
399
+ | `FocusSelection` | Click/drag selection, Ctrl/Cmd multi-range, row/column/corner-header selection, arrow-key focus, Shift+arrows, Cmd/Ctrl+A, Escape. |
400
+ | `RowHeadersDisabled` | `enableRowHeader={false}` hides the row-number column and the corner menu; the checkbox column is independent and still renders. |
401
+ | `RowSelection` | Uncontrolled checkbox row selection seeded by `defaultRowSelection`, with shift-click ranges, select-all, and a change listener. |
402
+ | `ControlledRowSelection` | Caller-owned `rowSelection` driven by toolbar buttons and the checkboxes. |
403
+ | `BodyContextMenu` | Right-click a cell for a custom Blueprint menu acting on the clicked cell or the current selection. |
404
+ | `Sorting` | Header chevron menu with Sort Asc / Sort Desc / Clear Sort. |
405
+ | `ControlledSorting` | Sorting state owned by the caller via `state` / `onSortingChange`. |
406
+ | `RowVirtualization` | 10,000 rows with only visible rows rendered. |
407
+ | `ColumnVisibility` | Controlled column visibility with `enableHiding: false` support. |
408
+ | `RowResizing` | Uncontrolled row resizing with `defaultRowHeights`. |
409
+ | `ControlledRowResizing` | Row heights owned by the caller via `rowHeights` / `onRowHeightChanged`. |
410
+ | `EditableCells` | Custom cell renderers (Blueprint `InputGroup`, `Checkbox`, `Tag`) with `meta.bodyCellClassName` styling. |
411
+ | `FrozenColumnsAndRows` | Frozen columns and rows with focus, selection, resizing, and cross-boundary reordering. |
412
+ | `FrozenColumnsVirtualized` | 10,000 rows with frozen columns/rows and row virtualization. |
413
+ | `FrozenColumnsWithGhostCells` | Ghost cells filling the leftover space around frozen rows/columns. |
414
+ | `Pagination/ClientSide` | `withPagination(BP_Table)` slicing 240 rows client-side, with sorting (resets to page 1) and page-size control. |
415
+ | `Pagination/WithVirtualization` | Paginated pages of a 10,000-row data set, virtualized within the current page. |
416
+ | `Pagination/ManualPagination` | Server-side pagination with `manualPagination`, `pageCount` / `rowCount`, and controlled state. |
417
+
418
+ ## Scripts
419
+
420
+ | Command | Description |
421
+ | --- | --- |
422
+ | `npm run dev` | Start the Vite dev server. |
423
+ | `npm run build` | Type-check and build the publishable library (`dist/`: ESM + CJS bundles, `styles.css`, and `.d.ts` types). |
424
+ | `npm run preview` | Preview the production build locally. |
425
+ | `npm run lint` | Run ESLint. |
426
+ | `npm run storybook` | Start Storybook on port 6006. |
427
+ | `npm run build-storybook` | Build a static Storybook site. |
428
+
429
+ Publishing: `npm run build` runs automatically via `prepublishOnly` before
430
+ `npm publish`. The `dist/` directory is the only thing shipped in the npm
431
+ tarball.
432
+
433
+ ## Tech stack & structure
434
+
435
+ - **React 18** + **TypeScript** + **Vite**
436
+ - [**@blueprintjs/core** v6](https://www.npmjs.com/package/@blueprintjs/core) — visual language, skins, and demo controls
437
+ - [**@tanstack/react-table** v9](https://www.npmjs.com/package/@tanstack/react-table) — headless table core
438
+ - [**@tanstack/react-virtual**](https://www.npmjs.com/package/@tanstack/react-virtual) — row virtualization
439
+ - **Storybook 8** — feature demos and development harness
440
+
441
+ ```
442
+ src/
443
+ ├── components/
444
+ │ ├── BP_Table.tsx # Public component & props
445
+ │ ├── container/ # Scroll container and layout
446
+ │ ├── head/ # Column headers, sort menu, reordering
447
+ │ ├── body/ # Body cells, row headers, virtualization
448
+ │ ├── quadrant/ # Quadrant layout plumbing
449
+ │ ├── layers/ # Resize/reorder guides and overlays
450
+ │ └── common/ # Regions, dimensions, classes, contexts
451
+ ├── hooks/ # Focus/selection, reordering, resizing, virtualization
452
+ └── types.ts # Shared types (TableLoadingOption, BP_VisibilityState, …)
453
+ ```
454
+
455
+ > `BP_Table` lives in `src/components/BP_Table.tsx` and is the single source of
456
+ > truth for the public API documented above; `src/index.ts` re-exports it as
457
+ > the package entry point.
@@ -0,0 +1,6 @@
1
+ "use strict";var It=Object.defineProperty;var Mt=(e,t,n)=>t in e?It(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var re=(e,t,n)=>Mt(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),f=require("react"),Y=require("@tanstack/react-table"),Ot=require("@tanstack/react-virtual"),k=require("@blueprintjs/core"),jt=require("@blueprintjs/icons");var ge=(e=>(e.CELLS="cells",e.COLUMN_HEADERS="column-header",e.ROW_HEADERS="row-header",e))(ge||{});function ve(e,t){return e.indexOf(t)!==-1}const Ne=Y.tableFeatures({columnSizingFeature:Y.columnSizingFeature,columnResizingFeature:Y.columnResizingFeature,columnOrderingFeature:Y.columnOrderingFeature,columnVisibilityFeature:Y.columnVisibilityFeature,columnPinningFeature:Y.columnPinningFeature,rowPinningFeature:Y.rowPinningFeature,rowSelectionFeature:Y.rowSelectionFeature,cellSelectionFeature:Y.cellSelectionFeature,rowSortingFeature:Y.rowSortingFeature,sortedRowModel:Y.createSortedRowModel(),sortFns:Y.sortFns}),Bt=e=>Y.useTable({...e,initialState:e.initialState??{},features:e.features??Ne,columnResizeMode:e.columnResizeMode??"onEnd"});function yt({table:e,numFrozenColumns:t,numFrozenRows:n}){const s=e.getVisibleLeafColumns(),o=e.getRowModel().rows;f.useLayoutEffect(()=>{var c;if(e.setColumnPinning==null)return;const l=s.slice(0,Math.max(0,t)).map(u=>u.id),r=((c=e.state.columnPinning)==null?void 0:c.start)??[];be(r,l)||e.setColumnPinning(u=>({...u,start:l}))},[t,e,s]),f.useLayoutEffect(()=>{var c;if(e.setRowPinning==null)return;const l=o.slice(0,Math.max(0,n)).map(u=>u.id),r=((c=e.state.rowPinning)==null?void 0:c.top)??[];be(r,l)||e.setRowPinning(u=>({...u,top:l}))},[n,o,e])}function be(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}const qe=5;function Dt({table:e,columnHeaderHeight:t,frozenRowCount:n,frozenRowsHeight:s,getRowHeight:o,scrollContainerRef:l,enableRowVirtualization:r,overscanRowCount:c}){const u=Math.max(0,e.getRowModel().rows.length-n),a=Ot.useVirtualizer({count:u,getScrollElement:()=>l.current,estimateSize:m=>o(n+m),overscan:c,scrollMargin:t+s,enabled:r});return f.useLayoutEffect(()=>{a.measure()},[n,o,a]),r?a:void 0}function bt({value:e,initialValue:t,finalValue:n,onChange:s=()=>{}}){const[o,l]=f.useState(t!==void 0?t:n),r=c=>{l(c),s==null||s(c)};return e!==void 0?[e,s,!0]:[o,r,!1]}const Pt=20,$t=30,Ke=30,Ft=30,Pe=150,Ut=50,zt=200;function Ht(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ze={exports:{}};/*!
2
+ Copyright (c) 2018 Jed Watson.
3
+ Licensed under the MIT License (MIT), see
4
+ http://jedwatson.github.io/classnames
5
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var l="",r=0;r<arguments.length;r++){var c=arguments[r];c&&(l=o(l,s(c)))}return l}function s(l){if(typeof l=="string"||typeof l=="number")return l;if(typeof l!="object")return"";if(Array.isArray(l))return n.apply(null,l);if(l.toString!==Object.prototype.toString&&!l.toString.toString().includes("[native code]"))return l.toString();var r="";for(var c in l)t.call(l,c)&&l[c]&&(r=o(r,c));return r}function o(l,r){return r?l?l+" "+r:l+r:l}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Ze);var kt=Ze.exports;const P=Ht(kt),h=k.Classes.getClassNamespace(),Gt=`${h}-table-body-cells`,Wt=`${h}-table-body-virtual-client`,$e=`${h}-table-bottom-container`,Je=`${h}-table-cell`,Vt=`${h}-table-cell-client`,Yt=`${h}-table-cell-ghost`,et=`${h}-table-cell-ledger-even`,tt=`${h}-table-cell-ledger-odd`,Xt=`${h}-table-column-header-tr`,Qt=`${h}-table-column-headers`,Ie=`${h}-table-column-header-cell`,nt=`${h}-table-column-name`,st=`${h}-table-column-name-text`,qt=`${h}-table-container`,Le=`${h}-table-dragging`,lt=`${h}-table-focus-region`,Kt=`${h}-table-has-reorder-handle`,ce=`${h}-table-header`,Zt=`${h}-table-header-active`,ot=`${h}-table-header-content`,Jt=`${h}-table-horizontal-guide`,Me=`${h}-table-last-in-column`,rt=`${h}-table-last-in-row`,en=`${h}-table-menu`,tn=`${h}-table-no-horizontal-scroll`,nn=`${h}-table-no-vertical-scroll`,ct=`${h}-table-no-wrap-text`,xe=`${h}-table-overlay`,Oe=`${h}-table-overlay-layer`,sn=`${h}-table-pagination-bar`,Fe=`${h}-table-pagination-bar-controls`,_e=`${h}-table-pagination-bar-text`,ln=`${h}-table-pagination-layout`,on=`${h}-table-quadrant`,rn=`${h}-table-quadrant-body-container`,cn=`${h}-table-quadrant-left`,un=`${h}-table-quadrant-main`,an=`${h}-table-quadrant-scroll-container`,dn=`${h}-table-quadrant-stack`,fn=`${h}-table-quadrant-top`,mn=`${h}-table-quadrant-top-left`,hn=`${h}-table-region`,En=`${h}-table-reorder-handle`,wn=`${h}-table-reorder-handle-target`,it=`${h}-table-resize-guides`,ut=`${h}-table-resize-handle`,at=`${h}-table-resize-handle-target`,gn=`${h}-table-resize-horizontal`,Ln=`${h}-table-resize-vertical`,Tn=`${h}-table-row-headers`,Ue=`${h}-table-row-headers-cells-container`,dt=`${h}-table-row-name`,ft=`${h}-table-row-name-text`,je=`${h}-table-row-selected`,mt=`${h}-table-row-selection-cell`,ht=`${h}-table-row-selection-checkbox`,Cn=`${h}-table-row-selection-header-cell`,pn=`${h}-table-selection-enabled`,Et=`${h}-table-selection-region`,An=`${h}-table-th-menu`,vn=`${h}-table-th-menu-container`,xn=`${h}-table-th-menu-container-background`,Nn=`${h}-table-th-menu-open`,Sn=`${h}-table-thead`,_n=`${h}-table-top-container`,wt=`${h}-table-truncated-cell`,gt=`${h}-table-truncated-text`,Lt=`${h}-table-vertical-guide`;function Tt(e,t){return typeof t=="number"?`${e}${t}`:t.indexOf(e)===0?t:`${e}${t}`}function Be(e){return Tt(`${h}-table-cell-col-`,e)}function de(e){return Tt(`${h}-table-cell-row-`,e)}var J=(e=>(e.CELLS="cells",e.FULL_ROWS="full-rows",e.FULL_COLUMNS="full-columns",e.FULL_TABLE="full-table",e))(J||{}),ye=(e=>(e.CELL="cell",e))(ye||{}),Ct=(e=>(e.UP="up",e.DOWN="down",e.LEFT="left",e.RIGHT="right",e))(Ct||{});class v{static getRegionCardinality(t){return t.cols!=null&&t.rows!=null?"cells":t.cols!=null?"full-columns":t.rows!=null?"full-rows":"full-table"}static cell(t,n,s,o){return{cols:v.normalizeInterval(n,o),rows:v.normalizeInterval(t,s)}}static row(t,n){return{rows:v.normalizeInterval(t,n)}}static column(t,n){return{cols:v.normalizeInterval(t,n)}}static table(){return{}}static copy(t){const n=v.getRegionCardinality(t);return n==="cells"?v.cell(t.rows[0],t.cols[0],t.rows[1],t.cols[1]):n==="full-columns"?v.column(t.cols[0],t.cols[1]):n==="full-rows"?v.row(t.rows[0],t.rows[1]):v.table()}static update(t,n,s){const o=t.slice();return s!=null?o.splice(s,1,n):(o.pop(),o.push(n)),o}static clampRegion(t,n,s){const o=v.copy(t);return t.rows!=null&&(o.rows[0]=v.clamp(t.rows[0],0,n),o.rows[1]=v.clamp(t.rows[1],0,n)),t.cols!=null&&(o.cols[0]=v.clamp(t.cols[0],0,s),o.cols[1]=v.clamp(t.cols[1],0,s)),o}static expandRegion(t,n){const s=v.getRegionCardinality(t),o=v.getRegionCardinality(n);if(o!==s)return n;switch(o){case"full-rows":return v.row(Math.min(t.rows[0],n.rows[0]),Math.max(t.rows[1],n.rows[1]));case"full-columns":return v.column(Math.min(t.cols[0],n.cols[0]),Math.max(t.cols[1],n.cols[1]));case"cells":return v.cell(Math.min(t.rows[0],n.rows[0]),Math.min(t.cols[0],n.cols[0]),Math.max(t.rows[1],n.rows[1]),Math.max(t.cols[1],n.cols[1]));default:return v.table()}}static getRegionFromFocusedRegion(t){return v.cell(t.row,t.col)}static getCellRegionFromRegion(t,n,s){switch(v.getRegionCardinality(t)){case"full-table":return v.cell(0,0,n-1,s-1);case"full-columns":return v.cell(0,t.cols[0],n-1,t.cols[1]);case"full-rows":return v.cell(t.rows[0],0,t.rows[1],s-1);default:return v.cell(t.rows[0],t.cols[0],t.rows[1],t.cols[1])}}static getFocusCellCoordinatesFromRegion(t){switch(v.getRegionCardinality(t)){case"full-table":return{col:0,row:0};case"full-columns":return{col:t.cols[0],row:0};case"full-rows":return{col:0,row:t.rows[0]};default:return{col:t.cols[0],row:t.rows[0]}}}static regionsEqual(t,n){return v.intervalsEqual(t.rows,n.rows)&&v.intervalsEqual(t.cols,n.cols)}static findContainingRegion(t,n){if(t==null)return-1;for(let s=0;s<t.length;s++)if(v.regionContains(t[s],n))return s;return-1}static containsRegion(t,n){return v.overlapsRegion(t,n,!1)}static overlapsRegion(t,n,s=!1){const o=s?v.intervalOverlaps:v.intervalContains;if(t==null||n==null)return!1;for(const l of t)switch(v.getRegionCardinality(l)){case"full-table":return!0;case"full-columns":if(o(l.cols,n.cols))return!0;continue;case"full-rows":if(o(l.rows,n.rows))return!0;continue;case"cells":if(o(l.cols,n.cols)&&o(l.rows,n.rows))return!0;continue}return!1}static enumerateUniqueCells(t,n,s){if(t==null||t.length===0)return[];const o=new Set,l=[];for(const r of t)v.eachCellInRegion(r,n,s,(c,u)=>{const a=`${c}-${u}`;o.has(a)||(o.add(a),l.push({col:u,row:c}))});return l.sort((r,c)=>r.row-c.row||r.col-c.col),l}static joinStyledRegionGroups(t,n){const s=[];return t!=null&&t.length>0&&s.push({className:Et,regions:t}),n!=null&&s.push({className:lt,regions:[v.getRegionFromFocusedRegion(n)]}),s}static regionContains(t,n){return v.overlapsRegion([t],n,!1)}static intervalContains(t,n){return t==null||n==null?!1:t[0]<=n[0]&&n[1]<=t[1]}static intervalOverlaps(t,n){return t==null||n==null?!1:t[0]<=n[1]&&n[0]<=t[1]}static eachCellInRegion(t,n,s,o){switch(v.getRegionCardinality(t)){case"full-table":for(let l=0;l<n;l++)for(let r=0;r<s;r++)o(l,r);break;case"full-columns":for(let l=0;l<n;l++)for(let r=t.cols[0];r<=t.cols[1];r++)o(l,r);break;case"full-rows":for(let l=t.rows[0];l<=t.rows[1];l++)for(let r=0;r<s;r++)o(l,r);break;case"cells":for(let l=t.rows[0];l<=t.rows[1];l++)for(let r=t.cols[0];r<=t.cols[1];r++)o(l,r);break}}static clamp(t,n,s){return Math.max(n,Math.min(s,t))}static intervalsEqual(t,n){return t==null?n==null:n==null?!1:t[0]===n[0]&&t[1]===n[1]}static normalizeInterval(t,n){return(n==null?[t,t]:[t,n]).sort((o,l)=>o-l)}}function pt(e){switch(e){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 Rn(e,t){switch(t){case"up":return{...e,focusSelectionIndex:0,row:e.row-1};case"down":return{...e,focusSelectionIndex:0,row:e.row+1};case"left":return{...e,col:e.col-1,focusSelectionIndex:0};case"right":return{...e,col:e.col+1,focusSelectionIndex:0}}}function In(e,t,n){if(v.getRegionCardinality(e)==="full-table")return e;const s=v.copy(e);let o=0,l=0;if(n!=null){const c=s.rows!=null&&n.row===s.rows[0],u=s.rows!=null&&n.row===s.rows[1],a=s.cols!=null&&n.col===s.cols[0],m=s.cols!=null&&n.col===s.cols[1];t==="up"?o=c&&!u?1:0:t==="down"?o=u&&!c?0:1:t==="left"?l=a&&!m?1:0:l=m&&!a?0:1}else o=t==="down"?1:0,l=t==="right"?1:0;const r=pt(t);return s.rows!=null&&(s.rows[o]+=r.rows),s.cols!=null&&(s.cols[l]+=r.cols),s}function At(e){return e.getStartVisibleLeafColumns().length}function se(e){return e.getTopRows().length}function ie(e){return e.getStartTotalSize()}function Te(e,t){return t==="start"?e.getStartVisibleLeafColumns():e.getCenterVisibleLeafColumns()}function fe(e,t){return t==="start"?e.getStartTotalSize():e.getCenterTotalSize()}function Mn(e,t,n){return t.getIsPinned()==="start"?t.getStart("start"):ie(e)+t.getStart("center")-n}function Se(e,t){return On(0,se(e),t)}function On(e,t,n){let s=0;for(let o=e;o<t;o++)s+=n(o);return s}function ze(e,t,n){if(n<0)return;let s=0;const o=Te(e,t);let l=o.length-1;for(;s<=l;){const r=s+l>>1,c=o[r],u=c.getStart(t);if(n<u){l=r-1;continue}if(n>=u+c.getSize()){s=r+1;continue}return c.getIndex()}}function He(e,t,n,s,o){const l=se(e),r=e.getRowModel().rows.length,c=t==="top"?0:l,u=t==="top"?l:r;if(n<0||c>=u)return;const a=s(c);let m=c,d=u-1;for(;m<=d;){const E=m+d>>1,T=s(E)-a;if(n<T){d=E-1;continue}if(n>=T+o(E)){m=E+1;continue}return E}}function jn({table:e,scrollContainerRef:t,rowHeaderWidth:n,columnHeaderHeight:s,getRowTop:o,getRowHeight:l},r,c){const u=t.current;if(u==null)return;const a=u.getBoundingClientRect(),m=r-a.left,d=c-a.top,E=ie(e),T=Se(e,l),C=m-n,g=C-E+u.scrollLeft,x=d-s,L=x-T+u.scrollTop,R=C>=0&&C<E?ze(e,"start",C):ze(e,"center",g),p=x>=0&&x<T?He(e,"top",x,o,l):He(e,"center",L,o,l);if(!(R==null||p==null))return{col:R,row:p}}class Bn{constructor({table:t,target:n,selectedRegions:s,numRows:o,numCols:l}){re(this,"target");re(this,"regions");re(this,"selectedRegions");re(this,"numRows");re(this,"numCols");re(this,"targetRow");re(this,"targetCell");var r;this.target=n,this.selectedRegions=s,this.numRows=o,this.numCols=l,this.regions=v.overlapsRegion(s,n)?s:[n],this.targetRow=t.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 v.enumerateUniqueCells(this.regions,this.numRows,this.numCols)}getTargetRow(){return this.targetRow}getTargetCell(){return this.targetCell}}function yn(e){var a,m;const t=e.getVisibleLeafColumns(),n=e.state.columnPinning;if(n==null||(((a=n.start)==null?void 0:a.length)??0)+(((m=n.end)==null?void 0:m.length)??0)===0)return t;const s=new Map(t.map(d=>[d.id,d])),o=(n.start??[]).map(d=>s.get(d)).filter(d=>d!=null),l=(n.end??[]).map(d=>s.get(d)).filter(d=>d!=null),r=new Set(o.map(d=>d.id)),c=new Set(l.map(d=>d.id)),u=t.filter(d=>!r.has(d.id)&&!c.has(d.id));return[...o,...u,...l]}function Dn(e,t,n){if(e.length===0)return null;const s=Math.max(0,Math.min(t,e.length-1)),o=Math.max(0,Math.min(n,e.length-1));let l=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(let c=s;c<=o;c++){const u=e[c];u<l&&(l=u),u>r&&(r=u)}return[l,r]}function bn(e,t,n){if(e.length===0)return null;let s=0,o=e.length-1,l=-1;for(;s<=o;){const c=s+o>>1;e[c].getDisplayIndex()>=t?(l=c,o=c-1):s=c+1}if(l<0||e[l].getDisplayIndex()>n)return null;s=l,o=e.length-1;let r=l;for(;s<=o;){const c=s+o>>1;e[c].getDisplayIndex()<=n?(r=c,s=c+1):o=c-1}return[l,r]}function Pn(e,t,n,s){const o=e[0]===0&&e[1]===n-1,l=t[0]===0&&t[1]===s-1;return o&&l?v.table():l?v.row(e[0],e[1]):o?v.column(t[0],t[1]):v.cell(e[0],t[0],e[1],t[1])}function ke(e){const t=e.getCellSelectionBounds();if(t.length===0)return[];const n=e.getRowModel().rows,o=yn(e).map(r=>r.getIndex()),l=[];for(const r of t){const c=bn(n,r.minRowIndex,r.maxRowIndex),u=Dn(o,r.minColumnIndex,r.maxColumnIndex);c==null||u==null||l.push(Pn(c,u,n.length,o.length))}return l}function $n(e,t){if(t==null||t.length===0)return[];const n=e.getRowModel().rows,s=e.getVisibleLeafColumns();if(n.length===0||s.length===0)return[];const o=[];for(const l of t){let r,c;switch(v.getRegionCardinality(l)){case J.FULL_TABLE:r=[0,n.length-1],c=[0,s.length-1];break;case J.FULL_COLUMNS:r=[0,n.length-1],c=l.cols;break;case J.FULL_ROWS:r=l.rows,c=[0,s.length-1];break;default:r=l.rows,c=l.cols;break}r[0]<0||r[1]>=n.length||c[0]<0||c[1]>=s.length||o.push({anchorRowId:n[r[0]].id,anchorColumnId:s[c[0]].id,focusRowId:n[r[1]].id,focusColumnId:s[c[1]].id})}return o}function Ge(e){const t=e.getFocusedCell();if(t==null)return;const n=e.getRowModel().rows.indexOf(t.row);if(!(n<0))return{row:n,col:t.column.getIndex()}}function Fn(e,t){const n=e.getRowModel().rows[t.row],s=e.getVisibleLeafColumns()[t.col];if(!(n==null||s==null))return n.getAllCellsByColumnId()[s.id]}function We(e){return JSON.stringify(e.map(t=>({rows:t.rows??null,cols:t.cols??null})))}function Un({table:e,getRowTop:t,getRowHeight:n,scrollContainerRef:s,rowHeaderWidth:o,columnHeaderHeight:l,bodyContextMenuRenderer:r,enableBodyContextMenu:c,enableFocusedCell:u=!1,onFocusedCell:a,onFocusedRegion:m,selectedRegions:d,onSelection:E,selectionModes:T}){const C=d!=null,g=c??r!=null,x=f.useRef(!1),L=f.useRef(void 0),R=f.useCallback(w=>T==null?!0:T.includes(w),[T]),p=e.state.cellSelection,y=e.state.columnPinning,B=e.getRowModel().rows,U=e.getVisibleLeafColumns(),M=f.useMemo(()=>ke(e),[p,y,B,e,U]),A=f.useMemo(()=>u?Ge(e):void 0,[p,u,B,e]),$=f.useMemo(()=>{const w=[];return M.length>0&&w.push({className:Et,regions:M}),A!=null&&w.push({className:lt,regions:[v.cell(A.row,A.col)]}),w},[A,M]);f.useEffect(()=>{if(!C)return;const w=We(d??[]);L.current!==w&&(L.current=w,e.setCellSelection($n(e,d)))},[d,C,e]);const F=f.useRef(null),N=f.useRef(!1);f.useEffect(()=>{const w=We(M);if(F.current!==w){if(F.current=w,!N.current){N.current=!0;return}C&&L.current===w||E==null||E(M)}},[C,E,M]);const I=f.useRef(null);f.useEffect(()=>{if(!u)return;const w=A!=null?`${A.row}-${A.col}`:null;I.current!==w&&(I.current=w,A!=null&&(a==null||a(A),m==null||m({type:ye.CELL,row:A.row,col:A.col,focusSelectionIndex:0})))},[u,A,a,m]);const O=f.useCallback(()=>{var w;u&&((w=s.current)==null||w.focus())},[u,s]),_=f.useCallback(()=>{const w=Ge(e);if(w==null)return;const j=s.current;if(j==null)return;const b=e.getVisibleLeafColumns()[w.col];if(b==null)return;const K=At(e),Z=ie(e),te=se(e),H=Se(e,n),G=b.getStart(),ne=G+b.getSize(),oe=t(w.row),pe=oe+n(w.row),he=j.clientWidth-o-Z,De=j.clientHeight-l-H;let ue=j.scrollLeft,ae=j.scrollTop;if(w.col>=K){const Ee=G-Z,we=ne-Z;Ee<ue?ue=Math.max(0,Ee):we>ue+he&&(ue=we-he)}if(w.row>=te){const Ee=oe-H,we=pe-H;Ee<ae?ae=Math.max(0,Ee):we>ae+De&&(ae=we-De)}ue!==j.scrollLeft&&(j.scrollLeft=ue),ae!==j.scrollTop&&(j.scrollTop=ae)},[l,n,t,o,s,e]);f.useEffect(()=>{x.current&&(x.current=!1,_())},[p,_,e]);const S=f.useCallback(w=>{const j=w.metaKey||w.ctrlKey,D=w.key;let b;if(D==="ArrowUp"?b="up":D==="ArrowDown"?b="down":D==="ArrowLeft"?b="left":D==="ArrowRight"&&(b="right"),b!=null){w.preventDefault(),w.stopPropagation(),w.shiftKey?e.extendCellSelection(b):u&&(x.current=!0,e.moveCellSelection(b));return}if(D==="Tab"&&u){w.preventDefault(),w.stopPropagation(),x.current=!0,e.moveCellSelection(w.shiftKey?"left":"right");return}if(D==="Escape"){w.preventDefault(),w.stopPropagation(),e.resetCellSelection(!0);return}j&&D.toLowerCase()==="a"&&(w.preventDefault(),w.stopPropagation(),e.selectAllCells())},[u,e]),z=f.useCallback((w,j)=>jn({table:e,scrollContainerRef:s,rowHeaderWidth:o,columnHeaderHeight:l,getRowTop:t,getRowHeight:n},w,j),[l,n,t,o,s,e]),V=f.useCallback(w=>{w.button===0&&O()},[O]),X=f.useCallback(w=>{if(!g)return;const j=z(w.clientX,w.clientY);if(j==null)return;const D=Fn(e,j);D!=null&&(D.getIsSelected()||R(J.CELLS)&&e.setCellSelection([{anchorRowId:D.row.id,anchorColumnId:D.column.id,focusRowId:D.row.id,focusColumnId:D.column.id}]))},[z,g,R,e]),Q=f.useCallback(w=>{if(!g||r==null)return;const j=z(w.clientX,w.clientY);if(j==null)return;const D=new Bn({table:e,target:v.cell(j.row,j.col),selectedRegions:ke(e),numRows:e.getRowModel().rows.length,numCols:e.getVisibleLeafColumns().length});return r(D)??void 0},[r,z,g,e]),q=f.useCallback((w,j)=>{if(!R(J.FULL_COLUMNS)){e.resetCellSelection(!0),O();return}j.preventDefault(),j.stopPropagation();const D=e.getRowModel().rows,b=e.getVisibleLeafColumns()[w];b==null||D.length===0||(j.shiftKey?e.setCellSelection(K=>{const Z=K[K.length-1];return Z==null?[{anchorRowId:D[0].id,anchorColumnId:b.id,focusRowId:D[D.length-1].id,focusColumnId:b.id}]:[...K.slice(0,-1),{...Z,focusColumnId:b.id}]}):e.setCellSelection([{anchorRowId:D[0].id,anchorColumnId:b.id,focusRowId:D[D.length-1].id,focusColumnId:b.id}]),O())},[O,R,e]),ee=f.useCallback((w,j)=>{if(!R(J.FULL_ROWS)){e.resetCellSelection(!0),O();return}j.preventDefault(),j.stopPropagation();const D=e.getRowModel().rows,b=e.getVisibleLeafColumns(),K=D[w];K==null||b.length===0||(j.shiftKey?e.setCellSelection(Z=>{const te=Z[Z.length-1];return te==null?[{anchorRowId:K.id,anchorColumnId:b[0].id,focusRowId:K.id,focusColumnId:b[b.length-1].id}]:[...Z.slice(0,-1),{...te,focusRowId:K.id}]}):e.setCellSelection([{anchorRowId:K.id,anchorColumnId:b[0].id,focusRowId:K.id,focusColumnId:b[b.length-1].id}]),O())},[O,R,e]),le=f.useCallback(w=>{if(!R(J.FULL_TABLE)){e.resetCellSelection(!0),O();return}w.preventDefault(),w.stopPropagation(),e.selectAllCells(),O()},[O,R,e]);return{regionGroups:$,handleBodyContextMenu:X,handleBodyPointerDown:V,handleColumnHeaderMouseDown:q,handleKeyDown:S,handleMenuMouseDown:le,handleRowHeaderMouseDown:ee,isBodyContextMenuEnabled:g,isSelectionModeEnabled:R,renderBodyContextMenu:Q}}function zn({minHeight:e,headerRowCount:t}){const n=f.useRef(null),[s,o]=f.useState(null);f.useLayoutEffect(()=>{const r=n.current;if(r==null)return;const c=()=>{const a=r.getBoundingClientRect().height;a>0&&o(m=>m===a?m:a)};c();const u=new ResizeObserver(c);return u.observe(r),()=>u.disconnect()},[]);const l=Math.max(0,t)*Ke;return{ref:n,height:Math.max(e,l,s??0)}}function Hn({enableGhostCells:e,rowHeight:t,rowHeaderWidth:n,columnHeaderHeight:s,totalWidth:o,totalHeight:l,scrollContainerRef:r}){const[c,u]=f.useState(null);if(f.useLayoutEffect(()=>{const T=r.current;if(T==null)return;const C=()=>{u({width:T.clientWidth,height:T.clientHeight})};C();const g=new ResizeObserver(C);return g.observe(T),()=>g.disconnect()},[r]),!e||c==null)return;const a=c.width-n-o,m=c.height-s-l,d=a>0?Math.min(Math.ceil(a/Pe),Ut):0,E=m>0?Math.min(Math.ceil(m/t),zt):0;if(!(d===0&&E===0))return{columnCount:d,rowCount:E,columnWidth:Pe,rowHeight:t}}function vt(e,t){return t==null?e:e+t.columnCount*t.columnWidth}const kn=6,Gn=100;function Wn({rowHeight:e,rowCount:t,rowHeights:n,defaultRowHeights:s,enableRowResizing:o=!1,minRowHeight:l=kn,maxRowHeight:r=Gn,onRowHeightChanged:c}){const u=n!=null,[a,m]=f.useState(s??[]),[d,E]=f.useState(null),[T,C]=f.useState(null),g=f.useRef(null),x=f.useCallback(_=>u?n[_]??e:a[_]??(s==null?void 0:s[_])??e,[s,a,u,e,n]),{rowTops:L,totalHeight:R}=f.useMemo(()=>{const _=new Array(t);let S=0;for(let z=0;z<t;z++)_[z]=S,S+=x(z);return{rowTops:_,totalHeight:S}},[x,t]),p=f.useCallback(_=>L[_]??0,[L]),y=f.useRef(x);y.current=x;const B=f.useRef(L);B.current=L;const U=f.useRef(o);U.current=o;const M=f.useRef(u);M.current=u;const A=f.useRef(l);A.current=l;const $=f.useRef(r);$.current=r;const F=f.useRef(c);F.current=c;const N=f.useCallback(_=>{var X,Q;const S=g.current;if(S==null)return;const z="touches"in _?(X=_.touches[0])==null?void 0:X.clientY:_.clientY;if(z==null)return;const V=Math.min(S.max,Math.max(S.min,S.startHeight+(z-S.startY)));M.current||m(q=>{const ee=q.slice();return ee[S.index]=V,ee}),(Q=F.current)==null||Q.call(F,S.index,V),C(S.rowTop+V)},[]),I=f.useCallback(()=>{g.current=null,E(null),C(null),window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",I),window.removeEventListener("touchmove",N),window.removeEventListener("touchend",I),window.removeEventListener("touchcancel",I)},[N]),O=f.useCallback((_,S)=>{var Q;if(!U.current)return;S.preventDefault(),S.stopPropagation();const z="touches"in S?(Q=S.touches[0])==null?void 0:Q.clientY:S.clientY;if(z==null)return;const V=B.current[_]??0,X=y.current(_);g.current={index:_,startY:z,startHeight:X,rowTop:V,min:A.current,max:$.current},E(_),C(V+X),window.addEventListener("mousemove",N),window.addEventListener("mouseup",I),window.addEventListener("touchmove",N),window.addEventListener("touchend",I),window.addEventListener("touchcancel",I)},[N,I]);return f.useEffect(()=>()=>{window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",I),window.removeEventListener("touchmove",N),window.removeEventListener("touchend",I),window.removeEventListener("touchcancel",I)},[N,I]),{enabled:o,getRowHeight:x,getRowTop:p,totalHeight:R,resizingRowIndex:d,resizingGuideTop:T,startRowResize:O}}const xt=f.createContext(null);function Ce(){return f.useContext(xt)}const Nt=f.createContext(null);function Vn(){return f.useContext(Nt)}function Yn(e,t){return t<e?t:e<=t&&t<e+1?e:Math.max(0,t-1)}function Xn(e,t,n,s,o){const[l,r]=f.useState(null),[c,u]=f.useState(null),a=f.useRef(null),m=f.useCallback(x=>{var U,M;const L=((U=n.current)==null?void 0:U.getBoundingClientRect().left)??0,R=((M=s.current)==null?void 0:M.scrollLeft)??0,p=ie(e),y=x-L-o;if(y<p){let A=0;for(const $ of Te(e,"start"))if($.getStart("start")+$.getSize()/2<y)A++;else break;return A}let B=At(e);for(const A of Te(e,"center"))if(p+A.getStart("center")-R+A.getSize()/2<y)B++;else break;return B},[n,o,s,e]),d=f.useCallback(x=>{var U;const L=a.current;if(a.current=null,r(null),u(null),L==null)return;const R=e.getVisibleLeafColumns(),p=(U=R[L.oldIndex])==null?void 0:U.id;if(p==null)return;const y=Yn(L.oldIndex,m(x)),B=R.map(M=>M.id).filter(M=>M!==p);B.splice(y,0,p),e.setColumnOrder(B)},[m,e]),E=f.useCallback(x=>{a.current!=null&&u(m(x.clientX))},[m]),T=f.useCallback(x=>{d(x.clientX)},[d]),C=f.useCallback((x,L)=>{t&&(L.preventDefault(),a.current={oldIndex:x.getIndex()},r(x.id),u(m(L.clientX)),window.addEventListener("pointermove",E),window.addEventListener("pointerup",T),window.addEventListener("pointercancel",T))},[t,m,E,T]);return f.useEffect(()=>()=>{window.removeEventListener("pointermove",E),window.removeEventListener("pointerup",T),window.removeEventListener("pointercancel",T)},[E,T]),{contextValue:f.useMemo(()=>({enableColumnReordering:t,reorderingColumnId:l,startReorder:C}),[t,l,C]),guideIndex:c,reorderingColumnId:l}}function Qn({table:e,reorderingColumnId:t,guideIndex:n,rowHeaderWidth:s,scrollLeft:o}){if(t==null||n==null)return null;const l=e.getVisibleLeafColumns(),r=e.getStartVisibleLeafColumns().length,c=l[n],u=ie(e);let a;return n<=r?a=n<r&&c!=null?c.getStart("start"):u:c!=null?a=u+c.getStart("center")-o:a=u+fe(e,"center")-o,i.jsx("div",{className:P(it,Oe),children:i.jsx("div",{className:P(xe,Lt),style:{left:s+a}})})}function qn({table:e,rowHeaderWidth:t,columnHeaderHeight:n,scrollLeft:s,scrollTop:o,frozenRowCount:l,resizingGuideTop:r=null,resizingRowIndex:c=null}){const u=e.state.columnResizing,a=u==null?void 0:u.isResizingColumn,m=a!=null&&a!==!1?e.getColumn(a):void 0,d=m!=null?t+Mn(e,m,s)+m.getSize()+((u==null?void 0:u.deltaOffset)??0):null,E=r!=null&&c!=null?n+r-(c<l?0:o):null;return d==null&&E==null?null:i.jsxs("div",{className:P(it,Oe),children:[d!=null&&i.jsx("div",{className:P(xe,Lt),style:{left:d}}),E!=null&&i.jsx("div",{className:P(xe,Jt),style:{top:E}})]})}function me({loading:e,variableLength:t=!1,children:n}){if(e){const s=t?75-Math.floor(Math.random()*11)*5:100;return i.jsx("div",{className:k.Classes.SKELETON,style:{width:`${s}%`}})}return i.jsx(i.Fragment,{children:n})}function Kn({table:e,cell:t,rowIndex:n,rowTop:s,columnRegion:o,rowHeight:l,loading:r,isLastInRow:c,isLastInColumn:u}){var E;const a=t.column.getSize(),m=t.column.getStart(o),d=(E=t.column.columnDef.meta)==null?void 0:E.bodyCellClassName;return i.jsx("div",{className:P(Je,wt,de(n),Be(t.column.getIndex()),n%2===0?et:tt,{[rt]:c,[Me]:u,[k.Classes.LOADING]:r,[je]:t.row.getIsSelected()},d),style:{height:l,left:m,position:"absolute",top:s,width:a},onMouseDown:T=>{T.button===0&&t.getSelectionStartHandler()(T)},onMouseEnter:t.getSelectionExtendHandler(),children:i.jsx("div",{className:P(gt,ct),children:i.jsx(me,{loading:r,variableLength:!0,children:i.jsx(e.FlexRender,{cell:t})})})})}function Re({columnIndex:e,rowIndex:t,left:n,top:s,width:o,height:l,loading:r}){return i.jsx("div",{className:P(Je,Yt,wt,de(t),Be(e),t%2===0?et:tt,{[k.Classes.LOADING]:r}),style:{height:l,left:n,position:"absolute",top:s,width:o},children:i.jsx("div",{className:P(gt,ct),children:i.jsx(me,{loading:r,variableLength:!0})})})}function Zn({table:e,ghosts:t,loading:n,columnRegion:s,rowRegion:o,rowIndices:l,regionTop:r,regionHeight:c,getRowTop:u,getRowHeight:a}){const m=e.getRowModel().rows,d=e.getVisibleLeafColumns().length,E=fe(e,s),T=Te(e,s),C=s==="center",g=o==="center";return i.jsxs(i.Fragment,{children:[C&&l.map(x=>{var L;return i.jsx(f.Fragment,{children:Array.from({length:t.columnCount}).map((R,p)=>i.jsx(Re,{columnIndex:d+p,rowIndex:x,left:E+p*t.columnWidth,top:u(x)-r,width:t.columnWidth,height:a(x),loading:n},`ghost-column-cell-${x}-${p}`))},`ghost-column-cells-${((L=m[x])==null?void 0:L.id)??x}`)}),g&&Array.from({length:t.rowCount}).map((x,L)=>{const R=m.length+L,p=c+L*t.rowHeight;return i.jsxs(f.Fragment,{children:[T.map(y=>i.jsx(Re,{columnIndex:y.getIndex(),rowIndex:R,left:y.getStart(s),top:p,width:y.getSize(),height:t.rowHeight,loading:n},`ghost-row-cell-${L}-${y.id}`)),C&&Array.from({length:t.columnCount}).map((y,B)=>i.jsx(Re,{columnIndex:d+B,rowIndex:R,left:E+B*t.columnWidth,top:p,width:t.columnWidth,height:t.rowHeight,loading:n},`ghost-corner-cell-${L}-${B}`))]},`ghost-row-cells-${L}`)})]})}function Ve(e,t,n){let s=null,o=0;for(const l of Te(e,t)){const r=l.getIndex();r<n[0]||r>n[1]||(s==null&&(s=l.getStart(t)),o+=l.getSize())}return s==null?null:{offset:s,size:o}}function Ye(e,t,n,s,o){const l=se(e),r=e.getRowModel().rows.length,c=Math.max(n[0],t==="top"?0:l),u=Math.min(n[1],t==="top"?l-1:r-1);if(c>u)return null;const a=t==="center"?Jn(e,t,s):0;return{offset:s(c)-a,size:s(u)+o(u)-s(c)}}function Jn(e,t,n){return t==="center"?n(se(e)):0}function es(e,t,n,s,o,l){const r=v.getRegionCardinality(t),c={offset:0,size:fe(e,n)},u=se(e),a=e.getRowModel().rows.length,m={offset:0,size:(s==="top"?u:a-u)===0?0:o(s==="top"?u-1:a-1)+l(s==="top"?u-1:a-1)-o(s==="top"?0:u)};let d,E;switch(r){case J.CELLS:d=Ve(e,n,t.cols),E=Ye(e,s,t.rows,o,l);break;case J.FULL_COLUMNS:d=Ve(e,n,t.cols),E=m;break;case J.FULL_ROWS:d=c,E=Ye(e,s,t.rows,o,l);break;default:d=c,E=m;break}return d==null||E==null||d.size<=0||E.size<=0?null:{height:E.size,left:d.offset,top:E.offset,width:d.size}}function ts({table:e,regionGroups:t,columnRegion:n,rowRegion:s,getRowTop:o,getRowHeight:l}){return i.jsx("div",{className:Oe,"aria-hidden":!0,children:t.map((r,c)=>r.regions.map((u,a)=>{const m=es(e,u,n,s,o,l);return m==null?null:i.jsx("div",{className:P(xe,hn,r.className),style:m},`${c}-${a}`)}))})}function ns({table:e,columnRegion:t,rowRegion:n,offsetTop:s=0,offsetLeft:o=0,areCellsLoading:l,rowVirtualizer:r,rowResizing:c,ghosts:u,className:a,...m}){const d=Ce(),E=d!=null&&d.isBodyContextMenuEnabled,T=e.getRowModel().rows,C=se(e),g=n==="top",x=g?C:T.length-C,L=g?0:c.getRowTop(C),R=g?c.getRowTop(C):c.totalHeight-c.getRowTop(C),p=fe(e,t),B=!g&&r!=null?r.getVirtualItems():void 0,U=B!=null?B.map(A=>C+A.index):Array.from({length:x},(A,$)=>g?$:C+$),M=g?C-1:T.length-1;return i.jsx("div",{...m,className:P(rn,a),style:{paddingLeft:o,paddingTop:s},children:i.jsx("div",{children:i.jsxs(k.ContextMenu,{className:P(Wt,Vt),style:{height:R,width:p},onPointerDown:d==null?void 0:d.handleBodyPointerDown,disabled:!E,onContextMenu:E?d==null?void 0:d.handleBodyContextMenu:void 0,content:({mouseEvent:A})=>A==null||d==null?void 0:d.renderBodyContextMenu(A),children:[i.jsxs("div",{className:Gt,children:[U.map(A=>{const $=T[A];if($==null)return null;const F=t==="start"?$.getStartVisibleCells():$.getCenterVisibleCells(),N=c.getRowTop(A)-L,I=c.getRowHeight(A);return F.map((O,_)=>i.jsx(Kn,{table:e,cell:O,rowIndex:A,rowTop:N,columnRegion:t,rowHeight:I,loading:l,isLastInRow:_===F.length-1,isLastInColumn:A===M},O.id))}),u!=null&&i.jsx(Zn,{table:e,ghosts:u,loading:l,columnRegion:t,rowRegion:n,rowIndices:U,regionTop:L,regionHeight:R,getRowTop:c.getRowTop,getRowHeight:c.getRowHeight})]}),d!=null&&d.regionGroups.length>0&&i.jsx(ts,{table:e,regionGroups:d.regionGroups,columnRegion:t,rowRegion:n,getRowTop:c.getRowTop,getRowHeight:c.getRowHeight})]})})})}function ss({row:e,rowIndex:t,rowHeight:n,loading:s,isLastInColumn:o,isResizing:l=!1,onResizeStart:r,className:c,...u}){const a=Ce();return i.jsxs("div",{...u,className:P(ce,de(t),{[Me]:o,[k.Classes.LOADING]:s,[je]:(e==null?void 0:e.getIsSelected())??!1},c),style:{flexBasis:n,height:n,minHeight:0},onMouseDown:m=>a==null?void 0:a.handleRowHeaderMouseDown(t,m),children:[i.jsx("div",{className:dt,children:i.jsx("div",{className:ft,children:i.jsx(me,{loading:s,children:i.jsx("span",{children:t+1})})})}),!s&&r!=null&&i.jsx("div",{className:P(at,gn,{[Le]:l}),onMouseDown:r,onTouchStart:r,children:i.jsx("div",{className:P(ut,{[Le]:l})})})]})}function ls({row:e,rowIndex:t,rowHeight:n,loading:s,isLastInColumn:o}){const l=(e==null?void 0:e.getIsSelected())??!1;return i.jsx("div",{className:P(ce,mt,de(t),{[Me]:o,[k.Classes.LOADING]:s,[je]:l}),style:{height:n},children:!s&&e!=null&&i.jsx("div",{className:ht,children:i.jsx(k.Checkbox,{"aria-label":`Select row ${t+1}`,checked:l,disabled:!e.getCanSelect(),onChange:r=>e.getToggleSelectedHandler()(r)})})})}function Xe({table:e,rowRegion:t,rowHeaderWidth:n,enableRowHeader:s=!0,selectionColumnWidth:o=0,areRowHeadersLoading:l,rowVirtualizer:r,rowResizing:c,ghosts:u,className:a,...m}){if(!s&&o===0)return null;const d=e.getRowModel().rows,E=s?n:0,T=se(e),C=t==="top",g=C?0:T,x=C?T:d.length-T,L=C?c.getRowTop(T):c.totalHeight-c.getRowTop(T),p=!C&&r!=null?r.getVirtualItems():void 0,y=(r==null?void 0:r.options.scrollMargin)??0,B=p!=null&&p.length>0?p[0].start-y:0,U=p!=null&&p.length>0?L-(p[p.length-1].end-y):0,M=p!=null?p.map(N=>T+N.index):Array.from({length:x},(N,I)=>g+I),A=C?T-1:d.length-1,$={height:L,transform:"translateY(0px)",paddingTop:B,paddingBottom:U},F=u!=null&&!C?Array.from({length:u.rowCount},(N,I)=>d.length+I):[];return i.jsx("div",{...m,className:P(Tn,a),style:{width:E+o},children:i.jsxs("div",{style:{display:"flex",height:L},children:[s&&i.jsx("div",{style:{flex:"0 0 auto",width:n},children:i.jsxs("div",{className:Ue,style:$,children:[M.map(N=>{var I;return i.jsx(ss,{row:d[N],rowIndex:N,rowHeight:c.getRowHeight(N),loading:l,isLastInColumn:N===A,isResizing:c.resizingRowIndex===N,onResizeStart:c.enabled?O=>c.startRowResize(N,O):void 0},((I=d[N])==null?void 0:I.id)??N)}),F.map((N,I)=>i.jsx("div",{className:P(ce,de(N),{[k.Classes.LOADING]:l}),style:{flexBasis:u==null?void 0:u.rowHeight,height:u==null?void 0:u.rowHeight,minHeight:0},children:i.jsx("div",{className:dt,children:i.jsx("div",{className:ft,children:i.jsx(me,{loading:l})})})},`ghost-row-header-${I}`))]})}),o>0&&i.jsx("div",{style:{flex:"0 0 auto",width:o},children:i.jsxs("div",{className:Ue,style:$,children:[M.map(N=>{var I;return i.jsx(ls,{row:d[N],rowIndex:N,rowHeight:c.getRowHeight(N),loading:l,isLastInColumn:N===A},((I=d[N])==null?void 0:I.id)??N)}),F.map((N,I)=>i.jsx("div",{className:P(ce,mt,de(N),{[k.Classes.LOADING]:l}),style:{height:u==null?void 0:u.rowHeight}},`ghost-row-selection-${I}`))]})})]})})}function os({header:e,isOpen:t,onOpenChange:n}){const s=e.column.getIsSorted(),o=r=>{e.column.toggleSorting(r),n(!1)},l=()=>{e.column.clearSorting(),n(!1)};return i.jsxs("div",{className:P(vn,{[Nn]:t}),children:[i.jsx("div",{className:xn}),i.jsx(k.PopoverNext,{className:An,content:i.jsxs(k.Menu,{children:[i.jsx(k.MenuItem,{icon:"sort-asc",text:"Sort Asc",onClick:()=>o(!1)}),i.jsx(k.MenuItem,{icon:"sort-desc",text:"Sort Desc",onClick:()=>o(!0)}),s&&i.jsx(k.MenuItem,{icon:"sort",text:"Clear Sort",onClick:l})]}),isOpen:t,onInteraction:n,placement:"bottom",rootBoundary:"viewport",children:i.jsx(k.Icon,{icon:"chevron-down"})})]})}function rs({table:e,header:t,isLastInRow:n,enableSorting:s=!1,loading:o}){var R;const l=t.getSize(),r=t.column.getIsResizing(),c=t.getResizeHandler(),u=typeof t.column.columnDef.header=="string"?t.column.columnDef.header:void 0,a=Vn(),m=Ce(),d=(a==null?void 0:a.enableColumnReordering)??!1,E=(a==null?void 0:a.reorderingColumnId)===t.column.id,T=s&&t.column.getCanSort(),C=(R=t.column.columnDef.meta)==null?void 0:R.headCellClassName,[g,x]=f.useState(!1),L=t.column.getIndex();return i.jsxs("div",{className:P(ce,Be(L),Ie,{[rt]:n},{[Kt]:d},{[Zt]:g},{[k.Classes.LOADING]:o},C),style:{flexBasis:l,minWidth:0,width:l},onMouseDown:p=>m==null?void 0:m.handleColumnHeaderMouseDown(L,p),children:[i.jsxs("div",{className:nt,title:u,children:[d&&i.jsx("div",{className:P(wn,{[Le]:E}),onPointerDown:p=>a==null?void 0:a.startReorder(t.column,p),children:i.jsx("div",{className:En,children:i.jsx(jt.DragHandleVerticalIcon,{title:"Press down to drag"})})}),T&&!o&&i.jsx(os,{table:e,header:t,isOpen:g,onOpenChange:x}),i.jsx("div",{className:st,children:i.jsx(me,{loading:o,variableLength:!0,children:i.jsx(e.FlexRender,{header:t})})})]}),i.jsx("div",{className:ot}),!o&&i.jsx("div",{className:P(at,Ln,{[Le]:r}),onMouseDown:c,onTouchStart:c,children:i.jsx("div",{className:P(ut,{[Le]:r})})})]})}function cs({table:e,headerGroup:t,columnRegion:n,enableSorting:s=!1,areColumnHeadersLoading:o,ghosts:l}){var u;const r=(u=t.headers[t.headers.length-1])==null?void 0:u.id,c=vt(fe(e,n),l);return i.jsxs("div",{className:P(Sn,Xt),style:{transform:"translateX(0px)",width:c},children:[t.headers.map(a=>i.jsx(rs,{table:e,header:a,isLastInRow:a.id===r,enableSorting:s,loading:o},a.id)),l!=null&&Array.from({length:l.columnCount}).map((a,m)=>i.jsxs("div",{className:P(ce,Ie,{[k.Classes.LOADING]:o}),style:{flexBasis:l.columnWidth,minWidth:0,width:l.columnWidth},children:[i.jsx("div",{className:nt,children:i.jsx("div",{className:st,children:i.jsx(me,{loading:o,variableLength:!0})})}),i.jsx("div",{className:ot})]},`ghost-column-header-${m}`))]})}function is({table:e,columnRegion:t,enableSorting:n=!1,areColumnHeadersLoading:s,ghosts:o,className:l,...r}){const c=t==="start"?e.getStartHeaderGroups():e.getCenterHeaderGroups(),u=t==="center"?o:void 0,a=vt(fe(e,t),u);return i.jsx("div",{...r,className:P(Qt,l),children:i.jsx("div",{style:{width:a},children:c.map(m=>i.jsx(cs,{table:e,headerGroup:m,columnRegion:t,enableSorting:n,areColumnHeadersLoading:s,ghosts:u},m.id))})})}function us({width:e,height:t,className:n,...s}){const o=Ce();return i.jsx("div",{...s,className:P(en,n),style:{width:e,height:t},onMouseDown:o==null?void 0:o.handleMenuMouseDown})}function as({table:e,width:t,height:n,loading:s=!1}){const o=e.getIsAllRowsSelected(),l=e.getIsSomeRowsSelected();return i.jsx("div",{className:P(ce,Ie,Cn),style:{flex:"0 0 auto",height:n,width:t},children:!s&&i.jsx("div",{className:ht,children:i.jsx(k.Checkbox,{"aria-label":"Select all rows",checked:o,indeterminate:!o&&l,onChange:r=>e.getToggleAllRowsSelectedHandler()(r)})})})}var W=(e=>(e.MAIN="main",e.TOP="top",e.LEFT="left",e.TOP_LEFT="top-left",e))(W||{});function ds(e){switch(e){case W.MAIN:return un;case W.TOP:return fn;case W.LEFT:return cn;case W.TOP_LEFT:return mn;default:return}}function Ae({quadrantType:e,table:t,rowHeaderWidth:n,enableRowHeader:s=!0,columnHeaderHeight:o,columnHeaderMeasureRef:l,enableSorting:r=!1,areCellsLoading:c,areColumnHeadersLoading:u,areRowHeadersLoading:a,rowResizing:m,rowVirtualizer:d,ghosts:E,scrollContainerRef:T,onScroll:C,onWheel:g,style:x,selectionColumnWidth:L=0}){const R=e===W.MAIN,p=e===W.TOP||e===W.TOP_LEFT,B=e===W.LEFT||e===W.TOP_LEFT?"start":"center",U=p?"top":"center",M=e===W.TOP||e===W.TOP_LEFT,A=e===W.TOP_LEFT,$=Ce(),F=ie(t),N=Se(t,m.getRowHeight),I=s?n:0,O=(z,V)=>i.jsx(ns,{table:t,columnRegion:B,rowRegion:U,offsetTop:z,offsetLeft:V,areCellsLoading:c,rowVirtualizer:d,rowResizing:m,ghosts:E}),_=M?i.jsxs("div",{ref:e===W.TOP?l:void 0,className:_n,style:B==="center"?{paddingLeft:F}:void 0,children:[A&&i.jsxs(i.Fragment,{children:[s&&i.jsx(us,{width:n,height:o}),L>0&&i.jsx(as,{table:t,width:L,height:o,loading:a})]}),i.jsx(is,{table:t,columnRegion:B,enableSorting:r,areColumnHeadersLoading:u,ghosts:E})]}):void 0;let S;switch(e){case W.MAIN:S=O(o+N,I+L+F);break;case W.TOP:S=i.jsxs(i.Fragment,{children:[_,O(0,F)]});break;case W.LEFT:S=i.jsx("div",{style:{paddingTop:N},children:i.jsxs("div",{className:$e,style:{width:I+L+F},children:[i.jsx(Xe,{table:t,rowRegion:"center",rowHeaderWidth:n,enableRowHeader:s,selectionColumnWidth:L,areRowHeadersLoading:a,rowVirtualizer:d,rowResizing:m,ghosts:E}),O(0,0)]})});break;case W.TOP_LEFT:S=i.jsxs(i.Fragment,{children:[_,i.jsxs("div",{className:$e,style:{width:I+L+F},children:[i.jsx(Xe,{table:t,rowRegion:"top",rowHeaderWidth:n,enableRowHeader:s,selectionColumnWidth:L,areRowHeadersLoading:a,rowVirtualizer:d,rowResizing:m,ghosts:E}),O(0,0)]})]});break;default:S=void 0}return i.jsx("div",{className:P(on,ds(e)),style:x,children:i.jsx("div",{ref:T,className:an,tabIndex:R&&$!=null?0:void 0,onKeyDown:R?$==null?void 0:$.handleKeyDown:void 0,onScroll:C,onWheel:g,children:S})})}function fs({table:e,rowHeaderWidth:t,enableRowHeader:n=!0,columnHeaderHeight:s,columnHeaderMeasureRef:o,enableColumnReordering:l=!1,enableSorting:r=!1,areCellsLoading:c,areColumnHeadersLoading:u,areRowHeadersLoading:a,selection:m,rowResizing:d,ghosts:E,enableRowVirtualization:T,overscanRowCount:C,scrollContainerRef:g,selectionColumnWidth:x=0}){const L=f.useRef(null),R=f.useRef(null),p=f.useRef(null),y=f.useRef(null),B=ie(e),U=se(e),M=Se(e,d.getRowHeight),A=(n?t:0)+x,$=Dt({table:e,columnHeaderHeight:s,frozenRowCount:U,frozenRowsHeight:M,getRowHeight:d.getRowHeight,scrollContainerRef:g,enableRowVirtualization:T??!1,overscanRowCount:C??qe}),{contextValue:F,guideIndex:N,reorderingColumnId:I}=Xn(e,l,L,g,A),[O,_]=f.useState({left:0,top:0}),S=e.state.columnResizing,z=(S==null?void 0:S.isResizingColumn)!=null&&S.isResizingColumn!==!1,V=d.resizingGuideTop!=null,X=I!=null,Q=f.useRef(!1);Q.current=z||V||X;const[q,ee]=f.useState({vertical:0,horizontal:0}),le=f.useCallback(()=>{const H=g.current;H!=null&&(R.current!=null&&(R.current.scrollLeft=H.scrollLeft),p.current!=null&&(p.current.scrollTop=H.scrollTop),y.current!=null&&(y.current.scrollLeft=0,y.current.scrollTop=0))},[g]),w=f.useCallback(()=>{if(le(),Q.current){const H=g.current;H!=null&&_({left:H.scrollLeft,top:H.scrollTop})}},[g,le]),j=f.useCallback(()=>{const H=g.current;if(H==null)return;const G=Math.max(0,H.offsetWidth-H.clientWidth),ne=Math.max(0,H.offsetHeight-H.clientHeight);ee(oe=>oe.vertical===G&&oe.horizontal===ne?oe:{vertical:G,horizontal:ne})},[g]),D=e.getTotalSize();f.useLayoutEffect(()=>{const H=g.current;if(H==null)return;j();const G=new ResizeObserver(j);return G.observe(H),()=>G.disconnect()},[j,g]),f.useLayoutEffect(()=>{j()},[s,B,M,j,d.totalHeight,D]),f.useLayoutEffect(()=>{le()},[s,B,M,le]),f.useLayoutEffect(()=>{if(!Q.current)return;const H=g.current;if(H==null)return;const G=H.scrollLeft,ne=H.scrollTop;(G!==O.left||ne!==O.top)&&_({left:G,top:ne})},[z,X,V,g,O.left,O.top]);const b=f.useCallback(H=>{const G=g.current;if(G==null)return;const ne=Math.max(0,G.scrollWidth-G.clientWidth),oe=Math.max(0,G.scrollHeight-G.clientHeight),pe=Qe(G.scrollLeft+H.deltaX,0,ne),he=Qe(G.scrollTop+H.deltaY,0,oe);pe!==G.scrollLeft&&(G.scrollLeft=pe),he!==G.scrollTop&&(G.scrollTop=he)},[g]),K=s+M,Z=A+B,te={table:e,rowHeaderWidth:t,enableRowHeader:n,selectionColumnWidth:x,columnHeaderHeight:s,enableSorting:r,areCellsLoading:c,areColumnHeadersLoading:u,areRowHeadersLoading:a,rowResizing:d,rowVirtualizer:$,ghosts:E};return i.jsx("div",{ref:L,className:dn,children:i.jsx(Nt.Provider,{value:F,children:i.jsxs(xt.Provider,{value:m,children:[i.jsx(Ae,{...te,quadrantType:W.MAIN,scrollContainerRef:g,onScroll:w}),i.jsx(Ae,{...te,quadrantType:W.TOP,columnHeaderMeasureRef:o,scrollContainerRef:R,onWheel:b,style:{height:K,left:A,right:q.vertical}}),i.jsx(Ae,{...te,quadrantType:W.LEFT,scrollContainerRef:p,onWheel:b,style:{bottom:q.horizontal,top:s,width:Z}}),i.jsx(Ae,{...te,quadrantType:W.TOP_LEFT,scrollContainerRef:y,onWheel:b,style:{height:K,width:Z}}),i.jsx(qn,{table:e,rowHeaderWidth:A,columnHeaderHeight:s,scrollLeft:O.left,scrollTop:O.top,frozenRowCount:U,resizingGuideTop:d.resizingGuideTop,resizingRowIndex:d.resizingRowIndex}),i.jsx(Qn,{table:e,reorderingColumnId:I,guideIndex:N,rowHeaderWidth:A,scrollLeft:O.left})]})})})}function Qe(e,t,n){return Math.max(t,Math.min(n,e))}function ms({table:e,rowHeight:t,rowHeaderWidth:n,enableRowHeader:s=!0,columnHeaderHeight:o,enableColumnReordering:l=!1,enableSorting:r=!1,areCellsLoading:c,areColumnHeadersLoading:u,areRowHeadersLoading:a,enableFocusedCell:m=!1,enableGhostCells:d=!1,bodyContextMenuRenderer:E,enableBodyContextMenu:T,onFocusedCell:C,onFocusedRegion:g,selectedRegions:x,onSelection:L,selectionModes:R,enableRowVirtualization:p,overscanRowCount:y,enableRowResizing:B=!1,rowHeights:U,defaultRowHeights:M,onRowHeightChanged:A,minRowHeight:$,maxRowHeight:F,selectionColumnWidth:N=0,className:I,...O}){const _=f.useRef(null),S=(s?n:0)+N,{ref:z,height:V}=zn({minHeight:o,headerRowCount:e.getHeaderGroups().length}),X=Wn({rowHeight:t,rowCount:e.getRowModel().rows.length,rowHeights:U,defaultRowHeights:M,enableRowResizing:B,minRowHeight:$,maxRowHeight:F,onRowHeightChanged:A}),Q=Un({table:e,getRowTop:X.getRowTop,getRowHeight:X.getRowHeight,scrollContainerRef:_,rowHeaderWidth:S,columnHeaderHeight:V,bodyContextMenuRenderer:E,enableBodyContextMenu:T,enableFocusedCell:m,onFocusedCell:C,onFocusedRegion:g,selectedRegions:x,onSelection:L,selectionModes:R}),q=Hn({enableGhostCells:d,rowHeight:t,rowHeaderWidth:S,columnHeaderHeight:V,totalWidth:e.getTotalSize(),totalHeight:X.totalHeight,scrollContainerRef:_}),ee=Q.isSelectionModeEnabled(J.CELLS)?pn:void 0;return i.jsx("div",{...O,className:P(qt,ee,{[tn]:q!=null&&q.columnCount>0,[nn]:q!=null&&q.rowCount>0},I),children:i.jsx(fs,{table:e,rowHeaderWidth:n,enableRowHeader:s,columnHeaderHeight:V,columnHeaderMeasureRef:z,enableColumnReordering:l,enableSorting:r,areCellsLoading:c,areColumnHeadersLoading:u,areRowHeadersLoading:a,selection:Q,rowResizing:X,ghosts:q,enableRowVirtualization:p,overscanRowCount:y,scrollContainerRef:_,selectionColumnWidth:N})})}function hs({htmlProps:e,rowHeight:t=Pt,showRowSelectionCheckboxes:n=!1,rowSelectionColumnWidth:s=Ft,rowHeaderWidth:o=$t,enableRowHeader:l=!0,columnHeaderHeight:r=Ke,enableColumnReordering:c=!1,enableSorting:u=!1,loadingOptions:a=[],enableFocusedCell:m=!1,enableGhostCells:d=!1,bodyContextMenuRenderer:E,enableBodyContextMenu:T,onFocusedCell:C,onFocusedRegion:g,selectedRegions:x,onSelection:L,selectionModes:R,enableRowVirtualization:p=!1,numFrozenColumns:y=0,numFrozenRows:B=0,overscanRowCount:U=qe,columnVisibility:M,enableRowResizing:A=!1,rowHeights:$,defaultRowHeights:F,onRowHeightChanged:N,minRowHeight:I,maxRowHeight:O,rowSelection:_,defaultRowSelection:S,...z}){var j,D;const[V,X]=bt({value:_??((j=z.state)==null?void 0:j.rowSelection),initialValue:S??((D=z.initialState)==null?void 0:D.rowSelection),finalValue:{},onChange:z.onRowSelectionChange}),Q=f.useCallback(b=>{X(Y.functionalUpdate(b,V))},[V,X]),q=Bt({...z,enableSorting:u,state:{...z.state,...M!==void 0?{columnVisibility:M}:{},rowSelection:V},onRowSelectionChange:Q});yt({table:q,numFrozenColumns:y,numFrozenRows:B});const ee=ve(a,ge.CELLS),le=ve(a,ge.COLUMN_HEADERS),w=ve(a,ge.ROW_HEADERS);return i.jsx(ms,{table:q,rowHeight:t,rowHeaderWidth:o,enableRowHeader:l,columnHeaderHeight:r,enableColumnReordering:c,enableSorting:u,areCellsLoading:ee,areColumnHeadersLoading:le,areRowHeadersLoading:w,enableFocusedCell:m,enableGhostCells:d,bodyContextMenuRenderer:E,enableBodyContextMenu:T,onFocusedCell:C,onFocusedRegion:g,selectedRegions:x,onSelection:L,selectionModes:R,enableRowVirtualization:p,overscanRowCount:U,enableRowResizing:A,rowHeights:$,defaultRowHeights:F,onRowHeightChanged:N,minRowHeight:I,maxRowHeight:O,selectionColumnWidth:n?s:0,...e})}const St=10,_t=[10,20,50,100];function Rt({pageIndex:e,pageSize:t,pageCount:n,rowCount:s,pageSizeOptions:o=_t,onPageIndexChange:l,onPageSizeChange:r,className:c}){const u=n!=null&&n>=0?n:void 0,a=e>0,m=u===void 0?!0:e<u-1,d=s===void 0||s===0?0:e*t+1,E=s===void 0?void 0:Math.min((e+1)*t,s),T=o.includes(t)?o:[...o,t].sort((C,g)=>C-g);return i.jsxs("div",{className:P(sn,c),children:[i.jsxs("div",{className:Fe,children:[i.jsx("span",{className:_e,children:"Rows per page:"}),i.jsx(k.HTMLSelect,{"aria-label":"Rows per page",onChange:C=>r(Number(C.currentTarget.value)),options:T,value:t}),s!==void 0&&i.jsxs("span",{className:_e,children:[d===0?0:`${d}–${E}`," of ",s]})]}),i.jsxs("div",{className:Fe,children:[i.jsxs("span",{className:_e,children:["Page ",e+1,u!==void 0?` of ${u}`:""]}),i.jsxs(k.ButtonGroup,{children:[i.jsx(k.Button,{"aria-label":"First page",disabled:!a,icon:"double-chevron-left",onClick:()=>l(0)}),i.jsx(k.Button,{"aria-label":"Previous page",disabled:!a,icon:"chevron-left",onClick:()=>l(e-1)}),i.jsx(k.Button,{"aria-label":"Next page",disabled:!m,icon:"chevron-right",onClick:()=>l(e+1)}),i.jsx(k.Button,{"aria-label":"Last page",disabled:u===void 0||!m,icon:"double-chevron-right",onClick:()=>{u!==void 0&&l(u-1)}})]})]})]})}const Es=Y.tableFeatures({...Ne,rowPaginationFeature:Y.rowPaginationFeature,paginatedRowModel:Y.createPaginatedRowModel()});function ws(e){function t({data:s,initialState:o,state:l,features:r,onPaginationChange:c,manualPagination:u,pageCount:a,rowCount:m,initialPageIndex:d=0,initialPageSize:E=St,pageSizeOptions:T,showPaginationBar:C=!0,paginationBarClassName:g,...x}){const[L,R]=f.useState(()=>{var _,S;return{pageIndex:((_=o==null?void 0:o.pagination)==null?void 0:_.pageIndex)??d,pageSize:((S=o==null?void 0:o.pagination)==null?void 0:S.pageSize)??E}}),p=l==null?void 0:l.pagination,y=p??L,{pageIndex:B,pageSize:U}=y,M=f.useCallback(_=>{c==null||c(_),p===void 0&&R(S=>Y.functionalUpdate(_,S))},[p,c]),A=u===!0,$=A?m:s.length,F=f.useMemo(()=>A?a!=null&&a>=0?a:m!=null?Math.ceil(m/U):void 0:Math.max(1,Math.ceil(s.length/U)),[s.length,A,a,U,m]);f.useEffect(()=>{if(F===void 0)return;const _=Math.max(0,F-1);B>_&&M(S=>({...S,pageIndex:_}))},[M,F,B]);const N=f.useMemo(()=>r==null?Es:Y.tableFeatures({...Ne,...r,rowPaginationFeature:Y.rowPaginationFeature,paginatedRowModel:Y.createPaginatedRowModel()}),[r]),I=f.useCallback(_=>{M(S=>({...S,pageIndex:Math.max(0,_)}))},[M]),O=f.useCallback(_=>{M(S=>({...S,pageIndex:0,pageSize:_}))},[M]);return i.jsxs("div",{className:ln,children:[i.jsx(e,{...x,data:s,initialState:o,state:{...l,pagination:y},features:N,onPaginationChange:M,manualPagination:u,pageCount:a,rowCount:m}),C&&i.jsx(Rt,{className:g,onPageIndexChange:I,onPageSizeChange:O,pageCount:F,pageIndex:B,pageSize:U,pageSizeOptions:T,rowCount:$})]})}const n=e.displayName??e.name??"Table";return t.displayName=`withPagination(${n})`,t}exports.BP_Table=hs;exports.DEFAULT_BP_TABLE_FEATURES=Ne;exports.DEFAULT_PAGE_SIZE=St;exports.DEFAULT_PAGE_SIZE_OPTIONS=_t;exports.Direction=Ct;exports.FocusMode=ye;exports.RegionCardinality=J;exports.Regions=v;exports.TableLoadingOption=ge;exports.TablePaginationBar=Rt;exports.directionToDelta=pt;exports.hasLoadingOption=ve;exports.moveFocusedCell=Rn;exports.resizeRegion=In;exports.withPagination=ws;
6
+ //# sourceMappingURL=blueprintjs-react-table.cjs.map