vue-data-ui 3.28.3 → 3.28.4
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/dist/{PackageVersion-CXT-eAuk.js → PackageVersion-DhptF5oD.js} +1 -1
- package/dist/components/vue-ui-3d-bar.js +1 -1
- package/dist/components/vue-ui-age-pyramid.js +1 -1
- package/dist/components/vue-ui-bullet.js +1 -1
- package/dist/components/vue-ui-bump.js +1 -1
- package/dist/components/vue-ui-candlestick.js +1 -1
- package/dist/components/vue-ui-carousel-table.js +1 -1
- package/dist/components/vue-ui-chestnut.js +1 -1
- package/dist/components/vue-ui-chord.js +1 -1
- package/dist/components/vue-ui-circle-pack.js +1 -1
- package/dist/components/vue-ui-cursor.js +1 -1
- package/dist/components/vue-ui-dag.js +1 -1
- package/dist/components/vue-ui-dashboard.js +1 -1
- package/dist/components/vue-ui-digits.js +1 -1
- package/dist/components/vue-ui-donut-evolution.js +1 -1
- package/dist/components/vue-ui-donut.js +1 -1
- package/dist/components/vue-ui-dumbbell.js +1 -1
- package/dist/components/vue-ui-flow.js +1 -1
- package/dist/components/vue-ui-funnel.js +1 -1
- package/dist/components/vue-ui-galaxy.js +1 -1
- package/dist/components/vue-ui-gauge.js +1 -1
- package/dist/components/vue-ui-geo.js +1 -1
- package/dist/components/vue-ui-gizmo.js +1 -1
- package/dist/components/vue-ui-graph.js +1 -1
- package/dist/components/vue-ui-heatmap.js +1 -1
- package/dist/components/vue-ui-hill.js +1 -1
- package/dist/components/vue-ui-history-plot.js +1 -1
- package/dist/components/vue-ui-horizontal-bar.js +1 -1
- package/dist/components/vue-ui-kpi.js +1 -1
- package/dist/components/vue-ui-molecule.js +1 -1
- package/dist/components/vue-ui-mood-radar.js +1 -1
- package/dist/components/vue-ui-nested-donuts.js +1 -1
- package/dist/components/vue-ui-onion.js +1 -1
- package/dist/components/vue-ui-parallel-coordinate-plot.js +1 -1
- package/dist/components/vue-ui-quadrant.js +1 -1
- package/dist/components/vue-ui-quick-chart.js +1 -1
- package/dist/components/vue-ui-radar.js +1 -1
- package/dist/components/vue-ui-relation-circle.js +1 -1
- package/dist/components/vue-ui-ridgeline.js +1 -1
- package/dist/components/vue-ui-rings.js +1 -1
- package/dist/components/vue-ui-scatter.js +1 -1
- package/dist/components/vue-ui-skeleton.js +1 -1
- package/dist/components/vue-ui-spark-trend.js +1 -1
- package/dist/components/vue-ui-sparkbar.js +1 -1
- package/dist/components/vue-ui-sparkgauge.js +1 -1
- package/dist/components/vue-ui-sparkhistogram.js +1 -1
- package/dist/components/vue-ui-sparkline.js +1 -1
- package/dist/components/vue-ui-sparkstackbar.js +1 -1
- package/dist/components/vue-ui-stackbar.js +1 -1
- package/dist/components/vue-ui-stackline.js +1 -1
- package/dist/components/vue-ui-strip-plot.js +1 -1
- package/dist/components/vue-ui-table-sparkline.js +1 -1
- package/dist/components/vue-ui-table.js +1 -1
- package/dist/components/vue-ui-thermometer.js +1 -1
- package/dist/components/vue-ui-timer.js +1 -1
- package/dist/components/vue-ui-tiremarks.js +1 -1
- package/dist/components/vue-ui-treemap.js +1 -1
- package/dist/components/vue-ui-vertical-bar.js +1 -1
- package/dist/components/vue-ui-waffle.js +1 -1
- package/dist/components/vue-ui-wheel.js +1 -1
- package/dist/components/vue-ui-word-cloud.js +1 -1
- package/dist/components/vue-ui-world.js +1 -1
- package/dist/components/vue-ui-xy.js +1 -1
- package/dist/package-CX7pZToh.js +1 -0
- package/dist/{render-common-C70bnUVe.js → render-common-DwEiRIJ0.js} +1 -1
- package/dist/ssr/vue-ui-donut.js +1 -1
- package/dist/ssr/vue-ui-xy.js +1 -1
- package/dist/ssr.js +1 -1
- package/dist/vue-data-ui-CORn0LF6.js +1 -0
- package/dist/vue-data-ui.js +1 -1
- package/dist/{vue-ui-3d-bar-ljsy2rX6.js → vue-ui-3d-bar-CJTKyv3A.js} +1 -1
- package/dist/{vue-ui-age-pyramid-a6CK7z3a.js → vue-ui-age-pyramid-6uZzf1w6.js} +1 -1
- package/dist/{vue-ui-bullet-DX4A2Qwo.js → vue-ui-bullet-CsJcLhmV.js} +1 -1
- package/dist/{vue-ui-bump-IvRdB6MD.js → vue-ui-bump-DXpxBWp_.js} +1 -1
- package/dist/{vue-ui-candlestick-BgyUo13S.js → vue-ui-candlestick-Bn_RSZ0k.js} +1 -1
- package/dist/{vue-ui-carousel-table-D01DGfA0.js → vue-ui-carousel-table-ChNykS-r.js} +1 -1
- package/dist/{vue-ui-chestnut-DYrMSzmQ.js → vue-ui-chestnut-DMYQTkxM.js} +1 -1
- package/dist/{vue-ui-chord-CwzQ7QbP.js → vue-ui-chord-Pp0U0-zV.js} +1 -1
- package/dist/{vue-ui-circle-pack-DQHNM9sC.js → vue-ui-circle-pack-We23fOaF.js} +1 -1
- package/dist/{vue-ui-cursor-CTFfbDX8.js → vue-ui-cursor-3-RTIIl-.js} +1 -1
- package/dist/{vue-ui-dag-DF29_9Gg.js → vue-ui-dag-5fVnwEXd.js} +1 -1
- package/dist/{vue-ui-dashboard-D98rMHjI.js → vue-ui-dashboard-Dlwnintv.js} +1 -1
- package/dist/{vue-ui-digits-AoPCgSfP.js → vue-ui-digits-ZMK0aBxE.js} +1 -1
- package/dist/{vue-ui-donut-BYUkblpv.js → vue-ui-donut-CmLo1r4-.js} +1 -1
- package/dist/{vue-ui-donut-evolution-wxHDTKlg.js → vue-ui-donut-evolution-CYvo7Cww.js} +1 -1
- package/dist/vue-ui-donut-j1bv0KyD.js +22 -0
- package/dist/{vue-ui-dumbbell-DR7rjMt0.js → vue-ui-dumbbell-DigrSGwq.js} +1 -1
- package/dist/{vue-ui-flow-DtQlRSK_.js → vue-ui-flow-D9cc9yXD.js} +1 -1
- package/dist/{vue-ui-funnel-BP3chlZy.js → vue-ui-funnel-U88Hs0nL.js} +1 -1
- package/dist/{vue-ui-galaxy-B7ogrJ6f.js → vue-ui-galaxy-B1Vuz8CA.js} +1 -1
- package/dist/{vue-ui-gauge-CrmzNkjT.js → vue-ui-gauge-1MgZSPXt.js} +1 -1
- package/dist/{vue-ui-geo-BbTvWbfX.js → vue-ui-geo-BV8ARcaX.js} +1 -1
- package/dist/{vue-ui-gizmo-C3wgMKwb.js → vue-ui-gizmo-DtsERB-E.js} +1 -1
- package/dist/{vue-ui-graph-CzUVEiO-.js → vue-ui-graph-BVTPTDl5.js} +1 -1
- package/dist/{vue-ui-heatmap-BxR2ccwd.js → vue-ui-heatmap-6YwaVr3F.js} +1 -1
- package/dist/{vue-ui-hill-BDOd7LrC.js → vue-ui-hill-BvrNT8KZ.js} +1 -1
- package/dist/{vue-ui-history-plot-0-vs_CVn.js → vue-ui-history-plot-CJIILQPt.js} +1 -1
- package/dist/{vue-ui-horizontal-bar-C5pNTRKB.js → vue-ui-horizontal-bar-Dfo-kTqg.js} +1 -1
- package/dist/{vue-ui-kpi-Dfhsk0U1.js → vue-ui-kpi-DHfExr9d.js} +1 -1
- package/dist/{vue-ui-molecule-DUX1NUIY.js → vue-ui-molecule-C8e5IeHG.js} +1 -1
- package/dist/{vue-ui-mood-radar-B1N5AwX_.js → vue-ui-mood-radar-DsnT2U65.js} +1 -1
- package/dist/{vue-ui-nested-donuts-CfHH-cU6.js → vue-ui-nested-donuts-JkpqMhuL.js} +1 -1
- package/dist/{vue-ui-onion-DRN-jIvq.js → vue-ui-onion-CIA2tlff.js} +1 -1
- package/dist/{vue-ui-parallel-coordinate-plot-UUPjQABF.js → vue-ui-parallel-coordinate-plot-Bcr3B3NI.js} +1 -1
- package/dist/{vue-ui-quadrant-zmtzn0lM.js → vue-ui-quadrant-DKVFawhC.js} +1 -1
- package/dist/{vue-ui-quick-chart-DgU_IhKY.js → vue-ui-quick-chart-Bk2N8Hmd.js} +1 -1
- package/dist/{vue-ui-radar-BGSoxRaK.js → vue-ui-radar-CdH-BFKA.js} +1 -1
- package/dist/{vue-ui-relation-circle-XUw5UMrt.js → vue-ui-relation-circle-COZpOybS.js} +1 -1
- package/dist/{vue-ui-ridgeline-B5RJcFyA.js → vue-ui-ridgeline-MLknaTUO.js} +1 -1
- package/dist/{vue-ui-rings-BJaCLH2Q.js → vue-ui-rings-ARqLCM_P.js} +1 -1
- package/dist/{vue-ui-scatter-BA0hk_Tf.js → vue-ui-scatter-CX2wsXdE.js} +1 -1
- package/dist/{vue-ui-skeleton-DpzaXPO3.js → vue-ui-skeleton-wyvAru88.js} +1 -1
- package/dist/{vue-ui-spark-trend-DJ63XtgQ.js → vue-ui-spark-trend-C02PmIq_.js} +1 -1
- package/dist/{vue-ui-sparkbar-C5wP9R67.js → vue-ui-sparkbar-CjD57-Xi.js} +1 -1
- package/dist/{vue-ui-sparkgauge-DQcAOGuG.js → vue-ui-sparkgauge-8Eia8T2W.js} +1 -1
- package/dist/{vue-ui-sparkhistogram-BBiCxX6W.js → vue-ui-sparkhistogram-C-0f7XCl.js} +1 -1
- package/dist/{vue-ui-sparkline-B_GkB9V_.js → vue-ui-sparkline-BMMrpUPR.js} +1 -1
- package/dist/{vue-ui-sparkstackbar-DSRXhqhJ.js → vue-ui-sparkstackbar-BmgCVCKG.js} +1 -1
- package/dist/{vue-ui-stackbar-QjOQHbld.js → vue-ui-stackbar-G_zZRAa9.js} +1 -1
- package/dist/{vue-ui-stackline-CoII13bc.js → vue-ui-stackline-DchZoEAg.js} +1 -1
- package/dist/{vue-ui-strip-plot-d3UoFFrf.js → vue-ui-strip-plot-DVyPa3sp.js} +1 -1
- package/dist/{vue-ui-table-CHFjZzW7.js → vue-ui-table-qTF_q-Qu.js} +1 -1
- package/dist/{vue-ui-table-sparkline-BkZ7sn4X.js → vue-ui-table-sparkline-B2Q-7-GQ.js} +1 -1
- package/dist/{vue-ui-thermometer-B--g_Lkt.js → vue-ui-thermometer-CxNoxslq.js} +1 -1
- package/dist/{vue-ui-timer-DmwEWrDh.js → vue-ui-timer-DRjoRidI.js} +1 -1
- package/dist/{vue-ui-tiremarks-160Gx7-3.js → vue-ui-tiremarks-BC_YGp3T.js} +1 -1
- package/dist/{vue-ui-treemap-B-Yjtob0.js → vue-ui-treemap-CNM5ohoO.js} +1 -1
- package/dist/{vue-ui-waffle-BhzLg5ip.js → vue-ui-waffle-BiJshI4O.js} +1 -1
- package/dist/{vue-ui-wheel-DHb4G42X.js → vue-ui-wheel-BxR0_iNZ.js} +1 -1
- package/dist/{vue-ui-word-cloud-BcpreM7A.js → vue-ui-word-cloud-CZzC3R1K.js} +1 -1
- package/dist/{vue-ui-world-BD9acchj.js → vue-ui-world-CJgt0ESz.js} +1 -1
- package/dist/{vue-ui-xy-C-2Phexw.js → vue-ui-xy-B6XNUCzQ.js} +1 -1
- package/dist/{vue-ui-xy-CB3lQs2m.js → vue-ui-xy-DrKVPSg7.js} +1 -1
- package/package.json +1 -1
- package/dist/package-CgIKu3rP.js +0 -1
- package/dist/vue-data-ui-CrOhFey9.js +0 -1
- package/dist/vue-ui-donut-BQGnUso2.js +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useConfig-6jO1fkp5.js";import{$ as n,D as r,Ht as i,Jt as a,S as o,X as ee,at as s,i as te,m as ne,nt as re,w as ie,yt as ae,zt as oe}from"./lib-rPeBMZrn.js";import{n as se,t as ce}from"./useHints-C-TwxM0Y.js";import{t as le}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as ue}from"./resolveChartConfig-CIhClE5R.js";import{n as de,t as fe}from"./userOptionsSlots-DYuo-E5m.js";import{t as pe}from"./usePrinter-DVf3YcG5.js";import{t as me}from"./useUserOptionState-CXlFnwPv.js";import{t as he}from"./vClickOutside-BxNzkY17.js";import{t as ge}from"./vue_ui_table_sparkline-Dlfbza49.js";import{Fragment as c,computed as l,createBlock as _e,createCommentVNode as u,createElementBlock as d,createElementVNode as f,createSlots as ve,createVNode as p,defineAsyncComponent as ye,mergeProps as be,nextTick as xe,normalizeClass as Se,normalizeStyle as m,onBeforeUnmount as Ce,onMounted as we,openBlock as h,ref as g,renderList as _,renderSlot as Te,shallowRef as Ee,toDisplayString as v,unref as y,useCssVars as De,useSlots as Oe,watch as ke,withCtx as Ae,withDirectives as je}from"vue";var Me=/* @__PURE__ */ e({default:()=>b}),Ne=[`id`],Pe={style:{"z-index":`1`,"padding-right":`24px`}},Fe={key:0,style:{display:`flex`,flexDirection:`row`,alignItems:`center`}},Ie={key:0,style:{display:`flex`,flexDirection:`row`,alignItems:`center`}},Le=[`onClick`],Re=[`onClick`],ze=[`data-cell`],Be=[`data-cell`,`onPointerenter`],Ve=[`data-cell`],He=[`data-cell`],Ue=[`data-cell`],We=[`data-cell`],Ge={key:1,ref:`source`,dir:`auto`},b=/*#__PURE__*/ le({__name:`vue-ui-table-sparkline`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`copyAlt`],setup(e,{expose:le,emit:Me}){De(e=>({v5fe3988e:e.tdo}));let b=ye(()=>import(`./vue-ui-sparkline-B_GkB9V_.js`).then(e=>e.n)),x=ye(()=>import(`./BaseIcon-Cm-IJ179.js`).then(e=>e.n)),Ke=ye(()=>import(`./UserOptions-uWHV_zPB.js`).then(e=>e.n)),{vue_ui_table_sparkline:qe}=t(),S=e,Je=Me,C=g(ee()),Ye=g(0),w=g(0),T=g(null),Xe=Oe(),Ze=g(!1),E=l({get:()=>et(),set:e=>e}),D=l(()=>E.value.userOptions),O=l(()=>E.value.sparkline),k=l(()=>E.value.thead),A=l(()=>E.value.tbody),j=l(()=>E.value.title);we(()=>{Xe[`chart-background`]&&E.value.debug&&console.warn(`VueUiTableSparkline does not support the #chart-background slot.`)}),se({config:()=>E.value,dataset:()=>S.dataset,component:`VueUiTableSparkline`,rules:[ce.emptyArray,{test:e=>e.some(e=>e?.values&&e.values.length>500),message:[`👀 One or more series have > 500 datapoints. Consider if you really need this level of detail.`,``,`▶️ Use larger time scales, or aggregated values`]},{test:e=>e.some(e=>e?.values&&e.values.length>1095),message:[`👀 One or more series have > 1095 datapoints. Above this threshold, the dataset is computed through an LTTB algorithm, to preserve the shape of the data without increasing the number of datapoints.`,``,`▶️ If you need this level of detail, you can change config.downsample.threshold and set a higher value. Note that performance will be impacted.`]}]});let M=l(()=>E.value.userOptions.useCursorPointer),{userOptionsVisible:N,setUserOptionsVisibility:Qe,keepUserOptionState:$e}=me({config:E.value});function et(){return ue(S.config,qe,ge)}ke(()=>S.config,e=>{E.value=et(),N.value=!E.value.userOptions.showOnChartHover,st(),w.value+=1},{deep:!0}),ke(()=>S.dataset,e=>{W.value=U.value,w.value+=1},{deep:!0});let{isPrinting:tt,isImaging:nt,generatePdf:rt,generateImage:it}=pe({elementId:`table_${C.value}`,fileName:j.value.text||`vue-ui-table-sparkline`,options:E.value.userOptions.print}),at=l(()=>ie(E.value.customPalette)),P=g(null),F=g(!1),ot=l(()=>E.value.responsiveBreakpoint);we(()=>{st()});let I=g(E.value.colNames),L=Ee(null);function st(){oe(S.dataset)&&s({componentName:`VueUiTableSparkline`,type:`dataset`}),L.value&&L.value.disconnect(),L.value=new ResizeObserver(e=>{e.forEach(e=>{F.value=e.contentRect.width<ot.value})}),P.value&&L.value.observe(P.value),I.value=[];for(let e=0;e<mt.value;e+=1)I.value.push(E.value.colNames[e]||`col ${e}`)}Ce(()=>{L.value&&L.value.disconnect()});function R(e){if([null,void 0].includes(e))return null;let t=Number(e);return Number.isFinite(t)?t:null}function z(e){return typeof e==`number`&&Number.isFinite(e)}function ct(e=[]){return e.map(R).filter(z)}function B(e,t,n){let r=R(e),i=R(t),a=z(r),o=z(i);return a&&o?n===-1?r-i:i-r:a?-1:+!!o}function V(e,t,r={}){let i=R(e);return i===null?`-`:te(E.value.formatter,i,n({p:E.value.prefix,v:i,s:E.value.suffix,r:t}),r)}let H=l(()=>(S.dataset.forEach((e,t)=>{ae({datasetObject:e,requiredAttributes:[`name`,`values`]}).forEach(e=>{s({componentName:`VueUiTableSparkline`,type:`datasetSerieAttribute`,property:e,index:t})})}),S.dataset.map((e,t)=>{let n=e.values||[],r=ct(n),a=r.length?r.reduce((e,t)=>e+t,0):null,ee=r.length?a/r.length:null,s=r.length?ne(r):null;return{...e,values:n,color:o(e.color)||at.value[t]||i[t]||i[t%i.length],sum:a,average:ee,median:s,sparklineDataset:n.map((e,t)=>({period:E.value.colNames[t]||`col ${t}`,value:R(e)}))}})));function lt(e){let t=(e[0]?.values||[]).map((t,n)=>e.map(e=>e?.values?.[n]??null)).map(e=>e.map((e,t)=>[e,t]).sort((e,t)=>B(e[0],t[0],1)).map(e=>e[1]));return e.map((e,n)=>({...e,values:e.values||[],orders:t[n]}))}let U=l(()=>lt(H.value)),W=g(U.value),ut=l(()=>Math.max(...W.value.map(e=>(e.values||[]).length))),dt=g(void 0),ft=g(!1),G=g(void 0),pt=g(1);function K(){ft.value=!1,G.value=void 0,X.value=void 0,pt.value=1,$.value.forEach(e=>e.state=1),Y.value={name:1,sum:1,average:1,median:1},W.value=U.value}function q(e,t,n){if([`name`,`sum`,`average`,`median`].includes(e.type)){ht(e.type,t,n);return}if(!bt(t))return;if(Z.value=t,X.value=void 0,![null,void 0].includes(G.value)&&t!==G.value&&(G.value=void 0,K()),$.value[t].state===n&&G.value===t){G.value=void 0,K();return}ft.value=!0,G.value=t;let r=U.value.map(e=>e.values?.[t]??null),i=n;$.value[t].state=i,pt.value=i,t===dt.value?dt.value=void 0:dt.value=t;let a=r.map((e,t)=>[t,e]).sort((e,t)=>B(e[1],t[1],i)).map(e=>e[0]).map(e=>U.value[e]);W.value=a,w.value+=1}let mt=l(()=>Math.max(...S.dataset.map(e=>(e.values||[]).length))),J=l(()=>{let e=I.value.map(e=>({type:`reg`,value:e}));if(!e.length)for(let t=0;t<mt.value;t+=1)e.push({type:`reg`,value:`col ${t+1}`});E.value.showTotal&&(e=[...e,{type:`sum`,value:E.value.translations.total}]);let t;return t=E.value.showAverage&&E.value.showMedian?[...e,{type:`average`,value:E.value.translations.average},{type:`median`,value:E.value.translations.median}]:E.value.showAverage&&!E.value.showMedian?[...e,{type:`average`,value:E.value.translations.average}]:!E.value.showAverage&&E.value.showMedian?[...e,{type:`median`,value:E.value.translations.median}]:e,E.value.showSparklines?[...t,{type:`chart`,value:E.value.translations.chart}]:t}),Y=g({name:1,sum:1,average:1,median:1}),X=g(void 0);function ht(e,t,n){if(!W.value||W.value.length===0||!xt(e))return;if(X.value!==e&&(X.value=void 0),![null,void 0].includes(G.value)&&t!==G.value&&K(),G.value=void 0,Y.value[e]===n&&X.value){X.value=void 0,K();return}X.value=e,ft.value=!0,Y.value[e]=n,[null,void 0].includes(t)||($.value[t].state=Y.value[e]);let r=Y.value[e],i=[...W.value].sort((t,n)=>{let i=t[e],a=n[e];return typeof i==`string`&&typeof a==`string`?r===-1?i.localeCompare(a):a.localeCompare(i):B(i,a,r)});W.value=i}let Z=g(void 0),Q=g(void 0);function gt({dataIndex:e,serieIndex:t}){Z.value=e,Q.value=t,T.value[e]&&!F.value&&T.value[e].scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})}let _t=g(!1);function vt(e){_t.value=e,Ye.value+=1}function yt(e=null){xe(()=>{let t=[E.value.translations.serie].concat(J.value),n=H.value.map((e,t)=>[[e.name],e.values,[e.sum],[e.average],[e.median]]),i=[t].concat(n),a=r(i);e?e(a):re({csvContent:a,title:j.value.text||`vue-ui-table-sparkline`})})}function bt(e){return E.value.sortedDataColumnIndices.includes(e)}function xt(e){return e.type===`name`||e===`name`?E.value.sortedSeriesName:e.type===`sum`||e===`sum`?E.value.sortedSum:e.type===`average`||e===`average`?E.value.sortedAverage:e.type===`median`||e===`median`?E.value.sortedMedian:!1}function St(e,t,n){return[`sum`,`average`,`median`].includes(t.type)?X.value===t.type&&Y.value[t.type]===n?1:.3:e===G.value&&$.value[e].state===n?1:.3}function Ct(){E.value.resetSortOnClickOutside&&K()}let $=l({get:()=>J.value.map(e=>({state:1})),set:e=>e});function wt(e){e?.stage===`start`?Ze.value=!0:e?.stage===`end`?Ze.value=!1:it()}async function Tt(){Je(`copyAlt`,{config:E.value,dataset:H.value}),E.value.userOptions.callbacks.altCopy?await Promise.resolve(E.value.userOptions.callbacks.altCopy({config:E.value,dataset:H.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}return le({generatePdf:rt,generateImage:it,generateCsv:yt,restoreOrder:K,copyAlt:Tt}),(e,t)=>(h(),d(`div`,{ref_key:`tableContainer`,ref:P,class:Se({"vue-data-ui-component":!0,"vue-ui-table-sparkline":!0,"vue-ui-responsive":F.value}),style:{overflow:`hidden`},id:`table_${C.value}`,onMouseenter:t[3]||=()=>y(Qe)(!0),onMouseleave:t[4]||=()=>y(Qe)(!1)},[j.value.text?(h(),d(`div`,{key:0,class:`vue-ui-table-sparkline-caption`,style:m({backgroundColor:j.value.backgroundColor})},[f(`div`,{class:`atom-title`,style:m({fontSize:`${j.value.fontSize}px`,fontWeight:j.value.bold?`bold`:`normal`,color:j.value.color,textAlign:j.value.textAlign})},v(j.value.text),5),j.value.subtitle.text?(h(),d(`div`,{key:0,class:`atom-subtitle`,style:m({fontSize:`${j.value.subtitle.fontSize}px`,fontWeight:j.value.subtitle.bold?`bold`:`normal`,color:j.value.subtitle.color,textAlign:j.value.textAlign})},v(j.value.subtitle.text),5)):u(``,!0)],4)):u(``,!0),f(`div`,{style:{overflow:`auto`},onPointerleave:t[2]||=e=>{Q.value=void 0,Z.value=void 0}},[f(`table`,{class:`vue-ui-data-table`,style:m({fontFamily:E.value.fontFamily,position:`relative`})},[f(`thead`,Pe,[je((h(),d(`tr`,{role:`row`,class:`vue-ui-data-table__thead-row`,style:m({backgroundColor:k.value.backgroundColor,color:k.value.color})},[f(`th`,{role:`cell`,style:m({backgroundColor:k.value.backgroundColor,border:k.value.outline,textAlign:k.value.textAlign,fontWeight:k.value.bold?`bold`:`normal`}),class:`sticky-col-first`},[f(`div`,{style:m({display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`3px`,justifyContent:k.value.textAlign})},[f(`span`,null,v(E.value.translations.serie),1),W.value.length>1&&E.value.sortedSeriesName?(h(),d(`div`,Fe,[f(`button`,{class:`vue-ui-table-sparkline-sorting-button vue-ui-table-sparkline-sorting-button-down`,onClick:t[0]||=e=>q({type:`name`},null,-1),style:m({cursor:M.value?`pointer`:`default`})},[p(y(x),{size:12,name:`arrowBottom`,stroke:k.value.color,style:m({opacity:X.value===`name`&&Y.value.name===-1?1:.3})},null,8,[`stroke`,`style`])],4),f(`button`,{class:`vue-ui-table-sparkline-sorting-button vue-ui-table-sparkline-sorting-button-up`,onClick:t[1]||=e=>q({type:`name`},null,1),style:m({cursor:M.value?`pointer`:`default`})},[p(y(x),{size:12,name:`arrowTop`,stroke:k.value.color,style:m({opacity:X.value===`name`&&Y.value.name===1?1:.3})},null,8,[`stroke`,`style`])],4)])):u(``,!0)],4)],4),(h(!0),d(c,null,_(J.value,(t,n)=>(h(),d(`th`,{role:`cell`,style:m({background:k.value.backgroundColor,border:k.value.outline,textAlign:k.value.textAlign,fontWeight:k.value.bold?`bold`:`normal`,minWidth:n===J.value.length-1?`${O.value.dimensions.width}px`:`48px`,paddingRight:n===J.value.length-1&&D.value.show?`36px`:``}),class:Se({"sticky-col":n===J.value.length-1&&E.value.showSparklines})},[f(`div`,{style:m({display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`3px`,justifyContent:k.value.textAlign})},[f(`span`,null,v(t.value),1),W.value.length>1&&(bt(n)||xt(t))?(h(),d(`div`,Ie,[f(`button`,{class:`vue-ui-table-sparkline-sorting-button vue-ui-table-sparkline-sorting-button-down`,onClick:()=>q(t,n,-1),style:m({cursor:M.value?`pointer`:`default`})},[p(y(x),{size:12,name:`arrowBottom`,stroke:k.value.color,style:m({opacity:St(n,t,-1)})},null,8,[`stroke`,`style`])],12,Le),f(`button`,{class:`vue-ui-table-sparkline-sorting-button vue-ui-table-sparkline-sorting-button-up`,onClick:()=>q(t,n,1),style:m({cursor:M.value?`pointer`:`default`})},[p(y(x),{size:12,name:`arrowTop`,stroke:k.value.color,style:m({opacity:St(n,t,1)})},null,8,[`stroke`,`style`])],12,Re)])):u(``,!0)],4),D.value.show&&n===J.value.length-1&&(y($e)||y(N))?(h(),_e(y(Ke),{ref_for:!0,ref:`details`,key:`user_option_${Ye.value}`,backgroundColor:k.value.backgroundColor,color:k.value.color,isPrinting:y(tt),isImaging:y(nt),uid:C.value,hasPdf:D.value.buttons.pdf,hasXls:D.value.buttons.csv,hasImg:D.value.buttons.img,hasFullscreen:D.value.buttons.fullscreen,hasAltCopy:D.value.buttons.altCopy,isFullscreen:_t.value,titles:{...D.value.buttonTitles},chartElement:P.value,position:D.value.position,callbacks:D.value.callbacks,printScale:D.value.print.scale,isCursorPointer:M.value,onToggleFullscreen:vt,onGeneratePdf:y(rt),onGenerateImage:wt,onGenerateCsv:yt,onCopyAlt:Tt,style:m({visibility:y($e)?y(N)?`visible`:`hidden`:`visible`})},ve({_:2},[_(y(de)(e.$slots,`menuIcon optionPdf optionCsv optionImg optionFullscreen optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:Ae(n=>[Te(e.$slots,t,be({ref_for:!0},y(fe)(t,n)),void 0,!0)])}))]),1032,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`hasPdf`,`hasXls`,`hasImg`,`hasFullscreen`,`hasAltCopy`,`isFullscreen`,`titles`,`chartElement`,`position`,`callbacks`,`printScale`,`isCursorPointer`,`onGeneratePdf`,`style`])):u(``,!0)],6))),256))],4)),[[y(he),Ct]])]),f(`tbody`,null,[(h(!0),d(c,null,_(W.value,(e,t)=>(h(),d(`tr`,{role:`row`,style:m({backgroundColor:A.value.backgroundColor,color:A.value.color}),class:Se({"vue-ui-data-table__tbody__row":!0,"vue-ui-data-table__tbody__row-even":t%2==0,"vue-ui-data-table__tbody__row-odd":t%2!=0})},[f(`td`,{role:`cell`,style:m({backgroundColor:A.value.backgroundColor,border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign}),"data-cell":E.value.translations.serie,class:`vue-ui-data-table__tbody__td sticky-col-first`},[f(`div`,{dir:`auto`,style:m({display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`6px`,justifyContent:A.value.textAlign})},[A.value.showColorMarker?(h(),d(`span`,{key:0,style:m({color:e.color})},`⬤`,4)):u(``,!0),f(`span`,null,v(e.name??`-`),1)],4)],12,ze),(h(!0),d(c,null,_(ut.value,(n,r)=>(h(),d(`td`,{dir:`auto`,role:`cell`,ref_for:!0,ref_key:`TD`,ref:T,style:m({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign,background:Z.value!==void 0&&r===Z.value?A.value.selectedColor.useSerieColor?y(a)(e.color,20):A.value.selectedColor.fallback:``}),"data-cell":J.value[r]?J.value[r].value:``,class:`vue-ui-data-table__tbody__td`,onPointerenter:e=>{Q.value=t,Z.value=r}},v(V(e.values[r],E.value.roundingValues,{datapoint:e,seriesIndex:t,datapointIndex:r})),45,Be))),256)),E.value.showTotal?(h(),d(`td`,{key:0,dir:`auto`,role:`cell`,style:m({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign}),"data-cell":E.value.translations.total,class:`vue-ui-data-table__tbody__td`},v(V(e.sum,E.value.roundingTotal,{datapoint:e.sum,seriesIndex:t})),13,Ve)):u(``,!0),E.value.showAverage?(h(),d(`td`,{key:1,dir:`auto`,role:`cell`,style:m({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign}),"data-cell":E.value.translations.average,class:`vue-ui-data-table__tbody__td`},v(V(e.average,E.value.roundingAverage,{datapoint:e.average,seriesIndex:t})),13,He)):u(``,!0),E.value.showMedian?(h(),d(`td`,{key:2,dir:`auto`,role:`cell`,style:m({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign}),"data-cell":E.value.translations.median,class:`vue-ui-data-table__tbody__td`},v(V(e.median,E.value.roundingMedian,{datapoint:e.median,seriesIndex:t})),13,Ue)):u(``,!0),E.value.showSparklines?(h(),d(`td`,{key:3,role:`cell`,"data-cell":E.value.translations.chart,style:m({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign,backgroundColor:A.value.backgroundColor,padding:`0`}),class:`vue-ui-data-table__tbody__td sticky-col`},[p(y(b),{onHoverIndex:({index:e})=>gt({dataIndex:e,serieIndex:t}),"height-ratio":O.value.dimensions.heightRatio,"forced-padding":30,dataset:e.sparklineDataset,showInfo:!1,selectedIndex:Z.value,config:{type:O.value.type,style:{backgroundColor:`transparent`,animation:{show:O.value.animation.show&&!y(tt)&&!y(nt),animationFrames:O.value.animation.animationFrames},padding:{right:12},line:{color:e.color,smooth:O.value.smooth,cutNullValues:O.value.cutNullValues,strokeWidth:O.value.strokeWidth},bar:{color:e.color},area:{color:e.color,opacity:O.value.showArea?16:0,useGradient:O.value.useGradient},verticalIndicator:{color:e.color},plot:{radius:9,stroke:A.value.backgroundColor,strokeWidth:3}}}},null,8,[`onHoverIndex`,`height-ratio`,`dataset`,`selectedIndex`,`config`])],12,We)):u(``,!0)],6))),256))])],4)],32),e.$slots.source?(h(),d(`div`,Ge,[Te(e.$slots,`source`,{},void 0,!0)],512)):u(``,!0)],42,Ne))}},[[`__scopeId`,`data-v-bb68c573`]]);export{Me as n,b as t};
|
|
1
|
+
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useConfig-6jO1fkp5.js";import{$ as n,D as r,Ht as i,Jt as a,S as o,X as ee,at as s,i as te,m as ne,nt as re,w as ie,yt as ae,zt as oe}from"./lib-rPeBMZrn.js";import{n as se,t as ce}from"./useHints-C-TwxM0Y.js";import{t as le}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as ue}from"./resolveChartConfig-CIhClE5R.js";import{n as de,t as fe}from"./userOptionsSlots-DYuo-E5m.js";import{t as pe}from"./usePrinter-DVf3YcG5.js";import{t as me}from"./useUserOptionState-CXlFnwPv.js";import{t as he}from"./vClickOutside-BxNzkY17.js";import{t as ge}from"./vue_ui_table_sparkline-Dlfbza49.js";import{Fragment as c,computed as l,createBlock as _e,createCommentVNode as u,createElementBlock as d,createElementVNode as f,createSlots as ve,createVNode as p,defineAsyncComponent as ye,mergeProps as be,nextTick as xe,normalizeClass as Se,normalizeStyle as m,onBeforeUnmount as Ce,onMounted as we,openBlock as h,ref as g,renderList as _,renderSlot as Te,shallowRef as Ee,toDisplayString as v,unref as y,useCssVars as De,useSlots as Oe,watch as ke,withCtx as Ae,withDirectives as je}from"vue";var Me=/* @__PURE__ */ e({default:()=>b}),Ne=[`id`],Pe={style:{"z-index":`1`,"padding-right":`24px`}},Fe={key:0,style:{display:`flex`,flexDirection:`row`,alignItems:`center`}},Ie={key:0,style:{display:`flex`,flexDirection:`row`,alignItems:`center`}},Le=[`onClick`],Re=[`onClick`],ze=[`data-cell`],Be=[`data-cell`,`onPointerenter`],Ve=[`data-cell`],He=[`data-cell`],Ue=[`data-cell`],We=[`data-cell`],Ge={key:1,ref:`source`,dir:`auto`},b=/*#__PURE__*/ le({__name:`vue-ui-table-sparkline`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`copyAlt`],setup(e,{expose:le,emit:Me}){De(e=>({v5fe3988e:e.tdo}));let b=ye(()=>import(`./vue-ui-sparkline-BMMrpUPR.js`).then(e=>e.n)),x=ye(()=>import(`./BaseIcon-Cm-IJ179.js`).then(e=>e.n)),Ke=ye(()=>import(`./UserOptions-uWHV_zPB.js`).then(e=>e.n)),{vue_ui_table_sparkline:qe}=t(),S=e,Je=Me,C=g(ee()),Ye=g(0),w=g(0),T=g(null),Xe=Oe(),Ze=g(!1),E=l({get:()=>et(),set:e=>e}),D=l(()=>E.value.userOptions),O=l(()=>E.value.sparkline),k=l(()=>E.value.thead),A=l(()=>E.value.tbody),j=l(()=>E.value.title);we(()=>{Xe[`chart-background`]&&E.value.debug&&console.warn(`VueUiTableSparkline does not support the #chart-background slot.`)}),se({config:()=>E.value,dataset:()=>S.dataset,component:`VueUiTableSparkline`,rules:[ce.emptyArray,{test:e=>e.some(e=>e?.values&&e.values.length>500),message:[`👀 One or more series have > 500 datapoints. Consider if you really need this level of detail.`,``,`▶️ Use larger time scales, or aggregated values`]},{test:e=>e.some(e=>e?.values&&e.values.length>1095),message:[`👀 One or more series have > 1095 datapoints. Above this threshold, the dataset is computed through an LTTB algorithm, to preserve the shape of the data without increasing the number of datapoints.`,``,`▶️ If you need this level of detail, you can change config.downsample.threshold and set a higher value. Note that performance will be impacted.`]}]});let M=l(()=>E.value.userOptions.useCursorPointer),{userOptionsVisible:N,setUserOptionsVisibility:Qe,keepUserOptionState:$e}=me({config:E.value});function et(){return ue(S.config,qe,ge)}ke(()=>S.config,e=>{E.value=et(),N.value=!E.value.userOptions.showOnChartHover,st(),w.value+=1},{deep:!0}),ke(()=>S.dataset,e=>{W.value=U.value,w.value+=1},{deep:!0});let{isPrinting:tt,isImaging:nt,generatePdf:rt,generateImage:it}=pe({elementId:`table_${C.value}`,fileName:j.value.text||`vue-ui-table-sparkline`,options:E.value.userOptions.print}),at=l(()=>ie(E.value.customPalette)),P=g(null),F=g(!1),ot=l(()=>E.value.responsiveBreakpoint);we(()=>{st()});let I=g(E.value.colNames),L=Ee(null);function st(){oe(S.dataset)&&s({componentName:`VueUiTableSparkline`,type:`dataset`}),L.value&&L.value.disconnect(),L.value=new ResizeObserver(e=>{e.forEach(e=>{F.value=e.contentRect.width<ot.value})}),P.value&&L.value.observe(P.value),I.value=[];for(let e=0;e<mt.value;e+=1)I.value.push(E.value.colNames[e]||`col ${e}`)}Ce(()=>{L.value&&L.value.disconnect()});function R(e){if([null,void 0].includes(e))return null;let t=Number(e);return Number.isFinite(t)?t:null}function z(e){return typeof e==`number`&&Number.isFinite(e)}function ct(e=[]){return e.map(R).filter(z)}function B(e,t,n){let r=R(e),i=R(t),a=z(r),o=z(i);return a&&o?n===-1?r-i:i-r:a?-1:+!!o}function V(e,t,r={}){let i=R(e);return i===null?`-`:te(E.value.formatter,i,n({p:E.value.prefix,v:i,s:E.value.suffix,r:t}),r)}let H=l(()=>(S.dataset.forEach((e,t)=>{ae({datasetObject:e,requiredAttributes:[`name`,`values`]}).forEach(e=>{s({componentName:`VueUiTableSparkline`,type:`datasetSerieAttribute`,property:e,index:t})})}),S.dataset.map((e,t)=>{let n=e.values||[],r=ct(n),a=r.length?r.reduce((e,t)=>e+t,0):null,ee=r.length?a/r.length:null,s=r.length?ne(r):null;return{...e,values:n,color:o(e.color)||at.value[t]||i[t]||i[t%i.length],sum:a,average:ee,median:s,sparklineDataset:n.map((e,t)=>({period:E.value.colNames[t]||`col ${t}`,value:R(e)}))}})));function lt(e){let t=(e[0]?.values||[]).map((t,n)=>e.map(e=>e?.values?.[n]??null)).map(e=>e.map((e,t)=>[e,t]).sort((e,t)=>B(e[0],t[0],1)).map(e=>e[1]));return e.map((e,n)=>({...e,values:e.values||[],orders:t[n]}))}let U=l(()=>lt(H.value)),W=g(U.value),ut=l(()=>Math.max(...W.value.map(e=>(e.values||[]).length))),dt=g(void 0),ft=g(!1),G=g(void 0),pt=g(1);function K(){ft.value=!1,G.value=void 0,X.value=void 0,pt.value=1,$.value.forEach(e=>e.state=1),Y.value={name:1,sum:1,average:1,median:1},W.value=U.value}function q(e,t,n){if([`name`,`sum`,`average`,`median`].includes(e.type)){ht(e.type,t,n);return}if(!bt(t))return;if(Z.value=t,X.value=void 0,![null,void 0].includes(G.value)&&t!==G.value&&(G.value=void 0,K()),$.value[t].state===n&&G.value===t){G.value=void 0,K();return}ft.value=!0,G.value=t;let r=U.value.map(e=>e.values?.[t]??null),i=n;$.value[t].state=i,pt.value=i,t===dt.value?dt.value=void 0:dt.value=t;let a=r.map((e,t)=>[t,e]).sort((e,t)=>B(e[1],t[1],i)).map(e=>e[0]).map(e=>U.value[e]);W.value=a,w.value+=1}let mt=l(()=>Math.max(...S.dataset.map(e=>(e.values||[]).length))),J=l(()=>{let e=I.value.map(e=>({type:`reg`,value:e}));if(!e.length)for(let t=0;t<mt.value;t+=1)e.push({type:`reg`,value:`col ${t+1}`});E.value.showTotal&&(e=[...e,{type:`sum`,value:E.value.translations.total}]);let t;return t=E.value.showAverage&&E.value.showMedian?[...e,{type:`average`,value:E.value.translations.average},{type:`median`,value:E.value.translations.median}]:E.value.showAverage&&!E.value.showMedian?[...e,{type:`average`,value:E.value.translations.average}]:!E.value.showAverage&&E.value.showMedian?[...e,{type:`median`,value:E.value.translations.median}]:e,E.value.showSparklines?[...t,{type:`chart`,value:E.value.translations.chart}]:t}),Y=g({name:1,sum:1,average:1,median:1}),X=g(void 0);function ht(e,t,n){if(!W.value||W.value.length===0||!xt(e))return;if(X.value!==e&&(X.value=void 0),![null,void 0].includes(G.value)&&t!==G.value&&K(),G.value=void 0,Y.value[e]===n&&X.value){X.value=void 0,K();return}X.value=e,ft.value=!0,Y.value[e]=n,[null,void 0].includes(t)||($.value[t].state=Y.value[e]);let r=Y.value[e],i=[...W.value].sort((t,n)=>{let i=t[e],a=n[e];return typeof i==`string`&&typeof a==`string`?r===-1?i.localeCompare(a):a.localeCompare(i):B(i,a,r)});W.value=i}let Z=g(void 0),Q=g(void 0);function gt({dataIndex:e,serieIndex:t}){Z.value=e,Q.value=t,T.value[e]&&!F.value&&T.value[e].scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})}let _t=g(!1);function vt(e){_t.value=e,Ye.value+=1}function yt(e=null){xe(()=>{let t=[E.value.translations.serie].concat(J.value),n=H.value.map((e,t)=>[[e.name],e.values,[e.sum],[e.average],[e.median]]),i=[t].concat(n),a=r(i);e?e(a):re({csvContent:a,title:j.value.text||`vue-ui-table-sparkline`})})}function bt(e){return E.value.sortedDataColumnIndices.includes(e)}function xt(e){return e.type===`name`||e===`name`?E.value.sortedSeriesName:e.type===`sum`||e===`sum`?E.value.sortedSum:e.type===`average`||e===`average`?E.value.sortedAverage:e.type===`median`||e===`median`?E.value.sortedMedian:!1}function St(e,t,n){return[`sum`,`average`,`median`].includes(t.type)?X.value===t.type&&Y.value[t.type]===n?1:.3:e===G.value&&$.value[e].state===n?1:.3}function Ct(){E.value.resetSortOnClickOutside&&K()}let $=l({get:()=>J.value.map(e=>({state:1})),set:e=>e});function wt(e){e?.stage===`start`?Ze.value=!0:e?.stage===`end`?Ze.value=!1:it()}async function Tt(){Je(`copyAlt`,{config:E.value,dataset:H.value}),E.value.userOptions.callbacks.altCopy?await Promise.resolve(E.value.userOptions.callbacks.altCopy({config:E.value,dataset:H.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}return le({generatePdf:rt,generateImage:it,generateCsv:yt,restoreOrder:K,copyAlt:Tt}),(e,t)=>(h(),d(`div`,{ref_key:`tableContainer`,ref:P,class:Se({"vue-data-ui-component":!0,"vue-ui-table-sparkline":!0,"vue-ui-responsive":F.value}),style:{overflow:`hidden`},id:`table_${C.value}`,onMouseenter:t[3]||=()=>y(Qe)(!0),onMouseleave:t[4]||=()=>y(Qe)(!1)},[j.value.text?(h(),d(`div`,{key:0,class:`vue-ui-table-sparkline-caption`,style:m({backgroundColor:j.value.backgroundColor})},[f(`div`,{class:`atom-title`,style:m({fontSize:`${j.value.fontSize}px`,fontWeight:j.value.bold?`bold`:`normal`,color:j.value.color,textAlign:j.value.textAlign})},v(j.value.text),5),j.value.subtitle.text?(h(),d(`div`,{key:0,class:`atom-subtitle`,style:m({fontSize:`${j.value.subtitle.fontSize}px`,fontWeight:j.value.subtitle.bold?`bold`:`normal`,color:j.value.subtitle.color,textAlign:j.value.textAlign})},v(j.value.subtitle.text),5)):u(``,!0)],4)):u(``,!0),f(`div`,{style:{overflow:`auto`},onPointerleave:t[2]||=e=>{Q.value=void 0,Z.value=void 0}},[f(`table`,{class:`vue-ui-data-table`,style:m({fontFamily:E.value.fontFamily,position:`relative`})},[f(`thead`,Pe,[je((h(),d(`tr`,{role:`row`,class:`vue-ui-data-table__thead-row`,style:m({backgroundColor:k.value.backgroundColor,color:k.value.color})},[f(`th`,{role:`cell`,style:m({backgroundColor:k.value.backgroundColor,border:k.value.outline,textAlign:k.value.textAlign,fontWeight:k.value.bold?`bold`:`normal`}),class:`sticky-col-first`},[f(`div`,{style:m({display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`3px`,justifyContent:k.value.textAlign})},[f(`span`,null,v(E.value.translations.serie),1),W.value.length>1&&E.value.sortedSeriesName?(h(),d(`div`,Fe,[f(`button`,{class:`vue-ui-table-sparkline-sorting-button vue-ui-table-sparkline-sorting-button-down`,onClick:t[0]||=e=>q({type:`name`},null,-1),style:m({cursor:M.value?`pointer`:`default`})},[p(y(x),{size:12,name:`arrowBottom`,stroke:k.value.color,style:m({opacity:X.value===`name`&&Y.value.name===-1?1:.3})},null,8,[`stroke`,`style`])],4),f(`button`,{class:`vue-ui-table-sparkline-sorting-button vue-ui-table-sparkline-sorting-button-up`,onClick:t[1]||=e=>q({type:`name`},null,1),style:m({cursor:M.value?`pointer`:`default`})},[p(y(x),{size:12,name:`arrowTop`,stroke:k.value.color,style:m({opacity:X.value===`name`&&Y.value.name===1?1:.3})},null,8,[`stroke`,`style`])],4)])):u(``,!0)],4)],4),(h(!0),d(c,null,_(J.value,(t,n)=>(h(),d(`th`,{role:`cell`,style:m({background:k.value.backgroundColor,border:k.value.outline,textAlign:k.value.textAlign,fontWeight:k.value.bold?`bold`:`normal`,minWidth:n===J.value.length-1?`${O.value.dimensions.width}px`:`48px`,paddingRight:n===J.value.length-1&&D.value.show?`36px`:``}),class:Se({"sticky-col":n===J.value.length-1&&E.value.showSparklines})},[f(`div`,{style:m({display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`3px`,justifyContent:k.value.textAlign})},[f(`span`,null,v(t.value),1),W.value.length>1&&(bt(n)||xt(t))?(h(),d(`div`,Ie,[f(`button`,{class:`vue-ui-table-sparkline-sorting-button vue-ui-table-sparkline-sorting-button-down`,onClick:()=>q(t,n,-1),style:m({cursor:M.value?`pointer`:`default`})},[p(y(x),{size:12,name:`arrowBottom`,stroke:k.value.color,style:m({opacity:St(n,t,-1)})},null,8,[`stroke`,`style`])],12,Le),f(`button`,{class:`vue-ui-table-sparkline-sorting-button vue-ui-table-sparkline-sorting-button-up`,onClick:()=>q(t,n,1),style:m({cursor:M.value?`pointer`:`default`})},[p(y(x),{size:12,name:`arrowTop`,stroke:k.value.color,style:m({opacity:St(n,t,1)})},null,8,[`stroke`,`style`])],12,Re)])):u(``,!0)],4),D.value.show&&n===J.value.length-1&&(y($e)||y(N))?(h(),_e(y(Ke),{ref_for:!0,ref:`details`,key:`user_option_${Ye.value}`,backgroundColor:k.value.backgroundColor,color:k.value.color,isPrinting:y(tt),isImaging:y(nt),uid:C.value,hasPdf:D.value.buttons.pdf,hasXls:D.value.buttons.csv,hasImg:D.value.buttons.img,hasFullscreen:D.value.buttons.fullscreen,hasAltCopy:D.value.buttons.altCopy,isFullscreen:_t.value,titles:{...D.value.buttonTitles},chartElement:P.value,position:D.value.position,callbacks:D.value.callbacks,printScale:D.value.print.scale,isCursorPointer:M.value,onToggleFullscreen:vt,onGeneratePdf:y(rt),onGenerateImage:wt,onGenerateCsv:yt,onCopyAlt:Tt,style:m({visibility:y($e)?y(N)?`visible`:`hidden`:`visible`})},ve({_:2},[_(y(de)(e.$slots,`menuIcon optionPdf optionCsv optionImg optionFullscreen optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:Ae(n=>[Te(e.$slots,t,be({ref_for:!0},y(fe)(t,n)),void 0,!0)])}))]),1032,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`hasPdf`,`hasXls`,`hasImg`,`hasFullscreen`,`hasAltCopy`,`isFullscreen`,`titles`,`chartElement`,`position`,`callbacks`,`printScale`,`isCursorPointer`,`onGeneratePdf`,`style`])):u(``,!0)],6))),256))],4)),[[y(he),Ct]])]),f(`tbody`,null,[(h(!0),d(c,null,_(W.value,(e,t)=>(h(),d(`tr`,{role:`row`,style:m({backgroundColor:A.value.backgroundColor,color:A.value.color}),class:Se({"vue-ui-data-table__tbody__row":!0,"vue-ui-data-table__tbody__row-even":t%2==0,"vue-ui-data-table__tbody__row-odd":t%2!=0})},[f(`td`,{role:`cell`,style:m({backgroundColor:A.value.backgroundColor,border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign}),"data-cell":E.value.translations.serie,class:`vue-ui-data-table__tbody__td sticky-col-first`},[f(`div`,{dir:`auto`,style:m({display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`6px`,justifyContent:A.value.textAlign})},[A.value.showColorMarker?(h(),d(`span`,{key:0,style:m({color:e.color})},`⬤`,4)):u(``,!0),f(`span`,null,v(e.name??`-`),1)],4)],12,ze),(h(!0),d(c,null,_(ut.value,(n,r)=>(h(),d(`td`,{dir:`auto`,role:`cell`,ref_for:!0,ref_key:`TD`,ref:T,style:m({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign,background:Z.value!==void 0&&r===Z.value?A.value.selectedColor.useSerieColor?y(a)(e.color,20):A.value.selectedColor.fallback:``}),"data-cell":J.value[r]?J.value[r].value:``,class:`vue-ui-data-table__tbody__td`,onPointerenter:e=>{Q.value=t,Z.value=r}},v(V(e.values[r],E.value.roundingValues,{datapoint:e,seriesIndex:t,datapointIndex:r})),45,Be))),256)),E.value.showTotal?(h(),d(`td`,{key:0,dir:`auto`,role:`cell`,style:m({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign}),"data-cell":E.value.translations.total,class:`vue-ui-data-table__tbody__td`},v(V(e.sum,E.value.roundingTotal,{datapoint:e.sum,seriesIndex:t})),13,Ve)):u(``,!0),E.value.showAverage?(h(),d(`td`,{key:1,dir:`auto`,role:`cell`,style:m({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign}),"data-cell":E.value.translations.average,class:`vue-ui-data-table__tbody__td`},v(V(e.average,E.value.roundingAverage,{datapoint:e.average,seriesIndex:t})),13,He)):u(``,!0),E.value.showMedian?(h(),d(`td`,{key:2,dir:`auto`,role:`cell`,style:m({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign}),"data-cell":E.value.translations.median,class:`vue-ui-data-table__tbody__td`},v(V(e.median,E.value.roundingMedian,{datapoint:e.median,seriesIndex:t})),13,Ue)):u(``,!0),E.value.showSparklines?(h(),d(`td`,{key:3,role:`cell`,"data-cell":E.value.translations.chart,style:m({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign,backgroundColor:A.value.backgroundColor,padding:`0`}),class:`vue-ui-data-table__tbody__td sticky-col`},[p(y(b),{onHoverIndex:({index:e})=>gt({dataIndex:e,serieIndex:t}),"height-ratio":O.value.dimensions.heightRatio,"forced-padding":30,dataset:e.sparklineDataset,showInfo:!1,selectedIndex:Z.value,config:{type:O.value.type,style:{backgroundColor:`transparent`,animation:{show:O.value.animation.show&&!y(tt)&&!y(nt),animationFrames:O.value.animation.animationFrames},padding:{right:12},line:{color:e.color,smooth:O.value.smooth,cutNullValues:O.value.cutNullValues,strokeWidth:O.value.strokeWidth},bar:{color:e.color},area:{color:e.color,opacity:O.value.showArea?16:0,useGradient:O.value.useGradient},verticalIndicator:{color:e.color},plot:{radius:9,stroke:A.value.backgroundColor,strokeWidth:3}}}},null,8,[`onHoverIndex`,`height-ratio`,`dataset`,`selectedIndex`,`config`])],12,We)):u(``,!0)],6))),256))])],4)],32),e.$slots.source?(h(),d(`div`,Ge,[Te(e.$slots,`source`,{},void 0,!0)],512)):u(``,!0)],42,Ne))}},[[`__scopeId`,`data-v-bb68c573`]]);export{Me as n,b as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useConfig-6jO1fkp5.js";import{$ as n,Ht as r,Jt as i,S as a,X as ee,at as o,b as s,i as te,in as ne,t as re,w as ie,yt as ae,zt as oe}from"./lib-rPeBMZrn.js";import{n as se,t as ce}from"./BaseScanner-8NdoBs7B.js";import{n as le,t as ue}from"./useHints-C-TwxM0Y.js";import{t as de}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as fe}from"./resolveChartConfig-CIhClE5R.js";import{t as pe}from"./img-D4RQwASc.js";import{n as me}from"./Title-BliHuXfT.js";import{t as he}from"./useChartExport-BZts4KFb.js";import{n as ge,t as _e}from"./annotationSlots-BRR85CqJ.js";import{n as ve,t as ye}from"./userOptionsSlots-DYuo-E5m.js";import{t as be}from"./usePrinter-DVf3YcG5.js";import{c as xe}from"./canvas-lib-22VpOI4_.js";import{t as Se}from"./useResponsive-CENUxfEL.js";import{t as Ce}from"./DefGrad-DKMq1REY.js";import{t as we}from"./useUserOptionState-CXlFnwPv.js";import{t as Te}from"./useChartAccessibility-DOMuYJfm.js";import{t as Ee}from"./usePrefersMotion-XLHwega2.js";import{t as De}from"./useAutoSizeLabelsInsideViewbox-AIRF0PlD.js";import{t as Oe}from"./vue_ui_thermometer-CRijq6H6.js";import{Fragment as c,computed as l,createBlock as u,createCommentVNode as d,createElementBlock as f,createElementVNode as p,createSlots as ke,createVNode as Ae,defineAsyncComponent as m,guardReactiveProps as h,normalizeClass as g,normalizeProps as _,normalizeStyle as je,onMounted as Me,openBlock as v,ref as y,renderList as b,renderSlot as x,toDisplayString as S,toRefs as Ne,unref as C,useCssVars as Pe,watch as Fe,withCtx as Ie}from"vue";var Le=/* @__PURE__ */ e({default:()=>w}),Re=[`id`],ze={key:1,ref:`noTitle`,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},Be=[`xmlns`,`viewBox`,`aria-labelledby`,`aria-describedby`],Ve=[`id`],He=[`id`],Ue=[`width`,`height`],We=[`id`],Ge=[`x`,`y`,`width`,`height`,`rx`,`ry`],Ke=[`clip-path`],qe=[`x`,`y`,`height`,`width`],Je=[`x`,`y`,`height`,`width`,`fill`],Ye=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],Xe=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],Ze=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],Qe=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],$e=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],et=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],tt=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],nt=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],rt=[`x`,`y`,`height`,`width`],it=[`aria-label`],at=[`x`,`y`,`height`],ot=[`y`,`x`,`fill`,`font-size`,`font-weight`],st={key:4,class:`vue-data-ui-watermark`},w=/*#__PURE__*/ de({__name:`vue-ui-thermometer`,props:{dataset:{type:Object,default(){return{}}},config:{type:Object,default(){return{}}}},emits:[`copyAlt`],setup(e,{expose:de,emit:Le}){Pe(e=>({fff55a2e:Mt.value,v6d4692c5:jt.value,v4e7414f2:At.value}));let w=m(()=>import(`./PackageVersion-CXT-eAuk.js`).then(e=>e.t)),ct=m(()=>import(`./PenAndPaper-BGEp-TUm.js`).then(e=>e.t)),lt=m(()=>import(`./UserOptions-uWHV_zPB.js`).then(e=>e.n)),{vue_ui_thermometer:ut}=t(),dt=Ee(),T=e,ft=Le,E=y(ee()),D=y(null),pt=y(0),mt=y(0),ht=y(null),gt=y(null),O=y(null),k=y(null),_t=l(()=>!!T.dataset&&Object.keys(T.dataset).length);Me(()=>{St()});let A=y(B()),j=l(()=>A.value.userOptions),M=l(()=>A.value.style.chart.graduations),N=l(()=>A.value.style.chart);le({config:()=>A.value,dataset:()=>T.dataset,component:`VueUiThermometer`,rules:[ue.noHint]});let vt=y(N.value.thermometer.width),P=y(N.value.height),F=y(N.value.width),yt=l(()=>A.value.userOptions.useCursorPointer),bt=l(()=>ne({defaultConfig:{userOptions:{show:!1},style:{chart:{animation:{use:!1},backgroundColor:`#99999930`,graduations:{stroke:`#6A6A6A`}}}},userConfig:A.value.skeletonConfig??{}})),{loading:I,FINAL_DATASET:L}=se({...Ne(T),FINAL_CONFIG:A,prepareConfig:B,skeletonDataset:T.config?.skeletonDataset??{value:0,from:-100,to:100,steps:20,colors:{from:`#A1A1A1`,to:`#CACACA`}},skeletonConfig:ne({defaultConfig:A.value,userConfig:bt.value})}),xt=l(()=>A.value.debug);function St(){if(oe(T.dataset)?o({componentName:`VueUiThermometer`,type:`dataset`,debug:xt.value}):ae({datasetObject:T.dataset,requiredAttributes:[`value`,`from`,`to`]}).forEach(e=>{o({componentName:`VueUiThermometer`,type:`datasetAttribute`,property:e,debug:xt.value})}),A.value.responsive){let e=xe(()=>{let{width:e,height:t}=Se({chart:D.value,title:A.value.style.title.text?ht.value:null,source:gt.value});requestAnimationFrame(()=>{P.value=Math.max(.1,t-12),F.value=e,Rt()})});O.value&&(k.value&&O.value.unobserve(k.value),O.value.disconnect()),O.value=new ResizeObserver(e),k.value=D.value,O.value.observe(k.value)}Rt()}let{userOptionsVisible:R,setUserOptionsVisibility:Ct,keepUserOptionState:wt}=we({config:A.value}),{svgRef:z}=Te({config:A.value.style.title});function B(){return fe(T.config,ut,Oe)}Fe(()=>T.config,e=>{A.value=B(),R.value=!A.value.userOptions.showOnChartHover,vt.value=N.value.thermometer.width,P.value=N.value.height,F.value=N.value.width,St(),mt.value+=1},{deep:!0});let{isPrinting:V,isImaging:H,generatePdf:Tt,generateImage:Et}=be({elementId:`thermometer__${E.value}`,fileName:A.value.style.title.text||`vue-ui-thermometer`,options:A.value.userOptions.print}),Dt=l(()=>A.value.userOptions.show&&!A.value.style.title.text),U=l(()=>ie(A.value.customPalette)),W=l(()=>L.value.steps||10);function G(e,t,n){let r=[],i=Ot(e),a=Ot(t);for(let e=0;e<n;e+=1){let t=K(i.red,a.red,e,n),ee=K(i.green,a.green,e,n),o=K(i.blue,a.blue,e,n),s=`#${q(t)}${q(ee)}${q(o)}`;r.push(s)}return r}function Ot(e){let t=e.slice(1);return{red:parseInt(t.slice(0,2),16),green:parseInt(t.slice(2,4),16),blue:parseInt(t.slice(4,6),16)}}function K(e,t,n,r){return Math.round(e+(t-e)*n/r)}function q(e){return e.toString(16).padStart(2,`0`)}let J=l(()=>{let e=Math.max(.1,F.value),t=Math.max(.1,P.value),n=N.value.padding;return{width:e,left:e/2-N.value.thermometer.width/2,right:e/2+N.value.thermometer.width/2,top:n.top,bottom:t-n.bottom-n.top,height:t,thermoHeight:t-n.top-n.bottom,thermoWidth:N.value.thermometer.width}}),kt=l(()=>J.value),Y=l(()=>{let e=s(L.value.from)<0?Math.abs(s(L.value.from)):s(L.value.from),t=s(L.value.to)<0?Math.abs(s(L.value.to)):s(L.value.to),n=0;return n=s(L.value.to)>0?e+t:e>t?e-t:t-e,(1-(Math.abs(s(L.value.from))+s(L.value.value))/n)*J.value.thermoHeight}),At=l(()=>`${Y.value}px`),jt=l(()=>`${J.value.thermoHeight}px`),Mt=l(()=>dt.value?`0ms`:`${N.value.animation.speedMs}ms`),Nt=l(()=>{if(L.value.colors){if(!L.value.colors.from)return G(U.value[0]||r[0],a(L.value.colors.to),W.value||10);if(!L.value.colors.to)return G(a(L.value.colors.from),U.value[1]||r[1],W.value||10)}else return G(U.value[1]||r[1],U.value[0]||r[0],W.value||10);return G(a(L.value.colors.from),a(L.value.colors.to),W.value||10)}),Pt=l(()=>{let e=[],t=0,n=J.value.thermoHeight;for(let r=0;r<n-1;r+=n/W.value)e.push({x:J.value.left,y:J.value.top+r,qYLess:J.value.top+r+n/W.value/4,halfY:J.value.top+r+n/W.value/2,qYMore:J.value.top+r+n/W.value/4*3,color:Nt.value[t],height:Math.max(.1,n/W.value)}),t+=1;return e}),X=y(!1);function Ft(e){X.value=e,pt.value+=1}let Z=y(!1);function It(){Z.value=!Z.value}async function Lt({scale:e=2}={}){if(!D.value)return;let{width:t,height:n}=D.value.getBoundingClientRect(),r=t/n,{imageUri:i,base64:a}=await pe({domElement:D.value,base64:!0,img:!0,scale:e});return{imageUri:i,base64:a,title:A.value.style.title.text,width:t,height:n,aspectRatio:r}}let Q=l({get:()=>N.value.label.fontSize,set:e=>e}),{autoSizeLabels:Rt}=De({svgRef:z,fontSize:N.value.label.fontSize,minFontSize:N.value.label.minFontSize,sizeRef:Q,labelClass:`.vue-ui-thermometer-label`}),zt=l(()=>N.value.backgroundColor),Bt=l(()=>A.value.style.title),{isCallbackImaging:Vt,isCallbackSvg:Ht,generateSvg:Ut,onGenerateImage:Wt}=he({svg:z,title:Bt,legend:null,legendItems:null,backgroundColor:zt,getSvgCallback:()=>A.value.userOptions.callbacks.svg,generateImage:Et});async function Gt(){ft(`copyAlt`,{config:A.value,dataset:L.value}),A.value.userOptions.callbacks.altCopy?await Promise.resolve(A.value.userOptions.callbacks.altCopy({config:A.value,dataset:L.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}let Kt=l(()=>`${E.value}-title`),qt=l(()=>`${E.value}-desc`),$=l(()=>te(N.value.label.formatter,L.value.value,n({p:N.value.label.prefix,v:L.value.value,s:N.value.label.suffix,r:N.value.label.rounding}),{datapoint:L.value})),Jt=l(()=>A.value.style.title.text||``),Yt=l(()=>{if(I.value)return`...`;let e=s(L.value.from),t=s(L.value.to);return`Thermometer value: ${$.value}. Range: ${e} to ${t}.`});return de({getImage:Lt,generatePdf:Tt,generateImage:Et,generateSvg:Ut,toggleAnnotator:It,toggleFullscreen:Ft,copyAlt:Gt}),(e,t)=>(v(),f(`div`,{ref_key:`thermoChart`,ref:D,class:g(`vue-data-ui-component vue-ui-thermometer ${X.value?`vue-data-ui-wrapper-fullscreen`:``}`),style:je(`width:100%;background:${N.value.backgroundColor};color:${N.value.color};font-family:${A.value.style.fontFamily}`),id:`thermometer__${E.value}`,onMouseenter:t[0]||=()=>C(Ct)(!0),onMouseleave:t[1]||=()=>C(Ct)(!1)},[j.value.buttons.annotator?(v(),u(C(ct),{key:0,svgRef:C(z),backgroundColor:N.value.backgroundColor,color:N.value.color,active:Z.value,isCursorPointer:yt.value,palette:j.value.annotatorPalette,onClose:It},ke({_:2},[b(C(_e),t=>({name:t,fn:Ie(n=>[x(e.$slots,t,_(h(C(ge)(t,n))),void 0,!0)])}))]),1032,[`svgRef`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):d(``,!0),Dt.value?(v(),f(`div`,ze,null,512)):d(``,!0),A.value.style.title.text?(v(),f(`div`,{key:2,ref_key:`chartTitle`,ref:ht,style:`width:100%`},[(v(),u(me,{key:`title_${mt.value}`,config:{title:{cy:`thermometer-div-title`,...A.value.style.title},subtitle:{cy:`thermometer-div-subtitle`,...A.value.style.title.subtitle}}},null,8,[`config`]))],512)):d(``,!0),j.value.show&&_t.value&&(C(wt)||C(R))?(v(),u(C(lt),{ref:`details`,key:`user_options_${pt.value}`,backgroundColor:N.value.backgroundColor,color:N.value.color,isImaging:C(H),isPrinting:C(V),uid:E.value,hasPdf:j.value.buttons.pdf,hasImg:j.value.buttons.img,hasSvg:j.value.buttons.svg,hasFullscreen:j.value.buttons.fullscreen,hasAltCopy:j.value.buttons.altCopy,hasXls:!1,isFullscreen:X.value,titles:{...j.value.buttonTitles},chartElement:D.value,position:j.value.position,hasAnnotator:j.value.buttons.annotator,isAnnotation:Z.value,callbacks:j.value.callbacks,printScale:j.value.print.scale,isCursorPointer:yt.value,onToggleFullscreen:Ft,onGeneratePdf:C(Tt),onGenerateImage:C(Wt),onGenerateSvg:C(Ut),onToggleAnnotator:It,onCopyAlt:Gt,style:je({visibility:C(wt)?C(R)?`visible`:`hidden`:`visible`})},ke({_:2},[b(C(ve)(e.$slots,`menuIcon optionPdf optionImg optionSvg optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:Ie(n=>[x(e.$slots,t,_(h(C(ye)(t,n))),void 0,!0)])}))]),1032,[`backgroundColor`,`color`,`isImaging`,`isPrinting`,`uid`,`hasPdf`,`hasImg`,`hasSvg`,`hasFullscreen`,`hasAltCopy`,`isFullscreen`,`titles`,`chartElement`,`position`,`hasAnnotator`,`isAnnotation`,`callbacks`,`printScale`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):d(``,!0),(v(),f(`svg`,{ref_key:`svgRef`,ref:z,xmlns:C(re),class:g({"vue-data-ui-fullscreen--on":X.value,"vue-data-ui-fulscreen--off":!X.value}),width:`100%`,viewBox:`0 0 ${J.value.width} ${J.value.height}`,style:`background:transparent`,"aria-labelledby":Kt.value,"aria-describedby":qt.value},[p(`title`,{id:Kt.value},S(Jt.value),9,Ve),p(`desc`,{id:qt.value},S(Yt.value),9,He),Ae(C(w)),x(e.$slots,`svg-underlayer`,{svg:{...kt.value,isPrintingImg:C(V)||C(H)||C(Vt),isPrintingSvg:C(Ht)}},void 0,!0),e.$slots[`chart-background`]?(v(),f(`foreignObject`,{key:0,x:0,y:0,width:J.value.width,height:J.value.height,style:{pointerEvents:`none`}},[x(e.$slots,`chart-background`,{},void 0,!0)],8,Ue)):d(``,!0),p(`defs`,null,[p(`clipPath`,{id:`vueUiPill-${E.value}`,clipPathUnits:`userSpaceOnUse`},[p(`rect`,{x:J.value.left,y:J.value.top,width:J.value.thermoWidth,height:J.value.thermoHeight,rx:J.value.thermoWidth/2,ry:J.value.thermoWidth/2},null,8,Ge)],8,We),(v(!0),f(c,null,b(Pt.value,(e,t)=>(v(),u(Ce,{t:`linear`,id:`vueUiThermometerGradient_${t}_${E.value}`,key:`t_${t}_${E.value}`,x1:`0%`,y1:`0%`,x2:`100%`,y2:`0%`,stops:[[`0%`,e.color,1],[`50%`,C(i)(e.color,100-M.value.gradient.intensity),1],[`100%`,e.color,1]]},null,8,[`id`,`stops`]))),128))]),p(`g`,{"clip-path":`url(#vueUiPill-${E.value})`},[p(`rect`,{x:J.value.left,y:J.value.top,height:J.value.thermoHeight,width:J.value.thermoWidth,fill:`#FFFFFF`},null,8,qe),(v(!0),f(c,null,b(Pt.value,(e,t)=>(v(),f(`g`,{key:`graduation_${t}`},[p(`rect`,{x:e.x,y:e.y,height:e.height,width:J.value.thermoWidth,fill:M.value.gradient.show?`url(#vueUiThermometerGradient_${t}_${E.value})`:e.color,"shape-rendering":`crispEdges`},null,8,Je),M.value.show&&[`both`,`left`].includes(M.value.sides)?(v(),f(`line`,{key:0,x1:e.x,x2:e.x+10,y1:e.y,y2:e.y,"stroke-width":M.value.strokeWidth,stroke:M.value.stroke,"stroke-linecap":`round`},null,8,Ye)):d(``,!0),M.value.showIntermediate?(v(),f(c,{key:1},[M.value.show&&[`both`,`left`].includes(M.value.sides)?(v(),f(`line`,{key:0,x1:e.x,x2:e.x+5,y1:e.halfY,y2:e.halfY,"stroke-width":M.value.strokeWidth/2,stroke:M.value.stroke,"stroke-linecap":`round`},null,8,Xe)):d(``,!0),M.value.show&&[`both`,`left`].includes(M.value.sides)?(v(),f(`line`,{key:1,x1:e.x,x2:e.x+2.5,y1:e.qYLess,y2:e.qYLess,"stroke-width":M.value.strokeWidth/2,stroke:M.value.stroke,"stroke-linecap":`round`},null,8,Ze)):d(``,!0),M.value.show&&[`both`,`left`].includes(M.value.sides)?(v(),f(`line`,{key:2,x1:e.x,x2:e.x+2.5,y1:e.qYMore,y2:e.qYMore,"stroke-width":M.value.strokeWidth/2,stroke:M.value.stroke,"stroke-linecap":`round`},null,8,Qe)):d(``,!0)],64)):d(``,!0),M.value.show&&[`both`,`right`].includes(M.value.sides)?(v(),f(`line`,{key:2,x1:J.value.right,x2:J.value.right-10,y1:e.y,y2:e.y,"stroke-width":M.value.strokeWidth,stroke:M.value.stroke,"stroke-linecap":`round`},null,8,$e)):d(``,!0),M.value.showIntermediate?(v(),f(c,{key:3},[M.value.show&&[`both`,`right`].includes(M.value.sides)?(v(),f(`line`,{key:0,x1:J.value.right,x2:J.value.right-5,y1:e.halfY,y2:e.halfY,"stroke-width":M.value.strokeWidth/2,stroke:M.value.stroke,"stroke-linecap":`round`},null,8,et)):d(``,!0),M.value.show&&[`both`,`right`].includes(M.value.sides)?(v(),f(`line`,{key:1,x1:J.value.right,x2:J.value.right-2.5,y1:e.qYLess,y2:e.qYLess,"stroke-width":M.value.strokeWidth/2,stroke:M.value.stroke,"stroke-linecap":`round`},null,8,tt)):d(``,!0),M.value.show&&[`both`,`right`].includes(M.value.sides)?(v(),f(`line`,{key:2,x1:J.value.right,x2:J.value.right-2.5,y1:e.qYMore,y2:e.qYMore,"stroke-width":M.value.strokeWidth/2,stroke:M.value.stroke,"stroke-linecap":`round`},null,8,nt)):d(``,!0)],64)):d(``,!0)]))),128)),p(`rect`,{class:g({"vue-ui-thermometer-temperature":N.value.animation.use}),x:J.value.left,y:J.value.top,height:Y.value,width:J.value.thermoWidth,fill:`#FFFFFF66`},null,10,rt)],8,Ke),N.value.label.show?(v(),f(`g`,{key:1,role:`status`,"aria-live":`polite`,"aria-label":C(I)?`Loading data`:$.value},[C(I)?(v(),f(`rect`,{key:0,x:J.value.left-60,y:Y.value+J.value.top-Q.value/2,width:50,height:Q.value,fill:`#6A6A6A40`,rx:`3`},null,8,at)):(v(),f(`text`,{key:1,"aria-hidden":`true`,class:g({"vue-ui-thermometer-temperature-value":N.value.animation.use,"vue-ui-thermometer-label":!0}),y:Y.value+J.value.top+Q.value/3,x:J.value.left-10,"text-anchor":`end`,fill:N.value.label.color,"font-size":Q.value,"font-weight":N.value.label.bold?`bold`:`normal`},S($.value),11,ot))],8,it)):d(``,!0),x(e.$slots,`svg`,{svg:{...kt.value,isPrintingImg:C(V)||C(H)||C(Vt),isPrintingSvg:C(Ht)}},void 0,!0)],10,Be)),e.$slots.watermark?(v(),f(`div`,st,[x(e.$slots,`watermark`,_(h({isPrinting:C(V)||C(H)||C(Vt)||C(Ht)})),void 0,!0)])):d(``,!0),e.$slots.source?(v(),f(`div`,{key:5,ref_key:`source`,ref:gt,dir:`auto`},[x(e.$slots,`source`,{},void 0,!0)],512)):d(``,!0),x(e.$slots,`skeleton`,{},()=>[C(I)?(v(),u(ce,{key:0})):d(``,!0)],!0)],46,Re))}},[[`__scopeId`,`data-v-fec98266`]]);export{Le as n,w as t};
|
|
1
|
+
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useConfig-6jO1fkp5.js";import{$ as n,Ht as r,Jt as i,S as a,X as ee,at as o,b as s,i as te,in as ne,t as re,w as ie,yt as ae,zt as oe}from"./lib-rPeBMZrn.js";import{n as se,t as ce}from"./BaseScanner-8NdoBs7B.js";import{n as le,t as ue}from"./useHints-C-TwxM0Y.js";import{t as de}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as fe}from"./resolveChartConfig-CIhClE5R.js";import{t as pe}from"./img-D4RQwASc.js";import{n as me}from"./Title-BliHuXfT.js";import{t as he}from"./useChartExport-BZts4KFb.js";import{n as ge,t as _e}from"./annotationSlots-BRR85CqJ.js";import{n as ve,t as ye}from"./userOptionsSlots-DYuo-E5m.js";import{t as be}from"./usePrinter-DVf3YcG5.js";import{c as xe}from"./canvas-lib-22VpOI4_.js";import{t as Se}from"./useResponsive-CENUxfEL.js";import{t as Ce}from"./DefGrad-DKMq1REY.js";import{t as we}from"./useUserOptionState-CXlFnwPv.js";import{t as Te}from"./useChartAccessibility-DOMuYJfm.js";import{t as Ee}from"./usePrefersMotion-XLHwega2.js";import{t as De}from"./useAutoSizeLabelsInsideViewbox-AIRF0PlD.js";import{t as Oe}from"./vue_ui_thermometer-CRijq6H6.js";import{Fragment as c,computed as l,createBlock as u,createCommentVNode as d,createElementBlock as f,createElementVNode as p,createSlots as ke,createVNode as Ae,defineAsyncComponent as m,guardReactiveProps as h,normalizeClass as g,normalizeProps as _,normalizeStyle as je,onMounted as Me,openBlock as v,ref as y,renderList as b,renderSlot as x,toDisplayString as S,toRefs as Ne,unref as C,useCssVars as Pe,watch as Fe,withCtx as Ie}from"vue";var Le=/* @__PURE__ */ e({default:()=>w}),Re=[`id`],ze={key:1,ref:`noTitle`,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},Be=[`xmlns`,`viewBox`,`aria-labelledby`,`aria-describedby`],Ve=[`id`],He=[`id`],Ue=[`width`,`height`],We=[`id`],Ge=[`x`,`y`,`width`,`height`,`rx`,`ry`],Ke=[`clip-path`],qe=[`x`,`y`,`height`,`width`],Je=[`x`,`y`,`height`,`width`,`fill`],Ye=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],Xe=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],Ze=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],Qe=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],$e=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],et=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],tt=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],nt=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],rt=[`x`,`y`,`height`,`width`],it=[`aria-label`],at=[`x`,`y`,`height`],ot=[`y`,`x`,`fill`,`font-size`,`font-weight`],st={key:4,class:`vue-data-ui-watermark`},w=/*#__PURE__*/ de({__name:`vue-ui-thermometer`,props:{dataset:{type:Object,default(){return{}}},config:{type:Object,default(){return{}}}},emits:[`copyAlt`],setup(e,{expose:de,emit:Le}){Pe(e=>({fff55a2e:Mt.value,v6d4692c5:jt.value,v4e7414f2:At.value}));let w=m(()=>import(`./PackageVersion-DhptF5oD.js`).then(e=>e.t)),ct=m(()=>import(`./PenAndPaper-BGEp-TUm.js`).then(e=>e.t)),lt=m(()=>import(`./UserOptions-uWHV_zPB.js`).then(e=>e.n)),{vue_ui_thermometer:ut}=t(),dt=Ee(),T=e,ft=Le,E=y(ee()),D=y(null),pt=y(0),mt=y(0),ht=y(null),gt=y(null),O=y(null),k=y(null),_t=l(()=>!!T.dataset&&Object.keys(T.dataset).length);Me(()=>{St()});let A=y(B()),j=l(()=>A.value.userOptions),M=l(()=>A.value.style.chart.graduations),N=l(()=>A.value.style.chart);le({config:()=>A.value,dataset:()=>T.dataset,component:`VueUiThermometer`,rules:[ue.noHint]});let vt=y(N.value.thermometer.width),P=y(N.value.height),F=y(N.value.width),yt=l(()=>A.value.userOptions.useCursorPointer),bt=l(()=>ne({defaultConfig:{userOptions:{show:!1},style:{chart:{animation:{use:!1},backgroundColor:`#99999930`,graduations:{stroke:`#6A6A6A`}}}},userConfig:A.value.skeletonConfig??{}})),{loading:I,FINAL_DATASET:L}=se({...Ne(T),FINAL_CONFIG:A,prepareConfig:B,skeletonDataset:T.config?.skeletonDataset??{value:0,from:-100,to:100,steps:20,colors:{from:`#A1A1A1`,to:`#CACACA`}},skeletonConfig:ne({defaultConfig:A.value,userConfig:bt.value})}),xt=l(()=>A.value.debug);function St(){if(oe(T.dataset)?o({componentName:`VueUiThermometer`,type:`dataset`,debug:xt.value}):ae({datasetObject:T.dataset,requiredAttributes:[`value`,`from`,`to`]}).forEach(e=>{o({componentName:`VueUiThermometer`,type:`datasetAttribute`,property:e,debug:xt.value})}),A.value.responsive){let e=xe(()=>{let{width:e,height:t}=Se({chart:D.value,title:A.value.style.title.text?ht.value:null,source:gt.value});requestAnimationFrame(()=>{P.value=Math.max(.1,t-12),F.value=e,Rt()})});O.value&&(k.value&&O.value.unobserve(k.value),O.value.disconnect()),O.value=new ResizeObserver(e),k.value=D.value,O.value.observe(k.value)}Rt()}let{userOptionsVisible:R,setUserOptionsVisibility:Ct,keepUserOptionState:wt}=we({config:A.value}),{svgRef:z}=Te({config:A.value.style.title});function B(){return fe(T.config,ut,Oe)}Fe(()=>T.config,e=>{A.value=B(),R.value=!A.value.userOptions.showOnChartHover,vt.value=N.value.thermometer.width,P.value=N.value.height,F.value=N.value.width,St(),mt.value+=1},{deep:!0});let{isPrinting:V,isImaging:H,generatePdf:Tt,generateImage:Et}=be({elementId:`thermometer__${E.value}`,fileName:A.value.style.title.text||`vue-ui-thermometer`,options:A.value.userOptions.print}),Dt=l(()=>A.value.userOptions.show&&!A.value.style.title.text),U=l(()=>ie(A.value.customPalette)),W=l(()=>L.value.steps||10);function G(e,t,n){let r=[],i=Ot(e),a=Ot(t);for(let e=0;e<n;e+=1){let t=K(i.red,a.red,e,n),ee=K(i.green,a.green,e,n),o=K(i.blue,a.blue,e,n),s=`#${q(t)}${q(ee)}${q(o)}`;r.push(s)}return r}function Ot(e){let t=e.slice(1);return{red:parseInt(t.slice(0,2),16),green:parseInt(t.slice(2,4),16),blue:parseInt(t.slice(4,6),16)}}function K(e,t,n,r){return Math.round(e+(t-e)*n/r)}function q(e){return e.toString(16).padStart(2,`0`)}let J=l(()=>{let e=Math.max(.1,F.value),t=Math.max(.1,P.value),n=N.value.padding;return{width:e,left:e/2-N.value.thermometer.width/2,right:e/2+N.value.thermometer.width/2,top:n.top,bottom:t-n.bottom-n.top,height:t,thermoHeight:t-n.top-n.bottom,thermoWidth:N.value.thermometer.width}}),kt=l(()=>J.value),Y=l(()=>{let e=s(L.value.from)<0?Math.abs(s(L.value.from)):s(L.value.from),t=s(L.value.to)<0?Math.abs(s(L.value.to)):s(L.value.to),n=0;return n=s(L.value.to)>0?e+t:e>t?e-t:t-e,(1-(Math.abs(s(L.value.from))+s(L.value.value))/n)*J.value.thermoHeight}),At=l(()=>`${Y.value}px`),jt=l(()=>`${J.value.thermoHeight}px`),Mt=l(()=>dt.value?`0ms`:`${N.value.animation.speedMs}ms`),Nt=l(()=>{if(L.value.colors){if(!L.value.colors.from)return G(U.value[0]||r[0],a(L.value.colors.to),W.value||10);if(!L.value.colors.to)return G(a(L.value.colors.from),U.value[1]||r[1],W.value||10)}else return G(U.value[1]||r[1],U.value[0]||r[0],W.value||10);return G(a(L.value.colors.from),a(L.value.colors.to),W.value||10)}),Pt=l(()=>{let e=[],t=0,n=J.value.thermoHeight;for(let r=0;r<n-1;r+=n/W.value)e.push({x:J.value.left,y:J.value.top+r,qYLess:J.value.top+r+n/W.value/4,halfY:J.value.top+r+n/W.value/2,qYMore:J.value.top+r+n/W.value/4*3,color:Nt.value[t],height:Math.max(.1,n/W.value)}),t+=1;return e}),X=y(!1);function Ft(e){X.value=e,pt.value+=1}let Z=y(!1);function It(){Z.value=!Z.value}async function Lt({scale:e=2}={}){if(!D.value)return;let{width:t,height:n}=D.value.getBoundingClientRect(),r=t/n,{imageUri:i,base64:a}=await pe({domElement:D.value,base64:!0,img:!0,scale:e});return{imageUri:i,base64:a,title:A.value.style.title.text,width:t,height:n,aspectRatio:r}}let Q=l({get:()=>N.value.label.fontSize,set:e=>e}),{autoSizeLabels:Rt}=De({svgRef:z,fontSize:N.value.label.fontSize,minFontSize:N.value.label.minFontSize,sizeRef:Q,labelClass:`.vue-ui-thermometer-label`}),zt=l(()=>N.value.backgroundColor),Bt=l(()=>A.value.style.title),{isCallbackImaging:Vt,isCallbackSvg:Ht,generateSvg:Ut,onGenerateImage:Wt}=he({svg:z,title:Bt,legend:null,legendItems:null,backgroundColor:zt,getSvgCallback:()=>A.value.userOptions.callbacks.svg,generateImage:Et});async function Gt(){ft(`copyAlt`,{config:A.value,dataset:L.value}),A.value.userOptions.callbacks.altCopy?await Promise.resolve(A.value.userOptions.callbacks.altCopy({config:A.value,dataset:L.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}let Kt=l(()=>`${E.value}-title`),qt=l(()=>`${E.value}-desc`),$=l(()=>te(N.value.label.formatter,L.value.value,n({p:N.value.label.prefix,v:L.value.value,s:N.value.label.suffix,r:N.value.label.rounding}),{datapoint:L.value})),Jt=l(()=>A.value.style.title.text||``),Yt=l(()=>{if(I.value)return`...`;let e=s(L.value.from),t=s(L.value.to);return`Thermometer value: ${$.value}. Range: ${e} to ${t}.`});return de({getImage:Lt,generatePdf:Tt,generateImage:Et,generateSvg:Ut,toggleAnnotator:It,toggleFullscreen:Ft,copyAlt:Gt}),(e,t)=>(v(),f(`div`,{ref_key:`thermoChart`,ref:D,class:g(`vue-data-ui-component vue-ui-thermometer ${X.value?`vue-data-ui-wrapper-fullscreen`:``}`),style:je(`width:100%;background:${N.value.backgroundColor};color:${N.value.color};font-family:${A.value.style.fontFamily}`),id:`thermometer__${E.value}`,onMouseenter:t[0]||=()=>C(Ct)(!0),onMouseleave:t[1]||=()=>C(Ct)(!1)},[j.value.buttons.annotator?(v(),u(C(ct),{key:0,svgRef:C(z),backgroundColor:N.value.backgroundColor,color:N.value.color,active:Z.value,isCursorPointer:yt.value,palette:j.value.annotatorPalette,onClose:It},ke({_:2},[b(C(_e),t=>({name:t,fn:Ie(n=>[x(e.$slots,t,_(h(C(ge)(t,n))),void 0,!0)])}))]),1032,[`svgRef`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):d(``,!0),Dt.value?(v(),f(`div`,ze,null,512)):d(``,!0),A.value.style.title.text?(v(),f(`div`,{key:2,ref_key:`chartTitle`,ref:ht,style:`width:100%`},[(v(),u(me,{key:`title_${mt.value}`,config:{title:{cy:`thermometer-div-title`,...A.value.style.title},subtitle:{cy:`thermometer-div-subtitle`,...A.value.style.title.subtitle}}},null,8,[`config`]))],512)):d(``,!0),j.value.show&&_t.value&&(C(wt)||C(R))?(v(),u(C(lt),{ref:`details`,key:`user_options_${pt.value}`,backgroundColor:N.value.backgroundColor,color:N.value.color,isImaging:C(H),isPrinting:C(V),uid:E.value,hasPdf:j.value.buttons.pdf,hasImg:j.value.buttons.img,hasSvg:j.value.buttons.svg,hasFullscreen:j.value.buttons.fullscreen,hasAltCopy:j.value.buttons.altCopy,hasXls:!1,isFullscreen:X.value,titles:{...j.value.buttonTitles},chartElement:D.value,position:j.value.position,hasAnnotator:j.value.buttons.annotator,isAnnotation:Z.value,callbacks:j.value.callbacks,printScale:j.value.print.scale,isCursorPointer:yt.value,onToggleFullscreen:Ft,onGeneratePdf:C(Tt),onGenerateImage:C(Wt),onGenerateSvg:C(Ut),onToggleAnnotator:It,onCopyAlt:Gt,style:je({visibility:C(wt)?C(R)?`visible`:`hidden`:`visible`})},ke({_:2},[b(C(ve)(e.$slots,`menuIcon optionPdf optionImg optionSvg optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:Ie(n=>[x(e.$slots,t,_(h(C(ye)(t,n))),void 0,!0)])}))]),1032,[`backgroundColor`,`color`,`isImaging`,`isPrinting`,`uid`,`hasPdf`,`hasImg`,`hasSvg`,`hasFullscreen`,`hasAltCopy`,`isFullscreen`,`titles`,`chartElement`,`position`,`hasAnnotator`,`isAnnotation`,`callbacks`,`printScale`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):d(``,!0),(v(),f(`svg`,{ref_key:`svgRef`,ref:z,xmlns:C(re),class:g({"vue-data-ui-fullscreen--on":X.value,"vue-data-ui-fulscreen--off":!X.value}),width:`100%`,viewBox:`0 0 ${J.value.width} ${J.value.height}`,style:`background:transparent`,"aria-labelledby":Kt.value,"aria-describedby":qt.value},[p(`title`,{id:Kt.value},S(Jt.value),9,Ve),p(`desc`,{id:qt.value},S(Yt.value),9,He),Ae(C(w)),x(e.$slots,`svg-underlayer`,{svg:{...kt.value,isPrintingImg:C(V)||C(H)||C(Vt),isPrintingSvg:C(Ht)}},void 0,!0),e.$slots[`chart-background`]?(v(),f(`foreignObject`,{key:0,x:0,y:0,width:J.value.width,height:J.value.height,style:{pointerEvents:`none`}},[x(e.$slots,`chart-background`,{},void 0,!0)],8,Ue)):d(``,!0),p(`defs`,null,[p(`clipPath`,{id:`vueUiPill-${E.value}`,clipPathUnits:`userSpaceOnUse`},[p(`rect`,{x:J.value.left,y:J.value.top,width:J.value.thermoWidth,height:J.value.thermoHeight,rx:J.value.thermoWidth/2,ry:J.value.thermoWidth/2},null,8,Ge)],8,We),(v(!0),f(c,null,b(Pt.value,(e,t)=>(v(),u(Ce,{t:`linear`,id:`vueUiThermometerGradient_${t}_${E.value}`,key:`t_${t}_${E.value}`,x1:`0%`,y1:`0%`,x2:`100%`,y2:`0%`,stops:[[`0%`,e.color,1],[`50%`,C(i)(e.color,100-M.value.gradient.intensity),1],[`100%`,e.color,1]]},null,8,[`id`,`stops`]))),128))]),p(`g`,{"clip-path":`url(#vueUiPill-${E.value})`},[p(`rect`,{x:J.value.left,y:J.value.top,height:J.value.thermoHeight,width:J.value.thermoWidth,fill:`#FFFFFF`},null,8,qe),(v(!0),f(c,null,b(Pt.value,(e,t)=>(v(),f(`g`,{key:`graduation_${t}`},[p(`rect`,{x:e.x,y:e.y,height:e.height,width:J.value.thermoWidth,fill:M.value.gradient.show?`url(#vueUiThermometerGradient_${t}_${E.value})`:e.color,"shape-rendering":`crispEdges`},null,8,Je),M.value.show&&[`both`,`left`].includes(M.value.sides)?(v(),f(`line`,{key:0,x1:e.x,x2:e.x+10,y1:e.y,y2:e.y,"stroke-width":M.value.strokeWidth,stroke:M.value.stroke,"stroke-linecap":`round`},null,8,Ye)):d(``,!0),M.value.showIntermediate?(v(),f(c,{key:1},[M.value.show&&[`both`,`left`].includes(M.value.sides)?(v(),f(`line`,{key:0,x1:e.x,x2:e.x+5,y1:e.halfY,y2:e.halfY,"stroke-width":M.value.strokeWidth/2,stroke:M.value.stroke,"stroke-linecap":`round`},null,8,Xe)):d(``,!0),M.value.show&&[`both`,`left`].includes(M.value.sides)?(v(),f(`line`,{key:1,x1:e.x,x2:e.x+2.5,y1:e.qYLess,y2:e.qYLess,"stroke-width":M.value.strokeWidth/2,stroke:M.value.stroke,"stroke-linecap":`round`},null,8,Ze)):d(``,!0),M.value.show&&[`both`,`left`].includes(M.value.sides)?(v(),f(`line`,{key:2,x1:e.x,x2:e.x+2.5,y1:e.qYMore,y2:e.qYMore,"stroke-width":M.value.strokeWidth/2,stroke:M.value.stroke,"stroke-linecap":`round`},null,8,Qe)):d(``,!0)],64)):d(``,!0),M.value.show&&[`both`,`right`].includes(M.value.sides)?(v(),f(`line`,{key:2,x1:J.value.right,x2:J.value.right-10,y1:e.y,y2:e.y,"stroke-width":M.value.strokeWidth,stroke:M.value.stroke,"stroke-linecap":`round`},null,8,$e)):d(``,!0),M.value.showIntermediate?(v(),f(c,{key:3},[M.value.show&&[`both`,`right`].includes(M.value.sides)?(v(),f(`line`,{key:0,x1:J.value.right,x2:J.value.right-5,y1:e.halfY,y2:e.halfY,"stroke-width":M.value.strokeWidth/2,stroke:M.value.stroke,"stroke-linecap":`round`},null,8,et)):d(``,!0),M.value.show&&[`both`,`right`].includes(M.value.sides)?(v(),f(`line`,{key:1,x1:J.value.right,x2:J.value.right-2.5,y1:e.qYLess,y2:e.qYLess,"stroke-width":M.value.strokeWidth/2,stroke:M.value.stroke,"stroke-linecap":`round`},null,8,tt)):d(``,!0),M.value.show&&[`both`,`right`].includes(M.value.sides)?(v(),f(`line`,{key:2,x1:J.value.right,x2:J.value.right-2.5,y1:e.qYMore,y2:e.qYMore,"stroke-width":M.value.strokeWidth/2,stroke:M.value.stroke,"stroke-linecap":`round`},null,8,nt)):d(``,!0)],64)):d(``,!0)]))),128)),p(`rect`,{class:g({"vue-ui-thermometer-temperature":N.value.animation.use}),x:J.value.left,y:J.value.top,height:Y.value,width:J.value.thermoWidth,fill:`#FFFFFF66`},null,10,rt)],8,Ke),N.value.label.show?(v(),f(`g`,{key:1,role:`status`,"aria-live":`polite`,"aria-label":C(I)?`Loading data`:$.value},[C(I)?(v(),f(`rect`,{key:0,x:J.value.left-60,y:Y.value+J.value.top-Q.value/2,width:50,height:Q.value,fill:`#6A6A6A40`,rx:`3`},null,8,at)):(v(),f(`text`,{key:1,"aria-hidden":`true`,class:g({"vue-ui-thermometer-temperature-value":N.value.animation.use,"vue-ui-thermometer-label":!0}),y:Y.value+J.value.top+Q.value/3,x:J.value.left-10,"text-anchor":`end`,fill:N.value.label.color,"font-size":Q.value,"font-weight":N.value.label.bold?`bold`:`normal`},S($.value),11,ot))],8,it)):d(``,!0),x(e.$slots,`svg`,{svg:{...kt.value,isPrintingImg:C(V)||C(H)||C(Vt),isPrintingSvg:C(Ht)}},void 0,!0)],10,Be)),e.$slots.watermark?(v(),f(`div`,st,[x(e.$slots,`watermark`,_(h({isPrinting:C(V)||C(H)||C(Vt)||C(Ht)})),void 0,!0)])):d(``,!0),e.$slots.source?(v(),f(`div`,{key:5,ref_key:`source`,ref:gt,dir:`auto`},[x(e.$slots,`source`,{},void 0,!0)],512)):d(``,!0),x(e.$slots,`skeleton`,{},()=>[C(I)?(v(),u(ce,{key:0})):d(``,!0)],!0)],46,Re))}},[[`__scopeId`,`data-v-fec98266`]]);export{Le as n,w as t};
|
|
@@ -61,4 +61,4 @@ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useConfig-6jO
|
|
|
61
61
|
break;
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
-
`],{type:`application/javascript`}),o=URL.createObjectURL(a),s=new Worker(o);function c(e){let t=Math.floor(e/1e3),n=Math.floor(e%1e3/10),a=Math.floor(t/3600),o=Math.floor(t%3600/60),s=t%60,c=``;return i&&(c+=String(a).padStart(2,`0`)+`:`),c+=String(o).padStart(2,`0`)+`:`,c+=String(s).padStart(2,`0`),r&&(c+=`.`+String(n).padStart(2,`0`)),c}this.start=()=>{this.isPaused=!1,s.postMessage({action:`start`,data:{interval:this.interval}})},this.pause=()=>{this.isPaused?this.resume():(this.isPaused=!0,s.postMessage({action:`pause`}))},this.resume=()=>{this.isPaused&&=(s.postMessage({action:`resume`}),!1)},this.stop=()=>{s.postMessage({action:`stop`}),this.isPaused=!1},this.reset=()=>{s.postMessage({action:`reset`}),this.elapsed=0,this.isPaused=!1},this.restart=()=>{this.stop(),this.start()},this.lap=()=>new Promise(e=>{s.postMessage({action:`lap`}),s.addEventListener(`message`,t=>{let{elapsed:n,timestamp:r,action:i}=t.data;if(i===`lap`){let t=c(n);e({timestamp:r||0,elapsed:n,formatted:t})}},{once:!0})}),s.onmessage=t=>{let{elapsed:n,timestamp:r}=t.data;this.elapsed=n,e({timestamp:r||0,elapsed:this.elapsed,formatted:c(this.elapsed)})},s.onerror=e=>{n&&n(e)}}},S=/* @__PURE__ */ e({default:()=>C}),me=[`xmlns`,`viewBox`],he=[`width`,`height`],ge={key:1},_e=[`cx`,`cy`,`r`,`fill`,`stroke`,`stroke-width`],ve=[`d`,`stroke`,`stroke-width`],ye=[`r`,`fill`,`stroke`,`stroke-width`],be=[`r`,`fill`,`stroke`,`stroke-width`],xe=[`x`,`y`],Se={key:5},Ce=[`x`,`y`,`font-size`,`fill`,`font-weight`],we={key:0,class:`vue-ui-timer-controls`},Te=[`title`],Ee=[`title`],De=[`title`],Oe=[`title`],ke=[`title`],C=/*#__PURE__*/ s({__name:`vue-ui-timer`,props:{config:{type:Object,default(){return{}}}},emits:[`start`,`pause`,`reset`,`restart`,`lap`],setup(e,{expose:s,emit:S}){let C=oe(()=>import(`./PackageVersion-
|
|
64
|
+
`],{type:`application/javascript`}),o=URL.createObjectURL(a),s=new Worker(o);function c(e){let t=Math.floor(e/1e3),n=Math.floor(e%1e3/10),a=Math.floor(t/3600),o=Math.floor(t%3600/60),s=t%60,c=``;return i&&(c+=String(a).padStart(2,`0`)+`:`),c+=String(o).padStart(2,`0`)+`:`,c+=String(s).padStart(2,`0`),r&&(c+=`.`+String(n).padStart(2,`0`)),c}this.start=()=>{this.isPaused=!1,s.postMessage({action:`start`,data:{interval:this.interval}})},this.pause=()=>{this.isPaused?this.resume():(this.isPaused=!0,s.postMessage({action:`pause`}))},this.resume=()=>{this.isPaused&&=(s.postMessage({action:`resume`}),!1)},this.stop=()=>{s.postMessage({action:`stop`}),this.isPaused=!1},this.reset=()=>{s.postMessage({action:`reset`}),this.elapsed=0,this.isPaused=!1},this.restart=()=>{this.stop(),this.start()},this.lap=()=>new Promise(e=>{s.postMessage({action:`lap`}),s.addEventListener(`message`,t=>{let{elapsed:n,timestamp:r,action:i}=t.data;if(i===`lap`){let t=c(n);e({timestamp:r||0,elapsed:n,formatted:t})}},{once:!0})}),s.onmessage=t=>{let{elapsed:n,timestamp:r}=t.data;this.elapsed=n,e({timestamp:r||0,elapsed:this.elapsed,formatted:c(this.elapsed)})},s.onerror=e=>{n&&n(e)}}},S=/* @__PURE__ */ e({default:()=>C}),me=[`xmlns`,`viewBox`],he=[`width`,`height`],ge={key:1},_e=[`cx`,`cy`,`r`,`fill`,`stroke`,`stroke-width`],ve=[`d`,`stroke`,`stroke-width`],ye=[`r`,`fill`,`stroke`,`stroke-width`],be=[`r`,`fill`,`stroke`,`stroke-width`],xe=[`x`,`y`],Se={key:5},Ce=[`x`,`y`,`font-size`,`fill`,`font-weight`],we={key:0,class:`vue-ui-timer-controls`},Te=[`title`],Ee=[`title`],De=[`title`],Oe=[`title`],ke=[`title`],C=/*#__PURE__*/ s({__name:`vue-ui-timer`,props:{config:{type:Object,default(){return{}}}},emits:[`start`,`pause`,`reset`,`restart`,`lap`],setup(e,{expose:s,emit:S}){let C=oe(()=>import(`./PackageVersion-DhptF5oD.js`).then(e=>e.t)),{vue_ui_timer:Ae}=t(),w=e,T=S,E=y(null),D=y(null),O=y(null),k=ue(null),A=ue(null),j=y(n()),M=y(0);le(()=>{N()});function N(){if(P.value.responsive){let e=te(()=>{let{width:e,height:t}=ne({chart:E.value,title:P.value.style.title.text?D.value:null,legend:O.value});requestAnimationFrame(()=>{B.value.width=e,B.value.height=t,P.value.responsiveProportionalSizing?(B.value.tracker.core=r({relator:Math.min(e,t),adjuster:P.value.style.width,source:6*I.value.radiusRatio,threshold:1,fallback:1}),B.value.tracker.aura=r({relator:Math.min(e,t),adjuster:P.value.style.width,source:12*I.value.aura.radiusRatio,threshold:1,fallback:1}),B.value.label=r({relator:Math.min(e,t),adjuster:P.value.style.width,source:F.value.label.fontSize,threshold:10,fallback:10})):B.value.label=F.value.label.fontSize})});k.value&&(A.value&&k.value.unobserve(A.value),k.value.disconnect()),k.value=new ResizeObserver(e),A.value=E.value.parentNode,k.value.observe(A.value)}}ce(()=>{k.value&&(A.value&&k.value.unobserve(A.value),k.value.disconnect())});let P=u({get:()=>z(),set:e=>e}),F=u(()=>P.value.stopwatch),I=u(()=>P.value.stopwatch.tracker),L=u(()=>P.value.stopwatch.legend);a({config:()=>P.value,dataset:()=>[],component:`VueUiTimer`,rules:[o.noHint]});let R=u(()=>P.value.useCursorPointer),{svgRef:je}=ie({config:P.value.style.title});function z(){return c({userConfig:w.config,defaultConfig:Ae})}fe(()=>w.config,e=>{P.value=z(),N(),M.value+=1},{deep:!0});let Me=u(()=>{if(F.value.showHours&&F.value.showHundredth)return`00:00:00.00`;if(F.value.showHours&&!F.value.showHundredth)return`00:00:00`;if(!F.value.showHours&&F.value.showHundredth)return`00:00.00`;if(!F.value.showHours&&!F.value.showHundredth)return`00:00`}),B=y({height:P.value.style.height,width:P.value.style.width,tracker:{core:6*I.value.radiusRatio,aura:12*I.value.aura.radiusRatio},label:F.value.label.fontSize}),V=y(0),H=new pe(e=>Ne(e),10,``,F.value.showHundredth,F.value.showHours),U=y(!0),W=y(!1),G=y(!1);function K(){T(`start`),U.value&&H.start(),U.value=!1,W.value=!0}function q(){W.value&&=(T(`reset`),H.stop(),X.value=[],U.value=!0,!1)}function J(){G.value=!G.value,T(`pause`,V.value),H.pause()}function Y(){W.value&&(G.value=!1,T(`restart`),X.value=[],H.restart())}let X=y([]);async function Z(){if(!W.value||G.value)return;let e=await H.lap();e&&(X.value.push(e),T(`lap`,X.value))}function Ne({timestamp:e,elapsed:t,formatted:n}){V.value={timestamp:e,elapsed:t,formatted:n}}let Q=u(()=>Math.min(B.value.width,B.value.height)/2.5*F.value.track.radiusRatio);function Pe(e,t){return e*(360/(t*1e3))%360}function Fe(e){let t=Math.PI/180*e;return{cx:B.value.width/2+Q.value*Math.cos(t),cy:B.value.height/2+Q.value*Math.sin(t)}}let $=u(()=>{let e=Pe(V.value.elapsed,F.value.cycleSeconds),{cx:t,cy:n}=Fe(e-90),r=+(e>180);return{cx:t||B.value.width/2,cy:n||B.value.height/2-Q.value,largeArcFlag:r,sweepFlag:1}});return s({start:K,pause:J,reset:q,restart:Y,lap:Z}),(e,t)=>(v(),f(`div`,{ref_key:`timerChart`,ref:E,class:`vue-data-ui-component vue-ui-timer`,style:_({fontFamily:P.value.style.fontFamily,width:`100%`,height:P.value.responsive?`100%`:`auto`,textAlign:`center`})},[P.value.style.title.text?(v(),f(`div`,{key:0,ref_key:`chartTitle`,ref:D,style:_({width:`100%`,background:P.value.style.backgroundColor})},[(v(),ae(ee,{key:`title_${M.value}`,config:{title:{cy:`title`,...P.value.style.title},subtitle:{cy:`subtitle`,...P.value.style.title.subtitle}}},null,8,[`config`]))],4)):d(``,!0),(v(),f(`svg`,{ref_key:`svgRef`,ref:je,xmlns:x(i),viewBox:`0 0 ${B.value.width<=0?10:B.value.width} ${B.value.height<=0?10:B.value.height}`,style:_({maxWidth:`100%`,overflow:`visible`,background:P.value.style.backgroundColor})},[m(x(C)),e.$slots[`chart-background`]?(v(),f(`foreignObject`,{key:0,x:0,y:0,width:B.value.width<=0?10:B.value.width,height:B.value.height<=0?10:B.value.height,style:{pointerEvents:`none`}},[b(e.$slots,`chart-background`,{},void 0,!0)],8,he)):d(``,!0),I.value.gradient.show?(v(),f(`defs`,ge,[m(re,{t:`radial`,id:`tracker_gradient_${j.value}`,cx:`50%`,cy:`50%`,r:`50%`,fx:`50%`,fy:`50%`,stops:[[`0%`,I.value.gradient.color,1],[`100%`,I.value.fill,1]]},null,8,[`id`,`stops`])])):d(``,!0),p(`circle`,{cx:B.value.width/2,cy:B.value.height/2,r:Q.value,fill:F.value.track.fill,stroke:F.value.track.stroke,"stroke-width":F.value.track.strokeWidth},null,8,_e),F.value.cycleTrack.show?(v(),f(`path`,{key:2,d:`M ${B.value.width/2},${B.value.height/2-Q.value} A ${Q.value},${Q.value} 0 ${$.value.largeArcFlag},${$.value.sweepFlag} ${$.value.cx},${$.value.cy}`,stroke:F.value.cycleTrack.stroke,"stroke-width":F.value.cycleTrack.strokeWidth,"stroke-linecap":`round`,fill:`none`},null,8,ve)):d(``,!0),p(`circle`,se($.value,{r:B.value.tracker.core,fill:I.value.gradient.show?`url(#tracker_gradient_${j.value})`:I.value.fill,stroke:I.value.stroke,"stroke-width":I.value.strokeWidth}),null,16,ye),I.value.aura.show?(v(),f(`circle`,se({key:3},$.value,{r:B.value.tracker.aura,fill:`${I.value.aura.fill}`,opacity:.2,stroke:I.value.aura.stroke,"stroke-width":I.value.aura.strokeWidth}),null,16,be)):d(``,!0),e.$slots.time?(v(),f(`foreignObject`,{key:4,x:B.value.width/2,y:B.value.height/2,height:`0.1`,width:`0.1`,style:{overflow:`visible`}},[b(e.$slots,`time`,g(h({...V.value,...B.value})),void 0,!0)],8,xe)):e.$slots.timeSvg?(v(),f(`g`,Se,[b(e.$slots,`timeSvg`,g(h({...V.value,...B.value})),void 0,!0)])):(v(),f(`text`,{key:6,x:B.value.width/2,y:B.value.height/2+B.value.label/4,"font-size":B.value.label,"text-anchor":`middle`,fill:F.value.label.color,"font-weight":F.value.label.bold?`bold`:`normal`,style:{"font-variant-numeric":`tabular-nums !important`}},de(V.value.formatted||Me.value),9,Ce))],12,me)),p(`div`,{ref_key:`chartLegend`,ref:O,style:_({width:`100%`,backgroundColor:L.value.backgroundColor})},[e.$slots.controls?d(``,!0):(v(),f(`div`,we,[L.value.buttons.start?(v(),f(`button`,{key:0,title:L.value.buttonTitles.start,onClick:K,class:`vue-ui-timer-button`,style:_({opacity:W.value?.2:1,cursor:W.value?`default`:R.value?`pointer`:`default`})},[m(l,{name:`play`,stroke:L.value.buttons.iconColor},null,8,[`stroke`])],12,Te)):d(``,!0),L.value.buttons.pause?(v(),f(`button`,{key:1,title:G.value?L.value.buttonTitles.resume:L.value.buttonTitles.pause,onClick:J,class:`vue-ui-timer-button`,style:_({opacity:W.value?1:.2,cursor:W.value&&R.value?`pointer`:`default`})},[m(l,{name:`pause`,stroke:L.value.buttons.iconColor},null,8,[`stroke`])],12,Ee)):d(``,!0),L.value.buttons.reset?(v(),f(`button`,{key:2,title:L.value.buttonTitles.reset,onClick:q,class:`vue-ui-timer-button`,style:_({opacity:W.value?1:.2,cursor:W.value&&R.value?`pointer`:`default`})},[m(l,{name:`stop`,stroke:L.value.buttons.iconColor},null,8,[`stroke`])],12,De)):d(``,!0),L.value.buttons.restart?(v(),f(`button`,{key:3,title:L.value.buttonTitles.restart,onClick:Y,class:`vue-ui-timer-button`,style:_({opacity:W.value?1:.2,cursor:W.value&&R.value?`pointer`:`default`})},[m(l,{name:`restart`,stroke:L.value.buttons.iconColor},null,8,[`stroke`])],12,Oe)):d(``,!0),L.value.buttons.lap?(v(),f(`button`,{key:4,title:L.value.buttonTitles.lap,onClick:Z,class:`vue-ui-timer-button`,style:_({opacity:W.value&&!G.value?1:.2,cursor:W.value&&!G.value&&R.value?`pointer`:`default`})},[m(l,{name:`lap`,stroke:L.value.buttons.iconColor},null,8,[`stroke`])],12,ke)):d(``,!0)])),b(e.$slots,`controls`,g(h({start:K,pause:J,reset:q,restart:Y,lap:Z,laps:X.value,isRunning:W.value,isPaused:G.value,...V.value})),void 0,!0),b(e.$slots,`laps`,g(h({laps:X.value,lap:Z,isRunning:W.value,isPaused:G.value,...V.value})),void 0,!0)],4)],4))}},[[`__scopeId`,`data-v-27b9f373`]]);export{S as n,C as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useConfig-6jO1fkp5.js";import{$ as n,X as r,Yt as i,at as a,b as o,i as s,in as c,t as l,zt as ee}from"./lib-rPeBMZrn.js";import{n as te,t as ne}from"./BaseScanner-8NdoBs7B.js";import{n as re,t as ie}from"./useHints-C-TwxM0Y.js";import{t as ae}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{t as oe}from"./resolveChartConfig-CIhClE5R.js";import{t as se}from"./chartImage-DPGnEuYM.js";import{n as ce}from"./Title-BliHuXfT.js";import{t as le}from"./useChartExport-BZts4KFb.js";import{n as ue,t as de}from"./annotationSlots-BRR85CqJ.js";import{n as fe,t as pe}from"./userOptionsSlots-DYuo-E5m.js";import{t as me}from"./usePrinter-DVf3YcG5.js";import{c as he}from"./canvas-lib-22VpOI4_.js";import{t as ge}from"./useResponsive-CENUxfEL.js";import{t as _e}from"./useUserOptionState-CXlFnwPv.js";import{t as ve}from"./useChartAccessibility-DOMuYJfm.js";import{t as ye}from"./usePrefersMotion-XLHwega2.js";import{t as be}from"./vue_ui_tiremarks-8HFfABNF.js";import{Fragment as xe,computed as u,createBlock as d,createCommentVNode as f,createElementBlock as p,createElementVNode as Se,createSlots as Ce,createVNode as we,defineAsyncComponent as m,guardReactiveProps as h,normalizeClass as g,normalizeProps as Te,normalizeStyle as Ee,onMounted as De,openBlock as _,ref as v,renderList as y,renderSlot as b,toDisplayString as x,toRefs as Oe,unref as S,watch as ke,withCtx as Ae}from"vue";var je=/* @__PURE__ */ e({default:()=>C}),Me=[`id`],Ne=[`xmlns`,`viewBox`,`aria-labelledby`,`aria-describedby`],Pe=[`id`],Fe=[`id`],Ie=[`width`,`height`],Le={key:1},Re=[`d`,`stroke-width`,`stroke`],ze={key:2},Be=[`x1`,`y1`,`x2`,`y2`,`stroke-width`,`stroke`],Ve=[`aria-label`],He=[`x`,`y`,`height`],Ue=[`x`,`y`,`font-size`,`fill`,`font-weight`,`text-anchor`],We={key:4,class:`vue-data-ui-watermark`},C=/*#__PURE__*/ ae({__name:`vue-ui-tiremarks`,props:{config:{type:Object,default(){return{}}},dataset:{type:Object,default(){return{}}}},emits:[`copyAlt`],setup(e,{expose:ae,emit:je}){let C=m(()=>import(`./PenAndPaper-BGEp-TUm.js`).then(e=>e.t)),Ge=m(()=>import(`./UserOptions-uWHV_zPB.js`).then(e=>e.n)),Ke=m(()=>import(`./PackageVersion-CXT-eAuk.js`).then(e=>e.t)),{vue_ui_tiremarks:qe}=t(),w=ye(),T=e,Je=je,Ye=u(()=>!!T.dataset&&Object.keys(T.dataset).length),E=v(r()),D=v(null),Xe=v(null),Ze=v(null),Qe=v(null),$e=v(0),et=v(0),O=v(null),k=v(null),A=v(L()),j=u(()=>A.value.userOptions),M=u(()=>A.value.style.chart.layout),N=u(()=>A.value.style.chart);re({config:()=>A.value,dataset:()=>T.dataset,component:`VueUiTiremarks`,rules:[ie.noHint]});let tt=u(()=>A.value.userOptions.useCursorPointer),nt=u(()=>c({defaultConfig:{userOptions:{show:!1},style:{chart:{backgroundColor:`#99999930`,animation:{use:!1},layout:{activeColor:`#6A6A6A80`,inactiveColor:`#CACACA80`,ticks:{gradient:{show:!1}}}}}},userConfig:A.value.skeletonConfig??{}})),{loading:P,FINAL_DATASET:F}=te({...Oe(T),FINAL_CONFIG:A,prepareConfig:L,skeletonDataset:T.config?.skeletonDataset??{percentage:50},skeletonConfig:c({defaultConfig:A.value,userConfig:nt.value})}),{userOptionsVisible:I,setUserOptionsVisibility:rt,keepUserOptionState:it}=_e({config:A.value}),{svgRef:at}=ve({config:N.value.title});function L(){return oe(T.config,qe,be)}ke(()=>T.config,e=>{A.value=L(),I.value=!A.value.userOptions.showOnChartHover,W.value=N.value.width,G.value=N.value.height,dt(),et.value+=1},{deep:!0});let{isPrinting:R,isImaging:z,generatePdf:ot,generateImage:st}=me({elementId:E.value,fileName:N.value.title.text||`vue-ui-tiremarks`,options:A.value.userOptions.print}),ct=u(()=>A.value.userOptions.show&&!N.value.title.text),B=v(N.value.animation.use&&!w.value?0:o(F.value.percentage));ke(()=>F.value,e=>{N.value.animation.use&&!w.value?lt(e.percentage):B.value=e.percentage||0},{deep:!0}),De(()=>{dt()});function lt(e){let t=N.value.animation.speed,n=Math.abs(e-B.value)/(t*120);function r(){B.value<e?B.value=Math.min(B.value+n,e):B.value>e&&(B.value=Math.max(B.value-n,e)),B.value!==e&&requestAnimationFrame(r)}r()}let ut=u(()=>A.value.debug);function dt(){if(ee(T.dataset)&&a({componentName:`VueUiTiremarks`,type:`dataset`,debug:ut.value}),A.value.responsive){let e=he(()=>{let{width:e,height:t}=ge({chart:D.value,title:N.value.title.text?Ze.value:null,source:Qe.value});requestAnimationFrame(()=>{W.value=Math.max(.1,e),G.value=Math.max(.1,t-12)})});O.value&&(k.value&&O.value.unobserve(k.value),O.value.disconnect()),O.value=new ResizeObserver(e),k.value=D.value.parentNode,O.value.observe(k.value)}lt(F.value.percentage||0)}let V=u(()=>M.value.display===`vertical`),H=u(()=>{let e=N.value.percentage.show,t={top:e?48:12,left:e?64:16,right:e?64:16,bottom:e?48:12};return V.value?{top:N.value.percentage.verticalPosition===`top`?t.top:3,left:3,right:3,bottom:N.value.percentage.verticalPosition===`bottom`?t.bottom:3}:{top:0,bottom:0,left:N.value.percentage.horizontalPosition===`left`?t.left:16,right:N.value.percentage.horizontalPosition===`right`?t.right:10}}),U=u(()=>Object.values(H.value).reduce((e,t)=>e+t,0)),W=v(N.value.width),G=v(N.value.height),K=u(()=>({height:G.value,width:W.value})),ft=u(()=>({horizontal:{x:J.value.x+(N.value.percentage.horizontalPosition===`left`?6:3),y:K.value.height/2-J.value.fontSize/2},vertical:{x:K.value.width/2-20,y:J.value.y-J.value.fontSize/2}})[M.value.display]),q=u(()=>V.value?{mark:(K.value.height-U.value)/100*.5,space:(K.value.height-U.value)/100*.5}:{mark:(K.value.width-U.value)/100*.5,space:(K.value.width-U.value)/100*.5}),pt=u(()=>{let e=[];for(let t=0;t<100;t+=1){let n=M.value.ticks.gradient.show?i(M.value.activeColor,t/100*(M.value.ticks.gradient.shiftHueIntensity/100)):M.value.activeColor;if(V.value){let r=M.value.crescendo?(100-t)*(K.value.width-H.value.left-H.value.right)/100/3:0,i=H.value.left+4+r,a=K.value.width-H.value.right-4-r,o=K.value.height-H.value.bottom-t*q.value.mark-t*q.value.space-q.value.mark,s=K.value.height-H.value.bottom-t*q.value.mark-t*q.value.space-q.value.mark,c=(a-i)/M.value.curveAngleX,l=M.value.curveAngleY*((1+t)/100);e.push({x1:i,x2:a,y1:o,y2:s,curve:`M ${i} ${o} C ${i+c} ${o-l}, ${a-c} ${s-l}, ${a} ${s}`,color:n})}else{let r=M.value.crescendo?(100-t)*(K.value.height-H.value.top-H.value.bottom)/100/3:0,i=H.value.left+t*q.value.mark+t*q.value.space-q.value.mark,a=i,o=H.value.top+4+r,s=K.value.height-H.value.bottom-4-r,c=M.value.curveAngleY*((1+t)/100),l=(s-o)/M.value.curveAngleX;e.push({x1:i,x2:a,y1:o,y2:s,curve:`M ${i} ${o} C ${i+c} ${o+l}, ${a+c} ${s-l}, ${a} ${s}`,color:n})}}return e}),J=u(()=>{let e,t,n,r=N.value.percentage.fontSize/3;return V.value?N.value.percentage.verticalPosition===`top`?(e=K.value.width/2,t=H.value.top/2,n=`middle`):N.value.percentage.verticalPosition===`bottom`&&(e=K.value.width/2,t=K.value.height-H.value.bottom/2+r,n=`middle`):N.value.percentage.horizontalPosition===`left`?(e=4,t=K.value.height/2+r,n=`start`):N.value.percentage.horizontalPosition===`right`&&(e=K.value.width-H.value.right+8,t=K.value.height/2+r,n=`start`),{x:e,y:t,textAnchor:n,bold:N.value.percentage.bold,fontSize:N.value.percentage.fontSize,fill:N.value.percentage.color}}),Y=v(!1);function mt(e){Y.value=e,$e.value+=1}let X=v(!1);function Z(){X.value=!X.value}let ht=se(D,()=>N.value.title.text),gt=u(()=>N.value.backgroundColor),_t=u(()=>N.value.title),{isCallbackImaging:vt,isCallbackSvg:Q,generateSvg:yt,onGenerateImage:bt}=le({svg:at,title:_t,legend:null,legendItems:null,backgroundColor:gt,getSvgCallback:()=>A.value.userOptions.callbacks.svg,generateImage:st});async function xt(){Je(`copyAlt`,{config:A.value,dataset:F.value}),A.value.userOptions.callbacks.altCopy?await Promise.resolve(A.value.userOptions.callbacks.altCopy({config:A.value,dataset:F.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}let St=u(()=>`${E.value}-title`),Ct=u(()=>`${E.value}-desc`),$=u(()=>s(N.value.percentage.formatter,B.value,n({v:B.value,s:`%`,r:N.value.percentage.rounding}))),wt=u(()=>N.value.title.text||``),Tt=u(()=>P.value?`Loading data`:`Value: ${$.value}`);return ae({getImage:ht,generatePdf:ot,generateImage:st,generateSvg:yt,toggleAnnotator:Z,toggleFullscreen:mt,copyAlt:xt}),(e,t)=>(_(),p(`div`,{ref_key:`tiremarksChart`,ref:D,class:g(`vue-data-ui-component vue-ui-tiremarks ${A.value.useCssAnimation?``:`vue-ui-dna`}`),style:Ee(`font-family:${A.value.style.fontFamily};width:100%; text-align:center;background:${N.value.backgroundColor}`),id:E.value,onMouseenter:t[0]||=()=>S(rt)(!0),onMouseleave:t[1]||=()=>S(rt)(!1)},[j.value.buttons.annotator?(_(),d(S(C),{key:0,svgRef:S(at),backgroundColor:N.value.backgroundColor,color:N.value.color,active:X.value,isCursorPointer:tt.value,palette:j.value.annotatorPalette,onClose:Z},Ce({_:2},[y(S(de),t=>({name:t,fn:Ae(n=>[b(e.$slots,t,Te(h(S(ue)(t,n))),void 0,!0)])}))]),1032,[`svgRef`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):f(``,!0),ct.value?(_(),p(`div`,{key:1,ref_key:`noTitle`,ref:Xe,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},null,512)):f(``,!0),N.value.title.text?(_(),p(`div`,{key:2,ref_key:`chartTitle`,ref:Ze,style:`width:100%;background:transparent;padding-bottom:12px`},[(_(),d(ce,{key:`title_${et.value}`,config:{title:{cy:`wheel-title`,...N.value.title},subtitle:{cy:`wheel-subtitle`,...N.value.title.subtitle}}},null,8,[`config`]))],512)):f(``,!0),j.value.show&&Ye.value&&(S(it)||S(I))?(_(),d(S(Ge),{ref:`details`,key:`user_options_${$e.value}`,backgroundColor:N.value.backgroundColor,color:N.value.color,isPrinting:S(R),isImaging:S(z),uid:E.value,hasPdf:j.value.buttons.pdf,hasImg:j.value.buttons.img,hasSvg:j.value.buttons.svg,hasFullscreen:j.value.buttons.fullscreen,hasAltCopy:j.value.buttons.altCopy,hasXls:!1,isFullscreen:Y.value,titles:{...j.value.buttonTitles},chartElement:D.value,position:j.value.position,hasAnnotator:j.value.buttons.annotator,isAnnotation:X.value,callbacks:j.value.callbacks,printScale:j.value.print.scale,isCursorPointer:tt.value,onToggleFullscreen:mt,onGeneratePdf:S(ot),onGenerateImage:S(bt),onGenerateSvg:S(yt),onToggleAnnotator:Z,onCopyAlt:xt,style:Ee({visibility:S(it)?S(I)?`visible`:`hidden`:`visible`})},Ce({_:2},[y(S(fe)(e.$slots,`menuIcon optionPdf optionImg optionSvg optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:Ae(n=>[b(e.$slots,t,Te(h(S(pe)(t,n))),void 0,!0)])}))]),1032,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`hasPdf`,`hasImg`,`hasSvg`,`hasFullscreen`,`hasAltCopy`,`isFullscreen`,`titles`,`chartElement`,`position`,`hasAnnotator`,`isAnnotation`,`callbacks`,`printScale`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):f(``,!0),(_(),p(`svg`,{ref_key:`svgRef`,ref:at,xmlns:S(l),class:g({"vue-data-ui-fullscreen--on":Y.value,"vue-data-ui-fulscreen--off":!Y.value}),viewBox:`0 0 ${W.value} ${G.value}`,style:Ee(`max-width:100%; overflow: visible; background:transparent;color:${N.value.color}`),role:`img`,"aria-labelledby":St.value,"aria-describedby":Ct.value},[Se(`title`,{id:St.value},x(wt.value),9,Pe),Se(`desc`,{id:Ct.value},x(Tt.value),9,Fe),we(S(Ke)),b(e.$slots,`svg-underlayer`,{svg:{...K.value,isPrintingImg:S(R)||S(z)||S(vt),isPrintingSvg:S(Q)}},void 0,!0),e.$slots[`chart-background`]?(_(),p(`foreignObject`,{key:0,x:0,y:0,width:K.value.width,height:K.value.height,style:{pointerEvents:`none`}},[b(e.$slots,`chart-background`,{},void 0,!0)],8,Ie)):f(``,!0),M.value.curved?(_(),p(`g`,Le,[(_(!0),p(xe,null,y(pt.value,(e,t)=>(_(),p(`path`,{d:e.curve,"stroke-width":q.value.mark,stroke:B.value>=t?e.color:M.value.inactiveColor,"stroke-linecap":`round`,fill:`none`,class:g({"vue-ui-tick-animated":N.value.animation.use&&!S(w)&&t<=B.value})},null,10,Re))),256))])):(_(),p(`g`,ze,[(_(!0),p(xe,null,y(pt.value,(e,t)=>(_(),p(`line`,{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,"stroke-width":q.value.mark,stroke:B.value>=t?e.color:M.value.inactiveColor,"stroke-linecap":`round`},null,8,Be))),256))])),N.value.percentage.show?(_(),p(`g`,{key:3,role:`status`,"aria-live":`polite`,"aria-label":S(P)?`...`:`${$.value}`},[S(P)?(_(),p(`rect`,{key:0,x:ft.value.x,y:ft.value.y,width:40,height:J.value.fontSize,fill:`#6A6A6A80`,rx:3},null,8,He)):(_(),p(`text`,{key:1,"aria-hidden":`true`,x:J.value.x,y:J.value.y,"font-size":J.value.fontSize,fill:M.value.ticks.gradient.show&&N.value.percentage.useGradientColor?S(i)(M.value.activeColor,B.value/100*(M.value.ticks.gradient.shiftHueIntensity/100)):N.value.percentage.color,"font-weight":J.value.bold?`bold`:`normal`,"text-anchor":J.value.textAnchor},x($.value),9,Ue))],8,Ve)):f(``,!0),b(e.$slots,`svg`,{svg:{...K.value,isPrintingImg:S(R)||S(z)||S(vt),isPrintingSvg:S(Q)}},void 0,!0)],14,Ne)),e.$slots.watermark?(_(),p(`div`,We,[b(e.$slots,`watermark`,Te(h({isPrinting:S(R)||S(z)||S(vt)||S(Q)})),void 0,!0)])):f(``,!0),e.$slots.source?(_(),p(`div`,{key:5,ref_key:`source`,ref:Qe,dir:`auto`},[b(e.$slots,`source`,{},void 0,!0)],512)):f(``,!0),b(e.$slots,`skeleton`,{},()=>[S(P)?(_(),d(ne,{key:0})):f(``,!0)],!0)],46,Me))}},[[`__scopeId`,`data-v-fa4acd55`]]);export{je as n,C as t};
|
|
1
|
+
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useConfig-6jO1fkp5.js";import{$ as n,X as r,Yt as i,at as a,b as o,i as s,in as c,t as l,zt as ee}from"./lib-rPeBMZrn.js";import{n as te,t as ne}from"./BaseScanner-8NdoBs7B.js";import{n as re,t as ie}from"./useHints-C-TwxM0Y.js";import{t as ae}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{t as oe}from"./resolveChartConfig-CIhClE5R.js";import{t as se}from"./chartImage-DPGnEuYM.js";import{n as ce}from"./Title-BliHuXfT.js";import{t as le}from"./useChartExport-BZts4KFb.js";import{n as ue,t as de}from"./annotationSlots-BRR85CqJ.js";import{n as fe,t as pe}from"./userOptionsSlots-DYuo-E5m.js";import{t as me}from"./usePrinter-DVf3YcG5.js";import{c as he}from"./canvas-lib-22VpOI4_.js";import{t as ge}from"./useResponsive-CENUxfEL.js";import{t as _e}from"./useUserOptionState-CXlFnwPv.js";import{t as ve}from"./useChartAccessibility-DOMuYJfm.js";import{t as ye}from"./usePrefersMotion-XLHwega2.js";import{t as be}from"./vue_ui_tiremarks-8HFfABNF.js";import{Fragment as xe,computed as u,createBlock as d,createCommentVNode as f,createElementBlock as p,createElementVNode as Se,createSlots as Ce,createVNode as we,defineAsyncComponent as m,guardReactiveProps as h,normalizeClass as g,normalizeProps as Te,normalizeStyle as Ee,onMounted as De,openBlock as _,ref as v,renderList as y,renderSlot as b,toDisplayString as x,toRefs as Oe,unref as S,watch as ke,withCtx as Ae}from"vue";var je=/* @__PURE__ */ e({default:()=>C}),Me=[`id`],Ne=[`xmlns`,`viewBox`,`aria-labelledby`,`aria-describedby`],Pe=[`id`],Fe=[`id`],Ie=[`width`,`height`],Le={key:1},Re=[`d`,`stroke-width`,`stroke`],ze={key:2},Be=[`x1`,`y1`,`x2`,`y2`,`stroke-width`,`stroke`],Ve=[`aria-label`],He=[`x`,`y`,`height`],Ue=[`x`,`y`,`font-size`,`fill`,`font-weight`,`text-anchor`],We={key:4,class:`vue-data-ui-watermark`},C=/*#__PURE__*/ ae({__name:`vue-ui-tiremarks`,props:{config:{type:Object,default(){return{}}},dataset:{type:Object,default(){return{}}}},emits:[`copyAlt`],setup(e,{expose:ae,emit:je}){let C=m(()=>import(`./PenAndPaper-BGEp-TUm.js`).then(e=>e.t)),Ge=m(()=>import(`./UserOptions-uWHV_zPB.js`).then(e=>e.n)),Ke=m(()=>import(`./PackageVersion-DhptF5oD.js`).then(e=>e.t)),{vue_ui_tiremarks:qe}=t(),w=ye(),T=e,Je=je,Ye=u(()=>!!T.dataset&&Object.keys(T.dataset).length),E=v(r()),D=v(null),Xe=v(null),Ze=v(null),Qe=v(null),$e=v(0),et=v(0),O=v(null),k=v(null),A=v(L()),j=u(()=>A.value.userOptions),M=u(()=>A.value.style.chart.layout),N=u(()=>A.value.style.chart);re({config:()=>A.value,dataset:()=>T.dataset,component:`VueUiTiremarks`,rules:[ie.noHint]});let tt=u(()=>A.value.userOptions.useCursorPointer),nt=u(()=>c({defaultConfig:{userOptions:{show:!1},style:{chart:{backgroundColor:`#99999930`,animation:{use:!1},layout:{activeColor:`#6A6A6A80`,inactiveColor:`#CACACA80`,ticks:{gradient:{show:!1}}}}}},userConfig:A.value.skeletonConfig??{}})),{loading:P,FINAL_DATASET:F}=te({...Oe(T),FINAL_CONFIG:A,prepareConfig:L,skeletonDataset:T.config?.skeletonDataset??{percentage:50},skeletonConfig:c({defaultConfig:A.value,userConfig:nt.value})}),{userOptionsVisible:I,setUserOptionsVisibility:rt,keepUserOptionState:it}=_e({config:A.value}),{svgRef:at}=ve({config:N.value.title});function L(){return oe(T.config,qe,be)}ke(()=>T.config,e=>{A.value=L(),I.value=!A.value.userOptions.showOnChartHover,W.value=N.value.width,G.value=N.value.height,dt(),et.value+=1},{deep:!0});let{isPrinting:R,isImaging:z,generatePdf:ot,generateImage:st}=me({elementId:E.value,fileName:N.value.title.text||`vue-ui-tiremarks`,options:A.value.userOptions.print}),ct=u(()=>A.value.userOptions.show&&!N.value.title.text),B=v(N.value.animation.use&&!w.value?0:o(F.value.percentage));ke(()=>F.value,e=>{N.value.animation.use&&!w.value?lt(e.percentage):B.value=e.percentage||0},{deep:!0}),De(()=>{dt()});function lt(e){let t=N.value.animation.speed,n=Math.abs(e-B.value)/(t*120);function r(){B.value<e?B.value=Math.min(B.value+n,e):B.value>e&&(B.value=Math.max(B.value-n,e)),B.value!==e&&requestAnimationFrame(r)}r()}let ut=u(()=>A.value.debug);function dt(){if(ee(T.dataset)&&a({componentName:`VueUiTiremarks`,type:`dataset`,debug:ut.value}),A.value.responsive){let e=he(()=>{let{width:e,height:t}=ge({chart:D.value,title:N.value.title.text?Ze.value:null,source:Qe.value});requestAnimationFrame(()=>{W.value=Math.max(.1,e),G.value=Math.max(.1,t-12)})});O.value&&(k.value&&O.value.unobserve(k.value),O.value.disconnect()),O.value=new ResizeObserver(e),k.value=D.value.parentNode,O.value.observe(k.value)}lt(F.value.percentage||0)}let V=u(()=>M.value.display===`vertical`),H=u(()=>{let e=N.value.percentage.show,t={top:e?48:12,left:e?64:16,right:e?64:16,bottom:e?48:12};return V.value?{top:N.value.percentage.verticalPosition===`top`?t.top:3,left:3,right:3,bottom:N.value.percentage.verticalPosition===`bottom`?t.bottom:3}:{top:0,bottom:0,left:N.value.percentage.horizontalPosition===`left`?t.left:16,right:N.value.percentage.horizontalPosition===`right`?t.right:10}}),U=u(()=>Object.values(H.value).reduce((e,t)=>e+t,0)),W=v(N.value.width),G=v(N.value.height),K=u(()=>({height:G.value,width:W.value})),ft=u(()=>({horizontal:{x:J.value.x+(N.value.percentage.horizontalPosition===`left`?6:3),y:K.value.height/2-J.value.fontSize/2},vertical:{x:K.value.width/2-20,y:J.value.y-J.value.fontSize/2}})[M.value.display]),q=u(()=>V.value?{mark:(K.value.height-U.value)/100*.5,space:(K.value.height-U.value)/100*.5}:{mark:(K.value.width-U.value)/100*.5,space:(K.value.width-U.value)/100*.5}),pt=u(()=>{let e=[];for(let t=0;t<100;t+=1){let n=M.value.ticks.gradient.show?i(M.value.activeColor,t/100*(M.value.ticks.gradient.shiftHueIntensity/100)):M.value.activeColor;if(V.value){let r=M.value.crescendo?(100-t)*(K.value.width-H.value.left-H.value.right)/100/3:0,i=H.value.left+4+r,a=K.value.width-H.value.right-4-r,o=K.value.height-H.value.bottom-t*q.value.mark-t*q.value.space-q.value.mark,s=K.value.height-H.value.bottom-t*q.value.mark-t*q.value.space-q.value.mark,c=(a-i)/M.value.curveAngleX,l=M.value.curveAngleY*((1+t)/100);e.push({x1:i,x2:a,y1:o,y2:s,curve:`M ${i} ${o} C ${i+c} ${o-l}, ${a-c} ${s-l}, ${a} ${s}`,color:n})}else{let r=M.value.crescendo?(100-t)*(K.value.height-H.value.top-H.value.bottom)/100/3:0,i=H.value.left+t*q.value.mark+t*q.value.space-q.value.mark,a=i,o=H.value.top+4+r,s=K.value.height-H.value.bottom-4-r,c=M.value.curveAngleY*((1+t)/100),l=(s-o)/M.value.curveAngleX;e.push({x1:i,x2:a,y1:o,y2:s,curve:`M ${i} ${o} C ${i+c} ${o+l}, ${a+c} ${s-l}, ${a} ${s}`,color:n})}}return e}),J=u(()=>{let e,t,n,r=N.value.percentage.fontSize/3;return V.value?N.value.percentage.verticalPosition===`top`?(e=K.value.width/2,t=H.value.top/2,n=`middle`):N.value.percentage.verticalPosition===`bottom`&&(e=K.value.width/2,t=K.value.height-H.value.bottom/2+r,n=`middle`):N.value.percentage.horizontalPosition===`left`?(e=4,t=K.value.height/2+r,n=`start`):N.value.percentage.horizontalPosition===`right`&&(e=K.value.width-H.value.right+8,t=K.value.height/2+r,n=`start`),{x:e,y:t,textAnchor:n,bold:N.value.percentage.bold,fontSize:N.value.percentage.fontSize,fill:N.value.percentage.color}}),Y=v(!1);function mt(e){Y.value=e,$e.value+=1}let X=v(!1);function Z(){X.value=!X.value}let ht=se(D,()=>N.value.title.text),gt=u(()=>N.value.backgroundColor),_t=u(()=>N.value.title),{isCallbackImaging:vt,isCallbackSvg:Q,generateSvg:yt,onGenerateImage:bt}=le({svg:at,title:_t,legend:null,legendItems:null,backgroundColor:gt,getSvgCallback:()=>A.value.userOptions.callbacks.svg,generateImage:st});async function xt(){Je(`copyAlt`,{config:A.value,dataset:F.value}),A.value.userOptions.callbacks.altCopy?await Promise.resolve(A.value.userOptions.callbacks.altCopy({config:A.value,dataset:F.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}let St=u(()=>`${E.value}-title`),Ct=u(()=>`${E.value}-desc`),$=u(()=>s(N.value.percentage.formatter,B.value,n({v:B.value,s:`%`,r:N.value.percentage.rounding}))),wt=u(()=>N.value.title.text||``),Tt=u(()=>P.value?`Loading data`:`Value: ${$.value}`);return ae({getImage:ht,generatePdf:ot,generateImage:st,generateSvg:yt,toggleAnnotator:Z,toggleFullscreen:mt,copyAlt:xt}),(e,t)=>(_(),p(`div`,{ref_key:`tiremarksChart`,ref:D,class:g(`vue-data-ui-component vue-ui-tiremarks ${A.value.useCssAnimation?``:`vue-ui-dna`}`),style:Ee(`font-family:${A.value.style.fontFamily};width:100%; text-align:center;background:${N.value.backgroundColor}`),id:E.value,onMouseenter:t[0]||=()=>S(rt)(!0),onMouseleave:t[1]||=()=>S(rt)(!1)},[j.value.buttons.annotator?(_(),d(S(C),{key:0,svgRef:S(at),backgroundColor:N.value.backgroundColor,color:N.value.color,active:X.value,isCursorPointer:tt.value,palette:j.value.annotatorPalette,onClose:Z},Ce({_:2},[y(S(de),t=>({name:t,fn:Ae(n=>[b(e.$slots,t,Te(h(S(ue)(t,n))),void 0,!0)])}))]),1032,[`svgRef`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):f(``,!0),ct.value?(_(),p(`div`,{key:1,ref_key:`noTitle`,ref:Xe,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},null,512)):f(``,!0),N.value.title.text?(_(),p(`div`,{key:2,ref_key:`chartTitle`,ref:Ze,style:`width:100%;background:transparent;padding-bottom:12px`},[(_(),d(ce,{key:`title_${et.value}`,config:{title:{cy:`wheel-title`,...N.value.title},subtitle:{cy:`wheel-subtitle`,...N.value.title.subtitle}}},null,8,[`config`]))],512)):f(``,!0),j.value.show&&Ye.value&&(S(it)||S(I))?(_(),d(S(Ge),{ref:`details`,key:`user_options_${$e.value}`,backgroundColor:N.value.backgroundColor,color:N.value.color,isPrinting:S(R),isImaging:S(z),uid:E.value,hasPdf:j.value.buttons.pdf,hasImg:j.value.buttons.img,hasSvg:j.value.buttons.svg,hasFullscreen:j.value.buttons.fullscreen,hasAltCopy:j.value.buttons.altCopy,hasXls:!1,isFullscreen:Y.value,titles:{...j.value.buttonTitles},chartElement:D.value,position:j.value.position,hasAnnotator:j.value.buttons.annotator,isAnnotation:X.value,callbacks:j.value.callbacks,printScale:j.value.print.scale,isCursorPointer:tt.value,onToggleFullscreen:mt,onGeneratePdf:S(ot),onGenerateImage:S(bt),onGenerateSvg:S(yt),onToggleAnnotator:Z,onCopyAlt:xt,style:Ee({visibility:S(it)?S(I)?`visible`:`hidden`:`visible`})},Ce({_:2},[y(S(fe)(e.$slots,`menuIcon optionPdf optionImg optionSvg optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:Ae(n=>[b(e.$slots,t,Te(h(S(pe)(t,n))),void 0,!0)])}))]),1032,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`hasPdf`,`hasImg`,`hasSvg`,`hasFullscreen`,`hasAltCopy`,`isFullscreen`,`titles`,`chartElement`,`position`,`hasAnnotator`,`isAnnotation`,`callbacks`,`printScale`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):f(``,!0),(_(),p(`svg`,{ref_key:`svgRef`,ref:at,xmlns:S(l),class:g({"vue-data-ui-fullscreen--on":Y.value,"vue-data-ui-fulscreen--off":!Y.value}),viewBox:`0 0 ${W.value} ${G.value}`,style:Ee(`max-width:100%; overflow: visible; background:transparent;color:${N.value.color}`),role:`img`,"aria-labelledby":St.value,"aria-describedby":Ct.value},[Se(`title`,{id:St.value},x(wt.value),9,Pe),Se(`desc`,{id:Ct.value},x(Tt.value),9,Fe),we(S(Ke)),b(e.$slots,`svg-underlayer`,{svg:{...K.value,isPrintingImg:S(R)||S(z)||S(vt),isPrintingSvg:S(Q)}},void 0,!0),e.$slots[`chart-background`]?(_(),p(`foreignObject`,{key:0,x:0,y:0,width:K.value.width,height:K.value.height,style:{pointerEvents:`none`}},[b(e.$slots,`chart-background`,{},void 0,!0)],8,Ie)):f(``,!0),M.value.curved?(_(),p(`g`,Le,[(_(!0),p(xe,null,y(pt.value,(e,t)=>(_(),p(`path`,{d:e.curve,"stroke-width":q.value.mark,stroke:B.value>=t?e.color:M.value.inactiveColor,"stroke-linecap":`round`,fill:`none`,class:g({"vue-ui-tick-animated":N.value.animation.use&&!S(w)&&t<=B.value})},null,10,Re))),256))])):(_(),p(`g`,ze,[(_(!0),p(xe,null,y(pt.value,(e,t)=>(_(),p(`line`,{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,"stroke-width":q.value.mark,stroke:B.value>=t?e.color:M.value.inactiveColor,"stroke-linecap":`round`},null,8,Be))),256))])),N.value.percentage.show?(_(),p(`g`,{key:3,role:`status`,"aria-live":`polite`,"aria-label":S(P)?`...`:`${$.value}`},[S(P)?(_(),p(`rect`,{key:0,x:ft.value.x,y:ft.value.y,width:40,height:J.value.fontSize,fill:`#6A6A6A80`,rx:3},null,8,He)):(_(),p(`text`,{key:1,"aria-hidden":`true`,x:J.value.x,y:J.value.y,"font-size":J.value.fontSize,fill:M.value.ticks.gradient.show&&N.value.percentage.useGradientColor?S(i)(M.value.activeColor,B.value/100*(M.value.ticks.gradient.shiftHueIntensity/100)):N.value.percentage.color,"font-weight":J.value.bold?`bold`:`normal`,"text-anchor":J.value.textAnchor},x($.value),9,Ue))],8,Ve)):f(``,!0),b(e.$slots,`svg`,{svg:{...K.value,isPrintingImg:S(R)||S(z)||S(vt),isPrintingSvg:S(Q)}},void 0,!0)],14,Ne)),e.$slots.watermark?(_(),p(`div`,We,[b(e.$slots,`watermark`,Te(h({isPrinting:S(R)||S(z)||S(vt)||S(Q)})),void 0,!0)])):f(``,!0),e.$slots.source?(_(),p(`div`,{key:5,ref_key:`source`,ref:Qe,dir:`auto`},[b(e.$slots,`source`,{},void 0,!0)],512)):f(``,!0),b(e.$slots,`skeleton`,{},()=>[S(P)?(_(),d(ne,{key:0})):f(``,!0)],!0)],46,Me))}},[[`__scopeId`,`data-v-fa4acd55`]]);export{je as n,C as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useConfig-6jO1fkp5.js";import{$ as n,D as r,Dt as i,Ft as a,Ht as o,S as s,X as c,Zt as l,at as u,et as d,i as f,in as ee,nt as te,pt as ne,r as re,t as ie,w as ae,zt as oe}from"./lib-rPeBMZrn.js";import{n as se,t as ce}from"./BaseScanner-8NdoBs7B.js";import{n as le,t as ue}from"./useHints-C-TwxM0Y.js";import{t as de}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as fe}from"./resolveChartConfig-CIhClE5R.js";import{t as pe}from"./chartImage-DPGnEuYM.js";import{t as me}from"./BaseIcon-Cm-IJ179.js";import{n as he}from"./Title-BliHuXfT.js";import{t as ge}from"./useChartExport-BZts4KFb.js";import{n as _e,t as ve}from"./tableIntegration-CNoJ1CIY.js";import{n as ye,t as be}from"./annotationSlots-BRR85CqJ.js";import{n as xe,t as Se}from"./userOptionsSlots-DYuo-E5m.js";import{t as Ce}from"./usePrinter-DVf3YcG5.js";import{t as we}from"./useTransitions-ChGGrtrv.js";import{c as Te}from"./canvas-lib-22VpOI4_.js";import{t as Ee}from"./useResponsive-CENUxfEL.js";import{t as De}from"./DefGrad-DKMq1REY.js";import{t as Oe}from"./BaseLegendToggle-Q3TiW9u1.js";import{t as ke}from"./A11yDataTable-DWNlWXzs.js";import{t as Ae}from"./useUserOptionState-CXlFnwPv.js";import{t as je}from"./useChartAccessibility-DOMuYJfm.js";import{t as Me}from"./Legend-DM0ClX3D.js";import{t as Ne}from"./usePanZoom-BdjP5Suc.js";import{t as Pe}from"./vue_ui_treemap-Bv4Rdl5_.js";import{Fragment as Fe,Teleport as Ie,computed as p,createBlock as m,createCommentVNode as h,createElementBlock as g,createElementVNode as _,createSlots as Le,createTextVNode as Re,createVNode as ze,defineAsyncComponent as Be,guardReactiveProps as v,mergeProps as Ve,nextTick as He,normalizeClass as Ue,normalizeProps as y,normalizeStyle as b,onBeforeUnmount as We,onMounted as Ge,openBlock as x,ref as S,renderList as Ke,renderSlot as C,resolveDynamicComponent as qe,shallowRef as w,toDisplayString as Je,toRefs as Ye,unref as T,useCssVars as Xe,useSlots as Ze,watch as Qe,withCtx as E,withKeys as $e,withModifiers as et}from"vue";function tt(e,t){let n=e.length;if(n===0)throw Error(`Max aspect ratio cannot be computed: ${e} is an empty array`);{let r=1/0,i=-1/0,a=0;for(let t=0;t<n;t+=1){let n=e[t].normalizedValue;n<r&&(r=n),n>i&&(i=n),a+=n}return Math.max(t**2*i/a**2,a**2/(t**2*r))}}function nt(e){let{xOffset:t,yOffset:n,width:r,height:i}=e;return{x0:t,y0:n,x1:t+r,y1:n+i}}function rt(e,t,n){if(e.length===0)return!0;{let r=e.concat(t);return tt(e,n)>=tt(r,n)}}function it(e){let t=[],n=e.length;for(let r=0;r<n;r+=1){let n=e[r],i=n.length;for(let e=0;e<i;e+=1)t.push(n[e])}return t}function at(e,t){return O({...t,children:e})}function ot(e){return(e.x1-e.x0)*(e.y1-e.y0)}function st(e,t){let{width:n,height:r,xOffset:i,yOffset:a}=ut(t),o=e.length,s=e.map(e=>e.normalizedValue||0).reduce((e,t)=>e+t,0),c=s/r,l=s/n,u=i,d=a,f=[];if(n>=r){for(let t=0;t<o;t+=1){let n=e[t],r=d+n.normalizedValue/c,i={x0:u,y0:d,x1:u+c,y1:r},a=Object.assign({},n,i);d=r,f.push(a)}return f}for(let t=0;t<o;t+=1){let n=e[t],r=u+n.normalizedValue/l,i={x0:u,y0:d,x1:r,y1:d+l},a=Object.assign({},n,i);u=r,f.push(a)}return f}function ct(e){let t=ut(e),n=t.width,r=t.height;return Math.min(n,r)}function lt(e,t){let n=e.length,r=t/e.map(e=>e.value??0).reduce((e,t)=>e+t,0),i=[],a,o;for(let t=0;t<n;t+=1)o=e[t],a=Object.assign({},o,{normalizedValue:o.value*(r||0)}),i.push(a);return i}function ut(e){let{x0:t,y0:n,x1:r,y1:i}=e;return{xOffset:t,yOffset:n,width:r-t,height:i-n}}function D(e,t,n,r){let i=e,a=t,o=n,s=r;for(;;){let e=i.length;if(e===0){let e=st(a,o);return s.concat(e)}let t=ct(o),n=i[0],r=i.slice(1,e);if(rt(a,n,t)){let e=a.concat(n);i=r,a=e,o=o,s=s}else{let e=a.length,t=0;for(let n=0;n<e;n+=1)t+=a[n].normalizedValue;let n=dt(o,t),r=st(a,o),c=s.concat(r);i=i,a=[],o=n,s=c}}}function O(e){if(e.children===void 0||!e.children.length)return[e];{let t=D(lt(e.children,ot(e)),[],e,[]),n=t.length,r=[];for(let e=0;e<n;e+=1)r.push(O(t[e]));return it(r)}}function dt(e,t){let{width:n,height:r,xOffset:i,yOffset:a}=ut(e);if(n>=r){let e=t/r,o=n-e;return nt({xOffset:i+e,yOffset:a,width:o,height:r})}{let e=t/n,o=r-e;return nt({xOffset:i,yOffset:a+e,width:n,height:o})}}var ft=/* @__PURE__ */ e({default:()=>Vt}),pt=[`id`],mt=[`id`],ht=[`id`],gt=[`tabindex`,`onClick`,`onKeydown`,`data-last-crumb`,`onMouseenter`,`onFocus`],_t={class:`vue-ui-treemap-crumb-unit`},vt={class:`vue-ui-treemap-crumb-unit-label`},yt={key:0,style:{width:`24px`,display:`flex`,"align-items":`center`}},bt={key:0,class:`vue-ui-treemap-crumb-unit-arrow`},xt={style:{position:`relative`}},St=[`xmlns`,`aria-describedby`,`viewBox`],Ct={key:0},wt=[`x`,`y`,`height`,`width`,`fill`,`rx`,`stroke`,`stroke-width`,`onClick`,`onMouseenter`,`onMouseleave`],Tt=[`id`],Et=[`x`,`y`,`width`,`height`],Dt=[`clip-path`],Ot=[`transform`],kt=[`transform`],At=[`x`,`y`,`fill`,`font-size`,`font-family`,`font-weight`],jt={key:0},Mt=[`x`,`y`,`height`,`width`],Nt={style:{width:`100%`,height:`100%`,overflow:`hidden`},class:`vue-ui-treemap-cell`},Pt={key:0,"data-dom-to-png-ignore":``,class:`reset-wrapper`},Ft={key:1,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},It={key:6,class:`vue-data-ui-watermark`},Lt=[`id`],Rt=[`onClick`],zt={style:{display:`flex`,"align-items":`center`}},Bt=4,Vt=/*#__PURE__*/ de({__name:`vue-ui-treemap`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`selectLegend`,`selectDatapoint`,`copyAlt`],setup(e,{expose:de,emit:tt}){Xe(e=>({v206eec08:Di.value}));let nt=Be(()=>import(`./DataTable-0Vv-aGHD.js`)),rt=Be(()=>import(`./PenAndPaper-BGEp-TUm.js`).then(e=>e.t)),it=Be(()=>import(`./vue-ui-accordion-S3nRtTU-.js`).then(e=>e.n)),ot=Be(()=>import(`./Tooltip-C1q0Qoh7.js`)),st=Be(()=>import(`./UserOptions-uWHV_zPB.js`).then(e=>e.n)),ct=Be(()=>import(`./PackageVersion-CXT-eAuk.js`).then(e=>e.t)),lt=Be(()=>import(`./BaseDraggableDialog-DHgIPVmz.js`).then(e=>e.n)),{vue_ui_treemap:ut}=t(),D=e,O=tt,dt=Ze(),ft=p(()=>!!D.dataset&&D.dataset.length),Vt=p(()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent)),k=S(c()),Ht=S(!1),Ut=S(``),Wt=S(!1),Gt=S(0),A=S([]),Kt=w(null),qt=w(null),Jt=w(null),Yt=w(null),Xt=w(null),Zt=S(0),Qt=S(0),$t=S(0),j=S([]),en=S(null),tn=S(!1),nn=S(null),rn=S(null),an=S(null),on=S(/* @__PURE__ */ new Map),M=S(null),sn=S({x:0,y:0}),cn=S(`pointer`),ln=S(!1),N=S(yn()),P=p(()=>N.value.userOptions),F=p(()=>N.value.style.chart.tooltip),I=p(()=>N.value.style.chart.legend),L=p(()=>N.value.style.chart.layout.labels),R=p(()=>N.value.style.chart.layout),z=p(()=>N.value.style.chart);le({config:()=>N.value,dataset:()=>D.dataset,component:`VueUiTreemap`,rules:[ue.emptyArray,{test:e=>e.length===1&&e[0]?.children&&e[0].children.length<6&&e[0].children.length>0||e.flatMap(e=>e?.children?.length??0).reduce((e,t)=>e+t,0)<6,message:[`👀 The number of data points is < 6. Consider:`,``,`▶️ Using another type of chart instead to better show proportions: VueUiDonut, VueUiWaffle`]},{test:e=>e.length===1&&e[0]?.children&&e[0].children.length===0,message:[`👀 There is a series defined in the dataset but it has no children items.`,``,`▶️ Add children items to your series.`]}]});let{transitionEnabled:un}=we({config:()=>N.value.transitions,dataset:()=>D.dataset}),B=p(()=>N.value.userOptions.useCursorPointer),dn=p(()=>ee({defaultConfig:{userOptions:{show:!1},style:{chart:{backgroundColor:`#999999`,layout:{labels:{showDefaultLabels:!1},rects:{stroke:`#6A6A6A`}},legend:{backgroundColor:`transparent`}}}},userConfig:N.value.skeletonConfig??{}})),{loading:fn,FINAL_DATASET:pn,manualLoading:mn}=se({...Ye(D),FINAL_CONFIG:N,prepareConfig:yn,skeletonDataset:D.config?.skeletonDataset??[{name:`_`,value:53,color:`#CACACA90`,children:[{name:`_`,value:21},{name:`_`,value:13},{name:`_`,value:8},{name:`_`,value:5},{name:`_`,value:3},{name:`_`,value:2},{name:`_`,value:1}]}],skeletonConfig:ee({defaultConfig:N.value,userConfig:dn.value})}),{userOptionsVisible:hn,setUserOptionsVisibility:gn,keepUserOptionState:_n}=Ae({config:N.value}),{svgRef:vn}=je({config:z.value.title});function yn(){return fe(D.config,ut,Pe)}let bn=l(D.config);Qe(()=>D.config,(e,t)=>{let n=l(e),r=n!==bn;bn=n;let i=yn();r?(fn.value||(N.value=i),hn.value=!N.value.userOptions.showOnChartHover,Zt.value+=1,Qt.value+=1,$t.value+=1,V.value.showTable=N.value.table.show,V.value.showTooltip=F.value.show,V.value.showZoom=z.value.zoom?.show??!1):(N.value.style.chart.tooltip=i.style.chart.tooltip,V.value.showTooltip=N.value.style.chart.tooltip.show)},{deep:!0});let{isPrinting:xn,isImaging:Sn,generatePdf:Cn,generateImage:wn}=Ce({elementId:`treemap_${k.value}`,fileName:z.value.title.text||`vue-ui-treemap`,options:N.value.userOptions.print}),Tn=p(()=>N.value.userOptions.show&&!z.value.title.text),En=p(()=>ae(N.value.customPalette)),V=S({showTable:N.value.table.show,showTooltip:F.value.show,showZoom:z.value.zoom?.show??!1});Qe(N,()=>{V.value={showTable:N.value.table.show,showTooltip:F.value.show,showZoom:z.value.zoom?.show??!1}},{immediate:!0});let Dn=S({height:z.value.height,width:z.value.width});function On(e){let t=Kt.value,n=Dn.value.height;return!t||!n?e:e*(n/t.getBoundingClientRect().height)}function kn(){if(!en.value||X.value.length<=1)return 0;let e=en.value,t=getComputedStyle(e);return On(e.offsetHeight+parseFloat(t.marginTop||`0`)+parseFloat(t.marginBottom||`0`)+parseFloat(t.paddingTop||`0`)+parseFloat(t.paddingBottom||`0`))}let H=p(()=>{let e=z.value.padding,t=Dn.value.width,n=Dn.value.height,r=kn(),i=e.left,a=t-e.right,o=e.top,s=n-e.bottom-r;return{left:i,top:o,right:a,bottom:s,width:a-i,height:Math.max(0,s-o),vbWidth:t,vbHeight:n-r,offsetY:r}}),U=S(d(pn.value)),W=S(U.value),An=w(/* @__PURE__ */ new Map);Qe([U,()=>N.value],()=>{an.value=null,on.value=/* @__PURE__ */ new Map},{deep:!0}),Qe(()=>A.value,()=>{an.value=null,on.value=/* @__PURE__ */ new Map,Pn(),$t.value+=1,Qt.value+=1},{deep:!0}),Qe([()=>Dn.value.width,()=>Dn.value.height],()=>{on.value=/* @__PURE__ */ new Map});function jn(e){Array.isArray(e)&&e.forEach((e,t)=>{e.id||=c(),e.sourceColor===void 0&&(e.sourceColor=s(e.color)||null);let n=e.sourceColor||An.value.get(e.id)||En.value[t]||o[t]||o[t%o.length];n=s(n),An.value.set(e.id,n),e.color=n,Mn(e,n)})}function Mn(e,t){Array.isArray(e.children)&&e.children.forEach(n=>{n.id||=c(),n.parentId=e.id,n.sourceColor===void 0&&(n.sourceColor=s(n.color)||null);let r=n.sourceColor||t;n.color=r,Mn(n,r)})}function Nn(e){let t=Y(e);for(;t?.parentId;)t=Y(t.parentId);return t?.id??null}function Pn(){let e=U.value.filter(e=>!A.value.includes(e.id));if(!j.value.length){W.value=e;return}let t=j.value[j.value.length-1],n=Y(t);if(!n){j.value=[],W.value=e;return}let r=Nn(n.id);r&&A.value.includes(r)?(j.value=[],W.value=e):W.value=[n]}Qe(()=>pn.value,()=>{U.value=d(pn.value),jn(U.value),Pn(),$t.value+=1,Qt.value+=1},{deep:!0,immediate:!0,flush:`post`});let Fn=w(null),In=w(null);Ge(()=>{tn.value=!0,Rn()});let Ln=p(()=>N.value.debug);Ge(()=>{dt[`chart-background`]&&Ln.value&&console.warn(`VueUiTreemap does not support the #chart-background slot.`)});function Rn(){if(oe(D.dataset)&&u({componentName:`VueUiTreemap`,type:`dataset`,debug:Ln.value}),jn(U.value),oe(D.dataset)||(mn.value=N.value.loading),N.value.responsive){let e=Te(()=>{let{width:e,height:t}=Ee({chart:Kt.value,title:z.value.title.text?qt.value:null,legend:I.value.show?Jt.value:null,source:Yt.value,noTitle:Xt.value});requestAnimationFrame(()=>{Dn.value.width=e,Dn.value.height=t-12})});Fn.value&&(In.value&&Fn.value.unobserve(In.value),Fn.value.disconnect()),Fn.value=new ResizeObserver(e),In.value=Kt.value.parentNode,Fn.value.observe(In.value)}}We(()=>{Fn.value&&(In.value&&Fn.value.unobserve(In.value),Fn.value.disconnect())});let zn=p(()=>W.value.map((e,t)=>({...e,color:s(e.color)||En.value[t]||o[t]||o[t%o.length]})).filter(e=>!A.value.includes(e.id))),Bn=p(()=>U.value.filter(e=>!A.value.includes(e.id)).map(e=>e.value||0).reduce((e,t)=>e+t,0)),Vn=p({get(){let e=[...zn.value];return R.value.sorted&&(e=[...zn.value].sort((e,t)=>t.value-e.value)),e.map(e=>({...e}))},set(e){return e}});function Hn(e,t){return e.value/t}function Un(e,t,n){let r=R.value.rects.colorRatio-Hn(t,n);return a(e,r<0?0:r)}function Wn(e){return Array.isArray(e.children)&&e.children.length>0}function Gn(e){return[...e].sort((e,t)=>{let n=Wn(e),r=Wn(t);if(n!==r)return n-r;let i=Number(e.value)||0;return(Number(t.value)||0)-i})}function Kn(e,t,n,r,i){return Gn(e).map((e,a)=>{let c=e.sourceColor||s(e.color)||s(t)||En.value[a]||o[a]||o[a%o.length],l=e.sourceColor?e.sourceColor:Un(c,e,r),u=Hn(e,r),d=i??e.parentId??e.id,f=Array.isArray(e.children)&&e.children.length&&e.children.reduce((e,t)=>e+(Number(t.value)||0),0)||1;return{...e,color:l,proportion:u,parentName:n,rootId:d,children:Array.isArray(e.children)&&e.children.length?Kn(e.children,c,e.name,f,d):void 0}})}function qn(e){let t=or(e),n=Jn(e),r=t*.55,i=t*.55,a=t*1.05,o=t*1.05,s=t*.35,c=n?a+o+s:t*.45,l=e.x0+r,u=e.x1-r,d=e.y0+c,f=e.y1-i;return u<=l||f<=d?null:{x0:l,y0:d,x1:u,y1:f}}function Jn(e){return L.value.hideUnderProportion===0||Yn(e)}function Yn(e){let t=Number(L.value.hideUnderProportion);return!Number.isFinite(t)||t<=0||e.proportion>t}function Xn(e,t,n=0,r=null){if(!Array.isArray(e)||!e.length)return[];let i=e.map(e=>{let{children:t,...n}=e;return{...n}}),a=new Map(e.map(e=>[e.id,Array.isArray(e.children)?e.children:[]])),o=new Map(e.map(e=>[e.id,e])),s=at(i,t),c=[];for(let e of s){let t=a.get(e.id)||[],i=o.get(e.id),s={...e,depth:n,parentId:r??e.parentId??null,color:i?.color??e.color??null,children:t,isVisibleNode:!0,showLabel:Jn(e)};if(c.push(s),t.length){let r=qn(s);r&&c.push(...Xn(t,r,n+1,e.id))}}return c}let Zn=p(()=>{let e=W.value.length?W.value:Vn.value,t=e.map(e=>Number(e.value)||0).reduce((e,t)=>e+t,0)||1;return Xn(e.map((e,n)=>{let r=e.children?e.children.reduce((e,t)=>e+(Number(t.value)||0),0):e.value,{children:i,...a}=e,l=e.sourceColor||s(e.color)||An.value.get(e.id)||En.value[n]||o[n]||o[n%o.length],u=e.sourceColor?e.sourceColor:Un(l,e,t);return{...a,id:e.id||c(),parentId:e.parentId??null,name:e.name,value:e.value,color:u,proportion:(Number(e.value)||0)/t,children:Array.isArray(e.children)&&e.children.length?Kn(e.children,l,e.name,r||1):void 0}}),{x0:H.value.left,y0:H.value.top,x1:H.value.left+H.value.width,y1:H.value.top+H.value.height})}),G=p(()=>Zn.value);function Qn(e){return(Z.value&&Z.value.id===e.id?R.value.rects.selected.strokeWidth:R.value.rects.strokeWidth)*Hr.value}function K({y0:e,y1:t}){return t-e<=0?1e-4:Math.round((t-e)*1e4)/1e4}function q({x0:e,x1:t}){return t-e<=0?1e-4:Math.round((t-e)*1e4)/1e4}function $n(){let e=L.value,t=Number(e.minFontSize),n=Number(e.fontSize),r=Math.max(0,Math.min(Number.isFinite(t)?t:0,Number.isFinite(n)?n:0));return{lowerBound:r,upperBound:Math.max(r,Number.isFinite(n)?n:r)}}function er(e){let t=Math.min(4,Math.max(e*.25,.5));return{paddingX:t,paddingTop:t}}function tr(e,t){let{paddingX:n,paddingTop:r}=er(t),i=t*1.1;return{x:e.x0+n,y:e.y0+r,width:Math.max(q(e)-n*2,0),height:Math.max(K(e)-r*2,0),lineHeight:i}}function nr(e,t){return f(L.value.formatter,e.value,n({p:L.value.prefix,v:e.value,s:L.value.suffix,r:F.value.roundingValue}),{datapoint:e,seriesIndex:t})}function rr(e,t){let n=nr(e,t);return Array.isArray(e.children)&&e.children.length?[`${e.name} (${n})`]:[`${e.name}`,n].filter(e=>`${e}`.length)}function ir(e,t,n){let r=rr(e,n),i=tr(e,t);return!r.length||i.width<=0||i.height<=0||r.length*i.lineHeight>i.height?!1:r.every((e,n)=>yi(e,t,n===0?500:400)<=i.width)}function ar(e,t,n,r){let i=rr(e,t),a=Math.max(1,...i.map(e=>String(e).length)),o=Math.min(18,Math.max(10,Math.ceil(a*.7))),s=Math.max(1,i.length),c=Math.max(q(e)-1,1e-4),l=Math.max(K(e)-1,1e-4),u=c/(o*.58),d=l/(s*1.35);return Math.max(n,Math.min(r,u,d))}function or(e,t){let{lowerBound:n,upperBound:r}=$n(),i=Math.max(1e-4,Math.min(q(e),K(e))),a=Math.max(n,Math.min(r,i*.9)),o=Math.min(a,ar(e,t,n,r));if(ir(e,o,t)||!ir(e,n,t))return o;let s=n,c=o,l=n;for(let n=0;n<8;n+=1){let n=(s+c)/2;ir(e,n,t)?(l=n,s=n):c=n}let u=Math.max(n,o*.7);return l>=u?l:o}function sr(e){Wt.value=e,Gt.value+=1}let J=p(()=>({x:0,y:0,width:H.value.vbWidth,height:H.value.vbHeight}));function Y(e,t=U.value){for(let n of t){if(n.id===e)return n;if(n.children){let t=Y(e,n.children);if(t)return t}}return null}function cr(e){let t=[],n=Y(e);for(;n&&n.parentId;){let e=Y(n.parentId);if(!e)break;t.unshift(e.id),n=e}return t}let lr=p(()=>j.value.length>0);function ur(){W.value=U.value.slice(),j.value=[],O(`selectDatapoint`,void 0)}function dr(){return j.value[j.value.length-1]??null}function fr(e,t,n){j.value=[...cr(e.id),e.id],W.value=[e],N.value.events.datapointClick&&N.value.events.datapointClick({datapoint:t??e,seriesIndex:n}),O(`selectDatapoint`,t??e)}function pr(e,t){let n=dr();if(!n){ur();return}let r=Y(n);if(!r?.parentId){N.value.events.datapointClick&&N.value.events.datapointClick({datapoint:e,seriesIndex:t}),ur();return}let i=Y(r.parentId);i?(j.value=[...cr(i.id),i.id],W.value=[i],N.value.events.datapointClick&&N.value.events.datapointClick({datapoint:e,seriesIndex:t}),O(`selectDatapoint`,e)):ur()}function mr(e,t){if(!e){ur();return}let n=Y(e.id);n&&(dr()===n.id?pr(e,t):fr(n,e,t))}function hr(e){return e?dr()===e.id:!1}let X=p(()=>{let e=[{id:null,label:`All`}];if(j.value.length>0){let t=Y(j.value[j.value.length-1]),n=[];for(;t;)n.unshift(t),t=t.parentId?Y(t.parentId):null;for(let t of n)e.push({id:t.id,label:t.name,node:t})}return e}),Z=w(null),gr=p(()=>U.value.map((e,t)=>({...e,color:s(e.color)||En.value[t]||o[t]||o[t%o.length],shape:`square`})).sort((e,t)=>t.value-e.value).map((e,t)=>{let r=e.value/U.value.map(e=>e.value).reduce((e,t)=>e+t,0);return{...e,proportion:r,isSegregated:A.value.includes(e.id),segregate:()=>br(e),opacity:A.value.includes(e.id)?.5:1,display:`${e.name}${I.value.showPercentage||I.value.showValue?`: `:``}${I.value.showValue?f(L.value.formatter,e.value,n({p:L.value.prefix,v:e.value,s:L.value.suffix,r:I.value.roundingValue}),{datapoint:e}):``}${I.value.showPercentage?A.value.includes(e.id)?`${I.value.showValue?` (`:``}- %${I.value.showValue?`)`:``}`:`${I.value.showValue?` (`:``}${isNaN(e.value/Bn.value)?`-`:(e.value/Bn.value*100).toFixed(I.value.roundingPercentage)}%${I.value.showValue?`)`:``}`:``}`}})),_r=p(()=>({cy:`treemap-div-legend`,backgroundColor:I.value.backgroundColor,color:I.value.color,fontSize:I.value.fontSize,paddingBottom:12,fontWeight:I.value.bold?`bold`:``})),vr=p(()=>A.value.length===gr.value.length);function yr(){A.value.length?A.value=[]:gr.value.forEach(e=>{A.value.push(e.id)}),O(`selectLegend`,U.value.filter(e=>!A.value.includes(e.id)))}function br(e){Z.value=null,A.value.includes(e.id)?A.value=A.value.filter(t=>t!==e.id):A.value.length<D.dataset.length-1&&A.value.push(e.id),O(`selectLegend`,U.value.filter(e=>!A.value.includes(e.id)))}function xr(e){return U.value.length?U.value.find(t=>t.name===e)||(Ln.value&&console.warn(`VueUiTreemap - Series name not found "${e}"`),null):(Ln.value&&console.warn(`VueUiTreemap - There are no series to show.`),null)}function Sr(e){let t=xr(e);t!==null&&A.value.includes(t.id)&&br({id:t.id})}function Cr(e){let t=xr(e);t!==null&&(A.value.includes(t.id)||br({id:t.id}))}function wr({datapoint:e,seriesIndex:t}){Z.value=null,Ht.value=!1,M.value=null,cn.value=`pointer`,N.value.events.datapointLeave&&N.value.events.datapointLeave({datapoint:e,seriesIndex:t})}let Tr=S(null);function Er({datapoint:e,seriesIndex:t,triggerMode:r=`pointer`}){if(vr.value||r===`pointer`&&Ir.value)return;N.value.events.datapointEnter&&N.value.events.datapointEnter({datapoint:e,seriesIndex:t}),M.value=t,cn.value=r,Z.value=e,Tr.value={datapoint:e,seriesIndex:t,config:N.value,series:zn.value};let a=F.value.customFormat;if(i(a)&&ne(()=>a({seriesIndex:t,datapoint:e,series:zn.value,config:N.value})))Ut.value=a({seriesIndex:t,datapoint:e,series:zn.value,config:N.value});else{let r=``;r+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${F.value.borderColor};padding-bottom:6px;margin-bottom:3px;">${e.name}</div>`,r+=`<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 12 12" height="14" width="14"><rect x="0" y="0" height="12" width="12" stroke="none" fill="${e.color}"/></svg>`,r+=`<b>${f(L.value.formatter,e.value,n({p:L.value.prefix,v:e.value,s:L.value.suffix,r:F.value.roundingValue}),{datapoint:e,seriesIndex:t})}</b>`,Ut.value=`<div>${r}</div>`}Ht.value=!0}let Q=p(()=>({head:G.value.map(e=>({name:e.name,color:e.color})),body:G.value.map(e=>e.value)}));function Dr(e=null){He(()=>{let t=Q.value.head.map((e,t)=>[[e.name],[Q.value.body[t]],[isNaN(Q.value.body[t]/Bn.value)?`-`:Q.value.body[t]/Bn.value*100]]),n=[[z.value.title.text],[z.value.title.subtitle.text],[[``],[`val`],[`%`]]].concat(t),i=r(n);e?e(i):te({csvContent:i,title:z.value.title.text||`vue-ui-treemap`})})}let Or=p(()=>{let e=[N.value.table.columnNames.series,N.value.table.columnNames.value,N.value.table.columnNames.percentage],t=Q.value.head.map((e,t)=>{let r=f(L.value.formatter,Q.value.body[t],n({p:L.value.prefix,v:Q.value.body[t],s:L.value.suffix,r:N.value.table.td.roundingValue}));return[{color:e.color,name:e.name,shape:`square`},r,isNaN(Q.value.body[t]/Bn.value)?`-`:n({v:Q.value.body[t]/Bn.value*100,s:`%`,r:N.value.table.td.roundingPercentage})]}),r={th:{backgroundColor:N.value.table.th.backgroundColor,color:N.value.table.th.color,outline:N.value.table.th.outline},td:{backgroundColor:N.value.table.td.backgroundColor,color:N.value.table.td.color,outline:N.value.table.td.outline},breakpoint:N.value.table.responsiveBreakpoint};return{colNames:[N.value.table.columnNames.series,N.value.table.columnNames.value],head:e,body:t,config:r}});function kr(){return G.value}function Ar(){V.value.showTable=!V.value.showTable}function jr(){V.value.showTooltip=!V.value.showTooltip}function Mr(){V.value.showZoom=!V.value.showZoom}let Nr=S(!1);function Pr(){Nr.value=!Nr.value}let Fr=p(()=>!Nr.value&&V.value.showZoom),Ir=S(null),Lr=S(!1),{viewBox:$,resetZoom:Rr,isZoom:zr,setInitialViewBox:Br,scale:Vr}=Ne(vn,{x:J.value.x,y:J.value.y,width:Math.max(10,J.value.width),height:Math.max(10,J.value.height)},1,Fr),Hr=p(()=>1/Vr.value),Ur=p(()=>Math.min(1,L.value.fontSizeZoomFactor/Math.max(Vr.value,1e-4))),Wr=p(()=>`scale(${Ur.value})`),Gr=p(()=>V.value.showZoom||zr.value);Qe([()=>J.value.x,()=>J.value.y,()=>J.value.width,()=>J.value.height],()=>{He(()=>{Br({x:J.value.x,y:J.value.y,width:Math.max(10,J.value.width),height:Math.max(10,J.value.height)})})},{immediate:!0});function Kr(e){Fr.value&&(e.button===void 0||e.button===0)&&(Ir.value={x:e.clientX,y:e.clientY},Lr.value=!1)}function qr(e){if(!Fr.value||!Ir.value)return;let t=e.clientX-Ir.value.x,n=e.clientY-Ir.value.y;Math.hypot(t,n)>Bt&&(Lr.value=!0)}function Jr(){Ir.value=null,Lr.value&&window.setTimeout(()=>{Lr.value=!1},0)}function Yr(e,t){Lr.value||mr(e,t)}let Xr=S(null);function Zr(e){Xr.value=e}function Qr(){Xr.value=null}let $r=pe(Kt,()=>z.value.title.text),ei=p(()=>ve({config:N,style:z,mutableConfig:V,dialog:lt,accordion:it,isFullscreen:Wt,parent:Kt,maxWidth:800,isCursorPointer:B}));Qe(()=>V.value.showTable,e=>_e(e,N,nn));function ti(){V.value.showTable=!1,rn.value&&rn.value.setTableIconState(!1)}let ni=p(()=>gr.value.map(e=>({...e,name:e.display}))),ri=p(()=>z.value.backgroundColor),ii=p(()=>z.value.title),{isCallbackImaging:ai,isCallbackSvg:oi,generateSvg:si,onGenerateImage:ci}=ge({svg:vn,title:ii,legend:I,legendItems:ni,backgroundColor:ri,getSvgCallback:()=>N.value.userOptions.callbacks.svg,generateImage:wn});function li(e,t){let n=or(e,t),{paddingX:r,paddingTop:i}=er(n);return{fontSize:n,paddingX:r,paddingTop:i,lineHeight:n*1.1}}function ui(e){return re(e.color??z.value.backgroundColor)}function di({availableHeight:e,lineHeight:t,lineIndex:n}){if(n===0)return 1/0;let r=e/(n+1);return r<1e-4?-1/0:t<=0?1/0:r/t}function fi(){return Number(L.value.hideUnderProportion)===0}function pi(e){let t=Ur.value;return e.alwaysShowAllLines?`scale(${Math.min(t,e.allLinesScaleCap)})`:Wr.value}function mi({rect:e,seriesIndex:t}){if(!e||!L.value.showDefaultLabels||!Jn(e))return null;let{fontSize:n,paddingX:r,paddingTop:i,lineHeight:a}=li(e,t),o=ui(e),s=rr(e,t).map(e=>String(e??``)),c=tr(e,n);if(!s.some(Boolean)||c.width<=0||c.height<=0)return null;let l=fi(),u=l?Math.max(1e-4,Math.min(1,c.height/Math.max(s.length*a,1e-4))):1,d=`treemap_clip_${k.value}_${e.id}`,f=e.x0,ee=e.y0,te=Math.max(q(e),0),ne=Math.max(K(e),0);return{key:hi(e),clipId:d,clipX:f,clipY:ee,clipWidth:te,clipHeight:ne,translate:`translate(${e.x0}, ${e.y0})`,alwaysShowAllLines:l,allLinesScaleCap:u,lines:s.map((t,s)=>({key:`${e.id}_${s}`,text:t,x:r,y:i+a*s,maxZoomFactor:di({availableHeight:c.height,lineHeight:a,lineIndex:s}),fill:o,fontSize:n,fontFamily:N.value.style.fontFamily,fontWeight:s===0?500:400}))}}function hi(e){return`${e.id}`}let gi=p(()=>dt.rect||fn.value||!L.value.showDefaultLabels||vr.value?[]:G.value.map((e,t)=>e.showLabel?mi({rect:e,seriesIndex:t}):null).filter(Boolean)),_i;function vi(){return typeof document>`u`?null:(_i||=document.createElement(`canvas`),_i.getContext(`2d`))}function yi(e,t,n=400){let r=vi();return r?(r.font=`${n} ${t}px ${N.value.style.fontFamily}`,r.measureText(String(e)).width):e.length*t*.6}function bi(e){let t=R.value.rects.borderRadius,n=q(e),r=K(e);return Math.min(t,Math.min(n,r)/6)}async function xi(){O(`copyAlt`,{config:N.value,dataset:G.value}),N.value.userOptions.callbacks.altCopy?await Promise.resolve(N.value.userOptions.callbacks.altCopy({config:N.value,dataset:G.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}function Si(){M.value=null,ln.value=!0}function Ci(){M.value=null,cn.value=`pointer`,Ht.value=!1,Z.value=null,ln.value=!1}function wi(e){if(!vn.value||Nr.value||document.activeElement!==vn.value||!G.value.length||vr.value)return;let t=[`ArrowLeft`,`ArrowUp`].includes(e.key),n=[`ArrowRight`,`ArrowDown`].includes(e.key),r=e.key===`Enter`||e.key===` `,i=e.key===`Escape`;if(!t&&!n&&!r&&!i)return;if(e.preventDefault(),e.stopPropagation(),i){M.value=null,cn.value=`pointer`,Ht.value=!1,Z.value=null;return}if(r){if(M.value===null)return;let e=G.value[M.value];if(!e)return;mr(e,M.value);return}let a=M.value,o=Z.value?G.value.findIndex(e=>e.id===Z.value.id):null,s=a!==null&&a>=0&&a<G.value.length,c=o!==null&&o>=0&&o<G.value.length;s?n?(a+=1,a>=G.value.length&&(a=0)):t&&(--a,a<0&&(a=G.value.length-1)):c?(a=n?o+1:o-1,a>=G.value.length&&(a=0),a<0&&(a=G.value.length-1)):a=n?0:G.value.length-1;let l=G.value[a];l&&(Ti(a),Er({datapoint:l,seriesIndex:a,triggerMode:`keyboard`}))}function Ti(e){if(!Number.isFinite(e)||!vn.value)return;let t=G.value[e];if(!t)return;let n=t.x0+q(t)/2,r=t.y0+K(t)/2,i=vn.value.getBoundingClientRect();sn.value={x:i.left+(n-$.value.x)/$.value.width*i.width,y:i.top+(r-$.value.y)/$.value.height*i.height}}let Ei=p(()=>({headers:Or.value?.colNames??[],rows:Or.value?.body??[]})),Di=p(()=>z.value.color);return de({getData:kr,getImage:$r,generateCsv:Dr,generateImage:wn,generateSvg:si,generatePdf:Cn,hideSeries:Cr,showSeries:Sr,toggleTable:Ar,toggleTooltip:jr,toggleZoom:Mr,toggleAnnotator:Pr,toggleFullscreen:sr,resetZoom:Rr,copyAlt:xi}),(e,t)=>(x(),g(`div`,{ref_key:`treemapChart`,ref:Kt,class:Ue(`vue-data-ui-component vue-ui-treemap ${Wt.value?`vue-data-ui-wrapper-fullscreen`:``} ${N.value.useCssAnimation?``:`vue-ui-dna`}`),style:b(`font-family:${N.value.style.fontFamily};width:100%; ${N.value.responsive?`height: 100%;`:``} text-align:center;background:${z.value.backgroundColor}`),id:`treemap_${k.value}`,onMouseenter:t[3]||=()=>T(gn)(!0),onMouseleave:t[4]||=()=>T(gn)(!1)},[_(`div`,{id:`chart-instructions-${k.value}`,class:`sr-only`},[_(`p`,null,Je(N.value.a11y.translations.keyboardNavigation),1)],8,mt),Ei.value?.rows?.length?(x(),m(ke,{key:0,uid:k.value,head:Ei.value.headers,body:Ei.value.rows,notice:N.value.a11y.translations.tableAvailable,caption:N.value.a11y.translations.tableCaption},null,8,[`uid`,`head`,`body`,`notice`,`caption`])):h(``,!0),P.value.buttons.annotator?(x(),m(T(rt),{key:1,svgRef:T(vn),backgroundColor:z.value.backgroundColor,color:z.value.color,active:Nr.value,isCursorPointer:B.value,palette:P.value.annotatorPalette,onClose:Pr},Le({_:2},[Ke(T(be),t=>({name:t,fn:E(n=>[C(e.$slots,t,y(v(T(ye)(t,n))),void 0,!0)])}))]),1032,[`svgRef`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):h(``,!0),Tn.value?(x(),g(`div`,{key:2,ref_key:`noTitle`,ref:Xt,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},null,512)):h(``,!0),z.value.title.text?(x(),g(`div`,{key:3,ref_key:`chartTitle`,ref:qt,style:b(`width:100%;background:${z.value.backgroundColor};padding-bottom:6px`)},[(x(),m(he,{key:`title_${Zt.value}`,config:{title:{cy:`treemap-div-title`,...z.value.title},subtitle:{cy:`treemap-div-subtitle`,...z.value.title.subtitle}}},null,8,[`config`]))],4)):h(``,!0),_(`div`,{id:`legend-top-${k.value}`},null,8,ht),P.value.show&&ft.value&&(T(_n)||T(hn))?(x(),m(T(st),{ref_key:`userOptionsRef`,ref:rn,key:`user_option_${Gt.value}`,backgroundColor:z.value.backgroundColor,color:z.value.color,isPrinting:T(xn),isImaging:T(Sn),uid:k.value,hasTooltip:P.value.buttons.tooltip&&F.value.show,hasPdf:P.value.buttons.pdf,hasXls:P.value.buttons.csv,hasImg:P.value.buttons.img,hasSvg:P.value.buttons.svg,hasTable:P.value.buttons.table,hasFullscreen:P.value.buttons.fullscreen,hasAltCopy:P.value.buttons.altCopy,isFullscreen:Wt.value,isTooltip:V.value.showTooltip,titles:{...P.value.buttonTitles},chartElement:Kt.value,position:P.value.position,hasAnnotator:P.value.buttons.annotator,isAnnotation:Nr.value,callbacks:P.value.callbacks,printScale:P.value.print.scale,tableDialog:N.value.table.useDialog,isCursorPointer:B.value,hasZoom:P.value.buttons.zoom,isZoom:V.value.showZoom,onToggleFullscreen:sr,onGeneratePdf:T(Cn),onGenerateCsv:Dr,onGenerateImage:T(ci),onGenerateSvg:T(si),onToggleTable:Ar,onToggleTooltip:jr,onToggleAnnotator:Pr,onToggleZoom:Mr,onCopyAlt:xi,style:b({visibility:T(_n)?T(hn)?`visible`:`hidden`:`visible`})},Le({_:2},[Ke(T(xe)(e.$slots,`menuIcon optionTooltip optionPdf optionCsv optionImg optionSvg optionTable optionFullscreen optionAnnotator optionZoom optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:E(n=>[C(e.$slots,t,y(v(T(Se)(t,n))),void 0,!0)])}))]),1032,/* @__PURE__ */ `backgroundColor.color.isPrinting.isImaging.uid.hasTooltip.hasPdf.hasXls.hasImg.hasSvg.hasTable.hasFullscreen.hasAltCopy.isFullscreen.isTooltip.titles.chartElement.position.hasAnnotator.isAnnotation.callbacks.printScale.tableDialog.isCursorPointer.hasZoom.isZoom.onGeneratePdf.onGenerateImage.onGenerateSvg.style`.split(`.`))):h(``,!0),X.value.length>1?(x(),g(`nav`,{key:5,class:`vue-ui-treemap-breadcrumbs`,"data-dom-to-png-ignore":``,ref_key:`breadcrumbsNav`,ref:en},[(x(!0),g(Fe,null,Ke(X.value,(n,r)=>(x(),g(`span`,{role:`button`,tabindex:r<X.value.length-1?0:void 0,key:n.id||`root`,onClick:e=>r===X.value.length-1?()=>{}:mr(n.node),onKeydown:[$e(et(e=>r===X.value.length-1?void 0:mr(n.node),[`prevent`]),[`enter`]),$e(et(e=>r===X.value.length-1?void 0:mr(n.node),[`prevent`]),[`space`])],class:`vue-ui-treemap-crumb`,"data-last-crumb":r===X.value.length-1,style:b({color:z.value.color,cursor:B.value?`pointer`:`default`}),onMouseenter:e=>Zr(r),onMouseleave:Qr,onFocus:e=>Zr(r),onBlur:Qr},[_(`span`,_t,[_(`span`,vt,[C(e.$slots,`breadcrumb-label`,Ve({ref_for:!0},{crumb:n,isRoot:r===0,isFocus:Xr.value===r}),()=>[r===0?(x(),g(`div`,yt,[ze(me,{name:Xr.value===0?`homeFilled`:`home`,stroke:z.value.color},null,8,[`name`,`stroke`])])):(x(),g(Fe,{key:1},[Re(Je(n.label),1)],64))],!0)]),r<X.value.length-1?(x(),g(`span`,bt,[C(e.$slots,`breadcrumb-arrow`,{},()=>[t[5]||=Re(` › `,-1)],!0)])):h(``,!0)])],44,gt))),128))],512)):h(``,!0),_(`div`,xt,[(x(),g(`svg`,{ref_key:`svgRef`,ref:vn,xmlns:T(ie),"aria-describedby":`chart-instructions-${k.value}`,class:Ue({"vue-data-ui-fullscreen--on":Wt.value,"vue-data-ui-fulscreen--off":!Wt.value,"vue-data-ui-zoom-plus":!lr.value,"vue-data-ui-zoom-minus":lr.value,"vue-data-ui-no-transition":!T(un),loading:T(fn)}),viewBox:`${T($).x} ${T($).y} ${T($).width<=0?10:T($).width} ${T($).height<=0?10:T($).height}`,style:b(`max-width:100%; overflow:${Gr.value?`hidden`:`visible`}; background:transparent;color:${z.value.color}`),tabindex:`0`,onFocus:Si,onBlur:Ci,onKeydown:wi,onPointerdown:Kr,onPointermove:qr,onPointerup:Jr,onPointercancel:Jr,onPointerleave:Jr},[ze(T(ct)),C(e.$slots,`svg-underlayer`,y(v({svg:H.value,isZoom:lr.value,rect:Z.value,config:N.value,isPrintingImg:T(xn)||T(Sn)||T(ai),isPrintingSvg:T(oi)})),void 0,!0),(x(!0),g(Fe,null,Ke(G.value,(e,t)=>(x(),g(`g`,{key:`tgrad_${e.id}`},[R.value.rects.gradient.show?(x(),g(`defs`,Ct,[ze(De,{t:`radial`,id:`tgrad_${e.id}`,gradientTransform:`translate(-1, -1.000001) scale(2, 2)`,stops:[[`18%`,e.color,1],[`100%`,T(a)(e.color,R.value.rects.gradient.intensity/100),1]]},null,8,[`id`,`stops`])])):h(``,!0)]))),128)),_(`g`,null,[(x(!0),g(Fe,null,Ke(G.value,(e,t)=>(x(),g(`g`,{key:`rect_${e.id}_${e.depth}`},[_(`rect`,{x:e.x0,y:e.y0,height:K(e),width:q(e),fill:Vt.value?e.color??z.value.backgroundColor:R.value.rects.gradient.show?vr.value?z.value.backgroundColor:`url(#tgrad_${e.id})`:e.color??z.value.backgroundColor,rx:T(Vr)>1?bi(e)*Hr.value:bi(e),stroke:Z.value&&Z.value.id===e.id?R.value.rects.selected.stroke:R.value.rects.stroke,"stroke-width":Qn(e),onClick:et(n=>Yr(e,t),[`stop`]),onMouseenter:()=>Er({datapoint:e,seriesIndex:t,triggerMode:`pointer`}),onMouseleave:n=>wr({datapoint:e,seriesIndex:t}),style:b(`opacity:${Z.value?Z.value.id===e.id?1:R.value.rects.selected.unselectedOpacity:1}`),class:Ue([`vue-ui-treemap-rect`,T(un)?`vue-data-ui-transition`:``,hr(e)?`vue-data-ui-zoom-minus`:`vue-data-ui-zoom-plus`])},null,46,wt)]))),128)),(x(!0),g(Fe,null,Ke(gi.value,e=>(x(),g(`g`,{key:e.key,style:{"pointer-events":`none`}},[_(`defs`,null,[_(`clipPath`,{id:e.clipId,clipPathUnits:`userSpaceOnUse`},[_(`rect`,{class:Ue({"vue-data-ui-transition":T(un)}),x:e.clipX,y:e.clipY,width:e.clipWidth,height:e.clipHeight},null,10,Et)],8,Tt)]),_(`g`,{"clip-path":`url(#${e.clipId})`},[_(`g`,{transform:e.translate},[_(`g`,{class:Ue({"vue-data-ui-transition":T(un)}),transform:pi(e)},[(x(!0),g(Fe,null,Ke(e.lines,t=>(x(),g(Fe,{key:t.key},[t.text&&(e.alwaysShowAllLines||Ur.value<=t.maxZoomFactor)?(x(),g(`text`,{key:0,x:t.x,y:t.y,fill:t.fill,"font-size":t.fontSize,"font-family":t.fontFamily,"font-weight":t.fontWeight,class:Ue({"vue-data-ui-transition":T(un)}),"text-anchor":`start`,"dominant-baseline":`text-before-edge`},Je(t.text),11,At)):h(``,!0)],64))),128))],10,kt)],8,Ot)],8,Dt)]))),128)),e.$slots.rect?(x(),g(`g`,jt,[(x(!0),g(Fe,null,Ke(G.value,(t,n)=>(x(),g(`g`,{key:`slot_${t.id}_${t.depth}`},[(x(),g(`foreignObject`,{x:t.x0,y:t.y0,height:K(t),width:q(t),class:`vue-ui-treemap-cell-foreignObject`,style:{"pointer-events":`none`,overflow:`hidden`}},[_(`div`,Nt,[T(fn)?h(``,!0):C(e.$slots,`rect`,Ve({ref_for:!0},{rect:{...t,height:K(t),width:q(t),isSelected:!Z.value||Z.value.id===t.id},shouldShow:Yn(t)||lr.value,fontSize:or(t,n),isZoom:lr.value,textColor:T(re)(t.color)}),void 0,!0,0)])],8,Mt))]))),128))])):h(``,!0)]),C(e.$slots,`svg`,y(v({svg:H.value,isZoom:lr.value,rect:Z.value,config:N.value,isPrintingImg:T(xn)||T(Sn)||T(ai),isPrintingSvg:T(oi)})),void 0,!0)],46,St)),T(zr)?(x(),g(`div`,Pt,[C(e.$slots,`reset-action`,{reset:T(Rr)},()=>[_(`button`,{"data-cy-reset":``,tabindex:`0`,role:`button`,class:`vue-data-ui-refresh-button`,style:b({background:z.value.backgroundColor,cursor:B.value?`pointer`:`default`}),onClick:t[0]||=e=>T(Rr)(!0)},[ze(me,{name:`refresh`,stroke:z.value.color},null,8,[`stroke`])],4)],!0)])):h(``,!0),e.$slots.hint?(x(),g(`div`,Ft,[C(e.$slots,`hint`,y(v({hint:N.value.a11y.translations.keyboardNavigation,isVisible:ln.value})),void 0,!0)])):h(``,!0)]),e.$slots.watermark?(x(),g(`div`,It,[C(e.$slots,`watermark`,y(v({isPrinting:T(xn)||T(Sn)||T(ai)||T(oi)})),void 0,!0)])):h(``,!0),_(`div`,{id:`legend-bottom-${k.value}`},null,8,Lt),tn.value&&(I.value.show||e.$slots.legend)?(x(),m(Ie,{key:7,to:I.value.position===`top`?`#legend-top-${k.value}`:`#legend-bottom-${k.value}`},[_(`div`,{ref_key:`chartLegend`,ref:Jt},[C(e.$slots,`legend`,{legend:gr.value},()=>[I.value.show?(x(),m(Me,{key:`legend_${$t.value}`,legendSet:gr.value,config:_r.value,id:`treemap_legend_${k.value}`,isCursorPointer:B.value,onClickMarker:t[1]||=({legend:e})=>br(e)},{item:E(({legend:e,index:t})=>[T(fn)?h(``,!0):(x(),g(`div`,{key:0,onClick:t=>br(e),style:b(`opacity:${A.value.includes(e.id)?.5:1}`)},Je(e.display),13,Rt))]),legendToggle:E(()=>[gr.value.length>2&&I.value.selectAllToggle.show&&!T(fn)?(x(),m(Oe,{key:0,backgroundColor:I.value.selectAllToggle.backgroundColor,color:I.value.selectAllToggle.color,fontSize:I.value.fontSize,checked:A.value.length>0,isCursorPointer:B.value,onToggle:yr},null,8,[`backgroundColor`,`color`,`fontSize`,`checked`,`isCursorPointer`])):h(``,!0)]),_:1},8,[`legendSet`,`config`,`id`,`isCursorPointer`])):h(``,!0)],!0)],512)],8,[`to`])):h(``,!0),e.$slots.source?(x(),g(`div`,{key:8,ref_key:`source`,ref:Yt,dir:`auto`},[C(e.$slots,`source`,{},void 0,!0)],512)):h(``,!0),ze(T(ot),{teleportTo:F.value.teleportTo,show:V.value.showTooltip&&Ht.value,backgroundColor:F.value.backgroundColor,color:F.value.color,fontSize:F.value.fontSize,borderRadius:F.value.borderRadius,borderColor:F.value.borderColor,borderWidth:F.value.borderWidth,backgroundOpacity:F.value.backgroundOpacity,position:F.value.position,offsetX:F.value.offsetX,offsetY:F.value.offsetY,parent:Kt.value,content:Ut.value,isFullscreen:Wt.value,isCustom:T(i)(F.value.customFormat),smooth:F.value.smooth,backdropFilter:F.value.backdropFilter,smoothForce:F.value.smoothForce,smoothSnapThreshold:F.value.smoothSnapThreshold,isA11yMode:cn.value===`keyboard`,a11yPosition:sn.value},{"tooltip-before":E(()=>[C(e.$slots,`tooltip-before`,y(v({...Tr.value})),void 0,!0)]),tooltip:E(()=>[C(e.$slots,`tooltip`,y(v({...Tr.value})),void 0,!0)]),"tooltip-after":E(()=>[C(e.$slots,`tooltip-after`,y(v({...Tr.value})),void 0,!0)]),_:3},8,[`teleportTo`,`show`,`backgroundColor`,`color`,`fontSize`,`borderRadius`,`borderColor`,`borderWidth`,`backgroundOpacity`,`position`,`offsetX`,`offsetY`,`parent`,`content`,`isFullscreen`,`isCustom`,`smooth`,`backdropFilter`,`smoothForce`,`smoothSnapThreshold`,`isA11yMode`,`a11yPosition`]),ft.value&&P.value.buttons.table?(x(),m(qe(ei.value.component),Ve({key:9},ei.value.props,{ref_key:`tableUnit`,ref:nn,onClose:ti}),Le({content:E(()=>[(x(),m(T(nt),{key:`table_${Qt.value}`,colNames:Or.value.colNames,head:Or.value.head,body:Or.value.body,config:Or.value.config,title:N.value.table.useDialog?``:ei.value.title,withCloseButton:!N.value.table.useDialog,isCursorPointer:B.value,onClose:ti},{th:E(({th:e})=>[_(`div`,zt,Je(e),1)]),td:E(({td:e})=>[Re(Je(e.name||e),1)]),_:1},8,[`colNames`,`head`,`body`,`config`,`title`,`withCloseButton`,`isCursorPointer`]))]),_:2},[N.value.table.useDialog?{name:`title`,fn:E(()=>[Re(Je(ei.value.title),1)]),key:`0`}:void 0,N.value.table.useDialog?{name:`actions`,fn:E(()=>[_(`button`,{tabindex:`0`,class:`vue-ui-user-options-button`,onClick:t[2]||=e=>Dr(P.value.callbacks.csv),style:b({cursor:B.value?`pointer`:`default`})},[ze(me,{name:`fileCsv`,stroke:ei.value.props.color},null,8,[`stroke`])],4)]),key:`1`}:void 0]),1040)):h(``,!0),C(e.$slots,`skeleton`,{},()=>[T(fn)?(x(),m(ce,{key:0})):h(``,!0)],!0)],46,pt))}},[[`__scopeId`,`data-v-7d98932d`]]);export{ft as n,Vt as t};
|
|
1
|
+
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useConfig-6jO1fkp5.js";import{$ as n,D as r,Dt as i,Ft as a,Ht as o,S as s,X as c,Zt as l,at as u,et as d,i as f,in as ee,nt as te,pt as ne,r as re,t as ie,w as ae,zt as oe}from"./lib-rPeBMZrn.js";import{n as se,t as ce}from"./BaseScanner-8NdoBs7B.js";import{n as le,t as ue}from"./useHints-C-TwxM0Y.js";import{t as de}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as fe}from"./resolveChartConfig-CIhClE5R.js";import{t as pe}from"./chartImage-DPGnEuYM.js";import{t as me}from"./BaseIcon-Cm-IJ179.js";import{n as he}from"./Title-BliHuXfT.js";import{t as ge}from"./useChartExport-BZts4KFb.js";import{n as _e,t as ve}from"./tableIntegration-CNoJ1CIY.js";import{n as ye,t as be}from"./annotationSlots-BRR85CqJ.js";import{n as xe,t as Se}from"./userOptionsSlots-DYuo-E5m.js";import{t as Ce}from"./usePrinter-DVf3YcG5.js";import{t as we}from"./useTransitions-ChGGrtrv.js";import{c as Te}from"./canvas-lib-22VpOI4_.js";import{t as Ee}from"./useResponsive-CENUxfEL.js";import{t as De}from"./DefGrad-DKMq1REY.js";import{t as Oe}from"./BaseLegendToggle-Q3TiW9u1.js";import{t as ke}from"./A11yDataTable-DWNlWXzs.js";import{t as Ae}from"./useUserOptionState-CXlFnwPv.js";import{t as je}from"./useChartAccessibility-DOMuYJfm.js";import{t as Me}from"./Legend-DM0ClX3D.js";import{t as Ne}from"./usePanZoom-BdjP5Suc.js";import{t as Pe}from"./vue_ui_treemap-Bv4Rdl5_.js";import{Fragment as Fe,Teleport as Ie,computed as p,createBlock as m,createCommentVNode as h,createElementBlock as g,createElementVNode as _,createSlots as Le,createTextVNode as Re,createVNode as ze,defineAsyncComponent as Be,guardReactiveProps as v,mergeProps as Ve,nextTick as He,normalizeClass as Ue,normalizeProps as y,normalizeStyle as b,onBeforeUnmount as We,onMounted as Ge,openBlock as x,ref as S,renderList as Ke,renderSlot as C,resolveDynamicComponent as qe,shallowRef as w,toDisplayString as Je,toRefs as Ye,unref as T,useCssVars as Xe,useSlots as Ze,watch as Qe,withCtx as E,withKeys as $e,withModifiers as et}from"vue";function tt(e,t){let n=e.length;if(n===0)throw Error(`Max aspect ratio cannot be computed: ${e} is an empty array`);{let r=1/0,i=-1/0,a=0;for(let t=0;t<n;t+=1){let n=e[t].normalizedValue;n<r&&(r=n),n>i&&(i=n),a+=n}return Math.max(t**2*i/a**2,a**2/(t**2*r))}}function nt(e){let{xOffset:t,yOffset:n,width:r,height:i}=e;return{x0:t,y0:n,x1:t+r,y1:n+i}}function rt(e,t,n){if(e.length===0)return!0;{let r=e.concat(t);return tt(e,n)>=tt(r,n)}}function it(e){let t=[],n=e.length;for(let r=0;r<n;r+=1){let n=e[r],i=n.length;for(let e=0;e<i;e+=1)t.push(n[e])}return t}function at(e,t){return O({...t,children:e})}function ot(e){return(e.x1-e.x0)*(e.y1-e.y0)}function st(e,t){let{width:n,height:r,xOffset:i,yOffset:a}=ut(t),o=e.length,s=e.map(e=>e.normalizedValue||0).reduce((e,t)=>e+t,0),c=s/r,l=s/n,u=i,d=a,f=[];if(n>=r){for(let t=0;t<o;t+=1){let n=e[t],r=d+n.normalizedValue/c,i={x0:u,y0:d,x1:u+c,y1:r},a=Object.assign({},n,i);d=r,f.push(a)}return f}for(let t=0;t<o;t+=1){let n=e[t],r=u+n.normalizedValue/l,i={x0:u,y0:d,x1:r,y1:d+l},a=Object.assign({},n,i);u=r,f.push(a)}return f}function ct(e){let t=ut(e),n=t.width,r=t.height;return Math.min(n,r)}function lt(e,t){let n=e.length,r=t/e.map(e=>e.value??0).reduce((e,t)=>e+t,0),i=[],a,o;for(let t=0;t<n;t+=1)o=e[t],a=Object.assign({},o,{normalizedValue:o.value*(r||0)}),i.push(a);return i}function ut(e){let{x0:t,y0:n,x1:r,y1:i}=e;return{xOffset:t,yOffset:n,width:r-t,height:i-n}}function D(e,t,n,r){let i=e,a=t,o=n,s=r;for(;;){let e=i.length;if(e===0){let e=st(a,o);return s.concat(e)}let t=ct(o),n=i[0],r=i.slice(1,e);if(rt(a,n,t)){let e=a.concat(n);i=r,a=e,o=o,s=s}else{let e=a.length,t=0;for(let n=0;n<e;n+=1)t+=a[n].normalizedValue;let n=dt(o,t),r=st(a,o),c=s.concat(r);i=i,a=[],o=n,s=c}}}function O(e){if(e.children===void 0||!e.children.length)return[e];{let t=D(lt(e.children,ot(e)),[],e,[]),n=t.length,r=[];for(let e=0;e<n;e+=1)r.push(O(t[e]));return it(r)}}function dt(e,t){let{width:n,height:r,xOffset:i,yOffset:a}=ut(e);if(n>=r){let e=t/r,o=n-e;return nt({xOffset:i+e,yOffset:a,width:o,height:r})}{let e=t/n,o=r-e;return nt({xOffset:i,yOffset:a+e,width:n,height:o})}}var ft=/* @__PURE__ */ e({default:()=>Vt}),pt=[`id`],mt=[`id`],ht=[`id`],gt=[`tabindex`,`onClick`,`onKeydown`,`data-last-crumb`,`onMouseenter`,`onFocus`],_t={class:`vue-ui-treemap-crumb-unit`},vt={class:`vue-ui-treemap-crumb-unit-label`},yt={key:0,style:{width:`24px`,display:`flex`,"align-items":`center`}},bt={key:0,class:`vue-ui-treemap-crumb-unit-arrow`},xt={style:{position:`relative`}},St=[`xmlns`,`aria-describedby`,`viewBox`],Ct={key:0},wt=[`x`,`y`,`height`,`width`,`fill`,`rx`,`stroke`,`stroke-width`,`onClick`,`onMouseenter`,`onMouseleave`],Tt=[`id`],Et=[`x`,`y`,`width`,`height`],Dt=[`clip-path`],Ot=[`transform`],kt=[`transform`],At=[`x`,`y`,`fill`,`font-size`,`font-family`,`font-weight`],jt={key:0},Mt=[`x`,`y`,`height`,`width`],Nt={style:{width:`100%`,height:`100%`,overflow:`hidden`},class:`vue-ui-treemap-cell`},Pt={key:0,"data-dom-to-png-ignore":``,class:`reset-wrapper`},Ft={key:1,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},It={key:6,class:`vue-data-ui-watermark`},Lt=[`id`],Rt=[`onClick`],zt={style:{display:`flex`,"align-items":`center`}},Bt=4,Vt=/*#__PURE__*/ de({__name:`vue-ui-treemap`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`selectLegend`,`selectDatapoint`,`copyAlt`],setup(e,{expose:de,emit:tt}){Xe(e=>({v206eec08:Di.value}));let nt=Be(()=>import(`./DataTable-0Vv-aGHD.js`)),rt=Be(()=>import(`./PenAndPaper-BGEp-TUm.js`).then(e=>e.t)),it=Be(()=>import(`./vue-ui-accordion-S3nRtTU-.js`).then(e=>e.n)),ot=Be(()=>import(`./Tooltip-C1q0Qoh7.js`)),st=Be(()=>import(`./UserOptions-uWHV_zPB.js`).then(e=>e.n)),ct=Be(()=>import(`./PackageVersion-DhptF5oD.js`).then(e=>e.t)),lt=Be(()=>import(`./BaseDraggableDialog-DHgIPVmz.js`).then(e=>e.n)),{vue_ui_treemap:ut}=t(),D=e,O=tt,dt=Ze(),ft=p(()=>!!D.dataset&&D.dataset.length),Vt=p(()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent)),k=S(c()),Ht=S(!1),Ut=S(``),Wt=S(!1),Gt=S(0),A=S([]),Kt=w(null),qt=w(null),Jt=w(null),Yt=w(null),Xt=w(null),Zt=S(0),Qt=S(0),$t=S(0),j=S([]),en=S(null),tn=S(!1),nn=S(null),rn=S(null),an=S(null),on=S(/* @__PURE__ */ new Map),M=S(null),sn=S({x:0,y:0}),cn=S(`pointer`),ln=S(!1),N=S(yn()),P=p(()=>N.value.userOptions),F=p(()=>N.value.style.chart.tooltip),I=p(()=>N.value.style.chart.legend),L=p(()=>N.value.style.chart.layout.labels),R=p(()=>N.value.style.chart.layout),z=p(()=>N.value.style.chart);le({config:()=>N.value,dataset:()=>D.dataset,component:`VueUiTreemap`,rules:[ue.emptyArray,{test:e=>e.length===1&&e[0]?.children&&e[0].children.length<6&&e[0].children.length>0||e.flatMap(e=>e?.children?.length??0).reduce((e,t)=>e+t,0)<6,message:[`👀 The number of data points is < 6. Consider:`,``,`▶️ Using another type of chart instead to better show proportions: VueUiDonut, VueUiWaffle`]},{test:e=>e.length===1&&e[0]?.children&&e[0].children.length===0,message:[`👀 There is a series defined in the dataset but it has no children items.`,``,`▶️ Add children items to your series.`]}]});let{transitionEnabled:un}=we({config:()=>N.value.transitions,dataset:()=>D.dataset}),B=p(()=>N.value.userOptions.useCursorPointer),dn=p(()=>ee({defaultConfig:{userOptions:{show:!1},style:{chart:{backgroundColor:`#999999`,layout:{labels:{showDefaultLabels:!1},rects:{stroke:`#6A6A6A`}},legend:{backgroundColor:`transparent`}}}},userConfig:N.value.skeletonConfig??{}})),{loading:fn,FINAL_DATASET:pn,manualLoading:mn}=se({...Ye(D),FINAL_CONFIG:N,prepareConfig:yn,skeletonDataset:D.config?.skeletonDataset??[{name:`_`,value:53,color:`#CACACA90`,children:[{name:`_`,value:21},{name:`_`,value:13},{name:`_`,value:8},{name:`_`,value:5},{name:`_`,value:3},{name:`_`,value:2},{name:`_`,value:1}]}],skeletonConfig:ee({defaultConfig:N.value,userConfig:dn.value})}),{userOptionsVisible:hn,setUserOptionsVisibility:gn,keepUserOptionState:_n}=Ae({config:N.value}),{svgRef:vn}=je({config:z.value.title});function yn(){return fe(D.config,ut,Pe)}let bn=l(D.config);Qe(()=>D.config,(e,t)=>{let n=l(e),r=n!==bn;bn=n;let i=yn();r?(fn.value||(N.value=i),hn.value=!N.value.userOptions.showOnChartHover,Zt.value+=1,Qt.value+=1,$t.value+=1,V.value.showTable=N.value.table.show,V.value.showTooltip=F.value.show,V.value.showZoom=z.value.zoom?.show??!1):(N.value.style.chart.tooltip=i.style.chart.tooltip,V.value.showTooltip=N.value.style.chart.tooltip.show)},{deep:!0});let{isPrinting:xn,isImaging:Sn,generatePdf:Cn,generateImage:wn}=Ce({elementId:`treemap_${k.value}`,fileName:z.value.title.text||`vue-ui-treemap`,options:N.value.userOptions.print}),Tn=p(()=>N.value.userOptions.show&&!z.value.title.text),En=p(()=>ae(N.value.customPalette)),V=S({showTable:N.value.table.show,showTooltip:F.value.show,showZoom:z.value.zoom?.show??!1});Qe(N,()=>{V.value={showTable:N.value.table.show,showTooltip:F.value.show,showZoom:z.value.zoom?.show??!1}},{immediate:!0});let Dn=S({height:z.value.height,width:z.value.width});function On(e){let t=Kt.value,n=Dn.value.height;return!t||!n?e:e*(n/t.getBoundingClientRect().height)}function kn(){if(!en.value||X.value.length<=1)return 0;let e=en.value,t=getComputedStyle(e);return On(e.offsetHeight+parseFloat(t.marginTop||`0`)+parseFloat(t.marginBottom||`0`)+parseFloat(t.paddingTop||`0`)+parseFloat(t.paddingBottom||`0`))}let H=p(()=>{let e=z.value.padding,t=Dn.value.width,n=Dn.value.height,r=kn(),i=e.left,a=t-e.right,o=e.top,s=n-e.bottom-r;return{left:i,top:o,right:a,bottom:s,width:a-i,height:Math.max(0,s-o),vbWidth:t,vbHeight:n-r,offsetY:r}}),U=S(d(pn.value)),W=S(U.value),An=w(/* @__PURE__ */ new Map);Qe([U,()=>N.value],()=>{an.value=null,on.value=/* @__PURE__ */ new Map},{deep:!0}),Qe(()=>A.value,()=>{an.value=null,on.value=/* @__PURE__ */ new Map,Pn(),$t.value+=1,Qt.value+=1},{deep:!0}),Qe([()=>Dn.value.width,()=>Dn.value.height],()=>{on.value=/* @__PURE__ */ new Map});function jn(e){Array.isArray(e)&&e.forEach((e,t)=>{e.id||=c(),e.sourceColor===void 0&&(e.sourceColor=s(e.color)||null);let n=e.sourceColor||An.value.get(e.id)||En.value[t]||o[t]||o[t%o.length];n=s(n),An.value.set(e.id,n),e.color=n,Mn(e,n)})}function Mn(e,t){Array.isArray(e.children)&&e.children.forEach(n=>{n.id||=c(),n.parentId=e.id,n.sourceColor===void 0&&(n.sourceColor=s(n.color)||null);let r=n.sourceColor||t;n.color=r,Mn(n,r)})}function Nn(e){let t=Y(e);for(;t?.parentId;)t=Y(t.parentId);return t?.id??null}function Pn(){let e=U.value.filter(e=>!A.value.includes(e.id));if(!j.value.length){W.value=e;return}let t=j.value[j.value.length-1],n=Y(t);if(!n){j.value=[],W.value=e;return}let r=Nn(n.id);r&&A.value.includes(r)?(j.value=[],W.value=e):W.value=[n]}Qe(()=>pn.value,()=>{U.value=d(pn.value),jn(U.value),Pn(),$t.value+=1,Qt.value+=1},{deep:!0,immediate:!0,flush:`post`});let Fn=w(null),In=w(null);Ge(()=>{tn.value=!0,Rn()});let Ln=p(()=>N.value.debug);Ge(()=>{dt[`chart-background`]&&Ln.value&&console.warn(`VueUiTreemap does not support the #chart-background slot.`)});function Rn(){if(oe(D.dataset)&&u({componentName:`VueUiTreemap`,type:`dataset`,debug:Ln.value}),jn(U.value),oe(D.dataset)||(mn.value=N.value.loading),N.value.responsive){let e=Te(()=>{let{width:e,height:t}=Ee({chart:Kt.value,title:z.value.title.text?qt.value:null,legend:I.value.show?Jt.value:null,source:Yt.value,noTitle:Xt.value});requestAnimationFrame(()=>{Dn.value.width=e,Dn.value.height=t-12})});Fn.value&&(In.value&&Fn.value.unobserve(In.value),Fn.value.disconnect()),Fn.value=new ResizeObserver(e),In.value=Kt.value.parentNode,Fn.value.observe(In.value)}}We(()=>{Fn.value&&(In.value&&Fn.value.unobserve(In.value),Fn.value.disconnect())});let zn=p(()=>W.value.map((e,t)=>({...e,color:s(e.color)||En.value[t]||o[t]||o[t%o.length]})).filter(e=>!A.value.includes(e.id))),Bn=p(()=>U.value.filter(e=>!A.value.includes(e.id)).map(e=>e.value||0).reduce((e,t)=>e+t,0)),Vn=p({get(){let e=[...zn.value];return R.value.sorted&&(e=[...zn.value].sort((e,t)=>t.value-e.value)),e.map(e=>({...e}))},set(e){return e}});function Hn(e,t){return e.value/t}function Un(e,t,n){let r=R.value.rects.colorRatio-Hn(t,n);return a(e,r<0?0:r)}function Wn(e){return Array.isArray(e.children)&&e.children.length>0}function Gn(e){return[...e].sort((e,t)=>{let n=Wn(e),r=Wn(t);if(n!==r)return n-r;let i=Number(e.value)||0;return(Number(t.value)||0)-i})}function Kn(e,t,n,r,i){return Gn(e).map((e,a)=>{let c=e.sourceColor||s(e.color)||s(t)||En.value[a]||o[a]||o[a%o.length],l=e.sourceColor?e.sourceColor:Un(c,e,r),u=Hn(e,r),d=i??e.parentId??e.id,f=Array.isArray(e.children)&&e.children.length&&e.children.reduce((e,t)=>e+(Number(t.value)||0),0)||1;return{...e,color:l,proportion:u,parentName:n,rootId:d,children:Array.isArray(e.children)&&e.children.length?Kn(e.children,c,e.name,f,d):void 0}})}function qn(e){let t=or(e),n=Jn(e),r=t*.55,i=t*.55,a=t*1.05,o=t*1.05,s=t*.35,c=n?a+o+s:t*.45,l=e.x0+r,u=e.x1-r,d=e.y0+c,f=e.y1-i;return u<=l||f<=d?null:{x0:l,y0:d,x1:u,y1:f}}function Jn(e){return L.value.hideUnderProportion===0||Yn(e)}function Yn(e){let t=Number(L.value.hideUnderProportion);return!Number.isFinite(t)||t<=0||e.proportion>t}function Xn(e,t,n=0,r=null){if(!Array.isArray(e)||!e.length)return[];let i=e.map(e=>{let{children:t,...n}=e;return{...n}}),a=new Map(e.map(e=>[e.id,Array.isArray(e.children)?e.children:[]])),o=new Map(e.map(e=>[e.id,e])),s=at(i,t),c=[];for(let e of s){let t=a.get(e.id)||[],i=o.get(e.id),s={...e,depth:n,parentId:r??e.parentId??null,color:i?.color??e.color??null,children:t,isVisibleNode:!0,showLabel:Jn(e)};if(c.push(s),t.length){let r=qn(s);r&&c.push(...Xn(t,r,n+1,e.id))}}return c}let Zn=p(()=>{let e=W.value.length?W.value:Vn.value,t=e.map(e=>Number(e.value)||0).reduce((e,t)=>e+t,0)||1;return Xn(e.map((e,n)=>{let r=e.children?e.children.reduce((e,t)=>e+(Number(t.value)||0),0):e.value,{children:i,...a}=e,l=e.sourceColor||s(e.color)||An.value.get(e.id)||En.value[n]||o[n]||o[n%o.length],u=e.sourceColor?e.sourceColor:Un(l,e,t);return{...a,id:e.id||c(),parentId:e.parentId??null,name:e.name,value:e.value,color:u,proportion:(Number(e.value)||0)/t,children:Array.isArray(e.children)&&e.children.length?Kn(e.children,l,e.name,r||1):void 0}}),{x0:H.value.left,y0:H.value.top,x1:H.value.left+H.value.width,y1:H.value.top+H.value.height})}),G=p(()=>Zn.value);function Qn(e){return(Z.value&&Z.value.id===e.id?R.value.rects.selected.strokeWidth:R.value.rects.strokeWidth)*Hr.value}function K({y0:e,y1:t}){return t-e<=0?1e-4:Math.round((t-e)*1e4)/1e4}function q({x0:e,x1:t}){return t-e<=0?1e-4:Math.round((t-e)*1e4)/1e4}function $n(){let e=L.value,t=Number(e.minFontSize),n=Number(e.fontSize),r=Math.max(0,Math.min(Number.isFinite(t)?t:0,Number.isFinite(n)?n:0));return{lowerBound:r,upperBound:Math.max(r,Number.isFinite(n)?n:r)}}function er(e){let t=Math.min(4,Math.max(e*.25,.5));return{paddingX:t,paddingTop:t}}function tr(e,t){let{paddingX:n,paddingTop:r}=er(t),i=t*1.1;return{x:e.x0+n,y:e.y0+r,width:Math.max(q(e)-n*2,0),height:Math.max(K(e)-r*2,0),lineHeight:i}}function nr(e,t){return f(L.value.formatter,e.value,n({p:L.value.prefix,v:e.value,s:L.value.suffix,r:F.value.roundingValue}),{datapoint:e,seriesIndex:t})}function rr(e,t){let n=nr(e,t);return Array.isArray(e.children)&&e.children.length?[`${e.name} (${n})`]:[`${e.name}`,n].filter(e=>`${e}`.length)}function ir(e,t,n){let r=rr(e,n),i=tr(e,t);return!r.length||i.width<=0||i.height<=0||r.length*i.lineHeight>i.height?!1:r.every((e,n)=>yi(e,t,n===0?500:400)<=i.width)}function ar(e,t,n,r){let i=rr(e,t),a=Math.max(1,...i.map(e=>String(e).length)),o=Math.min(18,Math.max(10,Math.ceil(a*.7))),s=Math.max(1,i.length),c=Math.max(q(e)-1,1e-4),l=Math.max(K(e)-1,1e-4),u=c/(o*.58),d=l/(s*1.35);return Math.max(n,Math.min(r,u,d))}function or(e,t){let{lowerBound:n,upperBound:r}=$n(),i=Math.max(1e-4,Math.min(q(e),K(e))),a=Math.max(n,Math.min(r,i*.9)),o=Math.min(a,ar(e,t,n,r));if(ir(e,o,t)||!ir(e,n,t))return o;let s=n,c=o,l=n;for(let n=0;n<8;n+=1){let n=(s+c)/2;ir(e,n,t)?(l=n,s=n):c=n}let u=Math.max(n,o*.7);return l>=u?l:o}function sr(e){Wt.value=e,Gt.value+=1}let J=p(()=>({x:0,y:0,width:H.value.vbWidth,height:H.value.vbHeight}));function Y(e,t=U.value){for(let n of t){if(n.id===e)return n;if(n.children){let t=Y(e,n.children);if(t)return t}}return null}function cr(e){let t=[],n=Y(e);for(;n&&n.parentId;){let e=Y(n.parentId);if(!e)break;t.unshift(e.id),n=e}return t}let lr=p(()=>j.value.length>0);function ur(){W.value=U.value.slice(),j.value=[],O(`selectDatapoint`,void 0)}function dr(){return j.value[j.value.length-1]??null}function fr(e,t,n){j.value=[...cr(e.id),e.id],W.value=[e],N.value.events.datapointClick&&N.value.events.datapointClick({datapoint:t??e,seriesIndex:n}),O(`selectDatapoint`,t??e)}function pr(e,t){let n=dr();if(!n){ur();return}let r=Y(n);if(!r?.parentId){N.value.events.datapointClick&&N.value.events.datapointClick({datapoint:e,seriesIndex:t}),ur();return}let i=Y(r.parentId);i?(j.value=[...cr(i.id),i.id],W.value=[i],N.value.events.datapointClick&&N.value.events.datapointClick({datapoint:e,seriesIndex:t}),O(`selectDatapoint`,e)):ur()}function mr(e,t){if(!e){ur();return}let n=Y(e.id);n&&(dr()===n.id?pr(e,t):fr(n,e,t))}function hr(e){return e?dr()===e.id:!1}let X=p(()=>{let e=[{id:null,label:`All`}];if(j.value.length>0){let t=Y(j.value[j.value.length-1]),n=[];for(;t;)n.unshift(t),t=t.parentId?Y(t.parentId):null;for(let t of n)e.push({id:t.id,label:t.name,node:t})}return e}),Z=w(null),gr=p(()=>U.value.map((e,t)=>({...e,color:s(e.color)||En.value[t]||o[t]||o[t%o.length],shape:`square`})).sort((e,t)=>t.value-e.value).map((e,t)=>{let r=e.value/U.value.map(e=>e.value).reduce((e,t)=>e+t,0);return{...e,proportion:r,isSegregated:A.value.includes(e.id),segregate:()=>br(e),opacity:A.value.includes(e.id)?.5:1,display:`${e.name}${I.value.showPercentage||I.value.showValue?`: `:``}${I.value.showValue?f(L.value.formatter,e.value,n({p:L.value.prefix,v:e.value,s:L.value.suffix,r:I.value.roundingValue}),{datapoint:e}):``}${I.value.showPercentage?A.value.includes(e.id)?`${I.value.showValue?` (`:``}- %${I.value.showValue?`)`:``}`:`${I.value.showValue?` (`:``}${isNaN(e.value/Bn.value)?`-`:(e.value/Bn.value*100).toFixed(I.value.roundingPercentage)}%${I.value.showValue?`)`:``}`:``}`}})),_r=p(()=>({cy:`treemap-div-legend`,backgroundColor:I.value.backgroundColor,color:I.value.color,fontSize:I.value.fontSize,paddingBottom:12,fontWeight:I.value.bold?`bold`:``})),vr=p(()=>A.value.length===gr.value.length);function yr(){A.value.length?A.value=[]:gr.value.forEach(e=>{A.value.push(e.id)}),O(`selectLegend`,U.value.filter(e=>!A.value.includes(e.id)))}function br(e){Z.value=null,A.value.includes(e.id)?A.value=A.value.filter(t=>t!==e.id):A.value.length<D.dataset.length-1&&A.value.push(e.id),O(`selectLegend`,U.value.filter(e=>!A.value.includes(e.id)))}function xr(e){return U.value.length?U.value.find(t=>t.name===e)||(Ln.value&&console.warn(`VueUiTreemap - Series name not found "${e}"`),null):(Ln.value&&console.warn(`VueUiTreemap - There are no series to show.`),null)}function Sr(e){let t=xr(e);t!==null&&A.value.includes(t.id)&&br({id:t.id})}function Cr(e){let t=xr(e);t!==null&&(A.value.includes(t.id)||br({id:t.id}))}function wr({datapoint:e,seriesIndex:t}){Z.value=null,Ht.value=!1,M.value=null,cn.value=`pointer`,N.value.events.datapointLeave&&N.value.events.datapointLeave({datapoint:e,seriesIndex:t})}let Tr=S(null);function Er({datapoint:e,seriesIndex:t,triggerMode:r=`pointer`}){if(vr.value||r===`pointer`&&Ir.value)return;N.value.events.datapointEnter&&N.value.events.datapointEnter({datapoint:e,seriesIndex:t}),M.value=t,cn.value=r,Z.value=e,Tr.value={datapoint:e,seriesIndex:t,config:N.value,series:zn.value};let a=F.value.customFormat;if(i(a)&&ne(()=>a({seriesIndex:t,datapoint:e,series:zn.value,config:N.value})))Ut.value=a({seriesIndex:t,datapoint:e,series:zn.value,config:N.value});else{let r=``;r+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${F.value.borderColor};padding-bottom:6px;margin-bottom:3px;">${e.name}</div>`,r+=`<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 12 12" height="14" width="14"><rect x="0" y="0" height="12" width="12" stroke="none" fill="${e.color}"/></svg>`,r+=`<b>${f(L.value.formatter,e.value,n({p:L.value.prefix,v:e.value,s:L.value.suffix,r:F.value.roundingValue}),{datapoint:e,seriesIndex:t})}</b>`,Ut.value=`<div>${r}</div>`}Ht.value=!0}let Q=p(()=>({head:G.value.map(e=>({name:e.name,color:e.color})),body:G.value.map(e=>e.value)}));function Dr(e=null){He(()=>{let t=Q.value.head.map((e,t)=>[[e.name],[Q.value.body[t]],[isNaN(Q.value.body[t]/Bn.value)?`-`:Q.value.body[t]/Bn.value*100]]),n=[[z.value.title.text],[z.value.title.subtitle.text],[[``],[`val`],[`%`]]].concat(t),i=r(n);e?e(i):te({csvContent:i,title:z.value.title.text||`vue-ui-treemap`})})}let Or=p(()=>{let e=[N.value.table.columnNames.series,N.value.table.columnNames.value,N.value.table.columnNames.percentage],t=Q.value.head.map((e,t)=>{let r=f(L.value.formatter,Q.value.body[t],n({p:L.value.prefix,v:Q.value.body[t],s:L.value.suffix,r:N.value.table.td.roundingValue}));return[{color:e.color,name:e.name,shape:`square`},r,isNaN(Q.value.body[t]/Bn.value)?`-`:n({v:Q.value.body[t]/Bn.value*100,s:`%`,r:N.value.table.td.roundingPercentage})]}),r={th:{backgroundColor:N.value.table.th.backgroundColor,color:N.value.table.th.color,outline:N.value.table.th.outline},td:{backgroundColor:N.value.table.td.backgroundColor,color:N.value.table.td.color,outline:N.value.table.td.outline},breakpoint:N.value.table.responsiveBreakpoint};return{colNames:[N.value.table.columnNames.series,N.value.table.columnNames.value],head:e,body:t,config:r}});function kr(){return G.value}function Ar(){V.value.showTable=!V.value.showTable}function jr(){V.value.showTooltip=!V.value.showTooltip}function Mr(){V.value.showZoom=!V.value.showZoom}let Nr=S(!1);function Pr(){Nr.value=!Nr.value}let Fr=p(()=>!Nr.value&&V.value.showZoom),Ir=S(null),Lr=S(!1),{viewBox:$,resetZoom:Rr,isZoom:zr,setInitialViewBox:Br,scale:Vr}=Ne(vn,{x:J.value.x,y:J.value.y,width:Math.max(10,J.value.width),height:Math.max(10,J.value.height)},1,Fr),Hr=p(()=>1/Vr.value),Ur=p(()=>Math.min(1,L.value.fontSizeZoomFactor/Math.max(Vr.value,1e-4))),Wr=p(()=>`scale(${Ur.value})`),Gr=p(()=>V.value.showZoom||zr.value);Qe([()=>J.value.x,()=>J.value.y,()=>J.value.width,()=>J.value.height],()=>{He(()=>{Br({x:J.value.x,y:J.value.y,width:Math.max(10,J.value.width),height:Math.max(10,J.value.height)})})},{immediate:!0});function Kr(e){Fr.value&&(e.button===void 0||e.button===0)&&(Ir.value={x:e.clientX,y:e.clientY},Lr.value=!1)}function qr(e){if(!Fr.value||!Ir.value)return;let t=e.clientX-Ir.value.x,n=e.clientY-Ir.value.y;Math.hypot(t,n)>Bt&&(Lr.value=!0)}function Jr(){Ir.value=null,Lr.value&&window.setTimeout(()=>{Lr.value=!1},0)}function Yr(e,t){Lr.value||mr(e,t)}let Xr=S(null);function Zr(e){Xr.value=e}function Qr(){Xr.value=null}let $r=pe(Kt,()=>z.value.title.text),ei=p(()=>ve({config:N,style:z,mutableConfig:V,dialog:lt,accordion:it,isFullscreen:Wt,parent:Kt,maxWidth:800,isCursorPointer:B}));Qe(()=>V.value.showTable,e=>_e(e,N,nn));function ti(){V.value.showTable=!1,rn.value&&rn.value.setTableIconState(!1)}let ni=p(()=>gr.value.map(e=>({...e,name:e.display}))),ri=p(()=>z.value.backgroundColor),ii=p(()=>z.value.title),{isCallbackImaging:ai,isCallbackSvg:oi,generateSvg:si,onGenerateImage:ci}=ge({svg:vn,title:ii,legend:I,legendItems:ni,backgroundColor:ri,getSvgCallback:()=>N.value.userOptions.callbacks.svg,generateImage:wn});function li(e,t){let n=or(e,t),{paddingX:r,paddingTop:i}=er(n);return{fontSize:n,paddingX:r,paddingTop:i,lineHeight:n*1.1}}function ui(e){return re(e.color??z.value.backgroundColor)}function di({availableHeight:e,lineHeight:t,lineIndex:n}){if(n===0)return 1/0;let r=e/(n+1);return r<1e-4?-1/0:t<=0?1/0:r/t}function fi(){return Number(L.value.hideUnderProportion)===0}function pi(e){let t=Ur.value;return e.alwaysShowAllLines?`scale(${Math.min(t,e.allLinesScaleCap)})`:Wr.value}function mi({rect:e,seriesIndex:t}){if(!e||!L.value.showDefaultLabels||!Jn(e))return null;let{fontSize:n,paddingX:r,paddingTop:i,lineHeight:a}=li(e,t),o=ui(e),s=rr(e,t).map(e=>String(e??``)),c=tr(e,n);if(!s.some(Boolean)||c.width<=0||c.height<=0)return null;let l=fi(),u=l?Math.max(1e-4,Math.min(1,c.height/Math.max(s.length*a,1e-4))):1,d=`treemap_clip_${k.value}_${e.id}`,f=e.x0,ee=e.y0,te=Math.max(q(e),0),ne=Math.max(K(e),0);return{key:hi(e),clipId:d,clipX:f,clipY:ee,clipWidth:te,clipHeight:ne,translate:`translate(${e.x0}, ${e.y0})`,alwaysShowAllLines:l,allLinesScaleCap:u,lines:s.map((t,s)=>({key:`${e.id}_${s}`,text:t,x:r,y:i+a*s,maxZoomFactor:di({availableHeight:c.height,lineHeight:a,lineIndex:s}),fill:o,fontSize:n,fontFamily:N.value.style.fontFamily,fontWeight:s===0?500:400}))}}function hi(e){return`${e.id}`}let gi=p(()=>dt.rect||fn.value||!L.value.showDefaultLabels||vr.value?[]:G.value.map((e,t)=>e.showLabel?mi({rect:e,seriesIndex:t}):null).filter(Boolean)),_i;function vi(){return typeof document>`u`?null:(_i||=document.createElement(`canvas`),_i.getContext(`2d`))}function yi(e,t,n=400){let r=vi();return r?(r.font=`${n} ${t}px ${N.value.style.fontFamily}`,r.measureText(String(e)).width):e.length*t*.6}function bi(e){let t=R.value.rects.borderRadius,n=q(e),r=K(e);return Math.min(t,Math.min(n,r)/6)}async function xi(){O(`copyAlt`,{config:N.value,dataset:G.value}),N.value.userOptions.callbacks.altCopy?await Promise.resolve(N.value.userOptions.callbacks.altCopy({config:N.value,dataset:G.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}function Si(){M.value=null,ln.value=!0}function Ci(){M.value=null,cn.value=`pointer`,Ht.value=!1,Z.value=null,ln.value=!1}function wi(e){if(!vn.value||Nr.value||document.activeElement!==vn.value||!G.value.length||vr.value)return;let t=[`ArrowLeft`,`ArrowUp`].includes(e.key),n=[`ArrowRight`,`ArrowDown`].includes(e.key),r=e.key===`Enter`||e.key===` `,i=e.key===`Escape`;if(!t&&!n&&!r&&!i)return;if(e.preventDefault(),e.stopPropagation(),i){M.value=null,cn.value=`pointer`,Ht.value=!1,Z.value=null;return}if(r){if(M.value===null)return;let e=G.value[M.value];if(!e)return;mr(e,M.value);return}let a=M.value,o=Z.value?G.value.findIndex(e=>e.id===Z.value.id):null,s=a!==null&&a>=0&&a<G.value.length,c=o!==null&&o>=0&&o<G.value.length;s?n?(a+=1,a>=G.value.length&&(a=0)):t&&(--a,a<0&&(a=G.value.length-1)):c?(a=n?o+1:o-1,a>=G.value.length&&(a=0),a<0&&(a=G.value.length-1)):a=n?0:G.value.length-1;let l=G.value[a];l&&(Ti(a),Er({datapoint:l,seriesIndex:a,triggerMode:`keyboard`}))}function Ti(e){if(!Number.isFinite(e)||!vn.value)return;let t=G.value[e];if(!t)return;let n=t.x0+q(t)/2,r=t.y0+K(t)/2,i=vn.value.getBoundingClientRect();sn.value={x:i.left+(n-$.value.x)/$.value.width*i.width,y:i.top+(r-$.value.y)/$.value.height*i.height}}let Ei=p(()=>({headers:Or.value?.colNames??[],rows:Or.value?.body??[]})),Di=p(()=>z.value.color);return de({getData:kr,getImage:$r,generateCsv:Dr,generateImage:wn,generateSvg:si,generatePdf:Cn,hideSeries:Cr,showSeries:Sr,toggleTable:Ar,toggleTooltip:jr,toggleZoom:Mr,toggleAnnotator:Pr,toggleFullscreen:sr,resetZoom:Rr,copyAlt:xi}),(e,t)=>(x(),g(`div`,{ref_key:`treemapChart`,ref:Kt,class:Ue(`vue-data-ui-component vue-ui-treemap ${Wt.value?`vue-data-ui-wrapper-fullscreen`:``} ${N.value.useCssAnimation?``:`vue-ui-dna`}`),style:b(`font-family:${N.value.style.fontFamily};width:100%; ${N.value.responsive?`height: 100%;`:``} text-align:center;background:${z.value.backgroundColor}`),id:`treemap_${k.value}`,onMouseenter:t[3]||=()=>T(gn)(!0),onMouseleave:t[4]||=()=>T(gn)(!1)},[_(`div`,{id:`chart-instructions-${k.value}`,class:`sr-only`},[_(`p`,null,Je(N.value.a11y.translations.keyboardNavigation),1)],8,mt),Ei.value?.rows?.length?(x(),m(ke,{key:0,uid:k.value,head:Ei.value.headers,body:Ei.value.rows,notice:N.value.a11y.translations.tableAvailable,caption:N.value.a11y.translations.tableCaption},null,8,[`uid`,`head`,`body`,`notice`,`caption`])):h(``,!0),P.value.buttons.annotator?(x(),m(T(rt),{key:1,svgRef:T(vn),backgroundColor:z.value.backgroundColor,color:z.value.color,active:Nr.value,isCursorPointer:B.value,palette:P.value.annotatorPalette,onClose:Pr},Le({_:2},[Ke(T(be),t=>({name:t,fn:E(n=>[C(e.$slots,t,y(v(T(ye)(t,n))),void 0,!0)])}))]),1032,[`svgRef`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):h(``,!0),Tn.value?(x(),g(`div`,{key:2,ref_key:`noTitle`,ref:Xt,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},null,512)):h(``,!0),z.value.title.text?(x(),g(`div`,{key:3,ref_key:`chartTitle`,ref:qt,style:b(`width:100%;background:${z.value.backgroundColor};padding-bottom:6px`)},[(x(),m(he,{key:`title_${Zt.value}`,config:{title:{cy:`treemap-div-title`,...z.value.title},subtitle:{cy:`treemap-div-subtitle`,...z.value.title.subtitle}}},null,8,[`config`]))],4)):h(``,!0),_(`div`,{id:`legend-top-${k.value}`},null,8,ht),P.value.show&&ft.value&&(T(_n)||T(hn))?(x(),m(T(st),{ref_key:`userOptionsRef`,ref:rn,key:`user_option_${Gt.value}`,backgroundColor:z.value.backgroundColor,color:z.value.color,isPrinting:T(xn),isImaging:T(Sn),uid:k.value,hasTooltip:P.value.buttons.tooltip&&F.value.show,hasPdf:P.value.buttons.pdf,hasXls:P.value.buttons.csv,hasImg:P.value.buttons.img,hasSvg:P.value.buttons.svg,hasTable:P.value.buttons.table,hasFullscreen:P.value.buttons.fullscreen,hasAltCopy:P.value.buttons.altCopy,isFullscreen:Wt.value,isTooltip:V.value.showTooltip,titles:{...P.value.buttonTitles},chartElement:Kt.value,position:P.value.position,hasAnnotator:P.value.buttons.annotator,isAnnotation:Nr.value,callbacks:P.value.callbacks,printScale:P.value.print.scale,tableDialog:N.value.table.useDialog,isCursorPointer:B.value,hasZoom:P.value.buttons.zoom,isZoom:V.value.showZoom,onToggleFullscreen:sr,onGeneratePdf:T(Cn),onGenerateCsv:Dr,onGenerateImage:T(ci),onGenerateSvg:T(si),onToggleTable:Ar,onToggleTooltip:jr,onToggleAnnotator:Pr,onToggleZoom:Mr,onCopyAlt:xi,style:b({visibility:T(_n)?T(hn)?`visible`:`hidden`:`visible`})},Le({_:2},[Ke(T(xe)(e.$slots,`menuIcon optionTooltip optionPdf optionCsv optionImg optionSvg optionTable optionFullscreen optionAnnotator optionZoom optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:E(n=>[C(e.$slots,t,y(v(T(Se)(t,n))),void 0,!0)])}))]),1032,/* @__PURE__ */ `backgroundColor.color.isPrinting.isImaging.uid.hasTooltip.hasPdf.hasXls.hasImg.hasSvg.hasTable.hasFullscreen.hasAltCopy.isFullscreen.isTooltip.titles.chartElement.position.hasAnnotator.isAnnotation.callbacks.printScale.tableDialog.isCursorPointer.hasZoom.isZoom.onGeneratePdf.onGenerateImage.onGenerateSvg.style`.split(`.`))):h(``,!0),X.value.length>1?(x(),g(`nav`,{key:5,class:`vue-ui-treemap-breadcrumbs`,"data-dom-to-png-ignore":``,ref_key:`breadcrumbsNav`,ref:en},[(x(!0),g(Fe,null,Ke(X.value,(n,r)=>(x(),g(`span`,{role:`button`,tabindex:r<X.value.length-1?0:void 0,key:n.id||`root`,onClick:e=>r===X.value.length-1?()=>{}:mr(n.node),onKeydown:[$e(et(e=>r===X.value.length-1?void 0:mr(n.node),[`prevent`]),[`enter`]),$e(et(e=>r===X.value.length-1?void 0:mr(n.node),[`prevent`]),[`space`])],class:`vue-ui-treemap-crumb`,"data-last-crumb":r===X.value.length-1,style:b({color:z.value.color,cursor:B.value?`pointer`:`default`}),onMouseenter:e=>Zr(r),onMouseleave:Qr,onFocus:e=>Zr(r),onBlur:Qr},[_(`span`,_t,[_(`span`,vt,[C(e.$slots,`breadcrumb-label`,Ve({ref_for:!0},{crumb:n,isRoot:r===0,isFocus:Xr.value===r}),()=>[r===0?(x(),g(`div`,yt,[ze(me,{name:Xr.value===0?`homeFilled`:`home`,stroke:z.value.color},null,8,[`name`,`stroke`])])):(x(),g(Fe,{key:1},[Re(Je(n.label),1)],64))],!0)]),r<X.value.length-1?(x(),g(`span`,bt,[C(e.$slots,`breadcrumb-arrow`,{},()=>[t[5]||=Re(` › `,-1)],!0)])):h(``,!0)])],44,gt))),128))],512)):h(``,!0),_(`div`,xt,[(x(),g(`svg`,{ref_key:`svgRef`,ref:vn,xmlns:T(ie),"aria-describedby":`chart-instructions-${k.value}`,class:Ue({"vue-data-ui-fullscreen--on":Wt.value,"vue-data-ui-fulscreen--off":!Wt.value,"vue-data-ui-zoom-plus":!lr.value,"vue-data-ui-zoom-minus":lr.value,"vue-data-ui-no-transition":!T(un),loading:T(fn)}),viewBox:`${T($).x} ${T($).y} ${T($).width<=0?10:T($).width} ${T($).height<=0?10:T($).height}`,style:b(`max-width:100%; overflow:${Gr.value?`hidden`:`visible`}; background:transparent;color:${z.value.color}`),tabindex:`0`,onFocus:Si,onBlur:Ci,onKeydown:wi,onPointerdown:Kr,onPointermove:qr,onPointerup:Jr,onPointercancel:Jr,onPointerleave:Jr},[ze(T(ct)),C(e.$slots,`svg-underlayer`,y(v({svg:H.value,isZoom:lr.value,rect:Z.value,config:N.value,isPrintingImg:T(xn)||T(Sn)||T(ai),isPrintingSvg:T(oi)})),void 0,!0),(x(!0),g(Fe,null,Ke(G.value,(e,t)=>(x(),g(`g`,{key:`tgrad_${e.id}`},[R.value.rects.gradient.show?(x(),g(`defs`,Ct,[ze(De,{t:`radial`,id:`tgrad_${e.id}`,gradientTransform:`translate(-1, -1.000001) scale(2, 2)`,stops:[[`18%`,e.color,1],[`100%`,T(a)(e.color,R.value.rects.gradient.intensity/100),1]]},null,8,[`id`,`stops`])])):h(``,!0)]))),128)),_(`g`,null,[(x(!0),g(Fe,null,Ke(G.value,(e,t)=>(x(),g(`g`,{key:`rect_${e.id}_${e.depth}`},[_(`rect`,{x:e.x0,y:e.y0,height:K(e),width:q(e),fill:Vt.value?e.color??z.value.backgroundColor:R.value.rects.gradient.show?vr.value?z.value.backgroundColor:`url(#tgrad_${e.id})`:e.color??z.value.backgroundColor,rx:T(Vr)>1?bi(e)*Hr.value:bi(e),stroke:Z.value&&Z.value.id===e.id?R.value.rects.selected.stroke:R.value.rects.stroke,"stroke-width":Qn(e),onClick:et(n=>Yr(e,t),[`stop`]),onMouseenter:()=>Er({datapoint:e,seriesIndex:t,triggerMode:`pointer`}),onMouseleave:n=>wr({datapoint:e,seriesIndex:t}),style:b(`opacity:${Z.value?Z.value.id===e.id?1:R.value.rects.selected.unselectedOpacity:1}`),class:Ue([`vue-ui-treemap-rect`,T(un)?`vue-data-ui-transition`:``,hr(e)?`vue-data-ui-zoom-minus`:`vue-data-ui-zoom-plus`])},null,46,wt)]))),128)),(x(!0),g(Fe,null,Ke(gi.value,e=>(x(),g(`g`,{key:e.key,style:{"pointer-events":`none`}},[_(`defs`,null,[_(`clipPath`,{id:e.clipId,clipPathUnits:`userSpaceOnUse`},[_(`rect`,{class:Ue({"vue-data-ui-transition":T(un)}),x:e.clipX,y:e.clipY,width:e.clipWidth,height:e.clipHeight},null,10,Et)],8,Tt)]),_(`g`,{"clip-path":`url(#${e.clipId})`},[_(`g`,{transform:e.translate},[_(`g`,{class:Ue({"vue-data-ui-transition":T(un)}),transform:pi(e)},[(x(!0),g(Fe,null,Ke(e.lines,t=>(x(),g(Fe,{key:t.key},[t.text&&(e.alwaysShowAllLines||Ur.value<=t.maxZoomFactor)?(x(),g(`text`,{key:0,x:t.x,y:t.y,fill:t.fill,"font-size":t.fontSize,"font-family":t.fontFamily,"font-weight":t.fontWeight,class:Ue({"vue-data-ui-transition":T(un)}),"text-anchor":`start`,"dominant-baseline":`text-before-edge`},Je(t.text),11,At)):h(``,!0)],64))),128))],10,kt)],8,Ot)],8,Dt)]))),128)),e.$slots.rect?(x(),g(`g`,jt,[(x(!0),g(Fe,null,Ke(G.value,(t,n)=>(x(),g(`g`,{key:`slot_${t.id}_${t.depth}`},[(x(),g(`foreignObject`,{x:t.x0,y:t.y0,height:K(t),width:q(t),class:`vue-ui-treemap-cell-foreignObject`,style:{"pointer-events":`none`,overflow:`hidden`}},[_(`div`,Nt,[T(fn)?h(``,!0):C(e.$slots,`rect`,Ve({ref_for:!0},{rect:{...t,height:K(t),width:q(t),isSelected:!Z.value||Z.value.id===t.id},shouldShow:Yn(t)||lr.value,fontSize:or(t,n),isZoom:lr.value,textColor:T(re)(t.color)}),void 0,!0,0)])],8,Mt))]))),128))])):h(``,!0)]),C(e.$slots,`svg`,y(v({svg:H.value,isZoom:lr.value,rect:Z.value,config:N.value,isPrintingImg:T(xn)||T(Sn)||T(ai),isPrintingSvg:T(oi)})),void 0,!0)],46,St)),T(zr)?(x(),g(`div`,Pt,[C(e.$slots,`reset-action`,{reset:T(Rr)},()=>[_(`button`,{"data-cy-reset":``,tabindex:`0`,role:`button`,class:`vue-data-ui-refresh-button`,style:b({background:z.value.backgroundColor,cursor:B.value?`pointer`:`default`}),onClick:t[0]||=e=>T(Rr)(!0)},[ze(me,{name:`refresh`,stroke:z.value.color},null,8,[`stroke`])],4)],!0)])):h(``,!0),e.$slots.hint?(x(),g(`div`,Ft,[C(e.$slots,`hint`,y(v({hint:N.value.a11y.translations.keyboardNavigation,isVisible:ln.value})),void 0,!0)])):h(``,!0)]),e.$slots.watermark?(x(),g(`div`,It,[C(e.$slots,`watermark`,y(v({isPrinting:T(xn)||T(Sn)||T(ai)||T(oi)})),void 0,!0)])):h(``,!0),_(`div`,{id:`legend-bottom-${k.value}`},null,8,Lt),tn.value&&(I.value.show||e.$slots.legend)?(x(),m(Ie,{key:7,to:I.value.position===`top`?`#legend-top-${k.value}`:`#legend-bottom-${k.value}`},[_(`div`,{ref_key:`chartLegend`,ref:Jt},[C(e.$slots,`legend`,{legend:gr.value},()=>[I.value.show?(x(),m(Me,{key:`legend_${$t.value}`,legendSet:gr.value,config:_r.value,id:`treemap_legend_${k.value}`,isCursorPointer:B.value,onClickMarker:t[1]||=({legend:e})=>br(e)},{item:E(({legend:e,index:t})=>[T(fn)?h(``,!0):(x(),g(`div`,{key:0,onClick:t=>br(e),style:b(`opacity:${A.value.includes(e.id)?.5:1}`)},Je(e.display),13,Rt))]),legendToggle:E(()=>[gr.value.length>2&&I.value.selectAllToggle.show&&!T(fn)?(x(),m(Oe,{key:0,backgroundColor:I.value.selectAllToggle.backgroundColor,color:I.value.selectAllToggle.color,fontSize:I.value.fontSize,checked:A.value.length>0,isCursorPointer:B.value,onToggle:yr},null,8,[`backgroundColor`,`color`,`fontSize`,`checked`,`isCursorPointer`])):h(``,!0)]),_:1},8,[`legendSet`,`config`,`id`,`isCursorPointer`])):h(``,!0)],!0)],512)],8,[`to`])):h(``,!0),e.$slots.source?(x(),g(`div`,{key:8,ref_key:`source`,ref:Yt,dir:`auto`},[C(e.$slots,`source`,{},void 0,!0)],512)):h(``,!0),ze(T(ot),{teleportTo:F.value.teleportTo,show:V.value.showTooltip&&Ht.value,backgroundColor:F.value.backgroundColor,color:F.value.color,fontSize:F.value.fontSize,borderRadius:F.value.borderRadius,borderColor:F.value.borderColor,borderWidth:F.value.borderWidth,backgroundOpacity:F.value.backgroundOpacity,position:F.value.position,offsetX:F.value.offsetX,offsetY:F.value.offsetY,parent:Kt.value,content:Ut.value,isFullscreen:Wt.value,isCustom:T(i)(F.value.customFormat),smooth:F.value.smooth,backdropFilter:F.value.backdropFilter,smoothForce:F.value.smoothForce,smoothSnapThreshold:F.value.smoothSnapThreshold,isA11yMode:cn.value===`keyboard`,a11yPosition:sn.value},{"tooltip-before":E(()=>[C(e.$slots,`tooltip-before`,y(v({...Tr.value})),void 0,!0)]),tooltip:E(()=>[C(e.$slots,`tooltip`,y(v({...Tr.value})),void 0,!0)]),"tooltip-after":E(()=>[C(e.$slots,`tooltip-after`,y(v({...Tr.value})),void 0,!0)]),_:3},8,[`teleportTo`,`show`,`backgroundColor`,`color`,`fontSize`,`borderRadius`,`borderColor`,`borderWidth`,`backgroundOpacity`,`position`,`offsetX`,`offsetY`,`parent`,`content`,`isFullscreen`,`isCustom`,`smooth`,`backdropFilter`,`smoothForce`,`smoothSnapThreshold`,`isA11yMode`,`a11yPosition`]),ft.value&&P.value.buttons.table?(x(),m(qe(ei.value.component),Ve({key:9},ei.value.props,{ref_key:`tableUnit`,ref:nn,onClose:ti}),Le({content:E(()=>[(x(),m(T(nt),{key:`table_${Qt.value}`,colNames:Or.value.colNames,head:Or.value.head,body:Or.value.body,config:Or.value.config,title:N.value.table.useDialog?``:ei.value.title,withCloseButton:!N.value.table.useDialog,isCursorPointer:B.value,onClose:ti},{th:E(({th:e})=>[_(`div`,zt,Je(e),1)]),td:E(({td:e})=>[Re(Je(e.name||e),1)]),_:1},8,[`colNames`,`head`,`body`,`config`,`title`,`withCloseButton`,`isCursorPointer`]))]),_:2},[N.value.table.useDialog?{name:`title`,fn:E(()=>[Re(Je(ei.value.title),1)]),key:`0`}:void 0,N.value.table.useDialog?{name:`actions`,fn:E(()=>[_(`button`,{tabindex:`0`,class:`vue-ui-user-options-button`,onClick:t[2]||=e=>Dr(P.value.callbacks.csv),style:b({cursor:B.value?`pointer`:`default`})},[ze(me,{name:`fileCsv`,stroke:ei.value.props.color},null,8,[`stroke`])],4)]),key:`1`}:void 0]),1040)):h(``,!0),C(e.$slots,`skeleton`,{},()=>[T(fn)?(x(),m(ce,{key:0})):h(``,!0)],!0)],46,pt))}},[[`__scopeId`,`data-v-7d98932d`]]);export{ft as n,Vt as t};
|