@svgrid/grid 3.0.3 → 3.0.4
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 +2 -1
- package/dist/GridMenus.svelte +44 -2
- package/dist/SvChartMenu.svelte +69 -0
- package/dist/SvChartMenu.svelte.d.ts +11 -0
- package/dist/SvChartPanes.svelte +113 -0
- package/dist/SvChartPanes.svelte.d.ts +20 -0
- package/dist/SvGrid.controller.svelte.d.ts +110 -39
- package/dist/SvGrid.controller.svelte.js +655 -200
- package/dist/SvGrid.css +105 -2
- package/dist/SvGrid.svelte +386 -514
- package/dist/SvGrid.types.d.ts +210 -9
- package/dist/SvGridCellEditor.svelte +17 -0
- package/dist/SvGridChart.svelte +2257 -329
- package/dist/SvGridChart.svelte.d.ts +6 -106
- package/dist/SvGridChart.types.d.ts +338 -0
- package/dist/SvGridChart.types.js +1 -0
- package/dist/SvGridChartBuilder.svelte +323 -0
- package/dist/SvGridChartBuilder.svelte.d.ts +34 -0
- package/dist/SvGridChartPanel.svelte +221 -275
- package/dist/SvGridChartPickers.svelte +417 -0
- package/dist/SvGridChartPickers.svelte.d.ts +70 -0
- package/dist/SvGridChartView.svelte +13 -14
- package/dist/SvModal.svelte +7 -1
- package/dist/SvModal.svelte.d.ts +5 -0
- package/dist/ai.d.ts +40 -8
- package/dist/ai.js +135 -24
- package/dist/aria.d.ts +11 -0
- package/dist/build-api.js +108 -22
- package/dist/cdn/GridMenus-7kbpnnBW.js +635 -0
- package/dist/cdn/GridMenus-BL7ZgQvU.js +636 -0
- package/dist/cdn/SvChartMenu-Bl6PBbkT.js +58 -0
- package/dist/cdn/SvChartMenu-FBSMINA6.js +59 -0
- package/dist/cdn/{SvDateRangeInput-DMLKmGEc.js → SvDateRangeInput-BeU_TkbQ.js} +15 -14
- package/dist/cdn/{SvDateRangeInput-CaOuMs8O.js → SvDateRangeInput-yX8vzleW.js} +38 -37
- package/dist/cdn/{SvDateTimePicker-sonaH0oh.js → SvDateTimePicker-DQwt4UAs.js} +139 -180
- package/dist/cdn/SvDateTimePicker-vNU6bZ-q.js +775 -0
- package/dist/cdn/{SvGridCellEditor-CjEJMJKc.js → SvGridCellEditor-B1p-vCK5.js} +188 -178
- package/dist/cdn/{SvGridCellEditor-BWnTi2N7.js → SvGridCellEditor-D_0q4xAu.js} +98 -88
- package/dist/cdn/SvGridChart-C3EWAZaM.js +3574 -0
- package/dist/cdn/SvGridChart-DzLkSwCH.js +3572 -0
- package/dist/cdn/SvGridChartBuilder-BE2T1ykB.js +783 -0
- package/dist/cdn/SvGridChartBuilder-CfII62sZ.js +784 -0
- package/dist/cdn/SvGridChartPanel-CCX5_Wgd.js +675 -0
- package/dist/cdn/SvGridChartPanel-xf4sWVTo.js +699 -0
- package/dist/cdn/SvGridChartView-CfuXmY5I.js +48 -0
- package/dist/cdn/SvGridChartView-DYwabQWj.js +47 -0
- package/dist/cdn/SvMenuList-CLN8OuIK.js +452 -0
- package/dist/cdn/SvMenuList-DkGhNKjf.js +451 -0
- package/dist/cdn/SvModal-BAE-pjZX.js +396 -0
- package/dist/cdn/SvModal-CIZWCcad.js +397 -0
- package/dist/cdn/chart-Dz7SqMXH.js +4341 -0
- package/dist/cdn/chart-export-BXqueeWJ.js +135 -0
- package/dist/cdn/chart-export-pdf-DONFUnNY.js +110 -0
- package/dist/cdn/chart-panel-messages-CUbf2R4i.js +1052 -0
- package/dist/cdn/chart-panel-messages-CmNrMdsr.js +1053 -0
- package/dist/cdn/chart-summary-BJW_tg_X.js +138 -0
- package/dist/cdn/chart-trend-CaN9mDEV.js +50 -0
- package/dist/cdn/chart-validate-HcOVFAfJ.js +188 -0
- package/dist/cdn/{column-resize-DsfNXMom.js → column-resize-DpmOLfRp.js} +3 -3
- package/dist/cdn/{date-format-BnnHlqGw.js → date-format-CtquV-p3.js} +583 -603
- package/dist/cdn/{date-format-BNii4zeD.js → date-format-D6KFzU_W.js} +347 -367
- package/dist/cdn/dismissable-DAHetSNk.js +44 -0
- package/dist/cdn/editor-contract-LXgQJAgd.js +22 -0
- package/dist/cdn/focus-trap-BBOQYBma.js +65 -0
- package/dist/cdn/{row-resize-BRcimkUT.js → row-resize-niQCp040.js} +44 -36
- package/dist/cdn/{src-D6XvA1Ij.js → src-BKhZ6eXd.js} +10227 -9787
- package/dist/cdn/{src-Bugf5XlI.js → src-V1uu8iE9.js} +6568 -6128
- package/dist/cdn/svgrid.js +26 -15
- package/dist/cdn/svgrid.svelte-external.js +26 -15
- package/dist/chart-axes.d.ts +53 -0
- package/dist/chart-axes.js +351 -0
- package/dist/chart-cartesian.d.ts +88 -0
- package/dist/chart-cartesian.js +1862 -0
- package/dist/chart-decimate.d.ts +51 -0
- package/dist/chart-decimate.js +199 -0
- package/dist/chart-export-pdf.d.ts +47 -0
- package/dist/chart-export-pdf.js +187 -0
- package/dist/chart-export.d.ts +2 -1
- package/dist/chart-export.js +18 -3
- package/dist/chart-financial.d.ts +91 -0
- package/dist/chart-financial.js +175 -0
- package/dist/chart-flow.d.ts +10 -0
- package/dist/chart-flow.js +298 -0
- package/dist/chart-format.d.ts +18 -0
- package/dist/chart-format.js +65 -0
- package/dist/chart-grid.d.ts +8 -0
- package/dist/chart-grid.js +190 -0
- package/dist/chart-hierarchy.d.ts +17 -0
- package/dist/chart-hierarchy.js +146 -0
- package/dist/chart-indicators.d.ts +115 -0
- package/dist/chart-indicators.js +389 -0
- package/dist/chart-messages.d.ts +95 -0
- package/dist/chart-messages.js +92 -0
- package/dist/chart-motion.d.ts +16 -0
- package/dist/chart-motion.js +141 -0
- package/dist/chart-panel-messages.d.ts +265 -0
- package/dist/chart-panel-messages.js +285 -0
- package/dist/chart-pivot.d.ts +87 -0
- package/dist/chart-pivot.js +156 -0
- package/dist/chart-polar.d.ts +25 -0
- package/dist/chart-polar.js +700 -0
- package/dist/chart-samples.d.ts +16 -0
- package/dist/chart-samples.js +153 -0
- package/dist/chart-scale.d.ts +113 -0
- package/dist/chart-scale.js +405 -0
- package/dist/chart-stats.d.ts +111 -0
- package/dist/chart-stats.js +419 -0
- package/dist/chart-stream.d.ts +45 -0
- package/dist/chart-stream.js +91 -0
- package/dist/chart-summary.d.ts +27 -0
- package/dist/chart-summary.js +205 -0
- package/dist/chart-sync.svelte.d.ts +32 -0
- package/dist/chart-sync.svelte.js +23 -0
- package/dist/chart-table.d.ts +35 -0
- package/dist/chart-table.js +165 -0
- package/dist/chart-trend.d.ts +19 -0
- package/dist/chart-trend.js +61 -0
- package/dist/chart-types.d.ts +1456 -0
- package/dist/chart-types.js +6 -0
- package/dist/chart-validate.d.ts +43 -0
- package/dist/chart-validate.js +272 -0
- package/dist/chart-zoom.d.ts +40 -0
- package/dist/chart-zoom.js +145 -0
- package/dist/chart.d.ts +186 -865
- package/dist/chart.js +460 -2204
- package/dist/clipboard.d.ts +1 -0
- package/dist/clipboard.js +137 -18
- package/dist/column-resize.d.ts +3 -0
- package/dist/column-resize.js +4 -1
- package/dist/columns.js +3 -0
- package/dist/command-context.d.ts +19 -0
- package/dist/command-context.js +116 -0
- package/dist/core.d.ts +7 -0
- package/dist/createPopoverSelect.svelte.d.ts +2 -2
- package/dist/editing.d.ts +2 -8
- package/dist/editing.js +262 -33
- package/dist/fill-patterns.d.ts +0 -5
- package/dist/fill-patterns.js +56 -2
- package/dist/grid-messages.d.ts +10 -3
- package/dist/grid-messages.js +5 -0
- package/dist/history.d.ts +83 -0
- package/dist/history.js +133 -0
- package/dist/index.d.ts +24 -6
- package/dist/index.js +20 -2
- package/dist/keyboard-handlers.js +88 -31
- package/dist/keyboard.d.ts +55 -0
- package/dist/keyboard.js +132 -0
- package/dist/menus.d.ts +3 -1
- package/dist/menus.js +7 -2
- package/dist/merges.d.ts +97 -0
- package/dist/merges.js +147 -0
- package/dist/row-resize.d.ts +3 -0
- package/dist/row-resize.js +14 -0
- package/dist/scroll-sync.d.ts +1 -0
- package/dist/scroll-sync.js +24 -0
- package/dist/selection.d.ts +16 -0
- package/dist/selection.js +108 -16
- package/dist/shortcut-registry.d.ts +145 -0
- package/dist/shortcut-registry.js +44 -0
- package/dist/svgrid-wrapper.types.d.ts +213 -22
- package/dist/virtualization/virtualizer.js +38 -17
- package/package.json +6 -1
- package/src/GridMenus.svelte +44 -2
- package/src/SvChartMenu.svelte +69 -0
- package/src/SvChartPanes.svelte +113 -0
- package/src/SvChartPanes.test.ts +66 -0
- package/src/SvGrid.controller.svelte.ts +629 -172
- package/src/SvGrid.css +105 -2
- package/src/SvGrid.svelte +386 -514
- package/src/SvGrid.types.ts +188 -8
- package/src/SvGridCellEditor.svelte +17 -0
- package/src/SvGridChart.svelte +2257 -329
- package/src/SvGridChart.test.ts +1419 -1
- package/src/SvGridChart.types.ts +336 -0
- package/src/SvGridChartBuilder.svelte +323 -0
- package/src/SvGridChartPanel.svelte +221 -275
- package/src/SvGridChartPickers.svelte +417 -0
- package/src/SvGridChartView.svelte +13 -14
- package/src/SvModal.svelte +7 -1
- package/src/SvModal.test.ts +9 -0
- package/src/ai.test.ts +57 -2
- package/src/ai.ts +166 -22
- package/src/aria.d.ts +11 -0
- package/src/build-api.coverage.test.ts +184 -0
- package/src/build-api.ts +107 -18
- package/src/chart-axes.test.ts +573 -0
- package/src/chart-axes.ts +342 -0
- package/src/chart-cartesian.ts +1863 -0
- package/src/chart-decimate.test.ts +249 -0
- package/src/chart-decimate.ts +186 -0
- package/src/chart-export-pdf.test.ts +91 -0
- package/src/chart-export-pdf.ts +207 -0
- package/src/chart-export.test.ts +14 -0
- package/src/chart-export.ts +13 -3
- package/src/chart-financial.ts +208 -0
- package/src/chart-flow.ts +286 -0
- package/src/chart-format.ts +67 -0
- package/src/chart-grid.ts +179 -0
- package/src/chart-hierarchy.ts +135 -0
- package/src/chart-indicators.test.ts +443 -0
- package/src/chart-indicators.ts +384 -0
- package/src/chart-messages.test.ts +21 -0
- package/src/chart-messages.ts +184 -0
- package/src/chart-motion.test.ts +71 -0
- package/src/chart-motion.ts +148 -0
- package/src/chart-panel-messages.test.ts +29 -0
- package/src/chart-panel-messages.ts +550 -0
- package/src/chart-pivot.test.ts +54 -0
- package/src/chart-pivot.ts +225 -0
- package/src/chart-polar.ts +674 -0
- package/src/chart-samples.ts +106 -0
- package/src/chart-scale.ts +394 -0
- package/src/chart-series-types.test.ts +714 -0
- package/src/chart-stats.ts +409 -0
- package/src/chart-stream.test.ts +75 -0
- package/src/chart-stream.ts +114 -0
- package/src/chart-summary.test.ts +90 -0
- package/src/chart-summary.ts +197 -0
- package/src/chart-sync.svelte.ts +41 -0
- package/src/chart-table.test.ts +76 -0
- package/src/chart-table.ts +178 -0
- package/src/chart-trend.ts +47 -0
- package/src/chart-types.ts +1309 -0
- package/src/chart-validate.test.ts +100 -0
- package/src/chart-validate.ts +247 -0
- package/src/chart-zoom.test.ts +137 -0
- package/src/chart-zoom.ts +124 -0
- package/src/chart.coverage.test.ts +81 -0
- package/src/chart.test.ts +56 -3
- package/src/chart.ts +557 -2784
- package/src/clipboard.test.ts +151 -0
- package/src/clipboard.ts +145 -16
- package/src/column-resize.ts +7 -1
- package/src/columns.ts +2 -0
- package/src/command-context.test.ts +200 -0
- package/src/command-context.ts +137 -0
- package/src/core.ts +7 -0
- package/src/editing.test.ts +281 -3
- package/src/editing.ts +256 -38
- package/src/fill-patterns.test.ts +35 -0
- package/src/fill-patterns.ts +56 -2
- package/src/grid-messages.ts +16 -3
- package/src/history.test.ts +196 -0
- package/src/history.ts +162 -0
- package/src/icon-seam.test.ts +3 -2
- package/src/index.ts +150 -2
- package/src/keyboard-handlers.coverage.test.ts +126 -6
- package/src/keyboard-handlers.ts +91 -30
- package/src/keyboard-shortcuts.seam.test.ts +200 -0
- package/src/keyboard.test.ts +124 -1
- package/src/keyboard.ts +142 -0
- package/src/menus.test.ts +26 -0
- package/src/menus.ts +10 -3
- package/src/merges.test.ts +112 -0
- package/src/merges.ts +168 -0
- package/src/pivot.grid.test.ts +40 -5
- package/src/row-resize.test.ts +44 -0
- package/src/row-resize.ts +17 -0
- package/src/scroll-sync.test.ts +42 -1
- package/src/scroll-sync.ts +25 -0
- package/src/selection.multi-range.test.ts +34 -0
- package/src/selection.test.ts +30 -2
- package/src/selection.ts +111 -19
- package/src/shortcut-registry.test.ts +97 -0
- package/src/shortcut-registry.ts +181 -0
- package/src/svgrid-wrapper.types.ts +184 -13
- package/src/svgrid.behavior.test.ts +135 -0
- package/src/svgrid.charting.test.ts +513 -3
- package/src/svgrid.context-menu.test.ts +31 -0
- package/src/svgrid.new-features.wrapper.test.ts +10 -3
- package/src/virtualization/virtualizer.ts +39 -17
- package/dist/cdn/GridMenus-CHOMnW-c.js +0 -602
- package/dist/cdn/GridMenus-DhdPF700.js +0 -603
- package/dist/cdn/SvDateTimePicker-CCbDZNZB.js +0 -816
- package/dist/cdn/SvGridChart-1PMSp2LZ.js +0 -1481
- package/dist/cdn/SvGridChart-D02avhyr.js +0 -1480
- package/dist/cdn/SvGridChartPanel-DJnViOv4.js +0 -834
- package/dist/cdn/SvGridChartPanel-vPTNerFZ.js +0 -810
- package/dist/cdn/SvGridChartView-C--HhdUo.js +0 -56
- package/dist/cdn/SvGridChartView-KyyFG-wY.js +0 -55
- package/dist/cdn/chart-DLg3_zTQ.js +0 -1652
|
@@ -1,810 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { t } from "./SvGridChart-1PMSp2LZ.js";
|
|
3
|
-
import * as n from "svelte/internal/client";
|
|
4
|
-
import "svelte/internal/disclose-version";
|
|
5
|
-
import { fly as r } from "svelte/transition";
|
|
6
|
-
import { cubicOut as i } from "svelte/easing";
|
|
7
|
-
//#region src/chart-export.ts
|
|
8
|
-
function a(e) {
|
|
9
|
-
return e instanceof SVGSVGElement ? e : e.querySelector("svg.sv-grid-chart-svg") ?? e.querySelector("svg");
|
|
10
|
-
}
|
|
11
|
-
function o(e, t, n) {
|
|
12
|
-
return getComputedStyle(e).getPropertyValue(t).trim() || n;
|
|
13
|
-
}
|
|
14
|
-
function s(e, t = {}) {
|
|
15
|
-
let n = a(e);
|
|
16
|
-
if (!n) throw Error("chartToSvgString: no <svg> found");
|
|
17
|
-
let r = o(n, "--sg-fg", "#0f172a"), i = o(n, "--sg-muted", "#64748b"), s = o(n, "--sg-border", "#e2e8f0"), c = t.background ?? o(n, "--sg-bg", "#ffffff"), l = n.viewBox.baseVal, u = l && l.width ? l.width : n.clientWidth || 520, d = l && l.height ? l.height : n.clientHeight || 300, f = n.cloneNode(!0);
|
|
18
|
-
f.setAttribute("width", String(u)), f.setAttribute("height", String(d)), f.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
19
|
-
let p = [
|
|
20
|
-
"fill",
|
|
21
|
-
"fill-opacity",
|
|
22
|
-
"stroke",
|
|
23
|
-
"stroke-width",
|
|
24
|
-
"stroke-opacity",
|
|
25
|
-
"stroke-dasharray",
|
|
26
|
-
"stroke-linecap",
|
|
27
|
-
"stroke-linejoin",
|
|
28
|
-
"opacity",
|
|
29
|
-
"font-size",
|
|
30
|
-
"font-family",
|
|
31
|
-
"font-weight",
|
|
32
|
-
"text-anchor"
|
|
33
|
-
], m = n.querySelectorAll("*"), h = f.querySelectorAll("*");
|
|
34
|
-
for (let e = 0; e < m.length; e += 1) {
|
|
35
|
-
let t = h[e];
|
|
36
|
-
if (!t || !t.style) continue;
|
|
37
|
-
let n = getComputedStyle(m[e]);
|
|
38
|
-
for (let e of p) {
|
|
39
|
-
let r = n.getPropertyValue(e);
|
|
40
|
-
r && r !== "normal" && t.style.setProperty(e, r);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
f.querySelectorAll(".sv-grid-chart-hit").forEach((e) => e.remove());
|
|
44
|
-
let g = document.createElementNS("http://www.w3.org/2000/svg", "style");
|
|
45
|
-
g.textContent = `
|
|
46
|
-
.sv-grid-chart-axis { fill: ${i}; font-size: 10px; font-family: sans-serif; }
|
|
47
|
-
.sv-grid-chart-gridline { stroke: ${s}; stroke-width: 1; opacity: 0.6; }
|
|
48
|
-
.sv-grid-chart-gridline.is-zero { stroke: ${i}; opacity: 0.9; }
|
|
49
|
-
.sv-grid-chart-datalabel { fill: ${r}; font-size: 9.5px; font-weight: 600; font-family: sans-serif; }
|
|
50
|
-
.sv-grid-chart-datalabel.on-bar { fill: #fff; }
|
|
51
|
-
.sv-grid-chart-donut-total { fill: ${r}; font-size: 16px; font-weight: 800; font-family: sans-serif; }
|
|
52
|
-
.sv-grid-chart-donut-label { fill: ${i}; font-size: 10px; font-family: sans-serif; }
|
|
53
|
-
`, f.insertBefore(g, f.firstChild);
|
|
54
|
-
let _ = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
55
|
-
return _.setAttribute("x", "0"), _.setAttribute("y", "0"), _.setAttribute("width", String(u)), _.setAttribute("height", String(d)), _.setAttribute("fill", c), f.insertBefore(_, g.nextSibling), new XMLSerializer().serializeToString(f);
|
|
56
|
-
}
|
|
57
|
-
function c(e, t) {
|
|
58
|
-
let n = document.createElement("a");
|
|
59
|
-
n.href = e, n.download = t, document.body.appendChild(n), n.click(), n.remove();
|
|
60
|
-
}
|
|
61
|
-
function l(e, t = "chart.svg", n = {}) {
|
|
62
|
-
let r = s(e, n), i = URL.createObjectURL(new Blob([r], { type: "image/svg+xml" }));
|
|
63
|
-
c(i, t), setTimeout(() => URL.revokeObjectURL(i), 1e3);
|
|
64
|
-
}
|
|
65
|
-
function u(e, t = {}) {
|
|
66
|
-
let n = s(e, t), r = t.scale ?? 2, i = a(e), o = i.viewBox.baseVal, c = (o && o.width ? o.width : i.clientWidth || 520) * r, l = (o && o.height ? o.height : i.clientHeight || 300) * r;
|
|
67
|
-
return new Promise((e, t) => {
|
|
68
|
-
let r = URL.createObjectURL(new Blob([n], { type: "image/svg+xml" })), i = new Image();
|
|
69
|
-
i.onload = () => {
|
|
70
|
-
let n = document.createElement("canvas");
|
|
71
|
-
n.width = Math.round(c), n.height = Math.round(l);
|
|
72
|
-
let a = n.getContext("2d");
|
|
73
|
-
if (!a) {
|
|
74
|
-
URL.revokeObjectURL(r), t(/* @__PURE__ */ Error("canvas 2d context unavailable"));
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
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");
|
|
78
|
-
}, i.onerror = () => {
|
|
79
|
-
URL.revokeObjectURL(r), t(/* @__PURE__ */ Error("failed to rasterize chart SVG"));
|
|
80
|
-
}, i.src = r;
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
async function d(e, t = "chart.png", n = {}) {
|
|
84
|
-
let r = await u(e, n), i = URL.createObjectURL(r);
|
|
85
|
-
c(i, t), setTimeout(() => URL.revokeObjectURL(i), 1e3);
|
|
86
|
-
}
|
|
87
|
-
var f = (e) => {
|
|
88
|
-
let t = e == null ? "" : String(e);
|
|
89
|
-
return /[",\n]/.test(t) ? `"${t.replace(/"/g, "\"\"")}"` : t;
|
|
90
|
-
};
|
|
91
|
-
function p(e) {
|
|
92
|
-
let t = e.series ?? [];
|
|
93
|
-
if (t.some((e) => e.points?.length)) {
|
|
94
|
-
let e = [
|
|
95
|
-
"Series",
|
|
96
|
-
"X",
|
|
97
|
-
"Y",
|
|
98
|
-
"Size",
|
|
99
|
-
"Label"
|
|
100
|
-
].map(f).join(","), n = [];
|
|
101
|
-
for (let e of t) for (let t of e.points ?? []) n.push([
|
|
102
|
-
e.label,
|
|
103
|
-
t.x,
|
|
104
|
-
t.y,
|
|
105
|
-
t.r ?? "",
|
|
106
|
-
t.label ?? ""
|
|
107
|
-
].map(f).join(","));
|
|
108
|
-
return n.length ? [e, ...n].join("\n") : "";
|
|
109
|
-
}
|
|
110
|
-
let n = e.categories ?? [];
|
|
111
|
-
if (!n.length || !t.length) return "";
|
|
112
|
-
let r = ["Category"];
|
|
113
|
-
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);
|
|
114
|
-
let i = n.map((e, n) => {
|
|
115
|
-
let r = [e];
|
|
116
|
-
for (let e of t) if (e.ohlc) {
|
|
117
|
-
let t = e.ohlc[n];
|
|
118
|
-
r.push(t?.o ?? "", t?.h ?? "", t?.l ?? "", t?.c ?? "");
|
|
119
|
-
} else if (e.boxes) {
|
|
120
|
-
let t = e.boxes[n];
|
|
121
|
-
r.push(t?.min ?? "", t?.q1 ?? "", t?.median ?? "", t?.q3 ?? "", t?.max ?? "", t?.outliers?.join(" ") ?? "");
|
|
122
|
-
} else if (e.errors) {
|
|
123
|
-
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);
|
|
124
|
-
r.push(t ?? "", a, o);
|
|
125
|
-
} else r.push(e.values[n] ?? "");
|
|
126
|
-
return r.map(f).join(",");
|
|
127
|
-
});
|
|
128
|
-
return [r.map(f).join(","), ...i].join("\n");
|
|
129
|
-
}
|
|
130
|
-
function m(e) {
|
|
131
|
-
let t = e.series ?? [];
|
|
132
|
-
return t.some((e) => e.points?.length) ? !0 : !!(e.categories?.length && t.length);
|
|
133
|
-
}
|
|
134
|
-
function h(e, t = "chart.csv") {
|
|
135
|
-
let n = p(e);
|
|
136
|
-
if (!n) return !1;
|
|
137
|
-
let r = URL.createObjectURL(new Blob([n], { type: "text/csv;charset=utf-8" }));
|
|
138
|
-
return c(r, t), setTimeout(() => URL.revokeObjectURL(r), 1e3), !0;
|
|
139
|
-
}
|
|
140
|
-
//#endregion
|
|
141
|
-
//#region src/SvGridChartPanel.svelte
|
|
142
|
-
var g = /* @__PURE__ */ e({ default: () => D }), _ = n.from_html("<div role=\"separator\" aria-label=\"Resize chart panel\"></div>"), v = n.from_html("<button type=\"button\" class=\"sv-grid-chart-btn\">Clear filter</button>"), ee = n.from_svg("<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>"), y = n.from_svg("<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>"), b = n.from_html("<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>"), x = n.from_html("<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>"), S = n.from_html("<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>"), te = n.from_svg("<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>"), C = n.from_svg("<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>"), ne = n.from_html("<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), w = n.from_html("<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>"), re = n.from_html("<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>"), T = n.from_html("<div class=\"sv-grid-chart-tabs\" role=\"tablist\" aria-label=\"Charts\"></div>"), E = n.from_html("<p class=\"sv-grid-chart-ai-msg is-error\"> </p>"), ie = n.from_html("<p class=\"sv-grid-chart-ai-msg\"> </p>"), ae = n.from_html("<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>"), oe = n.from_html("<option> </option>"), se = n.from_html("<optgroup></optgroup>"), ce = n.from_html("<option> </option>"), le = n.from_html("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\"> </span> <select></select></label>"), ue = n.from_html("<option> </option>"), de = n.from_html("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\"> </span> <select><option>(none)</option><!></select></label>"), fe = n.from_html("<option> </option>"), pe = n.from_html("<option> </option>"), me = n.from_html("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\">Y</span> <select></select></label>"), he = n.from_html("<option> </option>"), ge = n.from_html("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\">Aggregate</span> <select></select></label>"), _e = n.from_html("<option> </option>"), ve = n.from_html("<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), ye = n.from_html("<label class=\"sv-grid-chart-toggle\" title=\"Bars grow rightwards - suits long category labels\"><input type=\"checkbox\"/> Horizontal</label>"), be = n.from_html("<label class=\"sv-grid-chart-toggle\"><input type=\"checkbox\"/> Donut</label>"), xe = n.from_html("<option> </option>"), Se = n.from_html("<label class=\"sv-grid-chart-toggle\"><input type=\"checkbox\"/> Labels</label>"), Ce = n.from_html("<label class=\"sv-grid-chart-toggle\" title=\"Logarithmic value axis - flattens wide-range data\"><input type=\"checkbox\"/> Log scale</label>"), we = n.from_html("<label class=\"sv-grid-chart-toggle\" title=\"Space points by actual date - real time ticks and proportional gaps\"><input type=\"checkbox\"/> Date axis</label>"), Te = n.from_html("<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), Ee = n.from_html("<p class=\"sv-grid-chart-hint\" role=\"note\"> </p>"), De = n.from_html("<p class=\"sv-grid-chart-empty\"><!></p>"), Oe = n.from_html("<div class=\"sv-grid-chart-float-resizer\" role=\"separator\" aria-label=\"Resize chart window\"></div>"), ke = n.from_html("<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>");
|
|
143
|
-
function D(e, a) {
|
|
144
|
-
n.push(a, !0);
|
|
145
|
-
let o = n.prop(a, "ctrl", 7), s = n.derived(() => o().chartingConfig), c = n.derived(() => o().chartCfg), f = n.derived(() => o().chartIsCustom), p = n.derived(() => n.get(s)?.position ?? "bottom"), g = n.derived(() => n.get(s)?.crossFilter !== !1), D = n.derived(() => o().chartSpec), O = n.derived(() => o().chartableColumns), k = n.derived(() => o().chartSize ?? (n.get(p) === "right" ? n.get(s)?.width ?? 340 : n.get(s)?.height ?? 260)), A = n.derived(() => o().chartFloating), j = n.derived(() => o().chartMaximized), M = n.derived(() => o().chartFloatRect), N = n.state(null);
|
|
146
|
-
function Ae() {
|
|
147
|
-
let e = n.get(N)?.offsetParent;
|
|
148
|
-
return {
|
|
149
|
-
w: e?.clientWidth ?? 800,
|
|
150
|
-
h: e?.clientHeight ?? 520
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
function je() {
|
|
154
|
-
if (!o().chartFloatRect) {
|
|
155
|
-
let { w: e, h: t } = Ae(), n = Math.min(600, Math.max(360, e - 80)), r = Math.min(430, Math.max(260, t - 90));
|
|
156
|
-
o().chartFloatRect = {
|
|
157
|
-
x: Math.round((e - n) / 2),
|
|
158
|
-
y: Math.round((t - r) / 2),
|
|
159
|
-
w: n,
|
|
160
|
-
h: r
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
o().chartFloating = !0;
|
|
164
|
-
}
|
|
165
|
-
function Me() {
|
|
166
|
-
o().chartFloating = !1, o().chartMaximized = !1;
|
|
167
|
-
}
|
|
168
|
-
let Ne = () => o().chartMaximized = !o().chartMaximized;
|
|
169
|
-
function Pe(e) {
|
|
170
|
-
if (!n.get(A) || n.get(j) || e.target?.closest("button")) return;
|
|
171
|
-
let t = o().chartFloatRect;
|
|
172
|
-
if (!t) return;
|
|
173
|
-
e.preventDefault();
|
|
174
|
-
let r = e.clientX, i = e.clientY, { w: a, h: s } = Ae(), c = (e) => {
|
|
175
|
-
let n = Math.max(0, Math.min(a - t.w, t.x + e.clientX - r)), c = Math.max(0, Math.min(s - t.h, t.y + e.clientY - i));
|
|
176
|
-
o().chartFloatRect = {
|
|
177
|
-
x: n,
|
|
178
|
-
y: c,
|
|
179
|
-
w: t.w,
|
|
180
|
-
h: t.h
|
|
181
|
-
};
|
|
182
|
-
}, l = () => {
|
|
183
|
-
window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", l);
|
|
184
|
-
};
|
|
185
|
-
window.addEventListener("pointermove", c), window.addEventListener("pointerup", l);
|
|
186
|
-
}
|
|
187
|
-
function Fe(e) {
|
|
188
|
-
let t = o().chartFloatRect;
|
|
189
|
-
if (!t) return;
|
|
190
|
-
e.preventDefault(), e.stopPropagation();
|
|
191
|
-
let n = e.clientX, r = e.clientY;
|
|
192
|
-
e.target.setPointerCapture?.(e.pointerId);
|
|
193
|
-
let i = (e) => {
|
|
194
|
-
o().chartFloatRect = {
|
|
195
|
-
x: t.x,
|
|
196
|
-
y: t.y,
|
|
197
|
-
w: Math.max(300, t.w + e.clientX - n),
|
|
198
|
-
h: Math.max(220, t.h + e.clientY - r)
|
|
199
|
-
};
|
|
200
|
-
}, a = () => {
|
|
201
|
-
window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a);
|
|
202
|
-
};
|
|
203
|
-
window.addEventListener("pointermove", i), window.addEventListener("pointerup", a);
|
|
204
|
-
}
|
|
205
|
-
let Ie = n.derived(() => n.get(A) ? n.get(j) ? "left:12px; top:12px; right:12px; bottom:12px; width:auto; height:auto;" : n.get(M) ? `left:${n.get(M).x}px; top:${n.get(M).y}px; width:${n.get(M).w}px; height:${n.get(M).h}px;` : "" : n.get(p) === "right" ? `width:${n.get(k)}px` : `height:${n.get(k)}px`), P = n.state(0), F = n.state(0), Le = n.derived(() => n.get(D) ? n.get(D).type === "pie" ? n.get(D).categories.length : n.get(D).series.length : 0), Re = n.derived(() => (n.get(Le) > 1 ? 36 : 0) + (n.get(c)?.export === !0 ? 30 : 0)), ze = n.derived(() => n.get(P) > 24 ? n.get(P) - 8 : void 0), Be = n.derived(() => n.get(F) > 24 ? Math.max(120, n.get(F) - 8 - n.get(Re)) : void 0), Ve = [
|
|
206
|
-
{
|
|
207
|
-
value: "bar",
|
|
208
|
-
label: "Bar",
|
|
209
|
-
group: "Compare"
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
value: "line",
|
|
213
|
-
label: "Line",
|
|
214
|
-
group: "Compare"
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
value: "area",
|
|
218
|
-
label: "Area",
|
|
219
|
-
group: "Compare"
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
value: "pie",
|
|
223
|
-
label: "Pie",
|
|
224
|
-
group: "Part of a whole"
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
value: "treemap",
|
|
228
|
-
label: "Tree map",
|
|
229
|
-
group: "Part of a whole"
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
value: "funnel",
|
|
233
|
-
label: "Funnel",
|
|
234
|
-
group: "Flow"
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
value: "waterfall",
|
|
238
|
-
label: "Waterfall",
|
|
239
|
-
group: "Flow"
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
value: "sankey",
|
|
243
|
-
label: "Sankey",
|
|
244
|
-
group: "Flow",
|
|
245
|
-
needs: (e) => e.dims.length >= 2
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
value: "radar",
|
|
249
|
-
label: "Radar",
|
|
250
|
-
group: "Distribution"
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
value: "heatmap",
|
|
254
|
-
label: "Heat map",
|
|
255
|
-
group: "Distribution",
|
|
256
|
-
needs: (e) => e.dims.length >= 2
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
value: "scatter",
|
|
260
|
-
label: "Scatter",
|
|
261
|
-
group: "Distribution",
|
|
262
|
-
needs: (e) => e.measures.length >= 2
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
value: "boxplot",
|
|
266
|
-
label: "Box plot",
|
|
267
|
-
group: "Distribution"
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
value: "gauge",
|
|
271
|
-
label: "Gauge",
|
|
272
|
-
group: "Single value"
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
value: "calendar",
|
|
276
|
-
label: "Calendar",
|
|
277
|
-
group: "Over time",
|
|
278
|
-
needs: (e) => e.dates.length >= 1
|
|
279
|
-
}
|
|
280
|
-
], He = n.derived(() => Ve.filter((e) => !e.needs || e.needs(n.get(O)))), I = [
|
|
281
|
-
"bar",
|
|
282
|
-
"line",
|
|
283
|
-
"area"
|
|
284
|
-
], L = [
|
|
285
|
-
{
|
|
286
|
-
key: "theme",
|
|
287
|
-
label: "Theme",
|
|
288
|
-
colors: null
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
key: "ocean",
|
|
292
|
-
label: "Ocean",
|
|
293
|
-
colors: [
|
|
294
|
-
"#0ea5e9",
|
|
295
|
-
"#14b8a6",
|
|
296
|
-
"#6366f1",
|
|
297
|
-
"#8b5cf6",
|
|
298
|
-
"#06b6d4"
|
|
299
|
-
]
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
key: "sunset",
|
|
303
|
-
label: "Sunset",
|
|
304
|
-
colors: [
|
|
305
|
-
"#f59e0b",
|
|
306
|
-
"#ef4444",
|
|
307
|
-
"#ec4899",
|
|
308
|
-
"#8b5cf6",
|
|
309
|
-
"#f97316"
|
|
310
|
-
]
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
key: "forest",
|
|
314
|
-
label: "Forest",
|
|
315
|
-
colors: [
|
|
316
|
-
"#16a34a",
|
|
317
|
-
"#65a30d",
|
|
318
|
-
"#0d9488",
|
|
319
|
-
"#4d7c0f",
|
|
320
|
-
"#0891b2"
|
|
321
|
-
]
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
key: "slate",
|
|
325
|
-
label: "Slate",
|
|
326
|
-
colors: [
|
|
327
|
-
"#475569",
|
|
328
|
-
"#0ea5e9",
|
|
329
|
-
"#64748b",
|
|
330
|
-
"#38bdf8",
|
|
331
|
-
"#94a3b8"
|
|
332
|
-
]
|
|
333
|
-
}
|
|
334
|
-
], R = n.derived(() => L.find((e) => e.colors && o().chartPalette && e.colors.join() === o().chartPalette.join())?.key ?? "theme"), Ue = n.derived(() => o().chartType === "bar"), We = n.derived(() => o().chartType === "pie"), Ge = n.derived(() => o().chartType !== "gauge"), Ke = n.derived(() => n.get(O).dims.length > 1 && ![
|
|
335
|
-
"pie",
|
|
336
|
-
"gauge",
|
|
337
|
-
"waterfall",
|
|
338
|
-
"funnel",
|
|
339
|
-
"calendar"
|
|
340
|
-
].includes(o().chartType)), qe = n.derived(() => I.includes(o().chartType)), Je = n.derived(() => I.includes(o().chartType) || o().chartType === "scatter" || o().chartType === "boxplot"), Ye = n.derived(() => ![
|
|
341
|
-
"gauge",
|
|
342
|
-
"sankey",
|
|
343
|
-
"calendar",
|
|
344
|
-
"treemap",
|
|
345
|
-
"scatter",
|
|
346
|
-
"boxplot"
|
|
347
|
-
].includes(o().chartType)), z = n.derived(() => o().chartType === "scatter"), Xe = n.derived(() => !n.get(z) && o().chartType !== "boxplot"), Ze = n.derived(() => [...new Set(n.get(He).map((e) => e.group))]), Qe = n.derived(() => {
|
|
348
|
-
let e = o().chartType, t = o().chartSpec?.categories.length ?? 0;
|
|
349
|
-
return e === "heatmap" && !o().chartSeriesId && n.get(O).dims.length > 1 ? "Heat map needs a Split by column for its rows." : e === "sankey" && !o().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;
|
|
350
|
-
}), $e = [
|
|
351
|
-
{
|
|
352
|
-
value: "sum",
|
|
353
|
-
label: "Sum"
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
value: "avg",
|
|
357
|
-
label: "Average"
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
value: "count",
|
|
361
|
-
label: "Count"
|
|
362
|
-
}
|
|
363
|
-
], et = [
|
|
364
|
-
{
|
|
365
|
-
value: "number",
|
|
366
|
-
label: "Number"
|
|
367
|
-
},
|
|
368
|
-
{
|
|
369
|
-
value: "currency",
|
|
370
|
-
label: "Currency"
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
value: "percent",
|
|
374
|
-
label: "Percent"
|
|
375
|
-
}
|
|
376
|
-
];
|
|
377
|
-
function tt(e) {
|
|
378
|
-
n.get(g) && e.category != null && o().applyChartCrossFilter(String(e.category));
|
|
379
|
-
}
|
|
380
|
-
let B = n.state(null), V = n.state(!1), H = n.state(!1), U = () => n.get(B)?.querySelector("svg") ?? null, nt = n.derived(() => !!n.get(D) && m(n.get(D)));
|
|
381
|
-
function rt() {
|
|
382
|
-
let e = U();
|
|
383
|
-
e && d(e, "chart.png"), n.set(V, !1);
|
|
384
|
-
}
|
|
385
|
-
function it() {
|
|
386
|
-
let e = U();
|
|
387
|
-
e && l(e, "chart.svg"), n.set(V, !1);
|
|
388
|
-
}
|
|
389
|
-
function at() {
|
|
390
|
-
n.get(D) && h(n.get(D), "chart.csv"), n.set(V, !1);
|
|
391
|
-
}
|
|
392
|
-
async function ot() {
|
|
393
|
-
let e = U();
|
|
394
|
-
if (n.set(V, !1), !(!e || typeof ClipboardItem > "u" || !navigator.clipboard?.write)) try {
|
|
395
|
-
let t = await u(e);
|
|
396
|
-
await navigator.clipboard.write([new ClipboardItem({ "image/png": t })]), n.set(H, !0), setTimeout(() => n.set(H, !1), 1400);
|
|
397
|
-
} catch {}
|
|
398
|
-
}
|
|
399
|
-
n.user_effect(() => {
|
|
400
|
-
if (!n.get(V)) return;
|
|
401
|
-
let e = (e) => {
|
|
402
|
-
e.target?.closest(".sv-grid-chart-export") || n.set(V, !1);
|
|
403
|
-
};
|
|
404
|
-
return window.addEventListener("pointerdown", e), () => window.removeEventListener("pointerdown", e);
|
|
405
|
-
});
|
|
406
|
-
let st = n.derived(() => !!o().chartAiHandler), W = n.state(!1), G = n.state(""), K = n.state(!1), q = n.state(""), J = n.state("");
|
|
407
|
-
async function ct() {
|
|
408
|
-
let e = o().chartAiHandler, t = n.get(G).trim();
|
|
409
|
-
if (!(!e || !t || n.get(K))) {
|
|
410
|
-
n.set(K, !0), n.set(q, ""), n.set(J, "");
|
|
411
|
-
try {
|
|
412
|
-
let r = await e(t);
|
|
413
|
-
r ? (o().applyChartConfig(r), n.set(J, typeof r.rationale == "string" ? r.rationale : "", !0)) : n.set(q, "Couldn't build a chart from that request.");
|
|
414
|
-
} catch (e) {
|
|
415
|
-
n.set(q, e instanceof Error ? e.message : "Something went wrong.", !0);
|
|
416
|
-
} finally {
|
|
417
|
-
n.set(K, !1);
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
let Y = n.state(!1);
|
|
422
|
-
function lt(e) {
|
|
423
|
-
e.preventDefault(), n.set(Y, !0);
|
|
424
|
-
let t = n.get(p) === "right" ? e.clientX : e.clientY, r = n.get(k);
|
|
425
|
-
e.target.setPointerCapture?.(e.pointerId);
|
|
426
|
-
let i = (e) => {
|
|
427
|
-
let i = n.get(p) === "right" ? t - e.clientX : t - e.clientY;
|
|
428
|
-
o().chartSize = Math.max(160, Math.min(720, r + i));
|
|
429
|
-
}, a = () => {
|
|
430
|
-
n.set(Y, !1), window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a);
|
|
431
|
-
};
|
|
432
|
-
window.addEventListener("pointermove", i), window.addEventListener("pointerup", a);
|
|
433
|
-
}
|
|
434
|
-
var X = ke();
|
|
435
|
-
let ut;
|
|
436
|
-
var dt = n.child(X), ft = (e) => {
|
|
437
|
-
var t = _();
|
|
438
|
-
let r;
|
|
439
|
-
n.template_effect(() => {
|
|
440
|
-
r = n.set_class(t, 1, "sv-grid-chart-resizer", null, r, { "is-dragging": n.get(Y) }), n.set_attribute(t, "aria-orientation", n.get(p) === "right" ? "vertical" : "horizontal");
|
|
441
|
-
}), n.delegated("pointerdown", t, lt), n.append(e, t);
|
|
442
|
-
};
|
|
443
|
-
n.if(dt, (e) => {
|
|
444
|
-
n.get(A) || e(ft);
|
|
445
|
-
});
|
|
446
|
-
var pt = n.sibling(dt, 2), Z = n.child(pt);
|
|
447
|
-
let mt;
|
|
448
|
-
var ht = n.sibling(n.child(Z), 4), gt = n.child(ht), _t = (e) => {
|
|
449
|
-
var t = v();
|
|
450
|
-
n.delegated("click", t, () => o().clearChartCrossFilter()), n.append(e, t);
|
|
451
|
-
};
|
|
452
|
-
n.if(gt, (e) => {
|
|
453
|
-
n.get(g) && !n.get(f) && e(_t);
|
|
454
|
-
});
|
|
455
|
-
var vt = n.sibling(gt, 2), Q = n.child(vt), yt = n.child(Q), bt = (e) => {
|
|
456
|
-
var t = ee();
|
|
457
|
-
n.append(e, t);
|
|
458
|
-
}, xt = (e) => {
|
|
459
|
-
var t = y();
|
|
460
|
-
n.append(e, t);
|
|
461
|
-
};
|
|
462
|
-
n.if(yt, (e) => {
|
|
463
|
-
n.get(H) ? e(bt) : e(xt, -1);
|
|
464
|
-
}), n.reset(Q);
|
|
465
|
-
var St = n.sibling(Q, 2), Ct = (e) => {
|
|
466
|
-
var t = b(), r = n.child(t), i = n.sibling(r, 2), a = n.sibling(i, 2), o = n.sibling(a, 2);
|
|
467
|
-
n.reset(t), n.template_effect(() => a.disabled = !n.get(nt)), n.delegated("click", r, rt), n.delegated("click", i, it), n.delegated("click", a, at), n.delegated("click", o, ot), n.append(e, t);
|
|
468
|
-
};
|
|
469
|
-
n.if(St, (e) => {
|
|
470
|
-
n.get(V) && e(Ct);
|
|
471
|
-
}), n.reset(vt);
|
|
472
|
-
var wt = n.sibling(vt, 2), Tt = (e) => {
|
|
473
|
-
var t = x();
|
|
474
|
-
let r;
|
|
475
|
-
n.template_effect(() => {
|
|
476
|
-
r = n.set_class(t, 1, "sv-grid-chart-btn sv-grid-chart-ai-btn", null, r, { "is-active": n.get(W) }), n.set_attribute(t, "aria-expanded", n.get(W));
|
|
477
|
-
}), n.delegated("click", t, () => n.set(W, !n.get(W))), n.append(e, t);
|
|
478
|
-
};
|
|
479
|
-
n.if(wt, (e) => {
|
|
480
|
-
n.get(st) && !n.get(f) && e(Tt);
|
|
481
|
-
});
|
|
482
|
-
var Et = n.sibling(wt, 2), Dt = (e) => {
|
|
483
|
-
var t = S();
|
|
484
|
-
n.delegated("click", t, () => o().addChart()), n.append(e, t);
|
|
485
|
-
};
|
|
486
|
-
n.if(Et, (e) => {
|
|
487
|
-
n.get(f) || e(Dt);
|
|
488
|
-
});
|
|
489
|
-
var Ot = n.sibling(Et, 2), kt = (e) => {
|
|
490
|
-
var t = ne(), r = n.first_child(t), i = n.child(r), a = (e) => {
|
|
491
|
-
var t = te();
|
|
492
|
-
n.append(e, t);
|
|
493
|
-
}, o = (e) => {
|
|
494
|
-
var t = C();
|
|
495
|
-
n.append(e, t);
|
|
496
|
-
};
|
|
497
|
-
n.if(i, (e) => {
|
|
498
|
-
n.get(j) ? e(a) : e(o, -1);
|
|
499
|
-
}), n.reset(r);
|
|
500
|
-
var s = n.sibling(r, 2);
|
|
501
|
-
n.template_effect(() => {
|
|
502
|
-
n.set_attribute(r, "aria-label", n.get(j) ? "Restore" : "Maximize"), n.set_attribute(r, "title", n.get(j) ? "Restore" : "Maximize");
|
|
503
|
-
}), n.delegated("click", r, Ne), n.delegated("click", s, Me), n.append(e, t);
|
|
504
|
-
}, At = (e) => {
|
|
505
|
-
var t = w();
|
|
506
|
-
n.delegated("click", t, je), n.append(e, t);
|
|
507
|
-
};
|
|
508
|
-
n.if(Ot, (e) => {
|
|
509
|
-
n.get(A) ? e(kt) : e(At, -1);
|
|
510
|
-
});
|
|
511
|
-
var jt = n.sibling(Ot, 2);
|
|
512
|
-
n.reset(ht), n.reset(Z);
|
|
513
|
-
var Mt = n.sibling(Z, 2), Nt = (e) => {
|
|
514
|
-
var t = T();
|
|
515
|
-
n.each(t, 23, () => o().charts, (e) => e.id, (e, t, r) => {
|
|
516
|
-
var i = re();
|
|
517
|
-
let a;
|
|
518
|
-
var s = n.child(i), c = n.child(s, !0);
|
|
519
|
-
n.reset(s);
|
|
520
|
-
var l = n.sibling(s, 2);
|
|
521
|
-
n.reset(i), n.template_effect(() => {
|
|
522
|
-
a = n.set_class(i, 1, "sv-grid-chart-tab", null, a, { "is-active": n.get(r) === o().activeChartIndex }), n.set_attribute(s, "aria-selected", n.get(r) === o().activeChartIndex), n.set_text(c, n.get(t).title), n.set_attribute(l, "aria-label", `Remove ${n.get(t).title}`);
|
|
523
|
-
}), n.delegated("click", s, () => o().activeChartIndex = n.get(r)), n.delegated("click", l, () => o().removeChart(n.get(r))), n.append(e, i);
|
|
524
|
-
}), n.reset(t), n.append(e, t);
|
|
525
|
-
};
|
|
526
|
-
n.if(Mt, (e) => {
|
|
527
|
-
!n.get(f) && o().charts.length > 1 && e(Nt);
|
|
528
|
-
});
|
|
529
|
-
var Pt = n.sibling(Mt, 2), Ft = (e) => {
|
|
530
|
-
var t = ae(), r = n.child(t), i = n.child(r);
|
|
531
|
-
n.remove_input_defaults(i);
|
|
532
|
-
var a = n.sibling(i, 2), o = n.child(a, !0);
|
|
533
|
-
n.reset(a), n.reset(r);
|
|
534
|
-
var s = n.sibling(r, 2), c = (e) => {
|
|
535
|
-
var t = E(), r = n.child(t, !0);
|
|
536
|
-
n.reset(t), n.template_effect(() => n.set_text(r, n.get(q))), n.append(e, t);
|
|
537
|
-
}, l = (e) => {
|
|
538
|
-
var t = ie(), r = n.child(t, !0);
|
|
539
|
-
n.reset(t), n.template_effect(() => n.set_text(r, n.get(J))), n.append(e, t);
|
|
540
|
-
};
|
|
541
|
-
n.if(s, (e) => {
|
|
542
|
-
n.get(q) ? e(c) : n.get(J) && e(l, 1);
|
|
543
|
-
}), n.reset(t), n.template_effect((e) => {
|
|
544
|
-
i.disabled = n.get(K), a.disabled = e, n.set_text(o, n.get(K) ? "Thinking..." : "Chart it");
|
|
545
|
-
}, [() => n.get(K) || !n.get(G).trim()]), n.event("submit", r, (e) => {
|
|
546
|
-
e.preventDefault(), ct();
|
|
547
|
-
}), n.bind_value(i, () => n.get(G), (e) => n.set(G, e)), n.append(e, t);
|
|
548
|
-
};
|
|
549
|
-
n.if(Pt, (e) => {
|
|
550
|
-
n.get(st) && n.get(W) && !n.get(f) && e(Ft);
|
|
551
|
-
});
|
|
552
|
-
var It = n.sibling(Pt, 2), Lt = n.child(It), Rt = (e) => {
|
|
553
|
-
var t = Te(), r = n.first_child(t), i = n.sibling(n.child(r), 2);
|
|
554
|
-
n.each(i, 20, () => n.get(Ze), (e) => e, (e, t) => {
|
|
555
|
-
var r = se();
|
|
556
|
-
n.each(r, 21, () => n.get(He).filter((e) => e.group === t), (e) => e.value, (e, t) => {
|
|
557
|
-
var r = oe(), i = n.child(r, !0);
|
|
558
|
-
n.reset(r);
|
|
559
|
-
var a = {};
|
|
560
|
-
n.template_effect(() => {
|
|
561
|
-
n.set_text(i, n.get(t).label), a !== (a = n.get(t).value) && (r.value = (r.__value = n.get(t).value) ?? "");
|
|
562
|
-
}), n.append(e, r);
|
|
563
|
-
}), n.reset(r), n.template_effect(() => n.set_attribute(r, "label", t)), n.append(e, r);
|
|
564
|
-
}), n.reset(i);
|
|
565
|
-
var a;
|
|
566
|
-
n.init_select(i), n.reset(r);
|
|
567
|
-
var s = n.sibling(r, 2), c = (e) => {
|
|
568
|
-
var t = le(), r = n.child(t), i = n.child(r, !0);
|
|
569
|
-
n.reset(r);
|
|
570
|
-
var a = n.sibling(r, 2);
|
|
571
|
-
n.each(a, 21, () => n.get(O).dims, (e) => e.id, (e, t) => {
|
|
572
|
-
var r = ce(), i = n.child(r, !0);
|
|
573
|
-
n.reset(r);
|
|
574
|
-
var a = {};
|
|
575
|
-
n.template_effect(() => {
|
|
576
|
-
n.set_text(i, n.get(t).label), a !== (a = n.get(t).id) && (r.value = (r.__value = n.get(t).id) ?? "");
|
|
577
|
-
}), n.append(e, r);
|
|
578
|
-
}), n.reset(a);
|
|
579
|
-
var s;
|
|
580
|
-
n.init_select(a), n.reset(t), n.template_effect(() => {
|
|
581
|
-
n.set_text(i, o().chartType === "sankey" ? "From" : o().chartType === "heatmap" ? "Columns" : "Group by"), s !== (s = o().chartDimensionId ?? "") && (a.value = (a.__value = o().chartDimensionId ?? "") ?? "", n.select_option(a, o().chartDimensionId ?? ""));
|
|
582
|
-
}), n.delegated("change", a, (e) => o().chartDimensionId = e.currentTarget.value || null), n.append(e, t);
|
|
583
|
-
};
|
|
584
|
-
n.if(s, (e) => {
|
|
585
|
-
n.get(Ge) && e(c);
|
|
586
|
-
});
|
|
587
|
-
var l = n.sibling(s, 2), u = (e) => {
|
|
588
|
-
var t = de(), r = n.child(t), i = n.child(r, !0);
|
|
589
|
-
n.reset(r);
|
|
590
|
-
var a = n.sibling(r, 2), s = n.child(a);
|
|
591
|
-
s.value = s.__value = "";
|
|
592
|
-
var c = n.sibling(s);
|
|
593
|
-
n.each(c, 17, () => n.get(O).dims, (e) => e.id, (e, t) => {
|
|
594
|
-
var r = ue(), i = n.child(r, !0);
|
|
595
|
-
n.reset(r);
|
|
596
|
-
var a = {};
|
|
597
|
-
n.template_effect(() => {
|
|
598
|
-
n.set_text(i, n.get(t).label), a !== (a = n.get(t).id) && (r.value = (r.__value = n.get(t).id) ?? "");
|
|
599
|
-
}), n.append(e, r);
|
|
600
|
-
}), n.reset(a);
|
|
601
|
-
var l;
|
|
602
|
-
n.init_select(a), n.reset(t), n.template_effect(() => {
|
|
603
|
-
n.set_text(i, o().chartType === "sankey" ? "To" : o().chartType === "heatmap" ? "Rows" : "Split by"), l !== (l = o().chartSeriesId ?? "") && (a.value = (a.__value = o().chartSeriesId ?? "") ?? "", n.select_option(a, o().chartSeriesId ?? ""));
|
|
604
|
-
}), n.delegated("change", a, (e) => o().chartSeriesId = e.currentTarget.value || null), n.append(e, t);
|
|
605
|
-
};
|
|
606
|
-
n.if(l, (e) => {
|
|
607
|
-
n.get(Ke) && e(u);
|
|
608
|
-
});
|
|
609
|
-
var d = n.sibling(l, 2), f = n.child(d), p = n.child(f, !0);
|
|
610
|
-
n.reset(f);
|
|
611
|
-
var m = n.sibling(f, 2);
|
|
612
|
-
n.each(m, 21, () => n.get(O).measures, (e) => e.id, (e, t) => {
|
|
613
|
-
var r = fe(), i = n.child(r, !0);
|
|
614
|
-
n.reset(r);
|
|
615
|
-
var a = {};
|
|
616
|
-
n.template_effect(() => {
|
|
617
|
-
n.set_text(i, n.get(t).label), a !== (a = n.get(t).id) && (r.value = (r.__value = n.get(t).id) ?? "");
|
|
618
|
-
}), n.append(e, r);
|
|
619
|
-
}), n.reset(m);
|
|
620
|
-
var h;
|
|
621
|
-
n.init_select(m), n.reset(d);
|
|
622
|
-
var g = n.sibling(d, 2), _ = (e) => {
|
|
623
|
-
var t = me(), r = n.sibling(n.child(t), 2);
|
|
624
|
-
n.each(r, 21, () => n.get(O).measures, (e) => e.id, (e, t) => {
|
|
625
|
-
var r = pe(), i = n.child(r, !0);
|
|
626
|
-
n.reset(r);
|
|
627
|
-
var a = {};
|
|
628
|
-
n.template_effect(() => {
|
|
629
|
-
n.set_text(i, n.get(t).label), a !== (a = n.get(t).id) && (r.value = (r.__value = n.get(t).id) ?? "");
|
|
630
|
-
}), n.append(e, r);
|
|
631
|
-
}), n.reset(r);
|
|
632
|
-
var i;
|
|
633
|
-
n.init_select(r), n.reset(t), n.template_effect(() => {
|
|
634
|
-
i !== (i = o().effectiveChartMeasure2Id ?? "") && (r.value = (r.__value = o().effectiveChartMeasure2Id ?? "") ?? "", n.select_option(r, o().effectiveChartMeasure2Id ?? ""));
|
|
635
|
-
}), n.delegated("change", r, (e) => o().chartMeasure2Id = e.currentTarget.value || null), n.append(e, t);
|
|
636
|
-
};
|
|
637
|
-
n.if(g, (e) => {
|
|
638
|
-
n.get(z) && e(_);
|
|
639
|
-
});
|
|
640
|
-
var v = n.sibling(g, 2), ee = (e) => {
|
|
641
|
-
var t = ge(), r = n.sibling(n.child(t), 2);
|
|
642
|
-
n.each(r, 21, () => $e, (e) => e.value, (e, t) => {
|
|
643
|
-
var r = he(), i = n.child(r, !0);
|
|
644
|
-
n.reset(r);
|
|
645
|
-
var a = {};
|
|
646
|
-
n.template_effect(() => {
|
|
647
|
-
n.set_text(i, n.get(t).label), a !== (a = n.get(t).value) && (r.value = (r.__value = n.get(t).value) ?? "");
|
|
648
|
-
}), n.append(e, r);
|
|
649
|
-
}), n.reset(r);
|
|
650
|
-
var i;
|
|
651
|
-
n.init_select(r), n.reset(t), n.template_effect(() => {
|
|
652
|
-
i !== (i = o().chartReduce) && (r.value = (r.__value = o().chartReduce) ?? "", n.select_option(r, o().chartReduce));
|
|
653
|
-
}), n.delegated("change", r, (e) => o().chartReduce = e.currentTarget.value), n.append(e, t);
|
|
654
|
-
};
|
|
655
|
-
n.if(v, (e) => {
|
|
656
|
-
n.get(Xe) && e(ee);
|
|
657
|
-
});
|
|
658
|
-
var y = n.sibling(v, 2), b = n.sibling(n.child(y), 2);
|
|
659
|
-
n.each(b, 21, () => et, (e) => e.value, (e, t) => {
|
|
660
|
-
var r = _e(), i = n.child(r, !0);
|
|
661
|
-
n.reset(r);
|
|
662
|
-
var a = {};
|
|
663
|
-
n.template_effect(() => {
|
|
664
|
-
n.set_text(i, n.get(t).label), a !== (a = n.get(t).value) && (r.value = (r.__value = n.get(t).value) ?? "");
|
|
665
|
-
}), n.append(e, r);
|
|
666
|
-
}), n.reset(b);
|
|
667
|
-
var x;
|
|
668
|
-
n.init_select(b), n.reset(y);
|
|
669
|
-
var S = n.sibling(y, 2), te = (e) => {
|
|
670
|
-
var t = ve(), r = n.first_child(t), i = n.child(r);
|
|
671
|
-
n.remove_input_defaults(i), n.next(), n.reset(r);
|
|
672
|
-
var a = n.sibling(r, 2), s = n.child(a);
|
|
673
|
-
n.remove_input_defaults(s), n.next(), n.reset(a), n.template_effect(() => {
|
|
674
|
-
n.set_checked(i, o().chartStacked), n.set_checked(s, o().chartStacked100);
|
|
675
|
-
}), n.delegated("change", i, (e) => o().chartStacked = e.currentTarget.checked), n.delegated("change", s, (e) => o().chartStacked100 = e.currentTarget.checked), n.append(e, t);
|
|
676
|
-
};
|
|
677
|
-
n.if(S, (e) => {
|
|
678
|
-
n.get(qe) && e(te);
|
|
679
|
-
});
|
|
680
|
-
var C = n.sibling(S, 2), ne = (e) => {
|
|
681
|
-
var t = ye(), r = n.child(t);
|
|
682
|
-
n.remove_input_defaults(r), n.next(), n.reset(t), n.template_effect(() => n.set_checked(r, o().chartOrientation === "horizontal")), n.delegated("change", r, (e) => o().chartOrientation = e.currentTarget.checked ? "horizontal" : "vertical"), n.append(e, t);
|
|
683
|
-
};
|
|
684
|
-
n.if(C, (e) => {
|
|
685
|
-
n.get(Ue) && e(ne);
|
|
686
|
-
});
|
|
687
|
-
var w = n.sibling(C, 2), re = (e) => {
|
|
688
|
-
var t = be(), r = n.child(t);
|
|
689
|
-
n.remove_input_defaults(r), n.next(), n.reset(t), n.template_effect(() => n.set_checked(r, o().chartDonut)), n.delegated("change", r, (e) => o().chartDonut = e.currentTarget.checked), n.append(e, t);
|
|
690
|
-
};
|
|
691
|
-
n.if(w, (e) => {
|
|
692
|
-
n.get(We) && e(re);
|
|
693
|
-
});
|
|
694
|
-
var T = n.sibling(w, 2), E = n.sibling(n.child(T), 2);
|
|
695
|
-
n.each(E, 21, () => L, (e) => e.key, (e, t) => {
|
|
696
|
-
var r = xe(), i = n.child(r, !0);
|
|
697
|
-
n.reset(r);
|
|
698
|
-
var a = {};
|
|
699
|
-
n.template_effect(() => {
|
|
700
|
-
n.set_text(i, n.get(t).label), a !== (a = n.get(t).key) && (r.value = (r.__value = n.get(t).key) ?? "");
|
|
701
|
-
}), n.append(e, r);
|
|
702
|
-
}), n.reset(E);
|
|
703
|
-
var ie;
|
|
704
|
-
n.init_select(E), n.reset(T);
|
|
705
|
-
var ae = n.sibling(T, 2), Ee = (e) => {
|
|
706
|
-
var t = Se(), r = n.child(t);
|
|
707
|
-
n.remove_input_defaults(r), n.next(), n.reset(t), n.template_effect(() => n.set_checked(r, o().chartDataLabels)), n.delegated("change", r, (e) => o().chartDataLabels = e.currentTarget.checked), n.append(e, t);
|
|
708
|
-
};
|
|
709
|
-
n.if(ae, (e) => {
|
|
710
|
-
n.get(Ye) && e(Ee);
|
|
711
|
-
});
|
|
712
|
-
var De = n.sibling(ae, 2), Oe = (e) => {
|
|
713
|
-
var t = Ce(), r = n.child(t);
|
|
714
|
-
n.remove_input_defaults(r), n.next(), n.reset(t), n.template_effect(() => n.set_checked(r, o().chartLogScale)), n.delegated("change", r, (e) => o().chartLogScale = e.currentTarget.checked), n.append(e, t);
|
|
715
|
-
};
|
|
716
|
-
n.if(De, (e) => {
|
|
717
|
-
n.get(Je) && e(Oe);
|
|
718
|
-
});
|
|
719
|
-
var ke = n.sibling(De, 2), D = (e) => {
|
|
720
|
-
var t = we(), r = n.child(t);
|
|
721
|
-
n.remove_input_defaults(r), n.next(), n.reset(t), n.template_effect(() => n.set_checked(r, o().chartTimeAxis)), n.delegated("change", r, (e) => o().chartTimeAxis = e.currentTarget.checked), n.append(e, t);
|
|
722
|
-
}, k = n.derived(() => o().chartDimensionIsDate && I.includes(o().chartType));
|
|
723
|
-
n.if(ke, (e) => {
|
|
724
|
-
n.get(k) && e(D);
|
|
725
|
-
}), n.template_effect(() => {
|
|
726
|
-
a !== (a = o().chartType) && (i.value = (i.__value = o().chartType) ?? "", n.select_option(i, o().chartType)), n.set_text(p, n.get(z) ? "X" : o().chartType === "gauge" ? "Metric" : "Value"), h !== (h = o().chartMeasureId ?? "") && (m.value = (m.__value = o().chartMeasureId ?? "") ?? "", n.select_option(m, o().chartMeasureId ?? "")), x !== (x = o().chartValueFormat) && (b.value = (b.__value = o().chartValueFormat) ?? "", n.select_option(b, o().chartValueFormat)), ie !== (ie = n.get(R)) && (E.value = (E.__value = n.get(R)) ?? "", n.select_option(E, n.get(R)));
|
|
727
|
-
}), n.delegated("change", i, (e) => o().chartType = e.currentTarget.value), n.delegated("change", m, (e) => o().chartMeasureId = e.currentTarget.value || null), n.delegated("change", b, (e) => o().chartValueFormat = e.currentTarget.value), n.delegated("change", E, (e) => o().chartPalette = L.find((t) => t.key === e.currentTarget.value)?.colors ?? null), n.append(e, t);
|
|
728
|
-
};
|
|
729
|
-
n.if(Lt, (e) => {
|
|
730
|
-
n.get(f) || e(Rt);
|
|
731
|
-
});
|
|
732
|
-
var zt = n.sibling(Lt, 2), Bt = (e) => {
|
|
733
|
-
var t = Ee(), r = n.child(t, !0);
|
|
734
|
-
n.reset(t), n.template_effect(() => n.set_text(r, n.get(Qe))), n.append(e, t);
|
|
735
|
-
};
|
|
736
|
-
n.if(zt, (e) => {
|
|
737
|
-
n.get(Qe) && e(Bt);
|
|
738
|
-
}), n.reset(It), n.reset(pt);
|
|
739
|
-
var $ = n.sibling(pt, 2), Vt = n.child($), Ht = (e) => {
|
|
740
|
-
{
|
|
741
|
-
let r = n.derived(() => n.get(c)?.zoom === !0), i = n.derived(() => n.get(c)?.brush === !0), a = n.derived(() => n.get(c)?.export === !0 || void 0);
|
|
742
|
-
t(e, {
|
|
743
|
-
get spec() {
|
|
744
|
-
return n.get(D);
|
|
745
|
-
},
|
|
746
|
-
get width() {
|
|
747
|
-
return n.get(ze);
|
|
748
|
-
},
|
|
749
|
-
get height() {
|
|
750
|
-
return n.get(Be);
|
|
751
|
-
},
|
|
752
|
-
onSelect: tt,
|
|
753
|
-
interactive: !0,
|
|
754
|
-
legend: !0,
|
|
755
|
-
get dataLabels() {
|
|
756
|
-
return o().chartDataLabels;
|
|
757
|
-
},
|
|
758
|
-
get zoomable() {
|
|
759
|
-
return n.get(r);
|
|
760
|
-
},
|
|
761
|
-
get brush() {
|
|
762
|
-
return n.get(i);
|
|
763
|
-
},
|
|
764
|
-
get toolbar() {
|
|
765
|
-
return n.get(a);
|
|
766
|
-
}
|
|
767
|
-
});
|
|
768
|
-
}
|
|
769
|
-
}, Ut = (e) => {
|
|
770
|
-
var t = De(), r = n.child(t), i = (e) => {
|
|
771
|
-
var t = n.text("Charting needs at least one text column (to group by) and one numeric column (to measure).");
|
|
772
|
-
n.append(e, t);
|
|
773
|
-
}, a = (e) => {
|
|
774
|
-
var t = n.text("No data to chart.");
|
|
775
|
-
n.append(e, t);
|
|
776
|
-
};
|
|
777
|
-
n.if(r, (e) => {
|
|
778
|
-
!n.get(O).dims.length || !n.get(O).measures.length ? e(i) : e(a, -1);
|
|
779
|
-
}), n.reset(t), n.append(e, t);
|
|
780
|
-
};
|
|
781
|
-
n.if(Vt, (e) => {
|
|
782
|
-
n.get(D) && (n.get(D).series.length || n.get(D).gaugeValue != null || n.get(f)) ? e(Ht) : e(Ut, -1);
|
|
783
|
-
}), n.reset($), n.bind_this($, (e) => n.set(B, e), () => n.get(B));
|
|
784
|
-
var Wt = n.sibling($, 2), Gt = (e) => {
|
|
785
|
-
var t = Oe();
|
|
786
|
-
n.delegated("pointerdown", t, Fe), n.append(e, t);
|
|
787
|
-
};
|
|
788
|
-
n.if(Wt, (e) => {
|
|
789
|
-
n.get(A) && !n.get(j) && e(Gt);
|
|
790
|
-
}), n.reset(X), n.bind_this(X, (e) => n.set(N, e), () => n.get(N)), n.template_effect(() => {
|
|
791
|
-
ut = n.set_class(X, 1, "sv-grid-chart-panel", null, ut, {
|
|
792
|
-
"is-right": n.get(p) === "right" && !n.get(A),
|
|
793
|
-
"is-bottom": n.get(p) === "bottom" && !n.get(A),
|
|
794
|
-
"is-floating": n.get(A),
|
|
795
|
-
"is-maximized": n.get(A) && n.get(j)
|
|
796
|
-
}), n.set_style(X, n.get(Ie)), mt = n.set_class(Z, 1, "sv-grid-chart-drawer-title", null, mt, { "is-drag-handle": n.get(A) && !n.get(j) }), n.set_attribute(Q, "aria-expanded", n.get(V));
|
|
797
|
-
}), n.delegated("pointerdown", Z, Pe), n.delegated("click", Q, () => n.set(V, !n.get(V))), n.delegated("click", jt, () => o().chartPanelOpen = !1), n.bind_element_size($, "clientWidth", (e) => n.set(P, e)), n.bind_element_size($, "clientHeight", (e) => n.set(F, e)), n.transition(3, X, () => r, () => ({
|
|
798
|
-
x: !n.get(A) && n.get(p) === "right" ? n.get(k) : 0,
|
|
799
|
-
y: !n.get(A) && n.get(p) === "bottom" ? n.get(k) : 0,
|
|
800
|
-
duration: 180,
|
|
801
|
-
easing: i
|
|
802
|
-
})), n.append(e, X), n.pop();
|
|
803
|
-
}
|
|
804
|
-
n.delegate([
|
|
805
|
-
"pointerdown",
|
|
806
|
-
"click",
|
|
807
|
-
"change"
|
|
808
|
-
]);
|
|
809
|
-
//#endregion
|
|
810
|
-
export { u as a, d as c, p as i, l, g as n, s as o, m as r, h as s, D as t };
|