@sheetxl/grid-react 0.2.0 → 0.2.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/LICENSE.md +11 -11
- package/README.md +8 -8
- package/browser/cjs/index.cjs +8 -8
- package/browser/esm/index.mjs +198 -198
- package/licenses/dependencies.txt +22 -22
- package/node/assets/style.css +1 -1
- package/node/esm/index.mjs +94 -94
- package/package.json +3 -3
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.2.
|
|
2
|
+
* @license @sheetxl/grid-react - Grid - Advanced data grid component for React - v0.2.5
|
|
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.
|
|
@@ -13,14 +13,14 @@ 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
15
|
/**
|
|
16
|
-
* @license @sheetxl/utils - Utils - Utilities used by most SheetXL components. - v0.2.
|
|
16
|
+
* @license @sheetxl/utils - Utils - Utilities used by most SheetXL components. - v0.2.5
|
|
17
17
|
*
|
|
18
18
|
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
19
19
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
20
20
|
*/
|
|
21
21
|
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
22
|
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,
|
|
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, K = (e5 = $, t2 = false) => t2 ? e5 !== A ? W : H : e5 !== A ? V : j, q = (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
24
|
if (e5 === t2) return true;
|
|
25
25
|
if (!e5 || !t2) return false;
|
|
26
26
|
if (e5.length !== t2.length) return false;
|
|
@@ -49,7 +49,7 @@ function te(e5, t2 = 2, n2, o2 = $, r2) {
|
|
|
49
49
|
if (t2 <= 0 || e5.length <= 1) return i2;
|
|
50
50
|
let l2 = o2 === A, s2 = 0, c2 = false;
|
|
51
51
|
do {
|
|
52
|
-
const e6 = i2.sort(
|
|
52
|
+
const e6 = i2.sort(K(l2 ? $ : A));
|
|
53
53
|
i2 = [], i2.push(e6[0]);
|
|
54
54
|
const t3 = e6.length;
|
|
55
55
|
let a2 = 0, d2 = e6[0], u2 = d2.colStart, h2 = d2.rowStart, f2 = d2.colEnd, p2 = d2.rowEnd;
|
|
@@ -92,7 +92,7 @@ const ne = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: B,
|
|
|
92
92
|
const h2 = t2 ? s2 : c2, f2 = t2 ? c2 : s2;
|
|
93
93
|
o2 = { colStart: h2, rowStart: f2, colEnd: h2, rowEnd: f2 }, u2 && (o2.value = a2), i2 = s2, l2 = c2, r2 = a2;
|
|
94
94
|
}, done: (e6) => (o2 && (n2.push(o2), o2 = null), e6 ? te(n2, 3, true === e6 ? ee : e6, t2 ? A : $, Q) : n2) };
|
|
95
|
-
}, createRangeComparator:
|
|
95
|
+
}, createRangeComparator: K, 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
96
|
if (!t2 || 0 === t2.length) return e5;
|
|
97
97
|
let n2 = e5, o2 = null;
|
|
98
98
|
for (; !Y(n2, o2); ) o2 = n2, n2 = J(o2, t2);
|
|
@@ -109,7 +109,7 @@ const ne = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: B,
|
|
|
109
109
|
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
110
|
let s2 = n2;
|
|
111
111
|
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:
|
|
112
|
+
}, isCellWithinRange: (e5, t2) => !(!e5 || !t2 || e5.rowIndex < t2.rowStart || e5.rowIndex > t2.rowEnd || e5.colIndex < t2.colStart || e5.colIndex > t2.colEnd), isEqualCells: q, isEqualRanges: Y, isEqualRangesArrays: G, isEqualSelectionCoords: (e5, t2) => e5 === t2 || !(!e5 || !t2) && e5.rangeIndex === t2.rangeIndex && !!q(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
113
|
if (!e5 || 0 === e5.length) return null;
|
|
114
114
|
if (1 === e5.length && !t2) return e5[0];
|
|
115
115
|
let o2 = e5[0];
|
|
@@ -619,7 +619,7 @@ const We = async (e5, t2 = R) => new Promise(async (n2, o2) => {
|
|
|
619
619
|
console.warn("Can't parse html from clipboard.");
|
|
620
620
|
}
|
|
621
621
|
return o2;
|
|
622
|
-
}, Ne = "clipboard-uuid", Ue = "web text/uuid",
|
|
622
|
+
}, Ne = "clipboard-uuid", Ue = "web text/uuid", Ke = (e5) => `<div style="display:none" ${Ne}="${e5}"/>`, qe = (e5, t2) => {
|
|
623
623
|
let n2 = null;
|
|
624
624
|
try {
|
|
625
625
|
const o2 = new DOMParser().parseFromString(t2, R);
|
|
@@ -697,13 +697,13 @@ class Xe {
|
|
|
697
697
|
t2._state = { uuid: o2, ref: e5.ref, items: n2 }, t2.dispatchEvent(new Event("clipboardwrite")), t2.dispatchEvent(new Event("clipboardchange"));
|
|
698
698
|
};
|
|
699
699
|
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([
|
|
700
|
+
await Fe(), o2 && 0 === r2.length && (r2.push(new ClipboardItem({ [Ue]: new Blob([o2], { type: Ue }) })), r2.push(new ClipboardItem({ [R]: new Blob([Ke(o2)], { type: R }) })));
|
|
701
701
|
for (let e6 = 0; e6 < Math.min(1, r2.length); e6++) {
|
|
702
702
|
const t3 = r2[e6];
|
|
703
703
|
let i3 = t3.types.indexOf(R), l2 = null;
|
|
704
704
|
if (-1 !== i3) {
|
|
705
705
|
const e7 = await t3.getType(R);
|
|
706
|
-
l2 = await ke(e7), l2 && (l2 =
|
|
706
|
+
l2 = await ke(e7), l2 && (l2 = qe(o2, l2));
|
|
707
707
|
}
|
|
708
708
|
if (!l2 && t3.types.includes(P)) {
|
|
709
709
|
const e7 = await t3.getType(P);
|
|
@@ -716,7 +716,7 @@ class Xe {
|
|
|
716
716
|
const e7 = await t3.getType(O), n3 = Te(await e7.arrayBuffer());
|
|
717
717
|
l2 = `<div ${Ne}="${o2}"><img src="${Re + n3}"/></div>`;
|
|
718
718
|
}
|
|
719
|
-
!l2 && o2 && (l2 =
|
|
719
|
+
!l2 && o2 && (l2 = Ke(o2));
|
|
720
720
|
const s2 = new Blob([l2 ?? ""], { type: R }), c2 = {};
|
|
721
721
|
for (let e7 = 0; e7 < t3.types.length; e7++) {
|
|
722
722
|
const n3 = t3.types[e7];
|
|
@@ -845,7 +845,7 @@ const ft = Object.freeze(Object.defineProperty({ __proto__: null, deviceType: ut
|
|
|
845
845
|
return r2;
|
|
846
846
|
};
|
|
847
847
|
/**
|
|
848
|
-
* @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.2.
|
|
848
|
+
* @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.2.5
|
|
849
849
|
*
|
|
850
850
|
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
851
851
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
@@ -873,25 +873,25 @@ const Ot = r(a((n2, o2) => {
|
|
|
873
873
|
const e5 = H2.current;
|
|
874
874
|
H2.current = null, r2 !== e5 && (M2.current[A2] = r2);
|
|
875
875
|
}, [r2, A2]);
|
|
876
|
-
const U2 = l(null),
|
|
877
|
-
U2.current && (clearTimeout(U2.current), U2.current = null,
|
|
876
|
+
const U2 = l(null), K2 = l(null), q2 = i(() => {
|
|
877
|
+
U2.current && (clearTimeout(U2.current), U2.current = null, K2.current = null);
|
|
878
878
|
}, []), Y2 = i((e5, t2, n3, o3 = b2) => {
|
|
879
|
-
|
|
880
|
-
const t3 = n3 ? V2(
|
|
881
|
-
t3 !==
|
|
879
|
+
K2.current = e5, U2.current = setTimeout(() => {
|
|
880
|
+
const t3 = n3 ? V2(K2.current || e5) : W2(K2.current || e5);
|
|
881
|
+
t3 !== K2.current ? Y2(t3, false, n3, S2) : q2();
|
|
882
882
|
}, t2 ? 0 : o3);
|
|
883
|
-
}, [V2, W2,
|
|
884
|
-
s(() => () =>
|
|
883
|
+
}, [V2, W2, q2]);
|
|
884
|
+
s(() => () => q2(), [q2]);
|
|
885
885
|
const X2 = r2, G2 = d(() => {
|
|
886
886
|
if (!y2) return null;
|
|
887
|
-
const e5 = { orientation: p2, disabled: Math.floor(X2) <= 0 || 0 === Math.floor(B2 - $2), onMouseUp:
|
|
887
|
+
const e5 = { orientation: p2, disabled: Math.floor(X2) <= 0 || 0 === Math.floor(B2 - $2), onMouseUp: q2, onMouseLeave: q2, onMouseDown: () => Y2(X2, true, true) };
|
|
888
888
|
return E2?.(e5);
|
|
889
889
|
}, [y2, p2, X2, F2, B2, $2]), Z2 = d(() => {
|
|
890
890
|
if (!y2) return null;
|
|
891
|
-
const e5 = { orientation: p2, disabled: Math.floor(B2 - $2) <= Math.ceil(X2), onMouseUp:
|
|
891
|
+
const e5 = { orientation: p2, disabled: Math.floor(B2 - $2) <= Math.ceil(X2), onMouseUp: q2, onMouseLeave: q2, onMouseDown: () => Y2(X2, true, false) };
|
|
892
892
|
return _2?.(e5);
|
|
893
893
|
}, [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-
|
|
894
|
+
return t("div", { ref: o2, style: { display: "flex", flex: "1", flexDirection: D2 ? "column" : "row", padding: "0", ...u2 }, className: g("_sheetxl-scrollbar_eblx4_6", 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
895
|
}));
|
|
896
896
|
Ot.displayName = "Scrollbar";
|
|
897
897
|
let Lt = Date.now, Dt = {}, zt = 1;
|
|
@@ -1070,8 +1070,8 @@ const Ut = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProper
|
|
|
1070
1070
|
n2 = true, e5.stopPropagation();
|
|
1071
1071
|
}, isPropagationStopped: () => n2, persist: () => {
|
|
1072
1072
|
}, 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
|
|
1073
|
+
}, detectIt: Nt, focusableNodeNames: Wt, toPrettyKeyCode: (e5) => "BracketLeft" === e5 ? "[" : "BracketRight" === e5 ? "]" : Me.camelToPrettyCase(e5) }, Symbol.toStringTag, { value: "Module" })), Kt = [];
|
|
1074
|
+
function qt(e5, t2, n2 = Kt) {
|
|
1075
1075
|
const o2 = l(null);
|
|
1076
1076
|
return c(e5, () => {
|
|
1077
1077
|
if (!o2.current) return;
|
|
@@ -1086,7 +1086,7 @@ function Kt(e5, t2, n2 = qt) {
|
|
|
1086
1086
|
}, n2), o2;
|
|
1087
1087
|
}
|
|
1088
1088
|
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 =
|
|
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 = qt(r2, () => ({ isScrollPane: () => true }), []), _2 = l(null);
|
|
1090
1090
|
s(() => {
|
|
1091
1091
|
_2.current && (_2.current.__scrollTop === a2?.top && _2.current.__scrollLeft !== !a2?.left || _2.current?.scrollTo(a2?.left, a2?.top, false));
|
|
1092
1092
|
}, [a2?.left, a2?.top, y2]);
|
|
@@ -1137,7 +1137,7 @@ function Qt() {
|
|
|
1137
1137
|
const e6 = document.fullscreenElement;
|
|
1138
1138
|
if (!e6) return;
|
|
1139
1139
|
let t2 = e6.querySelector(".fullscreen-portal-root");
|
|
1140
|
-
t2 || (t2 = document.createElement("div"), t2.className = "fullscreen-portal-root _fullscreen-portal-
|
|
1140
|
+
t2 || (t2 = document.createElement("div"), t2.className = "fullscreen-portal-root _fullscreen-portal-root_1mjsr_4", e6.appendChild(t2));
|
|
1141
1141
|
}
|
|
1142
1142
|
return Jt++, e5(), document.addEventListener("fullscreenchange", e5), () => {
|
|
1143
1143
|
document.removeEventListener("fullscreenchange", e5), Jt--, Jt <= 0 && (document.querySelectorAll(".fullscreen-portal-root").forEach((e6) => {
|
|
@@ -1293,32 +1293,32 @@ r(a((n2, r2) => {
|
|
|
1293
1293
|
s(() => {
|
|
1294
1294
|
B2(un(f2, null === u2));
|
|
1295
1295
|
}, [f2, u2]);
|
|
1296
|
-
const [F2, { width: j2, height: V2 }] = w(), [W2, { width: H2, height: N2 }] = w(), U2 = "row" === a2 ? H2 : N2,
|
|
1296
|
+
const [F2, { width: j2, height: V2 }] = w(), [W2, { width: H2, height: N2 }] = w(), U2 = "row" === a2 ? H2 : N2, K2 = "row" === a2 ? j2 : V2, q2 = d(() => ((e5, t2, n3, o2) => {
|
|
1297
1297
|
const r3 = [null, null], i3 = [null, null];
|
|
1298
1298
|
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
1299
|
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
1300
|
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
1301
|
const p3 = Math.max(0, Math.min(100, l2 / s2 * 100));
|
|
1302
1302
|
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,
|
|
1303
|
+
})($2, K2, U2, z2), [z2, $2, K2, 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
1304
|
const t2 = un(e5, null === u2);
|
|
1305
1305
|
B2(t2);
|
|
1306
1306
|
}, [u2]), xe2 = Tt((e5) => {
|
|
1307
1307
|
if (I2 || !Y2) return;
|
|
1308
1308
|
const t2 = be2.current?.getBoundingClientRect();
|
|
1309
1309
|
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,
|
|
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(K2, n3)), 1 === z2.fixedPaneOffset && (n3 = K2 - n3), f2 && $2.pixels === n3 || B2({ pixels: n3, percent: null }), Z2?.(n3), e5.stopPropagation(), e5.preventDefault();
|
|
1311
|
+
}, [z2, a2, I2, Y2, $2, K2]), ye2 = Tt((e5) => {
|
|
1312
1312
|
if (document.removeEventListener("pointermove", xe2), document.removeEventListener("touchmove", xe2), document.removeEventListener("pointerup", ye2), Y2 && (X2(false), $2)) {
|
|
1313
1313
|
if (J2($2.pixels), !un(f2, null === u2) || $2.pixels !== f2) {
|
|
1314
1314
|
const e6 = { ...$2 };
|
|
1315
|
-
null === e6.percent && (e6.percent = e6.pixels /
|
|
1315
|
+
null === e6.percent && (e6.percent = e6.pixels / K2 * 100), A2(e6);
|
|
1316
1316
|
}
|
|
1317
1317
|
e5.stopPropagation(), e5.preventDefault();
|
|
1318
1318
|
}
|
|
1319
|
-
}, [$2, Y2, f2, u2,
|
|
1319
|
+
}, [$2, Y2, f2, u2, K2]), ve2 = Tt((e5) => {
|
|
1320
1320
|
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 =
|
|
1321
|
+
}, [ge2]), be2 = qt(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 !== q2?.pixels[0] ? `0 0 ${Math.round(q2?.pixels[0])}px` : `1 1 ${Math.round(q2?.percents[0] ?? 100)}%`, [`min${Ee2}`]: q2?.minBefore, [`max${Ee2}`]: c2 ? q2?.maxBefore : "100%" }, Ie2 = { ...ie2, ...de2, flex: 1 === z2.fixedPaneOffset && null !== q2?.pixels[1] ? `0 0 ${Math.round(q2?.pixels[1])}px` : `1 1 ${Math.round(q2?.percents[1] ?? 100)}%`, [`min${Ee2}`]: q2?.minAfter, [`max${Ee2}`]: i2 ? q2?.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, q2]), Me2 = d(() => c2 ? e("div", { ref: te2, className: g("after", oe2, ae2), style: Ie2, ...re2, ...ue2, children: c2 }, "after") : null, [c2, R2, O2, z2, q2]);
|
|
1322
1322
|
return t("div", { ref: m([F2, be2]), className: g("splitPane", "row" === a2 ? "vertical" : "horizontal", { dragging: Y2 }, E2), style: he2, children: [Ce2, Se2, Me2] });
|
|
1323
1323
|
}));
|
|
1324
1324
|
const fn = ({ initValue: e5, useHookBody: t2, applyStateChange: n2 }) => {
|
|
@@ -1738,23 +1738,23 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
|
|
|
1738
1738
|
W2({ eventType: "coordsChange", activeCoords: S2 });
|
|
1739
1739
|
}
|
|
1740
1740
|
}, [S2]);
|
|
1741
|
-
const
|
|
1741
|
+
const K2 = i((e5) => {
|
|
1742
1742
|
U2(e5.nativeEvent);
|
|
1743
|
-
}, []), { width:
|
|
1743
|
+
}, []), { width: q2 = 0, height: Y2 = 0 } = C2 ?? { width: 0, height: 0 }, X2 = Tt(r2, [r2]);
|
|
1744
1744
|
return { overlay: Tt((t3) => {
|
|
1745
1745
|
if (!A2.current || A2.current.isEditorClosed) return A2.current, null;
|
|
1746
1746
|
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:
|
|
1747
|
+
let n3 = T2(t3, A2.current.coords, q2, Y2, b2, E2), o3 = true;
|
|
1748
|
+
n3 && 0 !== n3.width && 0 !== n3.height || (n3 = { x: 0, y: 0, width: q2, height: q2 }, o3 = false);
|
|
1749
1749
|
const r3 = t3.getZoom(), i2 = { containerBounds: { x: 0, y: 0, width: n3.width / r3, height: n3.height / r3 }, setNaturalDimensions: M2, zoom: r3 };
|
|
1750
1750
|
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,
|
|
1751
|
+
}, [r2, b2, j2, q2, Y2, E2, v2, y2]), startEdit: i((e5) => {
|
|
1752
1752
|
W2({ eventType: "start", startEvent: e5 });
|
|
1753
1753
|
}, []), submitEdit: i(() => {
|
|
1754
1754
|
W2({ eventType: "submit" });
|
|
1755
1755
|
}, []), cancelEdit: i(() => {
|
|
1756
1756
|
W2({ eventType: "cancel" });
|
|
1757
|
-
}, []), onKeyboardEvent:
|
|
1757
|
+
}, []), onKeyboardEvent: K2, onPointerEvent: N2, onKeyboardEventNative: U2, onPointerEventNative: H2, isEditing: _2 };
|
|
1758
1758
|
}, 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
1759
|
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
1760
|
b2.current = I2(e6), w2(b2.current, v2.current);
|
|
@@ -1804,7 +1804,7 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
|
|
|
1804
1804
|
if (0 === t3) return o2;
|
|
1805
1805
|
r2 ? o2 += t3 : o2 -= t3;
|
|
1806
1806
|
}
|
|
1807
|
-
},
|
|
1807
|
+
}, Kn = (e5, t2, n2) => {
|
|
1808
1808
|
const o2 = [];
|
|
1809
1809
|
let r2 = t2;
|
|
1810
1810
|
for (; r2 <= n2; ) {
|
|
@@ -1812,7 +1812,7 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
|
|
|
1812
1812
|
0 === t3 ? (o2.push(r2), r2++) : r2 += t3;
|
|
1813
1813
|
}
|
|
1814
1814
|
return o2;
|
|
1815
|
-
},
|
|
1815
|
+
}, qn = (e5, t2, n2, o2, r2, i2) => {
|
|
1816
1816
|
if (!t2) return i2;
|
|
1817
1817
|
let { rowIndex: l2, colIndex: s2 } = e5;
|
|
1818
1818
|
switch (o2) {
|
|
@@ -1879,7 +1879,7 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
|
|
|
1879
1879
|
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
1880
|
const a2 = t2(e5), d2 = t2(l2);
|
|
1881
1881
|
var u2, h2;
|
|
1882
|
-
return (h2 = d2, !(u2 = a2) && !h2 || !u2 && h2 || u2 && !h2 ?
|
|
1882
|
+
return (h2 = d2, !(u2 = a2) && !h2 || !u2 && h2 || u2 && !h2 ? qn : Yn)(e5, t2, n2, o2, false, i2) ?? i2;
|
|
1883
1883
|
}, Gn = (e5, t2) => `${e5}:${t2}`, Zn = (e5, t2, n2, o2, r2, i2) => {
|
|
1884
1884
|
if (n2 - t2 >= r2 - o2) return o2;
|
|
1885
1885
|
let l2 = o2;
|
|
@@ -2109,8 +2109,8 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2109
2109
|
}, xo = (e5, t2, n2) => {
|
|
2110
2110
|
const o2 = e5.getVisibleRangeCoords(), r2 = e5.getScrollOrientation();
|
|
2111
2111
|
!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(
|
|
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: K2, selectionRenderer: q2 = 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 }) => {
|
|
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(q2, [q2]), 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
2114
|
u(Me.throttle(() => {
|
|
2115
2115
|
me2((e5) => {
|
|
2116
2116
|
ve2.current = true;
|
|
@@ -2190,13 +2190,13 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2190
2190
|
});
|
|
2191
2191
|
}, []), Ue2 = () => {
|
|
2192
2192
|
be2(wo);
|
|
2193
|
-
},
|
|
2193
|
+
}, Ke2 = "touch" === Ut.detectIt().primaryInput, qe2 = l(null), Ye2 = l(null), Xe2 = l(null), Ge2 = d(() => ({ onPointerDown: (e5) => {
|
|
2194
2194
|
if (!t2 || !t2.current) return false;
|
|
2195
2195
|
const n3 = e5.nativeEvent, o3 = t2.current.getViewFromClient(n3.clientX, n3.clientY);
|
|
2196
2196
|
if ("touch" === n3.pointerType || "touchstart" === n3.type) return Ye2.current = { topLeft: o3.getScrollTopLeft(), point: { x: n3.clientX, y: n3.clientY } }, true;
|
|
2197
2197
|
const r3 = o3.getCellCoordsFromClient(e5.nativeEvent.clientX, e5.nativeEvent.clientY);
|
|
2198
2198
|
if (!r3) return false;
|
|
2199
|
-
|
|
2199
|
+
qe2.current = { anchor: o3.getAnchor(), coords: r3 }, Ae2.current = null;
|
|
2200
2200
|
const i2 = e5.nativeEvent.which === Ct;
|
|
2201
2201
|
if (i2) {
|
|
2202
2202
|
if (-1 !== ne.indexOfCoords(r3, xe2.ranges)) return false;
|
|
@@ -2222,10 +2222,10 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2222
2222
|
}, onPointerMoveOrWait: Me.throttle((e5, n3) => {
|
|
2223
2223
|
if (!t2?.current) return;
|
|
2224
2224
|
if ("touch" === e5.pointerType || "touchmove" === e5.type) return;
|
|
2225
|
-
if (!
|
|
2226
|
-
const o3 =
|
|
2225
|
+
if (!qe2.current) return;
|
|
2226
|
+
const o3 = qe2.current.anchor;
|
|
2227
2227
|
let r3 = t2.current.getViewFromLocation(o3), i2 = r3.getCellCoordsFromClient(e5.clientX, e5.clientY);
|
|
2228
|
-
if (!ne.isEqualCells(i2,
|
|
2228
|
+
if (!ne.isEqualCells(i2, qe2.current?.coords) && (qe2.current = { anchor: o3, coords: i2 }, i2 && false !== j2?.(e5, i2, ye2.current))) {
|
|
2229
2229
|
if (Pe2.current) {
|
|
2230
2230
|
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
2231
|
if (Fe2(t3) || Fe2(n4)) return;
|
|
@@ -2235,7 +2235,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2235
2235
|
Xe2.current = n3, xo(r3, i2, t2);
|
|
2236
2236
|
}
|
|
2237
2237
|
}, 60), onPointerUp: (e5) => {
|
|
2238
|
-
if (
|
|
2238
|
+
if (qe2.current = null, "touch" === e5.pointerType || "touchend" === e5.type) {
|
|
2239
2239
|
if (Ye2.current) {
|
|
2240
2240
|
const e6 = t2.current.getViewFromClient(Ye2.current.point.x, Ye2.current.point.y), n4 = e6.getScrollTopLeft();
|
|
2241
2241
|
if (n4.left === Ye2.current.topLeft.left && n4.top === Ye2.current.topLeft.top) {
|
|
@@ -2243,7 +2243,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2243
2243
|
He2(t3);
|
|
2244
2244
|
}
|
|
2245
2245
|
}
|
|
2246
|
-
return Ye2.current = null, void (
|
|
2246
|
+
return Ye2.current = null, void (qe2.current = null);
|
|
2247
2247
|
}
|
|
2248
2248
|
try {
|
|
2249
2249
|
p2?.(ye2.current, e5);
|
|
@@ -2274,7 +2274,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2274
2274
|
e5.stopPropagation(), e5.preventDefault(), e5.nativeEvent.stopImmediatePropagation();
|
|
2275
2275
|
const d2 = o3 ?? t2.current.getViewFromClient(e5.nativeEvent.clientX, e5.nativeEvent.clientY), u2 = r3 ?? d2.getCellCoordsFromClient(e5.nativeEvent.clientX, e5.nativeEvent.clientY);
|
|
2276
2276
|
if (!u2) return false;
|
|
2277
|
-
|
|
2277
|
+
qe2.current = { anchor: d2.getAnchor(), coords: u2 }, Ae2.current = null;
|
|
2278
2278
|
const h2 = e5.nativeEvent.which === Ct;
|
|
2279
2279
|
if (h2) {
|
|
2280
2280
|
if (-1 !== ne.indexOfCoords(u2, xe2.ranges)) return false;
|
|
@@ -2299,10 +2299,10 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2299
2299
|
l2 && Be2(u2), b3 && 0 === xe2.ranges.length || He2(u2);
|
|
2300
2300
|
}, onSelectionPointerMoveOrWait: (e5, n3, o3, r3, i2, l2 = xe2.cell, s2 = true, c3 = false) => {
|
|
2301
2301
|
if (!t2?.current) return;
|
|
2302
|
-
if (e5.stopPropagation(), e5.preventDefault(), e5.stopImmediatePropagation(), !
|
|
2303
|
-
const a3 =
|
|
2302
|
+
if (e5.stopPropagation(), e5.preventDefault(), e5.stopImmediatePropagation(), !qe2.current) return;
|
|
2303
|
+
const a3 = qe2.current.anchor;
|
|
2304
2304
|
let d2 = r3 ?? t2.current.getViewFromLocation(a3), u2 = i2 ?? d2.getCellCoordsFromClient(e5.clientX, e5.clientY);
|
|
2305
|
-
if (!ne.isEqualCells(u2,
|
|
2305
|
+
if (!ne.isEqualCells(u2, qe2.current?.coords) && (qe2.current = { anchor: a3, coords: u2 }, u2 && false !== j2?.(e5, u2, ye2.current))) {
|
|
2306
2306
|
if (Pe2.current) {
|
|
2307
2307
|
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
2308
|
if (Fe2(t3) || Fe2(n4)) return;
|
|
@@ -2312,7 +2312,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2312
2312
|
s2 && xo(d2, u2, t2);
|
|
2313
2313
|
}
|
|
2314
2314
|
}, onPointerUp: (e5) => {
|
|
2315
|
-
|
|
2315
|
+
qe2.current = null, e5.stopPropagation(), e5.preventDefault(), e5.stopImmediatePropagation();
|
|
2316
2316
|
try {
|
|
2317
2317
|
p2?.(ye2.current, e5);
|
|
2318
2318
|
} catch (e6) {
|
|
@@ -2544,9 +2544,9 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2544
2544
|
Qe2(E, false, true);
|
|
2545
2545
|
}, []), Nt2 = i(() => {
|
|
2546
2546
|
Qe2(E, true, true);
|
|
2547
|
-
}, []),
|
|
2547
|
+
}, []), Kt2 = i(() => {
|
|
2548
2548
|
be2((e5) => e5.slice(0, -1));
|
|
2549
|
-
}, []),
|
|
2549
|
+
}, []), qt2 = d(() => {
|
|
2550
2550
|
const e5 = ie2();
|
|
2551
2551
|
return ((e6, t3, n3, o3, r3) => {
|
|
2552
2552
|
for (let i2 = 0; i2 < e6.length; i2++) {
|
|
@@ -2653,7 +2653,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2653
2653
|
};
|
|
2654
2654
|
if (!nn2.current) return void o3();
|
|
2655
2655
|
const r3 = nn2.current.range, i2 = en2;
|
|
2656
|
-
U2?.(r3, e5, n3), Promise.resolve(r3 && i2 &&
|
|
2656
|
+
U2?.(r3, e5, n3), Promise.resolve(r3 && i2 && K2?.(r3, i2, e5, n3)).finally(() => {
|
|
2657
2657
|
o3();
|
|
2658
2658
|
});
|
|
2659
2659
|
} }), [en2]), rn2 = hn(on2), ln2 = d(() => ({ onPointerDown: rn2 }), [rn2]), sn2 = l(null), cn2 = d(() => {
|
|
@@ -2731,7 +2731,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2731
2731
|
let h2 = null;
|
|
2732
2732
|
!R2 && o3 && !en2 && (h2 = f(uo, { ...o3, corner: r3, size: 7.5, borderStroke: `${P2} solid`, style: { borderRadius: 1 }, background: Q2, ...Qt2, key: "fillHandle" }));
|
|
2733
2733
|
const p3 = [...i2];
|
|
2734
|
-
if (d2 && p3.push(d2), u2 && p3.push(u2), h2 && p3.push(h2), !oe2 &&
|
|
2734
|
+
if (d2 && p3.push(d2), u2 && p3.push(u2), h2 && p3.push(h2), !oe2 && Ke2 && 1 === c3?.ranges.length && c3.ranges[c3.ranges.length - 1]) {
|
|
2735
2735
|
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
2736
|
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
2737
|
}
|
|
@@ -2748,11 +2748,11 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2748
2748
|
}, []);
|
|
2749
2749
|
return d(() => {
|
|
2750
2750
|
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:
|
|
2751
|
+
}, [n2]), { selection: cn2, setSelectionCell: Yt2, setSelectionRanges: be2, overlay: an2, cursor: Ee2, onPointerDown: Ze2, clearLastSelection: Kt2, newSelection: He2, modifySelection: We2, appendSelection: Ne2, clearSelections: Ue2, isEntire: qt2, navigate: Qe2, navigateSelection: et2 };
|
|
2752
|
+
}, bo = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, 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) => {
|
|
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: K2, overlayRenderer: q2, 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
2754
|
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(
|
|
2755
|
+
const he2 = Tt(L2, [L2]), fe2 = Tt(U2, [U2]), pe2 = Tt(O2, [O2]), ge2 = Tt(se2, [se2]), we2 = Tt(K2, [K2]), 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
2756
|
const e5 = P2 || Oe2;
|
|
2757
2757
|
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
2758
|
}, [Oe2, P2, ie2]), ze2 = (e5, t2, n2) => {
|
|
@@ -2774,12 +2774,12 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2774
2774
|
if (t2 > 0) {
|
|
2775
2775
|
const l3 = ze2(De2, { top: n2 + De2.getRowOffset(0) }), s3 = De2.getRowIndex(o3), c4 = De2.getRowIndex(r3 - 1);
|
|
2776
2776
|
let a4;
|
|
2777
|
-
e5[1] = { minIndex: s3, maxIndex: c4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: i2, visibleIndices: () => a4 || (a4 = Object.freeze(
|
|
2777
|
+
e5[1] = { minIndex: s3, maxIndex: c4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: i2, visibleIndices: () => a4 || (a4 = Object.freeze(Kn($e2, s3, c4)), a4), layout: l3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
|
|
2778
2778
|
}
|
|
2779
2779
|
const l2 = Math.max(0, Ve2 - i2), s2 = ze2(De2, { top: Ce2 + i2 }), c3 = s2.getRowIndex(0), a3 = s2.getRowIndex(l2);
|
|
2780
2780
|
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]),
|
|
2781
|
+
return e5[0] = { minIndex: c3, maxIndex: a3, minCoord: t2, maxCoord: w2 - 1, minBounds: i2, maxBounds: l2, visibleIndices: () => d2 || (d2 = Object.freeze(Kn($e2, c3, a3)), d2), layout: s2, maxVirtualBounds: De2.getRowOffset(w2), scrollOffset: Ce2, freezeOffset: (t2 > 0 ? De2.getRowOffset(t2) : 0) - n2 }, e5;
|
|
2782
|
+
}, [De2.getRowIndex, De2.getRowOffset, $e2, Ve2, w2, V2, Ce2, ie2]), Ke2 = d(() => {
|
|
2783
2783
|
const e5 = [];
|
|
2784
2784
|
let t2 = 0, n2 = 0;
|
|
2785
2785
|
"number" == typeof j2 ? t2 = j2 : (t2 = j2.index ?? 0, n2 = (j2.scrollOffset ?? 0) * ie2);
|
|
@@ -2787,19 +2787,19 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2787
2787
|
if (t2 > 0) {
|
|
2788
2788
|
const l3 = ze2(De2, { left: n2 + De2.getColOffset(0) }), s3 = De2.getColIndex(o3), c4 = De2.getColIndex(r3 - 1);
|
|
2789
2789
|
let a4;
|
|
2790
|
-
e5[1] = { minIndex: s3, maxIndex: c4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: i2, visibleIndices: () => a4 || (a4 = Object.freeze(
|
|
2790
|
+
e5[1] = { minIndex: s3, maxIndex: c4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: i2, visibleIndices: () => a4 || (a4 = Object.freeze(Kn(Fe2, s3, c4)), a4), layout: l3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
|
|
2791
2791
|
}
|
|
2792
2792
|
const l2 = Math.max(0, je2 - i2), s2 = ze2(De2, { left: Te2 + i2 }), c3 = s2.getColIndex(0), a3 = s2.getColIndex(l2);
|
|
2793
2793
|
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]),
|
|
2794
|
+
return e5[0] = { minIndex: c3, maxIndex: a3, minCoord: t2, maxCoord: m2 - 1, minBounds: i2, maxBounds: l2, visibleIndices: () => d2 || (d2 = Object.freeze(Kn(Fe2, c3, a3)), d2), layout: s2, maxVirtualBounds: De2.getColOffset(m2), scrollOffset: Te2, freezeOffset: (t2 > 0 ? De2.getColOffset(t2) : 0) - n2 }, e5;
|
|
2795
|
+
}, [De2.getColIndex, De2.getColOffset, Fe2, je2, m2, j2, Te2, ie2]), qe2 = l({}), Ye2 = l([]), Xe2 = d(() => {
|
|
2796
2796
|
let e5 = {};
|
|
2797
2797
|
const t2 = (t3, n3, o3, r3, i2) => {
|
|
2798
2798
|
const l2 = { vertical: r3?.vertical || false, horizontal: r3?.horizontal || false };
|
|
2799
|
-
if (t3 >=
|
|
2800
|
-
const s2 = { rowStart: Ue2[n3].minIndex, colStart:
|
|
2799
|
+
if (t3 >= Ke2.length || n3 >= Ue2.length) return null;
|
|
2800
|
+
const s2 = { rowStart: Ue2[n3].minIndex, colStart: Ke2[t3].minIndex, rowEnd: Ue2[n3].maxIndex, colEnd: Ke2[t3].maxIndex };
|
|
2801
2801
|
if (s2.rowStart > s2.rowEnd || s2.colStart > s2.colEnd) return null;
|
|
2802
|
-
const c3 = { getColIndex: (e6) =>
|
|
2802
|
+
const c3 = { getColIndex: (e6) => Ke2[t3].layout.getColIndex(e6), getColOffset: (e6) => Ke2[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: Ke2[t3].minBounds, y: Ue2[n3].minBounds, width: Ke2[t3].maxBounds, height: Ue2[n3].maxBounds }), u2 = (e6, t4) => oo(c3, e6 ?? s2, t4), h2 = { width: Ke2[t3].maxVirtualBounds, height: Ue2[n3].maxVirtualBounds }, f2 = { left: Ke2[t3].scrollOffset, top: Ue2[n3].scrollOffset }, p2 = { left: Ke2[t3].freezeOffset, top: Ue2[n3].freezeOffset }, g2 = { width: je2, height: Ve2 };
|
|
2803
2803
|
let w3 = null, m3 = null;
|
|
2804
2804
|
const x3 = (p2.top + (r3.vertical ? f2.top : 0)) / ie2, y3 = (p2.left + (r3.horizontal ? f2.left : 0)) / ie2;
|
|
2805
2805
|
return { getStage: () => me2.current ?? null, getVisibleRangeCoords: () => s2, toClipBounds: (e6, t4) => {
|
|
@@ -2812,7 +2812,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2812
2812
|
}, 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
2813
|
const n4 = tt2(e6, t4);
|
|
2814
2814
|
return { x: n4.x - d2.x, y: n4.y - d2.y };
|
|
2815
|
-
}, getLayout: () => c3, getCellCoordsAsRangeCoords: ce2, getVisibleColumns: () =>
|
|
2815
|
+
}, getLayout: () => c3, getCellCoordsAsRangeCoords: ce2, getVisibleColumns: () => Ke2[t3].visibleIndices(), getVisibleRows: () => Ue2[n3].visibleIndices(), getVisibleColumnOffsets: () => (w3 || (w3 = no(Ke2[t3].layout, true, Ke2[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: Ke2[t3].minCoord, colEnd: Ke2[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
2816
|
const o4 = tt2(e6, t4);
|
|
2817
2817
|
if (!o4) return null;
|
|
2818
2818
|
const r4 = c3.getColIndex(o4.x - d2.x), i3 = { rowIndex: c3.getRowIndex(o4.y - d2.y), colIndex: r4 };
|
|
@@ -2822,8 +2822,8 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2822
2822
|
}, getZoom: () => ie2, getAnchor: () => o3, getBounds: () => d2, getInsets: () => a3, getTotalSize: () => h2, getViewportSize: () => g2, getScrollTopLeft: () => f2, getFreezeTopLeft: () => p2, getScrollOrientation: () => l2, allViews: () => e5 };
|
|
2823
2823
|
};
|
|
2824
2824
|
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,
|
|
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), qe2.current = null, e5 = Object.freeze(e5);
|
|
2826
|
+
}, [Ue2, Ke2, ce2]), Ge2 = Object.keys(Xe2), Ze2 = Ke2[0]?.maxVirtualBounds ?? 0, Je2 = Ue2[0]?.maxVirtualBounds ?? 0, Qe2 = d(() => ({ left: Ke2[1] ? Ke2[1].layout.getColOffset(Ke2[1].maxIndex + 1) : 0, top: Ue2[1] ? Ue2[1].layout.getRowOffset(Ue2[1].maxIndex + 1) : 0 }), [Xe2]);
|
|
2827
2827
|
s(() => {
|
|
2828
2828
|
if (Ye2.current.length > 0) {
|
|
2829
2829
|
for (let e5 = 0; e5 < Ye2.current.length; e5++) Ye2.current[e5]();
|
|
@@ -2860,7 +2860,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2860
2860
|
return Ie2.current = t2, t2;
|
|
2861
2861
|
});
|
|
2862
2862
|
}, []), 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(
|
|
2863
|
+
const t2 = e5?.left ?? e5?.[0], n2 = e5?.top ?? e5?.[1], o3 = void 0 !== t2 ? Math.min(Ze2 - je2, Math.max(Ke2?.[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
2864
|
if (Ie2.current.left === o3 && Ie2.current.top === r3) return;
|
|
2865
2865
|
let i2 = null, l2 = null;
|
|
2866
2866
|
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 +2869,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2869
2869
|
return Ie2.current = t3, t3;
|
|
2870
2870
|
});
|
|
2871
2871
|
}, 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,
|
|
2872
|
+
}, [Ze2, Je2, Ue2, Ke2]);
|
|
2873
2873
|
s(() => {
|
|
2874
2874
|
_e2.current || ct2({ left: Te2, top: Ce2 });
|
|
2875
2875
|
}, [Ze2, je2, Je2, Ve2]), u(() => {
|
|
@@ -2919,22 +2919,22 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2919
2919
|
ye2.current = null, at2(c3 ? { left: l2 } : { top: s2 });
|
|
2920
2920
|
});
|
|
2921
2921
|
}, [Ze2, je2, Je2, Ve2, ge2]), ft2 = i((e5 = null) => {
|
|
2922
|
-
Le2.current = null,
|
|
2922
|
+
Le2.current = null, qe2.current = null, be2();
|
|
2923
2923
|
}, []);
|
|
2924
2924
|
u(() => {
|
|
2925
2925
|
ft2();
|
|
2926
2926
|
}, [N2]);
|
|
2927
|
-
const pt2 =
|
|
2927
|
+
const pt2 = qt(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
2928
|
Ye2.current.push(e5);
|
|
2929
2929
|
} }), [w2, m2, Xe2]);
|
|
2930
2930
|
s(() => (le2 && pt2.current?.addEventListener("wheel", ht2, { passive: false }), Pe2.current = true, _e2.current = null, () => {
|
|
2931
2931
|
pt2.current?.removeEventListener("wheel", ht2);
|
|
2932
2932
|
}), [le2]);
|
|
2933
2933
|
const gt2 = l([]), wt2 = (t2, n2) => {
|
|
2934
|
-
if (!t2 || !
|
|
2934
|
+
if (!t2 || !q2) return;
|
|
2935
2935
|
gt2.current = [];
|
|
2936
2936
|
n2.push(((t3, o3) => {
|
|
2937
|
-
const r3 = `view:${t3.getAnchor()}:overlay:${n2.length}`, i2 =
|
|
2937
|
+
const r3 = `view:${t3.getAnchor()}:overlay:${n2.length}`, i2 = q2?.({ key: r3, view: t3 }, (e5) => gt2.current[o3] = e5);
|
|
2938
2938
|
if (!i2) return null;
|
|
2939
2939
|
const l2 = t3.getBounds();
|
|
2940
2940
|
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 +2946,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2946
2946
|
wt2(Xe2[o3], r3), e5[o3] = { overlays: r3 };
|
|
2947
2947
|
}
|
|
2948
2948
|
return e5;
|
|
2949
|
-
}, [ve2,
|
|
2949
|
+
}, [ve2, q2, w2, m2, Ue2, Ke2]), xt2 = (t2, n2, o3, r3, i2, l2, s2) => {
|
|
2950
2950
|
if (!t2) return;
|
|
2951
2951
|
const c3 = t2.getVisibleColumns(), a3 = t2.getVisibleRows();
|
|
2952
2952
|
if (0 === c3.length || 0 === a3.length) return;
|
|
@@ -3014,7 +3014,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
3014
3014
|
xt2(Xe2[i2], c3, l2, s2, /* @__PURE__ */ new Set(), e5, t2), n2[i2] = { cells: c3, rangesH: l2, rangesV: s2 };
|
|
3015
3015
|
}
|
|
3016
3016
|
return Le2.current = t2, n2;
|
|
3017
|
-
}, [ve2, w2, m2, Ue2,
|
|
3017
|
+
}, [ve2, w2, m2, Ue2, Ke2, D2, de2, B2, oe2, re2, ce2]), vt2 = (t2, n2, o3, r3, i2) => {
|
|
3018
3018
|
if (t2) if (n2) {
|
|
3019
3019
|
const e5 = `view:${t2.getAnchor()}:hl:`, n3 = t2.getVisibleRows();
|
|
3020
3020
|
if (!n3 || 0 === n3.length) return;
|
|
@@ -3076,7 +3076,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
3076
3076
|
n2[r3] = e("svg", { width: `${c3}`, height: `${a3}`, viewBox: `0 0 ${c3} ${a3}`, preserveAspectRatio: "none", shapeRendering: "crispEdges", style: { position: "absolute" }, children: l2 });
|
|
3077
3077
|
}
|
|
3078
3078
|
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,
|
|
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, Ke2, 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
3080
|
const o3 = [], r3 = (e5) => {
|
|
3081
3081
|
if (!e5 || !Xe2[e5]) return;
|
|
3082
3082
|
const n2 = Xe2[e5].getBounds();
|
|
@@ -3099,12 +3099,12 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
3099
3099
|
if (!r3) return;
|
|
3100
3100
|
const i3 = r3.getBounds(), l3 = r3.getInsets(), s3 = r3.getAnchor();
|
|
3101
3101
|
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 =
|
|
3102
|
+
}, o3 = qe2.current, i2 = {}, l2 = [], s2 = Object.keys(Xe2);
|
|
3103
3103
|
for (let e6 = 0; e6 < s2.length; e6++) {
|
|
3104
3104
|
const t2 = s2[e6], r3 = o3?.[t2], c3 = i2[t2] = /* @__PURE__ */ new Map();
|
|
3105
3105
|
l2.push(n2(r3, c3, Xe2[t2]));
|
|
3106
3106
|
}
|
|
3107
|
-
return
|
|
3107
|
+
return qe2.current = i2, l2;
|
|
3108
3108
|
}, [ve2, Xe2, Z2, X2]), kt2 = d(() => {
|
|
3109
3109
|
const { style: t2, ...n2 } = J2 ?? {};
|
|
3110
3110
|
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 +3206,20 @@ const jo = (e5 = void 0) => Object.freeze({ clean: e5, dirty: void 0, editMode:
|
|
|
3206
3206
|
let j2 = 2;
|
|
3207
3207
|
const V2 = 96 * A2 / 72, W2 = 1.2 * V2;
|
|
3208
3208
|
"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,
|
|
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, K2] = h(N2);
|
|
3210
3210
|
u(() => {
|
|
3211
|
-
|
|
3211
|
+
K2(N2());
|
|
3212
3212
|
}, [w2, H2]), u(() => {
|
|
3213
3213
|
m2?.({ width: "wrap" === D2 ? void 0 : H2.width + j2, height: H2.height });
|
|
3214
3214
|
}, [H2, m2]);
|
|
3215
|
-
const
|
|
3215
|
+
const q2 = Tt(a2, [a2]), Y2 = Tt((e5) => {
|
|
3216
3216
|
if (k2.dirty === e5) return;
|
|
3217
3217
|
const t3 = { ...k2 };
|
|
3218
|
-
t3.dirty = e5, M2.current, R2(t3),
|
|
3218
|
+
t3.dirty = e5, M2.current, R2(t3), q2?.(t3);
|
|
3219
3219
|
}, [k2]), X2 = Tt((e5) => {
|
|
3220
3220
|
if (k2.editMode === e5) return;
|
|
3221
3221
|
const t3 = { ...k2 };
|
|
3222
|
-
t3.editMode = e5, R2(t3),
|
|
3222
|
+
t3.editMode = e5, R2(t3), q2?.(t3);
|
|
3223
3223
|
}, [k2]), G2 = Tt(() => {
|
|
3224
3224
|
try {
|
|
3225
3225
|
return f2?.(k2), g2?.(), true;
|
|
@@ -3232,7 +3232,7 @@ const jo = (e5 = void 0) => Object.freeze({ clean: e5, dirty: void 0, editMode:
|
|
|
3232
3232
|
if (!M2.current) return;
|
|
3233
3233
|
if (e5.isDefaultPrevented(), !(e5.isTrusted || e5.nativeEvent.ctrlKey || e5.nativeEvent.metaKey || e5.nativeEvent.altKey || e5.nativeEvent.isComposing) && -1 !== $n.indexOf(e5.nativeEvent.key)) {
|
|
3234
3234
|
const t4 = { ...k2 };
|
|
3235
|
-
return t4.dirty = "Backspace" === e5.nativeEvent.key ? "" : (t4.dirty ?? "") + e5.key, R2(t4),
|
|
3235
|
+
return t4.dirty = "Backspace" === e5.nativeEvent.key ? "" : (t4.dirty ?? "") + e5.key, R2(t4), q2?.(t4), void e5.preventDefault();
|
|
3236
3236
|
}
|
|
3237
3237
|
const t3 = e5.nativeEvent.shiftKey;
|
|
3238
3238
|
if (e5.which === vt) return e5.preventDefault(), void Z2();
|
|
@@ -3259,7 +3259,7 @@ const jo = (e5 = void 0) => Object.freeze({ clean: e5, dirty: void 0, editMode:
|
|
|
3259
3259
|
s(() => {
|
|
3260
3260
|
ee2(false);
|
|
3261
3261
|
}, []);
|
|
3262
|
-
const te2 =
|
|
3262
|
+
const te2 = qt(n2, () => ({ startEdit(e5) {
|
|
3263
3263
|
let t3 = e5?.initialSelection;
|
|
3264
3264
|
if (!t3) {
|
|
3265
3265
|
const e6 = M2.current.value.length ?? 0;
|
|
@@ -3267,7 +3267,7 @@ const jo = (e5 = void 0) => Object.freeze({ clean: e5, dirty: void 0, editMode:
|
|
|
3267
3267
|
}
|
|
3268
3268
|
M2.current?.setSelectionRange(t3.start, t3.end, t3.direction);
|
|
3269
3269
|
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),
|
|
3270
|
+
void 0 !== e5?.text && (n3.dirty = e5.text), n3.editMode === o2.editMode && n3.dirty === o2.dirty || (R2(n3), q2?.(n3));
|
|
3271
3271
|
}, submitEdit: () => G2(), cancelEdit() {
|
|
3272
3272
|
Z2();
|
|
3273
3273
|
}, autoFocus() {
|