vue-data-ui 2.4.60 → 2.4.61

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 (155) hide show
  1. package/dist/{Arrow-BoAS4IQq.cjs → Arrow-C4JCfYUu.cjs} +1 -1
  2. package/dist/{Arrow-BLYi22nR.js → Arrow-NyYxjtAV.js} +1 -1
  3. package/dist/{BaseIcon-BHIQREMO.cjs → BaseIcon-B1zKYJGk.cjs} +1 -1
  4. package/dist/{BaseIcon-EWtqg17H.js → BaseIcon-a81b_5b0.js} +1 -1
  5. package/dist/{DataTable-Dtq94CxH.cjs → DataTable-BVwnM0tQ.cjs} +1 -1
  6. package/dist/{DataTable-DO8KGCcE.js → DataTable-CcW8SHH2.js} +2 -2
  7. package/dist/{Legend-DGWOCyLt.js → Legend-Cq1rcFzv.js} +1 -1
  8. package/dist/{Legend-CMyzYtIb.cjs → Legend-fpW6iFgA.cjs} +1 -1
  9. package/dist/{PackageVersion-B_1OHk5A.cjs → PackageVersion-B7-YDa6h.cjs} +1 -1
  10. package/dist/{PackageVersion-BSLNI6kk.js → PackageVersion-LRbiiLp0.js} +1 -1
  11. package/dist/{PenAndPaper-CxMtGtJt.js → PenAndPaper-BCjJ-td_.js} +3 -3
  12. package/dist/{PenAndPaper-DhXsAnuf.cjs → PenAndPaper-JkRknDt7.cjs} +1 -1
  13. package/dist/{Shape-y66NSXKp.cjs → Shape-QZcWXoYb.cjs} +1 -1
  14. package/dist/{Shape-DnqZey62.js → Shape-hFNcMth4.js} +1 -1
  15. package/dist/{Slicer-D9bKLcPd.js → Slicer-DGn72_0M.js} +2 -2
  16. package/dist/{Slicer-CkI4c7ft.cjs → Slicer-DMYxCNLb.cjs} +1 -1
  17. package/dist/{Title-DjAOcuWO.cjs → Title-CQVviDIQ.cjs} +1 -1
  18. package/dist/{Title-CSqO5Y62.js → Title-Zm0LCGPS.js} +1 -1
  19. package/dist/{Tooltip-D_6iYZSH.js → Tooltip-CoahRzyE.js} +1 -1
  20. package/dist/{Tooltip-AHTiRuWB.cjs → Tooltip-DZ1uTqBW.cjs} +1 -1
  21. package/dist/{index-D7dTQAhm.js → index-CG_OTzik.js} +3 -1
  22. package/dist/index-V6tl1xgQ.cjs +9 -0
  23. package/dist/style.css +1 -1
  24. package/dist/types/vue-data-ui.d.cts +2 -0
  25. package/dist/types/vue-data-ui.d.ts +2 -0
  26. package/dist/{useNestedProp-BxCE3J3Z.cjs → useNestedProp--db71Vbu.cjs} +1 -1
  27. package/dist/{useNestedProp-Dqsj7eUX.js → useNestedProp-BZZvruew.js} +1 -1
  28. package/dist/{usePrinter-B_Ihuvge.js → usePrinter-CxBwzZkb.js} +1 -1
  29. package/dist/{usePrinter-sTw1FdN_.cjs → usePrinter-D0LQ1CyY.cjs} +1 -1
  30. package/dist/{vue-data-ui-CcmpjOfT.js → vue-data-ui-C4A5zIHI.js} +60 -60
  31. package/dist/{vue-data-ui-BttN99Pm.cjs → vue-data-ui-CUyuYhwT.cjs} +1 -1
  32. package/dist/vue-data-ui.cjs +1 -1
  33. package/dist/vue-data-ui.js +1 -1
  34. package/dist/{vue-ui-3d-bar-TVrDBG5I.js → vue-ui-3d-bar-DAh8koX4.js} +9 -9
  35. package/dist/{vue-ui-3d-bar-8ewYobNj.cjs → vue-ui-3d-bar-DKiYqw0u.cjs} +1 -1
  36. package/dist/{vue-ui-accordion-BZH6cz4t.cjs → vue-ui-accordion-B7VpkrPR.cjs} +1 -1
  37. package/dist/{vue-ui-accordion-lCiFhb8k.js → vue-ui-accordion-C2IbGLRv.js} +3 -3
  38. package/dist/{vue-ui-age-pyramid-BqL8zDjt.cjs → vue-ui-age-pyramid-BmqvzA-d.cjs} +1 -1
  39. package/dist/{vue-ui-age-pyramid-rHtMf5-R.js → vue-ui-age-pyramid-me4GgQNb.js} +10 -10
  40. package/dist/{vue-ui-annotator-fZIPfk7y.cjs → vue-ui-annotator-Bg9Juc1l.cjs} +1 -1
  41. package/dist/{vue-ui-annotator-DHgSReIY.js → vue-ui-annotator-XOzj9Bpg.js} +1 -1
  42. package/dist/{vue-ui-bullet-48af9PqJ.cjs → vue-ui-bullet-BsHk8Y0E.cjs} +1 -1
  43. package/dist/{vue-ui-bullet-BwhlvcvA.js → vue-ui-bullet-D1ElgM95.js} +8 -8
  44. package/dist/{vue-ui-candlestick-Ce3tBGpX.cjs → vue-ui-candlestick-Ba4yv9ZM.cjs} +1 -1
  45. package/dist/{vue-ui-candlestick-dMIrnPD6.js → vue-ui-candlestick-DLhwvS6l.js} +11 -11
  46. package/dist/{vue-ui-carousel-table-ZhjRbt5-.cjs → vue-ui-carousel-table-DSoV6GBf.cjs} +1 -1
  47. package/dist/{vue-ui-carousel-table-EcwgqGoI.js → vue-ui-carousel-table-cEaGm232.js} +4 -4
  48. package/dist/{vue-ui-chestnut-VbrVVUon.cjs → vue-ui-chestnut-D6D5Zr4r.cjs} +1 -1
  49. package/dist/{vue-ui-chestnut-vnOyc43k.js → vue-ui-chestnut-DCURZY6w.js} +8 -8
  50. package/dist/{vue-ui-cursor-nMbvzf_R.js → vue-ui-cursor-B9eASI3M.js} +2 -2
  51. package/dist/{vue-ui-cursor-BdXcdH2e.cjs → vue-ui-cursor-CqDpaKei.cjs} +1 -1
  52. package/dist/{vue-ui-dashboard-BtaQn50h.js → vue-ui-dashboard-B2rw-G-R.js} +2 -2
  53. package/dist/{vue-ui-dashboard-CboN2WC8.cjs → vue-ui-dashboard-Q-ILTgqP.cjs} +1 -1
  54. package/dist/{vue-ui-digits-CVfceh4-.js → vue-ui-digits-BAG_spWA.js} +2 -2
  55. package/dist/{vue-ui-digits-CUvrlpPz.cjs → vue-ui-digits-CagcmtFs.cjs} +1 -1
  56. package/dist/{vue-ui-donut-BckYXDZJ.cjs → vue-ui-donut-5jgX6ZLE.cjs} +1 -1
  57. package/dist/{vue-ui-donut-CgYNthls.js → vue-ui-donut-BJl5Isgy.js} +11 -11
  58. package/dist/{vue-ui-donut-evolution-BhlBp6R-.cjs → vue-ui-donut-evolution-CnqdY8LW.cjs} +1 -1
  59. package/dist/{vue-ui-donut-evolution-Bose25D6.js → vue-ui-donut-evolution-DMhkt7mf.js} +11 -11
  60. package/dist/{vue-ui-dumbbell-C2iT17s8.cjs → vue-ui-dumbbell-Be0B-LgS.cjs} +1 -1
  61. package/dist/{vue-ui-dumbbell-CzSlukSu.js → vue-ui-dumbbell-Dg3mYtw3.js} +10 -10
  62. package/dist/{vue-ui-flow-DDlFrtkk.cjs → vue-ui-flow-BKyhoEjt.cjs} +1 -1
  63. package/dist/{vue-ui-flow-DoDWK84L.js → vue-ui-flow-Cq8-bQr_.js} +9 -9
  64. package/dist/{vue-ui-funnel-BfJoFIfh.cjs → vue-ui-funnel-DFk4PKvj.cjs} +1 -1
  65. package/dist/{vue-ui-funnel-CM_ixf98.js → vue-ui-funnel-DHFbd45-.js} +9 -9
  66. package/dist/{vue-ui-galaxy-CP71UAF5.cjs → vue-ui-galaxy-Y1gaT5UE.cjs} +1 -1
  67. package/dist/{vue-ui-galaxy-DlwjTJCx.js → vue-ui-galaxy-rYHDLCt9.js} +11 -11
  68. package/dist/{vue-ui-gauge-ByfGCK6z.js → vue-ui-gauge-Ba14Ybvo.js} +7 -7
  69. package/dist/{vue-ui-gauge-LqhfOqH-.cjs → vue-ui-gauge-Bmuasq4t.cjs} +1 -1
  70. package/dist/{vue-ui-gizmo-DFnOaVHf.cjs → vue-ui-gizmo-CF11m0cq.cjs} +1 -1
  71. package/dist/{vue-ui-gizmo-D8Rq5vzL.js → vue-ui-gizmo-CuMablqV.js} +3 -3
  72. package/dist/{vue-ui-heatmap-BLjVXXW4.js → vue-ui-heatmap-B0Ry1OTW.js} +10 -10
  73. package/dist/{vue-ui-heatmap-A8qDlc58.cjs → vue-ui-heatmap-BekQJ_O8.cjs} +1 -1
  74. package/dist/{vue-ui-history-plot-Bxi5QRP8.cjs → vue-ui-history-plot-BTVojhgQ.cjs} +1 -1
  75. package/dist/{vue-ui-history-plot-DXoNlRFZ.js → vue-ui-history-plot-DkJdYX5N.js} +11 -11
  76. package/dist/{vue-ui-kpi-5cGZ0OBJ.cjs → vue-ui-kpi-BLreWPBQ.cjs} +1 -1
  77. package/dist/{vue-ui-kpi-Bbot_WSI.js → vue-ui-kpi-BQwuGH5_.js} +3 -3
  78. package/dist/{vue-ui-mini-loader-DWX9tRhG.cjs → vue-ui-mini-loader-C-61eqcR.cjs} +1 -1
  79. package/dist/{vue-ui-mini-loader-DOE9WO73.js → vue-ui-mini-loader-DOGNwMhX.js} +2 -2
  80. package/dist/{vue-ui-molecule-CxeFzXS5.cjs → vue-ui-molecule-BRM8s9SD.cjs} +1 -1
  81. package/dist/{vue-ui-molecule-0TReXB2j.js → vue-ui-molecule-DHBRDC8t.js} +11 -11
  82. package/dist/{vue-ui-mood-radar-1jLzXLXZ.cjs → vue-ui-mood-radar-MXQgj0yp.cjs} +1 -1
  83. package/dist/{vue-ui-mood-radar-BMFn685U.js → vue-ui-mood-radar-dfN44AZx.js} +11 -11
  84. package/dist/{vue-ui-nested-donuts-4FVj04vI.cjs → vue-ui-nested-donuts-BAtJgYOg.cjs} +1 -1
  85. package/dist/{vue-ui-nested-donuts-B9rWg9V8.js → vue-ui-nested-donuts-C-nDnw6v.js} +11 -11
  86. package/dist/{vue-ui-onion-CnIF_tv7.js → vue-ui-onion-D8OvxeHr.js} +11 -11
  87. package/dist/{vue-ui-onion-Br97OxbL.cjs → vue-ui-onion-EO8dPufp.cjs} +1 -1
  88. package/dist/{vue-ui-parallel-coordinate-plot-D9iHCwiA.js → vue-ui-parallel-coordinate-plot-3BNXcNsy.js} +12 -12
  89. package/dist/{vue-ui-parallel-coordinate-plot-Bi_h0H7e.cjs → vue-ui-parallel-coordinate-plot-Cxl3bY0H.cjs} +1 -1
  90. package/dist/{vue-ui-quadrant-4wjbqumK.js → vue-ui-quadrant-BOReLkSm.js} +12 -12
  91. package/dist/{vue-ui-quadrant-DHDToQ9a.cjs → vue-ui-quadrant-DiU08Q5X.cjs} +1 -1
  92. package/dist/{vue-ui-quick-chart-CJKM6r9X.cjs → vue-ui-quick-chart-BRERkFkI.cjs} +1 -1
  93. package/dist/{vue-ui-quick-chart-s6FHOZf8.js → vue-ui-quick-chart-D4UZCrzj.js} +9 -9
  94. package/dist/{vue-ui-radar-DpT9w1N-.js → vue-ui-radar-C2ePOuIW.js} +12 -12
  95. package/dist/{vue-ui-radar-DBR2qBM5.cjs → vue-ui-radar-DduWN5dL.cjs} +1 -1
  96. package/dist/{vue-ui-rating-D31vSe7a.js → vue-ui-rating-BYfD1N57.js} +2 -2
  97. package/dist/{vue-ui-rating-D1Mbw1G8.cjs → vue-ui-rating-BtzMW1EB.cjs} +1 -1
  98. package/dist/{vue-ui-relation-circle-DfP6BpVn.js → vue-ui-relation-circle-BKjs6DR1.js} +7 -7
  99. package/dist/{vue-ui-relation-circle-BNJbqK_A.cjs → vue-ui-relation-circle-DhLvWetz.cjs} +1 -1
  100. package/dist/{vue-ui-rings-ChcGuwL9.js → vue-ui-rings-BNwvxf2K.js} +11 -11
  101. package/dist/{vue-ui-rings-CjB8a3kO.cjs → vue-ui-rings-CzZyxYeS.cjs} +1 -1
  102. package/dist/{vue-ui-scatter-jk0N3EwD.cjs → vue-ui-scatter-D3Cl-rFL.cjs} +1 -1
  103. package/dist/{vue-ui-scatter-wUZ2CBpp.js → vue-ui-scatter-thYwTZhC.js} +12 -12
  104. package/dist/{vue-ui-screenshot-Blg3Suvg.js → vue-ui-screenshot-9y8wYnc3.js} +1 -1
  105. package/dist/{vue-ui-screenshot-DAFpjSWg.cjs → vue-ui-screenshot-DFHP0ThC.cjs} +1 -1
  106. package/dist/{vue-ui-skeleton-BObG0eVD.js → vue-ui-skeleton-B6hyEcxy.js} +3 -3
  107. package/dist/{vue-ui-skeleton-m4l9jfqA.cjs → vue-ui-skeleton-D56sSIBO.cjs} +1 -1
  108. package/dist/{vue-ui-smiley-DuQ3M02e.js → vue-ui-smiley-B-4Fqh2J.js} +2 -2
  109. package/dist/{vue-ui-smiley-rh3J3TRY.cjs → vue-ui-smiley-BsWAahKv.cjs} +1 -1
  110. package/dist/{vue-ui-spark-trend-SMpnQ3VV.js → vue-ui-spark-trend-DJcpI-ZY.js} +5 -5
  111. package/dist/{vue-ui-spark-trend-DlNNTu2c.cjs → vue-ui-spark-trend-MAq0VlUq.cjs} +1 -1
  112. package/dist/{vue-ui-sparkbar-chnu8aw9.cjs → vue-ui-sparkbar-DMlzP8ZM.cjs} +1 -1
  113. package/dist/{vue-ui-sparkbar-BB6fvRXK.js → vue-ui-sparkbar-DZqE8qN3.js} +4 -4
  114. package/dist/{vue-ui-sparkgauge-Bk_78-YB.js → vue-ui-sparkgauge-B-kRhMYK.js} +4 -4
  115. package/dist/{vue-ui-sparkgauge-FONvy7z9.cjs → vue-ui-sparkgauge-CvOP9U7-.cjs} +1 -1
  116. package/dist/{vue-ui-sparkhistogram--uyRru2f.cjs → vue-ui-sparkhistogram-DjUvwlYU.cjs} +1 -1
  117. package/dist/{vue-ui-sparkhistogram-CIsN7kQ2.js → vue-ui-sparkhistogram-EOeboT7_.js} +5 -5
  118. package/dist/vue-ui-sparkline-BS_ZXXei.cjs +1 -0
  119. package/dist/vue-ui-sparkline-BgB5km-f.js +420 -0
  120. package/dist/{vue-ui-sparkstackbar-DDMsCq0l.js → vue-ui-sparkstackbar-DGihKtGC.js} +5 -5
  121. package/dist/{vue-ui-sparkstackbar-1RvV2xwt.cjs → vue-ui-sparkstackbar-DSTz24kS.cjs} +1 -1
  122. package/dist/{vue-ui-stackbar-BSo9t-88.js → vue-ui-stackbar-DrJ3au6w.js} +12 -12
  123. package/dist/{vue-ui-stackbar-CQgtC1I4.cjs → vue-ui-stackbar-m-5t4Otk.cjs} +1 -1
  124. package/dist/{vue-ui-strip-plot-C99LsMeZ.js → vue-ui-strip-plot-4uC5MD3e.js} +11 -11
  125. package/dist/{vue-ui-strip-plot-BOSoKxsk.cjs → vue-ui-strip-plot-Yy2DIoMg.cjs} +1 -1
  126. package/dist/{vue-ui-table-M-6G46br.cjs → vue-ui-table-DCe_BTaV.cjs} +1 -1
  127. package/dist/{vue-ui-table-3M-aoEc7.js → vue-ui-table-DN498EB2.js} +1 -1
  128. package/dist/{vue-ui-table-heatmap-BuYlqsq9.js → vue-ui-table-heatmap-CMVmFTPi.js} +4 -4
  129. package/dist/{vue-ui-table-heatmap-CoozQ9bU.cjs → vue-ui-table-heatmap-PvopeKyW.cjs} +1 -1
  130. package/dist/{vue-ui-table-sparkline-u0a2YCwp.cjs → vue-ui-table-sparkline-BtUV0t4I.cjs} +1 -1
  131. package/dist/{vue-ui-table-sparkline-Dm5kErGp.js → vue-ui-table-sparkline-DpXxi6al.js} +5 -5
  132. package/dist/{vue-ui-thermometer-DAz_NjaN.cjs → vue-ui-thermometer-B9YyPrvt.cjs} +1 -1
  133. package/dist/{vue-ui-thermometer-DrY5FsCD.js → vue-ui-thermometer-CB38vNj3.js} +7 -7
  134. package/dist/{vue-ui-timer-meFVXDUZ.js → vue-ui-timer-BmFFjMb9.js} +5 -5
  135. package/dist/{vue-ui-timer-dCCTsApx.cjs → vue-ui-timer-D6GsFvTy.cjs} +1 -1
  136. package/dist/{vue-ui-tiremarks-CRKQklZh.cjs → vue-ui-tiremarks--CrAFWU2.cjs} +1 -1
  137. package/dist/{vue-ui-tiremarks-PaZ-lr2D.js → vue-ui-tiremarks-CJ2y_2T1.js} +7 -7
  138. package/dist/{vue-ui-treemap-Bce1C9jk.cjs → vue-ui-treemap-HpoEGWKV.cjs} +1 -1
  139. package/dist/{vue-ui-treemap-RjHcVtc6.js → vue-ui-treemap-Z3t2YGoE.js} +11 -11
  140. package/dist/{vue-ui-vertical-bar-C8rC-QBl.js → vue-ui-vertical-bar-B_x2w4L8.js} +11 -11
  141. package/dist/{vue-ui-vertical-bar-e7zR_v0M.cjs → vue-ui-vertical-bar-LdxXCg3W.cjs} +1 -1
  142. package/dist/{vue-ui-waffle-BZLPoVht.cjs → vue-ui-waffle-BDkOv8M4.cjs} +1 -1
  143. package/dist/{vue-ui-waffle-BT8Yn0cl.js → vue-ui-waffle-BKrNIOiM.js} +11 -11
  144. package/dist/{vue-ui-wheel-Bq75N1i7.js → vue-ui-wheel-BCs1b_hk.js} +7 -7
  145. package/dist/{vue-ui-wheel-CT6r7EQR.cjs → vue-ui-wheel-DgzJQSl_.cjs} +1 -1
  146. package/dist/{vue-ui-word-cloud-PcOI8TCE.cjs → vue-ui-word-cloud-BHm3q6eZ.cjs} +1 -1
  147. package/dist/{vue-ui-word-cloud-BGh6DY8P.js → vue-ui-word-cloud-CO47t4OJ.js} +10 -10
  148. package/dist/{vue-ui-xy-DuCsguVf.js → vue-ui-xy-RDecyidx.js} +14 -14
  149. package/dist/{vue-ui-xy-BmNqzUPR.cjs → vue-ui-xy-c7YLqedj.cjs} +1 -1
  150. package/dist/{vue-ui-xy-canvas-BnJBE19B.cjs → vue-ui-xy-canvas-CY1JxJvm.cjs} +1 -1
  151. package/dist/{vue-ui-xy-canvas-6qf3rgfa.js → vue-ui-xy-canvas-Q6mKl1B-.js} +11 -11
  152. package/package.json +1 -1
  153. package/dist/index-CgZGelSi.cjs +0 -9
  154. package/dist/vue-ui-sparkline-CFvUW--O.js +0 -419
  155. package/dist/vue-ui-sparkline-i6LHjMJR.cjs +0 -1
@@ -0,0 +1,420 @@
1
+ import { computed as v, ref as m, watch as U, onMounted as re, openBlock as n, createElementBlock as r, normalizeStyle as C, renderSlot as M, normalizeProps as ie, guardReactiveProps as de, createElementVNode as f, toDisplayString as X, createCommentVNode as c, unref as h, createVNode as ve, Fragment as A, renderList as D, createBlock as ce } from "vue";
2
+ import { u as he, c as ye, t as fe, C as Z, _ as T, o as pe, e as q, g as ge, w as I, $ as me, a0 as ke, X as be, s as P, R as H, i as Y, f as J } from "./index-CG_OTzik.js";
3
+ import { u as K } from "./useNestedProp-BZZvruew.js";
4
+ import _e from "./vue-ui-skeleton-B6hyEcxy.js";
5
+ import { t as xe, u as we } from "./useResponsive-CoxXLe23.js";
6
+ import { _ as $e } from "./PackageVersion-LRbiiLp0.js";
7
+ import { _ as Le } from "./_plugin-vue_export-helper-CHgC5LLL.js";
8
+ const Ne = ["id"], Ce = ["xmlns", "viewBox"], Me = ["width", "height"], Ie = ["id"], Pe = ["stop-color"], Ve = ["stop-color"], ze = ["id"], Se = ["stop-color"], We = ["stop-color"], Ae = ["id"], De = ["stop-color"], Te = ["stop-color"], Oe = { key: 1 }, Be = ["d", "fill"], Ee = ["d", "fill"], Fe = ["d", "stroke", "stroke-width"], Ge = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Re = ["x", "y", "width", "height", "fill", "rx"], je = ["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"], Ze = ["x", "y", "font-size", "font-weight", "fill"], qe = ["x", "y", "height", "width", "onMouseenter", "onClick"], He = {
9
+ __name: "vue-ui-sparkline",
10
+ props: {
11
+ config: {
12
+ type: Object,
13
+ default() {
14
+ return {};
15
+ }
16
+ },
17
+ dataset: {
18
+ type: Array,
19
+ default() {
20
+ return [];
21
+ }
22
+ },
23
+ showInfo: {
24
+ type: Boolean,
25
+ default: !0
26
+ },
27
+ selectedIndex: {
28
+ type: Number,
29
+ default: void 0
30
+ },
31
+ heightRatio: {
32
+ type: Number,
33
+ default: 1
34
+ },
35
+ forcedPadding: {
36
+ type: Number,
37
+ default: 30
38
+ }
39
+ },
40
+ emits: ["hoverIndex", "selectDatapoint"],
41
+ setup(_, { emit: V }) {
42
+ const s = _, { vue_ui_sparkline: Q } = he(), $ = v(() => !!s.dataset && s.dataset.length), p = m(ye()), z = m(null), O = m(null), B = m(null), e = v({
43
+ get: () => E(),
44
+ set: (t) => t
45
+ });
46
+ function E() {
47
+ const t = K({
48
+ userConfig: s.config,
49
+ defaultConfig: Q
50
+ });
51
+ let l = {};
52
+ return t.theme ? l = {
53
+ ...K({
54
+ userConfig: fe.vue_ui_sparkline[t.theme] || s.config,
55
+ defaultConfig: t
56
+ })
57
+ } : l = t, s.config && Z(s.config, "style.scaleMin") ? l.style.scaleMin = s.config.style.scaleMin : l.style.scaleMin = null, s.config && Z(s.config, "style.scaleMax") ? l.style.scaleMax = s.config.style.scaleMax : l.style.scaleMax = null, l;
58
+ }
59
+ const L = v(() => T({
60
+ data: s.dataset,
61
+ threshold: e.value.downsample.threshold
62
+ }));
63
+ U(() => s.config, (t) => {
64
+ e.value = E(), G(), u.value.chartWidth = e.value.style.chartWidth;
65
+ }, { deep: !0 }), U(() => s.dataset, (t) => {
66
+ b.value = T({
67
+ data: s.dataset.map((l) => ({
68
+ ...l,
69
+ value: [void 0].includes(l.value) ? null : l.value
70
+ })),
71
+ threshold: e.value.downsample.threshold
72
+ });
73
+ }, { deep: !0 });
74
+ const b = m(ee());
75
+ function ee() {
76
+ return T({
77
+ data: s.dataset.map((t) => e.value.style.animation.show ? {
78
+ ...t,
79
+ value: null
80
+ } : {
81
+ ...t,
82
+ value: [void 0].includes(t.value) ? null : t.value
83
+ }),
84
+ threshold: e.value.downsample.threshold
85
+ });
86
+ }
87
+ const F = m(null);
88
+ re(() => {
89
+ if (G(), e.value.style.animation.show && s.dataset.length > 1) {
90
+ let a = function() {
91
+ l < L.value.length ? (b.value.push(L.value[l]), setTimeout(() => {
92
+ requestAnimationFrame(a);
93
+ }, t)) : b.value = L.value, l += 1;
94
+ };
95
+ b.value = [];
96
+ const t = e.value.style.animation.animationFrames / s.dataset.length;
97
+ let l = 0;
98
+ a();
99
+ }
100
+ });
101
+ function G() {
102
+ if (pe(s.dataset) ? q({
103
+ componentName: "VueUiSparkline",
104
+ type: "dataset"
105
+ }) : s.dataset.forEach((t, l) => {
106
+ ge({
107
+ datasetObject: t,
108
+ requiredAttributes: ["period", "value"]
109
+ }).forEach((a) => {
110
+ q({
111
+ componentName: "VueUiSparkline",
112
+ type: "datasetSerieAttribute",
113
+ property: a,
114
+ index: l
115
+ });
116
+ });
117
+ }), e.value.responsive) {
118
+ const t = xe(() => {
119
+ const { width: l, height: a } = we({
120
+ chart: z.value,
121
+ title: e.value.style.title.show && s.showInfo ? O.value : null,
122
+ source: B.value
123
+ });
124
+ u.value.width = l, u.value.height = a, u.value.chartWidth = e.value.style.chartWidth / 500 * l, u.value.padding = s.forcedPadding / 500 * l;
125
+ });
126
+ F.value = new ResizeObserver(t), F.value.observe(z.value.parentNode);
127
+ }
128
+ }
129
+ const u = m({
130
+ height: 80 * s.heightRatio,
131
+ width: 500,
132
+ chartWidth: e.value.style.chartWidth,
133
+ padding: s.forcedPadding
134
+ }), te = m(6), o = v(() => ({
135
+ top: 12,
136
+ left: 0,
137
+ right: u.value.width,
138
+ bottom: u.value.height - 3,
139
+ start: s.showInfo && e.value.style.dataLabel.show && e.value.style.dataLabel.position === "left" ? u.value.width - u.value.chartWidth : u.value.padding,
140
+ width: s.showInfo && e.value.style.dataLabel.show ? u.value.chartWidth : u.value.width - u.value.padding,
141
+ height: u.value.height - 12
142
+ })), S = v(() => [null, void 0].includes(e.value.style.scaleMin) ? Math.min(...b.value.map((t) => isNaN(t.value) || [void 0, null, "NaN", NaN, 1 / 0, -1 / 0].includes(t.value) ? 0 : t.value || 0)) : e.value.style.scaleMin), ae = v(() => [null, void 0].includes(e.value.style.scaleMax) ? Math.max(...b.value.map((t) => isNaN(t.value) || [void 0, null, "NaN", NaN, 1 / 0, -1 / 0].includes(t.value) ? 0 : t.value || 0)) : e.value.style.scaleMax), x = v(() => {
143
+ const t = S.value >= 0 ? 0 : S.value;
144
+ return Math.abs(t);
145
+ }), le = v(() => ae.value + x.value + te.value), N = v(() => o.value.bottom - o.value.height * W(x.value));
146
+ function W(t) {
147
+ return t / le.value;
148
+ }
149
+ const g = v(() => L.value.length - 1), i = v(() => b.value.map((t, l) => {
150
+ const a = isNaN(t.value) || [void 0, null, "NaN", NaN, 1 / 0, -1 / 0].includes(t.value) ? 0 : t.value || 0;
151
+ return {
152
+ absoluteValue: a,
153
+ period: t.period,
154
+ plotValue: a + x.value,
155
+ toMax: W(a + x.value),
156
+ x: o.value.start + l * (o.value.width / (g.value + 1) > u.padding ? u.padding : o.value.width / (g.value + 1)),
157
+ y: o.value.bottom - o.value.height * W(a + x.value),
158
+ id: `plot_${p.value}_${l}`,
159
+ color: w.value ? e.value.style.bar.color : e.value.style.area.useGradient ? I(e.value.style.line.color, 0.05 * (1 - l / g.value)) : e.value.style.line.color,
160
+ width: o.value.width / (g.value + 1) > u.padding ? u.padding : o.value.width / (g.value + 1)
161
+ };
162
+ })), ue = v(() => {
163
+ const t = { x: i.value[0].x, y: u.value.height - 6 }, l = { x: i.value[i.value.length - 1].x, y: u.value.height - 6 }, a = [];
164
+ return i.value.forEach((d) => {
165
+ a.push(`${d.x},${d.y} `);
166
+ }), [t.x, t.y, ...a, l.x, l.y].toString();
167
+ }), y = m(void 0);
168
+ function se(t, l) {
169
+ y.value = t, V("hoverIndex", { index: l });
170
+ }
171
+ function oe() {
172
+ y.value = void 0, V("hoverIndex", { index: void 0 });
173
+ }
174
+ const k = v(() => {
175
+ if ($.value) {
176
+ const t = i.value.map((a) => a.absoluteValue), l = t.reduce((a, d) => a + d, 0);
177
+ return {
178
+ latest: i.value[i.value.length - 1].absoluteValue,
179
+ sum: l,
180
+ average: l / i.value.length,
181
+ median: me(t),
182
+ trend: ke(i.value.map(({ x: a, y: d, absoluteValue: j }) => ({
183
+ x: a,
184
+ y: d,
185
+ value: j
186
+ }))).trend
187
+ };
188
+ } else
189
+ return {
190
+ latest: null,
191
+ sum: null,
192
+ average: null,
193
+ median: null,
194
+ trend: null
195
+ };
196
+ }), R = v(() => $.value ? e.value.style.dataLabel.valueType === "latest" ? k.value.latest : e.value.style.dataLabel.valueType === "sum" ? k.value.sum : e.value.style.dataLabel.valueType === "average" ? k.value.average : 0 : 0), w = v(() => e.value.type && e.value.type === "bar");
197
+ function ne(t, l) {
198
+ V("selectDatapoint", { datapoint: t, index: l });
199
+ }
200
+ return (t, l) => (n(), r("div", {
201
+ ref_key: "sparklineChart",
202
+ ref: z,
203
+ class: "vue-ui-sparkline",
204
+ id: p.value,
205
+ style: C(`width:100%;font-family:${e.value.style.fontFamily};`)
206
+ }, [
207
+ M(t.$slots, "before", ie(de({
208
+ selected: y.value,
209
+ latest: k.value.latest,
210
+ sum: k.value.sum,
211
+ average: k.value.average,
212
+ median: k.value.median,
213
+ trend: k.value.trend
214
+ })), void 0, !0),
215
+ e.value.style.title.show && _.showInfo ? (n(), r("div", {
216
+ key: 0,
217
+ ref_key: "chartTitle",
218
+ ref: O,
219
+ class: "vue-ui-sparkline-title",
220
+ style: C(`display:flex;align-items:center;width:100%;color:${e.value.style.title.color};background:${e.value.style.backgroundColor};justify-content:${e.value.style.title.textAlign === "left" ? "flex-start" : e.value.style.title.textAlign === "right" ? "flex-end" : "center"};height:${e.value.style.title.fontSize * 2}px;font-size:${e.value.style.title.fontSize}px;font-weight:${e.value.style.title.bold ? "bold" : "normal"};`)
221
+ }, [
222
+ f("span", {
223
+ style: C(`padding:${e.value.style.title.textAlign === "left" ? "0 0 0 12px" : e.value.style.title.textAlign === "right" ? "0 12px 0 0" : "0"}`)
224
+ }, X(y.value ? y.value.period : e.value.style.title.text), 5)
225
+ ], 4)) : c("", !0),
226
+ $.value ? (n(), r("svg", {
227
+ key: 1,
228
+ xmlns: h(be),
229
+ viewBox: `0 0 ${u.value.width} ${u.value.height}`,
230
+ style: C(`background:${e.value.style.backgroundColor};overflow:hidden`)
231
+ }, [
232
+ ve($e),
233
+ t.$slots["chart-background"] ? (n(), r("foreignObject", {
234
+ key: 0,
235
+ x: 0,
236
+ y: 0,
237
+ width: u.value.width <= 0 ? 10 : u.value.width,
238
+ height: u.value.height <= 0 ? 10 : u.value.height,
239
+ style: {
240
+ pointerEvents: "none"
241
+ }
242
+ }, [
243
+ M(t.$slots, "chart-background", {}, void 0, !0)
244
+ ], 8, Me)) : c("", !0),
245
+ f("defs", null, [
246
+ f("linearGradient", {
247
+ x1: "0%",
248
+ y1: "0%",
249
+ x2: "100%",
250
+ y2: "0%",
251
+ id: `sparkline_gradient_${p.value}`
252
+ }, [
253
+ f("stop", {
254
+ offset: "0%",
255
+ "stop-color": h(P)(h(I)(e.value.style.area.color, 0.05), e.value.style.area.opacity)
256
+ }, null, 8, Pe),
257
+ f("stop", {
258
+ offset: "100%",
259
+ "stop-color": h(P)(e.value.style.area.color, e.value.style.area.opacity)
260
+ }, null, 8, Ve)
261
+ ], 8, Ie),
262
+ f("linearGradient", {
263
+ x2: "0%",
264
+ y2: "100%",
265
+ id: `sparkline_bar_gradient_pos_${p.value}`
266
+ }, [
267
+ f("stop", {
268
+ offset: "0%",
269
+ "stop-color": e.value.style.bar.color
270
+ }, null, 8, Se),
271
+ f("stop", {
272
+ offset: "100%",
273
+ "stop-color": h(I)(e.value.style.bar.color, 0.05)
274
+ }, null, 8, We)
275
+ ], 8, ze),
276
+ f("linearGradient", {
277
+ x2: "0%",
278
+ y2: "100%",
279
+ id: `sparkline_bar_gradient_neg_${p.value}`
280
+ }, [
281
+ f("stop", {
282
+ offset: "0%",
283
+ "stop-color": h(I)(e.value.style.bar.color, 0.05)
284
+ }, null, 8, De),
285
+ f("stop", {
286
+ offset: "100%",
287
+ "stop-color": e.value.style.bar.color
288
+ }, null, 8, Te)
289
+ ], 8, Ae)
290
+ ]),
291
+ e.value.style.area.show && !w.value && i.value[0] ? (n(), r("g", Oe, [
292
+ e.value.style.line.smooth ? (n(), r("path", {
293
+ key: 0,
294
+ d: `M ${i.value[0].x},${o.value.bottom} ${h(H)(i.value)} L ${i.value.at(-1).x},${o.value.bottom} Z`,
295
+ fill: e.value.style.area.useGradient ? `url(#sparkline_gradient_${p.value})` : h(P)(e.value.style.area.color, e.value.style.area.opacity)
296
+ }, null, 8, Be)) : (n(), r("path", {
297
+ key: 1,
298
+ d: `M${ue.value}Z`,
299
+ fill: e.value.style.area.useGradient ? `url(#sparkline_gradient_${p.value})` : h(P)(e.value.style.area.color, e.value.style.area.opacity)
300
+ }, null, 8, Ee))
301
+ ])) : c("", !0),
302
+ e.value.style.line.smooth && !w.value ? (n(), r("path", {
303
+ key: 2,
304
+ d: `M ${h(H)(i.value)}`,
305
+ stroke: e.value.style.line.color,
306
+ fill: "none",
307
+ "stroke-width": e.value.style.line.strokeWidth,
308
+ "stroke-linecap": "round"
309
+ }, null, 8, Fe)) : c("", !0),
310
+ (n(!0), r(A, null, D(i.value, (a, d) => (n(), r("g", null, [
311
+ d < i.value.length - 1 && !e.value.style.line.smooth && !w.value ? (n(), r("line", {
312
+ key: 0,
313
+ x1: a.x,
314
+ x2: i.value[d + 1].x,
315
+ y1: a.y,
316
+ y2: i.value[d + 1].y,
317
+ stroke: a.color,
318
+ "stroke-width": e.value.style.line.strokeWidth,
319
+ "stroke-linecap": "round",
320
+ "stroke-linejoin": "round",
321
+ "shape-rendering": "geometricPrecision"
322
+ }, null, 8, Ge)) : c("", !0),
323
+ w.value ? (n(), r("rect", {
324
+ key: 1,
325
+ x: a.x - a.width / 2,
326
+ y: a.absoluteValue > 0 ? a.y : N.value,
327
+ width: a.width,
328
+ height: Math.abs(a.y - N.value),
329
+ fill: a.absoluteValue > 0 ? `url(#sparkline_bar_gradient_pos_${p.value})` : `url(#sparkline_bar_gradient_neg_${p.value})`,
330
+ rx: e.value.style.bar.borderRadius
331
+ }, null, 8, Re)) : c("", !0),
332
+ e.value.style.verticalIndicator.show && (y.value && a.id === y.value.id || _.selectedIndex === d) ? (n(), r("line", {
333
+ key: 2,
334
+ x1: a.x,
335
+ x2: a.x,
336
+ y1: o.value.top - 6,
337
+ y2: o.value.bottom,
338
+ stroke: e.value.style.verticalIndicator.color || a.color,
339
+ "stroke-width": e.value.style.verticalIndicator.strokeWidth,
340
+ "stroke-linecap": "round",
341
+ "stroke-dasharray": e.value.style.verticalIndicator.strokeDasharray || 0
342
+ }, null, 8, je)) : c("", !0)
343
+ ]))), 256)),
344
+ S.value < 0 ? (n(), r("line", {
345
+ key: 3,
346
+ x1: o.value.start,
347
+ x2: o.value.start + o.value.width - 16,
348
+ y1: N.value,
349
+ y2: N.value,
350
+ stroke: e.value.style.zeroLine.color,
351
+ "stroke-dasharray": e.value.style.zeroLine.strokeWidth * 2,
352
+ "stroke-width": e.value.style.zeroLine.strokeWidth,
353
+ "stroke-linecap": "round"
354
+ }, null, 8, Ue)) : c("", !0),
355
+ e.value.style.plot.show ? (n(!0), r(A, { key: 4 }, D(i.value, (a, d) => (n(), r("g", null, [
356
+ y.value && a.id === y.value.id || _.selectedIndex === d ? (n(), r("circle", {
357
+ key: 0,
358
+ cx: a.x,
359
+ cy: a.y,
360
+ r: e.value.style.plot.radius,
361
+ fill: a.color,
362
+ stroke: e.value.style.plot.stroke,
363
+ "stroke-width": e.value.style.plot.strokeWidth
364
+ }, null, 8, Xe)) : c("", !0)
365
+ ]))), 256)) : c("", !0),
366
+ _.showInfo && e.value.style.dataLabel.show ? (n(), r("text", {
367
+ key: 5,
368
+ x: e.value.style.dataLabel.position === "left" ? 12 + e.value.style.dataLabel.offsetX : o.value.width + 12 + e.value.style.dataLabel.offsetX,
369
+ y: u.value.height / 2 + e.value.style.dataLabel.fontSize / 2.5 + e.value.style.dataLabel.offsetY,
370
+ "font-size": e.value.style.dataLabel.fontSize,
371
+ "font-weight": e.value.style.dataLabel.bold ? "bold" : "normal",
372
+ fill: e.value.style.dataLabel.color
373
+ }, X(y.value ? h(Y)(
374
+ e.value.style.dataLabel.formatter,
375
+ y.value.absoluteValue,
376
+ h(J)({ p: e.value.style.dataLabel.prefix, v: y.value.absoluteValue, s: e.value.style.dataLabel.suffix, r: e.value.style.dataLabel.roundingValue }),
377
+ { datapoint: y.value }
378
+ ) : h(Y)(
379
+ e.value.style.dataLabel.formatter,
380
+ R.value,
381
+ h(J)({ p: e.value.style.dataLabel.prefix, v: R.value, s: e.value.style.dataLabel.suffix, r: e.value.style.dataLabel.roundingValue })
382
+ )), 9, Ze)) : c("", !0),
383
+ (n(!0), r(A, null, D(i.value, (a, d) => (n(), r("rect", {
384
+ x: a.x - (o.value.width / (g.value + 1) > u.value.padding ? u.value.padding : o.value.width / (g.value + 1)) / 2,
385
+ y: o.value.top - 6,
386
+ height: o.value.height + 6,
387
+ width: o.value.width / (g.value + 1) > u.value.padding ? u.value.padding : o.value.width / (g.value + 1),
388
+ fill: "transparent",
389
+ onMouseenter: (j) => se(a, d),
390
+ onMouseleave: oe,
391
+ onClick: () => ne(a, d)
392
+ }, null, 40, qe))), 256)),
393
+ M(t.$slots, "svg", { svg: u.value }, void 0, !0)
394
+ ], 12, Ce)) : c("", !0),
395
+ t.$slots.source ? (n(), r("div", {
396
+ key: 2,
397
+ ref_key: "source",
398
+ ref: B,
399
+ dir: "auto"
400
+ }, [
401
+ M(t.$slots, "source", {}, void 0, !0)
402
+ ], 512)) : c("", !0),
403
+ $.value ? c("", !0) : (n(), ce(_e, {
404
+ key: 3,
405
+ config: {
406
+ type: "sparkline",
407
+ style: {
408
+ backgroundColor: e.value.style.backgroundColor,
409
+ sparkline: {
410
+ color: "#CCCCCC"
411
+ }
412
+ }
413
+ }
414
+ }, null, 8, ["config"]))
415
+ ], 12, Ne));
416
+ }
417
+ }, lt = /* @__PURE__ */ Le(He, [["__scopeId", "data-v-16e41da8"]]);
418
+ export {
419
+ lt as default
420
+ };
@@ -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-D7dTQAhm.js";
3
- import { u as ee } from "./useNestedProp-Dqsj7eUX.js";
4
- import ke from "./vue-ui-skeleton-BObG0eVD.js";
5
- import { _ as be } from "./PackageVersion-BSLNI6kk.js";
6
- import { _ as _e } from "./Tooltip-D_6iYZSH.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-CG_OTzik.js";
3
+ import { u as ee } from "./useNestedProp-BZZvruew.js";
4
+ import ke from "./vue-ui-skeleton-B6hyEcxy.js";
5
+ import { _ as be } from "./PackageVersion-LRbiiLp0.js";
6
+ import { _ as _e } from "./Tooltip-CoahRzyE.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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./index-CgZGelSi.cjs"),V=require("./useNestedProp-BxCE3J3Z.cjs"),q=require("./vue-ui-skeleton-m4l9jfqA.cjs"),O=require("./PackageVersion-B_1OHk5A.cjs"),U=require("./Tooltip-AHTiRuWB.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-V6tl1xgQ.cjs"),V=require("./useNestedProp--db71Vbu.cjs"),q=require("./vue-ui-skeleton-D56sSIBO.cjs"),O=require("./PackageVersion-B7-YDa6h.cjs"),U=require("./Tooltip-DZ1uTqBW.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,17 +1,17 @@
1
1
  import { computed as w, ref as y, onMounted as je, watch as et, nextTick as ne, openBlock as s, createElementBlock as i, normalizeClass as xe, normalizeStyle as B, unref as p, createBlock as J, createCommentVNode as h, renderSlot as k, createVNode as ue, createSlots as Mt, withCtx as C, normalizeProps as O, guardReactiveProps as P, Fragment as v, renderList as f, createElementVNode as U, toDisplayString as S, createTextVNode as Tt } from "vue";
2
- import { u as Nt, c as tt, t as It, a as Ot, p as ce, C as ve, b as Pt, o as At, e as at, g as Vt, d as Rt, a7 as he, a3 as lt, D as rt, X as Et, l as Ft, G as ot, f as W, x as st, i as it, y as Dt, q as Ht, r as Bt } from "./index-D7dTQAhm.js";
3
- import { u as nt } from "./useNestedProp-Dqsj7eUX.js";
2
+ import { u as Nt, c as tt, t as It, a as Ot, p as ce, C as ve, b as Pt, o as At, e as at, g as Vt, d as Rt, a7 as he, a3 as lt, D as rt, X as Et, l as Ft, G as ot, f as W, x as st, i as it, y as Dt, q as Ht, r as Bt } from "./index-CG_OTzik.js";
3
+ import { u as nt } from "./useNestedProp-BZZvruew.js";
4
4
  import { t as Ut, u as Wt } from "./useResponsive-CoxXLe23.js";
5
- import { u as Yt, U as Xt } from "./usePrinter-B_Ihuvge.js";
6
- import { S as Gt } from "./Slicer-D9bKLcPd.js";
7
- import { _ as Jt } from "./Tooltip-D_6iYZSH.js";
8
- import { _ as qt } from "./Title-CSqO5Y62.js";
9
- import { L as Zt } from "./Legend-DGWOCyLt.js";
10
- import Kt from "./vue-ui-accordion-lCiFhb8k.js";
11
- import { D as Qt } from "./DataTable-DO8KGCcE.js";
12
- import jt from "./vue-ui-skeleton-BObG0eVD.js";
13
- import { _ as ea } from "./PackageVersion-BSLNI6kk.js";
14
- import { P as ta } from "./PenAndPaper-CxMtGtJt.js";
5
+ import { u as Yt, U as Xt } from "./usePrinter-CxBwzZkb.js";
6
+ import { S as Gt } from "./Slicer-DGn72_0M.js";
7
+ import { _ as Jt } from "./Tooltip-CoahRzyE.js";
8
+ import { _ as qt } from "./Title-Zm0LCGPS.js";
9
+ import { L as Zt } from "./Legend-Cq1rcFzv.js";
10
+ import Kt from "./vue-ui-accordion-C2IbGLRv.js";
11
+ import { D as Qt } from "./DataTable-CcW8SHH2.js";
12
+ import jt from "./vue-ui-skeleton-B6hyEcxy.js";
13
+ import { _ as ea } from "./PackageVersion-LRbiiLp0.js";
14
+ import { P as ta } from "./PenAndPaper-BCjJ-td_.js";
15
15
  import { u as aa } from "./useUserOptionState-BIvW1Kz7.js";
16
16
  import { _ as la } from "./_plugin-vue_export-helper-CHgC5LLL.js";
17
17
  const ra = ["id"], oa = ["xmlns", "viewBox"], sa = ["x", "y", "width", "height"], ia = { key: 1 }, na = ["id"], ua = ["stop-color"], ca = ["stop-color"], va = ["stop-color"], ha = ["x1", "x2", "y1", "y2", "stroke"], da = ["x1", "x2", "y1", "y2", "stroke"], ya = ["x1", "x2", "y1", "y2", "stroke"], ga = ["x1", "x2", "y1", "y2", "stroke"], ba = ["x", "y", "height", "rx", "width", "fill", "stroke", "stroke-width"], fa = ["x", "y", "width", "rx", "height", "fill", "stroke", "stroke-width"], ma = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], pa = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], xa = ["x", "y", "font-size", "fill", "font-weight"], ka = ["transform", "font-size", "fill", "font-weight"], wa = ["x", "y", "font-size", "fill", "font-weight"], za = { key: 0 }, Ca = ["x", "y", "font-size", "font-weight", "fill"], La = ["x", "y", "font-size", "fill", "font-weight"], _a = { key: 0 }, Sa = ["x", "y", "font-size", "font-weight", "fill"], $a = ["x1", "x2", "y1", "y2", "stroke"], Ma = ["x", "y", "font-size", "font-weight", "fill"], Ta = ["x1", "x2", "y1", "y2", "stroke"], Na = ["font-size", "font-weight", "fill", "text-anchor", "transform"], Ia = { key: 0 }, Oa = { key: 1 }, Pa = ["text-anchor", "font-size", "font-weight", "fill", "transform", "onClick"], Aa = { key: 0 }, Va = { key: 1 }, Ra = ["font-size", "font-weight", "fill", "x", "y", "onClick"], Ea = ["x", "y", "width", "height", "onClick", "onMouseenter", "fill"], Fa = ["x", "y", "width", "height", "onClick", "onMouseenter", "fill"], Da = {
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("./index-CgZGelSi.cjs"),Me=require("./useNestedProp-BxCE3J3Z.cjs"),Te=require("./useResponsive-BJ7DTGpm.cjs"),Ve=require("./usePrinter-sTw1FdN_.cjs"),tt=require("./Slicer-CkI4c7ft.cjs"),at=require("./Tooltip-AHTiRuWB.cjs"),lt=require("./Title-DjAOcuWO.cjs"),ot=require("./Legend-CMyzYtIb.cjs"),rt=require("./vue-ui-accordion-BZH6cz4t.cjs"),st=require("./DataTable-Dtq94CxH.cjs"),nt=require("./vue-ui-skeleton-m4l9jfqA.cjs"),it=require("./PackageVersion-B_1OHk5A.cjs"),ut=require("./PenAndPaper-DhXsAnuf.cjs"),ct=require("./useUserOptionState-BgepsfED.cjs"),dt=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),vt=["id"],ht=["xmlns","viewBox"],mt=["x","y","width","height"],gt={key:1},yt=["id"],bt=["stop-color"],pt=["stop-color"],ft=["stop-color"],kt=["x1","x2","y1","y2","stroke"],xt=["x1","x2","y1","y2","stroke"],wt=["x1","x2","y1","y2","stroke"],Bt=["x1","x2","y1","y2","stroke"],Ct=["x","y","height","rx","width","fill","stroke","stroke-width"],St=["x","y","width","rx","height","fill","stroke","stroke-width"],zt=["x1","x2","y1","y2","stroke","stroke-width"],Lt=["x1","x2","y1","y2","stroke","stroke-width"],Nt=["x","y","font-size","fill","font-weight"],Et=["transform","font-size","fill","font-weight"],_t=["x","y","font-size","fill","font-weight"],$t={key:0},Mt=["x","y","font-size","font-weight","fill"],Tt=["x","y","font-size","fill","font-weight"],Vt={key:0},Pt=["x","y","font-size","font-weight","fill"],Ft=["x1","x2","y1","y2","stroke"],It=["x","y","font-size","font-weight","fill"],Ot=["x1","x2","y1","y2","stroke"],Rt=["font-size","font-weight","fill","text-anchor","transform"],Dt={key:0},At={key:1},qt=["text-anchor","font-size","font-weight","fill","transform","onClick"],Ht={key:0},Ut={key:1},Wt=["font-size","font-weight","fill","x","y","onClick"],Yt=["x","y","width","height","onClick","onMouseenter","fill"],Xt=["x","y","width","height","onClick","onMouseenter","fill"],Gt={key:4,class:"vue-data-ui-watermark"},Jt=["onClick"],Zt=["innerHTML"],Kt={__name:"vue-ui-stackbar",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:["selectDatapoint","selectLegend","selectTimeLabel"],setup(X,{expose:Pe,emit:G}){const v=X,{vue_ui_stackbar:Fe}=c.useConfig(),$=e.computed({get(){return!!v.dataset&&v.dataset.length},set(l){return l}}),M=e.ref(null),J=e.ref(c.createUid()),R=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),D=e.ref(!1),V=e.ref(null),P=e.ref(!1),Ie=e.ref(0),Oe=e.ref(0),Re=e.ref(0),T=e.ref(null);e.onMounted(()=>{Q()});const t=e.computed({get:()=>ue(),set:l=>l}),{userOptionsVisible:K,setUserOptionsVisibility:ne,keepUserOptionState:ie}=ct.useUserOptionState({config:t.value});function ue(){const l=Me.useNestedProp({userConfig:v.config,defaultConfig:Fe});let o={};return l.theme?o={...Me.useNestedProp({userConfig:c.themes.vue_ui_stackbar[l.theme]||v.config,defaultConfig:l}),customPalette:c.themePalettes[l.theme]||c.palette}:o=l,v.config&&c.hasDeepProperty(v.config,"style.chart.grid.scale.scaleMin")?o.style.chart.grid.scale.scaleMin=v.config.style.chart.grid.scale.scaleMin:o.style.chart.grid.scale.scaleMin=null,v.config&&c.hasDeepProperty(v.config,"style.chart.grid.scale.scaleMax")?o.style.chart.grid.scale.scaleMax=v.config.style.chart.grid.scale.scaleMax:o.style.chart.grid.scale.scaleMax=null,v.config&&c.hasDeepProperty(v.config,"style.chart.zoom.startIndex")?o.style.chart.zoom.startIndex=v.config.style.chart.zoom.startIndex:o.style.chart.zoom.startIndex=null,v.config&&c.hasDeepProperty(v.config,"style.chart.zoom.endIndex")?o.style.chart.zoom.endIndex=v.config.style.chart.zoom.endIndex:o.style.chart.zoom.endIndex=null,o}e.watch(()=>v.config,l=>{t.value=ue(),K.value=!t.value.showOnChartHover,Q(),Ie.value+=1,Oe.value+=1,Re.value+=1},{deep:!0}),e.watch(()=>v.dataset,l=>{ye()},{deep:!0});const b=e.ref({dataLabels:{show:t.value.style.chart.bars.dataLabels.show},showTable:t.value.table.show,showTooltip:t.value.style.chart.tooltip.show}),{isPrinting:ce,isImaging:de,generatePdf:ve,generateImage:he}=Ve.usePrinter({elementId:`stackbar_${J.value}`,fileName:t.value.style.chart.title.text||"vue-ui-stackbar"}),A=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}}),De=e.computed(()=>c.convertCustomPalette(t.value.customPalette)),me=e.ref(null),ge=e.ref(null);e.onMounted(()=>{Q()});function Q(){if(c.objectIsEmpty(v.dataset)?c.error({componentName:"VueUiStackbar",type:"dataset"}):v.dataset.forEach((l,o)=>{c.getMissingDatasetAttributes({datasetObject:l,requiredAttributes:["name","series"]}).forEach(a=>{$.value=!1,c.error({componentName:"VueUiStackbar",type:"datasetSerieAttribute",property:a,index:o})})}),setTimeout(()=>{P.value=!0},10),t.value.responsive){const l=Te.throttle(()=>{P.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});A.value.width=o,A.value.height=a,clearTimeout(ge.value),ge.value=setTimeout(()=>{P.value=!0},10)});me.value=new ResizeObserver(l),me.value.observe(M.value.parentNode)}be()}const s=e.computed(()=>{const{height:l,width:o}=A.value,{right:a}=A.value.paddingRatio,r=t.value.style.chart.padding.top,n=o-o*a,i=l-t.value.style.chart.padding.bottom,y=t.value.style.chart.padding.left,L=o-y-o*a,N=l-r-t.value.style.chart.padding.bottom;return{chartHeight:l,chartWidth:o,top:r,right:n,bottom:i,left:y,width:L,height:N<0?0:N}}),C=e.computed(()=>v.dataset.map((l,o)=>{const a=c.convertColorToHex(l.color)||De.value[o]||c.palette[o]||c.palette[o%c.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:c.createUid(),color:a}})),S=e.computed(()=>Math.max(...C.value.filter(l=>!p.value.includes(l.id)).map(l=>l.series.length))),u=e.ref({start:0,end:Math.max(...v.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)&&T.value?(t.value.style.chart.zoom.startIndex!==null&&(await e.nextTick(),await e.nextTick(),T.value&&T.value.setStartValue(t.value.style.chart.zoom.startIndex)),t.value.style.chart.zoom.endIndex!==null&&(await e.nextTick(),await e.nextTick(),T.value&&T.value.setEndValue(Ae(t.value.style.chart.zoom.endIndex+1)))):(u.value={start:0,end:Math.max(...v.dataset.map(l=>l.series.length))},se.value+=1)}function Ae(l){const o=Math.max(...v.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/(u.value.end-u.value.start):l=s.value.height/(u.value.end-u.value.start),l<=0?0:l}),F=e.computed(()=>c.sumSeries(C.value.filter(l=>!p.value.includes(l.id))).slice(u.value.start,u.value.end)),qe=e.computed(()=>c.sumSeries(C.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(u.value.start,u.value.end)),q=e.computed(()=>{const l=C.value.filter(o=>!p.value.includes(o.id));return{positive:c.sumSeries(l.map(o=>({...o,series:o.series.slice(u.value.start,u.value.end).map(a=>a>=0?a:0)}))),negative:c.sumSeries(l.map(o=>({...o,series:o.series.slice(u.value.start,u.value.end).map(a=>a<0?a:0)})))}}),w=e.computed(()=>{const l=t.value.style.chart.grid.scale.scaleMax!==null&&!t.value.style.chart.bars.distributed?t.value.style.chart.grid.scale.scaleMax:Math.max(...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)?c.calculateNiceScaleWithExactExtremes(a>0?0:a,l<0?0:l,t.value.style.chart.grid.scale.ticks):c.calculateNiceScale(a>0?0:a,l<0?0:l,t.value.style.chart.grid.scale.ticks);return r.ticks.map(n=>({zero:s.value.bottom-s.value.height*(Math.abs(r.min)/(r.max+Math.abs(r.min))),y:s.value.bottom-s.value.height*((n+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*((n+Math.abs(r.min))/(r.max+Math.abs(r.min))),horizontal_y:s.value.bottom-8,value:n}))}),z=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(u.value.start,u.value.end)}),g=e.computed(()=>{if(!$.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 n=Math.max(...q.value.positive)||0,i=Math.min(...q.value.negative),y=[-1/0,1/0,NaN,void 0,null].includes(i)?0:i,L=!t.value.style.chart.bars.distributed&&(t.value.style.chart.grid.scale.scaleMax!==null||t.value.style.chart.grid.scale.scaleMin!==null)?c.calculateNiceScaleWithExactExtremes(t.value.style.chart.grid.scale.scaleMin!==null?t.value.style.chart.grid.scale.scaleMin:y>0?0:y,t.value.style.chart.grid.scale.scaleMax!==null?t.value.style.chart.grid.scale.scaleMax:n<0?0:n,t.value.style.chart.grid.scale.ticks):c.calculateNiceScale(t.value.style.chart.grid.scale.scaleMin!==null?t.value.style.chart.grid.scale.scaleMin:y>0?0:y,t.value.style.chart.grid.scale.scaleMax!==null?t.value.style.chart.grid.scale.scaleMax:n<0?0:n,t.value.style.chart.grid.scale.ticks),{min:N,max:I}=L,E=I+(N>=0?0:Math.abs(N))||1,f=s.value.height,Y=s.value.width,_e=w.value[0]?w.value[0].zero:s.value.bottom,$e=w.value[0]?w.value[0].horizontal_zero:s.value.left;return C.value.filter(O=>!p.value.includes(O.id)).map(O=>{const B=O.series.slice(u.value.start,u.value.end),Xe=O.signedSeries.slice(u.value.start,u.value.end),Ge=B.map((h,m)=>s.value.left+d.value*m+d.value*t.value.style.chart.bars.gapRatio/4),Je=B.map((h,m)=>s.value.top+d.value*m+d.value*t.value.style.chart.bars.gapRatio/4),Ze=B.map((h,m)=>{const k=t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/E;let _,x;return h>0?(x=f*k,_=_e-x-l[m],l[m]+=x):(x=f*k,_=_e+a[m],a[m]+=Math.abs(x)),_}),Ke=B.map((h,m)=>{const k=t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/E;let _,x;return h>0?(x=Y*k,_=$e+o[m],o[m]+=x):(x=Y*k,_=$e-Math.abs(x)-r[m],r[m]+=Math.abs(x)),_}),Qe=B.map((h,m)=>{const k=t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/E;return h>0?f*k:f*Math.abs(k)}),je=B.map((h,m)=>{const k=t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/E;return h>0?Y*k:Y*Math.abs(k)}),et=B.map(h=>Math.abs(h)).reduce((h,m)=>h+m,0);return{...O,proportions:B.map((h,m)=>t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/et),series:B,signedSeries:Xe,x:Ge,y:Ze,height:Qe,horizontal_width:je,horizontal_y:Je,horizontal_x:Ke}})}),pe=e.computed(()=>qe.value.map((l,o)=>({value:l,sign:l>=0?1:-1})));function H(l,o,a,r,n){const i=n===-1&&l>=0?-l:l;return c.applyDataLabel(t.value.style.chart.bars.dataLabels.formatter,i,c.dataLabel({p:t.value.style.chart.bars.dataLabels.prefix,v:i,s:t.value.style.chart.bars.dataLabels.suffix,r:t.value.style.chart.bars.dataLabels.rounding}),{datapoint:o,seriesIndex:a,datapointIndex:r})}function fe(l,o,a,r){return c.applyDataLabel(t.value.style.chart.bars.dataLabels.formatter,l,c.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}));G("selectDatapoint",{datapoint:o,period:z.value[l]})}function xe(l){V.value=l,R.value=!0;const o=t.value.style.chart.tooltip.customFormat,a=JSON.parse(JSON.stringify(g.value)).map(n=>({name:n.name,value:n.series[l]===0?0:(n.signedSeries[l]===-1&&n.series[l]>=0?-n.series[l]:n.series[l])||null,proportion:n.proportions[l]||null,color:n.color,id:n.id})),r=a.map(n=>Math.abs(n.value)).reduce((n,i)=>n+i,0);if(c.isFunction(o)&&c.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:n,showPercentage:i,borderColor:y,roundingValue:L,roundingPercentage:N}=t.value.style.chart.tooltip;let I="";z.value[l]&&z.value[l].text&&t.value.style.chart.tooltip.showTimeLabel&&(I+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${y};padding-bottom:6px;margin-bottom:3px;">${z.value[l].text}</div>`);const E=[n&&i?"(":"",n&&i?")":""];a.reverse().forEach(f=>{I+=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("./index-V6tl1xgQ.cjs"),Me=require("./useNestedProp--db71Vbu.cjs"),Te=require("./useResponsive-BJ7DTGpm.cjs"),Ve=require("./usePrinter-D0LQ1CyY.cjs"),tt=require("./Slicer-DMYxCNLb.cjs"),at=require("./Tooltip-DZ1uTqBW.cjs"),lt=require("./Title-CQVviDIQ.cjs"),ot=require("./Legend-fpW6iFgA.cjs"),rt=require("./vue-ui-accordion-B7VpkrPR.cjs"),st=require("./DataTable-BVwnM0tQ.cjs"),nt=require("./vue-ui-skeleton-D56sSIBO.cjs"),it=require("./PackageVersion-B7-YDa6h.cjs"),ut=require("./PenAndPaper-JkRknDt7.cjs"),ct=require("./useUserOptionState-BgepsfED.cjs"),dt=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),vt=["id"],ht=["xmlns","viewBox"],mt=["x","y","width","height"],gt={key:1},yt=["id"],bt=["stop-color"],pt=["stop-color"],ft=["stop-color"],kt=["x1","x2","y1","y2","stroke"],xt=["x1","x2","y1","y2","stroke"],wt=["x1","x2","y1","y2","stroke"],Bt=["x1","x2","y1","y2","stroke"],Ct=["x","y","height","rx","width","fill","stroke","stroke-width"],St=["x","y","width","rx","height","fill","stroke","stroke-width"],zt=["x1","x2","y1","y2","stroke","stroke-width"],Lt=["x1","x2","y1","y2","stroke","stroke-width"],Nt=["x","y","font-size","fill","font-weight"],Et=["transform","font-size","fill","font-weight"],_t=["x","y","font-size","fill","font-weight"],$t={key:0},Mt=["x","y","font-size","font-weight","fill"],Tt=["x","y","font-size","fill","font-weight"],Vt={key:0},Pt=["x","y","font-size","font-weight","fill"],Ft=["x1","x2","y1","y2","stroke"],It=["x","y","font-size","font-weight","fill"],Ot=["x1","x2","y1","y2","stroke"],Rt=["font-size","font-weight","fill","text-anchor","transform"],Dt={key:0},At={key:1},qt=["text-anchor","font-size","font-weight","fill","transform","onClick"],Ht={key:0},Ut={key:1},Wt=["font-size","font-weight","fill","x","y","onClick"],Yt=["x","y","width","height","onClick","onMouseenter","fill"],Xt=["x","y","width","height","onClick","onMouseenter","fill"],Gt={key:4,class:"vue-data-ui-watermark"},Jt=["onClick"],Zt=["innerHTML"],Kt={__name:"vue-ui-stackbar",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:["selectDatapoint","selectLegend","selectTimeLabel"],setup(X,{expose:Pe,emit:G}){const v=X,{vue_ui_stackbar:Fe}=c.useConfig(),$=e.computed({get(){return!!v.dataset&&v.dataset.length},set(l){return l}}),M=e.ref(null),J=e.ref(c.createUid()),R=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),D=e.ref(!1),V=e.ref(null),P=e.ref(!1),Ie=e.ref(0),Oe=e.ref(0),Re=e.ref(0),T=e.ref(null);e.onMounted(()=>{Q()});const t=e.computed({get:()=>ue(),set:l=>l}),{userOptionsVisible:K,setUserOptionsVisibility:ne,keepUserOptionState:ie}=ct.useUserOptionState({config:t.value});function ue(){const l=Me.useNestedProp({userConfig:v.config,defaultConfig:Fe});let o={};return l.theme?o={...Me.useNestedProp({userConfig:c.themes.vue_ui_stackbar[l.theme]||v.config,defaultConfig:l}),customPalette:c.themePalettes[l.theme]||c.palette}:o=l,v.config&&c.hasDeepProperty(v.config,"style.chart.grid.scale.scaleMin")?o.style.chart.grid.scale.scaleMin=v.config.style.chart.grid.scale.scaleMin:o.style.chart.grid.scale.scaleMin=null,v.config&&c.hasDeepProperty(v.config,"style.chart.grid.scale.scaleMax")?o.style.chart.grid.scale.scaleMax=v.config.style.chart.grid.scale.scaleMax:o.style.chart.grid.scale.scaleMax=null,v.config&&c.hasDeepProperty(v.config,"style.chart.zoom.startIndex")?o.style.chart.zoom.startIndex=v.config.style.chart.zoom.startIndex:o.style.chart.zoom.startIndex=null,v.config&&c.hasDeepProperty(v.config,"style.chart.zoom.endIndex")?o.style.chart.zoom.endIndex=v.config.style.chart.zoom.endIndex:o.style.chart.zoom.endIndex=null,o}e.watch(()=>v.config,l=>{t.value=ue(),K.value=!t.value.showOnChartHover,Q(),Ie.value+=1,Oe.value+=1,Re.value+=1},{deep:!0}),e.watch(()=>v.dataset,l=>{ye()},{deep:!0});const b=e.ref({dataLabels:{show:t.value.style.chart.bars.dataLabels.show},showTable:t.value.table.show,showTooltip:t.value.style.chart.tooltip.show}),{isPrinting:ce,isImaging:de,generatePdf:ve,generateImage:he}=Ve.usePrinter({elementId:`stackbar_${J.value}`,fileName:t.value.style.chart.title.text||"vue-ui-stackbar"}),A=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}}),De=e.computed(()=>c.convertCustomPalette(t.value.customPalette)),me=e.ref(null),ge=e.ref(null);e.onMounted(()=>{Q()});function Q(){if(c.objectIsEmpty(v.dataset)?c.error({componentName:"VueUiStackbar",type:"dataset"}):v.dataset.forEach((l,o)=>{c.getMissingDatasetAttributes({datasetObject:l,requiredAttributes:["name","series"]}).forEach(a=>{$.value=!1,c.error({componentName:"VueUiStackbar",type:"datasetSerieAttribute",property:a,index:o})})}),setTimeout(()=>{P.value=!0},10),t.value.responsive){const l=Te.throttle(()=>{P.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});A.value.width=o,A.value.height=a,clearTimeout(ge.value),ge.value=setTimeout(()=>{P.value=!0},10)});me.value=new ResizeObserver(l),me.value.observe(M.value.parentNode)}be()}const s=e.computed(()=>{const{height:l,width:o}=A.value,{right:a}=A.value.paddingRatio,r=t.value.style.chart.padding.top,n=o-o*a,i=l-t.value.style.chart.padding.bottom,y=t.value.style.chart.padding.left,L=o-y-o*a,N=l-r-t.value.style.chart.padding.bottom;return{chartHeight:l,chartWidth:o,top:r,right:n,bottom:i,left:y,width:L,height:N<0?0:N}}),C=e.computed(()=>v.dataset.map((l,o)=>{const a=c.convertColorToHex(l.color)||De.value[o]||c.palette[o]||c.palette[o%c.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:c.createUid(),color:a}})),S=e.computed(()=>Math.max(...C.value.filter(l=>!p.value.includes(l.id)).map(l=>l.series.length))),u=e.ref({start:0,end:Math.max(...v.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)&&T.value?(t.value.style.chart.zoom.startIndex!==null&&(await e.nextTick(),await e.nextTick(),T.value&&T.value.setStartValue(t.value.style.chart.zoom.startIndex)),t.value.style.chart.zoom.endIndex!==null&&(await e.nextTick(),await e.nextTick(),T.value&&T.value.setEndValue(Ae(t.value.style.chart.zoom.endIndex+1)))):(u.value={start:0,end:Math.max(...v.dataset.map(l=>l.series.length))},se.value+=1)}function Ae(l){const o=Math.max(...v.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/(u.value.end-u.value.start):l=s.value.height/(u.value.end-u.value.start),l<=0?0:l}),F=e.computed(()=>c.sumSeries(C.value.filter(l=>!p.value.includes(l.id))).slice(u.value.start,u.value.end)),qe=e.computed(()=>c.sumSeries(C.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(u.value.start,u.value.end)),q=e.computed(()=>{const l=C.value.filter(o=>!p.value.includes(o.id));return{positive:c.sumSeries(l.map(o=>({...o,series:o.series.slice(u.value.start,u.value.end).map(a=>a>=0?a:0)}))),negative:c.sumSeries(l.map(o=>({...o,series:o.series.slice(u.value.start,u.value.end).map(a=>a<0?a:0)})))}}),w=e.computed(()=>{const l=t.value.style.chart.grid.scale.scaleMax!==null&&!t.value.style.chart.bars.distributed?t.value.style.chart.grid.scale.scaleMax:Math.max(...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)?c.calculateNiceScaleWithExactExtremes(a>0?0:a,l<0?0:l,t.value.style.chart.grid.scale.ticks):c.calculateNiceScale(a>0?0:a,l<0?0:l,t.value.style.chart.grid.scale.ticks);return r.ticks.map(n=>({zero:s.value.bottom-s.value.height*(Math.abs(r.min)/(r.max+Math.abs(r.min))),y:s.value.bottom-s.value.height*((n+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*((n+Math.abs(r.min))/(r.max+Math.abs(r.min))),horizontal_y:s.value.bottom-8,value:n}))}),z=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(u.value.start,u.value.end)}),g=e.computed(()=>{if(!$.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 n=Math.max(...q.value.positive)||0,i=Math.min(...q.value.negative),y=[-1/0,1/0,NaN,void 0,null].includes(i)?0:i,L=!t.value.style.chart.bars.distributed&&(t.value.style.chart.grid.scale.scaleMax!==null||t.value.style.chart.grid.scale.scaleMin!==null)?c.calculateNiceScaleWithExactExtremes(t.value.style.chart.grid.scale.scaleMin!==null?t.value.style.chart.grid.scale.scaleMin:y>0?0:y,t.value.style.chart.grid.scale.scaleMax!==null?t.value.style.chart.grid.scale.scaleMax:n<0?0:n,t.value.style.chart.grid.scale.ticks):c.calculateNiceScale(t.value.style.chart.grid.scale.scaleMin!==null?t.value.style.chart.grid.scale.scaleMin:y>0?0:y,t.value.style.chart.grid.scale.scaleMax!==null?t.value.style.chart.grid.scale.scaleMax:n<0?0:n,t.value.style.chart.grid.scale.ticks),{min:N,max:I}=L,E=I+(N>=0?0:Math.abs(N))||1,f=s.value.height,Y=s.value.width,_e=w.value[0]?w.value[0].zero:s.value.bottom,$e=w.value[0]?w.value[0].horizontal_zero:s.value.left;return C.value.filter(O=>!p.value.includes(O.id)).map(O=>{const B=O.series.slice(u.value.start,u.value.end),Xe=O.signedSeries.slice(u.value.start,u.value.end),Ge=B.map((h,m)=>s.value.left+d.value*m+d.value*t.value.style.chart.bars.gapRatio/4),Je=B.map((h,m)=>s.value.top+d.value*m+d.value*t.value.style.chart.bars.gapRatio/4),Ze=B.map((h,m)=>{const k=t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/E;let _,x;return h>0?(x=f*k,_=_e-x-l[m],l[m]+=x):(x=f*k,_=_e+a[m],a[m]+=Math.abs(x)),_}),Ke=B.map((h,m)=>{const k=t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/E;let _,x;return h>0?(x=Y*k,_=$e+o[m],o[m]+=x):(x=Y*k,_=$e-Math.abs(x)-r[m],r[m]+=Math.abs(x)),_}),Qe=B.map((h,m)=>{const k=t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/E;return h>0?f*k:f*Math.abs(k)}),je=B.map((h,m)=>{const k=t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/E;return h>0?Y*k:Y*Math.abs(k)}),et=B.map(h=>Math.abs(h)).reduce((h,m)=>h+m,0);return{...O,proportions:B.map((h,m)=>t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/et),series:B,signedSeries:Xe,x:Ge,y:Ze,height:Qe,horizontal_width:je,horizontal_y:Je,horizontal_x:Ke}})}),pe=e.computed(()=>qe.value.map((l,o)=>({value:l,sign:l>=0?1:-1})));function H(l,o,a,r,n){const i=n===-1&&l>=0?-l:l;return c.applyDataLabel(t.value.style.chart.bars.dataLabels.formatter,i,c.dataLabel({p:t.value.style.chart.bars.dataLabels.prefix,v:i,s:t.value.style.chart.bars.dataLabels.suffix,r:t.value.style.chart.bars.dataLabels.rounding}),{datapoint:o,seriesIndex:a,datapointIndex:r})}function fe(l,o,a,r){return c.applyDataLabel(t.value.style.chart.bars.dataLabels.formatter,l,c.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}));G("selectDatapoint",{datapoint:o,period:z.value[l]})}function xe(l){V.value=l,R.value=!0;const o=t.value.style.chart.tooltip.customFormat,a=JSON.parse(JSON.stringify(g.value)).map(n=>({name:n.name,value:n.series[l]===0?0:(n.signedSeries[l]===-1&&n.series[l]>=0?-n.series[l]:n.series[l])||null,proportion:n.proportions[l]||null,color:n.color,id:n.id})),r=a.map(n=>Math.abs(n.value)).reduce((n,i)=>n+i,0);if(c.isFunction(o)&&c.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:n,showPercentage:i,borderColor:y,roundingValue:L,roundingPercentage:N}=t.value.style.chart.tooltip;let I="";z.value[l]&&z.value[l].text&&t.value.style.chart.tooltip.showTimeLabel&&(I+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${y};padding-bottom:6px;margin-bottom:3px;">${z.value[l].text}</div>`);const E=[n&&i?"(":"",n&&i?")":""];a.reverse().forEach(f=>{I+=`
2
2
  <div style="display:flex;flex-direction:row;align-items:center;gap:4px">
3
3
  <svg viewBox="0 0 12 12" height="14" width="14"><rect rx="1" x="0" y="0" height="12" width="12" stroke="none" fill="${t.value.style.chart.bars.gradient.show?`url(#gradient_${f.id})`:f.color}"/></svg>
4
4
  ${f.name}${n||i?":":""} ${n?c.dataLabel({p:t.value.style.chart.bars.dataLabels.prefix,v:f.value,s:t.value.style.chart.bars.dataLabels.suffix,r:L}):""} ${E[0]}${i?c.dataLabel({v:isNaN(f.value/r)?0:Math.abs(f.value)/r*100,s:"%",r:N}):""}${E[1]}