@perses-dev/components 0.55.0-beta.2 → 0.55.0-beta.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 (352) hide show
  1. package/dist/ColorPicker/ColorPicker.d.ts.map +1 -1
  2. package/dist/ColorPicker/ColorPicker.js +2 -2
  3. package/dist/ColorPicker/ColorPicker.js.map +1 -1
  4. package/dist/ColorPicker/OptionsColorPicker.d.ts.map +1 -1
  5. package/dist/ColorPicker/OptionsColorPicker.js +1 -1
  6. package/dist/ColorPicker/OptionsColorPicker.js.map +1 -1
  7. package/dist/ContentWithLegend/ContentWithLegend.d.ts.map +1 -1
  8. package/dist/ContentWithLegend/ContentWithLegend.js +2 -2
  9. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
  10. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +1 -2
  11. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts.map +1 -1
  12. package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
  13. package/dist/DensitySelector/DensitySelector.d.ts.map +1 -1
  14. package/dist/DensitySelector/DensitySelector.js.map +1 -1
  15. package/dist/Dialog/Dialog.d.ts.map +1 -1
  16. package/dist/Dialog/Dialog.js.map +1 -1
  17. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
  18. package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
  19. package/dist/DragAndDrop/DragAndDropList.d.ts.map +1 -1
  20. package/dist/DragAndDrop/DragAndDropList.js +4 -4
  21. package/dist/DragAndDrop/DragAndDropList.js.map +1 -1
  22. package/dist/DragAndDrop/DragButton.d.ts +0 -1
  23. package/dist/DragAndDrop/DragButton.d.ts.map +1 -1
  24. package/dist/DragAndDrop/DragButton.js.map +1 -1
  25. package/dist/Drawer/Drawer.d.ts.map +1 -1
  26. package/dist/Drawer/Drawer.js.map +1 -1
  27. package/dist/EChart/EChart.d.ts +2 -2
  28. package/dist/EChart/EChart.d.ts.map +1 -1
  29. package/dist/EChart/EChart.js +5 -5
  30. package/dist/EChart/EChart.js.map +1 -1
  31. package/dist/EChart/timezone-formatter.d.ts.map +1 -1
  32. package/dist/FontSizeSelector/FontSizeSelector.d.ts.map +1 -1
  33. package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
  34. package/dist/FormatControls/FormatControls.d.ts.map +1 -1
  35. package/dist/FormatControls/FormatControls.js +1 -1
  36. package/dist/FormatControls/FormatControls.js.map +1 -1
  37. package/dist/FormatControls/UnitSelector.d.ts.map +1 -1
  38. package/dist/FormatControls/UnitSelector.js +1 -1
  39. package/dist/FormatControls/UnitSelector.js.map +1 -1
  40. package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
  41. package/dist/InfoTooltip/InfoTooltip.js +1 -1
  42. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  43. package/dist/JSONEditor.d.ts +1 -1
  44. package/dist/JSONEditor.d.ts.map +1 -1
  45. package/dist/JSONEditor.js +2 -2
  46. package/dist/JSONEditor.js.map +1 -1
  47. package/dist/Legend/CompactLegend.d.ts +1 -1
  48. package/dist/Legend/CompactLegend.d.ts.map +1 -1
  49. package/dist/Legend/CompactLegend.js +1 -1
  50. package/dist/Legend/CompactLegend.js.map +1 -1
  51. package/dist/Legend/Legend.d.ts +1 -1
  52. package/dist/Legend/Legend.d.ts.map +1 -1
  53. package/dist/Legend/Legend.js +1 -1
  54. package/dist/Legend/Legend.js.map +1 -1
  55. package/dist/Legend/LegendColorBadge.d.ts +0 -1
  56. package/dist/Legend/LegendColorBadge.d.ts.map +1 -1
  57. package/dist/Legend/LegendColorBadge.js +1 -1
  58. package/dist/Legend/LegendColorBadge.js.map +1 -1
  59. package/dist/Legend/ListLegend.d.ts +1 -1
  60. package/dist/Legend/ListLegend.d.ts.map +1 -1
  61. package/dist/Legend/ListLegend.js +5 -4
  62. package/dist/Legend/ListLegend.js.map +1 -1
  63. package/dist/Legend/ListLegendItem.d.ts +1 -1
  64. package/dist/Legend/ListLegendItem.d.ts.map +1 -1
  65. package/dist/Legend/ListLegendItem.js +4 -3
  66. package/dist/Legend/ListLegendItem.js.map +1 -1
  67. package/dist/Legend/TableLegend.d.ts.map +1 -1
  68. package/dist/Legend/TableLegend.js.map +1 -1
  69. package/dist/Legend/legend-model.d.ts.map +1 -1
  70. package/dist/Legend/legend-model.js.map +1 -1
  71. package/dist/LinksEditor/LinkEditorForm.d.ts.map +1 -1
  72. package/dist/LinksEditor/LinkEditorForm.js.map +1 -1
  73. package/dist/ModeSelector/ModeSelector.d.ts.map +1 -1
  74. package/dist/ModeSelector/ModeSelector.js.map +1 -1
  75. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts.map +1 -1
  76. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts.map +1 -1
  77. package/dist/OptionsEditorLayout/OptionsEditorControl.js +2 -2
  78. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  79. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts.map +1 -1
  80. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -1
  81. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts.map +1 -1
  82. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  83. package/dist/RepeatGrid/RepeatGrid.d.ts +15 -0
  84. package/dist/RepeatGrid/RepeatGrid.d.ts.map +1 -0
  85. package/dist/RepeatGrid/RepeatGrid.js +68 -0
  86. package/dist/RepeatGrid/RepeatGrid.js.map +1 -0
  87. package/dist/RepeatGrid/index.d.ts +2 -0
  88. package/dist/RepeatGrid/index.d.ts.map +1 -0
  89. package/dist/RepeatGrid/index.js +15 -0
  90. package/dist/RepeatGrid/index.js.map +1 -0
  91. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
  92. package/dist/SortSelector/SortSelector.d.ts.map +1 -1
  93. package/dist/SortSelector/SortSelector.js.map +1 -1
  94. package/dist/SortSelector/SortSelectorButtons.d.ts.map +1 -1
  95. package/dist/SortSelector/SortSelectorButtons.js.map +1 -1
  96. package/dist/Table/InnerTable.d.ts +0 -1
  97. package/dist/Table/InnerTable.d.ts.map +1 -1
  98. package/dist/Table/InnerTable.js.map +1 -1
  99. package/dist/Table/Table.d.ts.map +1 -1
  100. package/dist/Table/Table.js +1 -1
  101. package/dist/Table/Table.js.map +1 -1
  102. package/dist/Table/TableBody.d.ts +0 -1
  103. package/dist/Table/TableBody.d.ts.map +1 -1
  104. package/dist/Table/TableCell.d.ts.map +1 -1
  105. package/dist/Table/TableCell.js.map +1 -1
  106. package/dist/Table/TableCheckbox.d.ts.map +1 -1
  107. package/dist/Table/TableCheckbox.js.map +1 -1
  108. package/dist/Table/TableFoot.d.ts +0 -1
  109. package/dist/Table/TableFoot.d.ts.map +1 -1
  110. package/dist/Table/TableHead.d.ts +0 -1
  111. package/dist/Table/TableHead.d.ts.map +1 -1
  112. package/dist/Table/TableHeaderCell.d.ts +1 -1
  113. package/dist/Table/TableHeaderCell.d.ts.map +1 -1
  114. package/dist/Table/TableHeaderCell.js.map +1 -1
  115. package/dist/Table/TableRow.d.ts +0 -1
  116. package/dist/Table/TableRow.d.ts.map +1 -1
  117. package/dist/Table/TableRow.js.map +1 -1
  118. package/dist/Table/TableToolbar.d.ts.map +1 -1
  119. package/dist/Table/TableToolbar.js +4 -4
  120. package/dist/Table/TableToolbar.js.map +1 -1
  121. package/dist/Table/VirtualizedTable.d.ts +1 -1
  122. package/dist/Table/VirtualizedTable.d.ts.map +1 -1
  123. package/dist/Table/VirtualizedTable.js +8 -8
  124. package/dist/Table/VirtualizedTable.js.map +1 -1
  125. package/dist/Table/VirtualizedTableContainer.d.ts +0 -1
  126. package/dist/Table/VirtualizedTableContainer.d.ts.map +1 -1
  127. package/dist/Table/VirtualizedTableContainer.js.map +1 -1
  128. package/dist/Table/hooks/useFuzzySearch.d.ts +1 -1
  129. package/dist/Table/hooks/useFuzzySearch.d.ts.map +1 -1
  130. package/dist/Table/hooks/useFuzzySearch.js +1 -1
  131. package/dist/Table/hooks/useFuzzySearch.js.map +1 -1
  132. package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
  133. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts +1 -1
  134. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts.map +1 -1
  135. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
  136. package/dist/Table/model/table-model.d.ts +1 -1
  137. package/dist/Table/model/table-model.d.ts.map +1 -1
  138. package/dist/Table/model/table-model.js.map +1 -1
  139. package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -1
  140. package/dist/ThresholdsEditor/ThresholdInput.js +1 -1
  141. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  142. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
  143. package/dist/ThresholdsEditor/ThresholdsEditor.js +5 -5
  144. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  145. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts +1 -1
  146. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -1
  147. package/dist/TimeRangeSelector/DateTimeRangePicker.js +3 -3
  148. package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
  149. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +1 -1
  150. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -1
  151. package/dist/TimeRangeSelector/TimeRangeSelector.js +1 -1
  152. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
  153. package/dist/TimeRangeSelector/utils.d.ts.map +1 -1
  154. package/dist/TimeRangeSelector/utils.js +1 -1
  155. package/dist/TimeRangeSelector/utils.js.map +1 -1
  156. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -1
  157. package/dist/TimeSeriesTooltip/SeriesInfo.js +1 -1
  158. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  159. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts.map +1 -1
  160. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
  161. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts.map +1 -1
  162. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
  163. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +2 -2
  164. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
  165. package/dist/TimeSeriesTooltip/TimeChartTooltip.js +4 -4
  166. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  167. package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -1
  168. package/dist/TimeSeriesTooltip/TooltipContent.js +1 -1
  169. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  170. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts +0 -1
  171. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -1
  172. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
  173. package/dist/TimeSeriesTooltip/nearby-series.d.ts +1 -1
  174. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
  175. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  176. package/dist/TimeSeriesTooltip/tooltip-model.d.ts +1 -1
  177. package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
  178. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  179. package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
  180. package/dist/TimeSeriesTooltip/utils.js.map +1 -1
  181. package/dist/TimeZoneSelector.d.ts +1 -1
  182. package/dist/TimeZoneSelector.d.ts.map +1 -1
  183. package/dist/TimeZoneSelector.js +5 -2
  184. package/dist/TimeZoneSelector.js.map +1 -1
  185. package/dist/ToolbarIconButton/ToolbarIconButton.d.ts +0 -1
  186. package/dist/ToolbarIconButton/ToolbarIconButton.d.ts.map +1 -1
  187. package/dist/ToolbarIconButton/ToolbarIconButton.js +1 -1
  188. package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
  189. package/dist/TransformsEditor/TransformEditor.d.ts.map +1 -1
  190. package/dist/TransformsEditor/TransformEditor.js.map +1 -1
  191. package/dist/TransformsEditor/TransformEditorContainer.d.ts.map +1 -1
  192. package/dist/TransformsEditor/TransformEditorContainer.js +2 -2
  193. package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
  194. package/dist/TransformsEditor/TransformsEditor.d.ts.map +1 -1
  195. package/dist/TransformsEditor/TransformsEditor.js +1 -1
  196. package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
  197. package/dist/ValueMappingEditor/ValueMappingEditor.d.ts.map +1 -1
  198. package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -1
  199. package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts.map +1 -1
  200. package/dist/ValueMappingEditor/ValueMappingsEditor.js +1 -1
  201. package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +1 -1
  202. package/dist/cjs/ColorPicker/ColorPicker.js +2 -2
  203. package/dist/cjs/ColorPicker/OptionsColorPicker.js +1 -1
  204. package/dist/cjs/ContentWithLegend/ContentWithLegend.js +1 -1
  205. package/dist/cjs/DragAndDrop/DragAndDropList.js +4 -4
  206. package/dist/cjs/EChart/EChart.js +4 -4
  207. package/dist/cjs/FormatControls/FormatControls.js +1 -1
  208. package/dist/cjs/FormatControls/UnitSelector.js +1 -1
  209. package/dist/cjs/JSONEditor.js +2 -2
  210. package/dist/cjs/Legend/CompactLegend.js +1 -1
  211. package/dist/cjs/Legend/Legend.js +1 -1
  212. package/dist/cjs/Legend/LegendColorBadge.js +1 -1
  213. package/dist/cjs/Legend/ListLegend.js +4 -3
  214. package/dist/cjs/Legend/ListLegendItem.js +4 -3
  215. package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +2 -2
  216. package/dist/cjs/RepeatGrid/RepeatGrid.js +76 -0
  217. package/dist/cjs/RepeatGrid/index.js +30 -0
  218. package/dist/cjs/Table/Table.js +1 -1
  219. package/dist/cjs/Table/TableToolbar.js +4 -4
  220. package/dist/cjs/Table/VirtualizedTable.js +8 -8
  221. package/dist/cjs/Table/hooks/useFuzzySearch.js +1 -1
  222. package/dist/cjs/ThresholdsEditor/ThresholdInput.js +1 -1
  223. package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +5 -5
  224. package/dist/cjs/TimeRangeSelector/DateTimeRangePicker.js +3 -3
  225. package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +1 -1
  226. package/dist/cjs/TimeRangeSelector/utils.js +1 -1
  227. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +1 -1
  228. package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +4 -4
  229. package/dist/cjs/TimeSeriesTooltip/TooltipContent.js +1 -1
  230. package/dist/cjs/TimeZoneSelector.js +5 -2
  231. package/dist/cjs/ToolbarIconButton/ToolbarIconButton.js +1 -1
  232. package/dist/cjs/TransformsEditor/TransformEditorContainer.js +2 -2
  233. package/dist/cjs/TransformsEditor/TransformsEditor.js +1 -1
  234. package/dist/cjs/ValueMappingEditor/ValueMappingsEditor.js +1 -1
  235. package/dist/cjs/context/SnackbarProvider.js +1 -1
  236. package/dist/cjs/controls/TextField.js +1 -1
  237. package/dist/cjs/index.js +1 -0
  238. package/dist/cjs/model/bits.js +1 -1
  239. package/dist/cjs/model/bytes.js +1 -1
  240. package/dist/cjs/model/currency.js +1 -1
  241. package/dist/cjs/model/throughput.js +2 -2
  242. package/dist/cjs/model/units.js +4 -4
  243. package/dist/cjs/test/render.js +1 -1
  244. package/dist/cjs/test/setup-tests.js +9 -3
  245. package/dist/cjs/theme/palette/palette-options.js +4 -4
  246. package/dist/cjs/utils/format.js +6 -1
  247. package/dist/cjs/utils/memo.js +1 -1
  248. package/dist/cjs/utils/request-interpolation.js +1 -1
  249. package/dist/context/ChartsProvider.d.ts.map +1 -1
  250. package/dist/context/ChartsProvider.js.map +1 -1
  251. package/dist/context/ItemActionsProvider.js.map +1 -1
  252. package/dist/context/SelectionProvider.js.map +1 -1
  253. package/dist/context/SnackbarProvider.d.ts +1 -1
  254. package/dist/context/SnackbarProvider.d.ts.map +1 -1
  255. package/dist/context/SnackbarProvider.js +1 -1
  256. package/dist/context/SnackbarProvider.js.map +1 -1
  257. package/dist/context/TimeZoneProvider.d.ts.map +1 -1
  258. package/dist/context/TimeZoneProvider.js.map +1 -1
  259. package/dist/controls/TextField.d.ts +0 -1
  260. package/dist/controls/TextField.d.ts.map +1 -1
  261. package/dist/controls/TextField.js +1 -1
  262. package/dist/controls/TextField.js.map +1 -1
  263. package/dist/index.d.ts +1 -0
  264. package/dist/index.d.ts.map +1 -1
  265. package/dist/index.js +1 -0
  266. package/dist/index.js.map +1 -1
  267. package/dist/model/bits.d.ts.map +1 -1
  268. package/dist/model/bits.js +1 -1
  269. package/dist/model/bits.js.map +1 -1
  270. package/dist/model/bytes.d.ts.map +1 -1
  271. package/dist/model/bytes.js +1 -1
  272. package/dist/model/bytes.js.map +1 -1
  273. package/dist/model/currency.d.ts.map +1 -1
  274. package/dist/model/currency.js +1 -1
  275. package/dist/model/currency.js.map +1 -1
  276. package/dist/model/formatterCache.js.map +1 -1
  277. package/dist/model/graph.d.ts.map +1 -1
  278. package/dist/model/graph.js.map +1 -1
  279. package/dist/model/temperature.d.ts.map +1 -1
  280. package/dist/model/theme.d.ts.map +1 -1
  281. package/dist/model/theme.js.map +1 -1
  282. package/dist/model/throughput.d.ts.map +1 -1
  283. package/dist/model/throughput.js +2 -2
  284. package/dist/model/throughput.js.map +1 -1
  285. package/dist/model/types.d.ts +1 -1
  286. package/dist/model/types.d.ts.map +1 -1
  287. package/dist/model/types.js.map +1 -1
  288. package/dist/model/units.d.ts +8 -8
  289. package/dist/model/units.d.ts.map +1 -1
  290. package/dist/model/units.js +4 -4
  291. package/dist/model/units.js.map +1 -1
  292. package/dist/test/render.d.ts.map +1 -1
  293. package/dist/test/render.js +1 -1
  294. package/dist/test/render.js.map +1 -1
  295. package/dist/test/setup-tests.d.ts +1 -1
  296. package/dist/test/setup-tests.d.ts.map +1 -1
  297. package/dist/test/setup-tests.js +3 -2
  298. package/dist/test/setup-tests.js.map +1 -1
  299. package/dist/test-utils/theme.d.ts +1 -1
  300. package/dist/test-utils/theme.d.ts.map +1 -1
  301. package/dist/test-utils/theme.js.map +1 -1
  302. package/dist/theme/index.d.ts.map +1 -1
  303. package/dist/theme/index.js.map +1 -1
  304. package/dist/theme/palette/background.d.ts +1 -1
  305. package/dist/theme/palette/background.d.ts.map +1 -1
  306. package/dist/theme/palette/background.js.map +1 -1
  307. package/dist/theme/palette/error.d.ts.map +1 -1
  308. package/dist/theme/palette/error.js.map +1 -1
  309. package/dist/theme/palette/grey.d.ts +1 -1
  310. package/dist/theme/palette/grey.d.ts.map +1 -1
  311. package/dist/theme/palette/grey.js.map +1 -1
  312. package/dist/theme/palette/palette-options.d.ts.map +1 -1
  313. package/dist/theme/palette/palette-options.js +4 -4
  314. package/dist/theme/palette/palette-options.js.map +1 -1
  315. package/dist/theme/palette/primary.d.ts.map +1 -1
  316. package/dist/theme/palette/primary.js.map +1 -1
  317. package/dist/theme/palette/secondary.d.ts.map +1 -1
  318. package/dist/theme/palette/secondary.js.map +1 -1
  319. package/dist/theme/palette/success.d.ts.map +1 -1
  320. package/dist/theme/palette/success.js.map +1 -1
  321. package/dist/theme/palette/text.d.ts +1 -1
  322. package/dist/theme/palette/text.d.ts.map +1 -1
  323. package/dist/theme/palette/text.js.map +1 -1
  324. package/dist/theme/palette/warning.d.ts.map +1 -1
  325. package/dist/theme/palette/warning.js.map +1 -1
  326. package/dist/theme/theme.d.ts.map +1 -1
  327. package/dist/theme/theme.js.map +1 -1
  328. package/dist/utils/axis.d.ts.map +1 -1
  329. package/dist/utils/axis.js.map +1 -1
  330. package/dist/utils/browser-storage.js.map +1 -1
  331. package/dist/utils/chart-actions.d.ts +1 -1
  332. package/dist/utils/chart-actions.d.ts.map +1 -1
  333. package/dist/utils/chart-actions.js.map +1 -1
  334. package/dist/utils/data-field-interpolation.js.map +1 -1
  335. package/dist/utils/format.d.ts.map +1 -1
  336. package/dist/utils/format.js +6 -1
  337. package/dist/utils/format.js.map +1 -1
  338. package/dist/utils/mathjs.d.ts +1 -1
  339. package/dist/utils/memo.d.ts.map +1 -1
  340. package/dist/utils/memo.js +1 -1
  341. package/dist/utils/memo.js.map +1 -1
  342. package/dist/utils/request-interpolation.d.ts.map +1 -1
  343. package/dist/utils/request-interpolation.js +1 -1
  344. package/dist/utils/request-interpolation.js.map +1 -1
  345. package/dist/utils/selection-interpolation.js.map +1 -1
  346. package/dist/utils/theme-gen.d.ts.map +1 -1
  347. package/dist/utils/theme-gen.js.map +1 -1
  348. package/dist/utils/time-series-data.d.ts.map +1 -1
  349. package/dist/utils/time-series-data.js.map +1 -1
  350. package/dist/utils/transform-data.js.map +1 -1
  351. package/dist/utils/variable-interpolation.js.map +1 -1
  352. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Table/Table.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Stack, useTheme } from '@mui/material';\nimport {\n ColumnDef,\n ExpandedState,\n getCoreRowModel,\n getExpandedRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n OnChangeFn,\n Row,\n RowSelectionState,\n SortingState,\n Table as TanstackTable,\n useReactTable,\n VisibilityState,\n} from '@tanstack/react-table';\nimport { ReactElement, useCallback, useMemo, useState } from 'react';\nimport { useFuzzySearch } from './hooks/useFuzzySearch';\nimport { TableCheckbox } from './TableCheckbox';\nimport { VirtualizedTable } from './VirtualizedTable';\nimport { DEFAULT_COLUMN_WIDTH, persesColumnsToTanstackColumns, TableProps } from './model/table-model';\n\nconst DEFAULT_GET_ROW_ID = (data: unknown, index: number): string => {\n return `${index}`;\n};\n\n// Setting these defaults one enables them to be consistent across renders instead\n// of being recreated every time, which can be important for perf because react\n// does not do deep equality checking for objects and arrays.\nconst DEFAULT_ROW_SELECTION: NonNullable<TableProps<unknown>['rowSelection']> = {};\nconst DEFAULT_SORTING: NonNullable<TableProps<unknown>['sorting']> = [];\n\n/**\n * Component used to render tabular data in Perses use cases. This component is\n * **not** intended to be a general use data table for use cases unrelated to Perses.\n *\n * **Note: This component is currently experimental and is likely to have significant breaking changes in the near future. Use with caution outside of the core Perses codebase.**\n */\nexport function Table<TableData>({\n data,\n columns,\n cellConfigs,\n density = 'standard',\n defaultColumnWidth = DEFAULT_COLUMN_WIDTH,\n defaultColumnHeight = 'auto',\n checkboxSelection,\n onRowSelectionChange,\n onSortingChange,\n getCheckboxColor,\n getRowId = DEFAULT_GET_ROW_ID,\n rowSelection = DEFAULT_ROW_SELECTION,\n sorting = DEFAULT_SORTING,\n getItemActions,\n hasItemActions,\n pagination,\n onPaginationChange,\n rowSelectionVariant = 'standard',\n getSubRows,\n hiddenColumns,\n tableToolbarConfig,\n columnResizeMode = 'onChange',\n defaultColumnConfig,\n ...otherProps\n}: TableProps<TableData>): ReactElement {\n const theme = useTheme();\n\n const hasSubRows = !!getSubRows;\n\n const [expanded, setExpanded] = useState<ExpandedState>({});\n\n const { globalFilter, setGlobalFilter, fuzzySearchOptions } = useFuzzySearch<TableData>(\n tableToolbarConfig?.isSearchEnabled,\n tableToolbarConfig?.fuzzyMatchThreshold ?? 'CONTAINS',\n expanded,\n setExpanded\n );\n\n const [columnVisibility, setColumnVisibility] = useState<VisibilityState>(\n hiddenColumns?.reduce((acc, columnId) => ({ ...acc, [columnId]: false }), {}) ?? {}\n );\n\n const handleRowSelectionChange: OnChangeFn<RowSelectionState> = (rowSelectionUpdater) => {\n const newRowSelection =\n typeof rowSelectionUpdater === 'function' ? rowSelectionUpdater(rowSelection) : rowSelectionUpdater;\n onRowSelectionChange?.(newRowSelection);\n };\n\n const handleRowSelectionEvent = useCallback(\n (table: TanstackTable<TableData>, row: Row<TableData>, isModified: boolean) => {\n if (rowSelectionVariant === 'standard' || isModified) {\n row.toggleSelected();\n } else {\n // Legend variant (when action not modified with shift/meta key).\n // Note that this behavior needs to be kept in sync with behavior in\n // the Legend component for list-based legends.\n if (row.getIsSelected() && !table.getIsAllRowsSelected()) {\n // Row was already selected. Revert to select all.\n table.toggleAllRowsSelected();\n } else {\n // Focus the selected row.\n onRowSelectionChange?.({\n [row.id]: true,\n });\n }\n }\n },\n [onRowSelectionChange, rowSelectionVariant]\n );\n\n const handleCheckboxChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>, table: TanstackTable<TableData>, row: Row<TableData>) => {\n const nativePointerEvent =\n e.nativeEvent && (e.nativeEvent instanceof MouseEvent || e.nativeEvent instanceof KeyboardEvent)\n ? (e.nativeEvent as PointerEvent)\n : undefined;\n const isModifed = !!nativePointerEvent?.metaKey || !!nativePointerEvent?.shiftKey;\n handleRowSelectionEvent(table, row, isModifed);\n },\n [handleRowSelectionEvent]\n );\n\n const handleSortingChange: OnChangeFn<SortingState> = (sortingUpdater) => {\n const newSorting = typeof sortingUpdater === 'function' ? sortingUpdater(sorting) : sortingUpdater;\n onSortingChange?.(newSorting);\n };\n\n const actionsColumn: ColumnDef<TableData> = useMemo(() => {\n return {\n id: 'itemActions',\n header: 'Actions',\n cell: ({ row }): ReactElement => {\n return (\n <Stack direction=\"row\" alignItems=\"center\">\n {getItemActions?.({ id: row.id, data: row.original })}\n </Stack>\n );\n },\n enableSorting: false,\n enableResizing: false,\n };\n }, [getItemActions]);\n\n const checkboxColumn: ColumnDef<TableData> = useMemo(() => {\n return {\n id: 'checkboxRowSelect',\n size: 28,\n header: ({ table }): ReactElement => {\n return (\n <TableCheckbox\n checked={table.getIsAllRowsSelected()}\n indeterminate={table.getIsSomeRowsSelected()}\n onChange={table.getToggleAllRowsSelectedHandler()}\n color={theme.palette.text.primary}\n density={density}\n />\n );\n },\n cell: ({ row, table }): ReactElement => {\n return (\n <TableCheckbox\n checked={row.getIsSelected()}\n indeterminate={row.getIsSomeSelected()}\n onChange={(e) => {\n handleCheckboxChange(e, table, row);\n }}\n color={getCheckboxColor?.(row.original)}\n density={density}\n />\n );\n },\n enableSorting: false,\n enableResizing: false,\n };\n }, [theme.palette.text.primary, density, getCheckboxColor, handleCheckboxChange]);\n\n const tableColumns: Array<ColumnDef<TableData>> = useMemo(() => {\n const initTableColumns = persesColumnsToTanstackColumns(columns, defaultColumnConfig);\n\n if (hasItemActions) {\n initTableColumns.unshift(actionsColumn);\n }\n\n if (checkboxSelection) {\n initTableColumns.unshift(checkboxColumn);\n }\n\n return initTableColumns;\n }, [columns, defaultColumnConfig, hasItemActions, checkboxSelection, actionsColumn, checkboxColumn]);\n\n const table = useReactTable({\n data,\n columns: tableColumns,\n getRowId: getRowId,\n getCoreRowModel: getCoreRowModel(),\n getSortedRowModel: getSortedRowModel(),\n getPaginationRowModel: pagination ? getPaginationRowModel() : undefined,\n // without this setting, the getPaginationRowModel setting persists and it is not possible to switch from paginated to unpaginated\n // can be removed once https://github.com/TanStack/table/pull/5974 is merged\n manualPagination: !pagination,\n enableRowSelection: !!checkboxSelection,\n onRowSelectionChange: handleRowSelectionChange,\n onSortingChange: handleSortingChange,\n onColumnVisibilityChange: setColumnVisibility,\n getSubRows: getSubRows,\n getExpandedRowModel: hasSubRows ? getExpandedRowModel() : undefined,\n ...fuzzySearchOptions,\n // For now, defaulting to sort by descending first. We can expose the ability\n // to customize it if/when we have use cases for it.\n sortDescFirst: true,\n columnResizeMode,\n onExpandedChange: setExpanded,\n state: {\n rowSelection,\n sorting,\n globalFilter: tableToolbarConfig?.isSearchEnabled ? globalFilter : undefined,\n columnVisibility,\n ...(pagination ? { pagination } : {}),\n expanded,\n },\n });\n\n const handleRowClick = useCallback(\n (e: React.MouseEvent<HTMLDivElement, MouseEvent>, rowId: string) => {\n const row = table.getRow(rowId);\n const isModifiedClick = e.metaKey || e.shiftKey;\n handleRowSelectionEvent(table, row, isModifiedClick);\n },\n [handleRowSelectionEvent, table]\n );\n\n return (\n <VirtualizedTable\n {...otherProps}\n density={density}\n defaultColumnWidth={defaultColumnWidth}\n defaultColumnHeight={defaultColumnHeight}\n onRowClick={handleRowClick}\n rows={table.getRowModel().rows}\n columns={table.getVisibleFlatColumns()}\n columnSizing={table.getState().columnSizing}\n columnSizingInfo={table.getState().columnSizingInfo}\n headers={table.getHeaderGroups()}\n cellConfigs={cellConfigs}\n pagination={pagination}\n onPaginationChange={onPaginationChange}\n rowCount={table.getRowCount()}\n toolbarConfig={{\n isSearchEnabled: tableToolbarConfig?.isSearchEnabled,\n globalFilter,\n onGlobalFilterChange: setGlobalFilter,\n isColumnFilterEnabled: tableToolbarConfig?.isColumnFilterEnabled,\n columns: table.getAllColumns(),\n columnFilterMenuMaxHeight: tableToolbarConfig?.columnFilterMenuMaxHeight,\n isExpandAllEnabled: hasSubRows,\n isAllExpanded: table.getIsAllRowsExpanded(),\n onExpandAllChange: table.getToggleAllRowsExpandedHandler(),\n }}\n />\n );\n}\n"],"names":["Stack","useTheme","getCoreRowModel","getExpandedRowModel","getPaginationRowModel","getSortedRowModel","useReactTable","useCallback","useMemo","useState","useFuzzySearch","TableCheckbox","VirtualizedTable","DEFAULT_COLUMN_WIDTH","persesColumnsToTanstackColumns","DEFAULT_GET_ROW_ID","data","index","DEFAULT_ROW_SELECTION","DEFAULT_SORTING","Table","columns","cellConfigs","density","defaultColumnWidth","defaultColumnHeight","checkboxSelection","onRowSelectionChange","onSortingChange","getCheckboxColor","getRowId","rowSelection","sorting","getItemActions","hasItemActions","pagination","onPaginationChange","rowSelectionVariant","getSubRows","hiddenColumns","tableToolbarConfig","columnResizeMode","defaultColumnConfig","otherProps","theme","hasSubRows","expanded","setExpanded","globalFilter","setGlobalFilter","fuzzySearchOptions","isSearchEnabled","fuzzyMatchThreshold","columnVisibility","setColumnVisibility","reduce","acc","columnId","handleRowSelectionChange","rowSelectionUpdater","newRowSelection","handleRowSelectionEvent","table","row","isModified","toggleSelected","getIsSelected","getIsAllRowsSelected","toggleAllRowsSelected","id","handleCheckboxChange","e","nativePointerEvent","nativeEvent","MouseEvent","KeyboardEvent","undefined","isModifed","metaKey","shiftKey","handleSortingChange","sortingUpdater","newSorting","actionsColumn","header","cell","direction","alignItems","original","enableSorting","enableResizing","checkboxColumn","size","checked","indeterminate","getIsSomeRowsSelected","onChange","getToggleAllRowsSelectedHandler","color","palette","text","primary","getIsSomeSelected","tableColumns","initTableColumns","unshift","manualPagination","enableRowSelection","onColumnVisibilityChange","sortDescFirst","onExpandedChange","state","handleRowClick","rowId","getRow","isModifiedClick","onRowClick","rows","getRowModel","getVisibleFlatColumns","columnSizing","getState","columnSizingInfo","headers","getHeaderGroups","rowCount","getRowCount","toolbarConfig","onGlobalFilterChange","isColumnFilterEnabled","getAllColumns","columnFilterMenuMaxHeight","isExpandAllEnabled","isAllExpanded","getIsAllRowsExpanded","onExpandAllChange","getToggleAllRowsExpandedHandler"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,KAAK,EAAEC,QAAQ,QAAQ,gBAAgB;AAChD,SAGEC,eAAe,EACfC,mBAAmB,EACnBC,qBAAqB,EACrBC,iBAAiB,EAMjBC,aAAa,QAER,wBAAwB;AAC/B,SAAuBC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AACrE,SAASC,cAAc,QAAQ,yBAAyB;AACxD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,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B;QACrB,6EAA6E;QAC7E,oDAAoD;QACpD2D,eAAe;QACfpE;QACAqE,kBAAkB/D;QAClBgE,OAAO;YACLhF;YACAC;YACAgB,cAAcR,oBAAoBW,kBAAkBH,eAAe4B;YACnEvB;YACA,GAAIlB,aAAa;gBAAEA;YAAW,IAAI,CAAC,CAAC;YACpCW;QACF;IACF;IAEA,MAAMkE,iBAAiBzG,YACrB,CAACgE,GAAiD0C;QAChD,MAAMlD,MAAMD,MAAMoD,MAAM,CAACD;QACzB,MAAME,kBAAkB5C,EAAEO,OAAO,IAAIP,EAAEQ,QAAQ;QAC/ClB,wBAAwBC,OAAOC,KAAKoD;IACtC,GACA;QAACtD;QAAyBC;KAAM;IAGlC,qBACE,KAAClD;QACE,GAAG+B,UAAU;QACdpB,SAASA;QACTC,oBAAoBA;QACpBC,qBAAqBA;QACrB2F,YAAYJ;QACZK,MAAMvD,MAAMwD,WAAW,GAAGD,IAAI;QAC9BhG,SAASyC,MAAMyD,qBAAqB;QACpCC,cAAc1D,MAAM2D,QAAQ,GAAGD,YAAY;QAC3CE,kBAAkB5D,MAAM2D,QAAQ,GAAGC,gBAAgB;QACnDC,SAAS7D,MAAM8D,eAAe;QAC9BtG,aAAaA;QACba,YAAYA;QACZC,oBAAoBA;QACpByF,UAAU/D,MAAMgE,WAAW;QAC3BC,eAAe;YACb5E,iBAAiBX,oBAAoBW;YACrCH;YACAgF,sBAAsB/E;YACtBgF,uBAAuBzF,oBAAoByF;YAC3C5G,SAASyC,MAAMoE,aAAa;YAC5BC,2BAA2B3F,oBAAoB2F;YAC/CC,oBAAoBvF;YACpBwF,eAAevE,MAAMwE,oBAAoB;YACzCC,mBAAmBzE,MAAM0E,+BAA+B;QAC1D;;AAGN"}
1
+ {"version":3,"sources":["../../src/Table/Table.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Stack, useTheme } from '@mui/material';\nimport {\n ColumnDef,\n ExpandedState,\n getCoreRowModel,\n getExpandedRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n OnChangeFn,\n Row,\n RowSelectionState,\n SortingState,\n Table as TanstackTable,\n useReactTable,\n VisibilityState,\n} from '@tanstack/react-table';\nimport { ReactElement, useCallback, useMemo, useState } from 'react';\n\nimport { useFuzzySearch } from './hooks/useFuzzySearch';\nimport { DEFAULT_COLUMN_WIDTH, persesColumnsToTanstackColumns, TableProps } from './model/table-model';\nimport { TableCheckbox } from './TableCheckbox';\nimport { VirtualizedTable } from './VirtualizedTable';\n\nconst DEFAULT_GET_ROW_ID = (data: unknown, index: number): string => {\n return `${index}`;\n};\n\n// Setting these defaults one enables them to be consistent across renders instead\n// of being recreated every time, which can be important for perf because react\n// does not do deep equality checking for objects and arrays.\nconst DEFAULT_ROW_SELECTION: NonNullable<TableProps<unknown>['rowSelection']> = {};\nconst DEFAULT_SORTING: NonNullable<TableProps<unknown>['sorting']> = [];\n\n/**\n * Component used to render tabular data in Perses use cases. This component is\n * **not** intended to be a general use data table for use cases unrelated to Perses.\n *\n * **Note: This component is currently experimental and is likely to have significant breaking changes in the near future. Use with caution outside of the core Perses codebase.**\n */\nexport function Table<TableData>({\n data,\n columns,\n cellConfigs,\n density = 'standard',\n defaultColumnWidth = DEFAULT_COLUMN_WIDTH,\n defaultColumnHeight = 'auto',\n checkboxSelection,\n onRowSelectionChange,\n onSortingChange,\n getCheckboxColor,\n getRowId = DEFAULT_GET_ROW_ID,\n rowSelection = DEFAULT_ROW_SELECTION,\n sorting = DEFAULT_SORTING,\n getItemActions,\n hasItemActions,\n pagination,\n onPaginationChange,\n rowSelectionVariant = 'standard',\n getSubRows,\n hiddenColumns,\n tableToolbarConfig,\n columnResizeMode = 'onChange',\n defaultColumnConfig,\n ...otherProps\n}: TableProps<TableData>): ReactElement {\n const theme = useTheme();\n\n const hasSubRows = !!getSubRows;\n\n const [expanded, setExpanded] = useState<ExpandedState>({});\n\n const { globalFilter, setGlobalFilter, fuzzySearchOptions } = useFuzzySearch<TableData>(\n tableToolbarConfig?.isSearchEnabled,\n tableToolbarConfig?.fuzzyMatchThreshold ?? 'CONTAINS',\n expanded,\n setExpanded,\n );\n\n const [columnVisibility, setColumnVisibility] = useState<VisibilityState>(\n hiddenColumns?.reduce((acc, columnId) => ({ ...acc, [columnId]: false }), {}) ?? {},\n );\n\n const handleRowSelectionChange: OnChangeFn<RowSelectionState> = (rowSelectionUpdater) => {\n const newRowSelection =\n typeof rowSelectionUpdater === 'function' ? rowSelectionUpdater(rowSelection) : rowSelectionUpdater;\n onRowSelectionChange?.(newRowSelection);\n };\n\n const handleRowSelectionEvent = useCallback(\n (table: TanstackTable<TableData>, row: Row<TableData>, isModified: boolean) => {\n if (rowSelectionVariant === 'standard' || isModified) {\n row.toggleSelected();\n } else {\n // Legend variant (when action not modified with shift/meta key).\n // Note that this behavior needs to be kept in sync with behavior in\n // the Legend component for list-based legends.\n if (row.getIsSelected() && !table.getIsAllRowsSelected()) {\n // Row was already selected. Revert to select all.\n table.toggleAllRowsSelected();\n } else {\n // Focus the selected row.\n onRowSelectionChange?.({\n [row.id]: true,\n });\n }\n }\n },\n [onRowSelectionChange, rowSelectionVariant],\n );\n\n const handleCheckboxChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>, table: TanstackTable<TableData>, row: Row<TableData>) => {\n const nativePointerEvent =\n e.nativeEvent && (e.nativeEvent instanceof MouseEvent || e.nativeEvent instanceof KeyboardEvent)\n ? (e.nativeEvent as PointerEvent)\n : undefined;\n const isModifed = !!nativePointerEvent?.metaKey || !!nativePointerEvent?.shiftKey;\n handleRowSelectionEvent(table, row, isModifed);\n },\n [handleRowSelectionEvent],\n );\n\n const handleSortingChange: OnChangeFn<SortingState> = (sortingUpdater) => {\n const newSorting = typeof sortingUpdater === 'function' ? sortingUpdater(sorting) : sortingUpdater;\n onSortingChange?.(newSorting);\n };\n\n const actionsColumn: ColumnDef<TableData> = useMemo(() => {\n return {\n id: 'itemActions',\n header: 'Actions',\n cell: ({ row }): ReactElement => {\n return (\n <Stack direction=\"row\" alignItems=\"center\">\n {getItemActions?.({ id: row.id, data: row.original })}\n </Stack>\n );\n },\n enableSorting: false,\n enableResizing: false,\n };\n }, [getItemActions]);\n\n const checkboxColumn: ColumnDef<TableData> = useMemo(() => {\n return {\n id: 'checkboxRowSelect',\n size: 28,\n header: ({ table }): ReactElement => {\n return (\n <TableCheckbox\n checked={table.getIsAllRowsSelected()}\n indeterminate={table.getIsSomeRowsSelected()}\n onChange={table.getToggleAllRowsSelectedHandler()}\n color={theme.palette.text.primary}\n density={density}\n />\n );\n },\n cell: ({ row, table }): ReactElement => {\n return (\n <TableCheckbox\n checked={row.getIsSelected()}\n indeterminate={row.getIsSomeSelected()}\n onChange={(e) => {\n handleCheckboxChange(e, table, row);\n }}\n color={getCheckboxColor?.(row.original)}\n density={density}\n />\n );\n },\n enableSorting: false,\n enableResizing: false,\n };\n }, [theme.palette.text.primary, density, getCheckboxColor, handleCheckboxChange]);\n\n const tableColumns: Array<ColumnDef<TableData>> = useMemo(() => {\n const initTableColumns = persesColumnsToTanstackColumns(columns, defaultColumnConfig);\n\n if (hasItemActions) {\n initTableColumns.unshift(actionsColumn);\n }\n\n if (checkboxSelection) {\n initTableColumns.unshift(checkboxColumn);\n }\n\n return initTableColumns;\n }, [columns, defaultColumnConfig, hasItemActions, checkboxSelection, actionsColumn, checkboxColumn]);\n\n const table = useReactTable({\n data,\n columns: tableColumns,\n getRowId: getRowId,\n getCoreRowModel: getCoreRowModel(),\n getSortedRowModel: getSortedRowModel(),\n getPaginationRowModel: pagination ? getPaginationRowModel() : undefined,\n // without this setting, the getPaginationRowModel setting persists and it is not possible to switch from paginated to unpaginated\n // can be removed once https://github.com/TanStack/table/pull/5974 is merged\n manualPagination: !pagination,\n enableRowSelection: !!checkboxSelection,\n onRowSelectionChange: handleRowSelectionChange,\n onSortingChange: handleSortingChange,\n onColumnVisibilityChange: setColumnVisibility,\n getSubRows: getSubRows,\n getExpandedRowModel: hasSubRows ? getExpandedRowModel() : undefined,\n ...fuzzySearchOptions,\n // For now, defaulting to sort by descending first. We can expose the ability\n // to customize it if/when we have use cases for it.\n sortDescFirst: true,\n columnResizeMode,\n onExpandedChange: setExpanded,\n state: {\n rowSelection,\n sorting,\n globalFilter: tableToolbarConfig?.isSearchEnabled ? globalFilter : undefined,\n columnVisibility,\n ...(pagination ? { pagination } : {}),\n expanded,\n },\n });\n\n const handleRowClick = useCallback(\n (e: React.MouseEvent<HTMLDivElement, MouseEvent>, rowId: string) => {\n const row = table.getRow(rowId);\n const isModifiedClick = e.metaKey || e.shiftKey;\n handleRowSelectionEvent(table, row, isModifiedClick);\n },\n [handleRowSelectionEvent, table],\n );\n\n return (\n <VirtualizedTable\n {...otherProps}\n density={density}\n defaultColumnWidth={defaultColumnWidth}\n defaultColumnHeight={defaultColumnHeight}\n onRowClick={handleRowClick}\n rows={table.getRowModel().rows}\n columns={table.getVisibleFlatColumns()}\n columnSizing={table.getState().columnSizing}\n columnSizingInfo={table.getState().columnSizingInfo}\n headers={table.getHeaderGroups()}\n cellConfigs={cellConfigs}\n pagination={pagination}\n onPaginationChange={onPaginationChange}\n rowCount={table.getRowCount()}\n toolbarConfig={{\n isSearchEnabled: tableToolbarConfig?.isSearchEnabled,\n globalFilter,\n onGlobalFilterChange: setGlobalFilter,\n isColumnFilterEnabled: tableToolbarConfig?.isColumnFilterEnabled,\n columns: table.getAllColumns(),\n columnFilterMenuMaxHeight: tableToolbarConfig?.columnFilterMenuMaxHeight,\n isExpandAllEnabled: hasSubRows,\n isAllExpanded: table.getIsAllRowsExpanded(),\n onExpandAllChange: table.getToggleAllRowsExpandedHandler(),\n }}\n />\n );\n}\n"],"names":["Stack","useTheme","getCoreRowModel","getExpandedRowModel","getPaginationRowModel","getSortedRowModel","useReactTable","useCallback","useMemo","useState","useFuzzySearch","DEFAULT_COLUMN_WIDTH","persesColumnsToTanstackColumns","TableCheckbox","VirtualizedTable","DEFAULT_GET_ROW_ID","data","index","DEFAULT_ROW_SELECTION","DEFAULT_SORTING","Table","columns","cellConfigs","density","defaultColumnWidth","defaultColumnHeight","checkboxSelection","onRowSelectionChange","onSortingChange","getCheckboxColor","getRowId","rowSelection","sorting","getItemActions","hasItemActions","pagination","onPaginationChange","rowSelectionVariant","getSubRows","hiddenColumns","tableToolbarConfig","columnResizeMode","defaultColumnConfig","otherProps","theme","hasSubRows","expanded","setExpanded","globalFilter","setGlobalFilter","fuzzySearchOptions","isSearchEnabled","fuzzyMatchThreshold","columnVisibility","setColumnVisibility","reduce","acc","columnId","handleRowSelectionChange","rowSelectionUpdater","newRowSelection","handleRowSelectionEvent","table","row","isModified","toggleSelected","getIsSelected","getIsAllRowsSelected","toggleAllRowsSelected","id","handleCheckboxChange","e","nativePointerEvent","nativeEvent","MouseEvent","KeyboardEvent","undefined","isModifed","metaKey","shiftKey","handleSortingChange","sortingUpdater","newSorting","actionsColumn","header","cell","direction","alignItems","original","enableSorting","enableResizing","checkboxColumn","size","checked","indeterminate","getIsSomeRowsSelected","onChange","getToggleAllRowsSelectedHandler","color","palette","text","primary","getIsSomeSelected","tableColumns","initTableColumns","unshift","manualPagination","enableRowSelection","onColumnVisibilityChange","sortDescFirst","onExpandedChange","state","handleRowClick","rowId","getRow","isModifiedClick","onRowClick","rows","getRowModel","getVisibleFlatColumns","columnSizing","getState","columnSizingInfo","headers","getHeaderGroups","rowCount","getRowCount","toolbarConfig","onGlobalFilterChange","isColumnFilterEnabled","getAllColumns","columnFilterMenuMaxHeight","isExpandAllEnabled","isAllExpanded","getIsAllRowsExpanded","onExpandAllChange","getToggleAllRowsExpandedHandler"],"mappings":";AAAA,+BAA+B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,UAAU/D,MAAMgE,WAAW;QAC3BC,eAAe;YACb5E,iBAAiBX,oBAAoBW;YACrCH;YACAgF,sBAAsB/E;YACtBgF,uBAAuBzF,oBAAoByF;YAC3C5G,SAASyC,MAAMoE,aAAa;YAC5BC,2BAA2B3F,oBAAoB2F;YAC/CC,oBAAoBvF;YACpBwF,eAAevE,MAAMwE,oBAAoB;YACzCC,mBAAmBzE,MAAM0E,+BAA+B;QAC1D;;AAGN"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { TableBodyProps as MuiTableBodyProps } from '@mui/material';
3
2
  type TableBodyProps = MuiTableBodyProps;
4
3
  export declare const TableBody: import("react").ForwardRefExoticComponent<Omit<TableBodyProps, "ref"> & import("react").RefAttributes<HTMLTableSectionElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"TableBody.d.ts","sourceRoot":"","sources":["../../src/Table/TableBody.tsx"],"names":[],"mappings":";AAaA,OAAO,EAA6B,cAAc,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAG/F,KAAK,cAAc,GAAG,iBAAiB,CAAC;AAExC,eAAO,MAAM,SAAS,iIAEpB,CAAC"}
1
+ {"version":3,"file":"TableBody.d.ts","sourceRoot":"","sources":["../../src/Table/TableBody.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA6B,cAAc,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAG/F,KAAK,cAAc,GAAG,iBAAiB,CAAC;AAExC,eAAO,MAAM,SAAS,iIAEpB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TableCell.d.ts","sourceRoot":"","sources":["../../src/Table/TableCell.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,cAAc,IAAI,iBAAiB,EAGpC,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAA8B,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAmB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,MAAM,qBAAqB,CAAC;AAmBrG,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,OAAO,CAAC;IACnF,OAAO,EAAE,YAAY,CAAC;IACtB,mBAAmB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAGtC,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IAEvB,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAE3B;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,eAAe,GAAG,YAAY,GAAG,MAAM,CAAC;IACrD,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,oBAAoB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC;IACjH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjD;AAED,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,KAAK,EACL,mBAAmB,EACnB,UAAmB,EACnB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,WAAW,EACX,KAAK,EACL,KAAK,EACL,eAAe,EACf,QAAQ,EACR,sBAAsB,EACtB,GAAG,UAAU,EACd,EAAE,cAAc,GAAG,YAAY,CAiH/B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Table/TableCell.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n Box,\n Link,\n TableCell as MuiTableCell,\n TableCellProps as MuiTableCellProps,\n styled,\n useTheme,\n} from '@mui/material';\nimport { ReactElement, useEffect, useMemo, useRef } from 'react';\nimport { hasDataFieldPatterns, replaceDataFields } from '../utils/data-field-interpolation';\nimport { DataLink, TableCellAlignment, TableDensity, getTableCellLayout } from './model/table-model';\n\nconst StyledMuiTableCell = styled(MuiTableCell)(({ theme }) => ({\n padding: 0,\n backgroundColor: 'inherit',\n\n '&.MuiTableCell-head': {\n // Important to avoid scrolling behind the header showing through.\n backgroundColor: theme.palette.background.default,\n },\n '&:focus-visible': {\n outline: `solid 1px ${theme.palette.primary.main}`,\n // Move inward a little to avoid getting cut off when focusing on items\n // at the edge of the table.\n outlineOffset: '-1px',\n borderRadius: 0,\n },\n}));\n\nexport interface TableCellProps extends Omit<MuiTableCellProps, 'tabIndex' | 'align'> {\n density: TableDensity;\n defaultColumnHeight?: 'auto' | number;\n\n // These values are used to adjust the spacing for the first/last columns.\n isLastColumn: boolean;\n isFirstColumn: boolean;\n\n align?: TableCellAlignment;\n\n /**\n * Additional information to be displayed when hovering over the cell. This\n * may be the full cell value (e.g. to enable the user to see the full value\n * if it is ellipsized to fit into the space) or some other descriptive text\n * that is useful for the user.\n *\n * The hover behavior is currently managed with the `title` attribute, but this\n * may be changed to a tooltip in the future.\n */\n description?: string;\n\n /**\n * How the cell should behave related to focus.\n * - `trigger-focus`: the cell should be auto-focused when it renders.\n * - `focus-next`: the cell should have tabindex=\"0\", so that it will be\n * focused the next time someone tabs with a keyboard.\n * - `none`: the cell should have tabindex=\"-1\", so it is not focused by\n * keyboard interactions at this time.\n */\n focusState?: 'trigger-focus' | 'focus-next' | 'none';\n onFocusTrigger?: (e: React.MouseEvent<HTMLTableCellElement> | React.KeyboardEvent<HTMLTableCellElement>) => void;\n color?: string;\n backgroundColor?: string;\n dataLink?: DataLink;\n adjacentCellsValuesMap?: Record<string, string>;\n}\n\nexport function TableCell({\n children,\n density,\n variant,\n width,\n defaultColumnHeight,\n focusState = 'none',\n onFocusTrigger,\n isFirstColumn,\n isLastColumn,\n description,\n align,\n color,\n backgroundColor,\n dataLink,\n adjacentCellsValuesMap,\n ...otherProps\n}: TableCellProps): ReactElement {\n const theme = useTheme();\n const elRef = useRef<HTMLTableCellElement>();\n\n const isHeader = variant === 'head';\n\n useEffect(() => {\n if (focusState === 'trigger-focus' && elRef.current) {\n elRef.current.focus();\n }\n }, [focusState]);\n\n const handleFocus: React.FocusEventHandler<HTMLTableCellElement> = (e) => {\n // From https://zellwk.com/blog/keyboard-focusable-elements/\n const nestedFocusTarget = e.currentTarget?.querySelector<HTMLElement>(\n 'a[href], button, input, textarea, select, details,[role=\"button\"]'\n );\n if (nestedFocusTarget) {\n // If the cell has a focusable child, focus it instead. Mostly used for\n // checkbox cells, but could have other uses.\n nestedFocusTarget.focus();\n }\n };\n\n const handleInteractionFocusTrigger: TableCellProps['onFocusTrigger'] = (e) => {\n // We use `onClick` and `onKeyUp` events instead of `onFocus` because of\n // some ordering issues with when the browser calls events and how this\n // plays with the triggering of focus with keyboard interactions.\n // These report that a focus event happened, so we can adjust the current\n // tabindex and focuses to the right cell.\n onFocusTrigger?.(e);\n };\n\n const modifiedDataLink = useMemo((): DataLink | undefined => {\n if (!dataLink) return undefined;\n\n if (adjacentCellsValuesMap && hasDataFieldPatterns(dataLink.url)) {\n const { text } = replaceDataFields(dataLink.url, adjacentCellsValuesMap, { urlEncode: true });\n return { ...dataLink, url: text };\n }\n return dataLink;\n }, [dataLink, adjacentCellsValuesMap]);\n\n return (\n <StyledMuiTableCell\n {...otherProps}\n // Modify the tab index based on the currently focused cell. It's important\n // to avoid having tabindex 0 on everything because it essentially traps\n // a keyboard user in the table until they hit \"tab\" for every single\n // cell.\n tabIndex={focusState !== 'none' ? 0 : -1}\n onFocus={handleFocus}\n onClick={handleInteractionFocusTrigger}\n onKeyUp={handleInteractionFocusTrigger}\n style={{ width: width }}\n sx={{\n position: 'relative',\n borderBottom: isHeader ? `solid 1px ${theme.palette.grey[100]}` : `solid 1px ${theme.palette.grey[50]}`,\n '&:hover #original-cell': {\n position: 'absolute',\n top: 0,\n left: 0,\n zIndex: 10,\n width: 'fit-content',\n minWidth: '100%',\n whiteSpace: 'nowrap',\n overflow: 'visible',\n backgroundColor: `${backgroundColor ?? theme.palette.background.default} !important`,\n outline: `solid 1px ${theme.palette.info.main}`,\n outlineOffset: '-1px',\n },\n }}\n ref={elRef}\n >\n <Box\n id=\"original-cell\"\n sx={{\n ...getTableCellLayout(theme, density, { isHeader, isLastColumn, isFirstColumn, defaultColumnHeight }),\n position: 'relative',\n\n // Text truncation. Currently enforced on all cells. We may control\n // this with a prop on column config in the future.\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n\n // Need to inherit from the MUI cell because this manages some ordering\n // that the `TableSortLabel` uses to determine the location of the icon\n // in headers.\n flexDirection: 'inherit',\n }}\n style={{\n backgroundColor: backgroundColor ?? 'inherit',\n color: color ?? 'inherit',\n }}\n title={description}\n aria-label={description}\n textAlign={align}\n >\n {modifiedDataLink ? (\n <Link\n href={modifiedDataLink.url}\n target={modifiedDataLink.targetBlank ? '_blank' : '_self'}\n rel={modifiedDataLink.targetBlank ? 'noopener noreferrer' : undefined}\n >\n {children}\n </Link>\n ) : (\n children\n )}\n </Box>\n </StyledMuiTableCell>\n );\n}\n"],"names":["Box","Link","TableCell","MuiTableCell","styled","useTheme","useEffect","useMemo","useRef","hasDataFieldPatterns","replaceDataFields","getTableCellLayout","StyledMuiTableCell","theme","padding","backgroundColor","palette","background","default","outline","primary","main","outlineOffset","borderRadius","children","density","variant","width","defaultColumnHeight","focusState","onFocusTrigger","isFirstColumn","isLastColumn","description","align","color","dataLink","adjacentCellsValuesMap","otherProps","elRef","isHeader","current","focus","handleFocus","e","nestedFocusTarget","currentTarget","querySelector","handleInteractionFocusTrigger","modifiedDataLink","undefined","url","text","urlEncode","tabIndex","onFocus","onClick","onKeyUp","style","sx","position","borderBottom","grey","top","left","zIndex","minWidth","whiteSpace","overflow","info","ref","id","textOverflow","flexDirection","title","aria-label","textAlign","href","target","targetBlank","rel"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SACEA,GAAG,EACHC,IAAI,EACJC,aAAaC,YAAY,EAEzBC,MAAM,EACNC,QAAQ,QACH,gBAAgB;AACvB,SAAuBC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAQ;AACjE,SAASC,oBAAoB,EAAEC,iBAAiB,QAAQ,oCAAoC;AAC5F,SAAqDC,kBAAkB,QAAQ,sBAAsB;AAErG,MAAMC,qBAAqBR,OAAOD,cAAc,CAAC,EAAEU,KAAK,EAAE,GAAM,CAAA;QAC9DC,SAAS;QACTC,iBAAiB;QAEjB,uBAAuB;YACrB,kEAAkE;YAClEA,iBAAiBF,MAAMG,OAAO,CAACC,UAAU,CAACC,OAAO;QACnD;QACA,mBAAmB;YACjBC,SAAS,CAAC,UAAU,EAAEN,MAAMG,OAAO,CAACI,OAAO,CAACC,IAAI,EAAE;YAClD,uEAAuE;YACvE,4BAA4B;YAC5BC,eAAe;YACfC,cAAc;QAChB;IACF,CAAA;AAuCA,OAAO,SAASrB,UAAU,EACxBsB,QAAQ,EACRC,OAAO,EACPC,OAAO,EACPC,KAAK,EACLC,mBAAmB,EACnBC,aAAa,MAAM,EACnBC,cAAc,EACdC,aAAa,EACbC,YAAY,EACZC,WAAW,EACXC,KAAK,EACLC,KAAK,EACLpB,eAAe,EACfqB,QAAQ,EACRC,sBAAsB,EACtB,GAAGC,YACY;IACf,MAAM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UAAU;gBACVG,KAAK;gBACLC,MAAM;gBACNC,QAAQ;gBACRtC,OAAO;gBACPuC,UAAU;gBACVC,YAAY;gBACZC,UAAU;gBACVrD,iBAAiB,GAAGA,mBAAmBF,MAAMG,OAAO,CAACC,UAAU,CAACC,OAAO,CAAC,WAAW,CAAC;gBACpFC,SAAS,CAAC,UAAU,EAAEN,MAAMG,OAAO,CAACqD,IAAI,CAAChD,IAAI,EAAE;gBAC/CC,eAAe;YACjB;QACF;QACAgD,KAAK/B;kBAEL,cAAA,KAACvC;YACCuE,IAAG;YACHZ,IAAI;gBACF,GAAGhD,mBAAmBE,OAAOY,SAAS;oBAAEe;oBAAUR;oBAAcD;oBAAeH;gBAAoB,EAAE;gBACrGgC,UAAU;gBAEV,mEAAmE;gBACnE,mDAAmD;gBACnDO,YAAY;gBACZC,UAAU;gBACVI,cAAc;gBAEd,uEAAuE;gBACvE,uEAAuE;gBACvE,cAAc;gBACdC,eAAe;YACjB;YACAf,OAAO;gBACL3C,iBAAiBA,mBAAmB;gBACpCoB,OAAOA,SAAS;YAClB;YACAuC,OAAOzC;YACP0C,cAAY1C;YACZ2C,WAAW1C;sBAEVe,iCACC,KAAChD;gBACC4E,MAAM5B,iBAAiBE,GAAG;gBAC1B2B,QAAQ7B,iBAAiB8B,WAAW,GAAG,WAAW;gBAClDC,KAAK/B,iBAAiB8B,WAAW,GAAG,wBAAwB7B;0BAE3D1B;iBAGHA;;;AAKV"}
1
+ {"version":3,"sources":["../../src/Table/TableCell.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n Box,\n Link,\n TableCell as MuiTableCell,\n TableCellProps as MuiTableCellProps,\n styled,\n useTheme,\n} from '@mui/material';\nimport { ReactElement, useEffect, useMemo, useRef } from 'react';\n\nimport { hasDataFieldPatterns, replaceDataFields } from '../utils/data-field-interpolation';\nimport { DataLink, TableCellAlignment, TableDensity, getTableCellLayout } from './model/table-model';\n\nconst StyledMuiTableCell = styled(MuiTableCell)(({ theme }) => ({\n padding: 0,\n backgroundColor: 'inherit',\n\n '&.MuiTableCell-head': {\n // Important to avoid scrolling behind the header showing through.\n backgroundColor: theme.palette.background.default,\n },\n '&:focus-visible': {\n outline: `solid 1px ${theme.palette.primary.main}`,\n // Move inward a little to avoid getting cut off when focusing on items\n // at the edge of the table.\n outlineOffset: '-1px',\n borderRadius: 0,\n },\n}));\n\nexport interface TableCellProps extends Omit<MuiTableCellProps, 'tabIndex' | 'align'> {\n density: TableDensity;\n defaultColumnHeight?: 'auto' | number;\n\n // These values are used to adjust the spacing for the first/last columns.\n isLastColumn: boolean;\n isFirstColumn: boolean;\n\n align?: TableCellAlignment;\n\n /**\n * Additional information to be displayed when hovering over the cell. This\n * may be the full cell value (e.g. to enable the user to see the full value\n * if it is ellipsized to fit into the space) or some other descriptive text\n * that is useful for the user.\n *\n * The hover behavior is currently managed with the `title` attribute, but this\n * may be changed to a tooltip in the future.\n */\n description?: string;\n\n /**\n * How the cell should behave related to focus.\n * - `trigger-focus`: the cell should be auto-focused when it renders.\n * - `focus-next`: the cell should have tabindex=\"0\", so that it will be\n * focused the next time someone tabs with a keyboard.\n * - `none`: the cell should have tabindex=\"-1\", so it is not focused by\n * keyboard interactions at this time.\n */\n focusState?: 'trigger-focus' | 'focus-next' | 'none';\n onFocusTrigger?: (e: React.MouseEvent<HTMLTableCellElement> | React.KeyboardEvent<HTMLTableCellElement>) => void;\n color?: string;\n backgroundColor?: string;\n dataLink?: DataLink;\n adjacentCellsValuesMap?: Record<string, string>;\n}\n\nexport function TableCell({\n children,\n density,\n variant,\n width,\n defaultColumnHeight,\n focusState = 'none',\n onFocusTrigger,\n isFirstColumn,\n isLastColumn,\n description,\n align,\n color,\n backgroundColor,\n dataLink,\n adjacentCellsValuesMap,\n ...otherProps\n}: TableCellProps): ReactElement {\n const theme = useTheme();\n const elRef = useRef<HTMLTableCellElement>();\n\n const isHeader = variant === 'head';\n\n useEffect(() => {\n if (focusState === 'trigger-focus' && elRef.current) {\n elRef.current.focus();\n }\n }, [focusState]);\n\n const handleFocus: React.FocusEventHandler<HTMLTableCellElement> = (e) => {\n // From https://zellwk.com/blog/keyboard-focusable-elements/\n const nestedFocusTarget = e.currentTarget?.querySelector<HTMLElement>(\n 'a[href], button, input, textarea, select, details,[role=\"button\"]',\n );\n if (nestedFocusTarget) {\n // If the cell has a focusable child, focus it instead. Mostly used for\n // checkbox cells, but could have other uses.\n nestedFocusTarget.focus();\n }\n };\n\n const handleInteractionFocusTrigger: TableCellProps['onFocusTrigger'] = (e) => {\n // We use `onClick` and `onKeyUp` events instead of `onFocus` because of\n // some ordering issues with when the browser calls events and how this\n // plays with the triggering of focus with keyboard interactions.\n // These report that a focus event happened, so we can adjust the current\n // tabindex and focuses to the right cell.\n onFocusTrigger?.(e);\n };\n\n const modifiedDataLink = useMemo((): DataLink | undefined => {\n if (!dataLink) return undefined;\n\n if (adjacentCellsValuesMap && hasDataFieldPatterns(dataLink.url)) {\n const { text } = replaceDataFields(dataLink.url, adjacentCellsValuesMap, { urlEncode: true });\n return { ...dataLink, url: text };\n }\n return dataLink;\n }, [dataLink, adjacentCellsValuesMap]);\n\n return (\n <StyledMuiTableCell\n {...otherProps}\n // Modify the tab index based on the currently focused cell. It's important\n // to avoid having tabindex 0 on everything because it essentially traps\n // a keyboard user in the table until they hit \"tab\" for every single\n // cell.\n tabIndex={focusState !== 'none' ? 0 : -1}\n onFocus={handleFocus}\n onClick={handleInteractionFocusTrigger}\n onKeyUp={handleInteractionFocusTrigger}\n style={{ width: width }}\n sx={{\n position: 'relative',\n borderBottom: isHeader ? `solid 1px ${theme.palette.grey[100]}` : `solid 1px ${theme.palette.grey[50]}`,\n '&:hover #original-cell': {\n position: 'absolute',\n top: 0,\n left: 0,\n zIndex: 10,\n width: 'fit-content',\n minWidth: '100%',\n whiteSpace: 'nowrap',\n overflow: 'visible',\n backgroundColor: `${backgroundColor ?? theme.palette.background.default} !important`,\n outline: `solid 1px ${theme.palette.info.main}`,\n outlineOffset: '-1px',\n },\n }}\n ref={elRef}\n >\n <Box\n id=\"original-cell\"\n sx={{\n ...getTableCellLayout(theme, density, { isHeader, isLastColumn, isFirstColumn, defaultColumnHeight }),\n position: 'relative',\n\n // Text truncation. Currently enforced on all cells. We may control\n // this with a prop on column config in the future.\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n\n // Need to inherit from the MUI cell because this manages some ordering\n // that the `TableSortLabel` uses to determine the location of the icon\n // in headers.\n flexDirection: 'inherit',\n }}\n style={{\n backgroundColor: backgroundColor ?? 'inherit',\n color: color ?? 'inherit',\n }}\n title={description}\n aria-label={description}\n textAlign={align}\n >\n {modifiedDataLink ? (\n <Link\n href={modifiedDataLink.url}\n target={modifiedDataLink.targetBlank ? '_blank' : '_self'}\n rel={modifiedDataLink.targetBlank ? 'noopener noreferrer' : undefined}\n >\n {children}\n </Link>\n ) : (\n children\n )}\n </Box>\n </StyledMuiTableCell>\n );\n}\n"],"names":["Box","Link","TableCell","MuiTableCell","styled","useTheme","useEffect","useMemo","useRef","hasDataFieldPatterns","replaceDataFields","getTableCellLayout","StyledMuiTableCell","theme","padding","backgroundColor","palette","background","default","outline","primary","main","outlineOffset","borderRadius","children","density","variant","width","defaultColumnHeight","focusState","onFocusTrigger","isFirstColumn","isLastColumn","description","align","color","dataLink","adjacentCellsValuesMap","otherProps","elRef","isHeader","current","focus","handleFocus","e","nestedFocusTarget","currentTarget","querySelector","handleInteractionFocusTrigger","modifiedDataLink","undefined","url","text","urlEncode","tabIndex","onFocus","onClick","onKeyUp","style","sx","position","borderBottom","grey","top","left","zIndex","minWidth","whiteSpace","overflow","info","ref","id","textOverflow","flexDirection","title","aria-label","textAlign","href","target","targetBlank","rel"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SACEA,GAAG,EACHC,IAAI,EACJC,aAAaC,YAAY,EAEzBC,MAAM,EACNC,QAAQ,QACH,gBAAgB;AACvB,SAAuBC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAQ;AAEjE,SAASC,oBAAoB,EAAEC,iBAAiB,QAAQ,oCAAoC;AAC5F,SAAqDC,kBAAkB,QAAQ,sBAAsB;AAErG,MAAMC,qBAAqBR,OAAOD,cAAc,CAAC,EAAEU,KAAK,EAAE,GAAM,CAAA;QAC9DC,SAAS;QACTC,iBAAiB;QAEjB,uBAAuB;YACrB,kEAAkE;YAClEA,iBAAiBF,MAAMG,OAAO,CAACC,UAAU,CAACC,OAAO;QACnD;QACA,mBAAmB;YACjBC,SAAS,CAAC,UAAU,EAAEN,MAAMG,OAAO,CAACI,OAAO,CAACC,IAAI,EAAE;YAClD,uEAAuE;YACvE,4BAA4B;YAC5BC,eAAe;YACfC,cAAc;QAChB;IACF,CAAA;AAuCA,OAAO,SAASrB,UAAU,EACxBsB,QAAQ,EACRC,OAAO,EACPC,OAAO,EACPC,KAAK,EACLC,mBAAmB,EACnBC,aAAa,MAAM,EACnBC,cAAc,EACdC,aAAa,EACbC,YAAY,EACZC,WAAW,EACXC,KAAK,EACLC,KAAK,EACLpB,eAAe,EACfqB,QAAQ,EACRC,sBAAsB,EACtB,GAAGC,YACY;IACf,MAAMzB,QAAQR;IACd,MAAMkC,QAAQ/B;IAEd,MAAMgC,WAAWd,YAAY;IAE7BpB,UAAU;QACR,IAAIuB,eAAe,mBAAmBU,MAAME,OAAO,EAA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AAO,EAAE,GAAG,UAAU,EAAE,EAAE,kBAAkB,GAAG,YAAY,CAsCjG"}
1
+ {"version":3,"file":"TableCheckbox.d.ts","sourceRoot":"","sources":["../../src/Table/TableCheckbox.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAY,aAAa,EAAS,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,eAAe,GAAG,UAAU,CAAC;IACvG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,EAAE,kBAAkB,GAAG,YAAY,CAsCjG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Table/TableCheckbox.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Checkbox, CheckboxProps, alpha } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { TableDensity } from './model/table-model';\n\nexport interface TableCheckboxProps extends Pick<CheckboxProps, 'checked' | 'indeterminate' | 'onChange'> {\n color?: string;\n density: TableDensity;\n}\n\nexport function TableCheckbox({ color, density, ...otherProps }: TableCheckboxProps): ReactElement {\n const isCompact = density === 'compact';\n\n return (\n <Checkbox\n size={isCompact ? 'small' : 'medium'}\n {...otherProps}\n // Disable ripple and set background color below because of some issues\n // with re-rendering with the keyboard interactions that causes the ripple\n // animation to stutter.\n focusRipple={false}\n // Tab index is handled by the overall keyboard interactions for the table\n // to avoid trapping a keyboard user in a table by requiring them to tab\n // through every single checkbox.\n tabIndex={-1}\n sx={{\n color: color,\n\n padding: (theme) => theme.spacing(isCompact ? 0.25 : 0.5),\n\n // Centering.\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n\n '&.Mui-checked': {\n color: color,\n },\n\n '&.Mui-focusVisible': {\n background: color ? alpha(color, 0.5) : undefined,\n },\n\n '& .MuiSvgIcon-root': { fontSize: isCompact ? 16 : 18 },\n }}\n />\n );\n}\n"],"names":["Checkbox","alpha","TableCheckbox","color","density","otherProps","isCompact","size","focusRipple","tabIndex","sx","padding","theme","spacing","position","top","left","transform","background","undefined","fontSize"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,QAAQ,EAAiBC,KAAK,QAAQ,gBAAgB;AAS/D,OAAO,SAASC,cAAc,EAAEC,KAAK,EAAEC,OAAO,EAAE,GAAGC,YAAgC;IACjF,MAAMC,YAAYF,YAAY;IAE9B,qBACE,KAACJ;QACCO,MAAMD,YAAY,UAAU;QAC3B,GAAGD,UAAU;QACd,uEAAuE;QACvE,0EAA0E;QAC1E,wBAAwB;QACxBG,aAAa;QACb,0EAA0E;QAC1E,wEAAwE;QACxE,iCAAiC;QACjCC,UAAU,CAAC;QACXC,IAAI;YACFP,OAAOA;YAEPQ,SAAS,CAACC,QAAUA,MAAMC,OAAO,CAACP,YAAY,OAAO;YAErD,aAAa;YACbQ,UAAU;YACVC,KAAK;YACLC,MAAM;YACNC,WAAW;YAEX,iBAAiB;gBACfd,OAAOA;YACT;YAEA,sBAAsB;gBACpBe,YAAYf,QAAQF,MAAME,OAAO,OAAOgB;YAC1C;YAEA,sBAAsB;gBAAEC,UAAUd,YAAY,KAAK;YAAG;QACxD;;AAGN"}
1
+ {"version":3,"sources":["../../src/Table/TableCheckbox.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Checkbox, CheckboxProps, alpha } from '@mui/material';\nimport { ReactElement } from 'react';\n\nimport { TableDensity } from './model/table-model';\n\nexport interface TableCheckboxProps extends Pick<CheckboxProps, 'checked' | 'indeterminate' | 'onChange'> {\n color?: string;\n density: TableDensity;\n}\n\nexport function TableCheckbox({ color, density, ...otherProps }: TableCheckboxProps): ReactElement {\n const isCompact = density === 'compact';\n\n return (\n <Checkbox\n size={isCompact ? 'small' : 'medium'}\n {...otherProps}\n // Disable ripple and set background color below because of some issues\n // with re-rendering with the keyboard interactions that causes the ripple\n // animation to stutter.\n focusRipple={false}\n // Tab index is handled by the overall keyboard interactions for the table\n // to avoid trapping a keyboard user in a table by requiring them to tab\n // through every single checkbox.\n tabIndex={-1}\n sx={{\n color: color,\n\n padding: (theme) => theme.spacing(isCompact ? 0.25 : 0.5),\n\n // Centering.\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n\n '&.Mui-checked': {\n color: color,\n },\n\n '&.Mui-focusVisible': {\n background: color ? alpha(color, 0.5) : undefined,\n },\n\n '& .MuiSvgIcon-root': { fontSize: isCompact ? 16 : 18 },\n }}\n />\n );\n}\n"],"names":["Checkbox","alpha","TableCheckbox","color","density","otherProps","isCompact","size","focusRipple","tabIndex","sx","padding","theme","spacing","position","top","left","transform","background","undefined","fontSize"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,QAAQ,EAAiBC,KAAK,QAAQ,gBAAgB;AAU/D,OAAO,SAASC,cAAc,EAAEC,KAAK,EAAEC,OAAO,EAAE,GAAGC,YAAgC;IACjF,MAAMC,YAAYF,YAAY;IAE9B,qBACE,KAACJ;QACCO,MAAMD,YAAY,UAAU;QAC3B,GAAGD,UAAU;QACd,uEAAuE;QACvE,0EAA0E;QAC1E,wBAAwB;QACxBG,aAAa;QACb,0EAA0E;QAC1E,wEAAwE;QACxE,iCAAiC;QACjCC,UAAU,CAAC;QACXC,IAAI;YACFP,OAAOA;YAEPQ,SAAS,CAACC,QAAUA,MAAMC,OAAO,CAACP,YAAY,OAAO;YAErD,aAAa;YACbQ,UAAU;YACVC,KAAK;YACLC,MAAM;YACNC,WAAW;YAEX,iBAAiB;gBACfd,OAAOA;YACT;YAEA,sBAAsB;gBACpBe,YAAYf,QAAQF,MAAME,OAAO,OAAOgB;YAC1C;YAEA,sBAAsB;gBAAEC,UAAUd,YAAY,KAAK;YAAG;QACxD;;AAGN"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { TableFooterProps as MuiTableFooterProps } from '@mui/material';
3
2
  export declare const TableFoot: import("react").ForwardRefExoticComponent<Omit<MuiTableFooterProps, "ref"> & import("react").RefAttributes<HTMLTableSectionElement>>;
4
3
  //# sourceMappingURL=TableFoot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableFoot.d.ts","sourceRoot":"","sources":["../../src/Table/TableFoot.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAiC,gBAAgB,IAAI,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGvG,eAAO,MAAM,SAAS,sIAEpB,CAAC"}
1
+ {"version":3,"file":"TableFoot.d.ts","sourceRoot":"","sources":["../../src/Table/TableFoot.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAiC,gBAAgB,IAAI,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGvG,eAAO,MAAM,SAAS,sIAEpB,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { TableHeadProps as MuiTableHeadProps } from '@mui/material';
3
2
  type TableHeadProps = MuiTableHeadProps;
4
3
  export declare const TableHead: import("react").ForwardRefExoticComponent<Omit<TableHeadProps, "ref"> & import("react").RefAttributes<HTMLTableSectionElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"TableHead.d.ts","sourceRoot":"","sources":["../../src/Table/TableHead.tsx"],"names":[],"mappings":";AAaA,OAAO,EAA6B,cAAc,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAG/F,KAAK,cAAc,GAAG,iBAAiB,CAAC;AAExC,eAAO,MAAM,SAAS,iIAEpB,CAAC"}
1
+ {"version":3,"file":"TableHead.d.ts","sourceRoot":"","sources":["../../src/Table/TableHead.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA6B,cAAc,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAG/F,KAAK,cAAc,GAAG,iBAAiB,CAAC;AAExC,eAAO,MAAM,SAAS,iIAEpB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { ReactElement } from 'react';
2
- import { TableCellProps } from './TableCell';
3
2
  import { SortDirection } from './model/table-model';
3
+ import { TableCellProps } from './TableCell';
4
4
  export interface TableHeaderCellProps extends TableCellProps {
5
5
  /**
6
6
  * Handler called when a sort event is triggered.
@@ -1 +1 @@
1
- {"version":3,"file":"TableHeaderCell.d.ts","sourceRoot":"","sources":["../../src/Table/TableHeaderCell.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAa,cAAc,EAAE,M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EAAE,YAAY,CAAC;CAC7B;AAED,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC;;OAEG;IACH,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAE7B;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,QAAQ,EACR,YAAY,EACZ,GAAG,SAAS,EACb,EAAE,oBAAoB,GAAG,YAAY,CA6ErC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Table/TableHeaderCell.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TableSortLabel, Typography, tableSortLabelClasses, Box, Divider } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { TableCell, TableCellProps } from './TableCell';\nimport { SortDirection } from './model/table-model';\n\nexport interface TableHeaderCellProps extends TableCellProps {\n /**\n * Handler called when a sort event is triggered.\n * When specified, the header will include sorting interactions and indicators.\n */\n onSort?: ((event: unknown) => void) | undefined;\n\n /**\n * The current direction the header is sorted.\n */\n sortDirection?: SortDirection;\n\n /**\n * The next direction the header will be sorted when another sort action\n * is triggered via click/keyboard. This impacts some UI interactions (e.g.\n * the direction of the sort arrow on hover f the column is currently\n * unsorted.)\n */\n nextSortDirection?: SortDirection;\n\n /**\n * Configuration for column resizing interactions.\n * When included, the header will include a resize handle (divider).\n */\n resizeConfig?: ResizeConfig;\n}\n\nexport interface ResizeConfig {\n /**\n * Handler called when a column resize event is triggered.\n */\n resizeHandler: (event: unknown) => void;\n /**\n * Handler called when a column reset size event is triggered (double-click on the resize handle).\n */\n resetSizeHandler: () => void;\n\n /**\n * Indicates whether the column is currently being resized.\n */\n isResizing: boolean;\n}\n\nexport function TableHeaderCell({\n onSort,\n sortDirection,\n nextSortDirection,\n children,\n resizeConfig,\n ...cellProps\n}: TableHeaderCellProps): ReactElement {\n const showSortLabel = !!onSort;\n\n const headerText = (\n <Typography noWrap variant=\"inherit\" component=\"div\" color=\"inherit\">\n {children}\n </Typography>\n );\n\n const isActive = !!sortDirection;\n const direction = isActive ? sortDirection : nextSortDirection;\n\n return (\n <TableCell {...cellProps}>\n {showSortLabel ? (\n <TableSortLabel\n onClick={onSort}\n direction={direction}\n active={isActive}\n sx={{\n // Overrides a default vertical alignment in the CSS that changes\n // the header vertical rhythm in a way that's inconsistent with\n // non-sorting headers.\n verticalAlign: 'unset',\n\n // Makes it possible to ellipsize the text if it's too long.\n maxWidth: '100%',\n\n // Make the arrow visible when focused using the keyboard to assist\n // with a11y.\n '&:focus-visible': {\n [`& .${tableSortLabelClasses.icon}`]: {\n opacity: isActive ? 1 : 0.5,\n },\n },\n }}\n >\n {headerText}\n </TableSortLabel>\n ) : (\n headerText\n )}\n {resizeConfig && (\n <Box\n onMouseDown={(e) => {\n if (e.detail === 2) {\n resizeConfig.resetSizeHandler();\n return;\n }\n resizeConfig.resizeHandler(e);\n }}\n onTouchStart={resizeConfig.resizeHandler}\n sx={{\n position: 'absolute',\n height: '100%',\n top: 0,\n right: '4px',\n cursor: 'col-resize',\n }}\n >\n <Divider\n flexItem\n orientation=\"vertical\"\n sx={(theme) => ({\n backgroundColor: resizeConfig.isResizing ? theme.palette.action.active : theme.palette.divider,\n borderRadius: '2px',\n borderWidth: '2px',\n height: '100%',\n touchAction: 'none',\n transform: 'translateX(4px)',\n userSelect: 'none',\n })}\n />\n </Box>\n )}\n </TableCell>\n );\n}\n"],"names":["TableSortLabel","Typography","tableSortLabelClasses","Box","Divider","TableCell","TableHeaderCell","onSort","sortDirection","nextSortDirection","children","resizeConfig","cellProps","showSortLabel","headerText","noWrap","variant","component","color","isActive","direction","onClick","active","sx","verticalAlign","maxWidth","icon","opacity","onMouseDown","e","detail","resetSizeHandler","resizeHandler","onTouchStart","position","height","top","right","cursor","flexItem","orientation","theme","backgroundColor","isResizing","palette","action","divider","borderRadius","borderWidth","touchAction","transform","userSelect"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,cAAc,EAAEC,UAAU,EAAEC,qBAAqB,EAAEC,GAAG,EAAEC,OAAO,QAAQ,gBAAgB;AAEhG,SAASC,SAAS,QAAwB,cAAc;AA8CxD,OAAO,SAASC,gBAAgB,EAC9BC,MAAM,EACNC,aAAa,EACbC,iBAAiB,EACjBC,QAAQ,EACRC,YAAY,EACZ,GAAGC,WACkB;IACrB,MAAMC,gBAAgB,CAAC,CAACN;IAExB,MAAMO,2BACJ,KAACb;QAAWc,MAAM;QAACC,SAAQ;QAAUC,WAAU;QAAMC,OAAM;kBACxDR;;IAIL,MAAMS,WAAW,CAAC,CAACX;IACnB,MAAMY,YAAYD,WAAWX,gBAAgBC;IAE7C,qBACE,MAACJ;QAAW,GAAGO,SAAS;;YACrBC,8BACC,KAACb;gBACCqB,SAASd;gBACTa,WAAWA;gBACXE,QAAQH;gBACRI,IAAI;oBACF,iEAAiE;oBACjE,+DAA+D;oBAC/D,uBAAuB;oBACvBC,eAAe;oBAEf,4DAA4D;oBAC5DC,UAAU;oBAEV,mEAAmE;oBACnE,aAAa;oBACb,mBAAmB;wBACjB,CAAC,CAAC,GAAG,EAAEvB,sBAAsBwB,IAAI,EAAE,CAAC,EAAE;4BACpCC,SAASR,WAAW,IAAI;wBAC1B;oBACF;gBACF;0BAECL;iBAGHA;YAEDH,8BACC,KAACR;gBACCyB,aAAa,CAACC;oBACZ,IAAIA,EAAEC,MAAM,KAAK,GAAG;wBAClBnB,aAAaoB,gBAAgB;wBAC7B;oBACF;oBACApB,aAAaqB,aAAa,CAACH;gBAC7B;gBACAI,cAActB,aAAaqB,aAAa;gBACxCT,IAAI;oBACFW,UAAU;oBACVC,QAAQ;oBACRC,KAAK;oBACLC,OAAO;oBACPC,QAAQ;gBACV;0BAEA,cAAA,KAAClC;oBACCmC,QAAQ;oBACRC,aAAY;oBACZjB,IAAI,CAACkB,QAAW,CAAA;4BACdC,iBAAiB/B,aAAagC,UAAU,GAAGF,MAAMG,OAAO,CAACC,MAAM,CAACvB,MAAM,GAAGmB,MAAMG,OAAO,CAACE,OAAO;4BAC9FC,cAAc;4BACdC,aAAa;4BACbb,QAAQ;4BACRc,aAAa;4BACbC,WAAW;4BACXC,YAAY;wBACd,CAAA;;;;;AAMZ"}
1
+ {"version":3,"sources":["../../src/Table/TableHeaderCell.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TableSortLabel, Typography, tableSortLabelClasses, Box, Divider } from '@mui/material';\nimport { ReactElement } from 'react';\n\nimport { SortDirection } from './model/table-model';\nimport { TableCell, TableCellProps } from './TableCell';\n\nexport interface TableHeaderCellProps extends TableCellProps {\n /**\n * Handler called when a sort event is triggered.\n * When specified, the header will include sorting interactions and indicators.\n */\n onSort?: ((event: unknown) => void) | undefined;\n\n /**\n * The current direction the header is sorted.\n */\n sortDirection?: SortDirection;\n\n /**\n * The next direction the header will be sorted when another sort action\n * is triggered via click/keyboard. This impacts some UI interactions (e.g.\n * the direction of the sort arrow on hover f the column is currently\n * unsorted.)\n */\n nextSortDirection?: SortDirection;\n\n /**\n * Configuration for column resizing interactions.\n * When included, the header will include a resize handle (divider).\n */\n resizeConfig?: ResizeConfig;\n}\n\nexport interface ResizeConfig {\n /**\n * Handler called when a column resize event is triggered.\n */\n resizeHandler: (event: unknown) => void;\n /**\n * Handler called when a column reset size event is triggered (double-click on the resize handle).\n */\n resetSizeHandler: () => void;\n\n /**\n * Indicates whether the column is currently being resized.\n */\n isResizing: boolean;\n}\n\nexport function TableHeaderCell({\n onSort,\n sortDirection,\n nextSortDirection,\n children,\n resizeConfig,\n ...cellProps\n}: TableHeaderCellProps): ReactElement {\n const showSortLabel = !!onSort;\n\n const headerText = (\n <Typography noWrap variant=\"inherit\" component=\"div\" color=\"inherit\">\n {children}\n </Typography>\n );\n\n const isActive = !!sortDirection;\n const direction = isActive ? sortDirection : nextSortDirection;\n\n return (\n <TableCell {...cellProps}>\n {showSortLabel ? (\n <TableSortLabel\n onClick={onSort}\n direction={direction}\n active={isActive}\n sx={{\n // Overrides a default vertical alignment in the CSS that changes\n // the header vertical rhythm in a way that's inconsistent with\n // non-sorting headers.\n verticalAlign: 'unset',\n\n // Makes it possible to ellipsize the text if it's too long.\n maxWidth: '100%',\n\n // Make the arrow visible when focused using the keyboard to assist\n // with a11y.\n '&:focus-visible': {\n [`& .${tableSortLabelClasses.icon}`]: {\n opacity: isActive ? 1 : 0.5,\n },\n },\n }}\n >\n {headerText}\n </TableSortLabel>\n ) : (\n headerText\n )}\n {resizeConfig && (\n <Box\n onMouseDown={(e) => {\n if (e.detail === 2) {\n resizeConfig.resetSizeHandler();\n return;\n }\n resizeConfig.resizeHandler(e);\n }}\n onTouchStart={resizeConfig.resizeHandler}\n sx={{\n position: 'absolute',\n height: '100%',\n top: 0,\n right: '4px',\n cursor: 'col-resize',\n }}\n >\n <Divider\n flexItem\n orientation=\"vertical\"\n sx={(theme) => ({\n backgroundColor: resizeConfig.isResizing ? theme.palette.action.active : theme.palette.divider,\n borderRadius: '2px',\n borderWidth: '2px',\n height: '100%',\n touchAction: 'none',\n transform: 'translateX(4px)',\n userSelect: 'none',\n })}\n />\n </Box>\n )}\n </TableCell>\n );\n}\n"],"names":["TableSortLabel","Typography","tableSortLabelClasses","Box","Divider","TableCell","TableHeaderCell","onSort","sortDirection","nextSortDirection","children","resizeConfig","cellProps","showSortLabel","headerText","noWrap","variant","component","color","isActive","direction","onClick","active","sx","verticalAlign","maxWidth","icon","opacity","onMouseDown","e","detail","resetSizeHandler","resizeHandler","onTouchStart","position","height","top","right","cursor","flexItem","orientation","theme","backgroundColor","isResizing","palette","action","divider","borderRadius","borderWidth","touchAction","transform","userSelect"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,cAAc,EAAEC,UAAU,EAAEC,qBAAqB,EAAEC,GAAG,EAAEC,OAAO,QAAQ,gBAAgB;AAIhG,SAASC,SAAS,QAAwB,cAAc;AA6CxD,OAAO,SAASC,gBAAgB,EAC9BC,MAAM,EACNC,aAAa,EACbC,iBAAiB,EACjBC,QAAQ,EACRC,YAAY,EACZ,GAAGC,WACkB;IACrB,MAAMC,gBAAgB,CAAC,CAACN;IAExB,MAAMO,2BACJ,KAACb;QAAWc,MAAM;QAACC,SAAQ;QAAUC,WAAU;QAAMC,OAAM;kBACxDR;;IAIL,MAAMS,WAAW,CAAC,CAACX;IACnB,MAAMY,YAAYD,WAAWX,gBAAgBC;IAE7C,qBACE,MAACJ;QAAW,GAAGO,SAAS;;YACrBC,8BACC,KAACb;gBACCqB,SAASd;gBACTa,WAAWA;gBACXE,QAAQH;gBACRI,IAAI;oBACF,iEAAiE;oBACjE,+DAA+D;oBAC/D,uBAAuB;oBACvBC,eAAe;oBAEf,4DAA4D;oBAC5DC,UAAU;oBAEV,mEAAmE;oBACnE,aAAa;oBACb,mBAAmB;wBACjB,CAAC,CAAC,GAAG,EAAEvB,sBAAsBwB,IAAI,EAAE,CAAC,EAAE;4BACpCC,SAASR,WAAW,IAAI;wBAC1B;oBACF;gBACF;0BAECL;iBAGHA;YAEDH,8BACC,KAACR;gBACCyB,aAAa,CAACC;oBACZ,IAAIA,EAAEC,MAAM,KAAK,GAAG;wBAClBnB,aAAaoB,gBAAgB;wBAC7B;oBACF;oBACApB,aAAaqB,aAAa,CAACH;gBAC7B;gBACAI,cAActB,aAAaqB,aAAa;gBACxCT,IAAI;oBACFW,UAAU;oBACVC,QAAQ;oBACRC,KAAK;oBACLC,OAAO;oBACPC,QAAQ;gBACV;0BAEA,cAAA,KAAClC;oBACCmC,QAAQ;oBACRC,aAAY;oBACZjB,IAAI,CAACkB,QAAW,CAAA;4BACdC,iBAAiB/B,aAAagC,UAAU,GAAGF,MAAMG,OAAO,CAACC,MAAM,CAACvB,MAAM,GAAGmB,MAAMG,OAAO,CAACE,OAAO;4BAC9FC,cAAc;4BACdC,aAAa;4BACbb,QAAQ;4BACRc,aAAa;4BACbC,WAAW;4BACXC,YAAY;wBACd,CAAA;;;;;AAMZ"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { TableRowProps as MuiTableRowProps } from '@mui/material';
3
2
  import { TableDensity } from './model/table-model';
4
3
  interface TableRowProps extends MuiTableRowProps<'div'> {
@@ -1 +1 @@
1
- {"version":3,"file":"TableRow.d.ts","sourceRoot":"","sources":["../../src/Table/TableRow.tsx"],"names":[],"mappings":";AAaA,OAAO,EAA2B,aAAa,IAAI,gBAAgB,EAAS,MAAM,eAAe,CAAC;AAElG,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,UAAU,aAAc,SAAQ,gBAAgB,CAAC,KAAK,CAAC;IACrD,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,eAAO,MAAM,QAAQ,4HAanB,CAAC"}
1
+ {"version":3,"file":"TableRow.d.ts","sourceRoot":"","sources":["../../src/Table/TableRow.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA2B,aAAa,IAAI,gBAAgB,EAAS,MAAM,eAAe,CAAC;AAGlG,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,UAAU,aAAc,SAAQ,gBAAgB,CAAC,KAAK,CAAC;IACrD,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,eAAO,MAAM,QAAQ,4HAanB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Table/TableRow.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TableRow as MuiTableRow, TableRowProps as MuiTableRowProps, alpha } from '@mui/material';\nimport { forwardRef } from 'react';\nimport { TableDensity } from './model/table-model';\n\ninterface TableRowProps extends MuiTableRowProps<'div'> {\n density: TableDensity;\n}\n\nexport const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(function TableRow(props, ref) {\n return (\n <MuiTableRow\n {...props}\n ref={ref}\n sx={{\n backgroundColor: (theme) => theme.palette.background.default,\n '&:hover': {\n backgroundColor: (theme) => alpha(theme.palette.primary.main, theme.palette.action.hoverOpacity),\n },\n }}\n />\n );\n});\n"],"names":["TableRow","MuiTableRow","alpha","forwardRef","props","ref","sx","backgroundColor","theme","palette","background","default","primary","main","action","hoverOpacity"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,YAAYC,WAAW,EAAqCC,KAAK,QAAQ,gBAAgB;AAClG,SAASC,UAAU,QAAQ,QAAQ;AAOnC,OAAO,MAAMH,yBAAWG,WAA+C,SAASH,SAASI,KAAK,EAAEC,GAAG;IACjG,qBACE,KAACJ;QACE,GAAGG,KAAK;QACTC,KAAKA;QACLC,IAAI;YACFC,iBAAiB,CAACC,QAAUA,MAAMC,OAAO,CAACC,UAAU,CAACC,OAAO;YAC5D,WAAW;gBACTJ,iBAAiB,CAACC,QAAUN,MAAMM,MAAMC,OAAO,CAACG,OAAO,CAACC,IAAI,EAAEL,MAAMC,OAAO,CAACK,MAAM,CAACC,YAAY;YACjG;QACF;;AAGN,GAAG"}
1
+ {"version":3,"sources":["../../src/Table/TableRow.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TableRow as MuiTableRow, TableRowProps as MuiTableRowProps, alpha } from '@mui/material';\nimport { forwardRef } from 'react';\n\nimport { TableDensity } from './model/table-model';\n\ninterface TableRowProps extends MuiTableRowProps<'div'> {\n density: TableDensity;\n}\n\nexport const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(function TableRow(props, ref) {\n return (\n <MuiTableRow\n {...props}\n ref={ref}\n sx={{\n backgroundColor: (theme) => theme.palette.background.default,\n '&:hover': {\n backgroundColor: (theme) => alpha(theme.palette.primary.main, theme.palette.action.hoverOpacity),\n },\n }}\n />\n );\n});\n"],"names":["TableRow","MuiTableRow","alpha","forwardRef","props","ref","sx","backgroundColor","theme","palette","background","default","primary","main","action","hoverOpacity"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,YAAYC,WAAW,EAAqCC,KAAK,QAAQ,gBAAgB;AAClG,SAASC,UAAU,QAAQ,QAAQ;AAQnC,OAAO,MAAMH,yBAAWG,WAA+C,SAASH,SAASI,KAAK,EAAEC,GAAG;IACjG,qBACE,KAACJ;QACE,GAAGG,KAAK;QACTC,KAAKA;QACLC,IAAI;YACFC,iBAAiB,CAACC,QAAUA,MAAMC,OAAO,CAACC,UAAU,CAACC,OAAO;YAC5D,WAAW;gBACTJ,iBAAiB,CAACC,QAAUN,MAAMM,MAAMC,OAAO,CAACG,OAAO,CAACC,IAAI,EAAEL,MAAMC,OAAO,CAACK,MAAM,CAACC,YAAY;YACjG;QACF;;AAGN,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"TableToolbar.d.ts","sourceRoot":"","sources":["../../src/Table/TableToolbar.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAyB,MAAM,OAAO,CAAC;AAQ5D,MAAM,WAAW,iBAAiB,CAAC,SAAS;IAC1C;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAE9C;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,C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AAO,CAAC;IAE7B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,EACtC,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACrB,OAAO,EACP,KAAK,EACL,yBAA+B,EAC/B,kBAAkB,EAClB,aAAa,EACb,iBAAiB,GAClB,EAAE,iBAAiB,CAAC,SAAS,CAAC,GAAG,YAAY,GAAG,IAAI,CAyGpD"}
@@ -12,12 +12,12 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
14
  import { Checkbox, IconButton, InputAdornment, ListItemText, Menu, MenuItem, Stack, Tooltip } from '@mui/material';
15
- import { useCallback, useState } from 'react';
16
- import Magnify from 'mdi-material-ui/Magnify';
17
15
  import Close from 'mdi-material-ui/Close';
18
- import ViewColumn from 'mdi-material-ui/ViewColumn';
19
- import UnfoldMore from 'mdi-material-ui/UnfoldMoreHorizontal';
16
+ import Magnify from 'mdi-material-ui/Magnify';
20
17
  import UnfoldLess from 'mdi-material-ui/UnfoldLessHorizontal';
18
+ import UnfoldMore from 'mdi-material-ui/UnfoldMoreHorizontal';
19
+ import ViewColumn from 'mdi-material-ui/ViewColumn';
20
+ import { useCallback, useState } from 'react';
21
21
  import { TextField } from '../controls';
22
22
  export function TableToolbar({ isSearchEnabled, globalFilter, onGlobalFilterChange, isColumnFilterEnabled, columns, width, columnFilterMenuMaxHeight = 400, isExpandAllEnabled, isAllExpanded, onExpandAllChange }) {
23
23
  const [colMenuAnchor, setColMenuAnchor] = useState(null);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Table/TableToolbar.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Checkbox, IconButton, InputAdornment, ListItemText, Menu, MenuItem, Stack, Tooltip } from '@mui/material';\nimport { Column } from '@tanstack/react-table';\nimport { ReactElement, useCallback, useState } from 'react';\nimport Magnify from 'mdi-material-ui/Magnify';\nimport Close from 'mdi-material-ui/Close';\nimport ViewColumn from 'mdi-material-ui/ViewColumn';\nimport UnfoldMore from 'mdi-material-ui/UnfoldMoreHorizontal';\nimport UnfoldLess from 'mdi-material-ui/UnfoldLessHorizontal';\nimport { TextField } from '../controls';\n\nexport interface TableToolbarProps<TableData> {\n /**\n * When `true`, a search input is rendered.\n */\n isSearchEnabled?: boolean;\n\n /**\n * Current value of the global filter / search query.\n */\n globalFilter: string;\n\n /**\n * Callback fired when the search query changes.\n */\n onGlobalFilterChange: (value: string) => void;\n\n /**\n * When `true`, a \"Columns\" button is rendered that opens a column visibility dropdown.\n */\n isColumnFilterEnabled?: boolean;\n\n /**\n * All columns from the table instance, used to build the visibility menu.\n */\n columns: Array<Column<TableData>>;\n /**\n * The width of the toolbar, used to determine when to switch to a more compact layout.\n */\n width: number | string;\n\n /**\n * Max height for the column filter menu.\n */\n columnFilterMenuMaxHeight?: number | string;\n\n /**\n * When `true`, an \"Expand All\" / \"Collapse All\" toggle button is rendered.\n */\n isExpandAllEnabled?: boolean;\n\n /**\n * Whether all rows are currently expanded.\n */\n isAllExpanded?: boolean;\n\n /**\n * Callback to toggle expand/collapse all rows.\n */\n onExpandAllChange?: (event: unknown) => void;\n}\n\nexport function TableToolbar<TableData>({\n isSearchEnabled,\n globalFilter,\n onGlobalFilterChange,\n isColumnFilterEnabled,\n columns,\n width,\n columnFilterMenuMaxHeight = 400,\n isExpandAllEnabled,\n isAllExpanded,\n onExpandAllChange,\n}: TableToolbarProps<TableData>): ReactElement | null {\n const [colMenuAnchor, setColMenuAnchor] = useState<null | HTMLElement>(null);\n const colMenuOpen = Boolean(colMenuAnchor);\n const [searchResetKey, setSearchResetKey] = useState(0);\n\n const handleSearchClear = useCallback(() => {\n onGlobalFilterChange('');\n setSearchResetKey((prev) => prev + 1);\n }, [onGlobalFilterChange]);\n\n if (!isSearchEnabled && !isColumnFilterEnabled && !isExpandAllEnabled) {\n return null;\n }\n\n return (\n <Stack\n direction=\"row\"\n gap={1}\n alignItems=\"center\"\n justifyContent=\"flex-end\"\n width={width}\n padding=\"0.5rem\"\n sx={{ backgroundColor: (theme) => theme.palette.background.default }}\n >\n {isSearchEnabled && (\n <TextField\n key={searchResetKey}\n placeholder=\"Search...\"\n value={globalFilter}\n onChange={onGlobalFilterChange}\n variant=\"standard\"\n slotProps={{\n htmlInput: { 'aria-label': 'search table' },\n input: {\n startAdornment: (\n <InputAdornment position=\"start\">\n <Magnify fontSize=\"small\" />\n </InputAdornment>\n ),\n endAdornment: globalFilter !== '' && (\n <InputAdornment position=\"end\">\n <IconButton onClick={handleSearchClear}>\n <Close fontSize=\"small\" />\n </IconButton>\n </InputAdornment>\n ),\n },\n }}\n sx={{ flexGrow: 1 }}\n />\n )}\n {isExpandAllEnabled && (\n <Tooltip title={isAllExpanded ? 'Collapse all' : 'Expand all'}>\n <IconButton\n onClick={onExpandAllChange}\n color=\"info\"\n aria-label={isAllExpanded ? 'collapse all rows' : 'expand all rows'}\n >\n {isAllExpanded ? <UnfoldLess /> : <UnfoldMore />}\n </IconButton>\n </Tooltip>\n )}\n {isColumnFilterEnabled && (\n <>\n <IconButton\n onClick={(e) => setColMenuAnchor(e.currentTarget)}\n aria-haspopup=\"listbox\"\n aria-expanded={colMenuOpen}\n color=\"info\"\n >\n <ViewColumn />\n </IconButton>\n <Menu\n anchorEl={colMenuAnchor}\n open={colMenuOpen}\n onClose={() => setColMenuAnchor(null)}\n slotProps={{ list: { dense: true } }}\n sx={{ maxHeight: columnFilterMenuMaxHeight }}\n >\n {columns.map((column) => {\n const header = column.columnDef.header;\n const label = typeof header === 'string' ? header : column.id;\n return (\n <MenuItem\n key={column.id}\n disabled={!column.getCanHide()}\n onClick={column.getCanHide() ? column.getToggleVisibilityHandler() : undefined}\n dense\n >\n <Checkbox\n checked={column.getIsVisible()}\n disabled={!column.getCanHide()}\n size=\"small\"\n disableRipple\n sx={{ p: 0, mr: 1 }}\n />\n <ListItemText primary={label} />\n </MenuItem>\n );\n })}\n </Menu>\n </>\n )}\n </Stack>\n );\n}\n"],"names":["Checkbox","IconButton","InputAdornment","ListItemText","Menu","MenuItem","Stack","Tooltip","useCallback","useState","Magnify","Close","ViewColumn","UnfoldMore","UnfoldLess","TextField","TableToolbar","isSearchEnabled","globalFilter","onGlobalFilterChange","isColumnFilterEnabled","columns","width","columnFilterMenuMaxHeight","isExpandAllEnabled","isAllExpanded","onExpandAllChange","colMenuAnchor","setColMenuAnchor","colMenuOpen","Boolean","searchResetKey","setSearchResetKey","handleSearchClear","prev","direction","gap","alignItems","justifyContent","padding","sx","backgroundColor","theme","palette","background","default","placeholder","value","onChange","variant","slotProps","htmlInput","input","startAdornment","position","fontSize","endAdornment","onClick","flexGrow","title","color","aria-label","e","currentTarget","aria-haspopup","aria-expanded","anchorEl","open","onClose","list","dense","maxHeight","map","column","header","columnDef","label","id","disabled","getCanHide","getToggleVisibilityHandler","undefined","checked","getIsVisible","size","disableRipple","p","mr","primary"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,QAAQ,EAAEC,UAAU,EAAEC,cAAc,EAAEC,YAAY,EAAEC,IAAI,EAAEC,QAAQ,EAAE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AA,KAACrD;gCAAWwD,SAASxB;0CACnB,cAAA,KAACtB;oCAAM4C,UAAS;;;;oBAIxB;gBACF;gBACAf,IAAI;oBAAEkB,UAAU;gBAAE;eAtBb3B;YAyBRP,oCACC,KAACjB;gBAAQoD,OAAOlC,gBAAgB,iBAAiB;0BAC/C,cAAA,KAACxB;oBACCwD,SAAS/B;oBACTkC,OAAM;oBACNC,cAAYpC,gBAAgB,sBAAsB;8BAEjDA,8BAAgB,KAACX,gCAAgB,KAACD;;;YAIxCO,uCACC;;kCACE,KAACnB;wBACCwD,SAAS,CAACK,IAAMlC,iBAAiBkC,EAAEC,aAAa;wBAChDC,iBAAc;wBACdC,iBAAepC;wBACf+B,OAAM;kCAEN,cAAA,KAAChD;;kCAEH,KAACR;wBACC8D,UAAUvC;wBACVwC,MAAMtC;wBACNuC,SAAS,IAAMxC,iBAAiB;wBAChCsB,WAAW;4BAAEmB,MAAM;gCAAEC,OAAO;4BAAK;wBAAE;wBACnC9B,IAAI;4BAAE+B,WAAWhD;wBAA0B;kCAE1CF,QAAQmD,GAAG,CAAC,CAACC;4BACZ,MAAMC,SAASD,OAAOE,SAAS,CAACD,MAAM;4BACtC,MAAME,QAAQ,OAAOF,WAAW,WAAWA,SAASD,OAAOI,EAAE;4BAC7D,qBACE,MAACxE;gCAECyE,UAAU,CAACL,OAAOM,UAAU;gCAC5BtB,SAASgB,OAAOM,UAAU,KAAKN,OAAOO,0BAA0B,KAAKC;gCACrEX,KAAK;;kDAEL,KAACtE;wCACCkF,SAAST,OAAOU,YAAY;wCAC5BL,UAAU,CAACL,OAAOM,UAAU;wCAC5BK,MAAK;wCACLC,aAAa;wCACb7C,IAAI;4CAAE8C,GAAG;4CAAGC,IAAI;wCAAE;;kDAEpB,KAACpF;wCAAaqF,SAASZ;;;+BAZlBH,OAAOI,EAAE;wBAepB;;;;;;AAMZ"}
1
+ {"version":3,"sources":["../../src/Table/TableToolbar.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Checkbox, IconButton, InputAdornment, ListItemText, Menu, MenuItem, Stack, Tooltip } from '@mui/material';\nimport { Column } from '@tanstack/react-table';\nimport Close from 'mdi-material-ui/Close';\nimport Magnify from 'mdi-material-ui/Magnify';\nimport UnfoldLess from 'mdi-material-ui/UnfoldLessHorizontal';\nimport UnfoldMore from 'mdi-material-ui/UnfoldMoreHorizontal';\nimport ViewColumn from 'mdi-material-ui/ViewColumn';\nimport { ReactElement, useCallback, useState } from 'react';\n\nimport { TextField } from '../controls';\n\nexport interface TableToolbarProps<TableData> {\n /**\n * When `true`, a search input is rendered.\n */\n isSearchEnabled?: boolean;\n\n /**\n * Current value of the global filter / search query.\n */\n globalFilter: string;\n\n /**\n * Callback fired when the search query changes.\n */\n onGlobalFilterChange: (value: string) => void;\n\n /**\n * When `true`, a \"Columns\" button is rendered that opens a column visibility dropdown.\n */\n isColumnFilterEnabled?: boolean;\n\n /**\n * All columns from the table instance, used to build the visibility menu.\n */\n columns: Array<Column<TableData>>;\n /**\n * The width of the toolbar, used to determine when to switch to a more compact layout.\n */\n width: number | string;\n\n /**\n * Max height for the column filter menu.\n */\n columnFilterMenuMaxHeight?: number | string;\n\n /**\n * When `true`, an \"Expand All\" / \"Collapse All\" toggle button is rendered.\n */\n isExpandAllEnabled?: boolean;\n\n /**\n * Whether all rows are currently expanded.\n */\n isAllExpanded?: boolean;\n\n /**\n * Callback to toggle expand/collapse all rows.\n */\n onExpandAllChange?: (event: unknown) => void;\n}\n\nexport function TableToolbar<TableData>({\n isSearchEnabled,\n globalFilter,\n onGlobalFilterChange,\n isColumnFilterEnabled,\n columns,\n width,\n columnFilterMenuMaxHeight = 400,\n isExpandAllEnabled,\n isAllExpanded,\n onExpandAllChange,\n}: TableToolbarProps<TableData>): ReactElement | null {\n const [colMenuAnchor, setColMenuAnchor] = useState<null | HTMLElement>(null);\n const colMenuOpen = Boolean(colMenuAnchor);\n const [searchResetKey, setSearchResetKey] = useState(0);\n\n const handleSearchClear = useCallback(() => {\n onGlobalFilterChange('');\n setSearchResetKey((prev) => prev + 1);\n }, [onGlobalFilterChange]);\n\n if (!isSearchEnabled && !isColumnFilterEnabled && !isExpandAllEnabled) {\n return null;\n }\n\n return (\n <Stack\n direction=\"row\"\n gap={1}\n alignItems=\"center\"\n justifyContent=\"flex-end\"\n width={width}\n padding=\"0.5rem\"\n sx={{ backgroundColor: (theme) => theme.palette.background.default }}\n >\n {isSearchEnabled && (\n <TextField\n key={searchResetKey}\n placeholder=\"Search...\"\n value={globalFilter}\n onChange={onGlobalFilterChange}\n variant=\"standard\"\n slotProps={{\n htmlInput: { 'aria-label': 'search table' },\n input: {\n startAdornment: (\n <InputAdornment position=\"start\">\n <Magnify fontSize=\"small\" />\n </InputAdornment>\n ),\n endAdornment: globalFilter !== '' && (\n <InputAdornment position=\"end\">\n <IconButton onClick={handleSearchClear}>\n <Close fontSize=\"small\" />\n </IconButton>\n </InputAdornment>\n ),\n },\n }}\n sx={{ flexGrow: 1 }}\n />\n )}\n {isExpandAllEnabled && (\n <Tooltip title={isAllExpanded ? 'Collapse all' : 'Expand all'}>\n <IconButton\n onClick={onExpandAllChange}\n color=\"info\"\n aria-label={isAllExpanded ? 'collapse all rows' : 'expand all rows'}\n >\n {isAllExpanded ? <UnfoldLess /> : <UnfoldMore />}\n </IconButton>\n </Tooltip>\n )}\n {isColumnFilterEnabled && (\n <>\n <IconButton\n onClick={(e) => setColMenuAnchor(e.currentTarget)}\n aria-haspopup=\"listbox\"\n aria-expanded={colMenuOpen}\n color=\"info\"\n >\n <ViewColumn />\n </IconButton>\n <Menu\n anchorEl={colMenuAnchor}\n open={colMenuOpen}\n onClose={() => setColMenuAnchor(null)}\n slotProps={{ list: { dense: true } }}\n sx={{ maxHeight: columnFilterMenuMaxHeight }}\n >\n {columns.map((column) => {\n const header = column.columnDef.header;\n const label = typeof header === 'string' ? header : column.id;\n return (\n <MenuItem\n key={column.id}\n disabled={!column.getCanHide()}\n onClick={column.getCanHide() ? column.getToggleVisibilityHandler() : undefined}\n dense\n >\n <Checkbox\n checked={column.getIsVisible()}\n disabled={!column.getCanHide()}\n size=\"small\"\n disableRipple\n sx={{ p: 0, mr: 1 }}\n />\n <ListItemText primary={label} />\n </MenuItem>\n );\n })}\n </Menu>\n </>\n )}\n </Stack>\n );\n}\n"],"names":["Checkbox","IconButton","InputAdornment","ListItemText","Menu","MenuItem","Stack","Tooltip","Close","Magnify","UnfoldLess","UnfoldMore","ViewColumn","useCallback","useState","TextField","TableToolbar","isSearchEnabled","globalFilter","onGlobalFilterChange","isColumnFilterEnabled","columns","width","columnFilterMenuMaxHeight","isExpandAllEnabled","isAllExpanded","onExpandAllChange","colMenuAnchor","setColMenuAnchor","colMenuOpen","Boolean","searchResetKey","setSearchResetKey","handleSearchClear","prev","direction","gap","alignItems","justifyContent","padding","sx","backgroundColor","theme","palette","background","default","placeholder","value","onChange","variant","slotProps","htmlInput","input","startAdornment","position","fontSize","endAdornment","onClick","flexGrow","title","color","aria-label","e","currentTarget","aria-haspopup","aria-expanded","anchorEl","open","onClose","list","dense","maxHeight","map","column","header","columnDef","label","id","disabled","getCanHide","getToggleVisibilityHandler","undefined","checked","getIsVisible","size","disableRipple","p","mr","primary"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,QAAQ,EAAEC,UAAU,EAAEC,cAAc,EAAEC,YAAY,EAAE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ingState, HeaderGroup, Row } from '@tanstack/react-table';
2
2
  import { ReactElement } from 'react';
3
- import { TableToolbarProps } from './TableToolbar';
4
3
  import { TableCellConfigs, TableProps } from './model/table-model';
4
+ import { TableToolbarProps } from './TableToolbar';
5
5
  export type VirtualizedTableProps<TableData> = Required<Pick<TableProps<TableData>, 'height' | 'width' | 'density' | 'defaultColumnHeight' | 'defaultColumnWidth'>> & Pick<TableProps<TableData>, 'onRowMouseOver' | 'onRowMouseOut' | 'pagination' | 'onPaginationChange'> & {
6
6
  onRowClick: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, id: string) => void;
7
7
  rows: Array<Row<TableData>>;
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualizedTable.d.ts","sourceRoot":"","sources":["../../src/Table/VirtualizedTable.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,iBAAiB,EAAc,WAAW,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAGvH,OAAO,EAAE,YAAY,EAAmB,MAAM,OAAO,CAAC;AACtD,OAAO,EAAgB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAQjE,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAqB,MAAM,qBAAqB,CAAC;AAStF,MAAM,MAAM,qBAAqB,CAAC,SAAS,IAAI,QAAQ,CACrD,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,qBAAqB,GAAG,oBAAoB,CAAC,CAC3G,GACC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,gBAAgB,GAAG,eAAe,GAAG,YAAY,GAAG,oBAAoB,CAAC,GAAG;IACtG,UAAU,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,cAAc,EAAE,UAAU,CAAC,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAClF,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,SAA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@@ -11,20 +11,20 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
- import { flexRender } from '@tanstack/react-table';
15
14
  import { Box, TablePagination, TableRow as MuiTableRow } from '@mui/material';
16
- import { TableVirtuoso } from 'react-virtuoso';
15
+ import { flexRender } from '@tanstack/react-table';
17
16
  import { useMemo, useRef } from 'react';
18
- import { TableToolbar } from './TableToolbar';
19
- import { TableRow } from './TableRow';
20
- import { TableBody } from './TableBody';
17
+ import { TableVirtuoso } from 'react-virtuoso';
18
+ import { useVirtualizedTableKeyboardNav } from './hooks/useVirtualizedTableKeyboardNav';
21
19
  import { InnerTable } from './InnerTable';
20
+ import { TableBody } from './TableBody';
21
+ import { TableCell } from './TableCell';
22
+ import { TableFoot } from './TableFoot';
22
23
  import { TableHead } from './TableHead';
23
24
  import { TableHeaderCell } from './TableHeaderCell';
24
- import { TableCell } from './TableCell';
25
+ import { TableRow } from './TableRow';
26
+ import { TableToolbar } from './TableToolbar';
25
27
  import { VirtualizedTableContainer } from './VirtualizedTableContainer';
26
- import { useVirtualizedTableKeyboardNav } from './hooks/useVirtualizedTableKeyboardNav';
27
- import { TableFoot } from './TableFoot';
28
28
  // Separating out the virtualized table because we may want a paginated table
29
29
  // in the future that does not need virtualization, and we'd likely lay them
30
30
  // out differently.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Table/VirtualizedTable.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Column, ColumnSizingInfoState, ColumnSizingState, flexRender, HeaderGroup, Row } from '@tanstack/react-table';\nimport { Box, TablePagination, TableRow as MuiTableRow } from '@mui/material';\nimport { TableComponents, TableVirtuoso, TableVirtuosoHandle, TableVirtuosoProps } from 'react-virtuoso';\nimport { ReactElement, useMemo, useRef } from 'react';\nimport { TableToolbar, TableToolbarProps } from './TableToolbar';\nimport { TableRow } from './TableRow';\nimport { TableBody } from './TableBody';\nimport { InnerTable } from './InnerTable';\nimport { TableHead } from './TableHead';\nimport { TableHeaderCell } from './TableHeaderCell';\nimport { TableCell, TableCellProps } from './TableCell';\nimport { VirtualizedTableContainer } from './VirtualizedTableContainer';\nimport { TableCellConfigs, TableProps, TableRowEventOpts } from './model/table-model';\nimport { useVirtualizedTableKeyboardNav } from './hooks/useVirtualizedTableKeyboardNav';\nimport { TableFoot } from './TableFoot';\n\ntype TableCellPosition = {\n row: number;\n column: number;\n};\n\nexport type VirtualizedTableProps<TableData> = Required<\n Pick<TableProps<TableData>, 'height' | 'width' | 'density' | 'defaultColumnHeight' | 'defaultColumnWidth'>\n> &\n Pick<TableProps<TableData>, 'onRowMouseOver' | 'onRowMouseOut' | 'pagination' | 'onPaginationChange'> & {\n onRowClick: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, id: string) => void;\n rows: Array<Row<TableData>>;\n columns: Array<Column<TableData, unknown>>;\n headers: Array<HeaderGroup<TableData>>;\n columnSizing: ColumnSizingState;\n columnSizingInfo: ColumnSizingInfoState;\n cellConfigs?: TableCellConfigs;\n rowCount: number;\n toolbarConfig: Pick<\n TableToolbarProps<TableData>,\n | 'isSearchEnabled'\n | 'globalFilter'\n | 'onGlobalFilterChange'\n | 'isColumnFilterEnabled'\n | 'columns'\n | 'columnFilterMenuMaxHeight'\n | 'isExpandAllEnabled'\n | 'isAllExpanded'\n | 'onExpandAllChange'\n >;\n };\n\n// Separating out the virtualized table because we may want a paginated table\n// in the future that does not need virtualization, and we'd likely lay them\n// out differently.\nexport function VirtualizedTable<TableData>({\n width,\n height,\n density,\n defaultColumnWidth,\n defaultColumnHeight,\n onRowClick,\n onRowMouseOver,\n onRowMouseOut,\n rows,\n columns,\n headers,\n columnSizing,\n columnSizingInfo,\n cellConfigs,\n pagination,\n onPaginationChange,\n rowCount,\n toolbarConfig,\n}: VirtualizedTableProps<TableData>): ReactElement {\n const virtuosoRef = useRef<TableVirtuosoHandle>(null);\n // Use a ref for these values because they are only needed for keyboard\n // focus interactions and setting them on state will lead to a significant\n // amount of unnecessary re-renders.\n const visibleRange = useRef({\n startIndex: 0,\n endIndex: 0,\n });\n\n const setVisibleRange: TableVirtuosoProps<TableData, unknown>['rangeChanged'] = (newVisibleRange) => {\n visibleRange.current = newVisibleRange;\n };\n\n const keyboardNav = useVirtualizedTableKeyboardNav({\n visibleRange: visibleRange,\n virtualTable: virtuosoRef,\n\n // We add 1 here for the header.\n maxRows: rows.length + 1,\n maxColumns: columns.length,\n });\n\n const getFocusState = (cellPosition: TableCellPosition): TableCellProps['focusState'] => {\n if (cellPosition.row === keyboardNav.activeCell.row && cellPosition.column === keyboardNav.activeCell.column) {\n return keyboardNav.isActive ? 'trigger-focus' : 'focus-next';\n }\n\n return 'none';\n };\n\n const VirtuosoTableComponents: TableComponents<TableData> = useMemo(() => {\n return {\n Scroller: VirtualizedTableContainer,\n Table: (props): ReactElement => {\n return (\n <InnerTable\n {...props}\n width={width}\n density={density}\n onKeyDown={keyboardNav.onTableKeyDown}\n onBlur={keyboardNav.onTableBlur}\n />\n );\n },\n TableHead,\n TableFoot,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n TableRow: ({ item, ...props }): ReactElement | null => {\n const index = props['data-index'];\n const row = rows[index];\n if (!row) {\n return null;\n }\n\n const rowEventOpts: TableRowEventOpts = { id: row.id, index: row.index };\n\n return (\n <TableRow\n {...props}\n onClick={(e) => onRowClick(e, row.id)}\n density={density}\n onMouseOver={(e) => {\n onRowMouseOver?.(e, rowEventOpts);\n }}\n onMouseOut={(e) => {\n onRowMouseOut?.(e, rowEventOpts);\n }}\n />\n );\n },\n TableBody,\n };\n }, [\n density,\n keyboardNav.onTableKeyDown,\n keyboardNav.onTableBlur,\n onRowClick,\n onRowMouseOut,\n onRowMouseOver,\n rows,\n width,\n ]);\n\n const handleChangePage = (_event: React.MouseEvent<HTMLButtonElement> | null, newPage: number): void => {\n if (!pagination || !onPaginationChange) return;\n onPaginationChange({ ...pagination, pageIndex: newPage });\n };\n\n const handleChangeRowsPerPage = (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>): void => {\n if (!pagination || !onPaginationChange) return;\n onPaginationChange({ pageIndex: 0, pageSize: parseInt(event.target.value, 10) });\n };\n\n /**\n * Instead of calling `column.getSize()` on every render for every header\n * and especially every data cell (very expensive),\n * we will calculate all column sizes at once at the root table level in a useMemo\n * and pass the column sizes down as CSS variables to the <table> element.\n */\n const columnSizeVars = useMemo(() => {\n const colSizes: { [key: string]: number } = {};\n headers.forEach((headerGroup) => {\n headerGroup.headers\n .filter((header) => header.column.getCanResize())\n .forEach((header) => {\n colSizes[`--header-${header.id}-size`] = header.getSize();\n colSizes[`--col-${header.column.id}-size`] = header.column.getSize();\n });\n });\n return colSizes;\n // We want to recalculate column sizes whenever column sizes or column resizing info changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [columnSizingInfo, columnSizing, headers]);\n\n return (\n <Box style={{ width, height, ...columnSizeVars }}>\n <TableToolbar {...toolbarConfig} width={width} />\n <TableVirtuoso\n ref={virtuosoRef}\n totalCount={rows.length}\n components={VirtuosoTableComponents}\n // Note: this value is impacted by overscan. See this issue if overscan\n // is added.\n // https://github.com/petyosi/react-virtuoso/issues/118#issuecomment-642156138\n rangeChanged={setVisibleRange}\n fixedHeaderContent={() => {\n return (\n <>\n {headers.map((headerGroup) => {\n return (\n <TableRow key={headerGroup.id} density={density}>\n {headerGroup.headers.map((header, i, headers) => {\n const column = header.column;\n const position: TableCellPosition = {\n row: 0,\n column: i,\n };\n\n const isSorted = column.getIsSorted();\n const nextSorting = column.getNextSortingOrder();\n\n return (\n <TableHeaderCell\n key={header.id}\n onSort={column.getCanSort() ? column.getToggleSortingHandler() : undefined}\n sortDirection={typeof isSorted === 'string' ? isSorted : undefined}\n nextSortDirection={typeof nextSorting === 'string' ? nextSorting : undefined}\n width={\n header.column.getCanResize()\n ? `calc(var(--header-${header?.id}-size) * 1px)`\n : column.getSize() || defaultColumnWidth\n }\n defaultColumnHeight={defaultColumnHeight}\n align={column.columnDef.meta?.align}\n variant=\"head\"\n density={density}\n description={column.columnDef.meta?.headerDescription}\n focusState={getFocusState(position)}\n onFocusTrigger={() => keyboardNav.onCellFocus(position)}\n isFirstColumn={i === 0}\n isLastColumn={i === headers.length - 1}\n resizeConfig={\n header.column.getCanResize()\n ? {\n resizeHandler: header.getResizeHandler(),\n resetSizeHandler: header.column.resetSize,\n isResizing: header.column.getIsResizing(),\n }\n : undefined\n }\n >\n {flexRender(column.columnDef.header, header.getContext())}\n </TableHeaderCell>\n );\n })}\n </TableRow>\n );\n })}\n </>\n );\n }}\n fixedFooterContent={\n pagination\n ? (): ReactElement => (\n <MuiTableRow sx={{ backgroundColor: (theme) => theme.palette.background.default }}>\n <TablePagination\n colSpan={columns.length}\n count={rowCount}\n page={pagination.pageIndex}\n rowsPerPage={pagination.pageSize}\n onPageChange={handleChangePage}\n onRowsPerPageChange={handleChangeRowsPerPage}\n />\n </MuiTableRow>\n )\n : undefined\n }\n itemContent={(index) => {\n const row = rows[index];\n if (!row) {\n return null;\n }\n\n return (\n <>\n {row.getVisibleCells().map((cell, i, cells) => {\n const position: TableCellPosition = {\n row: index + 1,\n column: i,\n };\n\n const cellContext = cell.getContext();\n const cellConfig = cellConfigs?.[cellContext.cell.id];\n\n const cellRenderFn = cell.column.columnDef.cell;\n const cellContent = typeof cellRenderFn === 'function' ? cellRenderFn(cellContext) : null;\n\n /*\n IMPORTANT:\n If Variables exist in the link, they should have been translated by the plugin already. (Being developed at the moment)\n Components have no access to any context (Which is intentional and correct)\n We may want to add parameters to a link from neighboring cells in the future as well.\n If this is the case, the value of the neighboring cells should be read from here and be replaced. (Bing discussed at the moment, not decided yet)\n */\n\n const cellDescriptionDef = cell.column.columnDef.meta?.cellDescription;\n let description: string | undefined = undefined;\n if (typeof cellDescriptionDef === 'function') {\n // If the cell description is a function, set the value using\n // the function.\n description = cellDescriptionDef(cellContext);\n } else if (cellDescriptionDef && typeof cellContent === 'string') {\n // If the cell description is `true` AND the cell content is\n // a string (and thus viable as a `title` attribute), use the\n // cell content.\n description = cellContent;\n }\n\n /* this has been specifically added for the data link,\n therefore, non string and numeric values should be excluded\n */\n const adjacentCellsValuesMap = Object.entries(row.original as Record<string, unknown>)\n ?.filter(([_, value]) => ['string', 'number'].includes(typeof value))\n .reduce(\n (acc, [key, value]) => ({\n ...acc,\n [key]: String(value),\n }),\n {}\n );\n\n return (\n <TableCell\n key={cell.id}\n data-testid={cell.id}\n title={description || cellConfig?.text || cellContent}\n width={\n cell.column.getCanResize()\n ? `calc(var(--col-${cell.column.id}-size) * 1px)`\n : cell.column.getSize() || defaultColumnWidth\n }\n defaultColumnHeight={defaultColumnHeight}\n align={cell.column.columnDef.meta?.align}\n density={density}\n focusState={getFocusState(position)}\n onFocusTrigger={() => keyboardNav.onCellFocus(position)}\n isFirstColumn={i === 0}\n isLastColumn={i === cells.length - 1}\n description={description}\n color={cellConfig?.textColor ?? undefined}\n backgroundColor={cellConfig?.backgroundColor ?? undefined}\n dataLink={cell.column.columnDef.meta?.dataLink}\n adjacentCellsValuesMap={adjacentCellsValuesMap}\n >\n {cellConfig?.text || cellContent}\n </TableCell>\n );\n })}\n </>\n );\n }}\n />\n </Box>\n );\n}\n"],"names":["flexRender","Box","TablePagination","TableRow","MuiTableRow","TableVirtuoso","useMemo","useRef","TableToolbar","TableBody","InnerTable","TableHead","TableHeaderCell","TableCell","VirtualizedTableContainer","useVirtualizedTableKeyboardNav","TableFoot","VirtualizedTable","width","height","density","defaultColumnWidth","defaultColumnHeight","onRowClick","onRowMouseOver","onRowMouseOut","rows","columns","headers","columnSizing","columnSizingInfo","cellConfigs","pagination","onPaginationChange","rowCount","toolbarConfig","virtuosoRef","visibleRange","startIndex","endIndex","setVisibleRange","newVisibleRange","current","keyboardNav","virtualTable","maxRows","length","maxColumns","getFocusState","cellPosition","row","activeCell","column","isActive","VirtuosoTableComponents","Scroller","Table","props","onKeyDown","onTableKeyDown","onBlur","onTableBlur","item","index","rowEventOpts","id","onClick","e","onMouseOver","onMouseOut","handleChangePage","_event","newPage","pageIndex","handleChangeRowsPerPage","event","pageSize","parseInt","target","value","columnSizeVars","colSizes","forEach","headerGroup","filter","header","getCanResize","getSize","style","ref","totalCount","components","rangeChanged","fixedHeaderContent","map","i","position","isSorted","getIsSorted","nextSorting","getNextSortingOrder","onSort","getCanSort","getToggleSortingHandler","undefined","sortDirection","nextSortDirection","align","columnDef","meta","variant","description","headerDescription","focusState","onFocusTrigger","onCellFocus","isFirstColumn","isLastColumn","resizeConfig","resizeHandler","getResizeHandler","resetSizeHandler","resetSize","isResizing","getIsResizing","getContext","fixedFooterContent","sx","backgroundColor","theme","palette","background","default","colSpan","count","page","rowsPerPage","onPageChange","onRowsPerPageChange","itemContent","getVisibleCells","cell","cells","cellContext","cellConfig","cellRenderFn","cellContent","cellDescriptionDef","cellDescription","adjacentCellsValuesMap","Object","entries","original","_","includes","reduce","acc","key","String","data-testid","title","text","color","textColor","dataLink"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAA2DA,UAAU,QAA0B,wBAAwB;AACvH,SAASC,GAAG,EAAEC,eAAe,EAAEC,YAAYC,WAAW,QAAQ,gBAAgB;AAC9E,SAA0BC,aAAa,QAAiD,iBAAiB;AAC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AAC,GAC/C4E,KAAKzF,MAAM,CAACmC,OAAO,MAAMlE;gCAE/BC,qBAAqBA;gCACrBqF,OAAOkC,KAAKzF,MAAM,CAACwD,SAAS,CAACC,IAAI,EAAEF;gCACnCvF,SAASA;gCACT6F,YAAYjE,cAAcgD;gCAC1BkB,gBAAgB,IAAMvE,YAAYwE,WAAW,CAACnB;gCAC9CoB,eAAerB,MAAM;gCACrBsB,cAActB,MAAM+C,MAAMhG,MAAM,GAAG;gCACnCiE,aAAaA;gCACbmD,OAAOlB,YAAYmB,aAAa3D;gCAChCwB,iBAAiBgB,YAAYhB,mBAAmBxB;gCAChD4D,UAAUvB,KAAKzF,MAAM,CAACwD,SAAS,CAACC,IAAI,EAAEuD;gCACtCf,wBAAwBA;0CAEvBL,YAAYiB,QAAQf;+BArBhBL,KAAK5E,EAAE;wBAwBlB;;gBAGN;;;;AAIR"}
1
+ {"version":3,"sources":["../../src/Table/VirtualizedTable.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, TablePagination, TableRow as MuiTableRow } from '@mui/material';\nimport { Column, ColumnSizingInfoState, ColumnSizingState, flexRender, HeaderGroup, Row } from '@tanstack/react-table';\nimport { ReactElement, useMemo, useRef } from 'react';\nimport { TableComponents, TableVirtuoso, TableVirtuosoHandle, TableVirtuosoProps } from 'react-virtuoso';\n\nimport { useVirtualizedTableKeyboardNav } from './hooks/useVirtualizedTableKeyboardNav';\nimport { InnerTable } from './InnerTable';\nimport { TableCellConfigs, TableProps, TableRowEventOpts } from './model/table-model';\nimport { TableBody } from './TableBody';\nimport { TableCell, TableCellProps } from './TableCell';\nimport { TableFoot } from './TableFoot';\nimport { TableHead } from './TableHead';\nimport { TableHeaderCell } from './TableHeaderCell';\nimport { TableRow } from './TableRow';\nimport { TableToolbar, TableToolbarProps } from './TableToolbar';\nimport { VirtualizedTableContainer } from './VirtualizedTableContainer';\n\ntype TableCellPosition = {\n row: number;\n column: number;\n};\n\nexport type VirtualizedTableProps<TableData> = Required<\n Pick<TableProps<TableData>, 'height' | 'width' | 'density' | 'defaultColumnHeight' | 'defaultColumnWidth'>\n> &\n Pick<TableProps<TableData>, 'onRowMouseOver' | 'onRowMouseOut' | 'pagination' | 'onPaginationChange'> & {\n onRowClick: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, id: string) => void;\n rows: Array<Row<TableData>>;\n columns: Array<Column<TableData, unknown>>;\n headers: Array<HeaderGroup<TableData>>;\n columnSizing: ColumnSizingState;\n columnSizingInfo: ColumnSizingInfoState;\n cellConfigs?: TableCellConfigs;\n rowCount: number;\n toolbarConfig: Pick<\n TableToolbarProps<TableData>,\n | 'isSearchEnabled'\n | 'globalFilter'\n | 'onGlobalFilterChange'\n | 'isColumnFilterEnabled'\n | 'columns'\n | 'columnFilterMenuMaxHeight'\n | 'isExpandAllEnabled'\n | 'isAllExpanded'\n | 'onExpandAllChange'\n >;\n };\n\n// Separating out the virtualized table because we may want a paginated table\n// in the future that does not need virtualization, and we'd likely lay them\n// out differently.\nexport function VirtualizedTable<TableData>({\n width,\n height,\n density,\n defaultColumnWidth,\n defaultColumnHeight,\n onRowClick,\n onRowMouseOver,\n onRowMouseOut,\n rows,\n columns,\n headers,\n columnSizing,\n columnSizingInfo,\n cellConfigs,\n pagination,\n onPaginationChange,\n rowCount,\n toolbarConfig,\n}: VirtualizedTableProps<TableData>): ReactElement {\n const virtuosoRef = useRef<TableVirtuosoHandle>(null);\n // Use a ref for these values because they are only needed for keyboard\n // focus interactions and setting them on state will lead to a significant\n // amount of unnecessary re-renders.\n const visibleRange = useRef({\n startIndex: 0,\n endIndex: 0,\n });\n\n const setVisibleRange: TableVirtuosoProps<TableData, unknown>['rangeChanged'] = (newVisibleRange) => {\n visibleRange.current = newVisibleRange;\n };\n\n const keyboardNav = useVirtualizedTableKeyboardNav({\n visibleRange: visibleRange,\n virtualTable: virtuosoRef,\n\n // We add 1 here for the header.\n maxRows: rows.length + 1,\n maxColumns: columns.length,\n });\n\n const getFocusState = (cellPosition: TableCellPosition): TableCellProps['focusState'] => {\n if (cellPosition.row === keyboardNav.activeCell.row && cellPosition.column === keyboardNav.activeCell.column) {\n return keyboardNav.isActive ? 'trigger-focus' : 'focus-next';\n }\n\n return 'none';\n };\n\n const VirtuosoTableComponents: TableComponents<TableData> = useMemo(() => {\n return {\n Scroller: VirtualizedTableContainer,\n Table: (props): ReactElement => {\n return (\n <InnerTable\n {...props}\n width={width}\n density={density}\n onKeyDown={keyboardNav.onTableKeyDown}\n onBlur={keyboardNav.onTableBlur}\n />\n );\n },\n TableHead,\n TableFoot,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n TableRow: ({ item, ...props }): ReactElement | null => {\n const index = props['data-index'];\n const row = rows[index];\n if (!row) {\n return null;\n }\n\n const rowEventOpts: TableRowEventOpts = { id: row.id, index: row.index };\n\n return (\n <TableRow\n {...props}\n onClick={(e) => onRowClick(e, row.id)}\n density={density}\n onMouseOver={(e) => {\n onRowMouseOver?.(e, rowEventOpts);\n }}\n onMouseOut={(e) => {\n onRowMouseOut?.(e, rowEventOpts);\n }}\n />\n );\n },\n TableBody,\n };\n }, [\n density,\n keyboardNav.onTableKeyDown,\n keyboardNav.onTableBlur,\n onRowClick,\n onRowMouseOut,\n onRowMouseOver,\n rows,\n width,\n ]);\n\n const handleChangePage = (_event: React.MouseEvent<HTMLButtonElement> | null, newPage: number): void => {\n if (!pagination || !onPaginationChange) return;\n onPaginationChange({ ...pagination, pageIndex: newPage });\n };\n\n const handleChangeRowsPerPage = (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>): void => {\n if (!pagination || !onPaginationChange) return;\n onPaginationChange({ pageIndex: 0, pageSize: parseInt(event.target.value, 10) });\n };\n\n /**\n * Instead of calling `column.getSize()` on every render for every header\n * and especially every data cell (very expensive),\n * we will calculate all column sizes at once at the root table level in a useMemo\n * and pass the column sizes down as CSS variables to the <table> element.\n */\n const columnSizeVars = useMemo(() => {\n const colSizes: { [key: string]: number } = {};\n headers.forEach((headerGroup) => {\n headerGroup.headers\n .filter((header) => header.column.getCanResize())\n .forEach((header) => {\n colSizes[`--header-${header.id}-size`] = header.getSize();\n colSizes[`--col-${header.column.id}-size`] = header.column.getSize();\n });\n });\n return colSizes;\n // We want to recalculate column sizes whenever column sizes or column resizing info changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [columnSizingInfo, columnSizing, headers]);\n\n return (\n <Box style={{ width, height, ...columnSizeVars }}>\n <TableToolbar {...toolbarConfig} width={width} />\n <TableVirtuoso\n ref={virtuosoRef}\n totalCount={rows.length}\n components={VirtuosoTableComponents}\n // Note: this value is impacted by overscan. See this issue if overscan\n // is added.\n // https://github.com/petyosi/react-virtuoso/issues/118#issuecomment-642156138\n rangeChanged={setVisibleRange}\n fixedHeaderContent={() => {\n return (\n <>\n {headers.map((headerGroup) => {\n return (\n <TableRow key={headerGroup.id} density={density}>\n {headerGroup.headers.map((header, i, headers) => {\n const column = header.column;\n const position: TableCellPosition = {\n row: 0,\n column: i,\n };\n\n const isSorted = column.getIsSorted();\n const nextSorting = column.getNextSortingOrder();\n\n return (\n <TableHeaderCell\n key={header.id}\n onSort={column.getCanSort() ? column.getToggleSortingHandler() : undefined}\n sortDirection={typeof isSorted === 'string' ? isSorted : undefined}\n nextSortDirection={typeof nextSorting === 'string' ? nextSorting : undefined}\n width={\n header.column.getCanResize()\n ? `calc(var(--header-${header?.id}-size) * 1px)`\n : column.getSize() || defaultColumnWidth\n }\n defaultColumnHeight={defaultColumnHeight}\n align={column.columnDef.meta?.align}\n variant=\"head\"\n density={density}\n description={column.columnDef.meta?.headerDescription}\n focusState={getFocusState(position)}\n onFocusTrigger={() => keyboardNav.onCellFocus(position)}\n isFirstColumn={i === 0}\n isLastColumn={i === headers.length - 1}\n resizeConfig={\n header.column.getCanResize()\n ? {\n resizeHandler: header.getResizeHandler(),\n resetSizeHandler: header.column.resetSize,\n isResizing: header.column.getIsResizing(),\n }\n : undefined\n }\n >\n {flexRender(column.columnDef.header, header.getContext())}\n </TableHeaderCell>\n );\n })}\n </TableRow>\n );\n })}\n </>\n );\n }}\n fixedFooterContent={\n pagination\n ? (): ReactElement => (\n <MuiTableRow sx={{ backgroundColor: (theme) => theme.palette.background.default }}>\n <TablePagination\n colSpan={columns.length}\n count={rowCount}\n page={pagination.pageIndex}\n rowsPerPage={pagination.pageSize}\n onPageChange={handleChangePage}\n onRowsPerPageChange={handleChangeRowsPerPage}\n />\n </MuiTableRow>\n )\n : undefined\n }\n itemContent={(index) => {\n const row = rows[index];\n if (!row) {\n return null;\n }\n\n return (\n <>\n {row.getVisibleCells().map((cell, i, cells) => {\n const position: TableCellPosition = {\n row: index + 1,\n column: i,\n };\n\n const cellContext = cell.getContext();\n const cellConfig = cellConfigs?.[cellContext.cell.id];\n\n const cellRenderFn = cell.column.columnDef.cell;\n const cellContent = typeof cellRenderFn === 'function' ? cellRenderFn(cellContext) : null;\n\n /*\n IMPORTANT:\n If Variables exist in the link, they should have been translated by the plugin already. (Being developed at the moment)\n Components have no access to any context (Which is intentional and correct)\n We may want to add parameters to a link from neighboring cells in the future as well.\n If this is the case, the value of the neighboring cells should be read from here and be replaced. (Bing discussed at the moment, not decided yet)\n */\n\n const cellDescriptionDef = cell.column.columnDef.meta?.cellDescription;\n let description: string | undefined = undefined;\n if (typeof cellDescriptionDef === 'function') {\n // If the cell description is a function, set the value using\n // the function.\n description = cellDescriptionDef(cellContext);\n } else if (cellDescriptionDef && typeof cellContent === 'string') {\n // If the cell description is `true` AND the cell content is\n // a string (and thus viable as a `title` attribute), use the\n // cell content.\n description = cellContent;\n }\n\n /* this has been specifically added for the data link,\n therefore, non string and numeric values should be excluded\n */\n const adjacentCellsValuesMap = Object.entries(row.original as Record<string, unknown>)\n ?.filter(([_, value]) => ['string', 'number'].includes(typeof value))\n .reduce(\n (acc, [key, value]) => ({\n ...acc,\n [key]: String(value),\n }),\n {},\n );\n\n return (\n <TableCell\n key={cell.id}\n data-testid={cell.id}\n title={description || cellConfig?.text || cellContent}\n width={\n cell.column.getCanResize()\n ? `calc(var(--col-${cell.column.id}-size) * 1px)`\n : cell.column.getSize() || defaultColumnWidth\n }\n defaultColumnHeight={defaultColumnHeight}\n align={cell.column.columnDef.meta?.align}\n density={density}\n focusState={getFocusState(position)}\n onFocusTrigger={() => keyboardNav.onCellFocus(position)}\n isFirstColumn={i === 0}\n isLastColumn={i === cells.length - 1}\n description={description}\n color={cellConfig?.textColor ?? undefined}\n backgroundColor={cellConfig?.backgroundColor ?? undefined}\n dataLink={cell.column.columnDef.meta?.dataLink}\n adjacentCellsValuesMap={adjacentCellsValuesMap}\n >\n {cellConfig?.text || cellContent}\n </TableCell>\n );\n })}\n </>\n );\n }}\n />\n </Box>\n );\n}\n"],"names":["Box","TablePagination","TableRow","MuiTableRow","flexRender","useMemo","useRef","TableVirtuoso","useVirtualizedTableKeyboardNav","InnerTable","TableBody","TableCell","TableFoot","TableHead","TableHeaderCell","TableToolbar","VirtualizedTableContainer","VirtualizedTable","width","height","density","defaultColumnWidth","defaultColumnHeight","onRowClick","onRowMouseOver","onRowMouseOut","rows","columns","headers","columnSizing","columnSizingInfo","cellConfigs","pagination","onPaginationChange","rowCount","toolbarConfig","virtuosoRef","visibleRange","startIndex","endIndex","setVisibleRange","newVisibleRange","current","keyboardNav","virtualTable","maxRows","length","maxColumns","getFocusState","cellPosition","row","activeCell","column","isActive","VirtuosoTableComponents","Scroller","Table","props","onKeyDown","onTableKeyDown","onBlur","onTableBlur","item","index","rowEventOpts","id","onClick","e","onMouseOver","onMouseOut","handleChangePage","_event","newPage","pageIndex","handleChangeRowsPerPage","event","pageSize","parseInt","target","value","columnSizeVars","colSizes","forEach","headerGroup","filter","header","getCanResize","getSize","style","ref","totalCount","components","rangeChanged","fixedHeaderContent","map","i","position","isSorted","getIsSorted","nextSorting","getNextSortingOrder","onSort","getCanSort","getToggleSortingHandler","undefined","sortDirection","nextSortDirection","align","columnDef","meta","variant","description","headerDescription","focusState","onFocusTrigger","onCellFocus","isFirstColumn","isLastColumn","resizeConfig","resizeHandler","getResizeHandler","resetSizeHandler","resetSize","isResizing","getIsResizing","getContext","fixedFooterContent","sx","backgroundColor","theme","palette","background","default","colSpan","count","page","rowsPerPage","onPageChange","onRowsPerPageChange","itemContent","getVisibleCells","cell","cells","cellContext","cellConfig","cellRenderFn","cellContent","cellDescriptionDef","cellDescription","adjacentCellsValuesMap","Object","entries","original","_","includes","reduce","acc","key","String","data-testid","title","text","color","textColor","dataLink"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,GAAG,EAAEC,eAAe,EAAEC,YAAYC,WAAW,QAAQ,gBAAgB;AAC9E,SAA2DC,UAAU,QAA0B,wBAAwB;AACvH,SAAuBC,OAAO,EAAEC,MAAM,QAAQ,QAAQ;AACtD,SAA0BC,aAAa,QAAiD,iBAAiB;AAEzG,SAASC,8BAA8B,QAAQ,yCAAyC;AACxF,SAASC,UAAU,QAAQ,eAAe;AAE1C,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,SAAS,QAAwB,cAAc;AACxD,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,eAAe,QAAQ,oBAAoB;AACpD,SAASZ,QAAQ,QAAQ,aAAa;AACtC,SAASa,YAAY,QAA2B,iBAAiB;AACjE,SAASC,yBAAyB,QAAQ,8BAA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mBAAmBxB;gCAChD4D,UAAUvB,KAAKzF,MAAM,CAACwD,SAAS,CAACC,IAAI,EAAEuD;gCACtCf,wBAAwBA;0CAEvBL,YAAYiB,QAAQf;+BArBhBL,KAAK5E,EAAE;wBAwBlB;;gBAGN;;;;AAIR"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { TableContainerProps as MuiTableContainerProps } from '@mui/material';
3
2
  type VirtualizedTableContainerProps = MuiTableContainerProps;
4
3
  export declare const VirtualizedTableContainer: import("react").ForwardRefExoticComponent<Omit<VirtualizedTableContainerProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualizedTableContainer.d.ts","sourceRoot":"","sources":["../../src/Table/VirtualizedTableContainer.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAuC,mBAAmB,IAAI,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAInH,KAAK,8BAA8B,GAAG,sBAAsB,CAAC;AAE7D,eAAO,MAAM,yBAAyB,wIAIrC,CAAC"}
1
+ {"version":3,"file":"VirtualizedTableContainer.d.ts","sourceRoot":"","sources":["../../src/Table/VirtualizedTableContainer.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAuC,mBAAmB,IAAI,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAKnH,KAAK,8BAA8B,GAAG,sBAAsB,CAAC;AAE7D,eAAO,MAAM,yBAAyB,wIAIrC,CAAC"}