material-react-table 1.14.0 → 2.0.0-alpha.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 (467) hide show
  1. package/README.md +1 -0
  2. package/dist/cjs/index.js +1629 -1323
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/types/MaterialReactTable.d.ts +7 -11
  5. package/dist/cjs/types/body/MRT_TableBody.d.ts +4 -5
  6. package/dist/cjs/types/body/MRT_TableBodyCell.d.ts +5 -5
  7. package/dist/cjs/types/body/MRT_TableBodyCellValue.d.ts +4 -4
  8. package/dist/cjs/types/body/MRT_TableBodyRow.d.ts +5 -6
  9. package/dist/cjs/types/body/MRT_TableBodyRowGrabHandle.d.ts +5 -5
  10. package/dist/cjs/types/body/MRT_TableDetailPanel.d.ts +6 -6
  11. package/dist/cjs/types/body/index.d.ts +6 -0
  12. package/dist/cjs/types/buttons/MRT_ColumnPinningButtons.d.ts +2 -2
  13. package/dist/cjs/types/buttons/MRT_CopyButton.d.ts +2 -2
  14. package/dist/cjs/types/buttons/MRT_EditActionButtons.d.ts +2 -2
  15. package/dist/cjs/types/buttons/MRT_ExpandAllButton.d.ts +3 -3
  16. package/dist/cjs/types/buttons/MRT_ExpandButton.d.ts +2 -2
  17. package/dist/cjs/types/buttons/MRT_GrabHandleButton.d.ts +2 -2
  18. package/dist/cjs/types/buttons/MRT_ShowHideColumnsButton.d.ts +2 -2
  19. package/dist/cjs/types/buttons/MRT_ToggleDensePaddingButton.d.ts +2 -2
  20. package/dist/cjs/types/buttons/MRT_ToggleFiltersButton.d.ts +2 -2
  21. package/dist/cjs/types/buttons/MRT_ToggleFullScreenButton.d.ts +7 -0
  22. package/dist/cjs/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +2 -2
  23. package/dist/cjs/types/buttons/MRT_ToggleRowActionMenuButton.d.ts +2 -2
  24. package/dist/cjs/types/buttons/index.d.ts +12 -0
  25. package/dist/cjs/types/column.utils.d.ts +39 -51
  26. package/dist/cjs/types/filterFns.d.ts +14 -14
  27. package/dist/cjs/types/footer/MRT_TableFooter.d.ts +3 -3
  28. package/dist/cjs/types/footer/MRT_TableFooterCell.d.ts +4 -4
  29. package/dist/cjs/types/footer/MRT_TableFooterRow.d.ts +4 -4
  30. package/dist/cjs/types/footer/index.d.ts +3 -0
  31. package/dist/cjs/types/head/MRT_TableHead.d.ts +3 -3
  32. package/dist/cjs/types/head/MRT_TableHeadCell.d.ts +4 -4
  33. package/dist/cjs/types/head/MRT_TableHeadCellColumnActionsButton.d.ts +4 -4
  34. package/dist/cjs/types/head/MRT_TableHeadCellFilterContainer.d.ts +4 -4
  35. package/dist/cjs/types/head/MRT_TableHeadCellFilterLabel.d.ts +4 -4
  36. package/dist/cjs/types/head/MRT_TableHeadCellGrabHandle.d.ts +4 -4
  37. package/dist/cjs/types/head/MRT_TableHeadCellResizeHandle.d.ts +4 -4
  38. package/dist/cjs/types/head/MRT_TableHeadCellSortLabel.d.ts +4 -4
  39. package/dist/cjs/types/head/MRT_TableHeadRow.d.ts +4 -4
  40. package/dist/cjs/types/head/index.d.ts +9 -0
  41. package/dist/cjs/types/hooks/useMRT_DisplayColumns.d.ts +9 -0
  42. package/dist/cjs/types/hooks/useMRT_Effects.d.ts +2 -0
  43. package/dist/cjs/types/hooks/useMRT_TableInstance.d.ts +2 -0
  44. package/dist/cjs/types/hooks/useMRT_TableOptions.d.ts +2 -0
  45. package/dist/cjs/types/index.d.ts +14 -25
  46. package/dist/cjs/types/inputs/MRT_EditCellTextField.d.ts +2 -3
  47. package/dist/cjs/types/inputs/MRT_FilterCheckbox.d.ts +4 -4
  48. package/dist/cjs/types/inputs/MRT_FilterRangeFields.d.ts +4 -4
  49. package/dist/cjs/types/inputs/MRT_FilterRangeSlider.d.ts +4 -4
  50. package/dist/cjs/types/inputs/MRT_FilterTextField.d.ts +4 -4
  51. package/dist/cjs/types/inputs/MRT_GlobalFilterTextField.d.ts +2 -2
  52. package/dist/cjs/types/inputs/MRT_SelectCheckbox.d.ts +4 -4
  53. package/dist/cjs/types/inputs/index.d.ts +7 -0
  54. package/dist/cjs/types/locales/ar.d.ts +2 -0
  55. package/dist/cjs/types/locales/bg.d.ts +2 -0
  56. package/dist/cjs/types/locales/et.d.ts +2 -0
  57. package/dist/cjs/types/locales/ko.d.ts +2 -0
  58. package/dist/cjs/types/menus/MRT_ColumnActionMenu.d.ts +4 -4
  59. package/dist/cjs/types/menus/MRT_FilterOptionMenu.d.ts +2 -2
  60. package/dist/cjs/types/menus/MRT_RowActionMenu.d.ts +4 -4
  61. package/dist/cjs/types/menus/MRT_ShowHideColumnsMenu.d.ts +2 -2
  62. package/dist/cjs/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +2 -2
  63. package/dist/cjs/types/menus/index.d.ts +5 -0
  64. package/dist/cjs/types/modals/MRT_EditRowModal.d.ts +7 -0
  65. package/dist/cjs/types/modals/index.d.ts +1 -0
  66. package/dist/cjs/types/sortingFns.d.ts +2 -418
  67. package/dist/cjs/types/table/MRT_Table.d.ts +3 -3
  68. package/dist/cjs/types/table/MRT_TableContainer.d.ts +3 -3
  69. package/dist/cjs/types/table/MRT_TablePaper.d.ts +3 -3
  70. package/dist/cjs/types/table/index.d.ts +4 -0
  71. package/dist/cjs/types/toolbar/MRT_BottomToolbar.d.ts +2 -2
  72. package/dist/cjs/types/toolbar/MRT_LinearProgressBar.d.ts +2 -2
  73. package/dist/cjs/types/toolbar/MRT_TablePagination.d.ts +2 -2
  74. package/dist/cjs/types/toolbar/MRT_ToolbarAlertBanner.d.ts +2 -2
  75. package/dist/cjs/types/toolbar/MRT_ToolbarDropZone.d.ts +2 -2
  76. package/dist/cjs/types/toolbar/MRT_ToolbarInternalButtons.d.ts +2 -2
  77. package/dist/cjs/types/toolbar/MRT_TopToolbar.d.ts +2 -2
  78. package/dist/cjs/types/toolbar/index.d.ts +7 -0
  79. package/dist/cjs/types/types.d.ts +116 -85
  80. package/dist/cjs/types/useMaterialReactTable.d.ts +2 -0
  81. package/dist/esm/material-react-table.esm.js +1559 -1317
  82. package/dist/esm/material-react-table.esm.js.map +1 -1
  83. package/dist/esm/types/MaterialReactTable.d.ts +7 -11
  84. package/dist/esm/types/body/MRT_TableBody.d.ts +4 -5
  85. package/dist/esm/types/body/MRT_TableBodyCell.d.ts +5 -5
  86. package/dist/esm/types/body/MRT_TableBodyCellValue.d.ts +4 -4
  87. package/dist/esm/types/body/MRT_TableBodyRow.d.ts +5 -6
  88. package/dist/esm/types/body/MRT_TableBodyRowGrabHandle.d.ts +5 -5
  89. package/dist/esm/types/body/MRT_TableDetailPanel.d.ts +6 -6
  90. package/dist/esm/types/body/index.d.ts +6 -0
  91. package/dist/esm/types/buttons/MRT_ColumnPinningButtons.d.ts +2 -2
  92. package/dist/esm/types/buttons/MRT_CopyButton.d.ts +2 -2
  93. package/dist/esm/types/buttons/MRT_EditActionButtons.d.ts +2 -2
  94. package/dist/esm/types/buttons/MRT_ExpandAllButton.d.ts +3 -3
  95. package/dist/esm/types/buttons/MRT_ExpandButton.d.ts +2 -2
  96. package/dist/esm/types/buttons/MRT_GrabHandleButton.d.ts +2 -2
  97. package/dist/esm/types/buttons/MRT_ShowHideColumnsButton.d.ts +2 -2
  98. package/dist/esm/types/buttons/MRT_ToggleDensePaddingButton.d.ts +2 -2
  99. package/dist/esm/types/buttons/MRT_ToggleFiltersButton.d.ts +2 -2
  100. package/dist/esm/types/buttons/MRT_ToggleFullScreenButton.d.ts +7 -0
  101. package/dist/esm/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +2 -2
  102. package/dist/esm/types/buttons/MRT_ToggleRowActionMenuButton.d.ts +2 -2
  103. package/dist/esm/types/buttons/index.d.ts +12 -0
  104. package/dist/esm/types/column.utils.d.ts +39 -51
  105. package/dist/esm/types/filterFns.d.ts +14 -14
  106. package/dist/esm/types/footer/MRT_TableFooter.d.ts +3 -3
  107. package/dist/esm/types/footer/MRT_TableFooterCell.d.ts +4 -4
  108. package/dist/esm/types/footer/MRT_TableFooterRow.d.ts +4 -4
  109. package/dist/esm/types/footer/index.d.ts +3 -0
  110. package/dist/esm/types/head/MRT_TableHead.d.ts +3 -3
  111. package/dist/esm/types/head/MRT_TableHeadCell.d.ts +4 -4
  112. package/dist/esm/types/head/MRT_TableHeadCellColumnActionsButton.d.ts +4 -4
  113. package/dist/esm/types/head/MRT_TableHeadCellFilterContainer.d.ts +4 -4
  114. package/dist/esm/types/head/MRT_TableHeadCellFilterLabel.d.ts +4 -4
  115. package/dist/esm/types/head/MRT_TableHeadCellGrabHandle.d.ts +4 -4
  116. package/dist/esm/types/head/MRT_TableHeadCellResizeHandle.d.ts +4 -4
  117. package/dist/esm/types/head/MRT_TableHeadCellSortLabel.d.ts +4 -4
  118. package/dist/esm/types/head/MRT_TableHeadRow.d.ts +4 -4
  119. package/dist/esm/types/head/index.d.ts +9 -0
  120. package/dist/esm/types/hooks/useMRT_DisplayColumns.d.ts +9 -0
  121. package/dist/esm/types/hooks/useMRT_Effects.d.ts +2 -0
  122. package/dist/esm/types/hooks/useMRT_TableInstance.d.ts +2 -0
  123. package/dist/esm/types/hooks/useMRT_TableOptions.d.ts +2 -0
  124. package/dist/esm/types/index.d.ts +14 -25
  125. package/dist/esm/types/inputs/MRT_EditCellTextField.d.ts +2 -3
  126. package/dist/esm/types/inputs/MRT_FilterCheckbox.d.ts +4 -4
  127. package/dist/esm/types/inputs/MRT_FilterRangeFields.d.ts +4 -4
  128. package/dist/esm/types/inputs/MRT_FilterRangeSlider.d.ts +4 -4
  129. package/dist/esm/types/inputs/MRT_FilterTextField.d.ts +4 -4
  130. package/dist/esm/types/inputs/MRT_GlobalFilterTextField.d.ts +2 -2
  131. package/dist/esm/types/inputs/MRT_SelectCheckbox.d.ts +4 -4
  132. package/dist/esm/types/inputs/index.d.ts +7 -0
  133. package/dist/esm/types/locales/ar.d.ts +2 -0
  134. package/dist/esm/types/locales/bg.d.ts +2 -0
  135. package/dist/esm/types/locales/et.d.ts +2 -0
  136. package/dist/esm/types/locales/ko.d.ts +2 -0
  137. package/dist/esm/types/menus/MRT_ColumnActionMenu.d.ts +4 -4
  138. package/dist/esm/types/menus/MRT_FilterOptionMenu.d.ts +2 -2
  139. package/dist/esm/types/menus/MRT_RowActionMenu.d.ts +4 -4
  140. package/dist/esm/types/menus/MRT_ShowHideColumnsMenu.d.ts +2 -2
  141. package/dist/esm/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +2 -2
  142. package/dist/esm/types/menus/index.d.ts +5 -0
  143. package/dist/esm/types/modals/MRT_EditRowModal.d.ts +7 -0
  144. package/dist/esm/types/modals/index.d.ts +1 -0
  145. package/dist/esm/types/sortingFns.d.ts +2 -418
  146. package/dist/esm/types/table/MRT_Table.d.ts +3 -3
  147. package/dist/esm/types/table/MRT_TableContainer.d.ts +3 -3
  148. package/dist/esm/types/table/MRT_TablePaper.d.ts +3 -3
  149. package/dist/esm/types/table/index.d.ts +4 -0
  150. package/dist/esm/types/toolbar/MRT_BottomToolbar.d.ts +2 -2
  151. package/dist/esm/types/toolbar/MRT_LinearProgressBar.d.ts +2 -2
  152. package/dist/esm/types/toolbar/MRT_TablePagination.d.ts +2 -2
  153. package/dist/esm/types/toolbar/MRT_ToolbarAlertBanner.d.ts +2 -2
  154. package/dist/esm/types/toolbar/MRT_ToolbarDropZone.d.ts +2 -2
  155. package/dist/esm/types/toolbar/MRT_ToolbarInternalButtons.d.ts +2 -2
  156. package/dist/esm/types/toolbar/MRT_TopToolbar.d.ts +2 -2
  157. package/dist/esm/types/toolbar/index.d.ts +7 -0
  158. package/dist/esm/types/types.d.ts +116 -85
  159. package/dist/esm/types/useMaterialReactTable.d.ts +2 -0
  160. package/dist/index.d.ts +606 -156
  161. package/locales/ar.d.ts +2 -0
  162. package/locales/ar.esm.d.ts +2 -0
  163. package/locales/ar.esm.js +93 -0
  164. package/locales/ar.esm.js.map +1 -0
  165. package/locales/ar.js +97 -0
  166. package/locales/ar.js.map +1 -0
  167. package/locales/bg.d.ts +2 -0
  168. package/locales/bg.esm.d.ts +2 -0
  169. package/locales/bg.esm.js +93 -0
  170. package/locales/bg.esm.js.map +1 -0
  171. package/locales/bg.js +97 -0
  172. package/locales/bg.js.map +1 -0
  173. package/locales/cs.esm.js +1 -2
  174. package/locales/cs.esm.js.map +1 -1
  175. package/locales/cs.js +1 -2
  176. package/locales/cs.js.map +1 -1
  177. package/locales/da.esm.js +0 -1
  178. package/locales/da.esm.js.map +1 -1
  179. package/locales/da.js +0 -1
  180. package/locales/da.js.map +1 -1
  181. package/locales/de.esm.js +0 -1
  182. package/locales/de.esm.js.map +1 -1
  183. package/locales/de.js +0 -1
  184. package/locales/de.js.map +1 -1
  185. package/locales/en.esm.js +0 -1
  186. package/locales/en.esm.js.map +1 -1
  187. package/locales/en.js +0 -1
  188. package/locales/en.js.map +1 -1
  189. package/locales/es.esm.js +0 -1
  190. package/locales/es.esm.js.map +1 -1
  191. package/locales/es.js +0 -1
  192. package/locales/es.js.map +1 -1
  193. package/locales/et.d.ts +2 -0
  194. package/locales/et.esm.d.ts +2 -0
  195. package/locales/et.esm.js +93 -0
  196. package/locales/et.esm.js.map +1 -0
  197. package/locales/et.js +97 -0
  198. package/locales/et.js.map +1 -0
  199. package/locales/fa.esm.js +0 -1
  200. package/locales/fa.esm.js.map +1 -1
  201. package/locales/fa.js +0 -1
  202. package/locales/fa.js.map +1 -1
  203. package/locales/fi.esm.js +0 -1
  204. package/locales/fi.esm.js.map +1 -1
  205. package/locales/fi.js +0 -1
  206. package/locales/fi.js.map +1 -1
  207. package/locales/fr.esm.js +0 -1
  208. package/locales/fr.esm.js.map +1 -1
  209. package/locales/fr.js +0 -1
  210. package/locales/fr.js.map +1 -1
  211. package/locales/hu.esm.js +0 -1
  212. package/locales/hu.esm.js.map +1 -1
  213. package/locales/hu.js +0 -1
  214. package/locales/hu.js.map +1 -1
  215. package/locales/id.esm.js +0 -1
  216. package/locales/id.esm.js.map +1 -1
  217. package/locales/id.js +0 -1
  218. package/locales/id.js.map +1 -1
  219. package/locales/it.esm.js +0 -1
  220. package/locales/it.esm.js.map +1 -1
  221. package/locales/it.js +0 -1
  222. package/locales/it.js.map +1 -1
  223. package/locales/ja.esm.js +0 -1
  224. package/locales/ja.esm.js.map +1 -1
  225. package/locales/ja.js +0 -1
  226. package/locales/ja.js.map +1 -1
  227. package/locales/ko.d.ts +2 -0
  228. package/locales/ko.esm.d.ts +2 -0
  229. package/locales/ko.esm.js +93 -0
  230. package/locales/ko.esm.js.map +1 -0
  231. package/locales/ko.js +97 -0
  232. package/locales/ko.js.map +1 -0
  233. package/locales/nl.esm.js +0 -1
  234. package/locales/nl.esm.js.map +1 -1
  235. package/locales/nl.js +0 -1
  236. package/locales/nl.js.map +1 -1
  237. package/locales/no.esm.js +0 -1
  238. package/locales/no.esm.js.map +1 -1
  239. package/locales/no.js +0 -1
  240. package/locales/no.js.map +1 -1
  241. package/locales/pl.esm.js +0 -1
  242. package/locales/pl.esm.js.map +1 -1
  243. package/locales/pl.js +0 -1
  244. package/locales/pl.js.map +1 -1
  245. package/locales/pt-BR.esm.js +0 -1
  246. package/locales/pt-BR.esm.js.map +1 -1
  247. package/locales/pt-BR.js +0 -1
  248. package/locales/pt-BR.js.map +1 -1
  249. package/locales/pt.esm.js +0 -1
  250. package/locales/pt.esm.js.map +1 -1
  251. package/locales/pt.js +0 -1
  252. package/locales/pt.js.map +1 -1
  253. package/locales/ro.esm.js +0 -1
  254. package/locales/ro.esm.js.map +1 -1
  255. package/locales/ro.js +0 -1
  256. package/locales/ro.js.map +1 -1
  257. package/locales/ru.esm.js +0 -1
  258. package/locales/ru.esm.js.map +1 -1
  259. package/locales/ru.js +0 -1
  260. package/locales/ru.js.map +1 -1
  261. package/locales/sk.esm.js +0 -1
  262. package/locales/sk.esm.js.map +1 -1
  263. package/locales/sk.js +0 -1
  264. package/locales/sk.js.map +1 -1
  265. package/locales/sr-Cyrl-RS.esm.js +0 -1
  266. package/locales/sr-Cyrl-RS.esm.js.map +1 -1
  267. package/locales/sr-Cyrl-RS.js +0 -1
  268. package/locales/sr-Cyrl-RS.js.map +1 -1
  269. package/locales/sr-Latn-RS.esm.js +0 -1
  270. package/locales/sr-Latn-RS.esm.js.map +1 -1
  271. package/locales/sr-Latn-RS.js +0 -1
  272. package/locales/sr-Latn-RS.js.map +1 -1
  273. package/locales/sv.esm.js +0 -1
  274. package/locales/sv.esm.js.map +1 -1
  275. package/locales/sv.js +0 -1
  276. package/locales/sv.js.map +1 -1
  277. package/locales/tr.esm.js +0 -1
  278. package/locales/tr.esm.js.map +1 -1
  279. package/locales/tr.js +0 -1
  280. package/locales/tr.js.map +1 -1
  281. package/locales/uk.esm.js +0 -1
  282. package/locales/uk.esm.js.map +1 -1
  283. package/locales/uk.js +0 -1
  284. package/locales/uk.js.map +1 -1
  285. package/locales/vi.esm.js +0 -1
  286. package/locales/vi.esm.js.map +1 -1
  287. package/locales/vi.js +0 -1
  288. package/locales/vi.js.map +1 -1
  289. package/locales/zh-Hans.esm.js +7 -8
  290. package/locales/zh-Hans.esm.js.map +1 -1
  291. package/locales/zh-Hans.js +7 -8
  292. package/locales/zh-Hans.js.map +1 -1
  293. package/locales/zh-Hant.esm.js +1 -2
  294. package/locales/zh-Hant.esm.js.map +1 -1
  295. package/locales/zh-Hant.js +1 -2
  296. package/locales/zh-Hant.js.map +1 -1
  297. package/package.json +44 -42
  298. package/src/MaterialReactTable.tsx +31 -168
  299. package/src/body/MRT_TableBody.tsx +10 -23
  300. package/src/body/MRT_TableBodyCell.tsx +36 -39
  301. package/src/body/MRT_TableBodyCellValue.tsx +7 -4
  302. package/src/body/MRT_TableBodyRow.tsx +7 -7
  303. package/src/body/MRT_TableBodyRowGrabHandle.tsx +13 -10
  304. package/src/body/MRT_TableDetailPanel.tsx +11 -11
  305. package/src/body/index.ts +6 -0
  306. package/src/buttons/MRT_ColumnPinningButtons.tsx +2 -4
  307. package/src/buttons/MRT_CopyButton.tsx +9 -9
  308. package/src/buttons/MRT_EditActionButtons.tsx +56 -25
  309. package/src/buttons/MRT_ExpandAllButton.tsx +5 -3
  310. package/src/buttons/MRT_ExpandButton.tsx +2 -2
  311. package/src/buttons/MRT_GrabHandleButton.tsx +2 -2
  312. package/src/buttons/MRT_ShowHideColumnsButton.tsx +2 -5
  313. package/src/buttons/MRT_ToggleDensePaddingButton.tsx +2 -3
  314. package/src/buttons/MRT_ToggleFiltersButton.tsx +2 -5
  315. package/src/buttons/{MRT_FullScreenToggleButton.tsx → MRT_ToggleFullScreenButton.tsx} +13 -6
  316. package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +3 -5
  317. package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +16 -8
  318. package/src/buttons/index.ts +12 -0
  319. package/src/column.utils.ts +96 -45
  320. package/src/filterFns.ts +14 -14
  321. package/src/footer/MRT_TableFooter.tsx +4 -4
  322. package/src/footer/MRT_TableFooterCell.tsx +7 -4
  323. package/src/footer/MRT_TableFooterRow.tsx +6 -6
  324. package/src/footer/index.ts +3 -0
  325. package/src/head/MRT_TableHead.tsx +4 -4
  326. package/src/head/MRT_TableHeadCell.tsx +7 -4
  327. package/src/head/MRT_TableHeadCellColumnActionsButton.tsx +14 -12
  328. package/src/head/MRT_TableHeadCellFilterContainer.tsx +9 -4
  329. package/src/head/MRT_TableHeadCellFilterLabel.tsx +9 -4
  330. package/src/head/MRT_TableHeadCellGrabHandle.tsx +13 -13
  331. package/src/head/MRT_TableHeadCellResizeHandle.tsx +9 -4
  332. package/src/head/MRT_TableHeadCellSortLabel.tsx +8 -6
  333. package/src/head/MRT_TableHeadRow.tsx +6 -6
  334. package/src/head/index.ts +9 -0
  335. package/src/hooks/useMRT_DisplayColumns.tsx +142 -0
  336. package/src/hooks/useMRT_Effects.ts +77 -0
  337. package/src/hooks/useMRT_TableInstance.ts +291 -0
  338. package/src/hooks/useMRT_TableOptions.ts +169 -0
  339. package/src/index.ts +16 -0
  340. package/src/inputs/MRT_EditCellTextField.tsx +39 -25
  341. package/src/inputs/MRT_FilterCheckbox.tsx +14 -11
  342. package/src/inputs/MRT_FilterRangeFields.tsx +7 -4
  343. package/src/inputs/MRT_FilterRangeSlider.tsx +18 -19
  344. package/src/inputs/MRT_FilterTextField.tsx +15 -15
  345. package/src/inputs/MRT_GlobalFilterTextField.tsx +2 -4
  346. package/src/inputs/MRT_SelectCheckbox.tsx +8 -4
  347. package/src/inputs/index.ts +7 -0
  348. package/src/locales/ar.ts +94 -0
  349. package/src/locales/bg.ts +93 -0
  350. package/src/{_locales → locales}/cs.ts +1 -2
  351. package/src/{_locales → locales}/da.ts +0 -1
  352. package/src/{_locales → locales}/de.ts +0 -1
  353. package/src/{_locales → locales}/en.ts +1 -1
  354. package/src/{_locales → locales}/es.ts +0 -1
  355. package/src/locales/et.ts +94 -0
  356. package/src/{_locales → locales}/fa.ts +0 -1
  357. package/src/{_locales → locales}/fi.ts +0 -1
  358. package/src/{_locales → locales}/fr.ts +0 -1
  359. package/src/{_locales → locales}/hu.ts +0 -1
  360. package/src/{_locales → locales}/id.ts +0 -1
  361. package/src/{_locales → locales}/it.ts +0 -1
  362. package/src/{_locales → locales}/ja.ts +0 -1
  363. package/src/locales/ko.ts +93 -0
  364. package/src/{_locales → locales}/nl.ts +0 -1
  365. package/src/{_locales → locales}/no.ts +1 -1
  366. package/src/{_locales → locales}/pl.ts +0 -1
  367. package/src/{_locales → locales}/pt-BR.ts +0 -1
  368. package/src/{_locales → locales}/pt.ts +0 -1
  369. package/src/{_locales → locales}/ro.ts +0 -1
  370. package/src/{_locales → locales}/ru.ts +0 -1
  371. package/src/{_locales → locales}/sk.ts +0 -1
  372. package/src/{_locales → locales}/sr-Cyrl-RS.ts +0 -1
  373. package/src/{_locales → locales}/sr-Latn-RS.ts +0 -1
  374. package/src/{_locales → locales}/sv.ts +0 -1
  375. package/src/{_locales → locales}/tr.ts +0 -1
  376. package/src/{_locales → locales}/uk.ts +0 -1
  377. package/src/{_locales → locales}/vi.ts +0 -1
  378. package/src/{_locales → locales}/zh-Hans.ts +7 -8
  379. package/src/{_locales → locales}/zh-Hant.ts +1 -2
  380. package/src/menus/MRT_ColumnActionMenu.tsx +8 -8
  381. package/src/menus/MRT_FilterOptionMenu.tsx +4 -3
  382. package/src/menus/MRT_RowActionMenu.tsx +5 -5
  383. package/src/menus/MRT_ShowHideColumnsMenu.tsx +4 -6
  384. package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +4 -4
  385. package/src/menus/index.ts +5 -0
  386. package/src/modals/MRT_EditRowModal.tsx +115 -0
  387. package/src/modals/index.ts +1 -0
  388. package/src/sortingFns.ts +2 -2
  389. package/src/table/MRT_Table.tsx +40 -33
  390. package/src/table/MRT_TableContainer.tsx +23 -5
  391. package/src/table/MRT_TablePaper.tsx +13 -4
  392. package/src/table/index.ts +4 -0
  393. package/src/toolbar/MRT_BottomToolbar.tsx +2 -2
  394. package/src/toolbar/MRT_LinearProgressBar.tsx +2 -2
  395. package/src/toolbar/MRT_TablePagination.tsx +2 -2
  396. package/src/toolbar/MRT_ToolbarAlertBanner.tsx +2 -2
  397. package/src/toolbar/MRT_ToolbarDropZone.tsx +2 -2
  398. package/src/toolbar/MRT_ToolbarInternalButtons.tsx +6 -8
  399. package/src/toolbar/MRT_TopToolbar.tsx +2 -2
  400. package/src/toolbar/index.ts +7 -0
  401. package/src/types.ts +765 -751
  402. package/src/useMaterialReactTable.ts +11 -0
  403. package/dist/cjs/types/body/MRT_EditRowModal.d.ts +0 -8
  404. package/dist/cjs/types/buttons/MRT_FullScreenToggleButton.d.ts +0 -7
  405. package/dist/cjs/types/table/MRT_TableRoot.d.ts +0 -1
  406. package/dist/esm/types/body/MRT_EditRowModal.d.ts +0 -8
  407. package/dist/esm/types/buttons/MRT_FullScreenToggleButton.d.ts +0 -7
  408. package/dist/esm/types/table/MRT_TableRoot.d.ts +0 -1
  409. package/src/body/MRT_EditRowModal.tsx +0 -57
  410. package/src/index.tsx +0 -50
  411. package/src/table/MRT_TableRoot.tsx +0 -421
  412. /package/dist/cjs/types/{_locales → locales}/cs.d.ts +0 -0
  413. /package/dist/cjs/types/{_locales → locales}/da.d.ts +0 -0
  414. /package/dist/cjs/types/{_locales → locales}/de.d.ts +0 -0
  415. /package/dist/cjs/types/{_locales → locales}/en.d.ts +0 -0
  416. /package/dist/cjs/types/{_locales → locales}/es.d.ts +0 -0
  417. /package/dist/cjs/types/{_locales → locales}/fa.d.ts +0 -0
  418. /package/dist/cjs/types/{_locales → locales}/fi.d.ts +0 -0
  419. /package/dist/cjs/types/{_locales → locales}/fr.d.ts +0 -0
  420. /package/dist/cjs/types/{_locales → locales}/hu.d.ts +0 -0
  421. /package/dist/cjs/types/{_locales → locales}/id.d.ts +0 -0
  422. /package/dist/cjs/types/{_locales → locales}/it.d.ts +0 -0
  423. /package/dist/cjs/types/{_locales → locales}/ja.d.ts +0 -0
  424. /package/dist/cjs/types/{_locales → locales}/nl.d.ts +0 -0
  425. /package/dist/cjs/types/{_locales → locales}/no.d.ts +0 -0
  426. /package/dist/cjs/types/{_locales → locales}/pl.d.ts +0 -0
  427. /package/dist/cjs/types/{_locales → locales}/pt-BR.d.ts +0 -0
  428. /package/dist/cjs/types/{_locales → locales}/pt.d.ts +0 -0
  429. /package/dist/cjs/types/{_locales → locales}/ro.d.ts +0 -0
  430. /package/dist/cjs/types/{_locales → locales}/ru.d.ts +0 -0
  431. /package/dist/cjs/types/{_locales → locales}/sk.d.ts +0 -0
  432. /package/dist/cjs/types/{_locales → locales}/sr-Cyrl-RS.d.ts +0 -0
  433. /package/dist/cjs/types/{_locales → locales}/sr-Latn-RS.d.ts +0 -0
  434. /package/dist/cjs/types/{_locales → locales}/sv.d.ts +0 -0
  435. /package/dist/cjs/types/{_locales → locales}/tr.d.ts +0 -0
  436. /package/dist/cjs/types/{_locales → locales}/uk.d.ts +0 -0
  437. /package/dist/cjs/types/{_locales → locales}/vi.d.ts +0 -0
  438. /package/dist/cjs/types/{_locales → locales}/zh-Hans.d.ts +0 -0
  439. /package/dist/cjs/types/{_locales → locales}/zh-Hant.d.ts +0 -0
  440. /package/dist/esm/types/{_locales → locales}/cs.d.ts +0 -0
  441. /package/dist/esm/types/{_locales → locales}/da.d.ts +0 -0
  442. /package/dist/esm/types/{_locales → locales}/de.d.ts +0 -0
  443. /package/dist/esm/types/{_locales → locales}/en.d.ts +0 -0
  444. /package/dist/esm/types/{_locales → locales}/es.d.ts +0 -0
  445. /package/dist/esm/types/{_locales → locales}/fa.d.ts +0 -0
  446. /package/dist/esm/types/{_locales → locales}/fi.d.ts +0 -0
  447. /package/dist/esm/types/{_locales → locales}/fr.d.ts +0 -0
  448. /package/dist/esm/types/{_locales → locales}/hu.d.ts +0 -0
  449. /package/dist/esm/types/{_locales → locales}/id.d.ts +0 -0
  450. /package/dist/esm/types/{_locales → locales}/it.d.ts +0 -0
  451. /package/dist/esm/types/{_locales → locales}/ja.d.ts +0 -0
  452. /package/dist/esm/types/{_locales → locales}/nl.d.ts +0 -0
  453. /package/dist/esm/types/{_locales → locales}/no.d.ts +0 -0
  454. /package/dist/esm/types/{_locales → locales}/pl.d.ts +0 -0
  455. /package/dist/esm/types/{_locales → locales}/pt-BR.d.ts +0 -0
  456. /package/dist/esm/types/{_locales → locales}/pt.d.ts +0 -0
  457. /package/dist/esm/types/{_locales → locales}/ro.d.ts +0 -0
  458. /package/dist/esm/types/{_locales → locales}/ru.d.ts +0 -0
  459. /package/dist/esm/types/{_locales → locales}/sk.d.ts +0 -0
  460. /package/dist/esm/types/{_locales → locales}/sr-Cyrl-RS.d.ts +0 -0
  461. /package/dist/esm/types/{_locales → locales}/sr-Latn-RS.d.ts +0 -0
  462. /package/dist/esm/types/{_locales → locales}/sv.d.ts +0 -0
  463. /package/dist/esm/types/{_locales → locales}/tr.d.ts +0 -0
  464. /package/dist/esm/types/{_locales → locales}/uk.d.ts +0 -0
  465. /package/dist/esm/types/{_locales → locales}/vi.d.ts +0 -0
  466. /package/dist/esm/types/{_locales → locales}/zh-Hans.d.ts +0 -0
  467. /package/dist/esm/types/{_locales → locales}/zh-Hant.d.ts +0 -0
@@ -1,8 +1,8 @@
1
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { useMemo, useState, useRef, useCallback, useEffect, Fragment as Fragment$1, memo, useLayoutEffect } from 'react';
3
- import { aggregationFns, filterFns, sortingFns, useReactTable, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel } from '@tanstack/react-table';
1
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
+ import { useMemo, useState, memo, useEffect, useRef, useCallback, Fragment as Fragment$1, useLayoutEffect } from 'react';
3
+ import { aggregationFns, filterFns, sortingFns, flexRender as flexRender$1, createRow as createRow$1, useReactTable, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel } from '@tanstack/react-table';
4
4
  import { rankItem, rankings, compareItems } from '@tanstack/match-sorter-utils';
5
- import { alpha, lighten, useTheme, darken } from '@mui/material/styles';
5
+ import { alpha, lighten, darken, useTheme } from '@mui/material/styles';
6
6
  import ArrowDownwardIcon from '@mui/icons-material/ArrowDownward';
7
7
  import ArrowRightIcon from '@mui/icons-material/ArrowRight';
8
8
  import CancelIcon from '@mui/icons-material/Cancel';
@@ -31,23 +31,29 @@ import SearchOffIcon from '@mui/icons-material/SearchOff';
31
31
  import SortIcon from '@mui/icons-material/Sort';
32
32
  import ViewColumnIcon from '@mui/icons-material/ViewColumn';
33
33
  import VisibilityOffIcon from '@mui/icons-material/VisibilityOff';
34
- import Box from '@mui/material/Box';
35
- import Dialog from '@mui/material/Dialog';
36
- import Grow from '@mui/material/Grow';
37
- import IconButton from '@mui/material/IconButton';
34
+ import { useVirtualizer, defaultRangeExtractor } from '@tanstack/react-virtual';
35
+ import TableBody from '@mui/material/TableBody';
36
+ import Typography from '@mui/material/Typography';
37
+ import TableRow from '@mui/material/TableRow';
38
+ import Skeleton from '@mui/material/Skeleton';
39
+ import TableCell from '@mui/material/TableCell';
40
+ import TextField from '@mui/material/TextField';
41
+ import MenuItem from '@mui/material/MenuItem';
42
+ import Button from '@mui/material/Button';
38
43
  import Tooltip from '@mui/material/Tooltip';
44
+ import IconButton from '@mui/material/IconButton';
45
+ import Box from '@mui/material/Box';
46
+ import highlightWords from 'highlight-words';
47
+ import Collapse from '@mui/material/Collapse';
39
48
  import ListItemIcon from '@mui/material/ListItemIcon';
40
49
  import Menu from '@mui/material/Menu';
41
- import MenuItem from '@mui/material/MenuItem';
42
- import Button from '@mui/material/Button';
50
+ import CircularProgress from '@mui/material/CircularProgress';
43
51
  import Checkbox from '@mui/material/Checkbox';
44
52
  import Radio from '@mui/material/Radio';
45
53
  import Paper from '@mui/material/Paper';
46
54
  import Toolbar from '@mui/material/Toolbar';
47
55
  import useMediaQuery from '@mui/material/useMediaQuery';
48
- import Collapse from '@mui/material/Collapse';
49
56
  import InputAdornment from '@mui/material/InputAdornment';
50
- import TextField from '@mui/material/TextField';
51
57
  import { debounce } from '@mui/material/utils';
52
58
  import LinearProgress from '@mui/material/LinearProgress';
53
59
  import TablePagination from '@mui/material/TablePagination';
@@ -57,23 +63,18 @@ import Chip from '@mui/material/Chip';
57
63
  import Divider from '@mui/material/Divider';
58
64
  import FormControlLabel from '@mui/material/FormControlLabel';
59
65
  import Switch from '@mui/material/Switch';
60
- import Typography from '@mui/material/Typography';
61
66
  import Fade from '@mui/material/Fade';
62
67
  import TableContainer from '@mui/material/TableContainer';
63
- import { useVirtualizer, defaultRangeExtractor } from '@tanstack/react-virtual';
64
68
  import Table from '@mui/material/Table';
65
69
  import TableHead from '@mui/material/TableHead';
66
- import TableRow from '@mui/material/TableRow';
67
- import TableCell from '@mui/material/TableCell';
68
70
  import Slider from '@mui/material/Slider';
69
71
  import Stack from '@mui/material/Stack';
70
72
  import FormHelperText from '@mui/material/FormHelperText';
73
+ import Grow from '@mui/material/Grow';
71
74
  import Badge from '@mui/material/Badge';
72
75
  import TableSortLabel from '@mui/material/TableSortLabel';
73
- import TableBody from '@mui/material/TableBody';
74
- import Skeleton from '@mui/material/Skeleton';
75
- import highlightWords from 'highlight-words';
76
76
  import TableFooter from '@mui/material/TableFooter';
77
+ import Dialog from '@mui/material/Dialog';
77
78
  import DialogActions from '@mui/material/DialogActions';
78
79
  import DialogContent from '@mui/material/DialogContent';
79
80
  import DialogTitle from '@mui/material/DialogTitle';
@@ -100,6 +101,10 @@ function __rest(s, e) {
100
101
  }
101
102
  return t;
102
103
  }
104
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
105
+ var e = new Error(message);
106
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
107
+ };
103
108
 
104
109
  const MRT_AggregationFns = Object.assign({}, aggregationFns);
105
110
 
@@ -282,7 +287,7 @@ const getLeadingDisplayColumnIds = (props) => {
282
287
  props.positionActionsColumn === 'first' &&
283
288
  (props.enableRowActions ||
284
289
  (props.enableEditing &&
285
- ['row', 'modal'].includes((_a = props.editingMode) !== null && _a !== void 0 ? _a : ''))) &&
290
+ ['row', 'modal'].includes((_a = props.editDisplayMode) !== null && _a !== void 0 ? _a : ''))) &&
286
291
  'mrt-row-actions',
287
292
  props.positionExpandColumn === 'first' &&
288
293
  showExpandColumn(props) &&
@@ -297,7 +302,7 @@ const getTrailingDisplayColumnIds = (props) => {
297
302
  props.positionActionsColumn === 'last' &&
298
303
  (props.enableRowActions ||
299
304
  (props.enableEditing &&
300
- ['row', 'modal'].includes((_a = props.editingMode) !== null && _a !== void 0 ? _a : ''))) &&
305
+ ['row', 'modal'].includes((_a = props.editDisplayMode) !== null && _a !== void 0 ? _a : ''))) &&
301
306
  'mrt-row-actions',
302
307
  props.positionExpandColumn === 'last' &&
303
308
  showExpandColumn(props) &&
@@ -344,6 +349,19 @@ const getTotalRight = (table, column) => {
344
349
  .slice(column.getPinnedIndex() + 1)
345
350
  .reduce((acc, col) => acc + col.getSize(), 0);
346
351
  };
352
+ const getCanRankRows = (table) => {
353
+ const { options, getState } = table;
354
+ const { manualExpanding, manualFiltering, manualGrouping, manualSorting, enableGlobalFilterRankedResults, } = options;
355
+ const { globalFilterFn, expanded } = getState();
356
+ return (!manualExpanding &&
357
+ !manualFiltering &&
358
+ !manualGrouping &&
359
+ !manualSorting &&
360
+ enableGlobalFilterRankedResults &&
361
+ globalFilterFn === 'fuzzy' &&
362
+ expanded !== true &&
363
+ !Object.values(expanded).some(Boolean));
364
+ };
347
365
  const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
348
366
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
349
367
  const widthStyles = {
@@ -405,37 +423,10 @@ const MRT_DefaultDisplayColumn = {
405
423
  enableSorting: false,
406
424
  };
407
425
  const parseCSSVarId = (id) => id.replace(/[^a-zA-Z0-9]/g, '_');
408
-
409
- const MRT_Default_Icons = {
410
- ArrowDownwardIcon,
411
- ArrowRightIcon,
412
- CancelIcon,
413
- ClearAllIcon,
414
- CloseIcon,
415
- DensityLargeIcon,
416
- DensityMediumIcon,
417
- DensitySmallIcon,
418
- DragHandleIcon,
419
- DynamicFeedIcon,
420
- EditIcon,
421
- ExpandMoreIcon,
422
- FilterAltIcon,
423
- FilterListIcon,
424
- FilterListOffIcon,
425
- FullscreenExitIcon,
426
- FullscreenIcon,
427
- KeyboardDoubleArrowDownIcon,
428
- MoreHorizIcon,
429
- MoreVertIcon,
430
- PushPinIcon,
431
- RestartAltIcon,
432
- SaveIcon,
433
- SearchIcon,
434
- SearchOffIcon,
435
- SortIcon,
436
- ViewColumnIcon,
437
- VisibilityOffIcon,
438
- };
426
+ const flexRender = flexRender$1;
427
+ const createRow = (table, originalRow) => createRow$1(table, 'mrt-row-create', originalRow !== null && originalRow !== void 0 ? originalRow : Object.assign({}, ...getAllLeafColumnDefs(table.options.columns).map((col) => ({
428
+ [getColumnId(col)]: '',
429
+ }))), -1, 0);
439
430
 
440
431
  const MRT_Localization_EN = {
441
432
  actions: 'Actions',
@@ -526,62 +517,711 @@ const MRT_Localization_EN = {
526
517
  ungroupByColumn: 'Ungroup by {column}',
527
518
  unpin: 'Unpin',
528
519
  unpinAll: 'Unpin all',
529
- unsorted: 'Unsorted',
530
520
  };
531
521
 
532
- const MRT_ExpandAllButton = ({ table }) => {
533
- var _a, _b;
534
- const { getIsAllRowsExpanded, getIsSomeRowsExpanded, getCanSomeRowsExpand, getState, options: { icons: { KeyboardDoubleArrowDownIcon }, localization, muiExpandAllButtonProps, renderDetailPanel, }, toggleAllRowsExpanded, } = table;
535
- const { density, isLoading } = getState();
536
- const iconButtonProps = muiExpandAllButtonProps instanceof Function
537
- ? muiExpandAllButtonProps({ table })
538
- : muiExpandAllButtonProps;
539
- const isAllRowsExpanded = getIsAllRowsExpanded();
540
- return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: ((_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : isAllRowsExpanded)
541
- ? localization.collapseAll
542
- : localization.expandAll, children: jsx("span", { children: jsx(IconButton, Object.assign({ "aria-label": localization.expandAll, disabled: isLoading || (!renderDetailPanel && !getCanSomeRowsExpand()), onClick: () => toggleAllRowsExpanded(!isAllRowsExpanded) }, iconButtonProps, { sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', width: density === 'compact' ? '1.75rem' : '2.25rem', mt: density !== 'compact' ? '-0.25rem' : undefined }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
543
- ? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
544
- : iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined, children: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _b !== void 0 ? _b : (jsx(KeyboardDoubleArrowDownIcon, { style: {
545
- transform: `rotate(${isAllRowsExpanded ? -180 : getIsSomeRowsExpanded() ? -90 : 0}deg)`,
546
- transition: 'transform 150ms',
547
- } })) })) }) }));
522
+ const MRT_Default_Icons = {
523
+ ArrowDownwardIcon,
524
+ ArrowRightIcon,
525
+ CancelIcon,
526
+ ClearAllIcon,
527
+ CloseIcon,
528
+ DensityLargeIcon,
529
+ DensityMediumIcon,
530
+ DensitySmallIcon,
531
+ DragHandleIcon,
532
+ DynamicFeedIcon,
533
+ EditIcon,
534
+ ExpandMoreIcon,
535
+ FilterAltIcon,
536
+ FilterListIcon,
537
+ FilterListOffIcon,
538
+ FullscreenExitIcon,
539
+ FullscreenIcon,
540
+ KeyboardDoubleArrowDownIcon,
541
+ MoreHorizIcon,
542
+ MoreVertIcon,
543
+ PushPinIcon,
544
+ RestartAltIcon,
545
+ SaveIcon,
546
+ SearchIcon,
547
+ SearchOffIcon,
548
+ SortIcon,
549
+ ViewColumnIcon,
550
+ VisibilityOffIcon,
548
551
  };
549
552
 
550
- const MRT_ExpandButton = ({ row, table, }) => {
551
- var _a, _b;
552
- const { getState, options: { icons: { ExpandMoreIcon }, localization, muiExpandButtonProps, renderDetailPanel, }, } = table;
553
- const { density } = getState();
554
- const iconButtonProps = muiExpandButtonProps instanceof Function
555
- ? muiExpandButtonProps({ table, row })
556
- : muiExpandButtonProps;
557
- const canExpand = row.getCanExpand();
558
- const isExpanded = row.getIsExpanded();
559
- const handleToggleExpand = (event) => {
553
+ const useMRT_TableOptions = (_a) => {
554
+ var _b;
555
+ var { aggregationFns, autoResetExpanded = false, columnFilterDisplayMode = 'subheader', columnResizeMode = 'onChange', createDisplayMode = 'modal', defaultColumn, defaultDisplayColumn, editDisplayMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnResizing = false, enableDensityToggle = true, enableExpandAll = true, enableExpanding, enableFilterMatchHighlighting = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enableColumnPinning = false, enableRowSelection = false, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, layoutMode = 'semantic', localization, manualFiltering, manualGrouping, manualPagination, manualSorting, paginationDisplayMode = 'default', positionActionsColumn = 'first', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberMode = 'static', selectAllMode = 'page', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnFilterDisplayMode", "columnResizeMode", "createDisplayMode", "defaultColumn", "defaultDisplayColumn", "editDisplayMode", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnResizing", "enableDensityToggle", "enableExpandAll", "enableExpanding", "enableFilterMatchHighlighting", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enableColumnPinning", "enableRowSelection", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "paginationDisplayMode", "positionActionsColumn", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberMode", "selectAllMode", "sortingFns"]);
556
+ const _icons = useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
557
+ const _localization = useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
558
+ const _aggregationFns = useMemo(() => (Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns)), []);
559
+ const _filterFns = useMemo(() => (Object.assign(Object.assign({}, MRT_FilterFns), filterFns)), []);
560
+ const _sortingFns = useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
561
+ const _defaultColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), [defaultColumn]);
562
+ const _defaultDisplayColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), [defaultDisplayColumn]);
563
+ if (rest.enableRowVirtualization || rest.enableColumnVirtualization) {
564
+ layoutMode = 'grid';
565
+ }
566
+ if (rest.enableRowVirtualization) {
567
+ enableStickyHeader = true;
568
+ }
569
+ if (enablePagination === false && manualPagination === undefined) {
570
+ manualPagination = true;
571
+ }
572
+ if (!((_b = rest.data) === null || _b === void 0 ? void 0 : _b.length)) {
573
+ manualFiltering = true;
574
+ manualGrouping = true;
575
+ manualPagination = true;
576
+ manualSorting = true;
577
+ }
578
+ return Object.assign({ aggregationFns: _aggregationFns, autoResetExpanded,
579
+ columnFilterDisplayMode,
580
+ columnResizeMode,
581
+ createDisplayMode, defaultColumn: _defaultColumn, defaultDisplayColumn: _defaultDisplayColumn, editDisplayMode,
582
+ enableBottomToolbar,
583
+ enableColumnActions,
584
+ enableColumnFilters,
585
+ enableColumnOrdering,
586
+ enableColumnResizing,
587
+ enableDensityToggle,
588
+ enableExpandAll,
589
+ enableExpanding,
590
+ enableFilterMatchHighlighting,
591
+ enableFilters,
592
+ enableFullScreenToggle,
593
+ enableGlobalFilter,
594
+ enableGlobalFilterRankedResults,
595
+ enableGrouping,
596
+ enableHiding,
597
+ enableMultiRowSelection,
598
+ enableMultiSort,
599
+ enablePagination,
600
+ enableColumnPinning,
601
+ enableRowSelection,
602
+ enableSelectAll,
603
+ enableSorting,
604
+ enableStickyHeader,
605
+ enableTableFooter,
606
+ enableTableHead,
607
+ enableToolbarInternalActions,
608
+ enableTopToolbar, filterFns: _filterFns, icons: _icons, layoutMode, localization: _localization, manualFiltering,
609
+ manualGrouping,
610
+ manualPagination,
611
+ manualSorting,
612
+ paginationDisplayMode,
613
+ positionActionsColumn,
614
+ positionExpandColumn,
615
+ positionGlobalFilter,
616
+ positionPagination,
617
+ positionToolbarAlertBanner,
618
+ positionToolbarDropZone,
619
+ rowNumberMode,
620
+ selectAllMode, sortingFns: _sortingFns }, rest);
621
+ };
622
+
623
+ const MRT_EditCellTextField = ({ cell, table, }) => {
624
+ var _a, _b, _c;
625
+ const { getState, options: { createDisplayMode, editDisplayMode, muiEditTextFieldProps }, refs: { editInputRefs }, setEditingCell, setEditingRow, setCreatingRow, } = table;
626
+ const { column, row } = cell;
627
+ const { columnDef } = column;
628
+ const { creatingRow, editingRow } = getState();
629
+ const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
630
+ const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
631
+ const isSelectEdit = columnDef.editVariant === 'select';
632
+ const [value, setValue] = useState(() => cell.getValue());
633
+ const mTableBodyCellEditTextFieldProps = muiEditTextFieldProps instanceof Function
634
+ ? muiEditTextFieldProps({ cell, column, row, table })
635
+ : muiEditTextFieldProps;
636
+ const mcTableBodyCellEditTextFieldProps = columnDef.muiEditTextFieldProps instanceof Function
637
+ ? columnDef.muiEditTextFieldProps({
638
+ cell,
639
+ column,
640
+ row,
641
+ table,
642
+ })
643
+ : columnDef.muiEditTextFieldProps;
644
+ const textFieldProps = Object.assign(Object.assign({}, mTableBodyCellEditTextFieldProps), mcTableBodyCellEditTextFieldProps);
645
+ const saveInputValueToRowCache = (newValue) => {
646
+ //@ts-ignore
647
+ row._valuesCache[column.id] = newValue;
648
+ if (isCreating) {
649
+ setCreatingRow(Object.assign({}, row));
650
+ }
651
+ else if (isEditing) {
652
+ setEditingRow(Object.assign({}, row));
653
+ }
654
+ };
655
+ const handleChange = (event) => {
656
+ var _a;
657
+ (_a = textFieldProps.onChange) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
658
+ setValue(event.target.value);
659
+ if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.select) {
660
+ saveInputValueToRowCache(event.target.value);
661
+ }
662
+ };
663
+ const handleBlur = (event) => {
560
664
  var _a;
665
+ (_a = textFieldProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
666
+ saveInputValueToRowCache(value);
667
+ setEditingCell(null);
668
+ };
669
+ const handleEnterKeyDown = (event) => {
670
+ var _a, _b;
671
+ (_a = textFieldProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
672
+ if (event.key === 'Enter' && !event.shiftKey) {
673
+ (_b = editInputRefs.current[column.id]) === null || _b === void 0 ? void 0 : _b.blur();
674
+ }
675
+ };
676
+ if (columnDef.Edit) {
677
+ return jsx(Fragment, { children: (_a = columnDef.Edit) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table }) });
678
+ }
679
+ return (jsx(TextField, Object.assign({ disabled: (columnDef.enableEditing instanceof Function
680
+ ? columnDef.enableEditing(row)
681
+ : columnDef.enableEditing) === false, fullWidth: true, inputRef: (inputRef) => {
682
+ if (inputRef) {
683
+ editInputRefs.current[column.id] = inputRef;
684
+ if (textFieldProps.inputRef) {
685
+ textFieldProps.inputRef = inputRef;
686
+ }
687
+ }
688
+ }, label: ['modal', 'custom'].includes((isCreating ? createDisplayMode : editDisplayMode))
689
+ ? column.columnDef.header
690
+ : undefined, margin: "none", name: column.id, placeholder: !['modal', 'custom'].includes((isCreating ? createDisplayMode : editDisplayMode))
691
+ ? columnDef.header
692
+ : undefined, select: isSelectEdit, value: value, variant: "standard" }, textFieldProps, { onClick: (e) => {
693
+ var _a;
694
+ e.stopPropagation();
695
+ (_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.onClick) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, e);
696
+ }, onBlur: handleBlur, onChange: handleChange, onKeyDown: handleEnterKeyDown, children: (_b = textFieldProps.children) !== null && _b !== void 0 ? _b : (_c = columnDef === null || columnDef === void 0 ? void 0 : columnDef.editSelectOptions) === null || _c === void 0 ? void 0 : _c.map((option) => {
697
+ let value;
698
+ let text;
699
+ if (typeof option !== 'object') {
700
+ value = option;
701
+ text = option;
702
+ }
703
+ else {
704
+ value = option.value;
705
+ text = option.text;
706
+ }
707
+ return (jsx(MenuItem, { sx: {
708
+ display: 'flex',
709
+ m: 0,
710
+ alignItems: 'center',
711
+ gap: '0.5rem',
712
+ }, value: value, children: text }, value));
713
+ }) })));
714
+ };
715
+
716
+ const MRT_CopyButton = ({ cell, children, table, }) => {
717
+ var _a;
718
+ const { options: { localization, muiCopyButtonProps }, } = table;
719
+ const { column, row } = cell;
720
+ const { columnDef } = column;
721
+ const [copied, setCopied] = useState(false);
722
+ const handleCopy = (event, text) => {
561
723
  event.stopPropagation();
562
- row.toggleExpanded();
563
- (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
724
+ navigator.clipboard.writeText(text);
725
+ setCopied(true);
726
+ setTimeout(() => setCopied(false), 4000);
564
727
  };
565
- return (jsx(Tooltip, { arrow: true, disableHoverListener: !canExpand && !renderDetailPanel, enterDelay: 1000, enterNextDelay: 1000, title: ((_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : isExpanded)
566
- ? localization.collapse
567
- : localization.expand, children: jsx("span", { children: jsx(IconButton, Object.assign({ "aria-label": localization.expand, disabled: !canExpand && !renderDetailPanel }, iconButtonProps, { onClick: handleToggleExpand, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', width: density === 'compact' ? '1.75rem' : '2.25rem' }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
568
- ? iconButtonProps.sx(theme)
569
- : iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined, children: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _b !== void 0 ? _b : (jsx(ExpandMoreIcon, { style: {
570
- transform: `rotate(${!canExpand && !renderDetailPanel ? -90 : isExpanded ? -180 : 0}deg)`,
571
- transition: 'transform 150ms',
572
- } })) })) }) }));
728
+ const mTableBodyCellCopyButtonProps = muiCopyButtonProps instanceof Function
729
+ ? muiCopyButtonProps({ cell, column, row, table })
730
+ : muiCopyButtonProps;
731
+ const mcTableBodyCellCopyButtonProps = columnDef.muiCopyButtonProps instanceof Function
732
+ ? columnDef.muiCopyButtonProps({
733
+ cell,
734
+ column,
735
+ row,
736
+ table,
737
+ })
738
+ : columnDef.muiCopyButtonProps;
739
+ const buttonProps = Object.assign(Object.assign({}, mTableBodyCellCopyButtonProps), mcTableBodyCellCopyButtonProps);
740
+ return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.title) !== null && _a !== void 0 ? _a : (copied ? localization.copiedToClipboard : localization.clickToCopy), children: jsx(Button, 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' }, ((buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx) instanceof Function
741
+ ? buttonProps.sx(theme)
742
+ : buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx))), title: undefined, children: children })) }));
573
743
  };
574
744
 
575
- const mrtFilterOptions = (localization) => [
576
- {
577
- option: 'fuzzy',
578
- symbol: '≈',
579
- label: localization.filterFuzzy,
580
- divider: false,
581
- },
582
- {
583
- option: 'contains',
584
- symbol: '*',
745
+ const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table, }) => {
746
+ var _a;
747
+ const { options: { icons: { DragHandleIcon }, localization, }, } = table;
748
+ return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : localization.move, children: jsx(IconButton, Object.assign({ disableRipple: true, draggable: "true", size: "small" }, iconButtonProps, { onClick: (e) => {
749
+ var _a;
750
+ e.stopPropagation();
751
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, e);
752
+ }, onDragStart: onDragStart, onDragEnd: onDragEnd, sx: (theme) => (Object.assign({ cursor: 'grab', m: '0 -0.1rem', opacity: 0.5, p: '2px', transition: 'all 150ms ease-in-out', '&:hover': {
753
+ backgroundColor: 'transparent',
754
+ opacity: 1,
755
+ }, '&:active': {
756
+ cursor: 'grabbing',
757
+ } }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
758
+ ? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
759
+ : iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined, children: jsx(DragHandleIcon, {}) })) }));
760
+ };
761
+
762
+ const MRT_TableBodyRowGrabHandle = ({ row, rowRef, table, }) => {
763
+ const { options: { muiRowDragHandleProps }, } = table;
764
+ const iconButtonProps = muiRowDragHandleProps instanceof Function
765
+ ? muiRowDragHandleProps({ row, table })
766
+ : muiRowDragHandleProps;
767
+ const handleDragStart = (event) => {
768
+ var _a;
769
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
770
+ event.dataTransfer.setDragImage(rowRef.current, 0, 0);
771
+ table.setDraggingRow(row);
772
+ };
773
+ const handleDragEnd = (event) => {
774
+ var _a;
775
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
776
+ table.setDraggingRow(null);
777
+ table.setHoveredRow(null);
778
+ };
779
+ return (jsx(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
780
+ };
781
+
782
+ const allowedTypes = ['string', 'number'];
783
+ const MRT_TableBodyCellValue = ({ cell, table, }) => {
784
+ var _a, _b, _c;
785
+ const { getState, options: { enableFilterMatchHighlighting }, } = table;
786
+ const { column, row } = cell;
787
+ const { columnDef } = column;
788
+ const { globalFilter, globalFilterFn } = getState();
789
+ const filterValue = column.getFilterValue();
790
+ let renderedCellValue = cell.getIsAggregated() && columnDef.AggregatedCell
791
+ ? columnDef.AggregatedCell({
792
+ cell,
793
+ column,
794
+ row,
795
+ table,
796
+ })
797
+ : row.getIsGrouped() && !cell.getIsGrouped()
798
+ ? null
799
+ : cell.getIsGrouped() && columnDef.GroupedCell
800
+ ? columnDef.GroupedCell({
801
+ cell,
802
+ column,
803
+ row,
804
+ table,
805
+ })
806
+ : undefined;
807
+ const isGroupedValue = renderedCellValue !== undefined;
808
+ if (!isGroupedValue) {
809
+ renderedCellValue = cell.renderValue();
810
+ }
811
+ if (enableFilterMatchHighlighting &&
812
+ columnDef.enableFilterMatchHighlighting !== false &&
813
+ renderedCellValue &&
814
+ allowedTypes.includes(typeof renderedCellValue) &&
815
+ ((filterValue &&
816
+ allowedTypes.includes(typeof filterValue) &&
817
+ columnDef.filterVariant === 'text') ||
818
+ (globalFilter &&
819
+ allowedTypes.includes(typeof globalFilter) &&
820
+ column.getCanGlobalFilter()))) {
821
+ const chunks = highlightWords === null || highlightWords === void 0 ? void 0 : highlightWords({
822
+ text: renderedCellValue === null || renderedCellValue === void 0 ? void 0 : renderedCellValue.toString(),
823
+ query: ((_a = filterValue !== null && filterValue !== void 0 ? filterValue : globalFilter) !== null && _a !== void 0 ? _a : '').toString(),
824
+ matchExactly: (filterValue ? columnDef._filterFn : globalFilterFn) !== 'fuzzy',
825
+ });
826
+ if ((chunks === null || chunks === void 0 ? void 0 : chunks.length) > 1 || ((_b = chunks === null || chunks === void 0 ? void 0 : chunks[0]) === null || _b === void 0 ? void 0 : _b.match)) {
827
+ renderedCellValue = (jsx("span", { "aria-label": renderedCellValue, role: "note", children: (_c = chunks === null || chunks === void 0 ? void 0 : chunks.map(({ key, match, text }) => (jsx(Box, { "aria-hidden": "true", component: "span", sx: match
828
+ ? {
829
+ backgroundColor: (theme) => theme.palette.mode === 'dark'
830
+ ? darken(theme.palette.warning.dark, 0.25)
831
+ : lighten(theme.palette.warning.light, 0.5),
832
+ borderRadius: '2px',
833
+ color: (theme) => theme.palette.mode === 'dark' ? 'white' : 'black',
834
+ padding: '2px 1px',
835
+ }
836
+ : undefined, children: text }, key)))) !== null && _c !== void 0 ? _c : renderedCellValue }));
837
+ }
838
+ }
839
+ if (columnDef.Cell && !isGroupedValue) {
840
+ renderedCellValue = columnDef.Cell({
841
+ cell,
842
+ renderedCellValue,
843
+ column,
844
+ row,
845
+ table,
846
+ });
847
+ }
848
+ return jsx(Fragment, { children: renderedCellValue });
849
+ };
850
+
851
+ const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, table, virtualCell, }) => {
852
+ var _a, _b, _c, _d;
853
+ const theme = useTheme();
854
+ const { getState, options: { createDisplayMode, editDisplayMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, enableRowNumbers, layoutMode, muiTableBodyCellProps, muiSkeletonProps, rowNumberMode, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
855
+ const { creatingRow, draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, density, isLoading, showSkeletons, } = getState();
856
+ const { column, row } = cell;
857
+ const { columnDef } = column;
858
+ const { columnDefType } = columnDef;
859
+ const mTableCellBodyProps = muiTableBodyCellProps instanceof Function
860
+ ? muiTableBodyCellProps({ cell, column, row, table })
861
+ : muiTableBodyCellProps;
862
+ const mcTableCellBodyProps = columnDef.muiTableBodyCellProps instanceof Function
863
+ ? columnDef.muiTableBodyCellProps({ cell, column, row, table })
864
+ : columnDef.muiTableBodyCellProps;
865
+ const tableCellProps = Object.assign(Object.assign({}, mTableCellBodyProps), mcTableCellBodyProps);
866
+ const skeletonProps = muiSkeletonProps instanceof Function
867
+ ? muiSkeletonProps({ cell, column, row, table })
868
+ : muiSkeletonProps;
869
+ const [skeletonWidth, setSkeletonWidth] = useState(100);
870
+ useEffect(() => {
871
+ if ((!isLoading && !showSkeletons) || skeletonWidth !== 100)
872
+ return;
873
+ const size = column.getSize();
874
+ setSkeletonWidth(columnDefType === 'display'
875
+ ? size / 2
876
+ : Math.round(Math.random() * (size - size / 3) + size / 3));
877
+ }, [isLoading, showSkeletons]);
878
+ const draggingBorders = useMemo(() => {
879
+ const isDraggingColumn = (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id;
880
+ const isHoveredColumn = (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id;
881
+ const isDraggingRow = (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id;
882
+ const isHoveredRow = (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id;
883
+ const isFirstColumn = getIsFirstColumn(column, table);
884
+ const isLastColumn = getIsLastColumn(column, table);
885
+ const isLastRow = rowIndex === numRows - 1;
886
+ const borderStyle = isDraggingColumn || isDraggingRow
887
+ ? `1px dashed ${theme.palette.text.secondary} !important`
888
+ : isHoveredColumn || isHoveredRow
889
+ ? `2px dashed ${theme.palette.primary.main} !important`
890
+ : undefined;
891
+ return borderStyle
892
+ ? {
893
+ borderLeft: isDraggingColumn ||
894
+ isHoveredColumn ||
895
+ ((isDraggingRow || isHoveredRow) && isFirstColumn)
896
+ ? borderStyle
897
+ : undefined,
898
+ borderRight: isDraggingColumn ||
899
+ isHoveredColumn ||
900
+ ((isDraggingRow || isHoveredRow) && isLastColumn)
901
+ ? borderStyle
902
+ : undefined,
903
+ borderBottom: isDraggingRow || isHoveredRow || isLastRow
904
+ ? borderStyle
905
+ : undefined,
906
+ borderTop: isDraggingRow || isHoveredRow ? borderStyle : undefined,
907
+ }
908
+ : undefined;
909
+ }, [draggingColumn, draggingRow, hoveredColumn, hoveredRow, rowIndex]);
910
+ const isEditable = (enableEditing instanceof Function ? enableEditing(row) : enableEditing) &&
911
+ (columnDef.enableEditing instanceof Function
912
+ ? columnDef.enableEditing(row)
913
+ : columnDef.enableEditing) !== false;
914
+ const isEditing = isEditable &&
915
+ !['modal', 'custom'].includes(editDisplayMode) &&
916
+ (editDisplayMode === 'table' ||
917
+ (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id ||
918
+ (editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) === cell.id) &&
919
+ !row.getIsGrouped();
920
+ const isCreating = isEditable && createDisplayMode === 'row' && (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
921
+ const handleDoubleClick = (event) => {
922
+ var _a;
923
+ (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDoubleClick) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
924
+ if (isEditable && editDisplayMode === 'cell') {
925
+ setEditingCell(cell);
926
+ queueMicrotask(() => {
927
+ var _a;
928
+ const textField = editInputRefs.current[column.id];
929
+ if (textField) {
930
+ textField.focus();
931
+ (_a = textField.select) === null || _a === void 0 ? void 0 : _a.call(textField);
932
+ }
933
+ });
934
+ }
935
+ };
936
+ const handleDragEnter = (e) => {
937
+ var _a;
938
+ (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDragEnter) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, e);
939
+ if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
940
+ setHoveredColumn(null);
941
+ }
942
+ if (enableColumnOrdering && draggingColumn) {
943
+ setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
944
+ }
945
+ };
946
+ return (jsx(TableCell, Object.assign({ "data-index": virtualCell === null || virtualCell === void 0 ? void 0 : virtualCell.index, ref: (node) => {
947
+ if (node) {
948
+ measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
949
+ }
950
+ } }, tableCellProps, { onDragEnter: handleDragEnter, onDoubleClick: handleDoubleClick, sx: (theme) => (Object.assign(Object.assign({ alignItems: layoutMode === 'grid' ? 'center' : undefined, cursor: isEditable && editDisplayMode === 'cell' ? 'pointer' : 'inherit', justifyContent: layoutMode === 'grid' ? tableCellProps.align : undefined, overflow: 'hidden', p: density === 'compact'
951
+ ? columnDefType === 'display'
952
+ ? '0 0.5rem'
953
+ : '0.5rem'
954
+ : density === 'comfortable'
955
+ ? columnDefType === 'display'
956
+ ? '0.5rem 0.75rem'
957
+ : '1rem'
958
+ : columnDefType === 'display'
959
+ ? '1rem 1.25rem'
960
+ : '1.5rem', pl: column.id === 'mrt-row-expand'
961
+ ? `${row.depth +
962
+ (density === 'compact'
963
+ ? 0.5
964
+ : density === 'comfortable'
965
+ ? 0.75
966
+ : 1.25)}rem`
967
+ : undefined, textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, whiteSpace: density === 'compact' ? 'nowrap' : 'normal', zIndex: (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id ? 2 : column.getIsPinned() ? 1 : 0, '&:hover': {
968
+ outline: ['table', 'cell'].includes(editDisplayMode !== null && editDisplayMode !== void 0 ? editDisplayMode : '')
969
+ ? `1px solid ${theme.palette.text.secondary}`
970
+ : undefined,
971
+ outlineOffset: '-1px',
972
+ textOverflow: 'clip',
973
+ } }, getCommonCellStyles({
974
+ column,
975
+ table,
976
+ theme,
977
+ tableCellProps,
978
+ })), draggingBorders)), children: jsxs(Fragment, { children: [cell.getIsPlaceholder() ? ((_b = (_a = columnDef.PlaceholderCell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table })) !== null && _b !== void 0 ? _b : null) : (isLoading || showSkeletons) && cell.getValue() === null ? (jsx(Skeleton, Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : enableRowNumbers &&
979
+ rowNumberMode === 'static' &&
980
+ column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (jsx(MRT_TableBodyRowGrabHandle, { row: row, rowRef: rowRef, table: table })) : columnDefType === 'display' &&
981
+ (column.id === 'mrt-row-select' ||
982
+ column.id === 'mrt-row-expand' ||
983
+ !row.getIsGrouped()) ? ((_c = columnDef.Cell) === null || _c === void 0 ? void 0 : _c.call(columnDef, {
984
+ cell,
985
+ renderedCellValue: cell.renderValue(),
986
+ column,
987
+ row,
988
+ table,
989
+ })) : isCreating || isEditing ? (jsx(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
990
+ columnDef.enableClickToCopy !== false ? (jsx(MRT_CopyButton, { cell: cell, table: table, children: jsx(MRT_TableBodyCellValue, { cell: cell, table: table }) })) : (jsx(MRT_TableBodyCellValue, { cell: cell, table: table })), cell.getIsGrouped() && !columnDef.GroupedCell && (jsxs(Fragment, { children: [" (", (_d = row.subRows) === null || _d === void 0 ? void 0 : _d.length, ")"] }))] }) })));
991
+ };
992
+ const Memo_MRT_TableBodyCell = memo(MRT_TableBodyCell, (prev, next) => next.cell === prev.cell);
993
+
994
+ const MRT_TableDetailPanel = ({ parentRowRef, row, rowIndex, table, virtualRow, }) => {
995
+ const { getVisibleLeafColumns, getState, options: { layoutMode, muiTableBodyRowProps, muiDetailPanelProps, renderDetailPanel, }, } = table;
996
+ const { isLoading } = getState();
997
+ const tableRowProps = muiTableBodyRowProps instanceof Function
998
+ ? muiTableBodyRowProps({
999
+ isDetailPanel: true,
1000
+ row,
1001
+ staticRowIndex: rowIndex,
1002
+ table,
1003
+ })
1004
+ : muiTableBodyRowProps;
1005
+ const tableCellProps = muiDetailPanelProps instanceof Function
1006
+ ? muiDetailPanelProps({ row, table })
1007
+ : muiDetailPanelProps;
1008
+ return (jsx(TableRow, Object.assign({ className: "Mui-TableBodyCell-DetailPanel" }, tableRowProps, { sx: (theme) => {
1009
+ var _a, _b;
1010
+ return (Object.assign({ display: layoutMode === 'grid' ? 'flex' : 'table-row', position: virtualRow ? 'absolute' : undefined, top: virtualRow
1011
+ ? `${(_b = (_a = parentRowRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.height}px`
1012
+ : undefined, transform: virtualRow
1013
+ ? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
1014
+ : undefined, width: '100%', zIndex: virtualRow ? 2 : undefined }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
1015
+ ? tableRowProps.sx(theme)
1016
+ : tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx)));
1017
+ }, children: jsx(TableCell, Object.assign({ className: "Mui-TableBodyCell-DetailPanel", colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ backgroundColor: virtualRow
1018
+ ? lighten(theme.palette.background.default, 0.06)
1019
+ : undefined, borderBottom: !row.getIsExpanded() ? 'none' : undefined, display: layoutMode === 'grid' ? 'flex' : 'table-cell', pb: row.getIsExpanded() ? '1rem' : 0, pt: row.getIsExpanded() ? '1rem' : 0, transition: 'all 150ms ease-in-out', width: `${table.getTotalSize()}px` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
1020
+ ? tableCellProps.sx(theme)
1021
+ : tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))), children: renderDetailPanel && (jsx(Collapse, { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: !isLoading && renderDetailPanel({ row, table }) })) })) })));
1022
+ };
1023
+
1024
+ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, row, rowIndex, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, virtualRow, }) => {
1025
+ const { getState, options: { enableRowOrdering, layoutMode, memoMode, muiTableBodyRowProps, renderDetailPanel, }, setHoveredRow, } = table;
1026
+ const { draggingColumn, draggingRow, editingCell, editingRow, hoveredRow } = getState();
1027
+ const tableRowProps = muiTableBodyRowProps instanceof Function
1028
+ ? muiTableBodyRowProps({ row, staticRowIndex: rowIndex, table })
1029
+ : muiTableBodyRowProps;
1030
+ const handleDragEnter = (_e) => {
1031
+ if (enableRowOrdering && draggingRow) {
1032
+ setHoveredRow(row);
1033
+ }
1034
+ };
1035
+ const rowRef = useRef(null);
1036
+ return (jsxs(Fragment, { children: [jsxs(TableRow, Object.assign({ "data-index": virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.index, onDragEnter: handleDragEnter, selected: row.getIsSelected(), ref: (node) => {
1037
+ if (node) {
1038
+ rowRef.current = node;
1039
+ measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
1040
+ }
1041
+ } }, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.06), boxSizing: 'border-box', display: layoutMode === 'grid' ? 'flex' : 'table-row', opacity: (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id ? 0.5 : 1, position: virtualRow ? 'absolute' : undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', top: virtualRow ? 0 : undefined, width: '100%', '&:hover td': {
1042
+ backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false
1043
+ ? row.getIsSelected()
1044
+ ? `${alpha(theme.palette.primary.main, 0.2)}`
1045
+ : theme.palette.mode === 'dark'
1046
+ ? `${lighten(theme.palette.background.default, 0.12)}`
1047
+ : `${darken(theme.palette.background.default, 0.05)}`
1048
+ : undefined,
1049
+ } }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
1050
+ ? tableRowProps.sx(theme)
1051
+ : tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))), style: Object.assign({ transform: virtualRow
1052
+ ? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
1053
+ : undefined }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style), children: [virtualPaddingLeft ? (jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : row.getVisibleCells()).map((cellOrVirtualCell) => {
1054
+ const cell = columnVirtualizer
1055
+ ? row.getVisibleCells()[cellOrVirtualCell.index]
1056
+ : cellOrVirtualCell;
1057
+ const props = {
1058
+ cell,
1059
+ measureElement: columnVirtualizer === null || columnVirtualizer === void 0 ? void 0 : columnVirtualizer.measureElement,
1060
+ numRows,
1061
+ rowIndex,
1062
+ rowRef,
1063
+ table,
1064
+ virtualCell: columnVirtualizer
1065
+ ? cellOrVirtualCell
1066
+ : undefined,
1067
+ };
1068
+ return memoMode === 'cells' &&
1069
+ cell.column.columnDef.columnDefType === 'data' &&
1070
+ !draggingColumn &&
1071
+ !draggingRow &&
1072
+ (editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) !== cell.id &&
1073
+ (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) !== row.id ? (jsx(Memo_MRT_TableBodyCell, Object.assign({}, props), cell.id)) : (jsx(MRT_TableBodyCell, Object.assign({}, props), cell.id));
1074
+ }), virtualPaddingRight ? (jsx("td", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })), renderDetailPanel && !row.getIsGrouped() && (jsx(MRT_TableDetailPanel, { parentRowRef: rowRef, row: row, rowIndex: rowIndex, table: table, virtualRow: virtualRow }))] }));
1075
+ };
1076
+ const Memo_MRT_TableBodyRow = memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row && prev.rowIndex === next.rowIndex);
1077
+
1078
+ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
1079
+ var _a, _b, _c, _d;
1080
+ const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, layoutMode, localization, manualExpanding, manualFiltering, manualGrouping, manualPagination, manualSorting, memoMode, muiTableBodyProps, renderEmptyRowsFallback, rowVirtualizerInstanceRef, rowVirtualizerOptions, }, refs: { tableContainerRef, tablePaperRef }, } = table;
1081
+ const { columnFilters, density, expanded, globalFilter, globalFilterFn, pagination, sorting, } = getState();
1082
+ const tableBodyProps = muiTableBodyProps instanceof Function
1083
+ ? muiTableBodyProps({ table })
1084
+ : muiTableBodyProps;
1085
+ const vProps = rowVirtualizerOptions instanceof Function
1086
+ ? rowVirtualizerOptions({ table })
1087
+ : rowVirtualizerOptions;
1088
+ const shouldRankResults = useMemo(() => !manualExpanding &&
1089
+ !manualFiltering &&
1090
+ !manualGrouping &&
1091
+ !manualSorting &&
1092
+ enableGlobalFilterRankedResults &&
1093
+ globalFilter &&
1094
+ globalFilterFn === 'fuzzy' &&
1095
+ expanded !== true &&
1096
+ !Object.values(sorting).some(Boolean) &&
1097
+ !Object.values(expanded).some(Boolean), [
1098
+ enableGlobalFilterRankedResults,
1099
+ expanded,
1100
+ globalFilter,
1101
+ manualExpanding,
1102
+ manualFiltering,
1103
+ manualGrouping,
1104
+ manualSorting,
1105
+ sorting,
1106
+ ]);
1107
+ const rows = useMemo(() => {
1108
+ if (!shouldRankResults)
1109
+ return getRowModel().rows;
1110
+ const rankedRows = getPrePaginationRowModel().rows.sort((a, b) => rankGlobalFuzzy(a, b));
1111
+ if (enablePagination && !manualPagination) {
1112
+ const start = pagination.pageIndex * pagination.pageSize;
1113
+ return rankedRows.slice(start, start + pagination.pageSize);
1114
+ }
1115
+ return rankedRows;
1116
+ }, [
1117
+ shouldRankResults,
1118
+ shouldRankResults ? getPrePaginationRowModel().rows : getRowModel().rows,
1119
+ pagination.pageIndex,
1120
+ pagination.pageSize,
1121
+ ]);
1122
+ const rowVirtualizer = enableRowVirtualization
1123
+ ? useVirtualizer(Object.assign({ count: rows.length, estimateSize: () => density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73, getScrollElement: () => tableContainerRef.current, measureElement: typeof window !== 'undefined' &&
1124
+ navigator.userAgent.indexOf('Firefox') === -1
1125
+ ? (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height
1126
+ : undefined, overscan: 4 }, vProps))
1127
+ : undefined;
1128
+ if (rowVirtualizerInstanceRef && rowVirtualizer) {
1129
+ rowVirtualizerInstanceRef.current = rowVirtualizer;
1130
+ }
1131
+ const virtualRows = rowVirtualizer
1132
+ ? rowVirtualizer.getVirtualItems()
1133
+ : undefined;
1134
+ return (jsx(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', height: rowVirtualizer
1135
+ ? `${rowVirtualizer.getTotalSize()}px`
1136
+ : 'inherit', minHeight: !rows.length ? '100px' : undefined, position: 'relative' }, ((tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx) instanceof Function
1137
+ ? tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx(theme)
1138
+ : tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx))), children: (_a = tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.children) !== null && _a !== void 0 ? _a : (!rows.length ? (jsx("tr", { style: { display: layoutMode === 'grid' ? 'grid' : 'table-row' }, children: jsx("td", { colSpan: table.getVisibleLeafColumns().length, style: {
1139
+ display: layoutMode === 'grid' ? 'grid' : 'table-cell',
1140
+ }, children: (_b = renderEmptyRowsFallback === null || renderEmptyRowsFallback === void 0 ? void 0 : renderEmptyRowsFallback({ table })) !== null && _b !== void 0 ? _b : (jsx(Typography, { sx: {
1141
+ color: 'text.secondary',
1142
+ fontStyle: 'italic',
1143
+ maxWidth: `min(100vw, ${(_d = (_c = tablePaperRef.current) === null || _c === void 0 ? void 0 : _c.clientWidth) !== null && _d !== void 0 ? _d : 360}px)`,
1144
+ py: '2rem',
1145
+ textAlign: 'center',
1146
+ width: '100%',
1147
+ }, children: globalFilter || columnFilters.length
1148
+ ? localization.noResultsFound
1149
+ : localization.noRecordsToDisplay })) }) })) : (jsx(Fragment, { children: (virtualRows !== null && virtualRows !== void 0 ? virtualRows : rows).map((rowOrVirtualRow, rowIndex) => {
1150
+ const row = rowVirtualizer
1151
+ ? rows[rowOrVirtualRow.index]
1152
+ : rowOrVirtualRow;
1153
+ const props = {
1154
+ columnVirtualizer,
1155
+ measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
1156
+ numRows: rows.length,
1157
+ row,
1158
+ rowIndex: rowVirtualizer ? rowOrVirtualRow.index : rowIndex,
1159
+ table,
1160
+ virtualColumns,
1161
+ virtualPaddingLeft,
1162
+ virtualPaddingRight,
1163
+ virtualRow: rowVirtualizer
1164
+ ? rowOrVirtualRow
1165
+ : undefined,
1166
+ };
1167
+ return memoMode === 'rows' ? (jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
1168
+ }) }))) })));
1169
+ };
1170
+ const Memo_MRT_TableBody = memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
1171
+
1172
+ const MRT_ExpandAllButton = ({ table, }) => {
1173
+ var _a, _b;
1174
+ const { getIsAllRowsExpanded, getIsSomeRowsExpanded, getCanSomeRowsExpand, getState, options: { icons: { KeyboardDoubleArrowDownIcon }, localization, muiExpandAllButtonProps, renderDetailPanel, }, toggleAllRowsExpanded, } = table;
1175
+ const { density, isLoading } = getState();
1176
+ const iconButtonProps = muiExpandAllButtonProps instanceof Function
1177
+ ? muiExpandAllButtonProps({ table })
1178
+ : muiExpandAllButtonProps;
1179
+ const isAllRowsExpanded = getIsAllRowsExpanded();
1180
+ return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: ((_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : isAllRowsExpanded)
1181
+ ? localization.collapseAll
1182
+ : localization.expandAll, children: jsx("span", { children: jsx(IconButton, Object.assign({ "aria-label": localization.expandAll, disabled: isLoading || (!renderDetailPanel && !getCanSomeRowsExpand()), onClick: () => toggleAllRowsExpanded(!isAllRowsExpanded) }, iconButtonProps, { sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', width: density === 'compact' ? '1.75rem' : '2.25rem', mt: density !== 'compact' ? '-0.25rem' : undefined }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
1183
+ ? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
1184
+ : iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined, children: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _b !== void 0 ? _b : (jsx(KeyboardDoubleArrowDownIcon, { style: {
1185
+ transform: `rotate(${isAllRowsExpanded ? -180 : getIsSomeRowsExpanded() ? -90 : 0}deg)`,
1186
+ transition: 'transform 150ms',
1187
+ } })) })) }) }));
1188
+ };
1189
+
1190
+ const MRT_ExpandButton = ({ row, table, }) => {
1191
+ var _a, _b;
1192
+ const { getState, options: { icons: { ExpandMoreIcon }, localization, muiExpandButtonProps, renderDetailPanel, }, } = table;
1193
+ const { density } = getState();
1194
+ const iconButtonProps = muiExpandButtonProps instanceof Function
1195
+ ? muiExpandButtonProps({ table, row })
1196
+ : muiExpandButtonProps;
1197
+ const canExpand = row.getCanExpand();
1198
+ const isExpanded = row.getIsExpanded();
1199
+ const handleToggleExpand = (event) => {
1200
+ var _a;
1201
+ event.stopPropagation();
1202
+ row.toggleExpanded();
1203
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1204
+ };
1205
+ return (jsx(Tooltip, { arrow: true, disableHoverListener: !canExpand && !renderDetailPanel, enterDelay: 1000, enterNextDelay: 1000, title: ((_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : isExpanded)
1206
+ ? localization.collapse
1207
+ : localization.expand, children: jsx("span", { children: jsx(IconButton, Object.assign({ "aria-label": localization.expand, disabled: !canExpand && !renderDetailPanel }, iconButtonProps, { onClick: handleToggleExpand, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', width: density === 'compact' ? '1.75rem' : '2.25rem' }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
1208
+ ? iconButtonProps.sx(theme)
1209
+ : iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined, children: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _b !== void 0 ? _b : (jsx(ExpandMoreIcon, { style: {
1210
+ transform: `rotate(${!canExpand && !renderDetailPanel ? -90 : isExpanded ? -180 : 0}deg)`,
1211
+ transition: 'transform 150ms',
1212
+ } })) })) }) }));
1213
+ };
1214
+
1215
+ const mrtFilterOptions = (localization) => [
1216
+ {
1217
+ option: 'fuzzy',
1218
+ symbol: '≈',
1219
+ label: localization.filterFuzzy,
1220
+ divider: false,
1221
+ },
1222
+ {
1223
+ option: 'contains',
1224
+ symbol: '*',
585
1225
  label: localization.filterContains,
586
1226
  divider: false,
587
1227
  },
@@ -661,6 +1301,7 @@ const mrtFilterOptions = (localization) => [
661
1301
  const rangeModes = ['between', 'betweenInclusive', 'inNumberRange'];
662
1302
  const emptyModes = ['empty', 'notEmpty'];
663
1303
  const arrModes = ['arrIncludesSome', 'arrIncludesAll', 'arrIncludes'];
1304
+ const rangeVariants = ['range-slider', 'date-range', 'range'];
664
1305
  const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilterValue, table, }) => {
665
1306
  var _a, _b, _c, _d;
666
1307
  const { getState, options: { columnFilterModeOptions, globalFilterModeOptions, localization, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
@@ -669,7 +1310,7 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilt
669
1310
  const { columnDef } = column !== null && column !== void 0 ? column : {};
670
1311
  const currentFilterValue = column === null || column === void 0 ? void 0 : column.getFilterValue();
671
1312
  let allowedColumnFilterOptions = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _a !== void 0 ? _a : columnFilterModeOptions;
672
- if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'range-slider') {
1313
+ if (rangeVariants.includes(columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant)) {
673
1314
  allowedColumnFilterOptions = [
674
1315
  ...rangeModes,
675
1316
  ...(allowedColumnFilterOptions !== null && allowedColumnFilterOptions !== void 0 ? allowedColumnFilterOptions : []),
@@ -781,7 +1422,7 @@ const commonListItemStyles = {
781
1422
  };
782
1423
  const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
783
1424
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
784
- const { getState, toggleAllColumnsVisible, setColumnOrder, options: { columnFilterModeOptions, enableColumnFilterModes, enableColumnFilters, enableColumnResizing, enableGrouping, enableHiding, enablePinning, enableSorting, enableSortingRemoval, icons: { ArrowRightIcon, ClearAllIcon, ViewColumnIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, SortIcon, RestartAltIcon, VisibilityOffIcon, }, localization, renderColumnActionsMenuItems, }, refs: { filterInputRefs }, setColumnSizingInfo, setShowColumnFilters, } = table;
1425
+ const { getState, toggleAllColumnsVisible, setColumnOrder, options: { columnFilterModeOptions, enableColumnFilterModes, enableColumnFilters, enableColumnResizing, enableGrouping, enableHiding, enableColumnPinning, enableSorting, enableSortingRemoval, icons: { ArrowRightIcon, ClearAllIcon, ViewColumnIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, SortIcon, RestartAltIcon, VisibilityOffIcon, }, localization, renderColumnActionsMenuItems, }, refs: { filterInputRefs }, setColumnSizingInfo, setShowColumnFilters, } = table;
785
1426
  const { column } = header;
786
1427
  const { columnDef } = column;
787
1428
  const { columnSizing, columnVisibility, density, showColumnFilters } = getState();
@@ -862,10 +1503,10 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
862
1503
  : []),
863
1504
  ...(enableGrouping && column.getCanGroup()
864
1505
  ? [
865
- jsx(MenuItem, { divider: enablePinning, onClick: handleGroupByColumn, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(DynamicFeedIcon, {}) }), (_e = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) === null || _e === void 0 ? void 0 : _e.replace('{column}', String(columnDef.header))] }) }, 6),
1506
+ jsx(MenuItem, { divider: enableColumnPinning, onClick: handleGroupByColumn, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(DynamicFeedIcon, {}) }), (_e = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) === null || _e === void 0 ? void 0 : _e.replace('{column}', String(columnDef.header))] }) }, 6),
866
1507
  ]
867
1508
  : []),
868
- ...(enablePinning && column.getCanPin()
1509
+ ...(enableColumnPinning && column.getCanPin()
869
1510
  ? [
870
1511
  jsx(MenuItem, { disabled: column.getIsPinned() === 'left' || !column.getCanPin(), onClick: () => handlePinColumn('left'), sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(PushPinIcon, { style: { transform: 'rotate(90deg)' } }) }), localization.pinToLeft] }) }, 7),
871
1512
  jsx(MenuItem, { disabled: column.getIsPinned() === 'right' || !column.getCanPin(), onClick: () => handlePinColumn('right'), sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(PushPinIcon, { style: { transform: 'rotate(-90deg)' } }) }), localization.pinToRight] }) }, 8),
@@ -915,30 +1556,49 @@ const MRT_RowActionMenu = ({ anchorEl, handleEdit, row, setAnchorEl, table, }) =
915
1556
  };
916
1557
 
917
1558
  const MRT_EditActionButtons = ({ row, table, variant = 'icon', }) => {
918
- const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onEditingRowSave, onEditingRowCancel, }, refs: { editInputRefs }, setEditingRow, } = table;
919
- const { editingRow } = getState();
1559
+ const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onCreatingRowCancel, onCreatingRowSave, onEditingRowSave, onEditingRowCancel, }, refs: { editInputRefs }, setCreatingRow, setEditingRow, } = table;
1560
+ const { creatingRow, editingRow, isSaving } = getState();
1561
+ const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
1562
+ const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
920
1563
  const handleCancel = () => {
921
- onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
922
- setEditingRow(null);
1564
+ if (isCreating) {
1565
+ onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
1566
+ setCreatingRow(null);
1567
+ }
1568
+ else if (isEditing) {
1569
+ onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
1570
+ setEditingRow(null);
1571
+ }
1572
+ row._valuesCache = {}; //reset values cache
923
1573
  };
924
- const handleSave = () => {
925
- var _a, _b;
1574
+ const handleSubmitRow = () => {
1575
+ var _a;
926
1576
  //look for auto-filled input values
927
- (_a = Object.values(editInputRefs === null || editInputRefs === void 0 ? void 0 : editInputRefs.current)) === null || _a === void 0 ? void 0 : _a.forEach((input) => {
1577
+ (_a = Object.values(editInputRefs === null || editInputRefs === void 0 ? void 0 : editInputRefs.current)
1578
+ .filter((inputRef) => { var _a, _b; return row.id === ((_b = (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.name) === null || _a === void 0 ? void 0 : _a.split('_')) === null || _b === void 0 ? void 0 : _b[0]); })) === null || _a === void 0 ? void 0 : _a.forEach((input) => {
928
1579
  if (input.value !== undefined &&
929
- Object.hasOwn(editingRow === null || editingRow === void 0 ? void 0 : editingRow._valuesCache, input.name)) {
1580
+ Object.hasOwn(row === null || row === void 0 ? void 0 : row._valuesCache, input.name)) {
930
1581
  // @ts-ignore
931
- editingRow._valuesCache[input.name] = input.value;
1582
+ row._valuesCache[input.name] = input.value;
932
1583
  }
933
1584
  });
934
- onEditingRowSave === null || onEditingRowSave === void 0 ? void 0 : onEditingRowSave({
935
- exitEditingMode: () => setEditingRow(null),
936
- row: editingRow !== null && editingRow !== void 0 ? editingRow : row,
937
- table,
938
- values: (_b = editingRow === null || editingRow === void 0 ? void 0 : editingRow._valuesCache) !== null && _b !== void 0 ? _b : Object.assign({}, row.original),
939
- });
1585
+ if (isCreating)
1586
+ onCreatingRowSave === null || onCreatingRowSave === void 0 ? void 0 : onCreatingRowSave({
1587
+ exitCreatingMode: () => setCreatingRow(null),
1588
+ row,
1589
+ table,
1590
+ values: row._valuesCache,
1591
+ });
1592
+ else if (isEditing) {
1593
+ onEditingRowSave === null || onEditingRowSave === void 0 ? void 0 : onEditingRowSave({
1594
+ exitEditingMode: () => setEditingRow(null),
1595
+ row,
1596
+ table,
1597
+ values: row === null || row === void 0 ? void 0 : row._valuesCache,
1598
+ });
1599
+ }
940
1600
  };
941
- return (jsx(Box, { onClick: (e) => e.stopPropagation(), sx: { display: 'flex', gap: '0.75rem' }, children: variant === 'icon' ? (jsxs(Fragment, { children: [jsx(Tooltip, { arrow: true, title: localization.cancel, children: jsx(IconButton, { "aria-label": localization.cancel, onClick: handleCancel, children: jsx(CancelIcon, {}) }) }), jsx(Tooltip, { arrow: true, title: localization.save, children: jsx(IconButton, { "aria-label": localization.save, color: "info", onClick: handleSave, children: jsx(SaveIcon, {}) }) })] })) : (jsxs(Fragment, { children: [jsx(Button, { onClick: handleCancel, children: localization.cancel }), jsx(Button, { onClick: handleSave, variant: "contained", children: localization.save })] })) }));
1601
+ return (jsx(Box, { onClick: (e) => e.stopPropagation(), sx: { display: 'flex', gap: '0.75rem' }, children: variant === 'icon' ? (jsxs(Fragment, { children: [jsx(Tooltip, { arrow: true, title: localization.cancel, children: jsx(IconButton, { "aria-label": localization.cancel, onClick: handleCancel, children: jsx(CancelIcon, {}) }) }), jsx(Tooltip, { arrow: true, title: localization.save, children: jsx(IconButton, { "aria-label": localization.save, color: "info", onClick: handleSubmitRow, children: isSaving ? jsx(CircularProgress, { size: 18 }) : jsx(SaveIcon, {}) }) })] })) : (jsxs(Fragment, { children: [jsx(Button, { sx: { minWidth: '100px' }, onClick: handleCancel, children: localization.cancel }), jsxs(Button, { sx: { minWidth: '100px' }, onClick: handleSubmitRow, variant: "contained", children: [isSaving && jsx(CircularProgress, { color: "inherit", size: 18 }), localization.save] })] })) }));
942
1602
  };
943
1603
 
944
1604
  const commonIconButtonStyles = {
@@ -952,8 +1612,12 @@ const commonIconButtonStyles = {
952
1612
  },
953
1613
  };
954
1614
  const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
955
- const { getState, options: { editingMode, enableEditing, icons: { EditIcon, MoreHorizIcon }, localization, renderRowActionMenuItems, renderRowActions, }, setEditingRow, } = table;
956
- const { editingRow } = getState();
1615
+ const { getState, options: { createDisplayMode, editDisplayMode, enableEditing, icons: { EditIcon, MoreHorizIcon }, localization, renderRowActionMenuItems, renderRowActions, }, setEditingRow, } = table;
1616
+ const { creatingRow, editingRow } = getState();
1617
+ const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
1618
+ const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
1619
+ const showEditActionButtons = (isCreating && createDisplayMode === 'row') ||
1620
+ (isEditing && editDisplayMode === 'row');
957
1621
  const [anchorEl, setAnchorEl] = useState(null);
958
1622
  const handleOpenRowActionMenu = (event) => {
959
1623
  event.stopPropagation();
@@ -965,13 +1629,13 @@ const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
965
1629
  setEditingRow(Object.assign({}, row));
966
1630
  setAnchorEl(null);
967
1631
  };
968
- return (jsx(Fragment, { children: renderRowActions ? (renderRowActions({ cell, row, table })) : row.id === (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) && editingMode === 'row' ? (jsx(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems &&
1632
+ return (jsx(Fragment, { children: renderRowActions && !showEditActionButtons ? (renderRowActions({ cell, row, table })) : showEditActionButtons ? (jsx(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems &&
969
1633
  (enableEditing instanceof Function
970
1634
  ? enableEditing(row)
971
1635
  : enableEditing) ? (jsx(Tooltip, { placement: "right", arrow: true, title: localization.edit, children: jsx(IconButton, { "aria-label": localization.edit, sx: commonIconButtonStyles, onClick: handleStartEditMode, children: jsx(EditIcon, {}) }) })) : renderRowActionMenuItems ? (jsxs(Fragment, { children: [jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions, children: jsx(IconButton, { "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles, children: jsx(MoreHorizIcon, {}) }) }), jsx(MRT_RowActionMenu, { anchorEl: anchorEl, handleEdit: handleStartEditMode, row: row, setAnchorEl: setAnchorEl, table: table })] })) : null }));
972
1636
  };
973
1637
 
974
- const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
1638
+ const MRT_SelectCheckbox = ({ row, selectAll, table, }) => {
975
1639
  var _a;
976
1640
  const { getState, options: { localization, enableMultiRowSelection, muiSelectCheckboxProps, muiSelectAllCheckboxProps, selectAllMode, }, } = table;
977
1641
  const { density, isLoading } = getState();
@@ -1009,6 +1673,288 @@ const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
1009
1673
  : row === null || row === void 0 ? void 0 : row.getIsSomeSelected() }, commonProps))) }));
1010
1674
  };
1011
1675
 
1676
+ const useMRT_DisplayColumns = ({ creatingRow, columnOrder, grouping, tableOptions, }) => {
1677
+ var _a, _b;
1678
+ return useMemo(() => {
1679
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
1680
+ return [
1681
+ ((_b = (_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.columnOrder) !== null && _b !== void 0 ? _b : columnOrder).includes('mrt-row-drag') && Object.assign(Object.assign(Object.assign({ Cell: ({ row, rowRef, table }) => (jsx(MRT_TableBodyRowGrabHandle, { row: row, rowRef: rowRef, table: table })), header: tableOptions.localization.move, size: 60 }, tableOptions.defaultDisplayColumn), (_c = tableOptions.displayColumnDefOptions) === null || _c === void 0 ? void 0 : _c['mrt-row-drag']), { id: 'mrt-row-drag' }),
1682
+ (((_e = (_d = tableOptions.state) === null || _d === void 0 ? void 0 : _d.columnOrder) !== null && _e !== void 0 ? _e : columnOrder).includes('mrt-row-actions') ||
1683
+ (creatingRow && tableOptions.createDisplayMode === 'row')) && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row, table }) => (jsx(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })), header: tableOptions.localization.actions, size: 70 }, tableOptions.defaultDisplayColumn), (_f = tableOptions.displayColumnDefOptions) === null || _f === void 0 ? void 0 : _f['mrt-row-actions']), { id: 'mrt-row-actions' }),
1684
+ ((_h = (_g = tableOptions.state) === null || _g === void 0 ? void 0 : _g.columnOrder) !== null && _h !== void 0 ? _h : columnOrder).includes('mrt-row-expand') &&
1685
+ showExpandColumn(tableOptions, (_k = (_j = tableOptions.state) === null || _j === void 0 ? void 0 : _j.grouping) !== null && _k !== void 0 ? _k : grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row, table }) => (jsx(MRT_ExpandButton, { row: row, table: table })), Header: tableOptions.enableExpandAll
1686
+ ? ({ table }) => jsx(MRT_ExpandAllButton, { table: table })
1687
+ : null, header: tableOptions.localization.expand, size: 60 }, tableOptions.defaultDisplayColumn), (_l = tableOptions.displayColumnDefOptions) === null || _l === void 0 ? void 0 : _l['mrt-row-expand']), { id: 'mrt-row-expand' }),
1688
+ ((_o = (_m = tableOptions.state) === null || _m === void 0 ? void 0 : _m.columnOrder) !== null && _o !== void 0 ? _o : columnOrder).includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row, table }) => (jsx(MRT_SelectCheckbox, { row: row, table: table })), Header: tableOptions.enableSelectAll &&
1689
+ tableOptions.enableMultiRowSelection
1690
+ ? ({ table }) => jsx(MRT_SelectCheckbox, { selectAll: true, table: table })
1691
+ : null, header: tableOptions.localization.select, size: 60 }, tableOptions.defaultDisplayColumn), (_p = tableOptions.displayColumnDefOptions) === null || _p === void 0 ? void 0 : _p['mrt-row-select']), { id: 'mrt-row-select' }),
1692
+ ((_r = (_q = tableOptions.state) === null || _q === void 0 ? void 0 : _q.columnOrder) !== null && _r !== void 0 ? _r : columnOrder).includes('mrt-row-numbers') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => row.index + 1, Header: () => tableOptions.localization.rowNumber, header: tableOptions.localization.rowNumbers, size: 60 }, tableOptions.defaultDisplayColumn), (_s = tableOptions.displayColumnDefOptions) === null || _s === void 0 ? void 0 : _s['mrt-row-numbers']), { id: 'mrt-row-numbers' }),
1693
+ ].filter(Boolean);
1694
+ }, [
1695
+ columnOrder,
1696
+ grouping,
1697
+ tableOptions.displayColumnDefOptions,
1698
+ tableOptions.editDisplayMode,
1699
+ tableOptions.enableColumnDragging,
1700
+ tableOptions.enableColumnFilterModes,
1701
+ tableOptions.enableColumnOrdering,
1702
+ tableOptions.enableEditing,
1703
+ tableOptions.enableExpandAll,
1704
+ tableOptions.enableExpanding,
1705
+ tableOptions.enableGrouping,
1706
+ tableOptions.enableRowActions,
1707
+ tableOptions.enableRowDragging,
1708
+ tableOptions.enableRowNumbers,
1709
+ tableOptions.enableRowOrdering,
1710
+ tableOptions.enableRowSelection,
1711
+ tableOptions.enableSelectAll,
1712
+ tableOptions.localization,
1713
+ tableOptions.positionActionsColumn,
1714
+ tableOptions.renderDetailPanel,
1715
+ tableOptions.renderRowActionMenuItems,
1716
+ tableOptions.renderRowActions,
1717
+ (_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.columnOrder,
1718
+ (_b = tableOptions.state) === null || _b === void 0 ? void 0 : _b.grouping,
1719
+ ]);
1720
+ };
1721
+
1722
+ const useMRT_Effects = (table) => {
1723
+ const { getState, options: { enablePagination, rowCount }, } = table;
1724
+ const { globalFilter, isFullScreen, pagination, sorting, isLoading, showSkeletons, } = getState();
1725
+ const isMounted = useRef(false);
1726
+ const initialBodyHeight = useRef();
1727
+ const previousTop = useRef();
1728
+ useEffect(() => {
1729
+ if (typeof window !== 'undefined') {
1730
+ initialBodyHeight.current = document.body.style.height;
1731
+ }
1732
+ }, []);
1733
+ useEffect(() => {
1734
+ if (isMounted && typeof window !== 'undefined') {
1735
+ if (isFullScreen) {
1736
+ previousTop.current = document.body.getBoundingClientRect().top; //save scroll position
1737
+ document.body.style.height = '100vh'; //hide page scrollbars when table is in full screen mode
1738
+ }
1739
+ else {
1740
+ document.body.style.height = initialBodyHeight.current;
1741
+ if (!previousTop.current)
1742
+ return;
1743
+ //restore scroll position
1744
+ window.scrollTo({
1745
+ top: -1 * previousTop.current,
1746
+ behavior: 'instant',
1747
+ });
1748
+ }
1749
+ }
1750
+ isMounted.current = true;
1751
+ }, [isFullScreen]);
1752
+ //if page index is out of bounds, set it to the last page
1753
+ useEffect(() => {
1754
+ if (!enablePagination || isLoading || showSkeletons)
1755
+ return;
1756
+ const { pageIndex, pageSize } = pagination;
1757
+ const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : table.getPrePaginationRowModel().rows.length;
1758
+ const firstVisibleRowIndex = pageIndex * pageSize;
1759
+ if (firstVisibleRowIndex > totalRowCount) {
1760
+ table.setPageIndex(Math.floor(totalRowCount / pageSize));
1761
+ }
1762
+ }, [rowCount, table.getPrePaginationRowModel().rows.length]);
1763
+ //turn off sort when global filter is looking for ranked results
1764
+ const appliedSort = useRef(sorting);
1765
+ useEffect(() => {
1766
+ if (sorting.length) {
1767
+ appliedSort.current = sorting;
1768
+ }
1769
+ }, [sorting]);
1770
+ useEffect(() => {
1771
+ if (!getCanRankRows(table))
1772
+ return;
1773
+ if (globalFilter) {
1774
+ table.setSorting([]);
1775
+ }
1776
+ else {
1777
+ table.setSorting(() => appliedSort.current || []);
1778
+ }
1779
+ }, [globalFilter]);
1780
+ };
1781
+
1782
+ const useMRT_TableInstance = (tableOptions) => {
1783
+ 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;
1784
+ const bottomToolbarRef = useRef(null);
1785
+ const editInputRefs = useRef({});
1786
+ const filterInputRefs = useRef({});
1787
+ const searchInputRef = useRef(null);
1788
+ const tableContainerRef = useRef(null);
1789
+ const tableHeadCellRefs = useRef({});
1790
+ const tablePaperRef = useRef(null);
1791
+ const topToolbarRef = useRef(null);
1792
+ const initialState = useMemo(() => {
1793
+ var _a, _b, _c;
1794
+ const initState = (_a = tableOptions.initialState) !== null && _a !== void 0 ? _a : {};
1795
+ initState.columnOrder =
1796
+ (_b = initState.columnOrder) !== null && _b !== void 0 ? _b : getDefaultColumnOrderIds(tableOptions);
1797
+ initState.globalFilterFn = (_c = tableOptions.globalFilterFn) !== null && _c !== void 0 ? _c : 'fuzzy';
1798
+ return initState;
1799
+ }, []);
1800
+ const [creatingRow, _setCreatingRow] = useState((_a = initialState.creatingRow) !== null && _a !== void 0 ? _a : null);
1801
+ const [columnFilterFns, setColumnFilterFns] = useState(() => Object.assign({}, ...getAllLeafColumnDefs(tableOptions.columns).map((col) => {
1802
+ var _a, _b, _c, _d;
1803
+ return ({
1804
+ [getColumnId(col)]: col.filterFn instanceof Function
1805
+ ? (_a = col.filterFn.name) !== null && _a !== void 0 ? _a : 'custom'
1806
+ : (_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),
1807
+ });
1808
+ })));
1809
+ const [columnOrder, setColumnOrder] = useState((_b = initialState.columnOrder) !== null && _b !== void 0 ? _b : []);
1810
+ const [density, setDensity] = useState((_c = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _c !== void 0 ? _c : 'comfortable');
1811
+ const [draggingColumn, setDraggingColumn] = useState((_d = initialState.draggingColumn) !== null && _d !== void 0 ? _d : null);
1812
+ const [draggingRow, setDraggingRow] = useState((_e = initialState.draggingRow) !== null && _e !== void 0 ? _e : null);
1813
+ const [editingCell, setEditingCell] = useState((_f = initialState.editingCell) !== null && _f !== void 0 ? _f : null);
1814
+ const [editingRow, setEditingRow] = useState((_g = initialState.editingRow) !== null && _g !== void 0 ? _g : null);
1815
+ const [globalFilterFn, setGlobalFilterFn] = useState((_h = initialState.globalFilterFn) !== null && _h !== void 0 ? _h : 'fuzzy');
1816
+ const [grouping, setGrouping] = useState((_j = initialState.grouping) !== null && _j !== void 0 ? _j : []);
1817
+ const [hoveredColumn, setHoveredColumn] = useState((_k = initialState.hoveredColumn) !== null && _k !== void 0 ? _k : null);
1818
+ const [hoveredRow, setHoveredRow] = useState((_l = initialState.hoveredRow) !== null && _l !== void 0 ? _l : null);
1819
+ const [isFullScreen, setIsFullScreen] = useState((_m = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _m !== void 0 ? _m : false);
1820
+ const [showAlertBanner, setShowAlertBanner] = useState((_p = (_o = tableOptions.initialState) === null || _o === void 0 ? void 0 : _o.showAlertBanner) !== null && _p !== void 0 ? _p : false);
1821
+ const [showColumnFilters, setShowColumnFilters] = useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _q !== void 0 ? _q : false);
1822
+ const [showGlobalFilter, setShowGlobalFilter] = useState((_r = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _r !== void 0 ? _r : false);
1823
+ const [showToolbarDropZone, setShowToolbarDropZone] = useState((_s = initialState === null || initialState === void 0 ? void 0 : initialState.showToolbarDropZone) !== null && _s !== void 0 ? _s : false);
1824
+ const displayColumns = useMRT_DisplayColumns({
1825
+ columnOrder,
1826
+ creatingRow,
1827
+ grouping,
1828
+ tableOptions,
1829
+ });
1830
+ const columnDefs = useMemo(() => {
1831
+ var _a, _b, _c;
1832
+ return prepareColumns({
1833
+ aggregationFns: tableOptions.aggregationFns,
1834
+ columnDefs: [...displayColumns, ...tableOptions.columns],
1835
+ columnFilterFns: (_b = (_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.columnFilterFns) !== null && _b !== void 0 ? _b : columnFilterFns,
1836
+ defaultDisplayColumn: (_c = tableOptions.defaultDisplayColumn) !== null && _c !== void 0 ? _c : {},
1837
+ filterFns: tableOptions.filterFns,
1838
+ sortingFns: tableOptions.sortingFns,
1839
+ });
1840
+ }, [
1841
+ columnFilterFns,
1842
+ displayColumns,
1843
+ tableOptions.columns,
1844
+ (_t = tableOptions.state) === null || _t === void 0 ? void 0 : _t.columnFilterFns,
1845
+ ]);
1846
+ const data = useMemo(() => {
1847
+ var _a, _b, _c, _d, _e;
1848
+ return (((_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.isLoading) || ((_b = tableOptions.state) === null || _b === void 0 ? void 0 : _b.showSkeletons)) &&
1849
+ !tableOptions.data.length
1850
+ ? [
1851
+ ...Array(((_d = (_c = tableOptions.state) === null || _c === void 0 ? void 0 : _c.pagination) === null || _d === void 0 ? void 0 : _d.pageSize) ||
1852
+ ((_e = initialState === null || initialState === void 0 ? void 0 : initialState.pagination) === null || _e === void 0 ? void 0 : _e.pageSize) ||
1853
+ 10).fill(null),
1854
+ ].map(() => Object.assign({}, ...getAllLeafColumnDefs(tableOptions.columns).map((col) => ({
1855
+ [getColumnId(col)]: null,
1856
+ }))))
1857
+ : tableOptions.data;
1858
+ }, [
1859
+ tableOptions.data,
1860
+ (_u = tableOptions.state) === null || _u === void 0 ? void 0 : _u.isLoading,
1861
+ (_v = tableOptions.state) === null || _v === void 0 ? void 0 : _v.showSkeletons,
1862
+ ]);
1863
+ //@ts-ignore
1864
+ const table = useReactTable(Object.assign(Object.assign({ getCoreRowModel: getCoreRowModel(), getExpandedRowModel: tableOptions.enableExpanding || tableOptions.enableGrouping
1865
+ ? getExpandedRowModel()
1866
+ : undefined, getFacetedMinMaxValues: tableOptions.enableFacetedValues
1867
+ ? getFacetedMinMaxValues()
1868
+ : undefined, getFacetedRowModel: tableOptions.enableFacetedValues
1869
+ ? getFacetedRowModel()
1870
+ : undefined, getFacetedUniqueValues: tableOptions.enableFacetedValues
1871
+ ? getFacetedUniqueValues()
1872
+ : undefined, getFilteredRowModel: tableOptions.enableColumnFilters ||
1873
+ tableOptions.enableGlobalFilter ||
1874
+ tableOptions.enableFilters
1875
+ ? getFilteredRowModel()
1876
+ : undefined, getGroupedRowModel: tableOptions.enableGrouping
1877
+ ? getGroupedRowModel()
1878
+ : undefined, getPaginationRowModel: tableOptions.enablePagination
1879
+ ? getPaginationRowModel()
1880
+ : undefined, getSortedRowModel: tableOptions.enableSorting
1881
+ ? getSortedRowModel()
1882
+ : undefined, onColumnOrderChange: setColumnOrder, onGroupingChange: setGrouping, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows }, tableOptions), {
1883
+ //@ts-ignore
1884
+ columns: columnDefs, data, globalFilterFn: (_w = tableOptions.filterFns) === null || _w === void 0 ? void 0 : _w[globalFilterFn !== null && globalFilterFn !== void 0 ? globalFilterFn : 'fuzzy'], initialState, state: Object.assign({ creatingRow,
1885
+ columnFilterFns,
1886
+ columnOrder,
1887
+ density,
1888
+ draggingColumn,
1889
+ draggingRow,
1890
+ editingCell,
1891
+ editingRow,
1892
+ globalFilterFn,
1893
+ grouping,
1894
+ hoveredColumn,
1895
+ hoveredRow,
1896
+ isFullScreen,
1897
+ showAlertBanner,
1898
+ showColumnFilters,
1899
+ showGlobalFilter,
1900
+ showToolbarDropZone }, tableOptions.state) }));
1901
+ // @ts-ignore
1902
+ table.refs = {
1903
+ // @ts-ignore
1904
+ bottomToolbarRef,
1905
+ editInputRefs,
1906
+ filterInputRefs,
1907
+ // @ts-ignore
1908
+ searchInputRef,
1909
+ // @ts-ignore
1910
+ tableContainerRef,
1911
+ tableHeadCellRefs,
1912
+ // @ts-ignore
1913
+ tablePaperRef,
1914
+ // @ts-ignore
1915
+ topToolbarRef,
1916
+ };
1917
+ const setCreatingRow = (row) => {
1918
+ if (row === true) {
1919
+ table.setCreatingRow(createRow(table));
1920
+ }
1921
+ else {
1922
+ _setCreatingRow(row);
1923
+ }
1924
+ };
1925
+ table.setCreatingRow = setCreatingRow;
1926
+ table.setColumnFilterFns =
1927
+ (_x = tableOptions.onColumnFilterFnsChange) !== null && _x !== void 0 ? _x : setColumnFilterFns;
1928
+ table.setDensity = (_y = tableOptions.onDensityChange) !== null && _y !== void 0 ? _y : setDensity;
1929
+ table.setDraggingColumn =
1930
+ (_z = tableOptions.onDraggingColumnChange) !== null && _z !== void 0 ? _z : setDraggingColumn;
1931
+ table.setDraggingRow = (_0 = tableOptions.onDraggingRowChange) !== null && _0 !== void 0 ? _0 : setDraggingRow;
1932
+ table.setEditingCell = (_1 = tableOptions.onEditingCellChange) !== null && _1 !== void 0 ? _1 : setEditingCell;
1933
+ table.setEditingRow = (_2 = tableOptions.onEditingRowChange) !== null && _2 !== void 0 ? _2 : setEditingRow;
1934
+ table.setGlobalFilterFn =
1935
+ (_3 = tableOptions.onGlobalFilterFnChange) !== null && _3 !== void 0 ? _3 : setGlobalFilterFn;
1936
+ table.setHoveredColumn =
1937
+ (_4 = tableOptions.onHoveredColumnChange) !== null && _4 !== void 0 ? _4 : setHoveredColumn;
1938
+ table.setHoveredRow = (_5 = tableOptions.onHoveredRowChange) !== null && _5 !== void 0 ? _5 : setHoveredRow;
1939
+ table.setIsFullScreen = (_6 = tableOptions.onIsFullScreenChange) !== null && _6 !== void 0 ? _6 : setIsFullScreen;
1940
+ table.setShowAlertBanner =
1941
+ (_7 = tableOptions.onShowAlertBannerChange) !== null && _7 !== void 0 ? _7 : setShowAlertBanner;
1942
+ table.setShowColumnFilters =
1943
+ (_8 = tableOptions.onShowColumnFiltersChange) !== null && _8 !== void 0 ? _8 : setShowColumnFilters;
1944
+ table.setShowGlobalFilter =
1945
+ (_9 = tableOptions.onShowGlobalFilterChange) !== null && _9 !== void 0 ? _9 : setShowGlobalFilter;
1946
+ table.setShowToolbarDropZone =
1947
+ (_10 = tableOptions.onShowToolbarDropZoneChange) !== null && _10 !== void 0 ? _10 : setShowToolbarDropZone;
1948
+ useMRT_Effects(table);
1949
+ return table;
1950
+ };
1951
+
1952
+ const useMaterialReactTable = (tableOptions) => {
1953
+ const parsedTableOptions = useMRT_TableOptions(tableOptions);
1954
+ const tableInstance = useMRT_TableInstance(parsedTableOptions);
1955
+ return tableInstance;
1956
+ };
1957
+
1012
1958
  const MRT_GlobalFilterTextField = ({ table, }) => {
1013
1959
  var _a;
1014
1960
  const { getState, setGlobalFilter, options: { enableGlobalFilterModes, icons: { SearchIcon, CloseIcon }, localization, manualFiltering, muiSearchTextFieldProps, }, refs: { searchInputRef }, } = table;
@@ -1132,49 +2078,34 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
1132
2078
  : alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx))), children: [(alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && jsx(AlertTitle, { children: alertProps.title }), jsxs(Box, { sx: { p: '0.5rem 1rem' }, children: [alertProps === null || alertProps === void 0 ? void 0 : alertProps.children, (alertProps === null || alertProps === void 0 ? void 0 : alertProps.children) && (selectMessage || groupedByMessage) && (jsx("br", {})), selectMessage, selectMessage && groupedByMessage && jsx("br", {}), groupedByMessage] })] })) }));
1133
2079
  };
1134
2080
 
1135
- const MRT_FullScreenToggleButton = (_a) => {
2081
+ const MRT_ToggleFullScreenButton = (_a) => {
1136
2082
  var _b;
1137
2083
  var { table } = _a, rest = __rest(_a, ["table"]);
1138
2084
  const { getState, options: { icons: { FullscreenExitIcon, FullscreenIcon }, localization, }, setIsFullScreen, } = table;
1139
2085
  const { isFullScreen } = getState();
2086
+ const [tooltipOpened, setTooltipOpened] = useState(false);
1140
2087
  const handleToggleFullScreen = () => {
2088
+ setTooltipOpened(false);
1141
2089
  setIsFullScreen(!isFullScreen);
1142
2090
  };
1143
- return (jsx(Tooltip, { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsx(IconButton, Object.assign({ "aria-label": localization.showHideFilters, onClick: handleToggleFullScreen }, rest, { title: undefined, children: isFullScreen ? jsx(FullscreenExitIcon, {}) : jsx(FullscreenIcon, {}) })) }));
2091
+ return (jsx(Tooltip, { open: tooltipOpened, arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsx(IconButton, Object.assign({ "aria-label": localization.showHideFilters, onClick: handleToggleFullScreen, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false) }, rest, { title: undefined, children: isFullScreen ? jsx(FullscreenExitIcon, {}) : jsx(FullscreenIcon, {}) })) }));
1144
2092
  };
1145
2093
 
1146
2094
  const MRT_ColumnPinningButtons = ({ column, table, }) => {
1147
2095
  const { options: { icons: { PushPinIcon }, localization, }, } = table;
1148
2096
  const handlePinColumn = (pinDirection) => {
1149
- column.pin(pinDirection);
1150
- };
1151
- return (jsx(Box, { sx: { minWidth: '70px', textAlign: 'center' }, children: column.getIsPinned() ? (jsx(Tooltip, { arrow: true, title: localization.unpin, children: jsx(IconButton, { onClick: () => handlePinColumn(false), size: "small", children: jsx(PushPinIcon, {}) }) })) : (jsxs(Fragment, { children: [jsx(Tooltip, { arrow: true, title: localization.pinToLeft, children: jsx(IconButton, { onClick: () => handlePinColumn('left'), size: "small", children: jsx(PushPinIcon, { style: {
1152
- transform: 'rotate(90deg)',
1153
- } }) }) }), jsx(Tooltip, { arrow: true, title: localization.pinToRight, children: jsx(IconButton, { onClick: () => handlePinColumn('right'), size: "small", children: jsx(PushPinIcon, { style: {
1154
- transform: 'rotate(-90deg)',
1155
- } }) }) })] })) }));
1156
- };
1157
-
1158
- const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table, }) => {
1159
- var _a;
1160
- const { options: { icons: { DragHandleIcon }, localization, }, } = table;
1161
- return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : localization.move, children: jsx(IconButton, Object.assign({ disableRipple: true, draggable: "true", size: "small" }, iconButtonProps, { onClick: (e) => {
1162
- var _a;
1163
- e.stopPropagation();
1164
- (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, e);
1165
- }, onDragStart: onDragStart, onDragEnd: onDragEnd, sx: (theme) => (Object.assign({ cursor: 'grab', m: '0 -0.1rem', opacity: 0.5, p: '2px', transition: 'all 150ms ease-in-out', '&:hover': {
1166
- backgroundColor: 'transparent',
1167
- opacity: 1,
1168
- }, '&:active': {
1169
- cursor: 'grabbing',
1170
- } }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
1171
- ? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
1172
- : iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined, children: jsx(DragHandleIcon, {}) })) }));
2097
+ column.pin(pinDirection);
2098
+ };
2099
+ return (jsx(Box, { sx: { minWidth: '70px', textAlign: 'center' }, children: column.getIsPinned() ? (jsx(Tooltip, { arrow: true, title: localization.unpin, children: jsx(IconButton, { onClick: () => handlePinColumn(false), size: "small", children: jsx(PushPinIcon, {}) }) })) : (jsxs(Fragment, { children: [jsx(Tooltip, { arrow: true, title: localization.pinToLeft, children: jsx(IconButton, { onClick: () => handlePinColumn('left'), size: "small", children: jsx(PushPinIcon, { style: {
2100
+ transform: 'rotate(90deg)',
2101
+ } }) }) }), jsx(Tooltip, { arrow: true, title: localization.pinToRight, children: jsx(IconButton, { onClick: () => handlePinColumn('right'), size: "small", children: jsx(PushPinIcon, { style: {
2102
+ transform: 'rotate(-90deg)',
2103
+ } }) }) })] })) }));
1173
2104
  };
1174
2105
 
1175
2106
  const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredColumn, column, table, }) => {
1176
2107
  var _a;
1177
- const { getState, options: { enableColumnOrdering, enableHiding, enablePinning, localization, }, setColumnOrder, } = table;
2108
+ const { getState, options: { enableColumnOrdering, enableHiding, enableColumnPinning, localization, }, setColumnOrder, } = table;
1178
2109
  const { columnOrder } = getState();
1179
2110
  const { columnDef } = column;
1180
2111
  const { columnDefType } = columnDef;
@@ -1230,7 +2161,7 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredCol
1230
2161
  }, children: [columnDefType !== 'group' &&
1231
2162
  enableColumnOrdering &&
1232
2163
  !allColumns.some((col) => col.columnDef.columnDefType === 'group') &&
1233
- (columnDef.enableColumnOrdering !== false ? (jsx(MRT_GrabHandleButton, { onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })) : (jsx(Box, { sx: { width: '28px' } }))), enablePinning &&
2164
+ (columnDef.enableColumnOrdering !== false ? (jsx(MRT_GrabHandleButton, { onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })) : (jsx(Box, { sx: { width: '28px' } }))), enableColumnPinning &&
1234
2165
  (column.getCanPin() ? (jsx(MRT_ColumnPinningButtons, { column: column, table: table })) : (jsx(Box, { sx: { width: '70px' } }))), enableHiding ? (jsx(FormControlLabel, { componentsProps: {
1235
2166
  typography: {
1236
2167
  sx: {
@@ -1242,7 +2173,7 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredCol
1242
2173
  };
1243
2174
 
1244
2175
  const MRT_ShowHideColumnsMenu = ({ anchorEl, setAnchorEl, table, }) => {
1245
- const { getAllColumns, getAllLeafColumns, getCenterLeafColumns, getIsAllColumnsVisible, getIsSomeColumnsPinned, getIsSomeColumnsVisible, getLeftLeafColumns, getRightLeafColumns, getState, toggleAllColumnsVisible, options: { enableColumnOrdering, enableHiding, enablePinning, localization, }, } = table;
2176
+ const { getAllColumns, getAllLeafColumns, getCenterLeafColumns, getIsAllColumnsVisible, getIsSomeColumnsPinned, getIsSomeColumnsVisible, getLeftLeafColumns, getRightLeafColumns, getState, toggleAllColumnsVisible, options: { enableColumnOrdering, enableHiding, enableColumnPinning, localization, }, } = table;
1246
2177
  const { density, columnOrder, columnPinning } = getState();
1247
2178
  const hideAllColumns = () => {
1248
2179
  getAllLeafColumns()
@@ -1276,7 +2207,7 @@ const MRT_ShowHideColumnsMenu = ({ anchorEl, setAnchorEl, table, }) => {
1276
2207
  justifyContent: 'space-between',
1277
2208
  p: '0.5rem',
1278
2209
  pt: 0,
1279
- }, children: [enableHiding && (jsx(Button, { disabled: !getIsSomeColumnsVisible(), onClick: hideAllColumns, children: localization.hideAll })), enableColumnOrdering && (jsx(Button, { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options)), children: localization.resetOrder })), enablePinning && (jsx(Button, { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true), children: localization.unpinAll })), enableHiding && (jsx(Button, { disabled: getIsAllColumnsVisible(), onClick: () => toggleAllColumnsVisible(true), children: localization.showAll }))] }), jsx(Divider, {}), allColumns.map((column, index) => (jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] }));
2210
+ }, children: [enableHiding && (jsx(Button, { disabled: !getIsSomeColumnsVisible(), onClick: hideAllColumns, children: localization.hideAll })), enableColumnOrdering && (jsx(Button, { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options)), children: localization.resetOrder })), enableColumnPinning && (jsx(Button, { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true), children: localization.unpinAll })), enableHiding && (jsx(Button, { disabled: getIsAllColumnsVisible(), onClick: () => toggleAllColumnsVisible(true), children: localization.showAll }))] }), jsx(Divider, {}), allColumns.map((column, index) => (jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] }));
1280
2211
  };
1281
2212
 
1282
2213
  const MRT_ShowHideColumnsButton = (_a) => {
@@ -1331,7 +2262,7 @@ const MRT_ToggleGlobalFilterButton = (_a) => {
1331
2262
 
1332
2263
  const MRT_ToolbarInternalButtons = ({ table, }) => {
1333
2264
  var _a;
1334
- const { options: { enableColumnFilters, enableColumnOrdering, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enablePinning, initialState, renderToolbarInternalActions, }, } = table;
2265
+ const { options: { enableColumnFilters, enableColumnOrdering, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enableColumnPinning, initialState, renderToolbarInternalActions, }, } = table;
1335
2266
  return (jsx(Box, { sx: {
1336
2267
  alignItems: 'center',
1337
2268
  display: 'flex',
@@ -1340,7 +2271,7 @@ const MRT_ToolbarInternalButtons = ({ table, }) => {
1340
2271
  table,
1341
2272
  })) !== null && _a !== void 0 ? _a : (jsxs(Fragment, { children: [enableFilters &&
1342
2273
  enableGlobalFilter &&
1343
- !(initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) && (jsx(MRT_ToggleGlobalFilterButton, { table: table })), enableFilters && enableColumnFilters && (jsx(MRT_ToggleFiltersButton, { table: table })), (enableHiding || enableColumnOrdering || enablePinning) && (jsx(MRT_ShowHideColumnsButton, { table: table })), enableDensityToggle && (jsx(MRT_ToggleDensePaddingButton, { table: table })), enableFullScreenToggle && (jsx(MRT_FullScreenToggleButton, { table: table }))] })) }));
2274
+ !(initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) && (jsx(MRT_ToggleGlobalFilterButton, { table: table })), enableFilters && enableColumnFilters && (jsx(MRT_ToggleFiltersButton, { table: table })), (enableHiding || enableColumnOrdering || enableColumnPinning) && (jsx(MRT_ShowHideColumnsButton, { table: table })), enableDensityToggle && (jsx(MRT_ToggleDensePaddingButton, { table: table })), enableFullScreenToggle && (jsx(MRT_ToggleFullScreenButton, { table: table }))] })) }));
1344
2275
  };
1345
2276
 
1346
2277
  const MRT_ToolbarDropZone = ({ table, }) => {
@@ -1459,7 +2390,7 @@ const MRT_BottomToolbar = ({ table, }) => {
1459
2390
 
1460
2391
  const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
1461
2392
  var _a;
1462
- const { options: { icons: { MoreVertIcon }, localization, muiTableHeadCellColumnActionsButtonProps, }, } = table;
2393
+ const { options: { icons: { MoreVertIcon }, localization, muiColumnActionsButtonProps, }, } = table;
1463
2394
  const { column } = header;
1464
2395
  const { columnDef } = column;
1465
2396
  const [anchorEl, setAnchorEl] = useState(null);
@@ -1468,15 +2399,15 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
1468
2399
  event.preventDefault();
1469
2400
  setAnchorEl(event.currentTarget);
1470
2401
  };
1471
- const mTableHeadCellColumnActionsButtonProps = muiTableHeadCellColumnActionsButtonProps instanceof Function
1472
- ? muiTableHeadCellColumnActionsButtonProps({ column, table })
1473
- : muiTableHeadCellColumnActionsButtonProps;
1474
- const mcTableHeadCellColumnActionsButtonProps = columnDef.muiTableHeadCellColumnActionsButtonProps instanceof Function
1475
- ? columnDef.muiTableHeadCellColumnActionsButtonProps({
2402
+ const mTableHeadCellColumnActionsButtonProps = muiColumnActionsButtonProps instanceof Function
2403
+ ? muiColumnActionsButtonProps({ column, table })
2404
+ : muiColumnActionsButtonProps;
2405
+ const mcTableHeadCellColumnActionsButtonProps = columnDef.muiColumnActionsButtonProps instanceof Function
2406
+ ? columnDef.muiColumnActionsButtonProps({
1476
2407
  column,
1477
2408
  table,
1478
2409
  })
1479
- : columnDef.muiTableHeadCellColumnActionsButtonProps;
2410
+ : columnDef.muiColumnActionsButtonProps;
1480
2411
  const iconButtonProps = Object.assign(Object.assign({}, mTableHeadCellColumnActionsButtonProps), mcTableHeadCellColumnActionsButtonProps);
1481
2412
  return (jsxs(Fragment, { children: [jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : localization.columnActions, children: jsx(IconButton, Object.assign({ "aria-label": localization.columnActions, onClick: handleClick, size: "small" }, iconButtonProps, { sx: (theme) => (Object.assign({ height: '2rem', m: '-8px -4px', opacity: 0.5, transform: 'scale(0.85) translateX(-4px)', transition: 'opacity 150ms', width: '2rem', '&:hover': {
1482
2413
  opacity: 1,
@@ -1487,23 +2418,23 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
1487
2418
 
1488
2419
  const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1489
2420
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1490
- const { options: { enableColumnFilterModes, columnFilterModeOptions, icons: { FilterListIcon, CloseIcon }, localization, manualFiltering, muiTableHeadCellFilterTextFieldProps, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
2421
+ const { options: { enableColumnFilterModes, columnFilterModeOptions, icons: { FilterListIcon, CloseIcon }, localization, manualFiltering, muiFilterTextFieldProps, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
1491
2422
  const { column } = header;
1492
2423
  const { columnDef } = column;
1493
- const mTableHeadCellFilterTextFieldProps = muiTableHeadCellFilterTextFieldProps instanceof Function
1494
- ? muiTableHeadCellFilterTextFieldProps({
2424
+ const mTableHeadCellFilterTextFieldProps = muiFilterTextFieldProps instanceof Function
2425
+ ? muiFilterTextFieldProps({
1495
2426
  column,
1496
2427
  table,
1497
2428
  rangeFilterIndex,
1498
2429
  })
1499
- : muiTableHeadCellFilterTextFieldProps;
1500
- const mcTableHeadCellFilterTextFieldProps = columnDef.muiTableHeadCellFilterTextFieldProps instanceof Function
1501
- ? columnDef.muiTableHeadCellFilterTextFieldProps({
2430
+ : muiFilterTextFieldProps;
2431
+ const mcTableHeadCellFilterTextFieldProps = columnDef.muiFilterTextFieldProps instanceof Function
2432
+ ? columnDef.muiFilterTextFieldProps({
1502
2433
  column,
1503
2434
  table,
1504
2435
  rangeFilterIndex,
1505
2436
  })
1506
- : columnDef.muiTableHeadCellFilterTextFieldProps;
2437
+ : columnDef.muiFilterTextFieldProps;
1507
2438
  const textFieldProps = Object.assign(Object.assign({}, mTableHeadCellFilterTextFieldProps), mcTableHeadCellFilterTextFieldProps);
1508
2439
  const isRangeFilter = columnDef.filterVariant === 'range' || rangeFilterIndex !== undefined;
1509
2440
  const isSelectFilter = columnDef.filterVariant === 'select';
@@ -1533,7 +2464,9 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1533
2464
  const filterSelectOptions = useMemo(() => {
1534
2465
  var _a;
1535
2466
  return (_a = columnDef.filterSelectOptions) !== null && _a !== void 0 ? _a : ((isSelectFilter || isMultiSelectFilter) && facetedUniqueValues
1536
- ? Array.from(facetedUniqueValues.keys()).sort((a, b) => a.localeCompare(b))
2467
+ ? Array.from(facetedUniqueValues.keys())
2468
+ .filter((value) => value !== null && value !== undefined)
2469
+ .sort((a, b) => a.localeCompare(b))
1537
2470
  : undefined);
1538
2471
  }, [
1539
2472
  columnDef.filterSelectOptions,
@@ -1680,966 +2613,442 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1680
2613
  value = option;
1681
2614
  text = option;
1682
2615
  }
1683
- else {
1684
- value = option.value;
1685
- text = option.text;
1686
- }
1687
- return (jsxs(MenuItem, { sx: {
1688
- display: 'flex',
1689
- m: 0,
1690
- alignItems: 'center',
1691
- gap: '0.5rem',
1692
- }, value: value, children: [isMultiSelectFilter && (jsx(Checkbox, { checked: ((_a = column.getFilterValue()) !== null && _a !== void 0 ? _a : []).includes(value), sx: { mr: '0.5rem' } })), text, ' ', !columnDef.filterSelectOptions &&
1693
- `(${facetedUniqueValues.get(value)})`] }, value));
1694
- })] })), jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table, setFilterValue: setFilterValue })] }));
1695
- };
1696
-
1697
- const MRT_FilterRangeFields = ({ header, table }) => {
1698
- return (jsxs(Box, { sx: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '1rem' }, children: [jsx(MRT_FilterTextField, { header: header, rangeFilterIndex: 0, table: table }), jsx(MRT_FilterTextField, { header: header, rangeFilterIndex: 1, table: table })] }));
1699
- };
1700
-
1701
- const MRT_FilterCheckbox = ({ column, table }) => {
1702
- var _a, _b, _c;
1703
- const { getState, options: { localization, muiTableHeadCellFilterCheckboxProps }, } = table;
1704
- const { density } = getState();
1705
- const { columnDef } = column;
1706
- const mTableHeadCellFilterCheckboxProps = muiTableHeadCellFilterCheckboxProps instanceof Function
1707
- ? muiTableHeadCellFilterCheckboxProps({
1708
- column,
1709
- table,
1710
- })
1711
- : muiTableHeadCellFilterCheckboxProps;
1712
- const mcTableHeadCellFilterCheckboxProps = columnDef.muiTableHeadCellFilterCheckboxProps instanceof Function
1713
- ? columnDef.muiTableHeadCellFilterCheckboxProps({
1714
- column,
1715
- table,
1716
- })
1717
- : columnDef.muiTableHeadCellFilterCheckboxProps;
1718
- const checkboxProps = Object.assign(Object.assign({}, mTableHeadCellFilterCheckboxProps), mcTableHeadCellFilterCheckboxProps);
1719
- const filterLabel = (_a = localization.filterByColumn) === null || _a === void 0 ? void 0 : _a.replace('{column}', columnDef.header);
1720
- return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_b = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _b !== void 0 ? _b : filterLabel, children: jsx(FormControlLabel, { control: jsx(Checkbox, Object.assign({ checked: column.getFilterValue() === 'true', indeterminate: column.getFilterValue() === undefined, color: column.getFilterValue() === undefined ? 'default' : 'primary', size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { onClick: (e) => {
1721
- var _a;
1722
- e.stopPropagation();
1723
- (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
1724
- }, onChange: (e, checked) => {
1725
- var _a;
1726
- column.setFilterValue(column.getFilterValue() === undefined
1727
- ? 'true'
1728
- : column.getFilterValue() === 'true'
1729
- ? 'false'
1730
- : undefined);
1731
- (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onChange) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e, checked);
1732
- }, sx: (theme) => (Object.assign({ height: '2.5rem', width: '2.5rem' }, ((checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx) instanceof Function
1733
- ? checkboxProps.sx(theme)
1734
- : checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx))) })), disableTypography: true, label: (_c = checkboxProps.title) !== null && _c !== void 0 ? _c : filterLabel, sx: { color: 'text.secondary', mt: '-4px', fontWeight: 'normal' }, title: undefined }) }));
1735
- };
1736
-
1737
- const MRT_FilterRangeSlider = ({ header, table }) => {
1738
- var _a, _b;
1739
- const { options: { localization, muiTableHeadCellFilterSliderProps, enableColumnFilterModes, }, refs: { filterInputRefs }, } = table;
1740
- const { column } = header;
1741
- const { columnDef } = column;
1742
- const currentFilterOption = columnDef._filterFn;
1743
- const showChangeModeButton = enableColumnFilterModes && columnDef.enableColumnFilterModes !== false;
1744
- const mTableHeadCellFilterTextFieldProps = muiTableHeadCellFilterSliderProps instanceof Function
1745
- ? muiTableHeadCellFilterSliderProps({
1746
- column,
1747
- table,
1748
- })
1749
- : muiTableHeadCellFilterSliderProps;
1750
- const mcTableHeadCellFilterTextFieldProps = columnDef.muiTableHeadCellFilterSliderProps instanceof Function
1751
- ? columnDef.muiTableHeadCellFilterSliderProps({
1752
- column,
1753
- table,
1754
- })
1755
- : columnDef.muiTableHeadCellFilterSliderProps;
1756
- const sliderProps = Object.assign(Object.assign({}, mTableHeadCellFilterTextFieldProps), mcTableHeadCellFilterTextFieldProps);
1757
- let [min, max] = sliderProps.min !== undefined && sliderProps.max !== undefined
1758
- ? [sliderProps.min, sliderProps.max]
1759
- : (_a = column.getFacetedMinMaxValues()) !== null && _a !== void 0 ? _a : [0, 1];
1760
- //fix potential TanStack Table bugs where min or max is an array
1761
- if (Array.isArray(min))
1762
- min = min[0];
1763
- if (Array.isArray(max))
1764
- max = max[0];
1765
- if (min === null)
1766
- min = 0;
1767
- if (max === null)
1768
- max = 1;
1769
- const [filterValues, setFilterValues] = useState([min, max]);
1770
- const columnFilterValue = column.getFilterValue();
1771
- const isMounted = useRef(false);
1772
- useEffect(() => {
1773
- if (isMounted.current) {
1774
- if (columnFilterValue === undefined) {
1775
- setFilterValues([min, max]);
1776
- }
1777
- else if (Array.isArray(columnFilterValue)) {
1778
- setFilterValues(columnFilterValue);
1779
- }
1780
- }
1781
- isMounted.current = true;
1782
- }, [columnFilterValue, min, max]);
1783
- return (jsxs(Stack, { children: [jsx(Slider, Object.assign({ disableSwap: true, min: min, max: max, onChange: (_event, values) => {
1784
- setFilterValues(values);
1785
- }, onChangeCommitted: (_event, value) => {
1786
- if (Array.isArray(value)) {
1787
- if (value[0] <= min && value[1] >= max) {
1788
- //if the user has selected the entire range, remove the filter
1789
- column.setFilterValue(undefined);
1790
- }
1791
- else {
1792
- column.setFilterValue(value);
1793
- }
1794
- }
1795
- }, value: filterValues, valueLabelDisplay: "auto" }, sliderProps, { slotProps: {
1796
- input: {
1797
- ref: (node) => {
1798
- var _a, _b;
1799
- if (node) {
1800
- filterInputRefs.current[`${column.id}-0`] = node;
1801
- // @ts-ignore
1802
- if ((_b = (_a = sliderProps === null || sliderProps === void 0 ? void 0 : sliderProps.slotProps) === null || _a === void 0 ? void 0 : _a.input) === null || _b === void 0 ? void 0 : _b.ref) {
1803
- //@ts-ignore
1804
- sliderProps.slotProps.input.ref = node;
1805
- }
1806
- }
1807
- },
1808
- },
1809
- }, sx: (theme) => (Object.assign({ m: 'auto', mt: !showChangeModeButton ? '10px' : '6px', px: '4px', width: 'calc(100% - 8px)' }, ((sliderProps === null || sliderProps === void 0 ? void 0 : sliderProps.sx) instanceof Function
1810
- ? sliderProps.sx(theme)
1811
- : sliderProps === null || sliderProps === void 0 ? void 0 : sliderProps.sx))) })), showChangeModeButton ? (jsx(FormHelperText, { sx: {
1812
- m: '-3px -6px',
1813
- fontSize: '0.75rem',
1814
- lineHeight: '0.8rem',
1815
- whiteSpace: 'nowrap',
1816
- }, children: localization.filterMode.replace('{filterType}',
1817
- // @ts-ignore
1818
- localization[`filter${((_b = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _b === void 0 ? void 0 : _b.toUpperCase()) +
1819
- (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]) })) : null] }));
1820
- };
1821
-
1822
- const MRT_TableHeadCellFilterContainer = ({ header, table }) => {
1823
- const { getState } = table;
1824
- const { showColumnFilters } = getState();
1825
- const { column } = header;
1826
- const { columnDef } = column;
1827
- return (jsx(Collapse, { in: showColumnFilters, mountOnEnter: true, unmountOnExit: true, children: columnDef.filterVariant === 'checkbox' ? (jsx(MRT_FilterCheckbox, { column: column, table: table })) : columnDef.filterVariant === 'range-slider' ? (jsx(MRT_FilterRangeSlider, { header: header, table: table })) : columnDef.filterVariant === 'range' ||
1828
- ['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn) ? (jsx(MRT_FilterRangeFields, { header: header, table: table })) : (jsx(MRT_FilterTextField, { header: header, table: table })) }));
1829
- };
1830
-
1831
- const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
1832
- var _a, _b, _c, _d;
1833
- const { options: { icons: { FilterAltIcon }, localization, }, refs: { filterInputRefs }, setShowColumnFilters, } = table;
1834
- const { column } = header;
1835
- const { columnDef } = column;
1836
- const isRangeFilter = ['range', 'ranger-slider'].includes((_a = columnDef.filterVariant) !== null && _a !== void 0 ? _a : '') ||
1837
- ['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn);
1838
- const currentFilterOption = columnDef._filterFn;
1839
- const filterTooltip = localization.filteringByColumn
1840
- .replace('{column}', String(columnDef.header))
1841
- .replace('{filterType}',
1842
- // @ts-ignore
1843
- localization[`filter${((_b = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _b === void 0 ? void 0 : _b.toUpperCase()) +
1844
- (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`])
1845
- .replace('{filterValue}', `"${Array.isArray(column.getFilterValue())
1846
- ? column.getFilterValue().join(`" ${isRangeFilter ? localization.and : localization.or} "`)
1847
- : column.getFilterValue()}"`)
1848
- .replace('" "', '');
1849
- return (jsx(Grow, { unmountOnExit: true, in: (!!column.getFilterValue() && !isRangeFilter) ||
1850
- (isRangeFilter && // @ts-ignore
1851
- (!!((_c = column.getFilterValue()) === null || _c === void 0 ? void 0 : _c[0]) || !!((_d = column.getFilterValue()) === null || _d === void 0 ? void 0 : _d[1]))), children: jsx(Box, { component: "span", sx: { flex: '0 0' }, children: jsx(Tooltip, { arrow: true, placement: "top", title: filterTooltip, children: jsx(IconButton, { disableRipple: true, onClick: (event) => {
1852
- setShowColumnFilters(true);
1853
- queueMicrotask(() => {
1854
- var _a, _b;
1855
- (_a = filterInputRefs.current[`${column.id}-0`]) === null || _a === void 0 ? void 0 : _a.focus();
1856
- (_b = filterInputRefs.current[`${column.id}-0`]) === null || _b === void 0 ? void 0 : _b.select();
1857
- });
1858
- event.stopPropagation();
1859
- }, size: "small", sx: {
1860
- height: '12px',
1861
- m: 0,
1862
- opacity: 0.8,
1863
- p: '2px',
1864
- transform: 'scale(0.66)',
1865
- width: '12px',
1866
- }, children: jsx(FilterAltIcon, {}) }) }) }) }));
1867
- };
1868
-
1869
- const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
1870
- const { getState, options: { enableColumnOrdering, muiTableHeadCellDragHandleProps }, setColumnOrder, setDraggingColumn, setHoveredColumn, } = table;
1871
- const { columnDef } = column;
1872
- const { hoveredColumn, draggingColumn, columnOrder } = getState();
1873
- const mIconButtonProps = muiTableHeadCellDragHandleProps instanceof Function
1874
- ? muiTableHeadCellDragHandleProps({ column, table })
1875
- : muiTableHeadCellDragHandleProps;
1876
- const mcIconButtonProps = columnDef.muiTableHeadCellDragHandleProps instanceof Function
1877
- ? columnDef.muiTableHeadCellDragHandleProps({ column, table })
1878
- : columnDef.muiTableHeadCellDragHandleProps;
1879
- const iconButtonProps = Object.assign(Object.assign({}, mIconButtonProps), mcIconButtonProps);
1880
- const handleDragStart = (event) => {
1881
- var _a;
1882
- (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1883
- setDraggingColumn(column);
1884
- event.dataTransfer.setDragImage(tableHeadCellRef.current, 0, 0);
1885
- };
1886
- const handleDragEnd = (event) => {
1887
- var _a;
1888
- (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1889
- if ((hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
1890
- column.toggleGrouping();
1891
- }
1892
- else if (enableColumnOrdering &&
1893
- hoveredColumn &&
1894
- (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) !== (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id)) {
1895
- setColumnOrder(reorderColumn(column, hoveredColumn, columnOrder));
1896
- }
1897
- setDraggingColumn(null);
1898
- setHoveredColumn(null);
1899
- };
1900
- return (jsx(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
1901
- };
1902
-
1903
- const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
1904
- var _a;
1905
- const { getState, options: { columnResizeMode }, setColumnSizingInfo, } = table;
1906
- const { density } = getState();
1907
- const { column } = header;
1908
- return (jsx(Box, { className: "Mui-TableHeadCell-ResizeHandle-Wrapper", onDoubleClick: () => {
1909
- setColumnSizingInfo((old) => (Object.assign(Object.assign({}, old), { isResizingColumn: false })));
1910
- column.resetSize();
1911
- }, onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), sx: (theme) => ({
1912
- cursor: 'col-resize',
1913
- mr: density === 'compact' ? '-0.75rem' : '-1rem',
1914
- position: 'absolute',
1915
- right: '4px',
1916
- px: '4px',
1917
- '&:active > hr': {
1918
- backgroundColor: theme.palette.info.main,
1919
- opacity: 1,
1920
- },
1921
- }), style: {
1922
- transform: column.getIsResizing() && columnResizeMode === 'onEnd'
1923
- ? `translateX(${(_a = getState().columnSizingInfo.deltaOffset) !== null && _a !== void 0 ? _a : 0}px)`
1924
- : undefined,
1925
- }, children: jsx(Divider, { className: "Mui-TableHeadCell-ResizeHandle-Divider", flexItem: true, orientation: "vertical", sx: {
1926
- borderRadius: '2px',
1927
- borderWidth: '2px',
1928
- height: '24px',
1929
- touchAction: 'none',
1930
- transition: column.getIsResizing()
1931
- ? undefined
1932
- : 'all 150ms ease-in-out',
1933
- userSelect: 'none',
1934
- zIndex: 4,
1935
- } }) }));
1936
- };
1937
-
1938
- const MRT_TableHeadCellSortLabel = ({ header, table, tableCellProps, }) => {
1939
- const { getState, options: { icons: { ArrowDownwardIcon }, localization, }, } = table;
1940
- const { column } = header;
1941
- const { columnDef } = column;
1942
- const { sorting } = getState();
1943
- const sortTooltip = column.getIsSorted()
1944
- ? column.getIsSorted() === 'desc'
1945
- ? localization.sortedByColumnDesc.replace('{column}', columnDef.header)
1946
- : localization.sortedByColumnAsc.replace('{column}', columnDef.header)
1947
- : localization.unsorted;
1948
- return (jsx(Tooltip, { arrow: true, placement: "top", title: sortTooltip, children: jsx(Badge, { badgeContent: sorting.length > 1 ? column.getSortIndex() + 1 : 0, overlap: "circular", children: jsx(TableSortLabel, { "aria-label": sortTooltip, active: !!column.getIsSorted(), direction: column.getIsSorted()
1949
- ? column.getIsSorted()
1950
- : undefined, sx: {
1951
- flex: '0 0',
1952
- width: '2.4ch',
1953
- transform: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) !== 'right'
1954
- ? 'translateX(-0.5ch)'
1955
- : undefined,
1956
- }, IconComponent: ArrowDownwardIcon, onClick: (e) => {
1957
- var _a;
1958
- e.stopPropagation();
1959
- (_a = header.column.getToggleSortingHandler()) === null || _a === void 0 ? void 0 : _a(e);
1960
- } }) }) }));
2616
+ else {
2617
+ value = option.value;
2618
+ text = option.text;
2619
+ }
2620
+ return (jsxs(MenuItem, { sx: {
2621
+ display: 'flex',
2622
+ m: 0,
2623
+ alignItems: 'center',
2624
+ gap: '0.5rem',
2625
+ }, value: value, children: [isMultiSelectFilter && (jsx(Checkbox, { checked: ((_a = column.getFilterValue()) !== null && _a !== void 0 ? _a : []).includes(value), sx: { mr: '0.5rem' } })), text, ' ', !columnDef.filterSelectOptions &&
2626
+ `(${facetedUniqueValues.get(value)})`] }, value));
2627
+ })] })), jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table, setFilterValue: setFilterValue })] }));
1961
2628
  };
1962
2629
 
1963
- const MRT_TableHeadCell = ({ header, table }) => {
1964
- var _a, _b, _c, _d, _f, _g;
1965
- const theme = useTheme();
1966
- const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering, enableGrouping, enableMultiSort, layoutMode, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
1967
- const { density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
1968
- const { column } = header;
2630
+ const MRT_FilterRangeFields = ({ header, table, }) => {
2631
+ return (jsxs(Box, { sx: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '1rem' }, children: [jsx(MRT_FilterTextField, { header: header, rangeFilterIndex: 0, table: table }), jsx(MRT_FilterTextField, { header: header, rangeFilterIndex: 1, table: table })] }));
2632
+ };
2633
+
2634
+ const MRT_FilterCheckbox = ({ column, table, }) => {
2635
+ var _a, _b, _c;
2636
+ const { getState, options: { localization, muiFilterCheckboxProps }, } = table;
2637
+ const { density } = getState();
1969
2638
  const { columnDef } = column;
1970
- const { columnDefType } = columnDef;
1971
- const mTableHeadCellProps = muiTableHeadCellProps instanceof Function
1972
- ? muiTableHeadCellProps({ column, table })
1973
- : muiTableHeadCellProps;
1974
- const mcTableHeadCellProps = columnDef.muiTableHeadCellProps instanceof Function
1975
- ? columnDef.muiTableHeadCellProps({ column, table })
1976
- : columnDef.muiTableHeadCellProps;
1977
- const tableCellProps = Object.assign(Object.assign({}, mTableHeadCellProps), mcTableHeadCellProps);
1978
- const showColumnActions = (enableColumnActions || columnDef.enableColumnActions) &&
1979
- columnDef.enableColumnActions !== false;
1980
- const showDragHandle = enableColumnDragging !== false &&
1981
- columnDef.enableColumnDragging !== false &&
1982
- (enableColumnDragging ||
1983
- (enableColumnOrdering && columnDef.enableColumnOrdering !== false) ||
1984
- (enableGrouping &&
1985
- columnDef.enableGrouping !== false &&
1986
- !grouping.includes(column.id)));
1987
- const headerPL = useMemo(() => {
1988
- let pl = 0;
1989
- if (column.getCanSort())
1990
- pl++;
1991
- if (showColumnActions)
1992
- pl += 1.75;
1993
- if (showDragHandle)
1994
- pl += 1.25;
1995
- return pl;
1996
- }, [showColumnActions, showDragHandle]);
1997
- const draggingBorder = useMemo(() => (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
1998
- ? `1px dashed ${theme.palette.text.secondary}`
1999
- : (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
2000
- ? `2px dashed ${theme.palette.primary.main}`
2001
- : undefined, [draggingColumn, hoveredColumn]);
2002
- const draggingBorders = draggingBorder
2003
- ? {
2004
- borderLeft: draggingBorder,
2005
- borderRight: draggingBorder,
2006
- borderTop: draggingBorder,
2007
- }
2008
- : undefined;
2009
- const handleDragEnter = (_e) => {
2010
- if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
2011
- setHoveredColumn(null);
2012
- }
2013
- if (enableColumnOrdering && draggingColumn && columnDefType !== 'group') {
2014
- setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
2015
- }
2016
- };
2017
- const headerElement = (columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) instanceof Function
2018
- ? (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) === null || _a === void 0 ? void 0 : _a.call(columnDef, {
2639
+ const mTableHeadCellFilterCheckboxProps = muiFilterCheckboxProps instanceof Function
2640
+ ? muiFilterCheckboxProps({
2019
2641
  column,
2020
- header,
2021
2642
  table,
2022
2643
  })
2023
- : (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) !== null && _b !== void 0 ? _b : columnDef.header;
2024
- return (jsxs(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: (node) => {
2025
- if (node) {
2026
- tableHeadCellRefs.current[column.id] = node;
2027
- }
2028
- } }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ flexDirection: layoutMode === 'grid' ? 'column' : undefined, fontWeight: 'bold', overflow: 'visible', p: density === 'compact'
2029
- ? '0.5rem'
2030
- : density === 'comfortable'
2031
- ? columnDefType === 'display'
2032
- ? '0.75rem'
2033
- : '1rem'
2034
- : columnDefType === 'display'
2035
- ? '1rem 1.25rem'
2036
- : '1.5rem', pb: columnDefType === 'display'
2037
- ? 0
2038
- : showColumnFilters || density === 'compact'
2039
- ? '0.4rem'
2040
- : '0.6rem', pt: columnDefType === 'group' || density === 'compact'
2041
- ? '0.25rem'
2042
- : density === 'comfortable'
2043
- ? '.75rem'
2044
- : '1.25rem', userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
2045
- ? 3
2046
- : column.getIsPinned() && columnDefType !== 'group'
2047
- ? 2
2048
- : 1 }, getCommonCellStyles({
2644
+ : muiFilterCheckboxProps;
2645
+ const mcTableHeadCellFilterCheckboxProps = columnDef.muiFilterCheckboxProps instanceof Function
2646
+ ? columnDef.muiFilterCheckboxProps({
2049
2647
  column,
2050
- header,
2051
2648
  table,
2052
- tableCellProps,
2053
- theme,
2054
- })), draggingBorders)), children: [header.isPlaceholder ? null : (jsxs(Box, { className: "Mui-TableHeadCell-Content", sx: {
2055
- alignItems: 'center',
2056
- display: 'flex',
2057
- flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
2058
- justifyContent: columnDefType === 'group' || (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
2059
- ? 'center'
2060
- : column.getCanResize()
2061
- ? 'space-between'
2062
- : 'flex-start',
2063
- position: 'relative',
2064
- width: '100%',
2065
- }, children: [jsxs(Box, { className: "Mui-TableHeadCell-Content-Labels", onClick: column.getToggleSortingHandler(), sx: {
2066
- alignItems: 'center',
2067
- cursor: column.getCanSort() && columnDefType !== 'group'
2068
- ? 'pointer'
2069
- : undefined,
2070
- display: 'flex',
2071
- flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
2072
- overflow: columnDefType === 'data' ? 'hidden' : undefined,
2073
- pl: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
2074
- ? `${headerPL}rem`
2075
- : undefined,
2076
- }, children: [jsx(Box, { className: "Mui-TableHeadCell-Content-Wrapper", sx: {
2077
- minWidth: `${Math.min((_d = (_c = columnDef.header) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0, 5)}ch`,
2078
- overflow: columnDefType === 'data' ? 'hidden' : undefined,
2079
- textOverflow: 'ellipsis',
2080
- whiteSpace: ((_g = (_f = columnDef.header) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 0) < 20 ? 'nowrap' : 'normal',
2081
- '&:hover': {
2082
- textOverflow: 'clip',
2083
- },
2084
- }, title: columnDefType === 'data' ? columnDef.header : undefined, children: headerElement }), column.getCanSort() && (jsx(MRT_TableHeadCellSortLabel, { header: header, table: table, tableCellProps: tableCellProps })), column.getCanFilter() && (jsx(MRT_TableHeadCellFilterLabel, { header: header, table: table }))] }), columnDefType !== 'group' && (jsxs(Box, { className: "Mui-TableHeadCell-Content-Actions", sx: { whiteSpace: 'nowrap' }, children: [showDragHandle && (jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
2085
- current: tableHeadCellRefs.current[column.id],
2086
- } })), showColumnActions && (jsx(MRT_TableHeadCellColumnActionsButton, { header: header, table: table }))] })), column.getCanResize() && (jsx(MRT_TableHeadCellResizeHandle, { header: header, table: table }))] })), column.getCanFilter() && (jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }))] })));
2087
- };
2088
-
2089
- const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
2090
- const { options: { layoutMode, muiTableHeadRowProps }, } = table;
2091
- const tableRowProps = muiTableHeadRowProps instanceof Function
2092
- ? muiTableHeadRowProps({ headerGroup, table })
2093
- : muiTableHeadRowProps;
2094
- return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.04), boxShadow: `4px 0 8px ${alpha(theme.palette.common.black, 0.1)}`, display: layoutMode === 'grid' ? 'flex' : 'table-row', top: 0 }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
2095
- ? tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx(theme)
2096
- : tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))), children: [virtualPaddingLeft ? (jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader) => {
2097
- const header = virtualColumns
2098
- ? headerGroup.headers[headerOrVirtualHeader.index]
2099
- : headerOrVirtualHeader;
2100
- return (jsx(MRT_TableHeadCell, { header: header, table: table }, header.id));
2101
- }), virtualPaddingRight ? (jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
2102
- };
2103
-
2104
- const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
2105
- const { getHeaderGroups, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps }, } = table;
2106
- const { isFullScreen } = getState();
2107
- const tableHeadProps = muiTableHeadProps instanceof Function
2108
- ? muiTableHeadProps({ table })
2109
- : muiTableHeadProps;
2110
- const stickyHeader = enableStickyHeader || isFullScreen;
2111
- return (jsx(TableHead, Object.assign({}, tableHeadProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', opacity: 0.97, position: stickyHeader ? 'sticky' : 'relative', top: stickyHeader && layoutMode === 'grid' ? 0 : undefined, zIndex: stickyHeader ? 2 : undefined }, ((tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx) instanceof Function
2112
- ? tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx(theme)
2113
- : tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx))), children: getHeaderGroups().map((headerGroup) => (jsx(MRT_TableHeadRow, { headerGroup: headerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, headerGroup.id))) })));
2649
+ })
2650
+ : columnDef.muiFilterCheckboxProps;
2651
+ const checkboxProps = Object.assign(Object.assign({}, mTableHeadCellFilterCheckboxProps), mcTableHeadCellFilterCheckboxProps);
2652
+ const filterLabel = (_a = localization.filterByColumn) === null || _a === void 0 ? void 0 : _a.replace('{column}', columnDef.header);
2653
+ return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_b = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _b !== void 0 ? _b : filterLabel, children: jsx(FormControlLabel, { control: jsx(Checkbox, Object.assign({ checked: column.getFilterValue() === 'true', indeterminate: column.getFilterValue() === undefined, color: column.getFilterValue() === undefined ? 'default' : 'primary', size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { onClick: (e) => {
2654
+ var _a;
2655
+ e.stopPropagation();
2656
+ (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
2657
+ }, onChange: (e, checked) => {
2658
+ var _a;
2659
+ column.setFilterValue(column.getFilterValue() === undefined
2660
+ ? 'true'
2661
+ : column.getFilterValue() === 'true'
2662
+ ? 'false'
2663
+ : undefined);
2664
+ (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onChange) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e, checked);
2665
+ }, sx: (theme) => (Object.assign({ height: '2.5rem', width: '2.5rem' }, ((checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx) instanceof Function
2666
+ ? checkboxProps.sx(theme)
2667
+ : checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx))) })), disableTypography: true, label: (_c = checkboxProps.title) !== null && _c !== void 0 ? _c : filterLabel, sx: { color: 'text.secondary', mt: '-4px', fontWeight: 'normal' }, title: undefined }) }));
2114
2668
  };
2115
2669
 
2116
- const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
2117
- var _a, _b, _c;
2118
- const { getState, options: { muiTableBodyCellEditTextFieldProps }, refs: { editInputRefs }, setEditingCell, setEditingRow, } = table;
2119
- const { column, row } = cell;
2670
+ const MRT_FilterRangeSlider = ({ header, table, }) => {
2671
+ var _a, _b;
2672
+ const { options: { localization, muiFilterSliderProps, enableColumnFilterModes }, refs: { filterInputRefs }, } = table;
2673
+ const { column } = header;
2120
2674
  const { columnDef } = column;
2121
- const { editingRow } = getState();
2122
- const [value, setValue] = useState(() => cell.getValue());
2123
- const mTableBodyCellEditTextFieldProps = muiTableBodyCellEditTextFieldProps instanceof Function
2124
- ? muiTableBodyCellEditTextFieldProps({ cell, column, row, table })
2125
- : muiTableBodyCellEditTextFieldProps;
2126
- const mcTableBodyCellEditTextFieldProps = columnDef.muiTableBodyCellEditTextFieldProps instanceof Function
2127
- ? columnDef.muiTableBodyCellEditTextFieldProps({
2128
- cell,
2675
+ const currentFilterOption = columnDef._filterFn;
2676
+ const showChangeModeButton = enableColumnFilterModes && columnDef.enableColumnFilterModes !== false;
2677
+ const mFilterSliderProps = muiFilterSliderProps instanceof Function
2678
+ ? muiFilterSliderProps({
2129
2679
  column,
2130
- row,
2131
2680
  table,
2132
2681
  })
2133
- : columnDef.muiTableBodyCellEditTextFieldProps;
2134
- const textFieldProps = Object.assign(Object.assign({}, mTableBodyCellEditTextFieldProps), mcTableBodyCellEditTextFieldProps);
2135
- const isSelectEdit = columnDef.editVariant === 'select';
2136
- const saveRow = (newValue) => {
2137
- if (editingRow) {
2138
- setEditingRow(Object.assign(Object.assign({}, editingRow), { _valuesCache: Object.assign(Object.assign({}, editingRow._valuesCache), { [column.id]: newValue }) }));
2139
- }
2140
- };
2141
- const handleChange = (event) => {
2142
- var _a;
2143
- (_a = textFieldProps.onChange) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
2144
- setValue(event.target.value);
2145
- if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.select) {
2146
- saveRow(event.target.value);
2147
- }
2148
- };
2149
- const handleBlur = (event) => {
2150
- var _a;
2151
- (_a = textFieldProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
2152
- saveRow(value);
2153
- setEditingCell(null);
2154
- };
2155
- const handleEnterKeyDown = (event) => {
2156
- var _a, _b;
2157
- (_a = textFieldProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
2158
- if (event.key === 'Enter') {
2159
- (_b = editInputRefs.current[column.id]) === null || _b === void 0 ? void 0 : _b.blur();
2160
- }
2161
- };
2162
- if (columnDef.Edit) {
2163
- return jsx(Fragment, { children: (_a = columnDef.Edit) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table }) });
2164
- }
2165
- return (jsx(TextField, Object.assign({ disabled: (columnDef.enableEditing instanceof Function
2166
- ? columnDef.enableEditing(row)
2167
- : columnDef.enableEditing) === false, fullWidth: true, inputRef: (inputRef) => {
2168
- if (inputRef) {
2169
- editInputRefs.current[column.id] = inputRef;
2170
- if (textFieldProps.inputRef) {
2171
- textFieldProps.inputRef = inputRef;
2172
- }
2173
- }
2174
- }, label: showLabel ? column.columnDef.header : undefined, margin: "none", name: column.id, placeholder: columnDef.header, select: isSelectEdit, value: value, variant: "standard" }, textFieldProps, { onClick: (e) => {
2175
- var _a;
2176
- e.stopPropagation();
2177
- (_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.onClick) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, e);
2178
- }, onBlur: handleBlur, onChange: handleChange, onKeyDown: handleEnterKeyDown, children: (_b = textFieldProps.children) !== null && _b !== void 0 ? _b : (_c = columnDef === null || columnDef === void 0 ? void 0 : columnDef.editSelectOptions) === null || _c === void 0 ? void 0 : _c.map((option) => {
2179
- let value;
2180
- let text;
2181
- if (typeof option !== 'object') {
2182
- value = option;
2183
- text = option;
2682
+ : muiFilterSliderProps;
2683
+ const mcFilterSliderProps = columnDef.muiFilterSliderProps instanceof Function
2684
+ ? columnDef.muiFilterSliderProps({
2685
+ column,
2686
+ table,
2687
+ })
2688
+ : columnDef.muiFilterSliderProps;
2689
+ const sliderProps = Object.assign(Object.assign({}, mFilterSliderProps), mcFilterSliderProps);
2690
+ let [min, max] = sliderProps.min !== undefined && sliderProps.max !== undefined
2691
+ ? [sliderProps.min, sliderProps.max]
2692
+ : (_a = column.getFacetedMinMaxValues()) !== null && _a !== void 0 ? _a : [0, 1];
2693
+ //fix potential TanStack Table bugs where min or max is an array
2694
+ if (Array.isArray(min))
2695
+ min = min[0];
2696
+ if (Array.isArray(max))
2697
+ max = max[0];
2698
+ if (min === null)
2699
+ min = 0;
2700
+ if (max === null)
2701
+ max = 1;
2702
+ const [filterValues, setFilterValues] = useState([min, max]);
2703
+ const columnFilterValue = column.getFilterValue();
2704
+ const isMounted = useRef(false);
2705
+ useEffect(() => {
2706
+ if (isMounted.current) {
2707
+ if (columnFilterValue === undefined) {
2708
+ setFilterValues([min, max]);
2184
2709
  }
2185
- else {
2186
- value = option.value;
2187
- text = option.text;
2710
+ else if (Array.isArray(columnFilterValue)) {
2711
+ setFilterValues(columnFilterValue);
2188
2712
  }
2189
- return (jsx(MenuItem, { sx: {
2190
- display: 'flex',
2191
- m: 0,
2192
- alignItems: 'center',
2193
- gap: '0.5rem',
2194
- }, value: value, children: text }, value));
2195
- }) })));
2713
+ }
2714
+ isMounted.current = true;
2715
+ }, [columnFilterValue, min, max]);
2716
+ return (jsxs(Stack, { children: [jsx(Slider, Object.assign({ disableSwap: true, min: min, max: max, onChange: (_event, values) => {
2717
+ setFilterValues(values);
2718
+ }, onChangeCommitted: (_event, value) => {
2719
+ if (Array.isArray(value)) {
2720
+ if (value[0] <= min && value[1] >= max) {
2721
+ //if the user has selected the entire range, remove the filter
2722
+ column.setFilterValue(undefined);
2723
+ }
2724
+ else {
2725
+ column.setFilterValue(value);
2726
+ }
2727
+ }
2728
+ }, value: filterValues, valueLabelDisplay: "auto" }, sliderProps, { slotProps: {
2729
+ input: {
2730
+ ref: (node) => {
2731
+ var _a, _b;
2732
+ if (node) {
2733
+ filterInputRefs.current[`${column.id}-0`] = node;
2734
+ // @ts-ignore
2735
+ if ((_b = (_a = sliderProps === null || sliderProps === void 0 ? void 0 : sliderProps.slotProps) === null || _a === void 0 ? void 0 : _a.input) === null || _b === void 0 ? void 0 : _b.ref) {
2736
+ //@ts-ignore
2737
+ sliderProps.slotProps.input.ref = node;
2738
+ }
2739
+ }
2740
+ },
2741
+ },
2742
+ }, sx: (theme) => (Object.assign({ m: 'auto', mt: !showChangeModeButton ? '10px' : '6px', px: '4px', width: 'calc(100% - 8px)' }, ((sliderProps === null || sliderProps === void 0 ? void 0 : sliderProps.sx) instanceof Function
2743
+ ? sliderProps.sx(theme)
2744
+ : sliderProps === null || sliderProps === void 0 ? void 0 : sliderProps.sx))) })), showChangeModeButton ? (jsx(FormHelperText, { sx: {
2745
+ m: '-3px -6px',
2746
+ fontSize: '0.75rem',
2747
+ lineHeight: '0.8rem',
2748
+ whiteSpace: 'nowrap',
2749
+ }, children: localization.filterMode.replace('{filterType}',
2750
+ // @ts-ignore
2751
+ localization[`filter${((_b = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _b === void 0 ? void 0 : _b.toUpperCase()) +
2752
+ (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]) })) : null] }));
2196
2753
  };
2197
2754
 
2198
- const MRT_CopyButton = ({ cell, children, table, }) => {
2199
- var _a;
2200
- const { options: { localization, muiTableBodyCellCopyButtonProps }, } = table;
2201
- const { column, row } = cell;
2755
+ const MRT_TableHeadCellFilterContainer = ({ header, table, }) => {
2756
+ const { getState } = table;
2757
+ const { showColumnFilters } = getState();
2758
+ const { column } = header;
2202
2759
  const { columnDef } = column;
2203
- const [copied, setCopied] = useState(false);
2204
- const handleCopy = (event, text) => {
2205
- event.stopPropagation();
2206
- navigator.clipboard.writeText(text);
2207
- setCopied(true);
2208
- setTimeout(() => setCopied(false), 4000);
2209
- };
2210
- const mTableBodyCellCopyButtonProps = muiTableBodyCellCopyButtonProps instanceof Function
2211
- ? muiTableBodyCellCopyButtonProps({ cell, column, row, table })
2212
- : muiTableBodyCellCopyButtonProps;
2213
- const mcTableBodyCellCopyButtonProps = columnDef.muiTableBodyCellCopyButtonProps instanceof Function
2214
- ? columnDef.muiTableBodyCellCopyButtonProps({
2215
- cell,
2216
- column,
2217
- row,
2218
- table,
2219
- })
2220
- : columnDef.muiTableBodyCellCopyButtonProps;
2221
- const buttonProps = Object.assign(Object.assign({}, mTableBodyCellCopyButtonProps), mcTableBodyCellCopyButtonProps);
2222
- return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.title) !== null && _a !== void 0 ? _a : (copied ? localization.copiedToClipboard : localization.clickToCopy), children: jsx(Button, 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' }, ((buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx) instanceof Function
2223
- ? buttonProps.sx(theme)
2224
- : buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx))), title: undefined, children: children })) }));
2760
+ return (jsx(Collapse, { in: showColumnFilters, mountOnEnter: true, unmountOnExit: true, children: columnDef.filterVariant === 'checkbox' ? (jsx(MRT_FilterCheckbox, { column: column, table: table })) : columnDef.filterVariant === 'range-slider' ? (jsx(MRT_FilterRangeSlider, { header: header, table: table })) : columnDef.filterVariant === 'range' ||
2761
+ ['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn) ? (jsx(MRT_FilterRangeFields, { header: header, table: table })) : (jsx(MRT_FilterTextField, { header: header, table: table })) }));
2762
+ };
2763
+
2764
+ const MRT_TableHeadCellFilterLabel = ({ header, table, }) => {
2765
+ var _a, _b, _c, _d;
2766
+ const { options: { icons: { FilterAltIcon }, localization, }, refs: { filterInputRefs }, setShowColumnFilters, } = table;
2767
+ const { column } = header;
2768
+ const { columnDef } = column;
2769
+ const isRangeFilter = ['range', 'ranger-slider'].includes((_a = columnDef.filterVariant) !== null && _a !== void 0 ? _a : '') ||
2770
+ ['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn);
2771
+ const currentFilterOption = columnDef._filterFn;
2772
+ const filterTooltip = localization.filteringByColumn
2773
+ .replace('{column}', String(columnDef.header))
2774
+ .replace('{filterType}',
2775
+ // @ts-ignore
2776
+ localization[`filter${((_b = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _b === void 0 ? void 0 : _b.toUpperCase()) +
2777
+ (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`])
2778
+ .replace('{filterValue}', `"${Array.isArray(column.getFilterValue())
2779
+ ? column.getFilterValue().join(`" ${isRangeFilter ? localization.and : localization.or} "`)
2780
+ : column.getFilterValue()}"`)
2781
+ .replace('" "', '');
2782
+ return (jsx(Grow, { unmountOnExit: true, in: (!!column.getFilterValue() && !isRangeFilter) ||
2783
+ (isRangeFilter && // @ts-ignore
2784
+ (!!((_c = column.getFilterValue()) === null || _c === void 0 ? void 0 : _c[0]) || !!((_d = column.getFilterValue()) === null || _d === void 0 ? void 0 : _d[1]))), children: jsx(Box, { component: "span", sx: { flex: '0 0' }, children: jsx(Tooltip, { arrow: true, placement: "top", title: filterTooltip, children: jsx(IconButton, { disableRipple: true, onClick: (event) => {
2785
+ setShowColumnFilters(true);
2786
+ queueMicrotask(() => {
2787
+ var _a, _b;
2788
+ (_a = filterInputRefs.current[`${column.id}-0`]) === null || _a === void 0 ? void 0 : _a.focus();
2789
+ (_b = filterInputRefs.current[`${column.id}-0`]) === null || _b === void 0 ? void 0 : _b.select();
2790
+ });
2791
+ event.stopPropagation();
2792
+ }, size: "small", sx: {
2793
+ height: '12px',
2794
+ m: 0,
2795
+ opacity: 0.8,
2796
+ p: '2px',
2797
+ transform: 'scale(0.66)',
2798
+ width: '12px',
2799
+ }, children: jsx(FilterAltIcon, {}) }) }) }) }));
2225
2800
  };
2226
2801
 
2227
- const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table }) => {
2228
- const { options: { muiTableBodyRowDragHandleProps }, } = table;
2229
- const { row } = cell;
2230
- const iconButtonProps = muiTableBodyRowDragHandleProps instanceof Function
2231
- ? muiTableBodyRowDragHandleProps({ row, table })
2232
- : muiTableBodyRowDragHandleProps;
2802
+ const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
2803
+ const { getState, options: { enableColumnOrdering, muiColumnDragHandleProps }, setColumnOrder, setDraggingColumn, setHoveredColumn, } = table;
2804
+ const { columnDef } = column;
2805
+ const { hoveredColumn, draggingColumn, columnOrder } = getState();
2806
+ const mIconButtonProps = muiColumnDragHandleProps instanceof Function
2807
+ ? muiColumnDragHandleProps({ column, table })
2808
+ : muiColumnDragHandleProps;
2809
+ const mcIconButtonProps = columnDef.muiColumnDragHandleProps instanceof Function
2810
+ ? columnDef.muiColumnDragHandleProps({ column, table })
2811
+ : columnDef.muiColumnDragHandleProps;
2812
+ const iconButtonProps = Object.assign(Object.assign({}, mIconButtonProps), mcIconButtonProps);
2233
2813
  const handleDragStart = (event) => {
2234
2814
  var _a;
2235
2815
  (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
2236
- event.dataTransfer.setDragImage(rowRef.current, 0, 0);
2237
- table.setDraggingRow(row);
2816
+ setDraggingColumn(column);
2817
+ event.dataTransfer.setDragImage(tableHeadCellRef.current, 0, 0);
2238
2818
  };
2239
2819
  const handleDragEnd = (event) => {
2240
2820
  var _a;
2241
2821
  (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
2242
- table.setDraggingRow(null);
2243
- table.setHoveredRow(null);
2822
+ if ((hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
2823
+ column.toggleGrouping();
2824
+ }
2825
+ else if (enableColumnOrdering &&
2826
+ hoveredColumn &&
2827
+ (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) !== (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id)) {
2828
+ setColumnOrder(reorderColumn(column, hoveredColumn, columnOrder));
2829
+ }
2830
+ setDraggingColumn(null);
2831
+ setHoveredColumn(null);
2244
2832
  };
2245
2833
  return (jsx(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
2246
2834
  };
2247
2835
 
2248
- const allowedTypes = ['string', 'number'];
2249
- const MRT_TableBodyCellValue = ({ cell, table }) => {
2250
- var _a, _b, _c;
2251
- const { getState, options: { enableFilterMatchHighlighting }, } = table;
2252
- const { column, row } = cell;
2836
+ const MRT_TableHeadCellResizeHandle = ({ header, table, }) => {
2837
+ var _a;
2838
+ const { getState, options: { columnResizeMode }, setColumnSizingInfo, } = table;
2839
+ const { density } = getState();
2840
+ const { column } = header;
2841
+ return (jsx(Box, { className: "Mui-TableHeadCell-ResizeHandle-Wrapper", onDoubleClick: () => {
2842
+ setColumnSizingInfo((old) => (Object.assign(Object.assign({}, old), { isResizingColumn: false })));
2843
+ column.resetSize();
2844
+ }, onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), sx: (theme) => ({
2845
+ cursor: 'col-resize',
2846
+ mr: density === 'compact' ? '-0.75rem' : '-1rem',
2847
+ position: 'absolute',
2848
+ right: '4px',
2849
+ px: '4px',
2850
+ '&:active > hr': {
2851
+ backgroundColor: theme.palette.info.main,
2852
+ opacity: 1,
2853
+ },
2854
+ }), style: {
2855
+ transform: column.getIsResizing() && columnResizeMode === 'onEnd'
2856
+ ? `translateX(${(_a = getState().columnSizingInfo.deltaOffset) !== null && _a !== void 0 ? _a : 0}px)`
2857
+ : undefined,
2858
+ }, children: jsx(Divider, { className: "Mui-TableHeadCell-ResizeHandle-Divider", flexItem: true, orientation: "vertical", sx: {
2859
+ borderRadius: '2px',
2860
+ borderWidth: '2px',
2861
+ height: '24px',
2862
+ touchAction: 'none',
2863
+ transition: column.getIsResizing()
2864
+ ? undefined
2865
+ : 'all 150ms ease-in-out',
2866
+ userSelect: 'none',
2867
+ zIndex: 4,
2868
+ } }) }));
2869
+ };
2870
+
2871
+ const MRT_TableHeadCellSortLabel = ({ header, table, tableCellProps, }) => {
2872
+ const { getState, options: { icons: { ArrowDownwardIcon }, localization, }, } = table;
2873
+ const { column } = header;
2253
2874
  const { columnDef } = column;
2254
- const { globalFilter, globalFilterFn } = getState();
2255
- const filterValue = column.getFilterValue();
2256
- let renderedCellValue = cell.getIsAggregated() && columnDef.AggregatedCell
2257
- ? columnDef.AggregatedCell({
2258
- cell,
2259
- column,
2260
- row,
2261
- table,
2262
- })
2263
- : row.getIsGrouped() && !cell.getIsGrouped()
2264
- ? null
2265
- : cell.getIsGrouped() && columnDef.GroupedCell
2266
- ? columnDef.GroupedCell({
2267
- cell,
2268
- column,
2269
- row,
2270
- table,
2271
- })
2272
- : undefined;
2273
- const isGroupedValue = renderedCellValue !== undefined;
2274
- if (!isGroupedValue) {
2275
- renderedCellValue = cell.renderValue();
2276
- }
2277
- if (enableFilterMatchHighlighting &&
2278
- columnDef.enableFilterMatchHighlighting !== false &&
2279
- renderedCellValue &&
2280
- allowedTypes.includes(typeof renderedCellValue) &&
2281
- ((filterValue &&
2282
- allowedTypes.includes(typeof filterValue) &&
2283
- columnDef.filterVariant === 'text') ||
2284
- (globalFilter &&
2285
- allowedTypes.includes(typeof globalFilter) &&
2286
- column.getCanGlobalFilter()))) {
2287
- const chunks = highlightWords === null || highlightWords === void 0 ? void 0 : highlightWords({
2288
- text: renderedCellValue === null || renderedCellValue === void 0 ? void 0 : renderedCellValue.toString(),
2289
- query: ((_a = filterValue !== null && filterValue !== void 0 ? filterValue : globalFilter) !== null && _a !== void 0 ? _a : '').toString(),
2290
- matchExactly: (filterValue ? columnDef._filterFn : globalFilterFn) !== 'fuzzy',
2291
- });
2292
- if ((chunks === null || chunks === void 0 ? void 0 : chunks.length) > 1 || ((_b = chunks === null || chunks === void 0 ? void 0 : chunks[0]) === null || _b === void 0 ? void 0 : _b.match)) {
2293
- renderedCellValue = (jsx("span", { "aria-label": renderedCellValue, role: "note", children: (_c = chunks === null || chunks === void 0 ? void 0 : chunks.map(({ key, match, text }) => (jsx(Box, { "aria-hidden": "true", component: "span", sx: match
2294
- ? {
2295
- backgroundColor: (theme) => theme.palette.mode === 'dark'
2296
- ? darken(theme.palette.warning.dark, 0.25)
2297
- : lighten(theme.palette.warning.light, 0.5),
2298
- borderRadius: '2px',
2299
- color: (theme) => theme.palette.mode === 'dark' ? 'white' : 'black',
2300
- padding: '2px 1px',
2301
- }
2302
- : undefined, children: text }, key)))) !== null && _c !== void 0 ? _c : renderedCellValue }));
2303
- }
2304
- }
2305
- if (columnDef.Cell && !isGroupedValue) {
2306
- renderedCellValue = columnDef.Cell({
2307
- cell,
2308
- renderedCellValue,
2309
- column,
2310
- row,
2311
- table,
2312
- });
2313
- }
2314
- return jsx(Fragment, { children: renderedCellValue });
2875
+ const { sorting } = getState();
2876
+ const sortTooltip = column.getIsSorted()
2877
+ ? column.getIsSorted() === 'desc'
2878
+ ? localization.sortedByColumnDesc.replace('{column}', columnDef.header)
2879
+ : localization.sortedByColumnAsc.replace('{column}', columnDef.header)
2880
+ : column.getNextSortingOrder() === 'desc'
2881
+ ? localization.sortByColumnDesc.replace('{column}', columnDef.header)
2882
+ : localization.sortByColumnAsc.replace('{column}', columnDef.header);
2883
+ return (jsx(Tooltip, { arrow: true, placement: "top", title: sortTooltip, children: jsx(Badge, { badgeContent: sorting.length > 1 ? column.getSortIndex() + 1 : 0, overlap: "circular", children: jsx(TableSortLabel, { "aria-label": sortTooltip, active: !!column.getIsSorted(), direction: column.getIsSorted()
2884
+ ? column.getIsSorted()
2885
+ : undefined, sx: {
2886
+ flex: '0 0',
2887
+ width: '2.4ch',
2888
+ transform: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) !== 'right'
2889
+ ? 'translateX(-0.5ch)'
2890
+ : undefined,
2891
+ }, IconComponent: ArrowDownwardIcon, onClick: (e) => {
2892
+ var _a;
2893
+ e.stopPropagation();
2894
+ (_a = header.column.getToggleSortingHandler()) === null || _a === void 0 ? void 0 : _a(e);
2895
+ } }) }) }));
2315
2896
  };
2316
2897
 
2317
- const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, table, virtualCell, }) => {
2318
- var _a, _b, _c, _d;
2898
+ const MRT_TableHeadCell = ({ header, table, }) => {
2899
+ var _a, _b, _c, _d, _f, _g;
2319
2900
  const theme = useTheme();
2320
- const { getState, options: { editingMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, enableRowNumbers, layoutMode, muiTableBodyCellProps, muiTableBodyCellSkeletonProps, rowNumberMode, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
2321
- const { draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, density, isLoading, showSkeletons, } = getState();
2322
- const { column, row } = cell;
2901
+ const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering, enableGrouping, enableMultiSort, layoutMode, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
2902
+ const { density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
2903
+ const { column } = header;
2323
2904
  const { columnDef } = column;
2324
2905
  const { columnDefType } = columnDef;
2325
- const mTableCellBodyProps = muiTableBodyCellProps instanceof Function
2326
- ? muiTableBodyCellProps({ cell, column, row, table })
2327
- : muiTableBodyCellProps;
2328
- const mcTableCellBodyProps = columnDef.muiTableBodyCellProps instanceof Function
2329
- ? columnDef.muiTableBodyCellProps({ cell, column, row, table })
2330
- : columnDef.muiTableBodyCellProps;
2331
- const tableCellProps = Object.assign(Object.assign({}, mTableCellBodyProps), mcTableCellBodyProps);
2332
- const skeletonProps = muiTableBodyCellSkeletonProps instanceof Function
2333
- ? muiTableBodyCellSkeletonProps({ cell, column, row, table })
2334
- : muiTableBodyCellSkeletonProps;
2335
- const [skeletonWidth, setSkeletonWidth] = useState(0);
2336
- useEffect(() => setSkeletonWidth(isLoading || showSkeletons
2337
- ? columnDefType === 'display'
2338
- ? column.getSize() / 2
2339
- : Math.round(Math.random() * (column.getSize() - column.getSize() / 3) +
2340
- column.getSize() / 3)
2341
- : 100), []);
2342
- const draggingBorders = useMemo(() => {
2343
- const isDraggingColumn = (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id;
2344
- const isHoveredColumn = (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id;
2345
- const isDraggingRow = (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id;
2346
- const isHoveredRow = (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id;
2347
- const isFirstColumn = getIsFirstColumn(column, table);
2348
- const isLastColumn = getIsLastColumn(column, table);
2349
- const isLastRow = rowIndex === numRows - 1;
2350
- const borderStyle = isDraggingColumn || isDraggingRow
2351
- ? `1px dashed ${theme.palette.text.secondary} !important`
2352
- : isHoveredColumn || isHoveredRow
2353
- ? `2px dashed ${theme.palette.primary.main} !important`
2354
- : undefined;
2355
- return borderStyle
2356
- ? {
2357
- borderLeft: isDraggingColumn ||
2358
- isHoveredColumn ||
2359
- ((isDraggingRow || isHoveredRow) && isFirstColumn)
2360
- ? borderStyle
2361
- : undefined,
2362
- borderRight: isDraggingColumn ||
2363
- isHoveredColumn ||
2364
- ((isDraggingRow || isHoveredRow) && isLastColumn)
2365
- ? borderStyle
2366
- : undefined,
2367
- borderBottom: isDraggingRow || isHoveredRow || isLastRow
2368
- ? borderStyle
2369
- : undefined,
2370
- borderTop: isDraggingRow || isHoveredRow ? borderStyle : undefined,
2371
- }
2372
- : undefined;
2373
- }, [draggingColumn, draggingRow, hoveredColumn, hoveredRow, rowIndex]);
2374
- const isEditable = (enableEditing instanceof Function ? enableEditing(row) : enableEditing) &&
2375
- (columnDef.enableEditing instanceof Function
2376
- ? columnDef.enableEditing(row)
2377
- : columnDef.enableEditing) !== false;
2378
- const isEditing = isEditable &&
2379
- editingMode !== 'modal' &&
2380
- (editingMode === 'table' ||
2381
- (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id ||
2382
- (editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) === cell.id) &&
2383
- !row.getIsGrouped();
2384
- const handleDoubleClick = (event) => {
2385
- var _a;
2386
- (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDoubleClick) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
2387
- if (isEditable && editingMode === 'cell') {
2388
- setEditingCell(cell);
2389
- queueMicrotask(() => {
2390
- var _a;
2391
- const textField = editInputRefs.current[column.id];
2392
- if (textField) {
2393
- textField.focus();
2394
- (_a = textField.select) === null || _a === void 0 ? void 0 : _a.call(textField);
2395
- }
2396
- });
2906
+ const mTableHeadCellProps = muiTableHeadCellProps instanceof Function
2907
+ ? muiTableHeadCellProps({ column, table })
2908
+ : muiTableHeadCellProps;
2909
+ const mcTableHeadCellProps = columnDef.muiTableHeadCellProps instanceof Function
2910
+ ? columnDef.muiTableHeadCellProps({ column, table })
2911
+ : columnDef.muiTableHeadCellProps;
2912
+ const tableCellProps = Object.assign(Object.assign({}, mTableHeadCellProps), mcTableHeadCellProps);
2913
+ const showColumnActions = (enableColumnActions || columnDef.enableColumnActions) &&
2914
+ columnDef.enableColumnActions !== false;
2915
+ const showDragHandle = enableColumnDragging !== false &&
2916
+ columnDef.enableColumnDragging !== false &&
2917
+ (enableColumnDragging ||
2918
+ (enableColumnOrdering && columnDef.enableColumnOrdering !== false) ||
2919
+ (enableGrouping &&
2920
+ columnDef.enableGrouping !== false &&
2921
+ !grouping.includes(column.id)));
2922
+ const headerPL = useMemo(() => {
2923
+ let pl = 0;
2924
+ if (column.getCanSort())
2925
+ pl++;
2926
+ if (showColumnActions)
2927
+ pl += 1.75;
2928
+ if (showDragHandle)
2929
+ pl += 1.25;
2930
+ return pl;
2931
+ }, [showColumnActions, showDragHandle]);
2932
+ const draggingBorder = useMemo(() => (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
2933
+ ? `1px dashed ${theme.palette.text.secondary}`
2934
+ : (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
2935
+ ? `2px dashed ${theme.palette.primary.main}`
2936
+ : undefined, [draggingColumn, hoveredColumn]);
2937
+ const draggingBorders = draggingBorder
2938
+ ? {
2939
+ borderLeft: draggingBorder,
2940
+ borderRight: draggingBorder,
2941
+ borderTop: draggingBorder,
2397
2942
  }
2398
- };
2399
- const handleDragEnter = (e) => {
2400
- var _a;
2401
- (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDragEnter) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, e);
2943
+ : undefined;
2944
+ const handleDragEnter = (_e) => {
2402
2945
  if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
2403
2946
  setHoveredColumn(null);
2404
2947
  }
2405
- if (enableColumnOrdering && draggingColumn) {
2948
+ if (enableColumnOrdering && draggingColumn && columnDefType !== 'group') {
2406
2949
  setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
2407
2950
  }
2408
2951
  };
2409
- return (jsx(TableCell, Object.assign({ "data-index": virtualCell === null || virtualCell === void 0 ? void 0 : virtualCell.index, ref: (node) => {
2952
+ const headerElement = (columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) instanceof Function
2953
+ ? (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) === null || _a === void 0 ? void 0 : _a.call(columnDef, {
2954
+ column,
2955
+ header,
2956
+ table,
2957
+ })
2958
+ : (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) !== null && _b !== void 0 ? _b : columnDef.header;
2959
+ return (jsxs(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: (node) => {
2410
2960
  if (node) {
2411
- measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
2961
+ tableHeadCellRefs.current[column.id] = node;
2412
2962
  }
2413
- } }, tableCellProps, { onDragEnter: handleDragEnter, onDoubleClick: handleDoubleClick, sx: (theme) => (Object.assign(Object.assign({ alignItems: layoutMode === 'grid' ? 'center' : undefined, cursor: isEditable && editingMode === 'cell' ? 'pointer' : 'inherit', justifyContent: layoutMode === 'grid' ? tableCellProps.align : undefined, overflow: 'hidden', p: density === 'compact'
2414
- ? columnDefType === 'display'
2415
- ? '0 0.5rem'
2416
- : '0.5rem'
2963
+ } }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ flexDirection: layoutMode === 'grid' ? 'column' : undefined, fontWeight: 'bold', overflow: 'visible', p: density === 'compact'
2964
+ ? '0.5rem'
2417
2965
  : density === 'comfortable'
2418
2966
  ? columnDefType === 'display'
2419
- ? '0.5rem 0.75rem'
2967
+ ? '0.75rem'
2420
2968
  : '1rem'
2421
2969
  : columnDefType === 'display'
2422
2970
  ? '1rem 1.25rem'
2423
- : '1.5rem', pl: column.id === 'mrt-row-expand'
2424
- ? `${row.depth +
2425
- (density === 'compact'
2426
- ? 0.5
2427
- : density === 'comfortable'
2428
- ? 0.75
2429
- : 1.25)}rem`
2430
- : undefined, textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, whiteSpace: density === 'compact' ? 'nowrap' : 'normal', zIndex: (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id ? 2 : column.getIsPinned() ? 1 : 0, '&:hover': {
2431
- outline: ['table', 'cell'].includes(editingMode !== null && editingMode !== void 0 ? editingMode : '')
2432
- ? `1px solid ${theme.palette.text.secondary}`
2433
- : undefined,
2434
- outlineOffset: '-1px',
2435
- textOverflow: 'clip',
2436
- } }, getCommonCellStyles({
2971
+ : '1.5rem', pb: columnDefType === 'display'
2972
+ ? 0
2973
+ : showColumnFilters || density === 'compact'
2974
+ ? '0.4rem'
2975
+ : '0.6rem', pt: columnDefType === 'group' || density === 'compact'
2976
+ ? '0.25rem'
2977
+ : density === 'comfortable'
2978
+ ? '.75rem'
2979
+ : '1.25rem', userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
2980
+ ? 3
2981
+ : column.getIsPinned() && columnDefType !== 'group'
2982
+ ? 2
2983
+ : 1 }, getCommonCellStyles({
2437
2984
  column,
2985
+ header,
2438
2986
  table,
2439
- theme,
2440
2987
  tableCellProps,
2441
- })), draggingBorders)), children: jsxs(Fragment, { children: [cell.getIsPlaceholder() ? ((_b = (_a = columnDef.PlaceholderCell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table })) !== null && _b !== void 0 ? _b : null) : isLoading || showSkeletons ? (jsx(Skeleton, Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : enableRowNumbers &&
2442
- rowNumberMode === 'static' &&
2443
- column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (jsx(MRT_TableBodyRowGrabHandle, { cell: cell, rowRef: rowRef, table: table })) : columnDefType === 'display' &&
2444
- (column.id === 'mrt-row-select' ||
2445
- column.id === 'mrt-row-expand' ||
2446
- !row.getIsGrouped()) ? ((_c = columnDef.Cell) === null || _c === void 0 ? void 0 : _c.call(columnDef, {
2447
- cell,
2448
- renderedCellValue: cell.renderValue(),
2449
- column,
2450
- row,
2451
- table,
2452
- })) : isEditing ? (jsx(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
2453
- columnDef.enableClickToCopy !== false ? (jsx(MRT_CopyButton, { cell: cell, table: table, children: jsx(MRT_TableBodyCellValue, { cell: cell, table: table }) })) : (jsx(MRT_TableBodyCellValue, { cell: cell, table: table })), cell.getIsGrouped() && !columnDef.GroupedCell && (jsxs(Fragment, { children: [" (", (_d = row.subRows) === null || _d === void 0 ? void 0 : _d.length, ")"] }))] }) })));
2454
- };
2455
- const Memo_MRT_TableBodyCell = memo(MRT_TableBodyCell, (prev, next) => next.cell === prev.cell);
2456
-
2457
- const MRT_TableDetailPanel = ({ parentRowRef, row, rowIndex, table, virtualRow, }) => {
2458
- const { getVisibleLeafColumns, getState, options: { layoutMode, muiTableBodyRowProps, muiTableDetailPanelProps, renderDetailPanel, }, } = table;
2459
- const { isLoading } = getState();
2460
- const tableRowProps = muiTableBodyRowProps instanceof Function
2461
- ? muiTableBodyRowProps({
2462
- isDetailPanel: true,
2463
- row,
2464
- staticRowIndex: rowIndex,
2465
- table,
2466
- })
2467
- : muiTableBodyRowProps;
2468
- const tableCellProps = muiTableDetailPanelProps instanceof Function
2469
- ? muiTableDetailPanelProps({ row, table })
2470
- : muiTableDetailPanelProps;
2471
- return (jsx(TableRow, Object.assign({ className: "Mui-TableBodyCell-DetailPanel" }, tableRowProps, { sx: (theme) => {
2472
- var _a, _b;
2473
- return (Object.assign({ display: layoutMode === 'grid' ? 'flex' : 'table-row', position: virtualRow ? 'absolute' : undefined, top: virtualRow
2474
- ? `${(_b = (_a = parentRowRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.height}px`
2475
- : undefined, transform: virtualRow
2476
- ? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
2477
- : undefined, width: '100%', zIndex: virtualRow ? 2 : undefined }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
2478
- ? tableRowProps.sx(theme)
2479
- : tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx)));
2480
- }, children: jsx(TableCell, Object.assign({ className: "Mui-TableBodyCell-DetailPanel", colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ backgroundColor: virtualRow
2481
- ? lighten(theme.palette.background.default, 0.06)
2482
- : undefined, borderBottom: !row.getIsExpanded() ? 'none' : undefined, display: layoutMode === 'grid' ? 'flex' : 'table-cell', pb: row.getIsExpanded() ? '1rem' : 0, pt: row.getIsExpanded() ? '1rem' : 0, transition: 'all 150ms ease-in-out', width: `${table.getTotalSize()}px` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
2483
- ? tableCellProps.sx(theme)
2484
- : tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))), children: renderDetailPanel && (jsx(Collapse, { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: !isLoading && renderDetailPanel({ row, table }) })) })) })));
2485
- };
2486
-
2487
- const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, row, rowIndex, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, virtualRow, }) => {
2488
- const { getState, options: { enableRowOrdering, layoutMode, memoMode, muiTableBodyRowProps, renderDetailPanel, }, setHoveredRow, } = table;
2489
- const { draggingColumn, draggingRow, editingCell, editingRow, hoveredRow } = getState();
2490
- const tableRowProps = muiTableBodyRowProps instanceof Function
2491
- ? muiTableBodyRowProps({ row, staticRowIndex: rowIndex, table })
2492
- : muiTableBodyRowProps;
2493
- const handleDragEnter = (_e) => {
2494
- if (enableRowOrdering && draggingRow) {
2495
- setHoveredRow(row);
2496
- }
2497
- };
2498
- const rowRef = useRef(null);
2499
- return (jsxs(Fragment, { children: [jsxs(TableRow, Object.assign({ "data-index": virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.index, onDragEnter: handleDragEnter, selected: row.getIsSelected(), ref: (node) => {
2500
- if (node) {
2501
- rowRef.current = node;
2502
- measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
2503
- }
2504
- } }, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.06), boxSizing: 'border-box', display: layoutMode === 'grid' ? 'flex' : 'table-row', opacity: (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id ? 0.5 : 1, position: virtualRow ? 'absolute' : undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', top: virtualRow ? 0 : undefined, width: '100%', '&:hover td': {
2505
- backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false
2506
- ? row.getIsSelected()
2507
- ? `${alpha(theme.palette.primary.main, 0.2)}`
2508
- : theme.palette.mode === 'dark'
2509
- ? `${lighten(theme.palette.background.default, 0.12)}`
2510
- : `${darken(theme.palette.background.default, 0.05)}`
2511
- : undefined,
2512
- } }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
2513
- ? tableRowProps.sx(theme)
2514
- : tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))), style: Object.assign({ transform: virtualRow
2515
- ? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
2516
- : undefined }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style), children: [virtualPaddingLeft ? (jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : row.getVisibleCells()).map((cellOrVirtualCell) => {
2517
- const cell = columnVirtualizer
2518
- ? row.getVisibleCells()[cellOrVirtualCell.index]
2519
- : cellOrVirtualCell;
2520
- const props = {
2521
- cell,
2522
- measureElement: columnVirtualizer === null || columnVirtualizer === void 0 ? void 0 : columnVirtualizer.measureElement,
2523
- numRows,
2524
- rowIndex,
2525
- rowRef,
2526
- table,
2527
- virtualCell: columnVirtualizer
2528
- ? cellOrVirtualCell
2529
- : undefined,
2530
- };
2531
- return memoMode === 'cells' &&
2532
- cell.column.columnDef.columnDefType === 'data' &&
2533
- !draggingColumn &&
2534
- !draggingRow &&
2535
- (editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) !== cell.id &&
2536
- (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) !== row.id ? (jsx(Memo_MRT_TableBodyCell, Object.assign({}, props), cell.id)) : (jsx(MRT_TableBodyCell, Object.assign({}, props), cell.id));
2537
- }), virtualPaddingRight ? (jsx("td", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })), renderDetailPanel && !row.getIsGrouped() && (jsx(MRT_TableDetailPanel, { parentRowRef: rowRef, row: row, rowIndex: rowIndex, table: table, virtualRow: virtualRow }))] }));
2988
+ theme,
2989
+ })), draggingBorders)), children: [header.isPlaceholder ? null : (jsxs(Box, { className: "Mui-TableHeadCell-Content", sx: {
2990
+ alignItems: 'center',
2991
+ display: 'flex',
2992
+ flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
2993
+ justifyContent: columnDefType === 'group' || (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
2994
+ ? 'center'
2995
+ : column.getCanResize()
2996
+ ? 'space-between'
2997
+ : 'flex-start',
2998
+ position: 'relative',
2999
+ width: '100%',
3000
+ }, children: [jsxs(Box, { className: "Mui-TableHeadCell-Content-Labels", onClick: column.getToggleSortingHandler(), sx: {
3001
+ alignItems: 'center',
3002
+ cursor: column.getCanSort() && columnDefType !== 'group'
3003
+ ? 'pointer'
3004
+ : undefined,
3005
+ display: 'flex',
3006
+ flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
3007
+ overflow: columnDefType === 'data' ? 'hidden' : undefined,
3008
+ pl: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
3009
+ ? `${headerPL}rem`
3010
+ : undefined,
3011
+ }, children: [jsx(Box, { className: "Mui-TableHeadCell-Content-Wrapper", sx: {
3012
+ minWidth: `${Math.min((_d = (_c = columnDef.header) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0, 5)}ch`,
3013
+ overflow: columnDefType === 'data' ? 'hidden' : undefined,
3014
+ textOverflow: 'ellipsis',
3015
+ whiteSpace: ((_g = (_f = columnDef.header) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 0) < 20 ? 'nowrap' : 'normal',
3016
+ '&:hover': {
3017
+ textOverflow: 'clip',
3018
+ },
3019
+ }, title: columnDefType === 'data' ? columnDef.header : undefined, children: headerElement }), column.getCanSort() && (jsx(MRT_TableHeadCellSortLabel, { header: header, table: table, tableCellProps: tableCellProps })), column.getCanFilter() && (jsx(MRT_TableHeadCellFilterLabel, { header: header, table: table }))] }), columnDefType !== 'group' && (jsxs(Box, { className: "Mui-TableHeadCell-Content-Actions", sx: { whiteSpace: 'nowrap' }, children: [showDragHandle && (jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
3020
+ current: tableHeadCellRefs.current[column.id],
3021
+ } })), showColumnActions && (jsx(MRT_TableHeadCellColumnActionsButton, { header: header, table: table }))] })), column.getCanResize() && (jsx(MRT_TableHeadCellResizeHandle, { header: header, table: table }))] })), column.getCanFilter() && (jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }))] })));
2538
3022
  };
2539
- const Memo_MRT_TableBodyRow = memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row && prev.rowIndex === next.rowIndex);
2540
3023
 
2541
- const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
2542
- var _a, _b, _c, _d;
2543
- const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, layoutMode, localization, manualExpanding, manualFiltering, manualGrouping, manualPagination, manualSorting, memoMode, muiTableBodyProps, renderEmptyRowsFallback, rowVirtualizerInstanceRef, rowVirtualizerProps, virtualizerInstanceRef, virtualizerProps, }, refs: { tableContainerRef, tablePaperRef }, } = table;
2544
- const { columnFilters, density, expanded, globalFilter, globalFilterFn, pagination, sorting, } = getState();
2545
- const tableBodyProps = muiTableBodyProps instanceof Function
2546
- ? muiTableBodyProps({ table })
2547
- : muiTableBodyProps;
2548
- const vProps_old = virtualizerProps instanceof Function
2549
- ? virtualizerProps({ table })
2550
- : virtualizerProps;
2551
- const vProps = rowVirtualizerProps instanceof Function
2552
- ? rowVirtualizerProps({ table })
2553
- : rowVirtualizerProps;
2554
- const shouldRankResults = useMemo(() => !manualExpanding &&
2555
- !manualFiltering &&
2556
- !manualGrouping &&
2557
- !manualSorting &&
2558
- enableGlobalFilterRankedResults &&
2559
- globalFilter &&
2560
- globalFilterFn === 'fuzzy' &&
2561
- expanded !== true &&
2562
- !Object.values(sorting).some(Boolean) &&
2563
- !Object.values(expanded).some(Boolean), [
2564
- enableGlobalFilterRankedResults,
2565
- expanded,
2566
- globalFilter,
2567
- manualExpanding,
2568
- manualFiltering,
2569
- manualGrouping,
2570
- manualSorting,
2571
- sorting,
2572
- ]);
2573
- const rows = useMemo(() => {
2574
- if (!shouldRankResults)
2575
- return getRowModel().rows;
2576
- const rankedRows = getPrePaginationRowModel().rows.sort((a, b) => rankGlobalFuzzy(a, b));
2577
- if (enablePagination && !manualPagination) {
2578
- const start = pagination.pageIndex * pagination.pageSize;
2579
- return rankedRows.slice(start, start + pagination.pageSize);
2580
- }
2581
- return rankedRows;
2582
- }, [
2583
- shouldRankResults,
2584
- shouldRankResults ? getPrePaginationRowModel().rows : getRowModel().rows,
2585
- pagination.pageIndex,
2586
- pagination.pageSize,
2587
- ]);
2588
- const rowVirtualizer = enableRowVirtualization
2589
- ? useVirtualizer(Object.assign(Object.assign({ count: rows.length, estimateSize: () => density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73, getScrollElement: () => tableContainerRef.current, measureElement: typeof window !== 'undefined' &&
2590
- navigator.userAgent.indexOf('Firefox') === -1
2591
- ? (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height
2592
- : undefined, overscan: 4 }, vProps_old), vProps))
2593
- : undefined;
2594
- if (rowVirtualizerInstanceRef && rowVirtualizer) {
2595
- rowVirtualizerInstanceRef.current = rowVirtualizer;
2596
- }
2597
- //deprecated
2598
- if (virtualizerInstanceRef && rowVirtualizer) {
2599
- virtualizerInstanceRef.current = rowVirtualizer;
2600
- }
2601
- const virtualRows = rowVirtualizer
2602
- ? rowVirtualizer.getVirtualItems()
2603
- : undefined;
2604
- return (jsx(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', height: rowVirtualizer
2605
- ? `${rowVirtualizer.getTotalSize()}px`
2606
- : 'inherit', minHeight: !rows.length ? '100px' : undefined, position: 'relative' }, ((tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx) instanceof Function
2607
- ? tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx(theme)
2608
- : tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx))), children: (_a = tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.children) !== null && _a !== void 0 ? _a : (!rows.length ? (jsx("tr", { style: { display: layoutMode === 'grid' ? 'grid' : 'table-row' }, children: jsx("td", { colSpan: table.getVisibleLeafColumns().length, style: {
2609
- display: layoutMode === 'grid' ? 'grid' : 'table-cell',
2610
- }, children: (_b = renderEmptyRowsFallback === null || renderEmptyRowsFallback === void 0 ? void 0 : renderEmptyRowsFallback({ table })) !== null && _b !== void 0 ? _b : (jsx(Typography, { sx: {
2611
- color: 'text.secondary',
2612
- fontStyle: 'italic',
2613
- maxWidth: `min(100vw, ${(_d = (_c = tablePaperRef.current) === null || _c === void 0 ? void 0 : _c.clientWidth) !== null && _d !== void 0 ? _d : 360}px)`,
2614
- py: '2rem',
2615
- textAlign: 'center',
2616
- width: '100%',
2617
- }, children: globalFilter || columnFilters.length
2618
- ? localization.noResultsFound
2619
- : localization.noRecordsToDisplay })) }) })) : (jsx(Fragment, { children: (virtualRows !== null && virtualRows !== void 0 ? virtualRows : rows).map((rowOrVirtualRow, rowIndex) => {
2620
- const row = rowVirtualizer
2621
- ? rows[rowOrVirtualRow.index]
2622
- : rowOrVirtualRow;
2623
- const props = {
2624
- columnVirtualizer,
2625
- measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
2626
- numRows: rows.length,
2627
- row,
2628
- rowIndex: rowVirtualizer ? rowOrVirtualRow.index : rowIndex,
2629
- table,
2630
- virtualColumns,
2631
- virtualPaddingLeft,
2632
- virtualPaddingRight,
2633
- virtualRow: rowVirtualizer
2634
- ? rowOrVirtualRow
2635
- : undefined,
2636
- };
2637
- return memoMode === 'rows' ? (jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
2638
- }) }))) })));
3024
+ const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
3025
+ const { options: { layoutMode, muiTableHeadRowProps }, } = table;
3026
+ const tableRowProps = muiTableHeadRowProps instanceof Function
3027
+ ? muiTableHeadRowProps({ headerGroup, table })
3028
+ : muiTableHeadRowProps;
3029
+ return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.04), boxShadow: `4px 0 8px ${alpha(theme.palette.common.black, 0.1)}`, display: layoutMode === 'grid' ? 'flex' : 'table-row', top: 0 }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
3030
+ ? tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx(theme)
3031
+ : tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))), children: [virtualPaddingLeft ? (jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader) => {
3032
+ const header = virtualColumns
3033
+ ? headerGroup.headers[headerOrVirtualHeader.index]
3034
+ : headerOrVirtualHeader;
3035
+ return (jsx(MRT_TableHeadCell, { header: header, table: table }, header.id));
3036
+ }), virtualPaddingRight ? (jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
3037
+ };
3038
+
3039
+ const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
3040
+ const { getHeaderGroups, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps }, } = table;
3041
+ const { isFullScreen } = getState();
3042
+ const tableHeadProps = muiTableHeadProps instanceof Function
3043
+ ? muiTableHeadProps({ table })
3044
+ : muiTableHeadProps;
3045
+ const stickyHeader = enableStickyHeader || isFullScreen;
3046
+ return (jsx(TableHead, Object.assign({}, tableHeadProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', opacity: 0.97, position: stickyHeader ? 'sticky' : 'relative', top: stickyHeader && layoutMode === 'grid' ? 0 : undefined, zIndex: stickyHeader ? 2 : undefined }, ((tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx) instanceof Function
3047
+ ? tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx(theme)
3048
+ : tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx))), children: getHeaderGroups().map((headerGroup) => (jsx(MRT_TableHeadRow, { headerGroup: headerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, headerGroup.id))) })));
2639
3049
  };
2640
- const Memo_MRT_TableBody = memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
2641
3050
 
2642
- const MRT_TableFooterCell = ({ footer, table }) => {
3051
+ const MRT_TableFooterCell = ({ footer, table, }) => {
2643
3052
  var _a, _b, _c;
2644
3053
  const { getState, options: { layoutMode, muiTableFooterCellProps }, } = table;
2645
3054
  const { density } = getState();
@@ -2710,16 +3119,16 @@ const MRT_TableFooter = ({ table, virtualColumns, virtualPaddingLeft, virtualPad
2710
3119
  : tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx))), children: getFooterGroups().map((footerGroup) => (jsx(MRT_TableFooterRow, { footerGroup: footerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, footerGroup.id))) })));
2711
3120
  };
2712
3121
 
2713
- const MRT_Table = ({ table }) => {
3122
+ const MRT_Table = ({ table, }) => {
2714
3123
  var _a, _b, _c, _d;
2715
- const { getFlatHeaders, getState, options: { columns, columnVirtualizerInstanceRef, columnVirtualizerProps, enableColumnResizing, enableColumnVirtualization, enablePinning, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, }, refs: { tableContainerRef }, } = table;
3124
+ const { getFlatHeaders, getState, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, columns, enableColumnResizing, enableColumnVirtualization, enableColumnPinning, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, }, refs: { tableContainerRef }, } = table;
2716
3125
  const { columnPinning, columnSizing, columnSizingInfo, columnVisibility, isFullScreen, } = getState();
2717
3126
  const tableProps = muiTableProps instanceof Function
2718
3127
  ? muiTableProps({ table })
2719
3128
  : muiTableProps;
2720
- const vProps = columnVirtualizerProps instanceof Function
2721
- ? columnVirtualizerProps({ table })
2722
- : columnVirtualizerProps;
3129
+ const vProps = columnVirtualizerOptions instanceof Function
3130
+ ? columnVirtualizerOptions({ table })
3131
+ : columnVirtualizerOptions;
2723
3132
  const columnSizeVars = useMemo(() => {
2724
3133
  const headers = getFlatHeaders();
2725
3134
  const colSizes = {};
@@ -2741,14 +3150,14 @@ const MRT_Table = ({ table }) => {
2741
3150
  .rows[0]) === null || _a === void 0 ? void 0 : _a.getCenterVisibleCells()) === null || _b === void 0 ? void 0 : _b.slice(0, 16)) === null || _c === void 0 ? void 0 : _c.map((cell) => cell.column.getSize() * 1.2)) !== null && _d !== void 0 ? _d : [];
2742
3151
  return columnsWidths.reduce((a, b) => a + b, 0) / columnsWidths.length;
2743
3152
  }, [table.getRowModel().rows, columnPinning, columnVisibility]);
2744
- const [leftPinnedIndexes, rightPinnedIndexes] = useMemo(() => enableColumnVirtualization && enablePinning
3153
+ const [leftPinnedIndexes, rightPinnedIndexes] = useMemo(() => enableColumnVirtualization && enableColumnPinning
2745
3154
  ? [
2746
3155
  table.getLeftLeafColumns().map((c) => c.getPinnedIndex()),
2747
3156
  table
2748
3157
  .getRightLeafColumns()
2749
3158
  .map((c) => table.getVisibleLeafColumns().length - c.getPinnedIndex() - 1),
2750
3159
  ]
2751
- : [[], []], [columnPinning, enableColumnVirtualization, enablePinning]);
3160
+ : [[], []], [columnPinning, enableColumnVirtualization, enableColumnPinning]);
2752
3161
  const columnVirtualizer = enableColumnVirtualization
2753
3162
  ? useVirtualizer(Object.assign({ count: table.getVisibleLeafColumns().length, estimateSize: () => averageColumnWidth, getScrollElement: () => tableContainerRef.current, horizontal: true, overscan: 3, rangeExtractor: useCallback((range) => [
2754
3163
  ...new Set([
@@ -2778,15 +3187,60 @@ const MRT_Table = ({ table }) => {
2778
3187
  virtualPaddingLeft,
2779
3188
  virtualPaddingRight,
2780
3189
  };
2781
- return (jsxs(Table, Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: layoutMode === 'grid' ? 'grid' : 'table', tableLayout: layoutMode !== 'grid' && enableColumnResizing ? 'fixed' : undefined }, ((tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx) instanceof Function
2782
- ? tableProps.sx(theme)
2783
- : tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx))), style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style), children: [enableTableHead && jsx(MRT_TableHead, Object.assign({}, props)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsx(Memo_MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))) : (jsx(MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))), enableTableFooter && jsx(MRT_TableFooter, Object.assign({}, props))] })));
3190
+ return (jsx(Fragment, { children: jsxs(Table, Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: layoutMode === 'grid' ? 'grid' : 'table', tableLayout: layoutMode !== 'grid' && enableColumnResizing ? 'fixed' : undefined }, ((tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx) instanceof Function
3191
+ ? tableProps.sx(theme)
3192
+ : tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx))), style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style), children: [enableTableHead && jsx(MRT_TableHead, Object.assign({}, props)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsx(Memo_MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))) : (jsx(MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))), enableTableFooter && jsx(MRT_TableFooter, Object.assign({}, props))] })) }));
3193
+ };
3194
+
3195
+ const MRT_EditRowModal = ({ open, table, }) => {
3196
+ var _a;
3197
+ const { getState, options: { localization, onEditingRowCancel, onCreatingRowCancel, renderEditRowModalContent, renderCreateRowModalContent, muiCreateRowModalProps, muiEditRowModalProps, }, setEditingRow, setCreatingRow, } = table;
3198
+ const { creatingRow, editingRow } = getState();
3199
+ const row = (creatingRow !== null && creatingRow !== void 0 ? creatingRow : editingRow);
3200
+ const createModalProps = muiCreateRowModalProps instanceof Function
3201
+ ? muiCreateRowModalProps({ row, table })
3202
+ : muiCreateRowModalProps;
3203
+ const editModalProps = muiEditRowModalProps instanceof Function
3204
+ ? muiEditRowModalProps({ row, table })
3205
+ : muiEditRowModalProps;
3206
+ const dialogProps = Object.assign(Object.assign({}, editModalProps), (creatingRow && createModalProps));
3207
+ const internalEditComponents = row
3208
+ .getAllCells()
3209
+ .filter((cell) => cell.column.columnDef.columnDefType === 'data')
3210
+ .map((cell) => (jsx(MRT_EditCellTextField, { cell: cell, table: table }, cell.id)));
3211
+ return (jsx(Dialog, Object.assign({ fullWidth: true, maxWidth: "xs", onClose: (event, reason) => {
3212
+ var _a;
3213
+ if (creatingRow) {
3214
+ onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
3215
+ setCreatingRow(null);
3216
+ }
3217
+ else {
3218
+ onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
3219
+ setEditingRow(null);
3220
+ }
3221
+ row._valuesCache = {}; //reset values cache
3222
+ (_a = dialogProps.onClose) === null || _a === void 0 ? void 0 : _a.call(dialogProps, event, reason);
3223
+ }, open: open }, dialogProps, { children: (_a = ((creatingRow &&
3224
+ (renderCreateRowModalContent === null || renderCreateRowModalContent === void 0 ? void 0 : renderCreateRowModalContent({
3225
+ row,
3226
+ table,
3227
+ internalEditComponents,
3228
+ }))) ||
3229
+ (renderEditRowModalContent === null || renderEditRowModalContent === void 0 ? void 0 : renderEditRowModalContent({
3230
+ row,
3231
+ table,
3232
+ internalEditComponents,
3233
+ })))) !== null && _a !== void 0 ? _a : (jsxs(Fragment, { children: [jsx(DialogTitle, { sx: { textAlign: 'center' }, children: (creatingRow && localization.create) || localization.edit }), jsx(DialogContent, { children: jsx("form", { onSubmit: (e) => e.preventDefault(), children: jsx(Stack, { sx: {
3234
+ gap: '24px',
3235
+ paddingTop: '16px',
3236
+ width: '100%',
3237
+ }, children: internalEditComponents }) }) }), jsx(DialogActions, { sx: { p: '1.25rem' }, children: jsx(MRT_EditActionButtons, { row: row, table: table, variant: "text" }) })] })) })));
2784
3238
  };
2785
3239
 
2786
3240
  const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
2787
- const MRT_TableContainer = ({ table }) => {
2788
- const { getState, options: { enableStickyHeader, muiTableContainerProps }, refs: { tableContainerRef, bottomToolbarRef, topToolbarRef }, } = table;
2789
- const { isFullScreen } = getState();
3241
+ const MRT_TableContainer = ({ table, }) => {
3242
+ const { getState, options: { createDisplayMode, editDisplayMode, enableStickyHeader, muiTableContainerProps, }, refs: { tableContainerRef, bottomToolbarRef, topToolbarRef }, } = table;
3243
+ const { isFullScreen, creatingRow, editingRow, } = getState();
2790
3244
  const [totalToolbarHeight, setTotalToolbarHeight] = useState(0);
2791
3245
  const tableContainerProps = muiTableContainerProps instanceof Function
2792
3246
  ? muiTableContainerProps({ table })
@@ -2801,7 +3255,9 @@ const MRT_TableContainer = ({ table }) => {
2801
3255
  : 0;
2802
3256
  setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
2803
3257
  });
2804
- return (jsx(TableContainer, Object.assign({}, tableContainerProps, { ref: (node) => {
3258
+ const createModalOpen = createDisplayMode === 'modal' && creatingRow;
3259
+ const editModalOpen = editDisplayMode === 'modal' && editingRow;
3260
+ return (jsxs(TableContainer, Object.assign({}, tableContainerProps, { ref: (node) => {
2805
3261
  if (node) {
2806
3262
  tableContainerRef.current = node;
2807
3263
  if (tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) {
@@ -2815,10 +3271,10 @@ const MRT_TableContainer = ({ table }) => {
2815
3271
  ? tableContainerProps.sx(theme)
2816
3272
  : tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx))), style: Object.assign({ maxHeight: isFullScreen
2817
3273
  ? `calc(100vh - ${totalToolbarHeight}px)`
2818
- : undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), children: jsx(MRT_Table, { table: table }) })));
3274
+ : undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), children: [jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsx(MRT_EditRowModal, { open: true, table: table }))] })));
2819
3275
  };
2820
3276
 
2821
- const MRT_TablePaper = ({ table }) => {
3277
+ const MRT_TablePaper = ({ table, }) => {
2822
3278
  const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
2823
3279
  const { isFullScreen } = getState();
2824
3280
  const tablePaperProps = muiTablePaperProps instanceof Function
@@ -2830,16 +3286,22 @@ const MRT_TablePaper = ({ table }) => {
2830
3286
  //@ts-ignore
2831
3287
  tablePaperProps.ref.current = ref;
2832
3288
  }
2833
- }, sx: (theme) => (Object.assign({ transition: 'all 150ms ease-in-out' }, ((tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx) instanceof Function
3289
+ }, sx: (theme) => (Object.assign({ overflow: 'hidden', transition: 'all 100ms ease-in-out' }, ((tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx) instanceof Function
2834
3290
  ? tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx(theme)
2835
3291
  : tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx))), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), (isFullScreen
2836
3292
  ? {
3293
+ bottom: 0,
2837
3294
  height: '100vh',
3295
+ left: 0,
2838
3296
  margin: 0,
2839
3297
  maxHeight: '100vh',
2840
3298
  maxWidth: '100vw',
2841
3299
  padding: 0,
3300
+ position: 'fixed',
3301
+ right: 0,
3302
+ top: 0,
2842
3303
  width: '100vw',
3304
+ zIndex: 10,
2843
3305
  }
2844
3306
  : {})), children: [enableTopToolbar &&
2845
3307
  (renderTopToolbar instanceof Function
@@ -2850,237 +3312,17 @@ const MRT_TablePaper = ({ table }) => {
2850
3312
  : renderBottomToolbar !== null && renderBottomToolbar !== void 0 ? renderBottomToolbar : jsx(MRT_BottomToolbar, { table: table }))] })));
2851
3313
  };
2852
3314
 
2853
- const MRT_EditRowModal = ({ open, row, table, }) => {
2854
- const { options: { localization }, } = table;
2855
- return (jsxs(Dialog, { open: open, children: [jsx(DialogTitle, { textAlign: "center", children: localization.edit }), jsx(DialogContent, { children: jsx("form", { onSubmit: (e) => e.preventDefault(), children: jsx(Stack, { sx: {
2856
- gap: '1.5rem',
2857
- minWidth: { xs: '300px', sm: '360px', md: '400px' },
2858
- pt: '1rem',
2859
- width: '100%',
2860
- }, children: row
2861
- .getAllCells()
2862
- .filter((cell) => cell.column.columnDef.columnDefType === 'data')
2863
- .map((cell) => (jsx(MRT_EditCellTextField, { cell: cell, showLabel: true, table: table }, cell.id))) }) }) }), jsx(DialogActions, { sx: { p: '1.25rem' }, children: jsx(MRT_EditActionButtons, { row: row, table: table, variant: "text" }) })] }));
2864
- };
2865
-
2866
- const MRT_TableRoot = (props) => {
2867
- 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, _11, _12, _13;
2868
- const bottomToolbarRef = useRef(null);
2869
- const editInputRefs = useRef({});
2870
- const filterInputRefs = useRef({});
2871
- const searchInputRef = useRef(null);
2872
- const tableContainerRef = useRef(null);
2873
- const tableHeadCellRefs = useRef({});
2874
- const tablePaperRef = useRef(null);
2875
- const topToolbarRef = useRef(null);
2876
- const initialState = useMemo(() => {
2877
- var _a, _b, _c;
2878
- const initState = (_a = props.initialState) !== null && _a !== void 0 ? _a : {};
2879
- initState.columnOrder =
2880
- (_b = initState.columnOrder) !== null && _b !== void 0 ? _b : getDefaultColumnOrderIds(props);
2881
- initState.globalFilterFn = (_c = props.globalFilterFn) !== null && _c !== void 0 ? _c : 'fuzzy';
2882
- return initState;
2883
- }, []);
2884
- const [columnFilterFns, setColumnFilterFns] = useState(() => Object.assign({}, ...getAllLeafColumnDefs(props.columns).map((col) => {
2885
- var _a, _b, _c, _d;
2886
- return ({
2887
- [getColumnId(col)]: col.filterFn instanceof Function
2888
- ? (_a = col.filterFn.name) !== null && _a !== void 0 ? _a : 'custom'
2889
- : (_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),
2890
- });
2891
- })));
2892
- const [columnOrder, setColumnOrder] = useState((_a = initialState.columnOrder) !== null && _a !== void 0 ? _a : []);
2893
- const [density, setDensity] = useState((_b = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _b !== void 0 ? _b : 'comfortable');
2894
- const [draggingColumn, setDraggingColumn] = useState((_c = initialState.draggingColumn) !== null && _c !== void 0 ? _c : null);
2895
- const [draggingRow, setDraggingRow] = useState((_d = initialState.draggingRow) !== null && _d !== void 0 ? _d : null);
2896
- const [editingCell, setEditingCell] = useState((_e = initialState.editingCell) !== null && _e !== void 0 ? _e : null);
2897
- const [editingRow, setEditingRow] = useState((_f = initialState.editingRow) !== null && _f !== void 0 ? _f : null);
2898
- const [globalFilterFn, setGlobalFilterFn] = useState((_g = initialState.globalFilterFn) !== null && _g !== void 0 ? _g : 'fuzzy');
2899
- const [grouping, setGrouping] = useState((_h = initialState.grouping) !== null && _h !== void 0 ? _h : []);
2900
- const [hoveredColumn, setHoveredColumn] = useState((_j = initialState.hoveredColumn) !== null && _j !== void 0 ? _j : null);
2901
- const [hoveredRow, setHoveredRow] = useState((_k = initialState.hoveredRow) !== null && _k !== void 0 ? _k : null);
2902
- const [isFullScreen, setIsFullScreen] = useState((_l = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _l !== void 0 ? _l : false);
2903
- const [showAlertBanner, setShowAlertBanner] = useState((_o = (_m = props.initialState) === null || _m === void 0 ? void 0 : _m.showAlertBanner) !== null && _o !== void 0 ? _o : false);
2904
- const [showColumnFilters, setShowColumnFilters] = useState((_p = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _p !== void 0 ? _p : false);
2905
- const [showGlobalFilter, setShowGlobalFilter] = useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _q !== void 0 ? _q : false);
2906
- const [showToolbarDropZone, setShowToolbarDropZone] = useState((_r = initialState === null || initialState === void 0 ? void 0 : initialState.showToolbarDropZone) !== null && _r !== void 0 ? _r : false);
2907
- const displayColumns = useMemo(() => {
2908
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
2909
- return [
2910
- ((_b = (_a = props.state) === null || _a === void 0 ? void 0 : _a.columnOrder) !== null && _b !== void 0 ? _b : columnOrder).includes('mrt-row-drag') && Object.assign(Object.assign(Object.assign({ header: props.localization.move, size: 60 }, props.defaultDisplayColumn), (_c = props.displayColumnDefOptions) === null || _c === void 0 ? void 0 : _c['mrt-row-drag']), { id: 'mrt-row-drag' }),
2911
- ((_e = (_d = props.state) === null || _d === void 0 ? void 0 : _d.columnOrder) !== null && _e !== void 0 ? _e : columnOrder).includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row }) => (jsx(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })), header: props.localization.actions, size: 70 }, props.defaultDisplayColumn), (_f = props.displayColumnDefOptions) === null || _f === void 0 ? void 0 : _f['mrt-row-actions']), { id: 'mrt-row-actions' }),
2912
- ((_h = (_g = props.state) === null || _g === void 0 ? void 0 : _g.columnOrder) !== null && _h !== void 0 ? _h : columnOrder).includes('mrt-row-expand') &&
2913
- showExpandColumn(props, (_k = (_j = props.state) === null || _j === void 0 ? void 0 : _j.grouping) !== null && _k !== void 0 ? _k : grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (jsx(MRT_ExpandButton, { row: row, table: table })), Header: props.enableExpandAll
2914
- ? () => jsx(MRT_ExpandAllButton, { table: table })
2915
- : null, header: props.localization.expand, size: 60 }, props.defaultDisplayColumn), (_l = props.displayColumnDefOptions) === null || _l === void 0 ? void 0 : _l['mrt-row-expand']), { id: 'mrt-row-expand' }),
2916
- ((_o = (_m = props.state) === null || _m === void 0 ? void 0 : _m.columnOrder) !== null && _o !== void 0 ? _o : columnOrder).includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (jsx(MRT_SelectCheckbox, { row: row, table: table })), Header: props.enableSelectAll && props.enableMultiRowSelection
2917
- ? () => jsx(MRT_SelectCheckbox, { selectAll: true, table: table })
2918
- : null, header: props.localization.select, size: 60 }, props.defaultDisplayColumn), (_p = props.displayColumnDefOptions) === null || _p === void 0 ? void 0 : _p['mrt-row-select']), { id: 'mrt-row-select' }),
2919
- ((_r = (_q = props.state) === null || _q === void 0 ? void 0 : _q.columnOrder) !== null && _r !== void 0 ? _r : columnOrder).includes('mrt-row-numbers') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => row.index + 1, Header: () => props.localization.rowNumber, header: props.localization.rowNumbers, size: 60 }, props.defaultDisplayColumn), (_s = props.displayColumnDefOptions) === null || _s === void 0 ? void 0 : _s['mrt-row-numbers']), { id: 'mrt-row-numbers' }),
2920
- ].filter(Boolean);
2921
- }, [
2922
- columnOrder,
2923
- grouping,
2924
- props.displayColumnDefOptions,
2925
- props.editingMode,
2926
- props.enableColumnDragging,
2927
- props.enableColumnFilterModes,
2928
- props.enableColumnOrdering,
2929
- props.enableEditing,
2930
- props.enableExpandAll,
2931
- props.enableExpanding,
2932
- props.enableGrouping,
2933
- props.enableRowActions,
2934
- props.enableRowDragging,
2935
- props.enableRowNumbers,
2936
- props.enableRowOrdering,
2937
- props.enableRowSelection,
2938
- props.enableSelectAll,
2939
- props.localization,
2940
- props.positionActionsColumn,
2941
- props.renderDetailPanel,
2942
- props.renderRowActionMenuItems,
2943
- props.renderRowActions,
2944
- (_s = props.state) === null || _s === void 0 ? void 0 : _s.columnOrder,
2945
- (_t = props.state) === null || _t === void 0 ? void 0 : _t.grouping,
2946
- ]);
2947
- const columnDefs = useMemo(() => {
2948
- var _a, _b, _c;
2949
- return prepareColumns({
2950
- aggregationFns: props.aggregationFns,
2951
- columnDefs: [...displayColumns, ...props.columns],
2952
- columnFilterFns: (_b = (_a = props.state) === null || _a === void 0 ? void 0 : _a.columnFilterFns) !== null && _b !== void 0 ? _b : columnFilterFns,
2953
- defaultDisplayColumn: (_c = props.defaultDisplayColumn) !== null && _c !== void 0 ? _c : {},
2954
- filterFns: props.filterFns,
2955
- sortingFns: props.sortingFns,
2956
- });
2957
- }, [
2958
- columnFilterFns,
2959
- displayColumns,
2960
- props.columns,
2961
- (_u = props.state) === null || _u === void 0 ? void 0 : _u.columnFilterFns,
2962
- ]);
2963
- const data = useMemo(() => {
2964
- var _a, _b, _c, _d, _e;
2965
- return (((_a = props.state) === null || _a === void 0 ? void 0 : _a.isLoading) || ((_b = props.state) === null || _b === void 0 ? void 0 : _b.showSkeletons)) &&
2966
- !props.data.length
2967
- ? [
2968
- ...Array(((_d = (_c = props.state) === null || _c === void 0 ? void 0 : _c.pagination) === null || _d === void 0 ? void 0 : _d.pageSize) ||
2969
- ((_e = initialState === null || initialState === void 0 ? void 0 : initialState.pagination) === null || _e === void 0 ? void 0 : _e.pageSize) ||
2970
- 10).fill(null),
2971
- ].map(() => Object.assign({}, ...getAllLeafColumnDefs(props.columns).map((col) => ({
2972
- [getColumnId(col)]: null,
2973
- }))))
2974
- : props.data;
2975
- }, [props.data, (_v = props.state) === null || _v === void 0 ? void 0 : _v.isLoading, (_w = props.state) === null || _w === void 0 ? void 0 : _w.showSkeletons]);
2976
- //@ts-ignore
2977
- const table = Object.assign(Object.assign({}, useReactTable(Object.assign(Object.assign({ getCoreRowModel: getCoreRowModel(), getExpandedRowModel: props.enableExpanding || props.enableGrouping
2978
- ? getExpandedRowModel()
2979
- : undefined, getFacetedMinMaxValues: props.enableFacetedValues
2980
- ? getFacetedMinMaxValues()
2981
- : undefined, getFacetedRowModel: props.enableFacetedValues
2982
- ? getFacetedRowModel()
2983
- : undefined, getFacetedUniqueValues: props.enableFacetedValues
2984
- ? getFacetedUniqueValues()
2985
- : undefined, getFilteredRowModel: props.enableColumnFilters ||
2986
- props.enableGlobalFilter ||
2987
- props.enableFilters
2988
- ? getFilteredRowModel()
2989
- : undefined, getGroupedRowModel: props.enableGrouping
2990
- ? getGroupedRowModel()
2991
- : undefined, getPaginationRowModel: props.enablePagination
2992
- ? getPaginationRowModel()
2993
- : undefined, getSortedRowModel: props.enableSorting ? getSortedRowModel() : undefined, onColumnOrderChange: setColumnOrder, onGroupingChange: setGrouping, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows }, props), {
2994
- //@ts-ignore
2995
- columns: columnDefs, data, globalFilterFn: (_y = (_x = props.filterFns) === null || _x === void 0 ? void 0 : _x[globalFilterFn]) !== null && _y !== void 0 ? _y : (_z = props.filterFns) === null || _z === void 0 ? void 0 : _z.fuzzy, initialState, state: Object.assign({ columnFilterFns,
2996
- columnOrder,
2997
- density,
2998
- draggingColumn,
2999
- draggingRow,
3000
- editingCell,
3001
- editingRow,
3002
- globalFilterFn,
3003
- grouping,
3004
- hoveredColumn,
3005
- hoveredRow,
3006
- isFullScreen,
3007
- showAlertBanner,
3008
- showColumnFilters,
3009
- showGlobalFilter,
3010
- showToolbarDropZone }, props.state) }))), { refs: {
3011
- bottomToolbarRef,
3012
- editInputRefs,
3013
- filterInputRefs,
3014
- searchInputRef,
3015
- tableContainerRef,
3016
- tableHeadCellRefs,
3017
- tablePaperRef,
3018
- topToolbarRef,
3019
- }, setColumnFilterFns: (_0 = props.onColumnFilterFnsChange) !== null && _0 !== void 0 ? _0 : setColumnFilterFns, setDensity: (_1 = props.onDensityChange) !== null && _1 !== void 0 ? _1 : setDensity, setDraggingColumn: (_2 = props.onDraggingColumnChange) !== null && _2 !== void 0 ? _2 : setDraggingColumn, setDraggingRow: (_3 = props.onDraggingRowChange) !== null && _3 !== void 0 ? _3 : setDraggingRow, setEditingCell: (_4 = props.onEditingCellChange) !== null && _4 !== void 0 ? _4 : setEditingCell, setEditingRow: (_5 = props.onEditingRowChange) !== null && _5 !== void 0 ? _5 : setEditingRow, setGlobalFilterFn: (_6 = props.onGlobalFilterFnChange) !== null && _6 !== void 0 ? _6 : setGlobalFilterFn, setHoveredColumn: (_7 = props.onHoveredColumnChange) !== null && _7 !== void 0 ? _7 : setHoveredColumn, setHoveredRow: (_8 = props.onHoveredRowChange) !== null && _8 !== void 0 ? _8 : setHoveredRow, setIsFullScreen: (_9 = props.onIsFullScreenChange) !== null && _9 !== void 0 ? _9 : setIsFullScreen, setShowAlertBanner: (_10 = props.onShowAlertBannerChange) !== null && _10 !== void 0 ? _10 : setShowAlertBanner, setShowColumnFilters: (_11 = props.onShowColumnFiltersChange) !== null && _11 !== void 0 ? _11 : setShowColumnFilters, setShowGlobalFilter: (_12 = props.onShowGlobalFilterChange) !== null && _12 !== void 0 ? _12 : setShowGlobalFilter, setShowToolbarDropZone: (_13 = props.onShowToolbarDropZoneChange) !== null && _13 !== void 0 ? _13 : setShowToolbarDropZone });
3020
- if (props.tableFeatures) {
3021
- props.tableFeatures.forEach((feature) => {
3022
- Object.assign(table, feature(table));
3023
- });
3024
- }
3025
- if (props.tableInstanceRef) {
3026
- props.tableInstanceRef.current = table;
3027
- }
3028
- const initialBodyHeight = useRef();
3029
- useEffect(() => {
3030
- if (typeof window !== 'undefined') {
3031
- initialBodyHeight.current = document.body.style.height;
3032
- }
3033
- }, []);
3034
- useEffect(() => {
3035
- if (typeof window !== 'undefined') {
3036
- if (table.getState().isFullScreen) {
3037
- document.body.style.height = '100vh';
3038
- }
3039
- else {
3040
- document.body.style.height = initialBodyHeight.current;
3041
- }
3042
- }
3043
- }, [table.getState().isFullScreen]);
3044
- //if page index is out of bounds, set it to the last page
3045
- useEffect(() => {
3046
- var _a;
3047
- const { pageIndex, pageSize } = table.getState().pagination;
3048
- const totalRowCount = (_a = props.rowCount) !== null && _a !== void 0 ? _a : table.getPrePaginationRowModel().rows.length;
3049
- const firstVisibleRowIndex = pageIndex * pageSize;
3050
- if (firstVisibleRowIndex > totalRowCount) {
3051
- table.setPageIndex(Math.floor(totalRowCount / pageSize));
3052
- }
3053
- }, [props.rowCount, table.getPrePaginationRowModel().rows.length]);
3054
- return (jsxs(Fragment, { children: [jsx(Dialog, { PaperComponent: Box, TransitionComponent: !props.enableRowVirtualization ? Grow : undefined, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => table.setIsFullScreen(false), open: table.getState().isFullScreen, transitionDuration: 400, children: jsx(MRT_TablePaper, { table: table }) }), !table.getState().isFullScreen && (jsx(MRT_TablePaper, { table: table })), editingRow && props.editingMode === 'modal' && (jsx(MRT_EditRowModal, { row: editingRow, table: table, open: true }))] }));
3055
- };
3056
-
3057
- const MaterialReactTable = (_a) => {
3058
- var _b;
3059
- var { aggregationFns, autoResetExpanded = false, columnResizeMode = 'onChange', defaultColumn, defaultDisplayColumn, editingMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnResizing = false, enableDensityToggle = true, enableExpandAll = true, enableExpanding, enableFilterMatchHighlighting = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enablePinning = false, enableRowSelection = false, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, layoutMode = 'semantic', localization, manualFiltering, manualGrouping, manualPagination, manualSorting, positionActionsColumn = 'first', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberMode = 'original', selectAllMode = 'page', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnResizeMode", "defaultColumn", "defaultDisplayColumn", "editingMode", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnResizing", "enableDensityToggle", "enableExpandAll", "enableExpanding", "enableFilterMatchHighlighting", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enablePinning", "enableRowSelection", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "positionActionsColumn", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberMode", "selectAllMode", "sortingFns"]);
3060
- const _icons = useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
3061
- const _localization = useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
3062
- const _aggregationFns = useMemo(() => (Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns)), []);
3063
- const _filterFns = useMemo(() => (Object.assign(Object.assign({}, MRT_FilterFns), filterFns)), []);
3064
- const _sortingFns = useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
3065
- const _defaultColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), [defaultColumn]);
3066
- const _defaultDisplayColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), [defaultDisplayColumn]);
3067
- if (rest.enableRowVirtualization || rest.enableColumnVirtualization) {
3068
- layoutMode = 'grid';
3069
- }
3070
- if (rest.enableRowVirtualization) {
3071
- enableStickyHeader = true;
3315
+ const isTableInstanceProp = (props) => props.table !== undefined;
3316
+ const MaterialReactTable = (props) => {
3317
+ let table;
3318
+ if (isTableInstanceProp(props)) {
3319
+ table = props.table;
3072
3320
  }
3073
- if (enablePagination === false && manualPagination === undefined) {
3074
- manualPagination = true;
3075
- }
3076
- if (!((_b = rest.data) === null || _b === void 0 ? void 0 : _b.length)) {
3077
- manualFiltering = true;
3078
- manualGrouping = true;
3079
- manualPagination = true;
3080
- manualSorting = true;
3321
+ else {
3322
+ table = useMaterialReactTable(props);
3081
3323
  }
3082
- return (jsx(MRT_TableRoot, Object.assign({ aggregationFns: _aggregationFns, autoResetExpanded: autoResetExpanded, columnResizeMode: columnResizeMode, defaultColumn: _defaultColumn, defaultDisplayColumn: _defaultDisplayColumn, editingMode: editingMode, enableBottomToolbar: enableBottomToolbar, enableColumnActions: enableColumnActions, enableColumnFilters: enableColumnFilters, enableColumnOrdering: enableColumnOrdering, enableColumnResizing: enableColumnResizing, enableDensityToggle: enableDensityToggle, enableExpandAll: enableExpandAll, enableExpanding: enableExpanding, enableFilterMatchHighlighting: enableFilterMatchHighlighting, enableFilters: enableFilters, enableFullScreenToggle: enableFullScreenToggle, enableGlobalFilter: enableGlobalFilter, enableGlobalFilterRankedResults: enableGlobalFilterRankedResults, enableGrouping: enableGrouping, enableHiding: enableHiding, enableMultiRowSelection: enableMultiRowSelection, enableMultiSort: enableMultiSort, enablePagination: enablePagination, enablePinning: enablePinning, enableRowSelection: enableRowSelection, enableSelectAll: enableSelectAll, enableSorting: enableSorting, enableStickyHeader: enableStickyHeader, enableTableFooter: enableTableFooter, enableTableHead: enableTableHead, enableToolbarInternalActions: enableToolbarInternalActions, enableTopToolbar: enableTopToolbar, filterFns: _filterFns, icons: _icons, layoutMode: layoutMode, localization: _localization, manualFiltering: manualFiltering, manualGrouping: manualGrouping, manualPagination: manualPagination, manualSorting: manualSorting, positionActionsColumn: positionActionsColumn, positionExpandColumn: positionExpandColumn, positionGlobalFilter: positionGlobalFilter, positionPagination: positionPagination, positionToolbarAlertBanner: positionToolbarAlertBanner, positionToolbarDropZone: positionToolbarDropZone, rowNumberMode: rowNumberMode, selectAllMode: selectAllMode, sortingFns: _sortingFns }, rest)));
3324
+ return jsx(MRT_TablePaper, { table: table });
3083
3325
  };
3084
3326
 
3085
- export { MRT_AggregationFns, MRT_BottomToolbar, MRT_CopyButton, MRT_EditActionButtons, MRT_ExpandButton, MRT_FilterFns, MRT_FilterOptionMenu, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_GrabHandleButton, MRT_ShowHideColumnsButton, MRT_SortingFns, MRT_TableHeadCellFilterContainer, MRT_TablePagination, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MRT_ToggleRowActionMenuButton, MRT_ToolbarAlertBanner, MRT_ToolbarDropZone, MRT_ToolbarInternalButtons, MRT_TopToolbar, MaterialReactTable, MaterialReactTable as default };
3327
+ export { MRT_AggregationFns, MRT_BottomToolbar, MRT_ColumnActionMenu, MRT_ColumnPinningButtons, MRT_CopyButton, MRT_DefaultColumn, MRT_DefaultDisplayColumn, MRT_EditActionButtons, MRT_EditCellTextField, MRT_EditRowModal, MRT_ExpandAllButton, MRT_ExpandButton, MRT_FilterCheckbox, MRT_FilterFns, MRT_FilterOptionMenu, MRT_FilterRangeFields, MRT_FilterRangeSlider, MRT_FilterTextField, MRT_GlobalFilterTextField, MRT_GrabHandleButton, MRT_LinearProgressBar, MRT_RowActionMenu, MRT_SelectCheckbox, MRT_ShowHideColumnsButton, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, MRT_SortingFns, MRT_Table, MRT_TableBody, MRT_TableBodyCell, MRT_TableBodyCellValue, MRT_TableBodyRow, MRT_TableBodyRowGrabHandle, MRT_TableContainer, MRT_TableDetailPanel, MRT_TableFooter, MRT_TableFooterCell, MRT_TableFooterRow, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, MRT_TableHeadCellFilterContainer, MRT_TableHeadCellFilterLabel, MRT_TableHeadCellGrabHandle, MRT_TableHeadCellResizeHandle, MRT_TableHeadCellSortLabel, MRT_TableHeadRow, MRT_TablePagination, MRT_TablePaper, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleFullScreenButton, MRT_ToggleGlobalFilterButton, MRT_ToggleRowActionMenuButton, MRT_ToolbarAlertBanner, MRT_ToolbarDropZone, MRT_ToolbarInternalButtons, MRT_TopToolbar, MaterialReactTable, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, commonListItemStyles, commonMenuItemStyles, commonToolbarStyles, createRow, flexRender, getAllLeafColumnDefs, getCanRankRows, getColumnId, getCommonCellStyles, getDefaultColumnFilterFn, getDefaultColumnOrderIds, getIsFirstColumn, getIsFirstRightPinnedColumn, getIsLastColumn, getIsLastLeftPinnedColumn, getLeadingDisplayColumnIds, getTotalRight, getTrailingDisplayColumnIds, mrtFilterOptions, parseCSSVarId, prepareColumns, rankGlobalFuzzy, reorderColumn, showExpandColumn, useMaterialReactTable };
3086
3328
  //# sourceMappingURL=material-react-table.esm.js.map