@sheetxl/grid-react 0.3.18 → 0.3.20
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/browser/cjs/index.cjs +6 -6
- package/browser/esm/index.mjs +1243 -1214
- package/licenses/dependencies.txt +2 -2
- package/node/esm/index.mjs +568 -535
- package/package.json +3 -3
package/browser/esm/index.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._sheetxl-grid_h9wwa_7{position:relative;box-sizing:border-box;user-select:none}._sheetxl-grid_h9wwa_7 *{box-sizing:border-box!important}._sheetxl-grid_h9wwa_7 *:focus{outline:none}._sheetxl-grid_h9wwa_7 .cell-container{position:absolute;overflow:visible;white-space:pre}._sheetxl-grid_h9wwa_7 .cell-container>*{inset:0;position:absolute}._sheetxl-grid_h9wwa_7 .sheetxl-stage{contain:strict}._sheetxl-grid_h9wwa_7 .sheetxl-stage>*{contain:strict}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
2
|
import { jsx as q, jsxs as Ht, Fragment as wn } from "react/jsx-runtime";
|
|
3
|
-
import Sn, { memo as At, useCallback as D, useRef as G, useEffect as st, useImperativeHandle as Ur, forwardRef as Ut, useMemo as
|
|
4
|
-
import { createRoot as
|
|
5
|
-
import { unstable_batchedUpdates as
|
|
3
|
+
import Sn, { memo as At, useCallback as D, useRef as G, useEffect as st, useImperativeHandle as Ur, forwardRef as Ut, useMemo as Ee, useLayoutEffect as tn, useState as Ze, version as Kr, createElement as Jo, useReducer as Qo } from "react";
|
|
4
|
+
import { createRoot as $i } from "react-dom/client";
|
|
5
|
+
import { unstable_batchedUpdates as Bi, createPortal as qr } from "react-dom";
|
|
6
6
|
/**
|
|
7
|
-
* @license @sheetxl/grid-react - Grid - Advanced data grid component for React - v0.3.
|
|
7
|
+
* @license @sheetxl/grid-react - Grid - Advanced data grid component for React - v0.3.20
|
|
8
8
|
*
|
|
9
9
|
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
10
10
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
11
11
|
*/
|
|
12
|
-
const it = "up", lt = "down", ot = "left", Ke = "right", uo = "tl", Hn = "t", Nn = "l", Xt = "c", Ft = "text/html", fn = "text/plain", Mo = "image/png",
|
|
13
|
-
Object.freeze(Object.defineProperty({ __proto__: null, EmptyBounds:
|
|
14
|
-
const Nt = "column", an = "row",
|
|
12
|
+
const it = "up", lt = "down", ot = "left", Ke = "right", uo = "tl", Hn = "t", Nn = "l", Xt = "c", Ft = "text/html", fn = "text/plain", Mo = "image/png", Fi = Object.freeze({ left: 0, top: 0 }), ji = Object.freeze({ left: 0, top: 0, bottom: 0, right: 0 }), Vi = Object.freeze({ x: 0, y: 0, width: 0, height: 0 });
|
|
13
|
+
Object.freeze(Object.defineProperty({ __proto__: null, EmptyBounds: Vi, EmptyRect: ji, EmptyTopLeft: Fi }, Symbol.toStringTag, { value: "Module" }));
|
|
14
|
+
const Nt = "column", an = "row", Wi = Object.freeze({ colIndex: 0, rowIndex: 0 }), Hi = Object.freeze({ colStart: 0, rowStart: 0, colEnd: 0, rowEnd: 0 }), Yr = (e, t) => e.colStart === t.colStart ? e.rowStart - t.rowStart : e.colStart - t.colStart, Xr = (e, t) => e.rowStart === t.rowStart ? e.colStart - t.colStart : e.rowStart - t.rowStart, Ni = (e, t) => e.rowEnd === t.rowEnd ? t.colEnd - e.colEnd : t.rowEnd - e.rowEnd, Ui = (e, t) => e.colEnd === t.colEnd ? t.rowEnd - e.rowEnd : t.colEnd - e.colEnd, or = (e, t) => e.colIndex === t.colIndex ? e.rowIndex - t.rowIndex : e.colIndex - t.colIndex, rr = (e, t) => e.rowIndex === t.rowIndex ? e.colIndex - t.colIndex : e.rowIndex - t.rowIndex, Gr = (e = an, t = !1) => t ? e !== Nt ? Ni : Ui : e !== Nt ? Xr : Yr, ir = (e, t) => e === t || !(!e || !t) && e.rowIndex === t.rowIndex && e.colIndex === t.colIndex, jo = (e, t) => e === t || !(!e || !t) && e.rowStart === t.rowStart && e.rowEnd === t.rowEnd && e.colStart === t.colStart && e.colEnd === t.colEnd, Vo = (e, t) => !(!e || !t || e.colStart > t.colEnd || t.colStart > e.colEnd || e.rowStart > t.rowEnd || t.rowStart > e.rowEnd), lr = (e, t) => {
|
|
15
15
|
if (e === t) return !0;
|
|
16
16
|
if (!e || !t || e.length !== t.length) return !1;
|
|
17
17
|
for (let n = 0; n < e.length; n++) if (!jo(e[n], t[n])) return !1;
|
|
@@ -31,7 +31,7 @@ const Nt = "column", an = "row", Hi = Object.freeze({ colIndex: 0, rowIndex: 0 }
|
|
|
31
31
|
Vo(n, r) && (n.rowStart = Math.min(n.rowStart, r.rowStart), n.colStart = Math.min(n.colStart, r.colStart), n.rowEnd = Math.max(n.rowEnd, r.rowEnd), n.colEnd = Math.max(n.colEnd, r.colEnd));
|
|
32
32
|
}
|
|
33
33
|
return n;
|
|
34
|
-
},
|
|
34
|
+
}, Ki = [null, null], qi = (e, t, n) => {
|
|
35
35
|
if (e[0].value === e[1].value) return t;
|
|
36
36
|
};
|
|
37
37
|
function cr(e, t = 2, n, o = an, r) {
|
|
@@ -42,28 +42,28 @@ function cr(e, t = 2, n, o = an, r) {
|
|
|
42
42
|
const d = i.sort(Gr(l ? an : Nt));
|
|
43
43
|
i = [], i.push(d[0]);
|
|
44
44
|
const g = d.length;
|
|
45
|
-
let m = 0,
|
|
46
|
-
for (let
|
|
47
|
-
const
|
|
45
|
+
let m = 0, u = d[0], x = u.colStart, M = u.rowStart, E = u.colEnd, P = u.rowEnd;
|
|
46
|
+
for (let Q = 1; Q < g; Q++) {
|
|
47
|
+
const k = d[Q];
|
|
48
48
|
let I = !1;
|
|
49
|
-
if (I = l ?
|
|
50
|
-
let z = { colStart: x, rowStart:
|
|
51
|
-
if (
|
|
52
|
-
const
|
|
53
|
-
|
|
49
|
+
if (I = l ? u && M === k.rowStart && P === k.rowEnd && E + 1 === k.colStart : u && x === k.colStart && E === k.colEnd && P + 1 === k.rowStart, I) {
|
|
50
|
+
let z = { colStart: x, rowStart: M, colEnd: l ? k.colEnd : E, rowEnd: l ? P : k.rowEnd };
|
|
51
|
+
if (u.value !== void 0 && (z.value = u.value), n) {
|
|
52
|
+
const se = r ?? [null, null];
|
|
53
|
+
se[0] = u, se[1] = k, z = n(se, z, o);
|
|
54
54
|
}
|
|
55
55
|
if (z) {
|
|
56
|
-
i[m] = z, a = !0,
|
|
56
|
+
i[m] = z, a = !0, u = z, x = u.colStart, M = u.rowStart, E = u.colEnd, P = u.rowEnd;
|
|
57
57
|
continue;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
i[++m] =
|
|
60
|
+
i[++m] = k, u = k, x = u.colStart, M = u.rowStart, E = u.colEnd, P = u.rowEnd;
|
|
61
61
|
}
|
|
62
62
|
s++, l = !l, s === 1 && (a = !0);
|
|
63
63
|
} while (s < t && a && i.length > 1);
|
|
64
64
|
return i;
|
|
65
65
|
}
|
|
66
|
-
const Z = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell:
|
|
66
|
+
const Z = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: Wi, EmptyRange: Hi, cellToRange: (e, t) => {
|
|
67
67
|
if (!e) return null;
|
|
68
68
|
let n = t;
|
|
69
69
|
return n || (n = { ...e }, delete n.colIndex, delete n.rowIndex), n.colStart = e.colIndex ?? 0, n.rowStart = e.rowIndex ?? 0, n.colEnd = e.colIndex ?? 0, n.rowEnd = e.rowIndex ?? 0, n;
|
|
@@ -74,14 +74,14 @@ const Z = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: Hi,
|
|
|
74
74
|
let g = !0;
|
|
75
75
|
const m = d !== void 0;
|
|
76
76
|
if (m) {
|
|
77
|
-
const
|
|
78
|
-
|
|
77
|
+
const M = e ? e(r, d, t) : r === d ? d : void 0;
|
|
78
|
+
M === void 0 ? g = !1 : d = M;
|
|
79
79
|
}
|
|
80
80
|
if (g && a === l + 1 && s === i) return t ? o.rowEnd = a : o.colEnd = a, l = a, void (r = d);
|
|
81
81
|
o && n.push(o);
|
|
82
|
-
const
|
|
83
|
-
o = { colStart:
|
|
84
|
-
}, done: (s) => (o && (n.push(o), o = null), s ? cr(n, 3, s === !0 ?
|
|
82
|
+
const u = t ? s : a, x = t ? a : s;
|
|
83
|
+
o = { colStart: u, rowStart: x, colEnd: u, rowEnd: x }, m && (o.value = d), i = s, l = a, r = d;
|
|
84
|
+
}, done: (s) => (o && (n.push(o), o = null), s ? cr(n, 3, s === !0 ? qi : s, t ? Nt : an, Ki) : n) };
|
|
85
85
|
}, createRangeComparator: Gr, defaultRange: (e, t, n) => e ? n ? (n.colStart = e.colStart ?? t.colStart, n.rowStart = e.rowStart ?? t.rowStart, n.colEnd = e.colEnd ?? t.colEnd, n.rowEnd = e.rowEnd ?? t.rowEnd, n) : { colStart: e.colStart ?? t.colStart, rowStart: e.rowStart ?? t.rowStart, colEnd: e.colEnd ?? t.colEnd, rowEnd: e.rowEnd ?? t.rowEnd } : t, extendRangeToIntersectingRanges: sr, extendRangeToUnionRanges: (e, t) => {
|
|
86
86
|
if (!t || t.length === 0) return e;
|
|
87
87
|
let n = e, o = null;
|
|
@@ -104,20 +104,20 @@ const Z = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: Hi,
|
|
|
104
104
|
let o = e[0];
|
|
105
105
|
for (let r = 1; r < e.length; r++) o = To(o, e[r], n);
|
|
106
106
|
return t && (o = To(o, t, n)), o;
|
|
107
|
-
} }, Symbol.toStringTag, { value: "Module" })),
|
|
108
|
-
function
|
|
107
|
+
} }, Symbol.toStringTag, { value: "Module" })), Yi = typeof Symbol == "function" && Symbol.for ? Symbol.for("react.element") : 60103;
|
|
108
|
+
function Xi(e) {
|
|
109
109
|
return /* @__PURE__ */ function(t) {
|
|
110
110
|
return !!t && typeof t == "object";
|
|
111
111
|
}(e) && !function(t) {
|
|
112
112
|
const n = Object.prototype.toString.call(t);
|
|
113
|
-
return n === "[object RegExp]" || n === "[object Date]" || t.$$typeof ===
|
|
113
|
+
return n === "[object RegExp]" || n === "[object Date]" || t.$$typeof === Yi;
|
|
114
114
|
}(e);
|
|
115
115
|
}
|
|
116
116
|
function Vn(e, t) {
|
|
117
|
-
return t.clone !== !1 && t.isMergeableObject(e) ?
|
|
117
|
+
return t.clone !== !1 && t.isMergeableObject(e) ? En((n = e, Array.isArray(n) ? [] : {}), e, t) : e;
|
|
118
118
|
var n;
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function Gi(e, t, n) {
|
|
121
121
|
return e.concat(t).map(function(o) {
|
|
122
122
|
return Vn(o, n);
|
|
123
123
|
});
|
|
@@ -135,8 +135,8 @@ function dr(e, t) {
|
|
|
135
135
|
return !1;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
(n = n || {}).arrayMerge = n.arrayMerge ||
|
|
138
|
+
function En(e, t, n) {
|
|
139
|
+
(n = n || {}).arrayMerge = n.arrayMerge || Gi, n.isMergeableObject = n.isMergeableObject || Xi, n.cloneUnlessOtherwiseSpecified = Vn;
|
|
140
140
|
const o = Array.isArray(t);
|
|
141
141
|
return o === Array.isArray(e) ? o ? n.arrayMerge(e, t, n) : function(r, i, l) {
|
|
142
142
|
const s = {};
|
|
@@ -144,26 +144,26 @@ function _n(e, t, n) {
|
|
|
144
144
|
s[a] = Vn(r[a], l);
|
|
145
145
|
}), ar(i).forEach(function(a) {
|
|
146
146
|
var d, g;
|
|
147
|
-
dr(d = r, g = a) && (!Object.hasOwnProperty.call(d, g) || !Object.propertyIsEnumerable.call(d, g)) || (dr(r, a) && l.isMergeableObject(i[a]) ? s[a] = function(m,
|
|
148
|
-
if (!
|
|
149
|
-
const x =
|
|
150
|
-
return typeof x == "function" ? x :
|
|
147
|
+
dr(d = r, g = a) && (!Object.hasOwnProperty.call(d, g) || !Object.propertyIsEnumerable.call(d, g)) || (dr(r, a) && l.isMergeableObject(i[a]) ? s[a] = function(m, u) {
|
|
148
|
+
if (!u.customMerge) return En;
|
|
149
|
+
const x = u.customMerge(m);
|
|
150
|
+
return typeof x == "function" ? x : En;
|
|
151
151
|
}(a, l)(r[a], i[a], l) : s[a] = Vn(i[a], l));
|
|
152
152
|
}), s;
|
|
153
153
|
}(e, t, n) : Vn(t, n);
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
En.all = function(e, t) {
|
|
156
156
|
if (!Array.isArray(e)) throw new Error("first argument should be an array");
|
|
157
157
|
return e.reduce(function(n, o) {
|
|
158
|
-
return
|
|
158
|
+
return En(n, o, t);
|
|
159
159
|
}, {});
|
|
160
160
|
};
|
|
161
|
-
const
|
|
161
|
+
const Zi = Object.freeze([]), Ji = Object.freeze({}), ur = (e) => e, so = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
|
|
162
162
|
let t = 16 * Math.random() | 0;
|
|
163
163
|
return (e === "x" ? t : 3 & t | 8).toString(16);
|
|
164
164
|
}), Zr = (e, t) => e === t || !(!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length) && e.every((n, o) => n === t[o]), Fn = (e) => typeof e == "object" && !Array.isArray(e) && e !== null, Jr = (e) => typeof e != "object" || Array.isArray(e) || e === null ? e : (Object.keys(e).forEach(function(t) {
|
|
165
165
|
e[t] && typeof e[t] == "object" ? Jr(e[t]) : e[t] !== null && e[t] !== void 0 || delete e[t], typeof e[t] == "object" && Object.keys(e[t]).length === 0 && delete e[t];
|
|
166
|
-
}), Object.keys(e).length === 0 ? null : e),
|
|
166
|
+
}), Object.keys(e).length === 0 ? null : e), Qi = (e, t) => !(e !== t && !Zr(e, t) && !e.isEqual?.(t)), Qr = (e, t, n = Qi) => {
|
|
167
167
|
if (e == null || e === t) return null;
|
|
168
168
|
if (!e || typeof e != "object" || Array.isArray(e) || e.isImmutable?.()) return n(e, t) ? null : e;
|
|
169
169
|
const o = Object.keys(e);
|
|
@@ -182,7 +182,7 @@ const Ji = Object.freeze([]), Qi = Object.freeze({}), ur = (e) => e, so = () =>
|
|
|
182
182
|
function ei() {
|
|
183
183
|
return typeof process < "u" && process.release?.name === "node" || (typeof process < "u" && process.browser, !1);
|
|
184
184
|
}
|
|
185
|
-
const wr = (e, t = !1) => (document.hasFocus() || t) && (e === document.activeElement || e?.contains(document.activeElement)), Ct = Object.freeze(Object.defineProperty({ __proto__: null, EmptyArray:
|
|
185
|
+
const wr = (e, t = !1) => (document.hasFocus() || t) && (e === document.activeElement || e?.contains(document.activeElement)), Ct = Object.freeze(Object.defineProperty({ __proto__: null, EmptyArray: Zi, EmptyObject: Ji, OSType: jt, arrayMove: function(e, t, n) {
|
|
186
186
|
const o = e.slice();
|
|
187
187
|
return o.splice(n < 0 ? o.length + n : n, 0, o.splice(t, 1)[0]), o;
|
|
188
188
|
}, asNumber: (e) => {
|
|
@@ -255,7 +255,7 @@ const wr = (e, t = !1) => (document.hasFocus() || t) && (e === document.activeEl
|
|
|
255
255
|
return Object.freeze(t), Object.keys(t).forEach((n) => {
|
|
256
256
|
typeof t[n] != "object" || t[n] === null || Object.isFrozen(t[n]) || e(t[n]);
|
|
257
257
|
}), t;
|
|
258
|
-
}, deepMerge:
|
|
258
|
+
}, deepMerge: En, diffValues: (e, t) => {
|
|
259
259
|
const n = {}, o = Object.keys(t), r = o.length;
|
|
260
260
|
for (let i = 0; i < r; i++) {
|
|
261
261
|
const l = o[i];
|
|
@@ -309,7 +309,7 @@ const wr = (e, t = !1) => (document.hasFocus() || t) && (e === document.activeEl
|
|
|
309
309
|
const t = e.length;
|
|
310
310
|
if (t > 0 && e[t - 1] !== void 0 && !Fn(e[t - 1])) return e[t - 1];
|
|
311
311
|
let n = e[0] || {};
|
|
312
|
-
for (let o = 1; o < t; o++) n =
|
|
312
|
+
for (let o = 1; o < t; o++) n = En(n, e[o] || {}, { arrayMerge: (r, i) => [...i] });
|
|
313
313
|
return n;
|
|
314
314
|
}, nextTick: (e) => {
|
|
315
315
|
typeof window < "u" && typeof window.requestAnimationFrame == "function" ? window.requestAnimationFrame(() => {
|
|
@@ -456,7 +456,7 @@ const ni = "data:image/png;base64,", oi = "Unable to resolve image.", mr = (e) =
|
|
|
456
456
|
}
|
|
457
457
|
o || n(oi);
|
|
458
458
|
}), Ro = "image/svg+xml";
|
|
459
|
-
var xr,
|
|
459
|
+
var xr, yr;
|
|
460
460
|
Object.freeze(Object.defineProperty({ __proto__: null, DATA_URL_PNG_PREFIX: ni, getImageDataUrl: (e, t = 1) => new Promise(async (n, o) => {
|
|
461
461
|
let r = null;
|
|
462
462
|
try {
|
|
@@ -493,7 +493,7 @@ Object.freeze(Object.defineProperty({ __proto__: null, DATA_URL_PNG_PREFIX: ni,
|
|
|
493
493
|
};
|
|
494
494
|
if (t === Ro ? await r() : t.startsWith("image/") ? await o() : (await o(), n || await r()), !n) throw new Error("Failed to load image");
|
|
495
495
|
return n;
|
|
496
|
-
} }, Symbol.toStringTag, { value: "Module" })), (
|
|
496
|
+
} }, Symbol.toStringTag, { value: "Module" })), (yr = xr || (xr = {})).resolveTypedUpdates = (e, t, n, o) => {
|
|
497
497
|
if (e === null) return e;
|
|
498
498
|
if (e === void 0) return o;
|
|
499
499
|
let r = e;
|
|
@@ -513,24 +513,24 @@ Object.freeze(Object.defineProperty({ __proto__: null, DATA_URL_PNG_PREFIX: ni,
|
|
|
513
513
|
s = null;
|
|
514
514
|
for (let d = 0; d < a.length; d++) {
|
|
515
515
|
const g = a[d];
|
|
516
|
-
let m,
|
|
517
|
-
if (
|
|
516
|
+
let m, u = r[g];
|
|
517
|
+
if (u !== void 0) {
|
|
518
518
|
const x = i[g];
|
|
519
|
-
m = x ? (0,
|
|
519
|
+
m = x ? (0, yr.resolveTypedUpdates)(u, x, n, o?.[g]) : u;
|
|
520
520
|
} else m = o?.[g];
|
|
521
521
|
m != null && (s = s ?? {}, s[g] = m);
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
524
|
return s;
|
|
525
525
|
};
|
|
526
|
-
const
|
|
526
|
+
const vr = `The Safari browser does not support advanced copy and paste.
|
|
527
527
|
Copy and paste will be limited to within the browser tab.
|
|
528
528
|
|
|
529
529
|
Please use Chrome or Edge if external copy and paste is required.`, ko = `You do not have permissions to access the clipboard.
|
|
530
530
|
All copy and paste operations will be limited to the browser tab.`, ri = { Safari: `The Safari browser does not support advanced copy and paste.
|
|
531
531
|
Copy and paste will be limited to within the browser tab.
|
|
532
532
|
|
|
533
|
-
Please use Chrome or Edge if external copy and paste is required.`, Perms: ko, PermsWrite: Un() === jt.Safari ?
|
|
533
|
+
Please use Chrome or Edge if external copy and paste is required.`, Perms: ko, PermsWrite: Un() === jt.Safari ? vr : ko, PermsRead: Un() === jt.Safari ? vr : ko }, Po = async () => new Promise((e) => {
|
|
534
534
|
document.hasFocus() ? e() : globalThis.addEventListener?.("focus", () => {
|
|
535
535
|
e();
|
|
536
536
|
}, { once: !0 }), document.activeElement.focus?.();
|
|
@@ -612,7 +612,7 @@ const Ho = async (e, t = Ft) => new Promise(async (n, o) => {
|
|
|
612
612
|
console.warn("Can't parse html from clipboard.");
|
|
613
613
|
}
|
|
614
614
|
return o;
|
|
615
|
-
}, Kn = "clipboard-uuid", Tn = "web text/uuid", Sr = (e) => `<div style="display:none" ${Kn}="${e}"/>`,
|
|
615
|
+
}, Kn = "clipboard-uuid", Tn = "web text/uuid", Sr = (e) => `<div style="display:none" ${Kn}="${e}"/>`, el = (e, t) => {
|
|
616
616
|
let n = null;
|
|
617
617
|
try {
|
|
618
618
|
const o = new DOMParser().parseFromString(t, Ft);
|
|
@@ -621,7 +621,7 @@ const Ho = async (e, t = Ft) => new Promise(async (n, o) => {
|
|
|
621
621
|
console.warn("Can't embed uuid.", o);
|
|
622
622
|
}
|
|
623
623
|
return n;
|
|
624
|
-
},
|
|
624
|
+
}, _r = (e, t) => {
|
|
625
625
|
if (!t || !e) return !1;
|
|
626
626
|
try {
|
|
627
627
|
const n = t.querySelectorAll(`[${Kn}="${e}"]`);
|
|
@@ -648,7 +648,7 @@ let ho = class {
|
|
|
648
648
|
const e = await Ho(this._nativeClipboard, Tn);
|
|
649
649
|
if (!this._state || e && e === this._state.uuid) return !0;
|
|
650
650
|
const t = await br(this._nativeClipboard, Ft);
|
|
651
|
-
return !this._state || (
|
|
651
|
+
return !this._state || (_r(this._state.uuid, t) || this.clear(), !0);
|
|
652
652
|
}, async (e) => {
|
|
653
653
|
e?.message === "denied" || e.message?.includes("Document is not focused") || Un() === jt.Safari || console.warn("Unable to detect clipboard changes: ", e);
|
|
654
654
|
});
|
|
@@ -671,7 +671,7 @@ let ho = class {
|
|
|
671
671
|
const t = await Ho(this._nativeClipboard, Tn);
|
|
672
672
|
if (t && t === e._state.uuid) return !0;
|
|
673
673
|
const n = await br(this._nativeClipboard, Ft);
|
|
674
|
-
if (
|
|
674
|
+
if (_r(e._state?.uuid, n)) return !0;
|
|
675
675
|
}
|
|
676
676
|
return e._state = { items: await ii(this._nativeClipboard), uuid: null, ref: null }, this.dispatchEvent(new Event("clipboardread")), !0;
|
|
677
677
|
}, async (t) => {
|
|
@@ -694,25 +694,25 @@ let ho = class {
|
|
|
694
694
|
const s = r[l];
|
|
695
695
|
let a = s.types.indexOf(Ft), d = null;
|
|
696
696
|
if (a !== -1) {
|
|
697
|
-
const
|
|
698
|
-
d = await Wo(
|
|
697
|
+
const u = await s.getType(Ft);
|
|
698
|
+
d = await Wo(u), d && (d = el(o, d));
|
|
699
699
|
}
|
|
700
700
|
if (!d && s.types.includes(fn)) {
|
|
701
|
-
const
|
|
702
|
-
if (
|
|
701
|
+
const u = await s.getType(fn);
|
|
702
|
+
if (u) {
|
|
703
703
|
let x = null;
|
|
704
|
-
typeof
|
|
704
|
+
typeof u == "string" ? (console.warn("text as string", u), x = u) : x = await Wo(u), x && (d = `<div ${Kn}="${o}">${x}</div>`);
|
|
705
705
|
}
|
|
706
706
|
}
|
|
707
707
|
if (!d && s.types.includes(Mo)) {
|
|
708
|
-
const
|
|
708
|
+
const u = await s.getType(Mo), x = ti(await u.arrayBuffer());
|
|
709
709
|
d = `<div ${Kn}="${o}"><img src="${ni + x}"/></div>`;
|
|
710
710
|
}
|
|
711
711
|
!d && o && (d = Sr(o));
|
|
712
712
|
const g = new Blob([d ?? ""], { type: Ft }), m = {};
|
|
713
|
-
for (let
|
|
714
|
-
const x = s.types[
|
|
715
|
-
m[x] =
|
|
713
|
+
for (let u = 0; u < s.types.length; u++) {
|
|
714
|
+
const x = s.types[u];
|
|
715
|
+
m[x] = u === a ? g : s.getType(x);
|
|
716
716
|
}
|
|
717
717
|
d && a === -1 && (m[Ft] = g), o && (m[Tn] = new Blob([o], { type: Tn })), n.push(new ClipboardItem(m));
|
|
718
718
|
}
|
|
@@ -816,7 +816,7 @@ var Lo;
|
|
|
816
816
|
console.error("vite-plugin-css-injected-by-js", t);
|
|
817
817
|
}
|
|
818
818
|
}();
|
|
819
|
-
const Wn = { Left: "left", Right: "right", Center: "center" }, It = "shift",
|
|
819
|
+
const Wn = { Left: "left", Right: "right", Center: "center" }, It = "shift", vn = "alt", zt = "ctrl", li = 9, si = 13, tl = 27, ci = 37, ai = 38, di = 39, ui = 40, nl = 113, Er = 3, mn = { Horizontal: "horizontal", Vertical: "vertical" };
|
|
820
820
|
function hi(e) {
|
|
821
821
|
var t, n, o = "";
|
|
822
822
|
if (typeof e == "string" || typeof e == "number") o += e;
|
|
@@ -830,33 +830,33 @@ function Rn() {
|
|
|
830
830
|
for (var e, t, n = 0, o = "", r = arguments.length; n < r; n++) (e = arguments[n]) && (t = hi(e)) && (o && (o += " "), o += t);
|
|
831
831
|
return o;
|
|
832
832
|
}
|
|
833
|
-
var
|
|
834
|
-
}, fi = typeof window < "u",
|
|
833
|
+
var ol = function() {
|
|
834
|
+
}, fi = typeof window < "u", rl = fi ? tn : st, Ir = { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 };
|
|
835
835
|
const In = fi && window.ResizeObserver !== void 0 ? function() {
|
|
836
|
-
var e = Ze(null), t = e[0], n = e[1], o = Ze(Ir), r = o[0], i = o[1], l =
|
|
836
|
+
var e = Ze(null), t = e[0], n = e[1], o = Ze(Ir), r = o[0], i = o[1], l = Ee(function() {
|
|
837
837
|
return new window.ResizeObserver(function(s) {
|
|
838
838
|
if (s[0]) {
|
|
839
|
-
var a = s[0].contentRect, d = a.x, g = a.y, m = a.width,
|
|
840
|
-
i({ x: d, y: g, width: m, height:
|
|
839
|
+
var a = s[0].contentRect, d = a.x, g = a.y, m = a.width, u = a.height, x = a.top, M = a.left, E = a.bottom, P = a.right;
|
|
840
|
+
i({ x: d, y: g, width: m, height: u, top: x, left: M, bottom: E, right: P });
|
|
841
841
|
}
|
|
842
842
|
});
|
|
843
843
|
}, []);
|
|
844
|
-
return
|
|
844
|
+
return rl(function() {
|
|
845
845
|
if (t) return l.observe(t), function() {
|
|
846
846
|
l.disconnect();
|
|
847
847
|
};
|
|
848
848
|
}, [t]), [n, r];
|
|
849
849
|
} : function() {
|
|
850
|
-
return [
|
|
851
|
-
},
|
|
850
|
+
return [ol, Ir];
|
|
851
|
+
}, R = (e, t) => {
|
|
852
852
|
const n = D((...i) => e?.(...i), t), o = G(null);
|
|
853
853
|
o.current = n;
|
|
854
854
|
const r = D((...i) => o.current?.(...i), []);
|
|
855
855
|
if (o.current) return r;
|
|
856
|
-
},
|
|
856
|
+
}, il = (e) => {
|
|
857
857
|
const { style: t, orientation: n = mn.Vertical, ...o } = e, r = n === mn.Vertical;
|
|
858
858
|
return q("div", { style: { paddingBottom: "0px", paddingRight: "0px", paddingLeft: r ? "0px" : "3px", paddingTop: r ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...t }, ...o, children: q("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${r ? "vertical" : "horizontal"} single-button start`, children: q("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: q("path", { d: r ? "m 3.7274761,0.68060577 1.11969,1.93863003 1.12075,1.93912 c 0.0895,0.155 0.12152,0.33658 0.0904,0.51283 -0.0311,0.17625 -0.12336,0.33591 -0.26054,0.45091 -0.13715,0.11495 -0.31044,0.17793 -0.4894,0.17781 H 0.83095614 c -0.20186,0 -0.39542,-0.0802 -0.53814,-0.2229 -0.14272,-0.14272 -0.22291,-0.33629 -0.22291,-0.53814 -3e-4,-0.13308 0.0347,-0.26385 0.10147,-0.379 l 1.11872996,-1.94066 1.11921,-1.93864003 c 0.13594,-0.23541 0.38717,-0.38047 0.65905,-0.38047 0.27188,0 0.52311,0.14506 0.65905,0.38047 z" : "m 0.75051,2.3424298 1.93863,-1.11969 1.93912,-1.12075 c 0.155,-0.0895 0.33658,-0.12152 0.51283,-0.0904 0.17625,0.0311 0.33591,0.12336 0.45091,0.26054 0.11495,0.13715 0.17793,0.31044 0.17781,0.4894 v 4.47742 c 0,0.20186 -0.0802,0.39542 -0.2229,0.53814 -0.14272,0.14272 -0.33629,0.22291 -0.53814,0.22291 -0.13308,3e-4 -0.26385,-0.0347 -0.379,-0.10147 L 2.68911,4.7797998 0.75047,3.6605898 C 0.51506,3.5246498 0.37,3.2734198 0.37,3.0015398 c 0,-0.27188 0.14506,-0.52311 0.38047,-0.65905 z" }) }) }) });
|
|
859
|
-
},
|
|
859
|
+
}, ll = (e) => {
|
|
860
860
|
const { style: t, orientation: n = mn.Vertical, ...o } = e, r = n === mn.Vertical;
|
|
861
861
|
return q("div", { style: { paddingLeft: "0px", paddingTop: "0px", paddingRight: r ? "0px" : "3px", paddingBottom: r ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...t }, ...o, children: q("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${r ? "vertical" : "horizontal"} single-button end`, children: q("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: q("path", { d: r ? "M 2.412334,5.319396 1.292644,3.3807659 0.17189405,1.4416459 c -0.0895,-0.155 -0.12152,-0.33658 -0.0904,-0.51282998 0.0311,-0.17625 0.12336,-0.33591 0.26054,-0.45091 0.13715,-0.11495 0.31044,-0.17793 0.4894,-0.17781 H 5.308854 c 0.20186,0 0.39542,0.0802 0.53814,0.2229 0.14272,0.14272 0.22291,0.33629 0.22291,0.53813998 3e-4,0.13308 -0.0347,0.26385 -0.10147,0.379 l -1.11873,1.94066 -1.11921,1.9386401 c -0.13594,0.23541 -0.38717,0.38047 -0.65905,0.38047 -0.27188,0 -0.52311,-0.14506 -0.65905,-0.38047 z" : "m 5.3893002,3.6575719 -1.9386301,1.11969 -1.93912,1.12075 c -0.155,0.0895 -0.33658,0.12152 -0.51282997,0.0904 -0.17625,-0.0311 -0.33591,-0.12336 -0.45091,-0.26054 -0.11495,-0.13715 -0.17793,-0.31044 -0.17781,-0.4894 V 0.76105195 c 0,-0.20186 0.0802,-0.39542 0.2229,-0.53814 C 0.73562013,0.08019195 0.92919013,1.9467784e-6 1.1310401,1.9467784e-6 1.2641201,-2.9805322e-4 1.3948901,0.03470195 1.5100401,0.10147195 l 1.94066,1.11872995 1.9386401,1.11921 c 0.23541,0.13594 0.38047,0.38717 0.38047,0.65905 0,0.27188 -0.14506,0.52311 -0.38047,0.65905 z" }) }) }) });
|
|
862
862
|
}, No = (e, t, n, o, r = 0) => {
|
|
@@ -871,223 +871,252 @@ const In = fi && window.ResizeObserver !== void 0 ? function() {
|
|
|
871
871
|
};
|
|
872
872
|
Object.freeze(Object.defineProperty({ __proto__: null, getScrollTo: No }, Symbol.toStringTag, { value: "Module" }));
|
|
873
873
|
const er = At(Ut((e, t) => {
|
|
874
|
-
const { offset: n = 0, totalSize: o = 0, viewportSize: r = 0, style: i, className: l, orientation: s = mn.Vertical, onScrollOffset: a, onScroll: d, showCustomScrollButtons: g = !1, scrollButtonIncrement: m = 200, scrollButtonInitialRepeatDelay:
|
|
874
|
+
const { offset: n = 0, totalSize: o = 0, viewportSize: r = 0, style: i, className: l, orientation: s = mn.Vertical, onScrollOffset: a, onScroll: d, showCustomScrollButtons: g = !1, scrollButtonIncrement: m = 200, scrollButtonInitialRepeatDelay: u = 260, scrollButtonAdditionalRepeatDelay: x = 120, createScrollStartButton: M = il, createScrollEndButton: E = ll, ...P } = e, Q = R(d, [d]), k = G(null), [I, { width: z, height: se }] = In(), [B, { width: re, height: be }] = In(), N = s === mn.Vertical, H = N ? "top" : "left", X = N ? "scrollTop" : "scrollLeft", T = N ? se : z, S = N ? be : re, [f, J] = Ze(null);
|
|
875
875
|
st(() => {
|
|
876
|
-
|
|
877
|
-
}, [
|
|
876
|
+
f !== null && k.current && k.current.scrollTo({ behavior: "smooth", [H]: f });
|
|
877
|
+
}, [f, N]);
|
|
878
878
|
const K = D((Ye, $ = !1) => {
|
|
879
|
-
if (!
|
|
880
|
-
const
|
|
879
|
+
if (!k.current) return 0;
|
|
880
|
+
const _ = k.current.querySelector(".scrollbar-viewport"), Me = _.getBoundingClientRect(), ue = _.children, me = $ ? 0 : No(Ye, Me[H], ue, !0, Math.max(0, Ye - m));
|
|
881
881
|
return J(me), Math.max(0, me);
|
|
882
882
|
}, []), L = D((Ye, $ = !1) => {
|
|
883
|
-
if (!
|
|
884
|
-
const
|
|
883
|
+
if (!k.current) return 0;
|
|
884
|
+
const _ = k.current.querySelector(".scrollbar-viewport"), Me = _.getBoundingClientRect(), ue = _.children, me = Math.ceil(S - T), $e = $ ? me : No(Ye, Me[H], ue, !1, Math.max(0, Ye + m));
|
|
885
885
|
return J($e), Math.min(me, $e);
|
|
886
|
-
}, [S, T]), U = G(null),
|
|
886
|
+
}, [S, T]), U = G(null), te = D((Ye) => {
|
|
887
887
|
U.current = n;
|
|
888
888
|
const $ = Ye.target[X];
|
|
889
|
-
a($, r, o),
|
|
889
|
+
a($, r, o), Q?.(Ye);
|
|
890
890
|
}, [a, r, o, n]);
|
|
891
891
|
st(() => {
|
|
892
892
|
const Ye = U.current;
|
|
893
|
-
U.current = null, n !== Ye && (
|
|
893
|
+
U.current = null, n !== Ye && (k.current[X] = n);
|
|
894
894
|
}, [n, X]);
|
|
895
|
-
const
|
|
896
|
-
|
|
897
|
-
}, []), Ve = D((Ye, $,
|
|
898
|
-
Y.current = Ye,
|
|
899
|
-
const ue =
|
|
900
|
-
ue !== Y.current ? Ve(ue, !1,
|
|
895
|
+
const ne = G(null), Y = G(null), He = D(() => {
|
|
896
|
+
ne.current && (clearTimeout(ne.current), ne.current = null, Y.current = null);
|
|
897
|
+
}, []), Ve = D((Ye, $, _, Me = u) => {
|
|
898
|
+
Y.current = Ye, ne.current = setTimeout(() => {
|
|
899
|
+
const ue = _ ? K(Y.current || Ye) : L(Y.current || Ye);
|
|
900
|
+
ue !== Y.current ? Ve(ue, !1, _, x) : He();
|
|
901
901
|
}, $ ? 0 : Me);
|
|
902
902
|
}, [K, L, He]);
|
|
903
903
|
st(() => () => He(), [He]);
|
|
904
|
-
const Ne = n, at =
|
|
904
|
+
const Ne = n, at = Ee(() => {
|
|
905
905
|
if (!g) return null;
|
|
906
906
|
const Ye = { orientation: s, disabled: Math.floor(Ne) <= 0 || Math.floor(S - T) === 0, onMouseUp: He, onMouseLeave: He, onMouseDown: () => Ve(Ne, !0, !0) };
|
|
907
|
-
return
|
|
908
|
-
}, [g, s, Ne,
|
|
907
|
+
return M?.(Ye);
|
|
908
|
+
}, [g, s, Ne, f, S, T]), Se = Ee(() => {
|
|
909
909
|
if (!g) return null;
|
|
910
910
|
const Ye = { orientation: s, disabled: Math.floor(S - T) <= Math.ceil(Ne), onMouseUp: He, onMouseLeave: He, onMouseDown: () => Ve(Ne, !0, !1) };
|
|
911
|
-
return
|
|
912
|
-
}, [g, s, Ne,
|
|
913
|
-
return Ht("div", { ref: t, style: { display: "flex", flex: "1", flexDirection: N ? "column" : "row", padding: "0", ...i }, className: Rn("_sheetxl-scrollbar_eblx4_6", l), ...
|
|
911
|
+
return E?.(Ye);
|
|
912
|
+
}, [g, s, Ne, f, S, T]);
|
|
913
|
+
return Ht("div", { ref: t, style: { display: "flex", flex: "1", flexDirection: N ? "column" : "row", padding: "0", ...i }, className: Rn("_sheetxl-scrollbar_eblx4_6", l), ...P, children: [at, q("div", { className: "pseudo-scrollbar", style: { flex: "1 1 100%", display: "flex", boxSizing: "content-box", flexDirection: N ? "column" : "row", justifyContent: "center", alignItems: "center" }, ref: I, children: q("div", { tabIndex: -1, style: { flex: "1 1 100%", overflowY: N ? "scroll" : "hidden", overflowX: N ? "hidden" : "scroll", position: "relative", willChange: "transform" }, onScroll: te, ref: k, children: q("div", { ref: B, style: { position: "absolute", height: N ? o - r + (se ?? 0) : 1, width: N ? 1 : o - r + (z ?? 0) }, className: "scrollbar-viewport" }) }) }), Se] });
|
|
914
914
|
}));
|
|
915
915
|
er.displayName = "Scrollbar";
|
|
916
|
-
let Cr = Date.now, gn = {},
|
|
916
|
+
let Cr = Date.now, gn = {}, sl = 1;
|
|
917
917
|
const jn = (e) => {
|
|
918
918
|
let t = gn[e] !== null;
|
|
919
919
|
return t && (gn[e] = null), t;
|
|
920
920
|
}, Mr = (e, t, n, o = 0, r) => {
|
|
921
|
-
let i = Cr(), l = i, s = 0, a = 0, d =
|
|
922
|
-
if (
|
|
923
|
-
const
|
|
924
|
-
for (let
|
|
925
|
-
gn =
|
|
926
|
-
}
|
|
927
|
-
const
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
921
|
+
let i = Cr(), l = i, s = 0, a = 0, d = 0, g = sl++;
|
|
922
|
+
if (g % 20 == 0) {
|
|
923
|
+
const u = {};
|
|
924
|
+
for (let x in gn) u[x] = !0;
|
|
925
|
+
gn = u;
|
|
926
|
+
}
|
|
927
|
+
const m = function(u) {
|
|
928
|
+
let x = u !== !0, M = Cr(), E = !0;
|
|
929
|
+
try {
|
|
930
|
+
E = (!t || t(g)) ?? !0;
|
|
931
|
+
} catch {
|
|
932
|
+
E = !1;
|
|
933
|
+
}
|
|
934
|
+
if (!gn[g] || !E) return gn[g] = null, void n?.(60 - a / ((M - i) / 1e3), g, !1);
|
|
935
|
+
if (x) {
|
|
936
|
+
d = Math.round((M - l) / 16.666666666666668) - 1;
|
|
937
|
+
for (let k = 0; k < Math.min(d, 4); k++) m(!0), a++;
|
|
938
|
+
}
|
|
939
|
+
o && (s = (M - i) / o, s > 1 && (s = 1));
|
|
940
|
+
let P = r ? r(s) : s, Q = !1;
|
|
941
|
+
try {
|
|
942
|
+
Q = e(P, M, x);
|
|
943
|
+
} catch {
|
|
944
|
+
Q = !1;
|
|
945
|
+
}
|
|
946
|
+
Q !== !1 && s !== 1 || !x ? x && (l = M, requestAnimationFrame(m)) : (gn[g] = null, n?.(60 - a / ((M - i) / 1e3), g, s === 1 || o == null));
|
|
937
947
|
};
|
|
938
|
-
return gn[
|
|
939
|
-
}
|
|
940
|
-
var al = function() {
|
|
941
|
-
}, dl = function(e) {
|
|
948
|
+
return gn[g] = !0, requestAnimationFrame(m), g;
|
|
949
|
+
}, cl = function(e) {
|
|
942
950
|
return Math.pow(e - 1, 3) + 1;
|
|
943
|
-
},
|
|
951
|
+
}, al = function(e) {
|
|
944
952
|
return (e /= 0.5) < 1 ? 0.5 * Math.pow(e, 3) : 0.5 * (Math.pow(e - 2, 3) + 2);
|
|
945
|
-
}, pi = function(e, t) {
|
|
946
|
-
for (var n in this.__callback = e, this.options = { scrollingX: !0, scrollingY: !0, animating: !0, animationDuration: 250, bouncing: !0, locking: !0, paging: !1, snapping: !1, zooming: !1, minZoom: 0.5, maxZoom: 3, speedMultiplier: 1, scrollingComplete: al, penetrationDeceleration: 0.03, penetrationAcceleration: 0.08 }, t) this.options[n] = t[n];
|
|
947
953
|
};
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
}
|
|
971
|
-
|
|
954
|
+
class dl {
|
|
955
|
+
constructor(t, n) {
|
|
956
|
+
this.__isSingleTouch = !1, this.__isTracking = !1, this.__didDecelerationComplete = !1, this.__isGesturing = !1, this.__isDragging = !1, this.__isDecelerating = 0, this.__isAnimating = 0, this.__interruptedAnimation = !1, this.__lastScale = 1, this.__enableScrollX = !0, this.__enableScrollY = !0, this.__clientLeft = 0, this.__clientTop = 0, this.__clientWidth = 0, this.__clientHeight = 0, this.__contentWidth = 0, this.__contentHeight = 0, this.__snapWidth = 100, this.__snapHeight = 100, this.__zoomLevel = 1, this.__scrollLeft = 0, this.__scrollTop = 0, this.__maxScrollLeft = 0, this.__maxScrollTop = 0, this.__scheduledLeft = 0, this.__scheduledTop = 0, this.__scheduledZoom = 0, this.__lastTouchLeft = 0, this.__lastTouchTop = 0, this.__lastTouchMove = 0, this.__positions = [], this.__initialTouchLeft = 0, this.__initialTouchTop = 0, this.__zoomLevelStart = 1, this.__minDecelerationScrollLeft = null, this.__minDecelerationScrollTop = null, this.__maxDecelerationScrollLeft = null, this.__maxDecelerationScrollTop = null, this.__decelerationVelocityX = null, this.__decelerationVelocityY = 0, this.__callback = t, this.options = { scrollingX: !0, scrollingY: !0, animating: !0, animationDuration: 250, bouncing: !0, locking: !0, paging: !1, snapping: !1, zooming: !1, minZoom: 0.5, maxZoom: 3, speedMultiplier: 1, scrollingComplete: void 0, penetrationDeceleration: 0.03, penetrationAcceleration: 0.08, ...n };
|
|
957
|
+
}
|
|
958
|
+
setDimensions(t, n, o, r) {
|
|
959
|
+
t !== null && (this.__clientWidth = t), n !== null && (this.__clientHeight = n), o !== null && (this.__contentWidth = o), r !== null && (this.__contentHeight = r), this.__computeScrollMax(), this.scrollTo(this.__scrollLeft, this.__scrollTop, !0);
|
|
960
|
+
}
|
|
961
|
+
setPosition(t, n) {
|
|
962
|
+
this.__clientLeft = t || 0, this.__clientTop = n || 0;
|
|
963
|
+
}
|
|
964
|
+
setSnapSize(t, n) {
|
|
965
|
+
this.__snapWidth = t, this.__snapHeight = n;
|
|
966
|
+
}
|
|
967
|
+
getValues() {
|
|
968
|
+
return { left: this.__scrollLeft, top: this.__scrollTop, right: this.__scrollLeft + this.__clientWidth / this.__zoomLevel, bottom: this.__scrollTop + this.__clientHeight / this.__zoomLevel, zoom: this.__zoomLevel };
|
|
969
|
+
}
|
|
970
|
+
getPoint(t, n) {
|
|
971
|
+
const o = this.getValues();
|
|
972
|
+
return { left: t / o.zoom, top: n / o.zoom };
|
|
973
|
+
}
|
|
974
|
+
getScrollMax() {
|
|
975
|
+
return { left: this.__maxScrollLeft, top: this.__maxScrollTop };
|
|
976
|
+
}
|
|
977
|
+
zoomTo(t, n = !1, o, r, i) {
|
|
972
978
|
if (!this.options.zooming) throw new Error("Zooming is not enabled!");
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
}
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
979
|
+
i && (this.__zoomComplete = i), this.__isDecelerating && (jn(this.__isDecelerating), this.__isDecelerating = 0);
|
|
980
|
+
const l = this.__zoomLevel;
|
|
981
|
+
o === void 0 && (o = this.__clientWidth / 2), r === void 0 && (r = this.__clientHeight / 2), t = Math.max(Math.min(t, this.options.maxZoom), this.options.minZoom), this.__computeScrollMax(t);
|
|
982
|
+
const s = t / l;
|
|
983
|
+
let a = s * (this.__scrollLeft + o) - o, d = s * (this.__scrollTop + r) - r;
|
|
984
|
+
a > this.__maxScrollLeft ? a = this.__maxScrollLeft : a < 0 && (a = 0), d > this.__maxScrollTop ? d = this.__maxScrollTop : d < 0 && (d = 0), this.__publish(a, d, t, n);
|
|
985
|
+
}
|
|
986
|
+
zoomBy(t, n = !1, o = 0, r = 0, i) {
|
|
987
|
+
this.zoomTo(this.__zoomLevel * t, n, o, r, i);
|
|
988
|
+
}
|
|
989
|
+
scrollTo(t, n, o = !1, r = 1) {
|
|
990
|
+
if (this.__isDecelerating && (jn(this.__isDecelerating), this.__isDecelerating = 0), r !== void 0 && r !== this.__zoomLevel) {
|
|
991
|
+
if (!this.options.zooming) throw new Error("Zooming is not enabled!");
|
|
992
|
+
t *= r, n *= r, this.__computeScrollMax(r);
|
|
993
|
+
} else r = this.__zoomLevel;
|
|
994
|
+
this.options.scrollingX ? this.options.paging ? t = Math.round(t / this.__clientWidth) * this.__clientWidth : this.options.snapping && (t = Math.round(t / this.__snapWidth) * this.__snapWidth) : t = this.__scrollLeft, this.options.scrollingY ? this.options.paging ? n = Math.round(n / this.__clientHeight) * this.__clientHeight : this.options.snapping && (n = Math.round(n / this.__snapHeight) * this.__snapHeight) : n = this.__scrollTop, t = Math.max(Math.min(this.__maxScrollLeft, t), 0), n = Math.max(Math.min(this.__maxScrollTop, n), 0), t === this.__scrollLeft && n === this.__scrollTop && (o = !1), this.__publish(t, n, r, o);
|
|
995
|
+
}
|
|
996
|
+
scrollBy(t = 0, n = 0, o = !1) {
|
|
997
|
+
const r = this.__isAnimating ? this.__scheduledLeft : this.__scrollLeft, i = this.__isAnimating ? this.__scheduledTop : this.__scrollTop;
|
|
998
|
+
this.scrollTo(r + (t || 0), i + (n || 0), o);
|
|
999
|
+
}
|
|
1000
|
+
doMouseZoom(t, n, o, r) {
|
|
1001
|
+
const i = t > 0 ? 0.97 : 1.03;
|
|
1002
|
+
return this.zoomTo(this.__zoomLevel * i, !1, o - this.__clientLeft, r - this.__clientTop);
|
|
1003
|
+
}
|
|
1004
|
+
doTouchStart(t, n) {
|
|
1005
|
+
if (t.length === void 0) throw new Error("Invalid touch list: " + t);
|
|
1006
|
+
if (n instanceof Date && (n = n.valueOf()), typeof n != "number") throw new Error("Invalid timestamp value: " + n);
|
|
1007
|
+
let o, r;
|
|
1008
|
+
this.__interruptedAnimation = !0, this.__isDecelerating && (jn(this.__isDecelerating), this.__isDecelerating = 0, this.__interruptedAnimation = !0), this.__isAnimating && (jn(this.__isAnimating), this.__isAnimating = 0, this.__interruptedAnimation = !0);
|
|
1009
|
+
let i = t.length === 1;
|
|
1010
|
+
i ? (o = t[0].pageX, r = t[0].pageY) : (o = Math.abs(t[0].pageX + t[1].pageX) / 2, r = Math.abs(t[0].pageY + t[1].pageY) / 2), this.__initialTouchLeft = o, this.__initialTouchTop = r, this.__zoomLevelStart = this.__zoomLevel, this.__lastTouchLeft = o, this.__lastTouchTop = r, this.__lastTouchMove = n, this.__lastScale = 1, this.__enableScrollX = !i && this.options.scrollingX, this.__enableScrollY = !i && this.options.scrollingY, this.__isTracking = !0, this.__didDecelerationComplete = !1, this.__isDragging = !i, this.__isSingleTouch = i, this.__positions = [];
|
|
1011
|
+
}
|
|
1012
|
+
doTouchMove(t, n, o = 1) {
|
|
1013
|
+
if (t.length === void 0) throw new Error("Invalid touch list: " + t);
|
|
1014
|
+
if (n instanceof Date && (n = n.valueOf()), typeof n != "number") throw new Error("Invalid timestamp value: " + n);
|
|
1015
|
+
if (!this.__isTracking) return;
|
|
1016
|
+
let r, i;
|
|
1017
|
+
t.length === 2 ? (r = Math.abs(t[0].pageX + t[1].pageX) / 2, i = Math.abs(t[0].pageY + t[1].pageY) / 2) : (r = t[0].pageX, i = t[0].pageY);
|
|
1018
|
+
let l = this.__positions;
|
|
996
1019
|
if (this.__isDragging) {
|
|
997
|
-
|
|
998
|
-
if (
|
|
999
|
-
|
|
1000
|
-
if (
|
|
1001
|
-
|
|
1002
|
-
|
|
1020
|
+
let s = r - this.__lastTouchLeft, a = i - this.__lastTouchTop, d = this.__scrollLeft, g = this.__scrollTop, m = this.__zoomLevel;
|
|
1021
|
+
if (o !== void 0 && this.options.zooming) {
|
|
1022
|
+
let u = m;
|
|
1023
|
+
if (m = m / this.__lastScale * o, m = Math.max(Math.min(m, this.options.maxZoom), this.options.minZoom), u !== m) {
|
|
1024
|
+
let x = r - this.__clientLeft, M = i - this.__clientTop;
|
|
1025
|
+
d = (x + d) * m / u - x, g = (M + g) * m / u - M, this.__computeScrollMax(m);
|
|
1003
1026
|
}
|
|
1004
1027
|
}
|
|
1005
1028
|
if (this.__enableScrollX) {
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
(
|
|
1029
|
+
d -= s * this.options.speedMultiplier;
|
|
1030
|
+
let u = this.__maxScrollLeft;
|
|
1031
|
+
(d > u || d < 0) && (this.options.bouncing ? d += s / 2 * this.options.speedMultiplier : d = d > u ? u : 0);
|
|
1009
1032
|
}
|
|
1010
1033
|
if (this.__enableScrollY) {
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
(
|
|
1034
|
+
g -= a * this.options.speedMultiplier;
|
|
1035
|
+
const u = this.__maxScrollTop;
|
|
1036
|
+
(g > u || g < 0) && (this.options.bouncing ? g += a / 2 * this.options.speedMultiplier : g = g > u ? u : 0);
|
|
1014
1037
|
}
|
|
1015
|
-
|
|
1038
|
+
l.length > 60 && l.splice(0, 30), l.push(d, g, n), this.__publish(d, g, m);
|
|
1016
1039
|
} else {
|
|
1017
|
-
|
|
1018
|
-
this.__enableScrollX = this.options.scrollingX &&
|
|
1019
|
-
}
|
|
1020
|
-
this.__lastTouchLeft =
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1040
|
+
let s = this.options.locking ? 3 : 0, a = 5, d = Math.abs(r - this.__initialTouchLeft), g = Math.abs(i - this.__initialTouchTop);
|
|
1041
|
+
this.__enableScrollX = this.options.scrollingX && d >= s, this.__enableScrollY = this.options.scrollingY && g >= s, l.push(this.__scrollLeft, this.__scrollTop, n), this.__isDragging = (this.__enableScrollX || this.__enableScrollY) && (d >= a || g >= a), this.__isDragging && (this.__interruptedAnimation = !1);
|
|
1042
|
+
}
|
|
1043
|
+
this.__lastTouchLeft = r, this.__lastTouchTop = i, this.__lastTouchMove = n, this.__lastScale = o;
|
|
1044
|
+
}
|
|
1045
|
+
doTouchEnd(t) {
|
|
1046
|
+
if (t instanceof Date && (t = t.valueOf()), typeof t != "number") throw new Error("Invalid timestamp value: " + t);
|
|
1047
|
+
if (this.__isTracking) {
|
|
1048
|
+
if (this.__isTracking = !1, this.__isDragging) if (this.__isDragging = !1, this.__isSingleTouch && this.options.animating && t - this.__lastTouchMove <= 100) {
|
|
1049
|
+
let n = this.__positions, o = n.length - 1, r = o;
|
|
1050
|
+
for (let i = o; i > 0 && n[i] > this.__lastTouchMove - 100; i -= 3) r = i;
|
|
1051
|
+
if (r !== o) {
|
|
1052
|
+
const i = n[o] - n[r], l = this.__scrollLeft - n[r - 2], s = this.__scrollTop - n[r - 1];
|
|
1053
|
+
this.__decelerationVelocityX = l / i * (1e3 / 60), this.__decelerationVelocityY = s / i * (1e3 / 60);
|
|
1054
|
+
const a = this.options.paging || this.options.snapping ? 4 : 1;
|
|
1055
|
+
(Math.abs(this.__decelerationVelocityX) > a || Math.abs(this.__decelerationVelocityY) > a) && this.__startDeceleration(t);
|
|
1056
|
+
} else this.options.scrollingComplete?.();
|
|
1057
|
+
} else t - this.__lastTouchMove > 100 && this.options.scrollingComplete?.();
|
|
1058
|
+
this.__isDecelerating || ((this.__interruptedAnimation || this.__isDragging) && this.options.scrollingComplete?.(), this.scrollTo(this.__scrollLeft, this.__scrollTop, !0, this.__zoomLevel)), this.__positions.length = 0;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
__publish(t, n, o, r = !1) {
|
|
1062
|
+
const i = this.__isAnimating;
|
|
1063
|
+
if (i && (jn(i), this.__isAnimating = 0), r && this.options.animating) {
|
|
1064
|
+
this.__scheduledLeft = t, this.__scheduledTop = n, this.__scheduledZoom = o;
|
|
1065
|
+
const l = this.__scrollLeft, s = this.__scrollTop, a = this.__zoomLevel, d = t - l, g = n - s, m = o - a, u = function(E, P, Q) {
|
|
1066
|
+
Q && (this.__scrollLeft = l + d * E, this.__scrollTop = s + g * E, this.__zoomLevel = a + m * E, this.__callback && this.__callback(this.__scrollLeft, this.__scrollTop, this.__zoomLevel));
|
|
1067
|
+
}.bind(this), x = function(E) {
|
|
1068
|
+
return this.__isAnimating === E;
|
|
1069
|
+
}.bind(this), M = function(E, P, Q) {
|
|
1070
|
+
P === this.__isAnimating && (this.__isAnimating = !1), (this.__didDecelerationComplete || Q) && this.options.scrollingComplete?.(), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
|
|
1071
|
+
}.bind(this);
|
|
1072
|
+
this.__isAnimating = Mr(u, x, M, this.options.animationDuration, i ? cl : al);
|
|
1073
|
+
} else this.__scheduledLeft = this.__scrollLeft = t, this.__scheduledTop = this.__scrollTop = n, this.__scheduledZoom = this.__zoomLevel = o, this.__callback && this.__callback(t, n, o), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
|
|
1074
|
+
}
|
|
1075
|
+
__computeScrollMax(t = this.__zoomLevel) {
|
|
1076
|
+
this.__maxScrollLeft = Math.max(this.__contentWidth * t - this.__clientWidth, 0), this.__maxScrollTop = Math.max(this.__contentHeight * t - this.__clientHeight, 0);
|
|
1077
|
+
}
|
|
1078
|
+
__startDeceleration(t) {
|
|
1079
|
+
if (this.options.paging) {
|
|
1080
|
+
const l = Math.max(Math.min(this.__scrollLeft, this.__maxScrollLeft), 0), s = Math.max(Math.min(this.__scrollTop, this.__maxScrollTop), 0), a = this.__clientWidth, d = this.__clientHeight;
|
|
1081
|
+
this.__minDecelerationScrollLeft = Math.floor(l / a) * a, this.__minDecelerationScrollTop = Math.floor(s / d) * d, this.__maxDecelerationScrollLeft = Math.ceil(l / a) * a, this.__maxDecelerationScrollTop = Math.ceil(s / d) * d;
|
|
1082
|
+
} else this.__minDecelerationScrollLeft = 0, this.__minDecelerationScrollTop = 0, this.__maxDecelerationScrollLeft = this.__maxScrollLeft, this.__maxDecelerationScrollTop = this.__maxScrollTop;
|
|
1083
|
+
const n = function(l, s, a) {
|
|
1084
|
+
this.__stepThroughDeceleration(a);
|
|
1085
|
+
}.bind(this), o = this.options.snapping ? 4 : 0.1, r = function() {
|
|
1086
|
+
const l = Math.abs(this.__decelerationVelocityX) >= o || Math.abs(this.__decelerationVelocityY) >= o;
|
|
1087
|
+
return l || (this.__didDecelerationComplete = !0), l;
|
|
1088
|
+
}.bind(this), i = function(l, s, a) {
|
|
1089
|
+
this.__isDecelerating = 0, this.__didDecelerationComplete && this.options.scrollingComplete?.(), this.scrollTo(this.__scrollLeft, this.__scrollTop, this.options.snapping);
|
|
1046
1090
|
}.bind(this);
|
|
1047
|
-
this.
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
this.
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
}.bind(this);
|
|
1064
|
-
this.__isDecelerating = Mr(i, s, a);
|
|
1065
|
-
}, __stepThroughDeceleration: function(e) {
|
|
1066
|
-
var t = this.__scrollLeft + this.__decelerationVelocityX, n = this.__scrollTop + this.__decelerationVelocityY;
|
|
1067
|
-
if (!this.options.bouncing) {
|
|
1068
|
-
var o = Math.max(Math.min(this.__maxDecelerationScrollLeft, t), this.__minDecelerationScrollLeft);
|
|
1069
|
-
o !== t && (t = o, this.__decelerationVelocityX = 0);
|
|
1070
|
-
var r = Math.max(Math.min(this.__maxDecelerationScrollTop, n), this.__minDecelerationScrollTop);
|
|
1071
|
-
r !== n && (n = r, this.__decelerationVelocityY = 0);
|
|
1072
|
-
}
|
|
1073
|
-
if (e ? this.__publish(t, n, this.__zoomLevel) : (this.__scrollLeft = t, this.__scrollTop = n), !this.options.paging && (this.__decelerationVelocityX *= 0.95, this.__decelerationVelocityY *= 0.95), this.options.bouncing) {
|
|
1074
|
-
var i = 0, l = 0, s = this.options.penetrationDeceleration, a = this.options.penetrationAcceleration;
|
|
1075
|
-
t < this.__minDecelerationScrollLeft ? i = this.__minDecelerationScrollLeft - t : t > this.__maxDecelerationScrollLeft && (i = this.__maxDecelerationScrollLeft - t), n < this.__minDecelerationScrollTop ? l = this.__minDecelerationScrollTop - n : n > this.__maxDecelerationScrollTop && (l = this.__maxDecelerationScrollTop - n), i !== 0 && (i * this.__decelerationVelocityX <= 0 ? this.__decelerationVelocityX += i * s : this.__decelerationVelocityX = i * a), l !== 0 && (l * this.__decelerationVelocityY <= 0 ? this.__decelerationVelocityY += l * s : this.__decelerationVelocityY = l * a);
|
|
1076
|
-
}
|
|
1077
|
-
} };
|
|
1091
|
+
this.__isDecelerating = Mr(n, r, i);
|
|
1092
|
+
}
|
|
1093
|
+
__stepThroughDeceleration(t) {
|
|
1094
|
+
let n = this.__scrollLeft + this.__decelerationVelocityX, o = this.__scrollTop + this.__decelerationVelocityY;
|
|
1095
|
+
if (!this.options.bouncing) {
|
|
1096
|
+
const r = Math.max(Math.min(this.__maxDecelerationScrollLeft, n), this.__minDecelerationScrollLeft);
|
|
1097
|
+
r !== n && (n = r, this.__decelerationVelocityX = 0);
|
|
1098
|
+
const i = Math.max(Math.min(this.__maxDecelerationScrollTop, o), this.__minDecelerationScrollTop);
|
|
1099
|
+
i !== o && (o = i, this.__decelerationVelocityY = 0);
|
|
1100
|
+
}
|
|
1101
|
+
if (t ? this.__publish(n, o, this.__zoomLevel) : (this.__scrollLeft = n, this.__scrollTop = o), !this.options.paging && (this.__decelerationVelocityX *= 0.95, this.__decelerationVelocityY *= 0.95), this.options.bouncing) {
|
|
1102
|
+
let r = 0, i = 0, l = this.options.penetrationDeceleration, s = this.options.penetrationAcceleration;
|
|
1103
|
+
n < this.__minDecelerationScrollLeft ? r = this.__minDecelerationScrollLeft - n : n > this.__maxDecelerationScrollLeft && (r = this.__maxDecelerationScrollLeft - n), o < this.__minDecelerationScrollTop ? i = this.__minDecelerationScrollTop - o : o > this.__maxDecelerationScrollTop && (i = this.__maxDecelerationScrollTop - o), r !== 0 && (r * this.__decelerationVelocityX <= 0 ? this.__decelerationVelocityX += r * l : this.__decelerationVelocityX = r * s), i !== 0 && (i * this.__decelerationVelocityY <= 0 ? this.__decelerationVelocityY += i * l : this.__decelerationVelocityY = i * s);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1078
1107
|
var Gt = typeof window < "u" ? window : { screen: {}, navigator: {} }, Ln = (Gt.matchMedia || function() {
|
|
1079
1108
|
return { matches: !1 };
|
|
1080
|
-
}).bind(Gt),
|
|
1081
|
-
return
|
|
1109
|
+
}).bind(Gt), pi = !1, ul = { get passive() {
|
|
1110
|
+
return pi = !0;
|
|
1082
1111
|
} }, Tr = function() {
|
|
1083
1112
|
};
|
|
1084
|
-
Gt.addEventListener && Gt.addEventListener("p", Tr,
|
|
1085
|
-
var
|
|
1086
|
-
const
|
|
1113
|
+
Gt.addEventListener && Gt.addEventListener("p", Tr, ul), Gt.removeEventListener && Gt.removeEventListener("p", Tr, !1);
|
|
1114
|
+
var hl = pi, fl = "PointerEvent" in Gt, tr = "ontouchstart" in Gt, gi = tr || "TouchEvent" in Gt && Ln("(any-pointer: coarse)").matches, Rr = (Gt.navigator.maxTouchPoints || 0) > 0 || gi, wi = Gt.navigator.userAgent || "", pl = Ln("(pointer: coarse)").matches && /iPad|Macintosh/.test(wi) && Math.min(Gt.screen.width || 0, Gt.screen.height || 0) >= 768, mi = (Ln("(pointer: coarse)").matches || !Ln("(pointer: fine)").matches && tr) && !/Windows.*Firefox/.test(wi), gl = Ln("(any-pointer: fine)").matches || Ln("(any-hover: hover)").matches || pl || !tr, Uo = !Rr || !gl && mi ? Rr ? "touchOnly" : "mouseOnly" : "hybrid", wl = Uo === "mouseOnly" ? "mouse" : Uo === "touchOnly" || mi ? "touch" : "mouse";
|
|
1115
|
+
const ml = Object.freeze(Object.defineProperty({ __proto__: null, deviceType: Uo, primaryInput: wl, supportsPassiveEvents: hl, supportsPointerEvents: fl, supportsTouchEvents: gi }, Symbol.toStringTag, { value: "Module" })), xl = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]), xi = {};
|
|
1087
1116
|
function Ko() {
|
|
1088
|
-
return
|
|
1117
|
+
return ml;
|
|
1089
1118
|
}
|
|
1090
|
-
const we = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProperties:
|
|
1119
|
+
const we = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProperties: xi, boundPixel: function(e, t = !1, n = 0) {
|
|
1091
1120
|
return e;
|
|
1092
1121
|
}, createSyntheticEvent: (e) => {
|
|
1093
1122
|
let t = !1, n = !1;
|
|
@@ -1097,7 +1126,7 @@ const we = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProper
|
|
|
1097
1126
|
n = !0, e.stopPropagation();
|
|
1098
1127
|
}, isPropagationStopped: () => n, persist: () => {
|
|
1099
1128
|
}, timeStamp: e.timeStamp, type: e.type };
|
|
1100
|
-
}, detectIt: Ko, focusableNodeNames:
|
|
1129
|
+
}, detectIt: Ko, focusableNodeNames: xl, toPrettyKeyCode: (e) => e === "BracketLeft" ? "[" : e === "BracketRight" ? "]" : Ct.camelToPrettyCase(e) }, Symbol.toStringTag, { value: "Module" })), yl = [];
|
|
1101
1130
|
function wo(e, t, n = yl) {
|
|
1102
1131
|
const o = G(null);
|
|
1103
1132
|
return Ur(e, () => {
|
|
@@ -1112,53 +1141,53 @@ function wo(e, t, n = yl) {
|
|
|
1112
1141
|
return r;
|
|
1113
1142
|
}, n), o;
|
|
1114
1143
|
}
|
|
1115
|
-
const kr = (e) => q(er, { ...e }),
|
|
1116
|
-
const { children: n, viewport: o, onScrollViewport: r, showHorizontalScrollbar: i = !0, showVerticalScrollbar: l = !0, createScrollCorner: s =
|
|
1144
|
+
const kr = (e) => q(er, { ...e }), vl = ({ width: e, height: t }) => q("div", { className: "corner", style: { minWidth: `${e}px`, width: `${e}px`, minHeight: `${t}px`, height: `${t}px` } }), yi = At(Ut((e, t) => {
|
|
1145
|
+
const { children: n, viewport: o, onScrollViewport: r, showHorizontalScrollbar: i = !0, showVerticalScrollbar: l = !0, createScrollCorner: s = vl, createHorizontalScrollbar: a = kr, createVerticalScrollbar: d = kr, style: g, touchElement: m, disableTouch: u, ...x } = e, M = R(r, [r]), E = wo(t, () => ({ isScrollPane: () => !0 }), []), P = G(null);
|
|
1117
1146
|
st(() => {
|
|
1118
|
-
|
|
1147
|
+
P.current && (P.current.__scrollTop === o?.top && P.current.__scrollLeft === o?.left || P.current.__isDecelerating || P.current?.scrollTo(o?.left, o?.top, !1));
|
|
1119
1148
|
}, [o?.left, o?.top, m]);
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1122
|
-
}, []),
|
|
1123
|
-
|
|
1149
|
+
const Q = D((T, S) => {
|
|
1150
|
+
M?.({ left: T, top: S });
|
|
1151
|
+
}, []), k = D((T) => {
|
|
1152
|
+
P.current?.doTouchStart(T.touches, T.timeStamp);
|
|
1124
1153
|
}, []), I = D((T) => {
|
|
1125
|
-
T.preventDefault(),
|
|
1154
|
+
T.preventDefault(), P.current?.doTouchMove(T.touches, T.timeStamp);
|
|
1126
1155
|
}, []), z = D((T) => {
|
|
1127
|
-
|
|
1128
|
-
}, []),
|
|
1129
|
-
|
|
1156
|
+
P.current?.doTouchEnd(T.timeStamp);
|
|
1157
|
+
}, []), se = D(({ containerWidth: T, containerHeight: S, totalWidth: f, totalHeight: J }) => {
|
|
1158
|
+
P.current.setDimensions(T, S, f, J);
|
|
1130
1159
|
}, []);
|
|
1131
1160
|
st(() => {
|
|
1132
|
-
const T = m ??
|
|
1133
|
-
if (!
|
|
1134
|
-
if (!
|
|
1161
|
+
const T = m ?? E.current;
|
|
1162
|
+
if (!u && Ko().supportsTouchEvents && T && o) {
|
|
1163
|
+
if (!P.current) {
|
|
1135
1164
|
const S = { scrollingX: !0, scrollingY: !0, decelerationRate: 0.95, penetrationAcceleration: 0.08 };
|
|
1136
|
-
|
|
1165
|
+
P.current = new dl(Q, S);
|
|
1137
1166
|
}
|
|
1138
|
-
Ko().supportsTouchEvents && (T.addEventListener("touchstart",
|
|
1167
|
+
Ko().supportsTouchEvents && (T.addEventListener("touchstart", k), T.addEventListener("touchend", z), T.addEventListener("touchmove", I)), se({ containerWidth: o?.width, containerHeight: o?.height, totalWidth: o?.totalWidth, totalHeight: o?.totalHeight });
|
|
1139
1168
|
}
|
|
1140
1169
|
return () => {
|
|
1141
|
-
T?.removeEventListener("touchstart",
|
|
1170
|
+
T?.removeEventListener("touchstart", k), T?.removeEventListener("touchend", z), T?.removeEventListener("touchmove", I);
|
|
1142
1171
|
};
|
|
1143
|
-
}, [o?.width, o?.height, o?.totalWidth, o?.totalHeight,
|
|
1144
|
-
const [B, { width:
|
|
1172
|
+
}, [o?.width, o?.height, o?.totalWidth, o?.totalHeight, u, m]);
|
|
1173
|
+
const [B, { width: re }] = In(), [be, { height: N }] = In(), H = Ee(() => {
|
|
1145
1174
|
const T = d({ orientation: mn.Vertical, offset: o?.top, viewportSize: o?.height, totalSize: o?.totalHeight, onScrollOffset: (S) => {
|
|
1146
|
-
|
|
1175
|
+
M?.({ top: S });
|
|
1147
1176
|
} });
|
|
1148
1177
|
return q("div", { style: { display: "flex", flex: "0" }, ref: B, children: T });
|
|
1149
|
-
}, [d, o?.top, o?.height, o?.totalHeight]), X =
|
|
1150
|
-
const T = a({ orientation: mn.Horizontal, offset: o?.left, viewportSize: o?.width, totalSize: o?.totalWidth, onScrollOffset: (S) =>
|
|
1151
|
-
return Ht("div", { style: { display: "flex", flex: "none", flexDirection: "row", alignItems: "stretch", justifyContent: "center" }, children: [q("div", { style: { display: "flex", flex: "1 1 100%", flexDirection: "column", width: `calc(100% - ${
|
|
1152
|
-
}, [a, o?.left, o?.width, o?.totalWidth, l, s,
|
|
1153
|
-
return q("div", { style: { position: "relative", display: "flex", minWidth: l ? `${
|
|
1178
|
+
}, [d, o?.top, o?.height, o?.totalHeight]), X = Ee(() => {
|
|
1179
|
+
const T = a({ orientation: mn.Horizontal, offset: o?.left, viewportSize: o?.width, totalSize: o?.totalWidth, onScrollOffset: (S) => M?.({ left: S }) });
|
|
1180
|
+
return Ht("div", { style: { display: "flex", flex: "none", flexDirection: "row", alignItems: "stretch", justifyContent: "center" }, children: [q("div", { style: { display: "flex", flex: "1 1 100%", flexDirection: "column", width: `calc(100% - ${re}px)` }, children: q("div", { ref: be, className: "sizer", children: T }) }), l ? s({ width: re, height: N }) : q(wn, {})] });
|
|
1181
|
+
}, [a, o?.left, o?.width, o?.totalWidth, l, s, re, N]);
|
|
1182
|
+
return q("div", { style: { position: "relative", display: "flex", minWidth: l ? `${re}px` : void 0, minHeight: i ? `${N}px` : void 0, ...g }, ...x, ref: E, children: Ht("div", { style: { position: "relative", width: "100%", flex: "1 1 100%", display: "flex", flexDirection: "column", boxSizing: "border-box" }, children: [Ht("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: [q("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: n }), l ? H : q(wn, {})] }), i ? X : q(wn, {})] }) });
|
|
1154
1183
|
}));
|
|
1155
1184
|
yi.displayName = "ScrollPane";
|
|
1156
|
-
const
|
|
1185
|
+
const bl = () => {
|
|
1157
1186
|
const e = document.fullscreenElement;
|
|
1158
1187
|
return e ? e.querySelector(".fullscreen-portal-root") || e : document.body;
|
|
1159
1188
|
};
|
|
1160
1189
|
let no = 0;
|
|
1161
|
-
function
|
|
1190
|
+
function vi() {
|
|
1162
1191
|
return st(() => {
|
|
1163
1192
|
function e() {
|
|
1164
1193
|
const t = document.fullscreenElement;
|
|
@@ -1171,35 +1200,35 @@ function bi() {
|
|
|
1171
1200
|
t.parentNode && t.parentNode.removeChild(t);
|
|
1172
1201
|
}), no = 0);
|
|
1173
1202
|
};
|
|
1174
|
-
}, []), { getPortalContainer:
|
|
1203
|
+
}, []), { getPortalContainer: bl };
|
|
1175
1204
|
}
|
|
1176
|
-
const
|
|
1177
|
-
const { offset: n = 0, viewportSize: o = 0, totalSize: r = 0, minSize: i = 0, endGap: l =
|
|
1205
|
+
const Sl = 100, _l = 100, El = 1e6, Il = 100, Cl = 50, Ml = At(Ut((e, t) => {
|
|
1206
|
+
const { offset: n = 0, viewportSize: o = 0, totalSize: r = 0, minSize: i = 0, endGap: l = Sl, endScrollIncrement: s = _l, style: a = xi, onMouseDown: d, onScrollOffset: g, onScroll: m, scaleLimit: u = El, scaleFactor: x = Il, precisionFactor: M = Cl, ...E } = e;
|
|
1178
1207
|
m && console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead");
|
|
1179
|
-
const
|
|
1208
|
+
const P = R(d, [d]), Q = () => ({ offset: n, totalSize: u === 0 ? r : Math.min(r ?? 0, Math.max(i ?? 0, (n ?? 0) + (o ?? 0)) + (l ?? 0)) }), [k, I] = Ze(Q), z = u !== 0 && k.totalSize > u ? x : 1, se = z / M, B = Math.ceil(k.totalSize / z), re = Math.ceil(k.offset / z), be = Math.ceil(o / z), N = D((K) => {
|
|
1180
1209
|
}, []), [H, X] = Ze(!1), T = G(null);
|
|
1181
1210
|
tn(() => {
|
|
1182
1211
|
if (!H) {
|
|
1183
1212
|
T.current = { propTotalSize: r, propViewportSize: o, propOffset: n };
|
|
1184
|
-
const K =
|
|
1213
|
+
const K = Q();
|
|
1185
1214
|
I(K);
|
|
1186
1215
|
}
|
|
1187
1216
|
}, [r, o, n, H, i, l, s]);
|
|
1188
|
-
const S =
|
|
1189
|
-
const
|
|
1190
|
-
T.current = null,
|
|
1191
|
-
}, [g, z,
|
|
1192
|
-
document.removeEventListener("mousemove", N), document.removeEventListener("mouseup",
|
|
1217
|
+
const S = R((K, L, U) => {
|
|
1218
|
+
const te = T.current;
|
|
1219
|
+
T.current = null, te && te.propTotalSize === r && te.propViewportSize === o && te.propOffset === n || (Math.abs(K - re) < se && (K = re), g?.(K * z, re, be));
|
|
1220
|
+
}, [g, z, se, re, be]), f = D((K) => {
|
|
1221
|
+
document.removeEventListener("mousemove", N), document.removeEventListener("mouseup", f), X(!1);
|
|
1193
1222
|
}, []), J = D((K) => {
|
|
1194
|
-
|
|
1195
|
-
}, [N,
|
|
1196
|
-
return q(er, { ref: t, style: { ...a }, ...
|
|
1223
|
+
P?.(K), X(!0), document.addEventListener("mousemove", N, { passive: !0 }), document.addEventListener("mouseup", f, { passive: !0 });
|
|
1224
|
+
}, [N, f]);
|
|
1225
|
+
return q(er, { ref: t, style: { ...a }, ...E, offset: re, totalSize: B, viewportSize: be, onMouseDown: J, onScrollOffset: S });
|
|
1197
1226
|
}));
|
|
1198
1227
|
function Do(e, t) {
|
|
1199
1228
|
if (typeof e == "function") return e(t);
|
|
1200
1229
|
e && (e.current = t);
|
|
1201
1230
|
}
|
|
1202
|
-
|
|
1231
|
+
Ml.displayName = "VirtualScrollbar";
|
|
1203
1232
|
var fo = parseInt(Kr.split(".")[0], 10) >= 19 ? function(e) {
|
|
1204
1233
|
return (t) => {
|
|
1205
1234
|
const n = [];
|
|
@@ -1233,38 +1262,38 @@ At(Ut((e, t) => {
|
|
|
1233
1262
|
}, [n]);
|
|
1234
1263
|
return q("div", { tabIndex: 0, ref: fo([r, t]), onFocus: i, ...o });
|
|
1235
1264
|
})), At(Ut((e, t) => {
|
|
1236
|
-
const { className: n, style: o, children: r, radius: i = 4, strokeWidth: l = 1, strokeColor: s = "grey", ...a } = e, [d, { width: g, height: m }] = In(),
|
|
1237
|
-
const I =
|
|
1238
|
-
return function(
|
|
1239
|
-
if (B === 0) return
|
|
1240
|
-
function be(
|
|
1241
|
-
let L = J.x -
|
|
1242
|
-
return N(
|
|
1265
|
+
const { className: n, style: o, children: r, radius: i = 4, strokeWidth: l = 1, strokeColor: s = "grey", ...a } = e, [d, { width: g, height: m }] = In(), u = G(null), x = (Q, k = 0) => {
|
|
1266
|
+
const I = Q / 2, z = m - I + k;
|
|
1267
|
+
return function(se, B, re = !1) {
|
|
1268
|
+
if (B === 0) return se;
|
|
1269
|
+
function be(f, J, K) {
|
|
1270
|
+
let L = J.x - f.x, U = J.y - f.y, te = Math.sqrt(L * L + U * U);
|
|
1271
|
+
return N(f, J, Math.min(1, K / te));
|
|
1243
1272
|
}
|
|
1244
|
-
function N(
|
|
1245
|
-
return { x:
|
|
1273
|
+
function N(f, J, K) {
|
|
1274
|
+
return { x: f.x + (J.x - f.x) * K, y: f.y + (J.y - f.y) * K };
|
|
1246
1275
|
}
|
|
1247
|
-
function H(
|
|
1248
|
-
|
|
1276
|
+
function H(f, J) {
|
|
1277
|
+
f.length > 2 && (f[f.length - 2] = J.x, f[f.length - 1] = J.y);
|
|
1249
1278
|
}
|
|
1250
|
-
function X(
|
|
1251
|
-
return { x: parseFloat(
|
|
1279
|
+
function X(f) {
|
|
1280
|
+
return { x: parseFloat(f[f.length - 2]), y: parseFloat(f[f.length - 1]) };
|
|
1252
1281
|
}
|
|
1253
|
-
let T =
|
|
1282
|
+
let T = se.split(/[,\s]/).reduce(function(f, J) {
|
|
1254
1283
|
let K = J.match("([a-zA-Z])(.+)");
|
|
1255
|
-
return K ? (
|
|
1256
|
-
}, []).reduce(function(
|
|
1257
|
-
return parseFloat(J) == J &&
|
|
1284
|
+
return K ? (f.push(K[1]), f.push(K[2])) : f.push(J), f;
|
|
1285
|
+
}, []).reduce(function(f, J) {
|
|
1286
|
+
return parseFloat(J) == J && f.length ? f[f.length - 1].push(J) : f.push([J]), f;
|
|
1258
1287
|
}, []), S = [];
|
|
1259
1288
|
if (T.length > 1) {
|
|
1260
|
-
let
|
|
1261
|
-
T[T.length - 1][0] === "Z" && T[0].length > 2 && (J = ["L",
|
|
1289
|
+
let f = X(T[0]), J = null;
|
|
1290
|
+
T[T.length - 1][0] === "Z" && T[0].length > 2 && (J = ["L", f.x, f.y], T[T.length - 1] = J), S.push(T[0]);
|
|
1262
1291
|
for (let K = 1; K < T.length; K++) {
|
|
1263
|
-
let L = S[S.length - 1], U = T[K],
|
|
1264
|
-
if (
|
|
1265
|
-
let
|
|
1266
|
-
|
|
1267
|
-
let at = N(
|
|
1292
|
+
let L = S[S.length - 1], U = T[K], te = U === J ? T[1] : T[K + 1];
|
|
1293
|
+
if (te && L && L.length > 2 && U[0] === "L" && te.length > 2 && te[0] === "L") {
|
|
1294
|
+
let ne, Y, He = X(L), Ve = X(U), Ne = X(te);
|
|
1295
|
+
re ? (ne = N(Ve, L.origPoint || He, B), Y = N(Ve, te.origPoint || Ne, B)) : (ne = be(Ve, He, B), Y = be(Ve, Ne, B)), H(U, ne), U.origPoint = Ve, S.push(U);
|
|
1296
|
+
let at = N(ne, Ve, 0.5), Se = N(Ve, Y, 0.5), Ye = ["C", at.x, at.y, Se.x, Se.y, Y.x, Y.y];
|
|
1268
1297
|
Ye.origPoint = Ve, S.push(Ye);
|
|
1269
1298
|
} else S.push(U);
|
|
1270
1299
|
}
|
|
@@ -1273,20 +1302,20 @@ At(Ut((e, t) => {
|
|
|
1273
1302
|
S.push(["Z"]), H(S[0], K);
|
|
1274
1303
|
}
|
|
1275
1304
|
} else S = T;
|
|
1276
|
-
return S.reduce(function(
|
|
1277
|
-
return
|
|
1305
|
+
return S.reduce(function(f, J) {
|
|
1306
|
+
return f + J.join(" ") + " ";
|
|
1278
1307
|
}, "");
|
|
1279
1308
|
}(`M 0 ${I} L ${i - 0.5} ${I} L ${i - 0.5} ${z} L ${2 * i} ${z} L ${g - 2 * i} ${z} M ${g - 2 * i} ${z} L ${g - i} ${z} L ${g - i} ${I} L ${g} ${I}`, i);
|
|
1280
|
-
},
|
|
1309
|
+
}, M = Ee(() => x(l), [g, m, i, l]), E = Ee(() => {
|
|
1281
1310
|
if (i === 0) return;
|
|
1282
|
-
const
|
|
1283
|
-
return x(i) + `L ${g} 0 L 0 0 L 0 ${
|
|
1284
|
-
}, [
|
|
1285
|
-
return Ht("div", { className: n, style: { display: "flex", flexDirection: "row", ...o }, ...a, ref: fo([
|
|
1311
|
+
const Q = i / 2;
|
|
1312
|
+
return x(i) + `L ${g} 0 L 0 0 L 0 ${Q}`;
|
|
1313
|
+
}, [M, i, l]), P = Ee(() => ({ style: { clipPath: `path('${E}')` } }), [E]);
|
|
1314
|
+
return Ht("div", { className: n, style: { display: "flex", flexDirection: "row", ...o }, ...a, ref: fo([u, d, t]), children: [Sn.isValidElement(r) ? Sn.cloneElement(r, P) : q(wn, {}), q("svg", { style: { position: "absolute", top: 0, left: 0, pointerEvents: "none" }, width: g, height: m, viewBox: `0 0 ${g} ${m}`, children: q("path", { d: M, stroke: s, fill: "none", vectorEffect: "non-scaling-stroke", strokeWidth: l }) })] });
|
|
1286
1315
|
}));
|
|
1287
|
-
const
|
|
1288
|
-
const { onPointerDown: t, style: n, splitDirection: o, paddingBefore: r = 0, paddingAfter: i = 0, disabled: l, key: s, hitAreaProps: a =
|
|
1289
|
-
return q("div", { style: { ...n, position: "relative" }, ...d, children: q("div", { className: Rn("hit-box",
|
|
1316
|
+
const Tl = {}, Rl = (e) => {
|
|
1317
|
+
const { onPointerDown: t, style: n, splitDirection: o, paddingBefore: r = 0, paddingAfter: i = 0, disabled: l, key: s, hitAreaProps: a = Tl, ...d } = e, g = o === "row", { style: m, className: u, ...x } = a;
|
|
1318
|
+
return q("div", { style: { ...n, position: "relative" }, ...d, children: q("div", { className: Rn("hit-box", u), style: { left: (g ? -r : 0) + "px", width: `calc(100% + ${g ? r + i : 0}px)`, top: (g ? 0 : -r) + "px", height: `calc(100% + ${g ? 0 : r + i}px)`, position: "absolute", ...m }, onPointerDown: l ? void 0 : t, ...x }) }, s);
|
|
1290
1319
|
}, oo = {}, bn = (e, t, n = !0) => e === null ? null : e.pixels !== null ? n ? e.pixels : t - e.pixels : (n ? e.percent : 100 - e.percent) / 100 * t, ro = (e, t = !0) => e?.percent ? `${t ? e.percent : 100 - e.percent}%` : e?.pixels ? `${e.pixels}px` : void 0, pn = (e, t) => {
|
|
1291
1320
|
if (e == null) return null;
|
|
1292
1321
|
const n = { percent: null, pixels: null };
|
|
@@ -1295,80 +1324,80 @@ const Rl = {}, kl = (e) => {
|
|
|
1295
1324
|
};
|
|
1296
1325
|
function On(e) {
|
|
1297
1326
|
if (!e) throw new Error("must have a PointerHandlerOptions");
|
|
1298
|
-
const { onPointerDown: t, onPointerUp: n, onPointerMoveOrWait: o, processTouch: r = !1, consumeTouch: i = !0 } = e, l =
|
|
1299
|
-
|
|
1300
|
-
}, []),
|
|
1301
|
-
|
|
1327
|
+
const { onPointerDown: t, onPointerUp: n, onPointerMoveOrWait: o, processTouch: r = !1, consumeTouch: i = !0 } = e, l = R(t, [t]), s = R(n, [n]), a = R(o, [o]), d = G(!1), g = e?.timerInitial ?? 230, m = e?.timerContinuous ?? g / 2, u = G(null), x = G(null), M = G(null), E = G(null), P = D(() => {
|
|
1328
|
+
E.current && (clearTimeout(E.current), E.current = null);
|
|
1329
|
+
}, []), Q = D((H) => {
|
|
1330
|
+
E.current = setTimeout(() => {
|
|
1302
1331
|
window.requestAnimationFrame(() => {
|
|
1303
|
-
d.current !== !1 && a?.(x.current,
|
|
1304
|
-
}),
|
|
1332
|
+
d.current !== !1 && a?.(x.current, M.current, u.current);
|
|
1333
|
+
}), Q(m);
|
|
1305
1334
|
}, H ?? g);
|
|
1306
1335
|
}, []);
|
|
1307
|
-
st(() => () =>
|
|
1308
|
-
const
|
|
1336
|
+
st(() => () => P(), []);
|
|
1337
|
+
const k = r ? "pointer" : "mouse", I = D((H) => {
|
|
1309
1338
|
H.stopPropagation(), H.stopImmediatePropagation(), H.preventDefault();
|
|
1310
|
-
}, []), z =
|
|
1311
|
-
document.removeEventListener(`${
|
|
1312
|
-
d.current !== !1 && (d.current = !1, s?.(H,
|
|
1339
|
+
}, []), z = R((H) => {
|
|
1340
|
+
document.removeEventListener(`${k}move`, re), document.removeEventListener(`${k}up`, z), document.removeEventListener("keydown", be), document.removeEventListener("keyup", N), document.removeEventListener("touchstart", I, { capture: !0 }), document.removeEventListener("touchmove", I, { capture: !0 }), window.removeEventListener("blur", se), P(), window.requestAnimationFrame(() => {
|
|
1341
|
+
d.current !== !1 && (d.current = !1, s?.(H, M.current, u.current), M.current = null);
|
|
1313
1342
|
});
|
|
1314
|
-
}, []),
|
|
1343
|
+
}, []), se = D(() => {
|
|
1315
1344
|
d.current !== !1 && (d.current = !1, z(x.current));
|
|
1316
|
-
}, []), B =
|
|
1317
|
-
|
|
1318
|
-
d.current !== !1 && a?.(x.current,
|
|
1345
|
+
}, []), B = R(() => {
|
|
1346
|
+
P(), Q(m), window.requestAnimationFrame(() => {
|
|
1347
|
+
d.current !== !1 && a?.(x.current, M.current, u.current);
|
|
1319
1348
|
});
|
|
1320
|
-
}, [m]),
|
|
1349
|
+
}, [m]), re = R((H) => {
|
|
1321
1350
|
x.current = H, B();
|
|
1322
|
-
}, []), be =
|
|
1323
|
-
|
|
1324
|
-
}, []), N =
|
|
1325
|
-
|
|
1351
|
+
}, []), be = R((H) => {
|
|
1352
|
+
M.current = { ctrlKey: H.ctrlKey, shiftKey: H.shiftKey, altKey: H.altKey, metaKey: H.metaKey }, B();
|
|
1353
|
+
}, []), N = R((H) => {
|
|
1354
|
+
M.current = { ctrlKey: H.ctrlKey, shiftKey: H.shiftKey, altKey: H.altKey, metaKey: H.metaKey }, B();
|
|
1326
1355
|
}, [m]);
|
|
1327
|
-
return
|
|
1328
|
-
H.isDefaultPrevented() || (
|
|
1356
|
+
return R((H) => {
|
|
1357
|
+
H.isDefaultPrevented() || (M.current = { ctrlKey: H.ctrlKey, shiftKey: H.shiftKey, altKey: H.altKey, metaKey: H.metaKey }, l(H, M.current) !== !1 && (u.current = H, x.current = H.nativeEvent, document.addEventListener(`${k}up`, z, { passive: !1 }), document.addEventListener(`${k}move`, re, { passive: !1 }), document.addEventListener("keydown", be, { passive: !1 }), document.addEventListener("keyup", N, { passive: !1 }), window.addEventListener("blur", se, { passive: !0 }), r && i && (document.addEventListener("touchstart", I, { passive: !1, capture: !0 }), document.addEventListener("touchmove", I, { passive: !1, capture: !0 })), d.current = !0, Q(g)));
|
|
1329
1358
|
}, [g, r]);
|
|
1330
1359
|
}
|
|
1331
1360
|
At(Ut((e, t) => {
|
|
1332
|
-
const { elementBefore: n, elementAfter: o, splitDirection: r = "row", fixedPane: i = null, position: l, onPositionChange: s, minBefore: a, maxBefore: d, minAfter: g, maxAfter: m, children:
|
|
1333
|
-
if (
|
|
1334
|
-
const be =
|
|
1335
|
-
let
|
|
1336
|
-
i && (i === "before" ?
|
|
1337
|
-
const et =
|
|
1338
|
-
return { fixedPaneOffset:
|
|
1339
|
-
}, [a, d, g, m]), H =
|
|
1361
|
+
const { elementBefore: n, elementAfter: o, splitDirection: r = "row", fixedPane: i = null, position: l, onPositionChange: s, minBefore: a, maxBefore: d, minAfter: g, maxAfter: m, children: u, className: x, style: M, disabled: E = !1, onDragStart: P, onDragResize: Q, onDragFinish: k, resizerProps: I = oo, paneProps: z = oo, paneBeforeProps: se = oo, paneAfterProps: B = oo, createResizer: re = Rl } = e;
|
|
1362
|
+
if (u) throw new Error("Use elementBefore and elementAfter instead of children.");
|
|
1363
|
+
const be = Ee(() => Sn.isValidElement(o) && Sn.isValidElement(n), [o, n]), N = Ee(() => {
|
|
1364
|
+
let ee = null;
|
|
1365
|
+
i && (i === "before" ? ee = 0 : i === "after" && (ee = 1));
|
|
1366
|
+
const et = ee === null;
|
|
1367
|
+
return { fixedPaneOffset: ee, isPercent: et, minBefore: pn(a, et), maxBefore: pn(d, et), minAfter: pn(g, et), maxAfter: pn(m, et) };
|
|
1368
|
+
}, [a, d, g, m]), H = R(s, [s]), [X, T] = Ze(() => pn(l, i === null));
|
|
1340
1369
|
st(() => {
|
|
1341
1370
|
T(pn(l, i === null));
|
|
1342
1371
|
}, [l, i]);
|
|
1343
|
-
const [S, { width:
|
|
1372
|
+
const [S, { width: f, height: J }] = In(), [K, { width: L, height: U }] = In(), te = r === "row" ? L : U, ne = r === "row" ? f : J, Y = Ee(() => ((ee, et, Ue, ht) => {
|
|
1344
1373
|
const Ie = [null, null], Oe = [null, null];
|
|
1345
|
-
if (
|
|
1346
|
-
let rt = bn(
|
|
1374
|
+
if (ee || (ee = { percent: ht.fixedPaneOffset === null ? 50 : null, pixels: ht.fixedPaneOffset === null ? null : 0 }), et === 0) return ee?.pixels != null ? ht.fixedPaneOffset !== 1 ? (Ie[0] = ee?.pixels, Oe[1] = 100) : (Ie[1] = ee?.pixels - Ue, Oe[0] = 100) : ee?.percent != null && (ht.fixedPaneOffset !== 1 ? (Oe[0] = ee?.percent, Oe[1] = 100 - ee?.percent) : (Oe[1] = ee?.percent, Oe[0] = 100 - ee?.percent)), { percents: Oe, pixels: Ie, minBefore: ro(ht.minBefore, !0), maxBefore: ro(ht.maxBefore, !0), minAfter: ro(ht.minAfter), maxAfter: ro(ht.maxAfter) };
|
|
1375
|
+
let rt = bn(ee, et, ht.fixedPaneOffset !== 1), tt = et - Ue, ze = bn(ht.minBefore, tt, !0) ?? 0, rn = bn(ht.maxBefore, tt, !0) ?? tt, Tt = 0, nt = 0, Rt = 0, Ot = tt;
|
|
1347
1376
|
Tt = (bn(ht.maxAfter, et, !1) ?? Ue) - Ue, nt = bn(ht.minAfter, et, !1) ?? et, Rt = Math.max(ze, Tt), Ot = Math.min(rn, nt), rt = Math.max(Rt, Math.min(rt, Ot)), nt = Math.min(tt - rt, bn(ht.maxAfter, tt - rt, !0) ?? tt), Tt = Math.min(tt - rt, bn(ht.minAfter, tt - rt, !0) ?? tt), Ie[0] = rt, Ie[1] = tt - Ie[0];
|
|
1348
1377
|
const hn = Math.max(0, Math.min(100, rt / tt * 100));
|
|
1349
1378
|
return Oe[0] = hn, Oe[1] = 100 - Oe[0], { percents: Oe, pixels: Ie, minBefore: `${ze}px`, minAfter: `${Tt}px`, maxBefore: `${Ie[0]}px`, maxAfter: `${Ie[1]}px` };
|
|
1350
|
-
})(X,
|
|
1351
|
-
const et = pn(
|
|
1379
|
+
})(X, ne, te, N), [N, X, ne, te, r]), [He, Ve] = Ze(!1), Ne = R(P, [P]), at = R(Q, [Q]), Se = R(k, [k]), Ye = G(null), $ = G(null), _ = G(null), { style: Me, className: ue, ...me } = z, $e = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", display: "flex", overflow: "hidden", ...Me }, { className: dt, style: kt, ...ut } = se, { className: Zt, style: St, ...C } = B, ye = { flex: "1 1 100%", width: "100%", ...M, flexDirection: r, display: "flex" }, { className: Je, style: mt, onPointerDown: Qe, ...cn } = I, on = R((ee) => {
|
|
1380
|
+
const et = pn(ee, i === null);
|
|
1352
1381
|
T(et);
|
|
1353
|
-
}, [i]), Mt =
|
|
1354
|
-
if (
|
|
1382
|
+
}, [i]), Mt = R((ee) => {
|
|
1383
|
+
if (E || !He) return;
|
|
1355
1384
|
const et = De.current?.getBoundingClientRect();
|
|
1356
1385
|
let Ue = 0;
|
|
1357
|
-
Ue = r === "row" ? (
|
|
1358
|
-
}, [N, r,
|
|
1386
|
+
Ue = r === "row" ? (ee.clientX ?? ee.touches?.[0]?.clientX) - et.x : (ee.clientY ?? ee.touches?.[0]?.clientY) - et.y, Ue = Math.max(0, Math.min(ne, Ue)), N.fixedPaneOffset === 1 && (Ue = ne - Ue), l && X.pixels === Ue || T({ pixels: Ue, percent: null }), at?.(Ue), ee.stopPropagation(), ee.preventDefault();
|
|
1387
|
+
}, [N, r, E, He, X, ne]), dn = R((ee) => {
|
|
1359
1388
|
if (document.removeEventListener("pointermove", Mt), document.removeEventListener("touchmove", Mt), document.removeEventListener("pointerup", dn), He && (Ve(!1), X)) {
|
|
1360
1389
|
if (Se(X.pixels), !pn(l, i === null) || X.pixels !== l) {
|
|
1361
1390
|
const et = { ...X };
|
|
1362
|
-
et.percent === null && (et.percent = et.pixels /
|
|
1391
|
+
et.percent === null && (et.percent = et.pixels / ne * 100), H(et);
|
|
1363
1392
|
}
|
|
1364
|
-
|
|
1393
|
+
ee.stopPropagation(), ee.preventDefault();
|
|
1365
1394
|
}
|
|
1366
|
-
}, [X, He, l, i,
|
|
1367
|
-
Qe?.(
|
|
1368
|
-
}, [Qe]), De = wo(t, () => ({ setPosition: on, isSplitPane: () => !0 }), []), Kt =
|
|
1369
|
-
return Ht("div", { ref: fo([S, De]), className: Rn("splitPane", r === "row" ? "vertical" : "horizontal", { dragging: He }, x), style:
|
|
1395
|
+
}, [X, He, l, i, ne]), nn = R((ee) => {
|
|
1396
|
+
Qe?.(ee), ee.defaultPrevented || E || He || (Ve(!0), Ne(), document.addEventListener("pointermove", Mt, { passive: !1 }), document.addEventListener("touchmove", Mt, { passive: !1 }), document.addEventListener("pointerup", dn, { passive: !1 }));
|
|
1397
|
+
}, [Qe]), De = wo(t, () => ({ setPosition: on, isSplitPane: () => !0 }), []), Kt = Ee(() => be ? re?.({ key: "resizer", ref: fo([K, $]), className: Rn("resizer", Je), onPointerDownCapture: nn, style: { cursor: E ? void 0 : r === "row" ? "ew-resize" : "ns-resize", minWidth: r === "row" ? "2px" : void 0, minHeight: r !== "row" ? "2px" : void 0, boxSizing: "border-box", pointerEvents: "all", zIndex: 1, ...mt }, splitDirection: r, disabled: E, ...cn }) : null, [be, Je, cn, r, mt, E]), xt = r === "row" ? "Width" : "Height", Vt = { ...$e, ...kt, flex: N.fixedPaneOffset === 0 && Y?.pixels[0] !== null ? `0 0 ${Math.round(Y?.pixels[0])}px` : `1 1 ${Math.round(Y?.percents[0] ?? 100)}%`, [`min${xt}`]: Y?.minBefore, [`max${xt}`]: o ? Y?.maxBefore : "100%" }, Cn = { ...$e, ...St, flex: N.fixedPaneOffset === 1 && Y?.pixels[1] !== null ? `0 0 ${Math.round(Y?.pixels[1])}px` : `1 1 ${Math.round(Y?.percents[1] ?? 100)}%`, [`min${xt}`]: Y?.minAfter, [`max${xt}`]: n ? Y?.maxAfter : "100%" }, un = Ee(() => n ? q("div", { ref: Ye, className: Rn("before", ue, dt), style: Vt, ...me, ...ut, children: n }, "before") : null, [n, z, se, N, Y]), We = Ee(() => o ? q("div", { ref: _, className: Rn("after", ue, Zt), style: Cn, ...me, ...C, children: o }, "after") : null, [o, z, B, N, Y]);
|
|
1398
|
+
return Ht("div", { ref: fo([S, De]), className: Rn("splitPane", r === "row" ? "vertical" : "horizontal", { dragging: He }, x), style: ye, children: [un, Kt, We] });
|
|
1370
1399
|
}));
|
|
1371
|
-
const
|
|
1400
|
+
const kl = ({ initValue: e, useHookBody: t, applyStateChange: n }) => {
|
|
1372
1401
|
const o = G(e);
|
|
1373
1402
|
if (typeof t != "function") throw new Error("function expected as hook body parameter. got " + typeof t);
|
|
1374
1403
|
const r = t();
|
|
@@ -1378,12 +1407,12 @@ const Pl = ({ initValue: e, useHookBody: t, applyStateChange: n }) => {
|
|
|
1378
1407
|
}, qo = (e) => {
|
|
1379
1408
|
console && console.warn && console.warn(e);
|
|
1380
1409
|
}, zo = typeof self == "object" && self.self === self && self || typeof global == "object" && global.global === global && global || void 0;
|
|
1381
|
-
let
|
|
1410
|
+
let Pl = 1, Yo = !1, bi = !1;
|
|
1382
1411
|
const co = [], kn = [], po = () => {
|
|
1383
1412
|
kn.forEach((e) => e());
|
|
1384
|
-
},
|
|
1413
|
+
}, Ol = ({ automaticContainerInternalUseOnly: e }) => {
|
|
1385
1414
|
const [t, n] = Ze([]), o = G([]);
|
|
1386
|
-
return o.current = t, e || Yo !== !1 || (
|
|
1415
|
+
return o.current = t, e || Yo !== !1 || (bi = !0), st(() => {
|
|
1387
1416
|
let r = !0;
|
|
1388
1417
|
function i() {
|
|
1389
1418
|
if (r) return kn[0] !== i ? (e || Yo !== !0 || qo("SingletonHooksContainer is mounted after some singleton hook has been used.Your SingletonHooksContainer will not be used in favor of internal one."), void n((l) => [])) : void n([...co]);
|
|
@@ -1391,34 +1420,34 @@ const co = [], kn = [], po = () => {
|
|
|
1391
1420
|
return kn.push(i), po(), () => {
|
|
1392
1421
|
r = !1, o.current?.length > 0 && qo("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"), kn.splice(kn.indexOf(i), 1), po();
|
|
1393
1422
|
};
|
|
1394
|
-
}, [e]), q(wn, { children: t.map(({ hook: r, key: i }) => Jo(
|
|
1395
|
-
},
|
|
1423
|
+
}, [e]), q(wn, { children: t.map(({ hook: r, key: i }) => Jo(kl, { ...r, key: i })) });
|
|
1424
|
+
}, Si = (e, t, n = {}) => {
|
|
1396
1425
|
let o, r, i = !1, l = !1, s = [], { unmountIfNoConsumers: a = !1 } = n;
|
|
1397
1426
|
const d = (m) => {
|
|
1398
|
-
r = m,
|
|
1427
|
+
r = m, Bi(() => s.forEach((u) => u(m)));
|
|
1399
1428
|
}, g = () => (l || (r = typeof e == "function" ? e() : e, l = !0), r);
|
|
1400
1429
|
return () => {
|
|
1401
|
-
const [m,
|
|
1430
|
+
const [m, u] = Ze(g);
|
|
1402
1431
|
return st(() => (i || (i = !0, o = ((x) => {
|
|
1403
|
-
const
|
|
1404
|
-
return co.push({ hook: x, key:
|
|
1432
|
+
const M = Pl++;
|
|
1433
|
+
return co.push({ hook: x, key: M }), kn.length === 0 && bi === !1 && (Yo = !0, ((E) => {
|
|
1405
1434
|
if (zo.document && zo.document.createElement) {
|
|
1406
|
-
const
|
|
1407
|
-
|
|
1435
|
+
const P = zo.document.createElement("div");
|
|
1436
|
+
$i(P).render(q(E, { automaticContainerInternalUseOnly: !0 }));
|
|
1408
1437
|
} else qo("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.");
|
|
1409
|
-
})(
|
|
1410
|
-
co.splice(co.findIndex((
|
|
1438
|
+
})(Ol)), po(), () => {
|
|
1439
|
+
co.splice(co.findIndex((E) => E.key === M), 1), po();
|
|
1411
1440
|
};
|
|
1412
|
-
})({ initValue: e, useHookBody: t, applyStateChange: d })), s.push(
|
|
1413
|
-
s.splice(s.indexOf(
|
|
1441
|
+
})({ initValue: e, useHookBody: t, applyStateChange: d })), s.push(u), r !== m && u(r), () => {
|
|
1442
|
+
s.splice(s.indexOf(u), 1), s.length === 0 && a && (o(), i = !1);
|
|
1414
1443
|
}), []), m;
|
|
1415
1444
|
};
|
|
1416
1445
|
};
|
|
1417
|
-
|
|
1446
|
+
Si(null, () => {
|
|
1418
1447
|
const [e, t] = Ze(null);
|
|
1419
1448
|
return e;
|
|
1420
1449
|
});
|
|
1421
|
-
class
|
|
1450
|
+
class Ll {
|
|
1422
1451
|
constructor(t, n, o, r) {
|
|
1423
1452
|
this._listenersProperties = /* @__PURE__ */ new Set(), this._listenersExecute = /* @__PURE__ */ new Set(), this._key = t, this._target = n, this._applyProps(o || {}), this._callback = r, r === void 0 && (this._callback = () => {
|
|
1424
1453
|
console.log(`implement: ${this.label()} : ${this.description()}`);
|
|
@@ -1529,19 +1558,19 @@ class Dl {
|
|
|
1529
1558
|
}), n;
|
|
1530
1559
|
}
|
|
1531
1560
|
}
|
|
1532
|
-
class
|
|
1561
|
+
class _e extends Ll {
|
|
1533
1562
|
}
|
|
1534
|
-
Ct.getOS() === Ct.OSType.MacOS || (Ct.getOS(), Ct.OSType.IOS), Ct.getOS() === Ct.OSType.MacOS || (Ct.getOS(), Ct.OSType.IOS),
|
|
1563
|
+
Ct.getOS() === Ct.OSType.MacOS || (Ct.getOS(), Ct.OSType.IOS), Ct.getOS() === Ct.OSType.MacOS || (Ct.getOS(), Ct.OSType.IOS), Si({ setClipboard: (e) => {
|
|
1535
1564
|
throw new Error("This is only available via the useClipboard.");
|
|
1536
1565
|
}, getClipboard: () => ho.Global, refNativeCopy: { current: null }, refNativeLastKey: { current: null } }, () => {
|
|
1537
1566
|
const [e, t] = Ze(ho.Global);
|
|
1538
1567
|
return { setClipboard: (n) => t(n), getClipboard: () => e, refNativeCopy: G(null), refNativeLastKey: G(null) };
|
|
1539
1568
|
});
|
|
1540
|
-
let Ao = !1,
|
|
1541
|
-
var
|
|
1542
|
-
const Pr = () => "sheetxl-ui-" +
|
|
1569
|
+
let Ao = !1, Dl = 0;
|
|
1570
|
+
var zl = typeof document < "u" ? tn : st;
|
|
1571
|
+
const Pr = () => "sheetxl-ui-" + Dl++, Al = Sn.useId ?? function() {
|
|
1543
1572
|
const [e, t] = Sn.useState(() => Ao ? Pr() : void 0);
|
|
1544
|
-
return
|
|
1573
|
+
return zl(() => {
|
|
1545
1574
|
e == null && t(Pr());
|
|
1546
1575
|
}, []), Sn.useEffect(() => {
|
|
1547
1576
|
Ao || (Ao = !0);
|
|
@@ -1567,7 +1596,7 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1567
1596
|
let l, s;
|
|
1568
1597
|
e === "column" ? (l = o.columnMetadataMap, s = o.lastMeasuredColumnIndex) : (l = o.rowMetadataMap, s = o.lastMeasuredRowIndex);
|
|
1569
1598
|
let a = 0;
|
|
1570
|
-
return a = (s > 0 ? l[s].offset : 0) >= r ? _i({ itemType: e, itemSize: t, instanceProps: o, high: s, low: 0, offset: r, scale: i }) :
|
|
1599
|
+
return a = (s > 0 ? l[s].offset : 0) >= r ? _i({ itemType: e, itemSize: t, instanceProps: o, high: s, low: 0, offset: r, scale: i }) : $l({ itemType: e, itemSize: t, itemCount: n, instanceProps: o, index: Math.max(0, s), offset: r, scale: i }), a = Math.min(a, n), a;
|
|
1571
1600
|
}, _i = ({ itemType: e, itemSize: t, instanceProps: n, high: o, low: r, offset: i, scale: l }) => {
|
|
1572
1601
|
for (; r <= o; ) {
|
|
1573
1602
|
const s = r + Math.floor((o - r) / 2), a = Pn({ itemType: e, itemSize: t, index: s, instanceProps: n, scale: l }).offset;
|
|
@@ -1575,16 +1604,16 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1575
1604
|
a < i ? r = s + 1 : a > i && (o = s - 1);
|
|
1576
1605
|
}
|
|
1577
1606
|
return r > 0 ? r - 1 : 0;
|
|
1578
|
-
},
|
|
1607
|
+
}, $l = ({ itemType: e, itemSize: t, itemCount: n, instanceProps: o, index: r, offset: i, scale: l }) => {
|
|
1579
1608
|
let s = 1;
|
|
1580
1609
|
for (; r < n && Pn({ itemType: e, itemSize: t, index: r, instanceProps: o, scale: l }).offset < i; ) r += s, s *= 2;
|
|
1581
1610
|
return _i({ itemType: e, itemSize: t, instanceProps: o, high: Math.min(r, n - 1), low: Math.floor(r / 2), offset: i, scale: l });
|
|
1582
|
-
},
|
|
1583
|
-
const { rowCount: t, columnCount: n, defaultRowHeight: o, getRowHeight: r, defaultColumnWidth: i, getColumnWidth: l } = e || {}, s = G({ columnMetadataMap: {}, rowMetadataMap: {}, lastMeasuredColumnIndex: -1, lastMeasuredRowIndex: -1, recalcColumnIndices: [], recalcRowIndices: [] }), a =
|
|
1611
|
+
}, Bl = (e) => {
|
|
1612
|
+
const { rowCount: t, columnCount: n, defaultRowHeight: o, getRowHeight: r, defaultColumnWidth: i, getColumnWidth: l } = e || {}, s = G({ columnMetadataMap: {}, rowMetadataMap: {}, lastMeasuredColumnIndex: -1, lastMeasuredRowIndex: -1, recalcColumnIndices: [], recalcRowIndices: [] }), a = R((I) => Or({ itemType: "row", itemCount: t, itemSize: r ?? (() => o ?? 20), instanceProps: s.current, offset: I }), [t, r, o]), d = R((I) => I === -1 ? 0 : Pn({ itemType: "row", index: I, itemSize: r ?? (() => o ?? 20), instanceProps: s.current }).offset, [r, o]), g = R((I) => Pn({ itemType: "row", index: I, itemSize: r ?? (() => o ?? 20), instanceProps: s.current }).size, [r, o]), m = R((I) => Or({ itemType: "column", itemCount: n, itemSize: l ?? (() => i ?? 75), instanceProps: s.current, offset: I }), [n, l, i]), u = R((I) => I === -1 ? 0 : Pn({ itemType: "column", index: I, itemSize: l ?? (() => i ?? 75), instanceProps: s.current }).offset, [l, i]), x = R((I) => Pn({ itemType: "column", index: I, itemSize: l ?? (() => i ?? 75), instanceProps: s.current }).size, [l, i]), [M, E] = Qo((I) => I + 1, 0), P = () => ({ getRowOffset: d, getColOffset: u, getRowIndex: a, getColIndex: m }), [Q, k] = Ze(() => e ? P() : null);
|
|
1584
1613
|
return st(() => {
|
|
1585
|
-
|
|
1586
|
-
}, [
|
|
1587
|
-
},
|
|
1614
|
+
k(e ? P() : null);
|
|
1615
|
+
}, [M, t, n, i, o, g, x]), Q;
|
|
1616
|
+
}, Ei = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ~`!@#$%^&*()-_=+[{]};:'\",<.>/?|\\", Lr = (e) => {
|
|
1588
1617
|
if (!e) return null;
|
|
1589
1618
|
if (e.eventType === "start") return { type: e.eventType };
|
|
1590
1619
|
if (e.eventType === "submit") return { type: e.eventType };
|
|
@@ -1596,19 +1625,19 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1596
1625
|
return e.activeCoords && (t.activeCoords = e.activeCoords), t;
|
|
1597
1626
|
}
|
|
1598
1627
|
return { type: e.eventType ?? "unknown" };
|
|
1599
|
-
},
|
|
1600
|
-
const { session: t, refLatestCoords: n, handleSubmitEdit: o, handleCancelEdit: r, cellBounds: i, isInBounds: l, getCellEditor: s, propsEditor: a, borderStrokeFill: d = "rgb(33, 115, 70)", borderStrokeWidth: g = 2, alignment: m = Wn.Left, style:
|
|
1601
|
-
if (
|
|
1628
|
+
}, Fl = (e) => !0, jl = (e) => !!e && !(e.ctrlKey || e.metaKey || e.altKey || e.isComposing) && (!(e.shiftKey || e.key !== "F2" && e.key !== " " && e.key !== "Backspace") || (!e.shiftKey || e.key !== " ") && Ei.indexOf(e.key) !== -1), Vl = (e) => !!e && e.type === "dblclick" && { editMode: !0 }, Wl = (e) => {
|
|
1629
|
+
const { session: t, refLatestCoords: n, handleSubmitEdit: o, handleCancelEdit: r, cellBounds: i, isInBounds: l, getCellEditor: s, propsEditor: a, borderStrokeFill: d = "rgb(33, 115, 70)", borderStrokeWidth: g = 2, alignment: m = Wn.Left, style: u, ...x } = e, M = G(null), E = G(null), [P, Q] = Ze(!1), k = t.coords, I = D(async (X) => {
|
|
1630
|
+
if (M.current?.getBoundingClientRect()) {
|
|
1602
1631
|
if (X.eventType === "keyboard") {
|
|
1603
|
-
const S = X.event,
|
|
1604
|
-
|
|
1632
|
+
const S = X.event, f = new KeyboardEvent(S.type, { bubbles: !0, cancelable: !0, view: window, key: S.key, code: S.code, location: S.location, repeat: S.repeat, isComposing: S.isComposing, charCode: S.charCode, keyCode: S.keyCode, which: S.which, ctrlKey: S.ctrlKey, shiftKey: S.shiftKey, altKey: S.altKey, metaKey: S.metaKey });
|
|
1633
|
+
f.isSynthetic = !0, f.key, E.current?.dispatchEvent(f);
|
|
1605
1634
|
} else X.eventType === "pointer" || console.warn("unsupported event type", X);
|
|
1606
1635
|
await new Promise((S) => requestAnimationFrame(S));
|
|
1607
1636
|
}
|
|
1608
1637
|
}, []);
|
|
1609
1638
|
st(() => {
|
|
1610
|
-
const X =
|
|
1611
|
-
return
|
|
1639
|
+
const X = E.current;
|
|
1640
|
+
return Q(!0), E.current.startEdit?.(t.startEvent), (async () => {
|
|
1612
1641
|
t.editorRefs.push(X), t.editorRefsDispatchEditorEvent.push(I);
|
|
1613
1642
|
const T = [...t.events];
|
|
1614
1643
|
for (let S = 0; S < T.length; S++) await I(T[S]);
|
|
@@ -1618,58 +1647,58 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1618
1647
|
T !== -1 && t.editorRefs.splice(T, 1), t.onUnmount(X);
|
|
1619
1648
|
};
|
|
1620
1649
|
}, []);
|
|
1621
|
-
const z = D(() => o(t), []),
|
|
1650
|
+
const z = D(() => o(t), []), se = D(() => {
|
|
1622
1651
|
r(t);
|
|
1623
|
-
}, []), B = n.current && Z.isEqualCells(n.current,
|
|
1624
|
-
return q("div", { tabIndex: 0, ref:
|
|
1625
|
-
},
|
|
1626
|
-
const { view: t, canEdit: n =
|
|
1627
|
-
if (!
|
|
1628
|
-
const dt = me?.(
|
|
1652
|
+
}, []), B = n.current && Z.isEqualCells(n.current, k), re = l && B && P, be = s({ autoFocus: !!t.startEvent?.autoFocus, ...a, onSubmitEdit: z, onCancelEdit: se, ref: E }, k), N = i.x + we.boundPixel(-g / 2), H = we.boundPixel(i.width + g / 2, !0);
|
|
1653
|
+
return q("div", { tabIndex: 0, ref: M, style: { background: void 0, ...u, opacity: re ? u?.opacity ?? 1 : 0, pointerEvents: "auto", position: "absolute", boxSizing: "border-box", top: `${i.y + we.boundPixel(-g / 2)}px`, height: we.boundPixel(i.height + g / 2, !0), left: `${N}px`, width: H }, ...x, children: q("div", { className: "editor-container", style: { position: "absolute", boxSizing: "border-box", left: `${we.boundPixel(1)}px`, top: `${we.boundPixel(1)}px`, width: we.boundPixel(i.width - 2, !0), height: we.boundPixel(i.height - 2, !0), outline: `${g}px ${d} solid`, boxShadow: "rgba(60,64,67,.35) 2px 2px 6px 3px", maxHeight: "100%", overflow: "hidden", display: "flex" }, children: be }) });
|
|
1654
|
+
}, ps = (e) => {
|
|
1655
|
+
const { view: t, canEdit: n = Fl, getCellEditor: o, onBeforeStartEdit: r, onStartEdit: i, onSubmitEdit: l, onCancelEdit: s, onDoneEdit: a, isEditorStartKeyEvent: d = jl, isEditorStartPointerEvent: g = Vl, containerProps: m, borderStrokeFill: u, borderStrokeWidth: x = 2, getRangeCoords: M = null, activeCoords: E, alignment: P = Wn.Left } = e, [Q, k] = Ze(!1), [I, z] = Ze(void 0), se = R(($, _, Me, ue, me, $e) => {
|
|
1656
|
+
if (!_) return null;
|
|
1657
|
+
const dt = me?.(_, $), kt = $.getRangeCoordsBounds(dt), ut = $.toClipBounds(kt), Zt = kt, St = $.getZoom();
|
|
1629
1658
|
if (!ut) return null;
|
|
1630
1659
|
Me && (Me *= St), ue && (ue *= St);
|
|
1631
|
-
let C = Zt,
|
|
1660
|
+
let C = Zt, ye = !1;
|
|
1632
1661
|
if (Me !== void 0) {
|
|
1633
1662
|
let Qe = { ...dt }, cn = 0;
|
|
1634
|
-
for (; !
|
|
1663
|
+
for (; !ye && C.width <= Me && cn < 20; ) {
|
|
1635
1664
|
cn++, cn > 19 && console.warn("max width reached");
|
|
1636
1665
|
const on = $.getTotalRangeCoords(), Mt = $.getLayout();
|
|
1637
|
-
$e === Wn.Left ? Qe.colEnd + 1 < on.colEnd ? Qe.colEnd = Mt.getColIndex(C.x + Me) :
|
|
1666
|
+
$e === Wn.Left ? Qe.colEnd + 1 < on.colEnd ? Qe.colEnd = Mt.getColIndex(C.x + Me) : ye = !0 : $e === Wn.Right ? Qe.colStart - 1 >= 0 ? Qe.colStart = Mt.getColIndex(C.x - (Me - C.width)) : ye = !0 : $e === Wn.Center && Qe.colEnd + 1 < on.colEnd && Qe.colStart - 1 >= 0 ? (Qe.colStart = Mt.getColIndex(C.x - (Me - C.width) / 2), Qe.colEnd = Mt.getColIndex(C.x + C.width + (Me - C.width) / 2)) : ye = !0, ye || (C = $.getRangeCoordsBounds(Qe));
|
|
1638
1667
|
}
|
|
1639
1668
|
}
|
|
1640
1669
|
C.height = Zt.height, ue !== void 0 && (C.height = Math.max(ue + 1, Zt.height));
|
|
1641
1670
|
const { width: Je, height: mt } = $.getViewportSize();
|
|
1642
1671
|
return { x: C.x ?? 0, y: C.y ?? 0, height: Math.min(mt - C.y, C.height) + 1, width: Math.min(Je - C.x, C.width) + 1 };
|
|
1643
|
-
}, [
|
|
1672
|
+
}, [P]), B = R(n, [n]), re = D(() => {
|
|
1644
1673
|
t?.getStage()?.focus();
|
|
1645
|
-
}, [t]), be = G(null), N =
|
|
1646
|
-
r?.($),
|
|
1647
|
-
}, [r]), H =
|
|
1674
|
+
}, [t]), be = G(null), N = R(($) => {
|
|
1675
|
+
r?.($), ne(), k(!0), be.current = null;
|
|
1676
|
+
}, [r]), H = R(($) => {
|
|
1648
1677
|
i?.($.coords);
|
|
1649
|
-
}, [i]), X =
|
|
1650
|
-
$.isSubmitted || $.isCancelled || (
|
|
1651
|
-
}, [s]), T =
|
|
1678
|
+
}, [i]), X = R(($) => {
|
|
1679
|
+
$.isSubmitted || $.isCancelled || (f.current.isEditorClosed = !0, re(), $.isCancelled = !0, s?.($.coords), ne());
|
|
1680
|
+
}, [s]), T = R(($) => {
|
|
1652
1681
|
if ($.isSubmitted || $.isCancelled) return !1;
|
|
1653
1682
|
try {
|
|
1654
|
-
return be.current = $.coords, $.isEditorClosing = !0, $.isSubmitted = !0, $.isEditorSubmitted || ($.isEditorSubmitted = !0, $.editorRefs[0]?.submitEdit?.()), $.coords, l?.($.coords), $.isEditorClosed = !0,
|
|
1655
|
-
} catch (
|
|
1656
|
-
throw $.isEditorClosing = !1, $.isSubmitted = !1,
|
|
1657
|
-
}
|
|
1658
|
-
}, [l]), S =
|
|
1659
|
-
|
|
1660
|
-
}, [a]),
|
|
1661
|
-
$ && L.current.push($),
|
|
1662
|
-
}, []), Y =
|
|
1683
|
+
return be.current = $.coords, $.isEditorClosing = !0, $.isSubmitted = !0, $.isEditorSubmitted || ($.isEditorSubmitted = !0, $.editorRefs[0]?.submitEdit?.()), $.coords, l?.($.coords), $.isEditorClosed = !0, re(), ne(), !0;
|
|
1684
|
+
} catch (_) {
|
|
1685
|
+
throw $.isEditorClosing = !1, $.isSubmitted = !1, _;
|
|
1686
|
+
}
|
|
1687
|
+
}, [l]), S = R(($) => {
|
|
1688
|
+
k(!1), a?.($.coords), ne();
|
|
1689
|
+
}, [a]), f = G(null), J = G(null), K = G(null), L = G([]), [U, te] = Qo(($) => $ + 1, 0), ne = D(($) => {
|
|
1690
|
+
$ && L.current.push($), te();
|
|
1691
|
+
}, []), Y = R(($) => {
|
|
1663
1692
|
if ($.defaultPrevented || $.isSynthetic || !t) return;
|
|
1664
|
-
const
|
|
1665
|
-
|
|
1666
|
-
}, [t]), He =
|
|
1667
|
-
const
|
|
1668
|
-
Y(
|
|
1669
|
-
}, [t]), Ve =
|
|
1693
|
+
const _ = t?.getCellCoordsFromClient($.clientX, $.clientY);
|
|
1694
|
+
_ && ne({ eventType: "pointer", event: $, coords: _ });
|
|
1695
|
+
}, [t]), He = R(($) => {
|
|
1696
|
+
const _ = $.nativeEvent;
|
|
1697
|
+
Y(_);
|
|
1698
|
+
}, [t]), Ve = R(($) => {
|
|
1670
1699
|
if ($.defaultPrevented || $.isSynthetic || !t?.getStage()) return;
|
|
1671
|
-
const
|
|
1672
|
-
d($,
|
|
1700
|
+
const _ = J.current;
|
|
1701
|
+
d($, _) && ($.stopPropagation(), $.preventDefault()), $.key, ne({ eventType: "keyboard", event: $, coords: _ });
|
|
1673
1702
|
}, [t]);
|
|
1674
1703
|
tn(() => {
|
|
1675
1704
|
const $ = (ue, me) => {
|
|
@@ -1681,49 +1710,49 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1681
1710
|
const kt = Ct.uuidV4();
|
|
1682
1711
|
me = Object.freeze({ autoFocus: !0, ...me }), K.current = $e;
|
|
1683
1712
|
const ut = { coords: dt, startEvent: me, uuid: kt, isMounted: !1, isStarted: !1, isSubmitted: !1, isEditorSubmitted: !1, isEditorClosing: !1, isEditorClosed: !1, isCancelled: !1, events: [], editorRefsDispatchEditorEvent: [], editorRefs: [], onMount: (Zt) => {
|
|
1684
|
-
ut.isMounted || (ut.isMounted = !0,
|
|
1713
|
+
ut.isMounted || (ut.isMounted = !0, ne());
|
|
1685
1714
|
}, onUnmount: (Zt) => {
|
|
1686
1715
|
if (ut.editorRefs.length === 0) {
|
|
1687
1716
|
const St = () => {
|
|
1688
|
-
ut.isMounted = !1,
|
|
1717
|
+
ut.isMounted = !1, ne();
|
|
1689
1718
|
};
|
|
1690
1719
|
if (document.activeElement !== document.body) St();
|
|
1691
1720
|
else {
|
|
1692
|
-
const C = (
|
|
1693
|
-
|
|
1721
|
+
const C = (ye) => {
|
|
1722
|
+
ye.defaultPrevented || ye.target !== document.body || Ve(ye);
|
|
1694
1723
|
};
|
|
1695
1724
|
window.addEventListener("keydown", C, !0), t.getStage()?.addEventListener("focusin", () => {
|
|
1696
1725
|
window.removeEventListener("keydown", C), St();
|
|
1697
|
-
}, { once: !0 }),
|
|
1726
|
+
}, { once: !0 }), re();
|
|
1698
1727
|
}
|
|
1699
1728
|
}
|
|
1700
1729
|
} };
|
|
1701
1730
|
return ut;
|
|
1702
1731
|
};
|
|
1703
|
-
if (L.current.length <= 0 && !
|
|
1704
|
-
const
|
|
1705
|
-
Lr(
|
|
1732
|
+
if (L.current.length <= 0 && !f.current) return;
|
|
1733
|
+
const _ = L.current[0];
|
|
1734
|
+
Lr(_), ((ue) => {
|
|
1706
1735
|
const me = [], $e = ue?.length ?? 0;
|
|
1707
1736
|
for (let dt = 0; dt < $e; dt++) {
|
|
1708
1737
|
const kt = ue[dt];
|
|
1709
1738
|
me.push(Lr(kt));
|
|
1710
1739
|
}
|
|
1711
|
-
})(L.current),
|
|
1712
|
-
let Me =
|
|
1713
|
-
if (
|
|
1714
|
-
if (
|
|
1715
|
-
else if (
|
|
1716
|
-
if (
|
|
1717
|
-
|
|
1740
|
+
})(L.current), f.current, f.current;
|
|
1741
|
+
let Me = f.current;
|
|
1742
|
+
if (f.current) {
|
|
1743
|
+
if (f.current.isDone) f.current = null;
|
|
1744
|
+
else if (f.current.isSubmitted || f.current.isCancelled) {
|
|
1745
|
+
if (f.current.isMounted) return;
|
|
1746
|
+
f.current.isDone || (S(f.current), f.current.isDone = !0);
|
|
1718
1747
|
}
|
|
1719
1748
|
}
|
|
1720
|
-
if (
|
|
1721
|
-
if (
|
|
1722
|
-
const ue =
|
|
1723
|
-
|
|
1724
|
-
} else if (
|
|
1725
|
-
const ue =
|
|
1726
|
-
if (
|
|
1749
|
+
if (_) {
|
|
1750
|
+
if (_.eventType === "start") {
|
|
1751
|
+
const ue = _, me = ue.startEvent?.cell ?? J.current;
|
|
1752
|
+
f.current && Z.isEqualCells(f.current.coords, me) || (f.current = $(me, ue.startEvent));
|
|
1753
|
+
} else if (_.eventType === "keyboard") {
|
|
1754
|
+
const ue = _.event;
|
|
1755
|
+
if (f.current) {
|
|
1727
1756
|
let me = !1;
|
|
1728
1757
|
switch (ue.which) {
|
|
1729
1758
|
case ci:
|
|
@@ -1735,113 +1764,113 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1735
1764
|
me = !0;
|
|
1736
1765
|
}
|
|
1737
1766
|
if (!me) {
|
|
1738
|
-
|
|
1739
|
-
for (let $e = 0; $e <
|
|
1767
|
+
f.current.events.push(_);
|
|
1768
|
+
for (let $e = 0; $e < f.current.editorRefsDispatchEditorEvent.length; $e++) f.current.editorRefsDispatchEditorEvent[$e](_);
|
|
1740
1769
|
}
|
|
1741
|
-
} else if (d(ue,
|
|
1770
|
+
} else if (d(ue, _.coords)) {
|
|
1742
1771
|
let me;
|
|
1743
1772
|
const $e = $(me?.cell ?? J.current, me);
|
|
1744
|
-
$e && $e.events.push(
|
|
1773
|
+
$e && $e.events.push(_), f.current = $e;
|
|
1745
1774
|
}
|
|
1746
|
-
} else if (
|
|
1747
|
-
const ue =
|
|
1748
|
-
if (
|
|
1749
|
-
|
|
1750
|
-
for (let me = 0; me <
|
|
1775
|
+
} else if (_.eventType === "pointer") {
|
|
1776
|
+
const ue = _.event;
|
|
1777
|
+
if (f.current) {
|
|
1778
|
+
f.current.events.push(_);
|
|
1779
|
+
for (let me = 0; me < f.current.editorRefsDispatchEditorEvent.length; me++) f.current.editorRefsDispatchEditorEvent[me](_);
|
|
1751
1780
|
} else {
|
|
1752
|
-
const me =
|
|
1781
|
+
const me = _?.coords ?? J.current, $e = g(ue, me);
|
|
1753
1782
|
if ($e) {
|
|
1754
1783
|
let dt;
|
|
1755
1784
|
typeof dt != "boolean" && (dt = $e);
|
|
1756
1785
|
const kt = $(me, dt);
|
|
1757
|
-
kt && kt.events.push(
|
|
1786
|
+
kt && kt.events.push(_), f.current = kt;
|
|
1758
1787
|
}
|
|
1759
1788
|
}
|
|
1760
|
-
} else if (
|
|
1761
|
-
if (
|
|
1762
|
-
if (!
|
|
1763
|
-
T(
|
|
1789
|
+
} else if (_.eventType === "submit") {
|
|
1790
|
+
if (f.current && !f.current.isSubmitted && !f.current.isCancelled) {
|
|
1791
|
+
if (!f.current.isMounted) return;
|
|
1792
|
+
T(f.current);
|
|
1764
1793
|
}
|
|
1765
|
-
} else if (
|
|
1766
|
-
if (
|
|
1767
|
-
if (!
|
|
1768
|
-
X(
|
|
1794
|
+
} else if (_.eventType === "cancel") {
|
|
1795
|
+
if (f.current && !f.current.isSubmitted && !f.current.isCancelled) {
|
|
1796
|
+
if (!f.current.isMounted) return;
|
|
1797
|
+
X(f.current);
|
|
1769
1798
|
}
|
|
1770
|
-
} else if (
|
|
1771
|
-
const ue =
|
|
1772
|
-
if (J.current = ue.activeCoords,
|
|
1773
|
-
if (!
|
|
1799
|
+
} else if (_.eventType === "coordsChange") {
|
|
1800
|
+
const ue = _;
|
|
1801
|
+
if (J.current = ue.activeCoords, f.current, f.current && !f.current.isSubmitted && !f.current.isCancelled) {
|
|
1802
|
+
if (!f.current.isMounted) return;
|
|
1774
1803
|
try {
|
|
1775
|
-
T(
|
|
1804
|
+
T(f.current);
|
|
1776
1805
|
} catch {
|
|
1777
1806
|
}
|
|
1778
1807
|
}
|
|
1779
1808
|
}
|
|
1780
1809
|
}
|
|
1781
|
-
L.current.length > 0 && (L.current.shift(),
|
|
1782
|
-
t &&
|
|
1810
|
+
L.current.length > 0 && (L.current.shift(), ne()), L.current.length === 0 && (!f.current || f.current.isEditorClosing || f.current.isEditorClosed ? !f.current && Me && re() : f.current.isMounted && !f.current.isStarted && (f.current.isStarted = !0, f.current.startEvent.autoFocus && (typeof f.current.startEvent.autoFocus == "string" ? f.current.editorRefs[0]?.autoFocus(f.current.startEvent.autoFocus) : f.current.editorRefs[0]?.autoFocus()), H?.(f.current), requestAnimationFrame(() => {
|
|
1811
|
+
t && f.current?.coords && t.scrollCellCoordsIntoView(f.current.coords);
|
|
1783
1812
|
})));
|
|
1784
1813
|
}, [U]), st(() => {
|
|
1785
|
-
K.current =
|
|
1786
|
-
const $ =
|
|
1787
|
-
Z.isEqualCells($,
|
|
1788
|
-
}, [
|
|
1814
|
+
K.current = E;
|
|
1815
|
+
const $ = f.current?.coords;
|
|
1816
|
+
Z.isEqualCells($, E) || (f.current && (f.current.isEditorClosing = !0), ne({ eventType: "coordsChange", activeCoords: E }));
|
|
1817
|
+
}, [E]);
|
|
1789
1818
|
const Ne = D(($) => {
|
|
1790
1819
|
Ve($.nativeEvent);
|
|
1791
|
-
}, []), { width: at = 0, height: Se = 0 } = I ?? { width: 0, height: 0 }, Ye =
|
|
1792
|
-
return { overlay:
|
|
1793
|
-
if (!
|
|
1794
|
-
|
|
1795
|
-
let
|
|
1796
|
-
|
|
1797
|
-
const ue = $.getZoom(), me = { containerBounds: { x: 0, y: 0, width:
|
|
1798
|
-
return q(
|
|
1799
|
-
}, [o,
|
|
1800
|
-
|
|
1820
|
+
}, []), { width: at = 0, height: Se = 0 } = I ?? { width: 0, height: 0 }, Ye = R(o, [o]);
|
|
1821
|
+
return { overlay: R(($) => {
|
|
1822
|
+
if (!f.current || f.current.isEditorClosed) return f.current, null;
|
|
1823
|
+
f.current.coords;
|
|
1824
|
+
let _ = se($, f.current.coords, at, Se, M, P), Me = !0;
|
|
1825
|
+
_ && _.width !== 0 && _.height !== 0 || (_ = { x: 0, y: 0, width: at, height: at }, Me = !1);
|
|
1826
|
+
const ue = $.getZoom(), me = { containerBounds: { x: 0, y: 0, width: _.width / ue, height: _.height / ue }, setNaturalDimensions: z, zoom: ue };
|
|
1827
|
+
return q(Wl, { session: f.current, refLatestCoords: K, handleSubmitEdit: T, handleCancelEdit: X, cellBounds: _, borderStrokeWidth: x, borderStrokeFill: u, isInBounds: Me, getCellEditor: Ye, propsEditor: me, alignment: P, ...m }, "editor:" + f.current.uuid);
|
|
1828
|
+
}, [o, M, U, at, Se, P, x, u]), startEdit: D(($) => {
|
|
1829
|
+
ne({ eventType: "start", startEvent: $ });
|
|
1801
1830
|
}, []), submitEdit: D(() => {
|
|
1802
|
-
|
|
1831
|
+
ne({ eventType: "submit" });
|
|
1803
1832
|
}, []), cancelEdit: D(() => {
|
|
1804
|
-
|
|
1805
|
-
}, []), onKeyboardEvent: Ne, onPointerEvent: He, onKeyboardEventNative: Ve, onPointerEventNative: Y, isEditing:
|
|
1806
|
-
},
|
|
1807
|
-
const
|
|
1808
|
-
|
|
1809
|
-
}, be = D((S,
|
|
1833
|
+
ne({ eventType: "cancel" });
|
|
1834
|
+
}, []), onKeyboardEvent: Ne, onPointerEvent: He, onKeyboardEventNative: Ve, onPointerEventNative: Y, isEditing: Q };
|
|
1835
|
+
}, gs = ({ gridRef: e, gridMainRef: t, orientation: n = an, headerCount: o, selectionPolicy: r = "multiple", newSelectionMode: i = "clear", alwaysScrollToActiveCoords: l = !0, onDragStart: s, onDragEnd: a, pointerDownInterceptor: d, pointerMoveInterceptor: g, onPointerUp: m, newSelection: u, modifySelection: x, appendSelection: M, clearSelections: E }) => {
|
|
1836
|
+
const P = o ?? ((n === an ? e.current?.rowCount : e.current?.columnCount) || 0), Q = G(null), k = G(null), I = G(!1), z = G(null), se = D((S) => n === Nt ? { rowIndex: 0, colIndex: S.colIndex } : { rowIndex: S.rowIndex, colIndex: 0 }, [n]), B = D((S) => n === Nt ? { rowIndex: t.current ? t.current.rowCount - 1 : 0, colIndex: S.colIndex } : { rowIndex: S.rowIndex, colIndex: t.current ? t.current.columnCount - 1 : 0 }, [n]), re = (S) => {
|
|
1837
|
+
k.current = B(S), x(k.current, Q.current);
|
|
1838
|
+
}, be = D((S, f) => {
|
|
1810
1839
|
if (!e.current) return;
|
|
1811
|
-
const J = e.current.getViewFromClient(S,
|
|
1840
|
+
const J = e.current.getViewFromClient(S, f)?.getCellCoordsFromClient(S, f);
|
|
1812
1841
|
return J ? (n === Nt ? J.rowIndex = t.current.getViewport().rowStart : J.colIndex = t.current.getViewport().colStart, J) : void 0;
|
|
1813
|
-
}, []), N = D((S,
|
|
1842
|
+
}, []), N = D((S, f = !1) => {
|
|
1814
1843
|
let J = S;
|
|
1815
|
-
return
|
|
1816
|
-
}, [n]), H =
|
|
1844
|
+
return f || (J = { ...S }, n === an ? delete J.colIndex : delete J.rowIndex), t.current?.scrollCellCoordsIntoView(J);
|
|
1845
|
+
}, [n]), H = R(a, [a]), X = R(s, [s]), T = Ee(() => ({ onPointerDown: (S) => {
|
|
1817
1846
|
if (!e || !e.current || S.nativeEvent.defaultPrevented) return;
|
|
1818
|
-
const
|
|
1819
|
-
if (!
|
|
1847
|
+
const f = be(S.nativeEvent.clientX, S.nativeEvent.clientY);
|
|
1848
|
+
if (!f) return;
|
|
1820
1849
|
S.nativeEvent.which;
|
|
1821
1850
|
const J = S.nativeEvent.shiftKey, K = S.nativeEvent.ctrlKey || S.nativeEvent.metaKey;
|
|
1822
|
-
if (d?.(S,
|
|
1851
|
+
if (d?.(S, f) === !1) return;
|
|
1823
1852
|
X?.(), I.current = !0;
|
|
1824
|
-
const L = t.current?.getViewFromClient(S.nativeEvent.clientX, S.nativeEvent.clientY), U = ((
|
|
1825
|
-
if (J)
|
|
1853
|
+
const L = t.current?.getViewFromClient(S.nativeEvent.clientX, S.nativeEvent.clientY), U = ((te, ne) => n === Nt ? { ...te, rowIndex: ne.rowStart } : { ...te, colIndex: ne.colStart })(f, L.getVisibleRangeCoords());
|
|
1854
|
+
if (J) re(f);
|
|
1826
1855
|
else {
|
|
1827
|
-
if (K) return ((
|
|
1828
|
-
|
|
1829
|
-
})(
|
|
1830
|
-
((
|
|
1831
|
-
|
|
1832
|
-
})(
|
|
1856
|
+
if (K) return ((te, ne = te, Y) => {
|
|
1857
|
+
Q.current = se(te), k.current = B(ne), M(Q.current, k.current, Y);
|
|
1858
|
+
})(f, f, U), void (l && N(U, !0));
|
|
1859
|
+
((te, ne = te, Y) => {
|
|
1860
|
+
Q.current = se(te), k.current = B(ne), u(Q.current, k.current, Y);
|
|
1861
|
+
})(f, f, U), re(f), l && N(U, !0);
|
|
1833
1862
|
}
|
|
1834
1863
|
}, onPointerMoveOrWait: Ct.throttle((S) => {
|
|
1835
1864
|
if (!I.current || !e?.current) return;
|
|
1836
|
-
const
|
|
1837
|
-
if (
|
|
1838
|
-
if (Z.isEqualCells(z.current,
|
|
1839
|
-
|
|
1865
|
+
const f = be(S.clientX, S.clientY);
|
|
1866
|
+
if (f && g?.(S, f) !== !1) {
|
|
1867
|
+
if (Z.isEqualCells(z.current, f)) return E();
|
|
1868
|
+
re(f), N(f);
|
|
1840
1869
|
}
|
|
1841
1870
|
}, 60), onPointerUp: (S) => {
|
|
1842
1871
|
I.current = !1, H?.(), m?.(S);
|
|
1843
|
-
}, processTouch: !0, consumeTouch: !0 }), [r, l,
|
|
1844
|
-
return { onPointerDown:
|
|
1872
|
+
}, processTouch: !0, consumeTouch: !0 }), [r, l, P, i, E, d, m]);
|
|
1873
|
+
return { onPointerDown: R(On(T), []), getCellCoordsFromClient: be };
|
|
1845
1874
|
}, qe = (e, t, n) => {
|
|
1846
1875
|
if (!e) return t;
|
|
1847
1876
|
let o = t;
|
|
@@ -1859,7 +1888,7 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1859
1888
|
i === 0 ? (o.push(r), r++) : r += i;
|
|
1860
1889
|
}
|
|
1861
1890
|
return o;
|
|
1862
|
-
},
|
|
1891
|
+
}, Hl = (e, t, n, o, r, i) => {
|
|
1863
1892
|
if (!t) return i;
|
|
1864
1893
|
let { rowIndex: l, colIndex: s } = e;
|
|
1865
1894
|
switch (o) {
|
|
@@ -1890,7 +1919,7 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1890
1919
|
default:
|
|
1891
1920
|
return i;
|
|
1892
1921
|
}
|
|
1893
|
-
},
|
|
1922
|
+
}, Nl = (e, t = () => !0, n, o, r, i) => {
|
|
1894
1923
|
let { rowIndex: l, colIndex: s } = e;
|
|
1895
1924
|
switch (o) {
|
|
1896
1925
|
case lt: {
|
|
@@ -1920,13 +1949,13 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1920
1949
|
default:
|
|
1921
1950
|
return null;
|
|
1922
1951
|
}
|
|
1923
|
-
},
|
|
1952
|
+
}, Ul = (e, t, n, o, r, i) => {
|
|
1924
1953
|
if (!t) return i;
|
|
1925
1954
|
let l, { rowIndex: s, colIndex: a } = e;
|
|
1926
1955
|
o === lt ? l = { rowIndex: s + 1, colIndex: a } : o === it ? l = { rowIndex: s - 1, colIndex: a } : o === Ke ? l = { rowIndex: s, colIndex: a + 1 } : o === ot && (l = { rowIndex: s, colIndex: a - 1 });
|
|
1927
1956
|
const d = t(e), g = t(l);
|
|
1928
|
-
var m,
|
|
1929
|
-
return (
|
|
1957
|
+
var m, u;
|
|
1958
|
+
return (u = g, !(m = d) && !u || !m && u || m && !u ? Hl : Nl)(e, t, n, o, !1, i) ?? i;
|
|
1930
1959
|
}, Dr = (e, t) => `${e}:${t}`, zr = (e, t, n, o, r, i) => {
|
|
1931
1960
|
if (n - t >= r - o) return o;
|
|
1932
1961
|
let l = o;
|
|
@@ -1949,8 +1978,8 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1949
1978
|
case it:
|
|
1950
1979
|
s.rowIndex = qe(o, s.rowIndex - 1, t);
|
|
1951
1980
|
}
|
|
1952
|
-
const d = (
|
|
1953
|
-
if (
|
|
1981
|
+
const d = (u) => {
|
|
1982
|
+
if (u) {
|
|
1954
1983
|
a = e.rangeIndex >= e.ranges.length - 1 ? 0 : e.rangeIndex + 1;
|
|
1955
1984
|
const x = e.ranges[a];
|
|
1956
1985
|
s = { colIndex: x.colStart, rowIndex: x.rowStart };
|
|
@@ -1965,26 +1994,26 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1965
1994
|
else if (t === lt && s.colIndex === l.colEnd && s.rowIndex > l.rowEnd) d(!0);
|
|
1966
1995
|
else if (t === it && s.colIndex === l.colStart && s.rowIndex < l.rowStart) d(!1);
|
|
1967
1996
|
else {
|
|
1968
|
-
let
|
|
1997
|
+
let u = s.rowIndex, x = s.colIndex;
|
|
1969
1998
|
switch (t) {
|
|
1970
1999
|
case Ke:
|
|
1971
|
-
x > l.colEnd && (
|
|
2000
|
+
x > l.colEnd && (u = qe(o, u + 1, t), x = l.colStart, u > l.rowEnd && (u = l.rowStart));
|
|
1972
2001
|
break;
|
|
1973
2002
|
case ot:
|
|
1974
|
-
x < l.colStart && (
|
|
2003
|
+
x < l.colStart && (u = qe(o, u - 1, t), x = l.colEnd, u < l.rowStart && (u = l.rowEnd));
|
|
1975
2004
|
break;
|
|
1976
2005
|
case lt:
|
|
1977
|
-
|
|
2006
|
+
u > l.rowEnd && (x = qe(r, x + 1, t), u = l.rowStart, x > l.colEnd && (x = l.colStart));
|
|
1978
2007
|
break;
|
|
1979
2008
|
case it:
|
|
1980
|
-
|
|
2009
|
+
u < l.rowStart && (x = qe(r, x - 1, t), u = l.rowEnd, x < l.colStart && (x = l.colEnd));
|
|
1981
2010
|
}
|
|
1982
|
-
s = { rowIndex:
|
|
2011
|
+
s = { rowIndex: u, colIndex: x };
|
|
1983
2012
|
}
|
|
1984
2013
|
let g = n(s);
|
|
1985
2014
|
if (!Z.isRangeWithinRange(g, l)) {
|
|
1986
|
-
const
|
|
1987
|
-
|
|
2015
|
+
const u = Z.intersectRanges(g, l);
|
|
2016
|
+
u && (g = u);
|
|
1988
2017
|
}
|
|
1989
2018
|
let m = { rowStart: qe(o, g.rowStart, lt), colStart: qe(r, g.colStart, Ke), rowEnd: qe(o, g.rowEnd, it), colEnd: qe(r, g.colEnd, ot) };
|
|
1990
2019
|
if (m.rowStart !== s.rowIndex || m.colStart !== s.colIndex) {
|
|
@@ -2029,95 +2058,95 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
2029
2058
|
}, Fr = (e, t, n) => {
|
|
2030
2059
|
const o = e.getColOffset(t.colStart) + (n?.left ?? 0), r = e.getRowOffset(t.rowStart) + (n?.top ?? 0);
|
|
2031
2060
|
return { x: o, y: r, width: e.getColOffset(t.colEnd + 1) + (n?.right ?? 0) - (n?.left ?? 0) - o, height: e.getRowOffset(t.rowEnd + 1) + (n?.bottom ?? 0) - (n?.top ?? 0) - r };
|
|
2032
|
-
},
|
|
2061
|
+
}, Kl = (e, t, n) => !!n && !(e < n.x || e > n.x + n.width) && !(t < n.y || t > n.y + n.height), $o = (e, t = !0) => `M ${we.boundPixel(e.left)} ${we.boundPixel(e.top)} L ${we.boundPixel(e.right, !0)} ${we.boundPixel(e.top)} L ${we.boundPixel(e.right, !0)} ${we.boundPixel(e.bottom, !0)} L ${we.boundPixel(e.left)} ${we.boundPixel(e.bottom, !0)} L ${we.boundPixel(e.left)} ${we.boundPixel(e.top)} ${t ? "Z" : ""}`, jr = (e) => {
|
|
2033
2062
|
const { linePoints: t, bounds: n, pathProps: o, style: r, ...i } = e;
|
|
2034
2063
|
return q("svg", { width: `${we.boundPixel(n.width, !0)}`, height: `${we.boundPixel(n.height, !0)}`, viewBox: `0 0 ${we.boundPixel(n.width, !0)} ${we.boundPixel(n.height, !0)}`, style: { position: "absolute", left: `${we.boundPixel(n.x)}px`, top: `${we.boundPixel(n.y)}px`, width: `${we.boundPixel(n.width, !0)}px`, height: `${we.boundPixel(n.height, !0)}px`, pointerEvents: "none", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top, width, height", willChange: "left, top, width, height, stroke-dashoffset", ...r }, ...i, children: q("path", { d: `M ${we.boundPixel(t[0])} ${we.boundPixel(t[1])} L ${we.boundPixel(t[2])} ${we.boundPixel(t[3])}`, fill: "none", vectorEffect: "non-scaling-stroke", stroke: "black", ...o }) });
|
|
2035
|
-
},
|
|
2036
|
-
const { x: t = 0, y: n = 0, width: o = 0, height: r = 0, fill: i, stroke: l, strokeWidth: s = 0, strokeDasharray: a, strokeDashoffset: d, clipPath: g, pathBounds: m, pathProps:
|
|
2064
|
+
}, ql = (e) => {
|
|
2065
|
+
const { x: t = 0, y: n = 0, width: o = 0, height: r = 0, fill: i, stroke: l, strokeWidth: s = 0, strokeDasharray: a, strokeDashoffset: d, clipPath: g, pathBounds: m, pathProps: u, style: x, ...M } = e, E = n, P = t, Q = o, k = r;
|
|
2037
2066
|
let I = null;
|
|
2038
2067
|
if (i) {
|
|
2039
|
-
let z = $o({ top: 0, left: 0, bottom:
|
|
2040
|
-
m && (z = z + " " + $o({ top: m.y -
|
|
2068
|
+
let z = $o({ top: 0, left: 0, bottom: k, right: Q });
|
|
2069
|
+
m && (z = z + " " + $o({ top: m.y - E, left: m.x - P, bottom: m.height + m.y - E, right: m.width + m.x - P })), I = [q("path", { d: z, fill: i, stroke: "none", fillRule: "evenodd" }, "fill")];
|
|
2041
2070
|
}
|
|
2042
|
-
return Ht("svg", { width: `${we.boundPixel(o, !0)}`, height: `${we.boundPixel(r, !0)}`, viewBox: `0 0 ${we.boundPixel(o, !0)} ${we.boundPixel(r, !0)}`, preserveAspectRatio: "none", style: { position: "absolute", left: `${we.boundPixel(t)}px`, top: `${we.boundPixel(n)}px`, pointerEvents: "none", transitionDuration: "0ms", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top, width, height", willChange: "left, top, width, height, stroke-dashoffset", boxShadow: "rgb(60 64 67 / 5%) 0px 1px 4px 2px, rgb(255 255 255 / 15%) 0px 0px 2px 1px", overflow: "visible", ...x }, ...
|
|
2043
|
-
},
|
|
2071
|
+
return Ht("svg", { width: `${we.boundPixel(o, !0)}`, height: `${we.boundPixel(r, !0)}`, viewBox: `0 0 ${we.boundPixel(o, !0)} ${we.boundPixel(r, !0)}`, preserveAspectRatio: "none", style: { position: "absolute", left: `${we.boundPixel(t)}px`, top: `${we.boundPixel(n)}px`, pointerEvents: "none", transitionDuration: "0ms", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top, width, height", willChange: "left, top, width, height, stroke-dashoffset", boxShadow: "rgb(60 64 67 / 5%) 0px 1px 4px 2px, rgb(255 255 255 / 15%) 0px 0px 2px 1px", overflow: "visible", ...x }, ...M, children: [I, q("path", { d: $o({ top: 0, left: 0, right: Q, bottom: k }), fill: "none", strokeDasharray: a, strokeDashoffset: d, stroke: l, vectorEffect: "non-scaling-stroke", strokeWidth: s, ...u })] });
|
|
2072
|
+
}, Yl = (e) => {
|
|
2044
2073
|
const { key: t, ...n } = e;
|
|
2045
|
-
return q(
|
|
2046
|
-
},
|
|
2047
|
-
const { stroke: t, fill: n, x: o = 0, y: r = 0, width: i = 0, height: l = 0, style: s, isAnimatedStroke: a, animatedStrokeProps: d, range: g, cell: m, ...
|
|
2048
|
-
let
|
|
2049
|
-
const
|
|
2074
|
+
return q(Ii, { ...n }, t);
|
|
2075
|
+
}, Ii = At((e) => {
|
|
2076
|
+
const { stroke: t, fill: n, x: o = 0, y: r = 0, width: i = 0, height: l = 0, style: s, isAnimatedStroke: a, animatedStrokeProps: d, range: g, cell: m, ...u } = e, x = a || !!d, M = { name: "walking-offset", dashGap: 2, speed: 50, dashLength: 8, ...d };
|
|
2077
|
+
let E = M.dashGap + M.dashLength;
|
|
2078
|
+
const P = M.speed * E, Q = Al().replaceAll(":", ""), k = `${M.name}-${Q}`;
|
|
2050
2079
|
let I;
|
|
2051
2080
|
return st(() => {
|
|
2052
2081
|
if (!x) return;
|
|
2053
|
-
const z = `@keyframes ${
|
|
2082
|
+
const z = `@keyframes ${k} {
|
|
2054
2083
|
to {
|
|
2055
2084
|
stroke-dashoffset: 0px;
|
|
2056
2085
|
}
|
|
2057
|
-
}`,
|
|
2058
|
-
return
|
|
2059
|
-
document.head.removeChild(
|
|
2086
|
+
}`, se = document.createElement("style");
|
|
2087
|
+
return se.appendChild(document.createTextNode(z)), document.head.appendChild(se), se.sheet.insertRule(z, 0), () => {
|
|
2088
|
+
document.head.removeChild(se);
|
|
2060
2089
|
};
|
|
2061
|
-
}, [x]), x && (I = { strokeDasharray: `${
|
|
2090
|
+
}, [x]), x && (I = { strokeDasharray: `${M.dashLength}px ${M.dashGap}px`, strokeDashoffset: `${E}px`, animation: `${k} ${P}ms linear infinite`, willChange: "stroke-dashoffset" }), q(ql, { x: o, y: r, width: i, height: l, stroke: t, fill: n, shapeRendering: "crispEdges", style: { ...I, ...s }, ...u });
|
|
2062
2091
|
});
|
|
2063
|
-
function
|
|
2092
|
+
function Ci(e) {
|
|
2064
2093
|
var t, n, o = "";
|
|
2065
2094
|
if (typeof e == "string" || typeof e == "number") o += e;
|
|
2066
2095
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
2067
2096
|
var r = e.length;
|
|
2068
|
-
for (t = 0; t < r; t++) e[t] && (n =
|
|
2097
|
+
for (t = 0; t < r; t++) e[t] && (n = Ci(e[t])) && (o && (o += " "), o += n);
|
|
2069
2098
|
} else for (n in e) e[n] && (o && (o += " "), o += n);
|
|
2070
2099
|
return o;
|
|
2071
2100
|
}
|
|
2072
|
-
function
|
|
2073
|
-
for (var e, t, n = 0, o = "", r = arguments.length; n < r; n++) (e = arguments[n]) && (t =
|
|
2101
|
+
function _n() {
|
|
2102
|
+
for (var e, t, n = 0, o = "", r = arguments.length; n < r; n++) (e = arguments[n]) && (t = Ci(e)) && (o && (o += " "), o += t);
|
|
2074
2103
|
return o;
|
|
2075
2104
|
}
|
|
2076
|
-
|
|
2077
|
-
const
|
|
2105
|
+
Ii.displayName = "Selection";
|
|
2106
|
+
const Mi = At(Ut((e, t) => {
|
|
2078
2107
|
const { x: n = 0, y: o = 0, borderWidth: r = 1, size: i = 6, borderStroke: l, corner: s, style: a, className: d, background: g, ...m } = e;
|
|
2079
2108
|
if (n === 0 || o === 0) return null;
|
|
2080
|
-
let
|
|
2109
|
+
let u = !0, x = !0, M = !0, E = !0;
|
|
2081
2110
|
switch (s) {
|
|
2082
2111
|
case "tl":
|
|
2083
|
-
|
|
2112
|
+
u = !1, x = !1;
|
|
2084
2113
|
break;
|
|
2085
2114
|
case "bl":
|
|
2086
|
-
|
|
2115
|
+
u = !1, E = !1;
|
|
2087
2116
|
break;
|
|
2088
2117
|
case "br":
|
|
2089
|
-
|
|
2118
|
+
M = !1, E = !1;
|
|
2090
2119
|
break;
|
|
2091
2120
|
case "tr":
|
|
2092
|
-
x = !1,
|
|
2121
|
+
x = !1, M = !1;
|
|
2093
2122
|
}
|
|
2094
|
-
return q("div", { className:
|
|
2123
|
+
return q("div", { className: _n("fill-handle", d), style: { position: "absolute", left: n - (i + (u ? r : 0)) / 2, top: o - (i + (x ? r : 0)) / 2, width: i, height: i, borderLeft: u ? `${r}px ${l}` : void 0, borderTop: x ? `${r}px ${l}` : void 0, borderRight: M ? `${r}px ${l}` : void 0, borderBottom: E ? `${r}px ${l}` : void 0, background: g, cursor: "crosshair", pointerEvents: "all", transitionDuration: "0ms", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top", willChange: "left, top", ...a }, tabIndex: -1, ...m });
|
|
2095
2124
|
}));
|
|
2096
|
-
|
|
2097
|
-
var
|
|
2098
|
-
},
|
|
2099
|
-
const
|
|
2100
|
-
var e = Ze(null), t = e[0], n = e[1], o = Ze(Vr), r = o[0], i = o[1], l =
|
|
2125
|
+
Mi.displayName = "FillHandle";
|
|
2126
|
+
var Xl = function() {
|
|
2127
|
+
}, Ti = typeof window < "u", Gl = Ti ? tn : st, Vr = { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 };
|
|
2128
|
+
const Ri = Ti && window.ResizeObserver !== void 0 ? function() {
|
|
2129
|
+
var e = Ze(null), t = e[0], n = e[1], o = Ze(Vr), r = o[0], i = o[1], l = Ee(function() {
|
|
2101
2130
|
return new window.ResizeObserver(function(s) {
|
|
2102
2131
|
if (s[0]) {
|
|
2103
|
-
var a = s[0].contentRect, d = a.x, g = a.y, m = a.width,
|
|
2104
|
-
i({ x: d, y: g, width: m, height:
|
|
2132
|
+
var a = s[0].contentRect, d = a.x, g = a.y, m = a.width, u = a.height, x = a.top, M = a.left, E = a.bottom, P = a.right;
|
|
2133
|
+
i({ x: d, y: g, width: m, height: u, top: x, left: M, bottom: E, right: P });
|
|
2105
2134
|
}
|
|
2106
2135
|
});
|
|
2107
2136
|
}, []);
|
|
2108
|
-
return
|
|
2137
|
+
return Gl(function() {
|
|
2109
2138
|
if (t) return l.observe(t), function() {
|
|
2110
2139
|
l.disconnect();
|
|
2111
2140
|
};
|
|
2112
2141
|
}, [t]), [n, r];
|
|
2113
2142
|
} : function() {
|
|
2114
|
-
return [
|
|
2143
|
+
return [Xl, Vr];
|
|
2115
2144
|
};
|
|
2116
2145
|
function Bo(e, t) {
|
|
2117
2146
|
if (typeof e == "function") return e(t);
|
|
2118
2147
|
e && (e.current = t);
|
|
2119
2148
|
}
|
|
2120
|
-
var
|
|
2149
|
+
var Zl = parseInt(Kr.split(".")[0], 10) >= 19 ? function(e) {
|
|
2121
2150
|
return (t) => {
|
|
2122
2151
|
const n = [];
|
|
2123
2152
|
for (const o of e) {
|
|
@@ -2134,7 +2163,7 @@ var Jl = parseInt(Kr.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
2134
2163
|
};
|
|
2135
2164
|
};
|
|
2136
2165
|
const Go = At(Ut((e, t) => {
|
|
2137
|
-
const { range: n, view: o, anchor: r, borderStroke: i = "rgb(33, 115, 70)", background: l = "white", borderWidth: s = 1.5, size: a = 22, style: d, className: g, selectionTouchPointerHandler: m, onTouchSelectStart:
|
|
2166
|
+
const { range: n, view: o, anchor: r, borderStroke: i = "rgb(33, 115, 70)", background: l = "white", borderWidth: s = 1.5, size: a = 22, style: d, className: g, selectionTouchPointerHandler: m, onTouchSelectStart: u, onTouchSelectEnd: x, currentTouchAnchor: M, scrollableElement: E, scrollableRoot: P = document.body, ...Q } = e, k = R(u, [u]), I = R(x, [x]), { bounds: z, coordsPivot: se, key: B } = Ee(() => {
|
|
2138
2167
|
if (!n || !o) return null;
|
|
2139
2168
|
let K = null, L = null;
|
|
2140
2169
|
switch (r) {
|
|
@@ -2155,7 +2184,7 @@ const Go = At(Ut((e, t) => {
|
|
|
2155
2184
|
K = { colIndex: n.colStart, rowIndex: n.rowEnd };
|
|
2156
2185
|
}
|
|
2157
2186
|
let U = o.getRangeCoordsBounds(L ? { rowStart: L.rowIndex, colStart: L.colIndex, rowEnd: L.rowIndex, colEnd: L.colIndex } : n);
|
|
2158
|
-
const
|
|
2187
|
+
const te = o.getBounds(), ne = o.getViewportSize(), Y = te.x, He = te.y, Ve = ne.width, Ne = ne.height;
|
|
2159
2188
|
switch (r) {
|
|
2160
2189
|
case "tl":
|
|
2161
2190
|
break;
|
|
@@ -2176,307 +2205,307 @@ const Go = At(Ut((e, t) => {
|
|
|
2176
2205
|
}
|
|
2177
2206
|
const at = o.toClipBounds(U, 0);
|
|
2178
2207
|
return !at || at.width <= 0 || at.height <= 0 || U.x < 0 || U.y < 0 || U.x > Ve || U.y > Ne ? { bounds: null, coordsAnchor: null, coordsPivot: null, key: null } : { bounds: U, coordsAnchor: null, coordsPivot: K, key: "touchSelect-" + o.getAnchor() + "-" + r };
|
|
2179
|
-
}, [n, o, r]),
|
|
2208
|
+
}, [n, o, r]), re = G(null), be = On(Ee(() => {
|
|
2180
2209
|
const K = (L) => r === "t" || r === "b" ? { ...L, colIndex: void 0 } : r === "l" || r === "r" ? { ...L, rowIndex: void 0 } : L;
|
|
2181
2210
|
return { processTouch: !0, consumeTouch: !0, onPointerDown: (L, U) => {
|
|
2182
|
-
const ee = K(o.getCellCoordsFromClient(L.clientX, L.clientY));
|
|
2183
|
-
return oe.current = { coordsPivot: le }, P?.(r), m.onSelectionPointerDown(L, U, o, ee, le, !1, !0);
|
|
2184
|
-
}, onPointerMoveOrWait: (L, U, ee) => {
|
|
2185
2211
|
const te = K(o.getCellCoordsFromClient(L.clientX, L.clientY));
|
|
2186
|
-
return m.
|
|
2187
|
-
},
|
|
2188
|
-
|
|
2212
|
+
return re.current = { coordsPivot: se }, k?.(r), m.onSelectionPointerDown(L, U, o, te, se, !1, !0);
|
|
2213
|
+
}, onPointerMoveOrWait: (L, U, te) => {
|
|
2214
|
+
const ne = K(o.getCellCoordsFromClient(L.clientX, L.clientY));
|
|
2215
|
+
return m.onSelectionPointerMoveOrWait(L, U, te, o, ne, re.current?.coordsPivot, !0, !0);
|
|
2216
|
+
}, onPointerUp: (L, U, te) => (re.current = null, I?.(r), m.onPointerUp(L, U, te)) };
|
|
2217
|
+
}, [m, n, o, r])), [N, { y: H, x: X }] = Ri(), T = G(null), { getPortalContainer: S } = vi(), [f, J] = Ze(null);
|
|
2189
2218
|
return st(() => {
|
|
2190
2219
|
const K = T.current?.getBoundingClientRect();
|
|
2191
2220
|
if (!K || !z) return void J(null);
|
|
2192
|
-
let L = 0, U = 0,
|
|
2193
|
-
for (;
|
|
2194
|
-
J(qr(q("div", { className:
|
|
2195
|
-
}, [H, X, z?.x, z?.y, z?.width, z?.height, g,
|
|
2221
|
+
let L = 0, U = 0, te = E;
|
|
2222
|
+
for (; te; ) L += te.scrollLeft, U += te.scrollTop, te = P && te === P.parentElement ? null : te.parentElement;
|
|
2223
|
+
J(qr(q("div", { className: _n("touch-select-handle", g), ref: t, style: { position: "absolute", left: L + (K?.x ?? 0) - (a + s) / 2, top: U + (K?.y ?? 0) - (a + s) / 2, width: a, height: a, borderWidth: `${s}px`, border: i, borderRadius: "50%", background: l, boxShadow: `0 0 0 1.5px ${l}`, cursor: "grab", pointerEvents: "all", opacity: M ? 0 : 1, transitionDuration: "160ms", transitionProperty: "opacity", ...d }, tabIndex: -1, onPointerDown: be, ...Q }), P ?? S(), B));
|
|
2224
|
+
}, [H, X, z?.x, z?.y, z?.width, z?.height, g, M, l, a, s, i, E]), z ? Ht(wn, { children: [q("div", { ref: Zl([N, T]), style: { position: "absolute", left: z.x, top: z.y, opacity: 0 } }), f] }) : null;
|
|
2196
2225
|
}));
|
|
2197
2226
|
Go.displayName = "TouchSelectHandle";
|
|
2198
|
-
const en = -10,
|
|
2227
|
+
const en = -10, Jl = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd: 0 }), ki = Object.freeze({ colIndex: 0, rowIndex: 0 }), Zo = Object.freeze([]), Yt = (e) => {
|
|
2199
2228
|
if (e && e.cell && e.ranges && e.rangeIndex > -1 && e.rangeIndex <= e.ranges.length) return e;
|
|
2200
2229
|
const t = { cell: null, ranges: e?.ranges ?? Zo };
|
|
2201
|
-
return t.rangeIndex = e?.rangeIndex ?? t.ranges.length - 1, t.cell = e?.cell, !t.cell && t.ranges.length > 0 && (t.cell = { rowIndex: t.ranges[t.rangeIndex].rowStart, colIndex: t.ranges[t.rangeIndex].colStart }), t.cell || (t.cell =
|
|
2230
|
+
return t.rangeIndex = e?.rangeIndex ?? t.ranges.length - 1, t.cell = e?.cell, !t.cell && t.ranges.length > 0 && (t.cell = { rowIndex: t.ranges[t.rangeIndex].rowStart, colIndex: t.ranges[t.rangeIndex].colStart }), t.cell || (t.cell = ki), Z.isEqualSelectionCoords(t, e) ? e : t;
|
|
2202
2231
|
}, lo = (e, t, n) => {
|
|
2203
2232
|
const o = e.getVisibleRangeCoords(), r = e.getScrollOrientation();
|
|
2204
2233
|
!r.horizontal && (t.colIndex > o.colEnd || t.colIndex < o.colStart) && (t = { ...t, colIndex: t.colIndex > o.colEnd ? o.colEnd + 1 : o.colEnd - 1 }, e = n.current.getViewFromLocation(Xt)), !r.vertical && (t.rowIndex > o.rowEnd || t.rowIndex < o.rowStart) && (t = { ...t, rowIndex: t.rowIndex > o.rowEnd ? o.rowEnd + 1 : o.rowEnd - 1 }, e = n.current.getViewFromLocation(Xt)), e.scrollCellCoordsIntoView(t);
|
|
2205
|
-
},
|
|
2206
|
-
const Se = D(() => ({ top: B?.top ?? 0, left: B?.left ?? 0, bottom: e.current?.rowCount - 1 || 0, right: e.current?.columnCount - 1 || 0 }), []), Ye =
|
|
2234
|
+
}, Ql = () => !1, ws = ({ gridRef: e, commands: t, layout: n, selection: o, onSelectionChange: r, onSelectionDragStart: i, onSelectionDragEnd: l, selectionPolicy: s = "multiple", newSelectionMode: a = "clear", allowDeselectSelection: d = !0, onFillPreview: g, onFillCancel: m, onFillDone: u, onFill: x, disableFillDrag: M = !x, fillHandleBorderColor: E = "white", hiddenRowsAt: P, hiddenColumnsAt: Q, isContentfulCell: k, contentfulCellFinder: I = Ul, getDataCoords: z, alwaysScrollToActiveCoords: se = !1, selectionBounds: B, pointerDownInterceptor: re, pointerMoveInterceptor: be, mergedRanges: N, canSelectionSpanMergedCells: H = Ql, onMoveDragStart: X, onMoveDragUpdate: T, onMoveDragEnd: S, onMoveDragDone: f, selectionRenderer: J = Yl, disableMoveDrag: K = !S, getCellCoordsAsRangeCoords: L = Z.cellToRange, moveDragHitSize: U = 6, moveDragOutlineSize: te = 4, selectionBackgroundColor: ne = "rgba(16, 124, 65, 0.1)", selectionBorderColor: Y = "rgb(33, 115, 70)", selectionRemoveBorderColor: He = "rgb(255, 0, 0)", selectionRemoveBackgroundColor: Ve = "rgba(250, 10, 10, 0.1)", disableTouchSelection: Ne = !1, touchSelectHandleProps: at }) => {
|
|
2235
|
+
const Se = D(() => ({ top: B?.top ?? 0, left: B?.left ?? 0, bottom: e.current?.rowCount - 1 || 0, right: e.current?.columnCount - 1 || 0 }), []), Ye = R(x, [x]), $ = R(g, [g]), _ = R(m, [m]), Me = R(u, [u]), ue = R(k, [k]), me = R(J, [J]), $e = R((c, h = !1) => go(c, h, n.getRowOffset, h ? Se().bottom : Se().top), [n?.getRowOffset]), dt = R(P ?? $e, [P]), kt = R((c, h = !1) => go(c, h, n.getColOffset, h ? Se().right : Se().left), [n?.getColOffset]), ut = R(Q ?? kt, [Q]), [Zt, St] = Ze(() => Yt(o)), C = Ee(() => Yt(Zt), [Zt]), ye = G(C), Je = G(!0);
|
|
2207
2236
|
tn(Ct.throttle(() => {
|
|
2208
2237
|
St((c) => {
|
|
2209
2238
|
Je.current = !0;
|
|
2210
|
-
const
|
|
2211
|
-
return Z.isEqualSelectionCoords(
|
|
2239
|
+
const h = Yt(o);
|
|
2240
|
+
return Z.isEqualSelectionCoords(h, c) ? c : h;
|
|
2212
2241
|
});
|
|
2213
2242
|
}, 0), [o]), tn(() => {
|
|
2214
|
-
|
|
2243
|
+
ye.current = C;
|
|
2215
2244
|
}, [C]), st(() => {
|
|
2216
2245
|
Je.current || !r || Z.isEqualSelectionCoords(o, C) || r(C);
|
|
2217
2246
|
}, [C]);
|
|
2218
2247
|
const mt = D((c) => {
|
|
2219
|
-
St((
|
|
2220
|
-
Je.current = !1,
|
|
2221
|
-
let w = typeof c == "function" ? c(
|
|
2222
|
-
if (Z.isEqualRangesArrays(w,
|
|
2223
|
-
let p = Math.max(w.length ? 0 : -1, Math.min(
|
|
2224
|
-
p === -1 || Z.isCellWithinRange(
|
|
2225
|
-
const W = { cell:
|
|
2226
|
-
return Z.isEqualSelectionCoords(W,
|
|
2248
|
+
St((h) => {
|
|
2249
|
+
Je.current = !1, h = Yt(h);
|
|
2250
|
+
let w = typeof c == "function" ? c(h.ranges) : c ?? Zo;
|
|
2251
|
+
if (Z.isEqualRangesArrays(w, h.ranges)) return h;
|
|
2252
|
+
let p = Math.max(w.length ? 0 : -1, Math.min(h.rangeIndex, w.length - 1)), v = h.cell;
|
|
2253
|
+
p === -1 || Z.isCellWithinRange(v, w[p]) || (v = { rowIndex: w[p].rowStart, colIndex: w[p].colStart }), w.length === 1 && Z.isSingleCell(w[0]) && Z.isCellWithinRange(v, w[0]) && (w = [], p = -1);
|
|
2254
|
+
const W = { cell: v, ranges: w, rangeIndex: p };
|
|
2255
|
+
return Z.isEqualSelectionCoords(W, h) ? h : W;
|
|
2227
2256
|
});
|
|
2228
|
-
}, []), Qe =
|
|
2229
|
-
St((
|
|
2230
|
-
Je.current = !1,
|
|
2231
|
-
const w = c ??
|
|
2232
|
-
if (!Z.isSingleCell(p) &&
|
|
2233
|
-
if (Z.isEqualCells(w,
|
|
2234
|
-
let
|
|
2235
|
-
|
|
2236
|
-
const b = { ranges:
|
|
2237
|
-
return Z.isEqualSelectionCoords(b,
|
|
2257
|
+
}, []), Qe = R((c) => {
|
|
2258
|
+
St((h) => {
|
|
2259
|
+
Je.current = !1, h = Yt(h);
|
|
2260
|
+
const w = c ?? ki, p = L(w);
|
|
2261
|
+
if (!Z.isSingleCell(p) && h.ranges.length === 0) return { ranges: [p], rangeIndex: 0, cell: w };
|
|
2262
|
+
if (Z.isEqualCells(w, h.cell)) return h;
|
|
2263
|
+
let v = h.ranges, W = h.rangeIndex;
|
|
2264
|
+
h.ranges.length === 1 && (Z.isSingleCell(h.ranges[0]) && Z.isCellWithinRange(w, h.ranges[0]) || !Z.isCellWithinRange(w, h.ranges[0])) && (v = [], W = -1);
|
|
2265
|
+
const b = { ranges: v, rangeIndex: W, cell: w };
|
|
2266
|
+
return Z.isEqualSelectionCoords(b, h) ? h : b;
|
|
2238
2267
|
});
|
|
2239
|
-
}, [L]), [cn, on] = Ze(null), [Mt, dn] = Ze(null), nn = G(null), [De, Kt] = Ze(null), xt = G(null), Vt = G(null), [Cn, un] = Ze(null), We = G(null),
|
|
2268
|
+
}, [L]), [cn, on] = Ze(null), [Mt, dn] = Ze(null), nn = G(null), [De, Kt] = Ze(null), xt = G(null), Vt = G(null), [Cn, un] = Ze(null), We = G(null), ee = G(null), et = G(N);
|
|
2240
2269
|
st(() => {
|
|
2241
2270
|
et.current = N;
|
|
2242
2271
|
}, [N]);
|
|
2243
|
-
const Ue =
|
|
2272
|
+
const Ue = R((c, h = { inline: "nearest", block: "nearest" }) => {
|
|
2244
2273
|
let { rowIndex: w, colIndex: p } = c;
|
|
2245
|
-
w === void 0 && C?.cell && (w = C.cell.rowIndex), p === void 0 && C?.cell && (p = C.cell.colIndex), w !== void 0 && p !== void 0 && e.current?.scrollCellCoordsIntoView({ rowIndex: w, colIndex: p },
|
|
2274
|
+
w === void 0 && C?.cell && (w = C.cell.rowIndex), p === void 0 && C?.cell && (p = C.cell.colIndex), w !== void 0 && p !== void 0 && e.current?.scrollCellCoordsIntoView({ rowIndex: w, colIndex: p }, h);
|
|
2246
2275
|
}, [C]), ht = D((c) => {
|
|
2247
|
-
const
|
|
2248
|
-
return c.rowIndex <
|
|
2249
|
-
}, []), Ie =
|
|
2276
|
+
const h = Se();
|
|
2277
|
+
return c.rowIndex < h.top || c.colIndex < h.left || c.colIndex > h.right || c.rowIndex > h.bottom;
|
|
2278
|
+
}, []), Ie = R((c, h) => {
|
|
2250
2279
|
if (!e?.current) return null;
|
|
2251
|
-
const w = { rowStart: Math.min(c.rowIndex,
|
|
2280
|
+
const w = { rowStart: Math.min(c.rowIndex, h.rowIndex), colStart: Math.min(c.colIndex, h.colIndex), rowEnd: Math.max(c.rowIndex, h.rowIndex), colEnd: Math.max(c.colIndex, h.colIndex) };
|
|
2252
2281
|
if (H?.(w)) return w;
|
|
2253
|
-
const
|
|
2282
|
+
const v = L(c), W = L(h), b = { rowStart: Math.min(v.rowStart, W.rowStart), colStart: Math.min(v.colStart, W.colStart), rowEnd: Math.max(v.rowEnd, W.rowEnd), colEnd: Math.max(v.colEnd, W.colEnd) };
|
|
2254
2283
|
let he;
|
|
2255
2284
|
return typeof et.current == "function" ? he = et.current(b) : N && (he = N), he ? Z.extendRangeToUnionRanges(b, he) : b;
|
|
2256
|
-
}, [H, L]), Oe =
|
|
2257
|
-
const p = c.ranges.length > 0 ? c.ranges[c.rangeIndex] : { rowStart: c.cell.rowIndex, colStart: c.cell.colIndex, rowEnd: c.cell.rowIndex, colEnd: c.cell.colIndex },
|
|
2285
|
+
}, [H, L]), Oe = R((c, h, w) => {
|
|
2286
|
+
const p = c.ranges.length > 0 ? c.ranges[c.rangeIndex] : { rowStart: c.cell.rowIndex, colStart: c.cell.colIndex, rowEnd: c.cell.rowIndex, colEnd: c.cell.colIndex }, v = { rowStart: Math.min(h.rowIndex ?? p.rowStart, w.rowIndex ?? p.rowStart), colStart: Math.min(h.colIndex ?? p.colStart, w.colIndex ?? p.colStart), rowEnd: Math.max(h.rowIndex ?? p.rowEnd, w.rowIndex ?? p.rowEnd), colEnd: Math.max(h.colIndex ?? p.colEnd, w.colIndex ?? p.colEnd) }, W = { rowIndex: v.rowStart, colIndex: v.colStart }, b = { rowIndex: v.rowEnd, colIndex: v.colEnd };
|
|
2258
2287
|
if (!(ht(W) || ht(b)))
|
|
2259
2288
|
return Ie(W, b);
|
|
2260
|
-
}, [Ie]), rt =
|
|
2261
|
-
if (s === "single" || !
|
|
2262
|
-
const p = Oe(
|
|
2289
|
+
}, [Ie]), rt = R((c, h, w) => {
|
|
2290
|
+
if (s === "single" || !ye.current) return;
|
|
2291
|
+
const p = Oe(ye.current, c, h ?? ye.current.cell);
|
|
2263
2292
|
if (!p) return;
|
|
2264
|
-
const
|
|
2265
|
-
mt((W) => W.length ? W.map((b, he) =>
|
|
2266
|
-
}, []), tt = D((c,
|
|
2267
|
-
if (!
|
|
2268
|
-
c = { ...
|
|
2269
|
-
const p = Oe(
|
|
2293
|
+
const v = ye.current.rangeIndex;
|
|
2294
|
+
mt((W) => W.length ? W.map((b, he) => v === he ? p : b) : [p]), w && p && Qe({ colIndex: p.colStart, rowIndex: p.rowStart });
|
|
2295
|
+
}, []), tt = D((c, h, w) => {
|
|
2296
|
+
if (!ye.current) return;
|
|
2297
|
+
c = { ...ye.current?.cell, ...c }, h = h ?? c;
|
|
2298
|
+
const p = Oe(ye.current, c, h);
|
|
2270
2299
|
if (!p) return;
|
|
2271
|
-
const
|
|
2272
|
-
a === "clear" ? (We.current = W, rn()) : a === "modify" ? rt(
|
|
2273
|
-
}, []), ze = D((c,
|
|
2274
|
-
s !== "multiple" || !c || ht(c) || ht(
|
|
2300
|
+
const v = { rowIndex: p.rowStart, colIndex: p.colStart }, W = { ...v, ...w };
|
|
2301
|
+
a === "clear" ? (We.current = W, rn()) : a === "modify" ? rt(v) : ze(v), Qe(W);
|
|
2302
|
+
}, []), ze = D((c, h = c, w) => {
|
|
2303
|
+
s !== "multiple" || !c || ht(c) || ht(h) || St((p) => {
|
|
2275
2304
|
Je.current = !1, p = Yt(p);
|
|
2276
|
-
const
|
|
2277
|
-
if (!
|
|
2305
|
+
const v = Ie(c, h);
|
|
2306
|
+
if (!v) return p;
|
|
2278
2307
|
let W = p.ranges.length > 0 ? [...p.ranges] : [Ie(p.cell, p.cell)];
|
|
2279
|
-
W.push(
|
|
2280
|
-
const b = { ranges: W, cell: { rowIndex:
|
|
2308
|
+
W.push(v);
|
|
2309
|
+
const b = { ranges: W, cell: { rowIndex: v.rowStart, colIndex: v.colStart, ...w }, rangeIndex: W.length - 1 };
|
|
2281
2310
|
return Z.isEqualSelectionCoords(b, p) ? p : b;
|
|
2282
2311
|
});
|
|
2283
2312
|
}, []), rn = () => {
|
|
2284
2313
|
mt(Zo);
|
|
2285
|
-
}, Tt = we.detectIt().primaryInput === "touch", nt = G(null), Rt = G(null), Ot = G(null), hn =
|
|
2314
|
+
}, Tt = we.detectIt().primaryInput === "touch", nt = G(null), Rt = G(null), Ot = G(null), hn = Ee(() => ({ onPointerDown: (c) => {
|
|
2286
2315
|
if (!e || !e.current) return !1;
|
|
2287
|
-
const
|
|
2288
|
-
if (
|
|
2316
|
+
const h = c.nativeEvent, w = e.current.getViewFromClient(h.clientX, h.clientY);
|
|
2317
|
+
if (h.pointerType === "touch" || h.type === "touchstart") return Rt.current = { topLeft: w.getScrollTopLeft(), point: { x: h.clientX, y: h.clientY } }, !0;
|
|
2289
2318
|
const p = w.getCellCoordsFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY);
|
|
2290
2319
|
if (!p) return !1;
|
|
2291
|
-
nt.current = { anchor: w.getAnchor(), coords: p },
|
|
2292
|
-
const
|
|
2293
|
-
if (
|
|
2320
|
+
nt.current = { anchor: w.getAnchor(), coords: p }, ee.current = null;
|
|
2321
|
+
const v = c.nativeEvent.which === Er;
|
|
2322
|
+
if (v && Z.indexOfCoords(p, C.ranges) !== -1)
|
|
2294
2323
|
return !1;
|
|
2295
|
-
const W = c.nativeEvent.shiftKey, b = c.nativeEvent.ctrlKey || c.nativeEvent.metaKey, he = b,
|
|
2296
|
-
if (
|
|
2297
|
-
i?.(
|
|
2298
|
-
const Le = !
|
|
2324
|
+
const W = c.nativeEvent.shiftKey, b = c.nativeEvent.ctrlKey || c.nativeEvent.metaKey, he = b, oe = d, ie = C.ranges.length > 0, ge = b && oe;
|
|
2325
|
+
if (re?.(c, p, C) === !1) return !1;
|
|
2326
|
+
i?.(ye.current, c.nativeEvent);
|
|
2327
|
+
const Le = !v && s !== "single";
|
|
2299
2328
|
if (W) return rt(p), Le;
|
|
2300
2329
|
const de = Z.isEqualCells(p, C.cell);
|
|
2301
2330
|
if (he) {
|
|
2302
|
-
if (de && (!ge || !
|
|
2303
|
-
if (b && Z.indexOfCoords(p, C.ranges) !== -1 &&
|
|
2331
|
+
if (de && (!ge || !ie)) return Le;
|
|
2332
|
+
if (b && Z.indexOfCoords(p, C.ranges) !== -1 && oe) {
|
|
2304
2333
|
xt.current = p;
|
|
2305
|
-
const
|
|
2306
|
-
return Vt.current =
|
|
2334
|
+
const le = Ie(p, p);
|
|
2335
|
+
return Vt.current = le, Kt(le), Le;
|
|
2307
2336
|
}
|
|
2308
2337
|
return ze(p), Le;
|
|
2309
2338
|
}
|
|
2310
|
-
|
|
2311
|
-
}, onPointerMoveOrWait: Ct.throttle((c,
|
|
2339
|
+
se && Ue(p), de && C.ranges.length === 0 || tt(p);
|
|
2340
|
+
}, onPointerMoveOrWait: Ct.throttle((c, h) => {
|
|
2312
2341
|
if (!e?.current || c.pointerType === "touch" || c.type === "touchmove" || !nt.current) return;
|
|
2313
2342
|
const w = nt.current.anchor;
|
|
2314
|
-
let p = e.current.getViewFromLocation(w),
|
|
2315
|
-
if (!Z.isEqualCells(
|
|
2343
|
+
let p = e.current.getViewFromLocation(w), v = p.getCellCoordsFromClient(c.clientX, c.clientY);
|
|
2344
|
+
if (!Z.isEqualCells(v, nt.current?.coords) && (nt.current = { anchor: w, coords: v }, v && be?.(c, v, ye.current) !== !1)) {
|
|
2316
2345
|
if (xt.current) {
|
|
2317
|
-
const W = { rowStart: Math.min(
|
|
2346
|
+
const W = { rowStart: Math.min(v.rowIndex, xt.current.rowIndex), colStart: Math.min(v.colIndex, xt.current.colIndex), rowEnd: Math.max(v.rowIndex, xt.current.rowIndex), colEnd: Math.max(v.colIndex, xt.current.colIndex) }, b = { rowIndex: W.rowStart, colIndex: W.colStart }, he = { rowIndex: W.rowEnd, colIndex: W.colEnd };
|
|
2318
2347
|
if (ht(b) || ht(he)) return;
|
|
2319
|
-
const
|
|
2320
|
-
Vt.current =
|
|
2321
|
-
} else rt(
|
|
2322
|
-
Ot.current =
|
|
2348
|
+
const oe = Ie(b, he);
|
|
2349
|
+
Vt.current = oe, Kt(oe);
|
|
2350
|
+
} else rt(v);
|
|
2351
|
+
Ot.current = h, lo(p, v, e);
|
|
2323
2352
|
}
|
|
2324
2353
|
}, 60), onPointerUp: (c) => {
|
|
2325
2354
|
if (nt.current = null, c.pointerType === "touch" || c.type === "touchend") {
|
|
2326
2355
|
if (Rt.current) {
|
|
2327
2356
|
const w = e.current.getViewFromClient(Rt.current.point.x, Rt.current.point.y), p = w.getScrollTopLeft();
|
|
2328
2357
|
if (p.left === Rt.current.topLeft.left && p.top === Rt.current.topLeft.top) {
|
|
2329
|
-
const
|
|
2330
|
-
tt(
|
|
2358
|
+
const v = w.getCellCoordsFromClient(Rt.current.point.x, Rt.current.point.y);
|
|
2359
|
+
tt(v);
|
|
2331
2360
|
}
|
|
2332
2361
|
}
|
|
2333
2362
|
return Rt.current = null, void (nt.current = null);
|
|
2334
2363
|
}
|
|
2335
2364
|
try {
|
|
2336
|
-
l?.(
|
|
2365
|
+
l?.(ye.current, c);
|
|
2337
2366
|
} catch (w) {
|
|
2338
2367
|
console.warn(w);
|
|
2339
2368
|
}
|
|
2340
2369
|
if (!xt.current) return;
|
|
2341
|
-
const
|
|
2370
|
+
const h = Vt.current;
|
|
2342
2371
|
xt.current = null, Vt.current = null, Kt(null), St((w) => {
|
|
2343
2372
|
if (Je.current = !1, (w = Yt(w)).ranges.length === 0) return w;
|
|
2344
|
-
let p = [],
|
|
2373
|
+
let p = [], v = -1, W = w.cell;
|
|
2345
2374
|
for (let he = 0; he < w.ranges.length; he++) {
|
|
2346
|
-
const
|
|
2347
|
-
if (Z.isRangesIntersect(
|
|
2348
|
-
const
|
|
2349
|
-
for (let ge = 0; ge <
|
|
2350
|
-
const Le = { rowStart:
|
|
2351
|
-
p.push(Le), Z.isCellWithinRange(w.cell, Le) && (
|
|
2375
|
+
const oe = w.ranges[he];
|
|
2376
|
+
if (Z.isRangesIntersect(oe, h)) {
|
|
2377
|
+
const ie = Ct.subtractRect({ top: oe.rowStart, left: oe.colStart, bottom: oe.rowEnd + 1, right: oe.colEnd + 1 }, { top: h.rowStart, left: h.colStart, bottom: h.rowEnd + 1, right: h.colEnd + 1 });
|
|
2378
|
+
for (let ge = 0; ge < ie.length; ge++) {
|
|
2379
|
+
const Le = { rowStart: ie[ge].top, colStart: ie[ge].left, rowEnd: ie[ge].bottom - 1, colEnd: ie[ge].right - 1 };
|
|
2380
|
+
p.push(Le), Z.isCellWithinRange(w.cell, Le) && (v = p.length - 1);
|
|
2352
2381
|
}
|
|
2353
|
-
} else p.push(
|
|
2354
|
-
p.length > 0 &&
|
|
2382
|
+
} else p.push(oe);
|
|
2383
|
+
p.length > 0 && v === -1 && Z.isCellWithinRange(w.cell, oe) && (v = p.length - 1, W = { rowIndex: p[p.length - 1].rowStart, colIndex: p[p.length - 1].colStart });
|
|
2355
2384
|
}
|
|
2356
|
-
const b = { cell: W, rangeIndex:
|
|
2385
|
+
const b = { cell: W, rangeIndex: v, ranges: p };
|
|
2357
2386
|
return Z.isEqualSelectionCoords(b, w) ? w : b;
|
|
2358
2387
|
});
|
|
2359
|
-
}, processTouch: !0, consumeTouch: !1 }), [C, s, d,
|
|
2388
|
+
}, processTouch: !0, consumeTouch: !1 }), [C, s, d, se, a]), mo = R(On(hn), []), xo = Ee(() => ({ onSelectionPointerDown: (c, h, w, p, v = C.cell, W = se, b = c.nativeEvent.shiftKey, he = !1) => {
|
|
2360
2389
|
if (!e || !e.current) return !1;
|
|
2361
2390
|
c.stopPropagation(), c.preventDefault(), c.nativeEvent.stopImmediatePropagation();
|
|
2362
|
-
const
|
|
2363
|
-
if (!
|
|
2364
|
-
nt.current = { anchor:
|
|
2365
|
-
const ge = c.nativeEvent.which ===
|
|
2366
|
-
if (ge && Z.indexOfCoords(
|
|
2391
|
+
const oe = w ?? e.current.getViewFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY), ie = p ?? oe.getCellCoordsFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY);
|
|
2392
|
+
if (!ie) return !1;
|
|
2393
|
+
nt.current = { anchor: oe.getAnchor(), coords: ie }, ee.current = null;
|
|
2394
|
+
const ge = c.nativeEvent.which === Er;
|
|
2395
|
+
if (ge && Z.indexOfCoords(ie, C.ranges) !== -1)
|
|
2367
2396
|
return !1;
|
|
2368
|
-
const Le = c.nativeEvent.ctrlKey || c.nativeEvent.metaKey, de = Le,
|
|
2369
|
-
if (
|
|
2370
|
-
i?.(
|
|
2397
|
+
const Le = c.nativeEvent.ctrlKey || c.nativeEvent.metaKey, de = Le, le = d, Et = C.ranges.length > 0, F = Le && le;
|
|
2398
|
+
if (re?.(c, ie, C) === !1) return !1;
|
|
2399
|
+
i?.(ye.current, c.nativeEvent);
|
|
2371
2400
|
const ke = !ge && s !== "single";
|
|
2372
|
-
if (b) return rt(
|
|
2373
|
-
const Pt = Z.isEqualCells(
|
|
2401
|
+
if (b) return rt(ie, v, he), ke;
|
|
2402
|
+
const Pt = Z.isEqualCells(ie, v);
|
|
2374
2403
|
if (de) {
|
|
2375
|
-
if (Pt && (!F || !
|
|
2376
|
-
if (F && Z.indexOfCoords(
|
|
2377
|
-
xt.current =
|
|
2378
|
-
const Re = Ie(
|
|
2404
|
+
if (Pt && (!F || !Et)) return ke;
|
|
2405
|
+
if (F && Z.indexOfCoords(ie, C.ranges) !== -1 && le) {
|
|
2406
|
+
xt.current = ie;
|
|
2407
|
+
const Re = Ie(ie, ie);
|
|
2379
2408
|
return Vt.current = Re, Kt(Re), ke;
|
|
2380
2409
|
}
|
|
2381
|
-
return ze(
|
|
2410
|
+
return ze(ie), ke;
|
|
2382
2411
|
}
|
|
2383
|
-
W && Ue(
|
|
2384
|
-
}, onSelectionPointerMoveOrWait: (c,
|
|
2412
|
+
W && Ue(ie), Pt && C.ranges.length === 0 || tt(ie);
|
|
2413
|
+
}, onSelectionPointerMoveOrWait: (c, h, w, p, v, W = C.cell, b = !0, he = !1) => {
|
|
2385
2414
|
if (!e?.current || (c.stopPropagation(), c.preventDefault(), c.stopImmediatePropagation(), !nt.current)) return;
|
|
2386
|
-
const
|
|
2387
|
-
let
|
|
2388
|
-
if (!Z.isEqualCells(ge, nt.current?.coords) && (nt.current = { anchor:
|
|
2415
|
+
const oe = nt.current.anchor;
|
|
2416
|
+
let ie = p ?? e.current.getViewFromLocation(oe), ge = v ?? ie.getCellCoordsFromClient(c.clientX, c.clientY);
|
|
2417
|
+
if (!Z.isEqualCells(ge, nt.current?.coords) && (nt.current = { anchor: oe, coords: ge }, ge && be?.(c, ge, ye.current) !== !1)) {
|
|
2389
2418
|
if (xt.current) {
|
|
2390
|
-
const Le = { rowStart: Math.min(ge.rowIndex, xt.current.rowIndex), colStart: Math.min(ge.colIndex, xt.current.colIndex), rowEnd: Math.max(ge.rowIndex, xt.current.rowIndex), colEnd: Math.max(ge.colIndex, xt.current.colIndex) }, de = { rowIndex: Le.rowStart, colIndex: Le.colStart },
|
|
2391
|
-
if (ht(de) || ht(
|
|
2392
|
-
const
|
|
2393
|
-
Vt.current =
|
|
2419
|
+
const Le = { rowStart: Math.min(ge.rowIndex, xt.current.rowIndex), colStart: Math.min(ge.colIndex, xt.current.colIndex), rowEnd: Math.max(ge.rowIndex, xt.current.rowIndex), colEnd: Math.max(ge.colIndex, xt.current.colIndex) }, de = { rowIndex: Le.rowStart, colIndex: Le.colStart }, le = { rowIndex: Le.rowEnd, colIndex: Le.colEnd };
|
|
2420
|
+
if (ht(de) || ht(le)) return;
|
|
2421
|
+
const Et = Ie(de, le);
|
|
2422
|
+
Vt.current = Et, Kt(Et);
|
|
2394
2423
|
} else rt(ge, W, he);
|
|
2395
|
-
b && lo(
|
|
2424
|
+
b && lo(ie, ge, e);
|
|
2396
2425
|
}
|
|
2397
2426
|
}, onPointerUp: (c) => {
|
|
2398
2427
|
nt.current = null, c.stopPropagation(), c.preventDefault(), c.stopImmediatePropagation();
|
|
2399
2428
|
try {
|
|
2400
|
-
l?.(
|
|
2429
|
+
l?.(ye.current, c);
|
|
2401
2430
|
} catch (w) {
|
|
2402
2431
|
console.warn(w);
|
|
2403
2432
|
}
|
|
2404
2433
|
if (!xt.current) return;
|
|
2405
|
-
const
|
|
2434
|
+
const h = Vt.current;
|
|
2406
2435
|
xt.current = null, Vt.current = null, Kt(null), St((w) => {
|
|
2407
2436
|
if (Je.current = !1, (w = Yt(w)).ranges.length === 0) return w;
|
|
2408
|
-
let p = [],
|
|
2437
|
+
let p = [], v = -1, W = w.cell;
|
|
2409
2438
|
for (let he = 0; he < w.ranges.length; he++) {
|
|
2410
|
-
const
|
|
2411
|
-
if (Z.isRangesIntersect(
|
|
2412
|
-
const
|
|
2413
|
-
for (let ge = 0; ge <
|
|
2414
|
-
const Le = { rowStart:
|
|
2415
|
-
p.push(Le), Z.isCellWithinRange(w.cell, Le) && (
|
|
2439
|
+
const oe = w.ranges[he];
|
|
2440
|
+
if (Z.isRangesIntersect(oe, h)) {
|
|
2441
|
+
const ie = Ct.subtractRect({ top: oe.rowStart, left: oe.colStart, bottom: oe.rowEnd + 1, right: oe.colEnd + 1 }, { top: h.rowStart, left: h.colStart, bottom: h.rowEnd + 1, right: h.colEnd + 1 });
|
|
2442
|
+
for (let ge = 0; ge < ie.length; ge++) {
|
|
2443
|
+
const Le = { rowStart: ie[ge].top, colStart: ie[ge].left, rowEnd: ie[ge].bottom - 1, colEnd: ie[ge].right - 1 };
|
|
2444
|
+
p.push(Le), Z.isCellWithinRange(w.cell, Le) && (v = p.length - 1);
|
|
2416
2445
|
}
|
|
2417
|
-
} else p.push(
|
|
2418
|
-
p.length > 0 &&
|
|
2446
|
+
} else p.push(oe);
|
|
2447
|
+
p.length > 0 && v === -1 && Z.isCellWithinRange(w.cell, oe) && (v = p.length - 1, W = { rowIndex: p[p.length - 1].rowStart, colIndex: p[p.length - 1].colStart });
|
|
2419
2448
|
}
|
|
2420
|
-
const b = { cell: W, rangeIndex:
|
|
2449
|
+
const b = { cell: W, rangeIndex: v, ranges: p };
|
|
2421
2450
|
return Z.isEqualSelectionCoords(b, w) ? w : b;
|
|
2422
2451
|
});
|
|
2423
|
-
} }), [C, s, d,
|
|
2452
|
+
} }), [C, s, d, se, a]), pt = R((c, h = !1, w = !1, p = 0) => {
|
|
2424
2453
|
if (!e.current || !C.cell) return;
|
|
2425
|
-
let
|
|
2426
|
-
if (
|
|
2454
|
+
let v = C.cell, W = C.cell;
|
|
2455
|
+
if (h && C.ranges.length > 0) {
|
|
2427
2456
|
const F = C.ranges[C.rangeIndex], ke = C.cell;
|
|
2428
2457
|
switch (c) {
|
|
2429
2458
|
case it:
|
|
2430
|
-
W = { rowIndex: ke.rowIndex === F.rowStart ? F.rowEnd : F.rowStart, colIndex: F.colEnd },
|
|
2459
|
+
W = { rowIndex: ke.rowIndex === F.rowStart ? F.rowEnd : F.rowStart, colIndex: F.colEnd }, v = { rowIndex: ke.rowIndex === F.rowStart ? F.rowStart : F.rowEnd, colIndex: F.colStart };
|
|
2431
2460
|
break;
|
|
2432
2461
|
case lt:
|
|
2433
|
-
W = { rowIndex: ke.rowIndex === F.rowEnd ? F.rowStart : F.rowEnd, colIndex: F.colEnd },
|
|
2462
|
+
W = { rowIndex: ke.rowIndex === F.rowEnd ? F.rowStart : F.rowEnd, colIndex: F.colEnd }, v = { rowIndex: ke.rowIndex === F.rowEnd ? F.rowEnd : F.rowStart, colIndex: F.colStart };
|
|
2434
2463
|
break;
|
|
2435
2464
|
case ot:
|
|
2436
|
-
W = { rowIndex: F.rowEnd, colIndex: ke.colIndex === F.colStart ? F.colEnd : F.colStart },
|
|
2465
|
+
W = { rowIndex: F.rowEnd, colIndex: ke.colIndex === F.colStart ? F.colEnd : F.colStart }, v = { rowIndex: F.rowStart, colIndex: ke.colIndex === F.colStart ? F.colStart : F.colEnd };
|
|
2437
2466
|
break;
|
|
2438
2467
|
case Ke:
|
|
2439
|
-
W = { rowIndex: F.rowEnd, colIndex: ke.colIndex === F.colEnd ? F.colStart : F.colEnd },
|
|
2468
|
+
W = { rowIndex: F.rowEnd, colIndex: ke.colIndex === F.colEnd ? F.colStart : F.colEnd }, v = { rowIndex: F.rowStart, colIndex: ke.colIndex === F.colEnd ? F.colEnd : F.colStart };
|
|
2440
2469
|
}
|
|
2441
2470
|
}
|
|
2442
2471
|
const b = L(W);
|
|
2443
|
-
let { rowStart: he, colStart:
|
|
2444
|
-
const
|
|
2445
|
-
if (
|
|
2472
|
+
let { rowStart: he, colStart: oe } = b;
|
|
2473
|
+
const ie = Se();
|
|
2474
|
+
if (ee.current) switch (c) {
|
|
2446
2475
|
case it:
|
|
2447
2476
|
case lt:
|
|
2448
|
-
|
|
2477
|
+
ee.current.colIndex >= b.colStart && ee.current.colIndex <= b.colEnd && (oe = ee.current.colIndex);
|
|
2449
2478
|
break;
|
|
2450
2479
|
case ot:
|
|
2451
2480
|
case Ke:
|
|
2452
|
-
|
|
2481
|
+
ee.current.rowIndex >= b.rowStart && ee.current.rowIndex <= b.rowEnd && (he = ee.current.rowIndex);
|
|
2453
2482
|
}
|
|
2454
2483
|
if (!p) {
|
|
2455
2484
|
switch (c) {
|
|
2456
2485
|
case it:
|
|
2457
|
-
he = qe(dt, Math.max(b.rowStart - 1,
|
|
2486
|
+
he = qe(dt, Math.max(b.rowStart - 1, ie.top), c);
|
|
2458
2487
|
break;
|
|
2459
2488
|
case lt:
|
|
2460
|
-
he = qe(dt, Math.min(b.rowEnd + 1,
|
|
2489
|
+
he = qe(dt, Math.min(b.rowEnd + 1, ie.bottom), c);
|
|
2461
2490
|
break;
|
|
2462
2491
|
case ot:
|
|
2463
|
-
|
|
2492
|
+
oe = qe(ut, Math.max(b.colStart - 1, ie.left), c);
|
|
2464
2493
|
break;
|
|
2465
2494
|
case Ke:
|
|
2466
|
-
|
|
2495
|
+
oe = qe(ut, Math.min(b.colEnd + 1, ie.right), c);
|
|
2467
2496
|
}
|
|
2468
2497
|
if (w) switch (c) {
|
|
2469
2498
|
case it:
|
|
2470
|
-
he = I({ ...W, colIndex: C.cell.colIndex }, ue, dt, c, !1, Math.max(
|
|
2499
|
+
he = I({ ...W, colIndex: C.cell.colIndex }, ue, dt, c, !1, Math.max(ie.top, dt(ie.top, !1)));
|
|
2471
2500
|
break;
|
|
2472
2501
|
case lt:
|
|
2473
|
-
he = I({ ...W, colIndex: C.cell.colIndex }, ue, dt, c, !1, Math.min(
|
|
2502
|
+
he = I({ ...W, colIndex: C.cell.colIndex }, ue, dt, c, !1, Math.min(ie.bottom, ie.bottom - dt(ie.bottom, !0)));
|
|
2474
2503
|
break;
|
|
2475
2504
|
case ot:
|
|
2476
|
-
|
|
2505
|
+
oe = I({ ...W, rowIndex: C.cell.rowIndex }, ue, ut, c, !1, Math.max(ie.left, ut(ie.left, !1)));
|
|
2477
2506
|
break;
|
|
2478
2507
|
case Ke:
|
|
2479
|
-
|
|
2508
|
+
oe = I({ ...W, rowIndex: C.cell.rowIndex }, ue, ut, c, !1, Math.min(ie.right, ie.right - ut(ie.right, !0)));
|
|
2480
2509
|
}
|
|
2481
2510
|
}
|
|
2482
2511
|
let ge = null;
|
|
@@ -2484,93 +2513,93 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2484
2513
|
let F = 0;
|
|
2485
2514
|
switch (c) {
|
|
2486
2515
|
case it:
|
|
2487
|
-
F = n.getRowOffset(he + 1), he = Math.max(
|
|
2516
|
+
F = n.getRowOffset(he + 1), he = Math.max(ie.top, n.getRowIndex(F - p)), ge = { top: n.getRowOffset(he + 1) - (F - e.current.getScrollPosition().top) };
|
|
2488
2517
|
break;
|
|
2489
2518
|
case lt:
|
|
2490
|
-
F = n.getRowOffset(he), he = Math.min(
|
|
2519
|
+
F = n.getRowOffset(he), he = Math.min(ie.bottom, n.getRowIndex(F + p)), ge = { top: n.getRowOffset(he) - (F - e.current.getScrollPosition().top) };
|
|
2491
2520
|
break;
|
|
2492
2521
|
case ot:
|
|
2493
|
-
F = n.getColOffset(
|
|
2522
|
+
F = n.getColOffset(oe + 1), oe = Math.max(ie.left, n.getColIndex(F - p)), ge = { left: n.getColOffset(oe + 1) - (F - e.current.getScrollPosition().left) };
|
|
2494
2523
|
break;
|
|
2495
2524
|
case Ke:
|
|
2496
|
-
F = n.getColOffset(
|
|
2525
|
+
F = n.getColOffset(oe), oe = Math.min(ie.right, n.getColIndex(F + p)), ge = { left: n.getColOffset(oe) - (F - e.current.getScrollPosition().left) };
|
|
2497
2526
|
}
|
|
2498
2527
|
}
|
|
2499
|
-
const Le = { rowIndex: he, colIndex:
|
|
2500
|
-
|
|
2501
|
-
const
|
|
2502
|
-
if (
|
|
2528
|
+
const Le = { rowIndex: he, colIndex: oe }, de = L(Le), le = { rowIndex: de.rowStart, colIndex: de.colStart };
|
|
2529
|
+
h || (ee.current = Le);
|
|
2530
|
+
const Et = Z.isEqualCells(We.current, le) && Z.isEqualCells(We.current, v);
|
|
2531
|
+
if (h && !Et ? rt(le, v) : tt(le), ge) e.current.scrollTo(ge);
|
|
2503
2532
|
else {
|
|
2504
|
-
if (
|
|
2533
|
+
if (h && We.current) {
|
|
2505
2534
|
const F = Se();
|
|
2506
2535
|
if (c === Ke && We.current.colIndex === F.left || c === ot && We.current.colIndex === F.right || c === it && We.current.rowIndex === F.bottom || c === lt && We.current.rowIndex === F.top) return;
|
|
2507
2536
|
}
|
|
2508
2537
|
c === ot || c === Ke ? Ue({ colIndex: Le.colIndex }) : c !== it && c !== lt || Ue({ rowIndex: Le.rowIndex });
|
|
2509
2538
|
}
|
|
2510
|
-
}, [C, L]), ln =
|
|
2539
|
+
}, [C, L]), ln = R((c) => {
|
|
2511
2540
|
if (!e.current) return;
|
|
2512
2541
|
if (C.ranges.length === 0) return void pt(c);
|
|
2513
|
-
const
|
|
2514
|
-
if (Z.isEqualRangesArrays([
|
|
2542
|
+
const h = L(C.cell);
|
|
2543
|
+
if (Z.isEqualRangesArrays([h], C.ranges)) return void pt(c);
|
|
2515
2544
|
const w = Xo(C, c, L, dt, ut);
|
|
2516
2545
|
St((p) => {
|
|
2517
2546
|
Je.current = !1, p = Yt(p);
|
|
2518
|
-
const
|
|
2519
|
-
return Z.isEqualSelectionCoords(
|
|
2547
|
+
const v = { ...p, cell: w.cell, rangeIndex: w.rangeIndex };
|
|
2548
|
+
return Z.isEqualSelectionCoords(v, p) ? p : v;
|
|
2520
2549
|
}), w.cell && Ue(w.cell);
|
|
2521
|
-
}, [C, L]),
|
|
2550
|
+
}, [C, L]), yo = D(() => {
|
|
2522
2551
|
const c = Se();
|
|
2523
2552
|
rt({ rowIndex: c.top }, { rowIndex: c.bottom });
|
|
2524
|
-
}, []),
|
|
2553
|
+
}, []), vo = D(() => {
|
|
2525
2554
|
const c = Se();
|
|
2526
2555
|
rt({ colIndex: c.left }, { colIndex: c.right });
|
|
2527
|
-
}, []), xn =
|
|
2556
|
+
}, []), xn = R(() => {
|
|
2528
2557
|
C.cell && e?.current && Ue(C.cell);
|
|
2529
2558
|
}, [C.cell]), qn = D((c = !1) => {
|
|
2530
|
-
const
|
|
2531
|
-
c ? rt(
|
|
2559
|
+
const h = { rowIndex: Se().top };
|
|
2560
|
+
c ? rt(h) : tt(h), Ue(h);
|
|
2532
2561
|
}, []), Yn = D((c = !1) => {
|
|
2533
|
-
const
|
|
2534
|
-
c ? rt(
|
|
2562
|
+
const h = { rowIndex: Se().bottom };
|
|
2563
|
+
c ? rt(h) : tt(h), Ue(h);
|
|
2535
2564
|
}, []), Dn = D((c = !1) => {
|
|
2536
|
-
const
|
|
2537
|
-
c ? rt(
|
|
2565
|
+
const h = { colIndex: Se().left };
|
|
2566
|
+
c ? rt(h) : tt(h), Ue(h);
|
|
2538
2567
|
}, []), Mn = D((c = !1) => {
|
|
2539
|
-
const
|
|
2568
|
+
const h = Se(), w = { rowIndex: h.top, colIndex: h.left };
|
|
2540
2569
|
c ? rt(w) : tt(w), Ue(w);
|
|
2541
2570
|
}, []), zn = D((c = !1) => {
|
|
2542
|
-
const
|
|
2571
|
+
const h = Se(), w = { colIndex: z?.()?.colEnd ?? h.right };
|
|
2543
2572
|
c ? rt(w) : tt(w), Ue(w);
|
|
2544
|
-
}, [z]),
|
|
2545
|
-
const
|
|
2573
|
+
}, [z]), yn = D((c = !1) => {
|
|
2574
|
+
const h = Se(), w = { rowIndex: z?.()?.rowEnd ?? h.bottom, colIndex: z?.()?.colEnd ?? h.right };
|
|
2546
2575
|
c ? rt(w) : tt(w), Ue(w);
|
|
2547
|
-
}, [z]), An =
|
|
2576
|
+
}, [z]), An = R((c) => {
|
|
2548
2577
|
if (!e.current || C.ranges.length <= 1) return;
|
|
2549
|
-
const
|
|
2550
|
-
let w = C.rangeIndex + (
|
|
2578
|
+
const h = c === ot || c === it;
|
|
2579
|
+
let w = C.rangeIndex + (h ? -1 : 1);
|
|
2551
2580
|
w < 0 ? w = C.ranges.length - 1 : w > C.ranges.length - 1 && (w = 0);
|
|
2552
|
-
const p = C.ranges[w],
|
|
2581
|
+
const p = C.ranges[w], v = Xo({ cell: { rowIndex: p.rowEnd, colIndex: p.colEnd }, rangeIndex: 0, ranges: [p] }, Ke, L, dt, ut);
|
|
2553
2582
|
St((W) => {
|
|
2554
2583
|
Je.current = !1, W = Yt(W);
|
|
2555
|
-
const b = { ...W, cell:
|
|
2584
|
+
const b = { ...W, cell: v.cell, rangeIndex: w };
|
|
2556
2585
|
return Z.isEqualSelectionCoords(b, W) ? W : b;
|
|
2557
|
-
}),
|
|
2558
|
-
}, [C, L]), bo =
|
|
2586
|
+
}), v.cell && Ue(v.cell);
|
|
2587
|
+
}, [C, L]), bo = R(() => {
|
|
2559
2588
|
const c = Ar(C);
|
|
2560
|
-
St((
|
|
2561
|
-
Je.current = !1,
|
|
2562
|
-
const w = { ...
|
|
2563
|
-
return Z.isEqualSelectionCoords(w,
|
|
2589
|
+
St((h) => {
|
|
2590
|
+
Je.current = !1, h = Yt(h);
|
|
2591
|
+
const w = { ...h, visibleSelection: c };
|
|
2592
|
+
return Z.isEqualSelectionCoords(w, h) ? h : w;
|
|
2564
2593
|
}), c.cell && Ue(c.cell);
|
|
2565
|
-
}, [C, L]), So =
|
|
2594
|
+
}, [C, L]), So = R(() => {
|
|
2566
2595
|
if (!e.current || C.ranges.length === 0) return;
|
|
2567
|
-
const c = C.cell,
|
|
2568
|
-
let
|
|
2569
|
-
|
|
2596
|
+
const c = C.cell, h = C.ranges[C.rangeIndex], w = Ar({ cell: c, rangeIndex: 0, ranges: [h] }), p = w.ranges[w.rangeIndex];
|
|
2597
|
+
let v;
|
|
2598
|
+
v = p.rowStart === c.rowIndex && p.colStart === c.colIndex ? { rowIndex: p.rowStart, colIndex: p.colEnd } : p.rowStart === c.rowIndex && p.colEnd === c.colIndex ? { rowIndex: p.rowEnd, colIndex: p.colStart } : p.rowEnd === c.rowIndex && p.colStart === c.colIndex ? { rowIndex: p.rowEnd, colIndex: p.colEnd } : { rowIndex: p.rowStart, colIndex: p.colStart }, St((W) => {
|
|
2570
2599
|
W = Yt(W);
|
|
2571
|
-
const b = { ...W, cell:
|
|
2600
|
+
const b = { ...W, cell: v };
|
|
2572
2601
|
return Z.isEqualSelectionCoords(b, W) ? W : b;
|
|
2573
|
-
}),
|
|
2602
|
+
}), v && Ue(v);
|
|
2574
2603
|
}, [C, L]), Xn = D((c = !1) => {
|
|
2575
2604
|
pt(lt, c, !1, e.current.getDimensions().containerHeight);
|
|
2576
2605
|
}, []), Jt = D((c = !1) => {
|
|
@@ -2583,9 +2612,9 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2583
2612
|
ln(ot);
|
|
2584
2613
|
}, []), Jn = D(() => {
|
|
2585
2614
|
ln(Ke);
|
|
2586
|
-
}, []), Eo = D(() => {
|
|
2587
|
-
ln(it);
|
|
2588
2615
|
}, []), _o = D(() => {
|
|
2616
|
+
ln(it);
|
|
2617
|
+
}, []), Eo = D(() => {
|
|
2589
2618
|
ln(lt);
|
|
2590
2619
|
}, []), Bn = D(() => {
|
|
2591
2620
|
An(ot);
|
|
@@ -2595,7 +2624,7 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2595
2624
|
So();
|
|
2596
2625
|
}, []), Qn = D(() => {
|
|
2597
2626
|
pt(ot, !1, !1);
|
|
2598
|
-
}, []),
|
|
2627
|
+
}, []), y = D(() => {
|
|
2599
2628
|
pt(ot, !0, !1);
|
|
2600
2629
|
}, []), O = D(() => {
|
|
2601
2630
|
pt(ot, !1, !0);
|
|
@@ -2607,13 +2636,13 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2607
2636
|
pt(Ke, !0, !1);
|
|
2608
2637
|
}, []), fe = D(() => {
|
|
2609
2638
|
pt(Ke, !1, !0);
|
|
2610
|
-
}, []),
|
|
2639
|
+
}, []), ce = D(() => {
|
|
2611
2640
|
pt(Ke, !0, !0);
|
|
2612
2641
|
}, []), xe = D(() => {
|
|
2613
2642
|
pt(it, !1, !1);
|
|
2614
|
-
}, []),
|
|
2643
|
+
}, []), ve = D(() => {
|
|
2615
2644
|
pt(it, !0, !1);
|
|
2616
|
-
}, []),
|
|
2645
|
+
}, []), ae = D(() => {
|
|
2617
2646
|
pt(it, !1, !0);
|
|
2618
2647
|
}, []), je = D(() => {
|
|
2619
2648
|
pt(it, !0, !0);
|
|
@@ -2627,447 +2656,447 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2627
2656
|
pt(lt, !0, !0);
|
|
2628
2657
|
}, []), Xe = D(() => {
|
|
2629
2658
|
mt((c) => c.slice(0, -1));
|
|
2630
|
-
}, []), Lt =
|
|
2659
|
+
}, []), Lt = Ee(() => {
|
|
2631
2660
|
const c = Se();
|
|
2632
|
-
return ((
|
|
2633
|
-
for (let b = 0; b <
|
|
2634
|
-
const he =
|
|
2635
|
-
if (he.rowStart === w && he.colStart === p && he.rowEnd ===
|
|
2661
|
+
return ((h, w, p, v, W) => {
|
|
2662
|
+
for (let b = 0; b < h.length; b++) {
|
|
2663
|
+
const he = h[b];
|
|
2664
|
+
if (he.rowStart === w && he.colStart === p && he.rowEnd === v && he.colEnd === W) return !0;
|
|
2636
2665
|
}
|
|
2637
2666
|
return !1;
|
|
2638
2667
|
})(C.ranges, c.top, c.left, c.bottom, c.right);
|
|
2639
|
-
}, [B, C.ranges]),
|
|
2640
|
-
We.current = c, Qe(c),
|
|
2641
|
-
}, []), pe =
|
|
2642
|
-
const
|
|
2643
|
-
if (!
|
|
2644
|
-
const w =
|
|
2645
|
-
if (!p || !
|
|
2646
|
-
let
|
|
2647
|
-
if (
|
|
2648
|
-
const W = $r(
|
|
2668
|
+
}, [B, C.ranges]), yt = D((c, h = !0) => {
|
|
2669
|
+
We.current = c, Qe(c), h && c && e?.current && Ue(c);
|
|
2670
|
+
}, []), pe = R((c = !0) => {
|
|
2671
|
+
const h = nn.current;
|
|
2672
|
+
if (!ye.current?.cell) return;
|
|
2673
|
+
const w = ye.current?.ranges, p = ye.current?.cell;
|
|
2674
|
+
if (!p || !h || !h) return;
|
|
2675
|
+
let v = null;
|
|
2676
|
+
if (v = w.length > 0 ? w[w.length - 1] : L(p), v.colEnd >= v.colStart && v.rowEnd >= v.rowStart) {
|
|
2677
|
+
const W = $r(v, h);
|
|
2649
2678
|
let b = c ? Ye : $;
|
|
2650
2679
|
try {
|
|
2651
|
-
b?.(
|
|
2680
|
+
b?.(v, h, W.direction);
|
|
2652
2681
|
} catch (he) {
|
|
2653
2682
|
console.warn(he);
|
|
2654
2683
|
} finally {
|
|
2655
2684
|
c && Me?.();
|
|
2656
2685
|
}
|
|
2657
2686
|
}
|
|
2658
|
-
}, [L]), wt = G(null), $t = On(
|
|
2659
|
-
if (Ot.current =
|
|
2687
|
+
}, [L]), wt = G(null), $t = On(Ee(() => ({ onPointerDown: (c, h) => {
|
|
2688
|
+
if (Ot.current = h, !e || !e.current) return !1;
|
|
2660
2689
|
const w = e.current.getViewFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY), p = w?.getCellCoordsFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY);
|
|
2661
2690
|
p && (c.stopPropagation(), on("crosshair"), wt.current = { anchor: w.getAnchor(), coords: p });
|
|
2662
|
-
}, onPointerMoveOrWait: (c,
|
|
2663
|
-
if (
|
|
2691
|
+
}, onPointerMoveOrWait: (c, h) => {
|
|
2692
|
+
if (M || !e?.current || !ye.current || !wt.current) return;
|
|
2664
2693
|
const w = wt.current.anchor;
|
|
2665
|
-
let p = e.current.getViewFromLocation(w),
|
|
2666
|
-
if (!
|
|
2667
|
-
wt.current = { anchor: w, coords:
|
|
2668
|
-
const W =
|
|
2669
|
-
let b = Ie(
|
|
2694
|
+
let p = e.current.getViewFromLocation(w), v = p.getCellCoordsFromClient(c.clientX, c.clientY);
|
|
2695
|
+
if (!v) return;
|
|
2696
|
+
wt.current = { anchor: w, coords: v };
|
|
2697
|
+
const W = ye.current.ranges;
|
|
2698
|
+
let b = Ie(ye.current.cell, v);
|
|
2670
2699
|
if (!b) return;
|
|
2671
|
-
const he = W.length > 0,
|
|
2700
|
+
const he = W.length > 0, oe = he ? W[W.length - 1] : L(ye.current.cell);
|
|
2672
2701
|
if (!b) return;
|
|
2673
|
-
const
|
|
2674
|
-
|
|
2675
|
-
const Le = $r(
|
|
2676
|
-
if (!H?.(
|
|
2702
|
+
const ie = b.rowStart < oe.rowStart ? it : b.rowEnd > oe.rowEnd ? lt : b.colEnd > oe.colEnd ? Ke : ot, ge = Se();
|
|
2703
|
+
ie === ot && (b = { ...oe, colStart: Math.max(ge.left, b.colStart) }), ie === it && (b = { ...oe, rowStart: Math.max(ge.top, b.rowStart) }), ie === Ke && (b = { ...oe, colEnd: Math.min(ge.right, b.colEnd) }), ie === lt && (b = { ...oe, rowEnd: Math.min(ge.bottom, b.rowEnd) });
|
|
2704
|
+
const Le = $r(oe, b);
|
|
2705
|
+
if (!H?.(oe)) {
|
|
2677
2706
|
let de;
|
|
2678
|
-
typeof et.current == "function" ? de = et.current(
|
|
2679
|
-
const Te = { ...
|
|
2707
|
+
typeof et.current == "function" ? de = et.current(oe) : N && (de = N), b = ((le, Et, F, ke, Pt, Re) => {
|
|
2708
|
+
const Te = { ...Et };
|
|
2680
2709
|
if (F.length === 0) return Te;
|
|
2681
2710
|
if (Pt === ot) {
|
|
2682
|
-
const bt =
|
|
2683
|
-
Te.colStart =
|
|
2711
|
+
const bt = le.colEnd + 1 - le.colStart;
|
|
2712
|
+
Te.colStart = le.colStart - Math.ceil(Re / bt) * bt, Te.colStart < ke.left && (Te.colStart = Te.colStart + Math.ceil((ke.left - Te.colStart) / bt) * bt);
|
|
2684
2713
|
} else if (Pt === Ke) {
|
|
2685
|
-
const bt =
|
|
2686
|
-
Te.colEnd =
|
|
2714
|
+
const bt = le.colEnd + 1 - le.colStart;
|
|
2715
|
+
Te.colEnd = le.colEnd + Math.ceil(Re / bt) * bt, Te.colEnd > ke.right && (Te.colEnd = Te.colEnd - Math.ceil((ke.right - Te.colEnd) / bt) * bt);
|
|
2687
2716
|
} else if (Pt === it) {
|
|
2688
|
-
const bt =
|
|
2689
|
-
Te.rowStart =
|
|
2717
|
+
const bt = le.rowEnd + 1 - le.rowStart;
|
|
2718
|
+
Te.rowStart = le.rowStart - Math.ceil(Re / bt) * bt, Te.rowStart < ke.top && (Te.rowStart = Te.rowStart + Math.ceil((ke.top - Te.rowStart) / bt) * bt);
|
|
2690
2719
|
} else if (Pt === lt) {
|
|
2691
|
-
const bt =
|
|
2692
|
-
Te.rowEnd =
|
|
2720
|
+
const bt = le.rowEnd + 1 - le.rowStart;
|
|
2721
|
+
Te.rowEnd = le.rowEnd + Math.ceil(Re / bt) * bt, Te.rowEnd > ke.bottom && (Te.rowEnd = Te.rowEnd - Math.ceil((ke.bottom - Te.rowEnd) / bt) * bt);
|
|
2693
2722
|
}
|
|
2694
2723
|
return Te;
|
|
2695
|
-
})(
|
|
2724
|
+
})(oe, b, de, ge, Le.direction, Le.amount);
|
|
2696
2725
|
}
|
|
2697
|
-
if (he && Z.isRangeWithinRange(b,
|
|
2726
|
+
if (he && Z.isRangeWithinRange(b, oe) && (b = null), !Z.isEqualRanges(b, nn.current)) {
|
|
2698
2727
|
if (dn(b), nn.current = b, !b) {
|
|
2699
2728
|
try {
|
|
2700
|
-
|
|
2729
|
+
_?.();
|
|
2701
2730
|
} catch {
|
|
2702
2731
|
}
|
|
2703
2732
|
return void Me?.();
|
|
2704
2733
|
}
|
|
2705
2734
|
pe(!1);
|
|
2706
2735
|
}
|
|
2707
|
-
Ot.current =
|
|
2708
|
-
}, onPointerUp: (c,
|
|
2709
|
-
Ot.current =
|
|
2736
|
+
Ot.current = h, lo(p, v, e);
|
|
2737
|
+
}, onPointerUp: (c, h) => {
|
|
2738
|
+
Ot.current = h, Promise.resolve(pe(!0)).finally(() => {
|
|
2710
2739
|
Me?.(), dn(null), nn.current = null, wt.current = null, on(null), e.current?.focus();
|
|
2711
2740
|
});
|
|
2712
|
-
} }), [L])), Wt =
|
|
2713
|
-
if (Ot.current =
|
|
2741
|
+
} }), [L])), Wt = Ee(() => ({ onPointerDown: $t }), [$t]), [Ce, Ge] = Ze(null), Ae = G(null), ct = Ee(() => ({ onPointerDown: (c, h) => {
|
|
2742
|
+
if (Ot.current = h, !e || !e.current) return !1;
|
|
2714
2743
|
const w = e.current.getViewFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY), p = w?.getCellCoordsFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY);
|
|
2715
2744
|
if (!p) return;
|
|
2716
|
-
if (
|
|
2745
|
+
if (re?.(c, p, C) === !1) return !1;
|
|
2717
2746
|
c.stopPropagation(), on("default");
|
|
2718
|
-
const
|
|
2719
|
-
b.x -
|
|
2720
|
-
}, onPointerMoveOrWait: (c,
|
|
2721
|
-
if (K || !e?.current || !
|
|
2722
|
-
const p = c.clientX - w.clientX,
|
|
2723
|
-
if (Ae.current.isMoving = Ae.current.isMoving || Math.abs(p) > Math.max(1, 2) || Math.abs(
|
|
2747
|
+
const v = w.getRelativePointFromClient(0, 0), W = ye.current?.ranges[ye.current?.ranges.length - 1] ?? Z.cellToRange(ye.current?.cell), b = w.toClipBounds(w.getRangeCoordsBounds(W)), he = { x: 0, y: 0 };
|
|
2748
|
+
b.x - v.x > c.nativeEvent.clientX ? he.x = c.nativeEvent.clientX - (b.x - v.x) : c.nativeEvent.clientX >= b.x - v.x + b.width && (he.x = Math.max(0, c.nativeEvent.clientX - (b.x - v.x + b.width)) + 1), b.y - v.y > c.nativeEvent.clientY ? he.y = c.nativeEvent.clientY - (b.y - v.y) : c.nativeEvent.clientY >= b.y - v.y + b.height && (he.y = Math.max(0, c.nativeEvent.clientY - (b.y - v.y + b.height)) + 1), X?.(W, c.nativeEvent, h), Ae.current = { range: W, anchor: w.getAnchor(), cell: p, isMoving: !1, extrusion: he };
|
|
2749
|
+
}, onPointerMoveOrWait: (c, h, w) => {
|
|
2750
|
+
if (K || !e?.current || !ye.current || !Ae.current) return;
|
|
2751
|
+
const p = c.clientX - w.clientX, v = c.clientY - w.clientY;
|
|
2752
|
+
if (Ae.current.isMoving = Ae.current.isMoving || Math.abs(p) > Math.max(1, 2) || Math.abs(v) > Math.max(1, 2) || performance.now() - w.timeStamp > 500, !Ae.current.isMoving) return;
|
|
2724
2753
|
const W = Ae.current.anchor, b = Ae.current.extrusion;
|
|
2725
|
-
let he = e.current.getViewFromLocation(W),
|
|
2726
|
-
if (!
|
|
2727
|
-
const
|
|
2728
|
-
Z.isEqualRanges(Ce, Re) && !((Te) => !Te || !Ot.current || Ot.current.ctrlKey !== Te.ctrlKey || Ot.current.shiftKey !== Te.shiftKey || Ot.current.altKey !== Te.altKey || Ot.current.metaKey !== Te.metaKey)(c) || (Ge(Re), T?.(Re, c,
|
|
2729
|
-
}, onPointerUp: (c,
|
|
2730
|
-
Ot.current =
|
|
2754
|
+
let he = e.current.getViewFromLocation(W), oe = he.getCellCoordsFromClient(c.clientX - b.x, c.clientY - b.y, !0);
|
|
2755
|
+
if (!oe) return;
|
|
2756
|
+
const ie = Ae.current.cell, ge = Ae.current.range, Le = Se(), de = ge.colEnd - ge.colStart + 1, le = Math.min(Math.max(0, ie.colIndex - ge.colStart), de - 1), Et = Math.min(Le.right - de + 1, Math.max(Le.left, oe.colIndex - le)), F = ge.rowEnd - ge.rowStart + 1, ke = Math.min(Math.max(0, ie.rowIndex - ge.rowStart), F - 1), Pt = Math.min(Le.bottom - F + 1, Math.max(Le.top, oe.rowIndex - ke)), Re = { colStart: Et, colEnd: Et + de - 1, rowStart: Pt, rowEnd: Pt + F - 1 };
|
|
2757
|
+
Z.isEqualRanges(Ce, Re) && !((Te) => !Te || !Ot.current || Ot.current.ctrlKey !== Te.ctrlKey || Ot.current.shiftKey !== Te.shiftKey || Ot.current.altKey !== Te.altKey || Ot.current.metaKey !== Te.metaKey)(c) || (Ge(Re), T?.(Re, c, h)), Ot.current = h, lo(he, oe, e);
|
|
2758
|
+
}, onPointerUp: (c, h) => {
|
|
2759
|
+
Ot.current = h;
|
|
2731
2760
|
const w = () => {
|
|
2732
2761
|
Ge(null), Ae.current = null, on(null), e.current?.focus();
|
|
2733
2762
|
};
|
|
2734
2763
|
if (!Ae.current) return void w();
|
|
2735
|
-
const p = Ae.current.range,
|
|
2736
|
-
S?.(p, c,
|
|
2764
|
+
const p = Ae.current.range, v = Ce;
|
|
2765
|
+
S?.(p, c, h), Promise.resolve(p && v && f?.(p, v, c, h)).finally(() => {
|
|
2737
2766
|
w();
|
|
2738
2767
|
});
|
|
2739
|
-
} }), [Ce]), Pe = On(ct),
|
|
2740
|
-
const c = Z.isEqualSelectionCoords(C,
|
|
2741
|
-
return
|
|
2768
|
+
} }), [Ce]), Pe = On(ct), _t = Ee(() => ({ onPointerDown: Pe }), [Pe]), vt = G(null), Bt = Ee(() => {
|
|
2769
|
+
const c = Z.isEqualSelectionCoords(C, vt.current) ? vt.current : C;
|
|
2770
|
+
return vt.current = c, c;
|
|
2742
2771
|
}, [C]), qt = D((c) => {
|
|
2743
|
-
let
|
|
2744
|
-
const p = [],
|
|
2772
|
+
let h = null, w = "br";
|
|
2773
|
+
const p = [], v = { stroke: E, fill: ne, strokeWidth: 0.5 }, W = (de, le, Et) => {
|
|
2745
2774
|
const F = c.toClipBounds(c.getRangeCoordsBounds(de), en);
|
|
2746
2775
|
if (!F) return;
|
|
2747
|
-
F.x = F.width > 0 ? F.x : F.x -
|
|
2748
|
-
const ke = { key: `selection-fill-${
|
|
2749
|
-
if (
|
|
2750
|
-
const Pt = c.getCellCoordsAsRangeCoords(
|
|
2751
|
-
ke.cell =
|
|
2776
|
+
F.x = F.width > 0 ? F.x : F.x - v.strokeWidth / 2, F.y = F.height > 0 ? F.y : F.y - v.strokeWidth / 2, F.width = Math.max(F.width, v.strokeWidth), F.height = Math.max(F.height, v.strokeWidth);
|
|
2777
|
+
const ke = { key: `selection-fill-${le}`, range: de, ...F, ...v };
|
|
2778
|
+
if (Et) {
|
|
2779
|
+
const Pt = c.getCellCoordsAsRangeCoords(Et);
|
|
2780
|
+
ke.cell = Et, ke.pathBounds = c.toClipBounds(c.getRangeCoordsBounds(Pt), en), ke.pathBounds && (ke.pathBounds.width <= 0 || ke.pathBounds.height <= 0) && (delete ke.pathBounds, delete ke.cell);
|
|
2752
2781
|
}
|
|
2753
2782
|
return me(ke);
|
|
2754
2783
|
};
|
|
2755
2784
|
let b = C ? Yt(C) : null;
|
|
2756
|
-
const he = b?.cell ? c.getCellCoordsAsRangeCoords(b?.cell) :
|
|
2785
|
+
const he = b?.cell ? c.getCellCoordsAsRangeCoords(b?.cell) : Jl;
|
|
2757
2786
|
!b || b.ranges && b.ranges.length !== 0 || (b = { ranges: [he], rangeIndex: 0, cell: b.cell });
|
|
2758
2787
|
for (let de = 0; b && de < b.ranges.length; de++) {
|
|
2759
|
-
const
|
|
2760
|
-
|
|
2761
|
-
const F = 2, ke = 0.5, Pt = c.toClipBounds(c.getRangeCoordsBounds(
|
|
2788
|
+
const le = b.ranges[de], Et = W(le, de, de === b.rangeIndex ? b.cell : null);
|
|
2789
|
+
Et && p.push(Et);
|
|
2790
|
+
const F = 2, ke = 0.5, Pt = c.toClipBounds(c.getRangeCoordsBounds(le, { top: 0, left: 0, right: 0, bottom: 0 }), en);
|
|
2762
2791
|
if (Pt) {
|
|
2763
2792
|
const Re = (b.ranges.length, 4);
|
|
2764
|
-
p.push(me({ range:
|
|
2793
|
+
p.push(me({ range: le, key: `selection-inside-edge-${de}`, x: Pt.x - 1, y: Pt.y - 1, width: Math.max(Pt.width + 1, 0), height: Math.max(Pt.height + 1, 0), style: { overflow: "hidden" }, stroke: E, strokeWidth: Re }));
|
|
2765
2794
|
}
|
|
2766
2795
|
if (b.ranges.length === 1) {
|
|
2767
|
-
const Re = c.toClipBounds(c.getRangeCoordsBounds(
|
|
2796
|
+
const Re = c.toClipBounds(c.getRangeCoordsBounds(le), en);
|
|
2768
2797
|
if (Re) {
|
|
2769
|
-
K || p.push(me({ range:
|
|
2798
|
+
K || p.push(me({ range: le, key: `move-selection-hit-box-${de}`, x: Re.width > 1 ? Re.x : Re.x - (U / 2 + 1), y: Re.height > 1 ? Re.y : Re.y - (U / 2 + 1), width: Math.max(Re.width + 2, 1), height: Math.max(Re.height + 2, 1), stroke: "transparent", style: { boxShadow: "none" }, pathProps: { cursor: Ce ? void 0 : "move", pointerEvents: "stroke" }, strokeWidth: U, ..._t }));
|
|
2770
2799
|
const Te = F;
|
|
2771
|
-
p.push(me({ range:
|
|
2800
|
+
p.push(me({ range: le, key: `selection-single-${de}`, x: Re.x - Te / 2, y: Re.y - Te / 2, width: Math.max(Re.width + Te / 2, 1), height: Math.max(Re.height + Te / 2, 1), stroke: Y, strokeWidth: Te }));
|
|
2772
2801
|
}
|
|
2773
2802
|
} else {
|
|
2774
|
-
const Re = c.toClipBounds(c.getRangeCoordsBounds(
|
|
2775
|
-
Re && p.push(me({ range:
|
|
2803
|
+
const Re = c.toClipBounds(c.getRangeCoordsBounds(le, { top: -1, left: -1, right: -2, bottom: -2 }), en);
|
|
2804
|
+
Re && p.push(me({ range: le, key: `selection-multi-${de}`, x: Re.width > 1 ? Re.x : Re.x - ke / 2, y: Re.height > 1 ? Re.y : Re.y - ke / 2, width: Math.max(Re.width, ke) + 1, height: Math.max(Re.height, ke) + 1, stroke: Y, style: { overflow: "hidden" }, strokeWidth: 2 }));
|
|
2776
2805
|
}
|
|
2777
2806
|
if (b.ranges.length > 1 && de === b.rangeIndex) {
|
|
2778
2807
|
const Re = c.getCellCoordsAsRangeCoords(b.cell), Te = c.toClipBounds(c.getRangeCoordsBounds(Re, { top: 1, left: 1, right: -1, bottom: -1 }), en);
|
|
2779
|
-
Te && p.push(me({ range:
|
|
2808
|
+
Te && p.push(me({ range: le, key: `selection-anchor-${de}`, x: Te.x, y: Te.y, width: Math.max(Te.width, ke), height: Math.max(Te.height, ke), stroke: Y, style: { overflow: "hidden" }, strokeWidth: 2 }));
|
|
2780
2809
|
}
|
|
2781
2810
|
if (de === b.ranges.length - 1) {
|
|
2782
|
-
|
|
2783
|
-
const Re =
|
|
2811
|
+
h = null, w = null;
|
|
2812
|
+
const Re = le.rowStart === Se().top && le.rowEnd === Se().bottom, Te = le.colStart === Se().left && le.colEnd === Se().right, bt = c.getRangeCoordsBounds(le);
|
|
2784
2813
|
let Qt = null;
|
|
2785
2814
|
if (Re || Te) {
|
|
2786
2815
|
if (Qt = c.toClipBounds(bt, en), Object.keys(c.allViews()).length > 1) {
|
|
2787
|
-
const eo = c.getVisibleRangeCoords(), nr = c.allViews()[uo],
|
|
2788
|
-
(Te && (to === Hn && nr || to === Xt &&
|
|
2816
|
+
const eo = c.getVisibleRangeCoords(), nr = c.allViews()[uo], zi = c.allViews()[Hn], Ai = c.allViews()[Nn], to = c.getAnchor();
|
|
2817
|
+
(Te && (to === Hn && nr || to === Xt && Ai || !Z.isCellWithinRange({ colIndex: le.colStart, rowIndex: le.rowEnd }, eo) && !Z.isCellWithinRange({ colIndex: le.colStart, rowIndex: le.rowEnd + 1 }, eo)) || Re && (to === Nn && nr || to === Xt && zi || !Z.isCellWithinRange({ colIndex: le.colEnd, rowIndex: le.rowStart }, eo) && !Z.isCellWithinRange({ colIndex: le.colEnd + 1, rowIndex: le.rowStart }, eo))) && (Qt = null);
|
|
2789
2818
|
}
|
|
2790
2819
|
} else Qt = c.toClipBounds(bt, en);
|
|
2791
2820
|
if (!Qt || Qt.width === 0 || Qt.height === 0) continue;
|
|
2792
|
-
|
|
2821
|
+
h = { x: Qt.x + Qt.width + 1, y: Qt.y + Qt.height + 1 }, Qt.width === 0 || Qt.height === 0 || le.rowStart === Se().top && le.colStart === Se().left && le.rowEnd === Se().bottom && le.colEnd === Se().right || (Re ? (h.y = F, w = "tr") : Te && (h.x = F, w = "bl"));
|
|
2793
2822
|
}
|
|
2794
2823
|
}
|
|
2795
|
-
let
|
|
2824
|
+
let oe = null;
|
|
2796
2825
|
if (De) {
|
|
2797
2826
|
const de = c.toClipBounds(c.getRangeCoordsBounds(De, { top: 0, left: 0, right: 0, bottom: 0 }), en);
|
|
2798
|
-
de && (
|
|
2827
|
+
de && (oe = me({ ...v, range: De, key: "remove-selection", x: de.x, y: de.y, width: de.width, height: de.height, strokeWidth: 2, stroke: He, fill: Ve }));
|
|
2799
2828
|
}
|
|
2800
|
-
let
|
|
2829
|
+
let ie = null;
|
|
2801
2830
|
if (Mt) {
|
|
2802
2831
|
const de = c.toClipBounds(c.getRangeCoordsBounds(Mt, { top: 0, left: 0, right: 0, bottom: 0 }), en);
|
|
2803
|
-
de && (
|
|
2832
|
+
de && (ie = me({ range: Mt, key: "selection-fill-outline", x: de.x - 2 / 2, y: de.y - 2 / 2, width: de.width + 2 / 2, height: de.height + 2 / 2, strokeWidth: 2, stroke: Y, strokeDasharray: "3 2" }));
|
|
2804
2833
|
}
|
|
2805
2834
|
let ge = null;
|
|
2806
|
-
!
|
|
2835
|
+
!M && h && !Ce && (ge = Jo(Mi, { ...h, corner: w, size: 7.5, borderStroke: `${E} solid`, style: { borderRadius: 1 }, background: Y, ...Wt, key: "fillHandle" }));
|
|
2807
2836
|
const Le = [...p];
|
|
2808
|
-
if (
|
|
2809
|
-
const de = b.ranges[b.ranges.length - 1],
|
|
2810
|
-
Le.push(q(Go, { anchor:
|
|
2837
|
+
if (oe && Le.push(oe), ie && Le.push(ie), ge && Le.push(ge), !Ne && Tt && b?.ranges.length === 1 && b.ranges[b.ranges.length - 1]) {
|
|
2838
|
+
const de = b.ranges[b.ranges.length - 1], le = de.rowStart === Se().top && de.rowEnd === Se().bottom, Et = de.colStart === Se().left && de.colEnd === Se().right, F = { view: c, range: de, borderStroke: `${Y} solid`, background: E, selectionTouchPointerHandler: xo, ...at, onTouchSelectStart: (ke) => un(ke), onTouchSelectEnd: () => un(null), currentTouchAnchor: Cn };
|
|
2839
|
+
Le.push(q(Go, { anchor: Et ? "b" : le ? "r" : "br", scrollableElement: e.current, ...F }, "touch-select-handle-after")), Le.push(q(Go, { anchor: Et ? "t" : le ? "l" : "tl", scrollableElement: e.current, ...F }, "touch-select-handle-before"));
|
|
2811
2840
|
}
|
|
2812
2841
|
if (Ce) {
|
|
2813
2842
|
const de = c.toClipBounds(c.getRangeCoordsBounds(Ce, { top: 1, left: 1, right: 1, bottom: 1 }), en);
|
|
2814
|
-
de && Le.push(me({ range: Ce, key: "selection-move-outline", x: de.x -
|
|
2843
|
+
de && Le.push(me({ range: Ce, key: "selection-move-outline", x: de.x - te / 2, y: de.y - te / 2, width: Math.max(de.width + te / 2, 1), height: Math.max(de.height + te / 2, 1), stroke: Y, style: { boxShadow: "none", transitionDuration: "70ms", transitionTimingFunction: "ease-in", transitionProperty: "left, top, width, height", willChange: "left, top, width, height" }, strokeWidth: te }));
|
|
2815
2844
|
}
|
|
2816
2845
|
return q("div", { children: Le }, "selection");
|
|
2817
|
-
}, [Bt, De,
|
|
2846
|
+
}, [Bt, De, M, Mt, K, Ce, Se, E, Y, ne, He, Ve, Ne, at, Cn]), Dt = Ee(() => {
|
|
2818
2847
|
const c = () => e.current;
|
|
2819
|
-
return [new
|
|
2820
|
-
rn(),
|
|
2821
|
-
}), new
|
|
2848
|
+
return [new _e("moveToPageDown", c, { label: "Page Down", description: "Shift viewport down one page.", shortcut: [{ key: "PageDown" }] }, () => Xn(!1)), new _e("selectToPageDown", c, { label: "Select To Page Down", description: "Shift viewport and select down one page.", shortcut: [{ key: "PageDown", modifiers: [It] }] }, () => Xn(!0)), new _e("moveToPageRight", c, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [vn] }] }, () => Gn(!1)), new _e("selectToPageRight", c, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [vn, It] }] }, () => Gn(!0)), new _e("moveToPageUp", c, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp" }] }, () => Jt(!1)), new _e("selectToPageUp", c, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp", modifiers: [It] }] }, () => Jt(!0)), new _e("moveToPageLeft", c, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [vn] }] }, () => $n(!1)), new _e("selectToPageLeft", c, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [vn, It] }] }, () => $n(!0)), new _e("selectColumn", c, { label: "Select Column", description: "Select the columns for the selected cells.", shortcut: { key: "Space", modifiers: [zt] } }, yo), new _e("selectRow", c, { label: "Select Row", description: "Select the rows for the selected cells.", shortcut: { key: "Space", modifiers: [It] } }, vo), new _e("selectToColumnStart", c, { label: "Select To Column Start", description: "Select the columns to the beginning of the sheet." }, () => qn(!0)), new _e("selectToColumnEnd", c, { label: "Select To Column End", description: "Select the columns to the end of the sheet." }, () => Yn(!0)), new _e("moveToRowStart", c, { label: "Move to Row Home", description: "Move to the beginning of the row.", shortcut: [{ key: "Home" }] }, () => Dn(!1)), new _e("selectToRowStart", c, { label: "Select to Row Home", description: "Select to the beginning of the row.", shortcut: [{ key: "Home", modifiers: [It] }] }, () => Dn(!0)), new _e("moveToSheetStart", c, { label: "Move to Sheet Home", description: "Move to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [zt] }] }, () => Mn(!1)), new _e("selectToSheetStart", c, { label: "Select to Sheet Home", description: "Select to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [zt, It] }] }, () => Mn(!0)), new _e("moveToRowEnd", c, { label: "Move to Row End", description: "Move to the end of the row.", shortcut: [{ key: "End" }] }, () => zn(!1)), new _e("selectToRowEnd", c, { label: "Select to Row End", description: "Select to the end of the row.", shortcut: [{ key: "End", modifiers: [It] }] }, () => zn(!0)), new _e("moveToSheetEnd", c, { label: "Move to Sheet End", description: "Move to the end of the sheet.", shortcut: [{ key: "End", modifiers: [zt] }] }, () => yn(!1)), new _e("selectToSheetEnd", c, { label: "Select to Sheet End", description: "Select to the end of the sheet.", shortcut: [{ key: "End", modifiers: [zt, It] }] }, () => yn(!0)), new _e("scrollToActiveCoords", c, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell.", shortcut: { key: "Backspace", modifiers: [zt] } }, xn), new _e("scrollToActiveCoordsClearSelection", c, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell and clear selection.", shortcut: { key: "Backspace", modifiers: [It] } }, () => {
|
|
2849
|
+
rn(), yt(C.cell, !0);
|
|
2850
|
+
}), new _e("traverseSelectionRight", c, { label: "Traverse Right", description: "Traverse the selection moving rightward.", shortcut: { key: "Tab" } }, Jn), new _e("traverseSelectionLeft", c, { label: "Traverse Left", description: "Traverse the selection moving leftward.", shortcut: { key: "Tab", modifiers: [It] } }, Zn), new _e("traverseSelectionDown", c, { label: "Traverse Down", description: "Traverse the selection moving downward.", shortcut: [{ key: "Enter" }, { key: "NumpadEnter" }] }, Eo), new _e("traverseSelectionUp", c, { label: "Traverse Up", description: "Traverse the selection moving upward.", shortcut: [{ key: "Enter", modifiers: [It] }, { key: "NumpadEnter", modifiers: [It] }] }, _o), new _e("moveLeft", c, { label: "Move Left", description: "Move active cell to the left.", shortcut: [{ key: "ArrowLeft" }] }, Qn), new _e("selectLeft", c, { label: "Select Left", description: "Extend selection left.", shortcut: [{ key: "ArrowLeft", modifiers: [It] }] }, y), new _e("moveContentfulLeft", c, { label: "Move Left Contentful", description: "Move left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [zt] }] }, O), new _e("selectContentfulLeft", c, { label: "Select Left Contentful", description: "Extend selection left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [zt, It] }] }, A), new _e("moveRight", c, { label: "Move Right", description: "Move active cell to the right.", shortcut: [{ key: "ArrowRight" }] }, j), new _e("selectRight", c, { label: "Select Right", description: "Extend selection right.", shortcut: [{ key: "ArrowRight", modifiers: [It] }] }, V), new _e("moveContentfulRight", c, { label: "Move Right Contentful", description: "Move right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [zt] }] }, fe), new _e("selectContentfulRight", c, { label: "Select Right Contentful", description: "Extend selection right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [zt, It] }] }, ce), new _e("moveUp", c, { label: "Move Up", description: "Move active cell to the up.", shortcut: [{ key: "ArrowUp" }] }, xe), new _e("selectUp", c, { label: "Select Up", description: "Extend selection up.", shortcut: [{ key: "ArrowUp", modifiers: [It] }] }, ve), new _e("moveContentfulUp", c, { label: "Move Up Contentful", description: "Move up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [zt] }] }, ae), new _e("selectContentfulUp", c, { label: "Select Up Contentful", description: "Extend selection up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [zt, It] }] }, je), new _e("moveDown", c, { label: "Move Down", description: "Move active cell to the down.", shortcut: [{ key: "ArrowDown" }] }, ft), new _e("selectDown", c, { label: "Select Down", description: "Extend selection down.", shortcut: [{ key: "ArrowDown", modifiers: [It] }] }, Be), new _e("moveContentfulDown", c, { label: "Move Down Contentful", description: "Move down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [zt] }] }, Fe), new _e("selectContentfulDown", c, { label: "Select Down Contentful", description: "Extend selection down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [zt, It] }] }, gt), new _e("selectVisible", c, { label: "Select Visible", description: "Select visible cells only.", shortcut: { key: ";", modifiers: [vn] } }, bo), new _e("traverseSelectionPreviousRange", c, { label: "Traverse Previous Range", description: "Traverse the selection to the previous range.", shortcut: { key: "ArrowLeft", modifiers: [zt, vn] } }, Bn), new _e("traverseSelectionNextRange", c, { label: "Traverse Next Range", description: "Traverse the selection to the next range.", shortcut: { key: "ArrowRight", modifiers: [zt, vn] } }, Io), new _e("traverseSelectionCorners", c, { label: "Traverse Corners", description: "Traverse the selection through the corners of the selected range.", shortcut: { key: ".", modifiers: [zt] } }, Co)];
|
|
2822
2851
|
}, []);
|
|
2823
|
-
return
|
|
2852
|
+
return Ee(() => {
|
|
2824
2853
|
t?.addCommands(Dt, !0);
|
|
2825
|
-
}, [t]), { selection: Bt, setSelectionCell:
|
|
2854
|
+
}, [t]), { selection: Bt, setSelectionCell: yt, setSelectionRanges: mt, overlay: qt, cursor: cn, onPointerDown: mo, clearLastSelection: Xe, newSelection: tt, modifySelection: rt, appendSelection: ze, clearSelections: rn, isEntire: Lt, navigate: pt, navigateSelection: ln };
|
|
2826
2855
|
};
|
|
2827
2856
|
function ao(e, t) {
|
|
2828
2857
|
if (!e) throw new Error("Invariant failed");
|
|
2829
2858
|
}
|
|
2830
|
-
const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" },
|
|
2831
|
-
const { width: n, height: o, rowCount: r = 1, columnCount: i = 1, defaultRowHeight: l, defaultColumnWidth: s, getRowHeight: a, getColumnWidth: d, layout: g, onViewportScroll: m, onImmediateScroll:
|
|
2832
|
-
ao(
|
|
2833
|
-
const $ =
|
|
2834
|
-
const
|
|
2835
|
-
return nn.current = null, { getColOffset: (O) =>
|
|
2836
|
-
}, [dn, g, Y]), Kt = (
|
|
2859
|
+
const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, es = Object.freeze({ top: 0, left: 0 }), ts = Object.freeze({ bottom: -4, right: -4 }), ns = Object.freeze({ horizontal: !0, vertical: !0 }), Hr = [uo, Hn, Nn, Xt], ms = 150, sn = 3e3, Fo = {}, Pi = At(Ut((e, t) => {
|
|
2860
|
+
const { width: n, height: o, rowCount: r = 1, columnCount: i = 1, defaultRowHeight: l, defaultColumnWidth: s, getRowHeight: a, getColumnWidth: d, layout: g, onViewportScroll: m, onImmediateScroll: u, showGridLines: x = !0, gridLineColor: M = "rgb(224, 224, 224)", gridLineRowsProps: E, gridLineColumnsProps: P, clipCells: Q = !0, cursor: k, freezeLeft: I = 0, freezeTop: z = 0, freezeLeftProps: se, freezeTopProps: B, cellRenderer: re, onViewportChange: be, onFirstRender: N, overlayRenderer: H, overlayProps: X, overlays: T, overlaysProps: S, allowOverlaysOverflow: f = !1, stageProps: J, stageWrapper: K = null, hiddenRowsAt: L, hiddenColumnsAt: U, hiddenCellAt: te, getVisibleCells: ne, zoom: Y = 1, enableMouseWheel: He = !0, onWheelScroll: Ve, getCellCoordsAsRangeCoords: Ne = Z.cellToRange, scrollPoint: at = es, style: Se = {}, ...Ye } = e;
|
|
2861
|
+
ao(re), ao(!e?.children);
|
|
2862
|
+
const $ = R(u, [u]), _ = R(be, [be]), Me = R(m, [m]), ue = R(Ve, [Ve]), me = R(N, [N]), $e = G(null), dt = G(null), kt = G(null), [ut, Zt] = Qo((y) => y + 1, 0), [St, C] = Ze({ left: at?.left ?? 0, top: at?.top ?? 0, horizontalScrollDirection: null, verticalScrollDirection: null }), ye = G(null), Je = G(St), { top: mt, left: Qe, verticalScrollDirection: cn, horizontalScrollDirection: on } = St, Mt = G(!1), dn = Bl({ rowCount: r, columnCount: i, defaultRowHeight: l, defaultColumnWidth: s, getRowHeight: a, getColumnWidth: d }), nn = G(null), De = Ee(() => {
|
|
2863
|
+
const y = g || dn;
|
|
2864
|
+
return nn.current = null, { getColOffset: (O) => y.getColOffset(O) * Y, getColIndex: (O) => y.getColIndex(O / Y), getRowOffset: (O) => y.getRowOffset(O) * Y, getRowIndex: (O) => y.getRowIndex(O / Y) };
|
|
2865
|
+
}, [dn, g, Y]), Kt = (y, O, A) => {
|
|
2837
2866
|
const j = (O?.left ?? 0) + 0, V = (O?.top ?? 0) + 0;
|
|
2838
|
-
return { getColOffset: (fe) =>
|
|
2839
|
-
}, xt = D((
|
|
2867
|
+
return { getColOffset: (fe) => y.getColOffset(fe) - j, getColIndex: (fe) => y.getColIndex(fe + j), getRowOffset: (fe) => y.getRowOffset(fe) - V, getRowIndex: (fe) => y.getRowIndex(fe + V) };
|
|
2868
|
+
}, xt = D((y, O = !1) => go(y, O, De.getRowOffset, O ? 0 : r), [r, De?.getRowOffset]), Vt = R(L ?? xt, [L]), Cn = D((y, O = !1) => go(y, O, De.getColOffset, O ? i : 0), [i, De?.getColOffset]), un = R(U ?? Cn, [U]), We = Ee(() => Math.min(n ?? 800, De.getColOffset(i)), [De.getColOffset, i, n]), ee = Ee(() => Math.min(o ?? 600, De.getRowOffset(r)), [De.getRowOffset, r, o]), et = D((y) => {
|
|
2840
2869
|
Ct.canUseDOM && setTimeout(() => {
|
|
2841
|
-
$e.current?.focus({ preventScroll: !0, ...
|
|
2870
|
+
$e.current?.focus({ preventScroll: !0, ...y });
|
|
2842
2871
|
}, 0);
|
|
2843
|
-
}, []), Ue = D((
|
|
2872
|
+
}, []), Ue = D((y) => $e.current?.contains(y) || dt.current?.contains(y), []);
|
|
2844
2873
|
st(() => {
|
|
2845
|
-
Mt.current && (
|
|
2874
|
+
Mt.current && (ye.current && ye.current.left !== Je.current?.left && ye.current.top !== Je.current?.top || (ye.current = null, Me?.({ left: Qe, top: mt })));
|
|
2846
2875
|
}, [Qe, mt]);
|
|
2847
|
-
const ht =
|
|
2848
|
-
const
|
|
2876
|
+
const ht = R(() => ({ top: mt, left: Qe }), [mt, Qe]), Ie = Ee(() => {
|
|
2877
|
+
const y = [];
|
|
2849
2878
|
let O = 0, A = 0;
|
|
2850
2879
|
typeof z == "number" ? O = z : (O = z.index ?? 0, A = (z.scrollOffset ?? 0) * Y);
|
|
2851
2880
|
const j = A, V = De.getRowOffset(O), fe = V - j;
|
|
2852
2881
|
if (O > 0) {
|
|
2853
2882
|
const ft = Kt(De, { top: A + De.getRowOffset(0) }), Be = De.getRowIndex(j), Fe = De.getRowIndex(V - 1);
|
|
2854
2883
|
let gt;
|
|
2855
|
-
|
|
2884
|
+
y[1] = { minIndex: Be, maxIndex: Fe, minCoord: 0, maxCoord: O - 1, minBounds: 0, maxBounds: fe, visibleIndices: () => gt || (gt = Object.freeze(io(Vt, Be, Fe)), gt), layout: ft, maxVirtualBounds: V, scrollOffset: A, freezeOffset: A };
|
|
2856
2885
|
}
|
|
2857
|
-
const
|
|
2886
|
+
const ce = Math.max(0, ee - fe), xe = Kt(De, { top: mt + fe }), ve = xe.getRowIndex(0), ae = xe.getRowIndex(ce);
|
|
2858
2887
|
let je;
|
|
2859
|
-
return
|
|
2860
|
-
}, [De.getRowIndex, De.getRowOffset, Vt,
|
|
2861
|
-
const
|
|
2888
|
+
return y[0] = { minIndex: ve, maxIndex: ae, minCoord: O, maxCoord: r - 1, minBounds: fe, maxBounds: ce, visibleIndices: () => je || (je = Object.freeze(io(Vt, ve, ae)), je), layout: xe, maxVirtualBounds: De.getRowOffset(r), scrollOffset: mt, freezeOffset: (O > 0 ? De.getRowOffset(O) : 0) - A }, y;
|
|
2889
|
+
}, [De.getRowIndex, De.getRowOffset, Vt, ee, r, z, mt, Y]), Oe = Ee(() => {
|
|
2890
|
+
const y = [];
|
|
2862
2891
|
let O = 0, A = 0;
|
|
2863
2892
|
typeof I == "number" ? O = I : (O = I.index ?? 0, A = (I.scrollOffset ?? 0) * Y);
|
|
2864
2893
|
const j = A, V = De.getColOffset(O), fe = V - j;
|
|
2865
2894
|
if (O > 0) {
|
|
2866
2895
|
const ft = Kt(De, { left: A + De.getColOffset(0) }), Be = De.getColIndex(j), Fe = De.getColIndex(V - 1);
|
|
2867
2896
|
let gt;
|
|
2868
|
-
|
|
2897
|
+
y[1] = { minIndex: Be, maxIndex: Fe, minCoord: 0, maxCoord: O - 1, minBounds: 0, maxBounds: fe, visibleIndices: () => gt || (gt = Object.freeze(io(un, Be, Fe)), gt), layout: ft, maxVirtualBounds: V, scrollOffset: A, freezeOffset: A };
|
|
2869
2898
|
}
|
|
2870
|
-
const
|
|
2899
|
+
const ce = Math.max(0, We - fe), xe = Kt(De, { left: Qe + fe }), ve = xe.getColIndex(0), ae = xe.getColIndex(ce);
|
|
2871
2900
|
let je;
|
|
2872
|
-
return
|
|
2873
|
-
}, [De.getColIndex, De.getColOffset, un, We, i, I, Qe, Y]), rt = G({}), tt = G([]), ze =
|
|
2874
|
-
let
|
|
2875
|
-
const O = (j, V, fe,
|
|
2876
|
-
const
|
|
2901
|
+
return y[0] = { minIndex: ve, maxIndex: ae, minCoord: O, maxCoord: i - 1, minBounds: fe, maxBounds: ce, visibleIndices: () => je || (je = Object.freeze(io(un, ve, ae)), je), layout: xe, maxVirtualBounds: De.getColOffset(i), scrollOffset: Qe, freezeOffset: (O > 0 ? De.getColOffset(O) : 0) - A }, y;
|
|
2902
|
+
}, [De.getColIndex, De.getColOffset, un, We, i, I, Qe, Y]), rt = G({}), tt = G([]), ze = Ee(() => {
|
|
2903
|
+
let y = {};
|
|
2904
|
+
const O = (j, V, fe, ce, xe) => {
|
|
2905
|
+
const ve = { vertical: ce?.vertical || !1, horizontal: ce?.horizontal || !1 };
|
|
2877
2906
|
if (j >= Oe.length || V >= Ie.length) return null;
|
|
2878
|
-
const
|
|
2879
|
-
if (
|
|
2880
|
-
const je = { getColIndex: (Ce) => Oe[j].layout.getColIndex(Ce), getColOffset: (Ce) => Oe[j].layout.getColOffset(Ce), getRowIndex: (Ce) => Ie[V].layout.getRowIndex(Ce), getRowOffset: (Ce) => Ie[V].layout.getRowOffset(Ce) }, ft = Object.freeze({ left: xe?.left ?? 0, top: xe?.top ?? 0, right: xe?.right ?? 0, bottom: xe?.bottom ?? 0 }), Be = Object.freeze({ x: Oe[j].minBounds, y: Ie[V].minBounds, width: Oe[j].maxBounds, height: Ie[V].maxBounds }), Fe = (Ce, Ge) => Fr(je, Ce ??
|
|
2907
|
+
const ae = { rowStart: Ie[V].minIndex, colStart: Oe[j].minIndex, rowEnd: Ie[V].maxIndex, colEnd: Oe[j].maxIndex };
|
|
2908
|
+
if (ae.rowStart > ae.rowEnd || ae.colStart > ae.colEnd) return null;
|
|
2909
|
+
const je = { getColIndex: (Ce) => Oe[j].layout.getColIndex(Ce), getColOffset: (Ce) => Oe[j].layout.getColOffset(Ce), getRowIndex: (Ce) => Ie[V].layout.getRowIndex(Ce), getRowOffset: (Ce) => Ie[V].layout.getRowOffset(Ce) }, ft = Object.freeze({ left: xe?.left ?? 0, top: xe?.top ?? 0, right: xe?.right ?? 0, bottom: xe?.bottom ?? 0 }), Be = Object.freeze({ x: Oe[j].minBounds, y: Ie[V].minBounds, width: Oe[j].maxBounds, height: Ie[V].maxBounds }), Fe = (Ce, Ge) => Fr(je, Ce ?? ae, Ge), gt = { width: Oe[j].maxVirtualBounds, height: Ie[V].maxVirtualBounds }, Xe = { left: Oe[j].scrollOffset, top: Ie[V].scrollOffset }, Lt = { left: Oe[j].freezeOffset, top: Ie[V].freezeOffset }, yt = { width: We, height: ee };
|
|
2881
2910
|
let pe = null, wt = null;
|
|
2882
|
-
const $t = (Lt.top + (
|
|
2883
|
-
return { getStage: () => $e.current ?? null, getVisibleRangeCoords: () =>
|
|
2911
|
+
const $t = (Lt.top + (ce.vertical ? Xe.top : 0)) / Y, Wt = (Lt.left + (ce.horizontal ? Xe.left : 0)) / Y;
|
|
2912
|
+
return { getStage: () => $e.current ?? null, getVisibleRangeCoords: () => ae, toClipBounds: (Ce, Ge) => {
|
|
2884
2913
|
let Ae, ct = 0;
|
|
2885
|
-
return Ge === void 0 || typeof Ge == "number" ? (Ae = Fe(
|
|
2886
|
-
if (Pe.x >
|
|
2887
|
-
const Bt = { left: Pe.x, top: Pe.y, bottom: Pe.height + Pe.y, right: Pe.width + Pe.x }, qt = { left:
|
|
2914
|
+
return Ge === void 0 || typeof Ge == "number" ? (Ae = Fe(ae), ct = Ge) : Ae = Ge, ((Pe, _t, vt = 0) => {
|
|
2915
|
+
if (Pe.x > _t.width || Pe.y > _t.height) return null;
|
|
2916
|
+
const Bt = { left: Pe.x, top: Pe.y, bottom: Pe.height + Pe.y, right: Pe.width + Pe.x }, qt = { left: _t.x + vt, top: _t.y + vt, bottom: _t.height - 2 * vt + _t.y, right: _t.width - 2 * vt + _t.x }, Dt = { left: Math.max(Bt.left, qt.left), top: Math.max(Bt.top, qt.top), bottom: Math.min(Bt.bottom, qt.bottom), right: Math.min(Bt.right, qt.right) }, c = { x: Dt.left, y: Dt.top, width: Dt.right - Dt.left, height: Dt.bottom - Dt.top };
|
|
2888
2917
|
return c.height < 0 || c.width < 0 ? null : c;
|
|
2889
2918
|
})(Ce ?? { x: 0, y: 0, width: Be.width, height: Be.height }, Ae, ct);
|
|
2890
2919
|
}, toViewBounds: (Ce) => Wt === 0 && $t === 0 && Y === 1 ? Ce : { x: (Ce.x - Wt) * Y, y: (Ce.y - $t) * Y, width: Ce.width * Y, height: Ce.height * Y }, toAbsoluteBounds: (Ce) => Wt === 0 && $t === 0 && Y === 1 ? Ce : { x: Ce.x / Y + Wt, y: Ce.y / Y + $t, width: Ce.width / Y, height: Ce.height / Y }, getRelativePointFromClient: (Ce, Ge) => {
|
|
2891
2920
|
const Ae = hn(Ce, Ge);
|
|
2892
2921
|
return { x: Ae.x - Be.x, y: Ae.y - Be.y };
|
|
2893
|
-
}, getLayout: () => je, getCellCoordsAsRangeCoords: Ne, getVisibleColumns: () => Oe[j].visibleIndices(), getVisibleRows: () => Ie[V].visibleIndices(), getVisibleColumnOffsets: () => (pe || (pe = Br(Oe[j].layout, !0, Oe[j].visibleIndices(),
|
|
2922
|
+
}, getLayout: () => je, getCellCoordsAsRangeCoords: Ne, getVisibleColumns: () => Oe[j].visibleIndices(), getVisibleRows: () => Ie[V].visibleIndices(), getVisibleColumnOffsets: () => (pe || (pe = Br(Oe[j].layout, !0, Oe[j].visibleIndices(), ae.colStart, ae.colEnd)), pe), getVisibleRowOffsets: () => (wt || (wt = Br(Ie[V].layout, !1, Ie[V].visibleIndices(), ae.rowStart, ae.rowEnd)), wt), getTotalRangeCoords: () => ({ colStart: Oe[j].minCoord, colEnd: Oe[j].maxCoord, rowStart: Ie[V].minCoord, rowEnd: Ie[V].maxCoord }), getRangeCoordsBounds: Fe, scrollCellCoordsIntoView: (Ce, Ge) => Dn(Ce, Ge, fe), getCellCoordsFromClient: (Ce, Ge, Ae = !1) => {
|
|
2894
2923
|
const ct = hn(Ce, Ge);
|
|
2895
2924
|
if (!ct) return null;
|
|
2896
|
-
const Pe = je.getColIndex(ct.x - Be.x),
|
|
2897
|
-
if (Ae) return
|
|
2898
|
-
const
|
|
2899
|
-
return { rowIndex:
|
|
2900
|
-
}, getZoom: () => Y, getAnchor: () => fe, getBounds: () => Be, getInsets: () => ft, getTotalSize: () => gt, getViewportSize: () =>
|
|
2925
|
+
const Pe = je.getColIndex(ct.x - Be.x), _t = { rowIndex: je.getRowIndex(ct.y - Be.y), colIndex: Pe };
|
|
2926
|
+
if (Ae) return _t;
|
|
2927
|
+
const vt = Ne(_t);
|
|
2928
|
+
return { rowIndex: vt.rowStart, colIndex: vt.colStart };
|
|
2929
|
+
}, getZoom: () => Y, getAnchor: () => fe, getBounds: () => Be, getInsets: () => ft, getTotalSize: () => gt, getViewportSize: () => yt, getScrollTopLeft: () => Xe, getFreezeTopLeft: () => Lt, getScrollOrientation: () => ve, allViews: () => y };
|
|
2901
2930
|
};
|
|
2902
|
-
let A =
|
|
2903
|
-
return A && (
|
|
2904
|
-
}, [Ie, Oe, Ne]), rn = Object.keys(ze), Tt = Oe[0]?.maxVirtualBounds ?? 0, nt = Ie[0]?.maxVirtualBounds ?? 0, Rt =
|
|
2931
|
+
let A = y[Xt] = O(0, 0, Xt, ns, ts);
|
|
2932
|
+
return A && (y[Xt] = A), A = O(0, 1, Hn, { horizontal: !0 }), A && (y[Hn] = A), A = O(1, 0, Nn, { vertical: !0 }), A && (y[Nn] = A), A = O(1, 1, uo, {}), A && (y[uo] = A), rt.current = null, y = Object.freeze(y);
|
|
2933
|
+
}, [Ie, Oe, Ne]), rn = Object.keys(ze), Tt = Oe[0]?.maxVirtualBounds ?? 0, nt = Ie[0]?.maxVirtualBounds ?? 0, Rt = Ee(() => ({ left: Oe[1] ? Oe[1].layout.getColOffset(Oe[1].maxIndex + 1) : 0, top: Ie[1] ? Ie[1].layout.getRowOffset(Ie[1].maxIndex + 1) : 0 }), [ze]);
|
|
2905
2934
|
st(() => {
|
|
2906
2935
|
if (tt.current.length > 0) {
|
|
2907
|
-
for (let
|
|
2936
|
+
for (let y = 0; y < tt.current.length; y++) tt.current[y]();
|
|
2908
2937
|
tt.current = [];
|
|
2909
2938
|
}
|
|
2910
2939
|
}, [ze]);
|
|
2911
|
-
const Ot =
|
|
2940
|
+
const Ot = R(() => ({ containerWidth: We, containerHeight: ee, totalWidth: Tt, totalHeight: nt }), [We, ee, De]);
|
|
2912
2941
|
st(() => {
|
|
2913
|
-
!
|
|
2942
|
+
!ye.current && Mt.current && _({ top: mt, left: Qe, width: We, height: ee, totalWidth: Tt, totalHeight: nt });
|
|
2914
2943
|
}, [mt, Qe, Tt, nt]), st(() => {
|
|
2915
|
-
Mt.current &&
|
|
2916
|
-
}, [We,
|
|
2917
|
-
const hn = D((
|
|
2918
|
-
ao(typeof
|
|
2944
|
+
Mt.current && _({ top: mt, left: Qe, width: We, height: ee, totalWidth: Tt, totalHeight: nt });
|
|
2945
|
+
}, [We, ee]);
|
|
2946
|
+
const hn = D((y, O) => {
|
|
2947
|
+
ao(typeof y == "number" && typeof O == "number");
|
|
2919
2948
|
const A = $e.current?.getBoundingClientRect();
|
|
2920
|
-
return A ? { x:
|
|
2921
|
-
}, []), mo =
|
|
2949
|
+
return A ? { x: y - A.x, y: O - A.y } : { x: y, y: O };
|
|
2950
|
+
}, []), mo = R((y) => ze[y] || null, [ze]), xo = R((y, O) => {
|
|
2922
2951
|
if (Object.keys(ze).length === 1) return ze[Xt];
|
|
2923
|
-
const A = hn(
|
|
2952
|
+
const A = hn(y, O);
|
|
2924
2953
|
if (!A) return null;
|
|
2925
2954
|
const { x: j, y: V } = A;
|
|
2926
2955
|
let fe = null;
|
|
2927
|
-
const
|
|
2928
|
-
for (let xe = 0; !fe && xe <
|
|
2929
|
-
const
|
|
2930
|
-
|
|
2956
|
+
const ce = Hr;
|
|
2957
|
+
for (let xe = 0; !fe && xe < ce.length; xe++) {
|
|
2958
|
+
const ve = ze[ce[xe]];
|
|
2959
|
+
ve && Kl(j, V, ve.getBounds()) && (fe = ve);
|
|
2931
2960
|
}
|
|
2932
2961
|
return fe || (fe = ze[Xt]), fe;
|
|
2933
|
-
}, [ze, Ne]), pt =
|
|
2934
|
-
ln.current !== null && Ct.cancelTimeout(ln.current), ln.current = Ct.requestTimeout(
|
|
2935
|
-
}, []),
|
|
2936
|
-
ln.current = null, C((
|
|
2937
|
-
const O = { ...
|
|
2962
|
+
}, [ze, Ne]), pt = R(() => ze[Xt].getVisibleRangeCoords(), [ze[Xt]]), ln = G(null), yo = D(() => {
|
|
2963
|
+
ln.current !== null && Ct.cancelTimeout(ln.current), ln.current = Ct.requestTimeout(vo, 150);
|
|
2964
|
+
}, []), vo = D(() => {
|
|
2965
|
+
ln.current = null, C((y) => {
|
|
2966
|
+
const O = { ...y, verticalScrollDirection: null, horizontalScrollDirection: null };
|
|
2938
2967
|
return Je.current = O, O;
|
|
2939
2968
|
});
|
|
2940
|
-
}, []), xn =
|
|
2941
|
-
const O =
|
|
2969
|
+
}, []), xn = R((y) => {
|
|
2970
|
+
const O = y?.left ?? y?.[0], A = y?.top ?? y?.[1], j = O !== void 0 ? Math.min(Tt - We, Math.max(Oe?.[1]?.scrollOffset ?? 0, O)) : Je.current.left, V = A !== void 0 ? Math.min(nt - ee, Math.max(Ie?.[1]?.scrollOffset ?? 0, A)) : Je.current.top;
|
|
2942
2971
|
if (Je.current.left === j && Je.current.top === V) return;
|
|
2943
|
-
let fe = null,
|
|
2944
|
-
Je.current.left > j ? fe = ot : Je.current.left < j && (fe = Ke), Je.current.top > V ?
|
|
2972
|
+
let fe = null, ce = null;
|
|
2973
|
+
Je.current.left > j ? fe = ot : Je.current.left < j && (fe = Ke), Je.current.top > V ? ce = it : Je.current.top < V && (ce = lt), Ct.throttle(() => {
|
|
2945
2974
|
C((xe) => {
|
|
2946
|
-
const
|
|
2947
|
-
return Je.current =
|
|
2975
|
+
const ve = { ...xe, left: j, top: V, horizontalScrollDirection: fe, verticalScrollDirection: ce };
|
|
2976
|
+
return Je.current = ve, ve;
|
|
2948
2977
|
});
|
|
2949
|
-
}, 17)(),
|
|
2978
|
+
}, 17)(), ye.current?.top === V && ye.current?.left === j || (ye.current = { left: j, top: V }, $({ left: j, top: V }), _({ left: j, top: V, width: We, height: ee, totalWidth: Tt, totalHeight: nt })), yo();
|
|
2950
2979
|
}, [Tt, nt, Ie, Oe]);
|
|
2951
2980
|
st(() => {
|
|
2952
|
-
|
|
2953
|
-
}, [Tt, We, nt,
|
|
2954
|
-
|
|
2981
|
+
ye.current || xn({ left: Qe, top: mt });
|
|
2982
|
+
}, [Tt, We, nt, ee]), tn(() => {
|
|
2983
|
+
ye.current = { left: at?.left, top: at?.top }, xn(ye.current);
|
|
2955
2984
|
}, [at?.left, at?.top]);
|
|
2956
|
-
const qn =
|
|
2957
|
-
const O =
|
|
2985
|
+
const qn = R((y) => {
|
|
2986
|
+
const O = y?.left ?? y?.[0], A = y?.top ?? y?.[1], j = y?.behavior ?? "auto", V = { left: Je.current.left + (O ?? 0), top: Je.current.top + (A ?? 0) };
|
|
2958
2987
|
j && (V.behavior = j), xn(V);
|
|
2959
|
-
}, [Tt, We, nt,
|
|
2988
|
+
}, [Tt, We, nt, ee]), Yn = D((y) => {
|
|
2960
2989
|
let O = null;
|
|
2961
2990
|
if (Object.keys(ze).length > 1) {
|
|
2962
2991
|
const A = Hr;
|
|
2963
2992
|
for (let j = 0; !O && j < A.length; j++) {
|
|
2964
2993
|
const V = ze[A[j]];
|
|
2965
|
-
V && Z.isCellWithinRange(
|
|
2994
|
+
V && Z.isCellWithinRange(y, V.getVisibleRangeCoords()) && (O = V);
|
|
2966
2995
|
}
|
|
2967
2996
|
}
|
|
2968
2997
|
return O || (O = ze[Xt]), O;
|
|
2969
|
-
}, [ze]), Dn =
|
|
2970
|
-
const j = { rowIndex: 0, colIndex: 0, ...
|
|
2998
|
+
}, [ze]), Dn = R((y, O = { inline: "nearest", block: "nearest" }, A = null) => {
|
|
2999
|
+
const j = { rowIndex: 0, colIndex: 0, ...y };
|
|
2971
3000
|
let V = null;
|
|
2972
3001
|
if (A !== null) {
|
|
2973
|
-
if (V = ze[A], V === null) return new Promise((
|
|
3002
|
+
if (V = ze[A], V === null) return new Promise((yt, pe) => {
|
|
2974
3003
|
pe("Invalid view");
|
|
2975
3004
|
});
|
|
2976
3005
|
} else V = Yn(j);
|
|
2977
|
-
const fe = Ne(j),
|
|
3006
|
+
const fe = Ne(j), ce = V.getLayout(), xe = ce.getColOffset(fe.colStart), ve = ce.getRowOffset(fe.rowStart), ae = ce.getColOffset(fe.colEnd + 1), je = ce.getRowOffset(fe.rowEnd + 1), ft = V.getBounds(), Be = V.getTotalSize(), Fe = V.getScrollTopLeft(), gt = ((yt, pe, wt = !0) => (wt = wt === !0 ? { block: "start", inline: "end" } : wt === !1 ? { block: "end", inline: "end" } : { block: "end", inline: "end", ...wt }, { left: zr(wt.inline, yt.x, yt.x + yt.width, pe.left, pe.left + pe.width, pe.totalWidth), top: zr(wt.block, yt.y, yt.y + yt.height, pe.top, pe.top + pe.height, pe.totalHeight) }))({ x: xe + Fe.left, y: ve + Fe.top, width: ae - xe, height: je - ve }, { left: Fe.left, top: Fe.top, width: ft.width, height: ft.height, totalWidth: Be.width, totalHeight: Be.height }, O), Xe = { ...gt };
|
|
2978
3007
|
Xe.left > Qe ? Xe.left += 20 : Xe.left < Qe && (Xe.left -= 0), Xe.top > mt ? Xe.top += 20 : Xe.top < mt && (Xe.top -= 0);
|
|
2979
3008
|
const Lt = V.getScrollOrientation();
|
|
2980
|
-
return Lt.horizontal &&
|
|
3009
|
+
return Lt.horizontal && y.colIndex !== void 0 || delete Xe.left, Lt.vertical && y.rowIndex !== void 0 || delete Xe.top, new Promise((yt, pe) => {
|
|
2981
3010
|
try {
|
|
2982
|
-
xn(Xe),
|
|
3011
|
+
xn(Xe), yt(Xe);
|
|
2983
3012
|
} catch (wt) {
|
|
2984
3013
|
pe(wt);
|
|
2985
3014
|
}
|
|
2986
3015
|
});
|
|
2987
|
-
}, [Tt, nt, ze, Ne]), Mn =
|
|
2988
|
-
const O =
|
|
2989
|
-
|
|
2990
|
-
const { deltaX: A, deltaY: j, deltaMode: V } =
|
|
2991
|
-
if (kt.current || ue?.(
|
|
2992
|
-
let
|
|
2993
|
-
const
|
|
3016
|
+
}, [Tt, nt, ze, Ne]), Mn = R((y) => {
|
|
3017
|
+
const O = y.shiftKey;
|
|
3018
|
+
y.preventDefault();
|
|
3019
|
+
const { deltaX: A, deltaY: j, deltaMode: V } = y;
|
|
3020
|
+
if (kt.current || ue?.(y) === !1) return;
|
|
3021
|
+
let ce = O ? j : A, xe = j;
|
|
3022
|
+
const ve = O || Math.abs(ce) > Math.abs(xe);
|
|
2994
3023
|
V === 1 && (xe *= 0), kt.current = window.requestAnimationFrame(() => {
|
|
2995
|
-
kt.current = null, qn(
|
|
3024
|
+
kt.current = null, qn(ve ? { left: ce } : { top: xe });
|
|
2996
3025
|
});
|
|
2997
|
-
}, [Tt, We, nt,
|
|
3026
|
+
}, [Tt, We, nt, ee, ue]), zn = D((y = null) => {
|
|
2998
3027
|
nn.current = null, rt.current = null, Zt();
|
|
2999
3028
|
}, []);
|
|
3000
3029
|
tn(() => {
|
|
3001
3030
|
zn();
|
|
3002
|
-
}, [
|
|
3003
|
-
const
|
|
3004
|
-
tt.current.push(
|
|
3031
|
+
}, [re]);
|
|
3032
|
+
const yn = wo(t, () => ({ stage: $e.current, focus: et, contains: Ue, invalidate: zn, scrollTo: xn, scrollBy: qn, scrollCellCoordsIntoView: Dn, getScrollPosition: ht, getDimensions: Ot, getViewport: pt, handleWheel: Mn, rowCount: r, columnCount: i, getLayout: () => De, getRelativePointFromClient: hn, getViewFromClient: xo, getViewFromCellCoords: Yn, getViewFromLocation: mo, onViewChangeOnce: (y) => {
|
|
3033
|
+
tt.current.push(y);
|
|
3005
3034
|
} }), [r, i, ze]);
|
|
3006
|
-
st(() => (He &&
|
|
3007
|
-
|
|
3035
|
+
st(() => (He && yn.current?.addEventListener("wheel", Mn, { passive: !1 }), Mt.current = !0, ye.current = null, () => {
|
|
3036
|
+
yn.current?.removeEventListener("wheel", Mn);
|
|
3008
3037
|
}), [He]);
|
|
3009
|
-
const An = G([]), bo = (
|
|
3010
|
-
!
|
|
3038
|
+
const An = G([]), bo = (y, O) => {
|
|
3039
|
+
!y || !H || (An.current = [], O.push(((A, j) => {
|
|
3011
3040
|
const V = `view:${A.getAnchor()}:overlay:${O.length}`, fe = H?.({ key: V, view: A }, (xe) => An.current[j] = xe);
|
|
3012
3041
|
if (!fe) return null;
|
|
3013
|
-
const
|
|
3014
|
-
return q("div", { style: { position: "absolute", left: "0px", top: "0px", width: `${
|
|
3015
|
-
})(
|
|
3016
|
-
}, So =
|
|
3017
|
-
const
|
|
3042
|
+
const ce = A.getBounds();
|
|
3043
|
+
return q("div", { style: { position: "absolute", left: "0px", top: "0px", width: `${ce.width}px`, height: `${ce.height}px`, overflow: "hidden" }, children: fe }, `overlay-${A.getAnchor()}-${j}`);
|
|
3044
|
+
})(y, 0)));
|
|
3045
|
+
}, So = Ee(() => {
|
|
3046
|
+
const y = {}, O = Object.keys(ze);
|
|
3018
3047
|
for (let A = 0; A < O.length; A++) {
|
|
3019
3048
|
const j = O[A], V = [];
|
|
3020
|
-
bo(ze[j], V),
|
|
3049
|
+
bo(ze[j], V), y[j] = { overlays: V };
|
|
3021
3050
|
}
|
|
3022
|
-
return
|
|
3023
|
-
}, [ut, H, r, i, Ie, Oe]), Xn = (
|
|
3024
|
-
if (!
|
|
3025
|
-
const xe =
|
|
3026
|
-
if (xe.length === 0 ||
|
|
3027
|
-
let
|
|
3028
|
-
if (
|
|
3051
|
+
return y;
|
|
3052
|
+
}, [ut, H, r, i, Ie, Oe]), Xn = (y, O, A, j, V, fe, ce) => {
|
|
3053
|
+
if (!y) return;
|
|
3054
|
+
const xe = y.getVisibleColumns(), ve = y.getVisibleRows();
|
|
3055
|
+
if (xe.length === 0 || ve.length === 0) return;
|
|
3056
|
+
let ae = null;
|
|
3057
|
+
if (ne) ae = ne(y);
|
|
3029
3058
|
else {
|
|
3030
|
-
|
|
3031
|
-
for (let Ge = 0; Ge <
|
|
3032
|
-
const ct = { rowIndex:
|
|
3033
|
-
if (
|
|
3059
|
+
ae = [];
|
|
3060
|
+
for (let Ge = 0; Ge < ve.length; Ge++) for (let Ae = 0; Ae < xe.length; Ae++) {
|
|
3061
|
+
const ct = { rowIndex: ve[Ge], colIndex: xe[Ae] };
|
|
3062
|
+
if (te?.(ct)) continue;
|
|
3034
3063
|
const Pe = { coords: ct, range: Ne(ct) };
|
|
3035
|
-
|
|
3064
|
+
ae.push(Pe);
|
|
3036
3065
|
}
|
|
3037
3066
|
}
|
|
3038
|
-
const je =
|
|
3039
|
-
const
|
|
3067
|
+
const je = y.getVisibleColumnOffsets(), ft = y.getVisibleRowOffsets(), Be = y.getScrollTopLeft(), Fe = y.getFreezeTopLeft(), gt = Be.left + Fe.left, Xe = Be.top + Fe.top, Lt = Math.trunc(gt / sn), yt = Math.trunc(Xe / sn), pe = {}, wt = (Ge, Ae, ct, Pe, _t) => {
|
|
3068
|
+
const vt = `view:${Ge.getAnchor()}:cell:${Dr(Ae.rowIndex, Ae.colIndex)}`, Bt = Pe.x, qt = Pe.y, Dt = Math.trunc((gt + Bt) / sn) - Lt, c = Math.trunc((Xe + qt) / sn) - yt;
|
|
3040
3069
|
pe[c] || (pe[c] = {});
|
|
3041
|
-
let
|
|
3042
|
-
|
|
3043
|
-
let w = fe?.get(
|
|
3070
|
+
let h = pe[c][Dt];
|
|
3071
|
+
h || (h = pe[c][Dt] = []);
|
|
3072
|
+
let w = fe?.get(vt);
|
|
3044
3073
|
if (!w) {
|
|
3045
|
-
const p = (gt + Bt) % sn,
|
|
3046
|
-
w =
|
|
3074
|
+
const p = (gt + Bt) % sn, v = (Xe + qt) % sn;
|
|
3075
|
+
w = re({ key: vt, coords: Ae, bounds: Pe, zoom: Y, range: ct, view: Ge, value: _t, style: { left: we.boundPixel(p), top: we.boundPixel(v), width: we.boundPixel(Pe.width, !0), height: we.boundPixel(Pe.height, !0) } });
|
|
3047
3076
|
}
|
|
3048
|
-
|
|
3077
|
+
ce?.set(vt, w), h.push(w);
|
|
3049
3078
|
};
|
|
3050
|
-
for (let Ge = 0;
|
|
3051
|
-
const Ae =
|
|
3079
|
+
for (let Ge = 0; ae && Ge < ae.length; Ge++) {
|
|
3080
|
+
const Ae = ae[Ge], ct = Ae?.coords ?? Ae;
|
|
3052
3081
|
if (!ct) continue;
|
|
3053
|
-
const Pe = Ae?.range ?? { rowStart: ct.rowIndex, colStart: ct.colIndex, rowEnd: ct.rowIndex, colEnd: ct.colIndex },
|
|
3054
|
-
if (!Z.isRangesIntersect(Pe,
|
|
3055
|
-
const
|
|
3056
|
-
if (!
|
|
3082
|
+
const Pe = Ae?.range ?? { rowStart: ct.rowIndex, colStart: ct.colIndex, rowEnd: ct.rowIndex, colEnd: ct.colIndex }, _t = y.getVisibleRangeCoords();
|
|
3083
|
+
if (!Z.isRangesIntersect(Pe, _t) && !Z.isRangeWithinRange(Pe, _t)) continue;
|
|
3084
|
+
const vt = Pe && !Z.isSingleCell(Pe);
|
|
3085
|
+
if (!vt && te?.(ct)) continue;
|
|
3057
3086
|
const Bt = ct.rowIndex, qt = ct.colIndex, Dt = ft[Bt], c = je[qt];
|
|
3058
|
-
let
|
|
3059
|
-
Dt && c && (
|
|
3087
|
+
let h = null;
|
|
3088
|
+
Dt && c && (h = { x: c.offset, y: Dt.offset, width: c.size, height: Dt.size });
|
|
3060
3089
|
const w = Dr(Pe.rowStart, Pe.colStart);
|
|
3061
|
-
if (
|
|
3090
|
+
if (vt) {
|
|
3062
3091
|
if (V.has(w)) continue;
|
|
3063
3092
|
V.add(w), Pe.rowEnd - Pe.rowStart > 0 && A.push(Pe), Pe.colEnd - Pe.colStart > 0 && j.push(Pe);
|
|
3064
3093
|
}
|
|
3065
|
-
if (
|
|
3094
|
+
if (vt && (h = Fr(y.getLayout(), Pe)), !h) {
|
|
3066
3095
|
console.warn("no bounds for cell", w);
|
|
3067
3096
|
continue;
|
|
3068
3097
|
}
|
|
3069
3098
|
const p = Ae?.value;
|
|
3070
|
-
wt(
|
|
3099
|
+
wt(y, ct, Pe, h, p);
|
|
3071
3100
|
}
|
|
3072
3101
|
const $t = gt % sn, Wt = Xe % sn, Ce = Object.keys(pe);
|
|
3073
3102
|
for (let Ge = 0; Ge < Ce.length; Ge++) {
|
|
@@ -3075,186 +3104,186 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ts = Object.freeze({ top
|
|
|
3075
3104
|
if (!Ae) continue;
|
|
3076
3105
|
const ct = Object.keys(Ae);
|
|
3077
3106
|
for (let Pe = 0; Pe < ct.length; Pe++) {
|
|
3078
|
-
const
|
|
3079
|
-
if (!
|
|
3080
|
-
const
|
|
3081
|
-
O.push(q("div", { className: "cell-container", style: { transform: `translate(${we.boundPixel(Bt * sn - $t, !0)}px, ${we.boundPixel(
|
|
3107
|
+
const _t = Ae[ct[Pe]];
|
|
3108
|
+
if (!_t) continue;
|
|
3109
|
+
const vt = parseInt(Ce[Ge]), Bt = parseInt(ct[Pe]), qt = vt + yt, Dt = Bt + Lt, c = `view:${y.getAnchor()}:segment:${Dt}:${qt}`;
|
|
3110
|
+
O.push(q("div", { className: "cell-container", style: { transform: `translate(${we.boundPixel(Bt * sn - $t, !0)}px, ${we.boundPixel(vt * sn - Wt, !0)}px)`, willChange: "transform" }, children: _t }, c));
|
|
3082
3111
|
}
|
|
3083
3112
|
}
|
|
3084
|
-
}, Jt =
|
|
3085
|
-
const
|
|
3113
|
+
}, Jt = Ee(() => {
|
|
3114
|
+
const y = nn.current, O = /* @__PURE__ */ new Map(), A = {}, j = Object.keys(ze);
|
|
3086
3115
|
for (let V = 0; V < j.length; V++) {
|
|
3087
|
-
const fe = j[V],
|
|
3088
|
-
Xn(ze[fe],
|
|
3116
|
+
const fe = j[V], ce = [], xe = [], ve = [];
|
|
3117
|
+
Xn(ze[fe], ve, ce, xe, /* @__PURE__ */ new Set(), y, O), A[fe] = { cells: ve, rangesH: ce, rangesV: xe };
|
|
3089
3118
|
}
|
|
3090
3119
|
return nn.current = O, A;
|
|
3091
|
-
}, [ut, r, i, Ie, Oe, x, Se,
|
|
3092
|
-
if (
|
|
3093
|
-
const fe = `view:${
|
|
3094
|
-
if (!
|
|
3095
|
-
const xe = 0,
|
|
3096
|
-
let
|
|
3097
|
-
const je = V.sort(Z.rowFirstRangeComparator), ft =
|
|
3098
|
-
for (let Be = 0; Be <
|
|
3099
|
-
const Fe =
|
|
3120
|
+
}, [ut, r, i, Ie, Oe, x, Se, Q, te, ne, Ne]), Gn = (y, O, A, j, V) => {
|
|
3121
|
+
if (y) if (O) {
|
|
3122
|
+
const fe = `view:${y.getAnchor()}:hl:`, ce = y.getVisibleRows();
|
|
3123
|
+
if (!ce || ce.length === 0) return;
|
|
3124
|
+
const xe = 0, ve = y.getBounds().width;
|
|
3125
|
+
let ae = [];
|
|
3126
|
+
const je = V.sort(Z.rowFirstRangeComparator), ft = y.getVisibleRangeCoords();
|
|
3127
|
+
for (let Be = 0; Be < ce.length && ce[Be] <= ft.rowEnd; Be++) {
|
|
3128
|
+
const Fe = ce[Be];
|
|
3100
3129
|
if (Fe < ft.rowStart) continue;
|
|
3101
3130
|
let gt = !1;
|
|
3102
3131
|
for (; je.length > 0 && je[0].rowStart <= Fe; ) {
|
|
3103
3132
|
const pe = je.shift();
|
|
3104
|
-
pe.rowEnd > Fe && (
|
|
3133
|
+
pe.rowEnd > Fe && (ae.push(pe), gt = !0);
|
|
3105
3134
|
}
|
|
3106
|
-
gt && (
|
|
3107
|
-
const Xe =
|
|
3108
|
-
let
|
|
3109
|
-
for (let pe = 0; pe <
|
|
3110
|
-
let wt =
|
|
3111
|
-
const Wt =
|
|
3112
|
-
pe <
|
|
3135
|
+
gt && (ae = ae.sort(Z.columnFirstRangeComparator));
|
|
3136
|
+
const Xe = y.getLayout(), Lt = Xe.getRowOffset(Fe + 1);
|
|
3137
|
+
let yt = xe;
|
|
3138
|
+
for (let pe = 0; pe < ae.length + 1; pe++) {
|
|
3139
|
+
let wt = yt, $t = ve;
|
|
3140
|
+
const Wt = ae[pe];
|
|
3141
|
+
pe < ae.length && ($t = Math.min(ve, Xe.getColOffset(Wt.colStart)), yt = Math.min(ve, Xe.getColOffset(Wt.colEnd + 1))), j.push(Jo("path", { d: `M ${we.boundPixel(wt)} ${we.boundPixel(Lt, !1, A)} L ${we.boundPixel($t)} ${we.boundPixel(Lt, !1, A)}`, stroke: M, strokeWidth: 1, vectorEffect: "non-scaling-stroke", ...E, key: fe + Fe + ":" + pe }));
|
|
3113
3142
|
}
|
|
3114
|
-
for (let pe =
|
|
3143
|
+
for (let pe = ae.length - 1; pe >= 0; pe--) ae[pe].rowEnd <= ce[Be + 1] && ae.splice(pe, 1);
|
|
3115
3144
|
}
|
|
3116
3145
|
} else {
|
|
3117
|
-
const fe = `view:${
|
|
3118
|
-
if (!
|
|
3119
|
-
const xe = 0,
|
|
3120
|
-
let
|
|
3121
|
-
const je = V.sort(Z.columnFirstRangeComparator), ft =
|
|
3122
|
-
for (let Be = 0; Be <
|
|
3123
|
-
const Fe =
|
|
3146
|
+
const fe = `view:${y.getAnchor()}:vl:`, ce = y.getVisibleColumns();
|
|
3147
|
+
if (!ce || ce.length === 0) return;
|
|
3148
|
+
const xe = 0, ve = y.getBounds().height;
|
|
3149
|
+
let ae = [];
|
|
3150
|
+
const je = V.sort(Z.columnFirstRangeComparator), ft = y.getVisibleRangeCoords();
|
|
3151
|
+
for (let Be = 0; Be < ce.length && ce[Be] <= ft.colEnd; Be++) {
|
|
3152
|
+
const Fe = ce[Be];
|
|
3124
3153
|
if (Fe < ft.colStart) continue;
|
|
3125
3154
|
let gt = !1;
|
|
3126
3155
|
for (; je.length > 0 && je[0].colStart <= Fe; ) {
|
|
3127
3156
|
const pe = je.shift();
|
|
3128
|
-
pe.colEnd > Fe && (
|
|
3157
|
+
pe.colEnd > Fe && (ae.push(pe), gt = !0);
|
|
3129
3158
|
}
|
|
3130
|
-
gt && (
|
|
3131
|
-
const Xe =
|
|
3132
|
-
let
|
|
3133
|
-
for (let pe = 0; pe <
|
|
3134
|
-
let wt =
|
|
3135
|
-
const Wt =
|
|
3136
|
-
pe <
|
|
3137
|
-
let Ce =
|
|
3138
|
-
j.push(q("path", { d: `M ${we.boundPixel(Lt, !1, A)} ${we.boundPixel(wt)} L ${we.boundPixel(Lt, !1, A)} ${we.boundPixel($t)}`, stroke: Ce, strokeWidth: 1, vectorEffect: "non-scaling-stroke", ...
|
|
3159
|
+
gt && (ae = ae.sort(Z.rowFirstRangeComparator));
|
|
3160
|
+
const Xe = y.getLayout(), Lt = Xe.getColOffset(Fe + 1);
|
|
3161
|
+
let yt = xe;
|
|
3162
|
+
for (let pe = 0; pe < ae.length + 1; pe++) {
|
|
3163
|
+
let wt = yt, $t = ve;
|
|
3164
|
+
const Wt = ae[pe];
|
|
3165
|
+
pe < ae.length && ($t = Math.min(ve, Xe.getRowOffset(Wt.rowStart)), yt = Math.min(ve, Xe.getRowOffset(Wt.rowEnd + 1)));
|
|
3166
|
+
let Ce = M;
|
|
3167
|
+
j.push(q("path", { d: `M ${we.boundPixel(Lt, !1, A)} ${we.boundPixel(wt)} L ${we.boundPixel(Lt, !1, A)} ${we.boundPixel($t)}`, stroke: Ce, strokeWidth: 1, vectorEffect: "non-scaling-stroke", ...P }, fe + Fe + ":" + pe));
|
|
3139
3168
|
}
|
|
3140
|
-
for (let pe =
|
|
3169
|
+
for (let pe = ae.length - 1; pe >= 0; pe--) ae[pe].colEnd <= ce[Be + 1] && ae.splice(pe, 1);
|
|
3141
3170
|
}
|
|
3142
3171
|
}
|
|
3143
|
-
}, $n = (
|
|
3172
|
+
}, $n = (y) => {
|
|
3144
3173
|
if (!Jt) return;
|
|
3145
3174
|
const O = {};
|
|
3146
3175
|
for (let A = 0; A < rn.length; A++) {
|
|
3147
3176
|
const j = rn[A], V = ze[j], fe = [];
|
|
3148
|
-
Gn(V,
|
|
3149
|
-
const
|
|
3150
|
-
O[j] = q("svg", { width: `${xe}`, height: `${
|
|
3177
|
+
Gn(V, y, 0, fe, y ? Jt[j].rangesH : Jt[j].rangesV);
|
|
3178
|
+
const ce = V.getRangeCoordsBounds(), xe = Math.ceil(ce.width), ve = Math.ceil(ce.height);
|
|
3179
|
+
O[j] = q("svg", { width: `${xe}`, height: `${ve}`, viewBox: `0 0 ${xe} ${ve}`, preserveAspectRatio: "none", shapeRendering: "crispEdges", style: { position: "absolute" }, children: fe });
|
|
3151
3180
|
}
|
|
3152
3181
|
return O;
|
|
3153
|
-
}, Zn =
|
|
3154
|
-
const
|
|
3182
|
+
}, Zn = Ee(() => x === !0 || x?.horizontal === !0 ? $n(!0) : null, [ut, x, Ie, z, I, M, E, r, i, We, Tt, Jt]), Jn = Ee(() => x === !0 || x?.vertical === !0 ? $n(!1) : null, [ut, x, Oe, z, I, M, P, r, i, ee, nt, Jt]), _o = Ee(() => Rt.left === 0 ? null : q(jr, { linePoints: [0, 0, 0, ee + 1], bounds: { x: Rt.left, y: 0, width: 1, height: ee + 1 }, ...se }), [ut, Rt.left, ee, se]), Eo = Ee(() => Rt.top === 0 ? null : q(jr, { linePoints: [0, 0, We + 1, 0], bounds: { x: 0, y: Rt.top, width: We + 1, height: 1 }, ...B }), [ut, Rt.top, We, B]), Bn = Ee(() => {
|
|
3183
|
+
const y = [], O = (A) => {
|
|
3155
3184
|
if (!A || !ze[A]) return;
|
|
3156
3185
|
const j = ze[A].getBounds();
|
|
3157
3186
|
return Ht("div", { style: { position: "absolute", pointerEvents: "none", left: j.x, top: j.y, width: j.width, height: j.height, clip: `rect(0, ${j.width + 1}px, ${j.height + 1}px, 0)` }, className: `view view-${A}`, children: [Zn?.[A], Jn?.[A], Jt?.[A].cells] }, `view:${A}`);
|
|
3158
3187
|
};
|
|
3159
|
-
for (let A = 0; A < rn.length; A++)
|
|
3160
|
-
return q(wn, { children:
|
|
3161
|
-
}, [ze, Zn, Jn, Jt]), Io =
|
|
3188
|
+
for (let A = 0; A < rn.length; A++) y.push(O(rn[A]));
|
|
3189
|
+
return q(wn, { children: y });
|
|
3190
|
+
}, [ze, Zn, Jn, Jt]), Io = Ee(() => {
|
|
3162
3191
|
if (!t) return;
|
|
3163
|
-
const
|
|
3164
|
-
if (!
|
|
3192
|
+
const y = (ce, xe, ve, ae) => {
|
|
3193
|
+
if (!ae || ae.length === 0) return;
|
|
3165
3194
|
const je = [];
|
|
3166
|
-
for (let ft = 0; ft <
|
|
3167
|
-
const Be =
|
|
3168
|
-
let Fe =
|
|
3169
|
-
Fe !== Fo && (Fe = Be(
|
|
3195
|
+
for (let ft = 0; ft < ae.length; ft++) {
|
|
3196
|
+
const Be = ae[ft];
|
|
3197
|
+
let Fe = ce?.get(Be);
|
|
3198
|
+
Fe !== Fo && (Fe = Be(ve) ?? Fo), xe.set(Be, Fe), Fe && Fe !== Fo && je.push(Fe);
|
|
3170
3199
|
}
|
|
3171
3200
|
return je;
|
|
3172
|
-
}, O = (
|
|
3173
|
-
if (!
|
|
3174
|
-
const
|
|
3175
|
-
return Ht("div", { className:
|
|
3201
|
+
}, O = (ce, xe, ve) => {
|
|
3202
|
+
if (!ve) return;
|
|
3203
|
+
const ae = ve.getBounds(), je = ve.getInsets(), ft = ve.getAnchor();
|
|
3204
|
+
return Ht("div", { className: _n("view", `view-${ft}`, Wr.view), style: { position: "absolute", pointerEvents: "none", left: ae.x - je.left, top: ae.y - je.top, width: ae.width - (je.left + je.right), height: ae.height - (je.top + je.bottom), clipPath: f ? "inset(-2px)" : "inset(0px)" }, children: [y(ce, xe, ve, T), So?.[ft].overlays] }, `view:${ft}`);
|
|
3176
3205
|
}, A = rt.current, j = {}, V = [], fe = Object.keys(ze);
|
|
3177
|
-
for (let
|
|
3178
|
-
const xe = fe[
|
|
3179
|
-
V.push(O(
|
|
3206
|
+
for (let ce = 0; ce < fe.length; ce++) {
|
|
3207
|
+
const xe = fe[ce], ve = A?.[xe], ae = j[xe] = /* @__PURE__ */ new Map();
|
|
3208
|
+
V.push(O(ve, ae, ze[xe]));
|
|
3180
3209
|
}
|
|
3181
3210
|
return rt.current = j, V;
|
|
3182
|
-
}, [ut, ze,
|
|
3183
|
-
const { style:
|
|
3184
|
-
return q("div", { style: { width: We, height:
|
|
3185
|
-
}, [We,
|
|
3211
|
+
}, [ut, ze, f, T]), Co = Ee(() => {
|
|
3212
|
+
const { style: y, ...O } = J ?? {};
|
|
3213
|
+
return q("div", { style: { width: We, height: ee, ...y }, className: "sheetxl-stage", tabIndex: 0, ref: $e, ...O, ...Ye, children: K ? K(Bn) : Bn });
|
|
3214
|
+
}, [We, ee, Bn, J, K]), Qn = G(!1);
|
|
3186
3215
|
return st(() => {
|
|
3187
|
-
!Qn.current && Jt && (Qn.current = !0, me?.(
|
|
3188
|
-
}, [Jt]), Ht("div", { className:
|
|
3216
|
+
!Qn.current && Jt && (Qn.current = !0, me?.(yn.current));
|
|
3217
|
+
}, [Jt]), Ht("div", { className: _n("sheetxl-grid", Wr["sheetxl-grid"]), style: { overflow: "visible", cursor: k, maxWidth: We, maxHeight: ee, width: We, height: ee, ...Se }, ref: yn, children: [Co, Ht("div", { className: _n("sheetxl-overlays"), ref: dt, ...S, children: [Io, _o, Eo] })] });
|
|
3189
3218
|
}));
|
|
3190
|
-
|
|
3191
|
-
const
|
|
3192
|
-
const { width: n, height: o, style: r = {}, className: i, ...l } = e, [s, { width: a, height: d }] =
|
|
3193
|
-
return q("div", { className: i, style: { ...r }, children: q("div", { style: { position: "relative", top: "0px", left: "0px", width: "100%", height: "100%", maxWidth: "100%", maxHeight: "100%", boxSizing: "content-box" }, ref: s, children: q(
|
|
3219
|
+
Pi.displayName = "BaseGrid";
|
|
3220
|
+
const Oi = At(Ut((e, t) => {
|
|
3221
|
+
const { width: n, height: o, style: r = {}, className: i, ...l } = e, [s, { width: a, height: d }] = Ri();
|
|
3222
|
+
return q("div", { className: i, style: { ...r }, children: q("div", { style: { position: "relative", top: "0px", left: "0px", width: "100%", height: "100%", maxWidth: "100%", maxHeight: "100%", boxSizing: "content-box" }, ref: s, children: q(Pi, { ref: t, width: n ?? a, height: o ?? d, ...l }) }) });
|
|
3194
3223
|
}));
|
|
3195
|
-
|
|
3196
|
-
const
|
|
3197
|
-
const { showVerticalScrollbar: n, showHorizontalScrollbar: o, createHorizontalScrollbar: r, createVerticalScrollbar: i, createScrollCorner: l, viewport: s, onScrollViewport: a, style: d = {}, className: g, onScroll: m, ...
|
|
3198
|
-
ao(!s), Ur(t, () =>
|
|
3199
|
-
const
|
|
3200
|
-
|
|
3224
|
+
Oi.displayName = "Grid";
|
|
3225
|
+
const os = At(Ut((e, t) => {
|
|
3226
|
+
const { showVerticalScrollbar: n, showHorizontalScrollbar: o, createHorizontalScrollbar: r, createVerticalScrollbar: i, createScrollCorner: l, viewport: s, onScrollViewport: a, style: d = {}, className: g, onScroll: m, ...u } = e, [x, M] = Ze(null), E = G(null), P = G(null);
|
|
3227
|
+
ao(!s), Ur(t, () => P.current && E.current ? Object.assign(P.current, E.current) : null);
|
|
3228
|
+
const Q = D((k) => {
|
|
3229
|
+
P.current?.scrollTo(k), a?.(k);
|
|
3201
3230
|
}, []);
|
|
3202
|
-
return q(yi, { className: g, style: d, ref:
|
|
3231
|
+
return q(yi, { className: g, style: d, ref: E, showVerticalScrollbar: n, showHorizontalScrollbar: o, createHorizontalScrollbar: r, createVerticalScrollbar: i, createScrollCorner: l, viewport: x, onScrollViewport: Q, children: q(Oi, { style: { width: "100%", height: "100%" }, ...u, onViewportChange: (k) => M(k), ref: P }) });
|
|
3203
3232
|
}));
|
|
3204
|
-
|
|
3205
|
-
const Nr = () => !1,
|
|
3206
|
-
const { index: t, value: n, zoom: o, zoomScale: r = 100, headerText: i = (T) => `${T}`, headerStyle: l, headerStyleSelect: s = l, headerStyleSelectAll: a = s, headerStyleHover: d = a, verticalPadding: g = 0, horizontalPadding: m = 0, isSelected:
|
|
3233
|
+
os.displayName = "ScrollableGrid";
|
|
3234
|
+
const Nr = () => !1, rs = At((e) => {
|
|
3235
|
+
const { index: t, value: n, zoom: o, zoomScale: r = 100, headerText: i = (T) => `${T}`, headerStyle: l, headerStyleSelect: s = l, headerStyleSelectAll: a = s, headerStyleHover: d = a, verticalPadding: g = 0, horizontalPadding: m = 0, isSelected: u = Nr, isSelectedAll: x = Nr, coords: M, bounds: E, range: P, orientation: Q, view: k, style: I, ...z } = e, se = r / 100, B = G(null), [re, be] = Ze(!1), N = u?.(t) || !1, H = x?.(t) ? a : N ? s : l;
|
|
3207
3236
|
let X = H;
|
|
3208
|
-
if (
|
|
3237
|
+
if (re) {
|
|
3209
3238
|
let T = d;
|
|
3210
3239
|
typeof d == "function" && (T = d(H)), X = Ct.mergeContentful(H, T);
|
|
3211
3240
|
}
|
|
3212
|
-
return q("div", { ref: B, style: { background: X.fill, color: X.text?.fill, fontFamily: X.text?.fontFamily ?? l.text?.fontFamily, fontSize: 96 * (X.text?.fontSize ?? 11) / 72 *
|
|
3241
|
+
return q("div", { ref: B, style: { background: X.fill, color: X.text?.fill, fontFamily: X.text?.fontFamily ?? l.text?.fontFamily, fontSize: 96 * (X.text?.fontSize ?? 11) / 72 * se, fontStyle: X.text?.fontStyle, fontWeight: X.text?.fontWeight, lineHeight: 1.2, display: "flex", justifyContent: "center", alignItems: "end", pointerEvents: "auto", paddingBottom: `${se}px`, ...I, left: I.left - (Q === Nt ? 1 : 0), top: I.top - (Q === an ? 1 : 0), width: I.width + 1, height: I.height + 1, overflow: "hidden" }, ...z, onMouseMove: (T) => {
|
|
3213
3242
|
we.detectIt().primaryInput !== "touch" && T.buttons === 0 && be(!0);
|
|
3214
3243
|
}, onMouseOut: (T) => {
|
|
3215
3244
|
be(!1);
|
|
3216
3245
|
}, children: i(t) });
|
|
3217
3246
|
});
|
|
3218
|
-
|
|
3219
|
-
const
|
|
3220
|
-
const { orientation: n, view: o, index: r, className: i, style: l, disabled: s = !1, disabledResize: a = !1, isNextHidden: d, isHidden: g, isSelected: m, isSelectedAll:
|
|
3221
|
-
let
|
|
3222
|
-
m &&
|
|
3247
|
+
rs.displayName = "HeaderRenderer";
|
|
3248
|
+
const Li = "ew-resize", Di = "ns-resize", is = At(Ut((e, t) => {
|
|
3249
|
+
const { orientation: n, view: o, index: r, className: i, style: l, disabled: s = !1, disabledResize: a = !1, isNextHidden: d, isHidden: g, isSelected: m, isSelectedAll: u, showTouchDivider: x, headerStyle: M, headerStyleSelect: E, headerStyleSelectAll: P, headerStyleHover: Q, bounds: k, onPointerDown: I, onAutoFit: z, ...se } = e, B = n === Nt;
|
|
3250
|
+
let re = M;
|
|
3251
|
+
m && E && (re = E), u && P && (re = P);
|
|
3223
3252
|
const be = we.detectIt().primaryInput === "touch";
|
|
3224
3253
|
let N = B ? 14 : 8, H = N / 2, X = 0;
|
|
3225
3254
|
d && (X = -2), g && (X = 2), g && (N = N / 2 + X, H = 2 * X);
|
|
3226
|
-
let T =
|
|
3227
|
-
return !(m ||
|
|
3228
|
-
})),
|
|
3229
|
-
const { orientation: n, view: o, index: r, disabled: i = !1, disabledResize: l = !1, resizeThreshold: s = 1, dividerRenderer: a =
|
|
3230
|
-
let z = I ? o.getVisibleColumns() : o.getVisibleRows(),
|
|
3231
|
-
z.length > 0 && (I ?
|
|
3232
|
-
const B = G(null), [
|
|
3233
|
-
if (
|
|
3234
|
-
const U = I ? H.getColOffset(r) : H.getRowOffset(r),
|
|
3235
|
-
B.current = { isResizing: !1, startSize:
|
|
3255
|
+
let T = re.dividerStrokeFill ?? re.strokeFill;
|
|
3256
|
+
return !(m || u) && X === 0 && (T = `linear-gradient(${B ? 180 : 90}deg, ${re.fill}, ${T} 55%, ${T} 100%)`), Ht("div", { className: _n("header-divider", { disabled: s }, i, `index-${r}`), ref: t, onPointerDown: be ? void 0 : I, onDoubleClick: be ? void 0 : () => z?.(), style: { top: (B ? 0 : -N / 2 + (X - 1)) + "px", left: (B ? -N / 2 + (X - 1) : 0) + "px", width: B ? N : "calc(100% + 1px)", height: B ? "calc(100% + 1px)" : N, position: "absolute", overflow: "visible", pointerEvents: "all", cursor: s || a || be ? void 0 : B ? Li : Di, ...l }, ...se, children: [q("div", { style: { position: "relative", top: `${B ? 0 : H}px`, left: `${B ? H : 0}px`, width: B ? 1 : "100%", height: B ? "100%" : 1, background: T }, onDoubleClick: () => z?.() }), x && be ? q("div", { style: { position: "absolute", cursor: "grab", zIndex: 1, borderRadius: "4px", right: B ? "-6px" : "2px", bottom: B ? "2px" : "-9px", height: "24px", width: B ? "24px" : "18px", maxHeight: B ? "calc(100% - 4px)" : void 0, maxWidth: B ? void 0 : "calc(100% - 4px)", background: re.fill, border: `${P.edgeStrokeFill} solid 1px`, boxShadow: `0.5px 0.5px 0px 0px ${M.text.fill}`, display: "flex", alignItems: "center", justifyContent: "center" }, onPointerDown: I, children: q("div", { style: { width: "6.4px", height: "12px", backgroundImage: `url("data:image/svg+xml,%3Csvg width='6.4' height='12' viewBox='0 0 9.6 16' version='1.1' fill='${encodeURIComponent(E.text.fill)}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='M 9.60008,14.40009 C 9.60008,15.28374 8.88368,16 8.00003,16 7.11639,16 6.40012,15.28374 6.40012,14.40009 c 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40012 c 0,0.88364 -0.7164,1.60004 -1.60005,1.60004 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60004 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40006 c 0,0.88365 -0.7164,1.60005 -1.60005,1.60005 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60005 C 6.40012,0.71626 7.11639,0 8.00003,0 8.88368,0 9.60008,0.71626 9.60008,1.59991 M 3.19996,14.40009 C 3.19996,15.28374 2.48369,16 1.60005,16 0.7164,16 0,15.28374 0,14.40009 c 0,-0.88365 0.7164,-1.60005 1.60005,-1.60005 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40012 c 0,0.88364 -0.71627,1.60004 -1.59991,1.60004 C 0.7164,9.60001 0,8.88361 0,7.99997 0,7.11632 0.7164,6.39992 1.60005,6.39992 c 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40006 c 0,0.88365 -0.71627,1.60005 -1.59991,1.60005 C 0.7164,3.19996 0,2.48356 0,1.59991 0,0.71626 0.7164,0 1.60005,0 2.48369,0 3.19996,0.71626 3.19996,1.59991' /%3E%3C/svg%3E%0A")`, backgroundRepeat: "no-repeat", backgroundPosition: "center", transform: B ? void 0 : "rotate(90deg)" } }) }) : null] });
|
|
3257
|
+
})), ls = (e, t) => q(is, { ...e, ref: t }), xs = At(Ut((e, t) => {
|
|
3258
|
+
const { orientation: n, view: o, index: r, disabled: i = !1, disabledResize: l = !1, resizeThreshold: s = 1, dividerRenderer: a = ls, onDividerMouseDown: d, onDividerResizeStart: g, onDividerResize: m, onDividerResizeEnd: u, onDividerMouseUp: x, onDividerAutoFit: M, onPointerDown: E, ...P } = e, Q = R(E, [E]), k = R(M, [M]), I = n === Nt;
|
|
3259
|
+
let z = I ? o.getVisibleColumns() : o.getVisibleRows(), se = null;
|
|
3260
|
+
z.length > 0 && (I ? se = o.getRangeCoordsBounds({ rowStart: 0, rowEnd: 0, colStart: z[0], colEnd: z[z.length - 1] }) : o.getRangeCoordsBounds({ rowStart: z[0], rowEnd: z[z.length - 1], colStart: 0, colEnd: 0 }), se = o.toClipBounds(se, en));
|
|
3261
|
+
const B = G(null), [re, be] = Ze(null), N = (L, U) => I ? L.clientX - U.clientX : L.clientY - U.clientY, H = o.getLayout(), X = I ? H.getColOffset(r + 1) : H.getRowOffset(r + 1), T = On({ processTouch: !0, onPointerDown: (L) => {
|
|
3262
|
+
if (Q?.(L), !i && !l) {
|
|
3263
|
+
const U = I ? H.getColOffset(r) : H.getRowOffset(r), te = X - U;
|
|
3264
|
+
B.current = { isResizing: !1, startSize: te, index: r, view: o, orientation: n, onDividerMouseDown: d, onDividerResizeStart: g, onDividerResize: m, onDividerResizeEnd: u, onDividerMouseUp: x }, be(B.current), d?.(r, te);
|
|
3236
3265
|
}
|
|
3237
3266
|
L.stopPropagation(), L.preventDefault();
|
|
3238
|
-
}, onPointerUp: (L, U,
|
|
3267
|
+
}, onPointerUp: (L, U, te) => {
|
|
3239
3268
|
if (!B.current) return;
|
|
3240
|
-
B.current.isResizing && B.current.onDividerResizeEnd?.(B.current.index, Math.max(0, B.current.startSize + N(L,
|
|
3241
|
-
const
|
|
3242
|
-
B.current = null, be(B.current),
|
|
3243
|
-
}, onPointerMoveOrWait: (L, U,
|
|
3269
|
+
B.current.isResizing && B.current.onDividerResizeEnd?.(B.current.index, Math.max(0, B.current.startSize + N(L, te)), B.current.startSize);
|
|
3270
|
+
const ne = B.current;
|
|
3271
|
+
B.current = null, be(B.current), ne.onDividerMouseUp?.(ne.index);
|
|
3272
|
+
}, onPointerMoveOrWait: (L, U, te) => {
|
|
3244
3273
|
if (!B.current) return;
|
|
3245
|
-
const
|
|
3246
|
-
B.current.isResizing ? B.current.onDividerResize?.(B.current.index, Math.max(0, B.current.startSize +
|
|
3247
|
-
} }), S =
|
|
3248
|
-
|
|
3274
|
+
const ne = N(L, te);
|
|
3275
|
+
B.current.isResizing ? B.current.onDividerResize?.(B.current.index, Math.max(0, B.current.startSize + ne), B.current.startSize) : Math.abs(ne) > Math.max(1, s) && (B.current = { ...B.current, isResizing: !0 }, be(B.current), B.current.onDividerResizeStart?.(B.current.index, Math.max(0, B.current.startSize + ne))), L.stopPropagation(), L.preventDefault();
|
|
3276
|
+
} }), S = R(() => {
|
|
3277
|
+
k?.(r);
|
|
3249
3278
|
}, [r]);
|
|
3250
|
-
if (!
|
|
3251
|
-
const
|
|
3252
|
-
if (!
|
|
3253
|
-
const { getPortalContainer: J } =
|
|
3279
|
+
if (!se) return;
|
|
3280
|
+
const f = a({ bounds: se, orientation: n, view: o, index: r, disabled: i, disabledResize: l, onAutoFit: S, onPointerDown: T, ...P }, t);
|
|
3281
|
+
if (!f) return;
|
|
3282
|
+
const { getPortalContainer: J } = vi();
|
|
3254
3283
|
let K = null;
|
|
3255
|
-
return
|
|
3284
|
+
return re && re.isResizing && re.index === r && (K = qr(q("div", { style: { position: "absolute", cursor: I ? Li : Di, left: 0, top: 0, width: "100%", height: "100%" } }), J(), "divider:" + r)), Ht(wn, { children: [K, q("div", { className: _n("header-divider-anchor"), style: { position: "absolute", pointerEvents: "auto", top: `${I ? se.y : X}px`, left: `${I ? X : se.x}px`, width: (I ? 0 : se.width - 1) + "px", height: (I ? se.height - 1 : 0) + "px", display: "flex" }, tabIndex: -1, children: f })] });
|
|
3256
3285
|
}));
|
|
3257
|
-
class
|
|
3286
|
+
class ss {
|
|
3258
3287
|
naturalDimensions(t, n = {}) {
|
|
3259
3288
|
const o = document.createElement("div");
|
|
3260
3289
|
let r = n?.lineHeight ?? "1";
|
|
@@ -3272,50 +3301,50 @@ class cs {
|
|
|
3272
3301
|
return i.remove(), { width: s.width, height: s.height, maxLineHeight: 1.2 * (n.paintableText?.fontSize || 1056 / 72) };
|
|
3273
3302
|
}
|
|
3274
3303
|
}
|
|
3275
|
-
const
|
|
3276
|
-
const { editState: n =
|
|
3304
|
+
const cs = (e = void 0) => Object.freeze({ clean: e, dirty: void 0, editMode: !1 }), as = cs(), ys = At(Ut((e, t) => {
|
|
3305
|
+
const { editState: n = as, defaultTextStyle: o, onStartEdit: r, onChangeEdit: i, onSubmitEdit: l, onCancelEdit: s, onDoneEdit: a, containerBounds: d, setNaturalDimensions: g, onNavigate: m, textProperties: u, style: x, autoFocus: M, ...E } = e, P = G(null), { width: Q = 0 } = d ?? {}, [k, I] = Ze(() => n);
|
|
3277
3306
|
st(() => {
|
|
3278
3307
|
I(n);
|
|
3279
3308
|
}, [n]);
|
|
3280
|
-
const z =
|
|
3309
|
+
const z = u?.align || "left", se = u?.vAlign || "middle", B = u?.fill || "#040404", re = u?.wrap || "wrap", be = u?.fontFamily || "Calibri", N = u?.fontSize || 11, H = u?.fontWeight || 400, X = u?.fontStyle || "normal", T = k.dirty ?? k.clean ?? "";
|
|
3281
3310
|
let S = 2;
|
|
3282
|
-
const
|
|
3283
|
-
|
|
3284
|
-
const K =
|
|
3311
|
+
const f = 96 * N / 72, J = 1.2 * f;
|
|
3312
|
+
se === "right" && (S += 1);
|
|
3313
|
+
const K = Ee(() => new ss().naturalDimensions(T, { maxWidth: re === "wrap" ? Q - S : void 0, lineHeight: `${J}px`, paintableText: { fontStyle: X, wrap: re, letterSpacing: -0.25 } }), [T, re, S, f, be, H, X, g, Q]), L = D(() => K.maxLineHeight ? K.maxLineHeight + "px" : "1.2", [K]), [U, te] = Ze(L);
|
|
3285
3314
|
tn(() => {
|
|
3286
|
-
|
|
3315
|
+
te(L());
|
|
3287
3316
|
}, [d, K]), tn(() => {
|
|
3288
|
-
g?.({ width:
|
|
3317
|
+
g?.({ width: re === "wrap" ? void 0 : K.width + S, height: K.height });
|
|
3289
3318
|
}, [K, g]);
|
|
3290
|
-
const
|
|
3291
|
-
if (
|
|
3292
|
-
const Me = { ...
|
|
3293
|
-
Me.dirty =
|
|
3294
|
-
}, [
|
|
3295
|
-
if (
|
|
3296
|
-
const Me = { ...
|
|
3297
|
-
Me.editMode =
|
|
3298
|
-
}, [
|
|
3319
|
+
const ne = R(i, [i]), Y = R((_) => {
|
|
3320
|
+
if (k.dirty === _) return;
|
|
3321
|
+
const Me = { ...k };
|
|
3322
|
+
Me.dirty = _, P.current, I(Me), ne?.(Me);
|
|
3323
|
+
}, [k]), He = R((_) => {
|
|
3324
|
+
if (k.editMode === _) return;
|
|
3325
|
+
const Me = { ...k };
|
|
3326
|
+
Me.editMode = _, I(Me), ne?.(Me);
|
|
3327
|
+
}, [k]), Ve = R(() => {
|
|
3299
3328
|
try {
|
|
3300
|
-
return l?.(
|
|
3329
|
+
return l?.(k), a?.(), !0;
|
|
3301
3330
|
} catch {
|
|
3302
3331
|
return !1;
|
|
3303
3332
|
}
|
|
3304
|
-
}, [l,
|
|
3333
|
+
}, [l, k]), Ne = R(() => {
|
|
3305
3334
|
I(n), s?.(), a?.();
|
|
3306
|
-
}, [s, n]), at =
|
|
3307
|
-
if (!
|
|
3308
|
-
if (
|
|
3309
|
-
const ue = { ...
|
|
3310
|
-
return ue.dirty =
|
|
3311
|
-
}
|
|
3312
|
-
const Me =
|
|
3313
|
-
if (
|
|
3314
|
-
if (
|
|
3315
|
-
if (
|
|
3316
|
-
if (!
|
|
3335
|
+
}, [s, n]), at = R((_) => {
|
|
3336
|
+
if (!P.current) return;
|
|
3337
|
+
if (_.isDefaultPrevented(), !(_.isTrusted || _.nativeEvent.ctrlKey || _.nativeEvent.metaKey || _.nativeEvent.altKey || _.nativeEvent.isComposing) && Ei.indexOf(_.nativeEvent.key) !== -1) {
|
|
3338
|
+
const ue = { ...k };
|
|
3339
|
+
return ue.dirty = _.nativeEvent.key === "Backspace" ? "" : (ue.dirty ?? "") + _.key, I(ue), ne?.(ue), void _.preventDefault();
|
|
3340
|
+
}
|
|
3341
|
+
const Me = _.nativeEvent.shiftKey;
|
|
3342
|
+
if (_.which === tl) return _.preventDefault(), void Ne();
|
|
3343
|
+
if (_.which === nl) return He(!0), void _.preventDefault();
|
|
3344
|
+
if (_.which === si && (_.preventDefault(), Ve() && m?.(Me ? it : lt)), _.which === li) return _.preventDefault(), void (Ve() && m?.(Me ? ot : Ke));
|
|
3345
|
+
if (!k.editMode) {
|
|
3317
3346
|
let ue = null;
|
|
3318
|
-
switch (
|
|
3347
|
+
switch (_.which) {
|
|
3319
3348
|
case ci:
|
|
3320
3349
|
ue = ot;
|
|
3321
3350
|
break;
|
|
@@ -3330,57 +3359,57 @@ const as = (e = void 0) => Object.freeze({ clean: e, dirty: void 0, editMode: !1
|
|
|
3330
3359
|
}
|
|
3331
3360
|
if (ue) return void Ve();
|
|
3332
3361
|
}
|
|
3333
|
-
}, [
|
|
3362
|
+
}, [k, m]), [Se, Ye] = Ze(!M);
|
|
3334
3363
|
st(() => {
|
|
3335
3364
|
Ye(!1);
|
|
3336
3365
|
}, []);
|
|
3337
|
-
const $ = wo(t, () => ({ startEdit(
|
|
3338
|
-
let Me =
|
|
3366
|
+
const $ = wo(t, () => ({ startEdit(_) {
|
|
3367
|
+
let Me = _?.initialSelection;
|
|
3339
3368
|
if (!Me) {
|
|
3340
|
-
const me =
|
|
3369
|
+
const me = P.current.value.length ?? 0;
|
|
3341
3370
|
Me = { start: me, end: me, direction: "forward" };
|
|
3342
3371
|
}
|
|
3343
|
-
|
|
3344
|
-
const ue = { ...n, editMode:
|
|
3345
|
-
|
|
3372
|
+
P.current?.setSelectionRange(Me.start, Me.end, Me.direction);
|
|
3373
|
+
const ue = { ...n, editMode: _?.editMode ?? !1 };
|
|
3374
|
+
_?.text !== void 0 && (ue.dirty = _.text), ue.editMode === n.editMode && ue.dirty === n.dirty || (I(ue), ne?.(ue));
|
|
3346
3375
|
}, submitEdit: () => Ve(), cancelEdit() {
|
|
3347
3376
|
Ne();
|
|
3348
3377
|
}, autoFocus() {
|
|
3349
|
-
|
|
3350
|
-
}, getLineHeight: () => K?.maxLineHeight ?? J, dispatchEvent: (
|
|
3351
|
-
return q("div", { ref: $, ...
|
|
3352
|
-
Y(
|
|
3353
|
-
}, onDoubleClick: (
|
|
3354
|
-
|
|
3355
|
-
}, onMouseDown: (
|
|
3378
|
+
P.current?.focus();
|
|
3379
|
+
}, getLineHeight: () => K?.maxLineHeight ?? J, dispatchEvent: (_) => P.current.dispatchEvent(_) }), [n, r]);
|
|
3380
|
+
return q("div", { ref: $, ...E, style: { background: "transparent", display: "flex", flexGrow: 1, alignSelf: "center", height: K.height, maxWidth: "100%", maxHeight: "100%", ...x }, children: q("textarea", { spellCheck: "false", ref: P, value: T, autoFocus: !1, disabled: Se, name: "cell-editor", autoComplete: "off", autoCapitalize: "off", style: { flex: "1 1 100%", position: "relative", fontSize: `${f}px`, fontFamily: `${be}`, fontWeight: `${H}`, fontStyle: `${X}`, padding: "0px", marginRight: z === "right" ? "3px" : "0px", marginLeft: z === "left" ? "2px" : "0px", lineHeight: U, height: K.height, textRendering: "geometricPrecision", letterSpacing: "-0.25px", boxSizing: "border-box", borderWidth: 0, outline: "none", resize: "none", overflow: "hidden", verticalAlign: "baseline", textAlign: z, background: "transparent", color: B, marginBottom: "0px", userSelect: "text", maxHeight: "100%", whiteSpace: re === "wrap" ? "break-spaces" : "pre", wordWrap: "break-word" }, onChange: (_) => {
|
|
3381
|
+
Y(_.target.value);
|
|
3382
|
+
}, onDoubleClick: (_) => {
|
|
3383
|
+
_.isTrusted;
|
|
3384
|
+
}, onMouseDown: (_) => {
|
|
3356
3385
|
He(!0);
|
|
3357
3386
|
}, onKeyDown: at }) });
|
|
3358
|
-
})),
|
|
3387
|
+
})), vs = At((e) => {
|
|
3359
3388
|
const { value: t, view: n, bounds: o, range: r, zoom: i, children: l, style: s, ...a } = e;
|
|
3360
3389
|
return q("div", { style: { padding: "2px 4px", fontFamily: "Calibri", letterSpacing: -0.25, lineHeight: 1.2, fontSize: s?.fontSize || 1056 / 72, ...s }, ...a, children: t });
|
|
3361
3390
|
});
|
|
3362
3391
|
export {
|
|
3363
|
-
|
|
3392
|
+
Pi as BaseGrid,
|
|
3364
3393
|
ys as DefaultCellEditor,
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3394
|
+
vs as DefaultCellRenderer,
|
|
3395
|
+
is as DefaultHeaderDivider,
|
|
3396
|
+
Mi as FillHandle,
|
|
3397
|
+
Oi as Grid,
|
|
3398
|
+
xs as HeaderDivider,
|
|
3399
|
+
rs as HeaderRenderer,
|
|
3400
|
+
ms as RESET_SCROLL_EVENTS_DEBOUNCE_INTERVAL,
|
|
3372
3401
|
en as SELECTION_CLIP_INSETS,
|
|
3373
|
-
|
|
3402
|
+
Ei as STANDARD_KEY_CHARS,
|
|
3374
3403
|
jr as SVGLine,
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3404
|
+
ql as SVGRect,
|
|
3405
|
+
os as ScrollableGrid,
|
|
3406
|
+
Ii as Selection,
|
|
3378
3407
|
Go as TouchSelectHandle,
|
|
3379
|
-
|
|
3380
|
-
|
|
3408
|
+
Yl as defaultSelectionRenderer,
|
|
3409
|
+
cs as getDefaultStringEditState,
|
|
3381
3410
|
Yt as safeSelectionCoords,
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3411
|
+
Bl as useCellLayout,
|
|
3412
|
+
gs as useHeaderSelection,
|
|
3413
|
+
ps as useKeyboardEditorOverlay,
|
|
3414
|
+
ws as useSelection
|
|
3386
3415
|
};
|