@adyen/lume-vue3 1.16.0 → 1.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/components/core/lume-axis/composables/y-band-scale-axis.d.ts.map +1 -1
- package/dist/@types/components/core/lume-axis/composables/y-linear-scale-axis.d.ts.map +1 -1
- package/dist/@types/components/core/lume-axis/defaults.d.ts.map +1 -1
- package/dist/@types/components/core/lume-axis/helpers.d.ts +3 -0
- package/dist/@types/components/core/lume-axis/helpers.d.ts.map +1 -0
- package/dist/@types/components/core/lume-axis/lume-axis.vue.d.ts +2 -0
- package/dist/@types/components/core/lume-axis/lume-axis.vue.d.ts.map +1 -1
- package/dist/@types/components/core/lume-axis/types.d.ts +1 -1
- package/dist/@types/components/core/lume-axis/types.d.ts.map +1 -1
- package/dist/@types/components/core/lume-chart/lume-chart.vue.d.ts.map +1 -1
- package/dist/@types/components/groups/lume-line-group/lume-line-group.vue.d.ts.map +1 -1
- package/dist/@types/types/options.d.ts +1 -0
- package/dist/@types/types/options.d.ts.map +1 -1
- package/dist/@types/utils/margins.d.ts +1 -1
- package/dist/@types/utils/margins.d.ts.map +1 -1
- package/dist/common/BONsehMI.js +5 -0
- package/dist/common/BONsehMI.js.map +1 -0
- package/dist/common/DYSrBfkM.js +5 -0
- package/dist/common/DYSrBfkM.js.map +1 -0
- package/dist/common/KjsS1ILQ.js +5 -0
- package/dist/common/KjsS1ILQ.js.map +1 -0
- package/dist/common/jCogx8dL.js +3764 -0
- package/dist/common/jCogx8dL.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/plugin.js +1 -1
- package/dist/scss/components/lume-chart-legend.scss +32 -0
- package/dist/scss/components/lume-chart.scss +2 -1
- package/dist/scss/main.scss +2 -2
- package/dist/styles/main.css +1 -1
- package/package.json +1 -1
- package/dist/common/BYhjdB9y.js +0 -3725
- package/dist/common/BYhjdB9y.js.map +0 -1
- package/dist/common/BgaIG7xN.js +0 -5
- package/dist/common/BgaIG7xN.js.map +0 -1
- package/dist/common/Cd2sV3nh.js +0 -5
- package/dist/common/Cd2sV3nh.js.map +0 -1
- package/dist/common/DQ1wPLy9.js +0 -5
- package/dist/common/DQ1wPLy9.js.map +0 -1
|
@@ -0,0 +1,3764 @@
|
|
|
1
|
+
import { defineComponent as Q, ref as C, openBlock as b, createElementBlock as O, mergeProps as W, createElementVNode as P, toDisplayString as ce, createCommentVNode as K, isRef as Xt, computed as f, watch as U, toRefs as ie, inject as Qe, reactive as qe, onMounted as xe, unref as v, Fragment as oe, renderList as J, createBlock as ee, normalizeStyle as Yt, normalizeClass as ue, watchEffect as Kt, onBeforeUnmount as Jt, renderSlot as F, createTextVNode as _e, useSlots as me, nextTick as lt, withCtx as Z, createSlots as ke, pushScopeId as bn, popScopeId as An, provide as ot, createVNode as ge, withKeys as Ot, withModifiers as Nt, toHandlers as de, normalizeProps as $e, guardReactiveProps as we, defineAsyncComponent as at, resolveDynamicComponent as Ln } from "vue";
|
|
2
|
+
import { sankeyLinkHorizontal as Tn, sankey as $n, sankeyJustify as wn } from "d3-sankey";
|
|
3
|
+
import { format as In, ticks as xn, scaleLinear as je, scaleBand as Pe, link as On, line as Nn, area as En } from "d3";
|
|
4
|
+
import { createPopper as Dn } from "@popperjs/core";
|
|
5
|
+
const Bn = {
|
|
6
|
+
class: "axis__tick-label lume-typography--axis",
|
|
7
|
+
"pointer-events": "all",
|
|
8
|
+
"data-j-axis__tick-label": ""
|
|
9
|
+
}, Rn = /* @__PURE__ */ Q({
|
|
10
|
+
__name: "lume-tick",
|
|
11
|
+
props: {
|
|
12
|
+
value: {
|
|
13
|
+
type: [String, Number],
|
|
14
|
+
required: !0
|
|
15
|
+
},
|
|
16
|
+
group: {
|
|
17
|
+
type: Object,
|
|
18
|
+
required: !0
|
|
19
|
+
},
|
|
20
|
+
ghost: {
|
|
21
|
+
type: Object,
|
|
22
|
+
required: !0
|
|
23
|
+
},
|
|
24
|
+
label: {
|
|
25
|
+
type: Object,
|
|
26
|
+
required: !0
|
|
27
|
+
},
|
|
28
|
+
gridline: {
|
|
29
|
+
type: Object,
|
|
30
|
+
required: !0
|
|
31
|
+
},
|
|
32
|
+
isHovered: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: !1
|
|
35
|
+
},
|
|
36
|
+
isHidden: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: !1
|
|
39
|
+
},
|
|
40
|
+
withGridlines: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: !0
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
emits: ["click", "mouseenter"],
|
|
46
|
+
setup(e, { expose: n, emit: t }) {
|
|
47
|
+
const o = t, l = C(null);
|
|
48
|
+
return n({ ref: l }), (i, a) => (b(), O("g", W(e.group, {
|
|
49
|
+
class: ["axis__tick", {
|
|
50
|
+
"axis__tick--hovered": e.isHovered,
|
|
51
|
+
"axis__tick--hidden": e.isHidden
|
|
52
|
+
}],
|
|
53
|
+
"data-j-axis__tick": "",
|
|
54
|
+
onMouseenter: a[0] || (a[0] = (r) => o("mouseenter", r)),
|
|
55
|
+
onClick: a[1] || (a[1] = (r) => o("click", r))
|
|
56
|
+
}), [
|
|
57
|
+
P("g", Bn, [
|
|
58
|
+
P("rect", W(e.ghost, {
|
|
59
|
+
class: "axis__ghost",
|
|
60
|
+
fill: "url(#lume-tick-gradient)"
|
|
61
|
+
}), null, 16),
|
|
62
|
+
P("text", W(e.label, {
|
|
63
|
+
ref_key: "labelRef",
|
|
64
|
+
ref: l,
|
|
65
|
+
class: "axis__label"
|
|
66
|
+
}), ce(e.value), 17)
|
|
67
|
+
]),
|
|
68
|
+
e.withGridlines ? (b(), O("line", W({ key: 0 }, e.gridline, { class: "axis__grid-line" }), null, 16)) : K("", !0)
|
|
69
|
+
], 16));
|
|
70
|
+
}
|
|
71
|
+
}), ae = (e, n) => {
|
|
72
|
+
const t = e.__vccOpts || e;
|
|
73
|
+
for (const [o, l] of n)
|
|
74
|
+
t[o] = l;
|
|
75
|
+
return t;
|
|
76
|
+
}, Et = /* @__PURE__ */ ae(Rn, [["__scopeId", "data-v-59ddc0a6"]]), Hn = [
|
|
77
|
+
"controls",
|
|
78
|
+
"legend",
|
|
79
|
+
"axes",
|
|
80
|
+
"groups",
|
|
81
|
+
"tooltip",
|
|
82
|
+
"tooltip-content"
|
|
83
|
+
];
|
|
84
|
+
function Qt() {
|
|
85
|
+
return process.env.NODE_ENV === "production";
|
|
86
|
+
}
|
|
87
|
+
function qt(e) {
|
|
88
|
+
return (e == null ? void 0 : e.map(
|
|
89
|
+
(n) => n.values.map((t) => t == null ? void 0 : t.value).flat()
|
|
90
|
+
).flat()) || [];
|
|
91
|
+
}
|
|
92
|
+
function pt(e) {
|
|
93
|
+
return e.length === 1;
|
|
94
|
+
}
|
|
95
|
+
function Mn(e) {
|
|
96
|
+
return !!e && e.every(
|
|
97
|
+
(n) => "color" in n
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
function ut(e) {
|
|
101
|
+
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
102
|
+
}
|
|
103
|
+
function en(e, n) {
|
|
104
|
+
const t = { ...e };
|
|
105
|
+
return Object.entries(n).forEach(([o, l]) => {
|
|
106
|
+
t[o] = ut(e[o]) && ut(l) ? en(e[o], l) : l;
|
|
107
|
+
}), t;
|
|
108
|
+
}
|
|
109
|
+
function Sn(e) {
|
|
110
|
+
return e != null && ut(e) && "value" in e;
|
|
111
|
+
}
|
|
112
|
+
function pe(e) {
|
|
113
|
+
return (e == null ? void 0 : e.bandwidth) !== void 0;
|
|
114
|
+
}
|
|
115
|
+
function Gn(e) {
|
|
116
|
+
return pe(e) ? e.step() : Math.max(...e.range()) / Math.max(...e.domain());
|
|
117
|
+
}
|
|
118
|
+
function Cn(e) {
|
|
119
|
+
const [n, t] = e.domain();
|
|
120
|
+
return n == null || t == null || n === 0 && t === 0;
|
|
121
|
+
}
|
|
122
|
+
const Fn = (e, n) => {
|
|
123
|
+
if (!e)
|
|
124
|
+
throw new Error("Data is not a valid array");
|
|
125
|
+
if (e.length === 0)
|
|
126
|
+
throw new Error("Cannot get highest value from empty array");
|
|
127
|
+
e.some(
|
|
128
|
+
({ values: o }) => o.length - 1 >= n
|
|
129
|
+
) || Ie(be.IndexExceedsLengthOfDataSets);
|
|
130
|
+
};
|
|
131
|
+
function jn(e, n) {
|
|
132
|
+
var t;
|
|
133
|
+
return Fn(e, n), ((t = e.reduce(
|
|
134
|
+
(o, l) => {
|
|
135
|
+
var i, a;
|
|
136
|
+
return (((i = o.values[n]) == null ? void 0 : i.value) ?? 0) > (((a = l.values[n]) == null ? void 0 : a.value) ?? 0) ? o : l;
|
|
137
|
+
}
|
|
138
|
+
).values[n]) == null ? void 0 : t.value) || 0;
|
|
139
|
+
}
|
|
140
|
+
function tn(e) {
|
|
141
|
+
const n = Xt(e) ? e.value : e;
|
|
142
|
+
if (!n)
|
|
143
|
+
throw new Error("No empty array can be created from specified data value");
|
|
144
|
+
const t = Math.max(
|
|
145
|
+
...n.map((o) => o.values.length),
|
|
146
|
+
0
|
|
147
|
+
);
|
|
148
|
+
return Array(t).fill(null);
|
|
149
|
+
}
|
|
150
|
+
function Pn(e) {
|
|
151
|
+
return pe(e) ? e.domain().length : Math.max(...e.domain());
|
|
152
|
+
}
|
|
153
|
+
function Vn(e, n) {
|
|
154
|
+
return (t) => Math.round(e * (1 - t) + n * t);
|
|
155
|
+
}
|
|
156
|
+
function zn(e, n, t) {
|
|
157
|
+
const o = n, l = e.slice(0, o);
|
|
158
|
+
return e.slice(o).concat(l);
|
|
159
|
+
}
|
|
160
|
+
function Be(e) {
|
|
161
|
+
if (e.groups) {
|
|
162
|
+
const n = Object.keys(e);
|
|
163
|
+
return Object.assign(
|
|
164
|
+
{},
|
|
165
|
+
...n.map((t) => t !== "groups" ? { [t]: e[t] } : {})
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
return e;
|
|
169
|
+
}
|
|
170
|
+
function Wn(e) {
|
|
171
|
+
return Object.assign(
|
|
172
|
+
{},
|
|
173
|
+
...Object.keys(e).map(
|
|
174
|
+
(n) => Hn.includes(n) ? {} : { [n]: e[n] }
|
|
175
|
+
)
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
function ht(e, n) {
|
|
179
|
+
const t = n - e.length;
|
|
180
|
+
return t > 0 ? [...e, ...Array(t).fill({ value: null })] : e;
|
|
181
|
+
}
|
|
182
|
+
var be = /* @__PURE__ */ ((e) => (e.DatasetLength = `Our guidelines highly recommend not having more than 5 datasets in one chart.
|
|
183
|
+
Learn more: https://lume.design/guidelines/datasets`, e.ColorLoop = "Colors will loop around after the 5th dataset. You can prevent this by setting specific colors for your datasets.", e.Empty = "The dataset(s) provided are empty.", e.InvalidFormat = "The string provided to format is invalid. Please refer to https://github.com/d3/d3-format for valid arguments.", e.NotContainedInSvg = "This component is an `SVGElement`, thus it is required to be inside an `<svg>` container.", e.InvalidHoveredIndex = "The provided hovered index is not valid for the data of this chart.", e.InvalidHoveredElement = "The provided hovered element is not valid for the data of this diagram.", e.IndexExceedsLengthOfDataSets = "Index exceeds length of all of the datasets", e))(be || {});
|
|
184
|
+
const Un = "[lume] ";
|
|
185
|
+
function Ie(e, n = !0) {
|
|
186
|
+
n && Qt() || console.warn(Un + "Warning: " + e);
|
|
187
|
+
}
|
|
188
|
+
const Ye = (e) => {
|
|
189
|
+
let n = null;
|
|
190
|
+
switch (typeof e) {
|
|
191
|
+
case "string":
|
|
192
|
+
try {
|
|
193
|
+
n = In(e);
|
|
194
|
+
} catch {
|
|
195
|
+
Ie(be.InvalidFormat), n = null;
|
|
196
|
+
}
|
|
197
|
+
break;
|
|
198
|
+
case "function":
|
|
199
|
+
n = e;
|
|
200
|
+
break;
|
|
201
|
+
default:
|
|
202
|
+
n = null;
|
|
203
|
+
}
|
|
204
|
+
function t(...o) {
|
|
205
|
+
return n ? n(...o) : o[0];
|
|
206
|
+
}
|
|
207
|
+
return t;
|
|
208
|
+
}, Ve = () => ({
|
|
209
|
+
options: {
|
|
210
|
+
type: Object,
|
|
211
|
+
default: () => ({})
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
function Ae(e, n) {
|
|
215
|
+
return { allOptions: f(() => {
|
|
216
|
+
const o = Xt(n) ? n == null ? void 0 : n.value : n;
|
|
217
|
+
return o ? en(o, e.value) : e.value;
|
|
218
|
+
}) };
|
|
219
|
+
}
|
|
220
|
+
const Zn = 0.2;
|
|
221
|
+
function Xn(e, n, t) {
|
|
222
|
+
const o = C(), l = f(() => Math.max(...e.value.range())), i = f(() => n.value.length);
|
|
223
|
+
function a() {
|
|
224
|
+
if (!n.value) return;
|
|
225
|
+
const u = n.value.reduce(
|
|
226
|
+
(d, c) => d + c.ref.getBoundingClientRect().width,
|
|
227
|
+
0
|
|
228
|
+
), s = Math.ceil(u / i.value);
|
|
229
|
+
o.value = s + s * Zn;
|
|
230
|
+
}
|
|
231
|
+
function r(u) {
|
|
232
|
+
if (!n.value) return !0;
|
|
233
|
+
const s = t.value.skip, d = n.value.length;
|
|
234
|
+
if (u === 0) return !0;
|
|
235
|
+
const c = l.value / d, p = typeof s == "number" && s > 0 && s + 1 || Math.ceil(o.value / c);
|
|
236
|
+
return u % p === 0;
|
|
237
|
+
}
|
|
238
|
+
return U(n, a), { showTick: r };
|
|
239
|
+
}
|
|
240
|
+
const S = {
|
|
241
|
+
HORIZONTAL: "horizontal",
|
|
242
|
+
VERTICAL: "vertical"
|
|
243
|
+
}, Yn = {
|
|
244
|
+
SINGLE: "single",
|
|
245
|
+
GROUPED: "grouped",
|
|
246
|
+
STACKED: "stacked"
|
|
247
|
+
}, nn = "No data", Dt = 20, on = 0.33, an = 0.5, ln = 12, ze = 8, Kn = 1, Jn = [
|
|
248
|
+
"auto",
|
|
249
|
+
"auto-start",
|
|
250
|
+
"auto-end",
|
|
251
|
+
"top",
|
|
252
|
+
"top-start",
|
|
253
|
+
"top-end",
|
|
254
|
+
"right",
|
|
255
|
+
"right-start",
|
|
256
|
+
"right-end",
|
|
257
|
+
"bottom",
|
|
258
|
+
"bottom-start",
|
|
259
|
+
"bottom-end",
|
|
260
|
+
"left",
|
|
261
|
+
"left-start",
|
|
262
|
+
"left-end"
|
|
263
|
+
];
|
|
264
|
+
function et(e) {
|
|
265
|
+
e != null && e.closest("svg") || Ie(be.NotContainedInSvg);
|
|
266
|
+
}
|
|
267
|
+
const un = {
|
|
268
|
+
/** Displays a line for each tick. */
|
|
269
|
+
gridLines: !1,
|
|
270
|
+
/** Displays the axis title. */
|
|
271
|
+
withTitle: !0,
|
|
272
|
+
//
|
|
273
|
+
//// Tick settings
|
|
274
|
+
//
|
|
275
|
+
/** Controls if the tick labels should be displayed. */
|
|
276
|
+
showTicks: !0,
|
|
277
|
+
/** Amount of ticks to display in the axis. */
|
|
278
|
+
tickCount: 10,
|
|
279
|
+
/** Formatting string/function for the tick label. */
|
|
280
|
+
tickFormat: null,
|
|
281
|
+
/** Space between the tick label and the axis line. */
|
|
282
|
+
tickPadding: 12,
|
|
283
|
+
/** Horizontal alignment of the tick labels. Only applies to y axes. */
|
|
284
|
+
tickAlign: "end"
|
|
285
|
+
}, Qn = {
|
|
286
|
+
...un,
|
|
287
|
+
withTitle: !1,
|
|
288
|
+
skip: !0
|
|
289
|
+
}, qn = {
|
|
290
|
+
...un,
|
|
291
|
+
gridLines: !0
|
|
292
|
+
}, eo = function(e, n, t) {
|
|
293
|
+
const o = f(() => e.value.step() * e.value.paddingInner() / 2);
|
|
294
|
+
function l(u, s) {
|
|
295
|
+
return {
|
|
296
|
+
transform: `translate(${(e.value(s) ?? e.value(u)) - o.value}, 0)`
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
function i(u) {
|
|
300
|
+
var d;
|
|
301
|
+
const s = Math.max(
|
|
302
|
+
e.value.step(),
|
|
303
|
+
(u ? (d = u.getComputedTextLength) == null ? void 0 : d.call(u) : e.value.step()) + 20
|
|
304
|
+
);
|
|
305
|
+
return {
|
|
306
|
+
x: -(s - e.value.step()) / 2,
|
|
307
|
+
width: s,
|
|
308
|
+
height: t.value.tickPadding + ln + ze
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
function a() {
|
|
312
|
+
const u = e.value.step() / 2;
|
|
313
|
+
return {
|
|
314
|
+
x1: u,
|
|
315
|
+
x2: u,
|
|
316
|
+
y1: -n.value.height
|
|
317
|
+
// Negative height means it goes from bottom to top
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function r() {
|
|
321
|
+
return {
|
|
322
|
+
x: e.value.step() / 2,
|
|
323
|
+
y: t.value.tickPadding,
|
|
324
|
+
dy: "0.8em",
|
|
325
|
+
"text-anchor": "middle"
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
return {
|
|
329
|
+
getGridLinesAttributes: a,
|
|
330
|
+
getTickGhostAttributes: i,
|
|
331
|
+
getTickGroupAttributes: l,
|
|
332
|
+
getTickLabelAttributes: r
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
function Ke(e, n) {
|
|
336
|
+
return e.tickAlign === "start" && n != null;
|
|
337
|
+
}
|
|
338
|
+
const to = function(e, n, t) {
|
|
339
|
+
const o = f(() => e.value.step() * e.value.paddingInner() / 2);
|
|
340
|
+
function l(u, s) {
|
|
341
|
+
return {
|
|
342
|
+
transform: `translate(0, ${(e.value(s) ?? e.value(u)) - o.value})`
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
function i(u, s) {
|
|
346
|
+
var y;
|
|
347
|
+
const d = u ? (y = u.getComputedTextLength) == null ? void 0 : y.call(u) : 42, p = (Ke(t.value, s) ? s : d) + t.value.tickPadding + ze;
|
|
348
|
+
return {
|
|
349
|
+
x: -p,
|
|
350
|
+
width: p,
|
|
351
|
+
height: e.value.step()
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
function a() {
|
|
355
|
+
const u = e.value.step() / 2;
|
|
356
|
+
return {
|
|
357
|
+
y1: u,
|
|
358
|
+
y2: u,
|
|
359
|
+
x1: n.value.width
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
function r(u) {
|
|
363
|
+
const s = Ke(t.value, u);
|
|
364
|
+
return {
|
|
365
|
+
x: -(t.value.tickPadding + (s ? u : 0)),
|
|
366
|
+
y: e.value.step() / 2,
|
|
367
|
+
"text-anchor": s ? "start" : "end",
|
|
368
|
+
"alignment-baseline": "middle"
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
return {
|
|
372
|
+
getGridLinesAttributes: a,
|
|
373
|
+
getTickGhostAttributes: i,
|
|
374
|
+
getTickGroupAttributes: l,
|
|
375
|
+
getTickLabelAttributes: r
|
|
376
|
+
};
|
|
377
|
+
}, no = function(e, n, t) {
|
|
378
|
+
const o = f(() => {
|
|
379
|
+
const u = e.value.ticks();
|
|
380
|
+
return u.length > 1 ? e.value(u[1]) - e.value(u[0]) : 0;
|
|
381
|
+
});
|
|
382
|
+
function l(u) {
|
|
383
|
+
return {
|
|
384
|
+
transform: `translate(${e.value(u)}, 0)`
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
function i() {
|
|
388
|
+
return {
|
|
389
|
+
height: t.value.tickPadding + ln + ze,
|
|
390
|
+
width: o.value,
|
|
391
|
+
x: -(o.value / 2)
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function a() {
|
|
395
|
+
return {
|
|
396
|
+
y1: -n.value.height
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
function r() {
|
|
400
|
+
return {
|
|
401
|
+
y: t.value.tickPadding,
|
|
402
|
+
dy: "0.8em",
|
|
403
|
+
"text-anchor": "middle"
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
return {
|
|
407
|
+
getGridLinesAttributes: a,
|
|
408
|
+
getTickGhostAttributes: i,
|
|
409
|
+
getTickGroupAttributes: l,
|
|
410
|
+
getTickLabelAttributes: r
|
|
411
|
+
};
|
|
412
|
+
}, oo = function(e, n, t) {
|
|
413
|
+
const o = f(() => {
|
|
414
|
+
const u = e.value.ticks();
|
|
415
|
+
return u.length > 1 ? e.value(u[1]) - e.value(u[0]) : 0;
|
|
416
|
+
});
|
|
417
|
+
function l(u) {
|
|
418
|
+
return {
|
|
419
|
+
transform: `translate(0, ${e.value(u)})`
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
function i(u, s) {
|
|
423
|
+
var p;
|
|
424
|
+
const c = (Ke(t.value, s) ? s : ((p = u == null ? void 0 : u.getComputedTextLength) == null ? void 0 : p.call(u)) || 0) + t.value.tickPadding + ze;
|
|
425
|
+
return {
|
|
426
|
+
width: c,
|
|
427
|
+
height: o.value,
|
|
428
|
+
x: -c,
|
|
429
|
+
y: -(o.value / 2)
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
function a() {
|
|
433
|
+
return {
|
|
434
|
+
x1: n.value.width
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
function r(u) {
|
|
438
|
+
const s = Ke(t.value, u);
|
|
439
|
+
return {
|
|
440
|
+
x: -(t.value.tickPadding + (s ? u : 0)),
|
|
441
|
+
dy: "0.4em",
|
|
442
|
+
"text-anchor": s ? "start" : "end"
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
return {
|
|
446
|
+
getGridLinesAttributes: a,
|
|
447
|
+
getTickGhostAttributes: i,
|
|
448
|
+
getTickGroupAttributes: l,
|
|
449
|
+
getTickLabelAttributes: r
|
|
450
|
+
};
|
|
451
|
+
}, ao = {
|
|
452
|
+
"x-band-scale-axis": eo,
|
|
453
|
+
"y-band-scale-axis": to,
|
|
454
|
+
"x-linear-scale-axis": no,
|
|
455
|
+
"y-linear-scale-axis": oo
|
|
456
|
+
}, lo = ["transform"], uo = { key: 0 }, ro = /* @__PURE__ */ P("linearGradient", { id: "lume-tick-gradient" }, [
|
|
457
|
+
/* @__PURE__ */ P("stop", {
|
|
458
|
+
offset: "0%",
|
|
459
|
+
"stop-color": "rgba(255,255,255,0)"
|
|
460
|
+
}),
|
|
461
|
+
/* @__PURE__ */ P("stop", {
|
|
462
|
+
offset: "10%",
|
|
463
|
+
"stop-color": "var(--lume-chart-background-color)"
|
|
464
|
+
}),
|
|
465
|
+
/* @__PURE__ */ P("stop", {
|
|
466
|
+
offset: "90%",
|
|
467
|
+
"stop-color": "var(--lume-chart-background-color)"
|
|
468
|
+
}),
|
|
469
|
+
/* @__PURE__ */ P("stop", {
|
|
470
|
+
offset: "100%",
|
|
471
|
+
"stop-color": "rgba(255,255,255,0)"
|
|
472
|
+
})
|
|
473
|
+
], -1), io = [
|
|
474
|
+
ro
|
|
475
|
+
];
|
|
476
|
+
var rn = /* @__PURE__ */ ((e) => (e.bandScale = "band-scale-axis", e.linearScale = "linear-scale-axis", e))(rn || {}), sn = /* @__PURE__ */ ((e) => (e.left = "left", e.bottom = "bottom", e))(sn || {}), rt = /* @__PURE__ */ ((e) => (e.x = "bottom", e.y = "left", e))(rt || {});
|
|
477
|
+
const Bt = /* @__PURE__ */ Q({
|
|
478
|
+
__name: "lume-axis",
|
|
479
|
+
props: {
|
|
480
|
+
scale: {
|
|
481
|
+
type: Function,
|
|
482
|
+
default: null
|
|
483
|
+
},
|
|
484
|
+
type: {
|
|
485
|
+
type: String,
|
|
486
|
+
default: void 0,
|
|
487
|
+
validator: (e) => e in rt
|
|
488
|
+
},
|
|
489
|
+
position: {
|
|
490
|
+
type: String,
|
|
491
|
+
default: void 0,
|
|
492
|
+
validator: (e) => e in sn
|
|
493
|
+
},
|
|
494
|
+
containerSize: {
|
|
495
|
+
type: Object,
|
|
496
|
+
default: () => ({ width: 0, height: 0 })
|
|
497
|
+
},
|
|
498
|
+
hoveredIndex: {
|
|
499
|
+
type: Number,
|
|
500
|
+
default: -1
|
|
501
|
+
},
|
|
502
|
+
orientation: {
|
|
503
|
+
type: String,
|
|
504
|
+
default: S.VERTICAL
|
|
505
|
+
},
|
|
506
|
+
...Ve()
|
|
507
|
+
},
|
|
508
|
+
emits: ["mouseenter", "click", "mouseleave", "lume__internal--axis-size", "lume__internal--axis-overflow"],
|
|
509
|
+
setup(e, { emit: n }) {
|
|
510
|
+
const l = e, i = n, { scale: a, containerSize: r, hoveredIndex: u, options: s, orientation: d } = ie(l), c = Qe("isEmpty", C(!1)), p = qe({}), y = C(null), A = C(null), k = C(null), x = f(
|
|
511
|
+
() => l.type ? rt[l.type] : l.position
|
|
512
|
+
), g = f(
|
|
513
|
+
() => l.type || (x.value === "left" ? "y" : "x")
|
|
514
|
+
), _ = f(
|
|
515
|
+
() => g.value === "x" && d.value === S.VERTICAL || g.value === "y" && d.value === S.HORIZONTAL
|
|
516
|
+
), { allOptions: m } = Ae(
|
|
517
|
+
s,
|
|
518
|
+
g.value === "x" ? Qn : qn
|
|
519
|
+
), { showTick: T } = Xn(a, y, m), N = f(
|
|
520
|
+
() => c.value || !a.value || Cn(a.value)
|
|
521
|
+
), E = f(() => {
|
|
522
|
+
var D, R, H, ne;
|
|
523
|
+
return g.value === "y" && N.value ? `translate(0, ${((D = r.value) == null ? void 0 : D.height) / 2})` : g.value === "x" && N.value ? `translate(-${((R = r.value) == null ? void 0 : R.width) / 2}, ${(H = r.value) == null ? void 0 : H.height})` : `translate(0, ${g.value === "x" ? (ne = r.value) == null ? void 0 : ne.height : 0})`;
|
|
524
|
+
}), M = f(() => {
|
|
525
|
+
if (!a.value) return [];
|
|
526
|
+
if (pe(a.value))
|
|
527
|
+
return a.value.labels || a.value.domain();
|
|
528
|
+
const { tickCount: D } = m.value, [R, H] = a.value.domain();
|
|
529
|
+
return xn(R, H, D);
|
|
530
|
+
}), G = f(() => {
|
|
531
|
+
const { tickFormat: D } = m.value;
|
|
532
|
+
return Ye(D);
|
|
533
|
+
}), te = f(
|
|
534
|
+
() => m.value.withHover && _.value && u.value > -1
|
|
535
|
+
), B = f(
|
|
536
|
+
() => m.value.tickPadding + ze || 16
|
|
537
|
+
), q = f(() => g.value === "x" ? (
|
|
538
|
+
// If x axis, get the tick height
|
|
539
|
+
Math.max(
|
|
540
|
+
...(y.value || []).map(
|
|
541
|
+
(D) => {
|
|
542
|
+
var R, H;
|
|
543
|
+
return ((H = (R = D.ref).getBBox) == null ? void 0 : H.call(R).height) + B.value;
|
|
544
|
+
}
|
|
545
|
+
)
|
|
546
|
+
)
|
|
547
|
+
) : (
|
|
548
|
+
// If y axis, get the tick width
|
|
549
|
+
Math.max(
|
|
550
|
+
...(y.value || []).map(
|
|
551
|
+
(D) => {
|
|
552
|
+
var R, H;
|
|
553
|
+
return ((H = (R = D.ref).getBBox) == null ? void 0 : H.call(R).width) + B.value;
|
|
554
|
+
}
|
|
555
|
+
)
|
|
556
|
+
)
|
|
557
|
+
)), X = f(() => {
|
|
558
|
+
var ne, se, ye, Me;
|
|
559
|
+
if (g.value !== "x" || !a.value || !M.value.length)
|
|
560
|
+
return 0;
|
|
561
|
+
const D = M.value.length - 1, R = (Me = (ye = (se = (ne = y.value) == null ? void 0 : ne[D]) == null ? void 0 : se.ref) == null ? void 0 : ye.getBBox) == null ? void 0 : Me.call(ye).width;
|
|
562
|
+
if (!R) return 0;
|
|
563
|
+
const H = pe(a.value) ? (a.value(D) ?? a.value(M.value[D])) + a.value.bandwidth() / 2 : a.value(M.value[D]);
|
|
564
|
+
return Math.max(
|
|
565
|
+
0,
|
|
566
|
+
Math.ceil(
|
|
567
|
+
H + R / 2 + 2 - r.value.width
|
|
568
|
+
)
|
|
569
|
+
);
|
|
570
|
+
});
|
|
571
|
+
function Y(D) {
|
|
572
|
+
const { showTicks: R } = m.value;
|
|
573
|
+
return R === !1 ? "" : G.value(D);
|
|
574
|
+
}
|
|
575
|
+
function le(D, R, H) {
|
|
576
|
+
i("mouseenter", { index: _.value ? D : null, value: R, event: H });
|
|
577
|
+
}
|
|
578
|
+
function re(D, R, H) {
|
|
579
|
+
i("click", { index: D, value: R, event: H });
|
|
580
|
+
}
|
|
581
|
+
function Le(D) {
|
|
582
|
+
var R;
|
|
583
|
+
if (!(!y.value || !y.value.length))
|
|
584
|
+
return (R = y.value[D]) == null ? void 0 : R.ref;
|
|
585
|
+
}
|
|
586
|
+
function Re() {
|
|
587
|
+
const D = (y.value || []).map((R) => {
|
|
588
|
+
var H, ne;
|
|
589
|
+
return (ne = (H = R.ref) == null ? void 0 : H.getComputedTextLength) == null ? void 0 : ne.call(H);
|
|
590
|
+
}).filter((R) => R != null);
|
|
591
|
+
return D.length ? Math.max(...D) : void 0;
|
|
592
|
+
}
|
|
593
|
+
function Ne() {
|
|
594
|
+
const D = Re();
|
|
595
|
+
k.value = M.value.map(
|
|
596
|
+
(R, H) => ({
|
|
597
|
+
value: Y(R),
|
|
598
|
+
group: p.getTickGroupAttributes(R, H),
|
|
599
|
+
ghost: p.getTickGhostAttributes(Le(H), D),
|
|
600
|
+
label: p.getTickLabelAttributes(D),
|
|
601
|
+
gridline: p.getGridLinesAttributes()
|
|
602
|
+
})
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
function He() {
|
|
606
|
+
k.value && k.value.map((D) => (D.gridline = p.getGridLinesAttributes(), D));
|
|
607
|
+
}
|
|
608
|
+
function Te() {
|
|
609
|
+
if (!a.value) return;
|
|
610
|
+
const D = a.value.step ? "bandScale" : "linearScale", R = ao[`${g.value}-${rn[D]}`];
|
|
611
|
+
Object.entries(R(a, r, m) || []).forEach(
|
|
612
|
+
([H, ne]) => {
|
|
613
|
+
p[H] = ne;
|
|
614
|
+
}
|
|
615
|
+
);
|
|
616
|
+
}
|
|
617
|
+
return U(a, Te, { flush: "sync", immediate: !0 }), U(a, Ne, { immediate: !0 }), U(y, Ne), U(q, (D) => i("lume__internal--axis-size", D)), U(X, (D) => i("lume__internal--axis-overflow", D)), U(l.containerSize, He), xe(() => et(A.value)), (D, R) => v(a) ? (b(), O("g", {
|
|
618
|
+
key: 0,
|
|
619
|
+
ref_key: "root",
|
|
620
|
+
ref: A,
|
|
621
|
+
class: "axis",
|
|
622
|
+
transform: E.value,
|
|
623
|
+
"data-j-axis": "",
|
|
624
|
+
onMouseleave: R[1] || (R[1] = (H) => i("mouseleave", H))
|
|
625
|
+
}, [
|
|
626
|
+
g.value === "x" ? (b(), O("defs", uo, io)) : K("", !0),
|
|
627
|
+
(b(!0), O(oe, null, J(k.value, (H, ne) => (b(), ee(v(Et), W({
|
|
628
|
+
key: `${H.value}_${ne}`,
|
|
629
|
+
ref_for: !0,
|
|
630
|
+
ref_key: "tickRefs",
|
|
631
|
+
ref: y
|
|
632
|
+
}, H, {
|
|
633
|
+
"is-hidden": v(m).skip && !v(T)(ne),
|
|
634
|
+
"with-gridlines": v(m).gridLines,
|
|
635
|
+
onMouseenter: (se) => le(ne, H.value, se),
|
|
636
|
+
onClick: (se) => re(ne, H.value, se)
|
|
637
|
+
}), null, 16, ["is-hidden", "with-gridlines", "onMouseenter", "onClick"]))), 128)),
|
|
638
|
+
te.value ? (b(), ee(v(Et), W({ key: 1 }, k.value[v(u)], {
|
|
639
|
+
"with-gridlines": !1,
|
|
640
|
+
"is-hovered": "",
|
|
641
|
+
onClick: R[0] || (R[0] = (H) => re(
|
|
642
|
+
v(u),
|
|
643
|
+
k.value[v(u)].value,
|
|
644
|
+
H
|
|
645
|
+
))
|
|
646
|
+
}), null, 16)) : K("", !0)
|
|
647
|
+
], 40, lo)) : K("", !0);
|
|
648
|
+
}
|
|
649
|
+
});
|
|
650
|
+
function so(e, n, t, o) {
|
|
651
|
+
const l = f(() => t.value > 0 && t.value < 1), i = f(
|
|
652
|
+
() => o.value > 0 && o.value < 1
|
|
653
|
+
), a = f(
|
|
654
|
+
() => l.value ? e.value - 0.5 : e.value
|
|
655
|
+
// draws the 1px bar closer to the axis
|
|
656
|
+
), r = f(
|
|
657
|
+
() => i.value ? n.value - 0.5 : n.value
|
|
658
|
+
// draws the 1px bar closer to the axis
|
|
659
|
+
);
|
|
660
|
+
return { computedX: a, computedY: r, shouldHaveMinWidth: l, shouldHaveMinHeight: i };
|
|
661
|
+
}
|
|
662
|
+
function co(e, n, t, o) {
|
|
663
|
+
const l = C(0), i = C(0), a = f(() => `${e.value + t.value / 2}px ${n.value + o.value / 2}px`);
|
|
664
|
+
return xe(() => {
|
|
665
|
+
l.value = t.value, i.value = o.value;
|
|
666
|
+
}), U(t, (r) => l.value = r), U(o, (r) => i.value = r), { computedWidth: l, computedHeight: i, transformOrigin: a };
|
|
667
|
+
}
|
|
668
|
+
const vo = ["x", "y", "width", "height"], fo = /* @__PURE__ */ Q({
|
|
669
|
+
__name: "lume-bar",
|
|
670
|
+
props: {
|
|
671
|
+
x: {
|
|
672
|
+
type: Number,
|
|
673
|
+
default: 0
|
|
674
|
+
},
|
|
675
|
+
y: {
|
|
676
|
+
type: Number,
|
|
677
|
+
default: 0
|
|
678
|
+
},
|
|
679
|
+
width: {
|
|
680
|
+
type: Number,
|
|
681
|
+
required: !0
|
|
682
|
+
},
|
|
683
|
+
height: {
|
|
684
|
+
type: Number,
|
|
685
|
+
required: !0
|
|
686
|
+
},
|
|
687
|
+
classList: {
|
|
688
|
+
type: [String, Array],
|
|
689
|
+
default: ""
|
|
690
|
+
},
|
|
691
|
+
isFaded: {
|
|
692
|
+
type: Boolean,
|
|
693
|
+
default: !1
|
|
694
|
+
},
|
|
695
|
+
isNegative: {
|
|
696
|
+
type: Boolean,
|
|
697
|
+
default: !1
|
|
698
|
+
},
|
|
699
|
+
transition: {
|
|
700
|
+
type: [String, Boolean],
|
|
701
|
+
default: !1
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
emits: ["click", "mouseover", "mouseleave"],
|
|
705
|
+
setup(e, { emit: n }) {
|
|
706
|
+
const t = e, o = n, { x: l, y: i, width: a, height: r, transition: u, classList: s } = ie(t), d = C(null), c = f(
|
|
707
|
+
() => typeof s.value == "string" ? [s.value] : s.value
|
|
708
|
+
), p = f(() => u.value === "width"), y = f(() => u.value === "height"), A = co(l, i, a, r), { computedX: k, computedY: x, shouldHaveMinWidth: g, shouldHaveMinHeight: _ } = so(l, i, a, r), m = f(() => g.value ? 1 : (p.value ? A.computedWidth : a).value), T = f(() => _.value ? 1 : (y.value ? A.computedHeight : r).value), N = p.value || y.value ? A.transformOrigin : null;
|
|
709
|
+
return xe(() => et(d.value)), (E, M) => (b(), O("rect", {
|
|
710
|
+
ref_key: "root",
|
|
711
|
+
ref: d,
|
|
712
|
+
class: ue(["lume-bar", [
|
|
713
|
+
{
|
|
714
|
+
"lume-fill--faded": e.isFaded,
|
|
715
|
+
"lume-bar--negative": e.isNegative,
|
|
716
|
+
"lume-bar--transition-width": p.value,
|
|
717
|
+
"lume-bar--transition-height": y.value
|
|
718
|
+
},
|
|
719
|
+
...c.value
|
|
720
|
+
]]),
|
|
721
|
+
style: Yt({ transformOrigin: v(N) }),
|
|
722
|
+
x: v(k),
|
|
723
|
+
y: v(x),
|
|
724
|
+
width: m.value,
|
|
725
|
+
height: T.value,
|
|
726
|
+
"data-j-bar": "",
|
|
727
|
+
onClick: M[0] || (M[0] = (G) => o("click", G)),
|
|
728
|
+
onMouseover: M[1] || (M[1] = (G) => o("mouseover", G)),
|
|
729
|
+
onMouseleave: M[2] || (M[2] = (G) => o("mouseleave", G))
|
|
730
|
+
}, null, 46, vo));
|
|
731
|
+
}
|
|
732
|
+
}), yt = /* @__PURE__ */ ae(fo, [["__scopeId", "data-v-8e8f732a"]]);
|
|
733
|
+
var Ee = /* @__PURE__ */ ((e) => (e.Categorical = "categorical", e.Sequential = "sequential", e.Divergent = "divergent", e))(Ee || {}), he = /* @__PURE__ */ ((e) => (e.Skyblue = "skyblue", e.Royalblue = "royalblue", e.Violet = "violet", e.Darkteal = "darkteal", e.Gold = "gold", e))(he || {}), cn = /* @__PURE__ */ ((e) => (e.Skyblue10 = "skyblue-10", e.Skyblue20 = "skyblue-20", e.Skyblue30 = "skyblue-30", e.Skyblue40 = "skyblue-40", e.Skyblue50 = "skyblue-50", e.Skyblue60 = "skyblue-60", e.Skyblue70 = "skyblue-70", e.Skyblue80 = "skyblue-80", e.Skyblue90 = "skyblue-90", e.Skyblue100 = "skyblue-100", e.Royalblue10 = "royalblue-10", e.Royalblue20 = "royalblue-20", e.Royalblue30 = "royalblue-30", e.Royalblue40 = "royalblue-40", e.Royalblue50 = "royalblue-50", e.Royalblue60 = "royalblue-60", e.Royalblue70 = "royalblue-70", e.Royalblue80 = "royalblue-80", e.Royalblue90 = "royalblue-90", e.Royalblue100 = "royalblue-100", e.Violet10 = "violet-10", e.Violet20 = "violet-20", e.Violet30 = "violet-30", e.Violet40 = "violet-40", e.Violet50 = "violet-50", e.Violet60 = "violet-60", e.Violet70 = "violet-70", e.Violet80 = "violet-80", e.Violet90 = "violet-90", e.Violet100 = "violet-100", e.Darkteal10 = "darkteal-10", e.Darkteal20 = "darkteal-20", e.Darkteal30 = "darkteal-30", e.Darkteal40 = "darkteal-40", e.Darkteal50 = "darkteal-50", e.Darkteal60 = "darkteal-60", e.Darkteal70 = "darkteal-70", e.Darkteal80 = "darkteal-80", e.Darkteal90 = "darkteal-90", e.Darkteal100 = "darkteal-100", e.Gold10 = "gold-10", e.Gold20 = "gold-20", e.Gold30 = "gold-30", e.Gold40 = "gold-40", e.Gold50 = "gold-50", e.Gold60 = "gold-60", e.Gold70 = "gold-70", e.Gold80 = "gold-80", e.Gold90 = "gold-90", e.Gold100 = "gold-100", e))(cn || {}), _t = /* @__PURE__ */ ((e) => (e.SkyTeal = "skyblue-darkteal", e.VioletRoyal = "violet-royalblue", e.VioletTeal = "violet-darkteal", e.GoldTeal = "gold-darkteal", e.GoldRoyal = "gold-royalblue", e))(_t || {}), kt = /* @__PURE__ */ ((e) => (e.White = "white", e.Black = "black", e.Green = "green", e.Yellow = "yellow", e.Orange = "orange", e.Red = "red", e.Grey = "grey", e.Grey10 = "grey-10", e.Grey20 = "grey-20", e.Grey30 = "grey-30", e.Grey40 = "grey-40", e.Grey50 = "grey-50", e.Grey60 = "grey-60", e.Grey70 = "grey-70", e.Grey80 = "grey-80", e.Grey90 = "grey-90", e.Grey100 = "grey-100", e))(kt || {}), bt = /* @__PURE__ */ ((e) => (e["01"] = "01", e["02"] = "02", e["03"] = "03", e["04"] = "04", e["05"] = "05", e["06"] = "06", e["07"] = "07", e["08"] = "08", e["09"] = "09", e))(bt || {});
|
|
734
|
+
const mo = Ee.Categorical, We = he.Skyblue, go = _t.SkyTeal;
|
|
735
|
+
function po(e) {
|
|
736
|
+
return e === Ee.Divergent ? go : We;
|
|
737
|
+
}
|
|
738
|
+
function ho(e) {
|
|
739
|
+
return Object.values(bt).includes(e);
|
|
740
|
+
}
|
|
741
|
+
function Rt(e, n) {
|
|
742
|
+
return n === Ee.Divergent ? Object.values(_t).includes(e) : Object.values({
|
|
743
|
+
...he,
|
|
744
|
+
...cn,
|
|
745
|
+
...kt,
|
|
746
|
+
...bt
|
|
747
|
+
}).includes(e);
|
|
748
|
+
}
|
|
749
|
+
function yo(e, n) {
|
|
750
|
+
const t = Object.values(he).indexOf(e);
|
|
751
|
+
return zn(Object.values(he), t > -1 ? t : 0)[n];
|
|
752
|
+
}
|
|
753
|
+
function _o(e, n) {
|
|
754
|
+
const t = 50 + n * 10;
|
|
755
|
+
return `${e}-${t}`;
|
|
756
|
+
}
|
|
757
|
+
function ko(e, n) {
|
|
758
|
+
const t = (n + 1) * 10;
|
|
759
|
+
return `${e}-${t}`;
|
|
760
|
+
}
|
|
761
|
+
function Ht(e, n, t) {
|
|
762
|
+
switch (n) {
|
|
763
|
+
default:
|
|
764
|
+
case Ee.Categorical:
|
|
765
|
+
return ho(e) ? e : yo(e, t);
|
|
766
|
+
case Ee.Sequential:
|
|
767
|
+
return _o(e, t);
|
|
768
|
+
case Ee.Divergent:
|
|
769
|
+
return ko(e, t);
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
function bo(e, n, t = mo, o) {
|
|
773
|
+
return Rt(e, t) ? e : (o > 4 && (Ie(be.ColorLoop), o = o % 5), Rt(n, t) ? Ht(n, t, o) : Ht(po(t), t, o));
|
|
774
|
+
}
|
|
775
|
+
function Ao(e) {
|
|
776
|
+
return e.map((n) => Sn(n) ? n : { value: n });
|
|
777
|
+
}
|
|
778
|
+
function Lo(e) {
|
|
779
|
+
return e.__internal === !0;
|
|
780
|
+
}
|
|
781
|
+
const At = (e = null) => ({
|
|
782
|
+
data: {
|
|
783
|
+
type: Array,
|
|
784
|
+
required: !0,
|
|
785
|
+
validator: e || void 0
|
|
786
|
+
},
|
|
787
|
+
labels: {
|
|
788
|
+
type: Array,
|
|
789
|
+
default: void 0
|
|
790
|
+
},
|
|
791
|
+
color: {
|
|
792
|
+
type: String,
|
|
793
|
+
default: he.Skyblue
|
|
794
|
+
},
|
|
795
|
+
title: {
|
|
796
|
+
type: String,
|
|
797
|
+
default: null
|
|
798
|
+
}
|
|
799
|
+
});
|
|
800
|
+
function Lt(e, n, t, o, l) {
|
|
801
|
+
const i = qe({
|
|
802
|
+
width: 0,
|
|
803
|
+
height: 0
|
|
804
|
+
}), a = crypto.randomUUID(), r = f(() => {
|
|
805
|
+
var d;
|
|
806
|
+
return e.value.length > 5 && Ie(be.DatasetLength), (d = e.value) == null ? void 0 : d.map(
|
|
807
|
+
(c, p) => {
|
|
808
|
+
if (Lo(c)) return c;
|
|
809
|
+
const y = Ao(c.values), A = bo(
|
|
810
|
+
c.color,
|
|
811
|
+
t == null ? void 0 : t.value,
|
|
812
|
+
o == null ? void 0 : o.value.colorPalette,
|
|
813
|
+
p
|
|
814
|
+
);
|
|
815
|
+
return {
|
|
816
|
+
...c,
|
|
817
|
+
values: y,
|
|
818
|
+
color: A,
|
|
819
|
+
__internal: !0
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
);
|
|
823
|
+
}), u = f(() => Array.isArray(n.value) ? n.value : tn(e.value).map((d, c) => c));
|
|
824
|
+
function s(d) {
|
|
825
|
+
const c = (l == null ? void 0 : l.value) === S.HORIZONTAL && u.value.length * (((o == null ? void 0 : o.value.barHeight) || Dt) * 2) + ((o == null ? void 0 : o.value.barHeight) || Dt) || d.height;
|
|
826
|
+
i.width = d.width, i.height = c;
|
|
827
|
+
}
|
|
828
|
+
return {
|
|
829
|
+
chartID: a,
|
|
830
|
+
computedLabels: u,
|
|
831
|
+
containerSize: i,
|
|
832
|
+
internalData: r,
|
|
833
|
+
updateSize: s
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
const To = () => ({
|
|
837
|
+
xScale: {
|
|
838
|
+
type: Function,
|
|
839
|
+
default: null
|
|
840
|
+
},
|
|
841
|
+
yScale: {
|
|
842
|
+
type: Function,
|
|
843
|
+
default: null
|
|
844
|
+
}
|
|
845
|
+
});
|
|
846
|
+
function $o(e, n, t, o, l) {
|
|
847
|
+
const i = C(null), a = C(null);
|
|
848
|
+
function r() {
|
|
849
|
+
var d, c, p, y;
|
|
850
|
+
const { width: u, height: s } = t;
|
|
851
|
+
!u && !s || (o.value === S.HORIZONTAL ? (i.value = (d = e.value) != null && d.length ? St(
|
|
852
|
+
e.value,
|
|
853
|
+
u,
|
|
854
|
+
o.value,
|
|
855
|
+
l.value.startOnZero
|
|
856
|
+
) : null, a.value = (c = n.value) != null && c.length ? Mt(
|
|
857
|
+
n.value,
|
|
858
|
+
s,
|
|
859
|
+
o.value,
|
|
860
|
+
l.value
|
|
861
|
+
) : null) : (i.value = (p = n.value) != null && p.length ? Mt(
|
|
862
|
+
n.value,
|
|
863
|
+
u,
|
|
864
|
+
o.value,
|
|
865
|
+
l.value
|
|
866
|
+
) : null, a.value = (y = e.value) != null && y.length ? St(
|
|
867
|
+
e.value,
|
|
868
|
+
s,
|
|
869
|
+
o.value,
|
|
870
|
+
l.value.startOnZero
|
|
871
|
+
) : null));
|
|
872
|
+
}
|
|
873
|
+
return Kt(r), { xScale: i, yScale: a };
|
|
874
|
+
}
|
|
875
|
+
function Mt(e, n, t, o) {
|
|
876
|
+
const l = [0, n], { padding: i, paddingInner: a, paddingOuter: r } = o, u = i ?? (t === S.HORIZONTAL ? an : on);
|
|
877
|
+
return Object.assign(
|
|
878
|
+
Pe().range(l).paddingInner(a ?? u).paddingOuter(r ?? u).domain(e.map((s, d) => d)),
|
|
879
|
+
{ labels: e }
|
|
880
|
+
);
|
|
881
|
+
}
|
|
882
|
+
function St(e, n, t, o) {
|
|
883
|
+
const l = qt(e).filter((d) => d != null), i = [0, n];
|
|
884
|
+
if (l.length === 0)
|
|
885
|
+
return je().range(i).domain([0, 0]).nice();
|
|
886
|
+
const a = Math.min(...l), r = o && a > 0 ? 0 : a;
|
|
887
|
+
let u = Math.max(...l);
|
|
888
|
+
o && u < 0 && (u = 0);
|
|
889
|
+
const s = t === S.HORIZONTAL ? [r, u] : [u, r];
|
|
890
|
+
return je().range(i).domain(s).nice();
|
|
891
|
+
}
|
|
892
|
+
function Gt(e) {
|
|
893
|
+
return (e == null ? void 0 : e.range) !== void 0 || (e == null ? void 0 : e.copy) !== void 0;
|
|
894
|
+
}
|
|
895
|
+
function it(e, n) {
|
|
896
|
+
return pe(e) ? e.bandwidth() / 2 + e(e.domain()[n]) : e(n);
|
|
897
|
+
}
|
|
898
|
+
function Ct(e, n, {
|
|
899
|
+
padding: t,
|
|
900
|
+
paddingInner: o,
|
|
901
|
+
paddingOuter: l
|
|
902
|
+
} = {}) {
|
|
903
|
+
const i = t ?? (n === S.HORIZONTAL ? an : on);
|
|
904
|
+
return e.copy().paddingInner(o ?? i).paddingOuter(l ?? i);
|
|
905
|
+
}
|
|
906
|
+
function Tt(e) {
|
|
907
|
+
return Object.values(S).includes(e);
|
|
908
|
+
}
|
|
909
|
+
const Ge = (e, n = !0) => ({
|
|
910
|
+
...At(e),
|
|
911
|
+
...To(),
|
|
912
|
+
...Ve(),
|
|
913
|
+
classList: {
|
|
914
|
+
type: [String, Array],
|
|
915
|
+
default: () => []
|
|
916
|
+
},
|
|
917
|
+
hoveredIndex: {
|
|
918
|
+
type: Number,
|
|
919
|
+
default: null
|
|
920
|
+
},
|
|
921
|
+
...n ? {
|
|
922
|
+
orientation: {
|
|
923
|
+
type: String,
|
|
924
|
+
default: S.VERTICAL,
|
|
925
|
+
validator: Tt
|
|
926
|
+
}
|
|
927
|
+
} : {}
|
|
928
|
+
}), wo = (e) => ({
|
|
929
|
+
...At(e),
|
|
930
|
+
...Ve(),
|
|
931
|
+
hoveredElement: {
|
|
932
|
+
type: [Number, String],
|
|
933
|
+
default: null
|
|
934
|
+
}
|
|
935
|
+
});
|
|
936
|
+
function Io() {
|
|
937
|
+
const e = C(), n = qe({
|
|
938
|
+
dimensions: {}
|
|
939
|
+
}), t = new ResizeObserver((o) => {
|
|
940
|
+
o.forEach((l) => {
|
|
941
|
+
n.dimensions = l.contentRect;
|
|
942
|
+
});
|
|
943
|
+
});
|
|
944
|
+
return xe(() => {
|
|
945
|
+
t.observe(e.value);
|
|
946
|
+
}), Jt(() => {
|
|
947
|
+
t.unobserve(e.value);
|
|
948
|
+
}), { resizeState: n, resizeRef: e };
|
|
949
|
+
}
|
|
950
|
+
const xo = ["height"], Oo = ["transform"], No = /* @__PURE__ */ Q({
|
|
951
|
+
__name: "lume-chart-container",
|
|
952
|
+
props: {
|
|
953
|
+
margins: {
|
|
954
|
+
type: Object,
|
|
955
|
+
required: !0
|
|
956
|
+
},
|
|
957
|
+
containerSize: {
|
|
958
|
+
type: Object,
|
|
959
|
+
default: () => ({ width: 0, height: 0 })
|
|
960
|
+
},
|
|
961
|
+
transparentBackground: {
|
|
962
|
+
type: Boolean,
|
|
963
|
+
default: !1
|
|
964
|
+
},
|
|
965
|
+
noMinSize: {
|
|
966
|
+
type: Boolean,
|
|
967
|
+
default: !1
|
|
968
|
+
},
|
|
969
|
+
orientation: {
|
|
970
|
+
type: String,
|
|
971
|
+
default: S.VERTICAL,
|
|
972
|
+
validator: Tt
|
|
973
|
+
}
|
|
974
|
+
},
|
|
975
|
+
emits: ["click", "mouseenter", "mouseleave", "resize"],
|
|
976
|
+
setup(e, { emit: n }) {
|
|
977
|
+
const t = e, o = n, { margins: l, containerSize: i } = ie(t), a = C(null), { resizeRef: r, resizeState: u } = Io(), s = f(
|
|
978
|
+
() => i.value.height + l.value.top + l.value.bottom
|
|
979
|
+
);
|
|
980
|
+
return Kt(() => {
|
|
981
|
+
if (!a.value) return;
|
|
982
|
+
const { width: d } = u.dimensions, { height: c } = a.value.getBoundingClientRect();
|
|
983
|
+
if (!d || t.orientation === S.VERTICAL && !c)
|
|
984
|
+
return;
|
|
985
|
+
const p = d - l.value.left - l.value.right, y = c - l.value.top - l.value.bottom, A = {
|
|
986
|
+
width: p > 0 ? p : 0,
|
|
987
|
+
height: y > 0 ? y : 0,
|
|
988
|
+
outerWidth: d,
|
|
989
|
+
outerHeight: c
|
|
990
|
+
};
|
|
991
|
+
o("resize", A);
|
|
992
|
+
}), (d, c) => (b(), O("div", {
|
|
993
|
+
ref_key: "resizeRef",
|
|
994
|
+
ref: r,
|
|
995
|
+
class: ue(["lume-chart-container", {
|
|
996
|
+
"lume-chart-container--minimum": !e.noMinSize
|
|
997
|
+
}]),
|
|
998
|
+
"data-j-chart-container": ""
|
|
999
|
+
}, [
|
|
1000
|
+
F(d.$slots, "header", {}, void 0, !0),
|
|
1001
|
+
(b(), O("svg", {
|
|
1002
|
+
ref_key: "root",
|
|
1003
|
+
ref: a,
|
|
1004
|
+
class: ue(["lume-chart-container__svg", {
|
|
1005
|
+
"lume-chart-container__svg--transparent": e.transparentBackground
|
|
1006
|
+
}]),
|
|
1007
|
+
height: s.value,
|
|
1008
|
+
"data-j-chart-container__root": "",
|
|
1009
|
+
onClick: c[0] || (c[0] = (p) => o("click", p)),
|
|
1010
|
+
onMouseenter: c[1] || (c[1] = (p) => o("mouseenter", p)),
|
|
1011
|
+
onMouseleave: c[2] || (c[2] = (p) => o("mouseleave", p))
|
|
1012
|
+
}, [
|
|
1013
|
+
P("g", {
|
|
1014
|
+
transform: `translate(${v(l).left}, ${v(l).top})`,
|
|
1015
|
+
class: "lume-chart-container__group",
|
|
1016
|
+
"data-j-chart-container__group": ""
|
|
1017
|
+
}, [
|
|
1018
|
+
F(d.$slots, "default", {}, void 0, !0)
|
|
1019
|
+
], 8, Oo)
|
|
1020
|
+
], 42, xo)),
|
|
1021
|
+
F(d.$slots, "footer", {}, void 0, !0),
|
|
1022
|
+
F(d.$slots, "extra", {}, void 0, !0)
|
|
1023
|
+
], 2));
|
|
1024
|
+
}
|
|
1025
|
+
}), Eo = /* @__PURE__ */ ae(No, [["__scopeId", "data-v-d53cdc3e"]]), Do = ["onClick", "onMouseenter"], Bo = /* @__PURE__ */ Q({
|
|
1026
|
+
__name: "lume-chart-legend",
|
|
1027
|
+
props: {
|
|
1028
|
+
data: {
|
|
1029
|
+
type: Array,
|
|
1030
|
+
validator: Mn,
|
|
1031
|
+
required: !0
|
|
1032
|
+
}
|
|
1033
|
+
},
|
|
1034
|
+
emits: ["click", "mouseenter", "mouseleave"],
|
|
1035
|
+
setup(e, { emit: n }) {
|
|
1036
|
+
const t = n;
|
|
1037
|
+
return (o, l) => (b(), O("div", {
|
|
1038
|
+
class: "lume-chart-legend",
|
|
1039
|
+
"data-j-chart-legend": "",
|
|
1040
|
+
onMouseleave: l[0] || (l[0] = (i) => t("mouseleave"))
|
|
1041
|
+
}, [
|
|
1042
|
+
(b(!0), O(oe, null, J(e.data, (i, a) => (b(), O("div", {
|
|
1043
|
+
key: `legend-item-${a}`,
|
|
1044
|
+
class: "lume-chart-legend__item lume-typography--caption",
|
|
1045
|
+
tabindex: "0",
|
|
1046
|
+
"data-j-chart-legend__symbol-wrapper": "",
|
|
1047
|
+
onClick: (r) => t("click", { index: a, dataset: i, event: r }),
|
|
1048
|
+
onMouseenter: (r) => t("mouseenter", { index: a, dataset: i, event: r })
|
|
1049
|
+
}, [
|
|
1050
|
+
P("span", {
|
|
1051
|
+
class: ue(["lume-chart-legend__symbol", `lume-background-color--${i.color}`]),
|
|
1052
|
+
"data-j-chart-legend__symbol": ""
|
|
1053
|
+
}, null, 2),
|
|
1054
|
+
_e(" " + ce(i.label || a), 1)
|
|
1055
|
+
], 40, Do))), 128))
|
|
1056
|
+
], 32));
|
|
1057
|
+
}
|
|
1058
|
+
}), Ft = /* @__PURE__ */ ae(Bo, [["__scopeId", "data-v-6f1d1c44"]]), Ro = {}, Ho = {
|
|
1059
|
+
class: "lume-tooltip__title",
|
|
1060
|
+
"data-j-tooltip__title": ""
|
|
1061
|
+
};
|
|
1062
|
+
function Mo(e, n) {
|
|
1063
|
+
return b(), O("div", Ho, [
|
|
1064
|
+
F(e.$slots, "default", {}, void 0, !0)
|
|
1065
|
+
]);
|
|
1066
|
+
}
|
|
1067
|
+
const So = /* @__PURE__ */ ae(Ro, [["render", Mo], ["__scopeId", "data-v-8af3fac6"]]), Go = {}, Co = {
|
|
1068
|
+
class: "lume-tooltip__item",
|
|
1069
|
+
"data-j-tooltip__summary-item": ""
|
|
1070
|
+
}, Fo = { class: "lume-tooltip__value" };
|
|
1071
|
+
function jo(e, n) {
|
|
1072
|
+
return b(), O("li", Co, [
|
|
1073
|
+
P("span", null, [
|
|
1074
|
+
F(e.$slots, "default", {}, void 0, !0)
|
|
1075
|
+
]),
|
|
1076
|
+
P("strong", Fo, [
|
|
1077
|
+
F(e.$slots, "value", {}, void 0, !0)
|
|
1078
|
+
])
|
|
1079
|
+
]);
|
|
1080
|
+
}
|
|
1081
|
+
const Po = /* @__PURE__ */ ae(Go, [["render", jo], ["__scopeId", "data-v-4ed7ec1b"]]), Vo = {
|
|
1082
|
+
class: "lume-tooltip__item",
|
|
1083
|
+
"data-j-tooltip__item": ""
|
|
1084
|
+
}, zo = { "data-j-tooltip__item__label": "" }, Wo = {
|
|
1085
|
+
class: "lume-tooltip__value",
|
|
1086
|
+
"data-j-tooltip__item__value": ""
|
|
1087
|
+
}, Uo = /* @__PURE__ */ Q({
|
|
1088
|
+
__name: "lume-tooltip-item",
|
|
1089
|
+
props: {
|
|
1090
|
+
color: {
|
|
1091
|
+
type: String,
|
|
1092
|
+
default: null
|
|
1093
|
+
}
|
|
1094
|
+
},
|
|
1095
|
+
setup(e) {
|
|
1096
|
+
return (n, t) => (b(), O("li", Vo, [
|
|
1097
|
+
e.color ? (b(), O("span", {
|
|
1098
|
+
key: 0,
|
|
1099
|
+
class: ue([[`lume-background-color--${e.color}`], "lume-tooltip__symbol"]),
|
|
1100
|
+
"data-j-tooltip__item__symbol": ""
|
|
1101
|
+
}, null, 2)) : K("", !0),
|
|
1102
|
+
P("span", zo, [
|
|
1103
|
+
F(n.$slots, "label", {}, void 0, !0)
|
|
1104
|
+
]),
|
|
1105
|
+
P("strong", Wo, [
|
|
1106
|
+
F(n.$slots, "value", {}, void 0, !0)
|
|
1107
|
+
])
|
|
1108
|
+
]));
|
|
1109
|
+
}
|
|
1110
|
+
}), Zo = /* @__PURE__ */ ae(Uo, [["__scopeId", "data-v-4f995c3c"]]), Xo = (e) => (bn("data-v-6f13599d"), e = e(), An(), e), Yo = { class: "lume-tooltip__items" }, Ko = {
|
|
1111
|
+
key: 0,
|
|
1112
|
+
class: "lume-tooltip__break"
|
|
1113
|
+
}, Jo = /* @__PURE__ */ Xo(() => /* @__PURE__ */ P("hr", null, null, -1)), Qo = [
|
|
1114
|
+
Jo
|
|
1115
|
+
], qo = /* @__PURE__ */ Q({
|
|
1116
|
+
__name: "lume-tooltip",
|
|
1117
|
+
props: {
|
|
1118
|
+
opened: {
|
|
1119
|
+
type: Boolean,
|
|
1120
|
+
default: !1
|
|
1121
|
+
},
|
|
1122
|
+
targetElement: {
|
|
1123
|
+
type: Element,
|
|
1124
|
+
default: null
|
|
1125
|
+
},
|
|
1126
|
+
items: {
|
|
1127
|
+
type: Array,
|
|
1128
|
+
required: !0
|
|
1129
|
+
},
|
|
1130
|
+
position: {
|
|
1131
|
+
type: String,
|
|
1132
|
+
default: "auto",
|
|
1133
|
+
validator: (e) => Jn.includes(e)
|
|
1134
|
+
},
|
|
1135
|
+
fixedPositioning: {
|
|
1136
|
+
type: Boolean,
|
|
1137
|
+
default: !1
|
|
1138
|
+
},
|
|
1139
|
+
inverse: {
|
|
1140
|
+
type: Boolean,
|
|
1141
|
+
default: !1
|
|
1142
|
+
},
|
|
1143
|
+
modifiers: {
|
|
1144
|
+
type: Array,
|
|
1145
|
+
default: null
|
|
1146
|
+
},
|
|
1147
|
+
title: {
|
|
1148
|
+
type: [String, Number],
|
|
1149
|
+
default: null
|
|
1150
|
+
},
|
|
1151
|
+
summary: {
|
|
1152
|
+
type: String,
|
|
1153
|
+
default: null
|
|
1154
|
+
},
|
|
1155
|
+
...Ve()
|
|
1156
|
+
},
|
|
1157
|
+
emits: ["opened", "moved", "closed", "tooltip-mouseenter", "tooltip-mouseleave"],
|
|
1158
|
+
setup(e, { emit: n }) {
|
|
1159
|
+
const t = e, o = n, l = C(null), { items: i, options: a } = ie(t), r = me(), u = C(null), { allOptions: s } = Ae(a), d = f(
|
|
1160
|
+
() => s.value.fixedPositioning ?? t.fixedPositioning
|
|
1161
|
+
), c = f(
|
|
1162
|
+
() => d.value ? "fixed" : "absolute"
|
|
1163
|
+
), p = f(() => [
|
|
1164
|
+
{
|
|
1165
|
+
name: "computeStyles",
|
|
1166
|
+
options: {
|
|
1167
|
+
adaptive: !1
|
|
1168
|
+
// so that we can have smooth transitions
|
|
1169
|
+
}
|
|
1170
|
+
},
|
|
1171
|
+
{
|
|
1172
|
+
name: "offset",
|
|
1173
|
+
options: { offset: [0, s.value.offset || 8] }
|
|
1174
|
+
},
|
|
1175
|
+
...t.modifiers || []
|
|
1176
|
+
]), y = f(
|
|
1177
|
+
() => s.value.showTitle !== !1 && t.title != null
|
|
1178
|
+
), A = f(() => Ye(s.value.valueFormat)), k = f(() => Ye(s.value.titleFormat)), x = f(
|
|
1179
|
+
() => {
|
|
1180
|
+
var E;
|
|
1181
|
+
return ((E = i.value) == null ? void 0 : E.find((M) => M.isSummary)) || {
|
|
1182
|
+
label: s.value.summary ?? t.summary
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
), g = f(() => r.summary || x.value.label), _ = f(() => t.inverse || s.value.inverse ? [...i.value].reverse() : i.value);
|
|
1186
|
+
function m() {
|
|
1187
|
+
t.targetElement && l.value && (u.value = Dn(t.targetElement, l.value, {
|
|
1188
|
+
placement: t.position,
|
|
1189
|
+
strategy: c.value,
|
|
1190
|
+
modifiers: p.value
|
|
1191
|
+
}), o("opened", t.targetElement));
|
|
1192
|
+
}
|
|
1193
|
+
function T() {
|
|
1194
|
+
u.value && (u.value.destroy(), o("closed"), l.value && l.value.classList.remove("lume-tooltip--animated"));
|
|
1195
|
+
}
|
|
1196
|
+
function N() {
|
|
1197
|
+
u.value && (s.value.withAnimation !== !1 && l.value && l.value.classList.add("lume-tooltip--animated"), t.targetElement ? (function() {
|
|
1198
|
+
u.value.state.elements.reference = t.targetElement, u.value.update(), o("moved", t.targetElement);
|
|
1199
|
+
})() : T());
|
|
1200
|
+
}
|
|
1201
|
+
return U(
|
|
1202
|
+
() => t.targetElement,
|
|
1203
|
+
async (E, M) => {
|
|
1204
|
+
!M && E ? (await lt(), m()) : N();
|
|
1205
|
+
}
|
|
1206
|
+
), xe(m), Jt(T), (E, M) => e.opened && e.targetElement ? (b(), O("div", {
|
|
1207
|
+
key: 0,
|
|
1208
|
+
ref_key: "root",
|
|
1209
|
+
ref: l,
|
|
1210
|
+
class: ue(["lume-tooltip lume-typography--caption", {
|
|
1211
|
+
"lume-tooltip--pointer-events": v(a).withPointerEvents
|
|
1212
|
+
}]),
|
|
1213
|
+
"data-j-tooltip": "",
|
|
1214
|
+
onMouseenter: M[0] || (M[0] = (G) => o("tooltip-mouseenter")),
|
|
1215
|
+
onMouseleave: M[1] || (M[1] = (G) => o("tooltip-mouseleave"))
|
|
1216
|
+
}, [
|
|
1217
|
+
F(E.$slots, "default", {}, () => [
|
|
1218
|
+
F(E.$slots, "title", {}, () => [
|
|
1219
|
+
y.value ? (b(), ee(v(So), { key: 0 }, {
|
|
1220
|
+
default: Z(() => [
|
|
1221
|
+
_e(ce(k.value(e.title)), 1)
|
|
1222
|
+
]),
|
|
1223
|
+
_: 1
|
|
1224
|
+
})) : K("", !0)
|
|
1225
|
+
], !0),
|
|
1226
|
+
P("ul", Yo, [
|
|
1227
|
+
F(E.$slots, "summary", {}, () => [
|
|
1228
|
+
g.value ? (b(), ee(v(Po), { key: 0 }, ke({
|
|
1229
|
+
default: Z(() => [
|
|
1230
|
+
_e(ce(x.value.label) + " ", 1)
|
|
1231
|
+
]),
|
|
1232
|
+
_: 2
|
|
1233
|
+
}, [
|
|
1234
|
+
x.value.value ? {
|
|
1235
|
+
name: "value",
|
|
1236
|
+
fn: Z(() => [
|
|
1237
|
+
_e(ce(A.value(x.value.value)), 1)
|
|
1238
|
+
]),
|
|
1239
|
+
key: "0"
|
|
1240
|
+
} : void 0
|
|
1241
|
+
]), 1024)) : K("", !0)
|
|
1242
|
+
], !0),
|
|
1243
|
+
g.value ? (b(), O("li", Ko, Qo)) : K("", !0),
|
|
1244
|
+
F(E.$slots, "items", {}, () => [
|
|
1245
|
+
(b(!0), O(oe, null, J(_.value, (G) => (b(), ee(v(Zo), {
|
|
1246
|
+
key: G.label,
|
|
1247
|
+
color: G.color
|
|
1248
|
+
}, {
|
|
1249
|
+
label: Z(() => [
|
|
1250
|
+
_e(ce(G.label), 1)
|
|
1251
|
+
]),
|
|
1252
|
+
value: Z(() => [
|
|
1253
|
+
_e(ce(A.value(G.value)), 1)
|
|
1254
|
+
]),
|
|
1255
|
+
_: 2
|
|
1256
|
+
}, 1032, ["color"]))), 128))
|
|
1257
|
+
], !0)
|
|
1258
|
+
])
|
|
1259
|
+
], !0)
|
|
1260
|
+
], 34)) : K("", !0);
|
|
1261
|
+
}
|
|
1262
|
+
}), ea = /* @__PURE__ */ ae(qo, [["__scopeId", "data-v-6f13599d"]]), tt = () => ({
|
|
1263
|
+
data: {
|
|
1264
|
+
type: Array,
|
|
1265
|
+
required: !0
|
|
1266
|
+
},
|
|
1267
|
+
labels: {
|
|
1268
|
+
type: Array,
|
|
1269
|
+
default: () => []
|
|
1270
|
+
},
|
|
1271
|
+
options: {
|
|
1272
|
+
type: Object,
|
|
1273
|
+
default: () => ({})
|
|
1274
|
+
},
|
|
1275
|
+
orientation: {
|
|
1276
|
+
type: String,
|
|
1277
|
+
default: S.VERTICAL,
|
|
1278
|
+
validator: Tt
|
|
1279
|
+
},
|
|
1280
|
+
xScale: {
|
|
1281
|
+
type: Function,
|
|
1282
|
+
default: () => null
|
|
1283
|
+
},
|
|
1284
|
+
yScale: {
|
|
1285
|
+
type: Function,
|
|
1286
|
+
default: () => null
|
|
1287
|
+
},
|
|
1288
|
+
hoveredIndex: {
|
|
1289
|
+
type: Number,
|
|
1290
|
+
default: -1
|
|
1291
|
+
},
|
|
1292
|
+
containerSize: {
|
|
1293
|
+
type: Object,
|
|
1294
|
+
default: () => ({ width: 0, height: 0 })
|
|
1295
|
+
},
|
|
1296
|
+
transition: {
|
|
1297
|
+
type: Boolean,
|
|
1298
|
+
default: !0
|
|
1299
|
+
},
|
|
1300
|
+
classList: {
|
|
1301
|
+
type: [String, Array],
|
|
1302
|
+
default: () => []
|
|
1303
|
+
}
|
|
1304
|
+
}), ta = { class: "lume-overlay-group" }, na = /* @__PURE__ */ Q({
|
|
1305
|
+
__name: "lume-overlay-group",
|
|
1306
|
+
props: {
|
|
1307
|
+
...tt(),
|
|
1308
|
+
orientation: {
|
|
1309
|
+
type: String,
|
|
1310
|
+
default: S.VERTICAL
|
|
1311
|
+
}
|
|
1312
|
+
},
|
|
1313
|
+
emits: ["click", "lume__internal--hover", "mouseover"],
|
|
1314
|
+
setup(e, { emit: n }) {
|
|
1315
|
+
const t = e, o = n, { data: l, orientation: i, xScale: a, yScale: r } = ie(t), u = f(() => tn(l));
|
|
1316
|
+
function s(d) {
|
|
1317
|
+
var g;
|
|
1318
|
+
const c = i.value === S.HORIZONTAL ? r.value : a.value, p = c.domain(), y = Gn(c), A = ((g = c.paddingInner) == null ? void 0 : g.call(c)) ?? 0, k = y * A, x = pe(c) ? c(p[d]) - k / 2 : c(d) - y / 2;
|
|
1319
|
+
return i.value === S.HORIZONTAL ? {
|
|
1320
|
+
width: Math.max(...a.value.range()),
|
|
1321
|
+
height: y,
|
|
1322
|
+
transform: `translate(0, ${x})`
|
|
1323
|
+
} : {
|
|
1324
|
+
width: y,
|
|
1325
|
+
height: Math.max(...r.value.range()),
|
|
1326
|
+
transform: `translate(${x}, 0)`
|
|
1327
|
+
};
|
|
1328
|
+
}
|
|
1329
|
+
return (d, c) => (b(), O("g", ta, [
|
|
1330
|
+
(b(!0), O(oe, null, J(u.value, (p, y) => (b(), ee(v(yt), W(s(y), {
|
|
1331
|
+
key: `overlay-${y}`,
|
|
1332
|
+
"data-j-lume-overlay-group": y,
|
|
1333
|
+
transition: !1,
|
|
1334
|
+
"class-list": "lume-fill--transparent",
|
|
1335
|
+
onMouseover: (A) => o("lume__internal--hover", y),
|
|
1336
|
+
onClick: (A) => o("click", { index: y, event: A })
|
|
1337
|
+
}), null, 16, ["data-j-lume-overlay-group", "onMouseover", "onClick"]))), 128))
|
|
1338
|
+
]));
|
|
1339
|
+
}
|
|
1340
|
+
}), Oe = (e, n) => {
|
|
1341
|
+
function t(i, ...a) {
|
|
1342
|
+
}
|
|
1343
|
+
function o(i, a) {
|
|
1344
|
+
}
|
|
1345
|
+
return { componentEventPropagator: {}, emitInternalEvent: t, listenInternalEvent: o };
|
|
1346
|
+
};
|
|
1347
|
+
function oa(e) {
|
|
1348
|
+
return { hasNegativeValues: f(
|
|
1349
|
+
() => qt(e.value).some((t) => t < 0)
|
|
1350
|
+
) };
|
|
1351
|
+
}
|
|
1352
|
+
function aa(e, n, t, o) {
|
|
1353
|
+
const l = f(
|
|
1354
|
+
() => o.value === S.HORIZONTAL
|
|
1355
|
+
), i = f(
|
|
1356
|
+
() => {
|
|
1357
|
+
var s;
|
|
1358
|
+
return e.height - (l != null && l.value ? 0 : ((s = t.value) == null ? void 0 : s.call(t, 0)) || 0);
|
|
1359
|
+
}
|
|
1360
|
+
), a = f(
|
|
1361
|
+
() => {
|
|
1362
|
+
var s;
|
|
1363
|
+
return l != null && l.value ? ((s = n.value) == null ? void 0 : s.call(n, 0)) || 0 : e.width;
|
|
1364
|
+
}
|
|
1365
|
+
), r = f(
|
|
1366
|
+
() => {
|
|
1367
|
+
var s;
|
|
1368
|
+
return l != null && l.value ? "translate(0, 0)" : `translate(0, ${((s = t.value) == null ? void 0 : s.call(t, 0)) || 0})`;
|
|
1369
|
+
}
|
|
1370
|
+
);
|
|
1371
|
+
return { negativeBarAttributes: f(() => ({
|
|
1372
|
+
width: a.value,
|
|
1373
|
+
height: i.value,
|
|
1374
|
+
transform: r.value
|
|
1375
|
+
})) };
|
|
1376
|
+
}
|
|
1377
|
+
function la(e, n) {
|
|
1378
|
+
return e.reduce((t, o) => ht(o.values, n).map(
|
|
1379
|
+
(l, i) => t[i] ? l.value > t[i] ? l.value : t[i] : l.value ?? 0
|
|
1380
|
+
), []);
|
|
1381
|
+
}
|
|
1382
|
+
function ua(e, n) {
|
|
1383
|
+
return e.reduce((t, o) => ht(o.values, n).map(
|
|
1384
|
+
(l, i) => {
|
|
1385
|
+
const a = l.value == null || l.value < 0 ? 0 : l.value;
|
|
1386
|
+
return t[i] ? t[i] + a : a;
|
|
1387
|
+
}
|
|
1388
|
+
), []);
|
|
1389
|
+
}
|
|
1390
|
+
const jt = {
|
|
1391
|
+
"stacked-bar": ua
|
|
1392
|
+
};
|
|
1393
|
+
function dn(e, n, t, o, l, i, a, r) {
|
|
1394
|
+
const u = f(
|
|
1395
|
+
() => {
|
|
1396
|
+
var d;
|
|
1397
|
+
return n.value.withTooltip !== !1 && !((d = n.value.tooltipOptions) != null && d.targetElement);
|
|
1398
|
+
}
|
|
1399
|
+
);
|
|
1400
|
+
function s(d) {
|
|
1401
|
+
var y;
|
|
1402
|
+
const c = ((y = l == null ? void 0 : l.value) == null ? void 0 : y.length) ?? 0, p = r != null && r.value && jt[r.value] ? jt[r.value](
|
|
1403
|
+
d,
|
|
1404
|
+
c
|
|
1405
|
+
) : la(d, c);
|
|
1406
|
+
e.value = p.map((A, k) => ({
|
|
1407
|
+
cx: (i == null ? void 0 : i.value) === S.HORIZONTAL ? t.value(A) : it(t.value, k),
|
|
1408
|
+
cy: (i == null ? void 0 : i.value) === S.HORIZONTAL ? it(o.value, k) : o.value(A)
|
|
1409
|
+
}));
|
|
1410
|
+
}
|
|
1411
|
+
return U(
|
|
1412
|
+
[t, o],
|
|
1413
|
+
() => {
|
|
1414
|
+
t.value && o.value && (a != null && a.value) && u.value && s(a.value);
|
|
1415
|
+
},
|
|
1416
|
+
{ immediate: !0 }
|
|
1417
|
+
), { shouldGenerateTooltipAnchors: u, updateTooltipAnchorAttributes: s };
|
|
1418
|
+
}
|
|
1419
|
+
function ra() {
|
|
1420
|
+
const e = qe({
|
|
1421
|
+
opened: !1,
|
|
1422
|
+
targetElement: null
|
|
1423
|
+
});
|
|
1424
|
+
return { tooltipConfig: e, showTooltip: (o) => {
|
|
1425
|
+
e.opened = !0, e.targetElement = o;
|
|
1426
|
+
}, hideTooltip: () => {
|
|
1427
|
+
e.opened = !1, e.targetElement = null;
|
|
1428
|
+
} };
|
|
1429
|
+
}
|
|
1430
|
+
function ia(e) {
|
|
1431
|
+
return { getTooltipItems: f(
|
|
1432
|
+
() => (t) => e.value.map(({ color: o, label: l, values: i }) => {
|
|
1433
|
+
var a, r, u;
|
|
1434
|
+
return {
|
|
1435
|
+
color: ((a = i[t]) == null ? void 0 : a.color) || o,
|
|
1436
|
+
label: l,
|
|
1437
|
+
value: ((r = i[t]) == null ? void 0 : r.label) ?? ((u = i[t]) == null ? void 0 : u.value) ?? nn
|
|
1438
|
+
};
|
|
1439
|
+
})
|
|
1440
|
+
) };
|
|
1441
|
+
}
|
|
1442
|
+
const st = 16, ct = 8, dt = 28, vt = 24, De = {
|
|
1443
|
+
VERTICAL: {
|
|
1444
|
+
top: st,
|
|
1445
|
+
right: ct,
|
|
1446
|
+
bottom: dt,
|
|
1447
|
+
left: vt
|
|
1448
|
+
},
|
|
1449
|
+
HORIZONTAL: {
|
|
1450
|
+
top: st,
|
|
1451
|
+
right: ct,
|
|
1452
|
+
bottom: dt,
|
|
1453
|
+
left: vt
|
|
1454
|
+
}
|
|
1455
|
+
};
|
|
1456
|
+
function sa(e) {
|
|
1457
|
+
return !e || e === "auto" || e.top == null || e.top === "auto" ? st : e.top;
|
|
1458
|
+
}
|
|
1459
|
+
function ca(e, n) {
|
|
1460
|
+
return !e || e === "auto" || e.right == null || e.right === "auto" ? Math.max(ct, n || 0) : e.right;
|
|
1461
|
+
}
|
|
1462
|
+
function da(e, n) {
|
|
1463
|
+
return !e || e === "auto" || e.bottom == null || e.bottom === "auto" ? n || dt : e.bottom;
|
|
1464
|
+
}
|
|
1465
|
+
function va(e, n) {
|
|
1466
|
+
return !e || e === "auto" || e.left == null || e.left === "auto" ? n || vt : e.left;
|
|
1467
|
+
}
|
|
1468
|
+
const fa = { class: "lume-chart__header" }, ma = { class: "lume-chart__header-section" }, ga = {
|
|
1469
|
+
key: 0,
|
|
1470
|
+
class: "lume-chart__title lume-chart-title lume-typography--display"
|
|
1471
|
+
}, pa = { class: "lume-chart__controls" }, ha = { class: "lume-chart__header-section" }, ya = {
|
|
1472
|
+
key: 0,
|
|
1473
|
+
class: "lume-chart__axis-title lume-axis-title lume-typography--caption"
|
|
1474
|
+
}, _a = { key: 3 }, ka = ["r"], ba = {
|
|
1475
|
+
key: 0,
|
|
1476
|
+
class: "lume-chart__axis-title lume-chart__axis-title--centered lume-axis-title lume-typography--body"
|
|
1477
|
+
}, Aa = /* @__PURE__ */ Q({
|
|
1478
|
+
__name: "lume-chart",
|
|
1479
|
+
props: {
|
|
1480
|
+
...Ge(),
|
|
1481
|
+
chartType: {
|
|
1482
|
+
type: String,
|
|
1483
|
+
default: null
|
|
1484
|
+
}
|
|
1485
|
+
},
|
|
1486
|
+
setup(e, { emit: n }) {
|
|
1487
|
+
const t = e, o = me(), l = n, { data: i, labels: a, color: r, options: u, orientation: s, chartType: d } = ie(t), c = C(-1), p = C(null), y = C(null), A = C([]), k = C(null), x = C(0), g = C(0), _ = C(0), { allOptions: m } = Ae(u), { internalData: T, computedLabels: N, containerSize: E, updateSize: M, chartID: G } = Lt(i, a, r, m, s), { xScale: te, yScale: B } = $o(
|
|
1488
|
+
T,
|
|
1489
|
+
N,
|
|
1490
|
+
E,
|
|
1491
|
+
s,
|
|
1492
|
+
m
|
|
1493
|
+
), q = f(() => ({
|
|
1494
|
+
top: sa(m.value.margins),
|
|
1495
|
+
right: ca(
|
|
1496
|
+
m.value.margins,
|
|
1497
|
+
_.value
|
|
1498
|
+
),
|
|
1499
|
+
bottom: da(m.value.margins, x.value),
|
|
1500
|
+
left: va(m.value.margins, g.value)
|
|
1501
|
+
})), X = f(() => {
|
|
1502
|
+
var $;
|
|
1503
|
+
return t.xScale ? Gt(t.xScale) ? t.xScale : ($ = t.xScale) == null ? void 0 : $.call(t, T.value, a.value, E) : te.value;
|
|
1504
|
+
}), Y = f(() => {
|
|
1505
|
+
var $;
|
|
1506
|
+
return t.yScale ? Gt(t.yScale) ? t.yScale : ($ = t.yScale) == null ? void 0 : $.call(t, T.value, a.value, E) : B.value;
|
|
1507
|
+
}), le = f(() => ({
|
|
1508
|
+
...m.value.xAxisOptions,
|
|
1509
|
+
withHover: s.value === S.VERTICAL
|
|
1510
|
+
})), re = f(() => ({
|
|
1511
|
+
...m.value.yAxisOptions,
|
|
1512
|
+
withHover: s.value === S.HORIZONTAL
|
|
1513
|
+
})), Le = f(() => {
|
|
1514
|
+
var $;
|
|
1515
|
+
return ($ = m.value.xAxisOptions) == null ? void 0 : $.title;
|
|
1516
|
+
}), Re = f(() => {
|
|
1517
|
+
var $;
|
|
1518
|
+
return ($ = m.value.yAxisOptions) == null ? void 0 : $.title;
|
|
1519
|
+
}), Ne = f(() => {
|
|
1520
|
+
var $;
|
|
1521
|
+
return (($ = m.value.xAxisOptions) == null ? void 0 : $.withTitle) !== !1 && Le.value;
|
|
1522
|
+
}), He = f(() => {
|
|
1523
|
+
var $;
|
|
1524
|
+
return (($ = m.value.yAxisOptions) == null ? void 0 : $.withTitle) !== !1 && Re.value;
|
|
1525
|
+
}), Te = f(
|
|
1526
|
+
() => i.value.every(($) => !$.values.length) || i.value.every(($) => $.values.every((L) => L === null))
|
|
1527
|
+
), D = f(() => {
|
|
1528
|
+
const $ = [], { noBaseScales: L } = m.value;
|
|
1529
|
+
return L || $.push(() => !!(X.value && Y.value)), $.every((w) => w() === !0);
|
|
1530
|
+
}), { hasNegativeValues: R } = oa(T), { negativeBarAttributes: H } = aa(
|
|
1531
|
+
E,
|
|
1532
|
+
X,
|
|
1533
|
+
Y,
|
|
1534
|
+
s
|
|
1535
|
+
), { shouldGenerateTooltipAnchors: ne } = dn(
|
|
1536
|
+
A,
|
|
1537
|
+
m,
|
|
1538
|
+
X,
|
|
1539
|
+
Y,
|
|
1540
|
+
a,
|
|
1541
|
+
s,
|
|
1542
|
+
T,
|
|
1543
|
+
d
|
|
1544
|
+
), { tooltipConfig: se, showTooltip: ye, hideTooltip: Me } = ra(), { getTooltipItems: Se } = ia(T), I = f(
|
|
1545
|
+
() => {
|
|
1546
|
+
var $;
|
|
1547
|
+
return (($ = m.value.tooltipOptions) == null ? void 0 : $.position) || "top";
|
|
1548
|
+
}
|
|
1549
|
+
), j = f(() => {
|
|
1550
|
+
var L;
|
|
1551
|
+
const $ = (L = m.value.tooltipOptions) == null ? void 0 : L.withPointerEvents;
|
|
1552
|
+
return se.opened && (!$ || $ && k.value === !1);
|
|
1553
|
+
});
|
|
1554
|
+
function h($) {
|
|
1555
|
+
var w;
|
|
1556
|
+
if (m.value.withHover === !1 || $ === c.value) return;
|
|
1557
|
+
const L = c.value;
|
|
1558
|
+
if (c.value = $, m.value.withTooltip !== !1) {
|
|
1559
|
+
const nt = (w = m.value.tooltipOptions) != null && w.targetElement ? m.value.tooltipOptions.targetElement === "self" ? y.value.$el : m.value.tooltipOptions.targetElement : p.value[$];
|
|
1560
|
+
ye(nt);
|
|
1561
|
+
}
|
|
1562
|
+
l("hovered-index-changed", { newIndex: $, oldIndex: L }), l("update:hoveredIndex", $);
|
|
1563
|
+
}
|
|
1564
|
+
function V() {
|
|
1565
|
+
Me(), c.value = -1, l("update:hoveredIndex", -1);
|
|
1566
|
+
}
|
|
1567
|
+
function z($) {
|
|
1568
|
+
if (!i.value.some(
|
|
1569
|
+
({ values: w }) => $ <= w.length - 1
|
|
1570
|
+
)) {
|
|
1571
|
+
Ie(be.InvalidHoveredIndex);
|
|
1572
|
+
return;
|
|
1573
|
+
}
|
|
1574
|
+
$ == null || $ === -1 ? V() : h($);
|
|
1575
|
+
}
|
|
1576
|
+
function ve() {
|
|
1577
|
+
setTimeout(() => {
|
|
1578
|
+
j.value && V(), l("chart-mouseleave");
|
|
1579
|
+
}, 0);
|
|
1580
|
+
}
|
|
1581
|
+
function xt($) {
|
|
1582
|
+
M($), l("resize", $);
|
|
1583
|
+
}
|
|
1584
|
+
function Ue({ index: $, value: L, event: w }) {
|
|
1585
|
+
$ !== null && h($), l("axis-mouseenter", { index: $, value: L, event: w });
|
|
1586
|
+
}
|
|
1587
|
+
function Ze({ index: $, value: L, event: w }) {
|
|
1588
|
+
l("axis-click", { index: $, value: L, event: w });
|
|
1589
|
+
}
|
|
1590
|
+
return U(
|
|
1591
|
+
i,
|
|
1592
|
+
($, L) => l("data-changed", { newValue: $, oldValue: L })
|
|
1593
|
+
), U(
|
|
1594
|
+
a,
|
|
1595
|
+
($, L) => l("labels-changed", { newValue: $, oldValue: L })
|
|
1596
|
+
), U(Te, ($) => $ && Ie(be.Empty), { immediate: !0 }), U(() => t.hoveredIndex, z), U(
|
|
1597
|
+
A,
|
|
1598
|
+
($) => {
|
|
1599
|
+
$ && t.hoveredIndex != null && c.value === -1 && z(t.hoveredIndex);
|
|
1600
|
+
},
|
|
1601
|
+
{ flush: "post" }
|
|
1602
|
+
), U(k, ($) => {
|
|
1603
|
+
$ === !1 && se.opened && V();
|
|
1604
|
+
}), xe(async () => {
|
|
1605
|
+
l("rendered"), o.groups || console.error('"groups" `<slot>` must have content.');
|
|
1606
|
+
}), ot("chartID", G), ot("isEmpty", Te), ot("tooltipAnchorAttributes", A), ($, L) => (b(), ee(v(Eo), {
|
|
1607
|
+
id: `lume-chart_${v(G)}`,
|
|
1608
|
+
ref_key: "chartContainer",
|
|
1609
|
+
ref: y,
|
|
1610
|
+
margins: q.value,
|
|
1611
|
+
"container-size": v(E),
|
|
1612
|
+
"no-min-size": v(m).noMinSize,
|
|
1613
|
+
"transparent-background": v(m).transparentBackground,
|
|
1614
|
+
orientation: v(s),
|
|
1615
|
+
"data-j-lume-chart": "",
|
|
1616
|
+
onResize: xt,
|
|
1617
|
+
onClick: L[25] || (L[25] = (w) => l("chart-click", w)),
|
|
1618
|
+
onMouseenter: L[26] || (L[26] = (w) => l("chart-mouseenter", w)),
|
|
1619
|
+
onMouseleave: ve
|
|
1620
|
+
}, {
|
|
1621
|
+
header: Z(() => [
|
|
1622
|
+
P("div", fa, [
|
|
1623
|
+
P("div", ma, [
|
|
1624
|
+
$.title ? (b(), O("h1", ga, ce($.title), 1)) : K("", !0),
|
|
1625
|
+
P("div", pa, [
|
|
1626
|
+
F($.$slots, "controls", {}, void 0, !0)
|
|
1627
|
+
])
|
|
1628
|
+
]),
|
|
1629
|
+
P("div", ha, [
|
|
1630
|
+
He.value ? (b(), O("h3", ya, ce(Re.value), 1)) : K("", !0),
|
|
1631
|
+
F($.$slots, "legend", { data: v(T) }, () => [
|
|
1632
|
+
v(m).withLegend !== !1 && v(m).legendPosition !== "bottom" ? (b(), ee(v(Ft), {
|
|
1633
|
+
key: 0,
|
|
1634
|
+
data: v(T),
|
|
1635
|
+
class: "lume-chart__legend",
|
|
1636
|
+
"data-j-lume-chart__legend": "",
|
|
1637
|
+
onClick: L[0] || (L[0] = (w) => l("legend-click", w)),
|
|
1638
|
+
onMouseenter: L[1] || (L[1] = (w) => l("legend-mouseenter", w)),
|
|
1639
|
+
onMouseleave: L[2] || (L[2] = (w) => l("legend-mouseleave"))
|
|
1640
|
+
}, null, 8, ["data"])) : K("", !0)
|
|
1641
|
+
], !0)
|
|
1642
|
+
])
|
|
1643
|
+
])
|
|
1644
|
+
]),
|
|
1645
|
+
footer: Z(() => [
|
|
1646
|
+
Ne.value ? (b(), O("h3", ba, ce(Le.value), 1)) : K("", !0),
|
|
1647
|
+
v(m).withLegend !== !1 && v(m).legendPosition == "bottom" ? (b(), ee(v(Ft), {
|
|
1648
|
+
key: 1,
|
|
1649
|
+
data: v(T),
|
|
1650
|
+
class: "lume-chart__legend lume-chart__legend--bottom",
|
|
1651
|
+
"data-j-lume-chart__legend": "",
|
|
1652
|
+
onClick: L[17] || (L[17] = (w) => l("legend-click", w)),
|
|
1653
|
+
onMouseenter: L[18] || (L[18] = (w) => l("legend-mouseenter", w)),
|
|
1654
|
+
onMouseleave: L[19] || (L[19] = (w) => l("legend-mouseleave"))
|
|
1655
|
+
}, null, 8, ["data"])) : K("", !0)
|
|
1656
|
+
]),
|
|
1657
|
+
extra: Z(() => [
|
|
1658
|
+
F($.$slots, "tooltip", W(v(se), {
|
|
1659
|
+
data: v(T),
|
|
1660
|
+
labels: v(N),
|
|
1661
|
+
title: v(N)[c.value],
|
|
1662
|
+
items: v(Se)(c.value),
|
|
1663
|
+
position: I.value,
|
|
1664
|
+
withTooltip: v(m).withTooltip !== !1,
|
|
1665
|
+
hoveredIndex: c.value,
|
|
1666
|
+
handleMouseEnter: () => k.value = !0,
|
|
1667
|
+
handleMouseLeave: () => k.value = !1,
|
|
1668
|
+
options: v(m).tooltipOptions
|
|
1669
|
+
}), () => [
|
|
1670
|
+
v(m).withTooltip !== !1 ? (b(), ee(v(ea), W({ key: 0 }, v(se), {
|
|
1671
|
+
position: I.value,
|
|
1672
|
+
title: v(N)[c.value],
|
|
1673
|
+
items: v(Se)(c.value),
|
|
1674
|
+
options: v(m).tooltipOptions,
|
|
1675
|
+
"data-j-lume-chart__tooltip": "",
|
|
1676
|
+
onOpened: L[20] || (L[20] = (w) => l("tooltip-opened", {
|
|
1677
|
+
index: c.value,
|
|
1678
|
+
targetElement: w
|
|
1679
|
+
})),
|
|
1680
|
+
onMoved: L[21] || (L[21] = (w) => l("tooltip-moved", {
|
|
1681
|
+
index: c.value,
|
|
1682
|
+
targetElement: w
|
|
1683
|
+
})),
|
|
1684
|
+
onClosed: L[22] || (L[22] = (w) => l("tooltip-closed")),
|
|
1685
|
+
onTooltipMouseenter: L[23] || (L[23] = (w) => k.value = !0),
|
|
1686
|
+
onTooltipMouseleave: L[24] || (L[24] = (w) => k.value = !1)
|
|
1687
|
+
}), {
|
|
1688
|
+
default: Z(() => [
|
|
1689
|
+
F($.$slots, "tooltip-content", {
|
|
1690
|
+
data: v(T),
|
|
1691
|
+
labels: v(N),
|
|
1692
|
+
hoveredIndex: c.value
|
|
1693
|
+
}, void 0, !0)
|
|
1694
|
+
]),
|
|
1695
|
+
_: 3
|
|
1696
|
+
}, 16, ["position", "title", "items", "options"])) : K("", !0)
|
|
1697
|
+
], !0)
|
|
1698
|
+
]),
|
|
1699
|
+
default: Z(() => [
|
|
1700
|
+
D.value ? (b(), O(oe, { key: 0 }, [
|
|
1701
|
+
v(R) ? (b(), ee(v(yt), W({ key: 0 }, v(H), {
|
|
1702
|
+
"class-list": "lume-fill--negative",
|
|
1703
|
+
transition: !1,
|
|
1704
|
+
"data-j-lume-chart__negative-values": ""
|
|
1705
|
+
}), null, 16)) : K("", !0),
|
|
1706
|
+
v(m).withAxes !== !1 ? F($.$slots, "axes", {
|
|
1707
|
+
key: 1,
|
|
1708
|
+
xScale: X.value,
|
|
1709
|
+
yScale: Y.value,
|
|
1710
|
+
containerSize: v(E),
|
|
1711
|
+
options: v(m),
|
|
1712
|
+
hoveredIndex: c.value
|
|
1713
|
+
}, () => [
|
|
1714
|
+
ge(v(Bt), {
|
|
1715
|
+
type: "x",
|
|
1716
|
+
scale: X.value,
|
|
1717
|
+
"container-size": v(E),
|
|
1718
|
+
options: le.value,
|
|
1719
|
+
"hovered-index": c.value,
|
|
1720
|
+
orientation: v(s),
|
|
1721
|
+
"data-j-lume-chart__x-axis": "",
|
|
1722
|
+
onClick: Ze,
|
|
1723
|
+
onMouseenter: Ue,
|
|
1724
|
+
onMouseleave: L[3] || (L[3] = (w) => l("axis-mouseleave")),
|
|
1725
|
+
"onLume__internal-AxisSize": L[4] || (L[4] = (w) => x.value = w),
|
|
1726
|
+
"onLume__internal-AxisOverflow": L[5] || (L[5] = (w) => _.value = w)
|
|
1727
|
+
}, null, 8, ["scale", "container-size", "options", "hovered-index", "orientation"]),
|
|
1728
|
+
ge(v(Bt), {
|
|
1729
|
+
type: "y",
|
|
1730
|
+
scale: Y.value,
|
|
1731
|
+
"container-size": v(E),
|
|
1732
|
+
options: re.value,
|
|
1733
|
+
"hovered-index": c.value,
|
|
1734
|
+
orientation: v(s),
|
|
1735
|
+
"data-j-lume-chart__y-axis": "",
|
|
1736
|
+
onClick: Ze,
|
|
1737
|
+
onMouseenter: Ue,
|
|
1738
|
+
onMouseleave: L[6] || (L[6] = (w) => l("axis-mouseleave")),
|
|
1739
|
+
"onLume__internal-AxisSize": L[7] || (L[7] = (w) => g.value = w)
|
|
1740
|
+
}, null, 8, ["scale", "container-size", "options", "hovered-index", "orientation"])
|
|
1741
|
+
], !0) : K("", !0),
|
|
1742
|
+
v(m).withHover !== !1 ? (b(), ee(v(na), {
|
|
1743
|
+
key: 2,
|
|
1744
|
+
data: v(T),
|
|
1745
|
+
orientation: v(s),
|
|
1746
|
+
"x-scale": X.value,
|
|
1747
|
+
"y-scale": Y.value,
|
|
1748
|
+
"data-j-lume-chart__overlay-group": "",
|
|
1749
|
+
"onLume__internal-Hover": h
|
|
1750
|
+
}, null, 8, ["data", "orientation", "x-scale", "y-scale"])) : K("", !0),
|
|
1751
|
+
v(ne) ? (b(), O("g", _a, [
|
|
1752
|
+
(b(!0), O(oe, null, J(A.value, (w, nt) => (b(), O("circle", W(w, {
|
|
1753
|
+
ref_for: !0,
|
|
1754
|
+
ref_key: "tooltipAnchor",
|
|
1755
|
+
ref: p,
|
|
1756
|
+
key: `anchor_${nt}`,
|
|
1757
|
+
r: v(Kn),
|
|
1758
|
+
class: "lume-fill--transparent"
|
|
1759
|
+
}), null, 16, ka))), 128))
|
|
1760
|
+
])) : K("", !0),
|
|
1761
|
+
F($.$slots, "groups", {
|
|
1762
|
+
data: v(T),
|
|
1763
|
+
labels: v(N),
|
|
1764
|
+
options: v(m),
|
|
1765
|
+
orientation: v(s),
|
|
1766
|
+
xScale: X.value,
|
|
1767
|
+
yScale: Y.value,
|
|
1768
|
+
hoveredIndex: c.value,
|
|
1769
|
+
containerSize: v(E),
|
|
1770
|
+
transition: v(m).withTransition !== !1,
|
|
1771
|
+
classList: $.classList,
|
|
1772
|
+
onNodeClick: L[8] || (L[8] = (w) => l("node-click", w)),
|
|
1773
|
+
onNodeMouseenter: L[9] || (L[9] = (w) => l("node-mouseenter", w)),
|
|
1774
|
+
onNodeMouseleave: L[10] || (L[10] = (w) => l("node-mouseleave", w)),
|
|
1775
|
+
onLinkClick: L[11] || (L[11] = (w) => l("link-click", w)),
|
|
1776
|
+
onLinkMouseenter: L[12] || (L[12] = (w) => l("link-mouseenter", w)),
|
|
1777
|
+
onLinkMouseleave: L[13] || (L[13] = (w) => l("link-mouseleave", w)),
|
|
1778
|
+
onBarClick: L[14] || (L[14] = (w) => l("bar-click", w)),
|
|
1779
|
+
onLineClick: L[15] || (L[15] = (w) => l("line-click", w)),
|
|
1780
|
+
onPointClick: L[16] || (L[16] = (w) => l("point-click", w)),
|
|
1781
|
+
"onLume__internal-Hover": h
|
|
1782
|
+
}, void 0, !0)
|
|
1783
|
+
], 64)) : K("", !0)
|
|
1784
|
+
]),
|
|
1785
|
+
_: 3
|
|
1786
|
+
}, 8, ["id", "margins", "container-size", "no-min-size", "transparent-background", "orientation"]));
|
|
1787
|
+
}
|
|
1788
|
+
}), Ce = /* @__PURE__ */ ae(Aa, [["__scopeId", "data-v-47313de1"]]), Pt = 8, La = 8, Ta = 20, Fe = 2, Xe = 3, $a = 4, Vt = 2, wa = ["dy", "dominant-baseline"], Ia = ["y", "x", "width", "height"], xa = { class: "lume-alluvial-group__label-wrapper" }, Oa = /* @__PURE__ */ Q({
|
|
1789
|
+
__name: "lume-alluvial-node-label",
|
|
1790
|
+
props: {
|
|
1791
|
+
bottom: { type: Boolean, default: !1 },
|
|
1792
|
+
left: { type: Boolean, default: !1 },
|
|
1793
|
+
maxWidth: { type: Number, default: 0 }
|
|
1794
|
+
},
|
|
1795
|
+
emits: ["lume__internal--node-resize"],
|
|
1796
|
+
setup(e, { emit: n }) {
|
|
1797
|
+
const t = e, o = n, l = C(null), i = C(t.maxWidth), a = C(1);
|
|
1798
|
+
return U(
|
|
1799
|
+
[l, () => t.maxWidth],
|
|
1800
|
+
async ([r, u]) => {
|
|
1801
|
+
if (r && u) {
|
|
1802
|
+
i.value = u, await lt();
|
|
1803
|
+
const { width: s, height: d } = r.getBoundingClientRect();
|
|
1804
|
+
i.value = s + Vt > u ? u : s + Vt, a.value = Math.ceil(d);
|
|
1805
|
+
}
|
|
1806
|
+
},
|
|
1807
|
+
{ immediate: !0 }
|
|
1808
|
+
), U(i, async (r) => {
|
|
1809
|
+
r !== t.maxWidth && (await lt(), o("lume__internal--node-resize"));
|
|
1810
|
+
}), (r, u) => e.maxWidth ? (b(), O("foreignObject", {
|
|
1811
|
+
key: 1,
|
|
1812
|
+
class: "lume-alluvial-group__node-foreign",
|
|
1813
|
+
y: e.bottom ? "0.1em" : -a.value + 1,
|
|
1814
|
+
x: e.left ? -i.value : 0,
|
|
1815
|
+
width: i.value,
|
|
1816
|
+
height: a.value
|
|
1817
|
+
}, [
|
|
1818
|
+
P("div", xa, [
|
|
1819
|
+
P("span", {
|
|
1820
|
+
ref_key: "text",
|
|
1821
|
+
ref: l,
|
|
1822
|
+
class: "lume-alluvial-group__node-label"
|
|
1823
|
+
}, [
|
|
1824
|
+
F(r.$slots, "default", {}, void 0, !0)
|
|
1825
|
+
], 512)
|
|
1826
|
+
])
|
|
1827
|
+
], 8, Ia)) : (b(), O("text", {
|
|
1828
|
+
key: 0,
|
|
1829
|
+
class: "lume-alluvial-group__node-label",
|
|
1830
|
+
dy: e.bottom ? ".2em" : "-.2em",
|
|
1831
|
+
"dominant-baseline": e.bottom ? "hanging" : "auto"
|
|
1832
|
+
}, [
|
|
1833
|
+
F(r.$slots, "default", {}, void 0, !0)
|
|
1834
|
+
], 8, wa));
|
|
1835
|
+
}
|
|
1836
|
+
}), Na = /* @__PURE__ */ ae(Oa, [["__scopeId", "data-v-7126dfdb"]]), Ea = ["y", "dominant-baseline"], Da = /* @__PURE__ */ Q({
|
|
1837
|
+
__name: "lume-alluvial-node-value",
|
|
1838
|
+
props: {
|
|
1839
|
+
bottom: { type: Boolean, default: !0 }
|
|
1840
|
+
},
|
|
1841
|
+
setup(e) {
|
|
1842
|
+
return (n, t) => (b(), O("text", {
|
|
1843
|
+
class: "lume-alluvial-group__node-value",
|
|
1844
|
+
y: e.bottom ? ".2em" : "-.2em",
|
|
1845
|
+
"dominant-baseline": e.bottom ? "hanging" : "auto"
|
|
1846
|
+
}, [
|
|
1847
|
+
F(n.$slots, "default", {}, void 0, !0)
|
|
1848
|
+
], 8, Ea));
|
|
1849
|
+
}
|
|
1850
|
+
}), Ba = /* @__PURE__ */ ae(Da, [["__scopeId", "data-v-b4fc758b"]]), Ra = ["transform"], Ha = ["transform"], Ma = ["transform"], Sa = /* @__PURE__ */ Q({
|
|
1851
|
+
__name: "lume-alluvial-node-header",
|
|
1852
|
+
props: {
|
|
1853
|
+
align: {
|
|
1854
|
+
type: String,
|
|
1855
|
+
default: "center"
|
|
1856
|
+
},
|
|
1857
|
+
x: { type: Number, required: !0 },
|
|
1858
|
+
y: { type: Number, required: !0 }
|
|
1859
|
+
},
|
|
1860
|
+
setup(e) {
|
|
1861
|
+
const n = e, t = C(null), o = f(() => {
|
|
1862
|
+
var r;
|
|
1863
|
+
return ((r = t.value) == null ? void 0 : r.getBBox().width) ?? 0;
|
|
1864
|
+
}), l = f(() => n.align === "left" ? 0 : n.align === "right" ? -o.value : -o.value / 2), i = f(
|
|
1865
|
+
() => t.value && `translate(${l.value}, 0)`
|
|
1866
|
+
), a = f(
|
|
1867
|
+
() => t.value && `translate(${l.value + o.value}, 0)`
|
|
1868
|
+
);
|
|
1869
|
+
return (r, u) => (b(), O("g", {
|
|
1870
|
+
transform: `translate(${e.x}, ${e.y})`
|
|
1871
|
+
}, [
|
|
1872
|
+
P("g", { transform: i.value }, [
|
|
1873
|
+
F(r.$slots, "before", {}, void 0, !0)
|
|
1874
|
+
], 8, Ha),
|
|
1875
|
+
P("text", {
|
|
1876
|
+
ref_key: "textRef",
|
|
1877
|
+
ref: t,
|
|
1878
|
+
class: ue(["lume-alluvial-group__node-header lume-typography--caption", {
|
|
1879
|
+
[`lume-alluvial-group__node-header--${e.align}`]: e.align !== "center"
|
|
1880
|
+
}])
|
|
1881
|
+
}, [
|
|
1882
|
+
F(r.$slots, "default", {}, void 0, !0)
|
|
1883
|
+
], 2),
|
|
1884
|
+
P("g", { transform: a.value }, [
|
|
1885
|
+
F(r.$slots, "after", {}, void 0, !0)
|
|
1886
|
+
], 8, Ma)
|
|
1887
|
+
], 8, Ra));
|
|
1888
|
+
}
|
|
1889
|
+
}), Ga = /* @__PURE__ */ ae(Sa, [["__scopeId", "data-v-ee436a8d"]]);
|
|
1890
|
+
function zt(e, n) {
|
|
1891
|
+
return {
|
|
1892
|
+
x0: 0 + (n ? n.left : 0),
|
|
1893
|
+
y0: 0 + (n ? n.top : 0),
|
|
1894
|
+
x1: e.width - (n ? n.right : 0),
|
|
1895
|
+
y1: e.height - (n ? n.bottom : 0)
|
|
1896
|
+
};
|
|
1897
|
+
}
|
|
1898
|
+
function Ca(e) {
|
|
1899
|
+
const n = C(zt(e));
|
|
1900
|
+
function t(o) {
|
|
1901
|
+
n.value = zt(e, o);
|
|
1902
|
+
}
|
|
1903
|
+
return { extents: n, updateExtents: t };
|
|
1904
|
+
}
|
|
1905
|
+
var Je = /* @__PURE__ */ ((e) => (e.GraphProblem = "There was an issue generating your alluvial graph.", e.BarScaleDomainAbove0 = "Bar linear scale domain cannot start above 0!", e.BarScaleNull = "Bar linear scale cannot be `null`", e))(Je || {});
|
|
1906
|
+
const Fa = "[lume] ";
|
|
1907
|
+
function ft(e, n, t = !0) {
|
|
1908
|
+
t && Qt() || console.error(Fa + "Error: " + e, n);
|
|
1909
|
+
}
|
|
1910
|
+
const ja = 200;
|
|
1911
|
+
function fe(e) {
|
|
1912
|
+
return typeof e == "string" || typeof e == "number" ? e : e.id ?? e.label;
|
|
1913
|
+
}
|
|
1914
|
+
function Pa(e, n) {
|
|
1915
|
+
return n.nodes.find((t) => t.id === e);
|
|
1916
|
+
}
|
|
1917
|
+
function Va(e, n) {
|
|
1918
|
+
return n.links.find((t) => t.id === e);
|
|
1919
|
+
}
|
|
1920
|
+
function vn(e) {
|
|
1921
|
+
return !!(e.sourceLinks && e.targetLinks);
|
|
1922
|
+
}
|
|
1923
|
+
function $t(e) {
|
|
1924
|
+
return Math.max(
|
|
1925
|
+
...e.filter((n) => n.parentNodeId == null).map(({ layer: n }) => n)
|
|
1926
|
+
);
|
|
1927
|
+
}
|
|
1928
|
+
function fn(e) {
|
|
1929
|
+
return e.layer === 0;
|
|
1930
|
+
}
|
|
1931
|
+
function mn(e, n) {
|
|
1932
|
+
return e.parentNodeId == null && e.layer === n;
|
|
1933
|
+
}
|
|
1934
|
+
function gn(e, n, t) {
|
|
1935
|
+
return fn(e) ? n.alignFirstNodeLabels !== "right" : mn(e, t) ? n.alignLastNodeLabels === "left" : !1;
|
|
1936
|
+
}
|
|
1937
|
+
function za(e, n, t) {
|
|
1938
|
+
if (!n) return;
|
|
1939
|
+
const o = $t(e.nodes), l = e.nodes.filter((u) => fn(u)).map((u) => `${u.id}`), i = e.nodes.filter((u) => mn(u, o)).map((u) => `${u.id}`), a = n.filter((u) => l.includes(u.dataset.id)).reduce(
|
|
1940
|
+
(u, s) => Math.max(u, s.getBBox().width),
|
|
1941
|
+
-1 / 0
|
|
1942
|
+
), r = n.filter((u) => i.includes(u.dataset.id)).reduce(
|
|
1943
|
+
(u, s) => Math.max(u, s.getBBox().width),
|
|
1944
|
+
-1 / 0
|
|
1945
|
+
);
|
|
1946
|
+
return {
|
|
1947
|
+
left: t.alignFirstNodeLabels === "right" ? 0 : a,
|
|
1948
|
+
top: 0,
|
|
1949
|
+
right: t.alignLastNodeLabels === "left" ? 0 : r,
|
|
1950
|
+
bottom: 0
|
|
1951
|
+
};
|
|
1952
|
+
}
|
|
1953
|
+
function Wa(e, n) {
|
|
1954
|
+
const t = $t(e);
|
|
1955
|
+
return e.map((o) => {
|
|
1956
|
+
const l = o.y1 - o.y0 < Fe;
|
|
1957
|
+
return {
|
|
1958
|
+
x: o.x0,
|
|
1959
|
+
y: o.y0 - (l ? Fe / 2 : 0),
|
|
1960
|
+
// Negative offset to account for the min. height
|
|
1961
|
+
width: o.x1 - o.x0,
|
|
1962
|
+
height: l ? Fe : o.y1 - o.y0,
|
|
1963
|
+
textTransform: {
|
|
1964
|
+
x: gn(o, n, t) ? o.x0 - Pt : o.x1 + Pt,
|
|
1965
|
+
y: (o.y1 + o.y0) / 2
|
|
1966
|
+
},
|
|
1967
|
+
node: o
|
|
1968
|
+
};
|
|
1969
|
+
});
|
|
1970
|
+
}
|
|
1971
|
+
function Ua(e) {
|
|
1972
|
+
return [e.source.x1, e.y0];
|
|
1973
|
+
}
|
|
1974
|
+
function Za(e) {
|
|
1975
|
+
return [e.target.x0, e.y1];
|
|
1976
|
+
}
|
|
1977
|
+
function Xa(e) {
|
|
1978
|
+
return e.curveFunction ? On(e.curveFunction).source(Ua).target(Za) : Tn();
|
|
1979
|
+
}
|
|
1980
|
+
function Ya(e) {
|
|
1981
|
+
return e.map((n) => {
|
|
1982
|
+
var t;
|
|
1983
|
+
return {
|
|
1984
|
+
id: n.id,
|
|
1985
|
+
color: n.color || ((t = n.source) == null ? void 0 : t.color) || We,
|
|
1986
|
+
d: Xa(n)(n),
|
|
1987
|
+
strokeWidth: Math.max(1, n.width),
|
|
1988
|
+
link: n
|
|
1989
|
+
};
|
|
1990
|
+
});
|
|
1991
|
+
}
|
|
1992
|
+
function Wt(e, n, t, o, l) {
|
|
1993
|
+
if (o === !1) {
|
|
1994
|
+
e.node = {
|
|
1995
|
+
...e.node,
|
|
1996
|
+
transitionValue: l ? void 0 : t
|
|
1997
|
+
};
|
|
1998
|
+
return;
|
|
1999
|
+
}
|
|
2000
|
+
const i = Date.now(), a = Vn(n, t), r = () => {
|
|
2001
|
+
let s = (Date.now() - i) / ja;
|
|
2002
|
+
s > 1 && (s = 1), e.node = {
|
|
2003
|
+
...e.node,
|
|
2004
|
+
transitionValue: l && s === 1 ? void 0 : a(s)
|
|
2005
|
+
}, s < 1 && requestAnimationFrame(r);
|
|
2006
|
+
};
|
|
2007
|
+
requestAnimationFrame(r);
|
|
2008
|
+
}
|
|
2009
|
+
const Ka = ":aggregated";
|
|
2010
|
+
function Ja(e) {
|
|
2011
|
+
const n = C([]), t = f(() => {
|
|
2012
|
+
var s, d;
|
|
2013
|
+
const u = /* @__PURE__ */ new Map();
|
|
2014
|
+
return (d = (s = e.value) == null ? void 0 : s[0]) == null || d.values.forEach(({ value: c, expandableNodes: p }) => {
|
|
2015
|
+
p != null && p.length && u.set(c, [...p]);
|
|
2016
|
+
}), u;
|
|
2017
|
+
}), o = f(
|
|
2018
|
+
() => {
|
|
2019
|
+
const u = /* @__PURE__ */ new Map();
|
|
2020
|
+
return t.value.forEach((s, d) => {
|
|
2021
|
+
s.forEach((c) => u.set(c, d));
|
|
2022
|
+
}), u;
|
|
2023
|
+
}
|
|
2024
|
+
);
|
|
2025
|
+
function l(u) {
|
|
2026
|
+
return t.value.has(u);
|
|
2027
|
+
}
|
|
2028
|
+
function i(u) {
|
|
2029
|
+
return o.value.has(u);
|
|
2030
|
+
}
|
|
2031
|
+
function a(u) {
|
|
2032
|
+
return n.value.includes(u);
|
|
2033
|
+
}
|
|
2034
|
+
function r(u) {
|
|
2035
|
+
l(u) && (n.value = a(u) ? n.value.filter((s) => s !== u) : [...n.value, u]);
|
|
2036
|
+
}
|
|
2037
|
+
return U(e, () => n.value = []), {
|
|
2038
|
+
childIdsByParentId: t,
|
|
2039
|
+
expandedNodeIds: n,
|
|
2040
|
+
isExpandableNode: l,
|
|
2041
|
+
isExpandedNode: a,
|
|
2042
|
+
isSubNode: i,
|
|
2043
|
+
parentIdByChildId: o,
|
|
2044
|
+
toggleNodeExpansion: r
|
|
2045
|
+
};
|
|
2046
|
+
}
|
|
2047
|
+
function Qa(e, n, t, o) {
|
|
2048
|
+
if (!e || !n || o.size === 0)
|
|
2049
|
+
return { nodes: e, links: n };
|
|
2050
|
+
const l = n.filter(
|
|
2051
|
+
(a) => !o.has(fe(a.source)) && !o.has(fe(a.target))
|
|
2052
|
+
), i = new Set(l.map(({ id: a }) => a));
|
|
2053
|
+
return t.forEach((a, r) => {
|
|
2054
|
+
const u = /* @__PURE__ */ new Map();
|
|
2055
|
+
a.forEach((s) => {
|
|
2056
|
+
pn(n, s).forEach((d) => {
|
|
2057
|
+
const c = fe(d.target), p = u.get(c);
|
|
2058
|
+
if (p) {
|
|
2059
|
+
p.value += d.value;
|
|
2060
|
+
return;
|
|
2061
|
+
}
|
|
2062
|
+
const y = `${r}:${c}`;
|
|
2063
|
+
u.set(c, {
|
|
2064
|
+
id: i.has(y) ? `${y}${Ka}` : y,
|
|
2065
|
+
aggregatedFrom: r,
|
|
2066
|
+
color: d.color,
|
|
2067
|
+
curveFunction: d.curveFunction,
|
|
2068
|
+
source: r,
|
|
2069
|
+
target: c,
|
|
2070
|
+
value: d.value
|
|
2071
|
+
});
|
|
2072
|
+
});
|
|
2073
|
+
}), l.push(...u.values());
|
|
2074
|
+
}), {
|
|
2075
|
+
nodes: e.filter((a) => !o.has(a.id)),
|
|
2076
|
+
links: l
|
|
2077
|
+
};
|
|
2078
|
+
}
|
|
2079
|
+
function qa({
|
|
2080
|
+
graph: e,
|
|
2081
|
+
nodes: n,
|
|
2082
|
+
linkDefinitions: t,
|
|
2083
|
+
expandedNodeIds: o,
|
|
2084
|
+
childIdsByParentId: l,
|
|
2085
|
+
options: i,
|
|
2086
|
+
extents: a
|
|
2087
|
+
}) {
|
|
2088
|
+
var r;
|
|
2089
|
+
(r = e == null ? void 0 : e.nodes) != null && r.length && o.forEach((u) => {
|
|
2090
|
+
const s = e.nodes.find((c) => c.id === u), d = (l.get(u) ?? []).map((c) => n.find((p) => p.id === c)).filter(Boolean);
|
|
2091
|
+
!s || !d.length || el({ graph: e, parent: s, children: d, linkDefinitions: t, options: i, extents: a });
|
|
2092
|
+
});
|
|
2093
|
+
}
|
|
2094
|
+
function el({
|
|
2095
|
+
graph: e,
|
|
2096
|
+
parent: n,
|
|
2097
|
+
children: t,
|
|
2098
|
+
linkDefinitions: o,
|
|
2099
|
+
options: l,
|
|
2100
|
+
extents: i
|
|
2101
|
+
}) {
|
|
2102
|
+
const a = t.map(
|
|
2103
|
+
(d) => rl(o, n, d)
|
|
2104
|
+
), r = a.reduce((d, c) => d + c, 0);
|
|
2105
|
+
if (!r) return;
|
|
2106
|
+
const u = (n.y1 - n.y0) / r;
|
|
2107
|
+
tl({
|
|
2108
|
+
parent: n,
|
|
2109
|
+
children: t,
|
|
2110
|
+
childValues: a,
|
|
2111
|
+
scale: u,
|
|
2112
|
+
graph: e,
|
|
2113
|
+
options: l,
|
|
2114
|
+
extents: i
|
|
2115
|
+
});
|
|
2116
|
+
const s = al({
|
|
2117
|
+
parent: n,
|
|
2118
|
+
children: t,
|
|
2119
|
+
childValues: a,
|
|
2120
|
+
scale: u,
|
|
2121
|
+
linkDefinitions: o
|
|
2122
|
+
});
|
|
2123
|
+
ul(e, n).forEach((d) => {
|
|
2124
|
+
const c = ll({
|
|
2125
|
+
children: t,
|
|
2126
|
+
aggregatedLink: d,
|
|
2127
|
+
scale: u,
|
|
2128
|
+
linkDefinitions: o
|
|
2129
|
+
});
|
|
2130
|
+
Ut(e.links, d, c), Ut(
|
|
2131
|
+
d.target.targetLinks,
|
|
2132
|
+
d,
|
|
2133
|
+
c
|
|
2134
|
+
);
|
|
2135
|
+
}), n.sourceLinks = [
|
|
2136
|
+
...n.sourceLinks.filter(
|
|
2137
|
+
(d) => d.aggregatedFrom !== n.id
|
|
2138
|
+
),
|
|
2139
|
+
...s
|
|
2140
|
+
], e.links.push(...s), e.nodes.push(...t);
|
|
2141
|
+
}
|
|
2142
|
+
function tl({
|
|
2143
|
+
parent: e,
|
|
2144
|
+
children: n,
|
|
2145
|
+
childValues: t,
|
|
2146
|
+
scale: o,
|
|
2147
|
+
graph: l,
|
|
2148
|
+
options: i,
|
|
2149
|
+
extents: a
|
|
2150
|
+
}) {
|
|
2151
|
+
const r = e.x1 - e.x0, u = e.x1, s = il(l, e) ?? a.x1, d = Math.max(u, u + (s - u - r) / 2), c = t.map((k) => k * o), p = nl(n, i.nodePadding ?? 0), y = [...c, ...p].reduce(
|
|
2152
|
+
(k, x) => k + x,
|
|
2153
|
+
0
|
|
2154
|
+
);
|
|
2155
|
+
let A = ol({ parent: e, children: n, totalHeight: y, extents: a });
|
|
2156
|
+
n.forEach((k, x) => {
|
|
2157
|
+
A += p[x], k.x0 = d, k.x1 = d + r, k.y0 = A, k.y1 = A + c[x], k.depth = e.depth + 0.5, k.layer = e.layer + 0.5, k.parentNodeId = e.id, k.value = t[x], k.sourceLinks = [], k.targetLinks = [], A = k.y1;
|
|
2158
|
+
});
|
|
2159
|
+
}
|
|
2160
|
+
function nl(e, n) {
|
|
2161
|
+
return e.map(({ offset: t }, o) => o === 0 ? 0 : typeof t == "number" ? t : n);
|
|
2162
|
+
}
|
|
2163
|
+
function ol({
|
|
2164
|
+
parent: e,
|
|
2165
|
+
children: n,
|
|
2166
|
+
totalHeight: t,
|
|
2167
|
+
extents: o
|
|
2168
|
+
}) {
|
|
2169
|
+
const { offset: l } = n[0];
|
|
2170
|
+
return typeof l == "number" ? e.y0 + l : sl(
|
|
2171
|
+
(e.y0 + e.y1) / 2 - t / 2,
|
|
2172
|
+
o.y0,
|
|
2173
|
+
Math.max(o.y0, o.y1 - t)
|
|
2174
|
+
);
|
|
2175
|
+
}
|
|
2176
|
+
function al({
|
|
2177
|
+
parent: e,
|
|
2178
|
+
children: n,
|
|
2179
|
+
childValues: t,
|
|
2180
|
+
scale: o,
|
|
2181
|
+
linkDefinitions: l
|
|
2182
|
+
}) {
|
|
2183
|
+
let i = e.y0;
|
|
2184
|
+
return n.map((a, r) => {
|
|
2185
|
+
const u = wt(l, e.id, a.id), s = t[r] * o, d = {
|
|
2186
|
+
id: (u == null ? void 0 : u.id) ?? `${e.id}:${a.id}`,
|
|
2187
|
+
color: u == null ? void 0 : u.color,
|
|
2188
|
+
curveFunction: u == null ? void 0 : u.curveFunction,
|
|
2189
|
+
source: e,
|
|
2190
|
+
target: a,
|
|
2191
|
+
value: t[r],
|
|
2192
|
+
width: s,
|
|
2193
|
+
y0: i + s / 2,
|
|
2194
|
+
y1: (a.y0 + a.y1) / 2
|
|
2195
|
+
};
|
|
2196
|
+
return i += s, a.targetLinks.push(d), d;
|
|
2197
|
+
});
|
|
2198
|
+
}
|
|
2199
|
+
function ll({
|
|
2200
|
+
children: e,
|
|
2201
|
+
aggregatedLink: n,
|
|
2202
|
+
scale: t,
|
|
2203
|
+
linkDefinitions: o
|
|
2204
|
+
}) {
|
|
2205
|
+
const l = n.target;
|
|
2206
|
+
let i = n.y1 - n.width / 2;
|
|
2207
|
+
return e.reduce((a, r) => {
|
|
2208
|
+
const u = wt(o, r.id, l.id);
|
|
2209
|
+
if (!u) return a;
|
|
2210
|
+
const s = u.value * t, d = r.sourceLinks.reduce(
|
|
2211
|
+
(p, { width: y }) => p + y,
|
|
2212
|
+
r.y0
|
|
2213
|
+
), c = {
|
|
2214
|
+
id: u.id,
|
|
2215
|
+
color: u.color,
|
|
2216
|
+
curveFunction: u.curveFunction,
|
|
2217
|
+
source: r,
|
|
2218
|
+
target: l,
|
|
2219
|
+
value: u.value,
|
|
2220
|
+
width: s,
|
|
2221
|
+
y0: d + s / 2,
|
|
2222
|
+
y1: i + s / 2
|
|
2223
|
+
};
|
|
2224
|
+
return i += s, r.sourceLinks.push(c), a.push(c), a;
|
|
2225
|
+
}, []);
|
|
2226
|
+
}
|
|
2227
|
+
function ul(e, n) {
|
|
2228
|
+
return e.links.filter(
|
|
2229
|
+
(t) => t.aggregatedFrom === n.id
|
|
2230
|
+
);
|
|
2231
|
+
}
|
|
2232
|
+
function pn(e, n) {
|
|
2233
|
+
return e.filter(
|
|
2234
|
+
(t) => fe(t.source) === n
|
|
2235
|
+
);
|
|
2236
|
+
}
|
|
2237
|
+
function wt(e, n, t) {
|
|
2238
|
+
return e.find(
|
|
2239
|
+
(o) => fe(o.source) === n && fe(o.target) === t
|
|
2240
|
+
);
|
|
2241
|
+
}
|
|
2242
|
+
function rl(e, n, t) {
|
|
2243
|
+
const o = wt(e, n.id, t.id);
|
|
2244
|
+
return o ? o.value : pn(e, t.id).reduce(
|
|
2245
|
+
(l, { value: i }) => l + i,
|
|
2246
|
+
0
|
|
2247
|
+
);
|
|
2248
|
+
}
|
|
2249
|
+
function il(e, n) {
|
|
2250
|
+
const t = e.nodes.filter(
|
|
2251
|
+
(o) => o.layer === n.layer + 1
|
|
2252
|
+
);
|
|
2253
|
+
return t.length ? Math.min(...t.map(({ x0: o }) => o)) : null;
|
|
2254
|
+
}
|
|
2255
|
+
function Ut(e, n, t) {
|
|
2256
|
+
const o = e.indexOf(n);
|
|
2257
|
+
if (o === -1) {
|
|
2258
|
+
e.push(...t);
|
|
2259
|
+
return;
|
|
2260
|
+
}
|
|
2261
|
+
e.splice(o, 1, ...t);
|
|
2262
|
+
}
|
|
2263
|
+
function sl(e, n, t) {
|
|
2264
|
+
return Math.max(n, Math.min(e, t));
|
|
2265
|
+
}
|
|
2266
|
+
const cl = {
|
|
2267
|
+
nodes: [],
|
|
2268
|
+
links: []
|
|
2269
|
+
};
|
|
2270
|
+
function Zt(e, n) {
|
|
2271
|
+
return n.find((t) => t.every((o) => o.layer === e.layer));
|
|
2272
|
+
}
|
|
2273
|
+
function dl(e, n, t) {
|
|
2274
|
+
const o = C(null), {
|
|
2275
|
+
childIdsByParentId: l,
|
|
2276
|
+
expandedNodeIds: i,
|
|
2277
|
+
isExpandableNode: a,
|
|
2278
|
+
isSubNode: r,
|
|
2279
|
+
parentIdByChildId: u,
|
|
2280
|
+
toggleNodeExpansion: s
|
|
2281
|
+
} = Ja(e), d = f(() => {
|
|
2282
|
+
var g, _;
|
|
2283
|
+
return (_ = (g = e.value) == null ? void 0 : g[0]) == null ? void 0 : _.values.map(
|
|
2284
|
+
({
|
|
2285
|
+
label: m,
|
|
2286
|
+
color: T,
|
|
2287
|
+
value: N,
|
|
2288
|
+
deriveColorFromIncomingLinks: E,
|
|
2289
|
+
expandableNodes: M,
|
|
2290
|
+
offset: G
|
|
2291
|
+
}) => ({
|
|
2292
|
+
label: m || N.toString(),
|
|
2293
|
+
color: T,
|
|
2294
|
+
fallbackColor: T || We,
|
|
2295
|
+
id: N,
|
|
2296
|
+
deriveColorFromIncomingLinks: E,
|
|
2297
|
+
expandableNodes: M,
|
|
2298
|
+
offset: G
|
|
2299
|
+
})
|
|
2300
|
+
);
|
|
2301
|
+
}), c = f(
|
|
2302
|
+
() => {
|
|
2303
|
+
var g, _;
|
|
2304
|
+
return (_ = (g = e.value) == null ? void 0 : g[0]) == null ? void 0 : _.values.map(
|
|
2305
|
+
(m) => {
|
|
2306
|
+
var T;
|
|
2307
|
+
return (T = m.targets) == null ? void 0 : T.map(
|
|
2308
|
+
({ node: N, value: E, color: M, curveFunction: G }) => ({
|
|
2309
|
+
id: `${m.value}:${N}`,
|
|
2310
|
+
color: M,
|
|
2311
|
+
curveFunction: G,
|
|
2312
|
+
source: m.value ?? m.label,
|
|
2313
|
+
target: N,
|
|
2314
|
+
value: E
|
|
2315
|
+
})
|
|
2316
|
+
);
|
|
2317
|
+
}
|
|
2318
|
+
).filter(Boolean).flat();
|
|
2319
|
+
}
|
|
2320
|
+
), p = f(() => $n().nodeId(fe).nodeAlign(n.value.nodeAlign).nodePadding(n.value.nodePadding).nodeSort(n.value.nodeSort).nodeWidth(n.value.nodeWidth).linkSort(n.value.linkSort).iterations(n.value.iterations)), y = f(() => {
|
|
2321
|
+
var g;
|
|
2322
|
+
return (g = o.value) == null ? void 0 : g.nodes.filter((_) => _.parentNodeId == null).reduce((_, m) => {
|
|
2323
|
+
const T = Zt(m, _);
|
|
2324
|
+
return T ? (T.push(m), T.sort((N, E) => (N._y0 || N.y0) - (E._y0 || E.y0))) : _.push([m]), _;
|
|
2325
|
+
}, []).sort((_, m) => _[0].layer - m[0].layer);
|
|
2326
|
+
});
|
|
2327
|
+
function A(g) {
|
|
2328
|
+
const { offset: _ } = g, m = Zt(g, y.value);
|
|
2329
|
+
if (!m) return;
|
|
2330
|
+
const T = m[m.findIndex((E) => E.id === g.id) - 1], N = T && m.length !== 1 ? T.y1 + _ : _;
|
|
2331
|
+
g._y0 = g.y0, g._y1 = g.y1, g.y0 = N, g.y1 = g.y0 + (g._y1 - g._y0);
|
|
2332
|
+
}
|
|
2333
|
+
function k(g, _) {
|
|
2334
|
+
const { id: m, _y0: T, y0: N } = g, E = _.links.filter(
|
|
2335
|
+
(te) => te.source.id === m
|
|
2336
|
+
), M = _.links.filter(
|
|
2337
|
+
(te) => te.target.id === m
|
|
2338
|
+
), G = N - T;
|
|
2339
|
+
E.forEach((te) => te.y0 += G), M.forEach((te) => te.y1 += G);
|
|
2340
|
+
}
|
|
2341
|
+
const x = f(() => {
|
|
2342
|
+
var g;
|
|
2343
|
+
return o.value && ((g = d.value) == null || g.forEach((_) => {
|
|
2344
|
+
_.value === 0 && (_.fallbackColor = kt.Grey), typeof _.offset == "number" && !r(_.id) && (A(_), k(_, o.value));
|
|
2345
|
+
})), o.value;
|
|
2346
|
+
});
|
|
2347
|
+
return U([p, t, i], () => {
|
|
2348
|
+
try {
|
|
2349
|
+
const { x0: g, y0: _, x1: m, y1: T } = t.value, N = p.value.extent([
|
|
2350
|
+
[g, _],
|
|
2351
|
+
[m, T]
|
|
2352
|
+
])(
|
|
2353
|
+
Qa(
|
|
2354
|
+
d.value,
|
|
2355
|
+
c.value,
|
|
2356
|
+
l.value,
|
|
2357
|
+
u.value
|
|
2358
|
+
)
|
|
2359
|
+
);
|
|
2360
|
+
qa({
|
|
2361
|
+
graph: N,
|
|
2362
|
+
nodes: d.value,
|
|
2363
|
+
linkDefinitions: c.value,
|
|
2364
|
+
expandedNodeIds: i.value,
|
|
2365
|
+
childIdsByParentId: l.value,
|
|
2366
|
+
options: n.value,
|
|
2367
|
+
extents: t.value
|
|
2368
|
+
}), o.value = N;
|
|
2369
|
+
} catch (g) {
|
|
2370
|
+
ft(Je.GraphProblem, g), o.value = cl;
|
|
2371
|
+
}
|
|
2372
|
+
}), { columns: y, graph: x, isExpandableNode: a, toggleNodeExpansion: s };
|
|
2373
|
+
}
|
|
2374
|
+
function mt(e, n) {
|
|
2375
|
+
return n || (n = {}), e.targetLinks && e.targetLinks.forEach(({ source: t, value: o }) => {
|
|
2376
|
+
n[t.id] = o, mt(
|
|
2377
|
+
t,
|
|
2378
|
+
n
|
|
2379
|
+
);
|
|
2380
|
+
}), n;
|
|
2381
|
+
}
|
|
2382
|
+
function gt(e, n) {
|
|
2383
|
+
return n || (n = {}), e.sourceLinks && e.sourceLinks.forEach(({ target: t, value: o }) => {
|
|
2384
|
+
n[t.id] = o, gt(
|
|
2385
|
+
t,
|
|
2386
|
+
n
|
|
2387
|
+
);
|
|
2388
|
+
}), n;
|
|
2389
|
+
}
|
|
2390
|
+
function vl(e, n) {
|
|
2391
|
+
return n.links.reduce((t, o) => (o.source.id in e && o.target.id in e && t.push(o.id), t), []);
|
|
2392
|
+
}
|
|
2393
|
+
const fl = (e, n) => {
|
|
2394
|
+
let t;
|
|
2395
|
+
vn(e) ? t = {
|
|
2396
|
+
[e.id]: e.value,
|
|
2397
|
+
...mt(e),
|
|
2398
|
+
...gt(e)
|
|
2399
|
+
} : t = {
|
|
2400
|
+
[e.source.id]: e.source.value,
|
|
2401
|
+
[e.target.id]: e.target.value,
|
|
2402
|
+
...mt(e.source),
|
|
2403
|
+
...gt(e.target)
|
|
2404
|
+
};
|
|
2405
|
+
const o = vl(t, n);
|
|
2406
|
+
return { nodes: t, links: o };
|
|
2407
|
+
}, ml = (e) => {
|
|
2408
|
+
if (vn(e)) {
|
|
2409
|
+
const n = [...e.sourceLinks, ...e.targetLinks];
|
|
2410
|
+
return {
|
|
2411
|
+
nodes: n.reduce(
|
|
2412
|
+
(t, { source: o, target: l, value: i }) => o === e ? { ...t, [fe(l)]: i } : { ...t, [fe(o)]: i },
|
|
2413
|
+
{ [fe(e)]: e.value }
|
|
2414
|
+
),
|
|
2415
|
+
links: n.map(({ id: t }) => t)
|
|
2416
|
+
};
|
|
2417
|
+
}
|
|
2418
|
+
return {
|
|
2419
|
+
nodes: {
|
|
2420
|
+
[fe(e.target)]: e.value,
|
|
2421
|
+
[fe(e.source)]: e.source.value
|
|
2422
|
+
},
|
|
2423
|
+
links: [e.id]
|
|
2424
|
+
};
|
|
2425
|
+
};
|
|
2426
|
+
function gl(e, n, t) {
|
|
2427
|
+
const o = C(null), l = f(() => o.value ? typeof n.value.highlightedElements == "function" ? n.value.highlightedElements(
|
|
2428
|
+
o.value,
|
|
2429
|
+
t.value
|
|
2430
|
+
) : n.value.highlightedElements === "closest" ? ml(o.value, t.value) : fl(o.value, t.value) : { nodes: {}, links: [] });
|
|
2431
|
+
return U(l, (i, a) => {
|
|
2432
|
+
if (i.links.length === 0 && Object.keys(i.nodes).length === 0) {
|
|
2433
|
+
e.value.forEach((r) => {
|
|
2434
|
+
r.node.id in a.nodes && Wt(
|
|
2435
|
+
r,
|
|
2436
|
+
a.nodes[r.node.id],
|
|
2437
|
+
r.node.value,
|
|
2438
|
+
n.value.withTransition,
|
|
2439
|
+
!0
|
|
2440
|
+
);
|
|
2441
|
+
});
|
|
2442
|
+
return;
|
|
2443
|
+
}
|
|
2444
|
+
e.value.forEach((r) => {
|
|
2445
|
+
r.node.id in i.nodes && Wt(
|
|
2446
|
+
r,
|
|
2447
|
+
r.node.value,
|
|
2448
|
+
i.nodes[r.node.id],
|
|
2449
|
+
n.value.withTransition
|
|
2450
|
+
);
|
|
2451
|
+
});
|
|
2452
|
+
}), { highlightedElements: l, hoveredElement: o };
|
|
2453
|
+
}
|
|
2454
|
+
const pl = {
|
|
2455
|
+
class: "lume-alluvial-group",
|
|
2456
|
+
"data-j-alluvial-group": ""
|
|
2457
|
+
}, hl = { key: 0 }, yl = { key: 0 }, _l = ["id", "x1", "x2"], kl = ["stop-color"], bl = ["stop-color"], Al = ["d", "stroke-width", "onClick", "onMouseover"], Ll = ["d", "stroke", "stroke-dasharray", "stroke-dashoffset", "stroke-width", "data-id", "onClick", "onMouseover"], Tl = ["tabindex", "onClick", "onKeydown", "onMouseenter", "onMouseleave", "onMouseover", "onFocus"], $l = ["onClick"], wl = ["x", "y", "height", "width", "onClick"], Il = ["x", "y", "height", "width", "rx", "onClick"], xl = ["transform", "data-id", "width"], Ol = /* @__PURE__ */ Q({
|
|
2458
|
+
__name: "lume-alluvial-group",
|
|
2459
|
+
props: {
|
|
2460
|
+
...tt(),
|
|
2461
|
+
hoveredElementId: {
|
|
2462
|
+
type: [Number, String],
|
|
2463
|
+
default: null
|
|
2464
|
+
}
|
|
2465
|
+
},
|
|
2466
|
+
emits: ["node-click", "node-mouseenter", "node-mouseleave", "link-click", "link-mouseenter", "link-mouseleave"],
|
|
2467
|
+
setup(e, { emit: n }) {
|
|
2468
|
+
const t = e, o = n, l = Qe("chartID"), { data: i, options: a } = ie(t), r = C([]), u = C([]), s = C(null), d = C(null), c = C(null), { extents: p, updateExtents: y } = Ca(t.containerSize), { columns: A, graph: k, isExpandableNode: x, toggleNodeExpansion: g } = dl(i, a, p), { hoveredElement: _, highlightedElements: m } = gl(
|
|
2469
|
+
r,
|
|
2470
|
+
a,
|
|
2471
|
+
k
|
|
2472
|
+
), T = f(() => Ye(a.value.valueFormat)), N = f(
|
|
2473
|
+
() => a.value.nodeExpansionTrigger === "block"
|
|
2474
|
+
), E = f(
|
|
2475
|
+
() => Object.keys(m.value.nodes)
|
|
2476
|
+
), M = f(
|
|
2477
|
+
() => {
|
|
2478
|
+
var I, j;
|
|
2479
|
+
return (j = (I = k.value) == null ? void 0 : I.nodes) != null && j.length ? $t(k.value.nodes) : 0;
|
|
2480
|
+
}
|
|
2481
|
+
), G = f(() => {
|
|
2482
|
+
if (!A.value) return [];
|
|
2483
|
+
const I = A.value.length - 1;
|
|
2484
|
+
return A.value.map(([{ x0: j, x1: h }], V) => V === 0 && a.value.alignFirstNodeLabels === "right" ? { x: j, align: "left" } : V === I && a.value.alignLastNodeLabels === "left" ? { x: h, align: "right" } : { x: (j + h) / 2, align: "center" });
|
|
2485
|
+
}), te = f(() => {
|
|
2486
|
+
if (!(!a.value.nodeHeaders || !a.value.nodeHeaders.length))
|
|
2487
|
+
return a.value.nodeHeaders.slice(0, G.value.length).map((I, j) => ({
|
|
2488
|
+
label: I,
|
|
2489
|
+
...G.value[j]
|
|
2490
|
+
}));
|
|
2491
|
+
}), B = f(
|
|
2492
|
+
() => a.value.nodeHeaderPadding ?? Ta
|
|
2493
|
+
), q = f(() => {
|
|
2494
|
+
if (!(!a.value.gradient || !k.value))
|
|
2495
|
+
return k.value.links.reduce((I, j) => {
|
|
2496
|
+
const { source: h, target: V } = j, z = h.color || h.fallbackColor, ve = V.deriveColorFromIncomingLinks ? z : V.color || V.fallbackColor;
|
|
2497
|
+
return I[j.id] = {
|
|
2498
|
+
source: z,
|
|
2499
|
+
target: ve,
|
|
2500
|
+
x1: h.x1,
|
|
2501
|
+
x2: V.x0
|
|
2502
|
+
}, I;
|
|
2503
|
+
}, {});
|
|
2504
|
+
}), X = f(() => {
|
|
2505
|
+
const I = r.value.filter(
|
|
2506
|
+
(h) => He(h)
|
|
2507
|
+
), j = [];
|
|
2508
|
+
return I.forEach((h) => {
|
|
2509
|
+
const V = [];
|
|
2510
|
+
u.value.filter(({ link: z }) => z.target.id === h.node.id).reverse().reduce((z, ve, xt, Ue) => {
|
|
2511
|
+
const Ze = ve.link.target.y1 - ve.link.target.y0 > Fe;
|
|
2512
|
+
let $, L, w;
|
|
2513
|
+
return Ze ? ($ = ve.link.target.y1 - ve.link.target.y0, L = ve.link.value / h.node.value, w = L * $) : w = Fe / Ue.length, V.push({
|
|
2514
|
+
x: h.x,
|
|
2515
|
+
y: h.y + z,
|
|
2516
|
+
height: w,
|
|
2517
|
+
width: h.width,
|
|
2518
|
+
key: `node-block-${h.node.id}-source-link-${ve.link.source.id}`,
|
|
2519
|
+
class: `lume-alluvial-group__node-block lume-fill--${ve.link.source.color || We}`
|
|
2520
|
+
}), z + w;
|
|
2521
|
+
}, 0), j.push({
|
|
2522
|
+
id: h.node.id,
|
|
2523
|
+
subNodes: V
|
|
2524
|
+
});
|
|
2525
|
+
}), j;
|
|
2526
|
+
});
|
|
2527
|
+
function Y(I) {
|
|
2528
|
+
return a.value.gradient && `url('#${l}_${I.id}')`;
|
|
2529
|
+
}
|
|
2530
|
+
function le(I) {
|
|
2531
|
+
return E.value.length > 0 && !E.value.includes(I.toString());
|
|
2532
|
+
}
|
|
2533
|
+
function re(I) {
|
|
2534
|
+
return E.value.length > 0 && E.value.includes(I.toString());
|
|
2535
|
+
}
|
|
2536
|
+
function Le(I) {
|
|
2537
|
+
return m.value.links.length > 0 && !m.value.links.includes(I);
|
|
2538
|
+
}
|
|
2539
|
+
function Re(I) {
|
|
2540
|
+
return m.value.links.length > 0 && m.value.links.includes(I);
|
|
2541
|
+
}
|
|
2542
|
+
function Ne(I) {
|
|
2543
|
+
return gn(I, a.value, M.value);
|
|
2544
|
+
}
|
|
2545
|
+
function He(I) {
|
|
2546
|
+
return !I.node.color && I.node.deriveColorFromIncomingLinks;
|
|
2547
|
+
}
|
|
2548
|
+
function Te(I) {
|
|
2549
|
+
x(I.id) && g(I.id);
|
|
2550
|
+
}
|
|
2551
|
+
function D(I, j) {
|
|
2552
|
+
N.value || Te(I), o("node-click", { node: I, event: j });
|
|
2553
|
+
}
|
|
2554
|
+
function R(I, j) {
|
|
2555
|
+
Te(I), o("node-click", { node: I, event: j });
|
|
2556
|
+
}
|
|
2557
|
+
function H(I) {
|
|
2558
|
+
N.value && Te(I);
|
|
2559
|
+
}
|
|
2560
|
+
function ne(I, j) {
|
|
2561
|
+
I !== _.value && (_.value = I, o("link-mouseenter", { link: I, event: j }));
|
|
2562
|
+
}
|
|
2563
|
+
function se(I) {
|
|
2564
|
+
const j = _.value;
|
|
2565
|
+
_.value = null, o("link-mouseleave", { link: j, event: I });
|
|
2566
|
+
}
|
|
2567
|
+
function ye(I) {
|
|
2568
|
+
if (I == null) {
|
|
2569
|
+
_.value = null;
|
|
2570
|
+
return;
|
|
2571
|
+
}
|
|
2572
|
+
const j = Pa(I, k.value) || Va(I, k.value);
|
|
2573
|
+
if (!j) {
|
|
2574
|
+
Ie(be.InvalidHoveredElement);
|
|
2575
|
+
return;
|
|
2576
|
+
}
|
|
2577
|
+
_.value = j;
|
|
2578
|
+
}
|
|
2579
|
+
function Me(I) {
|
|
2580
|
+
var j;
|
|
2581
|
+
return ((j = X.value.find(({ id: h }) => I === h)) == null ? void 0 : j.subNodes) ?? [];
|
|
2582
|
+
}
|
|
2583
|
+
function Se() {
|
|
2584
|
+
const I = za(
|
|
2585
|
+
k.value,
|
|
2586
|
+
s.value,
|
|
2587
|
+
a.value
|
|
2588
|
+
);
|
|
2589
|
+
y(I);
|
|
2590
|
+
}
|
|
2591
|
+
return U(k, (I) => {
|
|
2592
|
+
r.value = Wa(I.nodes, a.value), u.value = Ya(I.links).reverse(), _.value == null && t.hoveredElementId != null && ye(t.hoveredElementId);
|
|
2593
|
+
}), U([d, c], () => {
|
|
2594
|
+
_.value = d.value ?? c.value;
|
|
2595
|
+
}), U([t.containerSize, s], () => {
|
|
2596
|
+
t.containerSize.width && t.containerSize.height && Se();
|
|
2597
|
+
}), U(
|
|
2598
|
+
() => [a.value.alignFirstNodeLabels, a.value.alignLastNodeLabels],
|
|
2599
|
+
Se
|
|
2600
|
+
), U(() => t.hoveredElementId, ye), (I, j) => (b(), O("g", pl, [
|
|
2601
|
+
te.value ? (b(), O("g", hl, [
|
|
2602
|
+
(b(!0), O(oe, null, J(te.value, (h, V) => F(I.$slots, `node-header-${V}`, {
|
|
2603
|
+
align: h.align,
|
|
2604
|
+
x: h.x,
|
|
2605
|
+
y: -B.value
|
|
2606
|
+
}, () => [
|
|
2607
|
+
(b(), ee(v(Ga), {
|
|
2608
|
+
key: `header_${h.x}`,
|
|
2609
|
+
align: h.align,
|
|
2610
|
+
x: h.x,
|
|
2611
|
+
y: -B.value
|
|
2612
|
+
}, {
|
|
2613
|
+
default: Z(() => [
|
|
2614
|
+
_e(ce(h.label), 1)
|
|
2615
|
+
]),
|
|
2616
|
+
_: 2
|
|
2617
|
+
}, 1032, ["align", "x", "y"]))
|
|
2618
|
+
], !0)), 256))
|
|
2619
|
+
])) : K("", !0),
|
|
2620
|
+
P("g", {
|
|
2621
|
+
class: "lume-alluvial-link-group",
|
|
2622
|
+
onMouseleave: se
|
|
2623
|
+
}, [
|
|
2624
|
+
v(a).gradient ? (b(), O("defs", yl, [
|
|
2625
|
+
(b(!0), O(oe, null, J(q.value, (h, V) => (b(), O("linearGradient", {
|
|
2626
|
+
id: `${v(l)}_${V}`,
|
|
2627
|
+
key: V,
|
|
2628
|
+
gradientUnits: "userSpaceOnUse",
|
|
2629
|
+
x1: h.x1,
|
|
2630
|
+
x2: h.x2
|
|
2631
|
+
}, [
|
|
2632
|
+
P("stop", {
|
|
2633
|
+
offset: "0%",
|
|
2634
|
+
"stop-color": `var(--lume-color--${h.source})`
|
|
2635
|
+
}, null, 8, kl),
|
|
2636
|
+
P("stop", {
|
|
2637
|
+
offset: "100%",
|
|
2638
|
+
"stop-color": `var(--lume-color--${h.target})`
|
|
2639
|
+
}, null, 8, bl)
|
|
2640
|
+
], 8, _l))), 128))
|
|
2641
|
+
])) : K("", !0),
|
|
2642
|
+
(b(!0), O(oe, null, J(u.value, (h) => (b(), O("path", {
|
|
2643
|
+
key: `link-ghost_${h.id}`,
|
|
2644
|
+
class: ue(["lume-alluvial-group__link", [
|
|
2645
|
+
"lume-stroke--transparent",
|
|
2646
|
+
"lume-alluvial-group__link--ghost"
|
|
2647
|
+
]]),
|
|
2648
|
+
d: h.d,
|
|
2649
|
+
"stroke-width": h.strokeWidth + v(La),
|
|
2650
|
+
"data-j-alluvial-ghost": "",
|
|
2651
|
+
onClick: (V) => o("link-click", { link: h.link, event: V }),
|
|
2652
|
+
onMouseover: (V) => ne(h.link, V)
|
|
2653
|
+
}, null, 40, Al))), 128)),
|
|
2654
|
+
(b(!0), O(oe, null, J(u.value, (h) => (b(), O("path", {
|
|
2655
|
+
key: `link_${h.id}`,
|
|
2656
|
+
class: ue(["lume-alluvial-group__link", {
|
|
2657
|
+
[`lume-stroke--${h.color}`]: !v(a).gradient && h.color,
|
|
2658
|
+
"lume-alluvial-group__link--faded": Le(h.id),
|
|
2659
|
+
"lume-alluvial-group__link--focused": Re(h.id)
|
|
2660
|
+
}]),
|
|
2661
|
+
d: h.d,
|
|
2662
|
+
stroke: Y(h.link),
|
|
2663
|
+
"stroke-dasharray": I.containerSize.width,
|
|
2664
|
+
"stroke-dashoffset": I.containerSize.width,
|
|
2665
|
+
"stroke-width": h.strokeWidth,
|
|
2666
|
+
"data-j-alluvial-path": "",
|
|
2667
|
+
"data-id": h.id,
|
|
2668
|
+
onClick: (V) => o("link-click", { link: h.link, event: V }),
|
|
2669
|
+
onMouseover: (V) => ne(h.link, V)
|
|
2670
|
+
}, null, 42, Ll))), 128))
|
|
2671
|
+
], 32),
|
|
2672
|
+
(b(!0), O(oe, null, J(r.value, (h, V) => (b(), O("g", {
|
|
2673
|
+
key: `node-block_${V}`,
|
|
2674
|
+
class: ue(["lume-alluvial-group__node", {
|
|
2675
|
+
"lume-alluvial-group__node--expandable": v(x)(
|
|
2676
|
+
h.node.id
|
|
2677
|
+
),
|
|
2678
|
+
"lume-alluvial-group__node--expandable-block": v(x)(h.node.id) && N.value,
|
|
2679
|
+
"lume-alluvial-group__node--faded": le(h.node.id),
|
|
2680
|
+
"lume-alluvial-group__node--focused": re(h.node.id)
|
|
2681
|
+
}]),
|
|
2682
|
+
"data-j-alluvial-group__node-block": ""
|
|
2683
|
+
}, [
|
|
2684
|
+
P("g", {
|
|
2685
|
+
tabindex: v(x)(h.node.id) ? "0" : null,
|
|
2686
|
+
onClick: (z) => D(h.node, z),
|
|
2687
|
+
onKeydown: [
|
|
2688
|
+
Ot(Nt((z) => R(h.node, z), ["prevent"]), ["enter"]),
|
|
2689
|
+
Ot(Nt((z) => R(h.node, z), ["prevent"]), ["space"])
|
|
2690
|
+
],
|
|
2691
|
+
onMouseenter: (z) => o("node-mouseenter", { node: h.node, event: z }),
|
|
2692
|
+
onMouseleave: (z) => o("node-mouseleave", { node: h.node, event: z }),
|
|
2693
|
+
onMouseover: (z) => d.value = h.node,
|
|
2694
|
+
onMouseout: j[0] || (j[0] = (z) => d.value = null),
|
|
2695
|
+
onFocus: (z) => c.value = h.node,
|
|
2696
|
+
onBlur: j[1] || (j[1] = (z) => c.value = null)
|
|
2697
|
+
}, [
|
|
2698
|
+
He(h) ? (b(!0), O(oe, { key: 0 }, J(Me(
|
|
2699
|
+
h.node.id
|
|
2700
|
+
), (z) => (b(), O("rect", W(z, {
|
|
2701
|
+
key: z.key,
|
|
2702
|
+
"data-j-alluvial-sub-nodes": "",
|
|
2703
|
+
onClick: (ve) => H(h.node)
|
|
2704
|
+
}), null, 16, $l))), 128)) : (b(), O("rect", {
|
|
2705
|
+
key: 1,
|
|
2706
|
+
class: ue(["lume-alluvial-group__node-block", `lume-fill--${h.node.color || h.node.fallbackColor}`]),
|
|
2707
|
+
x: h.x,
|
|
2708
|
+
y: h.y,
|
|
2709
|
+
height: h.height,
|
|
2710
|
+
width: h.width,
|
|
2711
|
+
onClick: (z) => H(h.node)
|
|
2712
|
+
}, null, 10, wl)),
|
|
2713
|
+
v(x)(h.node.id) ? (b(), O("rect", {
|
|
2714
|
+
key: 2,
|
|
2715
|
+
class: ue(["lume-alluvial-group__node-outline", `lume-stroke--${h.node.color || h.node.fallbackColor}`]),
|
|
2716
|
+
x: h.x - v(Xe),
|
|
2717
|
+
y: h.y - v(Xe),
|
|
2718
|
+
height: h.height + v(Xe) * 2,
|
|
2719
|
+
width: h.width + v(Xe) * 2,
|
|
2720
|
+
rx: v($a),
|
|
2721
|
+
"data-j-alluvial-node-outline": "",
|
|
2722
|
+
onClick: (z) => H(h.node)
|
|
2723
|
+
}, null, 10, Il)) : K("", !0),
|
|
2724
|
+
P("g", {
|
|
2725
|
+
ref_for: !0,
|
|
2726
|
+
ref_key: "nodeTextRefs",
|
|
2727
|
+
ref: s,
|
|
2728
|
+
class: ue(["lume-alluvial-group__node-text lume-typography--caption", {
|
|
2729
|
+
"lume-alluvial-group__node-text--left": Ne(
|
|
2730
|
+
h.node
|
|
2731
|
+
)
|
|
2732
|
+
}]),
|
|
2733
|
+
transform: `translate(${h.textTransform.x},${h.textTransform.y})`,
|
|
2734
|
+
"data-id": h.node.id,
|
|
2735
|
+
width: v(a).nodeLabelMaxWidth
|
|
2736
|
+
}, [
|
|
2737
|
+
F(I.$slots, `node-text-${h.node.id}`, {
|
|
2738
|
+
node: h.node,
|
|
2739
|
+
value: T.value(
|
|
2740
|
+
h.node.transitionValue || h.node.value,
|
|
2741
|
+
h.node.value
|
|
2742
|
+
)
|
|
2743
|
+
}, () => [
|
|
2744
|
+
ge(v(Na), {
|
|
2745
|
+
bottom: v(a).switchText,
|
|
2746
|
+
left: Ne(h.node),
|
|
2747
|
+
"max-width": v(a).nodeLabelMaxWidth,
|
|
2748
|
+
"onLume__internal-NodeResize": Se
|
|
2749
|
+
}, {
|
|
2750
|
+
default: Z(() => [
|
|
2751
|
+
_e(ce(h.node.label), 1)
|
|
2752
|
+
]),
|
|
2753
|
+
_: 2
|
|
2754
|
+
}, 1032, ["bottom", "left", "max-width"]),
|
|
2755
|
+
ge(v(Ba), {
|
|
2756
|
+
bottom: !v(a).switchText
|
|
2757
|
+
}, {
|
|
2758
|
+
default: Z(() => [
|
|
2759
|
+
_e(ce(T.value(
|
|
2760
|
+
h.node.transitionValue || h.node.value,
|
|
2761
|
+
h.node.value
|
|
2762
|
+
)), 1)
|
|
2763
|
+
]),
|
|
2764
|
+
_: 2
|
|
2765
|
+
}, 1032, ["bottom"])
|
|
2766
|
+
], !0)
|
|
2767
|
+
], 10, xl)
|
|
2768
|
+
], 40, Tl)
|
|
2769
|
+
], 2))), 128))
|
|
2770
|
+
]));
|
|
2771
|
+
}
|
|
2772
|
+
}), Nl = /* @__PURE__ */ ae(Ol, [["__scopeId", "data-v-0f56c6f5"]]), El = {
|
|
2773
|
+
margins: {
|
|
2774
|
+
top: 0,
|
|
2775
|
+
right: 0,
|
|
2776
|
+
bottom: 0,
|
|
2777
|
+
left: 0
|
|
2778
|
+
},
|
|
2779
|
+
withAxes: !1,
|
|
2780
|
+
withTooltip: !1,
|
|
2781
|
+
withHover: !1,
|
|
2782
|
+
withLegend: !1,
|
|
2783
|
+
// Alluvial options
|
|
2784
|
+
alignFirstNodeLabels: "left",
|
|
2785
|
+
alignLastNodeLabels: "right",
|
|
2786
|
+
gradient: !1,
|
|
2787
|
+
highlightedElements: "closest",
|
|
2788
|
+
nodePadding: 16,
|
|
2789
|
+
nodeWidth: 16,
|
|
2790
|
+
nodeAlign: wn,
|
|
2791
|
+
nodeExpansionTrigger: "node",
|
|
2792
|
+
valueFormat: (e) => String(e),
|
|
2793
|
+
iterations: 6
|
|
2794
|
+
}, bu = /* @__PURE__ */ Q({
|
|
2795
|
+
__name: "lume-alluvial-diagram",
|
|
2796
|
+
props: {
|
|
2797
|
+
...wo(pt)
|
|
2798
|
+
},
|
|
2799
|
+
setup(e, { emit: n }) {
|
|
2800
|
+
const t = e, { componentEventPropagator: o } = Oe(), l = Be(me()), i = Wn(me()), { options: a } = ie(t), { allOptions: r } = Ae(a, El);
|
|
2801
|
+
function u(s) {
|
|
2802
|
+
return {
|
|
2803
|
+
...s,
|
|
2804
|
+
noBaseScales: !0
|
|
2805
|
+
// Alluvial chart never uses base scales
|
|
2806
|
+
};
|
|
2807
|
+
}
|
|
2808
|
+
return (s, d) => (b(), ee(v(Ce), W({ ...t, ...s.$attrs }, {
|
|
2809
|
+
options: u(v(r)),
|
|
2810
|
+
"data-j-alluvial-diagram": ""
|
|
2811
|
+
}, de(v(o))), ke({
|
|
2812
|
+
groups: Z((c) => [
|
|
2813
|
+
ge(v(Nl), W(c, { "hovered-element-id": s.hoveredElement }, de(v(o))), ke({ _: 2 }, [
|
|
2814
|
+
J(v(i), (p, y) => ({
|
|
2815
|
+
name: y,
|
|
2816
|
+
fn: Z((A) => [
|
|
2817
|
+
F(s.$slots, y, $e(we(A || {})))
|
|
2818
|
+
])
|
|
2819
|
+
}))
|
|
2820
|
+
]), 1040, ["hovered-element-id"])
|
|
2821
|
+
]),
|
|
2822
|
+
_: 2
|
|
2823
|
+
}, [
|
|
2824
|
+
J(v(l), (c, p) => ({
|
|
2825
|
+
name: p,
|
|
2826
|
+
fn: Z((y) => [
|
|
2827
|
+
F(s.$slots, p, $e(we(y || {})))
|
|
2828
|
+
])
|
|
2829
|
+
}))
|
|
2830
|
+
]), 1040, ["options"]));
|
|
2831
|
+
}
|
|
2832
|
+
});
|
|
2833
|
+
var hn = /* @__PURE__ */ ((e) => (e.grouped = "grouped", e.stacked = "stacked", e))(hn || {});
|
|
2834
|
+
const Au = /* @__PURE__ */ Q({
|
|
2835
|
+
__name: "lume-bar-chart",
|
|
2836
|
+
props: {
|
|
2837
|
+
...Ge(),
|
|
2838
|
+
type: {
|
|
2839
|
+
type: String,
|
|
2840
|
+
default: null,
|
|
2841
|
+
validator: (e) => e in hn || e == null
|
|
2842
|
+
}
|
|
2843
|
+
},
|
|
2844
|
+
setup(e, { emit: n }) {
|
|
2845
|
+
const t = at(
|
|
2846
|
+
() => import("./KjsS1ILQ.js")
|
|
2847
|
+
), o = at(
|
|
2848
|
+
() => import("./DYSrBfkM.js")
|
|
2849
|
+
), l = at(
|
|
2850
|
+
() => import("./BONsehMI.js")
|
|
2851
|
+
), i = /* @__PURE__ */ new Map([
|
|
2852
|
+
["single", t],
|
|
2853
|
+
["grouped", o],
|
|
2854
|
+
["stacked", l]
|
|
2855
|
+
]), a = e, { componentEventPropagator: r } = Oe(), u = Be(me());
|
|
2856
|
+
function s(c) {
|
|
2857
|
+
return {
|
|
2858
|
+
...c,
|
|
2859
|
+
startOnZero: !0,
|
|
2860
|
+
// Bar chart always starts on zero,
|
|
2861
|
+
tooltipOptions: {
|
|
2862
|
+
...(c == null ? void 0 : c.tooltipOptions) || {},
|
|
2863
|
+
position: a.orientation === S.HORIZONTAL ? "right" : void 0
|
|
2864
|
+
}
|
|
2865
|
+
};
|
|
2866
|
+
}
|
|
2867
|
+
const d = f(() => {
|
|
2868
|
+
if (pt(a.data)) return i.get("single");
|
|
2869
|
+
if (!a.type)
|
|
2870
|
+
throw new Error("Bar chart needs a type when there's multiple datasets.");
|
|
2871
|
+
return i.get(a.type);
|
|
2872
|
+
});
|
|
2873
|
+
return (c, p) => (b(), ee(Ln(d.value), W({ ...a, ...c.$attrs }, {
|
|
2874
|
+
options: s(c.options)
|
|
2875
|
+
}, de(v(r))), ke({ _: 2 }, [
|
|
2876
|
+
J(v(u), (y, A) => ({
|
|
2877
|
+
name: A,
|
|
2878
|
+
fn: Z((k) => [
|
|
2879
|
+
F(c.$slots, A, $e(we(k || {})))
|
|
2880
|
+
])
|
|
2881
|
+
}))
|
|
2882
|
+
]), 1040, ["options"]));
|
|
2883
|
+
}
|
|
2884
|
+
});
|
|
2885
|
+
function Dl(e) {
|
|
2886
|
+
return Object.values(Yn).includes(e) || e == null;
|
|
2887
|
+
}
|
|
2888
|
+
function Bl(e) {
|
|
2889
|
+
return Object.values(S).includes(e);
|
|
2890
|
+
}
|
|
2891
|
+
const Rl = (e = !1) => ({
|
|
2892
|
+
type: {
|
|
2893
|
+
type: String,
|
|
2894
|
+
default: null,
|
|
2895
|
+
validator: Dl
|
|
2896
|
+
},
|
|
2897
|
+
...e ? {
|
|
2898
|
+
orientation: {
|
|
2899
|
+
type: String,
|
|
2900
|
+
default: S.VERTICAL,
|
|
2901
|
+
validator: Bl
|
|
2902
|
+
}
|
|
2903
|
+
} : {}
|
|
2904
|
+
});
|
|
2905
|
+
function yn(e, n) {
|
|
2906
|
+
const t = f(() => e.value.map((l) => {
|
|
2907
|
+
var i;
|
|
2908
|
+
return {
|
|
2909
|
+
...l,
|
|
2910
|
+
values: ht(
|
|
2911
|
+
l.values,
|
|
2912
|
+
((i = n == null ? void 0 : n.value) == null ? void 0 : i.length) ?? 0
|
|
2913
|
+
).map((a) => ({
|
|
2914
|
+
...a,
|
|
2915
|
+
value: (a == null ? void 0 : a.value) || 0
|
|
2916
|
+
}))
|
|
2917
|
+
};
|
|
2918
|
+
})), o = f(() => {
|
|
2919
|
+
var l;
|
|
2920
|
+
return (l = t.value) == null ? void 0 : l.reduce((i, a) => (a.values.forEach((r, u) => {
|
|
2921
|
+
i[u] ? i[u].push(r) : i[u] = [r];
|
|
2922
|
+
}), i), []);
|
|
2923
|
+
});
|
|
2924
|
+
return { multiBarData: t, groupedData: o };
|
|
2925
|
+
}
|
|
2926
|
+
function Hl(e, n) {
|
|
2927
|
+
return e.value.length === 1 ? "single" : n.value;
|
|
2928
|
+
}
|
|
2929
|
+
function Ml(e, n, t) {
|
|
2930
|
+
const o = f(
|
|
2931
|
+
() => t.value === S.HORIZONTAL
|
|
2932
|
+
);
|
|
2933
|
+
function l(r) {
|
|
2934
|
+
r || ft(Je.BarScaleNull), Math.min(...r.domain()) > 0 && ft(Je.BarScaleDomainAbove0);
|
|
2935
|
+
}
|
|
2936
|
+
const i = f(() => o.value ? (l(e.value), e.value) : e.value), a = f(() => o.value ? n.value : (l(n.value), n.value));
|
|
2937
|
+
return { barXScale: i, barYScale: a };
|
|
2938
|
+
}
|
|
2939
|
+
const Sl = {
|
|
2940
|
+
x: 0,
|
|
2941
|
+
y: 0,
|
|
2942
|
+
width: 0,
|
|
2943
|
+
height: 0
|
|
2944
|
+
};
|
|
2945
|
+
function Gl(e, n, t, o, l, i) {
|
|
2946
|
+
const a = f(
|
|
2947
|
+
() => o.value === S.HORIZONTAL
|
|
2948
|
+
);
|
|
2949
|
+
function r(c, p) {
|
|
2950
|
+
let y, A;
|
|
2951
|
+
return a.value ? (y = c >= 0 ? n.value(0) : n.value(c), A = t.value(t.value.domain()[p])) : (y = n.value(n.value.domain()[p]), A = c < 0 ? t.value(0) : t.value(c)), { x: y, y: A };
|
|
2952
|
+
}
|
|
2953
|
+
function u(c) {
|
|
2954
|
+
return a.value ? c < 0 ? n.value(0) - n.value(c) : n.value(c) - n.value(0) : n.value.bandwidth();
|
|
2955
|
+
}
|
|
2956
|
+
function s(c) {
|
|
2957
|
+
return a.value ? t.value.bandwidth() : c < 0 ? t.value(c) - t.value(0) : t.value(0) - t.value(c);
|
|
2958
|
+
}
|
|
2959
|
+
function d(c, p, y) {
|
|
2960
|
+
if (!(n.value && t.value)) return Sl;
|
|
2961
|
+
const { value: k, color: x } = c, g = x ?? e.value[p].color ?? We, { x: _, y: m } = r(k, y), T = u(k), N = s(k);
|
|
2962
|
+
return {
|
|
2963
|
+
classList: [`lume-fill--${g}`, ...i],
|
|
2964
|
+
x: _,
|
|
2965
|
+
y: m,
|
|
2966
|
+
width: T,
|
|
2967
|
+
height: N,
|
|
2968
|
+
isFaded: l.value !== -1 && l.value !== y,
|
|
2969
|
+
isNegative: k < 0
|
|
2970
|
+
};
|
|
2971
|
+
}
|
|
2972
|
+
return { barAttributeGenerator: d };
|
|
2973
|
+
}
|
|
2974
|
+
const Cl = {
|
|
2975
|
+
x: 0,
|
|
2976
|
+
y: 0,
|
|
2977
|
+
width: 0,
|
|
2978
|
+
height: 0
|
|
2979
|
+
};
|
|
2980
|
+
function Fl(e, n, t, o, l, i) {
|
|
2981
|
+
const a = f(
|
|
2982
|
+
() => o.value === S.HORIZONTAL
|
|
2983
|
+
), r = f(() => Pe().domain(e.value.map((A, k) => k)).range([0, n.value.bandwidth()]).padding(0)), u = f(() => Pe().domain(e.value.map((A, k) => k)).range([0, t.value.bandwidth()]).padding(0));
|
|
2984
|
+
function s(A, k, x) {
|
|
2985
|
+
if (a.value)
|
|
2986
|
+
return A >= 0 ? n.value(0) : n.value(A);
|
|
2987
|
+
const g = n.value.domain();
|
|
2988
|
+
return n.value(g[k]) + r.value(x);
|
|
2989
|
+
}
|
|
2990
|
+
function d(A, k, x) {
|
|
2991
|
+
if (a.value) {
|
|
2992
|
+
const g = t.value.domain();
|
|
2993
|
+
return t.value(g[k]) + u.value(x);
|
|
2994
|
+
}
|
|
2995
|
+
return A < 0 ? t.value(0) : t.value(A);
|
|
2996
|
+
}
|
|
2997
|
+
function c(A) {
|
|
2998
|
+
return a.value ? A < 0 ? n.value(0) - n.value(A) : n.value(A) - n.value(0) : r.value.bandwidth();
|
|
2999
|
+
}
|
|
3000
|
+
function p(A) {
|
|
3001
|
+
return a.value ? u.value.bandwidth() : A < 0 ? t.value(A) - t.value(0) : t.value(0) - t.value(A);
|
|
3002
|
+
}
|
|
3003
|
+
function y(A, k, x) {
|
|
3004
|
+
if (!(n.value && t.value)) return Cl;
|
|
3005
|
+
const { value: _, color: m } = A, T = m ?? e.value[k].color ?? Object.values(he)[k], N = s(_, x, k), E = d(_, x, k), M = c(_), G = p(_);
|
|
3006
|
+
return {
|
|
3007
|
+
classList: [`lume-fill--${T}`, ...i],
|
|
3008
|
+
x: N,
|
|
3009
|
+
y: E,
|
|
3010
|
+
width: M,
|
|
3011
|
+
height: G,
|
|
3012
|
+
isFaded: l.value !== -1 && l.value !== x,
|
|
3013
|
+
isNegative: _ < 0
|
|
3014
|
+
};
|
|
3015
|
+
}
|
|
3016
|
+
return { barAttributeGenerator: y };
|
|
3017
|
+
}
|
|
3018
|
+
function jl(e, n, t) {
|
|
3019
|
+
const o = f(
|
|
3020
|
+
() => n.value === S.HORIZONTAL
|
|
3021
|
+
), l = f(() => {
|
|
3022
|
+
const u = e.value.map(
|
|
3023
|
+
(s) => s.filter((d) => d.value < 0).reduce((d, c) => d + c.value, 0)
|
|
3024
|
+
);
|
|
3025
|
+
return Math.min(...u);
|
|
3026
|
+
}), i = f(() => {
|
|
3027
|
+
const u = e.value.map(
|
|
3028
|
+
(s) => s.reduce(
|
|
3029
|
+
(d, c) => c.value >= 0 ? d + c.value : d,
|
|
3030
|
+
0
|
|
3031
|
+
)
|
|
3032
|
+
);
|
|
3033
|
+
return Math.max(...u);
|
|
3034
|
+
});
|
|
3035
|
+
function a(u, s, d) {
|
|
3036
|
+
return s.length ? o.value ? je().domain([l.value, i.value]).range([0, d.width]) : Object.assign(
|
|
3037
|
+
Ct(
|
|
3038
|
+
Pe().domain(s.map((c, p) => p)).range([0, d.width]),
|
|
3039
|
+
n.value,
|
|
3040
|
+
t.value
|
|
3041
|
+
),
|
|
3042
|
+
{ labels: s }
|
|
3043
|
+
) : null;
|
|
3044
|
+
}
|
|
3045
|
+
function r(u, s, d) {
|
|
3046
|
+
return s.length ? o.value ? Object.assign(
|
|
3047
|
+
Ct(
|
|
3048
|
+
Pe().domain(s.map((c, p) => p)).range([0, d.height]),
|
|
3049
|
+
n.value,
|
|
3050
|
+
t.value
|
|
3051
|
+
),
|
|
3052
|
+
{ labels: s }
|
|
3053
|
+
) : je().domain([i.value, l.value]).range([0, d.height]) : null;
|
|
3054
|
+
}
|
|
3055
|
+
return { stackedXScaleGenerator: a, stackedYScaleGenerator: r };
|
|
3056
|
+
}
|
|
3057
|
+
function Pl(e, n, t, o, l, i) {
|
|
3058
|
+
const a = f(
|
|
3059
|
+
() => o.value === S.HORIZONTAL
|
|
3060
|
+
), r = f(
|
|
3061
|
+
() => a.value ? t.value.domain() : n.value.domain()
|
|
3062
|
+
), u = f(
|
|
3063
|
+
() => e.value.map((g) => g.values.map((_) => _ == null ? void 0 : _.value))
|
|
3064
|
+
);
|
|
3065
|
+
function s(g, _, m) {
|
|
3066
|
+
let T, N;
|
|
3067
|
+
return a.value ? (T = n.value(g >= 0 ? 0 + m : g + m), N = t.value(r.value[_])) : (T = n.value(r.value[_]), N = t.value(g >= 0 ? g + m : 0 + m)), { x: T, y: N };
|
|
3068
|
+
}
|
|
3069
|
+
function d(g) {
|
|
3070
|
+
return a.value ? n.value(g) - n.value(0) : n.value.bandwidth();
|
|
3071
|
+
}
|
|
3072
|
+
function c(g) {
|
|
3073
|
+
return a.value ? n.value(0) - n.value(g) : n.value.bandwidth();
|
|
3074
|
+
}
|
|
3075
|
+
function p(g) {
|
|
3076
|
+
return a.value ? t.value.bandwidth() : t.value(0) - t.value(g);
|
|
3077
|
+
}
|
|
3078
|
+
function y(g) {
|
|
3079
|
+
return a.value ? t.value.bandwidth() : t.value(g) - t.value(0);
|
|
3080
|
+
}
|
|
3081
|
+
function A(g, _) {
|
|
3082
|
+
return g ? u.value.reduce((m, T, N) => (N < g && T[_] >= 0 && (m += T[_]), m), 0) : 0;
|
|
3083
|
+
}
|
|
3084
|
+
function k(g, _) {
|
|
3085
|
+
return g ? u.value.reduce((m, T, N) => (N < g && T[_] < 0 && (m += T[_]), m), 0) : 0;
|
|
3086
|
+
}
|
|
3087
|
+
function x(g, _, m) {
|
|
3088
|
+
const { value: T, color: N } = g, E = T >= 0 ? d(T) : c(T), M = T >= 0 ? p(T) : y(T), G = T >= 0 ? A(_, m) : k(_, m), { x: te, y: B } = s(T, m, G);
|
|
3089
|
+
return {
|
|
3090
|
+
classList: [`lume-fill--${N ?? e.value[_].color ?? Object.values(he)[_]}`, ...i],
|
|
3091
|
+
width: E,
|
|
3092
|
+
height: M,
|
|
3093
|
+
x: te,
|
|
3094
|
+
y: B,
|
|
3095
|
+
isFaded: l.value !== -1 && l.value !== m,
|
|
3096
|
+
isNegative: T < 0
|
|
3097
|
+
};
|
|
3098
|
+
}
|
|
3099
|
+
return { barAttributeGenerator: x };
|
|
3100
|
+
}
|
|
3101
|
+
const Vl = {
|
|
3102
|
+
class: "lume-bar-group",
|
|
3103
|
+
"data-j-bars-group": ""
|
|
3104
|
+
}, zl = ["onMouseenter"], Wl = {
|
|
3105
|
+
single: Gl,
|
|
3106
|
+
grouped: Fl,
|
|
3107
|
+
stacked: Pl
|
|
3108
|
+
}, It = /* @__PURE__ */ Q({
|
|
3109
|
+
__name: "lume-bar-group",
|
|
3110
|
+
props: {
|
|
3111
|
+
...tt(),
|
|
3112
|
+
classList: {
|
|
3113
|
+
type: [String, Array],
|
|
3114
|
+
default: () => []
|
|
3115
|
+
},
|
|
3116
|
+
...Rl(!0),
|
|
3117
|
+
transition: {
|
|
3118
|
+
type: Boolean,
|
|
3119
|
+
default: !0
|
|
3120
|
+
}
|
|
3121
|
+
},
|
|
3122
|
+
emits: ["bar-click", "lume__internal--hover"],
|
|
3123
|
+
setup(e, { emit: n }) {
|
|
3124
|
+
const t = e, o = n, {
|
|
3125
|
+
data: l,
|
|
3126
|
+
hoveredIndex: i,
|
|
3127
|
+
orientation: a,
|
|
3128
|
+
transition: r,
|
|
3129
|
+
type: u,
|
|
3130
|
+
xScale: s,
|
|
3131
|
+
yScale: d,
|
|
3132
|
+
classList: c,
|
|
3133
|
+
labels: p
|
|
3134
|
+
} = ie(t);
|
|
3135
|
+
Qe("chartID");
|
|
3136
|
+
const { emitInternalEvent: y } = Oe(), { groupedData: A } = yn(l, p), { barXScale: k, barYScale: x } = Ml(s, d, a), g = f(() => typeof c.value == "string" ? [c.value] : c.value), _ = f(() => {
|
|
3137
|
+
const N = Hl(l, u), { barAttributeGenerator: E } = Wl[N](
|
|
3138
|
+
l,
|
|
3139
|
+
k,
|
|
3140
|
+
x,
|
|
3141
|
+
a,
|
|
3142
|
+
i,
|
|
3143
|
+
g.value
|
|
3144
|
+
);
|
|
3145
|
+
return E;
|
|
3146
|
+
}), m = f(() => {
|
|
3147
|
+
if (r.value)
|
|
3148
|
+
return a.value === S.HORIZONTAL ? "width" : "height";
|
|
3149
|
+
});
|
|
3150
|
+
async function T(N) {
|
|
3151
|
+
o("lume__internal--hover", N), y("lume__internal--hover", N);
|
|
3152
|
+
}
|
|
3153
|
+
return (N, E) => (b(), O("g", Vl, [
|
|
3154
|
+
(b(!0), O(oe, null, J(v(A), (M, G) => (b(), O("g", {
|
|
3155
|
+
key: G,
|
|
3156
|
+
onMouseenter: (te) => T(G)
|
|
3157
|
+
}, [
|
|
3158
|
+
(b(!0), O(oe, null, J(M, (te, B) => (b(), ee(v(yt), W(_.value(te, B, G, M), {
|
|
3159
|
+
key: `bar-${B}`,
|
|
3160
|
+
transition: m.value,
|
|
3161
|
+
"data-j-lume-bar": "",
|
|
3162
|
+
onClick: (q) => o("bar-click", {
|
|
3163
|
+
index: G,
|
|
3164
|
+
datasetIndex: B,
|
|
3165
|
+
event: q
|
|
3166
|
+
})
|
|
3167
|
+
}), null, 16, ["transition", "onClick"]))), 128))
|
|
3168
|
+
], 40, zl))), 128))
|
|
3169
|
+
]));
|
|
3170
|
+
}
|
|
3171
|
+
}), Ul = {
|
|
3172
|
+
[S.VERTICAL]: {
|
|
3173
|
+
withTooltip: !0,
|
|
3174
|
+
xAxisOptions: {},
|
|
3175
|
+
yAxisOptions: { gridLines: !0 },
|
|
3176
|
+
margins: De.VERTICAL
|
|
3177
|
+
},
|
|
3178
|
+
[S.HORIZONTAL]: {
|
|
3179
|
+
withTooltip: !0,
|
|
3180
|
+
xAxisOptions: { gridLines: !0 },
|
|
3181
|
+
yAxisOptions: { gridLines: !1 },
|
|
3182
|
+
margins: De.HORIZONTAL
|
|
3183
|
+
}
|
|
3184
|
+
}, Lu = /* @__PURE__ */ Q({
|
|
3185
|
+
__name: "lume-single-bar-chart",
|
|
3186
|
+
props: {
|
|
3187
|
+
...Ge(pt)
|
|
3188
|
+
},
|
|
3189
|
+
setup(e, { emit: n }) {
|
|
3190
|
+
const t = e, { componentEventPropagator: o } = Oe(), l = Be(me()), { orientation: i, options: a } = ie(t), r = f(
|
|
3191
|
+
() => Ul[i.value || S.VERTICAL]
|
|
3192
|
+
// needs to be computed so that default options are reactive
|
|
3193
|
+
), { allOptions: u } = Ae(a, r);
|
|
3194
|
+
return (s, d) => (b(), ee(v(Ce), W({ ...t, ...s.$attrs }, {
|
|
3195
|
+
"chart-type": "single-bar",
|
|
3196
|
+
options: v(u),
|
|
3197
|
+
"data-j-single-bar-chart": ""
|
|
3198
|
+
}, de(v(o))), ke({
|
|
3199
|
+
groups: Z((c) => [
|
|
3200
|
+
ge(v(It), W(c, { orientation: v(i) }, de(v(o))), null, 16, ["orientation"])
|
|
3201
|
+
]),
|
|
3202
|
+
_: 2
|
|
3203
|
+
}, [
|
|
3204
|
+
J(v(l), (c, p) => ({
|
|
3205
|
+
name: p,
|
|
3206
|
+
fn: Z((y) => [
|
|
3207
|
+
F(s.$slots, p, $e(we(y || {})))
|
|
3208
|
+
])
|
|
3209
|
+
}))
|
|
3210
|
+
]), 1040, ["options"]));
|
|
3211
|
+
}
|
|
3212
|
+
}), Zl = {
|
|
3213
|
+
[S.VERTICAL]: {
|
|
3214
|
+
withTooltip: !0,
|
|
3215
|
+
xAxisOptions: {},
|
|
3216
|
+
yAxisOptions: { gridLines: !0 },
|
|
3217
|
+
margins: De.VERTICAL
|
|
3218
|
+
},
|
|
3219
|
+
[S.HORIZONTAL]: {
|
|
3220
|
+
withTooltip: !0,
|
|
3221
|
+
xAxisOptions: { gridLines: !0 },
|
|
3222
|
+
yAxisOptions: { gridLines: !1 },
|
|
3223
|
+
margins: De.HORIZONTAL,
|
|
3224
|
+
tooltipOptions: { position: "right" }
|
|
3225
|
+
}
|
|
3226
|
+
}, Tu = /* @__PURE__ */ Q({
|
|
3227
|
+
__name: "lume-grouped-bar-chart",
|
|
3228
|
+
props: {
|
|
3229
|
+
...Ge()
|
|
3230
|
+
},
|
|
3231
|
+
setup(e, { emit: n }) {
|
|
3232
|
+
const t = e, { componentEventPropagator: o } = Oe(), l = Be(me()), { orientation: i, options: a } = ie(t), r = f(
|
|
3233
|
+
() => Zl[i.value || S.VERTICAL]
|
|
3234
|
+
// needs to be computed so that default options are reactive
|
|
3235
|
+
), { allOptions: u } = Ae(
|
|
3236
|
+
a,
|
|
3237
|
+
r
|
|
3238
|
+
);
|
|
3239
|
+
return (s, d) => (b(), ee(v(Ce), W({ ...t, ...s.$attrs }, {
|
|
3240
|
+
"chart-type": "grouped-bar",
|
|
3241
|
+
options: v(u),
|
|
3242
|
+
"data-j-grouped-bar-chart": ""
|
|
3243
|
+
}, de(v(o))), ke({
|
|
3244
|
+
groups: Z((c) => [
|
|
3245
|
+
ge(v(It), W(c, { type: "grouped" }, de(v(o))), null, 16)
|
|
3246
|
+
]),
|
|
3247
|
+
_: 2
|
|
3248
|
+
}, [
|
|
3249
|
+
J(v(l), (c, p) => ({
|
|
3250
|
+
name: p,
|
|
3251
|
+
fn: Z((y) => [
|
|
3252
|
+
F(s.$slots, p, $e(we(y || {})))
|
|
3253
|
+
])
|
|
3254
|
+
}))
|
|
3255
|
+
]), 1040, ["options"]));
|
|
3256
|
+
}
|
|
3257
|
+
}), Xl = {
|
|
3258
|
+
[S.VERTICAL]: {
|
|
3259
|
+
withTooltip: !0,
|
|
3260
|
+
xAxisOptions: {},
|
|
3261
|
+
yAxisOptions: { gridLines: !0 },
|
|
3262
|
+
margins: De.VERTICAL,
|
|
3263
|
+
tooltipOptions: { inverse: !0 }
|
|
3264
|
+
},
|
|
3265
|
+
[S.HORIZONTAL]: {
|
|
3266
|
+
withTooltip: !0,
|
|
3267
|
+
xAxisOptions: { gridLines: !0 },
|
|
3268
|
+
yAxisOptions: { gridLines: !1 },
|
|
3269
|
+
margins: De.HORIZONTAL,
|
|
3270
|
+
tooltipOptions: { position: "right" }
|
|
3271
|
+
}
|
|
3272
|
+
}, $u = /* @__PURE__ */ Q({
|
|
3273
|
+
__name: "lume-stacked-bar-chart",
|
|
3274
|
+
props: {
|
|
3275
|
+
...Ge()
|
|
3276
|
+
},
|
|
3277
|
+
setup(e, { emit: n }) {
|
|
3278
|
+
const t = e, { componentEventPropagator: o } = Oe(), l = Be(me()), { data: i, orientation: a, options: r, labels: u } = ie(t), s = f(
|
|
3279
|
+
() => Xl[a.value || S.VERTICAL]
|
|
3280
|
+
// needs to be computed so that default options are reactive
|
|
3281
|
+
), { allOptions: d } = Ae(
|
|
3282
|
+
r,
|
|
3283
|
+
s
|
|
3284
|
+
), { internalData: c } = Lt(i), { groupedData: p } = yn(c, u), { stackedXScaleGenerator: y, stackedYScaleGenerator: A } = jl(
|
|
3285
|
+
p,
|
|
3286
|
+
a,
|
|
3287
|
+
r
|
|
3288
|
+
), k = f(() => t.xScale || y), x = f(() => t.yScale || A);
|
|
3289
|
+
return (g, _) => (b(), ee(v(Ce), W({ ...t, ...g.$attrs }, {
|
|
3290
|
+
"chart-type": "stacked-bar",
|
|
3291
|
+
options: v(d),
|
|
3292
|
+
"x-scale": k.value,
|
|
3293
|
+
"y-scale": x.value,
|
|
3294
|
+
"data-j-stacked-bar-chart": ""
|
|
3295
|
+
}, de(v(o))), ke({
|
|
3296
|
+
groups: Z((m) => [
|
|
3297
|
+
ge(v(It), W(m, { type: "stacked" }, de(v(o))), null, 16)
|
|
3298
|
+
]),
|
|
3299
|
+
_: 2
|
|
3300
|
+
}, [
|
|
3301
|
+
J(v(l), (m, T) => ({
|
|
3302
|
+
name: T,
|
|
3303
|
+
fn: Z((N) => [
|
|
3304
|
+
F(g.$slots, T, $e(we(N || {})))
|
|
3305
|
+
])
|
|
3306
|
+
}))
|
|
3307
|
+
]), 1040, ["options", "x-scale", "y-scale"]));
|
|
3308
|
+
}
|
|
3309
|
+
}), Yl = ["d", "stroke-width"], Kl = 2, Jl = /* @__PURE__ */ Q({
|
|
3310
|
+
__name: "lume-line",
|
|
3311
|
+
props: {
|
|
3312
|
+
pathDefinition: {
|
|
3313
|
+
type: String,
|
|
3314
|
+
required: !0
|
|
3315
|
+
},
|
|
3316
|
+
width: {
|
|
3317
|
+
type: Number,
|
|
3318
|
+
default: Kl
|
|
3319
|
+
},
|
|
3320
|
+
color: {
|
|
3321
|
+
type: String,
|
|
3322
|
+
default: he.Skyblue
|
|
3323
|
+
},
|
|
3324
|
+
dashed: {
|
|
3325
|
+
type: Boolean,
|
|
3326
|
+
default: !1
|
|
3327
|
+
},
|
|
3328
|
+
transition: {
|
|
3329
|
+
type: Boolean,
|
|
3330
|
+
default: !0
|
|
3331
|
+
},
|
|
3332
|
+
animationDelay: {
|
|
3333
|
+
type: Number,
|
|
3334
|
+
default: 0
|
|
3335
|
+
},
|
|
3336
|
+
animationDuration: {
|
|
3337
|
+
type: Number,
|
|
3338
|
+
default: 0.2
|
|
3339
|
+
}
|
|
3340
|
+
},
|
|
3341
|
+
emits: ["click"],
|
|
3342
|
+
setup(e, { emit: n }) {
|
|
3343
|
+
const t = n, o = C(null);
|
|
3344
|
+
return xe(() => et(o.value)), (l, i) => (b(), O("path", {
|
|
3345
|
+
ref_key: "root",
|
|
3346
|
+
ref: o,
|
|
3347
|
+
class: ue(["lume-line", {
|
|
3348
|
+
[`lume-stroke--${e.color}`]: !0,
|
|
3349
|
+
"lume-line--dashed": e.dashed,
|
|
3350
|
+
"lume-line--transition": e.transition
|
|
3351
|
+
}]),
|
|
3352
|
+
d: e.pathDefinition,
|
|
3353
|
+
"stroke-width": e.width,
|
|
3354
|
+
style: Yt({
|
|
3355
|
+
animationDelay: e.transition && e.animationDelay + "s",
|
|
3356
|
+
animationDuration: e.transition && e.animationDuration + "s"
|
|
3357
|
+
}),
|
|
3358
|
+
"data-j-line": "",
|
|
3359
|
+
onClick: i[0] || (i[0] = (a) => t("click", a))
|
|
3360
|
+
}, null, 14, Yl));
|
|
3361
|
+
}
|
|
3362
|
+
}), Ql = /* @__PURE__ */ ae(Jl, [["__scopeId", "data-v-59449838"]]), ql = ["cx", "cy", "r", "stroke-width"], eu = 4, tu = 3, nu = /* @__PURE__ */ Q({
|
|
3363
|
+
__name: "lume-point",
|
|
3364
|
+
props: {
|
|
3365
|
+
x: {},
|
|
3366
|
+
y: {},
|
|
3367
|
+
color: { default: he.Skyblue },
|
|
3368
|
+
radius: { default: eu },
|
|
3369
|
+
active: { type: Boolean, default: !1 },
|
|
3370
|
+
visible: { type: Boolean, default: !1 }
|
|
3371
|
+
},
|
|
3372
|
+
emits: ["click"],
|
|
3373
|
+
setup(e, { emit: n }) {
|
|
3374
|
+
const t = e, o = n, l = C(null), i = f(() => t.radius / 2), a = f(() => t.active ? t.radius : t.visible ? tu : 0);
|
|
3375
|
+
return xe(() => et(l.value)), (r, u) => (b(), O("circle", {
|
|
3376
|
+
ref_key: "root",
|
|
3377
|
+
ref: l,
|
|
3378
|
+
class: ue(["lume-point", {
|
|
3379
|
+
[`lume-stroke--${r.color}`]: !0,
|
|
3380
|
+
"lume-point--active": r.active,
|
|
3381
|
+
[`lume-point--visible lume-fill--${r.color}`]: r.visible
|
|
3382
|
+
}]),
|
|
3383
|
+
cx: r.x,
|
|
3384
|
+
cy: r.y,
|
|
3385
|
+
r: a.value,
|
|
3386
|
+
"stroke-width": i.value,
|
|
3387
|
+
"data-j-point": "",
|
|
3388
|
+
onClick: u[0] || (u[0] = (s) => o("click", s))
|
|
3389
|
+
}, null, 10, ql));
|
|
3390
|
+
}
|
|
3391
|
+
}), ou = /* @__PURE__ */ ae(nu, [["__scopeId", "data-v-080270c0"]]);
|
|
3392
|
+
function _n(e, n) {
|
|
3393
|
+
function t(a) {
|
|
3394
|
+
let r = null;
|
|
3395
|
+
return a == null ? void 0 : a.reduce((u, s, d) => (s == null || s.value == null ? (r ? r.push(d) : r = [d], d === (a == null ? void 0 : a.length) - 1 && u.push(r)) : r && (u.push(r), r = null), u), []);
|
|
3396
|
+
}
|
|
3397
|
+
function o(a, r, u, s) {
|
|
3398
|
+
const p = Math.abs(a - r) / (u + 1) * (s + 1);
|
|
3399
|
+
return a == null && r == null ? null : a > r ? a - p : a + p;
|
|
3400
|
+
}
|
|
3401
|
+
function l(a) {
|
|
3402
|
+
return function(u) {
|
|
3403
|
+
return !!a.find(
|
|
3404
|
+
(s) => s.includes(u) || s.includes(u - 1)
|
|
3405
|
+
);
|
|
3406
|
+
};
|
|
3407
|
+
}
|
|
3408
|
+
return { computedLineData: f(
|
|
3409
|
+
() => e.value.map((a) => {
|
|
3410
|
+
const r = t(a.values);
|
|
3411
|
+
return {
|
|
3412
|
+
...a,
|
|
3413
|
+
isDashed: l(r),
|
|
3414
|
+
values: a.values.map((u, s) => {
|
|
3415
|
+
var c, p, y, A;
|
|
3416
|
+
const d = r.find(
|
|
3417
|
+
(k) => k.includes(s)
|
|
3418
|
+
);
|
|
3419
|
+
if (d) {
|
|
3420
|
+
const k = d[0] - 1, x = d[d.length - 1] + 1;
|
|
3421
|
+
let g = (c = a.values[k]) == null ? void 0 : c.value, _ = (p = a.values[x]) == null ? void 0 : p.value;
|
|
3422
|
+
if (g == null) {
|
|
3423
|
+
const m = (A = (y = n == null ? void 0 : n.value) == null ? void 0 : y.domain) == null ? void 0 : A.call(y);
|
|
3424
|
+
g = (m == null ? void 0 : m[1]) ?? 0, _ = g;
|
|
3425
|
+
} else _ == null && (_ = g);
|
|
3426
|
+
return {
|
|
3427
|
+
value: o(
|
|
3428
|
+
g,
|
|
3429
|
+
_,
|
|
3430
|
+
d.length,
|
|
3431
|
+
d.indexOf(s)
|
|
3432
|
+
),
|
|
3433
|
+
label: nn,
|
|
3434
|
+
isNull: !0
|
|
3435
|
+
};
|
|
3436
|
+
}
|
|
3437
|
+
return u;
|
|
3438
|
+
})
|
|
3439
|
+
};
|
|
3440
|
+
})
|
|
3441
|
+
) };
|
|
3442
|
+
}
|
|
3443
|
+
function au(e, n) {
|
|
3444
|
+
const t = e.bandwidth() / 2;
|
|
3445
|
+
return (o, l) => e(e.domain()[n + (l - 1)]) + t;
|
|
3446
|
+
}
|
|
3447
|
+
function lu(e, n) {
|
|
3448
|
+
return (t, o) => e(n + (o - 1));
|
|
3449
|
+
}
|
|
3450
|
+
function uu(e, n, t, o) {
|
|
3451
|
+
const l = Nn().x(
|
|
3452
|
+
pe(t) ? au(t, e) : lu(t, e)
|
|
3453
|
+
).y((i) => o(i));
|
|
3454
|
+
return n.every((i) => i == null) ? null : l(n);
|
|
3455
|
+
}
|
|
3456
|
+
const ru = {
|
|
3457
|
+
class: "lume-line-group",
|
|
3458
|
+
"data-j-lume-line-group": ""
|
|
3459
|
+
}, iu = { class: "lume-line-group__lines" }, su = {
|
|
3460
|
+
key: 0,
|
|
3461
|
+
class: "lume-line-group__points",
|
|
3462
|
+
"data-j-lume-line-group__points": ""
|
|
3463
|
+
}, cu = 1, du = /* @__PURE__ */ Q({
|
|
3464
|
+
__name: "lume-line-group",
|
|
3465
|
+
props: {
|
|
3466
|
+
...tt(),
|
|
3467
|
+
withPoints: {
|
|
3468
|
+
type: [Boolean, String],
|
|
3469
|
+
default: !0
|
|
3470
|
+
},
|
|
3471
|
+
transition: {
|
|
3472
|
+
type: Boolean,
|
|
3473
|
+
default: !0
|
|
3474
|
+
}
|
|
3475
|
+
},
|
|
3476
|
+
emits: ["line-click", "point-click", "lume__internal--hover"],
|
|
3477
|
+
setup(e, { emit: n }) {
|
|
3478
|
+
const t = e, o = n, { data: l, options: i, xScale: a, yScale: r, labels: u } = ie(t), s = Qe(
|
|
3479
|
+
"tooltipAnchorAttributes",
|
|
3480
|
+
null
|
|
3481
|
+
), { updateTooltipAnchorAttributes: d } = dn(
|
|
3482
|
+
s,
|
|
3483
|
+
i,
|
|
3484
|
+
a,
|
|
3485
|
+
r,
|
|
3486
|
+
u
|
|
3487
|
+
), c = f(() => {
|
|
3488
|
+
if (l.value.every((q) => q.isDashed))
|
|
3489
|
+
return l.value;
|
|
3490
|
+
const { computedLineData: B } = _n(
|
|
3491
|
+
l,
|
|
3492
|
+
r
|
|
3493
|
+
);
|
|
3494
|
+
return i.value.withTooltip !== !1 && (s != null && s.value) && d(B.value), B.value;
|
|
3495
|
+
}), p = f(() => {
|
|
3496
|
+
if (t.hoveredIndex === -1) return;
|
|
3497
|
+
const B = jn(
|
|
3498
|
+
c.value,
|
|
3499
|
+
t.hoveredIndex
|
|
3500
|
+
);
|
|
3501
|
+
return {
|
|
3502
|
+
d: `M ${it(a.value, t.hoveredIndex)},${r.value.range()[1]}
|
|
3503
|
+
V ${r.value(B)}`
|
|
3504
|
+
// Move to X index, Vertical line to the highest point
|
|
3505
|
+
};
|
|
3506
|
+
}), y = f(
|
|
3507
|
+
() => a.value && cu / (Pn(a.value) - 1)
|
|
3508
|
+
// Subtracting the first line (read below)
|
|
3509
|
+
), A = f(
|
|
3510
|
+
() => {
|
|
3511
|
+
var B;
|
|
3512
|
+
return ((B = i.value) == null ? void 0 : B.lineWidth) * 2 || void 0;
|
|
3513
|
+
}
|
|
3514
|
+
// If no `lineWidth`, returns NaN which needs to be undefined
|
|
3515
|
+
), k = f(
|
|
3516
|
+
() => a.value.bandwidth() / 2
|
|
3517
|
+
), x = f(() => a.value.domain()), g = f(
|
|
3518
|
+
() => i.value.withPoints ?? t.withPoints
|
|
3519
|
+
), _ = f(
|
|
3520
|
+
() => i.value.withPoints === "visible" || t.withPoints === "visible"
|
|
3521
|
+
);
|
|
3522
|
+
function m(B) {
|
|
3523
|
+
return c.value[B].values;
|
|
3524
|
+
}
|
|
3525
|
+
function T(B) {
|
|
3526
|
+
return m(B).flatMap(
|
|
3527
|
+
(q, X) => q.isNull ? [] : [X]
|
|
3528
|
+
);
|
|
3529
|
+
}
|
|
3530
|
+
function N(B, q) {
|
|
3531
|
+
var X;
|
|
3532
|
+
return ((X = m(q)[B]) == null ? void 0 : X.color) ?? c.value[q].color;
|
|
3533
|
+
}
|
|
3534
|
+
function E(B, q) {
|
|
3535
|
+
var Y, le;
|
|
3536
|
+
const X = B === 0 ? [] : [
|
|
3537
|
+
(Y = m(q)[B - 1]) == null ? void 0 : Y.value,
|
|
3538
|
+
(le = m(q)[B]) == null ? void 0 : le.value
|
|
3539
|
+
];
|
|
3540
|
+
return uu(
|
|
3541
|
+
B,
|
|
3542
|
+
X,
|
|
3543
|
+
a.value,
|
|
3544
|
+
r.value
|
|
3545
|
+
) || "";
|
|
3546
|
+
}
|
|
3547
|
+
function M(B) {
|
|
3548
|
+
return {
|
|
3549
|
+
animationDelay: B < 2 ? 0 : (B - 1) * y.value,
|
|
3550
|
+
animationDuration: y.value
|
|
3551
|
+
};
|
|
3552
|
+
}
|
|
3553
|
+
function G(B, q) {
|
|
3554
|
+
var Y;
|
|
3555
|
+
const X = (Y = m(q)[B]) == null ? void 0 : Y.value;
|
|
3556
|
+
return {
|
|
3557
|
+
x: pe(a.value) ? t.xScale(x.value[B]) + k.value : t.xScale(B),
|
|
3558
|
+
y: X === null ? r.value(r.value.domain()[1]) : r.value(X)
|
|
3559
|
+
};
|
|
3560
|
+
}
|
|
3561
|
+
function te(B) {
|
|
3562
|
+
return t.hoveredIndex === B;
|
|
3563
|
+
}
|
|
3564
|
+
return (B, q) => (b(), O("g", ru, [
|
|
3565
|
+
P("path", W(p.value, {
|
|
3566
|
+
class: "lume-line-group__overlay-line",
|
|
3567
|
+
"data-j-lume-line-group__overlay-line": ""
|
|
3568
|
+
}), null, 16),
|
|
3569
|
+
(b(!0), O(oe, null, J(c.value, (X, Y) => (b(), O("g", {
|
|
3570
|
+
key: X.label,
|
|
3571
|
+
class: "lume-line-group__group"
|
|
3572
|
+
}, [
|
|
3573
|
+
P("g", iu, [
|
|
3574
|
+
(b(!0), O(oe, null, J(X.values, (le, re) => (b(), ee(v(Ql), W(M(re), {
|
|
3575
|
+
key: `line-${re}`,
|
|
3576
|
+
color: N(re, Y),
|
|
3577
|
+
dashed: X.isDashed(re),
|
|
3578
|
+
"path-definition": E(re, Y),
|
|
3579
|
+
transition: e.transition,
|
|
3580
|
+
width: v(i).lineWidth,
|
|
3581
|
+
onClick: (Le) => o("line-click", { index: re, datasetIndex: Y, event: Le })
|
|
3582
|
+
}), null, 16, ["color", "dashed", "path-definition", "transition", "width", "onClick"]))), 128))
|
|
3583
|
+
]),
|
|
3584
|
+
g.value ? (b(), O("g", su, [
|
|
3585
|
+
(b(!0), O(oe, null, J(T(Y), (le) => (b(), ee(v(ou), W(G(le, Y), {
|
|
3586
|
+
key: `point-${le}`,
|
|
3587
|
+
active: te(le),
|
|
3588
|
+
color: N(le, Y),
|
|
3589
|
+
index: le,
|
|
3590
|
+
radius: A.value,
|
|
3591
|
+
visible: _.value,
|
|
3592
|
+
onClick: (re) => o("point-click", { index: le, datasetIndex: Y, event: re })
|
|
3593
|
+
}), null, 16, ["active", "color", "index", "radius", "visible", "onClick"]))), 128))
|
|
3594
|
+
])) : K("", !0)
|
|
3595
|
+
]))), 128))
|
|
3596
|
+
]));
|
|
3597
|
+
}
|
|
3598
|
+
}), kn = /* @__PURE__ */ ae(du, [["__scopeId", "data-v-8c8a77a0"]]), vu = {
|
|
3599
|
+
margins: De.VERTICAL,
|
|
3600
|
+
startOnZero: !0,
|
|
3601
|
+
withTooltip: !0,
|
|
3602
|
+
xAxisOptions: {},
|
|
3603
|
+
yAxisOptions: { gridLines: !0 }
|
|
3604
|
+
}, wu = /* @__PURE__ */ Q({
|
|
3605
|
+
__name: "lume-line-chart",
|
|
3606
|
+
props: {
|
|
3607
|
+
...Ge(null, !1)
|
|
3608
|
+
},
|
|
3609
|
+
setup(e, { emit: n }) {
|
|
3610
|
+
const t = e, { componentEventPropagator: o } = Oe(), l = Be(me()), { options: i } = ie(t), { allOptions: a } = Ae(i, vu);
|
|
3611
|
+
return (r, u) => (b(), ee(v(Ce), W({ ...t, ...r.$attrs }, {
|
|
3612
|
+
"chart-type": "line",
|
|
3613
|
+
options: v(a),
|
|
3614
|
+
"data-j-lume-line-chart": ""
|
|
3615
|
+
}, de(v(o))), ke({
|
|
3616
|
+
groups: Z((s) => [
|
|
3617
|
+
ge(v(kn), W(s, de(v(o))), null, 16)
|
|
3618
|
+
]),
|
|
3619
|
+
_: 2
|
|
3620
|
+
}, [
|
|
3621
|
+
J(v(l), (s, d) => ({
|
|
3622
|
+
name: d,
|
|
3623
|
+
fn: Z((c) => [
|
|
3624
|
+
F(r.$slots, d, $e(we(c || {})))
|
|
3625
|
+
])
|
|
3626
|
+
}))
|
|
3627
|
+
]), 1040, ["options"]));
|
|
3628
|
+
}
|
|
3629
|
+
});
|
|
3630
|
+
function fu(e) {
|
|
3631
|
+
return { areaPathDefinition: f(
|
|
3632
|
+
() => function(t, o) {
|
|
3633
|
+
if (!t || !o || pe(t) || pe(o))
|
|
3634
|
+
return;
|
|
3635
|
+
const l = e.value[0].values;
|
|
3636
|
+
return En().x((i, a) => t(a)).y0(o(Math.min(...o.domain()))).y1((i) => o(i.value))(l);
|
|
3637
|
+
}
|
|
3638
|
+
) };
|
|
3639
|
+
}
|
|
3640
|
+
const mu = {
|
|
3641
|
+
margins: {
|
|
3642
|
+
top: 0,
|
|
3643
|
+
right: 0,
|
|
3644
|
+
bottom: 0,
|
|
3645
|
+
left: 0
|
|
3646
|
+
},
|
|
3647
|
+
withAxes: !1,
|
|
3648
|
+
showArea: !0,
|
|
3649
|
+
startOnZero: !0,
|
|
3650
|
+
withLegend: !1,
|
|
3651
|
+
tooltipOptions: {
|
|
3652
|
+
showTitle: !1
|
|
3653
|
+
}
|
|
3654
|
+
}, gu = ["d"], pu = /* @__PURE__ */ Q({
|
|
3655
|
+
__name: "lume-sparkline-chart",
|
|
3656
|
+
props: {
|
|
3657
|
+
...At(null),
|
|
3658
|
+
...Ve()
|
|
3659
|
+
},
|
|
3660
|
+
setup(e, { expose: n, emit: t }) {
|
|
3661
|
+
const o = e, { componentEventPropagator: l } = Oe(), i = Be(me()), { data: a, options: r } = ie(o), { internalData: u } = Lt(a), { allOptions: s } = Ae(r, mu), { computedLineData: d } = _n(u), { areaPathDefinition: c } = fu(d), p = f(() => {
|
|
3662
|
+
var x, g;
|
|
3663
|
+
return (g = (x = u.value) == null ? void 0 : x[0]) == null ? void 0 : g.color;
|
|
3664
|
+
}), y = f(
|
|
3665
|
+
() => {
|
|
3666
|
+
var x, g;
|
|
3667
|
+
return ((g = (x = a.value) == null ? void 0 : x[0]) == null ? void 0 : g.areaColor) || p.value;
|
|
3668
|
+
}
|
|
3669
|
+
);
|
|
3670
|
+
function A(x) {
|
|
3671
|
+
return {
|
|
3672
|
+
...x,
|
|
3673
|
+
noMinSize: !0
|
|
3674
|
+
};
|
|
3675
|
+
}
|
|
3676
|
+
function k(x, g, _) {
|
|
3677
|
+
if (x.length)
|
|
3678
|
+
return je().range([0, _.width]).domain([0, x[0].values.length - 1]);
|
|
3679
|
+
}
|
|
3680
|
+
return n({
|
|
3681
|
+
areaPathDefinition: c
|
|
3682
|
+
}), (x, g) => (b(), ee(v(Ce), W(o, {
|
|
3683
|
+
"chart-type": "line",
|
|
3684
|
+
options: A(v(s)),
|
|
3685
|
+
"x-scale": k
|
|
3686
|
+
}, de(v(l))), ke({
|
|
3687
|
+
groups: Z((_) => [
|
|
3688
|
+
v(s).showArea ? (b(), O("path", {
|
|
3689
|
+
key: 0,
|
|
3690
|
+
class: ue([
|
|
3691
|
+
"sparkline-chart__area",
|
|
3692
|
+
v(r).withTransition !== !1 ? "sparkline-chart__area--transition" : "",
|
|
3693
|
+
`lume-fill--${y.value || p.value}`,
|
|
3694
|
+
"lume-fill--faded"
|
|
3695
|
+
]),
|
|
3696
|
+
d: v(c)(_.xScale, _.yScale),
|
|
3697
|
+
"data-j-sparkline__area": ""
|
|
3698
|
+
}, null, 10, gu)) : K("", !0),
|
|
3699
|
+
ge(v(kn), W(_, { "with-points": !1 }, de(v(l))), null, 16)
|
|
3700
|
+
]),
|
|
3701
|
+
_: 2
|
|
3702
|
+
}, [
|
|
3703
|
+
J(v(i), (_, m) => ({
|
|
3704
|
+
name: m,
|
|
3705
|
+
fn: Z((T) => [
|
|
3706
|
+
F(x.$slots, m, $e(we(T || {})), void 0, !0)
|
|
3707
|
+
])
|
|
3708
|
+
}))
|
|
3709
|
+
]), 1040, ["options"]));
|
|
3710
|
+
}
|
|
3711
|
+
}), Iu = /* @__PURE__ */ ae(pu, [["__scopeId", "data-v-579f7e32"]]);
|
|
3712
|
+
export {
|
|
3713
|
+
Ct as A,
|
|
3714
|
+
it as B,
|
|
3715
|
+
Ee as C,
|
|
3716
|
+
_t as D,
|
|
3717
|
+
Gt as E,
|
|
3718
|
+
Tt as F,
|
|
3719
|
+
Lt as G,
|
|
3720
|
+
$o as H,
|
|
3721
|
+
_n as I,
|
|
3722
|
+
aa as J,
|
|
3723
|
+
Ae as K,
|
|
3724
|
+
bt as L,
|
|
3725
|
+
Io as M,
|
|
3726
|
+
ra as N,
|
|
3727
|
+
kt as O,
|
|
3728
|
+
dn as P,
|
|
3729
|
+
ia as Q,
|
|
3730
|
+
At as R,
|
|
3731
|
+
cn as S,
|
|
3732
|
+
Ge as T,
|
|
3733
|
+
wo as U,
|
|
3734
|
+
Ve as V,
|
|
3735
|
+
To as W,
|
|
3736
|
+
bu as _,
|
|
3737
|
+
he as a,
|
|
3738
|
+
Nl as b,
|
|
3739
|
+
Ga as c,
|
|
3740
|
+
Na as d,
|
|
3741
|
+
Ba as e,
|
|
3742
|
+
Bt as f,
|
|
3743
|
+
yt as g,
|
|
3744
|
+
Au as h,
|
|
3745
|
+
It as i,
|
|
3746
|
+
Ce as j,
|
|
3747
|
+
Eo as k,
|
|
3748
|
+
Ft as l,
|
|
3749
|
+
Tu as m,
|
|
3750
|
+
Ql as n,
|
|
3751
|
+
wu as o,
|
|
3752
|
+
kn as p,
|
|
3753
|
+
na as q,
|
|
3754
|
+
ou as r,
|
|
3755
|
+
Lu as s,
|
|
3756
|
+
Iu as t,
|
|
3757
|
+
$u as u,
|
|
3758
|
+
ea as v,
|
|
3759
|
+
Zo as w,
|
|
3760
|
+
Po as x,
|
|
3761
|
+
So as y,
|
|
3762
|
+
oa as z
|
|
3763
|
+
};
|
|
3764
|
+
//# sourceMappingURL=jCogx8dL.js.map
|