@nubisco/ui 5.19.1 → 5.20.0
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/BarChart-Bnkibwcl.js +294 -0
- package/dist/BarChart-CjxY_3RM.cjs +1 -0
- package/dist/DataTable-CQBI0wcg.js +412 -0
- package/dist/DataTable-DN4SbClx.cjs +1 -0
- package/dist/{DatePicker-DMiiGKYY.js → DatePicker-ViTSDX6d.js} +113 -86
- package/dist/DatePicker-lv4wQxf8.cjs +1 -0
- package/dist/LineChart-Bol60gtX.cjs +1 -0
- package/dist/{LineChart-DG_ows6r.js → LineChart-CsBHPIUF.js} +25 -21
- package/dist/{Pagination-Br-k9zuG.js → Pagination-BveCRx-Z.js} +1 -1
- package/dist/{Pagination-CCMhqtoz.cjs → Pagination-DlTqW-zR.cjs} +1 -1
- package/dist/Select-D4Il1NaM.js +489 -0
- package/dist/Select-MwbDOqbP.cjs +1 -0
- package/dist/Tabs-Bmw1hFrN.cjs +1 -0
- package/dist/Tabs-CjXOZ3K6.js +196 -0
- package/dist/all.cjs +1 -1
- package/dist/all.mjs +7 -7
- package/dist/components/Charts/BarChart.cjs +1 -1
- package/dist/components/Charts/BarChart.d.ts +8 -1
- package/dist/components/Charts/BarChart.mjs +1 -1
- package/dist/components/Charts/BarChart.vue.d.ts.map +1 -1
- package/dist/components/Charts/LineChart.cjs +1 -1
- package/dist/components/Charts/LineChart.d.ts +8 -1
- package/dist/components/Charts/LineChart.mjs +1 -1
- package/dist/components/Charts/LineChart.vue.d.ts.map +1 -1
- package/dist/components/Charts/shared/types.d.ts +7 -0
- package/dist/components/DataTable.cjs +1 -1
- package/dist/components/DataTable.mjs +1 -1
- package/dist/components/DataTable.vue.d.ts.map +1 -1
- package/dist/components/DatePicker.cjs +1 -1
- package/dist/components/DatePicker.mjs +1 -1
- package/dist/components/DatePicker.vue.d.ts.map +1 -1
- package/dist/components/Pagination.cjs +1 -1
- package/dist/components/Pagination.mjs +1 -1
- package/dist/components/Select.cjs +1 -1
- package/dist/components/Select.d.ts +8 -0
- package/dist/components/Select.mjs +1 -1
- package/dist/components/Select.vue.d.ts +9 -7
- package/dist/components/Select.vue.d.ts.map +1 -1
- package/dist/components/Tabs.cjs +1 -1
- package/dist/components/Tabs.mjs +1 -1
- package/dist/components/Tabs.vue.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +7 -7
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/styles/BarChart.css +1 -1
- package/dist/styles/DataTable.css +1 -1
- package/dist/styles/LineChart.css +1 -1
- package/dist/styles/Select.css +1 -1
- package/dist/styles/Tabs.css +1 -1
- package/dist/ui.css +5 -5
- package/package.json +1 -1
- package/dist/BarChart-DTStA9jd.js +0 -290
- package/dist/BarChart-Dvrl4xeX.cjs +0 -1
- package/dist/DataTable-CWMlmjMi.cjs +0 -1
- package/dist/DataTable-DaNZAixf.js +0 -389
- package/dist/DatePicker-tAhXSR2o.cjs +0 -1
- package/dist/LineChart-C5bQNxQ-.cjs +0 -1
- package/dist/Select-ClkEzw5T.cjs +0 -1
- package/dist/Select-DIw08nte.js +0 -437
- package/dist/Tabs-CrrG1hvh.cjs +0 -1
- package/dist/Tabs-D3pdOieX.js +0 -180
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { t as e } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
2
|
+
import { i as t, l as n, n as r, u as i } from "./palette-StNyj_sM.js";
|
|
3
|
+
import { t as a } from "./ChartLegend-BLTbVV2E.js";
|
|
4
|
+
import { i as o, r as s, t as c } from "./scales-DlFF1BRk.js";
|
|
5
|
+
import { t as l } from "./useChartSize-UdZSuP3G.js";
|
|
6
|
+
import { Fragment as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createVNode as g, defineComponent as _, getCurrentInstance as v, mergeProps as y, normalizeClass as ee, openBlock as b, ref as x, renderList as S, toDisplayString as C, unref as w, withCtx as T } from "vue";
|
|
7
|
+
//#region src/components/Charts/BarChart.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
+
var E = [
|
|
9
|
+
"width",
|
|
10
|
+
"height",
|
|
11
|
+
"role",
|
|
12
|
+
"aria-label"
|
|
13
|
+
], D = { key: 0 }, O = [
|
|
14
|
+
"x1",
|
|
15
|
+
"x2",
|
|
16
|
+
"y1",
|
|
17
|
+
"y2"
|
|
18
|
+
], te = { class: "nb-chart__axis" }, ne = [
|
|
19
|
+
"x",
|
|
20
|
+
"y",
|
|
21
|
+
"text-anchor",
|
|
22
|
+
"dominant-baseline"
|
|
23
|
+
], re = { class: "nb-chart__axis" }, ie = [
|
|
24
|
+
"x",
|
|
25
|
+
"y",
|
|
26
|
+
"text-anchor",
|
|
27
|
+
"dominant-baseline"
|
|
28
|
+
], ae = [
|
|
29
|
+
"x1",
|
|
30
|
+
"x2",
|
|
31
|
+
"y1",
|
|
32
|
+
"y2"
|
|
33
|
+
], oe = [
|
|
34
|
+
"fill",
|
|
35
|
+
"tabindex",
|
|
36
|
+
"role",
|
|
37
|
+
"aria-label",
|
|
38
|
+
"onKeydown"
|
|
39
|
+
], k = { class: "nb-chart__hover-layer" }, A = [
|
|
40
|
+
"onMouseenter",
|
|
41
|
+
"onMousemove",
|
|
42
|
+
"onClick"
|
|
43
|
+
], j = /* @__PURE__ */ e(/* @__PURE__ */ _({
|
|
44
|
+
__name: "BarChart",
|
|
45
|
+
props: {
|
|
46
|
+
series: { default: () => [] },
|
|
47
|
+
orientation: { default: "vertical" },
|
|
48
|
+
stacked: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: !1
|
|
51
|
+
},
|
|
52
|
+
valueFormatter: {},
|
|
53
|
+
title: { default: void 0 },
|
|
54
|
+
subtitle: { default: void 0 },
|
|
55
|
+
height: { default: 280 },
|
|
56
|
+
showLegend: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: !0
|
|
59
|
+
},
|
|
60
|
+
showTooltip: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: !0
|
|
63
|
+
},
|
|
64
|
+
showGrid: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: !0
|
|
67
|
+
},
|
|
68
|
+
colors: { default: () => r }
|
|
69
|
+
},
|
|
70
|
+
emits: ["select"],
|
|
71
|
+
setup(e, { emit: r }) {
|
|
72
|
+
let _ = e, j = r, M = x(null), N = l(M, {
|
|
73
|
+
width: 480,
|
|
74
|
+
height: 240
|
|
75
|
+
}), P = d(() => _.orientation === "horizontal"), F = d(() => _.series.map((e, n) => ({
|
|
76
|
+
name: e.name,
|
|
77
|
+
data: e.data,
|
|
78
|
+
color: e.color ?? t(n, _.colors)
|
|
79
|
+
}))), I = d(() => (_.series[0]?.data ?? []).map((e) => e.x)), L = (e, t) => F.value[t]?.data[e]?.y ?? 0, R = (e, t) => {
|
|
80
|
+
let n = L(e, t);
|
|
81
|
+
if (!_.stacked) return [0, n];
|
|
82
|
+
let r = 0;
|
|
83
|
+
for (let i = 0; i < t; i += 1) {
|
|
84
|
+
let t = L(e, i);
|
|
85
|
+
t >= 0 == n >= 0 && (r += t);
|
|
86
|
+
}
|
|
87
|
+
return [r, r + n];
|
|
88
|
+
}, z = d(() => {
|
|
89
|
+
let e = [];
|
|
90
|
+
return I.value.forEach((t, n) => {
|
|
91
|
+
F.value.forEach((t, r) => {
|
|
92
|
+
e.push(R(n, r)[1]);
|
|
93
|
+
});
|
|
94
|
+
}), e.length ? o(Math.min(0, ...e), Math.max(0, ...e), .05) : [0, 1];
|
|
95
|
+
}), B = d(() => {
|
|
96
|
+
if (!P.value) return {
|
|
97
|
+
top: 12,
|
|
98
|
+
right: 16,
|
|
99
|
+
bottom: 28,
|
|
100
|
+
left: 44
|
|
101
|
+
};
|
|
102
|
+
let e = I.value.reduce((e, t) => Math.max(e, String(t).length), 0), t = Math.max(44, Math.round(N.value.width * .4));
|
|
103
|
+
return {
|
|
104
|
+
top: 12,
|
|
105
|
+
right: 16,
|
|
106
|
+
bottom: 28,
|
|
107
|
+
left: Math.min(Math.max(44, Math.ceil(e * 6.2) + 12), t)
|
|
108
|
+
};
|
|
109
|
+
}), V = d(() => ({
|
|
110
|
+
x0: B.value.left,
|
|
111
|
+
x1: Math.max(B.value.left, N.value.width - B.value.right),
|
|
112
|
+
y0: B.value.top,
|
|
113
|
+
y1: Math.max(B.value.top, N.value.height - B.value.bottom)
|
|
114
|
+
})), H = d(() => c(I.value.map((e) => String(e)), P.value ? [V.value.y0, V.value.y1] : [V.value.x0, V.value.x1], .2)), U = d(() => s(z.value, P.value ? [V.value.x0, V.value.x1] : [V.value.y1, V.value.y0])), W = d(() => U.value.ticks(5)), G = (e) => H.value(String(I.value[e])), K = (e) => G(e) + H.value.bandwidth / 2, q = d(() => {
|
|
115
|
+
let e = F.value.length || 1;
|
|
116
|
+
return _.stacked ? H.value.bandwidth : H.value.bandwidth / e;
|
|
117
|
+
}), se = (e, t) => {
|
|
118
|
+
let [n, r] = R(e, t), i = U.value(n), a = U.value(r), o = Math.max(0, q.value - 2), s = G(e) + (_.stacked ? 0 : t * q.value), c = Math.max(0, Math.abs(a - i));
|
|
119
|
+
return P.value ? {
|
|
120
|
+
x: Math.min(i, a),
|
|
121
|
+
y: s,
|
|
122
|
+
width: c,
|
|
123
|
+
height: o
|
|
124
|
+
} : {
|
|
125
|
+
x: s,
|
|
126
|
+
y: Math.min(i, a),
|
|
127
|
+
width: o,
|
|
128
|
+
height: c
|
|
129
|
+
};
|
|
130
|
+
}, ce = (e) => {
|
|
131
|
+
let t = G(e), n = H.value.bandwidth;
|
|
132
|
+
return P.value ? {
|
|
133
|
+
x: V.value.x0,
|
|
134
|
+
y: t,
|
|
135
|
+
width: Math.max(0, V.value.x1 - V.value.x0),
|
|
136
|
+
height: n
|
|
137
|
+
} : {
|
|
138
|
+
x: t,
|
|
139
|
+
y: V.value.y0,
|
|
140
|
+
width: n,
|
|
141
|
+
height: Math.max(0, V.value.y1 - V.value.y0)
|
|
142
|
+
};
|
|
143
|
+
}, le = (e) => Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(1)}k` : String(e), J = (e) => _.valueFormatter ? _.valueFormatter(e) : le(e), ue = v(), Y = () => !!ue?.vnode.props?.onSelect, de = (e, t) => {
|
|
144
|
+
let n = F.value[t], r = J(L(e, t));
|
|
145
|
+
return F.value.length > 1 ? `${I.value[e]}, ${n?.name}: ${r}` : `${I.value[e]}: ${r}`;
|
|
146
|
+
}, X = (e, t) => {
|
|
147
|
+
let n = F.value[t], r = n?.data[e];
|
|
148
|
+
return {
|
|
149
|
+
kind: "series",
|
|
150
|
+
x: r?.x ?? I.value[e],
|
|
151
|
+
y: r?.y ?? 0,
|
|
152
|
+
seriesName: n?.name ?? "",
|
|
153
|
+
seriesIndex: t,
|
|
154
|
+
index: e,
|
|
155
|
+
point: r ?? {
|
|
156
|
+
x: I.value[e],
|
|
157
|
+
y: 0
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}, Z = (e) => {
|
|
161
|
+
let t = e.currentTarget.ownerSVGElement;
|
|
162
|
+
if (!t) return null;
|
|
163
|
+
let n = t.getBoundingClientRect();
|
|
164
|
+
return {
|
|
165
|
+
x: e.clientX - n.left,
|
|
166
|
+
y: e.clientY - n.top
|
|
167
|
+
};
|
|
168
|
+
}, fe = (e, t) => {
|
|
169
|
+
let n = F.value.length;
|
|
170
|
+
if (n <= 1) return 0;
|
|
171
|
+
let r = Z(e);
|
|
172
|
+
if (!r) return 0;
|
|
173
|
+
if (_.stacked) {
|
|
174
|
+
let e = P.value ? r.x : r.y;
|
|
175
|
+
for (let r = 0; r < n; r += 1) {
|
|
176
|
+
let [n, i] = R(t, r), a = U.value(n), o = U.value(i);
|
|
177
|
+
if (e >= Math.min(a, o) && e <= Math.max(a, o)) return r;
|
|
178
|
+
}
|
|
179
|
+
return n - 1;
|
|
180
|
+
}
|
|
181
|
+
let i = (P.value ? r.y : r.x) - G(t), a = Math.floor(i / (q.value || 1));
|
|
182
|
+
return Math.min(Math.max(a, 0), n - 1);
|
|
183
|
+
}, pe = (e, t) => {
|
|
184
|
+
Y() && j("select", X(t, fe(e, t)));
|
|
185
|
+
}, me = (e, t, n) => {
|
|
186
|
+
Y() && (e.key !== "Enter" && e.key !== " " || (e.preventDefault(), j("select", X(t, n))));
|
|
187
|
+
}, Q = x(null), $ = x({
|
|
188
|
+
x: 0,
|
|
189
|
+
y: 0
|
|
190
|
+
}), he = (e, t) => {
|
|
191
|
+
let n = Z(e);
|
|
192
|
+
n && ($.value = {
|
|
193
|
+
x: n.x + 12,
|
|
194
|
+
y: n.y + 12
|
|
195
|
+
}, Q.value = t);
|
|
196
|
+
}, ge = d(() => Q.value === null ? [] : F.value.map((e) => {
|
|
197
|
+
let t = e.data[Q.value];
|
|
198
|
+
return {
|
|
199
|
+
label: e.name,
|
|
200
|
+
value: t?.label ?? J(t?.y ?? 0),
|
|
201
|
+
color: e.color
|
|
202
|
+
};
|
|
203
|
+
}));
|
|
204
|
+
return (t, r) => (b(), f(i, {
|
|
205
|
+
title: e.title,
|
|
206
|
+
subtitle: e.subtitle,
|
|
207
|
+
height: e.height,
|
|
208
|
+
"show-legend": e.showLegend && F.value.length > 0
|
|
209
|
+
}, {
|
|
210
|
+
legend: T(() => [g(a, { items: F.value.map((e) => ({
|
|
211
|
+
label: e.name,
|
|
212
|
+
color: e.color
|
|
213
|
+
})) }, null, 8, ["items"])]),
|
|
214
|
+
default: T(() => [h("div", {
|
|
215
|
+
ref_key: "root",
|
|
216
|
+
ref: M,
|
|
217
|
+
class: "nb-bar-chart"
|
|
218
|
+
}, [(b(), m("svg", {
|
|
219
|
+
width: w(N).width,
|
|
220
|
+
height: w(N).height,
|
|
221
|
+
class: ee(["nb-chart__svg", { "nb-chart__svg--selectable": Y() }]),
|
|
222
|
+
role: Y() ? "group" : "img",
|
|
223
|
+
"aria-label": e.title || "Bar chart",
|
|
224
|
+
onMouseleave: r[0] ||= (e) => Q.value = null
|
|
225
|
+
}, [
|
|
226
|
+
e.showGrid && w(N).width > 0 ? (b(), m("g", D, [(b(!0), m(u, null, S(W.value, (e) => (b(), m("line", {
|
|
227
|
+
key: `grid-${e}`,
|
|
228
|
+
class: "nb-chart__gridline",
|
|
229
|
+
x1: P.value ? U.value(e) : V.value.x0,
|
|
230
|
+
x2: P.value ? U.value(e) : V.value.x1,
|
|
231
|
+
y1: P.value ? V.value.y0 : U.value(e),
|
|
232
|
+
y2: P.value ? V.value.y1 : U.value(e)
|
|
233
|
+
}, null, 8, O))), 128))])) : p("", !0),
|
|
234
|
+
h("g", te, [(b(!0), m(u, null, S(W.value, (e) => (b(), m("text", {
|
|
235
|
+
key: `vt-${e}`,
|
|
236
|
+
x: P.value ? U.value(e) : V.value.x0 - 6,
|
|
237
|
+
y: P.value ? V.value.y1 + 14 : U.value(e),
|
|
238
|
+
"text-anchor": P.value ? "middle" : "end",
|
|
239
|
+
"dominant-baseline": P.value ? "auto" : "middle"
|
|
240
|
+
}, C(J(e)), 9, ne))), 128))]),
|
|
241
|
+
h("g", re, [(b(!0), m(u, null, S(I.value, (e, t) => (b(), m("text", {
|
|
242
|
+
key: `ct-${t}`,
|
|
243
|
+
x: P.value ? V.value.x0 - 6 : K(t),
|
|
244
|
+
y: P.value ? K(t) : V.value.y1 + 14,
|
|
245
|
+
"text-anchor": P.value ? "end" : "middle",
|
|
246
|
+
"dominant-baseline": P.value ? "middle" : "auto"
|
|
247
|
+
}, C(e), 9, ie))), 128))]),
|
|
248
|
+
h("line", {
|
|
249
|
+
class: "nb-chart__axis-line",
|
|
250
|
+
x1: P.value ? U.value(0) : V.value.x0,
|
|
251
|
+
x2: P.value ? U.value(0) : V.value.x1,
|
|
252
|
+
y1: P.value ? V.value.y0 : U.value(0),
|
|
253
|
+
y2: P.value ? V.value.y1 : U.value(0)
|
|
254
|
+
}, null, 8, ae),
|
|
255
|
+
(b(!0), m(u, null, S(I.value, (e, t) => (b(), m("g", { key: `g-${t}` }, [(b(!0), m(u, null, S(F.value, (e, n) => (b(), m("rect", y({
|
|
256
|
+
key: `${t}-${n}`,
|
|
257
|
+
class: ["nb-chart__bar", { "is-dim": Q.value !== null && Q.value !== t }]
|
|
258
|
+
}, { ref_for: !0 }, se(t, n), {
|
|
259
|
+
fill: e.color,
|
|
260
|
+
tabindex: Y() ? 0 : void 0,
|
|
261
|
+
role: Y() ? "button" : void 0,
|
|
262
|
+
"aria-label": Y() ? de(t, n) : void 0,
|
|
263
|
+
onKeydown: (e) => me(e, t, n)
|
|
264
|
+
}), null, 16, oe))), 128))]))), 128)),
|
|
265
|
+
h("g", k, [(b(!0), m(u, null, S(I.value, (e, t) => (b(), m("rect", y({ key: `hover-${t}` }, { ref_for: !0 }, ce(t), {
|
|
266
|
+
fill: "transparent",
|
|
267
|
+
onMouseenter: (e) => Q.value = t,
|
|
268
|
+
onMousemove: (e) => he(e, t),
|
|
269
|
+
onClick: (e) => pe(e, t)
|
|
270
|
+
}), null, 16, A))), 128))])
|
|
271
|
+
], 42, E)), g(n, {
|
|
272
|
+
visible: e.showTooltip && Q.value !== null,
|
|
273
|
+
x: $.value.x,
|
|
274
|
+
y: $.value.y,
|
|
275
|
+
title: Q.value === null ? "" : String(I.value[Q.value]),
|
|
276
|
+
rows: ge.value
|
|
277
|
+
}, null, 8, [
|
|
278
|
+
"visible",
|
|
279
|
+
"x",
|
|
280
|
+
"y",
|
|
281
|
+
"title",
|
|
282
|
+
"rows"
|
|
283
|
+
])], 512)]),
|
|
284
|
+
_: 1
|
|
285
|
+
}, 8, [
|
|
286
|
+
"title",
|
|
287
|
+
"subtitle",
|
|
288
|
+
"height",
|
|
289
|
+
"show-legend"
|
|
290
|
+
]));
|
|
291
|
+
}
|
|
292
|
+
}), [["__scopeId", "data-v-7b3d7ee4"]]);
|
|
293
|
+
//#endregion
|
|
294
|
+
export { j as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),t=require(`./palette-Cy2_8mLH.cjs`),n=require(`./ChartLegend-DGgW0yjG.cjs`),r=require(`./scales-4WxjhxBm.cjs`),i=require(`./useChartSize-C-BIN0vc.cjs`);let a=require(`vue`);var o=[`width`,`height`,`role`,`aria-label`],s={key:0},c=[`x1`,`x2`,`y1`,`y2`],l={class:`nb-chart__axis`},u=[`x`,`y`,`text-anchor`,`dominant-baseline`],d={class:`nb-chart__axis`},f=[`x`,`y`,`text-anchor`,`dominant-baseline`],p=[`x1`,`x2`,`y1`,`y2`],m=[`fill`,`tabindex`,`role`,`aria-label`,`onKeydown`],h={class:`nb-chart__hover-layer`},g=[`onMouseenter`,`onMousemove`,`onClick`],_=(0,a.defineComponent)({__name:`BarChart`,props:{series:{default:()=>[]},orientation:{default:`vertical`},stacked:{type:Boolean,default:!1},valueFormatter:{},title:{default:void 0},subtitle:{default:void 0},height:{default:280},showLegend:{type:Boolean,default:!0},showTooltip:{type:Boolean,default:!0},showGrid:{type:Boolean,default:!0},colors:{default:()=>t.n}},emits:[`select`],setup(e,{emit:_}){let v=e,y=_,b=(0,a.ref)(null),x=i.t(b,{width:480,height:240}),S=(0,a.computed)(()=>v.orientation===`horizontal`),C=(0,a.computed)(()=>v.series.map((e,n)=>({name:e.name,data:e.data,color:e.color??t.i(n,v.colors)}))),w=(0,a.computed)(()=>(v.series[0]?.data??[]).map(e=>e.x)),T=(e,t)=>C.value[t]?.data[e]?.y??0,E=(e,t)=>{let n=T(e,t);if(!v.stacked)return[0,n];let r=0;for(let i=0;i<t;i+=1){let t=T(e,i);t>=0==n>=0&&(r+=t)}return[r,r+n]},D=(0,a.computed)(()=>{let e=[];return w.value.forEach((t,n)=>{C.value.forEach((t,r)=>{e.push(E(n,r)[1])})}),e.length?r.i(Math.min(0,...e),Math.max(0,...e),.05):[0,1]}),O=(0,a.computed)(()=>{if(!S.value)return{top:12,right:16,bottom:28,left:44};let e=w.value.reduce((e,t)=>Math.max(e,String(t).length),0),t=Math.max(44,Math.round(x.value.width*.4));return{top:12,right:16,bottom:28,left:Math.min(Math.max(44,Math.ceil(e*6.2)+12),t)}}),k=(0,a.computed)(()=>({x0:O.value.left,x1:Math.max(O.value.left,x.value.width-O.value.right),y0:O.value.top,y1:Math.max(O.value.top,x.value.height-O.value.bottom)})),A=(0,a.computed)(()=>r.t(w.value.map(e=>String(e)),S.value?[k.value.y0,k.value.y1]:[k.value.x0,k.value.x1],.2)),j=(0,a.computed)(()=>r.r(D.value,S.value?[k.value.x0,k.value.x1]:[k.value.y1,k.value.y0])),M=(0,a.computed)(()=>j.value.ticks(5)),N=e=>A.value(String(w.value[e])),P=e=>N(e)+A.value.bandwidth/2,F=(0,a.computed)(()=>{let e=C.value.length||1;return v.stacked?A.value.bandwidth:A.value.bandwidth/e}),I=(e,t)=>{let[n,r]=E(e,t),i=j.value(n),a=j.value(r),o=Math.max(0,F.value-2),s=N(e)+(v.stacked?0:t*F.value),c=Math.max(0,Math.abs(a-i));return S.value?{x:Math.min(i,a),y:s,width:c,height:o}:{x:s,y:Math.min(i,a),width:o,height:c}},L=e=>{let t=N(e),n=A.value.bandwidth;return S.value?{x:k.value.x0,y:t,width:Math.max(0,k.value.x1-k.value.x0),height:n}:{x:t,y:k.value.y0,width:n,height:Math.max(0,k.value.y1-k.value.y0)}},R=e=>Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}k`:String(e),z=e=>v.valueFormatter?v.valueFormatter(e):R(e),B=(0,a.getCurrentInstance)(),V=()=>!!B?.vnode.props?.onSelect,H=(e,t)=>{let n=C.value[t],r=z(T(e,t));return C.value.length>1?`${w.value[e]}, ${n?.name}: ${r}`:`${w.value[e]}: ${r}`},U=(e,t)=>{let n=C.value[t],r=n?.data[e];return{kind:`series`,x:r?.x??w.value[e],y:r?.y??0,seriesName:n?.name??``,seriesIndex:t,index:e,point:r??{x:w.value[e],y:0}}},W=e=>{let t=e.currentTarget.ownerSVGElement;if(!t)return null;let n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}},G=(e,t)=>{let n=C.value.length;if(n<=1)return 0;let r=W(e);if(!r)return 0;if(v.stacked){let e=S.value?r.x:r.y;for(let r=0;r<n;r+=1){let[n,i]=E(t,r),a=j.value(n),o=j.value(i);if(e>=Math.min(a,o)&&e<=Math.max(a,o))return r}return n-1}let i=(S.value?r.y:r.x)-N(t),a=Math.floor(i/(F.value||1));return Math.min(Math.max(a,0),n-1)},K=(e,t)=>{V()&&y(`select`,U(t,G(e,t)))},q=(e,t,n)=>{V()&&(e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),y(`select`,U(t,n))))},J=(0,a.ref)(null),Y=(0,a.ref)({x:0,y:0}),X=(e,t)=>{let n=W(e);n&&(Y.value={x:n.x+12,y:n.y+12},J.value=t)},Z=(0,a.computed)(()=>J.value===null?[]:C.value.map(e=>{let t=e.data[J.value];return{label:e.name,value:t?.label??z(t?.y??0),color:e.color}}));return(r,i)=>((0,a.openBlock)(),(0,a.createBlock)(t.u,{title:e.title,subtitle:e.subtitle,height:e.height,"show-legend":e.showLegend&&C.value.length>0},{legend:(0,a.withCtx)(()=>[(0,a.createVNode)(n.t,{items:C.value.map(e=>({label:e.name,color:e.color}))},null,8,[`items`])]),default:(0,a.withCtx)(()=>[(0,a.createElementVNode)(`div`,{ref_key:`root`,ref:b,class:`nb-bar-chart`},[((0,a.openBlock)(),(0,a.createElementBlock)(`svg`,{width:(0,a.unref)(x).width,height:(0,a.unref)(x).height,class:(0,a.normalizeClass)([`nb-chart__svg`,{"nb-chart__svg--selectable":V()}]),role:V()?`group`:`img`,"aria-label":e.title||`Bar chart`,onMouseleave:i[0]||=e=>J.value=null},[e.showGrid&&(0,a.unref)(x).width>0?((0,a.openBlock)(),(0,a.createElementBlock)(`g`,s,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(M.value,e=>((0,a.openBlock)(),(0,a.createElementBlock)(`line`,{key:`grid-${e}`,class:`nb-chart__gridline`,x1:S.value?j.value(e):k.value.x0,x2:S.value?j.value(e):k.value.x1,y1:S.value?k.value.y0:j.value(e),y2:S.value?k.value.y1:j.value(e)},null,8,c))),128))])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`g`,l,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(M.value,e=>((0,a.openBlock)(),(0,a.createElementBlock)(`text`,{key:`vt-${e}`,x:S.value?j.value(e):k.value.x0-6,y:S.value?k.value.y1+14:j.value(e),"text-anchor":S.value?`middle`:`end`,"dominant-baseline":S.value?`auto`:`middle`},(0,a.toDisplayString)(z(e)),9,u))),128))]),(0,a.createElementVNode)(`g`,d,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(w.value,(e,t)=>((0,a.openBlock)(),(0,a.createElementBlock)(`text`,{key:`ct-${t}`,x:S.value?k.value.x0-6:P(t),y:S.value?P(t):k.value.y1+14,"text-anchor":S.value?`end`:`middle`,"dominant-baseline":S.value?`middle`:`auto`},(0,a.toDisplayString)(e),9,f))),128))]),(0,a.createElementVNode)(`line`,{class:`nb-chart__axis-line`,x1:S.value?j.value(0):k.value.x0,x2:S.value?j.value(0):k.value.x1,y1:S.value?k.value.y0:j.value(0),y2:S.value?k.value.y1:j.value(0)},null,8,p),((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(w.value,(e,t)=>((0,a.openBlock)(),(0,a.createElementBlock)(`g`,{key:`g-${t}`},[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(C.value,(e,n)=>((0,a.openBlock)(),(0,a.createElementBlock)(`rect`,(0,a.mergeProps)({key:`${t}-${n}`,class:[`nb-chart__bar`,{"is-dim":J.value!==null&&J.value!==t}]},{ref_for:!0},I(t,n),{fill:e.color,tabindex:V()?0:void 0,role:V()?`button`:void 0,"aria-label":V()?H(t,n):void 0,onKeydown:e=>q(e,t,n)}),null,16,m))),128))]))),128)),(0,a.createElementVNode)(`g`,h,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(w.value,(e,t)=>((0,a.openBlock)(),(0,a.createElementBlock)(`rect`,(0,a.mergeProps)({key:`hover-${t}`},{ref_for:!0},L(t),{fill:`transparent`,onMouseenter:e=>J.value=t,onMousemove:e=>X(e,t),onClick:e=>K(e,t)}),null,16,g))),128))])],42,o)),(0,a.createVNode)(t.l,{visible:e.showTooltip&&J.value!==null,x:Y.value.x,y:Y.value.y,title:J.value===null?``:String(w.value[J.value]),rows:Z.value},null,8,[`visible`,`x`,`y`,`title`,`rows`])],512)]),_:1},8,[`title`,`subtitle`,`height`,`show-legend`]))}}),v=e.t(_,[[`__scopeId`,`data-v-7b3d7ee4`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return v}});
|