@perses-dev/pie-chart-plugin 0.14.0 → 0.15.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 (123) hide show
  1. package/__mf/js/{PieChart.a102eecb.js → PieChart.5c25af4b.js} +4 -4
  2. package/__mf/js/async/121.3f985aad.js +2 -0
  3. package/__mf/js/async/192.e77db572.js +1 -0
  4. package/__mf/js/async/2.0d6a1680.js +1 -0
  5. package/__mf/js/async/235.2bb8ba2f.js +1 -0
  6. package/__mf/js/async/237.418111c6.js +2 -0
  7. package/__mf/js/async/274.0fa32f07.js +2 -0
  8. package/__mf/js/async/356.b5aee61d.js +1 -0
  9. package/__mf/js/async/376.d72b6d45.js +110 -0
  10. package/__mf/js/async/392.311100c7.js +2 -0
  11. package/__mf/js/async/407.2557a182.js +4 -0
  12. package/__mf/js/async/407.2557a182.js.LICENSE.txt +9 -0
  13. package/__mf/js/async/469.a5d124bd.js +1 -0
  14. package/__mf/js/async/470.7f042d46.js +2 -0
  15. package/__mf/js/async/496.ea85fb9d.js +1 -0
  16. package/__mf/js/async/554.ffbb20fd.js +2 -0
  17. package/__mf/js/async/587.fceb5f76.js +1 -0
  18. package/__mf/js/async/588.a2bbd130.js +1 -0
  19. package/__mf/js/async/603.312da395.js +1 -0
  20. package/__mf/js/async/616.cebd9b21.js +1 -0
  21. package/__mf/js/async/66.77308b27.js +1 -0
  22. package/__mf/js/async/71.87ecdff0.js +1 -0
  23. package/__mf/js/async/77.9d431bfa.js +1 -0
  24. package/__mf/js/async/788.cf73b628.js +43 -0
  25. package/__mf/js/async/{576.9e075806.js.LICENSE.txt → 788.cf73b628.js.LICENSE.txt} +41 -1
  26. package/__mf/js/async/873.48c1c973.js +1 -0
  27. package/__mf/js/async/941.1d0acff2.js +2 -0
  28. package/__mf/js/async/968.69813416.js +1 -0
  29. package/__mf/js/async/978.d64118ad.js +1 -0
  30. package/__mf/js/async/__federation_expose_PieChart.2e3c97fd.js +4 -0
  31. package/__mf/js/async/lib-router.64f2eab9.js +2 -0
  32. package/__mf/js/{main.bb1593b7.js → main.fa92d32d.js} +2 -2
  33. package/lib/PieChart.d.ts +3 -3
  34. package/lib/PieChart.d.ts.map +1 -1
  35. package/lib/PieChart.js +3 -3
  36. package/lib/PieChart.js.map +1 -1
  37. package/lib/PieChartBase.d.ts +2 -2
  38. package/lib/PieChartBase.d.ts.map +1 -1
  39. package/lib/PieChartBase.js +8 -8
  40. package/lib/PieChartBase.js.map +1 -1
  41. package/lib/PieChartOptionsEditorSettings.d.ts +2 -2
  42. package/lib/PieChartOptionsEditorSettings.d.ts.map +1 -1
  43. package/lib/PieChartOptionsEditorSettings.js +13 -10
  44. package/lib/PieChartOptionsEditorSettings.js.map +1 -1
  45. package/lib/PieChartPanel.d.ts +4 -4
  46. package/lib/PieChartPanel.d.ts.map +1 -1
  47. package/lib/PieChartPanel.js +9 -9
  48. package/lib/PieChartPanel.js.map +1 -1
  49. package/lib/bootstrap.js +2 -2
  50. package/lib/colors.js +3 -3
  51. package/lib/colors.js.map +1 -1
  52. package/lib/getPluginModule.d.ts +1 -1
  53. package/lib/getPluginModule.d.ts.map +1 -1
  54. package/lib/getPluginModule.js +3 -1
  55. package/lib/getPluginModule.js.map +1 -1
  56. package/lib/index-federation.js +1 -1
  57. package/lib/index.js +6 -6
  58. package/lib/index.js.map +1 -1
  59. package/lib/pie-chart-model.d.ts +3 -3
  60. package/lib/pie-chart-model.d.ts.map +1 -1
  61. package/lib/pie-chart-model.js +1 -1
  62. package/lib/pie-chart-model.js.map +1 -1
  63. package/lib/setup-tests.d.ts +1 -1
  64. package/lib/setup-tests.d.ts.map +1 -1
  65. package/lib/setup-tests.js +2 -2
  66. package/lib/setup-tests.js.map +1 -1
  67. package/lib/utils.d.ts +3 -3
  68. package/lib/utils.d.ts.map +1 -1
  69. package/lib/utils.js +5 -5
  70. package/lib/utils.js.map +1 -1
  71. package/mf-manifest.json +36 -33
  72. package/mf-stats.json +36 -33
  73. package/package.json +10 -10
  74. package/__mf/js/async/121.61df50b5.js +0 -2
  75. package/__mf/js/async/177.7624b91a.js +0 -1
  76. package/__mf/js/async/187.65618c74.js +0 -7
  77. package/__mf/js/async/187.65618c74.js.LICENSE.txt +0 -39
  78. package/__mf/js/async/192.d45ba757.js +0 -1
  79. package/__mf/js/async/2.651ba6ec.js +0 -1
  80. package/__mf/js/async/235.495df342.js +0 -1
  81. package/__mf/js/async/274.5c1e13d7.js +0 -2
  82. package/__mf/js/async/356.5cd094ae.js +0 -1
  83. package/__mf/js/async/376.196cec5c.js +0 -110
  84. package/__mf/js/async/392.281005cf.js +0 -2
  85. package/__mf/js/async/469.ea0276a5.js +0 -1
  86. package/__mf/js/async/470.0b301928.js +0 -2
  87. package/__mf/js/async/546.b800e1ff.js +0 -24
  88. package/__mf/js/async/546.b800e1ff.js.LICENSE.txt +0 -19
  89. package/__mf/js/async/554.507b3545.js +0 -2
  90. package/__mf/js/async/558.9bb26cf7.js +0 -1
  91. package/__mf/js/async/576.9e075806.js +0 -39
  92. package/__mf/js/async/587.a59f7544.js +0 -1
  93. package/__mf/js/async/603.224eeb96.js +0 -1
  94. package/__mf/js/async/616.702bde53.js +0 -1
  95. package/__mf/js/async/66.13296185.js +0 -1
  96. package/__mf/js/async/663.d4632bd2.js +0 -1
  97. package/__mf/js/async/873.8941a36f.js +0 -1
  98. package/__mf/js/async/941.b972dd8a.js +0 -2
  99. package/__mf/js/async/968.6009cb29.js +0 -1
  100. package/__mf/js/async/__federation_expose_PieChart.9cd45fce.js +0 -4
  101. package/__mf/js/async/lib-router.c182f4dd.js +0 -2
  102. package/lib/cjs/PieChart.js +0 -38
  103. package/lib/cjs/PieChartBase.js +0 -100
  104. package/lib/cjs/PieChartOptionsEditorSettings.js +0 -247
  105. package/lib/cjs/PieChartPanel.js +0 -155
  106. package/lib/cjs/bootstrap.js +0 -26
  107. package/lib/cjs/colors.js +0 -207
  108. package/lib/cjs/env.d.js +0 -14
  109. package/lib/cjs/getPluginModule.js +0 -39
  110. package/lib/cjs/index-federation.js +0 -55
  111. package/lib/cjs/index.js +0 -41
  112. package/lib/cjs/pie-chart-model.js +0 -53
  113. package/lib/cjs/setup-tests.js +0 -19
  114. package/lib/cjs/utils.js +0 -163
  115. /package/__mf/css/async/{187.85c2cbf6.css → 788.85c2cbf6.css} +0 -0
  116. /package/__mf/js/async/{121.61df50b5.js.LICENSE.txt → 121.3f985aad.js.LICENSE.txt} +0 -0
  117. /package/__mf/js/async/{274.5c1e13d7.js.LICENSE.txt → 274.0fa32f07.js.LICENSE.txt} +0 -0
  118. /package/__mf/js/async/{376.196cec5c.js.LICENSE.txt → 376.d72b6d45.js.LICENSE.txt} +0 -0
  119. /package/__mf/js/async/{392.281005cf.js.LICENSE.txt → 392.311100c7.js.LICENSE.txt} +0 -0
  120. /package/__mf/js/async/{470.0b301928.js.LICENSE.txt → 470.7f042d46.js.LICENSE.txt} +0 -0
  121. /package/__mf/js/async/{554.507b3545.js.LICENSE.txt → 554.ffbb20fd.js.LICENSE.txt} +0 -0
  122. /package/__mf/js/async/{941.b972dd8a.js.LICENSE.txt → 941.1d0acff2.js.LICENSE.txt} +0 -0
  123. /package/__mf/js/async/{lib-router.c182f4dd.js.LICENSE.txt → lib-router.64f2eab9.js.LICENSE.txt} +0 -0
@@ -1,39 +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;
21
- }
22
- });
23
- const _packagejson = /*#__PURE__*/ _interop_require_default(require("../package.json"));
24
- function _interop_require_default(obj) {
25
- return obj && obj.__esModule ? obj : {
26
- default: obj
27
- };
28
- }
29
- function getPluginModule() {
30
- const { name, version, perses } = _packagejson.default;
31
- return {
32
- kind: 'PluginModule',
33
- metadata: {
34
- name,
35
- version
36
- },
37
- spec: perses
38
- };
39
- }
@@ -1,55 +0,0 @@
1
- "use strict";
2
- function _getRequireWildcardCache(nodeInterop) {
3
- if (typeof WeakMap !== "function") return null;
4
- var cacheBabelInterop = new WeakMap();
5
- var cacheNodeInterop = new WeakMap();
6
- return (_getRequireWildcardCache = function(nodeInterop) {
7
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
8
- })(nodeInterop);
9
- }
10
- function _interop_require_wildcard(obj, nodeInterop) {
11
- if (!nodeInterop && obj && obj.__esModule) {
12
- return obj;
13
- }
14
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
15
- return {
16
- default: obj
17
- };
18
- }
19
- var cache = _getRequireWildcardCache(nodeInterop);
20
- if (cache && cache.has(obj)) {
21
- return cache.get(obj);
22
- }
23
- var newObj = {
24
- __proto__: null
25
- };
26
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
27
- for(var key in obj){
28
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
29
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
30
- if (desc && (desc.get || desc.set)) {
31
- Object.defineProperty(newObj, key, desc);
32
- } else {
33
- newObj[key] = obj[key];
34
- }
35
- }
36
- }
37
- newObj.default = obj;
38
- if (cache) {
39
- cache.set(obj, newObj);
40
- }
41
- return newObj;
42
- }
43
- // Copyright The Perses Authors
44
- // Licensed under the Apache License, Version 2.0 (the "License");
45
- // you may not use this file except in compliance with the License.
46
- // You may obtain a copy of the License at
47
- //
48
- // http://www.apache.org/licenses/LICENSE-2.0
49
- //
50
- // Unless required by applicable law or agreed to in writing, software
51
- // distributed under the License is distributed on an "AS IS" BASIS,
52
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
53
- // See the License for the specific language governing permissions and
54
- // limitations under the License.
55
- Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./bootstrap")));
package/lib/cjs/index.js DELETED
@@ -1,41 +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("./PieChartPanel"), exports);
24
- const _getPluginModule = require("./getPluginModule");
25
- _export_star(require("./colors"), exports);
26
- _export_star(require("./pie-chart-model"), exports);
27
- _export_star(require("./PieChart"), exports);
28
- _export_star(require("./PieChartOptionsEditorSettings"), exports);
29
- function _export_star(from, to) {
30
- Object.keys(from).forEach(function(k) {
31
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
32
- Object.defineProperty(to, k, {
33
- enumerable: true,
34
- get: function() {
35
- return from[k];
36
- }
37
- });
38
- }
39
- });
40
- return from;
41
- }
@@ -1,53 +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 DEFAULT_FORMAT () {
25
- return DEFAULT_FORMAT;
26
- },
27
- get DEFAULT_MODE () {
28
- return DEFAULT_MODE;
29
- },
30
- get DEFAULT_SORT () {
31
- return DEFAULT_SORT;
32
- },
33
- get createInitialPieChartOptions () {
34
- return createInitialPieChartOptions;
35
- }
36
- });
37
- const _pluginsystem = require("@perses-dev/plugin-system");
38
- const DEFAULT_FORMAT = {
39
- unit: 'decimal',
40
- shortValues: true
41
- };
42
- const DEFAULT_SORT = 'desc';
43
- const DEFAULT_MODE = 'value';
44
- function createInitialPieChartOptions() {
45
- return {
46
- calculation: _pluginsystem.DEFAULT_CALCULATION,
47
- format: DEFAULT_FORMAT,
48
- mode: DEFAULT_MODE,
49
- radius: 50,
50
- showLabels: false,
51
- sort: DEFAULT_SORT
52
- };
53
- }
@@ -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');
package/lib/cjs/utils.js DELETED
@@ -1,163 +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 PieChartListLegendMapper () {
25
- return PieChartListLegendMapper;
26
- },
27
- get PieChartTableLegendMapper () {
28
- return PieChartTableLegendMapper;
29
- },
30
- get getLabelFormatter () {
31
- return getLabelFormatter;
32
- },
33
- get getTooltipFormatter () {
34
- return getTooltipFormatter;
35
- },
36
- get sortSeriesData () {
37
- return sortSeriesData;
38
- }
39
- });
40
- const _components = require("@perses-dev/components");
41
- const _echarts = require("echarts");
42
- const _pluginsystem = require("@perses-dev/plugin-system");
43
- const _piechartmodel = require("./pie-chart-model");
44
- function sortSeriesData(data, sortOrder = _piechartmodel.DEFAULT_SORT) {
45
- return data.sort((a, b)=>{
46
- // Handle null values - push them to the end regardless of sort order
47
- if (a.value === null && b.value === null) return 0;
48
- if (a.value === null) return 1;
49
- if (b.value === null) return -1;
50
- // Sort by value
51
- const diff = (a.value ?? 0) - (b.value ?? 0);
52
- return sortOrder === 'asc' ? diff : -diff;
53
- });
54
- }
55
- const getTooltipFormatter = (formatOptions)=>{
56
- const relativeFormatOptions = {
57
- unit: 'percent',
58
- decimalPlaces: formatOptions?.decimalPlaces
59
- };
60
- return ({ name, value, percent })=>{
61
- if (typeof value === 'number') {
62
- return `${_echarts.format.encodeHTML(name)}: ${(0, _components.formatValue)(value, formatOptions)} (${(0, _components.formatValue)(percent, relativeFormatOptions)})`;
63
- }
64
- return `${_echarts.format.encodeHTML(name)}: ${_echarts.format.encodeHTML(value.toString())}`;
65
- };
66
- };
67
- const getLabelFormatter = (mode, formatOptions)=>{
68
- if (mode === 'percentage') {
69
- return percentageLabelFormatter(formatOptions);
70
- }
71
- return labelFormatter(formatOptions);
72
- };
73
- const labelFormatter = (formatOptions)=>{
74
- return ({ name, value })=>{
75
- if (typeof value === 'number') {
76
- return `${name}:\n${(0, _components.formatValue)(value, formatOptions)}`;
77
- }
78
- return `${name}:\n${_echarts.format.encodeHTML(value.toString())}`;
79
- };
80
- };
81
- const percentageLabelFormatter = (formatOptions)=>{
82
- const relativeFormatOptions = {
83
- unit: 'percent',
84
- decimalPlaces: formatOptions?.decimalPlaces
85
- };
86
- return ({ name, percent })=>{
87
- return `${name}:\n${(0, _components.formatValue)(percent, relativeFormatOptions)}`;
88
- };
89
- };
90
- class PieChartListLegendMapper {
91
- mapToLegendItems(pieChartData) {
92
- return pieChartData.map(({ id, name, itemStyle })=>({
93
- id: id,
94
- label: name,
95
- color: itemStyle.color,
96
- data: {}
97
- }));
98
- }
99
- mapToLegendColumns() {
100
- return [];
101
- }
102
- }
103
- class PieChartTableLegendMapper {
104
- mapToLegendItems(pieChartData, selectedValues) {
105
- const relativePieChartData = calculatePercentages(pieChartData);
106
- const absoluteValueSelected = selectedValues?.includes('abs');
107
- const relativeValueSelected = selectedValues?.includes('relative');
108
- return pieChartData.map(({ id, name, itemStyle, value })=>{
109
- const data = {};
110
- if (absoluteValueSelected && typeof value === 'number') {
111
- data['abs'] = value;
112
- }
113
- if (relativeValueSelected) {
114
- const itemPercentageValue = relativePieChartData.find((rpd)=>rpd.id === id)?.value;
115
- if (typeof itemPercentageValue === 'number') {
116
- data['relative'] = itemPercentageValue;
117
- }
118
- }
119
- return {
120
- id: id,
121
- label: name,
122
- color: itemStyle.color,
123
- data: data
124
- };
125
- });
126
- }
127
- mapToLegendColumns(selectedValues, formatOptions) {
128
- const relativeFormatOptions = {
129
- unit: 'percent',
130
- decimalPlaces: formatOptions?.decimalPlaces
131
- };
132
- return selectedValues?.toSorted().map((v)=>{
133
- const comparisonValue = isComparisonValue(v);
134
- return {
135
- accessorKey: `data.${v}`,
136
- header: comparisonValue ? _pluginsystem.comparisonLegends[v].label : v,
137
- headerDescription: comparisonValue ? _pluginsystem.comparisonLegends[v].description : undefined,
138
- width: 90,
139
- align: 'right',
140
- cellDescription: true,
141
- enableSorting: true,
142
- cell: ({ getValue })=>{
143
- const cellValue = getValue();
144
- return typeof cellValue === 'number' && formatOptions ? (0, _components.formatValue)(cellValue, v === 'relative' ? relativeFormatOptions : formatOptions) : cellValue;
145
- }
146
- };
147
- }) ?? [];
148
- }
149
- }
150
- function calculatePercentages(data) {
151
- const sum = data.reduce((accumulator, { value })=>accumulator + (value ?? 0), 0);
152
- return data.map((seriesData)=>{
153
- const percentage = (seriesData.value ?? 0) / sum * 100;
154
- return {
155
- ...seriesData,
156
- value: Number(percentage.toFixed(4))
157
- };
158
- });
159
- }
160
- const comparisonValuesArray = Object.keys(_pluginsystem.comparisonLegends);
161
- function isComparisonValue(value) {
162
- return typeof value === 'string' && comparisonValuesArray.includes(value);
163
- }