@perses-dev/components 0.50.1 → 0.51.0-beta.0

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 (117) hide show
  1. package/dist/ColorPicker/ColorPicker.js +2 -2
  2. package/dist/ColorPicker/ColorPicker.js.map +1 -1
  3. package/dist/ContentWithLegend/model/content-with-legend-model.js +2 -3
  4. package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
  5. package/dist/DragAndDrop/DragButton.d.ts +2 -2
  6. package/dist/DragAndDrop/DragButton.d.ts.map +1 -1
  7. package/dist/DragAndDrop/DragButton.js +6 -4
  8. package/dist/DragAndDrop/DragButton.js.map +1 -1
  9. package/dist/Drawer/Drawer.js +1 -1
  10. package/dist/Drawer/Drawer.js.map +1 -1
  11. package/dist/EChart/EChart.js +3 -4
  12. package/dist/EChart/EChart.js.map +1 -1
  13. package/dist/GaugeChart/GaugeChart.js +2 -5
  14. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  15. package/dist/InfoTooltip/InfoTooltip.js +5 -4
  16. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  17. package/dist/Legend/ListLegendItem.js +3 -4
  18. package/dist/Legend/ListLegendItem.js.map +1 -1
  19. package/dist/LineChart/LineChart.js +4 -8
  20. package/dist/LineChart/LineChart.js.map +1 -1
  21. package/dist/LinksEditor/LinksEditor.js +9 -18
  22. package/dist/LinksEditor/LinksEditor.js.map +1 -1
  23. package/dist/Overlay/Overlay.js +1 -1
  24. package/dist/Overlay/Overlay.js.map +1 -1
  25. package/dist/SettingsAutocomplete/SettingsAutocomplete.js +1 -2
  26. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
  27. package/dist/StatChart/StatChart.js +3 -5
  28. package/dist/StatChart/StatChart.js.map +1 -1
  29. package/dist/StatChart/calculateFontSize.js +2 -4
  30. package/dist/StatChart/calculateFontSize.js.map +1 -1
  31. package/dist/StatusHistoryChart/StatusHistoryChart.js +1 -2
  32. package/dist/StatusHistoryChart/StatusHistoryChart.js.map +1 -1
  33. package/dist/Table/Table.js +5 -5
  34. package/dist/Table/Table.js.map +1 -1
  35. package/dist/Table/TableCell.js +5 -6
  36. package/dist/Table/TableCell.js.map +1 -1
  37. package/dist/Table/VirtualizedTable.js +11 -14
  38. package/dist/Table/VirtualizedTable.js.map +1 -1
  39. package/dist/Table/hooks/useTableKeyboardNav.js +1 -1
  40. package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
  41. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +7 -13
  42. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
  43. package/dist/Table/model/table-model.js +1 -1
  44. package/dist/Table/model/table-model.js.map +1 -1
  45. package/dist/ThresholdsEditor/ThresholdsEditor.js +15 -23
  46. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  47. package/dist/TimeChart/TimeChart.js +3 -6
  48. package/dist/TimeChart/TimeChart.js.map +1 -1
  49. package/dist/TimeSeriesTooltip/LineChartTooltip.js +6 -11
  50. package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
  51. package/dist/TimeSeriesTooltip/SeriesInfo.js +1 -2
  52. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  53. package/dist/TimeSeriesTooltip/TimeChartTooltip.js +2 -3
  54. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  55. package/dist/TimeSeriesTooltip/TooltipHeader.js +4 -10
  56. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
  57. package/dist/TimeSeriesTooltip/nearby-series.js +13 -23
  58. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  59. package/dist/TimeSeriesTooltip/utils.js +2 -4
  60. package/dist/TimeSeriesTooltip/utils.js.map +1 -1
  61. package/dist/TransformsEditor/TransformEditor.js +4 -7
  62. package/dist/TransformsEditor/TransformEditor.js.map +1 -1
  63. package/dist/TransformsEditor/TransformEditorContainer.js +3 -5
  64. package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
  65. package/dist/TransformsEditor/TransformsEditor.js +3 -6
  66. package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
  67. package/dist/ValueMappingEditor/ValueMappingEditor.js +11 -24
  68. package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -1
  69. package/dist/cjs/ColorPicker/ColorPicker.js +2 -2
  70. package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +2 -3
  71. package/dist/cjs/DragAndDrop/DragButton.js +5 -3
  72. package/dist/cjs/Drawer/Drawer.js +1 -1
  73. package/dist/cjs/EChart/EChart.js +3 -4
  74. package/dist/cjs/GaugeChart/GaugeChart.js +2 -5
  75. package/dist/cjs/InfoTooltip/InfoTooltip.js +5 -4
  76. package/dist/cjs/Legend/ListLegendItem.js +3 -4
  77. package/dist/cjs/LineChart/LineChart.js +4 -8
  78. package/dist/cjs/LinksEditor/LinksEditor.js +9 -18
  79. package/dist/cjs/Overlay/Overlay.js +1 -1
  80. package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +1 -2
  81. package/dist/cjs/StatChart/StatChart.js +3 -5
  82. package/dist/cjs/StatChart/calculateFontSize.js +2 -4
  83. package/dist/cjs/StatusHistoryChart/StatusHistoryChart.js +1 -2
  84. package/dist/cjs/Table/Table.js +5 -5
  85. package/dist/cjs/Table/TableCell.js +5 -6
  86. package/dist/cjs/Table/VirtualizedTable.js +11 -14
  87. package/dist/cjs/Table/hooks/useTableKeyboardNav.js +1 -1
  88. package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +7 -13
  89. package/dist/cjs/Table/model/table-model.js +1 -1
  90. package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +15 -23
  91. package/dist/cjs/TimeChart/TimeChart.js +3 -6
  92. package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +6 -11
  93. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +1 -2
  94. package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +2 -3
  95. package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +4 -10
  96. package/dist/cjs/TimeSeriesTooltip/nearby-series.js +13 -23
  97. package/dist/cjs/TimeSeriesTooltip/utils.js +2 -4
  98. package/dist/cjs/TransformsEditor/TransformEditor.js +4 -7
  99. package/dist/cjs/TransformsEditor/TransformEditorContainer.js +3 -5
  100. package/dist/cjs/TransformsEditor/TransformsEditor.js +3 -6
  101. package/dist/cjs/ValueMappingEditor/ValueMappingEditor.js +11 -24
  102. package/dist/cjs/context/TimeZoneProvider.js +1 -1
  103. package/dist/cjs/controls/TextField.js +1 -1
  104. package/dist/cjs/utils/chart-actions.js +1 -2
  105. package/dist/cjs/utils/format.js +1 -1
  106. package/dist/cjs/utils/theme-gen.js +5 -7
  107. package/dist/context/TimeZoneProvider.js +1 -1
  108. package/dist/context/TimeZoneProvider.js.map +1 -1
  109. package/dist/controls/TextField.js +1 -1
  110. package/dist/controls/TextField.js.map +1 -1
  111. package/dist/utils/chart-actions.js +1 -2
  112. package/dist/utils/chart-actions.js.map +1 -1
  113. package/dist/utils/format.js +1 -1
  114. package/dist/utils/format.js.map +1 -1
  115. package/dist/utils/theme-gen.js +5 -7
  116. package/dist/utils/theme-gen.js.map +1 -1
  117. package/package.json +3 -3
@@ -68,18 +68,16 @@ function assembleTransform(mousePos, chartWidth, pinnedPos, tooltipHeight, toolt
68
68
  return mousePos.plotCanvas.x > xPosAdjustThreshold && x > _tooltipmodel.TOOLTIP_MAX_WIDTH ? `translate3d(${x - cursorPaddingX}px, ${y}px, 0) translateX(-100%)` : `translate3d(${x + cursorPaddingX}px, ${y}px, 0)`;
69
69
  }
70
70
  function getTooltipStyles(theme, pinnedPos, maxHeight) {
71
- var _theme_palette_designSystem;
72
71
  const adjustedMaxHeight = maxHeight ? maxHeight - _tooltipmodel.TOOLTIP_PADDING : undefined;
73
- var _theme_palette_designSystem_grey_;
74
72
  return {
75
73
  minWidth: _tooltipmodel.TOOLTIP_MIN_WIDTH,
76
74
  maxWidth: _tooltipmodel.TOOLTIP_MAX_WIDTH,
77
- maxHeight: adjustedMaxHeight !== null && adjustedMaxHeight !== void 0 ? adjustedMaxHeight : _tooltipmodel.TOOLTIP_MAX_HEIGHT,
75
+ maxHeight: adjustedMaxHeight ?? _tooltipmodel.TOOLTIP_MAX_HEIGHT,
78
76
  padding: 0,
79
77
  position: 'absolute',
80
78
  top: 0,
81
79
  left: 0,
82
- backgroundColor: (_theme_palette_designSystem_grey_ = (_theme_palette_designSystem = theme.palette.designSystem) === null || _theme_palette_designSystem === void 0 ? void 0 : _theme_palette_designSystem.grey[800]) !== null && _theme_palette_designSystem_grey_ !== void 0 ? _theme_palette_designSystem_grey_ : _tooltipmodel.TOOLTIP_BG_COLOR_FALLBACK,
80
+ backgroundColor: theme.palette.designSystem?.grey[800] ?? _tooltipmodel.TOOLTIP_BG_COLOR_FALLBACK,
83
81
  borderRadius: '6px',
84
82
  color: '#fff',
85
83
  fontSize: '11px',
@@ -24,7 +24,6 @@ const _jsxruntime = require("react/jsx-runtime");
24
24
  const _material = require("@mui/material");
25
25
  const _controls = require("../controls");
26
26
  function JoinByColumnValueTransformEditor({ value, onChange }) {
27
- var _value_spec_columns;
28
27
  return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
29
28
  direction: "row",
30
29
  children: [
@@ -36,7 +35,7 @@ function JoinByColumnValueTransformEditor({ value, onChange }) {
36
35
  width: '100%'
37
36
  },
38
37
  options: [],
39
- value: (_value_spec_columns = value.spec.columns) !== null && _value_spec_columns !== void 0 ? _value_spec_columns : [],
38
+ value: value.spec.columns ?? [],
40
39
  renderInput: (params)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
41
40
  ...params,
42
41
  variant: "outlined",
@@ -72,7 +71,6 @@ function JoinByColumnValueTransformEditor({ value, onChange }) {
72
71
  });
73
72
  }
74
73
  function MergeColumnsTransformEditor({ value, onChange }) {
75
- var _value_spec_columns, _value_spec_name;
76
74
  return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
77
75
  direction: "row",
78
76
  gap: 1,
@@ -86,7 +84,7 @@ function MergeColumnsTransformEditor({ value, onChange }) {
86
84
  width: '100%'
87
85
  },
88
86
  options: [],
89
- value: (_value_spec_columns = value.spec.columns) !== null && _value_spec_columns !== void 0 ? _value_spec_columns : [],
87
+ value: value.spec.columns ?? [],
90
88
  renderInput: (params)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
91
89
  ...params,
92
90
  variant: "outlined",
@@ -107,7 +105,7 @@ function MergeColumnsTransformEditor({ value, onChange }) {
107
105
  id: "merge-columns-name",
108
106
  variant: "outlined",
109
107
  label: "Output Name",
110
- value: (_value_spec_name = value.spec.name) !== null && _value_spec_name !== void 0 ? _value_spec_name : '',
108
+ value: value.spec.name ?? '',
111
109
  sx: {
112
110
  width: '100%'
113
111
  },
@@ -141,7 +139,6 @@ function MergeColumnsTransformEditor({ value, onChange }) {
141
139
  });
142
140
  }
143
141
  function MergeIndexedColumnsTransformEditor({ value, onChange }) {
144
- var _value_spec_column;
145
142
  return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
146
143
  direction: "row",
147
144
  children: [
@@ -150,7 +147,7 @@ function MergeIndexedColumnsTransformEditor({ value, onChange }) {
150
147
  variant: "outlined",
151
148
  label: "Column",
152
149
  placeholder: "Example: 'value' for merging 'value #1', 'value #2' and 'value #...'",
153
- value: (_value_spec_column = value.spec.column) !== null && _value_spec_column !== void 0 ? _value_spec_column : '',
150
+ value: value.spec.column ?? '',
154
151
  sx: {
155
152
  width: '100%'
156
153
  },
@@ -35,14 +35,12 @@ function _interop_require_default(obj) {
35
35
  };
36
36
  }
37
37
  function TransformEditorContainer({ index, value, isCollapsed, onChange, onCollapse, onDelete, ...props }) {
38
- var _value_spec, _value_spec1;
39
38
  function handleTransformDisable() {
40
- var _value_spec;
41
39
  onChange({
42
40
  ...value,
43
41
  spec: {
44
42
  ...value.spec,
45
- disabled: !((_value_spec = value.spec) === null || _value_spec === void 0 ? void 0 : _value_spec.disabled)
43
+ disabled: !value.spec?.disabled
46
44
  }
47
45
  });
48
46
  }
@@ -90,7 +88,7 @@ function TransformEditorContainer({ index, value, isCollapsed, onChange, onColla
90
88
  isCollapsed && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
91
89
  children: [
92
90
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Tooltip, {
93
- title: ((_value_spec = value.spec) === null || _value_spec === void 0 ? void 0 : _value_spec.disabled) ? 'Enable transformation' : 'Disable transformation',
91
+ title: value.spec?.disabled ? 'Enable transformation' : 'Disable transformation',
94
92
  placement: "top",
95
93
  children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
96
94
  size: "small",
@@ -98,7 +96,7 @@ function TransformEditorContainer({ index, value, isCollapsed, onChange, onColla
98
96
  marginLeft: 'auto'
99
97
  },
100
98
  onClick: handleTransformDisable,
101
- children: ((_value_spec1 = value.spec) === null || _value_spec1 === void 0 ? void 0 : _value_spec1.disabled) ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_EyeOffOutline.default, {}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_EyeOutline.default, {})
99
+ children: value.spec?.disabled ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_EyeOffOutline.default, {}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_EyeOutline.default, {})
102
100
  })
103
101
  }),
104
102
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Divider, {
@@ -81,17 +81,14 @@ function TransformsEditor({ value, onChange, ...props }) {
81
81
  gap: 1,
82
82
  ...props,
83
83
  children: [
84
- value.map((transform, i)=>{
85
- var _transformsCollapsed_i;
86
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TransformEditorContainer.TransformEditorContainer, {
84
+ value.map((transform, i)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_TransformEditorContainer.TransformEditorContainer, {
87
85
  index: i,
88
86
  value: transform,
89
- isCollapsed: (_transformsCollapsed_i = transformsCollapsed[i]) !== null && _transformsCollapsed_i !== void 0 ? _transformsCollapsed_i : true,
87
+ isCollapsed: transformsCollapsed[i] ?? true,
90
88
  onChange: (updatedTransform)=>handleTransformChange(i, updatedTransform),
91
89
  onDelete: ()=>handleTransformDelete(i),
92
90
  onCollapse: (collapsed)=>handleTransformCollapseExpand(i, collapsed)
93
- }, i);
94
- }),
91
+ }, i)),
95
92
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
96
93
  variant: "contained",
97
94
  startIcon: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Plus.default, {}),
@@ -33,8 +33,6 @@ function _interop_require_default(obj) {
33
33
  const ConditionEditor = ({ mapping, onChange, ...props })=>{
34
34
  switch(mapping.kind){
35
35
  case 'Value':
36
- var _mapping_spec;
37
- var _mapping_spec_value;
38
36
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
39
37
  gap: 1,
40
38
  direction: "row",
@@ -42,7 +40,7 @@ const ConditionEditor = ({ mapping, onChange, ...props })=>{
42
40
  children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
43
41
  label: "Value",
44
42
  placeholder: "Exact value",
45
- value: (_mapping_spec_value = (_mapping_spec = mapping.spec) === null || _mapping_spec === void 0 ? void 0 : _mapping_spec.value) !== null && _mapping_spec_value !== void 0 ? _mapping_spec_value : '',
43
+ value: mapping.spec?.value ?? '',
46
44
  onChange: (e)=>onChange({
47
45
  ...mapping,
48
46
  spec: {
@@ -54,8 +52,6 @@ const ConditionEditor = ({ mapping, onChange, ...props })=>{
54
52
  })
55
53
  });
56
54
  case 'Range':
57
- var _mapping_spec1, _mapping_spec2;
58
- var _mapping_spec_from, _mapping_spec_to;
59
55
  return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
60
56
  gap: 1,
61
57
  direction: "row",
@@ -64,7 +60,7 @@ const ConditionEditor = ({ mapping, onChange, ...props })=>{
64
60
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
65
61
  label: "From",
66
62
  placeholder: "Start of range",
67
- value: (_mapping_spec_from = (_mapping_spec1 = mapping.spec) === null || _mapping_spec1 === void 0 ? void 0 : _mapping_spec1.from) !== null && _mapping_spec_from !== void 0 ? _mapping_spec_from : '',
63
+ value: mapping.spec?.from ?? '',
68
64
  onChange: (e)=>onChange({
69
65
  ...mapping,
70
66
  spec: {
@@ -77,7 +73,7 @@ const ConditionEditor = ({ mapping, onChange, ...props })=>{
77
73
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
78
74
  label: "To",
79
75
  placeholder: "End of range (inclusive)",
80
- value: (_mapping_spec_to = (_mapping_spec2 = mapping.spec) === null || _mapping_spec2 === void 0 ? void 0 : _mapping_spec2.to) !== null && _mapping_spec_to !== void 0 ? _mapping_spec_to : '',
76
+ value: mapping.spec?.to ?? '',
81
77
  onChange: (e)=>onChange({
82
78
  ...mapping,
83
79
  spec: {
@@ -90,8 +86,6 @@ const ConditionEditor = ({ mapping, onChange, ...props })=>{
90
86
  ]
91
87
  });
92
88
  case 'Regex':
93
- var _mapping_spec3;
94
- var _mapping_spec_pattern;
95
89
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
96
90
  gap: 1,
97
91
  direction: "row",
@@ -99,7 +93,7 @@ const ConditionEditor = ({ mapping, onChange, ...props })=>{
99
93
  children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
100
94
  label: "Regular Expression",
101
95
  placeholder: "JavaScript regular expression",
102
- value: (_mapping_spec_pattern = (_mapping_spec3 = mapping.spec) === null || _mapping_spec3 === void 0 ? void 0 : _mapping_spec3.pattern) !== null && _mapping_spec_pattern !== void 0 ? _mapping_spec_pattern : '',
96
+ value: mapping.spec?.pattern ?? '',
103
97
  onChange: (e)=>onChange({
104
98
  ...mapping,
105
99
  spec: {
@@ -111,8 +105,6 @@ const ConditionEditor = ({ mapping, onChange, ...props })=>{
111
105
  })
112
106
  });
113
107
  case 'Misc':
114
- var _mapping_spec4;
115
- var _mapping_spec_value1;
116
108
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
117
109
  gap: 1,
118
110
  direction: "row",
@@ -120,7 +112,7 @@ const ConditionEditor = ({ mapping, onChange, ...props })=>{
120
112
  children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TextField, {
121
113
  select: true,
122
114
  label: "Value",
123
- value: (_mapping_spec_value1 = (_mapping_spec4 = mapping.spec) === null || _mapping_spec4 === void 0 ? void 0 : _mapping_spec4.value) !== null && _mapping_spec_value1 !== void 0 ? _mapping_spec_value1 : '',
115
+ value: mapping.spec?.value ?? '',
124
116
  onChange: (e)=>onChange({
125
117
  ...mapping,
126
118
  spec: {
@@ -225,7 +217,6 @@ const ConditionEditor = ({ mapping, onChange, ...props })=>{
225
217
  }
226
218
  };
227
219
  const ValueMappingEditor = ({ mapping, onChange, onDelete, ...props })=>{
228
- var _mapping_spec_result, _mapping_spec, _mapping_spec_result1, _mapping_spec1;
229
220
  const handleColorChange = (color)=>{
230
221
  onChange({
231
222
  ...mapping,
@@ -238,7 +229,6 @@ const ValueMappingEditor = ({ mapping, onChange, onDelete, ...props })=>{
238
229
  }
239
230
  });
240
231
  };
241
- var _mapping_spec_result_value, _mapping_spec_result_color;
242
232
  return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Grid2, {
243
233
  container: true,
244
234
  spacing: 2,
@@ -341,20 +331,17 @@ const ValueMappingEditor = ({ mapping, onChange, onDelete, ...props })=>{
341
331
  },
342
332
  children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
343
333
  label: "Display text",
344
- value: (_mapping_spec_result_value = (_mapping_spec = mapping.spec) === null || _mapping_spec === void 0 ? void 0 : (_mapping_spec_result = _mapping_spec.result) === null || _mapping_spec_result === void 0 ? void 0 : _mapping_spec_result.value) !== null && _mapping_spec_result_value !== void 0 ? _mapping_spec_result_value : '',
345
- onChange: (e)=>{
346
- var _mapping_spec;
347
- return onChange({
334
+ value: mapping.spec?.result?.value ?? '',
335
+ onChange: (e)=>onChange({
348
336
  ...mapping,
349
337
  spec: {
350
338
  ...mapping.spec,
351
339
  result: {
352
- ...(_mapping_spec = mapping.spec) === null || _mapping_spec === void 0 ? void 0 : _mapping_spec.result,
340
+ ...mapping.spec?.result,
353
341
  value: e.target.value
354
342
  }
355
343
  }
356
- });
357
- },
344
+ }),
358
345
  fullWidth: true
359
346
  })
360
347
  }),
@@ -366,9 +353,9 @@ const ValueMappingEditor = ({ mapping, onChange, onDelete, ...props })=>{
366
353
  direction: "row",
367
354
  justifyContent: "center",
368
355
  gap: 1,
369
- children: ((_mapping_spec1 = mapping.spec) === null || _mapping_spec1 === void 0 ? void 0 : (_mapping_spec_result1 = _mapping_spec1.result) === null || _mapping_spec_result1 === void 0 ? void 0 : _mapping_spec_result1.color) ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_OptionsColorPicker.OptionsColorPicker, {
356
+ children: mapping.spec?.result?.color ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_OptionsColorPicker.OptionsColorPicker, {
370
357
  label: "Color",
371
- color: (_mapping_spec_result_color = mapping.spec.result.color) !== null && _mapping_spec_result_color !== void 0 ? _mapping_spec_result_color : '#000',
358
+ color: mapping.spec.result.color ?? '#000',
372
359
  onColorChange: handleColorChange,
373
360
  onClear: ()=>handleColorChange(undefined)
374
361
  }) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
@@ -87,7 +87,7 @@ function useTimeZone() {
87
87
  const timeZone = (0, _react.useContext)(TimeZoneContext);
88
88
  return {
89
89
  // fallback to "local" timezone if TimeZoneProvider is not present in the React tree
90
- timeZone: timeZone !== null && timeZone !== void 0 ? timeZone : 'local',
90
+ timeZone: timeZone ?? 'local',
91
91
  formatWithUserTimeZone (date, formatString) {
92
92
  return (0, _utils.formatWithTimeZone)(date, formatString, timeZone);
93
93
  },
@@ -36,7 +36,7 @@ const TextField = /*#__PURE__*/ (0, _react.forwardRef)(function({ debounceMs = 2
36
36
  debounceFn(event.target.value);
37
37
  }
38
38
  const handleDebounceFn = (0, _react.useCallback)((inputValue)=>{
39
- onChange === null || onChange === void 0 ? void 0 : onChange(inputValue);
39
+ onChange?.(inputValue);
40
40
  }, [
41
41
  onChange
42
42
  ]);
@@ -138,8 +138,7 @@ function batchDispatchNearbySeriesActions(chart, nearbySeriesIndexes, emphasized
138
138
  }
139
139
  }
140
140
  function checkCrosshairPinnedStatus(seriesMapping) {
141
- var _seriesMapping_;
142
- const isCrosshairPinned = ((_seriesMapping_ = seriesMapping[seriesMapping.length - 1]) === null || _seriesMapping_ === void 0 ? void 0 : _seriesMapping_.name) === _model.PINNED_CROSSHAIR_SERIES_NAME;
141
+ const isCrosshairPinned = seriesMapping[seriesMapping.length - 1]?.name === _model.PINNED_CROSSHAIR_SERIES_NAME;
143
142
  return isCrosshairPinned;
144
143
  }
145
144
  function getClosestTimestamp(timeSeriesValues, cursorX) {
@@ -60,7 +60,7 @@ function formatWithTimeZone(date, formatString, timeZone) {
60
60
  * if timeZone is provided, and is not local|browser,
61
61
  * then format using timeZone option (recognize UTC regardless of uppercase/lowercase)
62
62
  * otherwise, format without timeZone option, defaulting to browser timeZone setting
63
- */ const lowerTimeZone = timeZone === null || timeZone === void 0 ? void 0 : timeZone.toLowerCase();
63
+ */ const lowerTimeZone = timeZone?.toLowerCase();
64
64
  if (!timeZone || lowerTimeZone === 'local' || lowerTimeZone === 'browser') {
65
65
  return (0, _datefns.format)(date, formatString);
66
66
  } else {
@@ -28,9 +28,7 @@ function _interop_require_default(obj) {
28
28
  }
29
29
  const DEFAULT_TEXT_COLOR = '#222';
30
30
  function generateChartsTheme(muiTheme, persesChartsThemeOverride) {
31
- var _muiTheme_palette_text, _muiTheme_palette_action, _muiTheme_palette, _muiTheme_palette_action1, _muiTheme_palette1, _muiTheme_palette_designSystem, _muiTheme_palette_designSystem1;
32
- var _muiTheme_palette_text_primary;
33
- const primaryTextColor = (_muiTheme_palette_text_primary = (_muiTheme_palette_text = muiTheme.palette.text) === null || _muiTheme_palette_text === void 0 ? void 0 : _muiTheme_palette_text.primary) !== null && _muiTheme_palette_text_primary !== void 0 ? _muiTheme_palette_text_primary : DEFAULT_TEXT_COLOR;
31
+ const primaryTextColor = muiTheme.palette.text?.primary ?? DEFAULT_TEXT_COLOR;
34
32
  const muiConvertedTheme = {
35
33
  title: {
36
34
  show: false
@@ -157,8 +155,8 @@ function generateChartsTheme(muiTheme, persesChartsThemeOverride) {
157
155
  pageTextStyle: {
158
156
  color: muiTheme.palette.grey[600]
159
157
  },
160
- pageIconColor: muiTheme === null || muiTheme === void 0 ? void 0 : (_muiTheme_palette = muiTheme.palette) === null || _muiTheme_palette === void 0 ? void 0 : (_muiTheme_palette_action = _muiTheme_palette.action) === null || _muiTheme_palette_action === void 0 ? void 0 : _muiTheme_palette_action.active,
161
- pageIconInactiveColor: muiTheme === null || muiTheme === void 0 ? void 0 : (_muiTheme_palette1 = muiTheme.palette) === null || _muiTheme_palette1 === void 0 ? void 0 : (_muiTheme_palette_action1 = _muiTheme_palette1.action) === null || _muiTheme_palette_action1 === void 0 ? void 0 : _muiTheme_palette_action1.disabled
158
+ pageIconColor: muiTheme?.palette?.action?.active,
159
+ pageIconInactiveColor: muiTheme?.palette?.action?.disabled
162
160
  },
163
161
  toolbox: {
164
162
  show: true,
@@ -169,8 +167,8 @@ function generateChartsTheme(muiTheme, persesChartsThemeOverride) {
169
167
  }
170
168
  },
171
169
  tooltip: {
172
- backgroundColor: (_muiTheme_palette_designSystem = muiTheme.palette.designSystem) === null || _muiTheme_palette_designSystem === void 0 ? void 0 : _muiTheme_palette_designSystem.grey[800],
173
- borderColor: (_muiTheme_palette_designSystem1 = muiTheme.palette.designSystem) === null || _muiTheme_palette_designSystem1 === void 0 ? void 0 : _muiTheme_palette_designSystem1.grey[800],
170
+ backgroundColor: muiTheme.palette.designSystem?.grey[800],
171
+ borderColor: muiTheme.palette.designSystem?.grey[800],
174
172
  textStyle: {
175
173
  color: '#fff',
176
174
  fontSize: 11
@@ -25,7 +25,7 @@ export function useTimeZone() {
25
25
  const timeZone = useContext(TimeZoneContext);
26
26
  return {
27
27
  // fallback to "local" timezone if TimeZoneProvider is not present in the React tree
28
- timeZone: timeZone !== null && timeZone !== void 0 ? timeZone : 'local',
28
+ timeZone: timeZone ?? 'local',
29
29
  formatWithUserTimeZone (date, formatString) {
30
30
  return formatWithTimeZone(date, formatString, timeZone);
31
31
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/context/TimeZoneProvider.tsx"],"sourcesContent":["// Copyright 2023 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 React, { createContext, ReactElement, useContext } from 'react';\nimport { formatWithTimeZone, dateFormatOptionsWithTimeZone } from '../utils';\n\nexport const TimeZoneContext = createContext<string | undefined>(undefined);\n\nexport interface TimeZoneProviderProps {\n timeZone?: string;\n children?: React.ReactNode;\n}\n\nexport function TimeZoneProvider(props: TimeZoneProviderProps): ReactElement {\n const { children, timeZone } = props;\n return <TimeZoneContext.Provider value={timeZone}>{children}</TimeZoneContext.Provider>;\n}\n\nexport function useTimeZone(): {\n timeZone: string;\n formatWithUserTimeZone: (date: Date, formatString: string) => string;\n dateFormatOptionsWithUserTimeZone: (dateFormatOptions: Intl.DateTimeFormatOptions) => Intl.DateTimeFormatOptions;\n} {\n const timeZone = useContext(TimeZoneContext);\n return {\n // fallback to \"local\" timezone if TimeZoneProvider is not present in the React tree\n timeZone: timeZone ?? 'local',\n formatWithUserTimeZone(date: Date, formatString: string): string {\n return formatWithTimeZone(date, formatString, timeZone);\n },\n dateFormatOptionsWithUserTimeZone(dateFormatOptions: Intl.DateTimeFormatOptions): Intl.DateTimeFormatOptions {\n return dateFormatOptionsWithTimeZone(dateFormatOptions, timeZone);\n },\n };\n}\n"],"names":["React","createContext","useContext","formatWithTimeZone","dateFormatOptionsWithTimeZone","TimeZoneContext","undefined","TimeZoneProvider","props","children","timeZone","Provider","value","useTimeZone","formatWithUserTimeZone","date","formatString","dateFormatOptionsWithUserTimeZone","dateFormatOptions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,SAASC,aAAa,EAAgBC,UAAU,QAAQ,QAAQ;AACvE,SAASC,kBAAkB,EAAEC,6BAA6B,QAAQ,WAAW;AAE7E,OAAO,MAAMC,gCAAkBJ,cAAkCK,WAAW;AAO5E,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EAAEC,QAAQ,EAAEC,QAAQ,EAAE,GAAGF;IAC/B,qBAAO,KAACH,gBAAgBM,QAAQ;QAACC,OAAOF;kBAAWD;;AACrD;AAEA,OAAO,SAASI;IAKd,MAAMH,WAAWR,WAAWG;IAC5B,OAAO;QACL,oFAAoF;QACpFK,UAAUA,qBAAAA,sBAAAA,WAAY;QACtBI,wBAAuBC,IAAU,EAAEC,YAAoB;YACrD,OAAOb,mBAAmBY,MAAMC,cAAcN;QAChD;QACAO,mCAAkCC,iBAA6C;YAC7E,OAAOd,8BAA8Bc,mBAAmBR;QAC1D;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/context/TimeZoneProvider.tsx"],"sourcesContent":["// Copyright 2023 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 React, { createContext, ReactElement, useContext } from 'react';\nimport { formatWithTimeZone, dateFormatOptionsWithTimeZone } from '../utils';\n\nexport const TimeZoneContext = createContext<string | undefined>(undefined);\n\nexport interface TimeZoneProviderProps {\n timeZone?: string;\n children?: React.ReactNode;\n}\n\nexport function TimeZoneProvider(props: TimeZoneProviderProps): ReactElement {\n const { children, timeZone } = props;\n return <TimeZoneContext.Provider value={timeZone}>{children}</TimeZoneContext.Provider>;\n}\n\nexport function useTimeZone(): {\n timeZone: string;\n formatWithUserTimeZone: (date: Date, formatString: string) => string;\n dateFormatOptionsWithUserTimeZone: (dateFormatOptions: Intl.DateTimeFormatOptions) => Intl.DateTimeFormatOptions;\n} {\n const timeZone = useContext(TimeZoneContext);\n return {\n // fallback to \"local\" timezone if TimeZoneProvider is not present in the React tree\n timeZone: timeZone ?? 'local',\n formatWithUserTimeZone(date: Date, formatString: string): string {\n return formatWithTimeZone(date, formatString, timeZone);\n },\n dateFormatOptionsWithUserTimeZone(dateFormatOptions: Intl.DateTimeFormatOptions): Intl.DateTimeFormatOptions {\n return dateFormatOptionsWithTimeZone(dateFormatOptions, timeZone);\n },\n };\n}\n"],"names":["React","createContext","useContext","formatWithTimeZone","dateFormatOptionsWithTimeZone","TimeZoneContext","undefined","TimeZoneProvider","props","children","timeZone","Provider","value","useTimeZone","formatWithUserTimeZone","date","formatString","dateFormatOptionsWithUserTimeZone","dateFormatOptions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,SAASC,aAAa,EAAgBC,UAAU,QAAQ,QAAQ;AACvE,SAASC,kBAAkB,EAAEC,6BAA6B,QAAQ,WAAW;AAE7E,OAAO,MAAMC,gCAAkBJ,cAAkCK,WAAW;AAO5E,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EAAEC,QAAQ,EAAEC,QAAQ,EAAE,GAAGF;IAC/B,qBAAO,KAACH,gBAAgBM,QAAQ;QAACC,OAAOF;kBAAWD;;AACrD;AAEA,OAAO,SAASI;IAKd,MAAMH,WAAWR,WAAWG;IAC5B,OAAO;QACL,oFAAoF;QACpFK,UAAUA,YAAY;QACtBI,wBAAuBC,IAAU,EAAEC,YAAoB;YACrD,OAAOb,mBAAmBY,MAAMC,cAAcN;QAChD;QACAO,mCAAkCC,iBAA6C;YAC7E,OAAOd,8BAA8Bc,mBAAmBR;QAC1D;IACF;AACF"}
@@ -21,7 +21,7 @@ export const TextField = /*#__PURE__*/ forwardRef(function({ debounceMs = 250, v
21
21
  debounceFn(event.target.value);
22
22
  }
23
23
  const handleDebounceFn = useCallback((inputValue)=>{
24
- onChange === null || onChange === void 0 ? void 0 : onChange(inputValue);
24
+ onChange?.(inputValue);
25
25
  }, [
26
26
  onChange
27
27
  ]);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/controls/TextField.tsx"],"sourcesContent":["// Copyright 2024 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 { TextFieldProps as MuiTextFieldProps, TextField as MuiTextField } from '@mui/material';\nimport { ChangeEvent, ForwardedRef, forwardRef, useCallback, useMemo, useState } from 'react';\nimport debounce from 'lodash/debounce';\n\ntype TextFieldProps = Omit<MuiTextFieldProps, 'onChange'> & { debounceMs?: number; onChange?: (value: string) => void };\n\nexport const TextField = forwardRef(function (\n { debounceMs = 250, value, onChange, ...props }: TextFieldProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n const [currentValue, setCurrentValue] = useState(value);\n\n function handleChange(event: ChangeEvent<HTMLInputElement>): void {\n setCurrentValue(event.target.value);\n debounceFn(event.target.value);\n }\n\n const handleDebounceFn = useCallback(\n (inputValue: string) => {\n onChange?.(inputValue);\n },\n [onChange]\n );\n\n const debounceFn = useMemo(() => debounce(handleDebounceFn, debounceMs), [debounceMs, handleDebounceFn]);\n\n return <MuiTextField ref={ref} value={currentValue} onChange={handleChange} {...props} />;\n});\nTextField.displayName = 'TextField';\n"],"names":["TextField","MuiTextField","forwardRef","useCallback","useMemo","useState","debounce","debounceMs","value","onChange","props","ref","currentValue","setCurrentValue","handleChange","event","target","debounceFn","handleDebounceFn","inputValue","displayName"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAA8CA,aAAaC,YAAY,QAAQ,gBAAgB;AAC/F,SAAoCC,UAAU,EAAEC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAC9F,OAAOC,cAAc,kBAAkB;AAIvC,OAAO,MAAMN,0BAAYE,WAAW,SAClC,EAAEK,aAAa,GAAG,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGC,OAAuB,EAC/DC,GAAiC;IAEjC,MAAM,CAACC,cAAcC,gBAAgB,GAAGR,SAASG;IAEjD,SAASM,aAAaC,KAAoC;QACxDF,gBAAgBE,MAAMC,MAAM,CAACR,KAAK;QAClCS,WAAWF,MAAMC,MAAM,CAACR,KAAK;IAC/B;IAEA,MAAMU,mBAAmBf,YACvB,CAACgB;QACCV,qBAAAA,+BAAAA,SAAWU;IACb,GACA;QAACV;KAAS;IAGZ,MAAMQ,aAAab,QAAQ,IAAME,SAASY,kBAAkBX,aAAa;QAACA;QAAYW;KAAiB;IAEvG,qBAAO,KAACjB;QAAaU,KAAKA;QAAKH,OAAOI;QAAcH,UAAUK;QAAe,GAAGJ,KAAK;;AACvF,GAAG;AACHV,UAAUoB,WAAW,GAAG"}
1
+ {"version":3,"sources":["../../src/controls/TextField.tsx"],"sourcesContent":["// Copyright 2024 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 { TextFieldProps as MuiTextFieldProps, TextField as MuiTextField } from '@mui/material';\nimport { ChangeEvent, ForwardedRef, forwardRef, useCallback, useMemo, useState } from 'react';\nimport debounce from 'lodash/debounce';\n\ntype TextFieldProps = Omit<MuiTextFieldProps, 'onChange'> & { debounceMs?: number; onChange?: (value: string) => void };\n\nexport const TextField = forwardRef(function (\n { debounceMs = 250, value, onChange, ...props }: TextFieldProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n const [currentValue, setCurrentValue] = useState(value);\n\n function handleChange(event: ChangeEvent<HTMLInputElement>): void {\n setCurrentValue(event.target.value);\n debounceFn(event.target.value);\n }\n\n const handleDebounceFn = useCallback(\n (inputValue: string) => {\n onChange?.(inputValue);\n },\n [onChange]\n );\n\n const debounceFn = useMemo(() => debounce(handleDebounceFn, debounceMs), [debounceMs, handleDebounceFn]);\n\n return <MuiTextField ref={ref} value={currentValue} onChange={handleChange} {...props} />;\n});\nTextField.displayName = 'TextField';\n"],"names":["TextField","MuiTextField","forwardRef","useCallback","useMemo","useState","debounce","debounceMs","value","onChange","props","ref","currentValue","setCurrentValue","handleChange","event","target","debounceFn","handleDebounceFn","inputValue","displayName"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAA8CA,aAAaC,YAAY,QAAQ,gBAAgB;AAC/F,SAAoCC,UAAU,EAAEC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAC9F,OAAOC,cAAc,kBAAkB;AAIvC,OAAO,MAAMN,0BAAYE,WAAW,SAClC,EAAEK,aAAa,GAAG,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGC,OAAuB,EAC/DC,GAAiC;IAEjC,MAAM,CAACC,cAAcC,gBAAgB,GAAGR,SAASG;IAEjD,SAASM,aAAaC,KAAoC;QACxDF,gBAAgBE,MAAMC,MAAM,CAACR,KAAK;QAClCS,WAAWF,MAAMC,MAAM,CAACR,KAAK;IAC/B;IAEA,MAAMU,mBAAmBf,YACvB,CAACgB;QACCV,WAAWU;IACb,GACA;QAACV;KAAS;IAGZ,MAAMQ,aAAab,QAAQ,IAAME,SAASY,kBAAkBX,aAAa;QAACA;QAAYW;KAAiB;IAEvG,qBAAO,KAACjB;QAAaU,KAAKA;QAAKH,OAAOI;QAAcH,UAAUK;QAAe,GAAGJ,KAAK;;AACvF,GAAG;AACHV,UAAUoB,WAAW,GAAG"}
@@ -120,8 +120,7 @@ import { PINNED_CROSSHAIR_SERIES_NAME } from '../model';
120
120
  /*
121
121
  * Determine whether a markLine was pushed into the final series, which means crosshair was already pinned onClick
122
122
  */ export function checkCrosshairPinnedStatus(seriesMapping) {
123
- var _seriesMapping_;
124
- const isCrosshairPinned = ((_seriesMapping_ = seriesMapping[seriesMapping.length - 1]) === null || _seriesMapping_ === void 0 ? void 0 : _seriesMapping_.name) === PINNED_CROSSHAIR_SERIES_NAME;
123
+ const isCrosshairPinned = seriesMapping[seriesMapping.length - 1]?.name === PINNED_CROSSHAIR_SERIES_NAME;
125
124
  return isCrosshairPinned;
126
125
  }
127
126
  /*
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/chart-actions.ts"],"sourcesContent":["// Copyright 2023 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 { ECharts as EChartsInstance } from 'echarts/core';\nimport { TimeSeries, TimeSeriesValueTuple } from '@perses-dev/core';\nimport { DatapointInfo, PINNED_CROSSHAIR_SERIES_NAME, TimeChartSeriesMapping } from '../model';\n\nexport interface ZoomEventData {\n start: number;\n end: number;\n // TODO: remove startIndex and endIndex once LineChart is deprecated\n startIndex?: number;\n endIndex?: number;\n}\n\n/**\n * Enable dataZoom without requring user to click toolbox icon.\n * https://stackoverflow.com/questions/57183297/is-there-a-way-to-use-zoom-of-type-select-without-showing-the-toolbar\n */\nexport function enableDataZoom(chart: EChartsInstance): void {\n const chartModel = chart['_model'];\n if (chartModel === undefined) return;\n if (chartModel.option.toolbox !== undefined && chartModel.option.toolbox.length > 0) {\n // check if hidden data zoom icon is unselected (if selected it would be 'emphasis' instead of 'normal')\n if (chartModel.option.toolbox[0].feature.dataZoom.iconStatus.zoom === 'normal') {\n chart.dispatchAction({\n type: 'takeGlobalCursor',\n key: 'dataZoomSelect',\n dataZoomSelectActive: true,\n });\n }\n }\n}\n\n/**\n * Restore chart to original state before zoom or other actions were dispatched\n */\nexport function restoreChart(chart: EChartsInstance): void {\n // TODO: support incremental unzoom instead of restore to original state\n chart.dispatchAction({\n type: 'restore', // https://echarts.apache.org/en/api.html#events.restore\n });\n}\n\n/*\n * Clear all highlighted series when cursor exits canvas\n * https://echarts.apache.org/en/api.html#action.downplay\n */\nexport function clearHighlightedSeries(chart: EChartsInstance): void {\n if (chart.dispatchAction !== undefined) {\n // Clear any selected data points\n chart.dispatchAction({\n type: 'unselect',\n });\n\n // Clear any highlighted series\n chart.dispatchAction({\n type: 'downplay',\n });\n }\n}\n\n/*\n * Convert a point from pixel coordinate to logical coordinate.\n * Used to determine if cursor is over chart canvas and closest datapoint.\n * https://echarts.apache.org/en/api.html#echartsInstance.convertFromPixel\n */\nexport function getPointInGrid(cursorCoordX: number, cursorCoordY: number, chart?: EChartsInstance): number[] | null {\n if (chart === undefined) {\n return null;\n }\n\n const pointInPixel = [cursorCoordX, cursorCoordY];\n if (!chart.containPixel('grid', pointInPixel)) {\n return null;\n }\n\n const pointInGrid: number[] = chart.convertFromPixel('grid', pointInPixel);\n return pointInGrid;\n}\n\n/*\n * TimeSeriesChart tooltip is built custom to support finding nearby series instead of single or all series.\n * This means ECharts actions need to be dispatched manually for series highlighting, datapoint select state, etc.\n * More info: https://echarts.apache.org/en/api.html#action\n */\nexport function batchDispatchNearbySeriesActions(\n chart: EChartsInstance,\n nearbySeriesIndexes: number[],\n emphasizedSeriesIndexes: number[],\n nonEmphasizedSeriesIndexes: number[],\n emphasizedDatapoints: DatapointInfo[],\n duplicateDatapoints: DatapointInfo[]\n): void {\n // Accounts for multiple series that are rendered direct on top of eachother.\n // Only applies select state to the datapoint that is visible to avoid color mismatch.\n const lastEmphasizedDatapoint =\n duplicateDatapoints.length > 0\n ? duplicateDatapoints[duplicateDatapoints.length - 1]\n : emphasizedDatapoints[emphasizedDatapoints.length - 1];\n if (lastEmphasizedDatapoint !== undefined) {\n // Corresponds to select options inside getTimeSeries util.\n // https://echarts.apache.org/en/option.html#series-line.select.itemStyle\n chart.dispatchAction({\n type: 'select',\n seriesIndex: lastEmphasizedDatapoint.seriesIndex,\n dataIndex: lastEmphasizedDatapoint.dataIndex,\n // Shared crosshair should not emphasize datapoints on adjacent charts.\n escapeConnect: true, // TODO: try to remove escapeConnect and match by seriesName for cross panel correlation\n });\n }\n\n // Clears emphasis state of all lines that are not emphasized.\n // Emphasized is a subset of just the nearby series that are closest to cursor.\n chart.dispatchAction({\n type: 'downplay',\n seriesIndex: nonEmphasizedSeriesIndexes,\n });\n\n // https://echarts.apache.org/en/api.html#action.highlight\n if (emphasizedSeriesIndexes.length > 0) {\n // Fadeout opacity of all series not closest to cursor.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: emphasizedSeriesIndexes,\n notBlur: false, // ensure blur IS triggered, this is default but setting so it is explicit\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n } else {\n // When no emphasized series with bold text, notBlur allows opacity fadeout to not trigger.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: nearbySeriesIndexes,\n notBlur: true, // do not trigger blur state when cursor is not immediately close to any series\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n\n // Clears selected datapoints since no bold series in tooltip, restore does not impact highlighting\n chart.dispatchAction({\n type: 'toggleSelect', // https://echarts.apache.org/en/api.html#action.toggleSelect\n });\n }\n}\n\n/*\n * Determine whether a markLine was pushed into the final series, which means crosshair was already pinned onClick\n */\nexport function checkCrosshairPinnedStatus(seriesMapping: TimeChartSeriesMapping): boolean {\n const isCrosshairPinned = seriesMapping[seriesMapping.length - 1]?.name === PINNED_CROSSHAIR_SERIES_NAME;\n return isCrosshairPinned;\n}\n\n/*\n * Find closest timestamp to logical x coordinate returned from echartsInstance.convertFromPixel\n * Used to find nearby series in time series tooltip.\n */\nexport function getClosestTimestamp(timeSeriesValues?: TimeSeriesValueTuple[], cursorX?: number): number | null {\n if (timeSeriesValues === undefined || cursorX === undefined) {\n return null;\n }\n\n let currentClosestTimestamp: number | null = null;\n let currentClosestDistance = Infinity;\n\n for (const [timestamp] of timeSeriesValues) {\n const distance = Math.abs(timestamp - cursorX);\n if (distance < currentClosestDistance) {\n currentClosestTimestamp = timestamp;\n currentClosestDistance = distance;\n }\n }\n return currentClosestTimestamp;\n}\n\n/*\n * Find closest timestamp in full dataset, used to snap crosshair into place onClick when tooltip is pinned.\n */\nexport function getClosestTimestampInFullDataset(data: TimeSeries[], cursorX?: number): number | null {\n if (cursorX === undefined) {\n return null;\n }\n const totalSeries = data.length;\n let closestTimestamp = null;\n for (let seriesIdx = 0; seriesIdx < totalSeries; seriesIdx++) {\n const currentDataset = totalSeries > 0 ? data[seriesIdx] : null;\n if (!currentDataset) break;\n const currentValues: TimeSeriesValueTuple[] = currentDataset.values;\n closestTimestamp = getClosestTimestamp(currentValues, cursorX);\n }\n return closestTimestamp;\n}\n"],"names":["PINNED_CROSSHAIR_SERIES_NAME","enableDataZoom","chart","chartModel","undefined","option","toolbox","length","feature","dataZoom","iconStatus","zoom","dispatchAction","type","key","dataZoomSelectActive","restoreChart","clearHighlightedSeries","getPointInGrid","cursorCoordX","cursorCoordY","pointInPixel","containPixel","pointInGrid","convertFromPixel","batchDispatchNearbySeriesActions","nearbySeriesIndexes","emphasizedSeriesIndexes","nonEmphasizedSeriesIndexes","emphasizedDatapoints","duplicateDatapoints","lastEmphasizedDatapoint","seriesIndex","dataIndex","escapeConnect","notBlur","checkCrosshairPinnedStatus","seriesMapping","isCrosshairPinned","name","getClosestTimestamp","timeSeriesValues","cursorX","currentClosestTimestamp","currentClosestDistance","Infinity","timestamp","distance","Math","abs","getClosestTimestampInFullDataset","data","totalSeries","closestTimestamp","seriesIdx","currentDataset","currentValues","values"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,SAA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AAKC,GAAG,CAACH,YAAYJ;QACtC,IAAIK,WAAWH,wBAAwB;YACrCD,0BAA0BG;YAC1BF,yBAAyBG;QAC3B;IACF;IACA,OAAOJ;AACT;AAEA;;CAEC,GACD,OAAO,SAASO,iCAAiCC,IAAkB,EAAET,OAAgB;IACnF,IAAIA,YAAYtC,WAAW;QACzB,OAAO;IACT;IACA,MAAMgD,cAAcD,KAAK5C,MAAM;IAC/B,IAAI8C,mBAAmB;IACvB,IAAK,IAAIC,YAAY,GAAGA,YAAYF,aAAaE,YAAa;QAC5D,MAAMC,iBAAiBH,cAAc,IAAID,IAAI,CAACG,UAAU,GAAG;QAC3D,IAAI,CAACC,gBAAgB;QACrB,MAAMC,gBAAwCD,eAAeE,MAAM;QACnEJ,mBAAmBb,oBAAoBgB,eAAed;IACxD;IACA,OAAOW;AACT"}
1
+ {"version":3,"sources":["../../src/utils/chart-actions.ts"],"sourcesContent":["// Copyright 2023 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 { ECharts as EChartsInstance } from 'echarts/core';\nimport { TimeSeries, TimeSeriesValueTuple } from '@perses-dev/core';\nimport { DatapointInfo, PINNED_CROSSHAIR_SERIES_NAME, TimeChartSeriesMapping } from '../model';\n\nexport interface ZoomEventData {\n start: number;\n end: number;\n // TODO: remove startIndex and endIndex once LineChart is deprecated\n startIndex?: number;\n endIndex?: number;\n}\n\n/**\n * Enable dataZoom without requring user to click toolbox icon.\n * https://stackoverflow.com/questions/57183297/is-there-a-way-to-use-zoom-of-type-select-without-showing-the-toolbar\n */\nexport function enableDataZoom(chart: EChartsInstance): void {\n const chartModel = chart['_model'];\n if (chartModel === undefined) return;\n if (chartModel.option.toolbox !== undefined && chartModel.option.toolbox.length > 0) {\n // check if hidden data zoom icon is unselected (if selected it would be 'emphasis' instead of 'normal')\n if (chartModel.option.toolbox[0].feature.dataZoom.iconStatus.zoom === 'normal') {\n chart.dispatchAction({\n type: 'takeGlobalCursor',\n key: 'dataZoomSelect',\n dataZoomSelectActive: true,\n });\n }\n }\n}\n\n/**\n * Restore chart to original state before zoom or other actions were dispatched\n */\nexport function restoreChart(chart: EChartsInstance): void {\n // TODO: support incremental unzoom instead of restore to original state\n chart.dispatchAction({\n type: 'restore', // https://echarts.apache.org/en/api.html#events.restore\n });\n}\n\n/*\n * Clear all highlighted series when cursor exits canvas\n * https://echarts.apache.org/en/api.html#action.downplay\n */\nexport function clearHighlightedSeries(chart: EChartsInstance): void {\n if (chart.dispatchAction !== undefined) {\n // Clear any selected data points\n chart.dispatchAction({\n type: 'unselect',\n });\n\n // Clear any highlighted series\n chart.dispatchAction({\n type: 'downplay',\n });\n }\n}\n\n/*\n * Convert a point from pixel coordinate to logical coordinate.\n * Used to determine if cursor is over chart canvas and closest datapoint.\n * https://echarts.apache.org/en/api.html#echartsInstance.convertFromPixel\n */\nexport function getPointInGrid(cursorCoordX: number, cursorCoordY: number, chart?: EChartsInstance): number[] | null {\n if (chart === undefined) {\n return null;\n }\n\n const pointInPixel = [cursorCoordX, cursorCoordY];\n if (!chart.containPixel('grid', pointInPixel)) {\n return null;\n }\n\n const pointInGrid: number[] = chart.convertFromPixel('grid', pointInPixel);\n return pointInGrid;\n}\n\n/*\n * TimeSeriesChart tooltip is built custom to support finding nearby series instead of single or all series.\n * This means ECharts actions need to be dispatched manually for series highlighting, datapoint select state, etc.\n * More info: https://echarts.apache.org/en/api.html#action\n */\nexport function batchDispatchNearbySeriesActions(\n chart: EChartsInstance,\n nearbySeriesIndexes: number[],\n emphasizedSeriesIndexes: number[],\n nonEmphasizedSeriesIndexes: number[],\n emphasizedDatapoints: DatapointInfo[],\n duplicateDatapoints: DatapointInfo[]\n): void {\n // Accounts for multiple series that are rendered direct on top of eachother.\n // Only applies select state to the datapoint that is visible to avoid color mismatch.\n const lastEmphasizedDatapoint =\n duplicateDatapoints.length > 0\n ? duplicateDatapoints[duplicateDatapoints.length - 1]\n : emphasizedDatapoints[emphasizedDatapoints.length - 1];\n if (lastEmphasizedDatapoint !== undefined) {\n // Corresponds to select options inside getTimeSeries util.\n // https://echarts.apache.org/en/option.html#series-line.select.itemStyle\n chart.dispatchAction({\n type: 'select',\n seriesIndex: lastEmphasizedDatapoint.seriesIndex,\n dataIndex: lastEmphasizedDatapoint.dataIndex,\n // Shared crosshair should not emphasize datapoints on adjacent charts.\n escapeConnect: true, // TODO: try to remove escapeConnect and match by seriesName for cross panel correlation\n });\n }\n\n // Clears emphasis state of all lines that are not emphasized.\n // Emphasized is a subset of just the nearby series that are closest to cursor.\n chart.dispatchAction({\n type: 'downplay',\n seriesIndex: nonEmphasizedSeriesIndexes,\n });\n\n // https://echarts.apache.org/en/api.html#action.highlight\n if (emphasizedSeriesIndexes.length > 0) {\n // Fadeout opacity of all series not closest to cursor.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: emphasizedSeriesIndexes,\n notBlur: false, // ensure blur IS triggered, this is default but setting so it is explicit\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n } else {\n // When no emphasized series with bold text, notBlur allows opacity fadeout to not trigger.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: nearbySeriesIndexes,\n notBlur: true, // do not trigger blur state when cursor is not immediately close to any series\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n\n // Clears selected datapoints since no bold series in tooltip, restore does not impact highlighting\n chart.dispatchAction({\n type: 'toggleSelect', // https://echarts.apache.org/en/api.html#action.toggleSelect\n });\n }\n}\n\n/*\n * Determine whether a markLine was pushed into the final series, which means crosshair was already pinned onClick\n */\nexport function checkCrosshairPinnedStatus(seriesMapping: TimeChartSeriesMapping): boolean {\n const isCrosshairPinned = seriesMapping[seriesMapping.length - 1]?.name === PINNED_CROSSHAIR_SERIES_NAME;\n return isCrosshairPinned;\n}\n\n/*\n * Find closest timestamp to logical x coordinate returned from echartsInstance.convertFromPixel\n * Used to find nearby series in time series tooltip.\n */\nexport function getClosestTimestamp(timeSeriesValues?: TimeSeriesValueTuple[], cursorX?: number): number | null {\n if (timeSeriesValues === undefined || cursorX === undefined) {\n return null;\n }\n\n let currentClosestTimestamp: number | null = null;\n let currentClosestDistance = Infinity;\n\n for (const [timestamp] of timeSeriesValues) {\n const distance = Math.abs(timestamp - cursorX);\n if (distance < currentClosestDistance) {\n currentClosestTimestamp = timestamp;\n currentClosestDistance = distance;\n }\n }\n return currentClosestTimestamp;\n}\n\n/*\n * Find closest timestamp in full dataset, used to snap crosshair into place onClick when tooltip is pinned.\n */\nexport function getClosestTimestampInFullDataset(data: TimeSeries[], cursorX?: number): number | null {\n if (cursorX === undefined) {\n return null;\n }\n const totalSeries = data.length;\n let closestTimestamp = null;\n for (let seriesIdx = 0; seriesIdx < totalSeries; seriesIdx++) {\n const currentDataset = totalSeries > 0 ? data[seriesIdx] : null;\n if (!currentDataset) break;\n const currentValues: TimeSeriesValueTuple[] = currentDataset.values;\n closestTimestamp = getClosestTimestamp(currentValues, cursorX);\n }\n return closestTimestamp;\n}\n"],"names":["PINNED_CROSSHAIR_SERIES_NAME","enableDataZoom","chart","chartModel","undefined","option","toolbox","length","feature","dataZoom","iconStatus","zoom","dispatchAction","type","key","dataZoomSelectActive","restoreChart","clearHighlightedSeries","getPointInGrid","cursorCoordX","cursorCoordY","pointInPixel","containPixel","pointInGrid","convertFromPixel","batchDispatchNearbySeriesActions","nearbySeriesIndexes","emphasizedSeriesIndexes","nonEmphasizedSeriesIndexes","emphasizedDatapoints","duplicateDatapoints","lastEmphasizedDatapoint","seriesIndex","dataIndex","escapeConnect","notBlur","checkCrosshairPinnedStatus","seriesMapping","isCrosshairPinned","name","getClosestTimestamp","timeSeriesValues","cursorX","currentClosestTimestamp","currentClosestDistance","Infinity","timestamp","distance","Math","abs","getClosestTimestampInFullDataset","data","totalSeries","closestTimestamp","seriesIdx","currentDataset","currentValues","values"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,SAAwBA,4BAA4B,QAAgC,WAAW;AAU/F;;;CAGC,GACD,OAAO,SAASC,eAAeC,KAAsB;IACnD,MAAMC,aAAaD,KAAK,CAAC,SAAS;IAClC,IAAIC,eAAeC,WAAW;IAC9B,IAAID,WAAWE,MAAM,CAACC,OAAO,KAAKF,aAAaD,WAAWE,MAAM,CAACC,OAAO,CAACC,MAAM,GAAG,GAAG;QACnF,wGAAwG;QACxG,IAAIJ,WAAWE,MAAM,CAACC,OAAO,CAAC,EAAE,CAACE,OAAO,CAACC,QAAQ,CAACC,UAAU,CAACC,IAAI,KAAK,UAAU;YAC9ET,MAAMU,cAAc,CAAC;gBACnBC,MAAM;gBACNC,KAAK;gBACLC,sBAAsB;YACxB;QACF;IACF;AACF;AAEA;;CAEC,GACD,OAAO,SAASC,aAAad,KAAsB;IACjD,wEAAwE;IACxEA,MAAMU,cAAc,CAAC;QACnBC,MAAM;IACR;AACF;AAEA;;;CAGC,GACD,OAAO,SAASI,uBAAuBf,KAAsB;IAC3D,IAAIA,MAAMU,cAAc,KAAKR,WAAW;QACtC,iCAAiC;QACjCF,MAAMU,cAAc,CAAC;YACnBC,MAAM;QACR;QAEA,+BAA+B;QAC/BX,MAAMU,cAAc,CAAC;YACnBC,MAAM;QACR;IACF;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASK,eAAeC,YAAoB,EAAEC,YAAoB,EAAElB,KAAuB;IAChG,IAAIA,UAAUE,WAAW;QACvB,OAAO;IACT;IAEA,MAAMiB,eAAe;QAACF;QAAcC;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;AAEA;;;CAGC,GACD,OAAO,SAASE,oBAAoBC,gBAAyC,EAAEC,OAAgB;IAC7F,IAAID,qBAAqBrC,aAAasC,YAAYtC,WAAW;QAC3D,OAAO;IACT;IAEA,IAAIuC,0BAAyC;IAC7C,IAAIC,yBAAyBC;IAE7B,KAAK,MAAM,CAACC,UAAU,IAAIL,iBAAkB;QAC1C,MAAMM,WAAWC,KAAKC,GAAG,CAACH,YAAYJ;QACtC,IAAIK,WAAWH,wBAAwB;YACrCD,0BAA0BG;YAC1BF,yBAAyBG;QAC3B;IACF;IACA,OAAOJ;AACT;AAEA;;CAEC,GACD,OAAO,SAASO,iCAAiCC,IAAkB,EAAET,OAAgB;IACnF,IAAIA,YAAYtC,WAAW;QACzB,OAAO;IACT;IACA,MAAMgD,cAAcD,KAAK5C,MAAM;IAC/B,IAAI8C,mBAAmB;IACvB,IAAK,IAAIC,YAAY,GAAGA,YAAYF,aAAaE,YAAa;QAC5D,MAAMC,iBAAiBH,cAAc,IAAID,IAAI,CAACG,UAAU,GAAG;QAC3D,IAAI,CAACC,gBAAgB;QACrB,MAAMC,gBAAwCD,eAAeE,MAAM;QACnEJ,mBAAmBb,oBAAoBgB,eAAed;IACxD;IACA,OAAOW;AACT"}
@@ -33,7 +33,7 @@ export function formatWithTimeZone(date, formatString, timeZone) {
33
33
  * if timeZone is provided, and is not local|browser,
34
34
  * then format using timeZone option (recognize UTC regardless of uppercase/lowercase)
35
35
  * otherwise, format without timeZone option, defaulting to browser timeZone setting
36
- */ const lowerTimeZone = timeZone === null || timeZone === void 0 ? void 0 : timeZone.toLowerCase();
36
+ */ const lowerTimeZone = timeZone?.toLowerCase();
37
37
  if (!timeZone || lowerTimeZone === 'local' || lowerTimeZone === 'browser') {
38
38
  return format(date, formatString);
39
39
  } else {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/format.ts"],"sourcesContent":["// Copyright 2023 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 { formatInTimeZone } from 'date-fns-tz';\nimport { format } from 'date-fns';\n\nexport function dateFormatOptionsWithTimeZone(\n dateFormatOptions: Intl.DateTimeFormatOptions,\n timeZone?: string\n): Intl.DateTimeFormatOptions {\n /*\n * if timeZone is provided, and is not local|browser,\n * then set timeZone option (recognize UTC regardless of uppercase/lowercase)\n * otherwise, default to browser timeZone setting\n */\n if (timeZone) {\n const lowerTimeZone = timeZone.toLowerCase();\n if (lowerTimeZone !== 'local' && lowerTimeZone !== 'browser') {\n return {\n ...dateFormatOptions,\n timeZone: lowerTimeZone === 'utc' ? 'UTC' : timeZone,\n };\n }\n }\n return dateFormatOptions;\n}\n\nexport function formatWithTimeZone(date: Date, formatString: string, timeZone?: string): string {\n /*\n * if timeZone is provided, and is not local|browser,\n * then format using timeZone option (recognize UTC regardless of uppercase/lowercase)\n * otherwise, format without timeZone option, defaulting to browser timeZone setting\n */\n const lowerTimeZone = timeZone?.toLowerCase();\n if (!timeZone || lowerTimeZone === 'local' || lowerTimeZone === 'browser') {\n return format(date, formatString);\n } else {\n return formatInTimeZone(date, lowerTimeZone === 'utc' ? 'UTC' : timeZone, formatString);\n }\n}\n\n/*\n * Determines time granularity for axis labels, defaults to hh:mm\n */\nexport function getFormattedDate(value: number, rangeMs: number, timeZone?: string): string {\n const dateFormatOptions: Intl.DateTimeFormatOptions = dateFormatOptionsWithTimeZone(\n {\n hour: 'numeric',\n minute: 'numeric',\n hourCycle: 'h23',\n },\n timeZone\n );\n const thirtyMinMs = 1800000;\n const dayMs = 86400000;\n if (rangeMs <= thirtyMinMs) {\n dateFormatOptions.second = 'numeric';\n } else if (rangeMs >= dayMs) {\n dateFormatOptions.month = 'numeric';\n dateFormatOptions.day = 'numeric';\n }\n const DATE_FORMAT = new Intl.DateTimeFormat(undefined, dateFormatOptions);\n // remove comma when month / day present\n return DATE_FORMAT.format(value).replace(/, /g, ' ');\n}\n\n// https://echarts.apache.org/en/option.html#xAxis.axisLabel.formatter\nexport function getFormattedAxisLabel(rangeMs: number):\n | string\n | {\n month: '{MMM}';\n year: '{yearStyle|{yyyy}}\\n{monthStyle|{MMM}}';\n day: '{MM}/{dd}';\n } {\n const dayMs = 86400000;\n const monthMs = 2629440000;\n const yearMs = 31536000000;\n\n // more than 5 years\n if (rangeMs > yearMs * 5) {\n return '{yyyy}';\n }\n\n // more than 2 years\n if (rangeMs > yearMs * 2) {\n return '{MMM} {yyyy}';\n }\n\n // between 5 days to 6 months\n if (rangeMs > dayMs * 5 && rangeMs < monthMs * 6) {\n return '{MM}/{dd}'; // 12/01\n }\n\n // between 2 and 5 days\n if (rangeMs > dayMs * 2 && rangeMs <= dayMs * 5) {\n return '{MM}/{dd} {HH}:{mm}'; // 12/01 12:30\n }\n\n return {\n year: '{yearStyle|{yyyy}}\\n{monthStyle|{MMM}}',\n month: '{MMM}', // Jan, Feb, ...\n day: '{MM}/{dd}',\n };\n}\n\ninterface FormattedDateTime {\n formattedDate: string;\n formattedTime: string;\n}\n\nexport const getDateAndTime = (timeMs?: number): FormattedDateTime => {\n if (!timeMs) {\n return { formattedDate: '', formattedTime: '' };\n }\n const date = new Date(timeMs);\n const formattedDate = format(date, 'MMM dd, yyyy - ');\n const formattedTime = format(date, 'HH:mm:ss');\n return {\n formattedDate,\n formattedTime,\n };\n};\n"],"names":["formatInTimeZone","format","dateFormatOptionsWithTimeZone","dateFormatOptions","timeZone","lowerTimeZone","toLowerCase","formatWithTimeZone","date","formatString","getFormattedDate","value","rangeMs","hour","minute","hourCycle","thirtyMinMs","dayMs","second","month","day","DATE_FORMAT","Intl","DateTimeFormat","undefined","replace","getFormattedAxisLabel","monthMs","yearMs","year","getDateAndTime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AACC,WAAWrB;IACvD,wCAAwC;IACxC,OAAOkB,YAAYpB,MAAM,CAACU,OAAOc,OAAO,CAAC,OAAO;AAClD;AAEA,sEAAsE;AACtE,OAAO,SAASC,sBAAsBd,OAAe;IAOnD,MAAMK,QAAQ;IACd,MAAMU,UAAU;IAChB,MAAMC,SAAS;IAEf,oBAAoB;IACpB,IAAIhB,UAAUgB,SAAS,GAAG;QACxB,OAAO;IACT;IAEA,oBAAoB;IACpB,IAAIhB,UAAUgB,SAAS,GAAG;QACxB,OAAO;IACT;IAEA,6BAA6B;IAC7B,IAAIhB,UAAUK,QAAQ,KAAKL,UAAUe,UAAU,GAAG;QAChD,OAAO,aAAa,QAAQ;IAC9B;IAEA,uBAAuB;IACvB,IAAIf,UAAUK,QAAQ,KAAKL,WAAWK,QAAQ,GAAG;QAC/C,OAAO,uBAAuB,cAAc;IAC9C;IAEA,OAAO;QACLY,MAAM;QACNV,OAAO;QACPC,KAAK;IACP;AACF;AAOA,OAAO,MAAMU,iBAAiB,CAACC;IAC7B,IAAI,CAACA,QAAQ;QACX,OAAO;YAAEC,eAAe;YAAIC,eAAe;QAAG;IAChD;IACA,MAAMzB,OAAO,IAAI0B,KAAKH;IACtB,MAAMC,gBAAgB/B,OAAOO,MAAM;IACnC,MAAMyB,gBAAgBhC,OAAOO,MAAM;IACnC,OAAO;QACLwB;QACAC;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../../src/utils/format.ts"],"sourcesContent":["// Copyright 2023 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 { formatInTimeZone } from 'date-fns-tz';\nimport { format } from 'date-fns';\n\nexport function dateFormatOptionsWithTimeZone(\n dateFormatOptions: Intl.DateTimeFormatOptions,\n timeZone?: string\n): Intl.DateTimeFormatOptions {\n /*\n * if timeZone is provided, and is not local|browser,\n * then set timeZone option (recognize UTC regardless of uppercase/lowercase)\n * otherwise, default to browser timeZone setting\n */\n if (timeZone) {\n const lowerTimeZone = timeZone.toLowerCase();\n if (lowerTimeZone !== 'local' && lowerTimeZone !== 'browser') {\n return {\n ...dateFormatOptions,\n timeZone: lowerTimeZone === 'utc' ? 'UTC' : timeZone,\n };\n }\n }\n return dateFormatOptions;\n}\n\nexport function formatWithTimeZone(date: Date, formatString: string, timeZone?: string): string {\n /*\n * if timeZone is provided, and is not local|browser,\n * then format using timeZone option (recognize UTC regardless of uppercase/lowercase)\n * otherwise, format without timeZone option, defaulting to browser timeZone setting\n */\n const lowerTimeZone = timeZone?.toLowerCase();\n if (!timeZone || lowerTimeZone === 'local' || lowerTimeZone === 'browser') {\n return format(date, formatString);\n } else {\n return formatInTimeZone(date, lowerTimeZone === 'utc' ? 'UTC' : timeZone, formatString);\n }\n}\n\n/*\n * Determines time granularity for axis labels, defaults to hh:mm\n */\nexport function getFormattedDate(value: number, rangeMs: number, timeZone?: string): string {\n const dateFormatOptions: Intl.DateTimeFormatOptions = dateFormatOptionsWithTimeZone(\n {\n hour: 'numeric',\n minute: 'numeric',\n hourCycle: 'h23',\n },\n timeZone\n );\n const thirtyMinMs = 1800000;\n const dayMs = 86400000;\n if (rangeMs <= thirtyMinMs) {\n dateFormatOptions.second = 'numeric';\n } else if (rangeMs >= dayMs) {\n dateFormatOptions.month = 'numeric';\n dateFormatOptions.day = 'numeric';\n }\n const DATE_FORMAT = new Intl.DateTimeFormat(undefined, dateFormatOptions);\n // remove comma when month / day present\n return DATE_FORMAT.format(value).replace(/, /g, ' ');\n}\n\n// https://echarts.apache.org/en/option.html#xAxis.axisLabel.formatter\nexport function getFormattedAxisLabel(rangeMs: number):\n | string\n | {\n month: '{MMM}';\n year: '{yearStyle|{yyyy}}\\n{monthStyle|{MMM}}';\n day: '{MM}/{dd}';\n } {\n const dayMs = 86400000;\n const monthMs = 2629440000;\n const yearMs = 31536000000;\n\n // more than 5 years\n if (rangeMs > yearMs * 5) {\n return '{yyyy}';\n }\n\n // more than 2 years\n if (rangeMs > yearMs * 2) {\n return '{MMM} {yyyy}';\n }\n\n // between 5 days to 6 months\n if (rangeMs > dayMs * 5 && rangeMs < monthMs * 6) {\n return '{MM}/{dd}'; // 12/01\n }\n\n // between 2 and 5 days\n if (rangeMs > dayMs * 2 && rangeMs <= dayMs * 5) {\n return '{MM}/{dd} {HH}:{mm}'; // 12/01 12:30\n }\n\n return {\n year: '{yearStyle|{yyyy}}\\n{monthStyle|{MMM}}',\n month: '{MMM}', // Jan, Feb, ...\n day: '{MM}/{dd}',\n };\n}\n\ninterface FormattedDateTime {\n formattedDate: string;\n formattedTime: string;\n}\n\nexport const getDateAndTime = (timeMs?: number): FormattedDateTime => {\n if (!timeMs) {\n return { formattedDate: '', formattedTime: '' };\n }\n const date = new Date(timeMs);\n const formattedDate = format(date, 'MMM dd, yyyy - ');\n const formattedTime = format(date, 'HH:mm:ss');\n return {\n formattedDate,\n formattedTime,\n };\n};\n"],"names":["formatInTimeZone","format","dateFormatOptionsWithTimeZone","dateFormatOptions","timeZone","lowerTimeZone","toLowerCase","formatWithTimeZone","date","formatString","getFormattedDate","value","rangeMs","hour","minute","hourCycle","thirtyMinMs","dayMs","second","month","day","DATE_FORMAT","Intl","DateTimeFormat","undefined","replace","getFormattedAxisLabel","monthMs","yearMs","year","getDateAndTime","timeMs","formattedDate","formattedTime","Date"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,gBAAgB,QAAQ,cAAc;AAC/C,SAASC,MAAM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;IACpB,IAAIhB,UAAUgB,SAAS,GAAG;QACxB,OAAO;IACT;IAEA,6BAA6B;IAC7B,IAAIhB,UAAUK,QAAQ,KAAKL,UAAUe,UAAU,GAAG;QAChD,OAAO,aAAa,QAAQ;IAC9B;IAEA,uBAAuB;IACvB,IAAIf,UAAUK,QAAQ,KAAKL,WAAWK,QAAQ,GAAG;QAC/C,OAAO,uBAAuB,cAAc;IAC9C;IAEA,OAAO;QACLY,MAAM;QACNV,OAAO;QACPC,KAAK;IACP;AACF;AAOA,OAAO,MAAMU,iBAAiB,CAACC;IAC7B,IAAI,CAACA,QAAQ;QACX,OAAO;YAAEC,eAAe;YAAIC,eAAe;QAAG;IAChD;IACA,MAAMzB,OAAO,IAAI0B,KAAKH;IACtB,MAAMC,gBAAgB/B,OAAOO,MAAM;IACnC,MAAMyB,gBAAgBhC,OAAOO,MAAM;IACnC,OAAO;QACLwB;QACAC;IACF;AACF,EAAE"}
@@ -13,9 +13,7 @@
13
13
  import merge from 'lodash/merge';
14
14
  const DEFAULT_TEXT_COLOR = '#222';
15
15
  export function generateChartsTheme(muiTheme, persesChartsThemeOverride) {
16
- var _muiTheme_palette_text, _muiTheme_palette_action, _muiTheme_palette, _muiTheme_palette_action1, _muiTheme_palette1, _muiTheme_palette_designSystem, _muiTheme_palette_designSystem1;
17
- var _muiTheme_palette_text_primary;
18
- const primaryTextColor = (_muiTheme_palette_text_primary = (_muiTheme_palette_text = muiTheme.palette.text) === null || _muiTheme_palette_text === void 0 ? void 0 : _muiTheme_palette_text.primary) !== null && _muiTheme_palette_text_primary !== void 0 ? _muiTheme_palette_text_primary : DEFAULT_TEXT_COLOR;
16
+ const primaryTextColor = muiTheme.palette.text?.primary ?? DEFAULT_TEXT_COLOR;
19
17
  const muiConvertedTheme = {
20
18
  title: {
21
19
  show: false
@@ -142,8 +140,8 @@ export function generateChartsTheme(muiTheme, persesChartsThemeOverride) {
142
140
  pageTextStyle: {
143
141
  color: muiTheme.palette.grey[600]
144
142
  },
145
- pageIconColor: muiTheme === null || muiTheme === void 0 ? void 0 : (_muiTheme_palette = muiTheme.palette) === null || _muiTheme_palette === void 0 ? void 0 : (_muiTheme_palette_action = _muiTheme_palette.action) === null || _muiTheme_palette_action === void 0 ? void 0 : _muiTheme_palette_action.active,
146
- pageIconInactiveColor: muiTheme === null || muiTheme === void 0 ? void 0 : (_muiTheme_palette1 = muiTheme.palette) === null || _muiTheme_palette1 === void 0 ? void 0 : (_muiTheme_palette_action1 = _muiTheme_palette1.action) === null || _muiTheme_palette_action1 === void 0 ? void 0 : _muiTheme_palette_action1.disabled
143
+ pageIconColor: muiTheme?.palette?.action?.active,
144
+ pageIconInactiveColor: muiTheme?.palette?.action?.disabled
147
145
  },
148
146
  toolbox: {
149
147
  show: true,
@@ -154,8 +152,8 @@ export function generateChartsTheme(muiTheme, persesChartsThemeOverride) {
154
152
  }
155
153
  },
156
154
  tooltip: {
157
- backgroundColor: (_muiTheme_palette_designSystem = muiTheme.palette.designSystem) === null || _muiTheme_palette_designSystem === void 0 ? void 0 : _muiTheme_palette_designSystem.grey[800],
158
- borderColor: (_muiTheme_palette_designSystem1 = muiTheme.palette.designSystem) === null || _muiTheme_palette_designSystem1 === void 0 ? void 0 : _muiTheme_palette_designSystem1.grey[800],
155
+ backgroundColor: muiTheme.palette.designSystem?.grey[800],
156
+ borderColor: muiTheme.palette.designSystem?.grey[800],
159
157
  textStyle: {
160
158
  color: '#fff',
161
159
  fontSize: 11