@svgrid/grid-wc 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +110 -110
- package/dist/{GridMenus-DpmS1pzo.js → GridMenus-YwTw9Upd.js} +64 -62
- package/dist/{SvDateRangeInput-u4ibte8S.js → SvDateRangeInput-CrxeppBV.js} +6 -6
- package/dist/{shadow/SvDateTimePicker-DVFiDxUq.js → SvDateTimePicker-xAO-Pb4S.js} +22 -22
- package/dist/{shadow/SvField-ChCI-O2O.js → SvField-CE345DyF.js} +3 -3
- package/dist/{SvGridCellEditor-DvsQyE9a.js → SvGridCellEditor-D7SyHtff.js} +2 -2
- package/dist/SvGridChart-CMaVmlso.js +1477 -0
- package/dist/SvGridChartPanel-Pc_IW0eA.js +833 -0
- package/dist/{SvGridChartView-ScXTF6t-.js → SvGridChartView-DLhhzmFy.js} +6 -4
- package/dist/{shadow/SvGridDropdown-DnAESFDu.js → SvGridDropdown-DUncHqM-.js} +2 -2
- package/dist/{cell-formatting-C0OsDmi_.js → cell-formatting-Eypm-id0.js} +1 -1
- package/dist/chart-GRBAgN1M.js +1658 -0
- package/dist/{date-format-CPHqTHN6.js → date-format-D_oQ5Yw0.js} +13 -13
- package/dist/{export-format-B6FUgOll.js → export-format-uGayRKWM.js} +3 -3
- package/dist/shadow/{GridMenus-DpmS1pzo.js → GridMenus-YwTw9Upd.js} +64 -62
- package/dist/shadow/{SvDateRangeInput-u4ibte8S.js → SvDateRangeInput-CrxeppBV.js} +6 -6
- package/dist/{SvDateTimePicker-DVFiDxUq.js → shadow/SvDateTimePicker-xAO-Pb4S.js} +22 -22
- package/dist/{SvField-ChCI-O2O.js → shadow/SvField-CE345DyF.js} +3 -3
- package/dist/shadow/{SvGridCellEditor-DvsQyE9a.js → SvGridCellEditor-D7SyHtff.js} +2 -2
- package/dist/shadow/SvGridChart-CMaVmlso.js +1477 -0
- package/dist/shadow/SvGridChartPanel-Pc_IW0eA.js +833 -0
- package/dist/shadow/{SvGridChartView-ScXTF6t-.js → SvGridChartView-DLhhzmFy.js} +6 -4
- package/dist/{SvGridDropdown-DnAESFDu.js → shadow/SvGridDropdown-DUncHqM-.js} +2 -2
- package/dist/shadow/{cell-formatting-C0OsDmi_.js → cell-formatting-Eypm-id0.js} +1 -1
- package/dist/shadow/chart-GRBAgN1M.js +1658 -0
- package/dist/shadow/{date-format-CPHqTHN6.js → date-format-D_oQ5Yw0.js} +13 -13
- package/dist/shadow/{export-format-C8kZGZfz.js → export-format-DhdZREP1.js} +3 -3
- package/dist/shadow/sv-grid-shadow-element.js +2160 -2000
- package/dist/sv-grid-element.js +2158 -1998
- package/package.json +3 -3
- package/dist/SvGridChart-yK5Zv85y.js +0 -1199
- package/dist/SvGridChartPanel-B38_VjXM.js +0 -584
- package/dist/chart-uvs3sFJA.js +0 -1220
- package/dist/shadow/SvGridChart-yK5Zv85y.js +0 -1199
- package/dist/shadow/SvGridChartPanel-B38_VjXM.js +0 -584
- package/dist/shadow/chart-uvs3sFJA.js +0 -1220
|
@@ -0,0 +1,833 @@
|
|
|
1
|
+
import { $ as e, E as t, F as n, H as r, I as i, J as a, K as o, L as s, M as c, O as l, P as u, R as d, S as f, V as p, X as m, Z as h, _ as g, a as ee, d as _, et as v, f as y, g as b, j as x, k as S, n as C, nt as w, o as te, p as T, q as ne, rt as E, s as D, tt as re, v as ie, w as O, y as k } from "./client-DjwUji8D.js";
|
|
2
|
+
import { t as ae } from "./SvGridChart-CMaVmlso.js";
|
|
3
|
+
//#region ../../node_modules/.pnpm/svelte@5.55.9_@typescript-eslint+types@8.67.0/node_modules/svelte/src/transition/index.js
|
|
4
|
+
function A(e) {
|
|
5
|
+
let t = e - 1;
|
|
6
|
+
return t * t * t + 1;
|
|
7
|
+
}
|
|
8
|
+
function j(e) {
|
|
9
|
+
let t = typeof e == "string" && e.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);
|
|
10
|
+
return t ? [parseFloat(t[1]), t[2] || "px"] : [e, "px"];
|
|
11
|
+
}
|
|
12
|
+
function M(e, { delay: t = 0, duration: n = 400, easing: r = A, x: i = 0, y: a = 0, opacity: o = 0 } = {}) {
|
|
13
|
+
let s = getComputedStyle(e), c = +s.opacity, l = s.transform === "none" ? "" : s.transform, u = c * (1 - o), [d, f] = j(i), [p, m] = j(a);
|
|
14
|
+
return {
|
|
15
|
+
delay: t,
|
|
16
|
+
duration: n,
|
|
17
|
+
easing: r,
|
|
18
|
+
css: (e, t) => `
|
|
19
|
+
transform: ${l} translate(${(1 - e) * d}${f}, ${(1 - e) * p}${m});
|
|
20
|
+
opacity: ${c - u * t}`
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region ../../node_modules/.pnpm/svelte@5.55.9_@typescript-eslint+types@8.67.0/node_modules/svelte/src/easing/index.js
|
|
25
|
+
function oe(e) {
|
|
26
|
+
let t = e - 1;
|
|
27
|
+
return t * t * t + 1;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region ../grid/dist/chart-export.js
|
|
31
|
+
function N(e) {
|
|
32
|
+
return e instanceof SVGSVGElement ? e : e.querySelector("svg.sv-grid-chart-svg") ?? e.querySelector("svg");
|
|
33
|
+
}
|
|
34
|
+
function P(e, t, n) {
|
|
35
|
+
return getComputedStyle(e).getPropertyValue(t).trim() || n;
|
|
36
|
+
}
|
|
37
|
+
function F(e, t = {}) {
|
|
38
|
+
let n = N(e);
|
|
39
|
+
if (!n) throw Error("chartToSvgString: no <svg> found");
|
|
40
|
+
let r = P(n, "--sg-fg", "#0f172a"), i = P(n, "--sg-muted", "#64748b"), a = P(n, "--sg-border", "#e2e8f0"), o = t.background ?? P(n, "--sg-bg", "#ffffff"), s = n.viewBox.baseVal, c = s && s.width ? s.width : n.clientWidth || 520, l = s && s.height ? s.height : n.clientHeight || 300, u = n.cloneNode(!0);
|
|
41
|
+
u.setAttribute("width", String(c)), u.setAttribute("height", String(l)), u.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
42
|
+
let d = [
|
|
43
|
+
"fill",
|
|
44
|
+
"fill-opacity",
|
|
45
|
+
"stroke",
|
|
46
|
+
"stroke-width",
|
|
47
|
+
"stroke-opacity",
|
|
48
|
+
"stroke-dasharray",
|
|
49
|
+
"stroke-linecap",
|
|
50
|
+
"stroke-linejoin",
|
|
51
|
+
"opacity",
|
|
52
|
+
"font-size",
|
|
53
|
+
"font-family",
|
|
54
|
+
"font-weight",
|
|
55
|
+
"text-anchor"
|
|
56
|
+
], f = n.querySelectorAll("*"), p = u.querySelectorAll("*");
|
|
57
|
+
for (let e = 0; e < f.length; e += 1) {
|
|
58
|
+
let t = p[e];
|
|
59
|
+
if (!t || !t.style) continue;
|
|
60
|
+
let n = getComputedStyle(f[e]);
|
|
61
|
+
for (let e of d) {
|
|
62
|
+
let r = n.getPropertyValue(e);
|
|
63
|
+
r && r !== "normal" && t.style.setProperty(e, r);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
u.querySelectorAll(".sv-grid-chart-hit").forEach((e) => e.remove());
|
|
67
|
+
let m = document.createElementNS("http://www.w3.org/2000/svg", "style");
|
|
68
|
+
m.textContent = `
|
|
69
|
+
.sv-grid-chart-axis { fill: ${i}; font-size: 10px; font-family: sans-serif; }
|
|
70
|
+
.sv-grid-chart-gridline { stroke: ${a}; stroke-width: 1; opacity: 0.6; }
|
|
71
|
+
.sv-grid-chart-gridline.is-zero { stroke: ${i}; opacity: 0.9; }
|
|
72
|
+
.sv-grid-chart-datalabel { fill: ${r}; font-size: 9.5px; font-weight: 600; font-family: sans-serif; }
|
|
73
|
+
.sv-grid-chart-datalabel.on-bar { fill: #fff; }
|
|
74
|
+
.sv-grid-chart-donut-total { fill: ${r}; font-size: 16px; font-weight: 800; font-family: sans-serif; }
|
|
75
|
+
.sv-grid-chart-donut-label { fill: ${i}; font-size: 10px; font-family: sans-serif; }
|
|
76
|
+
`, u.insertBefore(m, u.firstChild);
|
|
77
|
+
let h = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
78
|
+
return h.setAttribute("x", "0"), h.setAttribute("y", "0"), h.setAttribute("width", String(c)), h.setAttribute("height", String(l)), h.setAttribute("fill", o), u.insertBefore(h, m.nextSibling), new XMLSerializer().serializeToString(u);
|
|
79
|
+
}
|
|
80
|
+
function I(e, t) {
|
|
81
|
+
let n = document.createElement("a");
|
|
82
|
+
n.href = e, n.download = t, document.body.appendChild(n), n.click(), n.remove();
|
|
83
|
+
}
|
|
84
|
+
function se(e, t = "chart.svg", n = {}) {
|
|
85
|
+
let r = F(e, n), i = URL.createObjectURL(new Blob([r], { type: "image/svg+xml" }));
|
|
86
|
+
I(i, t), setTimeout(() => URL.revokeObjectURL(i), 1e3);
|
|
87
|
+
}
|
|
88
|
+
function ce(e, t = {}) {
|
|
89
|
+
let n = F(e, t), r = t.scale ?? 2, i = N(e), a = i.viewBox.baseVal, o = (a && a.width ? a.width : i.clientWidth || 520) * r, s = (a && a.height ? a.height : i.clientHeight || 300) * r;
|
|
90
|
+
return new Promise((e, t) => {
|
|
91
|
+
let r = URL.createObjectURL(new Blob([n], { type: "image/svg+xml" })), i = new Image();
|
|
92
|
+
i.onload = () => {
|
|
93
|
+
let n = document.createElement("canvas");
|
|
94
|
+
n.width = Math.round(o), n.height = Math.round(s);
|
|
95
|
+
let a = n.getContext("2d");
|
|
96
|
+
if (!a) {
|
|
97
|
+
URL.revokeObjectURL(r), t(/* @__PURE__ */ Error("canvas 2d context unavailable"));
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
a.drawImage(i, 0, 0, n.width, n.height), URL.revokeObjectURL(r), n.toBlob((n) => n ? e(n) : t(/* @__PURE__ */ Error("toBlob failed")), "image/png");
|
|
101
|
+
}, i.onerror = () => {
|
|
102
|
+
URL.revokeObjectURL(r), t(/* @__PURE__ */ Error("failed to rasterize chart SVG"));
|
|
103
|
+
}, i.src = r;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
async function L(e, t = "chart.png", n = {}) {
|
|
107
|
+
let r = await ce(e, n), i = URL.createObjectURL(r);
|
|
108
|
+
I(i, t), setTimeout(() => URL.revokeObjectURL(i), 1e3);
|
|
109
|
+
}
|
|
110
|
+
var R = (e) => {
|
|
111
|
+
let t = e == null ? "" : String(e);
|
|
112
|
+
return /[",\n]/.test(t) ? `"${t.replace(/"/g, "\"\"")}"` : t;
|
|
113
|
+
};
|
|
114
|
+
function z(e) {
|
|
115
|
+
let t = e.series ?? [];
|
|
116
|
+
if (t.some((e) => e.points?.length)) {
|
|
117
|
+
let e = [
|
|
118
|
+
"Series",
|
|
119
|
+
"X",
|
|
120
|
+
"Y",
|
|
121
|
+
"Size",
|
|
122
|
+
"Label"
|
|
123
|
+
].map(R).join(","), n = [];
|
|
124
|
+
for (let e of t) for (let t of e.points ?? []) n.push([
|
|
125
|
+
e.label,
|
|
126
|
+
t.x,
|
|
127
|
+
t.y,
|
|
128
|
+
t.r ?? "",
|
|
129
|
+
t.label ?? ""
|
|
130
|
+
].map(R).join(","));
|
|
131
|
+
return n.length ? [e, ...n].join("\n") : "";
|
|
132
|
+
}
|
|
133
|
+
let n = e.categories ?? [];
|
|
134
|
+
if (!n.length || !t.length) return "";
|
|
135
|
+
let r = ["Category"];
|
|
136
|
+
for (let e of t) e.ohlc ? r.push(`${e.label} Open`, `${e.label} High`, `${e.label} Low`, `${e.label} Close`) : e.boxes ? r.push(`${e.label} Min`, `${e.label} Q1`, `${e.label} Median`, `${e.label} Q3`, `${e.label} Max`, `${e.label} Outliers`) : e.errors ? r.push(e.label, `${e.label} Low`, `${e.label} High`) : r.push(e.label);
|
|
137
|
+
let i = n.map((e, n) => {
|
|
138
|
+
let r = [e];
|
|
139
|
+
for (let e of t) if (e.ohlc) {
|
|
140
|
+
let t = e.ohlc[n];
|
|
141
|
+
r.push(t?.o ?? "", t?.h ?? "", t?.l ?? "", t?.c ?? "");
|
|
142
|
+
} else if (e.boxes) {
|
|
143
|
+
let t = e.boxes[n];
|
|
144
|
+
r.push(t?.min ?? "", t?.q1 ?? "", t?.median ?? "", t?.q3 ?? "", t?.max ?? "", t?.outliers?.join(" ") ?? "");
|
|
145
|
+
} else if (e.errors) {
|
|
146
|
+
let t = e.values[n], i = e.errors[n], a = i == null ? "" : typeof i == "number" ? (t ?? 0) - Math.abs(i) : Math.min(i.lo, i.hi), o = i == null ? "" : typeof i == "number" ? (t ?? 0) + Math.abs(i) : Math.max(i.lo, i.hi);
|
|
147
|
+
r.push(t ?? "", a, o);
|
|
148
|
+
} else r.push(e.values[n] ?? "");
|
|
149
|
+
return r.map(R).join(",");
|
|
150
|
+
});
|
|
151
|
+
return [r.map(R).join(","), ...i].join("\n");
|
|
152
|
+
}
|
|
153
|
+
function le(e) {
|
|
154
|
+
let t = e.series ?? [];
|
|
155
|
+
return t.some((e) => e.points?.length) ? !0 : !!(e.categories?.length && t.length);
|
|
156
|
+
}
|
|
157
|
+
function ue(e, t = "chart.csv") {
|
|
158
|
+
let n = z(e);
|
|
159
|
+
if (!n) return !1;
|
|
160
|
+
let r = URL.createObjectURL(new Blob([n], { type: "text/csv;charset=utf-8" }));
|
|
161
|
+
return I(r, t), setTimeout(() => URL.revokeObjectURL(r), 1e3), !0;
|
|
162
|
+
}
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region ../grid/dist/SvGridChartPanel.svelte
|
|
165
|
+
var de = x("<div role=\"separator\" aria-label=\"Resize chart panel\"></div>"), fe = x("<button type=\"button\" class=\"sv-grid-chart-btn\">Clear filter</button>"), pe = c("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><polyline points=\"20 6 9 17 4 12\"></polyline></svg>"), me = c("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"></path><polyline points=\"7 10 12 15 17 10\"></polyline><line x1=\"12\" y1=\"15\" x2=\"12\" y2=\"3\"></line></svg>"), he = x("<div class=\"sv-grid-chart-export-menu\" role=\"menu\"><button type=\"button\" role=\"menuitem\">PNG image</button> <button type=\"button\" role=\"menuitem\">SVG vector</button> <button type=\"button\" role=\"menuitem\">CSV data</button> <button type=\"button\" role=\"menuitem\">Copy to clipboard</button></div>"), ge = x("<button type=\"button\" aria-label=\"Chart with AI\" title=\"Chart with AI\"><svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M12 2l1.9 4.6L18.5 8.5 13.9 10.4 12 15l-1.9-4.6L5.5 8.5l4.6-1.9L12 2zm6 11l1 2.4 2.4 1-2.4 1L18 21l-1-2.6-2.4-1 2.4-1L18 13zM6 14l.8 2 2 .8-2 .8L6 20l-.8-2.4-2-.8 2-.8L6 14z\"></path></svg> AI</button>"), _e = x("<button type=\"button\" class=\"sv-grid-chart-icon-btn\" aria-label=\"Add chart\" title=\"Add chart\"><svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"></line><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"></line></svg></button>"), ve = c("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M8 3v3a2 2 0 0 1-2 2H3\"></path><path d=\"M21 8h-3a2 2 0 0 1-2-2V3\"></path><path d=\"M3 16h3a2 2 0 0 1 2 2v3\"></path><path d=\"M16 21v-3a2 2 0 0 1 2-2h3\"></path></svg>"), ye = c("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M8 3H5a2 2 0 0 0-2 2v3\"></path><path d=\"M21 8V5a2 2 0 0 0-2-2h-3\"></path><path d=\"M3 16v3a2 2 0 0 0 2 2h3\"></path><path d=\"M16 21h3a2 2 0 0 0 2-2v-3\"></path></svg>"), be = x("<button type=\"button\" class=\"sv-grid-chart-icon-btn\"><!></button> <button type=\"button\" class=\"sv-grid-chart-icon-btn\" aria-label=\"Dock chart\" title=\"Dock\"><svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"></rect><line x1=\"15\" y1=\"3\" x2=\"15\" y2=\"21\"></line></svg></button>", 1), xe = x("<button type=\"button\" class=\"sv-grid-chart-icon-btn\" aria-label=\"Pop out chart\" title=\"Pop out\"><svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M15 3h6v6\"></path><path d=\"M10 14 21 3\"></path><path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"></path></svg></button>"), Se = x("<div><button type=\"button\" class=\"sv-grid-chart-tab-label\" role=\"tab\"> </button> <button type=\"button\" class=\"sv-grid-chart-tab-x\" title=\"Remove\">×</button></div>"), Ce = x("<div class=\"sv-grid-chart-tabs\" role=\"tablist\" aria-label=\"Charts\"></div>"), we = x("<p class=\"sv-grid-chart-ai-msg is-error\"> </p>"), Te = x("<p class=\"sv-grid-chart-ai-msg\"> </p>"), Ee = x("<div class=\"sv-grid-chart-ai\"><form class=\"sv-grid-chart-ai-row\"><input class=\"sv-grid-chart-ai-input\" type=\"text\" placeholder=\"Describe a chart, e.g. revenue by region stacked by product\"/> <button type=\"submit\" class=\"sv-grid-chart-btn\"> </button></form> <!></div>"), De = x("<option> </option>"), Oe = x("<optgroup></optgroup>"), ke = x("<option> </option>"), Ae = x("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\"> </span> <select></select></label>"), je = x("<option> </option>"), Me = x("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\"> </span> <select><option>(none)</option><!></select></label>"), Ne = x("<option> </option>"), Pe = x("<option> </option>"), Fe = x("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\">Y</span> <select></select></label>"), Ie = x("<option> </option>"), Le = x("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\">Aggregate</span> <select></select></label>"), Re = x("<option> </option>"), ze = x("<label class=\"sv-grid-chart-toggle\"><input type=\"checkbox\"/> Stacked</label> <label class=\"sv-grid-chart-toggle\" title=\"Normalise each category to 100 percent\"><input type=\"checkbox\"/> 100%</label>", 1), Be = x("<label class=\"sv-grid-chart-toggle\" title=\"Bars grow rightwards - suits long category labels\"><input type=\"checkbox\"/> Horizontal</label>"), Ve = x("<label class=\"sv-grid-chart-toggle\"><input type=\"checkbox\"/> Donut</label>"), He = x("<option> </option>"), Ue = x("<label class=\"sv-grid-chart-toggle\"><input type=\"checkbox\"/> Labels</label>"), We = x("<label class=\"sv-grid-chart-toggle\" title=\"Logarithmic value axis - flattens wide-range data\"><input type=\"checkbox\"/> Log scale</label>"), Ge = x("<label class=\"sv-grid-chart-toggle\" title=\"Space points by actual date - real time ticks and proportional gaps\"><input type=\"checkbox\"/> Date axis</label>"), Ke = x("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\">Type</span> <select></select></label> <!> <!> <label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\"> </span> <select></select></label> <!> <!> <label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\">Format</span> <select></select></label> <!> <!> <!> <label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\">Colours</span> <select></select></label> <!> <!> <!>", 1), qe = x("<p class=\"sv-grid-chart-hint\" role=\"note\"> </p>"), Je = x("<p class=\"sv-grid-chart-empty\"><!></p>"), Ye = x("<div class=\"sv-grid-chart-float-resizer\" role=\"separator\" aria-label=\"Resize chart window\"></div>"), Xe = x("<section aria-label=\"Chart\"><!> <header class=\"sv-grid-chart-panel-head\"><div><svg class=\"sv-grid-chart-title-icon\" width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><line x1=\"12\" y1=\"20\" x2=\"12\" y2=\"10\"></line><line x1=\"18\" y1=\"20\" x2=\"18\" y2=\"4\"></line><line x1=\"6\" y1=\"20\" x2=\"6\" y2=\"16\"></line></svg> <span class=\"sv-grid-chart-title\">Chart</span> <div class=\"sv-grid-chart-actions\"><!> <div class=\"sv-grid-chart-export\"><button type=\"button\" class=\"sv-grid-chart-icon-btn\" aria-label=\"Export chart\" title=\"Export\"><!></button> <!></div> <!> <!> <!> <button type=\"button\" class=\"sv-grid-chart-close\" aria-label=\"Close chart\">×</button></div></div> <!> <!> <div class=\"sv-grid-chart-controls\"><!> <!></div></header> <div class=\"sv-grid-chart-panel-body\"><!></div> <!></section>");
|
|
166
|
+
function B(n, c) {
|
|
167
|
+
re(c, !0);
|
|
168
|
+
let x = C(c, "ctrl", 7), A = e(() => x().chartingConfig), j = e(() => x().chartCfg), N = e(() => x().chartIsCustom), P = e(() => d(A)?.position ?? "bottom"), F = e(() => d(A)?.crossFilter !== !1), I = e(() => x().chartSpec), R = e(() => x().chartableColumns), z = e(() => x().chartSize ?? (d(P) === "right" ? d(A)?.width ?? 340 : d(A)?.height ?? 260)), B = e(() => x().chartFloating), V = e(() => x().chartMaximized), H = e(() => x().chartFloatRect), Ze = h(null);
|
|
169
|
+
function Qe() {
|
|
170
|
+
let e = d(Ze)?.offsetParent;
|
|
171
|
+
return {
|
|
172
|
+
w: e?.clientWidth ?? 800,
|
|
173
|
+
h: e?.clientHeight ?? 520
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function $e() {
|
|
177
|
+
if (!x().chartFloatRect) {
|
|
178
|
+
let { w: e, h: t } = Qe(), n = Math.min(600, Math.max(360, e - 80)), r = Math.min(430, Math.max(260, t - 90));
|
|
179
|
+
x().chartFloatRect = {
|
|
180
|
+
x: Math.round((e - n) / 2),
|
|
181
|
+
y: Math.round((t - r) / 2),
|
|
182
|
+
w: n,
|
|
183
|
+
h: r
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
x().chartFloating = !0;
|
|
187
|
+
}
|
|
188
|
+
function et() {
|
|
189
|
+
x().chartFloating = !1, x().chartMaximized = !1;
|
|
190
|
+
}
|
|
191
|
+
let tt = () => x().chartMaximized = !x().chartMaximized;
|
|
192
|
+
function nt(e) {
|
|
193
|
+
if (!d(B) || d(V) || e.target?.closest("button")) return;
|
|
194
|
+
let t = x().chartFloatRect;
|
|
195
|
+
if (!t) return;
|
|
196
|
+
e.preventDefault();
|
|
197
|
+
let n = e.clientX, r = e.clientY, { w: i, h: a } = Qe(), o = (e) => {
|
|
198
|
+
let o = Math.max(0, Math.min(i - t.w, t.x + e.clientX - n)), s = Math.max(0, Math.min(a - t.h, t.y + e.clientY - r));
|
|
199
|
+
x().chartFloatRect = {
|
|
200
|
+
x: o,
|
|
201
|
+
y: s,
|
|
202
|
+
w: t.w,
|
|
203
|
+
h: t.h
|
|
204
|
+
};
|
|
205
|
+
}, s = () => {
|
|
206
|
+
window.removeEventListener("pointermove", o), window.removeEventListener("pointerup", s);
|
|
207
|
+
};
|
|
208
|
+
window.addEventListener("pointermove", o), window.addEventListener("pointerup", s);
|
|
209
|
+
}
|
|
210
|
+
function rt(e) {
|
|
211
|
+
let t = x().chartFloatRect;
|
|
212
|
+
if (!t) return;
|
|
213
|
+
e.preventDefault(), e.stopPropagation();
|
|
214
|
+
let n = e.clientX, r = e.clientY;
|
|
215
|
+
e.target.setPointerCapture?.(e.pointerId);
|
|
216
|
+
let i = (e) => {
|
|
217
|
+
x().chartFloatRect = {
|
|
218
|
+
x: t.x,
|
|
219
|
+
y: t.y,
|
|
220
|
+
w: Math.max(300, t.w + e.clientX - n),
|
|
221
|
+
h: Math.max(220, t.h + e.clientY - r)
|
|
222
|
+
};
|
|
223
|
+
}, a = () => {
|
|
224
|
+
window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a);
|
|
225
|
+
};
|
|
226
|
+
window.addEventListener("pointermove", i), window.addEventListener("pointerup", a);
|
|
227
|
+
}
|
|
228
|
+
let it = e(() => d(B) ? d(V) ? "left:12px; top:12px; right:12px; bottom:12px; width:auto; height:auto;" : d(H) ? `left:${d(H).x}px; top:${d(H).y}px; width:${d(H).w}px; height:${d(H).h}px;` : "" : d(P) === "right" ? `width:${d(z)}px` : `height:${d(z)}px`), at = h(0), ot = h(0), st = e(() => d(I) ? d(I).type === "pie" ? d(I).categories.length : d(I).series.length : 0), ct = e(() => (d(st) > 1 ? 36 : 0) + (d(j)?.export === !0 ? 30 : 0)), lt = e(() => d(at) > 24 ? d(at) - 8 : void 0), ut = e(() => d(ot) > 24 ? Math.max(120, d(ot) - 8 - d(ct)) : void 0), dt = [
|
|
229
|
+
{
|
|
230
|
+
value: "bar",
|
|
231
|
+
label: "Bar",
|
|
232
|
+
group: "Compare"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
value: "line",
|
|
236
|
+
label: "Line",
|
|
237
|
+
group: "Compare"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
value: "area",
|
|
241
|
+
label: "Area",
|
|
242
|
+
group: "Compare"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
value: "pie",
|
|
246
|
+
label: "Pie",
|
|
247
|
+
group: "Part of a whole"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
value: "treemap",
|
|
251
|
+
label: "Tree map",
|
|
252
|
+
group: "Part of a whole"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
value: "funnel",
|
|
256
|
+
label: "Funnel",
|
|
257
|
+
group: "Flow"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
value: "waterfall",
|
|
261
|
+
label: "Waterfall",
|
|
262
|
+
group: "Flow"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
value: "sankey",
|
|
266
|
+
label: "Sankey",
|
|
267
|
+
group: "Flow",
|
|
268
|
+
needs: (e) => e.dims.length >= 2
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
value: "radar",
|
|
272
|
+
label: "Radar",
|
|
273
|
+
group: "Distribution"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
value: "heatmap",
|
|
277
|
+
label: "Heat map",
|
|
278
|
+
group: "Distribution",
|
|
279
|
+
needs: (e) => e.dims.length >= 2
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
value: "scatter",
|
|
283
|
+
label: "Scatter",
|
|
284
|
+
group: "Distribution",
|
|
285
|
+
needs: (e) => e.measures.length >= 2
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
value: "boxplot",
|
|
289
|
+
label: "Box plot",
|
|
290
|
+
group: "Distribution"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
value: "gauge",
|
|
294
|
+
label: "Gauge",
|
|
295
|
+
group: "Single value"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
value: "calendar",
|
|
299
|
+
label: "Calendar",
|
|
300
|
+
group: "Over time",
|
|
301
|
+
needs: (e) => e.dates.length >= 1
|
|
302
|
+
}
|
|
303
|
+
], ft = e(() => dt.filter((e) => !e.needs || e.needs(d(R)))), pt = [
|
|
304
|
+
"bar",
|
|
305
|
+
"line",
|
|
306
|
+
"area"
|
|
307
|
+
], mt = [
|
|
308
|
+
{
|
|
309
|
+
key: "theme",
|
|
310
|
+
label: "Theme",
|
|
311
|
+
colors: null
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
key: "ocean",
|
|
315
|
+
label: "Ocean",
|
|
316
|
+
colors: [
|
|
317
|
+
"#0ea5e9",
|
|
318
|
+
"#14b8a6",
|
|
319
|
+
"#6366f1",
|
|
320
|
+
"#8b5cf6",
|
|
321
|
+
"#06b6d4"
|
|
322
|
+
]
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
key: "sunset",
|
|
326
|
+
label: "Sunset",
|
|
327
|
+
colors: [
|
|
328
|
+
"#f59e0b",
|
|
329
|
+
"#ef4444",
|
|
330
|
+
"#ec4899",
|
|
331
|
+
"#8b5cf6",
|
|
332
|
+
"#f97316"
|
|
333
|
+
]
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
key: "forest",
|
|
337
|
+
label: "Forest",
|
|
338
|
+
colors: [
|
|
339
|
+
"#16a34a",
|
|
340
|
+
"#65a30d",
|
|
341
|
+
"#0d9488",
|
|
342
|
+
"#4d7c0f",
|
|
343
|
+
"#0891b2"
|
|
344
|
+
]
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
key: "slate",
|
|
348
|
+
label: "Slate",
|
|
349
|
+
colors: [
|
|
350
|
+
"#475569",
|
|
351
|
+
"#0ea5e9",
|
|
352
|
+
"#64748b",
|
|
353
|
+
"#38bdf8",
|
|
354
|
+
"#94a3b8"
|
|
355
|
+
]
|
|
356
|
+
}
|
|
357
|
+
], ht = e(() => mt.find((e) => e.colors && x().chartPalette && e.colors.join() === x().chartPalette.join())?.key ?? "theme"), gt = e(() => x().chartType === "bar"), _t = e(() => x().chartType === "pie"), vt = e(() => x().chartType !== "gauge"), yt = e(() => d(R).dims.length > 1 && ![
|
|
358
|
+
"pie",
|
|
359
|
+
"gauge",
|
|
360
|
+
"waterfall",
|
|
361
|
+
"funnel",
|
|
362
|
+
"calendar"
|
|
363
|
+
].includes(x().chartType)), bt = e(() => pt.includes(x().chartType)), xt = e(() => pt.includes(x().chartType) || x().chartType === "scatter" || x().chartType === "boxplot"), St = e(() => ![
|
|
364
|
+
"gauge",
|
|
365
|
+
"sankey",
|
|
366
|
+
"calendar",
|
|
367
|
+
"treemap",
|
|
368
|
+
"scatter",
|
|
369
|
+
"boxplot"
|
|
370
|
+
].includes(x().chartType)), Ct = e(() => x().chartType === "scatter"), wt = e(() => !d(Ct) && x().chartType !== "boxplot"), Tt = e(() => [...new Set(d(ft).map((e) => e.group))]), Et = e(() => {
|
|
371
|
+
let e = x().chartType, t = x().chartSpec?.categories.length ?? 0;
|
|
372
|
+
return e === "heatmap" && !x().chartSeriesId && d(R).dims.length > 1 ? "Heat map needs a Split by column for its rows." : e === "sankey" && !x().chartSeriesId ? "Sankey needs a Split by column: Group by is the source, Split by the target." : e === "radar" && t > 0 && t < 3 ? "Radar needs at least 3 groups." : e === "funnel" && t === 1 ? "Funnel needs at least 2 stages." : null;
|
|
373
|
+
}), Dt = [
|
|
374
|
+
{
|
|
375
|
+
value: "sum",
|
|
376
|
+
label: "Sum"
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
value: "avg",
|
|
380
|
+
label: "Average"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
value: "count",
|
|
384
|
+
label: "Count"
|
|
385
|
+
}
|
|
386
|
+
], Ot = [
|
|
387
|
+
{
|
|
388
|
+
value: "number",
|
|
389
|
+
label: "Number"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
value: "currency",
|
|
393
|
+
label: "Currency"
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
value: "percent",
|
|
397
|
+
label: "Percent"
|
|
398
|
+
}
|
|
399
|
+
];
|
|
400
|
+
function kt(e) {
|
|
401
|
+
d(F) && e.category != null && x().applyChartCrossFilter(String(e.category));
|
|
402
|
+
}
|
|
403
|
+
let At = h(null), U = h(!1), jt = h(!1), Mt = () => d(At)?.querySelector("svg") ?? null, Nt = e(() => !!d(I) && le(d(I)));
|
|
404
|
+
function Pt() {
|
|
405
|
+
let e = Mt();
|
|
406
|
+
e && L(e, "chart.png"), m(U, !1);
|
|
407
|
+
}
|
|
408
|
+
function Ft() {
|
|
409
|
+
let e = Mt();
|
|
410
|
+
e && se(e, "chart.svg"), m(U, !1);
|
|
411
|
+
}
|
|
412
|
+
function It() {
|
|
413
|
+
d(I) && ue(d(I), "chart.csv"), m(U, !1);
|
|
414
|
+
}
|
|
415
|
+
async function Lt() {
|
|
416
|
+
let e = Mt();
|
|
417
|
+
if (m(U, !1), !(!e || typeof ClipboardItem > "u" || !navigator.clipboard?.write)) try {
|
|
418
|
+
let t = await ce(e);
|
|
419
|
+
await navigator.clipboard.write([new ClipboardItem({ "image/png": t })]), m(jt, !0), setTimeout(() => m(jt, !1), 1400);
|
|
420
|
+
} catch {}
|
|
421
|
+
}
|
|
422
|
+
r(() => {
|
|
423
|
+
if (!d(U)) return;
|
|
424
|
+
let e = (e) => {
|
|
425
|
+
e.target?.closest(".sv-grid-chart-export") || m(U, !1);
|
|
426
|
+
};
|
|
427
|
+
return window.addEventListener("pointerdown", e), () => window.removeEventListener("pointerdown", e);
|
|
428
|
+
});
|
|
429
|
+
let Rt = e(() => !!x().chartAiHandler), W = h(!1), G = h(""), K = h(!1), q = h(""), J = h("");
|
|
430
|
+
async function zt() {
|
|
431
|
+
let e = x().chartAiHandler, t = d(G).trim();
|
|
432
|
+
if (!(!e || !t || d(K))) {
|
|
433
|
+
m(K, !0), m(q, ""), m(J, "");
|
|
434
|
+
try {
|
|
435
|
+
let n = await e(t);
|
|
436
|
+
n ? (x().applyChartConfig(n), m(J, typeof n.rationale == "string" ? n.rationale : "", !0)) : m(q, "Couldn't build a chart from that request.");
|
|
437
|
+
} catch (e) {
|
|
438
|
+
m(q, e instanceof Error ? e.message : "Something went wrong.", !0);
|
|
439
|
+
} finally {
|
|
440
|
+
m(K, !1);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
let Bt = h(!1);
|
|
445
|
+
function Vt(e) {
|
|
446
|
+
e.preventDefault(), m(Bt, !0);
|
|
447
|
+
let t = d(P) === "right" ? e.clientX : e.clientY, n = d(z);
|
|
448
|
+
e.target.setPointerCapture?.(e.pointerId);
|
|
449
|
+
let r = (e) => {
|
|
450
|
+
let r = d(P) === "right" ? t - e.clientX : t - e.clientY;
|
|
451
|
+
x().chartSize = Math.max(160, Math.min(720, n + r));
|
|
452
|
+
}, i = () => {
|
|
453
|
+
m(Bt, !1), window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", i);
|
|
454
|
+
};
|
|
455
|
+
window.addEventListener("pointermove", r), window.addEventListener("pointerup", i);
|
|
456
|
+
}
|
|
457
|
+
var Y = Xe();
|
|
458
|
+
let Ht;
|
|
459
|
+
var Ut = o(Y), Wt = (e) => {
|
|
460
|
+
var t = de();
|
|
461
|
+
let n;
|
|
462
|
+
p(() => {
|
|
463
|
+
n = k(t, 1, "sv-grid-chart-resizer", null, n, { "is-dragging": d(Bt) }), y(t, "aria-orientation", d(P) === "right" ? "vertical" : "horizontal");
|
|
464
|
+
}), i("pointerdown", t, Vt), S(e, t);
|
|
465
|
+
};
|
|
466
|
+
t(Ut, (e) => {
|
|
467
|
+
d(B) || e(Wt);
|
|
468
|
+
});
|
|
469
|
+
var Gt = a(Ut, 2), X = o(Gt);
|
|
470
|
+
let Kt;
|
|
471
|
+
var qt = a(o(X), 4), Jt = o(qt), Yt = (e) => {
|
|
472
|
+
var t = fe();
|
|
473
|
+
i("click", t, () => x().clearChartCrossFilter()), S(e, t);
|
|
474
|
+
};
|
|
475
|
+
t(Jt, (e) => {
|
|
476
|
+
d(F) && !d(N) && e(Yt);
|
|
477
|
+
});
|
|
478
|
+
var Z = a(Jt, 2), Q = o(Z), Xt = o(Q), Zt = (e) => {
|
|
479
|
+
var t = pe();
|
|
480
|
+
S(e, t);
|
|
481
|
+
}, Qt = (e) => {
|
|
482
|
+
var t = me();
|
|
483
|
+
S(e, t);
|
|
484
|
+
};
|
|
485
|
+
t(Xt, (e) => {
|
|
486
|
+
d(jt) ? e(Zt) : e(Qt, -1);
|
|
487
|
+
}), E(Q);
|
|
488
|
+
var $t = a(Q, 2), en = (e) => {
|
|
489
|
+
var t = he(), n = o(t), r = a(n, 2), s = a(r, 2), c = a(s, 2);
|
|
490
|
+
E(t), p(() => s.disabled = !d(Nt)), i("click", n, Pt), i("click", r, Ft), i("click", s, It), i("click", c, Lt), S(e, t);
|
|
491
|
+
};
|
|
492
|
+
t($t, (e) => {
|
|
493
|
+
d(U) && e(en);
|
|
494
|
+
}), E(Z);
|
|
495
|
+
var tn = a(Z, 2), nn = (e) => {
|
|
496
|
+
var t = ge();
|
|
497
|
+
let n;
|
|
498
|
+
p(() => {
|
|
499
|
+
n = k(t, 1, "sv-grid-chart-btn sv-grid-chart-ai-btn", null, n, { "is-active": d(W) }), y(t, "aria-expanded", d(W));
|
|
500
|
+
}), i("click", t, () => m(W, !d(W))), S(e, t);
|
|
501
|
+
};
|
|
502
|
+
t(tn, (e) => {
|
|
503
|
+
d(Rt) && !d(N) && e(nn);
|
|
504
|
+
});
|
|
505
|
+
var rn = a(tn, 2), an = (e) => {
|
|
506
|
+
var t = _e();
|
|
507
|
+
i("click", t, () => x().addChart()), S(e, t);
|
|
508
|
+
};
|
|
509
|
+
t(rn, (e) => {
|
|
510
|
+
d(N) || e(an);
|
|
511
|
+
});
|
|
512
|
+
var on = a(rn, 2), sn = (e) => {
|
|
513
|
+
var n = be(), r = ne(n), s = o(r), c = (e) => {
|
|
514
|
+
var t = ve();
|
|
515
|
+
S(e, t);
|
|
516
|
+
}, l = (e) => {
|
|
517
|
+
var t = ye();
|
|
518
|
+
S(e, t);
|
|
519
|
+
};
|
|
520
|
+
t(s, (e) => {
|
|
521
|
+
d(V) ? e(c) : e(l, -1);
|
|
522
|
+
}), E(r);
|
|
523
|
+
var u = a(r, 2);
|
|
524
|
+
p(() => {
|
|
525
|
+
y(r, "aria-label", d(V) ? "Restore" : "Maximize"), y(r, "title", d(V) ? "Restore" : "Maximize");
|
|
526
|
+
}), i("click", r, tt), i("click", u, et), S(e, n);
|
|
527
|
+
}, cn = (e) => {
|
|
528
|
+
var t = xe();
|
|
529
|
+
i("click", t, $e), S(e, t);
|
|
530
|
+
};
|
|
531
|
+
t(on, (e) => {
|
|
532
|
+
d(B) ? e(sn) : e(cn, -1);
|
|
533
|
+
});
|
|
534
|
+
var ln = a(on, 2);
|
|
535
|
+
E(qt), E(X);
|
|
536
|
+
var un = a(X, 2), dn = (e) => {
|
|
537
|
+
var t = Ce();
|
|
538
|
+
O(t, 23, () => x().charts, (e) => e.id, (e, t, n) => {
|
|
539
|
+
var r = Se();
|
|
540
|
+
let s;
|
|
541
|
+
var c = o(r), u = o(c, !0);
|
|
542
|
+
E(c);
|
|
543
|
+
var f = a(c, 2);
|
|
544
|
+
E(r), p(() => {
|
|
545
|
+
s = k(r, 1, "sv-grid-chart-tab", null, s, { "is-active": d(n) === x().activeChartIndex }), y(c, "aria-selected", d(n) === x().activeChartIndex), l(u, d(t).title), y(f, "aria-label", `Remove ${d(t).title}`);
|
|
546
|
+
}), i("click", c, () => x().activeChartIndex = d(n)), i("click", f, () => x().removeChart(d(n))), S(e, r);
|
|
547
|
+
}), E(t), S(e, t);
|
|
548
|
+
};
|
|
549
|
+
t(un, (e) => {
|
|
550
|
+
!d(N) && x().charts.length > 1 && e(dn);
|
|
551
|
+
});
|
|
552
|
+
var fn = a(un, 2), pn = (e) => {
|
|
553
|
+
var n = Ee(), r = o(n), i = o(r);
|
|
554
|
+
_(i);
|
|
555
|
+
var c = a(i, 2), u = o(c, !0);
|
|
556
|
+
E(c), E(r);
|
|
557
|
+
var f = a(r, 2), h = (e) => {
|
|
558
|
+
var t = we(), n = o(t, !0);
|
|
559
|
+
E(t), p(() => l(n, d(q))), S(e, t);
|
|
560
|
+
}, g = (e) => {
|
|
561
|
+
var t = Te(), n = o(t, !0);
|
|
562
|
+
E(t), p(() => l(n, d(J))), S(e, t);
|
|
563
|
+
};
|
|
564
|
+
t(f, (e) => {
|
|
565
|
+
d(q) ? e(h) : d(J) && e(g, 1);
|
|
566
|
+
}), E(n), p((e) => {
|
|
567
|
+
i.disabled = d(K), c.disabled = e, l(u, d(K) ? "Thinking..." : "Chart it");
|
|
568
|
+
}, [() => d(K) || !d(G).trim()]), s("submit", r, (e) => {
|
|
569
|
+
e.preventDefault(), zt();
|
|
570
|
+
}), D(i, () => d(G), (e) => m(G, e)), S(e, n);
|
|
571
|
+
};
|
|
572
|
+
t(fn, (e) => {
|
|
573
|
+
d(Rt) && d(W) && !d(N) && e(pn);
|
|
574
|
+
});
|
|
575
|
+
var mn = a(fn, 2), hn = o(mn), gn = (n) => {
|
|
576
|
+
var r = Ke(), s = ne(r), c = a(o(s), 2);
|
|
577
|
+
O(c, 20, () => d(Tt), (e) => e, (e, t) => {
|
|
578
|
+
var n = Oe();
|
|
579
|
+
O(n, 21, () => d(ft).filter((e) => e.group === t), (e) => e.value, (e, t) => {
|
|
580
|
+
var n = De(), r = o(n, !0);
|
|
581
|
+
E(n);
|
|
582
|
+
var i = {};
|
|
583
|
+
p(() => {
|
|
584
|
+
l(r, d(t).label), i !== (i = d(t).value) && (n.value = (n.__value = d(t).value) ?? "");
|
|
585
|
+
}), S(e, n);
|
|
586
|
+
}), E(n), p(() => y(n, "label", t)), S(e, n);
|
|
587
|
+
}), E(c);
|
|
588
|
+
var u;
|
|
589
|
+
b(c), E(s);
|
|
590
|
+
var f = a(s, 2), m = (e) => {
|
|
591
|
+
var t = Ae(), n = o(t), r = o(n, !0);
|
|
592
|
+
E(n);
|
|
593
|
+
var s = a(n, 2);
|
|
594
|
+
O(s, 21, () => d(R).dims, (e) => e.id, (e, t) => {
|
|
595
|
+
var n = ke(), r = o(n, !0);
|
|
596
|
+
E(n);
|
|
597
|
+
var i = {};
|
|
598
|
+
p(() => {
|
|
599
|
+
l(r, d(t).label), i !== (i = d(t).id) && (n.value = (n.__value = d(t).id) ?? "");
|
|
600
|
+
}), S(e, n);
|
|
601
|
+
}), E(s);
|
|
602
|
+
var c;
|
|
603
|
+
b(s), E(t), p(() => {
|
|
604
|
+
l(r, x().chartType === "sankey" ? "From" : x().chartType === "heatmap" ? "Columns" : "Group by"), c !== (c = x().chartDimensionId ?? "") && (s.value = (s.__value = x().chartDimensionId ?? "") ?? "", g(s, x().chartDimensionId ?? ""));
|
|
605
|
+
}), i("change", s, (e) => x().chartDimensionId = e.currentTarget.value || null), S(e, t);
|
|
606
|
+
};
|
|
607
|
+
t(f, (e) => {
|
|
608
|
+
d(vt) && e(m);
|
|
609
|
+
});
|
|
610
|
+
var h = a(f, 2), ee = (e) => {
|
|
611
|
+
var t = Me(), n = o(t), r = o(n, !0);
|
|
612
|
+
E(n);
|
|
613
|
+
var s = a(n, 2), c = o(s);
|
|
614
|
+
c.value = c.__value = "";
|
|
615
|
+
var u = a(c);
|
|
616
|
+
O(u, 17, () => d(R).dims, (e) => e.id, (e, t) => {
|
|
617
|
+
var n = je(), r = o(n, !0);
|
|
618
|
+
E(n);
|
|
619
|
+
var i = {};
|
|
620
|
+
p(() => {
|
|
621
|
+
l(r, d(t).label), i !== (i = d(t).id) && (n.value = (n.__value = d(t).id) ?? "");
|
|
622
|
+
}), S(e, n);
|
|
623
|
+
}), E(s);
|
|
624
|
+
var f;
|
|
625
|
+
b(s), E(t), p(() => {
|
|
626
|
+
l(r, x().chartType === "sankey" ? "To" : x().chartType === "heatmap" ? "Rows" : "Split by"), f !== (f = x().chartSeriesId ?? "") && (s.value = (s.__value = x().chartSeriesId ?? "") ?? "", g(s, x().chartSeriesId ?? ""));
|
|
627
|
+
}), i("change", s, (e) => x().chartSeriesId = e.currentTarget.value || null), S(e, t);
|
|
628
|
+
};
|
|
629
|
+
t(h, (e) => {
|
|
630
|
+
d(yt) && e(ee);
|
|
631
|
+
});
|
|
632
|
+
var v = a(h, 2), C = o(v), te = o(C, !0);
|
|
633
|
+
E(C);
|
|
634
|
+
var D = a(C, 2);
|
|
635
|
+
O(D, 21, () => d(R).measures, (e) => e.id, (e, t) => {
|
|
636
|
+
var n = Ne(), r = o(n, !0);
|
|
637
|
+
E(n);
|
|
638
|
+
var i = {};
|
|
639
|
+
p(() => {
|
|
640
|
+
l(r, d(t).label), i !== (i = d(t).id) && (n.value = (n.__value = d(t).id) ?? "");
|
|
641
|
+
}), S(e, n);
|
|
642
|
+
}), E(D);
|
|
643
|
+
var re;
|
|
644
|
+
b(D), E(v);
|
|
645
|
+
var ie = a(v, 2), k = (e) => {
|
|
646
|
+
var t = Fe(), n = a(o(t), 2);
|
|
647
|
+
O(n, 21, () => d(R).measures, (e) => e.id, (e, t) => {
|
|
648
|
+
var n = Pe(), r = o(n, !0);
|
|
649
|
+
E(n);
|
|
650
|
+
var i = {};
|
|
651
|
+
p(() => {
|
|
652
|
+
l(r, d(t).label), i !== (i = d(t).id) && (n.value = (n.__value = d(t).id) ?? "");
|
|
653
|
+
}), S(e, n);
|
|
654
|
+
}), E(n);
|
|
655
|
+
var r;
|
|
656
|
+
b(n), E(t), p(() => {
|
|
657
|
+
r !== (r = x().effectiveChartMeasure2Id ?? "") && (n.value = (n.__value = x().effectiveChartMeasure2Id ?? "") ?? "", g(n, x().effectiveChartMeasure2Id ?? ""));
|
|
658
|
+
}), i("change", n, (e) => x().chartMeasure2Id = e.currentTarget.value || null), S(e, t);
|
|
659
|
+
};
|
|
660
|
+
t(ie, (e) => {
|
|
661
|
+
d(Ct) && e(k);
|
|
662
|
+
});
|
|
663
|
+
var ae = a(ie, 2), A = (e) => {
|
|
664
|
+
var t = Le(), n = a(o(t), 2);
|
|
665
|
+
O(n, 21, () => Dt, (e) => e.value, (e, t) => {
|
|
666
|
+
var n = Ie(), r = o(n, !0);
|
|
667
|
+
E(n);
|
|
668
|
+
var i = {};
|
|
669
|
+
p(() => {
|
|
670
|
+
l(r, d(t).label), i !== (i = d(t).value) && (n.value = (n.__value = d(t).value) ?? "");
|
|
671
|
+
}), S(e, n);
|
|
672
|
+
}), E(n);
|
|
673
|
+
var r;
|
|
674
|
+
b(n), E(t), p(() => {
|
|
675
|
+
r !== (r = x().chartReduce) && (n.value = (n.__value = x().chartReduce) ?? "", g(n, x().chartReduce));
|
|
676
|
+
}), i("change", n, (e) => x().chartReduce = e.currentTarget.value), S(e, t);
|
|
677
|
+
};
|
|
678
|
+
t(ae, (e) => {
|
|
679
|
+
d(wt) && e(A);
|
|
680
|
+
});
|
|
681
|
+
var j = a(ae, 2), M = a(o(j), 2);
|
|
682
|
+
O(M, 21, () => Ot, (e) => e.value, (e, t) => {
|
|
683
|
+
var n = Re(), r = o(n, !0);
|
|
684
|
+
E(n);
|
|
685
|
+
var i = {};
|
|
686
|
+
p(() => {
|
|
687
|
+
l(r, d(t).label), i !== (i = d(t).value) && (n.value = (n.__value = d(t).value) ?? "");
|
|
688
|
+
}), S(e, n);
|
|
689
|
+
}), E(M);
|
|
690
|
+
var oe;
|
|
691
|
+
b(M), E(j);
|
|
692
|
+
var N = a(j, 2), P = (e) => {
|
|
693
|
+
var t = ze(), n = ne(t), r = o(n);
|
|
694
|
+
_(r), w(), E(n);
|
|
695
|
+
var s = a(n, 2), c = o(s);
|
|
696
|
+
_(c), w(), E(s), p(() => {
|
|
697
|
+
T(r, x().chartStacked), T(c, x().chartStacked100);
|
|
698
|
+
}), i("change", r, (e) => x().chartStacked = e.currentTarget.checked), i("change", c, (e) => x().chartStacked100 = e.currentTarget.checked), S(e, t);
|
|
699
|
+
};
|
|
700
|
+
t(N, (e) => {
|
|
701
|
+
d(bt) && e(P);
|
|
702
|
+
});
|
|
703
|
+
var F = a(N, 2), I = (e) => {
|
|
704
|
+
var t = Be(), n = o(t);
|
|
705
|
+
_(n), w(), E(t), p(() => T(n, x().chartOrientation === "horizontal")), i("change", n, (e) => x().chartOrientation = e.currentTarget.checked ? "horizontal" : "vertical"), S(e, t);
|
|
706
|
+
};
|
|
707
|
+
t(F, (e) => {
|
|
708
|
+
d(gt) && e(I);
|
|
709
|
+
});
|
|
710
|
+
var se = a(F, 2), ce = (e) => {
|
|
711
|
+
var t = Ve(), n = o(t);
|
|
712
|
+
_(n), w(), E(t), p(() => T(n, x().chartDonut)), i("change", n, (e) => x().chartDonut = e.currentTarget.checked), S(e, t);
|
|
713
|
+
};
|
|
714
|
+
t(se, (e) => {
|
|
715
|
+
d(_t) && e(ce);
|
|
716
|
+
});
|
|
717
|
+
var L = a(se, 2), z = a(o(L), 2);
|
|
718
|
+
O(z, 21, () => mt, (e) => e.key, (e, t) => {
|
|
719
|
+
var n = He(), r = o(n, !0);
|
|
720
|
+
E(n);
|
|
721
|
+
var i = {};
|
|
722
|
+
p(() => {
|
|
723
|
+
l(r, d(t).label), i !== (i = d(t).key) && (n.value = (n.__value = d(t).key) ?? "");
|
|
724
|
+
}), S(e, n);
|
|
725
|
+
}), E(z);
|
|
726
|
+
var le;
|
|
727
|
+
b(z), E(L);
|
|
728
|
+
var ue = a(L, 2), de = (e) => {
|
|
729
|
+
var t = Ue(), n = o(t);
|
|
730
|
+
_(n), w(), E(t), p(() => T(n, x().chartDataLabels)), i("change", n, (e) => x().chartDataLabels = e.currentTarget.checked), S(e, t);
|
|
731
|
+
};
|
|
732
|
+
t(ue, (e) => {
|
|
733
|
+
d(St) && e(de);
|
|
734
|
+
});
|
|
735
|
+
var fe = a(ue, 2), pe = (e) => {
|
|
736
|
+
var t = We(), n = o(t);
|
|
737
|
+
_(n), w(), E(t), p(() => T(n, x().chartLogScale)), i("change", n, (e) => x().chartLogScale = e.currentTarget.checked), S(e, t);
|
|
738
|
+
};
|
|
739
|
+
t(fe, (e) => {
|
|
740
|
+
d(xt) && e(pe);
|
|
741
|
+
});
|
|
742
|
+
var me = a(fe, 2), he = (e) => {
|
|
743
|
+
var t = Ge(), n = o(t);
|
|
744
|
+
_(n), w(), E(t), p(() => T(n, x().chartTimeAxis)), i("change", n, (e) => x().chartTimeAxis = e.currentTarget.checked), S(e, t);
|
|
745
|
+
}, ge = e(() => x().chartDimensionIsDate && pt.includes(x().chartType));
|
|
746
|
+
t(me, (e) => {
|
|
747
|
+
d(ge) && e(he);
|
|
748
|
+
}), p(() => {
|
|
749
|
+
u !== (u = x().chartType) && (c.value = (c.__value = x().chartType) ?? "", g(c, x().chartType)), l(te, d(Ct) ? "X" : x().chartType === "gauge" ? "Metric" : "Value"), re !== (re = x().chartMeasureId ?? "") && (D.value = (D.__value = x().chartMeasureId ?? "") ?? "", g(D, x().chartMeasureId ?? "")), oe !== (oe = x().chartValueFormat) && (M.value = (M.__value = x().chartValueFormat) ?? "", g(M, x().chartValueFormat)), le !== (le = d(ht)) && (z.value = (z.__value = d(ht)) ?? "", g(z, d(ht)));
|
|
750
|
+
}), i("change", c, (e) => x().chartType = e.currentTarget.value), i("change", D, (e) => x().chartMeasureId = e.currentTarget.value || null), i("change", M, (e) => x().chartValueFormat = e.currentTarget.value), i("change", z, (e) => x().chartPalette = mt.find((t) => t.key === e.currentTarget.value)?.colors ?? null), S(n, r);
|
|
751
|
+
};
|
|
752
|
+
t(hn, (e) => {
|
|
753
|
+
d(N) || e(gn);
|
|
754
|
+
});
|
|
755
|
+
var _n = a(hn, 2), vn = (e) => {
|
|
756
|
+
var t = qe(), n = o(t, !0);
|
|
757
|
+
E(t), p(() => l(n, d(Et))), S(e, t);
|
|
758
|
+
};
|
|
759
|
+
t(_n, (e) => {
|
|
760
|
+
d(Et) && e(vn);
|
|
761
|
+
}), E(mn), E(Gt);
|
|
762
|
+
var $ = a(Gt, 2), yn = o($), bn = (t) => {
|
|
763
|
+
{
|
|
764
|
+
let n = e(() => d(j)?.zoom === !0), r = e(() => d(j)?.brush === !0), i = e(() => d(j)?.export === !0 || void 0);
|
|
765
|
+
ae(t, {
|
|
766
|
+
get spec() {
|
|
767
|
+
return d(I);
|
|
768
|
+
},
|
|
769
|
+
get width() {
|
|
770
|
+
return d(lt);
|
|
771
|
+
},
|
|
772
|
+
get height() {
|
|
773
|
+
return d(ut);
|
|
774
|
+
},
|
|
775
|
+
onSelect: kt,
|
|
776
|
+
interactive: !0,
|
|
777
|
+
legend: !0,
|
|
778
|
+
get dataLabels() {
|
|
779
|
+
return x().chartDataLabels;
|
|
780
|
+
},
|
|
781
|
+
get zoomable() {
|
|
782
|
+
return d(n);
|
|
783
|
+
},
|
|
784
|
+
get brush() {
|
|
785
|
+
return d(r);
|
|
786
|
+
},
|
|
787
|
+
get toolbar() {
|
|
788
|
+
return d(i);
|
|
789
|
+
}
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
}, xn = (e) => {
|
|
793
|
+
var n = Je(), r = o(n), i = (e) => {
|
|
794
|
+
var t = u("Charting needs at least one text column (to group by) and one numeric column (to measure).");
|
|
795
|
+
S(e, t);
|
|
796
|
+
}, a = (e) => {
|
|
797
|
+
var t = u("No data to chart.");
|
|
798
|
+
S(e, t);
|
|
799
|
+
};
|
|
800
|
+
t(r, (e) => {
|
|
801
|
+
!d(R).dims.length || !d(R).measures.length ? e(i) : e(a, -1);
|
|
802
|
+
}), E(n), S(e, n);
|
|
803
|
+
};
|
|
804
|
+
t(yn, (e) => {
|
|
805
|
+
d(I) && (d(I).series.length || d(I).gaugeValue != null || d(N)) ? e(bn) : e(xn, -1);
|
|
806
|
+
}), E($), ee($, (e) => m(At, e), () => d(At));
|
|
807
|
+
var Sn = a($, 2), Cn = (e) => {
|
|
808
|
+
var t = Ye();
|
|
809
|
+
i("pointerdown", t, rt), S(e, t);
|
|
810
|
+
};
|
|
811
|
+
t(Sn, (e) => {
|
|
812
|
+
d(B) && !d(V) && e(Cn);
|
|
813
|
+
}), E(Y), ee(Y, (e) => m(Ze, e), () => d(Ze)), p(() => {
|
|
814
|
+
Ht = k(Y, 1, "sv-grid-chart-panel", null, Ht, {
|
|
815
|
+
"is-right": d(P) === "right" && !d(B),
|
|
816
|
+
"is-bottom": d(P) === "bottom" && !d(B),
|
|
817
|
+
"is-floating": d(B),
|
|
818
|
+
"is-maximized": d(B) && d(V)
|
|
819
|
+
}), ie(Y, d(it)), Kt = k(X, 1, "sv-grid-chart-drawer-title", null, Kt, { "is-drag-handle": d(B) && !d(V) }), y(Q, "aria-expanded", d(U));
|
|
820
|
+
}), i("pointerdown", X, nt), i("click", Q, () => m(U, !d(U))), i("click", ln, () => x().chartPanelOpen = !1), te($, "clientWidth", (e) => m(at, e)), te($, "clientHeight", (e) => m(ot, e)), f(3, Y, () => M, () => ({
|
|
821
|
+
x: !d(B) && d(P) === "right" ? d(z) : 0,
|
|
822
|
+
y: !d(B) && d(P) === "bottom" ? d(z) : 0,
|
|
823
|
+
duration: 180,
|
|
824
|
+
easing: oe
|
|
825
|
+
})), S(n, Y), v();
|
|
826
|
+
}
|
|
827
|
+
n([
|
|
828
|
+
"pointerdown",
|
|
829
|
+
"click",
|
|
830
|
+
"change"
|
|
831
|
+
]);
|
|
832
|
+
//#endregion
|
|
833
|
+
export { B as default };
|