@kissesses/mantine-react-table-open 9.0.3

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