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
|
@@ -1,1474 +0,0 @@
|
|
|
1
|
-
import { Bt as e, Gt as t, Ht as n, Kt as r, Lt as i, S as a, a as o, d as s, i as c, k as l, n as u, o as d, qt as f, s as p, t as m, ut as h, w as g } from "../chunks/base-rBLTcEIv.js";
|
|
2
|
-
import { t as _ } from "./announcement.js";
|
|
3
|
-
import "./segmented.js";
|
|
4
|
-
import { a as v, c as y, d as b, i as x, n as S, o as C, s as w, t as T } from "../chunks/download-lFooAfD1.js";
|
|
5
|
-
import { C as E, S as D, T as O, _ as k, a as A, b as j, c as M, d as N, f as P, g as F, h as I, i as L, l as R, m as z, n as B, o as ee, r as V, s as H, t as te, v as U, w as W, x as G, y as K } from "../chunks/stagger-9hYzxhMG.js";
|
|
6
|
-
import "./data-table.js";
|
|
7
|
-
//#region src/components/shared/charts/shared/plot-keys.ts
|
|
8
|
-
var q = /* @__PURE__ */ new Set(["ArrowRight", "ArrowDown"]), ne = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowUp"]);
|
|
9
|
-
function re(e) {
|
|
10
|
-
return `${e.title}: ${e.rows.map((e) => `${e.label} ${e.value}`).join(", ")}`;
|
|
11
|
-
}
|
|
12
|
-
function ie(e) {
|
|
13
|
-
try {
|
|
14
|
-
return e.matches(":focus-visible");
|
|
15
|
-
} catch {
|
|
16
|
-
return !0;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function J(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 = re(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 (ne.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 && ie(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 Y(e) {
|
|
45
|
-
return r`<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 ae(e, n) {
|
|
50
|
-
let { controller: i, description: a } = n, { labels: s, axisTitle: c, unit: l, asOfIndex: u, asOfLabel: d, pendingHours: h = 0, fixedMax: g, small: _ = !1 } = e, v = i.id;
|
|
51
|
-
i.measure({
|
|
52
|
-
width: !0,
|
|
53
|
-
height: n.height ?? (_ ? "--chart-h-small" : "--chart-h-main"),
|
|
54
|
-
fit: !!n.expanded && !n.mobile
|
|
55
|
-
});
|
|
56
|
-
let y = e.series.filter((e) => !e.comparison).length > 1, b = 0, x = e.series.map((e) => ({
|
|
57
|
-
...e,
|
|
58
|
-
color: N(e.color),
|
|
59
|
-
symbol: y && !e.comparison ? I(e.color) ? e.color : z[b++ % z.length] : void 0
|
|
60
|
-
})), S = x.filter((e) => !i.hiddenSeries.includes(e.label)), C = S.flatMap((e) => e.values).filter((e) => e != null), { max: w, ticks: T } = j(g ?? Math.max(...C, 1)), E = K(T, i.width, {
|
|
61
|
-
fontFamily: i.fontFamily,
|
|
62
|
-
minimum: Math.ceil(p(s[0] ?? "", i.fontFamily) / 2)
|
|
63
|
-
}), k = U(n, { left: E.width }), A = h > 6, M = u ?? s.length - 1, L = (e) => e.comparison ? "var(--color-chart-secondary)" : e.color ?? "var(--color-chart-default)", B = x.map((e) => ({
|
|
64
|
-
label: e.label,
|
|
65
|
-
color: L(e),
|
|
66
|
-
shape: e.comparison ? "dashed" : "line",
|
|
67
|
-
symbol: e.symbol,
|
|
68
|
-
hidden: i.hiddenSeries.includes(e.label)
|
|
69
|
-
})), te = Math.max(1, Math.ceil(s.length / 8)), G = s.map((e, t) => ({
|
|
70
|
-
label: e,
|
|
71
|
-
x: W(t, s.length, k),
|
|
72
|
-
i: t
|
|
73
|
-
})).filter((e) => e.i % te === 0);
|
|
74
|
-
function q(e) {
|
|
75
|
-
return {
|
|
76
|
-
title: s[e],
|
|
77
|
-
rows: S.map((t) => ({
|
|
78
|
-
label: t.label,
|
|
79
|
-
value: t.values[e] == null ? "geen gegevens" : o(t.values[e]),
|
|
80
|
-
color: L(t)
|
|
81
|
-
}))
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
let ne = J(i, s.length, (e) => {
|
|
85
|
-
let t = S.map((t) => t.values[e]).filter((e) => e != null);
|
|
86
|
-
return {
|
|
87
|
-
x: W(e, s.length, k),
|
|
88
|
-
y: t.length ? O(Math.max(...t), w, k) : k.top,
|
|
89
|
-
content: q(e)
|
|
90
|
-
};
|
|
91
|
-
}), re = [
|
|
92
|
-
h > 0 ? (() => {
|
|
93
|
-
let e = W(M, s.length, k), t = A ? D(k) / (s.length - 1) : k.width - k.right - e;
|
|
94
|
-
return f`<rect x=${e} y=${k.top} width=${Math.max(0, t)}
|
|
95
|
-
height=${k.height - k.top - k.bottom}
|
|
96
|
-
fill="url(#hatch-${v})" />`;
|
|
97
|
-
})() : t,
|
|
98
|
-
f`<g class="lintje-chart__reveal">
|
|
99
|
-
${S.map((e) => {
|
|
100
|
-
let n = L(e), r = e.comparison ? void 0 : P(n), i = [[]];
|
|
101
|
-
e.values.forEach((e, t) => {
|
|
102
|
-
e == null || A && t > M ? i[i.length - 1].length && i.push([]) : i[i.length - 1].push({
|
|
103
|
-
x: W(t, s.length, k),
|
|
104
|
-
y: O(e, w, k)
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
let a = i.filter((e) => e.length > 0);
|
|
108
|
-
if (a.length === 0) return t;
|
|
109
|
-
let o = a[a.length - 1], c = o[o.length - 1], l = k.height - k.bottom;
|
|
110
|
-
return f`
|
|
111
|
-
<g>
|
|
112
|
-
${a.map((i) => {
|
|
113
|
-
let a = i.map((e) => `${e.x},${e.y}`).join(" ");
|
|
114
|
-
return f`
|
|
115
|
-
${e.area && !e.comparison ? f`<polygon fill=${n} fill-opacity=".14"
|
|
116
|
-
points=${`${i[0].x},${l} ${a} ${i[i.length - 1].x},${l}`} />` : t}
|
|
117
|
-
${r && i.length > 1 ? f`<polyline class="lintje-chart__line lintje-chart__line--casing" points=${a} stroke=${r} />` : t}
|
|
118
|
-
${i.length === 1 ? f`<circle cx=${i[0].x} cy=${i[0].y} r="2.5" fill=${n} />` : f`<polyline
|
|
119
|
-
class="lintje-chart__line"
|
|
120
|
-
points=${a}
|
|
121
|
-
stroke=${n}
|
|
122
|
-
stroke-dasharray=${e.comparison ? "5 4" : t}
|
|
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 ? f`<path class="lintje-chart__line-end" d=${F(e.symbol, 4.5, c.x, c.y)} fill=${n} />` : A && !e.comparison ? f`<circle cx=${c.x} cy=${c.y} r="4" fill=${n} />` : t}
|
|
128
|
-
</g>
|
|
129
|
-
`;
|
|
130
|
-
})}
|
|
131
|
-
</g>`,
|
|
132
|
-
A && d ? ee({
|
|
133
|
-
area: k,
|
|
134
|
-
index: M,
|
|
135
|
-
count: s.length,
|
|
136
|
-
label: `peilmoment ${d}`,
|
|
137
|
-
pendingHours: h,
|
|
138
|
-
lastValue: (() => {
|
|
139
|
-
let e = S.find((e) => !e.comparison)?.values[M];
|
|
140
|
-
return e == null ? void 0 : `${o(e)}${l ? ` ${l}` : ""}`;
|
|
141
|
-
})()
|
|
142
|
-
}) : t,
|
|
143
|
-
i.hoverIndex == null ? t : S.map((e) => {
|
|
144
|
-
let n = i.hoverIndex, r = e.values[n];
|
|
145
|
-
return r == null || A && n > M ? t : f`<circle class="lintje-chart__hover-point" r="4" fill=${L(e)}
|
|
146
|
-
cx=${W(n, s.length, k)}
|
|
147
|
-
cy=${O(r, w, k)} />`;
|
|
148
|
-
}),
|
|
149
|
-
s.map((e, t) => {
|
|
150
|
-
let n = W(t, s.length, k), r = D(k) / Math.max(1, s.length - 1);
|
|
151
|
-
return f`
|
|
152
|
-
<rect x=${n - r / 2} y=${k.top} width=${r}
|
|
153
|
-
height=${k.height - k.top - k.bottom}
|
|
154
|
-
fill="transparent"
|
|
155
|
-
@mousemove=${(e) => i.hoverAt(t, e, q(t))}
|
|
156
|
-
@mouseleave=${() => i.hoverAt(null)} />
|
|
157
|
-
`;
|
|
158
|
-
})
|
|
159
|
-
];
|
|
160
|
-
return r`
|
|
161
|
-
<div class="lintje-chart-wrap ${_ ? "lintje-chart--small" : ""}"
|
|
162
|
-
${m(i.attach)} ?data-in-view=${i.inView} data-tooltip-anchor
|
|
163
|
-
@keydown=${(e) => i.dismiss(e)}>
|
|
164
|
-
${R({
|
|
165
|
-
items: B,
|
|
166
|
-
onToggle: (e) => i.toggleSeries(e)
|
|
167
|
-
})}
|
|
168
|
-
${H({
|
|
169
|
-
fontFamily: i.fontFamily,
|
|
170
|
-
id: v,
|
|
171
|
-
ticks: T,
|
|
172
|
-
max: w,
|
|
173
|
-
area: k,
|
|
174
|
-
formatTick: E.format,
|
|
175
|
-
axisTitle: c ?? l,
|
|
176
|
-
xLabels: G,
|
|
177
|
-
description: a,
|
|
178
|
-
keys: ne
|
|
179
|
-
}, re)}
|
|
180
|
-
${V(i)}
|
|
181
|
-
${Y(i)}
|
|
182
|
-
</div>
|
|
183
|
-
`;
|
|
184
|
-
}
|
|
185
|
-
//#endregion
|
|
186
|
-
//#region src/components/shared/charts/shared/mark-select.ts
|
|
187
|
-
var oe = {
|
|
188
|
-
clickable: !1,
|
|
189
|
-
state: "",
|
|
190
|
-
markId: t,
|
|
191
|
-
role: t,
|
|
192
|
-
tabIndex: t,
|
|
193
|
-
pressed: t,
|
|
194
|
-
label: t,
|
|
195
|
-
click: t,
|
|
196
|
-
keydown: t
|
|
197
|
-
};
|
|
198
|
-
function X(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 ? oe : {
|
|
216
|
-
...oe,
|
|
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 se = [
|
|
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 ce(e, n) {
|
|
249
|
-
let { controller: i, description: a } = n, { labels: s, values: l, axisTitle: d, trend: p, dataLabels: g = !0, small: _ = !1, links: v } = e, y = N(e.color) ?? "var(--color-chart-default)", b = i.id, x = X(n, v ?? []);
|
|
250
|
-
i.measure({
|
|
251
|
-
width: !0,
|
|
252
|
-
height: n.height ?? (_ ? "--chart-h-small" : "--chart-h-main"),
|
|
253
|
-
fit: !!n.expanded && !n.mobile
|
|
254
|
-
});
|
|
255
|
-
let S = l.filter((e) => e != null), { max: C, ticks: w } = j(Math.max(...S, 1)), T = K(w, i.width, { fontFamily: i.fontFamily }), E = U(n, { left: T.width }), D = E.height - E.bottom, { width: k, bandWidth: A } = G(0, s.length, E), M = g && l.every((e) => e == null || u(c(e, k), A - 4)), P = (e) => ({
|
|
256
|
-
title: s[e],
|
|
257
|
-
rows: [{
|
|
258
|
-
label: d ?? "Waarde",
|
|
259
|
-
value: l[e] == null ? "geen gegevens" : o(l[e]),
|
|
260
|
-
color: y
|
|
261
|
-
}]
|
|
262
|
-
}), F = J(i, s.length, (e) => ({
|
|
263
|
-
x: G(e, s.length, E).center,
|
|
264
|
-
y: l[e] == null ? E.top : O(l[e], C, E),
|
|
265
|
-
content: P(e)
|
|
266
|
-
})), I = [l.map((e, n) => {
|
|
267
|
-
let r = G(n, s.length, E);
|
|
268
|
-
if (e == null) return f`<rect class="lintje-chart__missing" x=${r.x} y=${E.top} width=${r.width}
|
|
269
|
-
height=${Math.max(0, D - E.top)} fill="url(#hatch-${b})"
|
|
270
|
-
@mousemove=${(e) => i.showTooltip(e, P(n))}
|
|
271
|
-
@mouseleave=${() => i.hideTooltip()} />`;
|
|
272
|
-
let a = O(e, C, E), l = x.of(v?.[n], s[n], `${s[n]}: ${o(e)}`);
|
|
273
|
-
return f`
|
|
274
|
-
<g class="lintje-chart__bar-group ${i.hoverIndex === n ? "is-hovered" : ""}"
|
|
275
|
-
${h(B(n, s.length))}
|
|
276
|
-
@mousemove=${(e) => i.showTooltip(e, P(n))}
|
|
277
|
-
@mouseleave=${() => i.hideTooltip()}>
|
|
278
|
-
<rect class="lintje-chart__bar lintje-chart__mark ${l.state}"
|
|
279
|
-
x=${r.x} y=${a} width=${r.width} height=${Math.max(0, D - a)} fill=${y}
|
|
280
|
-
data-mark-id=${l.markId} role=${l.role} tabindex=${l.tabIndex}
|
|
281
|
-
aria-pressed=${l.pressed} aria-label=${l.label}
|
|
282
|
-
@click=${l.click} @keydown=${l.keydown} />
|
|
283
|
-
${M ? f`<text x=${r.center} y=${a - 5} text-anchor="middle" class="lintje-chart__data-label">
|
|
284
|
-
${c(e, r.width)}
|
|
285
|
-
</text>` : t}
|
|
286
|
-
</g>
|
|
287
|
-
`;
|
|
288
|
-
}), p ? f`<polyline
|
|
289
|
-
fill="none" stroke="var(--color-chart-emphasis)" stroke-width="1.5" stroke-dasharray="5 4"
|
|
290
|
-
points=${p.map((e, t) => e == null ? null : `${G(t, s.length, E).center},${O(e, C, E)}`).filter(Boolean).join(" ")} />` : t];
|
|
291
|
-
return r`
|
|
292
|
-
<div class="lintje-chart-wrap ${_ ? "lintje-chart--small" : ""}"
|
|
293
|
-
${m(i.attach)} ?data-in-view=${i.inView} data-tooltip-anchor
|
|
294
|
-
@keydown=${(e) => i.dismiss(e) || x.escape(e)}>
|
|
295
|
-
${H({
|
|
296
|
-
fontFamily: i.fontFamily,
|
|
297
|
-
id: b,
|
|
298
|
-
ticks: w,
|
|
299
|
-
max: C,
|
|
300
|
-
area: E,
|
|
301
|
-
axisTitle: d,
|
|
302
|
-
description: a,
|
|
303
|
-
formatTick: T.format,
|
|
304
|
-
xLabels: s.map((e, t) => ({
|
|
305
|
-
label: e,
|
|
306
|
-
x: G(t, s.length, E).center
|
|
307
|
-
})),
|
|
308
|
-
interactive: x.interactive,
|
|
309
|
-
keys: F
|
|
310
|
-
}, I)}
|
|
311
|
-
${V(i)}
|
|
312
|
-
${Y(i)}
|
|
313
|
-
</div>
|
|
314
|
-
`;
|
|
315
|
-
}
|
|
316
|
-
//#endregion
|
|
317
|
-
//#region src/components/shared/charts/horizontal-bar-chart/horizontal-bar-chart.ts
|
|
318
|
-
function Z(e) {
|
|
319
|
-
return e * 26 + 24;
|
|
320
|
-
}
|
|
321
|
-
function le(e, n) {
|
|
322
|
-
let { controller: i, description: a } = n, { rows: s, threshold: c, thresholdLabel: l, unit: u } = e, d = N(e.color) ?? "var(--color-chart-dark-yellow)", p = N(e.aboveThresholdColor) ?? "var(--color-chart-red)", g = i.id, _ = s.map((e) => e.href ? {
|
|
323
|
-
id: e.id ?? e.label,
|
|
324
|
-
href: e.href
|
|
325
|
-
} : null), v = X(n, _), y = Z(s.length);
|
|
326
|
-
i.measure({
|
|
327
|
-
width: !0,
|
|
328
|
-
height: y
|
|
329
|
-
});
|
|
330
|
-
let b = i.width, x = E(s.map((e) => e.label), b, { fontFamily: i.fontFamily }), { labelEnd: S, barStart: C } = x, w = Math.max(...s.map((e) => e.value), c ?? 0) * 1.15, T = (e) => Math.max(40, b - C - 60) * e / w, D = (e) => `${o(e)}${u ? ` ${u}` : ""}`, O = (e) => {
|
|
331
|
-
let t = s[e], n = c != null && t.value > c;
|
|
332
|
-
return {
|
|
333
|
-
title: t.label,
|
|
334
|
-
rows: [{
|
|
335
|
-
label: "Waarde",
|
|
336
|
-
value: D(t.value),
|
|
337
|
-
color: n ? p : d
|
|
338
|
-
}, ...c == null ? [] : [{
|
|
339
|
-
label: "Norm",
|
|
340
|
-
value: D(c),
|
|
341
|
-
color: "var(--color-chart-emphasis)"
|
|
342
|
-
}]]
|
|
343
|
-
};
|
|
344
|
-
}, k = J(i, s.length, (e) => ({
|
|
345
|
-
x: C + T(s[e].value),
|
|
346
|
-
y: e * 26 + 4,
|
|
347
|
-
content: O(e)
|
|
348
|
-
}));
|
|
349
|
-
return r`
|
|
350
|
-
<figure class="lintje-chart lintje-chart--rows" ${m(i.attach)} ?data-in-view=${i.inView}
|
|
351
|
-
data-tooltip-anchor
|
|
352
|
-
@keydown=${(e) => i.dismiss(e) || v.escape(e)}>
|
|
353
|
-
<svg viewBox="0 0 ${b} ${y}" class="lintje-chart__svg" role=${L(v.interactive)}
|
|
354
|
-
aria-labelledby="${g}-desc" width=${b} height=${y}
|
|
355
|
-
${h({
|
|
356
|
-
height: `${y}px`,
|
|
357
|
-
...A(g)
|
|
358
|
-
})}
|
|
359
|
-
tabindex="0" @keydown=${k.keydown} @focus=${k.focus} @blur=${k.blur}>
|
|
360
|
-
<desc id="${g}-desc">${a}</desc>
|
|
361
|
-
<defs>${M(g)}</defs>
|
|
362
|
-
${c == null ? t : f`
|
|
363
|
-
<line x1=${C + T(c)} x2=${C + T(c)} y1=${4} y2=${s.length * 26 + 2}
|
|
364
|
-
stroke="var(--color-chart-emphasis)" stroke-width="1" stroke-dasharray="3 3" />
|
|
365
|
-
<text x=${C + T(c) + 6} y=${s.length * 26 + 16} class="lintje-chart__axis-label">
|
|
366
|
-
${l ?? `norm ${o(c)}`}
|
|
367
|
-
</text>
|
|
368
|
-
`}
|
|
369
|
-
${s.map((e, t) => {
|
|
370
|
-
let n = t * 26 + 4, r = c != null && e.value > c, a = T(e.value), l = v.of(_[t], e.label, `${e.label}: ${o(e.value)}${u ? ` ${u}` : ""}`);
|
|
371
|
-
return f`
|
|
372
|
-
<g class="lintje-chart__bar-row ${i.hoverIndex === t ? "is-hovered" : ""}"
|
|
373
|
-
@mousemove=${(e) => i.showTooltip(e, O(t))}
|
|
374
|
-
@mouseleave=${() => i.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
|
-
${h(B(t, s.length))}
|
|
380
|
-
x=${C} y=${n} width=${Math.max(0, a)} height=${16}
|
|
381
|
-
fill=${r ? p : 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 + a + 6} y=${n + 16 - 3} font-weight="700"
|
|
386
|
-
class="lintje-chart__data-label ${c == null ? "" : "lintje-chart__data-label--halo"}">
|
|
387
|
-
${o(e.value)}${u ? ` ${u}` : ""}
|
|
388
|
-
</text>
|
|
389
|
-
</g>
|
|
390
|
-
`;
|
|
391
|
-
})}
|
|
392
|
-
</svg>
|
|
393
|
-
${V(i)}
|
|
394
|
-
${Y(i)}
|
|
395
|
-
</figure>
|
|
396
|
-
`;
|
|
397
|
-
}
|
|
398
|
-
//#endregion
|
|
399
|
-
//#region src/components/shared/charts/target-progress-chart/target-progress-chart.ts
|
|
400
|
-
function ue(e, t) {
|
|
401
|
-
let { controller: n, description: i } = t, { rows: a, target: o = 100 } = e, s = n.id, c = Z(a.length);
|
|
402
|
-
n.measure({
|
|
403
|
-
width: !0,
|
|
404
|
-
height: c
|
|
405
|
-
});
|
|
406
|
-
let l = n.width, u = E(a.map((e) => e.label), l, { fontFamily: n.fontFamily }), { labelEnd: p, barStart: g } = u, _ = (e) => Math.max(40, l - g - 70) * e / 110, v = 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: d(a[e].value),
|
|
411
|
-
color: y(a[e].value)
|
|
412
|
-
}, {
|
|
413
|
-
label: "Doel",
|
|
414
|
-
value: d(o),
|
|
415
|
-
color: "var(--color-chart-emphasis)"
|
|
416
|
-
}]
|
|
417
|
-
}), x = J(n, a.length, (e) => ({
|
|
418
|
-
x: g + _(a[e].value),
|
|
419
|
-
y: e * 26 + 4,
|
|
420
|
-
content: b(e)
|
|
421
|
-
}));
|
|
422
|
-
return r`
|
|
423
|
-
<figure class="lintje-chart lintje-chart--rows" ${m(n.attach)} ?data-in-view=${n.inView}
|
|
424
|
-
data-tooltip-anchor @keydown=${(e) => n.dismiss(e)}>
|
|
425
|
-
<svg viewBox="0 0 ${l} ${c}" class="lintje-chart__svg" role="img"
|
|
426
|
-
aria-labelledby="${s}-desc" width=${l} height=${c} ${h({ height: `${c}px` })}
|
|
427
|
-
tabindex="0" @keydown=${x.keydown} @focus=${x.focus} @blur=${x.blur}>
|
|
428
|
-
<desc id="${s}-desc">${i}</desc>
|
|
429
|
-
${a.map((e, t) => {
|
|
430
|
-
let r = t * 26 + 4, i = _(e.value), s = y(e.value), c = g + i + 46 > l, m = e.value >= o ? "lintje-chart__data-label--inside" : "lintje-chart__data-label--inside-light";
|
|
431
|
-
return f`
|
|
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=${l} height=${26} fill="transparent" />
|
|
436
|
-
<text x=${p} y=${r + 16 - 3} text-anchor="end" class="lintje-chart__axis-label">${u.fit(e.label)}</text>
|
|
437
|
-
<rect class="lintje-chart__bar lintje-chart__bar--horizontal" ${h(B(t, a.length))}
|
|
438
|
-
x=${g} y=${r} width=${Math.max(0, i)} height=${16} fill=${s} />
|
|
439
|
-
<text x=${c ? g + i - 6 : g + i + 6} y=${r + 16 - 3}
|
|
440
|
-
text-anchor=${c ? "end" : "start"}
|
|
441
|
-
class="lintje-chart__data-label ${c ? m : ""}" font-weight="700">${d(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
|
-
${V(n)}
|
|
450
|
-
${Y(n)}
|
|
451
|
-
</figure>
|
|
452
|
-
`;
|
|
453
|
-
}
|
|
454
|
-
//#endregion
|
|
455
|
-
//#region src/components/shared/charts/grouped-bar-chart/grouped-bar-chart.ts
|
|
456
|
-
function de(e, n) {
|
|
457
|
-
let { controller: i, description: a } = n, { labels: s, axisTitle: l, small: d = !1 } = e, p = i.id;
|
|
458
|
-
i.measure({
|
|
459
|
-
width: !0,
|
|
460
|
-
height: n.height ?? (d ? "--chart-h-small" : "--chart-h-main"),
|
|
461
|
-
fit: !!n.expanded && !n.mobile
|
|
462
|
-
});
|
|
463
|
-
let g = e.series.map((e) => ({
|
|
464
|
-
...e,
|
|
465
|
-
color: N(e.color)
|
|
466
|
-
})), _ = g.filter((e) => !i.hiddenSeries.includes(e.label)), v = X(n, _.flatMap((e) => e.links ?? [])), { max: y, ticks: b } = j(Math.max(..._.flatMap((e) => e.values), 1)), x = K(b, i.width, { fontFamily: i.fontFamily }), S = U(n, { left: x.width }), C = S.height - S.bottom, w = G(0, s.length, S).width / Math.max(1, _.length), T = _.every((e) => e.values.every((e) => u(c(e, w), w - 2))), E = g.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: i.hiddenSeries.includes(e.label)
|
|
471
|
-
})), D = (e, t) => E[g.indexOf(e)]?.color ?? se[t], k = (e) => ({
|
|
472
|
-
title: s[e],
|
|
473
|
-
rows: _.map((t, n) => ({
|
|
474
|
-
label: t.label,
|
|
475
|
-
value: o(t.values[e]),
|
|
476
|
-
color: D(t, n)
|
|
477
|
-
}))
|
|
478
|
-
}), A = J(i, s.length, (e) => ({
|
|
479
|
-
x: G(e, s.length, S).center,
|
|
480
|
-
y: O(Math.max(0, ..._.map((t) => t.values[e])), y, S),
|
|
481
|
-
content: k(e)
|
|
482
|
-
})), M = s.map((e, n) => {
|
|
483
|
-
let r = G(n, s.length, S);
|
|
484
|
-
return f`
|
|
485
|
-
<g class="lintje-chart__bar-group ${i.hoverIndex === n ? "is-hovered" : ""}"
|
|
486
|
-
${h(B(n, s.length))}
|
|
487
|
-
@mousemove=${(e) => i.showTooltip(e, k(n))}
|
|
488
|
-
@mouseleave=${() => i.hideTooltip()}>
|
|
489
|
-
${_.map((i, a) => {
|
|
490
|
-
let s = i.values[n], l = O(s, y, S), u = D(i, a), d = v.of(i.links?.[n], `${e} · ${i.label}`, `${e}, ${i.label}: ${o(s)}`);
|
|
491
|
-
return f`
|
|
492
|
-
<g>
|
|
493
|
-
<rect class="lintje-chart__bar lintje-chart__mark ${d.state}"
|
|
494
|
-
x=${r.x + a * w} y=${l} width=${w - 2}
|
|
495
|
-
height=${Math.max(0, C - l)} fill=${u}
|
|
496
|
-
data-mark-id=${d.markId} role=${d.role} tabindex=${d.tabIndex}
|
|
497
|
-
aria-pressed=${d.pressed} aria-label=${d.label}
|
|
498
|
-
@click=${d.click} @keydown=${d.keydown} />
|
|
499
|
-
${T ? f`<text x=${r.x + a * w + (w - 2) / 2} y=${l - 4}
|
|
500
|
-
text-anchor="middle" class="lintje-chart__data-label">${c(s, w)}</text>` : t}
|
|
501
|
-
</g>
|
|
502
|
-
`;
|
|
503
|
-
})}
|
|
504
|
-
</g>
|
|
505
|
-
`;
|
|
506
|
-
});
|
|
507
|
-
return r`
|
|
508
|
-
<div class="lintje-chart-wrap ${d ? "lintje-chart--small" : ""}"
|
|
509
|
-
${m(i.attach)} ?data-in-view=${i.inView} data-tooltip-anchor
|
|
510
|
-
@keydown=${(e) => i.dismiss(e) || v.escape(e)}>
|
|
511
|
-
${R({
|
|
512
|
-
items: E,
|
|
513
|
-
onToggle: (e) => i.toggleSeries(e)
|
|
514
|
-
})}
|
|
515
|
-
${H({
|
|
516
|
-
fontFamily: i.fontFamily,
|
|
517
|
-
id: p,
|
|
518
|
-
ticks: b,
|
|
519
|
-
max: y,
|
|
520
|
-
area: S,
|
|
521
|
-
axisTitle: l,
|
|
522
|
-
description: a,
|
|
523
|
-
formatTick: x.format,
|
|
524
|
-
xLabels: s.map((e, t) => ({
|
|
525
|
-
label: e,
|
|
526
|
-
x: G(t, s.length, S).center
|
|
527
|
-
})),
|
|
528
|
-
interactive: v.interactive,
|
|
529
|
-
keys: A
|
|
530
|
-
}, M)}
|
|
531
|
-
${V(i)}
|
|
532
|
-
${Y(i)}
|
|
533
|
-
</div>
|
|
534
|
-
`;
|
|
535
|
-
}
|
|
536
|
-
//#endregion
|
|
537
|
-
//#region src/components/shared/charts/shared/tints.ts
|
|
538
|
-
var fe = [
|
|
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 pe(e, t) {
|
|
561
|
-
if (e < 1) return [];
|
|
562
|
-
let n = fe[Math.min(e, fe.length) - 1];
|
|
563
|
-
return s(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 me = /* @__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 he(e, n) {
|
|
581
|
-
let { controller: i, description: a } = n, { labels: s, axisTitle: l, normalized: p = !1, totalOnTop: g = !0, small: _ = !1 } = e, v = i.id;
|
|
582
|
-
i.measure({
|
|
583
|
-
width: !0,
|
|
584
|
-
height: n.height ?? (_ ? "--chart-h-small" : "--chart-h-main"),
|
|
585
|
-
fit: !!n.expanded && !n.mobile
|
|
586
|
-
});
|
|
587
|
-
let y = e.series.map((e) => ({
|
|
588
|
-
...e,
|
|
589
|
-
color: N(e.color)
|
|
590
|
-
})), b = X(n, y.flatMap((e) => e.links ?? [])), x = s.map((e, t) => y.reduce((e, n) => e + n.values[t], 0)), { max: S, ticks: C } = p ? {
|
|
591
|
-
max: 100,
|
|
592
|
-
ticks: [
|
|
593
|
-
0,
|
|
594
|
-
25,
|
|
595
|
-
50,
|
|
596
|
-
75,
|
|
597
|
-
100
|
|
598
|
-
]
|
|
599
|
-
} : j(Math.max(...x, 1)), w = K(C, i.width, { fontFamily: i.fontFamily }), T = U(n, { left: w.width }), E = T.height - T.bottom, { width: D, bandWidth: k } = G(0, s.length, T), A = g && !p && x.every((e) => u(c(e, k), k - 4)), M = pe(y.length), P = (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 : me.has(n)) ? "lintje-chart__data-label--inside" : "lintje-chart__data-label--inside-light";
|
|
602
|
-
}, I = (e) => ({
|
|
603
|
-
title: s[e],
|
|
604
|
-
rows: y.map((t, n) => ({
|
|
605
|
-
label: t.label,
|
|
606
|
-
value: p ? d(t.values[e] / x[e] * 100) : o(t.values[e]),
|
|
607
|
-
color: P(t, n)
|
|
608
|
-
}))
|
|
609
|
-
}), L = J(i, s.length, (e) => ({
|
|
610
|
-
x: G(e, s.length, T).center,
|
|
611
|
-
y: O(p ? S : x[e], S, T),
|
|
612
|
-
content: I(e)
|
|
613
|
-
})), z = y.map((e, t) => ({
|
|
614
|
-
label: e.label,
|
|
615
|
-
color: P(e, t),
|
|
616
|
-
shape: "square"
|
|
617
|
-
})), ee = s.map((e, n) => {
|
|
618
|
-
let r = G(n, s.length, T), a = 0, l = y.map((e, t) => {
|
|
619
|
-
let r = e.values[n], i = p ? r / x[n] * 100 : r, o = O(a, S, T);
|
|
620
|
-
a += i;
|
|
621
|
-
let s = O(a, S, T);
|
|
622
|
-
return {
|
|
623
|
-
row: e,
|
|
624
|
-
j: t,
|
|
625
|
-
value: i,
|
|
626
|
-
y1: s,
|
|
627
|
-
height: Math.max(0, o - s)
|
|
628
|
-
};
|
|
629
|
-
});
|
|
630
|
-
return f`
|
|
631
|
-
<g class="lintje-chart__bar-group ${i.hoverIndex === n ? "is-hovered" : ""}"
|
|
632
|
-
${h(B(n, s.length))}
|
|
633
|
-
@mousemove=${(e) => i.showTooltip(e, I(n))}
|
|
634
|
-
@mouseleave=${() => i.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=${r.x} y=${T.top} width=${r.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
|
-
${l.map((t) => {
|
|
642
|
-
let i = b.of(t.row.links?.[n], `${e} · ${t.row.label}`, `${e}, ${t.row.label}: ${o(t.row.values[n])}`);
|
|
643
|
-
return f`
|
|
644
|
-
<rect class="lintje-chart__mark lintje-chart__segment ${i.state}"
|
|
645
|
-
x=${r.x} y=${t.y1} width=${r.width} height=${t.height}
|
|
646
|
-
fill=${P(t.row, t.j)}
|
|
647
|
-
data-mark-id=${i.markId} role=${i.role} tabindex=${i.tabIndex}
|
|
648
|
-
aria-pressed=${i.pressed} aria-label=${i.label}
|
|
649
|
-
@click=${i.click} @keydown=${i.keydown} />
|
|
650
|
-
`;
|
|
651
|
-
})}
|
|
652
|
-
</g>
|
|
653
|
-
<!-- Percentages inside the segments when they are >= 16 px tall and fit the width. -->
|
|
654
|
-
${p ? l.map((e) => e.height >= 16 && u(d(e.value), D - 4) ? f`<text x=${r.center} y=${e.y1 + e.height / 2 + 4} text-anchor="middle"
|
|
655
|
-
class="lintje-chart__data-label ${F(e.j)}">${d(e.value)}</text>` : t) : t}
|
|
656
|
-
${A ? f`<text x=${r.center} y=${O(x[n], S, T) - 5} text-anchor="middle"
|
|
657
|
-
class="lintje-chart__data-label" font-weight="700">${c(x[n], r.bandWidth)}</text>` : t}
|
|
658
|
-
</g>
|
|
659
|
-
`;
|
|
660
|
-
});
|
|
661
|
-
return r`
|
|
662
|
-
<div class="lintje-chart-wrap ${_ ? "lintje-chart--small" : ""}"
|
|
663
|
-
${m(i.attach)} ?data-in-view=${i.inView} data-tooltip-anchor
|
|
664
|
-
@keydown=${(e) => i.dismiss(e) || b.escape(e)}>
|
|
665
|
-
${R({ items: z })}
|
|
666
|
-
${H({
|
|
667
|
-
fontFamily: i.fontFamily,
|
|
668
|
-
id: v,
|
|
669
|
-
ticks: C,
|
|
670
|
-
max: S,
|
|
671
|
-
area: T,
|
|
672
|
-
axisTitle: l,
|
|
673
|
-
description: a,
|
|
674
|
-
formatTick: w.format,
|
|
675
|
-
xLabels: s.map((e, t) => ({
|
|
676
|
-
label: e,
|
|
677
|
-
x: G(t, s.length, T).center
|
|
678
|
-
})),
|
|
679
|
-
interactive: b.interactive,
|
|
680
|
-
keys: L
|
|
681
|
-
}, ee)}
|
|
682
|
-
${V(i)}
|
|
683
|
-
${Y(i)}
|
|
684
|
-
</div>
|
|
685
|
-
`;
|
|
686
|
-
}
|
|
687
|
-
//#endregion
|
|
688
|
-
//#region src/components/shared/charts/pie-chart/pie-chart.ts
|
|
689
|
-
var ge = 5, _e = (e) => {
|
|
690
|
-
let t = e.label.toLowerCase();
|
|
691
|
-
return t.startsWith("overig") || t === "rest";
|
|
692
|
-
}, ve = (e) => !e.remainder && !_e(e);
|
|
693
|
-
function ye(e) {
|
|
694
|
-
let t = e.filter(ve).sort((e, t) => t.value - e.value), n = e.filter((e) => !e.remainder && _e(e)), r = e.filter((e) => e.remainder);
|
|
695
|
-
if (t.length > ge) {
|
|
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 be(e, n) {
|
|
716
|
-
let { controller: i, description: a } = n, { donut: s = !1, centerValue: c, centerLabel: l, legendTable: u = !0, labelHeader: p = "Categorie" } = e, g = i.id, _ = ye(e.segments).map((e) => ({
|
|
717
|
-
...e,
|
|
718
|
-
color: N(e.color)
|
|
719
|
-
})), v = _.map((e) => e.href ? {
|
|
720
|
-
id: e.id ?? e.label,
|
|
721
|
-
href: e.href
|
|
722
|
-
} : null), y = X(n, v), b = (e) => {
|
|
723
|
-
let t = y.of(v[e], _[e].label, _[e].label).state;
|
|
724
|
-
return t.includes("is-selected") ? "is-selected" : t.includes("is-muted") ? "is-muted" : "";
|
|
725
|
-
}, x = !!n.expanded;
|
|
726
|
-
i.measure(x ? {
|
|
727
|
-
width: !0,
|
|
728
|
-
height: "--chart-h-main"
|
|
729
|
-
} : {});
|
|
730
|
-
let S = x ? Math.max(240, Math.min(560, i.height - 24)) : e.size ?? 200, C = _.reduce((e, t) => e + t.value, 0), w = S / 2, T = s ? w * .62 : 0, E = pe(_.filter(ve).length, e.color), D = -1, O = _.map((e) => (ve(e) && (D += 1), e.color ?? (e.remainder ? "var(--color-chart-remainder)" : _e(e) ? "var(--color-chart-other)" : E[Math.min(D, E.length - 1)]))), k = -90, j = _.map((e, t) => {
|
|
731
|
-
let n = e.value / C, r = k, i = k + n * 360;
|
|
732
|
-
k = i;
|
|
733
|
-
let a = +(n > .5), o = (e, t) => [w + t * Math.cos(e * Math.PI / 180), w + t * Math.sin(e * Math.PI / 180)], [c, l] = o(r, w), [u, d] = o(i, w);
|
|
734
|
-
return {
|
|
735
|
-
segment: e,
|
|
736
|
-
i: t,
|
|
737
|
-
d: s ? (() => {
|
|
738
|
-
let [e, t] = o(i, T), [n, s] = o(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} ${s} Z`;
|
|
740
|
-
})() : `M ${w} ${w} L ${c} ${l} A ${w} ${w} 0 ${a} 1 ${u} ${d} Z`,
|
|
741
|
-
color: O[t]
|
|
742
|
-
};
|
|
743
|
-
}), P = i.hoverSegment, F = P == null ? void 0 : j[P], I = (e) => {
|
|
744
|
-
i.hoverSegment = e, i.requestUpdate();
|
|
745
|
-
};
|
|
746
|
-
return r`
|
|
747
|
-
<div class="lintje-pie-chart ${x ? "lintje-pie-chart--expanded" : ""}" ${m(i.attach)}
|
|
748
|
-
?data-in-view=${i.inView} data-tooltip-anchor
|
|
749
|
-
@keydown=${(e) => i.dismiss(e) || y.escape(e)}>
|
|
750
|
-
<svg viewBox="0 0 ${S} ${S}" width=${S} height=${S} role=${L(y.interactive)}
|
|
751
|
-
class="lintje-pie-chart__svg" aria-labelledby="${g}-desc" ${h(A(g))}>
|
|
752
|
-
<desc id="${g}-desc">${a}</desc>
|
|
753
|
-
<defs>${M(g)}</defs>
|
|
754
|
-
${j.map(({ segment: e, i: t, d: n, color: r }) => {
|
|
755
|
-
let a = y.of(v[t], e.label, `${e.label}: ${o(e.value)} · ${d(e.value / C * 100)}`);
|
|
756
|
-
return f`
|
|
757
|
-
<path d=${n} fill=${r}
|
|
758
|
-
class="lintje-pie-chart__segment lintje-chart__mark lintje-chart__segment ${P === t ? "is-hovered" : ""} ${a.state}"
|
|
759
|
-
${h({ "transform-origin": `${w}px ${w}px` })}
|
|
760
|
-
data-mark-id=${a.markId} role=${a.role} tabindex=${a.tabIndex}
|
|
761
|
-
aria-pressed=${a.pressed} aria-label=${a.label}
|
|
762
|
-
@click=${a.click} @keydown=${a.keydown}
|
|
763
|
-
@mousemove=${(n) => {
|
|
764
|
-
I(t), i.showTooltip(n, {
|
|
765
|
-
title: e.label,
|
|
766
|
-
rows: [{
|
|
767
|
-
label: "Aantal",
|
|
768
|
-
value: `${o(e.value)} · ${d(e.value / C * 100)}`,
|
|
769
|
-
color: r
|
|
770
|
-
}]
|
|
771
|
-
});
|
|
772
|
-
}}
|
|
773
|
-
@mouseleave=${() => {
|
|
774
|
-
i.hoverSegment = null, i.hideTooltip(), i.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
|
-
${F ? f`<path d=${F.d} fill=${F.color} class="lintje-pie-chart__lift lintje-chart__segment"
|
|
781
|
-
${h({ "transform-origin": `${w}px ${w}px` })} aria-hidden="true" />` : t}
|
|
782
|
-
${s && c ? f`
|
|
783
|
-
<text x=${w} y=${w + 2} text-anchor="middle" class="lintje-pie-chart__center">${c}</text>
|
|
784
|
-
${l ? f`<text x=${w} y=${w + 20} text-anchor="middle" class="lintje-chart__axis-label">${l}</text>` : t}
|
|
785
|
-
` : t}
|
|
786
|
-
</svg>
|
|
787
|
-
|
|
788
|
-
${u ? r`
|
|
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">${p}</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
|
-
${_.map((e, t) => r`
|
|
800
|
-
<tr class="lintje-pie-chart__row ${P === t ? "is-hovered" : ""} ${b(t)}"
|
|
801
|
-
@mouseenter=${() => I(t)} @mouseleave=${() => I(null)}>
|
|
802
|
-
<th scope="row" class="lintje-pie-chart__label">
|
|
803
|
-
<span class="lintje-pie-chart__marker" ${h({ background: O[t] })}></span>${e.label}
|
|
804
|
-
</th>
|
|
805
|
-
<td class="lintje-pie-chart__value">${o(e.value)}</td>
|
|
806
|
-
<td class="lintje-pie-chart__value">${d(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">${o(C)}</td>
|
|
814
|
-
<td class="lintje-pie-chart__total"></td>
|
|
815
|
-
</tr>
|
|
816
|
-
</tfoot>
|
|
817
|
-
</table>
|
|
818
|
-
` : t}
|
|
819
|
-
${V(i)}
|
|
820
|
-
</div>
|
|
821
|
-
`;
|
|
822
|
-
}
|
|
823
|
-
//#endregion
|
|
824
|
-
//#region src/components/shared/charts/dual-axis-chart/dual-axis-chart.ts
|
|
825
|
-
function xe(e, n) {
|
|
826
|
-
let { controller: i, description: a } = n, { labels: s, threshold: c, thresholdLabel: l, small: u = !1, pendingHours: d = 0 } = e, p = {
|
|
827
|
-
...e.left,
|
|
828
|
-
color: N(e.left.color)
|
|
829
|
-
}, g = {
|
|
830
|
-
...e.right,
|
|
831
|
-
color: N(e.right.color)
|
|
832
|
-
}, _ = i.id;
|
|
833
|
-
i.measure({
|
|
834
|
-
width: !0,
|
|
835
|
-
height: n.height ?? (u ? "--chart-h-small" : "--chart-h-main"),
|
|
836
|
-
fit: !!n.expanded && !n.mobile
|
|
837
|
-
});
|
|
838
|
-
let v = p.color ?? "var(--color-chart-default)", y = g.color ?? "var(--color-chart-dark-yellow)", b = j(Math.max(...p.values.filter((e) => e != null), 1)), x = j(Math.max(...g.values.filter((e) => e != null), c ?? 0, 1)), S = K(b.ticks, i.width, { fontFamily: i.fontFamily }), C = K(x.ticks, i.width, { fontFamily: i.fontFamily }), w = U(n, {
|
|
839
|
-
left: S.width,
|
|
840
|
-
right: C.width
|
|
841
|
-
}), T = w.height - w.bottom, E = [
|
|
842
|
-
{
|
|
843
|
-
label: `${p.label} (linkeras)`,
|
|
844
|
-
color: v,
|
|
845
|
-
shape: "square"
|
|
846
|
-
},
|
|
847
|
-
{
|
|
848
|
-
label: `${g.label} (rechteras)`,
|
|
849
|
-
color: y,
|
|
850
|
-
shape: "line"
|
|
851
|
-
},
|
|
852
|
-
...c == null ? [] : [{
|
|
853
|
-
label: l ?? `Norm ${c}`,
|
|
854
|
-
color: "var(--color-chart-emphasis)",
|
|
855
|
-
shape: "dashed"
|
|
856
|
-
}]
|
|
857
|
-
], D = Math.max(1, Math.ceil(s.length / 8)), k = i.hoverIndex, A = P(y), M = [[]];
|
|
858
|
-
g.values.forEach((e, t) => {
|
|
859
|
-
e == null ? M[M.length - 1].length && M.push([]) : M[M.length - 1].push(`${G(t, s.length, w).center},${O(e, x.max, w)}`);
|
|
860
|
-
});
|
|
861
|
-
let F = (e, t) => e == null ? "geen gegevens" : `${o(e)}${t ? ` ${t}` : ""}`, I = (e) => ({
|
|
862
|
-
title: s[e],
|
|
863
|
-
rows: [{
|
|
864
|
-
label: p.label,
|
|
865
|
-
value: F(p.values[e], p.unit),
|
|
866
|
-
color: v
|
|
867
|
-
}, {
|
|
868
|
-
label: g.label,
|
|
869
|
-
value: F(g.values[e], g.unit),
|
|
870
|
-
color: y
|
|
871
|
-
}]
|
|
872
|
-
}), z = J(i, s.length, (e) => ({
|
|
873
|
-
x: G(e, s.length, w).center,
|
|
874
|
-
y: Math.min(p.values[e] == null ? T : O(p.values[e], b.max, w), g.values[e] == null ? T : O(g.values[e], x.max, w)),
|
|
875
|
-
content: I(e)
|
|
876
|
-
}));
|
|
877
|
-
return r`
|
|
878
|
-
<div class="lintje-chart-wrap ${u ? "lintje-chart--small" : ""}"
|
|
879
|
-
${m(i.attach)} ?data-in-view=${i.inView} data-tooltip-anchor
|
|
880
|
-
@keydown=${(e) => i.dismiss(e)}>
|
|
881
|
-
${R({ items: E })}
|
|
882
|
-
<figure class="lintje-chart">
|
|
883
|
-
<svg viewBox="0 0 ${w.width} ${w.height}" class="lintje-chart__svg" role=${L(!1)}
|
|
884
|
-
aria-labelledby="${_}-desc" width=${w.width} height=${w.height}
|
|
885
|
-
tabindex="0" @keydown=${z.keydown} @focus=${z.focus} @blur=${z.blur}>
|
|
886
|
-
<desc id="${_}-desc">${a}</desc>
|
|
887
|
-
<defs>
|
|
888
|
-
<pattern id="hatch-${_}" 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 = G(s.length - d, s.length, w);
|
|
895
|
-
return f`<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-${_})" />`;
|
|
898
|
-
})() : t}
|
|
899
|
-
|
|
900
|
-
${b.ticks.map((e) => {
|
|
901
|
-
let t = O(e, b.max, w), n = e === 0;
|
|
902
|
-
return f`
|
|
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) => f`
|
|
914
|
-
<text x=${w.width - w.right + 8} y=${O(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
|
-
${p.values.map((e, t) => {
|
|
926
|
-
let n = G(t, s.length, w);
|
|
927
|
-
if (e == null) return f`<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-${_})" />`;
|
|
929
|
-
let r = O(e, b.max, w);
|
|
930
|
-
return f`
|
|
931
|
-
<g class="lintje-chart__bar-group ${k === t ? "is-hovered" : ""}"
|
|
932
|
-
${h(B(t, s.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
|
-
${c == null ? t : f`<line x1=${w.left} x2=${w.width - w.right}
|
|
940
|
-
y1=${O(c, x.max, w)} y2=${O(c, 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 n = e.join(" "), [r, i] = e[0].split(",");
|
|
946
|
-
return f`
|
|
947
|
-
${A && e.length > 1 ? f`<polyline class="lintje-chart__line lintje-chart__line--casing"
|
|
948
|
-
stroke=${A} points=${n} />` : t}
|
|
949
|
-
${e.length === 1 ? f`<circle cx=${r} cy=${i} r="2.5" fill=${y} />` : f`<polyline class="lintje-chart__line" stroke=${y} points=${n} />`}
|
|
950
|
-
`;
|
|
951
|
-
})}
|
|
952
|
-
</g>
|
|
953
|
-
|
|
954
|
-
${s.filter((e, t) => t % D === 0).map((e, t) => f`
|
|
955
|
-
<text x=${G(t * D, s.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
|
-
${k != null && g.values[k] != null ? f`<circle class="lintje-chart__hover-point" r="4" fill=${y}
|
|
961
|
-
cx=${G(k, s.length, w).center}
|
|
962
|
-
cy=${O(g.values[k], x.max, w)} />` : t}
|
|
963
|
-
${s.map((e, t) => {
|
|
964
|
-
let n = G(t, s.length, w);
|
|
965
|
-
return f`
|
|
966
|
-
<rect x=${n.x} y=${w.top} width=${n.bandWidth} height=${T - w.top}
|
|
967
|
-
fill="transparent"
|
|
968
|
-
@mousemove=${(e) => i.hoverAt(t, e, I(t))}
|
|
969
|
-
@mouseleave=${() => i.hoverAt(null)} />
|
|
970
|
-
`;
|
|
971
|
-
})}
|
|
972
|
-
</svg>
|
|
973
|
-
</figure>
|
|
974
|
-
${V(i)}
|
|
975
|
-
${Y(i)}
|
|
976
|
-
</div>
|
|
977
|
-
`;
|
|
978
|
-
}
|
|
979
|
-
//#endregion
|
|
980
|
-
//#region src/components/shared/charts/heatmap-chart/heatmap-classes.ts
|
|
981
|
-
var Q = [
|
|
982
|
-
"var(--color-chart-seq-1)",
|
|
983
|
-
"var(--color-chart-seq-2)",
|
|
984
|
-
"var(--color-chart-seq-3)",
|
|
985
|
-
"var(--color-chart-seq-4)",
|
|
986
|
-
"var(--color-chart-seq-5)"
|
|
987
|
-
], Se = Q.length, Ce = [
|
|
988
|
-
1,
|
|
989
|
-
2,
|
|
990
|
-
2.5,
|
|
991
|
-
5,
|
|
992
|
-
10
|
|
993
|
-
];
|
|
994
|
-
function we(e, t) {
|
|
995
|
-
if (!(e > 0) || !Number.isFinite(e)) return 1;
|
|
996
|
-
let n = 10 ** Math.floor(Math.log10(e)), r = 0, i = Infinity;
|
|
997
|
-
for (let a of Ce) {
|
|
998
|
-
let o = a * n;
|
|
999
|
-
if (t && !Number.isInteger(o)) continue;
|
|
1000
|
-
let s = Math.abs(Math.log(o / e));
|
|
1001
|
-
s < i && (i = s, r = o);
|
|
1002
|
-
}
|
|
1003
|
-
return r || (t ? 1 : n);
|
|
1004
|
-
}
|
|
1005
|
-
function Te(e, t) {
|
|
1006
|
-
let n = Math.max(0, Math.min(10, -Math.floor(Math.log10(t)) + 1));
|
|
1007
|
-
return Number(e.toFixed(n));
|
|
1008
|
-
}
|
|
1009
|
-
function Ee(e) {
|
|
1010
|
-
let t = [];
|
|
1011
|
-
for (let n of e) for (let e of n ?? []) e != null && Number.isFinite(e) && t.push(e);
|
|
1012
|
-
if (t.length === 0) return [];
|
|
1013
|
-
let n = Math.min(...t), r = Math.max(...t);
|
|
1014
|
-
if (n === r) return [];
|
|
1015
|
-
let i = t.every(Number.isInteger), a = we((r - n) / Se, i), o = Math.floor(n / a) * a, s = [];
|
|
1016
|
-
for (let e = 1; e < Se; e += 1) {
|
|
1017
|
-
let t = Te(o + e * a, a);
|
|
1018
|
-
if (t > r) break;
|
|
1019
|
-
s.push(t);
|
|
1020
|
-
}
|
|
1021
|
-
return s;
|
|
1022
|
-
}
|
|
1023
|
-
function $(e, t, n = 0) {
|
|
1024
|
-
let r = o(e, n), i = t?.trim() ?? "";
|
|
1025
|
-
return i ? i === "%" ? `${r}%` : `${r} ${i}` : r;
|
|
1026
|
-
}
|
|
1027
|
-
function De(e) {
|
|
1028
|
-
let t = 0;
|
|
1029
|
-
for (let n of e) {
|
|
1030
|
-
let e = String(n), r = e.indexOf(".");
|
|
1031
|
-
r >= 0 && (t = Math.max(t, e.length - r - 1));
|
|
1032
|
-
}
|
|
1033
|
-
return Math.min(t, 4);
|
|
1034
|
-
}
|
|
1035
|
-
function Oe(e, t = {}) {
|
|
1036
|
-
let n = (t.bounds?.length ? t.bounds.slice(0, Se - 1) : null) ?? Ee(e), r = De(n), i = (e) => $(e, t.unit, r), a = (e) => o(e, r);
|
|
1037
|
-
if (n.length === 0) {
|
|
1038
|
-
let e = Q.length - 1;
|
|
1039
|
-
return [{
|
|
1040
|
-
limit: Infinity,
|
|
1041
|
-
color: Q[e],
|
|
1042
|
-
label: "alle waarden",
|
|
1043
|
-
ramp: e
|
|
1044
|
-
}];
|
|
1045
|
-
}
|
|
1046
|
-
return [
|
|
1047
|
-
{
|
|
1048
|
-
limit: n[0],
|
|
1049
|
-
color: Q[0],
|
|
1050
|
-
label: `< ${i(n[0])}`,
|
|
1051
|
-
ramp: 0
|
|
1052
|
-
},
|
|
1053
|
-
...n.slice(1).map((e, t) => ({
|
|
1054
|
-
limit: e,
|
|
1055
|
-
color: Q[t + 1],
|
|
1056
|
-
label: `${a(n[t])}–${i(e)}`,
|
|
1057
|
-
ramp: t + 1
|
|
1058
|
-
})),
|
|
1059
|
-
{
|
|
1060
|
-
limit: Infinity,
|
|
1061
|
-
color: Q[n.length],
|
|
1062
|
-
label: `≥ ${i(n[n.length - 1])}`,
|
|
1063
|
-
ramp: n.length
|
|
1064
|
-
}
|
|
1065
|
-
];
|
|
1066
|
-
}
|
|
1067
|
-
function ke(e, t) {
|
|
1068
|
-
let n = e.findIndex((e) => t < e.limit);
|
|
1069
|
-
return n === -1 ? e.length - 1 : n;
|
|
1070
|
-
}
|
|
1071
|
-
//#endregion
|
|
1072
|
-
//#region src/components/shared/charts/heatmap-chart/heatmap-chart.ts
|
|
1073
|
-
function Ae(e, t, n) {
|
|
1074
|
-
return Array.from({ length: n }, (n, r) => Array.from({ length: t }, (t, n) => e?.[n]?.[r]));
|
|
1075
|
-
}
|
|
1076
|
-
function je(e) {
|
|
1077
|
-
if (e.mobile) return e.mobile;
|
|
1078
|
-
let t = e.rowLabels.length, n = e.columnLabels.length;
|
|
1079
|
-
if (!(n <= t)) return {
|
|
1080
|
-
columnLabels: e.rowLabels,
|
|
1081
|
-
rowLabels: e.columnLabels,
|
|
1082
|
-
values: Ae(e.values, t, n),
|
|
1083
|
-
links: e.links ? Ae(e.links, t, n) : void 0
|
|
1084
|
-
};
|
|
1085
|
-
}
|
|
1086
|
-
function Me(e, n) {
|
|
1087
|
-
let { controller: i, description: a, mobile: s = !1 } = n, c = s ? je(e) : void 0, l = c?.columnLabels ?? e.columnLabels, u = c?.rowLabels ?? e.rowLabels, d = c?.values ?? e.values, f = c ? c.links : e.links, p = c ? !0 : e.compact ?? !1, { unit: g } = e, _ = X(n, (f ?? []).flat()), v = Oe(d, {
|
|
1088
|
-
bounds: e.bounds,
|
|
1089
|
-
unit: g
|
|
1090
|
-
}), y = (e) => ke(v, e);
|
|
1091
|
-
i.measure({});
|
|
1092
|
-
let b = i.selectedCell, x = i.dimmedClass;
|
|
1093
|
-
return r`
|
|
1094
|
-
<div class="lintje-heatmap" ${m(i.attach)} ?data-in-view=${i.inView}
|
|
1095
|
-
data-tooltip-anchor @keydown=${_.escape}>
|
|
1096
|
-
<table class="lintje-heatmap__grid ${p ? "is-compact" : ""}">
|
|
1097
|
-
<caption class="visually-hidden">${a}</caption>
|
|
1098
|
-
<thead>
|
|
1099
|
-
<tr>
|
|
1100
|
-
<td></td>
|
|
1101
|
-
${l.map((e) => r`<th scope="col" class="lintje-heatmap__column-label">${e}</th>`)}
|
|
1102
|
-
</tr>
|
|
1103
|
-
</thead>
|
|
1104
|
-
<tbody>
|
|
1105
|
-
${u.map((e, t) => r`
|
|
1106
|
-
<tr>
|
|
1107
|
-
<th scope="row" class="lintje-heatmap__row-label" title=${e}>
|
|
1108
|
-
<span class="lintje-heatmap__row-label-text">${e}</span>
|
|
1109
|
-
</th>
|
|
1110
|
-
${l.map((n, a) => {
|
|
1111
|
-
let s = d[t]?.[a];
|
|
1112
|
-
if (s == null) return r`
|
|
1113
|
-
<td class="lintje-heatmap__slot">
|
|
1114
|
-
<div class="lintje-heatmap__cell is-empty"
|
|
1115
|
-
title="${e} · ${l[a]}: geen meting">
|
|
1116
|
-
<span class="visually-hidden">geen meting</span>
|
|
1117
|
-
</div>
|
|
1118
|
-
</td>
|
|
1119
|
-
`;
|
|
1120
|
-
let c = y(s), m = _.of(f?.[t]?.[a], `${e} · ${l[a]}`), S = !m.clickable && b?.row === t && b?.column === a;
|
|
1121
|
-
return r`
|
|
1122
|
-
<td class="lintje-heatmap__slot">
|
|
1123
|
-
<button
|
|
1124
|
-
type="button"
|
|
1125
|
-
class="lintje-heatmap__cell lintje-heatmap__cell--class-${v[c].ramp} ${S ? "is-selected" : ""} ${x != null && x !== c ? "is-dimmed" : ""} ${m.state}"
|
|
1126
|
-
data-mark-id=${m.markId}
|
|
1127
|
-
${h({
|
|
1128
|
-
"--lintje-cell": v[c].color,
|
|
1129
|
-
...te(a, t, l.length, u.length)
|
|
1130
|
-
})}
|
|
1131
|
-
@click=${m.clickable ? m.click : () => {
|
|
1132
|
-
i.selectedCell = S ? null : {
|
|
1133
|
-
row: t,
|
|
1134
|
-
column: a
|
|
1135
|
-
}, i.requestUpdate();
|
|
1136
|
-
}}
|
|
1137
|
-
@mousemove=${p ? void 0 : (t) => i.showTooltip(t, {
|
|
1138
|
-
title: `${e} · ${l[a]}`,
|
|
1139
|
-
rows: [{
|
|
1140
|
-
label: `klasse ${v[c].label}`,
|
|
1141
|
-
value: $(s, g),
|
|
1142
|
-
color: v[c].color
|
|
1143
|
-
}]
|
|
1144
|
-
})}
|
|
1145
|
-
@mouseleave=${p ? void 0 : () => i.hideTooltip()}
|
|
1146
|
-
aria-pressed=${m.clickable ? m.pressed : S}
|
|
1147
|
-
aria-label="${e} ${l[a]}: ${$(s, g)}, klasse ${v[c].label}"
|
|
1148
|
-
>${o(s)}</button>
|
|
1149
|
-
</td>
|
|
1150
|
-
`;
|
|
1151
|
-
})}
|
|
1152
|
-
</tr>
|
|
1153
|
-
`)}
|
|
1154
|
-
</tbody>
|
|
1155
|
-
</table>
|
|
1156
|
-
|
|
1157
|
-
<!-- Selected cell: a 48 px line with day, block, value, class. -->
|
|
1158
|
-
${b && d[b.row]?.[b.column] != null ? r`
|
|
1159
|
-
<p class="lintje-heatmap__selection">
|
|
1160
|
-
<b>${u[b.row]} ${l[b.column]}</b> ·
|
|
1161
|
-
${$(d[b.row][b.column], g)} · klasse
|
|
1162
|
-
${v[y(d[b.row][b.column])].label}
|
|
1163
|
-
</p>
|
|
1164
|
-
` : t}
|
|
1165
|
-
|
|
1166
|
-
<!-- Class legend: clickable, dims the other classes to .25. -->
|
|
1167
|
-
<ul class="lintje-heatmap__legend">
|
|
1168
|
-
${v.map((e, t) => r`
|
|
1169
|
-
<li>
|
|
1170
|
-
<button type="button" class="lintje-heatmap__legend-item ${x != null && x !== t ? "is-dimmed" : ""}"
|
|
1171
|
-
@click=${() => {
|
|
1172
|
-
i.dimmedClass = x === t ? null : t, i.requestUpdate();
|
|
1173
|
-
}}
|
|
1174
|
-
aria-pressed=${x === t}>
|
|
1175
|
-
<span class="lintje-heatmap__swatch lintje-heatmap__swatch--class-${e.ramp}" ${h({ background: e.color })}></span>
|
|
1176
|
-
<span>${e.label}</span>
|
|
1177
|
-
</button>
|
|
1178
|
-
</li>
|
|
1179
|
-
`)}
|
|
1180
|
-
</ul>
|
|
1181
|
-
${V(i)}
|
|
1182
|
-
</div>
|
|
1183
|
-
`;
|
|
1184
|
-
}
|
|
1185
|
-
//#endregion
|
|
1186
|
-
//#region src/components/shared/charts/shared/render-chart.ts
|
|
1187
|
-
function Ne(e, t) {
|
|
1188
|
-
switch (e.kind) {
|
|
1189
|
-
case "line": return ae(e, t);
|
|
1190
|
-
case "bar": return ce(e, t);
|
|
1191
|
-
case "horizontal-bar": return le(e, t);
|
|
1192
|
-
case "target-progress": return ue(e, t);
|
|
1193
|
-
case "grouped-bar": return de(e, t);
|
|
1194
|
-
case "stacked-bar": return he(e, t);
|
|
1195
|
-
case "pie": return be(e, t);
|
|
1196
|
-
case "dual-axis": return xe(e, t);
|
|
1197
|
-
case "heatmap": return Me(e, t);
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
//#endregion
|
|
1201
|
-
//#region src/components/charts/chart-tile/chart-tile.css?inline
|
|
1202
|
-
var Pe = "/* ------------------------------------------------------------------------ */\n\n.lintje-chart-tile__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-tile__view { --h-control: var(--h-touch); width: 100%; }\n}\n", Fe = ".lintje-chart__svg, .lintje-pie-chart__svg", Ie = [{
|
|
1203
|
-
value: "chart",
|
|
1204
|
-
label: "Grafiek"
|
|
1205
|
-
}, {
|
|
1206
|
-
value: "table",
|
|
1207
|
-
label: "Tabel"
|
|
1208
|
-
}];
|
|
1209
|
-
function Le(e) {
|
|
1210
|
-
return (e ?? "").normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "grafiek";
|
|
1211
|
-
}
|
|
1212
|
-
function Re(e) {
|
|
1213
|
-
switch (e.kind) {
|
|
1214
|
-
case "line":
|
|
1215
|
-
case "dual-axis": return "line";
|
|
1216
|
-
case "pie": return e.donut ? "donut" : "pie";
|
|
1217
|
-
case "heatmap": return "heatmap";
|
|
1218
|
-
default: return "bar";
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
function ze(e) {
|
|
1222
|
-
switch (e.kind) {
|
|
1223
|
-
case "horizontal-bar":
|
|
1224
|
-
case "target-progress": return e.rows.length ? `${Z(e.rows.length)}px` : void 0;
|
|
1225
|
-
case "pie":
|
|
1226
|
-
case "heatmap": return;
|
|
1227
|
-
default: return e.small ? "var(--chart-h-small)" : void 0;
|
|
1228
|
-
}
|
|
1229
|
-
}
|
|
1230
|
-
function Be(e) {
|
|
1231
|
-
switch (e.kind) {
|
|
1232
|
-
case "line": return [["", ...e.series.map((e) => e.label)], ...e.labels.map((t, n) => [t, ...e.series.map((e) => e.values[n])])];
|
|
1233
|
-
case "bar": return [[
|
|
1234
|
-
"",
|
|
1235
|
-
e.axisTitle ?? "Waarde",
|
|
1236
|
-
...e.trend ? ["Trend"] : []
|
|
1237
|
-
], ...e.labels.map((t, n) => [
|
|
1238
|
-
t,
|
|
1239
|
-
e.values[n],
|
|
1240
|
-
...e.trend ? [e.trend[n]] : []
|
|
1241
|
-
])];
|
|
1242
|
-
case "horizontal-bar": return [["", e.unit ? `Waarde (${e.unit})` : "Waarde"], ...e.rows.map((e) => [e.label, e.value])];
|
|
1243
|
-
case "target-progress": return [[
|
|
1244
|
-
"",
|
|
1245
|
-
"Voortgang (%)",
|
|
1246
|
-
"Doel (%)"
|
|
1247
|
-
], ...e.rows.map((t) => [
|
|
1248
|
-
t.label,
|
|
1249
|
-
t.value,
|
|
1250
|
-
e.target ?? 100
|
|
1251
|
-
])];
|
|
1252
|
-
case "grouped-bar":
|
|
1253
|
-
case "stacked-bar": return [["", ...e.series.map((e) => e.label)], ...e.labels.map((t, n) => [t, ...e.series.map((e) => e.values[n])])];
|
|
1254
|
-
case "pie": return [["", "Aantal"], ...e.segments.map((e) => [e.label, e.value])];
|
|
1255
|
-
case "dual-axis": {
|
|
1256
|
-
let t = (e) => e.unit ? `${e.label} (${e.unit})` : e.label;
|
|
1257
|
-
return [[
|
|
1258
|
-
"",
|
|
1259
|
-
t(e.left),
|
|
1260
|
-
t(e.right)
|
|
1261
|
-
], ...e.labels.map((t, n) => [
|
|
1262
|
-
t,
|
|
1263
|
-
e.left.values[n],
|
|
1264
|
-
e.right.values[n]
|
|
1265
|
-
])];
|
|
1266
|
-
}
|
|
1267
|
-
case "heatmap": return [["", ...e.columnLabels], ...e.rowLabels.map((t, n) => [t, ...e.values[n] ?? []])];
|
|
1268
|
-
}
|
|
1269
|
-
}
|
|
1270
|
-
function Ve(e) {
|
|
1271
|
-
return e.reduce((e, t) => {
|
|
1272
|
-
if (typeof t != "number" || Number.isInteger(t)) return e;
|
|
1273
|
-
let n = String(t).split(".")[1] ?? "";
|
|
1274
|
-
return Math.max(e, n.length);
|
|
1275
|
-
}, 0);
|
|
1276
|
-
}
|
|
1277
|
-
function He(e, t) {
|
|
1278
|
-
let [n = [], ...r] = Be(e), i = n.map((e, t) => {
|
|
1279
|
-
let n = r.map((e) => e[t] ?? null);
|
|
1280
|
-
return t === 0 ? {
|
|
1281
|
-
key: `c${t}`,
|
|
1282
|
-
header: String(e ?? ""),
|
|
1283
|
-
format: "text",
|
|
1284
|
-
sortable: !1
|
|
1285
|
-
} : {
|
|
1286
|
-
key: `c${t}`,
|
|
1287
|
-
header: String(e ?? ""),
|
|
1288
|
-
format: "decimal",
|
|
1289
|
-
decimals: Ve(n),
|
|
1290
|
-
align: "right",
|
|
1291
|
-
sortable: !1
|
|
1292
|
-
};
|
|
1293
|
-
});
|
|
1294
|
-
return {
|
|
1295
|
-
caption: t,
|
|
1296
|
-
columns: i,
|
|
1297
|
-
rows: r.map((e, t) => ({
|
|
1298
|
-
row: String(t),
|
|
1299
|
-
...Object.fromEntries(i.map((t, n) => [t.key, e[n] ?? null]))
|
|
1300
|
-
})),
|
|
1301
|
-
rowKey: "row",
|
|
1302
|
-
defaultSort: {
|
|
1303
|
-
key: "row",
|
|
1304
|
-
direction: "asc"
|
|
1305
|
-
},
|
|
1306
|
-
pageSize: Math.max(r.length, 1)
|
|
1307
|
-
};
|
|
1308
|
-
}
|
|
1309
|
-
var Ue = class extends b {
|
|
1310
|
-
constructor(...e) {
|
|
1311
|
-
super(...e), this.view = "chart", this.#e = new k(() => this.requestUpdate()), this.#t = null, this.#n = new i(this);
|
|
1312
|
-
}
|
|
1313
|
-
static {
|
|
1314
|
-
this.styles = [
|
|
1315
|
-
l,
|
|
1316
|
-
n(_),
|
|
1317
|
-
n(g),
|
|
1318
|
-
n(a),
|
|
1319
|
-
...x,
|
|
1320
|
-
n(Pe)
|
|
1321
|
-
];
|
|
1322
|
-
}
|
|
1323
|
-
static {
|
|
1324
|
-
this.properties = {
|
|
1325
|
-
data: { attribute: !1 },
|
|
1326
|
-
view: { state: !0 }
|
|
1327
|
-
};
|
|
1328
|
-
}
|
|
1329
|
-
#e;
|
|
1330
|
-
#t;
|
|
1331
|
-
#n;
|
|
1332
|
-
get dataSettings() {
|
|
1333
|
-
return this.data ?? void 0;
|
|
1334
|
-
}
|
|
1335
|
-
disconnectedCallback() {
|
|
1336
|
-
this.#e.detach(), this.#t?.detach(), this.#t = null, super.disconnectedCallback();
|
|
1337
|
-
}
|
|
1338
|
-
get ready() {
|
|
1339
|
-
return (this.data?.state ?? "ready") === "ready";
|
|
1340
|
-
}
|
|
1341
|
-
get showsTable() {
|
|
1342
|
-
return !!this.data?.tableSwitch && this.ready && this.view === "table";
|
|
1343
|
-
}
|
|
1344
|
-
get expandable() {
|
|
1345
|
-
return this.data?.expandable !== !1;
|
|
1346
|
-
}
|
|
1347
|
-
get downloadName() {
|
|
1348
|
-
let e = this.data?.download;
|
|
1349
|
-
return e === !1 ? null : e?.filename ?? Le(this.data?.title);
|
|
1350
|
-
}
|
|
1351
|
-
csv() {
|
|
1352
|
-
let e = this.data, t = this.downloadName;
|
|
1353
|
-
e && t !== null && T(t, Be(e.chart));
|
|
1354
|
-
}
|
|
1355
|
-
png() {
|
|
1356
|
-
let e = this.data;
|
|
1357
|
-
if (!e) return;
|
|
1358
|
-
let t = this.renderRoot.querySelector(this.expanded ? "lintje-modal" : "lintje-tile")?.querySelector(Fe);
|
|
1359
|
-
t && S(this.downloadName ?? Le(e.title), t);
|
|
1360
|
-
}
|
|
1361
|
-
expandChanged(e) {
|
|
1362
|
-
e ? this.#t ??= new k(() => this.requestUpdate()) : (this.#t?.detach(), this.#t = null);
|
|
1363
|
-
}
|
|
1364
|
-
render() {
|
|
1365
|
-
let e = this.data;
|
|
1366
|
-
if (!e) return t;
|
|
1367
|
-
let n = this.ready, i = this.#n.matches && e.mobileSubtitle ? e.mobileSubtitle : e.subtitle, a = this.id ? `${this.id}-tile` : void 0, o = e.tableSwitch && n ? this.viewSwitch() : t, s = this.showsTable;
|
|
1368
|
-
return r`<lintje-tile
|
|
1369
|
-
id=${a ?? t}
|
|
1370
|
-
span=${e.span ?? t}
|
|
1371
|
-
heading=${e.title ?? t}
|
|
1372
|
-
icon=${e.icon ?? t}
|
|
1373
|
-
subtitle=${i ?? t}
|
|
1374
|
-
intro=${e.intro ?? t}
|
|
1375
|
-
footnote=${e.footnote ?? t}
|
|
1376
|
-
?legend-below=${!!e.legendBelow}
|
|
1377
|
-
?expandable=${this.expandable && n}
|
|
1378
|
-
?download=${this.downloadName !== null && n}
|
|
1379
|
-
@lintje-tile-expand=${(e) => {
|
|
1380
|
-
e.stopPropagation(), this.expand(!0);
|
|
1381
|
-
}}
|
|
1382
|
-
@lintje-tile-download=${(e) => {
|
|
1383
|
-
e.stopPropagation(), this.csv();
|
|
1384
|
-
}}
|
|
1385
|
-
>
|
|
1386
|
-
${o}
|
|
1387
|
-
${e.notice ? r`<lintje-announcement
|
|
1388
|
-
slot="notice"
|
|
1389
|
-
compact
|
|
1390
|
-
.data=${e.notice}
|
|
1391
|
-
></lintje-announcement>` : t}
|
|
1392
|
-
${this.content()}
|
|
1393
|
-
</lintje-tile>
|
|
1394
|
-
|
|
1395
|
-
${this.renderExpandModal(this.expanded ? s ? this.table() : this.#t ? Ne(e.chart, {
|
|
1396
|
-
...this.chartOptions(this.#t),
|
|
1397
|
-
expanded: !0
|
|
1398
|
-
}) : t : t, {
|
|
1399
|
-
heading: e.title,
|
|
1400
|
-
subtitle: i,
|
|
1401
|
-
footnote: e.footnote,
|
|
1402
|
-
csv: () => this.csv(),
|
|
1403
|
-
png: s ? void 0 : () => this.png()
|
|
1404
|
-
})}`;
|
|
1405
|
-
}
|
|
1406
|
-
content() {
|
|
1407
|
-
let e = this.data, t = ze(e.chart);
|
|
1408
|
-
switch (e.state ?? "ready") {
|
|
1409
|
-
case "loading": return y({
|
|
1410
|
-
kind: Re(e.chart),
|
|
1411
|
-
height: t
|
|
1412
|
-
});
|
|
1413
|
-
case "empty": return C(e.message, t);
|
|
1414
|
-
case "error": return w({
|
|
1415
|
-
message: e.message,
|
|
1416
|
-
lastKnown: e.lastKnown,
|
|
1417
|
-
height: t,
|
|
1418
|
-
announcement: v
|
|
1419
|
-
});
|
|
1420
|
-
default: return this.showsTable ? this.table() : Ne(e.chart, this.chartOptions(this.#e));
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
viewSwitch() {
|
|
1424
|
-
let e = this.#n.matches;
|
|
1425
|
-
return r`<lintje-segmented
|
|
1426
|
-
class="lintje-chart-tile__view"
|
|
1427
|
-
slot=${e ? "notice" : "actions"}
|
|
1428
|
-
label="Weergave"
|
|
1429
|
-
hide-label
|
|
1430
|
-
?stacked=${e}
|
|
1431
|
-
.value=${this.view}
|
|
1432
|
-
.options=${Ie}
|
|
1433
|
-
@lintje-change=${(e) => {
|
|
1434
|
-
e.stopPropagation(), this.view = e.detail === "table" ? "table" : "chart";
|
|
1435
|
-
}}
|
|
1436
|
-
></lintje-segmented>`;
|
|
1437
|
-
}
|
|
1438
|
-
table() {
|
|
1439
|
-
let e = this.data, t = e.title ? `${e.title}, als tabel` : "Grafiek als tabel";
|
|
1440
|
-
return r`<lintje-data-table
|
|
1441
|
-
class="lintje-chart-tile__table"
|
|
1442
|
-
bare
|
|
1443
|
-
.data=${He(e.chart, t)}
|
|
1444
|
-
></lintje-data-table>`;
|
|
1445
|
-
}
|
|
1446
|
-
async focusMark(e) {
|
|
1447
|
-
await this.updateComplete;
|
|
1448
|
-
let t = this.renderRoot.querySelector(this.expanded ? "lintje-modal" : "lintje-tile"), n = t?.querySelector(`[data-mark-id="${CSS.escape(e)}"]`) ?? t?.querySelector(`${Fe}, .lintje-heatmap`);
|
|
1449
|
-
n && !n.hasAttribute("tabindex") && n.setAttribute("tabindex", "-1"), n?.focus();
|
|
1450
|
-
}
|
|
1451
|
-
chartOptions(e) {
|
|
1452
|
-
return {
|
|
1453
|
-
controller: e,
|
|
1454
|
-
description: this.data?.description ?? "",
|
|
1455
|
-
mobile: this.#n.matches,
|
|
1456
|
-
selectedId: this.data?.selectedId ?? null,
|
|
1457
|
-
onSelect: ({ id: e, label: t, href: n }) => this.emit("lintje-mark-select", {
|
|
1458
|
-
id: e,
|
|
1459
|
-
label: t,
|
|
1460
|
-
href: n
|
|
1461
|
-
}),
|
|
1462
|
-
onClear: (e) => {
|
|
1463
|
-
this.emit("lintje-mark-select", {
|
|
1464
|
-
id: null,
|
|
1465
|
-
label: null,
|
|
1466
|
-
href: this.data?.clearHref
|
|
1467
|
-
}), this.focusMark(e);
|
|
1468
|
-
}
|
|
1469
|
-
};
|
|
1470
|
-
}
|
|
1471
|
-
};
|
|
1472
|
-
e("lintje-chart-tile", Ue);
|
|
1473
|
-
//#endregion
|
|
1474
|
-
export { Ue as LintjeChartTile };
|