@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,3909 @@
1
+ 'use no memo';
2
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
+ import clsx from 'clsx';
4
+ import { useState, memo, useEffect, useRef, useMemo, useReducer, useCallback, Fragment as Fragment$1, createElement, useLayoutEffect } from 'react';
5
+ import { Highlight, CopyButton, Tooltip, UnstyledButton, Select, MultiSelect, TextInput, useDirection, TableTd, Skeleton, TableTr, Collapse, Box, Text, TableTbody, ActionIcon, Flex, Button, useMantineTheme, Menu, Switch, TableTh, TableTfoot, Checkbox, Badge, Autocomplete, RangeSlider, Popover, Transition, Indicator, Radio, Alert, Stack, TableThead, useMantineColorScheme, Table, lighten, darken, Modal, LoadingOverlay, Progress, extractStyleProps, Group, Pagination, Paper } from '@mantine/core';
6
+ import { sortingFns, createRow as createRow$1, filterFns, flexRender as flexRender$1, aggregationFns, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from '@tanstack/react-table';
7
+ import { compareItems, rankItem, rankings } from '@tanstack/match-sorter-utils';
8
+ import { defaultRangeExtractor, useVirtualizer } from '@tanstack/react-virtual';
9
+ import { useHover, useMediaQuery } from '@mantine/hooks';
10
+ import { DateInput } from '@mantine/dates';
11
+ import { IconArrowAutofitContent, IconArrowsSort, IconBaselineDensityLarge, IconBaselineDensityMedium, IconBaselineDensitySmall, IconBoxMultiple, IconChevronDown, IconChevronLeft, IconChevronLeftPipe, IconChevronRight, IconChevronRightPipe, IconChevronsDown, IconCircleX, IconClearAll, IconColumns, IconDeviceFloppy, IconDots, IconDotsVertical, IconEdit, IconEyeOff, IconFilter, IconFilterCog, IconFilterOff, IconGripHorizontal, IconMaximize, IconMinimize, IconPinned, IconPinnedOff, IconSearch, IconSearchOff, IconSortAscending, IconSortDescending, IconX } from '@tabler/icons-react';
12
+
13
+ /******************************************************************************
14
+ Copyright (c) Microsoft Corporation.
15
+
16
+ Permission to use, copy, modify, and/or distribute this software for any
17
+ purpose with or without fee is hereby granted.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
20
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
21
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
22
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
23
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
24
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
25
+ PERFORMANCE OF THIS SOFTWARE.
26
+ ***************************************************************************** */
27
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
28
+
29
+
30
+ function __rest(s, e) {
31
+ var t = {};
32
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
33
+ t[p] = s[p];
34
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
35
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
36
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
37
+ t[p[i]] = s[p[i]];
38
+ }
39
+ return t;
40
+ }
41
+
42
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
43
+ var e = new Error(message);
44
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
45
+ };
46
+
47
+ var classes$C = {"root":"MRT_TableBody-module_root__kGhRy","root-grid":"MRT_TableBody-module_root-grid__WdOGg","root-no-rows":"MRT_TableBody-module_root-no-rows__iyi9K","root-virtualized":"MRT_TableBody-module_root-virtualized__TxPAi","empty-row-tr-grid":"MRT_TableBody-module_empty-row-tr-grid__LTgxw","empty-row-td-grid":"MRT_TableBody-module_empty-row-td-grid__pzlgG","empty-row-td-content":"MRT_TableBody-module_empty-row-td-content__Cc2XW","pinned":"MRT_TableBody-module_pinned__XHpcs"};
48
+
49
+ var classes$B = {"root":"MRT_TableBodyRow-module_root__2c3D4","root-grid":"MRT_TableBodyRow-module_root-grid__AwXTe","root-virtualized":"MRT_TableBodyRow-module_root-virtualized__zYgxq"};
50
+
51
+ var classes$A = {"root":"MRT_TableBodyCell-module_root__Wf-zi","root-grid":"MRT_TableBodyCell-module_root-grid__zIuC-","root-virtualized":"MRT_TableBodyCell-module_root-virtualized__jLl8R","root-data-col":"MRT_TableBodyCell-module_root-data-col__HHcxc","root-nowrap":"MRT_TableBodyCell-module_root-nowrap__-k1Jo","root-cursor-pointer":"MRT_TableBodyCell-module_root-cursor-pointer__4kw7J","root-editable-hover":"MRT_TableBodyCell-module_root-editable-hover__2DKSa","root-cell-hover-reveal":"MRT_TableBodyCell-module_root-cell-hover-reveal__T1fAH","cell-hover-reveal":"MRT_TableBodyCell-module_cell-hover-reveal__Q-1Xj","overflowing":"MRT_TableBodyCell-module_overflowing__QcXP4"};
52
+
53
+ const assignRef = (ref, value) => {
54
+ if (typeof ref === 'function') {
55
+ ref(value);
56
+ }
57
+ else if (ref) {
58
+ ref.current = value;
59
+ }
60
+ };
61
+ const parseFromValuesOrFunc = (fn, arg) => (fn instanceof Function ? fn(arg) : fn);
62
+
63
+ const allowedTypes = ['string', 'number'];
64
+ const allowedFilterVariants = ['text', 'autocomplete'];
65
+ const MRT_TableBodyCellValue = ({ cell, renderedColumnIndex = 0, renderedRowIndex = 0, table, }) => {
66
+ var _a, _b;
67
+ const { getState, options: { enableFilterMatchHighlighting, mantineHighlightProps = { size: 'sm' }, }, } = table;
68
+ const { column, row } = cell;
69
+ const { columnDef } = column;
70
+ const { globalFilter, globalFilterFn } = getState();
71
+ const filterValue = column.getFilterValue();
72
+ const highlightProps = parseFromValuesOrFunc(mantineHighlightProps, {
73
+ cell,
74
+ column,
75
+ row,
76
+ table,
77
+ });
78
+ let renderedCellValue = cell.getIsAggregated() && columnDef.AggregatedCell
79
+ ? columnDef.AggregatedCell({
80
+ cell,
81
+ column,
82
+ row,
83
+ table,
84
+ })
85
+ : row.getIsGrouped() && !cell.getIsGrouped()
86
+ ? null
87
+ : cell.getIsGrouped() && columnDef.GroupedCell
88
+ ? columnDef.GroupedCell({
89
+ cell,
90
+ column,
91
+ row,
92
+ table,
93
+ })
94
+ : undefined;
95
+ const isGroupedValue = renderedCellValue !== undefined;
96
+ if (!isGroupedValue) {
97
+ renderedCellValue = cell.renderValue();
98
+ }
99
+ if (enableFilterMatchHighlighting &&
100
+ columnDef.enableFilterMatchHighlighting !== false &&
101
+ renderedCellValue &&
102
+ allowedTypes.includes(typeof renderedCellValue) &&
103
+ ((filterValue &&
104
+ allowedTypes.includes(typeof filterValue) &&
105
+ allowedFilterVariants.includes(columnDef.filterVariant)) ||
106
+ (globalFilter &&
107
+ allowedTypes.includes(typeof globalFilter) &&
108
+ column.getCanGlobalFilter()))) {
109
+ let highlight = ((_b = (_a = column.getFilterValue()) !== null && _a !== void 0 ? _a : globalFilter) !== null && _b !== void 0 ? _b : '').toString();
110
+ if ((filterValue ? columnDef._filterFn : globalFilterFn) === 'fuzzy') {
111
+ highlight = highlight.split(' ');
112
+ }
113
+ renderedCellValue = (jsx(Highlight, Object.assign({ color: "yellow.3", highlight: highlight }, highlightProps, { children: renderedCellValue === null || renderedCellValue === void 0 ? void 0 : renderedCellValue.toString() })));
114
+ }
115
+ if (columnDef.Cell && !isGroupedValue) {
116
+ renderedCellValue = columnDef.Cell({
117
+ cell,
118
+ column,
119
+ renderedCellValue,
120
+ renderedColumnIndex,
121
+ renderedRowIndex,
122
+ row,
123
+ table,
124
+ });
125
+ }
126
+ return renderedCellValue;
127
+ };
128
+
129
+ /**
130
+ * TanStack Table keeps one table, row, cell, column and header instance for as
131
+ * long as the data and column definitions stay the same. The React Compiler
132
+ * caches a call such as `row.getIsSelected()` on the identity of `row`, so a
133
+ * compiled consumer component would keep the first result forever.
134
+ *
135
+ * A view is a `Proxy` around the TanStack instance. Reads, writes, method
136
+ * calls and object spreads all reach the live instance, and only the identity
137
+ * is new. `useMantineReactTable` returns a new table view whenever table state
138
+ * or options change, and row, cell, column and header views are cached per
139
+ * table view, so they change exactly when the table does.
140
+ */
141
+ const viewsByTable = new WeakMap();
142
+ const targetsByView = new WeakMap();
143
+ /** Returns the TanStack instance behind a view, or the object itself. */
144
+ const getMRT_ViewTarget = (viewOrTarget) => { var _a; return (_a = targetsByView.get(viewOrTarget)) !== null && _a !== void 0 ? _a : viewOrTarget; };
145
+ /**
146
+ * Creates a view of a TanStack instance.
147
+ * @param overrides - properties the view answers itself instead of the instance
148
+ */
149
+ const createMRT_View = (viewOrTarget, overrides) => {
150
+ const target = getMRT_ViewTarget(viewOrTarget);
151
+ const view = new Proxy(target, overrides
152
+ ? {
153
+ get: (instance, key) => key in overrides
154
+ ? overrides[key]
155
+ : instance[key],
156
+ }
157
+ : {});
158
+ targetsByView.set(view, target);
159
+ return view;
160
+ };
161
+ const getView = (table, viewOrTarget, getOverrides) => {
162
+ const target = getMRT_ViewTarget(viewOrTarget);
163
+ let views = viewsByTable.get(table);
164
+ if (!views) {
165
+ views = new WeakMap();
166
+ viewsByTable.set(table, views);
167
+ }
168
+ let view = views.get(target);
169
+ if (!view) {
170
+ view = createMRT_View(target, getOverrides === null || getOverrides === void 0 ? void 0 : getOverrides(target));
171
+ views.set(target, view);
172
+ }
173
+ return view;
174
+ };
175
+ const getMRT_RowView = (table, row) => getView(table, row);
176
+ const getMRT_ColumnView = (table, column) => getView(table, column);
177
+ const getMRT_CellView = (table, cell) => getView(table, cell, (target) => ({
178
+ column: getMRT_ColumnView(table, target.column),
179
+ row: getMRT_RowView(table, target.row),
180
+ }));
181
+ const getMRT_HeaderView = (table, header) => getView(table, header, (target) => ({
182
+ column: getMRT_ColumnView(table, target.column),
183
+ }));
184
+
185
+ const parseCSSVarId = (id) => id.replace(/[^a-zA-Z0-9]/g, '_');
186
+ const getPrimaryShade = (theme) => {
187
+ var _a, _b;
188
+ return typeof theme.primaryShade === 'number'
189
+ ? theme.primaryShade
190
+ : ((_b = (_a = theme.primaryShade) === null || _a === void 0 ? void 0 : _a.dark) !== null && _b !== void 0 ? _b : 7);
191
+ };
192
+ const getPrimaryColor = (theme, shade) => theme.colors[theme.primaryColor][shade !== null && shade !== void 0 ? shade : getPrimaryShade(theme)];
193
+ function dataVariable(name, value) {
194
+ const key = `data-${name}`;
195
+ switch (typeof value) {
196
+ case 'boolean':
197
+ return value ? { [key]: '' } : null;
198
+ case 'number':
199
+ return { [key]: `${value}` };
200
+ case 'string':
201
+ return { [key]: value };
202
+ default:
203
+ return null;
204
+ }
205
+ }
206
+
207
+ var classes$z = {"root":"MRT_CopyButton-module_root__mkXy4"};
208
+
209
+ const MRT_CopyButton = (_a) => {
210
+ var { cell, children, table } = _a, rest = __rest(_a, ["cell", "children", "table"]);
211
+ const { options: { localization: { clickToCopy, copiedToClipboard }, mantineCopyButtonProps, }, } = table;
212
+ const { column, row } = cell;
213
+ const { columnDef } = column;
214
+ const arg = { cell, column, row, table };
215
+ const buttonProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineCopyButtonProps, arg)), parseFromValuesOrFunc(columnDef.mantineCopyButtonProps, arg)), rest);
216
+ return (jsx(CopyButton, { value: cell.getValue(), children: ({ copied, copy }) => {
217
+ var _a;
218
+ return (jsx(Tooltip, { color: copied ? 'green' : undefined, label: (_a = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.title) !== null && _a !== void 0 ? _a : (copied ? copiedToClipboard : clickToCopy), openDelay: 1000, withinPortal: true, children: jsx(UnstyledButton, Object.assign({}, buttonProps, { className: clsx('mrt-copy-button', classes$z.root, buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.className), onClick: (e) => {
219
+ e.stopPropagation();
220
+ copy();
221
+ }, role: "presentation", title: undefined, children: children })) }));
222
+ } }));
223
+ };
224
+
225
+ const MRT_EditCellTextInput = (_a) => {
226
+ var _b;
227
+ var { cell, table } = _a, rest = __rest(_a, ["cell", "table"]);
228
+ const { getState, options: { createDisplayMode, editDisplayMode, mantineEditSelectProps, mantineEditTextInputProps, }, refs: { editInputRefs }, setCreatingRow, setEditingCell, setEditingRow, } = table;
229
+ const { column, row } = cell;
230
+ const { columnDef } = column;
231
+ const { creatingRow, editingRow } = getState();
232
+ const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
233
+ const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
234
+ const isSelectEdit = columnDef.editVariant === 'select';
235
+ const isMultiSelectEdit = columnDef.editVariant === 'multi-select';
236
+ const [value, setValue] = useState(() => cell.getValue());
237
+ const arg = { cell, column, row, table };
238
+ const textInputProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineEditTextInputProps, arg)), parseFromValuesOrFunc(columnDef.mantineEditTextInputProps, arg)), rest);
239
+ const selectProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineEditSelectProps, arg)), parseFromValuesOrFunc(columnDef.mantineEditSelectProps, arg)), rest);
240
+ const saveInputValueToRowCache = (newValue) => {
241
+ //@ts-ignore
242
+ row._valuesCache[column.id] = newValue;
243
+ if (isCreating) {
244
+ setCreatingRow(row);
245
+ }
246
+ else if (isEditing) {
247
+ setEditingRow(row);
248
+ }
249
+ };
250
+ const handleBlur = (event) => {
251
+ var _a;
252
+ (_a = textInputProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(textInputProps, event);
253
+ saveInputValueToRowCache(value);
254
+ setEditingCell(null);
255
+ };
256
+ const handleEnterKeyDown = (event) => {
257
+ var _a, _b;
258
+ (_a = textInputProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(textInputProps, event);
259
+ //Enter also confirms an IME composition (Chinese, Japanese, Korean input)
260
+ if (event.key === 'Enter' && !event.nativeEvent.isComposing) {
261
+ (_b = editInputRefs.current[cell.id]) === null || _b === void 0 ? void 0 : _b.blur();
262
+ }
263
+ };
264
+ if (columnDef.Edit) {
265
+ return (_b = columnDef.Edit) === null || _b === void 0 ? void 0 : _b.call(columnDef, { cell, column, row, table });
266
+ }
267
+ const commonProps = {
268
+ disabled: parseFromValuesOrFunc(columnDef.enableEditing, row) === false,
269
+ label: ['custom', 'modal'].includes((isCreating ? createDisplayMode : editDisplayMode))
270
+ ? column.columnDef.header
271
+ : undefined,
272
+ name: cell.id,
273
+ onClick: (e) => {
274
+ var _a;
275
+ e.stopPropagation();
276
+ (_a = textInputProps === null || textInputProps === void 0 ? void 0 : textInputProps.onClick) === null || _a === void 0 ? void 0 : _a.call(textInputProps, e);
277
+ },
278
+ placeholder: !['custom', 'modal'].includes((isCreating ? createDisplayMode : editDisplayMode))
279
+ ? columnDef.header
280
+ : undefined,
281
+ value,
282
+ variant: editDisplayMode === 'table' ? 'unstyled' : 'default',
283
+ };
284
+ if (isSelectEdit) {
285
+ return (jsx(Select, Object.assign({}, commonProps, { searchable: true, value: value }, selectProps, { onBlur: handleBlur, onChange: (value, option) => {
286
+ var _a, _b;
287
+ (_b = (_a = selectProps).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, value, option);
288
+ setValue(value);
289
+ }, onClick: (e) => {
290
+ var _a;
291
+ e.stopPropagation();
292
+ (_a = selectProps === null || selectProps === void 0 ? void 0 : selectProps.onClick) === null || _a === void 0 ? void 0 : _a.call(selectProps, e);
293
+ }, ref: (node) => {
294
+ if (node) {
295
+ editInputRefs.current[cell.id] = node;
296
+ assignRef(selectProps.ref, node);
297
+ }
298
+ } })));
299
+ }
300
+ if (isMultiSelectEdit) {
301
+ return (jsx(MultiSelect, Object.assign({}, commonProps, { searchable: true, value: value }, selectProps, { onBlur: handleBlur, onChange: (newValue) => {
302
+ var _a, _b;
303
+ (_b = (_a = selectProps).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, newValue);
304
+ setValue(newValue);
305
+ // Save if not in focus, otherwise it will be handled by onBlur
306
+ if (document.activeElement === editInputRefs.current[cell.id])
307
+ return;
308
+ saveInputValueToRowCache(newValue);
309
+ }, onClick: (e) => {
310
+ var _a;
311
+ e.stopPropagation();
312
+ (_a = selectProps === null || selectProps === void 0 ? void 0 : selectProps.onClick) === null || _a === void 0 ? void 0 : _a.call(selectProps, e);
313
+ }, ref: (node) => {
314
+ if (node) {
315
+ editInputRefs.current[cell.id] = node;
316
+ assignRef(selectProps.ref, node);
317
+ }
318
+ } })));
319
+ }
320
+ return (jsx(TextInput, Object.assign({}, commonProps, { onKeyDown: handleEnterKeyDown, value: value !== null && value !== void 0 ? value : '' }, textInputProps, { onBlur: handleBlur, onChange: (event) => {
321
+ var _a;
322
+ (_a = textInputProps.onChange) === null || _a === void 0 ? void 0 : _a.call(textInputProps, event);
323
+ setValue(event.target.value);
324
+ }, onClick: (event) => {
325
+ var _a;
326
+ event.stopPropagation();
327
+ (_a = textInputProps === null || textInputProps === void 0 ? void 0 : textInputProps.onClick) === null || _a === void 0 ? void 0 : _a.call(textInputProps, event);
328
+ }, ref: (node) => {
329
+ if (node) {
330
+ editInputRefs.current[cell.id] = node;
331
+ assignRef(textInputProps.ref, node);
332
+ }
333
+ } })));
334
+ };
335
+
336
+ const MRT_TableBodyCell = (_a) => {
337
+ var _b, _c, _d, _e, _f;
338
+ var { cell: cellProp, numRows = 1, renderedColumnIndex = 0, renderedRowIndex = 0, rowRef, table, virtualCell } = _a, rest = __rest(_a, ["cell", "numRows", "renderedColumnIndex", "renderedRowIndex", "rowRef", "table", "virtualCell"]);
339
+ //a view has a new identity per table reference, which compiled render callbacks need
340
+ const cell = getMRT_CellView(table, cellProp);
341
+ const direction = useDirection();
342
+ const { getState, options: { columnResizeDirection, columnResizeMode, createDisplayMode, editDisplayMode, enableClickToCopy, enableColumnOrdering, enableColumnPinning, enableEditing, enableGrouping, layoutMode, mantineSkeletonProps, mantineTableBodyCellProps, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
343
+ const { columnSizingInfo, creatingRow, density, draggingColumn, editingCell, editingRow, hoveredColumn, isLoading, showSkeletons, } = getState();
344
+ const { column, row } = cell;
345
+ const { columnDef } = column;
346
+ const { columnDefType } = columnDef;
347
+ const args = {
348
+ cell,
349
+ column,
350
+ renderedColumnIndex,
351
+ renderedRowIndex,
352
+ row,
353
+ table,
354
+ };
355
+ const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineTableBodyCellProps, args)), parseFromValuesOrFunc(columnDef.mantineTableBodyCellProps, args)), rest);
356
+ const skeletonProps = parseFromValuesOrFunc(mantineSkeletonProps, args);
357
+ const [skeletonWidth, setSkeletonWidth] = useState(100);
358
+ useEffect(() => {
359
+ if ((!isLoading && !showSkeletons) || skeletonWidth !== 100)
360
+ return;
361
+ const size = column.getSize();
362
+ setSkeletonWidth(columnDefType === 'display'
363
+ ? size / 2
364
+ : Math.round(Math.random() * (size - size / 3) + size / 3));
365
+ }, [isLoading, showSkeletons]);
366
+ const widthStyles = {
367
+ minWidth: `max(calc(var(--col-${parseCSSVarId(column === null || column === void 0 ? void 0 : column.id)}-size) * 1px), ${(_b = columnDef.minSize) !== null && _b !== void 0 ? _b : 30}px)`,
368
+ width: `calc(var(--col-${parseCSSVarId(column.id)}-size) * 1px)`,
369
+ };
370
+ if (layoutMode === 'grid') {
371
+ widthStyles.flex = `${[0, false].includes(columnDef.grow)
372
+ ? 0
373
+ : `var(--col-${parseCSSVarId(column.id)}-size)`} 0 auto`;
374
+ }
375
+ else if (layoutMode === 'grid-no-grow') {
376
+ widthStyles.flex = `${+(columnDef.grow || 0)} 0 auto`;
377
+ }
378
+ const isDraggingColumn = (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id;
379
+ const isHoveredColumn = (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id;
380
+ const isColumnPinned = enableColumnPinning &&
381
+ columnDef.columnDefType !== 'group' &&
382
+ column.getIsPinned();
383
+ const isEditable = !cell.getIsPlaceholder() &&
384
+ parseFromValuesOrFunc(enableEditing, row) &&
385
+ parseFromValuesOrFunc(columnDef.enableEditing, row) !== false;
386
+ const isEditing = isEditable &&
387
+ !['custom', 'modal'].includes(editDisplayMode) &&
388
+ (editDisplayMode === 'table' ||
389
+ (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id ||
390
+ (editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) === cell.id) &&
391
+ !row.getIsGrouped();
392
+ const isCreating = isEditable && createDisplayMode === 'row' && (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
393
+ const showClickToCopyButton = parseFromValuesOrFunc(enableClickToCopy, cell) ||
394
+ (parseFromValuesOrFunc(columnDef.enableClickToCopy, cell) &&
395
+ parseFromValuesOrFunc(columnDef.enableClickToCopy, cell) !== false);
396
+ const handleDoubleClick = (event) => {
397
+ var _a;
398
+ (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDoubleClick) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
399
+ if (isEditable && editDisplayMode === 'cell') {
400
+ setEditingCell(cell);
401
+ setTimeout(() => {
402
+ var _a;
403
+ const textField = editInputRefs.current[cell.id];
404
+ if (textField) {
405
+ textField.focus();
406
+ (_a = textField.select) === null || _a === void 0 ? void 0 : _a.call(textField);
407
+ }
408
+ }, 100);
409
+ }
410
+ };
411
+ const handleDragEnter = (e) => {
412
+ var _a;
413
+ (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDragEnter) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, e);
414
+ if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
415
+ setHoveredColumn(null);
416
+ }
417
+ if (enableColumnOrdering && draggingColumn) {
418
+ setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
419
+ }
420
+ };
421
+ const cellValueProps = {
422
+ cell,
423
+ renderedColumnIndex,
424
+ renderedRowIndex,
425
+ table,
426
+ };
427
+ const cellHoverRevealDivRef = useRef(null);
428
+ const [isCellContentOverflowing, setIsCellContentOverflowing] = useState(false);
429
+ const onMouseEnter = () => {
430
+ if (!columnDef.enableCellHoverReveal)
431
+ return;
432
+ const div = cellHoverRevealDivRef.current;
433
+ if (div) {
434
+ const isOverflow = div.scrollWidth > div.clientWidth;
435
+ setIsCellContentOverflowing(isOverflow);
436
+ }
437
+ };
438
+ const onMouseLeave = () => {
439
+ if (!columnDef.enableCellHoverReveal)
440
+ return;
441
+ setIsCellContentOverflowing(false);
442
+ };
443
+ const renderCellContent = () => {
444
+ var _a, _b, _c;
445
+ if (cell.getIsPlaceholder()) {
446
+ return (_b = (_a = columnDef.PlaceholderCell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table })) !== null && _b !== void 0 ? _b : null;
447
+ }
448
+ if (showSkeletons !== false && (isLoading || showSkeletons)) {
449
+ return jsx(Skeleton, Object.assign({ height: 20, width: skeletonWidth }, skeletonProps));
450
+ }
451
+ if (columnDefType === 'display' &&
452
+ (['mrt-row-expand', 'mrt-row-numbers', 'mrt-row-select'].includes(column.id) ||
453
+ !row.getIsGrouped())) {
454
+ return (_c = columnDef.Cell) === null || _c === void 0 ? void 0 : _c.call(columnDef, Object.assign({ column, renderedCellValue: cell.renderValue(), row,
455
+ rowRef }, cellValueProps));
456
+ }
457
+ if (isCreating || isEditing) {
458
+ return jsx(MRT_EditCellTextInput, { cell: cell, table: table });
459
+ }
460
+ if (showClickToCopyButton && columnDef.enableClickToCopy !== false) {
461
+ return (jsx(MRT_CopyButton, { cell: cell, table: table, children: jsx(MRT_TableBodyCellValue, Object.assign({}, cellValueProps)) }));
462
+ }
463
+ return jsx(MRT_TableBodyCellValue, Object.assign({}, cellValueProps));
464
+ };
465
+ return (jsx(TableTd, Object.assign({ "data-column-pinned": isColumnPinned || undefined, "data-dragging-column": isDraggingColumn || undefined, "data-first-right-pinned": (isColumnPinned === 'right' &&
466
+ column.getIsFirstColumn(isColumnPinned)) ||
467
+ undefined, "data-hovered-column-target": isHoveredColumn || undefined, "data-index": renderedColumnIndex, "data-last-left-pinned": (isColumnPinned === 'left' && column.getIsLastColumn(isColumnPinned)) ||
468
+ undefined, "data-last-row": renderedRowIndex === numRows - 1 || undefined, "data-resizing": (columnResizeMode === 'onChange' &&
469
+ (columnSizingInfo === null || columnSizingInfo === void 0 ? void 0 : columnSizingInfo.isResizingColumn) === column.id &&
470
+ columnResizeDirection) ||
471
+ undefined }, tableCellProps, { __vars: Object.assign({ '--mrt-cell-align': (_c = tableCellProps.align) !== null && _c !== void 0 ? _c : (direction.dir === 'rtl' ? 'right' : 'left'), '--mrt-table-cell-left': isColumnPinned === 'left'
472
+ ? `${column.getStart(isColumnPinned)}`
473
+ : undefined, '--mrt-table-cell-right': isColumnPinned === 'right'
474
+ ? `${column.getAfter(isColumnPinned)}`
475
+ : undefined }, tableCellProps.__vars), className: clsx(classes$A.root, (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) && classes$A['root-grid'], virtualCell && classes$A['root-virtualized'], isEditable &&
476
+ editDisplayMode === 'cell' &&
477
+ classes$A['root-cursor-pointer'], isEditable &&
478
+ ['cell', 'table'].includes(editDisplayMode !== null && editDisplayMode !== void 0 ? editDisplayMode : '') &&
479
+ columnDefType !== 'display' &&
480
+ classes$A['root-editable-hover'], columnDefType === 'data' && classes$A['root-data-col'], density === 'xs' && classes$A['root-nowrap'], columnDef.enableCellHoverReveal && classes$A['root-cell-hover-reveal'], tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.className), onDoubleClick: handleDoubleClick, onDragEnter: handleDragEnter, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, style: (theme) => (Object.assign(Object.assign({}, widthStyles), parseFromValuesOrFunc(tableCellProps.style, theme))), children: jsx(Fragment, { children: (_d = tableCellProps.children) !== null && _d !== void 0 ? _d : (columnDef.enableCellHoverReveal ? (jsxs("div", { className: clsx(columnDef.enableCellHoverReveal &&
481
+ !(isCreating || isEditing) &&
482
+ classes$A['cell-hover-reveal'], isCellContentOverflowing && classes$A['overflowing']), ref: cellHoverRevealDivRef, children: [renderCellContent(), cell.getIsGrouped() && !columnDef.GroupedCell && (jsxs(Fragment, { children: [" (", (_e = row.subRows) === null || _e === void 0 ? void 0 : _e.length, ")"] }))] })) : (jsxs(Fragment, { children: [renderCellContent(), cell.getIsGrouped() && !columnDef.GroupedCell && (jsxs(Fragment, { children: [" (", (_f = row.subRows) === null || _f === void 0 ? void 0 : _f.length, ")"] }))] }))) }) })));
483
+ };
484
+ const Memo_MRT_TableBodyCell = memo(MRT_TableBodyCell, (prev, next) => next.cell === prev.cell);
485
+
486
+ var classes$y = {"root":"MRT_TableDetailPanel-module_root__vQAlM","root-grid":"MRT_TableDetailPanel-module_root-grid__7UMC6","root-virtual-row":"MRT_TableDetailPanel-module_root-virtual-row__r-X4Z","inner":"MRT_TableDetailPanel-module_inner__o-Fk-","inner-grid":"MRT_TableDetailPanel-module_inner-grid__WLZgF","inner-expanded":"MRT_TableDetailPanel-module_inner-expanded__6tg9T","inner-virtual":"MRT_TableDetailPanel-module_inner-virtual__TItRy"};
487
+
488
+ const MRT_TableDetailPanel = (_a) => {
489
+ var _b, _c;
490
+ var { parentRowRef, renderedRowIndex = 0, row, rowVirtualizer, striped, table, virtualRow } = _a, rest = __rest(_a, ["parentRowRef", "renderedRowIndex", "row", "rowVirtualizer", "striped", "table", "virtualRow"]);
491
+ const { getState, getVisibleLeafColumns, options: { layoutMode, mantineDetailPanelProps, mantineTableBodyRowProps, renderDetailPanel, }, } = table;
492
+ const { isLoading } = getState();
493
+ const tableRowProps = parseFromValuesOrFunc(mantineTableBodyRowProps, {
494
+ isDetailPanel: true,
495
+ row,
496
+ table,
497
+ });
498
+ const tableCellProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineDetailPanelProps, {
499
+ row,
500
+ table,
501
+ })), rest);
502
+ const internalEditComponents = row
503
+ .getAllCells()
504
+ .filter((cell) => cell.column.columnDef.columnDefType === 'data')
505
+ .map((cell) => (jsx(MRT_EditCellTextInput, { cell: cell, table: table }, cell.id)));
506
+ const DetailPanel = !isLoading &&
507
+ row.getIsExpanded() &&
508
+ (renderDetailPanel === null || renderDetailPanel === void 0 ? void 0 : renderDetailPanel({ internalEditComponents, row, table }));
509
+ return (jsx(TableTr, Object.assign({ "data-index": renderDetailPanel ? renderedRowIndex * 2 + 1 : renderedRowIndex, "data-striped": striped, ref: (node) => {
510
+ var _a;
511
+ if (node) {
512
+ (_a = rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement) === null || _a === void 0 ? void 0 : _a.call(rowVirtualizer, node);
513
+ }
514
+ } }, tableRowProps, { __vars: Object.assign({ '--mrt-parent-row-height': virtualRow
515
+ ? `${(_c = (_b = parentRowRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect()) === null || _c === void 0 ? void 0 : _c.height}px`
516
+ : undefined, '--mrt-virtual-row-start': virtualRow
517
+ ? `${virtualRow.start}px`
518
+ : undefined }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.__vars), className: clsx('mantine-Table-tr-detail-panel', classes$y.root, (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) && classes$y['root-grid'], virtualRow && classes$y['root-virtual-row'], tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.className), children: jsx(TableTd, Object.assign({ colSpan: getVisibleLeafColumns().length, component: "td" }, tableCellProps, { __vars: {
519
+ '--mrt-inner-width': `${table.getTotalSize()}px`,
520
+ }, className: clsx('mantine-Table-td-detail-panel', classes$y.inner, (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) && classes$y['inner-grid'], row.getIsExpanded() && classes$y['inner-expanded'], virtualRow && classes$y['inner-virtual']), p: row.getIsExpanded() && DetailPanel ? 'md' : 0, children: rowVirtualizer ? (row.getIsExpanded() && DetailPanel) : (jsx(Collapse, { expanded: row.getIsExpanded(), children: DetailPanel })) })) })));
521
+ };
522
+
523
+ //`state` and `initialState` are compared through `table.getState()` instead
524
+ const ignoredOptionKeys = new Set(['initialState', 'state']);
525
+ const isPlain = (value) => {
526
+ if (typeof value !== 'object' || value === null)
527
+ return false;
528
+ const prototype = Object.getPrototypeOf(value);
529
+ return (prototype === Object.prototype || prototype === null || Array.isArray(value));
530
+ };
531
+ /**
532
+ * Compares plain objects and arrays by content, `depth` levels deep, and
533
+ * everything else by identity. `table.setSorting([{ desc: false, id: 'name' }])`
534
+ * with the sorting that is already set makes a new array with the same content,
535
+ * and that must not count as a change.
536
+ */
537
+ const isEqual = (a, b, depth) => {
538
+ if (Object.is(a, b))
539
+ return true;
540
+ if (!depth ||
541
+ !isPlain(a) ||
542
+ !isPlain(b) ||
543
+ Array.isArray(a) !== Array.isArray(b)) {
544
+ return false;
545
+ }
546
+ const keys = Object.keys(a);
547
+ return (keys.length === Object.keys(b).length &&
548
+ keys.every((key) => key in b && isEqual(a[key], b[key], depth - 1)));
549
+ };
550
+ /**
551
+ * Option objects such as `mantineTableProps={{ striped: true }}` compare by
552
+ * content. Arrays (`data`, `columns`) and functions compare by identity,
553
+ * because TanStack rebuilds rows and columns when their identity changes.
554
+ */
555
+ const optionsEqual = (a, b) => {
556
+ if (a === b)
557
+ return true;
558
+ const keys = Object.keys(a);
559
+ return (keys.length === Object.keys(b).length &&
560
+ keys.every((key) => key in b &&
561
+ (ignoredOptionKeys.has(key) ||
562
+ isEqual(a[key], b[key], Array.isArray(a[key]) ? 0 : 1))));
563
+ };
564
+ const stateVersions = new WeakMap();
565
+ /**
566
+ * A number that changes when table state changes, and not when only table
567
+ * options change. `memoMode: 'rows'` compares it, so a consumer that passes
568
+ * inline options still gets memoized rows.
569
+ */
570
+ const getMRT_TableStateVersion = (table) => stateVersions.get(table);
571
+ /**
572
+ * TanStack Table mutates one table instance for the lifetime of the hook. The
573
+ * React Compiler memoizes on reference identity, so compiled consumer code
574
+ * (`<MantineReactTable table={table} />`, `table.getState()` and so on) never
575
+ * sees a change on that instance.
576
+ *
577
+ * This hook returns a new reference whenever table state, table options or the
578
+ * internal render version change, and the same reference otherwise. State and
579
+ * option objects are compared by content, so a setter called with the current
580
+ * value keeps the reference. A function option is compared by identity: pass a
581
+ * stable function (`useCallback` or the React Compiler) to keep the reference
582
+ * across renders of the component that calls the hook. Each
583
+ * reference is a view (see `snapshot.utils.ts`) of the one underlying instance,
584
+ * so every reference reads current data and an old reference is never stale.
585
+ */
586
+ const useMRT_TableSnapshot = (table, tableOptions, version) => {
587
+ var _a;
588
+ const snapshotRef = useRef(null);
589
+ const options = tableOptions;
590
+ const state = table.getState();
591
+ const previous = snapshotRef.current;
592
+ const stateChanged = !previous ||
593
+ previous.version !== version ||
594
+ !isEqual(previous.state, state, 3);
595
+ if (stateChanged || !optionsEqual(previous.options, options)) {
596
+ const snapshot = createMRT_View(table, {
597
+ //a new function identity keeps `const { getState } = table` reactive too
598
+ getState: () => table.getState(),
599
+ });
600
+ const stateVersion = ((_a = previous === null || previous === void 0 ? void 0 : previous.stateVersion) !== null && _a !== void 0 ? _a : 0) + (stateChanged ? 1 : 0);
601
+ stateVersions.set(snapshot, stateVersion);
602
+ snapshotRef.current = {
603
+ options,
604
+ state,
605
+ stateVersion,
606
+ table: snapshot,
607
+ version,
608
+ };
609
+ }
610
+ return snapshotRef.current.table;
611
+ };
612
+
613
+ const fuzzy$1 = (rowA, rowB, columnId) => {
614
+ let dir = 0;
615
+ if (rowA.columnFiltersMeta[columnId]) {
616
+ dir = compareItems(rowA.columnFiltersMeta[columnId], rowB.columnFiltersMeta[columnId]);
617
+ }
618
+ // Provide a fallback for when the item ranks are equal
619
+ return dir === 0
620
+ ? sortingFns.alphanumeric(rowA, rowB, columnId)
621
+ : dir;
622
+ };
623
+ const MRT_SortingFns = Object.assign(Object.assign({}, sortingFns), { fuzzy: fuzzy$1 });
624
+ const rankGlobalFuzzy = (rowA, rowB) => Math.max(...Object.values(rowB.columnFiltersMeta).map((v) => v.rank)) -
625
+ Math.max(...Object.values(rowA.columnFiltersMeta).map((v) => v.rank));
626
+
627
+ const getMRT_Rows = (table, all) => {
628
+ const { getCenterRows, getPrePaginationRowModel, getRowModel, getState, getTopRows, options: { createDisplayMode, enablePagination, enableRowPinning, manualPagination, positionCreatingRow, rowPinningDisplayMode, }, } = table;
629
+ const { creatingRow, pagination } = getState();
630
+ const isRankingRows = getIsRankingRows(table);
631
+ let rows = [];
632
+ if (!isRankingRows) {
633
+ rows =
634
+ !enableRowPinning || (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky'))
635
+ ? all
636
+ ? getPrePaginationRowModel().rows
637
+ : getRowModel().rows
638
+ : getCenterRows();
639
+ }
640
+ else {
641
+ // fuzzy ranking adjustments
642
+ rows = getPrePaginationRowModel().rows.sort((a, b) => rankGlobalFuzzy(a, b));
643
+ if (enablePagination && !manualPagination && !all) {
644
+ const start = pagination.pageIndex * pagination.pageSize;
645
+ rows = rows.slice(start, start + pagination.pageSize);
646
+ }
647
+ if (enableRowPinning && !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky'))) {
648
+ // "re-center-ize" the rows (no top or bottom pinned rows unless sticky)
649
+ rows = rows.filter((row) => !row.getIsPinned());
650
+ }
651
+ }
652
+ // row pinning adjustments
653
+ if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky'))) {
654
+ const centerPinnedRowIds = rows
655
+ .filter((row) => row.getIsPinned())
656
+ .map((r) => r.id);
657
+ rows = [
658
+ ...getTopRows().filter((row) => !centerPinnedRowIds.includes(row.id)),
659
+ ...rows,
660
+ ];
661
+ }
662
+ // blank inserted creating row adjustments
663
+ if (positionCreatingRow !== undefined &&
664
+ creatingRow &&
665
+ createDisplayMode === 'row') {
666
+ const creatingRowIndex = !isNaN(+positionCreatingRow)
667
+ ? +positionCreatingRow
668
+ : positionCreatingRow === 'top'
669
+ ? 0
670
+ : rows.length;
671
+ rows = [
672
+ ...rows.slice(0, creatingRowIndex),
673
+ creatingRow,
674
+ ...rows.slice(creatingRowIndex),
675
+ ];
676
+ }
677
+ return rows;
678
+ };
679
+ const getCanRankRows = (table) => {
680
+ const { getState, options: { enableGlobalFilterRankedResults, manualExpanding, manualFiltering, manualGrouping, manualSorting, }, } = table;
681
+ const { expanded, globalFilterFn } = getState();
682
+ return (!manualExpanding &&
683
+ !manualFiltering &&
684
+ !manualGrouping &&
685
+ !manualSorting &&
686
+ enableGlobalFilterRankedResults &&
687
+ globalFilterFn === 'fuzzy' &&
688
+ expanded !== true &&
689
+ !Object.values(expanded).some(Boolean));
690
+ };
691
+ const getIsRankingRows = (table) => {
692
+ const { globalFilter, sorting } = table.getState();
693
+ return (getCanRankRows(table) &&
694
+ globalFilter &&
695
+ !Object.values(sorting).some(Boolean));
696
+ };
697
+ const getIsRowSelected = ({ row, table, }) => {
698
+ const { options: { enableRowSelection }, } = table;
699
+ return (row.getIsSelected() ||
700
+ (parseFromValuesOrFunc(enableRowSelection, row) &&
701
+ row.getCanSelectSubRows() &&
702
+ row.getIsAllSubRowsSelected()));
703
+ };
704
+ const getMRT_RowSelectionHandler = ({ renderedRowIndex = 0, row, table, }) => (event, value) => {
705
+ var _a;
706
+ const { getState, options: { enableBatchRowSelection, enableMultiRowSelection, enableRowPinning, manualPagination, rowPinningDisplayMode, }, refs: { lastSelectedRowId: lastSelectedRowId }, } = table;
707
+ const { pagination: { pageIndex, pageSize }, } = getState();
708
+ const paginationOffset = manualPagination ? 0 : pageSize * pageIndex;
709
+ const wasCurrentRowChecked = getIsRowSelected({ row, table });
710
+ // toggle selection of this row
711
+ row.toggleSelected(value !== null && value !== void 0 ? value : !wasCurrentRowChecked);
712
+ const changedRowIds = new Set([row.id]);
713
+ // if shift key is pressed, select all rows between last selected and this one
714
+ if (enableBatchRowSelection &&
715
+ enableMultiRowSelection &&
716
+ event.nativeEvent.shiftKey &&
717
+ lastSelectedRowId.current !== null) {
718
+ const rows = getMRT_Rows(table, true);
719
+ const lastIndex = rows.findIndex((r) => r.id === lastSelectedRowId.current);
720
+ if (lastIndex !== -1) {
721
+ const isLastIndexChecked = getIsRowSelected({
722
+ row: rows === null || rows === void 0 ? void 0 : rows[lastIndex],
723
+ table,
724
+ });
725
+ const currentIndex = renderedRowIndex + paginationOffset;
726
+ const [start, end] = lastIndex < currentIndex
727
+ ? [lastIndex, currentIndex]
728
+ : [currentIndex, lastIndex];
729
+ // toggle selection of all rows between last selected and this one
730
+ // but only if the last selected row is not the same as the current one
731
+ if (wasCurrentRowChecked !== isLastIndexChecked) {
732
+ for (let i = start; i <= end; i++) {
733
+ rows[i].toggleSelected(!wasCurrentRowChecked);
734
+ changedRowIds.add(rows[i].id);
735
+ }
736
+ }
737
+ }
738
+ }
739
+ // record the last selected row id
740
+ lastSelectedRowId.current = row.id;
741
+ // if all sub rows were selected, unselect them
742
+ if (row.getCanSelectSubRows() && row.getIsAllSubRowsSelected()) {
743
+ (_a = row.subRows) === null || _a === void 0 ? void 0 : _a.forEach((r) => r.toggleSelected(false));
744
+ }
745
+ if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('select'))) {
746
+ changedRowIds.forEach((rowId) => {
747
+ const rowToTogglePin = table.getRow(rowId);
748
+ rowToTogglePin.pin(!wasCurrentRowChecked //was not previously pinned or selected
749
+ ? (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('bottom'))
750
+ ? 'bottom'
751
+ : 'top'
752
+ : false);
753
+ });
754
+ }
755
+ };
756
+ const getMRT_SelectAllHandler = ({ table }) => (event, value, forceAll) => {
757
+ const { options: { enableRowPinning, rowPinningDisplayMode, selectAllMode }, refs: { lastSelectedRowId }, } = table;
758
+ if (selectAllMode === 'all' || forceAll) {
759
+ table.toggleAllRowsSelected(value !== null && value !== void 0 ? value : event.target.checked);
760
+ }
761
+ else {
762
+ table.toggleAllPageRowsSelected(value !== null && value !== void 0 ? value : event.target.checked);
763
+ }
764
+ if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('select'))) {
765
+ table.setRowPinning({ bottom: [], top: [] });
766
+ }
767
+ lastSelectedRowId.current = null;
768
+ };
769
+
770
+ const MRT_TableBodyRow = (_a) => {
771
+ var _b, _c, _d, _f;
772
+ var { children, columnVirtualizer, numRows, pinnedRowIds, renderedRowIndex = 0, row: rowProp, rowVirtualizer, table, tableProps, virtualRow } = _a, rest = __rest(_a, ["children", "columnVirtualizer", "numRows", "pinnedRowIds", "renderedRowIndex", "row", "rowVirtualizer", "table", "tableProps", "virtualRow"]);
773
+ //a view has a new identity per table reference, which compiled render callbacks need
774
+ const row = getMRT_RowView(table, rowProp);
775
+ const { getState, options: { enableRowOrdering, enableRowPinning, enableStickyFooter, enableStickyHeader, layoutMode, mantineTableBodyRowProps, memoMode, renderDetailPanel, rowPinningDisplayMode, }, refs: { tableFooterRef, tableHeadRef }, setHoveredRow, } = table;
776
+ const { density, draggingColumn, draggingRow, editingCell, editingRow, hoveredRow, isFullScreen, rowPinning, } = getState();
777
+ const visibleCells = row.getVisibleCells();
778
+ const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } = columnVirtualizer !== null && columnVirtualizer !== void 0 ? columnVirtualizer : {};
779
+ //the placeholder row for an empty table has no data to show in a detail panel
780
+ const isEmptyRow = row.id === 'mrt-row-empty';
781
+ const isRowSelected = getIsRowSelected({ row, table });
782
+ const isRowPinned = enableRowPinning && row.getIsPinned();
783
+ const isRowStickyPinned = isRowPinned && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) && 'sticky';
784
+ const isDraggingRow = (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id;
785
+ const isHoveredRow = (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id;
786
+ const tableRowProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineTableBodyRowProps, {
787
+ renderedRowIndex,
788
+ row,
789
+ table,
790
+ })), rest);
791
+ const [bottomPinnedIndex, topPinnedIndex] = useMemo(() => {
792
+ if (!enableRowPinning ||
793
+ !isRowStickyPinned ||
794
+ !pinnedRowIds ||
795
+ !row.getIsPinned())
796
+ return [];
797
+ return [
798
+ [...pinnedRowIds].reverse().indexOf(row.id),
799
+ pinnedRowIds.indexOf(row.id),
800
+ ];
801
+ }, [pinnedRowIds, rowPinning]);
802
+ const tableHeadHeight = ((enableStickyHeader || isFullScreen) &&
803
+ ((_b = tableHeadRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight)) ||
804
+ 0;
805
+ const tableFooterHeight = (enableStickyFooter && ((_c = tableFooterRef.current) === null || _c === void 0 ? void 0 : _c.clientHeight)) || 0;
806
+ const defaultRowHeightByDensity = {
807
+ lg: 61,
808
+ md: 53,
809
+ sm: 45,
810
+ xl: 69,
811
+ xs: 37,
812
+ };
813
+ const rowHeight =
814
+ // @ts-ignore
815
+ parseInt((_d = tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style) === null || _d === void 0 ? void 0 : _d.height, 10) ||
816
+ ((_f = defaultRowHeightByDensity[density]) !== null && _f !== void 0 ? _f : defaultRowHeightByDensity['md']);
817
+ const handleDragEnter = (_e) => {
818
+ if (enableRowOrdering && draggingRow) {
819
+ setHoveredRow(row);
820
+ }
821
+ };
822
+ const rowRef = useRef(null);
823
+ let striped = tableProps.striped;
824
+ if (striped) {
825
+ if (striped === true) {
826
+ striped = 'odd';
827
+ }
828
+ if (striped === 'odd' && renderedRowIndex % 2 !== 0) {
829
+ striped = false;
830
+ }
831
+ if (striped === 'even' && renderedRowIndex % 2 === 0) {
832
+ striped = false;
833
+ }
834
+ }
835
+ return (jsxs(Fragment, { children: [jsxs(TableTr, Object.assign({ "data-dragging-row": isDraggingRow || undefined, "data-hovered-row-target": isHoveredRow || undefined, "data-index": renderDetailPanel ? renderedRowIndex * 2 : renderedRowIndex, "data-row-pinned": isRowStickyPinned || isRowPinned || undefined, "data-selected": isRowSelected || undefined, "data-striped": striped, onDragEnter: handleDragEnter, ref: (node) => {
836
+ if (node) {
837
+ rowRef.current = node;
838
+ //also registers the row with the virtualizer's ResizeObserver
839
+ rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement(node);
840
+ }
841
+ } }, tableRowProps, { __vars: Object.assign(Object.assign({}, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.__vars), { '--mrt-pinned-row-bottom': !virtualRow && bottomPinnedIndex !== undefined && isRowPinned
842
+ ? `${bottomPinnedIndex * rowHeight +
843
+ (enableStickyFooter ? tableFooterHeight - 1 : 0)}`
844
+ : undefined, '--mrt-pinned-row-top': virtualRow
845
+ ? undefined
846
+ : topPinnedIndex !== undefined && isRowPinned
847
+ ? `${topPinnedIndex * rowHeight +
848
+ (enableStickyHeader || isFullScreen ? tableHeadHeight - 1 : 0)}`
849
+ : undefined, '--mrt-virtual-row-start': virtualRow
850
+ ? `${virtualRow.start}px`
851
+ : undefined }), className: clsx(classes$B.root, (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) && classes$B['root-grid'], virtualRow && classes$B['root-virtualized'], tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.className), children: [virtualPaddingLeft ? (jsx(Box, { component: "td", display: "flex", w: virtualPaddingLeft })) : null, children
852
+ ? children
853
+ : (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : row.getVisibleCells()).map((cellOrVirtualCell, renderedColumnIndex) => {
854
+ let cell = cellOrVirtualCell;
855
+ if (columnVirtualizer) {
856
+ renderedColumnIndex = cellOrVirtualCell
857
+ .index;
858
+ cell = visibleCells[renderedColumnIndex];
859
+ }
860
+ const cellProps = {
861
+ cell,
862
+ numRows,
863
+ renderedColumnIndex,
864
+ renderedRowIndex,
865
+ rowRef,
866
+ table,
867
+ virtualCell: columnVirtualizer
868
+ ? cellOrVirtualCell
869
+ : undefined,
870
+ };
871
+ return memoMode === 'cells' &&
872
+ cell.column.columnDef.columnDefType === 'data' &&
873
+ !draggingColumn &&
874
+ !draggingRow &&
875
+ (editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) !== cell.id &&
876
+ (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) !== row.id ? (jsx(Memo_MRT_TableBodyCell, Object.assign({}, cellProps), cell.id)) : (jsx(MRT_TableBodyCell, Object.assign({}, cellProps), cell.id));
877
+ }), virtualPaddingRight ? (jsx(Box, { component: "td", display: "flex", w: virtualPaddingRight })) : null] })), renderDetailPanel && !row.getIsGrouped() && !isEmptyRow && (jsx(MRT_TableDetailPanel, { parentRowRef: rowRef, renderedRowIndex: renderedRowIndex, row: row, rowVirtualizer: rowVirtualizer, striped: striped, table: table, virtualRow: virtualRow }))] }));
878
+ };
879
+ //the state version changes whenever table state changes, so a memoized row
880
+ //still follows row selection, density, editing and so on. The `table`
881
+ //reference is not compared: an inline option gives a new one on every render.
882
+ const Memo_MRT_TableBodyRow = memo(MRT_TableBodyRow, (prev, next) => {
883
+ var _a, _b;
884
+ return prev.row === next.row &&
885
+ getMRT_TableStateVersion(prev.table) ===
886
+ getMRT_TableStateVersion(next.table) &&
887
+ ((_a = prev.virtualRow) === null || _a === void 0 ? void 0 : _a.start) === ((_b = next.virtualRow) === null || _b === void 0 ? void 0 : _b.start);
888
+ });
889
+
890
+ const MRT_TableBodyEmptyRow = (_a) => {
891
+ var _b, _c;
892
+ var { table, tableProps } = _a, commonRowProps = __rest(_a, ["table", "tableProps"]);
893
+ const { getState, options: { layoutMode, localization, renderEmptyRowsFallback }, refs: { tablePaperRef }, } = table;
894
+ const { columnFilters, globalFilter } = getState();
895
+ const emptyRow = useMemo(() => createRow$1(table, 'mrt-row-empty', {}, 0, 0), []);
896
+ const emptyRowProps = Object.assign(Object.assign({}, commonRowProps), { renderedRowIndex: 0, row: emptyRow, virtualRow: undefined });
897
+ return (jsx(MRT_TableBodyRow, Object.assign({ className: clsx('mrt-table-body-row', (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) && classes$C['empty-row-tr-grid']), table: table, tableProps: tableProps }, emptyRowProps, { children: jsx("td", { className: clsx('mrt-table-body-cell', (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) && classes$C['empty-row-td-grid']), colSpan: table.getVisibleLeafColumns().length, children: (_b = renderEmptyRowsFallback === null || renderEmptyRowsFallback === void 0 ? void 0 : renderEmptyRowsFallback({ table })) !== null && _b !== void 0 ? _b : (jsx(Text, { __vars: {
898
+ '--mrt-paper-width': `${(_c = tablePaperRef.current) === null || _c === void 0 ? void 0 : _c.clientWidth}`,
899
+ }, className: clsx(classes$C['empty-row-td-content']), children: globalFilter || columnFilters.length
900
+ ? localization.noResultsFound
901
+ : localization.noRecordsToDisplay })) }) })));
902
+ };
903
+
904
+ const useMRT_Rows = (table) => {
905
+ const { getRowModel, getState, options: { data, enableGlobalFilterRankedResults, positionCreatingRow }, } = table;
906
+ const { creatingRow, expanded, globalFilter, pagination, rowPinning, sorting, } = getState();
907
+ const rows = useMemo(() => getMRT_Rows(table), [
908
+ creatingRow,
909
+ data,
910
+ enableGlobalFilterRankedResults,
911
+ expanded,
912
+ getRowModel().rows,
913
+ globalFilter,
914
+ pagination.pageIndex,
915
+ pagination.pageSize,
916
+ positionCreatingRow,
917
+ rowPinning,
918
+ sorting,
919
+ ]);
920
+ return rows;
921
+ };
922
+
923
+ /**
924
+ * Column virtualization indexes the visible leaf columns. A header group that
925
+ * holds group headers has fewer headers than there are leaf columns, so
926
+ * `headers[virtualColumn.index]` does not find the right header there.
927
+ *
928
+ * Returns the headers that sit above at least one rendered leaf column, or
929
+ * `undefined` for a header group of leaf headers, which the index does match.
930
+ * `style` narrows a group header when only some of its columns are rendered.
931
+ */
932
+ const getVirtualGroupHeaders = ({ headers, table, virtualColumns, }) => {
933
+ if (!virtualColumns || !headers.some((header) => { var _a; return (_a = header.subHeaders) === null || _a === void 0 ? void 0 : _a.length; })) {
934
+ return undefined;
935
+ }
936
+ const { layoutMode } = table.options;
937
+ const leafIndexes = new Map(table.getVisibleLeafColumns().map((column, index) => [column.id, index]));
938
+ const virtualIndexes = new Set(virtualColumns.map((virtualColumn) => virtualColumn.index));
939
+ return headers.flatMap((header) => {
940
+ const leafHeaders = header
941
+ .getLeafHeaders()
942
+ .filter((leafHeader) => { var _a; return !((_a = leafHeader.subHeaders) === null || _a === void 0 ? void 0 : _a.length); });
943
+ const renderedLeafHeaders = leafHeaders.filter((leafHeader) => { var _a; return virtualIndexes.has((_a = leafIndexes.get(leafHeader.column.id)) !== null && _a !== void 0 ? _a : -1); });
944
+ if (!renderedLeafHeaders.length)
945
+ return [];
946
+ let style;
947
+ if (renderedLeafHeaders.length < leafHeaders.length) {
948
+ const size = renderedLeafHeaders.reduce((total, leafHeader) => total + leafHeader.getSize(), 0);
949
+ style = { minWidth: `${size}px`, width: `${size}px` };
950
+ if (layoutMode === 'grid')
951
+ style.flex = `${size} 0 auto`;
952
+ }
953
+ return [
954
+ {
955
+ header,
956
+ index: leafIndexes.get(renderedLeafHeaders[0].column.id),
957
+ style,
958
+ },
959
+ ];
960
+ });
961
+ };
962
+ const extraIndexRangeExtractor = (range, draggingIndex) => {
963
+ const newIndexes = defaultRangeExtractor(range);
964
+ if (draggingIndex === undefined)
965
+ return newIndexes;
966
+ if (draggingIndex >= 0 &&
967
+ draggingIndex < Math.max(range.startIndex - range.overscan, 0)) {
968
+ newIndexes.unshift(draggingIndex);
969
+ }
970
+ if (draggingIndex >= 0 && draggingIndex > range.endIndex + range.overscan) {
971
+ newIndexes.push(draggingIndex);
972
+ }
973
+ return newIndexes;
974
+ };
975
+
976
+ /**
977
+ * TanStack Virtual reads its scroll element in a layout effect. Child layout
978
+ * effects run before the table container attaches its ref, so the first read
979
+ * returns null and no rows or columns are rendered.
980
+ *
981
+ * Passive effects run after every ref is attached. This hook re-renders the
982
+ * owner once when the virtualizer still holds a different scroll element, so
983
+ * the next layout effect picks up the mounted container. The virtualizer no
984
+ * longer depends on an unrelated parent re-render, which compiled consumer
985
+ * code does not produce.
986
+ */
987
+ const useMRT_VirtualizerScrollElement = (virtualizer) => {
988
+ const rerender = useReducer((version) => version + 1, 0)[1];
989
+ useEffect(() => {
990
+ //the virtualizer's own options decide the element, so a consumer's
991
+ //`getScrollElement` or `enabled: false` never leaves a permanent mismatch
992
+ const { enabled, getScrollElement } = virtualizer.options;
993
+ const scrollElement = enabled === false ? null : getScrollElement();
994
+ if (scrollElement && virtualizer.scrollElement !== scrollElement) {
995
+ rerender();
996
+ }
997
+ });
998
+ };
999
+
1000
+ const useMRT_RowVirtualizer = (table, rows) => {
1001
+ var _a, _b;
1002
+ const { getRowModel, getState, options: { enableRowVirtualization, renderDetailPanel, rowVirtualizerInstanceRef, rowVirtualizerOptions, }, refs: { scrollAreaViewportRef, tableContainerRef }, } = table;
1003
+ const { density, draggingRow, expanded } = getState();
1004
+ if (!enableRowVirtualization)
1005
+ return undefined;
1006
+ const rowVirtualizerProps = parseFromValuesOrFunc(rowVirtualizerOptions, {
1007
+ table,
1008
+ });
1009
+ const rowCount = (_a = rows === null || rows === void 0 ? void 0 : rows.length) !== null && _a !== void 0 ? _a : getRowModel().rows.length;
1010
+ const defaultRowHeightByDensity = {
1011
+ lg: 62.7,
1012
+ md: 54.7,
1013
+ sm: 48.7,
1014
+ xl: 70.7,
1015
+ xs: 42.7,
1016
+ };
1017
+ const normalRowHeight = (_b = defaultRowHeightByDensity[density]) !== null && _b !== void 0 ? _b : defaultRowHeightByDensity['md'];
1018
+ const rowVirtualizer = useVirtualizer(Object.assign({ count: renderDetailPanel ? rowCount * 2 : rowCount, estimateSize: (index) => renderDetailPanel && index % 2 === 1
1019
+ ? expanded === true
1020
+ ? 100
1021
+ : 0
1022
+ : normalRowHeight, getScrollElement: () => { var _a; return (_a = scrollAreaViewportRef.current) !== null && _a !== void 0 ? _a : tableContainerRef.current; }, measureElement: typeof window !== 'undefined' &&
1023
+ navigator.userAgent.indexOf('Firefox') === -1
1024
+ ? (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height
1025
+ : undefined, overscan: 4, rangeExtractor: useCallback((range) => {
1026
+ const current_index = getRowModel().rows.findIndex((row) => row.id === (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id));
1027
+ return extraIndexRangeExtractor(range, current_index >= 0 ? current_index : 0);
1028
+ }, [draggingRow]) }, rowVirtualizerProps));
1029
+ useMRT_VirtualizerScrollElement(rowVirtualizer);
1030
+ rowVirtualizer.virtualRows = rowVirtualizer.getVirtualItems();
1031
+ if (rowVirtualizerInstanceRef) {
1032
+ //@ts-ignore
1033
+ rowVirtualizerInstanceRef.current = rowVirtualizer;
1034
+ }
1035
+ return rowVirtualizer;
1036
+ };
1037
+
1038
+ const MRT_TableBody = (_a) => {
1039
+ var _b, _c, _d, _e;
1040
+ var { columnVirtualizer, table, tableProps } = _a, rest = __rest(_a, ["columnVirtualizer", "table", "tableProps"]);
1041
+ const { getBottomRows, getIsSomeRowsPinned, getRowModel, getState, getTopRows, options: { enableStickyFooter, enableStickyHeader, layoutMode, mantineTableBodyProps, memoMode, renderDetailPanel, rowPinningDisplayMode, }, refs: { tableFooterRef, tableHeadRef }, } = table;
1042
+ const { isFullScreen, rowPinning } = getState();
1043
+ const tableBodyProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineTableBodyProps, { table })), rest);
1044
+ const tableHeadHeight = ((enableStickyHeader || isFullScreen) &&
1045
+ ((_b = tableHeadRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight)) ||
1046
+ 0;
1047
+ const tableFooterHeight = (enableStickyFooter && ((_c = tableFooterRef.current) === null || _c === void 0 ? void 0 : _c.clientHeight)) || 0;
1048
+ const pinnedRowIds = useMemo(() => {
1049
+ var _a, _b;
1050
+ if (!((_a = rowPinning.bottom) === null || _a === void 0 ? void 0 : _a.length) && !((_b = rowPinning.top) === null || _b === void 0 ? void 0 : _b.length))
1051
+ return [];
1052
+ return getRowModel()
1053
+ .rows.filter((row) => row.getIsPinned())
1054
+ .map((r) => r.id);
1055
+ }, [rowPinning, getRowModel().rows]);
1056
+ const rows = useMRT_Rows(table);
1057
+ const rowVirtualizer = useMRT_RowVirtualizer(table, rows);
1058
+ const commonRowProps = {
1059
+ columnVirtualizer,
1060
+ numRows: rows.length,
1061
+ table,
1062
+ tableProps,
1063
+ };
1064
+ return (jsxs(Fragment, { children: [!(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
1065
+ getIsSomeRowsPinned('top') && (jsx(TableTbody, Object.assign({}, tableBodyProps, { __vars: Object.assign({ '--mrt-table-head-height': `${tableHeadHeight}` }, tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.__vars), className: clsx(classes$C.pinned, (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) && classes$C['root-grid'], tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.className), children: getTopRows().map((row, renderedRowIndex) => {
1066
+ const rowProps = Object.assign(Object.assign({}, commonRowProps), { renderedRowIndex,
1067
+ row });
1068
+ return memoMode === 'rows' ? (jsx(Memo_MRT_TableBodyRow, Object.assign({}, rowProps), row.id)) : (jsx(MRT_TableBodyRow, Object.assign({}, rowProps), row.id));
1069
+ }) }))), jsx(TableTbody, Object.assign({}, tableBodyProps, { __vars: Object.assign({ '--mrt-table-body-height': rowVirtualizer
1070
+ ? `${rowVirtualizer.getTotalSize()}px`
1071
+ : undefined }, tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.__vars), className: clsx(classes$C.root, (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) && classes$C['root-grid'], !rows.length && classes$C['root-no-rows'], rowVirtualizer && classes$C['root-virtualized'], tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.className), children: (_d = tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.children) !== null && _d !== void 0 ? _d : (!rows.length ? (jsx(MRT_TableBodyEmptyRow, Object.assign({}, commonRowProps))) : (jsx(Fragment, { children: ((_e = rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.virtualRows) !== null && _e !== void 0 ? _e : rows).map((rowOrVirtualRow, renderedRowIndex) => {
1072
+ if (rowVirtualizer) {
1073
+ if (renderDetailPanel) {
1074
+ if (rowOrVirtualRow.index % 2 === 1) {
1075
+ return null;
1076
+ }
1077
+ else {
1078
+ renderedRowIndex = rowOrVirtualRow.index / 2;
1079
+ }
1080
+ }
1081
+ else {
1082
+ renderedRowIndex = rowOrVirtualRow.index;
1083
+ }
1084
+ }
1085
+ const row = rowVirtualizer
1086
+ ? rows[renderedRowIndex]
1087
+ : rowOrVirtualRow;
1088
+ const props = Object.assign(Object.assign({}, commonRowProps), { pinnedRowIds,
1089
+ renderedRowIndex,
1090
+ row,
1091
+ rowVirtualizer, virtualRow: rowVirtualizer
1092
+ ? rowOrVirtualRow
1093
+ : undefined });
1094
+ const key = `${row.id}-${row.index}`;
1095
+ return memoMode === 'rows' ? (jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), key)) : (jsx(MRT_TableBodyRow, Object.assign({}, props), key));
1096
+ }) }))) })), !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
1097
+ getIsSomeRowsPinned('bottom') && (jsx(TableTbody, Object.assign({}, tableBodyProps, { __vars: Object.assign({ '--mrt-table-footer-height': `${tableFooterHeight}` }, tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.__vars), className: clsx(classes$C.pinned, (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) && classes$C['root-grid'], tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.className), children: getBottomRows().map((row, renderedRowIndex) => {
1098
+ const props = Object.assign(Object.assign({}, commonRowProps), { renderedRowIndex,
1099
+ row });
1100
+ return memoMode === 'rows' ? (jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
1101
+ }) })))] }));
1102
+ };
1103
+ const Memo_MRT_TableBody = memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
1104
+
1105
+ var classes$x = {"grab-icon":"MRT_GrabHandleButton-module_grab-icon__mQimy"};
1106
+
1107
+ const MRT_GrabHandleButton = ({ actionIconProps, onDragEnd, onDragStart, table: { options: { icons: { IconGripHorizontal }, localization: { move }, }, }, }) => {
1108
+ var _a, _b;
1109
+ return (jsx(Tooltip, { label: (_a = actionIconProps === null || actionIconProps === void 0 ? void 0 : actionIconProps.title) !== null && _a !== void 0 ? _a : move, openDelay: 1000, withinPortal: true, children: jsx(ActionIcon, Object.assign({ "aria-label": (_b = actionIconProps === null || actionIconProps === void 0 ? void 0 : actionIconProps.title) !== null && _b !== void 0 ? _b : move, draggable: true }, actionIconProps, { className: clsx('mrt-grab-handle-button', classes$x['grab-icon'], actionIconProps === null || actionIconProps === void 0 ? void 0 : actionIconProps.className), color: "gray", onClick: (e) => {
1110
+ var _a;
1111
+ e.stopPropagation();
1112
+ (_a = actionIconProps === null || actionIconProps === void 0 ? void 0 : actionIconProps.onClick) === null || _a === void 0 ? void 0 : _a.call(actionIconProps, e);
1113
+ }, onDragEnd: onDragEnd, onDragStart: onDragStart, size: "sm", title: undefined, variant: "transparent", children: jsx(IconGripHorizontal, { size: "100%" }) })) }));
1114
+ };
1115
+
1116
+ const MRT_TableBodyRowGrabHandle = (_a) => {
1117
+ var { row, rowRef, table } = _a, rest = __rest(_a, ["row", "rowRef", "table"]);
1118
+ const { options: { mantineRowDragHandleProps }, } = table;
1119
+ const actionIconProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineRowDragHandleProps, {
1120
+ row,
1121
+ table,
1122
+ })), rest);
1123
+ const handleDragStart = (event) => {
1124
+ var _a;
1125
+ (_a = actionIconProps === null || actionIconProps === void 0 ? void 0 : actionIconProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(actionIconProps, event);
1126
+ event.dataTransfer.setDragImage(rowRef.current, 0, 0);
1127
+ table.setDraggingRow(row);
1128
+ };
1129
+ const handleDragEnd = (event) => {
1130
+ var _a;
1131
+ (_a = actionIconProps === null || actionIconProps === void 0 ? void 0 : actionIconProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(actionIconProps, event);
1132
+ table.setDraggingRow(null);
1133
+ table.setHoveredRow(null);
1134
+ };
1135
+ return (jsx(MRT_GrabHandleButton, { actionIconProps: actionIconProps, onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table }));
1136
+ };
1137
+
1138
+ const MRT_RowPinButton = (_a) => {
1139
+ var { pinningPosition, row, table } = _a, rest = __rest(_a, ["pinningPosition", "row", "table"]);
1140
+ const { options: { icons: { IconPinned, IconX }, localization, rowPinningDisplayMode, }, } = table;
1141
+ const isPinned = row.getIsPinned();
1142
+ const [tooltipOpened, setTooltipOpened] = useState(false);
1143
+ const handleTogglePin = (event) => {
1144
+ setTooltipOpened(false);
1145
+ event.stopPropagation();
1146
+ row.pin(isPinned ? false : pinningPosition);
1147
+ };
1148
+ return (jsx(Tooltip, { label: isPinned ? localization.unpin : localization.pin, openDelay: 1000, opened: tooltipOpened, children: jsx(ActionIcon, Object.assign({ "aria-label": localization.pin, color: "gray", onClick: handleTogglePin, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false), size: "xs", style: {
1149
+ height: '24px',
1150
+ width: '24px',
1151
+ }, variant: "subtle" }, rest, { children: isPinned ? (jsx(IconX, {})) : (jsx(IconPinned, { fontSize: "small", style: {
1152
+ transform: `rotate(${rowPinningDisplayMode === 'sticky'
1153
+ ? 135
1154
+ : pinningPosition === 'top'
1155
+ ? 180
1156
+ : 0}deg)`,
1157
+ } })) })) }));
1158
+ };
1159
+
1160
+ const MRT_TableBodyRowPinButton = (_a) => {
1161
+ var { row, table } = _a, rest = __rest(_a, ["row", "table"]);
1162
+ const { getState, options: { enableRowPinning, rowPinningDisplayMode }, } = table;
1163
+ const { density } = getState();
1164
+ const canPin = parseFromValuesOrFunc(enableRowPinning, row);
1165
+ if (!canPin)
1166
+ return null;
1167
+ const rowPinButtonProps = Object.assign({ row,
1168
+ table }, rest);
1169
+ if (rowPinningDisplayMode === 'top-and-bottom' && !row.getIsPinned()) {
1170
+ return (jsxs(Box, { style: {
1171
+ display: 'flex',
1172
+ flexDirection: density === 'xs' ? 'row' : 'column',
1173
+ }, children: [jsx(MRT_RowPinButton, Object.assign({ pinningPosition: "top" }, rowPinButtonProps)), jsx(MRT_RowPinButton, Object.assign({ pinningPosition: "bottom" }, rowPinButtonProps))] }));
1174
+ }
1175
+ return (jsx(MRT_RowPinButton, Object.assign({ pinningPosition: rowPinningDisplayMode === 'bottom' ? 'bottom' : 'top' }, rowPinButtonProps)));
1176
+ };
1177
+
1178
+ var classes$w = {"root":"MRT_ColumnPinningButtons-module_root__scTtW","left":"MRT_ColumnPinningButtons-module_left__W6Aog","right":"MRT_ColumnPinningButtons-module_right__7AJE3"};
1179
+
1180
+ const MRT_ColumnPinningButtons = ({ column, table, }) => {
1181
+ const { options: { icons: { IconPinned, IconPinnedOff }, localization, }, } = table;
1182
+ return (jsx(Flex, { className: clsx('mrt-column-pinning-buttons', classes$w.root), children: column.getIsPinned() ? (jsx(Tooltip, { label: localization.unpin, withinPortal: true, children: jsx(ActionIcon, { color: "gray", onClick: () => column.pin(false), size: "md", variant: "subtle", children: jsx(IconPinnedOff, {}) }) })) : (jsxs(Fragment, { children: [jsx(Tooltip, { label: localization.pinToLeft, withinPortal: true, children: jsx(ActionIcon, { color: "gray", onClick: () => column.pin('left'), size: "md", variant: "subtle", children: jsx(IconPinned, { className: classes$w.left }) }) }), jsx(Tooltip, { label: localization.pinToRight, withinPortal: true, children: jsx(ActionIcon, { color: "gray", onClick: () => column.pin('right'), size: "md", variant: "subtle", children: jsx(IconPinned, { className: classes$w.right }) }) })] })) }));
1183
+ };
1184
+
1185
+ var classes$v = {"root":"MRT_EditActionButtons-module_root__BfxVZ"};
1186
+
1187
+ const MRT_EditActionButtons = (_a) => {
1188
+ var { row, table, variant = 'icon' } = _a, rest = __rest(_a, ["row", "table", "variant"]);
1189
+ const { getState, options: { icons: { IconCircleX, IconDeviceFloppy }, localization, onCreatingRowCancel, onCreatingRowSave, onEditingRowCancel, onEditingRowSave, }, refs: { editInputRefs }, setCreatingRow, setEditingRow, } = table;
1190
+ const { creatingRow, editingRow, isSaving } = getState();
1191
+ const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
1192
+ const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
1193
+ const handleCancel = () => {
1194
+ if (isCreating) {
1195
+ onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
1196
+ setCreatingRow(null);
1197
+ }
1198
+ else if (isEditing) {
1199
+ onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
1200
+ setEditingRow(null);
1201
+ }
1202
+ row._valuesCache = {}; //reset values cache
1203
+ };
1204
+ const handleSubmitRow = () => {
1205
+ var _a;
1206
+ //look for auto-filled input values. A browser can fill an input without
1207
+ //firing the change event that saves the value to the row cache.
1208
+ const inputNamePrefix = `${row.id}_`; //input names are cell ids: rowId_columnId
1209
+ const valuesCache = row._valuesCache;
1210
+ Object.values((_a = editInputRefs === null || editInputRefs === void 0 ? void 0 : editInputRefs.current) !== null && _a !== void 0 ? _a : {})
1211
+ .filter((input) => { var _a; return (_a = input === null || input === void 0 ? void 0 : input.name) === null || _a === void 0 ? void 0 : _a.startsWith(inputNamePrefix); })
1212
+ .forEach((input) => {
1213
+ var _a, _b;
1214
+ const columnId = input.name.slice(inputNamePrefix.length);
1215
+ const editVariant = (_a = table.getColumn(columnId)) === null || _a === void 0 ? void 0 : _a.columnDef.editVariant;
1216
+ //select inputs show the option label, not the value, so only text inputs are read
1217
+ const isTextInput = !editVariant || editVariant === 'text';
1218
+ if (isTextInput &&
1219
+ Object.hasOwn(valuesCache, columnId) &&
1220
+ //a number or other parsed value is the consumer's, and its text form can differ
1221
+ (typeof valuesCache[columnId] === 'string' ||
1222
+ valuesCache[columnId] == null) &&
1223
+ input.value !== String((_b = valuesCache[columnId]) !== null && _b !== void 0 ? _b : '')) {
1224
+ valuesCache[columnId] = input.value;
1225
+ }
1226
+ });
1227
+ if (isCreating)
1228
+ onCreatingRowSave === null || onCreatingRowSave === void 0 ? void 0 : onCreatingRowSave({
1229
+ exitCreatingMode: () => setCreatingRow(null),
1230
+ row,
1231
+ table,
1232
+ values: row._valuesCache,
1233
+ });
1234
+ else if (isEditing) {
1235
+ onEditingRowSave === null || onEditingRowSave === void 0 ? void 0 : onEditingRowSave({
1236
+ exitEditingMode: () => setEditingRow(null),
1237
+ row,
1238
+ table,
1239
+ values: row === null || row === void 0 ? void 0 : row._valuesCache,
1240
+ });
1241
+ }
1242
+ };
1243
+ return (jsx(Box, Object.assign({ className: clsx('mrt-edit-action-buttons', classes$v.root), onClick: (e) => e.stopPropagation() }, rest, { children: variant === 'icon' ? (jsxs(Fragment, { children: [jsx(Tooltip, { label: localization.cancel, withinPortal: true, children: jsx(ActionIcon, { "aria-label": localization.cancel, color: "red", onClick: handleCancel, variant: "subtle", children: jsx(IconCircleX, {}) }) }), jsx(Tooltip, { label: localization.save, withinPortal: true, children: jsx(ActionIcon, { "aria-label": localization.save, color: "blue", loading: isSaving, onClick: handleSubmitRow, variant: "subtle", children: jsx(IconDeviceFloppy, {}) }) })] })) : (jsxs(Fragment, { children: [jsx(Button, { onClick: handleCancel, variant: "subtle", children: localization.cancel }), jsx(Button, { loading: isSaving, onClick: handleSubmitRow, variant: "filled", children: localization.save })] })) })));
1244
+ };
1245
+
1246
+ var classes$u = {"root":"MRT_ExpandAllButton-module_root__gkBZD","chevron":"MRT_ExpandAllButton-module_chevron__Iep0j","up":"MRT_ExpandAllButton-module_up__Xth3U","right":"MRT_ExpandAllButton-module_right__bS4L-"};
1247
+
1248
+ const MRT_ExpandAllButton = (_a) => {
1249
+ var _b, _c;
1250
+ var { table } = _a, rest = __rest(_a, ["table"]);
1251
+ const { getCanSomeRowsExpand, getIsAllRowsExpanded, getIsSomeRowsExpanded, getState, options: { icons: { IconChevronsDown }, localization, mantineExpandAllButtonProps, renderDetailPanel, }, toggleAllRowsExpanded, } = table;
1252
+ const { density, isLoading } = getState();
1253
+ const actionIconProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineExpandAllButtonProps, {
1254
+ table,
1255
+ })), rest);
1256
+ const isAllRowsExpanded = getIsAllRowsExpanded();
1257
+ return (jsx(Tooltip, { label: ((_b = actionIconProps === null || actionIconProps === void 0 ? void 0 : actionIconProps.title) !== null && _b !== void 0 ? _b : isAllRowsExpanded)
1258
+ ? localization.collapseAll
1259
+ : localization.expandAll, openDelay: 1000, withinPortal: true, children: jsx(ActionIcon, Object.assign({ "aria-label": localization.expandAll, color: "gray", variant: "subtle" }, actionIconProps, { className: clsx('mrt-expand-all-button', classes$u.root, actionIconProps === null || actionIconProps === void 0 ? void 0 : actionIconProps.className, density), disabled: isLoading || (!renderDetailPanel && !getCanSomeRowsExpand()), onClick: () => toggleAllRowsExpanded(!isAllRowsExpanded), title: undefined, children: (_c = actionIconProps === null || actionIconProps === void 0 ? void 0 : actionIconProps.children) !== null && _c !== void 0 ? _c : (jsx(IconChevronsDown, { className: clsx(classes$u.chevron, isAllRowsExpanded
1260
+ ? classes$u.up
1261
+ : getIsSomeRowsExpanded()
1262
+ ? classes$u.right
1263
+ : undefined) })) })) }));
1264
+ };
1265
+
1266
+ var classes$t = {"root":"MRT_ExpandButton-module_root__IFYio","root-ltr":"MRT_ExpandButton-module_root-ltr__FHNnp","chevron":"MRT_ExpandButton-module_chevron__XzC5P","right":"MRT_ExpandButton-module_right__-pC-A","up":"MRT_ExpandButton-module_up__TZGBo","root-rtl":"MRT_ExpandButton-module_root-rtl__zoudS"};
1267
+
1268
+ const MRT_ExpandButton = (_a) => {
1269
+ var _b, _c;
1270
+ var { row, table } = _a, rest = __rest(_a, ["row", "table"]);
1271
+ const direction = useDirection();
1272
+ const { options: { icons: { IconChevronDown }, localization, mantineExpandButtonProps, positionExpandColumn, renderDetailPanel, }, } = table;
1273
+ const actionIconProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineExpandButtonProps, {
1274
+ row,
1275
+ table,
1276
+ })), rest);
1277
+ const internalEditComponents = row
1278
+ .getAllCells()
1279
+ .filter((cell) => cell.column.columnDef.columnDefType === 'data')
1280
+ .map((cell) => (jsx(MRT_EditCellTextInput, { cell: cell, table: table }, cell.id)));
1281
+ const canExpand = row.getCanExpand();
1282
+ const isExpanded = row.getIsExpanded();
1283
+ const DetailPanel = !!(renderDetailPanel === null || renderDetailPanel === void 0 ? void 0 : renderDetailPanel({
1284
+ internalEditComponents,
1285
+ row,
1286
+ table,
1287
+ }));
1288
+ const handleToggleExpand = (event) => {
1289
+ var _a;
1290
+ event.stopPropagation();
1291
+ row.toggleExpanded();
1292
+ (_a = actionIconProps === null || actionIconProps === void 0 ? void 0 : actionIconProps.onClick) === null || _a === void 0 ? void 0 : _a.call(actionIconProps, event);
1293
+ };
1294
+ const rtl = direction.dir === 'rtl' || positionExpandColumn === 'last';
1295
+ return (jsx(Tooltip, { disabled: !canExpand && !DetailPanel, label: (_b = actionIconProps === null || actionIconProps === void 0 ? void 0 : actionIconProps.title) !== null && _b !== void 0 ? _b : (isExpanded ? localization.collapse : localization.expand), openDelay: 1000, withinPortal: true, children: jsx(ActionIcon, Object.assign({ "aria-label": localization.expand, color: "gray", disabled: !canExpand && !DetailPanel, variant: "subtle" }, actionIconProps, { __vars: {
1296
+ '--mrt-row-depth': `${row.depth}`,
1297
+ }, className: clsx('mrt-expand-button', classes$t.root, classes$t[`root-${rtl ? 'rtl' : 'ltr'}`], actionIconProps === null || actionIconProps === void 0 ? void 0 : actionIconProps.className), onClick: handleToggleExpand, title: undefined, children: (_c = actionIconProps === null || actionIconProps === void 0 ? void 0 : actionIconProps.children) !== null && _c !== void 0 ? _c : (jsx(IconChevronDown, { className: clsx('mrt-expand-button-chevron', classes$t.chevron, !canExpand && !renderDetailPanel
1298
+ ? classes$t.right
1299
+ : isExpanded
1300
+ ? classes$t.up
1301
+ : undefined) })) })) }));
1302
+ };
1303
+
1304
+ var classes$s = {"root":"MRT_ShowHideColumnsMenu-module_root__2UWak","content":"MRT_ShowHideColumnsMenu-module_content__ehkWQ"};
1305
+
1306
+ var classes$r = {"root":"MRT_ShowHideColumnsMenuItems-module_root__wYgv-","menu":"MRT_ShowHideColumnsMenuItems-module_menu__CeATR","grab":"MRT_ShowHideColumnsMenuItems-module_grab__a-d-y","pin":"MRT_ShowHideColumnsMenuItems-module_pin__P437b","switch":"MRT_ShowHideColumnsMenuItems-module_switch__tMsdt","header":"MRT_ShowHideColumnsMenuItems-module_header__xVkKb"};
1307
+
1308
+ const getColumnId = (columnDef) => { var _a, _b, _c, _d; return (_d = (_a = columnDef.id) !== null && _a !== void 0 ? _a : (_c = (_b = columnDef.accessorKey) === null || _b === void 0 ? void 0 : _b.toString) === null || _c === void 0 ? void 0 : _c.call(_b)) !== null && _d !== void 0 ? _d : columnDef.header; };
1309
+ const getAllLeafColumnDefs = (columns) => {
1310
+ const allLeafColumnDefs = [];
1311
+ const getLeafColumns = (cols) => {
1312
+ cols.forEach((col) => {
1313
+ if (col.columns) {
1314
+ getLeafColumns(col.columns);
1315
+ }
1316
+ else {
1317
+ allLeafColumnDefs.push(col);
1318
+ }
1319
+ });
1320
+ };
1321
+ getLeafColumns(columns);
1322
+ return allLeafColumnDefs;
1323
+ };
1324
+ /**
1325
+ * Marks the placeholder rows that `useMRT_TableInstance` generates for the
1326
+ * loading skeletons. The same `Symbol.for` key is written there.
1327
+ */
1328
+ const skeletonRowKey = Symbol.for('mrt-skeleton-row');
1329
+ const isSkeletonRow = (originalRow) => !!(originalRow === null || originalRow === void 0 ? void 0 : originalRow[skeletonRowKey]);
1330
+ const skeletonSafeAccessorFns = new WeakSet();
1331
+ const prepareColumns = ({ columnDefs, tableOptions, }) => {
1332
+ const { aggregationFns = {}, defaultDisplayColumn, filterFns = {}, sortingFns = {}, state: { columnFilterFns = {} } = {}, } = tableOptions;
1333
+ return columnDefs.map((columnDef) => {
1334
+ var _a, _b, _c, _d, _e;
1335
+ //assign columnId
1336
+ if (!columnDef.id)
1337
+ columnDef.id = getColumnId(columnDef);
1338
+ //assign columnDefType
1339
+ if (!columnDef.columnDefType)
1340
+ columnDef.columnDefType = 'data';
1341
+ if ((_a = columnDef.columns) === null || _a === void 0 ? void 0 : _a.length) {
1342
+ columnDef.columnDefType = 'group';
1343
+ //recursively prepare columns if this is a group column
1344
+ columnDef.columns = prepareColumns({
1345
+ columnDefs: columnDef.columns,
1346
+ tableOptions,
1347
+ });
1348
+ }
1349
+ else if (columnDef.columnDefType === 'data') {
1350
+ //assign aggregationFns if multiple aggregationFns are provided
1351
+ if (Array.isArray(columnDef.aggregationFn)) {
1352
+ const aggFns = columnDef.aggregationFn;
1353
+ columnDef.aggregationFn = (columnId, leafRows, childRows) => aggFns.map((fn) => { var _a; return (_a = aggregationFns[fn]) === null || _a === void 0 ? void 0 : _a.call(aggregationFns, columnId, leafRows, childRows); });
1354
+ }
1355
+ //skeleton rows hold no data, so a custom accessorFn must not read them
1356
+ const { accessorFn } = columnDef;
1357
+ if (accessorFn && !skeletonSafeAccessorFns.has(accessorFn)) {
1358
+ columnDef.accessorFn = ((originalRow, index) => isSkeletonRow(originalRow)
1359
+ ? null
1360
+ : accessorFn(originalRow, index));
1361
+ skeletonSafeAccessorFns.add(columnDef.accessorFn);
1362
+ }
1363
+ //assign filterFns
1364
+ //a column added after the first render has no `columnFilterFns` state yet
1365
+ const filterMode = (_c = (_b = columnFilterFns[columnDef.id]) !== null && _b !== void 0 ? _b : columnDef._filterFn) !== null && _c !== void 0 ? _c : (columnDef.filterFn instanceof Function
1366
+ ? undefined
1367
+ : ((_d = columnDef.filterFn) !== null && _d !== void 0 ? _d : getDefaultColumnFilterFn(columnDef)));
1368
+ if (filterMode !== undefined) {
1369
+ if (Object.keys(filterFns).includes(filterMode)) {
1370
+ columnDef.filterFn = (_e = filterFns[filterMode]) !== null && _e !== void 0 ? _e : filterFns.fuzzy;
1371
+ }
1372
+ //custom filter modes that are not in `filterFns` still need to be tracked
1373
+ columnDef._filterFn = filterMode;
1374
+ }
1375
+ //assign sortingFns
1376
+ if (Object.keys(sortingFns).includes(columnDef.sortingFn)) {
1377
+ // @ts-ignore
1378
+ columnDef.sortingFn = sortingFns[columnDef.sortingFn];
1379
+ }
1380
+ }
1381
+ else if (columnDef.columnDefType === 'display') {
1382
+ columnDef = Object.assign(Object.assign({}, defaultDisplayColumn), columnDef);
1383
+ }
1384
+ return columnDef;
1385
+ });
1386
+ };
1387
+ const reorderColumn = (draggedColumn, targetColumn, columnOrder) => {
1388
+ if (draggedColumn.getCanPin()) {
1389
+ draggedColumn.pin(targetColumn.getIsPinned());
1390
+ }
1391
+ const newColumnOrder = [...columnOrder];
1392
+ newColumnOrder.splice(newColumnOrder.indexOf(targetColumn.id), 0, newColumnOrder.splice(newColumnOrder.indexOf(draggedColumn.id), 1)[0]);
1393
+ return newColumnOrder;
1394
+ };
1395
+ const getDefaultColumnFilterFn = (columnDef) => {
1396
+ const { filterVariant } = columnDef;
1397
+ if (filterVariant === 'multi-select')
1398
+ return 'arrIncludesSome';
1399
+ if (filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.includes('range'))
1400
+ return 'betweenInclusive';
1401
+ if (['checkbox', 'date', 'select'].includes(filterVariant || ''))
1402
+ return 'equals';
1403
+ return 'fuzzy';
1404
+ };
1405
+
1406
+ const MRT_ShowHideColumnsMenuItems = ({ allColumns, column, hoveredColumn, setHoveredColumn, table, }) => {
1407
+ var _a;
1408
+ const theme = useMantineTheme();
1409
+ const { getState, options: { enableColumnOrdering, enableColumnPinning, enableHiding, localization, }, setColumnOrder, } = table;
1410
+ const { columnOrder } = getState();
1411
+ const { columnDef } = column;
1412
+ const { columnDefType } = columnDef;
1413
+ const switchChecked = (columnDefType !== 'group' && column.getIsVisible()) ||
1414
+ (columnDefType === 'group' &&
1415
+ column.getLeafColumns().some((col) => col.getIsVisible()));
1416
+ const handleToggleColumnHidden = (column) => {
1417
+ var _a, _b;
1418
+ if (columnDefType === 'group') {
1419
+ (_b = (_a = column === null || column === void 0 ? void 0 : column.columns) === null || _a === void 0 ? void 0 : _a.forEach) === null || _b === void 0 ? void 0 : _b.call(_a, (childColumn) => {
1420
+ childColumn.toggleVisibility(!switchChecked);
1421
+ });
1422
+ }
1423
+ else {
1424
+ column.toggleVisibility();
1425
+ }
1426
+ };
1427
+ const menuItemRef = useRef(null);
1428
+ const [isDragging, setIsDragging] = useState(false);
1429
+ const handleDragStart = (e) => {
1430
+ setIsDragging(true);
1431
+ e.dataTransfer.setDragImage(menuItemRef.current, 0, 0);
1432
+ };
1433
+ const handleDragEnd = (_e) => {
1434
+ setIsDragging(false);
1435
+ setHoveredColumn(null);
1436
+ if (hoveredColumn) {
1437
+ setColumnOrder(reorderColumn(column, hoveredColumn, columnOrder));
1438
+ }
1439
+ };
1440
+ const handleDragEnter = (_e) => {
1441
+ if (!isDragging && columnDef.enableColumnOrdering !== false) {
1442
+ setHoveredColumn(column);
1443
+ }
1444
+ };
1445
+ if (!columnDef.header || columnDef.visibleInShowHideMenu === false) {
1446
+ return null;
1447
+ }
1448
+ return (jsxs(Fragment, { children: [jsx(Menu.Item, Object.assign({ className: classes$r.root, component: "span", onDragEnter: handleDragEnter, ref: menuItemRef, style: {
1449
+ '--_column-depth': `${(column.depth + 0.5) * 2}rem`,
1450
+ '--_hover-color': getPrimaryColor(theme),
1451
+ } }, dataVariable('dragging', isDragging), dataVariable('order-hovered', (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id), { children: jsxs(Box, { className: classes$r.menu, children: [columnDefType !== 'group' &&
1452
+ enableColumnOrdering &&
1453
+ !allColumns.some((col) => col.columnDef.columnDefType === 'group') &&
1454
+ (columnDef.enableColumnOrdering !== false ? (jsx(MRT_GrabHandleButton, { onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })) : (jsx(Box, { className: classes$r.grab }))), enableColumnPinning &&
1455
+ (column.getCanPin() ? (jsx(MRT_ColumnPinningButtons, { column: column, table: table })) : (jsx(Box, { className: classes$r.pin }))), enableHiding ? (jsx(Tooltip, { label: localization.toggleVisibility, openDelay: 1000, withinPortal: true, children: jsx(Switch, { checked: switchChecked, className: classes$r.switch, disabled: !column.getCanHide(), label: columnDef.header, onChange: () => handleToggleColumnHidden(column) }) })) : (jsx(Text, { className: classes$r.header, children: columnDef.header }))] }) })), (_a = column.columns) === null || _a === void 0 ? void 0 : _a.map((c, i) => (jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: c, hoveredColumn: hoveredColumn, setHoveredColumn: setHoveredColumn, table: table }, `${i}-${c.id}`)))] }));
1456
+ };
1457
+
1458
+ function defaultDisplayColumnProps({ header, id, size, tableOptions, }) {
1459
+ const { defaultDisplayColumn, displayColumnDefOptions, localization } = tableOptions;
1460
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, defaultDisplayColumn), { header: header ? localization[header] : '', size }), displayColumnDefOptions === null || displayColumnDefOptions === void 0 ? void 0 : displayColumnDefOptions[id]), { id });
1461
+ }
1462
+ const showRowPinningColumn = (tableOptions) => {
1463
+ const { enableRowPinning, rowPinningDisplayMode } = tableOptions;
1464
+ return !!(enableRowPinning && !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.startsWith('select')));
1465
+ };
1466
+ const showRowDragColumn = (tableOptions) => {
1467
+ const { enableRowDragging, enableRowOrdering } = tableOptions;
1468
+ return !!(enableRowDragging || enableRowOrdering);
1469
+ };
1470
+ const showRowExpandColumn = (tableOptions) => {
1471
+ const { enableExpanding, enableGrouping, renderDetailPanel, state: { grouping }, } = tableOptions;
1472
+ return !!(enableExpanding ||
1473
+ (enableGrouping && (grouping === null || grouping === void 0 ? void 0 : grouping.length)) ||
1474
+ renderDetailPanel);
1475
+ };
1476
+ const showRowActionsColumn = (tableOptions) => {
1477
+ const { createDisplayMode, editDisplayMode, enableEditing, enableRowActions, state: { creatingRow }, } = tableOptions;
1478
+ return !!(enableRowActions ||
1479
+ (creatingRow && createDisplayMode === 'row') ||
1480
+ (enableEditing && ['modal', 'row'].includes(editDisplayMode !== null && editDisplayMode !== void 0 ? editDisplayMode : '')));
1481
+ };
1482
+ const showRowSelectionColumn = (tableOptions) => !!tableOptions.enableRowSelection;
1483
+ const showRowNumbersColumn = (tableOptions) => !!tableOptions.enableRowNumbers;
1484
+ const showRowSpacerColumn = (tableOptions) => tableOptions.layoutMode === 'grid-no-grow';
1485
+ const getLeadingDisplayColumnIds = (tableOptions) => [
1486
+ showRowPinningColumn(tableOptions) && 'mrt-row-pin',
1487
+ showRowDragColumn(tableOptions) && 'mrt-row-drag',
1488
+ tableOptions.positionActionsColumn === 'first' &&
1489
+ showRowActionsColumn(tableOptions) &&
1490
+ 'mrt-row-actions',
1491
+ tableOptions.positionExpandColumn === 'first' &&
1492
+ showRowExpandColumn(tableOptions) &&
1493
+ 'mrt-row-expand',
1494
+ showRowSelectionColumn(tableOptions) && 'mrt-row-select',
1495
+ showRowNumbersColumn(tableOptions) && 'mrt-row-numbers',
1496
+ ].filter(Boolean);
1497
+ const getTrailingDisplayColumnIds = (tableOptions) => [
1498
+ tableOptions.positionActionsColumn === 'last' &&
1499
+ showRowActionsColumn(tableOptions) &&
1500
+ 'mrt-row-actions',
1501
+ tableOptions.positionExpandColumn === 'last' &&
1502
+ showRowExpandColumn(tableOptions) &&
1503
+ 'mrt-row-expand',
1504
+ showRowSpacerColumn(tableOptions) && 'mrt-row-spacer',
1505
+ ].filter(Boolean);
1506
+ const getDefaultColumnOrderIds = (tableOptions, reset = false) => {
1507
+ const { state: { columnOrder: currentColumnOrderIds = [] }, } = tableOptions;
1508
+ const leadingDisplayColIds = getLeadingDisplayColumnIds(tableOptions);
1509
+ const trailingDisplayColIds = getTrailingDisplayColumnIds(tableOptions);
1510
+ const defaultColumnDefIds = getAllLeafColumnDefs(tableOptions.columns).map((columnDef) => getColumnId(columnDef));
1511
+ let allLeafColumnDefIds = reset
1512
+ ? defaultColumnDefIds
1513
+ : Array.from(new Set([...currentColumnOrderIds, ...defaultColumnDefIds]));
1514
+ allLeafColumnDefIds = allLeafColumnDefIds.filter((colId) => !leadingDisplayColIds.includes(colId) &&
1515
+ !trailingDisplayColIds.includes(colId));
1516
+ return [
1517
+ ...leadingDisplayColIds,
1518
+ ...allLeafColumnDefIds,
1519
+ ...trailingDisplayColIds,
1520
+ ];
1521
+ };
1522
+
1523
+ const MRT_ShowHideColumnsMenu = ({ table, }) => {
1524
+ const { getAllColumns, getAllLeafColumns, getCenterLeafColumns, getIsAllColumnsVisible, getIsSomeColumnsPinned, getIsSomeColumnsVisible, getLeftLeafColumns, getRightLeafColumns, getState, options: { enableColumnOrdering, enableColumnPinning, enableHiding, localization, }, } = table;
1525
+ const { columnOrder, columnPinning } = getState();
1526
+ const handleToggleAllColumns = (value) => {
1527
+ getAllLeafColumns()
1528
+ .filter((col) => col.columnDef.enableHiding !== false)
1529
+ .forEach((col) => col.toggleVisibility(value));
1530
+ };
1531
+ const allColumns = useMemo(() => {
1532
+ const columns = getAllColumns();
1533
+ if (columnOrder.length > 0 &&
1534
+ !columns.some((col) => col.columnDef.columnDefType === 'group')) {
1535
+ return [
1536
+ ...getLeftLeafColumns(),
1537
+ ...Array.from(new Set(columnOrder)).map((colId) => getCenterLeafColumns().find((col) => (col === null || col === void 0 ? void 0 : col.id) === colId)),
1538
+ ...getRightLeafColumns(),
1539
+ ].filter(Boolean);
1540
+ }
1541
+ return columns;
1542
+ }, [
1543
+ columnOrder,
1544
+ columnPinning,
1545
+ getAllColumns(),
1546
+ getCenterLeafColumns(),
1547
+ getLeftLeafColumns(),
1548
+ getRightLeafColumns(),
1549
+ ]);
1550
+ const [hoveredColumn, setHoveredColumn] = useState(null);
1551
+ return (jsxs(Menu.Dropdown, { className: clsx('mrt-show-hide-columns-menu', classes$s.root), children: [jsxs(Flex, { className: classes$s.content, children: [enableHiding && (jsx(Button, { disabled: !getIsSomeColumnsVisible(), onClick: () => handleToggleAllColumns(false), variant: "subtle", children: localization.hideAll })), enableColumnOrdering && (jsx(Button, { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options, true)), variant: "subtle", children: localization.resetOrder })), enableColumnPinning && (jsx(Button, { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true), variant: "subtle", children: localization.unpinAll })), enableHiding && (jsx(Button, { disabled: getIsAllColumnsVisible(), onClick: () => handleToggleAllColumns(true), variant: "subtle", children: localization.showAll }))] }), jsx(Menu.Divider, {}), allColumns.map((column, index) => (jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] }));
1552
+ };
1553
+
1554
+ const MRT_ShowHideColumnsButton = (_a) => {
1555
+ var { table, title } = _a, rest = __rest(_a, ["table", "title"]);
1556
+ const { icons: { IconColumns }, localization: { showHideColumns }, } = table.options;
1557
+ return (jsxs(Menu, { closeOnItemClick: false, withinPortal: true, children: [jsx(Tooltip, { label: title !== null && title !== void 0 ? title : showHideColumns, withinPortal: true, children: jsx(Menu.Target, { children: jsx(ActionIcon, Object.assign({ "aria-label": title !== null && title !== void 0 ? title : showHideColumns, color: "gray", size: "lg", variant: "subtle" }, rest, { children: jsx(IconColumns, {}) })) }) }), jsx(MRT_ShowHideColumnsMenu, { table: table })] }));
1558
+ };
1559
+
1560
+ const next = {
1561
+ md: 'xs',
1562
+ xl: 'md',
1563
+ xs: 'xl',
1564
+ };
1565
+ const MRT_ToggleDensePaddingButton = (_a) => {
1566
+ var { table: { getState, options: { icons: { IconBaselineDensityLarge, IconBaselineDensityMedium, IconBaselineDensitySmall, }, localization: { toggleDensity }, }, setDensity, }, title } = _a, rest = __rest(_a, ["table", "title"]);
1567
+ const { density } = getState();
1568
+ return (jsx(Tooltip, { label: title !== null && title !== void 0 ? title : toggleDensity, withinPortal: true, children: jsx(ActionIcon, Object.assign({ "aria-label": title !== null && title !== void 0 ? title : toggleDensity, color: "gray", onClick: () => setDensity((current) => next[current]), size: "lg", variant: "subtle" }, rest, { children: density === 'xs' ? (jsx(IconBaselineDensitySmall, {})) : density === 'md' ? (jsx(IconBaselineDensityMedium, {})) : (jsx(IconBaselineDensityLarge, {})) })) }));
1569
+ };
1570
+
1571
+ const MRT_ToggleFiltersButton = (_a) => {
1572
+ var { table: { getState, options: { icons: { IconFilter, IconFilterOff }, localization: { showHideFilters }, }, setShowColumnFilters, }, title } = _a, rest = __rest(_a, ["table", "title"]);
1573
+ const { showColumnFilters } = getState();
1574
+ return (jsx(Tooltip, { label: title !== null && title !== void 0 ? title : showHideFilters, withinPortal: true, children: jsx(ActionIcon, Object.assign({ "aria-label": title !== null && title !== void 0 ? title : showHideFilters, color: "gray", onClick: () => setShowColumnFilters((current) => !current), size: "lg", variant: "subtle" }, rest, { children: showColumnFilters ? jsx(IconFilterOff, {}) : jsx(IconFilter, {}) })) }));
1575
+ };
1576
+
1577
+ const MRT_ToggleFullScreenButton = (_a) => {
1578
+ var { table: { getState, options: { icons: { IconMaximize, IconMinimize }, localization: { toggleFullScreen }, }, setIsFullScreen, }, title } = _a, rest = __rest(_a, ["table", "title"]);
1579
+ const { isFullScreen } = getState();
1580
+ const [tooltipOpened, setTooltipOpened] = useState(false);
1581
+ const handleToggleFullScreen = () => {
1582
+ setTooltipOpened(false);
1583
+ setIsFullScreen((current) => !current);
1584
+ };
1585
+ return (jsx(Tooltip, { label: title !== null && title !== void 0 ? title : toggleFullScreen, opened: tooltipOpened, withinPortal: true, children: jsx(ActionIcon, Object.assign({ "aria-label": title !== null && title !== void 0 ? title : toggleFullScreen, color: "gray", onClick: handleToggleFullScreen, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false), size: "lg", variant: "subtle" }, rest, { children: isFullScreen ? jsx(IconMinimize, {}) : jsx(IconMaximize, {}) })) }));
1586
+ };
1587
+
1588
+ const MRT_ToggleGlobalFilterButton = (_a) => {
1589
+ var { table: { getState, options: { icons: { IconSearch, IconSearchOff }, localization: { showHideSearch }, }, refs: { searchInputRef }, setShowGlobalFilter, }, title } = _a, rest = __rest(_a, ["table", "title"]);
1590
+ const { globalFilter, showGlobalFilter } = getState();
1591
+ const handleToggleSearch = () => {
1592
+ setShowGlobalFilter(!showGlobalFilter);
1593
+ setTimeout(() => { var _a; return (_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); }, 100);
1594
+ };
1595
+ return (jsx(Tooltip, { label: title !== null && title !== void 0 ? title : showHideSearch, withinPortal: true, children: jsx(ActionIcon, Object.assign({ "aria-label": title !== null && title !== void 0 ? title : showHideSearch, color: "gray", disabled: !!globalFilter, onClick: handleToggleSearch, size: "lg", variant: "subtle" }, rest, { children: showGlobalFilter ? jsx(IconSearchOff, {}) : jsx(IconSearch, {}) })) }));
1596
+ };
1597
+
1598
+ const MRT_RowActionMenu = (_a) => {
1599
+ var { handleEdit, row, table } = _a, rest = __rest(_a, ["handleEdit", "row", "table"]);
1600
+ const { options: { editDisplayMode, enableEditing, icons: { IconDots, IconEdit }, localization, positionActionsColumn, renderRowActionMenuItems, }, } = table;
1601
+ return (jsxs(Menu, { closeOnItemClick: true, position: positionActionsColumn === 'first'
1602
+ ? 'bottom-start'
1603
+ : positionActionsColumn === 'last'
1604
+ ? 'bottom-end'
1605
+ : undefined, withinPortal: true, children: [jsx(Tooltip, { label: localization.rowActions, openDelay: 1000, withinPortal: true, children: jsx(Menu.Target, { children: jsx(ActionIcon, Object.assign({ "aria-label": localization.rowActions, color: "gray", onClick: (event) => event.stopPropagation(), size: "sm", variant: "subtle" }, rest, { children: jsx(IconDots, {}) })) }) }), jsxs(Menu.Dropdown, { onClick: (event) => event.stopPropagation(), children: [enableEditing && editDisplayMode !== 'table' && (jsx(Menu.Item, { leftSection: jsx(IconEdit, {}), onClick: handleEdit, children: localization.edit })), renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 : renderRowActionMenuItems({
1606
+ row,
1607
+ table,
1608
+ })] })] }));
1609
+ };
1610
+
1611
+ const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
1612
+ const { getState, options: { createDisplayMode, editDisplayMode, enableEditing, icons: { IconEdit }, localization: { edit }, renderRowActionMenuItems, renderRowActions, }, setEditingRow, } = table;
1613
+ const { creatingRow, editingRow } = getState();
1614
+ const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
1615
+ const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
1616
+ const handleStartEditMode = (event) => {
1617
+ event.stopPropagation();
1618
+ setEditingRow(Object.assign({}, row));
1619
+ };
1620
+ const showEditActionButtons = (isCreating && createDisplayMode === 'row') ||
1621
+ (isEditing && editDisplayMode === 'row');
1622
+ return (jsx(Fragment, { children: renderRowActions && !showEditActionButtons ? (renderRowActions({ cell, row, table })) : showEditActionButtons ? (jsx(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems &&
1623
+ parseFromValuesOrFunc(enableEditing, row) ? (jsx(Tooltip, { label: edit, openDelay: 1000, position: "right", withinPortal: true, children: jsx(ActionIcon, { "aria-label": edit, color: "gray", disabled: !!editingRow && editingRow.id !== row.id, onClick: handleStartEditMode, size: "md", variant: "subtle", children: jsx(IconEdit, {}) }) })) : renderRowActionMenuItems ? (jsx(MRT_RowActionMenu, { handleEdit: handleStartEditMode, row: row, table: table })) : null }));
1624
+ };
1625
+
1626
+ var classes$q = {"root":"MRT_TableFooter-module_root__-JXpw","grid":"MRT_TableFooter-module_grid__J3Ga-","sticky":"MRT_TableFooter-module_sticky__GcoK6"};
1627
+
1628
+ var classes$p = {"root":"MRT_TableFooterRow-module_root__EuoPr","layout-mode-grid":"MRT_TableFooterRow-module_layout-mode-grid__dUEMF"};
1629
+
1630
+ var classes$o = {"root":"MRT_TableFooterCell-module_root__d8Scs","grid":"MRT_TableFooterCell-module_grid__H9jLk","group":"MRT_TableFooterCell-module_group__l3-p-"};
1631
+
1632
+ const MRT_TableFooterCell = (_a) => {
1633
+ var _b, _c, _d, _e, _f;
1634
+ var { footer: footerProp, renderedColumnIndex, table } = _a, rest = __rest(_a, ["footer", "renderedColumnIndex", "table"]);
1635
+ //a view has a new identity per table reference, which compiled render callbacks need
1636
+ const footer = getMRT_HeaderView(table, footerProp);
1637
+ const direction = useDirection();
1638
+ const { options: { enableColumnPinning, layoutMode, mantineTableFooterCellProps }, } = table;
1639
+ const { column } = footer;
1640
+ const { columnDef } = column;
1641
+ const { columnDefType } = columnDef;
1642
+ const isColumnPinned = enableColumnPinning &&
1643
+ columnDef.columnDefType !== 'group' &&
1644
+ column.getIsPinned();
1645
+ const args = { column, table };
1646
+ const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineTableFooterCellProps, args)), parseFromValuesOrFunc(columnDef.mantineTableFooterCellProps, args)), rest);
1647
+ const widthStyles = {
1648
+ minWidth: `max(calc(var(--header-${parseCSSVarId(footer === null || footer === void 0 ? void 0 : footer.id)}-size) * 1px), ${(_b = columnDef.minSize) !== null && _b !== void 0 ? _b : 30}px)`,
1649
+ width: `calc(var(--header-${parseCSSVarId(footer.id)}-size) * 1px)`,
1650
+ };
1651
+ if (layoutMode === 'grid') {
1652
+ widthStyles.flex = `${[0, false].includes(columnDef.grow)
1653
+ ? 0
1654
+ : `var(--header-${parseCSSVarId(footer.id)}-size)`} 0 auto`;
1655
+ }
1656
+ else if (layoutMode === 'grid-no-grow') {
1657
+ widthStyles.flex = `${+(columnDef.grow || 0)} 0 auto`;
1658
+ }
1659
+ return (jsx(TableTh, Object.assign({ colSpan: footer.colSpan, "data-column-pinned": isColumnPinned || undefined, "data-first-right-pinned": (isColumnPinned === 'right' &&
1660
+ column.getIsFirstColumn(isColumnPinned)) ||
1661
+ undefined, "data-index": renderedColumnIndex, "data-last-left-pinned": (isColumnPinned === 'left' && column.getIsLastColumn(isColumnPinned)) ||
1662
+ undefined }, tableCellProps, { __vars: Object.assign({ '--mrt-cell-align': (_c = tableCellProps.align) !== null && _c !== void 0 ? _c : (columnDefType === 'group'
1663
+ ? 'center'
1664
+ : direction.dir === 'rtl'
1665
+ ? 'right'
1666
+ : 'left'), '--mrt-table-cell-left': isColumnPinned === 'left'
1667
+ ? `${column.getStart(isColumnPinned)}`
1668
+ : undefined, '--mrt-table-cell-right': isColumnPinned === 'right'
1669
+ ? `${column.getAfter(isColumnPinned)}`
1670
+ : undefined }, tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.__vars), className: clsx(classes$o.root, (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) && classes$o.grid, columnDefType === 'group' && classes$o.group, tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.className), style: (theme) => (Object.assign(Object.assign({}, widthStyles), parseFromValuesOrFunc(tableCellProps.style, theme))), children: (_d = tableCellProps.children) !== null && _d !== void 0 ? _d : (footer.isPlaceholder
1671
+ ? null
1672
+ : ((_f = (_e = parseFromValuesOrFunc(columnDef.Footer, {
1673
+ column,
1674
+ footer,
1675
+ table,
1676
+ })) !== null && _e !== void 0 ? _e : columnDef.footer) !== null && _f !== void 0 ? _f : null)) })));
1677
+ };
1678
+
1679
+ const MRT_TableFooterRow = (_a) => {
1680
+ var _b, _c;
1681
+ var { columnVirtualizer, footerGroup, table } = _a, rest = __rest(_a, ["columnVirtualizer", "footerGroup", "table"]);
1682
+ const { options: { layoutMode, mantineTableFooterRowProps }, } = table;
1683
+ const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } = columnVirtualizer !== null && columnVirtualizer !== void 0 ? columnVirtualizer : {};
1684
+ // if no content in row, skip row
1685
+ if (!((_b = footerGroup.headers) === null || _b === void 0 ? void 0 : _b.some((header) => (typeof header.column.columnDef.footer === 'string' &&
1686
+ !!header.column.columnDef.footer) ||
1687
+ header.column.columnDef.Footer))) {
1688
+ return null;
1689
+ }
1690
+ const virtualGroupFooters = getVirtualGroupHeaders({
1691
+ headers: footerGroup.headers,
1692
+ table,
1693
+ virtualColumns,
1694
+ });
1695
+ const tableRowProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineTableFooterRowProps, {
1696
+ footerGroup,
1697
+ table,
1698
+ })), rest);
1699
+ return (jsxs(TableTr, Object.assign({ className: clsx(classes$p.root, (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) && classes$p['layout-mode-grid']) }, tableRowProps, { children: [virtualPaddingLeft ? (jsx(Box, { component: "th", display: "flex", w: virtualPaddingLeft })) : null, (_c = virtualGroupFooters === null || virtualGroupFooters === void 0 ? void 0 : virtualGroupFooters.map(({ header, index, style }) => (jsx(MRT_TableFooterCell, { footer: header, renderedColumnIndex: index, style: style, table: table }, header.id)))) !== null && _c !== void 0 ? _c : (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter, renderedColumnIndex) => {
1700
+ let footer = footerOrVirtualFooter;
1701
+ if (columnVirtualizer) {
1702
+ renderedColumnIndex = footerOrVirtualFooter
1703
+ .index;
1704
+ footer = footerGroup.headers[renderedColumnIndex];
1705
+ }
1706
+ return (jsx(MRT_TableFooterCell, { footer: footer, renderedColumnIndex: renderedColumnIndex, table: table }, footer.id));
1707
+ }), virtualPaddingRight ? (jsx(Box, { component: "th", display: "flex", w: virtualPaddingRight })) : null] })));
1708
+ };
1709
+
1710
+ const MRT_TableFooter = (_a) => {
1711
+ var { columnVirtualizer, table } = _a, rest = __rest(_a, ["columnVirtualizer", "table"]);
1712
+ const { getFooterGroups, getState, options: { enableStickyFooter, layoutMode, mantineTableFooterProps }, refs: { tableFooterRef }, } = table;
1713
+ const { isFullScreen } = getState();
1714
+ const tableFooterProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineTableFooterProps, {
1715
+ table,
1716
+ })), rest);
1717
+ const stickFooter = (isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
1718
+ return (jsx(TableTfoot, Object.assign({}, tableFooterProps, { className: clsx(classes$q.root, tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.className, stickFooter && classes$q.sticky, (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) && classes$q.grid), ref: (ref) => {
1719
+ tableFooterRef.current = ref;
1720
+ assignRef(tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.ref, ref);
1721
+ }, children: getFooterGroups().map((footerGroup) => (jsx(MRT_TableFooterRow, { columnVirtualizer: columnVirtualizer, footerGroup: footerGroup, table: table }, footerGroup.id))) })));
1722
+ };
1723
+
1724
+ var classes$n = {"root":"MRT_TableHead-module_root__j9NkO","root-grid":"MRT_TableHead-module_root-grid__c3aGl","root-table-row-group":"MRT_TableHead-module_root-table-row-group__d9FO4","root-sticky":"MRT_TableHead-module_root-sticky__0kuDE","banner-tr":"MRT_TableHead-module_banner-tr__EhT-x","banner-th":"MRT_TableHead-module_banner-th__KwM5a","grid":"MRT_TableHead-module_grid__OJ-td"};
1725
+
1726
+ var classes$m = {"root":"MRT_TableHeadRow-module_root__hUKv4","layout-mode-grid":"MRT_TableHeadRow-module_layout-mode-grid__4ZGri","sticky":"MRT_TableHeadRow-module_sticky__Ej7Ax"};
1727
+
1728
+ var classes$l = {"root":"MRT_TableHeadCell-module_root__6y50a","root-grid":"MRT_TableHeadCell-module_root-grid__bAf1d","root-virtualized":"MRT_TableHeadCell-module_root-virtualized__CWLit","root-no-select":"MRT_TableHeadCell-module_root-no-select__BEOVU","content":"MRT_TableHeadCell-module_content__-pzSK","content-spaced":"MRT_TableHeadCell-module_content-spaced__S85Aa","content-center":"MRT_TableHeadCell-module_content-center__c-17L","content-right":"MRT_TableHeadCell-module_content-right__NSRZU","content-wrapper":"MRT_TableHeadCell-module_content-wrapper__py6aJ","content-wrapper-hidden-overflow":"MRT_TableHeadCell-module_content-wrapper-hidden-overflow__QY40r","content-wrapper-nowrap":"MRT_TableHeadCell-module_content-wrapper-nowrap__-4aIg","labels":"MRT_TableHeadCell-module_labels__oiMSr","labels-right":"MRT_TableHeadCell-module_labels-right__6ZJp-","labels-center":"MRT_TableHeadCell-module_labels-center__MM9q8","labels-sortable":"MRT_TableHeadCell-module_labels-sortable__tyuLr","labels-data":"MRT_TableHeadCell-module_labels-data__PvFGO","content-actions":"MRT_TableHeadCell-module_content-actions__utxbm"};
1729
+
1730
+ var classes$k = {"filter-mode-label":"MRT_TableHeadCellFilterContainer-module_filter-mode-label__8reK-"};
1731
+
1732
+ //the multi-select filter input clears itself to an empty array, which must remove the filter like '' does
1733
+ const isBlankFilterValue = (val) => !val || (Array.isArray(val) && !val.length);
1734
+ /**
1735
+ * Mantine 8+ date inputs emit 'YYYY-MM-DD' strings. When the cell value is a
1736
+ * Date, the filter value is read as a Date at local midnight, so the two
1737
+ * compare as dates and not as text.
1738
+ */
1739
+ const getDateFilterValue = (cellValue, filterValue) => {
1740
+ if (!(cellValue instanceof Date))
1741
+ return undefined;
1742
+ if (filterValue instanceof Date)
1743
+ return filterValue;
1744
+ if (typeof filterValue !== 'string' || !filterValue)
1745
+ return undefined;
1746
+ const date = new Date(filterValue.includes('T') ? filterValue : `${filterValue}T00:00:00`);
1747
+ return isNaN(+date) ? undefined : date;
1748
+ };
1749
+ //a date filter picks a day, so dates compare by their local day and not by time
1750
+ const getDay = (date) => new Date(date).setHours(0, 0, 0, 0);
1751
+ const fuzzy = (row, columnId, filterValue, addMeta) => {
1752
+ const itemRank = rankItem(row.getValue(columnId), filterValue, {
1753
+ threshold: rankings.MATCHES,
1754
+ });
1755
+ addMeta(itemRank);
1756
+ return itemRank.passed;
1757
+ };
1758
+ fuzzy.autoRemove = isBlankFilterValue;
1759
+ const contains = (row, id, filterValue) => {
1760
+ var _a;
1761
+ return (_a = row
1762
+ .getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase().trim().includes(filterValue.toString().toLowerCase().trim());
1763
+ };
1764
+ contains.autoRemove = isBlankFilterValue;
1765
+ const startsWith = (row, id, filterValue) => {
1766
+ var _a;
1767
+ return (_a = row
1768
+ .getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase().trim().startsWith(filterValue.toString().toLowerCase().trim());
1769
+ };
1770
+ startsWith.autoRemove = isBlankFilterValue;
1771
+ const endsWith = (row, id, filterValue) => {
1772
+ var _a;
1773
+ return (_a = row
1774
+ .getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase().trim().endsWith(filterValue.toString().toLowerCase().trim());
1775
+ };
1776
+ endsWith.autoRemove = isBlankFilterValue;
1777
+ const equals = (row, id, filterValue) => {
1778
+ var _a;
1779
+ const dateFilterValue = getDateFilterValue(row.getValue(id), filterValue);
1780
+ if (dateFilterValue) {
1781
+ return getDay(row.getValue(id)) === getDay(dateFilterValue);
1782
+ }
1783
+ return (((_a = row.getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase().trim()) ===
1784
+ (filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString().toLowerCase().trim()));
1785
+ };
1786
+ equals.autoRemove = isBlankFilterValue;
1787
+ const notEquals = (row, id, filterValue) => !equals(row, id, filterValue);
1788
+ notEquals.autoRemove = isBlankFilterValue;
1789
+ const greaterThan = (row, id, rawFilterValue) => {
1790
+ var _a;
1791
+ const dateFilterValue = getDateFilterValue(row.getValue(id), rawFilterValue);
1792
+ if (dateFilterValue) {
1793
+ return getDay(row.getValue(id)) > getDay(dateFilterValue);
1794
+ }
1795
+ const filterValue = rawFilterValue;
1796
+ return !isNaN(+filterValue) && !isNaN(+row.getValue(id))
1797
+ ? +row.getValue(id) > +filterValue
1798
+ : ((_a = row.getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase().trim()) >
1799
+ (filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString().toLowerCase().trim());
1800
+ };
1801
+ greaterThan.autoRemove = isBlankFilterValue;
1802
+ const greaterThanOrEqualTo = (row, id, filterValue) => equals(row, id, filterValue) || greaterThan(row, id, filterValue);
1803
+ greaterThanOrEqualTo.autoRemove = isBlankFilterValue;
1804
+ const lessThan = (row, id, rawFilterValue) => {
1805
+ var _a;
1806
+ const dateFilterValue = getDateFilterValue(row.getValue(id), rawFilterValue);
1807
+ if (dateFilterValue) {
1808
+ return getDay(row.getValue(id)) < getDay(dateFilterValue);
1809
+ }
1810
+ const filterValue = rawFilterValue;
1811
+ return !isNaN(+filterValue) && !isNaN(+row.getValue(id))
1812
+ ? +row.getValue(id) < +filterValue
1813
+ : ((_a = row.getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase().trim()) <
1814
+ (filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString().toLowerCase().trim());
1815
+ };
1816
+ lessThan.autoRemove = isBlankFilterValue;
1817
+ const lessThanOrEqualTo = (row, id, filterValue) => equals(row, id, filterValue) || lessThan(row, id, filterValue);
1818
+ lessThanOrEqualTo.autoRemove = isBlankFilterValue;
1819
+ const between = (row, id, filterValues) => (['', undefined].includes(filterValues[0]) ||
1820
+ greaterThan(row, id, filterValues[0])) &&
1821
+ ((!isNaN(+filterValues[0]) &&
1822
+ !isNaN(+filterValues[1]) &&
1823
+ +filterValues[0] > +filterValues[1]) ||
1824
+ ['', undefined].includes(filterValues[1]) ||
1825
+ lessThan(row, id, filterValues[1]));
1826
+ between.autoRemove = isBlankFilterValue;
1827
+ const betweenInclusive = (row, id, filterValues) => (['', undefined].includes(filterValues[0]) ||
1828
+ greaterThanOrEqualTo(row, id, filterValues[0])) &&
1829
+ ((!isNaN(+filterValues[0]) &&
1830
+ !isNaN(+filterValues[1]) &&
1831
+ +filterValues[0] > +filterValues[1]) ||
1832
+ ['', undefined].includes(filterValues[1]) ||
1833
+ lessThanOrEqualTo(row, id, filterValues[1]));
1834
+ betweenInclusive.autoRemove = isBlankFilterValue;
1835
+ const empty = (row, id, _filterValue) => { var _a; return !((_a = row.getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().trim()); };
1836
+ empty.autoRemove = isBlankFilterValue;
1837
+ const notEmpty = (row, id, _filterValue) => { var _a; return !!((_a = row.getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().trim()); };
1838
+ notEmpty.autoRemove = isBlankFilterValue;
1839
+ const MRT_FilterFns = Object.assign(Object.assign({}, filterFns), { between,
1840
+ betweenInclusive,
1841
+ contains,
1842
+ empty,
1843
+ endsWith,
1844
+ equals,
1845
+ fuzzy,
1846
+ greaterThan,
1847
+ greaterThanOrEqualTo,
1848
+ lessThan,
1849
+ lessThanOrEqualTo,
1850
+ notEmpty,
1851
+ notEquals,
1852
+ startsWith });
1853
+ function localizedFilterOption(localization, option) {
1854
+ var _a;
1855
+ if (!option) {
1856
+ return '';
1857
+ }
1858
+ const key = `filter${option[0].toUpperCase()}${option.slice(1)}`;
1859
+ return (_a = localization[key]) !== null && _a !== void 0 ? _a : '';
1860
+ }
1861
+
1862
+ var classes$j = {"root":"MRT_FilterCheckBox-module_root__59h9r"};
1863
+
1864
+ const MRT_FilterCheckbox = (_a) => {
1865
+ var _b, _c, _d;
1866
+ var { column, table } = _a, rest = __rest(_a, ["column", "table"]);
1867
+ const { getState, options: { localization, mantineFilterCheckboxProps }, } = table;
1868
+ const { density } = getState();
1869
+ const { columnDef } = column;
1870
+ const arg = { column, table };
1871
+ const checkboxProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineFilterCheckboxProps, arg)), parseFromValuesOrFunc(columnDef.mantineFilterCheckboxProps, arg)), rest);
1872
+ const filterLabel = (_b = localization.filterByColumn) === null || _b === void 0 ? void 0 : _b.replace('{column}', columnDef.header);
1873
+ const value = column.getFilterValue();
1874
+ return (jsx(Tooltip, { label: (_c = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _c !== void 0 ? _c : filterLabel, openDelay: 1000, withinPortal: true, children: jsx(Checkbox, Object.assign({ checked: value === 'true', className: clsx('mrt-filter-checkbox', classes$j.root), indeterminate: value === undefined, label: (_d = checkboxProps.title) !== null && _d !== void 0 ? _d : filterLabel, size: density === 'xs' ? 'sm' : 'md' }, checkboxProps, { onChange: (e) => {
1875
+ var _a;
1876
+ column.setFilterValue(column.getFilterValue() === undefined
1877
+ ? 'true'
1878
+ : column.getFilterValue() === 'true'
1879
+ ? 'false'
1880
+ : undefined);
1881
+ (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onChange) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
1882
+ }, onClick: (e) => {
1883
+ var _a;
1884
+ e.stopPropagation();
1885
+ (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
1886
+ }, title: undefined })) }));
1887
+ };
1888
+
1889
+ var classes$i = {"root":"MRT_FilterRangeFields-module_root__KfCcg"};
1890
+
1891
+ var classes$h = {"root":"MRT_FilterTextInput-module_root__Ss8Ql","date-filter":"MRT_FilterTextInput-module_date-filter__jOBLB","range-filter":"MRT_FilterTextInput-module_range-filter__JQHAL","not-filter-chip":"MRT_FilterTextInput-module_not-filter-chip__u8b1y","filter-chip-badge":"MRT_FilterTextInput-module_filter-chip-badge__Sel2k"};
1892
+
1893
+ const MRT_FilterTextInput = (_a) => {
1894
+ var _b, _c, _d, _e, _f, _g, _h, _j;
1895
+ var { header, rangeFilterIndex, table } = _a, rest = __rest(_a, ["header", "rangeFilterIndex", "table"]);
1896
+ const { options: { columnFilterDisplayMode, columnFilterModeOptions, icons: { IconX }, localization, mantineFilterAutocompleteProps, mantineFilterDateInputProps, mantineFilterMultiSelectProps = {
1897
+ clearable: true,
1898
+ }, mantineFilterSelectProps, mantineFilterTextInputProps, manualFiltering, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
1899
+ const { column } = header;
1900
+ const { columnDef } = column;
1901
+ const arg = { column, rangeFilterIndex, table };
1902
+ const textInputProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineFilterTextInputProps, arg)), parseFromValuesOrFunc(columnDef.mantineFilterTextInputProps, arg)), rest);
1903
+ const selectProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineFilterSelectProps, arg)), parseFromValuesOrFunc(columnDef.mantineFilterSelectProps, arg));
1904
+ const multiSelectProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineFilterMultiSelectProps, arg)), parseFromValuesOrFunc(columnDef.mantineFilterMultiSelectProps, arg));
1905
+ const dateInputProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineFilterDateInputProps, arg)), parseFromValuesOrFunc(columnDef.mantineFilterDateInputProps, arg));
1906
+ const autoCompleteProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineFilterAutocompleteProps, arg)), parseFromValuesOrFunc(columnDef.mantineFilterAutocompleteProps, arg));
1907
+ const isRangeFilter = columnDef.filterVariant === 'range' ||
1908
+ columnDef.filterVariant === 'date-range' ||
1909
+ rangeFilterIndex !== undefined;
1910
+ const isSelectFilter = columnDef.filterVariant === 'select';
1911
+ const isMultiSelectFilter = columnDef.filterVariant === 'multi-select';
1912
+ const isDateFilter = columnDef.filterVariant === 'date' ||
1913
+ columnDef.filterVariant === 'date-range';
1914
+ const isAutoCompleteFilter = columnDef.filterVariant === 'autocomplete';
1915
+ const allowedColumnFilterOptions = (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _b !== void 0 ? _b : columnFilterModeOptions;
1916
+ const currentFilterOption = columnDef._filterFn;
1917
+ const filterChipLabel = ['empty', 'notEmpty'].includes(currentFilterOption)
1918
+ ? localizedFilterOption(localization, currentFilterOption)
1919
+ : '';
1920
+ const filterPlaceholder = !isRangeFilter
1921
+ ? ((_c = textInputProps === null || textInputProps === void 0 ? void 0 : textInputProps.placeholder) !== null && _c !== void 0 ? _c : (_d = localization.filterByColumn) === null || _d === void 0 ? void 0 : _d.replace('{column}', String(columnDef.header)))
1922
+ : rangeFilterIndex === 0
1923
+ ? localization.min
1924
+ : rangeFilterIndex === 1
1925
+ ? localization.max
1926
+ : '';
1927
+ const facetedUniqueValues = column.getFacetedUniqueValues();
1928
+ const filterSelectOptions = useMemo(() => {
1929
+ var _a, _b, _c;
1930
+ return ((_c = (_b = (_a = autoCompleteProps === null || autoCompleteProps === void 0 ? void 0 : autoCompleteProps.data) !== null && _a !== void 0 ? _a : selectProps === null || selectProps === void 0 ? void 0 : selectProps.data) !== null && _b !== void 0 ? _b : multiSelectProps === null || multiSelectProps === void 0 ? void 0 : multiSelectProps.data) !== null && _c !== void 0 ? _c : ((isAutoCompleteFilter || isSelectFilter || isMultiSelectFilter) &&
1931
+ facetedUniqueValues
1932
+ ? Array.from(facetedUniqueValues.keys())
1933
+ .filter((key) => key !== null)
1934
+ .sort((a, b) => a.localeCompare(b))
1935
+ : []))
1936
+ //@ts-ignore
1937
+ .filter((o) => o !== undefined && o !== null);
1938
+ }, [
1939
+ autoCompleteProps === null || autoCompleteProps === void 0 ? void 0 : autoCompleteProps.data,
1940
+ facetedUniqueValues,
1941
+ isAutoCompleteFilter,
1942
+ isMultiSelectFilter,
1943
+ isSelectFilter,
1944
+ multiSelectProps === null || multiSelectProps === void 0 ? void 0 : multiSelectProps.data,
1945
+ selectProps === null || selectProps === void 0 ? void 0 : selectProps.data,
1946
+ ]);
1947
+ const isMounted = useRef(false);
1948
+ const [filterValue, setFilterValue] = useState(() => {
1949
+ var _a, _b;
1950
+ return isMultiSelectFilter
1951
+ ? column.getFilterValue() || []
1952
+ : isRangeFilter
1953
+ ? ((_a = column.getFilterValue()) === null || _a === void 0 ? void 0 : _a[rangeFilterIndex]) || ''
1954
+ : ((_b = column.getFilterValue()) !== null && _b !== void 0 ? _b : '');
1955
+ });
1956
+ //the range value of this input that the table last held. The other range input
1957
+ //changes the same filter array, and that must not reset text typed here.
1958
+ const tableRangeValue = useRef(isRangeFilter ? filterValue : '');
1959
+ //send filterValue to the table instance once typing pauses. The timer restarts
1960
+ //on every change, so text retyped right after a clear is sent again.
1961
+ useEffect(() => {
1962
+ if (!isMounted.current)
1963
+ return;
1964
+ const timeout = setTimeout(() => {
1965
+ if (isRangeFilter) {
1966
+ column.setFilterValue((old) => {
1967
+ const newFilterValues = Array.isArray(old) ? [...old] : ['', '']; //a copy: the previous filter value is table state
1968
+ newFilterValues[rangeFilterIndex] = filterValue;
1969
+ return newFilterValues;
1970
+ });
1971
+ }
1972
+ else {
1973
+ column.setFilterValue(filterValue !== null && filterValue !== void 0 ? filterValue : undefined);
1974
+ }
1975
+ }, manualFiltering ? 400 : 200);
1976
+ return () => clearTimeout(timeout);
1977
+ }, [filterValue]);
1978
+ //receive table filter value and set it to local state
1979
+ useEffect(() => {
1980
+ var _a;
1981
+ if (!isMounted.current) {
1982
+ isMounted.current = true;
1983
+ return;
1984
+ }
1985
+ const tableFilterValue = column.getFilterValue();
1986
+ if (tableFilterValue === undefined) {
1987
+ tableRangeValue.current = '';
1988
+ handleClear();
1989
+ }
1990
+ else if (isRangeFilter && rangeFilterIndex !== undefined) {
1991
+ const next = (_a = (tableFilterValue !== null && tableFilterValue !== void 0 ? tableFilterValue : ['', ''])[rangeFilterIndex]) !== null && _a !== void 0 ? _a : '';
1992
+ if (next !== tableRangeValue.current) {
1993
+ tableRangeValue.current = next;
1994
+ setFilterValue(next);
1995
+ }
1996
+ }
1997
+ else {
1998
+ setFilterValue(tableFilterValue !== null && tableFilterValue !== void 0 ? tableFilterValue : '');
1999
+ }
2000
+ }, [column.getFilterValue()]);
2001
+ const handleClear = () => {
2002
+ if (isMultiSelectFilter) {
2003
+ setFilterValue([]);
2004
+ column.setFilterValue([]);
2005
+ }
2006
+ else if (isRangeFilter) {
2007
+ setFilterValue('');
2008
+ column.setFilterValue((old) => {
2009
+ const newFilterValues = Array.isArray(old) ? [...old] : ['', '']; //a copy: the previous filter value is table state
2010
+ newFilterValues[rangeFilterIndex] = undefined;
2011
+ return newFilterValues;
2012
+ });
2013
+ // This is from Mantine v6 but it also applies for v7
2014
+ // https://github.com/mantinedev/mantine/issues/4716#issuecomment-1702699688
2015
+ }
2016
+ else if (isSelectFilter) {
2017
+ setFilterValue(null);
2018
+ column.setFilterValue(null);
2019
+ }
2020
+ else {
2021
+ setFilterValue('');
2022
+ column.setFilterValue(undefined);
2023
+ }
2024
+ };
2025
+ const handleClearEmptyFilterChip = () => {
2026
+ if (isMultiSelectFilter) {
2027
+ setFilterValue([]);
2028
+ column.setFilterValue([]);
2029
+ }
2030
+ else {
2031
+ setFilterValue('');
2032
+ column.setFilterValue(undefined);
2033
+ }
2034
+ setColumnFilterFns((prev) => {
2035
+ var _a;
2036
+ return (Object.assign(Object.assign({}, prev), { [header.id]: (_a = allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions[0]) !== null && _a !== void 0 ? _a : 'fuzzy' }));
2037
+ });
2038
+ };
2039
+ const _k = {
2040
+ 'aria-label': filterPlaceholder,
2041
+ className: clsx('mrt-filter-text-input', classes$h.root, isDateFilter
2042
+ ? classes$h['date-filter']
2043
+ : isRangeFilter
2044
+ ? classes$h['range-filter']
2045
+ : !filterChipLabel && classes$h['not-filter-chip']),
2046
+ disabled: !!filterChipLabel,
2047
+ onChange: setFilterValue,
2048
+ onClick: (event) => event.stopPropagation(),
2049
+ placeholder: filterPlaceholder,
2050
+ style: Object.assign({}, (isMultiSelectFilter
2051
+ ? multiSelectProps === null || multiSelectProps === void 0 ? void 0 : multiSelectProps.style
2052
+ : isSelectFilter
2053
+ ? selectProps === null || selectProps === void 0 ? void 0 : selectProps.style
2054
+ : isDateFilter
2055
+ ? dateInputProps === null || dateInputProps === void 0 ? void 0 : dateInputProps.style
2056
+ : textInputProps === null || textInputProps === void 0 ? void 0 : textInputProps.style)),
2057
+ title: filterPlaceholder,
2058
+ value: isMultiSelectFilter && !Array.isArray(filterValue) ? [] : filterValue,
2059
+ variant: 'unstyled',
2060
+ }, { className } = _k, commonProps = __rest(_k, ["className"]);
2061
+ const ClearButton = filterValue ? (jsx(ActionIcon, { "aria-label": localization.clearFilter, color: "var(--mantine-color-gray-7)", onClick: handleClear, size: "sm", title: (_e = localization.clearFilter) !== null && _e !== void 0 ? _e : '', variant: "transparent", children: jsx(IconX, {}) })) : null;
2062
+ if (columnDef.Filter) {
2063
+ return (jsx(Fragment, { children: (_f = columnDef.Filter) === null || _f === void 0 ? void 0 : _f.call(columnDef, { column, header, rangeFilterIndex, table }) }));
2064
+ }
2065
+ if (filterChipLabel) {
2066
+ return (jsx(Box, { style: commonProps.style, children: jsx(Badge, { className: classes$h['filter-chip-badge'], onClick: handleClearEmptyFilterChip, rightSection: ClearButton, size: "lg", children: filterChipLabel }) }));
2067
+ }
2068
+ if (isMultiSelectFilter) {
2069
+ return (jsx(MultiSelect, Object.assign({}, commonProps, { searchable: true }, multiSelectProps, { className: clsx(className, multiSelectProps.className), data: filterSelectOptions, onChange: (value) => setFilterValue(value), ref: (node) => {
2070
+ if (node) {
2071
+ filterInputRefs.current[`${column.id}-${rangeFilterIndex !== null && rangeFilterIndex !== void 0 ? rangeFilterIndex : 0}`] =
2072
+ node;
2073
+ assignRef(multiSelectProps.ref, node);
2074
+ }
2075
+ }, rightSection: ((_g = filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString()) === null || _g === void 0 ? void 0 : _g.length) && (multiSelectProps === null || multiSelectProps === void 0 ? void 0 : multiSelectProps.clearable)
2076
+ ? ClearButton
2077
+ : undefined, style: commonProps.style })));
2078
+ }
2079
+ if (isSelectFilter) {
2080
+ return (jsx(Select, Object.assign({}, commonProps, { clearable: true, searchable: true }, selectProps, { className: clsx(className, selectProps.className), clearButtonProps: {
2081
+ size: 'md',
2082
+ }, data: filterSelectOptions, ref: (node) => {
2083
+ if (node) {
2084
+ filterInputRefs.current[`${column.id}-${rangeFilterIndex !== null && rangeFilterIndex !== void 0 ? rangeFilterIndex : 0}`] =
2085
+ node;
2086
+ assignRef(selectProps.ref, node);
2087
+ }
2088
+ }, style: commonProps.style })));
2089
+ }
2090
+ if (isDateFilter) {
2091
+ return (jsx(DateInput, Object.assign({}, commonProps, { allowDeselect: true, clearable: true, popoverProps: { withinPortal: columnFilterDisplayMode !== 'popover' } }, dateInputProps, { className: clsx(className, dateInputProps.className), onChange: (event) => commonProps.onChange(event === null ? '' : event), ref: (node) => {
2092
+ if (node) {
2093
+ filterInputRefs.current[`${column.id}-${rangeFilterIndex !== null && rangeFilterIndex !== void 0 ? rangeFilterIndex : 0}`] =
2094
+ node;
2095
+ assignRef(dateInputProps.ref, node);
2096
+ }
2097
+ }, style: commonProps.style })));
2098
+ }
2099
+ if (isAutoCompleteFilter) {
2100
+ return (jsx(Autocomplete, Object.assign({}, commonProps, { onChange: (value) => setFilterValue(value), rightSection: ((_h = filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString()) === null || _h === void 0 ? void 0 : _h.length) ? ClearButton : undefined }, autoCompleteProps, { className: clsx(className, autoCompleteProps.className), data: filterSelectOptions, ref: (node) => {
2101
+ if (node) {
2102
+ filterInputRefs.current[`${column.id}-${rangeFilterIndex !== null && rangeFilterIndex !== void 0 ? rangeFilterIndex : 0}`] =
2103
+ node;
2104
+ assignRef(autoCompleteProps.ref, node);
2105
+ }
2106
+ }, style: commonProps.style })));
2107
+ }
2108
+ return (jsx(TextInput, Object.assign({}, commonProps, { onChange: (e) => setFilterValue(e.target.value), rightSection: ((_j = filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString()) === null || _j === void 0 ? void 0 : _j.length) ? ClearButton : undefined }, textInputProps, { className: clsx(className, textInputProps.className), mt: 0, ref: (node) => {
2109
+ if (node) {
2110
+ filterInputRefs.current[`${column.id}-${rangeFilterIndex !== null && rangeFilterIndex !== void 0 ? rangeFilterIndex : 0}`] =
2111
+ node;
2112
+ assignRef(textInputProps.ref, node);
2113
+ }
2114
+ }, style: commonProps.style })));
2115
+ };
2116
+
2117
+ const MRT_FilterRangeFields = (_a) => {
2118
+ var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
2119
+ return (jsxs(Box, Object.assign({}, rest, { className: clsx('mrt-filter-range-fields', classes$i.root, rest.className), children: [jsx(MRT_FilterTextInput, { header: header, rangeFilterIndex: 0, table: table }), jsx(MRT_FilterTextInput, { header: header, rangeFilterIndex: 1, table: table })] })));
2120
+ };
2121
+
2122
+ var classes$g = {"root":"MRT_FilterRangeSlider-module_root__uwYEk"};
2123
+
2124
+ const MRT_FilterRangeSlider = (_a) => {
2125
+ var _b;
2126
+ var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
2127
+ const { options: { mantineFilterRangeSliderProps }, refs: { filterInputRefs }, } = table;
2128
+ const { column } = header;
2129
+ const { columnDef } = column;
2130
+ const arg = { column, table };
2131
+ const rangeSliderProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineFilterRangeSliderProps, arg)), parseFromValuesOrFunc(columnDef.mantineFilterRangeSliderProps, arg)), rest);
2132
+ let [min, max] = rangeSliderProps.min !== undefined && rangeSliderProps.max !== undefined
2133
+ ? [rangeSliderProps.min, rangeSliderProps.max]
2134
+ : ((_b = column.getFacetedMinMaxValues()) !== null && _b !== void 0 ? _b : [0, 1]);
2135
+ //fix potential TanStack Table bugs where min or max is an array
2136
+ if (Array.isArray(min))
2137
+ min = min[0];
2138
+ if (Array.isArray(max))
2139
+ max = max[0];
2140
+ if (min === null)
2141
+ min = 0;
2142
+ if (max === null)
2143
+ max = 1;
2144
+ const [filterValues, setFilterValues] = useState([
2145
+ min,
2146
+ max,
2147
+ ]);
2148
+ const columnFilterValue = column.getFilterValue();
2149
+ const isMounted = useRef(false);
2150
+ useEffect(() => {
2151
+ if (isMounted.current) {
2152
+ if (columnFilterValue === undefined) {
2153
+ setFilterValues([min, max]);
2154
+ }
2155
+ else if (Array.isArray(columnFilterValue)) {
2156
+ setFilterValues(columnFilterValue);
2157
+ }
2158
+ }
2159
+ isMounted.current = true;
2160
+ }, [columnFilterValue, min, max]);
2161
+ return (jsx(RangeSlider, Object.assign({ className: clsx('mrt-filter-range-slider', classes$g.root), max: max, min: min, onChange: (values) => {
2162
+ setFilterValues(values);
2163
+ }, onChangeEnd: (values) => {
2164
+ if (Array.isArray(values)) {
2165
+ if (values[0] <= min && values[1] >= max) {
2166
+ //if the user has selected the entire range, remove the filter
2167
+ column.setFilterValue(undefined);
2168
+ }
2169
+ else {
2170
+ column.setFilterValue(values);
2171
+ }
2172
+ }
2173
+ }, value: filterValues }, rangeSliderProps, { ref: (node) => {
2174
+ if (node) {
2175
+ //@ts-ignore
2176
+ filterInputRefs.current[`${column.id}-0`] = node;
2177
+ // @ts-ignore
2178
+ if (rangeSliderProps === null || rangeSliderProps === void 0 ? void 0 : rangeSliderProps.ref) {
2179
+ //@ts-ignore
2180
+ rangeSliderProps.ref = node;
2181
+ }
2182
+ }
2183
+ } })));
2184
+ };
2185
+
2186
+ var classes$f = {"symbol":"MRT_FilterOptionMenu-module_symbol__a1Bsy"};
2187
+
2188
+ const mrtFilterOptions = (localization) => [
2189
+ {
2190
+ divider: false,
2191
+ label: localization.filterFuzzy,
2192
+ option: 'fuzzy',
2193
+ symbol: '≈',
2194
+ },
2195
+ {
2196
+ divider: false,
2197
+ label: localization.filterContains,
2198
+ option: 'contains',
2199
+ symbol: '*',
2200
+ },
2201
+ {
2202
+ divider: false,
2203
+ label: localization.filterStartsWith,
2204
+ option: 'startsWith',
2205
+ symbol: 'a',
2206
+ },
2207
+ {
2208
+ divider: true,
2209
+ label: localization.filterEndsWith,
2210
+ option: 'endsWith',
2211
+ symbol: 'z',
2212
+ },
2213
+ {
2214
+ divider: false,
2215
+ label: localization.filterEquals,
2216
+ option: 'equals',
2217
+ symbol: '=',
2218
+ },
2219
+ {
2220
+ divider: true,
2221
+ label: localization.filterNotEquals,
2222
+ option: 'notEquals',
2223
+ symbol: '≠',
2224
+ },
2225
+ {
2226
+ divider: false,
2227
+ label: localization.filterBetween,
2228
+ option: 'between',
2229
+ symbol: '⇿',
2230
+ },
2231
+ {
2232
+ divider: true,
2233
+ label: localization.filterBetweenInclusive,
2234
+ option: 'betweenInclusive',
2235
+ symbol: '⬌',
2236
+ },
2237
+ {
2238
+ divider: false,
2239
+ label: localization.filterGreaterThan,
2240
+ option: 'greaterThan',
2241
+ symbol: '>',
2242
+ },
2243
+ {
2244
+ divider: false,
2245
+ label: localization.filterGreaterThanOrEqualTo,
2246
+ option: 'greaterThanOrEqualTo',
2247
+ symbol: '≥',
2248
+ },
2249
+ {
2250
+ divider: false,
2251
+ label: localization.filterLessThan,
2252
+ option: 'lessThan',
2253
+ symbol: '<',
2254
+ },
2255
+ {
2256
+ divider: true,
2257
+ label: localization.filterLessThanOrEqualTo,
2258
+ option: 'lessThanOrEqualTo',
2259
+ symbol: '≤',
2260
+ },
2261
+ {
2262
+ divider: false,
2263
+ label: localization.filterEmpty,
2264
+ option: 'empty',
2265
+ symbol: '∅',
2266
+ },
2267
+ {
2268
+ divider: false,
2269
+ label: localization.filterNotEmpty,
2270
+ option: 'notEmpty',
2271
+ symbol: '!∅',
2272
+ },
2273
+ ];
2274
+ const defaultGlobalFilterModeOptions = ['fuzzy', 'contains', 'startsWith'];
2275
+ const rangeModes = ['between', 'betweenInclusive', 'inNumberRange'];
2276
+ const emptyModes = ['empty', 'notEmpty'];
2277
+ const arrModes = ['arrIncludesSome', 'arrIncludesAll', 'arrIncludes'];
2278
+ const rangeVariants = ['range-slider', 'date-range', 'range'];
2279
+ const MRT_FilterOptionMenu = ({ header, onSelect, table, }) => {
2280
+ var _a, _b, _c, _d;
2281
+ const { getState, options: { columnFilterModeOptions, globalFilterModeOptions, localization, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
2282
+ const { globalFilterFn } = getState();
2283
+ const { column } = header !== null && header !== void 0 ? header : {};
2284
+ const { columnDef } = column !== null && column !== void 0 ? column : {};
2285
+ const currentFilterValue = column === null || column === void 0 ? void 0 : column.getFilterValue();
2286
+ let allowedColumnFilterOptions = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _a !== void 0 ? _a : columnFilterModeOptions;
2287
+ if (rangeVariants.includes(columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant)) {
2288
+ allowedColumnFilterOptions = [
2289
+ ...rangeModes,
2290
+ ...(allowedColumnFilterOptions !== null && allowedColumnFilterOptions !== void 0 ? allowedColumnFilterOptions : []),
2291
+ ].filter((option) => rangeModes.includes(option));
2292
+ }
2293
+ const internalFilterOptions = useMemo(() => {
2294
+ const filterOptions = mrtFilterOptions(localization).filter((filterOption) => columnDef
2295
+ ? allowedColumnFilterOptions === undefined ||
2296
+ (allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.includes(filterOption.option))
2297
+ : (globalFilterModeOptions !== null && globalFilterModeOptions !== void 0 ? globalFilterModeOptions : defaultGlobalFilterModeOptions).includes(filterOption.option));
2298
+ if (filterOptions.length &&
2299
+ filterOptions[filterOptions.length - 1].divider) {
2300
+ filterOptions[filterOptions.length - 1].divider = false;
2301
+ }
2302
+ return filterOptions;
2303
+ }, [columnDef, globalFilterModeOptions]);
2304
+ const handleSelectFilterMode = (option) => {
2305
+ var _a;
2306
+ const prevFilterMode = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef._filterFn) !== null && _a !== void 0 ? _a : '';
2307
+ if (!header || !column) {
2308
+ // global filter mode
2309
+ setGlobalFilterFn(option);
2310
+ }
2311
+ else if (option !== prevFilterMode) {
2312
+ // column filter mode
2313
+ setColumnFilterFns((prev) => (Object.assign(Object.assign({}, prev), { [header.id]: option })));
2314
+ // reset filter value and/or perform new filter render
2315
+ if (emptyModes.includes(option)) {
2316
+ // will now be empty/notEmpty filter mode
2317
+ if (currentFilterValue !== ' ' &&
2318
+ !emptyModes.includes(prevFilterMode)) {
2319
+ column.setFilterValue(' ');
2320
+ }
2321
+ else if (currentFilterValue) {
2322
+ column.setFilterValue(currentFilterValue); // perform new filter render
2323
+ }
2324
+ }
2325
+ else if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'multi-select' ||
2326
+ arrModes.includes(option)) {
2327
+ // will now be array filter mode
2328
+ if (currentFilterValue instanceof String ||
2329
+ (currentFilterValue === null || currentFilterValue === void 0 ? void 0 : currentFilterValue.length)) {
2330
+ column.setFilterValue([]);
2331
+ }
2332
+ else if (currentFilterValue) {
2333
+ column.setFilterValue(currentFilterValue); // perform new filter render
2334
+ }
2335
+ }
2336
+ else if (rangeVariants.includes(columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) ||
2337
+ rangeModes.includes(option)) {
2338
+ // will now be range filter mode
2339
+ if (!Array.isArray(currentFilterValue) ||
2340
+ (!(currentFilterValue === null || currentFilterValue === void 0 ? void 0 : currentFilterValue.every((v) => v === '')) &&
2341
+ !rangeModes.includes(prevFilterMode))) {
2342
+ column.setFilterValue(['', '']);
2343
+ }
2344
+ else {
2345
+ column.setFilterValue(currentFilterValue); // perform new filter render
2346
+ }
2347
+ }
2348
+ else {
2349
+ // will now be single value filter mode
2350
+ if (Array.isArray(currentFilterValue)) {
2351
+ column.setFilterValue('');
2352
+ }
2353
+ else if (currentFilterValue === ' ' &&
2354
+ emptyModes.includes(prevFilterMode)) {
2355
+ column.setFilterValue(undefined);
2356
+ }
2357
+ else {
2358
+ column.setFilterValue(currentFilterValue); // perform new filter render
2359
+ }
2360
+ }
2361
+ }
2362
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect();
2363
+ };
2364
+ const filterOption = !!header && columnDef ? columnDef._filterFn : globalFilterFn;
2365
+ return (jsx(Menu.Dropdown, { children: (_d = (header && column && columnDef
2366
+ ? ((_c = (_b = columnDef.renderColumnFilterModeMenuItems) === null || _b === void 0 ? void 0 : _b.call(columnDef, {
2367
+ column: column,
2368
+ internalFilterOptions,
2369
+ onSelectFilterMode: handleSelectFilterMode,
2370
+ table,
2371
+ })) !== null && _c !== void 0 ? _c : renderColumnFilterModeMenuItems === null || renderColumnFilterModeMenuItems === void 0 ? void 0 : renderColumnFilterModeMenuItems({
2372
+ column: column,
2373
+ internalFilterOptions,
2374
+ onSelectFilterMode: handleSelectFilterMode,
2375
+ table,
2376
+ }))
2377
+ : renderGlobalFilterModeMenuItems === null || renderGlobalFilterModeMenuItems === void 0 ? void 0 : renderGlobalFilterModeMenuItems({
2378
+ internalFilterOptions,
2379
+ onSelectFilterMode: handleSelectFilterMode,
2380
+ table,
2381
+ }))) !== null && _d !== void 0 ? _d : internalFilterOptions.map(({ divider, label, option, symbol }, index) => (jsxs(Fragment$1, { children: [jsx(Menu.Item, { color: option === filterOption ? 'blue' : undefined, leftSection: jsx("span", { className: classes$f.symbol, children: symbol }), onClick: () => handleSelectFilterMode(option), value: option, children: label }), divider && jsx(Menu.Divider, {})] }, index))) }));
2382
+ };
2383
+
2384
+ const MRT_TableHeadCellFilterContainer = (_a) => {
2385
+ var _b, _c;
2386
+ var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
2387
+ const { getState, options: { columnFilterDisplayMode, columnFilterModeOptions, enableColumnFilterModes, icons: { IconFilterCog }, localization, }, refs: { filterInputRefs }, } = table;
2388
+ const { showColumnFilters } = getState();
2389
+ const { column } = header;
2390
+ const { columnDef } = column;
2391
+ const currentFilterOption = columnDef._filterFn;
2392
+ const allowedColumnFilterOptions = (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _b !== void 0 ? _b : columnFilterModeOptions;
2393
+ const showChangeModeButton = enableColumnFilterModes &&
2394
+ columnDef.enableColumnFilterModes !== false &&
2395
+ (allowedColumnFilterOptions === undefined ||
2396
+ !!(allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.length));
2397
+ return (jsx(Collapse, { expanded: showColumnFilters || columnFilterDisplayMode === 'popover', children: jsxs(Flex, Object.assign({ direction: "column" }, rest, { children: [jsxs(Flex, { align: "flex-end", children: [columnDef.filterVariant === 'checkbox' ? (jsx(MRT_FilterCheckbox, { column: column, table: table })) : columnDef.filterVariant === 'range-slider' ? (jsx(MRT_FilterRangeSlider, { header: header, table: table })) : ['date-range', 'range'].includes((_c = columnDef.filterVariant) !== null && _c !== void 0 ? _c : '') ||
2398
+ ['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn) ? (jsx(MRT_FilterRangeFields, { header: header, table: table })) : (jsx(MRT_FilterTextInput, { header: header, table: table })), showChangeModeButton && (jsxs(Menu, { withinPortal: columnFilterDisplayMode !== 'popover', children: [jsx(Tooltip, { label: localization.changeFilterMode, position: "bottom-start", withinPortal: true, children: jsx(Menu.Target, { children: jsx(ActionIcon, { "aria-label": localization.changeFilterMode, color: "gray", size: "md", variant: "subtle", children: jsx(IconFilterCog, {}) }) }) }), jsx(MRT_FilterOptionMenu, { header: header, onSelect: () => setTimeout(() => { var _a; return (_a = filterInputRefs.current[`${column.id}-0`]) === null || _a === void 0 ? void 0 : _a.focus(); }, 100), table: table })] }))] }), showChangeModeButton ? (jsx(Text, { c: "dimmed", className: classes$k['filter-mode-label'], component: "label", children: localization.filterMode.replace('{filterType}', localizedFilterOption(localization, currentFilterOption)) })) : null] })) }));
2399
+ };
2400
+
2401
+ var classes$e = {"root":"MRT_TableHeadCellFilterLabel-module_root__Rur2R"};
2402
+
2403
+ const MRT_TableHeadCellFilterLabel = (_a) => {
2404
+ var _b, _c, _d;
2405
+ var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
2406
+ const { options: { columnFilterDisplayMode, icons: { IconFilter }, localization, }, refs: { filterInputRefs }, setShowColumnFilters, } = table;
2407
+ const { column } = header;
2408
+ const { columnDef } = column;
2409
+ const filterValue = column.getFilterValue();
2410
+ const [popoverOpened, setPopoverOpened] = useState(false);
2411
+ const isFilterActive = (Array.isArray(filterValue) && filterValue.some(Boolean)) ||
2412
+ (!!filterValue && !Array.isArray(filterValue));
2413
+ const isRangeFilter = columnDef.filterVariant === 'range' ||
2414
+ columnDef.filterVariant === 'date-range' ||
2415
+ ['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn);
2416
+ const currentFilterOption = columnDef._filterFn;
2417
+ const filterValueFn = columnDef.filterTooltipValueFn || ((value) => value);
2418
+ const filterTooltip = columnFilterDisplayMode === 'popover' && !isFilterActive
2419
+ ? (_b = localization.filterByColumn) === null || _b === void 0 ? void 0 : _b.replace('{column}', String(columnDef.header))
2420
+ : localization.filteringByColumn
2421
+ .replace('{column}', String(columnDef.header))
2422
+ .replace('{filterType}', localizedFilterOption(localization, currentFilterOption))
2423
+ .replace('{filterValue}', `"${Array.isArray(column.getFilterValue())
2424
+ ? column.getFilterValue()
2425
+ .map((v) => filterValueFn(v))
2426
+ .join(`" ${isRangeFilter ? localization.and : localization.or} "`)
2427
+ : filterValueFn(column.getFilterValue())}"`)
2428
+ .replace('" "', '');
2429
+ return (jsx(Fragment, { children: jsxs(Popover, { keepMounted: columnDef.filterVariant === 'range-slider', onChange: setPopoverOpened, onClose: () => setPopoverOpened(false), opened: popoverOpened, position: "top", shadow: "xl", width: 360, withinPortal: true, children: [jsx(Transition, { mounted: columnFilterDisplayMode === 'popover' ||
2430
+ (!!column.getFilterValue() && !isRangeFilter) ||
2431
+ (isRangeFilter &&
2432
+ (!!((_c = column.getFilterValue()) === null || _c === void 0 ? void 0 : _c[0]) ||
2433
+ !!((_d = column.getFilterValue()) === null || _d === void 0 ? void 0 : _d[1]))), transition: "scale", children: () => (jsx(Popover.Target, { children: jsx(Tooltip, { disabled: popoverOpened, label: filterTooltip, multiline: true, w: filterTooltip.length > 40 ? 300 : undefined, withinPortal: true, children: jsx(ActionIcon, Object.assign({ "aria-label": filterTooltip, className: clsx('mrt-table-head-cell-filter-label-icon', classes$e.root), size: 18 }, dataVariable('active', isFilterActive), { onClick: (event) => {
2434
+ event.stopPropagation();
2435
+ if (columnFilterDisplayMode === 'popover') {
2436
+ setPopoverOpened((opened) => !opened);
2437
+ }
2438
+ else {
2439
+ setShowColumnFilters(true);
2440
+ }
2441
+ setTimeout(() => {
2442
+ const input = filterInputRefs.current[`${column.id}-0`];
2443
+ input === null || input === void 0 ? void 0 : input.focus();
2444
+ if (typeof (input === null || input === void 0 ? void 0 : input.select) === 'function') {
2445
+ input.select();
2446
+ }
2447
+ }, 100);
2448
+ } }, rest, { children: jsx(IconFilter, { size: "100%" }) })) }) })) }), columnFilterDisplayMode === 'popover' && (jsx(Popover.Dropdown, { onClick: (event) => event.stopPropagation(), onKeyDown: (event) => event.key === 'Enter' &&
2449
+ !event.nativeEvent.isComposing &&
2450
+ setPopoverOpened(false), onMouseDown: (event) => event.stopPropagation(), children: jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }) }))] }) }));
2451
+ };
2452
+
2453
+ const MRT_TableHeadCellGrabHandle = (_a) => {
2454
+ var { column, table, tableHeadCellRef } = _a, rest = __rest(_a, ["column", "table", "tableHeadCellRef"]);
2455
+ const { getState, options: { enableColumnOrdering, mantineColumnDragHandleProps }, setColumnOrder, setDraggingColumn, setHoveredColumn, } = table;
2456
+ const { columnDef } = column;
2457
+ const { columnOrder, draggingColumn, hoveredColumn } = getState();
2458
+ const arg = { column, table };
2459
+ const actionIconProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineColumnDragHandleProps, arg)), parseFromValuesOrFunc(columnDef.mantineColumnDragHandleProps, arg)), rest);
2460
+ const handleDragStart = (event) => {
2461
+ var _a;
2462
+ (_a = actionIconProps === null || actionIconProps === void 0 ? void 0 : actionIconProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(actionIconProps, event);
2463
+ setDraggingColumn(column);
2464
+ event.dataTransfer.setDragImage(tableHeadCellRef.current, 0, 0);
2465
+ };
2466
+ const handleDragEnd = (event) => {
2467
+ var _a;
2468
+ (_a = actionIconProps === null || actionIconProps === void 0 ? void 0 : actionIconProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(actionIconProps, event);
2469
+ if ((hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
2470
+ column.toggleGrouping();
2471
+ }
2472
+ else if (enableColumnOrdering &&
2473
+ hoveredColumn &&
2474
+ (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) !== (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id)) {
2475
+ setColumnOrder(reorderColumn(column, hoveredColumn, columnOrder));
2476
+ }
2477
+ setDraggingColumn(null);
2478
+ setHoveredColumn(null);
2479
+ };
2480
+ return (jsx(MRT_GrabHandleButton, { actionIconProps: actionIconProps, onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table }));
2481
+ };
2482
+
2483
+ var classes$d = {"root":"MRT_TableHeadCellResizeHandle-module_root__paufe","root-ltr":"MRT_TableHeadCellResizeHandle-module_root-ltr__652AZ","root-rtl":"MRT_TableHeadCellResizeHandle-module_root-rtl__5VlSo","root-hide":"MRT_TableHeadCellResizeHandle-module_root-hide__-ILlD"};
2484
+
2485
+ const MRT_TableHeadCellResizeHandle = (_a) => {
2486
+ var _b;
2487
+ var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
2488
+ const { getState, options: { columnResizeDirection, columnResizeMode }, setColumnSizingInfo, } = table;
2489
+ const { density } = getState();
2490
+ const { column } = header;
2491
+ const handler = header.getResizeHandler();
2492
+ const offset = column.getIsResizing() && columnResizeMode === 'onEnd'
2493
+ ? `translateX(${(columnResizeDirection === 'rtl' ? -1 : 1) *
2494
+ ((_b = getState().columnSizingInfo.deltaOffset) !== null && _b !== void 0 ? _b : 0)}px)`
2495
+ : undefined;
2496
+ return (jsx(Box, Object.assign({ onDoubleClick: () => {
2497
+ setColumnSizingInfo((old) => (Object.assign(Object.assign({}, old), { isResizingColumn: false })));
2498
+ column.resetSize();
2499
+ }, onMouseDown: handler, onTouchStart: handler, role: "separator" }, rest, { __vars: Object.assign({ '--mrt-transform': offset }, rest.__vars), className: clsx('mrt-table-head-cell-resize-handle', classes$d.root, classes$d[`root-${columnResizeDirection}`], !header.subHeaders.length &&
2500
+ columnResizeMode === 'onChange' &&
2501
+ classes$d['root-hide'], density, rest.className) })));
2502
+ };
2503
+
2504
+ var classes$c = {"sort-icon":"MRT_TableHeadCellSortLabel-module_sort-icon__zs1xA","multi-sort-indicator":"MRT_TableHeadCellSortLabel-module_multi-sort-indicator__MGBj2"};
2505
+
2506
+ const MRT_TableHeadCellSortLabel = (_a) => {
2507
+ var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
2508
+ const { getState, options: { icons: { IconArrowsSort, IconSortAscending, IconSortDescending }, localization, }, } = table;
2509
+ const column = header.column;
2510
+ const { columnDef } = column;
2511
+ const { sorting } = getState();
2512
+ const sorted = column.getIsSorted();
2513
+ const sortIndex = column.getSortIndex();
2514
+ const sortTooltip = sorted
2515
+ ? sorted === 'desc'
2516
+ ? localization.sortedByColumnDesc.replace('{column}', columnDef.header)
2517
+ : localization.sortedByColumnAsc.replace('{column}', columnDef.header)
2518
+ : column.getNextSortingOrder() === 'desc'
2519
+ ? localization.sortByColumnDesc.replace('{column}', columnDef.header)
2520
+ : localization.sortByColumnAsc.replace('{column}', columnDef.header);
2521
+ const SortActionButton = (jsx(ActionIcon, Object.assign({ "aria-label": sortTooltip }, dataVariable('sorted', sorted), rest, { className: clsx('mrt-table-head-sort-button', classes$c['sort-icon'], rest.className), children: sorted === 'desc' ? (jsx(IconSortDescending, { size: "100%" })) : sorted === 'asc' ? (jsx(IconSortAscending, { size: "100%" })) : (jsx(IconArrowsSort, { size: "100%" })) })));
2522
+ return (jsx(Tooltip, { label: sortTooltip, openDelay: 1000, withinPortal: true, children: sorting.length < 2 || sortIndex === -1 ? (SortActionButton) : (jsx(Indicator, { classNames: {
2523
+ root: clsx('mrt-table-head-multi-sort-indicator', classes$c['multi-sort-indicator']),
2524
+ }, inline: true, label: sortIndex + 1, offset: 4, children: SortActionButton })) }));
2525
+ };
2526
+
2527
+ var classes$b = {"left":"MRT_ColumnActionMenu-module_left__cfNmY","right":"MRT_ColumnActionMenu-module_right__-nK56"};
2528
+
2529
+ const MRT_ColumnActionMenu = (_a) => {
2530
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
2531
+ var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
2532
+ const { getState, options: { columnFilterDisplayMode, enableColumnFilters, enableColumnPinning, enableColumnResizing, enableGrouping, enableHiding, enableSorting, enableSortingRemoval, icons: { IconArrowAutofitContent, IconBoxMultiple, IconClearAll, IconColumns, IconDotsVertical, IconEyeOff, IconFilter, IconFilterOff, IconPinned, IconPinnedOff, IconSortAscending, IconSortDescending, }, localization, mantineColumnActionsButtonProps, renderColumnActionsMenuItems, }, refs: { filterInputRefs }, setColumnOrder, setColumnSizingInfo, setShowColumnFilters, toggleAllColumnsVisible, } = table;
2533
+ const { column } = header;
2534
+ const { columnDef } = column;
2535
+ const { columnSizing, columnVisibility } = getState();
2536
+ const arg = { column, table };
2537
+ const actionIconProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineColumnActionsButtonProps, arg)), parseFromValuesOrFunc(columnDef.mantineColumnActionsButtonProps, arg));
2538
+ const handleClearSort = () => {
2539
+ column.clearSorting();
2540
+ };
2541
+ const handleSortAsc = () => {
2542
+ column.toggleSorting(false);
2543
+ };
2544
+ const handleSortDesc = () => {
2545
+ column.toggleSorting(true);
2546
+ };
2547
+ const handleResetColumnSize = () => {
2548
+ setColumnSizingInfo((old) => (Object.assign(Object.assign({}, old), { isResizingColumn: false })));
2549
+ column.resetSize();
2550
+ };
2551
+ const handleHideColumn = () => {
2552
+ column.toggleVisibility(false);
2553
+ };
2554
+ const handlePinColumn = (pinDirection) => {
2555
+ column.pin(pinDirection);
2556
+ };
2557
+ const handleGroupByColumn = () => {
2558
+ column.toggleGrouping();
2559
+ setColumnOrder((old) => ['mrt-row-expand', ...old]);
2560
+ };
2561
+ const handleClearFilter = () => {
2562
+ column.setFilterValue('');
2563
+ };
2564
+ const handleFilterByColumn = () => {
2565
+ setShowColumnFilters(true);
2566
+ setTimeout(() => { var _a; return (_a = filterInputRefs.current[`${column.id}-0`]) === null || _a === void 0 ? void 0 : _a.focus(); }, 100);
2567
+ };
2568
+ const handleShowAllColumns = () => {
2569
+ toggleAllColumnsVisible(true);
2570
+ };
2571
+ const internalColumnMenuItems = (jsxs(Fragment, { children: [enableSorting && column.getCanSort() && (jsxs(Fragment, { children: [enableSortingRemoval !== false && (jsx(Menu.Item, { disabled: !column.getIsSorted(), leftSection: jsx(IconClearAll, {}), onClick: handleClearSort, children: localization.clearSort })), jsx(Menu.Item, { disabled: column.getIsSorted() === 'asc', leftSection: jsx(IconSortAscending, {}), onClick: handleSortAsc, children: (_b = localization.sortByColumnAsc) === null || _b === void 0 ? void 0 : _b.replace('{column}', String(columnDef.header)) }), jsx(Menu.Item, { disabled: column.getIsSorted() === 'desc', leftSection: jsx(IconSortDescending, {}), onClick: handleSortDesc, children: (_c = localization.sortByColumnDesc) === null || _c === void 0 ? void 0 : _c.replace('{column}', String(columnDef.header)) }), (enableColumnFilters || enableGrouping || enableHiding) && (jsx(Menu.Divider, {}, 3))] })), enableColumnFilters &&
2572
+ columnFilterDisplayMode !== 'popover' &&
2573
+ column.getCanFilter() && (jsxs(Fragment, { children: [jsx(Menu.Item, { disabled: !column.getFilterValue(), leftSection: jsx(IconFilterOff, {}), onClick: handleClearFilter, children: localization.clearFilter }), jsx(Menu.Item, { leftSection: jsx(IconFilter, {}), onClick: handleFilterByColumn, children: (_d = localization.filterByColumn) === null || _d === void 0 ? void 0 : _d.replace('{column}', String(columnDef.header)) }), (enableGrouping || enableHiding) && jsx(Menu.Divider, {}, 2)] })), enableGrouping && column.getCanGroup() && (jsxs(Fragment, { children: [jsx(Menu.Item, { leftSection: jsx(IconBoxMultiple, {}), onClick: handleGroupByColumn, children: (_e = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) === null || _e === void 0 ? void 0 : _e.replace('{column}', String(columnDef.header)) }), enableColumnPinning && jsx(Menu.Divider, {})] })), enableColumnPinning && column.getCanPin() && (jsxs(Fragment, { children: [jsx(Menu.Item, { disabled: column.getIsPinned() === 'left' || !column.getCanPin(), leftSection: jsx(IconPinned, { className: classes$b.left }), onClick: () => handlePinColumn('left'), children: localization.pinToLeft }), jsx(Menu.Item, { disabled: column.getIsPinned() === 'right' || !column.getCanPin(), leftSection: jsx(IconPinned, { className: classes$b.right }), onClick: () => handlePinColumn('right'), children: localization.pinToRight }), jsx(Menu.Item, { disabled: !column.getIsPinned(), leftSection: jsx(IconPinnedOff, {}), onClick: () => handlePinColumn(false), children: localization.unpin }), enableHiding && jsx(Menu.Divider, {})] })), enableColumnResizing && column.getCanResize() && (jsx(Menu.Item, { disabled: !columnSizing[column.id], leftSection: jsx(IconArrowAutofitContent, {}), onClick: handleResetColumnSize, children: localization.resetColumnSize }, 0)), enableHiding && (jsxs(Fragment, { children: [jsx(Menu.Item, { disabled: !column.getCanHide(), leftSection: jsx(IconEyeOff, {}), onClick: handleHideColumn, children: (_f = localization.hideColumn) === null || _f === void 0 ? void 0 : _f.replace('{column}', String(columnDef.header)) }, 0), jsx(Menu.Item, { disabled: !Object.values(columnVisibility).filter((visible) => !visible)
2574
+ .length, leftSection: jsx(IconColumns, {}), onClick: handleShowAllColumns, children: (_g = localization.showAllColumns) === null || _g === void 0 ? void 0 : _g.replace('{column}', String(columnDef.header)) }, 1)] }))] }));
2575
+ return (jsxs(Menu, Object.assign({ closeOnItemClick: true, position: "bottom-start", withinPortal: true }, rest, { children: [jsx(Tooltip, { label: (_h = actionIconProps === null || actionIconProps === void 0 ? void 0 : actionIconProps.title) !== null && _h !== void 0 ? _h : localization.columnActions, openDelay: 1000, withinPortal: true, children: jsx(Menu.Target, { children: jsx(ActionIcon, Object.assign({ "aria-label": localization.columnActions, color: "gray", size: "sm", variant: "subtle" }, actionIconProps, { children: jsx(IconDotsVertical, { size: "100%" }) })) }) }), jsx(Menu.Dropdown, { children: (_l = (_k = (_j = columnDef.renderColumnActionsMenuItems) === null || _j === void 0 ? void 0 : _j.call(columnDef, {
2576
+ column,
2577
+ internalColumnMenuItems,
2578
+ table,
2579
+ })) !== null && _k !== void 0 ? _k : renderColumnActionsMenuItems === null || renderColumnActionsMenuItems === void 0 ? void 0 : renderColumnActionsMenuItems({
2580
+ column,
2581
+ internalColumnMenuItems,
2582
+ table,
2583
+ })) !== null && _l !== void 0 ? _l : internalColumnMenuItems })] })));
2584
+ };
2585
+
2586
+ const MRT_TableHeadCell = (_a) => {
2587
+ var _b, _c, _d, _f, _g, _h;
2588
+ var { columnVirtualizer, header: headerProp, renderedHeaderIndex = 0, table } = _a, rest = __rest(_a, ["columnVirtualizer", "header", "renderedHeaderIndex", "table"]);
2589
+ //a view has a new identity per table reference, which compiled render callbacks need
2590
+ const header = getMRT_HeaderView(table, headerProp);
2591
+ const direction = useDirection();
2592
+ const { getState, options: { columnFilterDisplayMode, columnResizeDirection, columnResizeMode, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnPinning, enableGrouping, enableHeaderActionsHoverReveal, enableMultiSort, layoutMode, mantineTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
2593
+ const { columnSizingInfo, draggingColumn, grouping, hoveredColumn } = getState();
2594
+ const { column } = header;
2595
+ const { columnDef } = column;
2596
+ const { columnDefType } = columnDef;
2597
+ const arg = { column, table };
2598
+ const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineTableHeadCellProps, arg)), parseFromValuesOrFunc(columnDef.mantineTableHeadCellProps, arg)), rest);
2599
+ const widthStyles = {
2600
+ minWidth: `max(calc(var(--header-${parseCSSVarId(header === null || header === void 0 ? void 0 : header.id)}-size) * 1px), ${(_b = columnDef.minSize) !== null && _b !== void 0 ? _b : 30}px)`,
2601
+ width: `calc(var(--header-${parseCSSVarId(header.id)}-size) * 1px)`,
2602
+ };
2603
+ if (layoutMode === 'grid') {
2604
+ widthStyles.flex = `${[0, false].includes(columnDef.grow)
2605
+ ? 0
2606
+ : `var(--header-${parseCSSVarId(header.id)}-size)`} 0 auto`;
2607
+ }
2608
+ else if (layoutMode === 'grid-no-grow') {
2609
+ widthStyles.flex = `${+(columnDef.grow || 0)} 0 auto`;
2610
+ }
2611
+ const isColumnPinned = enableColumnPinning &&
2612
+ columnDef.columnDefType !== 'group' &&
2613
+ column.getIsPinned();
2614
+ const isDraggingColumn = (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id;
2615
+ const isHoveredColumn = (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id;
2616
+ const { hovered: isHoveredHeadCell, ref: isHoveredHeadCellRef } = useHover();
2617
+ const [isOpenedColumnActions, setIsOpenedColumnActions] = useState(false);
2618
+ const columnActionsEnabled = (enableColumnActions || columnDef.enableColumnActions) &&
2619
+ columnDef.enableColumnActions !== false;
2620
+ const showColumnButtons = !enableHeaderActionsHoverReveal ||
2621
+ isOpenedColumnActions ||
2622
+ (isHoveredHeadCell &&
2623
+ !table.getVisibleFlatColumns().find((column) => column.getIsResizing()));
2624
+ const showDragHandle = enableColumnDragging !== false &&
2625
+ columnDef.enableColumnDragging !== false &&
2626
+ (enableColumnDragging ||
2627
+ (enableColumnOrdering && columnDef.enableColumnOrdering !== false) ||
2628
+ (enableGrouping &&
2629
+ columnDef.enableGrouping !== false &&
2630
+ !grouping.includes(column.id))) &&
2631
+ showColumnButtons;
2632
+ const headerPL = useMemo(() => {
2633
+ let pl = 0;
2634
+ if (column.getCanSort())
2635
+ pl++;
2636
+ // Only add padding for buttons if they will actually be displayed
2637
+ if (showColumnButtons && (columnActionsEnabled || showDragHandle))
2638
+ pl += 1.75;
2639
+ if (showDragHandle)
2640
+ pl += 1.25;
2641
+ return pl;
2642
+ }, [showColumnButtons, showDragHandle, columnActionsEnabled]);
2643
+ const handleDragEnter = (_e) => {
2644
+ if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
2645
+ setHoveredColumn(null);
2646
+ }
2647
+ if (enableColumnOrdering && draggingColumn && columnDefType !== 'group') {
2648
+ setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
2649
+ }
2650
+ };
2651
+ const headerElement = (columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) instanceof Function
2652
+ ? (_c = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) === null || _c === void 0 ? void 0 : _c.call(columnDef, {
2653
+ column,
2654
+ header,
2655
+ table,
2656
+ })
2657
+ : ((_d = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) !== null && _d !== void 0 ? _d : columnDef.header);
2658
+ return (jsxs(TableTh, Object.assign({ colSpan: header.colSpan, "data-column-pinned": isColumnPinned || undefined, "data-dragging-column": isDraggingColumn || undefined, "data-first-right-pinned": (isColumnPinned === 'right' &&
2659
+ column.getIsFirstColumn(isColumnPinned)) ||
2660
+ undefined, "data-hovered-column-target": isHoveredColumn || undefined, "data-index": renderedHeaderIndex, "data-last-left-pinned": (isColumnPinned === 'left' && column.getIsLastColumn(isColumnPinned)) ||
2661
+ undefined, "data-resizing": (columnResizeMode === 'onChange' &&
2662
+ (columnSizingInfo === null || columnSizingInfo === void 0 ? void 0 : columnSizingInfo.isResizingColumn) === column.id &&
2663
+ columnResizeDirection) ||
2664
+ undefined }, tableCellProps, { __vars: {
2665
+ '--mrt-table-cell-left': isColumnPinned === 'left'
2666
+ ? `${column.getStart(isColumnPinned)}`
2667
+ : undefined,
2668
+ '--mrt-table-cell-right': isColumnPinned === 'right'
2669
+ ? `${column.getAfter(isColumnPinned)}`
2670
+ : undefined,
2671
+ }, align: columnDefType === 'group'
2672
+ ? 'center'
2673
+ : direction.dir === 'rtl'
2674
+ ? 'right'
2675
+ : 'left', className: clsx(classes$l.root, (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) && classes$l['root-grid'], enableMultiSort && column.getCanSort() && classes$l['root-no-select'], columnVirtualizer && classes$l['root-virtualized'], tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.className), onDragEnter: handleDragEnter, ref: (node) => {
2676
+ var _a;
2677
+ if (node) {
2678
+ tableHeadCellRefs.current[column.id] = node;
2679
+ isHoveredHeadCellRef(node);
2680
+ if (columnDefType !== 'group') {
2681
+ (_a = columnVirtualizer === null || columnVirtualizer === void 0 ? void 0 : columnVirtualizer.measureElement) === null || _a === void 0 ? void 0 : _a.call(columnVirtualizer, node);
2682
+ }
2683
+ }
2684
+ }, style: (theme) => (Object.assign(Object.assign({}, widthStyles), parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.style, theme))), children: [header.isPlaceholder
2685
+ ? null
2686
+ : ((_f = tableCellProps.children) !== null && _f !== void 0 ? _f : (jsxs(Flex, { className: clsx('mrt-table-head-cell-content', classes$l.content, (columnDefType === 'group' ||
2687
+ (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center') &&
2688
+ classes$l['content-center'], (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' && classes$l['content-right'], column.getCanResize() && classes$l['content-spaced']), children: [jsxs(Flex, { __vars: {
2689
+ '--mrt-table-head-cell-labels-padding-left': `${headerPL}`,
2690
+ }, className: clsx('mrt-table-head-cell-labels', classes$l.labels, column.getCanSort() &&
2691
+ columnDefType !== 'group' &&
2692
+ classes$l['labels-sortable'], (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right'
2693
+ ? classes$l['labels-right']
2694
+ : (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center' &&
2695
+ classes$l['labels-center'], columnDefType === 'data' && classes$l['labels-data']), onClick: column.getToggleSortingHandler(), children: [jsx(Flex, { className: clsx('mrt-table-head-cell-content-wrapper', classes$l['content-wrapper'], columnDefType === 'data' &&
2696
+ classes$l['content-wrapper-hidden-overflow'], ((_h = (_g = columnDef.header) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0) < 20 &&
2697
+ classes$l['content-wrapper-nowrap']), children: headerElement }), column.getCanFilter() &&
2698
+ (column.getIsFiltered() || showColumnButtons) && (jsx(MRT_TableHeadCellFilterLabel, { header: header, table: table })), column.getCanSort() &&
2699
+ (column.getIsSorted() || showColumnButtons) && (jsx(MRT_TableHeadCellSortLabel, { header: header, table: table }))] }), columnDefType !== 'group' && (jsxs(Flex, { className: clsx('mrt-table-head-cell-content-actions', classes$l['content-actions']), children: [showDragHandle && (jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
2700
+ current: tableHeadCellRefs.current[column.id],
2701
+ } })), columnActionsEnabled && showColumnButtons && (jsx(MRT_ColumnActionMenu, { header: header, onChange: setIsOpenedColumnActions, opened: isOpenedColumnActions, table: table }))] })), column.getCanResize() && (jsx(MRT_TableHeadCellResizeHandle, { header: header, table: table }))] }))), columnFilterDisplayMode === 'subheader' && column.getCanFilter() && (jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }))] })));
2702
+ };
2703
+
2704
+ const MRT_TableHeadRow = (_a) => {
2705
+ var _b;
2706
+ var { columnVirtualizer, headerGroup, table } = _a, rest = __rest(_a, ["columnVirtualizer", "headerGroup", "table"]);
2707
+ const { getState, options: { enableStickyHeader, layoutMode, mantineTableHeadRowProps }, } = table;
2708
+ const { isFullScreen } = getState();
2709
+ const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } = columnVirtualizer !== null && columnVirtualizer !== void 0 ? columnVirtualizer : {};
2710
+ const virtualGroupHeaders = getVirtualGroupHeaders({
2711
+ headers: headerGroup.headers,
2712
+ table,
2713
+ virtualColumns,
2714
+ });
2715
+ const tableRowProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineTableHeadRowProps, {
2716
+ headerGroup,
2717
+ table,
2718
+ })), rest);
2719
+ return (jsxs(TableTr, Object.assign({}, tableRowProps, { className: clsx(classes$m.root, (enableStickyHeader || isFullScreen) && classes$m.sticky, (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) && classes$m['layout-mode-grid'], tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.className), children: [virtualPaddingLeft ? (jsx(Box, { component: "th", display: "flex", w: virtualPaddingLeft })) : null, (_b = virtualGroupHeaders === null || virtualGroupHeaders === void 0 ? void 0 : virtualGroupHeaders.map(({ header, index, style }) => (jsx(MRT_TableHeadCell, { columnVirtualizer: columnVirtualizer, header: header, renderedHeaderIndex: index, style: style, table: table }, header.id)))) !== null && _b !== void 0 ? _b : (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader, renderedHeaderIndex) => {
2720
+ let header = headerOrVirtualHeader;
2721
+ if (columnVirtualizer) {
2722
+ renderedHeaderIndex = headerOrVirtualHeader
2723
+ .index;
2724
+ header = headerGroup.headers[renderedHeaderIndex];
2725
+ }
2726
+ return (jsx(MRT_TableHeadCell, { columnVirtualizer: columnVirtualizer, header: header, renderedHeaderIndex: renderedHeaderIndex, table: table }, header.id));
2727
+ }), virtualPaddingRight ? (jsx(Box, { component: "th", display: "flex", w: virtualPaddingRight })) : null] })));
2728
+ };
2729
+
2730
+ var classes$a = {"alert":"MRT_ToolbarAlertBanner-module_alert__PAhUK","alert-stacked":"MRT_ToolbarAlertBanner-module_alert-stacked__HR7Nq","alert-bottom":"MRT_ToolbarAlertBanner-module_alert-bottom__u9L-S","alert-badge":"MRT_ToolbarAlertBanner-module_alert-badge__GwDmX","toolbar-alert":"MRT_ToolbarAlertBanner-module_toolbar-alert__3sJGU","head-overlay":"MRT_ToolbarAlertBanner-module_head-overlay__Hw7jK"};
2731
+
2732
+ const MRT_SelectCheckbox = (_a) => {
2733
+ var _b;
2734
+ var { renderedRowIndex = 0, row, table } = _a, rest = __rest(_a, ["renderedRowIndex", "row", "table"]);
2735
+ const { getState, options: { enableMultiRowSelection, localization, mantineSelectAllCheckboxProps, mantineSelectCheckboxProps, selectAllMode, selectDisplayMode, }, } = table;
2736
+ const { density, isLoading } = getState();
2737
+ const selectAll = !row;
2738
+ const allRowsSelected = selectAll
2739
+ ? selectAllMode === 'page'
2740
+ ? table.getIsAllPageRowsSelected()
2741
+ : table.getIsAllRowsSelected()
2742
+ : undefined;
2743
+ const isChecked = selectAll
2744
+ ? allRowsSelected
2745
+ : getIsRowSelected({ row, table });
2746
+ const checkboxProps = Object.assign(Object.assign({}, (selectAll
2747
+ ? parseFromValuesOrFunc(mantineSelectAllCheckboxProps, { table })
2748
+ : parseFromValuesOrFunc(mantineSelectCheckboxProps, {
2749
+ row,
2750
+ table,
2751
+ }))), rest);
2752
+ const onSelectionChange = row
2753
+ ? getMRT_RowSelectionHandler({
2754
+ renderedRowIndex,
2755
+ row,
2756
+ table,
2757
+ })
2758
+ : undefined;
2759
+ const onSelectAllChange = getMRT_SelectAllHandler({ table });
2760
+ const commonProps = Object.assign(Object.assign({ 'aria-label': selectAll
2761
+ ? localization.toggleSelectAll
2762
+ : localization.toggleSelectRow, checked: isChecked, disabled: isLoading || (row && !row.getCanSelect()) || (row === null || row === void 0 ? void 0 : row.id) === 'mrt-row-create', onChange: (event) => {
2763
+ event.stopPropagation();
2764
+ if (selectAll) {
2765
+ onSelectAllChange(event);
2766
+ }
2767
+ else {
2768
+ onSelectionChange(event);
2769
+ }
2770
+ }, size: density === 'xs' ? 'sm' : 'md' }, checkboxProps), { onClick: (e) => {
2771
+ var _a;
2772
+ e.stopPropagation();
2773
+ (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
2774
+ }, title: undefined });
2775
+ return (jsx(Tooltip, { label: (_b = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _b !== void 0 ? _b : (selectAll
2776
+ ? localization.toggleSelectAll
2777
+ : localization.toggleSelectRow), openDelay: 1000, withinPortal: true, children: jsx("span", { children: selectDisplayMode === 'switch' ? (jsx(Switch, Object.assign({}, commonProps))) : selectDisplayMode === 'radio' ||
2778
+ enableMultiRowSelection === false ? (jsx(Radio, Object.assign({}, commonProps))) : (jsx(Checkbox, Object.assign({ indeterminate: !isChecked && selectAll
2779
+ ? table.getIsSomeRowsSelected()
2780
+ : (row === null || row === void 0 ? void 0 : row.getIsSomeSelected()) && row.getCanSelectSubRows() }, commonProps))) }) }));
2781
+ };
2782
+
2783
+ const MRT_ToolbarAlertBanner = (_a) => {
2784
+ var _b, _c, _d;
2785
+ var { stackAlertBanner, table } = _a, rest = __rest(_a, ["stackAlertBanner", "table"]);
2786
+ const { getFilteredSelectedRowModel, getPrePaginationRowModel, getState, options: { enableRowSelection, enableSelectAll, icons: { IconX }, localization, mantineToolbarAlertBannerBadgeProps, mantineToolbarAlertBannerProps, manualPagination, positionToolbarAlertBanner, renderToolbarAlertBannerContent, rowCount, }, } = table;
2787
+ const { density, grouping, rowSelection, showAlertBanner } = getState();
2788
+ const alertProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineToolbarAlertBannerProps, {
2789
+ table,
2790
+ })), rest);
2791
+ const badgeProps = parseFromValuesOrFunc(mantineToolbarAlertBannerBadgeProps, { table });
2792
+ const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().flatRows.length;
2793
+ const selectedRowCount = useMemo(() => manualPagination
2794
+ ? Object.values(rowSelection).filter(Boolean).length
2795
+ : getFilteredSelectedRowModel().rows.length, [rowSelection, totalRowCount, manualPagination]);
2796
+ const selectedAlert = selectedRowCount ? (jsxs(Flex, { align: "center", gap: "sm", children: [(_c = (_b = localization.selectedCountOfRowCountRowsSelected) === null || _b === void 0 ? void 0 : _b.replace('{selectedCount}', selectedRowCount.toString())) === null || _c === void 0 ? void 0 : _c.replace('{rowCount}', totalRowCount.toString()), jsx(Button, { onClick: (event) => getMRT_SelectAllHandler({ table })(event, false, true), size: "compact-xs", variant: "subtle", children: localization.clearSelection })] })) : null;
2797
+ const groupedAlert = grouping.length > 0 ? (jsxs(Flex, { children: [localization.groupedBy, ' ', grouping.map((columnId, index) => (jsxs(Fragment$1, { children: [index > 0 ? localization.thenBy : '', jsxs(Badge, Object.assign({ className: classes$a['alert-badge'], rightSection: jsx(ActionIcon, { color: "white", onClick: () => table.getColumn(columnId).toggleGrouping(), size: "xs", variant: "subtle", children: jsx(IconX, { style: { transform: 'scale(0.8)' } }) }), variant: "filled" }, badgeProps, { children: [table.getColumn(columnId).columnDef.header, ' '] }))] }, `${index}-${columnId}`)))] })) : null;
2798
+ return (jsx(Collapse, { expanded: showAlertBanner || !!selectedAlert || !!groupedAlert, transitionDuration: stackAlertBanner ? 200 : 0, children: jsx(Alert, Object.assign({ color: "blue", icon: false }, alertProps, { className: clsx(classes$a.alert, stackAlertBanner &&
2799
+ !positionToolbarAlertBanner &&
2800
+ classes$a['alert-stacked'], !stackAlertBanner &&
2801
+ positionToolbarAlertBanner === 'bottom' &&
2802
+ classes$a['alert-bottom'], alertProps === null || alertProps === void 0 ? void 0 : alertProps.className), children: (_d = renderToolbarAlertBannerContent === null || renderToolbarAlertBannerContent === void 0 ? void 0 : renderToolbarAlertBannerContent({
2803
+ groupedAlert,
2804
+ selectedAlert,
2805
+ table,
2806
+ })) !== null && _d !== void 0 ? _d : (jsxs(Flex, { className: clsx(classes$a['toolbar-alert'], positionToolbarAlertBanner === 'head-overlay' &&
2807
+ classes$a['head-overlay'], density), children: [enableRowSelection &&
2808
+ enableSelectAll &&
2809
+ positionToolbarAlertBanner === 'head-overlay' && (jsx(MRT_SelectCheckbox, { table: table })), jsxs(Stack, { children: [alertProps === null || alertProps === void 0 ? void 0 : alertProps.children, selectedAlert, groupedAlert] })] })) })) }));
2810
+ };
2811
+
2812
+ const MRT_TableHead = (_a) => {
2813
+ var { columnVirtualizer, table } = _a, rest = __rest(_a, ["columnVirtualizer", "table"]);
2814
+ const { getHeaderGroups, getSelectedRowModel, getState, options: { enableStickyHeader, layoutMode, mantineTableHeadProps, positionToolbarAlertBanner, }, refs: { tableHeadRef }, } = table;
2815
+ const { isFullScreen, showAlertBanner } = getState();
2816
+ const tableHeadProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineTableHeadProps, {
2817
+ table,
2818
+ })), rest);
2819
+ const stickyHeader = enableStickyHeader || isFullScreen;
2820
+ return (jsx(TableThead, Object.assign({}, tableHeadProps, { className: clsx(classes$n.root, (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid'))
2821
+ ? classes$n['root-grid']
2822
+ : classes$n['root-table-row-group'], stickyHeader && classes$n['root-sticky'], tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.className), pos: stickyHeader && (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'sticky' : 'relative', ref: (ref) => {
2823
+ tableHeadRef.current = ref;
2824
+ assignRef(tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.ref, ref);
2825
+ }, children: positionToolbarAlertBanner === 'head-overlay' &&
2826
+ (showAlertBanner || getSelectedRowModel().rows.length > 0) ? (jsx(TableTr, { className: clsx(classes$n['banner-tr'], (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) && classes$n.grid), children: jsx(TableTh, { className: clsx(classes$n['banner-th'], (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) && classes$n.grid), colSpan: table.getVisibleLeafColumns().length, children: jsx(MRT_ToolbarAlertBanner, { table: table }) }) })) : (getHeaderGroups().map((headerGroup) => (jsx(MRT_TableHeadRow, { columnVirtualizer: columnVirtualizer, headerGroup: headerGroup, table: table }, headerGroup.id)))) })));
2827
+ };
2828
+
2829
+ var classes$9 = {"root":"MRT_GlobalFilterTextInput-module_root__Xmcpv","collapse":"MRT_GlobalFilterTextInput-module_collapse__v311d"};
2830
+
2831
+ const MRT_GlobalFilterTextInput = (_a) => {
2832
+ var { table } = _a, rest = __rest(_a, ["table"]);
2833
+ const { getState, options: { enableGlobalFilterModes, icons: { IconSearch, IconX }, localization, mantineSearchTextInputProps, manualFiltering, positionGlobalFilter, }, refs: { searchInputRef }, setGlobalFilter, } = table;
2834
+ const { globalFilter, showGlobalFilter } = getState();
2835
+ const textFieldProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineSearchTextInputProps, {
2836
+ table,
2837
+ })), rest);
2838
+ const isMounted = useRef(false);
2839
+ const [searchValue, setSearchValue] = useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
2840
+ //send the search value to the table once typing pauses. The timer restarts on
2841
+ //every change, so text retyped right after a clear is sent again.
2842
+ useEffect(() => {
2843
+ const timeout = setTimeout(() => setGlobalFilter(searchValue || undefined), manualFiltering ? 500 : 250);
2844
+ return () => clearTimeout(timeout);
2845
+ }, [searchValue]);
2846
+ const handleClear = () => {
2847
+ setSearchValue('');
2848
+ setGlobalFilter(undefined);
2849
+ };
2850
+ useEffect(() => {
2851
+ if (isMounted.current) {
2852
+ if (globalFilter === undefined) {
2853
+ handleClear();
2854
+ }
2855
+ else {
2856
+ setSearchValue(globalFilter);
2857
+ }
2858
+ }
2859
+ isMounted.current = true;
2860
+ }, [globalFilter]);
2861
+ return (jsxs(Collapse, { className: classes$9.collapse, expanded: showGlobalFilter, children: [enableGlobalFilterModes && (jsxs(Menu, { withinPortal: true, children: [jsx(Menu.Target, { children: jsx(ActionIcon, { "aria-label": localization.changeSearchMode, color: "gray", size: "sm", variant: "transparent", children: jsx(IconSearch, {}) }) }), jsx(MRT_FilterOptionMenu, { onSelect: handleClear, table: table })] })), jsx(TextInput, Object.assign({ leftSection: !enableGlobalFilterModes && jsx(IconSearch, {}), mt: 0, mx: positionGlobalFilter !== 'left' ? 'mx' : undefined, onChange: (event) => setSearchValue(event.target.value), placeholder: localization.search, rightSection: jsx(ActionIcon, { "aria-label": localization.clearSearch, color: "gray", disabled: !(searchValue === null || searchValue === void 0 ? void 0 : searchValue.length), hidden: !searchValue, onClick: handleClear, size: "sm", style: {
2862
+ visibility: !searchValue ? 'hidden' : undefined,
2863
+ }, variant: "transparent", children: jsx(Tooltip, { label: localization.clearSearch, withinPortal: true, children: jsx(IconX, {}) }) }), value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "filled" }, textFieldProps, { className: clsx('mrt-global-filter-text-input', classes$9.root, textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.className), ref: (node) => {
2864
+ if (node) {
2865
+ searchInputRef.current = node;
2866
+ if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.ref) {
2867
+ // @ts-ignore
2868
+ textFieldProps.ref = node;
2869
+ }
2870
+ }
2871
+ } }))] }));
2872
+ };
2873
+
2874
+ const flexRender = flexRender$1;
2875
+ function createMRTColumnHelper() {
2876
+ return {
2877
+ accessor: (accessor, column) => {
2878
+ return typeof accessor === 'function'
2879
+ ? Object.assign(Object.assign({}, column), { accessorFn: accessor })
2880
+ : Object.assign(Object.assign({}, column), { accessorKey: accessor });
2881
+ },
2882
+ display: (column) => column,
2883
+ group: (column) => column,
2884
+ };
2885
+ }
2886
+ const createRow = (table, originalRow, rowIndex = -1, depth = 0, subRows, parentId) => createRow$1(table, 'mrt-row-create', originalRow !== null && originalRow !== void 0 ? originalRow : Object.assign({}, ...getAllLeafColumnDefs(table.options.columns).map((col) => ({
2887
+ [getColumnId(col)]: '',
2888
+ }))), rowIndex, depth, subRows, parentId);
2889
+
2890
+ const getMRT_RowActionsColumnDef = (tableOptions) => {
2891
+ return Object.assign({ Cell: ({ cell, row, table }) => (jsx(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })) }, defaultDisplayColumnProps({
2892
+ header: 'actions',
2893
+ id: 'mrt-row-actions',
2894
+ size: 70,
2895
+ tableOptions,
2896
+ }));
2897
+ };
2898
+
2899
+ const getMRT_RowDragColumnDef = (tableOptions) => {
2900
+ return Object.assign({ Cell: ({ row, rowRef, table }) => (jsx(MRT_TableBodyRowGrabHandle, { row: row, rowRef: rowRef, table: table })), grow: false }, defaultDisplayColumnProps({
2901
+ header: 'move',
2902
+ id: 'mrt-row-drag',
2903
+ size: 60,
2904
+ tableOptions,
2905
+ }));
2906
+ };
2907
+
2908
+ const getMRT_RowExpandColumnDef = (tableOptions) => {
2909
+ var _a;
2910
+ const { defaultColumn, enableExpandAll, groupedColumnMode, positionExpandColumn, renderDetailPanel, state: { grouping }, } = tableOptions;
2911
+ const alignProps = positionExpandColumn === 'last'
2912
+ ? {
2913
+ align: 'right',
2914
+ }
2915
+ : undefined;
2916
+ return Object.assign({ Cell: ({ cell, column, row, table }) => {
2917
+ var _a, _b, _c;
2918
+ const expandButtonProps = { row, table };
2919
+ const subRowsLength = (_a = row.subRows) === null || _a === void 0 ? void 0 : _a.length;
2920
+ if (tableOptions.groupedColumnMode === 'remove' && row.groupingColumnId) {
2921
+ return (jsxs(Flex, { align: "center", gap: "0.25rem", children: [jsx(MRT_ExpandButton, Object.assign({}, expandButtonProps)), jsx(Tooltip, { label: table.getColumn(row.groupingColumnId).columnDef.header, openDelay: 1000, position: "right", children: jsx("span", { children: row.groupingValue }) }), !!subRowsLength && jsxs("span", { children: ["(", subRowsLength, ")"] })] }));
2922
+ }
2923
+ else {
2924
+ return (jsxs(Fragment, { children: [jsx(MRT_ExpandButton, Object.assign({}, expandButtonProps)), (_c = (_b = column.columnDef).GroupedCell) === null || _c === void 0 ? void 0 : _c.call(_b, { cell, column, row, table })] }));
2925
+ }
2926
+ }, Header: enableExpandAll
2927
+ ? ({ table }) => {
2928
+ var _a;
2929
+ return (jsxs(Flex, { align: "center", children: [jsx(MRT_ExpandAllButton, { table: table }), groupedColumnMode === 'remove' &&
2930
+ ((_a = grouping === null || grouping === void 0 ? void 0 : grouping.map((groupedColumnId) => table.getColumn(groupedColumnId).columnDef.header)) === null || _a === void 0 ? void 0 : _a.join(', '))] }));
2931
+ }
2932
+ : undefined, mantineTableBodyCellProps: alignProps, mantineTableHeadCellProps: alignProps }, defaultDisplayColumnProps({
2933
+ header: 'expand',
2934
+ id: 'mrt-row-expand',
2935
+ size: groupedColumnMode === 'remove'
2936
+ ? ((_a = defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.size) !== null && _a !== void 0 ? _a : 180)
2937
+ : renderDetailPanel
2938
+ ? enableExpandAll
2939
+ ? 60
2940
+ : 70
2941
+ : 100,
2942
+ tableOptions,
2943
+ }));
2944
+ };
2945
+
2946
+ const getMRT_RowNumbersColumnDef = (tableOptions) => {
2947
+ const { localization, rowNumberDisplayMode } = tableOptions;
2948
+ const { pagination: { pageIndex, pageSize }, } = tableOptions.state;
2949
+ return Object.assign({ Cell: ({ renderedRowIndex = 0, row }) => {
2950
+ var _a;
2951
+ return ((_a = (rowNumberDisplayMode === 'static'
2952
+ ? renderedRowIndex + pageSize * pageIndex
2953
+ : row.index)) !== null && _a !== void 0 ? _a : 0) + 1;
2954
+ }, grow: false, Header: () => localization.rowNumber }, defaultDisplayColumnProps({
2955
+ header: 'rowNumbers',
2956
+ id: 'mrt-row-numbers',
2957
+ size: 50,
2958
+ tableOptions,
2959
+ }));
2960
+ };
2961
+
2962
+ const getMRT_RowPinningColumnDef = (tableOptions) => {
2963
+ return Object.assign({ Cell: ({ row, table }) => (jsx(MRT_TableBodyRowPinButton, { row: row, table: table })), grow: false }, defaultDisplayColumnProps({
2964
+ header: 'pin',
2965
+ id: 'mrt-row-pin',
2966
+ size: 60,
2967
+ tableOptions,
2968
+ }));
2969
+ };
2970
+
2971
+ const getMRT_RowSelectColumnDef = (tableOptions) => {
2972
+ const { enableMultiRowSelection, enableSelectAll } = tableOptions;
2973
+ return Object.assign({ Cell: ({ renderedRowIndex, row, table }) => (jsx(MRT_SelectCheckbox, { renderedRowIndex: renderedRowIndex, row: row, table: table })), grow: false, Header: enableSelectAll && enableMultiRowSelection
2974
+ ? ({ table }) => jsx(MRT_SelectCheckbox, { table: table })
2975
+ : undefined }, defaultDisplayColumnProps({
2976
+ header: 'select',
2977
+ id: 'mrt-row-select',
2978
+ size: enableSelectAll ? 60 : 70,
2979
+ tableOptions,
2980
+ }));
2981
+ };
2982
+
2983
+ const MRT_AggregationFns = Object.assign({}, aggregationFns);
2984
+
2985
+ const MRT_Default_Icons = {
2986
+ IconArrowAutofitContent,
2987
+ IconArrowsSort,
2988
+ IconBaselineDensityLarge,
2989
+ IconBaselineDensityMedium,
2990
+ IconBaselineDensitySmall,
2991
+ IconBoxMultiple,
2992
+ IconChevronDown,
2993
+ IconChevronLeft,
2994
+ IconChevronLeftPipe,
2995
+ IconChevronRight,
2996
+ IconChevronRightPipe,
2997
+ IconChevronsDown,
2998
+ IconCircleX,
2999
+ IconClearAll,
3000
+ IconColumns,
3001
+ IconDeviceFloppy,
3002
+ IconDots,
3003
+ IconDotsVertical,
3004
+ IconEdit,
3005
+ IconEyeOff,
3006
+ IconFilter,
3007
+ IconFilterCog,
3008
+ IconFilterOff,
3009
+ IconGripHorizontal,
3010
+ IconMaximize,
3011
+ IconMinimize,
3012
+ IconPinned,
3013
+ IconPinnedOff,
3014
+ IconSearch,
3015
+ IconSearchOff,
3016
+ IconSortAscending,
3017
+ IconSortDescending,
3018
+ IconX,
3019
+ };
3020
+
3021
+ const MRT_Localization_EN = {
3022
+ actions: 'Actions',
3023
+ and: 'and',
3024
+ cancel: 'Cancel',
3025
+ changeFilterMode: 'Change filter mode',
3026
+ changeSearchMode: 'Change search mode',
3027
+ clearFilter: 'Clear filter',
3028
+ clearSearch: 'Clear search',
3029
+ clearSelection: 'Clear selection',
3030
+ clearSort: 'Clear sort',
3031
+ clickToCopy: 'Click to copy',
3032
+ copy: 'Copy',
3033
+ collapse: 'Collapse',
3034
+ collapseAll: 'Collapse all',
3035
+ columnActions: 'Column Actions',
3036
+ copiedToClipboard: 'Copied to clipboard',
3037
+ dropToGroupBy: 'Drop to group by {column}',
3038
+ edit: 'Edit',
3039
+ expand: 'Expand',
3040
+ expandAll: 'Expand all',
3041
+ filterArrIncludes: 'Includes',
3042
+ filterArrIncludesAll: 'Includes all',
3043
+ filterArrIncludesSome: 'Includes',
3044
+ filterBetween: 'Between',
3045
+ filterBetweenInclusive: 'Between Inclusive',
3046
+ filterByColumn: 'Filter by {column}',
3047
+ filterContains: 'Contains',
3048
+ filterEmpty: 'Empty',
3049
+ filterEndsWith: 'Ends With',
3050
+ filterEquals: 'Equals',
3051
+ filterEqualsString: 'Equals',
3052
+ filterFuzzy: 'Fuzzy',
3053
+ filterGreaterThan: 'Greater Than',
3054
+ filterGreaterThanOrEqualTo: 'Greater Than Or Equal To',
3055
+ filterInNumberRange: 'Between',
3056
+ filterIncludesString: 'Contains',
3057
+ filterIncludesStringSensitive: 'Contains',
3058
+ filterLessThan: 'Less Than',
3059
+ filterLessThanOrEqualTo: 'Less Than Or Equal To',
3060
+ filterMode: 'Filter Mode: {filterType}',
3061
+ filterNotEmpty: 'Not Empty',
3062
+ filterNotEquals: 'Not Equals',
3063
+ filterStartsWith: 'Starts With',
3064
+ filterWeakEquals: 'Equals',
3065
+ filteringByColumn: 'Filtering by {column} - {filterType} {filterValue}',
3066
+ goToFirstPage: 'Go to first page',
3067
+ goToLastPage: 'Go to last page',
3068
+ goToNextPage: 'Go to next page',
3069
+ goToPreviousPage: 'Go to previous page',
3070
+ grab: 'Grab',
3071
+ groupByColumn: 'Group by {column}',
3072
+ groupedBy: 'Grouped by ',
3073
+ hideAll: 'Hide all',
3074
+ hideColumn: 'Hide {column} column',
3075
+ max: 'Max',
3076
+ min: 'Min',
3077
+ move: 'Move',
3078
+ noRecordsToDisplay: 'No records to display',
3079
+ noResultsFound: 'No results found',
3080
+ of: 'of',
3081
+ or: 'or',
3082
+ pin: 'Pin',
3083
+ pinToLeft: 'Pin to left',
3084
+ pinToRight: 'Pin to right',
3085
+ resetColumnSize: 'Reset column size',
3086
+ resetOrder: 'Reset order',
3087
+ rowActions: 'Row Actions',
3088
+ rowNumber: '#',
3089
+ rowNumbers: 'Row Numbers',
3090
+ rowsPerPage: 'Rows per page',
3091
+ save: 'Save',
3092
+ search: 'Search',
3093
+ selectedCountOfRowCountRowsSelected: '{selectedCount} of {rowCount} row(s) selected',
3094
+ select: 'Select',
3095
+ showAll: 'Show all',
3096
+ showAllColumns: 'Show all columns',
3097
+ showHideColumns: 'Show/Hide columns',
3098
+ showHideFilters: 'Show/Hide filters',
3099
+ showHideSearch: 'Show/Hide search',
3100
+ sortByColumnAsc: 'Sort by {column} ascending',
3101
+ sortByColumnDesc: 'Sort by {column} descending',
3102
+ sortedByColumnAsc: 'Sorted by {column} ascending',
3103
+ sortedByColumnDesc: 'Sorted by {column} descending',
3104
+ thenBy: ', then by ',
3105
+ toggleDensity: 'Toggle density',
3106
+ toggleFullScreen: 'Toggle full screen',
3107
+ toggleSelectAll: 'Toggle select all',
3108
+ toggleSelectRow: 'Toggle select row',
3109
+ toggleVisibility: 'Toggle visibility',
3110
+ ungroupByColumn: 'Ungroup by {column}',
3111
+ unpin: 'Unpin',
3112
+ unpinAll: 'Unpin all',
3113
+ };
3114
+
3115
+ const MRT_DefaultColumn = {
3116
+ filterVariant: 'text',
3117
+ maxSize: 1000,
3118
+ minSize: 40,
3119
+ size: 180,
3120
+ };
3121
+ const MRT_DefaultDisplayColumn = {
3122
+ columnDefType: 'display',
3123
+ enableClickToCopy: false,
3124
+ enableColumnActions: false,
3125
+ enableColumnDragging: false,
3126
+ enableColumnFilter: false,
3127
+ enableColumnOrdering: false,
3128
+ enableEditing: false,
3129
+ enableGlobalFilter: false,
3130
+ enableGrouping: false,
3131
+ enableHiding: false,
3132
+ enableResizing: false,
3133
+ enableSorting: false,
3134
+ };
3135
+ const globalFilterValueCache = new WeakMap();
3136
+ /**
3137
+ * Finds the first row with a value in the column and checks that the value is
3138
+ * a string or a number. The result is cached for each data array.
3139
+ */
3140
+ const getColumnHasGlobalFilterValue = (data, column) => {
3141
+ if (!(data === null || data === void 0 ? void 0 : data.length) || !column.accessorFn)
3142
+ return false;
3143
+ let cache = globalFilterValueCache.get(data);
3144
+ if (!cache) {
3145
+ cache = new Map();
3146
+ globalFilterValueCache.set(data, cache);
3147
+ }
3148
+ let hasValue = cache.get(column.id);
3149
+ if (hasValue === undefined) {
3150
+ hasValue = false;
3151
+ for (let index = 0; index < data.length; index++) {
3152
+ const value = column.accessorFn(data[index], index);
3153
+ if (value !== null && value !== undefined) {
3154
+ hasValue = typeof value === 'string' || typeof value === 'number';
3155
+ break;
3156
+ }
3157
+ }
3158
+ cache.set(column.id, hasValue);
3159
+ }
3160
+ return hasValue;
3161
+ };
3162
+ const useMRT_TableOptions = (_a) => {
3163
+ var _b;
3164
+ var { aggregationFns, autoResetExpanded = false, columnFilterDisplayMode = 'subheader', columnResizeDirection, columnResizeMode = 'onChange', createDisplayMode = 'modal', defaultColumn, defaultDisplayColumn, editDisplayMode = 'modal', enableBatchRowSelection = true, enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnPinning = false, enableColumnResizing = false, enableColumnVirtualization, enableDensityToggle = true, enableExpandAll = true, enableExpanding, enableFacetedValues = false, enableFilterMatchHighlighting = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHeaderActionsHoverReveal = false, enableHiding = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enableRowPinning = false, enableRowSelection = false, enableRowVirtualization, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, layoutMode, localization, manualFiltering, manualGrouping, manualPagination, manualSorting, paginationDisplayMode = 'default', positionActionsColumn = 'first', positionCreatingRow = 'top', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberDisplayMode = 'static', rowPinningDisplayMode = 'sticky', selectAllMode = 'page', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnFilterDisplayMode", "columnResizeDirection", "columnResizeMode", "createDisplayMode", "defaultColumn", "defaultDisplayColumn", "editDisplayMode", "enableBatchRowSelection", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnPinning", "enableColumnResizing", "enableColumnVirtualization", "enableDensityToggle", "enableExpandAll", "enableExpanding", "enableFacetedValues", "enableFilterMatchHighlighting", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHeaderActionsHoverReveal", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enableRowPinning", "enableRowSelection", "enableRowVirtualization", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "paginationDisplayMode", "positionActionsColumn", "positionCreatingRow", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberDisplayMode", "rowPinningDisplayMode", "selectAllMode", "sortingFns"]);
3165
+ const direction = useDirection();
3166
+ icons = useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
3167
+ localization = useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
3168
+ aggregationFns = useMemo(() => (Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns)), []);
3169
+ filterFns = useMemo(() => (Object.assign(Object.assign({}, MRT_FilterFns), filterFns)), []);
3170
+ sortingFns = useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
3171
+ defaultColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), [defaultColumn]);
3172
+ defaultDisplayColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), [defaultDisplayColumn]);
3173
+ //cannot be changed after initialization
3174
+ [enableColumnVirtualization, enableRowVirtualization] = useMemo(() => [enableColumnVirtualization, enableRowVirtualization], []);
3175
+ if (!columnResizeDirection) {
3176
+ columnResizeDirection = direction.dir || 'ltr';
3177
+ }
3178
+ layoutMode =
3179
+ layoutMode || (enableColumnResizing ? 'grid-no-grow' : 'semantic');
3180
+ if (layoutMode === 'semantic' &&
3181
+ (enableRowVirtualization || enableColumnVirtualization)) {
3182
+ layoutMode = 'grid';
3183
+ }
3184
+ if (enableRowVirtualization) {
3185
+ enableStickyHeader = true;
3186
+ }
3187
+ if (enablePagination === false && manualPagination === undefined) {
3188
+ manualPagination = true;
3189
+ }
3190
+ if (!((_b = rest.data) === null || _b === void 0 ? void 0 : _b.length)) {
3191
+ manualFiltering = true;
3192
+ manualGrouping = true;
3193
+ manualPagination = true;
3194
+ manualSorting = true;
3195
+ }
3196
+ return Object.assign({ aggregationFns,
3197
+ autoResetExpanded,
3198
+ columnFilterDisplayMode,
3199
+ columnResizeDirection,
3200
+ columnResizeMode,
3201
+ createDisplayMode,
3202
+ defaultColumn,
3203
+ defaultDisplayColumn,
3204
+ editDisplayMode,
3205
+ enableBatchRowSelection,
3206
+ enableBottomToolbar,
3207
+ enableColumnActions,
3208
+ enableColumnFilters,
3209
+ enableColumnOrdering,
3210
+ enableColumnPinning,
3211
+ enableColumnResizing,
3212
+ enableColumnVirtualization,
3213
+ enableDensityToggle,
3214
+ enableExpandAll,
3215
+ enableExpanding,
3216
+ enableFacetedValues,
3217
+ enableFilterMatchHighlighting,
3218
+ enableFilters,
3219
+ enableFullScreenToggle,
3220
+ enableGlobalFilter,
3221
+ enableGlobalFilterRankedResults,
3222
+ enableGrouping,
3223
+ enableHeaderActionsHoverReveal,
3224
+ enableHiding,
3225
+ enableMultiRowSelection,
3226
+ enableMultiSort,
3227
+ enablePagination,
3228
+ enableRowPinning,
3229
+ enableRowSelection,
3230
+ enableRowVirtualization,
3231
+ enableSelectAll,
3232
+ enableSorting,
3233
+ enableStickyHeader,
3234
+ enableTableFooter,
3235
+ enableTableHead,
3236
+ enableToolbarInternalActions,
3237
+ enableTopToolbar,
3238
+ filterFns,
3239
+ //TanStack only checks the value in the first row, so a null there removes the column from the global filter
3240
+ getColumnCanGlobalFilter: (column) => getColumnHasGlobalFilterValue(rest.data, column), getCoreRowModel: getCoreRowModel(), getExpandedRowModel: enableExpanding || enableGrouping ? getExpandedRowModel() : undefined, getFacetedMinMaxValues: enableFacetedValues
3241
+ ? getFacetedMinMaxValues()
3242
+ : undefined, getFacetedRowModel: enableFacetedValues ? getFacetedRowModel() : undefined, getFacetedUniqueValues: enableFacetedValues
3243
+ ? getFacetedUniqueValues()
3244
+ : undefined, getFilteredRowModel: enableColumnFilters || enableGlobalFilter || enableFilters
3245
+ ? getFilteredRowModel()
3246
+ : undefined, getGroupedRowModel: enableGrouping ? getGroupedRowModel() : undefined, getPaginationRowModel: enablePagination
3247
+ ? getPaginationRowModel()
3248
+ : undefined, getSortedRowModel: enableSorting ? getSortedRowModel() : undefined, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows, icons,
3249
+ layoutMode,
3250
+ localization,
3251
+ manualFiltering,
3252
+ manualGrouping,
3253
+ manualPagination,
3254
+ manualSorting,
3255
+ paginationDisplayMode,
3256
+ positionActionsColumn,
3257
+ positionCreatingRow,
3258
+ positionExpandColumn,
3259
+ positionGlobalFilter,
3260
+ positionPagination,
3261
+ positionToolbarAlertBanner,
3262
+ positionToolbarDropZone,
3263
+ rowNumberDisplayMode,
3264
+ rowPinningDisplayMode,
3265
+ selectAllMode,
3266
+ sortingFns }, rest);
3267
+ };
3268
+
3269
+ const blankColProps = {
3270
+ children: null,
3271
+ style: {
3272
+ minWidth: 0,
3273
+ padding: 0,
3274
+ width: 0,
3275
+ },
3276
+ };
3277
+ const getMRT_RowSpacerColumnDef = (tableOptions) => {
3278
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, defaultDisplayColumnProps({
3279
+ id: 'mrt-row-spacer',
3280
+ size: 0,
3281
+ tableOptions,
3282
+ })), { grow: true }), MRT_DefaultDisplayColumn), { mantineTableBodyCellProps: blankColProps, mantineTableFooterCellProps: blankColProps, mantineTableHeadCellProps: blankColProps });
3283
+ };
3284
+
3285
+ const useMRT_Effects = (table, rerenderTable) => {
3286
+ const { getIsSomeRowsPinned, getPrePaginationRowModel, getState, options: { enablePagination, enableRowPinning, rowCount }, } = table;
3287
+ const { columnOrder, density, globalFilter, isFullScreen, isLoading, pagination, showSkeletons, sorting, } = getState();
3288
+ const totalColumnCount = table.options.columns.length;
3289
+ const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
3290
+ //`rerenderTable` also changes the table reference, which compiled consumer code needs
3291
+ const rerenderSelf = useReducer(() => ({}), {})[1];
3292
+ const rerender = rerenderTable !== null && rerenderTable !== void 0 ? rerenderTable : rerenderSelf;
3293
+ const initialBodyHeight = useRef(undefined);
3294
+ const previousTop = useRef(undefined);
3295
+ useEffect(() => {
3296
+ if (typeof window !== 'undefined') {
3297
+ initialBodyHeight.current = document.body.style.height;
3298
+ }
3299
+ }, []);
3300
+ //hide scrollbars when table is in full screen mode, preserve body scroll position after full screen exit
3301
+ useEffect(() => {
3302
+ if (typeof window !== 'undefined') {
3303
+ if (isFullScreen) {
3304
+ previousTop.current = document.body.getBoundingClientRect().top; //save scroll position
3305
+ document.body.style.height = '100dvh'; //hide page scrollbars when table is in full screen mode
3306
+ }
3307
+ else {
3308
+ document.body.style.height = initialBodyHeight.current;
3309
+ if (!previousTop.current)
3310
+ return;
3311
+ //restore scroll position
3312
+ window.scrollTo({
3313
+ behavior: 'instant',
3314
+ top: -1 * previousTop.current,
3315
+ });
3316
+ }
3317
+ }
3318
+ }, [isFullScreen]);
3319
+ //recalculate column order when columns change or features are toggled on/off
3320
+ useEffect(() => {
3321
+ if (totalColumnCount !== columnOrder.length) {
3322
+ table.setColumnOrder(getDefaultColumnOrderIds(table.options));
3323
+ }
3324
+ }, [totalColumnCount]);
3325
+ //if page index is out of bounds, set it to the last page
3326
+ useEffect(() => {
3327
+ if (!enablePagination || isLoading || showSkeletons)
3328
+ return;
3329
+ const { pageIndex, pageSize } = pagination;
3330
+ const firstVisibleRowIndex = pageIndex * pageSize;
3331
+ if (firstVisibleRowIndex >= totalRowCount && firstVisibleRowIndex > 0) {
3332
+ table.setPageIndex(Math.ceil(totalRowCount / pageSize) - 1);
3333
+ }
3334
+ }, [totalRowCount]);
3335
+ //turn off sort when global filter is looking for ranked results
3336
+ const appliedSort = useRef(sorting);
3337
+ useEffect(() => {
3338
+ if (sorting.length) {
3339
+ appliedSort.current = sorting;
3340
+ }
3341
+ }, [sorting]);
3342
+ useEffect(() => {
3343
+ if (!getCanRankRows(table))
3344
+ return;
3345
+ if (globalFilter) {
3346
+ table.setSorting([]);
3347
+ }
3348
+ else {
3349
+ table.setSorting(() => appliedSort.current || []);
3350
+ }
3351
+ }, [globalFilter]);
3352
+ //fix pinned row top style when density changes
3353
+ useEffect(() => {
3354
+ if (enableRowPinning && getIsSomeRowsPinned()) {
3355
+ setTimeout(() => {
3356
+ rerender();
3357
+ }, 150);
3358
+ }
3359
+ }, [density]);
3360
+ };
3361
+
3362
+ /**
3363
+ * The MRT hook that wraps the TanStack useReactTable hook and adds additional functionality
3364
+ * @param definedTableOptions - table options with proper defaults set
3365
+ * @param rerender - re-renders the owner of the table instance and changes the table reference
3366
+ * @returns the MRT table instance
3367
+ */
3368
+ const useMRT_TableInstance = (definedTableOptions, rerender) => {
3369
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
3370
+ const lastSelectedRowId = useRef(null);
3371
+ const bottomToolbarRef = useRef(null);
3372
+ const editInputRefs = useRef({});
3373
+ const filterInputRefs = useRef({});
3374
+ const scrollAreaViewportRef = useRef(null);
3375
+ const searchInputRef = useRef(null);
3376
+ const tableContainerRef = useRef(null);
3377
+ const tableHeadCellRefs = useRef({});
3378
+ const tablePaperRef = useRef(null);
3379
+ const topToolbarRef = useRef(null);
3380
+ const tableHeadRef = useRef(null);
3381
+ const tableFooterRef = useRef(null);
3382
+ //transform initial state with proper column order
3383
+ const initialState = useMemo(() => {
3384
+ var _a, _b, _c;
3385
+ const initState = (_a = definedTableOptions.initialState) !== null && _a !== void 0 ? _a : {};
3386
+ initState.columnOrder =
3387
+ (_b = initState.columnOrder) !== null && _b !== void 0 ? _b : getDefaultColumnOrderIds(Object.assign(Object.assign({}, definedTableOptions), { state: Object.assign(Object.assign({}, definedTableOptions.initialState), definedTableOptions.state) }));
3388
+ initState.globalFilterFn = (_c = definedTableOptions.globalFilterFn) !== null && _c !== void 0 ? _c : 'fuzzy';
3389
+ return initState;
3390
+ }, []);
3391
+ definedTableOptions.initialState = initialState;
3392
+ const [creatingRow, _setCreatingRow] = useState((_a = initialState.creatingRow) !== null && _a !== void 0 ? _a : null);
3393
+ const [columnFilterFns, setColumnFilterFns] = useState(() => Object.assign({}, ...getAllLeafColumnDefs(definedTableOptions.columns).map((col) => {
3394
+ var _a, _b, _c, _d;
3395
+ return ({
3396
+ [getColumnId(col)]: col.filterFn instanceof Function
3397
+ ? ((_a = col.filterFn.name) !== null && _a !== void 0 ? _a : 'custom')
3398
+ : ((_d = (_b = col.filterFn) !== null && _b !== void 0 ? _b : (_c = initialState === null || initialState === void 0 ? void 0 : initialState.columnFilterFns) === null || _c === void 0 ? void 0 : _c[getColumnId(col)]) !== null && _d !== void 0 ? _d : getDefaultColumnFilterFn(col)),
3399
+ });
3400
+ })));
3401
+ const [columnOrder, onColumnOrderChange] = useState((_b = initialState.columnOrder) !== null && _b !== void 0 ? _b : []);
3402
+ const [columnSizingInfo, onColumnSizingInfoChange] = useState((_c = initialState.columnSizingInfo) !== null && _c !== void 0 ? _c : {});
3403
+ const [density, setDensity] = useState((_d = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _d !== void 0 ? _d : 'md');
3404
+ const [draggingColumn, setDraggingColumn] = useState((_e = initialState.draggingColumn) !== null && _e !== void 0 ? _e : null);
3405
+ const [draggingRow, setDraggingRow] = useState((_f = initialState.draggingRow) !== null && _f !== void 0 ? _f : null);
3406
+ const [editingCell, setEditingCell] = useState((_g = initialState.editingCell) !== null && _g !== void 0 ? _g : null);
3407
+ const [editingRow, setEditingRow] = useState((_h = initialState.editingRow) !== null && _h !== void 0 ? _h : null);
3408
+ const [globalFilterFn, setGlobalFilterFn] = useState((_j = initialState.globalFilterFn) !== null && _j !== void 0 ? _j : 'fuzzy');
3409
+ const [grouping, onGroupingChange] = useState((_k = initialState.grouping) !== null && _k !== void 0 ? _k : []);
3410
+ const [hoveredColumn, setHoveredColumn] = useState((_l = initialState.hoveredColumn) !== null && _l !== void 0 ? _l : null);
3411
+ const [hoveredRow, setHoveredRow] = useState((_m = initialState.hoveredRow) !== null && _m !== void 0 ? _m : null);
3412
+ const [isFullScreen, setIsFullScreen] = useState((_o = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _o !== void 0 ? _o : false);
3413
+ const [pagination, onPaginationChange] = useState((_p = initialState === null || initialState === void 0 ? void 0 : initialState.pagination) !== null && _p !== void 0 ? _p : { pageIndex: 0, pageSize: 10 });
3414
+ const [showAlertBanner, setShowAlertBanner] = useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showAlertBanner) !== null && _q !== void 0 ? _q : false);
3415
+ const [showColumnFilters, setShowColumnFilters] = useState((_r = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _r !== void 0 ? _r : false);
3416
+ const [showGlobalFilter, setShowGlobalFilter] = useState((_s = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _s !== void 0 ? _s : false);
3417
+ const [showToolbarDropZone, setShowToolbarDropZone] = useState((_t = initialState === null || initialState === void 0 ? void 0 : initialState.showToolbarDropZone) !== null && _t !== void 0 ? _t : false);
3418
+ definedTableOptions.state = Object.assign({ columnFilterFns,
3419
+ columnOrder,
3420
+ columnSizingInfo,
3421
+ creatingRow,
3422
+ density,
3423
+ draggingColumn,
3424
+ draggingRow,
3425
+ editingCell,
3426
+ editingRow,
3427
+ globalFilterFn,
3428
+ grouping,
3429
+ hoveredColumn,
3430
+ hoveredRow,
3431
+ isFullScreen,
3432
+ pagination,
3433
+ showAlertBanner,
3434
+ showColumnFilters,
3435
+ showGlobalFilter,
3436
+ showToolbarDropZone }, definedTableOptions.state);
3437
+ //The table options now include all state needed to help determine column visibility and order logic
3438
+ const statefulTableOptions = definedTableOptions;
3439
+ //don't recompute columnDefs while resizing column or dragging column/row
3440
+ const columnDefsRef = useRef([]);
3441
+ statefulTableOptions.columns =
3442
+ statefulTableOptions.state.columnSizingInfo.isResizingColumn ||
3443
+ statefulTableOptions.state.draggingColumn ||
3444
+ statefulTableOptions.state.draggingRow
3445
+ ? columnDefsRef.current
3446
+ : prepareColumns({
3447
+ columnDefs: [
3448
+ ...[
3449
+ showRowPinningColumn(statefulTableOptions) &&
3450
+ getMRT_RowPinningColumnDef(statefulTableOptions),
3451
+ showRowDragColumn(statefulTableOptions) &&
3452
+ getMRT_RowDragColumnDef(statefulTableOptions),
3453
+ showRowActionsColumn(statefulTableOptions) &&
3454
+ getMRT_RowActionsColumnDef(statefulTableOptions),
3455
+ showRowExpandColumn(statefulTableOptions) &&
3456
+ getMRT_RowExpandColumnDef(statefulTableOptions),
3457
+ showRowSelectionColumn(statefulTableOptions) &&
3458
+ getMRT_RowSelectColumnDef(statefulTableOptions),
3459
+ showRowNumbersColumn(statefulTableOptions) &&
3460
+ getMRT_RowNumbersColumnDef(statefulTableOptions),
3461
+ ].filter(Boolean),
3462
+ ...statefulTableOptions.columns,
3463
+ ...[
3464
+ showRowSpacerColumn(statefulTableOptions) &&
3465
+ getMRT_RowSpacerColumnDef(statefulTableOptions),
3466
+ ].filter(Boolean),
3467
+ ],
3468
+ tableOptions: statefulTableOptions,
3469
+ });
3470
+ columnDefsRef.current = statefulTableOptions.columns;
3471
+ //if loading, generate blank rows to show skeleton loaders
3472
+ statefulTableOptions.data = useMemo(() => (statefulTableOptions.state.isLoading ||
3473
+ statefulTableOptions.state.showSkeletons) &&
3474
+ !statefulTableOptions.data.length
3475
+ ? [
3476
+ ...Array(Math.min(statefulTableOptions.state.pagination.pageSize, 20)).fill(null),
3477
+ ].map(() => Object.assign(
3478
+ //`prepareColumns` skips a custom accessorFn for rows with this key
3479
+ { [Symbol.for('mrt-skeleton-row')]: true }, ...getAllLeafColumnDefs(statefulTableOptions.columns).map((col) => ({
3480
+ [getColumnId(col)]: null,
3481
+ }))))
3482
+ : statefulTableOptions.data, [
3483
+ statefulTableOptions.data,
3484
+ statefulTableOptions.state.isLoading,
3485
+ statefulTableOptions.state.showSkeletons,
3486
+ ]);
3487
+ //@ts-ignore
3488
+ const table = useReactTable(Object.assign(Object.assign({ onColumnOrderChange,
3489
+ onColumnSizingInfoChange,
3490
+ onGroupingChange,
3491
+ onPaginationChange }, statefulTableOptions), { globalFilterFn: (_u = statefulTableOptions.filterFns) === null || _u === void 0 ? void 0 : _u[globalFilterFn !== null && globalFilterFn !== void 0 ? globalFilterFn : 'fuzzy'] }));
3492
+ table.refs = {
3493
+ bottomToolbarRef,
3494
+ editInputRefs,
3495
+ filterInputRefs,
3496
+ lastSelectedRowId,
3497
+ scrollAreaViewportRef,
3498
+ searchInputRef,
3499
+ tableContainerRef,
3500
+ tableFooterRef,
3501
+ tableHeadCellRefs,
3502
+ tableHeadRef,
3503
+ tablePaperRef,
3504
+ topToolbarRef,
3505
+ };
3506
+ table.setCreatingRow = (row) => {
3507
+ let _row = row;
3508
+ if (row === true) {
3509
+ _row = createRow(table);
3510
+ }
3511
+ if (statefulTableOptions === null || statefulTableOptions === void 0 ? void 0 : statefulTableOptions.onCreatingRowChange) {
3512
+ statefulTableOptions.onCreatingRowChange(_row);
3513
+ }
3514
+ else {
3515
+ _setCreatingRow(_row);
3516
+ }
3517
+ };
3518
+ table.setColumnFilterFns =
3519
+ (_v = statefulTableOptions.onColumnFilterFnsChange) !== null && _v !== void 0 ? _v : setColumnFilterFns;
3520
+ table.setDensity = (_w = statefulTableOptions.onDensityChange) !== null && _w !== void 0 ? _w : setDensity;
3521
+ table.setDraggingColumn =
3522
+ (_x = statefulTableOptions.onDraggingColumnChange) !== null && _x !== void 0 ? _x : setDraggingColumn;
3523
+ table.setDraggingRow =
3524
+ (_y = statefulTableOptions.onDraggingRowChange) !== null && _y !== void 0 ? _y : setDraggingRow;
3525
+ table.setEditingCell =
3526
+ (_z = statefulTableOptions.onEditingCellChange) !== null && _z !== void 0 ? _z : setEditingCell;
3527
+ table.setEditingRow =
3528
+ (_0 = statefulTableOptions.onEditingRowChange) !== null && _0 !== void 0 ? _0 : setEditingRow;
3529
+ table.setGlobalFilterFn =
3530
+ (_1 = statefulTableOptions.onGlobalFilterFnChange) !== null && _1 !== void 0 ? _1 : setGlobalFilterFn;
3531
+ table.setHoveredColumn =
3532
+ (_2 = statefulTableOptions.onHoveredColumnChange) !== null && _2 !== void 0 ? _2 : setHoveredColumn;
3533
+ table.setHoveredRow =
3534
+ (_3 = statefulTableOptions.onHoveredRowChange) !== null && _3 !== void 0 ? _3 : setHoveredRow;
3535
+ table.setIsFullScreen =
3536
+ (_4 = statefulTableOptions.onIsFullScreenChange) !== null && _4 !== void 0 ? _4 : setIsFullScreen;
3537
+ table.setShowAlertBanner =
3538
+ (_5 = statefulTableOptions.onShowAlertBannerChange) !== null && _5 !== void 0 ? _5 : setShowAlertBanner;
3539
+ table.setShowColumnFilters =
3540
+ (_6 = statefulTableOptions.onShowColumnFiltersChange) !== null && _6 !== void 0 ? _6 : setShowColumnFilters;
3541
+ table.setShowGlobalFilter =
3542
+ (_7 = statefulTableOptions.onShowGlobalFilterChange) !== null && _7 !== void 0 ? _7 : setShowGlobalFilter;
3543
+ table.setShowToolbarDropZone =
3544
+ (_8 = statefulTableOptions.onShowToolbarDropZoneChange) !== null && _8 !== void 0 ? _8 : setShowToolbarDropZone;
3545
+ useMRT_Effects(table, rerender);
3546
+ return table;
3547
+ };
3548
+
3549
+ const useMantineReactTable = (tableOptions) => {
3550
+ const [version, rerender] = useReducer((v) => v + 1, 0);
3551
+ const table = useMRT_TableInstance(useMRT_TableOptions(tableOptions), rerender);
3552
+ return useMRT_TableSnapshot(table, tableOptions, version);
3553
+ };
3554
+
3555
+ var classes$8 = {"root":"MRT_TablePaper-module_root__q0v5L"};
3556
+
3557
+ var classes$7 = {"root":"MRT_TableContainer-module_root__JIsGB","root-scroll-area":"MRT_TableContainer-module_root-scroll-area__ZTVGY","root-sticky":"MRT_TableContainer-module_root-sticky__uC4qx","root-fullscreen":"MRT_TableContainer-module_root-fullscreen__aM8Jg"};
3558
+
3559
+ var classes$6 = {"root":"MRT_Table-module_root__ms2uS","root-grid":"MRT_Table-module_root-grid__2Pynz"};
3560
+
3561
+ const useMRT_ColumnVirtualizer = (table) => {
3562
+ var _a, _b, _c, _d;
3563
+ const { getLeftLeafColumns, getRightLeafColumns, getState, getVisibleLeafColumns, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, enableColumnPinning, enableColumnVirtualization, }, refs: { scrollAreaViewportRef, tableContainerRef }, } = table;
3564
+ const { columnPinning, draggingColumn } = getState();
3565
+ if (!enableColumnVirtualization)
3566
+ return undefined;
3567
+ const columnVirtualizerProps = parseFromValuesOrFunc(columnVirtualizerOptions, {
3568
+ table,
3569
+ });
3570
+ const visibleColumns = getVisibleLeafColumns();
3571
+ const [leftPinnedIndexes, rightPinnedIndexes] = useMemo(() => enableColumnPinning
3572
+ ? [
3573
+ getLeftLeafColumns().map((c) => c.getPinnedIndex()),
3574
+ getRightLeafColumns()
3575
+ .map((column) => visibleColumns.length - column.getPinnedIndex() - 1)
3576
+ .sort((a, b) => a - b),
3577
+ ]
3578
+ : [[], []], [visibleColumns.length, columnPinning, enableColumnPinning]);
3579
+ const numPinnedLeft = leftPinnedIndexes.length;
3580
+ const numPinnedRight = rightPinnedIndexes.length;
3581
+ const draggingColumnIndex = useMemo(() => (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id)
3582
+ ? visibleColumns.findIndex((c) => c.id === (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id))
3583
+ : undefined, [draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id]);
3584
+ const columnVirtualizer = useVirtualizer(Object.assign({ count: visibleColumns.length, estimateSize: (index) => visibleColumns[index].getSize(), getScrollElement: () => { var _a; return (_a = scrollAreaViewportRef.current) !== null && _a !== void 0 ? _a : tableContainerRef.current; }, horizontal: true, overscan: 3, rangeExtractor: useCallback((range) => {
3585
+ const newIndexes = extraIndexRangeExtractor(range, draggingColumnIndex);
3586
+ if (!numPinnedLeft && !numPinnedRight) {
3587
+ return newIndexes;
3588
+ }
3589
+ return [
3590
+ ...new Set([
3591
+ ...leftPinnedIndexes,
3592
+ ...newIndexes,
3593
+ ...rightPinnedIndexes,
3594
+ ]),
3595
+ ];
3596
+ }, [leftPinnedIndexes, rightPinnedIndexes, draggingColumnIndex]) }, columnVirtualizerProps));
3597
+ useMRT_VirtualizerScrollElement(columnVirtualizer);
3598
+ const virtualColumns = columnVirtualizer.getVirtualItems();
3599
+ columnVirtualizer.virtualColumns = virtualColumns;
3600
+ const numColumns = virtualColumns.length;
3601
+ if (numColumns) {
3602
+ const totalSize = columnVirtualizer.getTotalSize();
3603
+ const leftNonPinnedStart = ((_a = virtualColumns[numPinnedLeft]) === null || _a === void 0 ? void 0 : _a.start) || 0;
3604
+ const leftNonPinnedEnd = ((_b = virtualColumns[leftPinnedIndexes.length - 1]) === null || _b === void 0 ? void 0 : _b.end) || 0;
3605
+ const rightNonPinnedStart = ((_c = virtualColumns[numColumns - numPinnedRight]) === null || _c === void 0 ? void 0 : _c.start) || 0;
3606
+ const rightNonPinnedEnd = ((_d = virtualColumns[numColumns - numPinnedRight - 1]) === null || _d === void 0 ? void 0 : _d.end) || 0;
3607
+ columnVirtualizer.virtualPaddingLeft =
3608
+ leftNonPinnedStart - leftNonPinnedEnd;
3609
+ columnVirtualizer.virtualPaddingRight =
3610
+ totalSize -
3611
+ rightNonPinnedEnd -
3612
+ (numPinnedRight ? totalSize - rightNonPinnedStart : 0);
3613
+ }
3614
+ if (columnVirtualizerInstanceRef) {
3615
+ //@ts-ignore
3616
+ columnVirtualizerInstanceRef.current = columnVirtualizer;
3617
+ }
3618
+ return columnVirtualizer;
3619
+ };
3620
+
3621
+ const MRT_Table = (_a) => {
3622
+ var { table } = _a, rest = __rest(_a, ["table"]);
3623
+ const { getFlatHeaders, getState, options: { columns, enableTableFooter, enableTableHead, layoutMode, mantineScrollAreaProps, mantineTableProps, memoMode, withScrollArea, }, } = table;
3624
+ const { columnSizing, columnSizingInfo, columnVisibility, density } = getState();
3625
+ const tableProps = Object.assign(Object.assign({ highlightOnHover: true, horizontalSpacing: density, verticalSpacing: density }, parseFromValuesOrFunc(mantineTableProps, { table })), rest);
3626
+ const columnSizeVars = useMemo(() => {
3627
+ const headers = getFlatHeaders();
3628
+ const colSizes = {};
3629
+ for (let i = 0; i < headers.length; i++) {
3630
+ const header = headers[i];
3631
+ const colSize = header.getSize();
3632
+ colSizes[`--header-${parseCSSVarId(header.id)}-size`] = colSize;
3633
+ colSizes[`--col-${parseCSSVarId(header.column.id)}-size`] = colSize;
3634
+ }
3635
+ return colSizes;
3636
+ }, [columns, columnSizing, columnSizingInfo, columnVisibility]);
3637
+ const columnVirtualizer = useMRT_ColumnVirtualizer(table);
3638
+ const commonTableGroupProps = {
3639
+ columnVirtualizer,
3640
+ table,
3641
+ };
3642
+ const { colorScheme } = useMantineColorScheme();
3643
+ const { stripedColor } = tableProps;
3644
+ const tableNode = (jsxs(Table, Object.assign({ className: clsx('mrt-table', classes$6.root, (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) && classes$6['root-grid'], tableProps.className) }, tableProps, { __vars: Object.assign(Object.assign(Object.assign({}, columnSizeVars), { '--mrt-striped-row-background-color': stripedColor, '--mrt-striped-row-hover-background-color': stripedColor
3645
+ ? colorScheme === 'dark'
3646
+ ? lighten(stripedColor, 0.08)
3647
+ : darken(stripedColor, 0.12)
3648
+ : undefined }), tableProps.__vars), children: [enableTableHead && jsx(MRT_TableHead, Object.assign({}, commonTableGroupProps)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsx(Memo_MRT_TableBody, Object.assign({}, commonTableGroupProps, { tableProps: tableProps }))) : (jsx(MRT_TableBody, Object.assign({}, commonTableGroupProps, { tableProps: tableProps }))), enableTableFooter && jsx(MRT_TableFooter, Object.assign({}, commonTableGroupProps))] })));
3649
+ if (!withScrollArea)
3650
+ return tableNode;
3651
+ const _b = Object.assign({ h: '100%', minWidth: '100%', offsetScrollbars: 'present', w: '100%' }, parseFromValuesOrFunc(mantineScrollAreaProps, { table })), { ref: scrollAreaRef, viewportRef } = _b, scrollContainerProps = __rest(_b, ["ref", "viewportRef"]);
3652
+ return (jsx(Table.ScrollContainer, Object.assign({}, scrollContainerProps, { className: clsx('mrt-table-scroll-area', scrollContainerProps.className),
3653
+ //Mantine hands over the viewport itself, and null when it unmounts, so
3654
+ //the ref does not depend on a class name and never keeps a removed node
3655
+ scrollAreaProps: Object.assign(Object.assign({}, scrollContainerProps.scrollAreaProps), { viewportRef: (node) => {
3656
+ var _a;
3657
+ table.refs.scrollAreaViewportRef.current = node;
3658
+ assignRef(scrollAreaRef, node);
3659
+ assignRef(viewportRef, node);
3660
+ assignRef((_a = scrollContainerProps.scrollAreaProps) === null || _a === void 0 ? void 0 : _a.viewportRef, node);
3661
+ } }), children: tableNode })));
3662
+ };
3663
+
3664
+ const MRT_EditRowModal = (_a) => {
3665
+ var _b;
3666
+ var { open, table } = _a, rest = __rest(_a, ["open", "table"]);
3667
+ const { getState, options: { mantineCreateRowModalProps, mantineEditRowModalProps, onCreatingRowCancel, onEditingRowCancel, renderCreateRowModalContent, renderEditRowModalContent, }, setCreatingRow, setEditingRow, } = table;
3668
+ const { creatingRow, editingRow } = getState();
3669
+ const row = (creatingRow !== null && creatingRow !== void 0 ? creatingRow : editingRow);
3670
+ const arg = { row, table };
3671
+ const modalProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineEditRowModalProps, arg)), (creatingRow && parseFromValuesOrFunc(mantineCreateRowModalProps, arg))), rest);
3672
+ const internalEditComponents = row
3673
+ .getAllCells()
3674
+ .filter((cell) => cell.column.columnDef.columnDefType === 'data')
3675
+ .map((cell) => (jsx(MRT_EditCellTextInput, { cell: cell, table: table }, cell.id)));
3676
+ const handleCancel = () => {
3677
+ var _a;
3678
+ if (creatingRow) {
3679
+ onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
3680
+ setCreatingRow(null);
3681
+ }
3682
+ else {
3683
+ onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
3684
+ setEditingRow(null);
3685
+ }
3686
+ row._valuesCache = {}; //reset values cache
3687
+ (_a = modalProps.onClose) === null || _a === void 0 ? void 0 : _a.call(modalProps);
3688
+ };
3689
+ return (createElement(Modal, Object.assign({ opened: open, withCloseButton: false }, modalProps, { key: row.id, onClose: handleCancel }), (_b = ((creatingRow &&
3690
+ (renderCreateRowModalContent === null || renderCreateRowModalContent === void 0 ? void 0 : renderCreateRowModalContent({
3691
+ internalEditComponents,
3692
+ row,
3693
+ table,
3694
+ }))) ||
3695
+ (renderEditRowModalContent === null || renderEditRowModalContent === void 0 ? void 0 : renderEditRowModalContent({
3696
+ internalEditComponents,
3697
+ row,
3698
+ table,
3699
+ })))) !== null && _b !== void 0 ? _b : (jsxs(Fragment, { children: [jsx("form", { onSubmit: (e) => e.preventDefault(), children: jsx(Stack, { gap: "lg", pb: 24, pt: 16, children: internalEditComponents }) }), jsx(Flex, { justify: "flex-end", children: jsx(MRT_EditActionButtons, { row: row, table: table, variant: "text" }) })] }))));
3700
+ };
3701
+
3702
+ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
3703
+ const MRT_TableContainer = (_a) => {
3704
+ var _b;
3705
+ var { table } = _a, rest = __rest(_a, ["table"]);
3706
+ const { getState, options: { createDisplayMode, editDisplayMode, enableStickyHeader, mantineLoadingOverlayProps, mantineTableContainerProps, withScrollArea, }, refs: { bottomToolbarRef, tableContainerRef, tableHeadRef, topToolbarRef }, } = table;
3707
+ const { creatingRow, density, editingRow, isFullScreen, isLoading, showLoadingOverlay, } = getState();
3708
+ const [totalToolbarHeight, setTotalToolbarHeight] = useState(0);
3709
+ const [scrollOffset, setScrollOffset] = useState(0);
3710
+ const tableContainerProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineTableContainerProps, { table })), rest);
3711
+ const loadingOverlayProps = parseFromValuesOrFunc(mantineLoadingOverlayProps, { table });
3712
+ useIsomorphicLayoutEffect(() => {
3713
+ var _a, _b, _c, _d;
3714
+ const topToolbarHeight = typeof document !== 'undefined'
3715
+ ? ((_b = (_a = topToolbarRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0)
3716
+ : 0;
3717
+ const bottomToolbarHeight = typeof document !== 'undefined'
3718
+ ? ((_d = (_c = bottomToolbarRef === null || bottomToolbarRef === void 0 ? void 0 : bottomToolbarRef.current) === null || _c === void 0 ? void 0 : _c.offsetHeight) !== null && _d !== void 0 ? _d : 0)
3719
+ : 0;
3720
+ setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
3721
+ }); //no dependency list: the bottom toolbar ref attaches after this effect first runs
3722
+ useIsomorphicLayoutEffect(() => {
3723
+ const setOffset = () => {
3724
+ var _a, _b;
3725
+ const offset = typeof document !== 'undefined'
3726
+ ? ((_b = (_a = tableHeadRef === null || tableHeadRef === void 0 ? void 0 : tableHeadRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0)
3727
+ : 0;
3728
+ setScrollOffset(offset);
3729
+ };
3730
+ setOffset();
3731
+ const timeout = setTimeout(setOffset, 150);
3732
+ return () => clearTimeout(timeout);
3733
+ }, [(_b = tableHeadRef === null || tableHeadRef === void 0 ? void 0 : tableHeadRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight, density]);
3734
+ const createModalOpen = createDisplayMode === 'modal' && creatingRow;
3735
+ const editModalOpen = editDisplayMode === 'modal' && editingRow;
3736
+ return (jsxs(Box, Object.assign({}, tableContainerProps, { __vars: Object.assign({ '--mrt-scroll-offset': `${scrollOffset}px`, '--mrt-top-toolbar-height': `${totalToolbarHeight}` }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.__vars), className: clsx('mrt-table-container', classes$7.root, enableStickyHeader && classes$7['root-sticky'], isFullScreen && classes$7['root-fullscreen'], withScrollArea && classes$7['root-scroll-area'], tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.className), ref: (node) => {
3737
+ if (node) {
3738
+ tableContainerRef.current = node;
3739
+ assignRef(tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref, node);
3740
+ }
3741
+ }, children: [jsx(LoadingOverlay, Object.assign({ visible: isLoading || showLoadingOverlay, zIndex: 2 }, loadingOverlayProps)), jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsx(MRT_EditRowModal, { open: true, table: table }))] })));
3742
+ };
3743
+
3744
+ var commonClasses = {"common-toolbar-styles":"common-styles-module_common-toolbar-styles__DnjR8"};
3745
+
3746
+ var classes$5 = {"root":"MRT_BottomToolbar-module_root__VDeWo","root-fullscreen":"MRT_BottomToolbar-module_root-fullscreen__esE15","custom-toolbar-container":"MRT_BottomToolbar-module_custom-toolbar-container__XcDRF","paginator-container":"MRT_BottomToolbar-module_paginator-container__A3eWY","paginator-container-alert-banner":"MRT_BottomToolbar-module_paginator-container-alert-banner__gyqtO"};
3747
+
3748
+ var classes$4 = {"collapse":"MRT_ProgressBar-module_collapse__rOLJH","collapse-top":"MRT_ProgressBar-module_collapse-top__oCi0h"};
3749
+
3750
+ const MRT_ProgressBar = (_a) => {
3751
+ var { isTopToolbar, table } = _a, rest = __rest(_a, ["isTopToolbar", "table"]);
3752
+ const { getState, options: { mantineProgressProps }, } = table;
3753
+ const { isSaving, showProgressBars } = getState();
3754
+ const linearProgressProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineProgressProps, {
3755
+ isTopToolbar,
3756
+ table,
3757
+ })), rest);
3758
+ return (jsx(Collapse, { className: clsx(classes$4.collapse, isTopToolbar && classes$4['collapse-top']), expanded: isSaving || showProgressBars, children: jsx(Progress, Object.assign({ animated: true, "aria-busy": "true", "aria-label": "Loading", radius: 0, value: 100 }, linearProgressProps)) }));
3759
+ };
3760
+
3761
+ var classes$3 = {"root":"MRT_TablePagination-module_root__yZ8pm","pagesize":"MRT_TablePagination-module_pagesize__-vmTn","with-top-margin":"MRT_TablePagination-module_with-top-margin__aM5-m"};
3762
+
3763
+ const defaultRowsPerPage = [5, 10, 15, 20, 25, 30, 50, 100].map((x) => x.toString());
3764
+ const MRT_TablePagination = (_a) => {
3765
+ var _b;
3766
+ var { position = 'bottom', table } = _a, props = __rest(_a, ["position", "table"]);
3767
+ const { getPrePaginationRowModel, getState, options: { enableToolbarInternalActions, icons: { IconChevronLeft, IconChevronLeftPipe, IconChevronRight, IconChevronRightPipe, }, localization, mantinePaginationProps, paginationDisplayMode, rowCount, }, setPageIndex, setPageSize, } = table;
3768
+ const { pagination: { pageIndex = 0, pageSize = 10 }, showGlobalFilter, } = getState();
3769
+ const paginationProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantinePaginationProps, {
3770
+ table,
3771
+ })), props);
3772
+ const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
3773
+ const numberOfPages = Math.ceil(totalRowCount / pageSize);
3774
+ const showFirstLastPageButtons = numberOfPages > 2;
3775
+ const firstRowIndex = pageIndex * pageSize;
3776
+ const lastRowIndex = Math.min(pageIndex * pageSize + pageSize, totalRowCount);
3777
+ const _c = paginationProps !== null && paginationProps !== void 0 ? paginationProps : {}, { rowsPerPageOptions = defaultRowsPerPage, showRowsPerPage = true, withEdges = showFirstLastPageButtons } = _c, rest = __rest(_c, ["rowsPerPageOptions", "showRowsPerPage", "withEdges"]);
3778
+ const needsTopMargin = position === 'top' && enableToolbarInternalActions && !showGlobalFilter;
3779
+ //the 'pages' mode passes these to the Mantine Pagination component instead
3780
+ const isDefaultDisplayMode = paginationDisplayMode === 'default';
3781
+ const { styleProps } = extractStyleProps(rest);
3782
+ return (jsxs(Box, Object.assign({}, (isDefaultDisplayMode ? styleProps : undefined), { className: clsx('mrt-table-pagination', classes$3.root, needsTopMargin && classes$3['with-top-margin'], isDefaultDisplayMode && rest.className), style: isDefaultDisplayMode ? rest.style : undefined, children: [(paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.showRowsPerPage) !== false && (jsxs(Group, { gap: "xs", children: [jsx(Text, { id: "rpp-label", children: localization.rowsPerPage }), jsx(Select, { allowDeselect: false, "aria-labelledby": "rpp-label", className: classes$3.pagesize, data: (_b = paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.rowsPerPageOptions) !== null && _b !== void 0 ? _b : defaultRowsPerPage, onChange: (value) => setPageSize(+value), value: pageSize.toString() })] })), paginationDisplayMode === 'pages' ? (jsx(Pagination, Object.assign({ firstIcon: IconChevronLeftPipe, lastIcon: IconChevronRightPipe, nextIcon: IconChevronRight, onChange: (newPageIndex) => setPageIndex(newPageIndex - 1), previousIcon: IconChevronLeft, total: numberOfPages, value: pageIndex + 1, withEdges: withEdges }, rest))) : paginationDisplayMode === 'default' ? (jsxs(Fragment, { children: [jsx(Text, { children: `${lastRowIndex === 0 ? 0 : (firstRowIndex + 1).toLocaleString()}-${lastRowIndex.toLocaleString()} ${localization.of} ${totalRowCount.toLocaleString()}` }), jsxs(Group, { gap: 6, children: [withEdges && (jsx(ActionIcon, { "aria-label": localization.goToFirstPage, color: "gray", disabled: pageIndex <= 0, onClick: () => setPageIndex(0), variant: "subtle", children: jsx(IconChevronLeftPipe, {}) })), jsx(ActionIcon, { "aria-label": localization.goToPreviousPage, color: "gray", disabled: pageIndex <= 0, onClick: () => setPageIndex(pageIndex - 1), variant: "subtle", children: jsx(IconChevronLeft, {}) }), jsx(ActionIcon, { "aria-label": localization.goToNextPage, color: "gray", disabled: lastRowIndex >= totalRowCount, onClick: () => setPageIndex(pageIndex + 1), variant: "subtle", children: jsx(IconChevronRight, {}) }), withEdges && (jsx(ActionIcon, { "aria-label": localization.goToLastPage, color: "gray", disabled: lastRowIndex >= totalRowCount, onClick: () => setPageIndex(numberOfPages - 1), variant: "subtle", children: jsx(IconChevronRightPipe, {}) }))] })] })) : null] })));
3783
+ };
3784
+
3785
+ var classes$2 = {"root":"MRT_ToolbarDropZone-module_root__eGTXb","hovered":"MRT_ToolbarDropZone-module_hovered__g7PeJ"};
3786
+
3787
+ const MRT_ToolbarDropZone = (_a) => {
3788
+ var { table } = _a, rest = __rest(_a, ["table"]);
3789
+ const { getState, options: { enableGrouping, localization }, setHoveredColumn, setShowToolbarDropZone, } = table;
3790
+ const { draggingColumn, grouping, hoveredColumn, showToolbarDropZone } = getState();
3791
+ const handleDragEnter = (_event) => {
3792
+ setHoveredColumn({ id: 'drop-zone' });
3793
+ };
3794
+ useEffect(() => {
3795
+ var _a;
3796
+ if (((_a = table.options.state) === null || _a === void 0 ? void 0 : _a.showToolbarDropZone) !== undefined) {
3797
+ setShowToolbarDropZone(!!enableGrouping &&
3798
+ !!draggingColumn &&
3799
+ draggingColumn.columnDef.enableGrouping !== false &&
3800
+ !grouping.includes(draggingColumn.id));
3801
+ }
3802
+ }, [enableGrouping, draggingColumn, grouping]);
3803
+ return (jsx(Transition, { mounted: showToolbarDropZone, transition: "fade", children: () => {
3804
+ var _a, _b;
3805
+ return (jsx(Flex, Object.assign({ className: clsx('mrt-toolbar-dropzone', classes$2.root, (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone' && classes$2.hovered), onDragEnter: handleDragEnter }, rest, { children: jsx(Text, { children: localization.dropToGroupBy.replace('{column}', (_b = (_a = draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.columnDef) === null || _a === void 0 ? void 0 : _a.header) !== null && _b !== void 0 ? _b : '') }) })));
3806
+ } }));
3807
+ };
3808
+
3809
+ const MRT_BottomToolbar = (_a) => {
3810
+ var { table } = _a, rest = __rest(_a, ["table"]);
3811
+ const { getState, options: { enablePagination, mantineBottomToolbarProps, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderBottomToolbarCustomActions, }, refs: { bottomToolbarRef }, } = table;
3812
+ const { isFullScreen } = getState();
3813
+ const isMobile = useMediaQuery('(max-width: 720px)');
3814
+ const toolbarProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineBottomToolbarProps, {
3815
+ table,
3816
+ })), rest);
3817
+ const stackAlertBanner = isMobile || !!renderBottomToolbarCustomActions;
3818
+ return (jsxs(Box, Object.assign({}, toolbarProps, { className: clsx('mrt-bottom-toolbar', classes$5.root, commonClasses['common-toolbar-styles'], isFullScreen && classes$5['root-fullscreen'], toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.className), ref: (node) => {
3819
+ if (node) {
3820
+ bottomToolbarRef.current = node;
3821
+ assignRef(toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.ref, node);
3822
+ }
3823
+ }, children: [jsx(MRT_ProgressBar, { isTopToolbar: false, table: table }), positionToolbarAlertBanner === 'bottom' && (jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })), ['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsx(MRT_ToolbarDropZone, { table: table })), jsxs(Box, { className: classes$5['custom-toolbar-container'], children: [renderBottomToolbarCustomActions ? (renderBottomToolbarCustomActions({ table })) : (jsx("span", {})), jsx(Box, { className: clsx(classes$5['paginator-container'], stackAlertBanner && classes$5['paginator-container-alert-banner']), children: enablePagination &&
3824
+ ['both', 'bottom'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (jsx(MRT_TablePagination, { position: "bottom", table: table })) })] })] })));
3825
+ };
3826
+
3827
+ var classes$1 = {"root":"MRT_TopToolbar-module_root__r4-V9","root-fullscreen":"MRT_TopToolbar-module_root-fullscreen__3itT8","actions-container":"MRT_TopToolbar-module_actions-container__-uL0u","actions-container-stack-alert":"MRT_TopToolbar-module_actions-container-stack-alert__OYDL6"};
3828
+
3829
+ var classes = {"root":"MRT_ToolbarInternalButtons-module_root__NKoUG"};
3830
+
3831
+ const MRT_ToolbarInternalButtons = (_a) => {
3832
+ var _b;
3833
+ var { table } = _a, rest = __rest(_a, ["table"]);
3834
+ const { options: { columnFilterDisplayMode, enableColumnFilters, enableColumnOrdering, enableColumnPinning, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, initialState, renderToolbarInternalActions, }, } = table;
3835
+ return (jsx(Flex, Object.assign({}, rest, { className: clsx('mrt-toolbar-internal-buttons', classes.root, rest === null || rest === void 0 ? void 0 : rest.className), children: (_b = renderToolbarInternalActions === null || renderToolbarInternalActions === void 0 ? void 0 : renderToolbarInternalActions({ table })) !== null && _b !== void 0 ? _b : (jsxs(Fragment, { children: [enableFilters &&
3836
+ enableGlobalFilter &&
3837
+ !(initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) && (jsx(MRT_ToggleGlobalFilterButton, { table: table })), enableFilters &&
3838
+ enableColumnFilters &&
3839
+ columnFilterDisplayMode !== 'popover' && (jsx(MRT_ToggleFiltersButton, { table: table })), (enableHiding || enableColumnOrdering || enableColumnPinning) && (jsx(MRT_ShowHideColumnsButton, { table: table })), enableDensityToggle && (jsx(MRT_ToggleDensePaddingButton, { table: table })), enableFullScreenToggle && (jsx(MRT_ToggleFullScreenButton, { table: table }))] })) })));
3840
+ };
3841
+
3842
+ const MRT_TopToolbar = (_a) => {
3843
+ var _b;
3844
+ var { table } = _a, rest = __rest(_a, ["table"]);
3845
+ const { getState, options: { enableGlobalFilter, enablePagination, enableToolbarInternalActions, mantineTopToolbarProps, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderTopToolbarCustomActions, }, refs: { topToolbarRef }, } = table;
3846
+ const { isFullScreen, showGlobalFilter } = getState();
3847
+ const isMobile = useMediaQuery('(max-width:720px)');
3848
+ const isTablet = useMediaQuery('(max-width:1024px)');
3849
+ const toolbarProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantineTopToolbarProps, { table })), rest);
3850
+ const stackAlertBanner = isMobile ||
3851
+ !!renderTopToolbarCustomActions ||
3852
+ (showGlobalFilter && isTablet);
3853
+ const globalFilterProps = {
3854
+ style: !isTablet
3855
+ ? {
3856
+ zIndex: 3,
3857
+ }
3858
+ : undefined,
3859
+ table,
3860
+ };
3861
+ return (jsxs(Box, Object.assign({}, toolbarProps, { className: clsx(commonClasses['common-toolbar-styles'], classes$1['root'], isFullScreen && classes$1['root-fullscreen'], toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.className), ref: (node) => {
3862
+ if (node) {
3863
+ topToolbarRef.current = node;
3864
+ assignRef(toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.ref, node);
3865
+ }
3866
+ }, children: [positionToolbarAlertBanner === 'top' && (jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })), ['both', 'top'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsx(MRT_ToolbarDropZone, { table: table })), jsxs(Flex, { className: clsx(classes$1['actions-container'], stackAlertBanner && classes$1['actions-container-stack-alert']), children: [enableGlobalFilter && positionGlobalFilter === 'left' && (jsx(MRT_GlobalFilterTextInput, Object.assign({}, globalFilterProps))), (_b = renderTopToolbarCustomActions === null || renderTopToolbarCustomActions === void 0 ? void 0 : renderTopToolbarCustomActions({ table })) !== null && _b !== void 0 ? _b : jsx("span", {}), enableToolbarInternalActions ? (jsxs(Flex, { justify: 'end', wrap: 'wrap-reverse', children: [enableGlobalFilter && positionGlobalFilter === 'right' && (jsx(MRT_GlobalFilterTextInput, Object.assign({}, globalFilterProps))), jsx(MRT_ToolbarInternalButtons, { table: table })] })) : (enableGlobalFilter &&
3867
+ positionGlobalFilter === 'right' && (jsx(MRT_GlobalFilterTextInput, Object.assign({}, globalFilterProps))))] }), enablePagination &&
3868
+ ['both', 'top'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (jsx(Flex, { justify: "end", children: jsx(MRT_TablePagination, { position: "top", table: table }) })), jsx(MRT_ProgressBar, { isTopToolbar: true, table: table })] })));
3869
+ };
3870
+
3871
+ const MRT_TablePaper = (_a) => {
3872
+ var _b, _c;
3873
+ var { table } = _a, rest = __rest(_a, ["table"]);
3874
+ const { getState, options: { enableBottomToolbar, enableTopToolbar, mantinePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
3875
+ const { isFullScreen } = getState();
3876
+ const tablePaperProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(mantinePaperProps, { table })), rest);
3877
+ return (jsxs(Paper, Object.assign({ shadow: "xs", withBorder: true }, tablePaperProps, { className: clsx('mrt-table-paper', classes$8.root, isFullScreen && 'mrt-table-paper-fullscreen', tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.className), ref: (ref) => {
3878
+ tablePaperRef.current = ref;
3879
+ assignRef(tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.ref, ref);
3880
+ },
3881
+ // rare case where we should use inline styles to guarantee highest specificity
3882
+ style: (theme) => (Object.assign(Object.assign({ zIndex: isFullScreen ? 200 : undefined }, parseFromValuesOrFunc(tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style, theme)), (isFullScreen
3883
+ ? {
3884
+ border: 0,
3885
+ borderRadius: 0,
3886
+ bottom: 0,
3887
+ height: '100vh',
3888
+ left: 0,
3889
+ margin: 0,
3890
+ maxHeight: '100vh',
3891
+ maxWidth: '100vw',
3892
+ padding: 0,
3893
+ position: 'fixed',
3894
+ right: 0,
3895
+ top: 0,
3896
+ width: '100vw',
3897
+ }
3898
+ : null))), children: [enableTopToolbar &&
3899
+ ((_b = parseFromValuesOrFunc(renderTopToolbar, { table })) !== null && _b !== void 0 ? _b : (jsx(MRT_TopToolbar, { table: table }))), jsx(MRT_TableContainer, { table: table }), enableBottomToolbar &&
3900
+ ((_c = parseFromValuesOrFunc(renderBottomToolbar, { table })) !== null && _c !== void 0 ? _c : (jsx(MRT_BottomToolbar, { table: table })))] })));
3901
+ };
3902
+
3903
+ const isTableInstanceProp = (props) => props.table !== undefined;
3904
+ const MRT_TableFromOptions = (props) => jsx(MRT_TablePaper, { table: useMantineReactTable(props) });
3905
+ //two components keep the hook call unconditional (Rules of Hooks)
3906
+ const MantineReactTable = (props) => isTableInstanceProp(props) ? (jsx(MRT_TablePaper, { table: props.table })) : (jsx(MRT_TableFromOptions, Object.assign({}, props)));
3907
+
3908
+ export { MRT_AggregationFns, MRT_BottomToolbar, MRT_ColumnActionMenu, MRT_ColumnPinningButtons, MRT_CopyButton, MRT_DefaultColumn, MRT_DefaultDisplayColumn, MRT_EditActionButtons, MRT_EditCellTextInput, MRT_EditRowModal, MRT_ExpandAllButton, MRT_ExpandButton, MRT_FilterCheckbox, MRT_FilterFns, MRT_FilterOptionMenu, MRT_FilterRangeFields, MRT_FilterRangeSlider, MRT_FilterTextInput, MRT_GlobalFilterTextInput, MRT_GrabHandleButton, MRT_ProgressBar, MRT_RowActionMenu, MRT_RowPinButton, MRT_SelectCheckbox, MRT_ShowHideColumnsButton, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, MRT_SortingFns, MRT_Table, MRT_TableBody, MRT_TableBodyCell, MRT_TableBodyCellValue, MRT_TableBodyEmptyRow, MRT_TableBodyRow, MRT_TableBodyRowGrabHandle, MRT_TableBodyRowPinButton, MRT_TableContainer, MRT_TableDetailPanel, MRT_TableFooter, MRT_TableFooterCell, MRT_TableFooterRow, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellFilterContainer, MRT_TableHeadCellFilterLabel, MRT_TableHeadCellGrabHandle, MRT_TableHeadCellResizeHandle, MRT_TableHeadCellSortLabel, MRT_TableHeadRow, MRT_TablePagination, MRT_TablePaper, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleFullScreenButton, MRT_ToggleGlobalFilterButton, MRT_ToggleRowActionMenuButton, MRT_ToolbarAlertBanner, MRT_ToolbarDropZone, MRT_ToolbarInternalButtons, MRT_TopToolbar, MantineReactTable, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, assignRef, createMRTColumnHelper, createMRT_View, createRow, dataVariable, defaultDisplayColumnProps, flexRender, getAllLeafColumnDefs, getCanRankRows, getColumnId, getDefaultColumnFilterFn, getDefaultColumnOrderIds, getIsRankingRows, getIsRowSelected, getLeadingDisplayColumnIds, getMRT_CellView, getMRT_ColumnView, getMRT_HeaderView, getMRT_RowSelectionHandler, getMRT_RowView, getMRT_Rows, getMRT_SelectAllHandler, getMRT_ViewTarget, getPrimaryColor, getPrimaryShade, getTrailingDisplayColumnIds, isSkeletonRow, localizedFilterOption, mrtFilterOptions, parseCSSVarId, parseFromValuesOrFunc, prepareColumns, rankGlobalFuzzy, reorderColumn, showRowActionsColumn, showRowDragColumn, showRowExpandColumn, showRowNumbersColumn, showRowPinningColumn, showRowSelectionColumn, showRowSpacerColumn, skeletonRowKey, useMRT_ColumnVirtualizer, useMRT_Effects, useMRT_RowVirtualizer, useMRT_Rows, useMRT_TableInstance, useMRT_TableOptions, useMantineReactTable };
3909
+ //# sourceMappingURL=index.esm.mjs.map