@perses-dev/pie-chart-plugin 0.13.0-rc.1 → 0.13.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.
- package/__mf/js/{PieChart.2d322ee8.js → PieChart.1d9ff92c.js} +3 -3
- package/__mf/js/async/253.4239fca0.js +24 -0
- package/__mf/js/async/392.2780a75e.js +2 -0
- package/__mf/js/async/{634.3952d370.js → 634.282182cd.js} +1 -1
- package/__mf/js/async/901.b80f4764.js +7 -0
- package/__mf/js/async/__federation_expose_PieChart.d3aa3268.js +4 -0
- package/__mf/js/{main.fa5b840e.js → main.09fdb510.js} +3 -3
- package/lib/PieChartBase.d.ts +7 -0
- package/lib/PieChartBase.d.ts.map +1 -1
- package/lib/PieChartBase.js +5 -4
- package/lib/PieChartBase.js.map +1 -1
- package/lib/PieChartOptionsEditorSettings.js.map +1 -1
- package/lib/PieChartPanel.d.ts.map +1 -1
- package/lib/PieChartPanel.js +24 -68
- package/lib/PieChartPanel.js.map +1 -1
- package/lib/cjs/PieChartBase.js +4 -3
- package/lib/cjs/PieChartPanel.js +22 -66
- package/lib/cjs/utils.js +123 -12
- package/lib/utils.d.ts +23 -6
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +112 -10
- package/lib/utils.js.map +1 -1
- package/mf-manifest.json +13 -13
- package/mf-stats.json +18 -15
- package/package.json +4 -4
- package/__mf/js/async/390.c46e492c.js +0 -7
- package/__mf/js/async/392.4e64389c.js +0 -2
- package/__mf/js/async/648.c849fcac.js +0 -22
- package/__mf/js/async/__federation_expose_PieChart.febb995f.js +0 -1
- /package/__mf/js/async/{648.c849fcac.js.LICENSE.txt → 253.4239fca0.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{392.4e64389c.js.LICENSE.txt → 392.2780a75e.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{390.c46e492c.js.LICENSE.txt → 901.b80f4764.js.LICENSE.txt} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.chunk_PieChart=self.chunk_PieChart||[]).push([["44"],{18063:function(e,t,l){l.r(t),l.d(t,{PieChart:()=>W});let r={unit:"decimal",shortValues:!0},n="desc";var a=l(62540),o=l(25632),i=l.n(o),s=l(21147),d=l(38662),u=l(51867),h=l(12826),c=l(68003),f=l(315),g=l(67987),m=l(54227),p=l(76795),v=l(97653),x=l(88091),b=l(7013),C=l(70451),j=l(74628),y=l(87680),A=l(3967);function w(e){let t=e.reduce((e,t)=>{let{value:l}=t;return e+(l??0)},0);return e.map(e=>{let l=(e.value??0)/t*100;return{...e,value:Number(l.toFixed(2))}})}var M=l(92959);let S=new M.A({hue:{min:20,max:360}}),O=new M.A({hue:{min:0,max:20}});function P(e){let t=e.toString(16);return 1===t.length?"0"+t:t}function $(e){let t=0;for(let l=0;l<e.length;l++)t=(t<<5)-t+e.charCodeAt(l),t&=t;return Math.abs(t)/0x7fffffff}function E(e,t){let l,{r,g:n,b:a}={r:parseInt((l=e.replace("#","")).substring(0,2),16),g:parseInt(l.substring(2,4),16),b:parseInt(l.substring(4,6),16)},o=Math.round(r*t),i=Math.round(n*t),s=Math.round(a*t);return`#${P(o)}${P(i)}${P(s)}`}let L={};var k=l(74653),I=l(76545),T=l(59738),_=l(90652),F=l(72106),G=l(55875),D=l(50944),z=l(37573),N=l(56599);function R(e){let{width:t,height:l,data:r,showLabels:n}=e,o=(0,u.useChartsTheme)(),i=(0,N.A)(),s={tooltip:{trigger:"item",formatter:"{b}: {c} ({d}%)",appendTo:document.body,confine:!1},series:[{type:"pie",radius:"90%",label:{show:!!n,position:"inner",fontSize:14,formatter:"{b}\n{c}",overflow:"truncate",fontWeight:"bold"},center:["50%","50%"],data:r,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}},itemStyle:{borderRadius:5,borderColor:i.palette.background.default,borderWidth:2}}]};return(0,a.jsx)(j.A,{style:{width:t,height:l},sx:{overflow:"auto"},children:(0,a.jsx)(u.EChart,{sx:{width:"100%",height:"100%"},option:s,theme:o.echartsTheme})})}(0,k.Y)([I.a,T.a,_.a,F.a,G.a,D.a,z.a]);let W={PanelComponent:function(e){let{spec:{calculation:t,sort:l,mode:r,legend:o,colorPalette:d},contentDimensions:h,queryResults:c}=e,f=(0,u.useChartsTheme)(),g=(0,u.useId)("time-series-panel"),m=c.flatMap(e=>{var t;return(null==e||null==(t=e.data.series)?void 0:t.map(e=>e.name))||[]}),p=(0,C.useMemo)(()=>(function(e,t){let l=e.length;if(l<=0)return[];let r=[];if(void 0===t){for(let t=0;t<e.length;t++){let l=function(e){let{categoricalPalette:t,muiPrimaryColor:l,seriesName:r}=e;return function(e,t){var l;let r,n;return l=e.toLowerCase().includes("error"),(n=L[r=`${e}_____${l}`])||(n=function(e,t){let[l,r,n]=t?O.hsl(e):S.hsl(e),a=`${(100*r).toFixed(0)}%`,o=`${(100*n).toFixed(0)}%`;return`hsla(${l.toFixed(2)},${a},${o},0.9)`}(e,l),L[r]=n),n??t}(r,Array.isArray(t)&&t[0]?t[0]:l)}({categoricalPalette:["#ff0000"],muiPrimaryColor:"#ff0000",seriesName:e[t]||""});r.push(l)}return r}if(1===t.length){let n=t[0]??"#ff0000";for(let e=0;e<l;e++)if(0===e)r.push(n);else{let t=(l-e)/l*1;r.push(E(n,t))}return r.sort((t,l)=>$(e[r.indexOf(t)]||"fallback")-$(e[r.indexOf(l)]||"fallback"))}for(let e=0;e<l;e++){let l=function(e,t){if(!e||0===e.length)return"#ff0000";let l=e.length,r=e[t%l]??"#ff0000";return t<l?r:E(r,Math.min(1-.2*Math.floor(t/l),1))}(t,e);r.push(l)}return l>t.length?r.sort((t,l)=>$(e[r.indexOf(t)]||"fallback")-$(e[r.indexOf(l)]||"fallback")):r})(m,d),[d,m]),{pieChartData:v,legendItems:x,legendColumns:b}=(0,C.useMemo)(()=>{var e;let a=y.Lu[t],i=[],d=[],u=[];c.forEach((e,t)=>{let l=(null==e?void 0:e.data.series)??[];l.forEach((e,r)=>{let n=`${g}${e.name}${r}${t}`,o=p[t*l.length+r]??"#ff0000",s={id:n,value:a(e.values)??null,name:e.formattedName??"",itemStyle:{color:o}};i.push(s),d.push({id:n,label:e.formattedName??"",color:o,data:{}})})});let h=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;return e.sort((e,l)=>{if(null===e.value&&null===l.value)return 0;if(null===e.value)return 1;if(null===l.value)return -1;let r=(e.value??0)-(l.value??0);return"asc"===t?r:-r})}(i,l),f=new Map(h.map(e=>[e.id??e.name,e.value??0]));if(d.sort((e,t)=>{let r=f.get(e.id)??0,n=f.get(t.id)??0;return"asc"===l?r-n:n-r}),(null==o||null==(e=o.values)?void 0:e.length)&&(null==o?void 0:o.mode)==="table"){let{values:e}=o;[...e].sort().forEach(e=>{var t,l;switch(u.push({accessorKey:`data.${e}`,header:(null==(t=s.comparisonLegends[e])?void 0:t.label)||e,headerDescription:null==(l=s.comparisonLegends[e])?void 0:l.description,width:90,align:"right",cellDescription:!0,enableSorting:!0}),e){case"abs":d.forEach(e=>{let{value:t}=i.find(t=>e.id===t.id)||{};"number"==typeof t&&e.data&&(e.data.abs=t)});break;case"relative":d.forEach(e=>{let{value:t}=w(h).find(t=>e.id===t.id)||{};"number"==typeof t&&e.data&&(e.data.relative=`${t.toFixed(2)}%`)})}})}return{pieChartData:"percentage"===r?w(h):h,legendItems:d,legendColumns:u}},[t,l,r,c,p,g,o]),M=f.container.padding.default,P=h?{width:h.width-2*M,height:h.height-2*M}:void 0,k=(0,C.useMemo)(()=>e.spec.legend&&(0,s.validateLegendSpec)(e.spec.legend)?i()({},A.yf,e.spec.legend):void 0,[e.spec.legend]),[I,T]=(0,C.useState)("ALL"),[_,F]=(0,C.useState)(),G=(0,C.useRef)(null);return h?(0,a.jsx)(j.A,{sx:{padding:`${M}px`},children:(0,a.jsx)(u.ContentWithLegend,{width:(null==P?void 0:P.width)??400,height:(null==P?void 0:P.height)??1e3,minChildrenHeight:50,legendSize:null==k?void 0:k.size,legendProps:k&&{options:k,data:x,selectedItems:I,onSelectedItemsChange:T,tableProps:{columns:b,sorting:_,onSortingChange:F},onItemMouseOver:(e,t)=>{var l;let{id:r}=t;null==(l=G.current)||l.highlightSeries({name:r})},onItemMouseOut:()=>{var e;null==(e=G.current)||e.clearHighlightedSeries()}},children:t=>{let{height:l,width:r}=t;return(0,a.jsx)(j.A,{style:{height:l,width:r},children:(0,a.jsx)(R,{data:v,width:r,height:l,showLabels:!!e.spec.showLabels})})}})}):null},panelOptionsEditorComponents:[{label:"Settings",content:function(e){let{onChange:t,value:l}=e,n=(0,u.useChartsTheme)().echartsTheme.color,o=(0,C.useMemo)(()=>l.colorPalette||void 0,[l.colorPalette]),j=e=>{t((0,d.jM)(l,t=>{Array.isArray(e)?t.colorPalette=e:"string"==typeof e?t.colorPalette=[e]:t.colorPalette=void 0}))},y=i()({},r,l.format),A=(0,C.useMemo)(()=>Array.isArray(o)?1===o.length?"gradient":"theme":"default",[o]),w=(0,C.useMemo)(()=>void 0===o?"Colors will be automatically assigned using metrics name hash.":Array.isArray(o)&&o.length>1?"Colors will be automatically assigned using the current theme color palette.":Array.isArray(o)&&1===o.length?"All series will use a gradient based on the selected color.":void 0,[o]);return(0,a.jsxs)(u.OptionsEditorGrid,{children:[(0,a.jsxs)(u.OptionsEditorColumn,{children:[(0,a.jsx)(s.LegendOptionsEditor,{calculation:"comparison",value:l.legend,onChange:e=>{t((0,d.jM)(l,t=>{t.legend=e}))}}),(0,a.jsxs)(u.OptionsEditorGroup,{title:"Misc",children:[(0,a.jsx)(u.OptionsEditorControl,{label:"Show Labels",control:(0,a.jsx)(c.A,{checked:!!l.showLabels,onChange:(e,r)=>{t((0,d.jM)(l,e=>{e.showLabels=r}))}})}),(0,a.jsx)(u.FormatControls,{value:y,onChange:e=>{t((0,d.jM)(l,t=>{t.format=e}))},disabled:"percentage"===l.mode}),(0,a.jsx)(s.CalculationSelector,{value:l.calculation,onChange:e=>{t((0,d.jM)(l,t=>{t.calculation=e}))}}),(0,a.jsx)(u.SortSelector,{value:l.sort,onChange:e=>{t((0,d.jM)(l,t=>{t.sort=e}))}}),(0,a.jsx)(u.ModeSelector,{value:l.mode,onChange:e=>{t((0,d.jM)(l,t=>{t.mode=e}))},disablePercentageMode:(0,h.GU)(y)})]})]}),(0,a.jsxs)(u.OptionsEditorColumn,{children:[(0,a.jsx)(u.OptionsEditorGroup,{title:"Colors",children:(0,a.jsxs)(f.A,{spacing:2,children:[(0,a.jsxs)(f.A,{direction:"row",spacing:2,alignItems:"center",children:[(0,a.jsxs)(g.A,{size:"small",sx:{minWidth:150},children:[(0,a.jsx)(m.A,{children:"Color Scheme"}),(0,a.jsxs)(p.A,{value:A,label:"Color Scheme",onChange:e=>(e=>{if("theme"===e)j(n);else if("default"===e)j();else{if(Array.isArray(o)&&1===o.length)return;j(["#ff0000"])}})(e.target.value),children:[(0,a.jsx)(v.A,{value:"default",children:"Default"}),(0,a.jsx)(v.A,{value:"theme",children:"Theme"}),(0,a.jsx)(v.A,{value:"gradient",children:"Gradient"})]})]}),Array.isArray(o)&&1===o.length&&(0,a.jsx)(u.OptionsColorPicker,{label:"Color",color:(null==o?void 0:o[0])??n[0]??"#ff0000",onColorChange:e=>j([e])})]}),w&&(0,a.jsx)(x.A,{variant:"body2",color:"text.secondary",children:w})]})}),(0,a.jsx)(u.OptionsEditorGroup,{title:"Reset Settings",children:(0,a.jsx)(b.A,{variant:"outlined",color:"secondary",onClick:()=>{t((0,d.jM)(l,e=>{e.legend=void 0,e.colorPalette=void 0}))},children:"Reset To Defaults"})})]})]})}}],supportedQueryTypes:["TimeSeriesQuery"],createInitialOptions:function(){return{calculation:"last",format:r,mode:"value",radius:50,showLabels:!1,sort:n}}}}}]);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|