@svgrid/grid-wc 2.6.2 → 2.7.0

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 (48) hide show
  1. package/dist/{GridMenus-CU_-Ks4f.js → GridMenus-DE0zNY_3.js} +263 -242
  2. package/dist/{SvDateTimePicker-Ch1Vug8H.js → SvDateTimePicker-BpeEupA2.js} +81 -81
  3. package/dist/{SvGrid.helpers-CgUd39VT.js → SvGrid.helpers-BZPDBcza.js} +27 -11
  4. package/dist/{SvGridCellEditor-CBJUbAsR.js → SvGridCellEditor-_rqEaig7.js} +148 -140
  5. package/dist/{SvGridChart-BztTavvw.js → SvGridChart-yK5Zv85y.js} +158 -158
  6. package/dist/{SvGridChartPanel-Ca5HWIZ3.js → SvGridChartPanel-B38_VjXM.js} +52 -52
  7. package/dist/{SvGridChartView-AcWj_tcs.js → SvGridChartView-ScXTF6t-.js} +4 -4
  8. package/dist/{SvGridDropdown-BXqvR1cs.js → SvGridDropdown-DnAESFDu.js} +29 -29
  9. package/dist/angular/fesm2022/svgrid-grid-wc-angular.mjs +358 -0
  10. package/dist/angular/fesm2022/svgrid-grid-wc-angular.mjs.map +1 -0
  11. package/dist/angular/package.json +25 -0
  12. package/dist/angular/types/svgrid-grid-wc-angular.d.ts +161 -0
  13. package/dist/{client-DoXxrq8q.js → client-DjwUji8D.js} +1 -1
  14. package/dist/column-resize-DvCRUrN3.js +101 -0
  15. package/dist/{dismissable-xj_k_fnZ.js → dismissable-Nx79OIVg.js} +36 -36
  16. package/dist/react/index.d.ts +313 -0
  17. package/dist/react/index.js +72 -0
  18. package/dist/row-resize-D-8s3cqT.js +94 -0
  19. package/dist/shadow/GridMenus-DE0zNY_3.js +1022 -0
  20. package/dist/shadow/SvDateTimePicker-BpeEupA2.js +1885 -0
  21. package/dist/shadow/SvGrid.helpers-BZPDBcza.js +125 -0
  22. package/dist/shadow/SvGridCellEditor-_rqEaig7.js +531 -0
  23. package/dist/shadow/SvGridChart-yK5Zv85y.js +1199 -0
  24. package/dist/shadow/SvGridChartPanel-B38_VjXM.js +584 -0
  25. package/dist/shadow/SvGridChartView-ScXTF6t-.js +50 -0
  26. package/dist/shadow/SvGridDropdown-DnAESFDu.js +256 -0
  27. package/dist/shadow/cell-formatting-C0OsDmi_.js +86 -0
  28. package/dist/shadow/chart-uvs3sFJA.js +1220 -0
  29. package/dist/shadow/client-DjwUji8D.js +2960 -0
  30. package/dist/shadow/column-resize-DvCRUrN3.js +101 -0
  31. package/dist/shadow/dismissable-Nx79OIVg.js +186 -0
  32. package/dist/shadow/editor-contract-peBDxir_.js +22 -0
  33. package/dist/shadow/editor-registry-DxGKqcvx.js +24 -0
  34. package/dist/shadow/export-format-C8kZGZfz.js +161 -0
  35. package/dist/shadow/popover-WsGlvtQv.js +69 -0
  36. package/dist/shadow/row-drag-touch-Ddaa-QeB.js +91 -0
  37. package/dist/shadow/row-resize-D-8s3cqT.js +94 -0
  38. package/dist/shadow/sv-grid-shadow-element.d.ts +246 -0
  39. package/dist/shadow/sv-grid-shadow-element.js +10067 -0
  40. package/dist/{svelte-virtualizer.svelte-CFoYP2Ls.js → shadow/svelte-virtualizer.svelte-DZ9UcyfT.js} +35 -30
  41. package/dist/shadow/validate-CgmAtX1A.js +75 -0
  42. package/dist/sv-grid-element.d.ts +246 -0
  43. package/dist/sv-grid-element.js +3619 -2692
  44. package/dist/svelte-virtualizer.svelte-DZ9UcyfT.js +527 -0
  45. package/dist/validate-CgmAtX1A.js +75 -0
  46. package/dist/vue/index.d.ts +147 -0
  47. package/dist/vue/index.js +72 -0
  48. package/package.json +71 -6
@@ -0,0 +1,101 @@
1
+ //#region ../grid/dist/column-resize.js
2
+ var e = "sv-grid-resize-handle";
3
+ function t(t, n) {
4
+ let r = n, i = null, a = null, o = 0, s = () => r.min ?? 40;
5
+ function c(e) {
6
+ return e.closest("[data-svgrid-header-col]")?.dataset.svgridHeaderCol ?? null;
7
+ }
8
+ function l() {
9
+ i && r.onResize(i.columnId, o);
10
+ }
11
+ function u(e) {
12
+ i && (o = Math.max(s(), i.startWidth + (e.clientX - i.startX)), a === null && (a = requestAnimationFrame(() => {
13
+ a = null, l();
14
+ })));
15
+ }
16
+ function d(e) {
17
+ if (i) {
18
+ a !== null && (cancelAnimationFrame(a), a = null), o = Math.max(s(), i.startWidth + (e.clientX - i.startX)), l(), i.handle.classList.remove("is-resizing"), m(i.handle, i.columnId);
19
+ try {
20
+ i.handle.releasePointerCapture(e.pointerId);
21
+ } catch {}
22
+ i = null, window.removeEventListener("pointermove", u), window.removeEventListener("pointerup", d), window.removeEventListener("pointercancel", d), document.body.style.cursor = "";
23
+ }
24
+ }
25
+ function f(t) {
26
+ if (r.disabled) return;
27
+ let n = t.target;
28
+ if (!n?.classList.contains(e)) return;
29
+ let a = c(n);
30
+ if (!(!a || r.canResize?.(a) === !1)) {
31
+ t.preventDefault(), t.stopPropagation(), n.classList.add("is-resizing"), o = r.getWidth(a), i = {
32
+ columnId: a,
33
+ startX: t.clientX,
34
+ startWidth: o,
35
+ handle: n
36
+ };
37
+ try {
38
+ n.setPointerCapture(t.pointerId);
39
+ } catch {}
40
+ document.body.style.cursor = "col-resize", window.addEventListener("pointermove", u), window.addEventListener("pointerup", d), window.addEventListener("pointercancel", d);
41
+ }
42
+ }
43
+ function p(t) {
44
+ if (r.disabled) return;
45
+ let n = t.target;
46
+ if (!n?.classList.contains(e)) return;
47
+ let i = t.shiftKey ? 1 : 10, a = 0;
48
+ if (t.key === "ArrowLeft") a = -i;
49
+ else if (t.key === "ArrowRight") a = i;
50
+ else return;
51
+ let o = c(n);
52
+ if (!o || r.canResize?.(o) === !1) return;
53
+ t.preventDefault(), t.stopPropagation();
54
+ let l = Math.max(s(), Math.round(r.getWidth(o) + a));
55
+ r.onResize(o, l), m(n, o);
56
+ }
57
+ function m(e, t) {
58
+ let n = Math.round(r.getWidth(t));
59
+ e.setAttribute("aria-valuenow", String(n)), e.setAttribute("aria-valuemin", String(s())), e.setAttribute("aria-valuetext", `${n} pixels`);
60
+ }
61
+ function h() {
62
+ if (r.disabled) {
63
+ g();
64
+ return;
65
+ }
66
+ let n = t.querySelectorAll("th.sv-grid-column[data-svgrid-header-col]");
67
+ for (let t of n) {
68
+ if (t.classList.contains("sv-grid-column-spacer")) continue;
69
+ let n = t.dataset.svgridHeaderCol;
70
+ if (!n) continue;
71
+ if (r.canResize?.(n) === !1) {
72
+ t.querySelector(`:scope > .${e}`)?.remove();
73
+ continue;
74
+ }
75
+ if (t.querySelector(`:scope > .${e}`)) continue;
76
+ let i = document.createElement("div");
77
+ i.className = e, i.setAttribute("role", "separator"), i.setAttribute("aria-orientation", "vertical"), i.setAttribute("aria-label", `Resize ${r.label?.(n) ?? n}`), i.tabIndex = 0, m(i, n), i.addEventListener("dblclick", (e) => {
78
+ e.stopPropagation(), e.preventDefault(), !r.disabled && (r.onAutosize?.(n), m(i, n));
79
+ }), t.appendChild(i);
80
+ }
81
+ }
82
+ function g() {
83
+ t.querySelectorAll(`.${e}`).forEach((e) => e.remove());
84
+ }
85
+ t.addEventListener("pointerdown", f, { capture: !0 }), t.addEventListener("keydown", p, { capture: !0 });
86
+ let _ = new MutationObserver(() => h());
87
+ return _.observe(t, {
88
+ childList: !0,
89
+ subtree: !0
90
+ }), h(), {
91
+ update(e) {
92
+ let t = r.disabled;
93
+ r = e, t !== r.disabled && h();
94
+ },
95
+ destroy() {
96
+ t.removeEventListener("pointerdown", f, { capture: !0 }), t.removeEventListener("keydown", p, { capture: !0 }), window.removeEventListener("pointermove", u), window.removeEventListener("pointerup", d), window.removeEventListener("pointercancel", d), a !== null && cancelAnimationFrame(a), _.disconnect(), g();
97
+ }
98
+ };
99
+ }
100
+ //#endregion
101
+ export { t as columnResize };
@@ -0,0 +1,186 @@
1
+ import { $ as e, A as t, D as n, E as r, F as i, I as a, J as o, K as s, O as c, R as l, V as u, et as d, f, j as p, k as m, n as h, q as g, rt as _, tt as v, v as ee, w as te, y } from "./client-DjwUji8D.js";
2
+ import { n as b, r as x } from "./editor-contract-peBDxir_.js";
3
+ //#region ../grid/dist/SvField.svelte
4
+ var S = p("<span class=\"sv-field__req svelte-xtfnp5\" aria-hidden=\"true\">*</span>"), C = p("<label class=\"sv-field__label svelte-xtfnp5\"> <!></label>"), w = p("<span class=\"sv-field__spinner svelte-xtfnp5\" role=\"status\" aria-label=\"Loading\"></span>"), T = p("<span class=\"sv-field__labelrow svelte-xtfnp5\"><!> <!></span>"), ne = p("<span class=\"sv-field__req svelte-xtfnp5\" aria-hidden=\"true\">*</span>"), re = p("<label class=\"sv-field__float-label svelte-xtfnp5\"> <!></label>"), ie = p("<span class=\"sv-field__adorn sv-field__adorn--lead svelte-xtfnp5\"><!></span>"), ae = p("<span class=\"sv-field__affix sv-field__affix--pre svelte-xtfnp5\"> </span>"), oe = p("<span class=\"sv-field__affix sv-field__affix--suf svelte-xtfnp5\"> </span>"), E = p("<span class=\"sv-field__adorn sv-field__adorn--trail svelte-xtfnp5\"><!></span>"), D = p("<span class=\"sv-field__action-txt svelte-xtfnp5\"> </span>"), O = p("<button class=\"sv-field__action svelte-xtfnp5\" type=\"button\" tabindex=\"-1\"><!></button>"), k = p("<button class=\"sv-field__clear svelte-xtfnp5\" type=\"button\" tabindex=\"-1\">&times;</button>"), A = p("<div><!> <!> <!> <span class=\"sv-field__slot svelte-xtfnp5\"><!></span> <!> <!> <!> <!></div>"), j = p("<span class=\"sv-field__error svelte-xtfnp5\" role=\"alert\"> </span>"), M = p("<span class=\"sv-field__hint svelte-xtfnp5\"> </span>"), N = p("<div><!> <!> <!></div>");
5
+ function P(i, p) {
6
+ v(p, !0);
7
+ let P = h(p, "required", 3, !1), F = h(p, "block", 3, !1), I = h(p, "loading", 3, !1), L = h(p, "frame", 3, !1), R = h(p, "invalid", 3, !1), z = h(p, "size", 3, "md"), B = h(p, "disabled", 3, !1), V = h(p, "readonly", 3, !1), H = h(p, "clearable", 3, !1), U = h(p, "showClear", 3, !1), W = h(p, "clearLabel", 3, "Clear"), G = h(p, "labelMode", 3, "static"), K = h(p, "filled", 3, !1), se = e(() => p.width == null ? void 0 : typeof p.width == "number" ? `${p.width}px` : p.width), q = e(() => G() === "floating" && L() && !!p.label), J = e(() => p.dir === "ltr" || p.dir === "rtl" ? p.dir : void 0);
8
+ var Y = N();
9
+ let X;
10
+ var Z = s(Y), ce = (e) => {
11
+ var t = T(), n = s(t), i = (e) => {
12
+ var t = C(), n = s(t, !0), i = o(n), a = (e) => {
13
+ var t = S();
14
+ m(e, t);
15
+ };
16
+ r(i, (e) => {
17
+ P() && e(a);
18
+ }), _(t), u(() => {
19
+ f(t, "for", p.id), c(n, p.label);
20
+ }), m(e, t);
21
+ };
22
+ r(n, (e) => {
23
+ p.label && !l(q) && e(i);
24
+ });
25
+ var a = o(n, 2), d = (e) => {
26
+ var t = w();
27
+ m(e, t);
28
+ };
29
+ r(a, (e) => {
30
+ I() && e(d);
31
+ }), _(t), m(e, t);
32
+ };
33
+ r(Z, (e) => {
34
+ (p.label && !l(q) || I()) && e(ce);
35
+ });
36
+ var Q = o(Z, 2), le = (e) => {
37
+ var i = A();
38
+ let d, h;
39
+ var v = s(i), b = (e) => {
40
+ var t = re(), n = s(t, !0), i = o(n), a = (e) => {
41
+ var t = ne();
42
+ m(e, t);
43
+ };
44
+ r(i, (e) => {
45
+ P() && e(a);
46
+ }), _(t), u(() => {
47
+ f(t, "for", p.id), c(n, p.label);
48
+ }), m(e, t);
49
+ };
50
+ r(v, (e) => {
51
+ l(q) && e(b);
52
+ });
53
+ var x = o(v, 2), S = (e) => {
54
+ var t = ie(), r = s(t);
55
+ n(r, () => p.leading), _(t), m(e, t);
56
+ };
57
+ r(x, (e) => {
58
+ p.leading && e(S);
59
+ });
60
+ var C = o(x, 2), w = (e) => {
61
+ var t = ae(), n = s(t, !0);
62
+ _(t), u(() => c(n, p.prefix)), m(e, t);
63
+ };
64
+ r(C, (e) => {
65
+ p.prefix && e(w);
66
+ });
67
+ var T = o(C, 2), j = s(T);
68
+ n(j, () => p.children), _(T);
69
+ var M = o(T, 2), N = (e) => {
70
+ var t = oe(), n = s(t, !0);
71
+ _(t), u(() => c(n, p.suffix)), m(e, t);
72
+ };
73
+ r(M, (e) => {
74
+ p.suffix && e(N);
75
+ });
76
+ var I = o(M, 2), L = (e) => {
77
+ var t = E(), r = s(t);
78
+ n(r, () => p.trailing), _(t), m(e, t);
79
+ };
80
+ r(I, (e) => {
81
+ p.trailing && e(L);
82
+ });
83
+ var G = o(I, 2), J = (e) => {
84
+ var i = t(), o = g(i);
85
+ te(o, 17, () => p.actions, (e) => e.label, (e, i) => {
86
+ var o = O(), d = s(o), p = (e) => {
87
+ var r = t(), a = g(r);
88
+ n(a, () => l(i).icon), m(e, r);
89
+ }, h = (e) => {
90
+ var t = D(), n = s(t, !0);
91
+ _(t), u(() => c(n, l(i).label)), m(e, t);
92
+ };
93
+ r(d, (e) => {
94
+ l(i).icon ? e(p) : e(h, -1);
95
+ }), _(o), u(() => {
96
+ f(o, "aria-label", l(i).label), f(o, "title", l(i).label), o.disabled = B() || l(i).disabled;
97
+ }), a("click", o, () => l(i).onClick()), m(e, o);
98
+ }), m(e, i);
99
+ };
100
+ r(G, (e) => {
101
+ p.actions?.length && e(J);
102
+ });
103
+ var Y = o(G, 2), X = (e) => {
104
+ var t = k();
105
+ u(() => f(t, "aria-label", W())), a("click", t, () => p.onclear?.()), m(e, t);
106
+ };
107
+ r(Y, (e) => {
108
+ H() && U() && !B() && !V() && e(X);
109
+ }), _(i), u(() => {
110
+ d = y(i, 1, `sv-field__control sv-field--${z() ?? ""}`, "svelte-xtfnp5", d, {
111
+ "is-invalid": R(),
112
+ "is-disabled": B(),
113
+ "is-readonly": V(),
114
+ "is-filled": K()
115
+ }), h = ee(i, "", h, { width: F() ? void 0 : l(se) });
116
+ }), m(e, i);
117
+ }, $ = (e) => {
118
+ var r = t(), i = g(r);
119
+ n(i, () => p.children), m(e, r);
120
+ };
121
+ r(Q, (e) => {
122
+ L() ? e(le) : e($, -1);
123
+ });
124
+ var ue = o(Q, 2), de = (e) => {
125
+ var t = j(), n = s(t, !0);
126
+ _(t), u((e) => {
127
+ f(t, "id", e), c(n, p.error);
128
+ }, [() => b(p.id)]), m(e, t);
129
+ }, fe = (e) => {
130
+ var t = M(), n = s(t, !0);
131
+ _(t), u((e) => {
132
+ f(t, "id", e), c(n, p.hint);
133
+ }, [() => x(p.id)]), m(e, t);
134
+ };
135
+ r(ue, (e) => {
136
+ p.error ? e(de) : p.hint && e(fe, 1);
137
+ }), _(Y), u(() => {
138
+ X = y(Y, 1, "sv-field svelte-xtfnp5", null, X, {
139
+ "sv-field--block": F(),
140
+ "sv-field--floating": l(q)
141
+ }), f(Y, "dir", l(J)), Y.dir = Y.dir;
142
+ }), m(i, Y), d();
143
+ }
144
+ i(["click"]);
145
+ //#endregion
146
+ //#region ../grid/dist/a11y/dismissable.js
147
+ function F(e, t) {
148
+ return t ? (Array.isArray(e) ? e : [e]).some((e) => e != null && e.contains(t)) : !1;
149
+ }
150
+ var I = [], L = !1;
151
+ function R() {
152
+ L || typeof document > "u" || (L = !0, document.addEventListener("keydown", (e) => {
153
+ if (e.key !== "Escape") return;
154
+ let t = I[I.length - 1];
155
+ t?.closeOnEscape && (e.stopPropagation(), t.onDismiss("escape"));
156
+ }, !0), document.addEventListener("pointerdown", (e) => {
157
+ let t = I[I.length - 1];
158
+ t?.closeOnOutside && (F(t.element(), e.target) || t.onDismiss("outside"));
159
+ }, !0));
160
+ }
161
+ function z(e) {
162
+ let t = {
163
+ element: e.element,
164
+ onDismiss: e.onDismiss,
165
+ closeOnEscape: e.closeOnEscape ?? !0,
166
+ closeOnOutside: e.closeOnOutside ?? !0
167
+ };
168
+ return {
169
+ activate() {
170
+ R(), I.includes(t) || I.push(t);
171
+ },
172
+ release() {
173
+ let e = I.indexOf(t);
174
+ e >= 0 && I.splice(e, 1);
175
+ }
176
+ };
177
+ }
178
+ function B(e, t) {
179
+ if (typeof window > "u") return () => {};
180
+ let n = (n) => {
181
+ F(e(), n.target) || t();
182
+ };
183
+ return window.addEventListener("scroll", n, !0), () => window.removeEventListener("scroll", n, !0);
184
+ }
185
+ //#endregion
186
+ export { B as n, P as r, z as t };
@@ -0,0 +1,22 @@
1
+ //#region ../grid/dist/editor-contract.js
2
+ var e = (e) => e ? `${e}__error` : void 0, t = (e) => e ? `${e}__hint` : void 0, n = 0, r = (e = "sv-ed") => `${e}-${n++}`;
3
+ function i(n) {
4
+ let r = [n.error ? e(n.id) : void 0, n.hint ? t(n.id) : void 0].filter(Boolean);
5
+ return {
6
+ "aria-invalid": n.invalid ? "true" : void 0,
7
+ "aria-required": n.required ? "true" : void 0,
8
+ "aria-describedby": r.length ? r.join(" ") : void 0,
9
+ "aria-label": n.ariaLabel
10
+ };
11
+ }
12
+ function a(e, t) {
13
+ if (!t) return e;
14
+ let n = { ...e };
15
+ for (let e in t) {
16
+ let r = t[e];
17
+ r != null && r !== "" && (n[e] = r);
18
+ }
19
+ return n;
20
+ }
21
+ //#endregion
22
+ export { a, r as i, e as n, t as r, i as t };
@@ -0,0 +1,24 @@
1
+ //#region ../grid/dist/editor-registry.js
2
+ var e = /* @__PURE__ */ new Map();
3
+ function t(t) {
4
+ return e.get(t);
5
+ }
6
+ function n(t) {
7
+ return e.has(t);
8
+ }
9
+ function r(e) {
10
+ return {
11
+ value: e.value,
12
+ onChange: e.onChange,
13
+ onCommit: e.onCommit,
14
+ onCancel: e.onCancel,
15
+ onCommitAndMove: e.onCommitAndMove,
16
+ onRequestClose: e.onRequestClose,
17
+ inCell: e.inCell
18
+ };
19
+ }
20
+ function i(e, t) {
21
+ return e.props ? e.props(t) : r(t);
22
+ }
23
+ //#endregion
24
+ export { n, i as r, t };
@@ -0,0 +1,161 @@
1
+ import { n as e, r as t, t as n } from "./cell-formatting-C0OsDmi_.js";
2
+ import "./sv-grid-shadow-element.js";
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;
15
+ }
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, {
20
+ type: a.type,
21
+ locales: a.locales,
22
+ currency: a.type === "currency" ? a.currency ?? "USD" : void 0,
23
+ valueIsPercentPoints: a.type === "percent" ? a.valueIsPercentPoints : void 0,
24
+ options: a.options
25
+ });
26
+ if (a.type === "date" || a.type === "datetime") {
27
+ let n = r(i);
28
+ if (n) {
29
+ let r = t(a.pattern, a.type), i = r || a.options ? {
30
+ ...r,
31
+ ...a.options
32
+ } : a.type === "date" ? {
33
+ year: "numeric",
34
+ month: "2-digit",
35
+ day: "2-digit"
36
+ } : {
37
+ year: "numeric",
38
+ month: "2-digit",
39
+ day: "2-digit",
40
+ hour: "2-digit",
41
+ minute: "2-digit"
42
+ };
43
+ return e(a.locales, i).format(n);
44
+ }
45
+ }
46
+ return String(i);
47
+ }
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);
51
+ let s = {};
52
+ for (let e of r) s[e.field] = e.header;
53
+ let c = [s];
54
+ for (let t of e) {
55
+ 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);
59
+ }
60
+ c.push(e);
61
+ }
62
+ return {
63
+ records: c,
64
+ fields: a,
65
+ align: o
66
+ };
67
+ }
68
+ var o = "";
69
+ function s(e) {
70
+ if (e?.aborted) throw new DOMException("Export aborted", "AbortError");
71
+ }
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);
75
+ return n === "" ? n : n.includes(t) || n.includes("\"") || n.includes("\n") || n.includes("\r") ? `"${n.replace(/"/g, "\"\"")}"` : n;
76
+ }
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 = [];
79
+ for (let i = 0; i < e.length; i++) {
80
+ s(n.signal);
81
+ let a = e[i];
82
+ f.push(t.map((e) => l(a[e], r)).join(r)), i > 0 && i % u === 0 && (n.onProgress?.({
83
+ phase: "serialize",
84
+ ratio: i / d,
85
+ row: i,
86
+ total: d
87
+ }), await c());
88
+ }
89
+ n.onProgress?.({
90
+ phase: "serialize",
91
+ ratio: 1,
92
+ row: d,
93
+ total: d
94
+ });
95
+ let p = f.join(i);
96
+ return (a ? o : "") + p;
97
+ }
98
+ async function d(e, t, n = {}) {
99
+ let r = Math.max(1, n.chunkRows ?? 5e3), i = e.length - 1, a = [];
100
+ 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?.({
105
+ phase: "serialize",
106
+ ratio: o / i,
107
+ row: o,
108
+ total: i
109
+ }), await c());
110
+ }
111
+ return n.onProgress?.({
112
+ phase: "serialize",
113
+ ratio: 1,
114
+ row: i,
115
+ total: i
116
+ }), JSON.stringify(a, null, 2);
117
+ }
118
+ function f(e) {
119
+ return (e == null ? "" : e instanceof Date ? e.toISOString() : String(e)).replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/\r?\n/g, "<br>");
120
+ }
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) => {
123
+ let t = a[e];
124
+ return t === "right" ? "---:" : t === "center" ? ":--:" : "---";
125
+ }).join(" | ")} |`, d = [];
126
+ for (let a = 1; a < e.length; a++) {
127
+ s(n.signal);
128
+ let o = e[a];
129
+ d.push(`| ${t.map((e) => f(o[e])).join(" | ")} |`), a > 0 && a % r === 0 && (n.onProgress?.({
130
+ phase: "serialize",
131
+ ratio: a / i,
132
+ row: a,
133
+ total: i
134
+ }), await c());
135
+ }
136
+ return n.onProgress?.({
137
+ phase: "serialize",
138
+ ratio: 1,
139
+ row: i,
140
+ total: i
141
+ }), [
142
+ l,
143
+ u,
144
+ ...d
145
+ ].join("\n") + "\n";
146
+ }
147
+ function m(e, t) {
148
+ if (typeof document > "u" || typeof URL > "u") throw Error("@svgrid/grid: export requires a browser environment");
149
+ let n = URL.createObjectURL(e), r = document.createElement("a");
150
+ r.href = n, r.download = t, document.body.appendChild(r), r.click(), r.remove(), setTimeout(() => URL.revokeObjectURL(n), 0);
151
+ }
152
+ function h(e, t, n) {
153
+ 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);
155
+ }
156
+ async function g(e) {
157
+ if (typeof navigator > "u" || !navigator.clipboard) throw Error("@svgrid/grid: clipboard API is unavailable in this context");
158
+ await navigator.clipboard.writeText(e);
159
+ }
160
+ //#endregion
161
+ export { g as copyTextToClipboard, h as downloadTextFile, a as projectGridRows, u as serializeDelimited, d as serializeJson, p as serializeMarkdown };
@@ -0,0 +1,69 @@
1
+ //#region ../grid/dist/popover.js
2
+ var e = [
3
+ "--sg-accent",
4
+ "--sg-on-accent",
5
+ "--sg-bg",
6
+ "--sg-fg",
7
+ "--sg-muted",
8
+ "--sg-border",
9
+ "--sg-header-bg",
10
+ "--sg-header-fg",
11
+ "--sg-row-hover-bg",
12
+ "--sg-row-alt-bg",
13
+ "--sg-selection-bg",
14
+ "--sg-selection-fg",
15
+ "--sg-input-bg",
16
+ "--sg-input-border",
17
+ "--sg-danger",
18
+ "--sg-focus-ring",
19
+ "--sg-radius",
20
+ "--sg-font",
21
+ "--sg-invalid-bg",
22
+ "--sg-invalid-border",
23
+ "--sg-invalid-fg",
24
+ "--sg-rating-on",
25
+ "--sg-rating-empty",
26
+ "--sg-rating-hover"
27
+ ];
28
+ function t(t, n = e) {
29
+ let r = getComputedStyle(t);
30
+ for (let e of n) {
31
+ let n = r.getPropertyValue(e).trim();
32
+ n && t.style.setProperty(e, n);
33
+ }
34
+ return document.body.appendChild(t), { destroy() {
35
+ t.parentNode === document.body && document.body.removeChild(t);
36
+ } };
37
+ }
38
+ function n(e, t = {}) {
39
+ if (typeof e.animate != "function" || typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches) return;
40
+ let n = t.up ? 6 : -6, r = t.scale ?? .97;
41
+ return e.animate([{
42
+ opacity: 0,
43
+ transform: `translateY(${n}px) scale(${r})`
44
+ }, {
45
+ opacity: 1,
46
+ transform: "translateY(0) scale(1)"
47
+ }], {
48
+ duration: t.duration ?? 140,
49
+ easing: "cubic-bezier(0.16, 1, 0.3, 1)"
50
+ }), {};
51
+ }
52
+ function r(e, t) {
53
+ let n = t.gap ?? 2, r = t.viewportMargin ?? 8, i = t.minHeight ?? 96, a = window.innerHeight - e.bottom - n - r, o = e.top - n - r, s = a < t.estimatedHeight && o > a, c = Math.max(i, Math.floor(s ? o : a)), l = Math.min(t.estimatedHeight, c), u = Math.max(e.width, t.minWidth ?? 0), d = e.left;
54
+ if (t.clampHorizontal !== !1) {
55
+ let e = window.innerWidth - u - 4;
56
+ d = Math.max(4, Math.min(d, e));
57
+ }
58
+ return {
59
+ top: s ? Math.max(r, e.top - n - l) : e.bottom + n,
60
+ left: d,
61
+ width: u,
62
+ openUpward: s,
63
+ maxHeight: l,
64
+ availHeight: c,
65
+ bottom: Math.round(window.innerHeight - e.top + n)
66
+ };
67
+ }
68
+ //#endregion
69
+ export { n, t as r, r as t };
@@ -0,0 +1,91 @@
1
+ function e(e) {
2
+ let { ctx: t } = e, n = null;
3
+ function r(e, t) {
4
+ let n = document.elementFromPoint(e, t)?.closest?.("tr.sv-grid-row");
5
+ if (!n) return null;
6
+ let r = n.querySelector("[data-svgrid-row]")?.dataset.svgridRow;
7
+ if (r == null) return null;
8
+ let i = Number(r);
9
+ if (!Number.isFinite(i)) return null;
10
+ let a = n.getBoundingClientRect();
11
+ return {
12
+ index: i,
13
+ side: t < a.top + a.height / 2 ? "before" : "after"
14
+ };
15
+ }
16
+ function i() {
17
+ n?.scrollFrame != null && (cancelAnimationFrame(n.scrollFrame), n.scrollFrame = null);
18
+ }
19
+ function a(e) {
20
+ let a = n?.scroller;
21
+ if (!n || !a) return;
22
+ let o = a.getBoundingClientRect(), s = 0;
23
+ if (e < o.top + 48 ? s = -12 : e > o.bottom - 48 && (s = 12), i(), s === 0) return;
24
+ let c = () => {
25
+ if (!n?.started) return;
26
+ a.scrollTop += s;
27
+ let i = r(n.startX, e);
28
+ i && (t.rowDropIndex = i.index, t.rowDropSide = i.side), n.scrollFrame = requestAnimationFrame(c);
29
+ };
30
+ n.scrollFrame = requestAnimationFrame(c);
31
+ }
32
+ function o(e) {
33
+ n?.started && e.preventDefault();
34
+ }
35
+ function s() {
36
+ window.removeEventListener("pointermove", l), window.removeEventListener("pointerup", u), window.removeEventListener("pointercancel", d), window.removeEventListener("touchmove", o);
37
+ }
38
+ function c(r) {
39
+ if (!n) return;
40
+ let a = n;
41
+ a.timer && clearTimeout(a.timer), i(), n = null, s(), a.root?.classList.remove("sv-grid-row-drag-active"), a.started && (r && t.rowDropIndex != null ? e.commitDropOnRow(t.rowDropIndex, t.rowDropSide ?? "before") : (e.clearIndicators(), e.closeBus()));
42
+ }
43
+ function l(i) {
44
+ if (!n || i.pointerId !== n.pointerId) return;
45
+ if (!n.started) {
46
+ Math.abs(i.clientY - n.startY) + Math.abs(i.clientX - n.startX) > 10 && c(!1);
47
+ return;
48
+ }
49
+ i.preventDefault();
50
+ let o = r(i.clientX, i.clientY);
51
+ o && (e.cancelPendingLeave(), t.rowDropIndex = o.index, t.rowDropSide = o.side), n.startX = i.clientX, a(i.clientY);
52
+ }
53
+ function u(e) {
54
+ !n || e.pointerId !== n.pointerId || c(!0);
55
+ }
56
+ function d(e) {
57
+ !n || e.pointerId !== n.pointerId || c(!1);
58
+ }
59
+ return {
60
+ start(r, i) {
61
+ if (!e.managed() || n) return;
62
+ let a = e.originalAt(i);
63
+ if (a == null) return;
64
+ let s = r.currentTarget;
65
+ n = {
66
+ pointerId: r.pointerId,
67
+ rowIndex: i,
68
+ startX: r.clientX,
69
+ startY: r.clientY,
70
+ started: !1,
71
+ timer: null,
72
+ scrollFrame: null,
73
+ scroller: s?.closest?.(".sv-grid-container") ?? null,
74
+ root: s?.closest?.(".sv-grid-root") ?? null
75
+ }, window.addEventListener("pointermove", l, { passive: !1 }), window.addEventListener("pointerup", u), window.addEventListener("pointercancel", d), window.addEventListener("touchmove", o, { passive: !1 }), n.timer = setTimeout(() => {
76
+ if (n) {
77
+ n.started = !0, n.timer = null, n.root?.classList.add("sv-grid-row-drag-active");
78
+ try {
79
+ s?.setPointerCapture?.(r.pointerId);
80
+ } catch {}
81
+ e.openBus(a), t.rowDragActive = !0, t.rowDropIndex = i, t.rowDropSide = "before";
82
+ }
83
+ }, 350);
84
+ },
85
+ destroy() {
86
+ c(!1);
87
+ }
88
+ };
89
+ }
90
+ //#endregion
91
+ export { e as createTouchDrag };