@perses-dev/pie-chart-plugin 0.12.0 → 0.12.1

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 (80) hide show
  1. package/__mf/js/PieChart.b1153c53.js +6 -0
  2. package/__mf/js/async/{964.7fdfdfd5.js → 121.281eb287.js} +2 -2
  3. package/__mf/js/async/{488.a0bde6cf.js → 177.c83badab.js} +1 -1
  4. package/__mf/js/async/192.b0eb01c2.js +1 -0
  5. package/__mf/js/async/2.ba8aa6eb.js +1 -0
  6. package/__mf/js/async/217.01ced8ce.js +110 -0
  7. package/__mf/js/async/235.88141957.js +1 -0
  8. package/__mf/js/async/250.baaa2e6d.js +7 -0
  9. package/__mf/js/async/252.f2f74aad.js +22 -0
  10. package/__mf/js/async/274.78035147.js +2 -0
  11. package/__mf/js/async/322.e2f8adf7.js +2 -0
  12. package/__mf/js/async/337.13482c5c.js +1 -0
  13. package/__mf/js/async/350.7f227cc5.js +1 -0
  14. package/__mf/js/async/356.75a8af4c.js +1 -0
  15. package/__mf/js/async/392.4e64389c.js +2 -0
  16. package/__mf/js/async/469.e52e96c4.js +1 -0
  17. package/__mf/js/async/470.844ea64f.js +2 -0
  18. package/__mf/js/async/554.2692322c.js +2 -0
  19. package/__mf/js/async/{214.a7648318.js → 587.6f746ff5.js} +1 -1
  20. package/__mf/js/async/616.b6650249.js +1 -0
  21. package/__mf/js/async/663.c0629798.js +1 -0
  22. package/__mf/js/async/721.8dc45583.js +1 -0
  23. package/__mf/js/async/873.8b5831f0.js +1 -0
  24. package/__mf/js/async/941.ca6b716b.js +38 -0
  25. package/__mf/js/async/{738.5a36e399.js → 968.a62ee0f7.js} +1 -1
  26. package/__mf/js/async/__federation_expose_PieChart.af9fd247.js +1 -0
  27. package/__mf/js/async/lib-router.34969c19.js +2 -0
  28. package/__mf/js/main.75a48646.js +6 -0
  29. package/lib/PieChartBase.js +1 -1
  30. package/lib/PieChartBase.js.map +1 -1
  31. package/lib/PieChartOptionsEditorSettings.js +1 -1
  32. package/lib/PieChartOptionsEditorSettings.js.map +1 -1
  33. package/lib/PieChartPanel.js +1 -1
  34. package/lib/PieChartPanel.js.map +1 -1
  35. package/lib/bootstrap.js +1 -1
  36. package/lib/bootstrap.js.map +1 -1
  37. package/lib/cjs/colors.js +8 -8
  38. package/lib/cjs/index-federation.js +12 -12
  39. package/lib/cjs/pie-chart-model.js +5 -5
  40. package/lib/cjs/utils.js +3 -3
  41. package/mf-manifest.json +32 -32
  42. package/mf-stats.json +32 -32
  43. package/package.json +4 -4
  44. package/__mf/js/PieChart.1d58bffe.js +0 -5
  45. package/__mf/js/async/156.1cf9ec35.js +0 -1
  46. package/__mf/js/async/173.c694e6f7.js +0 -2
  47. package/__mf/js/async/264.6e9f3f27.js +0 -110
  48. package/__mf/js/async/292.67519c5b.js +0 -1
  49. package/__mf/js/async/298.e575048a.js +0 -1
  50. package/__mf/js/async/398.9b0b9c83.js +0 -1
  51. package/__mf/js/async/409.9c48d616.js +0 -1
  52. package/__mf/js/async/567.672f2dce.js +0 -2
  53. package/__mf/js/async/651.9c74cbf3.js +0 -1
  54. package/__mf/js/async/656.13055e59.js +0 -1
  55. package/__mf/js/async/694.011b21e8.js +0 -1
  56. package/__mf/js/async/706.3e6ace36.js +0 -38
  57. package/__mf/js/async/707.c77cb775.js +0 -1
  58. package/__mf/js/async/711.2e914849.js +0 -22
  59. package/__mf/js/async/75.b6a33f75.js +0 -1
  60. package/__mf/js/async/770.73dda090.js +0 -1
  61. package/__mf/js/async/863.2d634113.js +0 -2
  62. package/__mf/js/async/922.560b8115.js +0 -7
  63. package/__mf/js/async/960.021d7634.js +0 -2
  64. package/__mf/js/async/981.e6f0d188.js +0 -2
  65. package/__mf/js/async/__federation_expose_PieChart.6ae68990.js +0 -1
  66. package/__mf/js/async/lib-router.5205dc27.js +0 -2
  67. package/__mf/js/main.efe2355f.js +0 -5
  68. /package/__mf/css/async/{263.d3010b86.css → 442.d3010b86.css} +0 -0
  69. /package/__mf/css/async/{341.d3010b86.css → 61.d3010b86.css} +0 -0
  70. /package/__mf/css/async/{759.d3010b86.css → 823.d3010b86.css} +0 -0
  71. /package/__mf/js/async/{964.7fdfdfd5.js.LICENSE.txt → 121.281eb287.js.LICENSE.txt} +0 -0
  72. /package/__mf/js/async/{264.6e9f3f27.js.LICENSE.txt → 217.01ced8ce.js.LICENSE.txt} +0 -0
  73. /package/__mf/js/async/{922.560b8115.js.LICENSE.txt → 250.baaa2e6d.js.LICENSE.txt} +0 -0
  74. /package/__mf/js/async/{711.2e914849.js.LICENSE.txt → 252.f2f74aad.js.LICENSE.txt} +0 -0
  75. /package/__mf/js/async/{960.021d7634.js.LICENSE.txt → 274.78035147.js.LICENSE.txt} +0 -0
  76. /package/__mf/js/async/{863.2d634113.js.LICENSE.txt → 322.e2f8adf7.js.LICENSE.txt} +0 -0
  77. /package/__mf/js/async/{981.e6f0d188.js.LICENSE.txt → 392.4e64389c.js.LICENSE.txt} +0 -0
  78. /package/__mf/js/async/{173.c694e6f7.js.LICENSE.txt → 470.844ea64f.js.LICENSE.txt} +0 -0
  79. /package/__mf/js/async/{567.672f2dce.js.LICENSE.txt → 554.2692322c.js.LICENSE.txt} +0 -0
  80. /package/__mf/js/async/{lib-router.5205dc27.js.LICENSE.txt → lib-router.34969c19.js.LICENSE.txt} +0 -0
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  //Copyright 2024 The Perses Authors
2
3
  // Licensed under the Apache License, Version 2.0 (the "License");
3
4
  // you may not use this file except in compliance with the License.
@@ -10,7 +11,6 @@
10
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
12
  // See the License for the specific language governing permissions and
12
13
  // limitations under the License.
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { Box } from '@mui/material';
15
15
  import { ContentWithLegend, useChartsTheme, useId } from '@perses-dev/components';
16
16
  import { CalculationsMap, DEFAULT_LEGEND } from '@perses-dev/core';
@@ -1 +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 } from '@mui/material';\nimport {\n ChartInstance,\n ContentWithLegend,\n LegendItem,\n LegendProps,\n SelectedLegendItemState,\n TableColumnConfig,\n useChartsTheme,\n useId,\n} from '@perses-dev/components';\nimport { CalculationType, CalculationsMap, DEFAULT_LEGEND, TimeSeriesData } from '@perses-dev/core';\nimport { comparisonLegends, ComparisonValues, PanelProps, validateLegendSpec } from '@perses-dev/plugin-system';\nimport merge from 'lodash/merge';\nimport { ReactElement, useMemo, useRef, useState } from 'react';\nimport { PieChartOptions } from './pie-chart-model';\nimport { calculatePercentages, sortSeriesData } from './utils';\nimport { getSeriesColor } from './colors';\nimport { PieChartBase, PieChartData } from './PieChartBase';\n\nexport type PieChartPanelProps = PanelProps<PieChartOptions, TimeSeriesData>;\n\nexport function PieChartPanel(props: PieChartPanelProps): ReactElement | null {\n const {\n spec: { calculation, sort, mode, legend: pieChartLegend, colorPalette: colorPalette },\n contentDimensions,\n queryResults,\n } = props;\n const chartsTheme = useChartsTheme();\n const chartId = useId('time-series-panel');\n const seriesNames = queryResults.flatMap((result) => result?.data.series?.map((series) => series.name) || []);\n\n // Memoize the color list so it only regenerates when color/palette/series count changes\n const colorList = useMemo(() => {\n return getSeriesColor(seriesNames, colorPalette);\n }, [colorPalette, seriesNames]);\n\n const { pieChartData, legendItems, legendColumns } = useMemo(() => {\n const calculate = CalculationsMap[calculation as CalculationType];\n const pieChartData: PieChartData[] = [];\n const legendItems: LegendItem[] = [];\n const legendColumns: Array<TableColumnConfig<LegendItem>> = [];\n\n queryResults.forEach((result, queryIndex) => {\n const series = result?.data.series ?? [];\n\n series.forEach((seriesData, seriesIndex) => {\n const seriesId = `${chartId}${seriesData.name}${seriesIndex}${queryIndex}`;\n const seriesColor = colorList[queryIndex * series.length + seriesIndex] ?? '#ff0000';\n\n const seriesItem = {\n id: seriesId,\n value: calculate(seriesData.values) ?? null,\n name: seriesData.formattedName ?? '',\n itemStyle: {\n color: seriesColor,\n },\n };\n\n pieChartData.push(seriesItem);\n legendItems.push({\n id: seriesId,\n label: seriesData.formattedName ?? '',\n color: seriesColor,\n data: {},\n });\n });\n });\n\n const sortedPieChartData = sortSeriesData(pieChartData, sort);\n\n // Reorder legend items to reflect the current sorting order of series\n const valueById = new Map(sortedPieChartData.map((pd) => [pd.id ?? pd.name, pd.value ?? 0]));\n legendItems.sort((a, b) => {\n const av = valueById.get(a.id) ?? 0;\n const bv = valueById.get(b.id) ?? 0;\n return sort === 'asc' ? av - bv : bv - av;\n });\n\n if (pieChartLegend?.values?.length && pieChartLegend?.mode === 'table') {\n const { values } = pieChartLegend;\n [...values].sort().forEach((v) => {\n /* First, create a column for the current legend value */\n legendColumns.push({\n accessorKey: `data.${v}`,\n header: comparisonLegends[v as ComparisonValues]?.label || v,\n headerDescription: comparisonLegends[v as ComparisonValues]?.description,\n width: 90,\n align: 'right',\n cellDescription: true,\n enableSorting: true,\n });\n /* Then, settle the legend items related to this legend value */\n switch (v) {\n case 'abs':\n legendItems.forEach((li) => {\n const { value: itemAbsoluteValue } = pieChartData.find((pd) => li.id === pd.id) || {};\n if (typeof itemAbsoluteValue === 'number' && li.data) {\n li.data['abs'] = itemAbsoluteValue;\n }\n });\n break;\n case 'relative':\n legendItems.forEach((li) => {\n const { value: itemPercentageValue } =\n calculatePercentages(sortedPieChartData).find((ppd) => li.id === ppd.id) || {};\n if (typeof itemPercentageValue === 'number' && li.data) {\n li.data['relative'] = `${itemPercentageValue.toFixed(2)}%`;\n }\n });\n break;\n default:\n break;\n }\n });\n }\n\n return {\n pieChartData: mode === 'percentage' ? calculatePercentages(sortedPieChartData) : sortedPieChartData,\n legendItems,\n legendColumns,\n };\n }, [calculation, sort, mode, queryResults, colorList, chartId, pieChartLegend]);\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) return null;\n\n return (\n <Box sx={{ padding: `${contentPadding}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: legendColumns,\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 <PieChartBase\n data={pieChartData}\n width={width}\n height={height}\n showLabels={Boolean(props.spec.showLabels)}\n />\n </Box>\n );\n }}\n </ContentWithLegend>\n </Box>\n );\n}\n"],"names":["Box","ContentWithLegend","useChartsTheme","useId","CalculationsMap","DEFAULT_LEGEND","comparisonLegends","validateLegendSpec","merge","useMemo","useRef","useState","calculatePercentages","sortSeriesData","getSeriesColor","PieChartBase","PieChartPanel","props","spec","calculation","sort","mode","legend","pieChartLegend","colorPalette","contentDimensions","queryResults","chartsTheme","chartId","seriesNames","flatMap","result","data","series","map","name","colorList","pieChartData","legendItems","legendColumns","calculate","forEach","queryIndex","seriesData","seriesIndex","seriesId","seriesColor","length","seriesItem","id","value","values","formattedName","itemStyle","color","push","label","sortedPieChartData","valueById","Map","pd","a","b","av","get","bv","v","accessorKey","header","headerDescription","description","width","align","cellDescription","enableSorting","li","itemAbsoluteValue","find","itemPercentageValue","ppd","toFixed","contentPadding","container","padding","default","adjustedContentDimensions","height","undefined","selectedLegendItems","setSelectedLegendItems","legendSorting","setLegendSorting","chartRef","sx","minChildrenHeight","legendSize","size","legendProps","options","selectedItems","onSelectedItemsChange","tableProps","columns","sorting","onSortingChange","onItemMouseOver","e","current","highlightSeries","onItemMouseOut","clearHighlightedSeries","style","showLabels","Boolean"],"mappings":"AAAA,mCAAmC;AACnC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAEEC,iBAAiB,EAKjBC,cAAc,EACdC,KAAK,QACA,yBAAyB;AAChC,SAA0BC,eAAe,EAAEC,cAAc,QAAwB,mBAAmB;AACpG,SAASC,iBAAiB,EAAgCC,kBAAkB,QAAQ,4BAA4B;AAChH,OAAOC,WAAW,eAAe;AACjC,SAAuBC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAEhE,SAASC,oBAAoB,EAAEC,cAAc,QAAQ,UAAU;AAC/D,SAASC,cAAc,QAAQ,WAAW;AAC1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EAAE,CAAC;QAAC;kBACxC,cAAA,KAAChF;YACCsE,OAAOc,2BAA2Bd,SAAS;YAC3Ce,QAAQD,2BAA2BC,UAAU;YAC7C,4DAA4D;YAC5D,gEAAgE;YAChEQ,mBAAmB;YACnBC,YAAYzE,QAAQ0E;YACpBC,aACE3E,UAAU;gBACR4E,SAAS5E;gBACTU,MAAMM;gBACN6D,eAAeX;gBACfY,uBAAuBX;gBACvBY,YAAY;oBACVC,SAAS/D;oBACTgE,SAASb;oBACTc,iBAAiBb;gBACnB;gBACAc,iBAAiB,CAACC,GAAG,EAAEzD,EAAE,EAAE;oBACzB2C,SAASe,OAAO,EAAEC,gBAAgB;wBAAEzE,MAAMc;oBAAG;gBAC/C;gBACA4D,gBAAgB;oBACdjB,SAASe,OAAO,EAAEG;gBACpB;YACF;sBAGD,CAAC,EAAExB,MAAM,EAAEf,KAAK,EAAE;gBACjB,qBACE,KAACvE;oBAAI+G,OAAO;wBAAEzB;wBAAQf;oBAAM;8BAC1B,cAAA,KAACxD;wBACCiB,MAAMK;wBACNkC,OAAOA;wBACPe,QAAQA;wBACR0B,YAAYC,QAAQhG,MAAMC,IAAI,CAAC8F,UAAU;;;YAIjD;;;AAIR"}
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 } from '@mui/material';\nimport {\n ChartInstance,\n ContentWithLegend,\n LegendItem,\n LegendProps,\n SelectedLegendItemState,\n TableColumnConfig,\n useChartsTheme,\n useId,\n} from '@perses-dev/components';\nimport { CalculationType, CalculationsMap, DEFAULT_LEGEND, TimeSeriesData } from '@perses-dev/core';\nimport { comparisonLegends, ComparisonValues, PanelProps, validateLegendSpec } from '@perses-dev/plugin-system';\nimport merge from 'lodash/merge';\nimport { ReactElement, useMemo, useRef, useState } from 'react';\nimport { PieChartOptions } from './pie-chart-model';\nimport { calculatePercentages, sortSeriesData } from './utils';\nimport { getSeriesColor } from './colors';\nimport { PieChartBase, PieChartData } from './PieChartBase';\n\nexport type PieChartPanelProps = PanelProps<PieChartOptions, TimeSeriesData>;\n\nexport function PieChartPanel(props: PieChartPanelProps): ReactElement | null {\n const {\n spec: { calculation, sort, mode, legend: pieChartLegend, colorPalette: colorPalette },\n contentDimensions,\n queryResults,\n } = props;\n const chartsTheme = useChartsTheme();\n const chartId = useId('time-series-panel');\n const seriesNames = queryResults.flatMap((result) => result?.data.series?.map((series) => series.name) || []);\n\n // Memoize the color list so it only regenerates when color/palette/series count changes\n const colorList = useMemo(() => {\n return getSeriesColor(seriesNames, colorPalette);\n }, [colorPalette, seriesNames]);\n\n const { pieChartData, legendItems, legendColumns } = useMemo(() => {\n const calculate = CalculationsMap[calculation as CalculationType];\n const pieChartData: PieChartData[] = [];\n const legendItems: LegendItem[] = [];\n const legendColumns: Array<TableColumnConfig<LegendItem>> = [];\n\n queryResults.forEach((result, queryIndex) => {\n const series = result?.data.series ?? [];\n\n series.forEach((seriesData, seriesIndex) => {\n const seriesId = `${chartId}${seriesData.name}${seriesIndex}${queryIndex}`;\n const seriesColor = colorList[queryIndex * series.length + seriesIndex] ?? '#ff0000';\n\n const seriesItem = {\n id: seriesId,\n value: calculate(seriesData.values) ?? null,\n name: seriesData.formattedName ?? '',\n itemStyle: {\n color: seriesColor,\n },\n };\n\n pieChartData.push(seriesItem);\n legendItems.push({\n id: seriesId,\n label: seriesData.formattedName ?? '',\n color: seriesColor,\n data: {},\n });\n });\n });\n\n const sortedPieChartData = sortSeriesData(pieChartData, sort);\n\n // Reorder legend items to reflect the current sorting order of series\n const valueById = new Map(sortedPieChartData.map((pd) => [pd.id ?? pd.name, pd.value ?? 0]));\n legendItems.sort((a, b) => {\n const av = valueById.get(a.id) ?? 0;\n const bv = valueById.get(b.id) ?? 0;\n return sort === 'asc' ? av - bv : bv - av;\n });\n\n if (pieChartLegend?.values?.length && pieChartLegend?.mode === 'table') {\n const { values } = pieChartLegend;\n [...values].sort().forEach((v) => {\n /* First, create a column for the current legend value */\n legendColumns.push({\n accessorKey: `data.${v}`,\n header: comparisonLegends[v as ComparisonValues]?.label || v,\n headerDescription: comparisonLegends[v as ComparisonValues]?.description,\n width: 90,\n align: 'right',\n cellDescription: true,\n enableSorting: true,\n });\n /* Then, settle the legend items related to this legend value */\n switch (v) {\n case 'abs':\n legendItems.forEach((li) => {\n const { value: itemAbsoluteValue } = pieChartData.find((pd) => li.id === pd.id) || {};\n if (typeof itemAbsoluteValue === 'number' && li.data) {\n li.data['abs'] = itemAbsoluteValue;\n }\n });\n break;\n case 'relative':\n legendItems.forEach((li) => {\n const { value: itemPercentageValue } =\n calculatePercentages(sortedPieChartData).find((ppd) => li.id === ppd.id) || {};\n if (typeof itemPercentageValue === 'number' && li.data) {\n li.data['relative'] = `${itemPercentageValue.toFixed(2)}%`;\n }\n });\n break;\n default:\n break;\n }\n });\n }\n\n return {\n pieChartData: mode === 'percentage' ? calculatePercentages(sortedPieChartData) : sortedPieChartData,\n legendItems,\n legendColumns,\n };\n }, [calculation, sort, mode, queryResults, colorList, chartId, pieChartLegend]);\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) return null;\n\n return (\n <Box sx={{ padding: `${contentPadding}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: legendColumns,\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 <PieChartBase\n data={pieChartData}\n width={width}\n height={height}\n showLabels={Boolean(props.spec.showLabels)}\n />\n </Box>\n );\n }}\n </ContentWithLegend>\n </Box>\n );\n}\n"],"names":["Box","ContentWithLegend","useChartsTheme","useId","CalculationsMap","DEFAULT_LEGEND","comparisonLegends","validateLegendSpec","merge","useMemo","useRef","useState","calculatePercentages","sortSeriesData","getSeriesColor","PieChartBase","PieChartPanel","props","spec","calculation","sort","mode","legend","pieChartLegend","colorPalette","contentDimensions","queryResults","chartsTheme","chartId","seriesNames","flatMap","result","data","series","map","name","colorList","pieChartData","legendItems","legendColumns","calculate","forEach","queryIndex","seriesData","seriesIndex","seriesId","seriesColor","length","seriesItem","id","value","values","formattedName","itemStyle","color","push","label","sortedPieChartData","valueById","Map","pd","a","b","av","get","bv","v","accessorKey","header","headerDescription","description","width","align","cellDescription","enableSorting","li","itemAbsoluteValue","find","itemPercentageValue","ppd","toFixed","contentPadding","container","padding","default","adjustedContentDimensions","height","undefined","selectedLegendItems","setSelectedLegendItems","legendSorting","setLegendSorting","chartRef","sx","minChildrenHeight","legendSize","size","legendProps","options","selectedItems","onSelectedItemsChange","tableProps","columns","sorting","onSortingChange","onItemMouseOver","e","current","highlightSeries","onItemMouseOut","clearHighlightedSeries","style","showLabels","Boolean"],"mappings":";AAAA,mCAAmC;AACnC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAEEC,iBAAiB,EAKjBC,cAAc,EACdC,KAAK,QACA,yBAAyB;AAChC,SAA0BC,eAAe,EAAEC,cAAc,QAAwB,mBAAmB;AACpG,SAASC,iBAAiB,EAAgCC,kBAAkB,QAAQ,4BAA4B;AAChH,OAAOC,WAAW,eAAe;AACjC,SAAuBC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAEhE,SAASC,oBAAoB,EAAEC,cAAc,QAAQ,UAAU;AAC/D,SAASC,cAAc,QAAQ,WAAW;AAC1C,SAASC,YAAY,QAAsB,iBAAiB;AAI5D,OAAO,SAASC,cAAcC,KAAyB;IACrD,MAAM,EACJC,MAAM,EAAEC,WAAW,EAAEC,IAAI,EAAEC,IAAI,EAAEC,QAAQC,cAAc,EAAEC,cAAcA,YAAY,EAAE,EACrFC,iBAAiB,EACjBC,YAAY,EACb,GAAGT;IACJ,MAAMU,cAAczB;IACpB,MAAM0B,UAAUzB,MAAM;IACtB,MAAM0B,cAAcH,aAAaI,OAAO,CAAC,CAACC,SAAWA,QAAQC,KAAKC,QAAQC,IAAI,CAACD,SAAWA,OAAOE,IAAI,KAAK,EAAE;IAE5G,wFAAwF;IACxF,MAAMC,YAAY3B,QAAQ;QACxB,OAAOK,eAAee,aAAaL;IACrC,GAAG;QAACA;QAAcK;KAAY;IAE9B,MAAM,EAAEQ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GD,CAAC,EAAExB,MAAM,EAAEf,KAAK,EAAE;gBACjB,qBACE,KAACvE;oBAAI+G,OAAO;wBAAEzB;wBAAQf;oBAAM;8BAC1B,cAAA,KAACxD;wBACCiB,MAAMK;wBACNkC,OAAOA;wBACPe,QAAQA;wBACR0B,YAAYC,QAAQhG,MAAMC,IAAI,CAAC8F,UAAU;;;YAIjD;;;AAIR"}
package/lib/bootstrap.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  // Copyright 2024 The Perses Authors
2
3
  // Licensed under the Apache License, Version 2.0 (the "License");
3
4
  // you may not use this file except in compliance with the License.
@@ -10,7 +11,6 @@
10
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
12
  // See the License for the specific language governing permissions and
12
13
  // limitations under the License.
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import React from 'react';
15
15
  import ReactDOM from 'react-dom/client';
16
16
  const root = ReactDOM.createRoot(document.getElementById('root'));
@@ -1 +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"}
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"}
package/lib/cjs/colors.js CHANGED
@@ -17,29 +17,29 @@ Object.defineProperty(exports, "__esModule", {
17
17
  function _export(target, all) {
18
18
  for(var name in all)Object.defineProperty(target, name, {
19
19
  enumerable: true,
20
- get: all[name]
20
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- generateGradientColor: function() {
24
+ get generateGradientColor () {
25
25
  return generateGradientColor;
26
26
  },
27
- getAutoPaletteColor: function() {
27
+ get getAutoPaletteColor () {
28
28
  return getAutoPaletteColor;
29
29
  },
30
- getColor: function() {
30
+ get getColor () {
31
31
  return getColor;
32
32
  },
33
- getConsistentColor: function() {
33
+ get getConsistentColor () {
34
34
  return getConsistentColor;
35
35
  },
36
- getConsistentSeriesNameColor: function() {
36
+ get getConsistentSeriesNameColor () {
37
37
  return getConsistentSeriesNameColor;
38
38
  },
39
- getDefaultSeriesColor: function() {
39
+ get getDefaultSeriesColor () {
40
40
  return getDefaultSeriesColor;
41
41
  },
42
- getSeriesColor: function() {
42
+ get getSeriesColor () {
43
43
  return getSeriesColor;
44
44
  }
45
45
  });
@@ -1,15 +1,3 @@
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
1
  "use strict";
14
2
  function _getRequireWildcardCache(nodeInterop) {
15
3
  if (typeof WeakMap !== "function") return null;
@@ -52,4 +40,16 @@ function _interop_require_wildcard(obj, nodeInterop) {
52
40
  }
53
41
  return newObj;
54
42
  }
43
+ // Copyright 2024 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
55
  Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./bootstrap")));
@@ -17,20 +17,20 @@ Object.defineProperty(exports, "__esModule", {
17
17
  function _export(target, all) {
18
18
  for(var name in all)Object.defineProperty(target, name, {
19
19
  enumerable: true,
20
- get: all[name]
20
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- DEFAULT_FORMAT: function() {
24
+ get DEFAULT_FORMAT () {
25
25
  return DEFAULT_FORMAT;
26
26
  },
27
- DEFAULT_MODE: function() {
27
+ get DEFAULT_MODE () {
28
28
  return DEFAULT_MODE;
29
29
  },
30
- DEFAULT_SORT: function() {
30
+ get DEFAULT_SORT () {
31
31
  return DEFAULT_SORT;
32
32
  },
33
- createInitialPieChartOptions: function() {
33
+ get createInitialPieChartOptions () {
34
34
  return createInitialPieChartOptions;
35
35
  }
36
36
  });
package/lib/cjs/utils.js CHANGED
@@ -17,14 +17,14 @@ Object.defineProperty(exports, "__esModule", {
17
17
  function _export(target, all) {
18
18
  for(var name in all)Object.defineProperty(target, name, {
19
19
  enumerable: true,
20
- get: all[name]
20
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- calculatePercentages: function() {
24
+ get calculatePercentages () {
25
25
  return calculatePercentages;
26
26
  },
27
- sortSeriesData: function() {
27
+ get sortSeriesData () {
28
28
  return sortSeriesData;
29
29
  }
30
30
  });
package/mf-manifest.json CHANGED
@@ -5,11 +5,11 @@
5
5
  "name": "PieChart",
6
6
  "type": "app",
7
7
  "buildInfo": {
8
- "buildVersion": "0.12.0",
8
+ "buildVersion": "0.12.1",
9
9
  "buildName": "@perses-dev/pie-chart-plugin"
10
10
  },
11
11
  "remoteEntry": {
12
- "name": "__mf/js/PieChart.1d58bffe.js",
12
+ "name": "__mf/js/PieChart.b1153c53.js",
13
13
  "path": "",
14
14
  "type": "global"
15
15
  },
@@ -20,7 +20,7 @@
20
20
  "api": ""
21
21
  },
22
22
  "globalName": "PieChart",
23
- "pluginVersion": "0.19.1",
23
+ "pluginVersion": "0.21.6",
24
24
  "prefetchInterface": false,
25
25
  "getPublicPath": "function() { const prefix = window.PERSES_PLUGIN_ASSETS_PATH || window.PERSES_APP_CONFIG?.api_prefix || \"\"; return prefix + \"/plugins/PieChart/\"; }"
26
26
  },
@@ -35,7 +35,7 @@
35
35
  "js": {
36
36
  "async": [],
37
37
  "sync": [
38
- "__mf/js/async/960.021d7634.js"
38
+ "__mf/js/async/274.78035147.js"
39
39
  ]
40
40
  },
41
41
  "css": {
@@ -54,8 +54,8 @@
54
54
  "js": {
55
55
  "async": [],
56
56
  "sync": [
57
- "__mf/js/async/694.011b21e8.js",
58
- "__mf/js/async/770.73dda090.js"
57
+ "__mf/js/async/235.88141957.js",
58
+ "__mf/js/async/616.b6650249.js"
59
59
  ]
60
60
  },
61
61
  "css": {
@@ -74,8 +74,8 @@
74
74
  "js": {
75
75
  "async": [],
76
76
  "sync": [
77
- "__mf/js/async/214.a7648318.js",
78
- "__mf/js/async/738.5a36e399.js"
77
+ "__mf/js/async/587.6f746ff5.js",
78
+ "__mf/js/async/968.a62ee0f7.js"
79
79
  ]
80
80
  },
81
81
  "css": {
@@ -87,14 +87,14 @@
87
87
  {
88
88
  "id": "PieChart:@perses-dev/components",
89
89
  "name": "@perses-dev/components",
90
- "version": "0.53.0-beta.1",
90
+ "version": "0.53.0-beta.2",
91
91
  "singleton": true,
92
- "requiredVersion": "^0.53.0-beta.1",
92
+ "requiredVersion": "^0.53.0-beta.2",
93
93
  "assets": {
94
94
  "js": {
95
95
  "async": [],
96
96
  "sync": [
97
- "__mf/js/async/922.560b8115.js"
97
+ "__mf/js/async/250.baaa2e6d.js"
98
98
  ]
99
99
  },
100
100
  "css": {
@@ -106,14 +106,14 @@
106
106
  {
107
107
  "id": "PieChart:@perses-dev/plugin-system",
108
108
  "name": "@perses-dev/plugin-system",
109
- "version": "0.53.0-beta.1",
109
+ "version": "0.53.0-beta.2",
110
110
  "singleton": true,
111
- "requiredVersion": "^0.53.0-beta.1",
111
+ "requiredVersion": "^0.53.0-beta.2",
112
112
  "assets": {
113
113
  "js": {
114
114
  "async": [],
115
115
  "sync": [
116
- "__mf/js/async/711.2e914849.js"
116
+ "__mf/js/async/252.f2f74aad.js"
117
117
  ]
118
118
  },
119
119
  "css": {
@@ -132,7 +132,7 @@
132
132
  "js": {
133
133
  "async": [],
134
134
  "sync": [
135
- "__mf/js/async/75.b6a33f75.js"
135
+ "__mf/js/async/192.b0eb01c2.js"
136
136
  ]
137
137
  },
138
138
  "css": {
@@ -151,7 +151,7 @@
151
151
  "js": {
152
152
  "async": [],
153
153
  "sync": [
154
- "__mf/js/async/409.9c48d616.js"
154
+ "__mf/js/async/873.8b5831f0.js"
155
155
  ]
156
156
  },
157
157
  "css": {
@@ -170,7 +170,7 @@
170
170
  "js": {
171
171
  "async": [],
172
172
  "sync": [
173
- "__mf/js/async/981.e6f0d188.js"
173
+ "__mf/js/async/392.4e64389c.js"
174
174
  ]
175
175
  },
176
176
  "css": {
@@ -189,7 +189,7 @@
189
189
  "js": {
190
190
  "async": [],
191
191
  "sync": [
192
- "__mf/js/async/173.c694e6f7.js"
192
+ "__mf/js/async/470.844ea64f.js"
193
193
  ]
194
194
  },
195
195
  "css": {
@@ -208,7 +208,7 @@
208
208
  "js": {
209
209
  "async": [],
210
210
  "sync": [
211
- "__mf/js/async/964.7fdfdfd5.js"
211
+ "__mf/js/async/121.281eb287.js"
212
212
  ]
213
213
  },
214
214
  "css": {
@@ -226,26 +226,26 @@
226
226
  "assets": {
227
227
  "js": {
228
228
  "sync": [
229
- "__mf/js/async/567.672f2dce.js",
230
- "__mf/js/async/264.6e9f3f27.js",
231
- "__mf/js/async/298.e575048a.js",
232
- "__mf/js/async/707.c77cb775.js",
233
- "__mf/js/async/__federation_expose_PieChart.6ae68990.js"
229
+ "__mf/js/async/554.2692322c.js",
230
+ "__mf/js/async/217.01ced8ce.js",
231
+ "__mf/js/async/721.8dc45583.js",
232
+ "__mf/js/async/337.13482c5c.js",
233
+ "__mf/js/async/__federation_expose_PieChart.af9fd247.js"
234
234
  ],
235
235
  "async": [
236
- "__mf/js/async/lib-router.5205dc27.js",
237
- "__mf/js/async/292.67519c5b.js",
238
- "__mf/js/async/706.3e6ace36.js",
239
- "__mf/js/async/488.a0bde6cf.js",
240
- "__mf/js/async/398.9b0b9c83.js",
241
- "__mf/js/async/156.1cf9ec35.js"
236
+ "__mf/js/async/lib-router.34969c19.js",
237
+ "__mf/js/async/356.75a8af4c.js",
238
+ "__mf/js/async/941.ca6b716b.js",
239
+ "__mf/js/async/177.c83badab.js",
240
+ "__mf/js/async/469.e52e96c4.js",
241
+ "__mf/js/async/663.c0629798.js"
242
242
  ]
243
243
  },
244
244
  "css": {
245
245
  "sync": [],
246
246
  "async": [
247
- "__mf/css/async/263.d3010b86.css",
248
- "__mf/css/async/341.d3010b86.css"
247
+ "__mf/css/async/823.d3010b86.css",
248
+ "__mf/css/async/61.d3010b86.css"
249
249
  ]
250
250
  }
251
251
  },
package/mf-stats.json CHANGED
@@ -5,11 +5,11 @@
5
5
  "name": "PieChart",
6
6
  "type": "app",
7
7
  "buildInfo": {
8
- "buildVersion": "0.12.0",
8
+ "buildVersion": "0.12.1",
9
9
  "buildName": "@perses-dev/pie-chart-plugin"
10
10
  },
11
11
  "remoteEntry": {
12
- "name": "__mf/js/PieChart.1d58bffe.js",
12
+ "name": "__mf/js/PieChart.b1153c53.js",
13
13
  "path": "",
14
14
  "type": "global"
15
15
  },
@@ -20,7 +20,7 @@
20
20
  "api": ""
21
21
  },
22
22
  "globalName": "PieChart",
23
- "pluginVersion": "0.19.1",
23
+ "pluginVersion": "0.21.6",
24
24
  "prefetchInterface": false,
25
25
  "getPublicPath": "function() { const prefix = window.PERSES_PLUGIN_ASSETS_PATH || window.PERSES_APP_CONFIG?.api_prefix || \"\"; return prefix + \"/plugins/PieChart/\"; }"
26
26
  },
@@ -37,7 +37,7 @@
37
37
  "js": {
38
38
  "async": [],
39
39
  "sync": [
40
- "__mf/js/async/960.021d7634.js"
40
+ "__mf/js/async/274.78035147.js"
41
41
  ]
42
42
  },
43
43
  "css": {
@@ -59,8 +59,8 @@
59
59
  "js": {
60
60
  "async": [],
61
61
  "sync": [
62
- "__mf/js/async/694.011b21e8.js",
63
- "__mf/js/async/770.73dda090.js"
62
+ "__mf/js/async/235.88141957.js",
63
+ "__mf/js/async/616.b6650249.js"
64
64
  ]
65
65
  },
66
66
  "css": {
@@ -82,8 +82,8 @@
82
82
  "js": {
83
83
  "async": [],
84
84
  "sync": [
85
- "__mf/js/async/214.a7648318.js",
86
- "__mf/js/async/738.5a36e399.js"
85
+ "__mf/js/async/587.6f746ff5.js",
86
+ "__mf/js/async/968.a62ee0f7.js"
87
87
  ]
88
88
  },
89
89
  "css": {
@@ -95,17 +95,17 @@
95
95
  },
96
96
  {
97
97
  "singleton": true,
98
- "requiredVersion": "^0.53.0-beta.1",
98
+ "requiredVersion": "^0.53.0-beta.2",
99
99
  "shareScope": "default",
100
100
  "name": "@perses-dev/components",
101
- "version": "0.53.0-beta.1",
101
+ "version": "0.53.0-beta.2",
102
102
  "eager": false,
103
103
  "id": "PieChart:@perses-dev/components",
104
104
  "assets": {
105
105
  "js": {
106
106
  "async": [],
107
107
  "sync": [
108
- "__mf/js/async/922.560b8115.js"
108
+ "__mf/js/async/250.baaa2e6d.js"
109
109
  ]
110
110
  },
111
111
  "css": {
@@ -119,17 +119,17 @@
119
119
  },
120
120
  {
121
121
  "singleton": true,
122
- "requiredVersion": "^0.53.0-beta.1",
122
+ "requiredVersion": "^0.53.0-beta.2",
123
123
  "shareScope": "default",
124
124
  "name": "@perses-dev/plugin-system",
125
- "version": "0.53.0-beta.1",
125
+ "version": "0.53.0-beta.2",
126
126
  "eager": false,
127
127
  "id": "PieChart:@perses-dev/plugin-system",
128
128
  "assets": {
129
129
  "js": {
130
130
  "async": [],
131
131
  "sync": [
132
- "__mf/js/async/711.2e914849.js"
132
+ "__mf/js/async/252.f2f74aad.js"
133
133
  ]
134
134
  },
135
135
  "css": {
@@ -153,7 +153,7 @@
153
153
  "js": {
154
154
  "async": [],
155
155
  "sync": [
156
- "__mf/js/async/75.b6a33f75.js"
156
+ "__mf/js/async/192.b0eb01c2.js"
157
157
  ]
158
158
  },
159
159
  "css": {
@@ -175,7 +175,7 @@
175
175
  "js": {
176
176
  "async": [],
177
177
  "sync": [
178
- "__mf/js/async/409.9c48d616.js"
178
+ "__mf/js/async/873.8b5831f0.js"
179
179
  ]
180
180
  },
181
181
  "css": {
@@ -197,7 +197,7 @@
197
197
  "js": {
198
198
  "async": [],
199
199
  "sync": [
200
- "__mf/js/async/981.e6f0d188.js"
200
+ "__mf/js/async/392.4e64389c.js"
201
201
  ]
202
202
  },
203
203
  "css": {
@@ -219,7 +219,7 @@
219
219
  "js": {
220
220
  "async": [],
221
221
  "sync": [
222
- "__mf/js/async/173.c694e6f7.js"
222
+ "__mf/js/async/470.844ea64f.js"
223
223
  ]
224
224
  },
225
225
  "css": {
@@ -241,7 +241,7 @@
241
241
  "js": {
242
242
  "async": [],
243
243
  "sync": [
244
- "__mf/js/async/964.7fdfdfd5.js"
244
+ "__mf/js/async/121.281eb287.js"
245
245
  ]
246
246
  },
247
247
  "css": {
@@ -269,26 +269,26 @@
269
269
  "assets": {
270
270
  "js": {
271
271
  "sync": [
272
- "__mf/js/async/567.672f2dce.js",
273
- "__mf/js/async/264.6e9f3f27.js",
274
- "__mf/js/async/298.e575048a.js",
275
- "__mf/js/async/707.c77cb775.js",
276
- "__mf/js/async/__federation_expose_PieChart.6ae68990.js"
272
+ "__mf/js/async/554.2692322c.js",
273
+ "__mf/js/async/217.01ced8ce.js",
274
+ "__mf/js/async/721.8dc45583.js",
275
+ "__mf/js/async/337.13482c5c.js",
276
+ "__mf/js/async/__federation_expose_PieChart.af9fd247.js"
277
277
  ],
278
278
  "async": [
279
- "__mf/js/async/lib-router.5205dc27.js",
280
- "__mf/js/async/292.67519c5b.js",
281
- "__mf/js/async/706.3e6ace36.js",
282
- "__mf/js/async/488.a0bde6cf.js",
283
- "__mf/js/async/398.9b0b9c83.js",
284
- "__mf/js/async/156.1cf9ec35.js"
279
+ "__mf/js/async/lib-router.34969c19.js",
280
+ "__mf/js/async/356.75a8af4c.js",
281
+ "__mf/js/async/941.ca6b716b.js",
282
+ "__mf/js/async/177.c83badab.js",
283
+ "__mf/js/async/469.e52e96c4.js",
284
+ "__mf/js/async/663.c0629798.js"
285
285
  ]
286
286
  },
287
287
  "css": {
288
288
  "sync": [],
289
289
  "async": [
290
- "__mf/css/async/263.d3010b86.css",
291
- "__mf/css/async/341.d3010b86.css"
290
+ "__mf/css/async/823.d3010b86.css",
291
+ "__mf/css/async/61.d3010b86.css"
292
292
  ]
293
293
  }
294
294
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/pie-chart-plugin",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "homepage": "https://github.com/perses/plugins/blob/main/README.md",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,9 +27,9 @@
27
27
  "@emotion/react": "^11.7.1",
28
28
  "@emotion/styled": "^11.6.0",
29
29
  "@hookform/resolvers": "^3.2.0",
30
- "@perses-dev/components": "^0.53.0-beta.1",
31
- "@perses-dev/core": "^0.53.0-beta.1",
32
- "@perses-dev/plugin-system": "^0.53.0-beta.1",
30
+ "@perses-dev/components": "^0.53.0-beta.2",
31
+ "@perses-dev/core": "^0.53.0-beta.2",
32
+ "@perses-dev/plugin-system": "^0.53.0-beta.2",
33
33
  "date-fns": "^4.1.0",
34
34
  "date-fns-tz": "^3.2.0",
35
35
  "echarts": "5.5.0",