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
package/dist/cjs/index.js CHANGED
@@ -35,23 +35,29 @@ var SearchOffIcon = require('@mui/icons-material/SearchOff');
35
35
  var SortIcon = require('@mui/icons-material/Sort');
36
36
  var ViewColumnIcon = require('@mui/icons-material/ViewColumn');
37
37
  var VisibilityOffIcon = require('@mui/icons-material/VisibilityOff');
38
- var Box = require('@mui/material/Box');
39
- var Dialog = require('@mui/material/Dialog');
40
- var Grow = require('@mui/material/Grow');
41
- var IconButton = require('@mui/material/IconButton');
38
+ var reactVirtual = require('@tanstack/react-virtual');
39
+ var TableBody = require('@mui/material/TableBody');
40
+ var Typography = require('@mui/material/Typography');
41
+ var TableRow = require('@mui/material/TableRow');
42
+ var Skeleton = require('@mui/material/Skeleton');
43
+ var TableCell = require('@mui/material/TableCell');
44
+ var TextField = require('@mui/material/TextField');
45
+ var MenuItem = require('@mui/material/MenuItem');
46
+ var Button = require('@mui/material/Button');
42
47
  var Tooltip = require('@mui/material/Tooltip');
48
+ var IconButton = require('@mui/material/IconButton');
49
+ var Box = require('@mui/material/Box');
50
+ var highlightWords = require('highlight-words');
51
+ var Collapse = require('@mui/material/Collapse');
43
52
  var ListItemIcon = require('@mui/material/ListItemIcon');
44
53
  var Menu = require('@mui/material/Menu');
45
- var MenuItem = require('@mui/material/MenuItem');
46
- var Button = require('@mui/material/Button');
54
+ var CircularProgress = require('@mui/material/CircularProgress');
47
55
  var Checkbox = require('@mui/material/Checkbox');
48
56
  var Radio = require('@mui/material/Radio');
49
57
  var Paper = require('@mui/material/Paper');
50
58
  var Toolbar = require('@mui/material/Toolbar');
51
59
  var useMediaQuery = require('@mui/material/useMediaQuery');
52
- var Collapse = require('@mui/material/Collapse');
53
60
  var InputAdornment = require('@mui/material/InputAdornment');
54
- var TextField = require('@mui/material/TextField');
55
61
  var utils = require('@mui/material/utils');
56
62
  var LinearProgress = require('@mui/material/LinearProgress');
57
63
  var TablePagination = require('@mui/material/TablePagination');
@@ -61,23 +67,18 @@ var Chip = require('@mui/material/Chip');
61
67
  var Divider = require('@mui/material/Divider');
62
68
  var FormControlLabel = require('@mui/material/FormControlLabel');
63
69
  var Switch = require('@mui/material/Switch');
64
- var Typography = require('@mui/material/Typography');
65
70
  var Fade = require('@mui/material/Fade');
66
71
  var TableContainer = require('@mui/material/TableContainer');
67
- var reactVirtual = require('@tanstack/react-virtual');
68
72
  var Table = require('@mui/material/Table');
69
73
  var TableHead = require('@mui/material/TableHead');
70
- var TableRow = require('@mui/material/TableRow');
71
- var TableCell = require('@mui/material/TableCell');
72
74
  var Slider = require('@mui/material/Slider');
73
75
  var Stack = require('@mui/material/Stack');
74
76
  var FormHelperText = require('@mui/material/FormHelperText');
77
+ var Grow = require('@mui/material/Grow');
75
78
  var Badge = require('@mui/material/Badge');
76
79
  var TableSortLabel = require('@mui/material/TableSortLabel');
77
- var TableBody = require('@mui/material/TableBody');
78
- var Skeleton = require('@mui/material/Skeleton');
79
- var highlightWords = require('highlight-words');
80
80
  var TableFooter = require('@mui/material/TableFooter');
81
+ var Dialog = require('@mui/material/Dialog');
81
82
  var DialogActions = require('@mui/material/DialogActions');
82
83
  var DialogContent = require('@mui/material/DialogContent');
83
84
  var DialogTitle = require('@mui/material/DialogTitle');
@@ -112,23 +113,28 @@ var SearchOffIcon__default = /*#__PURE__*/_interopDefaultLegacy(SearchOffIcon);
112
113
  var SortIcon__default = /*#__PURE__*/_interopDefaultLegacy(SortIcon);
113
114
  var ViewColumnIcon__default = /*#__PURE__*/_interopDefaultLegacy(ViewColumnIcon);
114
115
  var VisibilityOffIcon__default = /*#__PURE__*/_interopDefaultLegacy(VisibilityOffIcon);
115
- var Box__default = /*#__PURE__*/_interopDefaultLegacy(Box);
116
- var Dialog__default = /*#__PURE__*/_interopDefaultLegacy(Dialog);
117
- var Grow__default = /*#__PURE__*/_interopDefaultLegacy(Grow);
118
- var IconButton__default = /*#__PURE__*/_interopDefaultLegacy(IconButton);
116
+ var TableBody__default = /*#__PURE__*/_interopDefaultLegacy(TableBody);
117
+ var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
118
+ var TableRow__default = /*#__PURE__*/_interopDefaultLegacy(TableRow);
119
+ var Skeleton__default = /*#__PURE__*/_interopDefaultLegacy(Skeleton);
120
+ var TableCell__default = /*#__PURE__*/_interopDefaultLegacy(TableCell);
121
+ var TextField__default = /*#__PURE__*/_interopDefaultLegacy(TextField);
122
+ var MenuItem__default = /*#__PURE__*/_interopDefaultLegacy(MenuItem);
123
+ var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
119
124
  var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
125
+ var IconButton__default = /*#__PURE__*/_interopDefaultLegacy(IconButton);
126
+ var Box__default = /*#__PURE__*/_interopDefaultLegacy(Box);
127
+ var highlightWords__default = /*#__PURE__*/_interopDefaultLegacy(highlightWords);
128
+ var Collapse__default = /*#__PURE__*/_interopDefaultLegacy(Collapse);
120
129
  var ListItemIcon__default = /*#__PURE__*/_interopDefaultLegacy(ListItemIcon);
121
130
  var Menu__default = /*#__PURE__*/_interopDefaultLegacy(Menu);
122
- var MenuItem__default = /*#__PURE__*/_interopDefaultLegacy(MenuItem);
123
- var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
131
+ var CircularProgress__default = /*#__PURE__*/_interopDefaultLegacy(CircularProgress);
124
132
  var Checkbox__default = /*#__PURE__*/_interopDefaultLegacy(Checkbox);
125
133
  var Radio__default = /*#__PURE__*/_interopDefaultLegacy(Radio);
126
134
  var Paper__default = /*#__PURE__*/_interopDefaultLegacy(Paper);
127
135
  var Toolbar__default = /*#__PURE__*/_interopDefaultLegacy(Toolbar);
128
136
  var useMediaQuery__default = /*#__PURE__*/_interopDefaultLegacy(useMediaQuery);
129
- var Collapse__default = /*#__PURE__*/_interopDefaultLegacy(Collapse);
130
137
  var InputAdornment__default = /*#__PURE__*/_interopDefaultLegacy(InputAdornment);
131
- var TextField__default = /*#__PURE__*/_interopDefaultLegacy(TextField);
132
138
  var LinearProgress__default = /*#__PURE__*/_interopDefaultLegacy(LinearProgress);
133
139
  var TablePagination__default = /*#__PURE__*/_interopDefaultLegacy(TablePagination);
134
140
  var Alert__default = /*#__PURE__*/_interopDefaultLegacy(Alert);
@@ -137,22 +143,18 @@ var Chip__default = /*#__PURE__*/_interopDefaultLegacy(Chip);
137
143
  var Divider__default = /*#__PURE__*/_interopDefaultLegacy(Divider);
138
144
  var FormControlLabel__default = /*#__PURE__*/_interopDefaultLegacy(FormControlLabel);
139
145
  var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
140
- var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
141
146
  var Fade__default = /*#__PURE__*/_interopDefaultLegacy(Fade);
142
147
  var TableContainer__default = /*#__PURE__*/_interopDefaultLegacy(TableContainer);
143
148
  var Table__default = /*#__PURE__*/_interopDefaultLegacy(Table);
144
149
  var TableHead__default = /*#__PURE__*/_interopDefaultLegacy(TableHead);
145
- var TableRow__default = /*#__PURE__*/_interopDefaultLegacy(TableRow);
146
- var TableCell__default = /*#__PURE__*/_interopDefaultLegacy(TableCell);
147
150
  var Slider__default = /*#__PURE__*/_interopDefaultLegacy(Slider);
148
151
  var Stack__default = /*#__PURE__*/_interopDefaultLegacy(Stack);
149
152
  var FormHelperText__default = /*#__PURE__*/_interopDefaultLegacy(FormHelperText);
153
+ var Grow__default = /*#__PURE__*/_interopDefaultLegacy(Grow);
150
154
  var Badge__default = /*#__PURE__*/_interopDefaultLegacy(Badge);
151
155
  var TableSortLabel__default = /*#__PURE__*/_interopDefaultLegacy(TableSortLabel);
152
- var TableBody__default = /*#__PURE__*/_interopDefaultLegacy(TableBody);
153
- var Skeleton__default = /*#__PURE__*/_interopDefaultLegacy(Skeleton);
154
- var highlightWords__default = /*#__PURE__*/_interopDefaultLegacy(highlightWords);
155
156
  var TableFooter__default = /*#__PURE__*/_interopDefaultLegacy(TableFooter);
157
+ var Dialog__default = /*#__PURE__*/_interopDefaultLegacy(Dialog);
156
158
  var DialogActions__default = /*#__PURE__*/_interopDefaultLegacy(DialogActions);
157
159
  var DialogContent__default = /*#__PURE__*/_interopDefaultLegacy(DialogContent);
158
160
  var DialogTitle__default = /*#__PURE__*/_interopDefaultLegacy(DialogTitle);
@@ -365,7 +367,7 @@ const getLeadingDisplayColumnIds = (props) => {
365
367
  props.positionActionsColumn === 'first' &&
366
368
  (props.enableRowActions ||
367
369
  (props.enableEditing &&
368
- ['row', 'modal'].includes((_a = props.editingMode) !== null && _a !== void 0 ? _a : ''))) &&
370
+ ['row', 'modal'].includes((_a = props.editDisplayMode) !== null && _a !== void 0 ? _a : ''))) &&
369
371
  'mrt-row-actions',
370
372
  props.positionExpandColumn === 'first' &&
371
373
  showExpandColumn(props) &&
@@ -380,7 +382,7 @@ const getTrailingDisplayColumnIds = (props) => {
380
382
  props.positionActionsColumn === 'last' &&
381
383
  (props.enableRowActions ||
382
384
  (props.enableEditing &&
383
- ['row', 'modal'].includes((_a = props.editingMode) !== null && _a !== void 0 ? _a : ''))) &&
385
+ ['row', 'modal'].includes((_a = props.editDisplayMode) !== null && _a !== void 0 ? _a : ''))) &&
384
386
  'mrt-row-actions',
385
387
  props.positionExpandColumn === 'last' &&
386
388
  showExpandColumn(props) &&
@@ -427,6 +429,19 @@ const getTotalRight = (table, column) => {
427
429
  .slice(column.getPinnedIndex() + 1)
428
430
  .reduce((acc, col) => acc + col.getSize(), 0);
429
431
  };
432
+ const getCanRankRows = (table) => {
433
+ const { options, getState } = table;
434
+ const { manualExpanding, manualFiltering, manualGrouping, manualSorting, enableGlobalFilterRankedResults, } = options;
435
+ const { globalFilterFn, expanded } = getState();
436
+ return (!manualExpanding &&
437
+ !manualFiltering &&
438
+ !manualGrouping &&
439
+ !manualSorting &&
440
+ enableGlobalFilterRankedResults &&
441
+ globalFilterFn === 'fuzzy' &&
442
+ expanded !== true &&
443
+ !Object.values(expanded).some(Boolean));
444
+ };
430
445
  const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
431
446
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
432
447
  const widthStyles = {
@@ -488,37 +503,10 @@ const MRT_DefaultDisplayColumn = {
488
503
  enableSorting: false,
489
504
  };
490
505
  const parseCSSVarId = (id) => id.replace(/[^a-zA-Z0-9]/g, '_');
491
-
492
- const MRT_Default_Icons = {
493
- ArrowDownwardIcon: ArrowDownwardIcon__default["default"],
494
- ArrowRightIcon: ArrowRightIcon__default["default"],
495
- CancelIcon: CancelIcon__default["default"],
496
- ClearAllIcon: ClearAllIcon__default["default"],
497
- CloseIcon: CloseIcon__default["default"],
498
- DensityLargeIcon: DensityLargeIcon__default["default"],
499
- DensityMediumIcon: DensityMediumIcon__default["default"],
500
- DensitySmallIcon: DensitySmallIcon__default["default"],
501
- DragHandleIcon: DragHandleIcon__default["default"],
502
- DynamicFeedIcon: DynamicFeedIcon__default["default"],
503
- EditIcon: EditIcon__default["default"],
504
- ExpandMoreIcon: ExpandMoreIcon__default["default"],
505
- FilterAltIcon: FilterAltIcon__default["default"],
506
- FilterListIcon: FilterListIcon__default["default"],
507
- FilterListOffIcon: FilterListOffIcon__default["default"],
508
- FullscreenExitIcon: FullscreenExitIcon__default["default"],
509
- FullscreenIcon: FullscreenIcon__default["default"],
510
- KeyboardDoubleArrowDownIcon: KeyboardDoubleArrowDownIcon__default["default"],
511
- MoreHorizIcon: MoreHorizIcon__default["default"],
512
- MoreVertIcon: MoreVertIcon__default["default"],
513
- PushPinIcon: PushPinIcon__default["default"],
514
- RestartAltIcon: RestartAltIcon__default["default"],
515
- SaveIcon: SaveIcon__default["default"],
516
- SearchIcon: SearchIcon__default["default"],
517
- SearchOffIcon: SearchOffIcon__default["default"],
518
- SortIcon: SortIcon__default["default"],
519
- ViewColumnIcon: ViewColumnIcon__default["default"],
520
- VisibilityOffIcon: VisibilityOffIcon__default["default"],
521
- };
506
+ const flexRender = reactTable.flexRender;
507
+ const createRow = (table, originalRow) => reactTable.createRow(table, 'mrt-row-create', originalRow !== null && originalRow !== void 0 ? originalRow : Object.assign({}, ...getAllLeafColumnDefs(table.options.columns).map((col) => ({
508
+ [getColumnId(col)]: '',
509
+ }))), -1, 0);
522
510
 
523
511
  const MRT_Localization_EN = {
524
512
  actions: 'Actions',
@@ -609,57 +597,706 @@ const MRT_Localization_EN = {
609
597
  ungroupByColumn: 'Ungroup by {column}',
610
598
  unpin: 'Unpin',
611
599
  unpinAll: 'Unpin all',
612
- unsorted: 'Unsorted',
613
600
  };
614
601
 
615
- const MRT_ExpandAllButton = ({ table }) => {
616
- var _a, _b;
617
- const { getIsAllRowsExpanded, getIsSomeRowsExpanded, getCanSomeRowsExpand, getState, options: { icons: { KeyboardDoubleArrowDownIcon }, localization, muiExpandAllButtonProps, renderDetailPanel, }, toggleAllRowsExpanded, } = table;
618
- const { density, isLoading } = getState();
619
- const iconButtonProps = muiExpandAllButtonProps instanceof Function
620
- ? muiExpandAllButtonProps({ table })
621
- : muiExpandAllButtonProps;
622
- const isAllRowsExpanded = getIsAllRowsExpanded();
623
- return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: ((_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : isAllRowsExpanded)
624
- ? localization.collapseAll
625
- : localization.expandAll, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], 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
626
- ? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
627
- : 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 : (jsxRuntime.jsx(KeyboardDoubleArrowDownIcon, { style: {
628
- transform: `rotate(${isAllRowsExpanded ? -180 : getIsSomeRowsExpanded() ? -90 : 0}deg)`,
629
- transition: 'transform 150ms',
630
- } })) })) }) }));
602
+ const MRT_Default_Icons = {
603
+ ArrowDownwardIcon: ArrowDownwardIcon__default["default"],
604
+ ArrowRightIcon: ArrowRightIcon__default["default"],
605
+ CancelIcon: CancelIcon__default["default"],
606
+ ClearAllIcon: ClearAllIcon__default["default"],
607
+ CloseIcon: CloseIcon__default["default"],
608
+ DensityLargeIcon: DensityLargeIcon__default["default"],
609
+ DensityMediumIcon: DensityMediumIcon__default["default"],
610
+ DensitySmallIcon: DensitySmallIcon__default["default"],
611
+ DragHandleIcon: DragHandleIcon__default["default"],
612
+ DynamicFeedIcon: DynamicFeedIcon__default["default"],
613
+ EditIcon: EditIcon__default["default"],
614
+ ExpandMoreIcon: ExpandMoreIcon__default["default"],
615
+ FilterAltIcon: FilterAltIcon__default["default"],
616
+ FilterListIcon: FilterListIcon__default["default"],
617
+ FilterListOffIcon: FilterListOffIcon__default["default"],
618
+ FullscreenExitIcon: FullscreenExitIcon__default["default"],
619
+ FullscreenIcon: FullscreenIcon__default["default"],
620
+ KeyboardDoubleArrowDownIcon: KeyboardDoubleArrowDownIcon__default["default"],
621
+ MoreHorizIcon: MoreHorizIcon__default["default"],
622
+ MoreVertIcon: MoreVertIcon__default["default"],
623
+ PushPinIcon: PushPinIcon__default["default"],
624
+ RestartAltIcon: RestartAltIcon__default["default"],
625
+ SaveIcon: SaveIcon__default["default"],
626
+ SearchIcon: SearchIcon__default["default"],
627
+ SearchOffIcon: SearchOffIcon__default["default"],
628
+ SortIcon: SortIcon__default["default"],
629
+ ViewColumnIcon: ViewColumnIcon__default["default"],
630
+ VisibilityOffIcon: VisibilityOffIcon__default["default"],
631
631
  };
632
632
 
633
- const MRT_ExpandButton = ({ row, table, }) => {
634
- var _a, _b;
635
- const { getState, options: { icons: { ExpandMoreIcon }, localization, muiExpandButtonProps, renderDetailPanel, }, } = table;
636
- const { density } = getState();
637
- const iconButtonProps = muiExpandButtonProps instanceof Function
638
- ? muiExpandButtonProps({ table, row })
639
- : muiExpandButtonProps;
640
- const canExpand = row.getCanExpand();
641
- const isExpanded = row.getIsExpanded();
642
- const handleToggleExpand = (event) => {
633
+ const useMRT_TableOptions = (_a) => {
634
+ var _b;
635
+ 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"]);
636
+ const _icons = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
637
+ const _localization = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
638
+ const _aggregationFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns)), []);
639
+ const _filterFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_FilterFns), filterFns)), []);
640
+ const _sortingFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
641
+ const _defaultColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), [defaultColumn]);
642
+ const _defaultDisplayColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), [defaultDisplayColumn]);
643
+ if (rest.enableRowVirtualization || rest.enableColumnVirtualization) {
644
+ layoutMode = 'grid';
645
+ }
646
+ if (rest.enableRowVirtualization) {
647
+ enableStickyHeader = true;
648
+ }
649
+ if (enablePagination === false && manualPagination === undefined) {
650
+ manualPagination = true;
651
+ }
652
+ if (!((_b = rest.data) === null || _b === void 0 ? void 0 : _b.length)) {
653
+ manualFiltering = true;
654
+ manualGrouping = true;
655
+ manualPagination = true;
656
+ manualSorting = true;
657
+ }
658
+ return Object.assign({ aggregationFns: _aggregationFns, autoResetExpanded,
659
+ columnFilterDisplayMode,
660
+ columnResizeMode,
661
+ createDisplayMode, defaultColumn: _defaultColumn, defaultDisplayColumn: _defaultDisplayColumn, editDisplayMode,
662
+ enableBottomToolbar,
663
+ enableColumnActions,
664
+ enableColumnFilters,
665
+ enableColumnOrdering,
666
+ enableColumnResizing,
667
+ enableDensityToggle,
668
+ enableExpandAll,
669
+ enableExpanding,
670
+ enableFilterMatchHighlighting,
671
+ enableFilters,
672
+ enableFullScreenToggle,
673
+ enableGlobalFilter,
674
+ enableGlobalFilterRankedResults,
675
+ enableGrouping,
676
+ enableHiding,
677
+ enableMultiRowSelection,
678
+ enableMultiSort,
679
+ enablePagination,
680
+ enableColumnPinning,
681
+ enableRowSelection,
682
+ enableSelectAll,
683
+ enableSorting,
684
+ enableStickyHeader,
685
+ enableTableFooter,
686
+ enableTableHead,
687
+ enableToolbarInternalActions,
688
+ enableTopToolbar, filterFns: _filterFns, icons: _icons, layoutMode, localization: _localization, manualFiltering,
689
+ manualGrouping,
690
+ manualPagination,
691
+ manualSorting,
692
+ paginationDisplayMode,
693
+ positionActionsColumn,
694
+ positionExpandColumn,
695
+ positionGlobalFilter,
696
+ positionPagination,
697
+ positionToolbarAlertBanner,
698
+ positionToolbarDropZone,
699
+ rowNumberMode,
700
+ selectAllMode, sortingFns: _sortingFns }, rest);
701
+ };
702
+
703
+ const MRT_EditCellTextField = ({ cell, table, }) => {
704
+ var _a, _b, _c;
705
+ const { getState, options: { createDisplayMode, editDisplayMode, muiEditTextFieldProps }, refs: { editInputRefs }, setEditingCell, setEditingRow, setCreatingRow, } = table;
706
+ const { column, row } = cell;
707
+ const { columnDef } = column;
708
+ const { creatingRow, editingRow } = getState();
709
+ const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
710
+ const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
711
+ const isSelectEdit = columnDef.editVariant === 'select';
712
+ const [value, setValue] = react.useState(() => cell.getValue());
713
+ const mTableBodyCellEditTextFieldProps = muiEditTextFieldProps instanceof Function
714
+ ? muiEditTextFieldProps({ cell, column, row, table })
715
+ : muiEditTextFieldProps;
716
+ const mcTableBodyCellEditTextFieldProps = columnDef.muiEditTextFieldProps instanceof Function
717
+ ? columnDef.muiEditTextFieldProps({
718
+ cell,
719
+ column,
720
+ row,
721
+ table,
722
+ })
723
+ : columnDef.muiEditTextFieldProps;
724
+ const textFieldProps = Object.assign(Object.assign({}, mTableBodyCellEditTextFieldProps), mcTableBodyCellEditTextFieldProps);
725
+ const saveInputValueToRowCache = (newValue) => {
726
+ //@ts-ignore
727
+ row._valuesCache[column.id] = newValue;
728
+ if (isCreating) {
729
+ setCreatingRow(Object.assign({}, row));
730
+ }
731
+ else if (isEditing) {
732
+ setEditingRow(Object.assign({}, row));
733
+ }
734
+ };
735
+ const handleChange = (event) => {
643
736
  var _a;
644
- event.stopPropagation();
645
- row.toggleExpanded();
646
- (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
737
+ (_a = textFieldProps.onChange) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
738
+ setValue(event.target.value);
739
+ if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.select) {
740
+ saveInputValueToRowCache(event.target.value);
741
+ }
647
742
  };
648
- return (jsxRuntime.jsx(Tooltip__default["default"], { 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)
649
- ? localization.collapse
650
- : localization.expand, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], 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
651
- ? iconButtonProps.sx(theme)
652
- : 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 : (jsxRuntime.jsx(ExpandMoreIcon, { style: {
653
- transform: `rotate(${!canExpand && !renderDetailPanel ? -90 : isExpanded ? -180 : 0}deg)`,
654
- transition: 'transform 150ms',
655
- } })) })) }) }));
743
+ const handleBlur = (event) => {
744
+ var _a;
745
+ (_a = textFieldProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
746
+ saveInputValueToRowCache(value);
747
+ setEditingCell(null);
748
+ };
749
+ const handleEnterKeyDown = (event) => {
750
+ var _a, _b;
751
+ (_a = textFieldProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
752
+ if (event.key === 'Enter' && !event.shiftKey) {
753
+ (_b = editInputRefs.current[column.id]) === null || _b === void 0 ? void 0 : _b.blur();
754
+ }
755
+ };
756
+ if (columnDef.Edit) {
757
+ return jsxRuntime.jsx(jsxRuntime.Fragment, { children: (_a = columnDef.Edit) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table }) });
758
+ }
759
+ return (jsxRuntime.jsx(TextField__default["default"], Object.assign({ disabled: (columnDef.enableEditing instanceof Function
760
+ ? columnDef.enableEditing(row)
761
+ : columnDef.enableEditing) === false, fullWidth: true, inputRef: (inputRef) => {
762
+ if (inputRef) {
763
+ editInputRefs.current[column.id] = inputRef;
764
+ if (textFieldProps.inputRef) {
765
+ textFieldProps.inputRef = inputRef;
766
+ }
767
+ }
768
+ }, label: ['modal', 'custom'].includes((isCreating ? createDisplayMode : editDisplayMode))
769
+ ? column.columnDef.header
770
+ : undefined, margin: "none", name: column.id, placeholder: !['modal', 'custom'].includes((isCreating ? createDisplayMode : editDisplayMode))
771
+ ? columnDef.header
772
+ : undefined, select: isSelectEdit, value: value, variant: "standard" }, textFieldProps, { onClick: (e) => {
773
+ var _a;
774
+ e.stopPropagation();
775
+ (_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.onClick) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, e);
776
+ }, 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) => {
777
+ let value;
778
+ let text;
779
+ if (typeof option !== 'object') {
780
+ value = option;
781
+ text = option;
782
+ }
783
+ else {
784
+ value = option.value;
785
+ text = option.text;
786
+ }
787
+ return (jsxRuntime.jsx(MenuItem__default["default"], { sx: {
788
+ display: 'flex',
789
+ m: 0,
790
+ alignItems: 'center',
791
+ gap: '0.5rem',
792
+ }, value: value, children: text }, value));
793
+ }) })));
656
794
  };
657
795
 
658
- const mrtFilterOptions = (localization) => [
659
- {
660
- option: 'fuzzy',
661
- symbol: '≈',
662
- label: localization.filterFuzzy,
796
+ const MRT_CopyButton = ({ cell, children, table, }) => {
797
+ var _a;
798
+ const { options: { localization, muiCopyButtonProps }, } = table;
799
+ const { column, row } = cell;
800
+ const { columnDef } = column;
801
+ const [copied, setCopied] = react.useState(false);
802
+ const handleCopy = (event, text) => {
803
+ event.stopPropagation();
804
+ navigator.clipboard.writeText(text);
805
+ setCopied(true);
806
+ setTimeout(() => setCopied(false), 4000);
807
+ };
808
+ const mTableBodyCellCopyButtonProps = muiCopyButtonProps instanceof Function
809
+ ? muiCopyButtonProps({ cell, column, row, table })
810
+ : muiCopyButtonProps;
811
+ const mcTableBodyCellCopyButtonProps = columnDef.muiCopyButtonProps instanceof Function
812
+ ? columnDef.muiCopyButtonProps({
813
+ cell,
814
+ column,
815
+ row,
816
+ table,
817
+ })
818
+ : columnDef.muiCopyButtonProps;
819
+ const buttonProps = Object.assign(Object.assign({}, mTableBodyCellCopyButtonProps), mcTableBodyCellCopyButtonProps);
820
+ return (jsxRuntime.jsx(Tooltip__default["default"], { 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: jsxRuntime.jsx(Button__default["default"], Object.assign({ onClick: (e) => handleCopy(e, cell.getValue()), size: "small", type: "button", variant: "text" }, buttonProps, { sx: (theme) => (Object.assign({ backgroundColor: 'transparent', border: 'none', color: 'inherit', cursor: 'copy', fontFamily: 'inherit', fontSize: 'inherit', letterSpacing: 'inherit', m: '-0.25rem', minWidth: 'unset', textAlign: 'inherit', textTransform: 'inherit' }, ((buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx) instanceof Function
821
+ ? buttonProps.sx(theme)
822
+ : buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx))), title: undefined, children: children })) }));
823
+ };
824
+
825
+ const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table, }) => {
826
+ var _a;
827
+ const { options: { icons: { DragHandleIcon }, localization, }, } = table;
828
+ return (jsxRuntime.jsx(Tooltip__default["default"], { 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: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ disableRipple: true, draggable: "true", size: "small" }, iconButtonProps, { onClick: (e) => {
829
+ var _a;
830
+ e.stopPropagation();
831
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, e);
832
+ }, 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': {
833
+ backgroundColor: 'transparent',
834
+ opacity: 1,
835
+ }, '&:active': {
836
+ cursor: 'grabbing',
837
+ } }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
838
+ ? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
839
+ : iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined, children: jsxRuntime.jsx(DragHandleIcon, {}) })) }));
840
+ };
841
+
842
+ const MRT_TableBodyRowGrabHandle = ({ row, rowRef, table, }) => {
843
+ const { options: { muiRowDragHandleProps }, } = table;
844
+ const iconButtonProps = muiRowDragHandleProps instanceof Function
845
+ ? muiRowDragHandleProps({ row, table })
846
+ : muiRowDragHandleProps;
847
+ const handleDragStart = (event) => {
848
+ var _a;
849
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
850
+ event.dataTransfer.setDragImage(rowRef.current, 0, 0);
851
+ table.setDraggingRow(row);
852
+ };
853
+ const handleDragEnd = (event) => {
854
+ var _a;
855
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
856
+ table.setDraggingRow(null);
857
+ table.setHoveredRow(null);
858
+ };
859
+ return (jsxRuntime.jsx(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
860
+ };
861
+
862
+ const allowedTypes = ['string', 'number'];
863
+ const MRT_TableBodyCellValue = ({ cell, table, }) => {
864
+ var _a, _b, _c;
865
+ const { getState, options: { enableFilterMatchHighlighting }, } = table;
866
+ const { column, row } = cell;
867
+ const { columnDef } = column;
868
+ const { globalFilter, globalFilterFn } = getState();
869
+ const filterValue = column.getFilterValue();
870
+ let renderedCellValue = cell.getIsAggregated() && columnDef.AggregatedCell
871
+ ? columnDef.AggregatedCell({
872
+ cell,
873
+ column,
874
+ row,
875
+ table,
876
+ })
877
+ : row.getIsGrouped() && !cell.getIsGrouped()
878
+ ? null
879
+ : cell.getIsGrouped() && columnDef.GroupedCell
880
+ ? columnDef.GroupedCell({
881
+ cell,
882
+ column,
883
+ row,
884
+ table,
885
+ })
886
+ : undefined;
887
+ const isGroupedValue = renderedCellValue !== undefined;
888
+ if (!isGroupedValue) {
889
+ renderedCellValue = cell.renderValue();
890
+ }
891
+ if (enableFilterMatchHighlighting &&
892
+ columnDef.enableFilterMatchHighlighting !== false &&
893
+ renderedCellValue &&
894
+ allowedTypes.includes(typeof renderedCellValue) &&
895
+ ((filterValue &&
896
+ allowedTypes.includes(typeof filterValue) &&
897
+ columnDef.filterVariant === 'text') ||
898
+ (globalFilter &&
899
+ allowedTypes.includes(typeof globalFilter) &&
900
+ column.getCanGlobalFilter()))) {
901
+ const chunks = highlightWords__default["default"] === null || highlightWords__default["default"] === void 0 ? void 0 : highlightWords__default["default"]({
902
+ text: renderedCellValue === null || renderedCellValue === void 0 ? void 0 : renderedCellValue.toString(),
903
+ query: ((_a = filterValue !== null && filterValue !== void 0 ? filterValue : globalFilter) !== null && _a !== void 0 ? _a : '').toString(),
904
+ matchExactly: (filterValue ? columnDef._filterFn : globalFilterFn) !== 'fuzzy',
905
+ });
906
+ 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)) {
907
+ renderedCellValue = (jsxRuntime.jsx("span", { "aria-label": renderedCellValue, role: "note", children: (_c = chunks === null || chunks === void 0 ? void 0 : chunks.map(({ key, match, text }) => (jsxRuntime.jsx(Box__default["default"], { "aria-hidden": "true", component: "span", sx: match
908
+ ? {
909
+ backgroundColor: (theme) => theme.palette.mode === 'dark'
910
+ ? styles.darken(theme.palette.warning.dark, 0.25)
911
+ : styles.lighten(theme.palette.warning.light, 0.5),
912
+ borderRadius: '2px',
913
+ color: (theme) => theme.palette.mode === 'dark' ? 'white' : 'black',
914
+ padding: '2px 1px',
915
+ }
916
+ : undefined, children: text }, key)))) !== null && _c !== void 0 ? _c : renderedCellValue }));
917
+ }
918
+ }
919
+ if (columnDef.Cell && !isGroupedValue) {
920
+ renderedCellValue = columnDef.Cell({
921
+ cell,
922
+ renderedCellValue,
923
+ column,
924
+ row,
925
+ table,
926
+ });
927
+ }
928
+ return jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderedCellValue });
929
+ };
930
+
931
+ const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, table, virtualCell, }) => {
932
+ var _a, _b, _c, _d;
933
+ const theme = styles.useTheme();
934
+ const { getState, options: { createDisplayMode, editDisplayMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, enableRowNumbers, layoutMode, muiTableBodyCellProps, muiSkeletonProps, rowNumberMode, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
935
+ const { creatingRow, draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, density, isLoading, showSkeletons, } = getState();
936
+ const { column, row } = cell;
937
+ const { columnDef } = column;
938
+ const { columnDefType } = columnDef;
939
+ const mTableCellBodyProps = muiTableBodyCellProps instanceof Function
940
+ ? muiTableBodyCellProps({ cell, column, row, table })
941
+ : muiTableBodyCellProps;
942
+ const mcTableCellBodyProps = columnDef.muiTableBodyCellProps instanceof Function
943
+ ? columnDef.muiTableBodyCellProps({ cell, column, row, table })
944
+ : columnDef.muiTableBodyCellProps;
945
+ const tableCellProps = Object.assign(Object.assign({}, mTableCellBodyProps), mcTableCellBodyProps);
946
+ const skeletonProps = muiSkeletonProps instanceof Function
947
+ ? muiSkeletonProps({ cell, column, row, table })
948
+ : muiSkeletonProps;
949
+ const [skeletonWidth, setSkeletonWidth] = react.useState(100);
950
+ react.useEffect(() => {
951
+ if ((!isLoading && !showSkeletons) || skeletonWidth !== 100)
952
+ return;
953
+ const size = column.getSize();
954
+ setSkeletonWidth(columnDefType === 'display'
955
+ ? size / 2
956
+ : Math.round(Math.random() * (size - size / 3) + size / 3));
957
+ }, [isLoading, showSkeletons]);
958
+ const draggingBorders = react.useMemo(() => {
959
+ const isDraggingColumn = (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id;
960
+ const isHoveredColumn = (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id;
961
+ const isDraggingRow = (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id;
962
+ const isHoveredRow = (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id;
963
+ const isFirstColumn = getIsFirstColumn(column, table);
964
+ const isLastColumn = getIsLastColumn(column, table);
965
+ const isLastRow = rowIndex === numRows - 1;
966
+ const borderStyle = isDraggingColumn || isDraggingRow
967
+ ? `1px dashed ${theme.palette.text.secondary} !important`
968
+ : isHoveredColumn || isHoveredRow
969
+ ? `2px dashed ${theme.palette.primary.main} !important`
970
+ : undefined;
971
+ return borderStyle
972
+ ? {
973
+ borderLeft: isDraggingColumn ||
974
+ isHoveredColumn ||
975
+ ((isDraggingRow || isHoveredRow) && isFirstColumn)
976
+ ? borderStyle
977
+ : undefined,
978
+ borderRight: isDraggingColumn ||
979
+ isHoveredColumn ||
980
+ ((isDraggingRow || isHoveredRow) && isLastColumn)
981
+ ? borderStyle
982
+ : undefined,
983
+ borderBottom: isDraggingRow || isHoveredRow || isLastRow
984
+ ? borderStyle
985
+ : undefined,
986
+ borderTop: isDraggingRow || isHoveredRow ? borderStyle : undefined,
987
+ }
988
+ : undefined;
989
+ }, [draggingColumn, draggingRow, hoveredColumn, hoveredRow, rowIndex]);
990
+ const isEditable = (enableEditing instanceof Function ? enableEditing(row) : enableEditing) &&
991
+ (columnDef.enableEditing instanceof Function
992
+ ? columnDef.enableEditing(row)
993
+ : columnDef.enableEditing) !== false;
994
+ const isEditing = isEditable &&
995
+ !['modal', 'custom'].includes(editDisplayMode) &&
996
+ (editDisplayMode === 'table' ||
997
+ (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id ||
998
+ (editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) === cell.id) &&
999
+ !row.getIsGrouped();
1000
+ const isCreating = isEditable && createDisplayMode === 'row' && (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
1001
+ const handleDoubleClick = (event) => {
1002
+ var _a;
1003
+ (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDoubleClick) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
1004
+ if (isEditable && editDisplayMode === 'cell') {
1005
+ setEditingCell(cell);
1006
+ queueMicrotask(() => {
1007
+ var _a;
1008
+ const textField = editInputRefs.current[column.id];
1009
+ if (textField) {
1010
+ textField.focus();
1011
+ (_a = textField.select) === null || _a === void 0 ? void 0 : _a.call(textField);
1012
+ }
1013
+ });
1014
+ }
1015
+ };
1016
+ const handleDragEnter = (e) => {
1017
+ var _a;
1018
+ (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDragEnter) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, e);
1019
+ if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
1020
+ setHoveredColumn(null);
1021
+ }
1022
+ if (enableColumnOrdering && draggingColumn) {
1023
+ setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
1024
+ }
1025
+ };
1026
+ return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ "data-index": virtualCell === null || virtualCell === void 0 ? void 0 : virtualCell.index, ref: (node) => {
1027
+ if (node) {
1028
+ measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
1029
+ }
1030
+ } }, 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'
1031
+ ? columnDefType === 'display'
1032
+ ? '0 0.5rem'
1033
+ : '0.5rem'
1034
+ : density === 'comfortable'
1035
+ ? columnDefType === 'display'
1036
+ ? '0.5rem 0.75rem'
1037
+ : '1rem'
1038
+ : columnDefType === 'display'
1039
+ ? '1rem 1.25rem'
1040
+ : '1.5rem', pl: column.id === 'mrt-row-expand'
1041
+ ? `${row.depth +
1042
+ (density === 'compact'
1043
+ ? 0.5
1044
+ : density === 'comfortable'
1045
+ ? 0.75
1046
+ : 1.25)}rem`
1047
+ : 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': {
1048
+ outline: ['table', 'cell'].includes(editDisplayMode !== null && editDisplayMode !== void 0 ? editDisplayMode : '')
1049
+ ? `1px solid ${theme.palette.text.secondary}`
1050
+ : undefined,
1051
+ outlineOffset: '-1px',
1052
+ textOverflow: 'clip',
1053
+ } }, getCommonCellStyles({
1054
+ column,
1055
+ table,
1056
+ theme,
1057
+ tableCellProps,
1058
+ })), draggingBorders)), children: jsxRuntime.jsxs(jsxRuntime.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 ? (jsxRuntime.jsx(Skeleton__default["default"], Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : enableRowNumbers &&
1059
+ rowNumberMode === 'static' &&
1060
+ column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (jsxRuntime.jsx(MRT_TableBodyRowGrabHandle, { row: row, rowRef: rowRef, table: table })) : columnDefType === 'display' &&
1061
+ (column.id === 'mrt-row-select' ||
1062
+ column.id === 'mrt-row-expand' ||
1063
+ !row.getIsGrouped()) ? ((_c = columnDef.Cell) === null || _c === void 0 ? void 0 : _c.call(columnDef, {
1064
+ cell,
1065
+ renderedCellValue: cell.renderValue(),
1066
+ column,
1067
+ row,
1068
+ table,
1069
+ })) : isCreating || isEditing ? (jsxRuntime.jsx(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
1070
+ columnDef.enableClickToCopy !== false ? (jsxRuntime.jsx(MRT_CopyButton, { cell: cell, table: table, children: jsxRuntime.jsx(MRT_TableBodyCellValue, { cell: cell, table: table }) })) : (jsxRuntime.jsx(MRT_TableBodyCellValue, { cell: cell, table: table })), cell.getIsGrouped() && !columnDef.GroupedCell && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [" (", (_d = row.subRows) === null || _d === void 0 ? void 0 : _d.length, ")"] }))] }) })));
1071
+ };
1072
+ const Memo_MRT_TableBodyCell = react.memo(MRT_TableBodyCell, (prev, next) => next.cell === prev.cell);
1073
+
1074
+ const MRT_TableDetailPanel = ({ parentRowRef, row, rowIndex, table, virtualRow, }) => {
1075
+ const { getVisibleLeafColumns, getState, options: { layoutMode, muiTableBodyRowProps, muiDetailPanelProps, renderDetailPanel, }, } = table;
1076
+ const { isLoading } = getState();
1077
+ const tableRowProps = muiTableBodyRowProps instanceof Function
1078
+ ? muiTableBodyRowProps({
1079
+ isDetailPanel: true,
1080
+ row,
1081
+ staticRowIndex: rowIndex,
1082
+ table,
1083
+ })
1084
+ : muiTableBodyRowProps;
1085
+ const tableCellProps = muiDetailPanelProps instanceof Function
1086
+ ? muiDetailPanelProps({ row, table })
1087
+ : muiDetailPanelProps;
1088
+ return (jsxRuntime.jsx(TableRow__default["default"], Object.assign({ className: "Mui-TableBodyCell-DetailPanel" }, tableRowProps, { sx: (theme) => {
1089
+ var _a, _b;
1090
+ return (Object.assign({ display: layoutMode === 'grid' ? 'flex' : 'table-row', position: virtualRow ? 'absolute' : undefined, top: virtualRow
1091
+ ? `${(_b = (_a = parentRowRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.height}px`
1092
+ : undefined, transform: virtualRow
1093
+ ? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
1094
+ : undefined, width: '100%', zIndex: virtualRow ? 2 : undefined }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
1095
+ ? tableRowProps.sx(theme)
1096
+ : tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx)));
1097
+ }, children: jsxRuntime.jsx(TableCell__default["default"], Object.assign({ className: "Mui-TableBodyCell-DetailPanel", colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ backgroundColor: virtualRow
1098
+ ? styles.lighten(theme.palette.background.default, 0.06)
1099
+ : 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
1100
+ ? tableCellProps.sx(theme)
1101
+ : tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))), children: renderDetailPanel && (jsxRuntime.jsx(Collapse__default["default"], { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: !isLoading && renderDetailPanel({ row, table }) })) })) })));
1102
+ };
1103
+
1104
+ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, row, rowIndex, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, virtualRow, }) => {
1105
+ const { getState, options: { enableRowOrdering, layoutMode, memoMode, muiTableBodyRowProps, renderDetailPanel, }, setHoveredRow, } = table;
1106
+ const { draggingColumn, draggingRow, editingCell, editingRow, hoveredRow } = getState();
1107
+ const tableRowProps = muiTableBodyRowProps instanceof Function
1108
+ ? muiTableBodyRowProps({ row, staticRowIndex: rowIndex, table })
1109
+ : muiTableBodyRowProps;
1110
+ const handleDragEnter = (_e) => {
1111
+ if (enableRowOrdering && draggingRow) {
1112
+ setHoveredRow(row);
1113
+ }
1114
+ };
1115
+ const rowRef = react.useRef(null);
1116
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(TableRow__default["default"], Object.assign({ "data-index": virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.index, onDragEnter: handleDragEnter, selected: row.getIsSelected(), ref: (node) => {
1117
+ if (node) {
1118
+ rowRef.current = node;
1119
+ measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
1120
+ }
1121
+ } }, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.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': {
1122
+ backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false
1123
+ ? row.getIsSelected()
1124
+ ? `${styles.alpha(theme.palette.primary.main, 0.2)}`
1125
+ : theme.palette.mode === 'dark'
1126
+ ? `${styles.lighten(theme.palette.background.default, 0.12)}`
1127
+ : `${styles.darken(theme.palette.background.default, 0.05)}`
1128
+ : undefined,
1129
+ } }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
1130
+ ? tableRowProps.sx(theme)
1131
+ : tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))), style: Object.assign({ transform: virtualRow
1132
+ ? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
1133
+ : undefined }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style), children: [virtualPaddingLeft ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : row.getVisibleCells()).map((cellOrVirtualCell) => {
1134
+ const cell = columnVirtualizer
1135
+ ? row.getVisibleCells()[cellOrVirtualCell.index]
1136
+ : cellOrVirtualCell;
1137
+ const props = {
1138
+ cell,
1139
+ measureElement: columnVirtualizer === null || columnVirtualizer === void 0 ? void 0 : columnVirtualizer.measureElement,
1140
+ numRows,
1141
+ rowIndex,
1142
+ rowRef,
1143
+ table,
1144
+ virtualCell: columnVirtualizer
1145
+ ? cellOrVirtualCell
1146
+ : undefined,
1147
+ };
1148
+ return memoMode === 'cells' &&
1149
+ cell.column.columnDef.columnDefType === 'data' &&
1150
+ !draggingColumn &&
1151
+ !draggingRow &&
1152
+ (editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) !== cell.id &&
1153
+ (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) !== row.id ? (jsxRuntime.jsx(Memo_MRT_TableBodyCell, Object.assign({}, props), cell.id)) : (jsxRuntime.jsx(MRT_TableBodyCell, Object.assign({}, props), cell.id));
1154
+ }), virtualPaddingRight ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })), renderDetailPanel && !row.getIsGrouped() && (jsxRuntime.jsx(MRT_TableDetailPanel, { parentRowRef: rowRef, row: row, rowIndex: rowIndex, table: table, virtualRow: virtualRow }))] }));
1155
+ };
1156
+ const Memo_MRT_TableBodyRow = react.memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row && prev.rowIndex === next.rowIndex);
1157
+
1158
+ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
1159
+ var _a, _b, _c, _d;
1160
+ const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, layoutMode, localization, manualExpanding, manualFiltering, manualGrouping, manualPagination, manualSorting, memoMode, muiTableBodyProps, renderEmptyRowsFallback, rowVirtualizerInstanceRef, rowVirtualizerOptions, }, refs: { tableContainerRef, tablePaperRef }, } = table;
1161
+ const { columnFilters, density, expanded, globalFilter, globalFilterFn, pagination, sorting, } = getState();
1162
+ const tableBodyProps = muiTableBodyProps instanceof Function
1163
+ ? muiTableBodyProps({ table })
1164
+ : muiTableBodyProps;
1165
+ const vProps = rowVirtualizerOptions instanceof Function
1166
+ ? rowVirtualizerOptions({ table })
1167
+ : rowVirtualizerOptions;
1168
+ const shouldRankResults = react.useMemo(() => !manualExpanding &&
1169
+ !manualFiltering &&
1170
+ !manualGrouping &&
1171
+ !manualSorting &&
1172
+ enableGlobalFilterRankedResults &&
1173
+ globalFilter &&
1174
+ globalFilterFn === 'fuzzy' &&
1175
+ expanded !== true &&
1176
+ !Object.values(sorting).some(Boolean) &&
1177
+ !Object.values(expanded).some(Boolean), [
1178
+ enableGlobalFilterRankedResults,
1179
+ expanded,
1180
+ globalFilter,
1181
+ manualExpanding,
1182
+ manualFiltering,
1183
+ manualGrouping,
1184
+ manualSorting,
1185
+ sorting,
1186
+ ]);
1187
+ const rows = react.useMemo(() => {
1188
+ if (!shouldRankResults)
1189
+ return getRowModel().rows;
1190
+ const rankedRows = getPrePaginationRowModel().rows.sort((a, b) => rankGlobalFuzzy(a, b));
1191
+ if (enablePagination && !manualPagination) {
1192
+ const start = pagination.pageIndex * pagination.pageSize;
1193
+ return rankedRows.slice(start, start + pagination.pageSize);
1194
+ }
1195
+ return rankedRows;
1196
+ }, [
1197
+ shouldRankResults,
1198
+ shouldRankResults ? getPrePaginationRowModel().rows : getRowModel().rows,
1199
+ pagination.pageIndex,
1200
+ pagination.pageSize,
1201
+ ]);
1202
+ const rowVirtualizer = enableRowVirtualization
1203
+ ? reactVirtual.useVirtualizer(Object.assign({ count: rows.length, estimateSize: () => density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73, getScrollElement: () => tableContainerRef.current, measureElement: typeof window !== 'undefined' &&
1204
+ navigator.userAgent.indexOf('Firefox') === -1
1205
+ ? (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height
1206
+ : undefined, overscan: 4 }, vProps))
1207
+ : undefined;
1208
+ if (rowVirtualizerInstanceRef && rowVirtualizer) {
1209
+ rowVirtualizerInstanceRef.current = rowVirtualizer;
1210
+ }
1211
+ const virtualRows = rowVirtualizer
1212
+ ? rowVirtualizer.getVirtualItems()
1213
+ : undefined;
1214
+ return (jsxRuntime.jsx(TableBody__default["default"], Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', height: rowVirtualizer
1215
+ ? `${rowVirtualizer.getTotalSize()}px`
1216
+ : 'inherit', minHeight: !rows.length ? '100px' : undefined, position: 'relative' }, ((tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx) instanceof Function
1217
+ ? tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx(theme)
1218
+ : 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 ? (jsxRuntime.jsx("tr", { style: { display: layoutMode === 'grid' ? 'grid' : 'table-row' }, children: jsxRuntime.jsx("td", { colSpan: table.getVisibleLeafColumns().length, style: {
1219
+ display: layoutMode === 'grid' ? 'grid' : 'table-cell',
1220
+ }, children: (_b = renderEmptyRowsFallback === null || renderEmptyRowsFallback === void 0 ? void 0 : renderEmptyRowsFallback({ table })) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(Typography__default["default"], { sx: {
1221
+ color: 'text.secondary',
1222
+ fontStyle: 'italic',
1223
+ maxWidth: `min(100vw, ${(_d = (_c = tablePaperRef.current) === null || _c === void 0 ? void 0 : _c.clientWidth) !== null && _d !== void 0 ? _d : 360}px)`,
1224
+ py: '2rem',
1225
+ textAlign: 'center',
1226
+ width: '100%',
1227
+ }, children: globalFilter || columnFilters.length
1228
+ ? localization.noResultsFound
1229
+ : localization.noRecordsToDisplay })) }) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: (virtualRows !== null && virtualRows !== void 0 ? virtualRows : rows).map((rowOrVirtualRow, rowIndex) => {
1230
+ const row = rowVirtualizer
1231
+ ? rows[rowOrVirtualRow.index]
1232
+ : rowOrVirtualRow;
1233
+ const props = {
1234
+ columnVirtualizer,
1235
+ measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
1236
+ numRows: rows.length,
1237
+ row,
1238
+ rowIndex: rowVirtualizer ? rowOrVirtualRow.index : rowIndex,
1239
+ table,
1240
+ virtualColumns,
1241
+ virtualPaddingLeft,
1242
+ virtualPaddingRight,
1243
+ virtualRow: rowVirtualizer
1244
+ ? rowOrVirtualRow
1245
+ : undefined,
1246
+ };
1247
+ return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
1248
+ }) }))) })));
1249
+ };
1250
+ const Memo_MRT_TableBody = react.memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
1251
+
1252
+ const MRT_ExpandAllButton = ({ table, }) => {
1253
+ var _a, _b;
1254
+ const { getIsAllRowsExpanded, getIsSomeRowsExpanded, getCanSomeRowsExpand, getState, options: { icons: { KeyboardDoubleArrowDownIcon }, localization, muiExpandAllButtonProps, renderDetailPanel, }, toggleAllRowsExpanded, } = table;
1255
+ const { density, isLoading } = getState();
1256
+ const iconButtonProps = muiExpandAllButtonProps instanceof Function
1257
+ ? muiExpandAllButtonProps({ table })
1258
+ : muiExpandAllButtonProps;
1259
+ const isAllRowsExpanded = getIsAllRowsExpanded();
1260
+ return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: ((_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : isAllRowsExpanded)
1261
+ ? localization.collapseAll
1262
+ : localization.expandAll, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], 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
1263
+ ? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
1264
+ : 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 : (jsxRuntime.jsx(KeyboardDoubleArrowDownIcon, { style: {
1265
+ transform: `rotate(${isAllRowsExpanded ? -180 : getIsSomeRowsExpanded() ? -90 : 0}deg)`,
1266
+ transition: 'transform 150ms',
1267
+ } })) })) }) }));
1268
+ };
1269
+
1270
+ const MRT_ExpandButton = ({ row, table, }) => {
1271
+ var _a, _b;
1272
+ const { getState, options: { icons: { ExpandMoreIcon }, localization, muiExpandButtonProps, renderDetailPanel, }, } = table;
1273
+ const { density } = getState();
1274
+ const iconButtonProps = muiExpandButtonProps instanceof Function
1275
+ ? muiExpandButtonProps({ table, row })
1276
+ : muiExpandButtonProps;
1277
+ const canExpand = row.getCanExpand();
1278
+ const isExpanded = row.getIsExpanded();
1279
+ const handleToggleExpand = (event) => {
1280
+ var _a;
1281
+ event.stopPropagation();
1282
+ row.toggleExpanded();
1283
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1284
+ };
1285
+ return (jsxRuntime.jsx(Tooltip__default["default"], { 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)
1286
+ ? localization.collapse
1287
+ : localization.expand, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], 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
1288
+ ? iconButtonProps.sx(theme)
1289
+ : 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 : (jsxRuntime.jsx(ExpandMoreIcon, { style: {
1290
+ transform: `rotate(${!canExpand && !renderDetailPanel ? -90 : isExpanded ? -180 : 0}deg)`,
1291
+ transition: 'transform 150ms',
1292
+ } })) })) }) }));
1293
+ };
1294
+
1295
+ const mrtFilterOptions = (localization) => [
1296
+ {
1297
+ option: 'fuzzy',
1298
+ symbol: '≈',
1299
+ label: localization.filterFuzzy,
663
1300
  divider: false,
664
1301
  },
665
1302
  {
@@ -744,6 +1381,7 @@ const mrtFilterOptions = (localization) => [
744
1381
  const rangeModes = ['between', 'betweenInclusive', 'inNumberRange'];
745
1382
  const emptyModes = ['empty', 'notEmpty'];
746
1383
  const arrModes = ['arrIncludesSome', 'arrIncludesAll', 'arrIncludes'];
1384
+ const rangeVariants = ['range-slider', 'date-range', 'range'];
747
1385
  const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilterValue, table, }) => {
748
1386
  var _a, _b, _c, _d;
749
1387
  const { getState, options: { columnFilterModeOptions, globalFilterModeOptions, localization, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
@@ -752,7 +1390,7 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilt
752
1390
  const { columnDef } = column !== null && column !== void 0 ? column : {};
753
1391
  const currentFilterValue = column === null || column === void 0 ? void 0 : column.getFilterValue();
754
1392
  let allowedColumnFilterOptions = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _a !== void 0 ? _a : columnFilterModeOptions;
755
- if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'range-slider') {
1393
+ if (rangeVariants.includes(columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant)) {
756
1394
  allowedColumnFilterOptions = [
757
1395
  ...rangeModes,
758
1396
  ...(allowedColumnFilterOptions !== null && allowedColumnFilterOptions !== void 0 ? allowedColumnFilterOptions : []),
@@ -864,7 +1502,7 @@ const commonListItemStyles = {
864
1502
  };
865
1503
  const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
866
1504
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
867
- 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;
1505
+ 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;
868
1506
  const { column } = header;
869
1507
  const { columnDef } = column;
870
1508
  const { columnSizing, columnVisibility, density, showColumnFilters } = getState();
@@ -945,10 +1583,10 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
945
1583
  : []),
946
1584
  ...(enableGrouping && column.getCanGroup()
947
1585
  ? [
948
- jsxRuntime.jsx(MenuItem__default["default"], { divider: enablePinning, onClick: handleGroupByColumn, sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(DynamicFeedIcon, {}) }), (_e = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) === null || _e === void 0 ? void 0 : _e.replace('{column}', String(columnDef.header))] }) }, 6),
1586
+ jsxRuntime.jsx(MenuItem__default["default"], { divider: enableColumnPinning, onClick: handleGroupByColumn, sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(DynamicFeedIcon, {}) }), (_e = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) === null || _e === void 0 ? void 0 : _e.replace('{column}', String(columnDef.header))] }) }, 6),
949
1587
  ]
950
1588
  : []),
951
- ...(enablePinning && column.getCanPin()
1589
+ ...(enableColumnPinning && column.getCanPin()
952
1590
  ? [
953
1591
  jsxRuntime.jsx(MenuItem__default["default"], { disabled: column.getIsPinned() === 'left' || !column.getCanPin(), onClick: () => handlePinColumn('left'), sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(PushPinIcon, { style: { transform: 'rotate(90deg)' } }) }), localization.pinToLeft] }) }, 7),
954
1592
  jsxRuntime.jsx(MenuItem__default["default"], { disabled: column.getIsPinned() === 'right' || !column.getCanPin(), onClick: () => handlePinColumn('right'), sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(PushPinIcon, { style: { transform: 'rotate(-90deg)' } }) }), localization.pinToRight] }) }, 8),
@@ -998,30 +1636,49 @@ const MRT_RowActionMenu = ({ anchorEl, handleEdit, row, setAnchorEl, table, }) =
998
1636
  };
999
1637
 
1000
1638
  const MRT_EditActionButtons = ({ row, table, variant = 'icon', }) => {
1001
- const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onEditingRowSave, onEditingRowCancel, }, refs: { editInputRefs }, setEditingRow, } = table;
1002
- const { editingRow } = getState();
1639
+ const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onCreatingRowCancel, onCreatingRowSave, onEditingRowSave, onEditingRowCancel, }, refs: { editInputRefs }, setCreatingRow, setEditingRow, } = table;
1640
+ const { creatingRow, editingRow, isSaving } = getState();
1641
+ const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
1642
+ const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
1003
1643
  const handleCancel = () => {
1004
- onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
1005
- setEditingRow(null);
1644
+ if (isCreating) {
1645
+ onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
1646
+ setCreatingRow(null);
1647
+ }
1648
+ else if (isEditing) {
1649
+ onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
1650
+ setEditingRow(null);
1651
+ }
1652
+ row._valuesCache = {}; //reset values cache
1006
1653
  };
1007
- const handleSave = () => {
1008
- var _a, _b;
1654
+ const handleSubmitRow = () => {
1655
+ var _a;
1009
1656
  //look for auto-filled input values
1010
- (_a = Object.values(editInputRefs === null || editInputRefs === void 0 ? void 0 : editInputRefs.current)) === null || _a === void 0 ? void 0 : _a.forEach((input) => {
1657
+ (_a = Object.values(editInputRefs === null || editInputRefs === void 0 ? void 0 : editInputRefs.current)
1658
+ .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) => {
1011
1659
  if (input.value !== undefined &&
1012
- Object.hasOwn(editingRow === null || editingRow === void 0 ? void 0 : editingRow._valuesCache, input.name)) {
1660
+ Object.hasOwn(row === null || row === void 0 ? void 0 : row._valuesCache, input.name)) {
1013
1661
  // @ts-ignore
1014
- editingRow._valuesCache[input.name] = input.value;
1662
+ row._valuesCache[input.name] = input.value;
1015
1663
  }
1016
1664
  });
1017
- onEditingRowSave === null || onEditingRowSave === void 0 ? void 0 : onEditingRowSave({
1018
- exitEditingMode: () => setEditingRow(null),
1019
- row: editingRow !== null && editingRow !== void 0 ? editingRow : row,
1020
- table,
1021
- values: (_b = editingRow === null || editingRow === void 0 ? void 0 : editingRow._valuesCache) !== null && _b !== void 0 ? _b : Object.assign({}, row.original),
1022
- });
1665
+ if (isCreating)
1666
+ onCreatingRowSave === null || onCreatingRowSave === void 0 ? void 0 : onCreatingRowSave({
1667
+ exitCreatingMode: () => setCreatingRow(null),
1668
+ row,
1669
+ table,
1670
+ values: row._valuesCache,
1671
+ });
1672
+ else if (isEditing) {
1673
+ onEditingRowSave === null || onEditingRowSave === void 0 ? void 0 : onEditingRowSave({
1674
+ exitEditingMode: () => setEditingRow(null),
1675
+ row,
1676
+ table,
1677
+ values: row === null || row === void 0 ? void 0 : row._valuesCache,
1678
+ });
1679
+ }
1023
1680
  };
1024
- return (jsxRuntime.jsx(Box__default["default"], { onClick: (e) => e.stopPropagation(), sx: { display: 'flex', gap: '0.75rem' }, children: variant === 'icon' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.cancel, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.cancel, onClick: handleCancel, children: jsxRuntime.jsx(CancelIcon, {}) }) }), jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.save, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.save, color: "info", onClick: handleSave, children: jsxRuntime.jsx(SaveIcon, {}) }) })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Button__default["default"], { onClick: handleCancel, children: localization.cancel }), jsxRuntime.jsx(Button__default["default"], { onClick: handleSave, variant: "contained", children: localization.save })] })) }));
1681
+ return (jsxRuntime.jsx(Box__default["default"], { onClick: (e) => e.stopPropagation(), sx: { display: 'flex', gap: '0.75rem' }, children: variant === 'icon' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.cancel, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.cancel, onClick: handleCancel, children: jsxRuntime.jsx(CancelIcon, {}) }) }), jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.save, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.save, color: "info", onClick: handleSubmitRow, children: isSaving ? jsxRuntime.jsx(CircularProgress__default["default"], { size: 18 }) : jsxRuntime.jsx(SaveIcon, {}) }) })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Button__default["default"], { sx: { minWidth: '100px' }, onClick: handleCancel, children: localization.cancel }), jsxRuntime.jsxs(Button__default["default"], { sx: { minWidth: '100px' }, onClick: handleSubmitRow, variant: "contained", children: [isSaving && jsxRuntime.jsx(CircularProgress__default["default"], { color: "inherit", size: 18 }), localization.save] })] })) }));
1025
1682
  };
1026
1683
 
1027
1684
  const commonIconButtonStyles = {
@@ -1035,8 +1692,12 @@ const commonIconButtonStyles = {
1035
1692
  },
1036
1693
  };
1037
1694
  const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
1038
- const { getState, options: { editingMode, enableEditing, icons: { EditIcon, MoreHorizIcon }, localization, renderRowActionMenuItems, renderRowActions, }, setEditingRow, } = table;
1039
- const { editingRow } = getState();
1695
+ const { getState, options: { createDisplayMode, editDisplayMode, enableEditing, icons: { EditIcon, MoreHorizIcon }, localization, renderRowActionMenuItems, renderRowActions, }, setEditingRow, } = table;
1696
+ const { creatingRow, editingRow } = getState();
1697
+ const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
1698
+ const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
1699
+ const showEditActionButtons = (isCreating && createDisplayMode === 'row') ||
1700
+ (isEditing && editDisplayMode === 'row');
1040
1701
  const [anchorEl, setAnchorEl] = react.useState(null);
1041
1702
  const handleOpenRowActionMenu = (event) => {
1042
1703
  event.stopPropagation();
@@ -1048,13 +1709,13 @@ const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
1048
1709
  setEditingRow(Object.assign({}, row));
1049
1710
  setAnchorEl(null);
1050
1711
  };
1051
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderRowActions ? (renderRowActions({ cell, row, table })) : row.id === (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) && editingMode === 'row' ? (jsxRuntime.jsx(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems &&
1712
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderRowActions && !showEditActionButtons ? (renderRowActions({ cell, row, table })) : showEditActionButtons ? (jsxRuntime.jsx(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems &&
1052
1713
  (enableEditing instanceof Function
1053
1714
  ? enableEditing(row)
1054
1715
  : enableEditing) ? (jsxRuntime.jsx(Tooltip__default["default"], { placement: "right", arrow: true, title: localization.edit, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.edit, sx: commonIconButtonStyles, onClick: handleStartEditMode, children: jsxRuntime.jsx(EditIcon, {}) }) })) : renderRowActionMenuItems ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles, children: jsxRuntime.jsx(MoreHorizIcon, {}) }) }), jsxRuntime.jsx(MRT_RowActionMenu, { anchorEl: anchorEl, handleEdit: handleStartEditMode, row: row, setAnchorEl: setAnchorEl, table: table })] })) : null }));
1055
1716
  };
1056
1717
 
1057
- const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
1718
+ const MRT_SelectCheckbox = ({ row, selectAll, table, }) => {
1058
1719
  var _a;
1059
1720
  const { getState, options: { localization, enableMultiRowSelection, muiSelectCheckboxProps, muiSelectAllCheckboxProps, selectAllMode, }, } = table;
1060
1721
  const { density, isLoading } = getState();
@@ -1092,6 +1753,288 @@ const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
1092
1753
  : row === null || row === void 0 ? void 0 : row.getIsSomeSelected() }, commonProps))) }));
1093
1754
  };
1094
1755
 
1756
+ const useMRT_DisplayColumns = ({ creatingRow, columnOrder, grouping, tableOptions, }) => {
1757
+ var _a, _b;
1758
+ return react.useMemo(() => {
1759
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
1760
+ return [
1761
+ ((_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 }) => (jsxRuntime.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' }),
1762
+ (((_e = (_d = tableOptions.state) === null || _d === void 0 ? void 0 : _d.columnOrder) !== null && _e !== void 0 ? _e : columnOrder).includes('mrt-row-actions') ||
1763
+ (creatingRow && tableOptions.createDisplayMode === 'row')) && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row, table }) => (jsxRuntime.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' }),
1764
+ ((_h = (_g = tableOptions.state) === null || _g === void 0 ? void 0 : _g.columnOrder) !== null && _h !== void 0 ? _h : columnOrder).includes('mrt-row-expand') &&
1765
+ 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 }) => (jsxRuntime.jsx(MRT_ExpandButton, { row: row, table: table })), Header: tableOptions.enableExpandAll
1766
+ ? ({ table }) => jsxRuntime.jsx(MRT_ExpandAllButton, { table: table })
1767
+ : 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' }),
1768
+ ((_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 }) => (jsxRuntime.jsx(MRT_SelectCheckbox, { row: row, table: table })), Header: tableOptions.enableSelectAll &&
1769
+ tableOptions.enableMultiRowSelection
1770
+ ? ({ table }) => jsxRuntime.jsx(MRT_SelectCheckbox, { selectAll: true, table: table })
1771
+ : 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' }),
1772
+ ((_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' }),
1773
+ ].filter(Boolean);
1774
+ }, [
1775
+ columnOrder,
1776
+ grouping,
1777
+ tableOptions.displayColumnDefOptions,
1778
+ tableOptions.editDisplayMode,
1779
+ tableOptions.enableColumnDragging,
1780
+ tableOptions.enableColumnFilterModes,
1781
+ tableOptions.enableColumnOrdering,
1782
+ tableOptions.enableEditing,
1783
+ tableOptions.enableExpandAll,
1784
+ tableOptions.enableExpanding,
1785
+ tableOptions.enableGrouping,
1786
+ tableOptions.enableRowActions,
1787
+ tableOptions.enableRowDragging,
1788
+ tableOptions.enableRowNumbers,
1789
+ tableOptions.enableRowOrdering,
1790
+ tableOptions.enableRowSelection,
1791
+ tableOptions.enableSelectAll,
1792
+ tableOptions.localization,
1793
+ tableOptions.positionActionsColumn,
1794
+ tableOptions.renderDetailPanel,
1795
+ tableOptions.renderRowActionMenuItems,
1796
+ tableOptions.renderRowActions,
1797
+ (_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.columnOrder,
1798
+ (_b = tableOptions.state) === null || _b === void 0 ? void 0 : _b.grouping,
1799
+ ]);
1800
+ };
1801
+
1802
+ const useMRT_Effects = (table) => {
1803
+ const { getState, options: { enablePagination, rowCount }, } = table;
1804
+ const { globalFilter, isFullScreen, pagination, sorting, isLoading, showSkeletons, } = getState();
1805
+ const isMounted = react.useRef(false);
1806
+ const initialBodyHeight = react.useRef();
1807
+ const previousTop = react.useRef();
1808
+ react.useEffect(() => {
1809
+ if (typeof window !== 'undefined') {
1810
+ initialBodyHeight.current = document.body.style.height;
1811
+ }
1812
+ }, []);
1813
+ react.useEffect(() => {
1814
+ if (isMounted && typeof window !== 'undefined') {
1815
+ if (isFullScreen) {
1816
+ previousTop.current = document.body.getBoundingClientRect().top; //save scroll position
1817
+ document.body.style.height = '100vh'; //hide page scrollbars when table is in full screen mode
1818
+ }
1819
+ else {
1820
+ document.body.style.height = initialBodyHeight.current;
1821
+ if (!previousTop.current)
1822
+ return;
1823
+ //restore scroll position
1824
+ window.scrollTo({
1825
+ top: -1 * previousTop.current,
1826
+ behavior: 'instant',
1827
+ });
1828
+ }
1829
+ }
1830
+ isMounted.current = true;
1831
+ }, [isFullScreen]);
1832
+ //if page index is out of bounds, set it to the last page
1833
+ react.useEffect(() => {
1834
+ if (!enablePagination || isLoading || showSkeletons)
1835
+ return;
1836
+ const { pageIndex, pageSize } = pagination;
1837
+ const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : table.getPrePaginationRowModel().rows.length;
1838
+ const firstVisibleRowIndex = pageIndex * pageSize;
1839
+ if (firstVisibleRowIndex > totalRowCount) {
1840
+ table.setPageIndex(Math.floor(totalRowCount / pageSize));
1841
+ }
1842
+ }, [rowCount, table.getPrePaginationRowModel().rows.length]);
1843
+ //turn off sort when global filter is looking for ranked results
1844
+ const appliedSort = react.useRef(sorting);
1845
+ react.useEffect(() => {
1846
+ if (sorting.length) {
1847
+ appliedSort.current = sorting;
1848
+ }
1849
+ }, [sorting]);
1850
+ react.useEffect(() => {
1851
+ if (!getCanRankRows(table))
1852
+ return;
1853
+ if (globalFilter) {
1854
+ table.setSorting([]);
1855
+ }
1856
+ else {
1857
+ table.setSorting(() => appliedSort.current || []);
1858
+ }
1859
+ }, [globalFilter]);
1860
+ };
1861
+
1862
+ const useMRT_TableInstance = (tableOptions) => {
1863
+ 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;
1864
+ const bottomToolbarRef = react.useRef(null);
1865
+ const editInputRefs = react.useRef({});
1866
+ const filterInputRefs = react.useRef({});
1867
+ const searchInputRef = react.useRef(null);
1868
+ const tableContainerRef = react.useRef(null);
1869
+ const tableHeadCellRefs = react.useRef({});
1870
+ const tablePaperRef = react.useRef(null);
1871
+ const topToolbarRef = react.useRef(null);
1872
+ const initialState = react.useMemo(() => {
1873
+ var _a, _b, _c;
1874
+ const initState = (_a = tableOptions.initialState) !== null && _a !== void 0 ? _a : {};
1875
+ initState.columnOrder =
1876
+ (_b = initState.columnOrder) !== null && _b !== void 0 ? _b : getDefaultColumnOrderIds(tableOptions);
1877
+ initState.globalFilterFn = (_c = tableOptions.globalFilterFn) !== null && _c !== void 0 ? _c : 'fuzzy';
1878
+ return initState;
1879
+ }, []);
1880
+ const [creatingRow, _setCreatingRow] = react.useState((_a = initialState.creatingRow) !== null && _a !== void 0 ? _a : null);
1881
+ const [columnFilterFns, setColumnFilterFns] = react.useState(() => Object.assign({}, ...getAllLeafColumnDefs(tableOptions.columns).map((col) => {
1882
+ var _a, _b, _c, _d;
1883
+ return ({
1884
+ [getColumnId(col)]: col.filterFn instanceof Function
1885
+ ? (_a = col.filterFn.name) !== null && _a !== void 0 ? _a : 'custom'
1886
+ : (_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),
1887
+ });
1888
+ })));
1889
+ const [columnOrder, setColumnOrder] = react.useState((_b = initialState.columnOrder) !== null && _b !== void 0 ? _b : []);
1890
+ const [density, setDensity] = react.useState((_c = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _c !== void 0 ? _c : 'comfortable');
1891
+ const [draggingColumn, setDraggingColumn] = react.useState((_d = initialState.draggingColumn) !== null && _d !== void 0 ? _d : null);
1892
+ const [draggingRow, setDraggingRow] = react.useState((_e = initialState.draggingRow) !== null && _e !== void 0 ? _e : null);
1893
+ const [editingCell, setEditingCell] = react.useState((_f = initialState.editingCell) !== null && _f !== void 0 ? _f : null);
1894
+ const [editingRow, setEditingRow] = react.useState((_g = initialState.editingRow) !== null && _g !== void 0 ? _g : null);
1895
+ const [globalFilterFn, setGlobalFilterFn] = react.useState((_h = initialState.globalFilterFn) !== null && _h !== void 0 ? _h : 'fuzzy');
1896
+ const [grouping, setGrouping] = react.useState((_j = initialState.grouping) !== null && _j !== void 0 ? _j : []);
1897
+ const [hoveredColumn, setHoveredColumn] = react.useState((_k = initialState.hoveredColumn) !== null && _k !== void 0 ? _k : null);
1898
+ const [hoveredRow, setHoveredRow] = react.useState((_l = initialState.hoveredRow) !== null && _l !== void 0 ? _l : null);
1899
+ const [isFullScreen, setIsFullScreen] = react.useState((_m = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _m !== void 0 ? _m : false);
1900
+ const [showAlertBanner, setShowAlertBanner] = react.useState((_p = (_o = tableOptions.initialState) === null || _o === void 0 ? void 0 : _o.showAlertBanner) !== null && _p !== void 0 ? _p : false);
1901
+ const [showColumnFilters, setShowColumnFilters] = react.useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _q !== void 0 ? _q : false);
1902
+ const [showGlobalFilter, setShowGlobalFilter] = react.useState((_r = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _r !== void 0 ? _r : false);
1903
+ const [showToolbarDropZone, setShowToolbarDropZone] = react.useState((_s = initialState === null || initialState === void 0 ? void 0 : initialState.showToolbarDropZone) !== null && _s !== void 0 ? _s : false);
1904
+ const displayColumns = useMRT_DisplayColumns({
1905
+ columnOrder,
1906
+ creatingRow,
1907
+ grouping,
1908
+ tableOptions,
1909
+ });
1910
+ const columnDefs = react.useMemo(() => {
1911
+ var _a, _b, _c;
1912
+ return prepareColumns({
1913
+ aggregationFns: tableOptions.aggregationFns,
1914
+ columnDefs: [...displayColumns, ...tableOptions.columns],
1915
+ columnFilterFns: (_b = (_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.columnFilterFns) !== null && _b !== void 0 ? _b : columnFilterFns,
1916
+ defaultDisplayColumn: (_c = tableOptions.defaultDisplayColumn) !== null && _c !== void 0 ? _c : {},
1917
+ filterFns: tableOptions.filterFns,
1918
+ sortingFns: tableOptions.sortingFns,
1919
+ });
1920
+ }, [
1921
+ columnFilterFns,
1922
+ displayColumns,
1923
+ tableOptions.columns,
1924
+ (_t = tableOptions.state) === null || _t === void 0 ? void 0 : _t.columnFilterFns,
1925
+ ]);
1926
+ const data = react.useMemo(() => {
1927
+ var _a, _b, _c, _d, _e;
1928
+ return (((_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.isLoading) || ((_b = tableOptions.state) === null || _b === void 0 ? void 0 : _b.showSkeletons)) &&
1929
+ !tableOptions.data.length
1930
+ ? [
1931
+ ...Array(((_d = (_c = tableOptions.state) === null || _c === void 0 ? void 0 : _c.pagination) === null || _d === void 0 ? void 0 : _d.pageSize) ||
1932
+ ((_e = initialState === null || initialState === void 0 ? void 0 : initialState.pagination) === null || _e === void 0 ? void 0 : _e.pageSize) ||
1933
+ 10).fill(null),
1934
+ ].map(() => Object.assign({}, ...getAllLeafColumnDefs(tableOptions.columns).map((col) => ({
1935
+ [getColumnId(col)]: null,
1936
+ }))))
1937
+ : tableOptions.data;
1938
+ }, [
1939
+ tableOptions.data,
1940
+ (_u = tableOptions.state) === null || _u === void 0 ? void 0 : _u.isLoading,
1941
+ (_v = tableOptions.state) === null || _v === void 0 ? void 0 : _v.showSkeletons,
1942
+ ]);
1943
+ //@ts-ignore
1944
+ const table = reactTable.useReactTable(Object.assign(Object.assign({ getCoreRowModel: reactTable.getCoreRowModel(), getExpandedRowModel: tableOptions.enableExpanding || tableOptions.enableGrouping
1945
+ ? reactTable.getExpandedRowModel()
1946
+ : undefined, getFacetedMinMaxValues: tableOptions.enableFacetedValues
1947
+ ? reactTable.getFacetedMinMaxValues()
1948
+ : undefined, getFacetedRowModel: tableOptions.enableFacetedValues
1949
+ ? reactTable.getFacetedRowModel()
1950
+ : undefined, getFacetedUniqueValues: tableOptions.enableFacetedValues
1951
+ ? reactTable.getFacetedUniqueValues()
1952
+ : undefined, getFilteredRowModel: tableOptions.enableColumnFilters ||
1953
+ tableOptions.enableGlobalFilter ||
1954
+ tableOptions.enableFilters
1955
+ ? reactTable.getFilteredRowModel()
1956
+ : undefined, getGroupedRowModel: tableOptions.enableGrouping
1957
+ ? reactTable.getGroupedRowModel()
1958
+ : undefined, getPaginationRowModel: tableOptions.enablePagination
1959
+ ? reactTable.getPaginationRowModel()
1960
+ : undefined, getSortedRowModel: tableOptions.enableSorting
1961
+ ? reactTable.getSortedRowModel()
1962
+ : undefined, onColumnOrderChange: setColumnOrder, onGroupingChange: setGrouping, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows }, tableOptions), {
1963
+ //@ts-ignore
1964
+ 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,
1965
+ columnFilterFns,
1966
+ columnOrder,
1967
+ density,
1968
+ draggingColumn,
1969
+ draggingRow,
1970
+ editingCell,
1971
+ editingRow,
1972
+ globalFilterFn,
1973
+ grouping,
1974
+ hoveredColumn,
1975
+ hoveredRow,
1976
+ isFullScreen,
1977
+ showAlertBanner,
1978
+ showColumnFilters,
1979
+ showGlobalFilter,
1980
+ showToolbarDropZone }, tableOptions.state) }));
1981
+ // @ts-ignore
1982
+ table.refs = {
1983
+ // @ts-ignore
1984
+ bottomToolbarRef,
1985
+ editInputRefs,
1986
+ filterInputRefs,
1987
+ // @ts-ignore
1988
+ searchInputRef,
1989
+ // @ts-ignore
1990
+ tableContainerRef,
1991
+ tableHeadCellRefs,
1992
+ // @ts-ignore
1993
+ tablePaperRef,
1994
+ // @ts-ignore
1995
+ topToolbarRef,
1996
+ };
1997
+ const setCreatingRow = (row) => {
1998
+ if (row === true) {
1999
+ table.setCreatingRow(createRow(table));
2000
+ }
2001
+ else {
2002
+ _setCreatingRow(row);
2003
+ }
2004
+ };
2005
+ table.setCreatingRow = setCreatingRow;
2006
+ table.setColumnFilterFns =
2007
+ (_x = tableOptions.onColumnFilterFnsChange) !== null && _x !== void 0 ? _x : setColumnFilterFns;
2008
+ table.setDensity = (_y = tableOptions.onDensityChange) !== null && _y !== void 0 ? _y : setDensity;
2009
+ table.setDraggingColumn =
2010
+ (_z = tableOptions.onDraggingColumnChange) !== null && _z !== void 0 ? _z : setDraggingColumn;
2011
+ table.setDraggingRow = (_0 = tableOptions.onDraggingRowChange) !== null && _0 !== void 0 ? _0 : setDraggingRow;
2012
+ table.setEditingCell = (_1 = tableOptions.onEditingCellChange) !== null && _1 !== void 0 ? _1 : setEditingCell;
2013
+ table.setEditingRow = (_2 = tableOptions.onEditingRowChange) !== null && _2 !== void 0 ? _2 : setEditingRow;
2014
+ table.setGlobalFilterFn =
2015
+ (_3 = tableOptions.onGlobalFilterFnChange) !== null && _3 !== void 0 ? _3 : setGlobalFilterFn;
2016
+ table.setHoveredColumn =
2017
+ (_4 = tableOptions.onHoveredColumnChange) !== null && _4 !== void 0 ? _4 : setHoveredColumn;
2018
+ table.setHoveredRow = (_5 = tableOptions.onHoveredRowChange) !== null && _5 !== void 0 ? _5 : setHoveredRow;
2019
+ table.setIsFullScreen = (_6 = tableOptions.onIsFullScreenChange) !== null && _6 !== void 0 ? _6 : setIsFullScreen;
2020
+ table.setShowAlertBanner =
2021
+ (_7 = tableOptions.onShowAlertBannerChange) !== null && _7 !== void 0 ? _7 : setShowAlertBanner;
2022
+ table.setShowColumnFilters =
2023
+ (_8 = tableOptions.onShowColumnFiltersChange) !== null && _8 !== void 0 ? _8 : setShowColumnFilters;
2024
+ table.setShowGlobalFilter =
2025
+ (_9 = tableOptions.onShowGlobalFilterChange) !== null && _9 !== void 0 ? _9 : setShowGlobalFilter;
2026
+ table.setShowToolbarDropZone =
2027
+ (_10 = tableOptions.onShowToolbarDropZoneChange) !== null && _10 !== void 0 ? _10 : setShowToolbarDropZone;
2028
+ useMRT_Effects(table);
2029
+ return table;
2030
+ };
2031
+
2032
+ const useMaterialReactTable = (tableOptions) => {
2033
+ const parsedTableOptions = useMRT_TableOptions(tableOptions);
2034
+ const tableInstance = useMRT_TableInstance(parsedTableOptions);
2035
+ return tableInstance;
2036
+ };
2037
+
1095
2038
  const MRT_GlobalFilterTextField = ({ table, }) => {
1096
2039
  var _a;
1097
2040
  const { getState, setGlobalFilter, options: { enableGlobalFilterModes, icons: { SearchIcon, CloseIcon }, localization, manualFiltering, muiSearchTextFieldProps, }, refs: { searchInputRef }, } = table;
@@ -1215,49 +2158,34 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
1215
2158
  : alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx))), children: [(alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && jsxRuntime.jsx(AlertTitle__default["default"], { children: alertProps.title }), jsxRuntime.jsxs(Box__default["default"], { 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) && (jsxRuntime.jsx("br", {})), selectMessage, selectMessage && groupedByMessage && jsxRuntime.jsx("br", {}), groupedByMessage] })] })) }));
1216
2159
  };
1217
2160
 
1218
- const MRT_FullScreenToggleButton = (_a) => {
2161
+ const MRT_ToggleFullScreenButton = (_a) => {
1219
2162
  var _b;
1220
2163
  var { table } = _a, rest = __rest(_a, ["table"]);
1221
2164
  const { getState, options: { icons: { FullscreenExitIcon, FullscreenIcon }, localization, }, setIsFullScreen, } = table;
1222
2165
  const { isFullScreen } = getState();
2166
+ const [tooltipOpened, setTooltipOpened] = react.useState(false);
1223
2167
  const handleToggleFullScreen = () => {
2168
+ setTooltipOpened(false);
1224
2169
  setIsFullScreen(!isFullScreen);
1225
2170
  };
1226
- return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.showHideFilters, onClick: handleToggleFullScreen }, rest, { title: undefined, children: isFullScreen ? jsxRuntime.jsx(FullscreenExitIcon, {}) : jsxRuntime.jsx(FullscreenIcon, {}) })) }));
2171
+ return (jsxRuntime.jsx(Tooltip__default["default"], { open: tooltipOpened, arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.showHideFilters, onClick: handleToggleFullScreen, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false) }, rest, { title: undefined, children: isFullScreen ? jsxRuntime.jsx(FullscreenExitIcon, {}) : jsxRuntime.jsx(FullscreenIcon, {}) })) }));
1227
2172
  };
1228
2173
 
1229
2174
  const MRT_ColumnPinningButtons = ({ column, table, }) => {
1230
2175
  const { options: { icons: { PushPinIcon }, localization, }, } = table;
1231
- const handlePinColumn = (pinDirection) => {
1232
- column.pin(pinDirection);
1233
- };
1234
- return (jsxRuntime.jsx(Box__default["default"], { sx: { minWidth: '70px', textAlign: 'center' }, children: column.getIsPinned() ? (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.unpin, children: jsxRuntime.jsx(IconButton__default["default"], { onClick: () => handlePinColumn(false), size: "small", children: jsxRuntime.jsx(PushPinIcon, {}) }) })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.pinToLeft, children: jsxRuntime.jsx(IconButton__default["default"], { onClick: () => handlePinColumn('left'), size: "small", children: jsxRuntime.jsx(PushPinIcon, { style: {
1235
- transform: 'rotate(90deg)',
1236
- } }) }) }), jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.pinToRight, children: jsxRuntime.jsx(IconButton__default["default"], { onClick: () => handlePinColumn('right'), size: "small", children: jsxRuntime.jsx(PushPinIcon, { style: {
1237
- transform: 'rotate(-90deg)',
1238
- } }) }) })] })) }));
1239
- };
1240
-
1241
- const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table, }) => {
1242
- var _a;
1243
- const { options: { icons: { DragHandleIcon }, localization, }, } = table;
1244
- return (jsxRuntime.jsx(Tooltip__default["default"], { 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: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ disableRipple: true, draggable: "true", size: "small" }, iconButtonProps, { onClick: (e) => {
1245
- var _a;
1246
- e.stopPropagation();
1247
- (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, e);
1248
- }, 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': {
1249
- backgroundColor: 'transparent',
1250
- opacity: 1,
1251
- }, '&:active': {
1252
- cursor: 'grabbing',
1253
- } }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
1254
- ? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
1255
- : iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined, children: jsxRuntime.jsx(DragHandleIcon, {}) })) }));
2176
+ const handlePinColumn = (pinDirection) => {
2177
+ column.pin(pinDirection);
2178
+ };
2179
+ return (jsxRuntime.jsx(Box__default["default"], { sx: { minWidth: '70px', textAlign: 'center' }, children: column.getIsPinned() ? (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.unpin, children: jsxRuntime.jsx(IconButton__default["default"], { onClick: () => handlePinColumn(false), size: "small", children: jsxRuntime.jsx(PushPinIcon, {}) }) })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.pinToLeft, children: jsxRuntime.jsx(IconButton__default["default"], { onClick: () => handlePinColumn('left'), size: "small", children: jsxRuntime.jsx(PushPinIcon, { style: {
2180
+ transform: 'rotate(90deg)',
2181
+ } }) }) }), jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.pinToRight, children: jsxRuntime.jsx(IconButton__default["default"], { onClick: () => handlePinColumn('right'), size: "small", children: jsxRuntime.jsx(PushPinIcon, { style: {
2182
+ transform: 'rotate(-90deg)',
2183
+ } }) }) })] })) }));
1256
2184
  };
1257
2185
 
1258
2186
  const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredColumn, column, table, }) => {
1259
2187
  var _a;
1260
- const { getState, options: { enableColumnOrdering, enableHiding, enablePinning, localization, }, setColumnOrder, } = table;
2188
+ const { getState, options: { enableColumnOrdering, enableHiding, enableColumnPinning, localization, }, setColumnOrder, } = table;
1261
2189
  const { columnOrder } = getState();
1262
2190
  const { columnDef } = column;
1263
2191
  const { columnDefType } = columnDef;
@@ -1313,7 +2241,7 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredCol
1313
2241
  }, children: [columnDefType !== 'group' &&
1314
2242
  enableColumnOrdering &&
1315
2243
  !allColumns.some((col) => col.columnDef.columnDefType === 'group') &&
1316
- (columnDef.enableColumnOrdering !== false ? (jsxRuntime.jsx(MRT_GrabHandleButton, { onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })) : (jsxRuntime.jsx(Box__default["default"], { sx: { width: '28px' } }))), enablePinning &&
2244
+ (columnDef.enableColumnOrdering !== false ? (jsxRuntime.jsx(MRT_GrabHandleButton, { onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })) : (jsxRuntime.jsx(Box__default["default"], { sx: { width: '28px' } }))), enableColumnPinning &&
1317
2245
  (column.getCanPin() ? (jsxRuntime.jsx(MRT_ColumnPinningButtons, { column: column, table: table })) : (jsxRuntime.jsx(Box__default["default"], { sx: { width: '70px' } }))), enableHiding ? (jsxRuntime.jsx(FormControlLabel__default["default"], { componentsProps: {
1318
2246
  typography: {
1319
2247
  sx: {
@@ -1325,7 +2253,7 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredCol
1325
2253
  };
1326
2254
 
1327
2255
  const MRT_ShowHideColumnsMenu = ({ anchorEl, setAnchorEl, table, }) => {
1328
- const { getAllColumns, getAllLeafColumns, getCenterLeafColumns, getIsAllColumnsVisible, getIsSomeColumnsPinned, getIsSomeColumnsVisible, getLeftLeafColumns, getRightLeafColumns, getState, toggleAllColumnsVisible, options: { enableColumnOrdering, enableHiding, enablePinning, localization, }, } = table;
2256
+ const { getAllColumns, getAllLeafColumns, getCenterLeafColumns, getIsAllColumnsVisible, getIsSomeColumnsPinned, getIsSomeColumnsVisible, getLeftLeafColumns, getRightLeafColumns, getState, toggleAllColumnsVisible, options: { enableColumnOrdering, enableHiding, enableColumnPinning, localization, }, } = table;
1329
2257
  const { density, columnOrder, columnPinning } = getState();
1330
2258
  const hideAllColumns = () => {
1331
2259
  getAllLeafColumns()
@@ -1359,7 +2287,7 @@ const MRT_ShowHideColumnsMenu = ({ anchorEl, setAnchorEl, table, }) => {
1359
2287
  justifyContent: 'space-between',
1360
2288
  p: '0.5rem',
1361
2289
  pt: 0,
1362
- }, children: [enableHiding && (jsxRuntime.jsx(Button__default["default"], { disabled: !getIsSomeColumnsVisible(), onClick: hideAllColumns, children: localization.hideAll })), enableColumnOrdering && (jsxRuntime.jsx(Button__default["default"], { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options)), children: localization.resetOrder })), enablePinning && (jsxRuntime.jsx(Button__default["default"], { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true), children: localization.unpinAll })), enableHiding && (jsxRuntime.jsx(Button__default["default"], { disabled: getIsAllColumnsVisible(), onClick: () => toggleAllColumnsVisible(true), children: localization.showAll }))] }), jsxRuntime.jsx(Divider__default["default"], {}), allColumns.map((column, index) => (jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] }));
2290
+ }, children: [enableHiding && (jsxRuntime.jsx(Button__default["default"], { disabled: !getIsSomeColumnsVisible(), onClick: hideAllColumns, children: localization.hideAll })), enableColumnOrdering && (jsxRuntime.jsx(Button__default["default"], { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options)), children: localization.resetOrder })), enableColumnPinning && (jsxRuntime.jsx(Button__default["default"], { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true), children: localization.unpinAll })), enableHiding && (jsxRuntime.jsx(Button__default["default"], { disabled: getIsAllColumnsVisible(), onClick: () => toggleAllColumnsVisible(true), children: localization.showAll }))] }), jsxRuntime.jsx(Divider__default["default"], {}), allColumns.map((column, index) => (jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] }));
1363
2291
  };
1364
2292
 
1365
2293
  const MRT_ShowHideColumnsButton = (_a) => {
@@ -1414,7 +2342,7 @@ const MRT_ToggleGlobalFilterButton = (_a) => {
1414
2342
 
1415
2343
  const MRT_ToolbarInternalButtons = ({ table, }) => {
1416
2344
  var _a;
1417
- const { options: { enableColumnFilters, enableColumnOrdering, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enablePinning, initialState, renderToolbarInternalActions, }, } = table;
2345
+ const { options: { enableColumnFilters, enableColumnOrdering, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enableColumnPinning, initialState, renderToolbarInternalActions, }, } = table;
1418
2346
  return (jsxRuntime.jsx(Box__default["default"], { sx: {
1419
2347
  alignItems: 'center',
1420
2348
  display: 'flex',
@@ -1423,7 +2351,7 @@ const MRT_ToolbarInternalButtons = ({ table, }) => {
1423
2351
  table,
1424
2352
  })) !== null && _a !== void 0 ? _a : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [enableFilters &&
1425
2353
  enableGlobalFilter &&
1426
- !(initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) && (jsxRuntime.jsx(MRT_ToggleGlobalFilterButton, { table: table })), enableFilters && enableColumnFilters && (jsxRuntime.jsx(MRT_ToggleFiltersButton, { table: table })), (enableHiding || enableColumnOrdering || enablePinning) && (jsxRuntime.jsx(MRT_ShowHideColumnsButton, { table: table })), enableDensityToggle && (jsxRuntime.jsx(MRT_ToggleDensePaddingButton, { table: table })), enableFullScreenToggle && (jsxRuntime.jsx(MRT_FullScreenToggleButton, { table: table }))] })) }));
2354
+ !(initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) && (jsxRuntime.jsx(MRT_ToggleGlobalFilterButton, { table: table })), enableFilters && enableColumnFilters && (jsxRuntime.jsx(MRT_ToggleFiltersButton, { table: table })), (enableHiding || enableColumnOrdering || enableColumnPinning) && (jsxRuntime.jsx(MRT_ShowHideColumnsButton, { table: table })), enableDensityToggle && (jsxRuntime.jsx(MRT_ToggleDensePaddingButton, { table: table })), enableFullScreenToggle && (jsxRuntime.jsx(MRT_ToggleFullScreenButton, { table: table }))] })) }));
1427
2355
  };
1428
2356
 
1429
2357
  const MRT_ToolbarDropZone = ({ table, }) => {
@@ -1542,7 +2470,7 @@ const MRT_BottomToolbar = ({ table, }) => {
1542
2470
 
1543
2471
  const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
1544
2472
  var _a;
1545
- const { options: { icons: { MoreVertIcon }, localization, muiTableHeadCellColumnActionsButtonProps, }, } = table;
2473
+ const { options: { icons: { MoreVertIcon }, localization, muiColumnActionsButtonProps, }, } = table;
1546
2474
  const { column } = header;
1547
2475
  const { columnDef } = column;
1548
2476
  const [anchorEl, setAnchorEl] = react.useState(null);
@@ -1551,15 +2479,15 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
1551
2479
  event.preventDefault();
1552
2480
  setAnchorEl(event.currentTarget);
1553
2481
  };
1554
- const mTableHeadCellColumnActionsButtonProps = muiTableHeadCellColumnActionsButtonProps instanceof Function
1555
- ? muiTableHeadCellColumnActionsButtonProps({ column, table })
1556
- : muiTableHeadCellColumnActionsButtonProps;
1557
- const mcTableHeadCellColumnActionsButtonProps = columnDef.muiTableHeadCellColumnActionsButtonProps instanceof Function
1558
- ? columnDef.muiTableHeadCellColumnActionsButtonProps({
2482
+ const mTableHeadCellColumnActionsButtonProps = muiColumnActionsButtonProps instanceof Function
2483
+ ? muiColumnActionsButtonProps({ column, table })
2484
+ : muiColumnActionsButtonProps;
2485
+ const mcTableHeadCellColumnActionsButtonProps = columnDef.muiColumnActionsButtonProps instanceof Function
2486
+ ? columnDef.muiColumnActionsButtonProps({
1559
2487
  column,
1560
2488
  table,
1561
2489
  })
1562
- : columnDef.muiTableHeadCellColumnActionsButtonProps;
2490
+ : columnDef.muiColumnActionsButtonProps;
1563
2491
  const iconButtonProps = Object.assign(Object.assign({}, mTableHeadCellColumnActionsButtonProps), mcTableHeadCellColumnActionsButtonProps);
1564
2492
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { 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: jsxRuntime.jsx(IconButton__default["default"], 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': {
1565
2493
  opacity: 1,
@@ -1570,23 +2498,23 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
1570
2498
 
1571
2499
  const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1572
2500
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1573
- const { options: { enableColumnFilterModes, columnFilterModeOptions, icons: { FilterListIcon, CloseIcon }, localization, manualFiltering, muiTableHeadCellFilterTextFieldProps, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
2501
+ const { options: { enableColumnFilterModes, columnFilterModeOptions, icons: { FilterListIcon, CloseIcon }, localization, manualFiltering, muiFilterTextFieldProps, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
1574
2502
  const { column } = header;
1575
2503
  const { columnDef } = column;
1576
- const mTableHeadCellFilterTextFieldProps = muiTableHeadCellFilterTextFieldProps instanceof Function
1577
- ? muiTableHeadCellFilterTextFieldProps({
2504
+ const mTableHeadCellFilterTextFieldProps = muiFilterTextFieldProps instanceof Function
2505
+ ? muiFilterTextFieldProps({
1578
2506
  column,
1579
2507
  table,
1580
2508
  rangeFilterIndex,
1581
2509
  })
1582
- : muiTableHeadCellFilterTextFieldProps;
1583
- const mcTableHeadCellFilterTextFieldProps = columnDef.muiTableHeadCellFilterTextFieldProps instanceof Function
1584
- ? columnDef.muiTableHeadCellFilterTextFieldProps({
2510
+ : muiFilterTextFieldProps;
2511
+ const mcTableHeadCellFilterTextFieldProps = columnDef.muiFilterTextFieldProps instanceof Function
2512
+ ? columnDef.muiFilterTextFieldProps({
1585
2513
  column,
1586
2514
  table,
1587
2515
  rangeFilterIndex,
1588
2516
  })
1589
- : columnDef.muiTableHeadCellFilterTextFieldProps;
2517
+ : columnDef.muiFilterTextFieldProps;
1590
2518
  const textFieldProps = Object.assign(Object.assign({}, mTableHeadCellFilterTextFieldProps), mcTableHeadCellFilterTextFieldProps);
1591
2519
  const isRangeFilter = columnDef.filterVariant === 'range' || rangeFilterIndex !== undefined;
1592
2520
  const isSelectFilter = columnDef.filterVariant === 'select';
@@ -1616,7 +2544,9 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1616
2544
  const filterSelectOptions = react.useMemo(() => {
1617
2545
  var _a;
1618
2546
  return (_a = columnDef.filterSelectOptions) !== null && _a !== void 0 ? _a : ((isSelectFilter || isMultiSelectFilter) && facetedUniqueValues
1619
- ? Array.from(facetedUniqueValues.keys()).sort((a, b) => a.localeCompare(b))
2547
+ ? Array.from(facetedUniqueValues.keys())
2548
+ .filter((value) => value !== null && value !== undefined)
2549
+ .sort((a, b) => a.localeCompare(b))
1620
2550
  : undefined);
1621
2551
  }, [
1622
2552
  columnDef.filterSelectOptions,
@@ -1764,965 +2694,441 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1764
2694
  text = option;
1765
2695
  }
1766
2696
  else {
1767
- value = option.value;
1768
- text = option.text;
1769
- }
1770
- return (jsxRuntime.jsxs(MenuItem__default["default"], { sx: {
1771
- display: 'flex',
1772
- m: 0,
1773
- alignItems: 'center',
1774
- gap: '0.5rem',
1775
- }, value: value, children: [isMultiSelectFilter && (jsxRuntime.jsx(Checkbox__default["default"], { checked: ((_a = column.getFilterValue()) !== null && _a !== void 0 ? _a : []).includes(value), sx: { mr: '0.5rem' } })), text, ' ', !columnDef.filterSelectOptions &&
1776
- `(${facetedUniqueValues.get(value)})`] }, value));
1777
- })] })), jsxRuntime.jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table, setFilterValue: setFilterValue })] }));
1778
- };
1779
-
1780
- const MRT_FilterRangeFields = ({ header, table }) => {
1781
- return (jsxRuntime.jsxs(Box__default["default"], { sx: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '1rem' }, children: [jsxRuntime.jsx(MRT_FilterTextField, { header: header, rangeFilterIndex: 0, table: table }), jsxRuntime.jsx(MRT_FilterTextField, { header: header, rangeFilterIndex: 1, table: table })] }));
1782
- };
1783
-
1784
- const MRT_FilterCheckbox = ({ column, table }) => {
1785
- var _a, _b, _c;
1786
- const { getState, options: { localization, muiTableHeadCellFilterCheckboxProps }, } = table;
1787
- const { density } = getState();
1788
- const { columnDef } = column;
1789
- const mTableHeadCellFilterCheckboxProps = muiTableHeadCellFilterCheckboxProps instanceof Function
1790
- ? muiTableHeadCellFilterCheckboxProps({
1791
- column,
1792
- table,
1793
- })
1794
- : muiTableHeadCellFilterCheckboxProps;
1795
- const mcTableHeadCellFilterCheckboxProps = columnDef.muiTableHeadCellFilterCheckboxProps instanceof Function
1796
- ? columnDef.muiTableHeadCellFilterCheckboxProps({
1797
- column,
1798
- table,
1799
- })
1800
- : columnDef.muiTableHeadCellFilterCheckboxProps;
1801
- const checkboxProps = Object.assign(Object.assign({}, mTableHeadCellFilterCheckboxProps), mcTableHeadCellFilterCheckboxProps);
1802
- const filterLabel = (_a = localization.filterByColumn) === null || _a === void 0 ? void 0 : _a.replace('{column}', columnDef.header);
1803
- return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_b = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _b !== void 0 ? _b : filterLabel, children: jsxRuntime.jsx(FormControlLabel__default["default"], { control: jsxRuntime.jsx(Checkbox__default["default"], Object.assign({ checked: column.getFilterValue() === 'true', indeterminate: column.getFilterValue() === undefined, color: column.getFilterValue() === undefined ? 'default' : 'primary', size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { onClick: (e) => {
1804
- var _a;
1805
- e.stopPropagation();
1806
- (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
1807
- }, onChange: (e, checked) => {
1808
- var _a;
1809
- column.setFilterValue(column.getFilterValue() === undefined
1810
- ? 'true'
1811
- : column.getFilterValue() === 'true'
1812
- ? 'false'
1813
- : undefined);
1814
- (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onChange) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e, checked);
1815
- }, sx: (theme) => (Object.assign({ height: '2.5rem', width: '2.5rem' }, ((checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx) instanceof Function
1816
- ? checkboxProps.sx(theme)
1817
- : 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 }) }));
1818
- };
1819
-
1820
- const MRT_FilterRangeSlider = ({ header, table }) => {
1821
- var _a, _b;
1822
- const { options: { localization, muiTableHeadCellFilterSliderProps, enableColumnFilterModes, }, refs: { filterInputRefs }, } = table;
1823
- const { column } = header;
1824
- const { columnDef } = column;
1825
- const currentFilterOption = columnDef._filterFn;
1826
- const showChangeModeButton = enableColumnFilterModes && columnDef.enableColumnFilterModes !== false;
1827
- const mTableHeadCellFilterTextFieldProps = muiTableHeadCellFilterSliderProps instanceof Function
1828
- ? muiTableHeadCellFilterSliderProps({
1829
- column,
1830
- table,
1831
- })
1832
- : muiTableHeadCellFilterSliderProps;
1833
- const mcTableHeadCellFilterTextFieldProps = columnDef.muiTableHeadCellFilterSliderProps instanceof Function
1834
- ? columnDef.muiTableHeadCellFilterSliderProps({
1835
- column,
1836
- table,
1837
- })
1838
- : columnDef.muiTableHeadCellFilterSliderProps;
1839
- const sliderProps = Object.assign(Object.assign({}, mTableHeadCellFilterTextFieldProps), mcTableHeadCellFilterTextFieldProps);
1840
- let [min, max] = sliderProps.min !== undefined && sliderProps.max !== undefined
1841
- ? [sliderProps.min, sliderProps.max]
1842
- : (_a = column.getFacetedMinMaxValues()) !== null && _a !== void 0 ? _a : [0, 1];
1843
- //fix potential TanStack Table bugs where min or max is an array
1844
- if (Array.isArray(min))
1845
- min = min[0];
1846
- if (Array.isArray(max))
1847
- max = max[0];
1848
- if (min === null)
1849
- min = 0;
1850
- if (max === null)
1851
- max = 1;
1852
- const [filterValues, setFilterValues] = react.useState([min, max]);
1853
- const columnFilterValue = column.getFilterValue();
1854
- const isMounted = react.useRef(false);
1855
- react.useEffect(() => {
1856
- if (isMounted.current) {
1857
- if (columnFilterValue === undefined) {
1858
- setFilterValues([min, max]);
1859
- }
1860
- else if (Array.isArray(columnFilterValue)) {
1861
- setFilterValues(columnFilterValue);
1862
- }
1863
- }
1864
- isMounted.current = true;
1865
- }, [columnFilterValue, min, max]);
1866
- return (jsxRuntime.jsxs(Stack__default["default"], { children: [jsxRuntime.jsx(Slider__default["default"], Object.assign({ disableSwap: true, min: min, max: max, onChange: (_event, values) => {
1867
- setFilterValues(values);
1868
- }, onChangeCommitted: (_event, value) => {
1869
- if (Array.isArray(value)) {
1870
- if (value[0] <= min && value[1] >= max) {
1871
- //if the user has selected the entire range, remove the filter
1872
- column.setFilterValue(undefined);
1873
- }
1874
- else {
1875
- column.setFilterValue(value);
1876
- }
1877
- }
1878
- }, value: filterValues, valueLabelDisplay: "auto" }, sliderProps, { slotProps: {
1879
- input: {
1880
- ref: (node) => {
1881
- var _a, _b;
1882
- if (node) {
1883
- filterInputRefs.current[`${column.id}-0`] = node;
1884
- // @ts-ignore
1885
- 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) {
1886
- //@ts-ignore
1887
- sliderProps.slotProps.input.ref = node;
1888
- }
1889
- }
1890
- },
1891
- },
1892
- }, 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
1893
- ? sliderProps.sx(theme)
1894
- : sliderProps === null || sliderProps === void 0 ? void 0 : sliderProps.sx))) })), showChangeModeButton ? (jsxRuntime.jsx(FormHelperText__default["default"], { sx: {
1895
- m: '-3px -6px',
1896
- fontSize: '0.75rem',
1897
- lineHeight: '0.8rem',
1898
- whiteSpace: 'nowrap',
1899
- }, children: localization.filterMode.replace('{filterType}',
1900
- // @ts-ignore
1901
- localization[`filter${((_b = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _b === void 0 ? void 0 : _b.toUpperCase()) +
1902
- (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]) })) : null] }));
1903
- };
1904
-
1905
- const MRT_TableHeadCellFilterContainer = ({ header, table }) => {
1906
- const { getState } = table;
1907
- const { showColumnFilters } = getState();
1908
- const { column } = header;
1909
- const { columnDef } = column;
1910
- return (jsxRuntime.jsx(Collapse__default["default"], { in: showColumnFilters, mountOnEnter: true, unmountOnExit: true, children: columnDef.filterVariant === 'checkbox' ? (jsxRuntime.jsx(MRT_FilterCheckbox, { column: column, table: table })) : columnDef.filterVariant === 'range-slider' ? (jsxRuntime.jsx(MRT_FilterRangeSlider, { header: header, table: table })) : columnDef.filterVariant === 'range' ||
1911
- ['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn) ? (jsxRuntime.jsx(MRT_FilterRangeFields, { header: header, table: table })) : (jsxRuntime.jsx(MRT_FilterTextField, { header: header, table: table })) }));
1912
- };
1913
-
1914
- const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
1915
- var _a, _b, _c, _d;
1916
- const { options: { icons: { FilterAltIcon }, localization, }, refs: { filterInputRefs }, setShowColumnFilters, } = table;
1917
- const { column } = header;
1918
- const { columnDef } = column;
1919
- const isRangeFilter = ['range', 'ranger-slider'].includes((_a = columnDef.filterVariant) !== null && _a !== void 0 ? _a : '') ||
1920
- ['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn);
1921
- const currentFilterOption = columnDef._filterFn;
1922
- const filterTooltip = localization.filteringByColumn
1923
- .replace('{column}', String(columnDef.header))
1924
- .replace('{filterType}',
1925
- // @ts-ignore
1926
- localization[`filter${((_b = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _b === void 0 ? void 0 : _b.toUpperCase()) +
1927
- (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`])
1928
- .replace('{filterValue}', `"${Array.isArray(column.getFilterValue())
1929
- ? column.getFilterValue().join(`" ${isRangeFilter ? localization.and : localization.or} "`)
1930
- : column.getFilterValue()}"`)
1931
- .replace('" "', '');
1932
- return (jsxRuntime.jsx(Grow__default["default"], { unmountOnExit: true, in: (!!column.getFilterValue() && !isRangeFilter) ||
1933
- (isRangeFilter && // @ts-ignore
1934
- (!!((_c = column.getFilterValue()) === null || _c === void 0 ? void 0 : _c[0]) || !!((_d = column.getFilterValue()) === null || _d === void 0 ? void 0 : _d[1]))), children: jsxRuntime.jsx(Box__default["default"], { component: "span", sx: { flex: '0 0' }, children: jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, placement: "top", title: filterTooltip, children: jsxRuntime.jsx(IconButton__default["default"], { disableRipple: true, onClick: (event) => {
1935
- setShowColumnFilters(true);
1936
- queueMicrotask(() => {
1937
- var _a, _b;
1938
- (_a = filterInputRefs.current[`${column.id}-0`]) === null || _a === void 0 ? void 0 : _a.focus();
1939
- (_b = filterInputRefs.current[`${column.id}-0`]) === null || _b === void 0 ? void 0 : _b.select();
1940
- });
1941
- event.stopPropagation();
1942
- }, size: "small", sx: {
1943
- height: '12px',
1944
- m: 0,
1945
- opacity: 0.8,
1946
- p: '2px',
1947
- transform: 'scale(0.66)',
1948
- width: '12px',
1949
- }, children: jsxRuntime.jsx(FilterAltIcon, {}) }) }) }) }));
1950
- };
1951
-
1952
- const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
1953
- const { getState, options: { enableColumnOrdering, muiTableHeadCellDragHandleProps }, setColumnOrder, setDraggingColumn, setHoveredColumn, } = table;
1954
- const { columnDef } = column;
1955
- const { hoveredColumn, draggingColumn, columnOrder } = getState();
1956
- const mIconButtonProps = muiTableHeadCellDragHandleProps instanceof Function
1957
- ? muiTableHeadCellDragHandleProps({ column, table })
1958
- : muiTableHeadCellDragHandleProps;
1959
- const mcIconButtonProps = columnDef.muiTableHeadCellDragHandleProps instanceof Function
1960
- ? columnDef.muiTableHeadCellDragHandleProps({ column, table })
1961
- : columnDef.muiTableHeadCellDragHandleProps;
1962
- const iconButtonProps = Object.assign(Object.assign({}, mIconButtonProps), mcIconButtonProps);
1963
- const handleDragStart = (event) => {
1964
- var _a;
1965
- (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1966
- setDraggingColumn(column);
1967
- event.dataTransfer.setDragImage(tableHeadCellRef.current, 0, 0);
1968
- };
1969
- const handleDragEnd = (event) => {
1970
- var _a;
1971
- (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1972
- if ((hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
1973
- column.toggleGrouping();
1974
- }
1975
- else if (enableColumnOrdering &&
1976
- hoveredColumn &&
1977
- (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) !== (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id)) {
1978
- setColumnOrder(reorderColumn(column, hoveredColumn, columnOrder));
1979
- }
1980
- setDraggingColumn(null);
1981
- setHoveredColumn(null);
1982
- };
1983
- return (jsxRuntime.jsx(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
1984
- };
1985
-
1986
- const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
1987
- var _a;
1988
- const { getState, options: { columnResizeMode }, setColumnSizingInfo, } = table;
1989
- const { density } = getState();
1990
- const { column } = header;
1991
- return (jsxRuntime.jsx(Box__default["default"], { className: "Mui-TableHeadCell-ResizeHandle-Wrapper", onDoubleClick: () => {
1992
- setColumnSizingInfo((old) => (Object.assign(Object.assign({}, old), { isResizingColumn: false })));
1993
- column.resetSize();
1994
- }, onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), sx: (theme) => ({
1995
- cursor: 'col-resize',
1996
- mr: density === 'compact' ? '-0.75rem' : '-1rem',
1997
- position: 'absolute',
1998
- right: '4px',
1999
- px: '4px',
2000
- '&:active > hr': {
2001
- backgroundColor: theme.palette.info.main,
2002
- opacity: 1,
2003
- },
2004
- }), style: {
2005
- transform: column.getIsResizing() && columnResizeMode === 'onEnd'
2006
- ? `translateX(${(_a = getState().columnSizingInfo.deltaOffset) !== null && _a !== void 0 ? _a : 0}px)`
2007
- : undefined,
2008
- }, children: jsxRuntime.jsx(Divider__default["default"], { className: "Mui-TableHeadCell-ResizeHandle-Divider", flexItem: true, orientation: "vertical", sx: {
2009
- borderRadius: '2px',
2010
- borderWidth: '2px',
2011
- height: '24px',
2012
- touchAction: 'none',
2013
- transition: column.getIsResizing()
2014
- ? undefined
2015
- : 'all 150ms ease-in-out',
2016
- userSelect: 'none',
2017
- zIndex: 4,
2018
- } }) }));
2019
- };
2020
-
2021
- const MRT_TableHeadCellSortLabel = ({ header, table, tableCellProps, }) => {
2022
- const { getState, options: { icons: { ArrowDownwardIcon }, localization, }, } = table;
2023
- const { column } = header;
2024
- const { columnDef } = column;
2025
- const { sorting } = getState();
2026
- const sortTooltip = column.getIsSorted()
2027
- ? column.getIsSorted() === 'desc'
2028
- ? localization.sortedByColumnDesc.replace('{column}', columnDef.header)
2029
- : localization.sortedByColumnAsc.replace('{column}', columnDef.header)
2030
- : localization.unsorted;
2031
- return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, placement: "top", title: sortTooltip, children: jsxRuntime.jsx(Badge__default["default"], { badgeContent: sorting.length > 1 ? column.getSortIndex() + 1 : 0, overlap: "circular", children: jsxRuntime.jsx(TableSortLabel__default["default"], { "aria-label": sortTooltip, active: !!column.getIsSorted(), direction: column.getIsSorted()
2032
- ? column.getIsSorted()
2033
- : undefined, sx: {
2034
- flex: '0 0',
2035
- width: '2.4ch',
2036
- transform: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) !== 'right'
2037
- ? 'translateX(-0.5ch)'
2038
- : undefined,
2039
- }, IconComponent: ArrowDownwardIcon, onClick: (e) => {
2040
- var _a;
2041
- e.stopPropagation();
2042
- (_a = header.column.getToggleSortingHandler()) === null || _a === void 0 ? void 0 : _a(e);
2043
- } }) }) }));
2697
+ value = option.value;
2698
+ text = option.text;
2699
+ }
2700
+ return (jsxRuntime.jsxs(MenuItem__default["default"], { sx: {
2701
+ display: 'flex',
2702
+ m: 0,
2703
+ alignItems: 'center',
2704
+ gap: '0.5rem',
2705
+ }, value: value, children: [isMultiSelectFilter && (jsxRuntime.jsx(Checkbox__default["default"], { checked: ((_a = column.getFilterValue()) !== null && _a !== void 0 ? _a : []).includes(value), sx: { mr: '0.5rem' } })), text, ' ', !columnDef.filterSelectOptions &&
2706
+ `(${facetedUniqueValues.get(value)})`] }, value));
2707
+ })] })), jsxRuntime.jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table, setFilterValue: setFilterValue })] }));
2044
2708
  };
2045
2709
 
2046
- const MRT_TableHeadCell = ({ header, table }) => {
2047
- var _a, _b, _c, _d, _f, _g;
2048
- const theme = styles.useTheme();
2049
- const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering, enableGrouping, enableMultiSort, layoutMode, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
2050
- const { density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
2051
- const { column } = header;
2710
+ const MRT_FilterRangeFields = ({ header, table, }) => {
2711
+ return (jsxRuntime.jsxs(Box__default["default"], { sx: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '1rem' }, children: [jsxRuntime.jsx(MRT_FilterTextField, { header: header, rangeFilterIndex: 0, table: table }), jsxRuntime.jsx(MRT_FilterTextField, { header: header, rangeFilterIndex: 1, table: table })] }));
2712
+ };
2713
+
2714
+ const MRT_FilterCheckbox = ({ column, table, }) => {
2715
+ var _a, _b, _c;
2716
+ const { getState, options: { localization, muiFilterCheckboxProps }, } = table;
2717
+ const { density } = getState();
2052
2718
  const { columnDef } = column;
2053
- const { columnDefType } = columnDef;
2054
- const mTableHeadCellProps = muiTableHeadCellProps instanceof Function
2055
- ? muiTableHeadCellProps({ column, table })
2056
- : muiTableHeadCellProps;
2057
- const mcTableHeadCellProps = columnDef.muiTableHeadCellProps instanceof Function
2058
- ? columnDef.muiTableHeadCellProps({ column, table })
2059
- : columnDef.muiTableHeadCellProps;
2060
- const tableCellProps = Object.assign(Object.assign({}, mTableHeadCellProps), mcTableHeadCellProps);
2061
- const showColumnActions = (enableColumnActions || columnDef.enableColumnActions) &&
2062
- columnDef.enableColumnActions !== false;
2063
- const showDragHandle = enableColumnDragging !== false &&
2064
- columnDef.enableColumnDragging !== false &&
2065
- (enableColumnDragging ||
2066
- (enableColumnOrdering && columnDef.enableColumnOrdering !== false) ||
2067
- (enableGrouping &&
2068
- columnDef.enableGrouping !== false &&
2069
- !grouping.includes(column.id)));
2070
- const headerPL = react.useMemo(() => {
2071
- let pl = 0;
2072
- if (column.getCanSort())
2073
- pl++;
2074
- if (showColumnActions)
2075
- pl += 1.75;
2076
- if (showDragHandle)
2077
- pl += 1.25;
2078
- return pl;
2079
- }, [showColumnActions, showDragHandle]);
2080
- const draggingBorder = react.useMemo(() => (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
2081
- ? `1px dashed ${theme.palette.text.secondary}`
2082
- : (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
2083
- ? `2px dashed ${theme.palette.primary.main}`
2084
- : undefined, [draggingColumn, hoveredColumn]);
2085
- const draggingBorders = draggingBorder
2086
- ? {
2087
- borderLeft: draggingBorder,
2088
- borderRight: draggingBorder,
2089
- borderTop: draggingBorder,
2090
- }
2091
- : undefined;
2092
- const handleDragEnter = (_e) => {
2093
- if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
2094
- setHoveredColumn(null);
2095
- }
2096
- if (enableColumnOrdering && draggingColumn && columnDefType !== 'group') {
2097
- setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
2098
- }
2099
- };
2100
- const headerElement = (columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) instanceof Function
2101
- ? (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) === null || _a === void 0 ? void 0 : _a.call(columnDef, {
2719
+ const mTableHeadCellFilterCheckboxProps = muiFilterCheckboxProps instanceof Function
2720
+ ? muiFilterCheckboxProps({
2102
2721
  column,
2103
- header,
2104
2722
  table,
2105
2723
  })
2106
- : (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) !== null && _b !== void 0 ? _b : columnDef.header;
2107
- return (jsxRuntime.jsxs(TableCell__default["default"], Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: (node) => {
2108
- if (node) {
2109
- tableHeadCellRefs.current[column.id] = node;
2110
- }
2111
- } }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ flexDirection: layoutMode === 'grid' ? 'column' : undefined, fontWeight: 'bold', overflow: 'visible', p: density === 'compact'
2112
- ? '0.5rem'
2113
- : density === 'comfortable'
2114
- ? columnDefType === 'display'
2115
- ? '0.75rem'
2116
- : '1rem'
2117
- : columnDefType === 'display'
2118
- ? '1rem 1.25rem'
2119
- : '1.5rem', pb: columnDefType === 'display'
2120
- ? 0
2121
- : showColumnFilters || density === 'compact'
2122
- ? '0.4rem'
2123
- : '0.6rem', pt: columnDefType === 'group' || density === 'compact'
2124
- ? '0.25rem'
2125
- : density === 'comfortable'
2126
- ? '.75rem'
2127
- : '1.25rem', userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
2128
- ? 3
2129
- : column.getIsPinned() && columnDefType !== 'group'
2130
- ? 2
2131
- : 1 }, getCommonCellStyles({
2724
+ : muiFilterCheckboxProps;
2725
+ const mcTableHeadCellFilterCheckboxProps = columnDef.muiFilterCheckboxProps instanceof Function
2726
+ ? columnDef.muiFilterCheckboxProps({
2132
2727
  column,
2133
- header,
2134
2728
  table,
2135
- tableCellProps,
2136
- theme,
2137
- })), draggingBorders)), children: [header.isPlaceholder ? null : (jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content", sx: {
2138
- alignItems: 'center',
2139
- display: 'flex',
2140
- flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
2141
- justifyContent: columnDefType === 'group' || (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
2142
- ? 'center'
2143
- : column.getCanResize()
2144
- ? 'space-between'
2145
- : 'flex-start',
2146
- position: 'relative',
2147
- width: '100%',
2148
- }, children: [jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content-Labels", onClick: column.getToggleSortingHandler(), sx: {
2149
- alignItems: 'center',
2150
- cursor: column.getCanSort() && columnDefType !== 'group'
2151
- ? 'pointer'
2152
- : undefined,
2153
- display: 'flex',
2154
- flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
2155
- overflow: columnDefType === 'data' ? 'hidden' : undefined,
2156
- pl: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
2157
- ? `${headerPL}rem`
2158
- : undefined,
2159
- }, children: [jsxRuntime.jsx(Box__default["default"], { className: "Mui-TableHeadCell-Content-Wrapper", sx: {
2160
- minWidth: `${Math.min((_d = (_c = columnDef.header) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0, 5)}ch`,
2161
- overflow: columnDefType === 'data' ? 'hidden' : undefined,
2162
- textOverflow: 'ellipsis',
2163
- whiteSpace: ((_g = (_f = columnDef.header) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 0) < 20 ? 'nowrap' : 'normal',
2164
- '&:hover': {
2165
- textOverflow: 'clip',
2166
- },
2167
- }, title: columnDefType === 'data' ? columnDef.header : undefined, children: headerElement }), column.getCanSort() && (jsxRuntime.jsx(MRT_TableHeadCellSortLabel, { header: header, table: table, tableCellProps: tableCellProps })), column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterLabel, { header: header, table: table }))] }), columnDefType !== 'group' && (jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content-Actions", sx: { whiteSpace: 'nowrap' }, children: [showDragHandle && (jsxRuntime.jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
2168
- current: tableHeadCellRefs.current[column.id],
2169
- } })), showColumnActions && (jsxRuntime.jsx(MRT_TableHeadCellColumnActionsButton, { header: header, table: table }))] })), column.getCanResize() && (jsxRuntime.jsx(MRT_TableHeadCellResizeHandle, { header: header, table: table }))] })), column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }))] })));
2170
- };
2171
-
2172
- const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
2173
- const { options: { layoutMode, muiTableHeadRowProps }, } = table;
2174
- const tableRowProps = muiTableHeadRowProps instanceof Function
2175
- ? muiTableHeadRowProps({ headerGroup, table })
2176
- : muiTableHeadRowProps;
2177
- return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.lighten(theme.palette.background.default, 0.04), boxShadow: `4px 0 8px ${styles.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
2178
- ? tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx(theme)
2179
- : tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))), children: [virtualPaddingLeft ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader) => {
2180
- const header = virtualColumns
2181
- ? headerGroup.headers[headerOrVirtualHeader.index]
2182
- : headerOrVirtualHeader;
2183
- return (jsxRuntime.jsx(MRT_TableHeadCell, { header: header, table: table }, header.id));
2184
- }), virtualPaddingRight ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
2185
- };
2186
-
2187
- const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
2188
- const { getHeaderGroups, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps }, } = table;
2189
- const { isFullScreen } = getState();
2190
- const tableHeadProps = muiTableHeadProps instanceof Function
2191
- ? muiTableHeadProps({ table })
2192
- : muiTableHeadProps;
2193
- const stickyHeader = enableStickyHeader || isFullScreen;
2194
- return (jsxRuntime.jsx(TableHead__default["default"], 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
2195
- ? tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx(theme)
2196
- : tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx))), children: getHeaderGroups().map((headerGroup) => (jsxRuntime.jsx(MRT_TableHeadRow, { headerGroup: headerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, headerGroup.id))) })));
2729
+ })
2730
+ : columnDef.muiFilterCheckboxProps;
2731
+ const checkboxProps = Object.assign(Object.assign({}, mTableHeadCellFilterCheckboxProps), mcTableHeadCellFilterCheckboxProps);
2732
+ const filterLabel = (_a = localization.filterByColumn) === null || _a === void 0 ? void 0 : _a.replace('{column}', columnDef.header);
2733
+ return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_b = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _b !== void 0 ? _b : filterLabel, children: jsxRuntime.jsx(FormControlLabel__default["default"], { control: jsxRuntime.jsx(Checkbox__default["default"], Object.assign({ checked: column.getFilterValue() === 'true', indeterminate: column.getFilterValue() === undefined, color: column.getFilterValue() === undefined ? 'default' : 'primary', size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { onClick: (e) => {
2734
+ var _a;
2735
+ e.stopPropagation();
2736
+ (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
2737
+ }, onChange: (e, checked) => {
2738
+ var _a;
2739
+ column.setFilterValue(column.getFilterValue() === undefined
2740
+ ? 'true'
2741
+ : column.getFilterValue() === 'true'
2742
+ ? 'false'
2743
+ : undefined);
2744
+ (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onChange) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e, checked);
2745
+ }, sx: (theme) => (Object.assign({ height: '2.5rem', width: '2.5rem' }, ((checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx) instanceof Function
2746
+ ? checkboxProps.sx(theme)
2747
+ : 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 }) }));
2197
2748
  };
2198
2749
 
2199
- const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
2200
- var _a, _b, _c;
2201
- const { getState, options: { muiTableBodyCellEditTextFieldProps }, refs: { editInputRefs }, setEditingCell, setEditingRow, } = table;
2202
- const { column, row } = cell;
2750
+ const MRT_FilterRangeSlider = ({ header, table, }) => {
2751
+ var _a, _b;
2752
+ const { options: { localization, muiFilterSliderProps, enableColumnFilterModes }, refs: { filterInputRefs }, } = table;
2753
+ const { column } = header;
2203
2754
  const { columnDef } = column;
2204
- const { editingRow } = getState();
2205
- const [value, setValue] = react.useState(() => cell.getValue());
2206
- const mTableBodyCellEditTextFieldProps = muiTableBodyCellEditTextFieldProps instanceof Function
2207
- ? muiTableBodyCellEditTextFieldProps({ cell, column, row, table })
2208
- : muiTableBodyCellEditTextFieldProps;
2209
- const mcTableBodyCellEditTextFieldProps = columnDef.muiTableBodyCellEditTextFieldProps instanceof Function
2210
- ? columnDef.muiTableBodyCellEditTextFieldProps({
2211
- cell,
2755
+ const currentFilterOption = columnDef._filterFn;
2756
+ const showChangeModeButton = enableColumnFilterModes && columnDef.enableColumnFilterModes !== false;
2757
+ const mFilterSliderProps = muiFilterSliderProps instanceof Function
2758
+ ? muiFilterSliderProps({
2212
2759
  column,
2213
- row,
2214
2760
  table,
2215
2761
  })
2216
- : columnDef.muiTableBodyCellEditTextFieldProps;
2217
- const textFieldProps = Object.assign(Object.assign({}, mTableBodyCellEditTextFieldProps), mcTableBodyCellEditTextFieldProps);
2218
- const isSelectEdit = columnDef.editVariant === 'select';
2219
- const saveRow = (newValue) => {
2220
- if (editingRow) {
2221
- setEditingRow(Object.assign(Object.assign({}, editingRow), { _valuesCache: Object.assign(Object.assign({}, editingRow._valuesCache), { [column.id]: newValue }) }));
2222
- }
2223
- };
2224
- const handleChange = (event) => {
2225
- var _a;
2226
- (_a = textFieldProps.onChange) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
2227
- setValue(event.target.value);
2228
- if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.select) {
2229
- saveRow(event.target.value);
2230
- }
2231
- };
2232
- const handleBlur = (event) => {
2233
- var _a;
2234
- (_a = textFieldProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
2235
- saveRow(value);
2236
- setEditingCell(null);
2237
- };
2238
- const handleEnterKeyDown = (event) => {
2239
- var _a, _b;
2240
- (_a = textFieldProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
2241
- if (event.key === 'Enter') {
2242
- (_b = editInputRefs.current[column.id]) === null || _b === void 0 ? void 0 : _b.blur();
2243
- }
2244
- };
2245
- if (columnDef.Edit) {
2246
- return jsxRuntime.jsx(jsxRuntime.Fragment, { children: (_a = columnDef.Edit) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table }) });
2247
- }
2248
- return (jsxRuntime.jsx(TextField__default["default"], Object.assign({ disabled: (columnDef.enableEditing instanceof Function
2249
- ? columnDef.enableEditing(row)
2250
- : columnDef.enableEditing) === false, fullWidth: true, inputRef: (inputRef) => {
2251
- if (inputRef) {
2252
- editInputRefs.current[column.id] = inputRef;
2253
- if (textFieldProps.inputRef) {
2254
- textFieldProps.inputRef = inputRef;
2255
- }
2256
- }
2257
- }, label: showLabel ? column.columnDef.header : undefined, margin: "none", name: column.id, placeholder: columnDef.header, select: isSelectEdit, value: value, variant: "standard" }, textFieldProps, { onClick: (e) => {
2258
- var _a;
2259
- e.stopPropagation();
2260
- (_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.onClick) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, e);
2261
- }, 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) => {
2262
- let value;
2263
- let text;
2264
- if (typeof option !== 'object') {
2265
- value = option;
2266
- text = option;
2762
+ : muiFilterSliderProps;
2763
+ const mcFilterSliderProps = columnDef.muiFilterSliderProps instanceof Function
2764
+ ? columnDef.muiFilterSliderProps({
2765
+ column,
2766
+ table,
2767
+ })
2768
+ : columnDef.muiFilterSliderProps;
2769
+ const sliderProps = Object.assign(Object.assign({}, mFilterSliderProps), mcFilterSliderProps);
2770
+ let [min, max] = sliderProps.min !== undefined && sliderProps.max !== undefined
2771
+ ? [sliderProps.min, sliderProps.max]
2772
+ : (_a = column.getFacetedMinMaxValues()) !== null && _a !== void 0 ? _a : [0, 1];
2773
+ //fix potential TanStack Table bugs where min or max is an array
2774
+ if (Array.isArray(min))
2775
+ min = min[0];
2776
+ if (Array.isArray(max))
2777
+ max = max[0];
2778
+ if (min === null)
2779
+ min = 0;
2780
+ if (max === null)
2781
+ max = 1;
2782
+ const [filterValues, setFilterValues] = react.useState([min, max]);
2783
+ const columnFilterValue = column.getFilterValue();
2784
+ const isMounted = react.useRef(false);
2785
+ react.useEffect(() => {
2786
+ if (isMounted.current) {
2787
+ if (columnFilterValue === undefined) {
2788
+ setFilterValues([min, max]);
2267
2789
  }
2268
- else {
2269
- value = option.value;
2270
- text = option.text;
2790
+ else if (Array.isArray(columnFilterValue)) {
2791
+ setFilterValues(columnFilterValue);
2271
2792
  }
2272
- return (jsxRuntime.jsx(MenuItem__default["default"], { sx: {
2273
- display: 'flex',
2274
- m: 0,
2275
- alignItems: 'center',
2276
- gap: '0.5rem',
2277
- }, value: value, children: text }, value));
2278
- }) })));
2793
+ }
2794
+ isMounted.current = true;
2795
+ }, [columnFilterValue, min, max]);
2796
+ return (jsxRuntime.jsxs(Stack__default["default"], { children: [jsxRuntime.jsx(Slider__default["default"], Object.assign({ disableSwap: true, min: min, max: max, onChange: (_event, values) => {
2797
+ setFilterValues(values);
2798
+ }, onChangeCommitted: (_event, value) => {
2799
+ if (Array.isArray(value)) {
2800
+ if (value[0] <= min && value[1] >= max) {
2801
+ //if the user has selected the entire range, remove the filter
2802
+ column.setFilterValue(undefined);
2803
+ }
2804
+ else {
2805
+ column.setFilterValue(value);
2806
+ }
2807
+ }
2808
+ }, value: filterValues, valueLabelDisplay: "auto" }, sliderProps, { slotProps: {
2809
+ input: {
2810
+ ref: (node) => {
2811
+ var _a, _b;
2812
+ if (node) {
2813
+ filterInputRefs.current[`${column.id}-0`] = node;
2814
+ // @ts-ignore
2815
+ 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) {
2816
+ //@ts-ignore
2817
+ sliderProps.slotProps.input.ref = node;
2818
+ }
2819
+ }
2820
+ },
2821
+ },
2822
+ }, 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
2823
+ ? sliderProps.sx(theme)
2824
+ : sliderProps === null || sliderProps === void 0 ? void 0 : sliderProps.sx))) })), showChangeModeButton ? (jsxRuntime.jsx(FormHelperText__default["default"], { sx: {
2825
+ m: '-3px -6px',
2826
+ fontSize: '0.75rem',
2827
+ lineHeight: '0.8rem',
2828
+ whiteSpace: 'nowrap',
2829
+ }, children: localization.filterMode.replace('{filterType}',
2830
+ // @ts-ignore
2831
+ localization[`filter${((_b = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _b === void 0 ? void 0 : _b.toUpperCase()) +
2832
+ (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]) })) : null] }));
2279
2833
  };
2280
2834
 
2281
- const MRT_CopyButton = ({ cell, children, table, }) => {
2282
- var _a;
2283
- const { options: { localization, muiTableBodyCellCopyButtonProps }, } = table;
2284
- const { column, row } = cell;
2835
+ const MRT_TableHeadCellFilterContainer = ({ header, table, }) => {
2836
+ const { getState } = table;
2837
+ const { showColumnFilters } = getState();
2838
+ const { column } = header;
2285
2839
  const { columnDef } = column;
2286
- const [copied, setCopied] = react.useState(false);
2287
- const handleCopy = (event, text) => {
2288
- event.stopPropagation();
2289
- navigator.clipboard.writeText(text);
2290
- setCopied(true);
2291
- setTimeout(() => setCopied(false), 4000);
2292
- };
2293
- const mTableBodyCellCopyButtonProps = muiTableBodyCellCopyButtonProps instanceof Function
2294
- ? muiTableBodyCellCopyButtonProps({ cell, column, row, table })
2295
- : muiTableBodyCellCopyButtonProps;
2296
- const mcTableBodyCellCopyButtonProps = columnDef.muiTableBodyCellCopyButtonProps instanceof Function
2297
- ? columnDef.muiTableBodyCellCopyButtonProps({
2298
- cell,
2299
- column,
2300
- row,
2301
- table,
2302
- })
2303
- : columnDef.muiTableBodyCellCopyButtonProps;
2304
- const buttonProps = Object.assign(Object.assign({}, mTableBodyCellCopyButtonProps), mcTableBodyCellCopyButtonProps);
2305
- return (jsxRuntime.jsx(Tooltip__default["default"], { 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: jsxRuntime.jsx(Button__default["default"], Object.assign({ onClick: (e) => handleCopy(e, cell.getValue()), size: "small", type: "button", variant: "text" }, buttonProps, { sx: (theme) => (Object.assign({ backgroundColor: 'transparent', border: 'none', color: 'inherit', cursor: 'copy', fontFamily: 'inherit', fontSize: 'inherit', letterSpacing: 'inherit', m: '-0.25rem', minWidth: 'unset', textAlign: 'inherit', textTransform: 'inherit' }, ((buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx) instanceof Function
2306
- ? buttonProps.sx(theme)
2307
- : buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx))), title: undefined, children: children })) }));
2840
+ return (jsxRuntime.jsx(Collapse__default["default"], { in: showColumnFilters, mountOnEnter: true, unmountOnExit: true, children: columnDef.filterVariant === 'checkbox' ? (jsxRuntime.jsx(MRT_FilterCheckbox, { column: column, table: table })) : columnDef.filterVariant === 'range-slider' ? (jsxRuntime.jsx(MRT_FilterRangeSlider, { header: header, table: table })) : columnDef.filterVariant === 'range' ||
2841
+ ['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn) ? (jsxRuntime.jsx(MRT_FilterRangeFields, { header: header, table: table })) : (jsxRuntime.jsx(MRT_FilterTextField, { header: header, table: table })) }));
2842
+ };
2843
+
2844
+ const MRT_TableHeadCellFilterLabel = ({ header, table, }) => {
2845
+ var _a, _b, _c, _d;
2846
+ const { options: { icons: { FilterAltIcon }, localization, }, refs: { filterInputRefs }, setShowColumnFilters, } = table;
2847
+ const { column } = header;
2848
+ const { columnDef } = column;
2849
+ const isRangeFilter = ['range', 'ranger-slider'].includes((_a = columnDef.filterVariant) !== null && _a !== void 0 ? _a : '') ||
2850
+ ['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn);
2851
+ const currentFilterOption = columnDef._filterFn;
2852
+ const filterTooltip = localization.filteringByColumn
2853
+ .replace('{column}', String(columnDef.header))
2854
+ .replace('{filterType}',
2855
+ // @ts-ignore
2856
+ localization[`filter${((_b = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _b === void 0 ? void 0 : _b.toUpperCase()) +
2857
+ (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`])
2858
+ .replace('{filterValue}', `"${Array.isArray(column.getFilterValue())
2859
+ ? column.getFilterValue().join(`" ${isRangeFilter ? localization.and : localization.or} "`)
2860
+ : column.getFilterValue()}"`)
2861
+ .replace('" "', '');
2862
+ return (jsxRuntime.jsx(Grow__default["default"], { unmountOnExit: true, in: (!!column.getFilterValue() && !isRangeFilter) ||
2863
+ (isRangeFilter && // @ts-ignore
2864
+ (!!((_c = column.getFilterValue()) === null || _c === void 0 ? void 0 : _c[0]) || !!((_d = column.getFilterValue()) === null || _d === void 0 ? void 0 : _d[1]))), children: jsxRuntime.jsx(Box__default["default"], { component: "span", sx: { flex: '0 0' }, children: jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, placement: "top", title: filterTooltip, children: jsxRuntime.jsx(IconButton__default["default"], { disableRipple: true, onClick: (event) => {
2865
+ setShowColumnFilters(true);
2866
+ queueMicrotask(() => {
2867
+ var _a, _b;
2868
+ (_a = filterInputRefs.current[`${column.id}-0`]) === null || _a === void 0 ? void 0 : _a.focus();
2869
+ (_b = filterInputRefs.current[`${column.id}-0`]) === null || _b === void 0 ? void 0 : _b.select();
2870
+ });
2871
+ event.stopPropagation();
2872
+ }, size: "small", sx: {
2873
+ height: '12px',
2874
+ m: 0,
2875
+ opacity: 0.8,
2876
+ p: '2px',
2877
+ transform: 'scale(0.66)',
2878
+ width: '12px',
2879
+ }, children: jsxRuntime.jsx(FilterAltIcon, {}) }) }) }) }));
2308
2880
  };
2309
2881
 
2310
- const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table }) => {
2311
- const { options: { muiTableBodyRowDragHandleProps }, } = table;
2312
- const { row } = cell;
2313
- const iconButtonProps = muiTableBodyRowDragHandleProps instanceof Function
2314
- ? muiTableBodyRowDragHandleProps({ row, table })
2315
- : muiTableBodyRowDragHandleProps;
2882
+ const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
2883
+ const { getState, options: { enableColumnOrdering, muiColumnDragHandleProps }, setColumnOrder, setDraggingColumn, setHoveredColumn, } = table;
2884
+ const { columnDef } = column;
2885
+ const { hoveredColumn, draggingColumn, columnOrder } = getState();
2886
+ const mIconButtonProps = muiColumnDragHandleProps instanceof Function
2887
+ ? muiColumnDragHandleProps({ column, table })
2888
+ : muiColumnDragHandleProps;
2889
+ const mcIconButtonProps = columnDef.muiColumnDragHandleProps instanceof Function
2890
+ ? columnDef.muiColumnDragHandleProps({ column, table })
2891
+ : columnDef.muiColumnDragHandleProps;
2892
+ const iconButtonProps = Object.assign(Object.assign({}, mIconButtonProps), mcIconButtonProps);
2316
2893
  const handleDragStart = (event) => {
2317
2894
  var _a;
2318
2895
  (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
2319
- event.dataTransfer.setDragImage(rowRef.current, 0, 0);
2320
- table.setDraggingRow(row);
2896
+ setDraggingColumn(column);
2897
+ event.dataTransfer.setDragImage(tableHeadCellRef.current, 0, 0);
2321
2898
  };
2322
2899
  const handleDragEnd = (event) => {
2323
2900
  var _a;
2324
2901
  (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
2325
- table.setDraggingRow(null);
2326
- table.setHoveredRow(null);
2902
+ if ((hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
2903
+ column.toggleGrouping();
2904
+ }
2905
+ else if (enableColumnOrdering &&
2906
+ hoveredColumn &&
2907
+ (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) !== (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id)) {
2908
+ setColumnOrder(reorderColumn(column, hoveredColumn, columnOrder));
2909
+ }
2910
+ setDraggingColumn(null);
2911
+ setHoveredColumn(null);
2327
2912
  };
2328
2913
  return (jsxRuntime.jsx(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
2329
2914
  };
2330
2915
 
2331
- const allowedTypes = ['string', 'number'];
2332
- const MRT_TableBodyCellValue = ({ cell, table }) => {
2333
- var _a, _b, _c;
2334
- const { getState, options: { enableFilterMatchHighlighting }, } = table;
2335
- const { column, row } = cell;
2916
+ const MRT_TableHeadCellResizeHandle = ({ header, table, }) => {
2917
+ var _a;
2918
+ const { getState, options: { columnResizeMode }, setColumnSizingInfo, } = table;
2919
+ const { density } = getState();
2920
+ const { column } = header;
2921
+ return (jsxRuntime.jsx(Box__default["default"], { className: "Mui-TableHeadCell-ResizeHandle-Wrapper", onDoubleClick: () => {
2922
+ setColumnSizingInfo((old) => (Object.assign(Object.assign({}, old), { isResizingColumn: false })));
2923
+ column.resetSize();
2924
+ }, onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), sx: (theme) => ({
2925
+ cursor: 'col-resize',
2926
+ mr: density === 'compact' ? '-0.75rem' : '-1rem',
2927
+ position: 'absolute',
2928
+ right: '4px',
2929
+ px: '4px',
2930
+ '&:active > hr': {
2931
+ backgroundColor: theme.palette.info.main,
2932
+ opacity: 1,
2933
+ },
2934
+ }), style: {
2935
+ transform: column.getIsResizing() && columnResizeMode === 'onEnd'
2936
+ ? `translateX(${(_a = getState().columnSizingInfo.deltaOffset) !== null && _a !== void 0 ? _a : 0}px)`
2937
+ : undefined,
2938
+ }, children: jsxRuntime.jsx(Divider__default["default"], { className: "Mui-TableHeadCell-ResizeHandle-Divider", flexItem: true, orientation: "vertical", sx: {
2939
+ borderRadius: '2px',
2940
+ borderWidth: '2px',
2941
+ height: '24px',
2942
+ touchAction: 'none',
2943
+ transition: column.getIsResizing()
2944
+ ? undefined
2945
+ : 'all 150ms ease-in-out',
2946
+ userSelect: 'none',
2947
+ zIndex: 4,
2948
+ } }) }));
2949
+ };
2950
+
2951
+ const MRT_TableHeadCellSortLabel = ({ header, table, tableCellProps, }) => {
2952
+ const { getState, options: { icons: { ArrowDownwardIcon }, localization, }, } = table;
2953
+ const { column } = header;
2336
2954
  const { columnDef } = column;
2337
- const { globalFilter, globalFilterFn } = getState();
2338
- const filterValue = column.getFilterValue();
2339
- let renderedCellValue = cell.getIsAggregated() && columnDef.AggregatedCell
2340
- ? columnDef.AggregatedCell({
2341
- cell,
2342
- column,
2343
- row,
2344
- table,
2345
- })
2346
- : row.getIsGrouped() && !cell.getIsGrouped()
2347
- ? null
2348
- : cell.getIsGrouped() && columnDef.GroupedCell
2349
- ? columnDef.GroupedCell({
2350
- cell,
2351
- column,
2352
- row,
2353
- table,
2354
- })
2355
- : undefined;
2356
- const isGroupedValue = renderedCellValue !== undefined;
2357
- if (!isGroupedValue) {
2358
- renderedCellValue = cell.renderValue();
2359
- }
2360
- if (enableFilterMatchHighlighting &&
2361
- columnDef.enableFilterMatchHighlighting !== false &&
2362
- renderedCellValue &&
2363
- allowedTypes.includes(typeof renderedCellValue) &&
2364
- ((filterValue &&
2365
- allowedTypes.includes(typeof filterValue) &&
2366
- columnDef.filterVariant === 'text') ||
2367
- (globalFilter &&
2368
- allowedTypes.includes(typeof globalFilter) &&
2369
- column.getCanGlobalFilter()))) {
2370
- const chunks = highlightWords__default["default"] === null || highlightWords__default["default"] === void 0 ? void 0 : highlightWords__default["default"]({
2371
- text: renderedCellValue === null || renderedCellValue === void 0 ? void 0 : renderedCellValue.toString(),
2372
- query: ((_a = filterValue !== null && filterValue !== void 0 ? filterValue : globalFilter) !== null && _a !== void 0 ? _a : '').toString(),
2373
- matchExactly: (filterValue ? columnDef._filterFn : globalFilterFn) !== 'fuzzy',
2374
- });
2375
- 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)) {
2376
- renderedCellValue = (jsxRuntime.jsx("span", { "aria-label": renderedCellValue, role: "note", children: (_c = chunks === null || chunks === void 0 ? void 0 : chunks.map(({ key, match, text }) => (jsxRuntime.jsx(Box__default["default"], { "aria-hidden": "true", component: "span", sx: match
2377
- ? {
2378
- backgroundColor: (theme) => theme.palette.mode === 'dark'
2379
- ? styles.darken(theme.palette.warning.dark, 0.25)
2380
- : styles.lighten(theme.palette.warning.light, 0.5),
2381
- borderRadius: '2px',
2382
- color: (theme) => theme.palette.mode === 'dark' ? 'white' : 'black',
2383
- padding: '2px 1px',
2384
- }
2385
- : undefined, children: text }, key)))) !== null && _c !== void 0 ? _c : renderedCellValue }));
2386
- }
2387
- }
2388
- if (columnDef.Cell && !isGroupedValue) {
2389
- renderedCellValue = columnDef.Cell({
2390
- cell,
2391
- renderedCellValue,
2392
- column,
2393
- row,
2394
- table,
2395
- });
2396
- }
2397
- return jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderedCellValue });
2955
+ const { sorting } = getState();
2956
+ const sortTooltip = column.getIsSorted()
2957
+ ? column.getIsSorted() === 'desc'
2958
+ ? localization.sortedByColumnDesc.replace('{column}', columnDef.header)
2959
+ : localization.sortedByColumnAsc.replace('{column}', columnDef.header)
2960
+ : column.getNextSortingOrder() === 'desc'
2961
+ ? localization.sortByColumnDesc.replace('{column}', columnDef.header)
2962
+ : localization.sortByColumnAsc.replace('{column}', columnDef.header);
2963
+ return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, placement: "top", title: sortTooltip, children: jsxRuntime.jsx(Badge__default["default"], { badgeContent: sorting.length > 1 ? column.getSortIndex() + 1 : 0, overlap: "circular", children: jsxRuntime.jsx(TableSortLabel__default["default"], { "aria-label": sortTooltip, active: !!column.getIsSorted(), direction: column.getIsSorted()
2964
+ ? column.getIsSorted()
2965
+ : undefined, sx: {
2966
+ flex: '0 0',
2967
+ width: '2.4ch',
2968
+ transform: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) !== 'right'
2969
+ ? 'translateX(-0.5ch)'
2970
+ : undefined,
2971
+ }, IconComponent: ArrowDownwardIcon, onClick: (e) => {
2972
+ var _a;
2973
+ e.stopPropagation();
2974
+ (_a = header.column.getToggleSortingHandler()) === null || _a === void 0 ? void 0 : _a(e);
2975
+ } }) }) }));
2398
2976
  };
2399
2977
 
2400
- const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, table, virtualCell, }) => {
2401
- var _a, _b, _c, _d;
2978
+ const MRT_TableHeadCell = ({ header, table, }) => {
2979
+ var _a, _b, _c, _d, _f, _g;
2402
2980
  const theme = styles.useTheme();
2403
- const { getState, options: { editingMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, enableRowNumbers, layoutMode, muiTableBodyCellProps, muiTableBodyCellSkeletonProps, rowNumberMode, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
2404
- const { draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, density, isLoading, showSkeletons, } = getState();
2405
- const { column, row } = cell;
2981
+ const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering, enableGrouping, enableMultiSort, layoutMode, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
2982
+ const { density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
2983
+ const { column } = header;
2406
2984
  const { columnDef } = column;
2407
2985
  const { columnDefType } = columnDef;
2408
- const mTableCellBodyProps = muiTableBodyCellProps instanceof Function
2409
- ? muiTableBodyCellProps({ cell, column, row, table })
2410
- : muiTableBodyCellProps;
2411
- const mcTableCellBodyProps = columnDef.muiTableBodyCellProps instanceof Function
2412
- ? columnDef.muiTableBodyCellProps({ cell, column, row, table })
2413
- : columnDef.muiTableBodyCellProps;
2414
- const tableCellProps = Object.assign(Object.assign({}, mTableCellBodyProps), mcTableCellBodyProps);
2415
- const skeletonProps = muiTableBodyCellSkeletonProps instanceof Function
2416
- ? muiTableBodyCellSkeletonProps({ cell, column, row, table })
2417
- : muiTableBodyCellSkeletonProps;
2418
- const [skeletonWidth, setSkeletonWidth] = react.useState(0);
2419
- react.useEffect(() => setSkeletonWidth(isLoading || showSkeletons
2420
- ? columnDefType === 'display'
2421
- ? column.getSize() / 2
2422
- : Math.round(Math.random() * (column.getSize() - column.getSize() / 3) +
2423
- column.getSize() / 3)
2424
- : 100), []);
2425
- const draggingBorders = react.useMemo(() => {
2426
- const isDraggingColumn = (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id;
2427
- const isHoveredColumn = (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id;
2428
- const isDraggingRow = (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id;
2429
- const isHoveredRow = (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id;
2430
- const isFirstColumn = getIsFirstColumn(column, table);
2431
- const isLastColumn = getIsLastColumn(column, table);
2432
- const isLastRow = rowIndex === numRows - 1;
2433
- const borderStyle = isDraggingColumn || isDraggingRow
2434
- ? `1px dashed ${theme.palette.text.secondary} !important`
2435
- : isHoveredColumn || isHoveredRow
2436
- ? `2px dashed ${theme.palette.primary.main} !important`
2437
- : undefined;
2438
- return borderStyle
2439
- ? {
2440
- borderLeft: isDraggingColumn ||
2441
- isHoveredColumn ||
2442
- ((isDraggingRow || isHoveredRow) && isFirstColumn)
2443
- ? borderStyle
2444
- : undefined,
2445
- borderRight: isDraggingColumn ||
2446
- isHoveredColumn ||
2447
- ((isDraggingRow || isHoveredRow) && isLastColumn)
2448
- ? borderStyle
2449
- : undefined,
2450
- borderBottom: isDraggingRow || isHoveredRow || isLastRow
2451
- ? borderStyle
2452
- : undefined,
2453
- borderTop: isDraggingRow || isHoveredRow ? borderStyle : undefined,
2454
- }
2455
- : undefined;
2456
- }, [draggingColumn, draggingRow, hoveredColumn, hoveredRow, rowIndex]);
2457
- const isEditable = (enableEditing instanceof Function ? enableEditing(row) : enableEditing) &&
2458
- (columnDef.enableEditing instanceof Function
2459
- ? columnDef.enableEditing(row)
2460
- : columnDef.enableEditing) !== false;
2461
- const isEditing = isEditable &&
2462
- editingMode !== 'modal' &&
2463
- (editingMode === 'table' ||
2464
- (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id ||
2465
- (editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) === cell.id) &&
2466
- !row.getIsGrouped();
2467
- const handleDoubleClick = (event) => {
2468
- var _a;
2469
- (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDoubleClick) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
2470
- if (isEditable && editingMode === 'cell') {
2471
- setEditingCell(cell);
2472
- queueMicrotask(() => {
2473
- var _a;
2474
- const textField = editInputRefs.current[column.id];
2475
- if (textField) {
2476
- textField.focus();
2477
- (_a = textField.select) === null || _a === void 0 ? void 0 : _a.call(textField);
2478
- }
2479
- });
2986
+ const mTableHeadCellProps = muiTableHeadCellProps instanceof Function
2987
+ ? muiTableHeadCellProps({ column, table })
2988
+ : muiTableHeadCellProps;
2989
+ const mcTableHeadCellProps = columnDef.muiTableHeadCellProps instanceof Function
2990
+ ? columnDef.muiTableHeadCellProps({ column, table })
2991
+ : columnDef.muiTableHeadCellProps;
2992
+ const tableCellProps = Object.assign(Object.assign({}, mTableHeadCellProps), mcTableHeadCellProps);
2993
+ const showColumnActions = (enableColumnActions || columnDef.enableColumnActions) &&
2994
+ columnDef.enableColumnActions !== false;
2995
+ const showDragHandle = enableColumnDragging !== false &&
2996
+ columnDef.enableColumnDragging !== false &&
2997
+ (enableColumnDragging ||
2998
+ (enableColumnOrdering && columnDef.enableColumnOrdering !== false) ||
2999
+ (enableGrouping &&
3000
+ columnDef.enableGrouping !== false &&
3001
+ !grouping.includes(column.id)));
3002
+ const headerPL = react.useMemo(() => {
3003
+ let pl = 0;
3004
+ if (column.getCanSort())
3005
+ pl++;
3006
+ if (showColumnActions)
3007
+ pl += 1.75;
3008
+ if (showDragHandle)
3009
+ pl += 1.25;
3010
+ return pl;
3011
+ }, [showColumnActions, showDragHandle]);
3012
+ const draggingBorder = react.useMemo(() => (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
3013
+ ? `1px dashed ${theme.palette.text.secondary}`
3014
+ : (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
3015
+ ? `2px dashed ${theme.palette.primary.main}`
3016
+ : undefined, [draggingColumn, hoveredColumn]);
3017
+ const draggingBorders = draggingBorder
3018
+ ? {
3019
+ borderLeft: draggingBorder,
3020
+ borderRight: draggingBorder,
3021
+ borderTop: draggingBorder,
2480
3022
  }
2481
- };
2482
- const handleDragEnter = (e) => {
2483
- var _a;
2484
- (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDragEnter) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, e);
3023
+ : undefined;
3024
+ const handleDragEnter = (_e) => {
2485
3025
  if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
2486
3026
  setHoveredColumn(null);
2487
3027
  }
2488
- if (enableColumnOrdering && draggingColumn) {
3028
+ if (enableColumnOrdering && draggingColumn && columnDefType !== 'group') {
2489
3029
  setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
2490
3030
  }
2491
3031
  };
2492
- return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ "data-index": virtualCell === null || virtualCell === void 0 ? void 0 : virtualCell.index, ref: (node) => {
3032
+ const headerElement = (columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) instanceof Function
3033
+ ? (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) === null || _a === void 0 ? void 0 : _a.call(columnDef, {
3034
+ column,
3035
+ header,
3036
+ table,
3037
+ })
3038
+ : (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) !== null && _b !== void 0 ? _b : columnDef.header;
3039
+ return (jsxRuntime.jsxs(TableCell__default["default"], Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: (node) => {
2493
3040
  if (node) {
2494
- measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
3041
+ tableHeadCellRefs.current[column.id] = node;
2495
3042
  }
2496
- } }, 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'
2497
- ? columnDefType === 'display'
2498
- ? '0 0.5rem'
2499
- : '0.5rem'
3043
+ } }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ flexDirection: layoutMode === 'grid' ? 'column' : undefined, fontWeight: 'bold', overflow: 'visible', p: density === 'compact'
3044
+ ? '0.5rem'
2500
3045
  : density === 'comfortable'
2501
3046
  ? columnDefType === 'display'
2502
- ? '0.5rem 0.75rem'
3047
+ ? '0.75rem'
2503
3048
  : '1rem'
2504
3049
  : columnDefType === 'display'
2505
3050
  ? '1rem 1.25rem'
2506
- : '1.5rem', pl: column.id === 'mrt-row-expand'
2507
- ? `${row.depth +
2508
- (density === 'compact'
2509
- ? 0.5
2510
- : density === 'comfortable'
2511
- ? 0.75
2512
- : 1.25)}rem`
2513
- : 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': {
2514
- outline: ['table', 'cell'].includes(editingMode !== null && editingMode !== void 0 ? editingMode : '')
2515
- ? `1px solid ${theme.palette.text.secondary}`
2516
- : undefined,
2517
- outlineOffset: '-1px',
2518
- textOverflow: 'clip',
2519
- } }, getCommonCellStyles({
3051
+ : '1.5rem', pb: columnDefType === 'display'
3052
+ ? 0
3053
+ : showColumnFilters || density === 'compact'
3054
+ ? '0.4rem'
3055
+ : '0.6rem', pt: columnDefType === 'group' || density === 'compact'
3056
+ ? '0.25rem'
3057
+ : density === 'comfortable'
3058
+ ? '.75rem'
3059
+ : '1.25rem', userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
3060
+ ? 3
3061
+ : column.getIsPinned() && columnDefType !== 'group'
3062
+ ? 2
3063
+ : 1 }, getCommonCellStyles({
2520
3064
  column,
3065
+ header,
2521
3066
  table,
2522
- theme,
2523
3067
  tableCellProps,
2524
- })), draggingBorders)), children: jsxRuntime.jsxs(jsxRuntime.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 ? (jsxRuntime.jsx(Skeleton__default["default"], Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : enableRowNumbers &&
2525
- rowNumberMode === 'static' &&
2526
- column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (jsxRuntime.jsx(MRT_TableBodyRowGrabHandle, { cell: cell, rowRef: rowRef, table: table })) : columnDefType === 'display' &&
2527
- (column.id === 'mrt-row-select' ||
2528
- column.id === 'mrt-row-expand' ||
2529
- !row.getIsGrouped()) ? ((_c = columnDef.Cell) === null || _c === void 0 ? void 0 : _c.call(columnDef, {
2530
- cell,
2531
- renderedCellValue: cell.renderValue(),
2532
- column,
2533
- row,
2534
- table,
2535
- })) : isEditing ? (jsxRuntime.jsx(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
2536
- columnDef.enableClickToCopy !== false ? (jsxRuntime.jsx(MRT_CopyButton, { cell: cell, table: table, children: jsxRuntime.jsx(MRT_TableBodyCellValue, { cell: cell, table: table }) })) : (jsxRuntime.jsx(MRT_TableBodyCellValue, { cell: cell, table: table })), cell.getIsGrouped() && !columnDef.GroupedCell && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [" (", (_d = row.subRows) === null || _d === void 0 ? void 0 : _d.length, ")"] }))] }) })));
2537
- };
2538
- const Memo_MRT_TableBodyCell = react.memo(MRT_TableBodyCell, (prev, next) => next.cell === prev.cell);
2539
-
2540
- const MRT_TableDetailPanel = ({ parentRowRef, row, rowIndex, table, virtualRow, }) => {
2541
- const { getVisibleLeafColumns, getState, options: { layoutMode, muiTableBodyRowProps, muiTableDetailPanelProps, renderDetailPanel, }, } = table;
2542
- const { isLoading } = getState();
2543
- const tableRowProps = muiTableBodyRowProps instanceof Function
2544
- ? muiTableBodyRowProps({
2545
- isDetailPanel: true,
2546
- row,
2547
- staticRowIndex: rowIndex,
2548
- table,
2549
- })
2550
- : muiTableBodyRowProps;
2551
- const tableCellProps = muiTableDetailPanelProps instanceof Function
2552
- ? muiTableDetailPanelProps({ row, table })
2553
- : muiTableDetailPanelProps;
2554
- return (jsxRuntime.jsx(TableRow__default["default"], Object.assign({ className: "Mui-TableBodyCell-DetailPanel" }, tableRowProps, { sx: (theme) => {
2555
- var _a, _b;
2556
- return (Object.assign({ display: layoutMode === 'grid' ? 'flex' : 'table-row', position: virtualRow ? 'absolute' : undefined, top: virtualRow
2557
- ? `${(_b = (_a = parentRowRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.height}px`
2558
- : undefined, transform: virtualRow
2559
- ? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
2560
- : undefined, width: '100%', zIndex: virtualRow ? 2 : undefined }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
2561
- ? tableRowProps.sx(theme)
2562
- : tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx)));
2563
- }, children: jsxRuntime.jsx(TableCell__default["default"], Object.assign({ className: "Mui-TableBodyCell-DetailPanel", colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ backgroundColor: virtualRow
2564
- ? styles.lighten(theme.palette.background.default, 0.06)
2565
- : 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
2566
- ? tableCellProps.sx(theme)
2567
- : tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))), children: renderDetailPanel && (jsxRuntime.jsx(Collapse__default["default"], { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: !isLoading && renderDetailPanel({ row, table }) })) })) })));
2568
- };
2569
-
2570
- const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, row, rowIndex, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, virtualRow, }) => {
2571
- const { getState, options: { enableRowOrdering, layoutMode, memoMode, muiTableBodyRowProps, renderDetailPanel, }, setHoveredRow, } = table;
2572
- const { draggingColumn, draggingRow, editingCell, editingRow, hoveredRow } = getState();
2573
- const tableRowProps = muiTableBodyRowProps instanceof Function
2574
- ? muiTableBodyRowProps({ row, staticRowIndex: rowIndex, table })
2575
- : muiTableBodyRowProps;
2576
- const handleDragEnter = (_e) => {
2577
- if (enableRowOrdering && draggingRow) {
2578
- setHoveredRow(row);
2579
- }
2580
- };
2581
- const rowRef = react.useRef(null);
2582
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(TableRow__default["default"], Object.assign({ "data-index": virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.index, onDragEnter: handleDragEnter, selected: row.getIsSelected(), ref: (node) => {
2583
- if (node) {
2584
- rowRef.current = node;
2585
- measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
2586
- }
2587
- } }, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.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': {
2588
- backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false
2589
- ? row.getIsSelected()
2590
- ? `${styles.alpha(theme.palette.primary.main, 0.2)}`
2591
- : theme.palette.mode === 'dark'
2592
- ? `${styles.lighten(theme.palette.background.default, 0.12)}`
2593
- : `${styles.darken(theme.palette.background.default, 0.05)}`
2594
- : undefined,
2595
- } }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
2596
- ? tableRowProps.sx(theme)
2597
- : tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))), style: Object.assign({ transform: virtualRow
2598
- ? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
2599
- : undefined }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style), children: [virtualPaddingLeft ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : row.getVisibleCells()).map((cellOrVirtualCell) => {
2600
- const cell = columnVirtualizer
2601
- ? row.getVisibleCells()[cellOrVirtualCell.index]
2602
- : cellOrVirtualCell;
2603
- const props = {
2604
- cell,
2605
- measureElement: columnVirtualizer === null || columnVirtualizer === void 0 ? void 0 : columnVirtualizer.measureElement,
2606
- numRows,
2607
- rowIndex,
2608
- rowRef,
2609
- table,
2610
- virtualCell: columnVirtualizer
2611
- ? cellOrVirtualCell
2612
- : undefined,
2613
- };
2614
- return memoMode === 'cells' &&
2615
- cell.column.columnDef.columnDefType === 'data' &&
2616
- !draggingColumn &&
2617
- !draggingRow &&
2618
- (editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) !== cell.id &&
2619
- (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) !== row.id ? (jsxRuntime.jsx(Memo_MRT_TableBodyCell, Object.assign({}, props), cell.id)) : (jsxRuntime.jsx(MRT_TableBodyCell, Object.assign({}, props), cell.id));
2620
- }), virtualPaddingRight ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })), renderDetailPanel && !row.getIsGrouped() && (jsxRuntime.jsx(MRT_TableDetailPanel, { parentRowRef: rowRef, row: row, rowIndex: rowIndex, table: table, virtualRow: virtualRow }))] }));
3068
+ theme,
3069
+ })), draggingBorders)), children: [header.isPlaceholder ? null : (jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content", sx: {
3070
+ alignItems: 'center',
3071
+ display: 'flex',
3072
+ flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
3073
+ justifyContent: columnDefType === 'group' || (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
3074
+ ? 'center'
3075
+ : column.getCanResize()
3076
+ ? 'space-between'
3077
+ : 'flex-start',
3078
+ position: 'relative',
3079
+ width: '100%',
3080
+ }, children: [jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content-Labels", onClick: column.getToggleSortingHandler(), sx: {
3081
+ alignItems: 'center',
3082
+ cursor: column.getCanSort() && columnDefType !== 'group'
3083
+ ? 'pointer'
3084
+ : undefined,
3085
+ display: 'flex',
3086
+ flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
3087
+ overflow: columnDefType === 'data' ? 'hidden' : undefined,
3088
+ pl: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
3089
+ ? `${headerPL}rem`
3090
+ : undefined,
3091
+ }, children: [jsxRuntime.jsx(Box__default["default"], { className: "Mui-TableHeadCell-Content-Wrapper", sx: {
3092
+ minWidth: `${Math.min((_d = (_c = columnDef.header) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0, 5)}ch`,
3093
+ overflow: columnDefType === 'data' ? 'hidden' : undefined,
3094
+ textOverflow: 'ellipsis',
3095
+ whiteSpace: ((_g = (_f = columnDef.header) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 0) < 20 ? 'nowrap' : 'normal',
3096
+ '&:hover': {
3097
+ textOverflow: 'clip',
3098
+ },
3099
+ }, title: columnDefType === 'data' ? columnDef.header : undefined, children: headerElement }), column.getCanSort() && (jsxRuntime.jsx(MRT_TableHeadCellSortLabel, { header: header, table: table, tableCellProps: tableCellProps })), column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterLabel, { header: header, table: table }))] }), columnDefType !== 'group' && (jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content-Actions", sx: { whiteSpace: 'nowrap' }, children: [showDragHandle && (jsxRuntime.jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
3100
+ current: tableHeadCellRefs.current[column.id],
3101
+ } })), showColumnActions && (jsxRuntime.jsx(MRT_TableHeadCellColumnActionsButton, { header: header, table: table }))] })), column.getCanResize() && (jsxRuntime.jsx(MRT_TableHeadCellResizeHandle, { header: header, table: table }))] })), column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }))] })));
2621
3102
  };
2622
- const Memo_MRT_TableBodyRow = react.memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row && prev.rowIndex === next.rowIndex);
2623
3103
 
2624
- const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
2625
- var _a, _b, _c, _d;
2626
- 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;
2627
- const { columnFilters, density, expanded, globalFilter, globalFilterFn, pagination, sorting, } = getState();
2628
- const tableBodyProps = muiTableBodyProps instanceof Function
2629
- ? muiTableBodyProps({ table })
2630
- : muiTableBodyProps;
2631
- const vProps_old = virtualizerProps instanceof Function
2632
- ? virtualizerProps({ table })
2633
- : virtualizerProps;
2634
- const vProps = rowVirtualizerProps instanceof Function
2635
- ? rowVirtualizerProps({ table })
2636
- : rowVirtualizerProps;
2637
- const shouldRankResults = react.useMemo(() => !manualExpanding &&
2638
- !manualFiltering &&
2639
- !manualGrouping &&
2640
- !manualSorting &&
2641
- enableGlobalFilterRankedResults &&
2642
- globalFilter &&
2643
- globalFilterFn === 'fuzzy' &&
2644
- expanded !== true &&
2645
- !Object.values(sorting).some(Boolean) &&
2646
- !Object.values(expanded).some(Boolean), [
2647
- enableGlobalFilterRankedResults,
2648
- expanded,
2649
- globalFilter,
2650
- manualExpanding,
2651
- manualFiltering,
2652
- manualGrouping,
2653
- manualSorting,
2654
- sorting,
2655
- ]);
2656
- const rows = react.useMemo(() => {
2657
- if (!shouldRankResults)
2658
- return getRowModel().rows;
2659
- const rankedRows = getPrePaginationRowModel().rows.sort((a, b) => rankGlobalFuzzy(a, b));
2660
- if (enablePagination && !manualPagination) {
2661
- const start = pagination.pageIndex * pagination.pageSize;
2662
- return rankedRows.slice(start, start + pagination.pageSize);
2663
- }
2664
- return rankedRows;
2665
- }, [
2666
- shouldRankResults,
2667
- shouldRankResults ? getPrePaginationRowModel().rows : getRowModel().rows,
2668
- pagination.pageIndex,
2669
- pagination.pageSize,
2670
- ]);
2671
- const rowVirtualizer = enableRowVirtualization
2672
- ? reactVirtual.useVirtualizer(Object.assign(Object.assign({ count: rows.length, estimateSize: () => density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73, getScrollElement: () => tableContainerRef.current, measureElement: typeof window !== 'undefined' &&
2673
- navigator.userAgent.indexOf('Firefox') === -1
2674
- ? (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height
2675
- : undefined, overscan: 4 }, vProps_old), vProps))
2676
- : undefined;
2677
- if (rowVirtualizerInstanceRef && rowVirtualizer) {
2678
- rowVirtualizerInstanceRef.current = rowVirtualizer;
2679
- }
2680
- //deprecated
2681
- if (virtualizerInstanceRef && rowVirtualizer) {
2682
- virtualizerInstanceRef.current = rowVirtualizer;
2683
- }
2684
- const virtualRows = rowVirtualizer
2685
- ? rowVirtualizer.getVirtualItems()
2686
- : undefined;
2687
- return (jsxRuntime.jsx(TableBody__default["default"], Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', height: rowVirtualizer
2688
- ? `${rowVirtualizer.getTotalSize()}px`
2689
- : 'inherit', minHeight: !rows.length ? '100px' : undefined, position: 'relative' }, ((tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx) instanceof Function
2690
- ? tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx(theme)
2691
- : 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 ? (jsxRuntime.jsx("tr", { style: { display: layoutMode === 'grid' ? 'grid' : 'table-row' }, children: jsxRuntime.jsx("td", { colSpan: table.getVisibleLeafColumns().length, style: {
2692
- display: layoutMode === 'grid' ? 'grid' : 'table-cell',
2693
- }, children: (_b = renderEmptyRowsFallback === null || renderEmptyRowsFallback === void 0 ? void 0 : renderEmptyRowsFallback({ table })) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(Typography__default["default"], { sx: {
2694
- color: 'text.secondary',
2695
- fontStyle: 'italic',
2696
- maxWidth: `min(100vw, ${(_d = (_c = tablePaperRef.current) === null || _c === void 0 ? void 0 : _c.clientWidth) !== null && _d !== void 0 ? _d : 360}px)`,
2697
- py: '2rem',
2698
- textAlign: 'center',
2699
- width: '100%',
2700
- }, children: globalFilter || columnFilters.length
2701
- ? localization.noResultsFound
2702
- : localization.noRecordsToDisplay })) }) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: (virtualRows !== null && virtualRows !== void 0 ? virtualRows : rows).map((rowOrVirtualRow, rowIndex) => {
2703
- const row = rowVirtualizer
2704
- ? rows[rowOrVirtualRow.index]
2705
- : rowOrVirtualRow;
2706
- const props = {
2707
- columnVirtualizer,
2708
- measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
2709
- numRows: rows.length,
2710
- row,
2711
- rowIndex: rowVirtualizer ? rowOrVirtualRow.index : rowIndex,
2712
- table,
2713
- virtualColumns,
2714
- virtualPaddingLeft,
2715
- virtualPaddingRight,
2716
- virtualRow: rowVirtualizer
2717
- ? rowOrVirtualRow
2718
- : undefined,
2719
- };
2720
- return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
2721
- }) }))) })));
3104
+ const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
3105
+ const { options: { layoutMode, muiTableHeadRowProps }, } = table;
3106
+ const tableRowProps = muiTableHeadRowProps instanceof Function
3107
+ ? muiTableHeadRowProps({ headerGroup, table })
3108
+ : muiTableHeadRowProps;
3109
+ return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.lighten(theme.palette.background.default, 0.04), boxShadow: `4px 0 8px ${styles.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
3110
+ ? tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx(theme)
3111
+ : tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))), children: [virtualPaddingLeft ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader) => {
3112
+ const header = virtualColumns
3113
+ ? headerGroup.headers[headerOrVirtualHeader.index]
3114
+ : headerOrVirtualHeader;
3115
+ return (jsxRuntime.jsx(MRT_TableHeadCell, { header: header, table: table }, header.id));
3116
+ }), virtualPaddingRight ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
3117
+ };
3118
+
3119
+ const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
3120
+ const { getHeaderGroups, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps }, } = table;
3121
+ const { isFullScreen } = getState();
3122
+ const tableHeadProps = muiTableHeadProps instanceof Function
3123
+ ? muiTableHeadProps({ table })
3124
+ : muiTableHeadProps;
3125
+ const stickyHeader = enableStickyHeader || isFullScreen;
3126
+ return (jsxRuntime.jsx(TableHead__default["default"], 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
3127
+ ? tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx(theme)
3128
+ : tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx))), children: getHeaderGroups().map((headerGroup) => (jsxRuntime.jsx(MRT_TableHeadRow, { headerGroup: headerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, headerGroup.id))) })));
2722
3129
  };
2723
- const Memo_MRT_TableBody = react.memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
2724
3130
 
2725
- const MRT_TableFooterCell = ({ footer, table }) => {
3131
+ const MRT_TableFooterCell = ({ footer, table, }) => {
2726
3132
  var _a, _b, _c;
2727
3133
  const { getState, options: { layoutMode, muiTableFooterCellProps }, } = table;
2728
3134
  const { density } = getState();
@@ -2793,16 +3199,16 @@ const MRT_TableFooter = ({ table, virtualColumns, virtualPaddingLeft, virtualPad
2793
3199
  : tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx))), children: getFooterGroups().map((footerGroup) => (jsxRuntime.jsx(MRT_TableFooterRow, { footerGroup: footerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, footerGroup.id))) })));
2794
3200
  };
2795
3201
 
2796
- const MRT_Table = ({ table }) => {
3202
+ const MRT_Table = ({ table, }) => {
2797
3203
  var _a, _b, _c, _d;
2798
- const { getFlatHeaders, getState, options: { columns, columnVirtualizerInstanceRef, columnVirtualizerProps, enableColumnResizing, enableColumnVirtualization, enablePinning, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, }, refs: { tableContainerRef }, } = table;
3204
+ const { getFlatHeaders, getState, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, columns, enableColumnResizing, enableColumnVirtualization, enableColumnPinning, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, }, refs: { tableContainerRef }, } = table;
2799
3205
  const { columnPinning, columnSizing, columnSizingInfo, columnVisibility, isFullScreen, } = getState();
2800
3206
  const tableProps = muiTableProps instanceof Function
2801
3207
  ? muiTableProps({ table })
2802
3208
  : muiTableProps;
2803
- const vProps = columnVirtualizerProps instanceof Function
2804
- ? columnVirtualizerProps({ table })
2805
- : columnVirtualizerProps;
3209
+ const vProps = columnVirtualizerOptions instanceof Function
3210
+ ? columnVirtualizerOptions({ table })
3211
+ : columnVirtualizerOptions;
2806
3212
  const columnSizeVars = react.useMemo(() => {
2807
3213
  const headers = getFlatHeaders();
2808
3214
  const colSizes = {};
@@ -2824,14 +3230,14 @@ const MRT_Table = ({ table }) => {
2824
3230
  .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 : [];
2825
3231
  return columnsWidths.reduce((a, b) => a + b, 0) / columnsWidths.length;
2826
3232
  }, [table.getRowModel().rows, columnPinning, columnVisibility]);
2827
- const [leftPinnedIndexes, rightPinnedIndexes] = react.useMemo(() => enableColumnVirtualization && enablePinning
3233
+ const [leftPinnedIndexes, rightPinnedIndexes] = react.useMemo(() => enableColumnVirtualization && enableColumnPinning
2828
3234
  ? [
2829
3235
  table.getLeftLeafColumns().map((c) => c.getPinnedIndex()),
2830
3236
  table
2831
3237
  .getRightLeafColumns()
2832
3238
  .map((c) => table.getVisibleLeafColumns().length - c.getPinnedIndex() - 1),
2833
3239
  ]
2834
- : [[], []], [columnPinning, enableColumnVirtualization, enablePinning]);
3240
+ : [[], []], [columnPinning, enableColumnVirtualization, enableColumnPinning]);
2835
3241
  const columnVirtualizer = enableColumnVirtualization
2836
3242
  ? reactVirtual.useVirtualizer(Object.assign({ count: table.getVisibleLeafColumns().length, estimateSize: () => averageColumnWidth, getScrollElement: () => tableContainerRef.current, horizontal: true, overscan: 3, rangeExtractor: react.useCallback((range) => [
2837
3243
  ...new Set([
@@ -2861,15 +3267,60 @@ const MRT_Table = ({ table }) => {
2861
3267
  virtualPaddingLeft,
2862
3268
  virtualPaddingRight,
2863
3269
  };
2864
- return (jsxRuntime.jsxs(Table__default["default"], 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
2865
- ? tableProps.sx(theme)
2866
- : 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 && jsxRuntime.jsx(MRT_TableHead, Object.assign({}, props)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsxRuntime.jsx(Memo_MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))) : (jsxRuntime.jsx(MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))), enableTableFooter && jsxRuntime.jsx(MRT_TableFooter, Object.assign({}, props))] })));
3270
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(Table__default["default"], 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
3271
+ ? tableProps.sx(theme)
3272
+ : 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 && jsxRuntime.jsx(MRT_TableHead, Object.assign({}, props)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsxRuntime.jsx(Memo_MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))) : (jsxRuntime.jsx(MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))), enableTableFooter && jsxRuntime.jsx(MRT_TableFooter, Object.assign({}, props))] })) }));
3273
+ };
3274
+
3275
+ const MRT_EditRowModal = ({ open, table, }) => {
3276
+ var _a;
3277
+ const { getState, options: { localization, onEditingRowCancel, onCreatingRowCancel, renderEditRowModalContent, renderCreateRowModalContent, muiCreateRowModalProps, muiEditRowModalProps, }, setEditingRow, setCreatingRow, } = table;
3278
+ const { creatingRow, editingRow } = getState();
3279
+ const row = (creatingRow !== null && creatingRow !== void 0 ? creatingRow : editingRow);
3280
+ const createModalProps = muiCreateRowModalProps instanceof Function
3281
+ ? muiCreateRowModalProps({ row, table })
3282
+ : muiCreateRowModalProps;
3283
+ const editModalProps = muiEditRowModalProps instanceof Function
3284
+ ? muiEditRowModalProps({ row, table })
3285
+ : muiEditRowModalProps;
3286
+ const dialogProps = Object.assign(Object.assign({}, editModalProps), (creatingRow && createModalProps));
3287
+ const internalEditComponents = row
3288
+ .getAllCells()
3289
+ .filter((cell) => cell.column.columnDef.columnDefType === 'data')
3290
+ .map((cell) => (jsxRuntime.jsx(MRT_EditCellTextField, { cell: cell, table: table }, cell.id)));
3291
+ return (jsxRuntime.jsx(Dialog__default["default"], Object.assign({ fullWidth: true, maxWidth: "xs", onClose: (event, reason) => {
3292
+ var _a;
3293
+ if (creatingRow) {
3294
+ onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
3295
+ setCreatingRow(null);
3296
+ }
3297
+ else {
3298
+ onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
3299
+ setEditingRow(null);
3300
+ }
3301
+ row._valuesCache = {}; //reset values cache
3302
+ (_a = dialogProps.onClose) === null || _a === void 0 ? void 0 : _a.call(dialogProps, event, reason);
3303
+ }, open: open }, dialogProps, { children: (_a = ((creatingRow &&
3304
+ (renderCreateRowModalContent === null || renderCreateRowModalContent === void 0 ? void 0 : renderCreateRowModalContent({
3305
+ row,
3306
+ table,
3307
+ internalEditComponents,
3308
+ }))) ||
3309
+ (renderEditRowModalContent === null || renderEditRowModalContent === void 0 ? void 0 : renderEditRowModalContent({
3310
+ row,
3311
+ table,
3312
+ internalEditComponents,
3313
+ })))) !== null && _a !== void 0 ? _a : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(DialogTitle__default["default"], { sx: { textAlign: 'center' }, children: (creatingRow && localization.create) || localization.edit }), jsxRuntime.jsx(DialogContent__default["default"], { children: jsxRuntime.jsx("form", { onSubmit: (e) => e.preventDefault(), children: jsxRuntime.jsx(Stack__default["default"], { sx: {
3314
+ gap: '24px',
3315
+ paddingTop: '16px',
3316
+ width: '100%',
3317
+ }, children: internalEditComponents }) }) }), jsxRuntime.jsx(DialogActions__default["default"], { sx: { p: '1.25rem' }, children: jsxRuntime.jsx(MRT_EditActionButtons, { row: row, table: table, variant: "text" }) })] })) })));
2867
3318
  };
2868
3319
 
2869
3320
  const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? react.useLayoutEffect : react.useEffect;
2870
- const MRT_TableContainer = ({ table }) => {
2871
- const { getState, options: { enableStickyHeader, muiTableContainerProps }, refs: { tableContainerRef, bottomToolbarRef, topToolbarRef }, } = table;
2872
- const { isFullScreen } = getState();
3321
+ const MRT_TableContainer = ({ table, }) => {
3322
+ const { getState, options: { createDisplayMode, editDisplayMode, enableStickyHeader, muiTableContainerProps, }, refs: { tableContainerRef, bottomToolbarRef, topToolbarRef }, } = table;
3323
+ const { isFullScreen, creatingRow, editingRow, } = getState();
2873
3324
  const [totalToolbarHeight, setTotalToolbarHeight] = react.useState(0);
2874
3325
  const tableContainerProps = muiTableContainerProps instanceof Function
2875
3326
  ? muiTableContainerProps({ table })
@@ -2884,7 +3335,9 @@ const MRT_TableContainer = ({ table }) => {
2884
3335
  : 0;
2885
3336
  setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
2886
3337
  });
2887
- return (jsxRuntime.jsx(TableContainer__default["default"], Object.assign({}, tableContainerProps, { ref: (node) => {
3338
+ const createModalOpen = createDisplayMode === 'modal' && creatingRow;
3339
+ const editModalOpen = editDisplayMode === 'modal' && editingRow;
3340
+ return (jsxRuntime.jsxs(TableContainer__default["default"], Object.assign({}, tableContainerProps, { ref: (node) => {
2888
3341
  if (node) {
2889
3342
  tableContainerRef.current = node;
2890
3343
  if (tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) {
@@ -2898,10 +3351,10 @@ const MRT_TableContainer = ({ table }) => {
2898
3351
  ? tableContainerProps.sx(theme)
2899
3352
  : tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx))), style: Object.assign({ maxHeight: isFullScreen
2900
3353
  ? `calc(100vh - ${totalToolbarHeight}px)`
2901
- : undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), children: jsxRuntime.jsx(MRT_Table, { table: table }) })));
3354
+ : undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), children: [jsxRuntime.jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsxRuntime.jsx(MRT_EditRowModal, { open: true, table: table }))] })));
2902
3355
  };
2903
3356
 
2904
- const MRT_TablePaper = ({ table }) => {
3357
+ const MRT_TablePaper = ({ table, }) => {
2905
3358
  const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
2906
3359
  const { isFullScreen } = getState();
2907
3360
  const tablePaperProps = muiTablePaperProps instanceof Function
@@ -2913,16 +3366,22 @@ const MRT_TablePaper = ({ table }) => {
2913
3366
  //@ts-ignore
2914
3367
  tablePaperProps.ref.current = ref;
2915
3368
  }
2916
- }, sx: (theme) => (Object.assign({ transition: 'all 150ms ease-in-out' }, ((tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx) instanceof Function
3369
+ }, sx: (theme) => (Object.assign({ overflow: 'hidden', transition: 'all 100ms ease-in-out' }, ((tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx) instanceof Function
2917
3370
  ? tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx(theme)
2918
3371
  : tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx))), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), (isFullScreen
2919
3372
  ? {
3373
+ bottom: 0,
2920
3374
  height: '100vh',
3375
+ left: 0,
2921
3376
  margin: 0,
2922
3377
  maxHeight: '100vh',
2923
3378
  maxWidth: '100vw',
2924
3379
  padding: 0,
3380
+ position: 'fixed',
3381
+ right: 0,
3382
+ top: 0,
2925
3383
  width: '100vw',
3384
+ zIndex: 10,
2926
3385
  }
2927
3386
  : {})), children: [enableTopToolbar &&
2928
3387
  (renderTopToolbar instanceof Function
@@ -2933,254 +3392,70 @@ const MRT_TablePaper = ({ table }) => {
2933
3392
  : renderBottomToolbar !== null && renderBottomToolbar !== void 0 ? renderBottomToolbar : jsxRuntime.jsx(MRT_BottomToolbar, { table: table }))] })));
2934
3393
  };
2935
3394
 
2936
- const MRT_EditRowModal = ({ open, row, table, }) => {
2937
- const { options: { localization }, } = table;
2938
- return (jsxRuntime.jsxs(Dialog__default["default"], { open: open, children: [jsxRuntime.jsx(DialogTitle__default["default"], { textAlign: "center", children: localization.edit }), jsxRuntime.jsx(DialogContent__default["default"], { children: jsxRuntime.jsx("form", { onSubmit: (e) => e.preventDefault(), children: jsxRuntime.jsx(Stack__default["default"], { sx: {
2939
- gap: '1.5rem',
2940
- minWidth: { xs: '300px', sm: '360px', md: '400px' },
2941
- pt: '1rem',
2942
- width: '100%',
2943
- }, children: row
2944
- .getAllCells()
2945
- .filter((cell) => cell.column.columnDef.columnDefType === 'data')
2946
- .map((cell) => (jsxRuntime.jsx(MRT_EditCellTextField, { cell: cell, showLabel: true, table: table }, cell.id))) }) }) }), jsxRuntime.jsx(DialogActions__default["default"], { sx: { p: '1.25rem' }, children: jsxRuntime.jsx(MRT_EditActionButtons, { row: row, table: table, variant: "text" }) })] }));
2947
- };
2948
-
2949
- const MRT_TableRoot = (props) => {
2950
- 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;
2951
- const bottomToolbarRef = react.useRef(null);
2952
- const editInputRefs = react.useRef({});
2953
- const filterInputRefs = react.useRef({});
2954
- const searchInputRef = react.useRef(null);
2955
- const tableContainerRef = react.useRef(null);
2956
- const tableHeadCellRefs = react.useRef({});
2957
- const tablePaperRef = react.useRef(null);
2958
- const topToolbarRef = react.useRef(null);
2959
- const initialState = react.useMemo(() => {
2960
- var _a, _b, _c;
2961
- const initState = (_a = props.initialState) !== null && _a !== void 0 ? _a : {};
2962
- initState.columnOrder =
2963
- (_b = initState.columnOrder) !== null && _b !== void 0 ? _b : getDefaultColumnOrderIds(props);
2964
- initState.globalFilterFn = (_c = props.globalFilterFn) !== null && _c !== void 0 ? _c : 'fuzzy';
2965
- return initState;
2966
- }, []);
2967
- const [columnFilterFns, setColumnFilterFns] = react.useState(() => Object.assign({}, ...getAllLeafColumnDefs(props.columns).map((col) => {
2968
- var _a, _b, _c, _d;
2969
- return ({
2970
- [getColumnId(col)]: col.filterFn instanceof Function
2971
- ? (_a = col.filterFn.name) !== null && _a !== void 0 ? _a : 'custom'
2972
- : (_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),
2973
- });
2974
- })));
2975
- const [columnOrder, setColumnOrder] = react.useState((_a = initialState.columnOrder) !== null && _a !== void 0 ? _a : []);
2976
- const [density, setDensity] = react.useState((_b = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _b !== void 0 ? _b : 'comfortable');
2977
- const [draggingColumn, setDraggingColumn] = react.useState((_c = initialState.draggingColumn) !== null && _c !== void 0 ? _c : null);
2978
- const [draggingRow, setDraggingRow] = react.useState((_d = initialState.draggingRow) !== null && _d !== void 0 ? _d : null);
2979
- const [editingCell, setEditingCell] = react.useState((_e = initialState.editingCell) !== null && _e !== void 0 ? _e : null);
2980
- const [editingRow, setEditingRow] = react.useState((_f = initialState.editingRow) !== null && _f !== void 0 ? _f : null);
2981
- const [globalFilterFn, setGlobalFilterFn] = react.useState((_g = initialState.globalFilterFn) !== null && _g !== void 0 ? _g : 'fuzzy');
2982
- const [grouping, setGrouping] = react.useState((_h = initialState.grouping) !== null && _h !== void 0 ? _h : []);
2983
- const [hoveredColumn, setHoveredColumn] = react.useState((_j = initialState.hoveredColumn) !== null && _j !== void 0 ? _j : null);
2984
- const [hoveredRow, setHoveredRow] = react.useState((_k = initialState.hoveredRow) !== null && _k !== void 0 ? _k : null);
2985
- const [isFullScreen, setIsFullScreen] = react.useState((_l = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _l !== void 0 ? _l : false);
2986
- const [showAlertBanner, setShowAlertBanner] = react.useState((_o = (_m = props.initialState) === null || _m === void 0 ? void 0 : _m.showAlertBanner) !== null && _o !== void 0 ? _o : false);
2987
- const [showColumnFilters, setShowColumnFilters] = react.useState((_p = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _p !== void 0 ? _p : false);
2988
- const [showGlobalFilter, setShowGlobalFilter] = react.useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _q !== void 0 ? _q : false);
2989
- const [showToolbarDropZone, setShowToolbarDropZone] = react.useState((_r = initialState === null || initialState === void 0 ? void 0 : initialState.showToolbarDropZone) !== null && _r !== void 0 ? _r : false);
2990
- const displayColumns = react.useMemo(() => {
2991
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
2992
- return [
2993
- ((_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' }),
2994
- ((_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 }) => (jsxRuntime.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' }),
2995
- ((_h = (_g = props.state) === null || _g === void 0 ? void 0 : _g.columnOrder) !== null && _h !== void 0 ? _h : columnOrder).includes('mrt-row-expand') &&
2996
- 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 }) => (jsxRuntime.jsx(MRT_ExpandButton, { row: row, table: table })), Header: props.enableExpandAll
2997
- ? () => jsxRuntime.jsx(MRT_ExpandAllButton, { table: table })
2998
- : 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' }),
2999
- ((_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 }) => (jsxRuntime.jsx(MRT_SelectCheckbox, { row: row, table: table })), Header: props.enableSelectAll && props.enableMultiRowSelection
3000
- ? () => jsxRuntime.jsx(MRT_SelectCheckbox, { selectAll: true, table: table })
3001
- : 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' }),
3002
- ((_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' }),
3003
- ].filter(Boolean);
3004
- }, [
3005
- columnOrder,
3006
- grouping,
3007
- props.displayColumnDefOptions,
3008
- props.editingMode,
3009
- props.enableColumnDragging,
3010
- props.enableColumnFilterModes,
3011
- props.enableColumnOrdering,
3012
- props.enableEditing,
3013
- props.enableExpandAll,
3014
- props.enableExpanding,
3015
- props.enableGrouping,
3016
- props.enableRowActions,
3017
- props.enableRowDragging,
3018
- props.enableRowNumbers,
3019
- props.enableRowOrdering,
3020
- props.enableRowSelection,
3021
- props.enableSelectAll,
3022
- props.localization,
3023
- props.positionActionsColumn,
3024
- props.renderDetailPanel,
3025
- props.renderRowActionMenuItems,
3026
- props.renderRowActions,
3027
- (_s = props.state) === null || _s === void 0 ? void 0 : _s.columnOrder,
3028
- (_t = props.state) === null || _t === void 0 ? void 0 : _t.grouping,
3029
- ]);
3030
- const columnDefs = react.useMemo(() => {
3031
- var _a, _b, _c;
3032
- return prepareColumns({
3033
- aggregationFns: props.aggregationFns,
3034
- columnDefs: [...displayColumns, ...props.columns],
3035
- columnFilterFns: (_b = (_a = props.state) === null || _a === void 0 ? void 0 : _a.columnFilterFns) !== null && _b !== void 0 ? _b : columnFilterFns,
3036
- defaultDisplayColumn: (_c = props.defaultDisplayColumn) !== null && _c !== void 0 ? _c : {},
3037
- filterFns: props.filterFns,
3038
- sortingFns: props.sortingFns,
3039
- });
3040
- }, [
3041
- columnFilterFns,
3042
- displayColumns,
3043
- props.columns,
3044
- (_u = props.state) === null || _u === void 0 ? void 0 : _u.columnFilterFns,
3045
- ]);
3046
- const data = react.useMemo(() => {
3047
- var _a, _b, _c, _d, _e;
3048
- return (((_a = props.state) === null || _a === void 0 ? void 0 : _a.isLoading) || ((_b = props.state) === null || _b === void 0 ? void 0 : _b.showSkeletons)) &&
3049
- !props.data.length
3050
- ? [
3051
- ...Array(((_d = (_c = props.state) === null || _c === void 0 ? void 0 : _c.pagination) === null || _d === void 0 ? void 0 : _d.pageSize) ||
3052
- ((_e = initialState === null || initialState === void 0 ? void 0 : initialState.pagination) === null || _e === void 0 ? void 0 : _e.pageSize) ||
3053
- 10).fill(null),
3054
- ].map(() => Object.assign({}, ...getAllLeafColumnDefs(props.columns).map((col) => ({
3055
- [getColumnId(col)]: null,
3056
- }))))
3057
- : props.data;
3058
- }, [props.data, (_v = props.state) === null || _v === void 0 ? void 0 : _v.isLoading, (_w = props.state) === null || _w === void 0 ? void 0 : _w.showSkeletons]);
3059
- //@ts-ignore
3060
- const table = Object.assign(Object.assign({}, reactTable.useReactTable(Object.assign(Object.assign({ getCoreRowModel: reactTable.getCoreRowModel(), getExpandedRowModel: props.enableExpanding || props.enableGrouping
3061
- ? reactTable.getExpandedRowModel()
3062
- : undefined, getFacetedMinMaxValues: props.enableFacetedValues
3063
- ? reactTable.getFacetedMinMaxValues()
3064
- : undefined, getFacetedRowModel: props.enableFacetedValues
3065
- ? reactTable.getFacetedRowModel()
3066
- : undefined, getFacetedUniqueValues: props.enableFacetedValues
3067
- ? reactTable.getFacetedUniqueValues()
3068
- : undefined, getFilteredRowModel: props.enableColumnFilters ||
3069
- props.enableGlobalFilter ||
3070
- props.enableFilters
3071
- ? reactTable.getFilteredRowModel()
3072
- : undefined, getGroupedRowModel: props.enableGrouping
3073
- ? reactTable.getGroupedRowModel()
3074
- : undefined, getPaginationRowModel: props.enablePagination
3075
- ? reactTable.getPaginationRowModel()
3076
- : undefined, getSortedRowModel: props.enableSorting ? reactTable.getSortedRowModel() : undefined, onColumnOrderChange: setColumnOrder, onGroupingChange: setGrouping, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows }, props), {
3077
- //@ts-ignore
3078
- 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,
3079
- columnOrder,
3080
- density,
3081
- draggingColumn,
3082
- draggingRow,
3083
- editingCell,
3084
- editingRow,
3085
- globalFilterFn,
3086
- grouping,
3087
- hoveredColumn,
3088
- hoveredRow,
3089
- isFullScreen,
3090
- showAlertBanner,
3091
- showColumnFilters,
3092
- showGlobalFilter,
3093
- showToolbarDropZone }, props.state) }))), { refs: {
3094
- bottomToolbarRef,
3095
- editInputRefs,
3096
- filterInputRefs,
3097
- searchInputRef,
3098
- tableContainerRef,
3099
- tableHeadCellRefs,
3100
- tablePaperRef,
3101
- topToolbarRef,
3102
- }, 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 });
3103
- if (props.tableFeatures) {
3104
- props.tableFeatures.forEach((feature) => {
3105
- Object.assign(table, feature(table));
3106
- });
3107
- }
3108
- if (props.tableInstanceRef) {
3109
- props.tableInstanceRef.current = table;
3110
- }
3111
- const initialBodyHeight = react.useRef();
3112
- react.useEffect(() => {
3113
- if (typeof window !== 'undefined') {
3114
- initialBodyHeight.current = document.body.style.height;
3115
- }
3116
- }, []);
3117
- react.useEffect(() => {
3118
- if (typeof window !== 'undefined') {
3119
- if (table.getState().isFullScreen) {
3120
- document.body.style.height = '100vh';
3121
- }
3122
- else {
3123
- document.body.style.height = initialBodyHeight.current;
3124
- }
3125
- }
3126
- }, [table.getState().isFullScreen]);
3127
- //if page index is out of bounds, set it to the last page
3128
- react.useEffect(() => {
3129
- var _a;
3130
- const { pageIndex, pageSize } = table.getState().pagination;
3131
- const totalRowCount = (_a = props.rowCount) !== null && _a !== void 0 ? _a : table.getPrePaginationRowModel().rows.length;
3132
- const firstVisibleRowIndex = pageIndex * pageSize;
3133
- if (firstVisibleRowIndex > totalRowCount) {
3134
- table.setPageIndex(Math.floor(totalRowCount / pageSize));
3135
- }
3136
- }, [props.rowCount, table.getPrePaginationRowModel().rows.length]);
3137
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Dialog__default["default"], { PaperComponent: Box__default["default"], TransitionComponent: !props.enableRowVirtualization ? Grow__default["default"] : undefined, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => table.setIsFullScreen(false), open: table.getState().isFullScreen, transitionDuration: 400, children: jsxRuntime.jsx(MRT_TablePaper, { table: table }) }), !table.getState().isFullScreen && (jsxRuntime.jsx(MRT_TablePaper, { table: table })), editingRow && props.editingMode === 'modal' && (jsxRuntime.jsx(MRT_EditRowModal, { row: editingRow, table: table, open: true }))] }));
3138
- };
3139
-
3140
- const MaterialReactTable = (_a) => {
3141
- var _b;
3142
- 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"]);
3143
- const _icons = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
3144
- const _localization = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
3145
- const _aggregationFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns)), []);
3146
- const _filterFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_FilterFns), filterFns)), []);
3147
- const _sortingFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
3148
- const _defaultColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), [defaultColumn]);
3149
- const _defaultDisplayColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), [defaultDisplayColumn]);
3150
- if (rest.enableRowVirtualization || rest.enableColumnVirtualization) {
3151
- layoutMode = 'grid';
3152
- }
3153
- if (rest.enableRowVirtualization) {
3154
- enableStickyHeader = true;
3395
+ const isTableInstanceProp = (props) => props.table !== undefined;
3396
+ const MaterialReactTable = (props) => {
3397
+ let table;
3398
+ if (isTableInstanceProp(props)) {
3399
+ table = props.table;
3155
3400
  }
3156
- if (enablePagination === false && manualPagination === undefined) {
3157
- manualPagination = true;
3158
- }
3159
- if (!((_b = rest.data) === null || _b === void 0 ? void 0 : _b.length)) {
3160
- manualFiltering = true;
3161
- manualGrouping = true;
3162
- manualPagination = true;
3163
- manualSorting = true;
3401
+ else {
3402
+ table = useMaterialReactTable(props);
3164
3403
  }
3165
- return (jsxRuntime.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)));
3404
+ return jsxRuntime.jsx(MRT_TablePaper, { table: table });
3166
3405
  };
3167
3406
 
3168
3407
  exports.MRT_AggregationFns = MRT_AggregationFns;
3169
3408
  exports.MRT_BottomToolbar = MRT_BottomToolbar;
3409
+ exports.MRT_ColumnActionMenu = MRT_ColumnActionMenu;
3410
+ exports.MRT_ColumnPinningButtons = MRT_ColumnPinningButtons;
3170
3411
  exports.MRT_CopyButton = MRT_CopyButton;
3412
+ exports.MRT_DefaultColumn = MRT_DefaultColumn;
3413
+ exports.MRT_DefaultDisplayColumn = MRT_DefaultDisplayColumn;
3171
3414
  exports.MRT_EditActionButtons = MRT_EditActionButtons;
3415
+ exports.MRT_EditCellTextField = MRT_EditCellTextField;
3416
+ exports.MRT_EditRowModal = MRT_EditRowModal;
3417
+ exports.MRT_ExpandAllButton = MRT_ExpandAllButton;
3172
3418
  exports.MRT_ExpandButton = MRT_ExpandButton;
3419
+ exports.MRT_FilterCheckbox = MRT_FilterCheckbox;
3173
3420
  exports.MRT_FilterFns = MRT_FilterFns;
3174
3421
  exports.MRT_FilterOptionMenu = MRT_FilterOptionMenu;
3175
- exports.MRT_FullScreenToggleButton = MRT_FullScreenToggleButton;
3422
+ exports.MRT_FilterRangeFields = MRT_FilterRangeFields;
3423
+ exports.MRT_FilterRangeSlider = MRT_FilterRangeSlider;
3424
+ exports.MRT_FilterTextField = MRT_FilterTextField;
3176
3425
  exports.MRT_GlobalFilterTextField = MRT_GlobalFilterTextField;
3177
3426
  exports.MRT_GrabHandleButton = MRT_GrabHandleButton;
3427
+ exports.MRT_LinearProgressBar = MRT_LinearProgressBar;
3428
+ exports.MRT_RowActionMenu = MRT_RowActionMenu;
3429
+ exports.MRT_SelectCheckbox = MRT_SelectCheckbox;
3178
3430
  exports.MRT_ShowHideColumnsButton = MRT_ShowHideColumnsButton;
3431
+ exports.MRT_ShowHideColumnsMenu = MRT_ShowHideColumnsMenu;
3432
+ exports.MRT_ShowHideColumnsMenuItems = MRT_ShowHideColumnsMenuItems;
3179
3433
  exports.MRT_SortingFns = MRT_SortingFns;
3434
+ exports.MRT_Table = MRT_Table;
3435
+ exports.MRT_TableBody = MRT_TableBody;
3436
+ exports.MRT_TableBodyCell = MRT_TableBodyCell;
3437
+ exports.MRT_TableBodyCellValue = MRT_TableBodyCellValue;
3438
+ exports.MRT_TableBodyRow = MRT_TableBodyRow;
3439
+ exports.MRT_TableBodyRowGrabHandle = MRT_TableBodyRowGrabHandle;
3440
+ exports.MRT_TableContainer = MRT_TableContainer;
3441
+ exports.MRT_TableDetailPanel = MRT_TableDetailPanel;
3442
+ exports.MRT_TableFooter = MRT_TableFooter;
3443
+ exports.MRT_TableFooterCell = MRT_TableFooterCell;
3444
+ exports.MRT_TableFooterRow = MRT_TableFooterRow;
3445
+ exports.MRT_TableHead = MRT_TableHead;
3446
+ exports.MRT_TableHeadCell = MRT_TableHeadCell;
3447
+ exports.MRT_TableHeadCellColumnActionsButton = MRT_TableHeadCellColumnActionsButton;
3180
3448
  exports.MRT_TableHeadCellFilterContainer = MRT_TableHeadCellFilterContainer;
3449
+ exports.MRT_TableHeadCellFilterLabel = MRT_TableHeadCellFilterLabel;
3450
+ exports.MRT_TableHeadCellGrabHandle = MRT_TableHeadCellGrabHandle;
3451
+ exports.MRT_TableHeadCellResizeHandle = MRT_TableHeadCellResizeHandle;
3452
+ exports.MRT_TableHeadCellSortLabel = MRT_TableHeadCellSortLabel;
3453
+ exports.MRT_TableHeadRow = MRT_TableHeadRow;
3181
3454
  exports.MRT_TablePagination = MRT_TablePagination;
3455
+ exports.MRT_TablePaper = MRT_TablePaper;
3182
3456
  exports.MRT_ToggleDensePaddingButton = MRT_ToggleDensePaddingButton;
3183
3457
  exports.MRT_ToggleFiltersButton = MRT_ToggleFiltersButton;
3458
+ exports.MRT_ToggleFullScreenButton = MRT_ToggleFullScreenButton;
3184
3459
  exports.MRT_ToggleGlobalFilterButton = MRT_ToggleGlobalFilterButton;
3185
3460
  exports.MRT_ToggleRowActionMenuButton = MRT_ToggleRowActionMenuButton;
3186
3461
  exports.MRT_ToolbarAlertBanner = MRT_ToolbarAlertBanner;
@@ -3188,5 +3463,32 @@ exports.MRT_ToolbarDropZone = MRT_ToolbarDropZone;
3188
3463
  exports.MRT_ToolbarInternalButtons = MRT_ToolbarInternalButtons;
3189
3464
  exports.MRT_TopToolbar = MRT_TopToolbar;
3190
3465
  exports.MaterialReactTable = MaterialReactTable;
3191
- exports["default"] = MaterialReactTable;
3466
+ exports.Memo_MRT_TableBody = Memo_MRT_TableBody;
3467
+ exports.Memo_MRT_TableBodyCell = Memo_MRT_TableBodyCell;
3468
+ exports.Memo_MRT_TableBodyRow = Memo_MRT_TableBodyRow;
3469
+ exports.commonListItemStyles = commonListItemStyles;
3470
+ exports.commonMenuItemStyles = commonMenuItemStyles;
3471
+ exports.commonToolbarStyles = commonToolbarStyles;
3472
+ exports.createRow = createRow;
3473
+ exports.flexRender = flexRender;
3474
+ exports.getAllLeafColumnDefs = getAllLeafColumnDefs;
3475
+ exports.getCanRankRows = getCanRankRows;
3476
+ exports.getColumnId = getColumnId;
3477
+ exports.getCommonCellStyles = getCommonCellStyles;
3478
+ exports.getDefaultColumnFilterFn = getDefaultColumnFilterFn;
3479
+ exports.getDefaultColumnOrderIds = getDefaultColumnOrderIds;
3480
+ exports.getIsFirstColumn = getIsFirstColumn;
3481
+ exports.getIsFirstRightPinnedColumn = getIsFirstRightPinnedColumn;
3482
+ exports.getIsLastColumn = getIsLastColumn;
3483
+ exports.getIsLastLeftPinnedColumn = getIsLastLeftPinnedColumn;
3484
+ exports.getLeadingDisplayColumnIds = getLeadingDisplayColumnIds;
3485
+ exports.getTotalRight = getTotalRight;
3486
+ exports.getTrailingDisplayColumnIds = getTrailingDisplayColumnIds;
3487
+ exports.mrtFilterOptions = mrtFilterOptions;
3488
+ exports.parseCSSVarId = parseCSSVarId;
3489
+ exports.prepareColumns = prepareColumns;
3490
+ exports.rankGlobalFuzzy = rankGlobalFuzzy;
3491
+ exports.reorderColumn = reorderColumn;
3492
+ exports.showExpandColumn = showExpandColumn;
3493
+ exports.useMaterialReactTable = useMaterialReactTable;
3192
3494
  //# sourceMappingURL=index.js.map