vue-chrts 2.0.0-beta.2 → 2.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Tooltip.js +47 -46
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { getFirstPropertyValue as
|
|
3
|
-
const C =
|
|
1
|
+
import { defineComponent as F, computed as m, createElementBlock as n, openBlock as s, createElementVNode as r, toDisplayString as c, Fragment as p, renderList as z, normalizeStyle as w } from "vue";
|
|
2
|
+
import { getFirstPropertyValue as B } from "../utils.js";
|
|
3
|
+
const C = /* @__PURE__ */ F({
|
|
4
4
|
__name: "Tooltip",
|
|
5
5
|
props: {
|
|
6
6
|
data: {},
|
|
@@ -8,66 +8,67 @@ const C = { style: { display: "flex", "align-items": "center" } }, W = /* @__PUR
|
|
|
8
8
|
titleFormatter: { type: Function },
|
|
9
9
|
yFormatter: { type: Function }
|
|
10
10
|
},
|
|
11
|
-
setup(
|
|
12
|
-
const
|
|
13
|
-
() =>
|
|
14
|
-
),
|
|
15
|
-
([
|
|
11
|
+
setup(l) {
|
|
12
|
+
const t = l, v = m(
|
|
13
|
+
() => t.titleFormatter ? t.titleFormatter(t.data) : B(t.data)
|
|
14
|
+
), d = ["_index", "_stacked", "_ending"], g = m(() => Object.entries(t.data ?? []).filter(
|
|
15
|
+
([e, a]) => !d.includes(e) && Object.keys(t.categories).includes(e)
|
|
16
16
|
)), u = {
|
|
17
|
+
display: "flex",
|
|
18
|
+
flexDirection: "column"
|
|
19
|
+
}, f = {
|
|
17
20
|
color: "var(--vis-tooltip-title-color, #000)",
|
|
18
21
|
textTransform: "var(--vis-tooltip-title-text-transform, capitalize)",
|
|
19
22
|
borderBottom: "var(--vis-tooltip-title-border-bottom, 1px solid #e5e7eb)",
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
padding: "var(--vis-tooltip-title-padding, 0.75rem)",
|
|
23
|
+
padding: "var(--vis-tooltip-title-padding, 0.75rem 0.75rem 0.5rem 0.75rem)",
|
|
24
|
+
margin: "var(--vis-tooltip-title-margin, 0 0 0.25rem 0)",
|
|
23
25
|
fontSize: "var(--vis-tooltip-title-font-size, 0.875rem)",
|
|
24
26
|
lineHeight: "var(--vis-tooltip-title-line-height, 100%)",
|
|
25
27
|
fontWeight: "var(--vis-tooltip-title-font-weight, 600)"
|
|
26
|
-
}, f = {
|
|
27
|
-
display: "flex",
|
|
28
|
-
alignItems: "center",
|
|
29
|
-
justifyContent: "space-between",
|
|
30
|
-
padding: "var(--vis-tooltip-entry-padding-top, 0.25rem) var(--vis-tooltip-entry-padding-right, 0.25rem) var(--vis-tooltip-entry-padding-bottom, 0.5rem) var(--vis-tooltip-entry-padding-left, 0.25rem)"
|
|
31
28
|
}, y = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
display: "grid",
|
|
30
|
+
gridTemplateColumns: "auto 1fr auto",
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
gap: "var(--vis-tooltip-content-gap, 0.25rem 0.5rem)",
|
|
33
|
+
padding: "var(--vis-tooltip-content-padding, 0 0.75rem 0.5rem 0.75rem)"
|
|
36
34
|
}, h = {
|
|
37
35
|
fontWeight: "var(--vis-tooltip-label-font-weight, 400)",
|
|
38
36
|
fontSize: "var(--vis-tooltip-label-font-size, 0.875rem)",
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
color: "var(--vis-tooltip-label-color, inherit)",
|
|
38
|
+
margin: "var(--vis-tooltip-label-margin, 0 1rem 0 0)",
|
|
39
|
+
whiteSpace: "nowrap"
|
|
41
40
|
}, b = {
|
|
42
41
|
fontSize: "var(--vis-tooltip-value-font-size, 0.875rem)",
|
|
43
42
|
fontWeight: "var(--vis-tooltip-value-font-weight, 600)",
|
|
44
|
-
color: "var(--vis-tooltip-value-color)"
|
|
43
|
+
color: "var(--vis-tooltip-value-color, inherit)",
|
|
44
|
+
textAlign: "right",
|
|
45
|
+
fontVariantNumeric: "tabular-nums"
|
|
46
|
+
}, x = (e, a) => {
|
|
47
|
+
var o, i;
|
|
48
|
+
return {
|
|
49
|
+
width: "8px",
|
|
50
|
+
height: "8px",
|
|
51
|
+
aspectRatio: "1",
|
|
52
|
+
borderRadius: "var(--vis-tooltip-dot-border-radius, 4px)",
|
|
53
|
+
margin: "var(--vis-tooltip-dot-margin, 0)",
|
|
54
|
+
flexShrink: "0",
|
|
55
|
+
backgroundColor: typeof ((o = t.categories[e]) == null ? void 0 : o.color) == "string" && ((i = t.categories[e]) != null && i.color) ? t.categories[e].color : `var(--vis-color${a})`
|
|
56
|
+
};
|
|
45
57
|
};
|
|
46
|
-
return (
|
|
47
|
-
|
|
48
|
-
(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
...y,
|
|
58
|
-
backgroundColor: typeof ((v = t.categories[i]) == null ? void 0 : v.color) == "string" && ((d = t.categories[i]) != null && d.color) ? t.categories[i].color : `var(--vis-color${F})`
|
|
59
|
-
})
|
|
60
|
-
}, null, 4),
|
|
61
|
-
o("span", { style: h }, n(t.categories[i].name) + ": ", 1)
|
|
62
|
-
]),
|
|
63
|
-
o("div", null, [
|
|
64
|
-
o("span", { style: b }, n(t.yFormatter ? t.yFormatter(s) : s), 1)
|
|
65
|
-
])
|
|
66
|
-
]);
|
|
67
|
-
}), 128))
|
|
58
|
+
return (e, a) => (s(), n("div", { style: u }, [
|
|
59
|
+
r("div", { style: f }, c(v.value), 1),
|
|
60
|
+
r("div", { style: y }, [
|
|
61
|
+
(s(!0), n(p, null, z(g.value, ([o, i], S) => (s(), n(p, { key: o }, [
|
|
62
|
+
r("span", {
|
|
63
|
+
style: w(x(o, S))
|
|
64
|
+
}, null, 4),
|
|
65
|
+
r("span", { style: h }, c(l.categories[o].name), 1),
|
|
66
|
+
r("span", { style: b }, c(l.yFormatter ? l.yFormatter(i) : i), 1)
|
|
67
|
+
], 64))), 128))
|
|
68
|
+
])
|
|
68
69
|
]));
|
|
69
70
|
}
|
|
70
71
|
});
|
|
71
72
|
export {
|
|
72
|
-
|
|
73
|
+
C as default
|
|
73
74
|
};
|