vue-data-ui 2.5.0 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/dist/{Arrow-CDKNBZrn.cjs → Arrow-B6TKrox1.cjs} +1 -1
  2. package/dist/{Arrow-DO1Kr0tq.js → Arrow-DWRIfIAk.js} +1 -1
  3. package/dist/{BaseIcon-BKYwMJ4Y.cjs → BaseIcon-BdnE2DAH.cjs} +1 -1
  4. package/dist/{BaseIcon-DVY6e_YL.js → BaseIcon-QBIdDtsh.js} +1 -1
  5. package/dist/{DataTable-D4_TjSBJ.js → DataTable-BaW_PF1t.js} +2 -2
  6. package/dist/{DataTable-ZowHAjXC.cjs → DataTable-D8Jrpq-B.cjs} +1 -1
  7. package/dist/{Legend-CcoLuZn0.cjs → Legend-D_1LwKfa.cjs} +1 -1
  8. package/dist/{Legend-K7NRkzGf.js → Legend-Qe36RQO1.js} +2 -2
  9. package/dist/{PackageVersion-Cun_qdX7.cjs → PackageVersion-CLMnI-8e.cjs} +1 -1
  10. package/dist/{PackageVersion-DKr8jVlI.js → PackageVersion-DBbbI7TU.js} +1 -1
  11. package/dist/{PenAndPaper-u46MyY7W.cjs → PenAndPaper-DxTPtHU5.cjs} +1 -1
  12. package/dist/{PenAndPaper-CurhQVkh.js → PenAndPaper-tV-SbWUa.js} +3 -3
  13. package/dist/{Shape-C4LyHNQ3.js → Shape-BDcnW_8x.js} +1 -1
  14. package/dist/{Shape-B6dlN2je.cjs → Shape-lPTNUyoX.cjs} +1 -1
  15. package/dist/{Slicer-CP2dQhd5.js → Slicer-BnomLNhl.js} +2 -2
  16. package/dist/{Slicer-BIzpsKb9.cjs → Slicer-UxISG-yc.cjs} +1 -1
  17. package/dist/{Title-bDp_4dQV.cjs → Title-C6GY7-tb.cjs} +1 -1
  18. package/dist/{Title-C4aoNP1T.js → Title-hfEOmPlv.js} +1 -1
  19. package/dist/{Tooltip-fEuHWstj.cjs → Tooltip-CVzhBGn7.cjs} +1 -1
  20. package/dist/{Tooltip-CG6ZX21C.js → Tooltip-DvcJ9uFx.js} +1 -1
  21. package/dist/index-8TfPi9lB.cjs +9 -0
  22. package/dist/{index-DAAFXQJj.js → index-OhfEeW2N.js} +156 -156
  23. package/dist/{useNestedProp--1nKK7i0.cjs → useNestedProp-BKRkMJ0r.cjs} +1 -1
  24. package/dist/{useNestedProp-DMtJzMiX.js → useNestedProp-Cwjz-hIm.js} +1 -1
  25. package/dist/{usePrinter-xicwiw8r.cjs → usePrinter-CzqlwBQp.cjs} +1 -1
  26. package/dist/{usePrinter-BvlefWMW.js → usePrinter-stvkbwgz.js} +1 -1
  27. package/dist/{vue-data-ui-DfZfDAuq.cjs → vue-data-ui-BU2uVZ8u.cjs} +1 -1
  28. package/dist/{vue-data-ui-59LZYiyy.js → vue-data-ui-BtU5J1kO.js} +61 -61
  29. package/dist/vue-data-ui.cjs +1 -1
  30. package/dist/vue-data-ui.js +1 -1
  31. package/dist/{vue-ui-3d-bar-Bm56SoLy.js → vue-ui-3d-bar-Bf1P0qgr.js} +9 -9
  32. package/dist/{vue-ui-3d-bar-CZlGwiDq.cjs → vue-ui-3d-bar-Dyo1Q2wP.cjs} +1 -1
  33. package/dist/{vue-ui-accordion-B67N9Oo8.js → vue-ui-accordion-BH0OU8sD.js} +3 -3
  34. package/dist/{vue-ui-accordion-B4PyxVUm.cjs → vue-ui-accordion-CDyaHBeZ.cjs} +1 -1
  35. package/dist/{vue-ui-age-pyramid-DCMUbrYc.js → vue-ui-age-pyramid-D_geE4yV.js} +10 -10
  36. package/dist/{vue-ui-age-pyramid-D9DN4SYa.cjs → vue-ui-age-pyramid-pVg5s_Ov.cjs} +1 -1
  37. package/dist/{vue-ui-annotator-MuRFw529.js → vue-ui-annotator-B7SCNeQW.js} +1 -1
  38. package/dist/{vue-ui-annotator-CNrWYokB.cjs → vue-ui-annotator-C801utZu.cjs} +1 -1
  39. package/dist/{vue-ui-bullet-DJjM56tB.cjs → vue-ui-bullet-BHEWqnfi.cjs} +1 -1
  40. package/dist/{vue-ui-bullet-Bojb2p0l.js → vue-ui-bullet-BkhafZhy.js} +8 -8
  41. package/dist/{vue-ui-candlestick-B3J5_Q_K.cjs → vue-ui-candlestick-DO_gKBjH.cjs} +1 -1
  42. package/dist/{vue-ui-candlestick-DXMPVZ0k.js → vue-ui-candlestick-p--HKs4y.js} +11 -11
  43. package/dist/{vue-ui-carousel-table-CQAWsXet.js → vue-ui-carousel-table-085oPZYs.js} +4 -4
  44. package/dist/{vue-ui-carousel-table-WNkO6kVE.cjs → vue-ui-carousel-table-CFkTzNWc.cjs} +1 -1
  45. package/dist/{vue-ui-chestnut-CChxV7D2.js → vue-ui-chestnut-DwwohH1I.js} +8 -8
  46. package/dist/{vue-ui-chestnut-DUHyQSIc.cjs → vue-ui-chestnut-nwV10tRK.cjs} +1 -1
  47. package/dist/{vue-ui-circle-pack-feW9MRNc.js → vue-ui-circle-pack-CEbJgElX.js} +9 -9
  48. package/dist/{vue-ui-circle-pack-Bo9NTyE5.cjs → vue-ui-circle-pack-Ckz1noNv.cjs} +1 -1
  49. package/dist/{vue-ui-cursor-CTNCoeO1.js → vue-ui-cursor-DoI4WKkL.js} +2 -2
  50. package/dist/{vue-ui-cursor-Y79oTXbN.cjs → vue-ui-cursor-Dy-h9HRU.cjs} +1 -1
  51. package/dist/{vue-ui-dashboard-ht0wjO32.cjs → vue-ui-dashboard-D4D8EpSH.cjs} +1 -1
  52. package/dist/{vue-ui-dashboard-CTk7cXk3.js → vue-ui-dashboard-S_-VrC-e.js} +2 -2
  53. package/dist/{vue-ui-digits-CRfqQd-4.js → vue-ui-digits-DVrKHvAx.js} +2 -2
  54. package/dist/{vue-ui-digits-CSzsY3pv.cjs → vue-ui-digits-woeBxaRE.cjs} +1 -1
  55. package/dist/{vue-ui-donut-DhQt8Zro.cjs → vue-ui-donut-BQpTsxFs.cjs} +1 -1
  56. package/dist/{vue-ui-donut-D6U1P8MA.js → vue-ui-donut-DLSPHatR.js} +12 -12
  57. package/dist/{vue-ui-donut-evolution-ZOfJ13fG.cjs → vue-ui-donut-evolution-BNz1stCl.cjs} +1 -1
  58. package/dist/{vue-ui-donut-evolution-BSk3uqC8.js → vue-ui-donut-evolution-CUISQ53T.js} +11 -11
  59. package/dist/{vue-ui-dumbbell-DwNJ0t9t.js → vue-ui-dumbbell-BANsx_dg.js} +10 -10
  60. package/dist/{vue-ui-dumbbell-Cc2vQuKa.cjs → vue-ui-dumbbell-BEbI6awt.cjs} +1 -1
  61. package/dist/{vue-ui-flow-CQisc_LK.js → vue-ui-flow-DkLbGRW4.js} +9 -9
  62. package/dist/{vue-ui-flow-BbKP10ov.cjs → vue-ui-flow-_0zTxd16.cjs} +1 -1
  63. package/dist/{vue-ui-funnel-DybxnhPr.cjs → vue-ui-funnel-BiHd3sXy.cjs} +1 -1
  64. package/dist/{vue-ui-funnel-DA82mX-l.js → vue-ui-funnel-D6i4ABc6.js} +9 -9
  65. package/dist/{vue-ui-galaxy-Co-39JiJ.js → vue-ui-galaxy-C5_aW-lx.js} +11 -11
  66. package/dist/{vue-ui-galaxy-C-hNndez.cjs → vue-ui-galaxy-LHVVEbkR.cjs} +1 -1
  67. package/dist/{vue-ui-gauge-TvTF5LS6.js → vue-ui-gauge-CQWnEC8a.js} +7 -7
  68. package/dist/{vue-ui-gauge-gWdl5oo1.cjs → vue-ui-gauge-CuG7d3WL.cjs} +1 -1
  69. package/dist/{vue-ui-gizmo-KnX0YMoX.js → vue-ui-gizmo-B8da3ua8.js} +3 -3
  70. package/dist/{vue-ui-gizmo-BQoNUgtQ.cjs → vue-ui-gizmo-DT4GUmYv.cjs} +1 -1
  71. package/dist/{vue-ui-heatmap-B5xnkUqI.cjs → vue-ui-heatmap-BRSvLW0z.cjs} +1 -1
  72. package/dist/{vue-ui-heatmap-BYhGn41t.js → vue-ui-heatmap-pcdqGLRS.js} +10 -10
  73. package/dist/{vue-ui-history-plot-8n3FPjHp.js → vue-ui-history-plot-B2DaZsY0.js} +11 -11
  74. package/dist/{vue-ui-history-plot-BFZOwwn-.cjs → vue-ui-history-plot-BVu0hQ59.cjs} +1 -1
  75. package/dist/{vue-ui-kpi-r9o6PDR7.js → vue-ui-kpi-D7j0srlP.js} +3 -3
  76. package/dist/{vue-ui-kpi-BRrkDdp5.cjs → vue-ui-kpi-DLVZ4U8H.cjs} +1 -1
  77. package/dist/{vue-ui-mini-loader-z5Tjy9_F.js → vue-ui-mini-loader-D7VHDTGz.js} +2 -2
  78. package/dist/{vue-ui-mini-loader-BXBmMZE5.cjs → vue-ui-mini-loader-RBVygXcT.cjs} +1 -1
  79. package/dist/{vue-ui-molecule-Hmix0fg_.js → vue-ui-molecule-C_uhs2U_.js} +11 -11
  80. package/dist/{vue-ui-molecule-BS-uVTx6.cjs → vue-ui-molecule-CbZJ0z9y.cjs} +1 -1
  81. package/dist/{vue-ui-mood-radar-D3bJvAUA.cjs → vue-ui-mood-radar-C-dVtA4T.cjs} +1 -1
  82. package/dist/{vue-ui-mood-radar-cQQYzxOe.js → vue-ui-mood-radar-CU0CfAfQ.js} +11 -11
  83. package/dist/{vue-ui-nested-donuts-BQ-orCsy.js → vue-ui-nested-donuts-D8LwVfr9.js} +11 -11
  84. package/dist/{vue-ui-nested-donuts-CJoByLIN.cjs → vue-ui-nested-donuts-Dn138dxB.cjs} +1 -1
  85. package/dist/{vue-ui-onion-2gpWMiK3.cjs → vue-ui-onion-4Kme64Fh.cjs} +1 -1
  86. package/dist/{vue-ui-onion-DMdgBAGm.js → vue-ui-onion-BfGt1Swk.js} +11 -11
  87. package/dist/{vue-ui-parallel-coordinate-plot-BkksCptE.cjs → vue-ui-parallel-coordinate-plot-CzmGTTtd.cjs} +1 -1
  88. package/dist/{vue-ui-parallel-coordinate-plot-CORjvdpu.js → vue-ui-parallel-coordinate-plot-I0JYDTzv.js} +12 -12
  89. package/dist/{vue-ui-quadrant-C7z-xan4.js → vue-ui-quadrant-BkM4J8Zo.js} +12 -12
  90. package/dist/{vue-ui-quadrant-DwLVQDkC.cjs → vue-ui-quadrant-DUJK0sJm.cjs} +1 -1
  91. package/dist/{vue-ui-quick-chart-DQ_0L2k8.cjs → vue-ui-quick-chart-BOOd6VGK.cjs} +1 -1
  92. package/dist/{vue-ui-quick-chart-BNBYa1qm.js → vue-ui-quick-chart-DOIEo_Ek.js} +9 -9
  93. package/dist/{vue-ui-radar-BJalnvQ0.js → vue-ui-radar-DCuyQ8TQ.js} +12 -12
  94. package/dist/{vue-ui-radar-DMug3I3r.cjs → vue-ui-radar-KqvUF0yd.cjs} +1 -1
  95. package/dist/{vue-ui-rating-CAtmkCip.cjs → vue-ui-rating-Cf9IXhte.cjs} +1 -1
  96. package/dist/{vue-ui-rating-YrpteNHP.js → vue-ui-rating-IQbpjp9W.js} +2 -2
  97. package/dist/{vue-ui-relation-circle-6WgpxOdi.cjs → vue-ui-relation-circle-Ch4R9uAU.cjs} +1 -1
  98. package/dist/{vue-ui-relation-circle-CaX6ryF7.js → vue-ui-relation-circle-D6oDkLxu.js} +7 -7
  99. package/dist/{vue-ui-rings-B94ER7yb.js → vue-ui-rings-DIIMJ6Ki.js} +12 -12
  100. package/dist/{vue-ui-rings-DwXSWAh9.cjs → vue-ui-rings-DUZubsW3.cjs} +1 -1
  101. package/dist/{vue-ui-scatter-R_o-56au.js → vue-ui-scatter-DlB5PjIz.js} +12 -12
  102. package/dist/{vue-ui-scatter-klHezU7g.cjs → vue-ui-scatter-eKhsBZM7.cjs} +1 -1
  103. package/dist/{vue-ui-screenshot-BJBVXs5F.cjs → vue-ui-screenshot-BvDI2Y8t.cjs} +1 -1
  104. package/dist/{vue-ui-screenshot-CawOtRGf.js → vue-ui-screenshot-cTGWG_q0.js} +1 -1
  105. package/dist/{vue-ui-skeleton-BM3ut-zl.js → vue-ui-skeleton-CZBWPZpy.js} +3 -3
  106. package/dist/{vue-ui-skeleton-DsMIGHB3.cjs → vue-ui-skeleton-ilN9FTO6.cjs} +1 -1
  107. package/dist/{vue-ui-smiley-bh_FuZmP.cjs → vue-ui-smiley-DfgDQnG8.cjs} +1 -1
  108. package/dist/{vue-ui-smiley-DX5k4pRq.js → vue-ui-smiley-DvDya3We.js} +2 -2
  109. package/dist/{vue-ui-spark-trend-BSLfkSAJ.js → vue-ui-spark-trend-8QHcYdgb.js} +5 -5
  110. package/dist/{vue-ui-spark-trend-N88_MES6.cjs → vue-ui-spark-trend-ChVtimzF.cjs} +1 -1
  111. package/dist/{vue-ui-sparkbar-NRuy_wAW.cjs → vue-ui-sparkbar-B6n8KYPy.cjs} +1 -1
  112. package/dist/{vue-ui-sparkbar-CgV-sv7t.js → vue-ui-sparkbar-_FtDdeUa.js} +4 -4
  113. package/dist/{vue-ui-sparkgauge-h9hOQBbL.cjs → vue-ui-sparkgauge-5XOcWXho.cjs} +1 -1
  114. package/dist/{vue-ui-sparkgauge-YOs41cOi.js → vue-ui-sparkgauge-B_j3XcZO.js} +4 -4
  115. package/dist/{vue-ui-sparkhistogram-BHVoP35U.js → vue-ui-sparkhistogram-C9p3d3J9.js} +5 -5
  116. package/dist/{vue-ui-sparkhistogram-BIoA2rZ8.cjs → vue-ui-sparkhistogram-DmwtHHUR.cjs} +1 -1
  117. package/dist/{vue-ui-sparkline-nIfo0etd.js → vue-ui-sparkline-C4Vopkk9.js} +4 -4
  118. package/dist/{vue-ui-sparkline-C3lqwFGV.cjs → vue-ui-sparkline-_vAuMTEe.cjs} +1 -1
  119. package/dist/{vue-ui-sparkstackbar-CBBZJlfz.cjs → vue-ui-sparkstackbar-3N5wyfEu.cjs} +1 -1
  120. package/dist/{vue-ui-sparkstackbar-CMH38Bht.js → vue-ui-sparkstackbar-CBRJEeRr.js} +5 -5
  121. package/dist/{vue-ui-stackbar-CBzYWzrX.js → vue-ui-stackbar-BzbafUmP.js} +13 -13
  122. package/dist/{vue-ui-stackbar-CwwOCVW2.cjs → vue-ui-stackbar-CrTAjJpl.cjs} +1 -1
  123. package/dist/{vue-ui-strip-plot-3UZVAou8.js → vue-ui-strip-plot-BnGNBKdY.js} +11 -11
  124. package/dist/{vue-ui-strip-plot-Dp2kJ7iQ.cjs → vue-ui-strip-plot-T0bYake6.cjs} +1 -1
  125. package/dist/{vue-ui-table-B3s1IcfE.cjs → vue-ui-table-Csf-GIDz.cjs} +1 -1
  126. package/dist/{vue-ui-table-CDmWHO-z.js → vue-ui-table-DBC5CyhX.js} +1 -1
  127. package/dist/{vue-ui-table-heatmap-BsZvR-Zs.cjs → vue-ui-table-heatmap-CvAJBKKA.cjs} +1 -1
  128. package/dist/{vue-ui-table-heatmap-CZD0-bMz.js → vue-ui-table-heatmap-zoNwnmLR.js} +4 -4
  129. package/dist/{vue-ui-table-sparkline-nCnQKAqx.js → vue-ui-table-sparkline-C6bJM-f0.js} +5 -5
  130. package/dist/{vue-ui-table-sparkline-BqGa1gwS.cjs → vue-ui-table-sparkline-zwvphD8h.cjs} +1 -1
  131. package/dist/{vue-ui-thermometer-Be7yQtd0.js → vue-ui-thermometer-BIYcENnb.js} +7 -7
  132. package/dist/{vue-ui-thermometer-dk2T8fWc.cjs → vue-ui-thermometer-DUxXfiGM.cjs} +1 -1
  133. package/dist/{vue-ui-timer-DMPyhmkw.cjs → vue-ui-timer-CcLN8TnA.cjs} +1 -1
  134. package/dist/{vue-ui-timer-B7jYXTxP.js → vue-ui-timer-MLu40_bj.js} +5 -5
  135. package/dist/{vue-ui-tiremarks-B2YzKOZ9.cjs → vue-ui-tiremarks-C9CecS3O.cjs} +1 -1
  136. package/dist/{vue-ui-tiremarks-BysMKDiL.js → vue-ui-tiremarks-MFmGeu6B.js} +7 -7
  137. package/dist/{vue-ui-treemap-BgPQTI0-.cjs → vue-ui-treemap-DyG27xaQ.cjs} +1 -1
  138. package/dist/{vue-ui-treemap-CVEo4sPM.js → vue-ui-treemap-ftHRUAk5.js} +11 -11
  139. package/dist/{vue-ui-vertical-bar-tR8BBtIQ.cjs → vue-ui-vertical-bar-DguUw97r.cjs} +1 -1
  140. package/dist/{vue-ui-vertical-bar-DqNS7Ash.js → vue-ui-vertical-bar-L0xygeZE.js} +12 -12
  141. package/dist/{vue-ui-waffle-CNIMp_6k.cjs → vue-ui-waffle-B-QYt7UZ.cjs} +1 -1
  142. package/dist/{vue-ui-waffle-pwRzgt1I.js → vue-ui-waffle-CIB4Siw3.js} +12 -12
  143. package/dist/{vue-ui-wheel-U-zWCCQP.js → vue-ui-wheel-CRPNNms-.js} +7 -7
  144. package/dist/{vue-ui-wheel-yVszAJvl.cjs → vue-ui-wheel-DywU63kY.cjs} +1 -1
  145. package/dist/{vue-ui-word-cloud-D2bvq4zl.cjs → vue-ui-word-cloud-Cuw5VBTB.cjs} +1 -1
  146. package/dist/{vue-ui-word-cloud-RI8RK0o-.js → vue-ui-word-cloud-CyrBFbga.js} +10 -10
  147. package/dist/{vue-ui-xy-Iprttv_w.cjs → vue-ui-xy-BU8znJsu.cjs} +1 -1
  148. package/dist/{vue-ui-xy-canvas-CauFtYWC.js → vue-ui-xy-canvas-CoVdHIGi.js} +11 -11
  149. package/dist/{vue-ui-xy-canvas-7QgtFfPE.cjs → vue-ui-xy-canvas-FQFE06yk.cjs} +1 -1
  150. package/dist/{vue-ui-xy-BqbnfSBo.js → vue-ui-xy-db3m5Vm0.js} +14 -14
  151. package/package.json +1 -1
  152. package/dist/index-CHCA909R.cjs +0 -9
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./index-CHCA909R.cjs"),T=require("./useNestedProp--1nKK7i0.cjs"),w=require("./BaseIcon-BKYwMJ4Y.cjs"),A=require("./vue-ui-skeleton-DsMIGHB3.cjs"),F=require("./PackageVersion-Cun_qdX7.cjs"),q=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),O=["id"],D=["xmlns","viewBox"],P=["width","height"],G=["id"],U=["stop-color"],W=["stop-color"],Z={key:1},H=["d","fill"],R=["d","fill"],X=["d","stroke","stroke-width","stroke-linecap","stroke-linejoin"],J=["d","stroke","stroke-width","stroke-linecap","stroke-linejoin"],K=["height","width","x"],Q={style:{width:"100%"}},Y=["x","y","fill","font-size","font-weight"],ee=["stroke","cx","cy","fill"],te=["x","y","font-size","fill","font-weight"],le={key:2,ref:"source",dir:"auto"},ae={__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:()=>x(),set:l=>l});function x(){const l=T.useNestedProp({userConfig:u.config,defaultConfig:$});return l.theme?{...T.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=x(),C()},{deep:!0}),e.watch(()=>u.dataset,l=>{h.value=a.largestTriangleThreeBucketsArray({data:u.dataset,threshold:t.value.downsample.threshold}).map(r=>[void 0,1/0,-1/0,null,NaN].includes(r)?null:r)},{deep:!0});function g(l){return l.map(r=>a.checkNaN(r))}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 r=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(),V=L-i;V>r?(i=L-V%r,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 n=e.ref({height:80,width:300}),d=e.computed(()=>({top:t.value.style.padding.top,left:t.value.style.padding.left,right:n.value.width-t.value.style.padding.right,bottom:n.value.height-t.value.style.padding.bottom,height:n.value.height-(t.value.style.padding.top+t.value.style.padding.bottom)-(t.value.style.dataLabel.show?t.value.style.dataLabel.fontSize:0),width:n.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(r=>a.checkNaN(r))),min:Math.min(...l.map(r=>a.checkNaN(r)))}}),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,r)=>{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(r*(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:n.value.height-6},r={x:o.value[o.value.length-1].x,y:n.value.height-6},i=[];return o.value.forEach(v=>{i.push(`${v.x},${v.y} `)}),[l.x,l.y,...i,r.x,r.y].toString()}),j=e.computed(()=>{let l=[];return o.value.forEach(r=>{l.push(`${r.x},${r.y} `)}),`M ${l.toString()}`});return(l,r)=>(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 ${n.value.width} ${n.value.height}`,style:"width:100%;background:transparent;overflow:visible"},[e.createVNode(F._sfc_main),l.$slots["chart-background"]?(e.openBlock(),e.createElementBlock("foreignObject",{key:0,x:0,y:0,width:n.value.width<=0?10:n.value.width,height:n.value.height<=0?10:n.value.height,style:{pointerEvents:"none"}},[e.renderSlot(l.$slots,"chart-background",{},void 0,!0)],8,P)):e.createCommentVNode("",!0),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,U),e.createElementVNode("stop",{offset:"100%","stop-color":t.value.style.backgroundColor},null,8,W)],8,G)]),t.value.style.area.show&&o.value[0]?(e.openBlock(),e.createElementBlock("g",Z,[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,H)):(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,R))])):e.createCommentVNode("",!0),t.value.style.line.smooth&&o.value.length?(e.openBlock(),e.createElementBlock("path",{key:2,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,X)):e.createCommentVNode("",!0),!t.value.style.line.smooth&&o.value.length?(e.openBlock(),e.createElementBlock("path",{key:3,d:j.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,J)):e.createCommentVNode("",!0),p.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("foreignObject",{key:4,height:n.value.height/2,width:n.value.height/2,x:n.value.height/5,y:8},[e.createElementVNode("div",Q,[k.value==="positive"?(e.openBlock(),e.createBlock(w.default,{key:0,stroke:s.value,name:"arrowTop",size:n.value.height/2},null,8,["stroke","size"])):e.createCommentVNode("",!0),k.value==="negative"?(e.openBlock(),e.createBlock(w.default,{key:1,stroke:s.value,name:"arrowBottom",size:n.value.height/2},null,8,["stroke","size"])):e.createCommentVNode("",!0),k.value==="neutral"?(e.openBlock(),e.createBlock(w.default,{key:2,stroke:s.value,name:"arrowRight",size:n.value.height/2},null,8,["stroke","size"])):e.createCommentVNode("",!0)])],8,K)),p.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("text",{key:5,x:n.value.height/2-n.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,Y)),o.value.length&&o.value.at(-1).x!==void 0?(e.openBlock(),e.createElementBlock("circle",{key:6,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,ee)):e.createCommentVNode("",!0),o.value.length&&o.value.at(-1).x!==void 0&&t.value.style.dataLabel.show?(e.openBlock(),e.createElementBlock("text",{key:7,"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,te)):e.createCommentVNode("",!0)],8,D)):(e.openBlock(),e.createBlock(A.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",le,[e.renderSlot(l.$slots,"source",{},void 0,!0)],512)):e.createCommentVNode("",!0)],12,O))}},oe=q._export_sfc(ae,[["__scopeId","data-v-38d02804"]]);exports.default=oe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./index-8TfPi9lB.cjs"),T=require("./useNestedProp-BKRkMJ0r.cjs"),w=require("./BaseIcon-BdnE2DAH.cjs"),A=require("./vue-ui-skeleton-ilN9FTO6.cjs"),F=require("./PackageVersion-CLMnI-8e.cjs"),q=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),O=["id"],D=["xmlns","viewBox"],P=["width","height"],G=["id"],U=["stop-color"],W=["stop-color"],Z={key:1},H=["d","fill"],R=["d","fill"],X=["d","stroke","stroke-width","stroke-linecap","stroke-linejoin"],J=["d","stroke","stroke-width","stroke-linecap","stroke-linejoin"],K=["height","width","x"],Q={style:{width:"100%"}},Y=["x","y","fill","font-size","font-weight"],ee=["stroke","cx","cy","fill"],te=["x","y","font-size","fill","font-weight"],le={key:2,ref:"source",dir:"auto"},ae={__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:()=>x(),set:l=>l});function x(){const l=T.useNestedProp({userConfig:u.config,defaultConfig:$});return l.theme?{...T.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=x(),C()},{deep:!0}),e.watch(()=>u.dataset,l=>{h.value=a.largestTriangleThreeBucketsArray({data:u.dataset,threshold:t.value.downsample.threshold}).map(r=>[void 0,1/0,-1/0,null,NaN].includes(r)?null:r)},{deep:!0});function g(l){return l.map(r=>a.checkNaN(r))}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 r=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(),V=L-i;V>r?(i=L-V%r,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 n=e.ref({height:80,width:300}),d=e.computed(()=>({top:t.value.style.padding.top,left:t.value.style.padding.left,right:n.value.width-t.value.style.padding.right,bottom:n.value.height-t.value.style.padding.bottom,height:n.value.height-(t.value.style.padding.top+t.value.style.padding.bottom)-(t.value.style.dataLabel.show?t.value.style.dataLabel.fontSize:0),width:n.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(r=>a.checkNaN(r))),min:Math.min(...l.map(r=>a.checkNaN(r)))}}),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,r)=>{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(r*(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:n.value.height-6},r={x:o.value[o.value.length-1].x,y:n.value.height-6},i=[];return o.value.forEach(v=>{i.push(`${v.x},${v.y} `)}),[l.x,l.y,...i,r.x,r.y].toString()}),j=e.computed(()=>{let l=[];return o.value.forEach(r=>{l.push(`${r.x},${r.y} `)}),`M ${l.toString()}`});return(l,r)=>(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 ${n.value.width} ${n.value.height}`,style:"width:100%;background:transparent;overflow:visible"},[e.createVNode(F._sfc_main),l.$slots["chart-background"]?(e.openBlock(),e.createElementBlock("foreignObject",{key:0,x:0,y:0,width:n.value.width<=0?10:n.value.width,height:n.value.height<=0?10:n.value.height,style:{pointerEvents:"none"}},[e.renderSlot(l.$slots,"chart-background",{},void 0,!0)],8,P)):e.createCommentVNode("",!0),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,U),e.createElementVNode("stop",{offset:"100%","stop-color":t.value.style.backgroundColor},null,8,W)],8,G)]),t.value.style.area.show&&o.value[0]?(e.openBlock(),e.createElementBlock("g",Z,[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,H)):(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,R))])):e.createCommentVNode("",!0),t.value.style.line.smooth&&o.value.length?(e.openBlock(),e.createElementBlock("path",{key:2,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,X)):e.createCommentVNode("",!0),!t.value.style.line.smooth&&o.value.length?(e.openBlock(),e.createElementBlock("path",{key:3,d:j.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,J)):e.createCommentVNode("",!0),p.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("foreignObject",{key:4,height:n.value.height/2,width:n.value.height/2,x:n.value.height/5,y:8},[e.createElementVNode("div",Q,[k.value==="positive"?(e.openBlock(),e.createBlock(w.default,{key:0,stroke:s.value,name:"arrowTop",size:n.value.height/2},null,8,["stroke","size"])):e.createCommentVNode("",!0),k.value==="negative"?(e.openBlock(),e.createBlock(w.default,{key:1,stroke:s.value,name:"arrowBottom",size:n.value.height/2},null,8,["stroke","size"])):e.createCommentVNode("",!0),k.value==="neutral"?(e.openBlock(),e.createBlock(w.default,{key:2,stroke:s.value,name:"arrowRight",size:n.value.height/2},null,8,["stroke","size"])):e.createCommentVNode("",!0)])],8,K)),p.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("text",{key:5,x:n.value.height/2-n.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,Y)),o.value.length&&o.value.at(-1).x!==void 0?(e.openBlock(),e.createElementBlock("circle",{key:6,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,ee)):e.createCommentVNode("",!0),o.value.length&&o.value.at(-1).x!==void 0&&t.value.style.dataLabel.show?(e.openBlock(),e.createElementBlock("text",{key:7,"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,te)):e.createCommentVNode("",!0)],8,D)):(e.openBlock(),e.createBlock(A.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",le,[e.renderSlot(l.$slots,"source",{},void 0,!0)],512)):e.createCommentVNode("",!0)],12,O))}},oe=q._export_sfc(ae,[["__scopeId","data-v-38d02804"]]);exports.default=oe;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),o=require("./index-CHCA909R.cjs"),b=require("./useNestedProp--1nKK7i0.cjs"),D=require("./vue-ui-skeleton-DsMIGHB3.cjs"),$=require("./PackageVersion-Cun_qdX7.cjs"),z=["onClick"],L={key:1},P=["xmlns","viewBox"],A=["id"],F=["stop-color"],O=["stop-color"],I=["height","width","fill","rx"],T=["height","width","fill","rx"],q=["height","width","fill","rx"],M={key:2,ref:"source",dir:"auto"},U={__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:C}){const n=p,{vue_ui_sparkbar:S}=o.useConfig(),w=e.useSlots();e.onMounted(()=>{w["chart-background"]&&console.warn("VueUiSparkbar does not support the #chart-background slot.")});const 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=b.useNestedProp({userConfig:n.config,defaultConfig:S});return l.theme?{...b.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 N=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}),_=e.computed(()=>Math.max(...n.dataset.map(l=>l.value))),B=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)||N.value[r]||o.palette[r]||o.palette[r%o.palette.length]}))));function V(l){return l/_.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:V(l.value)}function d(l){return t.value.style.layout.independant&&l.target||t.value.style.layout.target}function E(l,r){C("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(B.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",L,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($._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,F),e.createElementVNode("stop",{offset:"100%","stop-color":a.color},null,8,O)],8,A)]),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,I),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,T),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,q)],8,P))],12,z)):e.createCommentVNode("",!0)],64))),256)),l.$slots.source?(e.openBlock(),e.createElementBlock("div",M,[e.renderSlot(l.$slots,"source")],512)):e.createCommentVNode("",!0),v.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(D.default,{key:3,config:{type:"sparkbar",style:{backgroundColor:t.value.style.backgroundColor,sparkbar:{color:"#CCCCCC"}}}},null,8,["config"]))],4))}};exports.default=U;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),o=require("./index-8TfPi9lB.cjs"),b=require("./useNestedProp-BKRkMJ0r.cjs"),D=require("./vue-ui-skeleton-ilN9FTO6.cjs"),$=require("./PackageVersion-CLMnI-8e.cjs"),z=["onClick"],L={key:1},P=["xmlns","viewBox"],A=["id"],F=["stop-color"],O=["stop-color"],I=["height","width","fill","rx"],T=["height","width","fill","rx"],q=["height","width","fill","rx"],M={key:2,ref:"source",dir:"auto"},U={__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:C}){const n=p,{vue_ui_sparkbar:S}=o.useConfig(),w=e.useSlots();e.onMounted(()=>{w["chart-background"]&&console.warn("VueUiSparkbar does not support the #chart-background slot.")});const 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=b.useNestedProp({userConfig:n.config,defaultConfig:S});return l.theme?{...b.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 N=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}),_=e.computed(()=>Math.max(...n.dataset.map(l=>l.value))),B=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)||N.value[r]||o.palette[r]||o.palette[r%o.palette.length]}))));function V(l){return l/_.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:V(l.value)}function d(l){return t.value.style.layout.independant&&l.target||t.value.style.layout.target}function E(l,r){C("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(B.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",L,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($._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,F),e.createElementVNode("stop",{offset:"100%","stop-color":a.color},null,8,O)],8,A)]),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,I),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,T),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,q)],8,P))],12,z)):e.createCommentVNode("",!0)],64))),256)),l.$slots.source?(e.openBlock(),e.createElementBlock("div",M,[e.renderSlot(l.$slots,"source")],512)):e.createCommentVNode("",!0),v.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(D.default,{key:3,config:{type:"sparkbar",style:{backgroundColor:t.value.style.backgroundColor,sparkbar:{color:"#CCCCCC"}}}},null,8,["config"]))],4))}};exports.default=U;
@@ -1,8 +1,8 @@
1
1
  import { useSlots as X, onMounted as z, computed as g, ref as x, watch as L, nextTick as R, openBlock as n, createElementBlock as c, normalizeStyle as p, unref as s, renderSlot as C, normalizeProps as O, mergeProps as J, createCommentVNode as v, createElementVNode as d, toDisplayString as f, Fragment as T, renderList as K, guardReactiveProps as Q, createVNode as Y, createBlock as Z } from "vue";
2
- import { u as ee, c as te, t as le, a as ae, p as k, b as oe, o as se, e as V, g as ue, d as ne, s as $, i as b, f as w, X as re, w as ie } from "./index-DAAFXQJj.js";
3
- import { u as E } from "./useNestedProp-DMtJzMiX.js";
4
- import ce from "./vue-ui-skeleton-BM3ut-zl.js";
5
- import { _ as ve } from "./PackageVersion-DKr8jVlI.js";
2
+ import { u as ee, c as te, t as le, a as ae, p as k, b as oe, o as se, e as V, g as ue, d as ne, s as $, i as b, f as w, X as re, w as ie } from "./index-OhfEeW2N.js";
3
+ import { u as E } from "./useNestedProp-Cwjz-hIm.js";
4
+ import ce from "./vue-ui-skeleton-CZBWPZpy.js";
5
+ import { _ as ve } from "./PackageVersion-DBbbI7TU.js";
6
6
  const de = ["onClick"], pe = { key: 1 }, fe = ["xmlns", "viewBox"], ye = ["id"], me = ["stop-color"], ge = ["stop-color"], he = ["height", "width", "fill", "rx"], xe = ["height", "width", "fill", "rx"], ke = ["height", "width", "fill", "rx"], be = {
7
7
  key: 2,
8
8
  ref: "source",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),n=require("./index-CHCA909R.cjs"),b=require("./useNestedProp--1nKK7i0.cjs"),w=require("./vue-ui-skeleton-DsMIGHB3.cjs"),x=require("./PackageVersion-Cun_qdX7.cjs"),S=["xmlns","viewBox"],B=["width","height"],E=["id"],L=["stop-color"],M=["stop-color"],V=["d","stroke","stroke-linecap"],z=["d","stroke","stroke-linecap","stroke-dashoffset"],A=["x","y","font-size","fill","font-weight"],O={key:4,ref:"source",dir:"auto"},j={__name:"vue-ui-sparkgauge",props:{config:{type:Object,default(){return{}}},dataset:{type:Object,default(){return{}}}},setup(C){const o=C,{vue_ui_sparkgauge:_}=n.useConfig(),c=e.computed(()=>!!o.dataset&&Object.keys(o.dataset).length);e.onMounted(()=>{d()});function d(){n.objectIsEmpty(o.dataset)?n.error({componentName:"VueUiSparkgauge",type:"dataset"}):n.getMissingDatasetAttributes({datasetObject:o.dataset,requiredAttributes:["value","min","max"]}).forEach(a=>{n.error({componentName:"VueUiSparkgauge",type:"datasetAttribute",property:a})})}const v=e.ref(n.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:n.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})),s=e.computed(()=>{const a=o.dataset.min??0,r=o.dataset.max??0,$=r-a;return{min:a,max:r,diff:$}}),l=e.ref(t.value.style.animation.show?s.value.min:o.dataset.value);e.watch(()=>o.dataset.value,()=>{y(o.dataset.value||0)});const f=e.computed(()=>l.value>s.value.max?s.value.max:l.value<s.value.min?s.value.min:l.value),p=e.computed(()=>s.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-s.value.min)/s.value.diff:(Math.abs(s.value.min)-Math.abs(f.value))/s.value.diff),h=e.computed(()=>n.interpolateColorHex(t.value.style.colors.min,t.value.style.colors.max,s.value.min,s.value.max,l.value)),k=e.computed(()=>t.value.style.dataLabel.autoColor?h.value:t.value.style.dataLabel.color),N=e.computed(()=>t.value.style.track.autoColor?h.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(n.XMLNS),viewBox:`0 0 ${u.value.width} ${u.value.height}`,style:"overflow: visible; background:transparent; width:100%;"},[e.createVNode(x._sfc_main),a.$slots["chart-background"]?(e.openBlock(),e.createElementBlock("foreignObject",{key:0,x:0,y:0,width:u.value.width,height:u.value.height,style:{pointerEvents:"none"}},[e.renderSlot(a.$slots,"chart-background")],8,B)):e.createCommentVNode("",!0),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,L),e.createElementVNode("stop",{offset:"100%","stop-color":t.value.style.colors.max},null,8,M)],8,E)]),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,V),g.value!==0?(e.openBlock(),e.createElementBlock("path",{key:1,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})`:N.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:k.value,"font-weight":t.value.style.dataLabel.bold?"bold":"normal"},e.toDisplayString(e.unref(n.applyDataLabel)(t.value.style.dataLabel.formatter,e.unref(n.checkNaN)(l.value),e.unref(n.dataLabel)({p:t.value.style.dataLabel.prefix,v:e.unref(n.checkNaN)(l.value),s:t.value.style.dataLabel.suffix,r:t.value.style.dataLabel.rounding}),{datapoint:e.unref(n.checkNaN)(l.value),color:k.value})),9,A)],8,S)):e.createCommentVNode("",!0),c.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(w.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",O,[e.renderSlot(a.$slots,"source")],512)):e.createCommentVNode("",!0)],4))}};exports.default=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),n=require("./index-8TfPi9lB.cjs"),b=require("./useNestedProp-BKRkMJ0r.cjs"),w=require("./vue-ui-skeleton-ilN9FTO6.cjs"),x=require("./PackageVersion-CLMnI-8e.cjs"),S=["xmlns","viewBox"],B=["width","height"],E=["id"],L=["stop-color"],M=["stop-color"],V=["d","stroke","stroke-linecap"],z=["d","stroke","stroke-linecap","stroke-dashoffset"],A=["x","y","font-size","fill","font-weight"],O={key:4,ref:"source",dir:"auto"},j={__name:"vue-ui-sparkgauge",props:{config:{type:Object,default(){return{}}},dataset:{type:Object,default(){return{}}}},setup(C){const o=C,{vue_ui_sparkgauge:_}=n.useConfig(),c=e.computed(()=>!!o.dataset&&Object.keys(o.dataset).length);e.onMounted(()=>{d()});function d(){n.objectIsEmpty(o.dataset)?n.error({componentName:"VueUiSparkgauge",type:"dataset"}):n.getMissingDatasetAttributes({datasetObject:o.dataset,requiredAttributes:["value","min","max"]}).forEach(a=>{n.error({componentName:"VueUiSparkgauge",type:"datasetAttribute",property:a})})}const v=e.ref(n.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:n.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})),s=e.computed(()=>{const a=o.dataset.min??0,r=o.dataset.max??0,$=r-a;return{min:a,max:r,diff:$}}),l=e.ref(t.value.style.animation.show?s.value.min:o.dataset.value);e.watch(()=>o.dataset.value,()=>{y(o.dataset.value||0)});const f=e.computed(()=>l.value>s.value.max?s.value.max:l.value<s.value.min?s.value.min:l.value),p=e.computed(()=>s.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-s.value.min)/s.value.diff:(Math.abs(s.value.min)-Math.abs(f.value))/s.value.diff),h=e.computed(()=>n.interpolateColorHex(t.value.style.colors.min,t.value.style.colors.max,s.value.min,s.value.max,l.value)),k=e.computed(()=>t.value.style.dataLabel.autoColor?h.value:t.value.style.dataLabel.color),N=e.computed(()=>t.value.style.track.autoColor?h.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(n.XMLNS),viewBox:`0 0 ${u.value.width} ${u.value.height}`,style:"overflow: visible; background:transparent; width:100%;"},[e.createVNode(x._sfc_main),a.$slots["chart-background"]?(e.openBlock(),e.createElementBlock("foreignObject",{key:0,x:0,y:0,width:u.value.width,height:u.value.height,style:{pointerEvents:"none"}},[e.renderSlot(a.$slots,"chart-background")],8,B)):e.createCommentVNode("",!0),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,L),e.createElementVNode("stop",{offset:"100%","stop-color":t.value.style.colors.max},null,8,M)],8,E)]),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,V),g.value!==0?(e.openBlock(),e.createElementBlock("path",{key:1,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})`:N.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:k.value,"font-weight":t.value.style.dataLabel.bold?"bold":"normal"},e.toDisplayString(e.unref(n.applyDataLabel)(t.value.style.dataLabel.formatter,e.unref(n.checkNaN)(l.value),e.unref(n.dataLabel)({p:t.value.style.dataLabel.prefix,v:e.unref(n.checkNaN)(l.value),s:t.value.style.dataLabel.suffix,r:t.value.style.dataLabel.rounding}),{datapoint:e.unref(n.checkNaN)(l.value),color:k.value})),9,A)],8,S)):e.createCommentVNode("",!0),c.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(w.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",O,[e.renderSlot(a.$slots,"source")],512)):e.createCommentVNode("",!0)],4))}};exports.default=j;
@@ -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 r, unref as c, createVNode as D, renderSlot as S, createElementVNode as d, normalizeClass as G, createBlock as I } from "vue";
2
- import { u as U, o as q, e as z, g as P, c as R, t as T, O as X, X as H, i as V, v as g, f as Y } from "./index-DAAFXQJj.js";
3
- import { u as O } from "./useNestedProp-DMtJzMiX.js";
4
- import J from "./vue-ui-skeleton-BM3ut-zl.js";
5
- import { _ as K } from "./PackageVersion-DKr8jVlI.js";
2
+ import { u as U, o as q, e as z, g as P, c as R, t as T, O as X, X as H, i as V, v as g, f as Y } from "./index-OhfEeW2N.js";
3
+ import { u as O } from "./useNestedProp-Cwjz-hIm.js";
4
+ import J from "./vue-ui-skeleton-CZBWPZpy.js";
5
+ import { _ as K } from "./PackageVersion-DBbbI7TU.js";
6
6
  const Q = ["xmlns", "viewBox"], W = ["width", "height"], Z = ["id"], ee = ["stop-color"], te = ["stop-color"], ae = ["d", "stroke", "stroke-linecap"], le = ["d", "stroke", "stroke-linecap", "stroke-dashoffset"], oe = ["x", "y", "font-size", "fill", "font-weight"], se = {
7
7
  key: 4,
8
8
  ref: "source",
@@ -1,9 +1,9 @@
1
1
  import { useCssVars as K, computed as _, onMounted as Q, ref as N, watch as Z, openBlock as a, createElementBlock as s, normalizeStyle as $, createElementVNode as h, createTextVNode as ee, toDisplayString as p, unref as n, createCommentVNode as c, createVNode as te, renderSlot as D, Fragment as f, renderList as g, normalizeClass as I, createBlock as V } from "vue";
2
- import { u as le, o as ae, e as E, g as se, c as oe, t as ue, s as b, i as H, f as F, X as re, w as z } from "./index-DAAFXQJj.js";
3
- import { u as O } from "./useNestedProp-DMtJzMiX.js";
4
- import { _ as ie } from "./Shape-C4LyHNQ3.js";
5
- import ne from "./vue-ui-skeleton-BM3ut-zl.js";
6
- import { _ as ve } from "./PackageVersion-DKr8jVlI.js";
2
+ import { u as le, o as ae, e as E, g as se, c as oe, t as ue, s as b, i as H, f as F, X as re, w as z } from "./index-OhfEeW2N.js";
3
+ import { u as O } from "./useNestedProp-Cwjz-hIm.js";
4
+ import { _ as ie } from "./Shape-BDcnW_8x.js";
5
+ import ne from "./vue-ui-skeleton-CZBWPZpy.js";
6
+ import { _ as ve } from "./PackageVersion-DBbbI7TU.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 = ["width", "height"], ge = ["id"], pe = ["stop-color"], be = ["stop-color"], me = ["id"], _e = ["stop-color"], xe = ["stop-color"], ke = ["id"], we = ["stop-color"], $e = ["stop-color"], Ce = { key: 1 }, Le = ["x", "y", "height", "width", "fill", "stroke", "stroke-width", "rx"], ze = { key: 2 }, Se = ["x", "y", "font-size", "font-weight", "fill"], Me = ["x", "y", "font-size", "fill"], Ae = ["x", "y", "font-size", "fill"], Ne = ["height", "width", "x", "onMouseover", "stroke", "stroke-width", "rx", "stroke-dasharray", "onClick"], De = {
9
9
  key: 2,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./index-CHCA909R.cjs"),_=require("./useNestedProp--1nKK7i0.cjs"),F=require("./Shape-B6dlN2je.cjs"),M=require("./vue-ui-skeleton-DsMIGHB3.cjs"),O=require("./PackageVersion-Cun_qdX7.cjs"),A=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),H={key:0},q={key:1},I=["xmlns","viewBox"],U=["width","height"],W=["id"],j=["stop-color"],P=["stop-color"],G=["id"],T=["stop-color"],X=["stop-color"],Y=["id"],R=["stop-color"],J=["stop-color"],K={key:1},Q=["x","y","height","width","fill","stroke","stroke-width","rx"],Z={key:2},ee=["x","y","font-size","font-weight","fill"],te=["x","y","font-size","fill"],le=["x","y","font-size","fill"],oe=["height","width","x","onMouseover","stroke","stroke-width","rx","stroke-dasharray","onClick"],ae={key:2,ref:"source",dir:"auto"},ne={__name:"vue-ui-sparkhistogram",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:["selectDatapoint"],setup(B,{emit:x}){const c=B;e.useCssVars(o=>({"9e84af8a":S.value}));const{vue_ui_sparkhistogram:E}=a.useConfig(),f=e.computed(()=>!!c.dataset&&c.dataset.length);e.onMounted(()=>{k()});function k(){a.objectIsEmpty(c.dataset)?a.error({componentName:"VueUiSparkHistogram",type:"dataset"}):c.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:c.config,defaultConfig:E});return o.theme?{..._.useNestedProp({userConfig:a.themes.vue_ui_sparkhistogram[o.theme]||c.config,defaultConfig:o})}:o}e.watch(()=>c.config,o=>{t.value=b(),k()},{deep:!0});const u=e.computed(()=>{const o=t.value.style.layout.height,r=t.value.style.layout.width,l=t.value.style.layout.padding.top,n=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,h=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:n,centerY:p,drawingHeight:h,drawingWidth:m,height:o,left:d,right:y,top:l,width:r}}),w=e.computed(()=>Math.max(...c.dataset.map(o=>Math.abs(o.value||0))));function C(o){return Math.abs(o)/w.value}const i=e.computed(()=>c.dataset.map((o,r)=>{const l=C(o.value||0),n=u.value.drawingHeight*l,d=u.value.drawingWidth/c.dataset.length,y=d*(t.value.style.bars.gap/100),p=d-y,h=u.value.centerY-n/2,m=u.value.left+(y/2+r*d),N=u.value.left+r*d,g=typeof o.intensity>"u"?100:Math.round(o.intensity*100),L=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:L,gradient:z,height:n,intensity:g,proportion:l,stroke:V,textAnchor:D,trapX:N,unitWidth:d,width:p,x:m,y:h}})),s=e.ref(null);function $(o,r){x("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=>s.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),s.value!==null?(e.openBlock(),e.createElementBlock("span",H,"- "+e.toDisplayString(i.value[s.value].timeLabel||"")+" "+e.toDisplayString(e.unref(a.applyDataLabel)(t.value.style.labels.value.formatter,i.value[s.value].value,e.unref(a.dataLabel)({p:t.value.style.labels.value.prefix,v:i.value[s.value].value,s:t.value.style.labels.value.suffix,r:t.value.style.labels.value.rounding}),{datapoint:i.value[s.value],seriesIndex:s.value})),1)):e.createCommentVNode("",!0),![void 0,null].includes(s.value)&&![null,void 0].includes(i.value[s.value].valueLabel)?(e.openBlock(),e.createElementBlock("span",q,"("+e.toDisplayString(i.value[s.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),f.value?(e.openBlock(),e.createElementBlock("svg",{key:1,xmlns:e.unref(a.XMLNS),viewBox:`0 0 ${u.value.width} ${u.value.height}`,style:{overflow:"visible"}},[e.createVNode(O._sfc_main),o.$slots["chart-background"]?(e.openBlock(),e.createElementBlock("foreignObject",{key:0,x:0,y:0,width:u.value.width,height:u.value.height,style:{pointerEvents:"none"}},[e.renderSlot(o.$slots,"chart-background",{},void 0,!0)],8,U)):e.createCommentVNode("",!0),e.createElementVNode("defs",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(l,n)=>(e.openBlock(),e.createElementBlock("radialGradient",{id:`gradient_positive_${n}_${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,j),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(a.setOpacity)(t.value.style.bars.colors.positive,l.intensity)},null,8,P)],8,W))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(l,n)=>(e.openBlock(),e.createElementBlock("radialGradient",{id:`gradient_negative_${n}_${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,T),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(a.setOpacity)(t.value.style.bars.colors.negative,l.intensity)},null,8,X)],8,G))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(l,n)=>(e.openBlock(),e.createElementBlock("radialGradient",{id:`gradient_datapoint_${n}_${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,R),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(a.setOpacity)(l.color,l.intensity)},null,8,J)],8,Y))),256))]),!t.value.style.bars.shape||t.value.style.bars.shape==="square"?(e.openBlock(),e.createElementBlock("g",K,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(l,n)=>(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,Q))),256))])):(e.openBlock(),e.createElementBlock("g",Z,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(l,n)=>(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(i.value,(l,n)=>(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:i.value[s.value],seriesIndex:s.value})),9,ee))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(l,n)=>(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,te)):e.createCommentVNode("",!0)]))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(l,n)=>(e.openBlock(),e.createElementBlock("g",null,[l.timeLabel?(e.openBlock(),e.createElementBlock("text",{key:0,x:l.textAnchor,y:u.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,le)):e.createCommentVNode("",!0)]))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(l,n)=>(e.openBlock(),e.createElementBlock("g",null,[e.createElementVNode("rect",{height:u.value.height,width:l.unitWidth,fill:"transparent",x:l.trapX,y:0,onMouseover:d=>s.value=n,onMouseleave:r[0]||(r[0]=d=>s.value=null),stroke:s.value!==null&&s.value===n?t.value.style.selector.stroke:"","stroke-width":s.value!==null&&s.value===n?t.value.style.selector.strokeWidth:0,rx:t.value.style.selector.borderRadius,"stroke-dasharray":t.value.style.selector.strokeDasharray,onClick:()=>$(l,n)},null,40,oe)]))),256))],8,I)):e.createCommentVNode("",!0),o.$slots.source?(e.openBlock(),e.createElementBlock("div",ae,[e.renderSlot(o.$slots,"source",{},void 0,!0)],512)):e.createCommentVNode("",!0),f.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(ne,[["__scopeId","data-v-ad438c17"]]);exports.default=se;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./index-8TfPi9lB.cjs"),_=require("./useNestedProp-BKRkMJ0r.cjs"),F=require("./Shape-lPTNUyoX.cjs"),M=require("./vue-ui-skeleton-ilN9FTO6.cjs"),O=require("./PackageVersion-CLMnI-8e.cjs"),A=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),H={key:0},q={key:1},I=["xmlns","viewBox"],U=["width","height"],W=["id"],j=["stop-color"],P=["stop-color"],G=["id"],T=["stop-color"],X=["stop-color"],Y=["id"],R=["stop-color"],J=["stop-color"],K={key:1},Q=["x","y","height","width","fill","stroke","stroke-width","rx"],Z={key:2},ee=["x","y","font-size","font-weight","fill"],te=["x","y","font-size","fill"],le=["x","y","font-size","fill"],oe=["height","width","x","onMouseover","stroke","stroke-width","rx","stroke-dasharray","onClick"],ae={key:2,ref:"source",dir:"auto"},ne={__name:"vue-ui-sparkhistogram",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:["selectDatapoint"],setup(B,{emit:x}){const c=B;e.useCssVars(o=>({"9e84af8a":S.value}));const{vue_ui_sparkhistogram:E}=a.useConfig(),f=e.computed(()=>!!c.dataset&&c.dataset.length);e.onMounted(()=>{k()});function k(){a.objectIsEmpty(c.dataset)?a.error({componentName:"VueUiSparkHistogram",type:"dataset"}):c.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:c.config,defaultConfig:E});return o.theme?{..._.useNestedProp({userConfig:a.themes.vue_ui_sparkhistogram[o.theme]||c.config,defaultConfig:o})}:o}e.watch(()=>c.config,o=>{t.value=b(),k()},{deep:!0});const u=e.computed(()=>{const o=t.value.style.layout.height,r=t.value.style.layout.width,l=t.value.style.layout.padding.top,n=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,h=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:n,centerY:p,drawingHeight:h,drawingWidth:m,height:o,left:d,right:y,top:l,width:r}}),w=e.computed(()=>Math.max(...c.dataset.map(o=>Math.abs(o.value||0))));function C(o){return Math.abs(o)/w.value}const i=e.computed(()=>c.dataset.map((o,r)=>{const l=C(o.value||0),n=u.value.drawingHeight*l,d=u.value.drawingWidth/c.dataset.length,y=d*(t.value.style.bars.gap/100),p=d-y,h=u.value.centerY-n/2,m=u.value.left+(y/2+r*d),N=u.value.left+r*d,g=typeof o.intensity>"u"?100:Math.round(o.intensity*100),L=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:L,gradient:z,height:n,intensity:g,proportion:l,stroke:V,textAnchor:D,trapX:N,unitWidth:d,width:p,x:m,y:h}})),s=e.ref(null);function $(o,r){x("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=>s.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),s.value!==null?(e.openBlock(),e.createElementBlock("span",H,"- "+e.toDisplayString(i.value[s.value].timeLabel||"")+" "+e.toDisplayString(e.unref(a.applyDataLabel)(t.value.style.labels.value.formatter,i.value[s.value].value,e.unref(a.dataLabel)({p:t.value.style.labels.value.prefix,v:i.value[s.value].value,s:t.value.style.labels.value.suffix,r:t.value.style.labels.value.rounding}),{datapoint:i.value[s.value],seriesIndex:s.value})),1)):e.createCommentVNode("",!0),![void 0,null].includes(s.value)&&![null,void 0].includes(i.value[s.value].valueLabel)?(e.openBlock(),e.createElementBlock("span",q,"("+e.toDisplayString(i.value[s.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),f.value?(e.openBlock(),e.createElementBlock("svg",{key:1,xmlns:e.unref(a.XMLNS),viewBox:`0 0 ${u.value.width} ${u.value.height}`,style:{overflow:"visible"}},[e.createVNode(O._sfc_main),o.$slots["chart-background"]?(e.openBlock(),e.createElementBlock("foreignObject",{key:0,x:0,y:0,width:u.value.width,height:u.value.height,style:{pointerEvents:"none"}},[e.renderSlot(o.$slots,"chart-background",{},void 0,!0)],8,U)):e.createCommentVNode("",!0),e.createElementVNode("defs",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(l,n)=>(e.openBlock(),e.createElementBlock("radialGradient",{id:`gradient_positive_${n}_${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,j),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(a.setOpacity)(t.value.style.bars.colors.positive,l.intensity)},null,8,P)],8,W))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(l,n)=>(e.openBlock(),e.createElementBlock("radialGradient",{id:`gradient_negative_${n}_${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,T),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(a.setOpacity)(t.value.style.bars.colors.negative,l.intensity)},null,8,X)],8,G))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(l,n)=>(e.openBlock(),e.createElementBlock("radialGradient",{id:`gradient_datapoint_${n}_${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,R),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(a.setOpacity)(l.color,l.intensity)},null,8,J)],8,Y))),256))]),!t.value.style.bars.shape||t.value.style.bars.shape==="square"?(e.openBlock(),e.createElementBlock("g",K,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(l,n)=>(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,Q))),256))])):(e.openBlock(),e.createElementBlock("g",Z,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(l,n)=>(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(i.value,(l,n)=>(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:i.value[s.value],seriesIndex:s.value})),9,ee))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(l,n)=>(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,te)):e.createCommentVNode("",!0)]))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(l,n)=>(e.openBlock(),e.createElementBlock("g",null,[l.timeLabel?(e.openBlock(),e.createElementBlock("text",{key:0,x:l.textAnchor,y:u.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,le)):e.createCommentVNode("",!0)]))),256)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(l,n)=>(e.openBlock(),e.createElementBlock("g",null,[e.createElementVNode("rect",{height:u.value.height,width:l.unitWidth,fill:"transparent",x:l.trapX,y:0,onMouseover:d=>s.value=n,onMouseleave:r[0]||(r[0]=d=>s.value=null),stroke:s.value!==null&&s.value===n?t.value.style.selector.stroke:"","stroke-width":s.value!==null&&s.value===n?t.value.style.selector.strokeWidth:0,rx:t.value.style.selector.borderRadius,"stroke-dasharray":t.value.style.selector.strokeDasharray,onClick:()=>$(l,n)},null,40,oe)]))),256))],8,I)):e.createCommentVNode("",!0),o.$slots.source?(e.openBlock(),e.createElementBlock("div",ae,[e.renderSlot(o.$slots,"source",{},void 0,!0)],512)):e.createCommentVNode("",!0),f.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(ne,[["__scopeId","data-v-ad438c17"]]);exports.default=se;
@@ -1,9 +1,9 @@
1
1
  import { computed as c, ref as b, watch as U, onMounted as re, openBlock as r, createElementBlock as i, normalizeStyle as C, renderSlot as M, normalizeProps as ie, guardReactiveProps as de, createElementVNode as f, toDisplayString as X, createCommentVNode as h, unref as v, createVNode as ve, Fragment as D, renderList as P, createBlock as ce } from "vue";
2
- import { u as he, c as ye, t as fe, C as q, a0 as T, o as pe, e as Z, g as ge, w as I, a1 as me, a2 as be, X as ke, s as V, S as H, a3 as Y, i as J, f as K } from "./index-DAAFXQJj.js";
3
- import { u as Q } from "./useNestedProp-DMtJzMiX.js";
4
- import _e from "./vue-ui-skeleton-BM3ut-zl.js";
2
+ import { u as he, c as ye, t as fe, C as q, a0 as T, o as pe, e as Z, g as ge, w as I, a1 as me, a2 as be, X as ke, s as V, S as H, a3 as Y, i as J, f as K } from "./index-OhfEeW2N.js";
3
+ import { u as Q } from "./useNestedProp-Cwjz-hIm.js";
4
+ import _e from "./vue-ui-skeleton-CZBWPZpy.js";
5
5
  import { t as xe, u as we } from "./useResponsive-CoxXLe23.js";
6
- import { _ as $e } from "./PackageVersion-DKr8jVlI.js";
6
+ import { _ as $e } from "./PackageVersion-DBbbI7TU.js";
7
7
  import { _ as Le } from "./_plugin-vue_export-helper-CHgC5LLL.js";
8
8
  const Ne = ["id"], Ce = ["xmlns", "viewBox"], Me = ["width", "height"], Ie = ["id"], Ve = ["stop-color"], Se = ["stop-color"], ze = ["id"], Ae = ["stop-color"], We = ["stop-color"], De = ["id"], Pe = ["stop-color"], Te = ["stop-color"], Fe = { key: 1 }, Oe = ["d", "fill"], Be = ["d", "fill"], Ee = ["d", "stroke", "stroke-width"], Ge = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], je = ["x", "y", "width", "height", "fill", "rx"], Re = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], Ue = ["x1", "x2", "y1", "y2", "stroke", "stroke-dasharray", "stroke-width"], Xe = ["cx", "cy", "r", "fill", "stroke", "stroke-width"], qe = ["x", "y", "font-size", "font-weight", "fill"], Ze = ["x", "y", "height", "width", "onMouseenter", "onClick"], He = {
9
9
  __name: "vue-ui-sparkline",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),r=require("./index-CHCA909R.cjs"),S=require("./useNestedProp--1nKK7i0.cjs"),q=require("./vue-ui-skeleton-DsMIGHB3.cjs"),P=require("./useResponsive-BJ7DTGpm.cjs"),G=require("./PackageVersion-Cun_qdX7.cjs"),R=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),H=["id"],U=["xmlns","viewBox"],X=["width","height"],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:1},ne=["d","fill"],re=["d","fill"],ue=["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"],fe={__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},heightRatio:{type:Number,default:1},forcedPadding:{type:Number,default:30}},emits:["hoverIndex","selectDatapoint"],setup(p,{emit:x}){const u=p,{vue_ui_sparkline:z}=r.useConfig(),k=e.computed(()=>!!u.dataset&&u.dataset.length),v=e.ref(r.createUid()),w=e.ref(null),V=e.ref(null),C=e.ref(null),t=e.computed({get:()=>L(),set:l=>l});function L(){const l=S.useNestedProp({userConfig:u.config,defaultConfig:z});let o={};return l.theme?o={...S.useNestedProp({userConfig:r.themes.vue_ui_sparkline[l.theme]||u.config,defaultConfig:l})}:o=l,u.config&&r.hasDeepProperty(u.config,"style.scaleMin")?o.style.scaleMin=u.config.style.scaleMin:o.style.scaleMin=null,u.config&&r.hasDeepProperty(u.config,"style.scaleMax")?o.style.scaleMax=u.config.style.scaleMax:o.style.scaleMax=null,o}const b=e.computed(()=>r.largestTriangleThreeBucketsArrayObjects({data:u.dataset,threshold:t.value.downsample.threshold}));e.watch(()=>u.config,l=>{t.value=L(),$(),n.value.chartWidth=t.value.style.chartWidth},{deep:!0}),e.watch(()=>u.dataset,l=>{f.value=r.largestTriangleThreeBucketsArrayObjects({data:u.dataset.map(o=>({...o,value:[void 0].includes(o.value)?null:o.value})),threshold:t.value.downsample.threshold})},{deep:!0});const f=e.ref(A());function A(){return r.largestTriangleThreeBucketsArrayObjects({data:u.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&&u.dataset.length>1){let a=function(){o<b.value.length?(f.value.push(b.value[o]),setTimeout(()=>{requestAnimationFrame(a)},l)):f.value=b.value,o+=1};f.value=[];const l=t.value.style.animation.animationFrames/u.dataset.length;let o=0;a()}});function $(){if(r.objectIsEmpty(u.dataset)?r.error({componentName:"VueUiSparkline",type:"dataset"}):u.dataset.forEach((l,o)=>{r.getMissingDatasetAttributes({datasetObject:l,requiredAttributes:["period","value"]}).forEach(a=>{r.error({componentName:"VueUiSparkline",type:"datasetSerieAttribute",property:a,index:o})})}),t.value.responsive){const l=P.throttle(()=>{const{width:o,height:a}=P.useResponsive({chart:w.value,title:t.value.style.title.show&&u.showInfo?V.value:null,source:C.value});requestAnimationFrame(()=>{n.value.width=o,n.value.height=a,n.value.chartWidth=t.value.style.chartWidth/500*o,n.value.padding=u.forcedPadding/500*o})});E.value=new ResizeObserver(l),E.value.observe(w.value.parentNode)}}const n=e.ref({height:80*u.heightRatio,width:500,chartWidth:t.value.style.chartWidth,padding:u.forcedPadding}),s=e.computed(()=>{const{top:l,right:o,bottom:a,left:i}=t.value.style.padding;return{top:l,left:i,right:n.value.width-o,bottom:n.value.height-a,start:u.showInfo&&t.value.style.dataLabel.show&&t.value.style.dataLabel.position==="left"?n.value.width-n.value.chartWidth+i:n.value.padding+i,width:u.showInfo&&t.value.style.dataLabel.show?n.value.chartWidth-i-o:n.value.width-n.value.padding-i-o,height:n.value.height-l-a}}),N=e.computed(()=>[null,void 0].includes(t.value.style.scaleMin)?Math.min(...f.value.map(l=>isNaN(l.value)||[void 0,null,"NaN",NaN,1/0,-1/0].includes(l.value)?0:l.value||0)):t.value.style.scaleMin),D=e.computed(()=>[null,void 0].includes(t.value.style.scaleMax)?Math.max(...f.value.map(l=>isNaN(l.value)||[void 0,null,"NaN",NaN,1/0,-1/0].includes(l.value)?0:l.value||0)):t.value.style.scaleMax),m=e.computed(()=>{const l=N.value>=0?0:N.value;return Math.abs(l)}),O=e.computed(()=>D.value+m.value),_=e.computed(()=>s.value.bottom-s.value.height*B(m.value));function B(l){return l/O.value}const h=e.computed(()=>b.value.length-1),d=e.computed(()=>f.value.map((l,o)=>{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:s.value.start+o*(s.value.width/(h.value+1)>n.padding?n.padding:s.value.width/(h.value+1)),y:s.value.bottom-s.value.height*B(a+m.value),id:`plot_${v.value}_${o}`,color:g.value?t.value.style.bar.color:t.value.style.area.useGradient?r.shiftHue(t.value.style.line.color,.05*(1-o/h.value)):t.value.style.line.color,width:s.value.width/(h.value+1)>n.padding?n.padding:s.value.width/(h.value+1)}})),T=e.computed(()=>{const l={x:d.value[0].x||0,y:(n.value.height||0)-6},o={x:d.value[d.value.length-1].x||0,y:(n.value.height||0)-6},a=[];return d.value.forEach(i=>{a.push(`${i.x||0},${i.y||0} `)}),[l.x,l.y,...a,o.x,o.y].toString()}),c=e.ref(void 0);function W(l,o){c.value=l,x("hoverIndex",{index:o})}function F(){c.value=void 0,x("hoverIndex",{index:void 0})}const y=e.computed(()=>{if(k.value){const l=d.value.map(a=>a.absoluteValue),o=l.reduce((a,i)=>a+i,0);return{latest:d.value[d.value.length-1].absoluteValue,sum:o,average:o/d.value.length,median:r.calcMedian(l),trend:r.calcLinearProgression(d.value.map(({x:a,y:i,absoluteValue:I})=>({x:a,y:i,value:I}))).trend}}else return{latest:null,sum:null,average:null,median:null,trend:null}}),M=e.computed(()=>k.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),g=e.computed(()=>t.value.type&&t.value.type==="bar");function j(l,o){x("selectDatapoint",{datapoint:l,index:o})}return(l,o)=>(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&&p.showInfo?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"chartTitle",ref:V,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),k.value?(e.openBlock(),e.createElementBlock("svg",{key:1,xmlns:e.unref(r.XMLNS),viewBox:`0 0 ${n.value.width} ${n.value.height}`,style:e.normalizeStyle(`background:${t.value.style.backgroundColor};overflow:visible`)},[e.createVNode(G._sfc_main),l.$slots["chart-background"]?(e.openBlock(),e.createElementBlock("foreignObject",{key:0,x:0,y:0,width:n.value.width<=0?10:n.value.width,height:n.value.height<=0?10:n.value.height,style:{pointerEvents:"none"}},[e.renderSlot(l.$slots,"chart-background",{},void 0,!0)],8,X)):e.createCommentVNode("",!0),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(r.setOpacity)(e.unref(r.shiftHue)(t.value.style.area.color,.05),t.value.style.area.opacity)},null,8,Y),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(r.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(r.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(r.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&&!g.value&&d.value[0]?(e.openBlock(),e.createElementBlock("g",oe,[t.value.style.line.smooth?(e.openBlock(),e.createElementBlock("path",{key:0,d:`M ${d.value[0].x},${s.value.bottom} ${e.unref(r.createSmoothPath)(d.value)} L ${d.value.at(-1).x},${s.value.bottom} Z`,fill:t.value.style.area.useGradient?`url(#sparkline_gradient_${v.value})`:e.unref(r.setOpacity)(t.value.style.area.color,t.value.style.area.opacity)},null,8,ne)):(e.openBlock(),e.createElementBlock("path",{key:1,d:`M${T.value}Z`,fill:t.value.style.area.useGradient?`url(#sparkline_gradient_${v.value})`:e.unref(r.setOpacity)(t.value.style.area.color,t.value.style.area.opacity)},null,8,re))])):e.createCommentVNode("",!0),t.value.style.line.smooth&&!g.value?(e.openBlock(),e.createElementBlock("path",{key:2,d:`M ${e.unref(r.createSmoothPath)(d.value)}`,stroke:t.value.style.line.color,fill:"none","stroke-width":t.value.style.line.strokeWidth,"stroke-linecap":"round"},null,8,ue)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(a,i)=>(e.openBlock(),e.createElementBlock("g",null,[i<d.value.length-1&&!t.value.style.line.smooth&&!g.value?(e.openBlock(),e.createElementBlock("line",{key:0,x1:a.x,x2:d.value[i+1].x,y1:a.y||0,y2:d.value[i+1].y||0,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),g.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||p.selectedIndex===i)?(e.openBlock(),e.createElementBlock("line",{key:2,x1:a.x,x2:a.x,y1:s.value.top-6,y2:s.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:3,x1:s.value.start,x2:s.value.start+s.value.width-16,y1:e.unref(r.forceValidValue)(_.value,s.value.bottom),y2:e.unref(r.forceValidValue)(_.value,s.value.bottom),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:4},e.renderList(d.value,(a,i)=>(e.openBlock(),e.createElementBlock("g",null,[c.value&&a.id===c.value.id||p.selectedIndex===i?(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),p.showInfo&&t.value.style.dataLabel.show?(e.openBlock(),e.createElementBlock("text",{key:5,x:t.value.style.dataLabel.position==="left"?12+t.value.style.dataLabel.offsetX:s.value.width+12+t.value.style.dataLabel.offsetX,y:n.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(r.applyDataLabel)(t.value.style.dataLabel.formatter,c.value.absoluteValue,e.unref(r.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(r.applyDataLabel)(t.value.style.dataLabel.formatter,M.value,e.unref(r.dataLabel)({p:t.value.style.dataLabel.prefix,v:M.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(d.value,(a,i)=>(e.openBlock(),e.createElementBlock("rect",{x:a.x-(s.value.width/(h.value+1)>n.value.padding?n.value.padding:s.value.width/(h.value+1))/2,y:s.value.top-6,height:s.value.height+6,width:s.value.width/(h.value+1)>n.value.padding?n.value.padding:s.value.width/(h.value+1),fill:"transparent",onMouseenter:I=>W(a,i),onMouseleave:F,onClick:()=>j(a,i)},null,40,ye))),256)),e.renderSlot(l.$slots,"svg",{svg:n.value},void 0,!0)],12,U)):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),k.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(q.default,{key:3,config:{type:"sparkline",style:{backgroundColor:t.value.style.backgroundColor,sparkline:{color:"#CCCCCC"}}}},null,8,["config"]))],12,H))}},pe=R._export_sfc(fe,[["__scopeId","data-v-db8c64e5"]]);exports.default=pe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),r=require("./index-8TfPi9lB.cjs"),S=require("./useNestedProp-BKRkMJ0r.cjs"),q=require("./vue-ui-skeleton-ilN9FTO6.cjs"),P=require("./useResponsive-BJ7DTGpm.cjs"),G=require("./PackageVersion-CLMnI-8e.cjs"),R=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),H=["id"],U=["xmlns","viewBox"],X=["width","height"],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:1},ne=["d","fill"],re=["d","fill"],ue=["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"],fe={__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},heightRatio:{type:Number,default:1},forcedPadding:{type:Number,default:30}},emits:["hoverIndex","selectDatapoint"],setup(p,{emit:x}){const u=p,{vue_ui_sparkline:z}=r.useConfig(),k=e.computed(()=>!!u.dataset&&u.dataset.length),v=e.ref(r.createUid()),w=e.ref(null),V=e.ref(null),C=e.ref(null),t=e.computed({get:()=>L(),set:l=>l});function L(){const l=S.useNestedProp({userConfig:u.config,defaultConfig:z});let o={};return l.theme?o={...S.useNestedProp({userConfig:r.themes.vue_ui_sparkline[l.theme]||u.config,defaultConfig:l})}:o=l,u.config&&r.hasDeepProperty(u.config,"style.scaleMin")?o.style.scaleMin=u.config.style.scaleMin:o.style.scaleMin=null,u.config&&r.hasDeepProperty(u.config,"style.scaleMax")?o.style.scaleMax=u.config.style.scaleMax:o.style.scaleMax=null,o}const b=e.computed(()=>r.largestTriangleThreeBucketsArrayObjects({data:u.dataset,threshold:t.value.downsample.threshold}));e.watch(()=>u.config,l=>{t.value=L(),$(),n.value.chartWidth=t.value.style.chartWidth},{deep:!0}),e.watch(()=>u.dataset,l=>{f.value=r.largestTriangleThreeBucketsArrayObjects({data:u.dataset.map(o=>({...o,value:[void 0].includes(o.value)?null:o.value})),threshold:t.value.downsample.threshold})},{deep:!0});const f=e.ref(A());function A(){return r.largestTriangleThreeBucketsArrayObjects({data:u.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&&u.dataset.length>1){let a=function(){o<b.value.length?(f.value.push(b.value[o]),setTimeout(()=>{requestAnimationFrame(a)},l)):f.value=b.value,o+=1};f.value=[];const l=t.value.style.animation.animationFrames/u.dataset.length;let o=0;a()}});function $(){if(r.objectIsEmpty(u.dataset)?r.error({componentName:"VueUiSparkline",type:"dataset"}):u.dataset.forEach((l,o)=>{r.getMissingDatasetAttributes({datasetObject:l,requiredAttributes:["period","value"]}).forEach(a=>{r.error({componentName:"VueUiSparkline",type:"datasetSerieAttribute",property:a,index:o})})}),t.value.responsive){const l=P.throttle(()=>{const{width:o,height:a}=P.useResponsive({chart:w.value,title:t.value.style.title.show&&u.showInfo?V.value:null,source:C.value});requestAnimationFrame(()=>{n.value.width=o,n.value.height=a,n.value.chartWidth=t.value.style.chartWidth/500*o,n.value.padding=u.forcedPadding/500*o})});E.value=new ResizeObserver(l),E.value.observe(w.value.parentNode)}}const n=e.ref({height:80*u.heightRatio,width:500,chartWidth:t.value.style.chartWidth,padding:u.forcedPadding}),s=e.computed(()=>{const{top:l,right:o,bottom:a,left:i}=t.value.style.padding;return{top:l,left:i,right:n.value.width-o,bottom:n.value.height-a,start:u.showInfo&&t.value.style.dataLabel.show&&t.value.style.dataLabel.position==="left"?n.value.width-n.value.chartWidth+i:n.value.padding+i,width:u.showInfo&&t.value.style.dataLabel.show?n.value.chartWidth-i-o:n.value.width-n.value.padding-i-o,height:n.value.height-l-a}}),N=e.computed(()=>[null,void 0].includes(t.value.style.scaleMin)?Math.min(...f.value.map(l=>isNaN(l.value)||[void 0,null,"NaN",NaN,1/0,-1/0].includes(l.value)?0:l.value||0)):t.value.style.scaleMin),D=e.computed(()=>[null,void 0].includes(t.value.style.scaleMax)?Math.max(...f.value.map(l=>isNaN(l.value)||[void 0,null,"NaN",NaN,1/0,-1/0].includes(l.value)?0:l.value||0)):t.value.style.scaleMax),m=e.computed(()=>{const l=N.value>=0?0:N.value;return Math.abs(l)}),O=e.computed(()=>D.value+m.value),_=e.computed(()=>s.value.bottom-s.value.height*B(m.value));function B(l){return l/O.value}const h=e.computed(()=>b.value.length-1),d=e.computed(()=>f.value.map((l,o)=>{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:s.value.start+o*(s.value.width/(h.value+1)>n.padding?n.padding:s.value.width/(h.value+1)),y:s.value.bottom-s.value.height*B(a+m.value),id:`plot_${v.value}_${o}`,color:g.value?t.value.style.bar.color:t.value.style.area.useGradient?r.shiftHue(t.value.style.line.color,.05*(1-o/h.value)):t.value.style.line.color,width:s.value.width/(h.value+1)>n.padding?n.padding:s.value.width/(h.value+1)}})),T=e.computed(()=>{const l={x:d.value[0].x||0,y:(n.value.height||0)-6},o={x:d.value[d.value.length-1].x||0,y:(n.value.height||0)-6},a=[];return d.value.forEach(i=>{a.push(`${i.x||0},${i.y||0} `)}),[l.x,l.y,...a,o.x,o.y].toString()}),c=e.ref(void 0);function W(l,o){c.value=l,x("hoverIndex",{index:o})}function F(){c.value=void 0,x("hoverIndex",{index:void 0})}const y=e.computed(()=>{if(k.value){const l=d.value.map(a=>a.absoluteValue),o=l.reduce((a,i)=>a+i,0);return{latest:d.value[d.value.length-1].absoluteValue,sum:o,average:o/d.value.length,median:r.calcMedian(l),trend:r.calcLinearProgression(d.value.map(({x:a,y:i,absoluteValue:I})=>({x:a,y:i,value:I}))).trend}}else return{latest:null,sum:null,average:null,median:null,trend:null}}),M=e.computed(()=>k.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),g=e.computed(()=>t.value.type&&t.value.type==="bar");function j(l,o){x("selectDatapoint",{datapoint:l,index:o})}return(l,o)=>(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&&p.showInfo?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"chartTitle",ref:V,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),k.value?(e.openBlock(),e.createElementBlock("svg",{key:1,xmlns:e.unref(r.XMLNS),viewBox:`0 0 ${n.value.width} ${n.value.height}`,style:e.normalizeStyle(`background:${t.value.style.backgroundColor};overflow:visible`)},[e.createVNode(G._sfc_main),l.$slots["chart-background"]?(e.openBlock(),e.createElementBlock("foreignObject",{key:0,x:0,y:0,width:n.value.width<=0?10:n.value.width,height:n.value.height<=0?10:n.value.height,style:{pointerEvents:"none"}},[e.renderSlot(l.$slots,"chart-background",{},void 0,!0)],8,X)):e.createCommentVNode("",!0),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(r.setOpacity)(e.unref(r.shiftHue)(t.value.style.area.color,.05),t.value.style.area.opacity)},null,8,Y),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(r.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(r.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(r.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&&!g.value&&d.value[0]?(e.openBlock(),e.createElementBlock("g",oe,[t.value.style.line.smooth?(e.openBlock(),e.createElementBlock("path",{key:0,d:`M ${d.value[0].x},${s.value.bottom} ${e.unref(r.createSmoothPath)(d.value)} L ${d.value.at(-1).x},${s.value.bottom} Z`,fill:t.value.style.area.useGradient?`url(#sparkline_gradient_${v.value})`:e.unref(r.setOpacity)(t.value.style.area.color,t.value.style.area.opacity)},null,8,ne)):(e.openBlock(),e.createElementBlock("path",{key:1,d:`M${T.value}Z`,fill:t.value.style.area.useGradient?`url(#sparkline_gradient_${v.value})`:e.unref(r.setOpacity)(t.value.style.area.color,t.value.style.area.opacity)},null,8,re))])):e.createCommentVNode("",!0),t.value.style.line.smooth&&!g.value?(e.openBlock(),e.createElementBlock("path",{key:2,d:`M ${e.unref(r.createSmoothPath)(d.value)}`,stroke:t.value.style.line.color,fill:"none","stroke-width":t.value.style.line.strokeWidth,"stroke-linecap":"round"},null,8,ue)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(a,i)=>(e.openBlock(),e.createElementBlock("g",null,[i<d.value.length-1&&!t.value.style.line.smooth&&!g.value?(e.openBlock(),e.createElementBlock("line",{key:0,x1:a.x,x2:d.value[i+1].x,y1:a.y||0,y2:d.value[i+1].y||0,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),g.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||p.selectedIndex===i)?(e.openBlock(),e.createElementBlock("line",{key:2,x1:a.x,x2:a.x,y1:s.value.top-6,y2:s.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:3,x1:s.value.start,x2:s.value.start+s.value.width-16,y1:e.unref(r.forceValidValue)(_.value,s.value.bottom),y2:e.unref(r.forceValidValue)(_.value,s.value.bottom),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:4},e.renderList(d.value,(a,i)=>(e.openBlock(),e.createElementBlock("g",null,[c.value&&a.id===c.value.id||p.selectedIndex===i?(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),p.showInfo&&t.value.style.dataLabel.show?(e.openBlock(),e.createElementBlock("text",{key:5,x:t.value.style.dataLabel.position==="left"?12+t.value.style.dataLabel.offsetX:s.value.width+12+t.value.style.dataLabel.offsetX,y:n.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(r.applyDataLabel)(t.value.style.dataLabel.formatter,c.value.absoluteValue,e.unref(r.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(r.applyDataLabel)(t.value.style.dataLabel.formatter,M.value,e.unref(r.dataLabel)({p:t.value.style.dataLabel.prefix,v:M.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(d.value,(a,i)=>(e.openBlock(),e.createElementBlock("rect",{x:a.x-(s.value.width/(h.value+1)>n.value.padding?n.value.padding:s.value.width/(h.value+1))/2,y:s.value.top-6,height:s.value.height+6,width:s.value.width/(h.value+1)>n.value.padding?n.value.padding:s.value.width/(h.value+1),fill:"transparent",onMouseenter:I=>W(a,i),onMouseleave:F,onClick:()=>j(a,i)},null,40,ye))),256)),e.renderSlot(l.$slots,"svg",{svg:n.value},void 0,!0)],12,U)):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),k.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(q.default,{key:3,config:{type:"sparkline",style:{backgroundColor:t.value.style.backgroundColor,sparkline:{color:"#CCCCCC"}}}},null,8,["config"]))],12,H))}},pe=R._export_sfc(fe,[["__scopeId","data-v-db8c64e5"]]);exports.default=pe;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./index-CHCA909R.cjs"),V=require("./useNestedProp--1nKK7i0.cjs"),q=require("./vue-ui-skeleton-DsMIGHB3.cjs"),O=require("./PackageVersion-Cun_qdX7.cjs"),U=require("./Tooltip-fEuHWstj.cjs"),M=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),j=["xmlns","viewBox"],H=["id"],I=["stop-color"],R=["stop-color"],W=["stop-color"],Y={id:"stackPill",clipPathUnits:"objectBoundingBox"},G=["fill"],X={key:0,"clip-path":"url(#stackPill)"},J=["x","width","height","fill"],K=["x","width","height","fill","stroke"],Q=["onClick","x","width","height","onMouseenter"],Z=["width","height","rx"],ee=["onClick"],te={style:{display:"flex","flex-direction":"row","align-items":"center",gap:"4px","justify-content":"center"}},le=["height","width"],oe=["fill"],ae={key:4,ref:"source",dir:"auto"},re={__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(),F=e.useSlots();e.onMounted(()=>{F["chart-background"]&&console.warn("VueUiSparkStackbar does not support the #chart-background slot.")});const 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=>{v.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)),v=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 p=function(){r+=o/l,r<o?(v.value=v.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(p)):(g.value=!1,v.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,p()}});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(()=>v.value.map((l,n)=>{const o=l.value||0,r=o/N.value,p=isNaN(r)?0:r,s=p*c.value.width;return{...l,value:o,proportion:p,width:s,proportionLabel:a.dataLabel({v:p*100,s:"%",r:t.value.style.legend.percentage.rounding})}})),C=e.computed(()=>y.value.filter((l,n)=>!d.value.includes(n)));function T(l){d.value.includes(l)?d.value=d.value.filter(n=>n!==l):d.value.length<v.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 A({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(O._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,I),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,R),e.createElementVNode("stop",{offset:"100%","stop-color":o.color},null,8,W)],8,H))),128)),e.createElementVNode("clipPath",Y,[e.createElementVNode("rect",{x:"0.005",y:"-2",width:"0.99",height:"5",rx:"3",ry:"3",fill:t.value.style.backgroundColor},null,8,G)])]),N.value>0?(e.openBlock(),e.createElementBlock("g",X,[(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,J))),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,K))),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:()=>A({datapoint:o,seriesIndex:r}),onMouseleave:n[0]||(n[0]=p=>{b.value=!1,m.value=null})},null,42,Q))),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,Z))],8,j)):e.createCommentVNode("",!0),x.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(q.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:p=>{T(r),z(o,r)}},[e.createElementVNode("div",te,[(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,oe)],8,le)),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,ee))),256))],4)):e.createCommentVNode("",!0),e.createVNode(U._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",ae,[e.renderSlot(l.$slots,"source",{},void 0,!0)],512)):e.createCommentVNode("",!0)],4))}},ne=M._export_sfc(re,[["__scopeId","data-v-72244c73"]]);exports.default=ne;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./index-8TfPi9lB.cjs"),V=require("./useNestedProp-BKRkMJ0r.cjs"),q=require("./vue-ui-skeleton-ilN9FTO6.cjs"),O=require("./PackageVersion-CLMnI-8e.cjs"),U=require("./Tooltip-CVzhBGn7.cjs"),M=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),j=["xmlns","viewBox"],H=["id"],I=["stop-color"],R=["stop-color"],W=["stop-color"],Y={id:"stackPill",clipPathUnits:"objectBoundingBox"},G=["fill"],X={key:0,"clip-path":"url(#stackPill)"},J=["x","width","height","fill"],K=["x","width","height","fill","stroke"],Q=["onClick","x","width","height","onMouseenter"],Z=["width","height","rx"],ee=["onClick"],te={style:{display:"flex","flex-direction":"row","align-items":"center",gap:"4px","justify-content":"center"}},le=["height","width"],oe=["fill"],ae={key:4,ref:"source",dir:"auto"},re={__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(),F=e.useSlots();e.onMounted(()=>{F["chart-background"]&&console.warn("VueUiSparkStackbar does not support the #chart-background slot.")});const 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=>{v.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)),v=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 p=function(){r+=o/l,r<o?(v.value=v.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(p)):(g.value=!1,v.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,p()}});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(()=>v.value.map((l,n)=>{const o=l.value||0,r=o/N.value,p=isNaN(r)?0:r,s=p*c.value.width;return{...l,value:o,proportion:p,width:s,proportionLabel:a.dataLabel({v:p*100,s:"%",r:t.value.style.legend.percentage.rounding})}})),C=e.computed(()=>y.value.filter((l,n)=>!d.value.includes(n)));function T(l){d.value.includes(l)?d.value=d.value.filter(n=>n!==l):d.value.length<v.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 A({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(O._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,I),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,R),e.createElementVNode("stop",{offset:"100%","stop-color":o.color},null,8,W)],8,H))),128)),e.createElementVNode("clipPath",Y,[e.createElementVNode("rect",{x:"0.005",y:"-2",width:"0.99",height:"5",rx:"3",ry:"3",fill:t.value.style.backgroundColor},null,8,G)])]),N.value>0?(e.openBlock(),e.createElementBlock("g",X,[(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,J))),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,K))),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:()=>A({datapoint:o,seriesIndex:r}),onMouseleave:n[0]||(n[0]=p=>{b.value=!1,m.value=null})},null,42,Q))),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,Z))],8,j)):e.createCommentVNode("",!0),x.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(q.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:p=>{T(r),z(o,r)}},[e.createElementVNode("div",te,[(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,oe)],8,le)),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,ee))),256))],4)):e.createCommentVNode("",!0),e.createVNode(U._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",ae,[e.renderSlot(l.$slots,"source",{},void 0,!0)],512)):e.createCommentVNode("",!0)],4))}},ne=M._export_sfc(re,[["__scopeId","data-v-72244c73"]]);exports.default=ne;
@@ -1,9 +1,9 @@
1
1
  import { useSlots as ne, onMounted as Y, computed as m, ref as d, watch as G, openBlock as s, createElementBlock as r, normalizeStyle as v, createElementVNode as p, toDisplayString as w, createCommentVNode as y, unref as C, createVNode as q, Fragment as x, renderList as $, normalizeClass as F, createBlock as ue, withCtx as H, renderSlot as U, normalizeProps as X, guardReactiveProps as J } from "vue";
2
- import { u as ie, c as K, t as ce, a as de, p as i, d as N, b as ve, o as pe, e as Q, g as ge, f as V, X as fe, s as he, w as ye, i as Z, x as me } from "./index-DAAFXQJj.js";
3
- import { u as ee } from "./useNestedProp-DMtJzMiX.js";
4
- import ke from "./vue-ui-skeleton-BM3ut-zl.js";
5
- import { _ as be } from "./PackageVersion-DKr8jVlI.js";
6
- import { _ as _e } from "./Tooltip-CG6ZX21C.js";
2
+ import { u as ie, c as K, t as ce, a as de, p as i, d as N, b as ve, o as pe, e as Q, g as ge, f as V, X as fe, s as he, w as ye, i as Z, x as me } from "./index-OhfEeW2N.js";
3
+ import { u as ee } from "./useNestedProp-Cwjz-hIm.js";
4
+ import ke from "./vue-ui-skeleton-CZBWPZpy.js";
5
+ import { _ as be } from "./PackageVersion-DBbbI7TU.js";
6
+ import { _ as _e } from "./Tooltip-DvcJ9uFx.js";
7
7
  import { _ as we } from "./_plugin-vue_export-helper-CHgC5LLL.js";
8
8
  const Ce = ["xmlns", "viewBox"], xe = ["id"], $e = ["stop-color"], Se = ["stop-color"], ze = ["stop-color"], Pe = {
9
9
  id: "stackPill",
@@ -1,19 +1,19 @@
1
1
  import { useSlots as It, computed as w, ref as g, onMounted as et, watch as tt, nextTick as he, openBlock as o, createElementBlock as s, normalizeClass as te, normalizeStyle as U, unref as m, createBlock as Z, createCommentVNode as v, renderSlot as x, createVNode as ae, createSlots as at, withCtx as _, normalizeProps as I, guardReactiveProps as O, Fragment as h, renderList as y, createElementVNode as Y, toDisplayString as $, createTextVNode as Ot } from "vue";
2
- import { u as Pt, c as lt, t as Rt, a as At, p as ve, C as de, b as Vt, o as Ft, e as rt, g as Dt, d as Et, aa as ye, a6 as ot, D as st, X as Ht, l as Wt, a3 as ge, G as it, f as X, x as nt, i as ut, y as Bt, q as Ut, r as Yt } from "./index-DAAFXQJj.js";
3
- import { u as ct } from "./useNestedProp-DMtJzMiX.js";
2
+ import { u as Pt, c as lt, t as Rt, a as At, p as ve, C as de, b as Vt, o as Ft, e as rt, g as Dt, d as Et, aa as ye, a6 as ot, D as st, X as Ht, l as Wt, a3 as ge, G as it, f as X, x as nt, i as ut, y as Bt, q as Ut, r as Yt } from "./index-OhfEeW2N.js";
3
+ import { u as ct } from "./useNestedProp-Cwjz-hIm.js";
4
4
  import { t as Xt, u as Gt } from "./useResponsive-CoxXLe23.js";
5
- import { u as Jt, U as qt } from "./usePrinter-BvlefWMW.js";
6
- import { S as Zt } from "./Slicer-CP2dQhd5.js";
7
- import { _ as Kt } from "./Tooltip-CG6ZX21C.js";
8
- import { _ as Qt } from "./Title-C4aoNP1T.js";
9
- import { L as jt } from "./Legend-K7NRkzGf.js";
10
- import ea from "./vue-ui-accordion-B67N9Oo8.js";
11
- import { D as ta } from "./DataTable-D4_TjSBJ.js";
12
- import aa from "./vue-ui-skeleton-BM3ut-zl.js";
13
- import { _ as la } from "./PackageVersion-DKr8jVlI.js";
14
- import { P as ra } from "./PenAndPaper-CurhQVkh.js";
5
+ import { u as Jt, U as qt } from "./usePrinter-stvkbwgz.js";
6
+ import { S as Zt } from "./Slicer-BnomLNhl.js";
7
+ import { _ as Kt } from "./Tooltip-DvcJ9uFx.js";
8
+ import { _ as Qt } from "./Title-hfEOmPlv.js";
9
+ import { L as jt } from "./Legend-Qe36RQO1.js";
10
+ import ea from "./vue-ui-accordion-BH0OU8sD.js";
11
+ import { D as ta } from "./DataTable-BaW_PF1t.js";
12
+ import aa from "./vue-ui-skeleton-CZBWPZpy.js";
13
+ import { _ as la } from "./PackageVersion-DBbbI7TU.js";
14
+ import { P as ra } from "./PenAndPaper-tV-SbWUa.js";
15
15
  import { u as oa } from "./useUserOptionState-BIvW1Kz7.js";
16
- import { _ as sa } from "./Shape-C4LyHNQ3.js";
16
+ import { _ as sa } from "./Shape-BDcnW_8x.js";
17
17
  import { _ as ia } from "./_plugin-vue_export-helper-CHgC5LLL.js";
18
18
  const na = ["id"], ua = ["xmlns", "viewBox"], ca = ["x", "y", "width", "height"], ha = { key: 1 }, va = ["id"], da = ["stop-color"], ya = ["stop-color"], ga = ["stop-color"], ba = ["x1", "x2", "y1", "y2", "stroke"], fa = ["x1", "x2", "y1", "y2", "stroke"], ma = ["x1", "x2", "y1", "y2", "stroke"], pa = ["x1", "x2", "y1", "y2", "stroke"], xa = { key: 0 }, ka = ["x", "y", "height", "rx", "width", "fill", "stroke", "stroke-width"], wa = { key: 0 }, za = ["x", "y", "height", "rx", "width", "fill", "stroke", "stroke-width"], _a = ["x", "y", "width", "rx", "height", "fill", "stroke", "stroke-width"], Ca = { key: 0 }, La = ["x", "y", "width", "rx", "height", "fill", "stroke", "stroke-width"], Sa = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], $a = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Ma = ["x", "y", "font-size", "fill", "font-weight"], Ta = ["transform", "font-size", "fill", "font-weight"], Na = ["x", "y", "font-size", "fill", "font-weight"], Ia = { key: 0 }, Oa = ["x", "y", "font-size", "font-weight", "fill"], Pa = ["x", "y", "font-size", "fill", "font-weight"], Ra = { key: 0 }, Aa = ["x", "y", "font-size", "font-weight", "fill"], Va = ["x1", "x2", "y1", "y2", "stroke"], Fa = ["x", "y", "font-size", "font-weight", "fill"], Da = ["x1", "x2", "y1", "y2", "stroke"], Ea = ["font-size", "font-weight", "fill", "text-anchor", "transform"], Ha = { key: 0 }, Wa = { key: 1 }, Ba = ["text-anchor", "font-size", "font-weight", "fill", "transform", "onClick"], Ua = { key: 0 }, Ya = { key: 1 }, Xa = ["font-size", "font-weight", "fill", "x", "y", "onClick"], Ga = ["x", "y", "width", "height", "onClick", "onMouseenter", "fill"], Ja = ["x", "y", "width", "height", "onClick", "onMouseenter", "fill"], qa = {
19
19
  key: 4,
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("./index-CHCA909R.cjs"),Ve=require("./useNestedProp--1nKK7i0.cjs"),Te=require("./useResponsive-BJ7DTGpm.cjs"),Me=require("./usePrinter-xicwiw8r.cjs"),at=require("./Slicer-BIzpsKb9.cjs"),lt=require("./Tooltip-fEuHWstj.cjs"),ot=require("./Title-bDp_4dQV.cjs"),rt=require("./Legend-CcoLuZn0.cjs"),st=require("./vue-ui-accordion-B4PyxVUm.cjs"),nt=require("./DataTable-ZowHAjXC.cjs"),it=require("./vue-ui-skeleton-DsMIGHB3.cjs"),ut=require("./PackageVersion-Cun_qdX7.cjs"),ct=require("./PenAndPaper-u46MyY7W.cjs"),dt=require("./useUserOptionState-BgepsfED.cjs"),ht=require("./Shape-B6dlN2je.cjs"),vt=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),mt=["id"],gt=["xmlns","viewBox"],yt=["x","y","width","height"],bt={key:1},pt=["id"],ft=["stop-color"],kt=["stop-color"],xt=["stop-color"],wt=["x1","x2","y1","y2","stroke"],Bt=["x1","x2","y1","y2","stroke"],Ct=["x1","x2","y1","y2","stroke"],zt=["x1","x2","y1","y2","stroke"],St={key:0},Lt=["x","y","height","rx","width","fill","stroke","stroke-width"],_t={key:0},Et=["x","y","height","rx","width","fill","stroke","stroke-width"],Nt=["x","y","width","rx","height","fill","stroke","stroke-width"],$t={key:0},Vt=["x","y","width","rx","height","fill","stroke","stroke-width"],Tt=["x1","x2","y1","y2","stroke","stroke-width"],Mt=["x1","x2","y1","y2","stroke","stroke-width"],Pt=["x","y","font-size","fill","font-weight"],Ft=["transform","font-size","fill","font-weight"],It=["x","y","font-size","fill","font-weight"],Rt={key:0},Ot=["x","y","font-size","font-weight","fill"],Dt=["x","y","font-size","fill","font-weight"],At={key:0},Ht=["x","y","font-size","font-weight","fill"],qt=["x1","x2","y1","y2","stroke"],Ut=["x","y","font-size","font-weight","fill"],Wt=["x1","x2","y1","y2","stroke"],Yt=["font-size","font-weight","fill","text-anchor","transform"],Xt={key:0},Gt={key:1},Jt=["text-anchor","font-size","font-weight","fill","transform","onClick"],Zt={key:0},Kt={key:1},Qt=["font-size","font-weight","fill","x","y","onClick"],jt=["x","y","width","height","onClick","onMouseenter","fill"],ea=["x","y","width","height","onClick","onMouseenter","fill"],ta={key:4,class:"vue-data-ui-watermark"},aa=["onClick"],la=["innerHTML"],oa={__name:"vue-ui-stackbar",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:["selectDatapoint","selectLegend","selectTimeLabel"],setup(G,{expose:Pe,emit:J}){const h=G,{vue_ui_stackbar:Fe}=u.useConfig(),Ie=e.useSlots(),T=e.computed({get(){return!!h.dataset&&h.dataset.length},set(l){return l}}),M=e.ref(null),C=e.ref(u.createUid()),D=e.ref(!1),ee=e.ref(null),Z=e.ref(""),p=e.ref([]),te=e.ref(0),ae=e.ref(null),le=e.ref(null),oe=e.ref(null),re=e.ref(null),se=e.ref(0),A=e.ref(!1),F=e.ref(null),_=e.ref(!1),Re=e.ref(0),Oe=e.ref(0),De=e.ref(0),P=e.ref(null);e.onMounted(()=>{Q()});const t=e.computed({get:()=>ue(),set:l=>l}),{userOptionsVisible:K,setUserOptionsVisibility:ne,keepUserOptionState:ie}=dt.useUserOptionState({config:t.value});function ue(){const l=Ve.useNestedProp({userConfig:h.config,defaultConfig:Fe});let o={};return l.theme?o={...Ve.useNestedProp({userConfig:u.themes.vue_ui_stackbar[l.theme]||h.config,defaultConfig:l}),customPalette:u.themePalettes[l.theme]||u.palette}:o=l,h.config&&u.hasDeepProperty(h.config,"style.chart.grid.scale.scaleMin")?o.style.chart.grid.scale.scaleMin=h.config.style.chart.grid.scale.scaleMin:o.style.chart.grid.scale.scaleMin=null,h.config&&u.hasDeepProperty(h.config,"style.chart.grid.scale.scaleMax")?o.style.chart.grid.scale.scaleMax=h.config.style.chart.grid.scale.scaleMax:o.style.chart.grid.scale.scaleMax=null,h.config&&u.hasDeepProperty(h.config,"style.chart.zoom.startIndex")?o.style.chart.zoom.startIndex=h.config.style.chart.zoom.startIndex:o.style.chart.zoom.startIndex=null,h.config&&u.hasDeepProperty(h.config,"style.chart.zoom.endIndex")?o.style.chart.zoom.endIndex=h.config.style.chart.zoom.endIndex:o.style.chart.zoom.endIndex=null,o}e.watch(()=>h.config,l=>{t.value=ue(),K.value=!t.value.userOptions.showOnChartHover,Q(),Re.value+=1,Oe.value+=1,De.value+=1,y.value.dataLabels.show=t.value.style.chart.bars.dataLabels.show,y.value.showTable=t.value.table.show,y.value.showTooltip=t.value.style.chart.tooltip.show},{deep:!0}),e.watch(()=>h.dataset,l=>{ye()},{deep:!0});const y=e.ref({dataLabels:{show:t.value.style.chart.bars.dataLabels.show},showTable:t.value.table.show,showTooltip:t.value.style.chart.tooltip.show}),{isPrinting:ce,isImaging:de,generatePdf:he,generateImage:ve}=Me.usePrinter({elementId:`stackbar_${C.value}`,fileName:t.value.style.chart.title.text||"vue-ui-stackbar"}),H=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}}),Ae=e.computed(()=>u.convertCustomPalette(t.value.customPalette)),me=e.ref(null),ge=e.ref(null);e.onMounted(()=>{Q()});function Q(){if(u.objectIsEmpty(h.dataset)?u.error({componentName:"VueUiStackbar",type:"dataset"}):h.dataset.forEach((l,o)=>{u.getMissingDatasetAttributes({datasetObject:l,requiredAttributes:["name","series"]}).forEach(a=>{T.value=!1,u.error({componentName:"VueUiStackbar",type:"datasetSerieAttribute",property:a,index:o})})}),setTimeout(()=>{_.value=!0},10),t.value.responsive){const l=Te.throttle(()=>{_.value=!1;const{width:o,height:a}=Te.useResponsive({chart:M.value,title:t.value.style.chart.title.text?ae.value:null,legend:t.value.style.chart.legend.show?le.value:null,slicer:t.value.style.chart.zoom.show&&S.value>1?oe.value:null,source:re.value});requestAnimationFrame(()=>{H.value.width=o,H.value.height=a,clearTimeout(ge.value),ge.value=setTimeout(()=>{_.value=!0},10)})});me.value=new ResizeObserver(l),me.value.observe(M.value.parentNode)}be()}const s=e.computed(()=>{const{height:l,width:o}=H.value,{right:a}=H.value.paddingRatio,r=t.value.style.chart.padding.top,i=o-o*a,n=l-t.value.style.chart.padding.bottom,b=t.value.style.chart.padding.left,E=o-b-o*a,N=l-r-t.value.style.chart.padding.bottom;return{chartHeight:l,chartWidth:o,top:r,right:i,bottom:n,left:b,width:E,height:N<0?0:N}}),z=e.computed(()=>h.dataset.map((l,o)=>{const a=u.convertColorToHex(l.color)||Ae.value[o]||u.palette[o]||u.palette[o%u.palette.length];return{...l,series:JSON.parse(JSON.stringify(l.series)).map(r=>t.value.style.chart.bars.distributed?Math.abs(r):r),signedSeries:l.series.map(r=>r>=0?1:-1),absoluteIndex:o,id:u.createUid(),color:a}})),S=e.computed(()=>Math.max(...z.value.filter(l=>!p.value.includes(l.id)).map(l=>l.series.length))),c=e.ref({start:0,end:Math.max(...h.dataset.map(l=>l.series.length))});function ye(){be()}async function be(){(t.value.style.chart.zoom.startIndex!==null||t.value.style.chart.zoom.endIndex!==null)&&P.value?(t.value.style.chart.zoom.startIndex!==null&&(await e.nextTick(),await e.nextTick(),P.value&&P.value.setStartValue(t.value.style.chart.zoom.startIndex)),t.value.style.chart.zoom.endIndex!==null&&(await e.nextTick(),await e.nextTick(),P.value&&P.value.setEndValue(He(t.value.style.chart.zoom.endIndex+1)))):(c.value={start:0,end:Math.max(...h.dataset.map(l=>l.series.length))},se.value+=1)}function He(l){const o=Math.max(...h.dataset.map(a=>a.series.length));return l>o?o:l<0||t.value.style.chart.zoom.startIndex!==null&&l<t.value.style.chart.zoom.startIndex?t.value.style.chart.zoom.startIndex!==null?t.value.style.chart.zoom.startIndex+1:1:l}const d=e.computed(()=>{let l;return t.value.orientation==="vertical"?l=s.value.width/(c.value.end-c.value.start):l=s.value.height/(c.value.end-c.value.start),l<=0?0:l}),I=e.computed(()=>u.sumSeries(z.value.filter(l=>!p.value.includes(l.id))).slice(c.value.start,c.value.end)),qe=e.computed(()=>u.sumSeries(z.value.filter(l=>!p.value.includes(l.id)).map(l=>({...l,series:l.series.map((o,a)=>l.signedSeries[a]===-1&&o>=0?-o:o)}))).slice(c.value.start,c.value.end)),q=e.computed(()=>{const l=z.value.filter(o=>!p.value.includes(o.id));return{positive:u.sumSeries(l.map(o=>({...o,series:o.series.slice(c.value.start,c.value.end).map(a=>a>=0?a:0)}))),negative:u.sumSeries(l.map(o=>({...o,series:o.series.slice(c.value.start,c.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(...q.value.positive),o=Math.min(...q.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(o)?0:o,r=!t.value.style.chart.bars.distributed&&(t.value.style.chart.grid.scale.scaleMax!==null||t.value.style.chart.grid.scale.scaleMin!==null)?u.calculateNiceScaleWithExactExtremes(a>0?0:a,l<0?0:l,t.value.style.chart.grid.scale.ticks):u.calculateNiceScale(a>0?0:a,l<0?0:l,t.value.style.chart.grid.scale.ticks);return r.ticks.map(i=>({zero:s.value.bottom-s.value.height*(Math.abs(r.min)/(r.max+Math.abs(r.min))),y:s.value.bottom-s.value.height*((i+Math.abs(r.min))/(r.max+Math.abs(r.min))),x:s.value.left-8,horizontal_zero:s.value.left+s.value.width*(Math.abs(r.min)/(r.max+Math.abs(r.min))),horizontal_x:s.value.left+s.value.width*((i+Math.abs(r.min))/(r.max+Math.abs(r.min))),horizontal_y:s.value.bottom-8,value:i}))}),L=e.computed(()=>{const l=[];for(let o=0;o<S.value;o+=1)l.push({text:t.value.style.chart.grid.x.timeLabels.values[o]||String(o),absoluteIndex:o});return l.slice(c.value.start,c.value.end)}),g=e.computed(()=>{if(!T.value)return[];let l=Array(S.value).fill(0),o=Array(S.value).fill(0),a=Array(S.value).fill(0),r=Array(S.value).fill(0);const i=Math.max(...q.value.positive)||0,n=Math.min(...q.value.negative),b=[-1/0,1/0,NaN,void 0,null].includes(n)?0:n,E=!t.value.style.chart.bars.distributed&&(t.value.style.chart.grid.scale.scaleMax!==null||t.value.style.chart.grid.scale.scaleMin!==null)?u.calculateNiceScaleWithExactExtremes(t.value.style.chart.grid.scale.scaleMin!==null?t.value.style.chart.grid.scale.scaleMin:b>0?0:b,t.value.style.chart.grid.scale.scaleMax!==null?t.value.style.chart.grid.scale.scaleMax:i<0?0:i,t.value.style.chart.grid.scale.ticks):u.calculateNiceScale(t.value.style.chart.grid.scale.scaleMin!==null?t.value.style.chart.grid.scale.scaleMin:b>0?0:b,t.value.style.chart.grid.scale.scaleMax!==null?t.value.style.chart.grid.scale.scaleMax:i<0?0:i,t.value.style.chart.grid.scale.ticks),{min:N,max:R}=E,$=R+(N>=0?0:Math.abs(N))||1,f=s.value.height,X=s.value.width,Ne=w.value[0]?w.value[0].zero:s.value.bottom,$e=w.value[0]?w.value[0].horizontal_zero:s.value.left;return z.value.filter(O=>!p.value.includes(O.id)).map(O=>{const B=O.series.slice(c.value.start,c.value.end),Ge=O.signedSeries.slice(c.value.start,c.value.end),Je=B.map((v,m)=>s.value.left+d.value*m+d.value*t.value.style.chart.bars.gapRatio/4),Ze=B.map((v,m)=>s.value.top+d.value*m+d.value*t.value.style.chart.bars.gapRatio/4),Ke=B.map((v,m)=>{const k=t.value.style.chart.bars.distributed?(v||0)/I.value[m]:(v||0)/$;let V,x;return v>0?(x=f*k,V=Ne-x-l[m],l[m]+=x):(x=f*k,V=Ne+a[m],a[m]+=Math.abs(x)),V}),Qe=B.map((v,m)=>{const k=t.value.style.chart.bars.distributed?(v||0)/I.value[m]:(v||0)/$;let V,x;return v>0?(x=X*k,V=$e+o[m],o[m]+=x):(x=X*k,V=$e-Math.abs(x)-r[m],r[m]+=Math.abs(x)),V}),je=B.map((v,m)=>{const k=t.value.style.chart.bars.distributed?(v||0)/I.value[m]:(v||0)/$;return v>0?f*k:f*Math.abs(k)}),et=B.map((v,m)=>{const k=t.value.style.chart.bars.distributed?(v||0)/I.value[m]:(v||0)/$;return v>0?X*k:X*Math.abs(k)}),tt=B.map(v=>Math.abs(v)).reduce((v,m)=>v+m,0);return{...O,proportions:B.map((v,m)=>t.value.style.chart.bars.distributed?(v||0)/I.value[m]:(v||0)/tt),series:B,signedSeries:Ge,x:Je,y:Ke,height:je,horizontal_width:et,horizontal_y:Ze,horizontal_x:Qe}})}),pe=e.computed(()=>qe.value.map((l,o)=>({value:l,sign:l>=0?1:-1})));function U(l,o,a,r,i){const n=i===-1&&l>=0?-l:l;return u.applyDataLabel(t.value.style.chart.bars.dataLabels.formatter,n,u.dataLabel({p:t.value.style.chart.bars.dataLabels.prefix,v:n,s:t.value.style.chart.bars.dataLabels.suffix,r:t.value.style.chart.bars.dataLabels.rounding}),{datapoint:o,seriesIndex:a,datapointIndex:r})}function fe(l,o,a,r){return u.applyDataLabel(t.value.style.chart.bars.dataLabels.formatter,l,u.dataLabel({v:isNaN(l)?0:l,s:"%",r:t.value.style.chart.bars.dataLabels.rounding}),{datapoint:o,seriesIndex:a,datapointIndex:r})}function ke(l){const o=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}));J("selectDatapoint",{datapoint:o,period:L.value[l]})}function xe(l){F.value=l,D.value=!0;const o=t.value.style.chart.tooltip.customFormat,a=JSON.parse(JSON.stringify(g.value)).map(i=>({name:i.name,absoluteIndex:i.absoluteIndex,value:i.series[l]===0?0:(i.signedSeries[l]===-1&&i.series[l]>=0?-i.series[l]:i.series[l])||null,proportion:i.proportions[l]||null,color:i.color,id:i.id})),r=a.map(i=>Math.abs(i.value)).reduce((i,n)=>i+n,0);if(u.isFunction(o)&&u.functionReturnsString(()=>o({seriesIndex:l,datapoint:a,series:g.value,config:t.value})))Z.value=o({seriesIndex:l,datapoint:a,series:g.value,config:t.value});else{const{showValue:i,showPercentage:n,borderColor:b,roundingValue:E,roundingPercentage:N}=t.value.style.chart.tooltip;let R="";L.value[l]&&L.value[l].text&&t.value.style.chart.tooltip.showTimeLabel&&(R+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${b};padding-bottom:6px;margin-bottom:3px;">${L.value[l].text}</div>`);const $=[i&&n?"(":"",i&&n?")":""];a.reverse().forEach(f=>{R+=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("./index-8TfPi9lB.cjs"),Ve=require("./useNestedProp-BKRkMJ0r.cjs"),Te=require("./useResponsive-BJ7DTGpm.cjs"),Me=require("./usePrinter-CzqlwBQp.cjs"),at=require("./Slicer-UxISG-yc.cjs"),lt=require("./Tooltip-CVzhBGn7.cjs"),ot=require("./Title-C6GY7-tb.cjs"),rt=require("./Legend-D_1LwKfa.cjs"),st=require("./vue-ui-accordion-CDyaHBeZ.cjs"),nt=require("./DataTable-D8Jrpq-B.cjs"),it=require("./vue-ui-skeleton-ilN9FTO6.cjs"),ut=require("./PackageVersion-CLMnI-8e.cjs"),ct=require("./PenAndPaper-DxTPtHU5.cjs"),dt=require("./useUserOptionState-BgepsfED.cjs"),ht=require("./Shape-lPTNUyoX.cjs"),vt=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),mt=["id"],gt=["xmlns","viewBox"],yt=["x","y","width","height"],bt={key:1},pt=["id"],ft=["stop-color"],kt=["stop-color"],xt=["stop-color"],wt=["x1","x2","y1","y2","stroke"],Bt=["x1","x2","y1","y2","stroke"],Ct=["x1","x2","y1","y2","stroke"],zt=["x1","x2","y1","y2","stroke"],St={key:0},Lt=["x","y","height","rx","width","fill","stroke","stroke-width"],_t={key:0},Et=["x","y","height","rx","width","fill","stroke","stroke-width"],Nt=["x","y","width","rx","height","fill","stroke","stroke-width"],$t={key:0},Vt=["x","y","width","rx","height","fill","stroke","stroke-width"],Tt=["x1","x2","y1","y2","stroke","stroke-width"],Mt=["x1","x2","y1","y2","stroke","stroke-width"],Pt=["x","y","font-size","fill","font-weight"],Ft=["transform","font-size","fill","font-weight"],It=["x","y","font-size","fill","font-weight"],Rt={key:0},Ot=["x","y","font-size","font-weight","fill"],Dt=["x","y","font-size","fill","font-weight"],At={key:0},Ht=["x","y","font-size","font-weight","fill"],qt=["x1","x2","y1","y2","stroke"],Ut=["x","y","font-size","font-weight","fill"],Wt=["x1","x2","y1","y2","stroke"],Yt=["font-size","font-weight","fill","text-anchor","transform"],Xt={key:0},Gt={key:1},Jt=["text-anchor","font-size","font-weight","fill","transform","onClick"],Zt={key:0},Kt={key:1},Qt=["font-size","font-weight","fill","x","y","onClick"],jt=["x","y","width","height","onClick","onMouseenter","fill"],ea=["x","y","width","height","onClick","onMouseenter","fill"],ta={key:4,class:"vue-data-ui-watermark"},aa=["onClick"],la=["innerHTML"],oa={__name:"vue-ui-stackbar",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:["selectDatapoint","selectLegend","selectTimeLabel"],setup(G,{expose:Pe,emit:J}){const h=G,{vue_ui_stackbar:Fe}=u.useConfig(),Ie=e.useSlots(),T=e.computed({get(){return!!h.dataset&&h.dataset.length},set(l){return l}}),M=e.ref(null),C=e.ref(u.createUid()),D=e.ref(!1),ee=e.ref(null),Z=e.ref(""),p=e.ref([]),te=e.ref(0),ae=e.ref(null),le=e.ref(null),oe=e.ref(null),re=e.ref(null),se=e.ref(0),A=e.ref(!1),F=e.ref(null),_=e.ref(!1),Re=e.ref(0),Oe=e.ref(0),De=e.ref(0),P=e.ref(null);e.onMounted(()=>{Q()});const t=e.computed({get:()=>ue(),set:l=>l}),{userOptionsVisible:K,setUserOptionsVisibility:ne,keepUserOptionState:ie}=dt.useUserOptionState({config:t.value});function ue(){const l=Ve.useNestedProp({userConfig:h.config,defaultConfig:Fe});let o={};return l.theme?o={...Ve.useNestedProp({userConfig:u.themes.vue_ui_stackbar[l.theme]||h.config,defaultConfig:l}),customPalette:u.themePalettes[l.theme]||u.palette}:o=l,h.config&&u.hasDeepProperty(h.config,"style.chart.grid.scale.scaleMin")?o.style.chart.grid.scale.scaleMin=h.config.style.chart.grid.scale.scaleMin:o.style.chart.grid.scale.scaleMin=null,h.config&&u.hasDeepProperty(h.config,"style.chart.grid.scale.scaleMax")?o.style.chart.grid.scale.scaleMax=h.config.style.chart.grid.scale.scaleMax:o.style.chart.grid.scale.scaleMax=null,h.config&&u.hasDeepProperty(h.config,"style.chart.zoom.startIndex")?o.style.chart.zoom.startIndex=h.config.style.chart.zoom.startIndex:o.style.chart.zoom.startIndex=null,h.config&&u.hasDeepProperty(h.config,"style.chart.zoom.endIndex")?o.style.chart.zoom.endIndex=h.config.style.chart.zoom.endIndex:o.style.chart.zoom.endIndex=null,o}e.watch(()=>h.config,l=>{t.value=ue(),K.value=!t.value.userOptions.showOnChartHover,Q(),Re.value+=1,Oe.value+=1,De.value+=1,y.value.dataLabels.show=t.value.style.chart.bars.dataLabels.show,y.value.showTable=t.value.table.show,y.value.showTooltip=t.value.style.chart.tooltip.show},{deep:!0}),e.watch(()=>h.dataset,l=>{ye()},{deep:!0});const y=e.ref({dataLabels:{show:t.value.style.chart.bars.dataLabels.show},showTable:t.value.table.show,showTooltip:t.value.style.chart.tooltip.show}),{isPrinting:ce,isImaging:de,generatePdf:he,generateImage:ve}=Me.usePrinter({elementId:`stackbar_${C.value}`,fileName:t.value.style.chart.title.text||"vue-ui-stackbar"}),H=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}}),Ae=e.computed(()=>u.convertCustomPalette(t.value.customPalette)),me=e.ref(null),ge=e.ref(null);e.onMounted(()=>{Q()});function Q(){if(u.objectIsEmpty(h.dataset)?u.error({componentName:"VueUiStackbar",type:"dataset"}):h.dataset.forEach((l,o)=>{u.getMissingDatasetAttributes({datasetObject:l,requiredAttributes:["name","series"]}).forEach(a=>{T.value=!1,u.error({componentName:"VueUiStackbar",type:"datasetSerieAttribute",property:a,index:o})})}),setTimeout(()=>{_.value=!0},10),t.value.responsive){const l=Te.throttle(()=>{_.value=!1;const{width:o,height:a}=Te.useResponsive({chart:M.value,title:t.value.style.chart.title.text?ae.value:null,legend:t.value.style.chart.legend.show?le.value:null,slicer:t.value.style.chart.zoom.show&&S.value>1?oe.value:null,source:re.value});requestAnimationFrame(()=>{H.value.width=o,H.value.height=a,clearTimeout(ge.value),ge.value=setTimeout(()=>{_.value=!0},10)})});me.value=new ResizeObserver(l),me.value.observe(M.value.parentNode)}be()}const s=e.computed(()=>{const{height:l,width:o}=H.value,{right:a}=H.value.paddingRatio,r=t.value.style.chart.padding.top,i=o-o*a,n=l-t.value.style.chart.padding.bottom,b=t.value.style.chart.padding.left,E=o-b-o*a,N=l-r-t.value.style.chart.padding.bottom;return{chartHeight:l,chartWidth:o,top:r,right:i,bottom:n,left:b,width:E,height:N<0?0:N}}),z=e.computed(()=>h.dataset.map((l,o)=>{const a=u.convertColorToHex(l.color)||Ae.value[o]||u.palette[o]||u.palette[o%u.palette.length];return{...l,series:JSON.parse(JSON.stringify(l.series)).map(r=>t.value.style.chart.bars.distributed?Math.abs(r):r),signedSeries:l.series.map(r=>r>=0?1:-1),absoluteIndex:o,id:u.createUid(),color:a}})),S=e.computed(()=>Math.max(...z.value.filter(l=>!p.value.includes(l.id)).map(l=>l.series.length))),c=e.ref({start:0,end:Math.max(...h.dataset.map(l=>l.series.length))});function ye(){be()}async function be(){(t.value.style.chart.zoom.startIndex!==null||t.value.style.chart.zoom.endIndex!==null)&&P.value?(t.value.style.chart.zoom.startIndex!==null&&(await e.nextTick(),await e.nextTick(),P.value&&P.value.setStartValue(t.value.style.chart.zoom.startIndex)),t.value.style.chart.zoom.endIndex!==null&&(await e.nextTick(),await e.nextTick(),P.value&&P.value.setEndValue(He(t.value.style.chart.zoom.endIndex+1)))):(c.value={start:0,end:Math.max(...h.dataset.map(l=>l.series.length))},se.value+=1)}function He(l){const o=Math.max(...h.dataset.map(a=>a.series.length));return l>o?o:l<0||t.value.style.chart.zoom.startIndex!==null&&l<t.value.style.chart.zoom.startIndex?t.value.style.chart.zoom.startIndex!==null?t.value.style.chart.zoom.startIndex+1:1:l}const d=e.computed(()=>{let l;return t.value.orientation==="vertical"?l=s.value.width/(c.value.end-c.value.start):l=s.value.height/(c.value.end-c.value.start),l<=0?0:l}),I=e.computed(()=>u.sumSeries(z.value.filter(l=>!p.value.includes(l.id))).slice(c.value.start,c.value.end)),qe=e.computed(()=>u.sumSeries(z.value.filter(l=>!p.value.includes(l.id)).map(l=>({...l,series:l.series.map((o,a)=>l.signedSeries[a]===-1&&o>=0?-o:o)}))).slice(c.value.start,c.value.end)),q=e.computed(()=>{const l=z.value.filter(o=>!p.value.includes(o.id));return{positive:u.sumSeries(l.map(o=>({...o,series:o.series.slice(c.value.start,c.value.end).map(a=>a>=0?a:0)}))),negative:u.sumSeries(l.map(o=>({...o,series:o.series.slice(c.value.start,c.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(...q.value.positive),o=Math.min(...q.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(o)?0:o,r=!t.value.style.chart.bars.distributed&&(t.value.style.chart.grid.scale.scaleMax!==null||t.value.style.chart.grid.scale.scaleMin!==null)?u.calculateNiceScaleWithExactExtremes(a>0?0:a,l<0?0:l,t.value.style.chart.grid.scale.ticks):u.calculateNiceScale(a>0?0:a,l<0?0:l,t.value.style.chart.grid.scale.ticks);return r.ticks.map(i=>({zero:s.value.bottom-s.value.height*(Math.abs(r.min)/(r.max+Math.abs(r.min))),y:s.value.bottom-s.value.height*((i+Math.abs(r.min))/(r.max+Math.abs(r.min))),x:s.value.left-8,horizontal_zero:s.value.left+s.value.width*(Math.abs(r.min)/(r.max+Math.abs(r.min))),horizontal_x:s.value.left+s.value.width*((i+Math.abs(r.min))/(r.max+Math.abs(r.min))),horizontal_y:s.value.bottom-8,value:i}))}),L=e.computed(()=>{const l=[];for(let o=0;o<S.value;o+=1)l.push({text:t.value.style.chart.grid.x.timeLabels.values[o]||String(o),absoluteIndex:o});return l.slice(c.value.start,c.value.end)}),g=e.computed(()=>{if(!T.value)return[];let l=Array(S.value).fill(0),o=Array(S.value).fill(0),a=Array(S.value).fill(0),r=Array(S.value).fill(0);const i=Math.max(...q.value.positive)||0,n=Math.min(...q.value.negative),b=[-1/0,1/0,NaN,void 0,null].includes(n)?0:n,E=!t.value.style.chart.bars.distributed&&(t.value.style.chart.grid.scale.scaleMax!==null||t.value.style.chart.grid.scale.scaleMin!==null)?u.calculateNiceScaleWithExactExtremes(t.value.style.chart.grid.scale.scaleMin!==null?t.value.style.chart.grid.scale.scaleMin:b>0?0:b,t.value.style.chart.grid.scale.scaleMax!==null?t.value.style.chart.grid.scale.scaleMax:i<0?0:i,t.value.style.chart.grid.scale.ticks):u.calculateNiceScale(t.value.style.chart.grid.scale.scaleMin!==null?t.value.style.chart.grid.scale.scaleMin:b>0?0:b,t.value.style.chart.grid.scale.scaleMax!==null?t.value.style.chart.grid.scale.scaleMax:i<0?0:i,t.value.style.chart.grid.scale.ticks),{min:N,max:R}=E,$=R+(N>=0?0:Math.abs(N))||1,f=s.value.height,X=s.value.width,Ne=w.value[0]?w.value[0].zero:s.value.bottom,$e=w.value[0]?w.value[0].horizontal_zero:s.value.left;return z.value.filter(O=>!p.value.includes(O.id)).map(O=>{const B=O.series.slice(c.value.start,c.value.end),Ge=O.signedSeries.slice(c.value.start,c.value.end),Je=B.map((v,m)=>s.value.left+d.value*m+d.value*t.value.style.chart.bars.gapRatio/4),Ze=B.map((v,m)=>s.value.top+d.value*m+d.value*t.value.style.chart.bars.gapRatio/4),Ke=B.map((v,m)=>{const k=t.value.style.chart.bars.distributed?(v||0)/I.value[m]:(v||0)/$;let V,x;return v>0?(x=f*k,V=Ne-x-l[m],l[m]+=x):(x=f*k,V=Ne+a[m],a[m]+=Math.abs(x)),V}),Qe=B.map((v,m)=>{const k=t.value.style.chart.bars.distributed?(v||0)/I.value[m]:(v||0)/$;let V,x;return v>0?(x=X*k,V=$e+o[m],o[m]+=x):(x=X*k,V=$e-Math.abs(x)-r[m],r[m]+=Math.abs(x)),V}),je=B.map((v,m)=>{const k=t.value.style.chart.bars.distributed?(v||0)/I.value[m]:(v||0)/$;return v>0?f*k:f*Math.abs(k)}),et=B.map((v,m)=>{const k=t.value.style.chart.bars.distributed?(v||0)/I.value[m]:(v||0)/$;return v>0?X*k:X*Math.abs(k)}),tt=B.map(v=>Math.abs(v)).reduce((v,m)=>v+m,0);return{...O,proportions:B.map((v,m)=>t.value.style.chart.bars.distributed?(v||0)/I.value[m]:(v||0)/tt),series:B,signedSeries:Ge,x:Je,y:Ke,height:je,horizontal_width:et,horizontal_y:Ze,horizontal_x:Qe}})}),pe=e.computed(()=>qe.value.map((l,o)=>({value:l,sign:l>=0?1:-1})));function U(l,o,a,r,i){const n=i===-1&&l>=0?-l:l;return u.applyDataLabel(t.value.style.chart.bars.dataLabels.formatter,n,u.dataLabel({p:t.value.style.chart.bars.dataLabels.prefix,v:n,s:t.value.style.chart.bars.dataLabels.suffix,r:t.value.style.chart.bars.dataLabels.rounding}),{datapoint:o,seriesIndex:a,datapointIndex:r})}function fe(l,o,a,r){return u.applyDataLabel(t.value.style.chart.bars.dataLabels.formatter,l,u.dataLabel({v:isNaN(l)?0:l,s:"%",r:t.value.style.chart.bars.dataLabels.rounding}),{datapoint:o,seriesIndex:a,datapointIndex:r})}function ke(l){const o=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}));J("selectDatapoint",{datapoint:o,period:L.value[l]})}function xe(l){F.value=l,D.value=!0;const o=t.value.style.chart.tooltip.customFormat,a=JSON.parse(JSON.stringify(g.value)).map(i=>({name:i.name,absoluteIndex:i.absoluteIndex,value:i.series[l]===0?0:(i.signedSeries[l]===-1&&i.series[l]>=0?-i.series[l]:i.series[l])||null,proportion:i.proportions[l]||null,color:i.color,id:i.id})),r=a.map(i=>Math.abs(i.value)).reduce((i,n)=>i+n,0);if(u.isFunction(o)&&u.functionReturnsString(()=>o({seriesIndex:l,datapoint:a,series:g.value,config:t.value})))Z.value=o({seriesIndex:l,datapoint:a,series:g.value,config:t.value});else{const{showValue:i,showPercentage:n,borderColor:b,roundingValue:E,roundingPercentage:N}=t.value.style.chart.tooltip;let R="";L.value[l]&&L.value[l].text&&t.value.style.chart.tooltip.showTimeLabel&&(R+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${b};padding-bottom:6px;margin-bottom:3px;">${L.value[l].text}</div>`);const $=[i&&n?"(":"",i&&n?")":""];a.reverse().forEach(f=>{R+=`
2
2
  <div style="display:flex;flex-direction:row;align-items:center;gap:4px">
3
3
  <svg viewBox="0 0 60 60" height="14" width="14"><rect rx="5" x="0" y="0" height="60" width="60" stroke="none" fill="${t.value.style.chart.bars.gradient.show?`url(#gradient_${f.id})`:f.color}"/>${Ie.pattern?`<rect rx="5" x="0" y="0" height="60" width="60" stroke="none" fill="url(#pattern_${C.value}_${f.absoluteIndex})"/>`:""}</svg>
4
4
  ${f.name}${i||n?":":""} ${i?u.dataLabel({p:t.value.style.chart.bars.dataLabels.prefix,v:f.value,s:t.value.style.chart.bars.dataLabels.suffix,r:E}):""} ${$[0]}${n?u.dataLabel({v:isNaN(f.value/r)?0:Math.abs(f.value)/r*100,s:"%",r:N}):""}${$[1]}