@careharmony/mantine-react-table-ng 0.0.0-stage → 4.0.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 (371) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +217 -3
  3. package/dist/index.cjs +4023 -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 +3909 -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/th/index.cjs +97 -0
  175. package/locales/th/index.d.cts +3 -0
  176. package/locales/th/index.esm.d.mts +3 -0
  177. package/locales/th/index.esm.mjs +95 -0
  178. package/locales/th/package.json +19 -0
  179. package/locales/tr/index.cjs +97 -0
  180. package/locales/tr/index.d.cts +3 -0
  181. package/locales/tr/index.esm.d.mts +3 -0
  182. package/locales/tr/index.esm.mjs +95 -0
  183. package/locales/tr/package.json +19 -0
  184. package/locales/uk/index.cjs +97 -0
  185. package/locales/uk/index.d.cts +3 -0
  186. package/locales/uk/index.esm.d.mts +3 -0
  187. package/locales/uk/index.esm.mjs +95 -0
  188. package/locales/uk/package.json +19 -0
  189. package/locales/vi/index.cjs +97 -0
  190. package/locales/vi/index.d.cts +3 -0
  191. package/locales/vi/index.esm.d.mts +3 -0
  192. package/locales/vi/index.esm.mjs +95 -0
  193. package/locales/vi/package.json +19 -0
  194. package/locales/zh-Hans/index.cjs +97 -0
  195. package/locales/zh-Hans/index.d.cts +3 -0
  196. package/locales/zh-Hans/index.esm.d.mts +3 -0
  197. package/locales/zh-Hans/index.esm.mjs +95 -0
  198. package/locales/zh-Hans/package.json +19 -0
  199. package/locales/zh-Hant/index.cjs +97 -0
  200. package/locales/zh-Hant/index.d.cts +3 -0
  201. package/locales/zh-Hant/index.esm.d.mts +3 -0
  202. package/locales/zh-Hant/index.esm.mjs +95 -0
  203. package/locales/zh-Hant/package.json +19 -0
  204. package/package.json +184 -4
  205. package/src/components/MantineReactTable.tsx +38 -0
  206. package/src/components/body/MRT_TableBody.module.css +42 -0
  207. package/src/components/body/MRT_TableBody.tsx +214 -0
  208. package/src/components/body/MRT_TableBodyCell.module.css +107 -0
  209. package/src/components/body/MRT_TableBodyCell.tsx +355 -0
  210. package/src/components/body/MRT_TableBodyCellValue.tsx +114 -0
  211. package/src/components/body/MRT_TableBodyEmptyRow.tsx +89 -0
  212. package/src/components/body/MRT_TableBodyRow.module.css +261 -0
  213. package/src/components/body/MRT_TableBodyRow.tsx +278 -0
  214. package/src/components/body/MRT_TableBodyRowGrabHandle.tsx +59 -0
  215. package/src/components/body/MRT_TableBodyRowPinButton.tsx +59 -0
  216. package/src/components/body/MRT_TableDetailPanel.module.css +35 -0
  217. package/src/components/body/MRT_TableDetailPanel.tsx +132 -0
  218. package/src/components/buttons/MRT_ColumnPinningButtons.module.css +11 -0
  219. package/src/components/buttons/MRT_ColumnPinningButtons.tsx +69 -0
  220. package/src/components/buttons/MRT_CopyButton.module.css +27 -0
  221. package/src/components/buttons/MRT_CopyButton.tsx +84 -0
  222. package/src/components/buttons/MRT_EditActionButtons.module.css +4 -0
  223. package/src/components/buttons/MRT_EditActionButtons.tsx +139 -0
  224. package/src/components/buttons/MRT_ExpandAllButton.module.css +26 -0
  225. package/src/components/buttons/MRT_ExpandAllButton.tsx +84 -0
  226. package/src/components/buttons/MRT_ExpandButton.module.css +37 -0
  227. package/src/components/buttons/MRT_ExpandButton.tsx +121 -0
  228. package/src/components/buttons/MRT_GrabHandleButton.module.css +6 -0
  229. package/src/components/buttons/MRT_GrabHandleButton.tsx +65 -0
  230. package/src/components/buttons/MRT_RowPinButton.tsx +84 -0
  231. package/src/components/buttons/MRT_ShowHideColumnsButton.tsx +46 -0
  232. package/src/components/buttons/MRT_ToggleDensePaddingButton.tsx +66 -0
  233. package/src/components/buttons/MRT_ToggleFiltersButton.tsx +45 -0
  234. package/src/components/buttons/MRT_ToggleFullScreenButton.tsx +59 -0
  235. package/src/components/buttons/MRT_ToggleGlobalFilterButton.tsx +52 -0
  236. package/src/components/buttons/MRT_ToggleRowActionMenuButton.tsx +87 -0
  237. package/src/components/footer/MRT_TableFooter.module.css +17 -0
  238. package/src/components/footer/MRT_TableFooter.tsx +70 -0
  239. package/src/components/footer/MRT_TableFooterCell.module.css +59 -0
  240. package/src/components/footer/MRT_TableFooterCell.tsx +126 -0
  241. package/src/components/footer/MRT_TableFooterRow.module.css +10 -0
  242. package/src/components/footer/MRT_TableFooterRow.tsx +111 -0
  243. package/src/components/head/MRT_TableHead.module.css +32 -0
  244. package/src/components/head/MRT_TableHead.tsx +106 -0
  245. package/src/components/head/MRT_TableHeadCell.module.css +172 -0
  246. package/src/components/head/MRT_TableHeadCell.tsx +317 -0
  247. package/src/components/head/MRT_TableHeadCellFilterContainer.module.css +5 -0
  248. package/src/components/head/MRT_TableHeadCellFilterContainer.tsx +123 -0
  249. package/src/components/head/MRT_TableHeadCellFilterLabel.module.css +14 -0
  250. package/src/components/head/MRT_TableHeadCellFilterLabel.tsx +176 -0
  251. package/src/components/head/MRT_TableHeadCellGrabHandle.tsx +82 -0
  252. package/src/components/head/MRT_TableHeadCellResizeHandle.module.css +44 -0
  253. package/src/components/head/MRT_TableHeadCellResizeHandle.tsx +68 -0
  254. package/src/components/head/MRT_TableHeadCellSortLabel.module.css +22 -0
  255. package/src/components/head/MRT_TableHeadCellSortLabel.tsx +90 -0
  256. package/src/components/head/MRT_TableHeadRow.module.css +12 -0
  257. package/src/components/head/MRT_TableHeadRow.tsx +105 -0
  258. package/src/components/inputs/MRT_EditCellTextInput.tsx +214 -0
  259. package/src/components/inputs/MRT_FilterCheckBox.module.css +4 -0
  260. package/src/components/inputs/MRT_FilterCheckbox.tsx +80 -0
  261. package/src/components/inputs/MRT_FilterRangeFields.module.css +5 -0
  262. package/src/components/inputs/MRT_FilterRangeFields.tsx +36 -0
  263. package/src/components/inputs/MRT_FilterRangeSlider.module.css +6 -0
  264. package/src/components/inputs/MRT_FilterRangeSlider.tsx +107 -0
  265. package/src/components/inputs/MRT_FilterTextInput.module.css +27 -0
  266. package/src/components/inputs/MRT_FilterTextInput.tsx +418 -0
  267. package/src/components/inputs/MRT_GlobalFilterTextInput.module.css +11 -0
  268. package/src/components/inputs/MRT_GlobalFilterTextInput.tsx +142 -0
  269. package/src/components/inputs/MRT_SelectCheckbox.tsx +138 -0
  270. package/src/components/menus/MRT_ColumnActionMenu.module.css +7 -0
  271. package/src/components/menus/MRT_ColumnActionMenu.tsx +288 -0
  272. package/src/components/menus/MRT_FilterOptionMenu.module.css +6 -0
  273. package/src/components/menus/MRT_FilterOptionMenu.tsx +279 -0
  274. package/src/components/menus/MRT_RowActionMenu.tsx +75 -0
  275. package/src/components/menus/MRT_ShowHideColumnsMenu.module.css +10 -0
  276. package/src/components/menus/MRT_ShowHideColumnsMenu.tsx +136 -0
  277. package/src/components/menus/MRT_ShowHideColumnsMenuItems.module.css +35 -0
  278. package/src/components/menus/MRT_ShowHideColumnsMenuItems.tsx +171 -0
  279. package/src/components/modals/MRT_EditRowModal.tsx +98 -0
  280. package/src/components/table/MRT_Table.module.css +7 -0
  281. package/src/components/table/MRT_Table.tsx +155 -0
  282. package/src/components/table/MRT_TableContainer.module.css +32 -0
  283. package/src/components/table/MRT_TableContainer.tsx +124 -0
  284. package/src/components/table/MRT_TablePaper.module.css +88 -0
  285. package/src/components/table/MRT_TablePaper.tsx +91 -0
  286. package/src/components/toolbar/MRT_BottomToolbar.module.css +40 -0
  287. package/src/components/toolbar/MRT_BottomToolbar.tsx +99 -0
  288. package/src/components/toolbar/MRT_ProgressBar.module.css +10 -0
  289. package/src/components/toolbar/MRT_ProgressBar.tsx +54 -0
  290. package/src/components/toolbar/MRT_TablePagination.module.css +20 -0
  291. package/src/components/toolbar/MRT_TablePagination.tsx +175 -0
  292. package/src/components/toolbar/MRT_ToolbarAlertBanner.module.css +37 -0
  293. package/src/components/toolbar/MRT_ToolbarAlertBanner.tsx +169 -0
  294. package/src/components/toolbar/MRT_ToolbarDropZone.module.css +23 -0
  295. package/src/components/toolbar/MRT_ToolbarDropZone.tsx +68 -0
  296. package/src/components/toolbar/MRT_ToolbarInternalButtons.module.css +6 -0
  297. package/src/components/toolbar/MRT_ToolbarInternalButtons.tsx +74 -0
  298. package/src/components/toolbar/MRT_TopToolbar.module.css +24 -0
  299. package/src/components/toolbar/MRT_TopToolbar.tsx +127 -0
  300. package/src/components/toolbar/common.styles.module.css +10 -0
  301. package/src/fns/aggregationFns.ts +3 -0
  302. package/src/fns/filterFns.ts +243 -0
  303. package/src/fns/sortingFns.ts +34 -0
  304. package/src/hooks/display-columns/getMRT_RowActionsColumnDef.tsx +25 -0
  305. package/src/hooks/display-columns/getMRT_RowDragColumnDef.tsx +32 -0
  306. package/src/hooks/display-columns/getMRT_RowExpandColumnDef.tsx +94 -0
  307. package/src/hooks/display-columns/getMRT_RowNumbersColumnDef.tsx +32 -0
  308. package/src/hooks/display-columns/getMRT_RowPinningColumnDef.tsx +26 -0
  309. package/src/hooks/display-columns/getMRT_RowSelectColumnDef.tsx +36 -0
  310. package/src/hooks/display-columns/getMRT_RowSpacerColumnDef.tsx +36 -0
  311. package/src/hooks/useMRT_ColumnVirtualizer.ts +135 -0
  312. package/src/hooks/useMRT_Effects.ts +109 -0
  313. package/src/hooks/useMRT_RowVirtualizer.ts +101 -0
  314. package/src/hooks/useMRT_Rows.ts +47 -0
  315. package/src/hooks/useMRT_TableInstance.ts +320 -0
  316. package/src/hooks/useMRT_TableOptions.ts +300 -0
  317. package/src/hooks/useMRT_TableSnapshot.ts +134 -0
  318. package/src/hooks/useMRT_VirtualizerScrollElement.ts +31 -0
  319. package/src/hooks/useMantineReactTable.ts +23 -0
  320. package/src/icons.ts +108 -0
  321. package/src/index.ts +91 -0
  322. package/src/locales/ar.ts +96 -0
  323. package/src/locales/az.ts +96 -0
  324. package/src/locales/bg.ts +96 -0
  325. package/src/locales/cs.ts +97 -0
  326. package/src/locales/da.ts +96 -0
  327. package/src/locales/de.ts +96 -0
  328. package/src/locales/el.ts +96 -0
  329. package/src/locales/en.ts +96 -0
  330. package/src/locales/es.ts +96 -0
  331. package/src/locales/et.ts +97 -0
  332. package/src/locales/fa.ts +96 -0
  333. package/src/locales/fi.ts +97 -0
  334. package/src/locales/fr.ts +96 -0
  335. package/src/locales/he.ts +96 -0
  336. package/src/locales/hr.ts +96 -0
  337. package/src/locales/hu.ts +96 -0
  338. package/src/locales/hy.ts +96 -0
  339. package/src/locales/id.ts +97 -0
  340. package/src/locales/it.ts +96 -0
  341. package/src/locales/ja.ts +96 -0
  342. package/src/locales/ko.ts +96 -0
  343. package/src/locales/nl.ts +96 -0
  344. package/src/locales/no.ts +97 -0
  345. package/src/locales/np.ts +97 -0
  346. package/src/locales/pl.ts +96 -0
  347. package/src/locales/pt-BR.ts +96 -0
  348. package/src/locales/pt.ts +96 -0
  349. package/src/locales/ro.ts +96 -0
  350. package/src/locales/ru.ts +96 -0
  351. package/src/locales/sk.ts +97 -0
  352. package/src/locales/sr-Cyrl-RS.ts +96 -0
  353. package/src/locales/sr-Latn-RS.ts +96 -0
  354. package/src/locales/sv.ts +96 -0
  355. package/src/locales/th.ts +97 -0
  356. package/src/locales/tr.ts +96 -0
  357. package/src/locales/uk.ts +96 -0
  358. package/src/locales/vi.ts +96 -0
  359. package/src/locales/zh-Hans.ts +95 -0
  360. package/src/locales/zh-Hant.ts +95 -0
  361. package/src/types.ts +1299 -0
  362. package/src/typings.d.ts +1 -0
  363. package/src/utils/column.utils.ts +157 -0
  364. package/src/utils/displayColumn.utils.ts +153 -0
  365. package/src/utils/row.utils.ts +263 -0
  366. package/src/utils/snapshot.utils.ts +97 -0
  367. package/src/utils/style.utils.ts +32 -0
  368. package/src/utils/tanstack.helpers.ts +66 -0
  369. package/src/utils/utils.ts +15 -0
  370. package/src/utils/virtualization.utils.ts +85 -0
  371. package/styles.css +1381 -0
@@ -0,0 +1,84 @@
1
+ 'use no memo';
2
+
3
+ import clsx from 'clsx';
4
+
5
+ import classes from './MRT_CopyButton.module.css';
6
+
7
+ import { type ReactNode } from 'react';
8
+
9
+ import {
10
+ CopyButton,
11
+ Tooltip,
12
+ UnstyledButton,
13
+ type UnstyledButtonProps,
14
+ } from '@mantine/core';
15
+
16
+ import {
17
+ type MRT_Cell,
18
+ type MRT_CellValue,
19
+ type MRT_RowData,
20
+ type MRT_TableInstance,
21
+ } from '../../types';
22
+ import { parseFromValuesOrFunc } from '../../utils/utils';
23
+
24
+ interface Props<TData extends MRT_RowData, TValue = MRT_CellValue>
25
+ extends UnstyledButtonProps {
26
+ cell: MRT_Cell<TData, TValue>;
27
+ children: ReactNode;
28
+ table: MRT_TableInstance<TData>;
29
+ }
30
+
31
+ export const MRT_CopyButton = <TData extends MRT_RowData>({
32
+ cell,
33
+ children,
34
+ table,
35
+ ...rest
36
+ }: Props<TData>) => {
37
+ const {
38
+ options: {
39
+ localization: { clickToCopy, copiedToClipboard },
40
+ mantineCopyButtonProps,
41
+ },
42
+ } = table;
43
+ const { column, row } = cell;
44
+ const { columnDef } = column;
45
+
46
+ const arg = { cell, column, row, table };
47
+ const buttonProps = {
48
+ ...parseFromValuesOrFunc(mantineCopyButtonProps, arg),
49
+ ...parseFromValuesOrFunc(columnDef.mantineCopyButtonProps, arg),
50
+ ...rest,
51
+ };
52
+
53
+ return (
54
+ <CopyButton value={cell.getValue<string>()}>
55
+ {({ copied, copy }) => (
56
+ <Tooltip
57
+ color={copied ? 'green' : undefined}
58
+ label={
59
+ buttonProps?.title ?? (copied ? copiedToClipboard : clickToCopy)
60
+ }
61
+ openDelay={1000}
62
+ withinPortal
63
+ >
64
+ <UnstyledButton
65
+ {...buttonProps}
66
+ className={clsx(
67
+ 'mrt-copy-button',
68
+ classes.root,
69
+ buttonProps?.className,
70
+ )}
71
+ onClick={(e) => {
72
+ e.stopPropagation();
73
+ copy();
74
+ }}
75
+ role="presentation"
76
+ title={undefined}
77
+ >
78
+ {children}
79
+ </UnstyledButton>
80
+ </Tooltip>
81
+ )}
82
+ </CopyButton>
83
+ );
84
+ };
@@ -0,0 +1,4 @@
1
+ .root {
2
+ display: flex;
3
+ gap: var(--mantine-spacing-xs);
4
+ }
@@ -0,0 +1,139 @@
1
+ 'use no memo';
2
+
3
+ import clsx from 'clsx';
4
+
5
+ import classes from './MRT_EditActionButtons.module.css';
6
+
7
+ import { ActionIcon, Box, type BoxProps, Button, Tooltip } from '@mantine/core';
8
+
9
+ import {
10
+ type MRT_Row,
11
+ type MRT_RowData,
12
+ type MRT_TableInstance,
13
+ } from '../../types';
14
+
15
+ interface Props<TData extends MRT_RowData> extends BoxProps {
16
+ row: MRT_Row<TData>;
17
+ table: MRT_TableInstance<TData>;
18
+ variant?: 'icon' | 'text';
19
+ }
20
+
21
+ export const MRT_EditActionButtons = <TData extends MRT_RowData>({
22
+ row,
23
+ table,
24
+ variant = 'icon',
25
+ ...rest
26
+ }: Props<TData>) => {
27
+ const {
28
+ getState,
29
+ options: {
30
+ icons: { IconCircleX, IconDeviceFloppy },
31
+ localization,
32
+ onCreatingRowCancel,
33
+ onCreatingRowSave,
34
+ onEditingRowCancel,
35
+ onEditingRowSave,
36
+ },
37
+ refs: { editInputRefs },
38
+ setCreatingRow,
39
+ setEditingRow,
40
+ } = table;
41
+ const { creatingRow, editingRow, isSaving } = getState();
42
+
43
+ const isCreating = creatingRow?.id === row.id;
44
+ const isEditing = editingRow?.id === row.id;
45
+
46
+ const handleCancel = () => {
47
+ if (isCreating) {
48
+ onCreatingRowCancel?.({ row, table });
49
+ setCreatingRow(null);
50
+ } else if (isEditing) {
51
+ onEditingRowCancel?.({ row, table });
52
+ setEditingRow(null);
53
+ }
54
+ row._valuesCache = {} as any; //reset values cache
55
+ };
56
+
57
+ const handleSubmitRow = () => {
58
+ //look for auto-filled input values. A browser can fill an input without
59
+ //firing the change event that saves the value to the row cache.
60
+ const inputNamePrefix = `${row.id}_`; //input names are cell ids: rowId_columnId
61
+ const valuesCache = row._valuesCache as Record<string, unknown>;
62
+ Object.values(editInputRefs?.current ?? {})
63
+ .filter((input) => input?.name?.startsWith(inputNamePrefix))
64
+ .forEach((input) => {
65
+ const columnId = input.name.slice(inputNamePrefix.length);
66
+ const editVariant = table.getColumn(columnId)?.columnDef.editVariant;
67
+ //select inputs show the option label, not the value, so only text inputs are read
68
+ const isTextInput = !editVariant || editVariant === 'text';
69
+ if (
70
+ isTextInput &&
71
+ Object.hasOwn(valuesCache, columnId) &&
72
+ //a number or other parsed value is the consumer's, and its text form can differ
73
+ (typeof valuesCache[columnId] === 'string' ||
74
+ valuesCache[columnId] == null) &&
75
+ input.value !== String(valuesCache[columnId] ?? '')
76
+ ) {
77
+ valuesCache[columnId] = input.value;
78
+ }
79
+ });
80
+ if (isCreating)
81
+ onCreatingRowSave?.({
82
+ exitCreatingMode: () => setCreatingRow(null),
83
+ row,
84
+ table,
85
+ values: row._valuesCache,
86
+ });
87
+ else if (isEditing) {
88
+ onEditingRowSave?.({
89
+ exitEditingMode: () => setEditingRow(null),
90
+ row,
91
+ table,
92
+ values: row?._valuesCache,
93
+ });
94
+ }
95
+ };
96
+
97
+ return (
98
+ <Box
99
+ className={clsx('mrt-edit-action-buttons', classes.root)}
100
+ onClick={(e) => e.stopPropagation()}
101
+ {...rest}
102
+ >
103
+ {variant === 'icon' ? (
104
+ <>
105
+ <Tooltip label={localization.cancel} withinPortal>
106
+ <ActionIcon
107
+ aria-label={localization.cancel}
108
+ color="red"
109
+ onClick={handleCancel}
110
+ variant="subtle"
111
+ >
112
+ <IconCircleX />
113
+ </ActionIcon>
114
+ </Tooltip>
115
+ <Tooltip label={localization.save} withinPortal>
116
+ <ActionIcon
117
+ aria-label={localization.save}
118
+ color="blue"
119
+ loading={isSaving}
120
+ onClick={handleSubmitRow}
121
+ variant="subtle"
122
+ >
123
+ <IconDeviceFloppy />
124
+ </ActionIcon>
125
+ </Tooltip>
126
+ </>
127
+ ) : (
128
+ <>
129
+ <Button onClick={handleCancel} variant="subtle">
130
+ {localization.cancel}
131
+ </Button>
132
+ <Button loading={isSaving} onClick={handleSubmitRow} variant="filled">
133
+ {localization.save}
134
+ </Button>
135
+ </>
136
+ )}
137
+ </Box>
138
+ );
139
+ };
@@ -0,0 +1,26 @@
1
+ .root {
2
+ margin-left: 6px;
3
+ opacity: 0.8;
4
+ &:disabled {
5
+ background-color: transparent;
6
+ border: none;
7
+ }
8
+ &:hover {
9
+ opacity: 1;
10
+ }
11
+ &:global(.xl) {
12
+ margin-left: -6px;
13
+ }
14
+ &:global(.md) {
15
+ margin-left: 0;
16
+ }
17
+ .chevron {
18
+ transition: transform 150ms;
19
+ &.up {
20
+ transform: rotate(-180deg);
21
+ }
22
+ &.right {
23
+ transform: rotate(-90deg);
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,84 @@
1
+ 'use no memo';
2
+
3
+ import clsx from 'clsx';
4
+
5
+ import classes from './MRT_ExpandAllButton.module.css';
6
+
7
+ import { ActionIcon, type ActionIconProps, Tooltip } from '@mantine/core';
8
+
9
+ import { type MRT_RowData, type MRT_TableInstance } from '../../types';
10
+ import { parseFromValuesOrFunc } from '../../utils/utils';
11
+
12
+ interface Props<TData extends MRT_RowData> extends ActionIconProps {
13
+ table: MRT_TableInstance<TData>;
14
+ }
15
+
16
+ export const MRT_ExpandAllButton = <TData extends MRT_RowData>({
17
+ table,
18
+ ...rest
19
+ }: Props<TData>) => {
20
+ const {
21
+ getCanSomeRowsExpand,
22
+ getIsAllRowsExpanded,
23
+ getIsSomeRowsExpanded,
24
+ getState,
25
+ options: {
26
+ icons: { IconChevronsDown },
27
+ localization,
28
+ mantineExpandAllButtonProps,
29
+ renderDetailPanel,
30
+ },
31
+ toggleAllRowsExpanded,
32
+ } = table;
33
+ const { density, isLoading } = getState();
34
+
35
+ const actionIconProps = {
36
+ ...parseFromValuesOrFunc(mantineExpandAllButtonProps, {
37
+ table,
38
+ }),
39
+ ...rest,
40
+ };
41
+
42
+ const isAllRowsExpanded = getIsAllRowsExpanded();
43
+
44
+ return (
45
+ <Tooltip
46
+ label={
47
+ (actionIconProps?.title ?? isAllRowsExpanded)
48
+ ? localization.collapseAll
49
+ : localization.expandAll
50
+ }
51
+ openDelay={1000}
52
+ withinPortal
53
+ >
54
+ <ActionIcon
55
+ aria-label={localization.expandAll}
56
+ color="gray"
57
+ variant="subtle"
58
+ {...actionIconProps}
59
+ className={clsx(
60
+ 'mrt-expand-all-button',
61
+ classes.root,
62
+ actionIconProps?.className,
63
+ density,
64
+ )}
65
+ disabled={isLoading || (!renderDetailPanel && !getCanSomeRowsExpand())}
66
+ onClick={() => toggleAllRowsExpanded(!isAllRowsExpanded)}
67
+ title={undefined}
68
+ >
69
+ {actionIconProps?.children ?? (
70
+ <IconChevronsDown
71
+ className={clsx(
72
+ classes.chevron,
73
+ isAllRowsExpanded
74
+ ? classes.up
75
+ : getIsSomeRowsExpanded()
76
+ ? classes.right
77
+ : undefined,
78
+ )}
79
+ />
80
+ )}
81
+ </ActionIcon>
82
+ </Tooltip>
83
+ );
84
+ };
@@ -0,0 +1,37 @@
1
+ .root {
2
+ opacity: 0.8;
3
+ &:disabled {
4
+ background-color: transparent;
5
+ border: none;
6
+ opacity: 0.3;
7
+ }
8
+ &:hover {
9
+ opacity: 1;
10
+ }
11
+ }
12
+
13
+ .root-ltr {
14
+ margin-left: calc(calc(var(--mrt-row-depth, 0)) * 16px);
15
+ .chevron {
16
+ transition: transform 200ms;
17
+ &.right {
18
+ transform: rotate(270deg);
19
+ }
20
+ &.up {
21
+ transform: rotate(-180deg);
22
+ }
23
+ }
24
+ }
25
+
26
+ .root-rtl {
27
+ margin-right: calc(calc(var(--mrt-row-depth, 0)) * 16px);
28
+ .chevron {
29
+ transition: transform 200ms;
30
+ &.right {
31
+ transform: rotate(-270deg);
32
+ }
33
+ &.up {
34
+ transform: rotate(180deg);
35
+ }
36
+ }
37
+ }
@@ -0,0 +1,121 @@
1
+ 'use no memo';
2
+
3
+ import clsx from 'clsx';
4
+
5
+ import classes from './MRT_ExpandButton.module.css';
6
+
7
+ import { type MouseEvent } from 'react';
8
+
9
+ import {
10
+ ActionIcon,
11
+ type ActionIconProps,
12
+ Tooltip,
13
+ useDirection,
14
+ } from '@mantine/core';
15
+
16
+ import {
17
+ type MRT_Row,
18
+ type MRT_RowData,
19
+ type MRT_TableInstance,
20
+ } from '../../types';
21
+ import { parseFromValuesOrFunc } from '../../utils/utils';
22
+ import { MRT_EditCellTextInput } from '../inputs/MRT_EditCellTextInput';
23
+
24
+ interface Props<TData extends MRT_RowData> extends ActionIconProps {
25
+ row: MRT_Row<TData>;
26
+ table: MRT_TableInstance<TData>;
27
+ }
28
+
29
+ export const MRT_ExpandButton = <TData extends MRT_RowData>({
30
+ row,
31
+ table,
32
+ ...rest
33
+ }: Props<TData>) => {
34
+ const direction = useDirection();
35
+ const {
36
+ options: {
37
+ icons: { IconChevronDown },
38
+ localization,
39
+ mantineExpandButtonProps,
40
+ positionExpandColumn,
41
+ renderDetailPanel,
42
+ },
43
+ } = table;
44
+
45
+ const actionIconProps = {
46
+ ...parseFromValuesOrFunc(mantineExpandButtonProps, {
47
+ row,
48
+ table,
49
+ }),
50
+ ...rest,
51
+ };
52
+
53
+ const internalEditComponents = row
54
+ .getAllCells()
55
+ .filter((cell) => cell.column.columnDef.columnDefType === 'data')
56
+ .map((cell) => (
57
+ <MRT_EditCellTextInput cell={cell} key={cell.id} table={table} />
58
+ ));
59
+
60
+ const canExpand = row.getCanExpand();
61
+ const isExpanded = row.getIsExpanded();
62
+
63
+ const DetailPanel = !!renderDetailPanel?.({
64
+ internalEditComponents,
65
+ row,
66
+ table,
67
+ });
68
+
69
+ const handleToggleExpand = (event: MouseEvent<HTMLButtonElement>) => {
70
+ event.stopPropagation();
71
+ row.toggleExpanded();
72
+ actionIconProps?.onClick?.(event);
73
+ };
74
+
75
+ const rtl = direction.dir === 'rtl' || positionExpandColumn === 'last';
76
+
77
+ return (
78
+ <Tooltip
79
+ disabled={!canExpand && !DetailPanel}
80
+ label={
81
+ actionIconProps?.title ??
82
+ (isExpanded ? localization.collapse : localization.expand)
83
+ }
84
+ openDelay={1000}
85
+ withinPortal
86
+ >
87
+ <ActionIcon
88
+ aria-label={localization.expand}
89
+ color="gray"
90
+ disabled={!canExpand && !DetailPanel}
91
+ variant="subtle"
92
+ {...actionIconProps}
93
+ __vars={{
94
+ '--mrt-row-depth': `${row.depth}`,
95
+ }}
96
+ className={clsx(
97
+ 'mrt-expand-button',
98
+ classes.root,
99
+ classes[`root-${rtl ? 'rtl' : 'ltr'}`],
100
+ actionIconProps?.className,
101
+ )}
102
+ onClick={handleToggleExpand}
103
+ title={undefined}
104
+ >
105
+ {actionIconProps?.children ?? (
106
+ <IconChevronDown
107
+ className={clsx(
108
+ 'mrt-expand-button-chevron',
109
+ classes.chevron,
110
+ !canExpand && !renderDetailPanel
111
+ ? classes.right
112
+ : isExpanded
113
+ ? classes.up
114
+ : undefined,
115
+ )}
116
+ />
117
+ )}
118
+ </ActionIcon>
119
+ </Tooltip>
120
+ );
121
+ };
@@ -0,0 +1,6 @@
1
+ .grab-icon {
2
+ cursor: grab;
3
+ &:active {
4
+ cursor: grabbing;
5
+ }
6
+ }
@@ -0,0 +1,65 @@
1
+ 'use no memo';
2
+
3
+ import clsx from 'clsx';
4
+
5
+ import classes from './MRT_GrabHandleButton.module.css';
6
+
7
+ import { type DragEventHandler } from 'react';
8
+
9
+ import { ActionIcon, type ActionIconProps, Tooltip } from '@mantine/core';
10
+
11
+ import {
12
+ type HTMLPropsRef,
13
+ type MRT_RowData,
14
+ type MRT_TableInstance,
15
+ } from '../../types';
16
+
17
+ interface Props<TData extends MRT_RowData> {
18
+ actionIconProps?: ActionIconProps & HTMLPropsRef<HTMLButtonElement>;
19
+ onDragEnd: DragEventHandler<HTMLButtonElement>;
20
+ onDragStart: DragEventHandler<HTMLButtonElement>;
21
+ table: MRT_TableInstance<TData>;
22
+ }
23
+
24
+ export const MRT_GrabHandleButton = <TData extends MRT_RowData>({
25
+ actionIconProps,
26
+ onDragEnd,
27
+ onDragStart,
28
+ table: {
29
+ options: {
30
+ icons: { IconGripHorizontal },
31
+ localization: { move },
32
+ },
33
+ },
34
+ }: Props<TData>) => {
35
+ return (
36
+ <Tooltip
37
+ label={actionIconProps?.title ?? move}
38
+ openDelay={1000}
39
+ withinPortal
40
+ >
41
+ <ActionIcon
42
+ aria-label={actionIconProps?.title ?? move}
43
+ draggable
44
+ {...actionIconProps}
45
+ className={clsx(
46
+ 'mrt-grab-handle-button',
47
+ classes['grab-icon'],
48
+ actionIconProps?.className,
49
+ )}
50
+ color="gray"
51
+ onClick={(e) => {
52
+ e.stopPropagation();
53
+ actionIconProps?.onClick?.(e);
54
+ }}
55
+ onDragEnd={onDragEnd}
56
+ onDragStart={onDragStart}
57
+ size="sm"
58
+ title={undefined}
59
+ variant="transparent"
60
+ >
61
+ <IconGripHorizontal size="100%" />
62
+ </ActionIcon>
63
+ </Tooltip>
64
+ );
65
+ };
@@ -0,0 +1,84 @@
1
+ 'use no memo';
2
+
3
+ import { type MouseEvent, useState } from 'react';
4
+
5
+ import { type RowPinningPosition } from '@tanstack/react-table';
6
+
7
+ import { ActionIcon, type ActionIconProps, Tooltip } from '@mantine/core';
8
+
9
+ import {
10
+ type MRT_Row,
11
+ type MRT_RowData,
12
+ type MRT_TableInstance,
13
+ } from '../../types';
14
+
15
+ interface Props<TData extends MRT_RowData> extends ActionIconProps {
16
+ pinningPosition: RowPinningPosition;
17
+ row: MRT_Row<TData>;
18
+ table: MRT_TableInstance<TData>;
19
+ }
20
+
21
+ export const MRT_RowPinButton = <TData extends MRT_RowData>({
22
+ pinningPosition,
23
+ row,
24
+ table,
25
+ ...rest
26
+ }: Props<TData>) => {
27
+ const {
28
+ options: {
29
+ icons: { IconPinned, IconX },
30
+ localization,
31
+ rowPinningDisplayMode,
32
+ },
33
+ } = table;
34
+
35
+ const isPinned = row.getIsPinned();
36
+
37
+ const [tooltipOpened, setTooltipOpened] = useState(false);
38
+
39
+ const handleTogglePin = (event: MouseEvent<HTMLButtonElement>) => {
40
+ setTooltipOpened(false);
41
+ event.stopPropagation();
42
+ row.pin(isPinned ? false : pinningPosition);
43
+ };
44
+
45
+ return (
46
+ <Tooltip
47
+ label={isPinned ? localization.unpin : localization.pin}
48
+ openDelay={1000}
49
+ opened={tooltipOpened}
50
+ >
51
+ <ActionIcon
52
+ aria-label={localization.pin}
53
+ color="gray"
54
+ onClick={handleTogglePin}
55
+ onMouseEnter={() => setTooltipOpened(true)}
56
+ onMouseLeave={() => setTooltipOpened(false)}
57
+ size="xs"
58
+ style={{
59
+ height: '24px',
60
+ width: '24px',
61
+ }}
62
+ variant="subtle"
63
+ {...rest}
64
+ >
65
+ {isPinned ? (
66
+ <IconX />
67
+ ) : (
68
+ <IconPinned
69
+ fontSize="small"
70
+ style={{
71
+ transform: `rotate(${
72
+ rowPinningDisplayMode === 'sticky'
73
+ ? 135
74
+ : pinningPosition === 'top'
75
+ ? 180
76
+ : 0
77
+ }deg)`,
78
+ }}
79
+ />
80
+ )}
81
+ </ActionIcon>
82
+ </Tooltip>
83
+ );
84
+ };
@@ -0,0 +1,46 @@
1
+ 'use no memo';
2
+
3
+ import { ActionIcon, type ActionIconProps, Menu, Tooltip } from '@mantine/core';
4
+
5
+ import {
6
+ type HTMLPropsRef,
7
+ type MRT_RowData,
8
+ type MRT_TableInstance,
9
+ } from '../../types';
10
+ import { MRT_ShowHideColumnsMenu } from '../menus/MRT_ShowHideColumnsMenu';
11
+
12
+ interface Props<TData extends MRT_RowData>
13
+ extends ActionIconProps,
14
+ HTMLPropsRef<HTMLButtonElement> {
15
+ table: MRT_TableInstance<TData>;
16
+ }
17
+
18
+ export const MRT_ShowHideColumnsButton = <TData extends MRT_RowData>({
19
+ table,
20
+ title,
21
+ ...rest
22
+ }: Props<TData>) => {
23
+ const {
24
+ icons: { IconColumns },
25
+ localization: { showHideColumns },
26
+ } = table.options;
27
+
28
+ return (
29
+ <Menu closeOnItemClick={false} withinPortal>
30
+ <Tooltip label={title ?? showHideColumns} withinPortal>
31
+ <Menu.Target>
32
+ <ActionIcon
33
+ aria-label={title ?? showHideColumns}
34
+ color="gray"
35
+ size="lg"
36
+ variant="subtle"
37
+ {...rest}
38
+ >
39
+ <IconColumns />
40
+ </ActionIcon>
41
+ </Menu.Target>
42
+ </Tooltip>
43
+ <MRT_ShowHideColumnsMenu table={table} />
44
+ </Menu>
45
+ );
46
+ };