@svgrid/grid 3.0.0 → 3.0.2
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/CHANGELOG.md +116 -88
- package/README.md +199 -199
- package/dist/FlexRender.svelte +96 -96
- package/dist/GridFooter.svelte +190 -181
- package/dist/GridFooter.svelte.d.ts +8 -0
- package/dist/GridMenus.svelte +18 -10
- package/dist/GridMenus.svelte.d.ts +2 -1
- package/dist/SvAutoComplete.svelte +169 -169
- package/dist/SvAvatar.svelte +75 -75
- package/dist/SvCalendar.svelte +503 -503
- package/dist/SvCarousel.svelte +141 -141
- package/dist/SvCheckBox.svelte +102 -102
- package/dist/SvCircularProgress.svelte +109 -109
- package/dist/SvColorInput.svelte +181 -181
- package/dist/SvComboBox.svelte +279 -279
- package/dist/SvContextMenu.svelte +116 -116
- package/dist/SvCountryInput.svelte +163 -163
- package/dist/SvDrawer.svelte +254 -254
- package/dist/SvDropDownList.svelte +378 -378
- package/dist/SvDurationInput.svelte +126 -126
- package/dist/SvField.svelte +293 -293
- package/dist/SvForm.svelte +437 -437
- package/dist/SvGrid.controller.svelte.d.ts +17 -0
- package/dist/SvGrid.controller.svelte.js +128 -14
- package/dist/SvGrid.css +79 -10
- package/dist/SvGrid.svelte +191 -186
- package/dist/SvGrid.types.d.ts +42 -1
- package/dist/SvGridCellEditor.svelte +748 -744
- package/dist/SvGridChart.svelte +2246 -1716
- package/dist/SvGridChart.svelte.d.ts +63 -1
- package/dist/SvGridChartPanel.svelte +633 -485
- package/dist/SvGridChartView.svelte +79 -70
- package/dist/SvGridChartView.svelte.d.ts +7 -0
- package/dist/SvGridDropdown.svelte +728 -728
- package/dist/SvGridSelect.svelte +270 -270
- package/dist/SvGroupCell.svelte +141 -116
- package/dist/SvGroupCell.svelte.d.ts +8 -0
- package/dist/SvListBox.svelte +334 -334
- package/dist/SvMaskedInput.svelte +122 -122
- package/dist/SvMenu.svelte +124 -124
- package/dist/SvMenuList.svelte +146 -146
- package/dist/SvMultiSelect.svelte +293 -293
- package/dist/SvNumberInput.svelte +172 -172
- package/dist/SvOtpInput.svelte +158 -158
- package/dist/SvPasswordInput.svelte +151 -151
- package/dist/SvPhoneInput.svelte +133 -133
- package/dist/SvPopover.svelte +197 -197
- package/dist/SvProgress.svelte +116 -116
- package/dist/SvRadioGroup.svelte +107 -107
- package/dist/SvRating.svelte +112 -112
- package/dist/SvResult.svelte +73 -73
- package/dist/SvRichText.svelte +211 -211
- package/dist/SvRowGroupPanel.svelte +186 -170
- package/dist/SvRowGroupPanel.svelte.d.ts +8 -0
- package/dist/SvScrollArea.svelte +61 -61
- package/dist/SvSlider.svelte +203 -203
- package/dist/SvSwitchButton.svelte +108 -108
- package/dist/SvTagsInput.svelte +115 -115
- package/dist/SvTextInput.svelte +147 -147
- package/dist/SvTimePicker.svelte +245 -245
- package/dist/SvToaster.svelte +159 -159
- package/dist/SvToggleButton.svelte +85 -85
- package/dist/SvTooltip.svelte +161 -161
- package/dist/SvTour.svelte +208 -208
- package/dist/SvTree.svelte +444 -444
- package/dist/SvTreeSelect.svelte +239 -239
- package/dist/ai.d.ts +11 -2
- package/dist/ai.js +51 -7
- package/dist/cdn/GridMenus-DyFA-QxA.js +602 -0
- package/dist/cdn/GridMenus-M2XP9t0_.js +603 -0
- package/dist/cdn/{SvDateRangeInput-DflbiP7N.js → SvDateRangeInput-CaOuMs8O.js} +1 -1
- package/dist/cdn/{SvDateRangeInput-Bh0A0JkF.js → SvDateRangeInput-DMLKmGEc.js} +1 -1
- package/dist/cdn/{SvDateTimePicker-Bivn8dAP.js → SvDateTimePicker-CCbDZNZB.js} +1 -1
- package/dist/cdn/{SvDateTimePicker-BWwpfB_o.js → SvDateTimePicker-sonaH0oh.js} +1 -1
- package/dist/cdn/{SvGridCellEditor-Ba7rY3eu.js → SvGridCellEditor-BWnTi2N7.js} +2 -2
- package/dist/cdn/{SvGridCellEditor-AXL8cHGO.js → SvGridCellEditor-CjEJMJKc.js} +2 -2
- package/dist/cdn/SvGridChart-DAb9RbRs.js +1480 -0
- package/dist/cdn/SvGridChart-Yl-IXZFO.js +1481 -0
- package/dist/cdn/SvGridChartPanel-DayQpDsR.js +834 -0
- package/dist/cdn/SvGridChartPanel-aqf8n-vJ.js +810 -0
- package/dist/cdn/{SvGridChartView-eSPuJE6g.js → SvGridChartView-CxfakxR0.js} +5 -3
- package/dist/cdn/{SvGridChartView-SmPW10dI.js → SvGridChartView-Dm_YEx9L.js} +5 -3
- package/dist/cdn/{SvGridDropdown-B1ZcLpgs.js → SvGridDropdown-D0VdjeR8.js} +1 -1
- package/dist/cdn/{SvGridDropdown-CtdbHcIS.js → SvGridDropdown-D13MtJ2j.js} +1 -1
- package/dist/cdn/cell-formatting-C2Hf5gqd.js +86 -0
- package/dist/cdn/chart-CKJRCPOk.js +1652 -0
- package/dist/cdn/{date-format-DZT7T1wf.js → date-format-BNii4zeD.js} +2 -2
- package/dist/cdn/{date-format-CcP1tafP.js → date-format-BnnHlqGw.js} +2 -2
- package/dist/cdn/{export-format-Cv1Dll6k.js → export-format-CUDLy2yn.js} +84 -168
- package/dist/cdn/{src-B_YS5AOc.js → src-BJ2opd0j.js} +3642 -3450
- package/dist/cdn/{src-DYXXpuSk.js → src-DNbz94Ct.js} +8649 -8457
- package/dist/cdn/svgrid.js +16 -15
- package/dist/cdn/svgrid.svelte-external.js +16 -15
- package/dist/cell-formatting.d.ts +7 -0
- package/dist/cell-formatting.js +7 -1
- package/dist/chart-export.d.ts +23 -2
- package/dist/chart-export.js +88 -14
- package/dist/chart.d.ts +410 -18
- package/dist/chart.js +824 -24
- package/dist/editing.js +22 -13
- package/dist/grid-icons.d.ts +49 -0
- package/dist/grid-icons.js +86 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/package.json +1 -1
- package/src/FlexRender.svelte +96 -96
- package/src/GridFooter.svelte +190 -181
- package/src/GridMenus.svelte +18 -10
- package/src/SvAutoComplete.svelte +169 -169
- package/src/SvAvatar.svelte +75 -75
- package/src/SvCalendar.svelte +503 -503
- package/src/SvCalendar.test.ts +226 -226
- package/src/SvCarousel.svelte +141 -141
- package/src/SvCheckBox.svelte +102 -102
- package/src/SvCircularProgress.svelte +109 -109
- package/src/SvColorInput.svelte +181 -181
- package/src/SvComboBox.svelte +279 -279
- package/src/SvContextMenu.svelte +116 -116
- package/src/SvCountryInput.svelte +163 -163
- package/src/SvDrawer.svelte +254 -254
- package/src/SvDropDownList.svelte +378 -378
- package/src/SvDurationInput.svelte +126 -126
- package/src/SvField.svelte +293 -293
- package/src/SvForm.svelte +437 -437
- package/src/SvForm.test.ts +411 -411
- package/src/SvGrid.controller.svelte.ts +146 -13
- package/src/SvGrid.css +79 -10
- package/src/SvGrid.svelte +191 -186
- package/src/SvGrid.types.ts +2133 -2092
- package/src/SvGridCellEditor.svelte +748 -744
- package/src/SvGridChart.svelte +2246 -1716
- package/src/SvGridChart.test.ts +243 -1
- package/src/SvGridChartPanel.svelte +633 -485
- package/src/SvGridChartView.svelte +79 -70
- package/src/SvGridDropdown.svelte +728 -728
- package/src/SvGridSelect.svelte +270 -270
- package/src/SvGroupCell.svelte +141 -116
- package/src/SvListBox.svelte +334 -334
- package/src/SvMaskedInput.svelte +122 -122
- package/src/SvMenu.svelte +124 -124
- package/src/SvMenu.test.ts +97 -97
- package/src/SvMenuList.svelte +146 -146
- package/src/SvMultiSelect.svelte +293 -293
- package/src/SvNumberInput.svelte +172 -172
- package/src/SvOtpInput.svelte +158 -158
- package/src/SvPasswordInput.svelte +151 -151
- package/src/SvPhoneInput.svelte +133 -133
- package/src/SvPopover.svelte +197 -197
- package/src/SvProgress.svelte +116 -116
- package/src/SvRadioGroup.svelte +107 -107
- package/src/SvRating.svelte +112 -112
- package/src/SvResult.svelte +73 -73
- package/src/SvRichText.svelte +211 -211
- package/src/SvRowGroupPanel.svelte +186 -170
- package/src/SvScrollArea.svelte +61 -61
- package/src/SvSlider.svelte +203 -203
- package/src/SvSwitchButton.svelte +108 -108
- package/src/SvTagsInput.svelte +115 -115
- package/src/SvTextInput.svelte +147 -147
- package/src/SvTimePicker.svelte +245 -245
- package/src/SvToaster.svelte +159 -159
- package/src/SvToaster.test.ts +95 -95
- package/src/SvToggleButton.svelte +85 -85
- package/src/SvTooltip.svelte +161 -161
- package/src/SvTour.svelte +208 -208
- package/src/SvTree.svelte +444 -444
- package/src/SvTreeSelect.svelte +239 -239
- package/src/a11y/dismissable.test.ts +119 -119
- package/src/a11y/dismissable.ts +114 -114
- package/src/a11y.contract.test.ts +49 -49
- package/src/a11y.test.ts +59 -59
- package/src/a11y.ts +61 -61
- package/src/ai.test.ts +561 -502
- package/src/ai.ts +1472 -1419
- package/src/build-api.coverage.test.ts +633 -633
- package/src/build-api.ts +846 -846
- package/src/builtin-editors.grid.test.ts +83 -83
- package/src/cell-formatting.ts +177 -171
- package/src/cell-render.test.ts +513 -513
- package/src/cell-render.ts +496 -496
- package/src/cell-values.ts +148 -148
- package/src/chart-export.test.ts +112 -0
- package/src/chart-export.ts +270 -202
- package/src/chart-view.svelte.ts +36 -36
- package/src/chart.test.ts +830 -1
- package/src/chart.ts +3342 -2321
- package/src/collaboration.test.ts +104 -104
- package/src/collaboration.ts +167 -167
- package/src/column-groups.ts +78 -78
- package/src/core.performance.test.ts +30 -30
- package/src/core.ts +1865 -1865
- package/src/createAutocomplete.svelte.ts +132 -132
- package/src/createCombobox.svelte.ts +191 -191
- package/src/createCountryInput.svelte.ts +157 -157
- package/src/createDropdownList.svelte.ts +168 -168
- package/src/createForm.svelte.ts +386 -386
- package/src/createGrid.svelte.ts +42 -42
- package/src/createGrid.test.ts +10 -10
- package/src/createGridState.svelte.ts +17 -17
- package/src/createListbox.svelte.ts +250 -250
- package/src/createMenu.svelte.ts +224 -224
- package/src/createPopoverSelect.svelte.ts +213 -213
- package/src/createSlider.svelte.ts +191 -191
- package/src/createTooltip.svelte.ts +144 -144
- package/src/createTree.svelte.ts +322 -322
- package/src/datetime/date-core.ts +206 -206
- package/src/datetime/date-restrict.ts +61 -61
- package/src/datetime/timezone.ts +135 -135
- package/src/dock-manager-model.ts +596 -596
- package/src/dock-model.ts +374 -374
- package/src/editing.test.ts +974 -974
- package/src/editing.ts +618 -609
- package/src/editor-contract.ts +171 -171
- package/src/editor-registry.grid.test.ts +144 -144
- package/src/editor-registry.ts +122 -122
- package/src/export-data-api.test.ts +126 -126
- package/src/export-format.test.ts +107 -107
- package/src/export-format.ts +601 -601
- package/src/filter-operators.ts +160 -160
- package/src/filtering/excel-filters.ts +325 -325
- package/src/flex-render.ts +3 -3
- package/src/form-field.ts +127 -127
- package/src/grid-icons.test.ts +46 -0
- package/src/grid-icons.ts +184 -0
- package/src/group-display.test.ts +167 -167
- package/src/group-display.ts +200 -200
- package/src/headless.ts +87 -87
- package/src/icon-overrides.grid.test.ts +188 -0
- package/src/icon-seam.test.ts +100 -0
- package/src/index.ts +19 -0
- package/src/js-scroller.svelte.ts +173 -173
- package/src/keyboard-handlers.ts +270 -270
- package/src/keyboard.test.ts +59 -59
- package/src/keyboard.ts +97 -97
- package/src/list-nav.test.ts +49 -49
- package/src/list-nav.ts +29 -29
- package/src/list-option.test.ts +56 -56
- package/src/list-option.ts +179 -179
- package/src/menus.ts +597 -597
- package/src/merge-objects.ts +48 -48
- package/src/overlays.test.ts +90 -90
- package/src/positioning.ts +268 -268
- package/src/render-component.ts +28 -28
- package/src/row-drag.test.ts +401 -401
- package/src/row-drag.ts +419 -419
- package/src/row-resize.test.ts +524 -524
- package/src/row-resize.ts +228 -228
- package/src/scheduler-ical.ts +181 -181
- package/src/scheduler-model.test.ts +562 -562
- package/src/scheduler-model.ts +873 -873
- package/src/selection.test.ts +885 -885
- package/src/server-data-source.test.ts +383 -383
- package/src/server-data-source.ts +469 -469
- package/src/sparkline.test.ts +68 -68
- package/src/sparkline.ts +169 -169
- package/src/spreadsheet.test.ts +488 -488
- package/src/spreadsheet.ts +312 -312
- package/src/static-functions.ts +11 -11
- package/src/subscribe.ts +38 -38
- package/src/summaries.ts +113 -113
- package/src/svgrid-wrapper.types.ts +563 -563
- package/src/svgrid.async-editor-options.test.ts +273 -273
- package/src/svgrid.auto-row-height.test.ts +204 -204
- package/src/svgrid.behavior.test.ts +910 -910
- package/src/svgrid.charting.test.ts +654 -534
- package/src/svgrid.comments-autocomplete.test.ts +127 -127
- package/src/svgrid.context-menu.test.ts +147 -147
- package/src/svgrid.features.test.ts +157 -157
- package/src/svgrid.filter-depth.test.ts +163 -163
- package/src/svgrid.filter-menu-listbox.svelte.test.ts +382 -377
- package/src/svgrid.filter-menu-scroll.test.ts +112 -112
- package/src/svgrid.grand-total.test.ts +188 -188
- package/src/svgrid.group-display-mode.test.ts +171 -171
- package/src/svgrid.group-footers.test.ts +121 -121
- package/src/svgrid.group-pagination.test.ts +153 -153
- package/src/svgrid.new-features.wrapper.test.ts +251 -251
- package/src/svgrid.tree-data.test.ts +186 -186
- package/src/svgrid.wrapper.test.ts +63 -63
- package/src/svgriddropdown.async-panel.svelte.test.ts +195 -195
- package/src/test-setup.ts +62 -62
- package/src/themes/index.ts +288 -288
- package/src/toast-store.svelte.ts +250 -250
- package/src/toast-store.test.ts +147 -147
- package/src/tree-row-model.test.ts +168 -168
- package/src/ui-buttons.test.ts +144 -144
- package/src/ui-inputs.test.ts +118 -118
- package/src/ui-localization.test.ts +113 -113
- package/src/ui-range.test.ts +70 -70
- package/src/ui-selection.test.ts +155 -155
- package/src/ui-tier1.test.ts +142 -142
- package/src/virtual.test.ts +88 -88
- package/src/virtualization/column-virtualizer.test.ts +27 -27
- package/src/virtualization/column-virtualizer.ts +30 -30
- package/src/virtualization/svelte-virtualizer.svelte.ts +26 -26
- package/src/virtualization/types.ts +30 -30
- package/src/virtualization/virtualizer.test.ts +47 -47
- package/src/virtualization/virtualizer.ts +322 -322
- package/dist/cdn/GridMenus-DMihUtma.js +0 -600
- package/dist/cdn/GridMenus-nmNDj1a3.js +0 -601
- package/dist/cdn/SvGridChart-Bs2GIR2Q.js +0 -1202
- package/dist/cdn/SvGridChart-CwhFz7GV.js +0 -1203
- package/dist/cdn/SvGridChartPanel-1WXuStzM.js +0 -561
- package/dist/cdn/SvGridChartPanel-e5_nqNP9.js +0 -585
- package/dist/cdn/chart-i4XcXyHJ.js +0 -1214
|
@@ -0,0 +1,834 @@
|
|
|
1
|
+
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
+
import { B as t, C as n, E as r, F as i, G as a, H as o, L as s, N as c, R as l, U as u, V as d, X as f, Y as p, _ as m, a as h, at as g, d as _, et as v, f as y, ft as b, g as x, h as S, i as C, it as w, k as T, lt as E, nt as D, o as ee, pt as O, st as k, t as te, tt as ne, u as A, ut as re, v as j } from "./disclose-version-Dr7rEVv-.js";
|
|
3
|
+
import { t as ie } from "./SvGridChart-DAb9RbRs.js";
|
|
4
|
+
//#region ../../node_modules/.pnpm/svelte@5.55.9_@typescript-eslint+types@8.67.0/node_modules/svelte/src/transition/index.js
|
|
5
|
+
function M(e) {
|
|
6
|
+
let t = e - 1;
|
|
7
|
+
return t * t * t + 1;
|
|
8
|
+
}
|
|
9
|
+
function N(e) {
|
|
10
|
+
let t = typeof e == "string" && e.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);
|
|
11
|
+
return t ? [parseFloat(t[1]), t[2] || "px"] : [e, "px"];
|
|
12
|
+
}
|
|
13
|
+
function P(e, { delay: t = 0, duration: n = 400, easing: r = M, x: i = 0, y: a = 0, opacity: o = 0 } = {}) {
|
|
14
|
+
let s = getComputedStyle(e), c = +s.opacity, l = s.transform === "none" ? "" : s.transform, u = c * (1 - o), [d, f] = N(i), [p, m] = N(a);
|
|
15
|
+
return {
|
|
16
|
+
delay: t,
|
|
17
|
+
duration: n,
|
|
18
|
+
easing: r,
|
|
19
|
+
css: (e, t) => `
|
|
20
|
+
transform: ${l} translate(${(1 - e) * d}${f}, ${(1 - e) * p}${m});
|
|
21
|
+
opacity: ${c - u * t}`
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region ../../node_modules/.pnpm/svelte@5.55.9_@typescript-eslint+types@8.67.0/node_modules/svelte/src/easing/index.js
|
|
26
|
+
function ae(e) {
|
|
27
|
+
let t = e - 1;
|
|
28
|
+
return t * t * t + 1;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/chart-export.ts
|
|
32
|
+
function F(e) {
|
|
33
|
+
return e instanceof SVGSVGElement ? e : e.querySelector("svg.sv-grid-chart-svg") ?? e.querySelector("svg");
|
|
34
|
+
}
|
|
35
|
+
function I(e, t, n) {
|
|
36
|
+
return getComputedStyle(e).getPropertyValue(t).trim() || n;
|
|
37
|
+
}
|
|
38
|
+
function L(e, t = {}) {
|
|
39
|
+
let n = F(e);
|
|
40
|
+
if (!n) throw Error("chartToSvgString: no <svg> found");
|
|
41
|
+
let r = I(n, "--sg-fg", "#0f172a"), i = I(n, "--sg-muted", "#64748b"), a = I(n, "--sg-border", "#e2e8f0"), o = t.background ?? I(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);
|
|
42
|
+
u.setAttribute("width", String(c)), u.setAttribute("height", String(l)), u.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
43
|
+
let d = [
|
|
44
|
+
"fill",
|
|
45
|
+
"fill-opacity",
|
|
46
|
+
"stroke",
|
|
47
|
+
"stroke-width",
|
|
48
|
+
"stroke-opacity",
|
|
49
|
+
"stroke-dasharray",
|
|
50
|
+
"stroke-linecap",
|
|
51
|
+
"stroke-linejoin",
|
|
52
|
+
"opacity",
|
|
53
|
+
"font-size",
|
|
54
|
+
"font-family",
|
|
55
|
+
"font-weight",
|
|
56
|
+
"text-anchor"
|
|
57
|
+
], f = n.querySelectorAll("*"), p = u.querySelectorAll("*");
|
|
58
|
+
for (let e = 0; e < f.length; e += 1) {
|
|
59
|
+
let t = p[e];
|
|
60
|
+
if (!t || !t.style) continue;
|
|
61
|
+
let n = getComputedStyle(f[e]);
|
|
62
|
+
for (let e of d) {
|
|
63
|
+
let r = n.getPropertyValue(e);
|
|
64
|
+
r && r !== "normal" && t.style.setProperty(e, r);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
u.querySelectorAll(".sv-grid-chart-hit").forEach((e) => e.remove());
|
|
68
|
+
let m = document.createElementNS("http://www.w3.org/2000/svg", "style");
|
|
69
|
+
m.textContent = `
|
|
70
|
+
.sv-grid-chart-axis { fill: ${i}; font-size: 10px; font-family: sans-serif; }
|
|
71
|
+
.sv-grid-chart-gridline { stroke: ${a}; stroke-width: 1; opacity: 0.6; }
|
|
72
|
+
.sv-grid-chart-gridline.is-zero { stroke: ${i}; opacity: 0.9; }
|
|
73
|
+
.sv-grid-chart-datalabel { fill: ${r}; font-size: 9.5px; font-weight: 600; font-family: sans-serif; }
|
|
74
|
+
.sv-grid-chart-datalabel.on-bar { fill: #fff; }
|
|
75
|
+
.sv-grid-chart-donut-total { fill: ${r}; font-size: 16px; font-weight: 800; font-family: sans-serif; }
|
|
76
|
+
.sv-grid-chart-donut-label { fill: ${i}; font-size: 10px; font-family: sans-serif; }
|
|
77
|
+
`, u.insertBefore(m, u.firstChild);
|
|
78
|
+
let h = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
79
|
+
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);
|
|
80
|
+
}
|
|
81
|
+
function R(e, t) {
|
|
82
|
+
let n = document.createElement("a");
|
|
83
|
+
n.href = e, n.download = t, document.body.appendChild(n), n.click(), n.remove();
|
|
84
|
+
}
|
|
85
|
+
function oe(e, t = "chart.svg", n = {}) {
|
|
86
|
+
let r = L(e, n), i = URL.createObjectURL(new Blob([r], { type: "image/svg+xml" }));
|
|
87
|
+
R(i, t), setTimeout(() => URL.revokeObjectURL(i), 1e3);
|
|
88
|
+
}
|
|
89
|
+
function se(e, t = {}) {
|
|
90
|
+
let n = L(e, t), r = t.scale ?? 2, i = F(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;
|
|
91
|
+
return new Promise((e, t) => {
|
|
92
|
+
let r = URL.createObjectURL(new Blob([n], { type: "image/svg+xml" })), i = new Image();
|
|
93
|
+
i.onload = () => {
|
|
94
|
+
let n = document.createElement("canvas");
|
|
95
|
+
n.width = Math.round(o), n.height = Math.round(s);
|
|
96
|
+
let a = n.getContext("2d");
|
|
97
|
+
if (!a) {
|
|
98
|
+
URL.revokeObjectURL(r), t(/* @__PURE__ */ Error("canvas 2d context unavailable"));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
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");
|
|
102
|
+
}, i.onerror = () => {
|
|
103
|
+
URL.revokeObjectURL(r), t(/* @__PURE__ */ Error("failed to rasterize chart SVG"));
|
|
104
|
+
}, i.src = r;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
async function z(e, t = "chart.png", n = {}) {
|
|
108
|
+
let r = await se(e, n), i = URL.createObjectURL(r);
|
|
109
|
+
R(i, t), setTimeout(() => URL.revokeObjectURL(i), 1e3);
|
|
110
|
+
}
|
|
111
|
+
var B = (e) => {
|
|
112
|
+
let t = e == null ? "" : String(e);
|
|
113
|
+
return /[",\n]/.test(t) ? `"${t.replace(/"/g, "\"\"")}"` : t;
|
|
114
|
+
};
|
|
115
|
+
function V(e) {
|
|
116
|
+
let t = e.series ?? [];
|
|
117
|
+
if (t.some((e) => e.points?.length)) {
|
|
118
|
+
let e = [
|
|
119
|
+
"Series",
|
|
120
|
+
"X",
|
|
121
|
+
"Y",
|
|
122
|
+
"Size",
|
|
123
|
+
"Label"
|
|
124
|
+
].map(B).join(","), n = [];
|
|
125
|
+
for (let e of t) for (let t of e.points ?? []) n.push([
|
|
126
|
+
e.label,
|
|
127
|
+
t.x,
|
|
128
|
+
t.y,
|
|
129
|
+
t.r ?? "",
|
|
130
|
+
t.label ?? ""
|
|
131
|
+
].map(B).join(","));
|
|
132
|
+
return n.length ? [e, ...n].join("\n") : "";
|
|
133
|
+
}
|
|
134
|
+
let n = e.categories ?? [];
|
|
135
|
+
if (!n.length || !t.length) return "";
|
|
136
|
+
let r = ["Category"];
|
|
137
|
+
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);
|
|
138
|
+
let i = n.map((e, n) => {
|
|
139
|
+
let r = [e];
|
|
140
|
+
for (let e of t) if (e.ohlc) {
|
|
141
|
+
let t = e.ohlc[n];
|
|
142
|
+
r.push(t?.o ?? "", t?.h ?? "", t?.l ?? "", t?.c ?? "");
|
|
143
|
+
} else if (e.boxes) {
|
|
144
|
+
let t = e.boxes[n];
|
|
145
|
+
r.push(t?.min ?? "", t?.q1 ?? "", t?.median ?? "", t?.q3 ?? "", t?.max ?? "", t?.outliers?.join(" ") ?? "");
|
|
146
|
+
} else if (e.errors) {
|
|
147
|
+
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);
|
|
148
|
+
r.push(t ?? "", a, o);
|
|
149
|
+
} else r.push(e.values[n] ?? "");
|
|
150
|
+
return r.map(B).join(",");
|
|
151
|
+
});
|
|
152
|
+
return [r.map(B).join(","), ...i].join("\n");
|
|
153
|
+
}
|
|
154
|
+
function H(e) {
|
|
155
|
+
let t = e.series ?? [];
|
|
156
|
+
return t.some((e) => e.points?.length) ? !0 : !!(e.categories?.length && t.length);
|
|
157
|
+
}
|
|
158
|
+
function ce(e, t = "chart.csv") {
|
|
159
|
+
let n = V(e);
|
|
160
|
+
if (!n) return !1;
|
|
161
|
+
let r = URL.createObjectURL(new Blob([n], { type: "text/csv;charset=utf-8" }));
|
|
162
|
+
return R(r, t), setTimeout(() => URL.revokeObjectURL(r), 1e3), !0;
|
|
163
|
+
}
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/SvGridChartPanel.svelte
|
|
166
|
+
var U = /* @__PURE__ */ e({ default: () => W }), le = s("<div role=\"separator\" aria-label=\"Resize chart panel\"></div>"), ue = s("<button type=\"button\" class=\"sv-grid-chart-btn\">Clear filter</button>"), de = l("<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>"), fe = l("<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>"), pe = s("<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>"), me = s("<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>"), he = s("<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>"), ge = l("<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>"), _e = l("<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>"), ve = s("<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), ye = s("<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>"), be = s("<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>"), xe = s("<div class=\"sv-grid-chart-tabs\" role=\"tablist\" aria-label=\"Charts\"></div>"), Se = s("<p class=\"sv-grid-chart-ai-msg is-error\"> </p>"), Ce = s("<p class=\"sv-grid-chart-ai-msg\"> </p>"), we = s("<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>"), Te = s("<option> </option>"), Ee = s("<optgroup></optgroup>"), De = s("<option> </option>"), Oe = s("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\"> </span> <select></select></label>"), ke = s("<option> </option>"), Ae = s("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\"> </span> <select><option>(none)</option><!></select></label>"), je = s("<option> </option>"), Me = s("<option> </option>"), Ne = s("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\">Y</span> <select></select></label>"), Pe = s("<option> </option>"), Fe = s("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\">Aggregate</span> <select></select></label>"), Ie = s("<option> </option>"), Le = s("<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), Re = s("<label class=\"sv-grid-chart-toggle\" title=\"Bars grow rightwards - suits long category labels\"><input type=\"checkbox\"/> Horizontal</label>"), ze = s("<label class=\"sv-grid-chart-toggle\"><input type=\"checkbox\"/> Donut</label>"), Be = s("<option> </option>"), Ve = s("<label class=\"sv-grid-chart-toggle\"><input type=\"checkbox\"/> Labels</label>"), He = s("<label class=\"sv-grid-chart-toggle\" title=\"Logarithmic value axis - flattens wide-range data\"><input type=\"checkbox\"/> Log scale</label>"), Ue = s("<label class=\"sv-grid-chart-toggle\" title=\"Space points by actual date - real time ticks and proportional gaps\"><input type=\"checkbox\"/> Date axis</label>"), We = s("<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), Ge = s("<p class=\"sv-grid-chart-hint\" role=\"note\"> </p>"), Ke = s("<p class=\"sv-grid-chart-empty\"><!></p>"), qe = s("<div class=\"sv-grid-chart-float-resizer\" role=\"separator\" aria-label=\"Resize chart window\"></div>"), Je = s("<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>");
|
|
167
|
+
function W(e, s) {
|
|
168
|
+
re(s, !0);
|
|
169
|
+
let l = te(s, "ctrl", 7), d = k(() => l().chartingConfig), M = k(() => l().chartCfg), N = k(() => l().chartIsCustom), F = k(() => a(d)?.position ?? "bottom"), I = k(() => a(d)?.crossFilter !== !1), L = k(() => l().chartSpec), R = k(() => l().chartableColumns), B = k(() => l().chartSize ?? (a(F) === "right" ? a(d)?.width ?? 340 : a(d)?.height ?? 260)), V = k(() => l().chartFloating), U = k(() => l().chartMaximized), W = k(() => l().chartFloatRect), Ye = g(null);
|
|
170
|
+
function Xe() {
|
|
171
|
+
let e = a(Ye)?.offsetParent;
|
|
172
|
+
return {
|
|
173
|
+
w: e?.clientWidth ?? 800,
|
|
174
|
+
h: e?.clientHeight ?? 520
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function Ze() {
|
|
178
|
+
if (!l().chartFloatRect) {
|
|
179
|
+
let { w: e, h: t } = Xe(), n = Math.min(600, Math.max(360, e - 80)), r = Math.min(430, Math.max(260, t - 90));
|
|
180
|
+
l().chartFloatRect = {
|
|
181
|
+
x: Math.round((e - n) / 2),
|
|
182
|
+
y: Math.round((t - r) / 2),
|
|
183
|
+
w: n,
|
|
184
|
+
h: r
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
l().chartFloating = !0;
|
|
188
|
+
}
|
|
189
|
+
function Qe() {
|
|
190
|
+
l().chartFloating = !1, l().chartMaximized = !1;
|
|
191
|
+
}
|
|
192
|
+
let $e = () => l().chartMaximized = !l().chartMaximized;
|
|
193
|
+
function et(e) {
|
|
194
|
+
if (!a(V) || a(U) || e.target?.closest("button")) return;
|
|
195
|
+
let t = l().chartFloatRect;
|
|
196
|
+
if (!t) return;
|
|
197
|
+
e.preventDefault();
|
|
198
|
+
let n = e.clientX, r = e.clientY, { w: i, h: o } = Xe(), s = (e) => {
|
|
199
|
+
let a = Math.max(0, Math.min(i - t.w, t.x + e.clientX - n)), s = Math.max(0, Math.min(o - t.h, t.y + e.clientY - r));
|
|
200
|
+
l().chartFloatRect = {
|
|
201
|
+
x: a,
|
|
202
|
+
y: s,
|
|
203
|
+
w: t.w,
|
|
204
|
+
h: t.h
|
|
205
|
+
};
|
|
206
|
+
}, c = () => {
|
|
207
|
+
window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", c);
|
|
208
|
+
};
|
|
209
|
+
window.addEventListener("pointermove", s), window.addEventListener("pointerup", c);
|
|
210
|
+
}
|
|
211
|
+
function tt(e) {
|
|
212
|
+
let t = l().chartFloatRect;
|
|
213
|
+
if (!t) return;
|
|
214
|
+
e.preventDefault(), e.stopPropagation();
|
|
215
|
+
let n = e.clientX, r = e.clientY;
|
|
216
|
+
e.target.setPointerCapture?.(e.pointerId);
|
|
217
|
+
let i = (e) => {
|
|
218
|
+
l().chartFloatRect = {
|
|
219
|
+
x: t.x,
|
|
220
|
+
y: t.y,
|
|
221
|
+
w: Math.max(300, t.w + e.clientX - n),
|
|
222
|
+
h: Math.max(220, t.h + e.clientY - r)
|
|
223
|
+
};
|
|
224
|
+
}, a = () => {
|
|
225
|
+
window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a);
|
|
226
|
+
};
|
|
227
|
+
window.addEventListener("pointermove", i), window.addEventListener("pointerup", a);
|
|
228
|
+
}
|
|
229
|
+
let nt = k(() => a(V) ? a(U) ? "left:12px; top:12px; right:12px; bottom:12px; width:auto; height:auto;" : a(W) ? `left:${a(W).x}px; top:${a(W).y}px; width:${a(W).w}px; height:${a(W).h}px;` : "" : a(F) === "right" ? `width:${a(B)}px` : `height:${a(B)}px`), rt = g(0), it = g(0), at = k(() => a(L) ? a(L).type === "pie" ? a(L).categories.length : a(L).series.length : 0), ot = k(() => (a(at) > 1 ? 36 : 0) + (a(M)?.export === !0 ? 30 : 0)), st = k(() => a(rt) > 24 ? a(rt) - 8 : void 0), ct = k(() => a(it) > 24 ? Math.max(120, a(it) - 8 - a(ot)) : void 0), lt = [
|
|
230
|
+
{
|
|
231
|
+
value: "bar",
|
|
232
|
+
label: "Bar",
|
|
233
|
+
group: "Compare"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
value: "line",
|
|
237
|
+
label: "Line",
|
|
238
|
+
group: "Compare"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
value: "area",
|
|
242
|
+
label: "Area",
|
|
243
|
+
group: "Compare"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
value: "pie",
|
|
247
|
+
label: "Pie",
|
|
248
|
+
group: "Part of a whole"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
value: "treemap",
|
|
252
|
+
label: "Tree map",
|
|
253
|
+
group: "Part of a whole"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
value: "funnel",
|
|
257
|
+
label: "Funnel",
|
|
258
|
+
group: "Flow"
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
value: "waterfall",
|
|
262
|
+
label: "Waterfall",
|
|
263
|
+
group: "Flow"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
value: "sankey",
|
|
267
|
+
label: "Sankey",
|
|
268
|
+
group: "Flow",
|
|
269
|
+
needs: (e) => e.dims.length >= 2
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
value: "radar",
|
|
273
|
+
label: "Radar",
|
|
274
|
+
group: "Distribution"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
value: "heatmap",
|
|
278
|
+
label: "Heat map",
|
|
279
|
+
group: "Distribution",
|
|
280
|
+
needs: (e) => e.dims.length >= 2
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
value: "scatter",
|
|
284
|
+
label: "Scatter",
|
|
285
|
+
group: "Distribution",
|
|
286
|
+
needs: (e) => e.measures.length >= 2
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
value: "boxplot",
|
|
290
|
+
label: "Box plot",
|
|
291
|
+
group: "Distribution"
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
value: "gauge",
|
|
295
|
+
label: "Gauge",
|
|
296
|
+
group: "Single value"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
value: "calendar",
|
|
300
|
+
label: "Calendar",
|
|
301
|
+
group: "Over time",
|
|
302
|
+
needs: (e) => e.dates.length >= 1
|
|
303
|
+
}
|
|
304
|
+
], ut = k(() => lt.filter((e) => !e.needs || e.needs(a(R)))), dt = [
|
|
305
|
+
"bar",
|
|
306
|
+
"line",
|
|
307
|
+
"area"
|
|
308
|
+
], ft = [
|
|
309
|
+
{
|
|
310
|
+
key: "theme",
|
|
311
|
+
label: "Theme",
|
|
312
|
+
colors: null
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
key: "ocean",
|
|
316
|
+
label: "Ocean",
|
|
317
|
+
colors: [
|
|
318
|
+
"#0ea5e9",
|
|
319
|
+
"#14b8a6",
|
|
320
|
+
"#6366f1",
|
|
321
|
+
"#8b5cf6",
|
|
322
|
+
"#06b6d4"
|
|
323
|
+
]
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
key: "sunset",
|
|
327
|
+
label: "Sunset",
|
|
328
|
+
colors: [
|
|
329
|
+
"#f59e0b",
|
|
330
|
+
"#ef4444",
|
|
331
|
+
"#ec4899",
|
|
332
|
+
"#8b5cf6",
|
|
333
|
+
"#f97316"
|
|
334
|
+
]
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
key: "forest",
|
|
338
|
+
label: "Forest",
|
|
339
|
+
colors: [
|
|
340
|
+
"#16a34a",
|
|
341
|
+
"#65a30d",
|
|
342
|
+
"#0d9488",
|
|
343
|
+
"#4d7c0f",
|
|
344
|
+
"#0891b2"
|
|
345
|
+
]
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
key: "slate",
|
|
349
|
+
label: "Slate",
|
|
350
|
+
colors: [
|
|
351
|
+
"#475569",
|
|
352
|
+
"#0ea5e9",
|
|
353
|
+
"#64748b",
|
|
354
|
+
"#38bdf8",
|
|
355
|
+
"#94a3b8"
|
|
356
|
+
]
|
|
357
|
+
}
|
|
358
|
+
], pt = k(() => ft.find((e) => e.colors && l().chartPalette && e.colors.join() === l().chartPalette.join())?.key ?? "theme"), mt = k(() => l().chartType === "bar"), ht = k(() => l().chartType === "pie"), gt = k(() => l().chartType !== "gauge"), _t = k(() => a(R).dims.length > 1 && ![
|
|
359
|
+
"pie",
|
|
360
|
+
"gauge",
|
|
361
|
+
"waterfall",
|
|
362
|
+
"funnel",
|
|
363
|
+
"calendar"
|
|
364
|
+
].includes(l().chartType)), vt = k(() => dt.includes(l().chartType)), yt = k(() => dt.includes(l().chartType) || l().chartType === "scatter" || l().chartType === "boxplot"), bt = k(() => ![
|
|
365
|
+
"gauge",
|
|
366
|
+
"sankey",
|
|
367
|
+
"calendar",
|
|
368
|
+
"treemap",
|
|
369
|
+
"scatter",
|
|
370
|
+
"boxplot"
|
|
371
|
+
].includes(l().chartType)), xt = k(() => l().chartType === "scatter"), St = k(() => !a(xt) && l().chartType !== "boxplot"), Ct = k(() => [...new Set(a(ut).map((e) => e.group))]), wt = k(() => {
|
|
372
|
+
let e = l().chartType, t = l().chartSpec?.categories.length ?? 0;
|
|
373
|
+
return e === "heatmap" && !l().chartSeriesId && a(R).dims.length > 1 ? "Heat map needs a Split by column for its rows." : e === "sankey" && !l().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;
|
|
374
|
+
}), Tt = [
|
|
375
|
+
{
|
|
376
|
+
value: "sum",
|
|
377
|
+
label: "Sum"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
value: "avg",
|
|
381
|
+
label: "Average"
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
value: "count",
|
|
385
|
+
label: "Count"
|
|
386
|
+
}
|
|
387
|
+
], Et = [
|
|
388
|
+
{
|
|
389
|
+
value: "number",
|
|
390
|
+
label: "Number"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
value: "currency",
|
|
394
|
+
label: "Currency"
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
value: "percent",
|
|
398
|
+
label: "Percent"
|
|
399
|
+
}
|
|
400
|
+
];
|
|
401
|
+
function Dt(e) {
|
|
402
|
+
a(I) && e.category != null && l().applyChartCrossFilter(String(e.category));
|
|
403
|
+
}
|
|
404
|
+
let Ot = g(null), G = g(!1), kt = g(!1), At = () => a(Ot)?.querySelector("svg") ?? null, jt = k(() => !!a(L) && H(a(L)));
|
|
405
|
+
function Mt() {
|
|
406
|
+
let e = At();
|
|
407
|
+
e && z(e, "chart.png"), w(G, !1);
|
|
408
|
+
}
|
|
409
|
+
function Nt() {
|
|
410
|
+
let e = At();
|
|
411
|
+
e && oe(e, "chart.svg"), w(G, !1);
|
|
412
|
+
}
|
|
413
|
+
function Pt() {
|
|
414
|
+
a(L) && ce(a(L), "chart.csv"), w(G, !1);
|
|
415
|
+
}
|
|
416
|
+
async function Ft() {
|
|
417
|
+
let e = At();
|
|
418
|
+
if (w(G, !1), !(!e || typeof ClipboardItem > "u" || !navigator.clipboard?.write)) try {
|
|
419
|
+
let t = await se(e);
|
|
420
|
+
await navigator.clipboard.write([new ClipboardItem({ "image/png": t })]), w(kt, !0), setTimeout(() => w(kt, !1), 1400);
|
|
421
|
+
} catch {}
|
|
422
|
+
}
|
|
423
|
+
f(() => {
|
|
424
|
+
if (!a(G)) return;
|
|
425
|
+
let e = (e) => {
|
|
426
|
+
e.target?.closest(".sv-grid-chart-export") || w(G, !1);
|
|
427
|
+
};
|
|
428
|
+
return window.addEventListener("pointerdown", e), () => window.removeEventListener("pointerdown", e);
|
|
429
|
+
});
|
|
430
|
+
let It = k(() => !!l().chartAiHandler), K = g(!1), q = g(""), J = g(!1), Y = g(""), Lt = g("");
|
|
431
|
+
async function Rt() {
|
|
432
|
+
let e = l().chartAiHandler, t = a(q).trim();
|
|
433
|
+
if (!(!e || !t || a(J))) {
|
|
434
|
+
w(J, !0), w(Y, ""), w(Lt, "");
|
|
435
|
+
try {
|
|
436
|
+
let n = await e(t);
|
|
437
|
+
n ? (l().applyChartConfig(n), w(Lt, typeof n.rationale == "string" ? n.rationale : "", !0)) : w(Y, "Couldn't build a chart from that request.");
|
|
438
|
+
} catch (e) {
|
|
439
|
+
w(Y, e instanceof Error ? e.message : "Something went wrong.", !0);
|
|
440
|
+
} finally {
|
|
441
|
+
w(J, !1);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
let zt = g(!1);
|
|
446
|
+
function Bt(e) {
|
|
447
|
+
e.preventDefault(), w(zt, !0);
|
|
448
|
+
let t = a(F) === "right" ? e.clientX : e.clientY, n = a(B);
|
|
449
|
+
e.target.setPointerCapture?.(e.pointerId);
|
|
450
|
+
let r = (e) => {
|
|
451
|
+
let r = a(F) === "right" ? t - e.clientX : t - e.clientY;
|
|
452
|
+
l().chartSize = Math.max(160, Math.min(720, n + r));
|
|
453
|
+
}, i = () => {
|
|
454
|
+
w(zt, !1), window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", i);
|
|
455
|
+
};
|
|
456
|
+
window.addEventListener("pointermove", r), window.addEventListener("pointerup", i);
|
|
457
|
+
}
|
|
458
|
+
var X = Je();
|
|
459
|
+
let Vt;
|
|
460
|
+
var Ht = v(X), Ut = (e) => {
|
|
461
|
+
var t = le();
|
|
462
|
+
let n;
|
|
463
|
+
p(() => {
|
|
464
|
+
n = j(t, 1, "sv-grid-chart-resizer", null, n, { "is-dragging": a(zt) }), _(t, "aria-orientation", a(F) === "right" ? "vertical" : "horizontal");
|
|
465
|
+
}), o("pointerdown", t, Bt), i(e, t);
|
|
466
|
+
};
|
|
467
|
+
T(Ht, (e) => {
|
|
468
|
+
a(V) || e(Ut);
|
|
469
|
+
});
|
|
470
|
+
var Wt = D(Ht, 2), Z = v(Wt);
|
|
471
|
+
let Gt;
|
|
472
|
+
var Kt = D(v(Z), 4), qt = v(Kt), Jt = (e) => {
|
|
473
|
+
var t = ue();
|
|
474
|
+
o("click", t, () => l().clearChartCrossFilter()), i(e, t);
|
|
475
|
+
};
|
|
476
|
+
T(qt, (e) => {
|
|
477
|
+
a(I) && !a(N) && e(Jt);
|
|
478
|
+
});
|
|
479
|
+
var Yt = D(qt, 2), Q = v(Yt), Xt = v(Q), Zt = (e) => {
|
|
480
|
+
var t = de();
|
|
481
|
+
i(e, t);
|
|
482
|
+
}, Qt = (e) => {
|
|
483
|
+
var t = fe();
|
|
484
|
+
i(e, t);
|
|
485
|
+
};
|
|
486
|
+
T(Xt, (e) => {
|
|
487
|
+
a(kt) ? e(Zt) : e(Qt, -1);
|
|
488
|
+
}), O(Q);
|
|
489
|
+
var $t = D(Q, 2), en = (e) => {
|
|
490
|
+
var t = pe(), n = v(t), r = D(n, 2), s = D(r, 2), c = D(s, 2);
|
|
491
|
+
O(t), p(() => s.disabled = !a(jt)), o("click", n, Mt), o("click", r, Nt), o("click", s, Pt), o("click", c, Ft), i(e, t);
|
|
492
|
+
};
|
|
493
|
+
T($t, (e) => {
|
|
494
|
+
a(G) && e(en);
|
|
495
|
+
}), O(Yt);
|
|
496
|
+
var tn = D(Yt, 2), nn = (e) => {
|
|
497
|
+
var t = me();
|
|
498
|
+
let n;
|
|
499
|
+
p(() => {
|
|
500
|
+
n = j(t, 1, "sv-grid-chart-btn sv-grid-chart-ai-btn", null, n, { "is-active": a(K) }), _(t, "aria-expanded", a(K));
|
|
501
|
+
}), o("click", t, () => w(K, !a(K))), i(e, t);
|
|
502
|
+
};
|
|
503
|
+
T(tn, (e) => {
|
|
504
|
+
a(It) && !a(N) && e(nn);
|
|
505
|
+
});
|
|
506
|
+
var rn = D(tn, 2), an = (e) => {
|
|
507
|
+
var t = he();
|
|
508
|
+
o("click", t, () => l().addChart()), i(e, t);
|
|
509
|
+
};
|
|
510
|
+
T(rn, (e) => {
|
|
511
|
+
a(N) || e(an);
|
|
512
|
+
});
|
|
513
|
+
var on = D(rn, 2), sn = (e) => {
|
|
514
|
+
var t = ve(), n = ne(t), r = v(n), s = (e) => {
|
|
515
|
+
var t = ge();
|
|
516
|
+
i(e, t);
|
|
517
|
+
}, c = (e) => {
|
|
518
|
+
var t = _e();
|
|
519
|
+
i(e, t);
|
|
520
|
+
};
|
|
521
|
+
T(r, (e) => {
|
|
522
|
+
a(U) ? e(s) : e(c, -1);
|
|
523
|
+
}), O(n);
|
|
524
|
+
var l = D(n, 2);
|
|
525
|
+
p(() => {
|
|
526
|
+
_(n, "aria-label", a(U) ? "Restore" : "Maximize"), _(n, "title", a(U) ? "Restore" : "Maximize");
|
|
527
|
+
}), o("click", n, $e), o("click", l, Qe), i(e, t);
|
|
528
|
+
}, cn = (e) => {
|
|
529
|
+
var t = ye();
|
|
530
|
+
o("click", t, Ze), i(e, t);
|
|
531
|
+
};
|
|
532
|
+
T(on, (e) => {
|
|
533
|
+
a(V) ? e(sn) : e(cn, -1);
|
|
534
|
+
});
|
|
535
|
+
var ln = D(on, 2);
|
|
536
|
+
O(Kt), O(Z);
|
|
537
|
+
var un = D(Z, 2), dn = (e) => {
|
|
538
|
+
var t = xe();
|
|
539
|
+
r(t, 23, () => l().charts, (e) => e.id, (e, t, n) => {
|
|
540
|
+
var r = be();
|
|
541
|
+
let s;
|
|
542
|
+
var u = v(r), d = v(u, !0);
|
|
543
|
+
O(u);
|
|
544
|
+
var f = D(u, 2);
|
|
545
|
+
O(r), p(() => {
|
|
546
|
+
s = j(r, 1, "sv-grid-chart-tab", null, s, { "is-active": a(n) === l().activeChartIndex }), _(u, "aria-selected", a(n) === l().activeChartIndex), c(d, a(t).title), _(f, "aria-label", `Remove ${a(t).title}`);
|
|
547
|
+
}), o("click", u, () => l().activeChartIndex = a(n)), o("click", f, () => l().removeChart(a(n))), i(e, r);
|
|
548
|
+
}), O(t), i(e, t);
|
|
549
|
+
};
|
|
550
|
+
T(un, (e) => {
|
|
551
|
+
!a(N) && l().charts.length > 1 && e(dn);
|
|
552
|
+
});
|
|
553
|
+
var fn = D(un, 2), pn = (e) => {
|
|
554
|
+
var t = we(), n = v(t), r = v(n);
|
|
555
|
+
A(r);
|
|
556
|
+
var o = D(r, 2), s = v(o, !0);
|
|
557
|
+
O(o), O(n);
|
|
558
|
+
var l = D(n, 2), d = (e) => {
|
|
559
|
+
var t = Se(), n = v(t, !0);
|
|
560
|
+
O(t), p(() => c(n, a(Y))), i(e, t);
|
|
561
|
+
}, f = (e) => {
|
|
562
|
+
var t = Ce(), n = v(t, !0);
|
|
563
|
+
O(t), p(() => c(n, a(Lt))), i(e, t);
|
|
564
|
+
};
|
|
565
|
+
T(l, (e) => {
|
|
566
|
+
a(Y) ? e(d) : a(Lt) && e(f, 1);
|
|
567
|
+
}), O(t), p((e) => {
|
|
568
|
+
r.disabled = a(J), o.disabled = e, c(s, a(J) ? "Thinking..." : "Chart it");
|
|
569
|
+
}, [() => a(J) || !a(q).trim()]), u("submit", n, (e) => {
|
|
570
|
+
e.preventDefault(), Rt();
|
|
571
|
+
}), ee(r, () => a(q), (e) => w(q, e)), i(e, t);
|
|
572
|
+
};
|
|
573
|
+
T(fn, (e) => {
|
|
574
|
+
a(It) && a(K) && !a(N) && e(pn);
|
|
575
|
+
});
|
|
576
|
+
var mn = D(fn, 2), hn = v(mn), gn = (e) => {
|
|
577
|
+
var t = We(), n = ne(t), s = D(v(n), 2);
|
|
578
|
+
r(s, 20, () => a(Ct), (e) => e, (e, t) => {
|
|
579
|
+
var n = Ee();
|
|
580
|
+
r(n, 21, () => a(ut).filter((e) => e.group === t), (e) => e.value, (e, t) => {
|
|
581
|
+
var n = Te(), r = v(n, !0);
|
|
582
|
+
O(n);
|
|
583
|
+
var o = {};
|
|
584
|
+
p(() => {
|
|
585
|
+
c(r, a(t).label), o !== (o = a(t).value) && (n.value = (n.__value = a(t).value) ?? "");
|
|
586
|
+
}), i(e, n);
|
|
587
|
+
}), O(n), p(() => _(n, "label", t)), i(e, n);
|
|
588
|
+
}), O(s);
|
|
589
|
+
var u;
|
|
590
|
+
S(s), O(n);
|
|
591
|
+
var d = D(n, 2), f = (e) => {
|
|
592
|
+
var t = Oe(), n = v(t), s = v(n, !0);
|
|
593
|
+
O(n);
|
|
594
|
+
var u = D(n, 2);
|
|
595
|
+
r(u, 21, () => a(R).dims, (e) => e.id, (e, t) => {
|
|
596
|
+
var n = De(), r = v(n, !0);
|
|
597
|
+
O(n);
|
|
598
|
+
var o = {};
|
|
599
|
+
p(() => {
|
|
600
|
+
c(r, a(t).label), o !== (o = a(t).id) && (n.value = (n.__value = a(t).id) ?? "");
|
|
601
|
+
}), i(e, n);
|
|
602
|
+
}), O(u);
|
|
603
|
+
var d;
|
|
604
|
+
S(u), O(t), p(() => {
|
|
605
|
+
c(s, l().chartType === "sankey" ? "From" : l().chartType === "heatmap" ? "Columns" : "Group by"), d !== (d = l().chartDimensionId ?? "") && (u.value = (u.__value = l().chartDimensionId ?? "") ?? "", x(u, l().chartDimensionId ?? ""));
|
|
606
|
+
}), o("change", u, (e) => l().chartDimensionId = e.currentTarget.value || null), i(e, t);
|
|
607
|
+
};
|
|
608
|
+
T(d, (e) => {
|
|
609
|
+
a(gt) && e(f);
|
|
610
|
+
});
|
|
611
|
+
var m = D(d, 2), h = (e) => {
|
|
612
|
+
var t = Ae(), n = v(t), s = v(n, !0);
|
|
613
|
+
O(n);
|
|
614
|
+
var u = D(n, 2), d = v(u);
|
|
615
|
+
d.value = d.__value = "";
|
|
616
|
+
var f = D(d);
|
|
617
|
+
r(f, 17, () => a(R).dims, (e) => e.id, (e, t) => {
|
|
618
|
+
var n = ke(), r = v(n, !0);
|
|
619
|
+
O(n);
|
|
620
|
+
var o = {};
|
|
621
|
+
p(() => {
|
|
622
|
+
c(r, a(t).label), o !== (o = a(t).id) && (n.value = (n.__value = a(t).id) ?? "");
|
|
623
|
+
}), i(e, n);
|
|
624
|
+
}), O(u);
|
|
625
|
+
var m;
|
|
626
|
+
S(u), O(t), p(() => {
|
|
627
|
+
c(s, l().chartType === "sankey" ? "To" : l().chartType === "heatmap" ? "Rows" : "Split by"), m !== (m = l().chartSeriesId ?? "") && (u.value = (u.__value = l().chartSeriesId ?? "") ?? "", x(u, l().chartSeriesId ?? ""));
|
|
628
|
+
}), o("change", u, (e) => l().chartSeriesId = e.currentTarget.value || null), i(e, t);
|
|
629
|
+
};
|
|
630
|
+
T(m, (e) => {
|
|
631
|
+
a(_t) && e(h);
|
|
632
|
+
});
|
|
633
|
+
var g = D(m, 2), C = v(g), w = v(C, !0);
|
|
634
|
+
O(C);
|
|
635
|
+
var E = D(C, 2);
|
|
636
|
+
r(E, 21, () => a(R).measures, (e) => e.id, (e, t) => {
|
|
637
|
+
var n = je(), r = v(n, !0);
|
|
638
|
+
O(n);
|
|
639
|
+
var o = {};
|
|
640
|
+
p(() => {
|
|
641
|
+
c(r, a(t).label), o !== (o = a(t).id) && (n.value = (n.__value = a(t).id) ?? "");
|
|
642
|
+
}), i(e, n);
|
|
643
|
+
}), O(E);
|
|
644
|
+
var ee;
|
|
645
|
+
S(E), O(g);
|
|
646
|
+
var te = D(g, 2), re = (e) => {
|
|
647
|
+
var t = Ne(), n = D(v(t), 2);
|
|
648
|
+
r(n, 21, () => a(R).measures, (e) => e.id, (e, t) => {
|
|
649
|
+
var n = Me(), r = v(n, !0);
|
|
650
|
+
O(n);
|
|
651
|
+
var o = {};
|
|
652
|
+
p(() => {
|
|
653
|
+
c(r, a(t).label), o !== (o = a(t).id) && (n.value = (n.__value = a(t).id) ?? "");
|
|
654
|
+
}), i(e, n);
|
|
655
|
+
}), O(n);
|
|
656
|
+
var s;
|
|
657
|
+
S(n), O(t), p(() => {
|
|
658
|
+
s !== (s = l().effectiveChartMeasure2Id ?? "") && (n.value = (n.__value = l().effectiveChartMeasure2Id ?? "") ?? "", x(n, l().effectiveChartMeasure2Id ?? ""));
|
|
659
|
+
}), o("change", n, (e) => l().chartMeasure2Id = e.currentTarget.value || null), i(e, t);
|
|
660
|
+
};
|
|
661
|
+
T(te, (e) => {
|
|
662
|
+
a(xt) && e(re);
|
|
663
|
+
});
|
|
664
|
+
var j = D(te, 2), ie = (e) => {
|
|
665
|
+
var t = Fe(), n = D(v(t), 2);
|
|
666
|
+
r(n, 21, () => Tt, (e) => e.value, (e, t) => {
|
|
667
|
+
var n = Pe(), r = v(n, !0);
|
|
668
|
+
O(n);
|
|
669
|
+
var o = {};
|
|
670
|
+
p(() => {
|
|
671
|
+
c(r, a(t).label), o !== (o = a(t).value) && (n.value = (n.__value = a(t).value) ?? "");
|
|
672
|
+
}), i(e, n);
|
|
673
|
+
}), O(n);
|
|
674
|
+
var s;
|
|
675
|
+
S(n), O(t), p(() => {
|
|
676
|
+
s !== (s = l().chartReduce) && (n.value = (n.__value = l().chartReduce) ?? "", x(n, l().chartReduce));
|
|
677
|
+
}), o("change", n, (e) => l().chartReduce = e.currentTarget.value), i(e, t);
|
|
678
|
+
};
|
|
679
|
+
T(j, (e) => {
|
|
680
|
+
a(St) && e(ie);
|
|
681
|
+
});
|
|
682
|
+
var M = D(j, 2), N = D(v(M), 2);
|
|
683
|
+
r(N, 21, () => Et, (e) => e.value, (e, t) => {
|
|
684
|
+
var n = Ie(), r = v(n, !0);
|
|
685
|
+
O(n);
|
|
686
|
+
var o = {};
|
|
687
|
+
p(() => {
|
|
688
|
+
c(r, a(t).label), o !== (o = a(t).value) && (n.value = (n.__value = a(t).value) ?? "");
|
|
689
|
+
}), i(e, n);
|
|
690
|
+
}), O(N);
|
|
691
|
+
var P;
|
|
692
|
+
S(N), O(M);
|
|
693
|
+
var ae = D(M, 2), F = (e) => {
|
|
694
|
+
var t = Le(), n = ne(t), r = v(n);
|
|
695
|
+
A(r), b(), O(n);
|
|
696
|
+
var a = D(n, 2), s = v(a);
|
|
697
|
+
A(s), b(), O(a), p(() => {
|
|
698
|
+
y(r, l().chartStacked), y(s, l().chartStacked100);
|
|
699
|
+
}), o("change", r, (e) => l().chartStacked = e.currentTarget.checked), o("change", s, (e) => l().chartStacked100 = e.currentTarget.checked), i(e, t);
|
|
700
|
+
};
|
|
701
|
+
T(ae, (e) => {
|
|
702
|
+
a(vt) && e(F);
|
|
703
|
+
});
|
|
704
|
+
var I = D(ae, 2), L = (e) => {
|
|
705
|
+
var t = Re(), n = v(t);
|
|
706
|
+
A(n), b(), O(t), p(() => y(n, l().chartOrientation === "horizontal")), o("change", n, (e) => l().chartOrientation = e.currentTarget.checked ? "horizontal" : "vertical"), i(e, t);
|
|
707
|
+
};
|
|
708
|
+
T(I, (e) => {
|
|
709
|
+
a(mt) && e(L);
|
|
710
|
+
});
|
|
711
|
+
var oe = D(I, 2), se = (e) => {
|
|
712
|
+
var t = ze(), n = v(t);
|
|
713
|
+
A(n), b(), O(t), p(() => y(n, l().chartDonut)), o("change", n, (e) => l().chartDonut = e.currentTarget.checked), i(e, t);
|
|
714
|
+
};
|
|
715
|
+
T(oe, (e) => {
|
|
716
|
+
a(ht) && e(se);
|
|
717
|
+
});
|
|
718
|
+
var z = D(oe, 2), B = D(v(z), 2);
|
|
719
|
+
r(B, 21, () => ft, (e) => e.key, (e, t) => {
|
|
720
|
+
var n = Be(), r = v(n, !0);
|
|
721
|
+
O(n);
|
|
722
|
+
var o = {};
|
|
723
|
+
p(() => {
|
|
724
|
+
c(r, a(t).label), o !== (o = a(t).key) && (n.value = (n.__value = a(t).key) ?? "");
|
|
725
|
+
}), i(e, n);
|
|
726
|
+
}), O(B);
|
|
727
|
+
var V;
|
|
728
|
+
S(B), O(z);
|
|
729
|
+
var H = D(z, 2), ce = (e) => {
|
|
730
|
+
var t = Ve(), n = v(t);
|
|
731
|
+
A(n), b(), O(t), p(() => y(n, l().chartDataLabels)), o("change", n, (e) => l().chartDataLabels = e.currentTarget.checked), i(e, t);
|
|
732
|
+
};
|
|
733
|
+
T(H, (e) => {
|
|
734
|
+
a(bt) && e(ce);
|
|
735
|
+
});
|
|
736
|
+
var U = D(H, 2), le = (e) => {
|
|
737
|
+
var t = He(), n = v(t);
|
|
738
|
+
A(n), b(), O(t), p(() => y(n, l().chartLogScale)), o("change", n, (e) => l().chartLogScale = e.currentTarget.checked), i(e, t);
|
|
739
|
+
};
|
|
740
|
+
T(U, (e) => {
|
|
741
|
+
a(yt) && e(le);
|
|
742
|
+
});
|
|
743
|
+
var ue = D(U, 2), de = (e) => {
|
|
744
|
+
var t = Ue(), n = v(t);
|
|
745
|
+
A(n), b(), O(t), p(() => y(n, l().chartTimeAxis)), o("change", n, (e) => l().chartTimeAxis = e.currentTarget.checked), i(e, t);
|
|
746
|
+
}, fe = k(() => l().chartDimensionIsDate && dt.includes(l().chartType));
|
|
747
|
+
T(ue, (e) => {
|
|
748
|
+
a(fe) && e(de);
|
|
749
|
+
}), p(() => {
|
|
750
|
+
u !== (u = l().chartType) && (s.value = (s.__value = l().chartType) ?? "", x(s, l().chartType)), c(w, a(xt) ? "X" : l().chartType === "gauge" ? "Metric" : "Value"), ee !== (ee = l().chartMeasureId ?? "") && (E.value = (E.__value = l().chartMeasureId ?? "") ?? "", x(E, l().chartMeasureId ?? "")), P !== (P = l().chartValueFormat) && (N.value = (N.__value = l().chartValueFormat) ?? "", x(N, l().chartValueFormat)), V !== (V = a(pt)) && (B.value = (B.__value = a(pt)) ?? "", x(B, a(pt)));
|
|
751
|
+
}), o("change", s, (e) => l().chartType = e.currentTarget.value), o("change", E, (e) => l().chartMeasureId = e.currentTarget.value || null), o("change", N, (e) => l().chartValueFormat = e.currentTarget.value), o("change", B, (e) => l().chartPalette = ft.find((t) => t.key === e.currentTarget.value)?.colors ?? null), i(e, t);
|
|
752
|
+
};
|
|
753
|
+
T(hn, (e) => {
|
|
754
|
+
a(N) || e(gn);
|
|
755
|
+
});
|
|
756
|
+
var _n = D(hn, 2), vn = (e) => {
|
|
757
|
+
var t = Ge(), n = v(t, !0);
|
|
758
|
+
O(t), p(() => c(n, a(wt))), i(e, t);
|
|
759
|
+
};
|
|
760
|
+
T(_n, (e) => {
|
|
761
|
+
a(wt) && e(vn);
|
|
762
|
+
}), O(mn), O(Wt);
|
|
763
|
+
var $ = D(Wt, 2), yn = v($), bn = (e) => {
|
|
764
|
+
{
|
|
765
|
+
let t = k(() => a(M)?.zoom === !0), n = k(() => a(M)?.brush === !0), r = k(() => a(M)?.export === !0 || void 0);
|
|
766
|
+
ie(e, {
|
|
767
|
+
get spec() {
|
|
768
|
+
return a(L);
|
|
769
|
+
},
|
|
770
|
+
get width() {
|
|
771
|
+
return a(st);
|
|
772
|
+
},
|
|
773
|
+
get height() {
|
|
774
|
+
return a(ct);
|
|
775
|
+
},
|
|
776
|
+
onSelect: Dt,
|
|
777
|
+
interactive: !0,
|
|
778
|
+
legend: !0,
|
|
779
|
+
get dataLabels() {
|
|
780
|
+
return l().chartDataLabels;
|
|
781
|
+
},
|
|
782
|
+
get zoomable() {
|
|
783
|
+
return a(t);
|
|
784
|
+
},
|
|
785
|
+
get brush() {
|
|
786
|
+
return a(n);
|
|
787
|
+
},
|
|
788
|
+
get toolbar() {
|
|
789
|
+
return a(r);
|
|
790
|
+
}
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
}, xn = (e) => {
|
|
794
|
+
var n = Ke(), r = v(n), o = (e) => {
|
|
795
|
+
var n = t("Charting needs at least one text column (to group by) and one numeric column (to measure).");
|
|
796
|
+
i(e, n);
|
|
797
|
+
}, s = (e) => {
|
|
798
|
+
var n = t("No data to chart.");
|
|
799
|
+
i(e, n);
|
|
800
|
+
};
|
|
801
|
+
T(r, (e) => {
|
|
802
|
+
!a(R).dims.length || !a(R).measures.length ? e(o) : e(s, -1);
|
|
803
|
+
}), O(n), i(e, n);
|
|
804
|
+
};
|
|
805
|
+
T(yn, (e) => {
|
|
806
|
+
a(L) && (a(L).series.length || a(L).gaugeValue != null || a(N)) ? e(bn) : e(xn, -1);
|
|
807
|
+
}), O($), C($, (e) => w(Ot, e), () => a(Ot));
|
|
808
|
+
var Sn = D($, 2), Cn = (e) => {
|
|
809
|
+
var t = qe();
|
|
810
|
+
o("pointerdown", t, tt), i(e, t);
|
|
811
|
+
};
|
|
812
|
+
T(Sn, (e) => {
|
|
813
|
+
a(V) && !a(U) && e(Cn);
|
|
814
|
+
}), O(X), C(X, (e) => w(Ye, e), () => a(Ye)), p(() => {
|
|
815
|
+
Vt = j(X, 1, "sv-grid-chart-panel", null, Vt, {
|
|
816
|
+
"is-right": a(F) === "right" && !a(V),
|
|
817
|
+
"is-bottom": a(F) === "bottom" && !a(V),
|
|
818
|
+
"is-floating": a(V),
|
|
819
|
+
"is-maximized": a(V) && a(U)
|
|
820
|
+
}), m(X, a(nt)), Gt = j(Z, 1, "sv-grid-chart-drawer-title", null, Gt, { "is-drag-handle": a(V) && !a(U) }), _(Q, "aria-expanded", a(G));
|
|
821
|
+
}), o("pointerdown", Z, et), o("click", Q, () => w(G, !a(G))), o("click", ln, () => l().chartPanelOpen = !1), h($, "clientWidth", (e) => w(rt, e)), h($, "clientHeight", (e) => w(it, e)), n(3, X, () => P, () => ({
|
|
822
|
+
x: !a(V) && a(F) === "right" ? a(B) : 0,
|
|
823
|
+
y: !a(V) && a(F) === "bottom" ? a(B) : 0,
|
|
824
|
+
duration: 180,
|
|
825
|
+
easing: ae
|
|
826
|
+
})), i(e, X), E();
|
|
827
|
+
}
|
|
828
|
+
d([
|
|
829
|
+
"pointerdown",
|
|
830
|
+
"click",
|
|
831
|
+
"change"
|
|
832
|
+
]);
|
|
833
|
+
//#endregion
|
|
834
|
+
export { se as a, z as c, V as i, oe as l, U as n, L as o, H as r, ce as s, W as t, P as u };
|