@sheetxl/grid-react 0.3.2 → 0.3.3
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 -6
- package/browser/esm/index.mjs +196 -196
- package/licenses/dependencies.txt +22 -22
- package/node/assets/style.css +1 -1
- package/node/esm/index.mjs +92 -92
- 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.3.
|
|
2
|
+
* @license @sheetxl/grid-react - Grid - Advanced data grid component for React - v0.3.3
|
|
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.
|
|
@@ -14,7 +14,7 @@ import { unstable_batchedUpdates as y, createPortal as v } from "react-dom";
|
|
|
14
14
|
import b from "tiny-invariant";
|
|
15
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 });
|
|
16
16
|
Object.freeze(Object.defineProperty({ __proto__: null, EmptyBounds: z, EmptyRect: D, EmptyTopLeft: L }, Symbol.toStringTag, { value: "Module" }));
|
|
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,
|
|
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, 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) => {
|
|
18
18
|
if (e5 === t2) return true;
|
|
19
19
|
if (!e5 || !t2) return false;
|
|
20
20
|
if (e5.length !== t2.length) return false;
|
|
@@ -43,7 +43,7 @@ function te(e5, t2 = 2, n2, o2 = $, r2) {
|
|
|
43
43
|
if (t2 <= 0 || e5.length <= 1) return i2;
|
|
44
44
|
let l2 = o2 === A, s2 = 0, c2 = false;
|
|
45
45
|
do {
|
|
46
|
-
const e6 = i2.sort(
|
|
46
|
+
const e6 = i2.sort(K(l2 ? $ : A));
|
|
47
47
|
i2 = [], i2.push(e6[0]);
|
|
48
48
|
const t3 = e6.length;
|
|
49
49
|
let a2 = 0, d2 = e6[0], u2 = d2.colStart, h2 = d2.rowStart, f2 = d2.colEnd, p2 = d2.rowEnd;
|
|
@@ -86,7 +86,7 @@ const ne = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: B,
|
|
|
86
86
|
const h2 = t2 ? s2 : c2, f2 = t2 ? c2 : s2;
|
|
87
87
|
o2 = { colStart: h2, rowStart: f2, colEnd: h2, rowEnd: f2 }, u2 && (o2.value = a2), i2 = s2, l2 = c2, r2 = a2;
|
|
88
88
|
}, done: (e6) => (o2 && (n2.push(o2), o2 = null), e6 ? te(n2, 3, true === e6 ? ee : e6, t2 ? A : $, Q) : n2) };
|
|
89
|
-
}, createRangeComparator:
|
|
89
|
+
}, 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) => {
|
|
90
90
|
if (!t2 || 0 === t2.length) return e5;
|
|
91
91
|
let n2 = e5, o2 = null;
|
|
92
92
|
for (; !Y(n2, o2); ) o2 = n2, n2 = J(o2, t2);
|
|
@@ -103,7 +103,7 @@ const ne = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: B,
|
|
|
103
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);
|
|
104
104
|
let s2 = n2;
|
|
105
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;
|
|
106
|
-
}, 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: 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) => {
|
|
107
107
|
if (!e5 || 0 === e5.length) return null;
|
|
108
108
|
if (1 === e5.length && !t2) return e5[0];
|
|
109
109
|
let o2 = e5[0];
|
|
@@ -613,7 +613,7 @@ const We = async (e5, t2 = R) => new Promise(async (n2, o2) => {
|
|
|
613
613
|
console.warn("Can't parse html from clipboard.");
|
|
614
614
|
}
|
|
615
615
|
return o2;
|
|
616
|
-
}, Ne = "clipboard-uuid", Ue = "web text/uuid",
|
|
616
|
+
}, Ne = "clipboard-uuid", Ue = "web text/uuid", Ke = (e5) => `<div style="display:none" ${Ne}="${e5}"/>`, qe = (e5, t2) => {
|
|
617
617
|
let n2 = null;
|
|
618
618
|
try {
|
|
619
619
|
const o2 = new DOMParser().parseFromString(t2, R);
|
|
@@ -691,13 +691,13 @@ class Xe {
|
|
|
691
691
|
t2._state = { uuid: o2, ref: e5.ref, items: n2 }, t2.dispatchEvent(new Event("clipboardwrite")), t2.dispatchEvent(new Event("clipboardchange"));
|
|
692
692
|
};
|
|
693
693
|
await je("clipboard-write", async () => {
|
|
694
|
-
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([Ke(o2)], { type: R }) })));
|
|
695
695
|
for (let e6 = 0; e6 < Math.min(1, r2.length); e6++) {
|
|
696
696
|
const t3 = r2[e6];
|
|
697
697
|
let i3 = t3.types.indexOf(R), l2 = null;
|
|
698
698
|
if (-1 !== i3) {
|
|
699
699
|
const e7 = await t3.getType(R);
|
|
700
|
-
l2 = await ke(e7), l2 && (l2 =
|
|
700
|
+
l2 = await ke(e7), l2 && (l2 = qe(o2, l2));
|
|
701
701
|
}
|
|
702
702
|
if (!l2 && t3.types.includes(P)) {
|
|
703
703
|
const e7 = await t3.getType(P);
|
|
@@ -710,7 +710,7 @@ class Xe {
|
|
|
710
710
|
const e7 = await t3.getType(O), n3 = Te(await e7.arrayBuffer());
|
|
711
711
|
l2 = `<div ${Ne}="${o2}"><img src="${Re + n3}"/></div>`;
|
|
712
712
|
}
|
|
713
|
-
!l2 && o2 && (l2 =
|
|
713
|
+
!l2 && o2 && (l2 = Ke(o2));
|
|
714
714
|
const s2 = new Blob([l2 ?? ""], { type: R }), c2 = {};
|
|
715
715
|
for (let e7 = 0; e7 < t3.types.length; e7++) {
|
|
716
716
|
const n3 = t3.types[e7];
|
|
@@ -861,25 +861,25 @@ const Ot = r(a((n2, o2) => {
|
|
|
861
861
|
const e5 = H2.current;
|
|
862
862
|
H2.current = null, r2 !== e5 && (M2.current[A2] = r2);
|
|
863
863
|
}, [r2, A2]);
|
|
864
|
-
const U2 = l(null),
|
|
865
|
-
U2.current && (clearTimeout(U2.current), U2.current = null,
|
|
864
|
+
const U2 = l(null), K2 = l(null), q2 = i(() => {
|
|
865
|
+
U2.current && (clearTimeout(U2.current), U2.current = null, K2.current = null);
|
|
866
866
|
}, []), Y2 = i((e5, t2, n3, o3 = b2) => {
|
|
867
|
-
|
|
868
|
-
const t3 = n3 ? V2(
|
|
869
|
-
t3 !==
|
|
867
|
+
K2.current = e5, U2.current = setTimeout(() => {
|
|
868
|
+
const t3 = n3 ? V2(K2.current || e5) : W2(K2.current || e5);
|
|
869
|
+
t3 !== K2.current ? Y2(t3, false, n3, S2) : q2();
|
|
870
870
|
}, t2 ? 0 : o3);
|
|
871
|
-
}, [V2, W2,
|
|
872
|
-
s(() => () =>
|
|
871
|
+
}, [V2, W2, q2]);
|
|
872
|
+
s(() => () => q2(), [q2]);
|
|
873
873
|
const X2 = r2, G2 = d(() => {
|
|
874
874
|
if (!y2) return null;
|
|
875
|
-
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: q2, onMouseLeave: q2, onMouseDown: () => Y2(X2, true, true) };
|
|
876
876
|
return E2?.(e5);
|
|
877
877
|
}, [y2, p2, X2, F2, B2, $2]), Z2 = d(() => {
|
|
878
878
|
if (!y2) return null;
|
|
879
|
-
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: q2, onMouseLeave: q2, onMouseDown: () => Y2(X2, true, false) };
|
|
880
880
|
return _2?.(e5);
|
|
881
881
|
}, [y2, p2, X2, F2, B2, $2]);
|
|
882
|
-
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_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] });
|
|
883
883
|
}));
|
|
884
884
|
Ot.displayName = "Scrollbar";
|
|
885
885
|
let Lt = Date.now, Dt = {}, zt = 1;
|
|
@@ -1058,8 +1058,8 @@ const Ut = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProper
|
|
|
1058
1058
|
n2 = true, e5.stopPropagation();
|
|
1059
1059
|
}, isPropagationStopped: () => n2, persist: () => {
|
|
1060
1060
|
}, timeStamp: e5.timeStamp, type: e5.type };
|
|
1061
|
-
}, detectIt: Nt, focusableNodeNames: Wt, toPrettyKeyCode: (e5) => "BracketLeft" === e5 ? "[" : "BracketRight" === e5 ? "]" : Me.camelToPrettyCase(e5) }, Symbol.toStringTag, { value: "Module" })),
|
|
1062
|
-
function
|
|
1061
|
+
}, detectIt: Nt, focusableNodeNames: Wt, toPrettyKeyCode: (e5) => "BracketLeft" === e5 ? "[" : "BracketRight" === e5 ? "]" : Me.camelToPrettyCase(e5) }, Symbol.toStringTag, { value: "Module" })), Kt = [];
|
|
1062
|
+
function qt(e5, t2, n2 = Kt) {
|
|
1063
1063
|
const o2 = l(null);
|
|
1064
1064
|
return c(e5, () => {
|
|
1065
1065
|
if (!o2.current) return;
|
|
@@ -1074,7 +1074,7 @@ function Kt(e5, t2, n2 = qt) {
|
|
|
1074
1074
|
}, n2), o2;
|
|
1075
1075
|
}
|
|
1076
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) => {
|
|
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 =
|
|
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 = qt(r2, () => ({ isScrollPane: () => true }), []), _2 = l(null);
|
|
1078
1078
|
s(() => {
|
|
1079
1079
|
_2.current && (_2.current.__scrollTop === a2?.top && _2.current.__scrollLeft !== !a2?.left || _2.current?.scrollTo(a2?.left, a2?.top, false));
|
|
1080
1080
|
}, [a2?.left, a2?.top, y2]);
|
|
@@ -1125,7 +1125,7 @@ function Qt() {
|
|
|
1125
1125
|
const e6 = document.fullscreenElement;
|
|
1126
1126
|
if (!e6) return;
|
|
1127
1127
|
let t2 = e6.querySelector(".fullscreen-portal-root");
|
|
1128
|
-
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_1mjsr_4", e6.appendChild(t2));
|
|
1129
1129
|
}
|
|
1130
1130
|
return Jt++, e5(), document.addEventListener("fullscreenchange", e5), () => {
|
|
1131
1131
|
document.removeEventListener("fullscreenchange", e5), Jt--, Jt <= 0 && (document.querySelectorAll(".fullscreen-portal-root").forEach((e6) => {
|
|
@@ -1281,32 +1281,32 @@ r(a((n2, r2) => {
|
|
|
1281
1281
|
s(() => {
|
|
1282
1282
|
B2(un(f2, null === u2));
|
|
1283
1283
|
}, [f2, u2]);
|
|
1284
|
-
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, K2 = "row" === a2 ? j2 : V2, q2 = d(() => ((e5, t2, n3, o2) => {
|
|
1285
1285
|
const r3 = [null, null], i3 = [null, null];
|
|
1286
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) };
|
|
1287
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;
|
|
1288
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];
|
|
1289
1289
|
const p3 = Math.max(0, Math.min(100, l2 / s2 * 100));
|
|
1290
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` };
|
|
1291
|
-
})($2,
|
|
1291
|
+
})($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) => {
|
|
1292
1292
|
const t2 = un(e5, null === u2);
|
|
1293
1293
|
B2(t2);
|
|
1294
1294
|
}, [u2]), xe2 = Tt((e5) => {
|
|
1295
1295
|
if (I2 || !Y2) return;
|
|
1296
1296
|
const t2 = be2.current?.getBoundingClientRect();
|
|
1297
1297
|
let n3 = 0;
|
|
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(
|
|
1299
|
-
}, [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(K2, n3)), 1 === z2.fixedPaneOffset && (n3 = K2 - n3), f2 && $2.pixels === n3 || B2({ pixels: n3, percent: null }), Z2?.(n3), e5.stopPropagation(), e5.preventDefault();
|
|
1299
|
+
}, [z2, a2, I2, Y2, $2, K2]), ye2 = Tt((e5) => {
|
|
1300
1300
|
if (document.removeEventListener("pointermove", xe2), document.removeEventListener("touchmove", xe2), document.removeEventListener("pointerup", ye2), Y2 && (X2(false), $2)) {
|
|
1301
1301
|
if (J2($2.pixels), !un(f2, null === u2) || $2.pixels !== f2) {
|
|
1302
1302
|
const e6 = { ...$2 };
|
|
1303
|
-
null === e6.percent && (e6.percent = e6.pixels /
|
|
1303
|
+
null === e6.percent && (e6.percent = e6.pixels / K2 * 100), A2(e6);
|
|
1304
1304
|
}
|
|
1305
1305
|
e5.stopPropagation(), e5.preventDefault();
|
|
1306
1306
|
}
|
|
1307
|
-
}, [$2, Y2, f2, u2,
|
|
1307
|
+
}, [$2, Y2, f2, u2, K2]), ve2 = Tt((e5) => {
|
|
1308
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 }));
|
|
1309
|
-
}, [ge2]), be2 =
|
|
1309
|
+
}, [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]);
|
|
1310
1310
|
return t("div", { ref: m([F2, be2]), className: g("splitPane", "row" === a2 ? "vertical" : "horizontal", { dragging: Y2 }, E2), style: he2, children: [Ce2, Se2, Me2] });
|
|
1311
1311
|
}));
|
|
1312
1312
|
const fn = ({ initValue: e5, useHookBody: t2, applyStateChange: n2 }) => {
|
|
@@ -1726,23 +1726,23 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
|
|
|
1726
1726
|
W2({ eventType: "coordsChange", activeCoords: S2 });
|
|
1727
1727
|
}
|
|
1728
1728
|
}, [S2]);
|
|
1729
|
-
const
|
|
1729
|
+
const K2 = i((e5) => {
|
|
1730
1730
|
U2(e5.nativeEvent);
|
|
1731
|
-
}, []), { width:
|
|
1731
|
+
}, []), { width: q2 = 0, height: Y2 = 0 } = C2 ?? { width: 0, height: 0 }, X2 = Tt(r2, [r2]);
|
|
1732
1732
|
return { overlay: Tt((t3) => {
|
|
1733
1733
|
if (!A2.current || A2.current.isEditorClosed) return A2.current, null;
|
|
1734
1734
|
A2.current.coords;
|
|
1735
|
-
let n3 = T2(t3, A2.current.coords,
|
|
1736
|
-
n3 && 0 !== n3.width && 0 !== n3.height || (n3 = { x: 0, y: 0, width:
|
|
1735
|
+
let n3 = T2(t3, A2.current.coords, q2, Y2, b2, E2), o3 = true;
|
|
1736
|
+
n3 && 0 !== n3.width && 0 !== n3.height || (n3 = { x: 0, y: 0, width: q2, height: q2 }, o3 = false);
|
|
1737
1737
|
const r3 = t3.getZoom(), i2 = { containerBounds: { x: 0, y: 0, width: n3.width / r3, height: n3.height / r3 }, setNaturalDimensions: M2, zoom: r3 };
|
|
1738
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);
|
|
1739
|
-
}, [r2, b2, j2,
|
|
1739
|
+
}, [r2, b2, j2, q2, Y2, E2, v2, y2]), startEdit: i((e5) => {
|
|
1740
1740
|
W2({ eventType: "start", startEvent: e5 });
|
|
1741
1741
|
}, []), submitEdit: i(() => {
|
|
1742
1742
|
W2({ eventType: "submit" });
|
|
1743
1743
|
}, []), cancelEdit: i(() => {
|
|
1744
1744
|
W2({ eventType: "cancel" });
|
|
1745
|
-
}, []), onKeyboardEvent:
|
|
1745
|
+
}, []), onKeyboardEvent: K2, onPointerEvent: N2, onKeyboardEventNative: U2, onPointerEventNative: H2, isEditing: _2 };
|
|
1746
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 }) => {
|
|
1747
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) => {
|
|
1748
1748
|
b2.current = I2(e6), w2(b2.current, v2.current);
|
|
@@ -1792,7 +1792,7 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
|
|
|
1792
1792
|
if (0 === t3) return o2;
|
|
1793
1793
|
r2 ? o2 += t3 : o2 -= t3;
|
|
1794
1794
|
}
|
|
1795
|
-
},
|
|
1795
|
+
}, Kn = (e5, t2, n2) => {
|
|
1796
1796
|
const o2 = [];
|
|
1797
1797
|
let r2 = t2;
|
|
1798
1798
|
for (; r2 <= n2; ) {
|
|
@@ -1800,7 +1800,7 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
|
|
|
1800
1800
|
0 === t3 ? (o2.push(r2), r2++) : r2 += t3;
|
|
1801
1801
|
}
|
|
1802
1802
|
return o2;
|
|
1803
|
-
},
|
|
1803
|
+
}, qn = (e5, t2, n2, o2, r2, i2) => {
|
|
1804
1804
|
if (!t2) return i2;
|
|
1805
1805
|
let { rowIndex: l2, colIndex: s2 } = e5;
|
|
1806
1806
|
switch (o2) {
|
|
@@ -1867,7 +1867,7 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
|
|
|
1867
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 });
|
|
1868
1868
|
const a2 = t2(e5), d2 = t2(l2);
|
|
1869
1869
|
var u2, h2;
|
|
1870
|
-
return (h2 = d2, !(u2 = a2) && !h2 || !u2 && h2 || u2 && !h2 ?
|
|
1870
|
+
return (h2 = d2, !(u2 = a2) && !h2 || !u2 && h2 || u2 && !h2 ? qn : Yn)(e5, t2, n2, o2, false, i2) ?? i2;
|
|
1871
1871
|
}, Gn = (e5, t2) => `${e5}:${t2}`, Zn = (e5, t2, n2, o2, r2, i2) => {
|
|
1872
1872
|
if (n2 - t2 >= r2 - o2) return o2;
|
|
1873
1873
|
let l2 = o2;
|
|
@@ -2097,8 +2097,8 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2097
2097
|
}, xo = (e5, t2, n2) => {
|
|
2098
2098
|
const o2 = e5.getVisibleRangeCoords(), r2 = e5.getScrollOrientation();
|
|
2099
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);
|
|
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:
|
|
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(
|
|
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: 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 }) => {
|
|
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(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);
|
|
2102
2102
|
u(Me.throttle(() => {
|
|
2103
2103
|
me2((e5) => {
|
|
2104
2104
|
ve2.current = true;
|
|
@@ -2178,13 +2178,13 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2178
2178
|
});
|
|
2179
2179
|
}, []), Ue2 = () => {
|
|
2180
2180
|
be2(wo);
|
|
2181
|
-
},
|
|
2181
|
+
}, Ke2 = "touch" === Ut.detectIt().primaryInput, qe2 = l(null), Ye2 = l(null), Xe2 = l(null), Ge2 = d(() => ({ onPointerDown: (e5) => {
|
|
2182
2182
|
if (!t2 || !t2.current) return false;
|
|
2183
2183
|
const n3 = e5.nativeEvent, o3 = t2.current.getViewFromClient(n3.clientX, n3.clientY);
|
|
2184
2184
|
if ("touch" === n3.pointerType || "touchstart" === n3.type) return Ye2.current = { topLeft: o3.getScrollTopLeft(), point: { x: n3.clientX, y: n3.clientY } }, true;
|
|
2185
2185
|
const r3 = o3.getCellCoordsFromClient(e5.nativeEvent.clientX, e5.nativeEvent.clientY);
|
|
2186
2186
|
if (!r3) return false;
|
|
2187
|
-
|
|
2187
|
+
qe2.current = { anchor: o3.getAnchor(), coords: r3 }, Ae2.current = null;
|
|
2188
2188
|
const i2 = e5.nativeEvent.which === Ct;
|
|
2189
2189
|
if (i2) {
|
|
2190
2190
|
if (-1 !== ne.indexOfCoords(r3, xe2.ranges)) return false;
|
|
@@ -2210,10 +2210,10 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2210
2210
|
}, onPointerMoveOrWait: Me.throttle((e5, n3) => {
|
|
2211
2211
|
if (!t2?.current) return;
|
|
2212
2212
|
if ("touch" === e5.pointerType || "touchmove" === e5.type) return;
|
|
2213
|
-
if (!
|
|
2214
|
-
const o3 =
|
|
2213
|
+
if (!qe2.current) return;
|
|
2214
|
+
const o3 = qe2.current.anchor;
|
|
2215
2215
|
let r3 = t2.current.getViewFromLocation(o3), i2 = r3.getCellCoordsFromClient(e5.clientX, e5.clientY);
|
|
2216
|
-
if (!ne.isEqualCells(i2,
|
|
2216
|
+
if (!ne.isEqualCells(i2, qe2.current?.coords) && (qe2.current = { anchor: o3, coords: i2 }, i2 && false !== j2?.(e5, i2, ye2.current))) {
|
|
2217
2217
|
if (Pe2.current) {
|
|
2218
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 };
|
|
2219
2219
|
if (Fe2(t3) || Fe2(n4)) return;
|
|
@@ -2223,7 +2223,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2223
2223
|
Xe2.current = n3, xo(r3, i2, t2);
|
|
2224
2224
|
}
|
|
2225
2225
|
}, 60), onPointerUp: (e5) => {
|
|
2226
|
-
if (
|
|
2226
|
+
if (qe2.current = null, "touch" === e5.pointerType || "touchend" === e5.type) {
|
|
2227
2227
|
if (Ye2.current) {
|
|
2228
2228
|
const e6 = t2.current.getViewFromClient(Ye2.current.point.x, Ye2.current.point.y), n4 = e6.getScrollTopLeft();
|
|
2229
2229
|
if (n4.left === Ye2.current.topLeft.left && n4.top === Ye2.current.topLeft.top) {
|
|
@@ -2231,7 +2231,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2231
2231
|
He2(t3);
|
|
2232
2232
|
}
|
|
2233
2233
|
}
|
|
2234
|
-
return Ye2.current = null, void (
|
|
2234
|
+
return Ye2.current = null, void (qe2.current = null);
|
|
2235
2235
|
}
|
|
2236
2236
|
try {
|
|
2237
2237
|
p2?.(ye2.current, e5);
|
|
@@ -2262,7 +2262,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2262
2262
|
e5.stopPropagation(), e5.preventDefault(), e5.nativeEvent.stopImmediatePropagation();
|
|
2263
2263
|
const d2 = o3 ?? t2.current.getViewFromClient(e5.nativeEvent.clientX, e5.nativeEvent.clientY), u2 = r3 ?? d2.getCellCoordsFromClient(e5.nativeEvent.clientX, e5.nativeEvent.clientY);
|
|
2264
2264
|
if (!u2) return false;
|
|
2265
|
-
|
|
2265
|
+
qe2.current = { anchor: d2.getAnchor(), coords: u2 }, Ae2.current = null;
|
|
2266
2266
|
const h2 = e5.nativeEvent.which === Ct;
|
|
2267
2267
|
if (h2) {
|
|
2268
2268
|
if (-1 !== ne.indexOfCoords(u2, xe2.ranges)) return false;
|
|
@@ -2287,10 +2287,10 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2287
2287
|
l2 && Be2(u2), b3 && 0 === xe2.ranges.length || He2(u2);
|
|
2288
2288
|
}, onSelectionPointerMoveOrWait: (e5, n3, o3, r3, i2, l2 = xe2.cell, s2 = true, c3 = false) => {
|
|
2289
2289
|
if (!t2?.current) return;
|
|
2290
|
-
if (e5.stopPropagation(), e5.preventDefault(), e5.stopImmediatePropagation(), !
|
|
2291
|
-
const a3 =
|
|
2290
|
+
if (e5.stopPropagation(), e5.preventDefault(), e5.stopImmediatePropagation(), !qe2.current) return;
|
|
2291
|
+
const a3 = qe2.current.anchor;
|
|
2292
2292
|
let d2 = r3 ?? t2.current.getViewFromLocation(a3), u2 = i2 ?? d2.getCellCoordsFromClient(e5.clientX, e5.clientY);
|
|
2293
|
-
if (!ne.isEqualCells(u2,
|
|
2293
|
+
if (!ne.isEqualCells(u2, qe2.current?.coords) && (qe2.current = { anchor: a3, coords: u2 }, u2 && false !== j2?.(e5, u2, ye2.current))) {
|
|
2294
2294
|
if (Pe2.current) {
|
|
2295
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 };
|
|
2296
2296
|
if (Fe2(t3) || Fe2(n4)) return;
|
|
@@ -2300,7 +2300,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2300
2300
|
s2 && xo(d2, u2, t2);
|
|
2301
2301
|
}
|
|
2302
2302
|
}, onPointerUp: (e5) => {
|
|
2303
|
-
|
|
2303
|
+
qe2.current = null, e5.stopPropagation(), e5.preventDefault(), e5.stopImmediatePropagation();
|
|
2304
2304
|
try {
|
|
2305
2305
|
p2?.(ye2.current, e5);
|
|
2306
2306
|
} catch (e6) {
|
|
@@ -2532,9 +2532,9 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2532
2532
|
Qe2(E, false, true);
|
|
2533
2533
|
}, []), Nt2 = i(() => {
|
|
2534
2534
|
Qe2(E, true, true);
|
|
2535
|
-
}, []),
|
|
2535
|
+
}, []), Kt2 = i(() => {
|
|
2536
2536
|
be2((e5) => e5.slice(0, -1));
|
|
2537
|
-
}, []),
|
|
2537
|
+
}, []), qt2 = d(() => {
|
|
2538
2538
|
const e5 = ie2();
|
|
2539
2539
|
return ((e6, t3, n3, o3, r3) => {
|
|
2540
2540
|
for (let i2 = 0; i2 < e6.length; i2++) {
|
|
@@ -2641,7 +2641,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2641
2641
|
};
|
|
2642
2642
|
if (!nn2.current) return void o3();
|
|
2643
2643
|
const r3 = nn2.current.range, i2 = en2;
|
|
2644
|
-
U2?.(r3, e5, n3), Promise.resolve(r3 && i2 &&
|
|
2644
|
+
U2?.(r3, e5, n3), Promise.resolve(r3 && i2 && K2?.(r3, i2, e5, n3)).finally(() => {
|
|
2645
2645
|
o3();
|
|
2646
2646
|
});
|
|
2647
2647
|
} }), [en2]), rn2 = hn(on2), ln2 = d(() => ({ onPointerDown: rn2 }), [rn2]), sn2 = l(null), cn2 = d(() => {
|
|
@@ -2719,7 +2719,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2719
2719
|
let h2 = null;
|
|
2720
2720
|
!R2 && o3 && !en2 && (h2 = f(uo, { ...o3, corner: r3, size: 7.5, borderStroke: `${P2} solid`, style: { borderRadius: 1 }, background: Q2, ...Qt2, key: "fillHandle" }));
|
|
2721
2721
|
const p3 = [...i2];
|
|
2722
|
-
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 && Ke2 && 1 === c3?.ranges.length && c3.ranges[c3.ranges.length - 1]) {
|
|
2723
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 };
|
|
2724
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"));
|
|
2725
2725
|
}
|
|
@@ -2736,11 +2736,11 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2736
2736
|
}, []);
|
|
2737
2737
|
return d(() => {
|
|
2738
2738
|
n2?.addCommands(dn2, true);
|
|
2739
|
-
}, [n2]), { selection: cn2, setSelectionCell: Yt2, setSelectionRanges: be2, overlay: an2, cursor: Ee2, onPointerDown: Ze2, clearLastSelection:
|
|
2740
|
-
}, bo = { "sheetxl-grid": "_sheetxl-
|
|
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:
|
|
2739
|
+
}, [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 };
|
|
2740
|
+
}, 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) => {
|
|
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: 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;
|
|
2742
2742
|
b(N2, "No cellRenderer specified. This is probably not what you wanted"), b(!o2?.children, "Grid does not support children elements");
|
|
2743
|
-
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(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(() => {
|
|
2744
2744
|
const e5 = P2 || Oe2;
|
|
2745
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) };
|
|
2746
2746
|
}, [Oe2, P2, ie2]), ze2 = (e5, t2, n2) => {
|
|
@@ -2762,12 +2762,12 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2762
2762
|
if (t2 > 0) {
|
|
2763
2763
|
const l3 = ze2(De2, { top: n2 + De2.getRowOffset(0) }), s3 = De2.getRowIndex(o3), c4 = De2.getRowIndex(r3 - 1);
|
|
2764
2764
|
let a4;
|
|
2765
|
-
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(Kn($e2, s3, c4)), a4), layout: l3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
|
|
2766
2766
|
}
|
|
2767
2767
|
const l2 = Math.max(0, Ve2 - i2), s2 = ze2(De2, { top: Ce2 + i2 }), c3 = s2.getRowIndex(0), a3 = s2.getRowIndex(l2);
|
|
2768
2768
|
let d2;
|
|
2769
|
-
return e5[0] = { minIndex: c3, maxIndex: a3, minCoord: t2, maxCoord: w2 - 1, minBounds: i2, maxBounds: l2, visibleIndices: () => d2 || (d2 = Object.freeze(
|
|
2770
|
-
}, [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(Kn($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]), Ke2 = d(() => {
|
|
2771
2771
|
const e5 = [];
|
|
2772
2772
|
let t2 = 0, n2 = 0;
|
|
2773
2773
|
"number" == typeof j2 ? t2 = j2 : (t2 = j2.index ?? 0, n2 = (j2.scrollOffset ?? 0) * ie2);
|
|
@@ -2775,19 +2775,19 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2775
2775
|
if (t2 > 0) {
|
|
2776
2776
|
const l3 = ze2(De2, { left: n2 + De2.getColOffset(0) }), s3 = De2.getColIndex(o3), c4 = De2.getColIndex(r3 - 1);
|
|
2777
2777
|
let a4;
|
|
2778
|
-
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(Kn(Fe2, s3, c4)), a4), layout: l3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
|
|
2779
2779
|
}
|
|
2780
2780
|
const l2 = Math.max(0, je2 - i2), s2 = ze2(De2, { left: Te2 + i2 }), c3 = s2.getColIndex(0), a3 = s2.getColIndex(l2);
|
|
2781
2781
|
let d2;
|
|
2782
|
-
return e5[0] = { minIndex: c3, maxIndex: a3, minCoord: t2, maxCoord: m2 - 1, minBounds: i2, maxBounds: l2, visibleIndices: () => d2 || (d2 = Object.freeze(
|
|
2783
|
-
}, [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(Kn(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]), qe2 = l({}), Ye2 = l([]), Xe2 = d(() => {
|
|
2784
2784
|
let e5 = {};
|
|
2785
2785
|
const t2 = (t3, n3, o3, r3, i2) => {
|
|
2786
2786
|
const l2 = { vertical: r3?.vertical || false, horizontal: r3?.horizontal || false };
|
|
2787
|
-
if (t3 >=
|
|
2788
|
-
const s2 = { rowStart: Ue2[n3].minIndex, colStart:
|
|
2787
|
+
if (t3 >= Ke2.length || n3 >= Ue2.length) return null;
|
|
2788
|
+
const s2 = { rowStart: Ue2[n3].minIndex, colStart: Ke2[t3].minIndex, rowEnd: Ue2[n3].maxIndex, colEnd: Ke2[t3].maxIndex };
|
|
2789
2789
|
if (s2.rowStart > s2.rowEnd || s2.colStart > s2.colEnd) return null;
|
|
2790
|
-
const c3 = { getColIndex: (e6) =>
|
|
2790
|
+
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 };
|
|
2791
2791
|
let w3 = null, m3 = null;
|
|
2792
2792
|
const x3 = (p2.top + (r3.vertical ? f2.top : 0)) / ie2, y3 = (p2.left + (r3.horizontal ? f2.left : 0)) / ie2;
|
|
2793
2793
|
return { getStage: () => me2.current ?? null, getVisibleRangeCoords: () => s2, toClipBounds: (e6, t4) => {
|
|
@@ -2800,7 +2800,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2800
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) => {
|
|
2801
2801
|
const n4 = tt2(e6, t4);
|
|
2802
2802
|
return { x: n4.x - d2.x, y: n4.y - d2.y };
|
|
2803
|
-
}, getLayout: () => c3, getCellCoordsAsRangeCoords: ce2, getVisibleColumns: () =>
|
|
2803
|
+
}, 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) => {
|
|
2804
2804
|
const o4 = tt2(e6, t4);
|
|
2805
2805
|
if (!o4) return null;
|
|
2806
2806
|
const r4 = c3.getColIndex(o4.x - d2.x), i3 = { rowIndex: c3.getRowIndex(o4.y - d2.y), colIndex: r4 };
|
|
@@ -2810,8 +2810,8 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2810
2810
|
}, getZoom: () => ie2, getAnchor: () => o3, getBounds: () => d2, getInsets: () => a3, getTotalSize: () => h2, getViewportSize: () => g2, getScrollTopLeft: () => f2, getFreezeTopLeft: () => p2, getScrollOrientation: () => l2, allViews: () => e5 };
|
|
2811
2811
|
};
|
|
2812
2812
|
let n2 = e5[k] = t2(0, 0, k, _o, Eo);
|
|
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),
|
|
2814
|
-
}, [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), qe2.current = null, e5 = Object.freeze(e5);
|
|
2814
|
+
}, [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]);
|
|
2815
2815
|
s(() => {
|
|
2816
2816
|
if (Ye2.current.length > 0) {
|
|
2817
2817
|
for (let e5 = 0; e5 < Ye2.current.length; e5++) Ye2.current[e5]();
|
|
@@ -2848,7 +2848,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2848
2848
|
return Ie2.current = t2, t2;
|
|
2849
2849
|
});
|
|
2850
2850
|
}, []), ct2 = Tt((e5) => {
|
|
2851
|
-
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(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;
|
|
2852
2852
|
if (Ie2.current.left === o3 && Ie2.current.top === r3) return;
|
|
2853
2853
|
let i2 = null, l2 = null;
|
|
2854
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(() => {
|
|
@@ -2857,7 +2857,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2857
2857
|
return Ie2.current = t3, t3;
|
|
2858
2858
|
});
|
|
2859
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();
|
|
2860
|
-
}, [Ze2, Je2, Ue2,
|
|
2860
|
+
}, [Ze2, Je2, Ue2, Ke2]);
|
|
2861
2861
|
s(() => {
|
|
2862
2862
|
_e2.current || ct2({ left: Te2, top: Ce2 });
|
|
2863
2863
|
}, [Ze2, je2, Je2, Ve2]), u(() => {
|
|
@@ -2907,22 +2907,22 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2907
2907
|
ye2.current = null, at2(c3 ? { left: l2 } : { top: s2 });
|
|
2908
2908
|
});
|
|
2909
2909
|
}, [Ze2, je2, Je2, Ve2, ge2]), ft2 = i((e5 = null) => {
|
|
2910
|
-
Le2.current = null,
|
|
2910
|
+
Le2.current = null, qe2.current = null, be2();
|
|
2911
2911
|
}, []);
|
|
2912
2912
|
u(() => {
|
|
2913
2913
|
ft2();
|
|
2914
2914
|
}, [N2]);
|
|
2915
|
-
const pt2 =
|
|
2915
|
+
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) => {
|
|
2916
2916
|
Ye2.current.push(e5);
|
|
2917
2917
|
} }), [w2, m2, Xe2]);
|
|
2918
2918
|
s(() => (le2 && pt2.current?.addEventListener("wheel", ht2, { passive: false }), Pe2.current = true, _e2.current = null, () => {
|
|
2919
2919
|
pt2.current?.removeEventListener("wheel", ht2);
|
|
2920
2920
|
}), [le2]);
|
|
2921
2921
|
const gt2 = l([]), wt2 = (t2, n2) => {
|
|
2922
|
-
if (!t2 || !
|
|
2922
|
+
if (!t2 || !q2) return;
|
|
2923
2923
|
gt2.current = [];
|
|
2924
2924
|
n2.push(((t3, o3) => {
|
|
2925
|
-
const r3 = `view:${t3.getAnchor()}:overlay:${n2.length}`, i2 =
|
|
2925
|
+
const r3 = `view:${t3.getAnchor()}:overlay:${n2.length}`, i2 = q2?.({ key: r3, view: t3 }, (e5) => gt2.current[o3] = e5);
|
|
2926
2926
|
if (!i2) return null;
|
|
2927
2927
|
const l2 = t3.getBounds();
|
|
2928
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}`);
|
|
@@ -2934,7 +2934,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
2934
2934
|
wt2(Xe2[o3], r3), e5[o3] = { overlays: r3 };
|
|
2935
2935
|
}
|
|
2936
2936
|
return e5;
|
|
2937
|
-
}, [ve2,
|
|
2937
|
+
}, [ve2, q2, w2, m2, Ue2, Ke2]), xt2 = (t2, n2, o3, r3, i2, l2, s2) => {
|
|
2938
2938
|
if (!t2) return;
|
|
2939
2939
|
const c3 = t2.getVisibleColumns(), a3 = t2.getVisibleRows();
|
|
2940
2940
|
if (0 === c3.length || 0 === a3.length) return;
|
|
@@ -3002,7 +3002,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
3002
3002
|
xt2(Xe2[i2], c3, l2, s2, /* @__PURE__ */ new Set(), e5, t2), n2[i2] = { cells: c3, rangesH: l2, rangesV: s2 };
|
|
3003
3003
|
}
|
|
3004
3004
|
return Le2.current = t2, n2;
|
|
3005
|
-
}, [ve2, w2, m2, Ue2,
|
|
3005
|
+
}, [ve2, w2, m2, Ue2, Ke2, D2, de2, B2, oe2, re2, ce2]), vt2 = (t2, n2, o3, r3, i2) => {
|
|
3006
3006
|
if (t2) if (n2) {
|
|
3007
3007
|
const e5 = `view:${t2.getAnchor()}:hl:`, n3 = t2.getVisibleRows();
|
|
3008
3008
|
if (!n3 || 0 === n3.length) return;
|
|
@@ -3064,7 +3064,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
3064
3064
|
n2[r3] = e("svg", { width: `${c3}`, height: `${a3}`, viewBox: `0 0 ${c3} ${a3}`, preserveAspectRatio: "none", shapeRendering: "crispEdges", style: { position: "absolute" }, children: l2 });
|
|
3065
3065
|
}
|
|
3066
3066
|
return n2;
|
|
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,
|
|
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, 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(() => {
|
|
3068
3068
|
const o3 = [], r3 = (e5) => {
|
|
3069
3069
|
if (!e5 || !Xe2[e5]) return;
|
|
3070
3070
|
const n2 = Xe2[e5].getBounds();
|
|
@@ -3087,12 +3087,12 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
3087
3087
|
if (!r3) return;
|
|
3088
3088
|
const i3 = r3.getBounds(), l3 = r3.getInsets(), s3 = r3.getAnchor();
|
|
3089
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}`);
|
|
3090
|
-
}, o3 =
|
|
3090
|
+
}, o3 = qe2.current, i2 = {}, l2 = [], s2 = Object.keys(Xe2);
|
|
3091
3091
|
for (let e6 = 0; e6 < s2.length; e6++) {
|
|
3092
3092
|
const t2 = s2[e6], r3 = o3?.[t2], c3 = i2[t2] = /* @__PURE__ */ new Map();
|
|
3093
3093
|
l2.push(n2(r3, c3, Xe2[t2]));
|
|
3094
3094
|
}
|
|
3095
|
-
return
|
|
3095
|
+
return qe2.current = i2, l2;
|
|
3096
3096
|
}, [ve2, Xe2, Z2, X2]), kt2 = d(() => {
|
|
3097
3097
|
const { style: t2, ...n2 } = J2 ?? {};
|
|
3098
3098
|
return e("div", { style: { width: je2, height: Ve2, ...t2 }, className: "sheetxl-stage", tabIndex: 0, ref: me2, ...n2, ...ue2, children: Q2 ? Q2(Ct2) : Ct2 });
|
|
@@ -3194,20 +3194,20 @@ const jo = (e5 = void 0) => Object.freeze({ clean: e5, dirty: void 0, editMode:
|
|
|
3194
3194
|
let j2 = 2;
|
|
3195
3195
|
const V2 = 96 * A2 / 72, W2 = 1.2 * V2;
|
|
3196
3196
|
"right" === O2 && (j2 += 1);
|
|
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,
|
|
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, K2] = h(N2);
|
|
3198
3198
|
u(() => {
|
|
3199
|
-
|
|
3199
|
+
K2(N2());
|
|
3200
3200
|
}, [w2, H2]), u(() => {
|
|
3201
3201
|
m2?.({ width: "wrap" === D2 ? void 0 : H2.width + j2, height: H2.height });
|
|
3202
3202
|
}, [H2, m2]);
|
|
3203
|
-
const
|
|
3203
|
+
const q2 = Tt(a2, [a2]), Y2 = Tt((e5) => {
|
|
3204
3204
|
if (k2.dirty === e5) return;
|
|
3205
3205
|
const t3 = { ...k2 };
|
|
3206
|
-
t3.dirty = e5, M2.current, R2(t3),
|
|
3206
|
+
t3.dirty = e5, M2.current, R2(t3), q2?.(t3);
|
|
3207
3207
|
}, [k2]), X2 = Tt((e5) => {
|
|
3208
3208
|
if (k2.editMode === e5) return;
|
|
3209
3209
|
const t3 = { ...k2 };
|
|
3210
|
-
t3.editMode = e5, R2(t3),
|
|
3210
|
+
t3.editMode = e5, R2(t3), q2?.(t3);
|
|
3211
3211
|
}, [k2]), G2 = Tt(() => {
|
|
3212
3212
|
try {
|
|
3213
3213
|
return f2?.(k2), g2?.(), true;
|
|
@@ -3220,7 +3220,7 @@ const jo = (e5 = void 0) => Object.freeze({ clean: e5, dirty: void 0, editMode:
|
|
|
3220
3220
|
if (!M2.current) return;
|
|
3221
3221
|
if (e5.isDefaultPrevented(), !(e5.isTrusted || e5.nativeEvent.ctrlKey || e5.nativeEvent.metaKey || e5.nativeEvent.altKey || e5.nativeEvent.isComposing) && -1 !== $n.indexOf(e5.nativeEvent.key)) {
|
|
3222
3222
|
const t4 = { ...k2 };
|
|
3223
|
-
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), q2?.(t4), void e5.preventDefault();
|
|
3224
3224
|
}
|
|
3225
3225
|
const t3 = e5.nativeEvent.shiftKey;
|
|
3226
3226
|
if (e5.which === vt) return e5.preventDefault(), void Z2();
|
|
@@ -3247,7 +3247,7 @@ const jo = (e5 = void 0) => Object.freeze({ clean: e5, dirty: void 0, editMode:
|
|
|
3247
3247
|
s(() => {
|
|
3248
3248
|
ee2(false);
|
|
3249
3249
|
}, []);
|
|
3250
|
-
const te2 =
|
|
3250
|
+
const te2 = qt(n2, () => ({ startEdit(e5) {
|
|
3251
3251
|
let t3 = e5?.initialSelection;
|
|
3252
3252
|
if (!t3) {
|
|
3253
3253
|
const e6 = M2.current.value.length ?? 0;
|
|
@@ -3255,7 +3255,7 @@ const jo = (e5 = void 0) => Object.freeze({ clean: e5, dirty: void 0, editMode:
|
|
|
3255
3255
|
}
|
|
3256
3256
|
M2.current?.setSelectionRange(t3.start, t3.end, t3.direction);
|
|
3257
3257
|
const n3 = { ...o2, editMode: e5?.editMode ?? false };
|
|
3258
|
-
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), q2?.(n3));
|
|
3259
3259
|
}, submitEdit: () => G2(), cancelEdit() {
|
|
3260
3260
|
Z2();
|
|
3261
3261
|
}, autoFocus() {
|