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