@perses-dev/pie-chart-plugin 0.6.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 (129) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +41 -0
  3. package/__mf/css/async/263.80005a4a.css +1 -0
  4. package/__mf/css/async/341.80005a4a.css +1 -0
  5. package/__mf/css/async/759.80005a4a.css +1 -0
  6. package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
  7. package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
  8. package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
  9. package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
  10. package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
  11. package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
  12. package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
  13. package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
  14. package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
  15. package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
  16. package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
  17. package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
  18. package/__mf/js/693.77ca36d8.js +5 -0
  19. package/__mf/js/PieChart.9e5c2bf5.js +5 -0
  20. package/__mf/js/async/162.668ea958.js +73 -0
  21. package/__mf/js/async/162.668ea958.js.LICENSE.txt +19 -0
  22. package/__mf/js/async/173.ee70b493.js +2 -0
  23. package/__mf/js/async/173.ee70b493.js.LICENSE.txt +19 -0
  24. package/__mf/js/async/214.df2e7807.js +1 -0
  25. package/__mf/js/async/224.dbeed4db.js +1 -0
  26. package/__mf/js/async/238.5287310b.js +1 -0
  27. package/__mf/js/async/292.f278784e.js +1 -0
  28. package/__mf/js/async/331.a0d6355f.js +2 -0
  29. package/__mf/js/async/331.a0d6355f.js.LICENSE.txt +21 -0
  30. package/__mf/js/async/36.ac56ec70.js +38 -0
  31. package/__mf/js/async/360.fdc4e499.js +29 -0
  32. package/__mf/js/async/360.fdc4e499.js.LICENSE.txt +37 -0
  33. package/__mf/js/async/488.0fc5dcbb.js +1 -0
  34. package/__mf/js/async/610.8c8cf7f2.js +1 -0
  35. package/__mf/js/async/620.9a73a66b.js +2 -0
  36. package/__mf/js/async/620.9a73a66b.js.LICENSE.txt +9 -0
  37. package/__mf/js/async/651.a1042e18.js +1 -0
  38. package/__mf/js/async/656.5efccb26.js +1 -0
  39. package/__mf/js/async/694.b227b636.js +1 -0
  40. package/__mf/js/async/707.55fda5d1.js +1 -0
  41. package/__mf/js/async/738.4ac98841.js +1 -0
  42. package/__mf/js/async/740.b86dfa00.js +1 -0
  43. package/__mf/js/async/75.905151a5.js +1 -0
  44. package/__mf/js/async/770.93415255.js +1 -0
  45. package/__mf/js/async/960.208437e1.js +2 -0
  46. package/__mf/js/async/960.208437e1.js.LICENSE.txt +8 -0
  47. package/__mf/js/async/964.6df60c3e.js +2 -0
  48. package/__mf/js/async/964.6df60c3e.js.LICENSE.txt +9 -0
  49. package/__mf/js/async/973.74031340.js +110 -0
  50. package/__mf/js/async/973.74031340.js.LICENSE.txt +27 -0
  51. package/__mf/js/async/981.3ecbf5ea.js +2 -0
  52. package/__mf/js/async/981.3ecbf5ea.js.LICENSE.txt +8 -0
  53. package/__mf/js/async/996.9e160813.js +2 -0
  54. package/__mf/js/async/996.9e160813.js.LICENSE.txt +24 -0
  55. package/__mf/js/async/__federation_expose_PieChart.f03b1180.js +1 -0
  56. package/__mf/js/async/lib-router.d29f3ef0.js +2 -0
  57. package/__mf/js/async/lib-router.d29f3ef0.js.LICENSE.txt +32 -0
  58. package/__mf/js/main.518abb8d.js +1 -0
  59. package/lib/PieChart.d.ts +8 -0
  60. package/lib/PieChart.d.ts.map +1 -0
  61. package/lib/PieChart.js +32 -0
  62. package/lib/PieChart.js.map +1 -0
  63. package/lib/PieChartOptionsEditorSettings.d.ts +4 -0
  64. package/lib/PieChartOptionsEditorSettings.d.ts.map +1 -0
  65. package/lib/PieChartOptionsEditorSettings.js +104 -0
  66. package/lib/PieChartOptionsEditorSettings.js.map +1 -0
  67. package/lib/PieChartPanel.d.ts +7 -0
  68. package/lib/PieChartPanel.d.ts.map +1 -0
  69. package/lib/PieChartPanel.js +164 -0
  70. package/lib/PieChartPanel.js.map +1 -0
  71. package/lib/bootstrap.d.ts +2 -0
  72. package/lib/bootstrap.d.ts.map +1 -0
  73. package/lib/bootstrap.js +19 -0
  74. package/lib/bootstrap.js.map +1 -0
  75. package/lib/cjs/PieChart.js +38 -0
  76. package/lib/cjs/PieChartOptionsEditorSettings.js +117 -0
  77. package/lib/cjs/PieChartPanel.js +177 -0
  78. package/lib/cjs/bootstrap.js +26 -0
  79. package/lib/cjs/env.d.js +14 -0
  80. package/lib/cjs/getPluginModule.js +27 -0
  81. package/lib/cjs/index-federation.js +55 -0
  82. package/lib/cjs/index.js +31 -0
  83. package/lib/cjs/model.js +16 -0
  84. package/lib/cjs/palette-gen.js +75 -0
  85. package/lib/cjs/palette.js +83 -0
  86. package/lib/cjs/pie-chart-model.js +114 -0
  87. package/lib/cjs/setup-tests.js +19 -0
  88. package/lib/cjs/utils.js +72 -0
  89. package/lib/env.d.js +15 -0
  90. package/lib/env.d.js.map +1 -0
  91. package/lib/getPluginModule.d.ts +6 -0
  92. package/lib/getPluginModule.d.ts.map +1 -0
  93. package/lib/getPluginModule.js +16 -0
  94. package/lib/getPluginModule.js.map +1 -0
  95. package/lib/index-federation.d.ts +1 -0
  96. package/lib/index-federation.d.ts.map +1 -0
  97. package/lib/index-federation.js +15 -0
  98. package/lib/index-federation.js.map +1 -0
  99. package/lib/index.d.ts +9 -0
  100. package/lib/index.d.ts.map +1 -0
  101. package/lib/index.js +10 -0
  102. package/lib/index.js.map +1 -0
  103. package/lib/model.d.ts +20 -0
  104. package/lib/model.d.ts.map +1 -0
  105. package/lib/model.js +15 -0
  106. package/lib/model.js.map +1 -0
  107. package/lib/palette-gen.d.ts +25 -0
  108. package/lib/palette-gen.d.ts.map +1 -0
  109. package/lib/palette-gen.js +62 -0
  110. package/lib/palette-gen.js.map +1 -0
  111. package/lib/palette.d.ts +6 -0
  112. package/lib/palette.d.ts.map +1 -0
  113. package/lib/palette.js +64 -0
  114. package/lib/palette.js.map +1 -0
  115. package/lib/pie-chart-model.d.ts +71 -0
  116. package/lib/pie-chart-model.d.ts.map +1 -0
  117. package/lib/pie-chart-model.js +71 -0
  118. package/lib/pie-chart-model.js.map +1 -0
  119. package/lib/setup-tests.d.ts +2 -0
  120. package/lib/setup-tests.d.ts.map +1 -0
  121. package/lib/setup-tests.js +17 -0
  122. package/lib/setup-tests.js.map +1 -0
  123. package/lib/utils.d.ts +7 -0
  124. package/lib/utils.d.ts.map +1 -0
  125. package/lib/utils.js +56 -0
  126. package/lib/utils.js.map +1 -0
  127. package/mf-manifest.json +321 -0
  128. package/mf-stats.json +366 -0
  129. package/package.json +53 -0
@@ -0,0 +1,164 @@
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
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { Box, useTheme } from '@mui/material';
15
+ import { ContentWithLegend, PieChart, useChartsTheme, useId } from '@perses-dev/components';
16
+ import { CalculationsMap, DEFAULT_LEGEND } from '@perses-dev/core';
17
+ import { validateLegendSpec } from '@perses-dev/plugin-system';
18
+ import merge from 'lodash/merge';
19
+ import { useMemo, useRef, useState } from 'react';
20
+ import { getSeriesColor } from './palette-gen';
21
+ import { DEFAULT_VISUAL } from './pie-chart-model';
22
+ import { calculatePercentages, sortSeriesData } from './utils';
23
+ export function PieChartPanel(props) {
24
+ const { spec: { calculation, sort, mode, querySettings: querySettingsList }, contentDimensions, queryResults } = props;
25
+ const chartsTheme = useChartsTheme();
26
+ const muiTheme = useTheme();
27
+ const PADDING = chartsTheme.container.padding.default;
28
+ const chartId = useId('time-series-panel');
29
+ const categoricalPalette = chartsTheme.echartsTheme.color;
30
+ const visual = useMemo(()=>{
31
+ return merge({}, DEFAULT_VISUAL, props.spec.visual);
32
+ }, [
33
+ props.spec.visual
34
+ ]);
35
+ const { pieChartData, legendItems } = useMemo(()=>{
36
+ const calculate = CalculationsMap[calculation];
37
+ const pieChartData = [];
38
+ const legendItems = [];
39
+ for(let queryIndex = 0; queryIndex < queryResults.length; queryIndex++){
40
+ const result = queryResults[queryIndex];
41
+ let seriesIndex = 0;
42
+ for (const seriesData of result?.data.series ?? []){
43
+ // Retrieve querySettings for this query, if exists.
44
+ // queries & querySettings indices do not necessarily match, so we have to check the tail value of the $ref attribute
45
+ let querySettings;
46
+ for (const item of querySettingsList ?? []){
47
+ if (item.queryIndex === queryIndex) {
48
+ querySettings = item;
49
+ // We don't break the loop here just in case there are multiple querySettings defined for the
50
+ // same queryIndex, because in that case we want the last one to take precedence.
51
+ }
52
+ }
53
+ const seriesColor = getSeriesColor({
54
+ categoricalPalette: categoricalPalette,
55
+ visual,
56
+ muiPrimaryColor: muiTheme.palette.primary.main,
57
+ seriesName: seriesData.name,
58
+ seriesIndex,
59
+ querySettings: querySettings,
60
+ queryHasMultipleResults: (queryResults[queryIndex]?.data?.series?.length ?? 0) > 1
61
+ });
62
+ const series = {
63
+ value: calculate(seriesData.values) ?? null,
64
+ name: seriesData.formattedName ?? '',
65
+ itemStyle: {
66
+ color: seriesColor
67
+ }
68
+ };
69
+ pieChartData.push(series);
70
+ const seriesId = chartId + seriesData.name + seriesIndex;
71
+ legendItems.push({
72
+ id: seriesId,
73
+ label: series.name,
74
+ color: seriesColor
75
+ });
76
+ seriesIndex++;
77
+ }
78
+ }
79
+ const sortedPieChartData = sortSeriesData(pieChartData, sort);
80
+ if (mode === 'percentage') {
81
+ return {
82
+ pieChartData: calculatePercentages(sortedPieChartData),
83
+ legendItems
84
+ };
85
+ }
86
+ return {
87
+ pieChartData: sortedPieChartData,
88
+ legendItems
89
+ };
90
+ }, [
91
+ calculation,
92
+ sort,
93
+ mode,
94
+ queryResults,
95
+ categoricalPalette,
96
+ visual,
97
+ muiTheme.palette.primary.main,
98
+ chartId,
99
+ querySettingsList
100
+ ]);
101
+ const contentPadding = chartsTheme.container.padding.default;
102
+ const adjustedContentDimensions = contentDimensions ? {
103
+ width: contentDimensions.width - contentPadding * 2,
104
+ height: contentDimensions.height - contentPadding * 2
105
+ } : undefined;
106
+ const legend = useMemo(()=>{
107
+ return props.spec.legend && validateLegendSpec(props.spec.legend) ? merge({}, DEFAULT_LEGEND, props.spec.legend) : undefined;
108
+ }, [
109
+ props.spec.legend
110
+ ]);
111
+ const [selectedLegendItems, setSelectedLegendItems] = useState('ALL');
112
+ const [legendSorting, setLegendSorting] = useState();
113
+ const chartRef = useRef(null);
114
+ // ensures there are fallbacks for unset properties since most
115
+ // users should not need to customize visual display
116
+ if (contentDimensions === undefined) return null;
117
+ return /*#__PURE__*/ _jsx(Box, {
118
+ sx: {
119
+ padding: `${PADDING}px`
120
+ },
121
+ children: /*#__PURE__*/ _jsx(ContentWithLegend, {
122
+ width: adjustedContentDimensions?.width ?? 400,
123
+ height: adjustedContentDimensions?.height ?? 1000,
124
+ // Making this small enough that the medium size doesn't get
125
+ // responsive-handling-ed away when in the panel options editor.
126
+ minChildrenHeight: 50,
127
+ legendSize: legend?.size,
128
+ legendProps: legend && {
129
+ options: legend,
130
+ data: legendItems,
131
+ selectedItems: selectedLegendItems,
132
+ onSelectedItemsChange: setSelectedLegendItems,
133
+ tableProps: {
134
+ columns: [],
135
+ sorting: legendSorting,
136
+ onSortingChange: setLegendSorting
137
+ },
138
+ onItemMouseOver: (e, { id })=>{
139
+ chartRef.current?.highlightSeries({
140
+ name: id
141
+ });
142
+ },
143
+ onItemMouseOut: ()=>{
144
+ chartRef.current?.clearHighlightedSeries();
145
+ }
146
+ },
147
+ children: ({ height, width })=>{
148
+ return /*#__PURE__*/ _jsx(Box, {
149
+ style: {
150
+ height,
151
+ width
152
+ },
153
+ children: /*#__PURE__*/ _jsx(PieChart, {
154
+ data: pieChartData,
155
+ width: contentDimensions.width - PADDING * 2,
156
+ height: contentDimensions.height - PADDING * 2
157
+ })
158
+ });
159
+ }
160
+ })
161
+ });
162
+ }
163
+
164
+ //# sourceMappingURL=PieChartPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/PieChartPanel.tsx"],"sourcesContent":["//Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, useTheme } from '@mui/material';\nimport {\n ChartInstance,\n ContentWithLegend,\n LegendItem,\n LegendProps,\n PieChart,\n PieChartData,\n SelectedLegendItemState,\n useChartsTheme,\n useId,\n} from '@perses-dev/components';\nimport { CalculationType, CalculationsMap, DEFAULT_LEGEND, TimeSeriesData } from '@perses-dev/core';\nimport { PanelProps, validateLegendSpec } from '@perses-dev/plugin-system';\nimport merge from 'lodash/merge';\nimport { ReactElement, useMemo, useRef, useState } from 'react';\nimport { QuerySettingsOptions } from './model';\nimport { getSeriesColor } from './palette-gen';\nimport { DEFAULT_VISUAL, PieChartOptions } from './pie-chart-model';\nimport { calculatePercentages, sortSeriesData } from './utils';\n\nexport type PieChartPanelProps = PanelProps<PieChartOptions, TimeSeriesData>;\n\nexport function PieChartPanel(props: PieChartPanelProps): ReactElement | null {\n const {\n spec: { calculation, sort, mode, querySettings: querySettingsList },\n contentDimensions,\n queryResults,\n } = props;\n const chartsTheme = useChartsTheme();\n const muiTheme = useTheme();\n const PADDING = chartsTheme.container.padding.default;\n const chartId = useId('time-series-panel');\n const categoricalPalette = chartsTheme.echartsTheme.color;\n\n const visual = useMemo(() => {\n return merge({}, DEFAULT_VISUAL, props.spec.visual);\n }, [props.spec.visual]);\n\n const { pieChartData, legendItems } = useMemo(() => {\n const calculate = CalculationsMap[calculation as CalculationType];\n const pieChartData: PieChartData[] = [];\n const legendItems: LegendItem[] = [];\n\n for (let queryIndex = 0; queryIndex < queryResults.length; queryIndex++) {\n const result = queryResults[queryIndex];\n\n let seriesIndex = 0;\n for (const seriesData of result?.data.series ?? []) {\n // Retrieve querySettings for this query, if exists.\n // queries & querySettings indices do not necessarily match, so we have to check the tail value of the $ref attribute\n let querySettings: QuerySettingsOptions | undefined;\n for (const item of querySettingsList ?? []) {\n if (item.queryIndex === queryIndex) {\n querySettings = item;\n // We don't break the loop here just in case there are multiple querySettings defined for the\n // same queryIndex, because in that case we want the last one to take precedence.\n }\n }\n const seriesColor = getSeriesColor({\n categoricalPalette: categoricalPalette as string[],\n visual,\n muiPrimaryColor: muiTheme.palette.primary.main,\n seriesName: seriesData.name,\n seriesIndex,\n querySettings: querySettings,\n queryHasMultipleResults: (queryResults[queryIndex]?.data?.series?.length ?? 0) > 1,\n });\n const series = {\n value: calculate(seriesData.values) ?? null,\n name: seriesData.formattedName ?? '',\n itemStyle: {\n color: seriesColor,\n },\n };\n pieChartData.push(series);\n\n const seriesId = chartId + seriesData.name + seriesIndex;\n legendItems.push({\n id: seriesId,\n label: series.name,\n color: seriesColor,\n });\n seriesIndex++;\n }\n }\n\n const sortedPieChartData = sortSeriesData(pieChartData, sort);\n if (mode === 'percentage') {\n return {\n pieChartData: calculatePercentages(sortedPieChartData),\n legendItems,\n };\n }\n return {\n pieChartData: sortedPieChartData,\n legendItems,\n };\n }, [\n calculation,\n sort,\n mode,\n queryResults,\n categoricalPalette,\n visual,\n muiTheme.palette.primary.main,\n chartId,\n querySettingsList,\n ]);\n\n const contentPadding = chartsTheme.container.padding.default;\n const adjustedContentDimensions: typeof contentDimensions = contentDimensions\n ? {\n width: contentDimensions.width - contentPadding * 2,\n height: contentDimensions.height - contentPadding * 2,\n }\n : undefined;\n\n const legend = useMemo(() => {\n return props.spec.legend && validateLegendSpec(props.spec.legend)\n ? merge({}, DEFAULT_LEGEND, props.spec.legend)\n : undefined;\n }, [props.spec.legend]);\n\n const [selectedLegendItems, setSelectedLegendItems] = useState<SelectedLegendItemState>('ALL');\n\n const [legendSorting, setLegendSorting] = useState<NonNullable<LegendProps['tableProps']>['sorting']>();\n\n const chartRef = useRef<ChartInstance>(null);\n\n // ensures there are fallbacks for unset properties since most\n // users should not need to customize visual display\n\n if (contentDimensions === undefined) return null;\n\n return (\n <Box sx={{ padding: `${PADDING}px` }}>\n <ContentWithLegend\n width={adjustedContentDimensions?.width ?? 400}\n height={adjustedContentDimensions?.height ?? 1000}\n // Making this small enough that the medium size doesn't get\n // responsive-handling-ed away when in the panel options editor.\n minChildrenHeight={50}\n legendSize={legend?.size}\n legendProps={\n legend && {\n options: legend,\n data: legendItems,\n selectedItems: selectedLegendItems,\n onSelectedItemsChange: setSelectedLegendItems,\n tableProps: {\n columns: [],\n sorting: legendSorting,\n onSortingChange: setLegendSorting,\n },\n onItemMouseOver: (e, { id }): void => {\n chartRef.current?.highlightSeries({ name: id });\n },\n onItemMouseOut: (): void => {\n chartRef.current?.clearHighlightedSeries();\n },\n }\n }\n >\n {({ height, width }) => {\n return (\n <Box style={{ height, width }}>\n <PieChart\n data={pieChartData}\n width={contentDimensions.width - PADDING * 2}\n height={contentDimensions.height - PADDING * 2}\n />\n </Box>\n );\n }}\n </ContentWithLegend>\n </Box>\n );\n}\n"],"names":["Box","useTheme","ContentWithLegend","PieChart","useChartsTheme","useId","CalculationsMap","DEFAULT_LEGEND","validateLegendSpec","merge","useMemo","useRef","useState","getSeriesColor","DEFAULT_VISUAL","calculatePercentages","sortSeriesData","PieChartPanel","props","spec","calculation","sort","mode","querySettings","querySettingsList","contentDimensions","queryResults","chartsTheme","muiTheme","PADDING","container","padding","default","chartId","categoricalPalette","echartsTheme","color","visual","pieChartData","legendItems","calculate","queryIndex","length","result","seriesIndex","seriesData","data","series","item","seriesColor","muiPrimaryColor","palette","primary","main","seriesName","name","queryHasMultipleResults","value","values","formattedName","itemStyle","push","seriesId","id","label","sortedPieChartData","contentPadding","adjustedContentDimensions","width","height","undefined","legend","selectedLegendItems","setSelectedLegendItems","legendSorting","setLegendSorting","chartRef","sx","minChildrenHeight","legendSize","size","legendProps","options","selectedItems","onSelectedItemsChange","tableProps","columns","sorting","onSortingChange","onItemMouseOver","e","current","highlightSeries","onItemMouseOut","clearHighlightedSeries","style"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=bootstrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/bootstrap.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
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
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import React from 'react';
15
+ import ReactDOM from 'react-dom/client';
16
+ const root = ReactDOM.createRoot(document.getElementById('root'));
17
+ root.render(/*#__PURE__*/ _jsx(React.StrictMode, {}));
18
+
19
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/bootstrap.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React from 'react';\nimport ReactDOM from 'react-dom/client';\n\nconst root = ReactDOM.createRoot(document.getElementById('root')!);\nroot.render(<React.StrictMode></React.StrictMode>);\n"],"names":["React","ReactDOM","root","createRoot","document","getElementById","render","StrictMode"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,WAAW,QAAQ;AAC1B,OAAOC,cAAc,mBAAmB;AAExC,MAAMC,OAAOD,SAASE,UAAU,CAACC,SAASC,cAAc,CAAC;AACzDH,KAAKI,MAAM,eAAC,KAACN,MAAMO,UAAU"}
@@ -0,0 +1,38 @@
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 _piechartmodel = require("./pie-chart-model");
24
+ const _PieChartOptionsEditorSettings = require("./PieChartOptionsEditorSettings");
25
+ const _PieChartPanel = require("./PieChartPanel");
26
+ const PieChart = {
27
+ PanelComponent: _PieChartPanel.PieChartPanel,
28
+ panelOptionsEditorComponents: [
29
+ {
30
+ label: 'Settings',
31
+ content: _PieChartOptionsEditorSettings.PieChartOptionsEditorSettings
32
+ }
33
+ ],
34
+ supportedQueryTypes: [
35
+ 'TimeSeriesQuery'
36
+ ],
37
+ createInitialOptions: _piechartmodel.createInitialPieChartOptions
38
+ };
@@ -0,0 +1,117 @@
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, "PieChartOptionsEditorSettings", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return PieChartOptionsEditorSettings;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _merge = /*#__PURE__*/ _interop_require_default(require("lodash/merge"));
25
+ const _pluginsystem = require("@perses-dev/plugin-system");
26
+ const _immer = require("immer");
27
+ const _components = require("@perses-dev/components");
28
+ const _core = require("@perses-dev/core");
29
+ const _material = require("@mui/material");
30
+ const _piechartmodel = require("./pie-chart-model");
31
+ function _interop_require_default(obj) {
32
+ return obj && obj.__esModule ? obj : {
33
+ default: obj
34
+ };
35
+ }
36
+ function PieChartOptionsEditorSettings(props) {
37
+ const { onChange, value } = props;
38
+ const handleCalculationChange = (newCalculation)=>{
39
+ onChange((0, _immer.produce)(value, (draft)=>{
40
+ draft.calculation = newCalculation;
41
+ }));
42
+ };
43
+ const handleLegendChange = (newLegend)=>{
44
+ // TODO (sjcobb): fix type, add position, fix glitch
45
+ onChange((0, _immer.produce)(value, (draft)=>{
46
+ draft.legend = newLegend;
47
+ }));
48
+ };
49
+ const handleUnitChange = (newFormat)=>{
50
+ onChange((0, _immer.produce)(value, (draft)=>{
51
+ draft.format = newFormat;
52
+ }));
53
+ };
54
+ const handleSortChange = (newSort)=>{
55
+ onChange((0, _immer.produce)(value, (draft)=>{
56
+ draft.sort = newSort;
57
+ }));
58
+ };
59
+ const handleModeChange = (newMode)=>{
60
+ onChange((0, _immer.produce)(value, (draft)=>{
61
+ draft.mode = newMode;
62
+ }));
63
+ };
64
+ // ensures decimalPlaces defaults to correct value
65
+ const format = (0, _merge.default)({}, _piechartmodel.DEFAULT_FORMAT, value.format);
66
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_components.OptionsEditorGrid, {
67
+ children: [
68
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_components.OptionsEditorColumn, {
69
+ children: [
70
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.LegendOptionsEditor, {
71
+ value: value.legend,
72
+ onChange: handleLegendChange
73
+ }),
74
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_components.OptionsEditorGroup, {
75
+ title: "Misc",
76
+ children: [
77
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.FormatControls, {
78
+ value: format,
79
+ onChange: handleUnitChange,
80
+ disabled: value.mode === 'percentage'
81
+ }),
82
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.CalculationSelector, {
83
+ value: value.calculation,
84
+ onChange: handleCalculationChange
85
+ }),
86
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.SortSelector, {
87
+ value: value.sort,
88
+ onChange: handleSortChange
89
+ }),
90
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ModeSelector, {
91
+ value: value.mode,
92
+ onChange: handleModeChange,
93
+ disablePercentageMode: (0, _core.isPercentUnit)(format)
94
+ })
95
+ ]
96
+ })
97
+ ]
98
+ }),
99
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorColumn, {
100
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorGroup, {
101
+ title: "Reset Settings",
102
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
103
+ variant: "outlined",
104
+ color: "secondary",
105
+ onClick: ()=>{
106
+ onChange((0, _immer.produce)(value, (draft)=>{
107
+ // reset button removes all optional panel options
108
+ draft.legend = undefined;
109
+ }));
110
+ },
111
+ children: "Reset To Defaults"
112
+ })
113
+ })
114
+ })
115
+ ]
116
+ });
117
+ }
@@ -0,0 +1,177 @@
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, "PieChartPanel", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return PieChartPanel;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _material = require("@mui/material");
25
+ const _components = require("@perses-dev/components");
26
+ const _core = require("@perses-dev/core");
27
+ const _pluginsystem = require("@perses-dev/plugin-system");
28
+ const _merge = /*#__PURE__*/ _interop_require_default(require("lodash/merge"));
29
+ const _react = require("react");
30
+ const _palettegen = require("./palette-gen");
31
+ const _piechartmodel = require("./pie-chart-model");
32
+ const _utils = require("./utils");
33
+ function _interop_require_default(obj) {
34
+ return obj && obj.__esModule ? obj : {
35
+ default: obj
36
+ };
37
+ }
38
+ function PieChartPanel(props) {
39
+ const { spec: { calculation, sort, mode, querySettings: querySettingsList }, contentDimensions, queryResults } = props;
40
+ const chartsTheme = (0, _components.useChartsTheme)();
41
+ const muiTheme = (0, _material.useTheme)();
42
+ const PADDING = chartsTheme.container.padding.default;
43
+ const chartId = (0, _components.useId)('time-series-panel');
44
+ const categoricalPalette = chartsTheme.echartsTheme.color;
45
+ const visual = (0, _react.useMemo)(()=>{
46
+ return (0, _merge.default)({}, _piechartmodel.DEFAULT_VISUAL, props.spec.visual);
47
+ }, [
48
+ props.spec.visual
49
+ ]);
50
+ const { pieChartData, legendItems } = (0, _react.useMemo)(()=>{
51
+ const calculate = _core.CalculationsMap[calculation];
52
+ const pieChartData = [];
53
+ const legendItems = [];
54
+ for(let queryIndex = 0; queryIndex < queryResults.length; queryIndex++){
55
+ const result = queryResults[queryIndex];
56
+ let seriesIndex = 0;
57
+ for (const seriesData of result?.data.series ?? []){
58
+ // Retrieve querySettings for this query, if exists.
59
+ // queries & querySettings indices do not necessarily match, so we have to check the tail value of the $ref attribute
60
+ let querySettings;
61
+ for (const item of querySettingsList ?? []){
62
+ if (item.queryIndex === queryIndex) {
63
+ querySettings = item;
64
+ // We don't break the loop here just in case there are multiple querySettings defined for the
65
+ // same queryIndex, because in that case we want the last one to take precedence.
66
+ }
67
+ }
68
+ const seriesColor = (0, _palettegen.getSeriesColor)({
69
+ categoricalPalette: categoricalPalette,
70
+ visual,
71
+ muiPrimaryColor: muiTheme.palette.primary.main,
72
+ seriesName: seriesData.name,
73
+ seriesIndex,
74
+ querySettings: querySettings,
75
+ queryHasMultipleResults: (queryResults[queryIndex]?.data?.series?.length ?? 0) > 1
76
+ });
77
+ const series = {
78
+ value: calculate(seriesData.values) ?? null,
79
+ name: seriesData.formattedName ?? '',
80
+ itemStyle: {
81
+ color: seriesColor
82
+ }
83
+ };
84
+ pieChartData.push(series);
85
+ const seriesId = chartId + seriesData.name + seriesIndex;
86
+ legendItems.push({
87
+ id: seriesId,
88
+ label: series.name,
89
+ color: seriesColor
90
+ });
91
+ seriesIndex++;
92
+ }
93
+ }
94
+ const sortedPieChartData = (0, _utils.sortSeriesData)(pieChartData, sort);
95
+ if (mode === 'percentage') {
96
+ return {
97
+ pieChartData: (0, _utils.calculatePercentages)(sortedPieChartData),
98
+ legendItems
99
+ };
100
+ }
101
+ return {
102
+ pieChartData: sortedPieChartData,
103
+ legendItems
104
+ };
105
+ }, [
106
+ calculation,
107
+ sort,
108
+ mode,
109
+ queryResults,
110
+ categoricalPalette,
111
+ visual,
112
+ muiTheme.palette.primary.main,
113
+ chartId,
114
+ querySettingsList
115
+ ]);
116
+ const contentPadding = chartsTheme.container.padding.default;
117
+ const adjustedContentDimensions = contentDimensions ? {
118
+ width: contentDimensions.width - contentPadding * 2,
119
+ height: contentDimensions.height - contentPadding * 2
120
+ } : undefined;
121
+ const legend = (0, _react.useMemo)(()=>{
122
+ return props.spec.legend && (0, _pluginsystem.validateLegendSpec)(props.spec.legend) ? (0, _merge.default)({}, _core.DEFAULT_LEGEND, props.spec.legend) : undefined;
123
+ }, [
124
+ props.spec.legend
125
+ ]);
126
+ const [selectedLegendItems, setSelectedLegendItems] = (0, _react.useState)('ALL');
127
+ const [legendSorting, setLegendSorting] = (0, _react.useState)();
128
+ const chartRef = (0, _react.useRef)(null);
129
+ // ensures there are fallbacks for unset properties since most
130
+ // users should not need to customize visual display
131
+ if (contentDimensions === undefined) return null;
132
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
133
+ sx: {
134
+ padding: `${PADDING}px`
135
+ },
136
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ContentWithLegend, {
137
+ width: adjustedContentDimensions?.width ?? 400,
138
+ height: adjustedContentDimensions?.height ?? 1000,
139
+ // Making this small enough that the medium size doesn't get
140
+ // responsive-handling-ed away when in the panel options editor.
141
+ minChildrenHeight: 50,
142
+ legendSize: legend?.size,
143
+ legendProps: legend && {
144
+ options: legend,
145
+ data: legendItems,
146
+ selectedItems: selectedLegendItems,
147
+ onSelectedItemsChange: setSelectedLegendItems,
148
+ tableProps: {
149
+ columns: [],
150
+ sorting: legendSorting,
151
+ onSortingChange: setLegendSorting
152
+ },
153
+ onItemMouseOver: (e, { id })=>{
154
+ chartRef.current?.highlightSeries({
155
+ name: id
156
+ });
157
+ },
158
+ onItemMouseOut: ()=>{
159
+ chartRef.current?.clearHighlightedSeries();
160
+ }
161
+ },
162
+ children: ({ height, width })=>{
163
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
164
+ style: {
165
+ height,
166
+ width
167
+ },
168
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.PieChart, {
169
+ data: pieChartData,
170
+ width: contentDimensions.width - PADDING * 2,
171
+ height: contentDimensions.height - PADDING * 2
172
+ })
173
+ });
174
+ }
175
+ })
176
+ });
177
+ }
@@ -0,0 +1,26 @@
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
+ const _jsxruntime = require("react/jsx-runtime");
18
+ const _react = /*#__PURE__*/ _interop_require_default(require("react"));
19
+ const _client = /*#__PURE__*/ _interop_require_default(require("react-dom/client"));
20
+ function _interop_require_default(obj) {
21
+ return obj && obj.__esModule ? obj : {
22
+ default: obj
23
+ };
24
+ }
25
+ const root = _client.default.createRoot(document.getElementById('root'));
26
+ root.render(/*#__PURE__*/ (0, _jsxruntime.jsx)(_react.default.StrictMode, {}));
@@ -0,0 +1,14 @@
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
+ /// <reference types="@rsbuild/core/types" />
14
+ "use strict";
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "getPluginModule", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return getPluginModule;
9
+ }
10
+ });
11
+ const _packagejson = /*#__PURE__*/ _interop_require_default(require("../package.json"));
12
+ function _interop_require_default(obj) {
13
+ return obj && obj.__esModule ? obj : {
14
+ default: obj
15
+ };
16
+ }
17
+ function getPluginModule() {
18
+ const { name, version, perses } = _packagejson.default;
19
+ return {
20
+ kind: 'PluginModule',
21
+ metadata: {
22
+ name,
23
+ version
24
+ },
25
+ spec: perses
26
+ };
27
+ }