@perses-dev/bar-chart-plugin 0.13.0 → 0.14.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/__mf/js/BarChart.777a5fe9.js +7 -0
  2. package/__mf/js/async/121.0dfa8a56.js +2 -0
  3. package/__mf/js/async/138.a47c7fc8.js +2 -0
  4. package/__mf/js/async/192.e523747d.js +1 -0
  5. package/__mf/js/async/235.5bb676bf.js +1 -0
  6. package/__mf/js/async/274.becf0c4e.js +2 -0
  7. package/__mf/js/async/319.a1a08706.js +1 -0
  8. package/__mf/js/async/356.4a2d6a5d.js +1 -0
  9. package/__mf/js/async/377.6b67c9b8.js +1 -0
  10. package/__mf/js/async/392.ce5748af.js +2 -0
  11. package/__mf/js/async/407.f9cff9c5.js +4 -0
  12. package/__mf/js/async/407.f9cff9c5.js.LICENSE.txt +9 -0
  13. package/__mf/js/async/435.4802f945.js +1 -0
  14. package/__mf/js/async/458.dd052408.js +1 -0
  15. package/__mf/js/async/470.6bd33fa1.js +2 -0
  16. package/__mf/js/async/496.46cf1305.js +1 -0
  17. package/__mf/js/async/587.e4d2ed78.js +1 -0
  18. package/__mf/js/async/588.ca7f0375.js +1 -0
  19. package/__mf/js/async/603.6e4d4c2a.js +1 -0
  20. package/__mf/js/async/616.6263efeb.js +1 -0
  21. package/__mf/js/async/71.5f1bab20.js +1 -0
  22. package/__mf/js/async/720.e068b3e4.js +101 -0
  23. package/__mf/js/async/77.d762eaa0.js +1 -0
  24. package/__mf/js/async/788.e72a42a8.js +43 -0
  25. package/__mf/js/async/{815.60db8972.js.LICENSE.txt → 788.e72a42a8.js.LICENSE.txt} +41 -1
  26. package/__mf/js/async/823.2a2b516e.js +10 -0
  27. package/__mf/js/async/854.49d186a1.js +1 -0
  28. package/__mf/js/async/873.9b3f6f36.js +1 -0
  29. package/__mf/js/async/934.04010fe7.js +2 -0
  30. package/__mf/js/async/941.88203ba1.js +2 -0
  31. package/__mf/js/async/963.36fb71d2.js +1 -0
  32. package/__mf/js/async/968.66f07975.js +1 -0
  33. package/__mf/js/async/977.b3f21ee5.js +1 -0
  34. package/__mf/js/async/978.d27fe59a.js +1 -0
  35. package/__mf/js/async/__federation_expose_BarChart.07c26459.js +1 -0
  36. package/__mf/js/async/lib-router.a4768e7d.js +2 -0
  37. package/__mf/js/main.e614feb4.js +7 -0
  38. package/lib/BarChart.d.ts +3 -3
  39. package/lib/BarChart.d.ts.map +1 -1
  40. package/lib/BarChart.js +4 -4
  41. package/lib/BarChart.js.map +1 -1
  42. package/lib/BarChartBase.d.ts +4 -2
  43. package/lib/BarChartBase.d.ts.map +1 -1
  44. package/lib/BarChartBase.js +34 -15
  45. package/lib/BarChartBase.js.map +1 -1
  46. package/lib/BarChartExportAction.d.ts +1 -1
  47. package/lib/BarChartExportAction.d.ts.map +1 -1
  48. package/lib/BarChartExportAction.js +5 -5
  49. package/lib/BarChartExportAction.js.map +1 -1
  50. package/lib/BarChartOptionsEditorSettings.d.ts +2 -2
  51. package/lib/BarChartOptionsEditorSettings.d.ts.map +1 -1
  52. package/lib/BarChartOptionsEditorSettings.js +87 -16
  53. package/lib/BarChartOptionsEditorSettings.js.map +1 -1
  54. package/lib/BarChartPanel.d.ts +4 -4
  55. package/lib/BarChartPanel.d.ts.map +1 -1
  56. package/lib/BarChartPanel.js +11 -10
  57. package/lib/BarChartPanel.js.map +1 -1
  58. package/lib/bar-chart-model.d.ts +18 -3
  59. package/lib/bar-chart-model.d.ts.map +1 -1
  60. package/lib/bar-chart-model.js +4 -2
  61. package/lib/bar-chart-model.js.map +1 -1
  62. package/lib/bootstrap.js +2 -2
  63. package/lib/getPluginModule.d.ts +1 -1
  64. package/lib/getPluginModule.d.ts.map +1 -1
  65. package/lib/getPluginModule.js +3 -1
  66. package/lib/getPluginModule.js.map +1 -1
  67. package/lib/index-federation.js +1 -1
  68. package/lib/index.js +5 -5
  69. package/lib/index.js.map +1 -1
  70. package/lib/setup-tests.d.ts +1 -1
  71. package/lib/setup-tests.d.ts.map +1 -1
  72. package/lib/setup-tests.js +2 -2
  73. package/lib/setup-tests.js.map +1 -1
  74. package/lib/tresholds.d.ts +1 -1
  75. package/lib/tresholds.d.ts.map +1 -1
  76. package/lib/tresholds.js +1 -1
  77. package/lib/tresholds.js.map +1 -1
  78. package/lib/utils.d.ts +8 -2
  79. package/lib/utils.d.ts.map +1 -1
  80. package/lib/utils.js +22 -3
  81. package/lib/utils.js.map +1 -1
  82. package/mf-manifest.json +40 -41
  83. package/mf-stats.json +40 -41
  84. package/package.json +10 -10
  85. package/__mf/js/BarChart.9e1e78c7.js +0 -7
  86. package/__mf/js/async/121.473596c1.js +0 -2
  87. package/__mf/js/async/177.3e3ea369.js +0 -1
  88. package/__mf/js/async/187.0c10a71e.js +0 -7
  89. package/__mf/js/async/187.0c10a71e.js.LICENSE.txt +0 -39
  90. package/__mf/js/async/192.d5754c56.js +0 -1
  91. package/__mf/js/async/235.b9e83b0f.js +0 -1
  92. package/__mf/js/async/274.3b869914.js +0 -2
  93. package/__mf/js/async/356.4b7b13a4.js +0 -1
  94. package/__mf/js/async/377.1e6cd99f.js +0 -1
  95. package/__mf/js/async/392.43a49d02.js +0 -2
  96. package/__mf/js/async/435.7b8a2474.js +0 -1
  97. package/__mf/js/async/458.e0bfe246.js +0 -1
  98. package/__mf/js/async/46.822ac417.js +0 -101
  99. package/__mf/js/async/470.bbaeb6f6.js +0 -2
  100. package/__mf/js/async/496.b1d86a71.js +0 -1
  101. package/__mf/js/async/546.966246a4.js +0 -24
  102. package/__mf/js/async/546.966246a4.js.LICENSE.txt +0 -19
  103. package/__mf/js/async/568.93423f6b.js +0 -1
  104. package/__mf/js/async/587.19607cd0.js +0 -1
  105. package/__mf/js/async/588.3e2e88e6.js +0 -1
  106. package/__mf/js/async/603.73790c72.js +0 -1
  107. package/__mf/js/async/616.673776b4.js +0 -1
  108. package/__mf/js/async/71.8dde0897.js +0 -1
  109. package/__mf/js/async/77.64992029.js +0 -1
  110. package/__mf/js/async/815.60db8972.js +0 -39
  111. package/__mf/js/async/823.55761759.js +0 -10
  112. package/__mf/js/async/854.8910fbf0.js +0 -1
  113. package/__mf/js/async/873.2961fe42.js +0 -1
  114. package/__mf/js/async/934.e8708047.js +0 -2
  115. package/__mf/js/async/941.b9c9bdfe.js +0 -2
  116. package/__mf/js/async/963.e557410b.js +0 -1
  117. package/__mf/js/async/968.0da0003e.js +0 -1
  118. package/__mf/js/async/977.4f77cf46.js +0 -1
  119. package/__mf/js/async/978.83c86840.js +0 -1
  120. package/__mf/js/async/__federation_expose_BarChart.cf3b83b6.js +0 -1
  121. package/__mf/js/async/lib-router.9c050a7f.js +0 -2
  122. package/__mf/js/main.8c45ef82.js +0 -7
  123. package/lib/cjs/BarChart.js +0 -45
  124. package/lib/cjs/BarChartBase.js +0 -232
  125. package/lib/cjs/BarChartExportAction.js +0 -124
  126. package/lib/cjs/BarChartOptionsEditorSettings.js +0 -180
  127. package/lib/cjs/BarChartPanel.js +0 -138
  128. package/lib/cjs/bar-chart-model.js +0 -66
  129. package/lib/cjs/bootstrap.js +0 -26
  130. package/lib/cjs/env.d.js +0 -14
  131. package/lib/cjs/getPluginModule.js +0 -39
  132. package/lib/cjs/index-federation.js +0 -55
  133. package/lib/cjs/index.js +0 -40
  134. package/lib/cjs/setup-tests.js +0 -19
  135. package/lib/cjs/tresholds.js +0 -77
  136. package/lib/cjs/utils.js +0 -72
  137. /package/__mf/css/async/{187.85c2cbf6.css → 788.85c2cbf6.css} +0 -0
  138. /package/__mf/js/async/{121.473596c1.js.LICENSE.txt → 121.0dfa8a56.js.LICENSE.txt} +0 -0
  139. /package/__mf/js/async/{274.3b869914.js.LICENSE.txt → 274.becf0c4e.js.LICENSE.txt} +0 -0
  140. /package/__mf/js/async/{392.43a49d02.js.LICENSE.txt → 392.ce5748af.js.LICENSE.txt} +0 -0
  141. /package/__mf/js/async/{470.bbaeb6f6.js.LICENSE.txt → 470.6bd33fa1.js.LICENSE.txt} +0 -0
  142. /package/__mf/js/async/{823.55761759.js.LICENSE.txt → 823.2a2b516e.js.LICENSE.txt} +0 -0
  143. /package/__mf/js/async/{934.e8708047.js.LICENSE.txt → 934.04010fe7.js.LICENSE.txt} +0 -0
  144. /package/__mf/js/async/{941.b9c9bdfe.js.LICENSE.txt → 941.88203ba1.js.LICENSE.txt} +0 -0
  145. /package/__mf/js/async/{lib-router.9c050a7f.js.LICENSE.txt → lib-router.a4768e7d.js.LICENSE.txt} +0 -0
package/lib/cjs/index.js DELETED
@@ -1,40 +0,0 @@
1
- // Copyright The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "getPluginModule", {
18
- enumerable: true,
19
- get: function() {
20
- return _getPluginModule.getPluginModule;
21
- }
22
- });
23
- _export_star(require("./bar-chart-model"), exports);
24
- _export_star(require("./BarChart"), exports);
25
- _export_star(require("./BarChartOptionsEditorSettings"), exports);
26
- const _getPluginModule = require("./getPluginModule");
27
- _export_star(require("./utils"), exports);
28
- function _export_star(from, to) {
29
- Object.keys(from).forEach(function(k) {
30
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
31
- Object.defineProperty(to, k, {
32
- enumerable: true,
33
- get: function() {
34
- return from[k];
35
- }
36
- });
37
- }
38
- });
39
- return from;
40
- }
@@ -1,19 +0,0 @@
1
- // Copyright The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- require("@testing-library/jest-dom");
18
- // Always mock e-charts during tests since we don't have a proper canvas in jsdom
19
- jest.mock('echarts/core');
@@ -1,77 +0,0 @@
1
- // Copyright The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the \"License\");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an \"AS IS\" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- function _export(target, all) {
18
- for(var name in all)Object.defineProperty(target, name, {
19
- enumerable: true,
20
- get: Object.getOwnPropertyDescriptor(all, name).get
21
- });
22
- }
23
- _export(exports, {
24
- get convertThresholds () {
25
- return convertThresholds;
26
- },
27
- get defaultThresholdInput () {
28
- return defaultThresholdInput;
29
- }
30
- });
31
- const _zip = /*#__PURE__*/ _interop_require_default(require("lodash/zip"));
32
- function _interop_require_default(obj) {
33
- return obj && obj.__esModule ? obj : {
34
- default: obj
35
- };
36
- }
37
- const defaultThresholdInput = {
38
- steps: [
39
- {
40
- value: 0
41
- }
42
- ]
43
- };
44
- function convertThresholds(thresholds, unit, max, palette) {
45
- const defaultThresholdColor = thresholds.defaultColor ?? palette.defaultColor;
46
- const defaultThresholdSteps = [
47
- [
48
- 0,
49
- defaultThresholdColor
50
- ]
51
- ];
52
- if (thresholds.steps !== undefined) {
53
- // https://echarts.apache.org/en/option.html#series-gauge.axisLine.lineStyle.color
54
- // color segments must be decimal between 0 and 1
55
- const segmentMax = 1;
56
- const valuesArr = thresholds.steps.map((step)=>{
57
- if (thresholds.mode === 'percent') {
58
- return step.value / 100;
59
- }
60
- return step.value / max;
61
- });
62
- valuesArr.push(segmentMax);
63
- const colorsArr = thresholds.steps.map((step, index)=>step.color ?? palette.palette[index]);
64
- colorsArr.unshift(defaultThresholdColor);
65
- const zippedArr = (0, _zip.default)(valuesArr, colorsArr);
66
- return zippedArr.map((elem)=>{
67
- const convertedValues = elem[0] ?? segmentMax;
68
- const convertedColors = elem[1] ?? defaultThresholdColor;
69
- return [
70
- convertedValues,
71
- convertedColors
72
- ];
73
- });
74
- } else {
75
- return defaultThresholdSteps;
76
- }
77
- }
package/lib/cjs/utils.js DELETED
@@ -1,72 +0,0 @@
1
- // Copyright The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- function _export(target, all) {
18
- for(var name in all)Object.defineProperty(target, name, {
19
- enumerable: true,
20
- get: Object.getOwnPropertyDescriptor(all, name).get
21
- });
22
- }
23
- _export(exports, {
24
- get calculatePercentages () {
25
- return calculatePercentages;
26
- },
27
- get sortSeriesData () {
28
- return sortSeriesData;
29
- }
30
- });
31
- const _barchartmodel = require("./bar-chart-model");
32
- function calculatePercentages(data) {
33
- const sum = data.reduce((accumulator, { value })=>accumulator + (value ?? 0), 0);
34
- return data.map((seriesData)=>{
35
- const percentage = (seriesData.value ?? 0) / sum * 100;
36
- return {
37
- ...seriesData,
38
- value: percentage
39
- };
40
- });
41
- }
42
- function sortSeriesData(data, sortOrder = _barchartmodel.DEFAULT_SORT) {
43
- if (sortOrder === 'asc') {
44
- // sort in ascending order by value
45
- return data.sort((a, b)=>{
46
- if (a.value === null) {
47
- return 1;
48
- }
49
- if (b.value === null) {
50
- return -1;
51
- }
52
- if (a.value === b.value) {
53
- return 0;
54
- }
55
- return a.value < b.value ? 1 : -1;
56
- });
57
- } else {
58
- // sort in descending order by value
59
- return data.sort((a, b)=>{
60
- if (a.value === null) {
61
- return -1;
62
- }
63
- if (b.value === null) {
64
- return 1;
65
- }
66
- if (a.value === b.value) {
67
- return 0;
68
- }
69
- return a.value < b.value ? -1 : 1;
70
- });
71
- }
72
- }