@kissesses/mantine-react-table-open 9.0.3

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 (362) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +196 -0
  3. package/dist/index.cjs +3769 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +1488 -0
  6. package/dist/index.esm.d.mts +1488 -0
  7. package/dist/index.esm.mjs +3664 -0
  8. package/dist/index.esm.mjs.map +1 -0
  9. package/locales/ar/index.cjs +97 -0
  10. package/locales/ar/index.d.cts +3 -0
  11. package/locales/ar/index.esm.d.mts +3 -0
  12. package/locales/ar/index.esm.mjs +95 -0
  13. package/locales/ar/package.json +19 -0
  14. package/locales/az/index.cjs +97 -0
  15. package/locales/az/index.d.cts +3 -0
  16. package/locales/az/index.esm.d.mts +3 -0
  17. package/locales/az/index.esm.mjs +95 -0
  18. package/locales/az/package.json +19 -0
  19. package/locales/bg/index.cjs +97 -0
  20. package/locales/bg/index.d.cts +3 -0
  21. package/locales/bg/index.esm.d.mts +3 -0
  22. package/locales/bg/index.esm.mjs +95 -0
  23. package/locales/bg/package.json +19 -0
  24. package/locales/cs/index.cjs +97 -0
  25. package/locales/cs/index.d.cts +3 -0
  26. package/locales/cs/index.esm.d.mts +3 -0
  27. package/locales/cs/index.esm.mjs +95 -0
  28. package/locales/cs/package.json +19 -0
  29. package/locales/da/index.cjs +97 -0
  30. package/locales/da/index.d.cts +3 -0
  31. package/locales/da/index.esm.d.mts +3 -0
  32. package/locales/da/index.esm.mjs +95 -0
  33. package/locales/da/package.json +19 -0
  34. package/locales/de/index.cjs +97 -0
  35. package/locales/de/index.d.cts +3 -0
  36. package/locales/de/index.esm.d.mts +3 -0
  37. package/locales/de/index.esm.mjs +95 -0
  38. package/locales/de/package.json +19 -0
  39. package/locales/el/index.cjs +97 -0
  40. package/locales/el/index.d.cts +3 -0
  41. package/locales/el/index.esm.d.mts +3 -0
  42. package/locales/el/index.esm.mjs +95 -0
  43. package/locales/el/package.json +19 -0
  44. package/locales/en/index.cjs +97 -0
  45. package/locales/en/index.d.cts +3 -0
  46. package/locales/en/index.esm.d.mts +3 -0
  47. package/locales/en/index.esm.mjs +95 -0
  48. package/locales/en/package.json +19 -0
  49. package/locales/es/index.cjs +97 -0
  50. package/locales/es/index.d.cts +3 -0
  51. package/locales/es/index.esm.d.mts +3 -0
  52. package/locales/es/index.esm.mjs +95 -0
  53. package/locales/es/package.json +19 -0
  54. package/locales/et/index.cjs +97 -0
  55. package/locales/et/index.d.cts +3 -0
  56. package/locales/et/index.esm.d.mts +3 -0
  57. package/locales/et/index.esm.mjs +95 -0
  58. package/locales/et/package.json +19 -0
  59. package/locales/fa/index.cjs +97 -0
  60. package/locales/fa/index.d.cts +3 -0
  61. package/locales/fa/index.esm.d.mts +3 -0
  62. package/locales/fa/index.esm.mjs +95 -0
  63. package/locales/fa/package.json +19 -0
  64. package/locales/fi/index.cjs +97 -0
  65. package/locales/fi/index.d.cts +3 -0
  66. package/locales/fi/index.esm.d.mts +3 -0
  67. package/locales/fi/index.esm.mjs +95 -0
  68. package/locales/fi/package.json +19 -0
  69. package/locales/fr/index.cjs +97 -0
  70. package/locales/fr/index.d.cts +3 -0
  71. package/locales/fr/index.esm.d.mts +3 -0
  72. package/locales/fr/index.esm.mjs +95 -0
  73. package/locales/fr/package.json +19 -0
  74. package/locales/he/index.cjs +97 -0
  75. package/locales/he/index.d.cts +3 -0
  76. package/locales/he/index.esm.d.mts +3 -0
  77. package/locales/he/index.esm.mjs +95 -0
  78. package/locales/he/package.json +19 -0
  79. package/locales/hr/index.cjs +97 -0
  80. package/locales/hr/index.d.cts +3 -0
  81. package/locales/hr/index.esm.d.mts +3 -0
  82. package/locales/hr/index.esm.mjs +95 -0
  83. package/locales/hr/package.json +19 -0
  84. package/locales/hu/index.cjs +97 -0
  85. package/locales/hu/index.d.cts +3 -0
  86. package/locales/hu/index.esm.d.mts +3 -0
  87. package/locales/hu/index.esm.mjs +95 -0
  88. package/locales/hu/package.json +19 -0
  89. package/locales/hy/index.cjs +97 -0
  90. package/locales/hy/index.d.cts +3 -0
  91. package/locales/hy/index.esm.d.mts +3 -0
  92. package/locales/hy/index.esm.mjs +95 -0
  93. package/locales/hy/package.json +19 -0
  94. package/locales/id/index.cjs +97 -0
  95. package/locales/id/index.d.cts +3 -0
  96. package/locales/id/index.esm.d.mts +3 -0
  97. package/locales/id/index.esm.mjs +95 -0
  98. package/locales/id/package.json +19 -0
  99. package/locales/it/index.cjs +97 -0
  100. package/locales/it/index.d.cts +3 -0
  101. package/locales/it/index.esm.d.mts +3 -0
  102. package/locales/it/index.esm.mjs +95 -0
  103. package/locales/it/package.json +19 -0
  104. package/locales/ja/index.cjs +97 -0
  105. package/locales/ja/index.d.cts +3 -0
  106. package/locales/ja/index.esm.d.mts +3 -0
  107. package/locales/ja/index.esm.mjs +95 -0
  108. package/locales/ja/package.json +19 -0
  109. package/locales/ko/index.cjs +97 -0
  110. package/locales/ko/index.d.cts +3 -0
  111. package/locales/ko/index.esm.d.mts +3 -0
  112. package/locales/ko/index.esm.mjs +95 -0
  113. package/locales/ko/package.json +19 -0
  114. package/locales/nl/index.cjs +97 -0
  115. package/locales/nl/index.d.cts +3 -0
  116. package/locales/nl/index.esm.d.mts +3 -0
  117. package/locales/nl/index.esm.mjs +95 -0
  118. package/locales/nl/package.json +19 -0
  119. package/locales/no/index.cjs +97 -0
  120. package/locales/no/index.d.cts +3 -0
  121. package/locales/no/index.esm.d.mts +3 -0
  122. package/locales/no/index.esm.mjs +95 -0
  123. package/locales/no/package.json +19 -0
  124. package/locales/np/index.cjs +97 -0
  125. package/locales/np/index.d.cts +3 -0
  126. package/locales/np/index.esm.d.mts +3 -0
  127. package/locales/np/index.esm.mjs +95 -0
  128. package/locales/np/package.json +19 -0
  129. package/locales/pl/index.cjs +97 -0
  130. package/locales/pl/index.d.cts +3 -0
  131. package/locales/pl/index.esm.d.mts +3 -0
  132. package/locales/pl/index.esm.mjs +95 -0
  133. package/locales/pl/package.json +19 -0
  134. package/locales/pt/index.cjs +97 -0
  135. package/locales/pt/index.d.cts +3 -0
  136. package/locales/pt/index.esm.d.mts +3 -0
  137. package/locales/pt/index.esm.mjs +95 -0
  138. package/locales/pt/package.json +19 -0
  139. package/locales/pt-BR/index.cjs +97 -0
  140. package/locales/pt-BR/index.d.cts +3 -0
  141. package/locales/pt-BR/index.esm.d.mts +3 -0
  142. package/locales/pt-BR/index.esm.mjs +95 -0
  143. package/locales/pt-BR/package.json +19 -0
  144. package/locales/ro/index.cjs +97 -0
  145. package/locales/ro/index.d.cts +3 -0
  146. package/locales/ro/index.esm.d.mts +3 -0
  147. package/locales/ro/index.esm.mjs +95 -0
  148. package/locales/ro/package.json +19 -0
  149. package/locales/ru/index.cjs +97 -0
  150. package/locales/ru/index.d.cts +3 -0
  151. package/locales/ru/index.esm.d.mts +3 -0
  152. package/locales/ru/index.esm.mjs +95 -0
  153. package/locales/ru/package.json +19 -0
  154. package/locales/sk/index.cjs +97 -0
  155. package/locales/sk/index.d.cts +3 -0
  156. package/locales/sk/index.esm.d.mts +3 -0
  157. package/locales/sk/index.esm.mjs +95 -0
  158. package/locales/sk/package.json +19 -0
  159. package/locales/sr-Cyrl-RS/index.cjs +97 -0
  160. package/locales/sr-Cyrl-RS/index.d.cts +3 -0
  161. package/locales/sr-Cyrl-RS/index.esm.d.mts +3 -0
  162. package/locales/sr-Cyrl-RS/index.esm.mjs +95 -0
  163. package/locales/sr-Cyrl-RS/package.json +19 -0
  164. package/locales/sr-Latn-RS/index.cjs +97 -0
  165. package/locales/sr-Latn-RS/index.d.cts +3 -0
  166. package/locales/sr-Latn-RS/index.esm.d.mts +3 -0
  167. package/locales/sr-Latn-RS/index.esm.mjs +95 -0
  168. package/locales/sr-Latn-RS/package.json +19 -0
  169. package/locales/sv/index.cjs +97 -0
  170. package/locales/sv/index.d.cts +3 -0
  171. package/locales/sv/index.esm.d.mts +3 -0
  172. package/locales/sv/index.esm.mjs +95 -0
  173. package/locales/sv/package.json +19 -0
  174. package/locales/tr/index.cjs +97 -0
  175. package/locales/tr/index.d.cts +3 -0
  176. package/locales/tr/index.esm.d.mts +3 -0
  177. package/locales/tr/index.esm.mjs +95 -0
  178. package/locales/tr/package.json +19 -0
  179. package/locales/uk/index.cjs +97 -0
  180. package/locales/uk/index.d.cts +3 -0
  181. package/locales/uk/index.esm.d.mts +3 -0
  182. package/locales/uk/index.esm.mjs +95 -0
  183. package/locales/uk/package.json +19 -0
  184. package/locales/vi/index.cjs +97 -0
  185. package/locales/vi/index.d.cts +3 -0
  186. package/locales/vi/index.esm.d.mts +3 -0
  187. package/locales/vi/index.esm.mjs +95 -0
  188. package/locales/vi/package.json +19 -0
  189. package/locales/zh-Hans/index.cjs +97 -0
  190. package/locales/zh-Hans/index.d.cts +3 -0
  191. package/locales/zh-Hans/index.esm.d.mts +3 -0
  192. package/locales/zh-Hans/index.esm.mjs +95 -0
  193. package/locales/zh-Hans/package.json +19 -0
  194. package/locales/zh-Hant/index.cjs +97 -0
  195. package/locales/zh-Hant/index.d.cts +3 -0
  196. package/locales/zh-Hant/index.esm.d.mts +3 -0
  197. package/locales/zh-Hant/index.esm.mjs +95 -0
  198. package/locales/zh-Hant/package.json +19 -0
  199. package/package.json +154 -0
  200. package/src/components/MantineReactTable.tsx +37 -0
  201. package/src/components/body/MRT_TableBody.module.css +42 -0
  202. package/src/components/body/MRT_TableBody.tsx +215 -0
  203. package/src/components/body/MRT_TableBodyCell.module.css +107 -0
  204. package/src/components/body/MRT_TableBodyCell.tsx +351 -0
  205. package/src/components/body/MRT_TableBodyCellValue.tsx +113 -0
  206. package/src/components/body/MRT_TableBodyEmptyRow.tsx +110 -0
  207. package/src/components/body/MRT_TableBodyRow.module.css +252 -0
  208. package/src/components/body/MRT_TableBodyRow.tsx +263 -0
  209. package/src/components/body/MRT_TableBodyRowGrabHandle.tsx +58 -0
  210. package/src/components/body/MRT_TableBodyRowPinButton.tsx +58 -0
  211. package/src/components/body/MRT_TableDetailPanel.module.css +35 -0
  212. package/src/components/body/MRT_TableDetailPanel.tsx +131 -0
  213. package/src/components/buttons/MRT_ColumnPinningButtons.module.css +11 -0
  214. package/src/components/buttons/MRT_ColumnPinningButtons.tsx +68 -0
  215. package/src/components/buttons/MRT_CopyButton.module.css +27 -0
  216. package/src/components/buttons/MRT_CopyButton.tsx +83 -0
  217. package/src/components/buttons/MRT_EditActionButtons.module.css +4 -0
  218. package/src/components/buttons/MRT_EditActionButtons.tsx +128 -0
  219. package/src/components/buttons/MRT_ExpandAllButton.module.css +26 -0
  220. package/src/components/buttons/MRT_ExpandAllButton.tsx +83 -0
  221. package/src/components/buttons/MRT_ExpandButton.module.css +37 -0
  222. package/src/components/buttons/MRT_ExpandButton.tsx +120 -0
  223. package/src/components/buttons/MRT_GrabHandleButton.module.css +6 -0
  224. package/src/components/buttons/MRT_GrabHandleButton.tsx +64 -0
  225. package/src/components/buttons/MRT_RowPinButton.tsx +83 -0
  226. package/src/components/buttons/MRT_ShowHideColumnsButton.tsx +45 -0
  227. package/src/components/buttons/MRT_ToggleDensePaddingButton.tsx +65 -0
  228. package/src/components/buttons/MRT_ToggleFiltersButton.tsx +44 -0
  229. package/src/components/buttons/MRT_ToggleFullScreenButton.tsx +58 -0
  230. package/src/components/buttons/MRT_ToggleGlobalFilterButton.tsx +51 -0
  231. package/src/components/buttons/MRT_ToggleRowActionMenuButton.tsx +86 -0
  232. package/src/components/footer/MRT_TableFooter.module.css +17 -0
  233. package/src/components/footer/MRT_TableFooter.tsx +72 -0
  234. package/src/components/footer/MRT_TableFooterCell.module.css +50 -0
  235. package/src/components/footer/MRT_TableFooterCell.tsx +122 -0
  236. package/src/components/footer/MRT_TableFooterRow.module.css +10 -0
  237. package/src/components/footer/MRT_TableFooterRow.tsx +94 -0
  238. package/src/components/head/MRT_TableHead.module.css +32 -0
  239. package/src/components/head/MRT_TableHead.tsx +108 -0
  240. package/src/components/head/MRT_TableHeadCell.module.css +163 -0
  241. package/src/components/head/MRT_TableHeadCell.tsx +322 -0
  242. package/src/components/head/MRT_TableHeadCellFilterContainer.module.css +5 -0
  243. package/src/components/head/MRT_TableHeadCellFilterContainer.tsx +147 -0
  244. package/src/components/head/MRT_TableHeadCellFilterLabel.module.css +14 -0
  245. package/src/components/head/MRT_TableHeadCellFilterLabel.tsx +171 -0
  246. package/src/components/head/MRT_TableHeadCellGrabHandle.tsx +81 -0
  247. package/src/components/head/MRT_TableHeadCellResizeHandle.module.css +44 -0
  248. package/src/components/head/MRT_TableHeadCellResizeHandle.tsx +67 -0
  249. package/src/components/head/MRT_TableHeadCellSortLabel.module.css +22 -0
  250. package/src/components/head/MRT_TableHeadCellSortLabel.tsx +89 -0
  251. package/src/components/head/MRT_TableHeadRow.module.css +12 -0
  252. package/src/components/head/MRT_TableHeadRow.tsx +87 -0
  253. package/src/components/inputs/MRT_EditCellTextInput.tsx +218 -0
  254. package/src/components/inputs/MRT_FilterCheckBox.module.css +4 -0
  255. package/src/components/inputs/MRT_FilterCheckbox.tsx +79 -0
  256. package/src/components/inputs/MRT_FilterRangeFields.module.css +5 -0
  257. package/src/components/inputs/MRT_FilterRangeFields.tsx +35 -0
  258. package/src/components/inputs/MRT_FilterRangeSlider.module.css +6 -0
  259. package/src/components/inputs/MRT_FilterRangeSlider.tsx +106 -0
  260. package/src/components/inputs/MRT_FilterTextInput.module.css +27 -0
  261. package/src/components/inputs/MRT_FilterTextInput.tsx +417 -0
  262. package/src/components/inputs/MRT_GlobalFilterTextInput.module.css +11 -0
  263. package/src/components/inputs/MRT_GlobalFilterTextInput.tsx +141 -0
  264. package/src/components/inputs/MRT_SelectCheckbox.tsx +137 -0
  265. package/src/components/menus/MRT_ColumnActionMenu.module.css +7 -0
  266. package/src/components/menus/MRT_ColumnActionMenu.tsx +287 -0
  267. package/src/components/menus/MRT_FilterOptionMenu.module.css +6 -0
  268. package/src/components/menus/MRT_FilterOptionMenu.tsx +274 -0
  269. package/src/components/menus/MRT_RowActionMenu.tsx +74 -0
  270. package/src/components/menus/MRT_ShowHideColumnsMenu.module.css +10 -0
  271. package/src/components/menus/MRT_ShowHideColumnsMenu.tsx +135 -0
  272. package/src/components/menus/MRT_ShowHideColumnsMenuItems.module.css +35 -0
  273. package/src/components/menus/MRT_ShowHideColumnsMenuItems.tsx +170 -0
  274. package/src/components/modals/MRT_EditRowModal.tsx +97 -0
  275. package/src/components/table/MRT_Table.module.css +7 -0
  276. package/src/components/table/MRT_Table.tsx +110 -0
  277. package/src/components/table/MRT_TableContainer.module.css +20 -0
  278. package/src/components/table/MRT_TableContainer.tsx +109 -0
  279. package/src/components/table/MRT_TablePaper.module.css +88 -0
  280. package/src/components/table/MRT_TablePaper.tsx +92 -0
  281. package/src/components/toolbar/MRT_BottomToolbar.module.css +40 -0
  282. package/src/components/toolbar/MRT_BottomToolbar.tsx +100 -0
  283. package/src/components/toolbar/MRT_ProgressBar.module.css +10 -0
  284. package/src/components/toolbar/MRT_ProgressBar.tsx +53 -0
  285. package/src/components/toolbar/MRT_TablePagination.module.css +20 -0
  286. package/src/components/toolbar/MRT_TablePagination.tsx +166 -0
  287. package/src/components/toolbar/MRT_ToolbarAlertBanner.module.css +37 -0
  288. package/src/components/toolbar/MRT_ToolbarAlertBanner.tsx +168 -0
  289. package/src/components/toolbar/MRT_ToolbarDropZone.module.css +23 -0
  290. package/src/components/toolbar/MRT_ToolbarDropZone.tsx +67 -0
  291. package/src/components/toolbar/MRT_ToolbarInternalButtons.module.css +6 -0
  292. package/src/components/toolbar/MRT_ToolbarInternalButtons.tsx +73 -0
  293. package/src/components/toolbar/MRT_TopToolbar.module.css +24 -0
  294. package/src/components/toolbar/MRT_TopToolbar.tsx +128 -0
  295. package/src/components/toolbar/common.styles.module.css +10 -0
  296. package/src/fns/aggregationFns.ts +3 -0
  297. package/src/fns/filterFns.ts +272 -0
  298. package/src/fns/sortingFns.ts +34 -0
  299. package/src/hooks/display-columns/getMRT_RowActionsColumnDef.tsx +23 -0
  300. package/src/hooks/display-columns/getMRT_RowDragColumnDef.tsx +30 -0
  301. package/src/hooks/display-columns/getMRT_RowExpandColumnDef.tsx +92 -0
  302. package/src/hooks/display-columns/getMRT_RowNumbersColumnDef.tsx +30 -0
  303. package/src/hooks/display-columns/getMRT_RowPinningColumnDef.tsx +24 -0
  304. package/src/hooks/display-columns/getMRT_RowSelectColumnDef.tsx +34 -0
  305. package/src/hooks/display-columns/getMRT_RowSpacerColumnDef.tsx +34 -0
  306. package/src/hooks/useMRT_ColumnVirtualizer.ts +129 -0
  307. package/src/hooks/useMRT_Effects.ts +105 -0
  308. package/src/hooks/useMRT_RowVirtualizer.ts +95 -0
  309. package/src/hooks/useMRT_Rows.ts +46 -0
  310. package/src/hooks/useMRT_TableInstance.ts +314 -0
  311. package/src/hooks/useMRT_TableOptions.ts +264 -0
  312. package/src/hooks/useMantineReactTable.ts +14 -0
  313. package/src/icons.ts +73 -0
  314. package/src/index.ts +90 -0
  315. package/src/locales/ar.ts +96 -0
  316. package/src/locales/az.ts +96 -0
  317. package/src/locales/bg.ts +96 -0
  318. package/src/locales/cs.ts +97 -0
  319. package/src/locales/da.ts +96 -0
  320. package/src/locales/de.ts +96 -0
  321. package/src/locales/el.ts +96 -0
  322. package/src/locales/en.ts +96 -0
  323. package/src/locales/es.ts +96 -0
  324. package/src/locales/et.ts +97 -0
  325. package/src/locales/fa.ts +96 -0
  326. package/src/locales/fi.ts +97 -0
  327. package/src/locales/fr.ts +96 -0
  328. package/src/locales/he.ts +96 -0
  329. package/src/locales/hr.ts +96 -0
  330. package/src/locales/hu.ts +96 -0
  331. package/src/locales/hy.ts +96 -0
  332. package/src/locales/id.ts +97 -0
  333. package/src/locales/it.ts +96 -0
  334. package/src/locales/ja.ts +96 -0
  335. package/src/locales/ko.ts +96 -0
  336. package/src/locales/nl.ts +96 -0
  337. package/src/locales/no.ts +97 -0
  338. package/src/locales/np.ts +97 -0
  339. package/src/locales/pl.ts +96 -0
  340. package/src/locales/pt-BR.ts +96 -0
  341. package/src/locales/pt.ts +96 -0
  342. package/src/locales/ro.ts +96 -0
  343. package/src/locales/ru.ts +96 -0
  344. package/src/locales/sk.ts +97 -0
  345. package/src/locales/sr-Cyrl-RS.ts +96 -0
  346. package/src/locales/sr-Latn-RS.ts +96 -0
  347. package/src/locales/sv.ts +96 -0
  348. package/src/locales/tr.ts +96 -0
  349. package/src/locales/uk.ts +96 -0
  350. package/src/locales/vi.ts +96 -0
  351. package/src/locales/zh-Hans.ts +95 -0
  352. package/src/locales/zh-Hant.ts +95 -0
  353. package/src/types.ts +1276 -0
  354. package/src/typings.d.ts +1 -0
  355. package/src/utils/column.utils.ts +124 -0
  356. package/src/utils/displayColumn.utils.ts +153 -0
  357. package/src/utils/row.utils.ts +263 -0
  358. package/src/utils/style.utils.ts +32 -0
  359. package/src/utils/tanstack.helpers.ts +66 -0
  360. package/src/utils/utils.ts +4 -0
  361. package/src/utils/virtualization.utils.ts +19 -0
  362. package/styles.css +1320 -0
@@ -0,0 +1,81 @@
1
+ import { type DragEvent, type RefObject } from 'react';
2
+
3
+ import { type ActionIconProps } from '@mantine/core';
4
+
5
+ import {
6
+ type MRT_CellValue,
7
+ type MRT_Column,
8
+ type MRT_RowData,
9
+ type MRT_TableInstance,
10
+ } from '../../types';
11
+ import { reorderColumn } from '../../utils/column.utils';
12
+ import { parseFromValuesOrFunc } from '../../utils/utils';
13
+ import { MRT_GrabHandleButton } from '../buttons/MRT_GrabHandleButton';
14
+
15
+ interface Props<TData extends MRT_RowData, TValue = MRT_CellValue>
16
+ extends ActionIconProps {
17
+ column: MRT_Column<TData, TValue>;
18
+ table: MRT_TableInstance<TData>;
19
+ tableHeadCellRef: RefObject<HTMLTableCellElement | null>;
20
+ }
21
+
22
+ export const MRT_TableHeadCellGrabHandle = <TData extends MRT_RowData>({
23
+ column,
24
+ table,
25
+ tableHeadCellRef,
26
+ ...rest
27
+ }: Props<TData>) => {
28
+ 'use no memo';
29
+ const {
30
+ getState,
31
+ options: { enableColumnOrdering, mantineColumnDragHandleProps },
32
+ setColumnOrder,
33
+ setDraggingColumn,
34
+ setHoveredColumn,
35
+ } = table;
36
+ const { columnDef } = column;
37
+ const { columnOrder, draggingColumn, hoveredColumn } = getState();
38
+
39
+ const arg = { column, table };
40
+ const actionIconProps = {
41
+ ...parseFromValuesOrFunc(mantineColumnDragHandleProps, arg),
42
+ ...parseFromValuesOrFunc(columnDef.mantineColumnDragHandleProps, arg),
43
+ ...rest,
44
+ };
45
+
46
+ const handleDragStart = (event: DragEvent<HTMLButtonElement>) => {
47
+ actionIconProps?.onDragStart?.(event);
48
+ setDraggingColumn(column);
49
+ event.dataTransfer.setDragImage(
50
+ tableHeadCellRef.current as HTMLElement,
51
+ 0,
52
+ 0,
53
+ );
54
+ };
55
+
56
+ const handleDragEnd = (event: DragEvent<HTMLButtonElement>) => {
57
+ actionIconProps?.onDragEnd?.(event);
58
+ if (hoveredColumn?.id === 'drop-zone') {
59
+ column.toggleGrouping();
60
+ } else if (
61
+ enableColumnOrdering &&
62
+ hoveredColumn &&
63
+ hoveredColumn?.id !== draggingColumn?.id
64
+ ) {
65
+ setColumnOrder(
66
+ reorderColumn(column, hoveredColumn as MRT_Column<TData>, columnOrder),
67
+ );
68
+ }
69
+ setDraggingColumn(null);
70
+ setHoveredColumn(null);
71
+ };
72
+
73
+ return (
74
+ <MRT_GrabHandleButton
75
+ actionIconProps={actionIconProps}
76
+ onDragEnd={handleDragEnd}
77
+ onDragStart={handleDragStart}
78
+ table={table}
79
+ />
80
+ );
81
+ };
@@ -0,0 +1,44 @@
1
+ .root {
2
+ --resize-handle-thickness: 4px;
3
+ background: var(--mantine-color-placeholder);
4
+ border-radius: 2px;
5
+ cursor: col-resize;
6
+ height: 24px;
7
+ position: absolute;
8
+ width: var(--resize-handle-thickness);
9
+ &:hover {
10
+ background: var(--mantine-primary-color-filled-hover);
11
+ }
12
+ &:active {
13
+ background: var(--mantine-primary-color-filled);
14
+ }
15
+ transform: var(--mrt-transform);
16
+ }
17
+
18
+ .root-ltr {
19
+ right: 0px;
20
+ margin-right: -10px;
21
+ &:global(.md) {
22
+ margin-right: -16px;
23
+ }
24
+ &:global(.xl) {
25
+ margin-right: -22px;
26
+ }
27
+ }
28
+
29
+ .root-rtl {
30
+ left: 0px;
31
+ margin-left: -10px;
32
+ &:global(.md) {
33
+ margin-left: -16px;
34
+ }
35
+ &:global(.xl) {
36
+ margin-left: -22px;
37
+ }
38
+ }
39
+
40
+ .root-hide {
41
+ &:active {
42
+ opacity: 0;
43
+ }
44
+ }
@@ -0,0 +1,67 @@
1
+ import clsx from 'clsx';
2
+
3
+ import classes from './MRT_TableHeadCellResizeHandle.module.css';
4
+
5
+ import { Box, type BoxProps } from '@mantine/core';
6
+
7
+ import {
8
+ type MRT_Header,
9
+ type MRT_RowData,
10
+ type MRT_TableInstance,
11
+ } from '../../types';
12
+
13
+ interface Props<TData extends MRT_RowData> extends BoxProps {
14
+ header: MRT_Header<TData>;
15
+ table: MRT_TableInstance<TData>;
16
+ }
17
+
18
+ export const MRT_TableHeadCellResizeHandle = <TData extends MRT_RowData>({
19
+ header,
20
+ table,
21
+ ...rest
22
+ }: Props<TData>) => {
23
+ 'use no memo';
24
+ const {
25
+ getState,
26
+ options: { columnResizeDirection, columnResizeMode },
27
+ setColumnSizingInfo,
28
+ } = table;
29
+ const { density } = getState();
30
+ const { column } = header;
31
+ const handler = header.getResizeHandler();
32
+
33
+ const offset =
34
+ column.getIsResizing() && columnResizeMode === 'onEnd'
35
+ ? `translateX(${
36
+ (columnResizeDirection === 'rtl' ? -1 : 1) *
37
+ (getState().columnSizingInfo.deltaOffset ?? 0)
38
+ }px)`
39
+ : undefined;
40
+
41
+ return (
42
+ <Box
43
+ onDoubleClick={() => {
44
+ setColumnSizingInfo((old) => ({
45
+ ...old,
46
+ isResizingColumn: false,
47
+ }));
48
+ column.resetSize();
49
+ }}
50
+ onMouseDown={handler}
51
+ onTouchStart={handler}
52
+ role="separator"
53
+ {...rest}
54
+ __vars={{ '--mrt-transform': offset, ...rest.__vars }}
55
+ className={clsx(
56
+ 'mrt-table-head-cell-resize-handle',
57
+ classes.root,
58
+ classes[`root-${columnResizeDirection}`],
59
+ !header.subHeaders.length &&
60
+ columnResizeMode === 'onChange' &&
61
+ classes['root-hide'],
62
+ density,
63
+ rest.className,
64
+ )}
65
+ />
66
+ );
67
+ };
@@ -0,0 +1,22 @@
1
+ .sort-icon {
2
+ transition: all 150ms ease;
3
+ --ai-size: var(--ai-size-xs);
4
+ --ai-bg: transparent;
5
+ --ai-hover: light-dark(
6
+ var(--mantine-color-gray-1),
7
+ var(--mantine-color-dark-6)
8
+ );
9
+ --ai-hover-color: var(--mantine-color-bright);
10
+ color: var(--mantine-color-bright);
11
+ &[data-sorted] {
12
+ color: var(--mantine-primary-color-filled);
13
+ }
14
+ margin-left: 1px;
15
+ }
16
+
17
+ .multi-sort-indicator {
18
+ --indicator-size: rem(16px);
19
+ --indicator-color: transparent;
20
+ --indicator-text-color: var(--mantine-color-bright);
21
+ height: var(--indicator-size);
22
+ }
@@ -0,0 +1,89 @@
1
+ import clsx from 'clsx';
2
+
3
+ import classes from './MRT_TableHeadCellSortLabel.module.css';
4
+
5
+ import {
6
+ ActionIcon,
7
+ type ActionIconProps,
8
+ Indicator,
9
+ Tooltip,
10
+ } from '@mantine/core';
11
+
12
+ import type { MRT_Header, MRT_RowData, MRT_TableInstance } from '../../types';
13
+ import { dataVariable } from '../../utils/style.utils';
14
+
15
+ interface Props<TData extends MRT_RowData> extends ActionIconProps {
16
+ header: MRT_Header<TData>;
17
+ table: MRT_TableInstance<TData>;
18
+ }
19
+
20
+ export const MRT_TableHeadCellSortLabel = <TData extends MRT_RowData>({
21
+ header,
22
+ table,
23
+ ...rest
24
+ }: Props<TData>) => {
25
+ 'use no memo';
26
+ const {
27
+ getState,
28
+ options: {
29
+ icons: { IconArrowsSort, IconSortAscending, IconSortDescending },
30
+ localization,
31
+ },
32
+ } = table;
33
+ const column = header.column;
34
+ const { columnDef } = column;
35
+ const { sorting } = getState();
36
+ const sorted = column.getIsSorted();
37
+ const sortIndex = column.getSortIndex();
38
+
39
+ const sortTooltip = sorted
40
+ ? sorted === 'desc'
41
+ ? localization.sortedByColumnDesc.replace('{column}', columnDef.header)
42
+ : localization.sortedByColumnAsc.replace('{column}', columnDef.header)
43
+ : column.getNextSortingOrder() === 'desc'
44
+ ? localization.sortByColumnDesc.replace('{column}', columnDef.header)
45
+ : localization.sortByColumnAsc.replace('{column}', columnDef.header);
46
+
47
+ const SortActionButton = (
48
+ <ActionIcon
49
+ aria-label={sortTooltip}
50
+ {...dataVariable('sorted', sorted)}
51
+ {...rest}
52
+ className={clsx(
53
+ 'mrt-table-head-sort-button',
54
+ classes['sort-icon'],
55
+ rest.className,
56
+ )}
57
+ >
58
+ {sorted === 'desc' ? (
59
+ <IconSortDescending size="100%" />
60
+ ) : sorted === 'asc' ? (
61
+ <IconSortAscending size="100%" />
62
+ ) : (
63
+ <IconArrowsSort size="100%" />
64
+ )}
65
+ </ActionIcon>
66
+ );
67
+
68
+ return (
69
+ <Tooltip label={sortTooltip} openDelay={1000} withinPortal>
70
+ {sorting.length < 2 || sortIndex === -1 ? (
71
+ SortActionButton
72
+ ) : (
73
+ <Indicator
74
+ classNames={{
75
+ root: clsx(
76
+ 'mrt-table-head-multi-sort-indicator',
77
+ classes['multi-sort-indicator'],
78
+ ),
79
+ }}
80
+ inline
81
+ label={sortIndex + 1}
82
+ offset={4}
83
+ >
84
+ {SortActionButton}
85
+ </Indicator>
86
+ )}
87
+ </Tooltip>
88
+ );
89
+ };
@@ -0,0 +1,12 @@
1
+ .root {
2
+ background-color: var(--mrt-base-background-color);
3
+ display: table-row;
4
+ &.layout-mode-grid {
5
+ display: flex;
6
+ }
7
+ }
8
+
9
+ .sticky {
10
+ position: sticky;
11
+ top: 0;
12
+ }
@@ -0,0 +1,87 @@
1
+ import clsx from 'clsx';
2
+
3
+ import classes from './MRT_TableHeadRow.module.css';
4
+
5
+ import { Box, TableTr, type TableTrProps } from '@mantine/core';
6
+
7
+ import { MRT_TableHeadCell } from './MRT_TableHeadCell';
8
+
9
+ import {
10
+ type MRT_ColumnVirtualizer,
11
+ type MRT_Header,
12
+ type MRT_HeaderGroup,
13
+ type MRT_RowData,
14
+ type MRT_TableInstance,
15
+ type MRT_VirtualItem,
16
+ } from '../../types';
17
+ import { parseFromValuesOrFunc } from '../../utils/utils';
18
+
19
+ interface Props<TData extends MRT_RowData> extends TableTrProps {
20
+ columnVirtualizer?: MRT_ColumnVirtualizer;
21
+ headerGroup: MRT_HeaderGroup<TData>;
22
+ table: MRT_TableInstance<TData>;
23
+ }
24
+
25
+ export const MRT_TableHeadRow = <TData extends MRT_RowData>({
26
+ columnVirtualizer,
27
+ headerGroup,
28
+ table,
29
+ ...rest
30
+ }: Props<TData>) => {
31
+ 'use no memo';
32
+ const {
33
+ getState,
34
+ options: { enableStickyHeader, layoutMode, mantineTableHeadRowProps },
35
+ } = table;
36
+ const { isFullScreen } = getState();
37
+
38
+ const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } =
39
+ columnVirtualizer ?? {};
40
+
41
+ const tableRowProps = {
42
+ ...parseFromValuesOrFunc(mantineTableHeadRowProps, {
43
+ headerGroup,
44
+ table,
45
+ }),
46
+ ...rest,
47
+ };
48
+
49
+ return (
50
+ <TableTr
51
+ {...tableRowProps}
52
+ className={clsx(
53
+ classes.root,
54
+ (enableStickyHeader || isFullScreen) && classes.sticky,
55
+ layoutMode?.startsWith('grid') && classes['layout-mode-grid'],
56
+ tableRowProps?.className,
57
+ )}
58
+ >
59
+ {virtualPaddingLeft ? (
60
+ <Box component="th" display="flex" w={virtualPaddingLeft} />
61
+ ) : null}
62
+ {(virtualColumns ?? headerGroup.headers).map(
63
+ (headerOrVirtualHeader, renderedHeaderIndex) => {
64
+ let header = headerOrVirtualHeader as MRT_Header<TData>;
65
+ if (columnVirtualizer) {
66
+ renderedHeaderIndex = (headerOrVirtualHeader as MRT_VirtualItem)
67
+ .index;
68
+ header = headerGroup.headers[renderedHeaderIndex];
69
+ }
70
+
71
+ return (
72
+ <MRT_TableHeadCell
73
+ columnVirtualizer={columnVirtualizer}
74
+ header={header}
75
+ key={header.id}
76
+ renderedHeaderIndex={renderedHeaderIndex}
77
+ table={table}
78
+ />
79
+ );
80
+ },
81
+ )}
82
+ {virtualPaddingRight ? (
83
+ <Box component="th" display="flex" w={virtualPaddingRight} />
84
+ ) : null}
85
+ </TableTr>
86
+ );
87
+ };
@@ -0,0 +1,218 @@
1
+ import { type FocusEvent, type KeyboardEvent, useState } from 'react';
2
+
3
+ import {
4
+ MultiSelect,
5
+ type MultiSelectProps,
6
+ Select,
7
+ type SelectProps,
8
+ TextInput,
9
+ type TextInputProps,
10
+ } from '@mantine/core';
11
+
12
+ import {
13
+ type HTMLPropsRef,
14
+ type MRT_Cell,
15
+ type MRT_CellValue,
16
+ type MRT_RowData,
17
+ type MRT_TableInstance,
18
+ } from '../../types';
19
+ import { parseFromValuesOrFunc } from '../../utils/utils';
20
+
21
+ interface PropsTextInput<TData extends MRT_RowData, TValue = MRT_CellValue>
22
+ extends TextInputProps {
23
+ cell: MRT_Cell<TData, TValue>;
24
+ table: MRT_TableInstance<TData>;
25
+ }
26
+
27
+ interface PropsSelect<TData extends MRT_RowData, TValue = MRT_CellValue>
28
+ extends SelectProps {
29
+ cell: MRT_Cell<TData, TValue>;
30
+ table: MRT_TableInstance<TData>;
31
+ }
32
+
33
+ interface PropsMultiSelect<TData extends MRT_RowData, TValue = MRT_CellValue>
34
+ extends MultiSelectProps {
35
+ cell: MRT_Cell<TData, TValue>;
36
+ table: MRT_TableInstance<TData>;
37
+ }
38
+
39
+ type MRT_TextInputProps = HTMLPropsRef<HTMLInputElement> & TextInputProps;
40
+ type MRT_SelectProps = HTMLPropsRef<HTMLInputElement> & SelectProps;
41
+ type MRT_MultiSelectProps = HTMLPropsRef<HTMLInputElement> & MultiSelectProps;
42
+
43
+ export const MRT_EditCellTextInput = <TData extends MRT_RowData>({
44
+ cell,
45
+ table,
46
+ ...rest
47
+ }: PropsMultiSelect<TData> | PropsSelect<TData> | PropsTextInput<TData>) => {
48
+ 'use no memo';
49
+ const {
50
+ getState,
51
+ options: {
52
+ createDisplayMode,
53
+ editDisplayMode,
54
+ mantineEditSelectProps,
55
+ mantineEditTextInputProps,
56
+ },
57
+ refs: { editInputRefs },
58
+ setCreatingRow,
59
+ setEditingCell,
60
+ setEditingRow,
61
+ } = table;
62
+ const { column, row } = cell;
63
+ const { columnDef } = column;
64
+ const { creatingRow, editingRow } = getState();
65
+
66
+ const isCreating = creatingRow?.id === row.id;
67
+ const isEditing = editingRow?.id === row.id;
68
+ const isSelectEdit = columnDef.editVariant === 'select';
69
+ const isMultiSelectEdit = columnDef.editVariant === 'multi-select';
70
+
71
+ const [value, setValue] = useState(() => cell.getValue<any>());
72
+
73
+ const arg = { cell, column, row, table };
74
+ const textInputProps = {
75
+ ...parseFromValuesOrFunc(mantineEditTextInputProps, arg),
76
+ ...parseFromValuesOrFunc(columnDef.mantineEditTextInputProps, arg),
77
+ ...rest,
78
+ } as MRT_TextInputProps;
79
+
80
+ const selectProps = {
81
+ ...parseFromValuesOrFunc(mantineEditSelectProps, arg),
82
+ ...parseFromValuesOrFunc(columnDef.mantineEditSelectProps, arg),
83
+ ...rest,
84
+ };
85
+
86
+ const saveInputValueToRowCache = (newValue: null | string) => {
87
+ //@ts-ignore
88
+ row._valuesCache[column.id] = newValue;
89
+ if (isCreating) {
90
+ setCreatingRow(row);
91
+ } else if (isEditing) {
92
+ setEditingRow(row);
93
+ }
94
+ };
95
+
96
+ const handleBlur = (event: FocusEvent<HTMLInputElement>) => {
97
+ textInputProps.onBlur?.(event);
98
+ saveInputValueToRowCache(value);
99
+ setEditingCell(null);
100
+ };
101
+
102
+ const handleEnterKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
103
+ textInputProps.onKeyDown?.(event);
104
+ if (event.key === 'Enter') {
105
+ editInputRefs.current[cell.id]?.blur();
106
+ }
107
+ };
108
+
109
+ if (columnDef.Edit) {
110
+ return columnDef.Edit?.({ cell, column, row, table });
111
+ }
112
+
113
+ const commonProps = {
114
+ disabled: parseFromValuesOrFunc(columnDef.enableEditing, row) === false,
115
+ label: ['custom', 'modal'].includes(
116
+ (isCreating ? createDisplayMode : editDisplayMode) as string,
117
+ )
118
+ ? column.columnDef.header
119
+ : undefined,
120
+ name: cell.id,
121
+ onClick: (e: any) => {
122
+ e.stopPropagation();
123
+ textInputProps?.onClick?.(e);
124
+ },
125
+ placeholder: !['custom', 'modal'].includes(
126
+ (isCreating ? createDisplayMode : editDisplayMode) as string,
127
+ )
128
+ ? columnDef.header
129
+ : undefined,
130
+ value,
131
+ variant: editDisplayMode === 'table' ? 'unstyled' : 'default',
132
+ } as const;
133
+
134
+ if (isSelectEdit) {
135
+ return (
136
+ <Select
137
+ {...commonProps}
138
+ searchable
139
+ value={value as any}
140
+ {...(selectProps as MRT_SelectProps)}
141
+ onBlur={handleBlur}
142
+ onChange={(value, option) => {
143
+ (selectProps as MRT_SelectProps).onChange?.(value as any, option);
144
+ setValue(value);
145
+ }}
146
+ onClick={(e) => {
147
+ e.stopPropagation();
148
+ selectProps?.onClick?.(e);
149
+ }}
150
+ ref={(node) => {
151
+ if (node) {
152
+ editInputRefs.current[cell.id] = node;
153
+ if (selectProps.ref && typeof selectProps.ref !== 'function') {
154
+ selectProps.ref.current = node;
155
+ }
156
+ }
157
+ }}
158
+ />
159
+ );
160
+ }
161
+
162
+ if (isMultiSelectEdit) {
163
+ return (
164
+ <MultiSelect
165
+ {...commonProps}
166
+ searchable
167
+ value={value}
168
+ {...(selectProps as MRT_MultiSelectProps)}
169
+ onBlur={handleBlur}
170
+ onChange={(newValue) => {
171
+ (selectProps as MRT_MultiSelectProps).onChange?.(value as any);
172
+ setValue(newValue);
173
+ // Save if not in focus, otherwise it will be handled by onBlur
174
+ if (document.activeElement === editInputRefs.current[cell.id]) return;
175
+ saveInputValueToRowCache(newValue as any);
176
+ }}
177
+ onClick={(e) => {
178
+ e.stopPropagation();
179
+ selectProps?.onClick?.(e);
180
+ }}
181
+ ref={(node) => {
182
+ if (node) {
183
+ editInputRefs.current[cell.id] = node;
184
+ if (selectProps.ref && typeof selectProps.ref !== 'function') {
185
+ selectProps.ref.current = node;
186
+ }
187
+ }
188
+ }}
189
+ />
190
+ );
191
+ }
192
+
193
+ return (
194
+ <TextInput
195
+ {...commonProps}
196
+ onKeyDown={handleEnterKeyDown}
197
+ value={value ?? ''}
198
+ {...textInputProps}
199
+ onBlur={handleBlur}
200
+ onChange={(event) => {
201
+ textInputProps.onChange?.(event);
202
+ setValue(event.target.value);
203
+ }}
204
+ onClick={(event) => {
205
+ event.stopPropagation();
206
+ textInputProps?.onClick?.(event);
207
+ }}
208
+ ref={(node) => {
209
+ if (node) {
210
+ editInputRefs.current[cell.id] = node;
211
+ if (textInputProps.ref && typeof textInputProps.ref !== 'function') {
212
+ textInputProps.ref.current = node;
213
+ }
214
+ }
215
+ }}
216
+ />
217
+ );
218
+ };
@@ -0,0 +1,4 @@
1
+ .root {
2
+ font-weight: normal;
3
+ margin-top: 8px;
4
+ }
@@ -0,0 +1,79 @@
1
+ import clsx from 'clsx';
2
+
3
+ import classes from './MRT_FilterCheckBox.module.css';
4
+
5
+ import { Checkbox, type CheckboxProps, Tooltip } from '@mantine/core';
6
+
7
+ import {
8
+ type MRT_CellValue,
9
+ type MRT_Column,
10
+ type MRT_RowData,
11
+ type MRT_TableInstance,
12
+ } from '../../types';
13
+ import { parseFromValuesOrFunc } from '../../utils/utils';
14
+
15
+ interface Props<TData extends MRT_RowData, TValue = MRT_CellValue>
16
+ extends CheckboxProps {
17
+ column: MRT_Column<TData, TValue>;
18
+ table: MRT_TableInstance<TData>;
19
+ }
20
+
21
+ export const MRT_FilterCheckbox = <TData extends MRT_RowData>({
22
+ column,
23
+ table,
24
+ ...rest
25
+ }: Props<TData>) => {
26
+ 'use no memo';
27
+ const {
28
+ getState,
29
+ options: { localization, mantineFilterCheckboxProps },
30
+ } = table;
31
+ const { density } = getState();
32
+ const { columnDef } = column;
33
+
34
+ const arg = { column, table };
35
+ const checkboxProps = {
36
+ ...parseFromValuesOrFunc(mantineFilterCheckboxProps, arg),
37
+ ...parseFromValuesOrFunc(columnDef.mantineFilterCheckboxProps, arg),
38
+ ...rest,
39
+ } as CheckboxProps;
40
+
41
+ const filterLabel = localization.filterByColumn?.replace(
42
+ '{column}',
43
+ columnDef.header,
44
+ );
45
+
46
+ const value = column.getFilterValue();
47
+
48
+ return (
49
+ <Tooltip
50
+ label={checkboxProps?.title ?? filterLabel}
51
+ openDelay={1000}
52
+ withinPortal
53
+ >
54
+ <Checkbox
55
+ checked={value === 'true'}
56
+ className={clsx('mrt-filter-checkbox', classes.root)}
57
+ indeterminate={value === undefined}
58
+ label={checkboxProps.title ?? filterLabel}
59
+ size={density === 'xs' ? 'sm' : 'md'}
60
+ {...checkboxProps}
61
+ onChange={(e) => {
62
+ column.setFilterValue(
63
+ column.getFilterValue() === undefined
64
+ ? 'true'
65
+ : column.getFilterValue() === 'true'
66
+ ? 'false'
67
+ : undefined,
68
+ );
69
+ checkboxProps?.onChange?.(e);
70
+ }}
71
+ onClick={(e) => {
72
+ e.stopPropagation();
73
+ checkboxProps?.onClick?.(e);
74
+ }}
75
+ title={undefined}
76
+ />
77
+ </Tooltip>
78
+ );
79
+ };