lintje 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-elements/actions.js +1 -1
- package/dist-elements/charts.js +1 -1
- package/dist-elements/chunks/{base-rBLTcEIv.js → base-Bg-IFOPG.js} +134 -105
- package/dist-elements/chunks/{date-format-B5DPGjAw.js → date-format-mHtZyBys.js} +28 -2
- package/dist-elements/chunks/disclosure-BXTX04gM.js +4 -0
- package/dist-elements/chunks/{disclosure-CHasOudX.js → disclosure-CMXhX-Vb.js} +7 -7
- package/dist-elements/chunks/download-y528pIHP.js +230 -0
- package/dist-elements/chunks/{focus-trap-w3vCamJ6.js → focus-trap-9BnE-xWv.js} +1 -1
- package/dist-elements/chunks/{input-jQVTln7H.js → input-BtuNFSWk.js} +13 -13
- package/dist-elements/chunks/{player-Bq9YGnpt.js → player-DXOZEyEy.js} +24 -24
- package/dist-elements/chunks/{sentence-CLNJOeXz.js → sentence-BI3lwEuT.js} +3 -3
- package/dist-elements/chunks/{stagger-9hYzxhMG.js → stagger-qGD3wmhg.js} +145 -123
- package/dist-elements/core.js +1 -1
- package/dist-elements/custom-elements.json +436 -26
- package/dist-elements/feedback.js +1 -1
- package/dist-elements/guides/dashboard.md +1 -1
- package/dist-elements/guides/events.md +3 -2
- package/dist-elements/guides/loading.md +3 -3
- package/dist-elements/guides/start.md +1 -1
- package/dist-elements/inputs.js +1 -0
- package/dist-elements/layout.js +1 -1
- package/dist-elements/lintje.js +22659 -22216
- package/dist-elements/map.js +1 -1
- package/dist-elements/overlays.js +1 -1
- package/dist-elements/tag/activity-log.js +11 -11
- package/dist-elements/tag/ai-label.js +7 -7
- package/dist-elements/tag/announcement.js +19 -19
- package/dist-elements/tag/app-search.js +21 -21
- package/dist-elements/tag/audio-player.js +34 -34
- package/dist-elements/tag/badge.js +1 -1
- package/dist-elements/tag/breadcrumbs.js +11 -11
- package/dist-elements/tag/button.js +1 -1
- package/dist-elements/tag/card-list.js +1 -1
- package/dist-elements/tag/card.js +25 -25
- package/dist-elements/tag/chart.d.ts +1 -0
- package/dist-elements/tag/chart.js +1868 -0
- package/dist-elements/tag/chat-answer.js +28 -28
- package/dist-elements/tag/chat-composer.js +20 -20
- package/dist-elements/tag/chat-message.js +9 -9
- package/dist-elements/tag/chat-strip.js +16 -16
- package/dist-elements/tag/chat-suggestions.js +1 -1
- package/dist-elements/tag/chat.js +27 -27
- package/dist-elements/tag/checkbox.js +6 -6
- package/dist-elements/tag/code.js +8 -8
- package/dist-elements/tag/combobox.js +13 -13
- package/dist-elements/tag/confirm-dialog.js +6 -6
- package/dist-elements/tag/conflict-alert.js +5 -5
- package/dist-elements/tag/copy-button.js +7 -7
- package/dist-elements/tag/data-table.js +179 -179
- package/dist-elements/tag/date-input.js +34 -42
- package/dist-elements/tag/date-range.js +33 -33
- package/dist-elements/tag/description-list.js +20 -20
- package/dist-elements/tag/document-viewer.js +19 -19
- package/dist-elements/tag/drawer.js +7 -7
- package/dist-elements/tag/empty-state.js +11 -11
- package/dist-elements/tag/error-summary.js +8 -8
- package/dist-elements/tag/expander.js +7 -7
- package/dist-elements/tag/explainer.js +9 -9
- package/dist-elements/tag/field.js +4 -4
- package/dist-elements/tag/file-upload.js +20 -20
- package/dist-elements/tag/filter-bar.js +35 -35
- package/dist-elements/tag/filter-sheet.js +6 -6
- package/dist-elements/tag/filter-zone.js +21 -21
- package/dist-elements/tag/footer.js +1 -1
- package/dist-elements/tag/form-actions.js +7 -7
- package/dist-elements/tag/form-section.js +3 -3
- package/dist-elements/tag/form.js +4 -4
- package/dist-elements/tag/gallery.js +6 -6
- package/dist-elements/tag/grid-item.js +1 -1
- package/dist-elements/tag/grid.js +1 -1
- package/dist-elements/tag/hero.js +6 -6
- package/dist-elements/tag/highlight.js +6 -6
- package/dist-elements/tag/icon-button.js +1 -1
- package/dist-elements/tag/icon.js +1 -1
- package/dist-elements/tag/job-list.js +6 -6
- package/dist-elements/tag/kpi-row.js +7 -5
- package/dist-elements/tag/kpi.js +259 -69
- package/dist-elements/tag/level-meter.js +5 -5
- package/dist-elements/tag/list.js +28 -28
- package/dist-elements/tag/logo.js +9 -9
- package/dist-elements/tag/map.d.ts +1 -0
- package/dist-elements/tag/map.js +21910 -0
- package/dist-elements/tag/menu-button.js +48 -47
- package/dist-elements/tag/modal.js +9 -9
- package/dist-elements/tag/multiselect.js +18 -18
- package/dist-elements/tag/note.js +4 -4
- package/dist-elements/tag/notifications.js +24 -24
- package/dist-elements/tag/number-input.js +8 -8
- package/dist-elements/tag/page-header.js +13 -13
- package/dist-elements/tag/pagination.js +27 -27
- package/dist-elements/tag/popover.js +1 -1
- package/dist-elements/tag/progress-bar.js +1 -1
- package/dist-elements/tag/prose.js +4 -4
- package/dist-elements/tag/qr-code.js +6 -6
- package/dist-elements/tag/radio-group.js +7 -7
- package/dist-elements/tag/range.js +13 -13
- package/dist-elements/tag/recording-status.js +8 -8
- package/dist-elements/tag/repeater.js +1 -1
- package/dist-elements/tag/segmented.js +7 -7
- package/dist-elements/tag/select.js +6 -6
- package/dist-elements/tag/session-expiry.js +13 -13
- package/dist-elements/tag/shell.js +168 -168
- package/dist-elements/tag/shortcuts.js +8 -8
- package/dist-elements/tag/skeleton.js +1 -1
- package/dist-elements/tag/slot-picker.d.ts +1 -0
- package/dist-elements/tag/slot-picker.js +74 -0
- package/dist-elements/tag/sortable-list.js +11 -11
- package/dist-elements/tag/spinner.js +1 -1
- package/dist-elements/tag/split-pane.js +4 -4
- package/dist-elements/tag/status-dot.js +1 -1
- package/dist-elements/tag/stepper.js +13 -13
- package/dist-elements/tag/streaming-text.js +15 -15
- package/dist-elements/tag/sub-nav.js +26 -26
- package/dist-elements/tag/tabs.js +13 -13
- package/dist-elements/tag/tag-input.js +14 -14
- package/dist-elements/tag/text-editor.js +7 -7
- package/dist-elements/tag/text-input.js +10 -10
- package/dist-elements/tag/textarea.js +6 -6
- package/dist-elements/tag/tile.js +1 -1
- package/dist-elements/tag/time-input.js +136 -42
- package/dist-elements/tag/toast.js +10 -10
- package/dist-elements/tag/toggle.js +6 -6
- package/dist-elements/tag/toggletip.js +11 -11
- package/dist-elements/tag/tooltip.js +1 -1
- package/dist-elements/tag/transcript.js +31 -31
- package/dist-elements/tag/translator.js +7 -7
- package/dist-elements/tag/tree-view.js +12 -12
- package/dist-elements/tag/user-menu.js +31 -30
- package/dist-elements/tag/video-player.js +13 -13
- package/dist-elements/tokens.css +2 -0
- package/dist-elements/types/bundle/charts.d.ts +1 -1
- package/dist-elements/types/bundle/index.d.ts +1 -1
- package/dist-elements/types/bundle/inputs.d.ts +1 -0
- package/dist-elements/types/bundle/map.d.ts +1 -1
- package/dist-elements/types/components/charts/{chart-tile/chart-tile.d.ts → chart/chart.d.ts} +7 -7
- package/dist-elements/types/components/charts/kpi/gauge.d.ts +18 -0
- package/dist-elements/types/components/charts/kpi/kpi.d.ts +28 -3
- package/dist-elements/types/components/chat/chat-answer/chat-answer.d.ts +1 -1
- package/dist-elements/types/components/index.d.ts +8 -5
- package/dist-elements/types/components/inputs/date-input/date-format.d.ts +4 -0
- package/dist-elements/types/components/inputs/slot-picker/slot-picker.d.ts +41 -0
- package/dist-elements/types/components/inputs/time-input/time-format.d.ts +4 -0
- package/dist-elements/types/components/inputs/time-input/time-input.d.ts +25 -6
- package/dist-elements/types/components/map/{map-tile/map-tile.d.ts → map/map.d.ts} +10 -6
- package/dist-elements/types/components/shared/charts/histogram-chart/histogram-chart.d.ts +33 -0
- package/dist-elements/types/components/shared/charts/index.d.ts +3 -1
- package/dist-elements/types/components/shared/charts/map-chart/area.d.ts +16 -0
- package/dist-elements/types/components/shared/charts/map-chart/drawings.d.ts +6 -2
- package/dist-elements/types/components/shared/charts/map-chart/geo.d.ts +6 -0
- package/dist-elements/types/components/shared/charts/map-chart/leaflet.d.ts +40 -2
- package/dist-elements/types/components/shared/charts/map-chart/map-chart.d.ts +17 -3
- package/dist-elements/types/components/shared/charts/map-chart/map-legend.d.ts +26 -0
- package/dist-elements/types/components/shared/charts/map-chart/marks.d.ts +47 -0
- package/dist-elements/types/components/shared/charts/map-chart/reveal.d.ts +1 -1
- package/dist-elements/types/components/shared/charts/scatter-chart/scatter-chart.d.ts +29 -0
- package/dist-elements/types/components/shared/charts/shared/axes.d.ts +21 -4
- package/dist-elements/types/components/shared/charts/shared/chart-icons.d.ts +4 -3
- package/dist-elements/types/components/shared/charts/shared/controller.d.ts +27 -15
- package/dist-elements/types/components/shared/charts/shared/types.d.ts +112 -6
- package/dist-elements/types/core/format.d.ts +5 -2
- package/dist-elements/types/icons/register.d.ts +1 -1
- package/dist-elements/types/primitives/shared/place.d.ts +1 -1
- package/dist-elements/types/primitives/tooltip/tooltip.d.ts +2 -0
- package/dist-elements/types/types.d.ts +37 -7
- package/dist-icons/functioneel-cirkelselectie.svg +1 -0
- package/dist-icons/functioneel-lasso.svg +1 -0
- package/dist-icons/functioneel-punaise-outline.svg +1 -0
- package/dist-icons/functioneel-punaise.svg +1 -0
- package/dist-icons/functioneel-rechthoekselectie.svg +1 -0
- package/dist-icons/functioneel-selectie.svg +1 -0
- package/package.json +1 -1
- package/dist-elements/chunks/disclosure-Z7Ny17sS.js +0 -4
- package/dist-elements/chunks/download-lFooAfD1.js +0 -226
- package/dist-elements/tag/chart-tile.d.ts +0 -1
- package/dist-elements/tag/chart-tile.js +0 -1474
- package/dist-elements/tag/map-tile.d.ts +0 -1
- package/dist-elements/tag/map-tile.js +0 -22292
|
@@ -0,0 +1,1868 @@
|
|
|
1
|
+
import { A as e, Bt as t, Gt as n, Ht as r, Jt as i, Lt as a, S as o, c as s, d as c, i as l, k as u, l as d, o as f, p, qt as m, r as h, s as g, ut as _, w as v } from "../chunks/base-Bg-IFOPG.js";
|
|
2
|
+
import { t as y } from "./announcement.js";
|
|
3
|
+
import "./segmented.js";
|
|
4
|
+
import { a as b, c as x, d as S, i as C, n as w, o as T, s as E, t as D } from "../chunks/download-y528pIHP.js";
|
|
5
|
+
import { C as O, E as k, S as A, T as j, _ as M, a as N, b as P, c as F, f as I, g as L, h as R, i as z, l as ee, n as B, o as V, p as te, r as H, s as ne, t as re, u as ie, v as U, w as W, x as G, y as K } from "../chunks/stagger-qGD3wmhg.js";
|
|
6
|
+
import "./data-table.js";
|
|
7
|
+
//#region src/components/shared/charts/shared/plot-keys.ts
|
|
8
|
+
var q = /* @__PURE__ */ new Set(["ArrowRight", "ArrowDown"]), ae = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowUp"]);
|
|
9
|
+
function oe(e) {
|
|
10
|
+
return `${e.title}: ${e.rows.map((e) => `${e.label} ${e.value}`.trim()).join(", ")}`;
|
|
11
|
+
}
|
|
12
|
+
function J(e) {
|
|
13
|
+
try {
|
|
14
|
+
return e.matches(":focus-visible");
|
|
15
|
+
} catch {
|
|
16
|
+
return !0;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function Y(e, t, n) {
|
|
20
|
+
let r = (t, r) => {
|
|
21
|
+
let i = n(r), a = t.closest("[data-tooltip-anchor]"), o = t.getBoundingClientRect(), s = a?.getBoundingClientRect() ?? o;
|
|
22
|
+
e.hoverIndex = r, e.status = oe(i.content), e.showTooltipAt(o.left - s.left + i.x, o.top - s.top + i.y, i.content);
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
keydown(n) {
|
|
26
|
+
if (n.target !== n.currentTarget || t === 0) return;
|
|
27
|
+
let i = e.hoverIndex ?? -1, a;
|
|
28
|
+
if (q.has(n.key)) a = Math.min(t - 1, i + 1);
|
|
29
|
+
else if (ae.has(n.key)) a = Math.max(0, i - 1);
|
|
30
|
+
else if (n.key === "Home") a = 0;
|
|
31
|
+
else if (n.key === "End") a = t - 1;
|
|
32
|
+
else return;
|
|
33
|
+
n.preventDefault(), r(n.currentTarget, a);
|
|
34
|
+
},
|
|
35
|
+
focus(n) {
|
|
36
|
+
let i = n.currentTarget;
|
|
37
|
+
n.target === i && t !== 0 && J(i) && r(i, Math.min(e.hoverIndex ?? 0, t - 1));
|
|
38
|
+
},
|
|
39
|
+
blur() {
|
|
40
|
+
(e.hoverIndex != null || e.status) && (e.hoverIndex = null, e.status = "", e.hideTooltip(), e.requestUpdate());
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function X(e) {
|
|
45
|
+
return m`<p class="visually-hidden" role="status">${e.status}</p>`;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/components/shared/charts/line-chart/line-chart.ts
|
|
49
|
+
function se(e, t) {
|
|
50
|
+
let { controller: r, description: a } = t, { labels: o, axisTitle: s, unit: l, asOfIndex: u, asOfLabel: f, pendingHours: p = 0, fixedMax: h, small: _ = !1 } = e, v = r.id;
|
|
51
|
+
r.measure({
|
|
52
|
+
width: !0,
|
|
53
|
+
height: t.height ?? (_ ? "--chart-h-small" : "--chart-h-main"),
|
|
54
|
+
fit: !!t.expanded && !t.mobile
|
|
55
|
+
});
|
|
56
|
+
let y = e.series.filter((e) => !e.comparison).length > 1, b = 0, x = e.series.map((e) => ({
|
|
57
|
+
...e,
|
|
58
|
+
color: I(e.color),
|
|
59
|
+
symbol: y && !e.comparison ? L(e.color) ? e.color : R[b++ % R.length] : void 0
|
|
60
|
+
})), S = x.filter((e) => !r.hiddenSeries.includes(e.label)), C = S.flatMap((e) => e.values).filter((e) => e != null), { max: w, ticks: T } = G(h ?? Math.max(...C, 1)), E = P(T, r.width, {
|
|
61
|
+
fontFamily: r.fontFamily,
|
|
62
|
+
minimum: Math.ceil(d(o[0] ?? "", r.fontFamily) / 2)
|
|
63
|
+
}), D = K(t, { left: E.width }), A = p > 6, N = u ?? o.length - 1, F = (e) => e.comparison ? "var(--color-chart-secondary)" : e.color ?? "var(--color-chart-default)", z = x.map((e) => ({
|
|
64
|
+
label: e.label,
|
|
65
|
+
color: F(e),
|
|
66
|
+
shape: e.comparison ? "dashed" : "line",
|
|
67
|
+
symbol: e.symbol,
|
|
68
|
+
hidden: r.hiddenSeries.includes(e.label)
|
|
69
|
+
})), B = Math.max(1, Math.ceil(o.length / 8)), re = o.map((e, t) => ({
|
|
70
|
+
label: e,
|
|
71
|
+
x: j(t, o.length, D),
|
|
72
|
+
i: t
|
|
73
|
+
})).filter((e) => e.i % B === 0);
|
|
74
|
+
function ie(e) {
|
|
75
|
+
return {
|
|
76
|
+
title: o[e],
|
|
77
|
+
rows: S.map((t) => ({
|
|
78
|
+
label: t.label,
|
|
79
|
+
value: t.values[e] == null ? "geen gegevens" : g(t.values[e]),
|
|
80
|
+
color: F(t)
|
|
81
|
+
}))
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
let U = Y(r, o.length, (e) => {
|
|
85
|
+
let t = S.map((t) => t.values[e]).filter((e) => e != null);
|
|
86
|
+
return {
|
|
87
|
+
x: j(e, o.length, D),
|
|
88
|
+
y: t.length ? k(Math.max(...t), w, D) : D.top,
|
|
89
|
+
content: ie(e)
|
|
90
|
+
};
|
|
91
|
+
}), W = [
|
|
92
|
+
p > 0 ? (() => {
|
|
93
|
+
let e = j(N, o.length, D), t = A ? O(D) / (o.length - 1) : D.width - D.right - e;
|
|
94
|
+
return i`<rect x=${e} y=${D.top} width=${Math.max(0, t)}
|
|
95
|
+
height=${D.height - D.top - D.bottom}
|
|
96
|
+
fill="url(#hatch-${v})" />`;
|
|
97
|
+
})() : n,
|
|
98
|
+
i`<g class="lintje-chart__reveal">
|
|
99
|
+
${S.map((e) => {
|
|
100
|
+
let t = F(e), r = e.comparison ? void 0 : te(t), a = [[]];
|
|
101
|
+
e.values.forEach((e, t) => {
|
|
102
|
+
e == null || A && t > N ? a[a.length - 1].length && a.push([]) : a[a.length - 1].push({
|
|
103
|
+
x: j(t, o.length, D),
|
|
104
|
+
y: k(e, w, D)
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
let s = a.filter((e) => e.length > 0);
|
|
108
|
+
if (s.length === 0) return n;
|
|
109
|
+
let c = s[s.length - 1], l = c[c.length - 1], u = D.height - D.bottom;
|
|
110
|
+
return i`
|
|
111
|
+
<g>
|
|
112
|
+
${s.map((a) => {
|
|
113
|
+
let o = a.map((e) => `${e.x},${e.y}`).join(" ");
|
|
114
|
+
return i`
|
|
115
|
+
${e.area && !e.comparison ? i`<polygon fill=${t} fill-opacity=".14"
|
|
116
|
+
points=${`${a[0].x},${u} ${o} ${a[a.length - 1].x},${u}`} />` : n}
|
|
117
|
+
${r && a.length > 1 ? i`<polyline class="lintje-chart__line lintje-chart__line--casing" points=${o} stroke=${r} />` : n}
|
|
118
|
+
${a.length === 1 ? i`<circle cx=${a[0].x} cy=${a[0].y} r="2.5" fill=${t} />` : i`<polyline
|
|
119
|
+
class="lintje-chart__line"
|
|
120
|
+
points=${o}
|
|
121
|
+
stroke=${t}
|
|
122
|
+
stroke-dasharray=${e.comparison ? "5 4" : n}
|
|
123
|
+
opacity=${e.comparison ? .9 : 1} />`}
|
|
124
|
+
`;
|
|
125
|
+
})}
|
|
126
|
+
<!-- The line's own shape at its end; a 4 px point there at an early as-of time. -->
|
|
127
|
+
${e.symbol ? i`<path class="lintje-chart__line-end" d=${M(e.symbol, 4.5, l.x, l.y)} fill=${t} />` : A && !e.comparison ? i`<circle cx=${l.x} cy=${l.y} r="4" fill=${t} />` : n}
|
|
128
|
+
</g>
|
|
129
|
+
`;
|
|
130
|
+
})}
|
|
131
|
+
</g>`,
|
|
132
|
+
A && f ? V({
|
|
133
|
+
area: D,
|
|
134
|
+
index: N,
|
|
135
|
+
count: o.length,
|
|
136
|
+
label: `peilmoment ${f}`,
|
|
137
|
+
pendingHours: p,
|
|
138
|
+
lastValue: (() => {
|
|
139
|
+
let e = S.find((e) => !e.comparison)?.values[N];
|
|
140
|
+
return e == null ? void 0 : `${g(e)}${l ? ` ${l}` : ""}`;
|
|
141
|
+
})()
|
|
142
|
+
}) : n,
|
|
143
|
+
r.hoverIndex == null ? n : S.map((e) => {
|
|
144
|
+
let t = r.hoverIndex, a = e.values[t];
|
|
145
|
+
return a == null || A && t > N ? n : i`<circle class="lintje-chart__hover-point" r="4" fill=${F(e)}
|
|
146
|
+
cx=${j(t, o.length, D)}
|
|
147
|
+
cy=${k(a, w, D)} />`;
|
|
148
|
+
}),
|
|
149
|
+
o.map((e, t) => {
|
|
150
|
+
let n = j(t, o.length, D), a = O(D) / Math.max(1, o.length - 1);
|
|
151
|
+
return i`
|
|
152
|
+
<rect x=${n - a / 2} y=${D.top} width=${a}
|
|
153
|
+
height=${D.height - D.top - D.bottom}
|
|
154
|
+
fill="transparent"
|
|
155
|
+
@mousemove=${(e) => r.hoverAt(t, e, ie(t))}
|
|
156
|
+
@mouseleave=${() => r.hoverAt(null)} />
|
|
157
|
+
`;
|
|
158
|
+
})
|
|
159
|
+
];
|
|
160
|
+
return m`
|
|
161
|
+
<div class="lintje-chart-wrap ${_ ? "lintje-chart--small" : ""}"
|
|
162
|
+
${c(r.attach)} ?data-in-view=${r.inView} data-tooltip-anchor
|
|
163
|
+
@keydown=${(e) => r.dismiss(e)}>
|
|
164
|
+
${ee({
|
|
165
|
+
items: z,
|
|
166
|
+
onToggle: (e) => r.toggleSeries(e)
|
|
167
|
+
})}
|
|
168
|
+
${ne({
|
|
169
|
+
fontFamily: r.fontFamily,
|
|
170
|
+
id: v,
|
|
171
|
+
ticks: T,
|
|
172
|
+
max: w,
|
|
173
|
+
area: D,
|
|
174
|
+
formatTick: E.format,
|
|
175
|
+
axisTitle: s ?? l,
|
|
176
|
+
xLabels: re,
|
|
177
|
+
description: a,
|
|
178
|
+
keys: U
|
|
179
|
+
}, W)}
|
|
180
|
+
${H(r)}
|
|
181
|
+
${X(r)}
|
|
182
|
+
</div>
|
|
183
|
+
`;
|
|
184
|
+
}
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region src/components/shared/charts/shared/mark-select.ts
|
|
187
|
+
var Z = {
|
|
188
|
+
clickable: !1,
|
|
189
|
+
state: "",
|
|
190
|
+
markId: n,
|
|
191
|
+
role: n,
|
|
192
|
+
tabIndex: n,
|
|
193
|
+
pressed: n,
|
|
194
|
+
label: n,
|
|
195
|
+
click: n,
|
|
196
|
+
keydown: n
|
|
197
|
+
};
|
|
198
|
+
function Q(e, t) {
|
|
199
|
+
let n = /* @__PURE__ */ new Set();
|
|
200
|
+
for (let e of t) e?.href && n.add(e.id);
|
|
201
|
+
let r = e.selectedId != null && n.has(e.selectedId) ? e.selectedId : null, i = () => {
|
|
202
|
+
r != null && e.onClear?.(r);
|
|
203
|
+
}, a = (t, n) => {
|
|
204
|
+
if (t.id === r) return i();
|
|
205
|
+
e.onSelect?.({
|
|
206
|
+
id: t.id,
|
|
207
|
+
label: n,
|
|
208
|
+
href: t.href
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
return {
|
|
212
|
+
active: r,
|
|
213
|
+
interactive: !!e.onSelect && n.size > 0,
|
|
214
|
+
of(t, n, i) {
|
|
215
|
+
if (!t?.href || !e.onSelect) return r == null ? Z : {
|
|
216
|
+
...Z,
|
|
217
|
+
state: "is-muted"
|
|
218
|
+
};
|
|
219
|
+
let o = t.id === r;
|
|
220
|
+
return {
|
|
221
|
+
clickable: !0,
|
|
222
|
+
state: `is-clickable ${o ? "is-selected" : r == null ? "" : "is-muted"}`,
|
|
223
|
+
markId: t.id,
|
|
224
|
+
role: "button",
|
|
225
|
+
tabIndex: 0,
|
|
226
|
+
pressed: o ? "true" : "false",
|
|
227
|
+
label: i ?? n,
|
|
228
|
+
click: () => a(t, n),
|
|
229
|
+
keydown: (e) => {
|
|
230
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), a(t, n));
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
},
|
|
234
|
+
escape(e) {
|
|
235
|
+
e.key === "Escape" && r != null && (e.stopPropagation(), i());
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/components/shared/charts/bar-chart/bar-chart.ts
|
|
241
|
+
var ce = [
|
|
242
|
+
"var(--color-chart-tint-1)",
|
|
243
|
+
"var(--color-chart-tint-2)",
|
|
244
|
+
"var(--color-chart-tint-3)",
|
|
245
|
+
"var(--color-chart-tint-4)",
|
|
246
|
+
"var(--color-chart-tint-5)"
|
|
247
|
+
];
|
|
248
|
+
function le(e, t) {
|
|
249
|
+
let { controller: r, description: a } = t, { labels: o, values: s, axisTitle: u, trend: d, dataLabels: p = !0, small: h = !1, links: v } = e, y = I(e.color) ?? "var(--color-chart-default)", b = r.id, x = Q(t, v ?? []);
|
|
250
|
+
r.measure({
|
|
251
|
+
width: !0,
|
|
252
|
+
height: t.height ?? (h ? "--chart-h-small" : "--chart-h-main"),
|
|
253
|
+
fit: !!t.expanded && !t.mobile
|
|
254
|
+
});
|
|
255
|
+
let S = s.filter((e) => e != null), { max: C, ticks: w } = G(Math.max(...S, 1)), T = P(w, r.width, { fontFamily: r.fontFamily }), E = K(t, { left: T.width }), D = E.height - E.bottom, { width: O, bandWidth: j } = A(0, o.length, E), M = p && s.every((e) => e == null || l(f(e, O), j - 4)), N = (e) => ({
|
|
256
|
+
title: o[e],
|
|
257
|
+
rows: [{
|
|
258
|
+
label: u ?? "Waarde",
|
|
259
|
+
value: s[e] == null ? "geen gegevens" : g(s[e]),
|
|
260
|
+
color: y
|
|
261
|
+
}]
|
|
262
|
+
}), F = Y(r, o.length, (e) => ({
|
|
263
|
+
x: A(e, o.length, E).center,
|
|
264
|
+
y: s[e] == null ? E.top : k(s[e], C, E),
|
|
265
|
+
content: N(e)
|
|
266
|
+
})), L = [s.map((e, t) => {
|
|
267
|
+
let a = A(t, o.length, E);
|
|
268
|
+
if (e == null) return i`<rect class="lintje-chart__missing" x=${a.x} y=${E.top} width=${a.width}
|
|
269
|
+
height=${Math.max(0, D - E.top)} fill="url(#hatch-${b})"
|
|
270
|
+
@mousemove=${(e) => r.showTooltip(e, N(t))}
|
|
271
|
+
@mouseleave=${() => r.hideTooltip()} />`;
|
|
272
|
+
let s = k(e, C, E), c = x.of(v?.[t], o[t], `${o[t]}: ${g(e)}`);
|
|
273
|
+
return i`
|
|
274
|
+
<g class="lintje-chart__bar-group ${r.hoverIndex === t ? "is-hovered" : ""}"
|
|
275
|
+
${_(B(t, o.length))}
|
|
276
|
+
@mousemove=${(e) => r.showTooltip(e, N(t))}
|
|
277
|
+
@mouseleave=${() => r.hideTooltip()}>
|
|
278
|
+
<rect class="lintje-chart__bar lintje-chart__mark ${c.state}"
|
|
279
|
+
x=${a.x} y=${s} width=${a.width} height=${Math.max(0, D - s)} fill=${y}
|
|
280
|
+
data-mark-id=${c.markId} role=${c.role} tabindex=${c.tabIndex}
|
|
281
|
+
aria-pressed=${c.pressed} aria-label=${c.label}
|
|
282
|
+
@click=${c.click} @keydown=${c.keydown} />
|
|
283
|
+
${M ? i`<text x=${a.center} y=${s - 5} text-anchor="middle" class="lintje-chart__data-label">
|
|
284
|
+
${f(e, a.width)}
|
|
285
|
+
</text>` : n}
|
|
286
|
+
</g>
|
|
287
|
+
`;
|
|
288
|
+
}), d ? i`<polyline
|
|
289
|
+
fill="none" stroke="var(--color-chart-emphasis)" stroke-width="1.5" stroke-dasharray="5 4"
|
|
290
|
+
points=${d.map((e, t) => e == null ? null : `${A(t, o.length, E).center},${k(e, C, E)}`).filter(Boolean).join(" ")} />` : n];
|
|
291
|
+
return m`
|
|
292
|
+
<div class="lintje-chart-wrap ${h ? "lintje-chart--small" : ""}"
|
|
293
|
+
${c(r.attach)} ?data-in-view=${r.inView} data-tooltip-anchor
|
|
294
|
+
@keydown=${(e) => r.dismiss(e) || x.escape(e)}>
|
|
295
|
+
${ne({
|
|
296
|
+
fontFamily: r.fontFamily,
|
|
297
|
+
id: b,
|
|
298
|
+
ticks: w,
|
|
299
|
+
max: C,
|
|
300
|
+
area: E,
|
|
301
|
+
axisTitle: u,
|
|
302
|
+
description: a,
|
|
303
|
+
formatTick: T.format,
|
|
304
|
+
xLabels: o.map((e, t) => ({
|
|
305
|
+
label: e,
|
|
306
|
+
x: A(t, o.length, E).center
|
|
307
|
+
})),
|
|
308
|
+
interactive: x.interactive,
|
|
309
|
+
keys: F
|
|
310
|
+
}, L)}
|
|
311
|
+
${H(r)}
|
|
312
|
+
${X(r)}
|
|
313
|
+
</div>
|
|
314
|
+
`;
|
|
315
|
+
}
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region src/components/shared/charts/horizontal-bar-chart/horizontal-bar-chart.ts
|
|
318
|
+
function ue(e) {
|
|
319
|
+
return e * 26 + 24;
|
|
320
|
+
}
|
|
321
|
+
function de(e, t) {
|
|
322
|
+
let { controller: r, description: a } = t, { rows: o, threshold: s, thresholdLabel: l, unit: u } = e, d = I(e.color) ?? "var(--color-chart-dark-yellow)", f = I(e.aboveThresholdColor) ?? "var(--color-chart-red)", p = r.id, h = o.map((e) => e.href ? {
|
|
323
|
+
id: e.id ?? e.label,
|
|
324
|
+
href: e.href
|
|
325
|
+
} : null), v = Q(t, h), y = ue(o.length);
|
|
326
|
+
r.measure({
|
|
327
|
+
width: !0,
|
|
328
|
+
height: y
|
|
329
|
+
});
|
|
330
|
+
let b = r.width, x = W(o.map((e) => e.label), b, { fontFamily: r.fontFamily }), { labelEnd: S, barStart: C } = x, w = Math.max(...o.map((e) => e.value), s ?? 0) * 1.15, T = (e) => Math.max(40, b - C - 60) * e / w, E = (e) => `${g(e)}${u ? ` ${u}` : ""}`, D = (e) => {
|
|
331
|
+
let t = o[e], n = s != null && t.value > s;
|
|
332
|
+
return {
|
|
333
|
+
title: t.label,
|
|
334
|
+
rows: [{
|
|
335
|
+
label: "Waarde",
|
|
336
|
+
value: E(t.value),
|
|
337
|
+
color: n ? f : d
|
|
338
|
+
}, ...s == null ? [] : [{
|
|
339
|
+
label: "Norm",
|
|
340
|
+
value: E(s),
|
|
341
|
+
color: "var(--color-chart-emphasis)"
|
|
342
|
+
}]]
|
|
343
|
+
};
|
|
344
|
+
}, O = Y(r, o.length, (e) => ({
|
|
345
|
+
x: C + T(o[e].value),
|
|
346
|
+
y: e * 26 + 4,
|
|
347
|
+
content: D(e)
|
|
348
|
+
}));
|
|
349
|
+
return m`
|
|
350
|
+
<figure class="lintje-chart lintje-chart--rows" ${c(r.attach)} ?data-in-view=${r.inView}
|
|
351
|
+
data-tooltip-anchor
|
|
352
|
+
@keydown=${(e) => r.dismiss(e) || v.escape(e)}>
|
|
353
|
+
<svg viewBox="0 0 ${b} ${y}" class="lintje-chart__svg" role=${z(v.interactive)}
|
|
354
|
+
aria-labelledby="${p}-desc" width=${b} height=${y}
|
|
355
|
+
${_({
|
|
356
|
+
height: `${y}px`,
|
|
357
|
+
...N(p)
|
|
358
|
+
})}
|
|
359
|
+
tabindex="0" @keydown=${O.keydown} @focus=${O.focus} @blur=${O.blur}>
|
|
360
|
+
<desc id="${p}-desc">${a}</desc>
|
|
361
|
+
<defs>${F(p)}</defs>
|
|
362
|
+
${s == null ? n : i`
|
|
363
|
+
<line x1=${C + T(s)} x2=${C + T(s)} y1=${4} y2=${o.length * 26 + 2}
|
|
364
|
+
stroke="var(--color-chart-emphasis)" stroke-width="1" stroke-dasharray="3 3" />
|
|
365
|
+
<text x=${C + T(s) + 6} y=${o.length * 26 + 16} class="lintje-chart__axis-label">
|
|
366
|
+
${l ?? `norm ${g(s)}`}
|
|
367
|
+
</text>
|
|
368
|
+
`}
|
|
369
|
+
${o.map((e, t) => {
|
|
370
|
+
let n = t * 26 + 4, a = s != null && e.value > s, c = T(e.value), l = v.of(h[t], e.label, `${e.label}: ${g(e.value)}${u ? ` ${u}` : ""}`);
|
|
371
|
+
return i`
|
|
372
|
+
<g class="lintje-chart__bar-row ${r.hoverIndex === t ? "is-hovered" : ""}"
|
|
373
|
+
@mousemove=${(e) => r.showTooltip(e, D(t))}
|
|
374
|
+
@mouseleave=${() => r.hideTooltip()}>
|
|
375
|
+
<!-- Hit area across the whole row, so the tooltip doesn't flicker between bars. -->
|
|
376
|
+
<rect x=${0} y=${n - 5} width=${b} height=${26} fill="transparent" />
|
|
377
|
+
<text x=${S} y=${n + 16 - 3} text-anchor="end" class="lintje-chart__axis-label">${x.fit(e.label)}</text>
|
|
378
|
+
<rect class="lintje-chart__bar lintje-chart__bar--horizontal lintje-chart__mark ${l.state}"
|
|
379
|
+
${_(B(t, o.length))}
|
|
380
|
+
x=${C} y=${n} width=${Math.max(0, c)} height=${16}
|
|
381
|
+
fill=${a ? f : d}
|
|
382
|
+
data-mark-id=${l.markId} role=${l.role} tabindex=${l.tabIndex}
|
|
383
|
+
aria-pressed=${l.pressed} aria-label=${l.label}
|
|
384
|
+
@click=${l.click} @keydown=${l.keydown} />
|
|
385
|
+
<text x=${C + c + 6} y=${n + 16 - 3} font-weight="700"
|
|
386
|
+
class="lintje-chart__data-label ${s == null ? "" : "lintje-chart__data-label--halo"}">
|
|
387
|
+
${g(e.value)}${u ? ` ${u}` : ""}
|
|
388
|
+
</text>
|
|
389
|
+
</g>
|
|
390
|
+
`;
|
|
391
|
+
})}
|
|
392
|
+
</svg>
|
|
393
|
+
${H(r)}
|
|
394
|
+
${X(r)}
|
|
395
|
+
</figure>
|
|
396
|
+
`;
|
|
397
|
+
}
|
|
398
|
+
//#endregion
|
|
399
|
+
//#region src/components/shared/charts/target-progress-chart/target-progress-chart.ts
|
|
400
|
+
function fe(e, t) {
|
|
401
|
+
let { controller: n, description: r } = t, { rows: a, target: o = 100 } = e, l = n.id, u = ue(a.length);
|
|
402
|
+
n.measure({
|
|
403
|
+
width: !0,
|
|
404
|
+
height: u
|
|
405
|
+
});
|
|
406
|
+
let d = n.width, f = W(a.map((e) => e.label), d, { fontFamily: n.fontFamily }), { labelEnd: p, barStart: h } = f, g = (e) => Math.max(40, d - h - 70) * e / 110, v = h + g(o), y = (e) => e >= o ? "var(--color-chart-green)" : "var(--color-attention)", b = (e) => ({
|
|
407
|
+
title: a[e].label,
|
|
408
|
+
rows: [{
|
|
409
|
+
label: "Voortgang",
|
|
410
|
+
value: s(a[e].value),
|
|
411
|
+
color: y(a[e].value)
|
|
412
|
+
}, {
|
|
413
|
+
label: "Doel",
|
|
414
|
+
value: s(o),
|
|
415
|
+
color: "var(--color-chart-emphasis)"
|
|
416
|
+
}]
|
|
417
|
+
}), x = Y(n, a.length, (e) => ({
|
|
418
|
+
x: h + g(a[e].value),
|
|
419
|
+
y: e * 26 + 4,
|
|
420
|
+
content: b(e)
|
|
421
|
+
}));
|
|
422
|
+
return m`
|
|
423
|
+
<figure class="lintje-chart lintje-chart--rows" ${c(n.attach)} ?data-in-view=${n.inView}
|
|
424
|
+
data-tooltip-anchor @keydown=${(e) => n.dismiss(e)}>
|
|
425
|
+
<svg viewBox="0 0 ${d} ${u}" class="lintje-chart__svg" role="img"
|
|
426
|
+
aria-labelledby="${l}-desc" width=${d} height=${u} ${_({ height: `${u}px` })}
|
|
427
|
+
tabindex="0" @keydown=${x.keydown} @focus=${x.focus} @blur=${x.blur}>
|
|
428
|
+
<desc id="${l}-desc">${r}</desc>
|
|
429
|
+
${a.map((e, t) => {
|
|
430
|
+
let r = t * 26 + 4, c = g(e.value), l = y(e.value), u = h + c + 46 > d, m = e.value >= o ? "lintje-chart__data-label--inside" : "lintje-chart__data-label--inside-light";
|
|
431
|
+
return i`
|
|
432
|
+
<g class="lintje-chart__bar-row ${n.hoverIndex === t ? "is-hovered" : ""}"
|
|
433
|
+
@mousemove=${(e) => n.showTooltip(e, b(t))}
|
|
434
|
+
@mouseleave=${() => n.hideTooltip()}>
|
|
435
|
+
<rect x=${0} y=${r - 5} width=${d} height=${26} fill="transparent" />
|
|
436
|
+
<text x=${p} y=${r + 16 - 3} text-anchor="end" class="lintje-chart__axis-label">${f.fit(e.label)}</text>
|
|
437
|
+
<rect class="lintje-chart__bar lintje-chart__bar--horizontal" ${_(B(t, a.length))}
|
|
438
|
+
x=${h} y=${r} width=${Math.max(0, c)} height=${16} fill=${l} />
|
|
439
|
+
<text x=${u ? h + c - 6 : h + c + 6} y=${r + 16 - 3}
|
|
440
|
+
text-anchor=${u ? "end" : "start"}
|
|
441
|
+
class="lintje-chart__data-label ${u ? m : ""}" font-weight="700">${s(e.value)}</text>
|
|
442
|
+
</g>
|
|
443
|
+
`;
|
|
444
|
+
})}
|
|
445
|
+
<line x1=${v} x2=${v} y1=${0} y2=${a.length * 26 + 2}
|
|
446
|
+
stroke="var(--color-chart-emphasis)" stroke-width="1" stroke-dasharray="3 3" />
|
|
447
|
+
<text x=${v + 6} y=${a.length * 26 + 16} class="lintje-chart__axis-label">norm ${o}</text>
|
|
448
|
+
</svg>
|
|
449
|
+
${H(n)}
|
|
450
|
+
${X(n)}
|
|
451
|
+
</figure>
|
|
452
|
+
`;
|
|
453
|
+
}
|
|
454
|
+
//#endregion
|
|
455
|
+
//#region src/components/shared/charts/grouped-bar-chart/grouped-bar-chart.ts
|
|
456
|
+
function pe(e, t) {
|
|
457
|
+
let { controller: r, description: a } = t, { labels: o, axisTitle: s, small: u = !1 } = e, d = r.id;
|
|
458
|
+
r.measure({
|
|
459
|
+
width: !0,
|
|
460
|
+
height: t.height ?? (u ? "--chart-h-small" : "--chart-h-main"),
|
|
461
|
+
fit: !!t.expanded && !t.mobile
|
|
462
|
+
});
|
|
463
|
+
let p = e.series.map((e) => ({
|
|
464
|
+
...e,
|
|
465
|
+
color: I(e.color)
|
|
466
|
+
})), h = p.filter((e) => !r.hiddenSeries.includes(e.label)), v = Q(t, h.flatMap((e) => e.links ?? [])), { max: y, ticks: b } = G(Math.max(...h.flatMap((e) => e.values), 1)), x = P(b, r.width, { fontFamily: r.fontFamily }), S = K(t, { left: x.width }), C = S.height - S.bottom, w = A(0, o.length, S).width / Math.max(1, h.length), T = h.every((e) => e.values.every((e) => l(f(e, w), w - 2))), E = p.map((e, t) => ({
|
|
467
|
+
label: e.label,
|
|
468
|
+
color: e.color ?? (t === 0 ? "var(--color-chart-default)" : "var(--color-chart-secondary)"),
|
|
469
|
+
shape: "square",
|
|
470
|
+
hidden: r.hiddenSeries.includes(e.label)
|
|
471
|
+
})), D = (e, t) => E[p.indexOf(e)]?.color ?? ce[t], O = (e) => ({
|
|
472
|
+
title: o[e],
|
|
473
|
+
rows: h.map((t, n) => ({
|
|
474
|
+
label: t.label,
|
|
475
|
+
value: g(t.values[e]),
|
|
476
|
+
color: D(t, n)
|
|
477
|
+
}))
|
|
478
|
+
}), j = Y(r, o.length, (e) => ({
|
|
479
|
+
x: A(e, o.length, S).center,
|
|
480
|
+
y: k(Math.max(0, ...h.map((t) => t.values[e])), y, S),
|
|
481
|
+
content: O(e)
|
|
482
|
+
})), M = o.map((e, t) => {
|
|
483
|
+
let a = A(t, o.length, S);
|
|
484
|
+
return i`
|
|
485
|
+
<g class="lintje-chart__bar-group ${r.hoverIndex === t ? "is-hovered" : ""}"
|
|
486
|
+
${_(B(t, o.length))}
|
|
487
|
+
@mousemove=${(e) => r.showTooltip(e, O(t))}
|
|
488
|
+
@mouseleave=${() => r.hideTooltip()}>
|
|
489
|
+
${h.map((r, o) => {
|
|
490
|
+
let s = r.values[t], c = k(s, y, S), l = D(r, o), u = v.of(r.links?.[t], `${e} · ${r.label}`, `${e}, ${r.label}: ${g(s)}`);
|
|
491
|
+
return i`
|
|
492
|
+
<g>
|
|
493
|
+
<rect class="lintje-chart__bar lintje-chart__mark ${u.state}"
|
|
494
|
+
x=${a.x + o * w} y=${c} width=${w - 2}
|
|
495
|
+
height=${Math.max(0, C - c)} fill=${l}
|
|
496
|
+
data-mark-id=${u.markId} role=${u.role} tabindex=${u.tabIndex}
|
|
497
|
+
aria-pressed=${u.pressed} aria-label=${u.label}
|
|
498
|
+
@click=${u.click} @keydown=${u.keydown} />
|
|
499
|
+
${T ? i`<text x=${a.x + o * w + (w - 2) / 2} y=${c - 4}
|
|
500
|
+
text-anchor="middle" class="lintje-chart__data-label">${f(s, w)}</text>` : n}
|
|
501
|
+
</g>
|
|
502
|
+
`;
|
|
503
|
+
})}
|
|
504
|
+
</g>
|
|
505
|
+
`;
|
|
506
|
+
});
|
|
507
|
+
return m`
|
|
508
|
+
<div class="lintje-chart-wrap ${u ? "lintje-chart--small" : ""}"
|
|
509
|
+
${c(r.attach)} ?data-in-view=${r.inView} data-tooltip-anchor
|
|
510
|
+
@keydown=${(e) => r.dismiss(e) || v.escape(e)}>
|
|
511
|
+
${ee({
|
|
512
|
+
items: E,
|
|
513
|
+
onToggle: (e) => r.toggleSeries(e)
|
|
514
|
+
})}
|
|
515
|
+
${ne({
|
|
516
|
+
fontFamily: r.fontFamily,
|
|
517
|
+
id: d,
|
|
518
|
+
ticks: b,
|
|
519
|
+
max: y,
|
|
520
|
+
area: S,
|
|
521
|
+
axisTitle: s,
|
|
522
|
+
description: a,
|
|
523
|
+
formatTick: x.format,
|
|
524
|
+
xLabels: o.map((e, t) => ({
|
|
525
|
+
label: e,
|
|
526
|
+
x: A(t, o.length, S).center
|
|
527
|
+
})),
|
|
528
|
+
interactive: v.interactive,
|
|
529
|
+
keys: j
|
|
530
|
+
}, M)}
|
|
531
|
+
${H(r)}
|
|
532
|
+
${X(r)}
|
|
533
|
+
</div>
|
|
534
|
+
`;
|
|
535
|
+
}
|
|
536
|
+
//#endregion
|
|
537
|
+
//#region src/components/shared/charts/shared/tints.ts
|
|
538
|
+
var $ = [
|
|
539
|
+
[1],
|
|
540
|
+
[1, 4],
|
|
541
|
+
[
|
|
542
|
+
1,
|
|
543
|
+
2,
|
|
544
|
+
4
|
|
545
|
+
],
|
|
546
|
+
[
|
|
547
|
+
1,
|
|
548
|
+
2,
|
|
549
|
+
3,
|
|
550
|
+
4
|
|
551
|
+
],
|
|
552
|
+
[
|
|
553
|
+
1,
|
|
554
|
+
2,
|
|
555
|
+
3,
|
|
556
|
+
4,
|
|
557
|
+
5
|
|
558
|
+
]
|
|
559
|
+
];
|
|
560
|
+
function me(e, t) {
|
|
561
|
+
if (e < 1) return [];
|
|
562
|
+
let n = $[Math.min(e, $.length) - 1];
|
|
563
|
+
return h(t) ? n.map((e) => e === 1 ? `var(--color-chart-${t})` : `var(--color-chart-${t}-tint-${e})`) : n.map((e) => `var(--color-chart-tint-${e})`);
|
|
564
|
+
}
|
|
565
|
+
//#endregion
|
|
566
|
+
//#region src/components/shared/charts/stacked-bar-chart/stacked-bar-chart.ts
|
|
567
|
+
var he = /* @__PURE__ */ new Set([
|
|
568
|
+
"sky-blue",
|
|
569
|
+
"red",
|
|
570
|
+
"green",
|
|
571
|
+
"violet",
|
|
572
|
+
"dark-green",
|
|
573
|
+
"purple",
|
|
574
|
+
"ruby-red",
|
|
575
|
+
"dark-brown",
|
|
576
|
+
"brown",
|
|
577
|
+
"dark-blue",
|
|
578
|
+
"moss-green"
|
|
579
|
+
]);
|
|
580
|
+
function ge(e, t) {
|
|
581
|
+
let { controller: r, description: a } = t, { labels: o, axisTitle: u, normalized: d = !1, totalOnTop: p = !0, small: h = !1 } = e, v = r.id;
|
|
582
|
+
r.measure({
|
|
583
|
+
width: !0,
|
|
584
|
+
height: t.height ?? (h ? "--chart-h-small" : "--chart-h-main"),
|
|
585
|
+
fit: !!t.expanded && !t.mobile
|
|
586
|
+
});
|
|
587
|
+
let y = e.series.map((e) => ({
|
|
588
|
+
...e,
|
|
589
|
+
color: I(e.color)
|
|
590
|
+
})), b = Q(t, y.flatMap((e) => e.links ?? [])), x = o.map((e, t) => y.reduce((e, n) => e + n.values[t], 0)), { max: S, ticks: C } = d ? {
|
|
591
|
+
max: 100,
|
|
592
|
+
ticks: [
|
|
593
|
+
0,
|
|
594
|
+
25,
|
|
595
|
+
50,
|
|
596
|
+
75,
|
|
597
|
+
100
|
|
598
|
+
]
|
|
599
|
+
} : G(Math.max(...x, 1)), w = P(C, r.width, { fontFamily: r.fontFamily }), T = K(t, { left: w.width }), E = T.height - T.bottom, { width: D, bandWidth: O } = A(0, o.length, T), j = p && !d && x.every((e) => l(f(e, O), O - 4)), M = me(y.length), N = (e, t) => e.color ?? M[Math.min(t, M.length - 1)], F = (t) => {
|
|
600
|
+
let n = e.series[t].color;
|
|
601
|
+
return (n == null ? t === 0 : he.has(n)) ? "lintje-chart__data-label--inside" : "lintje-chart__data-label--inside-light";
|
|
602
|
+
}, L = (e) => ({
|
|
603
|
+
title: o[e],
|
|
604
|
+
rows: y.map((t, n) => ({
|
|
605
|
+
label: t.label,
|
|
606
|
+
value: d ? s(t.values[e] / x[e] * 100) : g(t.values[e]),
|
|
607
|
+
color: N(t, n)
|
|
608
|
+
}))
|
|
609
|
+
}), R = Y(r, o.length, (e) => ({
|
|
610
|
+
x: A(e, o.length, T).center,
|
|
611
|
+
y: k(d ? S : x[e], S, T),
|
|
612
|
+
content: L(e)
|
|
613
|
+
})), z = y.map((e, t) => ({
|
|
614
|
+
label: e.label,
|
|
615
|
+
color: N(e, t),
|
|
616
|
+
shape: "square"
|
|
617
|
+
})), V = o.map((e, t) => {
|
|
618
|
+
let a = A(t, o.length, T), c = 0, u = y.map((e, n) => {
|
|
619
|
+
let r = e.values[t], i = d ? r / x[t] * 100 : r, a = k(c, S, T);
|
|
620
|
+
c += i;
|
|
621
|
+
let o = k(c, S, T);
|
|
622
|
+
return {
|
|
623
|
+
row: e,
|
|
624
|
+
j: n,
|
|
625
|
+
value: i,
|
|
626
|
+
y1: o,
|
|
627
|
+
height: Math.max(0, a - o)
|
|
628
|
+
};
|
|
629
|
+
});
|
|
630
|
+
return i`
|
|
631
|
+
<g class="lintje-chart__bar-group ${r.hoverIndex === t ? "is-hovered" : ""}"
|
|
632
|
+
${_(B(t, o.length))}
|
|
633
|
+
@mousemove=${(e) => r.showTooltip(e, L(t))}
|
|
634
|
+
@mouseleave=${() => r.hideTooltip()}>
|
|
635
|
+
<!-- The hit area under the whole column, so the tooltip also follows the empty
|
|
636
|
+
space above the stack. It lies *under* the segments: on top it swallowed
|
|
637
|
+
every click on a segment that drills. -->
|
|
638
|
+
<rect x=${a.x} y=${T.top} width=${a.width} height=${E - T.top} fill="transparent" />
|
|
639
|
+
<!-- The segments in one group, so the column lifts on hover as a whole. -->
|
|
640
|
+
<g class="lintje-chart__bar">
|
|
641
|
+
${u.map((n) => {
|
|
642
|
+
let r = b.of(n.row.links?.[t], `${e} · ${n.row.label}`, `${e}, ${n.row.label}: ${g(n.row.values[t])}`);
|
|
643
|
+
return i`
|
|
644
|
+
<rect class="lintje-chart__mark lintje-chart__segment ${r.state}"
|
|
645
|
+
x=${a.x} y=${n.y1} width=${a.width} height=${n.height}
|
|
646
|
+
fill=${N(n.row, n.j)}
|
|
647
|
+
data-mark-id=${r.markId} role=${r.role} tabindex=${r.tabIndex}
|
|
648
|
+
aria-pressed=${r.pressed} aria-label=${r.label}
|
|
649
|
+
@click=${r.click} @keydown=${r.keydown} />
|
|
650
|
+
`;
|
|
651
|
+
})}
|
|
652
|
+
</g>
|
|
653
|
+
<!-- Percentages inside the segments when they are >= 16 px tall and fit the width. -->
|
|
654
|
+
${d ? u.map((e) => e.height >= 16 && l(s(e.value), D - 4) ? i`<text x=${a.center} y=${e.y1 + e.height / 2 + 4} text-anchor="middle"
|
|
655
|
+
class="lintje-chart__data-label ${F(e.j)}">${s(e.value)}</text>` : n) : n}
|
|
656
|
+
${j ? i`<text x=${a.center} y=${k(x[t], S, T) - 5} text-anchor="middle"
|
|
657
|
+
class="lintje-chart__data-label" font-weight="700">${f(x[t], a.bandWidth)}</text>` : n}
|
|
658
|
+
</g>
|
|
659
|
+
`;
|
|
660
|
+
});
|
|
661
|
+
return m`
|
|
662
|
+
<div class="lintje-chart-wrap ${h ? "lintje-chart--small" : ""}"
|
|
663
|
+
${c(r.attach)} ?data-in-view=${r.inView} data-tooltip-anchor
|
|
664
|
+
@keydown=${(e) => r.dismiss(e) || b.escape(e)}>
|
|
665
|
+
${ee({ items: z })}
|
|
666
|
+
${ne({
|
|
667
|
+
fontFamily: r.fontFamily,
|
|
668
|
+
id: v,
|
|
669
|
+
ticks: C,
|
|
670
|
+
max: S,
|
|
671
|
+
area: T,
|
|
672
|
+
axisTitle: u,
|
|
673
|
+
description: a,
|
|
674
|
+
formatTick: w.format,
|
|
675
|
+
xLabels: o.map((e, t) => ({
|
|
676
|
+
label: e,
|
|
677
|
+
x: A(t, o.length, T).center
|
|
678
|
+
})),
|
|
679
|
+
interactive: b.interactive,
|
|
680
|
+
keys: R
|
|
681
|
+
}, V)}
|
|
682
|
+
${H(r)}
|
|
683
|
+
${X(r)}
|
|
684
|
+
</div>
|
|
685
|
+
`;
|
|
686
|
+
}
|
|
687
|
+
//#endregion
|
|
688
|
+
//#region src/components/shared/charts/pie-chart/pie-chart.ts
|
|
689
|
+
var _e = 5, ve = (e) => {
|
|
690
|
+
let t = e.label.toLowerCase();
|
|
691
|
+
return t.startsWith("overig") || t === "rest";
|
|
692
|
+
}, ye = (e) => !e.remainder && !ve(e);
|
|
693
|
+
function be(e) {
|
|
694
|
+
let t = e.filter(ye).sort((e, t) => t.value - e.value), n = e.filter((e) => !e.remainder && ve(e)), r = e.filter((e) => e.remainder);
|
|
695
|
+
if (t.length > _e) {
|
|
696
|
+
let e = t.splice(4).reduce((e, t) => e + t.value, 0);
|
|
697
|
+
if (n.length > 0) {
|
|
698
|
+
let [t] = n;
|
|
699
|
+
n[0] = {
|
|
700
|
+
label: t.label,
|
|
701
|
+
value: t.value + e,
|
|
702
|
+
color: t.color
|
|
703
|
+
};
|
|
704
|
+
} else n.push({
|
|
705
|
+
label: "Overig",
|
|
706
|
+
value: e
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
return [
|
|
710
|
+
...t,
|
|
711
|
+
...n,
|
|
712
|
+
...r
|
|
713
|
+
];
|
|
714
|
+
}
|
|
715
|
+
function xe(e, t) {
|
|
716
|
+
let { controller: r, description: a } = t, { donut: o = !1, centerValue: l, centerLabel: u, legendTable: d = !0, labelHeader: f = "Categorie" } = e, p = r.id, h = be(e.segments).map((e) => ({
|
|
717
|
+
...e,
|
|
718
|
+
color: I(e.color)
|
|
719
|
+
})), v = h.map((e) => e.href ? {
|
|
720
|
+
id: e.id ?? e.label,
|
|
721
|
+
href: e.href
|
|
722
|
+
} : null), y = Q(t, v), b = (e) => {
|
|
723
|
+
let t = y.of(v[e], h[e].label, h[e].label).state;
|
|
724
|
+
return t.includes("is-selected") ? "is-selected" : t.includes("is-muted") ? "is-muted" : "";
|
|
725
|
+
}, x = !!t.expanded;
|
|
726
|
+
r.measure(x ? {
|
|
727
|
+
width: !0,
|
|
728
|
+
height: "--chart-h-main"
|
|
729
|
+
} : {});
|
|
730
|
+
let S = x ? Math.max(240, Math.min(560, r.height - 24)) : e.size ?? 200, C = h.reduce((e, t) => e + t.value, 0), w = S / 2, T = o ? w * .62 : 0, E = me(h.filter(ye).length, e.color), D = -1, O = h.map((e) => (ye(e) && (D += 1), e.color ?? (e.remainder ? "var(--color-chart-remainder)" : ve(e) ? "var(--color-chart-other)" : E[Math.min(D, E.length - 1)]))), k = -90, A = h.map((e, t) => {
|
|
731
|
+
let n = e.value / C, r = k, i = k + n * 360;
|
|
732
|
+
k = i;
|
|
733
|
+
let a = +(n > .5), s = (e, t) => [w + t * Math.cos(e * Math.PI / 180), w + t * Math.sin(e * Math.PI / 180)], [c, l] = s(r, w), [u, d] = s(i, w);
|
|
734
|
+
return {
|
|
735
|
+
segment: e,
|
|
736
|
+
i: t,
|
|
737
|
+
d: o ? (() => {
|
|
738
|
+
let [e, t] = s(i, T), [n, o] = s(r, T);
|
|
739
|
+
return `M ${c} ${l} A ${w} ${w} 0 ${a} 1 ${u} ${d} L ${e} ${t} A ${T} ${T} 0 ${a} 0 ${n} ${o} Z`;
|
|
740
|
+
})() : `M ${w} ${w} L ${c} ${l} A ${w} ${w} 0 ${a} 1 ${u} ${d} Z`,
|
|
741
|
+
color: O[t]
|
|
742
|
+
};
|
|
743
|
+
}), j = r.hoverSegment, M = j == null ? void 0 : A[j], P = (e) => {
|
|
744
|
+
r.hoverSegment = e, r.requestUpdate();
|
|
745
|
+
};
|
|
746
|
+
return m`
|
|
747
|
+
<div class="lintje-pie-chart ${x ? "lintje-pie-chart--expanded" : ""}" ${c(r.attach)}
|
|
748
|
+
?data-in-view=${r.inView} data-tooltip-anchor
|
|
749
|
+
@keydown=${(e) => r.dismiss(e) || y.escape(e)}>
|
|
750
|
+
<svg viewBox="0 0 ${S} ${S}" width=${S} height=${S} role=${z(y.interactive)}
|
|
751
|
+
class="lintje-pie-chart__svg" aria-labelledby="${p}-desc" ${_(N(p))}>
|
|
752
|
+
<desc id="${p}-desc">${a}</desc>
|
|
753
|
+
<defs>${F(p)}</defs>
|
|
754
|
+
${A.map(({ segment: e, i: t, d: n, color: a }) => {
|
|
755
|
+
let o = y.of(v[t], e.label, `${e.label}: ${g(e.value)} · ${s(e.value / C * 100)}`);
|
|
756
|
+
return i`
|
|
757
|
+
<path d=${n} fill=${a}
|
|
758
|
+
class="lintje-pie-chart__segment lintje-chart__mark lintje-chart__segment ${j === t ? "is-hovered" : ""} ${o.state}"
|
|
759
|
+
${_({ "transform-origin": `${w}px ${w}px` })}
|
|
760
|
+
data-mark-id=${o.markId} role=${o.role} tabindex=${o.tabIndex}
|
|
761
|
+
aria-pressed=${o.pressed} aria-label=${o.label}
|
|
762
|
+
@click=${o.click} @keydown=${o.keydown}
|
|
763
|
+
@mousemove=${(n) => {
|
|
764
|
+
P(t), r.showTooltip(n, {
|
|
765
|
+
title: e.label,
|
|
766
|
+
rows: [{
|
|
767
|
+
label: "Aantal",
|
|
768
|
+
value: `${g(e.value)} · ${s(e.value / C * 100)}`,
|
|
769
|
+
color: a
|
|
770
|
+
}]
|
|
771
|
+
});
|
|
772
|
+
}}
|
|
773
|
+
@mouseleave=${() => {
|
|
774
|
+
r.hoverSegment = null, r.hideTooltip(), r.requestUpdate();
|
|
775
|
+
}} />
|
|
776
|
+
`;
|
|
777
|
+
})}
|
|
778
|
+
<!-- The hovered segment once more on top, lifted with a light shadow: in place, the
|
|
779
|
+
next segment would cover that shadow on one side (user test 13 Sep). -->
|
|
780
|
+
${M ? i`<path d=${M.d} fill=${M.color} class="lintje-pie-chart__lift lintje-chart__segment"
|
|
781
|
+
${_({ "transform-origin": `${w}px ${w}px` })} aria-hidden="true" />` : n}
|
|
782
|
+
${o && l ? i`
|
|
783
|
+
<text x=${w} y=${w + 2} text-anchor="middle" class="lintje-pie-chart__center">${l}</text>
|
|
784
|
+
${u ? i`<text x=${w} y=${w + 20} text-anchor="middle" class="lintje-chart__axis-label">${u}</text>` : n}
|
|
785
|
+
` : n}
|
|
786
|
+
</svg>
|
|
787
|
+
|
|
788
|
+
${d ? m`
|
|
789
|
+
<table class="lintje-pie-chart__table">
|
|
790
|
+
<caption class="visually-hidden">Legenda: ${a}</caption>
|
|
791
|
+
<thead>
|
|
792
|
+
<tr>
|
|
793
|
+
<th scope="col" class="lintje-pie-chart__column-label">${f}</th>
|
|
794
|
+
<th scope="col" class="lintje-pie-chart__column-label lintje-pie-chart__column-label--numeric">aantal</th>
|
|
795
|
+
<th scope="col" class="lintje-pie-chart__column-label lintje-pie-chart__column-label--numeric">%</th>
|
|
796
|
+
</tr>
|
|
797
|
+
</thead>
|
|
798
|
+
<tbody>
|
|
799
|
+
${h.map((e, t) => m`
|
|
800
|
+
<tr class="lintje-pie-chart__row ${j === t ? "is-hovered" : ""} ${b(t)}"
|
|
801
|
+
@mouseenter=${() => P(t)} @mouseleave=${() => P(null)}>
|
|
802
|
+
<th scope="row" class="lintje-pie-chart__label">
|
|
803
|
+
<span class="lintje-pie-chart__marker" ${_({ background: O[t] })}></span>${e.label}
|
|
804
|
+
</th>
|
|
805
|
+
<td class="lintje-pie-chart__value">${g(e.value)}</td>
|
|
806
|
+
<td class="lintje-pie-chart__value">${s(e.value / C * 100)}</td>
|
|
807
|
+
</tr>
|
|
808
|
+
`)}
|
|
809
|
+
</tbody>
|
|
810
|
+
<tfoot>
|
|
811
|
+
<tr>
|
|
812
|
+
<th scope="row" class="lintje-pie-chart__total-label">Totaal</th>
|
|
813
|
+
<td class="lintje-pie-chart__total">${g(C)}</td>
|
|
814
|
+
<td class="lintje-pie-chart__total"></td>
|
|
815
|
+
</tr>
|
|
816
|
+
</tfoot>
|
|
817
|
+
</table>
|
|
818
|
+
` : n}
|
|
819
|
+
${H(r)}
|
|
820
|
+
</div>
|
|
821
|
+
`;
|
|
822
|
+
}
|
|
823
|
+
//#endregion
|
|
824
|
+
//#region src/components/shared/charts/dual-axis-chart/dual-axis-chart.ts
|
|
825
|
+
function Se(e, t) {
|
|
826
|
+
let { controller: r, description: a } = t, { labels: o, threshold: s, thresholdLabel: l, small: u = !1, pendingHours: d = 0 } = e, f = {
|
|
827
|
+
...e.left,
|
|
828
|
+
color: I(e.left.color)
|
|
829
|
+
}, p = {
|
|
830
|
+
...e.right,
|
|
831
|
+
color: I(e.right.color)
|
|
832
|
+
}, h = r.id;
|
|
833
|
+
r.measure({
|
|
834
|
+
width: !0,
|
|
835
|
+
height: t.height ?? (u ? "--chart-h-small" : "--chart-h-main"),
|
|
836
|
+
fit: !!t.expanded && !t.mobile
|
|
837
|
+
});
|
|
838
|
+
let v = f.color ?? "var(--color-chart-default)", y = p.color ?? "var(--color-chart-dark-yellow)", b = G(Math.max(...f.values.filter((e) => e != null), 1)), x = G(Math.max(...p.values.filter((e) => e != null), s ?? 0, 1)), S = P(b.ticks, r.width, { fontFamily: r.fontFamily }), C = P(x.ticks, r.width, { fontFamily: r.fontFamily }), w = K(t, {
|
|
839
|
+
left: S.width,
|
|
840
|
+
right: C.width
|
|
841
|
+
}), T = w.height - w.bottom, E = [
|
|
842
|
+
{
|
|
843
|
+
label: `${f.label} (linkeras)`,
|
|
844
|
+
color: v,
|
|
845
|
+
shape: "square"
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
label: `${p.label} (rechteras)`,
|
|
849
|
+
color: y,
|
|
850
|
+
shape: "line"
|
|
851
|
+
},
|
|
852
|
+
...s == null ? [] : [{
|
|
853
|
+
label: l ?? `Norm ${s}`,
|
|
854
|
+
color: "var(--color-chart-emphasis)",
|
|
855
|
+
shape: "dashed"
|
|
856
|
+
}]
|
|
857
|
+
], D = Math.max(1, Math.ceil(o.length / 8)), O = r.hoverIndex, j = te(y), M = [[]];
|
|
858
|
+
p.values.forEach((e, t) => {
|
|
859
|
+
e == null ? M[M.length - 1].length && M.push([]) : M[M.length - 1].push(`${A(t, o.length, w).center},${k(e, x.max, w)}`);
|
|
860
|
+
});
|
|
861
|
+
let N = (e, t) => e == null ? "geen gegevens" : `${g(e)}${t ? ` ${t}` : ""}`, F = (e) => ({
|
|
862
|
+
title: o[e],
|
|
863
|
+
rows: [{
|
|
864
|
+
label: f.label,
|
|
865
|
+
value: N(f.values[e], f.unit),
|
|
866
|
+
color: v
|
|
867
|
+
}, {
|
|
868
|
+
label: p.label,
|
|
869
|
+
value: N(p.values[e], p.unit),
|
|
870
|
+
color: y
|
|
871
|
+
}]
|
|
872
|
+
}), L = Y(r, o.length, (e) => ({
|
|
873
|
+
x: A(e, o.length, w).center,
|
|
874
|
+
y: Math.min(f.values[e] == null ? T : k(f.values[e], b.max, w), p.values[e] == null ? T : k(p.values[e], x.max, w)),
|
|
875
|
+
content: F(e)
|
|
876
|
+
}));
|
|
877
|
+
return m`
|
|
878
|
+
<div class="lintje-chart-wrap ${u ? "lintje-chart--small" : ""}"
|
|
879
|
+
${c(r.attach)} ?data-in-view=${r.inView} data-tooltip-anchor
|
|
880
|
+
@keydown=${(e) => r.dismiss(e)}>
|
|
881
|
+
${ee({ items: E })}
|
|
882
|
+
<figure class="lintje-chart">
|
|
883
|
+
<svg viewBox="0 0 ${w.width} ${w.height}" class="lintje-chart__svg" role=${z(!1)}
|
|
884
|
+
aria-labelledby="${h}-desc" width=${w.width} height=${w.height}
|
|
885
|
+
tabindex="0" @keydown=${L.keydown} @focus=${L.focus} @blur=${L.blur}>
|
|
886
|
+
<desc id="${h}-desc">${a}</desc>
|
|
887
|
+
<defs>
|
|
888
|
+
<pattern id="hatch-${h}" width="6" height="6" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
|
|
889
|
+
<line x1="0" y1="0" x2="0" y2="6" stroke="var(--color-chart-hatch)" stroke-width="2" />
|
|
890
|
+
</pattern>
|
|
891
|
+
</defs>
|
|
892
|
+
<!-- Incomplete hours at the end: hatched, never drawn as zero. -->
|
|
893
|
+
${d > 0 ? (() => {
|
|
894
|
+
let e = A(o.length - d, o.length, w);
|
|
895
|
+
return i`<rect x=${e.x - (e.bandWidth - e.width) / 2} y=${w.top}
|
|
896
|
+
width=${w.width - w.right - e.x + (e.bandWidth - e.width) / 2}
|
|
897
|
+
height=${T - w.top} fill="url(#hatch-${h})" />`;
|
|
898
|
+
})() : n}
|
|
899
|
+
|
|
900
|
+
${b.ticks.map((e) => {
|
|
901
|
+
let t = k(e, b.max, w), n = e === 0;
|
|
902
|
+
return i`
|
|
903
|
+
<g>
|
|
904
|
+
<line x1=${w.left} x2=${w.width - w.right} y1=${t} y2=${t}
|
|
905
|
+
stroke=${n ? "var(--color-chart-zero)" : "var(--color-chart-grid)"}
|
|
906
|
+
stroke-width=${n ? 1.5 : 1} />
|
|
907
|
+
<text x=${w.left - 8} y=${t + 4} text-anchor="end" class="lintje-chart__axis-label" fill=${v}>
|
|
908
|
+
${S.format(e)}
|
|
909
|
+
</text>
|
|
910
|
+
</g>
|
|
911
|
+
`;
|
|
912
|
+
})}
|
|
913
|
+
${x.ticks.map((e) => i`
|
|
914
|
+
<text x=${w.width - w.right + 8} y=${k(e, x.max, w) + 4}
|
|
915
|
+
class="lintje-chart__axis-label" fill=${"var(--color-chart-dark-yellow-text)"}>${C.format(e)}</text>
|
|
916
|
+
`)}
|
|
917
|
+
|
|
918
|
+
<!-- 2 px axis lines in the color of their series -->
|
|
919
|
+
<line x1=${w.left} x2=${w.left} y1=${w.top} y2=${T} stroke=${v} stroke-width="2" />
|
|
920
|
+
<line x1=${w.width - w.right} x2=${w.width - w.right} y1=${w.top} y2=${T}
|
|
921
|
+
stroke=${y} stroke-width="2" />
|
|
922
|
+
|
|
923
|
+
<!-- Bars grow in one after another; the hit areas below sit on top, so hover comes
|
|
924
|
+
from hoverIndex rather than :hover. -->
|
|
925
|
+
${f.values.map((e, t) => {
|
|
926
|
+
let n = A(t, o.length, w);
|
|
927
|
+
if (e == null) return i`<rect class="lintje-chart__missing" x=${n.x} y=${w.top} width=${n.width}
|
|
928
|
+
height=${Math.max(0, T - w.top)} fill="url(#hatch-${h})" />`;
|
|
929
|
+
let r = k(e, b.max, w);
|
|
930
|
+
return i`
|
|
931
|
+
<g class="lintje-chart__bar-group ${O === t ? "is-hovered" : ""}"
|
|
932
|
+
${_(B(t, o.length))}>
|
|
933
|
+
<rect class="lintje-chart__bar" x=${n.x} y=${r} width=${n.width}
|
|
934
|
+
height=${Math.max(0, T - r)} fill=${v} />
|
|
935
|
+
</g>
|
|
936
|
+
`;
|
|
937
|
+
})}
|
|
938
|
+
|
|
939
|
+
${s == null ? n : i`<line x1=${w.left} x2=${w.width - w.right}
|
|
940
|
+
y1=${k(s, x.max, w)} y2=${k(s, x.max, w)}
|
|
941
|
+
stroke="var(--color-chart-emphasis)" stroke-width="1" stroke-dasharray="4 3" />`}
|
|
942
|
+
|
|
943
|
+
<g class="lintje-chart__reveal">
|
|
944
|
+
${M.filter((e) => e.length > 0).map((e) => {
|
|
945
|
+
let t = e.join(" "), [r, a] = e[0].split(",");
|
|
946
|
+
return i`
|
|
947
|
+
${j && e.length > 1 ? i`<polyline class="lintje-chart__line lintje-chart__line--casing"
|
|
948
|
+
stroke=${j} points=${t} />` : n}
|
|
949
|
+
${e.length === 1 ? i`<circle cx=${r} cy=${a} r="2.5" fill=${y} />` : i`<polyline class="lintje-chart__line" stroke=${y} points=${t} />`}
|
|
950
|
+
`;
|
|
951
|
+
})}
|
|
952
|
+
</g>
|
|
953
|
+
|
|
954
|
+
${o.filter((e, t) => t % D === 0).map((e, t) => i`
|
|
955
|
+
<text x=${A(t * D, o.length, w).center} y=${w.height - 8}
|
|
956
|
+
text-anchor="middle" class="lintje-chart__axis-label">${e}</text>
|
|
957
|
+
`)}
|
|
958
|
+
|
|
959
|
+
<!-- Hover point on the right-axis line; no point for a missing value. -->
|
|
960
|
+
${O != null && p.values[O] != null ? i`<circle class="lintje-chart__hover-point" r="4" fill=${y}
|
|
961
|
+
cx=${A(O, o.length, w).center}
|
|
962
|
+
cy=${k(p.values[O], x.max, w)} />` : n}
|
|
963
|
+
${o.map((e, t) => {
|
|
964
|
+
let n = A(t, o.length, w);
|
|
965
|
+
return i`
|
|
966
|
+
<rect x=${n.x} y=${w.top} width=${n.bandWidth} height=${T - w.top}
|
|
967
|
+
fill="transparent"
|
|
968
|
+
@mousemove=${(e) => r.hoverAt(t, e, F(t))}
|
|
969
|
+
@mouseleave=${() => r.hoverAt(null)} />
|
|
970
|
+
`;
|
|
971
|
+
})}
|
|
972
|
+
</svg>
|
|
973
|
+
</figure>
|
|
974
|
+
${H(r)}
|
|
975
|
+
${X(r)}
|
|
976
|
+
</div>
|
|
977
|
+
`;
|
|
978
|
+
}
|
|
979
|
+
//#endregion
|
|
980
|
+
//#region src/components/shared/charts/scatter-chart/scatter-chart.ts
|
|
981
|
+
var Ce = 4.5, we = 5.5, Te = 44, Ee = 8, De = (e, t) => e.left < t.right && t.left < e.right && e.top < t.bottom && t.top < e.bottom;
|
|
982
|
+
function Oe(e, t, n, r) {
|
|
983
|
+
let i = 5.5, a = [];
|
|
984
|
+
for (let [o, s] of e.entries()) {
|
|
985
|
+
if (!t.includes(s.label)) continue;
|
|
986
|
+
let c = d(s.label, r, 700), l = s.y - 9, u = l - 12, f = l + 3, p = [{
|
|
987
|
+
anchor: "end",
|
|
988
|
+
x: s.x - Ee,
|
|
989
|
+
left: s.x - Ee - c
|
|
990
|
+
}, {
|
|
991
|
+
anchor: "start",
|
|
992
|
+
x: s.x + Ee,
|
|
993
|
+
left: s.x + Ee
|
|
994
|
+
}].map((e) => ({
|
|
995
|
+
...e,
|
|
996
|
+
right: e.left + c,
|
|
997
|
+
top: u,
|
|
998
|
+
bottom: f
|
|
999
|
+
})).find((t) => t.left >= n.left && t.right <= n.width - n.right && t.top >= 0 && a.every((e) => !De(t, e)) && e.every((e, n) => n === o || !De(t, {
|
|
1000
|
+
left: e.x - i,
|
|
1001
|
+
right: e.x + i,
|
|
1002
|
+
top: e.y - i,
|
|
1003
|
+
bottom: e.y + i
|
|
1004
|
+
})));
|
|
1005
|
+
if (!p) return [];
|
|
1006
|
+
a.push({
|
|
1007
|
+
...p,
|
|
1008
|
+
label: s.label,
|
|
1009
|
+
y: l
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
return a.map(({ label: e, x: t, y: n, anchor: r }) => ({
|
|
1013
|
+
label: e,
|
|
1014
|
+
x: t,
|
|
1015
|
+
y: n,
|
|
1016
|
+
anchor: r
|
|
1017
|
+
}));
|
|
1018
|
+
}
|
|
1019
|
+
var ke = (e) => e.charAt(0).toUpperCase() + e.slice(1), Ae = (e, t) => `${g(e)}${t ? ` ${t}` : ""}`;
|
|
1020
|
+
function je(e) {
|
|
1021
|
+
let t = new Set(e.series.map((e) => e.color).filter(L)), n = R.filter((e) => !t.has(e)), r = 0;
|
|
1022
|
+
return e.series.map((e) => {
|
|
1023
|
+
let t = L(e.color) ? e.color : n[r++ % n.length];
|
|
1024
|
+
return {
|
|
1025
|
+
color: I(e.color ?? t),
|
|
1026
|
+
symbol: t
|
|
1027
|
+
};
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1030
|
+
function Me(t, r) {
|
|
1031
|
+
let { controller: a, description: o } = r, { axisTitle: s, unit: l, xTitle: u, xUnit: d, threshold: f, thresholdLabel: h, small: v = !1 } = t, y = a.id;
|
|
1032
|
+
a.measure({
|
|
1033
|
+
width: !0,
|
|
1034
|
+
height: r.height ?? (v ? "--chart-h-small" : "--chart-h-main"),
|
|
1035
|
+
fit: !!r.expanded && !r.mobile
|
|
1036
|
+
});
|
|
1037
|
+
let b = je(t), x = t.series.map((e, t) => ({
|
|
1038
|
+
...e,
|
|
1039
|
+
...b[t]
|
|
1040
|
+
})), S = (e) => a.hiddenSeries.includes(e.label), C = x.flatMap((e, t) => e.points.map((n, r) => ({
|
|
1041
|
+
point: n,
|
|
1042
|
+
row: e,
|
|
1043
|
+
key: `${t}:${r}`
|
|
1044
|
+
})).filter((e) => e.point.x != null && e.point.y != null)).sort((e, t) => e.point.x - t.point.x || e.point.y - t.point.y), w = C.filter(({ row: e }) => !S(e)), T = new Map(w.map((e, t) => [e.key, t])), E = G(Math.max(...w.map(({ point: e }) => e.x), 1), r.mobile ? 3 : 6), D = G(Math.max(...w.map(({ point: e }) => e.y), f ?? 0, 1)), A = P(D.ticks, a.width, { fontFamily: a.fontFamily }), j = K(r, {
|
|
1045
|
+
left: A.width,
|
|
1046
|
+
bottom: Te
|
|
1047
|
+
}), N = (e) => j.left + O(j) * e / E.max, F = E.ticks.map((e, t) => ({
|
|
1048
|
+
label: g(e),
|
|
1049
|
+
x: N(e),
|
|
1050
|
+
anchor: t === E.ticks.length - 1 ? "end" : "middle"
|
|
1051
|
+
})), I = [...x.map((e) => ({
|
|
1052
|
+
label: e.label,
|
|
1053
|
+
color: e.color,
|
|
1054
|
+
shape: "point",
|
|
1055
|
+
symbol: e.symbol,
|
|
1056
|
+
hidden: S(e)
|
|
1057
|
+
})), ...f == null ? [] : [{
|
|
1058
|
+
label: h ?? "Norm",
|
|
1059
|
+
color: "var(--color-chart-emphasis)",
|
|
1060
|
+
shape: "dashed",
|
|
1061
|
+
fixed: !0
|
|
1062
|
+
}]];
|
|
1063
|
+
function L(e) {
|
|
1064
|
+
let { point: t, row: n } = w[e];
|
|
1065
|
+
return {
|
|
1066
|
+
title: t.label,
|
|
1067
|
+
rows: [
|
|
1068
|
+
{
|
|
1069
|
+
label: n.label,
|
|
1070
|
+
value: "",
|
|
1071
|
+
color: n.color,
|
|
1072
|
+
symbol: n.symbol
|
|
1073
|
+
},
|
|
1074
|
+
{
|
|
1075
|
+
label: ke(u),
|
|
1076
|
+
value: Ae(t.x, d)
|
|
1077
|
+
},
|
|
1078
|
+
{
|
|
1079
|
+
label: ke(s),
|
|
1080
|
+
value: Ae(t.y, l)
|
|
1081
|
+
}
|
|
1082
|
+
]
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
let R = (e) => ({
|
|
1086
|
+
x: N(e.x),
|
|
1087
|
+
y: k(e.y, D.max, j)
|
|
1088
|
+
}), z = (e) => R(w[e].point), V = Y(a, w.length, (e) => ({
|
|
1089
|
+
...z(e),
|
|
1090
|
+
content: L(e)
|
|
1091
|
+
})), re = w.map(({ point: e, row: t }) => e.href ? {
|
|
1092
|
+
id: e.id ?? `${t.label} · ${e.label}`,
|
|
1093
|
+
href: e.href
|
|
1094
|
+
} : null), ie = Q(r, re), U = w.map(({ point: e }, t) => ie.of(re[t], e.label, oe(L(t)))), W = Oe(w.map((e, t) => ({
|
|
1095
|
+
label: e.point.label,
|
|
1096
|
+
...z(t)
|
|
1097
|
+
})), t.dataLabels ?? [], j, a.fontFamily), q = f == null ? 0 : k(f, D.max, j), ae = a.hoverIndex == null ? void 0 : w[a.hoverIndex], J = (t) => {
|
|
1098
|
+
let n = t.target.closest?.("[data-point]");
|
|
1099
|
+
if (n) return Number(n.getAttribute("data-point"));
|
|
1100
|
+
let r = t.currentTarget, i = r.ownerSVGElement?.getBoundingClientRect(), a = i && i.width > 0 ? j.width / i.width : 1, o = (t.clientX - (i?.left ?? 0)) * a, s = (t.clientY - (i?.top ?? 0)) * a, c = e(r, "--h-target", 48) / 2, l = null, u = c;
|
|
1101
|
+
return w.forEach((e, t) => {
|
|
1102
|
+
let { x: n, y: r } = z(t), i = Math.hypot(n - o, r - s);
|
|
1103
|
+
i <= u && (l = t, u = i);
|
|
1104
|
+
}), l;
|
|
1105
|
+
}, se = (e) => {
|
|
1106
|
+
let t = J(e);
|
|
1107
|
+
t == null ? (a.hoverIndex != null || a.tooltip) && a.hoverAt(null) : a.hoverAt(t, e, L(t));
|
|
1108
|
+
}, Z = (e) => {
|
|
1109
|
+
let t = J(e), r = t == null ? null : U[t];
|
|
1110
|
+
r?.clickable && r.click !== n && r.click();
|
|
1111
|
+
}, ce = ae != null && U[a.hoverIndex]?.clickable, le = [f == null ? n : i`
|
|
1112
|
+
<g class="lintje-chart__reference">
|
|
1113
|
+
<line x1=${j.left} x2=${j.width - j.right} y1=${q} y2=${q}
|
|
1114
|
+
stroke="var(--color-chart-emphasis)" stroke-width="1" stroke-dasharray="3 3" />
|
|
1115
|
+
<text x=${j.left + 6} y=${q - 6}
|
|
1116
|
+
class="lintje-chart__axis-label lintje-chart__axis-label--halo">
|
|
1117
|
+
${h ?? `norm ${Ae(f, l)}`}
|
|
1118
|
+
</text>
|
|
1119
|
+
</g>
|
|
1120
|
+
`, i`<g @mousemove=${se} @mouseleave=${() => a.hoverAt(null)} @click=${Z}>
|
|
1121
|
+
<rect class="lintje-chart__hit ${ce ? "is-clickable" : ""}"
|
|
1122
|
+
x="0" y="0" width=${j.width} height=${j.height} />
|
|
1123
|
+
<g>
|
|
1124
|
+
${p(C, (e) => e.key, ({ point: e, row: t, key: r }, a) => {
|
|
1125
|
+
let { x: o, y: s } = R(e), c = te(t.color), l = T.get(r), u = l == null ? void 0 : U[l];
|
|
1126
|
+
return i`
|
|
1127
|
+
<path class="lintje-chart__point lintje-chart__mark ${c ? "" : "lintje-chart__segment"} ${u?.state ?? "is-hidden"}"
|
|
1128
|
+
${_(B(a, C.length))}
|
|
1129
|
+
d=${M(t.symbol, Ce, o, s)} fill=${t.color}
|
|
1130
|
+
stroke=${c ?? n} stroke-width=${c ? 1 : n}
|
|
1131
|
+
data-point=${l ?? n}
|
|
1132
|
+
data-mark-id=${u?.markId ?? n} role=${u?.role ?? n}
|
|
1133
|
+
tabindex=${u?.tabIndex ?? n}
|
|
1134
|
+
aria-pressed=${u?.pressed ?? n} aria-label=${u?.label ?? n}
|
|
1135
|
+
@keydown=${u?.keydown ?? n} />
|
|
1136
|
+
`;
|
|
1137
|
+
})}
|
|
1138
|
+
</g>
|
|
1139
|
+
|
|
1140
|
+
${W.map((e) => i`
|
|
1141
|
+
<text x=${e.x} y=${e.y} text-anchor=${e.anchor}
|
|
1142
|
+
class="lintje-chart__data-label lintje-chart__data-label--halo">${e.label}</text>
|
|
1143
|
+
`)}
|
|
1144
|
+
|
|
1145
|
+
<!-- The point under the pointer or the keyboard, raised with a ring in the surface. -->
|
|
1146
|
+
${ae ? (() => {
|
|
1147
|
+
let { x: e, y: t } = z(a.hoverIndex), r = te(ae.row.color), o = M(ae.row.symbol, we, e, t);
|
|
1148
|
+
return i`
|
|
1149
|
+
<path class="lintje-chart__hover-point" d=${o} fill=${ae.row.color} />
|
|
1150
|
+
${r ? i`<path class="lintje-chart__hover-casing" d=${o} stroke=${r} />` : n}
|
|
1151
|
+
`;
|
|
1152
|
+
})() : n}
|
|
1153
|
+
</g>`];
|
|
1154
|
+
return m`
|
|
1155
|
+
<div class="lintje-chart-wrap ${v ? "lintje-chart--small" : ""}"
|
|
1156
|
+
${c(a.attach)} ?data-in-view=${a.inView} data-tooltip-anchor
|
|
1157
|
+
@keydown=${(e) => a.dismiss(e) || ie.escape(e)}>
|
|
1158
|
+
${ee({
|
|
1159
|
+
items: I,
|
|
1160
|
+
onToggle: (e) => a.toggleSeries(e)
|
|
1161
|
+
})}
|
|
1162
|
+
${ne({
|
|
1163
|
+
fontFamily: a.fontFamily,
|
|
1164
|
+
id: y,
|
|
1165
|
+
ticks: D.ticks,
|
|
1166
|
+
max: D.max,
|
|
1167
|
+
area: j,
|
|
1168
|
+
formatTick: A.format,
|
|
1169
|
+
axisTitle: s,
|
|
1170
|
+
xLabels: F,
|
|
1171
|
+
xTitle: u,
|
|
1172
|
+
description: o,
|
|
1173
|
+
interactive: ie.interactive,
|
|
1174
|
+
keys: V
|
|
1175
|
+
}, le)}
|
|
1176
|
+
${H(a)}
|
|
1177
|
+
${X(a)}
|
|
1178
|
+
</div>
|
|
1179
|
+
`;
|
|
1180
|
+
}
|
|
1181
|
+
//#endregion
|
|
1182
|
+
//#region src/components/shared/charts/heatmap-chart/heatmap-classes.ts
|
|
1183
|
+
var Ne = [
|
|
1184
|
+
"var(--color-chart-seq-1)",
|
|
1185
|
+
"var(--color-chart-seq-2)",
|
|
1186
|
+
"var(--color-chart-seq-3)",
|
|
1187
|
+
"var(--color-chart-seq-4)",
|
|
1188
|
+
"var(--color-chart-seq-5)"
|
|
1189
|
+
], Pe = Ne.length, Fe = [
|
|
1190
|
+
1,
|
|
1191
|
+
2,
|
|
1192
|
+
2.5,
|
|
1193
|
+
5,
|
|
1194
|
+
10
|
|
1195
|
+
];
|
|
1196
|
+
function Ie(e, t) {
|
|
1197
|
+
if (!(e > 0) || !Number.isFinite(e)) return 1;
|
|
1198
|
+
let n = 10 ** Math.floor(Math.log10(e)), r = 0, i = Infinity;
|
|
1199
|
+
for (let a of Fe) {
|
|
1200
|
+
let o = a * n;
|
|
1201
|
+
if (t && !Number.isInteger(o)) continue;
|
|
1202
|
+
let s = Math.abs(Math.log(o / e));
|
|
1203
|
+
s < i && (i = s, r = o);
|
|
1204
|
+
}
|
|
1205
|
+
return r || (t ? 1 : n);
|
|
1206
|
+
}
|
|
1207
|
+
function Le(e, t) {
|
|
1208
|
+
let n = Math.max(0, Math.min(10, -Math.floor(Math.log10(t)) + 1));
|
|
1209
|
+
return Number(e.toFixed(n));
|
|
1210
|
+
}
|
|
1211
|
+
function Re(e) {
|
|
1212
|
+
let t = [];
|
|
1213
|
+
for (let n of e) for (let e of n ?? []) e != null && Number.isFinite(e) && t.push(e);
|
|
1214
|
+
if (t.length === 0) return [];
|
|
1215
|
+
let n = Math.min(...t), r = Math.max(...t);
|
|
1216
|
+
if (n === r) return [];
|
|
1217
|
+
let i = t.every(Number.isInteger), a = Ie((r - n) / Pe, i), o = Math.floor(n / a) * a, s = [];
|
|
1218
|
+
for (let e = 1; e < Pe; e += 1) {
|
|
1219
|
+
let t = Le(o + e * a, a);
|
|
1220
|
+
if (t > r) break;
|
|
1221
|
+
s.push(t);
|
|
1222
|
+
}
|
|
1223
|
+
return s;
|
|
1224
|
+
}
|
|
1225
|
+
function ze(e, t, n = 0) {
|
|
1226
|
+
let r = g(e, n), i = t?.trim() ?? "";
|
|
1227
|
+
return i ? i === "%" ? `${r}%` : `${r} ${i}` : r;
|
|
1228
|
+
}
|
|
1229
|
+
function Be(e) {
|
|
1230
|
+
let t = 0;
|
|
1231
|
+
for (let n of e) {
|
|
1232
|
+
let e = String(n), r = e.indexOf(".");
|
|
1233
|
+
r >= 0 && (t = Math.max(t, e.length - r - 1));
|
|
1234
|
+
}
|
|
1235
|
+
return Math.min(t, 4);
|
|
1236
|
+
}
|
|
1237
|
+
function Ve(e, t = {}) {
|
|
1238
|
+
let n = (t.bounds?.length ? t.bounds.slice(0, Pe - 1) : null) ?? Re(e), r = Be(n), i = (e) => ze(e, t.unit, r), a = (e) => g(e, r);
|
|
1239
|
+
if (n.length === 0) {
|
|
1240
|
+
let e = Ne.length - 1;
|
|
1241
|
+
return [{
|
|
1242
|
+
limit: Infinity,
|
|
1243
|
+
color: Ne[e],
|
|
1244
|
+
label: "alle waarden",
|
|
1245
|
+
ramp: e
|
|
1246
|
+
}];
|
|
1247
|
+
}
|
|
1248
|
+
return [
|
|
1249
|
+
{
|
|
1250
|
+
limit: n[0],
|
|
1251
|
+
color: Ne[0],
|
|
1252
|
+
label: `< ${i(n[0])}`,
|
|
1253
|
+
ramp: 0
|
|
1254
|
+
},
|
|
1255
|
+
...n.slice(1).map((e, t) => ({
|
|
1256
|
+
limit: e,
|
|
1257
|
+
color: Ne[t + 1],
|
|
1258
|
+
label: `${a(n[t])}–${i(e)}`,
|
|
1259
|
+
ramp: t + 1
|
|
1260
|
+
})),
|
|
1261
|
+
{
|
|
1262
|
+
limit: Infinity,
|
|
1263
|
+
color: Ne[n.length],
|
|
1264
|
+
label: `≥ ${i(n[n.length - 1])}`,
|
|
1265
|
+
ramp: n.length
|
|
1266
|
+
}
|
|
1267
|
+
];
|
|
1268
|
+
}
|
|
1269
|
+
function He(e, t) {
|
|
1270
|
+
let n = e.findIndex((e) => t < e.limit);
|
|
1271
|
+
return n === -1 ? e.length - 1 : n;
|
|
1272
|
+
}
|
|
1273
|
+
//#endregion
|
|
1274
|
+
//#region src/components/shared/charts/heatmap-chart/heatmap-chart.ts
|
|
1275
|
+
function Ue(e, t, n) {
|
|
1276
|
+
return Array.from({ length: n }, (n, r) => Array.from({ length: t }, (t, n) => e?.[n]?.[r]));
|
|
1277
|
+
}
|
|
1278
|
+
function We(e) {
|
|
1279
|
+
if (e.mobile) return e.mobile;
|
|
1280
|
+
let t = e.rowLabels.length, n = e.columnLabels.length;
|
|
1281
|
+
if (!(n <= t)) return {
|
|
1282
|
+
columnLabels: e.rowLabels,
|
|
1283
|
+
rowLabels: e.columnLabels,
|
|
1284
|
+
values: Ue(e.values, t, n),
|
|
1285
|
+
links: e.links ? Ue(e.links, t, n) : void 0
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
function Ge(e, t) {
|
|
1289
|
+
let { controller: r, description: i, mobile: a = !1 } = t, o = a ? We(e) : void 0, s = o?.columnLabels ?? e.columnLabels, l = o?.rowLabels ?? e.rowLabels, u = o?.values ?? e.values, d = o ? o.links : e.links, f = o ? !0 : e.compact ?? !1, { unit: p } = e, h = Q(t, (d ?? []).flat()), v = Ve(u, {
|
|
1290
|
+
bounds: e.bounds,
|
|
1291
|
+
unit: p
|
|
1292
|
+
}), y = (e) => He(v, e);
|
|
1293
|
+
r.measure({});
|
|
1294
|
+
let b = r.selectedCell, x = r.dimmedClass;
|
|
1295
|
+
return m`
|
|
1296
|
+
<div class="lintje-heatmap" ${c(r.attach)} ?data-in-view=${r.inView}
|
|
1297
|
+
data-tooltip-anchor @keydown=${h.escape}>
|
|
1298
|
+
<table class="lintje-heatmap__grid ${f ? "is-compact" : ""}">
|
|
1299
|
+
<caption class="visually-hidden">${i}</caption>
|
|
1300
|
+
<thead>
|
|
1301
|
+
<tr>
|
|
1302
|
+
<td></td>
|
|
1303
|
+
${s.map((e) => m`<th scope="col" class="lintje-heatmap__column-label">${e}</th>`)}
|
|
1304
|
+
</tr>
|
|
1305
|
+
</thead>
|
|
1306
|
+
<tbody>
|
|
1307
|
+
${l.map((e, t) => m`
|
|
1308
|
+
<tr>
|
|
1309
|
+
<th scope="row" class="lintje-heatmap__row-label" title=${e}>
|
|
1310
|
+
<span class="lintje-heatmap__row-label-text">${e}</span>
|
|
1311
|
+
</th>
|
|
1312
|
+
${s.map((n, i) => {
|
|
1313
|
+
let a = u[t]?.[i];
|
|
1314
|
+
if (a == null) return m`
|
|
1315
|
+
<td class="lintje-heatmap__slot">
|
|
1316
|
+
<div class="lintje-heatmap__cell is-empty"
|
|
1317
|
+
title="${e} · ${s[i]}: geen meting">
|
|
1318
|
+
<span class="visually-hidden">geen meting</span>
|
|
1319
|
+
</div>
|
|
1320
|
+
</td>
|
|
1321
|
+
`;
|
|
1322
|
+
let o = y(a), c = h.of(d?.[t]?.[i], `${e} · ${s[i]}`), S = !c.clickable && b?.row === t && b?.column === i;
|
|
1323
|
+
return m`
|
|
1324
|
+
<td class="lintje-heatmap__slot">
|
|
1325
|
+
<button
|
|
1326
|
+
type="button"
|
|
1327
|
+
class="lintje-heatmap__cell lintje-heatmap__cell--class-${v[o].ramp} ${S ? "is-selected" : ""} ${x != null && x !== o ? "is-dimmed" : ""} ${c.state}"
|
|
1328
|
+
data-mark-id=${c.markId}
|
|
1329
|
+
${_({
|
|
1330
|
+
"--lintje-cell": v[o].color,
|
|
1331
|
+
...re(i, t, s.length, l.length)
|
|
1332
|
+
})}
|
|
1333
|
+
@click=${c.clickable ? c.click : () => {
|
|
1334
|
+
r.selectedCell = S ? null : {
|
|
1335
|
+
row: t,
|
|
1336
|
+
column: i
|
|
1337
|
+
}, r.requestUpdate();
|
|
1338
|
+
}}
|
|
1339
|
+
@mousemove=${f ? void 0 : (t) => r.showTooltip(t, {
|
|
1340
|
+
title: `${e} · ${s[i]}`,
|
|
1341
|
+
rows: [{
|
|
1342
|
+
label: `klasse ${v[o].label}`,
|
|
1343
|
+
value: ze(a, p),
|
|
1344
|
+
color: v[o].color
|
|
1345
|
+
}]
|
|
1346
|
+
})}
|
|
1347
|
+
@mouseleave=${f ? void 0 : () => r.hideTooltip()}
|
|
1348
|
+
aria-pressed=${c.clickable ? c.pressed : S}
|
|
1349
|
+
aria-label="${e} ${s[i]}: ${ze(a, p)}, klasse ${v[o].label}"
|
|
1350
|
+
>${g(a)}</button>
|
|
1351
|
+
</td>
|
|
1352
|
+
`;
|
|
1353
|
+
})}
|
|
1354
|
+
</tr>
|
|
1355
|
+
`)}
|
|
1356
|
+
</tbody>
|
|
1357
|
+
</table>
|
|
1358
|
+
|
|
1359
|
+
<!-- Selected cell: a 48 px line with day, block, value, class. -->
|
|
1360
|
+
${b && u[b.row]?.[b.column] != null ? m`
|
|
1361
|
+
<p class="lintje-heatmap__selection">
|
|
1362
|
+
<b>${l[b.row]} ${s[b.column]}</b> ·
|
|
1363
|
+
${ze(u[b.row][b.column], p)} · klasse
|
|
1364
|
+
${v[y(u[b.row][b.column])].label}
|
|
1365
|
+
</p>
|
|
1366
|
+
` : n}
|
|
1367
|
+
|
|
1368
|
+
<!-- Class legend: clickable, dims the other classes to .25. -->
|
|
1369
|
+
<ul class="lintje-heatmap__legend">
|
|
1370
|
+
${v.map((e, t) => m`
|
|
1371
|
+
<li>
|
|
1372
|
+
<button type="button" class="lintje-heatmap__legend-item ${x != null && x !== t ? "is-dimmed" : ""}"
|
|
1373
|
+
@click=${() => {
|
|
1374
|
+
r.dimmedClass = x === t ? null : t, r.requestUpdate();
|
|
1375
|
+
}}
|
|
1376
|
+
aria-pressed=${x === t}>
|
|
1377
|
+
<span class="lintje-heatmap__swatch lintje-heatmap__swatch--class-${e.ramp}" ${_({ background: e.color })}></span>
|
|
1378
|
+
<span>${e.label}</span>
|
|
1379
|
+
</button>
|
|
1380
|
+
</li>
|
|
1381
|
+
`)}
|
|
1382
|
+
</ul>
|
|
1383
|
+
${H(r)}
|
|
1384
|
+
</div>
|
|
1385
|
+
`;
|
|
1386
|
+
}
|
|
1387
|
+
//#endregion
|
|
1388
|
+
//#region src/components/shared/charts/histogram-chart/histogram-chart.ts
|
|
1389
|
+
var Ke = 16, qe = 56, Je = 8, Ye = 18;
|
|
1390
|
+
function Xe(e) {
|
|
1391
|
+
return g(e, +!Number.isInteger(e));
|
|
1392
|
+
}
|
|
1393
|
+
function Ze(e, t) {
|
|
1394
|
+
let n = t ? ` ${t}` : "";
|
|
1395
|
+
return e.to == null ? `${Xe(e.from)}${n} of meer` : `${Xe(e.from)} tot ${Xe(e.to)}${n}`;
|
|
1396
|
+
}
|
|
1397
|
+
function Qe(e, t, n = "") {
|
|
1398
|
+
let r = t.width, i = e.map((e) => {
|
|
1399
|
+
let t = d(e.text, n, e.bold ? 700 : 400), i = e.x + 6 + t <= r;
|
|
1400
|
+
return {
|
|
1401
|
+
x: i ? e.x + 6 : e.x - 6,
|
|
1402
|
+
anchor: i ? "start" : "end",
|
|
1403
|
+
left: i ? e.x + 6 : e.x - 6 - t,
|
|
1404
|
+
right: i ? e.x + 6 + t : e.x - 6
|
|
1405
|
+
};
|
|
1406
|
+
}), a = i.length === 2 ? +(e[1].x >= e[0].x) : -1, o = i.length === 2 && i[0].left < i[1].right + Je && i[1].left < i[0].right + Je;
|
|
1407
|
+
return i.map((e, n) => ({
|
|
1408
|
+
x: e.x,
|
|
1409
|
+
y: t.top + 12 + (o && n === a ? Ye : 0),
|
|
1410
|
+
anchor: e.anchor
|
|
1411
|
+
}));
|
|
1412
|
+
}
|
|
1413
|
+
function $e(e, t) {
|
|
1414
|
+
let { controller: r, description: a } = t, { bins: o, axisTitle: l, xTitle: u, unit: f, median: p, threshold: h, small: v = !1 } = e, y = e.label ?? "Aantal", b = I(e.color) ?? "var(--color-chart-default)", x = r.id, S = (e) => f ? `${e} ${f}` : e;
|
|
1415
|
+
r.measure({
|
|
1416
|
+
width: !0,
|
|
1417
|
+
height: t.height ?? (v ? "--chart-h-small" : "--chart-h-main"),
|
|
1418
|
+
fit: !!t.expanded && !t.mobile
|
|
1419
|
+
});
|
|
1420
|
+
let C = o.map((e) => e.count).filter((e) => e != null), w = C.length === o.length ? C.reduce((e, t) => e + t, 0) : null, { max: T, ticks: E } = G(Math.max(...C, 1)), D = P(E, r.width, { fontFamily: r.fontFamily }), O = K(t), A = K(t, {
|
|
1421
|
+
left: D.width,
|
|
1422
|
+
bottom: O.bottom + (u ? Ke : 0)
|
|
1423
|
+
}), j = A.height - A.bottom, M = A.width - A.right, N = o[0]?.from ?? 0, F = o[o.length - 1], L = o.length > 1 ? o[o.length - 1].from - o[o.length - 2].from : 1, R = F ? F.to ?? F.from + L : 1, z = (e) => A.left + (e - N) / Math.max(R - N, 2 ** -52) * (M - A.left), V = o.map((e) => {
|
|
1424
|
+
let t = z(e.from), n = z(e.to ?? R) - t;
|
|
1425
|
+
return {
|
|
1426
|
+
x: t,
|
|
1427
|
+
width: n,
|
|
1428
|
+
center: t + n / 2
|
|
1429
|
+
};
|
|
1430
|
+
}), te = (e) => {
|
|
1431
|
+
let t = o[e].count;
|
|
1432
|
+
return {
|
|
1433
|
+
title: Ze(o[e], f),
|
|
1434
|
+
rows: [{
|
|
1435
|
+
label: y,
|
|
1436
|
+
value: t == null ? "geen gegevens" : g(t),
|
|
1437
|
+
color: b
|
|
1438
|
+
}, ...t != null && w != null && w > 0 ? [{
|
|
1439
|
+
label: "Aandeel",
|
|
1440
|
+
value: s(t / w * 100, 1),
|
|
1441
|
+
color: b
|
|
1442
|
+
}] : []]
|
|
1443
|
+
};
|
|
1444
|
+
}, re = Y(r, o.length, (e) => ({
|
|
1445
|
+
x: V[e].center,
|
|
1446
|
+
y: o[e].count == null ? A.top : k(o[e].count, T, A),
|
|
1447
|
+
content: te(e)
|
|
1448
|
+
})), U = F?.to == null && o.length > 0, W = [...o.slice(0, U ? -1 : void 0).map((e) => e.from), ...U ? [] : F ? [F.to] : []].map((e) => ({
|
|
1449
|
+
label: Xe(e),
|
|
1450
|
+
x: z(e)
|
|
1451
|
+
})), q = U ? {
|
|
1452
|
+
label: `${Xe(F.from)}+`,
|
|
1453
|
+
x: V[V.length - 1].center
|
|
1454
|
+
} : null, ae = W.length > 1 ? (W[W.length - 1].x - W[0].x) / (W.length - 1) : 1, oe = Math.max(1, Math.ceil(qe / ae)), J = ie(W.filter((e, t) => t % oe === 0), r.fontFamily), se = (e, t) => Math.abs(t.x - e.x) < (d(e.label, r.fontFamily) + d(t.label, r.fontFamily)) / 2 + Je, Z = U ? q : W[W.length - 1];
|
|
1455
|
+
Z && !J.includes(Z) && (J.length && se(J[J.length - 1], Z) && (J = J.slice(0, -1)), U || (J = [...J, Z]));
|
|
1456
|
+
let Q = U ? F.from : R, ce = (e) => e != null && e >= N && e <= Q, le = [...ce(p) ? [{
|
|
1457
|
+
x: z(p),
|
|
1458
|
+
text: e.medianLabel ?? S(`mediaan ${Xe(p)}`),
|
|
1459
|
+
bold: !0,
|
|
1460
|
+
dashed: !1
|
|
1461
|
+
}] : [], ...ce(h) ? [{
|
|
1462
|
+
x: z(h),
|
|
1463
|
+
text: e.thresholdLabel ?? S(`norm ${Xe(h)}`),
|
|
1464
|
+
bold: !1,
|
|
1465
|
+
dashed: !0
|
|
1466
|
+
}] : []], ue = Qe(le, A, r.fontFamily), de = (e) => e.charAt(0).toUpperCase() + e.slice(1), fe = [
|
|
1467
|
+
{
|
|
1468
|
+
label: y,
|
|
1469
|
+
color: b,
|
|
1470
|
+
shape: "square"
|
|
1471
|
+
},
|
|
1472
|
+
...ce(p) ? [{
|
|
1473
|
+
label: de(e.medianLabel ?? "Mediaan"),
|
|
1474
|
+
color: "var(--color-chart-emphasis)",
|
|
1475
|
+
shape: "line"
|
|
1476
|
+
}] : [],
|
|
1477
|
+
...ce(h) ? [{
|
|
1478
|
+
label: de(e.thresholdLabel ?? "Norm"),
|
|
1479
|
+
color: "var(--color-chart-emphasis)",
|
|
1480
|
+
shape: "dashed"
|
|
1481
|
+
}] : []
|
|
1482
|
+
], pe = (e) => {
|
|
1483
|
+
let t = V[e], n = o[e].count;
|
|
1484
|
+
if (n == null) return i`<rect class="lintje-chart__missing" x=${t.x} y=${A.top} width=${t.width}
|
|
1485
|
+
height=${Math.max(0, j - A.top)} fill="url(#hatch-${x})" />`;
|
|
1486
|
+
let r = k(n, T, A);
|
|
1487
|
+
return i`
|
|
1488
|
+
<g class="lintje-chart__bar-group" ${_(B(e, o.length))}>
|
|
1489
|
+
<rect class="lintje-chart__bar lintje-chart__segment" x=${t.x} y=${r} width=${t.width}
|
|
1490
|
+
height=${Math.max(0, j - r)} fill=${b} />
|
|
1491
|
+
</g>
|
|
1492
|
+
`;
|
|
1493
|
+
}, $ = r.hoverIndex, me = $ == null ? null : o[$]?.count, he = [
|
|
1494
|
+
o.map((e, t) => pe(t)),
|
|
1495
|
+
$ != null && me != null ? i`<rect class="lintje-chart__bar lintje-chart__bar--lifted lintje-chart__segment"
|
|
1496
|
+
x=${V[$].x} y=${k(me, T, A)} width=${V[$].width}
|
|
1497
|
+
height=${Math.max(0, j - k(me, T, A))} fill=${b} />` : n,
|
|
1498
|
+
J.map((e) => i`
|
|
1499
|
+
<line x1=${e.x} x2=${e.x} y1=${j} y2=${j + 4}
|
|
1500
|
+
stroke="var(--color-chart-zero)" stroke-width="1" />
|
|
1501
|
+
<text x=${e.x} y=${j + 20} text-anchor="middle" class="lintje-chart__axis-label">${e.label}</text>
|
|
1502
|
+
`),
|
|
1503
|
+
q ? i`<text x=${q.x} y=${j + 20} text-anchor="middle" class="lintje-chart__axis-label">${q.label}</text>` : n,
|
|
1504
|
+
le.map((e, t) => {
|
|
1505
|
+
let r = ue[t];
|
|
1506
|
+
return i`
|
|
1507
|
+
<g class="lintje-chart__reference">
|
|
1508
|
+
<line x1=${e.x} x2=${e.x} y1=${A.top} y2=${j}
|
|
1509
|
+
stroke="var(--color-chart-emphasis)" stroke-width=${e.dashed ? 1 : 1.5}
|
|
1510
|
+
stroke-dasharray=${e.dashed ? "3 3" : n} />
|
|
1511
|
+
<text x=${r.x} y=${r.y} text-anchor=${r.anchor}
|
|
1512
|
+
class=${e.bold ? "lintje-chart__data-label lintje-chart__data-label--halo" : "lintje-chart__axis-label lintje-chart__axis-label--halo"}>${e.text}</text>
|
|
1513
|
+
</g>
|
|
1514
|
+
`;
|
|
1515
|
+
}),
|
|
1516
|
+
V.map((e, t) => i`
|
|
1517
|
+
<rect x=${e.x} y=${A.top} width=${e.width} height=${Math.max(0, j - A.top)}
|
|
1518
|
+
fill="transparent"
|
|
1519
|
+
@mousemove=${(e) => r.hoverAt(t, e, te(t))}
|
|
1520
|
+
@mouseleave=${() => r.hoverAt(null)} />
|
|
1521
|
+
`)
|
|
1522
|
+
];
|
|
1523
|
+
return m`
|
|
1524
|
+
<div class="lintje-chart-wrap ${v ? "lintje-chart--small" : ""}"
|
|
1525
|
+
${c(r.attach)} ?data-in-view=${r.inView} data-tooltip-anchor
|
|
1526
|
+
@keydown=${(e) => r.dismiss(e)}>
|
|
1527
|
+
${ee({ items: fe })}
|
|
1528
|
+
${ne({
|
|
1529
|
+
fontFamily: r.fontFamily,
|
|
1530
|
+
id: x,
|
|
1531
|
+
ticks: E,
|
|
1532
|
+
max: T,
|
|
1533
|
+
area: A,
|
|
1534
|
+
axisTitle: l,
|
|
1535
|
+
xTitle: u,
|
|
1536
|
+
description: a,
|
|
1537
|
+
formatTick: D.format,
|
|
1538
|
+
keys: re
|
|
1539
|
+
}, he)}
|
|
1540
|
+
${H(r)}
|
|
1541
|
+
${X(r)}
|
|
1542
|
+
</div>
|
|
1543
|
+
`;
|
|
1544
|
+
}
|
|
1545
|
+
//#endregion
|
|
1546
|
+
//#region src/components/shared/charts/shared/render-chart.ts
|
|
1547
|
+
function et(e, t) {
|
|
1548
|
+
switch (e.kind) {
|
|
1549
|
+
case "line": return se(e, t);
|
|
1550
|
+
case "bar": return le(e, t);
|
|
1551
|
+
case "horizontal-bar": return de(e, t);
|
|
1552
|
+
case "target-progress": return fe(e, t);
|
|
1553
|
+
case "grouped-bar": return pe(e, t);
|
|
1554
|
+
case "stacked-bar": return ge(e, t);
|
|
1555
|
+
case "pie": return xe(e, t);
|
|
1556
|
+
case "dual-axis": return Se(e, t);
|
|
1557
|
+
case "scatter": return Me(e, t);
|
|
1558
|
+
case "heatmap": return Ge(e, t);
|
|
1559
|
+
case "histogram": return $e(e, t);
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
//#endregion
|
|
1563
|
+
//#region src/components/charts/chart/chart.css?inline
|
|
1564
|
+
var tt = "/* ------------------------------------------------------------------------ */\n\n.lintje-chart__view { flex: none; }\n\n/* Below 768 px it is a row of its own at the touch height. */\n@media (max-width: 767px) {\n .lintje-chart__view { --h-control: var(--h-touch); width: 100%; }\n}\n", nt = ".lintje-chart__svg, .lintje-pie-chart__svg", rt = [{
|
|
1565
|
+
value: "chart",
|
|
1566
|
+
label: "Grafiek"
|
|
1567
|
+
}, {
|
|
1568
|
+
value: "table",
|
|
1569
|
+
label: "Tabel"
|
|
1570
|
+
}];
|
|
1571
|
+
function it(e) {
|
|
1572
|
+
return (e ?? "").normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "grafiek";
|
|
1573
|
+
}
|
|
1574
|
+
function at(e) {
|
|
1575
|
+
switch (e.kind) {
|
|
1576
|
+
case "line":
|
|
1577
|
+
case "dual-axis":
|
|
1578
|
+
case "scatter": return "line";
|
|
1579
|
+
case "pie": return e.donut ? "donut" : "pie";
|
|
1580
|
+
case "heatmap": return "heatmap";
|
|
1581
|
+
default: return "bar";
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
function ot(e) {
|
|
1585
|
+
switch (e.kind) {
|
|
1586
|
+
case "horizontal-bar":
|
|
1587
|
+
case "target-progress": return e.rows.length ? `${ue(e.rows.length)}px` : void 0;
|
|
1588
|
+
case "pie":
|
|
1589
|
+
case "heatmap": return;
|
|
1590
|
+
default: return e.small ? "var(--chart-h-small)" : void 0;
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
function st(e) {
|
|
1594
|
+
switch (e.kind) {
|
|
1595
|
+
case "line": return [["", ...e.series.map((e) => e.label)], ...e.labels.map((t, n) => [t, ...e.series.map((e) => e.values[n])])];
|
|
1596
|
+
case "bar": return [[
|
|
1597
|
+
"",
|
|
1598
|
+
e.axisTitle ?? "Waarde",
|
|
1599
|
+
...e.trend ? ["Trend"] : []
|
|
1600
|
+
], ...e.labels.map((t, n) => [
|
|
1601
|
+
t,
|
|
1602
|
+
e.values[n],
|
|
1603
|
+
...e.trend ? [e.trend[n]] : []
|
|
1604
|
+
])];
|
|
1605
|
+
case "horizontal-bar": return [["", e.unit ? `Waarde (${e.unit})` : "Waarde"], ...e.rows.map((e) => [e.label, e.value])];
|
|
1606
|
+
case "target-progress": return [[
|
|
1607
|
+
"",
|
|
1608
|
+
"Voortgang (%)",
|
|
1609
|
+
"Doel (%)"
|
|
1610
|
+
], ...e.rows.map((t) => [
|
|
1611
|
+
t.label,
|
|
1612
|
+
t.value,
|
|
1613
|
+
e.target ?? 100
|
|
1614
|
+
])];
|
|
1615
|
+
case "grouped-bar":
|
|
1616
|
+
case "stacked-bar": return [["", ...e.series.map((e) => e.label)], ...e.labels.map((t, n) => [t, ...e.series.map((e) => e.values[n])])];
|
|
1617
|
+
case "pie": return [["", "Aantal"], ...e.segments.map((e) => [e.label, e.value])];
|
|
1618
|
+
case "dual-axis": {
|
|
1619
|
+
let t = (e) => e.unit ? `${e.label} (${e.unit})` : e.label;
|
|
1620
|
+
return [[
|
|
1621
|
+
"",
|
|
1622
|
+
t(e.left),
|
|
1623
|
+
t(e.right)
|
|
1624
|
+
], ...e.labels.map((t, n) => [
|
|
1625
|
+
t,
|
|
1626
|
+
e.left.values[n],
|
|
1627
|
+
e.right.values[n]
|
|
1628
|
+
])];
|
|
1629
|
+
}
|
|
1630
|
+
case "scatter": {
|
|
1631
|
+
let t = (e, t) => {
|
|
1632
|
+
let n = e.charAt(0).toUpperCase() + e.slice(1);
|
|
1633
|
+
return t ? `${n} (${t})` : n;
|
|
1634
|
+
};
|
|
1635
|
+
return [[
|
|
1636
|
+
"Reeks",
|
|
1637
|
+
"Naam",
|
|
1638
|
+
t(e.xTitle, e.xUnit),
|
|
1639
|
+
t(e.axisTitle, e.unit)
|
|
1640
|
+
], ...e.series.flatMap((e) => e.points.map((t) => [
|
|
1641
|
+
e.label,
|
|
1642
|
+
t.label,
|
|
1643
|
+
t.x,
|
|
1644
|
+
t.y
|
|
1645
|
+
]))];
|
|
1646
|
+
}
|
|
1647
|
+
case "heatmap": return [["", ...e.columnLabels], ...e.rowLabels.map((t, n) => [t, ...e.values[n] ?? []])];
|
|
1648
|
+
case "histogram": {
|
|
1649
|
+
let t = (t) => e.unit ? `${t} (${e.unit})` : t;
|
|
1650
|
+
return [[
|
|
1651
|
+
"Klasse",
|
|
1652
|
+
t("Van"),
|
|
1653
|
+
t("Tot"),
|
|
1654
|
+
"Aantal"
|
|
1655
|
+
], ...e.bins.map((t) => [
|
|
1656
|
+
Ze(t, e.unit),
|
|
1657
|
+
t.from,
|
|
1658
|
+
t.to ?? "",
|
|
1659
|
+
t.count
|
|
1660
|
+
])];
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
function ct(e) {
|
|
1665
|
+
return e.reduce((e, t) => {
|
|
1666
|
+
if (typeof t != "number" || Number.isInteger(t)) return e;
|
|
1667
|
+
let n = String(t).split(".")[1] ?? "";
|
|
1668
|
+
return Math.max(e, n.length);
|
|
1669
|
+
}, 0);
|
|
1670
|
+
}
|
|
1671
|
+
function lt(e, t) {
|
|
1672
|
+
let [n = [], ...r] = st(e), i = n.map((e, t) => {
|
|
1673
|
+
let n = r.map((e) => e[t] ?? null);
|
|
1674
|
+
return t === 0 || n.some((e) => typeof e == "string" && e !== "") ? {
|
|
1675
|
+
key: `c${t}`,
|
|
1676
|
+
header: String(e ?? ""),
|
|
1677
|
+
format: "text",
|
|
1678
|
+
sortable: !1
|
|
1679
|
+
} : {
|
|
1680
|
+
key: `c${t}`,
|
|
1681
|
+
header: String(e ?? ""),
|
|
1682
|
+
format: "decimal",
|
|
1683
|
+
decimals: ct(n),
|
|
1684
|
+
align: "right",
|
|
1685
|
+
sortable: !1
|
|
1686
|
+
};
|
|
1687
|
+
});
|
|
1688
|
+
return {
|
|
1689
|
+
caption: t,
|
|
1690
|
+
columns: i,
|
|
1691
|
+
rows: r.map((e, t) => ({
|
|
1692
|
+
row: String(t),
|
|
1693
|
+
...Object.fromEntries(i.map((t, n) => [t.key, e[n] ?? null]))
|
|
1694
|
+
})),
|
|
1695
|
+
rowKey: "row",
|
|
1696
|
+
defaultSort: {
|
|
1697
|
+
key: "row",
|
|
1698
|
+
direction: "asc"
|
|
1699
|
+
},
|
|
1700
|
+
pageSize: Math.max(r.length, 1)
|
|
1701
|
+
};
|
|
1702
|
+
}
|
|
1703
|
+
var ut = class extends S {
|
|
1704
|
+
constructor(...e) {
|
|
1705
|
+
super(...e), this.view = "chart", this.#e = new U(() => this.requestUpdate()), this.#t = null, this.#n = new a(this);
|
|
1706
|
+
}
|
|
1707
|
+
static {
|
|
1708
|
+
this.styles = [
|
|
1709
|
+
u,
|
|
1710
|
+
r(y),
|
|
1711
|
+
r(v),
|
|
1712
|
+
r(o),
|
|
1713
|
+
...C,
|
|
1714
|
+
r(tt)
|
|
1715
|
+
];
|
|
1716
|
+
}
|
|
1717
|
+
static {
|
|
1718
|
+
this.properties = {
|
|
1719
|
+
data: { attribute: !1 },
|
|
1720
|
+
view: { state: !0 }
|
|
1721
|
+
};
|
|
1722
|
+
}
|
|
1723
|
+
#e;
|
|
1724
|
+
#t;
|
|
1725
|
+
#n;
|
|
1726
|
+
get dataSettings() {
|
|
1727
|
+
return this.data ?? void 0;
|
|
1728
|
+
}
|
|
1729
|
+
disconnectedCallback() {
|
|
1730
|
+
this.#e.detach(), this.#t?.detach(), this.#t = null, super.disconnectedCallback();
|
|
1731
|
+
}
|
|
1732
|
+
get ready() {
|
|
1733
|
+
return (this.data?.state ?? "ready") === "ready";
|
|
1734
|
+
}
|
|
1735
|
+
get showsTable() {
|
|
1736
|
+
return !!this.data?.tableSwitch && this.ready && this.view === "table";
|
|
1737
|
+
}
|
|
1738
|
+
get expandable() {
|
|
1739
|
+
return this.data?.expandable !== !1;
|
|
1740
|
+
}
|
|
1741
|
+
get downloadName() {
|
|
1742
|
+
let e = this.data?.download;
|
|
1743
|
+
return e === !1 ? null : e?.filename ?? it(this.data?.title);
|
|
1744
|
+
}
|
|
1745
|
+
csv() {
|
|
1746
|
+
let e = this.data, t = this.downloadName;
|
|
1747
|
+
e && t !== null && D(t, st(e.chart));
|
|
1748
|
+
}
|
|
1749
|
+
png() {
|
|
1750
|
+
let e = this.data;
|
|
1751
|
+
if (!e) return;
|
|
1752
|
+
let t = this.renderRoot.querySelector(this.expanded ? "lintje-modal" : "lintje-tile")?.querySelector(nt);
|
|
1753
|
+
t && w(this.downloadName ?? it(e.title), t);
|
|
1754
|
+
}
|
|
1755
|
+
expandChanged(e) {
|
|
1756
|
+
e ? this.#t ??= new U(() => this.requestUpdate()) : (this.#t?.detach(), this.#t = null);
|
|
1757
|
+
}
|
|
1758
|
+
render() {
|
|
1759
|
+
let e = this.data;
|
|
1760
|
+
if (!e) return n;
|
|
1761
|
+
let t = this.ready, r = this.#n.matches && e.mobileSubtitle ? e.mobileSubtitle : e.subtitle, i = this.id ? `${this.id}-tile` : void 0, a = e.tableSwitch && t ? this.viewSwitch() : n, o = this.showsTable;
|
|
1762
|
+
return m`<lintje-tile
|
|
1763
|
+
id=${i ?? n}
|
|
1764
|
+
span=${e.span ?? n}
|
|
1765
|
+
heading=${e.title ?? n}
|
|
1766
|
+
icon=${e.icon ?? n}
|
|
1767
|
+
subtitle=${r ?? n}
|
|
1768
|
+
intro=${e.intro ?? n}
|
|
1769
|
+
footnote=${e.footnote ?? n}
|
|
1770
|
+
?legend-below=${!!e.legendBelow}
|
|
1771
|
+
?expandable=${this.expandable && t}
|
|
1772
|
+
?download=${this.downloadName !== null && t}
|
|
1773
|
+
@lintje-tile-expand=${(e) => {
|
|
1774
|
+
e.stopPropagation(), this.expand(!0);
|
|
1775
|
+
}}
|
|
1776
|
+
@lintje-tile-download=${(e) => {
|
|
1777
|
+
e.stopPropagation(), this.csv();
|
|
1778
|
+
}}
|
|
1779
|
+
>
|
|
1780
|
+
${a}
|
|
1781
|
+
${e.notice ? m`<lintje-announcement
|
|
1782
|
+
slot="notice"
|
|
1783
|
+
compact
|
|
1784
|
+
.data=${e.notice}
|
|
1785
|
+
></lintje-announcement>` : n}
|
|
1786
|
+
${this.content()}
|
|
1787
|
+
</lintje-tile>
|
|
1788
|
+
|
|
1789
|
+
${this.renderExpandModal(this.expanded ? o ? this.table() : this.#t ? et(e.chart, {
|
|
1790
|
+
...this.chartOptions(this.#t),
|
|
1791
|
+
expanded: !0
|
|
1792
|
+
}) : n : n, {
|
|
1793
|
+
heading: e.title,
|
|
1794
|
+
subtitle: r,
|
|
1795
|
+
footnote: e.footnote,
|
|
1796
|
+
csv: () => this.csv(),
|
|
1797
|
+
png: o ? void 0 : () => this.png()
|
|
1798
|
+
})}`;
|
|
1799
|
+
}
|
|
1800
|
+
content() {
|
|
1801
|
+
let e = this.data, t = ot(e.chart);
|
|
1802
|
+
switch (e.state ?? "ready") {
|
|
1803
|
+
case "loading": return x({
|
|
1804
|
+
kind: at(e.chart),
|
|
1805
|
+
height: t
|
|
1806
|
+
});
|
|
1807
|
+
case "empty": return T(e.message, t);
|
|
1808
|
+
case "error": return E({
|
|
1809
|
+
message: e.message,
|
|
1810
|
+
lastKnown: e.lastKnown,
|
|
1811
|
+
height: t,
|
|
1812
|
+
announcement: b
|
|
1813
|
+
});
|
|
1814
|
+
default: return this.showsTable ? this.table() : et(e.chart, this.chartOptions(this.#e));
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1817
|
+
viewSwitch() {
|
|
1818
|
+
let e = this.#n.matches;
|
|
1819
|
+
return m`<lintje-segmented
|
|
1820
|
+
class="lintje-chart__view"
|
|
1821
|
+
slot=${e ? "notice" : "actions"}
|
|
1822
|
+
label="Weergave"
|
|
1823
|
+
hide-label
|
|
1824
|
+
?stacked=${e}
|
|
1825
|
+
.value=${this.view}
|
|
1826
|
+
.options=${rt}
|
|
1827
|
+
@lintje-change=${(e) => {
|
|
1828
|
+
e.stopPropagation(), this.view = e.detail === "table" ? "table" : "chart";
|
|
1829
|
+
}}
|
|
1830
|
+
></lintje-segmented>`;
|
|
1831
|
+
}
|
|
1832
|
+
table() {
|
|
1833
|
+
let e = this.data, t = e.title ? `${e.title}, als tabel` : "Grafiek als tabel";
|
|
1834
|
+
return m`<lintje-data-table
|
|
1835
|
+
class="lintje-chart__table"
|
|
1836
|
+
bare
|
|
1837
|
+
.data=${lt(e.chart, t)}
|
|
1838
|
+
></lintje-data-table>`;
|
|
1839
|
+
}
|
|
1840
|
+
async focusMark(e) {
|
|
1841
|
+
await this.updateComplete;
|
|
1842
|
+
let t = this.renderRoot.querySelector(this.expanded ? "lintje-modal" : "lintje-tile"), n = t?.querySelector(`[data-mark-id="${CSS.escape(e)}"]`) ?? t?.querySelector(`${nt}, .lintje-heatmap`);
|
|
1843
|
+
n && !n.hasAttribute("tabindex") && n.setAttribute("tabindex", "-1"), n?.focus();
|
|
1844
|
+
}
|
|
1845
|
+
chartOptions(e) {
|
|
1846
|
+
return {
|
|
1847
|
+
controller: e,
|
|
1848
|
+
description: this.data?.description ?? "",
|
|
1849
|
+
mobile: this.#n.matches,
|
|
1850
|
+
selectedId: this.data?.selectedId ?? null,
|
|
1851
|
+
onSelect: ({ id: e, label: t, href: n }) => this.emit("lintje-mark-select", {
|
|
1852
|
+
id: e,
|
|
1853
|
+
label: t,
|
|
1854
|
+
href: n
|
|
1855
|
+
}),
|
|
1856
|
+
onClear: (e) => {
|
|
1857
|
+
this.emit("lintje-mark-select", {
|
|
1858
|
+
id: null,
|
|
1859
|
+
label: null,
|
|
1860
|
+
href: this.data?.clearHref
|
|
1861
|
+
}), this.focusMark(e);
|
|
1862
|
+
}
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1865
|
+
};
|
|
1866
|
+
t("lintje-chart", ut);
|
|
1867
|
+
//#endregion
|
|
1868
|
+
export { ut as LintjeChart };
|