@perses-dev/components 0.23.1 → 0.24.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 (152) hide show
  1. package/dist/ColorPicker/ColorPicker.d.ts +12 -0
  2. package/dist/ColorPicker/ColorPicker.d.ts.map +1 -0
  3. package/dist/ColorPicker/ColorPicker.js +78 -0
  4. package/dist/ColorPicker/ColorPicker.js.map +1 -0
  5. package/dist/ColorPicker/index.d.ts +2 -0
  6. package/dist/ColorPicker/index.d.ts.map +1 -0
  7. package/dist/ColorPicker/index.js +15 -0
  8. package/dist/ColorPicker/index.js.map +1 -0
  9. package/dist/EChart.d.ts +2 -2
  10. package/dist/EChart.d.ts.map +1 -1
  11. package/dist/EChart.js.map +1 -1
  12. package/dist/Legend/Legend.js +6 -9
  13. package/dist/Legend/Legend.js.map +1 -1
  14. package/dist/LineChart/LineChart.d.ts +4 -2
  15. package/dist/LineChart/LineChart.d.ts.map +1 -1
  16. package/dist/LineChart/LineChart.js +1 -1
  17. package/dist/LineChart/LineChart.js.map +1 -1
  18. package/dist/OptionsEditorLayout/OptionsEditorControl.js +1 -1
  19. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  20. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts +3 -2
  21. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -1
  22. package/dist/OptionsEditorLayout/OptionsEditorGroup.js +17 -5
  23. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  24. package/dist/StatChart/StatChart.d.ts +0 -1
  25. package/dist/StatChart/StatChart.d.ts.map +1 -1
  26. package/dist/StatChart/StatChart.js +1 -3
  27. package/dist/StatChart/StatChart.js.map +1 -1
  28. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts +4 -0
  29. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts.map +1 -0
  30. package/dist/ThresholdsEditor/ThresholdColorPicker.js +76 -0
  31. package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +1 -0
  32. package/dist/ThresholdsEditor/ThresholdInput.d.ts +13 -0
  33. package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -0
  34. package/dist/ThresholdsEditor/ThresholdInput.js +61 -0
  35. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -0
  36. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +10 -0
  37. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -0
  38. package/dist/ThresholdsEditor/ThresholdsEditor.js +215 -0
  39. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -0
  40. package/dist/ThresholdsEditor/index.d.ts +2 -0
  41. package/dist/ThresholdsEditor/index.d.ts.map +1 -0
  42. package/dist/ThresholdsEditor/index.js +15 -0
  43. package/dist/ThresholdsEditor/index.js.map +1 -0
  44. package/dist/TimeSeriesTooltip/focused-series.d.ts.map +1 -1
  45. package/dist/TimeSeriesTooltip/focused-series.js +3 -3
  46. package/dist/TimeSeriesTooltip/focused-series.js.map +1 -1
  47. package/dist/cjs/ColorPicker/ColorPicker.js +128 -0
  48. package/dist/cjs/{model/legend.test.js → ColorPicker/index.js} +11 -12
  49. package/dist/cjs/Legend/Legend.js +5 -8
  50. package/dist/cjs/LineChart/LineChart.js +40 -1
  51. package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +1 -1
  52. package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +22 -5
  53. package/dist/cjs/StatChart/StatChart.js +1 -41
  54. package/dist/cjs/ThresholdsEditor/ThresholdColorPicker.js +87 -0
  55. package/dist/cjs/ThresholdsEditor/ThresholdInput.js +72 -0
  56. package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +265 -0
  57. package/dist/{model/legend.test.js → cjs/ThresholdsEditor/index.js} +15 -14
  58. package/dist/cjs/TimeSeriesTooltip/focused-series.js +3 -3
  59. package/dist/cjs/index.js +2 -0
  60. package/dist/cjs/test-utils/theme.js +8 -0
  61. package/dist/cjs/theme/theme.js +5 -0
  62. package/dist/cjs/utils/theme-gen.js +8 -0
  63. package/dist/index.d.ts +2 -0
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +2 -0
  66. package/dist/index.js.map +1 -1
  67. package/dist/model/graph.d.ts +2 -2
  68. package/dist/model/graph.d.ts.map +1 -1
  69. package/dist/model/graph.js.map +1 -1
  70. package/dist/model/legend.d.ts +1 -1
  71. package/dist/model/legend.d.ts.map +1 -1
  72. package/dist/model/legend.js.map +1 -1
  73. package/dist/model/theme.d.ts +5 -0
  74. package/dist/model/theme.d.ts.map +1 -1
  75. package/dist/model/theme.js.map +1 -1
  76. package/dist/model/units/bytes.d.ts +1 -1
  77. package/dist/model/units/bytes.d.ts.map +1 -1
  78. package/dist/model/units/bytes.js.map +1 -1
  79. package/dist/model/units/decimal.d.ts +1 -1
  80. package/dist/model/units/decimal.d.ts.map +1 -1
  81. package/dist/model/units/decimal.js.map +1 -1
  82. package/dist/model/units/percent.d.ts +1 -1
  83. package/dist/model/units/percent.d.ts.map +1 -1
  84. package/dist/model/units/percent.js.map +1 -1
  85. package/dist/model/units/time.d.ts +1 -1
  86. package/dist/model/units/time.d.ts.map +1 -1
  87. package/dist/model/units/time.js.map +1 -1
  88. package/dist/model/units/types.d.ts +1 -1
  89. package/dist/model/units/types.d.ts.map +1 -1
  90. package/dist/model/units/types.js.map +1 -1
  91. package/dist/test-utils/theme.d.ts.map +1 -1
  92. package/dist/test-utils/theme.js +8 -0
  93. package/dist/test-utils/theme.js.map +1 -1
  94. package/dist/theme/theme.js +5 -0
  95. package/dist/theme/theme.js.map +1 -1
  96. package/dist/utils/theme-gen.d.ts.map +1 -1
  97. package/dist/utils/theme-gen.js +8 -0
  98. package/dist/utils/theme-gen.js.map +1 -1
  99. package/package.json +5 -3
  100. package/dist/InfoTooltip/InfoTooltip.test.d.ts +0 -2
  101. package/dist/InfoTooltip/InfoTooltip.test.d.ts.map +0 -1
  102. package/dist/InfoTooltip/InfoTooltip.test.js +0 -36
  103. package/dist/InfoTooltip/InfoTooltip.test.js.map +0 -1
  104. package/dist/LegendOptionsEditor/LegendOptionsEditor.test.d.ts +0 -2
  105. package/dist/LegendOptionsEditor/LegendOptionsEditor.test.d.ts.map +0 -1
  106. package/dist/LegendOptionsEditor/LegendOptionsEditor.test.js +0 -62
  107. package/dist/LegendOptionsEditor/LegendOptionsEditor.test.js.map +0 -1
  108. package/dist/StatChart/StatChart.test.d.ts +0 -2
  109. package/dist/StatChart/StatChart.test.d.ts.map +0 -1
  110. package/dist/StatChart/StatChart.test.js +0 -94
  111. package/dist/StatChart/StatChart.test.js.map +0 -1
  112. package/dist/TimeSeriesTooltip/SeriesInfo.test.d.ts +0 -2
  113. package/dist/TimeSeriesTooltip/SeriesInfo.test.d.ts.map +0 -1
  114. package/dist/TimeSeriesTooltip/SeriesInfo.test.js +0 -52
  115. package/dist/TimeSeriesTooltip/SeriesInfo.test.js.map +0 -1
  116. package/dist/TimeSeriesTooltip/TooltipContent.test.d.ts +0 -2
  117. package/dist/TimeSeriesTooltip/TooltipContent.test.d.ts.map +0 -1
  118. package/dist/TimeSeriesTooltip/TooltipContent.test.js +0 -78
  119. package/dist/TimeSeriesTooltip/TooltipContent.test.js.map +0 -1
  120. package/dist/TimeSeriesTooltip/focused-series.test.d.ts +0 -2
  121. package/dist/TimeSeriesTooltip/focused-series.test.d.ts.map +0 -1
  122. package/dist/TimeSeriesTooltip/focused-series.test.js +0 -93
  123. package/dist/TimeSeriesTooltip/focused-series.test.js.map +0 -1
  124. package/dist/UnitSelector/UnitSelector.test.d.ts +0 -2
  125. package/dist/UnitSelector/UnitSelector.test.d.ts.map +0 -1
  126. package/dist/UnitSelector/UnitSelector.test.js +0 -204
  127. package/dist/UnitSelector/UnitSelector.test.js.map +0 -1
  128. package/dist/cjs/InfoTooltip/InfoTooltip.test.js +0 -43
  129. package/dist/cjs/LegendOptionsEditor/LegendOptionsEditor.test.js +0 -69
  130. package/dist/cjs/StatChart/StatChart.test.js +0 -96
  131. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.test.js +0 -54
  132. package/dist/cjs/TimeSeriesTooltip/TooltipContent.test.js +0 -80
  133. package/dist/cjs/TimeSeriesTooltip/focused-series.test.js +0 -95
  134. package/dist/cjs/UnitSelector/UnitSelector.test.js +0 -211
  135. package/dist/cjs/model/units/units.test.js +0 -206
  136. package/dist/cjs/utils/format.test.js +0 -47
  137. package/dist/cjs/utils/theme-gen.test.js +0 -202
  138. package/dist/model/legend.test.d.ts +0 -2
  139. package/dist/model/legend.test.d.ts.map +0 -1
  140. package/dist/model/legend.test.js.map +0 -1
  141. package/dist/model/units/units.test.d.ts +0 -2
  142. package/dist/model/units/units.test.d.ts.map +0 -1
  143. package/dist/model/units/units.test.js +0 -204
  144. package/dist/model/units/units.test.js.map +0 -1
  145. package/dist/utils/format.test.d.ts +0 -2
  146. package/dist/utils/format.test.d.ts.map +0 -1
  147. package/dist/utils/format.test.js +0 -45
  148. package/dist/utils/format.test.js.map +0 -1
  149. package/dist/utils/theme-gen.test.d.ts +0 -2
  150. package/dist/utils/theme-gen.test.d.ts.map +0 -1
  151. package/dist/utils/theme-gen.test.js +0 -200
  152. package/dist/utils/theme-gen.test.js.map +0 -1
@@ -1,206 +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
- const _units = require("./units");
18
- describe('formatValue', ()=>{
19
- const tests = [
20
- {
21
- value: 100000,
22
- unit: {
23
- kind: 'Decimal'
24
- },
25
- expected: '100,000.00'
26
- },
27
- {
28
- value: 155900,
29
- unit: {
30
- kind: 'Decimal',
31
- decimal_places: 4
32
- },
33
- expected: '155,900.0000'
34
- },
35
- {
36
- value: 1000,
37
- unit: {
38
- kind: 'Decimal',
39
- decimal_places: 2,
40
- abbreviate: true
41
- },
42
- expected: '1K'
43
- },
44
- {
45
- value: 1590.878787,
46
- unit: {
47
- kind: 'Decimal',
48
- decimal_places: 3,
49
- abbreviate: true
50
- },
51
- expected: '1.591K'
52
- },
53
- {
54
- value: 0.123456789,
55
- unit: {
56
- kind: 'Decimal',
57
- decimal_places: 2,
58
- abbreviate: true
59
- },
60
- expected: '0.12'
61
- },
62
- {
63
- value: 0.123456789,
64
- unit: {
65
- kind: 'Decimal',
66
- decimal_places: 4,
67
- abbreviate: false
68
- },
69
- expected: '0.1235'
70
- },
71
- {
72
- value: -0.123456789,
73
- unit: {
74
- kind: 'Decimal',
75
- decimal_places: 3,
76
- abbreviate: true
77
- },
78
- expected: '-0.123'
79
- },
80
- {
81
- value: 0,
82
- unit: {
83
- kind: 'Decimal',
84
- decimal_places: 2,
85
- abbreviate: true
86
- },
87
- expected: '0'
88
- },
89
- {
90
- value: 10,
91
- unit: {
92
- kind: 'Percent'
93
- },
94
- expected: '10.00%'
95
- },
96
- {
97
- value: 50,
98
- unit: {
99
- kind: 'Percent',
100
- decimal_places: 0
101
- },
102
- expected: '50%'
103
- },
104
- {
105
- value: 0.1,
106
- unit: {
107
- kind: 'PercentDecimal'
108
- },
109
- expected: '10.00%'
110
- },
111
- {
112
- value: 100,
113
- unit: {
114
- kind: 'Bytes',
115
- decimal_places: 0,
116
- abbreviate: false
117
- },
118
- expected: '100 bytes'
119
- },
120
- {
121
- value: 100,
122
- unit: {
123
- kind: 'Bytes',
124
- decimal_places: -1,
125
- abbreviate: false
126
- },
127
- expected: '100 bytes'
128
- },
129
- {
130
- value: 225000,
131
- unit: {
132
- kind: 'Bytes',
133
- decimal_places: 0,
134
- abbreviate: true
135
- },
136
- expected: '220 KB'
137
- },
138
- {
139
- value: 505200,
140
- unit: {
141
- kind: 'Bytes'
142
- },
143
- expected: '505,200.00 bytes'
144
- },
145
- {
146
- value: 8000,
147
- unit: {
148
- kind: 'Milliseconds'
149
- },
150
- expected: '8,000.00 milliseconds'
151
- },
152
- {
153
- value: 200900,
154
- unit: {
155
- kind: 'Seconds'
156
- },
157
- expected: '200,900.00 seconds'
158
- },
159
- {
160
- value: 300,
161
- unit: {
162
- kind: 'Minutes'
163
- },
164
- expected: '300.00 minutes'
165
- },
166
- {
167
- value: 300,
168
- unit: {
169
- kind: 'Hours'
170
- },
171
- expected: '300.00 hours'
172
- },
173
- {
174
- value: 300,
175
- unit: {
176
- kind: 'Days'
177
- },
178
- expected: '300.00 days'
179
- },
180
- {
181
- value: 300,
182
- unit: {
183
- kind: 'Weeks'
184
- },
185
- expected: '300.00 weeks'
186
- },
187
- {
188
- value: 300,
189
- unit: {
190
- kind: 'Months'
191
- },
192
- expected: '300.00 months'
193
- },
194
- {
195
- value: 300,
196
- unit: {
197
- kind: 'Years'
198
- },
199
- expected: '300.00 years'
200
- }
201
- ];
202
- it.each(tests)('returns $expected when $value formatted as $unit', (args)=>{
203
- const { value , unit , expected } = args;
204
- expect((0, _units.formatValue)(value, unit)).toEqual(expected);
205
- });
206
- });
@@ -1,47 +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
- const _format = require("./format");
18
- const DATE = new Date(168523200000);
19
- const DATE_FORMAT_OPTIONS = {
20
- hour: 'numeric',
21
- minute: 'numeric',
22
- hourCycle: 'h23'
23
- };
24
- describe('formatWithTimeZone', ()=>{
25
- it('should format in Los Angeles timezone', ()=>{
26
- expect((0, _format.formatWithTimeZone)(DATE, 'yyyy-MM-dd HH:mm:ss', 'America/Los_Angeles')).toBe('1975-05-05 05:00:00');
27
- });
28
- it('should format in UTC timezone', ()=>{
29
- expect((0, _format.formatWithTimeZone)(DATE, 'yyyy-MM-dd HH:mm:ss', 'UTC')).toBe('1975-05-05 12:00:00');
30
- expect((0, _format.formatWithTimeZone)(DATE, 'yyyy-MM-dd HH:mm:ss', 'utc')).toBe('1975-05-05 12:00:00');
31
- });
32
- });
33
- describe('dateFormatOptionsWithTimeZone', ()=>{
34
- it('should format in Los Angeles timezone', ()=>{
35
- const dateFormatOptions = (0, _format.dateFormatOptionsWithTimeZone)(DATE_FORMAT_OPTIONS, 'America/Los_Angeles');
36
- expect(new Intl.DateTimeFormat(undefined, dateFormatOptions).format(DATE)).toBe('05:00');
37
- });
38
- it('should format in UTC timezone', ()=>{
39
- const dateFormatOptions = (0, _format.dateFormatOptionsWithTimeZone)(DATE_FORMAT_OPTIONS, 'utc');
40
- expect(new Intl.DateTimeFormat(undefined, dateFormatOptions).format(DATE)).toBe('12:00');
41
- });
42
- it('should use browser local timezone', ()=>{
43
- expect((0, _format.dateFormatOptionsWithTimeZone)(DATE_FORMAT_OPTIONS, 'browser').timeZone).toBeUndefined();
44
- expect((0, _format.dateFormatOptionsWithTimeZone)(DATE_FORMAT_OPTIONS, 'local').timeZone).toBeUndefined();
45
- expect((0, _format.dateFormatOptionsWithTimeZone)(DATE_FORMAT_OPTIONS).timeZone).toBeUndefined();
46
- });
47
- });
@@ -1,202 +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
- const _material = require("@mui/material");
18
- const _themeGen = require("./theme-gen");
19
- describe('generateChartsTheme', ()=>{
20
- const muiTheme = (0, _material.createTheme)({});
21
- const echartsThemeOverrides = {
22
- legend: {
23
- textStyle: {
24
- color: 'yellow'
25
- }
26
- },
27
- line: {
28
- showSymbol: true,
29
- smooth: true
30
- }
31
- };
32
- const chartsTheme = (0, _themeGen.generateChartsTheme)(muiTheme, echartsThemeOverrides);
33
- it('should return perses specific charts theme from converted MUI theme', ()=>{
34
- expect(chartsTheme).toMatchInlineSnapshot(`
35
- Object {
36
- "container": Object {
37
- "padding": Object {
38
- "default": 12,
39
- },
40
- },
41
- "echartsTheme": Object {
42
- "bar": Object {
43
- "barMaxWidth": 150,
44
- "itemStyle": Object {
45
- "borderColor": "#e0e0e0",
46
- "borderWidth": 0,
47
- },
48
- },
49
- "categoryAxis": Object {
50
- "axisLabel": Object {
51
- "color": "rgba(0, 0, 0, 0.87)",
52
- "margin": 15,
53
- "show": true,
54
- },
55
- "axisLine": Object {
56
- "lineStyle": Object {
57
- "color": "#757575",
58
- },
59
- "show": true,
60
- },
61
- "axisTick": Object {
62
- "length": 6,
63
- "lineStyle": Object {
64
- "color": "#757575",
65
- },
66
- "show": false,
67
- },
68
- "show": true,
69
- "splitArea": Object {
70
- "areaStyle": Object {
71
- "color": Array [
72
- "#e0e0e0",
73
- ],
74
- },
75
- "show": false,
76
- },
77
- "splitLine": Object {
78
- "lineStyle": Object {
79
- "color": "#e0e0e0",
80
- "opacity": 0.6,
81
- "width": 0.5,
82
- },
83
- "show": true,
84
- },
85
- },
86
- "color": Array [
87
- "#8dd3c7",
88
- "#bebada",
89
- "#fb8072",
90
- "#80b1d3",
91
- "#fdb462",
92
- ],
93
- "gauge": Object {
94
- "detail": Object {
95
- "fontSize": 18,
96
- "fontWeight": 600,
97
- "valueAnimation": false,
98
- },
99
- "splitLine": Object {
100
- "distance": 0,
101
- "length": 4,
102
- "lineStyle": Object {
103
- "width": 1,
104
- },
105
- },
106
- "splitNumber": 12,
107
- },
108
- "grid": Object {
109
- "bottom": 0,
110
- "containLabel": true,
111
- "left": 20,
112
- "right": 20,
113
- "top": 5,
114
- },
115
- "legend": Object {
116
- "orient": "horizontal",
117
- "pageIconColor": "rgba(0, 0, 0, 0.54)",
118
- "pageIconInactiveColor": "rgba(0, 0, 0, 0.26)",
119
- "pageTextStyle": Object {
120
- "color": "#757575",
121
- },
122
- "textStyle": Object {
123
- "color": "yellow",
124
- },
125
- },
126
- "line": Object {
127
- "emphasis": Object {
128
- "lineStyle": Object {
129
- "width": 1.5,
130
- },
131
- },
132
- "lineStyle": Object {
133
- "width": 1,
134
- },
135
- "showSymbol": true,
136
- "smooth": true,
137
- "symbol": "circle",
138
- "symbolSize": 4,
139
- },
140
- "textStyle": Object {
141
- "color": "rgba(0, 0, 0, 0.87)",
142
- "fontFamily": "\\"Roboto\\", \\"Helvetica\\", \\"Arial\\", sans-serif",
143
- "fontSize": 12,
144
- },
145
- "title": Object {
146
- "show": false,
147
- },
148
- "toolbox": Object {
149
- "iconStyle": Object {
150
- "borderColor": "rgba(0, 0, 0, 0.87)",
151
- },
152
- "right": 10,
153
- "show": true,
154
- "top": 10,
155
- },
156
- "tooltip": Object {},
157
- "valueAxis": Object {
158
- "axisLabel": Object {
159
- "color": "rgba(0, 0, 0, 0.87)",
160
- "margin": 12,
161
- },
162
- "axisLine": Object {
163
- "show": false,
164
- },
165
- "show": true,
166
- "splitLine": Object {
167
- "lineStyle": Object {
168
- "color": "#e0e0e0",
169
- "opacity": 0.6,
170
- "width": 0.5,
171
- },
172
- "show": true,
173
- },
174
- },
175
- },
176
- "noDataOption": Object {
177
- "title": Object {
178
- "left": "center",
179
- "show": true,
180
- "text": "No data",
181
- "textStyle": Object {
182
- "color": "rgba(0, 0, 0, 0.87)",
183
- "fontSize": 16,
184
- "fontWeight": 400,
185
- },
186
- "top": "center",
187
- },
188
- "xAxis": Object {
189
- "show": false,
190
- },
191
- "yAxis": Object {
192
- "show": false,
193
- },
194
- },
195
- "sparkline": Object {
196
- "color": "#1976d2",
197
- "width": 2,
198
- },
199
- }
200
- `);
201
- });
202
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=legend.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"legend.test.d.ts","sourceRoot":"","sources":["../../src/model/legend.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/model/legend.test.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 { LegendOptions, validateLegendSpec } from './legend';\n\ndescribe('validateLegendSpec', () => {\n it('should check if a legend spec is valid', () => {\n const invalidLegend = { position: 'bottom' };\n expect(validateLegendSpec(invalidLegend as LegendOptions)).toEqual(false);\n expect(validateLegendSpec({ position: 'Bottom' })).toEqual(true);\n expect(validateLegendSpec(undefined)).toEqual(true);\n });\n});\n"],"names":["validateLegendSpec","describe","it","invalidLegend","position","expect","toEqual","undefined"],"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,SAAwBA,kBAAkB,QAAQ,UAAU,CAAC;AAE7DC,QAAQ,CAAC,oBAAoB,EAAE,IAAM;IACnCC,EAAE,CAAC,wCAAwC,EAAE,IAAM;QACjD,MAAMC,aAAa,GAAG;YAAEC,QAAQ,EAAE,QAAQ;SAAE,AAAC;QAC7CC,MAAM,CAACL,kBAAkB,CAACG,aAAa,CAAkB,CAAC,CAACG,OAAO,CAAC,KAAK,CAAC,CAAC;QAC1ED,MAAM,CAACL,kBAAkB,CAAC;YAAEI,QAAQ,EAAE,QAAQ;SAAE,CAAC,CAAC,CAACE,OAAO,CAAC,IAAI,CAAC,CAAC;QACjED,MAAM,CAACL,kBAAkB,CAACO,SAAS,CAAC,CAAC,CAACD,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=units.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"units.test.d.ts","sourceRoot":"","sources":["../../../src/model/units/units.test.ts"],"names":[],"mappings":""}
@@ -1,204 +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
- import { formatValue } from './units';
14
- describe('formatValue', ()=>{
15
- const tests = [
16
- {
17
- value: 100000,
18
- unit: {
19
- kind: 'Decimal'
20
- },
21
- expected: '100,000.00'
22
- },
23
- {
24
- value: 155900,
25
- unit: {
26
- kind: 'Decimal',
27
- decimal_places: 4
28
- },
29
- expected: '155,900.0000'
30
- },
31
- {
32
- value: 1000,
33
- unit: {
34
- kind: 'Decimal',
35
- decimal_places: 2,
36
- abbreviate: true
37
- },
38
- expected: '1K'
39
- },
40
- {
41
- value: 1590.878787,
42
- unit: {
43
- kind: 'Decimal',
44
- decimal_places: 3,
45
- abbreviate: true
46
- },
47
- expected: '1.591K'
48
- },
49
- {
50
- value: 0.123456789,
51
- unit: {
52
- kind: 'Decimal',
53
- decimal_places: 2,
54
- abbreviate: true
55
- },
56
- expected: '0.12'
57
- },
58
- {
59
- value: 0.123456789,
60
- unit: {
61
- kind: 'Decimal',
62
- decimal_places: 4,
63
- abbreviate: false
64
- },
65
- expected: '0.1235'
66
- },
67
- {
68
- value: -0.123456789,
69
- unit: {
70
- kind: 'Decimal',
71
- decimal_places: 3,
72
- abbreviate: true
73
- },
74
- expected: '-0.123'
75
- },
76
- {
77
- value: 0,
78
- unit: {
79
- kind: 'Decimal',
80
- decimal_places: 2,
81
- abbreviate: true
82
- },
83
- expected: '0'
84
- },
85
- {
86
- value: 10,
87
- unit: {
88
- kind: 'Percent'
89
- },
90
- expected: '10.00%'
91
- },
92
- {
93
- value: 50,
94
- unit: {
95
- kind: 'Percent',
96
- decimal_places: 0
97
- },
98
- expected: '50%'
99
- },
100
- {
101
- value: 0.1,
102
- unit: {
103
- kind: 'PercentDecimal'
104
- },
105
- expected: '10.00%'
106
- },
107
- {
108
- value: 100,
109
- unit: {
110
- kind: 'Bytes',
111
- decimal_places: 0,
112
- abbreviate: false
113
- },
114
- expected: '100 bytes'
115
- },
116
- {
117
- value: 100,
118
- unit: {
119
- kind: 'Bytes',
120
- decimal_places: -1,
121
- abbreviate: false
122
- },
123
- expected: '100 bytes'
124
- },
125
- {
126
- value: 225000,
127
- unit: {
128
- kind: 'Bytes',
129
- decimal_places: 0,
130
- abbreviate: true
131
- },
132
- expected: '220 KB'
133
- },
134
- {
135
- value: 505200,
136
- unit: {
137
- kind: 'Bytes'
138
- },
139
- expected: '505,200.00 bytes'
140
- },
141
- {
142
- value: 8000,
143
- unit: {
144
- kind: 'Milliseconds'
145
- },
146
- expected: '8,000.00 milliseconds'
147
- },
148
- {
149
- value: 200900,
150
- unit: {
151
- kind: 'Seconds'
152
- },
153
- expected: '200,900.00 seconds'
154
- },
155
- {
156
- value: 300,
157
- unit: {
158
- kind: 'Minutes'
159
- },
160
- expected: '300.00 minutes'
161
- },
162
- {
163
- value: 300,
164
- unit: {
165
- kind: 'Hours'
166
- },
167
- expected: '300.00 hours'
168
- },
169
- {
170
- value: 300,
171
- unit: {
172
- kind: 'Days'
173
- },
174
- expected: '300.00 days'
175
- },
176
- {
177
- value: 300,
178
- unit: {
179
- kind: 'Weeks'
180
- },
181
- expected: '300.00 weeks'
182
- },
183
- {
184
- value: 300,
185
- unit: {
186
- kind: 'Months'
187
- },
188
- expected: '300.00 months'
189
- },
190
- {
191
- value: 300,
192
- unit: {
193
- kind: 'Years'
194
- },
195
- expected: '300.00 years'
196
- }
197
- ];
198
- it.each(tests)('returns $expected when $value formatted as $unit', (args)=>{
199
- const { value , unit , expected } = args;
200
- expect(formatValue(value, unit)).toEqual(expected);
201
- });
202
- });
203
-
204
- //# sourceMappingURL=units.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/model/units/units.test.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 { formatValue, UnitOptions } from './units';\n\ninterface UnitTestCase {\n value: number;\n unit: UnitOptions;\n expected: string;\n}\n\ndescribe('formatValue', () => {\n const tests: UnitTestCase[] = [\n {\n value: 100000,\n unit: { kind: 'Decimal' },\n expected: '100,000.00',\n },\n {\n value: 155900,\n unit: { kind: 'Decimal', decimal_places: 4 },\n expected: '155,900.0000',\n },\n {\n value: 1000,\n unit: { kind: 'Decimal', decimal_places: 2, abbreviate: true },\n expected: '1K',\n },\n {\n value: 1590.878787,\n unit: { kind: 'Decimal', decimal_places: 3, abbreviate: true },\n expected: '1.591K',\n },\n {\n value: 0.123456789,\n unit: { kind: 'Decimal', decimal_places: 2, abbreviate: true },\n expected: '0.12',\n },\n {\n value: 0.123456789,\n unit: { kind: 'Decimal', decimal_places: 4, abbreviate: false },\n expected: '0.1235',\n },\n {\n value: -0.123456789,\n unit: { kind: 'Decimal', decimal_places: 3, abbreviate: true },\n expected: '-0.123',\n },\n {\n value: 0,\n unit: { kind: 'Decimal', decimal_places: 2, abbreviate: true },\n expected: '0',\n },\n {\n value: 10,\n unit: { kind: 'Percent' },\n expected: '10.00%',\n },\n {\n value: 50,\n unit: { kind: 'Percent', decimal_places: 0 },\n expected: '50%',\n },\n {\n value: 0.1,\n unit: { kind: 'PercentDecimal' },\n expected: '10.00%',\n },\n {\n value: 100,\n unit: { kind: 'Bytes', decimal_places: 0, abbreviate: false },\n expected: '100 bytes',\n },\n {\n value: 100,\n unit: { kind: 'Bytes', decimal_places: -1, abbreviate: false },\n expected: '100 bytes',\n },\n {\n value: 225000,\n unit: { kind: 'Bytes', decimal_places: 0, abbreviate: true },\n expected: '220 KB',\n },\n {\n value: 505200,\n unit: { kind: 'Bytes' },\n expected: '505,200.00 bytes',\n },\n {\n value: 8000,\n unit: { kind: 'Milliseconds' },\n expected: '8,000.00 milliseconds',\n },\n {\n value: 200900,\n unit: { kind: 'Seconds' },\n expected: '200,900.00 seconds',\n },\n {\n value: 300,\n unit: { kind: 'Minutes' },\n expected: '300.00 minutes',\n },\n {\n value: 300,\n unit: { kind: 'Hours' },\n expected: '300.00 hours',\n },\n {\n value: 300,\n unit: { kind: 'Days' },\n expected: '300.00 days',\n },\n {\n value: 300,\n unit: { kind: 'Weeks' },\n expected: '300.00 weeks',\n },\n {\n value: 300,\n unit: { kind: 'Months' },\n expected: '300.00 months',\n },\n {\n value: 300,\n unit: { kind: 'Years' },\n expected: '300.00 years',\n },\n ];\n it.each(tests)('returns $expected when $value formatted as $unit', (args: UnitTestCase) => {\n const { value, unit, expected } = args;\n expect(formatValue(value, unit)).toEqual(expected);\n });\n});\n"],"names":["formatValue","describe","tests","value","unit","kind","expected","decimal_places","abbreviate","it","each","args","expect","toEqual"],"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,WAAW,QAAqB,SAAS,CAAC;AAQnDC,QAAQ,CAAC,aAAa,EAAE,IAAM;IAC5B,MAAMC,KAAK,GAAmB;QAC5B;YACEC,KAAK,EAAE,MAAM;YACbC,IAAI,EAAE;gBAAEC,IAAI,EAAE,SAAS;aAAE;YACzBC,QAAQ,EAAE,YAAY;SACvB;QACD;YACEH,KAAK,EAAE,MAAM;YACbC,IAAI,EAAE;gBAAEC,IAAI,EAAE,SAAS;gBAAEE,cAAc,EAAE,CAAC;aAAE;YAC5CD,QAAQ,EAAE,cAAc;SACzB;QACD;YACEH,KAAK,EAAE,IAAI;YACXC,IAAI,EAAE;gBAAEC,IAAI,EAAE,SAAS;gBAAEE,cAAc,EAAE,CAAC;gBAAEC,UAAU,EAAE,IAAI;aAAE;YAC9DF,QAAQ,EAAE,IAAI;SACf;QACD;YACEH,KAAK,EAAE,WAAW;YAClBC,IAAI,EAAE;gBAAEC,IAAI,EAAE,SAAS;gBAAEE,cAAc,EAAE,CAAC;gBAAEC,UAAU,EAAE,IAAI;aAAE;YAC9DF,QAAQ,EAAE,QAAQ;SACnB;QACD;YACEH,KAAK,EAAE,WAAW;YAClBC,IAAI,EAAE;gBAAEC,IAAI,EAAE,SAAS;gBAAEE,cAAc,EA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