@svgrid/grid-wc 3.0.4 → 3.0.5

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 (29) hide show
  1. package/dist/{GridMenus-DMkf7UMn.js → GridMenus-Nf04Zcl5.js} +2 -2
  2. package/dist/{SvGrid.helpers-BdVDtjUm.js → SvGrid.helpers-zBkDTryR.js} +36 -37
  3. package/dist/{shadow/SvGridCellEditor-DhXEIlyE.js → SvGridCellEditor-BTbDEgpe.js} +1 -1
  4. package/dist/{shadow/SvGridChart-BMdCbrqb.js → SvGridChart-BSNYAW_W.js} +4 -4
  5. package/dist/{SvGridChartBuilder-Chp_MD1B.js → SvGridChartBuilder-DDl_Bv8k.js} +3 -3
  6. package/dist/{SvGridChartPanel-BIV2O2Lp.js → SvGridChartPanel-DkIR-3rA.js} +6 -6
  7. package/dist/{SvGridChartView-DyhkumD-.js → SvGridChartView-B4pqLWnm.js} +2 -2
  8. package/dist/{shadow/cell-formatting-CBfgahv1.js → cell-formatting-hb3vzxhJ.js} +27 -5
  9. package/dist/{shadow/chart-export-pdf-9OCvhzr0.js → chart-export-pdf-hJVuR7_z.js} +1 -1
  10. package/dist/{chart-D_LKA1fr.js → chart-nwSa4jQe.js} +1 -1
  11. package/dist/{shadow/chart-summary-v3Lhe8YD.js → chart-summary-BL4WDgEu.js} +1 -1
  12. package/dist/{export-format-CAi1mp-1.js → export-format-CXEUNl8j.js} +60 -65
  13. package/dist/shadow/{GridMenus-DMkf7UMn.js → GridMenus-Nf04Zcl5.js} +2 -2
  14. package/dist/shadow/{SvGrid.helpers-BdVDtjUm.js → SvGrid.helpers-zBkDTryR.js} +36 -37
  15. package/dist/{SvGridCellEditor-DhXEIlyE.js → shadow/SvGridCellEditor-BTbDEgpe.js} +1 -1
  16. package/dist/{SvGridChart-BMdCbrqb.js → shadow/SvGridChart-BSNYAW_W.js} +4 -4
  17. package/dist/shadow/{SvGridChartBuilder-Chp_MD1B.js → SvGridChartBuilder-DDl_Bv8k.js} +3 -3
  18. package/dist/shadow/{SvGridChartPanel-BIV2O2Lp.js → SvGridChartPanel-DkIR-3rA.js} +6 -6
  19. package/dist/shadow/{SvGridChartView-DyhkumD-.js → SvGridChartView-B4pqLWnm.js} +2 -2
  20. package/dist/{cell-formatting-CBfgahv1.js → shadow/cell-formatting-hb3vzxhJ.js} +27 -5
  21. package/dist/{chart-export-pdf-9OCvhzr0.js → shadow/chart-export-pdf-hJVuR7_z.js} +1 -1
  22. package/dist/shadow/{chart-D_LKA1fr.js → chart-nwSa4jQe.js} +1 -1
  23. package/dist/{chart-summary-v3Lhe8YD.js → shadow/chart-summary-BL4WDgEu.js} +1 -1
  24. package/dist/shadow/{export-format-mnW_rVBZ.js → export-format-DQtIyOvV.js} +60 -65
  25. package/dist/shadow/sv-grid-shadow-element.js +1960 -1911
  26. package/dist/shadow/{svelte-virtualizer.svelte-CnGhFGDc.js → svelte-virtualizer.svelte-CMX34S17.js} +7 -3
  27. package/dist/sv-grid-element.js +1945 -1896
  28. package/dist/{svelte-virtualizer.svelte-CnGhFGDc.js → svelte-virtualizer.svelte-CMX34S17.js} +7 -3
  29. package/package.json +3 -3
@@ -57,12 +57,34 @@ function n(e, n) {
57
57
  let r = (Array.isArray(e) ? e.join(",") : e ?? "") + "|" + (n.style ?? "") + "|" + (n.currency ?? "") + "|" + (n.minimumFractionDigits ?? "") + "|" + (n.maximumFractionDigits ?? "") + "|" + (n.useGrouping ?? "") + "|" + (n.currencyDisplay ?? "") + "|" + (n.notation ?? "") + "|" + (n.signDisplay ?? "") + "|" + (n.minimumIntegerDigits ?? "") + "|" + (n.compactDisplay ?? "") + "|" + (n.unit ?? "") + "|" + (n.unitDisplay ?? "") + "|" + (n.minimumSignificantDigits ?? "") + "|" + (n.maximumSignificantDigits ?? ""), i = t.get(r);
58
58
  return i || (i = new Intl.NumberFormat(e, n), t.set(r, i)), i;
59
59
  }
60
- var r = /* @__PURE__ */ new Map();
61
- function i(e, t) {
62
- let n = (Array.isArray(e) ? e.join(",") : e ?? "") + "|" + (t.dateStyle ?? "") + "|" + (t.timeStyle ?? "") + "|" + (t.year ?? "") + "|" + (t.month ?? "") + "|" + (t.day ?? "") + "|" + (t.hour ?? "") + "|" + (t.minute ?? "") + "|" + (t.second ?? "") + "|" + (t.weekday ?? "") + "|" + (t.hour12 ?? ""), i = r.get(n);
63
- return i || (i = new Intl.DateTimeFormat(e, t), r.set(n, i)), i;
60
+ function r(e) {
61
+ if (e instanceof Date) return Number.isNaN(e.getTime()) ? null : e;
62
+ if (typeof e == "number") {
63
+ if (!Number.isFinite(e)) return null;
64
+ let t = new Date(e);
65
+ return Number.isNaN(t.getTime()) ? null : t;
66
+ }
67
+ if (typeof e != "string") return null;
68
+ let t = e.trim();
69
+ if (t === "") return null;
70
+ let n = /^(\d{4})-(\d{2})-(\d{2})$/.exec(t);
71
+ if (n) {
72
+ let [e, t, r] = [
73
+ Number(n[1]),
74
+ Number(n[2]) - 1,
75
+ Number(n[3])
76
+ ], i = /* @__PURE__ */ new Date(0);
77
+ return i.setFullYear(e, t, r), i.setHours(0, 0, 0, 0), i.getMonth() === t && i.getDate() === r ? i : null;
78
+ }
79
+ let r = new Date(t);
80
+ return Number.isNaN(r.getTime()) ? null : r;
64
81
  }
82
+ var i = /* @__PURE__ */ new Map();
65
83
  function a(e, t) {
84
+ let n = (Array.isArray(e) ? e.join(",") : e ?? "") + "|" + (t.dateStyle ?? "") + "|" + (t.timeStyle ?? "") + "|" + (t.year ?? "") + "|" + (t.month ?? "") + "|" + (t.day ?? "") + "|" + (t.hour ?? "") + "|" + (t.minute ?? "") + "|" + (t.second ?? "") + "|" + (t.weekday ?? "") + "|" + (t.hour12 ?? ""), r = i.get(n);
85
+ return r || (r = new Intl.DateTimeFormat(e, t), i.set(n, r)), r;
86
+ }
87
+ function o(e, t) {
66
88
  let r = typeof e == "number" ? e : Number(e);
67
89
  if (!Number.isFinite(r)) return String(e ?? "");
68
90
  let i = t.locales;
@@ -83,4 +105,4 @@ function a(e, t) {
83
105
  return n(i, t.options ?? {}).format(r);
84
106
  }
85
107
  //#endregion
86
- export { e as i, i as n, n as r, a as t };
108
+ export { e as a, r as i, a as n, n as r, o as t };
@@ -1,4 +1,4 @@
1
- import { i as e, r as t } from "./SvGridChart-BMdCbrqb.js";
1
+ import { i as e, r as t } from "./SvGridChart-BSNYAW_W.js";
2
2
  //#region ../grid/dist/chart-export-pdf.js
3
3
  var n = {
4
4
  A4: [595.28, 841.89],
@@ -1,4 +1,4 @@
1
- import { r as e } from "./cell-formatting-CBfgahv1.js";
1
+ import { r as e } from "./cell-formatting-hb3vzxhJ.js";
2
2
  //#region \0rolldown/runtime.js
3
3
  var t = Object.defineProperty, n = (e, n) => {
4
4
  let r = {};
@@ -1,4 +1,4 @@
1
- import { A as e, j as t, k as n } from "./chart-D_LKA1fr.js";
1
+ import { A as e, j as t, k as n } from "./chart-nwSa4jQe.js";
2
2
  //#region ../grid/dist/chart-summary.js
3
3
  var r = (e) => typeof e == "number" && Number.isFinite(e);
4
4
  function i(e) {
@@ -1,22 +1,17 @@
1
- import { i as e, n as t, t as n } from "./cell-formatting-CBfgahv1.js";
1
+ import { a as e, i as t, n, t as r } from "./cell-formatting-hb3vzxhJ.js";
2
2
  import "./sv-grid-shadow-element.js";
3
3
  //#region ../grid/dist/export-format.js
4
- function r(e) {
5
- if (e instanceof Date) return Number.isNaN(e.getTime()) ? null : e;
6
- if (typeof e == "number" && Number.isFinite(e)) {
7
- let t = new Date(e);
8
- return Number.isNaN(t.getTime()) ? null : t;
9
- }
10
- if (typeof e == "string" && e.trim() !== "") {
11
- let t = new Date(e);
12
- return Number.isNaN(t.getTime()) ? null : t;
13
- }
14
- return null;
4
+ function i(e) {
5
+ return t(e);
6
+ }
7
+ function a(e) {
8
+ let t = (e, t = 2) => String(Math.abs(e)).padStart(t, "0"), n = -e.getTimezoneOffset(), r = n < 0 ? "-" : "+", i = e.getFullYear();
9
+ return (i < 0 ? "-" + t(i, 6) : t(i, 4)) + `-${t(e.getMonth() + 1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(), 3)}${r}${t(Math.floor(Math.abs(n) / 60))}:${t(Math.abs(n) % 60)}`;
15
10
  }
16
- function i(i, a) {
17
- if (i == null) return "";
18
- if (!a) return String(i);
19
- if (a.type === "number" || a.type === "currency" || a.type === "percent") return n(i, {
11
+ function o(t, a) {
12
+ if (t == null) return "";
13
+ if (!a) return String(t);
14
+ if (a.type === "number" || a.type === "currency" || a.type === "percent") return r(t, {
20
15
  type: a.type,
21
16
  locales: a.locales,
22
17
  currency: a.type === "currency" ? a.currency ?? "USD" : void 0,
@@ -24,10 +19,10 @@ function i(i, a) {
24
19
  options: a.options
25
20
  });
26
21
  if (a.type === "date" || a.type === "datetime") {
27
- let n = r(i);
28
- if (n) {
29
- let r = e(a.pattern, a.type), i = r || a.options ? {
30
- ...r,
22
+ let r = i(t);
23
+ if (r) {
24
+ let t = e(a.pattern, a.type), i = t || a.options ? {
25
+ ...t,
31
26
  ...a.options
32
27
  } : a.type === "date" ? {
33
28
  year: "numeric",
@@ -40,73 +35,73 @@ function i(i, a) {
40
35
  hour: "2-digit",
41
36
  minute: "2-digit"
42
37
  };
43
- return t(a.locales, i).format(n);
38
+ return n(a.locales, i).format(r);
44
39
  }
45
40
  }
46
- return String(i);
41
+ return String(t);
47
42
  }
48
- function a(e, t, n = {}) {
49
- let r = n.columns && n.columns.length ? n.columns.map((e) => t.find((t) => t.field === e)).filter((e) => !!e) : t.filter((e) => e.field), a = r.map((e) => e.field), o = {};
50
- for (let e of r) e.align && (o[e.field] = e.align);
43
+ function s(e, t, n = {}) {
44
+ let r = n.columns && n.columns.length ? n.columns.map((e) => t.find((t) => t.field === e)).filter((e) => !!e) : t.filter((e) => e.field), i = r.map((e) => e.field), a = {};
45
+ for (let e of r) e.align && (a[e.field] = e.align);
51
46
  let s = {};
52
47
  for (let e of r) s[e.field] = e.header;
53
48
  let c = [s];
54
49
  for (let t of e) {
55
50
  let e = {};
56
- for (let a of r) {
57
- let r = t[a.field];
58
- e[a.field] = n.rawValues ? r : i(r, a.format);
51
+ for (let i of r) {
52
+ let r = t[i.field];
53
+ e[i.field] = n.rawValues ? r : o(r, i.format);
59
54
  }
60
55
  c.push(e);
61
56
  }
62
57
  return {
63
58
  records: c,
64
- fields: a,
65
- align: o
59
+ fields: i,
60
+ align: a
66
61
  };
67
62
  }
68
- var o = "";
69
- function s(e) {
63
+ var c = "";
64
+ function l(e) {
70
65
  if (e?.aborted) throw new DOMException("Export aborted", "AbortError");
71
66
  }
72
- var c = () => new Promise((e) => setTimeout(e, 0));
73
- function l(e, t) {
74
- let n = e == null ? "" : e instanceof Date ? e.toISOString() : String(e);
67
+ var u = () => new Promise((e) => setTimeout(e, 0));
68
+ function d(e, t) {
69
+ let n = e == null ? "" : e instanceof Date ? a(e) : String(e);
75
70
  return n === "" ? n : n.includes(t) || n.includes("\"") || n.includes("\n") || n.includes("\r") ? `"${n.replace(/"/g, "\"\"")}"` : n;
76
71
  }
77
- async function u(e, t, n = {}) {
78
- let r = n.csv?.delimiter ?? ",", i = n.csv?.eol ?? "\r\n", a = n.csv?.bom ?? !0, u = Math.max(1, n.chunkRows ?? 5e3), d = e.length, f = [];
72
+ async function f(e, t, n = {}) {
73
+ let r = n.csv?.delimiter ?? ",", i = n.csv?.eol ?? "\r\n", a = n.csv?.bom ?? !0, o = Math.max(1, n.chunkRows ?? 5e3), s = e.length, f = [];
79
74
  for (let i = 0; i < e.length; i++) {
80
- s(n.signal);
75
+ l(n.signal);
81
76
  let a = e[i];
82
- f.push(t.map((e) => l(a[e], r)).join(r)), i > 0 && i % u === 0 && (n.onProgress?.({
77
+ f.push(t.map((e) => d(a[e], r)).join(r)), i > 0 && i % o === 0 && (n.onProgress?.({
83
78
  phase: "serialize",
84
- ratio: i / d,
79
+ ratio: i / s,
85
80
  row: i,
86
- total: d
87
- }), await c());
81
+ total: s
82
+ }), await u());
88
83
  }
89
84
  n.onProgress?.({
90
85
  phase: "serialize",
91
86
  ratio: 1,
92
- row: d,
93
- total: d
87
+ row: s,
88
+ total: s
94
89
  });
95
90
  let p = f.join(i);
96
- return (a ? o : "") + p;
91
+ return (a ? c : "") + p;
97
92
  }
98
- async function d(e, t, n = {}) {
93
+ async function p(e, t, n = {}) {
99
94
  let r = Math.max(1, n.chunkRows ?? 5e3), i = e.length - 1, a = [];
100
95
  for (let o = 1; o < e.length; o++) {
101
- s(n.signal);
102
- let l = e[o], u = {};
103
- for (let e of t) u[e] = l[e];
104
- a.push(u), o > 0 && o % r === 0 && (n.onProgress?.({
96
+ l(n.signal);
97
+ let s = e[o], c = {};
98
+ for (let e of t) c[e] = s[e];
99
+ a.push(c), o > 0 && o % r === 0 && (n.onProgress?.({
105
100
  phase: "serialize",
106
101
  ratio: o / i,
107
102
  row: o,
108
103
  total: i
109
- }), await c());
104
+ }), await u());
110
105
  }
111
106
  return n.onProgress?.({
112
107
  phase: "serialize",
@@ -115,23 +110,23 @@ async function d(e, t, n = {}) {
115
110
  total: i
116
111
  }), JSON.stringify(a, null, 2);
117
112
  }
118
- function f(e) {
119
- return (e == null ? "" : e instanceof Date ? e.toISOString() : String(e)).replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/\r?\n/g, "<br>");
113
+ function m(e) {
114
+ return (e == null ? "" : e instanceof Date ? a(e) : String(e)).replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/\r?\n/g, "<br>");
120
115
  }
121
- async function p(e, t, n = {}) {
122
- let r = Math.max(1, n.chunkRows ?? 5e3), i = e.length, a = n.align ?? {}, o = e[0], l = `| ${t.map((e) => f(o?.[e])).join(" | ")} |`, u = `| ${t.map((e) => {
116
+ async function h(e, t, n = {}) {
117
+ let r = Math.max(1, n.chunkRows ?? 5e3), i = e.length, a = n.align ?? {}, o = e[0], s = `| ${t.map((e) => m(o?.[e])).join(" | ")} |`, c = `| ${t.map((e) => {
123
118
  let t = a[e];
124
119
  return t === "right" ? "---:" : t === "center" ? ":--:" : "---";
125
120
  }).join(" | ")} |`, d = [];
126
121
  for (let a = 1; a < e.length; a++) {
127
- s(n.signal);
122
+ l(n.signal);
128
123
  let o = e[a];
129
- d.push(`| ${t.map((e) => f(o[e])).join(" | ")} |`), a > 0 && a % r === 0 && (n.onProgress?.({
124
+ d.push(`| ${t.map((e) => m(o[e])).join(" | ")} |`), a > 0 && a % r === 0 && (n.onProgress?.({
130
125
  phase: "serialize",
131
126
  ratio: a / i,
132
127
  row: a,
133
128
  total: i
134
- }), await c());
129
+ }), await u());
135
130
  }
136
131
  return n.onProgress?.({
137
132
  phase: "serialize",
@@ -139,23 +134,23 @@ async function p(e, t, n = {}) {
139
134
  row: i,
140
135
  total: i
141
136
  }), [
142
- l,
143
- u,
137
+ s,
138
+ c,
144
139
  ...d
145
140
  ].join("\n") + "\n";
146
141
  }
147
- function m(e, t) {
142
+ function g(e, t) {
148
143
  if (typeof document > "u" || typeof URL > "u") throw Error("@svgrid/grid: export requires a browser environment");
149
144
  let n = URL.createObjectURL(e), r = document.createElement("a");
150
145
  r.href = n, r.download = t, document.body.appendChild(r), r.click(), r.remove(), setTimeout(() => URL.revokeObjectURL(n), 0);
151
146
  }
152
- function h(e, t, n) {
147
+ function _(e, t, n) {
153
148
  if (typeof document > "u" || typeof URL > "u") throw Error("@svgrid/grid: text export requires a browser environment");
154
- m(new Blob([e], { type: n }), t);
149
+ g(new Blob([e], { type: n }), t);
155
150
  }
156
- async function g(e) {
151
+ async function v(e) {
157
152
  if (typeof navigator > "u" || !navigator.clipboard) throw Error("@svgrid/grid: clipboard API is unavailable in this context");
158
153
  await navigator.clipboard.writeText(e);
159
154
  }
160
155
  //#endregion
161
- export { g as copyTextToClipboard, h as downloadTextFile, a as projectGridRows, u as serializeDelimited, d as serializeJson, p as serializeMarkdown };
156
+ export { v as copyTextToClipboard, _ as downloadTextFile, s as projectGridRows, f as serializeDelimited, p as serializeJson, h as serializeMarkdown };