material-react-table 1.11.4 → 1.12.0-beta.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 (317) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/index.js +770 -1004
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/types/MaterialReactTable.d.ts +4 -743
  5. package/dist/cjs/types/_locales/cs.d.ts +1 -1
  6. package/dist/cjs/types/_locales/da.d.ts +1 -1
  7. package/dist/cjs/types/_locales/de.d.ts +1 -1
  8. package/dist/cjs/types/_locales/en.d.ts +1 -1
  9. package/dist/cjs/types/_locales/es.d.ts +1 -1
  10. package/dist/cjs/types/_locales/fa.d.ts +1 -1
  11. package/dist/cjs/types/_locales/fi.d.ts +1 -1
  12. package/dist/cjs/types/_locales/fr.d.ts +1 -1
  13. package/dist/cjs/types/_locales/hu.d.ts +1 -1
  14. package/dist/cjs/types/_locales/id.d.ts +1 -1
  15. package/dist/cjs/types/_locales/it.d.ts +1 -1
  16. package/dist/cjs/types/_locales/ja.d.ts +1 -1
  17. package/dist/cjs/types/_locales/nl.d.ts +1 -1
  18. package/dist/cjs/types/_locales/pl.d.ts +1 -1
  19. package/dist/cjs/types/_locales/pt-BR.d.ts +1 -1
  20. package/dist/cjs/types/_locales/pt.d.ts +1 -1
  21. package/dist/cjs/types/_locales/ro.d.ts +1 -1
  22. package/dist/cjs/types/_locales/ru.d.ts +1 -1
  23. package/dist/cjs/types/_locales/sk.d.ts +1 -1
  24. package/dist/cjs/types/_locales/sr-Cyrl-RS.d.ts +1 -1
  25. package/dist/cjs/types/_locales/sr-Latn-RS.d.ts +1 -1
  26. package/dist/cjs/types/_locales/sv.d.ts +1 -1
  27. package/dist/cjs/types/_locales/tr.d.ts +1 -1
  28. package/dist/cjs/types/_locales/uk.d.ts +1 -1
  29. package/dist/cjs/types/_locales/vi.d.ts +1 -1
  30. package/dist/cjs/types/_locales/zh-Hans.d.ts +1 -1
  31. package/dist/cjs/types/_locales/zh-Hant.d.ts +1 -1
  32. package/dist/cjs/types/body/MRT_EditRowModal.d.ts +2 -3
  33. package/dist/cjs/types/body/MRT_TableBody.d.ts +4 -4
  34. package/dist/cjs/types/body/MRT_TableBodyCell.d.ts +5 -5
  35. package/dist/cjs/types/body/MRT_TableBodyCellValue.d.ts +2 -3
  36. package/dist/cjs/types/body/MRT_TableBodyRow.d.ts +5 -5
  37. package/dist/cjs/types/body/MRT_TableBodyRowGrabHandle.d.ts +3 -3
  38. package/dist/cjs/types/body/MRT_TableDetailPanel.d.ts +4 -4
  39. package/dist/cjs/types/buttons/MRT_ColumnPinningButtons.d.ts +2 -3
  40. package/dist/cjs/types/buttons/MRT_CopyButton.d.ts +3 -3
  41. package/dist/cjs/types/buttons/MRT_EditActionButtons.d.ts +2 -3
  42. package/dist/cjs/types/buttons/MRT_ExpandAllButton.d.ts +2 -3
  43. package/dist/cjs/types/buttons/MRT_ExpandButton.d.ts +2 -3
  44. package/dist/cjs/types/buttons/MRT_FullScreenToggleButton.d.ts +3 -4
  45. package/dist/cjs/types/buttons/MRT_GrabHandleButton.d.ts +4 -4
  46. package/dist/cjs/types/buttons/MRT_ShowHideColumnsButton.d.ts +3 -4
  47. package/dist/cjs/types/buttons/MRT_ToggleDensePaddingButton.d.ts +3 -4
  48. package/dist/cjs/types/buttons/MRT_ToggleFiltersButton.d.ts +3 -4
  49. package/dist/cjs/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +3 -4
  50. package/dist/cjs/types/buttons/MRT_ToggleRowActionMenuButton.d.ts +2 -3
  51. package/dist/cjs/types/column.utils.d.ts +10 -10
  52. package/dist/cjs/types/filterFns.d.ts +1 -1
  53. package/dist/cjs/types/footer/MRT_TableFooter.d.ts +3 -4
  54. package/dist/cjs/types/footer/MRT_TableFooterCell.d.ts +2 -3
  55. package/dist/cjs/types/footer/MRT_TableFooterRow.d.ts +3 -4
  56. package/dist/cjs/types/head/MRT_TableHead.d.ts +3 -4
  57. package/dist/cjs/types/head/MRT_TableHeadCell.d.ts +2 -3
  58. package/dist/cjs/types/head/MRT_TableHeadCellColumnActionsButton.d.ts +2 -3
  59. package/dist/cjs/types/head/MRT_TableHeadCellFilterContainer.d.ts +2 -3
  60. package/dist/cjs/types/head/MRT_TableHeadCellFilterLabel.d.ts +2 -3
  61. package/dist/cjs/types/head/MRT_TableHeadCellGrabHandle.d.ts +3 -3
  62. package/dist/cjs/types/head/MRT_TableHeadCellResizeHandle.d.ts +2 -3
  63. package/dist/cjs/types/head/MRT_TableHeadCellSortLabel.d.ts +3 -4
  64. package/dist/cjs/types/head/MRT_TableHeadRow.d.ts +3 -4
  65. package/dist/cjs/types/index.d.ts +6 -4
  66. package/dist/cjs/types/inputs/MRT_EditCellTextField.d.ts +2 -3
  67. package/dist/cjs/types/inputs/MRT_FilterCheckbox.d.ts +2 -3
  68. package/dist/cjs/types/inputs/MRT_FilterRangeFields.d.ts +2 -3
  69. package/dist/cjs/types/inputs/MRT_FilterTextField.d.ts +2 -3
  70. package/dist/cjs/types/inputs/MRT_GlobalFilterTextField.d.ts +2 -3
  71. package/dist/cjs/types/inputs/MRT_SelectCheckbox.d.ts +2 -3
  72. package/dist/cjs/types/menus/MRT_ColumnActionMenu.d.ts +2 -3
  73. package/dist/cjs/types/menus/MRT_FilterOptionMenu.d.ts +2 -3
  74. package/dist/cjs/types/menus/MRT_RowActionMenu.d.ts +3 -3
  75. package/dist/cjs/types/menus/MRT_ShowHideColumnsMenu.d.ts +2 -3
  76. package/dist/cjs/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +3 -3
  77. package/dist/cjs/types/sortingFns.d.ts +17 -17
  78. package/dist/cjs/types/table/MRT_Table.d.ts +2 -3
  79. package/dist/cjs/types/table/MRT_TableContainer.d.ts +2 -3
  80. package/dist/cjs/types/table/MRT_TablePaper.d.ts +2 -3
  81. package/dist/cjs/types/toolbar/MRT_BottomToolbar.d.ts +2 -3
  82. package/dist/cjs/types/toolbar/MRT_LinearProgressBar.d.ts +2 -3
  83. package/dist/cjs/types/toolbar/MRT_TablePagination.d.ts +2 -3
  84. package/dist/cjs/types/toolbar/MRT_ToolbarAlertBanner.d.ts +2 -3
  85. package/dist/cjs/types/toolbar/MRT_ToolbarDropZone.d.ts +2 -3
  86. package/dist/cjs/types/toolbar/MRT_ToolbarInternalButtons.d.ts +2 -3
  87. package/dist/cjs/types/toolbar/MRT_TopToolbar.d.ts +3 -4
  88. package/dist/cjs/types/types.d.ts +745 -0
  89. package/dist/esm/material-react-table.esm.js +691 -925
  90. package/dist/esm/material-react-table.esm.js.map +1 -1
  91. package/dist/esm/types/MaterialReactTable.d.ts +4 -743
  92. package/dist/esm/types/_locales/cs.d.ts +1 -1
  93. package/dist/esm/types/_locales/da.d.ts +1 -1
  94. package/dist/esm/types/_locales/de.d.ts +1 -1
  95. package/dist/esm/types/_locales/en.d.ts +1 -1
  96. package/dist/esm/types/_locales/es.d.ts +1 -1
  97. package/dist/esm/types/_locales/fa.d.ts +1 -1
  98. package/dist/esm/types/_locales/fi.d.ts +1 -1
  99. package/dist/esm/types/_locales/fr.d.ts +1 -1
  100. package/dist/esm/types/_locales/hu.d.ts +1 -1
  101. package/dist/esm/types/_locales/id.d.ts +1 -1
  102. package/dist/esm/types/_locales/it.d.ts +1 -1
  103. package/dist/esm/types/_locales/ja.d.ts +1 -1
  104. package/dist/esm/types/_locales/nl.d.ts +1 -1
  105. package/dist/esm/types/_locales/pl.d.ts +1 -1
  106. package/dist/esm/types/_locales/pt-BR.d.ts +1 -1
  107. package/dist/esm/types/_locales/pt.d.ts +1 -1
  108. package/dist/esm/types/_locales/ro.d.ts +1 -1
  109. package/dist/esm/types/_locales/ru.d.ts +1 -1
  110. package/dist/esm/types/_locales/sk.d.ts +1 -1
  111. package/dist/esm/types/_locales/sr-Cyrl-RS.d.ts +1 -1
  112. package/dist/esm/types/_locales/sr-Latn-RS.d.ts +1 -1
  113. package/dist/esm/types/_locales/sv.d.ts +1 -1
  114. package/dist/esm/types/_locales/tr.d.ts +1 -1
  115. package/dist/esm/types/_locales/uk.d.ts +1 -1
  116. package/dist/esm/types/_locales/vi.d.ts +1 -1
  117. package/dist/esm/types/_locales/zh-Hans.d.ts +1 -1
  118. package/dist/esm/types/_locales/zh-Hant.d.ts +1 -1
  119. package/dist/esm/types/body/MRT_EditRowModal.d.ts +2 -3
  120. package/dist/esm/types/body/MRT_TableBody.d.ts +4 -4
  121. package/dist/esm/types/body/MRT_TableBodyCell.d.ts +5 -5
  122. package/dist/esm/types/body/MRT_TableBodyCellValue.d.ts +2 -3
  123. package/dist/esm/types/body/MRT_TableBodyRow.d.ts +5 -5
  124. package/dist/esm/types/body/MRT_TableBodyRowGrabHandle.d.ts +3 -3
  125. package/dist/esm/types/body/MRT_TableDetailPanel.d.ts +4 -4
  126. package/dist/esm/types/buttons/MRT_ColumnPinningButtons.d.ts +2 -3
  127. package/dist/esm/types/buttons/MRT_CopyButton.d.ts +3 -3
  128. package/dist/esm/types/buttons/MRT_EditActionButtons.d.ts +2 -3
  129. package/dist/esm/types/buttons/MRT_ExpandAllButton.d.ts +2 -3
  130. package/dist/esm/types/buttons/MRT_ExpandButton.d.ts +2 -3
  131. package/dist/esm/types/buttons/MRT_FullScreenToggleButton.d.ts +3 -4
  132. package/dist/esm/types/buttons/MRT_GrabHandleButton.d.ts +4 -4
  133. package/dist/esm/types/buttons/MRT_ShowHideColumnsButton.d.ts +3 -4
  134. package/dist/esm/types/buttons/MRT_ToggleDensePaddingButton.d.ts +3 -4
  135. package/dist/esm/types/buttons/MRT_ToggleFiltersButton.d.ts +3 -4
  136. package/dist/esm/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +3 -4
  137. package/dist/esm/types/buttons/MRT_ToggleRowActionMenuButton.d.ts +2 -3
  138. package/dist/esm/types/column.utils.d.ts +10 -10
  139. package/dist/esm/types/filterFns.d.ts +1 -1
  140. package/dist/esm/types/footer/MRT_TableFooter.d.ts +3 -4
  141. package/dist/esm/types/footer/MRT_TableFooterCell.d.ts +2 -3
  142. package/dist/esm/types/footer/MRT_TableFooterRow.d.ts +3 -4
  143. package/dist/esm/types/head/MRT_TableHead.d.ts +3 -4
  144. package/dist/esm/types/head/MRT_TableHeadCell.d.ts +2 -3
  145. package/dist/esm/types/head/MRT_TableHeadCellColumnActionsButton.d.ts +2 -3
  146. package/dist/esm/types/head/MRT_TableHeadCellFilterContainer.d.ts +2 -3
  147. package/dist/esm/types/head/MRT_TableHeadCellFilterLabel.d.ts +2 -3
  148. package/dist/esm/types/head/MRT_TableHeadCellGrabHandle.d.ts +3 -3
  149. package/dist/esm/types/head/MRT_TableHeadCellResizeHandle.d.ts +2 -3
  150. package/dist/esm/types/head/MRT_TableHeadCellSortLabel.d.ts +3 -4
  151. package/dist/esm/types/head/MRT_TableHeadRow.d.ts +3 -4
  152. package/dist/esm/types/index.d.ts +6 -4
  153. package/dist/esm/types/inputs/MRT_EditCellTextField.d.ts +2 -3
  154. package/dist/esm/types/inputs/MRT_FilterCheckbox.d.ts +2 -3
  155. package/dist/esm/types/inputs/MRT_FilterRangeFields.d.ts +2 -3
  156. package/dist/esm/types/inputs/MRT_FilterTextField.d.ts +2 -3
  157. package/dist/esm/types/inputs/MRT_GlobalFilterTextField.d.ts +2 -3
  158. package/dist/esm/types/inputs/MRT_SelectCheckbox.d.ts +2 -3
  159. package/dist/esm/types/menus/MRT_ColumnActionMenu.d.ts +2 -3
  160. package/dist/esm/types/menus/MRT_FilterOptionMenu.d.ts +2 -3
  161. package/dist/esm/types/menus/MRT_RowActionMenu.d.ts +3 -3
  162. package/dist/esm/types/menus/MRT_ShowHideColumnsMenu.d.ts +2 -3
  163. package/dist/esm/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +3 -3
  164. package/dist/esm/types/sortingFns.d.ts +17 -17
  165. package/dist/esm/types/table/MRT_Table.d.ts +2 -3
  166. package/dist/esm/types/table/MRT_TableContainer.d.ts +2 -3
  167. package/dist/esm/types/table/MRT_TablePaper.d.ts +2 -3
  168. package/dist/esm/types/toolbar/MRT_BottomToolbar.d.ts +2 -3
  169. package/dist/esm/types/toolbar/MRT_LinearProgressBar.d.ts +2 -3
  170. package/dist/esm/types/toolbar/MRT_TablePagination.d.ts +2 -3
  171. package/dist/esm/types/toolbar/MRT_ToolbarAlertBanner.d.ts +2 -3
  172. package/dist/esm/types/toolbar/MRT_ToolbarDropZone.d.ts +2 -3
  173. package/dist/esm/types/toolbar/MRT_ToolbarInternalButtons.d.ts +2 -3
  174. package/dist/esm/types/toolbar/MRT_TopToolbar.d.ts +3 -4
  175. package/dist/esm/types/types.d.ts +745 -0
  176. package/dist/index.d.ts +40 -35
  177. package/locales/cs.d.ts +1 -1
  178. package/locales/cs.esm.d.ts +1 -1
  179. package/locales/da.d.ts +1 -1
  180. package/locales/da.esm.d.ts +1 -1
  181. package/locales/de.d.ts +1 -1
  182. package/locales/de.esm.d.ts +1 -1
  183. package/locales/en.d.ts +1 -1
  184. package/locales/en.esm.d.ts +1 -1
  185. package/locales/es.d.ts +1 -1
  186. package/locales/es.esm.d.ts +1 -1
  187. package/locales/fa.d.ts +1 -1
  188. package/locales/fa.esm.d.ts +1 -1
  189. package/locales/fi.d.ts +1 -1
  190. package/locales/fi.esm.d.ts +1 -1
  191. package/locales/fr.d.ts +1 -1
  192. package/locales/fr.esm.d.ts +1 -1
  193. package/locales/hu.d.ts +1 -1
  194. package/locales/hu.esm.d.ts +1 -1
  195. package/locales/id.d.ts +1 -1
  196. package/locales/id.esm.d.ts +1 -1
  197. package/locales/it.d.ts +1 -1
  198. package/locales/it.esm.d.ts +1 -1
  199. package/locales/ja.d.ts +1 -1
  200. package/locales/ja.esm.d.ts +1 -1
  201. package/locales/nl.d.ts +1 -1
  202. package/locales/nl.esm.d.ts +1 -1
  203. package/locales/pl.d.ts +1 -1
  204. package/locales/pl.esm.d.ts +1 -1
  205. package/locales/pt-BR.d.ts +1 -1
  206. package/locales/pt-BR.esm.d.ts +1 -1
  207. package/locales/pt.d.ts +1 -1
  208. package/locales/pt.esm.d.ts +1 -1
  209. package/locales/ro.d.ts +1 -1
  210. package/locales/ro.esm.d.ts +1 -1
  211. package/locales/ru.d.ts +1 -1
  212. package/locales/ru.esm.d.ts +1 -1
  213. package/locales/sk.d.ts +1 -1
  214. package/locales/sk.esm.d.ts +1 -1
  215. package/locales/sr-Cyrl-RS.d.ts +1 -1
  216. package/locales/sr-Cyrl-RS.esm.d.ts +1 -1
  217. package/locales/sr-Latn-RS.d.ts +1 -1
  218. package/locales/sr-Latn-RS.esm.d.ts +1 -1
  219. package/locales/sv.d.ts +1 -1
  220. package/locales/sv.esm.d.ts +1 -1
  221. package/locales/tr.d.ts +1 -1
  222. package/locales/tr.esm.d.ts +1 -1
  223. package/locales/uk.d.ts +1 -1
  224. package/locales/uk.esm.d.ts +1 -1
  225. package/locales/vi.d.ts +1 -1
  226. package/locales/vi.esm.d.ts +1 -1
  227. package/locales/zh-Hans.d.ts +1 -1
  228. package/locales/zh-Hans.esm.d.ts +1 -1
  229. package/locales/zh-Hant.d.ts +1 -1
  230. package/locales/zh-Hant.esm.d.ts +1 -1
  231. package/package.json +35 -17
  232. package/src/MaterialReactTable.tsx +10 -984
  233. package/src/_locales/cs.ts +1 -1
  234. package/src/_locales/da.ts +1 -1
  235. package/src/_locales/de.ts +1 -1
  236. package/src/_locales/en.ts +1 -1
  237. package/src/_locales/es.ts +1 -1
  238. package/src/_locales/fa.ts +1 -1
  239. package/src/_locales/fi.ts +1 -1
  240. package/src/_locales/fr.ts +1 -1
  241. package/src/_locales/hu.ts +1 -1
  242. package/src/_locales/id.ts +1 -1
  243. package/src/_locales/it.ts +1 -1
  244. package/src/_locales/ja.ts +1 -1
  245. package/src/_locales/nl.ts +1 -1
  246. package/src/_locales/pl.ts +1 -1
  247. package/src/_locales/pt-BR.ts +1 -1
  248. package/src/_locales/pt.ts +1 -1
  249. package/src/_locales/ro.ts +1 -1
  250. package/src/_locales/ru.ts +1 -1
  251. package/src/_locales/sk.ts +1 -1
  252. package/src/_locales/sr-Cyrl-RS.ts +1 -1
  253. package/src/_locales/sr-Latn-RS.ts +1 -1
  254. package/src/_locales/sv.ts +1 -1
  255. package/src/_locales/tr.ts +1 -1
  256. package/src/_locales/uk.ts +1 -1
  257. package/src/_locales/vi.ts +1 -1
  258. package/src/_locales/zh-Hans.ts +1 -1
  259. package/src/_locales/zh-Hant.ts +1 -1
  260. package/src/body/MRT_EditRowModal.tsx +1 -2
  261. package/src/body/MRT_TableBody.tsx +2 -2
  262. package/src/body/MRT_TableBodyCell.tsx +6 -6
  263. package/src/body/MRT_TableBodyCellValue.tsx +2 -2
  264. package/src/body/MRT_TableBodyRow.tsx +3 -3
  265. package/src/body/MRT_TableBodyRowGrabHandle.tsx +2 -2
  266. package/src/body/MRT_TableDetailPanel.tsx +3 -3
  267. package/src/buttons/MRT_ColumnPinningButtons.tsx +1 -2
  268. package/src/buttons/MRT_CopyButton.tsx +2 -2
  269. package/src/buttons/MRT_EditActionButtons.tsx +1 -2
  270. package/src/buttons/MRT_ExpandAllButton.tsx +1 -2
  271. package/src/buttons/MRT_ExpandButton.tsx +2 -2
  272. package/src/buttons/MRT_FullScreenToggleButton.tsx +2 -3
  273. package/src/buttons/MRT_GrabHandleButton.tsx +3 -3
  274. package/src/buttons/MRT_ShowHideColumnsButton.tsx +3 -3
  275. package/src/buttons/MRT_ToggleDensePaddingButton.tsx +2 -3
  276. package/src/buttons/MRT_ToggleFiltersButton.tsx +2 -3
  277. package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +2 -3
  278. package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +2 -2
  279. package/src/column.utils.ts +23 -22
  280. package/src/filterFns.ts +1 -1
  281. package/src/footer/MRT_TableFooter.tsx +2 -3
  282. package/src/footer/MRT_TableFooterCell.tsx +1 -2
  283. package/src/footer/MRT_TableFooterRow.tsx +2 -3
  284. package/src/head/MRT_TableHead.tsx +2 -3
  285. package/src/head/MRT_TableHeadCell.tsx +3 -3
  286. package/src/head/MRT_TableHeadCellColumnActionsButton.tsx +2 -2
  287. package/src/head/MRT_TableHeadCellFilterContainer.tsx +1 -2
  288. package/src/head/MRT_TableHeadCellFilterLabel.tsx +2 -2
  289. package/src/head/MRT_TableHeadCellGrabHandle.tsx +2 -2
  290. package/src/head/MRT_TableHeadCellResizeHandle.tsx +1 -2
  291. package/src/head/MRT_TableHeadCellSortLabel.tsx +2 -3
  292. package/src/head/MRT_TableHeadRow.tsx +2 -3
  293. package/src/index.tsx +7 -5
  294. package/src/inputs/MRT_EditCellTextField.tsx +3 -3
  295. package/src/inputs/MRT_FilterCheckbox.tsx +2 -3
  296. package/src/inputs/MRT_FilterRangeFields.tsx +1 -2
  297. package/src/inputs/MRT_FilterTextField.tsx +5 -5
  298. package/src/inputs/MRT_GlobalFilterTextField.tsx +4 -4
  299. package/src/inputs/MRT_SelectCheckbox.tsx +3 -3
  300. package/src/menus/MRT_ColumnActionMenu.tsx +3 -2
  301. package/src/menus/MRT_FilterOptionMenu.tsx +8 -8
  302. package/src/menus/MRT_RowActionMenu.tsx +2 -2
  303. package/src/menus/MRT_ShowHideColumnsMenu.tsx +2 -2
  304. package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +2 -8
  305. package/src/sortingFns.ts +1 -1
  306. package/src/table/MRT_Table.tsx +2 -2
  307. package/src/table/MRT_TableContainer.tsx +2 -2
  308. package/src/table/MRT_TablePaper.tsx +1 -2
  309. package/src/table/MRT_TableRoot.tsx +16 -16
  310. package/src/toolbar/MRT_BottomToolbar.tsx +1 -2
  311. package/src/toolbar/MRT_LinearProgressBar.tsx +1 -2
  312. package/src/toolbar/MRT_TablePagination.tsx +2 -2
  313. package/src/toolbar/MRT_ToolbarAlertBanner.tsx +2 -2
  314. package/src/toolbar/MRT_ToolbarDropZone.tsx +2 -2
  315. package/src/toolbar/MRT_ToolbarInternalButtons.tsx +1 -2
  316. package/src/toolbar/MRT_TopToolbar.tsx +2 -3
  317. package/src/types.ts +981 -0
package/src/types.ts ADDED
@@ -0,0 +1,981 @@
1
+ import {
2
+ type Dispatch,
3
+ type MutableRefObject,
4
+ type ReactNode,
5
+ type SetStateAction,
6
+ } from 'react';
7
+ import { type AlertProps } from '@mui/material/Alert';
8
+ import { type ButtonProps } from '@mui/material/Button';
9
+ import { type CheckboxProps } from '@mui/material/Checkbox';
10
+ import { type ChipProps } from '@mui/material/Chip';
11
+ import { type IconButtonProps } from '@mui/material/IconButton';
12
+ import { type LinearProgressProps } from '@mui/material/LinearProgress';
13
+ import { type PaperProps } from '@mui/material/Paper';
14
+ import { type RadioProps } from '@mui/material/Radio';
15
+ import { type SkeletonProps } from '@mui/material/Skeleton';
16
+ import { type TableProps } from '@mui/material/Table';
17
+ import { type TableBodyProps } from '@mui/material/TableBody';
18
+ import { type TableCellProps } from '@mui/material/TableCell';
19
+ import { type TableContainerProps } from '@mui/material/TableContainer';
20
+ import { type TableFooterProps } from '@mui/material/TableFooter';
21
+ import { type TableHeadProps } from '@mui/material/TableHead';
22
+ import { type TablePaginationProps } from '@mui/material/TablePagination';
23
+ import { type TableRowProps } from '@mui/material/TableRow';
24
+ import { type TextFieldProps } from '@mui/material/TextField';
25
+ import { type ToolbarProps } from '@mui/material/Toolbar';
26
+ import {
27
+ type AggregationFn,
28
+ type Cell,
29
+ type Column,
30
+ type ColumnDef,
31
+ type ColumnFiltersState,
32
+ type ColumnOrderState,
33
+ type ColumnPinningState,
34
+ type ColumnSizingInfoState,
35
+ type ColumnSizingState,
36
+ type DeepKeys,
37
+ type ExpandedState,
38
+ type FilterFn,
39
+ type GroupingState,
40
+ type Header,
41
+ type HeaderGroup,
42
+ type OnChangeFn,
43
+ type PaginationState,
44
+ type Row,
45
+ type RowSelectionState,
46
+ type SortingFn,
47
+ type SortingState,
48
+ type Table,
49
+ type TableOptions,
50
+ type TableState,
51
+ type Updater,
52
+ type VisibilityState,
53
+ } from '@tanstack/react-table';
54
+ import {
55
+ type VirtualizerOptions,
56
+ type Virtualizer,
57
+ type VirtualItem,
58
+ } from '@tanstack/react-virtual';
59
+ import { type MRT_AggregationFns } from './aggregationFns';
60
+ import { type MRT_FilterFns } from './filterFns';
61
+ import { type MRT_SortingFns } from './sortingFns';
62
+ import { type MRT_Icons } from './icons';
63
+
64
+ export type { MRT_Icons };
65
+
66
+ type Prettify<T> = { [K in keyof T]: T[K] } & {};
67
+
68
+ type LiteralUnion<T extends U, U = string> = T | (U & Record<never, never>);
69
+
70
+ export type MRT_DensityState = 'comfortable' | 'compact' | 'spacious';
71
+
72
+ export type MRT_FilterFnsState = Record<string, MRT_FilterOption>;
73
+
74
+ export type {
75
+ ColumnFiltersState as MRT_ColumnFiltersState,
76
+ ColumnOrderState as MRT_ColumnOrderState,
77
+ ColumnPinningState as MRT_ColumnPinningState,
78
+ ColumnSizingInfoState as MRT_ColumnSizingInfoState,
79
+ ColumnSizingState as MRT_ColumnSizingState,
80
+ ExpandedState as MRT_ExpandedState,
81
+ GroupingState as MRT_GroupingState,
82
+ PaginationState as MRT_PaginationState,
83
+ RowSelectionState as MRT_RowSelectionState,
84
+ SortingState as MRT_SortingState,
85
+ Updater as MRT_Updater,
86
+ VirtualItem as MRT_VirtualItem,
87
+ Virtualizer as MRT_Virtualizer,
88
+ VirtualizerOptions as MRT_VirtualizerOptions,
89
+ VisibilityState as MRT_VisibilityState,
90
+ };
91
+
92
+ export interface MRT_Localization {
93
+ actions: string;
94
+ and: string;
95
+ cancel: string;
96
+ changeFilterMode: string;
97
+ changeSearchMode: string;
98
+ clearFilter: string;
99
+ clearSearch: string;
100
+ clearSort: string;
101
+ clickToCopy: string;
102
+ collapse: string;
103
+ collapseAll: string;
104
+ columnActions: string;
105
+ copiedToClipboard: string;
106
+ dropToGroupBy: string;
107
+ edit: string;
108
+ expand: string;
109
+ expandAll: string;
110
+ filterArrIncludes: string;
111
+ filterArrIncludesAll: string;
112
+ filterArrIncludesSome: string;
113
+ filterBetween: string;
114
+ filterBetweenInclusive: string;
115
+ filterByColumn: string;
116
+ filterContains: string;
117
+ filterEmpty: string;
118
+ filterEndsWith: string;
119
+ filterEquals: string;
120
+ filterEqualsString: string;
121
+ filterFuzzy: string;
122
+ filterGreaterThan: string;
123
+ filterGreaterThanOrEqualTo: string;
124
+ filterInNumberRange: string;
125
+ filterIncludesString: string;
126
+ filterIncludesStringSensitive: string;
127
+ filterLessThan: string;
128
+ filterLessThanOrEqualTo: string;
129
+ filterMode: string;
130
+ filterNotEmpty: string;
131
+ filterNotEquals: string;
132
+ filterStartsWith: string;
133
+ filterWeakEquals: string;
134
+ filteringByColumn: string;
135
+ goToFirstPage: string;
136
+ goToLastPage: string;
137
+ goToNextPage: string;
138
+ goToPreviousPage: string;
139
+ grab: string;
140
+ groupByColumn: string;
141
+ groupedBy: string;
142
+ hideAll: string;
143
+ hideColumn: string;
144
+ max: string;
145
+ min: string;
146
+ move: string;
147
+ noRecordsToDisplay: string;
148
+ noResultsFound: string;
149
+ of: string;
150
+ or: string;
151
+ pinToLeft: string;
152
+ pinToRight: string;
153
+ resetColumnSize: string;
154
+ resetOrder: string;
155
+ rowActions: string;
156
+ rowNumber: string;
157
+ rowNumbers: string;
158
+ rowsPerPage: string;
159
+ save: string;
160
+ search: string;
161
+ select: string;
162
+ selectedCountOfRowCountRowsSelected: string;
163
+ showAll: string;
164
+ showAllColumns: string;
165
+ showHideColumns: string;
166
+ showHideFilters: string;
167
+ showHideSearch: string;
168
+ sortByColumnAsc: string;
169
+ sortByColumnDesc: string;
170
+ sortedByColumnAsc: string;
171
+ sortedByColumnDesc: string;
172
+ thenBy: string;
173
+ toggleDensity: string;
174
+ toggleFullScreen: string;
175
+ toggleSelectAll: string;
176
+ toggleSelectRow: string;
177
+ toggleVisibility: string;
178
+ ungroupByColumn: string;
179
+ unpin: string;
180
+ unpinAll: string;
181
+ unsorted: string;
182
+ }
183
+
184
+ export interface MRT_RowModel<TData extends Record<string, any> = {}> {
185
+ flatRows: MRT_Row<TData>[];
186
+ rows: MRT_Row<TData>[];
187
+ rowsById: { [key: string]: MRT_Row<TData> };
188
+ }
189
+
190
+ export type MRT_TableInstance<TData extends Record<string, any> = {}> =
191
+ Prettify<
192
+ Omit<
193
+ Table<TData>,
194
+ | 'getAllColumns'
195
+ | 'getAllFlatColumns'
196
+ | 'getAllLeafColumns'
197
+ | 'getCenterLeafColumns'
198
+ | 'getColumn'
199
+ | 'getExpandedRowModel'
200
+ | 'getFlatHeaders'
201
+ | 'getLeftLeafColumns'
202
+ | 'getPaginationRowModel'
203
+ | 'getPreFilteredRowModel'
204
+ | 'getPrePaginationRowModel'
205
+ | 'getRightLeafColumns'
206
+ | 'getRowModel'
207
+ | 'getSelectedRowModel'
208
+ | 'getState'
209
+ | 'options'
210
+ > & {
211
+ getAllColumns: () => MRT_Column<TData>[];
212
+ getAllFlatColumns: () => MRT_Column<TData>[];
213
+ getAllLeafColumns: () => MRT_Column<TData>[];
214
+ getCenterLeafColumns: () => MRT_Column<TData>[];
215
+ getColumn: (columnId: string) => MRT_Column<TData>;
216
+ getExpandedRowModel: () => MRT_RowModel<TData>;
217
+ getFlatHeaders: () => MRT_Header<TData>[];
218
+ getLeftLeafColumns: () => MRT_Column<TData>[];
219
+ getPaginationRowModel: () => MRT_RowModel<TData>;
220
+ getPreFilteredRowModel: () => MRT_RowModel<TData>;
221
+ getPrePaginationRowModel: () => MRT_RowModel<TData>;
222
+ getRightLeafColumns: () => MRT_Column<TData>[];
223
+ getRowModel: () => MRT_RowModel<TData>;
224
+ getSelectedRowModel: () => MRT_RowModel<TData>;
225
+ getState: () => MRT_TableState<TData>;
226
+ options: MaterialReactTableProps<TData> & {
227
+ icons: MRT_Icons;
228
+ localization: MRT_Localization;
229
+ };
230
+ refs: {
231
+ bottomToolbarRef: MutableRefObject<HTMLDivElement>;
232
+ editInputRefs: MutableRefObject<Record<string, HTMLInputElement>>;
233
+ filterInputRefs: MutableRefObject<Record<string, HTMLInputElement>>;
234
+ searchInputRef: MutableRefObject<HTMLInputElement>;
235
+ tableContainerRef: MutableRefObject<HTMLDivElement>;
236
+ tableHeadCellRefs: MutableRefObject<
237
+ Record<string, HTMLTableCellElement>
238
+ >;
239
+ tablePaperRef: MutableRefObject<HTMLDivElement>;
240
+ topToolbarRef: MutableRefObject<HTMLDivElement>;
241
+ };
242
+ setColumnFilterFns: Dispatch<SetStateAction<MRT_FilterFnsState>>;
243
+ setDensity: Dispatch<SetStateAction<MRT_DensityState>>;
244
+ setDraggingColumn: Dispatch<SetStateAction<MRT_Column<TData> | null>>;
245
+ setDraggingRow: Dispatch<SetStateAction<MRT_Row<TData> | null>>;
246
+ setEditingCell: Dispatch<SetStateAction<MRT_Cell<TData> | null>>;
247
+ setEditingRow: Dispatch<SetStateAction<MRT_Row<TData> | null>>;
248
+ setGlobalFilterFn: Dispatch<SetStateAction<MRT_FilterOption>>;
249
+ setHoveredColumn: Dispatch<
250
+ SetStateAction<MRT_Column<TData> | { id: string } | null>
251
+ >;
252
+ setHoveredRow: Dispatch<
253
+ SetStateAction<MRT_Row<TData> | { id: string } | null>
254
+ >;
255
+ setIsFullScreen: Dispatch<SetStateAction<boolean>>;
256
+ setShowAlertBanner: Dispatch<SetStateAction<boolean>>;
257
+ setShowColumnFilters: Dispatch<SetStateAction<boolean>>;
258
+ setShowGlobalFilter: Dispatch<SetStateAction<boolean>>;
259
+ setShowToolbarDropZone: Dispatch<SetStateAction<boolean>>;
260
+ }
261
+ >;
262
+
263
+ export type MRT_TableState<TData extends Record<string, any> = {}> = Prettify<
264
+ TableState & {
265
+ columnFilterFns: MRT_FilterFnsState;
266
+ density: MRT_DensityState;
267
+ draggingColumn: MRT_Column<TData> | null;
268
+ draggingRow: MRT_Row<TData> | null;
269
+ editingCell: MRT_Cell<TData> | null;
270
+ editingRow: MRT_Row<TData> | null;
271
+ globalFilterFn: MRT_FilterOption;
272
+ hoveredColumn: MRT_Column<TData> | { id: string } | null;
273
+ hoveredRow: MRT_Row<TData> | { id: string } | null;
274
+ isFullScreen: boolean;
275
+ isLoading: boolean;
276
+ showAlertBanner: boolean;
277
+ showColumnFilters: boolean;
278
+ showGlobalFilter: boolean;
279
+ showProgressBars: boolean;
280
+ showSkeletons: boolean;
281
+ showToolbarDropZone: boolean;
282
+ }
283
+ >;
284
+
285
+ export type MRT_ColumnDef<TData extends Record<string, any> = {}> =
286
+ // Prettify<
287
+ Omit<
288
+ ColumnDef<TData, unknown>,
289
+ | 'accessorKey'
290
+ | 'aggregatedCell'
291
+ | 'aggregationFn'
292
+ | 'cell'
293
+ | 'columns'
294
+ | 'filterFn'
295
+ | 'footer'
296
+ | 'header'
297
+ | 'id'
298
+ | 'sortingFn'
299
+ > & {
300
+ AggregatedCell?: (props: {
301
+ cell: MRT_Cell<TData>;
302
+ column: MRT_Column<TData>;
303
+ row: MRT_Row<TData>;
304
+ table: MRT_TableInstance<TData>;
305
+ }) => ReactNode;
306
+ Cell?: (props: {
307
+ cell: MRT_Cell<TData>;
308
+ renderedCellValue: number | string | ReactNode;
309
+ column: MRT_Column<TData>;
310
+ row: MRT_Row<TData>;
311
+ table: MRT_TableInstance<TData>;
312
+ }) => ReactNode;
313
+ Edit?: (props: {
314
+ cell: MRT_Cell<TData>;
315
+ column: MRT_Column<TData>;
316
+ row: MRT_Row<TData>;
317
+ table: MRT_TableInstance<TData>;
318
+ }) => ReactNode;
319
+ Filter?: (props: {
320
+ column: MRT_Column<TData>;
321
+ header: MRT_Header<TData>;
322
+ rangeFilterIndex?: number;
323
+ table: MRT_TableInstance<TData>;
324
+ }) => ReactNode;
325
+ Footer?:
326
+ | ReactNode
327
+ | ((props: {
328
+ column: MRT_Column<TData>;
329
+ footer: MRT_Header<TData>;
330
+ table: MRT_TableInstance<TData>;
331
+ }) => ReactNode);
332
+ GroupedCell?: (props: {
333
+ cell: MRT_Cell<TData>;
334
+ column: MRT_Column<TData>;
335
+ row: MRT_Row<TData>;
336
+ table: MRT_TableInstance<TData>;
337
+ }) => ReactNode;
338
+ Header?:
339
+ | ReactNode
340
+ | ((props: {
341
+ column: MRT_Column<TData>;
342
+ header: MRT_Header<TData>;
343
+ table: MRT_TableInstance<TData>;
344
+ }) => ReactNode);
345
+ PlaceholderCell?: (props: {
346
+ cell: MRT_Cell<TData>;
347
+ column: MRT_Column<TData>;
348
+ row: MRT_Row<TData>;
349
+ table: MRT_TableInstance<TData>;
350
+ }) => ReactNode;
351
+ /**
352
+ * Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
353
+ * Specify a function here to point to the correct property in the data object.
354
+ *
355
+ * @example accessorFn: (row) => row.username
356
+ */
357
+ accessorFn?: (originalRow: TData) => any;
358
+ /**
359
+ * Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
360
+ * Specify which key in the row this column should use to access the correct data.
361
+ * Also supports Deep Key Dot Notation.
362
+ *
363
+ * @example accessorKey: 'username' //simple
364
+ * @example accessorKey: 'name.firstName' //deep key dot notation
365
+ */
366
+ accessorKey?: DeepKeys<TData>;
367
+ aggregationFn?: MRT_AggregationFn<TData> | Array<MRT_AggregationFn<TData>>;
368
+ /**
369
+ * Specify what type of column this is. Either `data`, `display`, or `group`. Defaults to `data`.
370
+ * Leave this blank if you are just creating a normal data column.
371
+ *
372
+ * @default 'data'
373
+ *
374
+ * @example columnDefType: 'display'
375
+ */
376
+ columnDefType?: 'data' | 'display' | 'group';
377
+ columnFilterModeOptions?: Array<
378
+ LiteralUnion<string & MRT_FilterOption>
379
+ > | null;
380
+ columns?: MRT_ColumnDef<TData>[];
381
+ editSelectOptions?: (string | { text: string; value: any })[];
382
+ editVariant?: 'text' | 'select';
383
+ enableClickToCopy?: boolean;
384
+ enableColumnActions?: boolean;
385
+ enableColumnDragging?: boolean;
386
+ enableColumnFilterModes?: boolean;
387
+ enableColumnOrdering?: boolean;
388
+ enableEditing?: boolean | ((row: MRT_Row<TData>) => boolean);
389
+ enableFilterMatchHighlighting?: boolean;
390
+ filterFn?: MRT_FilterFn<TData>;
391
+ filterSelectOptions?: (string | { text: string; value: any })[];
392
+ filterVariant?: 'text' | 'select' | 'multi-select' | 'range' | 'checkbox';
393
+ /**
394
+ * footer must be a string. If you want custom JSX to render the footer, you can also specify a `Footer` option. (Capital F)
395
+ */
396
+ footer?: string;
397
+ /**
398
+ * header must be a string. If you want custom JSX to render the header, you can also specify a `Header` option. (Capital H)
399
+ */
400
+ header: string;
401
+ /**
402
+ * Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
403
+ *
404
+ * If you have also specified an `accessorFn`, MRT still needs to have a valid `id` to be able to identify the column uniquely.
405
+ *
406
+ * `id` defaults to the `accessorKey` or `header` if not specified.
407
+ *
408
+ * @default gets set to the same value as `accessorKey` by default
409
+ */
410
+ id?: LiteralUnion<string & keyof TData>;
411
+ muiTableBodyCellCopyButtonProps?:
412
+ | ButtonProps
413
+ | ((props: {
414
+ cell: MRT_Cell<TData>;
415
+ column: MRT_Column<TData>;
416
+ row: MRT_Row<TData>;
417
+ table: MRT_TableInstance<TData>;
418
+ }) => ButtonProps);
419
+ muiTableBodyCellEditTextFieldProps?:
420
+ | TextFieldProps
421
+ | ((props: {
422
+ cell: MRT_Cell<TData>;
423
+ column: MRT_Column<TData>;
424
+ row: MRT_Row<TData>;
425
+ table: MRT_TableInstance<TData>;
426
+ }) => TextFieldProps);
427
+ muiTableBodyCellProps?:
428
+ | TableCellProps
429
+ | ((props: {
430
+ cell: MRT_Cell<TData>;
431
+ column: MRT_Column<TData>;
432
+ row: MRT_Row<TData>;
433
+ table: MRT_TableInstance<TData>;
434
+ }) => TableCellProps);
435
+ muiTableFooterCellProps?:
436
+ | TableCellProps
437
+ | ((props: {
438
+ table: MRT_TableInstance<TData>;
439
+ column: MRT_Column<TData>;
440
+ }) => TableCellProps);
441
+ muiTableHeadCellColumnActionsButtonProps?:
442
+ | IconButtonProps
443
+ | ((props: {
444
+ table: MRT_TableInstance<TData>;
445
+ column: MRT_Column<TData>;
446
+ }) => IconButtonProps);
447
+ muiTableHeadCellDragHandleProps?:
448
+ | IconButtonProps
449
+ | ((props: {
450
+ table: MRT_TableInstance<TData>;
451
+ column: MRT_Column<TData>;
452
+ }) => IconButtonProps);
453
+ muiTableHeadCellFilterCheckboxProps?:
454
+ | CheckboxProps
455
+ | ((props: {
456
+ column: MRT_Column<TData>;
457
+ table: MRT_TableInstance<TData>;
458
+ }) => CheckboxProps);
459
+ muiTableHeadCellFilterTextFieldProps?:
460
+ | TextFieldProps
461
+ | ((props: {
462
+ table: MRT_TableInstance<TData>;
463
+ column: MRT_Column<TData>;
464
+ rangeFilterIndex?: number;
465
+ }) => TextFieldProps);
466
+ muiTableHeadCellProps?:
467
+ | TableCellProps
468
+ | ((props: {
469
+ table: MRT_TableInstance<TData>;
470
+ column: MRT_Column<TData>;
471
+ }) => TableCellProps);
472
+ renderColumnActionsMenuItems?: (props: {
473
+ closeMenu: () => void;
474
+ column: MRT_Column<TData>;
475
+ table: MRT_TableInstance<TData>;
476
+ }) => ReactNode[];
477
+ renderColumnFilterModeMenuItems?: (props: {
478
+ column: MRT_Column<TData>;
479
+ internalFilterOptions: MRT_InternalFilterOption[];
480
+ onSelectFilterMode: (filterMode: MRT_FilterOption) => void;
481
+ table: MRT_TableInstance<TData>;
482
+ }) => ReactNode[];
483
+ sortingFn?: MRT_SortingFn<TData>;
484
+ };
485
+ // >
486
+
487
+ export type MRT_DefinedColumnDef<TData extends Record<string, any> = {}> =
488
+ // Prettify<
489
+ Omit<MRT_ColumnDef<TData>, 'id' | 'defaultDisplayColumn'> & {
490
+ defaultDisplayColumn: Partial<MRT_ColumnDef<TData>>;
491
+ id: string;
492
+ _filterFn: MRT_FilterOption;
493
+ };
494
+ // >
495
+
496
+ export type MRT_Column<TData extends Record<string, any> = {}> =
497
+ // Prettify<
498
+ Omit<
499
+ Column<TData, unknown>,
500
+ 'header' | 'footer' | 'columns' | 'columnDef' | 'filterFn'
501
+ > & {
502
+ columnDef: MRT_DefinedColumnDef<TData>;
503
+ columns?: MRT_Column<TData>[];
504
+ filterFn?: MRT_FilterFn<TData>;
505
+ footer: string;
506
+ header: string;
507
+ };
508
+ // >;
509
+
510
+ export type MRT_Header<TData extends Record<string, any> = {}> = Prettify<
511
+ Omit<Header<TData, unknown>, 'column'> & {
512
+ column: MRT_Column<TData>;
513
+ }
514
+ >;
515
+
516
+ export type MRT_HeaderGroup<TData extends Record<string, any> = {}> = Prettify<
517
+ Omit<HeaderGroup<TData>, 'headers'> & {
518
+ headers: MRT_Header<TData>[];
519
+ }
520
+ >;
521
+
522
+ export type MRT_Row<TData extends Record<string, any> = {}> = Prettify<
523
+ Omit<
524
+ Row<TData>,
525
+ 'getVisibleCells' | 'getAllCells' | 'subRows' | '_valuesCache'
526
+ > & {
527
+ getAllCells: () => MRT_Cell<TData>[];
528
+ getVisibleCells: () => MRT_Cell<TData>[];
529
+ subRows?: MRT_Row<TData>[];
530
+ _valuesCache: Record<LiteralUnion<string & DeepKeys<TData>>, any>;
531
+ }
532
+ >;
533
+
534
+ export type MRT_Cell<TData extends Record<string, any> = {}> = Prettify<
535
+ Omit<Cell<TData, unknown>, 'column' | 'row'> & {
536
+ column: MRT_Column<TData>;
537
+ row: MRT_Row<TData>;
538
+ }
539
+ >;
540
+
541
+ export type MRT_AggregationOption = string & keyof typeof MRT_AggregationFns;
542
+
543
+ export type MRT_AggregationFn<TData extends Record<string, any> = {}> =
544
+ | AggregationFn<TData>
545
+ | MRT_AggregationOption;
546
+
547
+ export type MRT_SortingOption = LiteralUnion<
548
+ string & keyof typeof MRT_SortingFns
549
+ >;
550
+
551
+ export type MRT_SortingFn<TData extends Record<string, any> = {}> =
552
+ | SortingFn<TData>
553
+ | MRT_SortingOption;
554
+
555
+ export type MRT_FilterOption = LiteralUnion<
556
+ string & keyof typeof MRT_FilterFns
557
+ >;
558
+
559
+ export type MRT_FilterFn<TData extends Record<string, any> = {}> =
560
+ | FilterFn<TData>
561
+ | MRT_FilterOption;
562
+
563
+ export type MRT_InternalFilterOption = {
564
+ option: string;
565
+ symbol: string;
566
+ label: string;
567
+ divider: boolean;
568
+ };
569
+
570
+ export type MRT_DisplayColumnIds =
571
+ | 'mrt-row-actions'
572
+ | 'mrt-row-drag'
573
+ | 'mrt-row-expand'
574
+ | 'mrt-row-numbers'
575
+ | 'mrt-row-select';
576
+
577
+ export type MRT_CreateTableFeature<
578
+ TData extends Record<string, any> = {},
579
+ TFeature = any,
580
+ > = (table: MRT_TableInstance<TData>) => TFeature;
581
+
582
+ /**
583
+ * `columns` and `data` props are the only required props, but there are over 170 other optional props.
584
+ *
585
+ * See more info on creating columns and data on the official docs site:
586
+ * @link https://www.material-react-table.com/docs/getting-started/usage
587
+ *
588
+ * See the full props list on the official docs site:
589
+ * @link https://www.material-react-table.com/docs/api/props
590
+ */
591
+ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
592
+ Prettify<
593
+ Omit<
594
+ Partial<TableOptions<TData>>,
595
+ | 'columns'
596
+ | 'data'
597
+ | 'defaultColumn'
598
+ | 'enableRowSelection'
599
+ | 'expandRowsFn'
600
+ | 'getRowId'
601
+ | 'globalFilterFn'
602
+ | 'initialState'
603
+ | 'onStateChange'
604
+ | 'state'
605
+ > & {
606
+ columnFilterModeOptions?: Array<
607
+ LiteralUnion<string & MRT_FilterOption>
608
+ > | null;
609
+ /**
610
+ * The columns to display in the table. `accessorKey`s or `accessorFn`s must match keys in the `data` prop.
611
+ *
612
+ * See more info on creating columns on the official docs site:
613
+ * @link https://www.material-react-table.com/docs/guides/data-columns
614
+ * @link https://www.material-react-table.com/docs/guides/display-columns
615
+ *
616
+ * See all Columns Options on the official docs site:
617
+ * @link https://www.material-react-table.com/docs/api/column-options
618
+ */
619
+ columns: MRT_ColumnDef<TData>[];
620
+ /**
621
+ * Pass your data as an array of objects. Objects can theoretically be any shape, but it's best to keep them consistent.
622
+ *
623
+ * See the usage guide for more info on creating columns and data:
624
+ * @link https://www.material-react-table.com/docs/getting-started/usage
625
+ */
626
+ data: TData[];
627
+ /**
628
+ * Instead of specifying a bunch of the same options for each column, you can just change an option in the `defaultColumn` prop to change a default option for all columns.
629
+ */
630
+ defaultColumn?: Partial<MRT_ColumnDef<TData>>;
631
+ /**
632
+ * Change the default options for display columns.
633
+ */
634
+ defaultDisplayColumn?: Partial<MRT_ColumnDef<TData>>;
635
+ displayColumnDefOptions?: Partial<{
636
+ [key in MRT_DisplayColumnIds]: Partial<MRT_ColumnDef>;
637
+ }>;
638
+ editingMode?: 'table' | 'modal' | 'row' | 'cell';
639
+ enableBottomToolbar?: boolean;
640
+ enableClickToCopy?: boolean;
641
+ enableColumnActions?: boolean;
642
+ enableColumnDragging?: boolean;
643
+ enableColumnFilterModes?: boolean;
644
+ enableColumnOrdering?: boolean;
645
+ enableColumnVirtualization?: boolean;
646
+ enableDensityToggle?: boolean;
647
+ enableEditing?: boolean | ((row: MRT_Row<TData>) => boolean);
648
+ enableExpandAll?: boolean;
649
+ enableFilterMatchHighlighting?: boolean;
650
+ enableFullScreenToggle?: boolean;
651
+ enableGlobalFilterModes?: boolean;
652
+ enableGlobalFilterRankedResults?: boolean;
653
+ enablePagination?: boolean;
654
+ enableRowActions?: boolean;
655
+ enableRowDragging?: boolean;
656
+ enableRowNumbers?: boolean;
657
+ enableRowOrdering?: boolean;
658
+ enableRowSelection?: boolean | ((row: MRT_Row<TData>) => boolean);
659
+ enableRowVirtualization?: boolean;
660
+ enableSelectAll?: boolean;
661
+ enableStickyFooter?: boolean;
662
+ enableStickyHeader?: boolean;
663
+ enableTableFooter?: boolean;
664
+ enableTableHead?: boolean;
665
+ enableToolbarInternalActions?: boolean;
666
+ enableTopToolbar?: boolean;
667
+ expandRowsFn?: (dataRow: TData) => TData[];
668
+ getRowId?: (
669
+ originalRow: TData,
670
+ index: number,
671
+ parentRow: MRT_Row<TData>,
672
+ ) => string;
673
+ globalFilterFn?: MRT_FilterOption;
674
+ globalFilterModeOptions?: MRT_FilterOption[] | null;
675
+ icons?: Partial<MRT_Icons>;
676
+ initialState?: Partial<MRT_TableState<TData>>;
677
+ /**
678
+ * Changes which kind of CSS layout is used to render the table. `semantic` uses default semantic HTML elements, while `grid` adds CSS grid and flexbox styles
679
+ */
680
+ layoutMode?: 'semantic' | 'grid';
681
+ /**
682
+ * Pass in either a locale imported from `material-react-table/locales/*` or a custom locale object.
683
+ *
684
+ * See the localization (i18n) guide for more info:
685
+ * @link https://www.material-react-table.com/docs/guides/localization
686
+ */
687
+ localization?: Partial<MRT_Localization>;
688
+ /**
689
+ * Memoize cells, rows, or the entire table body to potentially improve render performance.
690
+ *
691
+ * @warning This will break some dynamic rendering features. See the memoization guide for more info:
692
+ * @link https://www.material-react-table.com/docs/guides/memoize-components
693
+ */
694
+ memoMode?: 'cells' | 'rows' | 'table-body';
695
+ muiBottomToolbarProps?:
696
+ | ToolbarProps
697
+ | ((props: { table: MRT_TableInstance<TData> }) => ToolbarProps);
698
+ muiExpandAllButtonProps?:
699
+ | IconButtonProps
700
+ | ((props: { table: MRT_TableInstance<TData> }) => IconButtonProps);
701
+ muiExpandButtonProps?:
702
+ | IconButtonProps
703
+ | ((props: {
704
+ table: MRT_TableInstance<TData>;
705
+ row: MRT_Row<TData>;
706
+ }) => IconButtonProps);
707
+ muiLinearProgressProps?:
708
+ | LinearProgressProps
709
+ | ((props: {
710
+ isTopToolbar: boolean;
711
+ table: MRT_TableInstance<TData>;
712
+ }) => LinearProgressProps);
713
+ muiSearchTextFieldProps?:
714
+ | TextFieldProps
715
+ | ((props: { table: MRT_TableInstance<TData> }) => TextFieldProps);
716
+ muiSelectAllCheckboxProps?:
717
+ | CheckboxProps
718
+ | ((props: { table: MRT_TableInstance<TData> }) => CheckboxProps);
719
+ muiSelectCheckboxProps?:
720
+ | (CheckboxProps | RadioProps)
721
+ | ((props: {
722
+ table: MRT_TableInstance<TData>;
723
+ row: MRT_Row<TData>;
724
+ }) => CheckboxProps | RadioProps);
725
+ muiTableBodyCellCopyButtonProps?:
726
+ | ButtonProps
727
+ | ((props: {
728
+ cell: MRT_Cell<TData>;
729
+ column: MRT_Column<TData>;
730
+ row: MRT_Row<TData>;
731
+ table: MRT_TableInstance<TData>;
732
+ }) => ButtonProps);
733
+ muiTableBodyCellEditTextFieldProps?:
734
+ | TextFieldProps
735
+ | ((props: {
736
+ cell: MRT_Cell<TData>;
737
+ column: MRT_Column<TData>;
738
+ row: MRT_Row<TData>;
739
+ table: MRT_TableInstance<TData>;
740
+ }) => TextFieldProps);
741
+ muiTableBodyCellProps?:
742
+ | TableCellProps
743
+ | ((props: {
744
+ cell: MRT_Cell<TData>;
745
+ column: MRT_Column<TData>;
746
+ row: MRT_Row<TData>;
747
+ table: MRT_TableInstance<TData>;
748
+ }) => TableCellProps);
749
+ muiTableBodyCellSkeletonProps?:
750
+ | SkeletonProps
751
+ | ((props: {
752
+ cell: MRT_Cell<TData>;
753
+ column: MRT_Column<TData>;
754
+ row: MRT_Row<TData>;
755
+ table: MRT_TableInstance<TData>;
756
+ }) => SkeletonProps);
757
+ muiTableBodyProps?:
758
+ | TableBodyProps
759
+ | ((props: { table: MRT_TableInstance<TData> }) => TableBodyProps);
760
+ muiTableBodyRowDragHandleProps?:
761
+ | IconButtonProps
762
+ | ((props: {
763
+ table: MRT_TableInstance<TData>;
764
+ row: MRT_Row<TData>;
765
+ }) => IconButtonProps);
766
+ muiTableBodyRowProps?:
767
+ | TableRowProps
768
+ | ((props: {
769
+ isDetailPanel?: boolean;
770
+ row: MRT_Row<TData>;
771
+ staticRowIndex: number;
772
+ table: MRT_TableInstance<TData>;
773
+ }) => TableRowProps);
774
+ muiTableContainerProps?:
775
+ | TableContainerProps
776
+ | ((props: { table: MRT_TableInstance<TData> }) => TableContainerProps);
777
+ muiTableDetailPanelProps?:
778
+ | TableCellProps
779
+ | ((props: {
780
+ table: MRT_TableInstance<TData>;
781
+ row: MRT_Row<TData>;
782
+ }) => TableCellProps);
783
+ muiTableFooterCellProps?:
784
+ | TableCellProps
785
+ | ((props: {
786
+ table: MRT_TableInstance<TData>;
787
+ column: MRT_Column<TData>;
788
+ }) => TableCellProps);
789
+ muiTableFooterProps?:
790
+ | TableFooterProps
791
+ | ((props: { table: MRT_TableInstance<TData> }) => TableFooterProps);
792
+ muiTableFooterRowProps?:
793
+ | TableRowProps
794
+ | ((props: {
795
+ table: MRT_TableInstance<TData>;
796
+ footerGroup: MRT_HeaderGroup<TData>;
797
+ }) => TableRowProps);
798
+ muiTableHeadCellColumnActionsButtonProps?:
799
+ | IconButtonProps
800
+ | ((props: {
801
+ table: MRT_TableInstance<TData>;
802
+ column: MRT_Column<TData>;
803
+ }) => IconButtonProps);
804
+ muiTableHeadCellDragHandleProps?:
805
+ | IconButtonProps
806
+ | ((props: {
807
+ table: MRT_TableInstance<TData>;
808
+ column: MRT_Column<TData>;
809
+ }) => IconButtonProps);
810
+ muiTableHeadCellFilterCheckboxProps?:
811
+ | CheckboxProps
812
+ | ((props: {
813
+ column: MRT_Column<TData>;
814
+ table: MRT_TableInstance<TData>;
815
+ }) => CheckboxProps);
816
+ muiTableHeadCellFilterTextFieldProps?:
817
+ | TextFieldProps
818
+ | ((props: {
819
+ table: MRT_TableInstance<TData>;
820
+ column: MRT_Column<TData>;
821
+ rangeFilterIndex?: number;
822
+ }) => TextFieldProps);
823
+ muiTableHeadCellProps?:
824
+ | TableCellProps
825
+ | ((props: {
826
+ table: MRT_TableInstance<TData>;
827
+ column: MRT_Column<TData>;
828
+ }) => TableCellProps);
829
+ muiTableHeadProps?:
830
+ | TableHeadProps
831
+ | ((props: { table: MRT_TableInstance<TData> }) => TableHeadProps);
832
+ muiTableHeadRowProps?:
833
+ | TableRowProps
834
+ | ((props: {
835
+ table: MRT_TableInstance<TData>;
836
+ headerGroup: MRT_HeaderGroup<TData>;
837
+ }) => TableRowProps);
838
+ muiTablePaginationProps?:
839
+ | Partial<Omit<TablePaginationProps, 'rowsPerPage'>>
840
+ | ((props: {
841
+ table: MRT_TableInstance<TData>;
842
+ }) => Partial<Omit<TablePaginationProps, 'rowsPerPage'>>);
843
+ muiTablePaperProps?:
844
+ | PaperProps
845
+ | ((props: { table: MRT_TableInstance<TData> }) => PaperProps);
846
+ muiTableProps?:
847
+ | TableProps
848
+ | ((props: { table: MRT_TableInstance<TData> }) => TableProps);
849
+ muiToolbarAlertBannerChipProps?:
850
+ | ChipProps
851
+ | ((props: { table: MRT_TableInstance<TData> }) => ChipProps);
852
+ muiToolbarAlertBannerProps?:
853
+ | AlertProps
854
+ | ((props: { table: MRT_TableInstance<TData> }) => AlertProps);
855
+ muiTopToolbarProps?:
856
+ | ToolbarProps
857
+ | ((props: { table: MRT_TableInstance<TData> }) => ToolbarProps);
858
+ onDensityChange?: OnChangeFn<MRT_DensityState>;
859
+ onDraggingColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
860
+ onDraggingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
861
+ onEditingCellChange?: OnChangeFn<MRT_Cell<TData> | null>;
862
+ onEditingRowCancel?: (props: {
863
+ row: MRT_Row<TData>;
864
+ table: MRT_TableInstance<TData>;
865
+ }) => void;
866
+ onEditingRowSave?: (props: {
867
+ exitEditingMode: () => void;
868
+ row: MRT_Row<TData>;
869
+ table: MRT_TableInstance<TData>;
870
+ values: Record<LiteralUnion<string & DeepKeys<TData>>, any>;
871
+ }) => Promise<void> | void;
872
+ onEditingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
873
+ onColumnFilterFnsChange?: OnChangeFn<{ [key: string]: MRT_FilterOption }>;
874
+ onGlobalFilterFnChange?: OnChangeFn<MRT_FilterOption>;
875
+ onHoveredColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
876
+ onHoveredRowChange?: OnChangeFn<MRT_Row<TData> | null>;
877
+ onIsFullScreenChange?: OnChangeFn<boolean>;
878
+ onShowAlertBannerChange?: OnChangeFn<boolean>;
879
+ onShowColumnFiltersChange?: OnChangeFn<boolean>;
880
+ onShowGlobalFilterChange?: OnChangeFn<boolean>;
881
+ onShowToolbarDropZoneChange?: OnChangeFn<boolean>;
882
+ positionActionsColumn?: 'first' | 'last';
883
+ positionExpandColumn?: 'first' | 'last';
884
+ positionGlobalFilter?: 'left' | 'right' | 'none';
885
+ positionPagination?: 'bottom' | 'top' | 'both' | 'none';
886
+ positionToolbarAlertBanner?: 'bottom' | 'top' | 'none';
887
+ positionToolbarDropZone?: 'bottom' | 'top' | 'none' | 'both';
888
+ renderBottomToolbar?:
889
+ | ReactNode
890
+ | ((props: { table: MRT_TableInstance<TData> }) => ReactNode);
891
+ renderBottomToolbarCustomActions?: (props: {
892
+ table: MRT_TableInstance<TData>;
893
+ }) => ReactNode;
894
+ renderColumnActionsMenuItems?: (props: {
895
+ column: MRT_Column<TData>;
896
+ closeMenu: () => void;
897
+ table: MRT_TableInstance<TData>;
898
+ }) => ReactNode[];
899
+ renderColumnFilterModeMenuItems?: (props: {
900
+ column: MRT_Column<TData>;
901
+ internalFilterOptions: MRT_InternalFilterOption[];
902
+ onSelectFilterMode: (filterMode: MRT_FilterOption) => void;
903
+ table: MRT_TableInstance<TData>;
904
+ }) => ReactNode[];
905
+ renderDetailPanel?: (props: {
906
+ row: MRT_Row<TData>;
907
+ table: MRT_TableInstance<TData>;
908
+ }) => ReactNode;
909
+ renderGlobalFilterModeMenuItems?: (props: {
910
+ internalFilterOptions: MRT_InternalFilterOption[];
911
+ onSelectFilterMode: (filterMode: MRT_FilterOption) => void;
912
+ table: MRT_TableInstance<TData>;
913
+ }) => ReactNode[];
914
+ renderEmptyRowsFallback?: (props: {
915
+ table: MRT_TableInstance<TData>;
916
+ }) => ReactNode;
917
+ renderRowActionMenuItems?: (props: {
918
+ closeMenu: () => void;
919
+ row: MRT_Row<TData>;
920
+ table: MRT_TableInstance<TData>;
921
+ }) => ReactNode[];
922
+ renderRowActions?: (props: {
923
+ cell: MRT_Cell<TData>;
924
+ row: MRT_Row<TData>;
925
+ table: MRT_TableInstance<TData>;
926
+ }) => ReactNode;
927
+ renderToolbarInternalActions?: (props: {
928
+ table: MRT_TableInstance<TData>;
929
+ }) => ReactNode;
930
+ renderTopToolbar?:
931
+ | ReactNode
932
+ | ((props: { table: MRT_TableInstance<TData> }) => ReactNode);
933
+ renderTopToolbarCustomActions?: (props: {
934
+ table: MRT_TableInstance<TData>;
935
+ }) => ReactNode;
936
+ rowCount?: number;
937
+ rowNumberMode?: 'original' | 'static';
938
+ selectAllMode?: 'all' | 'page';
939
+ /**
940
+ * Manage state externally any way you want, then pass it back into MRT.
941
+ */
942
+ state?: Partial<MRT_TableState<TData>>;
943
+ /**
944
+ * Sequence of features important any dependent feature must be defined first
945
+ */
946
+ tableFeatures?: Array<MRT_CreateTableFeature<TData>>;
947
+ /**
948
+ * Get access to the table instance via a ref to read state or call built-in methods
949
+ */
950
+ tableInstanceRef?: MutableRefObject<MRT_TableInstance<TData> | null>;
951
+ /**
952
+ * @deprecated Use `rowVirtualizerInstanceRef` instead
953
+ */
954
+ virtualizerInstanceRef?: any;
955
+ /**
956
+ * @deprecated Use `rowVirtualizerProps` instead
957
+ */
958
+ virtualizerProps?: any;
959
+ }
960
+ > & {
961
+ columnVirtualizerInstanceRef?: MutableRefObject<Virtualizer<
962
+ HTMLDivElement,
963
+ HTMLTableCellElement
964
+ > | null>;
965
+ columnVirtualizerProps?:
966
+ | Partial<VirtualizerOptions<HTMLDivElement, HTMLTableCellElement>>
967
+ | ((props: {
968
+ table: MRT_TableInstance<TData>;
969
+ }) => Partial<
970
+ VirtualizerOptions<HTMLDivElement, HTMLTableCellElement>
971
+ >);
972
+ rowVirtualizerInstanceRef?: MutableRefObject<Virtualizer<
973
+ HTMLDivElement,
974
+ HTMLTableRowElement
975
+ > | null>;
976
+ rowVirtualizerProps?:
977
+ | Partial<VirtualizerOptions<HTMLDivElement, HTMLTableRowElement>>
978
+ | ((props: {
979
+ table: MRT_TableInstance<TData>;
980
+ }) => Partial<VirtualizerOptions<HTMLDivElement, HTMLTableRowElement>>);
981
+ };