material-react-table 2.9.2 → 2.11.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 (199) hide show
  1. package/README.md +3 -2
  2. package/dist/index.d.ts +222 -152
  3. package/dist/index.esm.js +906 -769
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +910 -768
  6. package/dist/index.js.map +1 -1
  7. package/locales/ar/index.esm.js +2 -0
  8. package/locales/ar/index.js +2 -0
  9. package/locales/az/index.esm.js +2 -0
  10. package/locales/az/index.js +2 -0
  11. package/locales/bg/index.esm.js +2 -0
  12. package/locales/bg/index.js +2 -0
  13. package/locales/cs/index.esm.js +2 -0
  14. package/locales/cs/index.js +2 -0
  15. package/locales/da/index.esm.js +2 -0
  16. package/locales/da/index.js +2 -0
  17. package/locales/de/index.esm.js +2 -0
  18. package/locales/de/index.js +2 -0
  19. package/locales/en/index.esm.js +2 -0
  20. package/locales/en/index.js +2 -0
  21. package/locales/es/index.esm.js +2 -0
  22. package/locales/es/index.js +2 -0
  23. package/locales/et/index.esm.js +2 -0
  24. package/locales/et/index.js +2 -0
  25. package/locales/fa/index.esm.js +2 -0
  26. package/locales/fa/index.js +2 -0
  27. package/locales/fi/index.esm.js +2 -0
  28. package/locales/fi/index.js +2 -0
  29. package/locales/fr/index.esm.js +2 -0
  30. package/locales/fr/index.js +2 -0
  31. package/locales/he/index.esm.js +2 -0
  32. package/locales/he/index.js +2 -0
  33. package/locales/hu/index.esm.js +2 -0
  34. package/locales/hu/index.js +2 -0
  35. package/locales/hy/index.esm.js +2 -0
  36. package/locales/hy/index.js +2 -0
  37. package/locales/id/index.esm.js +2 -0
  38. package/locales/id/index.js +2 -0
  39. package/locales/it/index.esm.js +2 -0
  40. package/locales/it/index.js +2 -0
  41. package/locales/ja/index.esm.js +2 -0
  42. package/locales/ja/index.js +2 -0
  43. package/locales/ko/index.esm.js +2 -0
  44. package/locales/ko/index.js +2 -0
  45. package/locales/nl/index.esm.js +2 -0
  46. package/locales/nl/index.js +2 -0
  47. package/locales/no/index.esm.js +2 -0
  48. package/locales/no/index.js +2 -0
  49. package/locales/np/index.esm.js +2 -0
  50. package/locales/np/index.js +2 -0
  51. package/locales/pl/index.esm.js +2 -0
  52. package/locales/pl/index.js +2 -0
  53. package/locales/pt/index.esm.js +2 -0
  54. package/locales/pt/index.js +2 -0
  55. package/locales/pt-BR/index.esm.js +2 -0
  56. package/locales/pt-BR/index.js +2 -0
  57. package/locales/ro/index.esm.js +2 -0
  58. package/locales/ro/index.js +2 -0
  59. package/locales/ru/index.esm.js +2 -0
  60. package/locales/ru/index.js +2 -0
  61. package/locales/sk/index.esm.js +2 -0
  62. package/locales/sk/index.js +2 -0
  63. package/locales/sr-Cyrl-RS/index.esm.js +2 -0
  64. package/locales/sr-Cyrl-RS/index.js +2 -0
  65. package/locales/sr-Latn-RS/index.esm.js +2 -0
  66. package/locales/sr-Latn-RS/index.js +2 -0
  67. package/locales/sv/index.esm.js +2 -0
  68. package/locales/sv/index.js +2 -0
  69. package/locales/tr/index.esm.js +2 -0
  70. package/locales/tr/index.js +2 -0
  71. package/locales/uk/index.esm.js +2 -0
  72. package/locales/uk/index.js +2 -0
  73. package/locales/vi/index.esm.js +2 -0
  74. package/locales/vi/index.js +2 -0
  75. package/locales/zh-Hans/index.esm.js +2 -0
  76. package/locales/zh-Hans/index.js +2 -0
  77. package/locales/zh-Hant/index.esm.js +2 -0
  78. package/locales/zh-Hant/index.js +2 -0
  79. package/package.json +20 -20
  80. package/src/components/MaterialReactTable.tsx +3 -3
  81. package/src/components/body/MRT_TableBody.tsx +3 -2
  82. package/src/components/body/MRT_TableBodyCell.tsx +45 -34
  83. package/src/components/body/MRT_TableBodyCellValue.tsx +5 -2
  84. package/src/components/body/MRT_TableBodyRow.tsx +13 -12
  85. package/src/components/body/MRT_TableBodyRowGrabHandle.tsx +4 -3
  86. package/src/components/body/MRT_TableBodyRowPinButton.tsx +3 -2
  87. package/src/components/body/MRT_TableDetailPanel.tsx +3 -2
  88. package/src/components/buttons/MRT_ColumnPinningButtons.tsx +3 -2
  89. package/src/components/buttons/MRT_CopyButton.tsx +4 -2
  90. package/src/components/buttons/MRT_EditActionButtons.tsx +3 -2
  91. package/src/components/buttons/MRT_ExpandAllButton.tsx +3 -2
  92. package/src/components/buttons/MRT_ExpandButton.tsx +3 -2
  93. package/src/components/buttons/MRT_GrabHandleButton.tsx +9 -15
  94. package/src/components/buttons/MRT_RowPinButton.tsx +3 -2
  95. package/src/components/buttons/MRT_ShowHideColumnsButton.tsx +3 -2
  96. package/src/components/buttons/MRT_ToggleDensePaddingButton.tsx +3 -2
  97. package/src/components/buttons/MRT_ToggleFiltersButton.tsx +3 -2
  98. package/src/components/buttons/MRT_ToggleFullScreenButton.tsx +3 -2
  99. package/src/components/buttons/MRT_ToggleGlobalFilterButton.tsx +3 -2
  100. package/src/components/buttons/MRT_ToggleRowActionMenuButton.tsx +3 -2
  101. package/src/components/footer/MRT_TableFooter.tsx +3 -2
  102. package/src/components/footer/MRT_TableFooterCell.tsx +3 -2
  103. package/src/components/footer/MRT_TableFooterRow.tsx +5 -3
  104. package/src/components/head/MRT_TableHead.tsx +3 -2
  105. package/src/components/head/MRT_TableHeadCell.tsx +9 -5
  106. package/src/components/head/MRT_TableHeadCellColumnActionsButton.tsx +4 -2
  107. package/src/components/head/MRT_TableHeadCellFilterContainer.tsx +4 -2
  108. package/src/components/head/MRT_TableHeadCellFilterLabel.tsx +4 -2
  109. package/src/components/head/MRT_TableHeadCellGrabHandle.tsx +4 -3
  110. package/src/components/head/MRT_TableHeadCellResizeHandle.tsx +3 -2
  111. package/src/components/head/MRT_TableHeadCellSortLabel.tsx +3 -2
  112. package/src/components/head/MRT_TableHeadRow.tsx +4 -2
  113. package/src/components/inputs/MRT_EditCellTextField.tsx +3 -2
  114. package/src/components/inputs/MRT_FilterCheckbox.tsx +3 -2
  115. package/src/components/inputs/MRT_FilterRangeFields.tsx +3 -2
  116. package/src/components/inputs/MRT_FilterRangeSlider.tsx +3 -2
  117. package/src/components/inputs/MRT_FilterTextField.tsx +15 -6
  118. package/src/components/inputs/MRT_GlobalFilterTextField.tsx +3 -2
  119. package/src/components/inputs/MRT_SelectCheckbox.tsx +26 -33
  120. package/src/components/menus/MRT_ActionMenuItem.tsx +61 -0
  121. package/src/components/menus/MRT_CellActionMenu.tsx +109 -0
  122. package/src/components/menus/MRT_ColumnActionMenu.tsx +92 -172
  123. package/src/components/menus/MRT_FilterOptionMenu.tsx +9 -16
  124. package/src/components/menus/MRT_RowActionMenu.tsx +10 -17
  125. package/src/components/menus/MRT_ShowHideColumnsMenu.tsx +11 -3
  126. package/src/components/menus/MRT_ShowHideColumnsMenuItems.tsx +7 -5
  127. package/src/components/modals/MRT_EditRowModal.tsx +3 -2
  128. package/src/components/table/MRT_Table.tsx +2 -2
  129. package/src/components/table/MRT_TableContainer.tsx +7 -2
  130. package/src/components/table/MRT_TableLoadingOverlay.tsx +11 -8
  131. package/src/components/table/MRT_TablePaper.tsx +3 -2
  132. package/src/components/toolbar/MRT_BottomToolbar.tsx +3 -2
  133. package/src/components/toolbar/MRT_LinearProgressBar.tsx +3 -2
  134. package/src/components/toolbar/MRT_TablePagination.tsx +2 -2
  135. package/src/components/toolbar/MRT_ToolbarAlertBanner.tsx +30 -13
  136. package/src/components/toolbar/MRT_ToolbarDropZone.tsx +3 -2
  137. package/src/components/toolbar/MRT_ToolbarInternalButtons.tsx +3 -2
  138. package/src/components/toolbar/MRT_TopToolbar.tsx +2 -2
  139. package/src/hooks/display-columns/getMRT_RowActionsColumnDef.tsx +1 -8
  140. package/src/hooks/display-columns/getMRT_RowDragColumnDef.tsx +1 -8
  141. package/src/hooks/display-columns/getMRT_RowExpandColumnDef.tsx +1 -8
  142. package/src/hooks/display-columns/getMRT_RowNumbersColumnDef.tsx +1 -8
  143. package/src/hooks/display-columns/getMRT_RowPinningColumnDef.tsx +1 -8
  144. package/src/hooks/display-columns/getMRT_RowSelectColumnDef.tsx +1 -8
  145. package/src/hooks/display-columns/getMRT_RowSpacerColumnDef.tsx +1 -8
  146. package/src/hooks/useMRT_Effects.ts +14 -4
  147. package/src/hooks/useMRT_Rows.ts +11 -79
  148. package/src/hooks/useMRT_TableInstance.ts +114 -59
  149. package/src/hooks/useMRT_TableOptions.ts +2 -0
  150. package/src/icons.ts +2 -0
  151. package/src/index.ts +2 -0
  152. package/src/locales/ar.ts +2 -0
  153. package/src/locales/az.ts +2 -0
  154. package/src/locales/bg.ts +2 -0
  155. package/src/locales/cs.ts +2 -0
  156. package/src/locales/da.ts +2 -0
  157. package/src/locales/de.ts +2 -0
  158. package/src/locales/en.ts +2 -0
  159. package/src/locales/es.ts +2 -0
  160. package/src/locales/et.ts +2 -0
  161. package/src/locales/fa.ts +2 -0
  162. package/src/locales/fi.ts +2 -0
  163. package/src/locales/fr.ts +2 -0
  164. package/src/locales/he.ts +2 -0
  165. package/src/locales/hu.ts +2 -0
  166. package/src/locales/hy.ts +2 -0
  167. package/src/locales/id.ts +2 -0
  168. package/src/locales/it.ts +2 -0
  169. package/src/locales/ja.ts +2 -0
  170. package/src/locales/ko.ts +2 -0
  171. package/src/locales/nl.ts +2 -0
  172. package/src/locales/no.ts +2 -0
  173. package/src/locales/np.ts +2 -0
  174. package/src/locales/pl.ts +2 -0
  175. package/src/locales/pt-BR.ts +2 -0
  176. package/src/locales/pt.ts +2 -0
  177. package/src/locales/ro.ts +2 -0
  178. package/src/locales/ru.ts +2 -0
  179. package/src/locales/sk.ts +2 -0
  180. package/src/locales/sr-Cyrl-RS.ts +2 -0
  181. package/src/locales/sr-Latn-RS.ts +2 -0
  182. package/src/locales/sv.ts +2 -0
  183. package/src/locales/tr.ts +2 -0
  184. package/src/locales/uk.ts +2 -0
  185. package/src/locales/vi.ts +2 -0
  186. package/src/locales/zh-Hans.ts +2 -0
  187. package/src/locales/zh-Hant.ts +2 -0
  188. package/src/types.ts +51 -13
  189. package/src/utils/cell.utils.ts +50 -0
  190. package/src/utils/column.utils.ts +4 -6
  191. package/src/utils/displayColumn.utils.ts +39 -21
  192. package/src/utils/row.utils.ts +179 -21
  193. package/locales/am/index.d.ts +0 -3
  194. package/locales/am/index.esm.d.ts +0 -3
  195. package/locales/am/index.esm.js +0 -93
  196. package/locales/am/index.js +0 -97
  197. package/locales/am/package.json +0 -6
  198. package/src/hooks/display-columns/getMRT_DisplayColumns.tsx +0 -26
  199. package/src/locales/am.ts +0 -94
package/dist/index.js CHANGED
@@ -12,8 +12,8 @@ var Box = require('@mui/material/Box');
12
12
  var Button = require('@mui/material/Button');
13
13
  var CircularProgress = require('@mui/material/CircularProgress');
14
14
  var styles = require('@mui/material/styles');
15
- var ListItemIcon = require('@mui/material/ListItemIcon');
16
15
  var Menu = require('@mui/material/Menu');
16
+ var ListItemIcon = require('@mui/material/ListItemIcon');
17
17
  var MenuItem = require('@mui/material/MenuItem');
18
18
  var Stack = require('@mui/material/Stack');
19
19
  var Checkbox = require('@mui/material/Checkbox');
@@ -25,6 +25,7 @@ var ChevronLeftIcon = require('@mui/icons-material/ChevronLeft');
25
25
  var ChevronRightIcon = require('@mui/icons-material/ChevronRight');
26
26
  var ClearAllIcon = require('@mui/icons-material/ClearAll');
27
27
  var CloseIcon = require('@mui/icons-material/Close');
28
+ var ContentCopy = require('@mui/icons-material/ContentCopy');
28
29
  var DensityLargeIcon = require('@mui/icons-material/DensityLarge');
29
30
  var DensityMediumIcon = require('@mui/icons-material/DensityMedium');
30
31
  var DensitySmallIcon = require('@mui/icons-material/DensitySmall');
@@ -102,8 +103,8 @@ var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
102
103
  var Box__default = /*#__PURE__*/_interopDefaultLegacy(Box);
103
104
  var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
104
105
  var CircularProgress__default = /*#__PURE__*/_interopDefaultLegacy(CircularProgress);
105
- var ListItemIcon__default = /*#__PURE__*/_interopDefaultLegacy(ListItemIcon);
106
106
  var Menu__default = /*#__PURE__*/_interopDefaultLegacy(Menu);
107
+ var ListItemIcon__default = /*#__PURE__*/_interopDefaultLegacy(ListItemIcon);
107
108
  var MenuItem__default = /*#__PURE__*/_interopDefaultLegacy(MenuItem);
108
109
  var Stack__default = /*#__PURE__*/_interopDefaultLegacy(Stack);
109
110
  var Checkbox__default = /*#__PURE__*/_interopDefaultLegacy(Checkbox);
@@ -115,6 +116,7 @@ var ChevronLeftIcon__default = /*#__PURE__*/_interopDefaultLegacy(ChevronLeftIco
115
116
  var ChevronRightIcon__default = /*#__PURE__*/_interopDefaultLegacy(ChevronRightIcon);
116
117
  var ClearAllIcon__default = /*#__PURE__*/_interopDefaultLegacy(ClearAllIcon);
117
118
  var CloseIcon__default = /*#__PURE__*/_interopDefaultLegacy(CloseIcon);
119
+ var ContentCopy__default = /*#__PURE__*/_interopDefaultLegacy(ContentCopy);
118
120
  var DensityLargeIcon__default = /*#__PURE__*/_interopDefaultLegacy(DensityLargeIcon);
119
121
  var DensityMediumIcon__default = /*#__PURE__*/_interopDefaultLegacy(DensityMediumIcon);
120
122
  var DensitySmallIcon__default = /*#__PURE__*/_interopDefaultLegacy(DensitySmallIcon);
@@ -248,13 +250,12 @@ const reorderColumn = (draggedColumn, targetColumn, columnOrder) => {
248
250
  return newColumnOrder;
249
251
  };
250
252
  const getDefaultColumnFilterFn = (columnDef) => {
251
- var _a;
252
- if (columnDef.filterVariant === 'multi-select')
253
+ const { filterVariant } = columnDef;
254
+ if (filterVariant === 'multi-select')
253
255
  return 'arrIncludesSome';
254
- if ((_a = columnDef.filterVariant) === null || _a === void 0 ? void 0 : _a.includes('range'))
256
+ if (filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.includes('range'))
255
257
  return 'betweenInclusive';
256
- if (columnDef.filterVariant === 'select' ||
257
- columnDef.filterVariant === 'checkbox')
258
+ if (filterVariant === 'select' || filterVariant === 'checkbox')
258
259
  return 'equals';
259
260
  return 'fuzzy';
260
261
  };
@@ -301,32 +302,73 @@ const createRow = (table, originalRow, rowIndex = -1, depth = 0, subRows, parent
301
302
  [getColumnId(col)]: '',
302
303
  }))), rowIndex, depth, subRows, parentId);
303
304
 
305
+ const parseFromValuesOrFunc = (fn, arg) => (fn instanceof Function ? fn(arg) : fn);
306
+ const getValueAndLabel = (option) => {
307
+ var _a, _b, _c;
308
+ let label = '';
309
+ let value = '';
310
+ if (option) {
311
+ if (typeof option !== 'object') {
312
+ label = option;
313
+ value = option;
314
+ }
315
+ else {
316
+ label = (_b = (_a = option.label) !== null && _a !== void 0 ? _a : option.text) !== null && _b !== void 0 ? _b : option.value;
317
+ value = (_c = option.value) !== null && _c !== void 0 ? _c : label;
318
+ }
319
+ }
320
+ return { label, value };
321
+ };
322
+
323
+ const isCellEditable = ({ cell, table, }) => {
324
+ const { enableEditing } = table.options;
325
+ const { column: { columnDef }, row, } = cell;
326
+ return (!cell.getIsPlaceholder() &&
327
+ parseFromValuesOrFunc(enableEditing, row) &&
328
+ parseFromValuesOrFunc(columnDef.enableEditing, row) !== false);
329
+ };
330
+ const openEditingCell = ({ cell, table, }) => {
331
+ const { options: { editDisplayMode }, refs: { editInputRefs }, } = table;
332
+ const { column } = cell;
333
+ if (isCellEditable({ cell, table }) && editDisplayMode === 'cell') {
334
+ table.setEditingCell(cell);
335
+ queueMicrotask(() => {
336
+ var _a;
337
+ const textField = editInputRefs.current[column.id];
338
+ if (textField) {
339
+ textField.focus();
340
+ (_a = textField.select) === null || _a === void 0 ? void 0 : _a.call(textField);
341
+ }
342
+ });
343
+ }
344
+ };
345
+
304
346
  function defaultDisplayColumnProps({ header, id, size, tableOptions, }) {
305
347
  const { defaultDisplayColumn, displayColumnDefOptions, localization } = tableOptions;
306
348
  return Object.assign(Object.assign(Object.assign(Object.assign({}, defaultDisplayColumn), { header: header ? localization[header] : '', size }), displayColumnDefOptions === null || displayColumnDefOptions === void 0 ? void 0 : displayColumnDefOptions[id]), { id });
307
349
  }
308
350
  const showRowPinningColumn = (tableOptions) => {
309
351
  const { enableRowPinning, rowPinningDisplayMode } = tableOptions;
310
- return enableRowPinning && !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.startsWith('select'));
352
+ return !!(enableRowPinning && !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.startsWith('select')));
311
353
  };
312
354
  const showRowDragColumn = (tableOptions) => {
313
355
  const { enableRowDragging, enableRowOrdering } = tableOptions;
314
- return enableRowDragging || enableRowOrdering;
356
+ return !!(enableRowDragging || enableRowOrdering);
315
357
  };
316
358
  const showRowExpandColumn = (tableOptions) => {
317
359
  const { enableExpanding, enableGrouping, renderDetailPanel, state: { grouping }, } = tableOptions;
318
360
  return !!(enableExpanding ||
319
- (enableGrouping && (grouping === undefined || (grouping === null || grouping === void 0 ? void 0 : grouping.length))) ||
361
+ (enableGrouping && (grouping === null || grouping === void 0 ? void 0 : grouping.length)) ||
320
362
  renderDetailPanel);
321
363
  };
322
364
  const showRowActionsColumn = (tableOptions) => {
323
365
  const { createDisplayMode, editDisplayMode, enableEditing, enableRowActions, state: { creatingRow }, } = tableOptions;
324
- return (enableRowActions ||
366
+ return !!(enableRowActions ||
325
367
  (creatingRow && createDisplayMode === 'row') ||
326
368
  (enableEditing && ['modal', 'row'].includes(editDisplayMode !== null && editDisplayMode !== void 0 ? editDisplayMode : '')));
327
369
  };
328
- const showRowSelectionColumn = (tableOptions) => tableOptions.enableRowSelection;
329
- const showRowNumbersColumn = (tableOptions) => tableOptions.enableRowNumbers;
370
+ const showRowSelectionColumn = (tableOptions) => !!tableOptions.enableRowSelection;
371
+ const showRowNumbersColumn = (tableOptions) => !!tableOptions.enableRowNumbers;
330
372
  const showRowSpacerColumn = (tableOptions) => tableOptions.layoutMode === 'grid-no-grow';
331
373
  const getLeadingDisplayColumnIds = (tableOptions) => [
332
374
  showRowPinningColumn(tableOptions) && 'mrt-row-pin',
@@ -349,44 +391,82 @@ const getTrailingDisplayColumnIds = (tableOptions) => [
349
391
  'mrt-row-expand',
350
392
  showRowSpacerColumn(tableOptions) && 'mrt-row-spacer',
351
393
  ].filter(Boolean);
352
- const getDefaultColumnOrderIds = (tableOptions) => {
353
- const leadingDisplayCols = getLeadingDisplayColumnIds(tableOptions);
354
- const trailingDisplayCols = getTrailingDisplayColumnIds(tableOptions);
355
- const allLeafColumnDefs = getAllLeafColumnDefs(tableOptions.columns)
356
- .map((columnDef) => getColumnId(columnDef))
357
- .filter((columnId) => !leadingDisplayCols.includes(columnId) &&
358
- !trailingDisplayCols.includes(columnId));
359
- return [...leadingDisplayCols, ...allLeafColumnDefs, ...trailingDisplayCols];
394
+ const getDefaultColumnOrderIds = (tableOptions, reset = false) => {
395
+ const { state: { columnOrder: currentColumnOrderIds = [] }, } = tableOptions;
396
+ const leadingDisplayColIds = getLeadingDisplayColumnIds(tableOptions);
397
+ const trailingDisplayColIds = getTrailingDisplayColumnIds(tableOptions);
398
+ const defaultColumnDefIds = getAllLeafColumnDefs(tableOptions.columns).map((columnDef) => getColumnId(columnDef));
399
+ let allLeafColumnDefIds = reset
400
+ ? defaultColumnDefIds
401
+ : Array.from(new Set([...currentColumnOrderIds, ...defaultColumnDefIds]));
402
+ allLeafColumnDefIds = allLeafColumnDefIds.filter((colId) => !leadingDisplayColIds.includes(colId) &&
403
+ !trailingDisplayColIds.includes(colId));
404
+ return [
405
+ ...leadingDisplayColIds,
406
+ ...allLeafColumnDefIds,
407
+ ...trailingDisplayColIds,
408
+ ];
360
409
  };
361
410
 
362
- const parseFromValuesOrFunc = (fn, arg) => (fn instanceof Function ? fn(arg) : fn);
363
- const getValueAndLabel = (option) => {
364
- var _a, _b, _c;
365
- let label = '';
366
- let value = '';
367
- if (option) {
368
- if (typeof option !== 'object') {
369
- label = option;
370
- value = option;
371
- }
372
- else {
373
- label = (_b = (_a = option.label) !== null && _a !== void 0 ? _a : option.text) !== null && _b !== void 0 ? _b : option.value;
374
- value = (_c = option.value) !== null && _c !== void 0 ? _c : label;
375
- }
411
+ const fuzzy$1 = (rowA, rowB, columnId) => {
412
+ let dir = 0;
413
+ if (rowA.columnFiltersMeta[columnId]) {
414
+ dir = matchSorterUtils.compareItems(rowA.columnFiltersMeta[columnId], rowB.columnFiltersMeta[columnId]);
376
415
  }
377
- return { label, value };
416
+ // Provide a fallback for when the item ranks are equal
417
+ return dir === 0
418
+ ? reactTable.sortingFns.alphanumeric(rowA, rowB, columnId)
419
+ : dir;
378
420
  };
421
+ const MRT_SortingFns = Object.assign(Object.assign({}, reactTable.sortingFns), { fuzzy: fuzzy$1 });
422
+ const rankGlobalFuzzy = (rowA, rowB) => Math.max(...Object.values(rowB.columnFiltersMeta).map((v) => v.rank)) -
423
+ Math.max(...Object.values(rowA.columnFiltersMeta).map((v) => v.rank));
379
424
 
380
- const getIsRowSelected = ({ row, table, }) => {
381
- const { options: { enableRowSelection }, } = table;
382
- return (row.getIsSelected() ||
383
- (parseFromValuesOrFunc(enableRowSelection, row) &&
384
- row.getCanSelectSubRows() &&
385
- row.getIsAllSubRowsSelected()));
425
+ const getMRT_Rows = (table, pinnedRowIds = [], all) => {
426
+ const { getBottomRows, getCenterRows, getPrePaginationRowModel, getRowModel, getState, getTopRows, options: { createDisplayMode, enablePagination, enableRowPinning, manualPagination, positionCreatingRow, rowPinningDisplayMode, }, } = table;
427
+ const { creatingRow, pagination } = getState();
428
+ const isRankingRows = getIsRankingRows(table);
429
+ let rows = [];
430
+ if (!isRankingRows) {
431
+ rows =
432
+ !enableRowPinning || (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky'))
433
+ ? all
434
+ ? getPrePaginationRowModel().rows
435
+ : getRowModel().rows
436
+ : getCenterRows();
437
+ }
438
+ else {
439
+ rows = getPrePaginationRowModel().rows.sort((a, b) => rankGlobalFuzzy(a, b));
440
+ if (enablePagination && !manualPagination && !all) {
441
+ const start = pagination.pageIndex * pagination.pageSize;
442
+ rows = rows.slice(start, start + pagination.pageSize);
443
+ }
444
+ }
445
+ if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky'))) {
446
+ rows = [
447
+ ...getTopRows().filter((row) => !pinnedRowIds.includes(row.id)),
448
+ ...rows,
449
+ ...getBottomRows().filter((row) => !pinnedRowIds.includes(row.id)),
450
+ ];
451
+ }
452
+ if (positionCreatingRow !== undefined &&
453
+ creatingRow &&
454
+ createDisplayMode === 'row') {
455
+ const creatingRowIndex = !isNaN(+positionCreatingRow)
456
+ ? +positionCreatingRow
457
+ : positionCreatingRow === 'top'
458
+ ? 0
459
+ : rows.length;
460
+ rows = [
461
+ ...rows.slice(0, creatingRowIndex),
462
+ creatingRow,
463
+ ...rows.slice(creatingRowIndex),
464
+ ];
465
+ }
466
+ return rows;
386
467
  };
387
468
  const getCanRankRows = (table) => {
388
- const { getState, options } = table;
389
- const { enableGlobalFilterRankedResults, manualExpanding, manualFiltering, manualGrouping, manualSorting, } = options;
469
+ const { getState, options: { enableGlobalFilterRankedResults, manualExpanding, manualFiltering, manualGrouping, manualSorting, }, } = table;
390
470
  const { expanded, globalFilterFn } = getState();
391
471
  return (!manualExpanding &&
392
472
  !manualFiltering &&
@@ -397,17 +477,67 @@ const getCanRankRows = (table) => {
397
477
  expanded !== true &&
398
478
  !Object.values(expanded).some(Boolean));
399
479
  };
480
+ const getIsRankingRows = (table) => {
481
+ const { globalFilter, sorting } = table.getState();
482
+ return (getCanRankRows(table) &&
483
+ globalFilter &&
484
+ !Object.values(sorting).some(Boolean));
485
+ };
486
+ const getIsRowSelected = ({ row, table, }) => {
487
+ const { options: { enableRowSelection }, } = table;
488
+ return (row.getIsSelected() ||
489
+ (parseFromValuesOrFunc(enableRowSelection, row) &&
490
+ row.getCanSelectSubRows() &&
491
+ row.getIsAllSubRowsSelected()));
492
+ };
493
+ const getMRT_RowSelectionHandler = () => ({ event, row, staticRowIndex = 0, table, }) => {
494
+ var _a;
495
+ const { getState, options: { enableBatchRowSelection, enableRowPinning, rowPinningDisplayMode, }, refs: { lastSelectedRowId: lastSelectedRowId }, } = table;
496
+ const { pagination: { pageIndex, pageSize }, } = getState();
497
+ const isChecked = getIsRowSelected({ row, table });
498
+ const isStickySelection = enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('select'));
499
+ // toggle selected of this row
500
+ row.getToggleSelectedHandler()(event);
501
+ // if shift key is pressed, select all rows between last selected and this one
502
+ if (enableBatchRowSelection &&
503
+ event.nativeEvent.shiftKey &&
504
+ lastSelectedRowId.current !== null) {
505
+ const rows = getMRT_Rows(table, undefined, true);
506
+ const lastIndex = rows.findIndex((r) => r.id === lastSelectedRowId.current);
507
+ if (lastIndex !== -1) {
508
+ const currentIndex = staticRowIndex + pageSize * pageIndex;
509
+ const [start, end] = lastIndex < currentIndex
510
+ ? [lastIndex, currentIndex]
511
+ : [currentIndex, lastIndex];
512
+ for (let i = start; i <= end; i++) {
513
+ rows[i].toggleSelected(!isChecked);
514
+ }
515
+ }
516
+ }
517
+ lastSelectedRowId.current = row.id;
518
+ // if all sub rows were selected, unselect them
519
+ if (row.getCanSelectSubRows() && row.getIsAllSubRowsSelected()) {
520
+ (_a = row.subRows) === null || _a === void 0 ? void 0 : _a.forEach((r) => r.toggleSelected(false));
521
+ }
522
+ if (isStickySelection) {
523
+ row.pin(!row.getIsPinned() && isChecked
524
+ ? (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('bottom'))
525
+ ? 'bottom'
526
+ : 'top'
527
+ : false);
528
+ }
529
+ };
400
530
 
401
531
  const MRT_AggregationFns = Object.assign({}, reactTable.aggregationFns);
402
532
 
403
- const fuzzy$1 = (row, columnId, filterValue, addMeta) => {
533
+ const fuzzy = (row, columnId, filterValue, addMeta) => {
404
534
  const itemRank = matchSorterUtils.rankItem(row.getValue(columnId), filterValue, {
405
535
  threshold: matchSorterUtils.rankings.MATCHES,
406
536
  });
407
537
  addMeta(itemRank);
408
538
  return itemRank.passed;
409
539
  };
410
- fuzzy$1.autoRemove = (val) => !val;
540
+ fuzzy.autoRemove = (val) => !val;
411
541
  const contains = (row, id, filterValue) => row
412
542
  .getValue(id)
413
543
  .toString()
@@ -475,7 +605,7 @@ const MRT_FilterFns = Object.assign(Object.assign({}, reactTable.filterFns), { b
475
605
  empty,
476
606
  endsWith,
477
607
  equals,
478
- fuzzy: fuzzy$1,
608
+ fuzzy,
479
609
  greaterThan,
480
610
  greaterThanOrEqualTo,
481
611
  lessThan,
@@ -484,20 +614,6 @@ const MRT_FilterFns = Object.assign(Object.assign({}, reactTable.filterFns), { b
484
614
  notEquals,
485
615
  startsWith });
486
616
 
487
- const fuzzy = (rowA, rowB, columnId) => {
488
- let dir = 0;
489
- if (rowA.columnFiltersMeta[columnId]) {
490
- dir = matchSorterUtils.compareItems(rowA.columnFiltersMeta[columnId], rowB.columnFiltersMeta[columnId]);
491
- }
492
- // Provide a fallback for when the item ranks are equal
493
- return dir === 0
494
- ? reactTable.sortingFns.alphanumeric(rowA, rowB, columnId)
495
- : dir;
496
- };
497
- const MRT_SortingFns = Object.assign(Object.assign({}, reactTable.sortingFns), { fuzzy });
498
- const rankGlobalFuzzy = (rowA, rowB) => Math.max(...Object.values(rowB.columnFiltersMeta).map((v) => v.rank)) -
499
- Math.max(...Object.values(rowA.columnFiltersMeta).map((v) => v.rank));
500
-
501
617
  /******************************************************************************
502
618
  Copyright (c) Microsoft Corporation.
503
619
 
@@ -673,380 +789,44 @@ const getCommonTooltipProps = (placement) => ({
673
789
  placement,
674
790
  });
675
791
 
676
- const mrtFilterOptions = (localization) => [
677
- {
678
- divider: false,
679
- label: localization.filterFuzzy,
680
- option: 'fuzzy',
681
- symbol: '',
682
- },
683
- {
684
- divider: false,
685
- label: localization.filterContains,
686
- option: 'contains',
687
- symbol: '*',
688
- },
689
- {
690
- divider: false,
691
- label: localization.filterStartsWith,
692
- option: 'startsWith',
693
- symbol: 'a',
694
- },
695
- {
696
- divider: true,
697
- label: localization.filterEndsWith,
698
- option: 'endsWith',
699
- symbol: 'z',
700
- },
701
- {
702
- divider: false,
703
- label: localization.filterEquals,
704
- option: 'equals',
705
- symbol: '=',
706
- },
707
- {
708
- divider: true,
709
- label: localization.filterNotEquals,
710
- option: 'notEquals',
711
- symbol: '≠',
712
- },
713
- {
714
- divider: false,
715
- label: localization.filterBetween,
716
- option: 'between',
717
- symbol: '⇿',
718
- },
719
- {
720
- divider: true,
721
- label: localization.filterBetweenInclusive,
722
- option: 'betweenInclusive',
723
- symbol: '⬌',
724
- },
725
- {
726
- divider: false,
727
- label: localization.filterGreaterThan,
728
- option: 'greaterThan',
729
- symbol: '>',
730
- },
731
- {
732
- divider: false,
733
- label: localization.filterGreaterThanOrEqualTo,
734
- option: 'greaterThanOrEqualTo',
735
- symbol: '≥',
736
- },
737
- {
738
- divider: false,
739
- label: localization.filterLessThan,
740
- option: 'lessThan',
741
- symbol: '<',
742
- },
743
- {
744
- divider: true,
745
- label: localization.filterLessThanOrEqualTo,
746
- option: 'lessThanOrEqualTo',
747
- symbol: '≤',
748
- },
749
- {
750
- divider: false,
751
- label: localization.filterEmpty,
752
- option: 'empty',
753
- symbol: '∅',
754
- },
755
- {
756
- divider: false,
757
- label: localization.filterNotEmpty,
758
- option: 'notEmpty',
759
- symbol: '!∅',
760
- },
761
- ];
762
- const rangeModes = ['between', 'betweenInclusive', 'inNumberRange'];
763
- const emptyModes = ['empty', 'notEmpty'];
764
- const arrModes = ['arrIncludesSome', 'arrIncludesAll', 'arrIncludes'];
765
- const rangeVariants = ['range-slider', 'date-range', 'datetime-range', 'range'];
766
- const MRT_FilterOptionMenu = (_a) => {
767
- var _b, _c, _d, _e;
768
- var { anchorEl, header, onSelect, setAnchorEl, setFilterValue, table } = _a, rest = __rest(_a, ["anchorEl", "header", "onSelect", "setAnchorEl", "setFilterValue", "table"]);
769
- const { getState, options: { columnFilterModeOptions, globalFilterModeOptions, localization, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
770
- const { density, globalFilterFn } = getState();
771
- const { column } = header !== null && header !== void 0 ? header : {};
772
- const { columnDef } = column !== null && column !== void 0 ? column : {};
773
- const currentFilterValue = column === null || column === void 0 ? void 0 : column.getFilterValue();
774
- let allowedColumnFilterOptions = (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _b !== void 0 ? _b : columnFilterModeOptions;
775
- if (rangeVariants.includes(columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant)) {
776
- allowedColumnFilterOptions = [
777
- ...rangeModes,
778
- ...(allowedColumnFilterOptions !== null && allowedColumnFilterOptions !== void 0 ? allowedColumnFilterOptions : []),
779
- ].filter((option) => rangeModes.includes(option));
780
- }
781
- const internalFilterOptions = react.useMemo(() => mrtFilterOptions(localization).filter((filterOption) => columnDef
782
- ? allowedColumnFilterOptions === undefined ||
783
- (allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.includes(filterOption.option))
784
- : (!globalFilterModeOptions ||
785
- globalFilterModeOptions.includes(filterOption.option)) &&
786
- ['contains', 'fuzzy', 'startsWith'].includes(filterOption.option)), []);
787
- const handleSelectFilterMode = (option) => {
788
- var _a, _b;
789
- const prevFilterMode = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef._filterFn) !== null && _a !== void 0 ? _a : '';
790
- if (!header || !column) {
791
- // global filter mode
792
- setGlobalFilterFn(option);
793
- }
794
- else if (option !== prevFilterMode) {
795
- // column filter mode
796
- setColumnFilterFns((prev) => (Object.assign(Object.assign({}, prev), { [header.id]: option })));
797
- // reset filter value and/or perform new filter render
798
- if (emptyModes.includes(option)) {
799
- // will now be empty/notEmpty filter mode
800
- if (currentFilterValue !== ' ' &&
801
- !emptyModes.includes(prevFilterMode)) {
802
- column.setFilterValue(' ');
803
- }
804
- else if (currentFilterValue) {
805
- column.setFilterValue(currentFilterValue); // perform new filter render
806
- }
807
- }
808
- else if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'multi-select' ||
809
- arrModes.includes(option)) {
810
- // will now be array filter mode
811
- if (currentFilterValue instanceof String ||
812
- (currentFilterValue === null || currentFilterValue === void 0 ? void 0 : currentFilterValue.length)) {
813
- column.setFilterValue([]);
814
- setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue([]);
815
- }
816
- else if (currentFilterValue) {
817
- column.setFilterValue(currentFilterValue); // perform new filter render
818
- }
819
- }
820
- else if (((_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === null || _b === void 0 ? void 0 : _b.includes('range')) ||
821
- rangeModes.includes(option)) {
822
- // will now be range filter mode
823
- if (!Array.isArray(currentFilterValue) ||
824
- (!(currentFilterValue === null || currentFilterValue === void 0 ? void 0 : currentFilterValue.every((v) => v === '')) &&
825
- !rangeModes.includes(prevFilterMode))) {
826
- column.setFilterValue(['', '']);
827
- setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue('');
828
- }
829
- else {
830
- column.setFilterValue(currentFilterValue); // perform new filter render
831
- }
832
- }
833
- else {
834
- // will now be single value filter mode
835
- if (Array.isArray(currentFilterValue)) {
836
- column.setFilterValue('');
837
- setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue('');
838
- }
839
- else if (currentFilterValue === ' ' &&
840
- emptyModes.includes(prevFilterMode)) {
841
- column.setFilterValue(undefined);
842
- }
843
- else {
844
- column.setFilterValue(currentFilterValue); // perform new filter render
845
- }
846
- }
847
- }
848
- setAnchorEl(null);
849
- onSelect === null || onSelect === void 0 ? void 0 : onSelect();
850
- };
851
- const filterOption = !!header && columnDef ? columnDef._filterFn : globalFilterFn;
852
- const theme = styles.useTheme();
853
- const { menuBackgroundColor } = getMRTTheme(table, theme);
854
- return (jsxRuntime.jsx(Menu__default["default"], Object.assign({ MenuListProps: {
855
- dense: density === 'compact',
856
- sx: {
857
- backgroundColor: menuBackgroundColor,
858
- },
859
- }, anchorEl: anchorEl, anchorOrigin: { horizontal: 'right', vertical: 'center' }, disableScrollLock: true, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: (_e = (header && column && columnDef
860
- ? (_d = (_c = columnDef.renderColumnFilterModeMenuItems) === null || _c === void 0 ? void 0 : _c.call(columnDef, {
861
- column: column,
862
- internalFilterOptions,
863
- onSelectFilterMode: handleSelectFilterMode,
864
- table,
865
- })) !== null && _d !== void 0 ? _d : renderColumnFilterModeMenuItems === null || renderColumnFilterModeMenuItems === void 0 ? void 0 : renderColumnFilterModeMenuItems({
866
- column: column,
867
- internalFilterOptions,
868
- onSelectFilterMode: handleSelectFilterMode,
869
- table,
870
- })
871
- : renderGlobalFilterModeMenuItems === null || renderGlobalFilterModeMenuItems === void 0 ? void 0 : renderGlobalFilterModeMenuItems({
872
- internalFilterOptions,
873
- onSelectFilterMode: handleSelectFilterMode,
874
- table,
875
- }))) !== null && _e !== void 0 ? _e : internalFilterOptions.map(({ divider, label, option, symbol }, index) => (jsxRuntime.jsxs(MenuItem__default["default"], { divider: divider, onClick: () => handleSelectFilterMode(option), selected: option === filterOption, sx: {
876
- alignItems: 'center',
877
- display: 'flex',
878
- gap: '2ch',
879
- my: 0,
880
- py: '6px',
881
- }, value: option, children: [jsxRuntime.jsx(Box__default["default"], { sx: { fontSize: '1.25rem', width: '2ch' }, children: symbol }), label] }, index))) })));
882
- };
883
-
884
- const commonMenuItemStyles = {
885
- alignItems: 'center',
886
- justifyContent: 'space-between',
887
- my: 0,
888
- py: '6px',
889
- };
890
- const commonListItemStyles = {
891
- alignItems: 'center',
892
- display: 'flex',
893
- };
894
- const MRT_ColumnActionMenu = (_a) => {
895
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
896
- var { anchorEl, header, setAnchorEl, table } = _a, rest = __rest(_a, ["anchorEl", "header", "setAnchorEl", "table"]);
897
- const { getState, options: { columnFilterDisplayMode, columnFilterModeOptions, enableColumnFilterModes, enableColumnFilters, enableColumnPinning, enableColumnResizing, enableGrouping, enableHiding, enableSorting, enableSortingRemoval, icons: { ArrowRightIcon, ClearAllIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, RestartAltIcon, SortIcon, ViewColumnIcon, VisibilityOffIcon, }, localization, renderColumnActionsMenuItems, }, refs: { filterInputRefs }, setColumnFilterFns, setColumnOrder, setColumnSizingInfo, setShowColumnFilters, toggleAllColumnsVisible, } = table;
898
- const { column } = header;
899
- const { columnDef } = column;
900
- const { columnSizing, columnVisibility, density, showColumnFilters } = getState();
901
- const columnFilterValue = column.getFilterValue();
902
- const [filterMenuAnchorEl, setFilterMenuAnchorEl] = react.useState(null);
903
- const handleClearSort = () => {
904
- column.clearSorting();
905
- setAnchorEl(null);
906
- };
907
- const handleSortAsc = () => {
908
- column.toggleSorting(false);
909
- setAnchorEl(null);
910
- };
911
- const handleSortDesc = () => {
912
- column.toggleSorting(true);
913
- setAnchorEl(null);
914
- };
915
- const handleResetColumnSize = () => {
916
- setColumnSizingInfo((old) => (Object.assign(Object.assign({}, old), { isResizingColumn: false })));
917
- column.resetSize();
918
- setAnchorEl(null);
919
- };
920
- const handleHideColumn = () => {
921
- column.toggleVisibility(false);
922
- setAnchorEl(null);
923
- };
924
- const handlePinColumn = (pinDirection) => {
925
- column.pin(pinDirection);
926
- setAnchorEl(null);
927
- };
928
- const handleGroupByColumn = () => {
929
- column.toggleGrouping();
930
- setColumnOrder((old) => ['mrt-row-expand', ...old]);
931
- setAnchorEl(null);
932
- };
933
- const handleClearFilter = () => {
934
- column.setFilterValue(undefined);
935
- setAnchorEl(null);
936
- if (['empty', 'notEmpty'].includes(columnDef._filterFn)) {
937
- setColumnFilterFns((prev) => {
938
- var _a;
939
- return (Object.assign(Object.assign({}, prev), { [header.id]: (_a = allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions[0]) !== null && _a !== void 0 ? _a : 'fuzzy' }));
940
- });
941
- }
942
- };
943
- const handleFilterByColumn = () => {
944
- setShowColumnFilters(true);
945
- queueMicrotask(() => { var _a; return (_a = filterInputRefs.current[`${column.id}-0`]) === null || _a === void 0 ? void 0 : _a.focus(); });
946
- setAnchorEl(null);
947
- };
948
- const handleShowAllColumns = () => {
949
- toggleAllColumnsVisible(true);
950
- setAnchorEl(null);
951
- };
952
- const handleOpenFilterModeMenu = (event) => {
953
- event.stopPropagation();
954
- setFilterMenuAnchorEl(event.currentTarget);
955
- };
956
- const isSelectFilter = !!columnDef.filterSelectOptions;
957
- const allowedColumnFilterOptions = (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _b !== void 0 ? _b : columnFilterModeOptions;
958
- const showFilterModeSubMenu = enableColumnFilterModes &&
959
- columnDef.enableColumnFilterModes !== false &&
960
- !isSelectFilter &&
961
- (allowedColumnFilterOptions === undefined ||
962
- !!(allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.length));
963
- const internalColumnMenuItems = [
964
- ...(enableSorting && column.getCanSort()
965
- ? [
966
- enableSortingRemoval !== false && (jsxRuntime.jsx(MenuItem__default["default"], { disabled: !column.getIsSorted(), onClick: handleClearSort, sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(ClearAllIcon, {}) }), localization.clearSort] }) }, 0)),
967
- jsxRuntime.jsx(MenuItem__default["default"], { disabled: column.getIsSorted() === 'asc', onClick: handleSortAsc, sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(SortIcon, { style: { transform: 'rotate(180deg) scaleX(-1)' } }) }), (_c = localization.sortByColumnAsc) === null || _c === void 0 ? void 0 : _c.replace('{column}', String(columnDef.header))] }) }, 1),
968
- jsxRuntime.jsx(MenuItem__default["default"], { disabled: column.getIsSorted() === 'desc', divider: enableColumnFilters || enableGrouping || enableHiding, onClick: handleSortDesc, sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(SortIcon, {}) }), (_d = localization.sortByColumnDesc) === null || _d === void 0 ? void 0 : _d.replace('{column}', String(columnDef.header))] }) }, 2),
969
- ]
970
- : []),
971
- ...(enableColumnFilters && column.getCanFilter()
972
- ? [
973
- jsxRuntime.jsx(MenuItem__default["default"], { disabled: !columnFilterValue ||
974
- (Array.isArray(columnFilterValue) &&
975
- !columnFilterValue.filter((value) => value).length), onClick: handleClearFilter, sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(FilterListOffIcon, {}) }), localization.clearFilter] }) }, 3),
976
- columnFilterDisplayMode === 'subheader' && (jsxRuntime.jsxs(MenuItem__default["default"], { disabled: showColumnFilters && !enableColumnFilterModes, divider: enableGrouping || enableHiding, onClick: showColumnFilters
977
- ? handleOpenFilterModeMenu
978
- : handleFilterByColumn, sx: commonMenuItemStyles, children: [jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(FilterListIcon, {}) }), (_e = localization.filterByColumn) === null || _e === void 0 ? void 0 : _e.replace('{column}', String(columnDef.header))] }), showFilterModeSubMenu && (jsxRuntime.jsx(IconButton__default["default"], { onClick: handleOpenFilterModeMenu, onMouseEnter: handleOpenFilterModeMenu, size: "small", sx: { p: 0 }, children: jsxRuntime.jsx(ArrowRightIcon, {}) }))] }, 4)),
979
- showFilterModeSubMenu && (jsxRuntime.jsx(MRT_FilterOptionMenu, { anchorEl: filterMenuAnchorEl, header: header, onSelect: handleFilterByColumn, setAnchorEl: setFilterMenuAnchorEl, table: table }, 5)),
980
- ].filter(Boolean)
981
- : []),
982
- ...(enableGrouping && column.getCanGroup()
983
- ? [
984
- jsxRuntime.jsx(MenuItem__default["default"], { divider: enableColumnPinning, onClick: handleGroupByColumn, sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(DynamicFeedIcon, {}) }), (_f = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) === null || _f === void 0 ? void 0 : _f.replace('{column}', String(columnDef.header))] }) }, 6),
985
- ]
986
- : []),
987
- ...(enableColumnPinning && column.getCanPin()
988
- ? [
989
- jsxRuntime.jsx(MenuItem__default["default"], { disabled: column.getIsPinned() === 'left' || !column.getCanPin(), onClick: () => handlePinColumn('left'), sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(PushPinIcon, { style: { transform: 'rotate(90deg)' } }) }), localization.pinToLeft] }) }, 7),
990
- jsxRuntime.jsx(MenuItem__default["default"], { disabled: column.getIsPinned() === 'right' || !column.getCanPin(), onClick: () => handlePinColumn('right'), sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(PushPinIcon, { style: { transform: 'rotate(-90deg)' } }) }), localization.pinToRight] }) }, 8),
991
- jsxRuntime.jsx(MenuItem__default["default"], { disabled: !column.getIsPinned(), divider: enableHiding, onClick: () => handlePinColumn(false), sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(PushPinIcon, {}) }), localization.unpin] }) }, 9),
992
- ]
993
- : []),
994
- ...(enableColumnResizing && column.getCanResize()
995
- ? [
996
- jsxRuntime.jsx(MenuItem__default["default"], { disabled: !columnSizing[column.id], onClick: handleResetColumnSize, sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(RestartAltIcon, {}) }), localization.resetColumnSize] }) }, 10),
997
- ]
998
- : []),
999
- ...(enableHiding
1000
- ? [
1001
- jsxRuntime.jsx(MenuItem__default["default"], { disabled: !column.getCanHide(), onClick: handleHideColumn, sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(VisibilityOffIcon, {}) }), (_g = localization.hideColumn) === null || _g === void 0 ? void 0 : _g.replace('{column}', String(columnDef.header))] }) }, 11),
1002
- jsxRuntime.jsx(MenuItem__default["default"], { disabled: !Object.values(columnVisibility).filter((visible) => !visible)
1003
- .length, onClick: handleShowAllColumns, sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(ViewColumnIcon, {}) }), (_h = localization.showAllColumns) === null || _h === void 0 ? void 0 : _h.replace('{column}', String(columnDef.header))] }) }, 12),
1004
- ]
1005
- : []),
1006
- ].filter(Boolean);
1007
- const theme = styles.useTheme();
1008
- const { menuBackgroundColor } = getMRTTheme(table, theme);
1009
- return (jsxRuntime.jsx(Menu__default["default"], Object.assign({ MenuListProps: {
1010
- dense: density === 'compact',
1011
- sx: {
1012
- backgroundColor: menuBackgroundColor,
1013
- },
1014
- }, anchorEl: anchorEl, disableScrollLock: true, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: (_l = (_k = (_j = columnDef.renderColumnActionsMenuItems) === null || _j === void 0 ? void 0 : _j.call(columnDef, {
1015
- closeMenu: () => setAnchorEl(null),
1016
- column,
1017
- internalColumnMenuItems,
1018
- table,
1019
- })) !== null && _k !== void 0 ? _k : renderColumnActionsMenuItems === null || renderColumnActionsMenuItems === void 0 ? void 0 : renderColumnActionsMenuItems({
1020
- closeMenu: () => setAnchorEl(null),
1021
- column,
1022
- internalColumnMenuItems,
1023
- table,
1024
- })) !== null && _l !== void 0 ? _l : internalColumnMenuItems })));
1025
- };
1026
-
1027
- const MRT_RowActionMenu = (_a) => {
1028
- var { anchorEl, handleEdit, row, setAnchorEl, staticRowIndex, table } = _a, rest = __rest(_a, ["anchorEl", "handleEdit", "row", "setAnchorEl", "staticRowIndex", "table"]);
1029
- const { getState, options: { editDisplayMode, enableEditing, icons: { EditIcon }, localization, renderRowActionMenuItems, }, } = table;
1030
- const { density } = getState();
1031
- const theme = styles.useTheme();
1032
- const { menuBackgroundColor } = getMRTTheme(table, theme);
1033
- return (jsxRuntime.jsxs(Menu__default["default"], Object.assign({ MenuListProps: {
1034
- dense: density === 'compact',
1035
- sx: {
1036
- backgroundColor: menuBackgroundColor,
1037
- },
1038
- }, anchorEl: anchorEl, disableScrollLock: true, onClick: (event) => event.stopPropagation(), onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: [parseFromValuesOrFunc(enableEditing, row) &&
1039
- ['modal', 'row'].includes(editDisplayMode) && (jsxRuntime.jsx(MenuItem__default["default"], { onClick: handleEdit, sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(EditIcon, {}) }), localization.edit] }) })), renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 : renderRowActionMenuItems({
1040
- closeMenu: () => setAnchorEl(null),
1041
- row,
1042
- staticRowIndex,
1043
- table,
1044
- })] })));
1045
- };
1046
-
1047
- const commonIconButtonStyles = {
1048
- '&:hover': {
1049
- opacity: 1,
792
+ const MRT_ActionMenuItem = (_a) => {
793
+ var { icon, label, onOpenSubMenu, table } = _a, rest = __rest(_a, ["icon", "label", "onOpenSubMenu", "table"]);
794
+ const { options: { icons: { ArrowRightIcon }, }, } = table;
795
+ return (jsxRuntime.jsxs(MenuItem__default["default"], Object.assign({ sx: {
796
+ alignItems: 'center',
797
+ justifyContent: 'space-between',
798
+ minWidth: '120px',
799
+ my: 0,
800
+ py: '6px',
801
+ } }, rest, { children: [jsxRuntime.jsxs(Box__default["default"], { sx: {
802
+ alignItems: 'center',
803
+ display: 'flex',
804
+ }, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: icon }), label] }), onOpenSubMenu && (jsxRuntime.jsx(IconButton__default["default"], { onClick: onOpenSubMenu, onMouseEnter: onOpenSubMenu, size: "small", sx: { p: 0 }, children: jsxRuntime.jsx(ArrowRightIcon, {}) }))] })));
805
+ };
806
+
807
+ const MRT_RowActionMenu = (_a) => {
808
+ var { anchorEl, handleEdit, row, setAnchorEl, staticRowIndex, table } = _a, rest = __rest(_a, ["anchorEl", "handleEdit", "row", "setAnchorEl", "staticRowIndex", "table"]);
809
+ const { getState, options: { editDisplayMode, enableEditing, icons: { EditIcon }, localization, renderRowActionMenuItems, }, } = table;
810
+ const { density } = getState();
811
+ const theme = styles.useTheme();
812
+ const { menuBackgroundColor } = getMRTTheme(table, theme);
813
+ return (jsxRuntime.jsxs(Menu__default["default"], Object.assign({ MenuListProps: {
814
+ dense: density === 'compact',
815
+ sx: {
816
+ backgroundColor: menuBackgroundColor,
817
+ },
818
+ }, anchorEl: anchorEl, disableScrollLock: true, onClick: (event) => event.stopPropagation(), onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: [parseFromValuesOrFunc(enableEditing, row) &&
819
+ ['modal', 'row'].includes(editDisplayMode) && (jsxRuntime.jsx(MRT_ActionMenuItem, { icon: jsxRuntime.jsx(EditIcon, {}), label: localization.edit, onClick: handleEdit, table: table })), renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 : renderRowActionMenuItems({
820
+ closeMenu: () => setAnchorEl(null),
821
+ row,
822
+ staticRowIndex,
823
+ table,
824
+ })] })));
825
+ };
826
+
827
+ const commonIconButtonStyles = {
828
+ '&:hover': {
829
+ opacity: 1,
1050
830
  },
1051
831
  height: '2rem',
1052
832
  ml: '10px',
@@ -1079,9 +859,6 @@ const MRT_ToggleRowActionMenuButton = (_a) => {
1079
859
  };
1080
860
 
1081
861
  const getMRT_RowActionsColumnDef = (tableOptions) => {
1082
- if (!showRowActionsColumn(tableOptions)) {
1083
- return null;
1084
- }
1085
862
  return Object.assign({ Cell: ({ cell, row, staticRowIndex, table }) => (jsxRuntime.jsx(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, staticRowIndex: staticRowIndex, table: table })) }, defaultDisplayColumnProps({
1086
863
  header: 'actions',
1087
864
  id: 'mrt-row-actions',
@@ -1092,19 +869,18 @@ const getMRT_RowActionsColumnDef = (tableOptions) => {
1092
869
 
1093
870
  const MRT_GrabHandleButton = (_a) => {
1094
871
  var _b, _c;
1095
- var { iconButtonProps, location, onDragEnd, onDragStart, table } = _a, rest = __rest(_a, ["iconButtonProps", "location", "onDragEnd", "onDragStart", "table"]);
872
+ var { location, table } = _a, rest = __rest(_a, ["location", "table"]);
1096
873
  const { options: { icons: { DragHandleIcon }, localization, }, } = table;
1097
- const _iconButtonProps = Object.assign(Object.assign({}, iconButtonProps), rest);
1098
- return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, getCommonTooltipProps('top'), { title: (_b = _iconButtonProps === null || _iconButtonProps === void 0 ? void 0 : _iconButtonProps.title) !== null && _b !== void 0 ? _b : localization.move, children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": (_c = _iconButtonProps.title) !== null && _c !== void 0 ? _c : localization.move, disableRipple: true, draggable: "true", size: "small" }, _iconButtonProps, { onClick: (e) => {
874
+ return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, getCommonTooltipProps('top'), { title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.move, children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": (_c = rest.title) !== null && _c !== void 0 ? _c : localization.move, disableRipple: true, draggable: "true", size: "small" }, rest, { onClick: (e) => {
1099
875
  var _a;
1100
876
  e.stopPropagation();
1101
- (_a = _iconButtonProps === null || _iconButtonProps === void 0 ? void 0 : _iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(_iconButtonProps, e);
1102
- }, onDragEnd: onDragEnd, onDragStart: onDragStart, sx: (theme) => (Object.assign({ '&:active': {
877
+ (_a = rest === null || rest === void 0 ? void 0 : rest.onClick) === null || _a === void 0 ? void 0 : _a.call(rest, e);
878
+ }, sx: (theme) => (Object.assign({ '&:active': {
1103
879
  cursor: 'grabbing',
1104
880
  }, '&:hover': {
1105
881
  backgroundColor: 'transparent',
1106
882
  opacity: 1,
1107
- }, cursor: 'grab', m: '0 -0.1rem', opacity: location === 'row' ? 1 : 0.3, p: '2px', transition: 'all 150ms ease-in-out' }, parseFromValuesOrFunc(_iconButtonProps === null || _iconButtonProps === void 0 ? void 0 : _iconButtonProps.sx, theme))), title: undefined, children: jsxRuntime.jsx(DragHandleIcon, {}) })) })));
883
+ }, cursor: 'grab', m: '0 -0.1rem', opacity: location === 'row' ? 1 : 0.5, p: '2px', transition: 'all 150ms ease-in-out' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), title: undefined, children: jsxRuntime.jsx(DragHandleIcon, {}) })) })));
1108
884
  };
1109
885
 
1110
886
  const MRT_TableBodyRowGrabHandle = (_a) => {
@@ -1131,13 +907,10 @@ const MRT_TableBodyRowGrabHandle = (_a) => {
1131
907
  table.setDraggingRow(null);
1132
908
  table.setHoveredRow(null);
1133
909
  };
1134
- return (jsxRuntime.jsx(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, location: "row", onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table }));
910
+ return (jsxRuntime.jsx(MRT_GrabHandleButton, Object.assign({}, iconButtonProps, { location: "row", onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })));
1135
911
  };
1136
912
 
1137
913
  const getMRT_RowDragColumnDef = (tableOptions) => {
1138
- if (!showRowDragColumn(tableOptions)) {
1139
- return null;
1140
- }
1141
914
  return Object.assign({ Cell: ({ row, rowRef, table }) => (jsxRuntime.jsx(MRT_TableBodyRowGrabHandle, { row: row, rowRef: rowRef, table: table })), grow: false }, defaultDisplayColumnProps({
1142
915
  header: 'move',
1143
916
  id: 'mrt-row-drag',
@@ -1197,9 +970,6 @@ const MRT_ExpandButton = ({ row, staticRowIndex, table, }) => {
1197
970
 
1198
971
  const getMRT_RowExpandColumnDef = (tableOptions) => {
1199
972
  var _a;
1200
- if (!showRowExpandColumn(tableOptions)) {
1201
- return null;
1202
- }
1203
973
  const { defaultColumn, enableExpandAll, groupedColumnMode, positionExpandColumn, renderDetailPanel, state: { grouping }, } = tableOptions;
1204
974
  const alignProps = positionExpandColumn === 'last'
1205
975
  ? {
@@ -1237,9 +1007,6 @@ const getMRT_RowExpandColumnDef = (tableOptions) => {
1237
1007
  };
1238
1008
 
1239
1009
  const getMRT_RowNumbersColumnDef = (tableOptions) => {
1240
- if (!showRowNumbersColumn(tableOptions)) {
1241
- return null;
1242
- }
1243
1010
  const { localization, rowNumberDisplayMode } = tableOptions;
1244
1011
  const { pagination: { pageIndex, pageSize }, } = tableOptions.state;
1245
1012
  return Object.assign({ Cell: ({ row, staticRowIndex }) => {
@@ -1293,9 +1060,6 @@ const MRT_TableBodyRowPinButton = (_a) => {
1293
1060
  };
1294
1061
 
1295
1062
  const getMRT_RowPinningColumnDef = (tableOptions) => {
1296
- if (!showRowPinningColumn(tableOptions)) {
1297
- return null;
1298
- }
1299
1063
  return Object.assign({ Cell: ({ row, table }) => (jsxRuntime.jsx(MRT_TableBodyRowPinButton, { row: row, table: table })), grow: false }, defaultDisplayColumnProps({
1300
1064
  header: 'pin',
1301
1065
  id: 'mrt-row-pin',
@@ -1307,36 +1071,25 @@ const getMRT_RowPinningColumnDef = (tableOptions) => {
1307
1071
  const MRT_SelectCheckbox = (_a) => {
1308
1072
  var _b;
1309
1073
  var { row, staticRowIndex, table } = _a, rest = __rest(_a, ["row", "staticRowIndex", "table"]);
1310
- const { getState, options: { enableMultiRowSelection, enableRowPinning, localization, muiSelectAllCheckboxProps, muiSelectCheckboxProps, rowPinningDisplayMode, selectAllMode, }, } = table;
1074
+ const { getState, options: { enableMultiRowSelection, enableRowPinning, localization, muiSelectAllCheckboxProps, muiSelectCheckboxProps, rowPinningDisplayMode, selectAllMode, }, refs: { lastSelectedRowId }, } = table;
1311
1075
  const { density, isLoading } = getState();
1312
1076
  const selectAll = !row;
1313
- const checkboxProps = Object.assign(Object.assign({}, (!row
1314
- ? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
1315
- : parseFromValuesOrFunc(muiSelectCheckboxProps, {
1316
- row,
1317
- staticRowIndex,
1318
- table,
1319
- }))), rest);
1320
1077
  const isStickySelection = enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('select'));
1321
1078
  const allRowsSelected = selectAll
1322
1079
  ? selectAllMode === 'page'
1323
1080
  ? table.getIsAllPageRowsSelected()
1324
1081
  : table.getIsAllRowsSelected()
1325
1082
  : undefined;
1326
- const onSelectionChange = (event, row) => {
1327
- var _a;
1328
- if (row.getIsAllSubRowsSelected() && row.getCanSelectSubRows()) {
1329
- (_a = row.subRows) === null || _a === void 0 ? void 0 : _a.forEach((r) => r.toggleSelected(false));
1330
- }
1331
- row.getToggleSelectedHandler()(event);
1332
- if (isStickySelection) {
1333
- row.pin(!row.getIsPinned() && event.target.checked
1334
- ? (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('bottom'))
1335
- ? 'bottom'
1336
- : 'top'
1337
- : false);
1338
- }
1339
- };
1083
+ const isChecked = selectAll
1084
+ ? allRowsSelected
1085
+ : getIsRowSelected({ row, table });
1086
+ const checkboxProps = Object.assign(Object.assign({}, (selectAll
1087
+ ? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
1088
+ : parseFromValuesOrFunc(muiSelectCheckboxProps, {
1089
+ row,
1090
+ table,
1091
+ }))), rest);
1092
+ const onSelectionChange = getMRT_RowSelectionHandler();
1340
1093
  const onSelectAllChange = (event) => {
1341
1094
  selectAllMode === 'all'
1342
1095
  ? table.getToggleAllRowsSelectedHandler()(event)
@@ -1344,16 +1097,19 @@ const MRT_SelectCheckbox = (_a) => {
1344
1097
  if (isStickySelection) {
1345
1098
  table.setRowPinning({ bottom: [], top: [] });
1346
1099
  }
1100
+ lastSelectedRowId.current = null;
1347
1101
  };
1348
1102
  const commonProps = Object.assign(Object.assign({ 'aria-label': selectAll
1349
1103
  ? localization.toggleSelectAll
1350
- : localization.toggleSelectRow, checked: selectAll ? allRowsSelected : getIsRowSelected({ row, table }), disabled: isLoading || (row && !row.getCanSelect()) || (row === null || row === void 0 ? void 0 : row.id) === 'mrt-row-create', inputProps: {
1104
+ : localization.toggleSelectRow, checked: isChecked, disabled: isLoading || (row && !row.getCanSelect()) || (row === null || row === void 0 ? void 0 : row.id) === 'mrt-row-create', inputProps: {
1351
1105
  'aria-label': selectAll
1352
1106
  ? localization.toggleSelectAll
1353
1107
  : localization.toggleSelectRow,
1354
1108
  }, onChange: (event) => {
1355
1109
  event.stopPropagation();
1356
- row ? onSelectionChange(event, row) : onSelectAllChange(event);
1110
+ row
1111
+ ? onSelectionChange({ event, row, staticRowIndex, table })
1112
+ : onSelectAllChange(event);
1357
1113
  }, size: (density === 'compact' ? 'small' : 'medium') }, checkboxProps), { onClick: (e) => {
1358
1114
  var _a;
1359
1115
  e.stopPropagation();
@@ -1367,9 +1123,6 @@ const MRT_SelectCheckbox = (_a) => {
1367
1123
  };
1368
1124
 
1369
1125
  const getMRT_RowSelectColumnDef = (tableOptions) => {
1370
- if (!showRowSelectionColumn(tableOptions)) {
1371
- return null;
1372
- }
1373
1126
  const { enableMultiRowSelection, enableSelectAll } = tableOptions;
1374
1127
  return Object.assign({ Cell: ({ row, staticRowIndex, table }) => (jsxRuntime.jsx(MRT_SelectCheckbox, { row: row, staticRowIndex: staticRowIndex, table: table })), Header: enableSelectAll && enableMultiRowSelection
1375
1128
  ? ({ table }) => jsxRuntime.jsx(MRT_SelectCheckbox, { table: table })
@@ -1389,6 +1142,7 @@ const MRT_Default_Icons = {
1389
1142
  ChevronRightIcon: ChevronRightIcon__default["default"],
1390
1143
  ClearAllIcon: ClearAllIcon__default["default"],
1391
1144
  CloseIcon: CloseIcon__default["default"],
1145
+ ContentCopy: ContentCopy__default["default"],
1392
1146
  DensityLargeIcon: DensityLargeIcon__default["default"],
1393
1147
  DensityMediumIcon: DensityMediumIcon__default["default"],
1394
1148
  DensitySmallIcon: DensitySmallIcon__default["default"],
@@ -1425,8 +1179,10 @@ const MRT_Localization_EN = {
1425
1179
  changeSearchMode: 'Change search mode',
1426
1180
  clearFilter: 'Clear filter',
1427
1181
  clearSearch: 'Clear search',
1182
+ clearSelection: 'Clear selection',
1428
1183
  clearSort: 'Clear sort',
1429
1184
  clickToCopy: 'Click to copy',
1185
+ copy: 'Copy',
1430
1186
  collapse: 'Collapse',
1431
1187
  collapseAll: 'Collapse all',
1432
1188
  columnActions: 'Column Actions',
@@ -1531,7 +1287,7 @@ const MRT_DefaultDisplayColumn = {
1531
1287
  };
1532
1288
  const useMRT_TableOptions = (_a) => {
1533
1289
  var _b;
1534
- var { aggregationFns, autoResetExpanded = false, columnFilterDisplayMode = 'subheader', columnResizeDirection, columnResizeMode = 'onChange', createDisplayMode = 'modal', defaultColumn, defaultDisplayColumn, editDisplayMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnPinning = false, enableColumnResizing = false, enableColumnVirtualization, enableDensityToggle = true, enableExpandAll = true, enableExpanding, enableFacetedValues = false, enableFilterMatchHighlighting = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enableRowPinning = false, enableRowSelection = false, enableRowVirtualization, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, layoutMode, localization, manualFiltering, manualGrouping, manualPagination, manualSorting, paginationDisplayMode = 'default', positionActionsColumn = 'first', positionCreatingRow = 'top', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberDisplayMode = 'static', rowPinningDisplayMode = 'sticky', selectAllMode = 'page', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnFilterDisplayMode", "columnResizeDirection", "columnResizeMode", "createDisplayMode", "defaultColumn", "defaultDisplayColumn", "editDisplayMode", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnPinning", "enableColumnResizing", "enableColumnVirtualization", "enableDensityToggle", "enableExpandAll", "enableExpanding", "enableFacetedValues", "enableFilterMatchHighlighting", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enableRowPinning", "enableRowSelection", "enableRowVirtualization", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "paginationDisplayMode", "positionActionsColumn", "positionCreatingRow", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberDisplayMode", "rowPinningDisplayMode", "selectAllMode", "sortingFns"]);
1290
+ var { aggregationFns, autoResetExpanded = false, columnFilterDisplayMode = 'subheader', columnResizeDirection, columnResizeMode = 'onChange', createDisplayMode = 'modal', defaultColumn, defaultDisplayColumn, editDisplayMode = 'modal', enableBatchRowSelection = true, enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnPinning = false, enableColumnResizing = false, enableColumnVirtualization, enableDensityToggle = true, enableExpandAll = true, enableExpanding, enableFacetedValues = false, enableFilterMatchHighlighting = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enableRowPinning = false, enableRowSelection = false, enableRowVirtualization, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, layoutMode, localization, manualFiltering, manualGrouping, manualPagination, manualSorting, paginationDisplayMode = 'default', positionActionsColumn = 'first', positionCreatingRow = 'top', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberDisplayMode = 'static', rowPinningDisplayMode = 'sticky', selectAllMode = 'page', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnFilterDisplayMode", "columnResizeDirection", "columnResizeMode", "createDisplayMode", "defaultColumn", "defaultDisplayColumn", "editDisplayMode", "enableBatchRowSelection", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnPinning", "enableColumnResizing", "enableColumnVirtualization", "enableDensityToggle", "enableExpandAll", "enableExpanding", "enableFacetedValues", "enableFilterMatchHighlighting", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enableRowPinning", "enableRowSelection", "enableRowVirtualization", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "paginationDisplayMode", "positionActionsColumn", "positionCreatingRow", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberDisplayMode", "rowPinningDisplayMode", "selectAllMode", "sortingFns"]);
1535
1291
  const theme = styles.useTheme();
1536
1292
  icons = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
1537
1293
  localization = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
@@ -1572,6 +1328,7 @@ const useMRT_TableOptions = (_a) => {
1572
1328
  defaultColumn,
1573
1329
  defaultDisplayColumn,
1574
1330
  editDisplayMode,
1331
+ enableBatchRowSelection,
1575
1332
  enableBottomToolbar,
1576
1333
  enableColumnActions,
1577
1334
  enableColumnFilters,
@@ -1641,9 +1398,6 @@ const blankColProps = {
1641
1398
  },
1642
1399
  };
1643
1400
  const getMRT_RowSpacerColumnDef = (tableOptions) => {
1644
- if (!showRowSpacerColumn(tableOptions)) {
1645
- return null;
1646
- }
1647
1401
  return Object.assign(Object.assign(Object.assign(Object.assign({}, defaultDisplayColumnProps({
1648
1402
  id: 'mrt-row-spacer',
1649
1403
  size: 0,
@@ -1651,24 +1405,12 @@ const getMRT_RowSpacerColumnDef = (tableOptions) => {
1651
1405
  })), { grow: true }), MRT_DefaultDisplayColumn), { muiTableBodyCellProps: blankColProps, muiTableFooterCellProps: blankColProps, muiTableHeadCellProps: blankColProps });
1652
1406
  };
1653
1407
 
1654
- const getMRT_DisplayColumns = (tableOptions) => {
1655
- return [
1656
- getMRT_RowNumbersColumnDef(tableOptions),
1657
- getMRT_RowSelectColumnDef(tableOptions),
1658
- getMRT_RowExpandColumnDef(tableOptions),
1659
- getMRT_RowActionsColumnDef(tableOptions),
1660
- getMRT_RowDragColumnDef(tableOptions),
1661
- getMRT_RowPinningColumnDef(tableOptions),
1662
- getMRT_RowSpacerColumnDef(tableOptions),
1663
- ].filter(Boolean);
1664
- };
1665
-
1666
1408
  const useMRT_Effects = (table) => {
1667
1409
  const { getIsSomeRowsPinned, getPrePaginationRowModel, getState, options: { enablePagination, enableRowPinning, rowCount }, } = table;
1668
- const { density, globalFilter, isFullScreen, isLoading, pagination, showSkeletons, sorting, } = getState();
1410
+ const { columnOrder, density, globalFilter, isFullScreen, isLoading, pagination, showSkeletons, sorting, } = getState();
1411
+ const totalColumnCount = table.options.columns.length;
1669
1412
  const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
1670
1413
  const rerender = react.useReducer(() => ({}), {})[1];
1671
- const isMounted = react.useRef(false);
1672
1414
  const initialBodyHeight = react.useRef();
1673
1415
  const previousTop = react.useRef();
1674
1416
  react.useEffect(() => {
@@ -1676,11 +1418,12 @@ const useMRT_Effects = (table) => {
1676
1418
  initialBodyHeight.current = document.body.style.height;
1677
1419
  }
1678
1420
  }, []);
1421
+ //hide scrollbars when table is in full screen mode, preserve body scroll position after full screen exit
1679
1422
  react.useEffect(() => {
1680
- if (isMounted && typeof window !== 'undefined') {
1423
+ if (typeof window !== 'undefined') {
1681
1424
  if (isFullScreen) {
1682
1425
  previousTop.current = document.body.getBoundingClientRect().top; //save scroll position
1683
- document.body.style.height = '100vh'; //hide page scrollbars when table is in full screen mode
1426
+ document.body.style.height = '100dvh'; //hide page scrollbars when table is in full screen mode
1684
1427
  }
1685
1428
  else {
1686
1429
  document.body.style.height = initialBodyHeight.current;
@@ -1693,8 +1436,13 @@ const useMRT_Effects = (table) => {
1693
1436
  });
1694
1437
  }
1695
1438
  }
1696
- isMounted.current = true;
1697
1439
  }, [isFullScreen]);
1440
+ //recalculate column order when columns change or features are toggled on/off
1441
+ react.useEffect(() => {
1442
+ if (totalColumnCount !== columnOrder.length) {
1443
+ table.setColumnOrder(getDefaultColumnOrderIds(table.options));
1444
+ }
1445
+ }, [totalColumnCount]);
1698
1446
  //if page index is out of bounds, set it to the last page
1699
1447
  react.useEffect(() => {
1700
1448
  if (!enablePagination || isLoading || showSkeletons)
@@ -1722,6 +1470,7 @@ const useMRT_Effects = (table) => {
1722
1470
  table.setSorting(() => appliedSort.current || []);
1723
1471
  }
1724
1472
  }, [globalFilter]);
1473
+ //fix pinned row top style when density changes
1725
1474
  react.useEffect(() => {
1726
1475
  if (enableRowPinning && getIsSomeRowsPinned()) {
1727
1476
  setTimeout(() => {
@@ -1731,8 +1480,15 @@ const useMRT_Effects = (table) => {
1731
1480
  }, [density]);
1732
1481
  };
1733
1482
 
1734
- const useMRT_TableInstance = (_tableOptions) => {
1735
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
1483
+ /**
1484
+ * The MRT hook that wraps the TanStack useReactTable hook and adds additional functionality
1485
+ * @param definedTableOptions - table options with proper defaults set
1486
+ * @returns the MRT table instance
1487
+ */
1488
+ const useMRT_TableInstance = (definedTableOptions) => {
1489
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
1490
+ const lastSelectedRowId = react.useRef(null);
1491
+ const actionCellRef = react.useRef(null);
1736
1492
  const bottomToolbarRef = react.useRef(null);
1737
1493
  const editInputRefs = react.useRef({});
1738
1494
  const filterInputRefs = react.useRef({});
@@ -1743,17 +1499,19 @@ const useMRT_TableInstance = (_tableOptions) => {
1743
1499
  const topToolbarRef = react.useRef(null);
1744
1500
  const tableHeadRef = react.useRef(null);
1745
1501
  const tableFooterRef = react.useRef(null);
1502
+ //transform initial state with proper column order
1746
1503
  const initialState = react.useMemo(() => {
1747
1504
  var _a, _b, _c;
1748
- const initState = (_a = _tableOptions.initialState) !== null && _a !== void 0 ? _a : {};
1505
+ const initState = (_a = definedTableOptions.initialState) !== null && _a !== void 0 ? _a : {};
1749
1506
  initState.columnOrder =
1750
- (_b = initState.columnOrder) !== null && _b !== void 0 ? _b : getDefaultColumnOrderIds(Object.assign(Object.assign({}, _tableOptions), { state: Object.assign(Object.assign({}, _tableOptions.initialState), _tableOptions.state) }));
1751
- initState.globalFilterFn = (_c = _tableOptions.globalFilterFn) !== null && _c !== void 0 ? _c : 'fuzzy';
1507
+ (_b = initState.columnOrder) !== null && _b !== void 0 ? _b : getDefaultColumnOrderIds(Object.assign(Object.assign({}, definedTableOptions), { state: Object.assign(Object.assign({}, definedTableOptions.initialState), definedTableOptions.state) }));
1508
+ initState.globalFilterFn = (_c = definedTableOptions.globalFilterFn) !== null && _c !== void 0 ? _c : 'fuzzy';
1752
1509
  return initState;
1753
1510
  }, []);
1754
- _tableOptions.initialState = initialState;
1755
- const [creatingRow, _setCreatingRow] = react.useState((_a = initialState.creatingRow) !== null && _a !== void 0 ? _a : null);
1756
- const [columnFilterFns, setColumnFilterFns] = react.useState(() => Object.assign({}, ...getAllLeafColumnDefs(_tableOptions.columns).map((col) => {
1511
+ definedTableOptions.initialState = initialState;
1512
+ const [actionCell, setActionCell] = react.useState((_a = initialState.actionCell) !== null && _a !== void 0 ? _a : null);
1513
+ const [creatingRow, _setCreatingRow] = react.useState((_b = initialState.creatingRow) !== null && _b !== void 0 ? _b : null);
1514
+ const [columnFilterFns, setColumnFilterFns] = react.useState(() => Object.assign({}, ...getAllLeafColumnDefs(definedTableOptions.columns).map((col) => {
1757
1515
  var _a, _b, _c, _d;
1758
1516
  return ({
1759
1517
  [getColumnId(col)]: col.filterFn instanceof Function
@@ -1761,24 +1519,25 @@ const useMRT_TableInstance = (_tableOptions) => {
1761
1519
  : (_d = (_b = col.filterFn) !== null && _b !== void 0 ? _b : (_c = initialState === null || initialState === void 0 ? void 0 : initialState.columnFilterFns) === null || _c === void 0 ? void 0 : _c[getColumnId(col)]) !== null && _d !== void 0 ? _d : getDefaultColumnFilterFn(col),
1762
1520
  });
1763
1521
  })));
1764
- const [columnOrder, onColumnOrderChange] = react.useState((_b = initialState.columnOrder) !== null && _b !== void 0 ? _b : []);
1765
- const [columnSizingInfo, onColumnSizingInfoChange] = react.useState((_c = initialState.columnSizingInfo) !== null && _c !== void 0 ? _c : {});
1766
- const [density, setDensity] = react.useState((_d = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _d !== void 0 ? _d : 'comfortable');
1767
- const [draggingColumn, setDraggingColumn] = react.useState((_e = initialState.draggingColumn) !== null && _e !== void 0 ? _e : null);
1768
- const [draggingRow, setDraggingRow] = react.useState((_f = initialState.draggingRow) !== null && _f !== void 0 ? _f : null);
1769
- const [editingCell, setEditingCell] = react.useState((_g = initialState.editingCell) !== null && _g !== void 0 ? _g : null);
1770
- const [editingRow, setEditingRow] = react.useState((_h = initialState.editingRow) !== null && _h !== void 0 ? _h : null);
1771
- const [globalFilterFn, setGlobalFilterFn] = react.useState((_j = initialState.globalFilterFn) !== null && _j !== void 0 ? _j : 'fuzzy');
1772
- const [grouping, onGroupingChange] = react.useState((_k = initialState.grouping) !== null && _k !== void 0 ? _k : []);
1773
- const [hoveredColumn, setHoveredColumn] = react.useState((_l = initialState.hoveredColumn) !== null && _l !== void 0 ? _l : null);
1774
- const [hoveredRow, setHoveredRow] = react.useState((_m = initialState.hoveredRow) !== null && _m !== void 0 ? _m : null);
1775
- const [isFullScreen, setIsFullScreen] = react.useState((_o = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _o !== void 0 ? _o : false);
1776
- const [pagination, onPaginationChange] = react.useState((_p = initialState === null || initialState === void 0 ? void 0 : initialState.pagination) !== null && _p !== void 0 ? _p : { pageIndex: 0, pageSize: 10 });
1777
- const [showAlertBanner, setShowAlertBanner] = react.useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showAlertBanner) !== null && _q !== void 0 ? _q : false);
1778
- const [showColumnFilters, setShowColumnFilters] = react.useState((_r = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _r !== void 0 ? _r : false);
1779
- const [showGlobalFilter, setShowGlobalFilter] = react.useState((_s = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _s !== void 0 ? _s : false);
1780
- const [showToolbarDropZone, setShowToolbarDropZone] = react.useState((_t = initialState === null || initialState === void 0 ? void 0 : initialState.showToolbarDropZone) !== null && _t !== void 0 ? _t : false);
1781
- _tableOptions.state = Object.assign({ columnFilterFns,
1522
+ const [columnOrder, onColumnOrderChange] = react.useState((_c = initialState.columnOrder) !== null && _c !== void 0 ? _c : []);
1523
+ const [columnSizingInfo, onColumnSizingInfoChange] = react.useState((_d = initialState.columnSizingInfo) !== null && _d !== void 0 ? _d : {});
1524
+ const [density, setDensity] = react.useState((_e = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _e !== void 0 ? _e : 'comfortable');
1525
+ const [draggingColumn, setDraggingColumn] = react.useState((_f = initialState.draggingColumn) !== null && _f !== void 0 ? _f : null);
1526
+ const [draggingRow, setDraggingRow] = react.useState((_g = initialState.draggingRow) !== null && _g !== void 0 ? _g : null);
1527
+ const [editingCell, setEditingCell] = react.useState((_h = initialState.editingCell) !== null && _h !== void 0 ? _h : null);
1528
+ const [editingRow, setEditingRow] = react.useState((_j = initialState.editingRow) !== null && _j !== void 0 ? _j : null);
1529
+ const [globalFilterFn, setGlobalFilterFn] = react.useState((_k = initialState.globalFilterFn) !== null && _k !== void 0 ? _k : 'fuzzy');
1530
+ const [grouping, onGroupingChange] = react.useState((_l = initialState.grouping) !== null && _l !== void 0 ? _l : []);
1531
+ const [hoveredColumn, setHoveredColumn] = react.useState((_m = initialState.hoveredColumn) !== null && _m !== void 0 ? _m : null);
1532
+ const [hoveredRow, setHoveredRow] = react.useState((_o = initialState.hoveredRow) !== null && _o !== void 0 ? _o : null);
1533
+ const [isFullScreen, setIsFullScreen] = react.useState((_p = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _p !== void 0 ? _p : false);
1534
+ const [pagination, onPaginationChange] = react.useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.pagination) !== null && _q !== void 0 ? _q : { pageIndex: 0, pageSize: 10 });
1535
+ const [showAlertBanner, setShowAlertBanner] = react.useState((_r = initialState === null || initialState === void 0 ? void 0 : initialState.showAlertBanner) !== null && _r !== void 0 ? _r : false);
1536
+ const [showColumnFilters, setShowColumnFilters] = react.useState((_s = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _s !== void 0 ? _s : false);
1537
+ const [showGlobalFilter, setShowGlobalFilter] = react.useState((_t = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _t !== void 0 ? _t : false);
1538
+ const [showToolbarDropZone, setShowToolbarDropZone] = react.useState((_u = initialState === null || initialState === void 0 ? void 0 : initialState.showToolbarDropZone) !== null && _u !== void 0 ? _u : false);
1539
+ definedTableOptions.state = Object.assign({ actionCell,
1540
+ columnFilterFns,
1782
1541
  columnOrder,
1783
1542
  columnSizingInfo,
1784
1543
  creatingRow,
@@ -1796,90 +1555,111 @@ const useMRT_TableInstance = (_tableOptions) => {
1796
1555
  showAlertBanner,
1797
1556
  showColumnFilters,
1798
1557
  showGlobalFilter,
1799
- showToolbarDropZone }, _tableOptions.state);
1800
- const tableOptions = _tableOptions;
1558
+ showToolbarDropZone }, definedTableOptions.state);
1559
+ //The table options now include all state needed to help determine column visibility and order logic
1560
+ const statefulTableOptions = definedTableOptions;
1801
1561
  //don't recompute columnDefs while resizing column or dragging column/row
1802
1562
  const columnDefsRef = react.useRef([]);
1803
- tableOptions.columns =
1804
- tableOptions.state.columnSizingInfo.isResizingColumn ||
1805
- tableOptions.state.draggingColumn ||
1806
- tableOptions.state.draggingRow
1563
+ statefulTableOptions.columns =
1564
+ statefulTableOptions.state.columnSizingInfo.isResizingColumn ||
1565
+ statefulTableOptions.state.draggingColumn ||
1566
+ statefulTableOptions.state.draggingRow
1807
1567
  ? columnDefsRef.current
1808
1568
  : prepareColumns({
1809
1569
  columnDefs: [
1810
- ...getMRT_DisplayColumns(tableOptions),
1811
- ...tableOptions.columns,
1570
+ ...[
1571
+ showRowPinningColumn(statefulTableOptions) &&
1572
+ getMRT_RowPinningColumnDef(statefulTableOptions),
1573
+ showRowDragColumn(statefulTableOptions) &&
1574
+ getMRT_RowDragColumnDef(statefulTableOptions),
1575
+ showRowActionsColumn(statefulTableOptions) &&
1576
+ getMRT_RowActionsColumnDef(statefulTableOptions),
1577
+ showRowExpandColumn(statefulTableOptions) &&
1578
+ getMRT_RowExpandColumnDef(statefulTableOptions),
1579
+ showRowSelectionColumn(statefulTableOptions) &&
1580
+ getMRT_RowSelectColumnDef(statefulTableOptions),
1581
+ showRowNumbersColumn(statefulTableOptions) &&
1582
+ getMRT_RowNumbersColumnDef(statefulTableOptions),
1583
+ ].filter(Boolean),
1584
+ ...statefulTableOptions.columns,
1585
+ ...[
1586
+ showRowSpacerColumn(statefulTableOptions) &&
1587
+ getMRT_RowSpacerColumnDef(statefulTableOptions),
1588
+ ].filter(Boolean),
1812
1589
  ],
1813
- tableOptions,
1590
+ tableOptions: statefulTableOptions,
1814
1591
  });
1815
- columnDefsRef.current = tableOptions.columns;
1816
- tableOptions.data = react.useMemo(() => (tableOptions.state.isLoading || tableOptions.state.showSkeletons) &&
1817
- !tableOptions.data.length
1592
+ columnDefsRef.current = statefulTableOptions.columns;
1593
+ //if loading, generate blank rows to show skeleton loaders
1594
+ statefulTableOptions.data = react.useMemo(() => (statefulTableOptions.state.isLoading ||
1595
+ statefulTableOptions.state.showSkeletons) &&
1596
+ !statefulTableOptions.data.length
1818
1597
  ? [
1819
- ...Array(Math.min(tableOptions.state.pagination.pageSize, 20)).fill(null),
1820
- ].map(() => Object.assign({}, ...getAllLeafColumnDefs(tableOptions.columns).map((col) => ({
1598
+ ...Array(Math.min(statefulTableOptions.state.pagination.pageSize, 20)).fill(null),
1599
+ ].map(() => Object.assign({}, ...getAllLeafColumnDefs(statefulTableOptions.columns).map((col) => ({
1821
1600
  [getColumnId(col)]: null,
1822
1601
  }))))
1823
- : tableOptions.data, [
1824
- tableOptions.data,
1825
- tableOptions.state.isLoading,
1826
- tableOptions.state.showSkeletons,
1602
+ : statefulTableOptions.data, [
1603
+ statefulTableOptions.data,
1604
+ statefulTableOptions.state.isLoading,
1605
+ statefulTableOptions.state.showSkeletons,
1827
1606
  ]);
1828
1607
  //@ts-ignore
1829
1608
  const table = reactTable.useReactTable(Object.assign(Object.assign({ onColumnOrderChange,
1830
1609
  onColumnSizingInfoChange,
1831
1610
  onGroupingChange,
1832
- onPaginationChange }, tableOptions), { globalFilterFn: (_u = tableOptions.filterFns) === null || _u === void 0 ? void 0 : _u[globalFilterFn !== null && globalFilterFn !== void 0 ? globalFilterFn : 'fuzzy'] }));
1833
- //@ts-ignore
1611
+ onPaginationChange }, statefulTableOptions), { globalFilterFn: (_v = statefulTableOptions.filterFns) === null || _v === void 0 ? void 0 : _v[globalFilterFn !== null && globalFilterFn !== void 0 ? globalFilterFn : 'fuzzy'] }));
1834
1612
  table.refs = {
1835
- //@ts-ignore
1613
+ actionCellRef,
1836
1614
  bottomToolbarRef,
1837
1615
  editInputRefs,
1838
1616
  filterInputRefs,
1839
- //@ts-ignore
1617
+ lastSelectedRowId,
1840
1618
  searchInputRef,
1841
- //@ts-ignore
1842
1619
  tableContainerRef,
1843
- //@ts-ignore
1844
1620
  tableFooterRef,
1845
1621
  tableHeadCellRefs,
1846
- //@ts-ignore
1847
1622
  tableHeadRef,
1848
- //@ts-ignore
1849
1623
  tablePaperRef,
1850
- //@ts-ignore
1851
1624
  topToolbarRef,
1852
1625
  };
1626
+ table.setActionCell =
1627
+ (_w = statefulTableOptions.onActionCellChange) !== null && _w !== void 0 ? _w : setActionCell;
1853
1628
  table.setCreatingRow = (row) => {
1854
1629
  var _a, _b;
1855
1630
  let _row = row;
1856
1631
  if (row === true) {
1857
1632
  _row = createRow(table);
1858
1633
  }
1859
- (_b = (_a = tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.onCreatingRowChange) === null || _a === void 0 ? void 0 : _a.call(tableOptions, _row)) !== null && _b !== void 0 ? _b : _setCreatingRow(_row);
1634
+ (_b = (_a = statefulTableOptions === null || statefulTableOptions === void 0 ? void 0 : statefulTableOptions.onCreatingRowChange) === null || _a === void 0 ? void 0 : _a.call(statefulTableOptions, _row)) !== null && _b !== void 0 ? _b : _setCreatingRow(_row);
1860
1635
  };
1861
1636
  table.setColumnFilterFns =
1862
- (_v = tableOptions.onColumnFilterFnsChange) !== null && _v !== void 0 ? _v : setColumnFilterFns;
1863
- table.setDensity = (_w = tableOptions.onDensityChange) !== null && _w !== void 0 ? _w : setDensity;
1637
+ (_x = statefulTableOptions.onColumnFilterFnsChange) !== null && _x !== void 0 ? _x : setColumnFilterFns;
1638
+ table.setDensity = (_y = statefulTableOptions.onDensityChange) !== null && _y !== void 0 ? _y : setDensity;
1864
1639
  table.setDraggingColumn =
1865
- (_x = tableOptions.onDraggingColumnChange) !== null && _x !== void 0 ? _x : setDraggingColumn;
1866
- table.setDraggingRow = (_y = tableOptions.onDraggingRowChange) !== null && _y !== void 0 ? _y : setDraggingRow;
1867
- table.setEditingCell = (_z = tableOptions.onEditingCellChange) !== null && _z !== void 0 ? _z : setEditingCell;
1868
- table.setEditingRow = (_0 = tableOptions.onEditingRowChange) !== null && _0 !== void 0 ? _0 : setEditingRow;
1640
+ (_z = statefulTableOptions.onDraggingColumnChange) !== null && _z !== void 0 ? _z : setDraggingColumn;
1641
+ table.setDraggingRow =
1642
+ (_0 = statefulTableOptions.onDraggingRowChange) !== null && _0 !== void 0 ? _0 : setDraggingRow;
1643
+ table.setEditingCell =
1644
+ (_1 = statefulTableOptions.onEditingCellChange) !== null && _1 !== void 0 ? _1 : setEditingCell;
1645
+ table.setEditingRow =
1646
+ (_2 = statefulTableOptions.onEditingRowChange) !== null && _2 !== void 0 ? _2 : setEditingRow;
1869
1647
  table.setGlobalFilterFn =
1870
- (_1 = tableOptions.onGlobalFilterFnChange) !== null && _1 !== void 0 ? _1 : setGlobalFilterFn;
1648
+ (_3 = statefulTableOptions.onGlobalFilterFnChange) !== null && _3 !== void 0 ? _3 : setGlobalFilterFn;
1871
1649
  table.setHoveredColumn =
1872
- (_2 = tableOptions.onHoveredColumnChange) !== null && _2 !== void 0 ? _2 : setHoveredColumn;
1873
- table.setHoveredRow = (_3 = tableOptions.onHoveredRowChange) !== null && _3 !== void 0 ? _3 : setHoveredRow;
1874
- table.setIsFullScreen = (_4 = tableOptions.onIsFullScreenChange) !== null && _4 !== void 0 ? _4 : setIsFullScreen;
1650
+ (_4 = statefulTableOptions.onHoveredColumnChange) !== null && _4 !== void 0 ? _4 : setHoveredColumn;
1651
+ table.setHoveredRow =
1652
+ (_5 = statefulTableOptions.onHoveredRowChange) !== null && _5 !== void 0 ? _5 : setHoveredRow;
1653
+ table.setIsFullScreen =
1654
+ (_6 = statefulTableOptions.onIsFullScreenChange) !== null && _6 !== void 0 ? _6 : setIsFullScreen;
1875
1655
  table.setShowAlertBanner =
1876
- (_5 = tableOptions.onShowAlertBannerChange) !== null && _5 !== void 0 ? _5 : setShowAlertBanner;
1656
+ (_7 = statefulTableOptions.onShowAlertBannerChange) !== null && _7 !== void 0 ? _7 : setShowAlertBanner;
1877
1657
  table.setShowColumnFilters =
1878
- (_6 = tableOptions.onShowColumnFiltersChange) !== null && _6 !== void 0 ? _6 : setShowColumnFilters;
1658
+ (_8 = statefulTableOptions.onShowColumnFiltersChange) !== null && _8 !== void 0 ? _8 : setShowColumnFilters;
1879
1659
  table.setShowGlobalFilter =
1880
- (_7 = tableOptions.onShowGlobalFilterChange) !== null && _7 !== void 0 ? _7 : setShowGlobalFilter;
1660
+ (_9 = statefulTableOptions.onShowGlobalFilterChange) !== null && _9 !== void 0 ? _9 : setShowGlobalFilter;
1881
1661
  table.setShowToolbarDropZone =
1882
- (_8 = tableOptions.onShowToolbarDropZoneChange) !== null && _8 !== void 0 ? _8 : setShowToolbarDropZone;
1662
+ (_10 = statefulTableOptions.onShowToolbarDropZoneChange) !== null && _10 !== void 0 ? _10 : setShowToolbarDropZone;
1883
1663
  useMRT_Effects(table);
1884
1664
  return table;
1885
1665
  };
@@ -1990,71 +1770,26 @@ const useMRT_RowVirtualizer = (table, rows) => {
1990
1770
  };
1991
1771
 
1992
1772
  const useMRT_Rows = (table, pinnedRowIds = []) => {
1993
- const { getBottomRows, getCenterRows, getPrePaginationRowModel, getRowModel, getState, getTopRows, options: { createDisplayMode, enableGlobalFilterRankedResults, enablePagination, enableRowPinning, manualExpanding, manualFiltering, manualGrouping, manualPagination, manualSorting, positionCreatingRow, rowPinningDisplayMode, }, } = table;
1773
+ const { getRowModel, getState, options: { data, enableGlobalFilterRankedResults, positionCreatingRow }, } = table;
1994
1774
  const { creatingRow, expanded, globalFilter, pagination, rowPinning, sorting, } = getState();
1995
- const shouldRankRows = react.useMemo(() => getCanRankRows(table) &&
1996
- !Object.values(sorting).some(Boolean) &&
1997
- globalFilter, [
1775
+ const rows = react.useMemo(() => getMRT_Rows(table, pinnedRowIds), [
1776
+ creatingRow,
1777
+ data,
1998
1778
  enableGlobalFilterRankedResults,
1999
1779
  expanded,
1780
+ getRowModel().rows,
2000
1781
  globalFilter,
2001
- manualExpanding,
2002
- manualFiltering,
2003
- manualGrouping,
2004
- manualSorting,
2005
- sorting,
2006
- ]);
2007
- const rows = react.useMemo(() => {
2008
- let rows = [];
2009
- if (!shouldRankRows) {
2010
- rows =
2011
- !enableRowPinning || (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky'))
2012
- ? getRowModel().rows
2013
- : getCenterRows();
2014
- }
2015
- else {
2016
- rows = getPrePaginationRowModel().rows.sort((a, b) => rankGlobalFuzzy(a, b));
2017
- if (enablePagination && !manualPagination) {
2018
- const start = pagination.pageIndex * pagination.pageSize;
2019
- rows = rows.slice(start, start + pagination.pageSize);
2020
- }
2021
- }
2022
- if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky'))) {
2023
- rows = [
2024
- ...getTopRows().filter((row) => !pinnedRowIds.includes(row.id)),
2025
- ...rows,
2026
- ...getBottomRows().filter((row) => !pinnedRowIds.includes(row.id)),
2027
- ];
2028
- }
2029
- if (positionCreatingRow !== undefined &&
2030
- creatingRow &&
2031
- createDisplayMode === 'row') {
2032
- const creatingRowIndex = !isNaN(+positionCreatingRow)
2033
- ? +positionCreatingRow
2034
- : positionCreatingRow === 'top'
2035
- ? 0
2036
- : rows.length;
2037
- rows = [
2038
- ...rows.slice(0, creatingRowIndex),
2039
- creatingRow,
2040
- ...rows.slice(creatingRowIndex),
2041
- ];
2042
- }
2043
- return rows;
2044
- }, [
2045
- creatingRow,
2046
1782
  pagination.pageIndex,
2047
1783
  pagination.pageSize,
2048
1784
  positionCreatingRow,
2049
1785
  rowPinning,
2050
- shouldRankRows ? getPrePaginationRowModel().rows : getRowModel().rows,
2051
- shouldRankRows,
1786
+ sorting,
2052
1787
  ]);
2053
1788
  return rows;
2054
1789
  };
2055
1790
 
2056
1791
  const allowedTypes = ['string', 'number'];
2057
- const MRT_TableBodyCellValue = ({ cell, rowRef, staticRowIndex, table, }) => {
1792
+ const MRT_TableBodyCellValue = ({ cell, rowRef, staticColumnIndex, staticRowIndex, table, }) => {
2058
1793
  var _a, _b, _c;
2059
1794
  const { getState, options: { enableFilterMatchHighlighting }, } = table;
2060
1795
  const { column, row } = cell;
@@ -2117,6 +1852,7 @@ const MRT_TableBodyCellValue = ({ cell, rowRef, staticRowIndex, table, }) => {
2117
1852
  renderedCellValue,
2118
1853
  row,
2119
1854
  rowRef,
1855
+ staticColumnIndex,
2120
1856
  staticRowIndex,
2121
1857
  table,
2122
1858
  });
@@ -2148,7 +1884,7 @@ const MRT_CopyButton = (_a) => {
2148
1884
  row,
2149
1885
  table,
2150
1886
  })), rest);
2151
- return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, getCommonTooltipProps('top'), { title: (_b = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.title) !== null && _b !== void 0 ? _b : (copied ? localization.copiedToClipboard : localization.clickToCopy), children: jsxRuntime.jsx(Button__default["default"], Object.assign({ onClick: (e) => handleCopy(e, cell.getValue()), size: "small", type: "button", variant: "text" }, buttonProps, { sx: (theme) => (Object.assign({ backgroundColor: 'transparent', border: 'none', color: 'inherit', cursor: 'copy', fontFamily: 'inherit', fontSize: 'inherit', letterSpacing: 'inherit', m: '-0.25rem', minWidth: 'unset', textAlign: 'inherit', textTransform: 'inherit' }, parseFromValuesOrFunc(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx, theme))), title: undefined })) })));
1887
+ return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, getCommonTooltipProps('top'), { title: (_b = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.title) !== null && _b !== void 0 ? _b : (copied ? localization.copiedToClipboard : localization.clickToCopy), children: jsxRuntime.jsx(Button__default["default"], Object.assign({ onClick: (e) => handleCopy(e, cell.getValue()), size: "small", type: "button", variant: "text" }, buttonProps, { sx: (theme) => (Object.assign({ backgroundColor: 'transparent', border: 'none', color: 'inherit', cursor: 'copy', fontFamily: 'inherit', fontSize: 'inherit', letterSpacing: 'inherit', m: '-0.25rem', minWidth: 'unset', py: 0, textAlign: 'inherit', textTransform: 'inherit' }, parseFromValuesOrFunc(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx, theme))), title: undefined })) })));
2152
1888
  };
2153
1889
 
2154
1890
  const MRT_EditCellTextField = (_a) => {
@@ -2249,10 +1985,10 @@ const MRT_EditCellTextField = (_a) => {
2249
1985
 
2250
1986
  const MRT_TableBodyCell = (_a) => {
2251
1987
  var _b, _c, _d, _e, _f;
2252
- var { cell, measureElement, numRows, rowRef, staticColumnIndex, staticRowIndex, table } = _a, rest = __rest(_a, ["cell", "measureElement", "numRows", "rowRef", "staticColumnIndex", "staticRowIndex", "table"]);
1988
+ var { cell, numRows, rowRef, staticColumnIndex, staticRowIndex, table } = _a, rest = __rest(_a, ["cell", "numRows", "rowRef", "staticColumnIndex", "staticRowIndex", "table"]);
2253
1989
  const theme = styles.useTheme();
2254
- const { getState, options: { columnResizeDirection, columnResizeMode, createDisplayMode, editDisplayMode, enableClickToCopy, enableColumnOrdering, enableColumnPinning, enableEditing, enableGrouping, layoutMode, muiSkeletonProps, muiTableBodyCellProps, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
2255
- const { columnSizingInfo, creatingRow, density, draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, isLoading, showSkeletons, } = getState();
1990
+ const { getState, options: { columnResizeDirection, columnResizeMode, createDisplayMode, editDisplayMode, enableCellActions, enableClickToCopy, enableColumnOrdering, enableColumnPinning, enableGrouping, layoutMode, muiSkeletonProps, muiTableBodyCellProps, }, setHoveredColumn, } = table;
1991
+ const { actionCell, columnSizingInfo, creatingRow, density, draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, isLoading, showSkeletons, } = getState();
2256
1992
  const { column, row } = cell;
2257
1993
  const { columnDef } = column;
2258
1994
  const { columnDefType } = columnDef;
@@ -2325,9 +2061,7 @@ const MRT_TableBodyCell = (_a) => {
2325
2061
  const isColumnPinned = enableColumnPinning &&
2326
2062
  columnDef.columnDefType !== 'group' &&
2327
2063
  column.getIsPinned();
2328
- const isEditable = !cell.getIsPlaceholder() &&
2329
- parseFromValuesOrFunc(enableEditing, row) &&
2330
- parseFromValuesOrFunc(columnDef.enableEditing, row) !== false;
2064
+ const isEditable = isCellEditable({ cell, table });
2331
2065
  const isEditing = isEditable &&
2332
2066
  !['custom', 'modal'].includes(editDisplayMode) &&
2333
2067
  (editDisplayMode === 'table' ||
@@ -2335,20 +2069,20 @@ const MRT_TableBodyCell = (_a) => {
2335
2069
  (editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) === cell.id) &&
2336
2070
  !row.getIsGrouped();
2337
2071
  const isCreating = isEditable && createDisplayMode === 'row' && (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
2072
+ const showClickToCopyButton = (parseFromValuesOrFunc(enableClickToCopy, cell) === true ||
2073
+ parseFromValuesOrFunc(columnDef.enableClickToCopy, cell) === true) &&
2074
+ !['context-menu', false].includes(
2075
+ // @ts-ignore
2076
+ parseFromValuesOrFunc(columnDef.enableClickToCopy, cell));
2077
+ const isRightClickable = parseFromValuesOrFunc(enableCellActions, cell);
2078
+ const cellValueProps = {
2079
+ cell,
2080
+ table,
2081
+ };
2338
2082
  const handleDoubleClick = (event) => {
2339
2083
  var _a;
2340
2084
  (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDoubleClick) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
2341
- if (isEditable && editDisplayMode === 'cell') {
2342
- setEditingCell(cell);
2343
- queueMicrotask(() => {
2344
- var _a;
2345
- const textField = editInputRefs.current[column.id];
2346
- if (textField) {
2347
- textField.focus();
2348
- (_a = textField.select) === null || _a === void 0 ? void 0 : _a.call(textField);
2349
- }
2350
- });
2351
- }
2085
+ openEditingCell({ cell, table });
2352
2086
  };
2353
2087
  const handleDragEnter = (e) => {
2354
2088
  var _a;
@@ -2360,22 +2094,29 @@ const MRT_TableBodyCell = (_a) => {
2360
2094
  setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
2361
2095
  }
2362
2096
  };
2363
- const cellValueProps = {
2364
- cell,
2365
- table,
2097
+ const handleContextMenu = (e) => {
2098
+ var _a;
2099
+ (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onContextMenu) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, e);
2100
+ if (isRightClickable) {
2101
+ e.preventDefault();
2102
+ table.setActionCell(cell);
2103
+ table.refs.actionCellRef.current = e.currentTarget;
2104
+ }
2366
2105
  };
2367
- return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: theme.direction === 'rtl' ? 'right' : 'left', "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, ref: (node) => {
2368
- if (node) {
2369
- measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
2370
- }
2371
- } }, tableCellProps, { onDoubleClick: handleDoubleClick, onDragEnter: handleDragEnter, sx: (theme) => (Object.assign(Object.assign({ '&:hover': {
2372
- outline: (editDisplayMode === 'cell' && isEditable) ||
2106
+ return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: theme.direction === 'rtl' ? 'right' : 'left', "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined }, tableCellProps, { onContextMenu: handleContextMenu, onDoubleClick: handleDoubleClick, onDragEnter: handleDragEnter, sx: (theme) => (Object.assign(Object.assign({ '&:hover': {
2107
+ outline: (actionCell === null || actionCell === void 0 ? void 0 : actionCell.id) === cell.id ||
2108
+ (editDisplayMode === 'cell' && isEditable) ||
2373
2109
  (editDisplayMode === 'table' && (isCreating || isEditing))
2374
2110
  ? `1px solid ${theme.palette.grey[500]}`
2375
2111
  : undefined,
2376
- outlineOffset: '-1px',
2377
2112
  textOverflow: 'clip',
2378
- }, alignItems: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'center' : undefined, cursor: isEditable && editDisplayMode === 'cell' ? 'pointer' : 'inherit', overflow: 'hidden', p: density === 'compact'
2113
+ }, alignItems: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'center' : undefined, cursor: isRightClickable
2114
+ ? 'context-menu'
2115
+ : isEditable && editDisplayMode === 'cell'
2116
+ ? 'pointer'
2117
+ : 'inherit', outline: (actionCell === null || actionCell === void 0 ? void 0 : actionCell.id) === cell.id
2118
+ ? `1px solid ${theme.palette.grey[500]}`
2119
+ : undefined, outlineOffset: '-1px', overflow: 'hidden', p: density === 'compact'
2379
2120
  ? columnDefType === 'display'
2380
2121
  ? '0 0.5rem'
2381
2122
  : '0.5rem'
@@ -2398,10 +2139,10 @@ const MRT_TableBodyCell = (_a) => {
2398
2139
  renderedCellValue: cell.renderValue(),
2399
2140
  row,
2400
2141
  rowRef,
2142
+ staticColumnIndex,
2401
2143
  staticRowIndex,
2402
2144
  table,
2403
- })) : isCreating || isEditing ? (jsxRuntime.jsx(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
2404
- columnDef.enableClickToCopy !== false ? (jsxRuntime.jsx(MRT_CopyButton, { cell: cell, table: table, children: jsxRuntime.jsx(MRT_TableBodyCellValue, Object.assign({}, cellValueProps)) })) : (jsxRuntime.jsx(MRT_TableBodyCellValue, Object.assign({}, cellValueProps))), cell.getIsGrouped() && !columnDef.GroupedCell && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [" (", (_f = row.subRows) === null || _f === void 0 ? void 0 : _f.length, ")"] }))] })) })));
2145
+ })) : isCreating || isEditing ? (jsxRuntime.jsx(MRT_EditCellTextField, { cell: cell, table: table })) : showClickToCopyButton && columnDef.enableClickToCopy !== false ? (jsxRuntime.jsx(MRT_CopyButton, { cell: cell, table: table, children: jsxRuntime.jsx(MRT_TableBodyCellValue, Object.assign({}, cellValueProps)) })) : (jsxRuntime.jsx(MRT_TableBodyCellValue, Object.assign({}, cellValueProps))), cell.getIsGrouped() && !columnDef.GroupedCell && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [" (", (_f = row.subRows) === null || _f === void 0 ? void 0 : _f.length, ")"] }))] })) })));
2405
2146
  };
2406
2147
  const Memo_MRT_TableBodyCell = react.memo(MRT_TableBodyCell, (prev, next) => next.cell === prev.cell);
2407
2148
 
@@ -2439,8 +2180,9 @@ const MRT_TableDetailPanel = (_a) => {
2439
2180
  : undefined, width: `100%` }, parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme))), children: enableRowVirtualization ? (row.getIsExpanded() && DetailPanel) : (jsxRuntime.jsx(Collapse__default["default"], { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: DetailPanel })) })) })));
2440
2181
  };
2441
2182
 
2442
- const MRT_TableBodyRow = ({ columnVirtualizer, numRows, pinnedRowIds, row, rowVirtualizer, staticRowIndex, table, virtualRow, }) => {
2443
- var _a, _b, _c, _d;
2183
+ const MRT_TableBodyRow = (_a) => {
2184
+ var _b, _c, _d, _f;
2185
+ var { columnVirtualizer, numRows, pinnedRowIds, row, rowVirtualizer, staticRowIndex, table, virtualRow } = _a, rest = __rest(_a, ["columnVirtualizer", "numRows", "pinnedRowIds", "row", "rowVirtualizer", "staticRowIndex", "table", "virtualRow"]);
2444
2186
  const theme = styles.useTheme();
2445
2187
  const { getState, options: { enableRowOrdering, enableRowPinning, enableStickyFooter, enableStickyHeader, layoutMode, memoMode, muiTableBodyRowProps, renderDetailPanel, rowPinningDisplayMode, }, refs: { tableFooterRef, tableHeadRef }, setHoveredRow, } = table;
2446
2188
  const { density, draggingColumn, draggingRow, editingCell, editingRow, hoveredRow, isFullScreen, rowPinning, } = getState();
@@ -2450,11 +2192,11 @@ const MRT_TableBodyRow = ({ columnVirtualizer, numRows, pinnedRowIds, row, rowVi
2450
2192
  const isRowPinned = enableRowPinning && row.getIsPinned();
2451
2193
  const isDraggingRow = (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id;
2452
2194
  const isHoveredRow = (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id;
2453
- const tableRowProps = parseFromValuesOrFunc(muiTableBodyRowProps, {
2195
+ const tableRowProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableBodyRowProps, {
2454
2196
  row,
2455
2197
  staticRowIndex,
2456
2198
  table,
2457
- });
2199
+ })), rest);
2458
2200
  const [bottomPinnedIndex, topPinnedIndex] = react.useMemo(() => {
2459
2201
  if (!enableRowPinning ||
2460
2202
  !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) ||
@@ -2467,14 +2209,14 @@ const MRT_TableBodyRow = ({ columnVirtualizer, numRows, pinnedRowIds, row, rowVi
2467
2209
  ];
2468
2210
  }, [pinnedRowIds, rowPinning]);
2469
2211
  const tableHeadHeight = ((enableStickyHeader || isFullScreen) &&
2470
- ((_a = tableHeadRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight)) ||
2212
+ ((_b = tableHeadRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight)) ||
2471
2213
  0;
2472
- const tableFooterHeight = (enableStickyFooter && ((_b = tableFooterRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight)) || 0;
2214
+ const tableFooterHeight = (enableStickyFooter && ((_c = tableFooterRef.current) === null || _c === void 0 ? void 0 : _c.clientHeight)) || 0;
2473
2215
  const sx = parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme);
2474
2216
  const defaultRowHeight = density === 'compact' ? 37 : density === 'comfortable' ? 53 : 69;
2475
2217
  const customRowHeight =
2476
2218
  // @ts-ignore
2477
- parseInt((_d = (_c = tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : sx === null || sx === void 0 ? void 0 : sx.height, 10) || undefined;
2219
+ parseInt((_f = (_d = tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style) === null || _d === void 0 ? void 0 : _d.height) !== null && _f !== void 0 ? _f : sx === null || sx === void 0 ? void 0 : sx.height, 10) || undefined;
2478
2220
  const rowHeight = customRowHeight || defaultRowHeight;
2479
2221
  const handleDragEnter = (_e) => {
2480
2222
  if (enableRowOrdering && draggingRow) {
@@ -2524,9 +2266,6 @@ const MRT_TableBodyRow = ({ columnVirtualizer, numRows, pinnedRowIds, row, rowVi
2524
2266
  }
2525
2267
  const props = {
2526
2268
  cell,
2527
- measureElement: !isDraggingRow && !isHoveredRow
2528
- ? columnVirtualizer === null || columnVirtualizer === void 0 ? void 0 : columnVirtualizer.measureElement
2529
- : undefined,
2530
2269
  numRows,
2531
2270
  rowRef,
2532
2271
  staticColumnIndex,
@@ -2620,89 +2359,427 @@ const MRT_TableBody = (_a) => {
2620
2359
  return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
2621
2360
  }) })))] }));
2622
2361
  };
2623
- const Memo_MRT_TableBody = react.memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
2362
+ const Memo_MRT_TableBody = react.memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
2363
+
2364
+ const MRT_TableFooterCell = (_a) => {
2365
+ var _b, _c, _d;
2366
+ var { footer, staticColumnIndex, table } = _a, rest = __rest(_a, ["footer", "staticColumnIndex", "table"]);
2367
+ const theme = styles.useTheme();
2368
+ const { getState, options: { enableColumnPinning, muiTableFooterCellProps }, } = table;
2369
+ const { density } = getState();
2370
+ const { column } = footer;
2371
+ const { columnDef } = column;
2372
+ const { columnDefType } = columnDef;
2373
+ const isColumnPinned = enableColumnPinning &&
2374
+ columnDef.columnDefType !== 'group' &&
2375
+ column.getIsPinned();
2376
+ const args = { column, table };
2377
+ const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterCellProps, args)), parseFromValuesOrFunc(columnDef.muiTableFooterCellProps, args)), rest);
2378
+ return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: columnDefType === 'group'
2379
+ ? 'center'
2380
+ : theme.direction === 'rtl'
2381
+ ? 'right'
2382
+ : 'left', colSpan: footer.colSpan, "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, variant: "footer" }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ fontWeight: 'bold', p: density === 'compact'
2383
+ ? '0.5rem'
2384
+ : density === 'comfortable'
2385
+ ? '1rem'
2386
+ : '1.5rem', verticalAlign: 'top' }, getCommonMRTCellStyles({
2387
+ column,
2388
+ header: footer,
2389
+ table,
2390
+ tableCellProps,
2391
+ theme,
2392
+ })), parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme))), children: (_b = tableCellProps.children) !== null && _b !== void 0 ? _b : (footer.isPlaceholder
2393
+ ? null
2394
+ : (_d = (_c = parseFromValuesOrFunc(columnDef.Footer, {
2395
+ column,
2396
+ footer,
2397
+ table,
2398
+ })) !== null && _c !== void 0 ? _c : columnDef.footer) !== null && _d !== void 0 ? _d : null) })));
2399
+ };
2400
+
2401
+ const MRT_TableFooterRow = (_a) => {
2402
+ var _b;
2403
+ var { columnVirtualizer, footerGroup, table } = _a, rest = __rest(_a, ["columnVirtualizer", "footerGroup", "table"]);
2404
+ const { options: { layoutMode, muiTableFooterRowProps }, } = table;
2405
+ const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } = columnVirtualizer !== null && columnVirtualizer !== void 0 ? columnVirtualizer : {};
2406
+ // if no content in row, skip row
2407
+ if (!((_b = footerGroup.headers) === null || _b === void 0 ? void 0 : _b.some((header) => (typeof header.column.columnDef.footer === 'string' &&
2408
+ !!header.column.columnDef.footer) ||
2409
+ header.column.columnDef.Footer))) {
2410
+ return null;
2411
+ }
2412
+ const tableRowProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterRowProps, {
2413
+ footerGroup,
2414
+ table,
2415
+ })), rest);
2416
+ return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: getMRTTheme(table, theme).baseBackgroundColor, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, position: 'relative', width: '100%' }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter, staticColumnIndex) => {
2417
+ let footer = footerOrVirtualFooter;
2418
+ if (columnVirtualizer) {
2419
+ staticColumnIndex = footerOrVirtualFooter
2420
+ .index;
2421
+ footer = footerGroup.headers[staticColumnIndex];
2422
+ }
2423
+ return footer ? (jsxRuntime.jsx(MRT_TableFooterCell, { footer: footer, staticColumnIndex: staticColumnIndex, table: table }, footer.id)) : null;
2424
+ }), virtualPaddingRight ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
2425
+ };
2426
+
2427
+ const MRT_TableFooter = (_a) => {
2428
+ var { columnVirtualizer, table } = _a, rest = __rest(_a, ["columnVirtualizer", "table"]);
2429
+ const { getFooterGroups, getState, options: { enableStickyFooter, layoutMode, muiTableFooterProps }, refs: { tableFooterRef }, } = table;
2430
+ const { isFullScreen } = getState();
2431
+ const tableFooterProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterProps, {
2432
+ table,
2433
+ })), rest);
2434
+ const stickFooter = (isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
2435
+ return (jsxRuntime.jsx(TableFooter__default["default"], Object.assign({}, tableFooterProps, { ref: (ref) => {
2436
+ tableFooterRef.current = ref;
2437
+ if (tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.ref) {
2438
+ // @ts-ignore
2439
+ tableFooterProps.ref.current = ref;
2440
+ }
2441
+ }, sx: (theme) => (Object.assign({ bottom: stickFooter ? 0 : undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, opacity: stickFooter ? 0.97 : undefined, outline: stickFooter
2442
+ ? theme.palette.mode === 'light'
2443
+ ? `1px solid ${theme.palette.grey[300]}`
2444
+ : `1px solid ${theme.palette.grey[700]}`
2445
+ : undefined, position: stickFooter ? 'sticky' : 'relative', zIndex: stickFooter ? 1 : undefined }, parseFromValuesOrFunc(tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx, theme))), children: getFooterGroups().map((footerGroup) => (jsxRuntime.jsx(MRT_TableFooterRow, { columnVirtualizer: columnVirtualizer, footerGroup: footerGroup, table: table }, footerGroup.id))) })));
2446
+ };
2447
+
2448
+ const mrtFilterOptions = (localization) => [
2449
+ {
2450
+ divider: false,
2451
+ label: localization.filterFuzzy,
2452
+ option: 'fuzzy',
2453
+ symbol: '≈',
2454
+ },
2455
+ {
2456
+ divider: false,
2457
+ label: localization.filterContains,
2458
+ option: 'contains',
2459
+ symbol: '*',
2460
+ },
2461
+ {
2462
+ divider: false,
2463
+ label: localization.filterStartsWith,
2464
+ option: 'startsWith',
2465
+ symbol: 'a',
2466
+ },
2467
+ {
2468
+ divider: true,
2469
+ label: localization.filterEndsWith,
2470
+ option: 'endsWith',
2471
+ symbol: 'z',
2472
+ },
2473
+ {
2474
+ divider: false,
2475
+ label: localization.filterEquals,
2476
+ option: 'equals',
2477
+ symbol: '=',
2478
+ },
2479
+ {
2480
+ divider: true,
2481
+ label: localization.filterNotEquals,
2482
+ option: 'notEquals',
2483
+ symbol: '≠',
2484
+ },
2485
+ {
2486
+ divider: false,
2487
+ label: localization.filterBetween,
2488
+ option: 'between',
2489
+ symbol: '⇿',
2490
+ },
2491
+ {
2492
+ divider: true,
2493
+ label: localization.filterBetweenInclusive,
2494
+ option: 'betweenInclusive',
2495
+ symbol: '⬌',
2496
+ },
2497
+ {
2498
+ divider: false,
2499
+ label: localization.filterGreaterThan,
2500
+ option: 'greaterThan',
2501
+ symbol: '>',
2502
+ },
2503
+ {
2504
+ divider: false,
2505
+ label: localization.filterGreaterThanOrEqualTo,
2506
+ option: 'greaterThanOrEqualTo',
2507
+ symbol: '≥',
2508
+ },
2509
+ {
2510
+ divider: false,
2511
+ label: localization.filterLessThan,
2512
+ option: 'lessThan',
2513
+ symbol: '<',
2514
+ },
2515
+ {
2516
+ divider: true,
2517
+ label: localization.filterLessThanOrEqualTo,
2518
+ option: 'lessThanOrEqualTo',
2519
+ symbol: '≤',
2520
+ },
2521
+ {
2522
+ divider: false,
2523
+ label: localization.filterEmpty,
2524
+ option: 'empty',
2525
+ symbol: '∅',
2526
+ },
2527
+ {
2528
+ divider: false,
2529
+ label: localization.filterNotEmpty,
2530
+ option: 'notEmpty',
2531
+ symbol: '!∅',
2532
+ },
2533
+ ];
2534
+ const rangeModes = ['between', 'betweenInclusive', 'inNumberRange'];
2535
+ const emptyModes = ['empty', 'notEmpty'];
2536
+ const arrModes = ['arrIncludesSome', 'arrIncludesAll', 'arrIncludes'];
2537
+ const rangeVariants = ['range-slider', 'date-range', 'datetime-range', 'range'];
2538
+ const MRT_FilterOptionMenu = (_a) => {
2539
+ var _b, _c, _d, _e;
2540
+ var { anchorEl, header, onSelect, setAnchorEl, setFilterValue, table } = _a, rest = __rest(_a, ["anchorEl", "header", "onSelect", "setAnchorEl", "setFilterValue", "table"]);
2541
+ const { getState, options: { columnFilterModeOptions, globalFilterModeOptions, localization, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
2542
+ const { density, globalFilterFn } = getState();
2543
+ const { column } = header !== null && header !== void 0 ? header : {};
2544
+ const { columnDef } = column !== null && column !== void 0 ? column : {};
2545
+ const currentFilterValue = column === null || column === void 0 ? void 0 : column.getFilterValue();
2546
+ let allowedColumnFilterOptions = (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _b !== void 0 ? _b : columnFilterModeOptions;
2547
+ if (rangeVariants.includes(columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant)) {
2548
+ allowedColumnFilterOptions = [
2549
+ ...rangeModes,
2550
+ ...(allowedColumnFilterOptions !== null && allowedColumnFilterOptions !== void 0 ? allowedColumnFilterOptions : []),
2551
+ ].filter((option) => rangeModes.includes(option));
2552
+ }
2553
+ const internalFilterOptions = react.useMemo(() => mrtFilterOptions(localization).filter((filterOption) => columnDef
2554
+ ? allowedColumnFilterOptions === undefined ||
2555
+ (allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.includes(filterOption.option))
2556
+ : (!globalFilterModeOptions ||
2557
+ globalFilterModeOptions.includes(filterOption.option)) &&
2558
+ ['contains', 'fuzzy', 'startsWith'].includes(filterOption.option)), []);
2559
+ const handleSelectFilterMode = (option) => {
2560
+ var _a, _b;
2561
+ const prevFilterMode = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef._filterFn) !== null && _a !== void 0 ? _a : '';
2562
+ if (!header || !column) {
2563
+ // global filter mode
2564
+ setGlobalFilterFn(option);
2565
+ }
2566
+ else if (option !== prevFilterMode) {
2567
+ // column filter mode
2568
+ setColumnFilterFns((prev) => (Object.assign(Object.assign({}, prev), { [header.id]: option })));
2569
+ // reset filter value and/or perform new filter render
2570
+ if (emptyModes.includes(option)) {
2571
+ // will now be empty/notEmpty filter mode
2572
+ if (currentFilterValue !== ' ' &&
2573
+ !emptyModes.includes(prevFilterMode)) {
2574
+ column.setFilterValue(' ');
2575
+ }
2576
+ else if (currentFilterValue) {
2577
+ column.setFilterValue(currentFilterValue); // perform new filter render
2578
+ }
2579
+ }
2580
+ else if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'multi-select' ||
2581
+ arrModes.includes(option)) {
2582
+ // will now be array filter mode
2583
+ if (currentFilterValue instanceof String ||
2584
+ (currentFilterValue === null || currentFilterValue === void 0 ? void 0 : currentFilterValue.length)) {
2585
+ column.setFilterValue([]);
2586
+ setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue([]);
2587
+ }
2588
+ else if (currentFilterValue) {
2589
+ column.setFilterValue(currentFilterValue); // perform new filter render
2590
+ }
2591
+ }
2592
+ else if (((_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === null || _b === void 0 ? void 0 : _b.includes('range')) ||
2593
+ rangeModes.includes(option)) {
2594
+ // will now be range filter mode
2595
+ if (!Array.isArray(currentFilterValue) ||
2596
+ (!(currentFilterValue === null || currentFilterValue === void 0 ? void 0 : currentFilterValue.every((v) => v === '')) &&
2597
+ !rangeModes.includes(prevFilterMode))) {
2598
+ column.setFilterValue(['', '']);
2599
+ setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue('');
2600
+ }
2601
+ else {
2602
+ column.setFilterValue(currentFilterValue); // perform new filter render
2603
+ }
2604
+ }
2605
+ else {
2606
+ // will now be single value filter mode
2607
+ if (Array.isArray(currentFilterValue)) {
2608
+ column.setFilterValue('');
2609
+ setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue('');
2610
+ }
2611
+ else if (currentFilterValue === ' ' &&
2612
+ emptyModes.includes(prevFilterMode)) {
2613
+ column.setFilterValue(undefined);
2614
+ }
2615
+ else {
2616
+ column.setFilterValue(currentFilterValue); // perform new filter render
2617
+ }
2618
+ }
2619
+ }
2620
+ setAnchorEl(null);
2621
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect();
2622
+ };
2623
+ const filterOption = !!header && columnDef ? columnDef._filterFn : globalFilterFn;
2624
+ const theme = styles.useTheme();
2625
+ const { menuBackgroundColor } = getMRTTheme(table, theme);
2626
+ return (jsxRuntime.jsx(Menu__default["default"], Object.assign({ MenuListProps: {
2627
+ dense: density === 'compact',
2628
+ sx: {
2629
+ backgroundColor: menuBackgroundColor,
2630
+ },
2631
+ }, anchorEl: anchorEl, anchorOrigin: { horizontal: 'right', vertical: 'center' }, disableScrollLock: true, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: (_e = (header && column && columnDef
2632
+ ? (_d = (_c = columnDef.renderColumnFilterModeMenuItems) === null || _c === void 0 ? void 0 : _c.call(columnDef, {
2633
+ column: column,
2634
+ internalFilterOptions,
2635
+ onSelectFilterMode: handleSelectFilterMode,
2636
+ table,
2637
+ })) !== null && _d !== void 0 ? _d : renderColumnFilterModeMenuItems === null || renderColumnFilterModeMenuItems === void 0 ? void 0 : renderColumnFilterModeMenuItems({
2638
+ column: column,
2639
+ internalFilterOptions,
2640
+ onSelectFilterMode: handleSelectFilterMode,
2641
+ table,
2642
+ })
2643
+ : renderGlobalFilterModeMenuItems === null || renderGlobalFilterModeMenuItems === void 0 ? void 0 : renderGlobalFilterModeMenuItems({
2644
+ internalFilterOptions,
2645
+ onSelectFilterMode: handleSelectFilterMode,
2646
+ table,
2647
+ }))) !== null && _e !== void 0 ? _e : internalFilterOptions.map(({ divider, label, option, symbol }, index) => (jsxRuntime.jsx(MRT_ActionMenuItem, { divider: divider, icon: symbol, label: label, onClick: () => handleSelectFilterMode(option), selected: option === filterOption, table: table, value: option }, index))) })));
2648
+ };
2624
2649
 
2625
- const MRT_TableFooterCell = (_a) => {
2626
- var _b, _c, _d;
2627
- var { footer, staticColumnIndex, table } = _a, rest = __rest(_a, ["footer", "staticColumnIndex", "table"]);
2628
- const theme = styles.useTheme();
2629
- const { getState, options: { enableColumnPinning, muiTableFooterCellProps }, } = table;
2630
- const { density } = getState();
2631
- const { column } = footer;
2650
+ const MRT_ColumnActionMenu = (_a) => {
2651
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
2652
+ var { anchorEl, header, setAnchorEl, table } = _a, rest = __rest(_a, ["anchorEl", "header", "setAnchorEl", "table"]);
2653
+ const { getAllLeafColumns, getState, options: { columnFilterDisplayMode, columnFilterModeOptions, enableColumnFilterModes, enableColumnFilters, enableColumnPinning, enableColumnResizing, enableGrouping, enableHiding, enableSorting, enableSortingRemoval, icons: { ClearAllIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, RestartAltIcon, SortIcon, ViewColumnIcon, VisibilityOffIcon, }, localization, renderColumnActionsMenuItems, }, refs: { filterInputRefs }, setColumnFilterFns, setColumnOrder, setColumnSizingInfo, setShowColumnFilters, } = table;
2654
+ const { column } = header;
2632
2655
  const { columnDef } = column;
2633
- const { columnDefType } = columnDef;
2634
- const isColumnPinned = enableColumnPinning &&
2635
- columnDef.columnDefType !== 'group' &&
2636
- column.getIsPinned();
2637
- const args = { column, table };
2638
- const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterCellProps, args)), parseFromValuesOrFunc(columnDef.muiTableFooterCellProps, args)), rest);
2639
- return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: columnDefType === 'group'
2640
- ? 'center'
2641
- : theme.direction === 'rtl'
2642
- ? 'right'
2643
- : 'left', colSpan: footer.colSpan, "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, variant: "footer" }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ fontWeight: 'bold', p: density === 'compact'
2644
- ? '0.5rem'
2645
- : density === 'comfortable'
2646
- ? '1rem'
2647
- : '1.5rem', verticalAlign: 'top' }, getCommonMRTCellStyles({
2656
+ const { columnSizing, columnVisibility, density, showColumnFilters } = getState();
2657
+ const columnFilterValue = column.getFilterValue();
2658
+ const [filterMenuAnchorEl, setFilterMenuAnchorEl] = react.useState(null);
2659
+ const handleClearSort = () => {
2660
+ column.clearSorting();
2661
+ setAnchorEl(null);
2662
+ };
2663
+ const handleSortAsc = () => {
2664
+ column.toggleSorting(false);
2665
+ setAnchorEl(null);
2666
+ };
2667
+ const handleSortDesc = () => {
2668
+ column.toggleSorting(true);
2669
+ setAnchorEl(null);
2670
+ };
2671
+ const handleResetColumnSize = () => {
2672
+ setColumnSizingInfo((old) => (Object.assign(Object.assign({}, old), { isResizingColumn: false })));
2673
+ column.resetSize();
2674
+ setAnchorEl(null);
2675
+ };
2676
+ const handleHideColumn = () => {
2677
+ column.toggleVisibility(false);
2678
+ setAnchorEl(null);
2679
+ };
2680
+ const handlePinColumn = (pinDirection) => {
2681
+ column.pin(pinDirection);
2682
+ setAnchorEl(null);
2683
+ };
2684
+ const handleGroupByColumn = () => {
2685
+ column.toggleGrouping();
2686
+ setColumnOrder((old) => ['mrt-row-expand', ...old]);
2687
+ setAnchorEl(null);
2688
+ };
2689
+ const handleClearFilter = () => {
2690
+ column.setFilterValue(undefined);
2691
+ setAnchorEl(null);
2692
+ if (['empty', 'notEmpty'].includes(columnDef._filterFn)) {
2693
+ setColumnFilterFns((prev) => {
2694
+ var _a;
2695
+ return (Object.assign(Object.assign({}, prev), { [header.id]: (_a = allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions[0]) !== null && _a !== void 0 ? _a : 'fuzzy' }));
2696
+ });
2697
+ }
2698
+ };
2699
+ const handleFilterByColumn = () => {
2700
+ setShowColumnFilters(true);
2701
+ queueMicrotask(() => { var _a; return (_a = filterInputRefs.current[`${column.id}-0`]) === null || _a === void 0 ? void 0 : _a.focus(); });
2702
+ setAnchorEl(null);
2703
+ };
2704
+ const handleShowAllColumns = () => {
2705
+ getAllLeafColumns()
2706
+ .filter((col) => col.columnDef.enableHiding !== false)
2707
+ .forEach((col) => col.toggleVisibility(true));
2708
+ setAnchorEl(null);
2709
+ };
2710
+ const handleOpenFilterModeMenu = (event) => {
2711
+ event.stopPropagation();
2712
+ setFilterMenuAnchorEl(event.currentTarget);
2713
+ };
2714
+ const isSelectFilter = !!columnDef.filterSelectOptions;
2715
+ const allowedColumnFilterOptions = (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _b !== void 0 ? _b : columnFilterModeOptions;
2716
+ const showFilterModeSubMenu = enableColumnFilterModes &&
2717
+ columnDef.enableColumnFilterModes !== false &&
2718
+ !isSelectFilter &&
2719
+ (allowedColumnFilterOptions === undefined ||
2720
+ !!(allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.length));
2721
+ const internalColumnMenuItems = [
2722
+ ...(enableSorting && column.getCanSort()
2723
+ ? [
2724
+ enableSortingRemoval !== false && (jsxRuntime.jsx(MRT_ActionMenuItem, { icon: jsxRuntime.jsx(ClearAllIcon, {}), label: localization.clearSort, onClick: handleClearSort, table: table }, 0)),
2725
+ jsxRuntime.jsx(MRT_ActionMenuItem, { disabled: column.getIsSorted() === 'asc', icon: jsxRuntime.jsx(SortIcon, { style: { transform: 'rotate(180deg) scaleX(-1)' } }), label: (_c = localization.sortByColumnAsc) === null || _c === void 0 ? void 0 : _c.replace('{column}', String(columnDef.header)), onClick: handleSortAsc, table: table }, 1),
2726
+ jsxRuntime.jsx(MRT_ActionMenuItem, { disabled: column.getIsSorted() === 'desc', divider: enableColumnFilters || enableGrouping || enableHiding, icon: jsxRuntime.jsx(SortIcon, {}), label: (_d = localization.sortByColumnDesc) === null || _d === void 0 ? void 0 : _d.replace('{column}', String(columnDef.header)), onClick: handleSortDesc, table: table }, 2),
2727
+ ]
2728
+ : []),
2729
+ ...(enableColumnFilters && column.getCanFilter()
2730
+ ? [
2731
+ jsxRuntime.jsx(MRT_ActionMenuItem, { disabled: !columnFilterValue ||
2732
+ (Array.isArray(columnFilterValue) &&
2733
+ !columnFilterValue.filter((value) => value).length), icon: jsxRuntime.jsx(FilterListOffIcon, {}), label: localization.clearFilter, onClick: handleClearFilter, table: table }, 3),
2734
+ columnFilterDisplayMode === 'subheader' && (jsxRuntime.jsx(MRT_ActionMenuItem, { disabled: showColumnFilters && !enableColumnFilterModes, divider: enableGrouping || enableHiding, icon: jsxRuntime.jsx(FilterListIcon, {}), label: (_e = localization.filterByColumn) === null || _e === void 0 ? void 0 : _e.replace('{column}', String(columnDef.header)), onClick: showColumnFilters
2735
+ ? handleOpenFilterModeMenu
2736
+ : handleFilterByColumn, onOpenSubMenu: showFilterModeSubMenu ? handleOpenFilterModeMenu : undefined, table: table }, 4)),
2737
+ showFilterModeSubMenu && (jsxRuntime.jsx(MRT_FilterOptionMenu, { anchorEl: filterMenuAnchorEl, header: header, onSelect: handleFilterByColumn, setAnchorEl: setFilterMenuAnchorEl, table: table }, 5)),
2738
+ ].filter(Boolean)
2739
+ : []),
2740
+ ...(enableGrouping && column.getCanGroup()
2741
+ ? [
2742
+ jsxRuntime.jsx(MRT_ActionMenuItem, { divider: enableColumnPinning, icon: jsxRuntime.jsx(DynamicFeedIcon, {}), label: (_f = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) === null || _f === void 0 ? void 0 : _f.replace('{column}', String(columnDef.header)), onClick: handleGroupByColumn, table: table }, 6),
2743
+ ]
2744
+ : []),
2745
+ ...(enableColumnPinning && column.getCanPin()
2746
+ ? [
2747
+ jsxRuntime.jsx(MRT_ActionMenuItem, { disabled: column.getIsPinned() === 'left' || !column.getCanPin(), icon: jsxRuntime.jsx(PushPinIcon, { style: { transform: 'rotate(90deg)' } }), label: localization.pinToLeft, onClick: () => handlePinColumn('left'), table: table }, 7),
2748
+ jsxRuntime.jsx(MRT_ActionMenuItem, { disabled: column.getIsPinned() === 'right' || !column.getCanPin(), icon: jsxRuntime.jsx(PushPinIcon, { style: { transform: 'rotate(-90deg)' } }), label: localization.pinToRight, onClick: () => handlePinColumn('right'), table: table }, 8),
2749
+ jsxRuntime.jsx(MRT_ActionMenuItem, { disabled: !column.getIsPinned(), divider: enableHiding, icon: jsxRuntime.jsx(PushPinIcon, {}), label: localization.unpin, onClick: () => handlePinColumn(false), table: table }, 9),
2750
+ ]
2751
+ : []),
2752
+ ...(enableColumnResizing && column.getCanResize()
2753
+ ? [
2754
+ jsxRuntime.jsx(MRT_ActionMenuItem, { disabled: !columnSizing[column.id], icon: jsxRuntime.jsx(RestartAltIcon, {}), label: localization.resetColumnSize, onClick: handleResetColumnSize, table: table }, 10),
2755
+ ]
2756
+ : []),
2757
+ ...(enableHiding
2758
+ ? [
2759
+ jsxRuntime.jsx(MRT_ActionMenuItem, { disabled: !column.getCanHide(), icon: jsxRuntime.jsx(VisibilityOffIcon, {}), label: (_g = localization.hideColumn) === null || _g === void 0 ? void 0 : _g.replace('{column}', String(columnDef.header)), onClick: handleHideColumn, table: table }, 11),
2760
+ jsxRuntime.jsx(MRT_ActionMenuItem, { disabled: !Object.values(columnVisibility).filter((visible) => !visible)
2761
+ .length, icon: jsxRuntime.jsx(ViewColumnIcon, {}), label: (_h = localization.showAllColumns) === null || _h === void 0 ? void 0 : _h.replace('{column}', String(columnDef.header)), onClick: handleShowAllColumns, table: table }, 12),
2762
+ ]
2763
+ : []),
2764
+ ].filter(Boolean);
2765
+ const theme = styles.useTheme();
2766
+ const { menuBackgroundColor } = getMRTTheme(table, theme);
2767
+ return (jsxRuntime.jsx(Menu__default["default"], Object.assign({ MenuListProps: {
2768
+ dense: density === 'compact',
2769
+ sx: {
2770
+ backgroundColor: menuBackgroundColor,
2771
+ },
2772
+ }, anchorEl: anchorEl, disableScrollLock: true, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: (_l = (_k = (_j = columnDef.renderColumnActionsMenuItems) === null || _j === void 0 ? void 0 : _j.call(columnDef, {
2773
+ closeMenu: () => setAnchorEl(null),
2648
2774
  column,
2649
- header: footer,
2775
+ internalColumnMenuItems,
2650
2776
  table,
2651
- tableCellProps,
2652
- theme,
2653
- })), parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme))), children: (_b = tableCellProps.children) !== null && _b !== void 0 ? _b : (footer.isPlaceholder
2654
- ? null
2655
- : (_d = (_c = parseFromValuesOrFunc(columnDef.Footer, {
2656
- column,
2657
- footer,
2658
- table,
2659
- })) !== null && _c !== void 0 ? _c : columnDef.footer) !== null && _d !== void 0 ? _d : null) })));
2660
- };
2661
-
2662
- const MRT_TableFooterRow = (_a) => {
2663
- var _b;
2664
- var { columnVirtualizer, footerGroup, table } = _a, rest = __rest(_a, ["columnVirtualizer", "footerGroup", "table"]);
2665
- const { options: { layoutMode, muiTableFooterRowProps }, } = table;
2666
- const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } = columnVirtualizer !== null && columnVirtualizer !== void 0 ? columnVirtualizer : {};
2667
- // if no content in row, skip row
2668
- if (!((_b = footerGroup.headers) === null || _b === void 0 ? void 0 : _b.some((header) => (typeof header.column.columnDef.footer === 'string' &&
2669
- !!header.column.columnDef.footer) ||
2670
- header.column.columnDef.Footer)))
2671
- return null;
2672
- const tableRowProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterRowProps, {
2673
- footerGroup,
2674
- table,
2675
- })), rest);
2676
- return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: getMRTTheme(table, theme).baseBackgroundColor, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, position: 'relative', width: '100%' }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter, staticColumnIndex) => {
2677
- let footer = footerOrVirtualFooter;
2678
- if (columnVirtualizer) {
2679
- staticColumnIndex = footerOrVirtualFooter
2680
- .index;
2681
- footer = footerGroup.headers[staticColumnIndex];
2682
- }
2683
- return footer ? (jsxRuntime.jsx(MRT_TableFooterCell, { footer: footer, staticColumnIndex: staticColumnIndex, table: table }, footer.id)) : null;
2684
- }), virtualPaddingRight ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
2685
- };
2686
-
2687
- const MRT_TableFooter = (_a) => {
2688
- var { columnVirtualizer, table } = _a, rest = __rest(_a, ["columnVirtualizer", "table"]);
2689
- const { getFooterGroups, getState, options: { enableStickyFooter, layoutMode, muiTableFooterProps }, refs: { tableFooterRef }, } = table;
2690
- const { isFullScreen } = getState();
2691
- const tableFooterProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterProps, {
2692
- table,
2693
- })), rest);
2694
- const stickFooter = (isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
2695
- return (jsxRuntime.jsx(TableFooter__default["default"], Object.assign({}, tableFooterProps, { ref: (ref) => {
2696
- tableFooterRef.current = ref;
2697
- if (tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.ref) {
2698
- // @ts-ignore
2699
- tableFooterProps.ref.current = ref;
2700
- }
2701
- }, sx: (theme) => (Object.assign({ bottom: stickFooter ? 0 : undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, opacity: stickFooter ? 0.97 : undefined, outline: stickFooter
2702
- ? theme.palette.mode === 'light'
2703
- ? `1px solid ${theme.palette.grey[300]}`
2704
- : `1px solid ${theme.palette.grey[700]}`
2705
- : undefined, position: stickFooter ? 'sticky' : 'relative', zIndex: stickFooter ? 1 : undefined }, parseFromValuesOrFunc(tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx, theme))), children: getFooterGroups().map((footerGroup) => (jsxRuntime.jsx(MRT_TableFooterRow, { columnVirtualizer: columnVirtualizer, footerGroup: footerGroup, table: table }, footerGroup.id))) })));
2777
+ })) !== null && _k !== void 0 ? _k : renderColumnActionsMenuItems === null || renderColumnActionsMenuItems === void 0 ? void 0 : renderColumnActionsMenuItems({
2778
+ closeMenu: () => setAnchorEl(null),
2779
+ column,
2780
+ internalColumnMenuItems,
2781
+ table,
2782
+ })) !== null && _l !== void 0 ? _l : internalColumnMenuItems })));
2706
2783
  };
2707
2784
 
2708
2785
  const MRT_TableHeadCellColumnActionsButton = (_a) => {
@@ -2821,6 +2898,7 @@ const MRT_FilterTextField = (_a) => {
2821
2898
  ? ((_a = column.getFilterValue()) === null || _a === void 0 ? void 0 : _a[rangeFilterIndex]) || ''
2822
2899
  : (_b = column.getFilterValue()) !== null && _b !== void 0 ? _b : '';
2823
2900
  });
2901
+ const [autocompleteValue, setAutocompleteValue] = react.useState(isAutocompleteFilter ? filterValue : null);
2824
2902
  const handleChangeDebounced = react.useCallback(utils.debounce((newValue) => {
2825
2903
  if (isRangeFilter) {
2826
2904
  column.setFilterValue((old) => {
@@ -2847,6 +2925,10 @@ const MRT_FilterTextField = (_a) => {
2847
2925
  handleChange(newValue);
2848
2926
  (_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.onChange) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
2849
2927
  };
2928
+ const handleAutocompleteChange = (newValue) => {
2929
+ setAutocompleteValue(newValue);
2930
+ handleChange(getValueAndLabel(newValue).value);
2931
+ };
2850
2932
  const handleClear = () => {
2851
2933
  if (isMultiSelectFilter) {
2852
2934
  setFilterValue([]);
@@ -2967,10 +3049,10 @@ const MRT_FilterTextField = (_a) => {
2967
3049
  } }))) : (filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.startsWith('date')) ? (jsxRuntime.jsx(DatePicker.DatePicker, Object.assign({}, commonDatePickerProps, datePickerProps, { slotProps: {
2968
3050
  field: Object.assign({ clearable: true, onClear: () => handleClear() }, (_r = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _r === void 0 ? void 0 : _r.field),
2969
3051
  textField: Object.assign(Object.assign({}, commonTextFieldProps), (_s = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _s === void 0 ? void 0 : _s.textField),
2970
- } }))) : isAutocompleteFilter ? (jsxRuntime.jsx(Autocomplete__default["default"], Object.assign({ freeSolo: true, getOptionLabel: (option) => getValueAndLabel(option).label, onChange: (_e, newValue) => handleChange(getValueAndLabel(newValue).value), options: (_t = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((option) => getValueAndLabel(option))) !== null && _t !== void 0 ? _t : [] }, autocompleteProps, { renderInput: (builtinTextFieldProps) => {
3052
+ } }))) : isAutocompleteFilter ? (jsxRuntime.jsx(Autocomplete__default["default"], Object.assign({ freeSolo: true, getOptionLabel: (option) => getValueAndLabel(option).label, onChange: (_e, newValue) => handleAutocompleteChange(newValue), options: (_t = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((option) => getValueAndLabel(option))) !== null && _t !== void 0 ? _t : [] }, autocompleteProps, { renderInput: (builtinTextFieldProps) => {
2971
3053
  var _a;
2972
3054
  return (jsxRuntime.jsx(TextField__default["default"], Object.assign({}, builtinTextFieldProps, commonTextFieldProps, { InputProps: Object.assign(Object.assign({}, builtinTextFieldProps.InputProps), { startAdornment: (_a = commonTextFieldProps === null || commonTextFieldProps === void 0 ? void 0 : commonTextFieldProps.InputProps) === null || _a === void 0 ? void 0 : _a.startAdornment }), inputProps: Object.assign(Object.assign({}, builtinTextFieldProps.inputProps), commonTextFieldProps === null || commonTextFieldProps === void 0 ? void 0 : commonTextFieldProps.inputProps), onChange: handleTextFieldChange, onClick: (e) => e.stopPropagation() })));
2973
- }, value: filterValue }))) : (jsxRuntime.jsx(TextField__default["default"], Object.assign({ select: isSelectFilter || isMultiSelectFilter }, commonTextFieldProps, { SelectProps: Object.assign({ MenuProps: { disableScrollLock: true }, displayEmpty: true, multiple: isMultiSelectFilter, renderValue: isMultiSelectFilter
3055
+ }, value: autocompleteValue }))) : (jsxRuntime.jsx(TextField__default["default"], Object.assign({ select: isSelectFilter || isMultiSelectFilter }, commonTextFieldProps, { SelectProps: Object.assign({ MenuProps: { disableScrollLock: true }, displayEmpty: true, multiple: isMultiSelectFilter, renderValue: isMultiSelectFilter
2974
3056
  ? (selected) => !(selected === null || selected === void 0 ? void 0 : selected.length) ? (jsxRuntime.jsx(Box__default["default"], { sx: { opacity: 0.5 }, children: filterPlaceholder })) : (jsxRuntime.jsx(Box__default["default"], { sx: { display: 'flex', flexWrap: 'wrap', gap: '2px' }, children: selected === null || selected === void 0 ? void 0 : selected.map((value) => {
2975
3057
  const selectedValue = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.find((option) => getValueAndLabel(option).value === value);
2976
3058
  return (jsxRuntime.jsx(Chip__default["default"], { label: getValueAndLabel(selectedValue).label }, value));
@@ -3126,7 +3208,7 @@ const MRT_TableHeadCellFilterLabel = (_a) => {
3126
3208
  }, size: "small" }, rest, { sx: (theme) => (Object.assign({ height: '16px', ml: '4px', opacity: isFilterActive ? 1 : 0.3, p: '8px', transform: 'scale(0.75)', transition: 'all 150ms ease-in-out', width: '16px' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: jsxRuntime.jsx(FilterAltIcon, {}) })) }) }) }), jsxRuntime.jsx(Popover__default["default"], { anchorEl: anchorEl, anchorOrigin: {
3127
3209
  horizontal: 'center',
3128
3210
  vertical: 'top',
3129
- }, onClick: (event) => event.stopPropagation(), onClose: (event) => {
3211
+ }, disableScrollLock: true, onClick: (event) => event.stopPropagation(), onClose: (event) => {
3130
3212
  //@ts-ignore
3131
3213
  event.stopPropagation();
3132
3214
  setAnchorEl(null);
@@ -3170,7 +3252,7 @@ const MRT_TableHeadCellGrabHandle = (_a) => {
3170
3252
  setDraggingColumn(null);
3171
3253
  setHoveredColumn(null);
3172
3254
  };
3173
- return (jsxRuntime.jsx(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table }));
3255
+ return (jsxRuntime.jsx(MRT_GrabHandleButton, Object.assign({}, iconButtonProps, { onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })));
3174
3256
  };
3175
3257
 
3176
3258
  const MRT_TableHeadCellResizeHandle = (_a) => {
@@ -3247,7 +3329,7 @@ const MRT_TableHeadCellSortLabel = (_a) => {
3247
3329
 
3248
3330
  const MRT_TableHeadCell = (_a) => {
3249
3331
  var _b, _c, _d, _f, _g, _h;
3250
- var { header, staticColumnIndex, table } = _a, rest = __rest(_a, ["header", "staticColumnIndex", "table"]);
3332
+ var { columnVirtualizer, header, staticColumnIndex, table } = _a, rest = __rest(_a, ["columnVirtualizer", "header", "staticColumnIndex", "table"]);
3251
3333
  const theme = styles.useTheme();
3252
3334
  const { getState, options: { columnFilterDisplayMode, columnResizeDirection, columnResizeMode, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnPinning, enableGrouping, enableMultiSort, layoutMode, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
3253
3335
  const { columnSizingInfo, density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
@@ -3324,8 +3406,12 @@ const MRT_TableHeadCell = (_a) => {
3324
3406
  : theme.direction === 'rtl'
3325
3407
  ? 'right'
3326
3408
  : 'left', colSpan: header.colSpan, "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, onDragEnter: handleDragEnter, ref: (node) => {
3409
+ var _a;
3327
3410
  if (node) {
3328
3411
  tableHeadCellRefs.current[column.id] = node;
3412
+ if (columnDefType !== 'group') {
3413
+ (_a = columnVirtualizer === null || columnVirtualizer === void 0 ? void 0 : columnVirtualizer.measureElement) === null || _a === void 0 ? void 0 : _a.call(columnVirtualizer, node);
3414
+ }
3329
3415
  }
3330
3416
  } }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ '& :hover': {
3331
3417
  '.MuiButtonBase-root': {
@@ -3388,7 +3474,7 @@ const MRT_TableHeadCell = (_a) => {
3388
3474
  whiteSpace: ((_h = (_g = columnDef.header) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0) < 20
3389
3475
  ? 'nowrap'
3390
3476
  : 'normal',
3391
- }, title: columnDefType === 'data' ? columnDef.header : undefined, children: HeaderElement }), column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterLabel, { header: header, table: table })), column.getCanSort() && (jsxRuntime.jsx(MRT_TableHeadCellSortLabel, { header: header, table: table }))] }), columnDefType !== 'group' && (jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content-Actions", sx: {
3477
+ }, children: HeaderElement }), column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterLabel, { header: header, table: table })), column.getCanSort() && (jsxRuntime.jsx(MRT_TableHeadCellSortLabel, { header: header, table: table }))] }), columnDefType !== 'group' && (jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content-Actions", sx: {
3392
3478
  whiteSpace: 'nowrap',
3393
3479
  }, children: [showDragHandle && (jsxRuntime.jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
3394
3480
  current: tableHeadCellRefs.current[column.id],
@@ -3412,14 +3498,14 @@ const MRT_TableHeadRow = (_a) => {
3412
3498
  .index;
3413
3499
  header = headerGroup.headers[staticColumnIndex];
3414
3500
  }
3415
- return header ? (jsxRuntime.jsx(MRT_TableHeadCell, { header: header, staticColumnIndex: staticColumnIndex, table: table }, header.id)) : null;
3501
+ return header ? (jsxRuntime.jsx(MRT_TableHeadCell, { columnVirtualizer: columnVirtualizer, header: header, staticColumnIndex: staticColumnIndex, table: table }, header.id)) : null;
3416
3502
  }), virtualPaddingRight ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
3417
3503
  };
3418
3504
 
3419
3505
  const MRT_ToolbarAlertBanner = (_a) => {
3420
3506
  var _b, _c, _d;
3421
3507
  var { stackAlertBanner, table } = _a, rest = __rest(_a, ["stackAlertBanner", "table"]);
3422
- const { getPrePaginationRowModel, getState, options: { enableRowSelection, enableSelectAll, localization, muiToolbarAlertBannerChipProps, muiToolbarAlertBannerProps, positionToolbarAlertBanner, renderToolbarAlertBannerContent, rowCount, }, refs: { tablePaperRef }, } = table;
3508
+ const { getFilteredSelectedRowModel, getPrePaginationRowModel, getState, options: { enableRowSelection, enableSelectAll, localization, manualPagination, muiToolbarAlertBannerChipProps, muiToolbarAlertBannerProps, positionToolbarAlertBanner, renderToolbarAlertBannerContent, rowCount, }, refs: { lastSelectedRowId, tablePaperRef }, } = table;
3423
3509
  const { density, grouping, rowSelection, showAlertBanner } = getState();
3424
3510
  const alertProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiToolbarAlertBannerProps, {
3425
3511
  table,
@@ -3427,10 +3513,14 @@ const MRT_ToolbarAlertBanner = (_a) => {
3427
3513
  const chipProps = parseFromValuesOrFunc(muiToolbarAlertBannerChipProps, {
3428
3514
  table,
3429
3515
  });
3430
- const selectedRowCount = react.useMemo(() => Object.values(rowSelection).filter(Boolean).length, [rowSelection]);
3431
- const selectedAlert = selectedRowCount > 0
3432
- ? (_c = (_b = localization.selectedCountOfRowCountRowsSelected) === null || _b === void 0 ? void 0 : _b.replace('{selectedCount}', selectedRowCount.toLocaleString())) === null || _c === void 0 ? void 0 : _c.replace('{rowCount}', (rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length).toString())
3433
- : null;
3516
+ const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
3517
+ const selectedRowCount = react.useMemo(() => manualPagination
3518
+ ? Object.values(rowSelection).filter(Boolean).length
3519
+ : getFilteredSelectedRowModel().rows.length, [rowSelection, totalRowCount, manualPagination]);
3520
+ const selectedAlert = selectedRowCount > 0 ? (jsxRuntime.jsxs(Stack__default["default"], { alignItems: "center", direction: "row", gap: "16px", children: [(_c = (_b = localization.selectedCountOfRowCountRowsSelected) === null || _b === void 0 ? void 0 : _b.replace('{selectedCount}', selectedRowCount.toLocaleString())) === null || _c === void 0 ? void 0 : _c.replace('{rowCount}', totalRowCount.toString()), jsxRuntime.jsx(Button__default["default"], { onClick: () => {
3521
+ table.toggleAllRowsSelected(false);
3522
+ lastSelectedRowId.current = null;
3523
+ }, size: "small", sx: { p: '2px' }, children: localization.clearSelection })] })) : null;
3434
3524
  const groupedAlert = grouping.length > 0 ? (jsxRuntime.jsxs("span", { children: [localization.groupedBy, ' ', grouping.map((columnId, index) => (jsxRuntime.jsxs(react.Fragment, { children: [index > 0 ? localization.thenBy : '', jsxRuntime.jsx(Chip__default["default"], Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))] }, `${index}-${columnId}`)))] })) : null;
3435
3525
  return (jsxRuntime.jsx(Collapse__default["default"], { in: showAlertBanner || !!selectedAlert || !!groupedAlert, timeout: stackAlertBanner ? 200 : 0, children: jsxRuntime.jsx(Alert__default["default"], Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => {
3436
3526
  var _a, _b;
@@ -3506,6 +3596,7 @@ const MRT_Table = (_a) => {
3506
3596
  };
3507
3597
 
3508
3598
  const MRT_TableLoadingOverlay = (_a) => {
3599
+ var _b;
3509
3600
  var { table } = _a, rest = __rest(_a, ["table"]);
3510
3601
  const { options: { localization, muiCircularProgressProps }, } = table;
3511
3602
  const circularProgressProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiCircularProgressProps, { table })), rest);
@@ -3521,8 +3612,54 @@ const MRT_TableLoadingOverlay = (_a) => {
3521
3612
  right: 0,
3522
3613
  top: 0,
3523
3614
  width: '100%',
3524
- zIndex: 2,
3525
- }), children: jsxRuntime.jsx(CircularProgress__default["default"], Object.assign({ "aria-label": localization.noRecordsToDisplay, id: "mrt-progress" }, circularProgressProps)) }));
3615
+ zIndex: 3,
3616
+ }), children: (_b = circularProgressProps === null || circularProgressProps === void 0 ? void 0 : circularProgressProps.Component) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(CircularProgress__default["default"], Object.assign({ "aria-label": localization.noRecordsToDisplay, id: "mrt-progress" }, circularProgressProps))) }));
3617
+ };
3618
+
3619
+ const MRT_CellActionMenu = (_a) => {
3620
+ var _b, _c;
3621
+ var { table } = _a, rest = __rest(_a, ["table"]);
3622
+ const { getState, options: { editDisplayMode, enableClickToCopy, enableEditing, icons: { ContentCopy, EditIcon }, localization, renderCellActionMenuItems, }, refs: { actionCellRef }, } = table;
3623
+ const { actionCell, density } = getState();
3624
+ const cell = actionCell;
3625
+ const { row } = cell;
3626
+ const { column } = cell;
3627
+ const { columnDef } = column;
3628
+ const theme = styles.useTheme();
3629
+ const { menuBackgroundColor } = getMRTTheme(table, theme);
3630
+ const handleClose = (event) => {
3631
+ event === null || event === void 0 ? void 0 : event.stopPropagation();
3632
+ table.setActionCell(null);
3633
+ actionCellRef.current = null;
3634
+ };
3635
+ const internalMenuItems = [
3636
+ (parseFromValuesOrFunc(enableClickToCopy, cell) === 'context-menu' ||
3637
+ parseFromValuesOrFunc(columnDef.enableClickToCopy, cell) ===
3638
+ 'context-menu') && (jsxRuntime.jsx(MRT_ActionMenuItem, { icon: jsxRuntime.jsx(ContentCopy, {}), label: localization.copy, onClick: (event) => {
3639
+ event.stopPropagation();
3640
+ navigator.clipboard.writeText(cell.getValue());
3641
+ handleClose();
3642
+ }, table: table }, 'mrt-copy')),
3643
+ parseFromValuesOrFunc(enableEditing, row) && editDisplayMode === 'cell' && (jsxRuntime.jsx(MRT_ActionMenuItem, { icon: jsxRuntime.jsx(EditIcon, {}), label: localization.edit, onClick: () => {
3644
+ openEditingCell({ cell, table });
3645
+ handleClose();
3646
+ }, table: table }, 'mrt-edit')),
3647
+ ].filter(Boolean);
3648
+ const renderActionProps = {
3649
+ cell,
3650
+ closeMenu: handleClose,
3651
+ column,
3652
+ internalMenuItems,
3653
+ row,
3654
+ table,
3655
+ };
3656
+ const menuItems = (_c = (_b = columnDef.renderCellActionMenuItems) === null || _b === void 0 ? void 0 : _b.call(columnDef, renderActionProps)) !== null && _c !== void 0 ? _c : renderCellActionMenuItems === null || renderCellActionMenuItems === void 0 ? void 0 : renderCellActionMenuItems(renderActionProps);
3657
+ return ((!!(menuItems === null || menuItems === void 0 ? void 0 : menuItems.length) || !!(internalMenuItems === null || internalMenuItems === void 0 ? void 0 : internalMenuItems.length)) && (jsxRuntime.jsx(Menu__default["default"], Object.assign({ MenuListProps: {
3658
+ dense: density === 'compact',
3659
+ sx: {
3660
+ backgroundColor: menuBackgroundColor,
3661
+ },
3662
+ }, anchorEl: actionCellRef.current, disableScrollLock: true, onClick: (event) => event.stopPropagation(), onClose: handleClose, open: !!cell, transformOrigin: { horizontal: -100, vertical: 8 } }, rest, { children: menuItems !== null && menuItems !== void 0 ? menuItems : internalMenuItems }))));
3526
3663
  };
3527
3664
 
3528
3665
  const MRT_EditRowModal = (_a) => {
@@ -3569,8 +3706,8 @@ const MRT_EditRowModal = (_a) => {
3569
3706
  const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? react.useLayoutEffect : react.useEffect;
3570
3707
  const MRT_TableContainer = (_a) => {
3571
3708
  var { table } = _a, rest = __rest(_a, ["table"]);
3572
- const { getState, options: { createDisplayMode, editDisplayMode, enableStickyHeader, muiTableContainerProps, }, refs: { bottomToolbarRef, tableContainerRef, topToolbarRef }, } = table;
3573
- const { creatingRow, editingRow, isFullScreen, isLoading, showLoadingOverlay, } = getState();
3709
+ const { getState, options: { createDisplayMode, editDisplayMode, enableCellActions, enableStickyHeader, muiTableContainerProps, }, refs: { bottomToolbarRef, tableContainerRef, topToolbarRef }, } = table;
3710
+ const { actionCell, creatingRow, editingRow, isFullScreen, isLoading, showLoadingOverlay, } = getState();
3574
3711
  const loading = showLoadingOverlay !== false && (isLoading || showLoadingOverlay);
3575
3712
  const [totalToolbarHeight, setTotalToolbarHeight] = react.useState(0);
3576
3713
  const tableContainerProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableContainerProps, {
@@ -3600,7 +3737,7 @@ const MRT_TableContainer = (_a) => {
3600
3737
  ? `calc(100vh - ${totalToolbarHeight}px)`
3601
3738
  : undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), sx: (theme) => (Object.assign({ maxHeight: enableStickyHeader
3602
3739
  ? `clamp(350px, calc(100vh - ${totalToolbarHeight}px), 9999px)`
3603
- : undefined, maxWidth: '100%', overflow: 'auto', position: 'relative' }, parseFromValuesOrFunc(tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx, theme))), children: [loading ? jsxRuntime.jsx(MRT_TableLoadingOverlay, { table: table }) : null, jsxRuntime.jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsxRuntime.jsx(MRT_EditRowModal, { open: true, table: table }))] })));
3740
+ : undefined, maxWidth: '100%', overflow: 'auto', position: 'relative' }, parseFromValuesOrFunc(tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx, theme))), children: [loading ? jsxRuntime.jsx(MRT_TableLoadingOverlay, { table: table }) : null, jsxRuntime.jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsxRuntime.jsx(MRT_EditRowModal, { open: true, table: table })), enableCellActions && actionCell && jsxRuntime.jsx(MRT_CellActionMenu, { table: table })] })));
3604
3741
  };
3605
3742
 
3606
3743
  const MRT_LinearProgressBar = (_a) => {
@@ -3740,7 +3877,7 @@ const MRT_ColumnPinningButtons = (_a) => {
3740
3877
 
3741
3878
  const MRT_ShowHideColumnsMenuItems = (_a) => {
3742
3879
  var _b;
3743
- var { allColumns, column, hoveredColumn, setHoveredColumn, table } = _a, rest = __rest(_a, ["allColumns", "column", "hoveredColumn", "setHoveredColumn", "table"]);
3880
+ var { allColumns, column, hoveredColumn, isNestedColumns, setHoveredColumn, table } = _a, rest = __rest(_a, ["allColumns", "column", "hoveredColumn", "isNestedColumns", "setHoveredColumn", "table"]);
3744
3881
  const { getState, options: { enableColumnOrdering, enableColumnPinning, enableHiding, localization, }, setColumnOrder, } = table;
3745
3882
  const { columnOrder } = getState();
3746
3883
  const { columnDef } = column;
@@ -3795,7 +3932,7 @@ const MRT_ShowHideColumnsMenuItems = (_a) => {
3795
3932
  gap: '8px',
3796
3933
  }, children: [columnDefType !== 'group' &&
3797
3934
  enableColumnOrdering &&
3798
- !allColumns.some((col) => col.columnDef.columnDefType === 'group') &&
3935
+ !isNestedColumns &&
3799
3936
  (columnDef.enableColumnOrdering !== false ? (jsxRuntime.jsx(MRT_GrabHandleButton, { onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })) : (jsxRuntime.jsx(Box__default["default"], { sx: { width: '28px' } }))), enableColumnPinning &&
3800
3937
  (column.getCanPin() ? (jsxRuntime.jsx(MRT_ColumnPinningButtons, { column: column, table: table })) : (jsxRuntime.jsx(Box__default["default"], { sx: { width: '70px' } }))), enableHiding ? (jsxRuntime.jsx(FormControlLabel__default["default"], { checked: switchChecked, componentsProps: {
3801
3938
  typography: {
@@ -3804,7 +3941,7 @@ const MRT_ShowHideColumnsMenuItems = (_a) => {
3804
3941
  opacity: columnDefType !== 'display' ? 1 : 0.5,
3805
3942
  },
3806
3943
  },
3807
- }, control: jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, getCommonTooltipProps(), { title: localization.toggleVisibility, children: jsxRuntime.jsx(Switch__default["default"], {}) })), disabled: !column.getCanHide(), label: columnDef.header, onChange: () => handleToggleColumnHidden(column) })) : (jsxRuntime.jsx(Typography__default["default"], { sx: { alignSelf: 'center' }, children: columnDef.header }))] }) })), (_b = column.columns) === null || _b === void 0 ? void 0 : _b.map((c, i) => (jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: c, hoveredColumn: hoveredColumn, setHoveredColumn: setHoveredColumn, table: table }, `${i}-${c.id}`)))] }));
3944
+ }, control: jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, getCommonTooltipProps(), { title: localization.toggleVisibility, children: jsxRuntime.jsx(Switch__default["default"], {}) })), disabled: !column.getCanHide(), label: columnDef.header, onChange: () => handleToggleColumnHidden(column) })) : (jsxRuntime.jsx(Typography__default["default"], { sx: { alignSelf: 'center' }, children: columnDef.header }))] }) })), (_b = column.columns) === null || _b === void 0 ? void 0 : _b.map((c, i) => (jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: c, hoveredColumn: hoveredColumn, isNestedColumns: isNestedColumns, setHoveredColumn: setHoveredColumn, table: table }, `${i}-${c.id}`)))] }));
3808
3945
  };
3809
3946
 
3810
3947
  const MRT_ShowHideColumnsMenu = (_a) => {
@@ -3835,6 +3972,7 @@ const MRT_ShowHideColumnsMenu = (_a) => {
3835
3972
  getLeftLeafColumns(),
3836
3973
  getRightLeafColumns(),
3837
3974
  ]);
3975
+ const isNestedColumns = allColumns.some((col) => col.columnDef.columnDefType === 'group');
3838
3976
  const [hoveredColumn, setHoveredColumn] = react.useState(null);
3839
3977
  const theme = styles.useTheme();
3840
3978
  const { menuBackgroundColor } = getMRTTheme(table, theme);
@@ -3848,7 +3986,7 @@ const MRT_ShowHideColumnsMenu = (_a) => {
3848
3986
  justifyContent: 'space-between',
3849
3987
  p: '0.5rem',
3850
3988
  pt: 0,
3851
- }, children: [enableHiding && (jsxRuntime.jsx(Button__default["default"], { disabled: !getIsSomeColumnsVisible(), onClick: () => handleToggleAllColumns(false), children: localization.hideAll })), enableColumnOrdering && (jsxRuntime.jsx(Button__default["default"], { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options)), children: localization.resetOrder })), enableColumnPinning && (jsxRuntime.jsx(Button__default["default"], { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true), children: localization.unpinAll })), enableHiding && (jsxRuntime.jsx(Button__default["default"], { disabled: getIsAllColumnsVisible(), onClick: () => handleToggleAllColumns(true), children: localization.showAll }))] }), jsxRuntime.jsx(Divider__default["default"], {}), allColumns.map((column, index) => (jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] })));
3989
+ }, children: [enableHiding && (jsxRuntime.jsx(Button__default["default"], { disabled: !getIsSomeColumnsVisible(), onClick: () => handleToggleAllColumns(false), children: localization.hideAll })), enableColumnOrdering && (jsxRuntime.jsx(Button__default["default"], { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options, true)), children: localization.resetOrder })), enableColumnPinning && (jsxRuntime.jsx(Button__default["default"], { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true), children: localization.unpinAll })), enableHiding && (jsxRuntime.jsx(Button__default["default"], { disabled: getIsAllColumnsVisible(), onClick: () => handleToggleAllColumns(true), children: localization.showAll }))] }), jsxRuntime.jsx(Divider__default["default"], {}), allColumns.map((column, index) => (jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, isNestedColumns: isNestedColumns, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] })));
3852
3990
  };
3853
3991
 
3854
3992
  const MRT_ShowHideColumnsButton = (_a) => {
@@ -4065,6 +4203,7 @@ const MaterialReactTable = (props) => {
4065
4203
  return jsxRuntime.jsx(MRT_TablePaper, { table: table });
4066
4204
  };
4067
4205
 
4206
+ exports.MRT_ActionMenuItem = MRT_ActionMenuItem;
4068
4207
  exports.MRT_AggregationFns = MRT_AggregationFns;
4069
4208
  exports.MRT_BottomToolbar = MRT_BottomToolbar;
4070
4209
  exports.MRT_ColumnActionMenu = MRT_ColumnActionMenu;
@@ -4130,8 +4269,6 @@ exports.MaterialReactTable = MaterialReactTable;
4130
4269
  exports.Memo_MRT_TableBody = Memo_MRT_TableBody;
4131
4270
  exports.Memo_MRT_TableBodyCell = Memo_MRT_TableBodyCell;
4132
4271
  exports.Memo_MRT_TableBodyRow = Memo_MRT_TableBodyRow;
4133
- exports.commonListItemStyles = commonListItemStyles;
4134
- exports.commonMenuItemStyles = commonMenuItemStyles;
4135
4272
  exports.createMRTColumnHelper = createMRTColumnHelper;
4136
4273
  exports.createRow = createRow;
4137
4274
  exports.defaultDisplayColumnProps = defaultDisplayColumnProps;
@@ -4145,11 +4282,16 @@ exports.getIsFirstColumn = getIsFirstColumn;
4145
4282
  exports.getIsFirstRightPinnedColumn = getIsFirstRightPinnedColumn;
4146
4283
  exports.getIsLastColumn = getIsLastColumn;
4147
4284
  exports.getIsLastLeftPinnedColumn = getIsLastLeftPinnedColumn;
4285
+ exports.getIsRankingRows = getIsRankingRows;
4148
4286
  exports.getIsRowSelected = getIsRowSelected;
4149
4287
  exports.getLeadingDisplayColumnIds = getLeadingDisplayColumnIds;
4288
+ exports.getMRT_RowSelectionHandler = getMRT_RowSelectionHandler;
4289
+ exports.getMRT_Rows = getMRT_Rows;
4150
4290
  exports.getTotalRight = getTotalRight;
4151
4291
  exports.getTrailingDisplayColumnIds = getTrailingDisplayColumnIds;
4292
+ exports.isCellEditable = isCellEditable;
4152
4293
  exports.mrtFilterOptions = mrtFilterOptions;
4294
+ exports.openEditingCell = openEditingCell;
4153
4295
  exports.prepareColumns = prepareColumns;
4154
4296
  exports.rankGlobalFuzzy = rankGlobalFuzzy;
4155
4297
  exports.reorderColumn = reorderColumn;