@svgrid/grid-wc 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.
Files changed (96) hide show
  1. package/README.md +130 -110
  2. package/dist/GridMenus-B1mC1aPp.js +1077 -0
  3. package/dist/SvChartMenu-CBMKm7Xb.js +413 -0
  4. package/dist/SvDateRangeInput-BrYTQEMM.js +197 -0
  5. package/dist/SvDateTimePicker-CnLlqNDQ.js +766 -0
  6. package/dist/SvField-Bmzp3ObZ.js +147 -0
  7. package/dist/SvGridCellEditor-B005dmV1.js +560 -0
  8. package/dist/SvGridChart-4TcL9Rj2.js +3702 -0
  9. package/dist/SvGridChartBuilder-C4OL4XYx.js +1165 -0
  10. package/dist/SvGridChartPanel-CfHA8Ioq.js +1743 -0
  11. package/dist/SvGridChartView-Ci-9_EJ0.js +45 -0
  12. package/dist/SvGridDropdown-BlA6iw9m.js +257 -0
  13. package/dist/angular/fesm2022/svgrid-grid-wc-angular.mjs +178 -7
  14. package/dist/angular/fesm2022/svgrid-grid-wc-angular.mjs.map +1 -1
  15. package/dist/angular/types/svgrid-grid-wc-angular.d.ts +77 -2
  16. package/dist/{shadow/cell-formatting-C0OsDmi_.js → cell-formatting-Eypm-id0.js} +1 -1
  17. package/dist/chart/SvChartMenu-C-sbGNk8.js +586 -0
  18. package/dist/chart/chart-export-BHGuh_kZ.js +127 -0
  19. package/dist/chart/chart-export-pdf-BjkkIEkE.js +104 -0
  20. package/dist/chart/chart-summary-B86RFA3M.js +137 -0
  21. package/dist/chart/chart-trend-DP6DSsBa.js +56 -0
  22. package/dist/chart/chart-validate-CD6ptiwg.js +180 -0
  23. package/dist/chart/client-BuB0wIgc.js +2757 -0
  24. package/dist/chart/sv-chart-element.d.ts +98 -0
  25. package/dist/chart/sv-chart-element.js +7282 -0
  26. package/dist/chart-DoqdUoGg.js +4398 -0
  27. package/dist/chart-export-pdf-BirUdchl.js +104 -0
  28. package/dist/chart-summary-BP9i-v8M.js +137 -0
  29. package/dist/chart-validate-CD6ptiwg.js +180 -0
  30. package/dist/{shadow/client-DjwUji8D.js → client-DEF0GRjE.js} +1 -1
  31. package/dist/{shadow/column-resize-DvCRUrN3.js → column-resize-DUPgynvc.js} +3 -3
  32. package/dist/date-format-DMTwV8NC.js +1128 -0
  33. package/dist/{export-format-B6FUgOll.js → export-format-uGayRKWM.js} +3 -3
  34. package/dist/focus-trap-DvlOlOGM.js +65 -0
  35. package/dist/list-option-DrRyivWp.js +82 -0
  36. package/dist/react/chart.d.ts +99 -0
  37. package/dist/react/chart.js +49 -0
  38. package/dist/react/index.d.ts +28 -0
  39. package/dist/react/index.js +4 -1
  40. package/dist/{row-resize-D-8s3cqT.js → row-resize-Cf8qPLbi.js} +44 -36
  41. package/dist/shadow/GridMenus-B1mC1aPp.js +1077 -0
  42. package/dist/shadow/SvChartMenu-CBMKm7Xb.js +413 -0
  43. package/dist/shadow/SvDateRangeInput-BrYTQEMM.js +197 -0
  44. package/dist/shadow/SvDateTimePicker-CnLlqNDQ.js +766 -0
  45. package/dist/shadow/SvField-Bmzp3ObZ.js +147 -0
  46. package/dist/shadow/SvGridCellEditor-B005dmV1.js +560 -0
  47. package/dist/shadow/SvGridChart-4TcL9Rj2.js +3702 -0
  48. package/dist/shadow/SvGridChartBuilder-C4OL4XYx.js +1165 -0
  49. package/dist/shadow/SvGridChartPanel-CfHA8Ioq.js +1743 -0
  50. package/dist/shadow/SvGridChartView-Ci-9_EJ0.js +45 -0
  51. package/dist/shadow/SvGridDropdown-BlA6iw9m.js +257 -0
  52. package/dist/{cell-formatting-C0OsDmi_.js → shadow/cell-formatting-Eypm-id0.js} +1 -1
  53. package/dist/shadow/chart-DoqdUoGg.js +4398 -0
  54. package/dist/shadow/chart-export-pdf-BirUdchl.js +104 -0
  55. package/dist/shadow/chart-summary-BP9i-v8M.js +137 -0
  56. package/dist/shadow/chart-validate-CD6ptiwg.js +180 -0
  57. package/dist/{client-DjwUji8D.js → shadow/client-DEF0GRjE.js} +1 -1
  58. package/dist/{column-resize-DvCRUrN3.js → shadow/column-resize-DUPgynvc.js} +3 -3
  59. package/dist/shadow/date-format-DMTwV8NC.js +1128 -0
  60. package/dist/shadow/{export-format-C8kZGZfz.js → export-format-DhdZREP1.js} +3 -3
  61. package/dist/shadow/focus-trap-DvlOlOGM.js +65 -0
  62. package/dist/shadow/list-option-DrRyivWp.js +82 -0
  63. package/dist/shadow/{row-resize-D-8s3cqT.js → row-resize-Cf8qPLbi.js} +44 -36
  64. package/dist/shadow/sv-grid-shadow-element.d.ts +15 -0
  65. package/dist/shadow/sv-grid-shadow-element.js +4853 -3626
  66. package/dist/shadow/{svelte-virtualizer.svelte-DZ9UcyfT.js → svelte-virtualizer.svelte-CnGhFGDc.js} +37 -34
  67. package/dist/sv-grid-element.d.ts +15 -0
  68. package/dist/sv-grid-element.js +4809 -3612
  69. package/dist/{svelte-virtualizer.svelte-DZ9UcyfT.js → svelte-virtualizer.svelte-CnGhFGDc.js} +37 -34
  70. package/dist/vue/chart.d.ts +64 -0
  71. package/dist/vue/chart.js +41 -0
  72. package/dist/vue/index.d.ts +11 -2
  73. package/dist/vue/index.js +4 -1
  74. package/package.json +18 -5
  75. package/dist/GridMenus-DpmS1pzo.js +0 -1121
  76. package/dist/SvDateRangeInput-u4ibte8S.js +0 -196
  77. package/dist/SvDateTimePicker-DVFiDxUq.js +0 -765
  78. package/dist/SvField-ChCI-O2O.js +0 -146
  79. package/dist/SvGridCellEditor-DvsQyE9a.js +0 -550
  80. package/dist/SvGridChart-yK5Zv85y.js +0 -1199
  81. package/dist/SvGridChartPanel-B38_VjXM.js +0 -584
  82. package/dist/SvGridChartView-ScXTF6t-.js +0 -50
  83. package/dist/SvGridDropdown-DnAESFDu.js +0 -256
  84. package/dist/chart-uvs3sFJA.js +0 -1220
  85. package/dist/date-format-CPHqTHN6.js +0 -1127
  86. package/dist/shadow/GridMenus-DpmS1pzo.js +0 -1121
  87. package/dist/shadow/SvDateRangeInput-u4ibte8S.js +0 -196
  88. package/dist/shadow/SvDateTimePicker-DVFiDxUq.js +0 -765
  89. package/dist/shadow/SvField-ChCI-O2O.js +0 -146
  90. package/dist/shadow/SvGridCellEditor-DvsQyE9a.js +0 -550
  91. package/dist/shadow/SvGridChart-yK5Zv85y.js +0 -1199
  92. package/dist/shadow/SvGridChartPanel-B38_VjXM.js +0 -584
  93. package/dist/shadow/SvGridChartView-ScXTF6t-.js +0 -50
  94. package/dist/shadow/SvGridDropdown-DnAESFDu.js +0 -256
  95. package/dist/shadow/chart-uvs3sFJA.js +0 -1220
  96. package/dist/shadow/date-format-CPHqTHN6.js +0 -1127
@@ -1,584 +0,0 @@
1
- import { $ as e, E as t, F as n, H as r, I as i, J as a, K as o, L as s, M as c, O as l, P as u, R as d, S as f, V as p, X as m, Z as h, _ as g, a as ee, d as _, et as v, f as y, g as b, j as x, k as S, n as te, nt as C, o as w, p as T, q as ne, rt as E, s as D, tt as re, v as O, w as k, y as A } from "./client-DjwUji8D.js";
2
- import { t as ie } from "./SvGridChart-yK5Zv85y.js";
3
- //#region ../../node_modules/.pnpm/svelte@5.55.9_@typescript-eslint+types@8.67.0/node_modules/svelte/src/transition/index.js
4
- function j(e) {
5
- let t = e - 1;
6
- return t * t * t + 1;
7
- }
8
- function M(e) {
9
- let t = typeof e == "string" && e.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);
10
- return t ? [parseFloat(t[1]), t[2] || "px"] : [e, "px"];
11
- }
12
- function N(e, { delay: t = 0, duration: n = 400, easing: r = j, x: i = 0, y: a = 0, opacity: o = 0 } = {}) {
13
- let s = getComputedStyle(e), c = +s.opacity, l = s.transform === "none" ? "" : s.transform, u = c * (1 - o), [d, f] = M(i), [p, m] = M(a);
14
- return {
15
- delay: t,
16
- duration: n,
17
- easing: r,
18
- css: (e, t) => `
19
- transform: ${l} translate(${(1 - e) * d}${f}, ${(1 - e) * p}${m});
20
- opacity: ${c - u * t}`
21
- };
22
- }
23
- //#endregion
24
- //#region ../../node_modules/.pnpm/svelte@5.55.9_@typescript-eslint+types@8.67.0/node_modules/svelte/src/easing/index.js
25
- function P(e) {
26
- let t = e - 1;
27
- return t * t * t + 1;
28
- }
29
- //#endregion
30
- //#region ../grid/dist/chart-export.js
31
- function F(e) {
32
- return e instanceof SVGSVGElement ? e : e.querySelector("svg.sv-grid-chart-svg") ?? e.querySelector("svg");
33
- }
34
- function I(e, t, n) {
35
- return getComputedStyle(e).getPropertyValue(t).trim() || n;
36
- }
37
- function L(e, t = {}) {
38
- let n = F(e);
39
- if (!n) throw Error("chartToSvgString: no <svg> found");
40
- 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);
41
- u.setAttribute("width", String(c)), u.setAttribute("height", String(l)), u.setAttribute("xmlns", "http://www.w3.org/2000/svg");
42
- let d = [
43
- "fill",
44
- "fill-opacity",
45
- "stroke",
46
- "stroke-width",
47
- "stroke-opacity",
48
- "stroke-dasharray",
49
- "stroke-linecap",
50
- "stroke-linejoin",
51
- "opacity",
52
- "font-size",
53
- "font-family",
54
- "font-weight",
55
- "text-anchor"
56
- ], f = n.querySelectorAll("*"), p = u.querySelectorAll("*");
57
- for (let e = 0; e < f.length; e += 1) {
58
- let t = p[e];
59
- if (!t || !t.style) continue;
60
- let n = getComputedStyle(f[e]);
61
- for (let e of d) {
62
- let r = n.getPropertyValue(e);
63
- r && r !== "normal" && t.style.setProperty(e, r);
64
- }
65
- }
66
- u.querySelectorAll(".sv-grid-chart-hit").forEach((e) => e.remove());
67
- let m = document.createElementNS("http://www.w3.org/2000/svg", "style");
68
- m.textContent = `
69
- .sv-grid-chart-axis { fill: ${i}; font-size: 10px; font-family: sans-serif; }
70
- .sv-grid-chart-gridline { stroke: ${a}; stroke-width: 1; opacity: 0.6; }
71
- .sv-grid-chart-gridline.is-zero { stroke: ${i}; opacity: 0.9; }
72
- .sv-grid-chart-datalabel { fill: ${r}; font-size: 9.5px; font-weight: 600; font-family: sans-serif; }
73
- .sv-grid-chart-datalabel.on-bar { fill: #fff; }
74
- .sv-grid-chart-donut-total { fill: ${r}; font-size: 16px; font-weight: 800; font-family: sans-serif; }
75
- .sv-grid-chart-donut-label { fill: ${i}; font-size: 10px; font-family: sans-serif; }
76
- `, u.insertBefore(m, u.firstChild);
77
- let h = document.createElementNS("http://www.w3.org/2000/svg", "rect");
78
- return h.setAttribute("x", "0"), h.setAttribute("y", "0"), h.setAttribute("width", String(c)), h.setAttribute("height", String(l)), h.setAttribute("fill", o), u.insertBefore(h, m.nextSibling), new XMLSerializer().serializeToString(u);
79
- }
80
- function R(e, t) {
81
- let n = document.createElement("a");
82
- n.href = e, n.download = t, document.body.appendChild(n), n.click(), n.remove();
83
- }
84
- function ae(e, t = "chart.svg", n = {}) {
85
- let r = L(e, n), i = URL.createObjectURL(new Blob([r], { type: "image/svg+xml" }));
86
- R(i, t), setTimeout(() => URL.revokeObjectURL(i), 1e3);
87
- }
88
- function oe(e, t = {}) {
89
- 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;
90
- return new Promise((e, t) => {
91
- let r = URL.createObjectURL(new Blob([n], { type: "image/svg+xml" })), i = new Image();
92
- i.onload = () => {
93
- let n = document.createElement("canvas");
94
- n.width = Math.round(o), n.height = Math.round(s);
95
- let a = n.getContext("2d");
96
- if (!a) {
97
- URL.revokeObjectURL(r), t(/* @__PURE__ */ Error("canvas 2d context unavailable"));
98
- return;
99
- }
100
- a.drawImage(i, 0, 0, n.width, n.height), URL.revokeObjectURL(r), n.toBlob((n) => n ? e(n) : t(/* @__PURE__ */ Error("toBlob failed")), "image/png");
101
- }, i.onerror = () => {
102
- URL.revokeObjectURL(r), t(/* @__PURE__ */ Error("failed to rasterize chart SVG"));
103
- }, i.src = r;
104
- });
105
- }
106
- async function se(e, t = "chart.png", n = {}) {
107
- let r = await oe(e, n), i = URL.createObjectURL(r);
108
- R(i, t), setTimeout(() => URL.revokeObjectURL(i), 1e3);
109
- }
110
- var z = (e) => {
111
- let t = e == null ? "" : String(e);
112
- return /[",\n]/.test(t) ? `"${t.replace(/"/g, "\"\"")}"` : t;
113
- };
114
- function B(e) {
115
- let t = e.categories ?? [], n = e.series ?? [];
116
- return !t.length || !n.length ? "" : [["Category", ...n.map((e) => e.label)].map(z).join(","), ...t.map((e, t) => [e, ...n.map((e) => e.values[t] ?? "")].map(z).join(","))].join("\n");
117
- }
118
- function ce(e, t = "chart.csv") {
119
- let n = B(e);
120
- if (!n) return !1;
121
- let r = URL.createObjectURL(new Blob([n], { type: "text/csv;charset=utf-8" }));
122
- return R(r, t), setTimeout(() => URL.revokeObjectURL(r), 1e3), !0;
123
- }
124
- //#endregion
125
- //#region ../grid/dist/SvGridChartPanel.svelte
126
- var le = x("<div role=\"separator\" aria-label=\"Resize chart panel\"></div>"), ue = x("<button type=\"button\" class=\"sv-grid-chart-btn\">Clear filter</button>"), de = c("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><polyline points=\"20 6 9 17 4 12\"></polyline></svg>"), fe = c("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"></path><polyline points=\"7 10 12 15 17 10\"></polyline><line x1=\"12\" y1=\"15\" x2=\"12\" y2=\"3\"></line></svg>"), pe = x("<div class=\"sv-grid-chart-export-menu\" role=\"menu\"><button type=\"button\" role=\"menuitem\">PNG image</button> <button type=\"button\" role=\"menuitem\">SVG vector</button> <button type=\"button\" role=\"menuitem\">CSV data</button> <button type=\"button\" role=\"menuitem\">Copy to clipboard</button></div>"), me = x("<button type=\"button\" aria-label=\"Chart with AI\" title=\"Chart with AI\"><svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M12 2l1.9 4.6L18.5 8.5 13.9 10.4 12 15l-1.9-4.6L5.5 8.5l4.6-1.9L12 2zm6 11l1 2.4 2.4 1-2.4 1L18 21l-1-2.6-2.4-1 2.4-1L18 13zM6 14l.8 2 2 .8-2 .8L6 20l-.8-2.4-2-.8 2-.8L6 14z\"></path></svg> AI</button>"), he = x("<button type=\"button\" class=\"sv-grid-chart-icon-btn\" aria-label=\"Add chart\" title=\"Add chart\"><svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"></line><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"></line></svg></button>"), ge = c("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M8 3v3a2 2 0 0 1-2 2H3\"></path><path d=\"M21 8h-3a2 2 0 0 1-2-2V3\"></path><path d=\"M3 16h3a2 2 0 0 1 2 2v3\"></path><path d=\"M16 21v-3a2 2 0 0 1 2-2h3\"></path></svg>"), _e = c("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M8 3H5a2 2 0 0 0-2 2v3\"></path><path d=\"M21 8V5a2 2 0 0 0-2-2h-3\"></path><path d=\"M3 16v3a2 2 0 0 0 2 2h3\"></path><path d=\"M16 21h3a2 2 0 0 0 2-2v-3\"></path></svg>"), ve = x("<button type=\"button\" class=\"sv-grid-chart-icon-btn\"><!></button> <button type=\"button\" class=\"sv-grid-chart-icon-btn\" aria-label=\"Dock chart\" title=\"Dock\"><svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"></rect><line x1=\"15\" y1=\"3\" x2=\"15\" y2=\"21\"></line></svg></button>", 1), ye = x("<button type=\"button\" class=\"sv-grid-chart-icon-btn\" aria-label=\"Pop out chart\" title=\"Pop out\"><svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M15 3h6v6\"></path><path d=\"M10 14 21 3\"></path><path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"></path></svg></button>"), be = x("<div><button type=\"button\" class=\"sv-grid-chart-tab-label\" role=\"tab\"> </button> <button type=\"button\" class=\"sv-grid-chart-tab-x\" title=\"Remove\">&times;</button></div>"), xe = x("<div class=\"sv-grid-chart-tabs\" role=\"tablist\" aria-label=\"Charts\"></div>"), Se = x("<p class=\"sv-grid-chart-ai-msg is-error\"> </p>"), Ce = x("<p class=\"sv-grid-chart-ai-msg\"> </p>"), we = x("<div class=\"sv-grid-chart-ai\"><form class=\"sv-grid-chart-ai-row\"><input class=\"sv-grid-chart-ai-input\" type=\"text\" placeholder=\"Describe a chart, e.g. revenue by region stacked by product\"/> <button type=\"submit\" class=\"sv-grid-chart-btn\"> </button></form> <!></div>"), Te = x("<option> </option>"), Ee = x("<option> </option>"), De = x("<option> </option>"), Oe = x("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\">Split by</span> <select><option>(none)</option><!></select></label>"), ke = x("<option> </option>"), Ae = x("<option> </option>"), je = x("<option> </option>"), Me = x("<label class=\"sv-grid-chart-toggle\"><input type=\"checkbox\"/> Stacked</label>"), Ne = x("<label class=\"sv-grid-chart-toggle\" title=\"Logarithmic value axis - flattens wide-range data\"><input type=\"checkbox\"/> Log scale</label>"), Pe = x("<label class=\"sv-grid-chart-toggle\" title=\"Space points by actual date - real time ticks and proportional gaps\"><input type=\"checkbox\"/> Date axis</label>"), Fe = x("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\">Type</span> <select></select></label> <label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\">Group by</span> <select></select></label> <!> <label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\">Value</span> <select></select></label> <label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\">Aggregate</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-toggle\"><input type=\"checkbox\"/> Labels</label> <!> <!>", 1), Ie = x("<p class=\"sv-grid-chart-empty\"><!></p>"), Le = x("<div class=\"sv-grid-chart-float-resizer\" role=\"separator\" aria-label=\"Resize chart window\"></div>"), Re = x("<section aria-label=\"Chart\"><!> <header class=\"sv-grid-chart-panel-head\"><div><svg class=\"sv-grid-chart-title-icon\" width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><line x1=\"12\" y1=\"20\" x2=\"12\" y2=\"10\"></line><line x1=\"18\" y1=\"20\" x2=\"18\" y2=\"4\"></line><line x1=\"6\" y1=\"20\" x2=\"6\" y2=\"16\"></line></svg> <span class=\"sv-grid-chart-title\">Chart</span> <div class=\"sv-grid-chart-actions\"><!> <div class=\"sv-grid-chart-export\"><button type=\"button\" class=\"sv-grid-chart-icon-btn\" aria-label=\"Export chart\" title=\"Export\"><!></button> <!></div> <!> <!> <!> <button type=\"button\" class=\"sv-grid-chart-close\" aria-label=\"Close chart\">&times;</button></div></div> <!> <!> <div class=\"sv-grid-chart-controls\"><!></div></header> <div class=\"sv-grid-chart-panel-body\"><!></div> <!></section>");
127
- function V(n, c) {
128
- re(c, !0);
129
- let x = te(c, "ctrl", 7), j = e(() => x().chartingConfig), M = e(() => x().chartCfg), F = e(() => x().chartIsCustom), I = e(() => d(j)?.position ?? "bottom"), L = e(() => d(j)?.crossFilter !== !1), R = e(() => x().chartSpec), z = e(() => x().chartableColumns), B = e(() => x().chartSize ?? (d(I) === "right" ? d(j)?.width ?? 340 : d(j)?.height ?? 260)), V = e(() => x().chartFloating), H = e(() => x().chartMaximized), U = e(() => x().chartFloatRect), ze = h(null);
130
- function Be() {
131
- let e = d(ze)?.offsetParent;
132
- return {
133
- w: e?.clientWidth ?? 800,
134
- h: e?.clientHeight ?? 520
135
- };
136
- }
137
- function Ve() {
138
- if (!x().chartFloatRect) {
139
- let { w: e, h: t } = Be(), n = Math.min(600, Math.max(360, e - 80)), r = Math.min(430, Math.max(260, t - 90));
140
- x().chartFloatRect = {
141
- x: Math.round((e - n) / 2),
142
- y: Math.round((t - r) / 2),
143
- w: n,
144
- h: r
145
- };
146
- }
147
- x().chartFloating = !0;
148
- }
149
- function He() {
150
- x().chartFloating = !1, x().chartMaximized = !1;
151
- }
152
- let Ue = () => x().chartMaximized = !x().chartMaximized;
153
- function We(e) {
154
- if (!d(V) || d(H) || e.target?.closest("button")) return;
155
- let t = x().chartFloatRect;
156
- if (!t) return;
157
- e.preventDefault();
158
- let n = e.clientX, r = e.clientY, { w: i, h: a } = Be(), o = (e) => {
159
- let o = Math.max(0, Math.min(i - t.w, t.x + e.clientX - n)), s = Math.max(0, Math.min(a - t.h, t.y + e.clientY - r));
160
- x().chartFloatRect = {
161
- x: o,
162
- y: s,
163
- w: t.w,
164
- h: t.h
165
- };
166
- }, s = () => {
167
- window.removeEventListener("pointermove", o), window.removeEventListener("pointerup", s);
168
- };
169
- window.addEventListener("pointermove", o), window.addEventListener("pointerup", s);
170
- }
171
- function Ge(e) {
172
- let t = x().chartFloatRect;
173
- if (!t) return;
174
- e.preventDefault(), e.stopPropagation();
175
- let n = e.clientX, r = e.clientY;
176
- e.target.setPointerCapture?.(e.pointerId);
177
- let i = (e) => {
178
- x().chartFloatRect = {
179
- x: t.x,
180
- y: t.y,
181
- w: Math.max(300, t.w + e.clientX - n),
182
- h: Math.max(220, t.h + e.clientY - r)
183
- };
184
- }, a = () => {
185
- window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a);
186
- };
187
- window.addEventListener("pointermove", i), window.addEventListener("pointerup", a);
188
- }
189
- let Ke = e(() => d(V) ? d(H) ? "left:12px; top:12px; right:12px; bottom:12px; width:auto; height:auto;" : d(U) ? `left:${d(U).x}px; top:${d(U).y}px; width:${d(U).w}px; height:${d(U).h}px;` : "" : d(I) === "right" ? `width:${d(B)}px` : `height:${d(B)}px`), qe = h(0), Je = h(0), Ye = e(() => d(R) ? d(R).type === "pie" ? d(R).categories.length : d(R).series.length : 0), Xe = e(() => (d(Ye) > 1 ? 36 : 0) + (d(M)?.export === !0 ? 30 : 0)), Ze = e(() => d(qe) > 24 ? d(qe) - 8 : void 0), Qe = e(() => d(Je) > 24 ? Math.max(120, d(Je) - 8 - d(Xe)) : void 0), $e = [
190
- {
191
- value: "bar",
192
- label: "Bar"
193
- },
194
- {
195
- value: "line",
196
- label: "Line"
197
- },
198
- {
199
- value: "area",
200
- label: "Area"
201
- },
202
- {
203
- value: "pie",
204
- label: "Pie"
205
- }
206
- ], et = [
207
- {
208
- value: "sum",
209
- label: "Sum"
210
- },
211
- {
212
- value: "avg",
213
- label: "Average"
214
- },
215
- {
216
- value: "count",
217
- label: "Count"
218
- }
219
- ], tt = [
220
- {
221
- value: "number",
222
- label: "Number"
223
- },
224
- {
225
- value: "currency",
226
- label: "Currency"
227
- },
228
- {
229
- value: "percent",
230
- label: "Percent"
231
- }
232
- ];
233
- function nt(e) {
234
- d(L) && e.category != null && x().applyChartCrossFilter(String(e.category));
235
- }
236
- let rt = h(null), W = h(!1), it = h(!1), at = () => d(rt)?.querySelector("svg") ?? null, ot = e(() => !!(d(R) && d(R).categories?.length && d(R).series?.length));
237
- function st() {
238
- let e = at();
239
- e && se(e, "chart.png"), m(W, !1);
240
- }
241
- function ct() {
242
- let e = at();
243
- e && ae(e, "chart.svg"), m(W, !1);
244
- }
245
- function lt() {
246
- d(R) && ce(d(R), "chart.csv"), m(W, !1);
247
- }
248
- async function ut() {
249
- let e = at();
250
- if (m(W, !1), !(!e || typeof ClipboardItem > "u" || !navigator.clipboard?.write)) try {
251
- let t = await oe(e);
252
- await navigator.clipboard.write([new ClipboardItem({ "image/png": t })]), m(it, !0), setTimeout(() => m(it, !1), 1400);
253
- } catch {}
254
- }
255
- r(() => {
256
- if (!d(W)) return;
257
- let e = (e) => {
258
- e.target?.closest(".sv-grid-chart-export") || m(W, !1);
259
- };
260
- return window.addEventListener("pointerdown", e), () => window.removeEventListener("pointerdown", e);
261
- });
262
- let dt = e(() => !!x().chartAiHandler), G = h(!1), K = h(""), q = h(!1), J = h(""), Y = h("");
263
- async function ft() {
264
- let e = x().chartAiHandler, t = d(K).trim();
265
- if (!(!e || !t || d(q))) {
266
- m(q, !0), m(J, ""), m(Y, "");
267
- try {
268
- let n = await e(t);
269
- n ? (x().applyChartConfig(n), m(Y, typeof n.rationale == "string" ? n.rationale : "", !0)) : m(J, "Couldn't build a chart from that request.");
270
- } catch (e) {
271
- m(J, e instanceof Error ? e.message : "Something went wrong.", !0);
272
- } finally {
273
- m(q, !1);
274
- }
275
- }
276
- }
277
- let pt = h(!1);
278
- function mt(e) {
279
- e.preventDefault(), m(pt, !0);
280
- let t = d(I) === "right" ? e.clientX : e.clientY, n = d(B);
281
- e.target.setPointerCapture?.(e.pointerId);
282
- let r = (e) => {
283
- let r = d(I) === "right" ? t - e.clientX : t - e.clientY;
284
- x().chartSize = Math.max(160, Math.min(720, n + r));
285
- }, i = () => {
286
- m(pt, !1), window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", i);
287
- };
288
- window.addEventListener("pointermove", r), window.addEventListener("pointerup", i);
289
- }
290
- var X = Re();
291
- let ht;
292
- var gt = o(X), _t = (e) => {
293
- var t = le();
294
- let n;
295
- p(() => {
296
- n = A(t, 1, "sv-grid-chart-resizer", null, n, { "is-dragging": d(pt) }), y(t, "aria-orientation", d(I) === "right" ? "vertical" : "horizontal");
297
- }), i("pointerdown", t, mt), S(e, t);
298
- };
299
- t(gt, (e) => {
300
- d(V) || e(_t);
301
- });
302
- var vt = a(gt, 2), Z = o(vt);
303
- let yt;
304
- var bt = a(o(Z), 4), xt = o(bt), St = (e) => {
305
- var t = ue();
306
- i("click", t, () => x().clearChartCrossFilter()), S(e, t);
307
- };
308
- t(xt, (e) => {
309
- d(L) && !d(F) && e(St);
310
- });
311
- var Ct = a(xt, 2), Q = o(Ct), wt = o(Q), Tt = (e) => {
312
- var t = de();
313
- S(e, t);
314
- }, Et = (e) => {
315
- var t = fe();
316
- S(e, t);
317
- };
318
- t(wt, (e) => {
319
- d(it) ? e(Tt) : e(Et, -1);
320
- }), E(Q);
321
- var Dt = a(Q, 2), Ot = (e) => {
322
- var t = pe(), n = o(t), r = a(n, 2), s = a(r, 2), c = a(s, 2);
323
- E(t), p(() => s.disabled = !d(ot)), i("click", n, st), i("click", r, ct), i("click", s, lt), i("click", c, ut), S(e, t);
324
- };
325
- t(Dt, (e) => {
326
- d(W) && e(Ot);
327
- }), E(Ct);
328
- var kt = a(Ct, 2), At = (e) => {
329
- var t = me();
330
- let n;
331
- p(() => {
332
- n = A(t, 1, "sv-grid-chart-btn sv-grid-chart-ai-btn", null, n, { "is-active": d(G) }), y(t, "aria-expanded", d(G));
333
- }), i("click", t, () => m(G, !d(G))), S(e, t);
334
- };
335
- t(kt, (e) => {
336
- d(dt) && !d(F) && e(At);
337
- });
338
- var jt = a(kt, 2), Mt = (e) => {
339
- var t = he();
340
- i("click", t, () => x().addChart()), S(e, t);
341
- };
342
- t(jt, (e) => {
343
- d(F) || e(Mt);
344
- });
345
- var Nt = a(jt, 2), Pt = (e) => {
346
- var n = ve(), r = ne(n), s = o(r), c = (e) => {
347
- var t = ge();
348
- S(e, t);
349
- }, l = (e) => {
350
- var t = _e();
351
- S(e, t);
352
- };
353
- t(s, (e) => {
354
- d(H) ? e(c) : e(l, -1);
355
- }), E(r);
356
- var u = a(r, 2);
357
- p(() => {
358
- y(r, "aria-label", d(H) ? "Restore" : "Maximize"), y(r, "title", d(H) ? "Restore" : "Maximize");
359
- }), i("click", r, Ue), i("click", u, He), S(e, n);
360
- }, Ft = (e) => {
361
- var t = ye();
362
- i("click", t, Ve), S(e, t);
363
- };
364
- t(Nt, (e) => {
365
- d(V) ? e(Pt) : e(Ft, -1);
366
- });
367
- var It = a(Nt, 2);
368
- E(bt), E(Z);
369
- var Lt = a(Z, 2), Rt = (e) => {
370
- var t = xe();
371
- k(t, 23, () => x().charts, (e) => e.id, (e, t, n) => {
372
- var r = be();
373
- let s;
374
- var c = o(r), u = o(c, !0);
375
- E(c);
376
- var f = a(c, 2);
377
- E(r), p(() => {
378
- s = A(r, 1, "sv-grid-chart-tab", null, s, { "is-active": d(n) === x().activeChartIndex }), y(c, "aria-selected", d(n) === x().activeChartIndex), l(u, d(t).title), y(f, "aria-label", `Remove ${d(t).title}`);
379
- }), i("click", c, () => x().activeChartIndex = d(n)), i("click", f, () => x().removeChart(d(n))), S(e, r);
380
- }), E(t), S(e, t);
381
- };
382
- t(Lt, (e) => {
383
- !d(F) && x().charts.length > 1 && e(Rt);
384
- });
385
- var zt = a(Lt, 2), Bt = (e) => {
386
- var n = we(), r = o(n), i = o(r);
387
- _(i);
388
- var c = a(i, 2), u = o(c, !0);
389
- E(c), E(r);
390
- var f = a(r, 2), h = (e) => {
391
- var t = Se(), n = o(t, !0);
392
- E(t), p(() => l(n, d(J))), S(e, t);
393
- }, g = (e) => {
394
- var t = Ce(), n = o(t, !0);
395
- E(t), p(() => l(n, d(Y))), S(e, t);
396
- };
397
- t(f, (e) => {
398
- d(J) ? e(h) : d(Y) && e(g, 1);
399
- }), E(n), p((e) => {
400
- i.disabled = d(q), c.disabled = e, l(u, d(q) ? "Thinking..." : "Chart it");
401
- }, [() => d(q) || !d(K).trim()]), s("submit", r, (e) => {
402
- e.preventDefault(), ft();
403
- }), D(i, () => d(K), (e) => m(K, e)), S(e, n);
404
- };
405
- t(zt, (e) => {
406
- d(dt) && d(G) && !d(F) && e(Bt);
407
- });
408
- var Vt = a(zt, 2), Ht = o(Vt), Ut = (e) => {
409
- var n = Fe(), r = ne(n), s = a(o(r), 2);
410
- k(s, 21, () => $e, (e) => e.value, (e, t) => {
411
- var n = Te(), r = o(n, !0);
412
- E(n);
413
- var i = {};
414
- p(() => {
415
- l(r, d(t).label), i !== (i = d(t).value) && (n.value = (n.__value = d(t).value) ?? "");
416
- }), S(e, n);
417
- }), E(s);
418
- var c;
419
- b(s), E(r);
420
- var u = a(r, 2), f = a(o(u), 2);
421
- k(f, 21, () => d(z).dims, (e) => e.id, (e, t) => {
422
- var n = Ee(), r = o(n, !0);
423
- E(n);
424
- var i = {};
425
- p(() => {
426
- l(r, d(t).label), i !== (i = d(t).id) && (n.value = (n.__value = d(t).id) ?? "");
427
- }), S(e, n);
428
- }), E(f);
429
- var m;
430
- b(f), E(u);
431
- var h = a(u, 2), ee = (e) => {
432
- var t = Oe(), n = a(o(t), 2), r = o(n);
433
- r.value = r.__value = "";
434
- var s = a(r);
435
- k(s, 17, () => d(z).dims, (e) => e.id, (e, t) => {
436
- var n = De(), r = o(n, !0);
437
- E(n);
438
- var i = {};
439
- p(() => {
440
- l(r, d(t).label), i !== (i = d(t).id) && (n.value = (n.__value = d(t).id) ?? "");
441
- }), S(e, n);
442
- }), E(n);
443
- var c;
444
- b(n), E(t), p(() => {
445
- c !== (c = x().chartSeriesId ?? "") && (n.value = (n.__value = x().chartSeriesId ?? "") ?? "", g(n, x().chartSeriesId ?? ""));
446
- }), i("change", n, (e) => x().chartSeriesId = e.currentTarget.value || null), S(e, t);
447
- };
448
- t(h, (e) => {
449
- d(z).dims.length > 1 && e(ee);
450
- });
451
- var v = a(h, 2), y = a(o(v), 2);
452
- k(y, 21, () => d(z).measures, (e) => e.id, (e, t) => {
453
- var n = ke(), r = o(n, !0);
454
- E(n);
455
- var i = {};
456
- p(() => {
457
- l(r, d(t).label), i !== (i = d(t).id) && (n.value = (n.__value = d(t).id) ?? "");
458
- }), S(e, n);
459
- }), E(y);
460
- var te;
461
- b(y), E(v);
462
- var w = a(v, 2), D = a(o(w), 2);
463
- k(D, 21, () => et, (e) => e.value, (e, t) => {
464
- var n = Ae(), r = o(n, !0);
465
- E(n);
466
- var i = {};
467
- p(() => {
468
- l(r, d(t).label), i !== (i = d(t).value) && (n.value = (n.__value = d(t).value) ?? "");
469
- }), S(e, n);
470
- }), E(D);
471
- var re;
472
- b(D), E(w);
473
- var O = a(w, 2), A = a(o(O), 2);
474
- k(A, 21, () => tt, (e) => e.value, (e, t) => {
475
- var n = je(), r = o(n, !0);
476
- E(n);
477
- var i = {};
478
- p(() => {
479
- l(r, d(t).label), i !== (i = d(t).value) && (n.value = (n.__value = d(t).value) ?? "");
480
- }), S(e, n);
481
- }), E(A);
482
- var ie;
483
- b(A), E(O);
484
- var j = a(O, 2), M = (e) => {
485
- var t = Me(), n = o(t);
486
- _(n), C(), E(t), p(() => T(n, x().chartStacked)), i("change", n, (e) => x().chartStacked = e.currentTarget.checked), S(e, t);
487
- };
488
- t(j, (e) => {
489
- x().chartType !== "pie" && e(M);
490
- });
491
- var N = a(j, 2), P = o(N);
492
- _(P), C(), E(N);
493
- var F = a(N, 2), I = (e) => {
494
- var t = Ne(), n = o(t);
495
- _(n), C(), E(t), p(() => T(n, x().chartLogScale)), i("change", n, (e) => x().chartLogScale = e.currentTarget.checked), S(e, t);
496
- };
497
- t(F, (e) => {
498
- x().chartType !== "pie" && e(I);
499
- });
500
- var L = a(F, 2), R = (e) => {
501
- var t = Pe(), n = o(t);
502
- _(n), C(), E(t), p(() => T(n, x().chartTimeAxis)), i("change", n, (e) => x().chartTimeAxis = e.currentTarget.checked), S(e, t);
503
- };
504
- t(L, (e) => {
505
- x().chartDimensionIsDate && x().chartType !== "pie" && e(R);
506
- }), p(() => {
507
- c !== (c = x().chartType) && (s.value = (s.__value = x().chartType) ?? "", g(s, x().chartType)), m !== (m = x().chartDimensionId ?? "") && (f.value = (f.__value = x().chartDimensionId ?? "") ?? "", g(f, x().chartDimensionId ?? "")), te !== (te = x().chartMeasureId ?? "") && (y.value = (y.__value = x().chartMeasureId ?? "") ?? "", g(y, x().chartMeasureId ?? "")), re !== (re = x().chartReduce) && (D.value = (D.__value = x().chartReduce) ?? "", g(D, x().chartReduce)), ie !== (ie = x().chartValueFormat) && (A.value = (A.__value = x().chartValueFormat) ?? "", g(A, x().chartValueFormat)), T(P, x().chartDataLabels);
508
- }), i("change", s, (e) => x().chartType = e.currentTarget.value), i("change", f, (e) => x().chartDimensionId = e.currentTarget.value || null), i("change", y, (e) => x().chartMeasureId = e.currentTarget.value || null), i("change", D, (e) => x().chartReduce = e.currentTarget.value), i("change", A, (e) => x().chartValueFormat = e.currentTarget.value), i("change", P, (e) => x().chartDataLabels = e.currentTarget.checked), S(e, n);
509
- };
510
- t(Ht, (e) => {
511
- d(F) || e(Ut);
512
- }), E(Vt), E(vt);
513
- var $ = a(vt, 2), Wt = o($), Gt = (t) => {
514
- {
515
- let n = e(() => d(M)?.zoom === !0), r = e(() => d(M)?.brush === !0), i = e(() => d(M)?.export === !0 || void 0);
516
- ie(t, {
517
- get spec() {
518
- return d(R);
519
- },
520
- get width() {
521
- return d(Ze);
522
- },
523
- get height() {
524
- return d(Qe);
525
- },
526
- onSelect: nt,
527
- interactive: !0,
528
- legend: !0,
529
- get dataLabels() {
530
- return x().chartDataLabels;
531
- },
532
- get zoomable() {
533
- return d(n);
534
- },
535
- get brush() {
536
- return d(r);
537
- },
538
- get toolbar() {
539
- return d(i);
540
- }
541
- });
542
- }
543
- }, Kt = (e) => {
544
- var n = Ie(), r = o(n), i = (e) => {
545
- var t = u("Charting needs at least one text column (to group by) and one numeric column (to measure).");
546
- S(e, t);
547
- }, a = (e) => {
548
- var t = u("No data to chart.");
549
- S(e, t);
550
- };
551
- t(r, (e) => {
552
- !d(z).dims.length || !d(z).measures.length ? e(i) : e(a, -1);
553
- }), E(n), S(e, n);
554
- };
555
- t(Wt, (e) => {
556
- d(R) && (d(R).series.length || d(F)) ? e(Gt) : e(Kt, -1);
557
- }), E($), ee($, (e) => m(rt, e), () => d(rt));
558
- var qt = a($, 2), Jt = (e) => {
559
- var t = Le();
560
- i("pointerdown", t, Ge), S(e, t);
561
- };
562
- t(qt, (e) => {
563
- d(V) && !d(H) && e(Jt);
564
- }), E(X), ee(X, (e) => m(ze, e), () => d(ze)), p(() => {
565
- ht = A(X, 1, "sv-grid-chart-panel", null, ht, {
566
- "is-right": d(I) === "right" && !d(V),
567
- "is-bottom": d(I) === "bottom" && !d(V),
568
- "is-floating": d(V),
569
- "is-maximized": d(V) && d(H)
570
- }), O(X, d(Ke)), yt = A(Z, 1, "sv-grid-chart-drawer-title", null, yt, { "is-drag-handle": d(V) && !d(H) }), y(Q, "aria-expanded", d(W));
571
- }), i("pointerdown", Z, We), i("click", Q, () => m(W, !d(W))), i("click", It, () => x().chartPanelOpen = !1), w($, "clientWidth", (e) => m(qe, e)), w($, "clientHeight", (e) => m(Je, e)), f(3, X, () => N, () => ({
572
- x: !d(V) && d(I) === "right" ? d(B) : 0,
573
- y: !d(V) && d(I) === "bottom" ? d(B) : 0,
574
- duration: 180,
575
- easing: P
576
- })), S(n, X), v();
577
- }
578
- n([
579
- "pointerdown",
580
- "click",
581
- "change"
582
- ]);
583
- //#endregion
584
- export { V as default };
@@ -1,50 +0,0 @@
1
- import { a as e } from "./chart-uvs3sFJA.js";
2
- import { $ as t, E as n, K as r, R as i, X as a, Z as o, et as s, j as c, k as l, o as u, rt as d, tt as f } from "./client-DjwUji8D.js";
3
- import { t as p } from "./SvGridChart-yK5Zv85y.js";
4
- //#region ../grid/dist/SvGridChartView.svelte
5
- var m = c("<div class=\"sv-grid-chart-view svelte-9enbu0\"><!></div>");
6
- function h(c, h) {
7
- f(h, !0);
8
- let g = o(0), _ = o(0), v = t(() => {
9
- let t = e(h.data ?? [], {
10
- type: h.chart.type ?? "bar",
11
- category: h.chart.category,
12
- value: h.chart.value,
13
- series: h.chart.series,
14
- reduce: h.chart.reduce,
15
- stacked: h.chart.stacked,
16
- stacked100: h.chart.stacked100,
17
- sort: h.chart.sort,
18
- topN: h.chart.topN,
19
- palette: h.chart.palette
20
- });
21
- return h.chart.valueFormat && (t.valueFormat = h.chart.valueFormat), t;
22
- });
23
- var y = m(), b = r(y), x = (e) => {
24
- {
25
- let n = t(() => h.chart.legend ?? !0), r = t(() => h.chart.dataLabels ?? !1);
26
- p(e, {
27
- get spec() {
28
- return i(v);
29
- },
30
- get width() {
31
- return i(g);
32
- },
33
- get height() {
34
- return i(_);
35
- },
36
- get legend() {
37
- return i(n);
38
- },
39
- get dataLabels() {
40
- return i(r);
41
- }
42
- });
43
- }
44
- };
45
- n(b, (e) => {
46
- i(g) > 0 && i(_) > 0 && e(x);
47
- }), d(y), u(y, "clientWidth", (e) => a(g, e)), u(y, "clientHeight", (e) => a(_, e)), l(c, y), s();
48
- }
49
- //#endregion
50
- export { h as default };