@svgrid/grid 3.0.5 → 3.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -7
- package/dist/GridMenus.svelte +34 -4
- package/dist/SvGrid.controller.svelte.d.ts +23 -3
- package/dist/SvGrid.controller.svelte.js +235 -54
- package/dist/SvGrid.css +143 -7
- package/dist/SvGrid.helpers.js +2 -4
- package/dist/SvGrid.svelte +223 -38
- package/dist/SvGrid.types.d.ts +77 -4
- package/dist/SvGridDropdown.svelte +20 -0
- package/dist/SvGridDropdown.svelte.d.ts +12 -0
- package/dist/SvModal.svelte +22 -0
- package/dist/SvModal.svelte.d.ts +7 -0
- package/dist/a11y/dismissable.d.ts +10 -0
- package/dist/a11y/dismissable.js +24 -2
- package/dist/build-api.js +81 -31
- package/dist/cdn/{GridMenus-CID62rlI.js → GridMenus-BgUS-W3o.js} +151 -142
- package/dist/cdn/GridMenus-CcwU8I4t.js +644 -0
- package/dist/cdn/{SvChartMenu-FBSMINA6.js → SvChartMenu-BFSTpvB-.js} +1 -1
- package/dist/cdn/{SvChartMenu-Bl6PBbkT.js → SvChartMenu-BZ1Iwv0y.js} +1 -1
- package/dist/cdn/{SvDateTimePicker-DQwt4UAs.js → SvDateTimePicker-D9u_cOf8.js} +1 -1
- package/dist/cdn/{SvDateTimePicker-vNU6bZ-q.js → SvDateTimePicker-s_6IUpI7.js} +1 -1
- package/dist/cdn/{SvGridCellEditor-B1p-vCK5.js → SvGridCellEditor-9yz-SbdZ.js} +2 -2
- package/dist/cdn/{SvGridCellEditor-D_0q4xAu.js → SvGridCellEditor-D7-ql1Hd.js} +2 -2
- package/dist/cdn/{SvGridChart-C3EWAZaM.js → SvGridChart-DMUOFxOe.js} +4 -4
- package/dist/cdn/{SvGridChart-DzLkSwCH.js → SvGridChart-N7ik0oWy.js} +4 -4
- package/dist/cdn/{SvGridChartBuilder-CfII62sZ.js → SvGridChartBuilder-CB_Jnm2k.js} +4 -4
- package/dist/cdn/{SvGridChartBuilder-BE2T1ykB.js → SvGridChartBuilder-Ca7gF8ZK.js} +4 -4
- package/dist/cdn/{SvGridChartPanel-xf4sWVTo.js → SvGridChartPanel-9GOJRHP7.js} +5 -5
- package/dist/cdn/{SvGridChartPanel-CCX5_Wgd.js → SvGridChartPanel-Dl-FujN8.js} +5 -5
- package/dist/cdn/{SvGridChartView-CfuXmY5I.js → SvGridChartView-B1LFgoPP.js} +2 -2
- package/dist/cdn/{SvGridChartView-DYwabQWj.js → SvGridChartView-By3n7DGZ.js} +2 -2
- package/dist/cdn/{SvGridDropdown-D0VdjeR8.js → SvGridDropdown-BWeM3lMe.js} +46 -46
- package/dist/cdn/{SvGridDropdown-D13MtJ2j.js → SvGridDropdown-CJ6QqTxu.js} +67 -67
- package/dist/cdn/{SvModal-CIZWCcad.js → SvModal-ClxGmpAc.js} +187 -186
- package/dist/cdn/{SvModal-BAE-pjZX.js → SvModal-DhB_VMFR.js} +148 -147
- package/dist/cdn/{cell-formatting-C2Hf5gqd.js → cell-formatting-Mnv84zoE.js} +28 -6
- package/dist/cdn/{chart-Dz7SqMXH.js → chart-By7h2Guv.js} +1 -1
- package/dist/cdn/{chart-panel-messages-CUbf2R4i.js → chart-panel-messages-BC-tOgFY.js} +1 -1
- package/dist/cdn/{chart-panel-messages-CmNrMdsr.js → chart-panel-messages-DUaXr-sb.js} +1 -1
- package/dist/cdn/{chart-summary-BJW_tg_X.js → chart-summary-BDtrNEiA.js} +1 -1
- package/dist/cdn/{chart-trend-CaN9mDEV.js → chart-trend-C1aOAPBZ.js} +1 -1
- package/dist/cdn/{dismissable-DAHetSNk.js → dismissable-Brc4EZU1.js} +5 -1
- package/dist/cdn/{editor-registry-BhgE3S84.js → editor-registry-BVeHvlZR.js} +49 -50
- package/dist/cdn/{export-format-CUDLy2yn.js → export-format-y1wdyCcv.js} +93 -97
- package/dist/cdn/{row-resize-niQCp040.js → row-resize-DtOS1KG6.js} +41 -32
- package/dist/cdn/{server-block-cache-CGoWz-87.js → server-block-cache-DIqb3VZn.js} +4 -0
- package/dist/cdn/{src-jcFMkBnN.js → src-25JmJ_7g.js} +4768 -4149
- package/dist/cdn/{src-Bklofsad.js → src-kE9B98r6.js} +4796 -4177
- package/dist/cdn/svgrid.js +18 -18
- package/dist/cdn/svgrid.svelte-external.js +18 -18
- package/dist/cdn/{validate-C7Rn_Bns.js → validate-AZoD8BoR.js} +6 -2
- package/dist/cell-formatting.d.ts +9 -0
- package/dist/cell-formatting.js +52 -1
- package/dist/cell-render.js +25 -6
- package/dist/clipboard.d.ts +2 -2
- package/dist/clipboard.js +72 -23
- package/dist/columns.js +7 -2
- package/dist/conditional-formatting.d.ts +2 -0
- package/dist/conditional-formatting.js +2 -0
- package/dist/core.d.ts +22 -6
- package/dist/core.js +478 -40
- package/dist/editing.js +24 -0
- package/dist/export-format.d.ts +8 -0
- package/dist/export-format.js +23 -16
- package/dist/grid-messages.d.ts +4 -0
- package/dist/grid-messages.js +4 -0
- package/dist/headless.d.ts +5 -0
- package/dist/headless.js +12 -0
- package/dist/history.d.ts +21 -0
- package/dist/history.js +34 -4
- package/dist/index.d.ts +1 -1
- package/dist/keyboard-handlers.js +24 -1
- package/dist/keyboard.js +4 -0
- package/dist/row-drag-touch.d.ts +1 -1
- package/dist/row-drag.js +35 -1
- package/dist/row-model.d.ts +6 -0
- package/dist/row-resize.js +22 -1
- package/dist/selection.js +1 -1
- package/dist/server-block-cache.d.ts +5 -0
- package/dist/server-block-cache.js +8 -0
- package/dist/server-data-source.d.ts +35 -3
- package/dist/server-data-source.js +11 -2
- package/dist/server.d.ts +1 -1
- package/dist/sparkline.js +7 -5
- package/dist/svgrid-wrapper.types.d.ts +33 -0
- package/dist/validate.js +9 -1
- package/dist/virtualization/column-virtualizer.d.ts +1 -0
- package/dist/virtualization/svelte-virtualizer.svelte.d.ts +1 -0
- package/dist/virtualization/svelte-virtualizer.svelte.js +1 -0
- package/dist/virtualization/virtualizer.d.ts +3 -0
- package/dist/virtualization/virtualizer.js +14 -1
- package/package.json +6 -1
- package/src/GridMenus.svelte +34 -4
- package/src/SvGrid.controller.svelte.ts +236 -57
- package/src/SvGrid.css +143 -7
- package/src/SvGrid.helpers.ts +2 -4
- package/src/SvGrid.svelte +223 -38
- package/src/SvGrid.types.ts +77 -4
- package/src/SvGridDropdown.svelte +20 -0
- package/src/SvModal.svelte +22 -0
- package/src/SvModal.test.ts +30 -1
- package/src/a11y/dismissable.test.ts +10 -1
- package/src/a11y/dismissable.ts +22 -2
- package/src/build-api.ts +85 -27
- package/src/cell-formatting.test.ts +17 -0
- package/src/cell-formatting.ts +49 -1
- package/src/cell-render.test.ts +24 -2
- package/src/cell-render.ts +24 -8
- package/src/clipboard.test.ts +107 -0
- package/src/clipboard.ts +62 -23
- package/src/columns.test.ts +4 -4
- package/src/columns.ts +7 -2
- package/src/conditional-formatting.test.ts +8 -0
- package/src/conditional-formatting.ts +3 -0
- package/src/core.sort.test.ts +86 -0
- package/src/core.tick-repair.test.ts +287 -0
- package/src/core.ts +478 -40
- package/src/editing.test.ts +52 -0
- package/src/editing.ts +25 -0
- package/src/export-dates.test.ts +114 -0
- package/src/export-format.ts +26 -14
- package/src/grid-messages.test.ts +7 -0
- package/src/grid-messages.ts +10 -0
- package/src/headless.ts +24 -0
- package/src/history.test.ts +49 -1
- package/src/history.ts +48 -2
- package/src/index.ts +2 -0
- package/src/keyboard-handlers.coverage.test.ts +65 -0
- package/src/keyboard-handlers.ts +26 -1
- package/src/keyboard.ts +3 -0
- package/src/row-drag-touch.ts +2 -2
- package/src/row-drag.test.ts +51 -0
- package/src/row-drag.ts +35 -2
- package/src/row-model.ts +6 -0
- package/src/row-resize.ts +24 -1
- package/src/selection.ts +1 -1
- package/src/server-block-cache.test.ts +27 -0
- package/src/server-block-cache.ts +13 -0
- package/src/server-data-source.infinite.test.ts +62 -0
- package/src/server-data-source.test.ts +19 -0
- package/src/server-data-source.ts +48 -4
- package/src/server.ts +2 -0
- package/src/sparkline.test.ts +7 -0
- package/src/sparkline.ts +6 -4
- package/src/svgrid-wrapper.types.ts +32 -0
- package/src/svgrid.api.test.ts +21 -0
- package/src/svgrid.charting.test.ts +12 -4
- package/src/svgrid.context-menu.test.ts +12 -0
- package/src/svgrid.data-push.svelte.test.ts +94 -0
- package/src/svgrid.detail-rows.svelte.test.ts +187 -0
- package/src/svgrid.filter-menu-scroll.test.ts +9 -0
- package/src/svgrid.gantt-seam.test.ts +1 -1
- package/src/svgrid.live-update-paths.svelte.test.ts +186 -0
- package/src/svgrid.menu-scroll-close.test.ts +10 -0
- package/src/svgrid.row-model-seam.svelte.test.ts +16 -0
- package/src/svgrid.row-pinning.test.ts +15 -1
- package/src/svgrid.selection-bar-seam.test.ts +1 -1
- package/src/svgrid.sticky-groups.svelte.test.ts +145 -0
- package/src/svgrid.upsell-license.test.ts +1 -1
- package/src/test-setup.ts +12 -0
- package/src/transaction.test.ts +58 -0
- package/src/validate.ts +7 -1
- package/src/virtualization/svelte-virtualizer.svelte.ts +1 -0
- package/src/virtualization/virtualizer.test.ts +44 -0
- package/src/virtualization/virtualizer.ts +13 -1
- package/dist/cdn/GridMenus-DLL-qZeu.js +0 -635
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import { i as e } from "./cell-formatting-Mnv84zoE.js";
|
|
1
2
|
//#region src/SvGrid.helpers.ts
|
|
2
|
-
function
|
|
3
|
+
function t(e) {
|
|
3
4
|
let t = "";
|
|
4
5
|
return e.color && (t += `color:${e.color};`), e.fontWeight != null && (t += `font-weight:${e.fontWeight};`), t;
|
|
5
6
|
}
|
|
6
|
-
function
|
|
7
|
+
function n(e) {
|
|
7
8
|
return Number.isInteger(e) ? e.toLocaleString() : e.toLocaleString(void 0, { maximumFractionDigits: 2 });
|
|
8
9
|
}
|
|
9
|
-
function
|
|
10
|
+
function r(e, t) {
|
|
10
11
|
return `${e}:${t}`;
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
+
function i(e) {
|
|
13
14
|
if (!e) return "";
|
|
14
15
|
if (typeof e == "string") return e;
|
|
15
16
|
if (Array.isArray(e)) return e.filter(Boolean).join(" ");
|
|
@@ -20,22 +21,22 @@ function r(e) {
|
|
|
20
21
|
}
|
|
21
22
|
return "";
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
+
function a(e) {
|
|
24
25
|
if (e == null || e === "") return "";
|
|
25
26
|
if (typeof e == "string" && /^\d{4}-\d{2}-\d{2}$/.test(e)) return e;
|
|
26
27
|
let t = e instanceof Date ? e : new Date(e);
|
|
27
28
|
return Number.isNaN(t.getTime()) ? "" : t.toISOString().slice(0, 10);
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
+
function o(e) {
|
|
30
31
|
if (e == null || e === "") return "";
|
|
31
32
|
if (typeof e == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/.test(e)) return e;
|
|
32
33
|
let t = e instanceof Date ? e : new Date(e);
|
|
33
34
|
return Number.isNaN(t.getTime()) ? "" : t.toISOString().slice(0, 16);
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
+
function s(e) {
|
|
36
37
|
return String(e).replace(/-native$/, "");
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function c(e) {
|
|
39
40
|
if (e instanceof Date) return e;
|
|
40
41
|
if (typeof e == "string") {
|
|
41
42
|
let t = e.match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?/);
|
|
@@ -46,23 +47,23 @@ function s(e) {
|
|
|
46
47
|
}
|
|
47
48
|
return null;
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
+
function l(e) {
|
|
50
51
|
return e ? `${String(e.getHours()).padStart(2, "0")}:${String(e.getMinutes()).padStart(2, "0")}` : null;
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
-
let n =
|
|
54
|
-
return n === "date" ?
|
|
53
|
+
function u(e, t) {
|
|
54
|
+
let n = s(e);
|
|
55
|
+
return n === "date" ? a(t) : n === "datetime" ? o(t) : String(t ?? "");
|
|
55
56
|
}
|
|
56
|
-
function
|
|
57
|
-
let t =
|
|
57
|
+
function d(e) {
|
|
58
|
+
let t = s(e);
|
|
58
59
|
return t === "number" ? "number" : t === "date" ? "date" : t === "datetime" ? "datetime-local" : t === "time" ? "time" : t === "password" ? "password" : t === "color" ? "color" : "text";
|
|
59
60
|
}
|
|
60
|
-
function
|
|
61
|
+
function f(e) {
|
|
61
62
|
if (!e || Number.isNaN(e.getTime())) return "";
|
|
62
63
|
let t = (e) => String(e).padStart(2, "0");
|
|
63
64
|
return `${e.getFullYear()}-${t(e.getMonth() + 1)}-${t(e.getDate())}`;
|
|
64
65
|
}
|
|
65
|
-
function
|
|
66
|
+
function p(e) {
|
|
66
67
|
if (!e) return null;
|
|
67
68
|
let t = /^(\d{4})-(\d{2})-(\d{2})/.exec(e);
|
|
68
69
|
if (!t) {
|
|
@@ -72,46 +73,44 @@ function f(e) {
|
|
|
72
73
|
let n = new Date(Number(t[1]), Number(t[2]) - 1, Number(t[3]));
|
|
73
74
|
return Number.isNaN(n.getTime()) ? null : n;
|
|
74
75
|
}
|
|
75
|
-
function
|
|
76
|
+
function m(e) {
|
|
76
77
|
if (!e || String(e).endsWith("-native")) return !1;
|
|
77
|
-
let t =
|
|
78
|
+
let t = s(e);
|
|
78
79
|
return t === "date" || t === "datetime" || t === "time";
|
|
79
80
|
}
|
|
80
|
-
function m(e) {
|
|
81
|
-
return o(e) === "number" ? "text" : u(e);
|
|
82
|
-
}
|
|
83
81
|
function h(e) {
|
|
84
|
-
return
|
|
82
|
+
return s(e) === "number" ? "text" : d(e);
|
|
85
83
|
}
|
|
86
84
|
function g(e) {
|
|
85
|
+
return /^-?(\d*\.?\d*)(e-?\d*)?$/i.test(e);
|
|
86
|
+
}
|
|
87
|
+
function _(e) {
|
|
87
88
|
return e == null || e === "" ? [] : Array.isArray(e) ? e.filter((e) => e != null && e !== "") : [e];
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
+
function v(e, t) {
|
|
90
91
|
let n = e.find((e) => e.value === t || String(e.value) === String(t));
|
|
91
92
|
return n ? n.label : String(t ?? "");
|
|
92
93
|
}
|
|
93
|
-
function
|
|
94
|
+
function y(e, t) {
|
|
94
95
|
return e.find((e) => e.value === t || String(e.value) === String(t))?.color;
|
|
95
96
|
}
|
|
96
|
-
function
|
|
97
|
+
function b(e) {
|
|
97
98
|
return e ? `background: color-mix(in srgb, ${e} 22%, transparent);border-color: color-mix(in srgb, ${e} 45%, transparent);color: color-mix(in srgb, ${e} 80%, var(--sg-fg, #0f172a));` : "";
|
|
98
99
|
}
|
|
99
|
-
function
|
|
100
|
-
let t =
|
|
100
|
+
function x(e) {
|
|
101
|
+
let t = s(e);
|
|
101
102
|
return t === "number" ? "sv-grid-cell-editor sv-grid-cell-editor-number" : t === "date" ? "sv-grid-cell-editor sv-grid-cell-editor-date" : t === "datetime" ? "sv-grid-cell-editor sv-grid-cell-editor-datetime" : t === "color" ? "sv-grid-cell-editor sv-grid-cell-editor-color" : "sv-grid-cell-editor";
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
-
|
|
105
|
-
let t = e instanceof Date ? e : new Date(e);
|
|
106
|
-
return Number.isNaN(t.getTime()) ? null : t;
|
|
104
|
+
function S(t) {
|
|
105
|
+
return e(t);
|
|
107
106
|
}
|
|
108
|
-
function
|
|
107
|
+
function C(e, t) {
|
|
109
108
|
return Math.max(8, Math.min(e, window.innerWidth - t - 8));
|
|
110
109
|
}
|
|
111
|
-
function
|
|
110
|
+
function w(e) {
|
|
112
111
|
return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/"/g, "\\\"");
|
|
113
112
|
}
|
|
114
|
-
function
|
|
113
|
+
function T(e, t) {
|
|
115
114
|
if (e == null || e === "") return NaN;
|
|
116
115
|
if (t) {
|
|
117
116
|
let t = (e instanceof Date ? e : new Date(String(e))).getTime();
|
|
@@ -120,11 +119,11 @@ function w(e, t) {
|
|
|
120
119
|
let n = typeof e == "number" ? e : Number(e);
|
|
121
120
|
return Number.isFinite(n) ? n : NaN;
|
|
122
121
|
}
|
|
123
|
-
function
|
|
122
|
+
function E(e) {
|
|
124
123
|
let t = Math.abs(e), n = t >= 1e3 ? 0 : t >= 100 ? 1 : t >= 1 ? 2 : 4;
|
|
125
124
|
return e.toLocaleString(void 0, { maximumFractionDigits: n });
|
|
126
125
|
}
|
|
127
|
-
function
|
|
126
|
+
function D(e) {
|
|
128
127
|
return new Date(e).toLocaleDateString(void 0, {
|
|
129
128
|
year: "numeric",
|
|
130
129
|
month: "short",
|
|
@@ -133,23 +132,23 @@ function E(e) {
|
|
|
133
132
|
}
|
|
134
133
|
//#endregion
|
|
135
134
|
//#region src/editor-registry.ts
|
|
136
|
-
var
|
|
137
|
-
function
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
function k(e) {
|
|
141
|
-
return D.get(e);
|
|
135
|
+
var O = /* @__PURE__ */ new Map();
|
|
136
|
+
function k(e, t) {
|
|
137
|
+
O.set(e, typeof t == "function" ? { component: t } : t);
|
|
142
138
|
}
|
|
143
139
|
function A(e) {
|
|
144
|
-
return
|
|
140
|
+
return O.get(e);
|
|
145
141
|
}
|
|
146
142
|
function j(e) {
|
|
147
|
-
|
|
143
|
+
return O.has(e);
|
|
144
|
+
}
|
|
145
|
+
function M(e) {
|
|
146
|
+
O.delete(e);
|
|
148
147
|
}
|
|
149
|
-
function
|
|
150
|
-
return [...
|
|
148
|
+
function N() {
|
|
149
|
+
return [...O.keys()];
|
|
151
150
|
}
|
|
152
|
-
function
|
|
151
|
+
function P(e) {
|
|
153
152
|
return {
|
|
154
153
|
value: e.value,
|
|
155
154
|
onChange: e.onChange,
|
|
@@ -160,8 +159,8 @@ function N(e) {
|
|
|
160
159
|
inCell: e.inCell
|
|
161
160
|
};
|
|
162
161
|
}
|
|
163
|
-
function
|
|
164
|
-
return e.props ? e.props(t) :
|
|
162
|
+
function F(e, t) {
|
|
163
|
+
return e.props ? e.props(t) : P(t);
|
|
165
164
|
}
|
|
166
165
|
//#endregion
|
|
167
|
-
export {
|
|
166
|
+
export { _ as A, y as C, i as D, T as E, c as O, d as S, g as T, p as _, N as a, u as b, S as c, b as d, w as f, E as g, D as h, k as i, m as j, f as k, t as l, n as m, A as n, F as o, l as p, j as r, M as s, P as t, C as u, h as v, v as w, x, r as y };
|
|
@@ -1,50 +1,46 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a as t, i as n, n as r, t as i } from "./cell-formatting-Mnv84zoE.js";
|
|
3
3
|
//#region src/export-format.ts
|
|
4
|
-
var
|
|
5
|
-
coerceExportDate: () =>
|
|
6
|
-
copyTextToClipboard: () =>
|
|
7
|
-
downloadBlobFile: () =>
|
|
8
|
-
downloadTextFile: () =>
|
|
9
|
-
formatValueForExport: () =>
|
|
10
|
-
projectGridRows: () =>
|
|
11
|
-
serializeDelimited: () =>
|
|
12
|
-
serializeHtml: () =>
|
|
13
|
-
serializeJson: () =>
|
|
14
|
-
serializeMarkdown: () =>
|
|
15
|
-
serializeXml: () =>
|
|
16
|
-
toExcelNumFmt: () =>
|
|
17
|
-
|
|
4
|
+
var a = /* @__PURE__ */ e({
|
|
5
|
+
coerceExportDate: () => o,
|
|
6
|
+
copyTextToClipboard: () => A,
|
|
7
|
+
downloadBlobFile: () => O,
|
|
8
|
+
downloadTextFile: () => k,
|
|
9
|
+
formatValueForExport: () => c,
|
|
10
|
+
projectGridRows: () => u,
|
|
11
|
+
serializeDelimited: () => _,
|
|
12
|
+
serializeHtml: () => b,
|
|
13
|
+
serializeJson: () => x,
|
|
14
|
+
serializeMarkdown: () => C,
|
|
15
|
+
serializeXml: () => D,
|
|
16
|
+
toExcelNumFmt: () => l,
|
|
17
|
+
toLocalIsoString: () => s,
|
|
18
|
+
valueForExcel: () => f
|
|
18
19
|
});
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
if (typeof e == "number" && Number.isFinite(e)) {
|
|
22
|
-
let t = new Date(e);
|
|
23
|
-
return Number.isNaN(t.getTime()) ? null : t;
|
|
24
|
-
}
|
|
25
|
-
if (typeof e == "string" && e.trim() !== "") {
|
|
26
|
-
let t = new Date(e);
|
|
27
|
-
return Number.isNaN(t.getTime()) ? null : t;
|
|
28
|
-
}
|
|
29
|
-
return null;
|
|
20
|
+
function o(e) {
|
|
21
|
+
return n(e);
|
|
30
22
|
}
|
|
31
|
-
function
|
|
23
|
+
function s(e) {
|
|
24
|
+
let t = (e, t = 2) => String(Math.abs(e)).padStart(t, "0"), n = -e.getTimezoneOffset(), r = n < 0 ? "-" : "+", i = e.getFullYear();
|
|
25
|
+
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)}`;
|
|
26
|
+
}
|
|
27
|
+
function c(e, n) {
|
|
32
28
|
if (e == null) return "";
|
|
33
|
-
if (!
|
|
34
|
-
if (
|
|
35
|
-
type:
|
|
36
|
-
locales:
|
|
37
|
-
currency:
|
|
38
|
-
valueIsPercentPoints:
|
|
39
|
-
options:
|
|
29
|
+
if (!n) return String(e);
|
|
30
|
+
if (n.type === "number" || n.type === "currency" || n.type === "percent") return i(e, {
|
|
31
|
+
type: n.type,
|
|
32
|
+
locales: n.locales,
|
|
33
|
+
currency: n.type === "currency" ? n.currency ?? "USD" : void 0,
|
|
34
|
+
valueIsPercentPoints: n.type === "percent" ? n.valueIsPercentPoints : void 0,
|
|
35
|
+
options: n.options
|
|
40
36
|
});
|
|
41
|
-
if (
|
|
42
|
-
let
|
|
43
|
-
if (
|
|
44
|
-
let e = t(
|
|
37
|
+
if (n.type === "date" || n.type === "datetime") {
|
|
38
|
+
let i = o(e);
|
|
39
|
+
if (i) {
|
|
40
|
+
let e = t(n.pattern, n.type), a = e || n.options ? {
|
|
45
41
|
...e,
|
|
46
|
-
...
|
|
47
|
-
} :
|
|
42
|
+
...n.options
|
|
43
|
+
} : n.type === "date" ? {
|
|
48
44
|
year: "numeric",
|
|
49
45
|
month: "2-digit",
|
|
50
46
|
day: "2-digit"
|
|
@@ -55,12 +51,12 @@ function o(e, i) {
|
|
|
55
51
|
hour: "2-digit",
|
|
56
52
|
minute: "2-digit"
|
|
57
53
|
};
|
|
58
|
-
return n
|
|
54
|
+
return r(n.locales, a).format(i);
|
|
59
55
|
}
|
|
60
56
|
}
|
|
61
57
|
return String(e);
|
|
62
58
|
}
|
|
63
|
-
function
|
|
59
|
+
function l(e) {
|
|
64
60
|
if (!e) return;
|
|
65
61
|
let t = () => {
|
|
66
62
|
let t = e.options;
|
|
@@ -68,34 +64,34 @@ function s(e) {
|
|
|
68
64
|
}, n = (e) => e > 0 ? "." + "0".repeat(e) : "";
|
|
69
65
|
switch (e.type) {
|
|
70
66
|
case "number": return `#,##0${n(t())}`;
|
|
71
|
-
case "currency": return `"${
|
|
67
|
+
case "currency": return `"${d(e.currency ?? "USD")}"#,##0${n(t())}`;
|
|
72
68
|
case "percent": return `0${n(t())}%`;
|
|
73
69
|
case "date": return "yyyy-mm-dd";
|
|
74
70
|
case "datetime": return "yyyy-mm-dd hh:mm";
|
|
75
71
|
default: return;
|
|
76
72
|
}
|
|
77
73
|
}
|
|
78
|
-
function
|
|
74
|
+
function u(e, t, n = {}) {
|
|
79
75
|
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 = {};
|
|
80
76
|
for (let e of r) e.align && (a[e.field] = e.align);
|
|
81
|
-
let
|
|
82
|
-
for (let e of r)
|
|
83
|
-
let
|
|
77
|
+
let o = {};
|
|
78
|
+
for (let e of r) o[e.field] = e.header;
|
|
79
|
+
let s = [o];
|
|
84
80
|
for (let t of e) {
|
|
85
81
|
let e = {};
|
|
86
82
|
for (let i of r) {
|
|
87
83
|
let r = t[i.field];
|
|
88
|
-
e[i.field] = n.rawValues ? r :
|
|
84
|
+
e[i.field] = n.rawValues ? r : c(r, i.format);
|
|
89
85
|
}
|
|
90
|
-
|
|
86
|
+
s.push(e);
|
|
91
87
|
}
|
|
92
88
|
return {
|
|
93
|
-
records:
|
|
89
|
+
records: s,
|
|
94
90
|
fields: i,
|
|
95
91
|
align: a
|
|
96
92
|
};
|
|
97
93
|
}
|
|
98
|
-
function
|
|
94
|
+
function d(e) {
|
|
99
95
|
return {
|
|
100
96
|
USD: "$",
|
|
101
97
|
EUR: "€",
|
|
@@ -108,7 +104,7 @@ function l(e) {
|
|
|
108
104
|
BRL: "R$"
|
|
109
105
|
}[e.toUpperCase()] ?? e.toUpperCase();
|
|
110
106
|
}
|
|
111
|
-
function
|
|
107
|
+
function f(e, t) {
|
|
112
108
|
if (e == null || !t) return { ok: !1 };
|
|
113
109
|
if (t.type === "number" || t.type === "currency") {
|
|
114
110
|
let t = typeof e == "number" ? e : Number(e);
|
|
@@ -125,7 +121,7 @@ function u(e, t) {
|
|
|
125
121
|
} : { ok: !1 };
|
|
126
122
|
}
|
|
127
123
|
if (t.type === "date" || t.type === "datetime") {
|
|
128
|
-
let t =
|
|
124
|
+
let t = o(e);
|
|
129
125
|
return t ? {
|
|
130
126
|
ok: !0,
|
|
131
127
|
value: t
|
|
@@ -133,26 +129,26 @@ function u(e, t) {
|
|
|
133
129
|
}
|
|
134
130
|
return { ok: !1 };
|
|
135
131
|
}
|
|
136
|
-
var
|
|
137
|
-
function
|
|
132
|
+
var p = "";
|
|
133
|
+
function m(e) {
|
|
138
134
|
if (e?.aborted) throw new DOMException("Export aborted", "AbortError");
|
|
139
135
|
}
|
|
140
|
-
var
|
|
141
|
-
function
|
|
142
|
-
let n = e == null ? "" : e instanceof Date ? e
|
|
136
|
+
var h = () => new Promise((e) => setTimeout(e, 0));
|
|
137
|
+
function g(e, t) {
|
|
138
|
+
let n = e == null ? "" : e instanceof Date ? s(e) : String(e);
|
|
143
139
|
return n === "" ? n : n.includes(t) || n.includes("\"") || n.includes("\n") || n.includes("\r") ? `"${n.replace(/"/g, "\"\"")}"` : n;
|
|
144
140
|
}
|
|
145
|
-
async function
|
|
141
|
+
async function _(e, t, n = {}) {
|
|
146
142
|
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, c = [];
|
|
147
143
|
for (let i = 0; i < e.length; i++) {
|
|
148
|
-
|
|
144
|
+
m(n.signal);
|
|
149
145
|
let a = e[i];
|
|
150
|
-
c.push(t.map((e) =>
|
|
146
|
+
c.push(t.map((e) => g(a[e], r)).join(r)), i > 0 && i % o === 0 && (n.onProgress?.({
|
|
151
147
|
phase: "serialize",
|
|
152
148
|
ratio: i / s,
|
|
153
149
|
row: i,
|
|
154
150
|
total: s
|
|
155
|
-
}), await
|
|
151
|
+
}), await h());
|
|
156
152
|
}
|
|
157
153
|
n.onProgress?.({
|
|
158
154
|
phase: "serialize",
|
|
@@ -161,48 +157,48 @@ async function h(e, t, n = {}) {
|
|
|
161
157
|
total: s
|
|
162
158
|
});
|
|
163
159
|
let l = c.join(i);
|
|
164
|
-
return (a ?
|
|
160
|
+
return (a ? p : "") + l;
|
|
165
161
|
}
|
|
166
|
-
var
|
|
162
|
+
var v = {
|
|
167
163
|
"&": "&",
|
|
168
164
|
"<": "<",
|
|
169
165
|
">": ">",
|
|
170
166
|
"\"": """,
|
|
171
167
|
"'": "'"
|
|
172
168
|
};
|
|
173
|
-
function
|
|
174
|
-
return (e == null ? "" : e instanceof Date ? e
|
|
169
|
+
function y(e) {
|
|
170
|
+
return (e == null ? "" : e instanceof Date ? s(e) : String(e)).replace(/[&<>"']/g, (e) => v[e]);
|
|
175
171
|
}
|
|
176
|
-
async function
|
|
177
|
-
let r = Math.max(1, n.chunkRows ?? 5e3), i = e.length, a = n.align ?? {}, o = n.cellStyle, s = n.cellLink, c = n.title ?? "Grid export", l = e[0], u = l ? t.map((e) => `<th>${
|
|
172
|
+
async function b(e, t, n = {}) {
|
|
173
|
+
let r = Math.max(1, n.chunkRows ?? 5e3), i = e.length, a = n.align ?? {}, o = n.cellStyle, s = n.cellLink, c = n.title ?? "Grid export", l = e[0], u = l ? t.map((e) => `<th>${y(l[e])}</th>`).join("") : "", d = [];
|
|
178
174
|
for (let c = 1; c < e.length; c++) {
|
|
179
|
-
|
|
175
|
+
m(n.signal);
|
|
180
176
|
let l = e[c], u = t.map((e, t) => {
|
|
181
177
|
let n = a[e], r = [];
|
|
182
178
|
n && n !== "left" && r.push(`text-align:${n}`);
|
|
183
179
|
let i = o?.(c - 1, t);
|
|
184
180
|
i?.fill && r.push(`background:${i.fill}`), i?.color && r.push(`color:${i.color}`), i?.bold && r.push("font-weight:700");
|
|
185
|
-
let u = r.length ? ` style="${r.join(";")}"` : "", d = i?.icon ? `${i.icon} ${
|
|
186
|
-
return f && (d = `<a href="${
|
|
181
|
+
let u = r.length ? ` style="${r.join(";")}"` : "", d = i?.icon ? `${i.icon} ${y(l[e])}` : y(l[e]), f = s?.(c - 1, t);
|
|
182
|
+
return f && (d = `<a href="${y(f)}">${d}</a>`), `<td${u}>${d}</td>`;
|
|
187
183
|
}).join("");
|
|
188
184
|
d.push(`<tr>${u}</tr>`), c > 0 && c % r === 0 && (n.onProgress?.({
|
|
189
185
|
phase: "serialize",
|
|
190
186
|
ratio: c / i,
|
|
191
187
|
row: c,
|
|
192
188
|
total: i
|
|
193
|
-
}), await
|
|
189
|
+
}), await h());
|
|
194
190
|
}
|
|
195
191
|
return n.onProgress?.({
|
|
196
192
|
phase: "serialize",
|
|
197
193
|
ratio: 1,
|
|
198
194
|
row: i,
|
|
199
195
|
total: i
|
|
200
|
-
}), `<!doctype html><html><head><meta charset="utf-8"><title>${
|
|
196
|
+
}), `<!doctype html><html><head><meta charset="utf-8"><title>${y(c)}</title><style>table{border-collapse:collapse;font-family:system-ui,sans-serif;font-size:13px}th,td{border:1px solid #d0d7de;padding:6px 10px}th{background:#f6f8fa;text-align:left}</style></head><body><table><thead><tr>${u}</tr></thead><tbody>${d.join("")}</tbody></table></body></html>`;
|
|
201
197
|
}
|
|
202
|
-
async function
|
|
198
|
+
async function x(e, t, n = {}) {
|
|
203
199
|
let r = Math.max(1, n.chunkRows ?? 5e3), i = e.length - 1, a = [];
|
|
204
200
|
for (let o = 1; o < e.length; o++) {
|
|
205
|
-
|
|
201
|
+
m(n.signal);
|
|
206
202
|
let s = e[o], c = {};
|
|
207
203
|
for (let e of t) c[e] = s[e];
|
|
208
204
|
a.push(c), o > 0 && o % r === 0 && (n.onProgress?.({
|
|
@@ -210,7 +206,7 @@ async function y(e, t, n = {}) {
|
|
|
210
206
|
ratio: o / i,
|
|
211
207
|
row: o,
|
|
212
208
|
total: i
|
|
213
|
-
}), await
|
|
209
|
+
}), await h());
|
|
214
210
|
}
|
|
215
211
|
return n.onProgress?.({
|
|
216
212
|
phase: "serialize",
|
|
@@ -219,23 +215,23 @@ async function y(e, t, n = {}) {
|
|
|
219
215
|
total: i
|
|
220
216
|
}), JSON.stringify(a, null, 2);
|
|
221
217
|
}
|
|
222
|
-
function
|
|
223
|
-
return (e == null ? "" : e instanceof Date ? e
|
|
218
|
+
function S(e) {
|
|
219
|
+
return (e == null ? "" : e instanceof Date ? s(e) : String(e)).replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/\r?\n/g, "<br>");
|
|
224
220
|
}
|
|
225
|
-
async function
|
|
226
|
-
let r = Math.max(1, n.chunkRows ?? 5e3), i = e.length, a = n.align ?? {}, o = e[0], s = `| ${t.map((e) =>
|
|
221
|
+
async function C(e, t, n = {}) {
|
|
222
|
+
let r = Math.max(1, n.chunkRows ?? 5e3), i = e.length, a = n.align ?? {}, o = e[0], s = `| ${t.map((e) => S(o?.[e])).join(" | ")} |`, c = `| ${t.map((e) => {
|
|
227
223
|
let t = a[e];
|
|
228
224
|
return t === "right" ? "---:" : t === "center" ? ":--:" : "---";
|
|
229
225
|
}).join(" | ")} |`, l = [];
|
|
230
226
|
for (let a = 1; a < e.length; a++) {
|
|
231
|
-
|
|
227
|
+
m(n.signal);
|
|
232
228
|
let o = e[a];
|
|
233
|
-
l.push(`| ${t.map((e) =>
|
|
229
|
+
l.push(`| ${t.map((e) => S(o[e])).join(" | ")} |`), a > 0 && a % r === 0 && (n.onProgress?.({
|
|
234
230
|
phase: "serialize",
|
|
235
231
|
ratio: a / i,
|
|
236
232
|
row: a,
|
|
237
233
|
total: i
|
|
238
|
-
}), await
|
|
234
|
+
}), await h());
|
|
239
235
|
}
|
|
240
236
|
return n.onProgress?.({
|
|
241
237
|
phase: "serialize",
|
|
@@ -248,31 +244,31 @@ async function x(e, t, n = {}) {
|
|
|
248
244
|
...l
|
|
249
245
|
].join("\n") + "\n";
|
|
250
246
|
}
|
|
251
|
-
var
|
|
247
|
+
var w = {
|
|
252
248
|
"&": "&",
|
|
253
249
|
"<": "<",
|
|
254
250
|
">": ">",
|
|
255
251
|
"\"": """,
|
|
256
252
|
"'": "'"
|
|
257
253
|
};
|
|
258
|
-
function
|
|
259
|
-
return (e == null ? "" : e instanceof Date ? e
|
|
254
|
+
function T(e) {
|
|
255
|
+
return (e == null ? "" : e instanceof Date ? s(e) : String(e)).replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, "").replace(/[&<>"']/g, (e) => w[e]);
|
|
260
256
|
}
|
|
261
|
-
function
|
|
257
|
+
function E(e) {
|
|
262
258
|
let t = e.replace(/[^A-Za-z0-9_.-]/g, "_");
|
|
263
259
|
return /^[A-Za-z_]/.test(t) ? t : `_${t}`;
|
|
264
260
|
}
|
|
265
|
-
async function
|
|
266
|
-
let r = Math.max(1, n.chunkRows ?? 5e3), i = e.length - 1, a = n.rootTag ?? "rows", o = n.rowTag ?? "row", s = t.map(
|
|
261
|
+
async function D(e, t, n = {}) {
|
|
262
|
+
let r = Math.max(1, n.chunkRows ?? 5e3), i = e.length - 1, a = n.rootTag ?? "rows", o = n.rowTag ?? "row", s = t.map(E), c = ["<?xml version=\"1.0\" encoding=\"UTF-8\"?>", `<${a}>`];
|
|
267
263
|
for (let a = 1; a < e.length; a++) {
|
|
268
|
-
|
|
269
|
-
let l = e[a], u = t.map((e, t) => `<${s[t]}>${
|
|
264
|
+
m(n.signal);
|
|
265
|
+
let l = e[a], u = t.map((e, t) => `<${s[t]}>${T(l[e])}</${s[t]}>`).join("");
|
|
270
266
|
c.push(` <${o}>${u}</${o}>`), a > 0 && a % r === 0 && (n.onProgress?.({
|
|
271
267
|
phase: "serialize",
|
|
272
268
|
ratio: a / i,
|
|
273
269
|
row: a,
|
|
274
270
|
total: i
|
|
275
|
-
}), await
|
|
271
|
+
}), await h());
|
|
276
272
|
}
|
|
277
273
|
return c.push(`</${a}>`), n.onProgress?.({
|
|
278
274
|
phase: "serialize",
|
|
@@ -281,18 +277,18 @@ async function T(e, t, n = {}) {
|
|
|
281
277
|
total: i
|
|
282
278
|
}), c.join("\n");
|
|
283
279
|
}
|
|
284
|
-
function
|
|
280
|
+
function O(e, t) {
|
|
285
281
|
if (typeof document > "u" || typeof URL > "u") throw Error("@svgrid/grid: export requires a browser environment");
|
|
286
282
|
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
287
283
|
r.href = n, r.download = t, document.body.appendChild(r), r.click(), r.remove(), setTimeout(() => URL.revokeObjectURL(n), 0);
|
|
288
284
|
}
|
|
289
|
-
function
|
|
285
|
+
function k(e, t, n) {
|
|
290
286
|
if (typeof document > "u" || typeof URL > "u") throw Error("@svgrid/grid: text export requires a browser environment");
|
|
291
|
-
|
|
287
|
+
O(new Blob([e], { type: n }), t);
|
|
292
288
|
}
|
|
293
|
-
async function
|
|
289
|
+
async function A(e) {
|
|
294
290
|
if (typeof navigator > "u" || !navigator.clipboard) throw Error("@svgrid/grid: clipboard API is unavailable in this context");
|
|
295
291
|
await navigator.clipboard.writeText(e);
|
|
296
292
|
}
|
|
297
293
|
//#endregion
|
|
298
|
-
export {
|
|
294
|
+
export { a, _ as c, C as d, D as f, k as i, b as l, f as m, A as n, c as o, l as p, O as r, u as s, o as t, x as u };
|