@svgrid/grid-wc 3.0.3 → 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.
- package/dist/{GridMenus-DMkf7UMn.js → GridMenus-Nf04Zcl5.js} +2 -2
- package/dist/{SvGrid.helpers-BdVDtjUm.js → SvGrid.helpers-zBkDTryR.js} +36 -37
- package/dist/{shadow/SvGridCellEditor-DhXEIlyE.js → SvGridCellEditor-BTbDEgpe.js} +1 -1
- package/dist/{shadow/SvGridChart-BMdCbrqb.js → SvGridChart-BSNYAW_W.js} +4 -4
- package/dist/{SvGridChartBuilder-Chp_MD1B.js → SvGridChartBuilder-DDl_Bv8k.js} +3 -3
- package/dist/{SvGridChartPanel-BIV2O2Lp.js → SvGridChartPanel-DkIR-3rA.js} +6 -6
- package/dist/{SvGridChartView-DyhkumD-.js → SvGridChartView-B4pqLWnm.js} +2 -2
- package/dist/{shadow/cell-formatting-CBfgahv1.js → cell-formatting-hb3vzxhJ.js} +27 -5
- package/dist/{shadow/chart-export-pdf-9OCvhzr0.js → chart-export-pdf-hJVuR7_z.js} +1 -1
- package/dist/{chart-D_LKA1fr.js → chart-nwSa4jQe.js} +1 -1
- package/dist/{shadow/chart-summary-v3Lhe8YD.js → chart-summary-BL4WDgEu.js} +1 -1
- package/dist/{export-format-CAi1mp-1.js → export-format-CXEUNl8j.js} +60 -65
- package/dist/shadow/{GridMenus-DMkf7UMn.js → GridMenus-Nf04Zcl5.js} +2 -2
- package/dist/shadow/{SvGrid.helpers-BdVDtjUm.js → SvGrid.helpers-zBkDTryR.js} +36 -37
- package/dist/{SvGridCellEditor-DhXEIlyE.js → shadow/SvGridCellEditor-BTbDEgpe.js} +1 -1
- package/dist/{SvGridChart-BMdCbrqb.js → shadow/SvGridChart-BSNYAW_W.js} +4 -4
- package/dist/shadow/{SvGridChartBuilder-Chp_MD1B.js → SvGridChartBuilder-DDl_Bv8k.js} +3 -3
- package/dist/shadow/{SvGridChartPanel-BIV2O2Lp.js → SvGridChartPanel-DkIR-3rA.js} +6 -6
- package/dist/shadow/{SvGridChartView-DyhkumD-.js → SvGridChartView-B4pqLWnm.js} +2 -2
- package/dist/{cell-formatting-CBfgahv1.js → shadow/cell-formatting-hb3vzxhJ.js} +27 -5
- package/dist/{chart-export-pdf-9OCvhzr0.js → shadow/chart-export-pdf-hJVuR7_z.js} +1 -1
- package/dist/shadow/{chart-D_LKA1fr.js → chart-nwSa4jQe.js} +1 -1
- package/dist/{chart-summary-v3Lhe8YD.js → shadow/chart-summary-BL4WDgEu.js} +1 -1
- package/dist/shadow/{export-format-mnW_rVBZ.js → export-format-DQtIyOvV.js} +60 -65
- package/dist/shadow/sv-grid-shadow-element.js +1960 -1911
- package/dist/shadow/{svelte-virtualizer.svelte-CnGhFGDc.js → svelte-virtualizer.svelte-CMX34S17.js} +7 -3
- package/dist/sv-grid-element.js +1945 -1896
- package/dist/{svelte-virtualizer.svelte-CnGhFGDc.js → svelte-virtualizer.svelte-CMX34S17.js} +7 -3
- 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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
|
108
|
+
export { e as a, r as i, a as n, n as r, o as t };
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
import {
|
|
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
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
17
|
-
if (
|
|
18
|
-
if (!a) return String(
|
|
19
|
-
if (a.type === "number" || a.type === "currency" || a.type === "percent") return
|
|
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
|
|
28
|
-
if (
|
|
29
|
-
let
|
|
30
|
-
...
|
|
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
|
|
38
|
+
return n(a.locales, i).format(r);
|
|
44
39
|
}
|
|
45
40
|
}
|
|
46
|
-
return String(
|
|
41
|
+
return String(t);
|
|
47
42
|
}
|
|
48
|
-
function
|
|
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),
|
|
50
|
-
for (let e of r) 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
|
|
57
|
-
let r = t[
|
|
58
|
-
e[
|
|
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:
|
|
65
|
-
align:
|
|
59
|
+
fields: i,
|
|
60
|
+
align: a
|
|
66
61
|
};
|
|
67
62
|
}
|
|
68
|
-
var
|
|
69
|
-
function
|
|
63
|
+
var c = "";
|
|
64
|
+
function l(e) {
|
|
70
65
|
if (e?.aborted) throw new DOMException("Export aborted", "AbortError");
|
|
71
66
|
}
|
|
72
|
-
var
|
|
73
|
-
function
|
|
74
|
-
let n = e == null ? "" : e instanceof Date ? 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
|
|
78
|
-
let r = n.csv?.delimiter ?? ",", i = n.csv?.eol ?? "\r\n", a = n.csv?.bom ?? !0,
|
|
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
|
-
|
|
75
|
+
l(n.signal);
|
|
81
76
|
let a = e[i];
|
|
82
|
-
f.push(t.map((e) =>
|
|
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 /
|
|
79
|
+
ratio: i / s,
|
|
85
80
|
row: i,
|
|
86
|
-
total:
|
|
87
|
-
}), await
|
|
81
|
+
total: s
|
|
82
|
+
}), await u());
|
|
88
83
|
}
|
|
89
84
|
n.onProgress?.({
|
|
90
85
|
phase: "serialize",
|
|
91
86
|
ratio: 1,
|
|
92
|
-
row:
|
|
93
|
-
total:
|
|
87
|
+
row: s,
|
|
88
|
+
total: s
|
|
94
89
|
});
|
|
95
90
|
let p = f.join(i);
|
|
96
|
-
return (a ?
|
|
91
|
+
return (a ? c : "") + p;
|
|
97
92
|
}
|
|
98
|
-
async function
|
|
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
|
-
|
|
102
|
-
let
|
|
103
|
-
for (let e of t)
|
|
104
|
-
a.push(
|
|
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
|
|
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
|
|
119
|
-
return (e == null ? "" : e instanceof Date ? e
|
|
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
|
|
122
|
-
let r = Math.max(1, n.chunkRows ?? 5e3), i = e.length, a = n.align ?? {}, o = e[0],
|
|
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
|
-
|
|
122
|
+
l(n.signal);
|
|
128
123
|
let o = e[a];
|
|
129
|
-
d.push(`| ${t.map((e) =>
|
|
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
|
|
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
|
-
|
|
143
|
-
|
|
137
|
+
s,
|
|
138
|
+
c,
|
|
144
139
|
...d
|
|
145
140
|
].join("\n") + "\n";
|
|
146
141
|
}
|
|
147
|
-
function
|
|
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
|
|
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
|
-
|
|
149
|
+
g(new Blob([e], { type: n }), t);
|
|
155
150
|
}
|
|
156
|
-
async function
|
|
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 {
|
|
156
|
+
export { v as copyTextToClipboard, _ as downloadTextFile, s as projectGridRows, f as serializeDelimited, p as serializeJson, h as serializeMarkdown };
|