@iota-uz/sdk 0.5.4 → 0.5.6
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/client-host/identity.d.ts +4 -4
- package/dist/client-host/identity.js +2 -2
- package/dist/lens/{CascadePanel-CdeeYZsY.js → CascadePanel-8eBL6DV0.js} +1 -1
- package/dist/lens/{ChartHost-DLcWF7pC.js → ChartHost-rxIhps-d.js} +2 -2
- package/dist/lens/ChartPanel-DCQW-AER.js +729 -0
- package/dist/lens/{CoveragePanel-C5Y50Ja8.js → CoveragePanel-CxzKUDi7.js} +1 -1
- package/dist/lens/DashboardPanels.d.ts.map +1 -1
- package/dist/lens/{GaugePanel-QdD8-G_m.js → GaugePanel-DxugJaW9.js} +1 -1
- package/dist/lens/{MapPanel-BYrx4srW.js → MapPanel-CSaipUVx.js} +2 -2
- package/dist/lens/{MetricFlowPanel-LreyGLdP.js → MetricFlowPanel-DboMsdRV.js} +2 -2
- package/dist/lens/{MetricHierarchyPanel-DvIh-llg.js → MetricHierarchyPanel-CB4VzfzW.js} +2 -2
- package/dist/lens/{MetricRelationshipPanel-C-aL3I9t.js → MetricRelationshipPanel-Cc5q2404.js} +2 -2
- package/dist/lens/{PrintReport-QqzDAR7K.js → PrintReport-B1Sz9tpp.js} +5 -5
- package/dist/lens/{TablePanel-DFfsYjWR.js → TablePanel-DmexOyme.js} +1 -1
- package/dist/lens/{adapter-BoXhQplf.js → adapter-D1rmM8ve.js} +143 -124
- package/dist/lens/charts/echarts/options.d.ts.map +1 -1
- package/dist/lens/contract/schemas.d.ts +1 -0
- package/dist/lens/contract/schemas.d.ts.map +1 -1
- package/dist/lens/contract/types.d.ts +5 -0
- package/dist/lens/contract/types.d.ts.map +1 -1
- package/dist/lens/controls/FilterBar.d.ts +5 -0
- package/dist/lens/controls/FilterBar.d.ts.map +1 -1
- package/dist/lens/{index-C3g4ib1H.js → index-BVG-TPw8.js} +2422 -2405
- package/dist/lens/{index-D16WayLn.js → index-DNVZzuf-.js} +1 -1
- package/dist/lens/index.js +1 -1
- package/dist/lens/{install-DiwRwFDZ.js → install-B84coHbE.js} +1 -1
- package/dist/lens/{install-Cw9b8dcU.js → install-BBDdlL7p.js} +1 -1
- package/dist/lens/{install-4afWuWQV.js → install-D185mcsK.js} +1 -1
- package/dist/lens/{install-DCnlqrJl.js → install-DEcc_o1k.js} +1 -1
- package/dist/lens/{metricViews-qsMUANFL.js → metricViews-CeM9-z5k.js} +1 -1
- package/dist/lens/panels/ChartPanel.d.ts.map +1 -1
- package/dist/lens/{prefetch-3fl1oLRK.js → prefetch-B-dQcQXC.js} +2 -2
- package/dist/lens/{prefetchPanels-DjyNoBKV.js → prefetchPanels-E12FEaLx.js} +1 -1
- package/dist/lens/{print-D6eDEk5V.js → print-UTQOLwVp.js} +1 -1
- package/dist/lens/{scales-CuZBfqCM.js → scales-DvqEigLb.js} +2 -2
- package/dist/lens/style.css +1 -1
- package/dist/sdk-identity.cjs +3 -3
- package/dist/sdk-identity.js +3 -3
- package/dist/sdk-identity.json +2 -2
- package/package.json +1 -1
- package/dist/lens/ChartPanel-DBX4StoU.js +0 -720
|
@@ -1,720 +0,0 @@
|
|
|
1
|
-
import { jsxs as k, jsx as l, Fragment as Ee } from "react/jsx-runtime";
|
|
2
|
-
import { useState as re, useRef as $e, useCallback as Ae, useEffect as be, useMemo as K, memo as vt, useLayoutEffect as Ct, Fragment as Lt } from "react";
|
|
3
|
-
import { r as At, f as kt } from "./keys-DenV5HsJ.js";
|
|
4
|
-
import { s as Rt, o as _e, c as Kt, a as Tt, b as Ft, d as Et, f as Mt } from "./scales-CuZBfqCM.js";
|
|
5
|
-
import { o as Bt, u as Re, a as wt, t as Ht, x as lt, y as dt, l as _t, z as zt, A as Ot, B as Ut, C as Vt, k as Dt, D as $t, E as Pt, F as gt, h as yt, s as bt, G as pt, H as qt, I as jt, g as Wt, J as Qt, K as Zt, P as Gt, W as Jt, L as H, M as ut, N as Yt, O as ze, Q as Xt, R as eo, S as to, T as oo } from "./index-C3g4ib1H.js";
|
|
6
|
-
import "@iota-uz/sdk/client-host";
|
|
7
|
-
import { c as no, C as ro } from "./ChartDataEquivalent-BFDdHoQn.js";
|
|
8
|
-
import { C as so } from "./ChartHost-DLcWF7pC.js";
|
|
9
|
-
const io = 0.02, ao = oo, co = 4;
|
|
10
|
-
function lo(e) {
|
|
11
|
-
const n = H(), t = H(e.encoding.label ? e.format[e.encoding.label] : void 0), r = H(e.encoding.value ? e.format[e.encoding.value] : void 0), c = H(e.encoding.previous ? e.format[e.encoding.previous] : void 0), a = H(e.encoding.lower ? e.format[e.encoding.lower] : void 0), m = H(e.encoding.q1 ? e.format[e.encoding.q1] : void 0), y = H(e.encoding.median ? e.format[e.encoding.median] : void 0), f = H(e.encoding.q3 ? e.format[e.encoding.q3] : void 0), b = H(e.encoding.upper ? e.format[e.encoding.upper] : void 0), v = H(e.encoding.id ? e.format[e.encoding.id] : void 0), T = H(e.encoding.series ? e.format[e.encoding.series] : void 0), h = H(e.encoding.category ? e.format[e.encoding.category] : void 0), u = H(e.encoding.cut ? e.format[e.encoding.cut] : void 0), N = H(e.encoding.cutLabel ? e.format[e.encoding.cutLabel] : void 0), se = H(e.encoding.final ? e.format[e.encoding.final] : void 0), V = ut(e.encoding.value ? e.format[e.encoding.value] : void 0), Y = ut(e.encoding.median ? e.format[e.encoding.median] : void 0), _ = K(() => {
|
|
12
|
-
const M = { label: t, value: r, previous: c, lower: a, q1: m, median: y, q3: f, upper: b, id: v, series: T, category: h, cut: u, cutLabel: N, final: se }, A = /* @__PURE__ */ new Map();
|
|
13
|
-
for (const C of Yt) {
|
|
14
|
-
const X = e.encoding[C], R = M[C];
|
|
15
|
-
X && R && A.set(X, R);
|
|
16
|
-
}
|
|
17
|
-
return (C, X) => (A.get(C) ?? n)(X);
|
|
18
|
-
}, [h, u, N, n, se, v, t, a, y, e.encoding, c, m, f, T, b, r]), ne = K(() => {
|
|
19
|
-
const M = e.encoding.value, A = e.encoding.median;
|
|
20
|
-
return (C, X) => M && C === M ? V(X) : A && C === A ? Y(X) : _(C, X);
|
|
21
|
-
}, [Y, _, e.encoding.median, e.encoding.value, V]);
|
|
22
|
-
return K(() => ({ format: _, formatAxis: ne }), [_, ne]);
|
|
23
|
-
}
|
|
24
|
-
function Oe(e, n, t) {
|
|
25
|
-
var y, f;
|
|
26
|
-
const r = n.encoding.id ? e.columns.findIndex((b) => b.name === n.encoding.id) : -1, c = [n.encoding.category, n.encoding.label].find((b) => !!b && e.columns.some((v) => v.name === b)), a = e.columns.findIndex((b) => b.name === c), m = r >= 0 ? (y = e.rows[t]) == null ? void 0 : y[r] : (f = e.rows[t]) == null ? void 0 : f[a];
|
|
27
|
-
return String(typeof m == "string" || typeof m == "number" || typeof m == "bigint" ? m : t);
|
|
28
|
-
}
|
|
29
|
-
function mt(e, n, t) {
|
|
30
|
-
var y;
|
|
31
|
-
if (((y = n.radial) == null ? void 0 : y.mode) === "partition" && n.encoding.series) {
|
|
32
|
-
const f = e.columns.findIndex((b) => b.name === n.encoding.series);
|
|
33
|
-
if (f >= 0) {
|
|
34
|
-
const b = e.rows.findIndex((v, T) => {
|
|
35
|
-
const h = v[f], u = typeof h == "string" || typeof h == "number" || typeof h == "bigint" ? String(h) : "";
|
|
36
|
-
return At(u, Oe(e, n, T)) === t;
|
|
37
|
-
});
|
|
38
|
-
if (b >= 0) return b;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
const r = e.rows.findIndex((f, b) => Oe(e, n, b) === t);
|
|
42
|
-
if (r >= 0) return r;
|
|
43
|
-
const c = n.encoding.category ?? n.encoding.label, a = e.columns.findIndex((f) => f.name === c), m = e.columns.findIndex((f) => f.name === n.encoding.series);
|
|
44
|
-
return a < 0 ? -1 : e.rows.findIndex((f) => kt(
|
|
45
|
-
ke(f[a]),
|
|
46
|
-
m >= 0 ? ke(f[m]) : ""
|
|
47
|
-
) === t);
|
|
48
|
-
}
|
|
49
|
-
function xt(e, n) {
|
|
50
|
-
return n.semantics !== "series" || !n.encoding.series ? -1 : e.columns.findIndex((t) => t.name === n.encoding.series);
|
|
51
|
-
}
|
|
52
|
-
function go(e, n) {
|
|
53
|
-
const t = /* @__PURE__ */ new Map();
|
|
54
|
-
if (!e) return t;
|
|
55
|
-
const r = e.columns.findIndex((c) => c.name === n.encoding.series);
|
|
56
|
-
if (r < 0) return t;
|
|
57
|
-
for (const c of e.rows) {
|
|
58
|
-
const a = c[r];
|
|
59
|
-
if (typeof a != "string" && typeof a != "number" && typeof a != "bigint") continue;
|
|
60
|
-
const m = String(a);
|
|
61
|
-
t.has(m) || t.set(m, t.size);
|
|
62
|
-
}
|
|
63
|
-
return t;
|
|
64
|
-
}
|
|
65
|
-
function uo(e, n, t) {
|
|
66
|
-
var a;
|
|
67
|
-
const r = xt(e, n);
|
|
68
|
-
if (r < 0) return Oe(e, n, t);
|
|
69
|
-
const c = (a = e.rows[t]) == null ? void 0 : a[r];
|
|
70
|
-
return String(typeof c == "string" || typeof c == "number" || typeof c == "bigint" ? c : t);
|
|
71
|
-
}
|
|
72
|
-
function ge(e) {
|
|
73
|
-
if (typeof e == "number" && Number.isFinite(e)) return e;
|
|
74
|
-
if (typeof e == "string" && e.trim() !== "") {
|
|
75
|
-
const n = Number(e);
|
|
76
|
-
if (Number.isFinite(n)) return n;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
function ke(e) {
|
|
80
|
-
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? String(e) : "";
|
|
81
|
-
}
|
|
82
|
-
function mo(e, n) {
|
|
83
|
-
const c = (n.kind === "pie" || n.kind === "donut" || n.kind === "radial" ? [n.encoding.label, n.encoding.category] : [n.encoding.category, n.encoding.label]).reduce((a, m) => a >= 0 || !m ? a : e.columns.findIndex((y) => y.name === m), -1);
|
|
84
|
-
return c < 0 ? 0 : new Set(e.rows.map((a) => a[c]).filter((a) => a != null).map(String)).size;
|
|
85
|
-
}
|
|
86
|
-
function ho(e, n) {
|
|
87
|
-
const t = e.columns.findIndex((r) => r.name === n.encoding.series);
|
|
88
|
-
return t < 0 ? 1 : new Set(e.rows.map((r) => r[t]).filter((r) => r != null).map(String)).size;
|
|
89
|
-
}
|
|
90
|
-
const St = "__lens_other__", fo = "__lens_topn_group";
|
|
91
|
-
function ht(e, n) {
|
|
92
|
-
var v, T;
|
|
93
|
-
const t = e.columns.findIndex((h) => h.name === fo), r = e.columns.findIndex((h) => h.name === (n.encoding.label ?? n.encoding.category)), c = e.columns.findIndex((h) => h.name === n.encoding.id), a = e.columns.findIndex((h) => h.name === n.encoding.value);
|
|
94
|
-
if (t < 0 || r < 0 || a < 0) return { frame: e, collapsed: !1 };
|
|
95
|
-
const m = e.rows.filter((h) => typeof h[t] == "string" && String(h[t]).trim() !== "");
|
|
96
|
-
if (m.length === 0) return { frame: e, collapsed: !1 };
|
|
97
|
-
const y = e.rows.filter((h) => !m.includes(h)).map((h) => [...h]), f = new Array(e.columns.length).fill(null);
|
|
98
|
-
f[t] = (v = m[0]) == null ? void 0 : v[t], f[r] = (T = m[0]) == null ? void 0 : T[t], c >= 0 && (f[c] = St), f[a] = m.reduce((h, u) => h + (ge(u[a]) ?? 0), 0), y.push(f);
|
|
99
|
-
const b = e.colors ? [...e.colors.filter((h, u) => !m.includes(e.rows[u])), ze()] : [...y.slice(0, -1).map(() => ""), ze()];
|
|
100
|
-
return { frame: { ...e, rows: y, colors: b }, collapsed: !0 };
|
|
101
|
-
}
|
|
102
|
-
function ft(e, n, t) {
|
|
103
|
-
if (n.kind !== "donut" || e.rows.length < 2) return { frame: e, collapsed: !1 };
|
|
104
|
-
const r = e.columns.findIndex((u) => u.name === (n.encoding.label ?? n.encoding.category)), c = e.columns.findIndex((u) => u.name === n.encoding.id), a = e.columns.findIndex((u) => u.name === n.encoding.value);
|
|
105
|
-
if (r < 0 || a < 0) return { frame: e, collapsed: !1 };
|
|
106
|
-
const m = e.total ?? e.rows.reduce((u, N) => u + (ge(N[a]) ?? 0), 0);
|
|
107
|
-
if (!Number.isFinite(m) || m <= 0) return { frame: e, collapsed: !1 };
|
|
108
|
-
const y = e.rows.map((u, N) => ({ index: N, value: ge(u[a]) ?? 0 })).filter(({ value: u }) => u / m < io);
|
|
109
|
-
if (y.length === 0) return { frame: e, collapsed: !1 };
|
|
110
|
-
const f = new Set(y.map(({ index: u }) => u)), b = e.rows.filter((u, N) => !f.has(N)).map((u) => [...u]), v = new Array(e.columns.length).fill(null);
|
|
111
|
-
v[r] = t, c >= 0 && (v[c] = St), v[a] = y.reduce((u, N) => u + N.value, 0), b.push(v);
|
|
112
|
-
const T = e.rows.map((u, N) => N).filter((u) => !f.has(u)), h = e.colors ? [...e.colors.filter((u, N) => !f.has(N)), ze()] : [...T.map(() => ""), ze()];
|
|
113
|
-
return { frame: { ...e, rows: b, colors: h }, collapsed: !0 };
|
|
114
|
-
}
|
|
115
|
-
function Ro({ panel: e, adapter: n }) {
|
|
116
|
-
var Qe, Ze, Ge, Je, Ye, Xe, et, tt, ot, nt, rt, st, it, at, ct;
|
|
117
|
-
const t = Bt(e.id), r = Re(), { document: c, navigation: a } = wt(), { drillInto: m } = Ht(), { format: y, formatAxis: f } = lo(e), [b, v] = re(), [T, h] = re(!1), [u, N] = re(0), se = typeof window > "u" ? { regression: !1 } : lt(new URL(window.location.href), e.id), [V, Y] = re(se.regression), [_, ne] = re(se.movingAverage), [M, A] = re(() => /* @__PURE__ */ new Set()), [C, X] = re(() => typeof window > "u" ? /* @__PURE__ */ new Set() : dt(new URL(window.location.href), e.id)), R = C, ee = a.panelId === e.id && a.path.length > 0, j = ee ? _t(c, a.path) : e.drillRoot ? c.drill.edges[e.drillRoot] : void 0, Me = j ? j.children.some(({ target: o }) => o) : !!e.drillRoot, te = !!e.drillRoot || !!j, z = zt(e), ie = $e(), ae = Ae((o) => {
|
|
118
|
-
if (te || !z.action || !t.data) return;
|
|
119
|
-
const i = mt(t.data, e, o);
|
|
120
|
-
return z.urlForRow(t.data, i >= 0 ? t.data.rows[i] : void 0);
|
|
121
|
-
}, [t.data, te, z, e]), ue = Ae((o) => {
|
|
122
|
-
var i;
|
|
123
|
-
(i = ie.current) == null || i.call(ie), ie.current = void 0, !(o === null || te) && (ie.current = z.prefetch(ae(o)));
|
|
124
|
-
}, [te, ae, z]);
|
|
125
|
-
be(() => () => {
|
|
126
|
-
var o;
|
|
127
|
-
return (o = ie.current) == null ? void 0 : o.call(ie);
|
|
128
|
-
}, []);
|
|
129
|
-
const Z = K(() => {
|
|
130
|
-
var o;
|
|
131
|
-
return te || ((o = z.action) == null ? void 0 : o.kind) !== "open_drawer" || !t.data ? [] : t.data.rows.length === 0 || t.data.rows.length > 4 ? [] : [...new Set(t.data.rows.flatMap((i) => {
|
|
132
|
-
const g = z.urlForRow(t.data, i);
|
|
133
|
-
return g ? [g] : [];
|
|
134
|
-
}))];
|
|
135
|
-
}, [t.data, te, z]);
|
|
136
|
-
be(() => {
|
|
137
|
-
if (Z.length !== 0)
|
|
138
|
-
return z.prefetchIdle(Z);
|
|
139
|
-
}, [Z, z]);
|
|
140
|
-
const I = Ot(), G = ((Qe = z.action) == null ? void 0 : Qe.kind) === "cross_filter" || ((Ze = z.action) == null ? void 0 : Ze.kind) === "cube_drill" ? z.action.filter : void 0, ve = K(() => {
|
|
141
|
-
if (!(G != null && G.dimension)) return;
|
|
142
|
-
const o = I.values[Ut], i = Array.isArray(o) ? o : o ? [o] : [], g = `${G.dimension}:`, w = new Set(i.filter((B) => B.startsWith(g)).map((B) => B.slice(g.length)));
|
|
143
|
-
return w.size > 0 ? w : void 0;
|
|
144
|
-
}, [G == null ? void 0 : G.dimension, I.values]), Ke = K(() => {
|
|
145
|
-
if (!ve || !G || !t.data) return;
|
|
146
|
-
new URL(globalThis.location.href);
|
|
147
|
-
const o = t.data;
|
|
148
|
-
for (let i = 0; i < o.rows.length; i += 1) {
|
|
149
|
-
const g = Vt(G.value, {
|
|
150
|
-
fields: Dt(o, o.rows[i]),
|
|
151
|
-
variables: {}
|
|
152
|
-
}), w = ke(g);
|
|
153
|
-
if (w !== "" && ve.has(w)) return Oe(o, e, i);
|
|
154
|
-
}
|
|
155
|
-
}, [ve, G, t.data, e]), J = e.kind, Te = t.data ? mo(t.data, e) <= 1 && ho(t.data, e) <= 1 : !1, pe = `${a.panelId === e.id ? a.path.join("|") : ""}:${a.perspectiveId ?? ""}`, xe = $e(pe);
|
|
156
|
-
be(() => {
|
|
157
|
-
xe.current !== pe && (xe.current = pe, v(void 0));
|
|
158
|
-
}, [pe]);
|
|
159
|
-
const me = Ae((o) => X(new Set(o)), []);
|
|
160
|
-
be(() => {
|
|
161
|
-
if (typeof window > "u") return;
|
|
162
|
-
const o = () => me(dt(new URL(window.location.href), e.id));
|
|
163
|
-
return window.addEventListener("popstate", o), () => window.removeEventListener("popstate", o);
|
|
164
|
-
}, [e.id, me]), be(() => {
|
|
165
|
-
if (typeof window > "u") return;
|
|
166
|
-
const o = new URL(window.location.href), i = $t(o, e.id, R);
|
|
167
|
-
i.search !== o.search && window.history.replaceState(window.history.state, "", i);
|
|
168
|
-
}, [R, e.id]), be(() => {
|
|
169
|
-
if (typeof window > "u") return;
|
|
170
|
-
const o = () => {
|
|
171
|
-
const i = lt(new URL(window.location.href), e.id);
|
|
172
|
-
Y(i.regression), ne(i.movingAverage);
|
|
173
|
-
};
|
|
174
|
-
return window.addEventListener("popstate", o), () => window.removeEventListener("popstate", o);
|
|
175
|
-
}, [e.id]), be(() => {
|
|
176
|
-
if (typeof window > "u") return;
|
|
177
|
-
const o = new URL(window.location.href), i = Pt(o, e.id, { regression: V, movingAverage: _ });
|
|
178
|
-
i.search !== o.search && window.history.replaceState(window.history.state, "", i);
|
|
179
|
-
}, [_, e.id, V]);
|
|
180
|
-
const D = K(() => {
|
|
181
|
-
var Q, Ce;
|
|
182
|
-
if (!t.data || R.size === 0) return t.data;
|
|
183
|
-
const o = t.data.rows.map((Le, ye) => !R.has(uo(t.data, e, ye))), i = t.data.rows.filter((Le, ye) => o[ye]), g = (Q = t.data.colors) == null ? void 0 : Q.filter((Le, ye) => o[ye]), w = t.data.columns.findIndex((Le) => Le.name === e.encoding.value), B = ((Ce = e.radial) == null ? void 0 : Ce.mode) === "partition" || w < 0 ? t.data.total : i.reduce((Le, ye) => Le + (ge(ye[w]) ?? 0), 0);
|
|
184
|
-
return { ...t.data, rows: i, total: B, ...g ? { colors: g } : {} };
|
|
185
|
-
}, [t.data, R, e]), F = K(() => D ? (() => {
|
|
186
|
-
const o = ht(D, e);
|
|
187
|
-
return o.collapsed ? o : ft(D, e, r("chart.other", "Other"));
|
|
188
|
-
})() : { frame: D, collapsed: !1 }, [e, r, D]), Fe = F.collapsed && F.frame ? no(F.frame, e, F.frame.rows.length - 1) : void 0, O = T || !F.collapsed ? D : F.frame, s = O ? Rt(O, e.encoding, e.valueAxis, (Ge = e.presentation) == null ? void 0 : Ge.valueSpreadThreshold) : !1, L = K(() => {
|
|
189
|
-
if (!t.data || T) return t.data;
|
|
190
|
-
const o = ht(t.data, e);
|
|
191
|
-
return o.collapsed ? o.frame : ft(t.data, e, r("chart.other", "Other")).frame;
|
|
192
|
-
}, [t.data, e, T, r]), S = K(() => {
|
|
193
|
-
var i;
|
|
194
|
-
if (!t.data || R.size === 0 || !e.encoding.value || ((i = e.radial) == null ? void 0 : i.mode) === "partition") return;
|
|
195
|
-
const o = t.data.columns.findIndex((g) => g.name === e.encoding.value);
|
|
196
|
-
if (!(o < 0))
|
|
197
|
-
return ((D == null ? void 0 : D.rows) ?? []).reduce((g, w) => g + (ge(w[o]) ?? 0), 0);
|
|
198
|
-
}, [t.data, R.size, e.encoding.value, (Je = e.radial) == null ? void 0 : Je.mode, D]), oe = K(() => {
|
|
199
|
-
var i;
|
|
200
|
-
if (!t.data || !e.encoding.value || ((i = e.radial) == null ? void 0 : i.mode) === "partition") return;
|
|
201
|
-
const o = t.data.columns.findIndex((g) => g.name === e.encoding.value);
|
|
202
|
-
if (!(o < 0))
|
|
203
|
-
return t.data.rows.reduce((g, w) => g + (ge(w[o]) ?? 0), 0);
|
|
204
|
-
}, [t.data, e.encoding.value, (Ye = e.radial) == null ? void 0 : Ye.mode]), W = R.size > 0 && ((D == null ? void 0 : D.rows.length) ?? 0) === 0, $ = t.data && t.data.rows.length > 0 ? t.data.total ?? (ee || e.kind === "pie" || e.kind === "donut" || e.kind === "radial" ? oe : void 0) ?? e.total : void 0, U = $ === void 0 || W ? null : R.size > 0 ? S ?? null : $, E = ((Xe = t.data) == null ? void 0 : Xe.presentation) ?? e.presentation, ce = O == null ? void 0 : O.colors, we = Ae((o) => {
|
|
205
|
-
const i = new Set(R);
|
|
206
|
-
i.has(o) ? i.delete(o) : i.add(o), me(i);
|
|
207
|
-
}, [R, me]), de = K(() => {
|
|
208
|
-
if (j)
|
|
209
|
-
return (o) => {
|
|
210
|
-
var i;
|
|
211
|
-
return !!((i = gt(j, o)) != null && i.target);
|
|
212
|
-
};
|
|
213
|
-
}, [j]), le = K(() => yt(t.data, e), [t.data, e]), he = K(() => {
|
|
214
|
-
const o = bt(c.theme, e, { positional: !ee, labels: le }), i = go(t.data, e);
|
|
215
|
-
return i.size === 0 ? o : (g, w) => o(g, i.get(g) ?? w);
|
|
216
|
-
}, [ee, c.theme, t.data, le, e]), fe = K(
|
|
217
|
-
() => pt(c.theme, e, { colors: ce, positional: !ee, labels: le }),
|
|
218
|
-
[ee, c.theme, ce, le, e]
|
|
219
|
-
), d = K(() => {
|
|
220
|
-
var i;
|
|
221
|
-
const o = new Set(M);
|
|
222
|
-
V || o.add(_e.trend);
|
|
223
|
-
for (const { window: g } of ((i = e.temporal) == null ? void 0 : i.movingAverages) ?? [])
|
|
224
|
-
g !== _ && o.add(_e.average(g));
|
|
225
|
-
return o;
|
|
226
|
-
}, [M, _, (et = e.temporal) == null ? void 0 : et.movingAverages, V]), p = Ae((o) => {
|
|
227
|
-
var g, w;
|
|
228
|
-
if (o === _e.trend) {
|
|
229
|
-
Y((B) => !B);
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
const i = (w = (g = e.temporal) == null ? void 0 : g.movingAverages) == null ? void 0 : w.find(({ window: B }) => _e.average(B) === o);
|
|
233
|
-
if (i) {
|
|
234
|
-
ne((B) => B === i.window ? void 0 : i.window);
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
A((B) => {
|
|
238
|
-
const Q = new Set(B);
|
|
239
|
-
return Q.has(o) ? Q.delete(o) : Q.add(o), Q;
|
|
240
|
-
});
|
|
241
|
-
}, [(tt = e.temporal) == null ? void 0 : tt.movingAverages]), x = (J === "line" || J === "area") && e.temporal && (e.temporal.regression || (ot = e.temporal.movingAverages) != null && ot.length) ? /* @__PURE__ */ k("div", { className: "lens-temporal-controls", children: [
|
|
242
|
-
e.temporal.regression && /* @__PURE__ */ l(
|
|
243
|
-
"button",
|
|
244
|
-
{
|
|
245
|
-
"aria-pressed": V,
|
|
246
|
-
className: "lens-temporal-toggle",
|
|
247
|
-
onClick: () => Y((o) => !o),
|
|
248
|
-
type: "button",
|
|
249
|
-
children: r("chart.regression", "Trend")
|
|
250
|
-
}
|
|
251
|
-
),
|
|
252
|
-
!!((nt = e.temporal.movingAverages) != null && nt.length) && /* @__PURE__ */ k(
|
|
253
|
-
"select",
|
|
254
|
-
{
|
|
255
|
-
"aria-label": r("chart.movingAverage", "Moving average"),
|
|
256
|
-
className: "lens-temporal-select",
|
|
257
|
-
onChange: (o) => ne(o.target.value ? Number(o.target.value) : void 0),
|
|
258
|
-
value: _ ?? "",
|
|
259
|
-
children: [
|
|
260
|
-
/* @__PURE__ */ l("option", { value: "", children: r("chart.movingAverage", "Moving average") }),
|
|
261
|
-
(rt = e.temporal.movingAverages) == null ? void 0 : rt.map(({ window: o, label: i }) => /* @__PURE__ */ l("option", { value: o, children: i || `SMA ${o}` }, o))
|
|
262
|
-
]
|
|
263
|
-
}
|
|
264
|
-
)
|
|
265
|
-
] }) : void 0, P = K(() => ({
|
|
266
|
-
previous: r("chart.series.previous", "Previous"),
|
|
267
|
-
trend: r("chart.series.trend", "Trend"),
|
|
268
|
-
movingAverage: (o) => r("chart.series.movingAverage", "SMA {window}", { window: String(o) }),
|
|
269
|
-
estimate: r("chart.series.estimate", "Estimate"),
|
|
270
|
-
ytd: r("chart.series.ytd", "YTD"),
|
|
271
|
-
forecast: r("chart.series.forecast", "Forecast"),
|
|
272
|
-
forecastLower: (o) => r("chart.series.forecastLower", "{forecast} lower", { forecast: o }),
|
|
273
|
-
forecastConfidence: (o) => r("chart.series.forecastConfidence", "{forecast} confidence", { forecast: o }),
|
|
274
|
-
boxplot: [
|
|
275
|
-
r("chart.boxplot.min", "Min"),
|
|
276
|
-
r("chart.boxplot.q1", "Q1"),
|
|
277
|
-
r("chart.boxplot.median", "Median"),
|
|
278
|
-
r("chart.boxplot.q3", "Q3"),
|
|
279
|
-
r("chart.boxplot.max", "Max")
|
|
280
|
-
],
|
|
281
|
-
noData: r("panel.empty", "No data"),
|
|
282
|
-
copyValue: r("explore.copyValue", "Copy value"),
|
|
283
|
-
copied: r("explore.copied", "Copied")
|
|
284
|
-
}), [r]), q = K(() => {
|
|
285
|
-
var o, i;
|
|
286
|
-
return O ? {
|
|
287
|
-
kind: J,
|
|
288
|
-
frame: O,
|
|
289
|
-
encoding: e.encoding,
|
|
290
|
-
format: y,
|
|
291
|
-
formatAxis: f,
|
|
292
|
-
formatTooltip: (g, w, B) => Qt(w, B, e.format[g], c.meta.locale),
|
|
293
|
-
// The plot abbreviates because a label has to fit beside a mark; the
|
|
294
|
-
// tooltip is where a reader who stopped to point gets the whole number, and
|
|
295
|
-
// the clipboard gets the machine value behind it.
|
|
296
|
-
formatExact: (g, w) => {
|
|
297
|
-
var B;
|
|
298
|
-
return Wt(w, e.format[g], ((B = c.meta) == null ? void 0 : B.locale) ?? "en");
|
|
299
|
-
},
|
|
300
|
-
rawValue: (g, w) => jt(w, e.format[g]),
|
|
301
|
-
categoryFormatDefined: !!(e.encoding.category && e.format[e.encoding.category]),
|
|
302
|
-
locale: (o = c.meta) == null ? void 0 : o.locale,
|
|
303
|
-
shareDecimalSeparator: e.encoding.value ? (i = e.format[e.encoding.value]) == null ? void 0 : i.decimalSeparator : void 0,
|
|
304
|
-
tooltipTotalLabel: r("panel.total", "Total"),
|
|
305
|
-
labels: P,
|
|
306
|
-
theme: c.theme,
|
|
307
|
-
// An explicit pick wins; otherwise the mark the page is currently filtered
|
|
308
|
-
// by carries the same outline, so the source panel states its own selection
|
|
309
|
-
// across a reload or a shared URL, not only in the click that made it.
|
|
310
|
-
selectedKey: b ?? Ke,
|
|
311
|
-
presentation: E,
|
|
312
|
-
seriesColor: he,
|
|
313
|
-
rowColor: fe,
|
|
314
|
-
radial: e.radial,
|
|
315
|
-
temporal: e.temporal,
|
|
316
|
-
hiddenOverlays: d,
|
|
317
|
-
valueAxis: e.valueAxis,
|
|
318
|
-
valueUnit: qt(e.encoding.value ? e.format[e.encoding.value] : void 0),
|
|
319
|
-
expandable: de
|
|
320
|
-
} : void 0;
|
|
321
|
-
}, [P, (st = c.meta) == null ? void 0 : st.locale, c.theme, de, y, f, Ke, d, J, e.encoding, e.format, e.radial, e.temporal, e.valueAxis, E, O, fe, b, he, r]), Se = K(() => {
|
|
322
|
-
var i, g;
|
|
323
|
-
if (!e.temporal && !e.encoding.previous) return [];
|
|
324
|
-
const o = e.encoding.category ?? e.encoding.label;
|
|
325
|
-
return Kt({
|
|
326
|
-
temporal: e.temporal,
|
|
327
|
-
hasComparison: !!e.encoding.previous,
|
|
328
|
-
labels: P,
|
|
329
|
-
formatValue: (w) => y(e.encoding.value ?? "", w),
|
|
330
|
-
formatCategory: Tt({
|
|
331
|
-
format: (w) => y(o ?? "", w),
|
|
332
|
-
isTime: ((i = t.data) == null ? void 0 : i.columns.some((w) => w.name === o && w.type === "time")) === !0,
|
|
333
|
-
hasDeclaredFormat: !!(o && e.format[o]),
|
|
334
|
-
locale: (g = c.meta) == null ? void 0 : g.locale
|
|
335
|
-
}),
|
|
336
|
-
hidden: d
|
|
337
|
-
});
|
|
338
|
-
}, [P, (it = c.meta) == null ? void 0 : it.locale, y, (at = t.data) == null ? void 0 : at.columns, d, e.encoding, e.format, e.temporal]), Be = Zt(), Ue = te ? Be ? !!((j == null ? void 0 : j.children.length) ?? e.drillRoot) : Me : !!z.action, Pe = J === "histogram" || J === "boxplot" || J === "heatmap", Ve = Te && !Pe, De = Ae((o, i, g) => {
|
|
339
|
-
const w = F.frame ? F.frame.rows.length - 1 : -1;
|
|
340
|
-
if (F.collapsed && !!(o === Fe || F.frame && mt(F.frame, e, o) === w)) {
|
|
341
|
-
h((Ce) => !Ce);
|
|
342
|
-
return;
|
|
343
|
-
}
|
|
344
|
-
if (!te) {
|
|
345
|
-
const Ce = ae(o);
|
|
346
|
-
z.activate(Ce, void 0, { newTab: g == null ? void 0 : g.newTab });
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
if (Be) {
|
|
350
|
-
v(o), Be(o, i);
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
const Q = gt(j, o);
|
|
354
|
-
j && !(Q != null && Q.target) || (v(o), m((Q == null ? void 0 : Q.key) ?? o, e.id));
|
|
355
|
-
}, [F.collapsed, F.frame, Fe, m, te, j, ae, Be, e, z]), qe = !Ve && (E == null ? void 0 : E.legend) === "below" && !!O, It = !Ve && Se.length > 0 && !!O, Ie = Ue || F.collapsed, Nt = e.encoding.category ?? e.encoding.label, je = (J === "line" || J === "area") && (O == null ? void 0 : O.columns.some((o) => o.name === Nt && o.type === "time")) === !0, He = Se.find((o) => o.kind === "incomplete" && o.active), We = G ? r("chart.filterHint", "Select to filter the page") : r("chart.drillHint", "Select to explore"), Ne = K(
|
|
356
|
-
() => q && Ue ? { ...q, actionHint: We } : q,
|
|
357
|
-
[We, q, Ue]
|
|
358
|
-
);
|
|
359
|
-
return /* @__PURE__ */ l(Gt, { allowEmptyContent: !Pe, panel: e, frame: t, headerActions: x, total: U, children: /* @__PURE__ */ k("div", { className: `lens-chart-layout${qe ? " lens-chart-layout-legend" : ""}`, children: [
|
|
360
|
-
/* @__PURE__ */ k("div", { className: "lens-chart-area", children: [
|
|
361
|
-
(E == null ? void 0 : E.totalBadge) === "plot" && J !== "donut" && ((ct = e.radial) == null ? void 0 : ct.mode) !== "partition" && U !== null && /* @__PURE__ */ l(yo, { panel: e, total: U }),
|
|
362
|
-
(s || He || je || ve || T && F.collapsed) && /* @__PURE__ */ k("div", { className: "lens-chart-notes", children: [
|
|
363
|
-
ve && /* @__PURE__ */ l("span", { className: "lens-chart-source-note", role: "note", children: r("chart.crossFilterSource", "All categories shown — the filter applies to the other panels") }),
|
|
364
|
-
s && /* @__PURE__ */ k(
|
|
365
|
-
"span",
|
|
366
|
-
{
|
|
367
|
-
className: "lens-chart-log-scale",
|
|
368
|
-
role: "note",
|
|
369
|
-
title: r("chart.logScaleHint", "Values are shown on a logarithmic scale"),
|
|
370
|
-
children: [
|
|
371
|
-
/* @__PURE__ */ l(Jt, { "aria-hidden": "true" }),
|
|
372
|
-
/* @__PURE__ */ l("span", { children: r("chart.logScale", "Logarithmic scale") })
|
|
373
|
-
]
|
|
374
|
-
}
|
|
375
|
-
),
|
|
376
|
-
He && /* @__PURE__ */ l("span", { className: "lens-chart-period-note", role: "note", children: [He.detail, He.label].filter(Boolean).join(" · ") }),
|
|
377
|
-
/* @__PURE__ */ k("span", { className: "lens-chart-notes-actions", children: [
|
|
378
|
-
T && F.collapsed && /* @__PURE__ */ l("button", { className: "lens-chart-collapse-other", onClick: () => h(!1), type: "button", children: r("chart.collapseOther", "Collapse Other") }),
|
|
379
|
-
je && /* @__PURE__ */ l("button", { className: "lens-chart-reset-zoom", onClick: () => N((o) => o + 1), type: "button", children: r("chart.resetZoom", "Reset zoom") })
|
|
380
|
-
] })
|
|
381
|
-
] }),
|
|
382
|
-
W ? /* @__PURE__ */ l(vo, { onShowAll: () => me(/* @__PURE__ */ new Set()) }) : Ne && Ve ? /* @__PURE__ */ l(
|
|
383
|
-
wo,
|
|
384
|
-
{
|
|
385
|
-
actionable: Ie,
|
|
386
|
-
frame: Ne.frame,
|
|
387
|
-
onSelect: Ie ? De : void 0,
|
|
388
|
-
panel: e
|
|
389
|
-
}
|
|
390
|
-
) : Ne && /* @__PURE__ */ k(Ee, { children: [
|
|
391
|
-
/* @__PURE__ */ l(
|
|
392
|
-
ro,
|
|
393
|
-
{
|
|
394
|
-
actionable: Ie,
|
|
395
|
-
format: Ne.format,
|
|
396
|
-
frame: Ne.frame,
|
|
397
|
-
label: r("chart.data", "Chart data for {name}", { name: e.title }),
|
|
398
|
-
onHover: ue,
|
|
399
|
-
onSelect: De,
|
|
400
|
-
panel: e,
|
|
401
|
-
translate: r
|
|
402
|
-
}
|
|
403
|
-
),
|
|
404
|
-
/* @__PURE__ */ l(
|
|
405
|
-
so,
|
|
406
|
-
{
|
|
407
|
-
input: Ne,
|
|
408
|
-
panelId: e.id,
|
|
409
|
-
adapter: n,
|
|
410
|
-
label: r("chart.label", "{name} chart", { name: e.title }),
|
|
411
|
-
drillable: Ie,
|
|
412
|
-
onHover: Ie ? ue : void 0,
|
|
413
|
-
onSelect: Ie ? De : void 0,
|
|
414
|
-
resetZoomKey: u
|
|
415
|
-
}
|
|
416
|
-
)
|
|
417
|
-
] }),
|
|
418
|
-
It && /* @__PURE__ */ l(po, { onToggle: p, overlays: Se })
|
|
419
|
-
] }),
|
|
420
|
-
qe && L && /* @__PURE__ */ l(
|
|
421
|
-
bo,
|
|
422
|
-
{
|
|
423
|
-
frame: L,
|
|
424
|
-
hidden: R,
|
|
425
|
-
onSetHidden: me,
|
|
426
|
-
onToggle: we,
|
|
427
|
-
panel: e,
|
|
428
|
-
presentation: E,
|
|
429
|
-
total: U ?? void 0
|
|
430
|
-
}
|
|
431
|
-
)
|
|
432
|
-
] }) });
|
|
433
|
-
}
|
|
434
|
-
function vo({ onShowAll: e }) {
|
|
435
|
-
const n = Re();
|
|
436
|
-
return /* @__PURE__ */ k("div", { className: "lens-chart-empty", role: "status", children: [
|
|
437
|
-
/* @__PURE__ */ l("span", { className: "lens-chart-empty-note", children: n("chart.allSeriesHidden", "All series are hidden") }),
|
|
438
|
-
/* @__PURE__ */ l("button", { className: "lens-chart-empty-action", onClick: e, type: "button", children: n("chart.showAllSeries", "Show all series") })
|
|
439
|
-
] });
|
|
440
|
-
}
|
|
441
|
-
function wo({ actionable: e, frame: n, onSelect: t, panel: r }) {
|
|
442
|
-
var ne, M;
|
|
443
|
-
const c = Re(), a = [r.encoding.category, r.encoding.label].find((A) => A !== void 0 && n.columns.some((C) => C.name === A)), m = r.encoding.value, y = n.columns.findIndex((A) => A.name === a), f = n.columns.findIndex((A) => A.name === m), b = H(m ? r.format[m] : void 0), v = f < 0 ? void 0 : n.rows.reduce((A, C) => A + (ge(C[f]) ?? 0), 0), T = y < 0 || (ne = n.rows[0]) == null ? void 0 : ne[y], h = ke(T), u = b(v), N = r.encoding.id ?? a, se = n.columns.findIndex((A) => A.name === N), V = ke(se < 0 || (M = n.rows[0]) == null ? void 0 : M[se]), Y = /* @__PURE__ */ l(Ee, { children: n.rows.length === 0 ? /* @__PURE__ */ l("span", { className: "lens-chart-compact-empty", children: c("panel.empty", "No data") }) : /* @__PURE__ */ k(Ee, { children: [
|
|
444
|
-
h && /* @__PURE__ */ l("span", { className: "lens-chart-compact-label", title: h, children: h }),
|
|
445
|
-
/* @__PURE__ */ l("strong", { className: "lens-chart-compact-value", children: u })
|
|
446
|
-
] }) }), _ = n.rows.length === 0 ? c("panel.empty", "No data") : [h, u].filter(Boolean).join(" / ");
|
|
447
|
-
return e && V && n.rows.length > 0 ? /* @__PURE__ */ l(
|
|
448
|
-
"button",
|
|
449
|
-
{
|
|
450
|
-
"aria-label": `${_}. ${c("chart.openMark", "Open {name}", { name: h ?? V })}`,
|
|
451
|
-
className: "lens-chart-compact lens-chart-compact-action",
|
|
452
|
-
onClick: () => t == null ? void 0 : t(V),
|
|
453
|
-
type: "button",
|
|
454
|
-
children: Y
|
|
455
|
-
}
|
|
456
|
-
) : /* @__PURE__ */ l("div", { "aria-label": _, className: "lens-chart-compact", role: "img", children: Y });
|
|
457
|
-
}
|
|
458
|
-
function yo({ panel: e, total: n }) {
|
|
459
|
-
const t = Re(), r = H(e.encoding.value ? e.format[e.encoding.value] : void 0);
|
|
460
|
-
return /* @__PURE__ */ k("span", { className: "lens-plot-total", children: [
|
|
461
|
-
/* @__PURE__ */ k("span", { className: "lens-panel-total-label", children: [
|
|
462
|
-
t("panel.total", "Total"),
|
|
463
|
-
":"
|
|
464
|
-
] }),
|
|
465
|
-
" ",
|
|
466
|
-
r(n)
|
|
467
|
-
] });
|
|
468
|
-
}
|
|
469
|
-
const bo = vt(function({
|
|
470
|
-
panel: n,
|
|
471
|
-
frame: t,
|
|
472
|
-
hidden: r,
|
|
473
|
-
onSetHidden: c,
|
|
474
|
-
onToggle: a,
|
|
475
|
-
total: m,
|
|
476
|
-
presentation: y
|
|
477
|
-
}) {
|
|
478
|
-
var Fe, O;
|
|
479
|
-
const { document: f, navigation: b } = wt(), v = Re(), [T, h] = re(""), u = $e(null), [N, se] = re({ top: !1, bottom: !1 }), [V, Y] = re(0), [_, ne] = re(!1), M = xt(t, n), A = M >= 0 ? n.encoding.series : n.encoding.label ?? n.encoding.category, C = n.encoding.value, X = H(C ? n.format[C] : void 0), R = t.columns.findIndex((s) => s.name === A), ee = t.columns.findIndex((s) => s.name === C), j = H(A ? n.format[A] : void 0), Me = b.panelId === n.id && b.path.length > 0, te = yt(t, n), z = bt(f.theme, n, { positional: !Me, labels: te }), ie = pt(f.theme, n, {
|
|
480
|
-
colors: t.colors,
|
|
481
|
-
positional: !Me,
|
|
482
|
-
labels: te
|
|
483
|
-
}), ae = n.encoding.id ? t.columns.findIndex((s) => s.name === n.encoding.id) : -1, ue = n.encoding.series ? t.columns.findIndex((s) => s.name === n.encoding.series) : -1, Z = ((Fe = n.radial) == null ? void 0 : Fe.mode) === "partition", I = K(() => {
|
|
484
|
-
var he, fe;
|
|
485
|
-
const s = t.rows.map((d, p) => {
|
|
486
|
-
const x = ae >= 0 ? d[ae] : d[R];
|
|
487
|
-
return String(typeof x == "string" || typeof x == "number" || typeof x == "bigint" ? x : p);
|
|
488
|
-
}), L = t.rows.map((d, p) => {
|
|
489
|
-
if (M < 0) return s[p];
|
|
490
|
-
const x = d[M];
|
|
491
|
-
return String(typeof x == "string" || typeof x == "number" || typeof x == "bigint" ? x : p);
|
|
492
|
-
});
|
|
493
|
-
let S = t.rows.map((d, p) => p);
|
|
494
|
-
if (M >= 0 || Z) {
|
|
495
|
-
const d = /* @__PURE__ */ new Set();
|
|
496
|
-
S = [];
|
|
497
|
-
for (let p = 0; p < t.rows.length; p += 1) {
|
|
498
|
-
const x = L[p];
|
|
499
|
-
d.has(x) || (d.add(x), S.push(p));
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
const oe = S.map((d) => L[d]), W = new Map(S.map((d, p) => [d, p])), $ = /* @__PURE__ */ new Map();
|
|
503
|
-
Z && s.forEach((d) => {
|
|
504
|
-
$.has(d) || $.set(d, $.size);
|
|
505
|
-
});
|
|
506
|
-
const U = new Map((((he = n.radial) == null ? void 0 : he.rings) ?? []).map((d) => [d.key, d.total])), E = /* @__PURE__ */ new Map();
|
|
507
|
-
for (let d = 0; d < t.rows.length; d += 1) {
|
|
508
|
-
const p = ue >= 0 ? (fe = t.rows[d]) == null ? void 0 : fe[ue] : void 0, x = Z && typeof p == "string" ? p : "", P = Z ? U.get(x) ?? m : m, q = Z ? x : String(P), Se = E.get(q) ?? { denominator: P, indices: [] };
|
|
509
|
-
Se.indices.push(d), E.set(q, Se);
|
|
510
|
-
}
|
|
511
|
-
const ce = /* @__PURE__ */ new Map();
|
|
512
|
-
for (const { denominator: d, indices: p } of E.values()) {
|
|
513
|
-
const x = p.map((P) => {
|
|
514
|
-
var q;
|
|
515
|
-
return ee >= 0 ? ge((q = t.rows[P]) == null ? void 0 : q[ee]) : void 0;
|
|
516
|
-
});
|
|
517
|
-
Et(x, d).forEach((P, q) => ce.set(p[q], P));
|
|
518
|
-
}
|
|
519
|
-
const we = /* @__PURE__ */ new Map();
|
|
520
|
-
Z && s.forEach((d) => we.set(d, (we.get(d) ?? 0) + 1));
|
|
521
|
-
const de = /* @__PURE__ */ new Map();
|
|
522
|
-
ee >= 0 && t.rows.forEach((d, p) => {
|
|
523
|
-
var q;
|
|
524
|
-
const x = ge(d[ee]);
|
|
525
|
-
if (x === void 0) return;
|
|
526
|
-
const P = L[p];
|
|
527
|
-
M >= 0 && C && ((q = n.format[C]) == null ? void 0 : q.kind) !== "percent" ? de.set(P, (de.get(P) ?? 0) + x) : de.set(P, x);
|
|
528
|
-
});
|
|
529
|
-
const le = /* @__PURE__ */ new Map();
|
|
530
|
-
return Z && ue >= 0 && S.forEach((d) => {
|
|
531
|
-
var x;
|
|
532
|
-
const p = (x = t.rows[d]) == null ? void 0 : x[ue];
|
|
533
|
-
typeof p == "string" && le.set(d, p);
|
|
534
|
-
}), { allKeys: oe, categoryOrder: $, entries: S, entryKeys: L, entryPositions: W, ringByIndex: le, rowKeys: s, rowsPerKey: we, shares: ce, valueByKey: de };
|
|
535
|
-
}, [t, ae, R, n.format, (O = n.radial) == null ? void 0 : O.rings, Z, ue, M, m, C, ee]), G = (s, L, S) => {
|
|
536
|
-
var $;
|
|
537
|
-
if (M >= 0) return z(s, S);
|
|
538
|
-
const oe = ae >= 0 ? ($ = t.rows[L]) == null ? void 0 : $[ae] : void 0, W = typeof oe == "string" && oe.trim() !== "" ? oe : void 0;
|
|
539
|
-
return ie(s, I.categoryOrder.get(I.rowKeys[L]) ?? L, W);
|
|
540
|
-
}, ve = (y == null ? void 0 : y.legendValue) === "percent", Ke = (s) => M >= 0 ? "value" : ve ? "percent" : Z ? I.rowsPerKey.get(I.rowKeys[s]) === 1 ? "percent" : "none" : "value", J = T.trim().toLocaleLowerCase(), Te = J === "" ? I.entries : I.entries.filter((s) => {
|
|
541
|
-
var S;
|
|
542
|
-
const L = (S = t.rows[s]) == null ? void 0 : S[R];
|
|
543
|
-
return ke(L).toLocaleLowerCase().includes(J);
|
|
544
|
-
});
|
|
545
|
-
if (Ct(() => {
|
|
546
|
-
const s = u.current;
|
|
547
|
-
if (!s) return;
|
|
548
|
-
const L = () => {
|
|
549
|
-
const oe = s.scrollTop + s.clientHeight, W = s.scrollHeight > s.clientHeight + 1;
|
|
550
|
-
if (se({
|
|
551
|
-
top: W && s.scrollTop > 1,
|
|
552
|
-
bottom: W && oe < s.scrollHeight - 1
|
|
553
|
-
}), !W) {
|
|
554
|
-
Y(0);
|
|
555
|
-
return;
|
|
556
|
-
}
|
|
557
|
-
const $ = s.querySelectorAll(".lens-chart-legend-item");
|
|
558
|
-
let U = 0;
|
|
559
|
-
for (const E of $) E.offsetTop + E.offsetHeight > oe + 1 && (U += 1);
|
|
560
|
-
Y(U);
|
|
561
|
-
};
|
|
562
|
-
L(), s.addEventListener("scroll", L, { passive: !0 });
|
|
563
|
-
const S = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(L);
|
|
564
|
-
return S == null || S.observe(s), () => {
|
|
565
|
-
s.removeEventListener("scroll", L), S == null || S.disconnect();
|
|
566
|
-
};
|
|
567
|
-
}, [_, Te.length]), R < 0) return null;
|
|
568
|
-
const pe = (s) => {
|
|
569
|
-
const L = !r.has(s) && I.allKeys.every((S) => S === s || r.has(S));
|
|
570
|
-
c(L ? /* @__PURE__ */ new Set() : new Set(I.allKeys.filter((S) => S !== s)));
|
|
571
|
-
}, xe = I.allKeys.length > 0 && I.allKeys.every((s) => r.has(s)), me = I.allKeys.every((s) => !r.has(s)), D = I.allKeys.length > co, F = I.entries.length >= ao;
|
|
572
|
-
return /* @__PURE__ */ k("div", { className: "lens-chart-legend-shell", style: _ ? { "--lens-chart-legend-max": "none" } : void 0, children: [
|
|
573
|
-
D && /* @__PURE__ */ k("div", { className: "lens-chart-legend-controls", children: [
|
|
574
|
-
/* @__PURE__ */ l(
|
|
575
|
-
"div",
|
|
576
|
-
{
|
|
577
|
-
"aria-label": v("chart.legendControls", "Legend controls"),
|
|
578
|
-
className: "lens-chart-legend-tools",
|
|
579
|
-
"data-members": F ? "many" : "one",
|
|
580
|
-
role: "group",
|
|
581
|
-
children: F ? /* @__PURE__ */ k(Ee, { children: [
|
|
582
|
-
/* @__PURE__ */ l(
|
|
583
|
-
"button",
|
|
584
|
-
{
|
|
585
|
-
"aria-pressed": xe,
|
|
586
|
-
onClick: () => c(new Set(I.allKeys)),
|
|
587
|
-
type: "button",
|
|
588
|
-
children: v("chart.legendHideAll", "Hide all")
|
|
589
|
-
}
|
|
590
|
-
),
|
|
591
|
-
/* @__PURE__ */ l(
|
|
592
|
-
"button",
|
|
593
|
-
{
|
|
594
|
-
"aria-pressed": me,
|
|
595
|
-
onClick: () => c(/* @__PURE__ */ new Set()),
|
|
596
|
-
type: "button",
|
|
597
|
-
children: v("chart.legendShowAll", "Show all")
|
|
598
|
-
}
|
|
599
|
-
),
|
|
600
|
-
/* @__PURE__ */ l(
|
|
601
|
-
"button",
|
|
602
|
-
{
|
|
603
|
-
"aria-label": v("chart.legendInvert", "Invert"),
|
|
604
|
-
className: "lens-chart-legend-invert",
|
|
605
|
-
onClick: () => c(new Set(I.allKeys.filter((s) => !r.has(s)))),
|
|
606
|
-
title: v("chart.legendInvert", "Invert"),
|
|
607
|
-
type: "button",
|
|
608
|
-
children: /* @__PURE__ */ l(Xt, {})
|
|
609
|
-
}
|
|
610
|
-
)
|
|
611
|
-
] }) : /* @__PURE__ */ l(
|
|
612
|
-
"button",
|
|
613
|
-
{
|
|
614
|
-
onClick: () => c(xe ? /* @__PURE__ */ new Set() : new Set(I.allKeys)),
|
|
615
|
-
type: "button",
|
|
616
|
-
children: xe ? v("chart.legendShowAll", "Show all") : v("chart.legendHideAll", "Hide all")
|
|
617
|
-
}
|
|
618
|
-
)
|
|
619
|
-
}
|
|
620
|
-
),
|
|
621
|
-
F && /* @__PURE__ */ k("label", { className: "lens-chart-legend-search", children: [
|
|
622
|
-
/* @__PURE__ */ l("span", { className: "lens-sr-only", children: v("chart.legendSearch", "Search legend") }),
|
|
623
|
-
/* @__PURE__ */ l(
|
|
624
|
-
"input",
|
|
625
|
-
{
|
|
626
|
-
className: "lens-facet-search",
|
|
627
|
-
onChange: (s) => h(s.currentTarget.value),
|
|
628
|
-
placeholder: v("chart.legendSearch", "Search legend"),
|
|
629
|
-
type: "search",
|
|
630
|
-
value: T
|
|
631
|
-
}
|
|
632
|
-
)
|
|
633
|
-
] })
|
|
634
|
-
] }),
|
|
635
|
-
/* @__PURE__ */ k(
|
|
636
|
-
"div",
|
|
637
|
-
{
|
|
638
|
-
className: "lens-chart-legend-scroll-frame",
|
|
639
|
-
"data-overflow-bottom": N.bottom || void 0,
|
|
640
|
-
"data-overflow-top": N.top || void 0,
|
|
641
|
-
children: [
|
|
642
|
-
/* @__PURE__ */ l("ul", { "aria-label": v("chart.legendControls", "Legend controls"), className: "lens-chart-legend", ref: u, role: "region", tabIndex: N.top || N.bottom ? 0 : void 0, children: Te.map((s, L) => {
|
|
643
|
-
var le, he, fe, d, p;
|
|
644
|
-
const S = t.rows[s], oe = I.entryPositions.get(s) ?? s, W = S[R], $ = W == null ? "" : j(W), U = I.entryKeys[s], E = r.has(U), ce = I.ringByIndex.get(s), we = L > 0 ? I.ringByIndex.get(Te[L - 1]) : void 0, de = ((fe = (he = (le = n.radial) == null ? void 0 : le.rings) == null ? void 0 : he.find((x) => x.key === ce)) == null ? void 0 : fe.label) ?? ce;
|
|
645
|
-
return /* @__PURE__ */ k(Lt, { children: [
|
|
646
|
-
ce && ce !== we && /* @__PURE__ */ l("li", { className: "lens-chart-legend-heading", children: de }),
|
|
647
|
-
/* @__PURE__ */ l("li", { className: "lens-chart-legend-item", children: /* @__PURE__ */ k(
|
|
648
|
-
"button",
|
|
649
|
-
{
|
|
650
|
-
"aria-pressed": !E,
|
|
651
|
-
className: `lens-chart-legend-toggle${E ? " lens-chart-legend-hidden" : ""}`,
|
|
652
|
-
onClick: () => a(U),
|
|
653
|
-
onDoubleClick: () => pe(U),
|
|
654
|
-
title: v("chart.legendToggleHint", "Click to toggle · double-click to isolate"),
|
|
655
|
-
type: "button",
|
|
656
|
-
children: [
|
|
657
|
-
/* @__PURE__ */ l(
|
|
658
|
-
"span",
|
|
659
|
-
{
|
|
660
|
-
"aria-hidden": "true",
|
|
661
|
-
className: "lens-chart-legend-mark",
|
|
662
|
-
style: { background: G($, s, oe) }
|
|
663
|
-
}
|
|
664
|
-
),
|
|
665
|
-
/* @__PURE__ */ l("span", { className: "lens-chart-legend-label", children: $ }),
|
|
666
|
-
Ke(s) !== "none" && /* @__PURE__ */ l("span", { className: "lens-chart-legend-value", children: Ke(s) === "percent" ? Mt(I.shares.get(s), (d = f.meta) == null ? void 0 : d.locale, C ? (p = n.format[C]) == null ? void 0 : p.decimalSeparator : void 0) : X(I.valueByKey.get(U)) }),
|
|
667
|
-
/* @__PURE__ */ l("span", { "aria-hidden": "true", className: "lens-chart-legend-visibility", children: E ? /* @__PURE__ */ l(eo, {}) : /* @__PURE__ */ l(to, {}) })
|
|
668
|
-
]
|
|
669
|
-
}
|
|
670
|
-
) }, `${U}-${s}`)
|
|
671
|
-
] }, `${U}-${s}`);
|
|
672
|
-
}) }),
|
|
673
|
-
/* @__PURE__ */ l("span", { "aria-hidden": "true", className: "lens-chart-legend-edge lens-chart-legend-edge-top" }),
|
|
674
|
-
/* @__PURE__ */ l("span", { "aria-hidden": "true", className: "lens-chart-legend-edge lens-chart-legend-edge-bottom" })
|
|
675
|
-
]
|
|
676
|
-
}
|
|
677
|
-
),
|
|
678
|
-
(V > 0 || _) && /* @__PURE__ */ l("button", { className: "lens-chart-legend-overflow", onClick: () => ne((s) => !s), type: "button", children: _ ? v("chart.legendCollapse", "Show fewer") : v("chart.legendMore", "{count} more", { count: String(V) }) })
|
|
679
|
-
] });
|
|
680
|
-
}), po = vt(function({ overlays: n, onToggle: t }) {
|
|
681
|
-
const r = Re(), c = r("chart.legendOverlays", "Chart marks");
|
|
682
|
-
return /* @__PURE__ */ k("ul", { "aria-label": c, className: "lens-chart-legend lens-chart-overlay-legend", children: [
|
|
683
|
-
/* @__PURE__ */ l("li", { className: "lens-chart-legend-heading", children: c }),
|
|
684
|
-
n.map((a) => /* @__PURE__ */ l("li", { className: "lens-chart-legend-item", children: /* @__PURE__ */ k(
|
|
685
|
-
"button",
|
|
686
|
-
{
|
|
687
|
-
"aria-pressed": a.active,
|
|
688
|
-
className: `lens-chart-legend-toggle${a.active ? "" : " lens-chart-legend-hidden"}`,
|
|
689
|
-
onClick: () => t(a.id),
|
|
690
|
-
title: r("chart.legendToggleOverlay", "Show or hide this mark"),
|
|
691
|
-
type: "button",
|
|
692
|
-
children: [
|
|
693
|
-
/* @__PURE__ */ l(
|
|
694
|
-
"span",
|
|
695
|
-
{
|
|
696
|
-
"aria-hidden": "true",
|
|
697
|
-
className: "lens-chart-overlay-mark",
|
|
698
|
-
"data-stroke": a.stroke,
|
|
699
|
-
style: { "--lens-overlay-ink": `var(${Ft(a.tone)})` }
|
|
700
|
-
}
|
|
701
|
-
),
|
|
702
|
-
/* @__PURE__ */ l("span", { className: "lens-chart-legend-label", children: a.label }),
|
|
703
|
-
a.detail && /* @__PURE__ */ k(Ee, { children: [
|
|
704
|
-
/* @__PURE__ */ l("span", { "aria-hidden": "true", className: "lens-chart-legend-separator", children: "·" }),
|
|
705
|
-
/* @__PURE__ */ l("span", { className: "lens-chart-legend-value", children: a.detail })
|
|
706
|
-
] })
|
|
707
|
-
]
|
|
708
|
-
}
|
|
709
|
-
) }, a.id))
|
|
710
|
-
] });
|
|
711
|
-
});
|
|
712
|
-
export {
|
|
713
|
-
Ro as ChartPanel,
|
|
714
|
-
ht as collapseExpandableTopN,
|
|
715
|
-
ft as collapseMinorDonutSlices,
|
|
716
|
-
St as donutRemainderKey,
|
|
717
|
-
Oe as legendKey,
|
|
718
|
-
mt as rowIndexForKey,
|
|
719
|
-
fo as topNGroupField
|
|
720
|
-
};
|