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