material-react-table 1.15.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 (466) hide show
  1. package/dist/cjs/index.js +1626 -1324
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/MaterialReactTable.d.ts +7 -11
  4. package/dist/cjs/types/body/MRT_TableBody.d.ts +4 -5
  5. package/dist/cjs/types/body/MRT_TableBodyCell.d.ts +5 -5
  6. package/dist/cjs/types/body/MRT_TableBodyCellValue.d.ts +4 -4
  7. package/dist/cjs/types/body/MRT_TableBodyRow.d.ts +5 -6
  8. package/dist/cjs/types/body/MRT_TableBodyRowGrabHandle.d.ts +5 -5
  9. package/dist/cjs/types/body/MRT_TableDetailPanel.d.ts +6 -6
  10. package/dist/cjs/types/body/index.d.ts +6 -0
  11. package/dist/cjs/types/buttons/MRT_ColumnPinningButtons.d.ts +2 -2
  12. package/dist/cjs/types/buttons/MRT_CopyButton.d.ts +2 -2
  13. package/dist/cjs/types/buttons/MRT_EditActionButtons.d.ts +2 -2
  14. package/dist/cjs/types/buttons/MRT_ExpandAllButton.d.ts +3 -3
  15. package/dist/cjs/types/buttons/MRT_ExpandButton.d.ts +2 -2
  16. package/dist/cjs/types/buttons/MRT_GrabHandleButton.d.ts +2 -2
  17. package/dist/cjs/types/buttons/MRT_ShowHideColumnsButton.d.ts +2 -2
  18. package/dist/cjs/types/buttons/MRT_ToggleDensePaddingButton.d.ts +2 -2
  19. package/dist/cjs/types/buttons/MRT_ToggleFiltersButton.d.ts +2 -2
  20. package/dist/cjs/types/buttons/MRT_ToggleFullScreenButton.d.ts +7 -0
  21. package/dist/cjs/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +2 -2
  22. package/dist/cjs/types/buttons/MRT_ToggleRowActionMenuButton.d.ts +2 -2
  23. package/dist/cjs/types/buttons/index.d.ts +12 -0
  24. package/dist/cjs/types/column.utils.d.ts +39 -51
  25. package/dist/cjs/types/filterFns.d.ts +14 -14
  26. package/dist/cjs/types/footer/MRT_TableFooter.d.ts +3 -3
  27. package/dist/cjs/types/footer/MRT_TableFooterCell.d.ts +4 -4
  28. package/dist/cjs/types/footer/MRT_TableFooterRow.d.ts +4 -4
  29. package/dist/cjs/types/footer/index.d.ts +3 -0
  30. package/dist/cjs/types/head/MRT_TableHead.d.ts +3 -3
  31. package/dist/cjs/types/head/MRT_TableHeadCell.d.ts +4 -4
  32. package/dist/cjs/types/head/MRT_TableHeadCellColumnActionsButton.d.ts +4 -4
  33. package/dist/cjs/types/head/MRT_TableHeadCellFilterContainer.d.ts +4 -4
  34. package/dist/cjs/types/head/MRT_TableHeadCellFilterLabel.d.ts +4 -4
  35. package/dist/cjs/types/head/MRT_TableHeadCellGrabHandle.d.ts +4 -4
  36. package/dist/cjs/types/head/MRT_TableHeadCellResizeHandle.d.ts +4 -4
  37. package/dist/cjs/types/head/MRT_TableHeadCellSortLabel.d.ts +4 -4
  38. package/dist/cjs/types/head/MRT_TableHeadRow.d.ts +4 -4
  39. package/dist/cjs/types/head/index.d.ts +9 -0
  40. package/dist/cjs/types/hooks/useMRT_DisplayColumns.d.ts +9 -0
  41. package/dist/cjs/types/hooks/useMRT_Effects.d.ts +2 -0
  42. package/dist/cjs/types/hooks/useMRT_TableInstance.d.ts +2 -0
  43. package/dist/cjs/types/hooks/useMRT_TableOptions.d.ts +2 -0
  44. package/dist/cjs/types/index.d.ts +14 -25
  45. package/dist/cjs/types/inputs/MRT_EditCellTextField.d.ts +2 -3
  46. package/dist/cjs/types/inputs/MRT_FilterCheckbox.d.ts +4 -4
  47. package/dist/cjs/types/inputs/MRT_FilterRangeFields.d.ts +4 -4
  48. package/dist/cjs/types/inputs/MRT_FilterRangeSlider.d.ts +4 -4
  49. package/dist/cjs/types/inputs/MRT_FilterTextField.d.ts +4 -4
  50. package/dist/cjs/types/inputs/MRT_GlobalFilterTextField.d.ts +2 -2
  51. package/dist/cjs/types/inputs/MRT_SelectCheckbox.d.ts +4 -4
  52. package/dist/cjs/types/inputs/index.d.ts +7 -0
  53. package/dist/cjs/types/locales/ar.d.ts +2 -0
  54. package/dist/cjs/types/locales/bg.d.ts +2 -0
  55. package/dist/cjs/types/locales/et.d.ts +2 -0
  56. package/dist/cjs/types/locales/ko.d.ts +2 -0
  57. package/dist/cjs/types/menus/MRT_ColumnActionMenu.d.ts +4 -4
  58. package/dist/cjs/types/menus/MRT_FilterOptionMenu.d.ts +2 -2
  59. package/dist/cjs/types/menus/MRT_RowActionMenu.d.ts +4 -4
  60. package/dist/cjs/types/menus/MRT_ShowHideColumnsMenu.d.ts +2 -2
  61. package/dist/cjs/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +2 -2
  62. package/dist/cjs/types/menus/index.d.ts +5 -0
  63. package/dist/cjs/types/modals/MRT_EditRowModal.d.ts +7 -0
  64. package/dist/cjs/types/modals/index.d.ts +1 -0
  65. package/dist/cjs/types/sortingFns.d.ts +3 -2
  66. package/dist/cjs/types/table/MRT_Table.d.ts +3 -3
  67. package/dist/cjs/types/table/MRT_TableContainer.d.ts +3 -3
  68. package/dist/cjs/types/table/MRT_TablePaper.d.ts +3 -3
  69. package/dist/cjs/types/table/index.d.ts +4 -0
  70. package/dist/cjs/types/toolbar/MRT_BottomToolbar.d.ts +2 -2
  71. package/dist/cjs/types/toolbar/MRT_LinearProgressBar.d.ts +2 -2
  72. package/dist/cjs/types/toolbar/MRT_TablePagination.d.ts +2 -2
  73. package/dist/cjs/types/toolbar/MRT_ToolbarAlertBanner.d.ts +2 -2
  74. package/dist/cjs/types/toolbar/MRT_ToolbarDropZone.d.ts +2 -2
  75. package/dist/cjs/types/toolbar/MRT_ToolbarInternalButtons.d.ts +2 -2
  76. package/dist/cjs/types/toolbar/MRT_TopToolbar.d.ts +2 -2
  77. package/dist/cjs/types/toolbar/index.d.ts +7 -0
  78. package/dist/cjs/types/types.d.ts +115 -84
  79. package/dist/cjs/types/useMaterialReactTable.d.ts +2 -0
  80. package/dist/esm/material-react-table.esm.js +1556 -1318
  81. package/dist/esm/material-react-table.esm.js.map +1 -1
  82. package/dist/esm/types/MaterialReactTable.d.ts +7 -11
  83. package/dist/esm/types/body/MRT_TableBody.d.ts +4 -5
  84. package/dist/esm/types/body/MRT_TableBodyCell.d.ts +5 -5
  85. package/dist/esm/types/body/MRT_TableBodyCellValue.d.ts +4 -4
  86. package/dist/esm/types/body/MRT_TableBodyRow.d.ts +5 -6
  87. package/dist/esm/types/body/MRT_TableBodyRowGrabHandle.d.ts +5 -5
  88. package/dist/esm/types/body/MRT_TableDetailPanel.d.ts +6 -6
  89. package/dist/esm/types/body/index.d.ts +6 -0
  90. package/dist/esm/types/buttons/MRT_ColumnPinningButtons.d.ts +2 -2
  91. package/dist/esm/types/buttons/MRT_CopyButton.d.ts +2 -2
  92. package/dist/esm/types/buttons/MRT_EditActionButtons.d.ts +2 -2
  93. package/dist/esm/types/buttons/MRT_ExpandAllButton.d.ts +3 -3
  94. package/dist/esm/types/buttons/MRT_ExpandButton.d.ts +2 -2
  95. package/dist/esm/types/buttons/MRT_GrabHandleButton.d.ts +2 -2
  96. package/dist/esm/types/buttons/MRT_ShowHideColumnsButton.d.ts +2 -2
  97. package/dist/esm/types/buttons/MRT_ToggleDensePaddingButton.d.ts +2 -2
  98. package/dist/esm/types/buttons/MRT_ToggleFiltersButton.d.ts +2 -2
  99. package/dist/esm/types/buttons/MRT_ToggleFullScreenButton.d.ts +7 -0
  100. package/dist/esm/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +2 -2
  101. package/dist/esm/types/buttons/MRT_ToggleRowActionMenuButton.d.ts +2 -2
  102. package/dist/esm/types/buttons/index.d.ts +12 -0
  103. package/dist/esm/types/column.utils.d.ts +39 -51
  104. package/dist/esm/types/filterFns.d.ts +14 -14
  105. package/dist/esm/types/footer/MRT_TableFooter.d.ts +3 -3
  106. package/dist/esm/types/footer/MRT_TableFooterCell.d.ts +4 -4
  107. package/dist/esm/types/footer/MRT_TableFooterRow.d.ts +4 -4
  108. package/dist/esm/types/footer/index.d.ts +3 -0
  109. package/dist/esm/types/head/MRT_TableHead.d.ts +3 -3
  110. package/dist/esm/types/head/MRT_TableHeadCell.d.ts +4 -4
  111. package/dist/esm/types/head/MRT_TableHeadCellColumnActionsButton.d.ts +4 -4
  112. package/dist/esm/types/head/MRT_TableHeadCellFilterContainer.d.ts +4 -4
  113. package/dist/esm/types/head/MRT_TableHeadCellFilterLabel.d.ts +4 -4
  114. package/dist/esm/types/head/MRT_TableHeadCellGrabHandle.d.ts +4 -4
  115. package/dist/esm/types/head/MRT_TableHeadCellResizeHandle.d.ts +4 -4
  116. package/dist/esm/types/head/MRT_TableHeadCellSortLabel.d.ts +4 -4
  117. package/dist/esm/types/head/MRT_TableHeadRow.d.ts +4 -4
  118. package/dist/esm/types/head/index.d.ts +9 -0
  119. package/dist/esm/types/hooks/useMRT_DisplayColumns.d.ts +9 -0
  120. package/dist/esm/types/hooks/useMRT_Effects.d.ts +2 -0
  121. package/dist/esm/types/hooks/useMRT_TableInstance.d.ts +2 -0
  122. package/dist/esm/types/hooks/useMRT_TableOptions.d.ts +2 -0
  123. package/dist/esm/types/index.d.ts +14 -25
  124. package/dist/esm/types/inputs/MRT_EditCellTextField.d.ts +2 -3
  125. package/dist/esm/types/inputs/MRT_FilterCheckbox.d.ts +4 -4
  126. package/dist/esm/types/inputs/MRT_FilterRangeFields.d.ts +4 -4
  127. package/dist/esm/types/inputs/MRT_FilterRangeSlider.d.ts +4 -4
  128. package/dist/esm/types/inputs/MRT_FilterTextField.d.ts +4 -4
  129. package/dist/esm/types/inputs/MRT_GlobalFilterTextField.d.ts +2 -2
  130. package/dist/esm/types/inputs/MRT_SelectCheckbox.d.ts +4 -4
  131. package/dist/esm/types/inputs/index.d.ts +7 -0
  132. package/dist/esm/types/locales/ar.d.ts +2 -0
  133. package/dist/esm/types/locales/bg.d.ts +2 -0
  134. package/dist/esm/types/locales/et.d.ts +2 -0
  135. package/dist/esm/types/locales/ko.d.ts +2 -0
  136. package/dist/esm/types/menus/MRT_ColumnActionMenu.d.ts +4 -4
  137. package/dist/esm/types/menus/MRT_FilterOptionMenu.d.ts +2 -2
  138. package/dist/esm/types/menus/MRT_RowActionMenu.d.ts +4 -4
  139. package/dist/esm/types/menus/MRT_ShowHideColumnsMenu.d.ts +2 -2
  140. package/dist/esm/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +2 -2
  141. package/dist/esm/types/menus/index.d.ts +5 -0
  142. package/dist/esm/types/modals/MRT_EditRowModal.d.ts +7 -0
  143. package/dist/esm/types/modals/index.d.ts +1 -0
  144. package/dist/esm/types/sortingFns.d.ts +3 -2
  145. package/dist/esm/types/table/MRT_Table.d.ts +3 -3
  146. package/dist/esm/types/table/MRT_TableContainer.d.ts +3 -3
  147. package/dist/esm/types/table/MRT_TablePaper.d.ts +3 -3
  148. package/dist/esm/types/table/index.d.ts +4 -0
  149. package/dist/esm/types/toolbar/MRT_BottomToolbar.d.ts +2 -2
  150. package/dist/esm/types/toolbar/MRT_LinearProgressBar.d.ts +2 -2
  151. package/dist/esm/types/toolbar/MRT_TablePagination.d.ts +2 -2
  152. package/dist/esm/types/toolbar/MRT_ToolbarAlertBanner.d.ts +2 -2
  153. package/dist/esm/types/toolbar/MRT_ToolbarDropZone.d.ts +2 -2
  154. package/dist/esm/types/toolbar/MRT_ToolbarInternalButtons.d.ts +2 -2
  155. package/dist/esm/types/toolbar/MRT_TopToolbar.d.ts +2 -2
  156. package/dist/esm/types/toolbar/index.d.ts +7 -0
  157. package/dist/esm/types/types.d.ts +115 -84
  158. package/dist/esm/types/useMaterialReactTable.d.ts +2 -0
  159. package/dist/index.d.ts +598 -148
  160. package/locales/ar.d.ts +2 -0
  161. package/locales/ar.esm.d.ts +2 -0
  162. package/locales/ar.esm.js +93 -0
  163. package/locales/ar.esm.js.map +1 -0
  164. package/locales/ar.js +97 -0
  165. package/locales/ar.js.map +1 -0
  166. package/locales/bg.d.ts +2 -0
  167. package/locales/bg.esm.d.ts +2 -0
  168. package/locales/bg.esm.js +93 -0
  169. package/locales/bg.esm.js.map +1 -0
  170. package/locales/bg.js +97 -0
  171. package/locales/bg.js.map +1 -0
  172. package/locales/cs.esm.js +1 -2
  173. package/locales/cs.esm.js.map +1 -1
  174. package/locales/cs.js +1 -2
  175. package/locales/cs.js.map +1 -1
  176. package/locales/da.esm.js +0 -1
  177. package/locales/da.esm.js.map +1 -1
  178. package/locales/da.js +0 -1
  179. package/locales/da.js.map +1 -1
  180. package/locales/de.esm.js +0 -1
  181. package/locales/de.esm.js.map +1 -1
  182. package/locales/de.js +0 -1
  183. package/locales/de.js.map +1 -1
  184. package/locales/en.esm.js +0 -1
  185. package/locales/en.esm.js.map +1 -1
  186. package/locales/en.js +0 -1
  187. package/locales/en.js.map +1 -1
  188. package/locales/es.esm.js +0 -1
  189. package/locales/es.esm.js.map +1 -1
  190. package/locales/es.js +0 -1
  191. package/locales/es.js.map +1 -1
  192. package/locales/et.d.ts +2 -0
  193. package/locales/et.esm.d.ts +2 -0
  194. package/locales/et.esm.js +93 -0
  195. package/locales/et.esm.js.map +1 -0
  196. package/locales/et.js +97 -0
  197. package/locales/et.js.map +1 -0
  198. package/locales/fa.esm.js +0 -1
  199. package/locales/fa.esm.js.map +1 -1
  200. package/locales/fa.js +0 -1
  201. package/locales/fa.js.map +1 -1
  202. package/locales/fi.esm.js +0 -1
  203. package/locales/fi.esm.js.map +1 -1
  204. package/locales/fi.js +0 -1
  205. package/locales/fi.js.map +1 -1
  206. package/locales/fr.esm.js +0 -1
  207. package/locales/fr.esm.js.map +1 -1
  208. package/locales/fr.js +0 -1
  209. package/locales/fr.js.map +1 -1
  210. package/locales/hu.esm.js +0 -1
  211. package/locales/hu.esm.js.map +1 -1
  212. package/locales/hu.js +0 -1
  213. package/locales/hu.js.map +1 -1
  214. package/locales/id.esm.js +0 -1
  215. package/locales/id.esm.js.map +1 -1
  216. package/locales/id.js +0 -1
  217. package/locales/id.js.map +1 -1
  218. package/locales/it.esm.js +0 -1
  219. package/locales/it.esm.js.map +1 -1
  220. package/locales/it.js +0 -1
  221. package/locales/it.js.map +1 -1
  222. package/locales/ja.esm.js +0 -1
  223. package/locales/ja.esm.js.map +1 -1
  224. package/locales/ja.js +0 -1
  225. package/locales/ja.js.map +1 -1
  226. package/locales/ko.d.ts +2 -0
  227. package/locales/ko.esm.d.ts +2 -0
  228. package/locales/ko.esm.js +93 -0
  229. package/locales/ko.esm.js.map +1 -0
  230. package/locales/ko.js +97 -0
  231. package/locales/ko.js.map +1 -0
  232. package/locales/nl.esm.js +0 -1
  233. package/locales/nl.esm.js.map +1 -1
  234. package/locales/nl.js +0 -1
  235. package/locales/nl.js.map +1 -1
  236. package/locales/no.esm.js +0 -1
  237. package/locales/no.esm.js.map +1 -1
  238. package/locales/no.js +0 -1
  239. package/locales/no.js.map +1 -1
  240. package/locales/pl.esm.js +0 -1
  241. package/locales/pl.esm.js.map +1 -1
  242. package/locales/pl.js +0 -1
  243. package/locales/pl.js.map +1 -1
  244. package/locales/pt-BR.esm.js +0 -1
  245. package/locales/pt-BR.esm.js.map +1 -1
  246. package/locales/pt-BR.js +0 -1
  247. package/locales/pt-BR.js.map +1 -1
  248. package/locales/pt.esm.js +0 -1
  249. package/locales/pt.esm.js.map +1 -1
  250. package/locales/pt.js +0 -1
  251. package/locales/pt.js.map +1 -1
  252. package/locales/ro.esm.js +0 -1
  253. package/locales/ro.esm.js.map +1 -1
  254. package/locales/ro.js +0 -1
  255. package/locales/ro.js.map +1 -1
  256. package/locales/ru.esm.js +0 -1
  257. package/locales/ru.esm.js.map +1 -1
  258. package/locales/ru.js +0 -1
  259. package/locales/ru.js.map +1 -1
  260. package/locales/sk.esm.js +0 -1
  261. package/locales/sk.esm.js.map +1 -1
  262. package/locales/sk.js +0 -1
  263. package/locales/sk.js.map +1 -1
  264. package/locales/sr-Cyrl-RS.esm.js +0 -1
  265. package/locales/sr-Cyrl-RS.esm.js.map +1 -1
  266. package/locales/sr-Cyrl-RS.js +0 -1
  267. package/locales/sr-Cyrl-RS.js.map +1 -1
  268. package/locales/sr-Latn-RS.esm.js +0 -1
  269. package/locales/sr-Latn-RS.esm.js.map +1 -1
  270. package/locales/sr-Latn-RS.js +0 -1
  271. package/locales/sr-Latn-RS.js.map +1 -1
  272. package/locales/sv.esm.js +0 -1
  273. package/locales/sv.esm.js.map +1 -1
  274. package/locales/sv.js +0 -1
  275. package/locales/sv.js.map +1 -1
  276. package/locales/tr.esm.js +0 -1
  277. package/locales/tr.esm.js.map +1 -1
  278. package/locales/tr.js +0 -1
  279. package/locales/tr.js.map +1 -1
  280. package/locales/uk.esm.js +0 -1
  281. package/locales/uk.esm.js.map +1 -1
  282. package/locales/uk.js +0 -1
  283. package/locales/uk.js.map +1 -1
  284. package/locales/vi.esm.js +0 -1
  285. package/locales/vi.esm.js.map +1 -1
  286. package/locales/vi.js +0 -1
  287. package/locales/vi.js.map +1 -1
  288. package/locales/zh-Hans.esm.js +7 -8
  289. package/locales/zh-Hans.esm.js.map +1 -1
  290. package/locales/zh-Hans.js +7 -8
  291. package/locales/zh-Hans.js.map +1 -1
  292. package/locales/zh-Hant.esm.js +1 -2
  293. package/locales/zh-Hant.esm.js.map +1 -1
  294. package/locales/zh-Hant.js +1 -2
  295. package/locales/zh-Hant.js.map +1 -1
  296. package/package.json +10 -8
  297. package/src/MaterialReactTable.tsx +31 -168
  298. package/src/body/MRT_TableBody.tsx +10 -23
  299. package/src/body/MRT_TableBodyCell.tsx +35 -38
  300. package/src/body/MRT_TableBodyCellValue.tsx +7 -4
  301. package/src/body/MRT_TableBodyRow.tsx +7 -7
  302. package/src/body/MRT_TableBodyRowGrabHandle.tsx +13 -10
  303. package/src/body/MRT_TableDetailPanel.tsx +11 -11
  304. package/src/body/index.ts +6 -0
  305. package/src/buttons/MRT_ColumnPinningButtons.tsx +2 -4
  306. package/src/buttons/MRT_CopyButton.tsx +9 -9
  307. package/src/buttons/MRT_EditActionButtons.tsx +56 -25
  308. package/src/buttons/MRT_ExpandAllButton.tsx +5 -3
  309. package/src/buttons/MRT_ExpandButton.tsx +2 -2
  310. package/src/buttons/MRT_GrabHandleButton.tsx +2 -2
  311. package/src/buttons/MRT_ShowHideColumnsButton.tsx +2 -5
  312. package/src/buttons/MRT_ToggleDensePaddingButton.tsx +2 -3
  313. package/src/buttons/MRT_ToggleFiltersButton.tsx +2 -5
  314. package/src/buttons/{MRT_FullScreenToggleButton.tsx → MRT_ToggleFullScreenButton.tsx} +13 -6
  315. package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +3 -5
  316. package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +16 -8
  317. package/src/buttons/index.ts +12 -0
  318. package/src/column.utils.ts +96 -45
  319. package/src/filterFns.ts +14 -14
  320. package/src/footer/MRT_TableFooter.tsx +4 -4
  321. package/src/footer/MRT_TableFooterCell.tsx +7 -4
  322. package/src/footer/MRT_TableFooterRow.tsx +6 -6
  323. package/src/footer/index.ts +3 -0
  324. package/src/head/MRT_TableHead.tsx +4 -4
  325. package/src/head/MRT_TableHeadCell.tsx +7 -4
  326. package/src/head/MRT_TableHeadCellColumnActionsButton.tsx +14 -12
  327. package/src/head/MRT_TableHeadCellFilterContainer.tsx +9 -4
  328. package/src/head/MRT_TableHeadCellFilterLabel.tsx +9 -4
  329. package/src/head/MRT_TableHeadCellGrabHandle.tsx +13 -13
  330. package/src/head/MRT_TableHeadCellResizeHandle.tsx +9 -4
  331. package/src/head/MRT_TableHeadCellSortLabel.tsx +8 -6
  332. package/src/head/MRT_TableHeadRow.tsx +6 -6
  333. package/src/head/index.ts +9 -0
  334. package/src/hooks/useMRT_DisplayColumns.tsx +142 -0
  335. package/src/hooks/useMRT_Effects.ts +77 -0
  336. package/src/hooks/useMRT_TableInstance.ts +291 -0
  337. package/src/hooks/useMRT_TableOptions.ts +169 -0
  338. package/src/index.ts +16 -0
  339. package/src/inputs/MRT_EditCellTextField.tsx +39 -25
  340. package/src/inputs/MRT_FilterCheckbox.tsx +14 -11
  341. package/src/inputs/MRT_FilterRangeFields.tsx +7 -4
  342. package/src/inputs/MRT_FilterRangeSlider.tsx +18 -19
  343. package/src/inputs/MRT_FilterTextField.tsx +15 -15
  344. package/src/inputs/MRT_GlobalFilterTextField.tsx +2 -4
  345. package/src/inputs/MRT_SelectCheckbox.tsx +8 -4
  346. package/src/inputs/index.ts +7 -0
  347. package/src/locales/ar.ts +94 -0
  348. package/src/locales/bg.ts +93 -0
  349. package/src/{_locales → locales}/cs.ts +1 -2
  350. package/src/{_locales → locales}/da.ts +0 -1
  351. package/src/{_locales → locales}/de.ts +0 -1
  352. package/src/{_locales → locales}/en.ts +1 -1
  353. package/src/{_locales → locales}/es.ts +0 -1
  354. package/src/locales/et.ts +94 -0
  355. package/src/{_locales → locales}/fa.ts +0 -1
  356. package/src/{_locales → locales}/fi.ts +0 -1
  357. package/src/{_locales → locales}/fr.ts +0 -1
  358. package/src/{_locales → locales}/hu.ts +0 -1
  359. package/src/{_locales → locales}/id.ts +0 -1
  360. package/src/{_locales → locales}/it.ts +0 -1
  361. package/src/{_locales → locales}/ja.ts +0 -1
  362. package/src/locales/ko.ts +93 -0
  363. package/src/{_locales → locales}/nl.ts +0 -1
  364. package/src/{_locales → locales}/no.ts +1 -1
  365. package/src/{_locales → locales}/pl.ts +0 -1
  366. package/src/{_locales → locales}/pt-BR.ts +0 -1
  367. package/src/{_locales → locales}/pt.ts +0 -1
  368. package/src/{_locales → locales}/ro.ts +0 -1
  369. package/src/{_locales → locales}/ru.ts +0 -1
  370. package/src/{_locales → locales}/sk.ts +0 -1
  371. package/src/{_locales → locales}/sr-Cyrl-RS.ts +0 -1
  372. package/src/{_locales → locales}/sr-Latn-RS.ts +0 -1
  373. package/src/{_locales → locales}/sv.ts +0 -1
  374. package/src/{_locales → locales}/tr.ts +0 -1
  375. package/src/{_locales → locales}/uk.ts +0 -1
  376. package/src/{_locales → locales}/vi.ts +0 -1
  377. package/src/{_locales → locales}/zh-Hans.ts +7 -8
  378. package/src/{_locales → locales}/zh-Hant.ts +1 -2
  379. package/src/menus/MRT_ColumnActionMenu.tsx +8 -8
  380. package/src/menus/MRT_FilterOptionMenu.tsx +4 -3
  381. package/src/menus/MRT_RowActionMenu.tsx +5 -5
  382. package/src/menus/MRT_ShowHideColumnsMenu.tsx +4 -6
  383. package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +4 -4
  384. package/src/menus/index.ts +5 -0
  385. package/src/modals/MRT_EditRowModal.tsx +115 -0
  386. package/src/modals/index.ts +1 -0
  387. package/src/sortingFns.ts +6 -2
  388. package/src/table/MRT_Table.tsx +40 -33
  389. package/src/table/MRT_TableContainer.tsx +23 -5
  390. package/src/table/MRT_TablePaper.tsx +13 -4
  391. package/src/table/index.ts +4 -0
  392. package/src/toolbar/MRT_BottomToolbar.tsx +2 -2
  393. package/src/toolbar/MRT_LinearProgressBar.tsx +2 -2
  394. package/src/toolbar/MRT_TablePagination.tsx +2 -2
  395. package/src/toolbar/MRT_ToolbarAlertBanner.tsx +2 -2
  396. package/src/toolbar/MRT_ToolbarDropZone.tsx +2 -2
  397. package/src/toolbar/MRT_ToolbarInternalButtons.tsx +6 -8
  398. package/src/toolbar/MRT_TopToolbar.tsx +2 -2
  399. package/src/toolbar/index.ts +7 -0
  400. package/src/types.ts +781 -765
  401. package/src/useMaterialReactTable.ts +11 -0
  402. package/dist/cjs/types/body/MRT_EditRowModal.d.ts +0 -8
  403. package/dist/cjs/types/buttons/MRT_FullScreenToggleButton.d.ts +0 -7
  404. package/dist/cjs/types/table/MRT_TableRoot.d.ts +0 -1
  405. package/dist/esm/types/body/MRT_EditRowModal.d.ts +0 -8
  406. package/dist/esm/types/buttons/MRT_FullScreenToggleButton.d.ts +0 -7
  407. package/dist/esm/types/table/MRT_TableRoot.d.ts +0 -1
  408. package/src/body/MRT_EditRowModal.tsx +0 -57
  409. package/src/index.tsx +0 -50
  410. package/src/table/MRT_TableRoot.tsx +0 -421
  411. /package/dist/cjs/types/{_locales → locales}/cs.d.ts +0 -0
  412. /package/dist/cjs/types/{_locales → locales}/da.d.ts +0 -0
  413. /package/dist/cjs/types/{_locales → locales}/de.d.ts +0 -0
  414. /package/dist/cjs/types/{_locales → locales}/en.d.ts +0 -0
  415. /package/dist/cjs/types/{_locales → locales}/es.d.ts +0 -0
  416. /package/dist/cjs/types/{_locales → locales}/fa.d.ts +0 -0
  417. /package/dist/cjs/types/{_locales → locales}/fi.d.ts +0 -0
  418. /package/dist/cjs/types/{_locales → locales}/fr.d.ts +0 -0
  419. /package/dist/cjs/types/{_locales → locales}/hu.d.ts +0 -0
  420. /package/dist/cjs/types/{_locales → locales}/id.d.ts +0 -0
  421. /package/dist/cjs/types/{_locales → locales}/it.d.ts +0 -0
  422. /package/dist/cjs/types/{_locales → locales}/ja.d.ts +0 -0
  423. /package/dist/cjs/types/{_locales → locales}/nl.d.ts +0 -0
  424. /package/dist/cjs/types/{_locales → locales}/no.d.ts +0 -0
  425. /package/dist/cjs/types/{_locales → locales}/pl.d.ts +0 -0
  426. /package/dist/cjs/types/{_locales → locales}/pt-BR.d.ts +0 -0
  427. /package/dist/cjs/types/{_locales → locales}/pt.d.ts +0 -0
  428. /package/dist/cjs/types/{_locales → locales}/ro.d.ts +0 -0
  429. /package/dist/cjs/types/{_locales → locales}/ru.d.ts +0 -0
  430. /package/dist/cjs/types/{_locales → locales}/sk.d.ts +0 -0
  431. /package/dist/cjs/types/{_locales → locales}/sr-Cyrl-RS.d.ts +0 -0
  432. /package/dist/cjs/types/{_locales → locales}/sr-Latn-RS.d.ts +0 -0
  433. /package/dist/cjs/types/{_locales → locales}/sv.d.ts +0 -0
  434. /package/dist/cjs/types/{_locales → locales}/tr.d.ts +0 -0
  435. /package/dist/cjs/types/{_locales → locales}/uk.d.ts +0 -0
  436. /package/dist/cjs/types/{_locales → locales}/vi.d.ts +0 -0
  437. /package/dist/cjs/types/{_locales → locales}/zh-Hans.d.ts +0 -0
  438. /package/dist/cjs/types/{_locales → locales}/zh-Hant.d.ts +0 -0
  439. /package/dist/esm/types/{_locales → locales}/cs.d.ts +0 -0
  440. /package/dist/esm/types/{_locales → locales}/da.d.ts +0 -0
  441. /package/dist/esm/types/{_locales → locales}/de.d.ts +0 -0
  442. /package/dist/esm/types/{_locales → locales}/en.d.ts +0 -0
  443. /package/dist/esm/types/{_locales → locales}/es.d.ts +0 -0
  444. /package/dist/esm/types/{_locales → locales}/fa.d.ts +0 -0
  445. /package/dist/esm/types/{_locales → locales}/fi.d.ts +0 -0
  446. /package/dist/esm/types/{_locales → locales}/fr.d.ts +0 -0
  447. /package/dist/esm/types/{_locales → locales}/hu.d.ts +0 -0
  448. /package/dist/esm/types/{_locales → locales}/id.d.ts +0 -0
  449. /package/dist/esm/types/{_locales → locales}/it.d.ts +0 -0
  450. /package/dist/esm/types/{_locales → locales}/ja.d.ts +0 -0
  451. /package/dist/esm/types/{_locales → locales}/nl.d.ts +0 -0
  452. /package/dist/esm/types/{_locales → locales}/no.d.ts +0 -0
  453. /package/dist/esm/types/{_locales → locales}/pl.d.ts +0 -0
  454. /package/dist/esm/types/{_locales → locales}/pt-BR.d.ts +0 -0
  455. /package/dist/esm/types/{_locales → locales}/pt.d.ts +0 -0
  456. /package/dist/esm/types/{_locales → locales}/ro.d.ts +0 -0
  457. /package/dist/esm/types/{_locales → locales}/ru.d.ts +0 -0
  458. /package/dist/esm/types/{_locales → locales}/sk.d.ts +0 -0
  459. /package/dist/esm/types/{_locales → locales}/sr-Cyrl-RS.d.ts +0 -0
  460. /package/dist/esm/types/{_locales → locales}/sr-Latn-RS.d.ts +0 -0
  461. /package/dist/esm/types/{_locales → locales}/sv.d.ts +0 -0
  462. /package/dist/esm/types/{_locales → locales}/tr.d.ts +0 -0
  463. /package/dist/esm/types/{_locales → locales}/uk.d.ts +0 -0
  464. /package/dist/esm/types/{_locales → locales}/vi.d.ts +0 -0
  465. /package/dist/esm/types/{_locales → locales}/zh-Hans.d.ts +0 -0
  466. /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';
@@ -286,7 +287,7 @@ const getLeadingDisplayColumnIds = (props) => {
286
287
  props.positionActionsColumn === 'first' &&
287
288
  (props.enableRowActions ||
288
289
  (props.enableEditing &&
289
- ['row', 'modal'].includes((_a = props.editingMode) !== null && _a !== void 0 ? _a : ''))) &&
290
+ ['row', 'modal'].includes((_a = props.editDisplayMode) !== null && _a !== void 0 ? _a : ''))) &&
290
291
  'mrt-row-actions',
291
292
  props.positionExpandColumn === 'first' &&
292
293
  showExpandColumn(props) &&
@@ -301,7 +302,7 @@ const getTrailingDisplayColumnIds = (props) => {
301
302
  props.positionActionsColumn === 'last' &&
302
303
  (props.enableRowActions ||
303
304
  (props.enableEditing &&
304
- ['row', 'modal'].includes((_a = props.editingMode) !== null && _a !== void 0 ? _a : ''))) &&
305
+ ['row', 'modal'].includes((_a = props.editDisplayMode) !== null && _a !== void 0 ? _a : ''))) &&
305
306
  'mrt-row-actions',
306
307
  props.positionExpandColumn === 'last' &&
307
308
  showExpandColumn(props) &&
@@ -348,6 +349,19 @@ const getTotalRight = (table, column) => {
348
349
  .slice(column.getPinnedIndex() + 1)
349
350
  .reduce((acc, col) => acc + col.getSize(), 0);
350
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
+ };
351
365
  const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
352
366
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
353
367
  const widthStyles = {
@@ -409,37 +423,10 @@ const MRT_DefaultDisplayColumn = {
409
423
  enableSorting: false,
410
424
  };
411
425
  const parseCSSVarId = (id) => id.replace(/[^a-zA-Z0-9]/g, '_');
412
-
413
- const MRT_Default_Icons = {
414
- ArrowDownwardIcon,
415
- ArrowRightIcon,
416
- CancelIcon,
417
- ClearAllIcon,
418
- CloseIcon,
419
- DensityLargeIcon,
420
- DensityMediumIcon,
421
- DensitySmallIcon,
422
- DragHandleIcon,
423
- DynamicFeedIcon,
424
- EditIcon,
425
- ExpandMoreIcon,
426
- FilterAltIcon,
427
- FilterListIcon,
428
- FilterListOffIcon,
429
- FullscreenExitIcon,
430
- FullscreenIcon,
431
- KeyboardDoubleArrowDownIcon,
432
- MoreHorizIcon,
433
- MoreVertIcon,
434
- PushPinIcon,
435
- RestartAltIcon,
436
- SaveIcon,
437
- SearchIcon,
438
- SearchOffIcon,
439
- SortIcon,
440
- ViewColumnIcon,
441
- VisibilityOffIcon,
442
- };
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);
443
430
 
444
431
  const MRT_Localization_EN = {
445
432
  actions: 'Actions',
@@ -530,63 +517,712 @@ const MRT_Localization_EN = {
530
517
  ungroupByColumn: 'Ungroup by {column}',
531
518
  unpin: 'Unpin',
532
519
  unpinAll: 'Unpin all',
533
- unsorted: 'Unsorted',
534
520
  };
535
521
 
536
- const MRT_ExpandAllButton = ({ table }) => {
537
- var _a, _b;
538
- const { getIsAllRowsExpanded, getIsSomeRowsExpanded, getCanSomeRowsExpand, getState, options: { icons: { KeyboardDoubleArrowDownIcon }, localization, muiExpandAllButtonProps, renderDetailPanel, }, toggleAllRowsExpanded, } = table;
539
- const { density, isLoading } = getState();
540
- const iconButtonProps = muiExpandAllButtonProps instanceof Function
541
- ? muiExpandAllButtonProps({ table })
542
- : muiExpandAllButtonProps;
543
- const isAllRowsExpanded = getIsAllRowsExpanded();
544
- 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)
545
- ? localization.collapseAll
546
- : 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
547
- ? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
548
- : 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: {
549
- transform: `rotate(${isAllRowsExpanded ? -180 : getIsSomeRowsExpanded() ? -90 : 0}deg)`,
550
- transition: 'transform 150ms',
551
- } })) })) }) }));
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,
552
551
  };
553
552
 
554
- const MRT_ExpandButton = ({ row, table, }) => {
555
- var _a, _b;
556
- const { getState, options: { icons: { ExpandMoreIcon }, localization, muiExpandButtonProps, renderDetailPanel, }, } = table;
557
- const { density } = getState();
558
- const iconButtonProps = muiExpandButtonProps instanceof Function
559
- ? muiExpandButtonProps({ table, row })
560
- : muiExpandButtonProps;
561
- const canExpand = row.getCanExpand();
562
- const isExpanded = row.getIsExpanded();
563
- 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) => {
564
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) => {
565
723
  event.stopPropagation();
566
- row.toggleExpanded();
567
- (_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);
568
727
  };
569
- 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)
570
- ? localization.collapse
571
- : 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
572
- ? iconButtonProps.sx(theme)
573
- : 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: {
574
- transform: `rotate(${!canExpand && !renderDetailPanel ? -90 : isExpanded ? -180 : 0}deg)`,
575
- transition: 'transform 150ms',
576
- } })) })) }) }));
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 })) }));
577
743
  };
578
744
 
579
- const mrtFilterOptions = (localization) => [
580
- {
581
- option: 'fuzzy',
582
- symbol: '≈',
583
- label: localization.filterFuzzy,
584
- divider: false,
585
- },
586
- {
587
- option: 'contains',
588
- symbol: '*',
589
- label: localization.filterContains,
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: '*',
1225
+ label: localization.filterContains,
590
1226
  divider: false,
591
1227
  },
592
1228
  {
@@ -665,6 +1301,7 @@ const mrtFilterOptions = (localization) => [
665
1301
  const rangeModes = ['between', 'betweenInclusive', 'inNumberRange'];
666
1302
  const emptyModes = ['empty', 'notEmpty'];
667
1303
  const arrModes = ['arrIncludesSome', 'arrIncludesAll', 'arrIncludes'];
1304
+ const rangeVariants = ['range-slider', 'date-range', 'range'];
668
1305
  const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilterValue, table, }) => {
669
1306
  var _a, _b, _c, _d;
670
1307
  const { getState, options: { columnFilterModeOptions, globalFilterModeOptions, localization, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
@@ -673,7 +1310,7 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilt
673
1310
  const { columnDef } = column !== null && column !== void 0 ? column : {};
674
1311
  const currentFilterValue = column === null || column === void 0 ? void 0 : column.getFilterValue();
675
1312
  let allowedColumnFilterOptions = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _a !== void 0 ? _a : columnFilterModeOptions;
676
- 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)) {
677
1314
  allowedColumnFilterOptions = [
678
1315
  ...rangeModes,
679
1316
  ...(allowedColumnFilterOptions !== null && allowedColumnFilterOptions !== void 0 ? allowedColumnFilterOptions : []),
@@ -785,7 +1422,7 @@ const commonListItemStyles = {
785
1422
  };
786
1423
  const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
787
1424
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
788
- 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;
789
1426
  const { column } = header;
790
1427
  const { columnDef } = column;
791
1428
  const { columnSizing, columnVisibility, density, showColumnFilters } = getState();
@@ -866,10 +1503,10 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
866
1503
  : []),
867
1504
  ...(enableGrouping && column.getCanGroup()
868
1505
  ? [
869
- 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),
870
1507
  ]
871
1508
  : []),
872
- ...(enablePinning && column.getCanPin()
1509
+ ...(enableColumnPinning && column.getCanPin()
873
1510
  ? [
874
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),
875
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),
@@ -919,30 +1556,49 @@ const MRT_RowActionMenu = ({ anchorEl, handleEdit, row, setAnchorEl, table, }) =
919
1556
  };
920
1557
 
921
1558
  const MRT_EditActionButtons = ({ row, table, variant = 'icon', }) => {
922
- const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onEditingRowSave, onEditingRowCancel, }, refs: { editInputRefs }, setEditingRow, } = table;
923
- 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;
924
1563
  const handleCancel = () => {
925
- onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
926
- 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
927
1573
  };
928
- const handleSave = () => {
929
- var _a, _b;
1574
+ const handleSubmitRow = () => {
1575
+ var _a;
930
1576
  //look for auto-filled input values
931
- (_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) => {
932
1579
  if (input.value !== undefined &&
933
- 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)) {
934
1581
  // @ts-ignore
935
- editingRow._valuesCache[input.name] = input.value;
1582
+ row._valuesCache[input.name] = input.value;
936
1583
  }
937
1584
  });
938
- onEditingRowSave === null || onEditingRowSave === void 0 ? void 0 : onEditingRowSave({
939
- exitEditingMode: () => setEditingRow(null),
940
- row: editingRow !== null && editingRow !== void 0 ? editingRow : row,
941
- table,
942
- values: (_b = editingRow === null || editingRow === void 0 ? void 0 : editingRow._valuesCache) !== null && _b !== void 0 ? _b : Object.assign({}, row.original),
943
- });
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
+ }
944
1600
  };
945
- 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] })] })) }));
946
1602
  };
947
1603
 
948
1604
  const commonIconButtonStyles = {
@@ -956,8 +1612,12 @@ const commonIconButtonStyles = {
956
1612
  },
957
1613
  };
958
1614
  const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
959
- const { getState, options: { editingMode, enableEditing, icons: { EditIcon, MoreHorizIcon }, localization, renderRowActionMenuItems, renderRowActions, }, setEditingRow, } = table;
960
- 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');
961
1621
  const [anchorEl, setAnchorEl] = useState(null);
962
1622
  const handleOpenRowActionMenu = (event) => {
963
1623
  event.stopPropagation();
@@ -969,13 +1629,13 @@ const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
969
1629
  setEditingRow(Object.assign({}, row));
970
1630
  setAnchorEl(null);
971
1631
  };
972
- 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 &&
973
1633
  (enableEditing instanceof Function
974
1634
  ? enableEditing(row)
975
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 }));
976
1636
  };
977
1637
 
978
- const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
1638
+ const MRT_SelectCheckbox = ({ row, selectAll, table, }) => {
979
1639
  var _a;
980
1640
  const { getState, options: { localization, enableMultiRowSelection, muiSelectCheckboxProps, muiSelectAllCheckboxProps, selectAllMode, }, } = table;
981
1641
  const { density, isLoading } = getState();
@@ -1013,6 +1673,288 @@ const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
1013
1673
  : row === null || row === void 0 ? void 0 : row.getIsSomeSelected() }, commonProps))) }));
1014
1674
  };
1015
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
+
1016
1958
  const MRT_GlobalFilterTextField = ({ table, }) => {
1017
1959
  var _a;
1018
1960
  const { getState, setGlobalFilter, options: { enableGlobalFilterModes, icons: { SearchIcon, CloseIcon }, localization, manualFiltering, muiSearchTextFieldProps, }, refs: { searchInputRef }, } = table;
@@ -1136,49 +2078,34 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
1136
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] })] })) }));
1137
2079
  };
1138
2080
 
1139
- const MRT_FullScreenToggleButton = (_a) => {
2081
+ const MRT_ToggleFullScreenButton = (_a) => {
1140
2082
  var _b;
1141
2083
  var { table } = _a, rest = __rest(_a, ["table"]);
1142
2084
  const { getState, options: { icons: { FullscreenExitIcon, FullscreenIcon }, localization, }, setIsFullScreen, } = table;
1143
2085
  const { isFullScreen } = getState();
2086
+ const [tooltipOpened, setTooltipOpened] = useState(false);
1144
2087
  const handleToggleFullScreen = () => {
2088
+ setTooltipOpened(false);
1145
2089
  setIsFullScreen(!isFullScreen);
1146
2090
  };
1147
- 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, {}) })) }));
1148
2092
  };
1149
2093
 
1150
2094
  const MRT_ColumnPinningButtons = ({ column, table, }) => {
1151
2095
  const { options: { icons: { PushPinIcon }, localization, }, } = table;
1152
- const handlePinColumn = (pinDirection) => {
1153
- column.pin(pinDirection);
1154
- };
1155
- 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: {
1156
- transform: 'rotate(90deg)',
1157
- } }) }) }), jsx(Tooltip, { arrow: true, title: localization.pinToRight, children: jsx(IconButton, { onClick: () => handlePinColumn('right'), size: "small", children: jsx(PushPinIcon, { style: {
1158
- transform: 'rotate(-90deg)',
1159
- } }) }) })] })) }));
1160
- };
1161
-
1162
- const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table, }) => {
1163
- var _a;
1164
- const { options: { icons: { DragHandleIcon }, localization, }, } = table;
1165
- 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) => {
1166
- var _a;
1167
- e.stopPropagation();
1168
- (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, e);
1169
- }, 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': {
1170
- backgroundColor: 'transparent',
1171
- opacity: 1,
1172
- }, '&:active': {
1173
- cursor: 'grabbing',
1174
- } }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
1175
- ? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
1176
- : iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined, children: jsx(DragHandleIcon, {}) })) }));
2096
+ const handlePinColumn = (pinDirection) => {
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
+ } }) }) })] })) }));
1177
2104
  };
1178
2105
 
1179
2106
  const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredColumn, column, table, }) => {
1180
2107
  var _a;
1181
- const { getState, options: { enableColumnOrdering, enableHiding, enablePinning, localization, }, setColumnOrder, } = table;
2108
+ const { getState, options: { enableColumnOrdering, enableHiding, enableColumnPinning, localization, }, setColumnOrder, } = table;
1182
2109
  const { columnOrder } = getState();
1183
2110
  const { columnDef } = column;
1184
2111
  const { columnDefType } = columnDef;
@@ -1234,7 +2161,7 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredCol
1234
2161
  }, children: [columnDefType !== 'group' &&
1235
2162
  enableColumnOrdering &&
1236
2163
  !allColumns.some((col) => col.columnDef.columnDefType === 'group') &&
1237
- (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 &&
1238
2165
  (column.getCanPin() ? (jsx(MRT_ColumnPinningButtons, { column: column, table: table })) : (jsx(Box, { sx: { width: '70px' } }))), enableHiding ? (jsx(FormControlLabel, { componentsProps: {
1239
2166
  typography: {
1240
2167
  sx: {
@@ -1246,7 +2173,7 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredCol
1246
2173
  };
1247
2174
 
1248
2175
  const MRT_ShowHideColumnsMenu = ({ anchorEl, setAnchorEl, table, }) => {
1249
- 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;
1250
2177
  const { density, columnOrder, columnPinning } = getState();
1251
2178
  const hideAllColumns = () => {
1252
2179
  getAllLeafColumns()
@@ -1280,7 +2207,7 @@ const MRT_ShowHideColumnsMenu = ({ anchorEl, setAnchorEl, table, }) => {
1280
2207
  justifyContent: 'space-between',
1281
2208
  p: '0.5rem',
1282
2209
  pt: 0,
1283
- }, 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}`)))] }));
1284
2211
  };
1285
2212
 
1286
2213
  const MRT_ShowHideColumnsButton = (_a) => {
@@ -1335,7 +2262,7 @@ const MRT_ToggleGlobalFilterButton = (_a) => {
1335
2262
 
1336
2263
  const MRT_ToolbarInternalButtons = ({ table, }) => {
1337
2264
  var _a;
1338
- 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;
1339
2266
  return (jsx(Box, { sx: {
1340
2267
  alignItems: 'center',
1341
2268
  display: 'flex',
@@ -1344,7 +2271,7 @@ const MRT_ToolbarInternalButtons = ({ table, }) => {
1344
2271
  table,
1345
2272
  })) !== null && _a !== void 0 ? _a : (jsxs(Fragment, { children: [enableFilters &&
1346
2273
  enableGlobalFilter &&
1347
- !(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 }))] })) }));
1348
2275
  };
1349
2276
 
1350
2277
  const MRT_ToolbarDropZone = ({ table, }) => {
@@ -1463,7 +2390,7 @@ const MRT_BottomToolbar = ({ table, }) => {
1463
2390
 
1464
2391
  const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
1465
2392
  var _a;
1466
- const { options: { icons: { MoreVertIcon }, localization, muiTableHeadCellColumnActionsButtonProps, }, } = table;
2393
+ const { options: { icons: { MoreVertIcon }, localization, muiColumnActionsButtonProps, }, } = table;
1467
2394
  const { column } = header;
1468
2395
  const { columnDef } = column;
1469
2396
  const [anchorEl, setAnchorEl] = useState(null);
@@ -1472,15 +2399,15 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
1472
2399
  event.preventDefault();
1473
2400
  setAnchorEl(event.currentTarget);
1474
2401
  };
1475
- const mTableHeadCellColumnActionsButtonProps = muiTableHeadCellColumnActionsButtonProps instanceof Function
1476
- ? muiTableHeadCellColumnActionsButtonProps({ column, table })
1477
- : muiTableHeadCellColumnActionsButtonProps;
1478
- const mcTableHeadCellColumnActionsButtonProps = columnDef.muiTableHeadCellColumnActionsButtonProps instanceof Function
1479
- ? columnDef.muiTableHeadCellColumnActionsButtonProps({
2402
+ const mTableHeadCellColumnActionsButtonProps = muiColumnActionsButtonProps instanceof Function
2403
+ ? muiColumnActionsButtonProps({ column, table })
2404
+ : muiColumnActionsButtonProps;
2405
+ const mcTableHeadCellColumnActionsButtonProps = columnDef.muiColumnActionsButtonProps instanceof Function
2406
+ ? columnDef.muiColumnActionsButtonProps({
1480
2407
  column,
1481
2408
  table,
1482
2409
  })
1483
- : columnDef.muiTableHeadCellColumnActionsButtonProps;
2410
+ : columnDef.muiColumnActionsButtonProps;
1484
2411
  const iconButtonProps = Object.assign(Object.assign({}, mTableHeadCellColumnActionsButtonProps), mcTableHeadCellColumnActionsButtonProps);
1485
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': {
1486
2413
  opacity: 1,
@@ -1491,23 +2418,23 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
1491
2418
 
1492
2419
  const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1493
2420
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1494
- 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;
1495
2422
  const { column } = header;
1496
2423
  const { columnDef } = column;
1497
- const mTableHeadCellFilterTextFieldProps = muiTableHeadCellFilterTextFieldProps instanceof Function
1498
- ? muiTableHeadCellFilterTextFieldProps({
2424
+ const mTableHeadCellFilterTextFieldProps = muiFilterTextFieldProps instanceof Function
2425
+ ? muiFilterTextFieldProps({
1499
2426
  column,
1500
2427
  table,
1501
2428
  rangeFilterIndex,
1502
2429
  })
1503
- : muiTableHeadCellFilterTextFieldProps;
1504
- const mcTableHeadCellFilterTextFieldProps = columnDef.muiTableHeadCellFilterTextFieldProps instanceof Function
1505
- ? columnDef.muiTableHeadCellFilterTextFieldProps({
2430
+ : muiFilterTextFieldProps;
2431
+ const mcTableHeadCellFilterTextFieldProps = columnDef.muiFilterTextFieldProps instanceof Function
2432
+ ? columnDef.muiFilterTextFieldProps({
1506
2433
  column,
1507
2434
  table,
1508
2435
  rangeFilterIndex,
1509
2436
  })
1510
- : columnDef.muiTableHeadCellFilterTextFieldProps;
2437
+ : columnDef.muiFilterTextFieldProps;
1511
2438
  const textFieldProps = Object.assign(Object.assign({}, mTableHeadCellFilterTextFieldProps), mcTableHeadCellFilterTextFieldProps);
1512
2439
  const isRangeFilter = columnDef.filterVariant === 'range' || rangeFilterIndex !== undefined;
1513
2440
  const isSelectFilter = columnDef.filterVariant === 'select';
@@ -1537,7 +2464,9 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1537
2464
  const filterSelectOptions = useMemo(() => {
1538
2465
  var _a;
1539
2466
  return (_a = columnDef.filterSelectOptions) !== null && _a !== void 0 ? _a : ((isSelectFilter || isMultiSelectFilter) && facetedUniqueValues
1540
- ? 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))
1541
2470
  : undefined);
1542
2471
  }, [
1543
2472
  columnDef.filterSelectOptions,
@@ -1685,965 +2614,441 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1685
2614
  text = option;
1686
2615
  }
1687
2616
  else {
1688
- value = option.value;
1689
- text = option.text;
1690
- }
1691
- return (jsxs(MenuItem, { sx: {
1692
- display: 'flex',
1693
- m: 0,
1694
- alignItems: 'center',
1695
- gap: '0.5rem',
1696
- }, value: value, children: [isMultiSelectFilter && (jsx(Checkbox, { checked: ((_a = column.getFilterValue()) !== null && _a !== void 0 ? _a : []).includes(value), sx: { mr: '0.5rem' } })), text, ' ', !columnDef.filterSelectOptions &&
1697
- `(${facetedUniqueValues.get(value)})`] }, value));
1698
- })] })), jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table, setFilterValue: setFilterValue })] }));
1699
- };
1700
-
1701
- const MRT_FilterRangeFields = ({ header, table }) => {
1702
- 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 })] }));
1703
- };
1704
-
1705
- const MRT_FilterCheckbox = ({ column, table }) => {
1706
- var _a, _b, _c;
1707
- const { getState, options: { localization, muiTableHeadCellFilterCheckboxProps }, } = table;
1708
- const { density } = getState();
1709
- const { columnDef } = column;
1710
- const mTableHeadCellFilterCheckboxProps = muiTableHeadCellFilterCheckboxProps instanceof Function
1711
- ? muiTableHeadCellFilterCheckboxProps({
1712
- column,
1713
- table,
1714
- })
1715
- : muiTableHeadCellFilterCheckboxProps;
1716
- const mcTableHeadCellFilterCheckboxProps = columnDef.muiTableHeadCellFilterCheckboxProps instanceof Function
1717
- ? columnDef.muiTableHeadCellFilterCheckboxProps({
1718
- column,
1719
- table,
1720
- })
1721
- : columnDef.muiTableHeadCellFilterCheckboxProps;
1722
- const checkboxProps = Object.assign(Object.assign({}, mTableHeadCellFilterCheckboxProps), mcTableHeadCellFilterCheckboxProps);
1723
- const filterLabel = (_a = localization.filterByColumn) === null || _a === void 0 ? void 0 : _a.replace('{column}', columnDef.header);
1724
- 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) => {
1725
- var _a;
1726
- e.stopPropagation();
1727
- (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
1728
- }, onChange: (e, checked) => {
1729
- var _a;
1730
- column.setFilterValue(column.getFilterValue() === undefined
1731
- ? 'true'
1732
- : column.getFilterValue() === 'true'
1733
- ? 'false'
1734
- : undefined);
1735
- (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onChange) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e, checked);
1736
- }, sx: (theme) => (Object.assign({ height: '2.5rem', width: '2.5rem' }, ((checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx) instanceof Function
1737
- ? checkboxProps.sx(theme)
1738
- : 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 }) }));
1739
- };
1740
-
1741
- const MRT_FilterRangeSlider = ({ header, table }) => {
1742
- var _a, _b;
1743
- const { options: { localization, muiTableHeadCellFilterSliderProps, enableColumnFilterModes, }, refs: { filterInputRefs }, } = table;
1744
- const { column } = header;
1745
- const { columnDef } = column;
1746
- const currentFilterOption = columnDef._filterFn;
1747
- const showChangeModeButton = enableColumnFilterModes && columnDef.enableColumnFilterModes !== false;
1748
- const mTableHeadCellFilterTextFieldProps = muiTableHeadCellFilterSliderProps instanceof Function
1749
- ? muiTableHeadCellFilterSliderProps({
1750
- column,
1751
- table,
1752
- })
1753
- : muiTableHeadCellFilterSliderProps;
1754
- const mcTableHeadCellFilterTextFieldProps = columnDef.muiTableHeadCellFilterSliderProps instanceof Function
1755
- ? columnDef.muiTableHeadCellFilterSliderProps({
1756
- column,
1757
- table,
1758
- })
1759
- : columnDef.muiTableHeadCellFilterSliderProps;
1760
- const sliderProps = Object.assign(Object.assign({}, mTableHeadCellFilterTextFieldProps), mcTableHeadCellFilterTextFieldProps);
1761
- let [min, max] = sliderProps.min !== undefined && sliderProps.max !== undefined
1762
- ? [sliderProps.min, sliderProps.max]
1763
- : (_a = column.getFacetedMinMaxValues()) !== null && _a !== void 0 ? _a : [0, 1];
1764
- //fix potential TanStack Table bugs where min or max is an array
1765
- if (Array.isArray(min))
1766
- min = min[0];
1767
- if (Array.isArray(max))
1768
- max = max[0];
1769
- if (min === null)
1770
- min = 0;
1771
- if (max === null)
1772
- max = 1;
1773
- const [filterValues, setFilterValues] = useState([min, max]);
1774
- const columnFilterValue = column.getFilterValue();
1775
- const isMounted = useRef(false);
1776
- useEffect(() => {
1777
- if (isMounted.current) {
1778
- if (columnFilterValue === undefined) {
1779
- setFilterValues([min, max]);
1780
- }
1781
- else if (Array.isArray(columnFilterValue)) {
1782
- setFilterValues(columnFilterValue);
1783
- }
1784
- }
1785
- isMounted.current = true;
1786
- }, [columnFilterValue, min, max]);
1787
- return (jsxs(Stack, { children: [jsx(Slider, Object.assign({ disableSwap: true, min: min, max: max, onChange: (_event, values) => {
1788
- setFilterValues(values);
1789
- }, onChangeCommitted: (_event, value) => {
1790
- if (Array.isArray(value)) {
1791
- if (value[0] <= min && value[1] >= max) {
1792
- //if the user has selected the entire range, remove the filter
1793
- column.setFilterValue(undefined);
1794
- }
1795
- else {
1796
- column.setFilterValue(value);
1797
- }
1798
- }
1799
- }, value: filterValues, valueLabelDisplay: "auto" }, sliderProps, { slotProps: {
1800
- input: {
1801
- ref: (node) => {
1802
- var _a, _b;
1803
- if (node) {
1804
- filterInputRefs.current[`${column.id}-0`] = node;
1805
- // @ts-ignore
1806
- 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) {
1807
- //@ts-ignore
1808
- sliderProps.slotProps.input.ref = node;
1809
- }
1810
- }
1811
- },
1812
- },
1813
- }, 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
1814
- ? sliderProps.sx(theme)
1815
- : sliderProps === null || sliderProps === void 0 ? void 0 : sliderProps.sx))) })), showChangeModeButton ? (jsx(FormHelperText, { sx: {
1816
- m: '-3px -6px',
1817
- fontSize: '0.75rem',
1818
- lineHeight: '0.8rem',
1819
- whiteSpace: 'nowrap',
1820
- }, children: localization.filterMode.replace('{filterType}',
1821
- // @ts-ignore
1822
- localization[`filter${((_b = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _b === void 0 ? void 0 : _b.toUpperCase()) +
1823
- (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]) })) : null] }));
1824
- };
1825
-
1826
- const MRT_TableHeadCellFilterContainer = ({ header, table }) => {
1827
- const { getState } = table;
1828
- const { showColumnFilters } = getState();
1829
- const { column } = header;
1830
- const { columnDef } = column;
1831
- 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' ||
1832
- ['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn) ? (jsx(MRT_FilterRangeFields, { header: header, table: table })) : (jsx(MRT_FilterTextField, { header: header, table: table })) }));
1833
- };
1834
-
1835
- const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
1836
- var _a, _b, _c, _d;
1837
- const { options: { icons: { FilterAltIcon }, localization, }, refs: { filterInputRefs }, setShowColumnFilters, } = table;
1838
- const { column } = header;
1839
- const { columnDef } = column;
1840
- const isRangeFilter = ['range', 'ranger-slider'].includes((_a = columnDef.filterVariant) !== null && _a !== void 0 ? _a : '') ||
1841
- ['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn);
1842
- const currentFilterOption = columnDef._filterFn;
1843
- const filterTooltip = localization.filteringByColumn
1844
- .replace('{column}', String(columnDef.header))
1845
- .replace('{filterType}',
1846
- // @ts-ignore
1847
- localization[`filter${((_b = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _b === void 0 ? void 0 : _b.toUpperCase()) +
1848
- (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`])
1849
- .replace('{filterValue}', `"${Array.isArray(column.getFilterValue())
1850
- ? column.getFilterValue().join(`" ${isRangeFilter ? localization.and : localization.or} "`)
1851
- : column.getFilterValue()}"`)
1852
- .replace('" "', '');
1853
- return (jsx(Grow, { unmountOnExit: true, in: (!!column.getFilterValue() && !isRangeFilter) ||
1854
- (isRangeFilter && // @ts-ignore
1855
- (!!((_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) => {
1856
- setShowColumnFilters(true);
1857
- queueMicrotask(() => {
1858
- var _a, _b;
1859
- (_a = filterInputRefs.current[`${column.id}-0`]) === null || _a === void 0 ? void 0 : _a.focus();
1860
- (_b = filterInputRefs.current[`${column.id}-0`]) === null || _b === void 0 ? void 0 : _b.select();
1861
- });
1862
- event.stopPropagation();
1863
- }, size: "small", sx: {
1864
- height: '12px',
1865
- m: 0,
1866
- opacity: 0.8,
1867
- p: '2px',
1868
- transform: 'scale(0.66)',
1869
- width: '12px',
1870
- }, children: jsx(FilterAltIcon, {}) }) }) }) }));
1871
- };
1872
-
1873
- const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
1874
- const { getState, options: { enableColumnOrdering, muiTableHeadCellDragHandleProps }, setColumnOrder, setDraggingColumn, setHoveredColumn, } = table;
1875
- const { columnDef } = column;
1876
- const { hoveredColumn, draggingColumn, columnOrder } = getState();
1877
- const mIconButtonProps = muiTableHeadCellDragHandleProps instanceof Function
1878
- ? muiTableHeadCellDragHandleProps({ column, table })
1879
- : muiTableHeadCellDragHandleProps;
1880
- const mcIconButtonProps = columnDef.muiTableHeadCellDragHandleProps instanceof Function
1881
- ? columnDef.muiTableHeadCellDragHandleProps({ column, table })
1882
- : columnDef.muiTableHeadCellDragHandleProps;
1883
- const iconButtonProps = Object.assign(Object.assign({}, mIconButtonProps), mcIconButtonProps);
1884
- const handleDragStart = (event) => {
1885
- var _a;
1886
- (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1887
- setDraggingColumn(column);
1888
- event.dataTransfer.setDragImage(tableHeadCellRef.current, 0, 0);
1889
- };
1890
- const handleDragEnd = (event) => {
1891
- var _a;
1892
- (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1893
- if ((hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
1894
- column.toggleGrouping();
1895
- }
1896
- else if (enableColumnOrdering &&
1897
- hoveredColumn &&
1898
- (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) !== (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id)) {
1899
- setColumnOrder(reorderColumn(column, hoveredColumn, columnOrder));
1900
- }
1901
- setDraggingColumn(null);
1902
- setHoveredColumn(null);
1903
- };
1904
- return (jsx(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
1905
- };
1906
-
1907
- const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
1908
- var _a;
1909
- const { getState, options: { columnResizeMode }, setColumnSizingInfo, } = table;
1910
- const { density } = getState();
1911
- const { column } = header;
1912
- return (jsx(Box, { className: "Mui-TableHeadCell-ResizeHandle-Wrapper", onDoubleClick: () => {
1913
- setColumnSizingInfo((old) => (Object.assign(Object.assign({}, old), { isResizingColumn: false })));
1914
- column.resetSize();
1915
- }, onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), sx: (theme) => ({
1916
- cursor: 'col-resize',
1917
- mr: density === 'compact' ? '-0.75rem' : '-1rem',
1918
- position: 'absolute',
1919
- right: '4px',
1920
- px: '4px',
1921
- '&:active > hr': {
1922
- backgroundColor: theme.palette.info.main,
1923
- opacity: 1,
1924
- },
1925
- }), style: {
1926
- transform: column.getIsResizing() && columnResizeMode === 'onEnd'
1927
- ? `translateX(${(_a = getState().columnSizingInfo.deltaOffset) !== null && _a !== void 0 ? _a : 0}px)`
1928
- : undefined,
1929
- }, children: jsx(Divider, { className: "Mui-TableHeadCell-ResizeHandle-Divider", flexItem: true, orientation: "vertical", sx: {
1930
- borderRadius: '2px',
1931
- borderWidth: '2px',
1932
- height: '24px',
1933
- touchAction: 'none',
1934
- transition: column.getIsResizing()
1935
- ? undefined
1936
- : 'all 150ms ease-in-out',
1937
- userSelect: 'none',
1938
- zIndex: 4,
1939
- } }) }));
1940
- };
1941
-
1942
- const MRT_TableHeadCellSortLabel = ({ header, table, tableCellProps, }) => {
1943
- const { getState, options: { icons: { ArrowDownwardIcon }, localization, }, } = table;
1944
- const { column } = header;
1945
- const { columnDef } = column;
1946
- const { sorting } = getState();
1947
- const sortTooltip = column.getIsSorted()
1948
- ? column.getIsSorted() === 'desc'
1949
- ? localization.sortedByColumnDesc.replace('{column}', columnDef.header)
1950
- : localization.sortedByColumnAsc.replace('{column}', columnDef.header)
1951
- : localization.unsorted;
1952
- 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()
1953
- ? column.getIsSorted()
1954
- : undefined, sx: {
1955
- flex: '0 0',
1956
- width: '2.4ch',
1957
- transform: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) !== 'right'
1958
- ? 'translateX(-0.5ch)'
1959
- : undefined,
1960
- }, IconComponent: ArrowDownwardIcon, onClick: (e) => {
1961
- var _a;
1962
- e.stopPropagation();
1963
- (_a = header.column.getToggleSortingHandler()) === null || _a === void 0 ? void 0 : _a(e);
1964
- } }) }) }));
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 })] }));
1965
2628
  };
1966
2629
 
1967
- const MRT_TableHeadCell = ({ header, table }) => {
1968
- var _a, _b, _c, _d, _f, _g;
1969
- const theme = useTheme();
1970
- const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering, enableGrouping, enableMultiSort, layoutMode, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
1971
- const { density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
1972
- 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();
1973
2638
  const { columnDef } = column;
1974
- const { columnDefType } = columnDef;
1975
- const mTableHeadCellProps = muiTableHeadCellProps instanceof Function
1976
- ? muiTableHeadCellProps({ column, table })
1977
- : muiTableHeadCellProps;
1978
- const mcTableHeadCellProps = columnDef.muiTableHeadCellProps instanceof Function
1979
- ? columnDef.muiTableHeadCellProps({ column, table })
1980
- : columnDef.muiTableHeadCellProps;
1981
- const tableCellProps = Object.assign(Object.assign({}, mTableHeadCellProps), mcTableHeadCellProps);
1982
- const showColumnActions = (enableColumnActions || columnDef.enableColumnActions) &&
1983
- columnDef.enableColumnActions !== false;
1984
- const showDragHandle = enableColumnDragging !== false &&
1985
- columnDef.enableColumnDragging !== false &&
1986
- (enableColumnDragging ||
1987
- (enableColumnOrdering && columnDef.enableColumnOrdering !== false) ||
1988
- (enableGrouping &&
1989
- columnDef.enableGrouping !== false &&
1990
- !grouping.includes(column.id)));
1991
- const headerPL = useMemo(() => {
1992
- let pl = 0;
1993
- if (column.getCanSort())
1994
- pl++;
1995
- if (showColumnActions)
1996
- pl += 1.75;
1997
- if (showDragHandle)
1998
- pl += 1.25;
1999
- return pl;
2000
- }, [showColumnActions, showDragHandle]);
2001
- const draggingBorder = useMemo(() => (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
2002
- ? `1px dashed ${theme.palette.text.secondary}`
2003
- : (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
2004
- ? `2px dashed ${theme.palette.primary.main}`
2005
- : undefined, [draggingColumn, hoveredColumn]);
2006
- const draggingBorders = draggingBorder
2007
- ? {
2008
- borderLeft: draggingBorder,
2009
- borderRight: draggingBorder,
2010
- borderTop: draggingBorder,
2011
- }
2012
- : undefined;
2013
- const handleDragEnter = (_e) => {
2014
- if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
2015
- setHoveredColumn(null);
2016
- }
2017
- if (enableColumnOrdering && draggingColumn && columnDefType !== 'group') {
2018
- setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
2019
- }
2020
- };
2021
- const headerElement = (columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) instanceof Function
2022
- ? (_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({
2023
2641
  column,
2024
- header,
2025
2642
  table,
2026
2643
  })
2027
- : (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) !== null && _b !== void 0 ? _b : columnDef.header;
2028
- return (jsxs(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: (node) => {
2029
- if (node) {
2030
- tableHeadCellRefs.current[column.id] = node;
2031
- }
2032
- } }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ flexDirection: layoutMode === 'grid' ? 'column' : undefined, fontWeight: 'bold', overflow: 'visible', p: density === 'compact'
2033
- ? '0.5rem'
2034
- : density === 'comfortable'
2035
- ? columnDefType === 'display'
2036
- ? '0.75rem'
2037
- : '1rem'
2038
- : columnDefType === 'display'
2039
- ? '1rem 1.25rem'
2040
- : '1.5rem', pb: columnDefType === 'display'
2041
- ? 0
2042
- : showColumnFilters || density === 'compact'
2043
- ? '0.4rem'
2044
- : '0.6rem', pt: columnDefType === 'group' || density === 'compact'
2045
- ? '0.25rem'
2046
- : density === 'comfortable'
2047
- ? '.75rem'
2048
- : '1.25rem', userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
2049
- ? 3
2050
- : column.getIsPinned() && columnDefType !== 'group'
2051
- ? 2
2052
- : 1 }, getCommonCellStyles({
2644
+ : muiFilterCheckboxProps;
2645
+ const mcTableHeadCellFilterCheckboxProps = columnDef.muiFilterCheckboxProps instanceof Function
2646
+ ? columnDef.muiFilterCheckboxProps({
2053
2647
  column,
2054
- header,
2055
2648
  table,
2056
- tableCellProps,
2057
- theme,
2058
- })), draggingBorders)), children: [header.isPlaceholder ? null : (jsxs(Box, { className: "Mui-TableHeadCell-Content", sx: {
2059
- alignItems: 'center',
2060
- display: 'flex',
2061
- flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
2062
- justifyContent: columnDefType === 'group' || (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
2063
- ? 'center'
2064
- : column.getCanResize()
2065
- ? 'space-between'
2066
- : 'flex-start',
2067
- position: 'relative',
2068
- width: '100%',
2069
- }, children: [jsxs(Box, { className: "Mui-TableHeadCell-Content-Labels", onClick: column.getToggleSortingHandler(), sx: {
2070
- alignItems: 'center',
2071
- cursor: column.getCanSort() && columnDefType !== 'group'
2072
- ? 'pointer'
2073
- : undefined,
2074
- display: 'flex',
2075
- flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
2076
- overflow: columnDefType === 'data' ? 'hidden' : undefined,
2077
- pl: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
2078
- ? `${headerPL}rem`
2079
- : undefined,
2080
- }, children: [jsx(Box, { className: "Mui-TableHeadCell-Content-Wrapper", sx: {
2081
- minWidth: `${Math.min((_d = (_c = columnDef.header) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0, 5)}ch`,
2082
- overflow: columnDefType === 'data' ? 'hidden' : undefined,
2083
- textOverflow: 'ellipsis',
2084
- whiteSpace: ((_g = (_f = columnDef.header) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 0) < 20 ? 'nowrap' : 'normal',
2085
- '&:hover': {
2086
- textOverflow: 'clip',
2087
- },
2088
- }, 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: {
2089
- current: tableHeadCellRefs.current[column.id],
2090
- } })), 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 }))] })));
2091
- };
2092
-
2093
- const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
2094
- const { options: { layoutMode, muiTableHeadRowProps }, } = table;
2095
- const tableRowProps = muiTableHeadRowProps instanceof Function
2096
- ? muiTableHeadRowProps({ headerGroup, table })
2097
- : muiTableHeadRowProps;
2098
- 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
2099
- ? tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx(theme)
2100
- : 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) => {
2101
- const header = virtualColumns
2102
- ? headerGroup.headers[headerOrVirtualHeader.index]
2103
- : headerOrVirtualHeader;
2104
- return (jsx(MRT_TableHeadCell, { header: header, table: table }, header.id));
2105
- }), virtualPaddingRight ? (jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
2106
- };
2107
-
2108
- const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
2109
- const { getHeaderGroups, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps }, } = table;
2110
- const { isFullScreen } = getState();
2111
- const tableHeadProps = muiTableHeadProps instanceof Function
2112
- ? muiTableHeadProps({ table })
2113
- : muiTableHeadProps;
2114
- const stickyHeader = enableStickyHeader || isFullScreen;
2115
- 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
2116
- ? tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx(theme)
2117
- : 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 }) }));
2118
2668
  };
2119
2669
 
2120
- const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
2121
- var _a, _b, _c;
2122
- const { getState, options: { muiTableBodyCellEditTextFieldProps }, refs: { editInputRefs }, setEditingCell, setEditingRow, } = table;
2123
- 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;
2124
2674
  const { columnDef } = column;
2125
- const { editingRow } = getState();
2126
- const [value, setValue] = useState(() => cell.getValue());
2127
- const mTableBodyCellEditTextFieldProps = muiTableBodyCellEditTextFieldProps instanceof Function
2128
- ? muiTableBodyCellEditTextFieldProps({ cell, column, row, table })
2129
- : muiTableBodyCellEditTextFieldProps;
2130
- const mcTableBodyCellEditTextFieldProps = columnDef.muiTableBodyCellEditTextFieldProps instanceof Function
2131
- ? columnDef.muiTableBodyCellEditTextFieldProps({
2132
- cell,
2675
+ const currentFilterOption = columnDef._filterFn;
2676
+ const showChangeModeButton = enableColumnFilterModes && columnDef.enableColumnFilterModes !== false;
2677
+ const mFilterSliderProps = muiFilterSliderProps instanceof Function
2678
+ ? muiFilterSliderProps({
2133
2679
  column,
2134
- row,
2135
2680
  table,
2136
2681
  })
2137
- : columnDef.muiTableBodyCellEditTextFieldProps;
2138
- const textFieldProps = Object.assign(Object.assign({}, mTableBodyCellEditTextFieldProps), mcTableBodyCellEditTextFieldProps);
2139
- const isSelectEdit = columnDef.editVariant === 'select';
2140
- const saveRow = (newValue) => {
2141
- if (editingRow) {
2142
- setEditingRow(Object.assign(Object.assign({}, editingRow), { _valuesCache: Object.assign(Object.assign({}, editingRow._valuesCache), { [column.id]: newValue }) }));
2143
- }
2144
- };
2145
- const handleChange = (event) => {
2146
- var _a;
2147
- (_a = textFieldProps.onChange) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
2148
- setValue(event.target.value);
2149
- if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.select) {
2150
- saveRow(event.target.value);
2151
- }
2152
- };
2153
- const handleBlur = (event) => {
2154
- var _a;
2155
- (_a = textFieldProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
2156
- saveRow(value);
2157
- setEditingCell(null);
2158
- };
2159
- const handleEnterKeyDown = (event) => {
2160
- var _a, _b;
2161
- (_a = textFieldProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
2162
- if (event.key === 'Enter') {
2163
- (_b = editInputRefs.current[column.id]) === null || _b === void 0 ? void 0 : _b.blur();
2164
- }
2165
- };
2166
- if (columnDef.Edit) {
2167
- return jsx(Fragment, { children: (_a = columnDef.Edit) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table }) });
2168
- }
2169
- return (jsx(TextField, Object.assign({ disabled: (columnDef.enableEditing instanceof Function
2170
- ? columnDef.enableEditing(row)
2171
- : columnDef.enableEditing) === false, fullWidth: true, inputRef: (inputRef) => {
2172
- if (inputRef) {
2173
- editInputRefs.current[column.id] = inputRef;
2174
- if (textFieldProps.inputRef) {
2175
- textFieldProps.inputRef = inputRef;
2176
- }
2177
- }
2178
- }, label: showLabel ? column.columnDef.header : undefined, margin: "none", name: column.id, placeholder: columnDef.header, select: isSelectEdit, value: value, variant: "standard" }, textFieldProps, { onClick: (e) => {
2179
- var _a;
2180
- e.stopPropagation();
2181
- (_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.onClick) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, e);
2182
- }, 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) => {
2183
- let value;
2184
- let text;
2185
- if (typeof option !== 'object') {
2186
- value = option;
2187
- 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]);
2188
2709
  }
2189
- else {
2190
- value = option.value;
2191
- text = option.text;
2710
+ else if (Array.isArray(columnFilterValue)) {
2711
+ setFilterValues(columnFilterValue);
2192
2712
  }
2193
- return (jsx(MenuItem, { sx: {
2194
- display: 'flex',
2195
- m: 0,
2196
- alignItems: 'center',
2197
- gap: '0.5rem',
2198
- }, value: value, children: text }, value));
2199
- }) })));
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] }));
2200
2753
  };
2201
2754
 
2202
- const MRT_CopyButton = ({ cell, children, table, }) => {
2203
- var _a;
2204
- const { options: { localization, muiTableBodyCellCopyButtonProps }, } = table;
2205
- const { column, row } = cell;
2755
+ const MRT_TableHeadCellFilterContainer = ({ header, table, }) => {
2756
+ const { getState } = table;
2757
+ const { showColumnFilters } = getState();
2758
+ const { column } = header;
2206
2759
  const { columnDef } = column;
2207
- const [copied, setCopied] = useState(false);
2208
- const handleCopy = (event, text) => {
2209
- event.stopPropagation();
2210
- navigator.clipboard.writeText(text);
2211
- setCopied(true);
2212
- setTimeout(() => setCopied(false), 4000);
2213
- };
2214
- const mTableBodyCellCopyButtonProps = muiTableBodyCellCopyButtonProps instanceof Function
2215
- ? muiTableBodyCellCopyButtonProps({ cell, column, row, table })
2216
- : muiTableBodyCellCopyButtonProps;
2217
- const mcTableBodyCellCopyButtonProps = columnDef.muiTableBodyCellCopyButtonProps instanceof Function
2218
- ? columnDef.muiTableBodyCellCopyButtonProps({
2219
- cell,
2220
- column,
2221
- row,
2222
- table,
2223
- })
2224
- : columnDef.muiTableBodyCellCopyButtonProps;
2225
- const buttonProps = Object.assign(Object.assign({}, mTableBodyCellCopyButtonProps), mcTableBodyCellCopyButtonProps);
2226
- 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
2227
- ? buttonProps.sx(theme)
2228
- : 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, {}) }) }) }) }));
2229
2800
  };
2230
2801
 
2231
- const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table }) => {
2232
- const { options: { muiTableBodyRowDragHandleProps }, } = table;
2233
- const { row } = cell;
2234
- const iconButtonProps = muiTableBodyRowDragHandleProps instanceof Function
2235
- ? muiTableBodyRowDragHandleProps({ row, table })
2236
- : 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);
2237
2813
  const handleDragStart = (event) => {
2238
2814
  var _a;
2239
2815
  (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
2240
- event.dataTransfer.setDragImage(rowRef.current, 0, 0);
2241
- table.setDraggingRow(row);
2816
+ setDraggingColumn(column);
2817
+ event.dataTransfer.setDragImage(tableHeadCellRef.current, 0, 0);
2242
2818
  };
2243
2819
  const handleDragEnd = (event) => {
2244
2820
  var _a;
2245
2821
  (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
2246
- table.setDraggingRow(null);
2247
- 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);
2248
2832
  };
2249
2833
  return (jsx(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
2250
2834
  };
2251
2835
 
2252
- const allowedTypes = ['string', 'number'];
2253
- const MRT_TableBodyCellValue = ({ cell, table }) => {
2254
- var _a, _b, _c;
2255
- const { getState, options: { enableFilterMatchHighlighting }, } = table;
2256
- 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;
2257
2874
  const { columnDef } = column;
2258
- const { globalFilter, globalFilterFn } = getState();
2259
- const filterValue = column.getFilterValue();
2260
- let renderedCellValue = cell.getIsAggregated() && columnDef.AggregatedCell
2261
- ? columnDef.AggregatedCell({
2262
- cell,
2263
- column,
2264
- row,
2265
- table,
2266
- })
2267
- : row.getIsGrouped() && !cell.getIsGrouped()
2268
- ? null
2269
- : cell.getIsGrouped() && columnDef.GroupedCell
2270
- ? columnDef.GroupedCell({
2271
- cell,
2272
- column,
2273
- row,
2274
- table,
2275
- })
2276
- : undefined;
2277
- const isGroupedValue = renderedCellValue !== undefined;
2278
- if (!isGroupedValue) {
2279
- renderedCellValue = cell.renderValue();
2280
- }
2281
- if (enableFilterMatchHighlighting &&
2282
- columnDef.enableFilterMatchHighlighting !== false &&
2283
- renderedCellValue &&
2284
- allowedTypes.includes(typeof renderedCellValue) &&
2285
- ((filterValue &&
2286
- allowedTypes.includes(typeof filterValue) &&
2287
- columnDef.filterVariant === 'text') ||
2288
- (globalFilter &&
2289
- allowedTypes.includes(typeof globalFilter) &&
2290
- column.getCanGlobalFilter()))) {
2291
- const chunks = highlightWords === null || highlightWords === void 0 ? void 0 : highlightWords({
2292
- text: renderedCellValue === null || renderedCellValue === void 0 ? void 0 : renderedCellValue.toString(),
2293
- query: ((_a = filterValue !== null && filterValue !== void 0 ? filterValue : globalFilter) !== null && _a !== void 0 ? _a : '').toString(),
2294
- matchExactly: (filterValue ? columnDef._filterFn : globalFilterFn) !== 'fuzzy',
2295
- });
2296
- 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)) {
2297
- 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
2298
- ? {
2299
- backgroundColor: (theme) => theme.palette.mode === 'dark'
2300
- ? darken(theme.palette.warning.dark, 0.25)
2301
- : lighten(theme.palette.warning.light, 0.5),
2302
- borderRadius: '2px',
2303
- color: (theme) => theme.palette.mode === 'dark' ? 'white' : 'black',
2304
- padding: '2px 1px',
2305
- }
2306
- : undefined, children: text }, key)))) !== null && _c !== void 0 ? _c : renderedCellValue }));
2307
- }
2308
- }
2309
- if (columnDef.Cell && !isGroupedValue) {
2310
- renderedCellValue = columnDef.Cell({
2311
- cell,
2312
- renderedCellValue,
2313
- column,
2314
- row,
2315
- table,
2316
- });
2317
- }
2318
- 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
+ } }) }) }));
2319
2896
  };
2320
2897
 
2321
- const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, table, virtualCell, }) => {
2322
- var _a, _b, _c, _d;
2898
+ const MRT_TableHeadCell = ({ header, table, }) => {
2899
+ var _a, _b, _c, _d, _f, _g;
2323
2900
  const theme = useTheme();
2324
- const { getState, options: { editingMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, enableRowNumbers, layoutMode, muiTableBodyCellProps, muiTableBodyCellSkeletonProps, rowNumberMode, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
2325
- const { draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, density, isLoading, showSkeletons, } = getState();
2326
- 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;
2327
2904
  const { columnDef } = column;
2328
2905
  const { columnDefType } = columnDef;
2329
- const mTableCellBodyProps = muiTableBodyCellProps instanceof Function
2330
- ? muiTableBodyCellProps({ cell, column, row, table })
2331
- : muiTableBodyCellProps;
2332
- const mcTableCellBodyProps = columnDef.muiTableBodyCellProps instanceof Function
2333
- ? columnDef.muiTableBodyCellProps({ cell, column, row, table })
2334
- : columnDef.muiTableBodyCellProps;
2335
- const tableCellProps = Object.assign(Object.assign({}, mTableCellBodyProps), mcTableCellBodyProps);
2336
- const skeletonProps = muiTableBodyCellSkeletonProps instanceof Function
2337
- ? muiTableBodyCellSkeletonProps({ cell, column, row, table })
2338
- : muiTableBodyCellSkeletonProps;
2339
- const [skeletonWidth, setSkeletonWidth] = useState(0);
2340
- useEffect(() => setSkeletonWidth(isLoading || showSkeletons
2341
- ? columnDefType === 'display'
2342
- ? column.getSize() / 2
2343
- : Math.round(Math.random() * (column.getSize() - column.getSize() / 3) +
2344
- column.getSize() / 3)
2345
- : 100), []);
2346
- const draggingBorders = useMemo(() => {
2347
- const isDraggingColumn = (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id;
2348
- const isHoveredColumn = (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id;
2349
- const isDraggingRow = (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id;
2350
- const isHoveredRow = (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id;
2351
- const isFirstColumn = getIsFirstColumn(column, table);
2352
- const isLastColumn = getIsLastColumn(column, table);
2353
- const isLastRow = rowIndex === numRows - 1;
2354
- const borderStyle = isDraggingColumn || isDraggingRow
2355
- ? `1px dashed ${theme.palette.text.secondary} !important`
2356
- : isHoveredColumn || isHoveredRow
2357
- ? `2px dashed ${theme.palette.primary.main} !important`
2358
- : undefined;
2359
- return borderStyle
2360
- ? {
2361
- borderLeft: isDraggingColumn ||
2362
- isHoveredColumn ||
2363
- ((isDraggingRow || isHoveredRow) && isFirstColumn)
2364
- ? borderStyle
2365
- : undefined,
2366
- borderRight: isDraggingColumn ||
2367
- isHoveredColumn ||
2368
- ((isDraggingRow || isHoveredRow) && isLastColumn)
2369
- ? borderStyle
2370
- : undefined,
2371
- borderBottom: isDraggingRow || isHoveredRow || isLastRow
2372
- ? borderStyle
2373
- : undefined,
2374
- borderTop: isDraggingRow || isHoveredRow ? borderStyle : undefined,
2375
- }
2376
- : undefined;
2377
- }, [draggingColumn, draggingRow, hoveredColumn, hoveredRow, rowIndex]);
2378
- const isEditable = (enableEditing instanceof Function ? enableEditing(row) : enableEditing) &&
2379
- (columnDef.enableEditing instanceof Function
2380
- ? columnDef.enableEditing(row)
2381
- : columnDef.enableEditing) !== false;
2382
- const isEditing = isEditable &&
2383
- editingMode !== 'modal' &&
2384
- (editingMode === 'table' ||
2385
- (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id ||
2386
- (editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) === cell.id) &&
2387
- !row.getIsGrouped();
2388
- const handleDoubleClick = (event) => {
2389
- var _a;
2390
- (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDoubleClick) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
2391
- if (isEditable && editingMode === 'cell') {
2392
- setEditingCell(cell);
2393
- queueMicrotask(() => {
2394
- var _a;
2395
- const textField = editInputRefs.current[column.id];
2396
- if (textField) {
2397
- textField.focus();
2398
- (_a = textField.select) === null || _a === void 0 ? void 0 : _a.call(textField);
2399
- }
2400
- });
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,
2401
2942
  }
2402
- };
2403
- const handleDragEnter = (e) => {
2404
- var _a;
2405
- (_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) => {
2406
2945
  if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
2407
2946
  setHoveredColumn(null);
2408
2947
  }
2409
- if (enableColumnOrdering && draggingColumn) {
2948
+ if (enableColumnOrdering && draggingColumn && columnDefType !== 'group') {
2410
2949
  setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
2411
2950
  }
2412
2951
  };
2413
- 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) => {
2414
2960
  if (node) {
2415
- measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
2961
+ tableHeadCellRefs.current[column.id] = node;
2416
2962
  }
2417
- } }, 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'
2418
- ? columnDefType === 'display'
2419
- ? '0 0.5rem'
2420
- : '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'
2421
2965
  : density === 'comfortable'
2422
2966
  ? columnDefType === 'display'
2423
- ? '0.5rem 0.75rem'
2967
+ ? '0.75rem'
2424
2968
  : '1rem'
2425
2969
  : columnDefType === 'display'
2426
2970
  ? '1rem 1.25rem'
2427
- : '1.5rem', pl: column.id === 'mrt-row-expand'
2428
- ? `${row.depth +
2429
- (density === 'compact'
2430
- ? 0.5
2431
- : density === 'comfortable'
2432
- ? 0.75
2433
- : 1.25)}rem`
2434
- : 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': {
2435
- outline: ['table', 'cell'].includes(editingMode !== null && editingMode !== void 0 ? editingMode : '')
2436
- ? `1px solid ${theme.palette.text.secondary}`
2437
- : undefined,
2438
- outlineOffset: '-1px',
2439
- textOverflow: 'clip',
2440
- } }, 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({
2441
2984
  column,
2985
+ header,
2442
2986
  table,
2443
- theme,
2444
2987
  tableCellProps,
2445
- })), 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 &&
2446
- rowNumberMode === 'static' &&
2447
- column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (jsx(MRT_TableBodyRowGrabHandle, { cell: cell, rowRef: rowRef, table: table })) : columnDefType === 'display' &&
2448
- (column.id === 'mrt-row-select' ||
2449
- column.id === 'mrt-row-expand' ||
2450
- !row.getIsGrouped()) ? ((_c = columnDef.Cell) === null || _c === void 0 ? void 0 : _c.call(columnDef, {
2451
- cell,
2452
- renderedCellValue: cell.renderValue(),
2453
- column,
2454
- row,
2455
- table,
2456
- })) : isEditing ? (jsx(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
2457
- 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, ")"] }))] }) })));
2458
- };
2459
- const Memo_MRT_TableBodyCell = memo(MRT_TableBodyCell, (prev, next) => next.cell === prev.cell);
2460
-
2461
- const MRT_TableDetailPanel = ({ parentRowRef, row, rowIndex, table, virtualRow, }) => {
2462
- const { getVisibleLeafColumns, getState, options: { layoutMode, muiTableBodyRowProps, muiTableDetailPanelProps, renderDetailPanel, }, } = table;
2463
- const { isLoading } = getState();
2464
- const tableRowProps = muiTableBodyRowProps instanceof Function
2465
- ? muiTableBodyRowProps({
2466
- isDetailPanel: true,
2467
- row,
2468
- staticRowIndex: rowIndex,
2469
- table,
2470
- })
2471
- : muiTableBodyRowProps;
2472
- const tableCellProps = muiTableDetailPanelProps instanceof Function
2473
- ? muiTableDetailPanelProps({ row, table })
2474
- : muiTableDetailPanelProps;
2475
- return (jsx(TableRow, Object.assign({ className: "Mui-TableBodyCell-DetailPanel" }, tableRowProps, { sx: (theme) => {
2476
- var _a, _b;
2477
- return (Object.assign({ display: layoutMode === 'grid' ? 'flex' : 'table-row', position: virtualRow ? 'absolute' : undefined, top: virtualRow
2478
- ? `${(_b = (_a = parentRowRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.height}px`
2479
- : undefined, transform: virtualRow
2480
- ? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
2481
- : undefined, width: '100%', zIndex: virtualRow ? 2 : undefined }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
2482
- ? tableRowProps.sx(theme)
2483
- : tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx)));
2484
- }, children: jsx(TableCell, Object.assign({ className: "Mui-TableBodyCell-DetailPanel", colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ backgroundColor: virtualRow
2485
- ? lighten(theme.palette.background.default, 0.06)
2486
- : 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
2487
- ? tableCellProps.sx(theme)
2488
- : 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 }) })) })) })));
2489
- };
2490
-
2491
- const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, row, rowIndex, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, virtualRow, }) => {
2492
- const { getState, options: { enableRowOrdering, layoutMode, memoMode, muiTableBodyRowProps, renderDetailPanel, }, setHoveredRow, } = table;
2493
- const { draggingColumn, draggingRow, editingCell, editingRow, hoveredRow } = getState();
2494
- const tableRowProps = muiTableBodyRowProps instanceof Function
2495
- ? muiTableBodyRowProps({ row, staticRowIndex: rowIndex, table })
2496
- : muiTableBodyRowProps;
2497
- const handleDragEnter = (_e) => {
2498
- if (enableRowOrdering && draggingRow) {
2499
- setHoveredRow(row);
2500
- }
2501
- };
2502
- const rowRef = useRef(null);
2503
- 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) => {
2504
- if (node) {
2505
- rowRef.current = node;
2506
- measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
2507
- }
2508
- } }, 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': {
2509
- backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false
2510
- ? row.getIsSelected()
2511
- ? `${alpha(theme.palette.primary.main, 0.2)}`
2512
- : theme.palette.mode === 'dark'
2513
- ? `${lighten(theme.palette.background.default, 0.12)}`
2514
- : `${darken(theme.palette.background.default, 0.05)}`
2515
- : undefined,
2516
- } }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
2517
- ? tableRowProps.sx(theme)
2518
- : tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))), style: Object.assign({ transform: virtualRow
2519
- ? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
2520
- : 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) => {
2521
- const cell = columnVirtualizer
2522
- ? row.getVisibleCells()[cellOrVirtualCell.index]
2523
- : cellOrVirtualCell;
2524
- const props = {
2525
- cell,
2526
- measureElement: columnVirtualizer === null || columnVirtualizer === void 0 ? void 0 : columnVirtualizer.measureElement,
2527
- numRows,
2528
- rowIndex,
2529
- rowRef,
2530
- table,
2531
- virtualCell: columnVirtualizer
2532
- ? cellOrVirtualCell
2533
- : undefined,
2534
- };
2535
- return memoMode === 'cells' &&
2536
- cell.column.columnDef.columnDefType === 'data' &&
2537
- !draggingColumn &&
2538
- !draggingRow &&
2539
- (editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) !== cell.id &&
2540
- (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));
2541
- }), 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 }))] })));
2542
3022
  };
2543
- const Memo_MRT_TableBodyRow = memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row && prev.rowIndex === next.rowIndex);
2544
3023
 
2545
- const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
2546
- var _a, _b, _c, _d;
2547
- 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;
2548
- const { columnFilters, density, expanded, globalFilter, globalFilterFn, pagination, sorting, } = getState();
2549
- const tableBodyProps = muiTableBodyProps instanceof Function
2550
- ? muiTableBodyProps({ table })
2551
- : muiTableBodyProps;
2552
- const vProps_old = virtualizerProps instanceof Function
2553
- ? virtualizerProps({ table })
2554
- : virtualizerProps;
2555
- const vProps = rowVirtualizerProps instanceof Function
2556
- ? rowVirtualizerProps({ table })
2557
- : rowVirtualizerProps;
2558
- const shouldRankResults = useMemo(() => !manualExpanding &&
2559
- !manualFiltering &&
2560
- !manualGrouping &&
2561
- !manualSorting &&
2562
- enableGlobalFilterRankedResults &&
2563
- globalFilter &&
2564
- globalFilterFn === 'fuzzy' &&
2565
- expanded !== true &&
2566
- !Object.values(sorting).some(Boolean) &&
2567
- !Object.values(expanded).some(Boolean), [
2568
- enableGlobalFilterRankedResults,
2569
- expanded,
2570
- globalFilter,
2571
- manualExpanding,
2572
- manualFiltering,
2573
- manualGrouping,
2574
- manualSorting,
2575
- sorting,
2576
- ]);
2577
- const rows = useMemo(() => {
2578
- if (!shouldRankResults)
2579
- return getRowModel().rows;
2580
- const rankedRows = getPrePaginationRowModel().rows.sort((a, b) => rankGlobalFuzzy(a, b));
2581
- if (enablePagination && !manualPagination) {
2582
- const start = pagination.pageIndex * pagination.pageSize;
2583
- return rankedRows.slice(start, start + pagination.pageSize);
2584
- }
2585
- return rankedRows;
2586
- }, [
2587
- shouldRankResults,
2588
- shouldRankResults ? getPrePaginationRowModel().rows : getRowModel().rows,
2589
- pagination.pageIndex,
2590
- pagination.pageSize,
2591
- ]);
2592
- const rowVirtualizer = enableRowVirtualization
2593
- ? useVirtualizer(Object.assign(Object.assign({ count: rows.length, estimateSize: () => density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73, getScrollElement: () => tableContainerRef.current, measureElement: typeof window !== 'undefined' &&
2594
- navigator.userAgent.indexOf('Firefox') === -1
2595
- ? (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height
2596
- : undefined, overscan: 4 }, vProps_old), vProps))
2597
- : undefined;
2598
- if (rowVirtualizerInstanceRef && rowVirtualizer) {
2599
- rowVirtualizerInstanceRef.current = rowVirtualizer;
2600
- }
2601
- //deprecated
2602
- if (virtualizerInstanceRef && rowVirtualizer) {
2603
- virtualizerInstanceRef.current = rowVirtualizer;
2604
- }
2605
- const virtualRows = rowVirtualizer
2606
- ? rowVirtualizer.getVirtualItems()
2607
- : undefined;
2608
- return (jsx(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', height: rowVirtualizer
2609
- ? `${rowVirtualizer.getTotalSize()}px`
2610
- : 'inherit', minHeight: !rows.length ? '100px' : undefined, position: 'relative' }, ((tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx) instanceof Function
2611
- ? tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx(theme)
2612
- : 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: {
2613
- display: layoutMode === 'grid' ? 'grid' : 'table-cell',
2614
- }, children: (_b = renderEmptyRowsFallback === null || renderEmptyRowsFallback === void 0 ? void 0 : renderEmptyRowsFallback({ table })) !== null && _b !== void 0 ? _b : (jsx(Typography, { sx: {
2615
- color: 'text.secondary',
2616
- fontStyle: 'italic',
2617
- maxWidth: `min(100vw, ${(_d = (_c = tablePaperRef.current) === null || _c === void 0 ? void 0 : _c.clientWidth) !== null && _d !== void 0 ? _d : 360}px)`,
2618
- py: '2rem',
2619
- textAlign: 'center',
2620
- width: '100%',
2621
- }, children: globalFilter || columnFilters.length
2622
- ? localization.noResultsFound
2623
- : localization.noRecordsToDisplay })) }) })) : (jsx(Fragment, { children: (virtualRows !== null && virtualRows !== void 0 ? virtualRows : rows).map((rowOrVirtualRow, rowIndex) => {
2624
- const row = rowVirtualizer
2625
- ? rows[rowOrVirtualRow.index]
2626
- : rowOrVirtualRow;
2627
- const props = {
2628
- columnVirtualizer,
2629
- measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
2630
- numRows: rows.length,
2631
- row,
2632
- rowIndex: rowVirtualizer ? rowOrVirtualRow.index : rowIndex,
2633
- table,
2634
- virtualColumns,
2635
- virtualPaddingLeft,
2636
- virtualPaddingRight,
2637
- virtualRow: rowVirtualizer
2638
- ? rowOrVirtualRow
2639
- : undefined,
2640
- };
2641
- return memoMode === 'rows' ? (jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
2642
- }) }))) })));
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))) })));
2643
3049
  };
2644
- const Memo_MRT_TableBody = memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
2645
3050
 
2646
- const MRT_TableFooterCell = ({ footer, table }) => {
3051
+ const MRT_TableFooterCell = ({ footer, table, }) => {
2647
3052
  var _a, _b, _c;
2648
3053
  const { getState, options: { layoutMode, muiTableFooterCellProps }, } = table;
2649
3054
  const { density } = getState();
@@ -2714,16 +3119,16 @@ const MRT_TableFooter = ({ table, virtualColumns, virtualPaddingLeft, virtualPad
2714
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))) })));
2715
3120
  };
2716
3121
 
2717
- const MRT_Table = ({ table }) => {
3122
+ const MRT_Table = ({ table, }) => {
2718
3123
  var _a, _b, _c, _d;
2719
- 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;
2720
3125
  const { columnPinning, columnSizing, columnSizingInfo, columnVisibility, isFullScreen, } = getState();
2721
3126
  const tableProps = muiTableProps instanceof Function
2722
3127
  ? muiTableProps({ table })
2723
3128
  : muiTableProps;
2724
- const vProps = columnVirtualizerProps instanceof Function
2725
- ? columnVirtualizerProps({ table })
2726
- : columnVirtualizerProps;
3129
+ const vProps = columnVirtualizerOptions instanceof Function
3130
+ ? columnVirtualizerOptions({ table })
3131
+ : columnVirtualizerOptions;
2727
3132
  const columnSizeVars = useMemo(() => {
2728
3133
  const headers = getFlatHeaders();
2729
3134
  const colSizes = {};
@@ -2745,14 +3150,14 @@ const MRT_Table = ({ table }) => {
2745
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 : [];
2746
3151
  return columnsWidths.reduce((a, b) => a + b, 0) / columnsWidths.length;
2747
3152
  }, [table.getRowModel().rows, columnPinning, columnVisibility]);
2748
- const [leftPinnedIndexes, rightPinnedIndexes] = useMemo(() => enableColumnVirtualization && enablePinning
3153
+ const [leftPinnedIndexes, rightPinnedIndexes] = useMemo(() => enableColumnVirtualization && enableColumnPinning
2749
3154
  ? [
2750
3155
  table.getLeftLeafColumns().map((c) => c.getPinnedIndex()),
2751
3156
  table
2752
3157
  .getRightLeafColumns()
2753
3158
  .map((c) => table.getVisibleLeafColumns().length - c.getPinnedIndex() - 1),
2754
3159
  ]
2755
- : [[], []], [columnPinning, enableColumnVirtualization, enablePinning]);
3160
+ : [[], []], [columnPinning, enableColumnVirtualization, enableColumnPinning]);
2756
3161
  const columnVirtualizer = enableColumnVirtualization
2757
3162
  ? useVirtualizer(Object.assign({ count: table.getVisibleLeafColumns().length, estimateSize: () => averageColumnWidth, getScrollElement: () => tableContainerRef.current, horizontal: true, overscan: 3, rangeExtractor: useCallback((range) => [
2758
3163
  ...new Set([
@@ -2782,15 +3187,60 @@ const MRT_Table = ({ table }) => {
2782
3187
  virtualPaddingLeft,
2783
3188
  virtualPaddingRight,
2784
3189
  };
2785
- 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
2786
- ? tableProps.sx(theme)
2787
- : 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" }) })] })) })));
2788
3238
  };
2789
3239
 
2790
3240
  const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
2791
- const MRT_TableContainer = ({ table }) => {
2792
- const { getState, options: { enableStickyHeader, muiTableContainerProps }, refs: { tableContainerRef, bottomToolbarRef, topToolbarRef }, } = table;
2793
- 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();
2794
3244
  const [totalToolbarHeight, setTotalToolbarHeight] = useState(0);
2795
3245
  const tableContainerProps = muiTableContainerProps instanceof Function
2796
3246
  ? muiTableContainerProps({ table })
@@ -2805,7 +3255,9 @@ const MRT_TableContainer = ({ table }) => {
2805
3255
  : 0;
2806
3256
  setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
2807
3257
  });
2808
- 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) => {
2809
3261
  if (node) {
2810
3262
  tableContainerRef.current = node;
2811
3263
  if (tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) {
@@ -2819,10 +3271,10 @@ const MRT_TableContainer = ({ table }) => {
2819
3271
  ? tableContainerProps.sx(theme)
2820
3272
  : tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx))), style: Object.assign({ maxHeight: isFullScreen
2821
3273
  ? `calc(100vh - ${totalToolbarHeight}px)`
2822
- : 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 }))] })));
2823
3275
  };
2824
3276
 
2825
- const MRT_TablePaper = ({ table }) => {
3277
+ const MRT_TablePaper = ({ table, }) => {
2826
3278
  const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
2827
3279
  const { isFullScreen } = getState();
2828
3280
  const tablePaperProps = muiTablePaperProps instanceof Function
@@ -2834,16 +3286,22 @@ const MRT_TablePaper = ({ table }) => {
2834
3286
  //@ts-ignore
2835
3287
  tablePaperProps.ref.current = ref;
2836
3288
  }
2837
- }, 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
2838
3290
  ? tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx(theme)
2839
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
2840
3292
  ? {
3293
+ bottom: 0,
2841
3294
  height: '100vh',
3295
+ left: 0,
2842
3296
  margin: 0,
2843
3297
  maxHeight: '100vh',
2844
3298
  maxWidth: '100vw',
2845
3299
  padding: 0,
3300
+ position: 'fixed',
3301
+ right: 0,
3302
+ top: 0,
2846
3303
  width: '100vw',
3304
+ zIndex: 10,
2847
3305
  }
2848
3306
  : {})), children: [enableTopToolbar &&
2849
3307
  (renderTopToolbar instanceof Function
@@ -2854,237 +3312,17 @@ const MRT_TablePaper = ({ table }) => {
2854
3312
  : renderBottomToolbar !== null && renderBottomToolbar !== void 0 ? renderBottomToolbar : jsx(MRT_BottomToolbar, { table: table }))] })));
2855
3313
  };
2856
3314
 
2857
- const MRT_EditRowModal = ({ open, row, table, }) => {
2858
- const { options: { localization }, } = table;
2859
- 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: {
2860
- gap: '1.5rem',
2861
- minWidth: { xs: '300px', sm: '360px', md: '400px' },
2862
- pt: '1rem',
2863
- width: '100%',
2864
- }, children: row
2865
- .getAllCells()
2866
- .filter((cell) => cell.column.columnDef.columnDefType === 'data')
2867
- .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" }) })] }));
2868
- };
2869
-
2870
- const MRT_TableRoot = (props) => {
2871
- 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;
2872
- const bottomToolbarRef = useRef(null);
2873
- const editInputRefs = useRef({});
2874
- const filterInputRefs = useRef({});
2875
- const searchInputRef = useRef(null);
2876
- const tableContainerRef = useRef(null);
2877
- const tableHeadCellRefs = useRef({});
2878
- const tablePaperRef = useRef(null);
2879
- const topToolbarRef = useRef(null);
2880
- const initialState = useMemo(() => {
2881
- var _a, _b, _c;
2882
- const initState = (_a = props.initialState) !== null && _a !== void 0 ? _a : {};
2883
- initState.columnOrder =
2884
- (_b = initState.columnOrder) !== null && _b !== void 0 ? _b : getDefaultColumnOrderIds(props);
2885
- initState.globalFilterFn = (_c = props.globalFilterFn) !== null && _c !== void 0 ? _c : 'fuzzy';
2886
- return initState;
2887
- }, []);
2888
- const [columnFilterFns, setColumnFilterFns] = useState(() => Object.assign({}, ...getAllLeafColumnDefs(props.columns).map((col) => {
2889
- var _a, _b, _c, _d;
2890
- return ({
2891
- [getColumnId(col)]: col.filterFn instanceof Function
2892
- ? (_a = col.filterFn.name) !== null && _a !== void 0 ? _a : 'custom'
2893
- : (_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),
2894
- });
2895
- })));
2896
- const [columnOrder, setColumnOrder] = useState((_a = initialState.columnOrder) !== null && _a !== void 0 ? _a : []);
2897
- const [density, setDensity] = useState((_b = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _b !== void 0 ? _b : 'comfortable');
2898
- const [draggingColumn, setDraggingColumn] = useState((_c = initialState.draggingColumn) !== null && _c !== void 0 ? _c : null);
2899
- const [draggingRow, setDraggingRow] = useState((_d = initialState.draggingRow) !== null && _d !== void 0 ? _d : null);
2900
- const [editingCell, setEditingCell] = useState((_e = initialState.editingCell) !== null && _e !== void 0 ? _e : null);
2901
- const [editingRow, setEditingRow] = useState((_f = initialState.editingRow) !== null && _f !== void 0 ? _f : null);
2902
- const [globalFilterFn, setGlobalFilterFn] = useState((_g = initialState.globalFilterFn) !== null && _g !== void 0 ? _g : 'fuzzy');
2903
- const [grouping, setGrouping] = useState((_h = initialState.grouping) !== null && _h !== void 0 ? _h : []);
2904
- const [hoveredColumn, setHoveredColumn] = useState((_j = initialState.hoveredColumn) !== null && _j !== void 0 ? _j : null);
2905
- const [hoveredRow, setHoveredRow] = useState((_k = initialState.hoveredRow) !== null && _k !== void 0 ? _k : null);
2906
- const [isFullScreen, setIsFullScreen] = useState((_l = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _l !== void 0 ? _l : false);
2907
- const [showAlertBanner, setShowAlertBanner] = useState((_o = (_m = props.initialState) === null || _m === void 0 ? void 0 : _m.showAlertBanner) !== null && _o !== void 0 ? _o : false);
2908
- const [showColumnFilters, setShowColumnFilters] = useState((_p = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _p !== void 0 ? _p : false);
2909
- const [showGlobalFilter, setShowGlobalFilter] = useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _q !== void 0 ? _q : false);
2910
- const [showToolbarDropZone, setShowToolbarDropZone] = useState((_r = initialState === null || initialState === void 0 ? void 0 : initialState.showToolbarDropZone) !== null && _r !== void 0 ? _r : false);
2911
- const displayColumns = useMemo(() => {
2912
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
2913
- return [
2914
- ((_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' }),
2915
- ((_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' }),
2916
- ((_h = (_g = props.state) === null || _g === void 0 ? void 0 : _g.columnOrder) !== null && _h !== void 0 ? _h : columnOrder).includes('mrt-row-expand') &&
2917
- 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
2918
- ? () => jsx(MRT_ExpandAllButton, { table: table })
2919
- : 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' }),
2920
- ((_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
2921
- ? () => jsx(MRT_SelectCheckbox, { selectAll: true, table: table })
2922
- : 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' }),
2923
- ((_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' }),
2924
- ].filter(Boolean);
2925
- }, [
2926
- columnOrder,
2927
- grouping,
2928
- props.displayColumnDefOptions,
2929
- props.editingMode,
2930
- props.enableColumnDragging,
2931
- props.enableColumnFilterModes,
2932
- props.enableColumnOrdering,
2933
- props.enableEditing,
2934
- props.enableExpandAll,
2935
- props.enableExpanding,
2936
- props.enableGrouping,
2937
- props.enableRowActions,
2938
- props.enableRowDragging,
2939
- props.enableRowNumbers,
2940
- props.enableRowOrdering,
2941
- props.enableRowSelection,
2942
- props.enableSelectAll,
2943
- props.localization,
2944
- props.positionActionsColumn,
2945
- props.renderDetailPanel,
2946
- props.renderRowActionMenuItems,
2947
- props.renderRowActions,
2948
- (_s = props.state) === null || _s === void 0 ? void 0 : _s.columnOrder,
2949
- (_t = props.state) === null || _t === void 0 ? void 0 : _t.grouping,
2950
- ]);
2951
- const columnDefs = useMemo(() => {
2952
- var _a, _b, _c;
2953
- return prepareColumns({
2954
- aggregationFns: props.aggregationFns,
2955
- columnDefs: [...displayColumns, ...props.columns],
2956
- columnFilterFns: (_b = (_a = props.state) === null || _a === void 0 ? void 0 : _a.columnFilterFns) !== null && _b !== void 0 ? _b : columnFilterFns,
2957
- defaultDisplayColumn: (_c = props.defaultDisplayColumn) !== null && _c !== void 0 ? _c : {},
2958
- filterFns: props.filterFns,
2959
- sortingFns: props.sortingFns,
2960
- });
2961
- }, [
2962
- columnFilterFns,
2963
- displayColumns,
2964
- props.columns,
2965
- (_u = props.state) === null || _u === void 0 ? void 0 : _u.columnFilterFns,
2966
- ]);
2967
- const data = useMemo(() => {
2968
- var _a, _b, _c, _d, _e;
2969
- return (((_a = props.state) === null || _a === void 0 ? void 0 : _a.isLoading) || ((_b = props.state) === null || _b === void 0 ? void 0 : _b.showSkeletons)) &&
2970
- !props.data.length
2971
- ? [
2972
- ...Array(((_d = (_c = props.state) === null || _c === void 0 ? void 0 : _c.pagination) === null || _d === void 0 ? void 0 : _d.pageSize) ||
2973
- ((_e = initialState === null || initialState === void 0 ? void 0 : initialState.pagination) === null || _e === void 0 ? void 0 : _e.pageSize) ||
2974
- 10).fill(null),
2975
- ].map(() => Object.assign({}, ...getAllLeafColumnDefs(props.columns).map((col) => ({
2976
- [getColumnId(col)]: null,
2977
- }))))
2978
- : props.data;
2979
- }, [props.data, (_v = props.state) === null || _v === void 0 ? void 0 : _v.isLoading, (_w = props.state) === null || _w === void 0 ? void 0 : _w.showSkeletons]);
2980
- //@ts-ignore
2981
- const table = Object.assign(Object.assign({}, useReactTable(Object.assign(Object.assign({ getCoreRowModel: getCoreRowModel(), getExpandedRowModel: props.enableExpanding || props.enableGrouping
2982
- ? getExpandedRowModel()
2983
- : undefined, getFacetedMinMaxValues: props.enableFacetedValues
2984
- ? getFacetedMinMaxValues()
2985
- : undefined, getFacetedRowModel: props.enableFacetedValues
2986
- ? getFacetedRowModel()
2987
- : undefined, getFacetedUniqueValues: props.enableFacetedValues
2988
- ? getFacetedUniqueValues()
2989
- : undefined, getFilteredRowModel: props.enableColumnFilters ||
2990
- props.enableGlobalFilter ||
2991
- props.enableFilters
2992
- ? getFilteredRowModel()
2993
- : undefined, getGroupedRowModel: props.enableGrouping
2994
- ? getGroupedRowModel()
2995
- : undefined, getPaginationRowModel: props.enablePagination
2996
- ? getPaginationRowModel()
2997
- : undefined, getSortedRowModel: props.enableSorting ? getSortedRowModel() : undefined, onColumnOrderChange: setColumnOrder, onGroupingChange: setGrouping, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows }, props), {
2998
- //@ts-ignore
2999
- 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,
3000
- columnOrder,
3001
- density,
3002
- draggingColumn,
3003
- draggingRow,
3004
- editingCell,
3005
- editingRow,
3006
- globalFilterFn,
3007
- grouping,
3008
- hoveredColumn,
3009
- hoveredRow,
3010
- isFullScreen,
3011
- showAlertBanner,
3012
- showColumnFilters,
3013
- showGlobalFilter,
3014
- showToolbarDropZone }, props.state) }))), { refs: {
3015
- bottomToolbarRef,
3016
- editInputRefs,
3017
- filterInputRefs,
3018
- searchInputRef,
3019
- tableContainerRef,
3020
- tableHeadCellRefs,
3021
- tablePaperRef,
3022
- topToolbarRef,
3023
- }, 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 });
3024
- if (props.tableFeatures) {
3025
- props.tableFeatures.forEach((feature) => {
3026
- Object.assign(table, feature(table));
3027
- });
3028
- }
3029
- if (props.tableInstanceRef) {
3030
- props.tableInstanceRef.current = table;
3031
- }
3032
- const initialBodyHeight = useRef();
3033
- useEffect(() => {
3034
- if (typeof window !== 'undefined') {
3035
- initialBodyHeight.current = document.body.style.height;
3036
- }
3037
- }, []);
3038
- useEffect(() => {
3039
- if (typeof window !== 'undefined') {
3040
- if (table.getState().isFullScreen) {
3041
- document.body.style.height = '100vh';
3042
- }
3043
- else {
3044
- document.body.style.height = initialBodyHeight.current;
3045
- }
3046
- }
3047
- }, [table.getState().isFullScreen]);
3048
- //if page index is out of bounds, set it to the last page
3049
- useEffect(() => {
3050
- var _a;
3051
- const { pageIndex, pageSize } = table.getState().pagination;
3052
- const totalRowCount = (_a = props.rowCount) !== null && _a !== void 0 ? _a : table.getPrePaginationRowModel().rows.length;
3053
- const firstVisibleRowIndex = pageIndex * pageSize;
3054
- if (firstVisibleRowIndex > totalRowCount) {
3055
- table.setPageIndex(Math.floor(totalRowCount / pageSize));
3056
- }
3057
- }, [props.rowCount, table.getPrePaginationRowModel().rows.length]);
3058
- 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 }))] }));
3059
- };
3060
-
3061
- const MaterialReactTable = (_a) => {
3062
- var _b;
3063
- 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"]);
3064
- const _icons = useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
3065
- const _localization = useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
3066
- const _aggregationFns = useMemo(() => (Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns)), []);
3067
- const _filterFns = useMemo(() => (Object.assign(Object.assign({}, MRT_FilterFns), filterFns)), []);
3068
- const _sortingFns = useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
3069
- const _defaultColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), [defaultColumn]);
3070
- const _defaultDisplayColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), [defaultDisplayColumn]);
3071
- if (rest.enableRowVirtualization || rest.enableColumnVirtualization) {
3072
- layoutMode = 'grid';
3073
- }
3074
- if (rest.enableRowVirtualization) {
3075
- enableStickyHeader = true;
3315
+ const isTableInstanceProp = (props) => props.table !== undefined;
3316
+ const MaterialReactTable = (props) => {
3317
+ let table;
3318
+ if (isTableInstanceProp(props)) {
3319
+ table = props.table;
3076
3320
  }
3077
- if (enablePagination === false && manualPagination === undefined) {
3078
- manualPagination = true;
3079
- }
3080
- if (!((_b = rest.data) === null || _b === void 0 ? void 0 : _b.length)) {
3081
- manualFiltering = true;
3082
- manualGrouping = true;
3083
- manualPagination = true;
3084
- manualSorting = true;
3321
+ else {
3322
+ table = useMaterialReactTable(props);
3085
3323
  }
3086
- 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 });
3087
3325
  };
3088
3326
 
3089
- 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 };
3090
3328
  //# sourceMappingURL=material-react-table.esm.js.map