UNPKG

vue-data-ui

Version:

A user-empowering data visualization Vue 3 components library for eloquent data storytelling

18 lines (17 loc) • 33.6 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),r=require("./index-B7zOq_yO.cjs"),Se=require("./useResponsive-DQmBAoBf.cjs"),Ke=require("./Title-LLvOAGEi.cjs"),Ve=require("./usePrinter-u4erwqXt.cjs"),Qe=require("./DataTable-DypMcnH2.cjs"),Ze=require("./Tooltip-B1xW8AQT.cjs"),je=require("./Legend-DUZ-tBhF.cjs"),et=require("./vue-ui-skeleton-Br6xw2QW.cjs"),tt=require("./vue-ui-accordion-DkOSgEPp.cjs"),Ee=require("./useNestedProp-DUH233CH.cjs"),lt=require("./PackageVersion-BS7Jybcw.cjs"),at=require("./PenAndPaper-CU0ABvzv.cjs"),ot=require("./useUserOptionState-BgepsfED.cjs"),nt=require("./useChartAccessibility-Cm7nkzTG.cjs"),st=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),rt=["id"],ut=["xmlns","viewBox"],it=["width","height"],ct=["id"],dt=["offset","stop-color"],vt=["offset","stop-opacity"],ft=["id"],pt=["id"],ht=["id"],yt=["flood-color"],mt=["d","fill","stroke","stroke-width","filter"],bt={key:1},gt=["d","fill"],kt={key:2},wt=["x","y","font-size","font-weight","fill"],Ct={key:3},Lt=["filter"],$t=["opacity","text-anchor","x","y","fill","font-size","font-weight"],xt=["opacity","text-anchor","x","y","fill","font-size","font-weight"],Bt=["text-anchor","x","y","fill","font-size","font-weight"],_t=["d","fill","onMouseenter","onClick"],Nt={key:5,class:"vue-data-ui-watermark"},St={key:0,class:"vue-ui-nested-donuts-legend-title"},Vt=["onClick"],Et=["innerHTML"],Tt={__name:"vue-ui-nested-donuts",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:["selectLegend","selectDatapoint"],setup(Te,{expose:Fe,emit:Oe}){const{vue_ui_nested_donuts:Ae}=r.useConfig(),b=Te,E=e.computed(()=>!!b.dataset&&b.dataset.length),p=e.ref(r.createUid()),M=e.ref(!1),R=e.ref(""),ze=e.ref(null),le=e.ref(0),N=e.ref(null),ae=e.ref(null),q=e.ref(null),oe=e.ref(null),ne=e.ref(null),se=e.ref(0),re=e.ref(0),ue=e.ref(0),x=e.ref(!0),B=e.ref([]),S=e.ref([]),_=e.ref(!1);function Pe(a){_.value=a,le.value+=1}const t=e.computed({get:()=>ve(),set:a=>a}),{userOptionsVisible:U,setUserOptionsVisibility:ie,keepUserOptionState:ce}=ot.useUserOptionState({config:t.value}),{svgRef:de}=nt.useChartAccessibility({config:t.value.style.chart.title});function ve(){const a=Ee.useNestedProp({userConfig:b.config,defaultConfig:Ae});return a.theme?{...Ee.useNestedProp({userConfig:r.themes.vue_ui_nested_donuts[a.theme]||b.config,defaultConfig:a}),customPalette:r.themePalettes[a.theme]||r.palette}:a}e.watch(()=>b.config,a=>{t.value=ve(),U.value=!t.value.userOptions.showOnChartHover,G(),se.value+=1,re.value+=1,ue.value+=1,m.value.dataLabels.show=t.value.style.chart.layout.labels.dataLabels.show,m.value.showTable=t.value.table.show,m.value.showTooltip=t.value.style.chart.tooltip.show},{deep:!0});const fe=e.computed(()=>{const{top:a,right:s,bottom:o,left:n}=t.value.style.chart.padding;return{css:`padding:${a}px ${s}px ${o}px ${n}px`,top:a,right:s,bottom:o,left:n}});function De(a,s=1e3,o=50){return new Promise(n=>{const l=a.length;B.value=Array(l).fill(0),S.value=[];let u=0;a.forEach((c,f)=>{setTimeout(()=>{const L=performance.now();function g(i){const d=Math.min((i-L)/s,1),k=r.easeOutCubic(d),Q=c*k;B.value[f]=Q,B.value=[...B.value];const D=[];let V=0;b.dataset.forEach((I,Z)=>{const Xe=I.series.reduce((ee,te)=>ee+r.sanitizeArray(te.values).reduce((We,Je)=>We+Je,0),0),He=B.value.slice(V,V+I.series.length).reduce((ee,te)=>ee+te,0),j=Xe-He;j>.001&&D.push({name:"__ghost__",arcOf:I.name,arcOfId:`${p.value}_${Z}`,id:`ghost_${p.value}_${Z}`,seriesIndex:-1,datasetIndex:Z,color:"transparent",value:j,fullValue:j,absoluteValues:[],ghost:!0}),V+=I.series.length}),S.value=D,d<1?requestAnimationFrame(g):(u+=1,u===l&&n())}requestAnimationFrame(g)},f*o)})})}e.onMounted(async()=>{var a;if(G(),(a=t.value.startAnimation)!=null&&a.show){const o=b.dataset.flatMap(n=>n.series).map(n=>r.sanitizeArray(n.values).reduce((l,u)=>l+u,0));B.value=o.map(()=>0),x.value=!0,S.value=b.dataset.map((n,l)=>{const u=n.series.reduce((c,f)=>c+r.sanitizeArray(f.values).reduce((L,g)=>L+g,0),0);return{name:"__ghost__",arcOf:n.name,arcOfId:`${p.value}_${l}`,id:`ghost_${p.value}_${l}`,seriesIndex:-1,datasetIndex:l,color:"transparent",value:u,fullValue:u,absoluteValues:[],ghost:!0}}),await e.nextTick(),De(o,t.value.startAnimation.durationMs,t.value.startAnimation.staggerMs).then(()=>{x.value=!1,S.value=[]})}else x.value=!1});const T=e.ref(null);e.onMounted(()=>{G()});function G(){if(r.objectIsEmpty(b.dataset)&&r.error({componentName:"VueUiNestedDonuts",type:"dataset"}),t.value.responsive){const a=Se.throttle(()=>{const{width:s,height:o}=Se.useResponsive({chart:N.value,title:t.value.style.chart.title.text?ae.value:null,legend:t.value.style.chart.legend.show?q.value:null,source:oe.value,noTitle:ne.value,padding:fe.value});requestAnimationFrame(()=>{v.value.width=s,v.value.height=o})});T.value=new ResizeObserver(a),T.value.observe(N.value.parentNode)}}e.onBeforeUnmount(()=>{T.value&&T.value.disconnect()});const{isPrinting:pe,isImaging:he,generatePdf:ye,generateImage:me}=Ve.usePrinter({elementId:`nested_donuts_${p.value}`,fileName:t.value.style.chart.title.text||"vue-ui-nested-donuts",options:t.value.userOptions.print}),Ie=e.computed(()=>t.value.userOptions.show&&!t.value.style.chart.title.text),Me=e.computed(()=>r.convertCustomPalette(t.value.customPalette)),m=e.ref({dataLabels:{show:t.value.style.chart.layout.labels.dataLabels.show},showTable:t.value.table.show,showTooltip:t.value.style.chart.tooltip.show}),v=e.ref({height:512,width:512}),be=Oe;function Re({datapoint:a,index:s}){be("selectDatapoint",{datapoint:a,index:s})}function ge({from:a,to:s,duration:o,onUpdate:n,onDone:l,easing:u=r.easeOutCubic}){const c=performance.now();function f(L){const g=Math.min((L-c)/o,1),i=u(g),d=a+(s-a)*i;n(d,g),g<1?requestAnimationFrame(f):(n(s,1),l&&l())}requestAnimationFrame(f)}const y=e.ref([]),w=e.computed(()=>{b.dataset.forEach((s,o)=>{[null,void 0].includes(s.name)&&r.error({componentName:"VueUiNestedDonuts",type:"datasetSerieAttribute",property:"name",index:o}),[null,void 0].includes(s.series)?r.error({componentName:"VueUiNestedDonuts",type:"datasetSerieAttribute",property:"series",index:o}):s.series.length===0?r.error({componentName:"VueUiNestedDonuts",type:"datasetAttributeEmpty",property:`series at index ${o}`}):s.series.forEach((n,l)=>{[null,void 0].includes(n.name)&&r.error({componentName:"VueUiNestedDonuts",type:"datasetSerieAttribute",property:"name",index:l,key:"serie"}),[null,void 0].includes(n.values)&&r.error({componentName:"VueUiNestedDonuts",type:"datasetSerieAttribute",property:"values",index:l,key:"serie"})})});let a=0;return b.dataset.map((s,o)=>({...s,total:s.series.filter(n=>!y.value.includes(n.id)).map(n=>r.sanitizeArray(n.values).reduce((l,u)=>l+u,0)).reduce((n,l)=>n+l,0),datasetIndex:o,id:`${p.value}_${o}`,series:s.series.map((n,l)=>{const u=r.sanitizeArray(n.values).reduce((c,f)=>c+f,0);return{name:n.name,arcOf:s.name,arcOfId:`${p.value}_${o}`,id:`${p.value}_${o}_${l}`,seriesIndex:l,datasetIndex:o,color:r.convertColorToHex(n.color)||Me.value[l]||r.palette[l%r.palette.length],value:x.value?B.value[a++]??0:u,absoluteValues:n.values||[]}})}))}),C=e.computed(()=>Math.min(v.value.height,v.value.width)*(t.value.style.chart.layout.donut.strokeWidth/512)),ke=e.computed(()=>[...w.value].map((a,s)=>{const o=a.series.filter(n=>!y.value.includes(n.id)).map(n=>n.value).reduce((n,l)=>n+l,0);return{...a,total:o,series:a.series.filter(n=>!y.value.includes(n.id)).map(n=>({...n,proportion:n.value/o}))}}));function qe(a,s,o){let n=0;for(let l=0;l<a.length;l+=1)o.includes(a[l])&&(n+=1);return n<s}const h=e.ref(ke.value);e.watch(()=>ke.value,a=>h.value=a);function Y(a){var g;be("selectLegend",a);const s=b.dataset.flatMap((i,d)=>i.series.map((k,Q)=>({value:r.sanitizeArray(k.values).reduce((D,V)=>D+V,0),id:`${p.value}_${d}_${Q}`,arcOfId:`${p.value}_${d}`}))).find(i=>i.id===a.id);if(!s)return;const o=((g=w.value.flatMap(i=>i.series).find(i=>i.id===a.id))==null?void 0:g.value)??0,n=h.value.flatMap(i=>i.series).find(i=>i.id===a.id);let u=n?n.value:0;const c=w.value.find(i=>i.id===s.arcOfId);if(!c)return;const f=c.series.map(i=>i.id),L=qe(f,f.length-1,y.value);y.value.includes(a.id)?(y.value=y.value.filter(i=>i!==a.id),t.value.serieToggleAnimation.show?ge({from:u,to:o,duration:t.value.serieToggleAnimation.durationMs,onUpdate:i=>{h.value=h.value.map(d=>({...d,series:d.series.map(k=>k.id===a.id?{...k,value:i}:k)}))}}):h.value=h.value.map(i=>({...i,series:i.series.map(d=>d.id===a.id?{...d,value:o}:d)}))):L&&(t.value.serieToggleAnimation.show?ge({from:u,to:0,duration:t.value.serieToggleAnimation.durationMs,onUpdate:i=>{h.value=h.value.map(d=>({...d,series:d.series.map(k=>k.id===a.id?{...k,value:i}:k)}))},onDone:()=>{y.value.push(a.id)}}):(h.value=h.value.map(i=>({...i,series:i.series.map(d=>d.id===a.id?{...d,value:0}:d)})),y.value.push(a.id)))}const X=e.computed(()=>C.value/w.value.length*t.value.style.chart.layout.donut.spacingRatio),we=e.computed(()=>h.value.map((a,s)=>C.value-s*C.value/w.value.length)),F=e.computed(()=>h.value.map((a,s)=>{const o=C.value-s*C.value/h.value.length,n=x.value?S.value.find(u=>u.datasetIndex===s):null,l=[...a.series,...n?[n]:[]].map(u=>({...u,value:u.value<.001?.001:u.value}));return{...a,radius:o,donut:r.makeDonut({series:l},v.value.width/2,v.value.height/2,o,o,1.99999,2,1,360,105.25,X.value)}})),Ce=e.computed(()=>[...w.value].map((a,s)=>{const o=s*C.value/w.value.length;return{sizeRatio:o,donut:r.makeDonut({series:[{value:1}]},v.value.width/2,v.value.height/2,C.value-o,C.value-o,1.99999,2,1,360,105.25,C.value/w.value.length*t.value.style.chart.layout.donut.spacingRatio)[0]}})),Le=e.ref(null),O=e.ref(null),A=e.ref(null),H=e.ref(null);function Ue({datapoint:a,_relativeIndex:s,seriesIndex:o}){Le.value=a.arcOfId,O.value=a.id,A.value=o,H.value={datapoint:a,seriesIndex:o,series:h.value,config:t.value};const n=t.value.style.chart.tooltip.customFormat;if(r.isFunction(n)&&r.functionReturnsString(()=>n({seriesIndex:o,datapoint:a,series:h.value,config:t.value})))R.value=n({seriesIndex:o,datapoint:a,series:h.value,config:t.value});else{let l="";if(t.value.style.chart.tooltip.showAllItemsAtIndex&&y.value.length===0){const u=h.value.map(c=>c.series.find(f=>f.seriesIndex===o));u.forEach((c,f)=>{if(!c)return"";l+=` <div style="display:flex; flex-direction: column; justify-content:flex-start; align-items:flex-start;padding:6px 0; ${f<u.length-1?`border-bottom:1px solid ${t.value.style.chart.tooltip.borderColor}`:""}"> <div style="display:flex; flex-direction: row; gap: 3px; justify-content:flex-start; align-items:center;"> <svg viewBox="0 0 20 20" height="${t.value.style.chart.tooltip.fontSize}" width="${t.value.style.chart.tooltip.fontSize}"> <circle cx="10" cy="10" r="10" fill="${c.color}"/> </svg> <span> ${c.arcOf??""} - ${c.name} </span> </div> <span> ${t.value.style.chart.tooltip.showValue?`<b>${r.applyDataLabel(t.value.style.chart.layout.labels.dataLabels.formatter,a.value,r.dataLabel({p:t.value.style.chart.layout.labels.dataLabels.prefix,v:a.value,s:t.value.style.chart.layout.labels.dataLabels.suffix,r:t.value.style.chart.tooltip.roundingValue}),{datapoint:a,seriesIndex:o})} </b>`:""} ${t.value.style.chart.tooltip.showPercentage?`(${r.dataLabel({v:c.proportion*100,s:"%",r:t.value.style.chart.tooltip.roundingPercentage})})`:""} </span> </div> `})}else l+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${t.value.style.chart.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${a.arcOf??""} - ${a.name}</div>`,l+=`<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 12 12" height="14" width="14"><circle cx="6" cy="6" r="6" stroke="none" fill="${a.color}"/></svg>`,t.value.style.chart.tooltip.showValue&&(l+=`<b>${r.applyDataLabel(t.value.style.chart.layout.labels.dataLabels.formatter,a.value,r.dataLabel({p:t.value.style.chart.layout.labels.dataLabels.prefix,v:a.value,s:t.value.style.chart.layout.labels.dataLabels.suffix,r:t.value.style.chart.tooltip.roundingValue}),{datapoint:a,seriesIndex:o})}</b>`),t.value.style.chart.tooltip.showPercentage&&(t.value.style.chart.tooltip.showValue?l+=`<span>(${r.dataLabel({v:a.proportion*100,s:"%",r:t.value.style.chart.tooltip.roundingPercentage})})</span></div>`:l+=`<b>${r.dataLabel({v:a.proportion*100,s:"%",r:t.value.style.chart.tooltip.roundingPercentage})}</b></div>`);R.value=`<div style="font-size:${t.value.style.chart.tooltip.fontSize}px">${l}</div>`}M.value=!0}function W(a){return a.proportion*100>t.value.style.chart.layout.labels.dataLabels.hideUnderValue}function $e(a,s){if(!t.value.useBlurOnHover)return"";if(t.value.style.chart.tooltip.showAllItemsAtIndex&&y.value.length===0)return[null,void 0].includes(A.value)||A.value===s?"":`url(#blur_${p.value})`;if(!t.value.style.chart.tooltip.showAllItemsAtIndex||y.value.length)return[null,void 0].includes(O.value)||O.value===a.id?"":`url(#blur_${p.value})`}const J=e.computed(()=>w.value.map((a,s)=>{const o=a.series.filter(l=>!y.value.includes(l.id)),n=x.value?o.map(l=>{const u=b.dataset[s].series.findIndex(c=>c.name===l.name);return r.sanitizeArray(b.dataset[s].series[u].values).reduce((c,f)=>c+f,0)}).reduce((l,u)=>l+u,0):o.map(l=>l.value).reduce((l,u)=>l+u,0);return a.series.map((l,u)=>{const c=r.sanitizeArray(b.dataset[s].series[u].values).reduce((L,g)=>L+g,0),f=x.value?c:l.value;return{name:l.name,color:l.color,value:f,shape:"circle",arcOf:l.arcOf,id:l.id,seriesIndex:u,datasetIndex:s,total:n,opacity:y.value.includes(l.id)?.5:1,segregate:()=>Y(l),isSegregated:y.value.includes(l.id)}})})),Ge=e.computed(()=>({cy:"nested-donuts-legend",backgroundColor:t.value.style.chart.legend.backgroundColor,color:t.value.style.chart.legend.color,fontSize:t.value.style.chart.legend.fontSize,paddingBottom:12,fontWeight:t.value.style.chart.legend.bold?"bold":""})),$=e.computed(()=>{const a=h.value.flatMap(o=>o.series.map(n=>({name:`${o.name} - ${n.name}`,color:n.color,total:o.total}))),s=h.value.flatMap(o=>o.series.map(n=>n.value));return{head:a,body:s}});function xe(){e.nextTick(()=>{const a=$.value.head.map((n,l)=>[[n.name],[$.value.body[l]],[isNaN($.value.body[l]/n.total)?"-":$.value.body[l]/n.total*100]]),s=[[t.value.style.chart.title.text],[t.value.style.chart.title.subtitle.text],[[""],["val"],["%"]]].concat(a),o=r.createCsvContent(s);r.downloadCsv({csvContent:o,title:t.value.style.chart.title.text||"vue-ui-nested-donuts"})})}const z=e.computed(()=>{const a=[t.value.table.columnNames.series,t.value.table.columnNames.value,t.value.table.columnNames.percentage],s=$.value.head.map((l,u)=>{const c=r.dataLabel({p:t.value.style.chart.layout.labels.dataLabels.prefix,v:$.value.body[u],s:t.value.style.chart.layout.labels.dataLabels.suffix,r:t.value.table.td.roundingValue});return[{color:l.color,name:l.name},c,isNaN($.value.body[u]/l.total)?"-":r.dataLabel({v:$.value.body[u]/l.total*100,s:"%",r:t.value.table.td.roundingPercentage})]}),o={th:{backgroundColor:t.value.table.th.backgroundColor,color:t.value.table.th.color,outline:t.value.table.th.outline},td:{backgroundColor:t.value.table.td.backgroundColor,color:t.value.table.td.color,outline:t.value.table.td.outline},breakpoint:t.value.table.responsiveBreakpoint};return{colNames:[t.value.table.columnNames.series,t.value.table.columnNames.value,t.value.table.columnNames.percentage],head:a,body:s,config:o}});function Ye(){return w.value}function Be(){m.value.showTable=!m.value.showTable}function _e(){m.value.dataLabels.show=!m.value.dataLabels.show}function Ne(){m.value.showTooltip=!m.value.showTooltip}const P=e.ref(!1);function K(){P.value=!P.value}return Fe({getData:Ye,generatePdf:ye,generateCsv:xe,generateImage:me,toggleTable:Be,toggleLabels:_e,toggleTooltip:Ne,toggleAnnotator:K}),(a,s)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"nestedDonutsChart",ref:N,class:e.normalizeClass(`vue-ui-nested-donuts ${_.value?"vue-data-ui-wrapper-fullscreen":""} ${t.value.useCssAnimation?"":"vue-ui-dna"}`),style:e.normalizeStyle(`font-family:${t.value.style.fontFamily};width:100%; text-align:center;background:${t.value.style.chart.backgroundColor}`),id:`nested_donuts_${p.value}`,onMouseenter:s[3]||(s[3]=()=>e.unref(ie)(!0)),onMouseleave:s[4]||(s[4]=()=>e.unref(ie)(!1))},[t.value.userOptions.buttons.annotator?(e.openBlock(),e.createBlock(at._sfc_main,{key:0,svgRef:e.unref(de),backgroundColor:t.value.style.chart.backgroundColor,color:t.value.style.chart.color,active:P.value,onClose:K},null,8,["svgRef","backgroundColor","color","active"])):e.createCommentVNode("",!0),Ie.value?(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"noTitle",ref:ne,class:"vue-data-ui-no-title-space",style:"height:36px; width: 100%;background:transparent"},null,512)):e.createCommentVNode("",!0),t.value.style.chart.title.text?(e.openBlock(),e.createElementBlock("div",{key:2,ref_key:"chartTitle",ref:ae},[(e.openBlock(),e.createBlock(Ke._sfc_main,{key:`title_${se.value}`,config:{title:{cy:"donut-div-title",...t.value.style.chart.title},subtitle:{cy:"donut-div-subtitle",...t.value.style.chart.title.subtitle}}},null,8,["config"]))],512)):e.createCommentVNode("",!0),t.value.userOptions.show&&E.value&&(e.unref(ce)||e.unref(U))?(e.openBlock(),e.createBlock(Ve.UserOptions,{ref:"details",key:`user_option_${le.value}`,backgroundColor:t.value.style.chart.backgroundColor,color:t.value.style.chart.color,isPrinting:e.unref(pe),isImaging:e.unref(he),uid:p.value,hasTooltip:t.value.userOptions.buttons.tooltip&&t.value.style.chart.tooltip.show,hasPdf:t.value.userOptions.buttons.pdf,hasXls:t.value.userOptions.buttons.csv,hasImg:t.value.userOptions.buttons.img,hasTable:t.value.userOptions.buttons.table,hasLabel:t.value.userOptions.buttons.labels,hasFullscreen:t.value.userOptions.buttons.fullscreen,isFullscreen:_.value,isTooltip:m.value.showTooltip,titles:{...t.value.userOptions.buttonTitles},chartElement:N.value,position:t.value.userOptions.position,hasAnnotator:t.value.userOptions.buttons.annotator,isAnnotation:P.value,onToggleFullscreen:Pe,onGeneratePdf:e.unref(ye),onGenerateCsv:xe,onGenerateImage:e.unref(me),onToggleTable:Be,onToggleLabels:_e,onToggleTooltip:Ne,onToggleAnnotator:K,style:e.normalizeStyle({visibility:e.unref(ce)?e.unref(U)?"visible":"hidden":"visible"})},e.createSlots({_:2},[a.$slots.menuIcon?{name:"menuIcon",fn:e.withCtx(({isOpen:o,color:n})=>[e.renderSlot(a.$slots,"menuIcon",e.normalizeProps(e.guardReactiveProps({isOpen:o,color:n})),void 0,!0)]),key:"0"}:void 0,a.$slots.optionTooltip?{name:"optionTooltip",fn:e.withCtx(()=>[e.renderSlot(a.$slots,"optionTooltip",{},void 0,!0)]),key:"1"}:void 0,a.$slots.optionPdf?{name:"optionPdf",fn:e.withCtx(()=>[e.renderSlot(a.$slots,"optionPdf",{},void 0,!0)]),key:"2"}:void 0,a.$slots.optionCsv?{name:"optionCsv",fn:e.withCtx(()=>[e.renderSlot(a.$slots,"optionCsv",{},void 0,!0)]),key:"3"}:void 0,a.$slots.optionImg?{name:"optionImg",fn:e.withCtx(()=>[e.renderSlot(a.$slots,"optionImg",{},void 0,!0)]),key:"4"}:void 0,a.$slots.optionTable?{name:"optionTable",fn:e.withCtx(()=>[e.renderSlot(a.$slots,"optionTable",{},void 0,!0)]),key:"5"}:void 0,a.$slots.optionLabels?{name:"optionLabels",fn:e.withCtx(()=>[e.renderSlot(a.$slots,"optionLabels",{},void 0,!0)]),key:"6"}:void 0,a.$slots.optionFullscreen?{name:"optionFullscreen",fn:e.withCtx(({toggleFullscreen:o,isFullscreen:n})=>[e.renderSlot(a.$slots,"optionFullscreen",e.normalizeProps(e.guardReactiveProps({toggleFullscreen:o,isFullscreen:n})),void 0,!0)]),key:"7"}:void 0,a.$slots.optionAnnotator?{name:"optionAnnotator",fn:e.withCtx(({toggleAnnotator:o,isAnnotator:n})=>[e.renderSlot(a.$slots,"optionAnnotator",e.normalizeProps(e.guardReactiveProps({toggleAnnotator:o,isAnnotator:n})),void 0,!0)]),key:"8"}:void 0]),1032,["backgroundColor","color","isPrinting","isImaging","uid","hasTooltip","hasPdf","hasXls","hasImg","hasTable","hasLabel","hasFullscreen","isFullscreen","isTooltip","titles","chartElement","position","hasAnnotator","isAnnotation","onGeneratePdf","onGenerateImage","style"])):e.createCommentVNode("",!0),E.value?(e.openBlock(),e.createElementBlock("svg",{key:4,ref_key:"svgRef",ref:de,xmlns:e.unref(r.XMLNS),class:e.normalizeClass({"vue-data-ui-fullscreen--on":_.value,"vue-data-ui-fulscreen--off":!_.value}),viewBox:`0 0 ${v.value.width<=0?.001:v.value.width} ${v.value.height<0?.001:v.value.height}`,style:e.normalizeStyle(`max-width:100%; overflow: visible; background:transparent;color:${t.value.style.chart.color};${fe.value.css}`)},[e.createVNode(lt._sfc_main),a.$slots["chart-background"]?(e.openBlock(),e.createElementBlock("foreignObject",{key:0,x:0,y:0,width:v.value.width<=0?.001:v.value.width,height:v.value.height<0?.001:v.value.height,style:{pointerEvents:"none"}},[e.renderSlot(a.$slots,"chart-background",{},void 0,!0)],8,it)):e.createCommentVNode("",!0),e.createElementVNode("defs",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Ce.value,(o,n)=>(e.openBlock(),e.createElementBlock("radialGradient",{id:`radial_${p.value}_${n}`},[s[5]||(s[5]=e.createElementVNode("stop",{offset:"0%","stop-color":"#FFFFFF","stop-opacity":"0"},null,-1)),e.createElementVNode("stop",{offset:`${(1-X.value/we.value[n])*100}%`,"stop-color":e.unref(r.setOpacity)("#FFFFFF",0),"stop-opacity":"0"},null,8,dt),e.createElementVNode("stop",{offset:`${(1-X.value/we.value[n]/2)*100}%`,"stop-color":"#FFFFFF","stop-opacity":t.value.style.chart.gradientIntensity/100},null,8,vt),s[6]||(s[6]=e.createElementVNode("stop",{offset:"100%","stop-color":"#FFFFFF","stop-opacity":"0"},null,-1))],8,ct))),256))]),e.createElementVNode("defs",null,[e.createElementVNode("filter",{id:`blur_${p.value}`,x:"-50%",y:"-50%",width:"200%",height:"200%"},[e.createElementVNode("feGaussianBlur",{in:"SourceGraphic",stdDeviation:2,id:`blur_std_${p.value}`},null,8,pt),s[7]||(s[7]=e.createElementVNode("feColorMatrix",{type:"saturate",values:"0"},null,-1))],8,ft),e.createElementVNode("filter",{id:`shadow_${p.value}`,"color-interpolation-filters":"sRGB"},[e.createElementVNode("feDropShadow",{dx:"0",dy:"0",stdDeviation:"10","flood-opacity":"0.5","flood-color":t.value.style.chart.layout.donut.shadowColor},null,8,yt)],8,ht)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(F.value,(o,n)=>(e.openBlock(),e.createElementBlock("g",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.donut.filter(l=>!l.ghost),(l,u)=>(e.openBlock(),e.createElementBlock("g",null,[e.createElementVNode("path",{class:"vue-ui-donut-arc-path",d:l.arcSlice,fill:e.unref(r.setOpacity)(l.color,80),stroke:t.value.style.chart.backgroundColor,"stroke-width":t.value.style.chart.layout.donut.borderWidth,filter:$e(l,u)},null,8,mt)]))),256))]))),256)),t.value.style.chart.useGradient?(e.openBlock(),e.createElementBlock("g",bt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Ce.value,(o,n)=>(e.openBlock(),e.createElementBlock("g",null,[e.createElementVNode("path",{d:o.donut.arcSlice,fill:`url(#radial_${p.value}_${n})`,stroke:"transparent","stroke-width":"0"},null,8,gt)]))),256))])):e.createCommentVNode("",!0),t.value.style.chart.layout.labels.dataLabels.showDonutName?(e.openBlock(),e.createElementBlock("g",kt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(F.value,(o,n)=>(e.openBlock(),e.createElementBlock("g",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.donut,(l,u)=>(e.openBlock(),e.createElementBlock("g",null,[u===0&&v.value.width&&v.value.height?(e.openBlock(),e.createElementBlock("text",{key:0,class:e.normalizeClass({animated:t.value.useCssAnimation}),x:v.value.width/2,y:l.startY-t.value.style.chart.layout.labels.dataLabels.fontSize+t.value.style.chart.layout.labels.dataLabels.donutNameOffsetY,"text-anchor":"middle","font-size":t.value.style.chart.layout.labels.dataLabels.fontSize,"font-weight":t.value.style.chart.layout.labels.dataLabels.boldDonutName?"bold":"normal",fill:t.value.style.chart.layout.labels.dataLabels.color},e.toDisplayString(t.value.style.chart.layout.labels.dataLabels.donutNameAbbreviation?e.unref(r.abbreviate)({source:o.name,length:t.value.style.chart.layout.labels.dataLabels.donutNameMaxAbbreviationSize}):o.name),11,wt)):e.createCommentVNode("",!0)]))),256))]))),256))])):e.createCommentVNode("",!0),t.value.style.chart.layout.labels.dataLabels.show?(e.openBlock(),e.createElementBlock("g",Ct,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(F.value,(o,n)=>(e.openBlock(),e.createElementBlock("g",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.donut.filter(l=>!l.ghost),(l,u)=>(e.openBlock(),e.createElementBlock("g",{filter:$e(l,u)},[e.withDirectives(e.createElementVNode("text",{class:e.normalizeClass({animated:t.value.useCssAnimation}),opacity:W(l)?1:0,"text-anchor":e.unref(r.calcMarkerOffsetX)(l,!0).anchor,x:e.unref(r.calcMarkerOffsetX)(l,!1,t.value.style.chart.layout.labels.dataLabels.offsetX).x||0,y:e.unref(r.calcMarkerOffsetY)(l,t.value.style.chart.layout.labels.dataLabels.offsetY,t.value.style.chart.layout.labels.dataLabels.offsetY),fill:t.value.style.chart.layout.labels.dataLabels.useSerieColor?l.color:t.value.style.chart.layout.labels.dataLabels.color,"font-size":t.value.style.chart.layout.labels.dataLabels.fontSize,"font-weight":t.value.style.chart.layout.labels.dataLabels.boldPercentage?"bold":"normal"},e.toDisplayString(e.unref(r.dataLabel)({v:l.proportion*100,s:"%",r:t.value.style.chart.layout.labels.dataLabels.roundingPercentage})),11,$t),[[e.vShow,m.value.dataLabels.show&&t.value.style.chart.layout.labels.dataLabels.showPercentage]]),e.withDirectives(e.createElementVNode("text",{class:e.normalizeClass({animated:t.value.useCssAnimation}),opacity:W(l)?1:0,"text-anchor":e.unref(r.calcMarkerOffsetX)(l,!0).anchor,x:e.unref(r.calcMarkerOffsetX)(l,!1,t.value.style.chart.layout.labels.dataLabels.offsetX).x||0,y:e.unref(r.calcMarkerOffsetY)(l,t.value.style.chart.layout.labels.dataLabels.offsetY,t.value.style.chart.layout.labels.dataLabels.offsetY)+t.value.style.chart.layout.labels.dataLabels.fontSize,fill:t.value.style.chart.layout.labels.dataLabels.useSerieColor?l.color:t.value.style.chart.layout.labels.dataLabels.color,"font-size":t.value.style.chart.layout.labels.dataLabels.fontSize,"font-weight":t.value.style.chart.layout.labels.dataLabels.boldValue?"bold":"normal"}," ("+e.toDisplayString(e.unref(r.applyDataLabel)(t.value.style.chart.layout.labels.dataLabels.formatter,l.value,e.unref(r.dataLabel)({p:t.value.style.chart.layout.labels.dataLabels.prefix,v:l.value,s:t.value.style.chart.layout.labels.dataLabels.suffix,r:t.value.style.chart.layout.labels.dataLabels.roundingValue}),{datapoint:l,seriesIndex:n,datapointIndex:u}))+") ",11,xt),[[e.vShow,m.value.dataLabels.show&&t.value.style.chart.layout.labels.dataLabels.showPercentage&&t.value.style.chart.layout.labels.dataLabels.showValue]]),W(l)&&m.value.dataLabels.show&&!t.value.style.chart.layout.labels.dataLabels.showPercentage&&t.value.style.chart.layout.labels.dataLabels.showValue?(e.openBlock(),e.createElementBlock("text",{key:0,class:e.normalizeClass({animated:t.value.useCssAnimation}),"text-anchor":e.unref(r.calcMarkerOffsetX)(l,!0).anchor,x:e.unref(r.calcMarkerOffsetX)(l,!1,t.value.style.chart.layout.labels.dataLabels.offsetX).x||0,y:e.unref(r.calcMarkerOffsetY)(l,t.value.style.chart.layout.labels.dataLabels.offsetY,t.value.style.chart.layout.labels.dataLabels.offsetY),fill:t.value.style.chart.layout.labels.dataLabels.useSerieColor?l.color:t.value.style.chart.layout.labels.dataLabels.color,"font-size":t.value.style.chart.layout.labels.dataLabels.fontSize,"font-weight":t.value.style.chart.layout.labels.dataLabels.boldValue?"bold":"normal"},e.toDisplayString(e.unref(r.applyDataLabel)(t.value.style.chart.layout.labels.dataLabels.formatter,l.value,e.unref(r.dataLabel)({p:t.value.style.chart.layout.labels.dataLabels.prefix,v:l.value,s:t.value.style.chart.layout.labels.dataLabels.suffix,r:t.value.style.chart.layout.labels.dataLabels.roundingValue}),{datapoint:l,seriesIndex:n,datapointIndex:u})),11,Bt)):e.createCommentVNode("",!0)],8,Lt))),256))]))),256))])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(F.value,(o,n)=>(e.openBlock(),e.createElementBlock("g",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.donut,(l,u)=>(e.openBlock(),e.createElementBlock("g",null,[e.createElementVNode("path",{d:l.arcSlice,fill:ze.value===n?"rgba(0,0,0,0.1)":"transparent",onMouseenter:c=>Ue({datapoint:l,seriesIndex:l.seriesIndex}),onClick:c=>Re({datapoint:l,index:u}),onMouseleave:s[0]||(s[0]=c=>{M.value=!1,Le.value=null,O.value=null,A.value=null})},null,40,_t)]))),256))]))),256)),e.renderSlot(a.$slots,"svg",{svg:v.value},void 0,!0)],14,ut)):e.createCommentVNode("",!0),a.$slots.watermark?(e.openBlock(),e.createElementBlock("div",Nt,[e.renderSlot(a.$slots,"watermark",e.normalizeProps(e.guardReactiveProps({isPrinting:e.unref(pe)||e.unref(he)})),void 0,!0)])):e.createCommentVNode("",!0),E.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(et.default,{key:6,config:{type:"donut",style:{backgroundColor:t.value.style.chart.backgroundColor,donut:{color:"#CCCCCC"}}}},null,8,["config"])),e.createVNode(Ze._sfc_main,{show:m.value.showTooltip&&M.value,backgroundColor:t.value.style.chart.tooltip.backgroundColor,color:t.value.style.chart.tooltip.color,borderRadius:t.value.style.chart.tooltip.borderRadius,borderColor:t.value.style.chart.tooltip.borderColor,borderWidth:t.value.style.chart.tooltip.borderWidth,fontSize:t.value.style.chart.tooltip.fontSize,backgroundOpacity:t.value.style.chart.tooltip.backgroundOpacity,position:t.value.style.chart.tooltip.position,offsetY:t.value.style.chart.tooltip.offsetY,parent:N.value,content:R.value,isFullscreen:_.value,isCustom:e.unref(r.isFunction)(t.value.style.chart.tooltip.customFormat)},{"tooltip-before":e.withCtx(()=>[e.renderSlot(a.$slots,"tooltip-before",e.normalizeProps(e.guardReactiveProps({...H.value})),void 0,!0)]),"tooltip-after":e.withCtx(()=>[e.renderSlot(a.$slots,"tooltip-after",e.normalizeProps(e.guardReactiveProps({...H.value})),void 0,!0)]),_:3},8,["show","backgroundColor","color","borderRadius","borderColor","borderWidth","fontSize","backgroundOpacity","position","offsetY","parent","content","isFullscreen","isCustom"]),t.value.style.chart.legend.show?(e.openBlock(),e.createElementBlock("div",{key:7,ref_key:"chartLegend",ref:q,class:e.normalizeClass({"vue-ui-nested-donuts-legend":J.value.length>1})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(J.value,(o,n)=>(e.openBlock(),e.createBlock(je.Legend,{key:`legend_${n}_${ue.value}`,legendSet:o,config:Ge.value,onClickMarker:s[1]||(s[1]=({legend:l})=>Y(l))},{legendTitle:e.withCtx(({titleSet:l})=>[l[0]&&l[0].arcOf?(e.openBlock(),e.createElementBlock("div",St,e.toDisplayString(l[0].arcOf),1)):e.createCommentVNode("",!0)]),item:e.withCtx(({legend:l,index:u})=>[e.createElementVNode("div",{onClick:c=>Y(l),style:e.normalizeStyle(`opacity:${y.value.includes(l.id)?.5:1}`)},[e.createTextVNode(e.toDisplayString(l.name)+": "+e.toDisplayString(e.unref(r.applyDataLabel)(t.value.style.chart.layout.labels.dataLabels.formatter,l.value,e.unref(r.dataLabel)({p:t.value.style.chart.layout.labels.dataLabels.prefix,v:l.value,s:t.value.style.chart.layout.labels.dataLabels.suffix,r:t.value.style.chart.legend.roundingValue}),{datapoint:l,seriesIndex:u}))+" ",1),y.value.includes(l.id)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(" ( - % ) ")],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" ("+e.toDisplayString(isNaN(l.value/l.total)?"-":e.unref(r.dataLabel)({v:l.value/l.total*100,s:"%",r:t.value.style.chart.legend.roundingPercentage}))+") ",1)],64))],12,Vt)]),_:2},1032,["legendSet","config"]))),128))],2)):e.createCommentVNode("",!0),t.value.style.chart.legend.show?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:8,ref_key:"chartLegend",ref:q},[e.renderSlot(a.$slots,"legend",{legend:J.value},void 0,!0)],512)),a.$slots.source?(e.openBlock(),e.createElementBlock("div",{key:9,ref_key:"source",ref:oe,dir:"auto"},[e.renderSlot(a.$slots,"source",{},void 0,!0)],512)):e.createCommentVNode("",!0),E.value?(e.openBlock(),e.createBlock(tt.default,{key:10,hideDetails:"",config:{open:m.value.showTable,maxHeight:1e4,body:{backgroundColor:t.value.style.chart.backgroundColor,color:t.value.style.chart.color},head:{backgroundColor:t.value.style.chart.backgroundColor,color:t.value.style.chart.color}}},{content:e.withCtx(()=>[(e.openBlock(),e.createBlock(Qe.DataTable,{key:`table_${re.value}`,colNames:z.value.colNames,head:z.value.head,body:z.value.body,config:z.value.config,title:`${t.value.style.chart.title.text}${t.value.style.chart.title.subtitle.text?` : ${t.value.style.chart.title.subtitle.text}`:""}`,onClose:s[2]||(s[2]=o=>m.value.showTable=!1)},{th:e.withCtx(({th:o})=>[e.createElementVNode("div",{innerHTML:o,style:{display:"flex","align-items":"center"}},null,8,Et)]),td:e.withCtx(({td:o})=>[e.createTextVNode(e.toDisplayString(o.name||o),1)]),_:1},8,["colNames","head","body","config","title"]))]),_:1},8,["config"])):e.createCommentVNode("",!0)],46,rt))}},Ft=st._export_sfc(Tt,[["__scopeId","data-v-3bc36ce2"]]);exports.default=Ft;