@sheetxl/grid-react 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/cjs/index.cjs +5 -5
- package/browser/esm/index.mjs +506 -495
- package/licenses/dependencies.txt +2 -2
- package/node/esm/index.mjs +15 -4
- 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
|
|
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 _e, useLayoutEffect as tn, useState as Ze, version as Kr, createElement as Jo, useReducer as Qo } from "react";
|
|
4
|
+
import { createRoot as Bi } from "react-dom/client";
|
|
5
|
+
import { unstable_batchedUpdates as Fi, 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.5
|
|
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", ji = Object.freeze({ left: 0, top: 0 }), Vi = Object.freeze({ left: 0, top: 0, bottom: 0, right: 0 }), Wi = Object.freeze({ x: 0, y: 0, width: 0, height: 0 });
|
|
13
|
+
Object.freeze(Object.defineProperty({ __proto__: null, EmptyBounds: Wi, EmptyRect: Vi, EmptyTopLeft: ji }, Symbol.toStringTag, { value: "Module" }));
|
|
14
|
+
const Nt = "column", an = "row", Hi = Object.freeze({ colIndex: 0, rowIndex: 0 }), Ni = 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, Ui = (e, t) => e.rowEnd === t.rowEnd ? t.colEnd - e.colEnd : t.rowEnd - e.rowEnd, Ki = (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 ? Ui : Ki : 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", $i = 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
|
+
}, qi = [null, null], Yi = (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, f = d[0], x = f.colStart, _ = f.rowStart,
|
|
45
|
+
let m = 0, f = d[0], x = f.colStart, _ = f.rowStart, M = f.colEnd, R = f.rowEnd;
|
|
46
46
|
for (let ae = 1; ae < g; ae++) {
|
|
47
47
|
const P = d[ae];
|
|
48
|
-
let
|
|
49
|
-
if (
|
|
50
|
-
let z = { colStart: x, rowStart: _, colEnd: l ? P.colEnd :
|
|
48
|
+
let I = !1;
|
|
49
|
+
if (I = l ? f && _ === P.rowStart && R === P.rowEnd && M + 1 === P.colStart : f && x === P.colStart && M === P.colEnd && R + 1 === P.rowStart, I) {
|
|
50
|
+
let z = { colStart: x, rowStart: _, colEnd: l ? P.colEnd : M, rowEnd: l ? R : P.rowEnd };
|
|
51
51
|
if (f.value !== void 0 && (z.value = f.value), n) {
|
|
52
52
|
const le = r ?? [null, null];
|
|
53
53
|
le[0] = f, le[1] = P, z = n(le, z, o);
|
|
54
54
|
}
|
|
55
55
|
if (z) {
|
|
56
|
-
i[m] = z, a = !0, f = z, x = f.colStart, _ = f.rowStart,
|
|
56
|
+
i[m] = z, a = !0, f = z, x = f.colStart, _ = f.rowStart, M = f.colEnd, R = f.rowEnd;
|
|
57
57
|
continue;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
i[++m] = P, f = P, x = f.colStart, _ = f.rowStart,
|
|
60
|
+
i[++m] = P, f = P, x = f.colStart, _ = f.rowStart, M = f.colEnd, R = f.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
|
|
66
|
+
const Z = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: Hi, EmptyRange: Ni, 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;
|
|
@@ -81,7 +81,7 @@ const G = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: $i,
|
|
|
81
81
|
o && n.push(o);
|
|
82
82
|
const f = t ? s : a, x = t ? a : s;
|
|
83
83
|
o = { colStart: f, rowStart: x, colEnd: f, 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 ?
|
|
84
|
+
}, done: (s) => (o && (n.push(o), o = null), s ? cr(n, 3, s === !0 ? Yi : s, t ? Nt : an, qi) : 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 G = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: $i,
|
|
|
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" })), Xi = typeof Symbol == "function" && Symbol.for ? Symbol.for("react.element") : 60103;
|
|
108
|
+
function Gi(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 === Xi;
|
|
114
114
|
}(e);
|
|
115
115
|
}
|
|
116
116
|
function Vn(e, t) {
|
|
117
117
|
return t.clone !== !1 && t.isMergeableObject(e) ? _n((n = e, Array.isArray(n) ? [] : {}), e, t) : e;
|
|
118
118
|
var n;
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function Zi(e, t, n) {
|
|
121
121
|
return e.concat(t).map(function(o) {
|
|
122
122
|
return Vn(o, n);
|
|
123
123
|
});
|
|
@@ -136,7 +136,7 @@ function dr(e, t) {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
function _n(e, t, n) {
|
|
139
|
-
(n = n || {}).arrayMerge = n.arrayMerge ||
|
|
139
|
+
(n = n || {}).arrayMerge = n.arrayMerge || Zi, n.isMergeableObject = n.isMergeableObject || Gi, 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 = {};
|
|
@@ -158,12 +158,12 @@ _n.all = function(e, t) {
|
|
|
158
158
|
return _n(n, o, t);
|
|
159
159
|
}, {});
|
|
160
160
|
};
|
|
161
|
-
const
|
|
161
|
+
const Ji = Object.freeze([]), Qi = 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), el = (e, t) => !(e !== t && !Zr(e, t) && !e.isEqual?.(t)), Qr = (e, t, n = el) => {
|
|
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 Ki = 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: Ji, EmptyObject: Qi, 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) => {
|
|
@@ -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}"/>`, tl = (e, t) => {
|
|
616
616
|
let n = null;
|
|
617
617
|
try {
|
|
618
618
|
const o = new DOMParser().parseFromString(t, Ft);
|
|
@@ -695,7 +695,7 @@ let ho = class {
|
|
|
695
695
|
let a = s.types.indexOf(Ft), d = null;
|
|
696
696
|
if (a !== -1) {
|
|
697
697
|
const f = await s.getType(Ft);
|
|
698
|
-
d = await Wo(f), d && (d =
|
|
698
|
+
d = await Wo(f), d && (d = tl(o, d));
|
|
699
699
|
}
|
|
700
700
|
if (!d && s.types.includes(fn)) {
|
|
701
701
|
const f = await s.getType(fn);
|
|
@@ -816,28 +816,28 @@ 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", yn = "alt", zt = "ctrl",
|
|
820
|
-
function
|
|
819
|
+
const Wn = { Left: "left", Right: "right", Center: "center" }, It = "shift", yn = "alt", zt = "ctrl", li = 9, si = 13, nl = 27, ci = 37, ai = 38, di = 39, ui = 40, ol = 113, _r = 3, mn = { Horizontal: "horizontal", Vertical: "vertical" };
|
|
820
|
+
function hi(e) {
|
|
821
821
|
var t, n, o = "";
|
|
822
822
|
if (typeof e == "string" || typeof e == "number") o += e;
|
|
823
823
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
824
824
|
var r = e.length;
|
|
825
|
-
for (t = 0; t < r; t++) e[t] && (n =
|
|
825
|
+
for (t = 0; t < r; t++) e[t] && (n = hi(e[t])) && (o && (o += " "), o += n);
|
|
826
826
|
} else for (n in e) e[n] && (o && (o += " "), o += n);
|
|
827
827
|
return o;
|
|
828
828
|
}
|
|
829
829
|
function Rn() {
|
|
830
|
-
for (var e, t, n = 0, o = "", r = arguments.length; n < r; n++) (e = arguments[n]) && (t =
|
|
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
833
|
var rl = function() {
|
|
834
|
-
},
|
|
835
|
-
const In =
|
|
834
|
+
}, fi = typeof window < "u", il = fi ? tn : st, Ir = { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 };
|
|
835
|
+
const In = fi && window.ResizeObserver !== void 0 ? function() {
|
|
836
836
|
var e = Ze(null), t = e[0], n = e[1], o = Ze(Ir), r = o[0], i = o[1], l = _e(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, f = a.height, x = a.top, _ = a.left,
|
|
840
|
-
i({ x: d, y: g, width: m, height: f, top: x, left: _, bottom:
|
|
839
|
+
var a = s[0].contentRect, d = a.x, g = a.y, m = a.width, f = a.height, x = a.top, _ = a.left, M = a.bottom, R = a.right;
|
|
840
|
+
i({ x: d, y: g, width: m, height: f, top: x, left: _, bottom: M, right: R });
|
|
841
841
|
}
|
|
842
842
|
});
|
|
843
843
|
}, []);
|
|
@@ -849,7 +849,7 @@ const In = si && window.ResizeObserver !== void 0 ? function() {
|
|
|
849
849
|
} : function() {
|
|
850
850
|
return [rl, Ir];
|
|
851
851
|
}, k = (e, t) => {
|
|
852
|
-
const n = D((...i) => e?.(...i), t), o =
|
|
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;
|
|
@@ -871,7 +871,7 @@ const In = si && 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: f = 260, scrollButtonAdditionalRepeatDelay: x = 120, createScrollStartButton: _ = ll, createScrollEndButton:
|
|
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: f = 260, scrollButtonAdditionalRepeatDelay: x = 120, createScrollStartButton: _ = ll, createScrollEndButton: M = sl, ...R } = e, ae = k(d, [d]), P = G(null), [I, { width: z, height: le }] = In(), [B, { width: oe, height: be }] = In(), N = s === mn.Vertical, H = N ? "top" : "left", X = N ? "scrollTop" : "scrollLeft", T = N ? le : z, S = N ? be : oe, [h, J] = Ze(null);
|
|
875
875
|
st(() => {
|
|
876
876
|
h !== null && P.current && P.current.scrollTo({ behavior: "smooth", [H]: h });
|
|
877
877
|
}, [h, N]);
|
|
@@ -881,9 +881,9 @@ const er = At(Ut((e, t) => {
|
|
|
881
881
|
return J(me), Math.max(0, me);
|
|
882
882
|
}, []), L = D((Ye, $ = !1) => {
|
|
883
883
|
if (!P.current) return 0;
|
|
884
|
-
const E = P.current.querySelector(".scrollbar-viewport"), Me = E.getBoundingClientRect(), ue = E.children, me = Math.ceil(S - T),
|
|
885
|
-
return J(
|
|
886
|
-
}, [S, T]), U =
|
|
884
|
+
const E = P.current.querySelector(".scrollbar-viewport"), Me = E.getBoundingClientRect(), ue = E.children, me = Math.ceil(S - T), $e = $ ? me : No(Ye, Me[H], ue, !1, Math.max(0, Ye + m));
|
|
885
|
+
return J($e), Math.min(me, $e);
|
|
886
|
+
}, [S, T]), U = G(null), ee = D((Ye) => {
|
|
887
887
|
U.current = n;
|
|
888
888
|
const $ = Ye.target[X];
|
|
889
889
|
a($, r, o), ae?.(Ye);
|
|
@@ -892,25 +892,25 @@ const er = At(Ut((e, t) => {
|
|
|
892
892
|
const Ye = U.current;
|
|
893
893
|
U.current = null, n !== Ye && (P.current[X] = n);
|
|
894
894
|
}, [n, X]);
|
|
895
|
-
const te =
|
|
895
|
+
const te = G(null), Y = G(null), He = D(() => {
|
|
896
896
|
te.current && (clearTimeout(te.current), te.current = null, Y.current = null);
|
|
897
|
-
}, []),
|
|
897
|
+
}, []), Ve = D((Ye, $, E, Me = f) => {
|
|
898
898
|
Y.current = Ye, te.current = setTimeout(() => {
|
|
899
899
|
const ue = E ? K(Y.current || Ye) : L(Y.current || Ye);
|
|
900
|
-
ue !== Y.current ?
|
|
900
|
+
ue !== Y.current ? Ve(ue, !1, E, x) : He();
|
|
901
901
|
}, $ ? 0 : Me);
|
|
902
902
|
}, [K, L, He]);
|
|
903
903
|
st(() => () => He(), [He]);
|
|
904
904
|
const Ne = n, at = _e(() => {
|
|
905
905
|
if (!g) return null;
|
|
906
|
-
const Ye = { orientation: s, disabled: Math.floor(Ne) <= 0 || Math.floor(S - T) === 0, onMouseUp: He, onMouseLeave: He, onMouseDown: () =>
|
|
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
907
|
return _?.(Ye);
|
|
908
908
|
}, [g, s, Ne, h, S, T]), Se = _e(() => {
|
|
909
909
|
if (!g) return null;
|
|
910
|
-
const Ye = { orientation: s, disabled: Math.floor(S - T) <= Math.ceil(Ne), onMouseUp: He, onMouseLeave: He, onMouseDown: () =>
|
|
911
|
-
return
|
|
910
|
+
const Ye = { orientation: s, disabled: Math.floor(S - T) <= Math.ceil(Ne), onMouseUp: He, onMouseLeave: He, onMouseDown: () => Ve(Ne, !0, !1) };
|
|
911
|
+
return M?.(Ye);
|
|
912
912
|
}, [g, s, Ne, h, 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), ...R, 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:
|
|
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), ...R, 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: ee, ref: P, children: q("div", { ref: B, style: { position: "absolute", height: N ? o - r + (le ?? 0) : 1, width: N ? 1 : o - r + (z ?? 0) }, className: "scrollbar-viewport" }) }) }), Se] });
|
|
914
914
|
}));
|
|
915
915
|
er.displayName = "Scrollbar";
|
|
916
916
|
let Cr = Date.now, gn = {}, cl = 1;
|
|
@@ -928,8 +928,8 @@ const jn = (e) => {
|
|
|
928
928
|
const f = m !== !0, x = Cr();
|
|
929
929
|
if (!gn[d] || t && !t(d)) return gn[d] = null, void n(60 - a / ((x - i) / 1e3), d, !1);
|
|
930
930
|
if (f) {
|
|
931
|
-
const
|
|
932
|
-
for (let R = 0; R < Math.min(
|
|
931
|
+
const M = Math.round((x - l) / 16.666666666666668) - 1;
|
|
932
|
+
for (let R = 0; R < Math.min(M, 4); R++) g(!0), a++;
|
|
933
933
|
}
|
|
934
934
|
o && (s = (x - i) / o, s > 1 && (s = 1));
|
|
935
935
|
const _ = r ? r(s) : s;
|
|
@@ -942,10 +942,10 @@ var al = function() {
|
|
|
942
942
|
return Math.pow(e - 1, 3) + 1;
|
|
943
943
|
}, ul = function(e) {
|
|
944
944
|
return (e /= 0.5) < 1 ? 0.5 * Math.pow(e, 3) : 0.5 * (Math.pow(e - 2, 3) + 2);
|
|
945
|
-
},
|
|
945
|
+
}, pi = function(e, t) {
|
|
946
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
947
|
};
|
|
948
|
-
|
|
948
|
+
pi.prototype = { __isSingleTouch: !1, __isTracking: !1, __didDecelerationComplete: !1, __isGesturing: !1, __isDragging: !1, __isDecelerating: !1, __isAnimating: !1, __clientLeft: 0, __clientTop: 0, __clientWidth: 0, __clientHeight: 0, __contentWidth: 0, __contentHeight: 0, __snapWidth: 100, __snapHeight: 100, __zoomLevel: 1, __scrollLeft: 0, __scrollTop: 0, __maxScrollLeft: 0, __maxScrollTop: 0, __scheduledLeft: 0, __scheduledTop: 0, __scheduledZoom: 0, __lastTouchLeft: null, __lastTouchTop: null, __lastTouchMove: null, __positions: null, __minDecelerationScrollLeft: null, __minDecelerationScrollTop: null, __maxDecelerationScrollLeft: null, __maxDecelerationScrollTop: null, __decelerationVelocityX: null, __decelerationVelocityY: null, setDimensions: function(e, t, n, o) {
|
|
949
949
|
e !== null && (this.__clientWidth = e), t !== null && (this.__clientHeight = t), n !== null && (this.__contentWidth = n), o !== null && (this.__contentHeight = o), this.__computeScrollMax(), this.scrollTo(this.__scrollLeft, this.__scrollTop, !0);
|
|
950
950
|
}, setPosition: function(e, t) {
|
|
951
951
|
this.__clientLeft = e || 0, this.__clientTop = t || 0;
|
|
@@ -1009,8 +1009,8 @@ ci.prototype = { __isSingleTouch: !1, __isTracking: !1, __didDecelerationComplet
|
|
|
1009
1009
|
}
|
|
1010
1010
|
if (this.__enableScrollY) {
|
|
1011
1011
|
d -= s * this.options.speedMultiplier;
|
|
1012
|
-
var
|
|
1013
|
-
(d >
|
|
1012
|
+
var M = this.__maxScrollTop;
|
|
1013
|
+
(d > M || d < 0) && (this.options.bouncing ? d += s / 2 * this.options.speedMultiplier : d = d > M ? M : 0);
|
|
1014
1014
|
}
|
|
1015
1015
|
i.length > 60 && i.splice(0, 30), i.push(a, d, t), this.__publish(a, d, g);
|
|
1016
1016
|
} else {
|
|
@@ -1037,12 +1037,12 @@ ci.prototype = { __isSingleTouch: !1, __isTracking: !1, __didDecelerationComplet
|
|
|
1037
1037
|
var r = this.__isAnimating;
|
|
1038
1038
|
if (r && (jn(r), this.__isAnimating = !1), o && this.options.animating) {
|
|
1039
1039
|
this.__scheduledLeft = e, this.__scheduledTop = t, this.__scheduledZoom = n;
|
|
1040
|
-
var i = this.__scrollLeft, l = this.__scrollTop, s = this.__zoomLevel, a = e - i, d = t - l, g = n - s, m = function(_,
|
|
1040
|
+
var i = this.__scrollLeft, l = this.__scrollTop, s = this.__zoomLevel, a = e - i, d = t - l, g = n - s, m = function(_, M, R) {
|
|
1041
1041
|
R && (this.__scrollLeft = i + a * _, this.__scrollTop = l + d * _, this.__zoomLevel = s + g * _, this.__callback && this.__callback(this.__scrollLeft, this.__scrollTop, this.__zoomLevel));
|
|
1042
1042
|
}.bind(this), f = function(_) {
|
|
1043
1043
|
return this.__isAnimating === _;
|
|
1044
|
-
}.bind(this), x = function(_,
|
|
1045
|
-
|
|
1044
|
+
}.bind(this), x = function(_, M, R) {
|
|
1045
|
+
M === this.__isAnimating && (this.__isAnimating = !1), (this.__didDecelerationComplete || R) && this.options.scrollingComplete(), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
|
|
1046
1046
|
}.bind(this);
|
|
1047
1047
|
this.__isAnimating = Mr(m, f, x, this.options.animationDuration, r ? dl : ul);
|
|
1048
1048
|
} else this.__scheduledLeft = this.__scrollLeft = e, this.__scheduledTop = this.__scrollTop = t, this.__scheduledZoom = this.__zoomLevel = n, this.__callback && this.__callback(e, t, n), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
|
|
@@ -1077,17 +1077,17 @@ ci.prototype = { __isSingleTouch: !1, __isTracking: !1, __didDecelerationComplet
|
|
|
1077
1077
|
} };
|
|
1078
1078
|
var Gt = typeof window < "u" ? window : { screen: {}, navigator: {} }, Ln = (Gt.matchMedia || function() {
|
|
1079
1079
|
return { matches: !1 };
|
|
1080
|
-
}).bind(Gt),
|
|
1081
|
-
return
|
|
1080
|
+
}).bind(Gt), gi = !1, hl = { get passive() {
|
|
1081
|
+
return gi = !0;
|
|
1082
1082
|
} }, Tr = function() {
|
|
1083
1083
|
};
|
|
1084
1084
|
Gt.addEventListener && Gt.addEventListener("p", Tr, hl), Gt.removeEventListener && Gt.removeEventListener("p", Tr, !1);
|
|
1085
|
-
var fl =
|
|
1086
|
-
const xl = Object.freeze(Object.defineProperty({ __proto__: null, deviceType: Uo, primaryInput: ml, supportsPassiveEvents: fl, supportsPointerEvents: pl, supportsTouchEvents:
|
|
1085
|
+
var fl = gi, pl = "PointerEvent" in Gt, tr = "ontouchstart" in Gt, wi = tr || "TouchEvent" in Gt && Ln("(any-pointer: coarse)").matches, Rr = (Gt.navigator.maxTouchPoints || 0) > 0 || wi, mi = Gt.navigator.userAgent || "", gl = Ln("(pointer: coarse)").matches && /iPad|Macintosh/.test(mi) && Math.min(Gt.screen.width || 0, Gt.screen.height || 0) >= 768, xi = (Ln("(pointer: coarse)").matches || !Ln("(pointer: fine)").matches && tr) && !/Windows.*Firefox/.test(mi), wl = Ln("(any-pointer: fine)").matches || Ln("(any-hover: hover)").matches || gl || !tr, Uo = !Rr || !wl && xi ? Rr ? "touchOnly" : "mouseOnly" : "hybrid", ml = Uo === "mouseOnly" ? "mouse" : Uo === "touchOnly" || xi ? "touch" : "mouse";
|
|
1086
|
+
const xl = Object.freeze(Object.defineProperty({ __proto__: null, deviceType: Uo, primaryInput: ml, supportsPassiveEvents: fl, supportsPointerEvents: pl, supportsTouchEvents: wi }, Symbol.toStringTag, { value: "Module" })), vl = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]), vi = {};
|
|
1087
1087
|
function Ko() {
|
|
1088
1088
|
return xl;
|
|
1089
1089
|
}
|
|
1090
|
-
const we = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProperties:
|
|
1090
|
+
const we = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProperties: vi, boundPixel: function(e, t = !1, n = 0) {
|
|
1091
1091
|
return e;
|
|
1092
1092
|
}, createSyntheticEvent: (e) => {
|
|
1093
1093
|
let t = !1, n = !1;
|
|
@@ -1099,7 +1099,7 @@ const we = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProper
|
|
|
1099
1099
|
}, timeStamp: e.timeStamp, type: e.type };
|
|
1100
1100
|
}, detectIt: Ko, focusableNodeNames: vl, toPrettyKeyCode: (e) => e === "BracketLeft" ? "[" : e === "BracketRight" ? "]" : Ct.camelToPrettyCase(e) }, Symbol.toStringTag, { value: "Module" })), yl = [];
|
|
1101
1101
|
function wo(e, t, n = yl) {
|
|
1102
|
-
const o =
|
|
1102
|
+
const o = G(null);
|
|
1103
1103
|
return Ur(e, () => {
|
|
1104
1104
|
if (!o.current) return;
|
|
1105
1105
|
const r = o.current, i = t?.();
|
|
@@ -1112,8 +1112,8 @@ function wo(e, t, n = yl) {
|
|
|
1112
1112
|
return r;
|
|
1113
1113
|
}, n), o;
|
|
1114
1114
|
}
|
|
1115
|
-
const kr = (e) => q(er, { ...e }), bl = ({ width: e, height: t }) => q("div", { className: "corner", style: { minWidth: `${e}px`, width: `${e}px`, minHeight: `${t}px`, height: `${t}px` } }),
|
|
1116
|
-
const { children: n, viewport: o, onScrollViewport: r, showHorizontalScrollbar: i = !0, showVerticalScrollbar: l = !0, createScrollCorner: s = bl, createHorizontalScrollbar: a = kr, createVerticalScrollbar: d = kr, style: g, touchElement: m, disableTouch: f, ...x } = e, _ = k(r, [r]),
|
|
1115
|
+
const kr = (e) => q(er, { ...e }), bl = ({ 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) => {
|
|
1116
|
+
const { children: n, viewport: o, onScrollViewport: r, showHorizontalScrollbar: i = !0, showVerticalScrollbar: l = !0, createScrollCorner: s = bl, createHorizontalScrollbar: a = kr, createVerticalScrollbar: d = kr, style: g, touchElement: m, disableTouch: f, ...x } = e, _ = k(r, [r]), M = wo(t, () => ({ isScrollPane: () => !0 }), []), R = G(null);
|
|
1117
1117
|
st(() => {
|
|
1118
1118
|
R.current && (R.current.__scrollTop === o?.top && R.current.__scrollLeft !== !o?.left || R.current?.scrollTo(o?.left, o?.top, !1));
|
|
1119
1119
|
}, [o?.left, o?.top, m]);
|
|
@@ -1121,7 +1121,7 @@ const kr = (e) => q(er, { ...e }), bl = ({ width: e, height: t }) => q("div", {
|
|
|
1121
1121
|
_?.({ left: T, top: S });
|
|
1122
1122
|
}, []), P = D((T) => {
|
|
1123
1123
|
R.current?.doTouchStart(T.touches, T.timeStamp);
|
|
1124
|
-
}, []),
|
|
1124
|
+
}, []), I = D((T) => {
|
|
1125
1125
|
T.preventDefault(), R.current?.doTouchMove(T.touches, T.timeStamp);
|
|
1126
1126
|
}, []), z = D((T) => {
|
|
1127
1127
|
R.current?.doTouchEnd(T.timeStamp);
|
|
@@ -1129,36 +1129,36 @@ const kr = (e) => q(er, { ...e }), bl = ({ width: e, height: t }) => q("div", {
|
|
|
1129
1129
|
R.current.setDimensions(T, S, h, J);
|
|
1130
1130
|
}, []);
|
|
1131
1131
|
st(() => {
|
|
1132
|
-
const T = m ??
|
|
1132
|
+
const T = m ?? M.current;
|
|
1133
1133
|
if (!f && Ko().supportsTouchEvents && T && o) {
|
|
1134
1134
|
if (!R.current) {
|
|
1135
1135
|
const S = { scrollingX: !0, scrollingY: !0, decelerationRate: 0.95, penetrationAcceleration: 0.08 };
|
|
1136
|
-
R.current = new
|
|
1136
|
+
R.current = new pi(ae, S);
|
|
1137
1137
|
}
|
|
1138
|
-
Ko().supportsTouchEvents && (T.addEventListener("touchstart", P), T.addEventListener("touchend", z), T.addEventListener("touchmove",
|
|
1138
|
+
Ko().supportsTouchEvents && (T.addEventListener("touchstart", P), T.addEventListener("touchend", z), T.addEventListener("touchmove", I)), le({ containerWidth: o?.width, containerHeight: o?.height, totalWidth: o?.totalWidth, totalHeight: o?.totalHeight });
|
|
1139
1139
|
}
|
|
1140
1140
|
return () => {
|
|
1141
|
-
T?.removeEventListener("touchstart", P), T?.removeEventListener("touchend", z), T?.removeEventListener("touchmove",
|
|
1141
|
+
T?.removeEventListener("touchstart", P), T?.removeEventListener("touchend", z), T?.removeEventListener("touchmove", I);
|
|
1142
1142
|
};
|
|
1143
1143
|
}, [o?.width, o?.height, o?.totalWidth, o?.totalHeight, f, m]);
|
|
1144
|
-
const [B, { width: oe }] = In(), [
|
|
1144
|
+
const [B, { width: oe }] = In(), [be, { height: N }] = In(), H = _e(() => {
|
|
1145
1145
|
const T = d({ orientation: mn.Vertical, offset: o?.top, viewportSize: o?.height, totalSize: o?.totalHeight, onScrollOffset: (S) => {
|
|
1146
1146
|
_?.({ top: S });
|
|
1147
1147
|
} });
|
|
1148
1148
|
return q("div", { style: { display: "flex", flex: "0" }, ref: B, children: T });
|
|
1149
1149
|
}, [d, o?.top, o?.height, o?.totalHeight]), X = _e(() => {
|
|
1150
1150
|
const T = a({ orientation: mn.Horizontal, offset: o?.left, viewportSize: o?.width, totalSize: o?.totalWidth, onScrollOffset: (S) => _?.({ left: 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% - ${oe}px)` }, children: q("div", { ref:
|
|
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% - ${oe}px)` }, children: q("div", { ref: be, className: "sizer", children: T }) }), l ? s({ width: oe, height: N }) : q(wn, {})] });
|
|
1152
1152
|
}, [a, o?.left, o?.width, o?.totalWidth, l, s, oe, N]);
|
|
1153
|
-
return q("div", { style: { position: "relative", display: "flex", minWidth: l ? `${oe}px` : void 0, minHeight: i ? `${N}px` : void 0, ...g }, ...x, ref:
|
|
1153
|
+
return q("div", { style: { position: "relative", display: "flex", minWidth: l ? `${oe}px` : void 0, minHeight: i ? `${N}px` : void 0, ...g }, ...x, ref: M, 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
1154
|
}));
|
|
1155
|
-
|
|
1155
|
+
yi.displayName = "ScrollPane";
|
|
1156
1156
|
const Sl = () => {
|
|
1157
1157
|
const e = document.fullscreenElement;
|
|
1158
1158
|
return e ? e.querySelector(".fullscreen-portal-root") || e : document.body;
|
|
1159
1159
|
};
|
|
1160
1160
|
let no = 0;
|
|
1161
|
-
function
|
|
1161
|
+
function bi() {
|
|
1162
1162
|
return st(() => {
|
|
1163
1163
|
function e() {
|
|
1164
1164
|
const t = document.fullscreenElement;
|
|
@@ -1174,26 +1174,26 @@ function gi() {
|
|
|
1174
1174
|
}, []), { getPortalContainer: Sl };
|
|
1175
1175
|
}
|
|
1176
1176
|
const El = 100, _l = 100, Il = 1e6, Cl = 100, Ml = 50, Tl = At(Ut((e, t) => {
|
|
1177
|
-
const { offset: n = 0, viewportSize: o = 0, totalSize: r = 0, minSize: i = 0, endGap: l = El, endScrollIncrement: s = _l, style: a =
|
|
1177
|
+
const { offset: n = 0, viewportSize: o = 0, totalSize: r = 0, minSize: i = 0, endGap: l = El, endScrollIncrement: s = _l, style: a = vi, onMouseDown: d, onScrollOffset: g, onScroll: m, scaleLimit: f = Il, scaleFactor: x = Cl, precisionFactor: _ = Ml, ...M } = e;
|
|
1178
1178
|
m && console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead");
|
|
1179
|
-
const R = k(d, [d]), ae = () => ({ offset: n, totalSize: f === 0 ? r : Math.min(r ?? 0, Math.max(i ?? 0, (n ?? 0) + (o ?? 0)) + (l ?? 0)) }), [P,
|
|
1180
|
-
}, []), [H, X] = Ze(!1), T =
|
|
1179
|
+
const R = k(d, [d]), ae = () => ({ offset: n, totalSize: f === 0 ? r : Math.min(r ?? 0, Math.max(i ?? 0, (n ?? 0) + (o ?? 0)) + (l ?? 0)) }), [P, I] = Ze(ae), z = f !== 0 && P.totalSize > f ? x : 1, le = z / _, B = Math.ceil(P.totalSize / z), oe = Math.ceil(P.offset / z), be = Math.ceil(o / z), N = D((K) => {
|
|
1180
|
+
}, []), [H, X] = Ze(!1), T = G(null);
|
|
1181
1181
|
tn(() => {
|
|
1182
1182
|
if (!H) {
|
|
1183
1183
|
T.current = { propTotalSize: r, propViewportSize: o, propOffset: n };
|
|
1184
1184
|
const K = ae();
|
|
1185
|
-
|
|
1185
|
+
I(K);
|
|
1186
1186
|
}
|
|
1187
1187
|
}, [r, o, n, H, i, l, s]);
|
|
1188
1188
|
const S = k((K, L, U) => {
|
|
1189
1189
|
const ee = T.current;
|
|
1190
|
-
T.current = null, ee && ee.propTotalSize === r && ee.propViewportSize === o && ee.propOffset === n || (Math.abs(K - oe) < le && (K = oe), g?.(K * z, oe,
|
|
1191
|
-
}, [g, z, le, oe,
|
|
1190
|
+
T.current = null, ee && ee.propTotalSize === r && ee.propViewportSize === o && ee.propOffset === n || (Math.abs(K - oe) < le && (K = oe), g?.(K * z, oe, be));
|
|
1191
|
+
}, [g, z, le, oe, be]), h = D((K) => {
|
|
1192
1192
|
document.removeEventListener("mousemove", N), document.removeEventListener("mouseup", h), X(!1);
|
|
1193
1193
|
}, []), J = D((K) => {
|
|
1194
1194
|
R?.(K), X(!0), document.addEventListener("mousemove", N, { passive: !0 }), document.addEventListener("mouseup", h, { passive: !0 });
|
|
1195
1195
|
}, [N, h]);
|
|
1196
|
-
return q(er, { ref: t, style: { ...a }, ...
|
|
1196
|
+
return q(er, { ref: t, style: { ...a }, ...M, offset: oe, totalSize: B, viewportSize: be, onMouseDown: J, onScrollOffset: S });
|
|
1197
1197
|
}));
|
|
1198
1198
|
function Do(e, t) {
|
|
1199
1199
|
if (typeof e == "function") return e(t);
|
|
@@ -1217,7 +1217,7 @@ var fo = parseInt(Kr.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
1217
1217
|
};
|
|
1218
1218
|
};
|
|
1219
1219
|
At(Ut((e, t) => {
|
|
1220
|
-
const { refFocusStart: n, ...o } = e, r =
|
|
1220
|
+
const { refFocusStart: n, ...o } = e, r = G(null), i = D(() => {
|
|
1221
1221
|
if (n) return void n?.current?.focus();
|
|
1222
1222
|
const l = r.current.parentElement.children;
|
|
1223
1223
|
let s = [];
|
|
@@ -1233,11 +1233,11 @@ At(Ut((e, t) => {
|
|
|
1233
1233
|
}, [n]);
|
|
1234
1234
|
return q("div", { tabIndex: 0, ref: fo([r, t]), onFocus: i, ...o });
|
|
1235
1235
|
})), 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(), f =
|
|
1237
|
-
const
|
|
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(), f = G(null), x = (ae, P = 0) => {
|
|
1237
|
+
const I = ae / 2, z = m - I + P;
|
|
1238
1238
|
return function(le, B, oe = !1) {
|
|
1239
1239
|
if (B === 0) return le;
|
|
1240
|
-
function
|
|
1240
|
+
function be(h, J, K) {
|
|
1241
1241
|
let L = J.x - h.x, U = J.y - h.y, ee = Math.sqrt(L * L + U * U);
|
|
1242
1242
|
return N(h, J, Math.min(1, K / ee));
|
|
1243
1243
|
}
|
|
@@ -1262,10 +1262,10 @@ At(Ut((e, t) => {
|
|
|
1262
1262
|
for (let K = 1; K < T.length; K++) {
|
|
1263
1263
|
let L = S[S.length - 1], U = T[K], ee = U === J ? T[1] : T[K + 1];
|
|
1264
1264
|
if (ee && L && L.length > 2 && U[0] === "L" && ee.length > 2 && ee[0] === "L") {
|
|
1265
|
-
let te, Y, He = X(L),
|
|
1266
|
-
oe ? (te = N(
|
|
1267
|
-
let at = N(te,
|
|
1268
|
-
Ye.origPoint =
|
|
1265
|
+
let te, Y, He = X(L), Ve = X(U), Ne = X(ee);
|
|
1266
|
+
oe ? (te = N(Ve, L.origPoint || He, B), Y = N(Ve, ee.origPoint || Ne, B)) : (te = be(Ve, He, B), Y = be(Ve, Ne, B)), H(U, te), U.origPoint = Ve, S.push(U);
|
|
1267
|
+
let at = N(te, Ve, 0.5), Se = N(Ve, Y, 0.5), Ye = ["C", at.x, at.y, Se.x, Se.y, Y.x, Y.y];
|
|
1268
|
+
Ye.origPoint = Ve, S.push(Ye);
|
|
1269
1269
|
} else S.push(U);
|
|
1270
1270
|
}
|
|
1271
1271
|
if (J) {
|
|
@@ -1276,12 +1276,12 @@ At(Ut((e, t) => {
|
|
|
1276
1276
|
return S.reduce(function(h, J) {
|
|
1277
1277
|
return h + J.join(" ") + " ";
|
|
1278
1278
|
}, "");
|
|
1279
|
-
}(`M 0 ${
|
|
1280
|
-
}, _ = _e(() => x(l), [g, m, i, l]),
|
|
1279
|
+
}(`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
|
+
}, _ = _e(() => x(l), [g, m, i, l]), M = _e(() => {
|
|
1281
1281
|
if (i === 0) return;
|
|
1282
1282
|
const ae = i / 2;
|
|
1283
1283
|
return x(i) + `L ${g} 0 L 0 0 L 0 ${ae}`;
|
|
1284
|
-
}, [_, i, l]), R = _e(() => ({ style: { clipPath: `path('${
|
|
1284
|
+
}, [_, i, l]), R = _e(() => ({ style: { clipPath: `path('${M}')` } }), [M]);
|
|
1285
1285
|
return Ht("div", { className: n, style: { display: "flex", flexDirection: "row", ...o }, ...a, ref: fo([f, d, t]), children: [Sn.isValidElement(r) ? Sn.cloneElement(r, R) : 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: _, stroke: s, fill: "none", vectorEffect: "non-scaling-stroke", strokeWidth: l }) })] });
|
|
1286
1286
|
}));
|
|
1287
1287
|
const Rl = {}, kl = (e) => {
|
|
@@ -1295,20 +1295,20 @@ const Rl = {}, kl = (e) => {
|
|
|
1295
1295
|
};
|
|
1296
1296
|
function On(e) {
|
|
1297
1297
|
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 = k(t, [t]), s = k(n, [n]), a = k(o, [o]), d =
|
|
1299
|
-
|
|
1298
|
+
const { onPointerDown: t, onPointerUp: n, onPointerMoveOrWait: o, processTouch: r = !1, consumeTouch: i = !0 } = e, l = k(t, [t]), s = k(n, [n]), a = k(o, [o]), d = G(!1), g = e?.timerInitial ?? 230, m = e?.timerContinuous ?? g / 2, f = G(null), x = G(null), _ = G(null), M = G(null), R = D(() => {
|
|
1299
|
+
M.current && (clearTimeout(M.current), M.current = null);
|
|
1300
1300
|
}, []), ae = D((H) => {
|
|
1301
|
-
|
|
1301
|
+
M.current = setTimeout(() => {
|
|
1302
1302
|
window.requestAnimationFrame(() => {
|
|
1303
1303
|
d.current !== !1 && a?.(x.current, _.current, f.current);
|
|
1304
1304
|
}), ae(m);
|
|
1305
1305
|
}, H ?? g);
|
|
1306
1306
|
}, []);
|
|
1307
1307
|
st(() => () => R(), []);
|
|
1308
|
-
const P = r ? "pointer" : "mouse",
|
|
1308
|
+
const P = r ? "pointer" : "mouse", I = D((H) => {
|
|
1309
1309
|
H.stopPropagation(), H.stopImmediatePropagation(), H.preventDefault();
|
|
1310
1310
|
}, []), z = k((H) => {
|
|
1311
|
-
document.removeEventListener(`${P}move`, oe), document.removeEventListener(`${P}up`, z), document.removeEventListener("keydown",
|
|
1311
|
+
document.removeEventListener(`${P}move`, oe), document.removeEventListener(`${P}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", le), R(), window.requestAnimationFrame(() => {
|
|
1312
1312
|
d.current !== !1 && (d.current = !1, s?.(H, _.current, f.current), _.current = null);
|
|
1313
1313
|
});
|
|
1314
1314
|
}, []), le = D(() => {
|
|
@@ -1319,19 +1319,19 @@ function On(e) {
|
|
|
1319
1319
|
});
|
|
1320
1320
|
}, [m]), oe = k((H) => {
|
|
1321
1321
|
x.current = H, B();
|
|
1322
|
-
}, []),
|
|
1322
|
+
}, []), be = k((H) => {
|
|
1323
1323
|
_.current = { ctrlKey: H.ctrlKey, shiftKey: H.shiftKey, altKey: H.altKey, metaKey: H.metaKey }, B();
|
|
1324
1324
|
}, []), N = k((H) => {
|
|
1325
1325
|
_.current = { ctrlKey: H.ctrlKey, shiftKey: H.shiftKey, altKey: H.altKey, metaKey: H.metaKey }, B();
|
|
1326
1326
|
}, [m]);
|
|
1327
1327
|
return k((H) => {
|
|
1328
|
-
H.isDefaultPrevented() || (_.current = { ctrlKey: H.ctrlKey, shiftKey: H.shiftKey, altKey: H.altKey, metaKey: H.metaKey }, l(H, _.current) !== !1 && (f.current = H, x.current = H.nativeEvent, document.addEventListener(`${P}up`, z, { passive: !1 }), document.addEventListener(`${P}move`, oe, { passive: !1 }), document.addEventListener("keydown",
|
|
1328
|
+
H.isDefaultPrevented() || (_.current = { ctrlKey: H.ctrlKey, shiftKey: H.shiftKey, altKey: H.altKey, metaKey: H.metaKey }, l(H, _.current) !== !1 && (f.current = H, x.current = H.nativeEvent, document.addEventListener(`${P}up`, z, { passive: !1 }), document.addEventListener(`${P}move`, oe, { passive: !1 }), document.addEventListener("keydown", be, { passive: !1 }), document.addEventListener("keyup", N, { passive: !1 }), window.addEventListener("blur", le, { passive: !0 }), r && i && (document.addEventListener("touchstart", I, { passive: !1, capture: !0 }), document.addEventListener("touchmove", I, { passive: !1, capture: !0 })), d.current = !0, ae(g)));
|
|
1329
1329
|
}, [g, r]);
|
|
1330
1330
|
}
|
|
1331
1331
|
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: f, className: x, style: _, disabled:
|
|
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: f, className: x, style: _, disabled: M = !1, onDragStart: R, onDragResize: ae, onDragFinish: P, resizerProps: I = oo, paneProps: z = oo, paneBeforeProps: le = oo, paneAfterProps: B = oo, createResizer: oe = kl } = e;
|
|
1333
1333
|
if (f) throw new Error("Use elementBefore and elementAfter instead of children.");
|
|
1334
|
-
const
|
|
1334
|
+
const be = _e(() => Sn.isValidElement(o) && Sn.isValidElement(n), [o, n]), N = _e(() => {
|
|
1335
1335
|
let Q = null;
|
|
1336
1336
|
i && (i === "before" ? Q = 0 : i === "after" && (Q = 1));
|
|
1337
1337
|
const et = Q === null;
|
|
@@ -1347,16 +1347,16 @@ At(Ut((e, t) => {
|
|
|
1347
1347
|
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
1348
|
const hn = Math.max(0, Math.min(100, rt / tt * 100));
|
|
1349
1349
|
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, te, ee, N), [N, X, te, ee, r]), [He,
|
|
1350
|
+
})(X, te, ee, N), [N, X, te, ee, r]), [He, Ve] = Ze(!1), Ne = k(R, [R]), at = k(ae, [ae]), Se = k(P, [P]), Ye = G(null), $ = G(null), E = 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 } = le, { className: Zt, style: St, ...C } = B, ve = { flex: "1 1 100%", width: "100%", ..._, flexDirection: r, display: "flex" }, { className: Je, style: mt, onPointerDown: Qe, ...cn } = I, on = k((Q) => {
|
|
1351
1351
|
const et = pn(Q, i === null);
|
|
1352
1352
|
T(et);
|
|
1353
1353
|
}, [i]), Mt = k((Q) => {
|
|
1354
|
-
if (
|
|
1354
|
+
if (M || !He) return;
|
|
1355
1355
|
const et = De.current?.getBoundingClientRect();
|
|
1356
1356
|
let Ue = 0;
|
|
1357
1357
|
Ue = r === "row" ? (Q.clientX ?? Q.touches?.[0]?.clientX) - et.x : (Q.clientY ?? Q.touches?.[0]?.clientY) - et.y, Ue = Math.max(0, Math.min(te, Ue)), N.fixedPaneOffset === 1 && (Ue = te - Ue), l && X.pixels === Ue || T({ pixels: Ue, percent: null }), at?.(Ue), Q.stopPropagation(), Q.preventDefault();
|
|
1358
|
-
}, [N, r,
|
|
1359
|
-
if (document.removeEventListener("pointermove", Mt), document.removeEventListener("touchmove", Mt), document.removeEventListener("pointerup", dn), He && (
|
|
1358
|
+
}, [N, r, M, He, X, te]), dn = k((Q) => {
|
|
1359
|
+
if (document.removeEventListener("pointermove", Mt), document.removeEventListener("touchmove", Mt), document.removeEventListener("pointerup", dn), He && (Ve(!1), X)) {
|
|
1360
1360
|
if (Se(X.pixels), !pn(l, i === null) || X.pixels !== l) {
|
|
1361
1361
|
const et = { ...X };
|
|
1362
1362
|
et.percent === null && (et.percent = et.pixels / te * 100), H(et);
|
|
@@ -1364,12 +1364,12 @@ At(Ut((e, t) => {
|
|
|
1364
1364
|
Q.stopPropagation(), Q.preventDefault();
|
|
1365
1365
|
}
|
|
1366
1366
|
}, [X, He, l, i, te]), nn = k((Q) => {
|
|
1367
|
-
Qe?.(Q), Q.defaultPrevented ||
|
|
1368
|
-
}, [Qe]), De = wo(t, () => ({ setPosition: on, isSplitPane: () => !0 }), []), Kt = _e(() =>
|
|
1369
|
-
return Ht("div", { ref: fo([S, De]), className: Rn("splitPane", r === "row" ? "vertical" : "horizontal", { dragging: He }, x), style:
|
|
1367
|
+
Qe?.(Q), Q.defaultPrevented || M || He || (Ve(!0), Ne(), document.addEventListener("pointermove", Mt, { passive: !1 }), document.addEventListener("touchmove", Mt, { passive: !1 }), document.addEventListener("pointerup", dn, { passive: !1 }));
|
|
1368
|
+
}, [Qe]), De = wo(t, () => ({ setPosition: on, isSplitPane: () => !0 }), []), Kt = _e(() => be ? oe?.({ key: "resizer", ref: fo([K, $]), className: Rn("resizer", Je), onPointerDownCapture: nn, style: { cursor: M ? 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: M, ...cn }) : null, [be, Je, cn, r, mt, M]), 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 = _e(() => n ? q("div", { ref: Ye, className: Rn("before", ue, dt), style: Vt, ...me, ...ut, children: n }, "before") : null, [n, z, le, N, Y]), We = _e(() => o ? q("div", { ref: E, className: Rn("after", ue, Zt), style: Cn, ...me, ...C, children: o }, "after") : null, [o, z, B, N, Y]);
|
|
1369
|
+
return Ht("div", { ref: fo([S, De]), className: Rn("splitPane", r === "row" ? "vertical" : "horizontal", { dragging: He }, x), style: ve, children: [un, Kt, We] });
|
|
1370
1370
|
}));
|
|
1371
1371
|
const Pl = ({ initValue: e, useHookBody: t, applyStateChange: n }) => {
|
|
1372
|
-
const o =
|
|
1372
|
+
const o = G(e);
|
|
1373
1373
|
if (typeof t != "function") throw new Error("function expected as hook body parameter. got " + typeof t);
|
|
1374
1374
|
const r = t();
|
|
1375
1375
|
return tn(() => {
|
|
@@ -1378,12 +1378,12 @@ const Pl = ({ initValue: e, useHookBody: t, applyStateChange: n }) => {
|
|
|
1378
1378
|
}, qo = (e) => {
|
|
1379
1379
|
console && console.warn && console.warn(e);
|
|
1380
1380
|
}, zo = typeof self == "object" && self.self === self && self || typeof global == "object" && global.global === global && global || void 0;
|
|
1381
|
-
let Ol = 1, Yo = !1,
|
|
1381
|
+
let Ol = 1, Yo = !1, Si = !1;
|
|
1382
1382
|
const co = [], kn = [], po = () => {
|
|
1383
1383
|
kn.forEach((e) => e());
|
|
1384
1384
|
}, Ll = ({ automaticContainerInternalUseOnly: e }) => {
|
|
1385
|
-
const [t, n] = Ze([]), o =
|
|
1386
|
-
return o.current = t, e || Yo !== !1 || (
|
|
1385
|
+
const [t, n] = Ze([]), o = G([]);
|
|
1386
|
+
return o.current = t, e || Yo !== !1 || (Si = !0), st(() => {
|
|
1387
1387
|
let r = !0;
|
|
1388
1388
|
function i() {
|
|
1389
1389
|
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]);
|
|
@@ -1392,29 +1392,29 @@ const co = [], kn = [], po = () => {
|
|
|
1392
1392
|
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
1393
|
};
|
|
1394
1394
|
}, [e]), q(wn, { children: t.map(({ hook: r, key: i }) => Jo(Pl, { ...r, key: i })) });
|
|
1395
|
-
},
|
|
1395
|
+
}, Ei = (e, t, n = {}) => {
|
|
1396
1396
|
let o, r, i = !1, l = !1, s = [], { unmountIfNoConsumers: a = !1 } = n;
|
|
1397
1397
|
const d = (m) => {
|
|
1398
|
-
r = m,
|
|
1398
|
+
r = m, Fi(() => s.forEach((f) => f(m)));
|
|
1399
1399
|
}, g = () => (l || (r = typeof e == "function" ? e() : e, l = !0), r);
|
|
1400
1400
|
return () => {
|
|
1401
1401
|
const [m, f] = Ze(g);
|
|
1402
1402
|
return st(() => (i || (i = !0, o = ((x) => {
|
|
1403
1403
|
const _ = Ol++;
|
|
1404
|
-
return co.push({ hook: x, key: _ }), kn.length === 0 &&
|
|
1404
|
+
return co.push({ hook: x, key: _ }), kn.length === 0 && Si === !1 && (Yo = !0, ((M) => {
|
|
1405
1405
|
if (zo.document && zo.document.createElement) {
|
|
1406
1406
|
const R = zo.document.createElement("div");
|
|
1407
|
-
|
|
1407
|
+
Bi(R).render(q(M, { automaticContainerInternalUseOnly: !0 }));
|
|
1408
1408
|
} 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
1409
|
})(Ll)), po(), () => {
|
|
1410
|
-
co.splice(co.findIndex((
|
|
1410
|
+
co.splice(co.findIndex((M) => M.key === _), 1), po();
|
|
1411
1411
|
};
|
|
1412
1412
|
})({ initValue: e, useHookBody: t, applyStateChange: d })), s.push(f), r !== m && f(r), () => {
|
|
1413
1413
|
s.splice(s.indexOf(f), 1), s.length === 0 && a && (o(), i = !1);
|
|
1414
1414
|
}), []), m;
|
|
1415
1415
|
};
|
|
1416
1416
|
};
|
|
1417
|
-
|
|
1417
|
+
Ei(null, () => {
|
|
1418
1418
|
const [e, t] = Ze(null);
|
|
1419
1419
|
return e;
|
|
1420
1420
|
});
|
|
@@ -1531,11 +1531,11 @@ class Dl {
|
|
|
1531
1531
|
}
|
|
1532
1532
|
class Ee extends Dl {
|
|
1533
1533
|
}
|
|
1534
|
-
Ct.getOS() === Ct.OSType.MacOS || (Ct.getOS(), Ct.OSType.IOS), Ct.getOS() === Ct.OSType.MacOS || (Ct.getOS(), Ct.OSType.IOS),
|
|
1534
|
+
Ct.getOS() === Ct.OSType.MacOS || (Ct.getOS(), Ct.OSType.IOS), Ct.getOS() === Ct.OSType.MacOS || (Ct.getOS(), Ct.OSType.IOS), Ei({ setClipboard: (e) => {
|
|
1535
1535
|
throw new Error("This is only available via the useClipboard.");
|
|
1536
1536
|
}, getClipboard: () => ho.Global, refNativeCopy: { current: null }, refNativeLastKey: { current: null } }, () => {
|
|
1537
1537
|
const [e, t] = Ze(ho.Global);
|
|
1538
|
-
return { setClipboard: (n) => t(n), getClipboard: () => e, refNativeCopy:
|
|
1538
|
+
return { setClipboard: (n) => t(n), getClipboard: () => e, refNativeCopy: G(null), refNativeLastKey: G(null) };
|
|
1539
1539
|
});
|
|
1540
1540
|
let Ao = !1, zl = 0;
|
|
1541
1541
|
var Al = typeof document < "u" ? tn : st;
|
|
@@ -1567,8 +1567,8 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1567
1567
|
let l, s;
|
|
1568
1568
|
e === "column" ? (l = o.columnMetadataMap, s = o.lastMeasuredColumnIndex) : (l = o.rowMetadataMap, s = o.lastMeasuredRowIndex);
|
|
1569
1569
|
let a = 0;
|
|
1570
|
-
return a = (s > 0 ? l[s].offset : 0) >= r ?
|
|
1571
|
-
},
|
|
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 }) : Bl({ itemType: e, itemSize: t, itemCount: n, instanceProps: o, index: Math.max(0, s), offset: r, scale: i }), a = Math.min(a, n), a;
|
|
1571
|
+
}, _i = ({ itemType: e, itemSize: t, instanceProps: n, high: o, low: r, offset: i, scale: l }) => {
|
|
1572
1572
|
for (; r <= o; ) {
|
|
1573
1573
|
const s = r + Math.floor((o - r) / 2), a = Pn({ itemType: e, itemSize: t, index: s, instanceProps: n, scale: l }).offset;
|
|
1574
1574
|
if (a === i) return s;
|
|
@@ -1578,13 +1578,13 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1578
1578
|
}, Bl = ({ itemType: e, itemSize: t, itemCount: n, instanceProps: o, index: r, offset: i, scale: l }) => {
|
|
1579
1579
|
let s = 1;
|
|
1580
1580
|
for (; r < n && Pn({ itemType: e, itemSize: t, index: r, instanceProps: o, scale: l }).offset < i; ) r += s, s *= 2;
|
|
1581
|
-
return
|
|
1581
|
+
return _i({ itemType: e, itemSize: t, instanceProps: o, high: Math.min(r, n - 1), low: Math.floor(r / 2), offset: i, scale: l });
|
|
1582
1582
|
}, Fl = (e) => {
|
|
1583
|
-
const { rowCount: t, columnCount: n, defaultRowHeight: o, getRowHeight: r, defaultColumnWidth: i, getColumnWidth: l } = e || {}, s =
|
|
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 = k((I) => Or({ itemType: "row", itemCount: t, itemSize: r ?? (() => o ?? 20), instanceProps: s.current, offset: I }), [t, r, o]), d = k((I) => I === -1 ? 0 : Pn({ itemType: "row", index: I, itemSize: r ?? (() => o ?? 20), instanceProps: s.current }).offset, [r, o]), g = k((I) => Pn({ itemType: "row", index: I, itemSize: r ?? (() => o ?? 20), instanceProps: s.current }).size, [r, o]), m = k((I) => Or({ itemType: "column", itemCount: n, itemSize: l ?? (() => i ?? 75), instanceProps: s.current, offset: I }), [n, l, i]), f = k((I) => I === -1 ? 0 : Pn({ itemType: "column", index: I, itemSize: l ?? (() => i ?? 75), instanceProps: s.current }).offset, [l, i]), x = k((I) => Pn({ itemType: "column", index: I, itemSize: l ?? (() => i ?? 75), instanceProps: s.current }).size, [l, i]), [_, M] = Qo((I) => I + 1, 0), R = () => ({ getRowOffset: d, getColOffset: f, getRowIndex: a, getColIndex: m }), [ae, P] = Ze(() => e ? R() : null);
|
|
1584
1584
|
return st(() => {
|
|
1585
1585
|
P(e ? R() : null);
|
|
1586
1586
|
}, [_, t, n, i, o, g, x]), ae;
|
|
1587
|
-
},
|
|
1587
|
+
}, Ii = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ~`!@#$%^&*()-_=+[{]};:'\",<.>/?|\\", Lr = (e) => {
|
|
1588
1588
|
if (!e) return null;
|
|
1589
1589
|
if (e.eventType === "start") return { type: e.eventType };
|
|
1590
1590
|
if (e.eventType === "submit") return { type: e.eventType };
|
|
@@ -1596,22 +1596,22 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1596
1596
|
return e.activeCoords && (t.activeCoords = e.activeCoords), t;
|
|
1597
1597
|
}
|
|
1598
1598
|
return { type: e.eventType ?? "unknown" };
|
|
1599
|
-
}, jl = (e) => !0, Vl = (e) => !!e && !(e.ctrlKey || e.metaKey || e.altKey || e.isComposing) && (!(e.shiftKey || e.key !== "F2" && e.key !== " " && e.key !== "Backspace") || (!e.shiftKey || e.key !== " ") &&
|
|
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: f, ...x } = e, _ =
|
|
1599
|
+
}, jl = (e) => !0, Vl = (e) => !!e && !(e.ctrlKey || e.metaKey || e.altKey || e.isComposing) && (!(e.shiftKey || e.key !== "F2" && e.key !== " " && e.key !== "Backspace") || (!e.shiftKey || e.key !== " ") && Ii.indexOf(e.key) !== -1), Wl = (e) => !!e && e.type === "dblclick" && { editMode: !0 }, Hl = (e) => {
|
|
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: f, ...x } = e, _ = G(null), M = G(null), [R, ae] = Ze(!1), P = t.coords, I = D(async (X) => {
|
|
1601
1601
|
if (_.current?.getBoundingClientRect()) {
|
|
1602
1602
|
if (X.eventType === "keyboard") {
|
|
1603
1603
|
const S = X.event, h = 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 });
|
|
1604
|
-
h.isSynthetic = !0, h.key,
|
|
1604
|
+
h.isSynthetic = !0, h.key, M.current?.dispatchEvent(h);
|
|
1605
1605
|
} else X.eventType === "pointer" || console.warn("unsupported event type", X);
|
|
1606
1606
|
await new Promise((S) => requestAnimationFrame(S));
|
|
1607
1607
|
}
|
|
1608
1608
|
}, []);
|
|
1609
1609
|
st(() => {
|
|
1610
|
-
const X =
|
|
1611
|
-
return ae(!0),
|
|
1612
|
-
t.editorRefs.push(X), t.editorRefsDispatchEditorEvent.push(
|
|
1610
|
+
const X = M.current;
|
|
1611
|
+
return ae(!0), M.current.startEdit?.(t.startEvent), (async () => {
|
|
1612
|
+
t.editorRefs.push(X), t.editorRefsDispatchEditorEvent.push(I);
|
|
1613
1613
|
const T = [...t.events];
|
|
1614
|
-
for (let S = 0; S < T.length; S++) await
|
|
1614
|
+
for (let S = 0; S < T.length; S++) await I(T[S]);
|
|
1615
1615
|
t.onMount(X);
|
|
1616
1616
|
})(), () => {
|
|
1617
1617
|
const T = t.editorRefs.indexOf(X);
|
|
@@ -1620,30 +1620,30 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1620
1620
|
}, []);
|
|
1621
1621
|
const z = D(() => o(t), []), le = D(() => {
|
|
1622
1622
|
r(t);
|
|
1623
|
-
}, []), B = n.current &&
|
|
1624
|
-
return q("div", { tabIndex: 0, ref: _, style: { background: void 0, ...f, opacity: oe ? f?.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:
|
|
1623
|
+
}, []), B = n.current && Z.isEqualCells(n.current, P), oe = l && B && R, be = s({ autoFocus: !!t.startEvent?.autoFocus, ...a, onSubmitEdit: z, onCancelEdit: le, ref: M }, P), N = i.x + we.boundPixel(-g / 2), H = we.boundPixel(i.width + g / 2, !0);
|
|
1624
|
+
return q("div", { tabIndex: 0, ref: _, style: { background: void 0, ...f, opacity: oe ? f?.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 }) });
|
|
1625
1625
|
}, gs = (e) => {
|
|
1626
|
-
const { view: t, canEdit: n = jl, getCellEditor: o, onBeforeStartEdit: r, onStartEdit: i, onSubmitEdit: l, onCancelEdit: s, onDoneEdit: a, isEditorStartKeyEvent: d = Vl, isEditorStartPointerEvent: g = Wl, containerProps: m, borderStrokeFill: f, borderStrokeWidth: x = 2, getRangeCoords: _ = null, activeCoords:
|
|
1626
|
+
const { view: t, canEdit: n = jl, getCellEditor: o, onBeforeStartEdit: r, onStartEdit: i, onSubmitEdit: l, onCancelEdit: s, onDoneEdit: a, isEditorStartKeyEvent: d = Vl, isEditorStartPointerEvent: g = Wl, containerProps: m, borderStrokeFill: f, borderStrokeWidth: x = 2, getRangeCoords: _ = null, activeCoords: M, alignment: R = Wn.Left } = e, [ae, P] = Ze(!1), [I, z] = Ze(void 0), le = k(($, E, Me, ue, me, $e) => {
|
|
1627
1627
|
if (!E) return null;
|
|
1628
1628
|
const dt = me?.(E, $), kt = $.getRangeCoordsBounds(dt), ut = $.toClipBounds(kt), Zt = kt, St = $.getZoom();
|
|
1629
1629
|
if (!ut) return null;
|
|
1630
1630
|
Me && (Me *= St), ue && (ue *= St);
|
|
1631
|
-
let
|
|
1631
|
+
let C = Zt, ve = !1;
|
|
1632
1632
|
if (Me !== void 0) {
|
|
1633
1633
|
let Qe = { ...dt }, cn = 0;
|
|
1634
|
-
for (; !
|
|
1634
|
+
for (; !ve && C.width <= Me && cn < 20; ) {
|
|
1635
1635
|
cn++, cn > 19 && console.warn("max width reached");
|
|
1636
1636
|
const on = $.getTotalRangeCoords(), Mt = $.getLayout();
|
|
1637
|
-
|
|
1637
|
+
$e === Wn.Left ? Qe.colEnd + 1 < on.colEnd ? Qe.colEnd = Mt.getColIndex(C.x + Me) : ve = !0 : $e === Wn.Right ? Qe.colStart - 1 >= 0 ? Qe.colStart = Mt.getColIndex(C.x - (Me - C.width)) : ve = !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)) : ve = !0, ve || (C = $.getRangeCoordsBounds(Qe));
|
|
1638
1638
|
}
|
|
1639
1639
|
}
|
|
1640
|
-
|
|
1640
|
+
C.height = Zt.height, ue !== void 0 && (C.height = Math.max(ue + 1, Zt.height));
|
|
1641
1641
|
const { width: Je, height: mt } = $.getViewportSize();
|
|
1642
|
-
return { x:
|
|
1642
|
+
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
1643
|
}, [R]), B = k(n, [n]), oe = D(() => {
|
|
1644
1644
|
t?.getStage()?.focus();
|
|
1645
|
-
}, [t]),
|
|
1646
|
-
r?.($), te(), P(!0),
|
|
1645
|
+
}, [t]), be = G(null), N = k(($) => {
|
|
1646
|
+
r?.($), te(), P(!0), be.current = null;
|
|
1647
1647
|
}, [r]), H = k(($) => {
|
|
1648
1648
|
i?.($.coords);
|
|
1649
1649
|
}, [i]), X = k(($) => {
|
|
@@ -1651,13 +1651,13 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1651
1651
|
}, [s]), T = k(($) => {
|
|
1652
1652
|
if ($.isSubmitted || $.isCancelled) return !1;
|
|
1653
1653
|
try {
|
|
1654
|
-
return
|
|
1654
|
+
return be.current = $.coords, $.isEditorClosing = !0, $.isSubmitted = !0, $.isEditorSubmitted || ($.isEditorSubmitted = !0, $.editorRefs[0]?.submitEdit?.()), $.coords, l?.($.coords), $.isEditorClosed = !0, oe(), te(), !0;
|
|
1655
1655
|
} catch (E) {
|
|
1656
1656
|
throw $.isEditorClosing = !1, $.isSubmitted = !1, E;
|
|
1657
1657
|
}
|
|
1658
1658
|
}, [l]), S = k(($) => {
|
|
1659
1659
|
P(!1), a?.($.coords), te();
|
|
1660
|
-
}, [a]), h =
|
|
1660
|
+
}, [a]), h = G(null), J = G(null), K = G(null), L = G([]), [U, ee] = Qo(($) => $ + 1, 0), te = D(($) => {
|
|
1661
1661
|
$ && L.current.push($), ee();
|
|
1662
1662
|
}, []), Y = k(($) => {
|
|
1663
1663
|
if ($.defaultPrevented || $.isSynthetic || !t) return;
|
|
@@ -1666,20 +1666,20 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1666
1666
|
}, [t]), He = k(($) => {
|
|
1667
1667
|
const E = $.nativeEvent;
|
|
1668
1668
|
Y(E);
|
|
1669
|
-
}, [t]),
|
|
1669
|
+
}, [t]), Ve = k(($) => {
|
|
1670
1670
|
if ($.defaultPrevented || $.isSynthetic || !t?.getStage()) return;
|
|
1671
1671
|
const E = J.current;
|
|
1672
1672
|
d($, E) && ($.stopPropagation(), $.preventDefault()), $.key, te({ eventType: "keyboard", event: $, coords: E });
|
|
1673
1673
|
}, [t]);
|
|
1674
1674
|
tn(() => {
|
|
1675
1675
|
const $ = (ue, me) => {
|
|
1676
|
-
const
|
|
1677
|
-
if (
|
|
1678
|
-
const dt =
|
|
1679
|
-
if (!B(
|
|
1680
|
-
N?.(
|
|
1676
|
+
const $e = me?.cell ?? ue;
|
|
1677
|
+
if (!$e) return null;
|
|
1678
|
+
const dt = $e;
|
|
1679
|
+
if (!B($e)) return null;
|
|
1680
|
+
N?.($e);
|
|
1681
1681
|
const kt = Ct.uuidV4();
|
|
1682
|
-
me = Object.freeze({ autoFocus: !0, ...me }), K.current =
|
|
1682
|
+
me = Object.freeze({ autoFocus: !0, ...me }), K.current = $e;
|
|
1683
1683
|
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
1684
|
ut.isMounted || (ut.isMounted = !0, te());
|
|
1685
1685
|
}, onUnmount: (Zt) => {
|
|
@@ -1689,11 +1689,11 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1689
1689
|
};
|
|
1690
1690
|
if (document.activeElement !== document.body) St();
|
|
1691
1691
|
else {
|
|
1692
|
-
const
|
|
1693
|
-
|
|
1692
|
+
const C = (ve) => {
|
|
1693
|
+
ve.defaultPrevented || ve.target !== document.body || Ve(ve);
|
|
1694
1694
|
};
|
|
1695
|
-
window.addEventListener("keydown",
|
|
1696
|
-
window.removeEventListener("keydown",
|
|
1695
|
+
window.addEventListener("keydown", C, !0), t.getStage()?.addEventListener("focusin", () => {
|
|
1696
|
+
window.removeEventListener("keydown", C), St();
|
|
1697
1697
|
}, { once: !0 }), oe();
|
|
1698
1698
|
}
|
|
1699
1699
|
}
|
|
@@ -1703,8 +1703,8 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1703
1703
|
if (L.current.length <= 0 && !h.current) return;
|
|
1704
1704
|
const E = L.current[0];
|
|
1705
1705
|
Lr(E), ((ue) => {
|
|
1706
|
-
const me = [],
|
|
1707
|
-
for (let dt = 0; dt <
|
|
1706
|
+
const me = [], $e = ue?.length ?? 0;
|
|
1707
|
+
for (let dt = 0; dt < $e; dt++) {
|
|
1708
1708
|
const kt = ue[dt];
|
|
1709
1709
|
me.push(Lr(kt));
|
|
1710
1710
|
}
|
|
@@ -1720,16 +1720,28 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1720
1720
|
if (E) {
|
|
1721
1721
|
if (E.eventType === "start") {
|
|
1722
1722
|
const ue = E, me = ue.startEvent?.cell ?? J.current;
|
|
1723
|
-
h.current &&
|
|
1723
|
+
h.current && Z.isEqualCells(h.current.coords, me) || (h.current = $(me, ue.startEvent));
|
|
1724
1724
|
} else if (E.eventType === "keyboard") {
|
|
1725
1725
|
const ue = E.event;
|
|
1726
1726
|
if (h.current) {
|
|
1727
|
-
|
|
1728
|
-
|
|
1727
|
+
let me = !1;
|
|
1728
|
+
switch (ue.which) {
|
|
1729
|
+
case ci:
|
|
1730
|
+
case di:
|
|
1731
|
+
case ai:
|
|
1732
|
+
case ui:
|
|
1733
|
+
case si:
|
|
1734
|
+
case li:
|
|
1735
|
+
me = !0;
|
|
1736
|
+
}
|
|
1737
|
+
if (!me) {
|
|
1738
|
+
h.current.events.push(E);
|
|
1739
|
+
for (let $e = 0; $e < h.current.editorRefsDispatchEditorEvent.length; $e++) h.current.editorRefsDispatchEditorEvent[$e](E);
|
|
1740
|
+
}
|
|
1729
1741
|
} else if (d(ue, E.coords)) {
|
|
1730
1742
|
let me;
|
|
1731
|
-
const
|
|
1732
|
-
|
|
1743
|
+
const $e = $(me?.cell ?? J.current, me);
|
|
1744
|
+
$e && $e.events.push(E), h.current = $e;
|
|
1733
1745
|
}
|
|
1734
1746
|
} else if (E.eventType === "pointer") {
|
|
1735
1747
|
const ue = E.event;
|
|
@@ -1737,10 +1749,10 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1737
1749
|
h.current.events.push(E);
|
|
1738
1750
|
for (let me = 0; me < h.current.editorRefsDispatchEditorEvent.length; me++) h.current.editorRefsDispatchEditorEvent[me](E);
|
|
1739
1751
|
} else {
|
|
1740
|
-
const me = E?.coords ?? J.current,
|
|
1741
|
-
if (
|
|
1752
|
+
const me = E?.coords ?? J.current, $e = g(ue, me);
|
|
1753
|
+
if ($e) {
|
|
1742
1754
|
let dt;
|
|
1743
|
-
typeof dt != "boolean" && (dt =
|
|
1755
|
+
typeof dt != "boolean" && (dt = $e);
|
|
1744
1756
|
const kt = $(me, dt);
|
|
1745
1757
|
kt && kt.events.push(E), h.current = kt;
|
|
1746
1758
|
}
|
|
@@ -1770,14 +1782,13 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1770
1782
|
t && h.current?.coords && t.scrollCellCoordsIntoView(h.current.coords);
|
|
1771
1783
|
})));
|
|
1772
1784
|
}, [U]), st(() => {
|
|
1773
|
-
|
|
1774
|
-
K.current = I;
|
|
1785
|
+
K.current = M;
|
|
1775
1786
|
const $ = h.current?.coords;
|
|
1776
|
-
|
|
1777
|
-
}, [
|
|
1787
|
+
Z.isEqualCells($, M) || (h.current && (h.current.isEditorClosing = !0), te({ eventType: "coordsChange", activeCoords: M }));
|
|
1788
|
+
}, [M]);
|
|
1778
1789
|
const Ne = D(($) => {
|
|
1779
|
-
|
|
1780
|
-
}, []), { width: at = 0, height: Se = 0 } =
|
|
1790
|
+
Ve($.nativeEvent);
|
|
1791
|
+
}, []), { width: at = 0, height: Se = 0 } = I ?? { width: 0, height: 0 }, Ye = k(o, [o]);
|
|
1781
1792
|
return { overlay: k(($) => {
|
|
1782
1793
|
if (!h.current || h.current.isEditorClosed) return h.current, null;
|
|
1783
1794
|
h.current.coords;
|
|
@@ -1791,11 +1802,11 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1791
1802
|
te({ eventType: "submit" });
|
|
1792
1803
|
}, []), cancelEdit: D(() => {
|
|
1793
1804
|
te({ eventType: "cancel" });
|
|
1794
|
-
}, []), onKeyboardEvent: Ne, onPointerEvent: He, onKeyboardEventNative:
|
|
1795
|
-
}, ws = ({ 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: f, modifySelection: x, appendSelection: _, clearSelections:
|
|
1796
|
-
const R = o ?? ((n === an ? e.current?.rowCount : e.current?.columnCount) || 0), ae =
|
|
1805
|
+
}, []), onKeyboardEvent: Ne, onPointerEvent: He, onKeyboardEventNative: Ve, onPointerEventNative: Y, isEditing: ae };
|
|
1806
|
+
}, ws = ({ 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: f, modifySelection: x, appendSelection: _, clearSelections: M }) => {
|
|
1807
|
+
const R = o ?? ((n === an ? e.current?.rowCount : e.current?.columnCount) || 0), ae = G(null), P = G(null), I = G(!1), z = G(null), le = 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]), oe = (S) => {
|
|
1797
1808
|
P.current = B(S), x(P.current, ae.current);
|
|
1798
|
-
},
|
|
1809
|
+
}, be = D((S, h) => {
|
|
1799
1810
|
if (!e.current) return;
|
|
1800
1811
|
const J = e.current.getViewFromClient(S, h)?.getCellCoordsFromClient(S, h);
|
|
1801
1812
|
return J ? (n === Nt ? J.rowIndex = t.current.getViewport().rowStart : J.colIndex = t.current.getViewport().colStart, J) : void 0;
|
|
@@ -1804,12 +1815,12 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1804
1815
|
return h || (J = { ...S }, n === an ? delete J.colIndex : delete J.rowIndex), t.current?.scrollCellCoordsIntoView(J);
|
|
1805
1816
|
}, [n]), H = k(a, [a]), X = k(s, [s]), T = _e(() => ({ onPointerDown: (S) => {
|
|
1806
1817
|
if (!e || !e.current || S.nativeEvent.defaultPrevented) return;
|
|
1807
|
-
const h =
|
|
1818
|
+
const h = be(S.nativeEvent.clientX, S.nativeEvent.clientY);
|
|
1808
1819
|
if (!h) return;
|
|
1809
1820
|
S.nativeEvent.which;
|
|
1810
1821
|
const J = S.nativeEvent.shiftKey, K = S.nativeEvent.ctrlKey || S.nativeEvent.metaKey;
|
|
1811
1822
|
if (d?.(S, h) === !1) return;
|
|
1812
|
-
X?.(),
|
|
1823
|
+
X?.(), I.current = !0;
|
|
1813
1824
|
const L = t.current?.getViewFromClient(S.nativeEvent.clientX, S.nativeEvent.clientY), U = ((ee, te) => n === Nt ? { ...ee, rowIndex: te.rowStart } : { ...ee, colIndex: te.colStart })(h, L.getVisibleRangeCoords());
|
|
1814
1825
|
if (J) oe(h);
|
|
1815
1826
|
else {
|
|
@@ -1821,16 +1832,16 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1821
1832
|
})(h, h, U), oe(h), l && N(U, !0);
|
|
1822
1833
|
}
|
|
1823
1834
|
}, onPointerMoveOrWait: Ct.throttle((S) => {
|
|
1824
|
-
if (!
|
|
1825
|
-
const h =
|
|
1835
|
+
if (!I.current || !e?.current) return;
|
|
1836
|
+
const h = be(S.clientX, S.clientY);
|
|
1826
1837
|
if (h && g?.(S, h) !== !1) {
|
|
1827
|
-
if (
|
|
1838
|
+
if (Z.isEqualCells(z.current, h)) return M();
|
|
1828
1839
|
oe(h), N(h);
|
|
1829
1840
|
}
|
|
1830
1841
|
}, 60), onPointerUp: (S) => {
|
|
1831
|
-
|
|
1832
|
-
}, processTouch: !0, consumeTouch: !0 }), [r, l, R, i,
|
|
1833
|
-
return { onPointerDown: k(On(T), []), getCellCoordsFromClient:
|
|
1842
|
+
I.current = !1, H?.(), m?.(S);
|
|
1843
|
+
}, processTouch: !0, consumeTouch: !0 }), [r, l, R, i, M, d, m]);
|
|
1844
|
+
return { onPointerDown: k(On(T), []), getCellCoordsFromClient: be };
|
|
1834
1845
|
}, qe = (e, t, n) => {
|
|
1835
1846
|
if (!e) return t;
|
|
1836
1847
|
let o = t;
|
|
@@ -1921,9 +1932,9 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1921
1932
|
let l = o;
|
|
1922
1933
|
return e === "nearest" && (o - t > 0 ? e = "start" : n - r > 0 && (e = "end")), e === "start" ? l = t : e === "end" ? l = n - (r - o) : e === "center" && (l = t + (n - t) / 2 - (r - o) / 2), Math.max(0, Math.min(l, i - (r - o)));
|
|
1923
1934
|
}, Ar = (e, t, n, o) => (console.log("todo: implement convertToVisibleRanges"), e), Xo = (e, t = Ke, n, o, r, i = null) => {
|
|
1924
|
-
if (i &&
|
|
1935
|
+
if (i && Z.isEqualSelectionCoords(i, e)) return e;
|
|
1925
1936
|
const l = e.ranges[e.rangeIndex];
|
|
1926
|
-
if (!
|
|
1937
|
+
if (!Z.isRangesIntersect({ rowStart: e.cell.rowIndex, colStart: e.cell.colIndex, rowEnd: e.cell.rowIndex, colEnd: e.cell.colIndex }, l)) return e;
|
|
1927
1938
|
let s = { ...e.cell }, a = e.rangeIndex;
|
|
1928
1939
|
switch (t) {
|
|
1929
1940
|
case Ke:
|
|
@@ -1971,8 +1982,8 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
1971
1982
|
s = { rowIndex: f, colIndex: x };
|
|
1972
1983
|
}
|
|
1973
1984
|
let g = n(s);
|
|
1974
|
-
if (!
|
|
1975
|
-
const f =
|
|
1985
|
+
if (!Z.isRangeWithinRange(g, l)) {
|
|
1986
|
+
const f = Z.intersectRanges(g, l);
|
|
1976
1987
|
f && (g = f);
|
|
1977
1988
|
}
|
|
1978
1989
|
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) };
|
|
@@ -2022,21 +2033,21 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
2022
2033
|
const { linePoints: t, bounds: n, pathProps: o, style: r, ...i } = e;
|
|
2023
2034
|
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 }) });
|
|
2024
2035
|
}, Yl = (e) => {
|
|
2025
|
-
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: f, style: x, ..._ } = e,
|
|
2026
|
-
let
|
|
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: f, style: x, ..._ } = e, M = n, R = t, ae = o, P = r;
|
|
2037
|
+
let I = null;
|
|
2027
2038
|
if (i) {
|
|
2028
2039
|
let z = $o({ top: 0, left: 0, bottom: P, right: ae });
|
|
2029
|
-
m && (z = z + " " + $o({ top: m.y -
|
|
2040
|
+
m && (z = z + " " + $o({ top: m.y - M, left: m.x - R, bottom: m.height + m.y - M, right: m.width + m.x - R })), I = [q("path", { d: z, fill: i, stroke: "none", fillRule: "evenodd" }, "fill")];
|
|
2030
2041
|
}
|
|
2031
|
-
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 }, ..._, children: [
|
|
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 }, ..._, children: [I, q("path", { d: $o({ top: 0, left: 0, right: ae, bottom: P }), fill: "none", strokeDasharray: a, strokeDashoffset: d, stroke: l, vectorEffect: "non-scaling-stroke", strokeWidth: s, ...f })] });
|
|
2032
2043
|
}, Xl = (e) => {
|
|
2033
2044
|
const { key: t, ...n } = e;
|
|
2034
|
-
return q(
|
|
2035
|
-
},
|
|
2045
|
+
return q(Ci, { ...n }, t);
|
|
2046
|
+
}, Ci = At((e) => {
|
|
2036
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, ...f } = e, x = a || !!d, _ = { name: "walking-offset", dashGap: 2, speed: 50, dashLength: 8, ...d };
|
|
2037
|
-
let
|
|
2038
|
-
const R = _.speed *
|
|
2039
|
-
let
|
|
2048
|
+
let M = _.dashGap + _.dashLength;
|
|
2049
|
+
const R = _.speed * M, ae = $l().replaceAll(":", ""), P = `${_.name}-${ae}`;
|
|
2050
|
+
let I;
|
|
2040
2051
|
return st(() => {
|
|
2041
2052
|
if (!x) return;
|
|
2042
2053
|
const z = `@keyframes ${P} {
|
|
@@ -2047,50 +2058,50 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
|
|
|
2047
2058
|
return le.appendChild(document.createTextNode(z)), document.head.appendChild(le), le.sheet.insertRule(z, 0), () => {
|
|
2048
2059
|
document.head.removeChild(le);
|
|
2049
2060
|
};
|
|
2050
|
-
}, [x]), x && (
|
|
2061
|
+
}, [x]), x && (I = { strokeDasharray: `${_.dashLength}px ${_.dashGap}px`, strokeDashoffset: `${M}px`, animation: `${P} ${R}ms linear infinite`, willChange: "stroke-dashoffset" }), q(Yl, { x: o, y: r, width: i, height: l, stroke: t, fill: n, shapeRendering: "crispEdges", style: { ...I, ...s }, ...f });
|
|
2051
2062
|
});
|
|
2052
|
-
function
|
|
2063
|
+
function Mi(e) {
|
|
2053
2064
|
var t, n, o = "";
|
|
2054
2065
|
if (typeof e == "string" || typeof e == "number") o += e;
|
|
2055
2066
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
2056
2067
|
var r = e.length;
|
|
2057
|
-
for (t = 0; t < r; t++) e[t] && (n =
|
|
2068
|
+
for (t = 0; t < r; t++) e[t] && (n = Mi(e[t])) && (o && (o += " "), o += n);
|
|
2058
2069
|
} else for (n in e) e[n] && (o && (o += " "), o += n);
|
|
2059
2070
|
return o;
|
|
2060
2071
|
}
|
|
2061
2072
|
function En() {
|
|
2062
|
-
for (var e, t, n = 0, o = "", r = arguments.length; n < r; n++) (e = arguments[n]) && (t =
|
|
2073
|
+
for (var e, t, n = 0, o = "", r = arguments.length; n < r; n++) (e = arguments[n]) && (t = Mi(e)) && (o && (o += " "), o += t);
|
|
2063
2074
|
return o;
|
|
2064
2075
|
}
|
|
2065
|
-
|
|
2066
|
-
const
|
|
2076
|
+
Ci.displayName = "Selection";
|
|
2077
|
+
const Ti = At(Ut((e, t) => {
|
|
2067
2078
|
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;
|
|
2068
2079
|
if (n === 0 || o === 0) return null;
|
|
2069
|
-
let f = !0, x = !0, _ = !0,
|
|
2080
|
+
let f = !0, x = !0, _ = !0, M = !0;
|
|
2070
2081
|
switch (s) {
|
|
2071
2082
|
case "tl":
|
|
2072
2083
|
f = !1, x = !1;
|
|
2073
2084
|
break;
|
|
2074
2085
|
case "bl":
|
|
2075
|
-
f = !1,
|
|
2086
|
+
f = !1, M = !1;
|
|
2076
2087
|
break;
|
|
2077
2088
|
case "br":
|
|
2078
|
-
_ = !1,
|
|
2089
|
+
_ = !1, M = !1;
|
|
2079
2090
|
break;
|
|
2080
2091
|
case "tr":
|
|
2081
2092
|
x = !1, _ = !1;
|
|
2082
2093
|
}
|
|
2083
|
-
return q("div", { className: En("fill-handle", d), style: { position: "absolute", left: n - (i + (f ? r : 0)) / 2, top: o - (i + (x ? r : 0)) / 2, width: i, height: i, borderLeft: f ? `${r}px ${l}` : void 0, borderTop: x ? `${r}px ${l}` : void 0, borderRight: _ ? `${r}px ${l}` : void 0, borderBottom:
|
|
2094
|
+
return q("div", { className: En("fill-handle", d), style: { position: "absolute", left: n - (i + (f ? r : 0)) / 2, top: o - (i + (x ? r : 0)) / 2, width: i, height: i, borderLeft: f ? `${r}px ${l}` : void 0, borderTop: x ? `${r}px ${l}` : void 0, borderRight: _ ? `${r}px ${l}` : void 0, borderBottom: M ? `${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 });
|
|
2084
2095
|
}));
|
|
2085
|
-
|
|
2096
|
+
Ti.displayName = "FillHandle";
|
|
2086
2097
|
var Gl = function() {
|
|
2087
|
-
},
|
|
2088
|
-
const
|
|
2098
|
+
}, Ri = typeof window < "u", Zl = Ri ? tn : st, Vr = { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 };
|
|
2099
|
+
const ki = Ri && window.ResizeObserver !== void 0 ? function() {
|
|
2089
2100
|
var e = Ze(null), t = e[0], n = e[1], o = Ze(Vr), r = o[0], i = o[1], l = _e(function() {
|
|
2090
2101
|
return new window.ResizeObserver(function(s) {
|
|
2091
2102
|
if (s[0]) {
|
|
2092
|
-
var a = s[0].contentRect, d = a.x, g = a.y, m = a.width, f = a.height, x = a.top, _ = a.left,
|
|
2093
|
-
i({ x: d, y: g, width: m, height: f, top: x, left: _, bottom:
|
|
2103
|
+
var a = s[0].contentRect, d = a.x, g = a.y, m = a.width, f = a.height, x = a.top, _ = a.left, M = a.bottom, R = a.right;
|
|
2104
|
+
i({ x: d, y: g, width: m, height: f, top: x, left: _, bottom: M, right: R });
|
|
2094
2105
|
}
|
|
2095
2106
|
});
|
|
2096
2107
|
}, []);
|
|
@@ -2123,7 +2134,7 @@ var Jl = parseInt(Kr.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
2123
2134
|
};
|
|
2124
2135
|
};
|
|
2125
2136
|
const Go = At(Ut((e, t) => {
|
|
2126
|
-
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: f, onTouchSelectEnd: x, currentTouchAnchor: _, scrollableElement:
|
|
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: f, onTouchSelectEnd: x, currentTouchAnchor: _, scrollableElement: M, scrollableRoot: R = document.body, ...ae } = e, P = k(f, [f]), I = k(x, [x]), { bounds: z, coordsPivot: le, key: B } = _e(() => {
|
|
2127
2138
|
if (!n || !o) return null;
|
|
2128
2139
|
let K = null, L = null;
|
|
2129
2140
|
switch (r) {
|
|
@@ -2144,7 +2155,7 @@ const Go = At(Ut((e, t) => {
|
|
|
2144
2155
|
K = { colIndex: n.colStart, rowIndex: n.rowEnd };
|
|
2145
2156
|
}
|
|
2146
2157
|
let U = o.getRangeCoordsBounds(L ? { rowStart: L.rowIndex, colStart: L.colIndex, rowEnd: L.rowIndex, colEnd: L.colIndex } : n);
|
|
2147
|
-
const ee = o.getBounds(), te = o.getViewportSize(), Y = ee.x, He = ee.y,
|
|
2158
|
+
const ee = o.getBounds(), te = o.getViewportSize(), Y = ee.x, He = ee.y, Ve = te.width, Ne = te.height;
|
|
2148
2159
|
switch (r) {
|
|
2149
2160
|
case "tl":
|
|
2150
2161
|
break;
|
|
@@ -2152,10 +2163,10 @@ const Go = At(Ut((e, t) => {
|
|
|
2152
2163
|
U.x = U.x + U.width, U.y = U.y + U.height;
|
|
2153
2164
|
break;
|
|
2154
2165
|
case "t":
|
|
2155
|
-
U.x =
|
|
2166
|
+
U.x = Ve / 2 - Y;
|
|
2156
2167
|
break;
|
|
2157
2168
|
case "b":
|
|
2158
|
-
U.x =
|
|
2169
|
+
U.x = Ve / 2 - Y, U.y = U.y + U.height;
|
|
2159
2170
|
break;
|
|
2160
2171
|
case "l":
|
|
2161
2172
|
U.y = Ne / 2 - He;
|
|
@@ -2164,8 +2175,8 @@ const Go = At(Ut((e, t) => {
|
|
|
2164
2175
|
U.x = U.x + U.width, U.y = Ne / 2 - He;
|
|
2165
2176
|
}
|
|
2166
2177
|
const at = o.toClipBounds(U, 0);
|
|
2167
|
-
return !at || at.width <= 0 || at.height <= 0 || U.x < 0 || U.y < 0 || U.x >
|
|
2168
|
-
}, [n, o, r]), oe =
|
|
2178
|
+
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]), oe = G(null), be = On(_e(() => {
|
|
2169
2180
|
const K = (L) => r === "t" || r === "b" ? { ...L, colIndex: void 0 } : r === "l" || r === "r" ? { ...L, rowIndex: void 0 } : L;
|
|
2170
2181
|
return { processTouch: !0, consumeTouch: !0, onPointerDown: (L, U) => {
|
|
2171
2182
|
const ee = K(o.getCellCoordsFromClient(L.clientX, L.clientY));
|
|
@@ -2173,66 +2184,66 @@ const Go = At(Ut((e, t) => {
|
|
|
2173
2184
|
}, onPointerMoveOrWait: (L, U, ee) => {
|
|
2174
2185
|
const te = K(o.getCellCoordsFromClient(L.clientX, L.clientY));
|
|
2175
2186
|
return m.onSelectionPointerMoveOrWait(L, U, ee, o, te, oe.current?.coordsPivot, !0, !0);
|
|
2176
|
-
}, onPointerUp: (L, U, ee) => (oe.current = null,
|
|
2177
|
-
}, [m, n, o, r])), [N, { y: H, x: X }] =
|
|
2187
|
+
}, onPointerUp: (L, U, ee) => (oe.current = null, I?.(r), m.onPointerUp(L, U, ee)) };
|
|
2188
|
+
}, [m, n, o, r])), [N, { y: H, x: X }] = ki(), T = G(null), { getPortalContainer: S } = bi(), [h, J] = Ze(null);
|
|
2178
2189
|
return st(() => {
|
|
2179
2190
|
const K = T.current?.getBoundingClientRect();
|
|
2180
2191
|
if (!K || !z) return void J(null);
|
|
2181
|
-
let L = 0, U = 0, ee =
|
|
2192
|
+
let L = 0, U = 0, ee = M;
|
|
2182
2193
|
for (; ee; ) L += ee.scrollLeft, U += ee.scrollTop, ee = R && ee === R.parentElement ? null : ee.parentElement;
|
|
2183
|
-
J(qr(q("div", { className: En("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: _ ? 0 : 1, transitionDuration: "160ms", transitionProperty: "opacity", ...d }, tabIndex: -1, onPointerDown:
|
|
2184
|
-
}, [H, X, z?.x, z?.y, z?.width, z?.height, g, _, l, a, s, i,
|
|
2194
|
+
J(qr(q("div", { className: En("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: _ ? 0 : 1, transitionDuration: "160ms", transitionProperty: "opacity", ...d }, tabIndex: -1, onPointerDown: be, ...ae }), R ?? S(), B));
|
|
2195
|
+
}, [H, X, z?.x, z?.y, z?.width, z?.height, g, _, l, a, s, i, M]), z ? Ht(wn, { children: [q("div", { ref: Jl([N, T]), style: { position: "absolute", left: z.x, top: z.y, opacity: 0 } }), h] }) : null;
|
|
2185
2196
|
}));
|
|
2186
2197
|
Go.displayName = "TouchSelectHandle";
|
|
2187
|
-
const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd: 0 }),
|
|
2198
|
+
const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd: 0 }), Pi = Object.freeze({ colIndex: 0, rowIndex: 0 }), Zo = Object.freeze([]), Yt = (e) => {
|
|
2188
2199
|
if (e && e.cell && e.ranges && e.rangeIndex > -1 && e.rangeIndex <= e.ranges.length) return e;
|
|
2189
2200
|
const t = { cell: null, ranges: e?.ranges ?? Zo };
|
|
2190
|
-
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 =
|
|
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 = Pi), Z.isEqualSelectionCoords(t, e) ? e : t;
|
|
2191
2202
|
}, lo = (e, t, n) => {
|
|
2192
2203
|
const o = e.getVisibleRangeCoords(), r = e.getScrollOrientation();
|
|
2193
2204
|
!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);
|
|
2194
|
-
}, es = () => !1, ms = ({ 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: f, onFill: x, disableFillDrag: _ = !x, fillHandleBorderColor:
|
|
2195
|
-
const Se = D(() => ({ top: B?.top ?? 0, left: B?.left ?? 0, bottom: e.current?.rowCount - 1 || 0, right: e.current?.columnCount - 1 || 0 }), []), Ye = k(x, [x]), $ = k(g, [g]), E = k(m, [m]), Me = k(f, [f]), ue = k(P, [P]), me = k(J, [J]),
|
|
2205
|
+
}, es = () => !1, ms = ({ 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: f, onFill: x, disableFillDrag: _ = !x, fillHandleBorderColor: M = "white", hiddenRowsAt: R, hiddenColumnsAt: ae, isContentfulCell: P, contentfulCellFinder: I = Kl, getDataCoords: z, alwaysScrollToActiveCoords: le = !1, selectionBounds: B, pointerDownInterceptor: oe, pointerMoveInterceptor: be, mergedRanges: N, canSelectionSpanMergedCells: H = es, onMoveDragStart: X, onMoveDragUpdate: T, onMoveDragEnd: S, onMoveDragDone: h, selectionRenderer: J = Xl, disableMoveDrag: K = !S, getCellCoordsAsRangeCoords: L = Z.cellToRange, moveDragHitSize: U = 6, moveDragOutlineSize: ee = 4, selectionBackgroundColor: te = "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 }) => {
|
|
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 = k(x, [x]), $ = k(g, [g]), E = k(m, [m]), Me = k(f, [f]), ue = k(P, [P]), me = k(J, [J]), $e = k((c, u = !1) => go(c, u, n.getRowOffset, u ? Se().bottom : Se().top), [n?.getRowOffset]), dt = k(R ?? $e, [R]), kt = k((c, u = !1) => go(c, u, n.getColOffset, u ? Se().right : Se().left), [n?.getColOffset]), ut = k(ae ?? kt, [ae]), [Zt, St] = Ze(() => Yt(o)), C = _e(() => Yt(Zt), [Zt]), ve = G(C), Je = G(!0);
|
|
2196
2207
|
tn(Ct.throttle(() => {
|
|
2197
2208
|
St((c) => {
|
|
2198
2209
|
Je.current = !0;
|
|
2199
2210
|
const u = Yt(o);
|
|
2200
|
-
return
|
|
2211
|
+
return Z.isEqualSelectionCoords(u, c) ? c : u;
|
|
2201
2212
|
});
|
|
2202
2213
|
}, 0), [o]), tn(() => {
|
|
2203
|
-
|
|
2204
|
-
}, [
|
|
2205
|
-
Je.current || !r ||
|
|
2206
|
-
}, [
|
|
2214
|
+
ve.current = C;
|
|
2215
|
+
}, [C]), st(() => {
|
|
2216
|
+
Je.current || !r || Z.isEqualSelectionCoords(o, C) || r(C);
|
|
2217
|
+
}, [C]);
|
|
2207
2218
|
const mt = D((c) => {
|
|
2208
2219
|
St((u) => {
|
|
2209
2220
|
Je.current = !1, u = Yt(u);
|
|
2210
2221
|
let w = typeof c == "function" ? c(u.ranges) : c ?? Zo;
|
|
2211
|
-
if (
|
|
2222
|
+
if (Z.isEqualRangesArrays(w, u.ranges)) return u;
|
|
2212
2223
|
let p = Math.max(w.length ? 0 : -1, Math.min(u.rangeIndex, w.length - 1)), y = u.cell;
|
|
2213
|
-
p === -1 ||
|
|
2224
|
+
p === -1 || Z.isCellWithinRange(y, w[p]) || (y = { rowIndex: w[p].rowStart, colIndex: w[p].colStart }), w.length === 1 && Z.isSingleCell(w[0]) && Z.isCellWithinRange(y, w[0]) && (w = [], p = -1);
|
|
2214
2225
|
const W = { cell: y, ranges: w, rangeIndex: p };
|
|
2215
|
-
return
|
|
2226
|
+
return Z.isEqualSelectionCoords(W, u) ? u : W;
|
|
2216
2227
|
});
|
|
2217
2228
|
}, []), Qe = k((c) => {
|
|
2218
2229
|
St((u) => {
|
|
2219
2230
|
Je.current = !1, u = Yt(u);
|
|
2220
|
-
const w = c ??
|
|
2221
|
-
if (!
|
|
2222
|
-
if (
|
|
2231
|
+
const w = c ?? Pi, p = L(w);
|
|
2232
|
+
if (!Z.isSingleCell(p) && u.ranges.length === 0) return { ranges: [p], rangeIndex: 0, cell: w };
|
|
2233
|
+
if (Z.isEqualCells(w, u.cell)) return u;
|
|
2223
2234
|
let y = u.ranges, W = u.rangeIndex;
|
|
2224
|
-
u.ranges.length === 1 && (
|
|
2235
|
+
u.ranges.length === 1 && (Z.isSingleCell(u.ranges[0]) && Z.isCellWithinRange(w, u.ranges[0]) || !Z.isCellWithinRange(w, u.ranges[0])) && (y = [], W = -1);
|
|
2225
2236
|
const b = { ranges: y, rangeIndex: W, cell: w };
|
|
2226
|
-
return
|
|
2237
|
+
return Z.isEqualSelectionCoords(b, u) ? u : b;
|
|
2227
2238
|
});
|
|
2228
|
-
}, [L]), [cn, on] = Ze(null), [Mt, dn] = Ze(null), nn =
|
|
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), Q = G(null), et = G(N);
|
|
2229
2240
|
st(() => {
|
|
2230
2241
|
et.current = N;
|
|
2231
2242
|
}, [N]);
|
|
2232
2243
|
const Ue = k((c, u = { inline: "nearest", block: "nearest" }) => {
|
|
2233
2244
|
let { rowIndex: w, colIndex: p } = c;
|
|
2234
|
-
w === void 0 &&
|
|
2235
|
-
}, [
|
|
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 }, u);
|
|
2246
|
+
}, [C]), ht = D((c) => {
|
|
2236
2247
|
const u = Se();
|
|
2237
2248
|
return c.rowIndex < u.top || c.colIndex < u.left || c.colIndex > u.right || c.rowIndex > u.bottom;
|
|
2238
2249
|
}, []), Ie = k((c, u) => {
|
|
@@ -2241,21 +2252,21 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2241
2252
|
if (H?.(w)) return w;
|
|
2242
2253
|
const y = L(c), W = L(u), b = { rowStart: Math.min(y.rowStart, W.rowStart), colStart: Math.min(y.colStart, W.colStart), rowEnd: Math.max(y.rowEnd, W.rowEnd), colEnd: Math.max(y.colEnd, W.colEnd) };
|
|
2243
2254
|
let he;
|
|
2244
|
-
return typeof et.current == "function" ? he = et.current(b) : N && (he = N), he ?
|
|
2255
|
+
return typeof et.current == "function" ? he = et.current(b) : N && (he = N), he ? Z.extendRangeToUnionRanges(b, he) : b;
|
|
2245
2256
|
}, [H, L]), Oe = k((c, u, w) => {
|
|
2246
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 }, y = { rowStart: Math.min(u.rowIndex ?? p.rowStart, w.rowIndex ?? p.rowStart), colStart: Math.min(u.colIndex ?? p.colStart, w.colIndex ?? p.colStart), rowEnd: Math.max(u.rowIndex ?? p.rowEnd, w.rowIndex ?? p.rowEnd), colEnd: Math.max(u.colIndex ?? p.colEnd, w.colIndex ?? p.colEnd) }, W = { rowIndex: y.rowStart, colIndex: y.colStart }, b = { rowIndex: y.rowEnd, colIndex: y.colEnd };
|
|
2247
2258
|
if (!(ht(W) || ht(b)))
|
|
2248
2259
|
return Ie(W, b);
|
|
2249
2260
|
}, [Ie]), rt = k((c, u, w) => {
|
|
2250
|
-
if (s === "single" || !
|
|
2251
|
-
const p = Oe(
|
|
2261
|
+
if (s === "single" || !ve.current) return;
|
|
2262
|
+
const p = Oe(ve.current, c, u ?? ve.current.cell);
|
|
2252
2263
|
if (!p) return;
|
|
2253
|
-
const y =
|
|
2264
|
+
const y = ve.current.rangeIndex;
|
|
2254
2265
|
mt((W) => W.length ? W.map((b, he) => y === he ? p : b) : [p]), w && p && Qe({ colIndex: p.colStart, rowIndex: p.rowStart });
|
|
2255
2266
|
}, []), tt = D((c, u, w) => {
|
|
2256
|
-
if (!
|
|
2257
|
-
c = { ...
|
|
2258
|
-
const p = Oe(
|
|
2267
|
+
if (!ve.current) return;
|
|
2268
|
+
c = { ...ve.current?.cell, ...c }, u = u ?? c;
|
|
2269
|
+
const p = Oe(ve.current, c, u);
|
|
2259
2270
|
if (!p) return;
|
|
2260
2271
|
const y = { rowIndex: p.rowStart, colIndex: p.colStart }, W = { ...y, ...w };
|
|
2261
2272
|
a === "clear" ? (We.current = W, rn()) : a === "modify" ? rt(y) : ze(y), Qe(W);
|
|
@@ -2267,11 +2278,11 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2267
2278
|
let W = p.ranges.length > 0 ? [...p.ranges] : [Ie(p.cell, p.cell)];
|
|
2268
2279
|
W.push(y);
|
|
2269
2280
|
const b = { ranges: W, cell: { rowIndex: y.rowStart, colIndex: y.colStart, ...w }, rangeIndex: W.length - 1 };
|
|
2270
|
-
return
|
|
2281
|
+
return Z.isEqualSelectionCoords(b, p) ? p : b;
|
|
2271
2282
|
});
|
|
2272
2283
|
}, []), rn = () => {
|
|
2273
2284
|
mt(Zo);
|
|
2274
|
-
}, Tt = we.detectIt().primaryInput === "touch", nt =
|
|
2285
|
+
}, Tt = we.detectIt().primaryInput === "touch", nt = G(null), Rt = G(null), Ot = G(null), hn = _e(() => ({ onPointerDown: (c) => {
|
|
2275
2286
|
if (!e || !e.current) return !1;
|
|
2276
2287
|
const u = c.nativeEvent, w = e.current.getViewFromClient(u.clientX, u.clientY);
|
|
2277
2288
|
if (u.pointerType === "touch" || u.type === "touchstart") return Rt.current = { topLeft: w.getScrollTopLeft(), point: { x: u.clientX, y: u.clientY } }, !0;
|
|
@@ -2279,29 +2290,29 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2279
2290
|
if (!p) return !1;
|
|
2280
2291
|
nt.current = { anchor: w.getAnchor(), coords: p }, Q.current = null;
|
|
2281
2292
|
const y = c.nativeEvent.which === _r;
|
|
2282
|
-
if (y &&
|
|
2293
|
+
if (y && Z.indexOfCoords(p, C.ranges) !== -1)
|
|
2283
2294
|
return !1;
|
|
2284
|
-
const W = c.nativeEvent.shiftKey, b = c.nativeEvent.ctrlKey || c.nativeEvent.metaKey, he = b, ne = d, re =
|
|
2285
|
-
if (oe?.(c, p,
|
|
2286
|
-
i?.(
|
|
2295
|
+
const W = c.nativeEvent.shiftKey, b = c.nativeEvent.ctrlKey || c.nativeEvent.metaKey, he = b, ne = d, re = C.ranges.length > 0, ge = b && ne;
|
|
2296
|
+
if (oe?.(c, p, C) === !1) return !1;
|
|
2297
|
+
i?.(ve.current, c.nativeEvent);
|
|
2287
2298
|
const Le = !y && s !== "single";
|
|
2288
2299
|
if (W) return rt(p), Le;
|
|
2289
|
-
const de =
|
|
2300
|
+
const de = Z.isEqualCells(p, C.cell);
|
|
2290
2301
|
if (he) {
|
|
2291
2302
|
if (de && (!ge || !re)) return Le;
|
|
2292
|
-
if (b &&
|
|
2303
|
+
if (b && Z.indexOfCoords(p, C.ranges) !== -1 && ne) {
|
|
2293
2304
|
xt.current = p;
|
|
2294
2305
|
const ie = Ie(p, p);
|
|
2295
2306
|
return Vt.current = ie, Kt(ie), Le;
|
|
2296
2307
|
}
|
|
2297
2308
|
return ze(p), Le;
|
|
2298
2309
|
}
|
|
2299
|
-
le && Ue(p), de &&
|
|
2310
|
+
le && Ue(p), de && C.ranges.length === 0 || tt(p);
|
|
2300
2311
|
}, onPointerMoveOrWait: Ct.throttle((c, u) => {
|
|
2301
2312
|
if (!e?.current || c.pointerType === "touch" || c.type === "touchmove" || !nt.current) return;
|
|
2302
2313
|
const w = nt.current.anchor;
|
|
2303
2314
|
let p = e.current.getViewFromLocation(w), y = p.getCellCoordsFromClient(c.clientX, c.clientY);
|
|
2304
|
-
if (!
|
|
2315
|
+
if (!Z.isEqualCells(y, nt.current?.coords) && (nt.current = { anchor: w, coords: y }, y && be?.(c, y, ve.current) !== !1)) {
|
|
2305
2316
|
if (xt.current) {
|
|
2306
2317
|
const W = { rowStart: Math.min(y.rowIndex, xt.current.rowIndex), colStart: Math.min(y.colIndex, xt.current.colIndex), rowEnd: Math.max(y.rowIndex, xt.current.rowIndex), colEnd: Math.max(y.colIndex, xt.current.colIndex) }, b = { rowIndex: W.rowStart, colIndex: W.colStart }, he = { rowIndex: W.rowEnd, colIndex: W.colEnd };
|
|
2307
2318
|
if (ht(b) || ht(he)) return;
|
|
@@ -2322,7 +2333,7 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2322
2333
|
return Rt.current = null, void (nt.current = null);
|
|
2323
2334
|
}
|
|
2324
2335
|
try {
|
|
2325
|
-
l?.(
|
|
2336
|
+
l?.(ve.current, c);
|
|
2326
2337
|
} catch (w) {
|
|
2327
2338
|
console.warn(w);
|
|
2328
2339
|
}
|
|
@@ -2333,48 +2344,48 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2333
2344
|
let p = [], y = -1, W = w.cell;
|
|
2334
2345
|
for (let he = 0; he < w.ranges.length; he++) {
|
|
2335
2346
|
const ne = w.ranges[he];
|
|
2336
|
-
if (
|
|
2347
|
+
if (Z.isRangesIntersect(ne, u)) {
|
|
2337
2348
|
const re = Ct.subtractRect({ top: ne.rowStart, left: ne.colStart, bottom: ne.rowEnd + 1, right: ne.colEnd + 1 }, { top: u.rowStart, left: u.colStart, bottom: u.rowEnd + 1, right: u.colEnd + 1 });
|
|
2338
2349
|
for (let ge = 0; ge < re.length; ge++) {
|
|
2339
2350
|
const Le = { rowStart: re[ge].top, colStart: re[ge].left, rowEnd: re[ge].bottom - 1, colEnd: re[ge].right - 1 };
|
|
2340
|
-
p.push(Le),
|
|
2351
|
+
p.push(Le), Z.isCellWithinRange(w.cell, Le) && (y = p.length - 1);
|
|
2341
2352
|
}
|
|
2342
2353
|
} else p.push(ne);
|
|
2343
|
-
p.length > 0 && y === -1 &&
|
|
2354
|
+
p.length > 0 && y === -1 && Z.isCellWithinRange(w.cell, ne) && (y = p.length - 1, W = { rowIndex: p[p.length - 1].rowStart, colIndex: p[p.length - 1].colStart });
|
|
2344
2355
|
}
|
|
2345
2356
|
const b = { cell: W, rangeIndex: y, ranges: p };
|
|
2346
|
-
return
|
|
2357
|
+
return Z.isEqualSelectionCoords(b, w) ? w : b;
|
|
2347
2358
|
});
|
|
2348
|
-
}, processTouch: !0, consumeTouch: !1 }), [
|
|
2359
|
+
}, processTouch: !0, consumeTouch: !1 }), [C, s, d, le, a]), mo = k(On(hn), []), xo = _e(() => ({ onSelectionPointerDown: (c, u, w, p, y = C.cell, W = le, b = c.nativeEvent.shiftKey, he = !1) => {
|
|
2349
2360
|
if (!e || !e.current) return !1;
|
|
2350
2361
|
c.stopPropagation(), c.preventDefault(), c.nativeEvent.stopImmediatePropagation();
|
|
2351
2362
|
const ne = w ?? e.current.getViewFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY), re = p ?? ne.getCellCoordsFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY);
|
|
2352
2363
|
if (!re) return !1;
|
|
2353
2364
|
nt.current = { anchor: ne.getAnchor(), coords: re }, Q.current = null;
|
|
2354
2365
|
const ge = c.nativeEvent.which === _r;
|
|
2355
|
-
if (ge &&
|
|
2366
|
+
if (ge && Z.indexOfCoords(re, C.ranges) !== -1)
|
|
2356
2367
|
return !1;
|
|
2357
|
-
const Le = c.nativeEvent.ctrlKey || c.nativeEvent.metaKey, de = Le, ie = d, _t =
|
|
2358
|
-
if (oe?.(c, re,
|
|
2359
|
-
i?.(
|
|
2368
|
+
const Le = c.nativeEvent.ctrlKey || c.nativeEvent.metaKey, de = Le, ie = d, _t = C.ranges.length > 0, F = Le && ie;
|
|
2369
|
+
if (oe?.(c, re, C) === !1) return !1;
|
|
2370
|
+
i?.(ve.current, c.nativeEvent);
|
|
2360
2371
|
const ke = !ge && s !== "single";
|
|
2361
2372
|
if (b) return rt(re, y, he), ke;
|
|
2362
|
-
const Pt =
|
|
2373
|
+
const Pt = Z.isEqualCells(re, y);
|
|
2363
2374
|
if (de) {
|
|
2364
2375
|
if (Pt && (!F || !_t)) return ke;
|
|
2365
|
-
if (F &&
|
|
2376
|
+
if (F && Z.indexOfCoords(re, C.ranges) !== -1 && ie) {
|
|
2366
2377
|
xt.current = re;
|
|
2367
2378
|
const Re = Ie(re, re);
|
|
2368
2379
|
return Vt.current = Re, Kt(Re), ke;
|
|
2369
2380
|
}
|
|
2370
2381
|
return ze(re), ke;
|
|
2371
2382
|
}
|
|
2372
|
-
W && Ue(re), Pt &&
|
|
2373
|
-
}, onSelectionPointerMoveOrWait: (c, u, w, p, y, W =
|
|
2383
|
+
W && Ue(re), Pt && C.ranges.length === 0 || tt(re);
|
|
2384
|
+
}, onSelectionPointerMoveOrWait: (c, u, w, p, y, W = C.cell, b = !0, he = !1) => {
|
|
2374
2385
|
if (!e?.current || (c.stopPropagation(), c.preventDefault(), c.stopImmediatePropagation(), !nt.current)) return;
|
|
2375
2386
|
const ne = nt.current.anchor;
|
|
2376
2387
|
let re = p ?? e.current.getViewFromLocation(ne), ge = y ?? re.getCellCoordsFromClient(c.clientX, c.clientY);
|
|
2377
|
-
if (!
|
|
2388
|
+
if (!Z.isEqualCells(ge, nt.current?.coords) && (nt.current = { anchor: ne, coords: ge }, ge && be?.(c, ge, ve.current) !== !1)) {
|
|
2378
2389
|
if (xt.current) {
|
|
2379
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 }, ie = { rowIndex: Le.rowEnd, colIndex: Le.colEnd };
|
|
2380
2391
|
if (ht(de) || ht(ie)) return;
|
|
@@ -2386,7 +2397,7 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2386
2397
|
}, onPointerUp: (c) => {
|
|
2387
2398
|
nt.current = null, c.stopPropagation(), c.preventDefault(), c.stopImmediatePropagation();
|
|
2388
2399
|
try {
|
|
2389
|
-
l?.(
|
|
2400
|
+
l?.(ve.current, c);
|
|
2390
2401
|
} catch (w) {
|
|
2391
2402
|
console.warn(w);
|
|
2392
2403
|
}
|
|
@@ -2397,23 +2408,23 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2397
2408
|
let p = [], y = -1, W = w.cell;
|
|
2398
2409
|
for (let he = 0; he < w.ranges.length; he++) {
|
|
2399
2410
|
const ne = w.ranges[he];
|
|
2400
|
-
if (
|
|
2411
|
+
if (Z.isRangesIntersect(ne, u)) {
|
|
2401
2412
|
const re = Ct.subtractRect({ top: ne.rowStart, left: ne.colStart, bottom: ne.rowEnd + 1, right: ne.colEnd + 1 }, { top: u.rowStart, left: u.colStart, bottom: u.rowEnd + 1, right: u.colEnd + 1 });
|
|
2402
2413
|
for (let ge = 0; ge < re.length; ge++) {
|
|
2403
2414
|
const Le = { rowStart: re[ge].top, colStart: re[ge].left, rowEnd: re[ge].bottom - 1, colEnd: re[ge].right - 1 };
|
|
2404
|
-
p.push(Le),
|
|
2415
|
+
p.push(Le), Z.isCellWithinRange(w.cell, Le) && (y = p.length - 1);
|
|
2405
2416
|
}
|
|
2406
2417
|
} else p.push(ne);
|
|
2407
|
-
p.length > 0 && y === -1 &&
|
|
2418
|
+
p.length > 0 && y === -1 && Z.isCellWithinRange(w.cell, ne) && (y = p.length - 1, W = { rowIndex: p[p.length - 1].rowStart, colIndex: p[p.length - 1].colStart });
|
|
2408
2419
|
}
|
|
2409
2420
|
const b = { cell: W, rangeIndex: y, ranges: p };
|
|
2410
|
-
return
|
|
2421
|
+
return Z.isEqualSelectionCoords(b, w) ? w : b;
|
|
2411
2422
|
});
|
|
2412
|
-
} }), [
|
|
2413
|
-
if (!e.current || !
|
|
2414
|
-
let y =
|
|
2415
|
-
if (u &&
|
|
2416
|
-
const F =
|
|
2423
|
+
} }), [C, s, d, le, a]), pt = k((c, u = !1, w = !1, p = 0) => {
|
|
2424
|
+
if (!e.current || !C.cell) return;
|
|
2425
|
+
let y = C.cell, W = C.cell;
|
|
2426
|
+
if (u && C.ranges.length > 0) {
|
|
2427
|
+
const F = C.ranges[C.rangeIndex], ke = C.cell;
|
|
2417
2428
|
switch (c) {
|
|
2418
2429
|
case it:
|
|
2419
2430
|
W = { rowIndex: ke.rowIndex === F.rowStart ? F.rowEnd : F.rowStart, colIndex: F.colEnd }, y = { rowIndex: ke.rowIndex === F.rowStart ? F.rowStart : F.rowEnd, colIndex: F.colStart };
|
|
@@ -2456,16 +2467,16 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2456
2467
|
}
|
|
2457
2468
|
if (w) switch (c) {
|
|
2458
2469
|
case it:
|
|
2459
|
-
he =
|
|
2470
|
+
he = I({ ...W, colIndex: C.cell.colIndex }, ue, dt, c, !1, Math.max(re.top, dt(re.top, !1)));
|
|
2460
2471
|
break;
|
|
2461
2472
|
case lt:
|
|
2462
|
-
he =
|
|
2473
|
+
he = I({ ...W, colIndex: C.cell.colIndex }, ue, dt, c, !1, Math.min(re.bottom, re.bottom - dt(re.bottom, !0)));
|
|
2463
2474
|
break;
|
|
2464
2475
|
case ot:
|
|
2465
|
-
ne =
|
|
2476
|
+
ne = I({ ...W, rowIndex: C.cell.rowIndex }, ue, ut, c, !1, Math.max(re.left, ut(re.left, !1)));
|
|
2466
2477
|
break;
|
|
2467
2478
|
case Ke:
|
|
2468
|
-
ne =
|
|
2479
|
+
ne = I({ ...W, rowIndex: C.cell.rowIndex }, ue, ut, c, !1, Math.min(re.right, re.right - ut(re.right, !0)));
|
|
2469
2480
|
}
|
|
2470
2481
|
}
|
|
2471
2482
|
let ge = null;
|
|
@@ -2487,7 +2498,7 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2487
2498
|
}
|
|
2488
2499
|
const Le = { rowIndex: he, colIndex: ne }, de = L(Le), ie = { rowIndex: de.rowStart, colIndex: de.colStart };
|
|
2489
2500
|
u || (Q.current = Le);
|
|
2490
|
-
const _t =
|
|
2501
|
+
const _t = Z.isEqualCells(We.current, ie) && Z.isEqualCells(We.current, y);
|
|
2491
2502
|
if (u && !_t ? rt(ie, y) : tt(ie), ge) e.current.scrollTo(ge);
|
|
2492
2503
|
else {
|
|
2493
2504
|
if (u && We.current) {
|
|
@@ -2496,26 +2507,26 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2496
2507
|
}
|
|
2497
2508
|
c === ot || c === Ke ? Ue({ colIndex: Le.colIndex }) : c !== it && c !== lt || Ue({ rowIndex: Le.rowIndex });
|
|
2498
2509
|
}
|
|
2499
|
-
}, [
|
|
2510
|
+
}, [C, L]), ln = k((c) => {
|
|
2500
2511
|
if (!e.current) return;
|
|
2501
|
-
if (
|
|
2502
|
-
const u = L(
|
|
2503
|
-
if (
|
|
2504
|
-
const w = Xo(
|
|
2512
|
+
if (C.ranges.length === 0) return void pt(c);
|
|
2513
|
+
const u = L(C.cell);
|
|
2514
|
+
if (Z.isEqualRangesArrays([u], C.ranges)) return void pt(c);
|
|
2515
|
+
const w = Xo(C, c, L, dt, ut);
|
|
2505
2516
|
St((p) => {
|
|
2506
2517
|
Je.current = !1, p = Yt(p);
|
|
2507
2518
|
const y = { ...p, cell: w.cell, rangeIndex: w.rangeIndex };
|
|
2508
|
-
return
|
|
2519
|
+
return Z.isEqualSelectionCoords(y, p) ? p : y;
|
|
2509
2520
|
}), w.cell && Ue(w.cell);
|
|
2510
|
-
}, [
|
|
2521
|
+
}, [C, L]), vo = D(() => {
|
|
2511
2522
|
const c = Se();
|
|
2512
2523
|
rt({ rowIndex: c.top }, { rowIndex: c.bottom });
|
|
2513
2524
|
}, []), yo = D(() => {
|
|
2514
2525
|
const c = Se();
|
|
2515
2526
|
rt({ colIndex: c.left }, { colIndex: c.right });
|
|
2516
2527
|
}, []), xn = k(() => {
|
|
2517
|
-
|
|
2518
|
-
}, [
|
|
2528
|
+
C.cell && e?.current && Ue(C.cell);
|
|
2529
|
+
}, [C.cell]), qn = D((c = !1) => {
|
|
2519
2530
|
const u = { rowIndex: Se().top };
|
|
2520
2531
|
c ? rt(u) : tt(u), Ue(u);
|
|
2521
2532
|
}, []), Yn = D((c = !1) => {
|
|
@@ -2534,33 +2545,33 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2534
2545
|
const u = Se(), w = { rowIndex: z?.()?.rowEnd ?? u.bottom, colIndex: z?.()?.colEnd ?? u.right };
|
|
2535
2546
|
c ? rt(w) : tt(w), Ue(w);
|
|
2536
2547
|
}, [z]), An = k((c) => {
|
|
2537
|
-
if (!e.current ||
|
|
2548
|
+
if (!e.current || C.ranges.length <= 1) return;
|
|
2538
2549
|
const u = c === ot || c === it;
|
|
2539
|
-
let w =
|
|
2540
|
-
w < 0 ? w =
|
|
2541
|
-
const p =
|
|
2550
|
+
let w = C.rangeIndex + (u ? -1 : 1);
|
|
2551
|
+
w < 0 ? w = C.ranges.length - 1 : w > C.ranges.length - 1 && (w = 0);
|
|
2552
|
+
const p = C.ranges[w], y = Xo({ cell: { rowIndex: p.rowEnd, colIndex: p.colEnd }, rangeIndex: 0, ranges: [p] }, Ke, L, dt, ut);
|
|
2542
2553
|
St((W) => {
|
|
2543
2554
|
Je.current = !1, W = Yt(W);
|
|
2544
2555
|
const b = { ...W, cell: y.cell, rangeIndex: w };
|
|
2545
|
-
return
|
|
2556
|
+
return Z.isEqualSelectionCoords(b, W) ? W : b;
|
|
2546
2557
|
}), y.cell && Ue(y.cell);
|
|
2547
|
-
}, [
|
|
2548
|
-
const c = Ar(
|
|
2558
|
+
}, [C, L]), bo = k(() => {
|
|
2559
|
+
const c = Ar(C);
|
|
2549
2560
|
St((u) => {
|
|
2550
2561
|
Je.current = !1, u = Yt(u);
|
|
2551
2562
|
const w = { ...u, visibleSelection: c };
|
|
2552
|
-
return
|
|
2563
|
+
return Z.isEqualSelectionCoords(w, u) ? u : w;
|
|
2553
2564
|
}), c.cell && Ue(c.cell);
|
|
2554
|
-
}, [
|
|
2555
|
-
if (!e.current ||
|
|
2556
|
-
const c =
|
|
2565
|
+
}, [C, L]), So = k(() => {
|
|
2566
|
+
if (!e.current || C.ranges.length === 0) return;
|
|
2567
|
+
const c = C.cell, u = C.ranges[C.rangeIndex], w = Ar({ cell: c, rangeIndex: 0, ranges: [u] }), p = w.ranges[w.rangeIndex];
|
|
2557
2568
|
let y;
|
|
2558
2569
|
y = 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) => {
|
|
2559
2570
|
W = Yt(W);
|
|
2560
2571
|
const b = { ...W, cell: y };
|
|
2561
|
-
return
|
|
2572
|
+
return Z.isEqualSelectionCoords(b, W) ? W : b;
|
|
2562
2573
|
}), y && Ue(y);
|
|
2563
|
-
}, [
|
|
2574
|
+
}, [C, L]), Xn = D((c = !1) => {
|
|
2564
2575
|
pt(lt, c, !1, e.current.getDimensions().containerHeight);
|
|
2565
2576
|
}, []), Jt = D((c = !1) => {
|
|
2566
2577
|
pt(it, c, !1, e.current.getDimensions().containerHeight);
|
|
@@ -2600,17 +2611,17 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2600
2611
|
pt(Ke, !0, !0);
|
|
2601
2612
|
}, []), xe = D(() => {
|
|
2602
2613
|
pt(it, !1, !1);
|
|
2603
|
-
}, []),
|
|
2614
|
+
}, []), ye = D(() => {
|
|
2604
2615
|
pt(it, !0, !1);
|
|
2605
2616
|
}, []), ce = D(() => {
|
|
2606
2617
|
pt(it, !1, !0);
|
|
2607
|
-
}, []),
|
|
2618
|
+
}, []), je = D(() => {
|
|
2608
2619
|
pt(it, !0, !0);
|
|
2609
2620
|
}, []), ft = D(() => {
|
|
2610
2621
|
pt(lt, !1, !1);
|
|
2611
|
-
}, []), $e = D(() => {
|
|
2612
|
-
pt(lt, !0, !1);
|
|
2613
2622
|
}, []), Be = D(() => {
|
|
2623
|
+
pt(lt, !0, !1);
|
|
2624
|
+
}, []), Fe = D(() => {
|
|
2614
2625
|
pt(lt, !1, !0);
|
|
2615
2626
|
}, []), gt = D(() => {
|
|
2616
2627
|
pt(lt, !0, !0);
|
|
@@ -2624,13 +2635,13 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2624
2635
|
if (he.rowStart === w && he.colStart === p && he.rowEnd === y && he.colEnd === W) return !0;
|
|
2625
2636
|
}
|
|
2626
2637
|
return !1;
|
|
2627
|
-
})(
|
|
2628
|
-
}, [B,
|
|
2638
|
+
})(C.ranges, c.top, c.left, c.bottom, c.right);
|
|
2639
|
+
}, [B, C.ranges]), vt = D((c, u = !0) => {
|
|
2629
2640
|
We.current = c, Qe(c), u && c && e?.current && Ue(c);
|
|
2630
2641
|
}, []), pe = k((c = !0) => {
|
|
2631
2642
|
const u = nn.current;
|
|
2632
|
-
if (!
|
|
2633
|
-
const w =
|
|
2643
|
+
if (!ve.current?.cell) return;
|
|
2644
|
+
const w = ve.current?.ranges, p = ve.current?.cell;
|
|
2634
2645
|
if (!p || !u || !u) return;
|
|
2635
2646
|
let y = null;
|
|
2636
2647
|
if (y = w.length > 0 ? w[w.length - 1] : L(p), y.colEnd >= y.colStart && y.rowEnd >= y.rowStart) {
|
|
@@ -2644,20 +2655,20 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2644
2655
|
c && Me?.();
|
|
2645
2656
|
}
|
|
2646
2657
|
}
|
|
2647
|
-
}, [L]), wt =
|
|
2658
|
+
}, [L]), wt = G(null), $t = On(_e(() => ({ onPointerDown: (c, u) => {
|
|
2648
2659
|
if (Ot.current = u, !e || !e.current) return !1;
|
|
2649
2660
|
const w = e.current.getViewFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY), p = w?.getCellCoordsFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY);
|
|
2650
2661
|
p && (c.stopPropagation(), on("crosshair"), wt.current = { anchor: w.getAnchor(), coords: p });
|
|
2651
2662
|
}, onPointerMoveOrWait: (c, u) => {
|
|
2652
|
-
if (_ || !e?.current || !
|
|
2663
|
+
if (_ || !e?.current || !ve.current || !wt.current) return;
|
|
2653
2664
|
const w = wt.current.anchor;
|
|
2654
2665
|
let p = e.current.getViewFromLocation(w), y = p.getCellCoordsFromClient(c.clientX, c.clientY);
|
|
2655
2666
|
if (!y) return;
|
|
2656
2667
|
wt.current = { anchor: w, coords: y };
|
|
2657
|
-
const W =
|
|
2658
|
-
let b = Ie(
|
|
2668
|
+
const W = ve.current.ranges;
|
|
2669
|
+
let b = Ie(ve.current.cell, y);
|
|
2659
2670
|
if (!b) return;
|
|
2660
|
-
const he = W.length > 0, ne = he ? W[W.length - 1] : L(
|
|
2671
|
+
const he = W.length > 0, ne = he ? W[W.length - 1] : L(ve.current.cell);
|
|
2661
2672
|
if (!b) return;
|
|
2662
2673
|
const re = b.rowStart < ne.rowStart ? it : b.rowEnd > ne.rowEnd ? lt : b.colEnd > ne.colEnd ? Ke : ot, ge = Se();
|
|
2663
2674
|
re === ot && (b = { ...ne, colStart: Math.max(ge.left, b.colStart) }), re === it && (b = { ...ne, rowStart: Math.max(ge.top, b.rowStart) }), re === Ke && (b = { ...ne, colEnd: Math.min(ge.right, b.colEnd) }), re === lt && (b = { ...ne, rowEnd: Math.min(ge.bottom, b.rowEnd) });
|
|
@@ -2683,7 +2694,7 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2683
2694
|
return Te;
|
|
2684
2695
|
})(ne, b, de, ge, Le.direction, Le.amount);
|
|
2685
2696
|
}
|
|
2686
|
-
if (he &&
|
|
2697
|
+
if (he && Z.isRangeWithinRange(b, ne) && (b = null), !Z.isEqualRanges(b, nn.current)) {
|
|
2687
2698
|
if (dn(b), nn.current = b, !b) {
|
|
2688
2699
|
try {
|
|
2689
2700
|
E?.();
|
|
@@ -2698,23 +2709,23 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2698
2709
|
Ot.current = u, Promise.resolve(pe(!0)).finally(() => {
|
|
2699
2710
|
Me?.(), dn(null), nn.current = null, wt.current = null, on(null), e.current?.focus();
|
|
2700
2711
|
});
|
|
2701
|
-
} }), [L])), Wt = _e(() => ({ onPointerDown: $t }), [$t]), [Ce, Ge] = Ze(null), Ae =
|
|
2712
|
+
} }), [L])), Wt = _e(() => ({ onPointerDown: $t }), [$t]), [Ce, Ge] = Ze(null), Ae = G(null), ct = _e(() => ({ onPointerDown: (c, u) => {
|
|
2702
2713
|
if (Ot.current = u, !e || !e.current) return !1;
|
|
2703
2714
|
const w = e.current.getViewFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY), p = w?.getCellCoordsFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY);
|
|
2704
2715
|
if (!p) return;
|
|
2705
|
-
if (oe?.(c, p,
|
|
2716
|
+
if (oe?.(c, p, C) === !1) return !1;
|
|
2706
2717
|
c.stopPropagation(), on("default");
|
|
2707
|
-
const y = w.getRelativePointFromClient(0, 0), W =
|
|
2718
|
+
const y = w.getRelativePointFromClient(0, 0), W = ve.current?.ranges[ve.current?.ranges.length - 1] ?? Z.cellToRange(ve.current?.cell), b = w.toClipBounds(w.getRangeCoordsBounds(W)), he = { x: 0, y: 0 };
|
|
2708
2719
|
b.x - y.x > c.nativeEvent.clientX ? he.x = c.nativeEvent.clientX - (b.x - y.x) : c.nativeEvent.clientX >= b.x - y.x + b.width && (he.x = Math.max(0, c.nativeEvent.clientX - (b.x - y.x + b.width)) + 1), b.y - y.y > c.nativeEvent.clientY ? he.y = c.nativeEvent.clientY - (b.y - y.y) : c.nativeEvent.clientY >= b.y - y.y + b.height && (he.y = Math.max(0, c.nativeEvent.clientY - (b.y - y.y + b.height)) + 1), X?.(W, c.nativeEvent, u), Ae.current = { range: W, anchor: w.getAnchor(), cell: p, isMoving: !1, extrusion: he };
|
|
2709
2720
|
}, onPointerMoveOrWait: (c, u, w) => {
|
|
2710
|
-
if (K || !e?.current || !
|
|
2721
|
+
if (K || !e?.current || !ve.current || !Ae.current) return;
|
|
2711
2722
|
const p = c.clientX - w.clientX, y = c.clientY - w.clientY;
|
|
2712
2723
|
if (Ae.current.isMoving = Ae.current.isMoving || Math.abs(p) > Math.max(1, 2) || Math.abs(y) > Math.max(1, 2) || performance.now() - w.timeStamp > 500, !Ae.current.isMoving) return;
|
|
2713
2724
|
const W = Ae.current.anchor, b = Ae.current.extrusion;
|
|
2714
2725
|
let he = e.current.getViewFromLocation(W), ne = he.getCellCoordsFromClient(c.clientX - b.x, c.clientY - b.y, !0);
|
|
2715
2726
|
if (!ne) return;
|
|
2716
2727
|
const re = Ae.current.cell, ge = Ae.current.range, Le = Se(), de = ge.colEnd - ge.colStart + 1, ie = Math.min(Math.max(0, re.colIndex - ge.colStart), de - 1), _t = Math.min(Le.right - de + 1, Math.max(Le.left, ne.colIndex - ie)), F = ge.rowEnd - ge.rowStart + 1, ke = Math.min(Math.max(0, re.rowIndex - ge.rowStart), F - 1), Pt = Math.min(Le.bottom - F + 1, Math.max(Le.top, ne.rowIndex - ke)), Re = { colStart: _t, colEnd: _t + de - 1, rowStart: Pt, rowEnd: Pt + F - 1 };
|
|
2717
|
-
|
|
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, u)), Ot.current = u, lo(he, ne, e);
|
|
2718
2729
|
}, onPointerUp: (c, u) => {
|
|
2719
2730
|
Ot.current = u;
|
|
2720
2731
|
const w = () => {
|
|
@@ -2725,12 +2736,12 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2725
2736
|
S?.(p, c, u), Promise.resolve(p && y && h?.(p, y, c, u)).finally(() => {
|
|
2726
2737
|
w();
|
|
2727
2738
|
});
|
|
2728
|
-
} }), [Ce]), Pe = On(ct), Et = _e(() => ({ onPointerDown: Pe }), [Pe]), yt =
|
|
2729
|
-
const c =
|
|
2739
|
+
} }), [Ce]), Pe = On(ct), Et = _e(() => ({ onPointerDown: Pe }), [Pe]), yt = G(null), Bt = _e(() => {
|
|
2740
|
+
const c = Z.isEqualSelectionCoords(C, yt.current) ? yt.current : C;
|
|
2730
2741
|
return yt.current = c, c;
|
|
2731
|
-
}, [
|
|
2742
|
+
}, [C]), qt = D((c) => {
|
|
2732
2743
|
let u = null, w = "br";
|
|
2733
|
-
const p = [], y = { stroke:
|
|
2744
|
+
const p = [], y = { stroke: M, fill: te, strokeWidth: 0.5 }, W = (de, ie, _t) => {
|
|
2734
2745
|
const F = c.toClipBounds(c.getRangeCoordsBounds(de), en);
|
|
2735
2746
|
if (!F) return;
|
|
2736
2747
|
F.x = F.width > 0 ? F.x : F.x - y.strokeWidth / 2, F.y = F.height > 0 ? F.y : F.y - y.strokeWidth / 2, F.width = Math.max(F.width, y.strokeWidth), F.height = Math.max(F.height, y.strokeWidth);
|
|
@@ -2741,7 +2752,7 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2741
2752
|
}
|
|
2742
2753
|
return me(ke);
|
|
2743
2754
|
};
|
|
2744
|
-
let b =
|
|
2755
|
+
let b = C ? Yt(C) : null;
|
|
2745
2756
|
const he = b?.cell ? c.getCellCoordsAsRangeCoords(b?.cell) : Ql;
|
|
2746
2757
|
!b || b.ranges && b.ranges.length !== 0 || (b = { ranges: [he], rangeIndex: 0, cell: b.cell });
|
|
2747
2758
|
for (let de = 0; b && de < b.ranges.length; de++) {
|
|
@@ -2750,7 +2761,7 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2750
2761
|
const F = 2, ke = 0.5, Pt = c.toClipBounds(c.getRangeCoordsBounds(ie, { top: 0, left: 0, right: 0, bottom: 0 }), en);
|
|
2751
2762
|
if (Pt) {
|
|
2752
2763
|
const Re = (b.ranges.length, 4);
|
|
2753
|
-
p.push(me({ range: ie, 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:
|
|
2764
|
+
p.push(me({ range: ie, 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: M, strokeWidth: Re }));
|
|
2754
2765
|
}
|
|
2755
2766
|
if (b.ranges.length === 1) {
|
|
2756
2767
|
const Re = c.toClipBounds(c.getRangeCoordsBounds(ie), en);
|
|
@@ -2773,8 +2784,8 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2773
2784
|
let Qt = null;
|
|
2774
2785
|
if (Re || Te) {
|
|
2775
2786
|
if (Qt = c.toClipBounds(bt, en), Object.keys(c.allViews()).length > 1) {
|
|
2776
|
-
const eo = c.getVisibleRangeCoords(), nr = c.allViews()[uo],
|
|
2777
|
-
(Te && (to === Hn && nr || to === Xt &&
|
|
2787
|
+
const eo = c.getVisibleRangeCoords(), nr = c.allViews()[uo], Ai = c.allViews()[Hn], $i = c.allViews()[Nn], to = c.getAnchor();
|
|
2788
|
+
(Te && (to === Hn && nr || to === Xt && $i || !Z.isCellWithinRange({ colIndex: ie.colStart, rowIndex: ie.rowEnd }, eo) && !Z.isCellWithinRange({ colIndex: ie.colStart, rowIndex: ie.rowEnd + 1 }, eo)) || Re && (to === Nn && nr || to === Xt && Ai || !Z.isCellWithinRange({ colIndex: ie.colEnd, rowIndex: ie.rowStart }, eo) && !Z.isCellWithinRange({ colIndex: ie.colEnd + 1, rowIndex: ie.rowStart }, eo))) && (Qt = null);
|
|
2778
2789
|
}
|
|
2779
2790
|
} else Qt = c.toClipBounds(bt, en);
|
|
2780
2791
|
if (!Qt || Qt.width === 0 || Qt.height === 0) continue;
|
|
@@ -2784,7 +2795,7 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2784
2795
|
let ne = null;
|
|
2785
2796
|
if (De) {
|
|
2786
2797
|
const de = c.toClipBounds(c.getRangeCoordsBounds(De, { top: 0, left: 0, right: 0, bottom: 0 }), en);
|
|
2787
|
-
de && (ne = me({ ...y, range: De, key: "remove-selection", x: de.x, y: de.y, width: de.width, height: de.height, strokeWidth: 2, stroke: He, fill:
|
|
2798
|
+
de && (ne = me({ ...y, range: De, key: "remove-selection", x: de.x, y: de.y, width: de.width, height: de.height, strokeWidth: 2, stroke: He, fill: Ve }));
|
|
2788
2799
|
}
|
|
2789
2800
|
let re = null;
|
|
2790
2801
|
if (Mt) {
|
|
@@ -2792,10 +2803,10 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2792
2803
|
de && (re = 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" }));
|
|
2793
2804
|
}
|
|
2794
2805
|
let ge = null;
|
|
2795
|
-
!_ && u && !Ce && (ge = Jo(
|
|
2806
|
+
!_ && u && !Ce && (ge = Jo(Ti, { ...u, corner: w, size: 7.5, borderStroke: `${M} solid`, style: { borderRadius: 1 }, background: Y, ...Wt, key: "fillHandle" }));
|
|
2796
2807
|
const Le = [...p];
|
|
2797
2808
|
if (ne && Le.push(ne), re && Le.push(re), ge && Le.push(ge), !Ne && Tt && b?.ranges.length === 1 && b.ranges[b.ranges.length - 1]) {
|
|
2798
|
-
const de = b.ranges[b.ranges.length - 1], ie = de.rowStart === Se().top && de.rowEnd === Se().bottom, _t = de.colStart === Se().left && de.colEnd === Se().right, F = { view: c, range: de, borderStroke: `${Y} solid`, background:
|
|
2809
|
+
const de = b.ranges[b.ranges.length - 1], ie = de.rowStart === Se().top && de.rowEnd === Se().bottom, _t = de.colStart === Se().left && de.colEnd === Se().right, F = { view: c, range: de, borderStroke: `${Y} solid`, background: M, selectionTouchPointerHandler: xo, ...at, onTouchSelectStart: (ke) => un(ke), onTouchSelectEnd: () => un(null), currentTouchAnchor: Cn };
|
|
2799
2810
|
Le.push(q(Go, { anchor: _t ? "b" : ie ? "r" : "br", scrollableElement: e.current, ...F }, "touch-select-handle-after")), Le.push(q(Go, { anchor: _t ? "t" : ie ? "l" : "tl", scrollableElement: e.current, ...F }, "touch-select-handle-before"));
|
|
2800
2811
|
}
|
|
2801
2812
|
if (Ce) {
|
|
@@ -2803,11 +2814,11 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2803
2814
|
de && Le.push(me({ range: Ce, key: "selection-move-outline", x: de.x - ee / 2, y: de.y - ee / 2, width: Math.max(de.width + ee / 2, 1), height: Math.max(de.height + ee / 2, 1), stroke: Y, style: { boxShadow: "none", transitionDuration: "70ms", transitionTimingFunction: "ease-in", transitionProperty: "left, top, width, height", willChange: "left, top, width, height" }, strokeWidth: ee }));
|
|
2804
2815
|
}
|
|
2805
2816
|
return q("div", { children: Le }, "selection");
|
|
2806
|
-
}, [Bt, De, _, Mt, K, Ce, Se,
|
|
2817
|
+
}, [Bt, De, _, Mt, K, Ce, Se, M, Y, te, He, Ve, Ne, at, Cn]), Dt = _e(() => {
|
|
2807
2818
|
const c = () => e.current;
|
|
2808
2819
|
return [new Ee("moveToPageDown", c, { label: "Page Down", description: "Shift viewport down one page.", shortcut: [{ key: "PageDown" }] }, () => Xn(!1)), new Ee("selectToPageDown", c, { label: "Select To Page Down", description: "Shift viewport and select down one page.", shortcut: [{ key: "PageDown", modifiers: [It] }] }, () => Xn(!0)), new Ee("moveToPageRight", c, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [yn] }] }, () => Gn(!1)), new Ee("selectToPageRight", c, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [yn, It] }] }, () => Gn(!0)), new Ee("moveToPageUp", c, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp" }] }, () => Jt(!1)), new Ee("selectToPageUp", c, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp", modifiers: [It] }] }, () => Jt(!0)), new Ee("moveToPageLeft", c, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [yn] }] }, () => $n(!1)), new Ee("selectToPageLeft", c, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [yn, It] }] }, () => $n(!0)), new Ee("selectColumn", c, { label: "Select Column", description: "Select the columns for the selected cells.", shortcut: { key: "Space", modifiers: [zt] } }, vo), new Ee("selectRow", c, { label: "Select Row", description: "Select the rows for the selected cells.", shortcut: { key: "Space", modifiers: [It] } }, yo), new Ee("selectToColumnStart", c, { label: "Select To Column Start", description: "Select the columns to the beginning of the sheet." }, () => qn(!0)), new Ee("selectToColumnEnd", c, { label: "Select To Column End", description: "Select the columns to the end of the sheet." }, () => Yn(!0)), new Ee("moveToRowStart", c, { label: "Move to Row Home", description: "Move to the beginning of the row.", shortcut: [{ key: "Home" }] }, () => Dn(!1)), new Ee("selectToRowStart", c, { label: "Select to Row Home", description: "Select to the beginning of the row.", shortcut: [{ key: "Home", modifiers: [It] }] }, () => Dn(!0)), new Ee("moveToSheetStart", c, { label: "Move to Sheet Home", description: "Move to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [zt] }] }, () => Mn(!1)), new Ee("selectToSheetStart", c, { label: "Select to Sheet Home", description: "Select to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [zt, It] }] }, () => Mn(!0)), new Ee("moveToRowEnd", c, { label: "Move to Row End", description: "Move to the end of the row.", shortcut: [{ key: "End" }] }, () => zn(!1)), new Ee("selectToRowEnd", c, { label: "Select to Row End", description: "Select to the end of the row.", shortcut: [{ key: "End", modifiers: [It] }] }, () => zn(!0)), new Ee("moveToSheetEnd", c, { label: "Move to Sheet End", description: "Move to the end of the sheet.", shortcut: [{ key: "End", modifiers: [zt] }] }, () => vn(!1)), new Ee("selectToSheetEnd", c, { label: "Select to Sheet End", description: "Select to the end of the sheet.", shortcut: [{ key: "End", modifiers: [zt, It] }] }, () => vn(!0)), new Ee("scrollToActiveCoords", c, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell.", shortcut: { key: "Backspace", modifiers: [zt] } }, xn), new Ee("scrollToActiveCoordsClearSelection", c, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell and clear selection.", shortcut: { key: "Backspace", modifiers: [It] } }, () => {
|
|
2809
|
-
rn(), vt(
|
|
2810
|
-
}), new Ee("traverseSelectionRight", c, { label: "Traverse Right", description: "Traverse the selection moving rightward.", shortcut: { key: "Tab" } }, Jn), new Ee("traverseSelectionLeft", c, { label: "Traverse Left", description: "Traverse the selection moving leftward.", shortcut: { key: "Tab", modifiers: [It] } }, Zn), new Ee("traverseSelectionDown", c, { label: "Traverse Down", description: "Traverse the selection moving downward.", shortcut: [{ key: "Enter" }, { key: "NumpadEnter" }] }, _o), new Ee("traverseSelectionUp", c, { label: "Traverse Up", description: "Traverse the selection moving upward.", shortcut: [{ key: "Enter", modifiers: [It] }, { key: "NumpadEnter", modifiers: [It] }] }, Eo), new Ee("moveLeft", c, { label: "Move Left", description: "Move active cell to the left.", shortcut: [{ key: "ArrowLeft" }] }, Qn), new Ee("selectLeft", c, { label: "Select Left", description: "Extend selection left.", shortcut: [{ key: "ArrowLeft", modifiers: [It] }] }, v), new Ee("moveContentfulLeft", c, { label: "Move Left Contentful", description: "Move left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [zt] }] }, O), new Ee("selectContentfulLeft", c, { label: "Select Left Contentful", description: "Extend selection left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [zt, It] }] }, A), new Ee("moveRight", c, { label: "Move Right", description: "Move active cell to the right.", shortcut: [{ key: "ArrowRight" }] }, j), new Ee("selectRight", c, { label: "Select Right", description: "Extend selection right.", shortcut: [{ key: "ArrowRight", modifiers: [It] }] }, V), new Ee("moveContentfulRight", c, { label: "Move Right Contentful", description: "Move right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [zt] }] }, fe), new Ee("selectContentfulRight", c, { label: "Select Right Contentful", description: "Extend selection right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [zt, It] }] }, se), new Ee("moveUp", c, { label: "Move Up", description: "Move active cell to the up.", shortcut: [{ key: "ArrowUp" }] }, xe), new Ee("selectUp", c, { label: "Select Up", description: "Extend selection up.", shortcut: [{ key: "ArrowUp", modifiers: [It] }] },
|
|
2820
|
+
rn(), vt(C.cell, !0);
|
|
2821
|
+
}), new Ee("traverseSelectionRight", c, { label: "Traverse Right", description: "Traverse the selection moving rightward.", shortcut: { key: "Tab" } }, Jn), new Ee("traverseSelectionLeft", c, { label: "Traverse Left", description: "Traverse the selection moving leftward.", shortcut: { key: "Tab", modifiers: [It] } }, Zn), new Ee("traverseSelectionDown", c, { label: "Traverse Down", description: "Traverse the selection moving downward.", shortcut: [{ key: "Enter" }, { key: "NumpadEnter" }] }, _o), new Ee("traverseSelectionUp", c, { label: "Traverse Up", description: "Traverse the selection moving upward.", shortcut: [{ key: "Enter", modifiers: [It] }, { key: "NumpadEnter", modifiers: [It] }] }, Eo), new Ee("moveLeft", c, { label: "Move Left", description: "Move active cell to the left.", shortcut: [{ key: "ArrowLeft" }] }, Qn), new Ee("selectLeft", c, { label: "Select Left", description: "Extend selection left.", shortcut: [{ key: "ArrowLeft", modifiers: [It] }] }, v), new Ee("moveContentfulLeft", c, { label: "Move Left Contentful", description: "Move left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [zt] }] }, O), new Ee("selectContentfulLeft", c, { label: "Select Left Contentful", description: "Extend selection left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [zt, It] }] }, A), new Ee("moveRight", c, { label: "Move Right", description: "Move active cell to the right.", shortcut: [{ key: "ArrowRight" }] }, j), new Ee("selectRight", c, { label: "Select Right", description: "Extend selection right.", shortcut: [{ key: "ArrowRight", modifiers: [It] }] }, V), new Ee("moveContentfulRight", c, { label: "Move Right Contentful", description: "Move right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [zt] }] }, fe), new Ee("selectContentfulRight", c, { label: "Select Right Contentful", description: "Extend selection right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [zt, It] }] }, se), new Ee("moveUp", c, { label: "Move Up", description: "Move active cell to the up.", shortcut: [{ key: "ArrowUp" }] }, xe), new Ee("selectUp", c, { label: "Select Up", description: "Extend selection up.", shortcut: [{ key: "ArrowUp", modifiers: [It] }] }, ye), new Ee("moveContentfulUp", c, { label: "Move Up Contentful", description: "Move up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [zt] }] }, ce), new Ee("selectContentfulUp", c, { label: "Select Up Contentful", description: "Extend selection up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [zt, It] }] }, je), new Ee("moveDown", c, { label: "Move Down", description: "Move active cell to the down.", shortcut: [{ key: "ArrowDown" }] }, ft), new Ee("selectDown", c, { label: "Select Down", description: "Extend selection down.", shortcut: [{ key: "ArrowDown", modifiers: [It] }] }, Be), new Ee("moveContentfulDown", c, { label: "Move Down Contentful", description: "Move down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [zt] }] }, Fe), new Ee("selectContentfulDown", c, { label: "Select Down Contentful", description: "Extend selection down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [zt, It] }] }, gt), new Ee("selectVisible", c, { label: "Select Visible", description: "Select visible cells only.", shortcut: { key: ";", modifiers: [yn] } }, bo), new Ee("traverseSelectionPreviousRange", c, { label: "Traverse Previous Range", description: "Traverse the selection to the previous range.", shortcut: { key: "ArrowLeft", modifiers: [zt, yn] } }, Bn), new Ee("traverseSelectionNextRange", c, { label: "Traverse Next Range", description: "Traverse the selection to the next range.", shortcut: { key: "ArrowRight", modifiers: [zt, yn] } }, Io), new Ee("traverseSelectionCorners", c, { label: "Traverse Corners", description: "Traverse the selection through the corners of the selected range.", shortcut: { key: ".", modifiers: [zt] } }, Co)];
|
|
2811
2822
|
}, []);
|
|
2812
2823
|
return _e(() => {
|
|
2813
2824
|
t?.addCommands(Dt, !0);
|
|
@@ -2816,10 +2827,10 @@ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2816
2827
|
function ao(e, t) {
|
|
2817
2828
|
if (!e) throw new Error("Invariant failed");
|
|
2818
2829
|
}
|
|
2819
|
-
const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ts = Object.freeze({ top: 0, left: 0 }), ns = Object.freeze({ bottom: -4, right: -4 }), os = Object.freeze({ horizontal: !0, vertical: !0 }), Hr = [uo, Hn, Nn, Xt], xs = 150, sn = 3e3, Fo = {},
|
|
2820
|
-
const { width: n, height: o, rowCount: r = 1, columnCount: i = 1, defaultRowHeight: l, defaultColumnWidth: s, getRowHeight: a, getColumnWidth: d, layout: g, onViewportScroll: m, onImmediateScroll: f, showGridLines: x = !0, gridLineColor: _ = "rgb(224, 224, 224)", gridLineRowsProps:
|
|
2830
|
+
const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ts = Object.freeze({ top: 0, left: 0 }), ns = Object.freeze({ bottom: -4, right: -4 }), os = Object.freeze({ horizontal: !0, vertical: !0 }), Hr = [uo, Hn, Nn, Xt], xs = 150, sn = 3e3, Fo = {}, Oi = At(Ut((e, t) => {
|
|
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: f, showGridLines: x = !0, gridLineColor: _ = "rgb(224, 224, 224)", gridLineRowsProps: M, gridLineColumnsProps: R, clipCells: ae = !0, cursor: P, freezeLeft: I = 0, freezeTop: z = 0, freezeLeftProps: le, freezeTopProps: B, cellRenderer: oe, onViewportChange: be, onFirstRender: N, overlayRenderer: H, overlayProps: X, overlays: T, overlaysProps: S, allowOverlaysOverflow: h = !1, stageProps: J, stageWrapper: K = null, hiddenRowsAt: L, hiddenColumnsAt: U, hiddenCellAt: ee, getVisibleCells: te, zoom: Y = 1, enableMouseWheel: He = !0, onWheelScroll: Ve, getCellCoordsAsRangeCoords: Ne = Z.cellToRange, scrollPoint: at = ts, style: Se = {}, ...Ye } = e;
|
|
2821
2832
|
ao(oe), ao(!e?.children);
|
|
2822
|
-
const $ = k(f, [f]), E = k(
|
|
2833
|
+
const $ = k(f, [f]), E = k(be, [be]), Me = k(m, [m]), ue = k(Ve, [Ve]), me = k(N, [N]), $e = G(null), dt = G(null), kt = G(null), [ut, Zt] = Qo((v) => v + 1, 0), [St, C] = Ze({ left: at?.left ?? 0, top: at?.top ?? 0, horizontalScrollDirection: null, verticalScrollDirection: null }), ve = G(null), Je = G(St), { top: mt, left: Qe, verticalScrollDirection: cn, horizontalScrollDirection: on } = St, Mt = G(!1), dn = Fl({ rowCount: r, columnCount: i, defaultRowHeight: l, defaultColumnWidth: s, getRowHeight: a, getColumnWidth: d }), nn = G(null), De = _e(() => {
|
|
2823
2834
|
const v = g || dn;
|
|
2824
2835
|
return nn.current = null, { getColOffset: (O) => v.getColOffset(O) * Y, getColIndex: (O) => v.getColIndex(O / Y), getRowOffset: (O) => v.getRowOffset(O) * Y, getRowIndex: (O) => v.getRowIndex(O / Y) };
|
|
2825
2836
|
}, [dn, g, Y]), Kt = (v, O, A) => {
|
|
@@ -2827,11 +2838,11 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ts = Object.freeze({ top
|
|
|
2827
2838
|
return { getColOffset: (fe) => v.getColOffset(fe) - j, getColIndex: (fe) => v.getColIndex(fe + j), getRowOffset: (fe) => v.getRowOffset(fe) - V, getRowIndex: (fe) => v.getRowIndex(fe + V) };
|
|
2828
2839
|
}, xt = D((v, O = !1) => go(v, O, De.getRowOffset, O ? 0 : r), [r, De?.getRowOffset]), Vt = k(L ?? xt, [L]), Cn = D((v, O = !1) => go(v, O, De.getColOffset, O ? i : 0), [i, De?.getColOffset]), un = k(U ?? Cn, [U]), We = _e(() => Math.min(n ?? 800, De.getColOffset(i)), [De.getColOffset, i, n]), Q = _e(() => Math.min(o ?? 600, De.getRowOffset(r)), [De.getRowOffset, r, o]), et = D((v) => {
|
|
2829
2840
|
Ct.canUseDOM && setTimeout(() => {
|
|
2830
|
-
|
|
2841
|
+
$e.current?.focus({ preventScroll: !0, ...v });
|
|
2831
2842
|
}, 0);
|
|
2832
|
-
}, []), Ue = D((v) =>
|
|
2843
|
+
}, []), Ue = D((v) => $e.current?.contains(v) || dt.current?.contains(v), []);
|
|
2833
2844
|
st(() => {
|
|
2834
|
-
Mt.current && (
|
|
2845
|
+
Mt.current && (ve.current && ve.current.left !== Je.current?.left && ve.current.top !== Je.current?.top || (ve.current = null, Me?.({ left: Qe, top: mt })));
|
|
2835
2846
|
}, [Qe, mt]);
|
|
2836
2847
|
const ht = k(() => ({ top: mt, left: Qe }), [mt, Qe]), Ie = _e(() => {
|
|
2837
2848
|
const v = [];
|
|
@@ -2839,54 +2850,54 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ts = Object.freeze({ top
|
|
|
2839
2850
|
typeof z == "number" ? O = z : (O = z.index ?? 0, A = (z.scrollOffset ?? 0) * Y);
|
|
2840
2851
|
const j = A, V = De.getRowOffset(O), fe = V - j;
|
|
2841
2852
|
if (O > 0) {
|
|
2842
|
-
const ft = Kt(De, { top: A + De.getRowOffset(0) }),
|
|
2853
|
+
const ft = Kt(De, { top: A + De.getRowOffset(0) }), Be = De.getRowIndex(j), Fe = De.getRowIndex(V - 1);
|
|
2843
2854
|
let gt;
|
|
2844
|
-
v[1] = { minIndex:
|
|
2855
|
+
v[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 };
|
|
2845
2856
|
}
|
|
2846
|
-
const se = Math.max(0, Q - fe), xe = Kt(De, { top: mt + fe }),
|
|
2847
|
-
let
|
|
2848
|
-
return v[0] = { minIndex:
|
|
2857
|
+
const se = Math.max(0, Q - fe), xe = Kt(De, { top: mt + fe }), ye = xe.getRowIndex(0), ce = xe.getRowIndex(se);
|
|
2858
|
+
let je;
|
|
2859
|
+
return v[0] = { minIndex: ye, maxIndex: ce, minCoord: O, maxCoord: r - 1, minBounds: fe, maxBounds: se, visibleIndices: () => je || (je = Object.freeze(io(Vt, ye, ce)), je), layout: xe, maxVirtualBounds: De.getRowOffset(r), scrollOffset: mt, freezeOffset: (O > 0 ? De.getRowOffset(O) : 0) - A }, v;
|
|
2849
2860
|
}, [De.getRowIndex, De.getRowOffset, Vt, Q, r, z, mt, Y]), Oe = _e(() => {
|
|
2850
2861
|
const v = [];
|
|
2851
2862
|
let O = 0, A = 0;
|
|
2852
|
-
typeof
|
|
2863
|
+
typeof I == "number" ? O = I : (O = I.index ?? 0, A = (I.scrollOffset ?? 0) * Y);
|
|
2853
2864
|
const j = A, V = De.getColOffset(O), fe = V - j;
|
|
2854
2865
|
if (O > 0) {
|
|
2855
|
-
const ft = Kt(De, { left: A + De.getColOffset(0) }),
|
|
2866
|
+
const ft = Kt(De, { left: A + De.getColOffset(0) }), Be = De.getColIndex(j), Fe = De.getColIndex(V - 1);
|
|
2856
2867
|
let gt;
|
|
2857
|
-
v[1] = { minIndex:
|
|
2868
|
+
v[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 };
|
|
2858
2869
|
}
|
|
2859
|
-
const se = Math.max(0, We - fe), xe = Kt(De, { left: Qe + fe }),
|
|
2860
|
-
let
|
|
2861
|
-
return v[0] = { minIndex:
|
|
2862
|
-
}, [De.getColIndex, De.getColOffset, un, We, i,
|
|
2870
|
+
const se = Math.max(0, We - fe), xe = Kt(De, { left: Qe + fe }), ye = xe.getColIndex(0), ce = xe.getColIndex(se);
|
|
2871
|
+
let je;
|
|
2872
|
+
return v[0] = { minIndex: ye, maxIndex: ce, minCoord: O, maxCoord: i - 1, minBounds: fe, maxBounds: se, visibleIndices: () => je || (je = Object.freeze(io(un, ye, ce)), je), layout: xe, maxVirtualBounds: De.getColOffset(i), scrollOffset: Qe, freezeOffset: (O > 0 ? De.getColOffset(O) : 0) - A }, v;
|
|
2873
|
+
}, [De.getColIndex, De.getColOffset, un, We, i, I, Qe, Y]), rt = G({}), tt = G([]), ze = _e(() => {
|
|
2863
2874
|
let v = {};
|
|
2864
2875
|
const O = (j, V, fe, se, xe) => {
|
|
2865
|
-
const
|
|
2876
|
+
const ye = { vertical: se?.vertical || !1, horizontal: se?.horizontal || !1 };
|
|
2866
2877
|
if (j >= Oe.length || V >= Ie.length) return null;
|
|
2867
2878
|
const ce = { rowStart: Ie[V].minIndex, colStart: Oe[j].minIndex, rowEnd: Ie[V].maxIndex, colEnd: Oe[j].maxIndex };
|
|
2868
2879
|
if (ce.rowStart > ce.rowEnd || ce.colStart > ce.colEnd) return null;
|
|
2869
|
-
const
|
|
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 ?? ce, 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 }, vt = { width: We, height: Q };
|
|
2870
2881
|
let pe = null, wt = null;
|
|
2871
2882
|
const $t = (Lt.top + (se.vertical ? Xe.top : 0)) / Y, Wt = (Lt.left + (se.horizontal ? Xe.left : 0)) / Y;
|
|
2872
|
-
return { getStage: () =>
|
|
2883
|
+
return { getStage: () => $e.current ?? null, getVisibleRangeCoords: () => ce, toClipBounds: (Ce, Ge) => {
|
|
2873
2884
|
let Ae, ct = 0;
|
|
2874
|
-
return Ge === void 0 || typeof Ge == "number" ? (Ae =
|
|
2885
|
+
return Ge === void 0 || typeof Ge == "number" ? (Ae = Fe(ce), ct = Ge) : Ae = Ge, ((Pe, Et, yt = 0) => {
|
|
2875
2886
|
if (Pe.x > Et.width || Pe.y > Et.height) return null;
|
|
2876
2887
|
const Bt = { left: Pe.x, top: Pe.y, bottom: Pe.height + Pe.y, right: Pe.width + Pe.x }, qt = { left: Et.x + yt, top: Et.y + yt, bottom: Et.height - 2 * yt + Et.y, right: Et.width - 2 * yt + Et.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 };
|
|
2877
2888
|
return c.height < 0 || c.width < 0 ? null : c;
|
|
2878
|
-
})(Ce ?? { x: 0, y: 0, width:
|
|
2889
|
+
})(Ce ?? { x: 0, y: 0, width: Be.width, height: Be.height }, Ae, ct);
|
|
2879
2890
|
}, 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) => {
|
|
2880
2891
|
const Ae = hn(Ce, Ge);
|
|
2881
|
-
return { x: Ae.x -
|
|
2882
|
-
}, getLayout: () =>
|
|
2892
|
+
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(), ce.colStart, ce.colEnd)), pe), getVisibleRowOffsets: () => (wt || (wt = Br(Ie[V].layout, !1, Ie[V].visibleIndices(), ce.rowStart, ce.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) => {
|
|
2883
2894
|
const ct = hn(Ce, Ge);
|
|
2884
2895
|
if (!ct) return null;
|
|
2885
|
-
const Pe =
|
|
2896
|
+
const Pe = je.getColIndex(ct.x - Be.x), Et = { rowIndex: je.getRowIndex(ct.y - Be.y), colIndex: Pe };
|
|
2886
2897
|
if (Ae) return Et;
|
|
2887
2898
|
const yt = Ne(Et);
|
|
2888
2899
|
return { rowIndex: yt.rowStart, colIndex: yt.colStart };
|
|
2889
|
-
}, getZoom: () => Y, getAnchor: () => fe, getBounds: () =>
|
|
2900
|
+
}, getZoom: () => Y, getAnchor: () => fe, getBounds: () => Be, getInsets: () => ft, getTotalSize: () => gt, getViewportSize: () => vt, getScrollTopLeft: () => Xe, getFreezeTopLeft: () => Lt, getScrollOrientation: () => ye, allViews: () => v };
|
|
2890
2901
|
};
|
|
2891
2902
|
let A = v[Xt] = O(0, 0, Xt, os, ns);
|
|
2892
2903
|
return A && (v[Xt] = A), A = O(0, 1, Hn, { horizontal: !0 }), A && (v[Hn] = A), A = O(1, 0, Nn, { vertical: !0 }), A && (v[Nn] = A), A = O(1, 1, uo, {}), A && (v[uo] = A), rt.current = null, v = Object.freeze(v);
|
|
@@ -2899,13 +2910,13 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ts = Object.freeze({ top
|
|
|
2899
2910
|
}, [ze]);
|
|
2900
2911
|
const Ot = k(() => ({ containerWidth: We, containerHeight: Q, totalWidth: Tt, totalHeight: nt }), [We, Q, De]);
|
|
2901
2912
|
st(() => {
|
|
2902
|
-
!
|
|
2913
|
+
!ve.current && Mt.current && E({ top: mt, left: Qe, width: We, height: Q, totalWidth: Tt, totalHeight: nt });
|
|
2903
2914
|
}, [mt, Qe, Tt, nt]), st(() => {
|
|
2904
2915
|
Mt.current && E({ top: mt, left: Qe, width: We, height: Q, totalWidth: Tt, totalHeight: nt });
|
|
2905
2916
|
}, [We, Q]);
|
|
2906
2917
|
const hn = D((v, O) => {
|
|
2907
2918
|
ao(typeof v == "number" && typeof O == "number");
|
|
2908
|
-
const A =
|
|
2919
|
+
const A = $e.current?.getBoundingClientRect();
|
|
2909
2920
|
return A ? { x: v - A.x, y: O - A.y } : { x: v, y: O };
|
|
2910
2921
|
}, []), mo = k((v) => ze[v] || null, [ze]), xo = k((v, O) => {
|
|
2911
2922
|
if (Object.keys(ze).length === 1) return ze[Xt];
|
|
@@ -2915,14 +2926,14 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ts = Object.freeze({ top
|
|
|
2915
2926
|
let fe = null;
|
|
2916
2927
|
const se = Hr;
|
|
2917
2928
|
for (let xe = 0; !fe && xe < se.length; xe++) {
|
|
2918
|
-
const
|
|
2919
|
-
|
|
2929
|
+
const ye = ze[se[xe]];
|
|
2930
|
+
ye && ql(j, V, ye.getBounds()) && (fe = ye);
|
|
2920
2931
|
}
|
|
2921
2932
|
return fe || (fe = ze[Xt]), fe;
|
|
2922
|
-
}, [ze, Ne]), pt = k(() => ze[Xt].getVisibleRangeCoords(), [ze[Xt]]), ln =
|
|
2933
|
+
}, [ze, Ne]), pt = k(() => ze[Xt].getVisibleRangeCoords(), [ze[Xt]]), ln = G(null), vo = D(() => {
|
|
2923
2934
|
ln.current !== null && Ct.cancelTimeout(ln.current), ln.current = Ct.requestTimeout(yo, 150);
|
|
2924
2935
|
}, []), yo = D(() => {
|
|
2925
|
-
ln.current = null,
|
|
2936
|
+
ln.current = null, C((v) => {
|
|
2926
2937
|
const O = { ...v, verticalScrollDirection: null, horizontalScrollDirection: null };
|
|
2927
2938
|
return Je.current = O, O;
|
|
2928
2939
|
});
|
|
@@ -2931,16 +2942,16 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ts = Object.freeze({ top
|
|
|
2931
2942
|
if (Je.current.left === j && Je.current.top === V) return;
|
|
2932
2943
|
let fe = null, se = null;
|
|
2933
2944
|
Je.current.left > j ? fe = ot : Je.current.left < j && (fe = Ke), Je.current.top > V ? se = it : Je.current.top < V && (se = lt), Ct.throttle(() => {
|
|
2934
|
-
|
|
2935
|
-
const
|
|
2936
|
-
return Je.current =
|
|
2945
|
+
C((xe) => {
|
|
2946
|
+
const ye = { ...xe, left: j, top: V, horizontalScrollDirection: fe, verticalScrollDirection: se };
|
|
2947
|
+
return Je.current = ye, ye;
|
|
2937
2948
|
});
|
|
2938
|
-
}, 17)(),
|
|
2949
|
+
}, 17)(), ve.current?.top === V && ve.current?.left === j || (ve.current = { left: j, top: V }, $({ left: j, top: V }), E({ left: j, top: V, width: We, height: Q, totalWidth: Tt, totalHeight: nt })), vo();
|
|
2939
2950
|
}, [Tt, nt, Ie, Oe]);
|
|
2940
2951
|
st(() => {
|
|
2941
|
-
|
|
2952
|
+
ve.current || xn({ left: Qe, top: mt });
|
|
2942
2953
|
}, [Tt, We, nt, Q]), tn(() => {
|
|
2943
|
-
|
|
2954
|
+
ve.current = { left: at?.left, top: at?.top }, xn(ve.current);
|
|
2944
2955
|
}, [at?.left, at?.top]);
|
|
2945
2956
|
const qn = k((v) => {
|
|
2946
2957
|
const O = v?.left ?? v?.[0], A = v?.top ?? v?.[1], j = v?.behavior ?? "auto", V = { left: Je.current.left + (O ?? 0), top: Je.current.top + (A ?? 0) };
|
|
@@ -2951,7 +2962,7 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ts = Object.freeze({ top
|
|
|
2951
2962
|
const A = Hr;
|
|
2952
2963
|
for (let j = 0; !O && j < A.length; j++) {
|
|
2953
2964
|
const V = ze[A[j]];
|
|
2954
|
-
V &&
|
|
2965
|
+
V && Z.isCellWithinRange(v, V.getVisibleRangeCoords()) && (O = V);
|
|
2955
2966
|
}
|
|
2956
2967
|
}
|
|
2957
2968
|
return O || (O = ze[Xt]), O;
|
|
@@ -2963,7 +2974,7 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ts = Object.freeze({ top
|
|
|
2963
2974
|
pe("Invalid view");
|
|
2964
2975
|
});
|
|
2965
2976
|
} else V = Yn(j);
|
|
2966
|
-
const fe = Ne(j), se = V.getLayout(), xe = se.getColOffset(fe.colStart),
|
|
2977
|
+
const fe = Ne(j), se = V.getLayout(), xe = se.getColOffset(fe.colStart), ye = se.getRowOffset(fe.rowStart), ce = se.getColOffset(fe.colEnd + 1), je = se.getRowOffset(fe.rowEnd + 1), ft = V.getBounds(), Be = V.getTotalSize(), Fe = V.getScrollTopLeft(), gt = ((vt, 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, vt.x, vt.x + vt.width, pe.left, pe.left + pe.width, pe.totalWidth), top: zr(wt.block, vt.y, vt.y + vt.height, pe.top, pe.top + pe.height, pe.totalHeight) }))({ x: xe + Fe.left, y: ye + Fe.top, width: ce - xe, height: je - ye }, { left: Fe.left, top: Fe.top, width: ft.width, height: ft.height, totalWidth: Be.width, totalHeight: Be.height }, O), Xe = { ...gt };
|
|
2967
2978
|
Xe.left > Qe ? Xe.left += 20 : Xe.left < Qe && (Xe.left -= 0), Xe.top > mt ? Xe.top += 20 : Xe.top < mt && (Xe.top -= 0);
|
|
2968
2979
|
const Lt = V.getScrollOrientation();
|
|
2969
2980
|
return Lt.horizontal && v.colIndex !== void 0 || delete Xe.left, Lt.vertical && v.rowIndex !== void 0 || delete Xe.top, new Promise((vt, pe) => {
|
|
@@ -2979,9 +2990,9 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ts = Object.freeze({ top
|
|
|
2979
2990
|
const { deltaX: A, deltaY: j, deltaMode: V } = v;
|
|
2980
2991
|
if (kt.current || ue?.(v) === !1) return;
|
|
2981
2992
|
let se = O ? j : A, xe = j;
|
|
2982
|
-
const
|
|
2993
|
+
const ye = O || Math.abs(se) > Math.abs(xe);
|
|
2983
2994
|
V === 1 && (xe *= 0), kt.current = window.requestAnimationFrame(() => {
|
|
2984
|
-
kt.current = null, qn(
|
|
2995
|
+
kt.current = null, qn(ye ? { left: se } : { top: xe });
|
|
2985
2996
|
});
|
|
2986
2997
|
}, [Tt, We, nt, Q, ue]), zn = D((v = null) => {
|
|
2987
2998
|
nn.current = null, rt.current = null, Zt();
|
|
@@ -2989,13 +3000,13 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ts = Object.freeze({ top
|
|
|
2989
3000
|
tn(() => {
|
|
2990
3001
|
zn();
|
|
2991
3002
|
}, [oe]);
|
|
2992
|
-
const vn = wo(t, () => ({ stage:
|
|
3003
|
+
const vn = 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: (v) => {
|
|
2993
3004
|
tt.current.push(v);
|
|
2994
3005
|
} }), [r, i, ze]);
|
|
2995
|
-
st(() => (He && vn.current?.addEventListener("wheel", Mn, { passive: !1 }), Mt.current = !0,
|
|
3006
|
+
st(() => (He && vn.current?.addEventListener("wheel", Mn, { passive: !1 }), Mt.current = !0, ve.current = null, () => {
|
|
2996
3007
|
vn.current?.removeEventListener("wheel", Mn);
|
|
2997
3008
|
}), [He]);
|
|
2998
|
-
const An =
|
|
3009
|
+
const An = G([]), bo = (v, O) => {
|
|
2999
3010
|
!v || !H || (An.current = [], O.push(((A, j) => {
|
|
3000
3011
|
const V = `view:${A.getAnchor()}:overlay:${O.length}`, fe = H?.({ key: V, view: A }, (xe) => An.current[j] = xe);
|
|
3001
3012
|
if (!fe) return null;
|
|
@@ -3011,20 +3022,20 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ts = Object.freeze({ top
|
|
|
3011
3022
|
return v;
|
|
3012
3023
|
}, [ut, H, r, i, Ie, Oe]), Xn = (v, O, A, j, V, fe, se) => {
|
|
3013
3024
|
if (!v) return;
|
|
3014
|
-
const xe = v.getVisibleColumns(),
|
|
3015
|
-
if (xe.length === 0 ||
|
|
3025
|
+
const xe = v.getVisibleColumns(), ye = v.getVisibleRows();
|
|
3026
|
+
if (xe.length === 0 || ye.length === 0) return;
|
|
3016
3027
|
let ce = null;
|
|
3017
3028
|
if (te) ce = te(v);
|
|
3018
3029
|
else {
|
|
3019
3030
|
ce = [];
|
|
3020
|
-
for (let Ge = 0; Ge <
|
|
3021
|
-
const ct = { rowIndex:
|
|
3031
|
+
for (let Ge = 0; Ge < ye.length; Ge++) for (let Ae = 0; Ae < xe.length; Ae++) {
|
|
3032
|
+
const ct = { rowIndex: ye[Ge], colIndex: xe[Ae] };
|
|
3022
3033
|
if (ee?.(ct)) continue;
|
|
3023
3034
|
const Pe = { coords: ct, range: Ne(ct) };
|
|
3024
3035
|
ce.push(Pe);
|
|
3025
3036
|
}
|
|
3026
3037
|
}
|
|
3027
|
-
const
|
|
3038
|
+
const je = v.getVisibleColumnOffsets(), ft = v.getVisibleRowOffsets(), Be = v.getScrollTopLeft(), Fe = v.getFreezeTopLeft(), gt = Be.left + Fe.left, Xe = Be.top + Fe.top, Lt = Math.trunc(gt / sn), vt = Math.trunc(Xe / sn), pe = {}, wt = (Ge, Ae, ct, Pe, Et) => {
|
|
3028
3039
|
const yt = `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) - vt;
|
|
3029
3040
|
pe[c] || (pe[c] = {});
|
|
3030
3041
|
let u = pe[c][Dt];
|
|
@@ -3040,10 +3051,10 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ts = Object.freeze({ top
|
|
|
3040
3051
|
const Ae = ce[Ge], ct = Ae?.coords ?? Ae;
|
|
3041
3052
|
if (!ct) continue;
|
|
3042
3053
|
const Pe = Ae?.range ?? { rowStart: ct.rowIndex, colStart: ct.colIndex, rowEnd: ct.rowIndex, colEnd: ct.colIndex }, Et = v.getVisibleRangeCoords();
|
|
3043
|
-
if (!
|
|
3044
|
-
const yt = Pe && !
|
|
3054
|
+
if (!Z.isRangesIntersect(Pe, Et) && !Z.isRangeWithinRange(Pe, Et)) continue;
|
|
3055
|
+
const yt = Pe && !Z.isSingleCell(Pe);
|
|
3045
3056
|
if (!yt && ee?.(ct)) continue;
|
|
3046
|
-
const Bt = ct.rowIndex, qt = ct.colIndex, Dt = ft[Bt], c =
|
|
3057
|
+
const Bt = ct.rowIndex, qt = ct.colIndex, Dt = ft[Bt], c = je[qt];
|
|
3047
3058
|
let u = null;
|
|
3048
3059
|
Dt && c && (u = { x: c.offset, y: Dt.offset, width: c.size, height: Dt.size });
|
|
3049
3060
|
const w = Dr(Pe.rowStart, Pe.colStart);
|
|
@@ -3073,60 +3084,60 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ts = Object.freeze({ top
|
|
|
3073
3084
|
}, Jt = _e(() => {
|
|
3074
3085
|
const v = nn.current, O = /* @__PURE__ */ new Map(), A = {}, j = Object.keys(ze);
|
|
3075
3086
|
for (let V = 0; V < j.length; V++) {
|
|
3076
|
-
const fe = j[V], se = [], xe = [],
|
|
3077
|
-
Xn(ze[fe],
|
|
3087
|
+
const fe = j[V], se = [], xe = [], ye = [];
|
|
3088
|
+
Xn(ze[fe], ye, se, xe, /* @__PURE__ */ new Set(), v, O), A[fe] = { cells: ye, rangesH: se, rangesV: xe };
|
|
3078
3089
|
}
|
|
3079
3090
|
return nn.current = O, A;
|
|
3080
3091
|
}, [ut, r, i, Ie, Oe, x, Se, ae, ee, te, Ne]), Gn = (v, O, A, j, V) => {
|
|
3081
3092
|
if (v) if (O) {
|
|
3082
3093
|
const fe = `view:${v.getAnchor()}:hl:`, se = v.getVisibleRows();
|
|
3083
3094
|
if (!se || se.length === 0) return;
|
|
3084
|
-
const xe = 0,
|
|
3095
|
+
const xe = 0, ye = v.getBounds().width;
|
|
3085
3096
|
let ce = [];
|
|
3086
|
-
const
|
|
3087
|
-
for (let
|
|
3088
|
-
const
|
|
3089
|
-
if (
|
|
3097
|
+
const je = V.sort(Z.rowFirstRangeComparator), ft = v.getVisibleRangeCoords();
|
|
3098
|
+
for (let Be = 0; Be < se.length && se[Be] <= ft.rowEnd; Be++) {
|
|
3099
|
+
const Fe = se[Be];
|
|
3100
|
+
if (Fe < ft.rowStart) continue;
|
|
3090
3101
|
let gt = !1;
|
|
3091
|
-
for (;
|
|
3092
|
-
const pe =
|
|
3093
|
-
pe.rowEnd >
|
|
3102
|
+
for (; je.length > 0 && je[0].rowStart <= Fe; ) {
|
|
3103
|
+
const pe = je.shift();
|
|
3104
|
+
pe.rowEnd > Fe && (ce.push(pe), gt = !0);
|
|
3094
3105
|
}
|
|
3095
|
-
gt && (ce = ce.sort(
|
|
3096
|
-
const Xe = v.getLayout(), Lt = Xe.getRowOffset(
|
|
3106
|
+
gt && (ce = ce.sort(Z.columnFirstRangeComparator));
|
|
3107
|
+
const Xe = v.getLayout(), Lt = Xe.getRowOffset(Fe + 1);
|
|
3097
3108
|
let vt = xe;
|
|
3098
3109
|
for (let pe = 0; pe < ce.length + 1; pe++) {
|
|
3099
|
-
let wt = vt, $t =
|
|
3110
|
+
let wt = vt, $t = ye;
|
|
3100
3111
|
const Wt = ce[pe];
|
|
3101
|
-
pe < ce.length && ($t = Math.min(
|
|
3112
|
+
pe < ce.length && ($t = Math.min(ye, Xe.getColOffset(Wt.colStart)), vt = Math.min(ye, 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: _, strokeWidth: 1, vectorEffect: "non-scaling-stroke", ...M, key: fe + Fe + ":" + pe }));
|
|
3102
3113
|
}
|
|
3103
|
-
for (let pe = ce.length - 1; pe >= 0; pe--) ce[pe].rowEnd <= se[
|
|
3114
|
+
for (let pe = ce.length - 1; pe >= 0; pe--) ce[pe].rowEnd <= se[Be + 1] && ce.splice(pe, 1);
|
|
3104
3115
|
}
|
|
3105
3116
|
} else {
|
|
3106
3117
|
const fe = `view:${v.getAnchor()}:vl:`, se = v.getVisibleColumns();
|
|
3107
3118
|
if (!se || se.length === 0) return;
|
|
3108
|
-
const xe = 0,
|
|
3119
|
+
const xe = 0, ye = v.getBounds().height;
|
|
3109
3120
|
let ce = [];
|
|
3110
|
-
const
|
|
3111
|
-
for (let
|
|
3112
|
-
const
|
|
3113
|
-
if (
|
|
3121
|
+
const je = V.sort(Z.columnFirstRangeComparator), ft = v.getVisibleRangeCoords();
|
|
3122
|
+
for (let Be = 0; Be < se.length && se[Be] <= ft.colEnd; Be++) {
|
|
3123
|
+
const Fe = se[Be];
|
|
3124
|
+
if (Fe < ft.colStart) continue;
|
|
3114
3125
|
let gt = !1;
|
|
3115
|
-
for (;
|
|
3116
|
-
const pe =
|
|
3117
|
-
pe.colEnd >
|
|
3126
|
+
for (; je.length > 0 && je[0].colStart <= Fe; ) {
|
|
3127
|
+
const pe = je.shift();
|
|
3128
|
+
pe.colEnd > Fe && (ce.push(pe), gt = !0);
|
|
3118
3129
|
}
|
|
3119
|
-
gt && (ce = ce.sort(
|
|
3120
|
-
const Xe = v.getLayout(), Lt = Xe.getColOffset(
|
|
3130
|
+
gt && (ce = ce.sort(Z.rowFirstRangeComparator));
|
|
3131
|
+
const Xe = v.getLayout(), Lt = Xe.getColOffset(Fe + 1);
|
|
3121
3132
|
let vt = xe;
|
|
3122
3133
|
for (let pe = 0; pe < ce.length + 1; pe++) {
|
|
3123
|
-
let wt = vt, $t =
|
|
3134
|
+
let wt = vt, $t = ye;
|
|
3124
3135
|
const Wt = ce[pe];
|
|
3125
|
-
pe < ce.length && ($t = Math.min(
|
|
3136
|
+
pe < ce.length && ($t = Math.min(ye, Xe.getRowOffset(Wt.rowStart)), vt = Math.min(ye, Xe.getRowOffset(Wt.rowEnd + 1)));
|
|
3126
3137
|
let Ce = _;
|
|
3127
|
-
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", ...R }, fe +
|
|
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", ...R }, fe + Fe + ":" + pe));
|
|
3128
3139
|
}
|
|
3129
|
-
for (let pe = ce.length - 1; pe >= 0; pe--) ce[pe].colEnd <= se[
|
|
3140
|
+
for (let pe = ce.length - 1; pe >= 0; pe--) ce[pe].colEnd <= se[Be + 1] && ce.splice(pe, 1);
|
|
3130
3141
|
}
|
|
3131
3142
|
}
|
|
3132
3143
|
}, $n = (v) => {
|
|
@@ -3135,11 +3146,11 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ts = Object.freeze({ top
|
|
|
3135
3146
|
for (let A = 0; A < rn.length; A++) {
|
|
3136
3147
|
const j = rn[A], V = ze[j], fe = [];
|
|
3137
3148
|
Gn(V, v, 0, fe, v ? Jt[j].rangesH : Jt[j].rangesV);
|
|
3138
|
-
const se = V.getRangeCoordsBounds(), xe = Math.ceil(se.width),
|
|
3139
|
-
O[j] = q("svg", { width: `${xe}`, height: `${
|
|
3149
|
+
const se = V.getRangeCoordsBounds(), xe = Math.ceil(se.width), ye = Math.ceil(se.height);
|
|
3150
|
+
O[j] = q("svg", { width: `${xe}`, height: `${ye}`, viewBox: `0 0 ${xe} ${ye}`, preserveAspectRatio: "none", shapeRendering: "crispEdges", style: { position: "absolute" }, children: fe });
|
|
3140
3151
|
}
|
|
3141
3152
|
return O;
|
|
3142
|
-
}, Zn = _e(() => x === !0 || x?.horizontal === !0 ? $n(!0) : null, [ut, x, Ie, z,
|
|
3153
|
+
}, Zn = _e(() => x === !0 || x?.horizontal === !0 ? $n(!0) : null, [ut, x, Ie, z, I, _, M, r, i, We, Tt, Jt]), Jn = _e(() => x === !0 || x?.vertical === !0 ? $n(!1) : null, [ut, x, Oe, z, I, _, R, r, i, Q, nt, Jt]), Eo = _e(() => Rt.left === 0 ? null : q(jr, { linePoints: [0, 0, 0, Q + 1], bounds: { x: Rt.left, y: 0, width: 1, height: Q + 1 }, ...le }), [ut, Rt.left, Q, le]), _o = _e(() => 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 = _e(() => {
|
|
3143
3154
|
const v = [], O = (A) => {
|
|
3144
3155
|
if (!A || !ze[A]) return;
|
|
3145
3156
|
const j = ze[A].getBounds();
|
|
@@ -3149,99 +3160,99 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ts = Object.freeze({ top
|
|
|
3149
3160
|
return q(wn, { children: v });
|
|
3150
3161
|
}, [ze, Zn, Jn, Jt]), Io = _e(() => {
|
|
3151
3162
|
if (!t) return;
|
|
3152
|
-
const v = (se, xe,
|
|
3163
|
+
const v = (se, xe, ye, ce) => {
|
|
3153
3164
|
if (!ce || ce.length === 0) return;
|
|
3154
|
-
const
|
|
3165
|
+
const je = [];
|
|
3155
3166
|
for (let ft = 0; ft < ce.length; ft++) {
|
|
3156
|
-
const
|
|
3157
|
-
let
|
|
3158
|
-
|
|
3167
|
+
const Be = ce[ft];
|
|
3168
|
+
let Fe = se?.get(Be);
|
|
3169
|
+
Fe !== Fo && (Fe = Be(ye) ?? Fo), xe.set(Be, Fe), Fe && Fe !== Fo && je.push(Fe);
|
|
3159
3170
|
}
|
|
3160
|
-
return
|
|
3161
|
-
}, O = (se, xe,
|
|
3162
|
-
if (!
|
|
3163
|
-
const ce =
|
|
3164
|
-
return Ht("div", { className: En("view", `view-${ft}`, Wr.view), style: { position: "absolute", pointerEvents: "none", left: ce.x -
|
|
3171
|
+
return je;
|
|
3172
|
+
}, O = (se, xe, ye) => {
|
|
3173
|
+
if (!ye) return;
|
|
3174
|
+
const ce = ye.getBounds(), je = ye.getInsets(), ft = ye.getAnchor();
|
|
3175
|
+
return Ht("div", { className: En("view", `view-${ft}`, Wr.view), style: { position: "absolute", pointerEvents: "none", left: ce.x - je.left, top: ce.y - je.top, width: ce.width - (je.left + je.right), height: ce.height - (je.top + je.bottom), clipPath: h ? "inset(-2px)" : "inset(0px)" }, children: [v(se, xe, ye, T), So?.[ft].overlays] }, `view:${ft}`);
|
|
3165
3176
|
}, A = rt.current, j = {}, V = [], fe = Object.keys(ze);
|
|
3166
3177
|
for (let se = 0; se < fe.length; se++) {
|
|
3167
|
-
const xe = fe[se],
|
|
3168
|
-
V.push(O(
|
|
3178
|
+
const xe = fe[se], ye = A?.[xe], ce = j[xe] = /* @__PURE__ */ new Map();
|
|
3179
|
+
V.push(O(ye, ce, ze[xe]));
|
|
3169
3180
|
}
|
|
3170
3181
|
return rt.current = j, V;
|
|
3171
3182
|
}, [ut, ze, h, T]), Co = _e(() => {
|
|
3172
3183
|
const { style: v, ...O } = J ?? {};
|
|
3173
|
-
return q("div", { style: { width: We, height: Q, ...v }, className: "sheetxl-stage", tabIndex: 0, ref:
|
|
3174
|
-
}, [We, Q, Bn, J, K]), Qn =
|
|
3184
|
+
return q("div", { style: { width: We, height: Q, ...v }, className: "sheetxl-stage", tabIndex: 0, ref: $e, ...O, ...Ye, children: K ? K(Bn) : Bn });
|
|
3185
|
+
}, [We, Q, Bn, J, K]), Qn = G(!1);
|
|
3175
3186
|
return st(() => {
|
|
3176
3187
|
!Qn.current && Jt && (Qn.current = !0, me?.(vn.current));
|
|
3177
3188
|
}, [Jt]), Ht("div", { className: En("sheetxl-grid", Wr["sheetxl-grid"]), style: { overflow: "visible", cursor: P, maxWidth: We, maxHeight: Q, width: We, height: Q, ...Se }, ref: vn, children: [Co, Ht("div", { className: En("sheetxl-overlays"), ref: dt, ...S, children: [Io, Eo, _o] })] });
|
|
3178
3189
|
}));
|
|
3179
|
-
|
|
3180
|
-
const
|
|
3181
|
-
const { width: n, height: o, style: r = {}, className: i, ...l } = e, [s, { width: a, height: d }] =
|
|
3182
|
-
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(
|
|
3190
|
+
Oi.displayName = "BaseGrid";
|
|
3191
|
+
const Li = At(Ut((e, t) => {
|
|
3192
|
+
const { width: n, height: o, style: r = {}, className: i, ...l } = e, [s, { width: a, height: d }] = ki();
|
|
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(Oi, { ref: t, width: n ?? a, height: o ?? d, ...l }) }) });
|
|
3183
3194
|
}));
|
|
3184
|
-
|
|
3195
|
+
Li.displayName = "Grid";
|
|
3185
3196
|
const rs = At(Ut((e, t) => {
|
|
3186
|
-
const { showVerticalScrollbar: n, showHorizontalScrollbar: o, createHorizontalScrollbar: r, createVerticalScrollbar: i, createScrollCorner: l, viewport: s, onScrollViewport: a, style: d = {}, className: g, onScroll: m, ...f } = e, [x, _] = Ze(null),
|
|
3187
|
-
ao(!s), Ur(t, () => R.current &&
|
|
3197
|
+
const { showVerticalScrollbar: n, showHorizontalScrollbar: o, createHorizontalScrollbar: r, createVerticalScrollbar: i, createScrollCorner: l, viewport: s, onScrollViewport: a, style: d = {}, className: g, onScroll: m, ...f } = e, [x, _] = Ze(null), M = G(null), R = G(null);
|
|
3198
|
+
ao(!s), Ur(t, () => R.current && M.current ? Object.assign(R.current, M.current) : null);
|
|
3188
3199
|
const ae = D((P) => {
|
|
3189
3200
|
R.current?.scrollTo(P), a?.(P);
|
|
3190
3201
|
}, []);
|
|
3191
|
-
return q(
|
|
3202
|
+
return q(yi, { className: g, style: d, ref: M, showVerticalScrollbar: n, showHorizontalScrollbar: o, createHorizontalScrollbar: r, createVerticalScrollbar: i, createScrollCorner: l, viewport: x, onScrollViewport: ae, children: q(Li, { style: { width: "100%", height: "100%" }, ...f, onViewportChange: (P) => _(P), ref: R }) });
|
|
3192
3203
|
}));
|
|
3193
3204
|
rs.displayName = "ScrollableGrid";
|
|
3194
3205
|
const Nr = () => !1, is = At((e) => {
|
|
3195
|
-
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: f = Nr, isSelectedAll: x = Nr, coords: _, bounds:
|
|
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: f = Nr, isSelectedAll: x = Nr, coords: _, bounds: M, range: R, orientation: ae, view: P, style: I, ...z } = e, le = r / 100, B = G(null), [oe, be] = Ze(!1), N = f?.(t) || !1, H = x?.(t) ? a : N ? s : l;
|
|
3196
3207
|
let X = H;
|
|
3197
3208
|
if (oe) {
|
|
3198
3209
|
let T = d;
|
|
3199
3210
|
typeof d == "function" && (T = d(H)), X = Ct.mergeContentful(H, T);
|
|
3200
3211
|
}
|
|
3201
|
-
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 * le, fontStyle: X.text?.fontStyle, fontWeight: X.text?.fontWeight, lineHeight: 1.2, display: "flex", justifyContent: "center", alignItems: "end", pointerEvents: "auto", paddingBottom: `${le}px`, ...
|
|
3202
|
-
we.detectIt().primaryInput !== "touch" && T.buttons === 0 &&
|
|
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 * le, fontStyle: X.text?.fontStyle, fontWeight: X.text?.fontWeight, lineHeight: 1.2, display: "flex", justifyContent: "center", alignItems: "end", pointerEvents: "auto", paddingBottom: `${le}px`, ...I, left: I.left - (ae === Nt ? 1 : 0), top: I.top - (ae === an ? 1 : 0), width: I.width + 1, height: I.height + 1, overflow: "hidden" }, ...z, onMouseMove: (T) => {
|
|
3213
|
+
we.detectIt().primaryInput !== "touch" && T.buttons === 0 && be(!0);
|
|
3203
3214
|
}, onMouseOut: (T) => {
|
|
3204
|
-
|
|
3215
|
+
be(!1);
|
|
3205
3216
|
}, children: i(t) });
|
|
3206
3217
|
});
|
|
3207
3218
|
is.displayName = "HeaderRenderer";
|
|
3208
|
-
const
|
|
3209
|
-
const { orientation: n, view: o, index: r, className: i, style: l, disabled: s = !1, disabledResize: a = !1, isNextHidden: d, isHidden: g, isSelected: m, isSelectedAll: f, showTouchDivider: x, headerStyle: _, headerStyleSelect:
|
|
3219
|
+
const Di = "ew-resize", zi = "ns-resize", ls = At(Ut((e, t) => {
|
|
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: f, showTouchDivider: x, headerStyle: _, headerStyleSelect: M, headerStyleSelectAll: R, headerStyleHover: ae, bounds: P, onPointerDown: I, onAutoFit: z, ...le } = e, B = n === Nt;
|
|
3210
3221
|
let oe = _;
|
|
3211
|
-
m &&
|
|
3212
|
-
const
|
|
3222
|
+
m && M && (oe = M), f && R && (oe = R);
|
|
3223
|
+
const be = we.detectIt().primaryInput === "touch";
|
|
3213
3224
|
let N = B ? 14 : 8, H = N / 2, X = 0;
|
|
3214
3225
|
d && (X = -2), g && (X = 2), g && (N = N / 2 + X, H = 2 * X);
|
|
3215
3226
|
let T = oe.dividerStrokeFill ?? oe.strokeFill;
|
|
3216
|
-
return !(m || f) && X === 0 && (T = `linear-gradient(${B ? 180 : 90}deg, ${oe.fill}, ${T} 55%, ${T} 100%)`), Ht("div", { className: En("header-divider", { disabled: s }, i, `index-${r}`), ref: t, onPointerDown:
|
|
3227
|
+
return !(m || f) && X === 0 && (T = `linear-gradient(${B ? 180 : 90}deg, ${oe.fill}, ${T} 55%, ${T} 100%)`), Ht("div", { className: En("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 ? Di : zi, ...l }, ...le, 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: oe.fill, border: `${R.edgeStrokeFill} solid 1px`, boxShadow: `0.5px 0.5px 0px 0px ${_.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(M.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] });
|
|
3217
3228
|
})), ss = (e, t) => q(ls, { ...e, ref: t }), vs = At(Ut((e, t) => {
|
|
3218
|
-
const { orientation: n, view: o, index: r, disabled: i = !1, disabledResize: l = !1, resizeThreshold: s = 1, dividerRenderer: a = ss, onDividerMouseDown: d, onDividerResizeStart: g, onDividerResize: m, onDividerResizeEnd: f, onDividerMouseUp: x, onDividerAutoFit: _, onPointerDown:
|
|
3219
|
-
let z =
|
|
3220
|
-
z.length > 0 && (
|
|
3221
|
-
const B =
|
|
3229
|
+
const { orientation: n, view: o, index: r, disabled: i = !1, disabledResize: l = !1, resizeThreshold: s = 1, dividerRenderer: a = ss, onDividerMouseDown: d, onDividerResizeStart: g, onDividerResize: m, onDividerResizeEnd: f, onDividerMouseUp: x, onDividerAutoFit: _, onPointerDown: M, ...R } = e, ae = k(M, [M]), P = k(_, [_]), I = n === Nt;
|
|
3230
|
+
let z = I ? o.getVisibleColumns() : o.getVisibleRows(), le = null;
|
|
3231
|
+
z.length > 0 && (I ? le = 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 }), le = o.toClipBounds(le, en));
|
|
3232
|
+
const B = G(null), [oe, 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) => {
|
|
3222
3233
|
if (ae?.(L), !i && !l) {
|
|
3223
|
-
const U =
|
|
3224
|
-
B.current = { isResizing: !1, startSize: ee, index: r, view: o, orientation: n, onDividerMouseDown: d, onDividerResizeStart: g, onDividerResize: m, onDividerResizeEnd: f, onDividerMouseUp: x },
|
|
3234
|
+
const U = I ? H.getColOffset(r) : H.getRowOffset(r), ee = X - U;
|
|
3235
|
+
B.current = { isResizing: !1, startSize: ee, index: r, view: o, orientation: n, onDividerMouseDown: d, onDividerResizeStart: g, onDividerResize: m, onDividerResizeEnd: f, onDividerMouseUp: x }, be(B.current), d?.(r, ee);
|
|
3225
3236
|
}
|
|
3226
3237
|
L.stopPropagation(), L.preventDefault();
|
|
3227
3238
|
}, onPointerUp: (L, U, ee) => {
|
|
3228
3239
|
if (!B.current) return;
|
|
3229
3240
|
B.current.isResizing && B.current.onDividerResizeEnd?.(B.current.index, Math.max(0, B.current.startSize + N(L, ee)), B.current.startSize);
|
|
3230
3241
|
const te = B.current;
|
|
3231
|
-
B.current = null,
|
|
3242
|
+
B.current = null, be(B.current), te.onDividerMouseUp?.(te.index);
|
|
3232
3243
|
}, onPointerMoveOrWait: (L, U, ee) => {
|
|
3233
3244
|
if (!B.current) return;
|
|
3234
3245
|
const te = N(L, ee);
|
|
3235
|
-
B.current.isResizing ? B.current.onDividerResize?.(B.current.index, Math.max(0, B.current.startSize + te), B.current.startSize) : Math.abs(te) > Math.max(1, s) && (B.current = { ...B.current, isResizing: !0 },
|
|
3246
|
+
B.current.isResizing ? B.current.onDividerResize?.(B.current.index, Math.max(0, B.current.startSize + te), B.current.startSize) : Math.abs(te) > 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 + te))), L.stopPropagation(), L.preventDefault();
|
|
3236
3247
|
} }), S = k(() => {
|
|
3237
3248
|
P?.(r);
|
|
3238
3249
|
}, [r]);
|
|
3239
3250
|
if (!le) return;
|
|
3240
3251
|
const h = a({ bounds: le, orientation: n, view: o, index: r, disabled: i, disabledResize: l, onAutoFit: S, onPointerDown: T, ...R }, t);
|
|
3241
3252
|
if (!h) return;
|
|
3242
|
-
const { getPortalContainer: J } =
|
|
3253
|
+
const { getPortalContainer: J } = bi();
|
|
3243
3254
|
let K = null;
|
|
3244
|
-
return oe && oe.isResizing && oe.index === r && (K = qr(q("div", { style: { position: "absolute", cursor:
|
|
3255
|
+
return oe && oe.isResizing && oe.index === r && (K = qr(q("div", { style: { position: "absolute", cursor: I ? Di : zi, left: 0, top: 0, width: "100%", height: "100%" } }), J(), "divider:" + r)), Ht(wn, { children: [K, q("div", { className: En("header-divider-anchor"), style: { position: "absolute", pointerEvents: "auto", top: `${I ? le.y : X}px`, left: `${I ? X : le.x}px`, width: (I ? 0 : le.width - 1) + "px", height: (I ? le.height - 1 : 0) + "px", display: "flex" }, tabIndex: -1, children: h })] });
|
|
3245
3256
|
}));
|
|
3246
3257
|
class cs {
|
|
3247
3258
|
naturalDimensions(t, n = {}) {
|
|
@@ -3262,15 +3273,15 @@ class cs {
|
|
|
3262
3273
|
}
|
|
3263
3274
|
}
|
|
3264
3275
|
const as = (e = void 0) => Object.freeze({ clean: e, dirty: void 0, editMode: !1 }), ds = as(), ys = At(Ut((e, t) => {
|
|
3265
|
-
const { editState: n = ds, defaultTextStyle: o, onStartEdit: r, onChangeEdit: i, onSubmitEdit: l, onCancelEdit: s, onDoneEdit: a, containerBounds: d, setNaturalDimensions: g, onNavigate: m, textProperties: f, style: x, autoFocus: _, ...
|
|
3276
|
+
const { editState: n = ds, defaultTextStyle: o, onStartEdit: r, onChangeEdit: i, onSubmitEdit: l, onCancelEdit: s, onDoneEdit: a, containerBounds: d, setNaturalDimensions: g, onNavigate: m, textProperties: f, style: x, autoFocus: _, ...M } = e, R = G(null), { width: ae = 0 } = d ?? {}, [P, I] = Ze(() => n);
|
|
3266
3277
|
st(() => {
|
|
3267
|
-
|
|
3278
|
+
I(n);
|
|
3268
3279
|
}, [n]);
|
|
3269
|
-
const z = f?.align || "left", le = f?.vAlign || "middle", B = f?.fill || "#040404", oe = f?.wrap || "wrap",
|
|
3280
|
+
const z = f?.align || "left", le = f?.vAlign || "middle", B = f?.fill || "#040404", oe = f?.wrap || "wrap", be = f?.fontFamily || "Calibri", N = f?.fontSize || 11, H = f?.fontWeight || 400, X = f?.fontStyle || "normal", T = P.dirty ?? P.clean ?? "";
|
|
3270
3281
|
let S = 2;
|
|
3271
3282
|
const h = 96 * N / 72, J = 1.2 * h;
|
|
3272
3283
|
le === "right" && (S += 1);
|
|
3273
|
-
const K = _e(() => new cs().naturalDimensions(T, { maxWidth: oe === "wrap" ? ae - S : void 0, lineHeight: `${J}px`, paintableText: { fontStyle: X, wrap: oe, letterSpacing: -0.25 } }), [T, oe, S, h,
|
|
3284
|
+
const K = _e(() => new cs().naturalDimensions(T, { maxWidth: oe === "wrap" ? ae - S : void 0, lineHeight: `${J}px`, paintableText: { fontStyle: X, wrap: oe, letterSpacing: -0.25 } }), [T, oe, S, h, be, H, X, g, ae]), L = D(() => K.maxLineHeight ? K.maxLineHeight + "px" : "1.2", [K]), [U, ee] = Ze(L);
|
|
3274
3285
|
tn(() => {
|
|
3275
3286
|
ee(L());
|
|
3276
3287
|
}, [d, K]), tn(() => {
|
|
@@ -3279,45 +3290,45 @@ const as = (e = void 0) => Object.freeze({ clean: e, dirty: void 0, editMode: !1
|
|
|
3279
3290
|
const te = k(i, [i]), Y = k((E) => {
|
|
3280
3291
|
if (P.dirty === E) return;
|
|
3281
3292
|
const Me = { ...P };
|
|
3282
|
-
Me.dirty = E, R.current,
|
|
3293
|
+
Me.dirty = E, R.current, I(Me), te?.(Me);
|
|
3283
3294
|
}, [P]), He = k((E) => {
|
|
3284
3295
|
if (P.editMode === E) return;
|
|
3285
3296
|
const Me = { ...P };
|
|
3286
|
-
Me.editMode = E,
|
|
3287
|
-
}, [P]),
|
|
3297
|
+
Me.editMode = E, I(Me), te?.(Me);
|
|
3298
|
+
}, [P]), Ve = k(() => {
|
|
3288
3299
|
try {
|
|
3289
3300
|
return l?.(P), a?.(), !0;
|
|
3290
3301
|
} catch {
|
|
3291
3302
|
return !1;
|
|
3292
3303
|
}
|
|
3293
3304
|
}, [l, P]), Ne = k(() => {
|
|
3294
|
-
|
|
3305
|
+
I(n), s?.(), a?.();
|
|
3295
3306
|
}, [s, n]), at = k((E) => {
|
|
3296
3307
|
if (!R.current) return;
|
|
3297
|
-
if (E.isDefaultPrevented(), !(E.isTrusted || E.nativeEvent.ctrlKey || E.nativeEvent.metaKey || E.nativeEvent.altKey || E.nativeEvent.isComposing) &&
|
|
3308
|
+
if (E.isDefaultPrevented(), !(E.isTrusted || E.nativeEvent.ctrlKey || E.nativeEvent.metaKey || E.nativeEvent.altKey || E.nativeEvent.isComposing) && Ii.indexOf(E.nativeEvent.key) !== -1) {
|
|
3298
3309
|
const ue = { ...P };
|
|
3299
|
-
return ue.dirty = E.nativeEvent.key === "Backspace" ? "" : (ue.dirty ?? "") + E.key,
|
|
3310
|
+
return ue.dirty = E.nativeEvent.key === "Backspace" ? "" : (ue.dirty ?? "") + E.key, I(ue), te?.(ue), void E.preventDefault();
|
|
3300
3311
|
}
|
|
3301
3312
|
const Me = E.nativeEvent.shiftKey;
|
|
3302
|
-
if (E.which ===
|
|
3313
|
+
if (E.which === nl) return E.preventDefault(), void Ne();
|
|
3303
3314
|
if (E.which === ol) return He(!0), void E.preventDefault();
|
|
3304
|
-
if (E.which ===
|
|
3315
|
+
if (E.which === si && (E.preventDefault(), Ve() && m?.(Me ? it : lt)), E.which === li) return E.preventDefault(), void (Ve() && m?.(Me ? ot : Ke));
|
|
3305
3316
|
if (!P.editMode) {
|
|
3306
3317
|
let ue = null;
|
|
3307
3318
|
switch (E.which) {
|
|
3308
|
-
case
|
|
3319
|
+
case ci:
|
|
3309
3320
|
ue = ot;
|
|
3310
3321
|
break;
|
|
3311
|
-
case
|
|
3322
|
+
case di:
|
|
3312
3323
|
ue = Ke;
|
|
3313
3324
|
break;
|
|
3314
|
-
case
|
|
3325
|
+
case ai:
|
|
3315
3326
|
ue = it;
|
|
3316
3327
|
break;
|
|
3317
|
-
case
|
|
3328
|
+
case ui:
|
|
3318
3329
|
ue = lt;
|
|
3319
3330
|
}
|
|
3320
|
-
if (ue) return void
|
|
3331
|
+
if (ue) return void Ve();
|
|
3321
3332
|
}
|
|
3322
3333
|
}, [P, m]), [Se, Ye] = Ze(!_);
|
|
3323
3334
|
st(() => {
|
|
@@ -3331,13 +3342,13 @@ const as = (e = void 0) => Object.freeze({ clean: e, dirty: void 0, editMode: !1
|
|
|
3331
3342
|
}
|
|
3332
3343
|
R.current?.setSelectionRange(Me.start, Me.end, Me.direction);
|
|
3333
3344
|
const ue = { ...n, editMode: E?.editMode ?? !1 };
|
|
3334
|
-
E?.text !== void 0 && (ue.dirty = E.text), ue.editMode === n.editMode && ue.dirty === n.dirty || (
|
|
3335
|
-
}, submitEdit: () =>
|
|
3345
|
+
E?.text !== void 0 && (ue.dirty = E.text), ue.editMode === n.editMode && ue.dirty === n.dirty || (I(ue), te?.(ue));
|
|
3346
|
+
}, submitEdit: () => Ve(), cancelEdit() {
|
|
3336
3347
|
Ne();
|
|
3337
3348
|
}, autoFocus() {
|
|
3338
3349
|
R.current?.focus();
|
|
3339
3350
|
}, getLineHeight: () => K?.maxLineHeight ?? J, dispatchEvent: (E) => R.current.dispatchEvent(E) }), [n, r]);
|
|
3340
|
-
return q("div", { ref: $, ...
|
|
3351
|
+
return q("div", { ref: $, ...M, style: { background: "transparent", display: "flex", flexGrow: 1, alignSelf: "center", height: K.height, maxWidth: "100%", maxHeight: "100%", ...x }, children: q("textarea", { spellCheck: "false", ref: R, value: T, autoFocus: !1, disabled: Se, name: "cell-editor", autoComplete: "off", autoCapitalize: "off", style: { flex: "1 1 100%", position: "relative", fontSize: `${h}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: oe === "wrap" ? "break-spaces" : "pre", wordWrap: "break-word" }, onChange: (E) => {
|
|
3341
3352
|
Y(E.target.value);
|
|
3342
3353
|
}, onDoubleClick: (E) => {
|
|
3343
3354
|
E.isTrusted;
|
|
@@ -3349,21 +3360,21 @@ const as = (e = void 0) => Object.freeze({ clean: e, dirty: void 0, editMode: !1
|
|
|
3349
3360
|
return q("div", { style: { padding: "2px 4px", fontFamily: "Calibri", letterSpacing: -0.25, lineHeight: 1.2, fontSize: s?.fontSize || 1056 / 72, ...s }, ...a, children: t });
|
|
3350
3361
|
});
|
|
3351
3362
|
export {
|
|
3352
|
-
|
|
3363
|
+
Oi as BaseGrid,
|
|
3353
3364
|
ys as DefaultCellEditor,
|
|
3354
3365
|
bs as DefaultCellRenderer,
|
|
3355
3366
|
ls as DefaultHeaderDivider,
|
|
3356
|
-
|
|
3357
|
-
|
|
3367
|
+
Ti as FillHandle,
|
|
3368
|
+
Li as Grid,
|
|
3358
3369
|
vs as HeaderDivider,
|
|
3359
3370
|
is as HeaderRenderer,
|
|
3360
3371
|
xs as RESET_SCROLL_EVENTS_DEBOUNCE_INTERVAL,
|
|
3361
3372
|
en as SELECTION_CLIP_INSETS,
|
|
3362
|
-
|
|
3373
|
+
Ii as STANDARD_KEY_CHARS,
|
|
3363
3374
|
jr as SVGLine,
|
|
3364
3375
|
Yl as SVGRect,
|
|
3365
3376
|
rs as ScrollableGrid,
|
|
3366
|
-
|
|
3377
|
+
Ci as Selection,
|
|
3367
3378
|
Go as TouchSelectHandle,
|
|
3368
3379
|
Xl as defaultSelectionRenderer,
|
|
3369
3380
|
as as getDefaultStringEditState,
|