@perses-dev/components 0.54.0-beta.0 → 0.54.0-beta.2

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 (330) hide show
  1. package/dist/AlignSelector/AlignSelector.js +1 -1
  2. package/dist/AlignSelector/AlignSelector.js.map +1 -1
  3. package/dist/ColorPicker/ColorPicker.js +1 -1
  4. package/dist/ColorPicker/ColorPicker.js.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.js +1 -1
  8. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
  9. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +1 -1
  10. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts.map +1 -1
  11. package/dist/ContentWithLegend/model/content-with-legend-model.js +1 -1
  12. package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
  13. package/dist/Dialog/DiscardChangesConfirmationDialog.js +1 -1
  14. package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
  15. package/dist/DragAndDrop/DragAndDropList.js +1 -1
  16. package/dist/DragAndDrop/DragAndDropList.js.map +1 -1
  17. package/dist/DragAndDrop/DragButton.js +1 -1
  18. package/dist/DragAndDrop/DragButton.js.map +1 -1
  19. package/dist/DragAndDrop/DropIndicator.js +1 -1
  20. package/dist/DragAndDrop/DropIndicator.js.map +1 -1
  21. package/dist/Drawer/Drawer.js +1 -1
  22. package/dist/Drawer/Drawer.js.map +1 -1
  23. package/dist/EChart/EChart.js +1 -1
  24. package/dist/EChart/EChart.js.map +1 -1
  25. package/dist/ErrorAlert.js +1 -1
  26. package/dist/ErrorAlert.js.map +1 -1
  27. package/dist/FormEditor/FormActions.d.ts +1 -1
  28. package/dist/FormEditor/FormActions.d.ts.map +1 -1
  29. package/dist/FormEditor/FormActions.js +1 -1
  30. package/dist/FormEditor/FormActions.js.map +1 -1
  31. package/dist/FormatControls/FormatControls.d.ts +1 -1
  32. package/dist/FormatControls/FormatControls.d.ts.map +1 -1
  33. package/dist/FormatControls/FormatControls.js +2 -2
  34. package/dist/FormatControls/FormatControls.js.map +1 -1
  35. package/dist/FormatControls/UnitSelector.d.ts +1 -1
  36. package/dist/FormatControls/UnitSelector.d.ts.map +1 -1
  37. package/dist/FormatControls/UnitSelector.js +1 -1
  38. package/dist/FormatControls/UnitSelector.js.map +1 -1
  39. package/dist/JSONEditor.js +1 -1
  40. package/dist/JSONEditor.js.map +1 -1
  41. package/dist/Legend/CompactLegend.js +1 -1
  42. package/dist/Legend/CompactLegend.js.map +1 -1
  43. package/dist/Legend/Legend.js +2 -2
  44. package/dist/Legend/Legend.js.map +1 -1
  45. package/dist/Legend/LegendColorBadge.js +1 -1
  46. package/dist/Legend/LegendColorBadge.js.map +1 -1
  47. package/dist/Legend/ListLegend.js +1 -1
  48. package/dist/Legend/ListLegend.js.map +1 -1
  49. package/dist/Legend/ListLegendItem.js +1 -1
  50. package/dist/Legend/ListLegendItem.js.map +1 -1
  51. package/dist/Legend/TableLegend.d.ts.map +1 -1
  52. package/dist/Legend/TableLegend.js +18 -4
  53. package/dist/Legend/TableLegend.js.map +1 -1
  54. package/dist/Legend/legend-model.d.ts +1 -1
  55. package/dist/Legend/legend-model.d.ts.map +1 -1
  56. package/dist/Legend/legend-model.js.map +1 -1
  57. package/dist/LinksEditor/LinkEditorForm.js +1 -1
  58. package/dist/LinksEditor/LinkEditorForm.js.map +1 -1
  59. package/dist/LinksEditor/LinksEditor.js +1 -1
  60. package/dist/LinksEditor/LinksEditor.js.map +1 -1
  61. package/dist/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
  62. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  63. package/dist/OptionsEditorLayout/OptionsEditorControl.js +1 -1
  64. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  65. package/dist/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
  66. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  67. package/dist/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
  68. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  69. package/dist/Overlay/Overlay.js +1 -1
  70. package/dist/Overlay/Overlay.js.map +1 -1
  71. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js +1 -1
  72. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  73. package/dist/SettingsAutocomplete/SettingsAutocomplete.js +1 -1
  74. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
  75. package/dist/SortSelector/SortSelectorButtons.js +1 -1
  76. package/dist/SortSelector/SortSelectorButtons.js.map +1 -1
  77. package/dist/Table/InnerTable.js +1 -1
  78. package/dist/Table/InnerTable.js.map +1 -1
  79. package/dist/Table/Table.d.ts +1 -1
  80. package/dist/Table/Table.d.ts.map +1 -1
  81. package/dist/Table/Table.js +47 -14
  82. package/dist/Table/Table.js.map +1 -1
  83. package/dist/Table/TableBody.js +1 -1
  84. package/dist/Table/TableBody.js.map +1 -1
  85. package/dist/Table/TableCell.js +1 -1
  86. package/dist/Table/TableCell.js.map +1 -1
  87. package/dist/Table/TableCheckbox.js +1 -1
  88. package/dist/Table/TableCheckbox.js.map +1 -1
  89. package/dist/Table/TableFoot.js +1 -1
  90. package/dist/Table/TableFoot.js.map +1 -1
  91. package/dist/Table/TableHead.js +1 -1
  92. package/dist/Table/TableHead.js.map +1 -1
  93. package/dist/Table/TableHeaderCell.d.ts +20 -1
  94. package/dist/Table/TableHeaderCell.d.ts.map +1 -1
  95. package/dist/Table/TableHeaderCell.js +56 -24
  96. package/dist/Table/TableHeaderCell.js.map +1 -1
  97. package/dist/Table/TableRow.js +1 -1
  98. package/dist/Table/TableRow.js.map +1 -1
  99. package/dist/Table/TableToolbar.d.ts +46 -0
  100. package/dist/Table/TableToolbar.d.ts.map +1 -0
  101. package/dist/Table/TableToolbar.js +138 -0
  102. package/dist/Table/TableToolbar.js.map +1 -0
  103. package/dist/Table/VirtualizedTable.d.ts +7 -3
  104. package/dist/Table/VirtualizedTable.d.ts.map +1 -1
  105. package/dist/Table/VirtualizedTable.js +157 -123
  106. package/dist/Table/VirtualizedTable.js.map +1 -1
  107. package/dist/Table/VirtualizedTableContainer.d.ts.map +1 -1
  108. package/dist/Table/VirtualizedTableContainer.js +6 -2
  109. package/dist/Table/VirtualizedTableContainer.js.map +1 -1
  110. package/dist/Table/hooks/useFuzzySearch.d.ts +14 -0
  111. package/dist/Table/hooks/useFuzzySearch.d.ts.map +1 -0
  112. package/dist/Table/hooks/useFuzzySearch.js +62 -0
  113. package/dist/Table/hooks/useFuzzySearch.js.map +1 -0
  114. package/dist/Table/model/table-model.d.ts +78 -4
  115. package/dist/Table/model/table-model.d.ts.map +1 -1
  116. package/dist/Table/model/table-model.js +37 -19
  117. package/dist/Table/model/table-model.js.map +1 -1
  118. package/dist/ThresholdsEditor/ThresholdInput.d.ts +1 -1
  119. package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -1
  120. package/dist/ThresholdsEditor/ThresholdInput.js +1 -1
  121. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  122. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +1 -1
  123. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
  124. package/dist/ThresholdsEditor/ThresholdsEditor.js +1 -1
  125. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  126. package/dist/TimeRangeSelector/DateTimeRangePicker.js +1 -1
  127. package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
  128. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -1
  129. package/dist/TimeRangeSelector/TimeRangeSelector.js +25 -2
  130. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
  131. package/dist/TimeSeriesTooltip/SeriesInfo.js +1 -1
  132. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  133. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +1 -1
  134. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
  135. package/dist/TimeSeriesTooltip/SeriesMarker.js +1 -1
  136. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
  137. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +1 -2
  138. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
  139. package/dist/TimeSeriesTooltip/TimeChartTooltip.js +1 -1
  140. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  141. package/dist/TimeSeriesTooltip/TooltipContent.js +1 -1
  142. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  143. package/dist/TimeSeriesTooltip/TooltipHeader.js +1 -1
  144. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
  145. package/dist/TimeSeriesTooltip/nearby-series.d.ts +2 -2
  146. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
  147. package/dist/TimeSeriesTooltip/nearby-series.js +1 -2
  148. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  149. package/dist/TimeZoneSelector.js +1 -1
  150. package/dist/TimeZoneSelector.js.map +1 -1
  151. package/dist/ToolbarIconButton/ToolbarIconButton.js +1 -1
  152. package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
  153. package/dist/TransformsEditor/TransformEditor.d.ts +1 -1
  154. package/dist/TransformsEditor/TransformEditor.d.ts.map +1 -1
  155. package/dist/TransformsEditor/TransformEditor.js +1 -1
  156. package/dist/TransformsEditor/TransformEditor.js.map +1 -1
  157. package/dist/TransformsEditor/TransformEditorContainer.d.ts.map +1 -1
  158. package/dist/TransformsEditor/TransformEditorContainer.js +2 -2
  159. package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
  160. package/dist/TransformsEditor/TransformsEditor.d.ts +1 -1
  161. package/dist/TransformsEditor/TransformsEditor.d.ts.map +1 -1
  162. package/dist/TransformsEditor/TransformsEditor.js +1 -1
  163. package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
  164. package/dist/ValueMappingEditor/ValueMappingEditor.d.ts +1 -1
  165. package/dist/ValueMappingEditor/ValueMappingEditor.d.ts.map +1 -1
  166. package/dist/ValueMappingEditor/ValueMappingEditor.js +1 -1
  167. package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -1
  168. package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts +1 -1
  169. package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts.map +1 -1
  170. package/dist/ValueMappingEditor/ValueMappingsEditor.js +1 -1
  171. package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +1 -1
  172. package/dist/YAxisLabel.js +1 -1
  173. package/dist/YAxisLabel.js.map +1 -1
  174. package/dist/cjs/ContentWithLegend/ContentWithLegend.js +2 -2
  175. package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +2 -2
  176. package/dist/cjs/FormatControls/FormatControls.js +4 -4
  177. package/dist/cjs/FormatControls/UnitSelector.js +3 -3
  178. package/dist/cjs/Legend/Legend.js +2 -2
  179. package/dist/cjs/Legend/TableLegend.js +16 -2
  180. package/dist/cjs/Table/Table.js +44 -11
  181. package/dist/cjs/Table/TableHeaderCell.js +54 -22
  182. package/dist/cjs/Table/TableToolbar.js +151 -0
  183. package/dist/cjs/Table/VirtualizedTable.js +155 -121
  184. package/dist/cjs/Table/VirtualizedTableContainer.js +5 -1
  185. package/dist/cjs/Table/hooks/useFuzzySearch.js +67 -0
  186. package/dist/cjs/Table/model/table-model.js +43 -19
  187. package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +23 -0
  188. package/dist/cjs/TimeSeriesTooltip/nearby-series.js +2 -3
  189. package/dist/cjs/TransformsEditor/TransformEditorContainer.js +2 -2
  190. package/dist/cjs/model/action.js +43 -0
  191. package/dist/cjs/model/bits.js +113 -0
  192. package/dist/cjs/model/bytes.js +115 -0
  193. package/dist/cjs/model/constants.js +23 -0
  194. package/dist/cjs/model/currency.js +126 -0
  195. package/dist/cjs/model/date.js +297 -0
  196. package/dist/cjs/model/decimal.js +72 -0
  197. package/dist/cjs/model/formatterCache.js +120 -0
  198. package/dist/cjs/model/index.js +17 -0
  199. package/dist/cjs/model/legend.js +101 -0
  200. package/dist/cjs/model/percent.js +82 -0
  201. package/dist/cjs/model/temperature.js +72 -0
  202. package/dist/cjs/model/thresholds.js +16 -0
  203. package/dist/cjs/model/throughput.js +161 -0
  204. package/dist/cjs/model/time.js +178 -0
  205. package/dist/cjs/model/transforms.js +29 -0
  206. package/dist/cjs/model/types.js +16 -0
  207. package/dist/cjs/model/units.js +186 -0
  208. package/dist/cjs/model/utils.js +48 -0
  209. package/dist/cjs/model/value-mapping.js +16 -0
  210. package/dist/cjs/theme/typography.js +1 -1
  211. package/dist/cjs/utils/axis.js +5 -5
  212. package/dist/cjs/utils/format.js +20 -0
  213. package/dist/cjs/utils/index.js +1 -0
  214. package/dist/cjs/utils/request-interpolation.js +49 -0
  215. package/dist/context/ChartsProvider.js +1 -1
  216. package/dist/context/ChartsProvider.js.map +1 -1
  217. package/dist/context/ItemActionsProvider.js +1 -1
  218. package/dist/context/ItemActionsProvider.js.map +1 -1
  219. package/dist/context/SelectionProvider.js +1 -1
  220. package/dist/context/SelectionProvider.js.map +1 -1
  221. package/dist/context/SnackbarProvider.js +1 -1
  222. package/dist/context/SnackbarProvider.js.map +1 -1
  223. package/dist/context/TimeZoneProvider.js +1 -1
  224. package/dist/context/TimeZoneProvider.js.map +1 -1
  225. package/dist/controls/TextField.js +1 -1
  226. package/dist/controls/TextField.js.map +1 -1
  227. package/dist/model/action.d.ts +4 -0
  228. package/dist/model/action.d.ts.map +1 -0
  229. package/dist/model/action.js +27 -0
  230. package/dist/model/action.js.map +1 -0
  231. package/dist/model/bits.d.ts +12 -0
  232. package/dist/model/bits.d.ts.map +1 -0
  233. package/dist/model/bits.js +89 -0
  234. package/dist/model/bits.js.map +1 -0
  235. package/dist/model/bytes.d.ts +12 -0
  236. package/dist/model/bytes.d.ts.map +1 -0
  237. package/dist/model/bytes.js +91 -0
  238. package/dist/model/bytes.js.map +1 -0
  239. package/dist/model/constants.d.ts +2 -0
  240. package/dist/model/constants.d.ts.map +1 -0
  241. package/dist/model/constants.js +15 -0
  242. package/dist/model/constants.js.map +1 -0
  243. package/dist/model/currency.d.ts +11 -0
  244. package/dist/model/currency.d.ts.map +1 -0
  245. package/dist/model/currency.js +107 -0
  246. package/dist/model/currency.js.map +1 -0
  247. package/dist/model/date.d.ts +28 -0
  248. package/dist/model/date.d.ts.map +1 -0
  249. package/dist/model/date.js +278 -0
  250. package/dist/model/date.js.map +1 -0
  251. package/dist/model/decimal.d.ts +12 -0
  252. package/dist/model/decimal.d.ts.map +1 -0
  253. package/dist/model/decimal.js +53 -0
  254. package/dist/model/decimal.js.map +1 -0
  255. package/dist/model/formatterCache.d.ts +11 -0
  256. package/dist/model/formatterCache.d.ts.map +1 -0
  257. package/dist/model/formatterCache.js +104 -0
  258. package/dist/model/formatterCache.js.map +1 -0
  259. package/dist/model/index.d.ts +17 -0
  260. package/dist/model/index.d.ts.map +1 -1
  261. package/dist/model/index.js +17 -0
  262. package/dist/model/index.js.map +1 -1
  263. package/dist/model/legend.d.ts +19 -0
  264. package/dist/model/legend.d.ts.map +1 -0
  265. package/dist/model/legend.js +61 -0
  266. package/dist/model/legend.js.map +1 -0
  267. package/dist/model/percent.d.ts +11 -0
  268. package/dist/model/percent.d.ts.map +1 -0
  269. package/dist/model/percent.js +63 -0
  270. package/dist/model/percent.js.map +1 -0
  271. package/dist/model/temperature.d.ts +11 -0
  272. package/dist/model/temperature.d.ts.map +1 -0
  273. package/dist/model/temperature.js +53 -0
  274. package/dist/model/temperature.js.map +1 -0
  275. package/dist/model/theme.d.ts +1 -1
  276. package/dist/model/theme.d.ts.map +1 -1
  277. package/dist/model/theme.js.map +1 -1
  278. package/dist/model/thresholds.d.ts +16 -0
  279. package/dist/model/thresholds.d.ts.map +1 -0
  280. package/dist/model/thresholds.js +15 -0
  281. package/dist/model/thresholds.js.map +1 -0
  282. package/dist/model/throughput.d.ts +12 -0
  283. package/dist/model/throughput.d.ts.map +1 -0
  284. package/dist/model/throughput.js +142 -0
  285. package/dist/model/throughput.js.map +1 -0
  286. package/dist/model/time.d.ts +23 -0
  287. package/dist/model/time.d.ts.map +1 -0
  288. package/dist/model/time.js +158 -0
  289. package/dist/model/time.js.map +1 -0
  290. package/dist/model/transforms.d.ts +43 -0
  291. package/dist/model/transforms.d.ts.map +1 -0
  292. package/dist/model/transforms.js +22 -0
  293. package/dist/model/transforms.js.map +1 -0
  294. package/dist/model/types.d.ts +56 -0
  295. package/dist/model/types.d.ts.map +1 -0
  296. package/dist/model/types.js +15 -0
  297. package/dist/model/types.js.map +1 -0
  298. package/dist/model/units.d.ts +105 -0
  299. package/dist/model/units.d.ts.map +1 -0
  300. package/dist/model/units.js +132 -0
  301. package/dist/model/units.js.map +1 -0
  302. package/dist/model/utils.d.ts +4 -0
  303. package/dist/model/utils.d.ts.map +1 -0
  304. package/dist/model/utils.js +32 -0
  305. package/dist/model/utils.js.map +1 -0
  306. package/dist/model/value-mapping.d.ts +35 -0
  307. package/dist/model/value-mapping.d.ts.map +1 -0
  308. package/dist/model/value-mapping.js +15 -0
  309. package/dist/model/value-mapping.js.map +1 -0
  310. package/dist/test/render.js +1 -1
  311. package/dist/test/render.js.map +1 -1
  312. package/dist/theme/typography.js +1 -1
  313. package/dist/theme/typography.js.map +1 -1
  314. package/dist/utils/axis.d.ts +1 -1
  315. package/dist/utils/axis.d.ts.map +1 -1
  316. package/dist/utils/axis.js +1 -1
  317. package/dist/utils/axis.js.map +1 -1
  318. package/dist/utils/format.d.ts +1 -0
  319. package/dist/utils/format.d.ts.map +1 -1
  320. package/dist/utils/format.js +17 -0
  321. package/dist/utils/format.js.map +1 -1
  322. package/dist/utils/index.d.ts +1 -0
  323. package/dist/utils/index.d.ts.map +1 -1
  324. package/dist/utils/index.js +1 -0
  325. package/dist/utils/index.js.map +1 -1
  326. package/dist/utils/request-interpolation.d.ts +6 -0
  327. package/dist/utils/request-interpolation.d.ts.map +1 -0
  328. package/dist/utils/request-interpolation.js +33 -0
  329. package/dist/utils/request-interpolation.js.map +1 -0
  330. package/package.json +4 -2
@@ -25,6 +25,7 @@ const _reacttable = require("@tanstack/react-table");
25
25
  const _material = require("@mui/material");
26
26
  const _reactvirtuoso = require("react-virtuoso");
27
27
  const _react = require("react");
28
+ const _TableToolbar = require("./TableToolbar");
28
29
  const _TableRow = require("./TableRow");
29
30
  const _TableBody = require("./TableBody");
30
31
  const _InnerTable = require("./InnerTable");
@@ -34,7 +35,7 @@ const _TableCell = require("./TableCell");
34
35
  const _VirtualizedTableContainer = require("./VirtualizedTableContainer");
35
36
  const _useVirtualizedTableKeyboardNav = require("./hooks/useVirtualizedTableKeyboardNav");
36
37
  const _TableFoot = require("./TableFoot");
37
- function VirtualizedTable({ width, height, density, defaultColumnWidth, defaultColumnHeight, onRowClick, onRowMouseOver, onRowMouseOut, rows, columns, headers, cellConfigs, pagination, onPaginationChange, rowCount }) {
38
+ function VirtualizedTable({ width, height, density, defaultColumnWidth, defaultColumnHeight, onRowClick, onRowMouseOver, onRowMouseOut, rows, columns, headers, columnSizing, columnSizingInfo, cellConfigs, pagination, onPaginationChange, rowCount, toolbarConfig }) {
38
39
  const virtuosoRef = (0, _react.useRef)(null);
39
40
  // Use a ref for these values because they are only needed for keyboard
40
41
  // focus interactions and setting them on state will lead to a significant
@@ -122,129 +123,162 @@ function VirtualizedTable({ width, height, density, defaultColumnWidth, defaultC
122
123
  pageSize: parseInt(event.target.value, 10)
123
124
  });
124
125
  };
125
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
126
+ /**
127
+ * Instead of calling `column.getSize()` on every render for every header
128
+ * and especially every data cell (very expensive),
129
+ * we will calculate all column sizes at once at the root table level in a useMemo
130
+ * and pass the column sizes down as CSS variables to the <table> element.
131
+ */ const columnSizeVars = (0, _react.useMemo)(()=>{
132
+ const colSizes = {};
133
+ headers.forEach((headerGroup)=>{
134
+ headerGroup.headers.filter((header)=>header.column.getCanResize()).forEach((header)=>{
135
+ colSizes[`--header-${header.id}-size`] = header.getSize();
136
+ colSizes[`--col-${header.column.id}-size`] = header.column.getSize();
137
+ });
138
+ });
139
+ return colSizes;
140
+ // We want to recalculate column sizes whenever column sizes or column resizing info changes.
141
+ // eslint-disable-next-line react-hooks/exhaustive-deps
142
+ }, [
143
+ columnSizingInfo,
144
+ columnSizing,
145
+ headers
146
+ ]);
147
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
126
148
  style: {
127
149
  width,
128
- height
150
+ height,
151
+ ...columnSizeVars
129
152
  },
130
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactvirtuoso.TableVirtuoso, {
131
- ref: virtuosoRef,
132
- totalCount: rows.length,
133
- components: VirtuosoTableComponents,
134
- // Note: this value is impacted by overscan. See this issue if overscan
135
- // is added.
136
- // https://github.com/petyosi/react-virtuoso/issues/118#issuecomment-642156138
137
- rangeChanged: setVisibleRange,
138
- fixedHeaderContent: ()=>{
139
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
140
- children: headers.map((headerGroup)=>{
141
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TableRow.TableRow, {
142
- density: density,
143
- children: headerGroup.headers.map((header, i, headers)=>{
144
- const column = header.column;
145
- const position = {
146
- row: 0,
147
- column: i
148
- };
149
- const isSorted = column.getIsSorted();
150
- const nextSorting = column.getNextSortingOrder();
151
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TableHeaderCell.TableHeaderCell, {
152
- onSort: column.getCanSort() ? column.getToggleSortingHandler() : undefined,
153
- sortDirection: typeof isSorted === 'string' ? isSorted : undefined,
154
- nextSortDirection: typeof nextSorting === 'string' ? nextSorting : undefined,
155
- width: column.getSize() || defaultColumnWidth,
156
- defaultColumnHeight: defaultColumnHeight,
157
- align: column.columnDef.meta?.align,
158
- variant: "head",
159
- density: density,
160
- description: column.columnDef.meta?.headerDescription,
161
- focusState: getFocusState(position),
162
- onFocusTrigger: ()=>keyboardNav.onCellFocus(position),
163
- isFirstColumn: i === 0,
164
- isLastColumn: i === headers.length - 1,
165
- children: (0, _reacttable.flexRender)(column.columnDef.header, header.getContext())
166
- }, header.id);
167
- })
168
- }, headerGroup.id);
169
- })
170
- });
171
- },
172
- fixedFooterContent: pagination ? ()=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableRow, {
173
- sx: {
174
- backgroundColor: (theme)=>theme.palette.background.default
175
- },
176
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TablePagination, {
177
- colSpan: columns.length,
178
- count: rowCount,
179
- page: pagination.pageIndex,
180
- rowsPerPage: pagination.pageSize,
181
- onPageChange: handleChangePage,
182
- onRowsPerPageChange: handleChangeRowsPerPage
183
- })
184
- }) : undefined,
185
- itemContent: (index)=>{
186
- const row = rows[index];
187
- if (!row) {
188
- return null;
153
+ children: [
154
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_TableToolbar.TableToolbar, {
155
+ ...toolbarConfig,
156
+ width: width
157
+ }),
158
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactvirtuoso.TableVirtuoso, {
159
+ ref: virtuosoRef,
160
+ totalCount: rows.length,
161
+ components: VirtuosoTableComponents,
162
+ // Note: this value is impacted by overscan. See this issue if overscan
163
+ // is added.
164
+ // https://github.com/petyosi/react-virtuoso/issues/118#issuecomment-642156138
165
+ rangeChanged: setVisibleRange,
166
+ fixedHeaderContent: ()=>{
167
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
168
+ children: headers.map((headerGroup)=>{
169
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TableRow.TableRow, {
170
+ density: density,
171
+ children: headerGroup.headers.map((header, i, headers)=>{
172
+ const column = header.column;
173
+ const position = {
174
+ row: 0,
175
+ column: i
176
+ };
177
+ const isSorted = column.getIsSorted();
178
+ const nextSorting = column.getNextSortingOrder();
179
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TableHeaderCell.TableHeaderCell, {
180
+ onSort: column.getCanSort() ? column.getToggleSortingHandler() : undefined,
181
+ sortDirection: typeof isSorted === 'string' ? isSorted : undefined,
182
+ nextSortDirection: typeof nextSorting === 'string' ? nextSorting : undefined,
183
+ width: header.column.getCanResize() ? `calc(var(--header-${header?.id}-size) * 1px)` : column.getSize() || defaultColumnWidth,
184
+ defaultColumnHeight: defaultColumnHeight,
185
+ align: column.columnDef.meta?.align,
186
+ variant: "head",
187
+ density: density,
188
+ description: column.columnDef.meta?.headerDescription,
189
+ focusState: getFocusState(position),
190
+ onFocusTrigger: ()=>keyboardNav.onCellFocus(position),
191
+ isFirstColumn: i === 0,
192
+ isLastColumn: i === headers.length - 1,
193
+ resizeConfig: header.column.getCanResize() ? {
194
+ resizeHandler: header.getResizeHandler(),
195
+ resetSizeHandler: header.column.resetSize,
196
+ isResizing: header.column.getIsResizing()
197
+ } : undefined,
198
+ children: (0, _reacttable.flexRender)(column.columnDef.header, header.getContext())
199
+ }, header.id);
200
+ })
201
+ }, headerGroup.id);
202
+ })
203
+ });
204
+ },
205
+ fixedFooterContent: pagination ? ()=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableRow, {
206
+ sx: {
207
+ backgroundColor: (theme)=>theme.palette.background.default
208
+ },
209
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TablePagination, {
210
+ colSpan: columns.length,
211
+ count: rowCount,
212
+ page: pagination.pageIndex,
213
+ rowsPerPage: pagination.pageSize,
214
+ onPageChange: handleChangePage,
215
+ onRowsPerPageChange: handleChangeRowsPerPage
216
+ })
217
+ }) : undefined,
218
+ itemContent: (index)=>{
219
+ const row = rows[index];
220
+ if (!row) {
221
+ return null;
222
+ }
223
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
224
+ children: row.getVisibleCells().map((cell, i, cells)=>{
225
+ const position = {
226
+ row: index + 1,
227
+ column: i
228
+ };
229
+ const cellContext = cell.getContext();
230
+ const cellConfig = cellConfigs?.[cellContext.cell.id];
231
+ const cellRenderFn = cell.column.columnDef.cell;
232
+ const cellContent = typeof cellRenderFn === 'function' ? cellRenderFn(cellContext) : null;
233
+ /*
234
+ IMPORTANT:
235
+ If Variables exist in the link, they should have been translated by the plugin already. (Being developed at the moment)
236
+ Components have no access to any context (Which is intentional and correct)
237
+ We may want to add parameters to a link from neighboring cells in the future as well.
238
+ 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)
239
+ */ const cellDescriptionDef = cell.column.columnDef.meta?.cellDescription;
240
+ let description = undefined;
241
+ if (typeof cellDescriptionDef === 'function') {
242
+ // If the cell description is a function, set the value using
243
+ // the function.
244
+ description = cellDescriptionDef(cellContext);
245
+ } else if (cellDescriptionDef && typeof cellContent === 'string') {
246
+ // If the cell description is `true` AND the cell content is
247
+ // a string (and thus viable as a `title` attribute), use the
248
+ // cell content.
249
+ description = cellContent;
250
+ }
251
+ /* this has been specifically added for the data link,
252
+ therefore, non string and numeric values should be excluded
253
+ */ const adjacentCellsValuesMap = Object.entries(row.original)?.filter(([_, value])=>[
254
+ 'string',
255
+ 'number'
256
+ ].includes(typeof value)).reduce((acc, [key, value])=>({
257
+ ...acc,
258
+ [key]: String(value)
259
+ }), {});
260
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TableCell.TableCell, {
261
+ "data-testid": cell.id,
262
+ title: description || cellConfig?.text || cellContent,
263
+ width: cell.column.getCanResize() ? `calc(var(--col-${cell.column.id}-size) * 1px)` : cell.column.getSize() || defaultColumnWidth,
264
+ defaultColumnHeight: defaultColumnHeight,
265
+ align: cell.column.columnDef.meta?.align,
266
+ density: density,
267
+ focusState: getFocusState(position),
268
+ onFocusTrigger: ()=>keyboardNav.onCellFocus(position),
269
+ isFirstColumn: i === 0,
270
+ isLastColumn: i === cells.length - 1,
271
+ description: description,
272
+ color: cellConfig?.textColor ?? undefined,
273
+ backgroundColor: cellConfig?.backgroundColor ?? undefined,
274
+ dataLink: cell.column.columnDef.meta?.dataLink,
275
+ adjacentCellsValuesMap: adjacentCellsValuesMap,
276
+ children: cellConfig?.text || cellContent
277
+ }, cell.id);
278
+ })
279
+ });
189
280
  }
190
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
191
- children: row.getVisibleCells().map((cell, i, cells)=>{
192
- const position = {
193
- row: index + 1,
194
- column: i
195
- };
196
- const cellContext = cell.getContext();
197
- const cellConfig = cellConfigs?.[cellContext.cell.id];
198
- const cellRenderFn = cell.column.columnDef.cell;
199
- const cellContent = typeof cellRenderFn === 'function' ? cellRenderFn(cellContext) : null;
200
- /*
201
- IMPORTANT:
202
- If Variables exist in the link, they should have been translated by the plugin already. (Being developed at the moment)
203
- Components have no access to any context (Which is intentional and correct)
204
- We may want to add parameters to a link from neighboring cells in the future as well.
205
- 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)
206
- */ const cellDescriptionDef = cell.column.columnDef.meta?.cellDescription;
207
- let description = undefined;
208
- if (typeof cellDescriptionDef === 'function') {
209
- // If the cell description is a function, set the value using
210
- // the function.
211
- description = cellDescriptionDef(cellContext);
212
- } else if (cellDescriptionDef && typeof cellContent === 'string') {
213
- // If the cell description is `true` AND the cell content is
214
- // a string (and thus viable as a `title` attribute), use the
215
- // cell content.
216
- description = cellContent;
217
- }
218
- /* this has been specifically added for the data link,
219
- therefore, non string and numeric values should be excluded
220
- */ const adjacentCellsValuesMap = Object.entries(row.original)?.filter(([_, value])=>[
221
- 'string',
222
- 'number'
223
- ].includes(typeof value)).reduce((acc, [key, value])=>({
224
- ...acc,
225
- [key]: String(value)
226
- }), {});
227
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TableCell.TableCell, {
228
- "data-testid": cell.id,
229
- title: description || cellConfig?.text || cellContent,
230
- width: cell.column.getSize() || defaultColumnWidth,
231
- defaultColumnHeight: defaultColumnHeight,
232
- align: cell.column.columnDef.meta?.align,
233
- density: density,
234
- focusState: getFocusState(position),
235
- onFocusTrigger: ()=>keyboardNav.onCellFocus(position),
236
- isFirstColumn: i === 0,
237
- isLastColumn: i === cells.length - 1,
238
- description: description,
239
- color: cellConfig?.textColor ?? undefined,
240
- backgroundColor: cellConfig?.backgroundColor ?? undefined,
241
- dataLink: cell.column.columnDef.meta?.dataLink,
242
- adjacentCellsValuesMap: adjacentCellsValuesMap,
243
- children: cellConfig?.text || cellContent
244
- }, cell.id);
245
- })
246
- });
247
- }
248
- })
281
+ })
282
+ ]
249
283
  });
250
284
  }
@@ -23,10 +23,14 @@ Object.defineProperty(exports, "VirtualizedTableContainer", {
23
23
  const _jsxruntime = require("react/jsx-runtime");
24
24
  const _material = require("@mui/material");
25
25
  const _react = require("react");
26
+ const _combinesx = require("../utils/combine-sx");
26
27
  const VirtualizedTableContainer = /*#__PURE__*/ (0, _react.forwardRef)(function VirtualizedTableContainer(props, ref) {
27
28
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableContainer, {
28
29
  ...props,
29
30
  tabIndex: -1,
30
- ref: ref
31
+ ref: ref,
32
+ sx: (0, _combinesx.combineSx)({
33
+ flexGrow: 1
34
+ }, props.sx)
31
35
  });
32
36
  });
@@ -0,0 +1,67 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "useFuzzySearch", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return useFuzzySearch;
21
+ }
22
+ });
23
+ const _reacttable = require("@tanstack/react-table");
24
+ const _matchsorterutils = require("@tanstack/match-sorter-utils");
25
+ const _react = require("react");
26
+ const getFuzzyFilterFunction = (threshold)=>(row, columnId, value, addMeta)=>{
27
+ const itemRank = (0, _matchsorterutils.rankItem)(row.getValue(columnId), value, {
28
+ threshold: _matchsorterutils.rankings[threshold]
29
+ });
30
+ addMeta({
31
+ itemRank
32
+ });
33
+ return itemRank.passed;
34
+ };
35
+ function useFuzzySearch(isSearchEnabled, threshold, expanded, setExpanded) {
36
+ const [globalFilter, setGlobalFilter] = (0, _react.useState)('');
37
+ const [prevExpandedState, setPrevExpandedState] = (0, _react.useState)(expanded);
38
+ // expand all rows when a search query is entered, and restore previous expansion state when the query is cleared
39
+ const handleGlobalFilterChange = (0, _react.useCallback)((value)=>{
40
+ setGlobalFilter((prev)=>{
41
+ if (!prev) {
42
+ setPrevExpandedState(expanded);
43
+ setExpanded(true);
44
+ } else if (prev && !value) {
45
+ setExpanded(prevExpandedState);
46
+ }
47
+ return value;
48
+ });
49
+ }, [
50
+ expanded,
51
+ prevExpandedState,
52
+ setExpanded
53
+ ]);
54
+ return {
55
+ globalFilter,
56
+ setGlobalFilter: handleGlobalFilterChange,
57
+ fuzzySearchOptions: {
58
+ filterFns: {
59
+ fuzzy: getFuzzyFilterFunction(threshold)
60
+ },
61
+ globalFilterFn: isSearchEnabled ? 'fuzzy' : undefined,
62
+ getFilteredRowModel: isSearchEnabled ? (0, _reacttable.getFilteredRowModel)() : undefined,
63
+ filterFromLeafRows: isSearchEnabled,
64
+ onGlobalFilterChange: handleGlobalFilterChange
65
+ }
66
+ };
67
+ }
@@ -24,6 +24,12 @@ _export(exports, {
24
24
  get DEFAULT_COLUMN_HEIGHT () {
25
25
  return DEFAULT_COLUMN_HEIGHT;
26
26
  },
27
+ get DEFAULT_COLUMN_MAX_WIDTH () {
28
+ return DEFAULT_COLUMN_MAX_WIDTH;
29
+ },
30
+ get DEFAULT_COLUMN_MIN_WIDTH () {
31
+ return DEFAULT_COLUMN_MIN_WIDTH;
32
+ },
27
33
  get DEFAULT_COLUMN_WIDTH () {
28
34
  return DEFAULT_COLUMN_WIDTH;
29
35
  },
@@ -35,6 +41,8 @@ _export(exports, {
35
41
  }
36
42
  });
37
43
  const DEFAULT_COLUMN_WIDTH = 150;
44
+ const DEFAULT_COLUMN_MIN_WIDTH = 60;
45
+ const DEFAULT_COLUMN_MAX_WIDTH = 1000;
38
46
  const DEFAULT_COLUMN_HEIGHT = 40;
39
47
  function calculateTableCellHeight(lineHeight, paddingY) {
40
48
  // Doing a bunch of math to enforce height to avoid weirdness with mismatched
@@ -78,27 +86,16 @@ function getTableCellLayout(theme, density, { isHeader, isLastColumn, isFirstCol
78
86
  lineHeight: lineHeight
79
87
  };
80
88
  }
81
- function persesColumnsToTanstackColumns(columns) {
82
- const tableCols = columns.map(({ width, align, headerDescription, cellDescription, enableSorting, dataLink, ...otherProps })=>{
83
- // Tanstack Table does not support an "auto" value to naturally size to fit
84
- // the space in a table. We translate our custom "auto" setting to 0 size
85
- // for these columns, so it is easy to fall back to auto when rendering.
86
- // Taking from a recommendation in this github discussion:
87
- // https://github.com/TanStack/table/discussions/4179#discussioncomment-3631326
88
- const sizeProps = width === 'auto' || width === undefined ? {
89
- // All zero values are used as shorthand for "auto" when rendering
90
- // because it makes it easy to fall back. (e.g. `row.size || "auto"`)
91
- size: 0,
92
- minSize: 0,
93
- maxSize: 0
94
- } : {
95
- size: width
96
- };
97
- const result = {
89
+ function persesColumnsToTanstackColumns(columns, defaultColumnConfig) {
90
+ return columns.map(({ width, align, headerDescription, cellDescription, enableSorting, dataLink, enableResizing, ...otherProps })=>{
91
+ const isResizingEnabled = enableResizing ?? defaultColumnConfig?.enableResizing ?? false;
92
+ const sizeProps = width === 'auto' || width === undefined ? getDefaultSizeProps(isResizingEnabled, defaultColumnConfig?.minWidth, defaultColumnConfig?.maxWidth) : getUserProvidedSizeProps(isResizingEnabled, width, defaultColumnConfig?.minWidth, defaultColumnConfig?.maxWidth);
93
+ return {
98
94
  ...otherProps,
99
95
  ...sizeProps,
100
96
  // Default sorting to false, so it is very explicitly set per column.
101
97
  enableSorting: !!enableSorting,
98
+ enableResizing: isResizingEnabled,
102
99
  // Open-ended store for extra metadata in TanStack Table, so you can bake
103
100
  // in your own features.
104
101
  meta: {
@@ -108,7 +105,34 @@ function persesColumnsToTanstackColumns(columns) {
108
105
  dataLink
109
106
  }
110
107
  };
111
- return result;
112
108
  });
113
- return tableCols;
109
+ }
110
+ function getUserProvidedSizeProps(isResizingEnabled, width, minWidth, maxWidth) {
111
+ // When resizing is enabled, we need to set min and max size to ensure the column can be resized within a reasonable range.
112
+ return isResizingEnabled ? {
113
+ size: width,
114
+ minSize: minWidth ?? DEFAULT_COLUMN_MIN_WIDTH,
115
+ maxSize: maxWidth ?? DEFAULT_COLUMN_MAX_WIDTH
116
+ } : {
117
+ size: width
118
+ };
119
+ }
120
+ function getDefaultSizeProps(isResizingEnabled, minWidth, maxWidth) {
121
+ return isResizingEnabled ? {
122
+ // When resizing is enabled, we need to set a default size for the column
123
+ // so that relative value can be calculated when resizing and column is visible.
124
+ size: DEFAULT_COLUMN_WIDTH,
125
+ minSize: minWidth ?? DEFAULT_COLUMN_MIN_WIDTH,
126
+ maxSize: maxWidth ?? DEFAULT_COLUMN_MAX_WIDTH
127
+ } : // the space in a table. We translate our custom "auto" setting to 0 size
128
+ // for these columns, so it is easy to fall back to auto when rendering.
129
+ // Taking from a recommendation in this github discussion:
130
+ // https://github.com/TanStack/table/discussions/4179#discussioncomment-3631326
131
+ {
132
+ // All zero values are used as shorthand for "auto" when rendering
133
+ // because it makes it easy to fall back. (e.g. `row.size || "auto"`)
134
+ size: 0,
135
+ minSize: 0,
136
+ maxSize: 0
137
+ };
114
138
  }
@@ -29,6 +29,7 @@ const _react = require("react");
29
29
  const _context = require("../context");
30
30
  const _timeZoneOption = require("../model/timeZoneOption");
31
31
  const _SettingsAutocomplete = require("../SettingsAutocomplete");
32
+ const _format = require("../utils/format");
32
33
  const _DateTimeRangePicker = require("./DateTimeRangePicker");
33
34
  const _utils = require("./utils");
34
35
  function _interop_require_default(obj) {
@@ -55,6 +56,8 @@ function TimeRangeSelector({ value, timeOptions, onChange, height, showCustomTim
55
56
  const [tzAnchorEl, setTzAnchorEl] = (0, _react.useState)(null);
56
57
  const tzOpen = Boolean(tzAnchorEl);
57
58
  const tzLabel = tzOptions.find((o)=>o.value === timeZone)?.display ?? timeZone;
59
+ const tzOffset = (0, _format.getGMTOffset)(timeZone);
60
+ const localOffset = (0, _format.getGMTOffset)('local');
58
61
  const tzAutocompleteOptions = tzOptions.map((o)=>({
59
62
  id: o.value,
60
63
  label: o.display
@@ -140,6 +143,26 @@ function TimeRangeSelector({ value, timeOptions, onChange, height, showCustomTim
140
143
  value: (0, _utils.formatTimeRange)(value, timeZone),
141
144
  onClick: ()=>setOpen(!open),
142
145
  IconComponent: _Calendar.default,
146
+ renderValue: ()=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
147
+ direction: "row",
148
+ alignItems: "center",
149
+ spacing: 1,
150
+ children: [
151
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
152
+ children: timeOptions.find((opt)=>(0, _utils.formatTimeRange)(opt.value, timeZone) === (0, _utils.formatTimeRange)(value, timeZone))?.display ?? (0, _utils.formatTimeRange)(value, timeZone)
153
+ }),
154
+ tzOffset !== localOffset && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
155
+ sx: {
156
+ typography: 'caption',
157
+ color: 'text.secondary'
158
+ },
159
+ children: [
160
+ "· ",
161
+ tzOffset
162
+ ]
163
+ })
164
+ ]
165
+ }),
143
166
  inputProps: {
144
167
  'aria-label': `Select time range. Currently set to ${value}`
145
168
  },
@@ -46,7 +46,6 @@ _export(exports, {
46
46
  return legacyCheckforNearbySeries;
47
47
  }
48
48
  });
49
- const _core = require("@perses-dev/core");
50
49
  const _model = require("../model");
51
50
  const _utils = require("../utils");
52
51
  const _tooltipmodel = require("./tooltip-model");
@@ -197,7 +196,7 @@ cursorPixelY) {
197
196
  seriesIndex: seriesIdx
198
197
  });
199
198
  }
200
- const formattedY = (0, _core.formatValue)(yValue, seriesFormat);
199
+ const formattedY = (0, _model.formatValue)(yValue, seriesFormat);
201
200
  currentNearbySeriesData.push({
202
201
  seriesIdx: seriesIdx,
203
202
  datumIdx: datumIdx,
@@ -266,7 +265,7 @@ function legacyCheckforNearbySeries(data, pointInGrid, yBuffer, chart, format) {
266
265
  }
267
266
  // determine whether to convert timestamp to ms, see: https://stackoverflow.com/a/23982005/17575201
268
267
  const xValueMilliSeconds = xValue > 99999999999 ? xValue : xValue * 1000;
269
- const formattedY = (0, _core.formatValue)(yValue, format);
268
+ const formattedY = (0, _model.formatValue)(yValue, format);
270
269
  currentNearbySeriesData.push({
271
270
  seriesIdx: seriesIdx,
272
271
  datumIdx: datumIdx,
@@ -27,7 +27,7 @@ const _ChevronDown = /*#__PURE__*/ _interop_require_default(require("mdi-materia
27
27
  const _EyeOffOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/EyeOffOutline"));
28
28
  const _EyeOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/EyeOutline"));
29
29
  const _DeleteOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/DeleteOutline"));
30
- const _core = require("@perses-dev/core");
30
+ const _model = require("../model");
31
31
  const _TransformEditor = require("./TransformEditor");
32
32
  function _interop_require_default(obj) {
33
33
  return obj && obj.__esModule ? obj : {
@@ -73,7 +73,7 @@ function TransformEditorContainer({ index, value, isCollapsed, onChange, onColla
73
73
  },
74
74
  children: value.kind ? /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
75
75
  children: /*#__PURE__*/ (0, _jsxruntime.jsx)("strong", {
76
- children: _core.TRANSFORM_TEXT[value.kind]
76
+ children: _model.TRANSFORM_TEXT[value.kind]
77
77
  })
78
78
  }) : /*#__PURE__*/ (0, _jsxruntime.jsx)("strong", {
79
79
  children: "Select a transformation kind"
@@ -0,0 +1,43 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
+ });
22
+ }
23
+ _export(exports, {
24
+ get getSubmitText () {
25
+ return getSubmitText;
26
+ },
27
+ get getTitleAction () {
28
+ return getTitleAction;
29
+ }
30
+ });
31
+ function getTitleAction(action, isDraft) {
32
+ if (action === 'read') return 'View';
33
+ if (isDraft && action === 'create') return 'Add';
34
+ if (!isDraft && action === 'create') return 'Create';
35
+ if (action === 'update') return 'Edit';
36
+ return '';
37
+ }
38
+ function getSubmitText(action, isDraft) {
39
+ if (isDraft && action === 'create') return 'Add';
40
+ if (isDraft && action === 'update') return 'Apply';
41
+ if (!isDraft) return 'Save';
42
+ return '';
43
+ }