@perses-dev/timeseries-chart-plugin 0.12.1 → 0.13.0-beta.1

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 (205) hide show
  1. package/__mf/css/async/907.85c2cbf6.css +1 -0
  2. package/__mf/font/inter-cyrillic-300-normal.432f2b21.woff +0 -0
  3. package/__mf/font/inter-cyrillic-300-normal.9da91009.woff2 +0 -0
  4. package/__mf/font/inter-cyrillic-400-normal.372704ff.woff2 +0 -0
  5. package/__mf/font/inter-cyrillic-400-normal.a6b6ef6f.woff +0 -0
  6. package/__mf/font/inter-cyrillic-500-normal.7c15bba8.woff2 +0 -0
  7. package/__mf/font/inter-cyrillic-500-normal.b9f8c929.woff +0 -0
  8. package/__mf/font/inter-cyrillic-600-normal.2f42892a.woff2 +0 -0
  9. package/__mf/font/inter-cyrillic-600-normal.c3987adc.woff +0 -0
  10. package/__mf/font/inter-cyrillic-700-normal.93eba3c3.woff +0 -0
  11. package/__mf/font/inter-cyrillic-700-normal.e9e5b2dc.woff2 +0 -0
  12. package/__mf/font/inter-cyrillic-900-normal.f285bd7a.woff2 +0 -0
  13. package/__mf/font/inter-cyrillic-900-normal.ffbd8a3a.woff +0 -0
  14. package/__mf/font/inter-cyrillic-ext-300-normal.95bb9038.woff2 +0 -0
  15. package/__mf/font/inter-cyrillic-ext-300-normal.cfc143a9.woff +0 -0
  16. package/__mf/font/inter-cyrillic-ext-400-normal.2a31c04b.woff +0 -0
  17. package/__mf/font/inter-cyrillic-ext-400-normal.f572b170.woff2 +0 -0
  18. package/__mf/font/inter-cyrillic-ext-500-normal.5a6bb1da.woff +0 -0
  19. package/__mf/font/inter-cyrillic-ext-500-normal.fe0d9b14.woff2 +0 -0
  20. package/__mf/font/inter-cyrillic-ext-600-normal.ecbdecad.woff +0 -0
  21. package/__mf/font/inter-cyrillic-ext-600-normal.f7b3c15b.woff2 +0 -0
  22. package/__mf/font/inter-cyrillic-ext-700-normal.4b4022a6.woff +0 -0
  23. package/__mf/font/inter-cyrillic-ext-700-normal.74b516d2.woff2 +0 -0
  24. package/__mf/font/inter-cyrillic-ext-900-normal.9970ddb5.woff +0 -0
  25. package/__mf/font/inter-cyrillic-ext-900-normal.a0d59adc.woff2 +0 -0
  26. package/__mf/font/inter-greek-300-normal.0d7be683.woff2 +0 -0
  27. package/__mf/font/inter-greek-300-normal.8f0b988e.woff +0 -0
  28. package/__mf/font/inter-greek-400-normal.cc58c11b.woff +0 -0
  29. package/__mf/font/inter-greek-400-normal.d7020e3c.woff2 +0 -0
  30. package/__mf/font/inter-greek-500-normal.d9a33207.woff +0 -0
  31. package/__mf/font/inter-greek-500-normal.f41f43db.woff2 +0 -0
  32. package/__mf/font/inter-greek-600-normal.4ec0c1c1.woff +0 -0
  33. package/__mf/font/inter-greek-600-normal.cc532937.woff2 +0 -0
  34. package/__mf/font/inter-greek-700-normal.5ec6c758.woff +0 -0
  35. package/__mf/font/inter-greek-700-normal.97f0eeeb.woff2 +0 -0
  36. package/__mf/font/inter-greek-900-normal.46b66369.woff2 +0 -0
  37. package/__mf/font/inter-greek-900-normal.9ae3a3c5.woff +0 -0
  38. package/__mf/font/inter-greek-ext-300-normal.10247a66.woff2 +0 -0
  39. package/__mf/font/inter-greek-ext-300-normal.4668e5cb.woff +0 -0
  40. package/__mf/font/inter-greek-ext-400-normal.4ce1df5d.woff2 +0 -0
  41. package/__mf/font/inter-greek-ext-400-normal.88ede1ea.woff +0 -0
  42. package/__mf/font/inter-greek-ext-500-normal.7a4aa726.woff +0 -0
  43. package/__mf/font/inter-greek-ext-500-normal.cbd51e2d.woff2 +0 -0
  44. package/__mf/font/inter-greek-ext-600-normal.089a95ee.woff +0 -0
  45. package/__mf/font/inter-greek-ext-600-normal.1f33d317.woff2 +0 -0
  46. package/__mf/font/inter-greek-ext-700-normal.31f1075d.woff +0 -0
  47. package/__mf/font/inter-greek-ext-700-normal.827cd618.woff2 +0 -0
  48. package/__mf/font/inter-greek-ext-900-normal.531bcee7.woff +0 -0
  49. package/__mf/font/inter-greek-ext-900-normal.8a9b36b9.woff2 +0 -0
  50. package/__mf/font/inter-latin-300-normal.15fb600d.woff2 +0 -0
  51. package/__mf/font/inter-latin-300-normal.6f95f590.woff +0 -0
  52. package/__mf/font/inter-latin-400-normal.2c7a775c.woff +0 -0
  53. package/__mf/font/inter-latin-400-normal.ef6d3f52.woff2 +0 -0
  54. package/__mf/font/inter-latin-500-normal.b7b43ace.woff2 +0 -0
  55. package/__mf/font/inter-latin-500-normal.cb4c8ceb.woff +0 -0
  56. package/__mf/font/inter-latin-600-normal.8fb1a964.woff2 +0 -0
  57. package/__mf/font/inter-latin-600-normal.ce0f5f43.woff +0 -0
  58. package/__mf/font/inter-latin-700-normal.953b7aa5.woff2 +0 -0
  59. package/__mf/font/inter-latin-700-normal.9c21d4dc.woff +0 -0
  60. package/__mf/font/inter-latin-900-normal.2a8028ec.woff2 +0 -0
  61. package/__mf/font/inter-latin-900-normal.fa252135.woff +0 -0
  62. package/__mf/font/inter-latin-ext-300-normal.167cc8c9.woff2 +0 -0
  63. package/__mf/font/inter-latin-ext-300-normal.f695be66.woff +0 -0
  64. package/__mf/font/inter-latin-ext-400-normal.32a25442.woff2 +0 -0
  65. package/__mf/font/inter-latin-ext-400-normal.4edcaace.woff +0 -0
  66. package/__mf/font/inter-latin-ext-500-normal.a19a84a6.woff +0 -0
  67. package/__mf/font/inter-latin-ext-500-normal.d9b491de.woff2 +0 -0
  68. package/__mf/font/inter-latin-ext-600-normal.38b075d8.woff2 +0 -0
  69. package/__mf/font/inter-latin-ext-600-normal.49faa47a.woff +0 -0
  70. package/__mf/font/inter-latin-ext-700-normal.93534b50.woff +0 -0
  71. package/__mf/font/inter-latin-ext-700-normal.b63daa1a.woff2 +0 -0
  72. package/__mf/font/inter-latin-ext-900-normal.0efdb307.woff +0 -0
  73. package/__mf/font/inter-latin-ext-900-normal.9c0fc2c7.woff2 +0 -0
  74. package/__mf/font/inter-vietnamese-300-normal.aad496d8.woff +0 -0
  75. package/__mf/font/inter-vietnamese-300-normal.ad9ef503.woff2 +0 -0
  76. package/__mf/font/inter-vietnamese-400-normal.a9dd2faf.woff +0 -0
  77. package/__mf/font/inter-vietnamese-400-normal.de4fc44f.woff2 +0 -0
  78. package/__mf/font/inter-vietnamese-500-normal.7c0a695f.woff2 +0 -0
  79. package/__mf/font/inter-vietnamese-500-normal.a3a73b95.woff +0 -0
  80. package/__mf/font/inter-vietnamese-600-normal.9d518599.woff2 +0 -0
  81. package/__mf/font/inter-vietnamese-600-normal.c5ce3fcb.woff +0 -0
  82. package/__mf/font/inter-vietnamese-700-normal.bc68b199.woff +0 -0
  83. package/__mf/font/inter-vietnamese-700-normal.faf12809.woff2 +0 -0
  84. package/__mf/font/inter-vietnamese-900-normal.2b782045.woff +0 -0
  85. package/__mf/font/inter-vietnamese-900-normal.e639b65a.woff2 +0 -0
  86. package/__mf/js/TimeSeriesChart.f9dd142d.js +7 -0
  87. package/__mf/js/async/121.df4898d6.js +2 -0
  88. package/__mf/js/async/177.56f1be10.js +1 -0
  89. package/__mf/js/async/187.2cc43fac.js +24 -0
  90. package/__mf/js/async/192.beef3a1a.js +1 -0
  91. package/__mf/js/async/2.c3740bb9.js +1 -0
  92. package/__mf/js/async/235.c24f24f7.js +1 -0
  93. package/__mf/js/async/274.d112354f.js +2 -0
  94. package/__mf/js/async/356.9f551c8a.js +1 -0
  95. package/__mf/js/async/392.2350fb02.js +2 -0
  96. package/__mf/js/async/470.a4fd777e.js +2 -0
  97. package/__mf/js/async/491.6f81cf51.js +1 -0
  98. package/__mf/js/async/568.cdcaf97d.js +1 -0
  99. package/__mf/js/async/587.c12780da.js +1 -0
  100. package/__mf/js/async/588.6662e16a.js +1 -0
  101. package/__mf/js/async/616.52acb1b4.js +1 -0
  102. package/__mf/js/async/681.8d61b348.js +110 -0
  103. package/__mf/js/async/681.8d61b348.js.LICENSE.txt +27 -0
  104. package/__mf/js/async/702.de247ad8.js +2 -0
  105. package/__mf/js/async/71.84e486c9.js +1 -0
  106. package/__mf/js/async/724.3439df06.js +1 -0
  107. package/__mf/js/async/78.91de282a.js +1 -0
  108. package/__mf/js/async/780.12a33d06.js +39 -0
  109. package/__mf/js/async/{390.ad50daba.js.LICENSE.txt → 780.12a33d06.js.LICENSE.txt} +11 -23
  110. package/__mf/js/async/873.9aad328a.js +1 -0
  111. package/__mf/js/async/907.5ce8f69d.js +7 -0
  112. package/__mf/js/async/{472.fd3069f0.js.LICENSE.txt → 907.5ce8f69d.js.LICENSE.txt} +19 -1
  113. package/__mf/js/async/941.c0e2d25e.js +2 -0
  114. package/__mf/js/async/968.6de5fa7c.js +1 -0
  115. package/__mf/js/async/978.5c14e175.js +1 -0
  116. package/__mf/js/async/__federation_expose_TimeSeriesChart.d1167045.js +1 -0
  117. package/__mf/js/async/lib-router.1934857d.js +2 -0
  118. package/__mf/js/main.2bb9f3e3.js +7 -0
  119. package/lib/QuerySettingsEditor.d.ts.map +1 -1
  120. package/lib/QuerySettingsEditor.js +179 -167
  121. package/lib/QuerySettingsEditor.js.map +1 -1
  122. package/lib/TimeSeriesChartBase.d.ts +2 -2
  123. package/lib/TimeSeriesChartBase.d.ts.map +1 -1
  124. package/lib/TimeSeriesChartBase.js +12 -11
  125. package/lib/TimeSeriesChartBase.js.map +1 -1
  126. package/lib/TimeSeriesChartPanel.d.ts +1 -1
  127. package/lib/TimeSeriesChartPanel.d.ts.map +1 -1
  128. package/lib/TimeSeriesChartPanel.js +2 -3
  129. package/lib/TimeSeriesChartPanel.js.map +1 -1
  130. package/lib/cjs/QuerySettingsEditor.js +177 -165
  131. package/lib/cjs/TimeSeriesChartBase.js +13 -12
  132. package/lib/cjs/TimeSeriesChartPanel.js +4 -5
  133. package/lib/cjs/utils/data-transform.js +1 -2
  134. package/lib/cjs/utils/timezone-formatter.js +48 -0
  135. package/lib/test/mock-query-results.d.ts +1 -1
  136. package/lib/test/mock-query-results.js.map +1 -1
  137. package/lib/time-series-chart-model.d.ts +2 -1
  138. package/lib/time-series-chart-model.d.ts.map +1 -1
  139. package/lib/time-series-chart-model.js.map +1 -1
  140. package/lib/utils/data-transform.d.ts +2 -2
  141. package/lib/utils/data-transform.d.ts.map +1 -1
  142. package/lib/utils/data-transform.js +1 -2
  143. package/lib/utils/data-transform.js.map +1 -1
  144. package/lib/utils/timezone-formatter.d.ts +5 -0
  145. package/lib/utils/timezone-formatter.d.ts.map +1 -0
  146. package/lib/utils/timezone-formatter.js +42 -0
  147. package/lib/utils/timezone-formatter.js.map +1 -0
  148. package/mf-manifest.json +62 -52
  149. package/mf-stats.json +74 -56
  150. package/package.json +4 -4
  151. package/__mf/css/async/442.d3010b86.css +0 -1
  152. package/__mf/css/async/61.d3010b86.css +0 -1
  153. package/__mf/css/async/823.d3010b86.css +0 -1
  154. package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
  155. package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
  156. package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
  157. package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
  158. package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
  159. package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
  160. package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
  161. package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
  162. package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
  163. package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
  164. package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
  165. package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
  166. package/__mf/js/TimeSeriesChart.734ed3ec.js +0 -6
  167. package/__mf/js/async/121.a742c022.js +0 -2
  168. package/__mf/js/async/177.97e14ed0.js +0 -1
  169. package/__mf/js/async/192.30450189.js +0 -1
  170. package/__mf/js/async/2.68ee9e1b.js +0 -1
  171. package/__mf/js/async/235.a53a2591.js +0 -1
  172. package/__mf/js/async/274.8e8950b6.js +0 -2
  173. package/__mf/js/async/356.dee0f34a.js +0 -1
  174. package/__mf/js/async/390.ad50daba.js +0 -110
  175. package/__mf/js/async/392.550376f0.js +0 -2
  176. package/__mf/js/async/470.4c93905a.js +0 -2
  177. package/__mf/js/async/472.fd3069f0.js +0 -7
  178. package/__mf/js/async/489.8bb61ec9.js +0 -1
  179. package/__mf/js/async/491.35fc6280.js +0 -1
  180. package/__mf/js/async/544.4dd63985.js +0 -2
  181. package/__mf/js/async/544.4dd63985.js.LICENSE.txt +0 -15
  182. package/__mf/js/async/558.5a41ebcc.js +0 -1
  183. package/__mf/js/async/587.40becf9b.js +0 -1
  184. package/__mf/js/async/588.33924c3f.js +0 -1
  185. package/__mf/js/async/616.6d37f37b.js +0 -1
  186. package/__mf/js/async/634.8646a5de.js +0 -24
  187. package/__mf/js/async/702.5d93a78a.js +0 -2
  188. package/__mf/js/async/71.e481dbdb.js +0 -1
  189. package/__mf/js/async/78.362ece9d.js +0 -1
  190. package/__mf/js/async/867.12a42f78.js +0 -38
  191. package/__mf/js/async/873.11e0e15e.js +0 -1
  192. package/__mf/js/async/941.5331fb70.js +0 -2
  193. package/__mf/js/async/968.2ea36b8a.js +0 -1
  194. package/__mf/js/async/978.844227d5.js +0 -1
  195. package/__mf/js/async/__federation_expose_TimeSeriesChart.54276867.js +0 -1
  196. package/__mf/js/async/lib-router.9730f5e9.js +0 -2
  197. package/__mf/js/main.22e0e85a.js +0 -6
  198. /package/__mf/js/async/{121.a742c022.js.LICENSE.txt → 121.df4898d6.js.LICENSE.txt} +0 -0
  199. /package/__mf/js/async/{634.8646a5de.js.LICENSE.txt → 187.2cc43fac.js.LICENSE.txt} +0 -0
  200. /package/__mf/js/async/{274.8e8950b6.js.LICENSE.txt → 274.d112354f.js.LICENSE.txt} +0 -0
  201. /package/__mf/js/async/{392.550376f0.js.LICENSE.txt → 392.2350fb02.js.LICENSE.txt} +0 -0
  202. /package/__mf/js/async/{470.4c93905a.js.LICENSE.txt → 470.a4fd777e.js.LICENSE.txt} +0 -0
  203. /package/__mf/js/async/{702.5d93a78a.js.LICENSE.txt → 702.de247ad8.js.LICENSE.txt} +0 -0
  204. /package/__mf/js/async/{941.5331fb70.js.LICENSE.txt → 941.c0e2d25e.js.LICENSE.txt} +0 -0
  205. /package/__mf/js/async/{lib-router.9730f5e9.js.LICENSE.txt → lib-router.1934857d.js.LICENSE.txt} +0 -0
@@ -212,19 +212,20 @@ function QuerySettingsEditor(props) {
212
212
  qs.areaOpacity = undefined;
213
213
  });
214
214
  };
215
- const addUnit = (i)=>{
215
+ const addFormat = (i)=>{
216
216
  updateQuerySettings(i, (qs)=>{
217
217
  qs.format = {
218
- unit: 'decimal'
218
+ unit: 'decimal',
219
+ shortValues: true
219
220
  };
220
221
  });
221
222
  };
222
- const removeUnit = (i)=>{
223
+ const removeFormat = (i)=>{
223
224
  updateQuerySettings(i, (qs)=>{
224
225
  qs.format = undefined;
225
226
  });
226
227
  };
227
- const handleUnitChange = (i, format)=>{
228
+ const handleFormatChange = (i, format)=>{
228
229
  updateQuerySettings(i, (qs)=>{
229
230
  qs.format = format;
230
231
  });
@@ -288,9 +289,9 @@ function QuerySettingsEditor(props) {
288
289
  onRemoveLineStyle: ()=>removeLineStyle(i),
289
290
  onAddAreaOpacity: ()=>addAreaOpacity(i),
290
291
  onRemoveAreaOpacity: ()=>removeAreaOpacity(i),
291
- onAddUnit: ()=>addUnit(i),
292
- onRemoveUnit: ()=>removeUnit(i),
293
- onUnitChange: (format)=>handleUnitChange(i, format)
292
+ onAddFormat: ()=>addFormat(i),
293
+ onRemoveFormat: ()=>removeFormat(i),
294
+ onFormatChange: (format)=>handleFormatChange(i, format)
294
295
  }, i)),
295
296
  queryCount > 0 && firstAvailableQueryIndex !== NO_INDEX_AVAILABLE && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
296
297
  variant: "contained",
@@ -304,7 +305,7 @@ function QuerySettingsEditor(props) {
304
305
  ]
305
306
  });
306
307
  }
307
- function QuerySettingsInput({ querySettings: { queryIndex, colorMode, colorValue, lineStyle, areaOpacity, format }, availableQueryIndexes, onQueryIndexChange, onColorModeChange, onColorValueChange, onLineStyleChange, onAreaOpacityChange, onDelete, inputRef, onAddColor: onAddColor, onRemoveColor: onRemoveColor, onAddLineStyle, onRemoveLineStyle, onAddAreaOpacity, onRemoveAreaOpacity, onAddUnit, onRemoveUnit, onUnitChange }) {
308
+ function QuerySettingsInput({ querySettings: { queryIndex, colorMode, colorValue, lineStyle, areaOpacity, format }, availableQueryIndexes, onQueryIndexChange, onColorModeChange, onColorValueChange, onLineStyleChange, onAreaOpacityChange, onDelete, inputRef, onAddColor: onAddColor, onRemoveColor: onRemoveColor, onAddLineStyle, onRemoveLineStyle, onAddAreaOpacity, onRemoveAreaOpacity, onAddFormat, onRemoveFormat, onFormatChange }) {
308
309
  // current query index should also be selectable
309
310
  const selectableQueryIndexes = availableQueryIndexes.concat(queryIndex).sort((a, b)=>a - b);
310
311
  // State for dropdown menu
@@ -328,9 +329,9 @@ function QuerySettingsInput({ querySettings: { queryIndex, colorMode, colorValue
328
329
  action: onAddAreaOpacity
329
330
  });
330
331
  if (format === undefined) options.push({
331
- key: 'unit',
332
- label: 'Unit',
333
- action: onAddUnit
332
+ key: 'format',
333
+ label: 'Format',
334
+ action: onAddFormat
334
335
  });
335
336
  return options;
336
337
  }, [
@@ -341,7 +342,7 @@ function QuerySettingsInput({ querySettings: { queryIndex, colorMode, colorValue
341
342
  onAddColor,
342
343
  onAddLineStyle,
343
344
  onAddAreaOpacity,
344
- onAddUnit
345
+ onAddFormat
345
346
  ]);
346
347
  const handleAddMenuClick = (event)=>{
347
348
  if (availableOptions.length === 1 && availableOptions[0]) {
@@ -359,172 +360,183 @@ function QuerySettingsInput({ querySettings: { queryIndex, colorMode, colorValue
359
360
  action();
360
361
  handleMenuClose();
361
362
  };
362
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
363
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
363
364
  sx: {
364
365
  borderBottom: '1px solid',
365
366
  borderColor: 'divider',
366
367
  borderRadius: 1,
367
- p: 2
368
+ p: 2,
369
+ display: 'flex',
370
+ flexWrap: 'nowrap',
371
+ flexDirection: 'row'
368
372
  },
369
- children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
370
- direction: "row",
371
- alignItems: "center",
372
- sx: {
373
- flexWrap: 'wrap',
374
- gap: 2
375
- },
376
- children: [
377
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
378
- select: true,
379
- inputRef: inputRef,
380
- value: queryIndex,
381
- label: "Query",
382
- onChange: onQueryIndexChange,
383
- sx: {
384
- minWidth: '75px'
385
- },
386
- children: selectableQueryIndexes.map((qi)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.MenuItem, {
387
- value: qi,
388
- children: [
389
- "#",
390
- qi + 1
391
- ]
392
- }, `query-${qi}`))
393
- }),
394
- colorMode && /*#__PURE__*/ (0, _jsxruntime.jsxs)(SettingsSection, {
395
- label: "Color",
396
- onRemove: onRemoveColor,
397
- children: [
398
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TextField, {
399
- select: true,
400
- value: colorMode,
401
- onChange: onColorModeChange,
402
- size: "small",
403
- sx: {
404
- flexGrow: 1
405
- },
406
- children: [
407
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
408
- value: "fixed-single",
409
- children: "Fixed (single)"
410
- }),
411
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
412
- value: "fixed",
413
- children: "Fixed"
414
- })
415
- ]
416
- }),
417
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsColorPicker, {
418
- label: `Query n°${queryIndex + 1}`,
419
- color: colorValue || DEFAULT_COLOR_VALUE,
420
- onColorChange: onColorValueChange
421
- })
422
- ]
423
- }),
424
- lineStyle && /*#__PURE__*/ (0, _jsxruntime.jsxs)(SettingsSection, {
425
- label: "Line Style",
426
- onRemove: onRemoveLineStyle,
427
- children: [
428
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ToggleButtonGroup, {
429
- color: "primary",
430
- exclusive: true,
431
- value: lineStyle,
432
- onChange: (__, newValue)=>{
433
- if (newValue !== null) {
434
- onLineStyleChange(newValue);
435
- }
436
- },
437
- size: "small",
438
- children: Object.entries(_timeserieschartmodel.LINE_STYLE_CONFIG).map(([styleValue, config])=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ToggleButton, {
439
- value: styleValue,
440
- "aria-label": `${styleValue} line style`,
441
- children: config.label
442
- }, styleValue))
443
- }),
444
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
445
- sx: {
446
- flexGrow: 1
447
- }
448
- })
449
- ]
450
- }),
451
- areaOpacity !== undefined && /*#__PURE__*/ (0, _jsxruntime.jsxs)(SettingsSection, {
452
- label: "Opacity",
453
- onRemove: onRemoveAreaOpacity,
454
- children: [
455
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {}),
456
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Slider, {
457
- value: areaOpacity,
458
- valueLabelDisplay: "auto",
459
- step: _timeserieschartmodel.OPACITY_CONFIG.step,
460
- marks: true,
461
- min: _timeserieschartmodel.OPACITY_CONFIG.min,
462
- max: _timeserieschartmodel.OPACITY_CONFIG.max,
463
- onChange: onAreaOpacityChange,
464
- sx: {
465
- flexGrow: 1
466
- }
467
- })
468
- ]
469
- }),
470
- format !== undefined && /*#__PURE__*/ (0, _jsxruntime.jsx)(SettingsSection, {
471
- label: "Unit",
472
- onRemove: onRemoveUnit,
473
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
373
+ children: [
374
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
375
+ direction: "row",
376
+ alignItems: "center",
377
+ sx: {
378
+ flexWrap: 'wrap',
379
+ gap: 2,
380
+ flexGrow: 1
381
+ },
382
+ children: [
383
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
384
+ select: true,
385
+ inputRef: inputRef,
386
+ value: queryIndex,
387
+ label: "Query",
388
+ onChange: onQueryIndexChange,
474
389
  sx: {
475
- minWidth: '180px'
390
+ minWidth: '75px'
476
391
  },
477
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.UnitSelector, {
478
- value: format,
479
- onChange: onUnitChange
480
- })
481
- })
482
- }),
483
- availableOptions.length > 0 && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
484
- children: [
485
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
486
- onClick: handleAddMenuClick,
487
- "aria-label": "Add option",
488
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Plus.default, {})
489
- }),
490
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Menu, {
491
- anchorEl: anchorEl,
492
- open: Boolean(anchorEl),
493
- onClose: handleMenuClose,
494
- anchorOrigin: {
495
- vertical: 'bottom',
496
- horizontal: 'left'
392
+ children: selectableQueryIndexes.map((qi)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.MenuItem, {
393
+ value: qi,
394
+ children: [
395
+ "#",
396
+ qi + 1
397
+ ]
398
+ }, `query-${qi}`))
399
+ }),
400
+ colorMode && /*#__PURE__*/ (0, _jsxruntime.jsxs)(SettingsSection, {
401
+ label: "Color",
402
+ onRemove: onRemoveColor,
403
+ children: [
404
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TextField, {
405
+ select: true,
406
+ value: colorMode,
407
+ onChange: onColorModeChange,
408
+ size: "small",
409
+ sx: {
410
+ flexGrow: 1
411
+ },
412
+ children: [
413
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
414
+ value: "fixed-single",
415
+ children: "Fixed (single)"
416
+ }),
417
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
418
+ value: "fixed",
419
+ children: "Fixed"
420
+ })
421
+ ]
422
+ }),
423
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsColorPicker, {
424
+ label: `Query n°${queryIndex + 1}`,
425
+ color: colorValue || DEFAULT_COLOR_VALUE,
426
+ onColorChange: onColorValueChange
427
+ })
428
+ ]
429
+ }),
430
+ lineStyle && /*#__PURE__*/ (0, _jsxruntime.jsxs)(SettingsSection, {
431
+ label: "Line Style",
432
+ onRemove: onRemoveLineStyle,
433
+ children: [
434
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ToggleButtonGroup, {
435
+ color: "primary",
436
+ exclusive: true,
437
+ value: lineStyle,
438
+ onChange: (__, newValue)=>{
439
+ if (newValue !== null) {
440
+ onLineStyleChange(newValue);
441
+ }
442
+ },
443
+ size: "small",
444
+ children: Object.entries(_timeserieschartmodel.LINE_STYLE_CONFIG).map(([styleValue, config])=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ToggleButton, {
445
+ value: styleValue,
446
+ "aria-label": `${styleValue} line style`,
447
+ children: config.label
448
+ }, styleValue))
449
+ }),
450
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
451
+ sx: {
452
+ flexGrow: 1
453
+ }
454
+ })
455
+ ]
456
+ }),
457
+ areaOpacity !== undefined && /*#__PURE__*/ (0, _jsxruntime.jsxs)(SettingsSection, {
458
+ label: "Opacity",
459
+ onRemove: onRemoveAreaOpacity,
460
+ children: [
461
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {}),
462
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Slider, {
463
+ value: areaOpacity,
464
+ valueLabelDisplay: "auto",
465
+ step: _timeserieschartmodel.OPACITY_CONFIG.step,
466
+ marks: true,
467
+ min: _timeserieschartmodel.OPACITY_CONFIG.min,
468
+ max: _timeserieschartmodel.OPACITY_CONFIG.max,
469
+ onChange: onAreaOpacityChange,
470
+ sx: {
471
+ flexGrow: 1
472
+ }
473
+ })
474
+ ]
475
+ }),
476
+ format !== undefined && /*#__PURE__*/ (0, _jsxruntime.jsx)(SettingsSection, {
477
+ label: "Format",
478
+ onRemove: onRemoveFormat,
479
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
480
+ sx: {
481
+ minWidth: '180px',
482
+ display: 'flex',
483
+ gap: 1,
484
+ flexDirection: 'column'
497
485
  },
498
- children: availableOptions.map((option)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.MenuItem, {
499
- onClick: ()=>handleMenuItemClick(option.action),
500
- sx: {
501
- minWidth: '120px'
502
- },
503
- children: [
504
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_Plus.default, {
505
- sx: {
506
- mr: 1,
507
- fontSize: '1rem'
508
- }
509
- }),
510
- option.label
511
- ]
512
- }, option.key))
486
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.FormatControls, {
487
+ value: format,
488
+ onChange: onFormatChange
489
+ })
513
490
  })
514
- ]
515
- }),
516
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
517
- sx: {
518
- flexGrow: 1
519
- }
520
- }),
521
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
491
+ }),
492
+ availableOptions.length > 0 && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
493
+ children: [
494
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
495
+ onClick: handleAddMenuClick,
496
+ "aria-label": "Add option",
497
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Plus.default, {})
498
+ }),
499
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Menu, {
500
+ anchorEl: anchorEl,
501
+ open: Boolean(anchorEl),
502
+ onClose: handleMenuClose,
503
+ anchorOrigin: {
504
+ vertical: 'bottom',
505
+ horizontal: 'left'
506
+ },
507
+ children: availableOptions.map((option)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.MenuItem, {
508
+ onClick: ()=>handleMenuItemClick(option.action),
509
+ sx: {
510
+ minWidth: '120px'
511
+ },
512
+ children: [
513
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_Plus.default, {
514
+ sx: {
515
+ mr: 1,
516
+ fontSize: '1rem'
517
+ }
518
+ }),
519
+ option.label
520
+ ]
521
+ }, option.key))
522
+ })
523
+ ]
524
+ })
525
+ ]
526
+ }),
527
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
528
+ sx: {
529
+ display: 'flex',
530
+ alignItems: 'center',
531
+ justifyContent: 'center'
532
+ },
533
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
522
534
  "aria-label": `delete settings for query n°${queryIndex + 1}`,
523
535
  onClick: onDelete,
524
536
  children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DeleteOutline.default, {})
525
537
  })
526
- ]
527
- })
538
+ })
539
+ ]
528
540
  });
529
541
  }
530
542
  // Reusable section component
@@ -25,19 +25,18 @@ const _react = require("react");
25
25
  const _material = require("@mui/material");
26
26
  const _merge = /*#__PURE__*/ _interop_require_default(require("lodash/merge"));
27
27
  const _isEqual = /*#__PURE__*/ _interop_require_default(require("lodash/isEqual"));
28
- const _datefnstz = require("date-fns-tz");
29
- const _core = require("@perses-dev/core");
30
- const _core1 = require("echarts/core");
28
+ const _core = require("echarts/core");
31
29
  const _charts = require("echarts/charts");
32
30
  const _components = require("echarts/components");
33
31
  const _renderers = require("echarts/renderers");
34
32
  const _components1 = require("@perses-dev/components");
33
+ const _timezoneformatter = require("./utils/timezone-formatter");
35
34
  function _interop_require_default(obj) {
36
35
  return obj && obj.__esModule ? obj : {
37
36
  default: obj
38
37
  };
39
38
  }
40
- (0, _core1.use)([
39
+ (0, _core.use)([
41
40
  _charts.LineChart,
42
41
  _charts.BarChart,
43
42
  _components.GridComponent,
@@ -61,9 +60,12 @@ const TimeSeriesChartBase = /*#__PURE__*/ (0, _react.forwardRef)(function TimeCh
61
60
  const [isDragging, setIsDragging] = (0, _react.useState)(false);
62
61
  const [startX, setStartX] = (0, _react.useState)(0);
63
62
  const { timeZone } = (0, _components1.useTimeZone)();
63
+ const getTimezoneAwareAxisFormatter = (0, _react.useCallback)((rangeMs)=>(0, _timezoneformatter.createTimezoneAwareAxisFormatter)(rangeMs, timeZone), [
64
+ timeZone
65
+ ]);
64
66
  let timeScale;
65
67
  if (timeScaleProp === undefined) {
66
- const commonTimeScale = (0, _core.getCommonTimeScale)(data);
68
+ const commonTimeScale = (0, _components1.getCommonTimeScale)(data);
67
69
  if (commonTimeScale === undefined) {
68
70
  // set default to past 5 years
69
71
  const today = new Date();
@@ -142,12 +144,11 @@ const TimeSeriesChartBase = /*#__PURE__*/ (0, _react.forwardRef)(function TimeCh
142
144
  // Utilizes ECharts dataset so raw data is separate from series option style properties
143
145
  // https://apache.github.io/echarts-handbook/en/concepts/dataset/
144
146
  const dataset = [];
145
- const isLocalTimeZone = timeZone === 'local';
146
147
  data.map((d, index)=>{
147
148
  const values = d.values.map(([timestamp, value])=>{
148
149
  const val = value === null ? '-' : value; // echarts use '-' to represent null data
149
150
  return [
150
- isLocalTimeZone ? timestamp : (0, _datefnstz.toZonedTime)(timestamp, timeZone),
151
+ timestamp,
151
152
  val
152
153
  ];
153
154
  });
@@ -171,11 +172,11 @@ const TimeSeriesChartBase = /*#__PURE__*/ (0, _react.forwardRef)(function TimeCh
171
172
  series: updatedSeriesMapping,
172
173
  xAxis: {
173
174
  type: 'time',
174
- min: isLocalTimeZone ? timeScale.startMs : (0, _datefnstz.toZonedTime)(timeScale.startMs, timeZone),
175
- max: isLocalTimeZone ? timeScale.endMs : (0, _datefnstz.toZonedTime)(timeScale.endMs, timeZone),
175
+ min: timeScale.startMs,
176
+ max: timeScale.endMs,
176
177
  axisLabel: {
177
178
  hideOverlap: true,
178
- formatter: (0, _components1.getFormattedAxisLabel)(timeScale.rangeMs ?? 0)
179
+ formatter: getTimezoneAwareAxisFormatter(timeScale.rangeMs ?? 0)
179
180
  },
180
181
  axisPointer: {
181
182
  snap: false
@@ -224,10 +225,10 @@ const TimeSeriesChartBase = /*#__PURE__*/ (0, _react.forwardRef)(function TimeCh
224
225
  noDataOption,
225
226
  __experimentalEChartsOptionsOverride,
226
227
  noDataVariant,
227
- timeZone,
228
228
  isStackedBar,
229
229
  enablePinning,
230
- pinnedCrosshair
230
+ pinnedCrosshair,
231
+ getTimezoneAwareAxisFormatter
231
232
  ]);
232
233
  // Update adjacent charts so tooltip is unpinned when current chart is clicked.
233
234
  (0, _react.useEffect)(()=>{
@@ -24,7 +24,6 @@ const _jsxruntime = require("react/jsx-runtime");
24
24
  const _react = require("react");
25
25
  const _material = require("@mui/material");
26
26
  const _merge = /*#__PURE__*/ _interop_require_default(require("lodash/merge"));
27
- const _core = require("@perses-dev/core");
28
27
  const _pluginsystem = require("@perses-dev/plugin-system");
29
28
  const _components = require("@perses-dev/components");
30
29
  const _timeserieschartmodel = require("./time-series-chart-model");
@@ -57,7 +56,7 @@ function TimeSeriesChartPanel(props) {
57
56
  } : undefined;
58
57
  // populate default 'position' and other future properties
59
58
  const legend = (0, _react.useMemo)(()=>{
60
- return props.spec.legend && (0, _pluginsystem.validateLegendSpec)(props.spec.legend) ? (0, _merge.default)({}, _core.DEFAULT_LEGEND, props.spec.legend) : undefined;
59
+ return props.spec.legend && (0, _pluginsystem.validateLegendSpec)(props.spec.legend) ? (0, _merge.default)({}, _components.DEFAULT_LEGEND, props.spec.legend) : undefined;
61
60
  }, [
62
61
  props.spec.legend
63
62
  ]);
@@ -168,7 +167,7 @@ function TimeSeriesChartPanel(props) {
168
167
  // We add a unique id for the chart to disambiguate items across charts
169
168
  // when there are multiple on the page.
170
169
  const seriesId = chartId + timeSeries.name + seriesIndex;
171
- const legendCalculations = legend?.values ? (0, _core.getCalculations)(timeSeries.values, legend.values) : undefined;
170
+ const legendCalculations = legend?.values ? (0, _pluginsystem.getCalculations)(timeSeries.values, legend.values) : undefined;
172
171
  // When we initially load the chart, we want to show all series, but
173
172
  // DO NOT want to visualy highlight all the items in the legend.
174
173
  const isSelectAll = selectedLegendItems === 'ALL';
@@ -200,7 +199,7 @@ function TimeSeriesChartPanel(props) {
200
199
  }
201
200
  timeChartData.push({
202
201
  name: formattedSeriesName,
203
- values: (0, _core.getTimeSeriesValues)(timeSeries, timeScale)
202
+ values: (0, _components.getTimeSeriesValues)(timeSeries, timeScale)
204
203
  });
205
204
  }
206
205
  if (legend && legendItems) {
@@ -314,7 +313,7 @@ function TimeSeriesChartPanel(props) {
314
313
  align: 'right',
315
314
  cell: ({ getValue })=>{
316
315
  const cellValue = getValue();
317
- return typeof cellValue === 'number' && format ? (0, _core.formatValue)(cellValue, format) : cellValue;
316
+ return typeof cellValue === 'number' && format ? (0, _components.formatValue)(cellValue, format) : cellValue;
318
317
  },
319
318
  cellDescription: true,
320
319
  enableSorting: true
@@ -49,7 +49,6 @@ _export(exports, {
49
49
  return roundDown;
50
50
  }
51
51
  });
52
- const _core = require("@perses-dev/core");
53
52
  const _components = require("@perses-dev/components");
54
53
  const _timeserieschartmodel = require("../time-series-chart-model");
55
54
  const EMPTY_GRAPH_DATA = {
@@ -61,7 +60,7 @@ const HIDE_DATAPOINTS_LIMIT = 70;
61
60
  const BLUR_FADEOUT_OPACITY = 0.5;
62
61
  function getCommonTimeScaleForQueries(queries) {
63
62
  const seriesData = queries.map((query)=>query.data);
64
- return (0, _core.getCommonTimeScale)(seriesData);
63
+ return (0, _components.getCommonTimeScale)(seriesData);
65
64
  }
66
65
  function getTimeSeries(id, datasetIndex, formattedName, visual, timeScale, paletteColor, querySettings, yAxisIndex) {
67
66
  const lineWidth = visual.lineWidth ?? _timeserieschartmodel.DEFAULT_LINE_WIDTH;
@@ -0,0 +1,48 @@
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, "createTimezoneAwareAxisFormatter", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return createTimezoneAwareAxisFormatter;
21
+ }
22
+ });
23
+ const _components = require("@perses-dev/components");
24
+ const DAY_MS = 86400000;
25
+ const MONTH_MS = 2629440000;
26
+ const YEAR_MS = 31536000000;
27
+ function createTimezoneAwareAxisFormatter(rangeMs, timeZone) {
28
+ return function(value) {
29
+ const timeStamp = new Date(Number(value));
30
+ // more than 5 years
31
+ if (rangeMs > YEAR_MS * 5) {
32
+ return (0, _components.formatWithTimeZone)(timeStamp, 'yyyy', timeZone);
33
+ }
34
+ // more than 2 years
35
+ if (rangeMs > YEAR_MS * 2) {
36
+ return (0, _components.formatWithTimeZone)(timeStamp, 'MMM yyyy', timeZone);
37
+ }
38
+ // between 10 days to 6 months
39
+ if (rangeMs > DAY_MS * 10 && rangeMs < MONTH_MS * 6) {
40
+ return (0, _components.formatWithTimeZone)(timeStamp, 'dd.MM', timeZone);
41
+ }
42
+ // between 2 and 10 days
43
+ if (rangeMs > DAY_MS * 2 && rangeMs <= DAY_MS * 10) {
44
+ return (0, _components.formatWithTimeZone)(timeStamp, 'dd.MM HH:mm', timeZone);
45
+ }
46
+ return (0, _components.formatWithTimeZone)(timeStamp, 'HH:mm', timeZone);
47
+ };
48
+ }
@@ -1,4 +1,4 @@
1
- import { TimeSeriesData } from '@perses-dev/core';
1
+ import { TimeSeriesData } from '@perses-dev/spec';
2
2
  export declare const MOCK_TIME_SERIES_QUERY_RESULT_MULTIVALUE: {
3
3
  status: string;
4
4
  fetchStatus: string;