@perses-dev/components 0.0.0-snapshot-explorer-plugin-c4a7621 → 0.0.0-snapshot-profile-8090608

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 (187) hide show
  1. package/README.md +1 -4
  2. package/dist/ColorPicker/ColorPicker.js.map +1 -1
  3. package/dist/ColorPicker/OptionsColorPicker.js.map +1 -1
  4. package/dist/ContentWithLegend/ContentWithLegend.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 +5 -3
  8. package/dist/DragAndDrop/DragButton.js.map +1 -1
  9. package/dist/DragAndDrop/DropIndicator.js.map +1 -1
  10. package/dist/Drawer/Drawer.js.map +1 -1
  11. package/dist/EChart/EChart.d.ts +3 -2
  12. package/dist/EChart/EChart.d.ts.map +1 -1
  13. package/dist/EChart/EChart.js +26 -4
  14. package/dist/EChart/EChart.js.map +1 -1
  15. package/dist/InfoTooltip/InfoTooltip.js +2 -1
  16. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  17. package/dist/JSONEditor.d.ts.map +1 -1
  18. package/dist/JSONEditor.js +5 -6
  19. package/dist/JSONEditor.js.map +1 -1
  20. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  21. package/dist/Overlay/Overlay.js +1 -1
  22. package/dist/Overlay/Overlay.js.map +1 -1
  23. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  24. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
  25. package/dist/Table/Table.d.ts +1 -1
  26. package/dist/Table/Table.d.ts.map +1 -1
  27. package/dist/Table/Table.js +15 -4
  28. package/dist/Table/Table.js.map +1 -1
  29. package/dist/Table/TableCell.d.ts +2 -1
  30. package/dist/Table/TableCell.d.ts.map +1 -1
  31. package/dist/Table/TableCell.js +4 -2
  32. package/dist/Table/TableCell.js.map +1 -1
  33. package/dist/Table/TableFoot.d.ts +4 -0
  34. package/dist/Table/TableFoot.d.ts.map +1 -0
  35. package/dist/{BarChart/index.js → Table/TableFoot.js} +11 -3
  36. package/dist/Table/TableFoot.js.map +1 -0
  37. package/dist/Table/TableHeaderCell.js.map +1 -1
  38. package/dist/Table/VirtualizedTable.d.ts +3 -2
  39. package/dist/Table/VirtualizedTable.d.ts.map +1 -1
  40. package/dist/Table/VirtualizedTable.js +33 -2
  41. package/dist/Table/VirtualizedTable.js.map +1 -1
  42. package/dist/Table/model/table-model.d.ts +18 -2
  43. package/dist/Table/model/table-model.d.ts.map +1 -1
  44. package/dist/Table/model/table-model.js +4 -2
  45. package/dist/Table/model/table-model.js.map +1 -1
  46. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  47. package/dist/ThresholdsEditor/ThresholdsEditor.js +1 -1
  48. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  49. package/dist/TimeChart/TimeChart.d.ts.map +1 -1
  50. package/dist/TimeChart/TimeChart.js +6 -6
  51. package/dist/TimeChart/TimeChart.js.map +1 -1
  52. package/dist/TimeRangeSelector/DateTimeRangePicker.js +1 -1
  53. package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
  54. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +1 -1
  55. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
  56. package/dist/TimeRangeSelector/utils.js.map +1 -1
  57. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
  58. package/dist/TimeSeriesTooltip/LineChartTooltip.js +2 -5
  59. package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
  60. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  61. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
  62. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
  63. package/dist/TimeSeriesTooltip/TimeChartTooltip.js +2 -5
  64. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  65. package/dist/TimeSeriesTooltip/tooltip-model.d.ts +1 -8
  66. package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
  67. package/dist/TimeSeriesTooltip/tooltip-model.js +6 -16
  68. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  69. package/dist/TimeSeriesTooltip/utils.d.ts +1 -1
  70. package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
  71. package/dist/TimeSeriesTooltip/utils.js +27 -23
  72. package/dist/TimeSeriesTooltip/utils.js.map +1 -1
  73. package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
  74. package/dist/cjs/DragAndDrop/DragButton.js +4 -2
  75. package/dist/cjs/EChart/EChart.js +25 -3
  76. package/dist/cjs/InfoTooltip/InfoTooltip.js +2 -1
  77. package/dist/cjs/JSONEditor.js +4 -5
  78. package/dist/cjs/Overlay/Overlay.js +1 -1
  79. package/dist/cjs/Table/Table.js +14 -3
  80. package/dist/cjs/Table/TableCell.js +4 -2
  81. package/dist/cjs/{StatChart/utils/formatStatChartValue.js → Table/TableFoot.js} +12 -15
  82. package/dist/cjs/Table/VirtualizedTable.js +32 -1
  83. package/dist/cjs/Table/model/table-model.js +7 -2
  84. package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +9 -9
  85. package/dist/cjs/TimeChart/TimeChart.js +5 -5
  86. package/dist/cjs/TimeRangeSelector/DateTimeRangePicker.js +2 -2
  87. package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +1 -4
  88. package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +1 -4
  89. package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +6 -25
  90. package/dist/cjs/TimeSeriesTooltip/utils.js +26 -22
  91. package/dist/cjs/context/ChartsProvider.js +3 -1
  92. package/dist/cjs/index.js +0 -5
  93. package/dist/cjs/test-utils/theme.js +1 -0
  94. package/dist/context/ChartsProvider.d.ts +2 -0
  95. package/dist/context/ChartsProvider.d.ts.map +1 -1
  96. package/dist/context/ChartsProvider.js +3 -1
  97. package/dist/context/ChartsProvider.js.map +1 -1
  98. package/dist/context/SnackbarProvider.js.map +1 -1
  99. package/dist/index.d.ts +0 -5
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +0 -5
  102. package/dist/index.js.map +1 -1
  103. package/dist/model/timeOption.js.map +1 -1
  104. package/dist/test-utils/theme.d.ts.map +1 -1
  105. package/dist/test-utils/theme.js +1 -0
  106. package/dist/test-utils/theme.js.map +1 -1
  107. package/dist/theme/component-overrides/alert.js.map +1 -1
  108. package/dist/utils/component-ids.js.map +1 -1
  109. package/package.json +6 -11
  110. package/dist/BarChart/BarChart.d.ts +0 -16
  111. package/dist/BarChart/BarChart.d.ts.map +0 -1
  112. package/dist/BarChart/BarChart.js +0 -134
  113. package/dist/BarChart/BarChart.js.map +0 -1
  114. package/dist/BarChart/index.d.ts +0 -2
  115. package/dist/BarChart/index.d.ts.map +0 -1
  116. package/dist/BarChart/index.js.map +0 -1
  117. package/dist/GaugeChart/GaugeChart.d.ts +0 -23
  118. package/dist/GaugeChart/GaugeChart.d.ts.map +0 -1
  119. package/dist/GaugeChart/GaugeChart.js +0 -214
  120. package/dist/GaugeChart/GaugeChart.js.map +0 -1
  121. package/dist/GaugeChart/index.d.ts +0 -2
  122. package/dist/GaugeChart/index.d.ts.map +0 -1
  123. package/dist/GaugeChart/index.js +0 -15
  124. package/dist/GaugeChart/index.js.map +0 -1
  125. package/dist/PieChart/PieChart.d.ts +0 -14
  126. package/dist/PieChart/PieChart.d.ts.map +0 -1
  127. package/dist/PieChart/PieChart.js +0 -92
  128. package/dist/PieChart/PieChart.js.map +0 -1
  129. package/dist/PieChart/index.d.ts +0 -2
  130. package/dist/PieChart/index.d.ts.map +0 -1
  131. package/dist/PieChart/index.js +0 -15
  132. package/dist/PieChart/index.js.map +0 -1
  133. package/dist/StatChart/StatChart.d.ts +0 -21
  134. package/dist/StatChart/StatChart.d.ts.map +0 -1
  135. package/dist/StatChart/StatChart.js +0 -185
  136. package/dist/StatChart/StatChart.js.map +0 -1
  137. package/dist/StatChart/calculateFontSize.d.ts +0 -16
  138. package/dist/StatChart/calculateFontSize.d.ts.map +0 -1
  139. package/dist/StatChart/calculateFontSize.js +0 -49
  140. package/dist/StatChart/calculateFontSize.js.map +0 -1
  141. package/dist/StatChart/index.d.ts +0 -2
  142. package/dist/StatChart/index.d.ts.map +0 -1
  143. package/dist/StatChart/index.js +0 -15
  144. package/dist/StatChart/index.js.map +0 -1
  145. package/dist/StatChart/utils/formatStatChartValue.d.ts +0 -3
  146. package/dist/StatChart/utils/formatStatChartValue.d.ts.map +0 -1
  147. package/dist/StatChart/utils/formatStatChartValue.js +0 -26
  148. package/dist/StatChart/utils/formatStatChartValue.js.map +0 -1
  149. package/dist/StatusHistoryChart/StatusHistoryChart.d.ts +0 -27
  150. package/dist/StatusHistoryChart/StatusHistoryChart.d.ts.map +0 -1
  151. package/dist/StatusHistoryChart/StatusHistoryChart.js +0 -132
  152. package/dist/StatusHistoryChart/StatusHistoryChart.js.map +0 -1
  153. package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts +0 -13
  154. package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts.map +0 -1
  155. package/dist/StatusHistoryChart/StatusHistoryTooltip.js +0 -47
  156. package/dist/StatusHistoryChart/StatusHistoryTooltip.js.map +0 -1
  157. package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts +0 -2
  158. package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts.map +0 -1
  159. package/dist/StatusHistoryChart/get-formatted-axis-label.js +0 -41
  160. package/dist/StatusHistoryChart/get-formatted-axis-label.js.map +0 -1
  161. package/dist/StatusHistoryChart/index.d.ts +0 -3
  162. package/dist/StatusHistoryChart/index.d.ts.map +0 -1
  163. package/dist/StatusHistoryChart/index.js +0 -16
  164. package/dist/StatusHistoryChart/index.js.map +0 -1
  165. package/dist/StatusHistoryChart/utils/get-color.d.ts +0 -6
  166. package/dist/StatusHistoryChart/utils/get-color.d.ts.map +0 -1
  167. package/dist/StatusHistoryChart/utils/get-color.js +0 -100
  168. package/dist/StatusHistoryChart/utils/get-color.js.map +0 -1
  169. package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts +0 -3
  170. package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts.map +0 -1
  171. package/dist/StatusHistoryChart/utils/get-tooltip-position.js +0 -27
  172. package/dist/StatusHistoryChart/utils/get-tooltip-position.js.map +0 -1
  173. package/dist/cjs/BarChart/BarChart.js +0 -142
  174. package/dist/cjs/BarChart/index.js +0 -30
  175. package/dist/cjs/GaugeChart/GaugeChart.js +0 -227
  176. package/dist/cjs/GaugeChart/index.js +0 -30
  177. package/dist/cjs/PieChart/PieChart.js +0 -100
  178. package/dist/cjs/PieChart/index.js +0 -30
  179. package/dist/cjs/StatChart/StatChart.js +0 -198
  180. package/dist/cjs/StatChart/calculateFontSize.js +0 -55
  181. package/dist/cjs/StatChart/index.js +0 -30
  182. package/dist/cjs/StatusHistoryChart/StatusHistoryChart.js +0 -140
  183. package/dist/cjs/StatusHistoryChart/StatusHistoryTooltip.js +0 -55
  184. package/dist/cjs/StatusHistoryChart/get-formatted-axis-label.js +0 -48
  185. package/dist/cjs/StatusHistoryChart/index.js +0 -31
  186. package/dist/cjs/StatusHistoryChart/utils/get-color.js +0 -125
  187. package/dist/cjs/StatusHistoryChart/utils/get-tooltip-position.js +0 -35
@@ -1,100 +0,0 @@
1
- // Copyright 2024 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, "PieChart", {
18
- enumerable: true,
19
- get: function() {
20
- return PieChart;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _core = require("echarts/core");
25
- const _charts = require("echarts/charts");
26
- const _components = require("echarts/components");
27
- const _renderers = require("echarts/renderers");
28
- const _material = require("@mui/material");
29
- const _ChartsProvider = require("../context/ChartsProvider");
30
- const _EChart = require("../EChart");
31
- (0, _core.use)([
32
- _charts.PieChart,
33
- _components.GridComponent,
34
- _components.DatasetComponent,
35
- _components.TitleComponent,
36
- _components.TooltipComponent,
37
- _renderers.CanvasRenderer
38
- ]);
39
- const PIE_WIN_WIDTH = 12;
40
- const PIE_GAP = 4;
41
- function PieChart(props) {
42
- const { width, height, data } = props;
43
- const chartsTheme = (0, _ChartsProvider.useChartsTheme)();
44
- const option = {
45
- title: {
46
- text: 'Referer of a Website',
47
- subtext: 'Fake Data',
48
- left: 'center'
49
- },
50
- tooltip: {
51
- trigger: 'item',
52
- formatter: '{a} <br/>{b} : {c} ({d}%)'
53
- },
54
- axisLabel: {
55
- overflow: 'truncate',
56
- width: width / 3
57
- },
58
- series: [
59
- {
60
- name: 'Access From',
61
- type: 'pie',
62
- radius: '55%',
63
- label: false,
64
- center: [
65
- '40%',
66
- '50%'
67
- ],
68
- data: data,
69
- emphasis: {
70
- itemStyle: {
71
- shadowBlur: 10,
72
- shadowOffsetX: 0,
73
- shadowColor: 'rgba(0, 0, 0, 0.5)'
74
- }
75
- }
76
- }
77
- ],
78
- itemStyle: {
79
- borderRadius: 2,
80
- color: chartsTheme.echartsTheme[0]
81
- }
82
- };
83
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
84
- style: {
85
- width: width,
86
- height: height
87
- },
88
- sx: {
89
- overflow: 'auto'
90
- },
91
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_EChart.EChart, {
92
- sx: {
93
- minHeight: height,
94
- height: data ? data.length * (PIE_WIN_WIDTH + PIE_GAP) : '100%'
95
- },
96
- option: option,
97
- theme: chartsTheme.echartsTheme
98
- })
99
- });
100
- }
@@ -1,30 +0,0 @@
1
- // Copyright 2024 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
- _export_star(require("./PieChart"), exports);
18
- function _export_star(from, to) {
19
- Object.keys(from).forEach(function(k) {
20
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
21
- Object.defineProperty(to, k, {
22
- enumerable: true,
23
- get: function() {
24
- return from[k];
25
- }
26
- });
27
- }
28
- });
29
- return from;
30
- }
@@ -1,198 +0,0 @@
1
- // Copyright 2023 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, "StatChart", {
18
- enumerable: true,
19
- get: function() {
20
- return StatChart;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _react = require("react");
25
- const _material = require("@mui/material");
26
- const _merge = /*#__PURE__*/ _interop_require_default(require("lodash/merge"));
27
- const _core = require("echarts/core");
28
- const _charts = require("echarts/charts");
29
- const _components = require("echarts/components");
30
- const _renderers = require("echarts/renderers");
31
- const _context = require("../context");
32
- const _EChart = require("../EChart");
33
- const _calculateFontSize = require("./calculateFontSize");
34
- const _formatStatChartValue = require("./utils/formatStatChartValue");
35
- function _interop_require_default(obj) {
36
- return obj && obj.__esModule ? obj : {
37
- default: obj
38
- };
39
- }
40
- (0, _core.use)([
41
- _charts.LineChart,
42
- _components.GridComponent,
43
- _components.DatasetComponent,
44
- _components.TitleComponent,
45
- _components.TooltipComponent,
46
- _renderers.CanvasRenderer
47
- ]);
48
- const LINE_HEIGHT = 1.2;
49
- const SERIES_NAME_MAX_FONT_SIZE = 30;
50
- const SERIES_NAME_FONT_WEIGHT = 400;
51
- const VALUE_FONT_WEIGHT = 700;
52
- const StatChart = (props)=>{
53
- const { width, height, data, sparkline, showSeriesName, format, valueFontSize } = props;
54
- const chartsTheme = (0, _context.useChartsTheme)();
55
- const color = data.color;
56
- const formattedValue = (0, _formatStatChartValue.formatStatChartValue)(data.calculatedValue, format);
57
- const containerPadding = chartsTheme.container.padding.default;
58
- // calculate series name font size and height
59
- let seriesNameFontSize = (0, _calculateFontSize.useOptimalFontSize)({
60
- text: data?.seriesData?.name ?? '',
61
- fontWeight: SERIES_NAME_FONT_WEIGHT,
62
- width,
63
- height: height * 0.125,
64
- lineHeight: LINE_HEIGHT,
65
- maxSize: SERIES_NAME_MAX_FONT_SIZE
66
- });
67
- const seriesNameHeight = showSeriesName ? seriesNameFontSize * LINE_HEIGHT + containerPadding : 0;
68
- // calculate value font size and height
69
- const availableWidth = width - containerPadding * 2;
70
- const availableHeight = height - seriesNameHeight;
71
- const optimalValueFontSize = (0, _calculateFontSize.useOptimalFontSize)({
72
- text: formattedValue,
73
- // override the font size if user selects it in the settings
74
- fontSizeOverride: valueFontSize,
75
- fontWeight: VALUE_FONT_WEIGHT,
76
- // without sparkline, use only 50% of the available width so it looks better for multiseries
77
- width: sparkline ? availableWidth : availableWidth * 0.5,
78
- // with sparkline, use only 25% of available height to leave room for chart
79
- // without sparkline, value should take up 90% of available space
80
- height: sparkline ? availableHeight * 0.25 : availableHeight * 0.9,
81
- lineHeight: LINE_HEIGHT
82
- });
83
- const valueFontHeight = optimalValueFontSize * LINE_HEIGHT;
84
- // make sure the series name font size is slightly smaller than value font size
85
- seriesNameFontSize = Math.min(optimalValueFontSize * 0.7, seriesNameFontSize);
86
- const option = (0, _react.useMemo)(()=>{
87
- if (data.seriesData === undefined) return chartsTheme.noDataOption;
88
- const series = data.seriesData;
89
- const statSeries = [];
90
- if (sparkline !== undefined) {
91
- const lineSeries = {
92
- type: 'line',
93
- name: series.name,
94
- data: series.values,
95
- zlevel: 1,
96
- symbol: 'none',
97
- animation: false,
98
- silent: true
99
- };
100
- const mergedSeries = (0, _merge.default)(lineSeries, sparkline);
101
- statSeries.push(mergedSeries);
102
- }
103
- const option = {
104
- title: {
105
- show: false
106
- },
107
- grid: {
108
- show: false,
109
- top: '35%',
110
- right: 0,
111
- bottom: 0,
112
- left: 0,
113
- containLabel: false
114
- },
115
- xAxis: {
116
- type: 'time',
117
- show: false,
118
- boundaryGap: false
119
- },
120
- yAxis: {
121
- type: 'value',
122
- show: false,
123
- min: (value)=>{
124
- if (value.min >= 0 && value.min <= 1) {
125
- // helps with percent-decimal units, or datasets that return 0 or 1 booleans
126
- return 0;
127
- }
128
- return value.min;
129
- }
130
- },
131
- tooltip: {
132
- show: false
133
- },
134
- series: statSeries
135
- };
136
- return option;
137
- }, [
138
- data,
139
- chartsTheme,
140
- sparkline
141
- ]);
142
- const textAlignment = sparkline ? 'auto' : 'center';
143
- const textStyles = {
144
- display: 'flex',
145
- flexDirection: 'column',
146
- justifyContent: textAlignment,
147
- alignItems: textAlignment
148
- };
149
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
150
- sx: {
151
- height: '100%',
152
- width: '100%',
153
- ...textStyles
154
- },
155
- children: [
156
- showSeriesName && /*#__PURE__*/ (0, _jsxruntime.jsx)(SeriesName, {
157
- padding: containerPadding,
158
- fontSize: seriesNameFontSize,
159
- children: data.seriesData?.name
160
- }),
161
- /*#__PURE__*/ (0, _jsxruntime.jsx)(Value, {
162
- variant: "h3",
163
- color: color,
164
- fontSize: optimalValueFontSize,
165
- padding: containerPadding,
166
- children: formattedValue
167
- }),
168
- sparkline !== undefined && /*#__PURE__*/ (0, _jsxruntime.jsx)(_EChart.EChart, {
169
- sx: {
170
- width: '100%',
171
- height: height - seriesNameHeight - valueFontHeight
172
- },
173
- option: option,
174
- theme: chartsTheme.echartsTheme,
175
- renderer: "svg"
176
- })
177
- ]
178
- });
179
- };
180
- const SeriesName = (0, _material.styled)(_material.Typography, {
181
- shouldForwardProp: (prop)=>prop !== 'padding' && prop !== 'fontSize'
182
- })(({ theme, padding, fontSize })=>({
183
- color: theme.palette.text.secondary,
184
- padding: `${padding}px`,
185
- fontSize: `${fontSize}px`,
186
- overflow: 'hidden',
187
- textOverflow: 'ellipsis',
188
- whiteSpace: 'nowrap'
189
- }));
190
- const Value = (0, _material.styled)(_material.Typography, {
191
- shouldForwardProp: (prop)=>prop !== 'color' && prop !== 'padding' && prop !== 'fontSize' && prop !== 'sparkline'
192
- })(({ theme, color, padding, fontSize, sparkline })=>({
193
- color: color ?? theme.palette.text.primary,
194
- fontSize: `${fontSize}px`,
195
- padding: sparkline ? `${padding}px ${padding}px 0 ${padding}px` : ` 0 ${padding}px`,
196
- whiteSpace: 'nowrap',
197
- lineHeight: LINE_HEIGHT
198
- }));
@@ -1,55 +0,0 @@
1
- // Copyright 2023 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, "useOptimalFontSize", {
18
- enumerable: true,
19
- get: function() {
20
- return useOptimalFontSize;
21
- }
22
- });
23
- const _ChartsProvider = require("../context/ChartsProvider");
24
- let canvasContext;
25
- function getGlobalCanvasContext() {
26
- if (!canvasContext) {
27
- canvasContext = document.createElement('canvas').getContext('2d');
28
- if (canvasContext === null) {
29
- throw new Error('Canvas context is null.');
30
- }
31
- }
32
- return canvasContext;
33
- }
34
- function useOptimalFontSize({ text, fontWeight, width, height, lineHeight, maxSize, fontSizeOverride }) {
35
- const ctx = getGlobalCanvasContext();
36
- const { echartsTheme } = (0, _ChartsProvider.useChartsTheme)();
37
- // if user has selected a font size in the settings, use it instead of calculating the optimal size
38
- if (fontSizeOverride !== undefined) {
39
- return Number(fontSizeOverride);
40
- }
41
- const textStyle = echartsTheme.textStyle;
42
- const fontSize = Number(textStyle?.fontSize) ?? 12;
43
- const fontFamily = textStyle?.fontFamily ?? 'Lato';
44
- // set the font on the canvas context
45
- const fontStyle = `${fontWeight} ${fontSize}px ${fontFamily}`;
46
- ctx.font = fontStyle;
47
- // measure the width of the text with the given font style
48
- const textMetrics = ctx.measureText(text);
49
- // check how much bigger we can make the font while staying within the width and height
50
- const fontSizeBasedOnWidth = width / textMetrics.width * fontSize;
51
- const fontSizeBasedOnHeight = height / lineHeight;
52
- // return the smaller font size
53
- const finalFontSize = Math.min(fontSizeBasedOnHeight, fontSizeBasedOnWidth);
54
- return maxSize ? Math.min(finalFontSize, maxSize) : finalFontSize;
55
- }
@@ -1,30 +0,0 @@
1
- // Copyright 2023 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
- _export_star(require("./StatChart"), exports);
18
- function _export_star(from, to) {
19
- Object.keys(from).forEach(function(k) {
20
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
21
- Object.defineProperty(to, k, {
22
- enumerable: true,
23
- get: function() {
24
- return from[k];
25
- }
26
- });
27
- }
28
- });
29
- return from;
30
- }
@@ -1,140 +0,0 @@
1
- // Copyright 2024 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, "StatusHistoryChart", {
18
- enumerable: true,
19
- get: function() {
20
- return StatusHistoryChart;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _material = require("@mui/material");
25
- const _charts = require("echarts/charts");
26
- const _components = require("echarts/components");
27
- const _core = require("echarts/core");
28
- const _renderers = require("echarts/renderers");
29
- const _ChartsProvider = require("../context/ChartsProvider");
30
- const _TimeZoneProvider = require("../context/TimeZoneProvider");
31
- const _EChart = require("../EChart");
32
- const _getformattedaxislabel = require("./get-formatted-axis-label");
33
- const _StatusHistoryTooltip = require("./StatusHistoryTooltip");
34
- (0, _core.use)([
35
- _charts.HeatmapChart,
36
- _components.VisualMapComponent,
37
- _components.GridComponent,
38
- _components.DatasetComponent,
39
- _components.TitleComponent,
40
- _components.TooltipComponent,
41
- _renderers.CanvasRenderer
42
- ]);
43
- const StatusHistoryChart = (props)=>{
44
- const { height, data, xAxisCategories, yAxisCategories, timeScale, colors } = props;
45
- const { timeZone } = (0, _TimeZoneProvider.useTimeZone)();
46
- const chartsTheme = (0, _ChartsProvider.useChartsTheme)();
47
- const theme = (0, _material.useTheme)();
48
- const option = {
49
- tooltip: {
50
- appendToBody: true,
51
- formatter: (params)=>{
52
- return (0, _StatusHistoryTooltip.generateTooltipHTML)({
53
- data: params.data.value,
54
- label: params.data.label,
55
- marker: params.marker,
56
- xAxisCategories,
57
- yAxisCategories,
58
- theme
59
- });
60
- }
61
- },
62
- grid: {
63
- top: '5%',
64
- bottom: '5%'
65
- },
66
- xAxis: {
67
- type: 'category',
68
- data: xAxisCategories,
69
- axisLine: {
70
- show: false
71
- },
72
- splitArea: {
73
- show: false
74
- },
75
- axisLabel: {
76
- hideOverlap: true,
77
- formatter: (0, _getformattedaxislabel.getFormattedStatusHistoryAxisLabel)(timeScale?.rangeMs ?? 0, timeZone)
78
- }
79
- },
80
- yAxis: {
81
- type: 'category',
82
- data: yAxisCategories,
83
- axisLine: {
84
- show: false
85
- },
86
- splitArea: {
87
- show: false,
88
- interval: 0
89
- },
90
- splitLine: {
91
- show: false
92
- },
93
- axisLabel: {
94
- interval: 0
95
- }
96
- },
97
- visualMap: {
98
- show: false,
99
- type: 'piecewise',
100
- pieces: colors
101
- },
102
- series: [
103
- {
104
- name: 'Status history',
105
- type: 'heatmap',
106
- coordinateSystem: 'cartesian2d',
107
- data: data,
108
- label: {
109
- show: false
110
- },
111
- itemStyle: {
112
- borderWidth: 1,
113
- borderType: 'solid',
114
- borderColor: '#ffffff'
115
- },
116
- emphasis: {
117
- itemStyle: {
118
- opacity: 0.5
119
- }
120
- }
121
- }
122
- ]
123
- };
124
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
125
- style: {
126
- height: height
127
- },
128
- sx: {
129
- overflow: 'auto'
130
- },
131
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_EChart.EChart, {
132
- sx: {
133
- width: '100%',
134
- height: height
135
- },
136
- option: option,
137
- theme: chartsTheme.echartsTheme
138
- })
139
- });
140
- };
@@ -1,55 +0,0 @@
1
- // Copyright 2024 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, "generateTooltipHTML", {
18
- enumerable: true,
19
- get: function() {
20
- return generateTooltipHTML;
21
- }
22
- });
23
- const _material = require("@mui/material");
24
- const _utils = require("../utils");
25
- function generateTooltipHTML({ data, label, marker, xAxisCategories, yAxisCategories, theme }) {
26
- const [x, y] = data;
27
- const xAxisLabel = xAxisCategories[x];
28
- const { formattedDate, formattedTime } = (0, _utils.getDateAndTime)(xAxisLabel);
29
- const tooltipHeader = (0, _material.css)`
30
- border-bottom: 1px solid ${theme.palette.grey[500]};
31
- padding-bottom: 8px;
32
- `;
33
- const tooltipContentStyles = (0, _material.css)`
34
- display: flex;
35
- justify-content: space-between;
36
- padding-top: 8px;
37
- `;
38
- const labelStyles = (0, _material.css)`
39
- margin-right: 16px;
40
- `;
41
- return `
42
- <div>
43
- <div style="${tooltipHeader.styles}">${formattedDate} ${formattedTime}</div>
44
- <div style="${tooltipContentStyles.styles}">
45
- <div style="${labelStyles.styles}">
46
- ${marker}
47
- <strong>${yAxisCategories[y]}</strong>
48
- </div>
49
- <div>
50
- ${label}
51
- </div>
52
- </div>
53
- </div>
54
- `;
55
- }
@@ -1,48 +0,0 @@
1
- // Copyright 2024 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, "getFormattedStatusHistoryAxisLabel", {
18
- enumerable: true,
19
- get: function() {
20
- return getFormattedStatusHistoryAxisLabel;
21
- }
22
- });
23
- const _utils = require("../utils");
24
- function getFormattedStatusHistoryAxisLabel(rangeMs, timezone) {
25
- return function(value) {
26
- const dayMs = 86400000;
27
- const monthMs = 2629440000;
28
- const yearMs = 31536000000;
29
- const timeStamp = new Date(Number(value));
30
- // more than 5 years
31
- if (rangeMs > yearMs * 5) {
32
- return (0, _utils.formatWithTimeZone)(timeStamp, 'yyy', timezone);
33
- }
34
- // more than 2 years
35
- if (rangeMs > yearMs * 2) {
36
- return (0, _utils.formatWithTimeZone)(timeStamp, 'MMM yyy', timezone);
37
- }
38
- // between 5 days to 6 months
39
- if (rangeMs > dayMs * 10 && rangeMs < monthMs * 6) {
40
- return (0, _utils.formatWithTimeZone)(timeStamp, 'dd.MM', timezone); // 12-01
41
- }
42
- // between 2 and 10 days
43
- if (rangeMs > dayMs * 2 && rangeMs <= dayMs * 10) {
44
- return (0, _utils.formatWithTimeZone)(timeStamp, 'dd.MM HH:mm', timezone); // 12-01; // 12-01 12:30
45
- }
46
- return (0, _utils.formatWithTimeZone)(timeStamp, 'HH:mm', timezone);
47
- };
48
- }