@svgrid/grid-wc 2.6.2 → 3.0.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.
- package/dist/GridMenus-DpmS1pzo.js +1121 -0
- package/dist/SvDateRangeInput-u4ibte8S.js +196 -0
- package/dist/SvDateTimePicker-DVFiDxUq.js +765 -0
- package/dist/{dismissable-xj_k_fnZ.js → SvField-ChCI-O2O.js} +44 -84
- package/dist/{SvGrid.helpers-CgUd39VT.js → SvGrid.helpers-BdVDtjUm.js} +37 -11
- package/dist/SvGridCellEditor-DvsQyE9a.js +550 -0
- package/dist/{SvGridChart-BztTavvw.js → SvGridChart-yK5Zv85y.js} +158 -158
- package/dist/{SvGridChartPanel-Ca5HWIZ3.js → SvGridChartPanel-B38_VjXM.js} +52 -52
- package/dist/{SvGridChartView-AcWj_tcs.js → SvGridChartView-ScXTF6t-.js} +4 -4
- package/dist/{SvGridDropdown-BXqvR1cs.js → SvGridDropdown-DnAESFDu.js} +29 -29
- package/dist/angular/fesm2022/svgrid-grid-wc-angular.mjs +358 -0
- package/dist/angular/fesm2022/svgrid-grid-wc-angular.mjs.map +1 -0
- package/dist/angular/package.json +25 -0
- package/dist/angular/types/svgrid-grid-wc-angular.d.ts +161 -0
- package/dist/{client-DoXxrq8q.js → client-DjwUji8D.js} +1 -1
- package/dist/column-resize-DvCRUrN3.js +101 -0
- package/dist/date-format-CPHqTHN6.js +1127 -0
- package/dist/dismissable-DvhBKm3q.js +41 -0
- package/dist/react/index.d.ts +313 -0
- package/dist/react/index.js +72 -0
- package/dist/{row-drag-touch-Ddaa-QeB.js → row-drag-touch-CycRR65n.js} +12 -10
- package/dist/row-resize-D-8s3cqT.js +94 -0
- package/dist/shadow/GridMenus-DpmS1pzo.js +1121 -0
- package/dist/shadow/SvDateRangeInput-u4ibte8S.js +196 -0
- package/dist/shadow/SvDateTimePicker-DVFiDxUq.js +765 -0
- package/dist/shadow/SvField-ChCI-O2O.js +146 -0
- package/dist/shadow/SvGrid.helpers-BdVDtjUm.js +135 -0
- package/dist/shadow/SvGridCellEditor-DvsQyE9a.js +550 -0
- package/dist/shadow/SvGridChart-yK5Zv85y.js +1199 -0
- package/dist/shadow/SvGridChartPanel-B38_VjXM.js +584 -0
- package/dist/shadow/SvGridChartView-ScXTF6t-.js +50 -0
- package/dist/shadow/SvGridDropdown-DnAESFDu.js +256 -0
- package/dist/shadow/cell-formatting-C0OsDmi_.js +86 -0
- package/dist/shadow/chart-uvs3sFJA.js +1220 -0
- package/dist/shadow/client-DjwUji8D.js +2960 -0
- package/dist/shadow/column-resize-DvCRUrN3.js +101 -0
- package/dist/shadow/date-format-CPHqTHN6.js +1127 -0
- package/dist/shadow/dismissable-DvhBKm3q.js +41 -0
- package/dist/shadow/editor-contract-peBDxir_.js +22 -0
- package/dist/shadow/editor-registry-DxGKqcvx.js +24 -0
- package/dist/shadow/export-format-C8kZGZfz.js +161 -0
- package/dist/shadow/popover-WsGlvtQv.js +69 -0
- package/dist/shadow/row-drag-touch-CycRR65n.js +93 -0
- package/dist/shadow/row-resize-D-8s3cqT.js +94 -0
- package/dist/shadow/sv-grid-shadow-element.d.ts +246 -0
- package/dist/shadow/sv-grid-shadow-element.js +10175 -0
- package/dist/{svelte-virtualizer.svelte-CFoYP2Ls.js → shadow/svelte-virtualizer.svelte-DZ9UcyfT.js} +35 -30
- package/dist/shadow/validate-CgmAtX1A.js +75 -0
- package/dist/sv-grid-element.d.ts +246 -0
- package/dist/sv-grid-element.js +3655 -2620
- package/dist/svelte-virtualizer.svelte-DZ9UcyfT.js +527 -0
- package/dist/validate-CgmAtX1A.js +75 -0
- package/dist/vue/index.d.ts +147 -0
- package/dist/vue/index.js +72 -0
- package/package.json +71 -6
- package/dist/GridMenus-CU_-Ks4f.js +0 -1001
- package/dist/SvDateTimePicker-Ch1Vug8H.js +0 -1885
- package/dist/SvGridCellEditor-CBJUbAsR.js +0 -523
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region ../grid/dist/a11y/dismissable.js
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
return t ? (Array.isArray(e) ? e : [e]).some((e) => e != null && e.contains(t)) : !1;
|
|
4
|
+
}
|
|
5
|
+
var t = [], n = !1;
|
|
6
|
+
function r() {
|
|
7
|
+
n || typeof document > "u" || (n = !0, document.addEventListener("keydown", (e) => {
|
|
8
|
+
if (e.key !== "Escape") return;
|
|
9
|
+
let n = t[t.length - 1];
|
|
10
|
+
n?.closeOnEscape && (e.stopPropagation(), n.onDismiss("escape"));
|
|
11
|
+
}, !0), document.addEventListener("pointerdown", (n) => {
|
|
12
|
+
let r = t[t.length - 1];
|
|
13
|
+
r?.closeOnOutside && (e(r.element(), n.target) || r.onDismiss("outside"));
|
|
14
|
+
}, !0));
|
|
15
|
+
}
|
|
16
|
+
function i(e) {
|
|
17
|
+
let n = {
|
|
18
|
+
element: e.element,
|
|
19
|
+
onDismiss: e.onDismiss,
|
|
20
|
+
closeOnEscape: e.closeOnEscape ?? !0,
|
|
21
|
+
closeOnOutside: e.closeOnOutside ?? !0
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
activate() {
|
|
25
|
+
r(), t.includes(n) || t.push(n);
|
|
26
|
+
},
|
|
27
|
+
release() {
|
|
28
|
+
let e = t.indexOf(n);
|
|
29
|
+
e >= 0 && t.splice(e, 1);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function a(t, n) {
|
|
34
|
+
if (typeof window > "u") return () => {};
|
|
35
|
+
let r = (r) => {
|
|
36
|
+
e(t(), r.target) || n();
|
|
37
|
+
};
|
|
38
|
+
return window.addEventListener("scroll", r, !0), () => window.removeEventListener("scroll", r, !0);
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { a as n, i 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,93 @@
|
|
|
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, a) {
|
|
61
|
+
if (!e.managed() || n) return;
|
|
62
|
+
let s = e.originalAt(i);
|
|
63
|
+
if (s == null) return;
|
|
64
|
+
let c = 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: c?.closest?.(".sv-grid-container") ?? null,
|
|
74
|
+
root: c?.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 });
|
|
76
|
+
let f = a == null ? 0 : Math.max(0, performance.now() - a);
|
|
77
|
+
n.timer = setTimeout(() => {
|
|
78
|
+
if (n) {
|
|
79
|
+
n.started = !0, n.timer = null, n.root?.classList.add("sv-grid-row-drag-active");
|
|
80
|
+
try {
|
|
81
|
+
c?.setPointerCapture?.(r.pointerId);
|
|
82
|
+
} catch {}
|
|
83
|
+
e.openBus(s), t.rowDragActive = !0, t.rowDropIndex = i, t.rowDropSide = "before";
|
|
84
|
+
}
|
|
85
|
+
}, Math.max(0, 350 - f));
|
|
86
|
+
},
|
|
87
|
+
destroy() {
|
|
88
|
+
c(!1);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
export { e as createTouchDrag };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
//#region ../grid/dist/row-resize.js
|
|
2
|
+
var e = "sv-grid-row-resize-handle";
|
|
3
|
+
function t(t, n) {
|
|
4
|
+
let r = n, i = null;
|
|
5
|
+
function a(e) {
|
|
6
|
+
let t = e.querySelector("[data-svgrid-row]")?.dataset.svgridRow;
|
|
7
|
+
return t == null ? NaN : Number(t);
|
|
8
|
+
}
|
|
9
|
+
function o(e) {
|
|
10
|
+
if (!i) return;
|
|
11
|
+
let t = r.min ?? 20, n = r.max ?? 320, a = Math.max(t, Math.min(n, i.startHeight + (e.clientY - i.startY)));
|
|
12
|
+
i.trEl.style.height = `${Math.round(a)}px`, r.onResizeMove?.(i.rowIndex, Math.round(a));
|
|
13
|
+
}
|
|
14
|
+
function s(e) {
|
|
15
|
+
if (!i) return;
|
|
16
|
+
let t = r.min ?? 20, n = r.max ?? 320, a = Math.max(t, Math.min(n, i.startHeight + (e.clientY - i.startY)));
|
|
17
|
+
r.onResize(i.rowIndex, Math.round(a)), i.strip.classList.remove("is-resizing");
|
|
18
|
+
try {
|
|
19
|
+
i.trEl.releasePointerCapture(e.pointerId);
|
|
20
|
+
} catch {}
|
|
21
|
+
i = null, window.removeEventListener("pointermove", o), window.removeEventListener("pointerup", s), document.body.style.cursor = "";
|
|
22
|
+
}
|
|
23
|
+
function c(t) {
|
|
24
|
+
if (r.disabled) return;
|
|
25
|
+
let n = t.target;
|
|
26
|
+
if (!n?.classList.contains(e)) return;
|
|
27
|
+
let i = t.shiftKey ? 1 : 10, o = 0;
|
|
28
|
+
if (t.key === "ArrowUp") o = -i;
|
|
29
|
+
else if (t.key === "ArrowDown") o = i;
|
|
30
|
+
else return;
|
|
31
|
+
let s = n.closest("tr.sv-grid-row");
|
|
32
|
+
if (!s) return;
|
|
33
|
+
let c = a(s);
|
|
34
|
+
if (!Number.isFinite(c)) return;
|
|
35
|
+
t.preventDefault(), t.stopPropagation();
|
|
36
|
+
let l = r.min ?? 20, u = r.max ?? 320, d = Math.round(Math.max(l, Math.min(u, s.getBoundingClientRect().height + o)));
|
|
37
|
+
s.style.height = `${d}px`, r.onResizeMove?.(c, d), r.onResize(c, d);
|
|
38
|
+
}
|
|
39
|
+
function l(t) {
|
|
40
|
+
if (r.disabled) return;
|
|
41
|
+
let n = t.target;
|
|
42
|
+
if (!n?.classList.contains(e)) return;
|
|
43
|
+
let c = n.closest("tr.sv-grid-row");
|
|
44
|
+
if (!c) return;
|
|
45
|
+
let l = a(c);
|
|
46
|
+
if (Number.isFinite(l)) {
|
|
47
|
+
t.preventDefault(), t.stopPropagation(), n.classList.add("is-resizing"), i = {
|
|
48
|
+
rowIndex: l,
|
|
49
|
+
startY: t.clientY,
|
|
50
|
+
startHeight: c.getBoundingClientRect().height,
|
|
51
|
+
trEl: c,
|
|
52
|
+
strip: n
|
|
53
|
+
};
|
|
54
|
+
try {
|
|
55
|
+
c.setPointerCapture(t.pointerId);
|
|
56
|
+
} catch {}
|
|
57
|
+
document.body.style.cursor = "row-resize", window.addEventListener("pointermove", o), window.addEventListener("pointerup", s);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function u() {
|
|
61
|
+
if (r.disabled) {
|
|
62
|
+
d();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
let n = t.querySelectorAll("tr.sv-grid-row");
|
|
66
|
+
for (let t of n) {
|
|
67
|
+
if (t.classList.contains("sv-grid-header-row") || t.classList.contains("sv-grid-row-spacer")) continue;
|
|
68
|
+
let n = t.querySelector(".sv-grid-cell.sv-row-gutter, .sv-grid-cell.sv-grid-row-number-cell") ?? (r.anchor === "row" ? t.querySelector(".sv-grid-cell") : null);
|
|
69
|
+
if (!n || n.querySelector(`:scope > .${e}`)) continue;
|
|
70
|
+
getComputedStyle(n).position === "static" && (n.style.position = "relative"), n.style.overflow = "visible";
|
|
71
|
+
let i = document.createElement("div");
|
|
72
|
+
i.className = e, i.setAttribute("role", "separator"), i.setAttribute("aria-orientation", "horizontal"), i.setAttribute("aria-label", "Resize row"), i.tabIndex = 0, i.style.cssText = "position:absolute;left:0;right:0;bottom:0;height:5px;cursor:row-resize;user-select:none;z-index:60;pointer-events:auto;", n.appendChild(i);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function d() {
|
|
76
|
+
t.querySelectorAll(`.${e}`).forEach((e) => e.remove());
|
|
77
|
+
}
|
|
78
|
+
t.addEventListener("pointerdown", l, { capture: !0 }), t.addEventListener("keydown", c, { capture: !0 });
|
|
79
|
+
let f = new MutationObserver(() => u());
|
|
80
|
+
return f.observe(t, {
|
|
81
|
+
childList: !0,
|
|
82
|
+
subtree: !0
|
|
83
|
+
}), u(), {
|
|
84
|
+
update(e) {
|
|
85
|
+
let t = r.disabled;
|
|
86
|
+
r = e, t !== r.disabled && u();
|
|
87
|
+
},
|
|
88
|
+
destroy() {
|
|
89
|
+
t.removeEventListener("pointerdown", l, { capture: !0 }), t.removeEventListener("keydown", c, { capture: !0 }), window.removeEventListener("pointermove", o), window.removeEventListener("pointerup", s), f.disconnect(), d();
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
export { t as rowResize };
|