@sheetxl/grid-react 0.3.0 → 0.3.2
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/LICENSE.md +11 -11
- package/README.md +8 -8
- package/browser/cjs/index.cjs +6 -11
- package/browser/esm/index.mjs +197 -209
- package/licenses/dependencies.txt +22 -22
- package/node/assets/style.css +1 -1
- package/node/esm/index.mjs +93 -105
- package/package.json +3 -6
package/node/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/grid-react - Grid - Advanced data grid component for React - v0.3.
|
|
2
|
+
* @license @sheetxl/grid-react - Grid - Advanced data grid component for React - v0.3.2
|
|
3
3
|
*
|
|
4
4
|
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
@@ -12,15 +12,9 @@ import { mergeRefs as m } from "react-merge-refs";
|
|
|
12
12
|
import { createRoot as x } from "react-dom/client";
|
|
13
13
|
import { unstable_batchedUpdates as y, createPortal as v } from "react-dom";
|
|
14
14
|
import b from "tiny-invariant";
|
|
15
|
-
/**
|
|
16
|
-
* @license @sheetxl/utils - Utils - Utilities used by most SheetXL components. - v0.3.0
|
|
17
|
-
*
|
|
18
|
-
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
19
|
-
* License: The license can be found at https://www.sheetxl.com/license.
|
|
20
|
-
*/
|
|
21
15
|
const S = "up", E = "down", _ = "left", I = "right", C = "tl", M = "t", T = "l", k = "c", R = "text/html", P = "text/plain", O = "image/png", L = Object.freeze({ left: 0, top: 0 }), D = Object.freeze({ left: 0, top: 0, bottom: 0, right: 0 }), z = Object.freeze({ x: 0, y: 0, width: 0, height: 0 });
|
|
22
16
|
Object.freeze(Object.defineProperty({ __proto__: null, EmptyBounds: z, EmptyRect: D, EmptyTopLeft: L }, Symbol.toStringTag, { value: "Module" }));
|
|
23
|
-
const A = "column", $ = "row", B = Object.freeze({ colIndex: 0, rowIndex: 0 }), F = Object.freeze({ colStart: 0, rowStart: 0, colEnd: 0, rowEnd: 0 }), j = (e5, t2) => e5.colStart === t2.colStart ? e5.rowStart - t2.rowStart : e5.colStart - t2.colStart, V = (e5, t2) => e5.rowStart === t2.rowStart ? e5.colStart - t2.colStart : e5.rowStart - t2.rowStart, W = (e5, t2) => e5.rowEnd === t2.rowEnd ? t2.colEnd - e5.colEnd : t2.rowEnd - e5.rowEnd, H = (e5, t2) => e5.colEnd === t2.colEnd ? t2.rowEnd - e5.rowEnd : t2.colEnd - e5.colEnd, N = (e5, t2) => e5.colIndex === t2.colIndex ? e5.rowIndex - t2.rowIndex : e5.colIndex - t2.colIndex, U = (e5, t2) => e5.rowIndex === t2.rowIndex ? e5.colIndex - t2.colIndex : e5.rowIndex - t2.rowIndex,
|
|
17
|
+
const A = "column", $ = "row", B = Object.freeze({ colIndex: 0, rowIndex: 0 }), F = Object.freeze({ colStart: 0, rowStart: 0, colEnd: 0, rowEnd: 0 }), j = (e5, t2) => e5.colStart === t2.colStart ? e5.rowStart - t2.rowStart : e5.colStart - t2.colStart, V = (e5, t2) => e5.rowStart === t2.rowStart ? e5.colStart - t2.colStart : e5.rowStart - t2.rowStart, W = (e5, t2) => e5.rowEnd === t2.rowEnd ? t2.colEnd - e5.colEnd : t2.rowEnd - e5.rowEnd, H = (e5, t2) => e5.colEnd === t2.colEnd ? t2.rowEnd - e5.rowEnd : t2.colEnd - e5.colEnd, N = (e5, t2) => e5.colIndex === t2.colIndex ? e5.rowIndex - t2.rowIndex : e5.colIndex - t2.colIndex, U = (e5, t2) => e5.rowIndex === t2.rowIndex ? e5.colIndex - t2.colIndex : e5.rowIndex - t2.rowIndex, q = (e5 = $, t2 = false) => t2 ? e5 !== A ? W : H : e5 !== A ? V : j, K = (e5, t2) => e5 === t2 || !(!e5 || !t2) && e5.rowIndex === t2.rowIndex && e5.colIndex === t2.colIndex, Y = (e5, t2) => e5 === t2 || !(!e5 || !t2) && e5.rowStart === t2.rowStart && e5.rowEnd === t2.rowEnd && e5.colStart === t2.colStart && e5.colEnd === t2.colEnd, X = (e5, t2) => !(!e5 || !t2 || e5.colStart > t2.colEnd || t2.colStart > e5.colEnd || e5.rowStart > t2.rowEnd || t2.rowStart > e5.rowEnd), G = (e5, t2) => {
|
|
24
18
|
if (e5 === t2) return true;
|
|
25
19
|
if (!e5 || !t2) return false;
|
|
26
20
|
if (e5.length !== t2.length) return false;
|
|
@@ -49,7 +43,7 @@ function te(e5, t2 = 2, n2, o2 = $, r2) {
|
|
|
49
43
|
if (t2 <= 0 || e5.length <= 1) return i2;
|
|
50
44
|
let l2 = o2 === A, s2 = 0, c2 = false;
|
|
51
45
|
do {
|
|
52
|
-
const e6 = i2.sort(
|
|
46
|
+
const e6 = i2.sort(q(l2 ? $ : A));
|
|
53
47
|
i2 = [], i2.push(e6[0]);
|
|
54
48
|
const t3 = e6.length;
|
|
55
49
|
let a2 = 0, d2 = e6[0], u2 = d2.colStart, h2 = d2.rowStart, f2 = d2.colEnd, p2 = d2.rowEnd;
|
|
@@ -92,7 +86,7 @@ const ne = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: B,
|
|
|
92
86
|
const h2 = t2 ? s2 : c2, f2 = t2 ? c2 : s2;
|
|
93
87
|
o2 = { colStart: h2, rowStart: f2, colEnd: h2, rowEnd: f2 }, u2 && (o2.value = a2), i2 = s2, l2 = c2, r2 = a2;
|
|
94
88
|
}, done: (e6) => (o2 && (n2.push(o2), o2 = null), e6 ? te(n2, 3, true === e6 ? ee : e6, t2 ? A : $, Q) : n2) };
|
|
95
|
-
}, createRangeComparator:
|
|
89
|
+
}, createRangeComparator: q, defaultRange: (e5, t2, n2) => e5 ? n2 ? (n2.colStart = e5.colStart ?? t2.colStart, n2.rowStart = e5.rowStart ?? t2.rowStart, n2.colEnd = e5.colEnd ?? t2.colEnd, n2.rowEnd = e5.rowEnd ?? t2.rowEnd, n2) : { colStart: e5.colStart ?? t2.colStart, rowStart: e5.rowStart ?? t2.rowStart, colEnd: e5.colEnd ?? t2.colEnd, rowEnd: e5.rowEnd ?? t2.rowEnd } : t2, extendRangeToIntersectingRanges: J, extendRangeToUnionRanges: (e5, t2) => {
|
|
96
90
|
if (!t2 || 0 === t2.length) return e5;
|
|
97
91
|
let n2 = e5, o2 = null;
|
|
98
92
|
for (; !Y(n2, o2); ) o2 = n2, n2 = J(o2, t2);
|
|
@@ -109,7 +103,7 @@ const ne = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: B,
|
|
|
109
103
|
const o2 = Math.max(e5.colStart, t2.colStart), r2 = Math.max(e5.rowStart, t2.rowStart), i2 = Math.min(e5.colEnd, t2.colEnd), l2 = Math.min(e5.rowEnd, t2.rowEnd);
|
|
110
104
|
let s2 = n2;
|
|
111
105
|
return s2 ? (s2.colStart = o2, s2.rowStart = r2, s2.colEnd = i2, s2.rowEnd = l2) : s2 = { colStart: o2, rowStart: r2, colEnd: i2, rowEnd: l2 }, s2;
|
|
112
|
-
}, isCellWithinRange: (e5, t2) => !(!e5 || !t2 || e5.rowIndex < t2.rowStart || e5.rowIndex > t2.rowEnd || e5.colIndex < t2.colStart || e5.colIndex > t2.colEnd), isEqualCells:
|
|
106
|
+
}, isCellWithinRange: (e5, t2) => !(!e5 || !t2 || e5.rowIndex < t2.rowStart || e5.rowIndex > t2.rowEnd || e5.colIndex < t2.colStart || e5.colIndex > t2.colEnd), isEqualCells: K, isEqualRanges: Y, isEqualRangesArrays: G, isEqualSelectionCoords: (e5, t2) => e5 === t2 || !(!e5 || !t2) && e5.rangeIndex === t2.rangeIndex && !!K(e5.cell, t2.cell) && G(e5.ranges, t2.ranges), isRangeWithinRange: (e5, t2) => !(e5.rowStart < t2.rowStart || e5.rowEnd > t2.rowEnd || e5.colStart < t2.colStart || e5.colEnd > t2.colEnd), isRangesIntersect: X, isSingleCell: (e5) => !!e5 && e5.rowEnd === e5.rowStart && e5.colStart === e5.colEnd, isValidRange: (e5) => !(!e5 || "number" != typeof e5.colStart || e5.colStart < 0 || "number" != typeof e5.colEnd || e5.colEnd < e5.colStart || "number" != typeof e5.rowStart || e5.rowStart < 0 || "number" != typeof e5.rowEnd || e5.rowEnd < e5.rowStart), mergeRangedValues: te, rowFirstCellComparator: U, rowFirstRangeComparator: V, sanitizeRange: (e5) => e5 ? { colStart: e5.colIndex ?? e5.colStart ?? 0, rowStart: e5.rowIndex ?? e5.rowStart ?? 0, colEnd: e5.colIndex ?? e5.colEnd ?? 0, rowEnd: e5.rowIndex ?? e5.rowEnd ?? 0 } : null, translateRange: (e5, t2 = -e5.rowStart, n2 = -e5.colStart, o2) => o2 ? (o2.colStart = e5.colStart + n2, o2.rowStart = e5.rowStart + t2, o2.colEnd = e5.colEnd + n2, o2.rowEnd = e5.rowEnd + t2, o2) : { colStart: e5.colStart + n2, rowStart: e5.rowStart + t2, colEnd: e5.colEnd + n2, rowEnd: e5.rowEnd + t2 }, unionRanges: Z, unionRangesArrays: (e5, t2, n2) => {
|
|
113
107
|
if (!e5 || 0 === e5.length) return null;
|
|
114
108
|
if (1 === e5.length && !t2) return e5[0];
|
|
115
109
|
let o2 = e5[0];
|
|
@@ -293,7 +287,7 @@ const Ce = (e5, t2 = false) => (document.hasFocus() || t2) && (e5 === document.a
|
|
|
293
287
|
}, findNextStep: (e5, t2 = true, n2 = 15, o2 = 10, r2 = 400) => {
|
|
294
288
|
const i2 = Math.max(e5 - o2, 0) + (t2 ? 1 : -1);
|
|
295
289
|
return Math.min(r2, Math[t2 ? "ceil" : "floor"](i2 / n2) * n2 + o2);
|
|
296
|
-
},
|
|
290
|
+
}, getDPI: () => {
|
|
297
291
|
let e5 = 1;
|
|
298
292
|
return "object" == typeof window && (e5 = window.devicePixelRatio || 1), e5;
|
|
299
293
|
}, getFromPath: (e5, t2) => {
|
|
@@ -619,7 +613,7 @@ const We = async (e5, t2 = R) => new Promise(async (n2, o2) => {
|
|
|
619
613
|
console.warn("Can't parse html from clipboard.");
|
|
620
614
|
}
|
|
621
615
|
return o2;
|
|
622
|
-
}, Ne = "clipboard-uuid", Ue = "web text/uuid",
|
|
616
|
+
}, Ne = "clipboard-uuid", Ue = "web text/uuid", qe = (e5) => `<div style="display:none" ${Ne}="${e5}"/>`, Ke = (e5, t2) => {
|
|
623
617
|
let n2 = null;
|
|
624
618
|
try {
|
|
625
619
|
const o2 = new DOMParser().parseFromString(t2, R);
|
|
@@ -697,13 +691,13 @@ class Xe {
|
|
|
697
691
|
t2._state = { uuid: o2, ref: e5.ref, items: n2 }, t2.dispatchEvent(new Event("clipboardwrite")), t2.dispatchEvent(new Event("clipboardchange"));
|
|
698
692
|
};
|
|
699
693
|
await je("clipboard-write", async () => {
|
|
700
|
-
await Fe(), o2 && 0 === r2.length && (r2.push(new ClipboardItem({ [Ue]: new Blob([o2], { type: Ue }) })), r2.push(new ClipboardItem({ [R]: new Blob([
|
|
694
|
+
await Fe(), o2 && 0 === r2.length && (r2.push(new ClipboardItem({ [Ue]: new Blob([o2], { type: Ue }) })), r2.push(new ClipboardItem({ [R]: new Blob([qe(o2)], { type: R }) })));
|
|
701
695
|
for (let e6 = 0; e6 < Math.min(1, r2.length); e6++) {
|
|
702
696
|
const t3 = r2[e6];
|
|
703
697
|
let i3 = t3.types.indexOf(R), l2 = null;
|
|
704
698
|
if (-1 !== i3) {
|
|
705
699
|
const e7 = await t3.getType(R);
|
|
706
|
-
l2 = await ke(e7), l2 && (l2 =
|
|
700
|
+
l2 = await ke(e7), l2 && (l2 = Ke(o2, l2));
|
|
707
701
|
}
|
|
708
702
|
if (!l2 && t3.types.includes(P)) {
|
|
709
703
|
const e7 = await t3.getType(P);
|
|
@@ -716,7 +710,7 @@ class Xe {
|
|
|
716
710
|
const e7 = await t3.getType(O), n3 = Te(await e7.arrayBuffer());
|
|
717
711
|
l2 = `<div ${Ne}="${o2}"><img src="${Re + n3}"/></div>`;
|
|
718
712
|
}
|
|
719
|
-
!l2 && o2 && (l2 =
|
|
713
|
+
!l2 && o2 && (l2 = qe(o2));
|
|
720
714
|
const s2 = new Blob([l2 ?? ""], { type: R }), c2 = {};
|
|
721
715
|
for (let e7 = 0; e7 < t3.types.length; e7++) {
|
|
722
716
|
const n3 = t3.types[e7];
|
|
@@ -844,12 +838,6 @@ const ft = Object.freeze(Object.defineProperty({ __proto__: null, deviceType: ut
|
|
|
844
838
|
}
|
|
845
839
|
return r2;
|
|
846
840
|
};
|
|
847
|
-
/**
|
|
848
|
-
* @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.3.0
|
|
849
|
-
*
|
|
850
|
-
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
851
|
-
* License: The license can be found at https://www.sheetxl.com/license.
|
|
852
|
-
*/
|
|
853
841
|
Object.freeze(Object.defineProperty({ __proto__: null, getScrollTo: Pt }, Symbol.toStringTag, { value: "Module" }));
|
|
854
842
|
const Ot = r(a((n2, o2) => {
|
|
855
843
|
const { offset: r2 = 0, totalSize: c2 = 0, viewportSize: a2 = 0, style: u2, className: f2, orientation: p2 = Mt.Vertical, onScrollOffset: m2, onScroll: x2, showCustomScrollButtons: y2 = false, scrollButtonIncrement: v2 = 200, scrollButtonInitialRepeatDelay: b2 = 260, scrollButtonAdditionalRepeatDelay: S2 = 120, createScrollStartButton: E2 = kt, createScrollEndButton: _2 = Rt, ...I2 } = n2, C2 = Tt(x2, [x2]), M2 = l(null), [T2, { width: k2, height: R2 }] = w(), [P2, { width: O2, height: L2 }] = w(), D2 = p2 === Mt.Vertical, z2 = D2 ? "top" : "left", A2 = D2 ? "scrollTop" : "scrollLeft", $2 = D2 ? R2 : k2, B2 = D2 ? L2 : O2, [F2, j2] = h(null);
|
|
@@ -873,25 +861,25 @@ const Ot = r(a((n2, o2) => {
|
|
|
873
861
|
const e5 = H2.current;
|
|
874
862
|
H2.current = null, r2 !== e5 && (M2.current[A2] = r2);
|
|
875
863
|
}, [r2, A2]);
|
|
876
|
-
const U2 = l(null),
|
|
877
|
-
U2.current && (clearTimeout(U2.current), U2.current = null,
|
|
864
|
+
const U2 = l(null), q2 = l(null), K2 = i(() => {
|
|
865
|
+
U2.current && (clearTimeout(U2.current), U2.current = null, q2.current = null);
|
|
878
866
|
}, []), Y2 = i((e5, t2, n3, o3 = b2) => {
|
|
879
|
-
|
|
880
|
-
const t3 = n3 ? V2(
|
|
881
|
-
t3 !==
|
|
867
|
+
q2.current = e5, U2.current = setTimeout(() => {
|
|
868
|
+
const t3 = n3 ? V2(q2.current || e5) : W2(q2.current || e5);
|
|
869
|
+
t3 !== q2.current ? Y2(t3, false, n3, S2) : K2();
|
|
882
870
|
}, t2 ? 0 : o3);
|
|
883
|
-
}, [V2, W2,
|
|
884
|
-
s(() => () =>
|
|
871
|
+
}, [V2, W2, K2]);
|
|
872
|
+
s(() => () => K2(), [K2]);
|
|
885
873
|
const X2 = r2, G2 = d(() => {
|
|
886
874
|
if (!y2) return null;
|
|
887
|
-
const e5 = { orientation: p2, disabled: Math.floor(X2) <= 0 || 0 === Math.floor(B2 - $2), onMouseUp:
|
|
875
|
+
const e5 = { orientation: p2, disabled: Math.floor(X2) <= 0 || 0 === Math.floor(B2 - $2), onMouseUp: K2, onMouseLeave: K2, onMouseDown: () => Y2(X2, true, true) };
|
|
888
876
|
return E2?.(e5);
|
|
889
877
|
}, [y2, p2, X2, F2, B2, $2]), Z2 = d(() => {
|
|
890
878
|
if (!y2) return null;
|
|
891
|
-
const e5 = { orientation: p2, disabled: Math.floor(B2 - $2) <= Math.ceil(X2), onMouseUp:
|
|
879
|
+
const e5 = { orientation: p2, disabled: Math.floor(B2 - $2) <= Math.ceil(X2), onMouseUp: K2, onMouseLeave: K2, onMouseDown: () => Y2(X2, true, false) };
|
|
892
880
|
return _2?.(e5);
|
|
893
881
|
}, [y2, p2, X2, F2, B2, $2]);
|
|
894
|
-
return t("div", { ref: o2, style: { display: "flex", flex: "1", flexDirection: D2 ? "column" : "row", padding: "0", ...u2 }, className: g("_sheetxl-
|
|
882
|
+
return t("div", { ref: o2, style: { display: "flex", flex: "1", flexDirection: D2 ? "column" : "row", padding: "0", ...u2 }, className: g("_sheetxl-scrollbar_18qzf_11", f2), ...I2, children: [G2, e("div", { className: "pseudo-scrollbar", style: { flex: "1 1 100%", display: "flex", boxSizing: "content-box", flexDirection: D2 ? "column" : "row", justifyContent: "center", alignItems: "center" }, ref: T2, children: e("div", { tabIndex: -1, style: { flex: "1 1 100%", overflowY: D2 ? "scroll" : "hidden", overflowX: D2 ? "hidden" : "scroll", position: "relative", willChange: "transform" }, onScroll: N2, ref: M2, children: e("div", { ref: P2, style: { position: "absolute", height: D2 ? c2 - a2 + (R2 ?? 0) : 1, width: D2 ? 1 : c2 - a2 + (k2 ?? 0) }, className: "scrollbar-viewport" }) }) }), Z2] });
|
|
895
883
|
}));
|
|
896
884
|
Ot.displayName = "Scrollbar";
|
|
897
885
|
let Lt = Date.now, Dt = {}, zt = 1;
|
|
@@ -1070,8 +1058,8 @@ const Ut = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProper
|
|
|
1070
1058
|
n2 = true, e5.stopPropagation();
|
|
1071
1059
|
}, isPropagationStopped: () => n2, persist: () => {
|
|
1072
1060
|
}, timeStamp: e5.timeStamp, type: e5.type };
|
|
1073
|
-
}, detectIt: Nt, focusableNodeNames: Wt, toPrettyKeyCode: (e5) => "BracketLeft" === e5 ? "[" : "BracketRight" === e5 ? "]" : Me.camelToPrettyCase(e5) }, Symbol.toStringTag, { value: "Module" })),
|
|
1074
|
-
function
|
|
1061
|
+
}, detectIt: Nt, focusableNodeNames: Wt, toPrettyKeyCode: (e5) => "BracketLeft" === e5 ? "[" : "BracketRight" === e5 ? "]" : Me.camelToPrettyCase(e5) }, Symbol.toStringTag, { value: "Module" })), qt = [];
|
|
1062
|
+
function Kt(e5, t2, n2 = qt) {
|
|
1075
1063
|
const o2 = l(null);
|
|
1076
1064
|
return c(e5, () => {
|
|
1077
1065
|
if (!o2.current) return;
|
|
@@ -1086,7 +1074,7 @@ function qt(e5, t2, n2 = Kt) {
|
|
|
1086
1074
|
}, n2), o2;
|
|
1087
1075
|
}
|
|
1088
1076
|
const Yt = (t2) => e(Ot, { ...t2 }), Xt = ({ width: t2, height: n2 }) => e("div", { className: "corner", style: { minWidth: `${t2}px`, width: `${t2}px`, minHeight: `${n2}px`, height: `${n2}px` } }), Gt = r(a((o2, r2) => {
|
|
1089
|
-
const { children: c2, viewport: a2, onScrollViewport: u2, showHorizontalScrollbar: h2 = true, showVerticalScrollbar: f2 = true, createScrollCorner: p2 = Xt, createHorizontalScrollbar: g2 = Yt, createVerticalScrollbar: m2 = Yt, style: x2, touchElement: y2, disableTouch: v2, ...b2 } = o2, S2 = Tt(u2, [u2]), E2 =
|
|
1077
|
+
const { children: c2, viewport: a2, onScrollViewport: u2, showHorizontalScrollbar: h2 = true, showVerticalScrollbar: f2 = true, createScrollCorner: p2 = Xt, createHorizontalScrollbar: g2 = Yt, createVerticalScrollbar: m2 = Yt, style: x2, touchElement: y2, disableTouch: v2, ...b2 } = o2, S2 = Tt(u2, [u2]), E2 = Kt(r2, () => ({ isScrollPane: () => true }), []), _2 = l(null);
|
|
1090
1078
|
s(() => {
|
|
1091
1079
|
_2.current && (_2.current.__scrollTop === a2?.top && _2.current.__scrollLeft !== !a2?.left || _2.current?.scrollTo(a2?.left, a2?.top, false));
|
|
1092
1080
|
}, [a2?.left, a2?.top, y2]);
|
|
@@ -1137,7 +1125,7 @@ function Qt() {
|
|
|
1137
1125
|
const e6 = document.fullscreenElement;
|
|
1138
1126
|
if (!e6) return;
|
|
1139
1127
|
let t2 = e6.querySelector(".fullscreen-portal-root");
|
|
1140
|
-
t2 || (t2 = document.createElement("div"), t2.className = "fullscreen-portal-root _fullscreen-portal-
|
|
1128
|
+
t2 || (t2 = document.createElement("div"), t2.className = "fullscreen-portal-root _fullscreen-portal-root_5qk7s_7", e6.appendChild(t2));
|
|
1141
1129
|
}
|
|
1142
1130
|
return Jt++, e5(), document.addEventListener("fullscreenchange", e5), () => {
|
|
1143
1131
|
document.removeEventListener("fullscreenchange", e5), Jt--, Jt <= 0 && (document.querySelectorAll(".fullscreen-portal-root").forEach((e6) => {
|
|
@@ -1293,32 +1281,32 @@ r(a((n2, r2) => {
|
|
|
1293
1281
|
s(() => {
|
|
1294
1282
|
B2(un(f2, null === u2));
|
|
1295
1283
|
}, [f2, u2]);
|
|
1296
|
-
const [F2, { width: j2, height: V2 }] = w(), [W2, { width: H2, height: N2 }] = w(), U2 = "row" === a2 ? H2 : N2,
|
|
1284
|
+
const [F2, { width: j2, height: V2 }] = w(), [W2, { width: H2, height: N2 }] = w(), U2 = "row" === a2 ? H2 : N2, q2 = "row" === a2 ? j2 : V2, K2 = d(() => ((e5, t2, n3, o2) => {
|
|
1297
1285
|
const r3 = [null, null], i3 = [null, null];
|
|
1298
1286
|
if (e5 || (e5 = { percent: null === o2.fixedPaneOffset ? 50 : null, pixels: null === o2.fixedPaneOffset ? null : 0 }), 0 === t2) return null != e5?.pixels ? 1 !== o2.fixedPaneOffset ? (r3[0] = e5?.pixels, i3[1] = 100) : (r3[1] = e5?.pixels - n3, i3[0] = 100) : null != e5?.percent && (1 !== o2.fixedPaneOffset ? (i3[0] = e5?.percent, i3[1] = 100 - e5?.percent) : (i3[1] = e5?.percent, i3[0] = 100 - e5?.percent)), { percents: i3, pixels: r3, minBefore: dn(o2.minBefore, true), maxBefore: dn(o2.maxBefore, true), minAfter: dn(o2.minAfter), maxAfter: dn(o2.maxAfter) };
|
|
1299
1287
|
let l2 = an(e5, t2, 1 !== o2.fixedPaneOffset), s2 = t2 - n3, c3 = an(o2.minBefore, s2, true) ?? 0, a3 = an(o2.maxBefore, s2, true) ?? s2, d2 = 0, u3 = 0, h2 = 0, f3 = s2;
|
|
1300
1288
|
d2 = (an(o2.maxAfter, t2, false) ?? n3) - n3, u3 = an(o2.minAfter, t2, false) ?? t2, h2 = Math.max(c3, d2), f3 = Math.min(a3, u3), l2 = Math.max(h2, Math.min(l2, f3)), u3 = Math.min(s2 - l2, an(o2.maxAfter, s2 - l2, true) ?? s2), d2 = Math.min(s2 - l2, an(o2.minAfter, s2 - l2, true) ?? s2), r3[0] = l2, r3[1] = s2 - r3[0];
|
|
1301
1289
|
const p3 = Math.max(0, Math.min(100, l2 / s2 * 100));
|
|
1302
1290
|
return i3[0] = p3, i3[1] = 100 - i3[0], { percents: i3, pixels: r3, minBefore: `${c3}px`, minAfter: `${d2}px`, maxBefore: `${r3[0]}px`, maxAfter: `${r3[1]}px` };
|
|
1303
|
-
})($2,
|
|
1291
|
+
})($2, q2, U2, z2), [z2, $2, q2, U2, a2]), [Y2, X2] = h(false), G2 = Tt(C2, [C2]), Z2 = Tt(M2, [M2]), J2 = Tt(T2, [T2]), Q2 = l(null), ee2 = l(null), te2 = l(null), { style: ne2, className: oe2, ...re2 } = R2, ie2 = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", display: "flex", overflow: "hidden", ...ne2 }, { className: le2, style: se2, ...ce2 } = P2, { className: ae2, style: de2, ...ue2 } = O2, he2 = { flex: "1 1 100%", width: "100%", ..._2, flexDirection: a2, display: "flex" }, { className: fe2, style: pe2, onPointerDown: ge2, ...we2 } = k2, me2 = Tt((e5) => {
|
|
1304
1292
|
const t2 = un(e5, null === u2);
|
|
1305
1293
|
B2(t2);
|
|
1306
1294
|
}, [u2]), xe2 = Tt((e5) => {
|
|
1307
1295
|
if (I2 || !Y2) return;
|
|
1308
1296
|
const t2 = be2.current?.getBoundingClientRect();
|
|
1309
1297
|
let n3 = 0;
|
|
1310
|
-
n3 = "row" === a2 ? (e5.clientX ?? e5.touches?.[0]?.clientX) - t2.x : (e5.clientY ?? e5.touches?.[0]?.clientY) - t2.y, n3 = Math.max(0, Math.min(
|
|
1311
|
-
}, [z2, a2, I2, Y2, $2,
|
|
1298
|
+
n3 = "row" === a2 ? (e5.clientX ?? e5.touches?.[0]?.clientX) - t2.x : (e5.clientY ?? e5.touches?.[0]?.clientY) - t2.y, n3 = Math.max(0, Math.min(q2, n3)), 1 === z2.fixedPaneOffset && (n3 = q2 - n3), f2 && $2.pixels === n3 || B2({ pixels: n3, percent: null }), Z2?.(n3), e5.stopPropagation(), e5.preventDefault();
|
|
1299
|
+
}, [z2, a2, I2, Y2, $2, q2]), ye2 = Tt((e5) => {
|
|
1312
1300
|
if (document.removeEventListener("pointermove", xe2), document.removeEventListener("touchmove", xe2), document.removeEventListener("pointerup", ye2), Y2 && (X2(false), $2)) {
|
|
1313
1301
|
if (J2($2.pixels), !un(f2, null === u2) || $2.pixels !== f2) {
|
|
1314
1302
|
const e6 = { ...$2 };
|
|
1315
|
-
null === e6.percent && (e6.percent = e6.pixels /
|
|
1303
|
+
null === e6.percent && (e6.percent = e6.pixels / q2 * 100), A2(e6);
|
|
1316
1304
|
}
|
|
1317
1305
|
e5.stopPropagation(), e5.preventDefault();
|
|
1318
1306
|
}
|
|
1319
|
-
}, [$2, Y2, f2, u2,
|
|
1307
|
+
}, [$2, Y2, f2, u2, q2]), ve2 = Tt((e5) => {
|
|
1320
1308
|
ge2?.(e5), e5.defaultPrevented || I2 || Y2 || (X2(true), G2(), document.addEventListener("pointermove", xe2, { passive: false }), document.addEventListener("touchmove", xe2, { passive: false }), document.addEventListener("pointerup", ye2, { passive: false }));
|
|
1321
|
-
}, [ge2]), be2 =
|
|
1309
|
+
}, [ge2]), be2 = Kt(r2, () => ({ setPosition: me2, isSplitPane: () => true }), []), Se2 = d(() => D2 ? L2?.({ key: "resizer", ref: m([W2, ee2]), className: g("resizer", fe2), onPointerDownCapture: ve2, style: { cursor: I2 ? void 0 : "row" === a2 ? "ew-resize" : "ns-resize", minWidth: "row" === a2 ? "2px" : void 0, minHeight: "row" !== a2 ? "2px" : void 0, boxSizing: "border-box", pointerEvents: "all", zIndex: 1, ...pe2 }, splitDirection: a2, disabled: I2, ...we2 }) : null, [D2, fe2, we2, a2, pe2, I2]), Ee2 = "row" === a2 ? "Width" : "Height", _e2 = { ...ie2, ...se2, flex: 0 === z2.fixedPaneOffset && null !== K2?.pixels[0] ? `0 0 ${Math.round(K2?.pixels[0])}px` : `1 1 ${Math.round(K2?.percents[0] ?? 100)}%`, [`min${Ee2}`]: K2?.minBefore, [`max${Ee2}`]: c2 ? K2?.maxBefore : "100%" }, Ie2 = { ...ie2, ...de2, flex: 1 === z2.fixedPaneOffset && null !== K2?.pixels[1] ? `0 0 ${Math.round(K2?.pixels[1])}px` : `1 1 ${Math.round(K2?.percents[1] ?? 100)}%`, [`min${Ee2}`]: K2?.minAfter, [`max${Ee2}`]: i2 ? K2?.maxAfter : "100%" }, Ce2 = d(() => i2 ? e("div", { ref: Q2, className: g("before", oe2, le2), style: _e2, ...re2, ...ce2, children: i2 }, "before") : null, [i2, R2, P2, z2, K2]), Me2 = d(() => c2 ? e("div", { ref: te2, className: g("after", oe2, ae2), style: Ie2, ...re2, ...ue2, children: c2 }, "after") : null, [c2, R2, O2, z2, K2]);
|
|
1322
1310
|
return t("div", { ref: m([F2, be2]), className: g("splitPane", "row" === a2 ? "vertical" : "horizontal", { dragging: Y2 }, E2), style: he2, children: [Ce2, Se2, Me2] });
|
|
1323
1311
|
}));
|
|
1324
1312
|
const fn = ({ initValue: e5, useHookBody: t2, applyStateChange: n2 }) => {
|
|
@@ -1738,23 +1726,23 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
|
|
|
1738
1726
|
W2({ eventType: "coordsChange", activeCoords: S2 });
|
|
1739
1727
|
}
|
|
1740
1728
|
}, [S2]);
|
|
1741
|
-
const
|
|
1729
|
+
const q2 = i((e5) => {
|
|
1742
1730
|
U2(e5.nativeEvent);
|
|
1743
|
-
}, []), { width:
|
|
1731
|
+
}, []), { width: K2 = 0, height: Y2 = 0 } = C2 ?? { width: 0, height: 0 }, X2 = Tt(r2, [r2]);
|
|
1744
1732
|
return { overlay: Tt((t3) => {
|
|
1745
1733
|
if (!A2.current || A2.current.isEditorClosed) return A2.current, null;
|
|
1746
1734
|
A2.current.coords;
|
|
1747
|
-
let n3 = T2(t3, A2.current.coords,
|
|
1748
|
-
n3 && 0 !== n3.width && 0 !== n3.height || (n3 = { x: 0, y: 0, width:
|
|
1735
|
+
let n3 = T2(t3, A2.current.coords, K2, Y2, b2, E2), o3 = true;
|
|
1736
|
+
n3 && 0 !== n3.width && 0 !== n3.height || (n3 = { x: 0, y: 0, width: K2, height: K2 }, o3 = false);
|
|
1749
1737
|
const r3 = t3.getZoom(), i2 = { containerBounds: { x: 0, y: 0, width: n3.width / r3, height: n3.height / r3 }, setNaturalDimensions: M2, zoom: r3 };
|
|
1750
1738
|
return e(Wn, { session: A2.current, refLatestCoords: B2, handleSubmitEdit: D2, handleCancelEdit: L2, cellBounds: n3, borderStrokeWidth: v2, borderStrokeFill: y2, isInBounds: o3, getCellEditor: X2, propsEditor: i2, alignment: E2, ...x2 }, "editor:" + A2.current.uuid);
|
|
1751
|
-
}, [r2, b2, j2,
|
|
1739
|
+
}, [r2, b2, j2, K2, Y2, E2, v2, y2]), startEdit: i((e5) => {
|
|
1752
1740
|
W2({ eventType: "start", startEvent: e5 });
|
|
1753
1741
|
}, []), submitEdit: i(() => {
|
|
1754
1742
|
W2({ eventType: "submit" });
|
|
1755
1743
|
}, []), cancelEdit: i(() => {
|
|
1756
1744
|
W2({ eventType: "cancel" });
|
|
1757
|
-
}, []), onKeyboardEvent:
|
|
1745
|
+
}, []), onKeyboardEvent: q2, onPointerEvent: N2, onKeyboardEventNative: U2, onPointerEventNative: H2, isEditing: _2 };
|
|
1758
1746
|
}, Nn = ({ gridRef: e5, gridMainRef: t2, orientation: n2 = $, headerCount: o2, selectionPolicy: r2 = "multiple", newSelectionMode: s2 = "clear", alwaysScrollToActiveCoords: c2 = true, onDragStart: a2, onDragEnd: u2, pointerDownInterceptor: h2, pointerMoveInterceptor: f2, onPointerUp: p2, newSelection: g2, modifySelection: w2, appendSelection: m2, clearSelections: x2 }) => {
|
|
1759
1747
|
const y2 = o2 ?? ((n2 === $ ? e5.current?.rowCount : e5.current?.columnCount) || 0), v2 = l(null), b2 = l(null), S2 = l(false), E2 = l(null), _2 = i((e6) => n2 === A ? { rowIndex: 0, colIndex: e6.colIndex } : { rowIndex: e6.rowIndex, colIndex: 0 }, [n2]), I2 = i((e6) => n2 === A ? { rowIndex: t2.current ? t2.current.rowCount - 1 : 0, colIndex: e6.colIndex } : { rowIndex: e6.rowIndex, colIndex: t2.current ? t2.current.columnCount - 1 : 0 }, [n2]), C2 = (e6) => {
|
|
1760
1748
|
b2.current = I2(e6), w2(b2.current, v2.current);
|
|
@@ -1804,7 +1792,7 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
|
|
|
1804
1792
|
if (0 === t3) return o2;
|
|
1805
1793
|
r2 ? o2 += t3 : o2 -= t3;
|
|
1806
1794
|
}
|
|
1807
|
-
},
|
|
1795
|
+
}, qn = (e5, t2, n2) => {
|
|
1808
1796
|
const o2 = [];
|
|
1809
1797
|
let r2 = t2;
|
|
1810
1798
|
for (; r2 <= n2; ) {
|
|
@@ -1812,7 +1800,7 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
|
|
|
1812
1800
|
0 === t3 ? (o2.push(r2), r2++) : r2 += t3;
|
|
1813
1801
|
}
|
|
1814
1802
|
return o2;
|
|
1815
|
-
},
|
|
1803
|
+
}, Kn = (e5, t2, n2, o2, r2, i2) => {
|
|
1816
1804
|
if (!t2) return i2;
|
|
1817
1805
|
let { rowIndex: l2, colIndex: s2 } = e5;
|
|
1818
1806
|
switch (o2) {
|
|
@@ -1879,7 +1867,7 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
|
|
|
1879
1867
|
o2 === E ? l2 = { rowIndex: s2 + 1, colIndex: c2 } : o2 === S ? l2 = { rowIndex: s2 - 1, colIndex: c2 } : o2 === I ? l2 = { rowIndex: s2, colIndex: c2 + 1 } : o2 === _ && (l2 = { rowIndex: s2, colIndex: c2 - 1 });
|
|
1880
1868
|
const a2 = t2(e5), d2 = t2(l2);
|
|
1881
1869
|
var u2, h2;
|
|
1882
|
-
return (h2 = d2, !(u2 = a2) && !h2 || !u2 && h2 || u2 && !h2 ?
|
|
1870
|
+
return (h2 = d2, !(u2 = a2) && !h2 || !u2 && h2 || u2 && !h2 ? Kn : Yn)(e5, t2, n2, o2, false, i2) ?? i2;
|
|
1883
1871
|
}, Gn = (e5, t2) => `${e5}:${t2}`, Zn = (e5, t2, n2, o2, r2, i2) => {
|
|
1884
1872
|
if (n2 - t2 >= r2 - o2) return o2;
|
|
1885
1873
|
let l2 = o2;
|
|
@@ -2109,8 +2097,8 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2109
2097
|
}, xo = (e5, t2, n2) => {
|
|
2110
2098
|
const o2 = e5.getVisibleRangeCoords(), r2 = e5.getScrollOrientation();
|
|
2111
2099
|
!r2.horizontal && (t2.colIndex > o2.colEnd || t2.colIndex < o2.colStart) && (t2 = { ...t2, colIndex: t2.colIndex > o2.colEnd ? o2.colEnd + 1 : o2.colEnd - 1 }, e5 = n2.current.getViewFromLocation(k)), !r2.vertical && (t2.rowIndex > o2.rowEnd || t2.rowIndex < o2.rowStart) && (t2 = { ...t2, rowIndex: t2.rowIndex > o2.rowEnd ? o2.rowEnd + 1 : o2.rowEnd - 1 }, e5 = n2.current.getViewFromLocation(k)), e5.scrollCellCoordsIntoView(t2);
|
|
2112
|
-
}, yo = () => false, vo = ({ gridRef: t2, commands: n2, layout: o2, selection: r2, onSelectionChange: c2, onSelectionDragStart: a2, onSelectionDragEnd: p2, selectionPolicy: g2 = "multiple", newSelectionMode: w2 = "clear", allowDeselectSelection: m2 = true, onFillPreview: x2, onFillCancel: y2, onFillDone: v2, onFill: b2, disableFillDrag: R2 = !b2, fillHandleBorderColor: P2 = "white", hiddenRowsAt: O2, hiddenColumnsAt: L2, isContentfulCell: D2, contentfulCellFinder: z2 = Xn, getDataCoords: A2, alwaysScrollToActiveCoords: $2 = false, selectionBounds: B2, pointerDownInterceptor: F2, pointerMoveInterceptor: j2, mergedRanges: V2, canSelectionSpanMergedCells: W2 = yo, onMoveDragStart: H2, onMoveDragUpdate: N2, onMoveDragEnd: U2, onMoveDragDone:
|
|
2113
|
-
const ie2 = i(() => ({ top: B2?.top ?? 0, left: B2?.left ?? 0, bottom: t2.current?.rowCount - 1 || 0, right: t2.current?.columnCount - 1 || 0 }), []), le2 = Tt(b2, [b2]), se2 = Tt(x2, [x2]), ce2 = Tt(y2, [y2]), ae2 = Tt(v2, [v2]), de2 = Tt(D2, [D2]), ue2 = Tt(
|
|
2100
|
+
}, yo = () => false, vo = ({ gridRef: t2, commands: n2, layout: o2, selection: r2, onSelectionChange: c2, onSelectionDragStart: a2, onSelectionDragEnd: p2, selectionPolicy: g2 = "multiple", newSelectionMode: w2 = "clear", allowDeselectSelection: m2 = true, onFillPreview: x2, onFillCancel: y2, onFillDone: v2, onFill: b2, disableFillDrag: R2 = !b2, fillHandleBorderColor: P2 = "white", hiddenRowsAt: O2, hiddenColumnsAt: L2, isContentfulCell: D2, contentfulCellFinder: z2 = Xn, getDataCoords: A2, alwaysScrollToActiveCoords: $2 = false, selectionBounds: B2, pointerDownInterceptor: F2, pointerMoveInterceptor: j2, mergedRanges: V2, canSelectionSpanMergedCells: W2 = yo, onMoveDragStart: H2, onMoveDragUpdate: N2, onMoveDragEnd: U2, onMoveDragDone: q2, selectionRenderer: K2 = co, disableMoveDrag: Y2 = !U2, getCellCoordsAsRangeCoords: X2 = ne.cellToRange, moveDragHitSize: G2 = 6, moveDragOutlineSize: Z2 = 4, selectionBackgroundColor: J2 = "rgba(16, 124, 65, 0.1)", selectionBorderColor: Q2 = "rgb(33, 115, 70)", selectionRemoveBorderColor: ee2 = "rgb(255, 0, 0)", selectionRemoveBackgroundColor: te2 = "rgba(250, 10, 10, 0.1)", disableTouchSelection: oe2 = false, touchSelectHandleProps: re2 }) => {
|
|
2101
|
+
const ie2 = i(() => ({ top: B2?.top ?? 0, left: B2?.left ?? 0, bottom: t2.current?.rowCount - 1 || 0, right: t2.current?.columnCount - 1 || 0 }), []), le2 = Tt(b2, [b2]), se2 = Tt(x2, [x2]), ce2 = Tt(y2, [y2]), ae2 = Tt(v2, [v2]), de2 = Tt(D2, [D2]), ue2 = Tt(K2, [K2]), he2 = Tt((e5, t3 = false) => to(e5, t3, o2.getRowOffset, t3 ? ie2().bottom : ie2().top), [o2?.getRowOffset]), fe2 = Tt(O2 ?? he2, [O2]), pe2 = Tt((e5, t3 = false) => to(e5, t3, o2.getColOffset, t3 ? ie2().right : ie2().left), [o2?.getColOffset]), ge2 = Tt(L2 ?? pe2, [L2]), [we2, me2] = h(() => mo(r2)), xe2 = d(() => mo(we2), [we2]), ye2 = l(xe2), ve2 = l(true);
|
|
2114
2102
|
u(Me.throttle(() => {
|
|
2115
2103
|
me2((e5) => {
|
|
2116
2104
|
ve2.current = true;
|
|
@@ -2190,13 +2178,13 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2190
2178
|
});
|
|
2191
2179
|
}, []), Ue2 = () => {
|
|
2192
2180
|
be2(wo);
|
|
2193
|
-
},
|
|
2181
|
+
}, qe2 = "touch" === Ut.detectIt().primaryInput, Ke2 = l(null), Ye2 = l(null), Xe2 = l(null), Ge2 = d(() => ({ onPointerDown: (e5) => {
|
|
2194
2182
|
if (!t2 || !t2.current) return false;
|
|
2195
2183
|
const n3 = e5.nativeEvent, o3 = t2.current.getViewFromClient(n3.clientX, n3.clientY);
|
|
2196
2184
|
if ("touch" === n3.pointerType || "touchstart" === n3.type) return Ye2.current = { topLeft: o3.getScrollTopLeft(), point: { x: n3.clientX, y: n3.clientY } }, true;
|
|
2197
2185
|
const r3 = o3.getCellCoordsFromClient(e5.nativeEvent.clientX, e5.nativeEvent.clientY);
|
|
2198
2186
|
if (!r3) return false;
|
|
2199
|
-
|
|
2187
|
+
Ke2.current = { anchor: o3.getAnchor(), coords: r3 }, Ae2.current = null;
|
|
2200
2188
|
const i2 = e5.nativeEvent.which === Ct;
|
|
2201
2189
|
if (i2) {
|
|
2202
2190
|
if (-1 !== ne.indexOfCoords(r3, xe2.ranges)) return false;
|
|
@@ -2222,10 +2210,10 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2222
2210
|
}, onPointerMoveOrWait: Me.throttle((e5, n3) => {
|
|
2223
2211
|
if (!t2?.current) return;
|
|
2224
2212
|
if ("touch" === e5.pointerType || "touchmove" === e5.type) return;
|
|
2225
|
-
if (!
|
|
2226
|
-
const o3 =
|
|
2213
|
+
if (!Ke2.current) return;
|
|
2214
|
+
const o3 = Ke2.current.anchor;
|
|
2227
2215
|
let r3 = t2.current.getViewFromLocation(o3), i2 = r3.getCellCoordsFromClient(e5.clientX, e5.clientY);
|
|
2228
|
-
if (!ne.isEqualCells(i2,
|
|
2216
|
+
if (!ne.isEqualCells(i2, Ke2.current?.coords) && (Ke2.current = { anchor: o3, coords: i2 }, i2 && false !== j2?.(e5, i2, ye2.current))) {
|
|
2229
2217
|
if (Pe2.current) {
|
|
2230
2218
|
const e6 = { rowStart: Math.min(i2.rowIndex, Pe2.current.rowIndex), colStart: Math.min(i2.colIndex, Pe2.current.colIndex), rowEnd: Math.max(i2.rowIndex, Pe2.current.rowIndex), colEnd: Math.max(i2.colIndex, Pe2.current.colIndex) }, t3 = { rowIndex: e6.rowStart, colIndex: e6.colStart }, n4 = { rowIndex: e6.rowEnd, colIndex: e6.colEnd };
|
|
2231
2219
|
if (Fe2(t3) || Fe2(n4)) return;
|
|
@@ -2235,7 +2223,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2235
2223
|
Xe2.current = n3, xo(r3, i2, t2);
|
|
2236
2224
|
}
|
|
2237
2225
|
}, 60), onPointerUp: (e5) => {
|
|
2238
|
-
if (
|
|
2226
|
+
if (Ke2.current = null, "touch" === e5.pointerType || "touchend" === e5.type) {
|
|
2239
2227
|
if (Ye2.current) {
|
|
2240
2228
|
const e6 = t2.current.getViewFromClient(Ye2.current.point.x, Ye2.current.point.y), n4 = e6.getScrollTopLeft();
|
|
2241
2229
|
if (n4.left === Ye2.current.topLeft.left && n4.top === Ye2.current.topLeft.top) {
|
|
@@ -2243,7 +2231,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2243
2231
|
He2(t3);
|
|
2244
2232
|
}
|
|
2245
2233
|
}
|
|
2246
|
-
return Ye2.current = null, void (
|
|
2234
|
+
return Ye2.current = null, void (Ke2.current = null);
|
|
2247
2235
|
}
|
|
2248
2236
|
try {
|
|
2249
2237
|
p2?.(ye2.current, e5);
|
|
@@ -2274,7 +2262,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2274
2262
|
e5.stopPropagation(), e5.preventDefault(), e5.nativeEvent.stopImmediatePropagation();
|
|
2275
2263
|
const d2 = o3 ?? t2.current.getViewFromClient(e5.nativeEvent.clientX, e5.nativeEvent.clientY), u2 = r3 ?? d2.getCellCoordsFromClient(e5.nativeEvent.clientX, e5.nativeEvent.clientY);
|
|
2276
2264
|
if (!u2) return false;
|
|
2277
|
-
|
|
2265
|
+
Ke2.current = { anchor: d2.getAnchor(), coords: u2 }, Ae2.current = null;
|
|
2278
2266
|
const h2 = e5.nativeEvent.which === Ct;
|
|
2279
2267
|
if (h2) {
|
|
2280
2268
|
if (-1 !== ne.indexOfCoords(u2, xe2.ranges)) return false;
|
|
@@ -2299,10 +2287,10 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2299
2287
|
l2 && Be2(u2), b3 && 0 === xe2.ranges.length || He2(u2);
|
|
2300
2288
|
}, onSelectionPointerMoveOrWait: (e5, n3, o3, r3, i2, l2 = xe2.cell, s2 = true, c3 = false) => {
|
|
2301
2289
|
if (!t2?.current) return;
|
|
2302
|
-
if (e5.stopPropagation(), e5.preventDefault(), e5.stopImmediatePropagation(), !
|
|
2303
|
-
const a3 =
|
|
2290
|
+
if (e5.stopPropagation(), e5.preventDefault(), e5.stopImmediatePropagation(), !Ke2.current) return;
|
|
2291
|
+
const a3 = Ke2.current.anchor;
|
|
2304
2292
|
let d2 = r3 ?? t2.current.getViewFromLocation(a3), u2 = i2 ?? d2.getCellCoordsFromClient(e5.clientX, e5.clientY);
|
|
2305
|
-
if (!ne.isEqualCells(u2,
|
|
2293
|
+
if (!ne.isEqualCells(u2, Ke2.current?.coords) && (Ke2.current = { anchor: a3, coords: u2 }, u2 && false !== j2?.(e5, u2, ye2.current))) {
|
|
2306
2294
|
if (Pe2.current) {
|
|
2307
2295
|
const e6 = { rowStart: Math.min(u2.rowIndex, Pe2.current.rowIndex), colStart: Math.min(u2.colIndex, Pe2.current.colIndex), rowEnd: Math.max(u2.rowIndex, Pe2.current.rowIndex), colEnd: Math.max(u2.colIndex, Pe2.current.colIndex) }, t3 = { rowIndex: e6.rowStart, colIndex: e6.colStart }, n4 = { rowIndex: e6.rowEnd, colIndex: e6.colEnd };
|
|
2308
2296
|
if (Fe2(t3) || Fe2(n4)) return;
|
|
@@ -2312,7 +2300,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2312
2300
|
s2 && xo(d2, u2, t2);
|
|
2313
2301
|
}
|
|
2314
2302
|
}, onPointerUp: (e5) => {
|
|
2315
|
-
|
|
2303
|
+
Ke2.current = null, e5.stopPropagation(), e5.preventDefault(), e5.stopImmediatePropagation();
|
|
2316
2304
|
try {
|
|
2317
2305
|
p2?.(ye2.current, e5);
|
|
2318
2306
|
} catch (e6) {
|
|
@@ -2544,9 +2532,9 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2544
2532
|
Qe2(E, false, true);
|
|
2545
2533
|
}, []), Nt2 = i(() => {
|
|
2546
2534
|
Qe2(E, true, true);
|
|
2547
|
-
}, []),
|
|
2535
|
+
}, []), qt2 = i(() => {
|
|
2548
2536
|
be2((e5) => e5.slice(0, -1));
|
|
2549
|
-
}, []),
|
|
2537
|
+
}, []), Kt2 = d(() => {
|
|
2550
2538
|
const e5 = ie2();
|
|
2551
2539
|
return ((e6, t3, n3, o3, r3) => {
|
|
2552
2540
|
for (let i2 = 0; i2 < e6.length; i2++) {
|
|
@@ -2653,7 +2641,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2653
2641
|
};
|
|
2654
2642
|
if (!nn2.current) return void o3();
|
|
2655
2643
|
const r3 = nn2.current.range, i2 = en2;
|
|
2656
|
-
U2?.(r3, e5, n3), Promise.resolve(r3 && i2 &&
|
|
2644
|
+
U2?.(r3, e5, n3), Promise.resolve(r3 && i2 && q2?.(r3, i2, e5, n3)).finally(() => {
|
|
2657
2645
|
o3();
|
|
2658
2646
|
});
|
|
2659
2647
|
} }), [en2]), rn2 = hn(on2), ln2 = d(() => ({ onPointerDown: rn2 }), [rn2]), sn2 = l(null), cn2 = d(() => {
|
|
@@ -2731,7 +2719,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2731
2719
|
let h2 = null;
|
|
2732
2720
|
!R2 && o3 && !en2 && (h2 = f(uo, { ...o3, corner: r3, size: 7.5, borderStroke: `${P2} solid`, style: { borderRadius: 1 }, background: Q2, ...Qt2, key: "fillHandle" }));
|
|
2733
2721
|
const p3 = [...i2];
|
|
2734
|
-
if (d2 && p3.push(d2), u2 && p3.push(u2), h2 && p3.push(h2), !oe2 &&
|
|
2722
|
+
if (d2 && p3.push(d2), u2 && p3.push(u2), h2 && p3.push(h2), !oe2 && qe2 && 1 === c3?.ranges.length && c3.ranges[c3.ranges.length - 1]) {
|
|
2735
2723
|
const o4 = c3.ranges[c3.ranges.length - 1], r4 = o4.rowStart === ie2().top && o4.rowEnd === ie2().bottom, i3 = o4.colStart === ie2().left && o4.colEnd === ie2().right, l3 = { view: n3, range: o4, borderStroke: `${Q2} solid`, background: P2, selectionTouchPointerHandler: Je2, ...re2, onTouchSelectStart: (e5) => De2(e5), onTouchSelectEnd: () => De2(null), currentTouchAnchor: Le2 };
|
|
2736
2724
|
p3.push(e(ho, { anchor: i3 ? "b" : r4 ? "r" : "br", scrollableElement: t2.current, ...l3 }, "touch-select-handle-after")), p3.push(e(ho, { anchor: i3 ? "t" : r4 ? "l" : "tl", scrollableElement: t2.current, ...l3 }, "touch-select-handle-before"));
|
|
2737
2725
|
}
|
|
@@ -2748,11 +2736,11 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2748
2736
|
}, []);
|
|
2749
2737
|
return d(() => {
|
|
2750
2738
|
n2?.addCommands(dn2, true);
|
|
2751
|
-
}, [n2]), { selection: cn2, setSelectionCell: Yt2, setSelectionRanges: be2, overlay: an2, cursor: Ee2, onPointerDown: Ze2, clearLastSelection:
|
|
2752
|
-
}, bo = { "sheetxl-grid": "_sheetxl-
|
|
2753
|
-
const { width: c2, height: a2, rowCount: w2 = 1, columnCount: m2 = 1, defaultRowHeight: x2, defaultColumnWidth: y2, getRowHeight: v2, getColumnWidth: R2, layout: P2, onViewportScroll: O2, onImmediateScroll: L2, showGridLines: D2 = true, gridLineColor: z2 = "rgb(224, 224, 224)", gridLineRowsProps: A2, gridLineColumnsProps: $2, clipCells: B2 = true, cursor: F2, freezeLeft: j2 = 0, freezeTop: V2 = 0, freezeLeftProps: W2, freezeTopProps: H2, cellRenderer: N2, onViewportChange: U2, onFirstRender:
|
|
2739
|
+
}, [n2]), { selection: cn2, setSelectionCell: Yt2, setSelectionRanges: be2, overlay: an2, cursor: Ee2, onPointerDown: Ze2, clearLastSelection: qt2, newSelection: He2, modifySelection: We2, appendSelection: Ne2, clearSelections: Ue2, isEntire: Kt2, navigate: Qe2, navigateSelection: et2 };
|
|
2740
|
+
}, bo = { "sheetxl-grid": "_sheetxl-grid_11irg_13" }, So = Object.freeze({ top: 0, left: 0 }), Eo = Object.freeze({ bottom: -4, right: -4 }), _o = Object.freeze({ horizontal: true, vertical: true }), Io = [C, M, T, k], Co = 150, Mo = 3e3, To = {}, ko = r(a((o2, r2) => {
|
|
2741
|
+
const { width: c2, height: a2, rowCount: w2 = 1, columnCount: m2 = 1, defaultRowHeight: x2, defaultColumnWidth: y2, getRowHeight: v2, getColumnWidth: R2, layout: P2, onViewportScroll: O2, onImmediateScroll: L2, showGridLines: D2 = true, gridLineColor: z2 = "rgb(224, 224, 224)", gridLineRowsProps: A2, gridLineColumnsProps: $2, clipCells: B2 = true, cursor: F2, freezeLeft: j2 = 0, freezeTop: V2 = 0, freezeLeftProps: W2, freezeTopProps: H2, cellRenderer: N2, onViewportChange: U2, onFirstRender: q2, overlayRenderer: K2, overlayProps: Y2, overlays: X2, overlaysProps: G2, allowOverlaysOverflow: Z2 = false, stageProps: J2, stageWrapper: Q2 = null, hiddenRowsAt: ee2, hiddenColumnsAt: te2, hiddenCellAt: oe2, getVisibleCells: re2, zoom: ie2 = 1, enableMouseWheel: le2 = true, onWheelScroll: se2, getCellCoordsAsRangeCoords: ce2 = ne.cellToRange, scrollPoint: ae2 = So, style: de2 = {}, ...ue2 } = o2;
|
|
2754
2742
|
b(N2, "No cellRenderer specified. This is probably not what you wanted"), b(!o2?.children, "Grid does not support children elements");
|
|
2755
|
-
const he2 = Tt(L2, [L2]), fe2 = Tt(U2, [U2]), pe2 = Tt(O2, [O2]), ge2 = Tt(se2, [se2]), we2 = Tt(
|
|
2743
|
+
const he2 = Tt(L2, [L2]), fe2 = Tt(U2, [U2]), pe2 = Tt(O2, [O2]), ge2 = Tt(se2, [se2]), we2 = Tt(q2, [q2]), me2 = l(null), xe2 = l(null), ye2 = l(null), [ve2, be2] = p((e5) => e5 + 1, 0), [Se2, Ee2] = h({ left: ae2?.left ?? 0, top: ae2?.top ?? 0, horizontalScrollDirection: null, verticalScrollDirection: null }), _e2 = l(null), Ie2 = l(Se2), { top: Ce2, left: Te2, verticalScrollDirection: ke2, horizontalScrollDirection: Re2 } = Se2, Pe2 = l(false), Oe2 = An({ rowCount: w2, columnCount: m2, defaultRowHeight: x2, defaultColumnWidth: y2, getRowHeight: v2, getColumnWidth: R2 }), Le2 = l(null), De2 = d(() => {
|
|
2756
2744
|
const e5 = P2 || Oe2;
|
|
2757
2745
|
return Le2.current = null, { getColOffset: (t2) => e5.getColOffset(t2) * ie2, getColIndex: (t2) => e5.getColIndex(t2 / ie2), getRowOffset: (t2) => e5.getRowOffset(t2) * ie2, getRowIndex: (t2) => e5.getRowIndex(t2 / ie2) };
|
|
2758
2746
|
}, [Oe2, P2, ie2]), ze2 = (e5, t2, n2) => {
|
|
@@ -2774,12 +2762,12 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2774
2762
|
if (t2 > 0) {
|
|
2775
2763
|
const l3 = ze2(De2, { top: n2 + De2.getRowOffset(0) }), s3 = De2.getRowIndex(o3), c4 = De2.getRowIndex(r3 - 1);
|
|
2776
2764
|
let a4;
|
|
2777
|
-
e5[1] = { minIndex: s3, maxIndex: c4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: i2, visibleIndices: () => a4 || (a4 = Object.freeze(
|
|
2765
|
+
e5[1] = { minIndex: s3, maxIndex: c4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: i2, visibleIndices: () => a4 || (a4 = Object.freeze(qn($e2, s3, c4)), a4), layout: l3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
|
|
2778
2766
|
}
|
|
2779
2767
|
const l2 = Math.max(0, Ve2 - i2), s2 = ze2(De2, { top: Ce2 + i2 }), c3 = s2.getRowIndex(0), a3 = s2.getRowIndex(l2);
|
|
2780
2768
|
let d2;
|
|
2781
|
-
return e5[0] = { minIndex: c3, maxIndex: a3, minCoord: t2, maxCoord: w2 - 1, minBounds: i2, maxBounds: l2, visibleIndices: () => d2 || (d2 = Object.freeze(
|
|
2782
|
-
}, [De2.getRowIndex, De2.getRowOffset, $e2, Ve2, w2, V2, Ce2, ie2]),
|
|
2769
|
+
return e5[0] = { minIndex: c3, maxIndex: a3, minCoord: t2, maxCoord: w2 - 1, minBounds: i2, maxBounds: l2, visibleIndices: () => d2 || (d2 = Object.freeze(qn($e2, c3, a3)), d2), layout: s2, maxVirtualBounds: De2.getRowOffset(w2), scrollOffset: Ce2, freezeOffset: (t2 > 0 ? De2.getRowOffset(t2) : 0) - n2 }, e5;
|
|
2770
|
+
}, [De2.getRowIndex, De2.getRowOffset, $e2, Ve2, w2, V2, Ce2, ie2]), qe2 = d(() => {
|
|
2783
2771
|
const e5 = [];
|
|
2784
2772
|
let t2 = 0, n2 = 0;
|
|
2785
2773
|
"number" == typeof j2 ? t2 = j2 : (t2 = j2.index ?? 0, n2 = (j2.scrollOffset ?? 0) * ie2);
|
|
@@ -2787,19 +2775,19 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2787
2775
|
if (t2 > 0) {
|
|
2788
2776
|
const l3 = ze2(De2, { left: n2 + De2.getColOffset(0) }), s3 = De2.getColIndex(o3), c4 = De2.getColIndex(r3 - 1);
|
|
2789
2777
|
let a4;
|
|
2790
|
-
e5[1] = { minIndex: s3, maxIndex: c4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: i2, visibleIndices: () => a4 || (a4 = Object.freeze(
|
|
2778
|
+
e5[1] = { minIndex: s3, maxIndex: c4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: i2, visibleIndices: () => a4 || (a4 = Object.freeze(qn(Fe2, s3, c4)), a4), layout: l3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
|
|
2791
2779
|
}
|
|
2792
2780
|
const l2 = Math.max(0, je2 - i2), s2 = ze2(De2, { left: Te2 + i2 }), c3 = s2.getColIndex(0), a3 = s2.getColIndex(l2);
|
|
2793
2781
|
let d2;
|
|
2794
|
-
return e5[0] = { minIndex: c3, maxIndex: a3, minCoord: t2, maxCoord: m2 - 1, minBounds: i2, maxBounds: l2, visibleIndices: () => d2 || (d2 = Object.freeze(
|
|
2795
|
-
}, [De2.getColIndex, De2.getColOffset, Fe2, je2, m2, j2, Te2, ie2]),
|
|
2782
|
+
return e5[0] = { minIndex: c3, maxIndex: a3, minCoord: t2, maxCoord: m2 - 1, minBounds: i2, maxBounds: l2, visibleIndices: () => d2 || (d2 = Object.freeze(qn(Fe2, c3, a3)), d2), layout: s2, maxVirtualBounds: De2.getColOffset(m2), scrollOffset: Te2, freezeOffset: (t2 > 0 ? De2.getColOffset(t2) : 0) - n2 }, e5;
|
|
2783
|
+
}, [De2.getColIndex, De2.getColOffset, Fe2, je2, m2, j2, Te2, ie2]), Ke2 = l({}), Ye2 = l([]), Xe2 = d(() => {
|
|
2796
2784
|
let e5 = {};
|
|
2797
2785
|
const t2 = (t3, n3, o3, r3, i2) => {
|
|
2798
2786
|
const l2 = { vertical: r3?.vertical || false, horizontal: r3?.horizontal || false };
|
|
2799
|
-
if (t3 >=
|
|
2800
|
-
const s2 = { rowStart: Ue2[n3].minIndex, colStart:
|
|
2787
|
+
if (t3 >= qe2.length || n3 >= Ue2.length) return null;
|
|
2788
|
+
const s2 = { rowStart: Ue2[n3].minIndex, colStart: qe2[t3].minIndex, rowEnd: Ue2[n3].maxIndex, colEnd: qe2[t3].maxIndex };
|
|
2801
2789
|
if (s2.rowStart > s2.rowEnd || s2.colStart > s2.colEnd) return null;
|
|
2802
|
-
const c3 = { getColIndex: (e6) =>
|
|
2790
|
+
const c3 = { getColIndex: (e6) => qe2[t3].layout.getColIndex(e6), getColOffset: (e6) => qe2[t3].layout.getColOffset(e6), getRowIndex: (e6) => Ue2[n3].layout.getRowIndex(e6), getRowOffset: (e6) => Ue2[n3].layout.getRowOffset(e6) }, a3 = Object.freeze({ left: i2?.left ?? 0, top: i2?.top ?? 0, right: i2?.right ?? 0, bottom: i2?.bottom ?? 0 }), d2 = Object.freeze({ x: qe2[t3].minBounds, y: Ue2[n3].minBounds, width: qe2[t3].maxBounds, height: Ue2[n3].maxBounds }), u2 = (e6, t4) => oo(c3, e6 ?? s2, t4), h2 = { width: qe2[t3].maxVirtualBounds, height: Ue2[n3].maxVirtualBounds }, f2 = { left: qe2[t3].scrollOffset, top: Ue2[n3].scrollOffset }, p2 = { left: qe2[t3].freezeOffset, top: Ue2[n3].freezeOffset }, g2 = { width: je2, height: Ve2 };
|
|
2803
2791
|
let w3 = null, m3 = null;
|
|
2804
2792
|
const x3 = (p2.top + (r3.vertical ? f2.top : 0)) / ie2, y3 = (p2.left + (r3.horizontal ? f2.left : 0)) / ie2;
|
|
2805
2793
|
return { getStage: () => me2.current ?? null, getVisibleRangeCoords: () => s2, toClipBounds: (e6, t4) => {
|
|
@@ -2812,7 +2800,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2812
2800
|
}, toViewBounds: (e6) => 0 === y3 && 0 === x3 && 1 === ie2 ? e6 : { x: (e6.x - y3) * ie2, y: (e6.y - x3) * ie2, width: e6.width * ie2, height: e6.height * ie2 }, toAbsoluteBounds: (e6) => 0 === y3 && 0 === x3 && 1 === ie2 ? e6 : { x: e6.x / ie2 + y3, y: e6.y / ie2 + x3, width: e6.width / ie2, height: e6.height / ie2 }, getRelativePointFromClient: (e6, t4) => {
|
|
2813
2801
|
const n4 = tt2(e6, t4);
|
|
2814
2802
|
return { x: n4.x - d2.x, y: n4.y - d2.y };
|
|
2815
|
-
}, getLayout: () => c3, getCellCoordsAsRangeCoords: ce2, getVisibleColumns: () =>
|
|
2803
|
+
}, getLayout: () => c3, getCellCoordsAsRangeCoords: ce2, getVisibleColumns: () => qe2[t3].visibleIndices(), getVisibleRows: () => Ue2[n3].visibleIndices(), getVisibleColumnOffsets: () => (w3 || (w3 = no(qe2[t3].layout, true, qe2[t3].visibleIndices(), s2.colStart, s2.colEnd)), w3), getVisibleRowOffsets: () => (m3 || (m3 = no(Ue2[n3].layout, false, Ue2[n3].visibleIndices(), s2.rowStart, s2.rowEnd)), m3), getTotalRangeCoords: () => ({ colStart: qe2[t3].minCoord, colEnd: qe2[t3].maxCoord, rowStart: Ue2[n3].minCoord, rowEnd: Ue2[n3].maxCoord }), getRangeCoordsBounds: u2, scrollCellCoordsIntoView: (e6, t4) => ut2(e6, t4, o3), getCellCoordsFromClient: (e6, t4, n4 = false) => {
|
|
2816
2804
|
const o4 = tt2(e6, t4);
|
|
2817
2805
|
if (!o4) return null;
|
|
2818
2806
|
const r4 = c3.getColIndex(o4.x - d2.x), i3 = { rowIndex: c3.getRowIndex(o4.y - d2.y), colIndex: r4 };
|
|
@@ -2822,8 +2810,8 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2822
2810
|
}, getZoom: () => ie2, getAnchor: () => o3, getBounds: () => d2, getInsets: () => a3, getTotalSize: () => h2, getViewportSize: () => g2, getScrollTopLeft: () => f2, getFreezeTopLeft: () => p2, getScrollOrientation: () => l2, allViews: () => e5 };
|
|
2823
2811
|
};
|
|
2824
2812
|
let n2 = e5[k] = t2(0, 0, k, _o, Eo);
|
|
2825
|
-
return n2 && (e5[k] = n2), n2 = t2(0, 1, M, { horizontal: true }), n2 && (e5[M] = n2), n2 = t2(1, 0, T, { vertical: true }), n2 && (e5[T] = n2), n2 = t2(1, 1, C, {}), n2 && (e5[C] = n2),
|
|
2826
|
-
}, [Ue2,
|
|
2813
|
+
return n2 && (e5[k] = n2), n2 = t2(0, 1, M, { horizontal: true }), n2 && (e5[M] = n2), n2 = t2(1, 0, T, { vertical: true }), n2 && (e5[T] = n2), n2 = t2(1, 1, C, {}), n2 && (e5[C] = n2), Ke2.current = null, e5 = Object.freeze(e5);
|
|
2814
|
+
}, [Ue2, qe2, ce2]), Ge2 = Object.keys(Xe2), Ze2 = qe2[0]?.maxVirtualBounds ?? 0, Je2 = Ue2[0]?.maxVirtualBounds ?? 0, Qe2 = d(() => ({ left: qe2[1] ? qe2[1].layout.getColOffset(qe2[1].maxIndex + 1) : 0, top: Ue2[1] ? Ue2[1].layout.getRowOffset(Ue2[1].maxIndex + 1) : 0 }), [Xe2]);
|
|
2827
2815
|
s(() => {
|
|
2828
2816
|
if (Ye2.current.length > 0) {
|
|
2829
2817
|
for (let e5 = 0; e5 < Ye2.current.length; e5++) Ye2.current[e5]();
|
|
@@ -2860,7 +2848,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2860
2848
|
return Ie2.current = t2, t2;
|
|
2861
2849
|
});
|
|
2862
2850
|
}, []), ct2 = Tt((e5) => {
|
|
2863
|
-
const t2 = e5?.left ?? e5?.[0], n2 = e5?.top ?? e5?.[1], o3 = void 0 !== t2 ? Math.min(Ze2 - je2, Math.max(
|
|
2851
|
+
const t2 = e5?.left ?? e5?.[0], n2 = e5?.top ?? e5?.[1], o3 = void 0 !== t2 ? Math.min(Ze2 - je2, Math.max(qe2?.[1]?.scrollOffset ?? 0, t2)) : Ie2.current.left, r3 = void 0 !== n2 ? Math.min(Je2 - Ve2, Math.max(Ue2?.[1]?.scrollOffset ?? 0, n2)) : Ie2.current.top;
|
|
2864
2852
|
if (Ie2.current.left === o3 && Ie2.current.top === r3) return;
|
|
2865
2853
|
let i2 = null, l2 = null;
|
|
2866
2854
|
Ie2.current.left > o3 ? i2 = _ : Ie2.current.left < o3 && (i2 = I), Ie2.current.top > r3 ? l2 = S : Ie2.current.top < r3 && (l2 = E), Me.throttle(() => {
|
|
@@ -2869,7 +2857,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2869
2857
|
return Ie2.current = t3, t3;
|
|
2870
2858
|
});
|
|
2871
2859
|
}, 17)(), _e2.current?.top === r3 && _e2.current?.left === o3 || (_e2.current = { left: o3, top: r3 }, he2({ left: o3, top: r3 }), fe2({ left: o3, top: r3, width: je2, height: Ve2, totalWidth: Ze2, totalHeight: Je2 })), lt2();
|
|
2872
|
-
}, [Ze2, Je2, Ue2,
|
|
2860
|
+
}, [Ze2, Je2, Ue2, qe2]);
|
|
2873
2861
|
s(() => {
|
|
2874
2862
|
_e2.current || ct2({ left: Te2, top: Ce2 });
|
|
2875
2863
|
}, [Ze2, je2, Je2, Ve2]), u(() => {
|
|
@@ -2919,22 +2907,22 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2919
2907
|
ye2.current = null, at2(c3 ? { left: l2 } : { top: s2 });
|
|
2920
2908
|
});
|
|
2921
2909
|
}, [Ze2, je2, Je2, Ve2, ge2]), ft2 = i((e5 = null) => {
|
|
2922
|
-
Le2.current = null,
|
|
2910
|
+
Le2.current = null, Ke2.current = null, be2();
|
|
2923
2911
|
}, []);
|
|
2924
2912
|
u(() => {
|
|
2925
2913
|
ft2();
|
|
2926
2914
|
}, [N2]);
|
|
2927
|
-
const pt2 =
|
|
2915
|
+
const pt2 = Kt(r2, () => ({ stage: me2.current, focus: We2, contains: He2, invalidate: ft2, scrollTo: ct2, scrollBy: at2, scrollCellCoordsIntoView: ut2, getScrollPosition: Ne2, getDimensions: et2, getViewport: rt2, handleWheel: ht2, rowCount: w2, columnCount: m2, getLayout: () => De2, getRelativePointFromClient: tt2, getViewFromClient: ot2, getViewFromCellCoords: dt2, getViewFromLocation: nt2, onViewChangeOnce: (e5) => {
|
|
2928
2916
|
Ye2.current.push(e5);
|
|
2929
2917
|
} }), [w2, m2, Xe2]);
|
|
2930
2918
|
s(() => (le2 && pt2.current?.addEventListener("wheel", ht2, { passive: false }), Pe2.current = true, _e2.current = null, () => {
|
|
2931
2919
|
pt2.current?.removeEventListener("wheel", ht2);
|
|
2932
2920
|
}), [le2]);
|
|
2933
2921
|
const gt2 = l([]), wt2 = (t2, n2) => {
|
|
2934
|
-
if (!t2 || !
|
|
2922
|
+
if (!t2 || !K2) return;
|
|
2935
2923
|
gt2.current = [];
|
|
2936
2924
|
n2.push(((t3, o3) => {
|
|
2937
|
-
const r3 = `view:${t3.getAnchor()}:overlay:${n2.length}`, i2 =
|
|
2925
|
+
const r3 = `view:${t3.getAnchor()}:overlay:${n2.length}`, i2 = K2?.({ key: r3, view: t3 }, (e5) => gt2.current[o3] = e5);
|
|
2938
2926
|
if (!i2) return null;
|
|
2939
2927
|
const l2 = t3.getBounds();
|
|
2940
2928
|
return e("div", { style: { position: "absolute", left: "0px", top: "0px", width: `${l2.width}px`, height: `${l2.height}px`, overflow: "hidden" }, children: i2 }, `overlay-${t3.getAnchor()}-${o3}`);
|
|
@@ -2946,7 +2934,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2946
2934
|
wt2(Xe2[o3], r3), e5[o3] = { overlays: r3 };
|
|
2947
2935
|
}
|
|
2948
2936
|
return e5;
|
|
2949
|
-
}, [ve2,
|
|
2937
|
+
}, [ve2, K2, w2, m2, Ue2, qe2]), xt2 = (t2, n2, o3, r3, i2, l2, s2) => {
|
|
2950
2938
|
if (!t2) return;
|
|
2951
2939
|
const c3 = t2.getVisibleColumns(), a3 = t2.getVisibleRows();
|
|
2952
2940
|
if (0 === c3.length || 0 === a3.length) return;
|
|
@@ -3014,7 +3002,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
3014
3002
|
xt2(Xe2[i2], c3, l2, s2, /* @__PURE__ */ new Set(), e5, t2), n2[i2] = { cells: c3, rangesH: l2, rangesV: s2 };
|
|
3015
3003
|
}
|
|
3016
3004
|
return Le2.current = t2, n2;
|
|
3017
|
-
}, [ve2, w2, m2, Ue2,
|
|
3005
|
+
}, [ve2, w2, m2, Ue2, qe2, D2, de2, B2, oe2, re2, ce2]), vt2 = (t2, n2, o3, r3, i2) => {
|
|
3018
3006
|
if (t2) if (n2) {
|
|
3019
3007
|
const e5 = `view:${t2.getAnchor()}:hl:`, n3 = t2.getVisibleRows();
|
|
3020
3008
|
if (!n3 || 0 === n3.length) return;
|
|
@@ -3076,7 +3064,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
3076
3064
|
n2[r3] = e("svg", { width: `${c3}`, height: `${a3}`, viewBox: `0 0 ${c3} ${a3}`, preserveAspectRatio: "none", shapeRendering: "crispEdges", style: { position: "absolute" }, children: l2 });
|
|
3077
3065
|
}
|
|
3078
3066
|
return n2;
|
|
3079
|
-
}, St2 = d(() => true === D2 || true === D2?.horizontal ? bt2(true) : null, [ve2, D2, Ue2, V2, j2, z2, A2, w2, m2, je2, Ze2, yt2]), Et2 = d(() => true === D2 || true === D2?.vertical ? bt2(false) : null, [ve2, D2,
|
|
3067
|
+
}, St2 = d(() => true === D2 || true === D2?.horizontal ? bt2(true) : null, [ve2, D2, Ue2, V2, j2, z2, A2, w2, m2, je2, Ze2, yt2]), Et2 = d(() => true === D2 || true === D2?.vertical ? bt2(false) : null, [ve2, D2, qe2, V2, j2, z2, $2, w2, m2, Ve2, Je2, yt2]), _t2 = d(() => 0 === Qe2.left ? null : e(lo, { linePoints: [0, 0, 0, Ve2 + 1], bounds: { x: Qe2.left, y: 0, width: 1, height: Ve2 + 1 }, ...W2 }), [ve2, Qe2.left, Ve2, W2]), It2 = d(() => 0 === Qe2.top ? null : e(lo, { linePoints: [0, 0, je2 + 1, 0], bounds: { x: 0, y: Qe2.top, width: je2 + 1, height: 1 }, ...H2 }), [ve2, Qe2.top, je2, H2]), Ct2 = d(() => {
|
|
3080
3068
|
const o3 = [], r3 = (e5) => {
|
|
3081
3069
|
if (!e5 || !Xe2[e5]) return;
|
|
3082
3070
|
const n2 = Xe2[e5].getBounds();
|
|
@@ -3099,12 +3087,12 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
3099
3087
|
if (!r3) return;
|
|
3100
3088
|
const i3 = r3.getBounds(), l3 = r3.getInsets(), s3 = r3.getAnchor();
|
|
3101
3089
|
return t("div", { className: g("view", `view-${s3}`, bo.view), style: { position: "absolute", pointerEvents: "none", left: i3.x - l3.left, top: i3.y - l3.top, width: i3.width - (l3.left + l3.right), height: i3.height - (l3.top + l3.bottom), clipPath: Z2 ? "inset(-2px)" : "inset(0px)" }, children: [e5(n3, o4, r3, X2), mt2?.[s3].overlays] }, `view:${s3}`);
|
|
3102
|
-
}, o3 =
|
|
3090
|
+
}, o3 = Ke2.current, i2 = {}, l2 = [], s2 = Object.keys(Xe2);
|
|
3103
3091
|
for (let e6 = 0; e6 < s2.length; e6++) {
|
|
3104
3092
|
const t2 = s2[e6], r3 = o3?.[t2], c3 = i2[t2] = /* @__PURE__ */ new Map();
|
|
3105
3093
|
l2.push(n2(r3, c3, Xe2[t2]));
|
|
3106
3094
|
}
|
|
3107
|
-
return
|
|
3095
|
+
return Ke2.current = i2, l2;
|
|
3108
3096
|
}, [ve2, Xe2, Z2, X2]), kt2 = d(() => {
|
|
3109
3097
|
const { style: t2, ...n2 } = J2 ?? {};
|
|
3110
3098
|
return e("div", { style: { width: je2, height: Ve2, ...t2 }, className: "sheetxl-stage", tabIndex: 0, ref: me2, ...n2, ...ue2, children: Q2 ? Q2(Ct2) : Ct2 });
|
|
@@ -3206,20 +3194,20 @@ const jo = (e5 = void 0) => Object.freeze({ clean: e5, dirty: void 0, editMode:
|
|
|
3206
3194
|
let j2 = 2;
|
|
3207
3195
|
const V2 = 96 * A2 / 72, W2 = 1.2 * V2;
|
|
3208
3196
|
"right" === O2 && (j2 += 1);
|
|
3209
|
-
const H2 = d(() => new Fo().naturalDimensions(F2, { maxWidth: "wrap" === D2 ? T2 - j2 : void 0, lineHeight: `${W2}px`, paintableText: { fontStyle: B2, wrap: D2, letterSpacing: -0.25 } }), [F2, D2, j2, V2, z2, $2, B2, m2, T2]), N2 = i(() => H2.maxLineHeight ? H2.maxLineHeight + "px" : "1.2", [H2]), [U2,
|
|
3197
|
+
const H2 = d(() => new Fo().naturalDimensions(F2, { maxWidth: "wrap" === D2 ? T2 - j2 : void 0, lineHeight: `${W2}px`, paintableText: { fontStyle: B2, wrap: D2, letterSpacing: -0.25 } }), [F2, D2, j2, V2, z2, $2, B2, m2, T2]), N2 = i(() => H2.maxLineHeight ? H2.maxLineHeight + "px" : "1.2", [H2]), [U2, q2] = h(N2);
|
|
3210
3198
|
u(() => {
|
|
3211
|
-
|
|
3199
|
+
q2(N2());
|
|
3212
3200
|
}, [w2, H2]), u(() => {
|
|
3213
3201
|
m2?.({ width: "wrap" === D2 ? void 0 : H2.width + j2, height: H2.height });
|
|
3214
3202
|
}, [H2, m2]);
|
|
3215
|
-
const
|
|
3203
|
+
const K2 = Tt(a2, [a2]), Y2 = Tt((e5) => {
|
|
3216
3204
|
if (k2.dirty === e5) return;
|
|
3217
3205
|
const t3 = { ...k2 };
|
|
3218
|
-
t3.dirty = e5, M2.current, R2(t3),
|
|
3206
|
+
t3.dirty = e5, M2.current, R2(t3), K2?.(t3);
|
|
3219
3207
|
}, [k2]), X2 = Tt((e5) => {
|
|
3220
3208
|
if (k2.editMode === e5) return;
|
|
3221
3209
|
const t3 = { ...k2 };
|
|
3222
|
-
t3.editMode = e5, R2(t3),
|
|
3210
|
+
t3.editMode = e5, R2(t3), K2?.(t3);
|
|
3223
3211
|
}, [k2]), G2 = Tt(() => {
|
|
3224
3212
|
try {
|
|
3225
3213
|
return f2?.(k2), g2?.(), true;
|
|
@@ -3232,7 +3220,7 @@ const jo = (e5 = void 0) => Object.freeze({ clean: e5, dirty: void 0, editMode:
|
|
|
3232
3220
|
if (!M2.current) return;
|
|
3233
3221
|
if (e5.isDefaultPrevented(), !(e5.isTrusted || e5.nativeEvent.ctrlKey || e5.nativeEvent.metaKey || e5.nativeEvent.altKey || e5.nativeEvent.isComposing) && -1 !== $n.indexOf(e5.nativeEvent.key)) {
|
|
3234
3222
|
const t4 = { ...k2 };
|
|
3235
|
-
return t4.dirty = "Backspace" === e5.nativeEvent.key ? "" : (t4.dirty ?? "") + e5.key, R2(t4),
|
|
3223
|
+
return t4.dirty = "Backspace" === e5.nativeEvent.key ? "" : (t4.dirty ?? "") + e5.key, R2(t4), K2?.(t4), void e5.preventDefault();
|
|
3236
3224
|
}
|
|
3237
3225
|
const t3 = e5.nativeEvent.shiftKey;
|
|
3238
3226
|
if (e5.which === vt) return e5.preventDefault(), void Z2();
|
|
@@ -3259,7 +3247,7 @@ const jo = (e5 = void 0) => Object.freeze({ clean: e5, dirty: void 0, editMode:
|
|
|
3259
3247
|
s(() => {
|
|
3260
3248
|
ee2(false);
|
|
3261
3249
|
}, []);
|
|
3262
|
-
const te2 =
|
|
3250
|
+
const te2 = Kt(n2, () => ({ startEdit(e5) {
|
|
3263
3251
|
let t3 = e5?.initialSelection;
|
|
3264
3252
|
if (!t3) {
|
|
3265
3253
|
const e6 = M2.current.value.length ?? 0;
|
|
@@ -3267,7 +3255,7 @@ const jo = (e5 = void 0) => Object.freeze({ clean: e5, dirty: void 0, editMode:
|
|
|
3267
3255
|
}
|
|
3268
3256
|
M2.current?.setSelectionRange(t3.start, t3.end, t3.direction);
|
|
3269
3257
|
const n3 = { ...o2, editMode: e5?.editMode ?? false };
|
|
3270
|
-
void 0 !== e5?.text && (n3.dirty = e5.text), n3.editMode === o2.editMode && n3.dirty === o2.dirty || (R2(n3),
|
|
3258
|
+
void 0 !== e5?.text && (n3.dirty = e5.text), n3.editMode === o2.editMode && n3.dirty === o2.dirty || (R2(n3), K2?.(n3));
|
|
3271
3259
|
}, submitEdit: () => G2(), cancelEdit() {
|
|
3272
3260
|
Z2();
|
|
3273
3261
|
}, autoFocus() {
|