vue-data-ui 2.4.20 → 2.4.21
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/{Arrow-TG2JsMwT.js → Arrow-BuVX2WoN.js} +1 -1
- package/dist/{Arrow-DjiNIFce.cjs → Arrow-DDe-g8rw.cjs} +1 -1
- package/dist/{BaseIcon-CgiYTpkb.js → BaseIcon-BRSPQaGQ.js} +1 -1
- package/dist/{BaseIcon-D-YgPcX1.cjs → BaseIcon-BdKOa64A.cjs} +1 -1
- package/dist/{DataTable-B-_LZJ5T.js → DataTable-BpVz3DBX.js} +2 -2
- package/dist/{DataTable-T6NSDRqO.cjs → DataTable-H-KTkjfv.cjs} +1 -1
- package/dist/{Legend-B3KPtqT8.cjs → Legend-G5Zc4QaZ.cjs} +1 -1
- package/dist/{Legend-CJnJQbiR.js → Legend-hnLfwhmm.js} +1 -1
- package/dist/{PackageVersion-BjoP5ypd.cjs → PackageVersion-BbQFSVXm.cjs} +1 -1
- package/dist/{PackageVersion-DHeUFci0.js → PackageVersion-wqab02xF.js} +1 -1
- package/dist/{PenAndPaper-C0H3KJhQ.cjs → PenAndPaper-BX8pR5oV.cjs} +1 -1
- package/dist/{PenAndPaper-BKIQk9Cq.js → PenAndPaper-C_laA5mt.js} +3 -3
- package/dist/{Shape-BmBZkR94.cjs → Shape-CJbFv4bs.cjs} +1 -1
- package/dist/{Shape-nQyHwd5x.js → Shape-QdnXSUyn.js} +1 -1
- package/dist/Slicer-C1blYfez.cjs +1 -0
- package/dist/{Slicer-Cs0G0M7b.js → Slicer-DV1kBscZ.js} +58 -58
- package/dist/{Title-Az2QIayC.cjs → Title-BRqTk-nT.cjs} +1 -1
- package/dist/{Title-Dl6c1jg0.js → Title-DBozX6nP.js} +1 -1
- package/dist/{Tooltip-8UZ341MF.js → Tooltip-Com_T8vc.js} +1 -1
- package/dist/{Tooltip-wdo3yY_W.cjs → Tooltip-DvGSIp31.cjs} +1 -1
- package/dist/{index-DsF7Aej7.cjs → index-CsQwCVqU.cjs} +1 -1
- package/dist/{index-C2sScL5o.js → index-hV0hU1iE.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{useNestedProp-CuE-kmwp.js → useNestedProp-CRAUOmT5.js} +1 -1
- package/dist/{useNestedProp-D0YHk8Cd.cjs → useNestedProp-DSYpaLxP.cjs} +1 -1
- package/dist/{usePrinter-CUDeluax.cjs → usePrinter-O2fMMTMe.cjs} +1 -1
- package/dist/{usePrinter-CddPH-Ds.js → usePrinter-y3d31M4g.js} +1 -1
- package/dist/{vue-data-ui-DqHj_pWh.js → vue-data-ui-bEKZH8jG.js} +58 -58
- package/dist/{vue-data-ui-owDqn8Xa.cjs → vue-data-ui-qBad3a6z.cjs} +1 -1
- package/dist/vue-data-ui.cjs +1 -1
- package/dist/vue-data-ui.js +1 -1
- package/dist/{vue-ui-3d-bar-DJscSRTK.cjs → vue-ui-3d-bar-CkqKnqQt.cjs} +1 -1
- package/dist/{vue-ui-3d-bar-Bp1Qr_3F.js → vue-ui-3d-bar-f7YaBbrh.js} +9 -9
- package/dist/{vue-ui-accordion-Av34wbMx.cjs → vue-ui-accordion-CaktYQoo.cjs} +1 -1
- package/dist/{vue-ui-accordion-BH4FO7io.js → vue-ui-accordion-m-s-7akB.js} +3 -3
- package/dist/{vue-ui-age-pyramid-BOPzYxu_.js → vue-ui-age-pyramid-DkfNZR86.js} +10 -10
- package/dist/{vue-ui-age-pyramid-DbwlbzZl.cjs → vue-ui-age-pyramid-EKKYQu3N.cjs} +1 -1
- package/dist/{vue-ui-annotator-CGj1ftbP.js → vue-ui-annotator-DrVu5Pu0.js} +1 -1
- package/dist/{vue-ui-annotator-Dd0ZkXyj.cjs → vue-ui-annotator-v07J6oQG.cjs} +1 -1
- package/dist/{vue-ui-bullet-C6D22-Ah.js → vue-ui-bullet-CYDMehDZ.js} +8 -8
- package/dist/{vue-ui-bullet-B1LUeFVN.cjs → vue-ui-bullet-CdG92x7A.cjs} +1 -1
- package/dist/{vue-ui-candlestick-6kWB1Iz6.js → vue-ui-candlestick-Bw1O3QmK.js} +11 -11
- package/dist/{vue-ui-candlestick-BfBmmv4x.cjs → vue-ui-candlestick-D9yN-yRo.cjs} +1 -1
- package/dist/{vue-ui-carousel-table-BdZ2MO_U.cjs → vue-ui-carousel-table-Cg6hAEVv.cjs} +1 -1
- package/dist/{vue-ui-carousel-table-BFyyF9Ql.js → vue-ui-carousel-table-kcQa0FHw.js} +4 -4
- package/dist/{vue-ui-chestnut-RzOkxqA7.js → vue-ui-chestnut-DE1AMXeX.js} +8 -8
- package/dist/{vue-ui-chestnut-DjG-n6FA.cjs → vue-ui-chestnut-Qu8c3_vB.cjs} +1 -1
- package/dist/{vue-ui-cursor-B7aO28Bc.cjs → vue-ui-cursor-DG8oufeh.cjs} +1 -1
- package/dist/{vue-ui-cursor-CvZS65zZ.js → vue-ui-cursor-DbfjKtpf.js} +2 -2
- package/dist/{vue-ui-dashboard-BMaPi8dt.cjs → vue-ui-dashboard-BbwgfxLx.cjs} +1 -1
- package/dist/{vue-ui-dashboard-B5xuKqwS.js → vue-ui-dashboard-CAkCNUBh.js} +2 -2
- package/dist/{vue-ui-digits-C8VAWZ3p.js → vue-ui-digits-BaXAiH4u.js} +2 -2
- package/dist/{vue-ui-digits-BMNNUYnH.cjs → vue-ui-digits-DgQkxULm.cjs} +1 -1
- package/dist/{vue-ui-donut-NsU-zF5W.js → vue-ui-donut-7GM_Wd1Y.js} +11 -11
- package/dist/{vue-ui-donut-BMhNabzn.cjs → vue-ui-donut-BHzCOBu6.cjs} +1 -1
- package/dist/{vue-ui-donut-evolution-Bi3VA_yA.cjs → vue-ui-donut-evolution-C-TkUOr6.cjs} +1 -1
- package/dist/{vue-ui-donut-evolution-BpBAko36.js → vue-ui-donut-evolution-DbU4RlP6.js} +11 -11
- package/dist/{vue-ui-dumbbell-DcoUMxUR.js → vue-ui-dumbbell-BacTx3zB.js} +10 -10
- package/dist/{vue-ui-dumbbell-Bcyuwjih.cjs → vue-ui-dumbbell-DacMeiTU.cjs} +1 -1
- package/dist/{vue-ui-flow-C9usdqKR.cjs → vue-ui-flow-BUAvjG7i.cjs} +1 -1
- package/dist/{vue-ui-flow-CHtg7-D-.js → vue-ui-flow-D2G0YWL9.js} +9 -9
- package/dist/{vue-ui-galaxy-DCl7i83C.cjs → vue-ui-galaxy-CxfV3BIw.cjs} +1 -1
- package/dist/{vue-ui-galaxy-oU6i5aA-.js → vue-ui-galaxy-D6RFyIbQ.js} +11 -11
- package/dist/{vue-ui-gauge-C8pggd2h.cjs → vue-ui-gauge-CJ5TKJpb.cjs} +1 -1
- package/dist/{vue-ui-gauge-Dy2ZQxvF.js → vue-ui-gauge-DNJXnyLw.js} +7 -7
- package/dist/{vue-ui-gizmo-BQdo0Q3v.cjs → vue-ui-gizmo-BBA51j_0.cjs} +1 -1
- package/dist/{vue-ui-gizmo-CW4t27JP.js → vue-ui-gizmo-Db7-gRmB.js} +3 -3
- package/dist/{vue-ui-heatmap-Cdu2Xhjf.js → vue-ui-heatmap-Ba6RMSTk.js} +10 -10
- package/dist/{vue-ui-heatmap-CFT-bLNP.cjs → vue-ui-heatmap-KQj8Jbpt.cjs} +1 -1
- package/dist/{vue-ui-kpi-DfRy61t9.cjs → vue-ui-kpi-1srKxA1L.cjs} +1 -1
- package/dist/{vue-ui-kpi-Dnh9ZTZH.js → vue-ui-kpi-C8wyHy1H.js} +3 -3
- package/dist/{vue-ui-mini-loader-CI0Mwg9T.cjs → vue-ui-mini-loader-BgKTecng.cjs} +1 -1
- package/dist/{vue-ui-mini-loader-CLh4mj5Z.js → vue-ui-mini-loader-DutVmCuC.js} +2 -2
- package/dist/{vue-ui-molecule-Dyfk9UfE.js → vue-ui-molecule-BOkIojio.js} +11 -11
- package/dist/{vue-ui-molecule-Cqvn7ZGx.cjs → vue-ui-molecule-CSezTn3m.cjs} +1 -1
- package/dist/{vue-ui-mood-radar-D9XUvCNH.js → vue-ui-mood-radar-C8U8PHaq.js} +11 -11
- package/dist/{vue-ui-mood-radar-UqlWcAkr.cjs → vue-ui-mood-radar-CNTDrRs6.cjs} +1 -1
- package/dist/{vue-ui-nested-donuts-DP4yfGUH.js → vue-ui-nested-donuts-Bv2D1uFd.js} +11 -11
- package/dist/{vue-ui-nested-donuts-vUJ2g2dk.cjs → vue-ui-nested-donuts-DRWWnsdR.cjs} +1 -1
- package/dist/{vue-ui-onion-IxyzzuZC.js → vue-ui-onion-CT9YjU8v.js} +11 -11
- package/dist/{vue-ui-onion-fJOV7lwQ.cjs → vue-ui-onion-CsnwbXED.cjs} +1 -1
- package/dist/{vue-ui-parallel-coordinate-plot-C6CQj1ih.cjs → vue-ui-parallel-coordinate-plot-C8KCRAX1.cjs} +1 -1
- package/dist/{vue-ui-parallel-coordinate-plot-6LNS_W9b.js → vue-ui-parallel-coordinate-plot-in5qpfXf.js} +12 -12
- package/dist/{vue-ui-quadrant-BPJzCH5I.cjs → vue-ui-quadrant-Bw-0aW4F.cjs} +1 -1
- package/dist/{vue-ui-quadrant-eQs9Dod-.js → vue-ui-quadrant-C_9VNAXg.js} +12 -12
- package/dist/{vue-ui-quick-chart-CTMgh6oC.js → vue-ui-quick-chart-BDBlm9uu.js} +9 -9
- package/dist/{vue-ui-quick-chart-CWhEkYew.cjs → vue-ui-quick-chart-C0YqMjyE.cjs} +1 -1
- package/dist/{vue-ui-radar-Rrbv8dAs.js → vue-ui-radar-C2QM_ee9.js} +12 -12
- package/dist/{vue-ui-radar-CbwxQra8.cjs → vue-ui-radar-DXKMbeyW.cjs} +1 -1
- package/dist/{vue-ui-rating-BDy7Vxiz.cjs → vue-ui-rating-CsOknvaV.cjs} +1 -1
- package/dist/{vue-ui-rating-b_H5cz4V.js → vue-ui-rating-DVpgv2AY.js} +2 -2
- package/dist/{vue-ui-relation-circle-BsaD2Vz5.js → vue-ui-relation-circle-OXfdAyky.js} +7 -7
- package/dist/{vue-ui-relation-circle-CYxPC6gU.cjs → vue-ui-relation-circle-ZA-M7aSc.cjs} +1 -1
- package/dist/{vue-ui-rings-CywU-FZc.js → vue-ui-rings-qLQ-gl21.js} +11 -11
- package/dist/{vue-ui-rings-Dj329t-Y.cjs → vue-ui-rings-rftqDu-q.cjs} +1 -1
- package/dist/{vue-ui-scatter-Cf7C-P1q.js → vue-ui-scatter-4LbMvEAD.js} +12 -12
- package/dist/{vue-ui-scatter-BU3bhusK.cjs → vue-ui-scatter-Cv2IcrVH.cjs} +1 -1
- package/dist/{vue-ui-screenshot-DBeBfiuI.js → vue-ui-screenshot-BV6ZYQRk.js} +1 -1
- package/dist/{vue-ui-screenshot-v4TXqkKi.cjs → vue-ui-screenshot-BgjnQNxG.cjs} +1 -1
- package/dist/{vue-ui-skeleton-BgKRd_jD.js → vue-ui-skeleton-BY8Jg9a_.js} +3 -3
- package/dist/{vue-ui-skeleton-e8hBgzZq.cjs → vue-ui-skeleton-DsRTbz6d.cjs} +1 -1
- package/dist/{vue-ui-smiley-BEPDv0B2.js → vue-ui-smiley-BQ_3uicm.js} +2 -2
- package/dist/{vue-ui-smiley-WLjNbXtv.cjs → vue-ui-smiley-DB3y8CIb.cjs} +1 -1
- package/dist/{vue-ui-spark-trend-CWlczo-T.js → vue-ui-spark-trend-BhCJfY_p.js} +5 -5
- package/dist/{vue-ui-spark-trend-BqJ9Du4S.cjs → vue-ui-spark-trend-Cgn7ONtS.cjs} +1 -1
- package/dist/{vue-ui-sparkbar-CC644wqU.cjs → vue-ui-sparkbar-D4GIhUXT.cjs} +1 -1
- package/dist/{vue-ui-sparkbar-CpzctkDi.js → vue-ui-sparkbar-DxXt-GHr.js} +4 -4
- package/dist/{vue-ui-sparkgauge-DhTYuVVk.js → vue-ui-sparkgauge-BCPkJveV.js} +4 -4
- package/dist/{vue-ui-sparkgauge-QdcUMSrr.cjs → vue-ui-sparkgauge-BbltbIrq.cjs} +1 -1
- package/dist/{vue-ui-sparkhistogram-DT8aWhy7.js → vue-ui-sparkhistogram-BKcr2mFc.js} +5 -5
- package/dist/{vue-ui-sparkhistogram-B_bkoRo5.cjs → vue-ui-sparkhistogram-DzX6lkk8.cjs} +1 -1
- package/dist/{vue-ui-sparkline-gNuSbC73.cjs → vue-ui-sparkline-C-svTmFU.cjs} +1 -1
- package/dist/{vue-ui-sparkline-B0y9q_YB.js → vue-ui-sparkline-DYHUFUOp.js} +4 -4
- package/dist/{vue-ui-sparkstackbar-D0EW5UMR.js → vue-ui-sparkstackbar-Btag2osm.js} +5 -5
- package/dist/{vue-ui-sparkstackbar-BObzDdzR.cjs → vue-ui-sparkstackbar-CL0uL_Te.cjs} +1 -1
- package/dist/{vue-ui-stackbar-Behinggy.js → vue-ui-stackbar-C2mRU7ya.js} +12 -12
- package/dist/{vue-ui-stackbar-BRxbXX0l.cjs → vue-ui-stackbar-CML7v_yU.cjs} +1 -1
- package/dist/{vue-ui-strip-plot-DjyK_xfj.js → vue-ui-strip-plot-BIXF3VxN.js} +11 -11
- package/dist/{vue-ui-strip-plot-CjhT-LmB.cjs → vue-ui-strip-plot-Vn5sEcME.cjs} +1 -1
- package/dist/{vue-ui-table-C2YKKkgd.cjs → vue-ui-table-BbVpmm0B.cjs} +1 -1
- package/dist/{vue-ui-table-DYrm2td6.js → vue-ui-table-CyuRalnp.js} +1 -1
- package/dist/{vue-ui-table-heatmap-uSw3G5Yp.js → vue-ui-table-heatmap-DlGeS3l9.js} +4 -4
- package/dist/{vue-ui-table-heatmap-_A66YkO3.cjs → vue-ui-table-heatmap-DrQXQd41.cjs} +1 -1
- package/dist/{vue-ui-table-sparkline-CimHSr9x.cjs → vue-ui-table-sparkline-DauDTktD.cjs} +1 -1
- package/dist/{vue-ui-table-sparkline-DP752Vad.js → vue-ui-table-sparkline-Yg2I33yZ.js} +5 -5
- package/dist/{vue-ui-thermometer-CqmSsg-L.cjs → vue-ui-thermometer-Bglz0dOQ.cjs} +1 -1
- package/dist/{vue-ui-thermometer-BAoZL-gV.js → vue-ui-thermometer-DXwbqNrn.js} +7 -7
- package/dist/{vue-ui-timer-CmeHwizl.js → vue-ui-timer-Brr7buaM.js} +5 -5
- package/dist/{vue-ui-timer-B3kBoPr3.cjs → vue-ui-timer-CpSEl8UD.cjs} +1 -1
- package/dist/{vue-ui-tiremarks-DEcQ-B-G.js → vue-ui-tiremarks-DJowPFwY.js} +7 -7
- package/dist/{vue-ui-tiremarks-DyAHN8nt.cjs → vue-ui-tiremarks-zdGmZNjo.cjs} +1 -1
- package/dist/{vue-ui-treemap-sI6K1nm9.js → vue-ui-treemap-Bn5JU5BI.js} +11 -11
- package/dist/{vue-ui-treemap-CNSeLpGe.cjs → vue-ui-treemap-a7NSP656.cjs} +1 -1
- package/dist/{vue-ui-vertical-bar-B1TdmM7c.cjs → vue-ui-vertical-bar-BYG1vGlT.cjs} +1 -1
- package/dist/{vue-ui-vertical-bar-COsFMFTH.js → vue-ui-vertical-bar-CZxN7L9z.js} +11 -11
- package/dist/{vue-ui-waffle-Cz1aIQK1.cjs → vue-ui-waffle-BbDBOivH.cjs} +1 -1
- package/dist/{vue-ui-waffle-DBjvyyH7.js → vue-ui-waffle-CzUpKfkZ.js} +11 -11
- package/dist/{vue-ui-wheel-BGT8eh76.js → vue-ui-wheel-CCje_ZSc.js} +7 -7
- package/dist/{vue-ui-wheel-D2SqIwip.cjs → vue-ui-wheel-lN3uYCr4.cjs} +1 -1
- package/dist/{vue-ui-word-cloud-BFLqOtlV.cjs → vue-ui-word-cloud-BjvG3n7x.cjs} +1 -1
- package/dist/{vue-ui-word-cloud-vUXYTp4a.js → vue-ui-word-cloud-D_5y92zN.js} +10 -10
- package/dist/{vue-ui-xy-CoDtZktc.cjs → vue-ui-xy-B-WlwJXZ.cjs} +1 -1
- package/dist/{vue-ui-xy-DyDkCQL0.js → vue-ui-xy-Drm1aAb-.js} +14 -14
- package/dist/{vue-ui-xy-canvas-C6db7VrZ.cjs → vue-ui-xy-canvas-BHrq_CYD.cjs} +1 -1
- package/dist/{vue-ui-xy-canvas-DnPYfALY.js → vue-ui-xy-canvas-jieVsnBN.js} +11 -11
- package/package.json +1 -1
- package/dist/Slicer-BUhJuKdW.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./index-CsQwCVqU.cjs"),V=require("./useNestedProp-DSYpaLxP.cjs"),x=require("./BaseIcon-BdKOa64A.cjs"),F=require("./vue-ui-skeleton-DsRTbz6d.cjs"),j=require("./PackageVersion-BbQFSVXm.cjs"),q=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),O=["id"],D=["xmlns","viewBox"],P=["id"],G=["stop-color"],U=["stop-color"],W={key:0},Z=["d","fill"],H=["d","fill"],R=["d","stroke","stroke-width","stroke-linecap","stroke-linejoin"],X=["d","stroke","stroke-width","stroke-linecap","stroke-linejoin"],J=["height","width","x"],K={style:{width:"100%"}},Q=["x","y","fill","font-size","font-weight"],Y=["stroke","cx","cy","fill"],ee=["x","y","font-size","fill","font-weight"],te={key:2,ref:"source",dir:"auto"},le={__name:"vue-ui-spark-trend",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},setup(E){const u=E,{vue_ui_spark_trend:$}=a.useConfig(),S=e.computed(()=>!!u.dataset&&u.dataset.length),y=e.ref(a.createUid()),t=e.computed({get:()=>w(),set:l=>l});function w(){const l=V.useNestedProp({userConfig:u.config,defaultConfig:$});return l.theme?{...V.useNestedProp({userConfig:a.themes.vue_ui_spark_trend[l.theme]||u.config,defaultConfig:l})}:l}const c=e.computed(()=>a.largestTriangleThreeBucketsArray({data:u.dataset,threshold:t.value.downsample.threshold}));e.watch(()=>u.config,l=>{t.value=w(),C()},{deep:!0}),e.watch(()=>u.dataset,l=>{h.value=a.largestTriangleThreeBucketsArray({data:u.dataset,threshold:t.value.downsample.threshold}).map(n=>[void 0,1/0,-1/0,null,NaN].includes(n)?null:n)},{deep:!0});function g(l){return l.map(n=>a.checkNaN(n))}const h=e.ref(a.largestTriangleThreeBucketsArray({data:u.dataset,threshold:t.value.downsample.threshold}).map(l=>t.value.style.animation.show||[void 0,1/0,-1/0,null,NaN].includes(l)?null:l)),p=e.ref(!1),_=e.ref(null);e.onMounted(()=>{C();let n=1e3/t.value.style.animation.animationFrames,i=performance.now();if(t.value.style.animation.show&&t.value.style.animation.animationFrames&&u.dataset.length>1){let N=function(){p.value=!0;let L=performance.now(),T=L-i;T>n?(i=L-T%n,v<c.value.length?(h.value.push(c.value[v]),v+=1,_.value=requestAnimationFrame(N)):(cancelAnimationFrame(_.value),h.value=g(c.value),p.value=!1)):_.value=requestAnimationFrame(N)};h.value=[];let v=0;N()}});function C(){a.objectIsEmpty(u.dataset)&&a.error({componentName:"VueUiSparkTrend",type:"dataset"})}const r=e.ref({height:80,width:300}),d=e.computed(()=>({top:t.value.style.padding.top,left:t.value.style.padding.left,right:r.value.width-t.value.style.padding.right,bottom:r.value.height-t.value.style.padding.bottom,height:r.value.height-(t.value.style.padding.top+t.value.style.padding.bottom)-(t.value.style.dataLabel.show?t.value.style.dataLabel.fontSize:0),width:r.value.width-(t.value.style.padding.left+t.value.style.padding.right)})),b=e.computed(()=>{const l=g(c.value);return{max:Math.max(...l.map(n=>a.checkNaN(n))),min:Math.min(...l.map(n=>a.checkNaN(n)))}}),m=e.computed(()=>{const l=b.value.min>=0?0:b.value.min;return Math.abs(l)}),z=e.computed(()=>b.value.max+m.value);function B(l){return l/z.value}const M=e.computed(()=>c.value.length),o=e.computed(()=>h.value.map((l,n)=>{const i=isNaN(l)||[void 0,null,"NaN",NaN,1/0,-1/0].includes(l)?0:l||0;return{value:a.checkNaN(l),absoluteValue:a.checkNaN(i),plotValue:a.checkNaN(i+m.value),toMax:B(i+m.value),x:d.value.left+a.checkNaN(n*(d.value.width/(M.value-1)))-t.value.style.padding.right,y:d.value.bottom-a.checkNaN(d.value.height*B(i+m.value))}})),f=e.computed(()=>{const l=g(c.value);return t.value.style.trendLabel.trendType==="global"?a.calcTrend(l):t.value.style.trendLabel.trendType==="n-1"&&l.length>1?(l.at(-1)/l.at(-2)-1)*100:t.value.style.trendLabel.trendType==="lastToFirst"?(l.at(-1)/l[0]-1)*100:0}),k=e.computed(()=>p.value||f.value===0?"neutral":f.value>0?"positive":"negative"),s=e.computed(()=>t.value.style.arrow.colors[k.value]),I=e.computed(()=>{const l={x:o.value[0].x,y:r.value.height-6},n={x:o.value[o.value.length-1].x,y:r.value.height-6},i=[];return o.value.forEach(v=>{i.push(`${v.x},${v.y} `)}),[l.x,l.y,...i,n.x,n.y].toString()}),A=e.computed(()=>{let l=[];return o.value.forEach(n=>{l.push(`${n.x},${n.y} `)}),`M ${l.toString()}`});return(l,n)=>(e.openBlock(),e.createElementBlock("div",{class:"vue-ui-spark-trend",id:y.value,style:e.normalizeStyle(`width:100%;font-family:${t.value.style.fontFamily};background:${t.value.style.backgroundColor}`)},[S.value?(e.openBlock(),e.createElementBlock("svg",{key:1,xmlns:e.unref(a.XMLNS),viewBox:`0 0 ${r.value.width} ${r.value.height}`,style:"width:100%;background:transparent;overflow:visible"},[e.createVNode(j._sfc_main),e.createElementVNode("defs",null,[e.createElementVNode("linearGradient",{x1:"0%",y1:"0%",x2:"0%",y2:"100%",id:`pill_gradient_${y.value}`},[e.createElementVNode("stop",{offset:"0%","stop-color":e.unref(a.setOpacity)(t.value.style.line.useColorTrend?s.value:t.value.style.line.stroke,t.value.style.area.opacity)},null,8,G),e.createElementVNode("stop",{offset:"100%","stop-color":t.value.style.backgroundColor},null,8,U)],8,P)]),t.value.style.area.show&&o.value[0]?(e.openBlock(),e.createElementBlock("g",W,[t.value.style.line.smooth?(e.openBlock(),e.createElementBlock("path",{key:0,d:`M ${o.value[0].x},${d.value.bottom} ${e.unref(a.createSmoothPath)(o.value)} L ${o.value.at(-1).x},${d.value.bottom} Z`,fill:t.value.style.area.useGradient?`url(#pill_gradient_${y.value})`:e.unref(a.setOpacity)(t.value.style.line.useColorTrend?s.value:t.value.style.line.stroke,t.value.style.area.opacity),stroke:"none"},null,8,Z)):(e.openBlock(),e.createElementBlock("path",{key:1,d:`M${I.value}Z`,fill:t.value.style.area.useGradient?`url(#pill_gradient_${y.value})`:e.unref(a.setOpacity)(t.value.style.line.useColorTrend?s.value:t.value.style.line.stroke,t.value.style.area.opacity),stroke:"none"},null,8,H))])):e.createCommentVNode("",!0),t.value.style.line.smooth&&o.value.length?(e.openBlock(),e.createElementBlock("path",{key:1,d:`M ${e.unref(a.createSmoothPath)(o.value)}`,stroke:t.value.style.line.useColorTrend?s.value:t.value.style.line.stroke,fill:"none","stroke-width":t.value.style.line.strokeWidth,"stroke-linecap":t.value.style.line.strokeLinecap,"stroke-linejoin":t.value.style.line.strokeLinejoin},null,8,R)):e.createCommentVNode("",!0),!t.value.style.line.smooth&&o.value.length?(e.openBlock(),e.createElementBlock("path",{key:2,d:A.value,stroke:t.value.style.line.useColorTrend?s.value:t.value.style.line.stroke,fill:"none","stroke-width":t.value.style.line.strokeWidth,"stroke-linecap":t.value.style.line.strokeLinecap,"stroke-linejoin":t.value.style.line.strokeLinejoin},null,8,X)):e.createCommentVNode("",!0),p.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("foreignObject",{key:3,height:r.value.height/2,width:r.value.height/2,x:r.value.height/5,y:8},[e.createElementVNode("div",K,[k.value==="positive"?(e.openBlock(),e.createBlock(x.default,{key:0,stroke:s.value,name:"arrowTop",size:r.value.height/2},null,8,["stroke","size"])):e.createCommentVNode("",!0),k.value==="negative"?(e.openBlock(),e.createBlock(x.default,{key:1,stroke:s.value,name:"arrowBottom",size:r.value.height/2},null,8,["stroke","size"])):e.createCommentVNode("",!0),k.value==="neutral"?(e.openBlock(),e.createBlock(x.default,{key:2,stroke:s.value,name:"arrowRight",size:r.value.height/2},null,8,["stroke","size"])):e.createCommentVNode("",!0)])],8,J)),p.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("text",{key:4,x:r.value.height/2-r.value.height/20,y:d.value.bottom,"text-anchor":"middle",fill:t.value.style.trendLabel.useColorTrend?s.value:t.value.style.trendLabel.color,"font-size":t.value.style.trendLabel.fontSize,"font-weight":t.value.style.trendLabel.bold?"bold":"normal"},e.toDisplayString(e.unref(a.dataLabel)({p:f.value>0?"+":"",v:f.value,s:"%",r:t.value.style.trendLabel.rounding})),9,Q)),o.value.length&&o.value.at(-1).x!==void 0?(e.openBlock(),e.createElementBlock("circle",{key:5,stroke:t.value.style.backgroundColor,"stroke-width":2,cx:o.value.at(-1).x,cy:o.value.at(-1).y,r:4,fill:s.value},null,8,Y)):e.createCommentVNode("",!0),o.value.length&&o.value.at(-1).x!==void 0&&t.value.style.dataLabel.show?(e.openBlock(),e.createElementBlock("text",{key:6,"text-anchor":"middle",x:o.value.at(-1).x,y:o.value.at(-1).y-t.value.style.dataLabel.fontSize/1.5,"font-size":t.value.style.dataLabel.fontSize,fill:t.value.style.dataLabel.useColorTrend?s.value:t.value.style.dataLabel.color,"font-weight":t.value.style.dataLabel.bold?"bold":"normal"},e.toDisplayString(e.unref(a.applyDataLabel)(t.value.style.dataLabel.formatter,o.value.at(-1).value,e.unref(a.dataLabel)({p:t.value.style.dataLabel.prefix,v:o.value.at(-1).value,s:t.value.style.dataLabel.suffix,r:t.value.style.dataLabel.rounding}),{datapoint:o.value.at(-1)})),9,ee)):e.createCommentVNode("",!0)],8,D)):(e.openBlock(),e.createBlock(F.default,{key:0,config:{type:"sparkline",style:{backgroundColor:t.value.style.backgroundColor,sparkline:{color:"#CCCCCC"}}}},null,8,["config"])),l.$slots.source?(e.openBlock(),e.createElementBlock("div",te,[e.renderSlot(l.$slots,"source",{},void 0,!0)],512)):e.createCommentVNode("",!0)],12,O))}},ae=q._export_sfc(le,[["__scopeId","data-v-30936343"]]);exports.default=ae;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),o=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),o=require("./index-CsQwCVqU.cjs"),C=require("./useNestedProp-DSYpaLxP.cjs"),V=require("./vue-ui-skeleton-DsRTbz6d.cjs"),D=require("./PackageVersion-BbQFSVXm.cjs"),$=["onClick"],z={key:1},L=["xmlns","viewBox"],P=["id"],A=["stop-color"],F=["stop-color"],O=["height","width","fill","rx"],I=["height","width","fill","rx"],T=["height","width","fill","rx"],q={key:2,ref:"source",dir:"auto"},M={__name:"vue-ui-sparkbar",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}},backgroundOpacity:{type:Number,default:null}},emits:["selectDatapoint"],setup(p,{emit:b}){const n=p,{vue_ui_sparkbar:w}=o.useConfig(),v=e.computed(()=>!!n.dataset&&n.dataset.length),y=e.ref(o.createUid()),t=e.computed({get:()=>f(),set:l=>l});function f(){const l=C.useNestedProp({userConfig:n.config,defaultConfig:w});return l.theme?{...C.useNestedProp({userConfig:o.themes.vue_ui_sparkbar[l.theme]||n.config,defaultConfig:l}),customPalette:o.themePalettes[l.theme]||o.palette}:l}e.watch(()=>n.config,l=>{t.value=f()},{deep:!0});const S=e.computed(()=>o.convertCustomPalette(t.value.customPalette)),c=e.ref(n.dataset.map(l=>({...l,value:t.value.style.animation.show?0:l.value||0,formatter:l.formatter||null}))),g=e.ref(null);e.onMounted(async()=>{o.objectIsEmpty(n.dataset)&&o.error({componentName:"VueUiSparkbar",type:"dataset"}),h()});function h(){if(t.value.style.animation.show){let x=function(){i+=a/l,i<a?(c.value=c.value.map((u,m)=>({...u,value:u.value+=r[m]})),g.value=requestAnimationFrame(x)):c.value=n.dataset.map(u=>({...u,value:u.value||0,formatter:u.formatter||null}))};const l=t.value.style.animation.animationFrames,r=n.dataset.map((u,m)=>u.value/l),a=n.dataset.map(u=>u.value||0).reduce((u,m)=>u+m,0);let i=0;x()}}e.watch(()=>n.dataset,async l=>{cancelAnimationFrame(g.value),c.value=n.dataset.map(r=>({...r,value:t.value.style.animation.show?0:r.value||0,formatter:r.formatter||null})),e.nextTick(h)},{deep:!0});const s=e.ref({width:500,height:16}),N=e.computed(()=>Math.max(...n.dataset.map(l=>l.value))),_=e.computed(()=>(n.dataset.forEach((l,r)=>{o.getMissingDatasetAttributes({datasetObject:l,requiredAttributes:["name","value"]}).forEach(a=>{o.error({componentName:"VueUiSparkbar",type:"datasetSerieAttribute",property:a,index:r})})}),c.value.map((l,r)=>({...l,value:l.value||0,color:o.convertColorToHex(l.color)||S.value[r]||o.palette[r]||o.palette[r%o.palette.length]}))));function B(l){return l/N.value}function k(l){return t.value.style.layout.independant?l.target?l.value/l.target:t.value.style.layout.percentage?l.value>100?1:l.value/100:t.value.style.layout.target===0?1:l.value/t.value.style.layout.target:B(l.value)}function d(l){return t.value.style.layout.independant&&l.target||t.value.style.layout.target}function E(l,r){b("selectDatapoint",{datapoint:l,index:r})}return(l,r)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle({width:"100%",fontFamily:t.value.style.fontFamily,background:n.backgroundOpacity!==null?e.unref(o.setOpacity)(t.value.style.backgroundColor,n.backgroundOpacity):t.value.style.backgroundColor})},[l.$slots.title?e.renderSlot(l.$slots,"title",e.normalizeProps(e.mergeProps({key:0},{title:{...l.title,title:t.value.style.title.text,subtitle:t.value.style.title.subtitle.text}}))):e.createCommentVNode("",!0),!l.$slots.title&&t.value.style.title.text?(e.openBlock(),e.createElementBlock("div",{key:1,class:"vue-ui-sparkbar-title-container",style:e.normalizeStyle({background:t.value.style.title.backgroundColor,margin:t.value.style.title.margin,textAlign:t.value.style.title.textAlign})},[e.createElementVNode("div",{class:"vue-ui-sparkbar-title",style:e.normalizeStyle({fontSize:t.value.style.title.fontSize+"px",color:t.value.style.title.color,fontWeight:t.value.style.title.bold?"bold":"normal"})},e.toDisplayString(t.value.style.title.text),5),t.value.style.title.subtitle.text?(e.openBlock(),e.createElementBlock("div",{key:0,class:"vue-ui-sparkbar-subtitle",style:e.normalizeStyle({fontSize:t.value.style.title.subtitle.fontSize+"px",color:t.value.style.title.subtitle.color,fontWeight:t.value.style.title.subtitle.bold?"bold":"normal"})},e.toDisplayString(t.value.style.title.subtitle.text),5)):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,(a,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[v.value?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(`display:flex !important;${["left","right"].includes(t.value.style.labels.name.position)?`flex-direction: ${t.value.style.labels.name.position==="right"?"row-reverse":"row"} !important`:"flex-direction:column !important"};gap:${t.value.style.gap}px !important;align-items:center;${p.dataset.length>0&&i!==p.dataset.length-1?"margin-bottom:6px":""}`),onClick:()=>E(a,i)},[e.renderSlot(l.$slots,"data-label",e.normalizeProps(e.guardReactiveProps({bar:{...a,target:d(a),valueLabel:e.unref(o.applyDataLabel)(a.formatter,a.value,e.unref(o.dataLabel)({p:a.prefix||"",v:a.value,s:a.suffix||"",r:a.rounding||0}),{datapoint:a,seriesIndex:i}),targetLabel:e.unref(o.applyDataLabel)(a.formatter,d(a),e.unref(o.dataLabel)({p:a.prefix||"",v:d(a),s:a.suffix||"",r:a.rounding||0}),{datapoint:a,seriesIndex:i})}}))),l.$slots["data-label"]?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle({width:t.value.style.labels.name.width,color:t.value.style.labels.name.color,fontSize:t.value.style.labels.fontSize+"px",fontWeight:t.value.style.labels.name.bold?"bold":"normal",textAlign:["left","right"].includes(t.value.style.labels.name.position)||["top","top-left"].includes(t.value.style.labels.name.position)?"left":t.value.style.labels.name.position==="top-center"?"center":"right"})},[e.createElementVNode("span",null,e.toDisplayString(a.name),1),t.value.style.labels.value.show?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle(`font-weight:${t.value.style.labels.value.bold?"bold":"normal"}`)},": "+e.toDisplayString(e.unref(o.applyDataLabel)(a.formatter,a.value,e.unref(o.dataLabel)({p:a.prefix||"",v:a.value,s:a.suffix||"",r:a.rounding||0}),{datapoint:a,seriesIndex:i})),5)):e.createCommentVNode("",!0),t.value.style.layout.showTargetValue?(e.openBlock(),e.createElementBlock("span",z,e.toDisplayString(" "+t.value.style.layout.targetValueText)+" "+e.toDisplayString(e.unref(o.applyDataLabel)(a.formatter,d(a),e.unref(o.dataLabel)({p:a.prefix||"",v:d(a),s:a.suffix||"",r:a.rounding||0}),{datapoint:a,seriesIndex:i})),1)):e.createCommentVNode("",!0)],4)),(e.openBlock(),e.createElementBlock("svg",{xmlns:e.unref(o.XMLNS),viewBox:`0 0 ${s.value.width} ${s.value.height}`,width:"100%"},[e.createVNode(D._sfc_main),e.createElementVNode("defs",null,[e.createElementVNode("linearGradient",{x1:"0%",y1:"0%",x2:"100%",y2:"0%",id:`sparkbar_gradient_${i}_${y.value}`},[e.createElementVNode("stop",{offset:"0%","stop-color":e.unref(o.setOpacity)(e.unref(o.shiftHue)(a.color,.03),100-t.value.style.bar.gradient.intensity)},null,8,A),e.createElementVNode("stop",{offset:"100%","stop-color":a.color},null,8,F)],8,P)]),e.createElementVNode("rect",{height:s.value.height,width:s.value.width,x:0,y:0,fill:e.unref(o.setOpacity)(t.value.style.gutter.backgroundColor,t.value.style.gutter.opacity),rx:s.value.height/2},null,8,O),e.createElementVNode("rect",{height:s.value.height,width:s.value.width*k(a),x:0,y:0,fill:t.value.style.bar.gradient.underlayerColor,rx:s.value.height/2},null,8,I),e.createElementVNode("rect",{height:s.value.height,width:s.value.width*k(a),x:0,y:0,fill:t.value.style.bar.gradient.show?`url(#sparkbar_gradient_${i}_${y.value})`:a.color,rx:s.value.height/2},null,8,T)],8,L))],12,$)):e.createCommentVNode("",!0)],64))),256)),l.$slots.source?(e.openBlock(),e.createElementBlock("div",q,[e.renderSlot(l.$slots,"source")],512)):e.createCommentVNode("",!0),v.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(V.default,{key:3,config:{type:"sparkbar",style:{backgroundColor:t.value.style.backgroundColor,sparkbar:{color:"#CCCCCC"}}}},null,8,["config"]))],4))}};exports.default=M;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { computed as g, ref as x, watch as z, onMounted as q, nextTick as H, openBlock as n, createElementBlock as v, normalizeStyle as f, unref as s, renderSlot as b, normalizeProps as L, mergeProps as X, createCommentVNode as c, createElementVNode as d, toDisplayString as p, Fragment as O, renderList as R, guardReactiveProps as J, createVNode as K, createBlock as Q } from "vue";
|
|
2
|
-
import { u as Y, c as Z, t as ee, a as te, p as k, b as le, o as ae, e as T, g as oe, d as se, s as $, i as w, f as _, X as ue, w as ne } from "./index-
|
|
3
|
-
import { u as V } from "./useNestedProp-
|
|
4
|
-
import ie from "./vue-ui-skeleton-
|
|
5
|
-
import { _ as re } from "./PackageVersion-
|
|
2
|
+
import { u as Y, c as Z, t as ee, a as te, p as k, b as le, o as ae, e as T, g as oe, d as se, s as $, i as w, f as _, X as ue, w as ne } from "./index-hV0hU1iE.js";
|
|
3
|
+
import { u as V } from "./useNestedProp-CRAUOmT5.js";
|
|
4
|
+
import ie from "./vue-ui-skeleton-BY8Jg9a_.js";
|
|
5
|
+
import { _ as re } from "./PackageVersion-wqab02xF.js";
|
|
6
6
|
const ve = ["onClick"], ce = { key: 1 }, de = ["xmlns", "viewBox"], fe = ["id"], pe = ["stop-color"], ye = ["stop-color"], me = ["height", "width", "fill", "rx"], ge = ["height", "width", "fill", "rx"], he = ["height", "width", "fill", "rx"], xe = {
|
|
7
7
|
key: 2,
|
|
8
8
|
ref: "source",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { computed as s, onMounted as N, ref as A, watch as M, openBlock as n, createElementBlock as i, normalizeStyle as m, toDisplayString as y, createCommentVNode as v, unref as c, createVNode as D, createElementVNode as d, normalizeClass as E, createBlock as G, renderSlot as I } from "vue";
|
|
2
|
-
import { u as U, o as q, e as S, g as P, c as R, t as T, N as X, X as H, i as V, v as p, f as Y } from "./index-
|
|
3
|
-
import { u as z } from "./useNestedProp-
|
|
4
|
-
import J from "./vue-ui-skeleton-
|
|
5
|
-
import { _ as K } from "./PackageVersion-
|
|
2
|
+
import { u as U, o as q, e as S, g as P, c as R, t as T, N as X, X as H, i as V, v as p, f as Y } from "./index-hV0hU1iE.js";
|
|
3
|
+
import { u as z } from "./useNestedProp-CRAUOmT5.js";
|
|
4
|
+
import J from "./vue-ui-skeleton-BY8Jg9a_.js";
|
|
5
|
+
import { _ as K } from "./PackageVersion-wqab02xF.js";
|
|
6
6
|
const Q = ["xmlns", "viewBox"], W = ["id"], Z = ["stop-color"], ee = ["stop-color"], te = ["d", "stroke", "stroke-linecap"], ae = ["d", "stroke", "stroke-linecap", "stroke-dashoffset"], le = ["x", "y", "font-size", "fill", "font-weight"], oe = {
|
|
7
7
|
key: 4,
|
|
8
8
|
ref: "source",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),s=require("./index-CsQwCVqU.cjs"),b=require("./useNestedProp-DSYpaLxP.cjs"),$=require("./vue-ui-skeleton-DsRTbz6d.cjs"),w=require("./PackageVersion-BbQFSVXm.cjs"),S=["xmlns","viewBox"],L=["id"],B=["stop-color"],E=["stop-color"],M=["d","stroke","stroke-linecap"],z=["d","stroke","stroke-linecap","stroke-dashoffset"],V=["x","y","font-size","fill","font-weight"],A={key:4,ref:"source",dir:"auto"},q={__name:"vue-ui-sparkgauge",props:{config:{type:Object,default(){return{}}},dataset:{type:Object,default(){return{}}}},setup(C){const o=C,{vue_ui_sparkgauge:_}=s.useConfig(),c=e.computed(()=>!!o.dataset&&Object.keys(o.dataset).length);e.onMounted(()=>{d()});function d(){s.objectIsEmpty(o.dataset)?s.error({componentName:"VueUiSparkgauge",type:"dataset"}):s.getMissingDatasetAttributes({datasetObject:o.dataset,requiredAttributes:["value","min","max"]}).forEach(a=>{s.error({componentName:"VueUiSparkgauge",type:"datasetAttribute",property:a})})}const v=e.ref(s.createUid()),t=e.computed({get:()=>m(),set:a=>a});function m(){const a=b.useNestedProp({userConfig:o.config,defaultConfig:_});return a.theme?{...b.useNestedProp({userConfig:s.themes.vue_ui_sparkgauge[a.theme]||o.config,defaultConfig:a})}:a}e.watch(()=>o.config,a=>{t.value=m(),d()},{deep:!0});const u=e.computed(()=>({height:t.value.style.height,width:128,base:t.value.style.basePosition})),n=e.computed(()=>{const a=o.dataset.min??0,r=o.dataset.max??0,N=r-a;return{min:a,max:r,diff:N}}),l=e.ref(t.value.style.animation.show?n.value.min:o.dataset.value);e.watch(()=>o.dataset.value,()=>{y(o.dataset.value||0)});const f=e.computed(()=>l.value>n.value.max?n.value.max:l.value<n.value.min?n.value.min:l.value),p=e.computed(()=>n.value.diff/t.value.style.animation.speedMs);e.onMounted(()=>{y(o.dataset.value||0)});function y(a){function r(){l.value<a?l.value=Math.min(l.value+p.value,a):l.value>a&&(l.value=Math.max(l.value-p.value,a)),l.value!==a&&requestAnimationFrame(r)}r()}const i=e.computed(()=>o.dataset.title??""),g=e.computed(()=>l.value>=0?(f.value-n.value.min)/n.value.diff:(Math.abs(n.value.min)-Math.abs(f.value))/n.value.diff),k=e.computed(()=>s.interpolateColorHex(t.value.style.colors.min,t.value.style.colors.max,n.value.min,n.value.max,l.value)),h=e.computed(()=>t.value.style.dataLabel.autoColor?k.value:t.value.style.dataLabel.color),x=e.computed(()=>t.value.style.track.autoColor?k.value:t.value.style.track.color);return(a,r)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(`font-family:${t.value.style.fontFamily};width: 100%; background:${t.value.style.background}`)},[t.value.style.title.show&&i.value&&t.value.style.title.position==="top"?(e.openBlock(),e.createElementBlock("div",{key:0,class:"vue-data-ui-sparkgauge-label",style:e.normalizeStyle(`font-size:${t.value.style.title.fontSize}px;text-align:${t.value.style.title.textAlign};font-weight:${t.value.style.title.bold?"bold":"normal"};color:${t.value.style.title.color}`)},e.toDisplayString(i.value),5)):e.createCommentVNode("",!0),c.value?(e.openBlock(),e.createElementBlock("svg",{key:1,xmlns:e.unref(s.XMLNS),viewBox:`0 0 ${u.value.width} ${u.value.height}`,style:"overflow: visible; background:transparent; width:100%;"},[e.createVNode(w._sfc_main),e.createElementVNode("defs",null,[e.createElementVNode("linearGradient",{id:`gradient_${v.value}`,x1:"-10%",y1:"100%",x2:"110%",y2:"100%"},[e.createElementVNode("stop",{offset:"0%","stop-color":t.value.style.colors.min},null,8,B),e.createElementVNode("stop",{offset:"100%","stop-color":t.value.style.colors.max},null,8,E)],8,L)]),e.createElementVNode("path",{d:`M10 ${u.value.base} A 1 1 0 1 1 118 ${u.value.base}`,stroke:t.value.style.gutter.color,"stroke-width":8,"stroke-linecap":t.value.style.gutter.strokeLinecap,fill:"none"},null,8,M),g.value!==0?(e.openBlock(),e.createElementBlock("path",{key:0,d:`M10 ${u.value.base} A 1 1 0 1 1 118 ${u.value.base}`,stroke:t.value.style.colors.showGradient?`url(#gradient_${v.value})`:x.value,"stroke-width":8,"stroke-linecap":t.value.style.track.strokeLinecap,fill:"none","stroke-dasharray":169.5,"stroke-dashoffset":169.5-169.5*g.value,class:e.normalizeClass({"vue-ui-sparkgauge-track":t.value.style.animation.show}),style:e.normalizeStyle(t.value.style.animation.show?`animation: vue-ui-sparkgauge-animation ${t.value.style.animation.speedMs}ms ease-in;`:"")},null,14,z)):e.createCommentVNode("",!0),e.createElementVNode("text",{"text-anchor":"middle",x:u.value.width/2,y:u.value.base+6+t.value.style.dataLabel.offsetY,"font-size":t.value.style.dataLabel.fontSize,fill:h.value,"font-weight":t.value.style.dataLabel.bold?"bold":"normal"},e.toDisplayString(e.unref(s.applyDataLabel)(t.value.style.dataLabel.formatter,e.unref(s.checkNaN)(l.value),e.unref(s.dataLabel)({p:t.value.style.dataLabel.prefix,v:e.unref(s.checkNaN)(l.value),s:t.value.style.dataLabel.suffix,r:t.value.style.dataLabel.rounding}),{datapoint:e.unref(s.checkNaN)(l.value),color:h.value})),9,V)],8,S)):e.createCommentVNode("",!0),c.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock($.default,{key:2,config:{type:"gauge",style:{backgroundColor:t.value.style.background,gauge:{color:"#CCCCCC"}}}},null,8,["config"])),t.value.style.title.show&&i.value&&t.value.style.title.position==="bottom"?(e.openBlock(),e.createElementBlock("div",{key:3,class:"vue-data-ui-sparkgauge-label",style:e.normalizeStyle(`font-size:${t.value.style.title.fontSize}px;text-align:${t.value.style.title.textAlign};font-weight:${t.value.style.title.bold?"bold":"normal"};font-weight:${t.value.style.title.bold?"bold":"normal"};color:${t.value.style.title.color}`)},e.toDisplayString(i.value),5)):e.createCommentVNode("",!0),a.$slots.source?(e.openBlock(),e.createElementBlock("div",A,[e.renderSlot(a.$slots,"source")],512)):e.createCommentVNode("",!0)],4))}};exports.default=q;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useCssVars as J, computed as _, onMounted as K, ref as N, watch as Q, openBlock as a, createElementBlock as s, normalizeStyle as $, createElementVNode as y, createTextVNode as Z, toDisplayString as g, unref as n, createCommentVNode as h, createVNode as ee, Fragment as f, renderList as p, normalizeClass as D, createBlock as I, renderSlot as te } from "vue";
|
|
2
|
-
import { u as le, o as ae, e as V, g as se, c as oe, t as ue, s as m, i as H, f as E, X as re, w as z } from "./index-
|
|
3
|
-
import { u as F } from "./useNestedProp-
|
|
4
|
-
import { _ as ie } from "./Shape-
|
|
5
|
-
import ne from "./vue-ui-skeleton-
|
|
6
|
-
import { _ as ve } from "./PackageVersion-
|
|
2
|
+
import { u as le, o as ae, e as V, g as se, c as oe, t as ue, s as m, i as H, f as E, X as re, w as z } from "./index-hV0hU1iE.js";
|
|
3
|
+
import { u as F } from "./useNestedProp-CRAUOmT5.js";
|
|
4
|
+
import { _ as ie } from "./Shape-QdnXSUyn.js";
|
|
5
|
+
import ne from "./vue-ui-skeleton-BY8Jg9a_.js";
|
|
6
|
+
import { _ as ve } from "./PackageVersion-wqab02xF.js";
|
|
7
7
|
import { _ as de } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
8
8
|
const ce = { key: 0 }, ye = { key: 1 }, he = ["xmlns", "viewBox"], fe = ["id"], pe = ["stop-color"], ge = ["stop-color"], me = ["id"], be = ["stop-color"], _e = ["stop-color"], xe = ["id"], ke = ["stop-color"], we = ["stop-color"], $e = { key: 0 }, Ce = ["x", "y", "height", "width", "fill", "stroke", "stroke-width", "rx"], Le = { key: 1 }, ze = ["x", "y", "font-size", "font-weight", "fill"], Se = ["x", "y", "font-size", "fill"], Me = ["x", "y", "font-size", "fill"], Ae = ["height", "width", "x", "onMouseover", "stroke", "stroke-width", "rx", "stroke-dasharray", "onClick"], Ne = {
|
|
9
9
|
key: 2,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./index-DsF7Aej7.cjs"),_=require("./useNestedProp-D0YHk8Cd.cjs"),F=require("./Shape-BmBZkR94.cjs"),M=require("./vue-ui-skeleton-e8hBgzZq.cjs"),O=require("./PackageVersion-BjoP5ypd.cjs"),A=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),H={key:0},q={key:1},I=["xmlns","viewBox"],U=["id"],W=["stop-color"],P=["stop-color"],j=["id"],G=["stop-color"],T=["stop-color"],X=["id"],Y=["stop-color"],R=["stop-color"],J={key:0},K=["x","y","height","width","fill","stroke","stroke-width","rx"],Q={key:1},Z=["x","y","font-size","font-weight","fill"],ee=["x","y","font-size","fill"],te=["x","y","font-size","fill"],le=["height","width","x","onMouseover","stroke","stroke-width","rx","stroke-dasharray","onClick"],oe={key:2,ref:"source",dir:"auto"},ae={__name:"vue-ui-sparkhistogram",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:["selectDatapoint"],setup(x,{emit:B}){const i=x;e.useCssVars(o=>({"3d57fabd":S.value}));const{vue_ui_sparkhistogram:E}=a.useConfig(),h=e.computed(()=>!!i.dataset&&i.dataset.length);e.onMounted(()=>{k()});function k(){a.objectIsEmpty(i.dataset)?a.error({componentName:"VueUiSparkHistogram",type:"dataset"}):i.dataset.forEach((o,r)=>{a.getMissingDatasetAttributes({datasetObject:o,requiredAttributes:["value"]}).forEach(l=>{a.error({componentName:"VueUiSparkHistogram",type:"datasetSerieAttribute",property:l,index:r})})})}const v=e.ref(a.createUid()),t=e.computed({get:()=>b(),set:o=>o});function b(){const o=_.useNestedProp({userConfig:i.config,defaultConfig:E});return o.theme?{..._.useNestedProp({userConfig:a.themes.vue_ui_sparkhistogram[o.theme]||i.config,defaultConfig:o})}:o}e.watch(()=>i.config,o=>{t.value=b(),k()},{deep:!0});const c=e.computed(()=>{const o=t.value.style.layout.height,r=t.value.style.layout.width,l=t.value.style.layout.padding.top,s=o-t.value.style.layout.padding.bottom,d=t.value.style.layout.padding.left,y=r-t.value.style.layout.padding.right,p=l+(o-l-t.value.style.layout.padding.bottom)/2,f=o-t.value.style.layout.padding.top-t.value.style.layout.padding.bottom,m=r-t.value.style.layout.padding.left-t.value.style.layout.padding.right;return{bottom:s,centerY:p,drawingHeight:f,drawingWidth:m,height:o,left:d,right:y,top:l,width:r}}),w=e.computed(()=>Math.max(...i.dataset.map(o=>Math.abs(o.value||0))));function C(o){return Math.abs(o)/w.value}const u=e.computed(()=>i.dataset.map((o,r)=>{const l=C(o.value||0),s=c.value.drawingHeight*l,d=c.value.drawingWidth/i.dataset.length,y=d*(t.value.style.bars.gap/100),p=d-y,f=c.value.centerY-s/2,m=c.value.left+(y/2+r*d),L=c.value.left+r*d,g=typeof o.intensity>"u"?100:Math.round(o.intensity*100),N=o.color?o.color:o.value>=0?a.setOpacity(t.value.style.bars.colors.positive,g):a.setOpacity(t.value.style.bars.colors.negative,g),V=o.color?o.color:o.value>=0?t.value.style.bars.colors.positive:t.value.style.bars.colors.negative,z=o.color?`url(#gradient_datapoint_${r}_${v.value})`:o.value>=0?`url(#gradient_positive_${r}_${v.value})`:`url(#gradient_negative_${r}_${v.value})`,D=m+p/2;return{...o,color:N,gradient:z,height:s,intensity:g,proportion:l,stroke:V,textAnchor:D,trapX:L,unitWidth:d,width:p,x:m,y:f}})),n=e.ref(null);function $(o,r){B("selectDatapoint",{datapoint:o,index:r})}const S=e.computed(()=>`${t.value.style.animation.speedMs}ms`);return(o,r)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(`width:100%;background:${t.value.style.backgroundColor};font-family:${t.value.style.fontFamily}`),onMouseleave:r[1]||(r[1]=l=>n.value=null)},[t.value.style.title.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(`width:calc(100% - 12px);background:transparent;margin:0 auto;margin:${t.value.style.title.margin};padding: 0 6px;text-align:${t.value.style.title.textAlign}`)},[e.createElementVNode("div",{style:e.normalizeStyle(`font-size:${t.value.style.title.fontSize}px;color:${t.value.style.title.color};font-weight:${t.value.style.title.bold?"bold":"normal"}`)},[e.createTextVNode(e.toDisplayString(t.value.style.title.text)+" ",1),n.value!==null?(e.openBlock(),e.createElementBlock("span",H,"- "+e.toDisplayString(u.value[n.value].timeLabel||"")+" "+e.toDisplayString(e.unref(a.applyDataLabel)(t.value.style.labels.value.formatter,u.value[n.value].value,e.unref(a.dataLabel)({p:t.value.style.labels.value.prefix,v:u.value[n.value].value,s:t.value.style.labels.value.suffix,r:t.value.style.labels.value.rounding}),{datapoint:u.value[n.value],seriesIndex:n.value})),1)):e.createCommentVNode("",!0),![void 0,null].includes(n.value)&&![null,void 0].includes(u.value[n.value].valueLabel)?(e.openBlock(),e.createElementBlock("span",q,"("+e.toDisplayString(u.value[n.value].valueLabel||0)+")",1)):e.createCommentVNode("",!0)],4),t.value.style.title.subtitle.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(`font-size:${t.value.style.title.subtitle.fontSize}px;color:${t.value.style.title.subtitle.color};font-weight:${t.value.style.title.subtitle.bold?"bold":"normal"}`)},e.toDisplayString(t.value.style.title.subtitle.text),5)):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),h.value?(e.openBlock(),e.createElementBlock("svg",{key:1,xmlns:e.unref(a.XMLNS),viewBox:`0 0 ${c.value.width} ${c.value.height}`,style:{overflow:"visible"}},[e.createVNode(O._sfc_main),e.createElementVNode("defs",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(l,s)=>(e.openBlock(),e.createElementBlock("radialGradient",{id:`gradient_positive_${s}_${v.value}`,cy:"50%",cx:"50%",r:"50%",fx:"50%",fy:"50%"},[e.createElementVNode("stop",{offset:"0%","stop-color":e.unref(a.setOpacity)(e.unref(a.shiftHue)(t.value.style.bars.colors.positive,.05),l.intensity)},null,8,W),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(a.setOpacity)(t.value.style.bars.colors.positive,l.intensity)},null,8,P)],8,U))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(l,s)=>(e.openBlock(),e.createElementBlock("radialGradient",{id:`gradient_negative_${s}_${v.value}`,cy:"50%",cx:"50%",r:"50%",fx:"50%",fy:"50%"},[e.createElementVNode("stop",{offset:"0%","stop-color":e.unref(a.setOpacity)(e.unref(a.shiftHue)(t.value.style.bars.colors.negative,.05),l.intensity)},null,8,G),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(a.setOpacity)(t.value.style.bars.colors.negative,l.intensity)},null,8,T)],8,j))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(l,s)=>(e.openBlock(),e.createElementBlock("radialGradient",{id:`gradient_datapoint_${s}_${v.value}`,cy:"50%",cx:"50%",r:"50%",fx:"50%",fy:"50%"},[e.createElementVNode("stop",{offset:"0%","stop-color":e.unref(a.setOpacity)(e.unref(a.shiftHue)(l.color,.05),l.intensity)},null,8,Y),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(a.setOpacity)(l.color,l.intensity)},null,8,R)],8,X))),256))]),!t.value.style.bars.shape||t.value.style.bars.shape==="square"?(e.openBlock(),e.createElementBlock("g",J,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(l,s)=>(e.openBlock(),e.createElementBlock("rect",{x:l.x,y:l.y,height:l.height,width:l.width,fill:t.value.style.bars.colors.gradient.show?l.gradient:l.color,stroke:l.stroke,"stroke-width":t.value.style.bars.strokeWidth,rx:`${t.value.style.bars.borderRadius*l.proportion/12}%`,class:e.normalizeClass({"vue-ui-sparkhistogram-shape":t.value.style.animation.show})},null,10,K))),256))])):(e.openBlock(),e.createElementBlock("g",Q,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(l,s)=>(e.openBlock(),e.createBlock(F._sfc_main,{plot:{x:l.x+l.width/2,y:l.y+l.height/2},color:t.value.style.bars.colors.gradient.show?l.gradient:l.color,shape:t.value.style.bars.shape,radius:l.height*.4,class:e.normalizeClass({"vue-ui-sparkhistogram-shape":t.value.style.animation.show})},null,8,["plot","color","shape","radius","class"]))),256))])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(l,s)=>(e.openBlock(),e.createElementBlock("text",{"text-anchor":"middle",x:l.textAnchor,y:l.y-t.value.style.labels.value.fontSize/3+t.value.style.labels.value.offsetY,"font-size":t.value.style.labels.value.fontSize,"font-weight":t.value.style.labels.value.bold?"bold":"normal",fill:t.value.style.labels.value.color},e.toDisplayString(e.unref(a.applyDataLabel)(t.value.style.labels.value.formatter,l.value,e.unref(a.dataLabel)({p:t.value.style.labels.value.prefix,v:l.value,s:t.value.style.labels.value.suffix,r:t.value.style.labels.value.rounding}),{datapoint:u.value[n.value],seriesIndex:n.value})),9,Z))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(l,s)=>(e.openBlock(),e.createElementBlock("g",null,[l.valueLabel?(e.openBlock(),e.createElementBlock("text",{key:0,x:l.textAnchor,y:l.y+l.height+t.value.style.labels.valueLabel.fontSize,"font-size":t.value.style.labels.valueLabel.fontSize,"text-anchor":"middle",fill:t.value.style.labels.valueLabel.color},e.toDisplayString(l.valueLabel),9,ee)):e.createCommentVNode("",!0)]))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(l,s)=>(e.openBlock(),e.createElementBlock("g",null,[l.timeLabel?(e.openBlock(),e.createElementBlock("text",{key:0,x:l.textAnchor,y:c.value.height-t.value.style.labels.timeLabel.fontSize/2,"font-size":t.value.style.labels.timeLabel.fontSize,fill:t.value.style.labels.timeLabel.color,"text-anchor":"middle"},e.toDisplayString(l.timeLabel),9,te)):e.createCommentVNode("",!0)]))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(l,s)=>(e.openBlock(),e.createElementBlock("g",null,[e.createElementVNode("rect",{height:c.value.height,width:l.unitWidth,fill:"transparent",x:l.trapX,y:0,onMouseover:d=>n.value=s,onMouseleave:r[0]||(r[0]=d=>n.value=null),stroke:n.value!==null&&n.value===s?t.value.style.selector.stroke:"","stroke-width":n.value!==null&&n.value===s?t.value.style.selector.strokeWidth:0,rx:t.value.style.selector.borderRadius,"stroke-dasharray":t.value.style.selector.strokeDasharray,onClick:()=>$(l,s)},null,40,le)]))),256))],8,I)):e.createCommentVNode("",!0),o.$slots.source?(e.openBlock(),e.createElementBlock("div",oe,[e.renderSlot(o.$slots,"source",{},void 0,!0)],512)):e.createCommentVNode("",!0),h.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(M.default,{key:3,config:{type:"sparkHistogram",style:{backgroundColor:t.value.style.backgroundColor,sparkHistogram:{color:"#CCCCCC"}}}},null,8,["config"]))],36))}},se=A._export_sfc(ae,[["__scopeId","data-v-4e962555"]]);exports.default=se;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./index-CsQwCVqU.cjs"),_=require("./useNestedProp-DSYpaLxP.cjs"),F=require("./Shape-CJbFv4bs.cjs"),M=require("./vue-ui-skeleton-DsRTbz6d.cjs"),O=require("./PackageVersion-BbQFSVXm.cjs"),A=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),H={key:0},q={key:1},I=["xmlns","viewBox"],U=["id"],W=["stop-color"],P=["stop-color"],j=["id"],G=["stop-color"],T=["stop-color"],X=["id"],Y=["stop-color"],R=["stop-color"],J={key:0},K=["x","y","height","width","fill","stroke","stroke-width","rx"],Q={key:1},Z=["x","y","font-size","font-weight","fill"],ee=["x","y","font-size","fill"],te=["x","y","font-size","fill"],le=["height","width","x","onMouseover","stroke","stroke-width","rx","stroke-dasharray","onClick"],oe={key:2,ref:"source",dir:"auto"},ae={__name:"vue-ui-sparkhistogram",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:["selectDatapoint"],setup(x,{emit:B}){const i=x;e.useCssVars(o=>({"3d57fabd":S.value}));const{vue_ui_sparkhistogram:E}=a.useConfig(),h=e.computed(()=>!!i.dataset&&i.dataset.length);e.onMounted(()=>{k()});function k(){a.objectIsEmpty(i.dataset)?a.error({componentName:"VueUiSparkHistogram",type:"dataset"}):i.dataset.forEach((o,r)=>{a.getMissingDatasetAttributes({datasetObject:o,requiredAttributes:["value"]}).forEach(l=>{a.error({componentName:"VueUiSparkHistogram",type:"datasetSerieAttribute",property:l,index:r})})})}const v=e.ref(a.createUid()),t=e.computed({get:()=>b(),set:o=>o});function b(){const o=_.useNestedProp({userConfig:i.config,defaultConfig:E});return o.theme?{..._.useNestedProp({userConfig:a.themes.vue_ui_sparkhistogram[o.theme]||i.config,defaultConfig:o})}:o}e.watch(()=>i.config,o=>{t.value=b(),k()},{deep:!0});const c=e.computed(()=>{const o=t.value.style.layout.height,r=t.value.style.layout.width,l=t.value.style.layout.padding.top,s=o-t.value.style.layout.padding.bottom,d=t.value.style.layout.padding.left,y=r-t.value.style.layout.padding.right,p=l+(o-l-t.value.style.layout.padding.bottom)/2,f=o-t.value.style.layout.padding.top-t.value.style.layout.padding.bottom,m=r-t.value.style.layout.padding.left-t.value.style.layout.padding.right;return{bottom:s,centerY:p,drawingHeight:f,drawingWidth:m,height:o,left:d,right:y,top:l,width:r}}),w=e.computed(()=>Math.max(...i.dataset.map(o=>Math.abs(o.value||0))));function C(o){return Math.abs(o)/w.value}const u=e.computed(()=>i.dataset.map((o,r)=>{const l=C(o.value||0),s=c.value.drawingHeight*l,d=c.value.drawingWidth/i.dataset.length,y=d*(t.value.style.bars.gap/100),p=d-y,f=c.value.centerY-s/2,m=c.value.left+(y/2+r*d),L=c.value.left+r*d,g=typeof o.intensity>"u"?100:Math.round(o.intensity*100),N=o.color?o.color:o.value>=0?a.setOpacity(t.value.style.bars.colors.positive,g):a.setOpacity(t.value.style.bars.colors.negative,g),V=o.color?o.color:o.value>=0?t.value.style.bars.colors.positive:t.value.style.bars.colors.negative,z=o.color?`url(#gradient_datapoint_${r}_${v.value})`:o.value>=0?`url(#gradient_positive_${r}_${v.value})`:`url(#gradient_negative_${r}_${v.value})`,D=m+p/2;return{...o,color:N,gradient:z,height:s,intensity:g,proportion:l,stroke:V,textAnchor:D,trapX:L,unitWidth:d,width:p,x:m,y:f}})),n=e.ref(null);function $(o,r){B("selectDatapoint",{datapoint:o,index:r})}const S=e.computed(()=>`${t.value.style.animation.speedMs}ms`);return(o,r)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(`width:100%;background:${t.value.style.backgroundColor};font-family:${t.value.style.fontFamily}`),onMouseleave:r[1]||(r[1]=l=>n.value=null)},[t.value.style.title.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(`width:calc(100% - 12px);background:transparent;margin:0 auto;margin:${t.value.style.title.margin};padding: 0 6px;text-align:${t.value.style.title.textAlign}`)},[e.createElementVNode("div",{style:e.normalizeStyle(`font-size:${t.value.style.title.fontSize}px;color:${t.value.style.title.color};font-weight:${t.value.style.title.bold?"bold":"normal"}`)},[e.createTextVNode(e.toDisplayString(t.value.style.title.text)+" ",1),n.value!==null?(e.openBlock(),e.createElementBlock("span",H,"- "+e.toDisplayString(u.value[n.value].timeLabel||"")+" "+e.toDisplayString(e.unref(a.applyDataLabel)(t.value.style.labels.value.formatter,u.value[n.value].value,e.unref(a.dataLabel)({p:t.value.style.labels.value.prefix,v:u.value[n.value].value,s:t.value.style.labels.value.suffix,r:t.value.style.labels.value.rounding}),{datapoint:u.value[n.value],seriesIndex:n.value})),1)):e.createCommentVNode("",!0),![void 0,null].includes(n.value)&&![null,void 0].includes(u.value[n.value].valueLabel)?(e.openBlock(),e.createElementBlock("span",q,"("+e.toDisplayString(u.value[n.value].valueLabel||0)+")",1)):e.createCommentVNode("",!0)],4),t.value.style.title.subtitle.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(`font-size:${t.value.style.title.subtitle.fontSize}px;color:${t.value.style.title.subtitle.color};font-weight:${t.value.style.title.subtitle.bold?"bold":"normal"}`)},e.toDisplayString(t.value.style.title.subtitle.text),5)):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),h.value?(e.openBlock(),e.createElementBlock("svg",{key:1,xmlns:e.unref(a.XMLNS),viewBox:`0 0 ${c.value.width} ${c.value.height}`,style:{overflow:"visible"}},[e.createVNode(O._sfc_main),e.createElementVNode("defs",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(l,s)=>(e.openBlock(),e.createElementBlock("radialGradient",{id:`gradient_positive_${s}_${v.value}`,cy:"50%",cx:"50%",r:"50%",fx:"50%",fy:"50%"},[e.createElementVNode("stop",{offset:"0%","stop-color":e.unref(a.setOpacity)(e.unref(a.shiftHue)(t.value.style.bars.colors.positive,.05),l.intensity)},null,8,W),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(a.setOpacity)(t.value.style.bars.colors.positive,l.intensity)},null,8,P)],8,U))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(l,s)=>(e.openBlock(),e.createElementBlock("radialGradient",{id:`gradient_negative_${s}_${v.value}`,cy:"50%",cx:"50%",r:"50%",fx:"50%",fy:"50%"},[e.createElementVNode("stop",{offset:"0%","stop-color":e.unref(a.setOpacity)(e.unref(a.shiftHue)(t.value.style.bars.colors.negative,.05),l.intensity)},null,8,G),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(a.setOpacity)(t.value.style.bars.colors.negative,l.intensity)},null,8,T)],8,j))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(l,s)=>(e.openBlock(),e.createElementBlock("radialGradient",{id:`gradient_datapoint_${s}_${v.value}`,cy:"50%",cx:"50%",r:"50%",fx:"50%",fy:"50%"},[e.createElementVNode("stop",{offset:"0%","stop-color":e.unref(a.setOpacity)(e.unref(a.shiftHue)(l.color,.05),l.intensity)},null,8,Y),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(a.setOpacity)(l.color,l.intensity)},null,8,R)],8,X))),256))]),!t.value.style.bars.shape||t.value.style.bars.shape==="square"?(e.openBlock(),e.createElementBlock("g",J,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(l,s)=>(e.openBlock(),e.createElementBlock("rect",{x:l.x,y:l.y,height:l.height,width:l.width,fill:t.value.style.bars.colors.gradient.show?l.gradient:l.color,stroke:l.stroke,"stroke-width":t.value.style.bars.strokeWidth,rx:`${t.value.style.bars.borderRadius*l.proportion/12}%`,class:e.normalizeClass({"vue-ui-sparkhistogram-shape":t.value.style.animation.show})},null,10,K))),256))])):(e.openBlock(),e.createElementBlock("g",Q,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(l,s)=>(e.openBlock(),e.createBlock(F._sfc_main,{plot:{x:l.x+l.width/2,y:l.y+l.height/2},color:t.value.style.bars.colors.gradient.show?l.gradient:l.color,shape:t.value.style.bars.shape,radius:l.height*.4,class:e.normalizeClass({"vue-ui-sparkhistogram-shape":t.value.style.animation.show})},null,8,["plot","color","shape","radius","class"]))),256))])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(l,s)=>(e.openBlock(),e.createElementBlock("text",{"text-anchor":"middle",x:l.textAnchor,y:l.y-t.value.style.labels.value.fontSize/3+t.value.style.labels.value.offsetY,"font-size":t.value.style.labels.value.fontSize,"font-weight":t.value.style.labels.value.bold?"bold":"normal",fill:t.value.style.labels.value.color},e.toDisplayString(e.unref(a.applyDataLabel)(t.value.style.labels.value.formatter,l.value,e.unref(a.dataLabel)({p:t.value.style.labels.value.prefix,v:l.value,s:t.value.style.labels.value.suffix,r:t.value.style.labels.value.rounding}),{datapoint:u.value[n.value],seriesIndex:n.value})),9,Z))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(l,s)=>(e.openBlock(),e.createElementBlock("g",null,[l.valueLabel?(e.openBlock(),e.createElementBlock("text",{key:0,x:l.textAnchor,y:l.y+l.height+t.value.style.labels.valueLabel.fontSize,"font-size":t.value.style.labels.valueLabel.fontSize,"text-anchor":"middle",fill:t.value.style.labels.valueLabel.color},e.toDisplayString(l.valueLabel),9,ee)):e.createCommentVNode("",!0)]))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(l,s)=>(e.openBlock(),e.createElementBlock("g",null,[l.timeLabel?(e.openBlock(),e.createElementBlock("text",{key:0,x:l.textAnchor,y:c.value.height-t.value.style.labels.timeLabel.fontSize/2,"font-size":t.value.style.labels.timeLabel.fontSize,fill:t.value.style.labels.timeLabel.color,"text-anchor":"middle"},e.toDisplayString(l.timeLabel),9,te)):e.createCommentVNode("",!0)]))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(l,s)=>(e.openBlock(),e.createElementBlock("g",null,[e.createElementVNode("rect",{height:c.value.height,width:l.unitWidth,fill:"transparent",x:l.trapX,y:0,onMouseover:d=>n.value=s,onMouseleave:r[0]||(r[0]=d=>n.value=null),stroke:n.value!==null&&n.value===s?t.value.style.selector.stroke:"","stroke-width":n.value!==null&&n.value===s?t.value.style.selector.strokeWidth:0,rx:t.value.style.selector.borderRadius,"stroke-dasharray":t.value.style.selector.strokeDasharray,onClick:()=>$(l,s)},null,40,le)]))),256))],8,I)):e.createCommentVNode("",!0),o.$slots.source?(e.openBlock(),e.createElementBlock("div",oe,[e.renderSlot(o.$slots,"source",{},void 0,!0)],512)):e.createCommentVNode("",!0),h.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(M.default,{key:3,config:{type:"sparkHistogram",style:{backgroundColor:t.value.style.backgroundColor,sparkHistogram:{color:"#CCCCCC"}}}},null,8,["config"]))],36))}},se=A._export_sfc(ae,[["__scopeId","data-v-4e962555"]]);exports.default=se;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("./index-DsF7Aej7.cjs"),M=require("./useNestedProp-D0YHk8Cd.cjs"),G=require("./vue-ui-skeleton-e8hBgzZq.cjs"),z=require("./useResponsive-BJ7DTGpm.cjs"),R=require("./PackageVersion-BjoP5ypd.cjs"),H=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),U=["id"],X=["xmlns","viewBox"],Z=["id"],Y=["stop-color"],J=["stop-color"],K=["id"],Q=["stop-color"],ee=["stop-color"],te=["id"],le=["stop-color"],ae=["stop-color"],oe={key:0},re=["d","fill"],ue=["d","fill"],ne=["d","stroke","stroke-width"],se=["x1","x2","y1","y2","stroke","stroke-width"],ie=["x","y","width","height","fill","rx"],de=["x1","x2","y1","y2","stroke","stroke-width","stroke-dasharray"],ce=["x1","x2","y1","y2","stroke","stroke-dasharray","stroke-width"],ve=["cx","cy","r","fill","stroke","stroke-width"],he=["x","y","font-size","font-weight","fill"],ye=["x","y","height","width","onMouseenter","onClick"],pe={__name:"vue-ui-sparkline",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}},showInfo:{type:Boolean,default:!0},selectedIndex:{type:Number,default:void 0}},emits:["hoverIndex","selectDatapoint"],setup(f,{emit:x}){const i=f,{vue_ui_sparkline:P}=u.useConfig(),g=e.computed(()=>!!i.dataset&&i.dataset.length),v=e.ref(u.createUid()),w=e.ref(null),L=e.ref(null),C=e.ref(null),t=e.computed({get:()=>V(),set:l=>l});function V(){const l=M.useNestedProp({userConfig:i.config,defaultConfig:P});return l.theme?{...M.useNestedProp({userConfig:u.themes.vue_ui_sparkline[l.theme]||i.config,defaultConfig:l})}:l}const b=e.computed(()=>u.largestTriangleThreeBucketsArrayObjects({data:i.dataset,threshold:t.value.downsample.threshold}));e.watch(()=>i.config,l=>{t.value=V(),$(),o.value.chartWidth=t.value.style.chartWidth},{deep:!0}),e.watch(()=>i.dataset,l=>{p.value=u.largestTriangleThreeBucketsArrayObjects({data:i.dataset.map(r=>({...r,value:[void 0].includes(r.value)?null:r.value})),threshold:t.value.downsample.threshold})},{deep:!0});const p=e.ref(A());function A(){return u.largestTriangleThreeBucketsArrayObjects({data:i.dataset.map(l=>t.value.style.animation.show?{...l,value:null}:{...l,value:[void 0].includes(l.value)?null:l.value}),threshold:t.value.downsample.threshold})}const E=e.ref(null);e.onMounted(()=>{if($(),t.value.style.animation.show&&i.dataset.length>1){let a=function(){r<b.value.length?(p.value.push(b.value[r]),setTimeout(()=>{requestAnimationFrame(a)},l)):p.value=b.value,r+=1};p.value=[];const l=t.value.style.animation.animationFrames/i.dataset.length;let r=0;a()}});function $(){if(u.objectIsEmpty(i.dataset)?u.error({componentName:"VueUiSparkline",type:"dataset"}):i.dataset.forEach((l,r)=>{u.getMissingDatasetAttributes({datasetObject:l,requiredAttributes:["period","value"]}).forEach(a=>{u.error({componentName:"VueUiSparkline",type:"datasetSerieAttribute",property:a,index:r})})}),t.value.responsive){const l=z.throttle(()=>{const{width:r,height:a}=z.useResponsive({chart:w.value,title:t.value.style.title.show&&i.showInfo?L.value:null,source:C.value});o.value.width=r,o.value.height=a,o.value.chartWidth=t.value.style.chartWidth/500*r,o.value.padding=.06*r});E.value=new ResizeObserver(l),E.value.observe(w.value.parentNode)}}const o=e.ref({height:80,width:500,chartWidth:t.value.style.chartWidth,padding:30}),T=e.ref(6),n=e.computed(()=>({top:12,left:0,right:o.value.width,bottom:o.value.height-3,start:i.showInfo&&t.value.style.dataLabel.show&&t.value.style.dataLabel.position==="left"?o.value.width-o.value.chartWidth:o.value.padding,width:i.showInfo&&t.value.style.dataLabel.show?o.value.chartWidth:o.value.width-o.value.padding,height:o.value.height-12})),N=e.computed(()=>Math.min(...p.value.map(l=>isNaN(l.value)||[void 0,null,"NaN",NaN,1/0,-1/0].includes(l.value)?0:l.value||0))),D=e.computed(()=>Math.max(...p.value.map(l=>isNaN(l.value)||[void 0,null,"NaN",NaN,1/0,-1/0].includes(l.value)?0:l.value||0))),m=e.computed(()=>{const l=N.value>=0?0:N.value;return Math.abs(l)}),O=e.computed(()=>D.value+m.value+T.value),_=e.computed(()=>n.value.bottom-n.value.height*B(m.value));function B(l){return l/O.value}const h=e.computed(()=>b.value.length-1),s=e.computed(()=>p.value.map((l,r)=>{const a=isNaN(l.value)||[void 0,null,"NaN",NaN,1/0,-1/0].includes(l.value)?0:l.value||0;return{absoluteValue:a,period:l.period,plotValue:a+m.value,toMax:B(a+m.value),x:n.value.start+r*(n.value.width/(h.value+1)>o.padding?o.padding:n.value.width/(h.value+1)),y:n.value.bottom-n.value.height*B(a+m.value),id:`plot_${v.value}_${r}`,color:k.value?t.value.style.bar.color:t.value.style.area.useGradient?u.shiftHue(t.value.style.line.color,.05*(1-r/h.value)):t.value.style.line.color,width:n.value.width/(h.value+1)>o.padding?o.padding:n.value.width/(h.value+1)}})),W=e.computed(()=>{const l={x:s.value[0].x,y:o.value.height-6},r={x:s.value[s.value.length-1].x,y:o.value.height-6},a=[];return s.value.forEach(d=>{a.push(`${d.x},${d.y} `)}),[l.x,l.y,...a,r.x,r.y].toString()}),c=e.ref(void 0);function F(l,r){c.value=l,x("hoverIndex",{index:r})}function j(){c.value=void 0,x("hoverIndex",{index:void 0})}const y=e.computed(()=>{if(g.value){const l=s.value.map(a=>a.absoluteValue),r=l.reduce((a,d)=>a+d,0);return{latest:s.value[s.value.length-1].absoluteValue,sum:r,average:r/s.value.length,median:u.calcMedian(l),trend:u.calcLinearProgression(s.value.map(({x:a,y:d,absoluteValue:S})=>({x:a,y:d,value:S}))).trend}}else return{latest:null,sum:null,average:null,median:null,trend:null}}),I=e.computed(()=>g.value?t.value.style.dataLabel.valueType==="latest"?y.value.latest:t.value.style.dataLabel.valueType==="sum"?y.value.sum:t.value.style.dataLabel.valueType==="average"?y.value.average:0:0),k=e.computed(()=>t.value.type&&t.value.type==="bar");function q(l,r){x("selectDatapoint",{datapoint:l,index:r})}return(l,r)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"sparklineChart",ref:w,class:"vue-ui-sparkline",id:v.value,style:e.normalizeStyle(`width:100%;font-family:${t.value.style.fontFamily}`)},[e.renderSlot(l.$slots,"before",e.normalizeProps(e.guardReactiveProps({selected:c.value,latest:y.value.latest,sum:y.value.sum,average:y.value.average,median:y.value.median,trend:y.value.trend})),void 0,!0),t.value.style.title.show&&f.showInfo?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"chartTitle",ref:L,class:"vue-ui-sparkline-title",style:e.normalizeStyle(`display:flex;align-items:center;width:100%;color:${t.value.style.title.color};background:${t.value.style.backgroundColor};justify-content:${t.value.style.title.textAlign==="left"?"flex-start":t.value.style.title.textAlign==="right"?"flex-end":"center"};height:${t.value.style.title.fontSize*2}px;font-size:${t.value.style.title.fontSize}px;font-weight:${t.value.style.title.bold?"bold":"normal"};`)},[e.createElementVNode("span",{style:e.normalizeStyle(`padding:${t.value.style.title.textAlign==="left"?"0 0 0 12px":t.value.style.title.textAlign==="right"?"0 12px 0 0":"0"}`)},e.toDisplayString(c.value?c.value.period:t.value.style.title.text),5)],4)):e.createCommentVNode("",!0),g.value?(e.openBlock(),e.createElementBlock("svg",{key:1,xmlns:e.unref(u.XMLNS),viewBox:`0 0 ${o.value.width} ${o.value.height}`,style:e.normalizeStyle(`background:${t.value.style.backgroundColor};overflow:visible`)},[e.createVNode(R._sfc_main),e.createElementVNode("defs",null,[e.createElementVNode("linearGradient",{x1:"0%",y1:"0%",x2:"100%",y2:"0%",id:`sparkline_gradient_${v.value}`},[e.createElementVNode("stop",{offset:"0%","stop-color":e.unref(u.setOpacity)(e.unref(u.shiftHue)(t.value.style.area.color,.05),t.value.style.area.opacity)},null,8,Y),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(u.setOpacity)(t.value.style.area.color,t.value.style.area.opacity)},null,8,J)],8,Z),e.createElementVNode("linearGradient",{x2:"0%",y2:"100%",id:`sparkline_bar_gradient_pos_${v.value}`},[e.createElementVNode("stop",{offset:"0%","stop-color":t.value.style.bar.color},null,8,Q),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(u.shiftHue)(t.value.style.bar.color,.05)},null,8,ee)],8,K),e.createElementVNode("linearGradient",{x2:"0%",y2:"100%",id:`sparkline_bar_gradient_neg_${v.value}`},[e.createElementVNode("stop",{offset:"0%","stop-color":e.unref(u.shiftHue)(t.value.style.bar.color,.05)},null,8,le),e.createElementVNode("stop",{offset:"100%","stop-color":t.value.style.bar.color},null,8,ae)],8,te)]),t.value.style.area.show&&!k.value&&s.value[0]?(e.openBlock(),e.createElementBlock("g",oe,[t.value.style.line.smooth?(e.openBlock(),e.createElementBlock("path",{key:0,d:`M ${s.value[0].x},${n.value.bottom} ${e.unref(u.createSmoothPath)(s.value)} L ${s.value.at(-1).x},${n.value.bottom} Z`,fill:t.value.style.area.useGradient?`url(#sparkline_gradient_${v.value})`:e.unref(u.setOpacity)(t.value.style.area.color,t.value.style.area.opacity)},null,8,re)):(e.openBlock(),e.createElementBlock("path",{key:1,d:`M${W.value}Z`,fill:t.value.style.area.useGradient?`url(#sparkline_gradient_${v.value})`:e.unref(u.setOpacity)(t.value.style.area.color,t.value.style.area.opacity)},null,8,ue))])):e.createCommentVNode("",!0),t.value.style.line.smooth&&!k.value?(e.openBlock(),e.createElementBlock("path",{key:1,d:`M ${e.unref(u.createSmoothPath)(s.value)}`,stroke:t.value.style.line.color,fill:"none","stroke-width":t.value.style.line.strokeWidth,"stroke-linecap":"round"},null,8,ne)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(a,d)=>(e.openBlock(),e.createElementBlock("g",null,[d<s.value.length-1&&!t.value.style.line.smooth&&!k.value?(e.openBlock(),e.createElementBlock("line",{key:0,x1:a.x,x2:s.value[d+1].x,y1:a.y,y2:s.value[d+1].y,stroke:a.color,"stroke-width":t.value.style.line.strokeWidth,"stroke-linecap":"round","stroke-linejoin":"round","shape-rendering":"geometricPrecision"},null,8,se)):e.createCommentVNode("",!0),k.value?(e.openBlock(),e.createElementBlock("rect",{key:1,x:a.x-a.width/2,y:a.absoluteValue>0?a.y:_.value,width:a.width,height:Math.abs(a.y-_.value),fill:a.absoluteValue>0?`url(#sparkline_bar_gradient_pos_${v.value})`:`url(#sparkline_bar_gradient_neg_${v.value})`,rx:t.value.style.bar.borderRadius},null,8,ie)):e.createCommentVNode("",!0),t.value.style.verticalIndicator.show&&(c.value&&a.id===c.value.id||f.selectedIndex===d)?(e.openBlock(),e.createElementBlock("line",{key:2,x1:a.x,x2:a.x,y1:n.value.top-6,y2:n.value.bottom,stroke:t.value.style.verticalIndicator.color||a.color,"stroke-width":t.value.style.verticalIndicator.strokeWidth,"stroke-linecap":"round","stroke-dasharray":t.value.style.verticalIndicator.strokeDasharray||0},null,8,de)):e.createCommentVNode("",!0)]))),256)),N.value<0?(e.openBlock(),e.createElementBlock("line",{key:2,x1:n.value.start,x2:n.value.start+n.value.width-16,y1:_.value,y2:_.value,stroke:t.value.style.zeroLine.color,"stroke-dasharray":t.value.style.zeroLine.strokeWidth*2,"stroke-width":t.value.style.zeroLine.strokeWidth,"stroke-linecap":"round"},null,8,ce)):e.createCommentVNode("",!0),t.value.style.plot.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:3},e.renderList(s.value,(a,d)=>(e.openBlock(),e.createElementBlock("g",null,[c.value&&a.id===c.value.id||f.selectedIndex===d?(e.openBlock(),e.createElementBlock("circle",{key:0,cx:a.x,cy:a.y,r:t.value.style.plot.radius,fill:a.color,stroke:t.value.style.plot.stroke,"stroke-width":t.value.style.plot.strokeWidth},null,8,ve)):e.createCommentVNode("",!0)]))),256)):e.createCommentVNode("",!0),f.showInfo&&t.value.style.dataLabel.show?(e.openBlock(),e.createElementBlock("text",{key:4,x:t.value.style.dataLabel.position==="left"?12+t.value.style.dataLabel.offsetX:n.value.width+12+t.value.style.dataLabel.offsetX,y:o.value.height/2+t.value.style.dataLabel.fontSize/2.5+t.value.style.dataLabel.offsetY,"font-size":t.value.style.dataLabel.fontSize,"font-weight":t.value.style.dataLabel.bold?"bold":"normal",fill:t.value.style.dataLabel.color},e.toDisplayString(c.value?e.unref(u.applyDataLabel)(t.value.style.dataLabel.formatter,c.value.absoluteValue,e.unref(u.dataLabel)({p:t.value.style.dataLabel.prefix,v:c.value.absoluteValue,s:t.value.style.dataLabel.suffix,r:t.value.style.dataLabel.roundingValue}),{datapoint:c.value}):e.unref(u.applyDataLabel)(t.value.style.dataLabel.formatter,I.value,e.unref(u.dataLabel)({p:t.value.style.dataLabel.prefix,v:I.value,s:t.value.style.dataLabel.suffix,r:t.value.style.dataLabel.roundingValue}))),9,he)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(a,d)=>(e.openBlock(),e.createElementBlock("rect",{x:a.x-(n.value.width/(h.value+1)>o.value.padding?o.value.padding:n.value.width/(h.value+1))/2,y:n.value.top-6,height:n.value.height+6,width:n.value.width/(h.value+1)>o.value.padding?o.value.padding:n.value.width/(h.value+1),fill:"transparent",onMouseenter:S=>F(a,d),onMouseleave:j,onClick:()=>q(a,d)},null,40,ye))),256)),e.renderSlot(l.$slots,"svg",{svg:o.value},void 0,!0)],12,X)):e.createCommentVNode("",!0),l.$slots.source?(e.openBlock(),e.createElementBlock("div",{key:2,ref_key:"source",ref:C,dir:"auto"},[e.renderSlot(l.$slots,"source",{},void 0,!0)],512)):e.createCommentVNode("",!0),g.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(G.default,{key:3,config:{type:"sparkline",style:{backgroundColor:t.value.style.backgroundColor,sparkline:{color:"#CCCCCC"}}}},null,8,["config"]))],12,U))}},fe=H._export_sfc(pe,[["__scopeId","data-v-9467697c"]]);exports.default=fe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("./index-CsQwCVqU.cjs"),M=require("./useNestedProp-DSYpaLxP.cjs"),G=require("./vue-ui-skeleton-DsRTbz6d.cjs"),z=require("./useResponsive-BJ7DTGpm.cjs"),R=require("./PackageVersion-BbQFSVXm.cjs"),H=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),U=["id"],X=["xmlns","viewBox"],Z=["id"],Y=["stop-color"],J=["stop-color"],K=["id"],Q=["stop-color"],ee=["stop-color"],te=["id"],le=["stop-color"],ae=["stop-color"],oe={key:0},re=["d","fill"],ue=["d","fill"],ne=["d","stroke","stroke-width"],se=["x1","x2","y1","y2","stroke","stroke-width"],ie=["x","y","width","height","fill","rx"],de=["x1","x2","y1","y2","stroke","stroke-width","stroke-dasharray"],ce=["x1","x2","y1","y2","stroke","stroke-dasharray","stroke-width"],ve=["cx","cy","r","fill","stroke","stroke-width"],he=["x","y","font-size","font-weight","fill"],ye=["x","y","height","width","onMouseenter","onClick"],pe={__name:"vue-ui-sparkline",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}},showInfo:{type:Boolean,default:!0},selectedIndex:{type:Number,default:void 0}},emits:["hoverIndex","selectDatapoint"],setup(f,{emit:x}){const i=f,{vue_ui_sparkline:P}=u.useConfig(),g=e.computed(()=>!!i.dataset&&i.dataset.length),v=e.ref(u.createUid()),w=e.ref(null),L=e.ref(null),C=e.ref(null),t=e.computed({get:()=>V(),set:l=>l});function V(){const l=M.useNestedProp({userConfig:i.config,defaultConfig:P});return l.theme?{...M.useNestedProp({userConfig:u.themes.vue_ui_sparkline[l.theme]||i.config,defaultConfig:l})}:l}const b=e.computed(()=>u.largestTriangleThreeBucketsArrayObjects({data:i.dataset,threshold:t.value.downsample.threshold}));e.watch(()=>i.config,l=>{t.value=V(),$(),o.value.chartWidth=t.value.style.chartWidth},{deep:!0}),e.watch(()=>i.dataset,l=>{p.value=u.largestTriangleThreeBucketsArrayObjects({data:i.dataset.map(r=>({...r,value:[void 0].includes(r.value)?null:r.value})),threshold:t.value.downsample.threshold})},{deep:!0});const p=e.ref(A());function A(){return u.largestTriangleThreeBucketsArrayObjects({data:i.dataset.map(l=>t.value.style.animation.show?{...l,value:null}:{...l,value:[void 0].includes(l.value)?null:l.value}),threshold:t.value.downsample.threshold})}const E=e.ref(null);e.onMounted(()=>{if($(),t.value.style.animation.show&&i.dataset.length>1){let a=function(){r<b.value.length?(p.value.push(b.value[r]),setTimeout(()=>{requestAnimationFrame(a)},l)):p.value=b.value,r+=1};p.value=[];const l=t.value.style.animation.animationFrames/i.dataset.length;let r=0;a()}});function $(){if(u.objectIsEmpty(i.dataset)?u.error({componentName:"VueUiSparkline",type:"dataset"}):i.dataset.forEach((l,r)=>{u.getMissingDatasetAttributes({datasetObject:l,requiredAttributes:["period","value"]}).forEach(a=>{u.error({componentName:"VueUiSparkline",type:"datasetSerieAttribute",property:a,index:r})})}),t.value.responsive){const l=z.throttle(()=>{const{width:r,height:a}=z.useResponsive({chart:w.value,title:t.value.style.title.show&&i.showInfo?L.value:null,source:C.value});o.value.width=r,o.value.height=a,o.value.chartWidth=t.value.style.chartWidth/500*r,o.value.padding=.06*r});E.value=new ResizeObserver(l),E.value.observe(w.value.parentNode)}}const o=e.ref({height:80,width:500,chartWidth:t.value.style.chartWidth,padding:30}),T=e.ref(6),n=e.computed(()=>({top:12,left:0,right:o.value.width,bottom:o.value.height-3,start:i.showInfo&&t.value.style.dataLabel.show&&t.value.style.dataLabel.position==="left"?o.value.width-o.value.chartWidth:o.value.padding,width:i.showInfo&&t.value.style.dataLabel.show?o.value.chartWidth:o.value.width-o.value.padding,height:o.value.height-12})),N=e.computed(()=>Math.min(...p.value.map(l=>isNaN(l.value)||[void 0,null,"NaN",NaN,1/0,-1/0].includes(l.value)?0:l.value||0))),D=e.computed(()=>Math.max(...p.value.map(l=>isNaN(l.value)||[void 0,null,"NaN",NaN,1/0,-1/0].includes(l.value)?0:l.value||0))),m=e.computed(()=>{const l=N.value>=0?0:N.value;return Math.abs(l)}),O=e.computed(()=>D.value+m.value+T.value),_=e.computed(()=>n.value.bottom-n.value.height*B(m.value));function B(l){return l/O.value}const h=e.computed(()=>b.value.length-1),s=e.computed(()=>p.value.map((l,r)=>{const a=isNaN(l.value)||[void 0,null,"NaN",NaN,1/0,-1/0].includes(l.value)?0:l.value||0;return{absoluteValue:a,period:l.period,plotValue:a+m.value,toMax:B(a+m.value),x:n.value.start+r*(n.value.width/(h.value+1)>o.padding?o.padding:n.value.width/(h.value+1)),y:n.value.bottom-n.value.height*B(a+m.value),id:`plot_${v.value}_${r}`,color:k.value?t.value.style.bar.color:t.value.style.area.useGradient?u.shiftHue(t.value.style.line.color,.05*(1-r/h.value)):t.value.style.line.color,width:n.value.width/(h.value+1)>o.padding?o.padding:n.value.width/(h.value+1)}})),W=e.computed(()=>{const l={x:s.value[0].x,y:o.value.height-6},r={x:s.value[s.value.length-1].x,y:o.value.height-6},a=[];return s.value.forEach(d=>{a.push(`${d.x},${d.y} `)}),[l.x,l.y,...a,r.x,r.y].toString()}),c=e.ref(void 0);function F(l,r){c.value=l,x("hoverIndex",{index:r})}function j(){c.value=void 0,x("hoverIndex",{index:void 0})}const y=e.computed(()=>{if(g.value){const l=s.value.map(a=>a.absoluteValue),r=l.reduce((a,d)=>a+d,0);return{latest:s.value[s.value.length-1].absoluteValue,sum:r,average:r/s.value.length,median:u.calcMedian(l),trend:u.calcLinearProgression(s.value.map(({x:a,y:d,absoluteValue:S})=>({x:a,y:d,value:S}))).trend}}else return{latest:null,sum:null,average:null,median:null,trend:null}}),I=e.computed(()=>g.value?t.value.style.dataLabel.valueType==="latest"?y.value.latest:t.value.style.dataLabel.valueType==="sum"?y.value.sum:t.value.style.dataLabel.valueType==="average"?y.value.average:0:0),k=e.computed(()=>t.value.type&&t.value.type==="bar");function q(l,r){x("selectDatapoint",{datapoint:l,index:r})}return(l,r)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"sparklineChart",ref:w,class:"vue-ui-sparkline",id:v.value,style:e.normalizeStyle(`width:100%;font-family:${t.value.style.fontFamily}`)},[e.renderSlot(l.$slots,"before",e.normalizeProps(e.guardReactiveProps({selected:c.value,latest:y.value.latest,sum:y.value.sum,average:y.value.average,median:y.value.median,trend:y.value.trend})),void 0,!0),t.value.style.title.show&&f.showInfo?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"chartTitle",ref:L,class:"vue-ui-sparkline-title",style:e.normalizeStyle(`display:flex;align-items:center;width:100%;color:${t.value.style.title.color};background:${t.value.style.backgroundColor};justify-content:${t.value.style.title.textAlign==="left"?"flex-start":t.value.style.title.textAlign==="right"?"flex-end":"center"};height:${t.value.style.title.fontSize*2}px;font-size:${t.value.style.title.fontSize}px;font-weight:${t.value.style.title.bold?"bold":"normal"};`)},[e.createElementVNode("span",{style:e.normalizeStyle(`padding:${t.value.style.title.textAlign==="left"?"0 0 0 12px":t.value.style.title.textAlign==="right"?"0 12px 0 0":"0"}`)},e.toDisplayString(c.value?c.value.period:t.value.style.title.text),5)],4)):e.createCommentVNode("",!0),g.value?(e.openBlock(),e.createElementBlock("svg",{key:1,xmlns:e.unref(u.XMLNS),viewBox:`0 0 ${o.value.width} ${o.value.height}`,style:e.normalizeStyle(`background:${t.value.style.backgroundColor};overflow:visible`)},[e.createVNode(R._sfc_main),e.createElementVNode("defs",null,[e.createElementVNode("linearGradient",{x1:"0%",y1:"0%",x2:"100%",y2:"0%",id:`sparkline_gradient_${v.value}`},[e.createElementVNode("stop",{offset:"0%","stop-color":e.unref(u.setOpacity)(e.unref(u.shiftHue)(t.value.style.area.color,.05),t.value.style.area.opacity)},null,8,Y),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(u.setOpacity)(t.value.style.area.color,t.value.style.area.opacity)},null,8,J)],8,Z),e.createElementVNode("linearGradient",{x2:"0%",y2:"100%",id:`sparkline_bar_gradient_pos_${v.value}`},[e.createElementVNode("stop",{offset:"0%","stop-color":t.value.style.bar.color},null,8,Q),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(u.shiftHue)(t.value.style.bar.color,.05)},null,8,ee)],8,K),e.createElementVNode("linearGradient",{x2:"0%",y2:"100%",id:`sparkline_bar_gradient_neg_${v.value}`},[e.createElementVNode("stop",{offset:"0%","stop-color":e.unref(u.shiftHue)(t.value.style.bar.color,.05)},null,8,le),e.createElementVNode("stop",{offset:"100%","stop-color":t.value.style.bar.color},null,8,ae)],8,te)]),t.value.style.area.show&&!k.value&&s.value[0]?(e.openBlock(),e.createElementBlock("g",oe,[t.value.style.line.smooth?(e.openBlock(),e.createElementBlock("path",{key:0,d:`M ${s.value[0].x},${n.value.bottom} ${e.unref(u.createSmoothPath)(s.value)} L ${s.value.at(-1).x},${n.value.bottom} Z`,fill:t.value.style.area.useGradient?`url(#sparkline_gradient_${v.value})`:e.unref(u.setOpacity)(t.value.style.area.color,t.value.style.area.opacity)},null,8,re)):(e.openBlock(),e.createElementBlock("path",{key:1,d:`M${W.value}Z`,fill:t.value.style.area.useGradient?`url(#sparkline_gradient_${v.value})`:e.unref(u.setOpacity)(t.value.style.area.color,t.value.style.area.opacity)},null,8,ue))])):e.createCommentVNode("",!0),t.value.style.line.smooth&&!k.value?(e.openBlock(),e.createElementBlock("path",{key:1,d:`M ${e.unref(u.createSmoothPath)(s.value)}`,stroke:t.value.style.line.color,fill:"none","stroke-width":t.value.style.line.strokeWidth,"stroke-linecap":"round"},null,8,ne)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(a,d)=>(e.openBlock(),e.createElementBlock("g",null,[d<s.value.length-1&&!t.value.style.line.smooth&&!k.value?(e.openBlock(),e.createElementBlock("line",{key:0,x1:a.x,x2:s.value[d+1].x,y1:a.y,y2:s.value[d+1].y,stroke:a.color,"stroke-width":t.value.style.line.strokeWidth,"stroke-linecap":"round","stroke-linejoin":"round","shape-rendering":"geometricPrecision"},null,8,se)):e.createCommentVNode("",!0),k.value?(e.openBlock(),e.createElementBlock("rect",{key:1,x:a.x-a.width/2,y:a.absoluteValue>0?a.y:_.value,width:a.width,height:Math.abs(a.y-_.value),fill:a.absoluteValue>0?`url(#sparkline_bar_gradient_pos_${v.value})`:`url(#sparkline_bar_gradient_neg_${v.value})`,rx:t.value.style.bar.borderRadius},null,8,ie)):e.createCommentVNode("",!0),t.value.style.verticalIndicator.show&&(c.value&&a.id===c.value.id||f.selectedIndex===d)?(e.openBlock(),e.createElementBlock("line",{key:2,x1:a.x,x2:a.x,y1:n.value.top-6,y2:n.value.bottom,stroke:t.value.style.verticalIndicator.color||a.color,"stroke-width":t.value.style.verticalIndicator.strokeWidth,"stroke-linecap":"round","stroke-dasharray":t.value.style.verticalIndicator.strokeDasharray||0},null,8,de)):e.createCommentVNode("",!0)]))),256)),N.value<0?(e.openBlock(),e.createElementBlock("line",{key:2,x1:n.value.start,x2:n.value.start+n.value.width-16,y1:_.value,y2:_.value,stroke:t.value.style.zeroLine.color,"stroke-dasharray":t.value.style.zeroLine.strokeWidth*2,"stroke-width":t.value.style.zeroLine.strokeWidth,"stroke-linecap":"round"},null,8,ce)):e.createCommentVNode("",!0),t.value.style.plot.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:3},e.renderList(s.value,(a,d)=>(e.openBlock(),e.createElementBlock("g",null,[c.value&&a.id===c.value.id||f.selectedIndex===d?(e.openBlock(),e.createElementBlock("circle",{key:0,cx:a.x,cy:a.y,r:t.value.style.plot.radius,fill:a.color,stroke:t.value.style.plot.stroke,"stroke-width":t.value.style.plot.strokeWidth},null,8,ve)):e.createCommentVNode("",!0)]))),256)):e.createCommentVNode("",!0),f.showInfo&&t.value.style.dataLabel.show?(e.openBlock(),e.createElementBlock("text",{key:4,x:t.value.style.dataLabel.position==="left"?12+t.value.style.dataLabel.offsetX:n.value.width+12+t.value.style.dataLabel.offsetX,y:o.value.height/2+t.value.style.dataLabel.fontSize/2.5+t.value.style.dataLabel.offsetY,"font-size":t.value.style.dataLabel.fontSize,"font-weight":t.value.style.dataLabel.bold?"bold":"normal",fill:t.value.style.dataLabel.color},e.toDisplayString(c.value?e.unref(u.applyDataLabel)(t.value.style.dataLabel.formatter,c.value.absoluteValue,e.unref(u.dataLabel)({p:t.value.style.dataLabel.prefix,v:c.value.absoluteValue,s:t.value.style.dataLabel.suffix,r:t.value.style.dataLabel.roundingValue}),{datapoint:c.value}):e.unref(u.applyDataLabel)(t.value.style.dataLabel.formatter,I.value,e.unref(u.dataLabel)({p:t.value.style.dataLabel.prefix,v:I.value,s:t.value.style.dataLabel.suffix,r:t.value.style.dataLabel.roundingValue}))),9,he)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(a,d)=>(e.openBlock(),e.createElementBlock("rect",{x:a.x-(n.value.width/(h.value+1)>o.value.padding?o.value.padding:n.value.width/(h.value+1))/2,y:n.value.top-6,height:n.value.height+6,width:n.value.width/(h.value+1)>o.value.padding?o.value.padding:n.value.width/(h.value+1),fill:"transparent",onMouseenter:S=>F(a,d),onMouseleave:j,onClick:()=>q(a,d)},null,40,ye))),256)),e.renderSlot(l.$slots,"svg",{svg:o.value},void 0,!0)],12,X)):e.createCommentVNode("",!0),l.$slots.source?(e.openBlock(),e.createElementBlock("div",{key:2,ref_key:"source",ref:C,dir:"auto"},[e.renderSlot(l.$slots,"source",{},void 0,!0)],512)):e.createCommentVNode("",!0),g.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(G.default,{key:3,config:{type:"sparkline",style:{backgroundColor:t.value.style.backgroundColor,sparkline:{color:"#CCCCCC"}}}},null,8,["config"]))],12,U))}},fe=H._export_sfc(pe,[["__scopeId","data-v-9467697c"]]);exports.default=fe;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { computed as v, ref as m, watch as U, onMounted as re, openBlock as o, createElementBlock as n, normalizeStyle as C, renderSlot as A, normalizeProps as ne, guardReactiveProps as ie, createElementVNode as f, toDisplayString as X, createCommentVNode as y, unref as c, createVNode as de, Fragment as P, renderList as D, createBlock as ve } from "vue";
|
|
2
|
-
import { u as ce, c as he, t as ye, _ as T, o as fe, e as Z, g as pe, w as I, $ as ge, a0 as me, X as ke, s as M, R as q, i as H, f as Y } from "./index-
|
|
3
|
-
import { u as J } from "./useNestedProp-
|
|
4
|
-
import be from "./vue-ui-skeleton-
|
|
2
|
+
import { u as ce, c as he, t as ye, _ as T, o as fe, e as Z, g as pe, w as I, $ as ge, a0 as me, X as ke, s as M, R as q, i as H, f as Y } from "./index-hV0hU1iE.js";
|
|
3
|
+
import { u as J } from "./useNestedProp-CRAUOmT5.js";
|
|
4
|
+
import be from "./vue-ui-skeleton-BY8Jg9a_.js";
|
|
5
5
|
import { t as _e, u as xe } from "./useResponsive-CoxXLe23.js";
|
|
6
|
-
import { _ as we } from "./PackageVersion-
|
|
6
|
+
import { _ as we } from "./PackageVersion-wqab02xF.js";
|
|
7
7
|
import { _ as Le } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
8
8
|
const $e = ["id"], Ne = ["xmlns", "viewBox"], Ce = ["id"], Ie = ["stop-color"], Me = ["stop-color"], Ve = ["id"], ze = ["stop-color"], Se = ["stop-color"], We = ["id"], Ae = ["stop-color"], Pe = ["stop-color"], De = { key: 0 }, Te = ["d", "fill"], Be = ["d", "fill"], Fe = ["d", "stroke", "stroke-width"], Ge = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Oe = ["x", "y", "width", "height", "fill", "rx"], Ee = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], je = ["x1", "x2", "y1", "y2", "stroke", "stroke-dasharray", "stroke-width"], Re = ["cx", "cy", "r", "fill", "stroke", "stroke-width"], Ue = ["x", "y", "font-size", "font-weight", "fill"], Xe = ["x", "y", "height", "width", "onMouseenter", "onClick"], Ze = {
|
|
9
9
|
__name: "vue-ui-sparkline",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { computed as m, ref as d, watch as Y, onMounted as se, openBlock as s, createElementBlock as r, normalizeStyle as v, createElementVNode as p, toDisplayString as w, createCommentVNode as y, unref as C, createVNode as G, Fragment as x, renderList as $, normalizeClass as F, createBlock as re, withCtx as q, renderSlot as j, normalizeProps as H, guardReactiveProps as X } from "vue";
|
|
2
|
-
import { u as ne, c as J, t as ue, a as ie, p as i, d as N, b as ce, o as de, e as K, g as ve, f as E, X as pe, s as ge, w as fe, i as Q, x as he } from "./index-
|
|
3
|
-
import { u as Z } from "./useNestedProp-
|
|
4
|
-
import ye from "./vue-ui-skeleton-
|
|
5
|
-
import { _ as me } from "./PackageVersion-
|
|
6
|
-
import { _ as be } from "./Tooltip-
|
|
2
|
+
import { u as ne, c as J, t as ue, a as ie, p as i, d as N, b as ce, o as de, e as K, g as ve, f as E, X as pe, s as ge, w as fe, i as Q, x as he } from "./index-hV0hU1iE.js";
|
|
3
|
+
import { u as Z } from "./useNestedProp-CRAUOmT5.js";
|
|
4
|
+
import ye from "./vue-ui-skeleton-BY8Jg9a_.js";
|
|
5
|
+
import { _ as me } from "./PackageVersion-wqab02xF.js";
|
|
6
|
+
import { _ as be } from "./Tooltip-Com_T8vc.js";
|
|
7
7
|
import { _ as ke } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
8
8
|
const _e = ["xmlns", "viewBox"], we = ["id"], Ce = ["stop-color"], xe = ["stop-color"], $e = ["stop-color"], Se = {
|
|
9
9
|
id: "stackPill",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./index-DsF7Aej7.cjs"),V=require("./useNestedProp-D0YHk8Cd.cjs"),A=require("./vue-ui-skeleton-e8hBgzZq.cjs"),q=require("./PackageVersion-BjoP5ypd.cjs"),O=require("./Tooltip-wdo3yY_W.cjs"),U=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),j=["xmlns","viewBox"],M=["id"],H=["stop-color"],I=["stop-color"],R=["stop-color"],W={id:"stackPill",clipPathUnits:"objectBoundingBox"},Y=["fill"],G={key:0,"clip-path":"url(#stackPill)"},X=["x","width","height","fill"],J=["x","width","height","fill","stroke"],K=["onClick","x","width","height","onMouseenter"],Q=["width","height","rx"],Z=["onClick"],ee={style:{display:"flex","flex-direction":"row","align-items":"center",gap:"4px","justify-content":"center"}},te=["height","width"],le=["fill"],oe={key:4,ref:"source",dir:"auto"},ae={__name:"vue-ui-sparkstackbar",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:["selectDatapoint"],setup(P,{emit:D}){const u=P,{vue_ui_sparkstackbar:L}=a.useConfig(),x=e.computed(()=>!!u.dataset&&u.dataset.length),B=e.ref(null),S=e.ref(a.createUid()),b=e.ref(!1),_=e.ref(""),t=e.computed({get:()=>$(),set:l=>l});function $(){const l=V.useNestedProp({userConfig:u.config,defaultConfig:L});return l.theme?{...V.useNestedProp({userConfig:a.themes.vue_ui_sparkstackbar[l.theme]||u.config,defaultConfig:l}),customPalette:a.themePalettes[l.theme]||a.palette}:l}e.watch(()=>u.config,l=>{t.value=$(),E()},{deep:!0}),e.watch(()=>u.dataset,l=>{p.value=u.dataset.map((n,o)=>({...n,color:n.color?a.convertColorToHex(n.color):f.value[o]||a.palette[o]||a.palette[o%a.palette.length]}))},{deep:!0});const f=e.computed(()=>a.convertCustomPalette(t.value.customPalette)),p=e.ref(u.dataset.map((l,n)=>({...l,value:t.value.style.animation.show?0:l.value||0,color:l.color?a.convertColorToHex(l.color):f.value[n]||a.palette[n]||a.palette[n%a.palette.length]}))),g=e.ref(!0);e.onMounted(()=>{if(E(),t.value.style.animation.show){let v=function(){r+=o/l,r<o?(p.value=p.value.map((s,i)=>({...s,value:s.value+=n[i],color:s.color?a.convertColorToHex(s.color):f.value[i]||a.palette[i]||a.palette[i%a.palette.length]})),requestAnimationFrame(v)):(g.value=!1,p.value=u.dataset.map((s,i)=>({...s,value:s.value||0,color:s.color?a.convertColorToHex(s.color):f.value[i]||a.palette[i]||a.palette[i%a.palette.length],id:a.createUid()})))};const l=t.value.style.animation.animationFrames,n=u.dataset.map((s,i)=>s.value/l),o=u.dataset.map(s=>s.value||0).reduce((s,i)=>s+i,0);let r=0;g.value=!0,v()}});function E(){a.objectIsEmpty(u.dataset)?a.error({componentName:"VueUiSparkStackbar",type:"dataset"}):u.dataset.forEach((l,n)=>{a.getMissingDatasetAttributes({datasetObject:l,requiredAttributes:["name","value"]}).forEach(o=>{a.error({componentName:"VueUiSparkStackbar",type:"datasetSerieAttribute",property:o,index:n})})})}const c=e.ref({width:500,height:16}),d=e.ref([]),N=e.computed(()=>u.dataset.map(l=>l.value||0).filter((l,n)=>!d.value.includes(n)).reduce((l,n)=>l+n,0)),y=e.computed(()=>p.value.map((l,n)=>{const o=l.value||0,r=o/N.value,v=isNaN(r)?0:r,s=v*c.value.width;return{...l,value:o,proportion:v,width:s,proportionLabel:a.dataLabel({v:v*100,s:"%",r:t.value.style.legend.percentage.rounding})}})),C=e.computed(()=>y.value.filter((l,n)=>!d.value.includes(n)));function F(l){d.value.includes(l)?d.value=d.value.filter(n=>n!==l):d.value.length<p.value.length-1&&d.value.push(l)}const h=e.computed(()=>{let l=0;const n=[];for(let o=0;o<C.value.length;o+=1)n.push({...C.value[o],start:l}),l+=C.value[o].width;return n});function z(l,n){D("selectDatapoint",{datapoint:l,index:n})}const w=e.ref(null),k=e.ref(!1),m=e.ref(null);function T({datapoint:l,seriesIndex:n}){if(!t.value.style.tooltip.show)return;w.value={datapoint:l,seriesIndex:n,config:t.value,series:y.value},b.value=!0,m.value=n;const o=t.value.style.tooltip.customFormat;if(a.isFunction(o))try{const r=o({seriesIndex:n,datapoint:l,series:y.value,config:t.value});typeof r=="string"&&(_.value=r,k.value=!0)}catch{console.warn("Custom format cannot be applied."),k.value=!1}if(!k.value){let r="";r+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${t.value.style.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${l.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"><circle cx="6" cy="6" r="6" stroke="none" fill="${l.color}"/></svg>`,r+=`<b>${l.proportionLabel}</b>`,r+=`<span>(${a.applyDataLabel(t.value.style.legend.value.formatter,l.value,a.dataLabel({p:t.value.style.legend.value.prefix,v:l.value,s:t.value.style.legend.value.suffix,r:t.value.style.legend.value.rounding}),{datapoint:l,seriesIndex:n})})</span>`,_.value=`<div>${r}</div>`}}return(l,n)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"sparkstackbarChart",ref:B,style:e.normalizeStyle(`width:100%; background:${t.value.style.backgroundColor}`)},[t.value.style.title.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(`width:calc(100% - 12px);background:transparent;margin:0 auto;margin:${t.value.style.title.margin};padding: 0 6px;text-align:${t.value.style.title.textAlign}`)},[e.createElementVNode("div",{style:e.normalizeStyle(`font-size:${t.value.style.title.fontSize}px;color:${t.value.style.title.color};font-weight:${t.value.style.title.bold?"bold":"normal"}`)},e.toDisplayString(t.value.style.title.text),5),t.value.style.title.subtitle.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(`font-size:${t.value.style.title.subtitle.fontSize}px;color:${t.value.style.title.subtitle.color};font-weight:${t.value.style.title.subtitle.bold?"bold":"normal"}`)},e.toDisplayString(t.value.style.title.subtitle.text),5)):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),x.value?(e.openBlock(),e.createElementBlock("svg",{key:1,xmlns:e.unref(a.XMLNS),width:"100%",viewBox:`0 0 ${c.value.width} ${c.value.height}`},[e.createVNode(q._sfc_main),e.createElementVNode("defs",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(o,r)=>(e.openBlock(),e.createElementBlock("linearGradient",{key:`stack_gradient_${r}`,gradientTransform:"rotate(90)",id:`stack_gradient_${r}_${S.value}`},[e.createElementVNode("stop",{offset:"0%","stop-color":o.color},null,8,H),e.createElementVNode("stop",{offset:"50%","stop-color":e.unref(a.setOpacity)(e.unref(a.shiftHue)(o.color,.05),100-t.value.style.bar.gradient.intensity)},null,8,I),e.createElementVNode("stop",{offset:"100%","stop-color":o.color},null,8,R)],8,M))),128)),e.createElementVNode("clipPath",W,[e.createElementVNode("rect",{x:"0.005",y:"-2",width:"0.99",height:"5",rx:"3",ry:"3",fill:t.value.style.backgroundColor},null,8,Y)])]),N.value>0?(e.openBlock(),e.createElementBlock("g",G,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(o,r)=>(e.openBlock(),e.createElementBlock("rect",{key:`stack_underlayer_${r}`,x:o.start,y:0,width:o.width,height:c.value.height,fill:t.value.style.bar.gradient.underlayerColor,class:e.normalizeClass({animated:!g.value}),style:e.normalizeStyle({opacity:m.value!==null&&t.value.style.tooltip.show?m.value===r?1:.5:1})},null,14,X))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(o,r)=>(e.openBlock(),e.createElementBlock("rect",{key:`stack_${r}`,x:o.start,y:0,width:o.width,height:c.value.height,fill:t.value.style.bar.gradient.show?`url(#stack_gradient_${r}_${S.value})`:o.color,stroke:t.value.style.backgroundColor,"stroke-linecap":"round",class:e.normalizeClass({animated:!g.value}),style:e.normalizeStyle({opacity:m.value!==null&&t.value.style.tooltip.show?m.value===r?1:.5:1})},null,14,J))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(o,r)=>(e.openBlock(),e.createElementBlock("rect",{key:`stack_trap_${r}`,onClick:()=>z(o,r),x:o.start,y:0,width:o.width,height:c.value.height,fill:"transparent",stroke:"none",class:e.normalizeClass({animated:!g.value}),onMouseenter:()=>T({datapoint:o,seriesIndex:r}),onMouseleave:n[0]||(n[0]=v=>{b.value=!1,m.value=null})},null,42,K))),128))])):(e.openBlock(),e.createElementBlock("rect",{key:1,x:2,y:1,width:c.value.width-4,height:c.value.height-2,stroke:"#CCCCCC","stroke-width":"2",fill:"transparent",rx:(c.value.height-4)/2},null,8,Q))],8,j)):e.createCommentVNode("",!0),x.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(A.default,{key:2,config:{type:"sparkStackbar",style:{backgroundColor:t.value.style.backgroundColor,sparkStackbar:{color:"#CCCCCC"}}}},null,8,["config"])),t.value.style.legend.show?(e.openBlock(),e.createElementBlock("div",{key:3,style:e.normalizeStyle(`background:transparent;margin:0 auto;margin:${t.value.style.legend.margin};justify-content:${t.value.style.legend.textAlign==="left"?"flex-start":t.value.style.legend.textAlign==="right"?"flex-end":"center"}`),class:"vue-ui-sparkstackbar-legend"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,(o,r)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(`font-size:${t.value.style.legend.fontSize}px;`),class:e.normalizeClass({"vue-ui-sparkstackbar-legend-item":!0,"vue-ui-sparkstackbar-legend-item-unselected":d.value.includes(r)}),onClick:v=>{F(r),z(o,r)}},[e.createElementVNode("div",ee,[(e.openBlock(),e.createElementBlock("svg",{height:`${t.value.style.legend.fontSize}px`,width:`${t.value.style.legend.fontSize}px`,viewBox:"0 0 10 10"},[e.createElementVNode("circle",{cx:5,cy:5,r:5,fill:o.color},null,8,le)],8,te)),e.createElementVNode("span",{style:e.normalizeStyle(`color:${t.value.style.legend.name.color}; font-weight:${t.value.style.legend.name.bold?"bold":"normal"}`)},e.toDisplayString(o.name),5),t.value.style.legend.percentage.show?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle(`font-weight:${t.value.style.legend.percentage.bold?"bold":"normal"};color:${t.value.style.legend.percentage.color}`)},e.toDisplayString(d.value.includes(r)?" - ":o.proportionLabel),5)):e.createCommentVNode("",!0),t.value.style.legend.value.show?(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle(`font-weight:${t.value.style.legend.value.bold?"bold":"normal"};color:${t.value.style.legend.value.color}`)}," ("+e.toDisplayString(e.unref(a.applyDataLabel)(t.value.style.legend.value.formatter,o.value,e.unref(a.dataLabel)({p:t.value.style.legend.value.prefix,v:o.value,s:t.value.style.legend.value.suffix,r:t.value.style.legend.value.rounding}),{datapoint:o,seriesIndex:r}))+") ",5)):e.createCommentVNode("",!0)])],14,Z))),256))],4)):e.createCommentVNode("",!0),e.createVNode(O._sfc_main,{show:b.value&&t.value.style.tooltip.show,parent:B.value,backgroundColor:t.value.style.tooltip.backgroundColor,color:t.value.style.tooltip.color,fontSize:t.value.style.tooltip.fontSize,borderRadius:t.value.style.tooltip.borderRadius,borderColor:t.value.style.tooltip.borderColor,borderWidth:t.value.style.tooltip.borderWidth,backgroundOpacity:t.value.style.tooltip.backgroundOpacity,position:t.value.style.tooltip.position,content:_.value,isCustom:k.value,offsetY:-124+t.value.style.tooltip.offsetY,blockShiftY:!0},{"tooltip-before":e.withCtx(()=>[e.renderSlot(l.$slots,"tooltip-before",e.normalizeProps(e.guardReactiveProps({...w.value})),void 0,!0)]),"tooltip-after":e.withCtx(()=>[e.renderSlot(l.$slots,"tooltip-after",e.normalizeProps(e.guardReactiveProps({...w.value})),void 0,!0)]),_:3},8,["show","parent","backgroundColor","color","fontSize","borderRadius","borderColor","borderWidth","backgroundOpacity","position","content","isCustom","offsetY"]),l.$slots.source?(e.openBlock(),e.createElementBlock("div",oe,[e.renderSlot(l.$slots,"source",{},void 0,!0)],512)):e.createCommentVNode("",!0)],4))}},re=U._export_sfc(ae,[["__scopeId","data-v-233900f7"]]);exports.default=re;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./index-CsQwCVqU.cjs"),V=require("./useNestedProp-DSYpaLxP.cjs"),A=require("./vue-ui-skeleton-DsRTbz6d.cjs"),q=require("./PackageVersion-BbQFSVXm.cjs"),O=require("./Tooltip-DvGSIp31.cjs"),U=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),j=["xmlns","viewBox"],M=["id"],H=["stop-color"],I=["stop-color"],R=["stop-color"],W={id:"stackPill",clipPathUnits:"objectBoundingBox"},Y=["fill"],G={key:0,"clip-path":"url(#stackPill)"},X=["x","width","height","fill"],J=["x","width","height","fill","stroke"],K=["onClick","x","width","height","onMouseenter"],Q=["width","height","rx"],Z=["onClick"],ee={style:{display:"flex","flex-direction":"row","align-items":"center",gap:"4px","justify-content":"center"}},te=["height","width"],le=["fill"],oe={key:4,ref:"source",dir:"auto"},ae={__name:"vue-ui-sparkstackbar",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:["selectDatapoint"],setup(P,{emit:D}){const u=P,{vue_ui_sparkstackbar:L}=a.useConfig(),x=e.computed(()=>!!u.dataset&&u.dataset.length),B=e.ref(null),S=e.ref(a.createUid()),b=e.ref(!1),_=e.ref(""),t=e.computed({get:()=>$(),set:l=>l});function $(){const l=V.useNestedProp({userConfig:u.config,defaultConfig:L});return l.theme?{...V.useNestedProp({userConfig:a.themes.vue_ui_sparkstackbar[l.theme]||u.config,defaultConfig:l}),customPalette:a.themePalettes[l.theme]||a.palette}:l}e.watch(()=>u.config,l=>{t.value=$(),E()},{deep:!0}),e.watch(()=>u.dataset,l=>{p.value=u.dataset.map((n,o)=>({...n,color:n.color?a.convertColorToHex(n.color):f.value[o]||a.palette[o]||a.palette[o%a.palette.length]}))},{deep:!0});const f=e.computed(()=>a.convertCustomPalette(t.value.customPalette)),p=e.ref(u.dataset.map((l,n)=>({...l,value:t.value.style.animation.show?0:l.value||0,color:l.color?a.convertColorToHex(l.color):f.value[n]||a.palette[n]||a.palette[n%a.palette.length]}))),g=e.ref(!0);e.onMounted(()=>{if(E(),t.value.style.animation.show){let v=function(){r+=o/l,r<o?(p.value=p.value.map((s,i)=>({...s,value:s.value+=n[i],color:s.color?a.convertColorToHex(s.color):f.value[i]||a.palette[i]||a.palette[i%a.palette.length]})),requestAnimationFrame(v)):(g.value=!1,p.value=u.dataset.map((s,i)=>({...s,value:s.value||0,color:s.color?a.convertColorToHex(s.color):f.value[i]||a.palette[i]||a.palette[i%a.palette.length],id:a.createUid()})))};const l=t.value.style.animation.animationFrames,n=u.dataset.map((s,i)=>s.value/l),o=u.dataset.map(s=>s.value||0).reduce((s,i)=>s+i,0);let r=0;g.value=!0,v()}});function E(){a.objectIsEmpty(u.dataset)?a.error({componentName:"VueUiSparkStackbar",type:"dataset"}):u.dataset.forEach((l,n)=>{a.getMissingDatasetAttributes({datasetObject:l,requiredAttributes:["name","value"]}).forEach(o=>{a.error({componentName:"VueUiSparkStackbar",type:"datasetSerieAttribute",property:o,index:n})})})}const c=e.ref({width:500,height:16}),d=e.ref([]),N=e.computed(()=>u.dataset.map(l=>l.value||0).filter((l,n)=>!d.value.includes(n)).reduce((l,n)=>l+n,0)),y=e.computed(()=>p.value.map((l,n)=>{const o=l.value||0,r=o/N.value,v=isNaN(r)?0:r,s=v*c.value.width;return{...l,value:o,proportion:v,width:s,proportionLabel:a.dataLabel({v:v*100,s:"%",r:t.value.style.legend.percentage.rounding})}})),C=e.computed(()=>y.value.filter((l,n)=>!d.value.includes(n)));function F(l){d.value.includes(l)?d.value=d.value.filter(n=>n!==l):d.value.length<p.value.length-1&&d.value.push(l)}const h=e.computed(()=>{let l=0;const n=[];for(let o=0;o<C.value.length;o+=1)n.push({...C.value[o],start:l}),l+=C.value[o].width;return n});function z(l,n){D("selectDatapoint",{datapoint:l,index:n})}const w=e.ref(null),k=e.ref(!1),m=e.ref(null);function T({datapoint:l,seriesIndex:n}){if(!t.value.style.tooltip.show)return;w.value={datapoint:l,seriesIndex:n,config:t.value,series:y.value},b.value=!0,m.value=n;const o=t.value.style.tooltip.customFormat;if(a.isFunction(o))try{const r=o({seriesIndex:n,datapoint:l,series:y.value,config:t.value});typeof r=="string"&&(_.value=r,k.value=!0)}catch{console.warn("Custom format cannot be applied."),k.value=!1}if(!k.value){let r="";r+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${t.value.style.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${l.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"><circle cx="6" cy="6" r="6" stroke="none" fill="${l.color}"/></svg>`,r+=`<b>${l.proportionLabel}</b>`,r+=`<span>(${a.applyDataLabel(t.value.style.legend.value.formatter,l.value,a.dataLabel({p:t.value.style.legend.value.prefix,v:l.value,s:t.value.style.legend.value.suffix,r:t.value.style.legend.value.rounding}),{datapoint:l,seriesIndex:n})})</span>`,_.value=`<div>${r}</div>`}}return(l,n)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"sparkstackbarChart",ref:B,style:e.normalizeStyle(`width:100%; background:${t.value.style.backgroundColor}`)},[t.value.style.title.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(`width:calc(100% - 12px);background:transparent;margin:0 auto;margin:${t.value.style.title.margin};padding: 0 6px;text-align:${t.value.style.title.textAlign}`)},[e.createElementVNode("div",{style:e.normalizeStyle(`font-size:${t.value.style.title.fontSize}px;color:${t.value.style.title.color};font-weight:${t.value.style.title.bold?"bold":"normal"}`)},e.toDisplayString(t.value.style.title.text),5),t.value.style.title.subtitle.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(`font-size:${t.value.style.title.subtitle.fontSize}px;color:${t.value.style.title.subtitle.color};font-weight:${t.value.style.title.subtitle.bold?"bold":"normal"}`)},e.toDisplayString(t.value.style.title.subtitle.text),5)):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),x.value?(e.openBlock(),e.createElementBlock("svg",{key:1,xmlns:e.unref(a.XMLNS),width:"100%",viewBox:`0 0 ${c.value.width} ${c.value.height}`},[e.createVNode(q._sfc_main),e.createElementVNode("defs",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(o,r)=>(e.openBlock(),e.createElementBlock("linearGradient",{key:`stack_gradient_${r}`,gradientTransform:"rotate(90)",id:`stack_gradient_${r}_${S.value}`},[e.createElementVNode("stop",{offset:"0%","stop-color":o.color},null,8,H),e.createElementVNode("stop",{offset:"50%","stop-color":e.unref(a.setOpacity)(e.unref(a.shiftHue)(o.color,.05),100-t.value.style.bar.gradient.intensity)},null,8,I),e.createElementVNode("stop",{offset:"100%","stop-color":o.color},null,8,R)],8,M))),128)),e.createElementVNode("clipPath",W,[e.createElementVNode("rect",{x:"0.005",y:"-2",width:"0.99",height:"5",rx:"3",ry:"3",fill:t.value.style.backgroundColor},null,8,Y)])]),N.value>0?(e.openBlock(),e.createElementBlock("g",G,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(o,r)=>(e.openBlock(),e.createElementBlock("rect",{key:`stack_underlayer_${r}`,x:o.start,y:0,width:o.width,height:c.value.height,fill:t.value.style.bar.gradient.underlayerColor,class:e.normalizeClass({animated:!g.value}),style:e.normalizeStyle({opacity:m.value!==null&&t.value.style.tooltip.show?m.value===r?1:.5:1})},null,14,X))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(o,r)=>(e.openBlock(),e.createElementBlock("rect",{key:`stack_${r}`,x:o.start,y:0,width:o.width,height:c.value.height,fill:t.value.style.bar.gradient.show?`url(#stack_gradient_${r}_${S.value})`:o.color,stroke:t.value.style.backgroundColor,"stroke-linecap":"round",class:e.normalizeClass({animated:!g.value}),style:e.normalizeStyle({opacity:m.value!==null&&t.value.style.tooltip.show?m.value===r?1:.5:1})},null,14,J))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(o,r)=>(e.openBlock(),e.createElementBlock("rect",{key:`stack_trap_${r}`,onClick:()=>z(o,r),x:o.start,y:0,width:o.width,height:c.value.height,fill:"transparent",stroke:"none",class:e.normalizeClass({animated:!g.value}),onMouseenter:()=>T({datapoint:o,seriesIndex:r}),onMouseleave:n[0]||(n[0]=v=>{b.value=!1,m.value=null})},null,42,K))),128))])):(e.openBlock(),e.createElementBlock("rect",{key:1,x:2,y:1,width:c.value.width-4,height:c.value.height-2,stroke:"#CCCCCC","stroke-width":"2",fill:"transparent",rx:(c.value.height-4)/2},null,8,Q))],8,j)):e.createCommentVNode("",!0),x.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(A.default,{key:2,config:{type:"sparkStackbar",style:{backgroundColor:t.value.style.backgroundColor,sparkStackbar:{color:"#CCCCCC"}}}},null,8,["config"])),t.value.style.legend.show?(e.openBlock(),e.createElementBlock("div",{key:3,style:e.normalizeStyle(`background:transparent;margin:0 auto;margin:${t.value.style.legend.margin};justify-content:${t.value.style.legend.textAlign==="left"?"flex-start":t.value.style.legend.textAlign==="right"?"flex-end":"center"}`),class:"vue-ui-sparkstackbar-legend"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,(o,r)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(`font-size:${t.value.style.legend.fontSize}px;`),class:e.normalizeClass({"vue-ui-sparkstackbar-legend-item":!0,"vue-ui-sparkstackbar-legend-item-unselected":d.value.includes(r)}),onClick:v=>{F(r),z(o,r)}},[e.createElementVNode("div",ee,[(e.openBlock(),e.createElementBlock("svg",{height:`${t.value.style.legend.fontSize}px`,width:`${t.value.style.legend.fontSize}px`,viewBox:"0 0 10 10"},[e.createElementVNode("circle",{cx:5,cy:5,r:5,fill:o.color},null,8,le)],8,te)),e.createElementVNode("span",{style:e.normalizeStyle(`color:${t.value.style.legend.name.color}; font-weight:${t.value.style.legend.name.bold?"bold":"normal"}`)},e.toDisplayString(o.name),5),t.value.style.legend.percentage.show?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle(`font-weight:${t.value.style.legend.percentage.bold?"bold":"normal"};color:${t.value.style.legend.percentage.color}`)},e.toDisplayString(d.value.includes(r)?" - ":o.proportionLabel),5)):e.createCommentVNode("",!0),t.value.style.legend.value.show?(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle(`font-weight:${t.value.style.legend.value.bold?"bold":"normal"};color:${t.value.style.legend.value.color}`)}," ("+e.toDisplayString(e.unref(a.applyDataLabel)(t.value.style.legend.value.formatter,o.value,e.unref(a.dataLabel)({p:t.value.style.legend.value.prefix,v:o.value,s:t.value.style.legend.value.suffix,r:t.value.style.legend.value.rounding}),{datapoint:o,seriesIndex:r}))+") ",5)):e.createCommentVNode("",!0)])],14,Z))),256))],4)):e.createCommentVNode("",!0),e.createVNode(O._sfc_main,{show:b.value&&t.value.style.tooltip.show,parent:B.value,backgroundColor:t.value.style.tooltip.backgroundColor,color:t.value.style.tooltip.color,fontSize:t.value.style.tooltip.fontSize,borderRadius:t.value.style.tooltip.borderRadius,borderColor:t.value.style.tooltip.borderColor,borderWidth:t.value.style.tooltip.borderWidth,backgroundOpacity:t.value.style.tooltip.backgroundOpacity,position:t.value.style.tooltip.position,content:_.value,isCustom:k.value,offsetY:-124+t.value.style.tooltip.offsetY,blockShiftY:!0},{"tooltip-before":e.withCtx(()=>[e.renderSlot(l.$slots,"tooltip-before",e.normalizeProps(e.guardReactiveProps({...w.value})),void 0,!0)]),"tooltip-after":e.withCtx(()=>[e.renderSlot(l.$slots,"tooltip-after",e.normalizeProps(e.guardReactiveProps({...w.value})),void 0,!0)]),_:3},8,["show","parent","backgroundColor","color","fontSize","borderRadius","borderColor","borderWidth","backgroundOpacity","position","content","isCustom","offsetY"]),l.$slots.source?(e.openBlock(),e.createElementBlock("div",oe,[e.renderSlot(l.$slots,"source",{},void 0,!0)],512)):e.createCommentVNode("",!0)],4))}},re=U._export_sfc(ae,[["__scopeId","data-v-233900f7"]]);exports.default=re;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { computed as p, ref as g, onMounted as Xe, watch as Ue, openBlock as s, createElementBlock as n, normalizeClass as ye, normalizeStyle as U, createBlock as Y, createCommentVNode as v, renderSlot as k, createVNode as se, unref as z, createSlots as xt, withCtx as C, normalizeProps as D, guardReactiveProps as E, Fragment as h, renderList as f, createElementVNode as H, toDisplayString as S, createTextVNode as kt } from "vue";
|
|
2
|
-
import { u as wt, c as Ye, t as Ct, a as _t, p as ie, M as Ge, b as zt, o as Lt, e as Je, g as St, d as $t, a7 as ne, a3 as qe, C as Ze, X as Mt, l as Tt, F as Ke, f as B, x as Qe, i as je, y as Nt, q as Ot, r as Pt } from "./index-
|
|
3
|
-
import { u as et } from "./useNestedProp-
|
|
2
|
+
import { u as wt, c as Ye, t as Ct, a as _t, p as ie, M as Ge, b as zt, o as Lt, e as Je, g as St, d as $t, a7 as ne, a3 as qe, C as Ze, X as Mt, l as Tt, F as Ke, f as B, x as Qe, i as je, y as Nt, q as Ot, r as Pt } from "./index-hV0hU1iE.js";
|
|
3
|
+
import { u as et } from "./useNestedProp-CRAUOmT5.js";
|
|
4
4
|
import { t as At, u as Rt } from "./useResponsive-CoxXLe23.js";
|
|
5
|
-
import { u as It, U as Ft } from "./usePrinter-
|
|
6
|
-
import { S as Vt } from "./Slicer-
|
|
7
|
-
import { _ as Dt } from "./Tooltip-
|
|
8
|
-
import { _ as Et } from "./Title-
|
|
9
|
-
import { L as Ht } from "./Legend-
|
|
10
|
-
import Bt from "./vue-ui-accordion-
|
|
11
|
-
import { D as Wt } from "./DataTable-
|
|
12
|
-
import Xt from "./vue-ui-skeleton-
|
|
13
|
-
import { _ as Ut } from "./PackageVersion-
|
|
14
|
-
import { P as Yt } from "./PenAndPaper-
|
|
5
|
+
import { u as It, U as Ft } from "./usePrinter-y3d31M4g.js";
|
|
6
|
+
import { S as Vt } from "./Slicer-DV1kBscZ.js";
|
|
7
|
+
import { _ as Dt } from "./Tooltip-Com_T8vc.js";
|
|
8
|
+
import { _ as Et } from "./Title-DBozX6nP.js";
|
|
9
|
+
import { L as Ht } from "./Legend-hnLfwhmm.js";
|
|
10
|
+
import Bt from "./vue-ui-accordion-m-s-7akB.js";
|
|
11
|
+
import { D as Wt } from "./DataTable-BpVz3DBX.js";
|
|
12
|
+
import Xt from "./vue-ui-skeleton-BY8Jg9a_.js";
|
|
13
|
+
import { _ as Ut } from "./PackageVersion-wqab02xF.js";
|
|
14
|
+
import { P as Yt } from "./PenAndPaper-C_laA5mt.js";
|
|
15
15
|
import { _ as Gt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
16
16
|
const Jt = ["id"], qt = ["xmlns", "viewBox"], Zt = { key: 0 }, Kt = ["id"], Qt = ["stop-color"], jt = ["stop-color"], ea = ["stop-color"], ta = ["x1", "x2", "y1", "y2", "stroke"], aa = ["x1", "x2", "y1", "y2", "stroke"], la = ["x1", "x2", "y1", "y2", "stroke"], oa = ["x1", "x2", "y1", "y2", "stroke"], ra = ["x", "y", "height", "rx", "width", "fill", "stroke", "stroke-width"], sa = ["x", "y", "width", "rx", "height", "fill", "stroke", "stroke-width"], ia = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], na = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], ua = ["x", "y", "font-size", "fill", "font-weight"], ca = ["transform", "font-size", "fill", "font-weight"], va = ["x", "y", "font-size", "fill", "font-weight"], ha = { key: 0 }, da = ["x", "y", "font-size", "font-weight", "fill"], ya = ["x", "y", "font-size", "fill", "font-weight"], ga = { key: 0 }, ba = ["x", "y", "font-size", "font-weight", "fill"], fa = ["x1", "x2", "y1", "y2", "stroke"], ma = ["x", "y", "font-size", "font-weight", "fill"], pa = ["x1", "x2", "y1", "y2", "stroke"], xa = ["font-size", "font-weight", "fill", "text-anchor", "transform"], ka = ["text-anchor", "font-size", "font-weight", "fill", "transform"], wa = ["font-size", "font-weight", "fill", "x", "y"], Ca = ["x", "y", "width", "height", "onClick", "onMouseenter", "fill"], _a = ["x", "y", "width", "height", "onClick", "onMouseenter", "fill"], za = {
|
|
17
17
|
key: 4,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("./index-DsF7Aej7.cjs"),Le=require("./useNestedProp-D0YHk8Cd.cjs"),Se=require("./useResponsive-BJ7DTGpm.cjs"),ze=require("./usePrinter-CUDeluax.cjs"),Ye=require("./Slicer-BUhJuKdW.cjs"),Ge=require("./Tooltip-wdo3yY_W.cjs"),Je=require("./Title-Az2QIayC.cjs"),Ze=require("./Legend-B3KPtqT8.cjs"),Ke=require("./vue-ui-accordion-Av34wbMx.cjs"),Qe=require("./DataTable-T6NSDRqO.cjs"),je=require("./vue-ui-skeleton-e8hBgzZq.cjs"),et=require("./PackageVersion-BjoP5ypd.cjs"),tt=require("./PenAndPaper-C0H3KJhQ.cjs"),at=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),lt=["id"],ot=["xmlns","viewBox"],rt={key:0},st=["id"],nt=["stop-color"],it=["stop-color"],ut=["stop-color"],ct=["x1","x2","y1","y2","stroke"],dt=["x1","x2","y1","y2","stroke"],vt=["x1","x2","y1","y2","stroke"],ht=["x1","x2","y1","y2","stroke"],gt=["x","y","height","rx","width","fill","stroke","stroke-width"],yt=["x","y","width","rx","height","fill","stroke","stroke-width"],mt=["x1","x2","y1","y2","stroke","stroke-width"],bt=["x1","x2","y1","y2","stroke","stroke-width"],pt=["x","y","font-size","fill","font-weight"],ft=["transform","font-size","fill","font-weight"],kt=["x","y","font-size","fill","font-weight"],xt={key:0},wt=["x","y","font-size","font-weight","fill"],Ct=["x","y","font-size","fill","font-weight"],Bt={key:0},Lt=["x","y","font-size","font-weight","fill"],St=["x1","x2","y1","y2","stroke"],zt=["x","y","font-size","font-weight","fill"],_t=["x1","x2","y1","y2","stroke"],Nt=["font-size","font-weight","fill","text-anchor","transform"],Et=["text-anchor","font-size","font-weight","fill","transform"],Mt=["font-size","font-weight","fill","x","y"],$t=["x","y","width","height","onClick","onMouseenter","fill"],Tt=["x","y","width","height","onClick","onMouseenter","fill"],Vt={key:4,class:"vue-data-ui-watermark"},Pt=["onClick"],Ft=["innerHTML"],Rt={__name:"vue-ui-stackbar",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:["selectDatapoint","selectLegend"],setup(Z,{expose:_e,emit:K}){const y=Z,{vue_ui_stackbar:Ne}=c.useConfig(),E=e.computed({get(){return!!y.dataset&&y.dataset.length},set(l){return l}}),M=e.ref(null),U=e.ref(c.createUid()),O=e.ref(!1),Q=e.ref(null),X=e.ref(""),p=e.ref([]),j=e.ref(0),ee=e.ref(null),te=e.ref(null),ae=e.ref(null),le=e.ref(null),oe=e.ref(0),Y=e.ref(!1),$=e.ref(null),T=e.ref(!1),Ee=e.ref(0),Me=e.ref(0),$e=e.ref(0);e.onMounted(()=>{G()});const t=e.computed({get:()=>re(),set:l=>l});function re(){const l=Le.useNestedProp({userConfig:y.config,defaultConfig:Ne});let r={};return l.theme?r={...Le.useNestedProp({userConfig:c.themes.vue_ui_stackbar[l.theme]||y.config,defaultConfig:l}),customPalette:c.themePalettes[l.theme]||c.palette}:r=l,y.config&&c.hasDeepProperty(y.config,"style.chart.grid.scale.scaleMin")?r.style.chart.grid.scale.scaleMin=y.config.style.chart.grid.scale.scaleMin:r.style.chart.grid.scale.scaleMin=null,y.config&&c.hasDeepProperty(y.config,"style.chart.grid.scale.scaleMax")?r.style.chart.grid.scale.scaleMax=y.config.style.chart.grid.scale.scaleMax:r.style.chart.grid.scale.scaleMax=null,r}e.watch(()=>y.config,l=>{t.value=re(),G(),Ee.value+=1,Me.value+=1,$e.value+=1},{deep:!0}),e.watch(()=>y.dataset,l=>{ve()},{deep:!0});const b=e.ref({dataLabels:{show:t.value.style.chart.bars.dataLabels.show},showTable:t.value.table.show,showTooltip:t.value.style.chart.tooltip.show}),{isPrinting:se,isImaging:ne,generatePdf:ie,generateImage:ue}=ze.usePrinter({elementId:`stackbar_${U.value}`,fileName:t.value.style.chart.title.text||"vue-ui-stackbar"}),D=e.ref({width:t.value.style.chart.width,height:t.value.style.chart.height,paddingRatio:{top:t.value.style.chart.padding.top/t.value.style.chart.height,right:t.value.style.chart.padding.right/t.value.style.chart.width,bottom:t.value.style.chart.padding.bottom/t.value.style.chart.height,left:t.value.style.chart.padding.left/t.value.style.chart.width}}),Te=e.computed(()=>c.convertCustomPalette(t.value.customPalette)),ce=e.ref(null),de=e.ref(null);e.onMounted(()=>{G()});function G(){if(c.objectIsEmpty(y.dataset)?c.error({componentName:"VueUiStackbar",type:"dataset"}):y.dataset.forEach((l,r)=>{c.getMissingDatasetAttributes({datasetObject:l,requiredAttributes:["name","series"]}).forEach(a=>{E.value=!1,c.error({componentName:"VueUiStackbar",type:"datasetSerieAttribute",property:a,index:r})})}),setTimeout(()=>{T.value=!0},10),t.value.responsive){const l=Se.throttle(()=>{T.value=!1;const{width:r,height:a}=Se.useResponsive({chart:M.value,title:t.value.style.chart.title.text?ee.value:null,legend:t.value.style.chart.legend.show?te.value:null,slicer:t.value.style.chart.zoom.show&&L.value>1?ae.value:null,source:le.value});D.value.width=r,D.value.height=a,clearTimeout(de.value),de.value=setTimeout(()=>{T.value=!0},10)});ce.value=new ResizeObserver(l),ce.value.observe(M.value.parentNode)}}const s=e.computed(()=>{const{height:l,width:r}=D.value,{right:a}=D.value.paddingRatio,o=t.value.style.chart.padding.top,n=r-r*a,i=l-t.value.style.chart.padding.bottom,m=t.value.style.chart.padding.left,S=r-m-r*a,z=l-o-t.value.style.chart.padding.bottom;return{chartHeight:l,chartWidth:r,top:o,right:n,bottom:i,left:m,width:S,height:z<0?0:z}}),B=e.computed(()=>y.dataset.map((l,r)=>{const a=c.convertColorToHex(l.color)||Te.value[r]||c.palette[r]||c.palette[r%c.palette.length];return{...l,series:JSON.parse(JSON.stringify(l.series)).map(o=>t.value.style.chart.bars.distributed?Math.abs(o):o),signedSeries:l.series.map(o=>o>=0?1:-1),absoluteIndex:r,id:c.createUid(),color:a}})),L=e.computed(()=>Math.max(...B.value.filter(l=>!p.value.includes(l.id)).map(l=>l.series.length))),u=e.ref({start:0,end:Math.max(...y.dataset.map(l=>l.series.length))});function ve(){u.value={start:0,end:Math.max(...y.dataset.map(l=>l.series.length))},oe.value+=1}const d=e.computed(()=>{let l;return t.value.orientation==="vertical"?l=s.value.width/(u.value.end-u.value.start):l=s.value.height/(u.value.end-u.value.start),l<=0?0:l}),V=e.computed(()=>c.sumSeries(B.value.filter(l=>!p.value.includes(l.id))).slice(u.value.start,u.value.end)),Ve=e.computed(()=>c.sumSeries(B.value.filter(l=>!p.value.includes(l.id)).map(l=>({...l,series:l.series.map((r,a)=>l.signedSeries[a]===-1&&r>=0?-r:r)}))).slice(u.value.start,u.value.end)),A=e.computed(()=>{const l=B.value.filter(r=>!p.value.includes(r.id));return{positive:c.sumSeries(l.map(r=>({...r,series:r.series.slice(u.value.start,u.value.end).map(a=>a>=0?a:0)}))),negative:c.sumSeries(l.map(r=>({...r,series:r.series.slice(u.value.start,u.value.end).map(a=>a<0?a:0)})))}}),w=e.computed(()=>{const l=t.value.style.chart.grid.scale.scaleMax!==null&&!t.value.style.chart.bars.distributed?t.value.style.chart.grid.scale.scaleMax:Math.max(...A.value.positive),r=Math.min(...A.value.negative),a=t.value.style.chart.grid.scale.scaleMin!==null&&!t.value.style.chart.bars.distributed?t.value.style.chart.grid.scale.scaleMin:[-1/0,1/0,NaN,void 0,null].includes(r)?0:r,o=!t.value.style.chart.bars.distributed&&(t.value.style.chart.grid.scale.scaleMax!==null||t.value.style.chart.grid.scale.scaleMin!==null)?c.calculateNiceScaleWithExactExtremes(a>0?0:a,l<0?0:l,t.value.style.chart.grid.scale.ticks):c.calculateNiceScale(a>0?0:a,l<0?0:l,t.value.style.chart.grid.scale.ticks);return o.ticks.map(n=>({zero:s.value.bottom-s.value.height*(Math.abs(o.min)/(o.max+Math.abs(o.min))),y:s.value.bottom-s.value.height*((n+Math.abs(o.min))/(o.max+Math.abs(o.min))),x:s.value.left-8,horizontal_zero:s.value.left+s.value.width*(Math.abs(o.min)/(o.max+Math.abs(o.min))),horizontal_x:s.value.left+s.value.width*((n+Math.abs(o.min))/(o.max+Math.abs(o.min))),horizontal_y:s.value.bottom-8,value:n}))}),P=e.computed(()=>t.value.style.chart.grid.x.timeLabels.values.slice(u.value.start,u.value.end)),g=e.computed(()=>{if(!E.value)return[];let l=Array(L.value).fill(0),r=Array(L.value).fill(0),a=Array(L.value).fill(0),o=Array(L.value).fill(0);const n=Math.max(...A.value.positive)||0,i=Math.min(...A.value.negative),m=[-1/0,1/0,NaN,void 0,null].includes(i)?0:i,S=!t.value.style.chart.bars.distributed&&(t.value.style.chart.grid.scale.scaleMax!==null||t.value.style.chart.grid.scale.scaleMin!==null)?c.calculateNiceScaleWithExactExtremes(t.value.style.chart.grid.scale.scaleMin!==null?t.value.style.chart.grid.scale.scaleMin:m>0?0:m,t.value.style.chart.grid.scale.scaleMax!==null?t.value.style.chart.grid.scale.scaleMax:n<0?0:n,t.value.style.chart.grid.scale.ticks):c.calculateNiceScale(t.value.style.chart.grid.scale.scaleMin!==null?t.value.style.chart.grid.scale.scaleMin:m>0?0:m,t.value.style.chart.grid.scale.scaleMax!==null?t.value.style.chart.grid.scale.scaleMax:n<0?0:n,t.value.style.chart.grid.scale.ticks),{min:z,max:F}=S,_=F+(z>=0?0:Math.abs(z))||1,f=s.value.height,W=s.value.width,Ce=w.value[0]?w.value[0].zero:s.value.bottom,Be=w.value[0]?w.value[0].horizontal_zero:s.value.left;return B.value.filter(R=>!p.value.includes(R.id)).map(R=>{const C=R.series.slice(u.value.start,u.value.end),De=R.signedSeries.slice(u.value.start,u.value.end),Ae=C.map((v,h)=>s.value.left+d.value*h+d.value*t.value.style.chart.bars.gapRatio/4),Ie=C.map((v,h)=>s.value.top+d.value*h+d.value*t.value.style.chart.bars.gapRatio/4),qe=C.map((v,h)=>{const k=t.value.style.chart.bars.distributed?(v||0)/V.value[h]:(v||0)/_;let N,x;return v>0?(x=f*k,N=Ce-x-l[h],l[h]+=x):(x=f*k,N=Ce+a[h],a[h]+=Math.abs(x)),N}),He=C.map((v,h)=>{const k=t.value.style.chart.bars.distributed?(v||0)/V.value[h]:(v||0)/_;let N,x;return v>0?(x=W*k,N=Be+r[h],r[h]+=x):(x=W*k,N=Be-Math.abs(x)-o[h],o[h]+=Math.abs(x)),N}),We=C.map((v,h)=>{const k=t.value.style.chart.bars.distributed?(v||0)/V.value[h]:(v||0)/_;return v>0?f*k:f*Math.abs(k)}),Ue=C.map((v,h)=>{const k=t.value.style.chart.bars.distributed?(v||0)/V.value[h]:(v||0)/_;return v>0?W*k:W*Math.abs(k)}),Xe=C.map(v=>Math.abs(v)).reduce((v,h)=>v+h,0);return{...R,proportions:C.map((v,h)=>t.value.style.chart.bars.distributed?(v||0)/V.value[h]:(v||0)/Xe),series:C,signedSeries:De,x:Ae,y:qe,height:We,horizontal_width:Ue,horizontal_y:Ie,horizontal_x:He}})}),he=e.computed(()=>Ve.value.map((l,r)=>({value:l,sign:l>=0?1:-1})));function I(l,r,a,o,n){const i=n===-1&&l>=0?-l:l;return c.applyDataLabel(t.value.style.chart.bars.dataLabels.formatter,i,c.dataLabel({p:t.value.style.chart.bars.dataLabels.prefix,v:i,s:t.value.style.chart.bars.dataLabels.suffix,r:t.value.style.chart.bars.dataLabels.rounding}),{datapoint:r,seriesIndex:a,datapointIndex:o})}function ge(l,r,a,o){return c.applyDataLabel(t.value.style.chart.bars.dataLabels.formatter,l,c.dataLabel({v:l,s:"%",r:t.value.style.chart.bars.dataLabels.rounding}),{datapoint:r,seriesIndex:a,datapointIndex:o})}function ye(l){const r=JSON.parse(JSON.stringify(g.value)).map(a=>({name:a.name,value:a.series[l]===0?0:a.series[l]||null,proportion:a.proportions[l]||null,color:a.color,id:a.id}));K("selectDatapoint",{datapoint:r,period:P.value[l]})}function me(l){$.value=l,O.value=!0;const r=t.value.style.chart.tooltip.customFormat,a=JSON.parse(JSON.stringify(g.value)).map(n=>({name:n.name,value:n.series[l]===0?0:(n.signedSeries[l]===-1&&n.series[l]>=0?-n.series[l]:n.series[l])||null,proportion:n.proportions[l]||null,color:n.color,id:n.id})),o=a.map(n=>Math.abs(n.value)).reduce((n,i)=>n+i,0);if(c.isFunction(r)&&c.functionReturnsString(()=>r({seriesIndex:l,datapoint:a,series:g.value,config:t.value})))X.value=r({seriesIndex:l,datapoint:a,series:g.value,config:t.value});else{const{showValue:n,showPercentage:i,borderColor:m,roundingValue:S,roundingPercentage:z}=t.value.style.chart.tooltip;let F="";P.value[l]&&(F+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${m};padding-bottom:6px;margin-bottom:3px;">${P.value[l]}</div>`);const _=[n&&i?"(":"",n&&i?")":""];a.reverse().forEach(f=>{F+=`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("./index-CsQwCVqU.cjs"),Le=require("./useNestedProp-DSYpaLxP.cjs"),Se=require("./useResponsive-BJ7DTGpm.cjs"),ze=require("./usePrinter-O2fMMTMe.cjs"),Ye=require("./Slicer-C1blYfez.cjs"),Ge=require("./Tooltip-DvGSIp31.cjs"),Je=require("./Title-BRqTk-nT.cjs"),Ze=require("./Legend-G5Zc4QaZ.cjs"),Ke=require("./vue-ui-accordion-CaktYQoo.cjs"),Qe=require("./DataTable-H-KTkjfv.cjs"),je=require("./vue-ui-skeleton-DsRTbz6d.cjs"),et=require("./PackageVersion-BbQFSVXm.cjs"),tt=require("./PenAndPaper-BX8pR5oV.cjs"),at=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),lt=["id"],ot=["xmlns","viewBox"],rt={key:0},st=["id"],nt=["stop-color"],it=["stop-color"],ut=["stop-color"],ct=["x1","x2","y1","y2","stroke"],dt=["x1","x2","y1","y2","stroke"],vt=["x1","x2","y1","y2","stroke"],ht=["x1","x2","y1","y2","stroke"],gt=["x","y","height","rx","width","fill","stroke","stroke-width"],yt=["x","y","width","rx","height","fill","stroke","stroke-width"],mt=["x1","x2","y1","y2","stroke","stroke-width"],bt=["x1","x2","y1","y2","stroke","stroke-width"],pt=["x","y","font-size","fill","font-weight"],ft=["transform","font-size","fill","font-weight"],kt=["x","y","font-size","fill","font-weight"],xt={key:0},wt=["x","y","font-size","font-weight","fill"],Ct=["x","y","font-size","fill","font-weight"],Bt={key:0},Lt=["x","y","font-size","font-weight","fill"],St=["x1","x2","y1","y2","stroke"],zt=["x","y","font-size","font-weight","fill"],_t=["x1","x2","y1","y2","stroke"],Nt=["font-size","font-weight","fill","text-anchor","transform"],Et=["text-anchor","font-size","font-weight","fill","transform"],Mt=["font-size","font-weight","fill","x","y"],$t=["x","y","width","height","onClick","onMouseenter","fill"],Tt=["x","y","width","height","onClick","onMouseenter","fill"],Vt={key:4,class:"vue-data-ui-watermark"},Pt=["onClick"],Ft=["innerHTML"],Rt={__name:"vue-ui-stackbar",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:["selectDatapoint","selectLegend"],setup(Z,{expose:_e,emit:K}){const y=Z,{vue_ui_stackbar:Ne}=c.useConfig(),E=e.computed({get(){return!!y.dataset&&y.dataset.length},set(l){return l}}),M=e.ref(null),U=e.ref(c.createUid()),O=e.ref(!1),Q=e.ref(null),X=e.ref(""),p=e.ref([]),j=e.ref(0),ee=e.ref(null),te=e.ref(null),ae=e.ref(null),le=e.ref(null),oe=e.ref(0),Y=e.ref(!1),$=e.ref(null),T=e.ref(!1),Ee=e.ref(0),Me=e.ref(0),$e=e.ref(0);e.onMounted(()=>{G()});const t=e.computed({get:()=>re(),set:l=>l});function re(){const l=Le.useNestedProp({userConfig:y.config,defaultConfig:Ne});let r={};return l.theme?r={...Le.useNestedProp({userConfig:c.themes.vue_ui_stackbar[l.theme]||y.config,defaultConfig:l}),customPalette:c.themePalettes[l.theme]||c.palette}:r=l,y.config&&c.hasDeepProperty(y.config,"style.chart.grid.scale.scaleMin")?r.style.chart.grid.scale.scaleMin=y.config.style.chart.grid.scale.scaleMin:r.style.chart.grid.scale.scaleMin=null,y.config&&c.hasDeepProperty(y.config,"style.chart.grid.scale.scaleMax")?r.style.chart.grid.scale.scaleMax=y.config.style.chart.grid.scale.scaleMax:r.style.chart.grid.scale.scaleMax=null,r}e.watch(()=>y.config,l=>{t.value=re(),G(),Ee.value+=1,Me.value+=1,$e.value+=1},{deep:!0}),e.watch(()=>y.dataset,l=>{ve()},{deep:!0});const b=e.ref({dataLabels:{show:t.value.style.chart.bars.dataLabels.show},showTable:t.value.table.show,showTooltip:t.value.style.chart.tooltip.show}),{isPrinting:se,isImaging:ne,generatePdf:ie,generateImage:ue}=ze.usePrinter({elementId:`stackbar_${U.value}`,fileName:t.value.style.chart.title.text||"vue-ui-stackbar"}),D=e.ref({width:t.value.style.chart.width,height:t.value.style.chart.height,paddingRatio:{top:t.value.style.chart.padding.top/t.value.style.chart.height,right:t.value.style.chart.padding.right/t.value.style.chart.width,bottom:t.value.style.chart.padding.bottom/t.value.style.chart.height,left:t.value.style.chart.padding.left/t.value.style.chart.width}}),Te=e.computed(()=>c.convertCustomPalette(t.value.customPalette)),ce=e.ref(null),de=e.ref(null);e.onMounted(()=>{G()});function G(){if(c.objectIsEmpty(y.dataset)?c.error({componentName:"VueUiStackbar",type:"dataset"}):y.dataset.forEach((l,r)=>{c.getMissingDatasetAttributes({datasetObject:l,requiredAttributes:["name","series"]}).forEach(a=>{E.value=!1,c.error({componentName:"VueUiStackbar",type:"datasetSerieAttribute",property:a,index:r})})}),setTimeout(()=>{T.value=!0},10),t.value.responsive){const l=Se.throttle(()=>{T.value=!1;const{width:r,height:a}=Se.useResponsive({chart:M.value,title:t.value.style.chart.title.text?ee.value:null,legend:t.value.style.chart.legend.show?te.value:null,slicer:t.value.style.chart.zoom.show&&L.value>1?ae.value:null,source:le.value});D.value.width=r,D.value.height=a,clearTimeout(de.value),de.value=setTimeout(()=>{T.value=!0},10)});ce.value=new ResizeObserver(l),ce.value.observe(M.value.parentNode)}}const s=e.computed(()=>{const{height:l,width:r}=D.value,{right:a}=D.value.paddingRatio,o=t.value.style.chart.padding.top,n=r-r*a,i=l-t.value.style.chart.padding.bottom,m=t.value.style.chart.padding.left,S=r-m-r*a,z=l-o-t.value.style.chart.padding.bottom;return{chartHeight:l,chartWidth:r,top:o,right:n,bottom:i,left:m,width:S,height:z<0?0:z}}),B=e.computed(()=>y.dataset.map((l,r)=>{const a=c.convertColorToHex(l.color)||Te.value[r]||c.palette[r]||c.palette[r%c.palette.length];return{...l,series:JSON.parse(JSON.stringify(l.series)).map(o=>t.value.style.chart.bars.distributed?Math.abs(o):o),signedSeries:l.series.map(o=>o>=0?1:-1),absoluteIndex:r,id:c.createUid(),color:a}})),L=e.computed(()=>Math.max(...B.value.filter(l=>!p.value.includes(l.id)).map(l=>l.series.length))),u=e.ref({start:0,end:Math.max(...y.dataset.map(l=>l.series.length))});function ve(){u.value={start:0,end:Math.max(...y.dataset.map(l=>l.series.length))},oe.value+=1}const d=e.computed(()=>{let l;return t.value.orientation==="vertical"?l=s.value.width/(u.value.end-u.value.start):l=s.value.height/(u.value.end-u.value.start),l<=0?0:l}),V=e.computed(()=>c.sumSeries(B.value.filter(l=>!p.value.includes(l.id))).slice(u.value.start,u.value.end)),Ve=e.computed(()=>c.sumSeries(B.value.filter(l=>!p.value.includes(l.id)).map(l=>({...l,series:l.series.map((r,a)=>l.signedSeries[a]===-1&&r>=0?-r:r)}))).slice(u.value.start,u.value.end)),A=e.computed(()=>{const l=B.value.filter(r=>!p.value.includes(r.id));return{positive:c.sumSeries(l.map(r=>({...r,series:r.series.slice(u.value.start,u.value.end).map(a=>a>=0?a:0)}))),negative:c.sumSeries(l.map(r=>({...r,series:r.series.slice(u.value.start,u.value.end).map(a=>a<0?a:0)})))}}),w=e.computed(()=>{const l=t.value.style.chart.grid.scale.scaleMax!==null&&!t.value.style.chart.bars.distributed?t.value.style.chart.grid.scale.scaleMax:Math.max(...A.value.positive),r=Math.min(...A.value.negative),a=t.value.style.chart.grid.scale.scaleMin!==null&&!t.value.style.chart.bars.distributed?t.value.style.chart.grid.scale.scaleMin:[-1/0,1/0,NaN,void 0,null].includes(r)?0:r,o=!t.value.style.chart.bars.distributed&&(t.value.style.chart.grid.scale.scaleMax!==null||t.value.style.chart.grid.scale.scaleMin!==null)?c.calculateNiceScaleWithExactExtremes(a>0?0:a,l<0?0:l,t.value.style.chart.grid.scale.ticks):c.calculateNiceScale(a>0?0:a,l<0?0:l,t.value.style.chart.grid.scale.ticks);return o.ticks.map(n=>({zero:s.value.bottom-s.value.height*(Math.abs(o.min)/(o.max+Math.abs(o.min))),y:s.value.bottom-s.value.height*((n+Math.abs(o.min))/(o.max+Math.abs(o.min))),x:s.value.left-8,horizontal_zero:s.value.left+s.value.width*(Math.abs(o.min)/(o.max+Math.abs(o.min))),horizontal_x:s.value.left+s.value.width*((n+Math.abs(o.min))/(o.max+Math.abs(o.min))),horizontal_y:s.value.bottom-8,value:n}))}),P=e.computed(()=>t.value.style.chart.grid.x.timeLabels.values.slice(u.value.start,u.value.end)),g=e.computed(()=>{if(!E.value)return[];let l=Array(L.value).fill(0),r=Array(L.value).fill(0),a=Array(L.value).fill(0),o=Array(L.value).fill(0);const n=Math.max(...A.value.positive)||0,i=Math.min(...A.value.negative),m=[-1/0,1/0,NaN,void 0,null].includes(i)?0:i,S=!t.value.style.chart.bars.distributed&&(t.value.style.chart.grid.scale.scaleMax!==null||t.value.style.chart.grid.scale.scaleMin!==null)?c.calculateNiceScaleWithExactExtremes(t.value.style.chart.grid.scale.scaleMin!==null?t.value.style.chart.grid.scale.scaleMin:m>0?0:m,t.value.style.chart.grid.scale.scaleMax!==null?t.value.style.chart.grid.scale.scaleMax:n<0?0:n,t.value.style.chart.grid.scale.ticks):c.calculateNiceScale(t.value.style.chart.grid.scale.scaleMin!==null?t.value.style.chart.grid.scale.scaleMin:m>0?0:m,t.value.style.chart.grid.scale.scaleMax!==null?t.value.style.chart.grid.scale.scaleMax:n<0?0:n,t.value.style.chart.grid.scale.ticks),{min:z,max:F}=S,_=F+(z>=0?0:Math.abs(z))||1,f=s.value.height,W=s.value.width,Ce=w.value[0]?w.value[0].zero:s.value.bottom,Be=w.value[0]?w.value[0].horizontal_zero:s.value.left;return B.value.filter(R=>!p.value.includes(R.id)).map(R=>{const C=R.series.slice(u.value.start,u.value.end),De=R.signedSeries.slice(u.value.start,u.value.end),Ae=C.map((v,h)=>s.value.left+d.value*h+d.value*t.value.style.chart.bars.gapRatio/4),Ie=C.map((v,h)=>s.value.top+d.value*h+d.value*t.value.style.chart.bars.gapRatio/4),qe=C.map((v,h)=>{const k=t.value.style.chart.bars.distributed?(v||0)/V.value[h]:(v||0)/_;let N,x;return v>0?(x=f*k,N=Ce-x-l[h],l[h]+=x):(x=f*k,N=Ce+a[h],a[h]+=Math.abs(x)),N}),He=C.map((v,h)=>{const k=t.value.style.chart.bars.distributed?(v||0)/V.value[h]:(v||0)/_;let N,x;return v>0?(x=W*k,N=Be+r[h],r[h]+=x):(x=W*k,N=Be-Math.abs(x)-o[h],o[h]+=Math.abs(x)),N}),We=C.map((v,h)=>{const k=t.value.style.chart.bars.distributed?(v||0)/V.value[h]:(v||0)/_;return v>0?f*k:f*Math.abs(k)}),Ue=C.map((v,h)=>{const k=t.value.style.chart.bars.distributed?(v||0)/V.value[h]:(v||0)/_;return v>0?W*k:W*Math.abs(k)}),Xe=C.map(v=>Math.abs(v)).reduce((v,h)=>v+h,0);return{...R,proportions:C.map((v,h)=>t.value.style.chart.bars.distributed?(v||0)/V.value[h]:(v||0)/Xe),series:C,signedSeries:De,x:Ae,y:qe,height:We,horizontal_width:Ue,horizontal_y:Ie,horizontal_x:He}})}),he=e.computed(()=>Ve.value.map((l,r)=>({value:l,sign:l>=0?1:-1})));function I(l,r,a,o,n){const i=n===-1&&l>=0?-l:l;return c.applyDataLabel(t.value.style.chart.bars.dataLabels.formatter,i,c.dataLabel({p:t.value.style.chart.bars.dataLabels.prefix,v:i,s:t.value.style.chart.bars.dataLabels.suffix,r:t.value.style.chart.bars.dataLabels.rounding}),{datapoint:r,seriesIndex:a,datapointIndex:o})}function ge(l,r,a,o){return c.applyDataLabel(t.value.style.chart.bars.dataLabels.formatter,l,c.dataLabel({v:l,s:"%",r:t.value.style.chart.bars.dataLabels.rounding}),{datapoint:r,seriesIndex:a,datapointIndex:o})}function ye(l){const r=JSON.parse(JSON.stringify(g.value)).map(a=>({name:a.name,value:a.series[l]===0?0:a.series[l]||null,proportion:a.proportions[l]||null,color:a.color,id:a.id}));K("selectDatapoint",{datapoint:r,period:P.value[l]})}function me(l){$.value=l,O.value=!0;const r=t.value.style.chart.tooltip.customFormat,a=JSON.parse(JSON.stringify(g.value)).map(n=>({name:n.name,value:n.series[l]===0?0:(n.signedSeries[l]===-1&&n.series[l]>=0?-n.series[l]:n.series[l])||null,proportion:n.proportions[l]||null,color:n.color,id:n.id})),o=a.map(n=>Math.abs(n.value)).reduce((n,i)=>n+i,0);if(c.isFunction(r)&&c.functionReturnsString(()=>r({seriesIndex:l,datapoint:a,series:g.value,config:t.value})))X.value=r({seriesIndex:l,datapoint:a,series:g.value,config:t.value});else{const{showValue:n,showPercentage:i,borderColor:m,roundingValue:S,roundingPercentage:z}=t.value.style.chart.tooltip;let F="";P.value[l]&&(F+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${m};padding-bottom:6px;margin-bottom:3px;">${P.value[l]}</div>`);const _=[n&&i?"(":"",n&&i?")":""];a.reverse().forEach(f=>{F+=`
|
|
2
2
|
<div style="display:flex;flex-direction:row;align-items:center;gap:4px">
|
|
3
3
|
<svg viewBox="0 0 12 12" height="14" width="14"><rect rx="1" x="0" y="0" height="12" width="12" stroke="none" fill="${t.value.style.chart.bars.gradient.show?`url(#gradient_${f.id})`:f.color}"/></svg>
|
|
4
4
|
${f.name}${n||i?":":""} ${n?c.dataLabel({p:t.value.style.chart.bars.dataLabels.prefix,v:f.value,s:t.value.style.chart.bars.dataLabels.suffix,r:S}):""} ${_[0]}${i?c.dataLabel({v:isNaN(f.value/o)?0:Math.abs(f.value)/o*100,s:"%",r:z}):""}${_[1]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { computed as h, ref as i, watch as Ie, onMounted as Me, onBeforeUnmount as De, openBlock as o, createElementBlock as u, normalizeClass as F, normalizeStyle as Q, createBlock as T, createCommentVNode as v, unref as d, createSlots as Ge, withCtx as f, renderSlot as y, normalizeProps as W, guardReactiveProps as I, createVNode as xe, Fragment as g, renderList as C, createElementVNode as k, toDisplayString as L, mergeProps as Ee, createTextVNode as Ve, nextTick as He } from "vue";
|
|
2
|
-
import { u as Re, c as Z, t as Ue, a as Be, p as A, o as Xe, e as ee, g as Ce, b as je, d as we, v as Ye, C as Je, f as B, X as qe, i as te, l as Ke, h as Qe, x as _e, y as Ze, q as et, r as tt, E as lt } from "./index-
|
|
2
|
+
import { u as Re, c as Z, t as Ue, a as Be, p as A, o as Xe, e as ee, g as Ce, b as je, d as we, v as Ye, C as Je, f as B, X as qe, i as te, l as Ke, h as Qe, x as _e, y as Ze, q as et, r as tt, E as lt } from "./index-hV0hU1iE.js";
|
|
3
3
|
import { t as at, u as ot } from "./useResponsive-CoxXLe23.js";
|
|
4
|
-
import { _ as st } from "./Title-
|
|
5
|
-
import { u as rt, U as ut } from "./usePrinter-
|
|
6
|
-
import { _ as nt } from "./Tooltip-
|
|
7
|
-
import { D as it } from "./DataTable-
|
|
8
|
-
import vt from "./vue-ui-skeleton-
|
|
9
|
-
import { _ as ct } from "./Shape-
|
|
10
|
-
import ht from "./vue-ui-accordion-
|
|
11
|
-
import { u as $e } from "./useNestedProp-
|
|
12
|
-
import { _ as dt } from "./PackageVersion-
|
|
13
|
-
import { P as pt } from "./PenAndPaper-
|
|
4
|
+
import { _ as st } from "./Title-DBozX6nP.js";
|
|
5
|
+
import { u as rt, U as ut } from "./usePrinter-y3d31M4g.js";
|
|
6
|
+
import { _ as nt } from "./Tooltip-Com_T8vc.js";
|
|
7
|
+
import { D as it } from "./DataTable-BpVz3DBX.js";
|
|
8
|
+
import vt from "./vue-ui-skeleton-BY8Jg9a_.js";
|
|
9
|
+
import { _ as ct } from "./Shape-QdnXSUyn.js";
|
|
10
|
+
import ht from "./vue-ui-accordion-m-s-7akB.js";
|
|
11
|
+
import { u as $e } from "./useNestedProp-CRAUOmT5.js";
|
|
12
|
+
import { _ as dt } from "./PackageVersion-wqab02xF.js";
|
|
13
|
+
import { P as pt } from "./PenAndPaper-C_laA5mt.js";
|
|
14
14
|
import { _ as ft } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
15
15
|
const yt = ["id"], bt = ["xmlns", "viewBox"], mt = { key: 0 }, gt = { key: 0 }, kt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], xt = { key: 1 }, Ct = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], wt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], _t = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], $t = ["x", "y", "fill", "font-size"], Tt = ["x", "y", "font-size", "fill"], Lt = ["fill", "font-size", "transform"], At = ["fill", "font-size", "x", "y"], Pt = ["x1", "x2", "y1", "y2", "stroke"], St = ["cx", "cy", "fill"], zt = ["cx", "cy", "fill"], Nt = ["id"], Ot = ["stop-color"], Ft = ["stop-color"], Wt = ["stop-color"], It = { key: 0 }, Mt = ["x", "y", "font-size", "fill"], Dt = {
|
|
16
16
|
key: 5,
|