vue-chrts 0.1.6 → 0.1.7
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as v, computed as c, createApp as
|
|
2
|
-
import { Orientation as
|
|
1
|
+
import { defineComponent as v, computed as c, createApp as x, createElementBlock as f, openBlock as d, normalizeClass as b, createVNode as r, createCommentVNode as V, unref as i, withCtx as P, createBlock as L } from "vue";
|
|
2
|
+
import { Orientation as s, StackedBar as A, GroupedBar as O } from "@unovis/ts";
|
|
3
3
|
import { VisXYContainer as C, VisTooltip as G, VisGroupedBar as N, VisStackedBar as j, VisAxis as h, VisBulletLegend as w } from "@unovis/vue";
|
|
4
4
|
import E from "../Tooltip.js";
|
|
5
|
-
import { LegendPosition as
|
|
5
|
+
import { LegendPosition as D } from "../../types.js";
|
|
6
6
|
const S = /* @__PURE__ */ v({
|
|
7
7
|
__name: "BarChart",
|
|
8
8
|
props: {
|
|
@@ -23,7 +23,7 @@ const S = /* @__PURE__ */ v({
|
|
|
23
23
|
barPadding: {},
|
|
24
24
|
radius: {},
|
|
25
25
|
hideLegend: { type: Boolean },
|
|
26
|
-
orientation: { default:
|
|
26
|
+
orientation: { default: s.Vertical },
|
|
27
27
|
legendPosition: {},
|
|
28
28
|
xDomainLine: { type: Boolean },
|
|
29
29
|
yDomainLine: { type: Boolean },
|
|
@@ -37,57 +37,57 @@ const S = /* @__PURE__ */ v({
|
|
|
37
37
|
if (!a.yAxis || a.yAxis.length === 0)
|
|
38
38
|
throw new Error("yAxis is required");
|
|
39
39
|
const m = c(() => a.yAxis.map((e) => (t) => t[e])), p = (e, t) => Object.values(a.categories)[t].color, g = c(
|
|
40
|
-
() => a.legendPosition ===
|
|
40
|
+
() => a.legendPosition === D.Top
|
|
41
41
|
), y = c(() => (e, t) => {
|
|
42
42
|
if (typeof window > "u" || typeof document > "u")
|
|
43
43
|
return "";
|
|
44
|
-
const u = Object.keys(a.categories), B = Object.keys(e).find((
|
|
44
|
+
const u = Object.keys(a.categories), B = Object.keys(e).find((o) => !u.includes(o));
|
|
45
45
|
try {
|
|
46
|
-
const
|
|
46
|
+
const o = x(E, {
|
|
47
47
|
data: e,
|
|
48
48
|
categories: a.categories,
|
|
49
49
|
xValue: e[B]
|
|
50
50
|
}), k = document.createElement("div");
|
|
51
|
-
|
|
51
|
+
o.mount(k);
|
|
52
52
|
const T = k.innerHTML;
|
|
53
|
-
return
|
|
53
|
+
return o.unmount(), T;
|
|
54
54
|
} catch {
|
|
55
55
|
return "";
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
-
return (e, t) => (
|
|
58
|
+
return (e, t) => (d(), f("div", {
|
|
59
59
|
class: b(["flex flex-col space-y-4", { "flex-col-reverse": g.value }])
|
|
60
60
|
}, [
|
|
61
|
-
|
|
62
|
-
default:
|
|
63
|
-
|
|
61
|
+
r(i(C), { height: e.height }, {
|
|
62
|
+
default: P(() => [
|
|
63
|
+
r(i(G), {
|
|
64
64
|
triggers: {
|
|
65
65
|
[i(O).selectors.bar]: y.value,
|
|
66
66
|
[i(A).selectors.bar]: y.value
|
|
67
67
|
}
|
|
68
68
|
}, null, 8, ["triggers"]),
|
|
69
|
-
e.stacked ? (
|
|
69
|
+
e.stacked ? (d(), L(i(j), {
|
|
70
70
|
key: 1,
|
|
71
|
-
data: e.
|
|
72
|
-
x: (u,
|
|
71
|
+
data: e.data,
|
|
72
|
+
x: (u, l) => l,
|
|
73
73
|
y: m.value,
|
|
74
74
|
color: p,
|
|
75
75
|
"rounded-corners": e.radius ?? 0,
|
|
76
76
|
"group-padding": e.groupPadding ?? 0,
|
|
77
77
|
"bar-padding": e.barPadding ?? 0.2,
|
|
78
|
-
orientation: e.orientation ?? i(
|
|
79
|
-
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (
|
|
78
|
+
orientation: e.orientation ?? i(s).Vertical
|
|
79
|
+
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (d(), L(i(N), {
|
|
80
80
|
key: 0,
|
|
81
|
-
data: e.
|
|
82
|
-
x: (u,
|
|
81
|
+
data: e.data,
|
|
82
|
+
x: (u, l) => l,
|
|
83
83
|
y: m.value,
|
|
84
84
|
color: p,
|
|
85
85
|
"rounded-corners": e.radius ?? 0,
|
|
86
86
|
"group-padding": e.groupPadding ?? 0,
|
|
87
87
|
"bar-padding": e.barPadding ?? 0.2,
|
|
88
|
-
orientation: e.orientation ?? i(
|
|
88
|
+
orientation: e.orientation ?? i(s).Vertical
|
|
89
89
|
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])),
|
|
90
|
-
|
|
90
|
+
r(i(h), {
|
|
91
91
|
type: "x",
|
|
92
92
|
"tick-format": e.xFormatter,
|
|
93
93
|
label: e.xLabel,
|
|
@@ -98,10 +98,10 @@ const S = /* @__PURE__ */ v({
|
|
|
98
98
|
"tick-values": e.xExplicitTicks,
|
|
99
99
|
"min-max-ticks-only": e.minMaxTicksOnly
|
|
100
100
|
}, null, 8, ["tick-format", "label", "grid-line", "domain-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"]),
|
|
101
|
-
|
|
101
|
+
r(i(h), {
|
|
102
102
|
type: "y",
|
|
103
103
|
label: e.yLabel,
|
|
104
|
-
"grid-line": e.orientation !== i(
|
|
104
|
+
"grid-line": e.orientation !== i(s).Horizontal && e.yGridLine,
|
|
105
105
|
"domain-line": !!e.yDomainLine,
|
|
106
106
|
"tick-format": e.yFormatter,
|
|
107
107
|
"num-ticks": e.yNumTicks,
|
|
@@ -110,11 +110,11 @@ const S = /* @__PURE__ */ v({
|
|
|
110
110
|
]),
|
|
111
111
|
_: 1
|
|
112
112
|
}, 8, ["height"]),
|
|
113
|
-
e.hideLegend ?
|
|
113
|
+
e.hideLegend ? V("", !0) : (d(), f("div", {
|
|
114
114
|
key: 0,
|
|
115
115
|
class: b(["flex items center justify-end", { "pb-4": g.value }])
|
|
116
116
|
}, [
|
|
117
|
-
|
|
117
|
+
r(i(w), {
|
|
118
118
|
items: Object.values(e.categories)
|
|
119
119
|
}, null, 8, ["items"])
|
|
120
120
|
], 2))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-chrts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -14,12 +14,6 @@
|
|
|
14
14
|
"require": "./dist/index.umd.cjs"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
-
"scripts": {
|
|
18
|
-
"dev": "vite",
|
|
19
|
-
"build": "vue-tsc -b && vite build",
|
|
20
|
-
"preview": "vite preview",
|
|
21
|
-
"release": "commit-and-tag-version"
|
|
22
|
-
},
|
|
23
17
|
"peerDependencies": {
|
|
24
18
|
"vue": "^3.5.13"
|
|
25
19
|
},
|
|
@@ -40,5 +34,10 @@
|
|
|
40
34
|
"vue-router": "^4.5.0",
|
|
41
35
|
"vue-tsc": "^2.2.4"
|
|
42
36
|
},
|
|
43
|
-
"
|
|
44
|
-
|
|
37
|
+
"scripts": {
|
|
38
|
+
"dev": "vite",
|
|
39
|
+
"build": "vue-tsc -b && vite build",
|
|
40
|
+
"preview": "vite preview",
|
|
41
|
+
"release": "commit-and-tag-version"
|
|
42
|
+
}
|
|
43
|
+
}
|