@sheetxl/grid-react 0.7.9 → 0.7.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/cjs/index.cjs +4 -4
- package/browser/esm/index.mjs +1307 -1341
- package/licenses/dependencies.txt +39 -39
- package/node/esm/index.mjs +722 -755
- package/package.json +3 -3
- package/types/index.d.ts +0 -40
package/node/esm/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/grid-react - Grid React - Advanced grid component for React - v0.7.
|
|
2
|
+
* @license @sheetxl/grid-react - Grid React - Advanced grid component for React - v0.7.11
|
|
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.
|
|
6
6
|
*/
|
|
7
7
|
import { jsx as e, jsxs as t, Fragment as n } from "react/jsx-runtime";
|
|
8
|
-
import { useCallbackRef as o, HorizontalAlignment as r, KeyCodes as l, ReactUtils as i, MouseButtonCodes as c, useSynchronizedPointerHandler as s, useId as a,
|
|
9
|
-
import { useRef as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { CoordUtils as
|
|
13
|
-
import { useMeasure as
|
|
14
|
-
import { createPortal as
|
|
15
|
-
import { mergeRefs as
|
|
16
|
-
const
|
|
8
|
+
import { useCallbackRef as o, HorizontalAlignment as r, KeyCodes as l, ReactUtils as i, MouseButtonCodes as c, useSynchronizedPointerHandler as s, useId as a, useAnimatedMeasure as d, useFullscreenPortal as u, SimpleCommand as h, KeyModifiers as g, useImperativeElement as f, ScrollPane as w } from "@sheetxl/utils-react";
|
|
9
|
+
import { useRef as x, useReducer as p, useState as m, useEffect as v, useCallback as S, useLayoutEffect as y, useMemo as b, memo as C, forwardRef as I, createElement as E, useImperativeHandle as R } from "react";
|
|
10
|
+
import M from "tiny-invariant";
|
|
11
|
+
import k from "clsx";
|
|
12
|
+
import { CoordUtils as P, CommonUtils as T, RangeOrientation as D, Direction as O, AnchorLocation as z } from "@sheetxl/utils";
|
|
13
|
+
import { useMeasure as L } from "react-use";
|
|
14
|
+
import { createPortal as $ } from "react-dom";
|
|
15
|
+
import { mergeRefs as B } from "react-merge-refs";
|
|
16
|
+
const F = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2 = 1 }) => {
|
|
17
17
|
let l2, i2, c2;
|
|
18
18
|
"column" === e2 ? (l2 = o2.columnMetadataMap, i2 = o2.lastMeasuredColumnIndex, c2 = o2.recalcColumnIndices) : (l2 = o2.rowMetadataMap, i2 = o2.lastMeasuredRowIndex, c2 = o2.recalcRowIndices);
|
|
19
19
|
const s2 = c2.length > 0;
|
|
@@ -30,28 +30,28 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
|
|
|
30
30
|
"column" === e2 ? o2.lastMeasuredColumnIndex = t2 : o2.lastMeasuredRowIndex = t2;
|
|
31
31
|
}
|
|
32
32
|
return l2[t2], l2[t2];
|
|
33
|
-
},
|
|
33
|
+
}, W = ({ itemType: e2, itemSize: t2, itemCount: n2, instanceProps: o2, offset: r2, scale: l2 }) => {
|
|
34
34
|
let i2, c2;
|
|
35
35
|
"column" === e2 ? (i2 = o2.columnMetadataMap, c2 = o2.lastMeasuredColumnIndex) : (i2 = o2.rowMetadataMap, c2 = o2.lastMeasuredRowIndex);
|
|
36
36
|
let s2 = 0;
|
|
37
|
-
return s2 = (c2 > 0 ? i2[c2].offset : 0) >= r2 ? A({ itemType: e2, itemSize: t2, instanceProps: o2, high: c2, low: 0, offset: r2, scale: l2 }) :
|
|
37
|
+
return s2 = (c2 > 0 ? i2[c2].offset : 0) >= r2 ? A({ itemType: e2, itemSize: t2, instanceProps: o2, high: c2, low: 0, offset: r2, scale: l2 }) : V({ itemType: e2, itemSize: t2, itemCount: n2, instanceProps: o2, index: Math.max(0, c2), offset: r2, scale: l2 }), s2 = Math.min(s2, n2), s2;
|
|
38
38
|
}, A = ({ itemType: e2, itemSize: t2, instanceProps: n2, high: o2, low: r2, offset: l2, scale: i2 }) => {
|
|
39
39
|
for (; r2 <= o2; ) {
|
|
40
|
-
const c2 = r2 + Math.floor((o2 - r2) / 2), s2 =
|
|
40
|
+
const c2 = r2 + Math.floor((o2 - r2) / 2), s2 = F({ itemType: e2, itemSize: t2, index: c2, instanceProps: n2, scale: i2 }).offset;
|
|
41
41
|
if (s2 === l2) return c2;
|
|
42
42
|
s2 < l2 ? r2 = c2 + 1 : s2 > l2 && (o2 = c2 - 1);
|
|
43
43
|
}
|
|
44
44
|
return r2 > 0 ? r2 - 1 : 0;
|
|
45
|
-
},
|
|
45
|
+
}, V = ({ itemType: e2, itemSize: t2, itemCount: n2, instanceProps: o2, index: r2, offset: l2, scale: i2 }) => {
|
|
46
46
|
let c2 = 1;
|
|
47
|
-
for (; r2 < n2 &&
|
|
47
|
+
for (; r2 < n2 && F({ itemType: e2, itemSize: t2, index: r2, instanceProps: o2, scale: i2 }).offset < l2; ) r2 += c2, c2 *= 2;
|
|
48
48
|
return A({ itemType: e2, itemSize: t2, instanceProps: o2, high: Math.min(r2, n2 - 1), low: Math.floor(r2 / 2), offset: l2, scale: i2 });
|
|
49
|
-
},
|
|
50
|
-
const { rowCount: t2, columnCount: n2, defaultRowHeight: r2, getRowHeight: l2, defaultColumnWidth: i2, getColumnWidth: c2 } = e2 || {}, s2 =
|
|
51
|
-
return
|
|
49
|
+
}, U = (e2) => {
|
|
50
|
+
const { rowCount: t2, columnCount: n2, defaultRowHeight: r2, getRowHeight: l2, defaultColumnWidth: i2, getColumnWidth: c2 } = e2 || {}, s2 = x({ columnMetadataMap: {}, rowMetadataMap: {}, lastMeasuredColumnIndex: -1, lastMeasuredRowIndex: -1, recalcColumnIndices: [], recalcRowIndices: [] }), a2 = o((e3) => W({ itemType: "row", itemCount: t2, itemSize: l2 ?? (() => r2 ?? 20), instanceProps: s2.current, offset: e3 }), [t2, l2, r2]), d2 = o((e3) => -1 === e3 ? 0 : F({ itemType: "row", index: e3, itemSize: l2 ?? (() => r2 ?? 20), instanceProps: s2.current }).offset, [l2, r2]), u2 = o((e3) => F({ itemType: "row", index: e3, itemSize: l2 ?? (() => r2 ?? 20), instanceProps: s2.current }).size, [l2, r2]), h2 = o((e3) => W({ itemType: "column", itemCount: n2, itemSize: c2 ?? (() => i2 ?? 75), instanceProps: s2.current, offset: e3 }), [n2, c2, i2]), g2 = o((e3) => -1 === e3 ? 0 : F({ itemType: "column", index: e3, itemSize: c2 ?? (() => i2 ?? 75), instanceProps: s2.current }).offset, [c2, i2]), f2 = o((e3) => F({ itemType: "column", index: e3, itemSize: c2 ?? (() => i2 ?? 75), instanceProps: s2.current }).size, [c2, i2]), [w2, S2] = p((e3) => e3 + 1, 0), y2 = () => ({ getRowOffset: d2, getColOffset: g2, getRowIndex: a2, getColIndex: h2 }), [b2, C2] = m(() => e2 ? y2() : null);
|
|
51
|
+
return v(() => {
|
|
52
52
|
C2(e2 ? y2() : null);
|
|
53
|
-
}, [
|
|
54
|
-
},
|
|
53
|
+
}, [w2, t2, n2, i2, r2, u2, f2]), b2;
|
|
54
|
+
}, H = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ~`!@#$%^&*()-_=+[{]};:'\",<.>/?|\\", K = (e2) => {
|
|
55
55
|
if (!e2) return null;
|
|
56
56
|
if ("start" === e2.eventType) return { type: e2.eventType };
|
|
57
57
|
if ("submit" === e2.eventType) return { type: e2.eventType };
|
|
@@ -63,8 +63,8 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
|
|
|
63
63
|
return e2.activeCoords && (t2.activeCoords = e2.activeCoords), t2;
|
|
64
64
|
}
|
|
65
65
|
return { type: e2.eventType ?? "unknown" };
|
|
66
|
-
},
|
|
67
|
-
const { session: n2, refLatestCoords: o2, handleSubmitEdit: l2, handleCancelEdit: c2, cellBounds: s2, isInBounds: a2, getCellEditor: d2, propsEditor: u2, borderStrokeFill: h2 = "rgb(33, 115, 70)", borderStrokeWidth: g2 = 2, alignment: f2 = r.Left, style:
|
|
66
|
+
}, N = (e2) => true, q = (e2) => !!e2 && (!(e2.ctrlKey || e2.metaKey || e2.altKey || e2.isComposing) && (!(e2.shiftKey || "F2" !== e2.key && " " !== e2.key && "Backspace" !== e2.key) || (!e2.shiftKey || " " !== e2.key) && -1 !== H.indexOf(e2.key))), j = (e2) => !!e2 && ("dblclick" === e2.type && { editMode: true }), X = (t2) => {
|
|
67
|
+
const { session: n2, refLatestCoords: o2, handleSubmitEdit: l2, handleCancelEdit: c2, cellBounds: s2, isInBounds: a2, getCellEditor: d2, propsEditor: u2, borderStrokeFill: h2 = "rgb(33, 115, 70)", borderStrokeWidth: g2 = 2, alignment: f2 = r.Left, style: w2, ...p2 } = t2, y2 = x(null), b2 = x(null), [C2, I2] = m(false), E2 = n2.coords, R2 = S(async (e2) => {
|
|
68
68
|
const t3 = y2.current?.getBoundingClientRect();
|
|
69
69
|
if (t3) {
|
|
70
70
|
if ("keyboard" === e2.eventType) {
|
|
@@ -74,7 +74,7 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
|
|
|
74
74
|
await new Promise((e3) => requestAnimationFrame(e3));
|
|
75
75
|
}
|
|
76
76
|
}, []);
|
|
77
|
-
|
|
77
|
+
v(() => {
|
|
78
78
|
const e2 = b2.current;
|
|
79
79
|
I2(true), b2.current.startEdit?.(n2.startEvent);
|
|
80
80
|
return (async () => {
|
|
@@ -87,12 +87,12 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
|
|
|
87
87
|
-1 !== t3 && n2.editorRefs.splice(t3, 1), n2.onUnmount(e2);
|
|
88
88
|
};
|
|
89
89
|
}, []);
|
|
90
|
-
const M2 =
|
|
90
|
+
const M2 = S(() => l2(n2), []), k2 = S(() => {
|
|
91
91
|
c2(n2);
|
|
92
|
-
}, []), T2 = o2.current &&
|
|
93
|
-
return e("div", { tabIndex: 0, ref: y2, style: { background: void 0, ...
|
|
94
|
-
},
|
|
95
|
-
const { view: n2, canEdit: i2 =
|
|
92
|
+
}, []), T2 = o2.current && P.isEqualCells(o2.current, E2), D2 = a2 && T2 && C2, O2 = d2({ autoFocus: !!n2.startEvent?.autoFocus, ...u2, onSubmitEdit: M2, onCancelEdit: k2, ref: b2 }, E2), z2 = s2.x + i.boundPixel(-g2 / 2), L2 = i.boundPixel(s2.width + g2 / 2, true);
|
|
93
|
+
return e("div", { tabIndex: 0, ref: y2, style: { background: void 0, ...w2, opacity: D2 ? w2?.opacity ?? 1 : 0, pointerEvents: "auto", position: "absolute", boxSizing: "border-box", top: `${s2.y + i.boundPixel(-g2 / 2)}px`, height: i.boundPixel(s2.height + g2 / 2, true), left: `${z2}px`, width: L2 }, ...p2, children: e("div", { className: "editor-container", style: { position: "absolute", boxSizing: "border-box", left: `${i.boundPixel(1)}px`, top: `${i.boundPixel(1)}px`, width: i.boundPixel(s2.width - 2, true), height: i.boundPixel(s2.height - 2, true), outline: `${g2}px ${h2} solid`, boxShadow: "rgba(60,64,67,.35) 2px 2px 6px 3px", maxHeight: "100%", overflow: "hidden", display: "flex" }, children: O2 }) });
|
|
94
|
+
}, Y = (t2) => {
|
|
95
|
+
const { view: n2, canEdit: i2 = N, getCellEditor: c2, onBeforeStartEdit: s2, onStartEdit: a2, onSubmitEdit: d2, onCancelEdit: u2, onDoneEdit: h2, isEditorStartKeyEvent: g2 = q, isEditorStartPointerEvent: f2 = j, containerProps: w2, borderStrokeFill: b2, borderStrokeWidth: C2 = 2, getRangeCoords: I2 = null, activeCoords: E2, alignment: R2 = r.Left } = t2, [M2, k2] = m(false), [D2, O2] = m(void 0), z2 = o((e2, t3, n3, o2, l2, i3) => {
|
|
96
96
|
if (!t3) return null;
|
|
97
97
|
const c3 = l2?.(t3, e2), s3 = e2.getRangeCoordsBounds(c3), a3 = e2.toClipBounds(s3), d3 = s3, u3 = e2.getZoom();
|
|
98
98
|
if (!a3) return null;
|
|
@@ -107,16 +107,16 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
h3.height = d3.height, void 0 !== o2 && (h3.height = Math.max(o2 + 1, d3.height));
|
|
110
|
-
const { width: f3, height:
|
|
111
|
-
return { x: h3.x ?? 0, y: h3.y ?? 0, height: Math.min(
|
|
112
|
-
}, [R2]), L2 = o(i2, [i2]), $2 =
|
|
110
|
+
const { width: f3, height: w3 } = e2.getViewportSize();
|
|
111
|
+
return { x: h3.x ?? 0, y: h3.y ?? 0, height: Math.min(w3 - h3.y, h3.height) + 1, width: Math.min(f3 - h3.x, h3.width) + 1 };
|
|
112
|
+
}, [R2]), L2 = o(i2, [i2]), $2 = S(() => {
|
|
113
113
|
n2?.getStage()?.focus();
|
|
114
|
-
}, [n2]), B2 =
|
|
115
|
-
s2?.(e2), ee2(),
|
|
116
|
-
}, [s2]),
|
|
114
|
+
}, [n2]), B2 = x(null), F2 = o((e2) => {
|
|
115
|
+
s2?.(e2), ee2(), k2(true), B2.current = null;
|
|
116
|
+
}, [s2]), W2 = o((e2) => {
|
|
117
117
|
a2?.(e2.coords);
|
|
118
|
-
}, [a2]),
|
|
119
|
-
e2.isSubmitted || e2.isCancelled || (
|
|
118
|
+
}, [a2]), A2 = o((e2) => {
|
|
119
|
+
e2.isSubmitted || e2.isCancelled || (H2.current.isEditorClosed = true, $2(), e2.isCancelled = true, u2?.(e2.coords), ee2());
|
|
120
120
|
}, [u2]), V2 = o((e2) => {
|
|
121
121
|
if (e2.isSubmitted || e2.isCancelled) return false;
|
|
122
122
|
try {
|
|
@@ -125,8 +125,8 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
|
|
|
125
125
|
throw e2.isEditorClosing = false, e2.isSubmitted = false, t3;
|
|
126
126
|
}
|
|
127
127
|
}, [d2]), U2 = o((e2) => {
|
|
128
|
-
|
|
129
|
-
}, [h2]),
|
|
128
|
+
k2(false), h2?.(e2.coords), ee2();
|
|
129
|
+
}, [h2]), H2 = x(null), Y2 = x(null), Z2 = x(null), _2 = x([]), [J2, Q2] = p((e2) => e2 + 1, 0), ee2 = S((e2) => {
|
|
130
130
|
e2 && _2.current.push(e2), Q2();
|
|
131
131
|
}, []), te2 = o((e2) => {
|
|
132
132
|
if (e2.defaultPrevented || e2.isSynthetic) return;
|
|
@@ -140,18 +140,18 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
|
|
|
140
140
|
}, [n2]), oe2 = o((e2) => {
|
|
141
141
|
if (e2.defaultPrevented || e2.isSynthetic) return;
|
|
142
142
|
if (!n2?.getStage()) return;
|
|
143
|
-
const t3 =
|
|
143
|
+
const t3 = Y2.current;
|
|
144
144
|
g2(e2, t3) && (e2.stopPropagation(), e2.preventDefault()), e2.key;
|
|
145
145
|
ee2({ eventType: "keyboard", event: e2, coords: t3 });
|
|
146
146
|
}, [n2]);
|
|
147
|
-
|
|
147
|
+
y(() => {
|
|
148
148
|
const e2 = (e3, t4) => {
|
|
149
149
|
const o3 = t4?.cell ?? e3;
|
|
150
150
|
if (!o3) return null;
|
|
151
151
|
const r2 = o3;
|
|
152
152
|
if (!L2(o3)) return null;
|
|
153
153
|
F2?.(o3);
|
|
154
|
-
const l2 =
|
|
154
|
+
const l2 = T.uuidV4();
|
|
155
155
|
t4 = Object.freeze({ autoFocus: true, ...t4 }), Z2.current = o3;
|
|
156
156
|
const i3 = { coords: r2, startEvent: t4, uuid: l2, isMounted: false, isStarted: false, isSubmitted: false, isEditorSubmitted: false, isEditorClosing: false, isEditorClosed: false, isCancelled: false, events: [], editorRefsDispatchEditorEvent: [], editorRefs: [], onMount: (e4) => {
|
|
157
157
|
i3.isMounted || (i3.isMounted = true, ee2());
|
|
@@ -167,36 +167,36 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
|
|
|
167
167
|
};
|
|
168
168
|
window.addEventListener("keydown", t5, true), n2.getStage()?.addEventListener("focusin", () => {
|
|
169
169
|
window.removeEventListener("keydown", t5), e5();
|
|
170
|
-
},
|
|
170
|
+
}, G), $2();
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
} };
|
|
174
174
|
return i3;
|
|
175
175
|
};
|
|
176
|
-
if (_2.current.length <= 0 && !
|
|
176
|
+
if (_2.current.length <= 0 && !H2.current) return;
|
|
177
177
|
const t3 = _2.current[0];
|
|
178
|
-
|
|
178
|
+
K(t3), ((e3) => {
|
|
179
179
|
const t4 = [], n3 = e3?.length ?? 0;
|
|
180
180
|
for (let o3 = 0; o3 < n3; o3++) {
|
|
181
181
|
const n4 = e3[o3];
|
|
182
|
-
t4.push(
|
|
182
|
+
t4.push(K(n4));
|
|
183
183
|
}
|
|
184
|
-
})(_2.current),
|
|
185
|
-
let o2 =
|
|
186
|
-
if (
|
|
187
|
-
if (
|
|
188
|
-
else if (
|
|
189
|
-
if (
|
|
190
|
-
|
|
184
|
+
})(_2.current), H2.current, H2.current;
|
|
185
|
+
let o2 = H2.current;
|
|
186
|
+
if (H2.current) {
|
|
187
|
+
if (H2.current.isDone) H2.current = null;
|
|
188
|
+
else if (H2.current.isSubmitted || H2.current.isCancelled) {
|
|
189
|
+
if (H2.current.isMounted) return;
|
|
190
|
+
H2.current.isDone || (U2(H2.current), H2.current.isDone = true);
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
if (t3) {
|
|
194
194
|
if ("start" === t3.eventType) {
|
|
195
|
-
const n3 = t3, o3 = n3.startEvent?.cell ??
|
|
196
|
-
|
|
195
|
+
const n3 = t3, o3 = n3.startEvent?.cell ?? Y2.current;
|
|
196
|
+
H2.current && P.isEqualCells(H2.current.coords, o3) || (H2.current = e2(o3, n3.startEvent));
|
|
197
197
|
} else if ("keyboard" === t3.eventType) {
|
|
198
198
|
const n3 = t3.event;
|
|
199
|
-
if (
|
|
199
|
+
if (H2.current) {
|
|
200
200
|
let e3 = false;
|
|
201
201
|
switch (n3.which) {
|
|
202
202
|
case l.Left:
|
|
@@ -208,122 +208,90 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
|
|
|
208
208
|
e3 = true;
|
|
209
209
|
}
|
|
210
210
|
if (!e3) {
|
|
211
|
-
|
|
212
|
-
for (let e4 = 0; e4 <
|
|
211
|
+
H2.current.events.push(t3);
|
|
212
|
+
for (let e4 = 0; e4 < H2.current.editorRefsDispatchEditorEvent.length; e4++) H2.current.editorRefsDispatchEditorEvent[e4](t3);
|
|
213
213
|
}
|
|
214
214
|
} else {
|
|
215
215
|
if (g2(n3, t3.coords)) {
|
|
216
216
|
let n4;
|
|
217
|
-
const o3 = e2(n4?.cell ??
|
|
218
|
-
o3 && o3.events.push(t3),
|
|
217
|
+
const o3 = e2(n4?.cell ?? Y2.current, n4);
|
|
218
|
+
o3 && o3.events.push(t3), H2.current = o3;
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
} else if ("pointer" === t3.eventType) {
|
|
222
222
|
const n3 = t3.event;
|
|
223
|
-
if (
|
|
224
|
-
|
|
225
|
-
for (let e3 = 0; e3 <
|
|
223
|
+
if (H2.current) {
|
|
224
|
+
H2.current.events.push(t3);
|
|
225
|
+
for (let e3 = 0; e3 < H2.current.editorRefsDispatchEditorEvent.length; e3++) H2.current.editorRefsDispatchEditorEvent[e3](t3);
|
|
226
226
|
} else {
|
|
227
|
-
const o3 = t3?.coords ??
|
|
227
|
+
const o3 = t3?.coords ?? Y2.current, r2 = f2(n3, o3);
|
|
228
228
|
if (r2) {
|
|
229
229
|
let n4;
|
|
230
230
|
"boolean" != typeof n4 && (n4 = r2);
|
|
231
231
|
const l2 = e2(o3, n4);
|
|
232
|
-
l2 && l2.events.push(t3),
|
|
232
|
+
l2 && l2.events.push(t3), H2.current = l2;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
} else if ("submit" === t3.eventType) {
|
|
236
|
-
if (
|
|
237
|
-
if (!
|
|
238
|
-
V2(
|
|
236
|
+
if (H2.current && !H2.current.isSubmitted && !H2.current.isCancelled) {
|
|
237
|
+
if (!H2.current.isMounted) return;
|
|
238
|
+
V2(H2.current);
|
|
239
239
|
}
|
|
240
240
|
} else if ("cancel" === t3.eventType) {
|
|
241
|
-
if (
|
|
242
|
-
if (!
|
|
243
|
-
|
|
241
|
+
if (H2.current && !H2.current.isSubmitted && !H2.current.isCancelled) {
|
|
242
|
+
if (!H2.current.isMounted) return;
|
|
243
|
+
A2(H2.current);
|
|
244
244
|
}
|
|
245
245
|
} else if ("coordsChange" === t3.eventType) {
|
|
246
246
|
const e3 = t3;
|
|
247
|
-
if (
|
|
248
|
-
if (!
|
|
247
|
+
if (Y2.current = e3.activeCoords, H2.current, H2.current && !H2.current.isSubmitted && !H2.current.isCancelled) {
|
|
248
|
+
if (!H2.current.isMounted) return;
|
|
249
249
|
try {
|
|
250
|
-
V2(
|
|
250
|
+
V2(H2.current);
|
|
251
251
|
} catch (e4) {
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
|
-
_2.current.length > 0 && (_2.current.shift(), ee2()), 0 === _2.current.length && (!
|
|
257
|
-
n2 &&
|
|
256
|
+
_2.current.length > 0 && (_2.current.shift(), ee2()), 0 === _2.current.length && (!H2.current || H2.current.isEditorClosing || H2.current.isEditorClosed ? !H2.current && o2 && $2() : H2.current.isMounted && !H2.current.isStarted && (H2.current.isStarted = true, H2.current.startEvent.autoFocus && ("string" == typeof H2.current.startEvent.autoFocus ? H2.current.editorRefs[0]?.autoFocus(H2.current.startEvent.autoFocus) : H2.current.editorRefs[0]?.autoFocus()), W2?.(H2.current), requestAnimationFrame(() => {
|
|
257
|
+
n2 && H2.current?.coords && n2.scrollCellCoordsIntoView(H2.current.coords);
|
|
258
258
|
})));
|
|
259
|
-
}, [J2]),
|
|
259
|
+
}, [J2]), v(() => {
|
|
260
260
|
Z2.current = E2;
|
|
261
|
-
const e2 =
|
|
262
|
-
if (!
|
|
263
|
-
|
|
261
|
+
const e2 = H2.current?.coords;
|
|
262
|
+
if (!P.isEqualCells(e2, E2)) {
|
|
263
|
+
H2.current && (H2.current.isEditorClosing = true);
|
|
264
264
|
ee2({ eventType: "coordsChange", activeCoords: E2 });
|
|
265
265
|
}
|
|
266
266
|
}, [E2]);
|
|
267
|
-
const re2 =
|
|
267
|
+
const re2 = S((e2) => {
|
|
268
268
|
oe2(e2.nativeEvent);
|
|
269
269
|
}, []), { width: le2 = 0, height: ie2 = 0 } = D2 ?? { width: 0, height: 0 }, ce2 = o(c2, [c2]);
|
|
270
270
|
return { overlay: o((t3) => {
|
|
271
|
-
if (!
|
|
272
|
-
|
|
273
|
-
let n3 = z2(t3,
|
|
271
|
+
if (!H2.current || H2.current.isEditorClosed) return H2.current, null;
|
|
272
|
+
H2.current.coords;
|
|
273
|
+
let n3 = z2(t3, H2.current.coords, le2, ie2, I2, R2), o2 = true;
|
|
274
274
|
n3 && 0 !== n3.width && 0 !== n3.height || (n3 = { x: 0, y: 0, width: le2, height: le2 }, o2 = false);
|
|
275
275
|
const r2 = t3.getZoom(), l2 = { containerBounds: { x: 0, y: 0, width: n3.width / r2, height: n3.height / r2 }, setNaturalSize: O2, zoom: r2 };
|
|
276
|
-
return e(
|
|
277
|
-
}, [c2, I2, J2, le2, ie2, R2, C2, b2]), startEdit:
|
|
276
|
+
return e(X, { session: H2.current, refLatestCoords: Z2, handleSubmitEdit: V2, handleCancelEdit: A2, cellBounds: n3, borderStrokeWidth: C2, borderStrokeFill: b2, isInBounds: o2, getCellEditor: ce2, propsEditor: l2, alignment: R2, ...w2 }, "editor:" + H2.current.uuid);
|
|
277
|
+
}, [c2, I2, J2, le2, ie2, R2, C2, b2]), startEdit: S((e2) => {
|
|
278
278
|
ee2({ eventType: "start", startEvent: e2 });
|
|
279
|
-
}, []), submitEdit:
|
|
279
|
+
}, []), submitEdit: S(() => {
|
|
280
280
|
ee2({ eventType: "submit" });
|
|
281
|
-
}, []), cancelEdit:
|
|
281
|
+
}, []), cancelEdit: S(() => {
|
|
282
282
|
ee2({ eventType: "cancel" });
|
|
283
283
|
}, []), onKeyboardEvent: re2, onPointerEvent: ne2, onKeyboardEventNative: oe2, onPointerEventNative: te2, isEditing: M2 };
|
|
284
|
-
},
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}, [r2]), [h2, g2] = p(l2);
|
|
289
|
-
return m(() => {
|
|
290
|
-
l2 && !h2 && g2(l2);
|
|
291
|
-
}, [l2, h2]), m(() => {
|
|
292
|
-
const e3 = i2.current;
|
|
293
|
-
if (!e3) return;
|
|
294
|
-
let r3 = false, l3 = 0;
|
|
295
|
-
const c3 = () => {
|
|
296
|
-
if (!e3) return;
|
|
297
|
-
const o3 = e3.getBoundingClientRect(), i3 = d2.current;
|
|
298
|
-
Math.abs(o3.x - i3.x) > t2 || Math.abs(o3.y - i3.y) > t2 || Math.abs(o3.width - i3.width) > t2 || Math.abs(o3.height - i3.height) > t2 ? (r3 || (r3 = true, g2(J(o3)), s2()), l3 = 0) : l3++, r3 && l3 >= n2 && (r3 = false, g2(J(o3)), s2()), d2.current = J(o3), a2.current = requestAnimationFrame(c3);
|
|
299
|
-
};
|
|
300
|
-
a2.current = requestAnimationFrame(c3);
|
|
301
|
-
const u3 = (e4) => {
|
|
302
|
-
r3 = true, s2();
|
|
303
|
-
}, h3 = (e4) => {
|
|
304
|
-
r3 = false, l3 = n2, s2();
|
|
305
|
-
};
|
|
306
|
-
let f2 = e3;
|
|
307
|
-
const w2 = [];
|
|
308
|
-
for (; f2 && f2 !== document.documentElement && (f2.addEventListener("animationstart", u3, true), f2.addEventListener("animationend", h3, true), f2.addEventListener("transitionstart", u3, true), f2.addEventListener("transitionend", h3, true), w2.push(f2), f2 = f2.parentElement, !(w2.length > o2)); ) ;
|
|
309
|
-
return () => {
|
|
310
|
-
a2.current && cancelAnimationFrame(a2.current), w2.forEach((e4) => {
|
|
311
|
-
e4.removeEventListener("animationstart", u3, true), e4.removeEventListener("animationend", h3, true), e4.removeEventListener("transitionstart", u3, true), e4.removeEventListener("transitionend", h3, true);
|
|
312
|
-
});
|
|
313
|
-
};
|
|
314
|
-
}, [c2, l2, t2, n2, o2]), [u2, h2];
|
|
315
|
-
}
|
|
316
|
-
const ee = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = T.Row, headerCount: r2, selectionPolicy: l2 = "multiple", newSelectionMode: i2 = "clear", alwaysScrollToActiveCoords: a2 = true, onDragStart: d2, onDragEnd: u2, pointerDownInterceptor: h2, pointerMoveInterceptor: g2, onPointerUp: f2, newSelection: x2, modifySelection: p2, appendSelection: m2, clearSelections: S2 }) => {
|
|
317
|
-
const b2 = r2 ?? ((n2 === T.Row ? e2.current?.rowCount : e2.current?.columnCount) || 0), C2 = w(null), I2 = w(null), E2 = w(false), R2 = w(null), M2 = v((e3) => n2 === T.Column ? { rowIndex: 0, colIndex: e3.colIndex } : { rowIndex: e3.rowIndex, colIndex: 0 }, [n2]), D2 = v((e3) => n2 === T.Column ? { rowIndex: t2.current ? t2.current.rowCount - 1 : 0, colIndex: e3.colIndex } : { rowIndex: e3.rowIndex, colIndex: t2.current ? t2.current.columnCount - 1 : 0 }, [n2]), O2 = (e3) => {
|
|
318
|
-
I2.current = D2(e3), p2(I2.current, C2.current);
|
|
319
|
-
}, z2 = v((o2, r3) => {
|
|
284
|
+
}, G = Object.freeze({ once: true }), Z = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = D.Row, headerCount: r2, selectionPolicy: l2 = "multiple", newSelectionMode: i2 = "clear", alwaysScrollToActiveCoords: a2 = true, onDragStart: d2, onDragEnd: u2, pointerDownInterceptor: h2, pointerMoveInterceptor: g2, onPointerUp: f2, newSelection: w2, modifySelection: p2, appendSelection: m2, clearSelections: v2 }) => {
|
|
285
|
+
const y2 = r2 ?? ((n2 === D.Row ? e2.current?.rowCount : e2.current?.columnCount) || 0), C2 = x(null), I2 = x(null), E2 = x(false), R2 = x(null), M2 = S((e3) => n2 === D.Column ? { rowIndex: 0, colIndex: e3.colIndex } : { rowIndex: e3.rowIndex, colIndex: 0 }, [n2]), k2 = S((e3) => n2 === D.Column ? { rowIndex: t2.current ? t2.current.rowCount - 1 : 0, colIndex: e3.colIndex } : { rowIndex: e3.rowIndex, colIndex: t2.current ? t2.current.columnCount - 1 : 0 }, [n2]), O2 = (e3) => {
|
|
286
|
+
I2.current = k2(e3), p2(I2.current, C2.current);
|
|
287
|
+
}, z2 = S((o2, r3) => {
|
|
320
288
|
if (!e2.current) return;
|
|
321
289
|
const l3 = e2.current.getViewFromClient(o2, r3)?.getCellCoordsFromClient(o2, r3);
|
|
322
|
-
return l3 ? (n2 ===
|
|
323
|
-
}, []), L2 =
|
|
290
|
+
return l3 ? (n2 === D.Column ? l3.rowIndex = t2.current.getViewport().rowStart : l3.colIndex = t2.current.getViewport().colStart, l3) : void 0;
|
|
291
|
+
}, []), L2 = S((e3, o2 = false) => {
|
|
324
292
|
let r3 = e3;
|
|
325
|
-
return o2 || (r3 = { ...e3 }, n2 ===
|
|
326
|
-
}, [n2]), $2 = o(u2, [u2]), B2 = o(d2, [d2]), F2 =
|
|
293
|
+
return o2 || (r3 = { ...e3 }, n2 === D.Row ? delete r3.colIndex : delete r3.rowIndex), t2.current?.scrollCellCoordsIntoView(r3);
|
|
294
|
+
}, [n2]), $2 = o(u2, [u2]), B2 = o(d2, [d2]), F2 = b(() => ({ onPointerDown: (o2) => {
|
|
327
295
|
if (!e2 || !e2.current) return;
|
|
328
296
|
if (o2.nativeEvent.defaultPrevented) return;
|
|
329
297
|
const r3 = z2(o2.nativeEvent.clientX, o2.nativeEvent.clientY);
|
|
@@ -332,37 +300,37 @@ const ee = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = T.Row, headerCount
|
|
|
332
300
|
const l3 = o2.nativeEvent.shiftKey, i3 = o2.nativeEvent.ctrlKey || o2.nativeEvent.metaKey;
|
|
333
301
|
if (false === h2?.(o2, r3)) return;
|
|
334
302
|
B2?.(), E2.current = true;
|
|
335
|
-
const s2 = t2.current?.getViewFromClient(o2.nativeEvent.clientX, o2.nativeEvent.clientY), d3 = ((e3, t3) => n2 ===
|
|
303
|
+
const s2 = t2.current?.getViewFromClient(o2.nativeEvent.clientX, o2.nativeEvent.clientY), d3 = ((e3, t3) => n2 === D.Column ? { ...e3, rowIndex: t3.rowStart } : { ...e3, colIndex: t3.colStart })(r3, s2.getVisibleRangeCoords());
|
|
336
304
|
if (l3) O2(r3);
|
|
337
305
|
else {
|
|
338
306
|
if (i3) return ((e3, t3 = e3, n3) => {
|
|
339
|
-
C2.current = M2(e3), I2.current =
|
|
307
|
+
C2.current = M2(e3), I2.current = k2(t3), m2(C2.current, I2.current, n3);
|
|
340
308
|
})(r3, r3, d3), void (a2 && L2(d3, true));
|
|
341
309
|
((e3, t3 = e3, n3) => {
|
|
342
|
-
C2.current = M2(e3), I2.current =
|
|
310
|
+
C2.current = M2(e3), I2.current = k2(t3), w2(C2.current, I2.current, n3);
|
|
343
311
|
})(r3, r3, d3), O2(r3), a2 && L2(d3, true);
|
|
344
312
|
}
|
|
345
|
-
}, onPointerMoveOrWait:
|
|
313
|
+
}, onPointerMoveOrWait: T.throttle((t3) => {
|
|
346
314
|
if (!E2.current || !e2?.current) return;
|
|
347
315
|
const n3 = z2(t3.clientX, t3.clientY);
|
|
348
316
|
if (n3 && false !== g2?.(t3, n3)) {
|
|
349
|
-
if (
|
|
317
|
+
if (P.isEqualCells(R2.current, n3)) return v2();
|
|
350
318
|
O2(n3), L2(n3);
|
|
351
319
|
}
|
|
352
320
|
}, 60), onPointerUp: (e3) => {
|
|
353
321
|
E2.current = false, $2?.(), f2?.(e3);
|
|
354
|
-
}, processTouch: true, consumeTouch: true }), [l2, a2,
|
|
322
|
+
}, processTouch: true, consumeTouch: true }), [l2, a2, y2, i2, v2, h2, f2]);
|
|
355
323
|
return { onPointerDown: o(s(F2), []), getCellCoordsFromClient: z2 };
|
|
356
|
-
},
|
|
324
|
+
}, _ = (e2, t2, n2) => {
|
|
357
325
|
if (!e2) return t2;
|
|
358
326
|
let o2 = t2;
|
|
359
|
-
const r2 = n2 ===
|
|
327
|
+
const r2 = n2 === O.Right || n2 === O.Down;
|
|
360
328
|
for (; ; ) {
|
|
361
329
|
const t3 = e2(o2, !r2);
|
|
362
330
|
if (0 === t3) return o2;
|
|
363
331
|
r2 ? o2 += t3 : o2 -= t3;
|
|
364
332
|
}
|
|
365
|
-
},
|
|
333
|
+
}, J = (e2, t2, n2) => {
|
|
366
334
|
const o2 = [];
|
|
367
335
|
let r2 = t2;
|
|
368
336
|
for (; r2 <= n2; ) {
|
|
@@ -370,75 +338,75 @@ const ee = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = T.Row, headerCount
|
|
|
370
338
|
0 === t3 ? (o2.push(r2), r2++) : r2 += t3;
|
|
371
339
|
}
|
|
372
340
|
return o2;
|
|
373
|
-
},
|
|
341
|
+
}, Q = (e2, t2, n2, o2, r2, l2) => {
|
|
374
342
|
if (!t2) return l2;
|
|
375
343
|
let { rowIndex: i2, colIndex: c2 } = e2;
|
|
376
344
|
switch (o2) {
|
|
377
|
-
case
|
|
378
|
-
i2 =
|
|
345
|
+
case O.Down: {
|
|
346
|
+
i2 = _(n2, Math.min(i2 + 1, l2), o2);
|
|
379
347
|
let e3 = t2({ rowIndex: i2, colIndex: c2 });
|
|
380
|
-
for (; !e3 && i2 < l2; ) i2 =
|
|
348
|
+
for (; !e3 && i2 < l2; ) i2 = _(n2, Math.min(++i2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
|
|
381
349
|
return i2;
|
|
382
350
|
}
|
|
383
|
-
case
|
|
384
|
-
i2 =
|
|
351
|
+
case O.Up: {
|
|
352
|
+
i2 = _(n2, Math.max(i2 - 1, l2), o2);
|
|
385
353
|
let e3 = t2({ rowIndex: i2, colIndex: c2 });
|
|
386
|
-
for (; !e3 && i2 > l2; ) i2 =
|
|
354
|
+
for (; !e3 && i2 > l2; ) i2 = _(n2, Math.max(--i2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
|
|
387
355
|
return i2;
|
|
388
356
|
}
|
|
389
|
-
case
|
|
390
|
-
c2 =
|
|
357
|
+
case O.Right: {
|
|
358
|
+
c2 = _(n2, Math.min(c2 + 1, l2), o2);
|
|
391
359
|
let e3 = t2({ rowIndex: i2, colIndex: c2 });
|
|
392
|
-
for (; !e3 && c2 < l2; ) c2 =
|
|
360
|
+
for (; !e3 && c2 < l2; ) c2 = _(n2, Math.min(++c2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
|
|
393
361
|
return c2;
|
|
394
362
|
}
|
|
395
|
-
case
|
|
396
|
-
c2 =
|
|
363
|
+
case O.Left: {
|
|
364
|
+
c2 = _(n2, Math.max(c2 - 1, l2), o2);
|
|
397
365
|
let e3 = t2({ rowIndex: i2, colIndex: c2 });
|
|
398
|
-
for (; !e3 && c2 > l2; ) c2 =
|
|
366
|
+
for (; !e3 && c2 > l2; ) c2 = _(n2, Math.max(--c2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
|
|
399
367
|
return c2;
|
|
400
368
|
}
|
|
401
369
|
default:
|
|
402
370
|
return l2;
|
|
403
371
|
}
|
|
404
|
-
},
|
|
372
|
+
}, ee = (e2, t2 = () => true, n2, o2, r2, l2) => {
|
|
405
373
|
let { rowIndex: i2, colIndex: c2 } = e2;
|
|
406
374
|
switch (o2) {
|
|
407
|
-
case
|
|
408
|
-
i2 =
|
|
375
|
+
case O.Down: {
|
|
376
|
+
i2 = _(n2, Math.min(i2 + 1, l2), o2);
|
|
409
377
|
let e3 = t2?.({ rowIndex: i2, colIndex: c2 });
|
|
410
|
-
for (; e3 && i2 < l2; ) i2 =
|
|
378
|
+
for (; e3 && i2 < l2; ) i2 = _(n2, Math.min(++i2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
|
|
411
379
|
return t2?.({ rowIndex: i2, colIndex: c2 }) ? i2 : i2 - 1;
|
|
412
380
|
}
|
|
413
|
-
case
|
|
414
|
-
i2 =
|
|
381
|
+
case O.Up: {
|
|
382
|
+
i2 = _(n2, Math.max(i2 - 1, l2), o2);
|
|
415
383
|
let e3 = t2?.({ rowIndex: i2, colIndex: c2 });
|
|
416
|
-
for (; e3 && i2 > l2; ) i2 =
|
|
384
|
+
for (; e3 && i2 > l2; ) i2 = _(n2, Math.max(--i2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
|
|
417
385
|
return t2?.({ rowIndex: i2, colIndex: c2 }) ? i2 : i2 + 1;
|
|
418
386
|
}
|
|
419
|
-
case
|
|
420
|
-
c2 =
|
|
387
|
+
case O.Right: {
|
|
388
|
+
c2 = _(n2, Math.min(c2 + 1, l2), o2);
|
|
421
389
|
let e3 = t2?.({ rowIndex: i2, colIndex: c2 });
|
|
422
|
-
for (; e3 && c2 < l2; ) c2 =
|
|
390
|
+
for (; e3 && c2 < l2; ) c2 = _(n2, Math.min(++c2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
|
|
423
391
|
return t2?.({ rowIndex: i2, colIndex: c2 }) ? c2 : c2 - 1;
|
|
424
392
|
}
|
|
425
|
-
case
|
|
426
|
-
c2 =
|
|
393
|
+
case O.Left: {
|
|
394
|
+
c2 = _(n2, Math.max(c2 - 1, l2), o2);
|
|
427
395
|
let e3 = t2?.({ rowIndex: i2, colIndex: c2 });
|
|
428
|
-
for (; e3 && c2 > l2; ) c2 =
|
|
396
|
+
for (; e3 && c2 > l2; ) c2 = _(n2, Math.max(--c2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
|
|
429
397
|
return t2?.({ rowIndex: i2, colIndex: c2 }) ? c2 : c2 + 1;
|
|
430
398
|
}
|
|
431
399
|
default:
|
|
432
400
|
return null;
|
|
433
401
|
}
|
|
434
|
-
},
|
|
402
|
+
}, te = (e2, t2, n2, o2, r2, l2) => {
|
|
435
403
|
if (!t2) return l2;
|
|
436
404
|
let i2, { rowIndex: c2, colIndex: s2 } = e2;
|
|
437
|
-
o2 ===
|
|
405
|
+
o2 === O.Down ? i2 = { rowIndex: c2 + 1, colIndex: s2 } : o2 === O.Up ? i2 = { rowIndex: c2 - 1, colIndex: s2 } : o2 === O.Right ? i2 = { rowIndex: c2, colIndex: s2 + 1 } : o2 === O.Left && (i2 = { rowIndex: c2, colIndex: s2 - 1 });
|
|
438
406
|
const a2 = t2(e2), d2 = t2(i2);
|
|
439
407
|
var u2, h2;
|
|
440
|
-
return (h2 = d2, !(u2 = a2) && !h2 || !u2 && h2 || u2 && !h2 ?
|
|
441
|
-
},
|
|
408
|
+
return (h2 = d2, !(u2 = a2) && !h2 || !u2 && h2 || u2 && !h2 ? Q : ee)(e2, t2, n2, o2, false, l2) ?? l2;
|
|
409
|
+
}, ne = (e2, t2) => `${e2}:${t2}`, oe = (e2, t2, n2, o2, r2, l2) => {
|
|
442
410
|
if (n2 - t2 >= r2 - o2) return o2;
|
|
443
411
|
let i2 = o2;
|
|
444
412
|
if ("nearest" === e2 && (o2 - t2 > 0 ? e2 = "start" : n2 - r2 > 0 && (e2 = "end")), "start" === e2) i2 = t2;
|
|
@@ -447,23 +415,23 @@ const ee = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = T.Row, headerCount
|
|
|
447
415
|
i2 = t2 + (n2 - t2) / 2 - (r2 - o2) / 2;
|
|
448
416
|
}
|
|
449
417
|
return i2 < o2 ? Math.max(0, i2) : i2 > o2 ? Math.min(i2, l2 - (r2 - o2)) : void 0;
|
|
450
|
-
},
|
|
451
|
-
if (l2 &&
|
|
418
|
+
}, re = (e2, t2, n2, o2) => (console.log("todo: implement convertToVisibleRanges"), e2), le = (e2, t2 = O.Right, n2, o2, r2, l2 = null) => {
|
|
419
|
+
if (l2 && P.isEqualSelectionCoords(l2, e2)) return e2;
|
|
452
420
|
const i2 = e2.ranges[e2.rangeIndex];
|
|
453
|
-
if (!
|
|
421
|
+
if (!P.isRangesIntersect({ rowStart: e2.cell.rowIndex, colStart: e2.cell.colIndex, rowEnd: e2.cell.rowIndex, colEnd: e2.cell.colIndex }, i2)) return e2;
|
|
454
422
|
let c2 = { ...e2.cell }, s2 = e2.rangeIndex;
|
|
455
423
|
switch (t2) {
|
|
456
|
-
case
|
|
457
|
-
c2.colIndex =
|
|
424
|
+
case O.Right:
|
|
425
|
+
c2.colIndex = _(r2, c2.colIndex + 1, t2);
|
|
458
426
|
break;
|
|
459
|
-
case
|
|
460
|
-
c2.colIndex =
|
|
427
|
+
case O.Left:
|
|
428
|
+
c2.colIndex = _(r2, c2.colIndex - 1, t2);
|
|
461
429
|
break;
|
|
462
|
-
case
|
|
463
|
-
c2.rowIndex =
|
|
430
|
+
case O.Down:
|
|
431
|
+
c2.rowIndex = _(o2, c2.rowIndex + 1, t2);
|
|
464
432
|
break;
|
|
465
|
-
case
|
|
466
|
-
c2.rowIndex =
|
|
433
|
+
case O.Up:
|
|
434
|
+
c2.rowIndex = _(o2, c2.rowIndex - 1, t2);
|
|
467
435
|
}
|
|
468
436
|
const a2 = (t3) => {
|
|
469
437
|
if (t3) {
|
|
@@ -476,54 +444,54 @@ const ee = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = T.Row, headerCount
|
|
|
476
444
|
c2 = { colIndex: t4.colEnd, rowIndex: t4.rowEnd };
|
|
477
445
|
}
|
|
478
446
|
};
|
|
479
|
-
if (t2 ===
|
|
480
|
-
else if (t2 ===
|
|
481
|
-
else if (t2 ===
|
|
482
|
-
else if (t2 ===
|
|
447
|
+
if (t2 === O.Right && c2.colIndex > i2.colEnd && c2.rowIndex === i2.rowEnd) a2(true);
|
|
448
|
+
else if (t2 === O.Left && c2.colIndex < i2.colStart && c2.rowIndex === i2.rowStart) a2(false);
|
|
449
|
+
else if (t2 === O.Down && c2.colIndex === i2.colEnd && c2.rowIndex > i2.rowEnd) a2(true);
|
|
450
|
+
else if (t2 === O.Up && c2.colIndex === i2.colStart && c2.rowIndex < i2.rowStart) a2(false);
|
|
483
451
|
else {
|
|
484
452
|
let e3 = c2.rowIndex, n3 = c2.colIndex;
|
|
485
453
|
switch (t2) {
|
|
486
|
-
case
|
|
487
|
-
n3 > i2.colEnd && (e3 =
|
|
454
|
+
case O.Right:
|
|
455
|
+
n3 > i2.colEnd && (e3 = _(o2, e3 + 1, t2), n3 = i2.colStart, e3 > i2.rowEnd && (e3 = i2.rowStart));
|
|
488
456
|
break;
|
|
489
|
-
case
|
|
490
|
-
n3 < i2.colStart && (e3 =
|
|
457
|
+
case O.Left:
|
|
458
|
+
n3 < i2.colStart && (e3 = _(o2, e3 - 1, t2), n3 = i2.colEnd, e3 < i2.rowStart && (e3 = i2.rowEnd));
|
|
491
459
|
break;
|
|
492
|
-
case
|
|
493
|
-
e3 > i2.rowEnd && (n3 =
|
|
460
|
+
case O.Down:
|
|
461
|
+
e3 > i2.rowEnd && (n3 = _(r2, n3 + 1, t2), e3 = i2.rowStart, n3 > i2.colEnd && (n3 = i2.colStart));
|
|
494
462
|
break;
|
|
495
|
-
case
|
|
496
|
-
e3 < i2.rowStart && (n3 =
|
|
463
|
+
case O.Up:
|
|
464
|
+
e3 < i2.rowStart && (n3 = _(r2, n3 - 1, t2), e3 = i2.rowEnd, n3 < i2.colStart && (n3 = i2.colEnd));
|
|
497
465
|
}
|
|
498
466
|
c2 = { rowIndex: e3, colIndex: n3 };
|
|
499
467
|
}
|
|
500
468
|
let d2 = n2(c2);
|
|
501
|
-
if (!
|
|
502
|
-
const e3 =
|
|
469
|
+
if (!P.isRangeWithinRange(d2, i2)) {
|
|
470
|
+
const e3 = P.intersectRanges(d2, i2);
|
|
503
471
|
e3 && (d2 = e3);
|
|
504
472
|
}
|
|
505
|
-
let u2 = { rowStart:
|
|
473
|
+
let u2 = { rowStart: _(o2, d2.rowStart, O.Down), colStart: _(r2, d2.colStart, O.Right), rowEnd: _(o2, d2.rowEnd, O.Up), colEnd: _(r2, d2.colEnd, O.Left) };
|
|
506
474
|
if (u2.rowStart !== c2.rowIndex || u2.colStart !== c2.colIndex) {
|
|
507
475
|
switch (t2) {
|
|
508
|
-
case
|
|
476
|
+
case O.Right:
|
|
509
477
|
e2.ranges[s2].colStart === u2.colStart && e2.ranges[s2].colEnd === u2.colEnd && (c2.rowIndex = u2.rowEnd), c2.colIndex = u2.colEnd;
|
|
510
478
|
break;
|
|
511
|
-
case
|
|
479
|
+
case O.Left:
|
|
512
480
|
e2.ranges[s2].colStart === u2.colStart && e2.ranges[s2].colEnd === u2.colEnd && (c2.rowIndex = u2.rowStart), c2.rowIndex === u2.rowStart ? c2.colIndex = u2.colStart + 1 : c2.colIndex = u2.colStart;
|
|
513
481
|
break;
|
|
514
|
-
case
|
|
482
|
+
case O.Down:
|
|
515
483
|
e2.ranges[s2].rowStart === u2.rowStart && e2.ranges[s2].rowEnd === u2.rowEnd && (c2.colIndex = u2.colEnd), c2.rowIndex = u2.rowEnd;
|
|
516
484
|
break;
|
|
517
|
-
case
|
|
485
|
+
case O.Up:
|
|
518
486
|
e2.ranges[s2].rowStart === u2.rowStart && e2.ranges[s2].rowEnd === u2.rowEnd && (c2.colIndex = u2.colStart), c2.colIndex === u2.colStart ? c2.rowIndex = u2.rowStart + 1 : c2.rowIndex = u2.rowStart;
|
|
519
487
|
}
|
|
520
|
-
return
|
|
488
|
+
return le({ cell: c2, ranges: e2.ranges, rangeIndex: s2 }, t2, n2, o2, r2, l2 ?? e2);
|
|
521
489
|
}
|
|
522
490
|
return { ranges: e2.ranges, cell: c2, rangeIndex: s2 };
|
|
523
|
-
},
|
|
491
|
+
}, ie = (e2, t2) => {
|
|
524
492
|
let n2, o2 = 0, r2 = 0;
|
|
525
|
-
return t2.colStart < e2.colStart ? (n2 =
|
|
526
|
-
},
|
|
493
|
+
return t2.colStart < e2.colStart ? (n2 = O.Left, o2 = e2.colStart - t2.colStart, r2 = t2.colStart) : t2.colEnd > e2.colEnd ? (n2 = O.Right, o2 = t2.colEnd - e2.colEnd, r2 = t2.colEnd) : t2.rowStart < e2.rowStart ? (n2 = O.Up, o2 = e2.rowStart - t2.rowStart, r2 = t2.rowStart) : t2.rowEnd > e2.rowEnd && (n2 = O.Down, o2 = t2.rowEnd - e2.rowEnd, r2 = t2.rowEnd), { direction: n2, amount: o2, index: r2 };
|
|
494
|
+
}, ce = (e2, t2 = false, n2, o2) => {
|
|
527
495
|
if (!n2) return 0;
|
|
528
496
|
const r2 = !t2, l2 = r2 ? 1 : -1;
|
|
529
497
|
let i2 = n2(r2 ? e2 : e2 + 1), c2 = n2(r2 ? e2 + 1 : e2), s2 = e2 + (r2 ? 2 : -1), a2 = 0;
|
|
@@ -532,7 +500,7 @@ const ee = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = T.Row, headerCount
|
|
|
532
500
|
i2 = c2, c2 = n2(s2), s2 += l2, a2++;
|
|
533
501
|
}
|
|
534
502
|
return a2;
|
|
535
|
-
},
|
|
503
|
+
}, se = (e2, t2, n2, o2, r2) => {
|
|
536
504
|
const l2 = {};
|
|
537
505
|
let i2 = null, c2 = null;
|
|
538
506
|
const s2 = n2.length;
|
|
@@ -543,35 +511,35 @@ const ee = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = T.Row, headerCount
|
|
|
543
511
|
i2 = r3 + 1, c2 = d2, l2[r3] = Object.freeze({ offset: s3, size: d2 - s3, spanIndex: a2 });
|
|
544
512
|
}
|
|
545
513
|
return Object.freeze(l2);
|
|
546
|
-
},
|
|
514
|
+
}, ae = (e2, t2, n2) => {
|
|
547
515
|
const o2 = e2.getColOffset(t2.colStart) + (n2?.left ?? 0), r2 = e2.getRowOffset(t2.rowStart) + (n2?.top ?? 0);
|
|
548
516
|
return { x: o2, y: r2, width: e2.getColOffset(t2.colEnd + 1) + (n2?.right ?? 0) - (n2?.left ?? 0) - o2, height: e2.getRowOffset(t2.rowEnd + 1) + (n2?.bottom ?? 0) - (n2?.top ?? 0) - r2 };
|
|
549
|
-
},
|
|
517
|
+
}, de = (e2, t2, n2) => {
|
|
550
518
|
if (!n2) return false;
|
|
551
519
|
const o2 = n2.x;
|
|
552
520
|
if (e2 < o2 || e2 > o2 + n2.width) return false;
|
|
553
521
|
const r2 = n2.y;
|
|
554
522
|
return !(t2 < r2 || t2 > r2 + n2.height);
|
|
555
|
-
},
|
|
523
|
+
}, ue = (e2, t2 = true) => `M ${i.boundPixel(e2.left)} ${i.boundPixel(e2.top)} L ${i.boundPixel(e2.right, true)} ${i.boundPixel(e2.top)} L ${i.boundPixel(e2.right, true)} ${i.boundPixel(e2.bottom, true)} L ${i.boundPixel(e2.left)} ${i.boundPixel(e2.bottom, true)} L ${i.boundPixel(e2.left)} ${i.boundPixel(e2.top)} ${t2 ? "Z" : ""}`, he = (t2) => {
|
|
556
524
|
const { linePoints: n2, bounds: o2, pathProps: r2, style: l2, ...c2 } = t2;
|
|
557
525
|
return e("svg", { width: `${i.boundPixel(o2.width, true)}`, height: `${i.boundPixel(o2.height, true)}`, viewBox: `0 0 ${i.boundPixel(o2.width, true)} ${i.boundPixel(o2.height, true)}`, style: { position: "absolute", left: `${i.boundPixel(o2.x)}px`, top: `${i.boundPixel(o2.y)}px`, width: `${i.boundPixel(o2.width, true)}px`, height: `${i.boundPixel(o2.height, true)}px`, pointerEvents: "none", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top, width, height", willChange: "left, top, width, height, stroke-dashoffset", ...l2 }, ...c2, children: e("path", { d: `M ${i.boundPixel(n2[0])} ${i.boundPixel(n2[1])} L ${i.boundPixel(n2[2])} ${i.boundPixel(n2[3])}`, fill: "none", vectorEffect: "non-scaling-stroke", stroke: "black", ...r2 }) });
|
|
558
|
-
},
|
|
526
|
+
}, ge = (n2) => {
|
|
559
527
|
const { x: o2 = 0, y: r2 = 0, width: l2 = 0, height: c2 = 0, fill: s2, stroke: a2, strokeWidth: d2 = 0, strokeDasharray: u2, strokeDashoffset: h2, clipPath: g2, pathBounds: f2, pathProps: w2, style: x2, ...p2 } = n2, m2 = r2, v2 = o2, S2 = l2, y2 = c2;
|
|
560
528
|
let b2 = null;
|
|
561
529
|
if (s2) {
|
|
562
|
-
let t2 =
|
|
563
|
-
f2 && (t2 = t2 + " " +
|
|
530
|
+
let t2 = ue({ top: 0, left: 0, bottom: y2, right: S2 });
|
|
531
|
+
f2 && (t2 = t2 + " " + ue({ top: f2.y - m2, left: f2.x - v2, bottom: f2.height + f2.y - m2, right: f2.width + f2.x - v2 })), b2 = [e("path", { d: t2, fill: s2, stroke: "none", fillRule: "evenodd" }, "fill")];
|
|
564
532
|
}
|
|
565
|
-
return t("svg", { width: `${i.boundPixel(l2, true)}`, height: `${i.boundPixel(c2, true)}`, viewBox: `0 0 ${i.boundPixel(l2, true)} ${i.boundPixel(c2, true)}`, preserveAspectRatio: "none", style: { position: "absolute", left: `${i.boundPixel(o2)}px`, top: `${i.boundPixel(r2)}px`, pointerEvents: "none", transitionDuration: "0ms", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top, width, height", willChange: "left, top, width, height, stroke-dashoffset", boxShadow: "rgb(60 64 67 / 5%) 0px 1px 4px 2px, rgb(255 255 255 / 15%) 0px 0px 2px 1px", overflow: "visible", ...x2 }, ...p2, children: [b2, e("path", { d:
|
|
566
|
-
},
|
|
533
|
+
return t("svg", { width: `${i.boundPixel(l2, true)}`, height: `${i.boundPixel(c2, true)}`, viewBox: `0 0 ${i.boundPixel(l2, true)} ${i.boundPixel(c2, true)}`, preserveAspectRatio: "none", style: { position: "absolute", left: `${i.boundPixel(o2)}px`, top: `${i.boundPixel(r2)}px`, pointerEvents: "none", transitionDuration: "0ms", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top, width, height", willChange: "left, top, width, height, stroke-dashoffset", boxShadow: "rgb(60 64 67 / 5%) 0px 1px 4px 2px, rgb(255 255 255 / 15%) 0px 0px 2px 1px", overflow: "visible", ...x2 }, ...p2, children: [b2, e("path", { d: ue({ top: 0, left: 0, right: S2, bottom: y2 }), fill: "none", strokeDasharray: u2, strokeDashoffset: h2, stroke: a2, vectorEffect: "non-scaling-stroke", strokeWidth: d2, ...w2 })] });
|
|
534
|
+
}, fe = (t2) => {
|
|
567
535
|
const { key: n2, ...o2 } = t2;
|
|
568
|
-
return e(
|
|
569
|
-
},
|
|
536
|
+
return e(we, { ...o2 }, n2);
|
|
537
|
+
}, we = C((t2) => {
|
|
570
538
|
const { stroke: n2, fill: o2, x: r2 = 0, y: l2 = 0, width: i2 = 0, height: c2 = 0, style: s2, isAnimatedStroke: d2, animatedStrokeProps: u2, range: h2, cell: g2, ...f2 } = t2, w2 = d2 || !!u2, x2 = { name: "walking-offset", dashGap: 2, speed: 50, dashLength: 8, ...u2 };
|
|
571
539
|
let p2 = x2.dashGap + x2.dashLength;
|
|
572
|
-
const
|
|
540
|
+
const m2 = x2.speed * p2, S2 = a().replaceAll(":", ""), y2 = `${x2.name}-${S2}`;
|
|
573
541
|
let b2;
|
|
574
|
-
return
|
|
542
|
+
return v(() => {
|
|
575
543
|
if (!w2) return;
|
|
576
544
|
const e2 = `@keyframes ${y2} {
|
|
577
545
|
to {
|
|
@@ -582,10 +550,10 @@ const ee = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = T.Row, headerCount
|
|
|
582
550
|
return t3.sheet.insertRule(e2, 0), () => {
|
|
583
551
|
document.head.removeChild(t3);
|
|
584
552
|
};
|
|
585
|
-
}, [w2]), w2 && (b2 = { strokeDasharray: `${x2.dashLength}px ${x2.dashGap}px`, strokeDashoffset: `${p2}px`, animation: `${y2} ${
|
|
553
|
+
}, [w2]), w2 && (b2 = { strokeDasharray: `${x2.dashLength}px ${x2.dashGap}px`, strokeDashoffset: `${p2}px`, animation: `${y2} ${m2}ms linear infinite`, willChange: "stroke-dashoffset" }), e(ge, { x: r2, y: l2, width: i2, height: c2, stroke: n2, fill: o2, shapeRendering: "crispEdges", style: { ...b2, ...s2 }, ...f2 });
|
|
586
554
|
});
|
|
587
|
-
|
|
588
|
-
const
|
|
555
|
+
we.displayName = "Selection";
|
|
556
|
+
const xe = C(I((t2, n2) => {
|
|
589
557
|
const { x: o2 = 0, y: r2 = 0, borderWidth: l2 = 1, size: i2 = 6, borderStroke: c2, corner: s2, style: a2, className: d2, background: u2, ...h2 } = t2;
|
|
590
558
|
if (0 === o2 || 0 === r2) return null;
|
|
591
559
|
let g2 = true, f2 = true, w2 = true, x2 = true;
|
|
@@ -602,13 +570,13 @@ const Se = b(C((t2, n2) => {
|
|
|
602
570
|
case "tr":
|
|
603
571
|
f2 = false, w2 = false;
|
|
604
572
|
}
|
|
605
|
-
return e("div", { className:
|
|
573
|
+
return e("div", { className: k("fill-handle", d2), style: { position: "absolute", left: o2 - (i2 + (g2 ? l2 : 0)) / 2, top: r2 - (i2 + (f2 ? l2 : 0)) / 2, width: i2, height: i2, borderLeft: g2 ? `${l2}px ${c2}` : void 0, borderTop: f2 ? `${l2}px ${c2}` : void 0, borderRight: w2 ? `${l2}px ${c2}` : void 0, borderBottom: x2 ? `${l2}px ${c2}` : void 0, background: u2, cursor: "crosshair", pointerEvents: "all", transitionDuration: "0ms", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top", willChange: "left, top", ...a2 }, tabIndex: -1, ...h2 });
|
|
606
574
|
}));
|
|
607
|
-
|
|
608
|
-
const
|
|
609
|
-
const { range: i2, view: c2, anchor: a2, borderStroke:
|
|
610
|
-
if (!
|
|
611
|
-
const
|
|
575
|
+
xe.displayName = "FillHandle";
|
|
576
|
+
const pe = i.detectIt().supportsTouchEvents, me = C(I((r2, l2) => {
|
|
577
|
+
const { range: i2, view: c2, anchor: a2, borderStroke: h2 = "rgb(33, 115, 70)", background: g2 = "white", borderWidth: f2 = 1.5, size: w2 = 22, style: p2, className: S2, selectionTouchPointerHandler: y2, onTouchSelectStart: C2, onTouchSelectEnd: I2, currentTouchAnchor: E2, scrollableElement: R2, scrollableRoot: M2, ...P2 } = r2;
|
|
578
|
+
if (!pe) return null;
|
|
579
|
+
const T2 = o(C2, [C2]), D2 = o(I2, [I2]), { bounds: O2, coordsPivot: z2, key: L2 } = b(() => {
|
|
612
580
|
if (!i2 || !c2) return null;
|
|
613
581
|
let e2 = null, t2 = null;
|
|
614
582
|
switch (a2) {
|
|
@@ -629,7 +597,7 @@ const ye = i.detectIt().supportsTouchEvents, be = b(C((r2, l2) => {
|
|
|
629
597
|
e2 = { colIndex: i2.colStart, rowIndex: i2.rowEnd };
|
|
630
598
|
}
|
|
631
599
|
let n2 = c2.getRangeCoordsBounds(t2 ? { rowStart: t2.rowIndex, colStart: t2.colIndex, rowEnd: t2.rowIndex, colEnd: t2.colIndex } : i2);
|
|
632
|
-
const o2 = c2.getBounds(), r3 = c2.getViewportSize(), l3 = o2.x, s2 = o2.y, d2 = r3.width,
|
|
600
|
+
const o2 = c2.getBounds(), r3 = c2.getViewportSize(), l3 = o2.x, s2 = o2.y, d2 = r3.width, u2 = r3.height;
|
|
633
601
|
switch (a2) {
|
|
634
602
|
case "tl":
|
|
635
603
|
break;
|
|
@@ -643,91 +611,91 @@ const ye = i.detectIt().supportsTouchEvents, be = b(C((r2, l2) => {
|
|
|
643
611
|
n2.x = d2 / 2 - l3, n2.y = n2.y + n2.height;
|
|
644
612
|
break;
|
|
645
613
|
case "l":
|
|
646
|
-
n2.y =
|
|
614
|
+
n2.y = u2 / 2 - s2;
|
|
647
615
|
break;
|
|
648
616
|
case "r":
|
|
649
|
-
n2.x = n2.x + n2.width, n2.y =
|
|
617
|
+
n2.x = n2.x + n2.width, n2.y = u2 / 2 - s2;
|
|
650
618
|
}
|
|
651
619
|
const h3 = c2.toClipBounds(n2, 0);
|
|
652
|
-
return !h3 || h3.width <= 0 || h3.height <= 0 || n2.x < 0 || n2.y < 0 || n2.x > d2 || n2.y >
|
|
653
|
-
}, [i2, c2, a2]),
|
|
620
|
+
return !h3 || h3.width <= 0 || h3.height <= 0 || n2.x < 0 || n2.y < 0 || n2.x > d2 || n2.y > u2 ? { bounds: null, coordsAnchor: null, coordsPivot: null, key: null } : { bounds: n2, coordsAnchor: null, coordsPivot: e2, key: "touchSelect-" + c2.getAnchor() + "-" + a2 };
|
|
621
|
+
}, [i2, c2, a2]), F2 = x(null), W2 = b(() => {
|
|
654
622
|
const e2 = (e3) => "t" === a2 || "b" === a2 ? { ...e3, colIndex: void 0 } : "l" === a2 || "r" === a2 ? { ...e3, rowIndex: void 0 } : e3;
|
|
655
623
|
return { processTouch: true, consumeTouch: true, onPointerDown: (t2, n2) => {
|
|
656
624
|
const o2 = e2(c2.getCellCoordsFromClient(t2.clientX, t2.clientY));
|
|
657
|
-
return
|
|
625
|
+
return F2.current = { coordsPivot: z2 }, T2?.(a2), y2.onSelectionPointerDown(t2, n2, c2, o2, z2, false, true);
|
|
658
626
|
}, onPointerMoveOrWait: (t2, n2, o2) => {
|
|
659
627
|
const r3 = e2(c2.getCellCoordsFromClient(t2.clientX, t2.clientY));
|
|
660
|
-
return
|
|
661
|
-
}, onPointerUp: (e3, t2, n2) => (
|
|
662
|
-
}, [
|
|
663
|
-
return
|
|
664
|
-
const t2 =
|
|
665
|
-
if (!t2 || !
|
|
666
|
-
let n2 = 0, o2 = 0, r3 =
|
|
667
|
-
for (; r3; ) n2 += r3.scrollLeft, o2 += r3.scrollTop, r3 =
|
|
668
|
-
|
|
669
|
-
}, [
|
|
628
|
+
return y2.onSelectionPointerMoveOrWait(t2, n2, o2, c2, r3, F2.current?.coordsPivot, true, true);
|
|
629
|
+
}, onPointerUp: (e3, t2, n2) => (F2.current = null, D2?.(a2), y2.onPointerUp(e3, t2, n2)) };
|
|
630
|
+
}, [y2, i2, c2, a2]), A2 = s(W2), [V2, { y: U2, x: H2 }] = d(), K2 = x(null), { getPortalContainer: N2, isFullscreen: q2 } = u(), [j2, X2] = m(null);
|
|
631
|
+
return v(() => {
|
|
632
|
+
const t2 = K2.current?.getBoundingClientRect();
|
|
633
|
+
if (!t2 || !O2) return void X2(null);
|
|
634
|
+
let n2 = 0, o2 = 0, r3 = R2;
|
|
635
|
+
for (; r3; ) n2 += r3.scrollLeft, o2 += r3.scrollTop, r3 = M2 && r3 === M2.parentElement ? null : r3.parentElement;
|
|
636
|
+
X2($(e("div", { className: k("touch-select-handle", S2), ref: l2, style: { position: "absolute", left: n2 + (t2?.x ?? 0) - (w2 + f2) / 2, top: o2 + (t2?.y ?? 0) - (w2 + f2) / 2, width: w2, height: w2, borderWidth: `${f2}px`, border: h2, borderRadius: "50%", background: g2, boxShadow: `0 0 0 1.5px ${g2}`, cursor: "grab", pointerEvents: "all", opacity: E2 ? 0 : 1, transitionDuration: "160ms", transitionProperty: "opacity", ...p2 }, tabIndex: -1, onPointerDown: A2, ...P2 }), M2 ?? N2(), L2));
|
|
637
|
+
}, [U2, H2, O2?.x, O2?.y, O2?.width, O2?.height, S2, E2, g2, w2, f2, h2, R2, q2]), O2 ? t(n, { children: [e("div", { ref: B([V2, K2]), style: { position: "absolute", left: O2.x, top: O2.y, opacity: 0 } }), j2] }) : null;
|
|
670
638
|
}));
|
|
671
|
-
|
|
672
|
-
const
|
|
639
|
+
me.displayName = "TouchSelectHandle";
|
|
640
|
+
const ve = -10, Se = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd: 0 }), ye = Object.freeze({ colIndex: 0, rowIndex: 0 }), be = Object.freeze([]), Ce = (e2) => {
|
|
673
641
|
if (e2 && e2.cell && e2.ranges && e2.rangeIndex > -1 && e2.rangeIndex <= e2.ranges.length) return e2;
|
|
674
|
-
const t2 = { cell: null, ranges: e2?.ranges ??
|
|
675
|
-
return t2.rangeIndex = e2?.rangeIndex ?? t2.ranges.length - 1, t2.cell = e2?.cell, !t2.cell && t2.ranges.length > 0 && (t2.cell = { rowIndex: t2.ranges[t2.rangeIndex].rowStart, colIndex: t2.ranges[t2.rangeIndex].colStart }), t2.cell || (t2.cell =
|
|
676
|
-
},
|
|
642
|
+
const t2 = { cell: null, ranges: e2?.ranges ?? be };
|
|
643
|
+
return t2.rangeIndex = e2?.rangeIndex ?? t2.ranges.length - 1, t2.cell = e2?.cell, !t2.cell && t2.ranges.length > 0 && (t2.cell = { rowIndex: t2.ranges[t2.rangeIndex].rowStart, colIndex: t2.ranges[t2.rangeIndex].colStart }), t2.cell || (t2.cell = ye), P.isEqualSelectionCoords(t2, e2) ? e2 : t2;
|
|
644
|
+
}, Ie = (e2, t2, n2) => {
|
|
677
645
|
const o2 = e2.getVisibleRangeCoords(), r2 = e2.getScrollOrientation();
|
|
678
|
-
!r2.horizontal && (t2.colIndex > o2.colEnd || t2.colIndex < o2.colStart) && (t2 = { ...t2, colIndex: t2.colIndex > o2.colEnd ? o2.colEnd + 1 : o2.colEnd - 1 }, e2 = n2.current.getViewFromLocation(
|
|
679
|
-
},
|
|
680
|
-
const he2 =
|
|
681
|
-
|
|
646
|
+
!r2.horizontal && (t2.colIndex > o2.colEnd || t2.colIndex < o2.colStart) && (t2 = { ...t2, colIndex: t2.colIndex > o2.colEnd ? o2.colEnd + 1 : o2.colEnd - 1 }, e2 = n2.current.getViewFromLocation(z.Center)), !r2.vertical && (t2.rowIndex > o2.rowEnd || t2.rowIndex < o2.rowStart) && (t2 = { ...t2, rowIndex: t2.rowIndex > o2.rowEnd ? o2.rowEnd + 1 : o2.rowEnd - 1 }, e2 = n2.current.getViewFromLocation(z.Center)), e2.scrollCellCoordsIntoView(t2);
|
|
647
|
+
}, Ee = () => false, Re = ({ gridRef: t2, commands: n2, layout: r2, selection: l2, onSelectionChange: a2, onSelectionDragStart: d2, onSelectionDragEnd: u2, selectionPolicy: f2 = "multiple", newSelectionMode: w2 = "clear", allowDeselectSelection: p2 = true, onFillPreview: C2, onFillCancel: I2, onFillDone: R2, onFill: M2, disableFillDrag: k2 = !M2, fillHandleBorderColor: D2 = "white", hiddenRowsAt: L2, hiddenColumnsAt: $2, isContentfulCell: B2, contentfulCellFinder: F2 = te, getDataCoords: W2, alwaysScrollToActiveCoords: A2 = false, selectionBounds: V2, pointerDownInterceptor: U2, pointerMoveInterceptor: H2, mergedRanges: K2, canSelectionSpanMergedCells: N2 = Ee, onMoveDragStart: q2, onMoveDragUpdate: j2, onMoveDragEnd: X2, onMoveDragDone: Y2, selectionRenderer: G2 = fe, disableMoveDrag: Z2 = !X2, getCellCoordsAsRangeCoords: J2 = P.cellToRange, moveDragHitSize: Q2 = 6, moveDragOutlineSize: ee2 = 4, selectionBackgroundColor: ne2 = "rgba(16, 124, 65, 0.1)", selectionBorderColor: oe2 = "rgb(33, 115, 70)", selectionRemoveBorderColor: se2 = "rgb(255, 0, 0)", selectionRemoveBackgroundColor: ae2 = "rgba(250, 10, 10, 0.1)", disableTouchSelection: de2 = false, touchSelectHandleProps: ue2 }) => {
|
|
648
|
+
const he2 = S(() => ({ top: V2?.top ?? 0, left: V2?.left ?? 0, bottom: t2.current?.rowCount - 1 || 0, right: t2.current?.columnCount - 1 || 0 }), []), ge2 = o(M2, [M2]), we2 = o(C2, [C2]), pe2 = o(I2, [I2]), Re2 = o(R2, [R2]), Me2 = o(B2, [B2]), ke2 = o(G2, [G2]), Pe2 = o((e2, t3 = false) => ce(e2, t3, r2.getRowOffset, t3 ? he2().bottom : he2().top), [r2?.getRowOffset]), Te2 = o(L2 ?? Pe2, [L2]), De2 = o((e2, t3 = false) => ce(e2, t3, r2.getColOffset, t3 ? he2().right : he2().left), [r2?.getColOffset]), Oe2 = o($2 ?? De2, [$2]), [ze2, Le2] = m(() => Ce(l2)), $e2 = b(() => Ce(ze2), [ze2]), Be2 = x($e2), Fe2 = x(true);
|
|
649
|
+
y(T.throttle(() => {
|
|
682
650
|
Le2((e2) => {
|
|
683
651
|
Fe2.current = true;
|
|
684
|
-
const t3 =
|
|
685
|
-
return
|
|
652
|
+
const t3 = Ce(l2);
|
|
653
|
+
return P.isEqualSelectionCoords(t3, e2) ? e2 : t3;
|
|
686
654
|
});
|
|
687
|
-
}, 0), [l2]),
|
|
655
|
+
}, 0), [l2]), y(() => {
|
|
688
656
|
Be2.current = $e2;
|
|
689
|
-
}, [$e2]),
|
|
690
|
-
Fe2.current || !a2 ||
|
|
657
|
+
}, [$e2]), v(() => {
|
|
658
|
+
Fe2.current || !a2 || P.isEqualSelectionCoords(l2, $e2) || a2($e2);
|
|
691
659
|
}, [$e2]);
|
|
692
|
-
const
|
|
660
|
+
const We2 = S((e2) => {
|
|
693
661
|
Le2((t3) => {
|
|
694
|
-
Fe2.current = false, t3 =
|
|
695
|
-
let n3 = "function" == typeof e2 ? e2(t3.ranges) : e2 ??
|
|
696
|
-
if (
|
|
662
|
+
Fe2.current = false, t3 = Ce(t3);
|
|
663
|
+
let n3 = "function" == typeof e2 ? e2(t3.ranges) : e2 ?? be;
|
|
664
|
+
if (P.isEqualRangesArrays(n3, t3.ranges)) return t3;
|
|
697
665
|
let o2 = Math.max(n3.length ? 0 : -1, Math.min(t3.rangeIndex, n3.length - 1)), r3 = t3.cell;
|
|
698
|
-
-1 === o2 ||
|
|
666
|
+
-1 === o2 || P.isCellWithinRange(r3, n3[o2]) || (r3 = { rowIndex: n3[o2].rowStart, colIndex: n3[o2].colStart }), 1 === n3.length && P.isSingleCell(n3[0]) && P.isCellWithinRange(r3, n3[0]) && (n3 = [], o2 = -1);
|
|
699
667
|
const l3 = { cell: r3, ranges: n3, rangeIndex: o2 };
|
|
700
|
-
return
|
|
668
|
+
return P.isEqualSelectionCoords(l3, t3) ? t3 : l3;
|
|
701
669
|
});
|
|
702
|
-
}, []),
|
|
670
|
+
}, []), Ae2 = o((e2) => {
|
|
703
671
|
Le2((t3) => {
|
|
704
|
-
Fe2.current = false, t3 =
|
|
705
|
-
const n3 = e2 ??
|
|
706
|
-
if (!
|
|
707
|
-
if (
|
|
672
|
+
Fe2.current = false, t3 = Ce(t3);
|
|
673
|
+
const n3 = e2 ?? ye, o2 = J2(n3);
|
|
674
|
+
if (!P.isSingleCell(o2) && 0 === t3.ranges.length) return { ranges: [o2], rangeIndex: 0, cell: n3 };
|
|
675
|
+
if (P.isEqualCells(n3, t3.cell)) return t3;
|
|
708
676
|
let r3 = t3.ranges, l3 = t3.rangeIndex;
|
|
709
|
-
1 === t3.ranges.length && (
|
|
677
|
+
1 === t3.ranges.length && (P.isSingleCell(t3.ranges[0]) && P.isCellWithinRange(n3, t3.ranges[0]) || !P.isCellWithinRange(n3, t3.ranges[0])) && (r3 = [], l3 = -1);
|
|
710
678
|
const i2 = { ranges: r3, rangeIndex: l3, cell: n3 };
|
|
711
|
-
return
|
|
679
|
+
return P.isEqualSelectionCoords(i2, t3) ? t3 : i2;
|
|
712
680
|
});
|
|
713
|
-
}, [
|
|
714
|
-
|
|
715
|
-
|
|
681
|
+
}, [J2]), [Ve2, Ue2] = m(null), [He2, Ke2] = m(null), Ne2 = x(null), [qe2, je2] = m(null), Xe2 = x(null), Ye2 = x(null), [Ge2, Ze] = m(null), _e = x(null), Je = x(null), Qe = x(K2);
|
|
682
|
+
v(() => {
|
|
683
|
+
Qe.current = K2;
|
|
716
684
|
}, [K2]);
|
|
717
685
|
const et = o((e2, n3 = { inline: "nearest", block: "nearest" }) => {
|
|
718
686
|
let { rowIndex: o2, colIndex: r3 } = e2;
|
|
719
687
|
void 0 === o2 && $e2?.cell && (o2 = $e2.cell.rowIndex), void 0 === r3 && $e2?.cell && (r3 = $e2.cell.colIndex), void 0 !== o2 && void 0 !== r3 && t2.current?.scrollCellCoordsIntoView({ rowIndex: o2, colIndex: r3 }, n3);
|
|
720
|
-
}, [$e2]), tt =
|
|
688
|
+
}, [$e2]), tt = S((e2) => {
|
|
721
689
|
const t3 = he2();
|
|
722
690
|
return e2.rowIndex < t3.top || e2.colIndex < t3.left || e2.colIndex > t3.right || e2.rowIndex > t3.bottom;
|
|
723
691
|
}, []), nt = o((e2, n3) => {
|
|
724
692
|
if (!t2?.current) return null;
|
|
725
693
|
const o2 = { rowStart: Math.min(e2.rowIndex, n3.rowIndex), colStart: Math.min(e2.colIndex, n3.colIndex), rowEnd: Math.max(e2.rowIndex, n3.rowIndex), colEnd: Math.max(e2.colIndex, n3.colIndex) }, r3 = N2?.(o2);
|
|
726
694
|
if (r3) return o2;
|
|
727
|
-
const l3 =
|
|
695
|
+
const l3 = J2(e2), i2 = J2(n3), c2 = { rowStart: Math.min(l3.rowStart, i2.rowStart), colStart: Math.min(l3.colStart, i2.colStart), rowEnd: Math.max(l3.rowEnd, i2.rowEnd), colEnd: Math.max(l3.colEnd, i2.colEnd) };
|
|
728
696
|
let s2;
|
|
729
|
-
return "function" == typeof
|
|
730
|
-
}, [N2,
|
|
697
|
+
return "function" == typeof Qe.current ? s2 = Qe.current(c2) : K2 && (s2 = K2), s2 ? P.extendRangeToUnionRanges(c2, s2) : c2;
|
|
698
|
+
}, [N2, J2]), ot = o((e2, t3, n3) => {
|
|
731
699
|
const o2 = e2.ranges.length > 0 ? e2.ranges[e2.rangeIndex] : { rowStart: e2.cell.rowIndex, colStart: e2.cell.colIndex, rowEnd: e2.cell.rowIndex, colEnd: e2.cell.colIndex }, r3 = { rowStart: Math.min(t3.rowIndex ?? o2.rowStart, n3.rowIndex ?? o2.rowStart), colStart: Math.min(t3.colIndex ?? o2.colStart, n3.colIndex ?? o2.colStart), rowEnd: Math.max(t3.rowIndex ?? o2.rowEnd, n3.rowIndex ?? o2.rowEnd), colEnd: Math.max(t3.colIndex ?? o2.colEnd, n3.colIndex ?? o2.colEnd) }, l3 = { rowIndex: r3.rowStart, colIndex: r3.colStart }, i2 = { rowIndex: r3.rowEnd, colIndex: r3.colEnd };
|
|
732
700
|
if (tt(l3) || tt(i2)) return;
|
|
733
701
|
return nt(l3, i2);
|
|
@@ -737,69 +705,69 @@ const Ce = -10, Ie = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
737
705
|
const o2 = ot(Be2.current, e2, t3 ?? Be2.current.cell);
|
|
738
706
|
if (!o2) return;
|
|
739
707
|
const r3 = Be2.current.rangeIndex;
|
|
740
|
-
|
|
741
|
-
}, []), lt =
|
|
708
|
+
We2((e3) => e3.length ? e3.map((e4, t4) => r3 === t4 ? o2 : e4) : [o2]), n3 && o2 && Ae2({ colIndex: o2.colStart, rowIndex: o2.rowStart });
|
|
709
|
+
}, []), lt = S((e2, t3, n3) => {
|
|
742
710
|
if (!Be2.current) return;
|
|
743
711
|
e2 = { ...Be2.current?.cell, ...e2 }, t3 = t3 ?? e2;
|
|
744
712
|
const o2 = ot(Be2.current, e2, t3);
|
|
745
713
|
if (!o2) return;
|
|
746
714
|
const r3 = { rowIndex: o2.rowStart, colIndex: o2.colStart }, l3 = { ...r3, ...n3 };
|
|
747
|
-
"clear" ===
|
|
748
|
-
}, []), it =
|
|
715
|
+
"clear" === w2 ? (_e.current = l3, ct()) : "modify" === w2 ? rt(r3) : it(r3), Ae2(l3);
|
|
716
|
+
}, []), it = S((e2, t3 = e2, n3) => {
|
|
749
717
|
"multiple" !== f2 || !e2 || tt(e2) || tt(t3) || Le2((o2) => {
|
|
750
|
-
Fe2.current = false, o2 =
|
|
718
|
+
Fe2.current = false, o2 = Ce(o2);
|
|
751
719
|
const r3 = nt(e2, t3);
|
|
752
720
|
if (!r3) return o2;
|
|
753
721
|
let l3 = o2.ranges.length > 0 ? [...o2.ranges] : [nt(o2.cell, o2.cell)];
|
|
754
722
|
l3.push(r3);
|
|
755
723
|
const i2 = { ranges: l3, cell: { rowIndex: r3.rowStart, colIndex: r3.colStart, ...n3 }, rangeIndex: l3.length - 1 };
|
|
756
|
-
return
|
|
724
|
+
return P.isEqualSelectionCoords(i2, o2) ? o2 : i2;
|
|
757
725
|
});
|
|
758
726
|
}, []), ct = () => {
|
|
759
|
-
|
|
760
|
-
}, st = "touch" === i.detectIt().primaryInput, at =
|
|
727
|
+
We2(be);
|
|
728
|
+
}, st = "touch" === i.detectIt().primaryInput, at = x(null), dt = x(null), ut = x(null), ht = b(() => ({ onPointerDown: (e2) => {
|
|
761
729
|
if (!t2 || !t2.current) return false;
|
|
762
730
|
const n3 = e2.nativeEvent, o2 = t2.current.getViewFromClient(n3.clientX, n3.clientY);
|
|
763
731
|
if ("touch" === n3.pointerType || "touchstart" === n3.type) return dt.current = { topLeft: o2.getScrollTopLeft(), point: { x: n3.clientX, y: n3.clientY } }, true;
|
|
764
732
|
const r3 = o2.getCellCoordsFromClient(e2.nativeEvent.clientX, e2.nativeEvent.clientY);
|
|
765
733
|
if (!r3) return false;
|
|
766
|
-
at.current = { anchor: o2.getAnchor(), coords: r3 },
|
|
734
|
+
at.current = { anchor: o2.getAnchor(), coords: r3 }, Je.current = null;
|
|
767
735
|
const l3 = e2.nativeEvent.which === c.Right;
|
|
768
736
|
if (l3) {
|
|
769
|
-
if (-1 !==
|
|
737
|
+
if (-1 !== P.indexOfCoords(r3, $e2.ranges)) return false;
|
|
770
738
|
}
|
|
771
|
-
const i2 = e2.nativeEvent.shiftKey, s2 = e2.nativeEvent.ctrlKey || e2.nativeEvent.metaKey, a3 = s2,
|
|
739
|
+
const i2 = e2.nativeEvent.shiftKey, s2 = e2.nativeEvent.ctrlKey || e2.nativeEvent.metaKey, a3 = s2, u3 = p2, h2 = $e2.ranges.length > 0, g2 = s2 && u3;
|
|
772
740
|
if (false === U2?.(e2, r3, $e2)) return false;
|
|
773
741
|
d2?.(Be2.current, e2.nativeEvent);
|
|
774
|
-
const
|
|
775
|
-
if (i2) return rt(r3),
|
|
776
|
-
const
|
|
742
|
+
const w3 = !l3 && "single" !== f2;
|
|
743
|
+
if (i2) return rt(r3), w3;
|
|
744
|
+
const x2 = P.isEqualCells(r3, $e2.cell);
|
|
777
745
|
if (a3) {
|
|
778
|
-
if (
|
|
746
|
+
if (x2 && (!g2 || !h2)) return w3;
|
|
779
747
|
if (s2) {
|
|
780
|
-
if (-1 !==
|
|
748
|
+
if (-1 !== P.indexOfCoords(r3, $e2.ranges) && u3) {
|
|
781
749
|
Xe2.current = r3;
|
|
782
750
|
const e3 = nt(r3, r3);
|
|
783
|
-
return Ye2.current = e3, je2(e3),
|
|
751
|
+
return Ye2.current = e3, je2(e3), w3;
|
|
784
752
|
}
|
|
785
753
|
}
|
|
786
|
-
return it(r3),
|
|
754
|
+
return it(r3), w3;
|
|
787
755
|
}
|
|
788
|
-
|
|
789
|
-
}, onPointerMoveOrWait:
|
|
756
|
+
A2 && et(r3), x2 && 0 === $e2.ranges.length || lt(r3);
|
|
757
|
+
}, onPointerMoveOrWait: T.throttle((e2, n3) => {
|
|
790
758
|
if (!t2?.current) return;
|
|
791
759
|
if ("touch" === e2.pointerType || "touchmove" === e2.type) return;
|
|
792
760
|
if (!at.current) return;
|
|
793
761
|
const o2 = at.current.anchor;
|
|
794
762
|
let r3 = t2.current.getViewFromLocation(o2), l3 = r3.getCellCoordsFromClient(e2.clientX, e2.clientY);
|
|
795
|
-
if (!
|
|
763
|
+
if (!P.isEqualCells(l3, at.current?.coords) && (at.current = { anchor: o2, coords: l3 }, l3 && false !== H2?.(e2, l3, Be2.current))) {
|
|
796
764
|
if (Xe2.current) {
|
|
797
765
|
const e3 = { rowStart: Math.min(l3.rowIndex, Xe2.current.rowIndex), colStart: Math.min(l3.colIndex, Xe2.current.colIndex), rowEnd: Math.max(l3.rowIndex, Xe2.current.rowIndex), colEnd: Math.max(l3.colIndex, Xe2.current.colIndex) }, t3 = { rowIndex: e3.rowStart, colIndex: e3.colStart }, n4 = { rowIndex: e3.rowEnd, colIndex: e3.colEnd };
|
|
798
766
|
if (tt(t3) || tt(n4)) return;
|
|
799
767
|
const o3 = nt(t3, n4);
|
|
800
768
|
Ye2.current = o3, je2(o3);
|
|
801
769
|
} else rt(l3);
|
|
802
|
-
ut.current = n3,
|
|
770
|
+
ut.current = n3, Ie(r3, l3, t2);
|
|
803
771
|
}
|
|
804
772
|
}, 60), onPointerUp: (e2) => {
|
|
805
773
|
if (at.current = null, "touch" === e2.pointerType || "touchend" === e2.type) {
|
|
@@ -813,307 +781,307 @@ const Ce = -10, Ie = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
813
781
|
return dt.current = null, void (at.current = null);
|
|
814
782
|
}
|
|
815
783
|
try {
|
|
816
|
-
|
|
784
|
+
u2?.(Be2.current, e2);
|
|
817
785
|
} catch (e3) {
|
|
818
786
|
console.warn(e3);
|
|
819
787
|
}
|
|
820
788
|
if (!Xe2.current) return;
|
|
821
789
|
const n3 = Ye2.current;
|
|
822
790
|
Xe2.current = null, Ye2.current = null, je2(null), Le2((e3) => {
|
|
823
|
-
if (Fe2.current = false, 0 === (e3 =
|
|
791
|
+
if (Fe2.current = false, 0 === (e3 = Ce(e3)).ranges.length) return e3;
|
|
824
792
|
let t3 = [], o2 = -1, r3 = e3.cell;
|
|
825
793
|
for (let l4 = 0; l4 < e3.ranges.length; l4++) {
|
|
826
794
|
const i2 = e3.ranges[l4];
|
|
827
|
-
if (
|
|
828
|
-
const r4 =
|
|
795
|
+
if (P.isRangesIntersect(i2, n3)) {
|
|
796
|
+
const r4 = T.subtractRect({ top: i2.rowStart, left: i2.colStart, bottom: i2.rowEnd + 1, right: i2.colEnd + 1 }, { top: n3.rowStart, left: n3.colStart, bottom: n3.rowEnd + 1, right: n3.colEnd + 1 });
|
|
829
797
|
for (let n4 = 0; n4 < r4.length; n4++) {
|
|
830
798
|
const l5 = { rowStart: r4[n4].top, colStart: r4[n4].left, rowEnd: r4[n4].bottom - 1, colEnd: r4[n4].right - 1 };
|
|
831
|
-
t3.push(l5),
|
|
799
|
+
t3.push(l5), P.isCellWithinRange(e3.cell, l5) && (o2 = t3.length - 1);
|
|
832
800
|
}
|
|
833
801
|
} else t3.push(i2);
|
|
834
|
-
t3.length > 0 && -1 === o2 &&
|
|
802
|
+
t3.length > 0 && -1 === o2 && P.isCellWithinRange(e3.cell, i2) && (o2 = t3.length - 1, r3 = { rowIndex: t3[t3.length - 1].rowStart, colIndex: t3[t3.length - 1].colStart });
|
|
835
803
|
}
|
|
836
804
|
const l3 = { cell: r3, rangeIndex: o2, ranges: t3 };
|
|
837
|
-
return
|
|
805
|
+
return P.isEqualSelectionCoords(l3, e3) ? e3 : l3;
|
|
838
806
|
});
|
|
839
|
-
}, processTouch: true, consumeTouch: false }), [$e2, f2,
|
|
807
|
+
}, processTouch: true, consumeTouch: false }), [$e2, f2, p2, A2, w2]), gt = o(s(ht), []), ft = b(() => ({ onSelectionPointerDown: (e2, n3, o2, r3, l3 = $e2.cell, i2 = A2, s2 = e2.nativeEvent.shiftKey, a3 = false) => {
|
|
840
808
|
if (!t2 || !t2.current) return false;
|
|
841
809
|
e2.stopPropagation(), e2.preventDefault(), e2.nativeEvent.stopImmediatePropagation();
|
|
842
|
-
const
|
|
810
|
+
const u3 = o2 ?? t2.current.getViewFromClient(e2.nativeEvent.clientX, e2.nativeEvent.clientY), h2 = r3 ?? u3.getCellCoordsFromClient(e2.nativeEvent.clientX, e2.nativeEvent.clientY);
|
|
843
811
|
if (!h2) return false;
|
|
844
|
-
at.current = { anchor:
|
|
845
|
-
const
|
|
846
|
-
if (
|
|
847
|
-
if (-1 !==
|
|
812
|
+
at.current = { anchor: u3.getAnchor(), coords: h2 }, Je.current = null;
|
|
813
|
+
const g2 = e2.nativeEvent.which === c.Right;
|
|
814
|
+
if (g2) {
|
|
815
|
+
if (-1 !== P.indexOfCoords(h2, $e2.ranges)) return false;
|
|
848
816
|
}
|
|
849
|
-
const
|
|
817
|
+
const w3 = e2.nativeEvent.ctrlKey || e2.nativeEvent.metaKey, x2 = w3, m2 = p2, v2 = $e2.ranges.length > 0, S2 = w3 && m2;
|
|
850
818
|
if (false === U2?.(e2, h2, $e2)) return false;
|
|
851
819
|
d2?.(Be2.current, e2.nativeEvent);
|
|
852
|
-
const
|
|
853
|
-
if (s2) return rt(h2, l3, a3),
|
|
854
|
-
const
|
|
855
|
-
if (
|
|
856
|
-
if (
|
|
857
|
-
if (
|
|
858
|
-
if (-1 !==
|
|
820
|
+
const y2 = !g2 && "single" !== f2;
|
|
821
|
+
if (s2) return rt(h2, l3, a3), y2;
|
|
822
|
+
const b2 = P.isEqualCells(h2, l3);
|
|
823
|
+
if (x2) {
|
|
824
|
+
if (b2 && (!S2 || !v2)) return y2;
|
|
825
|
+
if (S2) {
|
|
826
|
+
if (-1 !== P.indexOfCoords(h2, $e2.ranges) && m2) {
|
|
859
827
|
Xe2.current = h2;
|
|
860
828
|
const e3 = nt(h2, h2);
|
|
861
|
-
return Ye2.current = e3, je2(e3),
|
|
829
|
+
return Ye2.current = e3, je2(e3), y2;
|
|
862
830
|
}
|
|
863
831
|
}
|
|
864
|
-
return it(h2),
|
|
832
|
+
return it(h2), y2;
|
|
865
833
|
}
|
|
866
|
-
i2 && et(h2),
|
|
834
|
+
i2 && et(h2), b2 && 0 === $e2.ranges.length || lt(h2);
|
|
867
835
|
}, onSelectionPointerMoveOrWait: (e2, n3, o2, r3, l3, i2 = $e2.cell, c2 = true, s2 = false) => {
|
|
868
836
|
if (!t2?.current) return;
|
|
869
837
|
if (e2.stopPropagation(), e2.preventDefault(), e2.stopImmediatePropagation(), !at.current) return;
|
|
870
838
|
const a3 = at.current.anchor;
|
|
871
|
-
let d3 = r3 ?? t2.current.getViewFromLocation(a3),
|
|
872
|
-
if (!
|
|
839
|
+
let d3 = r3 ?? t2.current.getViewFromLocation(a3), u3 = l3 ?? d3.getCellCoordsFromClient(e2.clientX, e2.clientY);
|
|
840
|
+
if (!P.isEqualCells(u3, at.current?.coords) && (at.current = { anchor: a3, coords: u3 }, u3 && false !== H2?.(e2, u3, Be2.current))) {
|
|
873
841
|
if (Xe2.current) {
|
|
874
|
-
const e3 = { rowStart: Math.min(
|
|
842
|
+
const e3 = { rowStart: Math.min(u3.rowIndex, Xe2.current.rowIndex), colStart: Math.min(u3.colIndex, Xe2.current.colIndex), rowEnd: Math.max(u3.rowIndex, Xe2.current.rowIndex), colEnd: Math.max(u3.colIndex, Xe2.current.colIndex) }, t3 = { rowIndex: e3.rowStart, colIndex: e3.colStart }, n4 = { rowIndex: e3.rowEnd, colIndex: e3.colEnd };
|
|
875
843
|
if (tt(t3) || tt(n4)) return;
|
|
876
844
|
const o3 = nt(t3, n4);
|
|
877
845
|
Ye2.current = o3, je2(o3);
|
|
878
|
-
} else rt(
|
|
879
|
-
c2 &&
|
|
846
|
+
} else rt(u3, i2, s2);
|
|
847
|
+
c2 && Ie(d3, u3, t2);
|
|
880
848
|
}
|
|
881
849
|
}, onPointerUp: (e2) => {
|
|
882
850
|
at.current = null, e2.stopPropagation(), e2.preventDefault(), e2.stopImmediatePropagation();
|
|
883
851
|
try {
|
|
884
|
-
|
|
852
|
+
u2?.(Be2.current, e2);
|
|
885
853
|
} catch (e3) {
|
|
886
854
|
console.warn(e3);
|
|
887
855
|
}
|
|
888
856
|
if (!Xe2.current) return;
|
|
889
857
|
const t3 = Ye2.current;
|
|
890
858
|
Xe2.current = null, Ye2.current = null, je2(null), Le2((e3) => {
|
|
891
|
-
if (Fe2.current = false, 0 === (e3 =
|
|
859
|
+
if (Fe2.current = false, 0 === (e3 = Ce(e3)).ranges.length) return e3;
|
|
892
860
|
let n3 = [], o2 = -1, r3 = e3.cell;
|
|
893
861
|
for (let l4 = 0; l4 < e3.ranges.length; l4++) {
|
|
894
862
|
const i2 = e3.ranges[l4];
|
|
895
|
-
if (
|
|
896
|
-
const r4 =
|
|
863
|
+
if (P.isRangesIntersect(i2, t3)) {
|
|
864
|
+
const r4 = T.subtractRect({ top: i2.rowStart, left: i2.colStart, bottom: i2.rowEnd + 1, right: i2.colEnd + 1 }, { top: t3.rowStart, left: t3.colStart, bottom: t3.rowEnd + 1, right: t3.colEnd + 1 });
|
|
897
865
|
for (let t4 = 0; t4 < r4.length; t4++) {
|
|
898
866
|
const l5 = { rowStart: r4[t4].top, colStart: r4[t4].left, rowEnd: r4[t4].bottom - 1, colEnd: r4[t4].right - 1 };
|
|
899
|
-
n3.push(l5),
|
|
867
|
+
n3.push(l5), P.isCellWithinRange(e3.cell, l5) && (o2 = n3.length - 1);
|
|
900
868
|
}
|
|
901
869
|
} else n3.push(i2);
|
|
902
|
-
n3.length > 0 && -1 === o2 &&
|
|
870
|
+
n3.length > 0 && -1 === o2 && P.isCellWithinRange(e3.cell, i2) && (o2 = n3.length - 1, r3 = { rowIndex: n3[n3.length - 1].rowStart, colIndex: n3[n3.length - 1].colStart });
|
|
903
871
|
}
|
|
904
872
|
const l3 = { cell: r3, rangeIndex: o2, ranges: n3 };
|
|
905
|
-
return
|
|
873
|
+
return P.isEqualSelectionCoords(l3, e3) ? e3 : l3;
|
|
906
874
|
});
|
|
907
|
-
} }), [$e2, f2,
|
|
875
|
+
} }), [$e2, f2, p2, A2, w2]), wt = o((e2, n3 = false, o2 = false, l3 = 0) => {
|
|
908
876
|
if (!t2.current || !$e2.cell) return;
|
|
909
877
|
let i2 = $e2.cell, c2 = $e2.cell;
|
|
910
878
|
if (n3 && $e2.ranges.length > 0) {
|
|
911
879
|
const t3 = $e2.ranges[$e2.rangeIndex], n4 = $e2.cell;
|
|
912
880
|
switch (e2) {
|
|
913
|
-
case
|
|
881
|
+
case O.Up:
|
|
914
882
|
c2 = { rowIndex: n4.rowIndex === t3.rowStart ? t3.rowEnd : t3.rowStart, colIndex: t3.colEnd }, i2 = { rowIndex: n4.rowIndex === t3.rowStart ? t3.rowStart : t3.rowEnd, colIndex: t3.colStart };
|
|
915
883
|
break;
|
|
916
|
-
case
|
|
884
|
+
case O.Down:
|
|
917
885
|
c2 = { rowIndex: n4.rowIndex === t3.rowEnd ? t3.rowStart : t3.rowEnd, colIndex: t3.colEnd }, i2 = { rowIndex: n4.rowIndex === t3.rowEnd ? t3.rowEnd : t3.rowStart, colIndex: t3.colStart };
|
|
918
886
|
break;
|
|
919
|
-
case
|
|
887
|
+
case O.Left:
|
|
920
888
|
c2 = { rowIndex: t3.rowEnd, colIndex: n4.colIndex === t3.colStart ? t3.colEnd : t3.colStart }, i2 = { rowIndex: t3.rowStart, colIndex: n4.colIndex === t3.colStart ? t3.colStart : t3.colEnd };
|
|
921
889
|
break;
|
|
922
|
-
case
|
|
890
|
+
case O.Right:
|
|
923
891
|
c2 = { rowIndex: t3.rowEnd, colIndex: n4.colIndex === t3.colEnd ? t3.colStart : t3.colEnd }, i2 = { rowIndex: t3.rowStart, colIndex: n4.colIndex === t3.colEnd ? t3.colEnd : t3.colStart };
|
|
924
892
|
}
|
|
925
893
|
}
|
|
926
|
-
const s2 =
|
|
894
|
+
const s2 = J2(c2);
|
|
927
895
|
let { rowStart: a3, colStart: d3 } = s2;
|
|
928
|
-
const
|
|
929
|
-
if (
|
|
930
|
-
case
|
|
931
|
-
case
|
|
932
|
-
|
|
896
|
+
const u3 = he2();
|
|
897
|
+
if (Je.current) switch (e2) {
|
|
898
|
+
case O.Up:
|
|
899
|
+
case O.Down:
|
|
900
|
+
Je.current.colIndex >= s2.colStart && Je.current.colIndex <= s2.colEnd && (d3 = Je.current.colIndex);
|
|
933
901
|
break;
|
|
934
|
-
case
|
|
935
|
-
case
|
|
936
|
-
|
|
902
|
+
case O.Left:
|
|
903
|
+
case O.Right:
|
|
904
|
+
Je.current.rowIndex >= s2.rowStart && Je.current.rowIndex <= s2.rowEnd && (a3 = Je.current.rowIndex);
|
|
937
905
|
}
|
|
938
906
|
if (!l3) {
|
|
939
907
|
switch (e2) {
|
|
940
|
-
case
|
|
941
|
-
a3 =
|
|
908
|
+
case O.Up:
|
|
909
|
+
a3 = _(Te2, Math.max(s2.rowStart - 1, u3.top), e2);
|
|
942
910
|
break;
|
|
943
|
-
case
|
|
944
|
-
a3 =
|
|
911
|
+
case O.Down:
|
|
912
|
+
a3 = _(Te2, Math.min(s2.rowEnd + 1, u3.bottom), e2);
|
|
945
913
|
break;
|
|
946
|
-
case
|
|
947
|
-
d3 =
|
|
914
|
+
case O.Left:
|
|
915
|
+
d3 = _(Oe2, Math.max(s2.colStart - 1, u3.left), e2);
|
|
948
916
|
break;
|
|
949
|
-
case
|
|
950
|
-
d3 =
|
|
917
|
+
case O.Right:
|
|
918
|
+
d3 = _(Oe2, Math.min(s2.colEnd + 1, u3.right), e2);
|
|
951
919
|
}
|
|
952
920
|
if (o2) switch (e2) {
|
|
953
|
-
case
|
|
954
|
-
a3 = F2({ ...c2, colIndex: $e2.cell.colIndex },
|
|
921
|
+
case O.Up:
|
|
922
|
+
a3 = F2({ ...c2, colIndex: $e2.cell.colIndex }, Me2, Te2, e2, false, Math.max(u3.top, Te2(u3.top, false)));
|
|
955
923
|
break;
|
|
956
|
-
case
|
|
957
|
-
a3 = F2({ ...c2, colIndex: $e2.cell.colIndex },
|
|
924
|
+
case O.Down:
|
|
925
|
+
a3 = F2({ ...c2, colIndex: $e2.cell.colIndex }, Me2, Te2, e2, false, Math.min(u3.bottom, u3.bottom - Te2(u3.bottom, true)));
|
|
958
926
|
break;
|
|
959
|
-
case
|
|
960
|
-
d3 = F2({ ...c2, rowIndex: $e2.cell.rowIndex },
|
|
927
|
+
case O.Left:
|
|
928
|
+
d3 = F2({ ...c2, rowIndex: $e2.cell.rowIndex }, Me2, Oe2, e2, false, Math.max(u3.left, Oe2(u3.left, false)));
|
|
961
929
|
break;
|
|
962
|
-
case
|
|
963
|
-
d3 = F2({ ...c2, rowIndex: $e2.cell.rowIndex },
|
|
930
|
+
case O.Right:
|
|
931
|
+
d3 = F2({ ...c2, rowIndex: $e2.cell.rowIndex }, Me2, Oe2, e2, false, Math.min(u3.right, u3.right - Oe2(u3.right, true)));
|
|
964
932
|
}
|
|
965
933
|
}
|
|
966
934
|
let h2 = null;
|
|
967
935
|
if (l3) {
|
|
968
936
|
let n4 = 0;
|
|
969
937
|
switch (e2) {
|
|
970
|
-
case
|
|
971
|
-
n4 = r2.getRowOffset(a3 + 1), a3 = Math.max(
|
|
938
|
+
case O.Up:
|
|
939
|
+
n4 = r2.getRowOffset(a3 + 1), a3 = Math.max(u3.top, r2.getRowIndex(n4 - l3)), h2 = { top: r2.getRowOffset(a3 + 1) - (n4 - t2.current.getScrollPosition().top) };
|
|
972
940
|
break;
|
|
973
|
-
case
|
|
974
|
-
n4 = r2.getRowOffset(a3), a3 = Math.min(
|
|
941
|
+
case O.Down:
|
|
942
|
+
n4 = r2.getRowOffset(a3), a3 = Math.min(u3.bottom, r2.getRowIndex(n4 + l3)), h2 = { top: r2.getRowOffset(a3) - (n4 - t2.current.getScrollPosition().top) };
|
|
975
943
|
break;
|
|
976
|
-
case
|
|
977
|
-
n4 = r2.getColOffset(d3 + 1), d3 = Math.max(
|
|
944
|
+
case O.Left:
|
|
945
|
+
n4 = r2.getColOffset(d3 + 1), d3 = Math.max(u3.left, r2.getColIndex(n4 - l3)), h2 = { left: r2.getColOffset(d3 + 1) - (n4 - t2.current.getScrollPosition().left) };
|
|
978
946
|
break;
|
|
979
|
-
case
|
|
980
|
-
n4 = r2.getColOffset(d3), d3 = Math.min(
|
|
947
|
+
case O.Right:
|
|
948
|
+
n4 = r2.getColOffset(d3), d3 = Math.min(u3.right, r2.getColIndex(n4 + l3)), h2 = { left: r2.getColOffset(d3) - (n4 - t2.current.getScrollPosition().left) };
|
|
981
949
|
}
|
|
982
950
|
}
|
|
983
|
-
const
|
|
984
|
-
n3 || (
|
|
985
|
-
const
|
|
986
|
-
if (n3 && !
|
|
951
|
+
const g2 = { rowIndex: a3, colIndex: d3 }, f3 = J2(g2), w3 = { rowIndex: f3.rowStart, colIndex: f3.colStart };
|
|
952
|
+
n3 || (Je.current = g2);
|
|
953
|
+
const x2 = P.isEqualCells(_e.current, w3) && P.isEqualCells(_e.current, i2);
|
|
954
|
+
if (n3 && !x2 ? rt(w3, i2) : lt(w3), h2) t2.current.scrollTo(h2);
|
|
987
955
|
else {
|
|
988
|
-
if (n3 &&
|
|
956
|
+
if (n3 && _e.current) {
|
|
989
957
|
const t3 = he2();
|
|
990
|
-
if (e2 ===
|
|
958
|
+
if (e2 === O.Right && _e.current.colIndex === t3.left || e2 === O.Left && _e.current.colIndex === t3.right || e2 === O.Up && _e.current.rowIndex === t3.bottom || e2 === O.Down && _e.current.rowIndex === t3.top) return;
|
|
991
959
|
}
|
|
992
|
-
e2 ===
|
|
960
|
+
e2 === O.Left || e2 === O.Right ? et({ colIndex: g2.colIndex }) : e2 !== O.Up && e2 !== O.Down || et({ rowIndex: g2.rowIndex });
|
|
993
961
|
}
|
|
994
|
-
}, [$e2,
|
|
962
|
+
}, [$e2, J2]), xt = o((e2) => {
|
|
995
963
|
if (!t2.current) return;
|
|
996
964
|
if (0 === $e2.ranges.length) return void wt(e2);
|
|
997
|
-
const n3 =
|
|
998
|
-
if (
|
|
999
|
-
const o2 =
|
|
965
|
+
const n3 = J2($e2.cell);
|
|
966
|
+
if (P.isEqualRangesArrays([n3], $e2.ranges)) return void wt(e2);
|
|
967
|
+
const o2 = le($e2, e2, J2, Te2, Oe2);
|
|
1000
968
|
Le2((e3) => {
|
|
1001
|
-
Fe2.current = false, e3 =
|
|
969
|
+
Fe2.current = false, e3 = Ce(e3);
|
|
1002
970
|
const t3 = { ...e3, cell: o2.cell, rangeIndex: o2.rangeIndex };
|
|
1003
|
-
return
|
|
971
|
+
return P.isEqualSelectionCoords(t3, e3) ? e3 : t3;
|
|
1004
972
|
}), o2.cell && et(o2.cell);
|
|
1005
|
-
}, [$e2,
|
|
973
|
+
}, [$e2, J2]), pt = S(() => {
|
|
1006
974
|
const e2 = he2();
|
|
1007
975
|
rt({ rowIndex: e2.top }, { rowIndex: e2.bottom });
|
|
1008
|
-
}, []), mt =
|
|
976
|
+
}, []), mt = S(() => {
|
|
1009
977
|
const e2 = he2();
|
|
1010
978
|
rt({ colIndex: e2.left }, { colIndex: e2.right });
|
|
1011
979
|
}, []), vt = o(() => {
|
|
1012
980
|
$e2.cell && t2?.current && et($e2.cell);
|
|
1013
|
-
}, [$e2.cell]), St =
|
|
981
|
+
}, [$e2.cell]), St = S((e2 = false) => {
|
|
1014
982
|
const t3 = { rowIndex: he2().top };
|
|
1015
983
|
e2 ? rt(t3) : lt(t3), et(t3);
|
|
1016
|
-
}, []), yt =
|
|
984
|
+
}, []), yt = S((e2 = false) => {
|
|
1017
985
|
const t3 = { rowIndex: he2().bottom };
|
|
1018
986
|
e2 ? rt(t3) : lt(t3), et(t3);
|
|
1019
|
-
}, []), bt =
|
|
987
|
+
}, []), bt = S((e2 = false) => {
|
|
1020
988
|
const t3 = { colIndex: he2().left };
|
|
1021
989
|
e2 ? rt(t3) : lt(t3), et(t3);
|
|
1022
|
-
}, []), Ct =
|
|
990
|
+
}, []), Ct = S((e2 = false) => {
|
|
1023
991
|
const t3 = he2(), n3 = { rowIndex: t3.top, colIndex: t3.left };
|
|
1024
992
|
e2 ? rt(n3) : lt(n3), et(n3);
|
|
1025
|
-
}, []), It =
|
|
1026
|
-
const t3 = he2(), n3 = { colIndex:
|
|
993
|
+
}, []), It = S((e2 = false) => {
|
|
994
|
+
const t3 = he2(), n3 = { colIndex: W2?.()?.colEnd ?? t3.right };
|
|
1027
995
|
e2 ? rt(n3) : lt(n3), et(n3);
|
|
1028
|
-
}, [
|
|
1029
|
-
const t3 = he2(), n3 = { rowIndex:
|
|
996
|
+
}, [W2]), Et = S((e2 = false) => {
|
|
997
|
+
const t3 = he2(), n3 = { rowIndex: W2?.()?.rowEnd ?? t3.bottom, colIndex: W2?.()?.colEnd ?? t3.right };
|
|
1030
998
|
e2 ? rt(n3) : lt(n3), et(n3);
|
|
1031
|
-
}, [
|
|
999
|
+
}, [W2]), Rt = o((e2) => {
|
|
1032
1000
|
if (!t2.current) return;
|
|
1033
1001
|
if ($e2.ranges.length <= 1) return;
|
|
1034
|
-
const n3 = e2 ===
|
|
1002
|
+
const n3 = e2 === O.Left || e2 === O.Up;
|
|
1035
1003
|
let o2 = $e2.rangeIndex + (n3 ? -1 : 1);
|
|
1036
1004
|
o2 < 0 ? o2 = $e2.ranges.length - 1 : o2 > $e2.ranges.length - 1 && (o2 = 0);
|
|
1037
|
-
const r3 = $e2.ranges[o2], l3 =
|
|
1005
|
+
const r3 = $e2.ranges[o2], l3 = le({ cell: { rowIndex: r3.rowEnd, colIndex: r3.colEnd }, rangeIndex: 0, ranges: [r3] }, O.Right, J2, Te2, Oe2);
|
|
1038
1006
|
Le2((e3) => {
|
|
1039
|
-
Fe2.current = false, e3 =
|
|
1007
|
+
Fe2.current = false, e3 = Ce(e3);
|
|
1040
1008
|
const t3 = { ...e3, cell: l3.cell, rangeIndex: o2 };
|
|
1041
|
-
return
|
|
1009
|
+
return P.isEqualSelectionCoords(t3, e3) ? e3 : t3;
|
|
1042
1010
|
}), l3.cell && et(l3.cell);
|
|
1043
|
-
}, [$e2,
|
|
1044
|
-
const e2 =
|
|
1011
|
+
}, [$e2, J2]), Mt = o(() => {
|
|
1012
|
+
const e2 = re($e2);
|
|
1045
1013
|
Le2((t3) => {
|
|
1046
|
-
Fe2.current = false, t3 =
|
|
1014
|
+
Fe2.current = false, t3 = Ce(t3);
|
|
1047
1015
|
const n3 = { ...t3, visibleSelection: e2 };
|
|
1048
|
-
return
|
|
1016
|
+
return P.isEqualSelectionCoords(n3, t3) ? t3 : n3;
|
|
1049
1017
|
}), e2.cell && et(e2.cell);
|
|
1050
|
-
}, [$e2,
|
|
1018
|
+
}, [$e2, J2]), kt = o(() => {
|
|
1051
1019
|
if (!t2.current) return;
|
|
1052
1020
|
if (0 === $e2.ranges.length) return;
|
|
1053
|
-
const e2 = $e2.cell, n3 = $e2.ranges[$e2.rangeIndex], o2 =
|
|
1021
|
+
const e2 = $e2.cell, n3 = $e2.ranges[$e2.rangeIndex], o2 = re({ cell: e2, rangeIndex: 0, ranges: [n3] }), r3 = o2.ranges[o2.rangeIndex];
|
|
1054
1022
|
let l3;
|
|
1055
1023
|
l3 = r3.rowStart === e2.rowIndex && r3.colStart === e2.colIndex ? { rowIndex: r3.rowStart, colIndex: r3.colEnd } : r3.rowStart === e2.rowIndex && r3.colEnd === e2.colIndex ? { rowIndex: r3.rowEnd, colIndex: r3.colStart } : r3.rowEnd === e2.rowIndex && r3.colStart === e2.colIndex ? { rowIndex: r3.rowEnd, colIndex: r3.colEnd } : { rowIndex: r3.rowStart, colIndex: r3.colStart }, Le2((e3) => {
|
|
1056
|
-
e3 =
|
|
1024
|
+
e3 = Ce(e3);
|
|
1057
1025
|
const t3 = { ...e3, cell: l3 };
|
|
1058
|
-
return
|
|
1026
|
+
return P.isEqualSelectionCoords(t3, e3) ? e3 : t3;
|
|
1059
1027
|
}), l3 && et(l3);
|
|
1060
|
-
}, [$e2,
|
|
1061
|
-
wt(
|
|
1062
|
-
}, []), Tt =
|
|
1063
|
-
wt(
|
|
1064
|
-
}, []), Dt =
|
|
1065
|
-
wt(
|
|
1066
|
-
}, []), Ot =
|
|
1067
|
-
wt(
|
|
1068
|
-
}, []), zt =
|
|
1069
|
-
xt(
|
|
1070
|
-
}, []), Lt =
|
|
1071
|
-
xt(
|
|
1072
|
-
}, []), $t =
|
|
1073
|
-
xt(
|
|
1074
|
-
}, []), Bt =
|
|
1075
|
-
xt(
|
|
1076
|
-
}, []), Ft =
|
|
1077
|
-
Rt(
|
|
1078
|
-
}, []),
|
|
1079
|
-
Rt(
|
|
1080
|
-
}, []),
|
|
1028
|
+
}, [$e2, J2]), Pt = S((e2 = false) => {
|
|
1029
|
+
wt(O.Down, e2, false, t2.current.getDimensions().containerHeight);
|
|
1030
|
+
}, []), Tt = S((e2 = false) => {
|
|
1031
|
+
wt(O.Up, e2, false, t2.current.getDimensions().containerHeight);
|
|
1032
|
+
}, []), Dt = S((e2 = false) => {
|
|
1033
|
+
wt(O.Right, e2, false, t2.current.getDimensions().containerWidth);
|
|
1034
|
+
}, []), Ot = S((e2 = false) => {
|
|
1035
|
+
wt(O.Left, e2, false, t2.current.getDimensions().containerWidth);
|
|
1036
|
+
}, []), zt = S(() => {
|
|
1037
|
+
xt(O.Left);
|
|
1038
|
+
}, []), Lt = S(() => {
|
|
1039
|
+
xt(O.Right);
|
|
1040
|
+
}, []), $t = S(() => {
|
|
1041
|
+
xt(O.Up);
|
|
1042
|
+
}, []), Bt = S(() => {
|
|
1043
|
+
xt(O.Down);
|
|
1044
|
+
}, []), Ft = S(() => {
|
|
1045
|
+
Rt(O.Left);
|
|
1046
|
+
}, []), Wt = S(() => {
|
|
1047
|
+
Rt(O.Right);
|
|
1048
|
+
}, []), At = S(() => {
|
|
1081
1049
|
kt();
|
|
1082
|
-
}, []), Vt =
|
|
1083
|
-
wt(
|
|
1084
|
-
}, []), Ut =
|
|
1085
|
-
wt(
|
|
1086
|
-
}, []), Ht =
|
|
1087
|
-
wt(
|
|
1088
|
-
}, []), Kt =
|
|
1089
|
-
wt(
|
|
1090
|
-
}, []), Nt =
|
|
1091
|
-
wt(
|
|
1092
|
-
}, []), qt =
|
|
1093
|
-
wt(
|
|
1094
|
-
}, []), jt =
|
|
1095
|
-
wt(
|
|
1096
|
-
}, []), Xt =
|
|
1097
|
-
wt(
|
|
1098
|
-
}, []), Yt =
|
|
1099
|
-
wt(
|
|
1100
|
-
}, []), Gt =
|
|
1101
|
-
wt(
|
|
1102
|
-
}, []), Zt =
|
|
1103
|
-
wt(
|
|
1104
|
-
}, []), _t =
|
|
1105
|
-
wt(
|
|
1106
|
-
}, []), Jt =
|
|
1107
|
-
wt(
|
|
1108
|
-
}, []), Qt =
|
|
1109
|
-
wt(
|
|
1110
|
-
}, []), en =
|
|
1111
|
-
wt(
|
|
1112
|
-
}, []), tn =
|
|
1113
|
-
wt(
|
|
1114
|
-
}, []), nn =
|
|
1115
|
-
|
|
1116
|
-
}, []), on =
|
|
1050
|
+
}, []), Vt = S(() => {
|
|
1051
|
+
wt(O.Left, false, false);
|
|
1052
|
+
}, []), Ut = S(() => {
|
|
1053
|
+
wt(O.Left, true, false);
|
|
1054
|
+
}, []), Ht = S(() => {
|
|
1055
|
+
wt(O.Left, false, true);
|
|
1056
|
+
}, []), Kt = S(() => {
|
|
1057
|
+
wt(O.Left, true, true);
|
|
1058
|
+
}, []), Nt = S(() => {
|
|
1059
|
+
wt(O.Right, false, false);
|
|
1060
|
+
}, []), qt = S(() => {
|
|
1061
|
+
wt(O.Right, true, false);
|
|
1062
|
+
}, []), jt = S(() => {
|
|
1063
|
+
wt(O.Right, false, true);
|
|
1064
|
+
}, []), Xt = S(() => {
|
|
1065
|
+
wt(O.Right, true, true);
|
|
1066
|
+
}, []), Yt = S(() => {
|
|
1067
|
+
wt(O.Up, false, false);
|
|
1068
|
+
}, []), Gt = S(() => {
|
|
1069
|
+
wt(O.Up, true, false);
|
|
1070
|
+
}, []), Zt = S(() => {
|
|
1071
|
+
wt(O.Up, false, true);
|
|
1072
|
+
}, []), _t = S(() => {
|
|
1073
|
+
wt(O.Up, true, true);
|
|
1074
|
+
}, []), Jt = S(() => {
|
|
1075
|
+
wt(O.Down, false, false);
|
|
1076
|
+
}, []), Qt = S(() => {
|
|
1077
|
+
wt(O.Down, true, false);
|
|
1078
|
+
}, []), en = S(() => {
|
|
1079
|
+
wt(O.Down, false, true);
|
|
1080
|
+
}, []), tn = S(() => {
|
|
1081
|
+
wt(O.Down, true, true);
|
|
1082
|
+
}, []), nn = S(() => {
|
|
1083
|
+
We2((e2) => e2.slice(0, -1));
|
|
1084
|
+
}, []), on = b(() => {
|
|
1117
1085
|
const e2 = he2();
|
|
1118
1086
|
return ((e3, t3, n3, o2, r3) => {
|
|
1119
1087
|
const l3 = e3.length;
|
|
@@ -1123,8 +1091,8 @@ const Ce = -10, Ie = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
1123
1091
|
}
|
|
1124
1092
|
return false;
|
|
1125
1093
|
})($e2.ranges, e2.top, e2.left, e2.bottom, e2.right);
|
|
1126
|
-
}, [V2, $e2.ranges]), rn =
|
|
1127
|
-
|
|
1094
|
+
}, [V2, $e2.ranges]), rn = S((e2, n3 = true) => {
|
|
1095
|
+
_e.current = e2, Ae2(e2), n3 && e2 && t2?.current && et(e2);
|
|
1128
1096
|
}, []), ln = o((e2 = true) => {
|
|
1129
1097
|
const t3 = Ne2.current;
|
|
1130
1098
|
if (!Be2.current?.cell) return;
|
|
@@ -1132,23 +1100,23 @@ const Ce = -10, Ie = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
1132
1100
|
if (!o2 || !t3) return;
|
|
1133
1101
|
if (!t3) return;
|
|
1134
1102
|
let r3 = null;
|
|
1135
|
-
if (r3 = n3.length > 0 ? n3[n3.length - 1] :
|
|
1136
|
-
const n4 =
|
|
1137
|
-
let o3 = e2 ? ge2 :
|
|
1103
|
+
if (r3 = n3.length > 0 ? n3[n3.length - 1] : J2(o2), r3.colEnd >= r3.colStart && r3.rowEnd >= r3.rowStart) {
|
|
1104
|
+
const n4 = ie(r3, t3);
|
|
1105
|
+
let o3 = e2 ? ge2 : we2;
|
|
1138
1106
|
try {
|
|
1139
1107
|
o3?.(r3, t3, n4.direction);
|
|
1140
1108
|
} catch (e3) {
|
|
1141
1109
|
console.warn(e3);
|
|
1142
1110
|
} finally {
|
|
1143
|
-
e2 &&
|
|
1111
|
+
e2 && Re2?.();
|
|
1144
1112
|
}
|
|
1145
1113
|
}
|
|
1146
|
-
}, [
|
|
1114
|
+
}, [J2]), cn = x(null), sn = b(() => ({ onPointerDown: (e2, n3) => {
|
|
1147
1115
|
if (ut.current = n3, !t2 || !t2.current) return false;
|
|
1148
1116
|
const o2 = t2.current.getViewFromClient(e2.nativeEvent.clientX, e2.nativeEvent.clientY), r3 = o2?.getCellCoordsFromClient(e2.nativeEvent.clientX, e2.nativeEvent.clientY);
|
|
1149
1117
|
r3 && (e2.stopPropagation(), Ue2("crosshair"), cn.current = { anchor: o2.getAnchor(), coords: r3 });
|
|
1150
1118
|
}, onPointerMoveOrWait: (e2, n3) => {
|
|
1151
|
-
if (
|
|
1119
|
+
if (k2 || !t2?.current || !Be2.current || !cn.current) return;
|
|
1152
1120
|
const o2 = cn.current.anchor;
|
|
1153
1121
|
let r3 = t2.current.getViewFromLocation(o2), l3 = r3.getCellCoordsFromClient(e2.clientX, e2.clientY);
|
|
1154
1122
|
if (!l3) return;
|
|
@@ -1156,54 +1124,54 @@ const Ce = -10, Ie = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
1156
1124
|
const i2 = Be2.current.ranges;
|
|
1157
1125
|
let c2 = nt(Be2.current.cell, l3);
|
|
1158
1126
|
if (!c2) return;
|
|
1159
|
-
const s2 = i2.length > 0, a3 = s2 ? i2[i2.length - 1] :
|
|
1127
|
+
const s2 = i2.length > 0, a3 = s2 ? i2[i2.length - 1] : J2(Be2.current.cell);
|
|
1160
1128
|
if (!c2) return;
|
|
1161
|
-
const d3 = c2.rowStart < a3.rowStart ?
|
|
1162
|
-
d3 ===
|
|
1163
|
-
const h2 =
|
|
1129
|
+
const d3 = c2.rowStart < a3.rowStart ? O.Up : c2.rowEnd > a3.rowEnd ? O.Down : c2.colEnd > a3.colEnd ? O.Right : O.Left, u3 = he2();
|
|
1130
|
+
d3 === O.Left && (c2 = { ...a3, colStart: Math.max(u3.left, c2.colStart) }), d3 === O.Up && (c2 = { ...a3, rowStart: Math.max(u3.top, c2.rowStart) }), d3 === O.Right && (c2 = { ...a3, colEnd: Math.min(u3.right, c2.colEnd) }), d3 === O.Down && (c2 = { ...a3, rowEnd: Math.min(u3.bottom, c2.rowEnd) });
|
|
1131
|
+
const h2 = ie(a3, c2);
|
|
1164
1132
|
if (!N2?.(a3)) {
|
|
1165
1133
|
let e3;
|
|
1166
|
-
"function" == typeof
|
|
1134
|
+
"function" == typeof Qe.current ? e3 = Qe.current(a3) : K2 && (e3 = K2), c2 = ((e4, t3, n4, o3, r4, l4) => {
|
|
1167
1135
|
const i3 = { ...t3 };
|
|
1168
1136
|
if (0 === n4.length) return i3;
|
|
1169
|
-
if (r4 ===
|
|
1137
|
+
if (r4 === O.Left) {
|
|
1170
1138
|
const t4 = e4.colEnd + 1 - e4.colStart;
|
|
1171
1139
|
i3.colStart = e4.colStart - Math.ceil(l4 / t4) * t4, i3.colStart < o3.left && (i3.colStart = i3.colStart + Math.ceil((o3.left - i3.colStart) / t4) * t4);
|
|
1172
|
-
} else if (r4 ===
|
|
1140
|
+
} else if (r4 === O.Right) {
|
|
1173
1141
|
const t4 = e4.colEnd + 1 - e4.colStart;
|
|
1174
1142
|
i3.colEnd = e4.colEnd + Math.ceil(l4 / t4) * t4, i3.colEnd > o3.right && (i3.colEnd = i3.colEnd - Math.ceil((o3.right - i3.colEnd) / t4) * t4);
|
|
1175
|
-
} else if (r4 ===
|
|
1143
|
+
} else if (r4 === O.Up) {
|
|
1176
1144
|
const t4 = e4.rowEnd + 1 - e4.rowStart;
|
|
1177
1145
|
i3.rowStart = e4.rowStart - Math.ceil(l4 / t4) * t4, i3.rowStart < o3.top && (i3.rowStart = i3.rowStart + Math.ceil((o3.top - i3.rowStart) / t4) * t4);
|
|
1178
|
-
} else if (r4 ===
|
|
1146
|
+
} else if (r4 === O.Down) {
|
|
1179
1147
|
const t4 = e4.rowEnd + 1 - e4.rowStart;
|
|
1180
1148
|
i3.rowEnd = e4.rowEnd + Math.ceil(l4 / t4) * t4, i3.rowEnd > o3.bottom && (i3.rowEnd = i3.rowEnd - Math.ceil((o3.bottom - i3.rowEnd) / t4) * t4);
|
|
1181
1149
|
}
|
|
1182
1150
|
return i3;
|
|
1183
|
-
})(a3, c2, e3,
|
|
1151
|
+
})(a3, c2, e3, u3, h2.direction, h2.amount);
|
|
1184
1152
|
}
|
|
1185
|
-
if (s2 &&
|
|
1153
|
+
if (s2 && P.isRangeWithinRange(c2, a3) && (c2 = null), !P.isEqualRanges(c2, Ne2.current)) {
|
|
1186
1154
|
if (Ke2(c2), Ne2.current = c2, !c2) {
|
|
1187
1155
|
try {
|
|
1188
|
-
|
|
1156
|
+
pe2?.();
|
|
1189
1157
|
} catch (e3) {
|
|
1190
1158
|
}
|
|
1191
|
-
return void
|
|
1159
|
+
return void Re2?.();
|
|
1192
1160
|
}
|
|
1193
1161
|
ln(false);
|
|
1194
1162
|
}
|
|
1195
|
-
ut.current = n3,
|
|
1163
|
+
ut.current = n3, Ie(r3, l3, t2);
|
|
1196
1164
|
}, onPointerUp: (e2, n3) => {
|
|
1197
1165
|
ut.current = n3, Promise.resolve(ln(true)).finally(() => {
|
|
1198
|
-
|
|
1166
|
+
Re2?.(), Ke2(null), Ne2.current = null, cn.current = null, Ue2(null), t2.current?.focus();
|
|
1199
1167
|
});
|
|
1200
|
-
} }), [
|
|
1168
|
+
} }), [J2]), an = s(sn), dn = b(() => ({ onPointerDown: an }), [an]), [un, hn] = m(null), gn = x(null), fn = b(() => ({ onPointerDown: (e2, n3) => {
|
|
1201
1169
|
if (ut.current = n3, !t2 || !t2.current) return false;
|
|
1202
1170
|
const o2 = t2.current.getViewFromClient(e2.nativeEvent.clientX, e2.nativeEvent.clientY), r3 = o2?.getCellCoordsFromClient(e2.nativeEvent.clientX, e2.nativeEvent.clientY);
|
|
1203
1171
|
if (!r3) return;
|
|
1204
1172
|
if (false === U2?.(e2, r3, $e2)) return false;
|
|
1205
1173
|
e2.stopPropagation(), Ue2("default");
|
|
1206
|
-
const l3 = o2.getRelativePointFromClient(0, 0), i2 = Be2.current?.ranges[Be2.current?.ranges.length - 1] ??
|
|
1174
|
+
const l3 = o2.getRelativePointFromClient(0, 0), i2 = Be2.current?.ranges[Be2.current?.ranges.length - 1] ?? P.cellToRange(Be2.current?.cell), c2 = o2.toClipBounds(o2.getRangeCoordsBounds(i2)), s2 = { x: 0, y: 0 };
|
|
1207
1175
|
c2.x - l3.x > e2.nativeEvent.clientX ? s2.x = e2.nativeEvent.clientX - (c2.x - l3.x) : e2.nativeEvent.clientX >= c2.x - l3.x + c2.width && (s2.x = Math.max(0, e2.nativeEvent.clientX - (c2.x - l3.x + c2.width)) + 1), c2.y - l3.y > e2.nativeEvent.clientY ? s2.y = e2.nativeEvent.clientY - (c2.y - l3.y) : e2.nativeEvent.clientY >= c2.y - l3.y + c2.height && (s2.y = Math.max(0, e2.nativeEvent.clientY - (c2.y - l3.y + c2.height)) + 1), q2?.(i2, e2.nativeEvent, n3), gn.current = { range: i2, anchor: o2.getAnchor(), cell: r3, isMoving: false, extrusion: s2 };
|
|
1208
1176
|
}, onPointerMoveOrWait: (e2, n3, o2) => {
|
|
1209
1177
|
if (Z2 || !t2?.current || !Be2.current || !gn.current) return;
|
|
@@ -1212,8 +1180,8 @@ const Ce = -10, Ie = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
1212
1180
|
const i2 = gn.current.anchor, c2 = gn.current.extrusion;
|
|
1213
1181
|
let s2 = t2.current.getViewFromLocation(i2), a3 = s2.getCellCoordsFromClient(e2.clientX - c2.x, e2.clientY - c2.y, true);
|
|
1214
1182
|
if (!a3) return;
|
|
1215
|
-
const d3 = gn.current.cell,
|
|
1216
|
-
|
|
1183
|
+
const d3 = gn.current.cell, u3 = gn.current.range, h2 = he2(), g2 = u3.colEnd - u3.colStart + 1, f3 = Math.min(Math.max(0, d3.colIndex - u3.colStart), g2 - 1), w3 = Math.min(h2.right - g2 + 1, Math.max(h2.left, a3.colIndex - f3)), x2 = u3.rowEnd - u3.rowStart + 1, p3 = Math.min(Math.max(0, d3.rowIndex - u3.rowStart), x2 - 1), m2 = Math.min(h2.bottom - x2 + 1, Math.max(h2.top, a3.rowIndex - p3)), v2 = { colStart: w3, colEnd: w3 + g2 - 1, rowStart: m2, rowEnd: m2 + x2 - 1 };
|
|
1184
|
+
P.isEqualRanges(un, v2) && !((e3) => !e3 || !ut.current || ut.current.ctrlKey !== e3.ctrlKey || ut.current.shiftKey !== e3.shiftKey || ut.current.altKey !== e3.altKey || ut.current.metaKey !== e3.metaKey)(e2) || (hn(v2), j2?.(v2, e2, n3)), ut.current = n3, Ie(s2, a3, t2);
|
|
1217
1185
|
}, onPointerUp: (e2, n3) => {
|
|
1218
1186
|
ut.current = n3;
|
|
1219
1187
|
const o2 = () => {
|
|
@@ -1224,152 +1192,152 @@ const Ce = -10, Ie = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
1224
1192
|
X2?.(r3, e2, n3), Promise.resolve(r3 && l3 && Y2?.(r3, l3, e2, n3)).finally(() => {
|
|
1225
1193
|
o2();
|
|
1226
1194
|
});
|
|
1227
|
-
} }), [un]), wn = s(fn), xn =
|
|
1228
|
-
const e2 =
|
|
1195
|
+
} }), [un]), wn = s(fn), xn = b(() => ({ onPointerDown: wn }), [wn]), pn = x(null), mn = b(() => {
|
|
1196
|
+
const e2 = P.isEqualSelectionCoords($e2, pn.current) ? pn.current : $e2;
|
|
1229
1197
|
return pn.current = e2, e2;
|
|
1230
|
-
}, [$e2]), vn =
|
|
1198
|
+
}, [$e2]), vn = S((n3) => {
|
|
1231
1199
|
let o2 = null, r3 = "br";
|
|
1232
|
-
const l3 = [], i2 = { stroke:
|
|
1233
|
-
const r4 = n3.toClipBounds(n3.getRangeCoordsBounds(e2),
|
|
1200
|
+
const l3 = [], i2 = { stroke: D2, fill: ne2, strokeWidth: 0.5 }, c2 = (e2, t3, o3) => {
|
|
1201
|
+
const r4 = n3.toClipBounds(n3.getRangeCoordsBounds(e2), ve);
|
|
1234
1202
|
if (!r4) return;
|
|
1235
1203
|
r4.x = r4.width > 0 ? r4.x : r4.x - i2.strokeWidth / 2, r4.y = r4.height > 0 ? r4.y : r4.y - i2.strokeWidth / 2, r4.width = Math.max(r4.width, i2.strokeWidth), r4.height = Math.max(r4.height, i2.strokeWidth);
|
|
1236
1204
|
const l4 = { key: `selection-fill-${t3}`, range: e2, ...r4, ...i2 };
|
|
1237
1205
|
if (o3) {
|
|
1238
1206
|
const e3 = n3.getCellCoordsAsRangeCoords(o3);
|
|
1239
|
-
l4.cell = o3, l4.pathBounds = n3.toClipBounds(n3.getRangeCoordsBounds(e3),
|
|
1207
|
+
l4.cell = o3, l4.pathBounds = n3.toClipBounds(n3.getRangeCoordsBounds(e3), ve), l4.pathBounds && (l4.pathBounds.width <= 0 || l4.pathBounds.height <= 0) && (delete l4.pathBounds, delete l4.cell);
|
|
1240
1208
|
}
|
|
1241
|
-
return
|
|
1209
|
+
return ke2(l4);
|
|
1242
1210
|
};
|
|
1243
|
-
let s2 = $e2 ?
|
|
1244
|
-
const a3 = s2?.cell ? n3.getCellCoordsAsRangeCoords(s2?.cell) :
|
|
1211
|
+
let s2 = $e2 ? Ce($e2) : null;
|
|
1212
|
+
const a3 = s2?.cell ? n3.getCellCoordsAsRangeCoords(s2?.cell) : Se;
|
|
1245
1213
|
!s2 || s2.ranges && 0 !== s2.ranges.length || (s2 = { ranges: [a3], rangeIndex: 0, cell: s2.cell });
|
|
1246
1214
|
for (let e2 = 0; s2 && e2 < s2.ranges.length; e2++) {
|
|
1247
1215
|
const t3 = s2.ranges[e2], i3 = c2(t3, e2, e2 === s2.rangeIndex ? s2.cell : null);
|
|
1248
1216
|
i3 && l3.push(i3);
|
|
1249
|
-
const a4 = 2, d4 = 0.5,
|
|
1250
|
-
if (
|
|
1217
|
+
const a4 = 2, d4 = 0.5, u4 = n3.toClipBounds(n3.getRangeCoordsBounds(t3, { top: 0, left: 0, right: 0, bottom: 0 }), ve);
|
|
1218
|
+
if (u4) {
|
|
1251
1219
|
const n4 = (s2.ranges.length, 4);
|
|
1252
|
-
l3.push(
|
|
1220
|
+
l3.push(ke2({ range: t3, key: `selection-inside-edge-${e2}`, x: u4.x - 1, y: u4.y - 1, width: Math.max(u4.width + 1, 0), height: Math.max(u4.height + 1, 0), style: { overflow: "hidden" }, stroke: D2, strokeWidth: n4 }));
|
|
1253
1221
|
}
|
|
1254
1222
|
if (1 === s2.ranges.length) {
|
|
1255
|
-
const o3 = n3.toClipBounds(n3.getRangeCoordsBounds(t3),
|
|
1223
|
+
const o3 = n3.toClipBounds(n3.getRangeCoordsBounds(t3), ve);
|
|
1256
1224
|
if (o3) {
|
|
1257
|
-
Z2 || l3.push(
|
|
1225
|
+
Z2 || l3.push(ke2({ range: t3, key: `move-selection-hit-box-${e2}`, x: o3.width > 1 ? o3.x : o3.x - (Q2 / 2 + 1), y: o3.height > 1 ? o3.y : o3.y - (Q2 / 2 + 1), width: Math.max(o3.width + 2, 1), height: Math.max(o3.height + 2, 1), stroke: "transparent", style: { boxShadow: "none" }, pathProps: { cursor: un ? void 0 : "move", pointerEvents: "stroke" }, strokeWidth: Q2, ...xn }));
|
|
1258
1226
|
const n4 = a4;
|
|
1259
|
-
l3.push(
|
|
1227
|
+
l3.push(ke2({ range: t3, key: `selection-single-${e2}`, x: o3.x - n4 / 2, y: o3.y - n4 / 2, width: Math.max(o3.width + n4 / 2, 1), height: Math.max(o3.height + n4 / 2, 1), stroke: oe2, strokeWidth: n4 }));
|
|
1260
1228
|
}
|
|
1261
1229
|
} else {
|
|
1262
|
-
const o3 = n3.toClipBounds(n3.getRangeCoordsBounds(t3, { top: -1, left: -1, right: -2, bottom: -2 }),
|
|
1263
|
-
o3 && l3.push(
|
|
1230
|
+
const o3 = n3.toClipBounds(n3.getRangeCoordsBounds(t3, { top: -1, left: -1, right: -2, bottom: -2 }), ve);
|
|
1231
|
+
o3 && l3.push(ke2({ range: t3, key: `selection-multi-${e2}`, x: o3.width > 1 ? o3.x : o3.x - d4 / 2, y: o3.height > 1 ? o3.y : o3.y - d4 / 2, width: Math.max(o3.width, d4) + 1, height: Math.max(o3.height, d4) + 1, stroke: oe2, style: { overflow: "hidden" }, strokeWidth: 2 }));
|
|
1264
1232
|
}
|
|
1265
1233
|
if (s2.ranges.length > 1 && e2 === s2.rangeIndex) {
|
|
1266
|
-
const o3 = n3.getCellCoordsAsRangeCoords(s2.cell), r4 = n3.toClipBounds(n3.getRangeCoordsBounds(o3, { top: 1, left: 1, right: -1, bottom: -1 }),
|
|
1267
|
-
r4 && l3.push(
|
|
1234
|
+
const o3 = n3.getCellCoordsAsRangeCoords(s2.cell), r4 = n3.toClipBounds(n3.getRangeCoordsBounds(o3, { top: 1, left: 1, right: -1, bottom: -1 }), ve);
|
|
1235
|
+
r4 && l3.push(ke2({ range: t3, key: `selection-anchor-${e2}`, x: r4.x, y: r4.y, width: Math.max(r4.width, d4), height: Math.max(r4.height, d4), stroke: oe2, style: { overflow: "hidden" }, strokeWidth: 2 }));
|
|
1268
1236
|
}
|
|
1269
1237
|
if (e2 === s2.ranges.length - 1) {
|
|
1270
1238
|
o2 = null, r3 = null;
|
|
1271
1239
|
const e3 = t3.rowStart === he2().top && t3.rowEnd === he2().bottom, l4 = t3.colStart === he2().left && t3.colEnd === he2().right, i4 = n3.getRangeCoordsBounds(t3);
|
|
1272
1240
|
let c3 = null;
|
|
1273
1241
|
if (e3 || l4) {
|
|
1274
|
-
if (c3 = n3.toClipBounds(i4,
|
|
1275
|
-
const o3 = n3.getVisibleRangeCoords(), r4 = n3.allViews()[
|
|
1276
|
-
(l4 && (a5 ===
|
|
1242
|
+
if (c3 = n3.toClipBounds(i4, ve), Object.keys(n3.allViews()).length > 1) {
|
|
1243
|
+
const o3 = n3.getVisibleRangeCoords(), r4 = n3.allViews()[z.TopLeft], i5 = n3.allViews()[z.Top], s3 = n3.allViews()[z.Left], a5 = n3.getAnchor();
|
|
1244
|
+
(l4 && (a5 === z.Top && r4 || a5 === z.Center && s3 || !P.isCellWithinRange({ colIndex: t3.colStart, rowIndex: t3.rowEnd }, o3) && !P.isCellWithinRange({ colIndex: t3.colStart, rowIndex: t3.rowEnd + 1 }, o3)) || e3 && (a5 === z.Left && r4 || a5 === z.Center && i5 || !P.isCellWithinRange({ colIndex: t3.colEnd, rowIndex: t3.rowStart }, o3) && !P.isCellWithinRange({ colIndex: t3.colEnd + 1, rowIndex: t3.rowStart }, o3))) && (c3 = null);
|
|
1277
1245
|
}
|
|
1278
|
-
} else c3 = n3.toClipBounds(i4,
|
|
1246
|
+
} else c3 = n3.toClipBounds(i4, ve);
|
|
1279
1247
|
if (!c3 || 0 === c3.width || 0 === c3.height) continue;
|
|
1280
1248
|
o2 = { x: c3.x + c3.width + 1, y: c3.y + c3.height + 1 }, 0 === c3.width || 0 === c3.height || t3.rowStart === he2().top && t3.colStart === he2().left && t3.rowEnd === he2().bottom && t3.colEnd === he2().right || (e3 ? (o2.y = a4, r3 = "tr") : l4 && (o2.x = a4, r3 = "bl"));
|
|
1281
1249
|
}
|
|
1282
1250
|
}
|
|
1283
1251
|
let d3 = null;
|
|
1284
1252
|
if (qe2) {
|
|
1285
|
-
const e2 = n3.toClipBounds(n3.getRangeCoordsBounds(qe2, { top: 0, left: 0, right: 0, bottom: 0 }),
|
|
1253
|
+
const e2 = n3.toClipBounds(n3.getRangeCoordsBounds(qe2, { top: 0, left: 0, right: 0, bottom: 0 }), ve);
|
|
1286
1254
|
if (e2) {
|
|
1287
1255
|
const t3 = 2;
|
|
1288
|
-
d3 =
|
|
1256
|
+
d3 = ke2({ ...i2, range: qe2, key: "remove-selection", x: e2.x, y: e2.y, width: e2.width, height: e2.height, strokeWidth: t3, stroke: se2, fill: ae2 });
|
|
1289
1257
|
}
|
|
1290
1258
|
}
|
|
1291
|
-
let
|
|
1259
|
+
let u3 = null;
|
|
1292
1260
|
if (He2) {
|
|
1293
|
-
const e2 = n3.toClipBounds(n3.getRangeCoordsBounds(He2, { top: 0, left: 0, right: 0, bottom: 0 }),
|
|
1261
|
+
const e2 = n3.toClipBounds(n3.getRangeCoordsBounds(He2, { top: 0, left: 0, right: 0, bottom: 0 }), ve);
|
|
1294
1262
|
if (e2) {
|
|
1295
1263
|
const t3 = 2;
|
|
1296
|
-
|
|
1264
|
+
u3 = ke2({ range: He2, key: "selection-fill-outline", x: e2.x - t3 / 2, y: e2.y - t3 / 2, width: e2.width + t3 / 2, height: e2.height + t3 / 2, strokeWidth: t3, stroke: oe2, strokeDasharray: "3 2" });
|
|
1297
1265
|
}
|
|
1298
1266
|
}
|
|
1299
1267
|
let h2 = null;
|
|
1300
|
-
!
|
|
1301
|
-
const
|
|
1302
|
-
if (d3 &&
|
|
1303
|
-
const o3 = s2.ranges[s2.ranges.length - 1], r4 = o3.rowStart === he2().top && o3.rowEnd === he2().bottom, l4 = o3.colStart === he2().left && o3.colEnd === he2().right, i3 = { view: n3, range: o3, borderStroke: `${
|
|
1304
|
-
|
|
1268
|
+
!k2 && o2 && !un && (h2 = E(xe, { ...o2, corner: r3, size: 7.5, borderStroke: `${D2} solid`, style: { borderRadius: 1 }, background: oe2, ...dn, key: "fillHandle" }));
|
|
1269
|
+
const g2 = [...l3];
|
|
1270
|
+
if (d3 && g2.push(d3), u3 && g2.push(u3), h2 && g2.push(h2), !de2 && st && 1 === s2?.ranges.length && s2.ranges[s2.ranges.length - 1]) {
|
|
1271
|
+
const o3 = s2.ranges[s2.ranges.length - 1], r4 = o3.rowStart === he2().top && o3.rowEnd === he2().bottom, l4 = o3.colStart === he2().left && o3.colEnd === he2().right, i3 = { view: n3, range: o3, borderStroke: `${oe2} solid`, background: D2, selectionTouchPointerHandler: ft, ...ue2, onTouchSelectStart: (e2) => Ze(e2), onTouchSelectEnd: () => Ze(null), currentTouchAnchor: Ge2 };
|
|
1272
|
+
g2.push(e(me, { anchor: l4 ? "b" : r4 ? "r" : "br", scrollableElement: t2.current, ...i3 }, "touch-select-handle-after")), g2.push(e(me, { anchor: l4 ? "t" : r4 ? "l" : "tl", scrollableElement: t2.current, ...i3 }, "touch-select-handle-before"));
|
|
1305
1273
|
}
|
|
1306
1274
|
if (un) {
|
|
1307
|
-
const e2 = n3.toClipBounds(n3.getRangeCoordsBounds(un, { top: 1, left: 1, right: 1, bottom: 1 }),
|
|
1308
|
-
e2 &&
|
|
1275
|
+
const e2 = n3.toClipBounds(n3.getRangeCoordsBounds(un, { top: 1, left: 1, right: 1, bottom: 1 }), ve);
|
|
1276
|
+
e2 && g2.push(ke2({ range: un, key: "selection-move-outline", x: e2.x - ee2 / 2, y: e2.y - ee2 / 2, width: Math.max(e2.width + ee2 / 2, 1), height: Math.max(e2.height + ee2 / 2, 1), stroke: oe2, style: { boxShadow: "none", transitionDuration: "70ms", transitionTimingFunction: "ease-in", transitionProperty: "left, top, width, height", willChange: "left, top, width, height" }, strokeWidth: ee2 }));
|
|
1309
1277
|
}
|
|
1310
|
-
return e("div", { children:
|
|
1311
|
-
}, [mn, qe2,
|
|
1278
|
+
return e("div", { children: g2 }, "selection");
|
|
1279
|
+
}, [mn, qe2, k2, He2, Z2, un, he2, D2, oe2, ne2, se2, ae2, de2, ue2, Ge2]), Sn = b(() => {
|
|
1312
1280
|
const e2 = () => t2.current;
|
|
1313
|
-
return [new
|
|
1281
|
+
return [new h("moveToPageDown", e2, { label: "Page Down", description: "Shift viewport down one page.", shortcut: [{ key: "PageDown" }] }, () => Pt(false)), new h("selectToPageDown", e2, { label: "Select To Page Down", description: "Shift viewport and select down one page.", shortcut: [{ key: "PageDown", modifiers: [g.Shift] }] }, () => Pt(true)), new h("moveToPageRight", e2, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [g.Alt] }] }, () => Dt(false)), new h("selectToPageRight", e2, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [g.Alt, g.Shift] }] }, () => Dt(true)), new h("moveToPageUp", e2, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp" }] }, () => Tt(false)), new h("selectToPageUp", e2, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp", modifiers: [g.Shift] }] }, () => Tt(true)), new h("moveToPageLeft", e2, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [g.Alt] }] }, () => Ot(false)), new h("selectToPageLeft", e2, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [g.Alt, g.Shift] }] }, () => Ot(true)), new h("selectColumn", e2, { label: "Select Column", description: "Select the columns for the selected cells.", shortcut: { key: "Space", modifiers: [g.Ctrl] } }, pt), new h("selectRow", e2, { label: "Select Row", description: "Select the rows for the selected cells.", shortcut: { key: "Space", modifiers: [g.Shift] } }, mt), new h("selectToColumnStart", e2, { label: "Select To Column Start", description: "Select the columns to the beginning of the sheet." }, () => St(true)), new h("selectToColumnEnd", e2, { label: "Select To Column End", description: "Select the columns to the end of the sheet." }, () => yt(true)), new h("moveToRowStart", e2, { label: "Move to Row Home", description: "Move to the beginning of the row.", shortcut: [{ key: "Home" }] }, () => bt(false)), new h("selectToRowStart", e2, { label: "Select to Row Home", description: "Select to the beginning of the row.", shortcut: [{ key: "Home", modifiers: [g.Shift] }] }, () => bt(true)), new h("moveToSheetStart", e2, { label: "Move to Sheet Home", description: "Move to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [g.Ctrl] }] }, () => Ct(false)), new h("selectToSheetStart", e2, { label: "Select to Sheet Home", description: "Select to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [g.Ctrl, g.Shift] }] }, () => Ct(true)), new h("moveToRowEnd", e2, { label: "Move to Row End", description: "Move to the end of the row.", shortcut: [{ key: "End" }] }, () => It(false)), new h("selectToRowEnd", e2, { label: "Select to Row End", description: "Select to the end of the row.", shortcut: [{ key: "End", modifiers: [g.Shift] }] }, () => It(true)), new h("moveToSheetEnd", e2, { label: "Move to Sheet End", description: "Move to the end of the sheet.", shortcut: [{ key: "End", modifiers: [g.Ctrl] }] }, () => Et(false)), new h("selectToSheetEnd", e2, { label: "Select to Sheet End", description: "Select to the end of the sheet.", shortcut: [{ key: "End", modifiers: [g.Ctrl, g.Shift] }] }, () => Et(true)), new h("scrollToActiveCoords", e2, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell.", shortcut: { key: "Backspace", modifiers: [g.Ctrl] } }, vt), new h("scrollToActiveCoordsClearSelection", e2, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell and clear selection.", shortcut: { key: "Backspace", modifiers: [g.Shift] } }, () => {
|
|
1314
1282
|
ct(), rn($e2.cell, true);
|
|
1315
|
-
}), new
|
|
1283
|
+
}), new h("traverseSelectionRight", e2, { label: "Traverse Right", description: "Traverse the selection moving rightward.", shortcut: { key: "Tab" } }, Lt), new h("traverseSelectionLeft", e2, { label: "Traverse Left", description: "Traverse the selection moving leftward.", shortcut: { key: "Tab", modifiers: [g.Shift] } }, zt), new h("traverseSelectionDown", e2, { label: "Traverse Down", description: "Traverse the selection moving downward.", shortcut: [{ key: "Enter" }, { key: "NumpadEnter" }] }, Bt), new h("traverseSelectionUp", e2, { label: "Traverse Up", description: "Traverse the selection moving upward.", shortcut: [{ key: "Enter", modifiers: [g.Shift] }, { key: "NumpadEnter", modifiers: [g.Shift] }] }, $t), new h("moveLeft", e2, { label: "Move Left", description: "Move active cell to the left.", shortcut: [{ key: "ArrowLeft" }] }, Vt), new h("selectLeft", e2, { label: "Select Left", description: "Extend selection left.", shortcut: [{ key: "ArrowLeft", modifiers: [g.Shift] }] }, Ut), new h("moveContentfulLeft", e2, { label: "Move Left Contentful", description: "Move left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [g.Ctrl] }] }, Ht), new h("selectContentfulLeft", e2, { label: "Select Left Contentful", description: "Extend selection left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [g.Ctrl, g.Shift] }] }, Kt), new h("moveRight", e2, { label: "Move Right", description: "Move active cell to the right.", shortcut: [{ key: "ArrowRight" }] }, Nt), new h("selectRight", e2, { label: "Select Right", description: "Extend selection right.", shortcut: [{ key: "ArrowRight", modifiers: [g.Shift] }] }, qt), new h("moveContentfulRight", e2, { label: "Move Right Contentful", description: "Move right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [g.Ctrl] }] }, jt), new h("selectContentfulRight", e2, { label: "Select Right Contentful", description: "Extend selection right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [g.Ctrl, g.Shift] }] }, Xt), new h("moveUp", e2, { label: "Move Up", description: "Move active cell to the up.", shortcut: [{ key: "ArrowUp" }] }, Yt), new h("selectUp", e2, { label: "Select Up", description: "Extend selection up.", shortcut: [{ key: "ArrowUp", modifiers: [g.Shift] }] }, Gt), new h("moveContentfulUp", e2, { label: "Move Up Contentful", description: "Move up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [g.Ctrl] }] }, Zt), new h("selectContentfulUp", e2, { label: "Select Up Contentful", description: "Extend selection up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [g.Ctrl, g.Shift] }] }, _t), new h("moveDown", e2, { label: "Move Down", description: "Move active cell to the down.", shortcut: [{ key: "ArrowDown" }] }, Jt), new h("selectDown", e2, { label: "Select Down", description: "Extend selection down.", shortcut: [{ key: "ArrowDown", modifiers: [g.Shift] }] }, Qt), new h("moveContentfulDown", e2, { label: "Move Down Contentful", description: "Move down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [g.Ctrl] }] }, en), new h("selectContentfulDown", e2, { label: "Select Down Contentful", description: "Extend selection down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [g.Ctrl, g.Shift] }] }, tn), new h("selectVisible", e2, { label: "Select Visible", description: "Select visible cells only.", shortcut: { key: ";", modifiers: [g.Alt] } }, Mt), new h("traverseSelectionPreviousRange", e2, { label: "Traverse Previous Range", description: "Traverse the selection to the previous range.", shortcut: { key: "ArrowLeft", modifiers: [g.Ctrl, g.Alt] } }, Ft), new h("traverseSelectionNextRange", e2, { label: "Traverse Next Range", description: "Traverse the selection to the next range.", shortcut: { key: "ArrowRight", modifiers: [g.Ctrl, g.Alt] } }, Wt), new h("traverseSelectionCorners", e2, { label: "Traverse Corners", description: "Traverse the selection through the corners of the selected range.", shortcut: { key: ".", modifiers: [g.Ctrl] } }, At)];
|
|
1316
1284
|
}, []);
|
|
1317
|
-
return
|
|
1285
|
+
return b(() => {
|
|
1318
1286
|
n2?.addCommands(Sn, true);
|
|
1319
|
-
}, [n2]), { selection: mn, setSelectionCell: rn, setSelectionRanges:
|
|
1320
|
-
},
|
|
1321
|
-
const { width: c2, height: s2, rowCount: a2 = 1, columnCount: d2 = 1, defaultRowHeight: u2, defaultColumnWidth: h2, getRowHeight:
|
|
1322
|
-
|
|
1323
|
-
const ve2 = o(
|
|
1287
|
+
}, [n2]), { selection: mn, setSelectionCell: rn, setSelectionRanges: We2, overlay: vn, cursor: Ve2, onPointerDown: gt, clearLastSelection: nn, newSelection: lt, modifySelection: rt, appendSelection: it, clearSelections: ct, isEntire: on, navigate: wt, navigateSelection: xt };
|
|
1288
|
+
}, Me = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ke = Object.freeze({ top: 0, left: 0 }), Pe = Object.freeze({ bottom: -4, right: -4 }), Te = Object.freeze({ horizontal: true, vertical: true }), De = [z.TopLeft, z.Top, z.Left, z.Center], Oe = 150, ze = 3e3, Le = {}, $e = C(I((r2, l2) => {
|
|
1289
|
+
const { width: c2, height: s2, rowCount: a2 = 1, columnCount: d2 = 1, defaultRowHeight: u2, defaultColumnWidth: h2, getRowHeight: g2, getColumnWidth: w2, layout: C2, onViewportScroll: I2, onImmediateScroll: R2, showGridLines: D2 = true, gridLineColor: L2 = "rgb(224, 224, 224)", gridLineRowsProps: $2, gridLineColumnsProps: B2, clipCells: F2 = true, cursor: W2, freezeLeft: A2 = 0, freezeTop: V2 = 0, freezeLeftProps: H2, freezeTopProps: K2, cellRenderer: N2, onViewportChange: q2, onFirstRender: j2, overlayRenderer: X2, overlayProps: Y2, overlays: G2, overlaysProps: Z2, allowOverlaysOverflow: _2 = false, stageProps: Q2, stageWrapper: ee2 = null, hiddenRowsAt: te2, hiddenColumnsAt: re2, hiddenCellAt: le2, getVisibleCells: ie2, zoom: ue2 = 1, enableMouseWheel: ge2 = true, onWheelScroll: fe2, getCellCoordsAsRangeCoords: we2 = P.cellToRange, scrollPoint: xe2 = ke, style: pe2 = {}, ...me2 } = r2;
|
|
1290
|
+
M(N2, "No cellRenderer specified. This is probably not what you wanted"), M(!r2?.children, "Grid does not support children elements");
|
|
1291
|
+
const ve2 = o(R2, [R2]), Se2 = o(q2, [q2]), ye2 = o(I2, [I2]), be2 = o(fe2, [fe2]), Ce2 = o(j2, [j2]), Ie2 = x(null), Ee2 = x(null), Re2 = x(null), [Oe2, $e2] = p((e2) => e2 + 1, 0), [Be2, Fe2] = m({ left: xe2?.left ?? 0, top: xe2?.top ?? 0, horizontalScrollDirection: null, verticalScrollDirection: null }), We2 = x(null), Ae2 = x(Be2), { top: Ve2, left: Ue2, verticalScrollDirection: He2, horizontalScrollDirection: Ke2 } = Be2, Ne2 = x(false), qe2 = U({ rowCount: a2, columnCount: d2, defaultRowHeight: u2, defaultColumnWidth: h2, getRowHeight: g2, getColumnWidth: w2 }), je2 = x(null), Xe2 = b(() => {
|
|
1324
1292
|
const e2 = C2 || qe2;
|
|
1325
|
-
return je2.current = null, { getColOffset: (t2) => e2.getColOffset(t2) *
|
|
1326
|
-
}, [qe2, C2,
|
|
1293
|
+
return je2.current = null, { getColOffset: (t2) => e2.getColOffset(t2) * ue2, getColIndex: (t2) => e2.getColIndex(t2 / ue2), getRowOffset: (t2) => e2.getRowOffset(t2) * ue2, getRowIndex: (t2) => e2.getRowIndex(t2 / ue2) };
|
|
1294
|
+
}, [qe2, C2, ue2]), Ye2 = (e2, t2, n2) => {
|
|
1327
1295
|
const o2 = (t2?.left ?? 0) + 0, r3 = (t2?.top ?? 0) + 0;
|
|
1328
1296
|
return { getColOffset: (t3) => e2.getColOffset(t3) - o2, getColIndex: (t3) => e2.getColIndex(t3 + o2), getRowOffset: (t3) => e2.getRowOffset(t3) - r3, getRowIndex: (t3) => e2.getRowIndex(t3 + r3) };
|
|
1329
|
-
}, Ge2 = o((e2, t2 = false) =>
|
|
1330
|
-
|
|
1297
|
+
}, Ge2 = o((e2, t2 = false) => ce(e2, t2, Xe2.getRowOffset, t2 ? 0 : a2), [a2, Xe2?.getRowOffset]), Ze = o(te2 ?? Ge2, [te2]), _e = o((e2, t2 = false) => ce(e2, t2, Xe2.getColOffset, t2 ? d2 : 0), [d2, Xe2?.getColOffset]), Je = o(re2 ?? _e, [re2]), Qe = b(() => Math.min(c2 ?? 800, Xe2.getColOffset(d2)), [Xe2.getColOffset, d2, c2]), et = b(() => Math.min(s2 ?? 600, Xe2.getRowOffset(a2)), [Xe2.getRowOffset, a2, s2]), tt = S((e2) => {
|
|
1298
|
+
T.canUseDOM && setTimeout(() => {
|
|
1331
1299
|
Ie2.current?.focus({ preventScroll: true, ...e2 });
|
|
1332
1300
|
}, 0);
|
|
1333
|
-
}, []), nt =
|
|
1334
|
-
|
|
1335
|
-
Ne2.current && (
|
|
1301
|
+
}, []), nt = S((e2) => Ie2.current?.contains(e2) || Ee2.current?.contains(e2), []);
|
|
1302
|
+
v(() => {
|
|
1303
|
+
Ne2.current && (We2.current && We2.current.left !== Ae2.current?.left && We2.current.top !== Ae2.current?.top || (We2.current = null, ye2?.({ left: Ue2, top: Ve2 })));
|
|
1336
1304
|
}, [Ue2, Ve2]);
|
|
1337
|
-
const ot = o(() => ({ top: Ve2, left: Ue2 }), [Ve2, Ue2]), rt =
|
|
1305
|
+
const ot = o(() => ({ top: Ve2, left: Ue2 }), [Ve2, Ue2]), rt = b(() => {
|
|
1338
1306
|
const e2 = [];
|
|
1339
1307
|
let t2 = 0, n2 = 0;
|
|
1340
|
-
"number" == typeof
|
|
1308
|
+
"number" == typeof V2 ? t2 = V2 : (t2 = V2.index ?? 0, n2 = (V2.scrollOffset ?? 0) * ue2);
|
|
1341
1309
|
const o2 = n2, r3 = Xe2.getRowOffset(t2), l3 = r3 - o2;
|
|
1342
1310
|
if (t2 > 0) {
|
|
1343
1311
|
const i3 = Ye2(Xe2, { top: n2 + Xe2.getRowOffset(0) }), c4 = Xe2.getRowIndex(o2), s4 = Xe2.getRowIndex(r3 - 1);
|
|
1344
1312
|
let a3;
|
|
1345
|
-
e2[1] = { minIndex: c4, maxIndex: s4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: l3, visibleIndices: () => a3 || (a3 = Object.freeze(
|
|
1313
|
+
e2[1] = { minIndex: c4, maxIndex: s4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: l3, visibleIndices: () => a3 || (a3 = Object.freeze(J(Ze, c4, s4)), a3), layout: i3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
|
|
1346
1314
|
}
|
|
1347
1315
|
const i2 = Math.max(0, et - l3), c3 = Ye2(Xe2, { top: Ve2 + l3 }), s3 = c3.getRowIndex(0), d3 = c3.getRowIndex(i2);
|
|
1348
1316
|
let u3;
|
|
1349
|
-
return e2[0] = { minIndex: s3, maxIndex: d3, minCoord: t2, maxCoord: a2 - 1, minBounds: l3, maxBounds: i2, visibleIndices: () => u3 || (u3 = Object.freeze(
|
|
1350
|
-
}, [Xe2.getRowIndex, Xe2.getRowOffset,
|
|
1317
|
+
return e2[0] = { minIndex: s3, maxIndex: d3, minCoord: t2, maxCoord: a2 - 1, minBounds: l3, maxBounds: i2, visibleIndices: () => u3 || (u3 = Object.freeze(J(Ze, s3, d3)), u3), layout: c3, maxVirtualBounds: Xe2.getRowOffset(a2), scrollOffset: Ve2, freezeOffset: (t2 > 0 ? Xe2.getRowOffset(t2) : 0) - n2 }, e2;
|
|
1318
|
+
}, [Xe2.getRowIndex, Xe2.getRowOffset, Ze, et, a2, V2, Ve2, ue2]), lt = b(() => {
|
|
1351
1319
|
const e2 = [];
|
|
1352
1320
|
let t2 = 0, n2 = 0;
|
|
1353
|
-
"number" == typeof
|
|
1321
|
+
"number" == typeof A2 ? t2 = A2 : (t2 = A2.index ?? 0, n2 = (A2.scrollOffset ?? 0) * ue2);
|
|
1354
1322
|
const o2 = n2, r3 = Xe2.getColOffset(t2), l3 = r3 - o2;
|
|
1355
1323
|
if (t2 > 0) {
|
|
1356
1324
|
const i3 = Ye2(Xe2, { left: n2 + Xe2.getColOffset(0) }), c4 = Xe2.getColIndex(o2), s4 = Xe2.getColIndex(r3 - 1);
|
|
1357
1325
|
let a4;
|
|
1358
|
-
e2[1] = { minIndex: c4, maxIndex: s4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: l3, visibleIndices: () => a4 || (a4 = Object.freeze(
|
|
1326
|
+
e2[1] = { minIndex: c4, maxIndex: s4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: l3, visibleIndices: () => a4 || (a4 = Object.freeze(J(Je, c4, s4)), a4), layout: i3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
|
|
1359
1327
|
}
|
|
1360
|
-
const i2 = Math.max(0,
|
|
1328
|
+
const i2 = Math.max(0, Qe - l3), c3 = Ye2(Xe2, { left: Ue2 + l3 }), s3 = c3.getColIndex(0), a3 = c3.getColIndex(i2);
|
|
1361
1329
|
let u3;
|
|
1362
|
-
return e2[0] = { minIndex: s3, maxIndex: a3, minCoord: t2, maxCoord: d2 - 1, minBounds: l3, maxBounds: i2, visibleIndices: () => u3 || (u3 = Object.freeze(
|
|
1363
|
-
}, [Xe2.getColIndex, Xe2.getColOffset,
|
|
1330
|
+
return e2[0] = { minIndex: s3, maxIndex: a3, minCoord: t2, maxCoord: d2 - 1, minBounds: l3, maxBounds: i2, visibleIndices: () => u3 || (u3 = Object.freeze(J(Je, s3, a3)), u3), layout: c3, maxVirtualBounds: Xe2.getColOffset(d2), scrollOffset: Ue2, freezeOffset: (t2 > 0 ? Xe2.getColOffset(t2) : 0) - n2 }, e2;
|
|
1331
|
+
}, [Xe2.getColIndex, Xe2.getColOffset, Je, Qe, d2, A2, Ue2, ue2]), it = x({}), ct = x([]), st = b(() => {
|
|
1364
1332
|
let e2 = {};
|
|
1365
1333
|
const t2 = (t3, n3, o2, r3, l3) => {
|
|
1366
1334
|
const i2 = { vertical: r3?.vertical || false, horizontal: r3?.horizontal || false };
|
|
1367
1335
|
if (t3 >= lt.length || n3 >= rt.length) return null;
|
|
1368
1336
|
const c3 = { rowStart: rt[n3].minIndex, colStart: lt[t3].minIndex, rowEnd: rt[n3].maxIndex, colEnd: lt[t3].maxIndex };
|
|
1369
1337
|
if (c3.rowStart > c3.rowEnd || c3.colStart > c3.colEnd) return null;
|
|
1370
|
-
const s3 = { getColIndex: (e3) => lt[t3].layout.getColIndex(e3), getColOffset: (e3) => lt[t3].layout.getColOffset(e3), getRowIndex: (e3) => rt[n3].layout.getRowIndex(e3), getRowOffset: (e3) => rt[n3].layout.getRowOffset(e3) }, a3 = Object.freeze({ left: l3?.left ?? 0, top: l3?.top ?? 0, right: l3?.right ?? 0, bottom: l3?.bottom ?? 0 }), d3 = Object.freeze({ x: lt[t3].minBounds, y: rt[n3].minBounds, width: lt[t3].maxBounds, height: rt[n3].maxBounds }), u3 = (e3, t4) =>
|
|
1338
|
+
const s3 = { getColIndex: (e3) => lt[t3].layout.getColIndex(e3), getColOffset: (e3) => lt[t3].layout.getColOffset(e3), getRowIndex: (e3) => rt[n3].layout.getRowIndex(e3), getRowOffset: (e3) => rt[n3].layout.getRowOffset(e3) }, a3 = Object.freeze({ left: l3?.left ?? 0, top: l3?.top ?? 0, right: l3?.right ?? 0, bottom: l3?.bottom ?? 0 }), d3 = Object.freeze({ x: lt[t3].minBounds, y: rt[n3].minBounds, width: lt[t3].maxBounds, height: rt[n3].maxBounds }), u3 = (e3, t4) => ae(s3, e3 ?? c3, t4), h3 = { width: lt[t3].maxVirtualBounds, height: rt[n3].maxVirtualBounds }, g3 = { left: lt[t3].scrollOffset, top: rt[n3].scrollOffset }, f2 = { left: lt[t3].freezeOffset, top: rt[n3].freezeOffset }, w3 = { width: Qe, height: et };
|
|
1371
1339
|
let x2 = null, p2 = null;
|
|
1372
|
-
const m2 = (
|
|
1340
|
+
const m2 = (f2.top + (r3.vertical ? g3.top : 0)) / ue2, v2 = (f2.left + (r3.horizontal ? g3.left : 0)) / ue2;
|
|
1373
1341
|
return { getStage: () => Ie2.current ?? null, getVisibleRangeCoords: () => c3, toClipBounds: (e3, t4) => {
|
|
1374
1342
|
let n4, o3 = 0;
|
|
1375
1343
|
return void 0 === t4 || "number" == typeof t4 ? (n4 = u3(c3), o3 = t4) : n4 = t4, ((e4, t5, n5 = 0) => {
|
|
@@ -1377,94 +1345,94 @@ const Ce = -10, Ie = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
1377
1345
|
const o4 = { left: e4.x, top: e4.y, bottom: e4.height + e4.y, right: e4.width + e4.x }, r4 = { left: t5.x + n5, top: t5.y + n5, bottom: t5.height - 2 * n5 + t5.y, right: t5.width - 2 * n5 + t5.x }, l4 = { left: Math.max(o4.left, r4.left), top: Math.max(o4.top, r4.top), bottom: Math.min(o4.bottom, r4.bottom), right: Math.min(o4.right, r4.right) }, i3 = { x: l4.left, y: l4.top, width: l4.right - l4.left, height: l4.bottom - l4.top };
|
|
1378
1346
|
return i3.height < 0 || i3.width < 0 ? null : i3;
|
|
1379
1347
|
})(e3 ?? { x: 0, y: 0, width: d3.width, height: d3.height }, n4, o3);
|
|
1380
|
-
}, toViewBounds: (e3) => 0 === v2 && 0 === m2 && 1 ===
|
|
1348
|
+
}, toViewBounds: (e3) => 0 === v2 && 0 === m2 && 1 === ue2 ? e3 : { x: (e3.x - v2) * ue2, y: (e3.y - m2) * ue2, width: e3.width * ue2, height: e3.height * ue2 }, toAbsoluteBounds: (e3) => 0 === v2 && 0 === m2 && 1 === ue2 ? e3 : { x: e3.x / ue2 + v2, y: e3.y / ue2 + m2, width: e3.width / ue2, height: e3.height / ue2 }, getRelativePointFromClient: (e3, t4) => {
|
|
1381
1349
|
const n4 = ft(e3, t4);
|
|
1382
1350
|
return { x: n4.x - d3.x, y: n4.y - d3.y };
|
|
1383
|
-
}, getLayout: () => s3, getCellCoordsAsRangeCoords:
|
|
1351
|
+
}, getLayout: () => s3, getCellCoordsAsRangeCoords: we2, getVisibleColumns: () => lt[t3].visibleIndices(), getVisibleRows: () => rt[n3].visibleIndices(), getVisibleColumnOffsets: () => (x2 || (x2 = se(lt[t3].layout, true, lt[t3].visibleIndices(), c3.colStart, c3.colEnd)), x2), getVisibleRowOffsets: () => (p2 || (p2 = se(rt[n3].layout, false, rt[n3].visibleIndices(), c3.rowStart, c3.rowEnd)), p2), getTotalRangeCoords: () => ({ colStart: lt[t3].minCoord, colEnd: lt[t3].maxCoord, rowStart: rt[n3].minCoord, rowEnd: rt[n3].maxCoord }), getRangeCoordsBounds: u3, scrollCellCoordsIntoView: (e3, t4) => It(e3, t4, o2), getCellCoordsFromClient: (e3, t4, n4 = false) => {
|
|
1384
1352
|
const o3 = ft(e3, t4);
|
|
1385
1353
|
if (!o3) return null;
|
|
1386
1354
|
const r4 = s3.getColIndex(o3.x - d3.x), l4 = { rowIndex: s3.getRowIndex(o3.y - d3.y), colIndex: r4 };
|
|
1387
1355
|
if (n4) return l4;
|
|
1388
|
-
const i3 =
|
|
1356
|
+
const i3 = we2(l4);
|
|
1389
1357
|
return { rowIndex: i3.rowStart, colIndex: i3.colStart };
|
|
1390
|
-
}, getZoom: () =>
|
|
1358
|
+
}, getZoom: () => ue2, getAnchor: () => o2, getBounds: () => d3, getInsets: () => a3, getTotalSize: () => h3, getViewportSize: () => w3, getScrollTopLeft: () => g3, getFreezeTopLeft: () => f2, getScrollOrientation: () => i2, allViews: () => e2 };
|
|
1391
1359
|
};
|
|
1392
|
-
let n2 = e2[
|
|
1393
|
-
return n2 && (e2[
|
|
1394
|
-
}, [rt, lt,
|
|
1395
|
-
|
|
1360
|
+
let n2 = e2[z.Center] = t2(0, 0, z.Center, Te, Pe);
|
|
1361
|
+
return n2 && (e2[z.Center] = n2), n2 = t2(0, 1, z.Top, { horizontal: true }), n2 && (e2[z.Top] = n2), n2 = t2(1, 0, z.Left, { vertical: true }), n2 && (e2[z.Left] = n2), n2 = t2(1, 1, z.TopLeft, {}), n2 && (e2[z.TopLeft] = n2), it.current = null, e2 = Object.freeze(e2);
|
|
1362
|
+
}, [rt, lt, we2]), at = Object.keys(st), dt = lt[0]?.maxVirtualBounds ?? 0, ut = rt[0]?.maxVirtualBounds ?? 0, ht = b(() => ({ left: lt[1] ? lt[1].layout.getColOffset(lt[1].maxIndex + 1) : 0, top: rt[1] ? rt[1].layout.getRowOffset(rt[1].maxIndex + 1) : 0 }), [st]);
|
|
1363
|
+
v(() => {
|
|
1396
1364
|
if (ct.current.length > 0) {
|
|
1397
1365
|
for (let e2 = 0; e2 < ct.current.length; e2++) ct.current[e2]();
|
|
1398
1366
|
ct.current = [];
|
|
1399
1367
|
}
|
|
1400
1368
|
}, [st]);
|
|
1401
|
-
const gt = o(() => ({ containerWidth:
|
|
1402
|
-
|
|
1403
|
-
!
|
|
1404
|
-
}, [Ve2, Ue2, dt, ut]),
|
|
1405
|
-
Ne2.current && Se2({ top: Ve2, left: Ue2, width:
|
|
1406
|
-
}, [
|
|
1407
|
-
const ft =
|
|
1408
|
-
|
|
1369
|
+
const gt = o(() => ({ containerWidth: Qe, containerHeight: et, totalWidth: dt, totalHeight: ut }), [Qe, et, Xe2]);
|
|
1370
|
+
v(() => {
|
|
1371
|
+
!We2.current && Ne2.current && Se2({ top: Ve2, left: Ue2, width: Qe, height: et, totalWidth: dt, totalHeight: ut });
|
|
1372
|
+
}, [Ve2, Ue2, dt, ut]), v(() => {
|
|
1373
|
+
Ne2.current && Se2({ top: Ve2, left: Ue2, width: Qe, height: et, totalWidth: dt, totalHeight: ut });
|
|
1374
|
+
}, [Qe, et]);
|
|
1375
|
+
const ft = S((e2, t2) => {
|
|
1376
|
+
M("number" == typeof e2 && "number" == typeof t2, "Top and left should be a number.");
|
|
1409
1377
|
const n2 = Ie2.current?.getBoundingClientRect();
|
|
1410
1378
|
return n2 ? { x: e2 - n2.x, y: t2 - n2.y } : { x: e2, y: t2 };
|
|
1411
1379
|
}, []), wt = o((e2) => st[e2] || null, [st]), xt = o((e2, t2) => {
|
|
1412
|
-
if (1 === Object.keys(st).length) return st[
|
|
1380
|
+
if (1 === Object.keys(st).length) return st[z.Center];
|
|
1413
1381
|
const n2 = ft(e2, t2);
|
|
1414
1382
|
if (!n2) return null;
|
|
1415
1383
|
const { x: o2, y: r3 } = n2;
|
|
1416
1384
|
let l3 = null;
|
|
1417
|
-
const i2 =
|
|
1385
|
+
const i2 = De, c3 = i2.length;
|
|
1418
1386
|
for (let e3 = 0; !l3 && e3 < c3; e3++) {
|
|
1419
1387
|
const t3 = st[i2[e3]];
|
|
1420
|
-
t3 &&
|
|
1388
|
+
t3 && de(o2, r3, t3.getBounds()) && (l3 = t3);
|
|
1421
1389
|
}
|
|
1422
|
-
return l3 || (l3 = st[
|
|
1423
|
-
}, [st,
|
|
1424
|
-
null !== mt.current &&
|
|
1425
|
-
}, []), St =
|
|
1426
|
-
mt.current = null,
|
|
1390
|
+
return l3 || (l3 = st[z.Center]), l3;
|
|
1391
|
+
}, [st, we2]), pt = o(() => st[z.Center].getVisibleRangeCoords(), [st[z.Center]]), mt = x(null), vt = S(() => {
|
|
1392
|
+
null !== mt.current && T.cancelTimeout(mt.current), mt.current = T.requestTimeout(St, 150);
|
|
1393
|
+
}, []), St = S(() => {
|
|
1394
|
+
mt.current = null, Fe2((e2) => {
|
|
1427
1395
|
const t2 = { ...e2, verticalScrollDirection: null, horizontalScrollDirection: null };
|
|
1428
|
-
return
|
|
1396
|
+
return Ae2.current = t2, t2;
|
|
1429
1397
|
});
|
|
1430
1398
|
}, []), yt = o((e2) => {
|
|
1431
1399
|
const t2 = e2?.left ?? e2?.[0], n2 = e2?.top ?? e2?.[1];
|
|
1432
|
-
let o2 =
|
|
1433
|
-
void 0 !== t2 && t2 !== o2 && (t2 > o2 ? (o2 = Math.max(lt?.[1]?.scrollOffset ?? 0, t2), o2 = Math.min(dt -
|
|
1434
|
-
let r3 =
|
|
1435
|
-
if (void 0 !== n2 && n2 !== r3 && (n2 > r3 ? (r3 = Math.max(rt?.[1]?.scrollOffset ?? 0, n2), r3 = Math.min(ut - et, r3)) : r3 = Math.max(rt?.[1]?.scrollOffset ?? 0, n2)),
|
|
1400
|
+
let o2 = Ae2.current.left;
|
|
1401
|
+
void 0 !== t2 && t2 !== o2 && (t2 > o2 ? (o2 = Math.max(lt?.[1]?.scrollOffset ?? 0, t2), o2 = Math.min(dt - Qe, o2)) : o2 = Math.max(lt?.[1]?.scrollOffset ?? 0, t2));
|
|
1402
|
+
let r3 = Ae2.current.top;
|
|
1403
|
+
if (void 0 !== n2 && n2 !== r3 && (n2 > r3 ? (r3 = Math.max(rt?.[1]?.scrollOffset ?? 0, n2), r3 = Math.min(ut - et, r3)) : r3 = Math.max(rt?.[1]?.scrollOffset ?? 0, n2)), Ae2.current.left === o2 && Ae2.current.top === r3) return;
|
|
1436
1404
|
let l3 = null, i2 = null;
|
|
1437
|
-
|
|
1438
|
-
|
|
1405
|
+
Ae2.current.left > o2 ? l3 = O.Left : Ae2.current.left < o2 && (l3 = O.Right), Ae2.current.top > r3 ? i2 = O.Up : Ae2.current.top < r3 && (i2 = O.Down), T.throttle(() => {
|
|
1406
|
+
Fe2((e3) => {
|
|
1439
1407
|
const t3 = { ...e3, left: o2, top: r3, horizontalScrollDirection: l3, verticalScrollDirection: i2 };
|
|
1440
|
-
return
|
|
1408
|
+
return Ae2.current = t3, t3;
|
|
1441
1409
|
});
|
|
1442
|
-
}, 17)(),
|
|
1410
|
+
}, 17)(), We2.current?.top === r3 && We2.current?.left === o2 || (We2.current = { left: o2, top: r3 }, ve2({ left: o2, top: r3 }), Se2({ left: o2, top: r3, width: Qe, height: et, totalWidth: dt, totalHeight: ut })), vt();
|
|
1443
1411
|
}, [dt, ut, rt, lt]);
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
}, [
|
|
1412
|
+
v(() => {
|
|
1413
|
+
We2.current || yt({ left: Ue2, top: Ve2 });
|
|
1414
|
+
}, [Qe, et]), v(() => {
|
|
1447
1415
|
let e2, t2, n2 = false;
|
|
1448
|
-
|
|
1449
|
-
}, [dt, ut]),
|
|
1450
|
-
|
|
1451
|
-
}, [
|
|
1416
|
+
Ae2.current.left > dt && (e2 = 0, n2 = true), Ae2.current.top > ut && (t2 = 0, n2 = true), n2 && yt({ left: e2, top: t2 });
|
|
1417
|
+
}, [dt, ut]), y(() => {
|
|
1418
|
+
We2.current = { left: xe2?.left, top: xe2?.top }, yt(We2.current);
|
|
1419
|
+
}, [xe2?.left, xe2?.top]);
|
|
1452
1420
|
const bt = o((e2) => {
|
|
1453
1421
|
let t2 = e2?.left ?? e2?.[0], n2 = e2?.top ?? e2?.[1];
|
|
1454
1422
|
if (void 0 === t2 && void 0 === n2) return;
|
|
1455
1423
|
const o2 = e2?.behavior ?? "auto";
|
|
1456
|
-
if (void 0 !== t2 && (t2 =
|
|
1424
|
+
if (void 0 !== t2 && (t2 = Ae2.current.left + (t2 ?? 0)), void 0 !== n2 && (n2 = Ae2.current.top + (n2 ?? 0)), Ae2.current.left === t2 && Ae2.current.top === n2) return;
|
|
1457
1425
|
yt({ left: t2, top: n2, behavior: o2 });
|
|
1458
|
-
}, []), Ct =
|
|
1426
|
+
}, []), Ct = S((e2) => {
|
|
1459
1427
|
let t2 = null;
|
|
1460
1428
|
if (Object.keys(st).length > 1) {
|
|
1461
|
-
const n2 =
|
|
1429
|
+
const n2 = De, o2 = n2.length;
|
|
1462
1430
|
for (let r3 = 0; !t2 && r3 < o2; r3++) {
|
|
1463
1431
|
const o3 = st[n2[r3]];
|
|
1464
|
-
o3 &&
|
|
1432
|
+
o3 && P.isCellWithinRange(e2, o3.getVisibleRangeCoords()) && (t2 = o3);
|
|
1465
1433
|
}
|
|
1466
1434
|
}
|
|
1467
|
-
return t2 || (t2 = st[
|
|
1435
|
+
return t2 || (t2 = st[z.Center]), t2;
|
|
1468
1436
|
}, [st]), It = o((e2, t2 = { inline: "nearest", block: "nearest" }, n2 = null) => {
|
|
1469
1437
|
const o2 = { rowIndex: 0, colIndex: 0, ...e2 };
|
|
1470
1438
|
let r3 = null;
|
|
@@ -1473,23 +1441,23 @@ const Ce = -10, Ie = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
1473
1441
|
t3("Invalid view");
|
|
1474
1442
|
});
|
|
1475
1443
|
} else r3 = Ct(o2);
|
|
1476
|
-
const l3 =
|
|
1444
|
+
const l3 = we2(o2), i2 = r3.getLayout(), c3 = i2.getColOffset(l3.colStart), s3 = i2.getRowOffset(l3.rowStart), a3 = i2.getColOffset(l3.colEnd + 1), d3 = i2.getRowOffset(l3.rowEnd + 1), u3 = r3.getBounds(), h3 = r3.getTotalSize(), g3 = r3.getScrollTopLeft(), f2 = ((e3, t3, n3 = true) => {
|
|
1477
1445
|
n3 = true === n3 ? { block: "start", inline: "end" } : false === n3 ? { block: "end", inline: "end" } : { block: "end", inline: "end", ...n3 };
|
|
1478
|
-
const o3 =
|
|
1446
|
+
const o3 = oe(n3.inline, e3.x, e3.x + e3.width, t3.left, t3.left + t3.width, t3.totalWidth), r4 = oe(n3.block, e3.y, e3.y + e3.height, t3.top, t3.top + t3.height, t3.totalHeight);
|
|
1479
1447
|
if (void 0 !== o3 || void 0 !== r4) return { left: o3, top: r4 };
|
|
1480
|
-
})({ x: c3 +
|
|
1481
|
-
if (!
|
|
1482
|
-
const
|
|
1483
|
-
|
|
1448
|
+
})({ x: c3 + g3.left, y: s3 + g3.top, width: a3 - c3, height: d3 - s3 }, { left: g3.left, top: g3.top, width: u3.width, height: u3.height, totalWidth: h3.width, totalHeight: h3.height }, t2);
|
|
1449
|
+
if (!f2) return Promise.resolve({ ...g3 });
|
|
1450
|
+
const w3 = { ...f2 };
|
|
1451
|
+
w3.left > Ue2 ? w3.left += 20 : w3.left < Ue2 && (w3.left -= 0), w3.top > Ve2 ? w3.top += 20 : w3.top < Ve2 && (w3.top -= 0);
|
|
1484
1452
|
const x2 = r3.getScrollOrientation();
|
|
1485
|
-
return x2.horizontal && void 0 !== e2.colIndex || delete
|
|
1453
|
+
return x2.horizontal && void 0 !== e2.colIndex || delete w3.left, x2.vertical && void 0 !== e2.rowIndex || delete w3.top, new Promise((e3, t3) => {
|
|
1486
1454
|
try {
|
|
1487
|
-
yt(
|
|
1455
|
+
yt(w3), e3(w3);
|
|
1488
1456
|
} catch (e4) {
|
|
1489
1457
|
t3(e4);
|
|
1490
1458
|
}
|
|
1491
1459
|
});
|
|
1492
|
-
}, [dt, ut, st,
|
|
1460
|
+
}, [dt, ut, st, we2]), Et = o((e2) => {
|
|
1493
1461
|
const t2 = e2.shiftKey;
|
|
1494
1462
|
e2.preventDefault();
|
|
1495
1463
|
const { deltaX: n2, deltaY: o2, deltaMode: r3 } = e2;
|
|
@@ -1501,19 +1469,19 @@ const Ce = -10, Ie = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
1501
1469
|
1 === r3 && (c3 *= 0), Re2.current = window.requestAnimationFrame(() => {
|
|
1502
1470
|
Re2.current = null, bt(s3 ? { left: i2 } : { top: c3 });
|
|
1503
1471
|
});
|
|
1504
|
-
}, [be2]), Rt =
|
|
1505
|
-
je2.current = null, it.current = null,
|
|
1472
|
+
}, [be2]), Rt = S((e2 = null) => {
|
|
1473
|
+
je2.current = null, it.current = null, $e2();
|
|
1506
1474
|
}, []);
|
|
1507
|
-
|
|
1475
|
+
y(() => {
|
|
1508
1476
|
Rt();
|
|
1509
1477
|
}, [N2]);
|
|
1510
|
-
const Mt =
|
|
1478
|
+
const Mt = f(l2, () => ({ stage: Ie2.current, focus: tt, contains: nt, invalidate: Rt, scrollTo: yt, scrollBy: bt, scrollCellCoordsIntoView: It, getScrollPosition: ot, getDimensions: gt, getViewport: pt, handleWheel: Et, rowCount: a2, columnCount: d2, getLayout: () => Xe2, getRelativePointFromClient: ft, getViewFromClient: xt, getViewFromCellCoords: Ct, getViewFromLocation: wt, onViewChangeOnce: (e2) => {
|
|
1511
1479
|
ct.current.push(e2);
|
|
1512
1480
|
} }), [a2, d2, st]);
|
|
1513
|
-
|
|
1481
|
+
v(() => (ge2 && Mt.current?.addEventListener("wheel", Et, { passive: false }), Ne2.current = true, We2.current = null, () => {
|
|
1514
1482
|
Mt.current?.removeEventListener("wheel", Et);
|
|
1515
|
-
}), [
|
|
1516
|
-
const kt =
|
|
1483
|
+
}), [ge2]);
|
|
1484
|
+
const kt = x([]), Pt = (t2, n2) => {
|
|
1517
1485
|
if (!t2 || !X2) return;
|
|
1518
1486
|
kt.current = [];
|
|
1519
1487
|
n2.push(((t3, o2) => {
|
|
@@ -1522,19 +1490,19 @@ const Ce = -10, Ie = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
1522
1490
|
const i2 = t3.getBounds();
|
|
1523
1491
|
return e("div", { style: { position: "absolute", left: "0px", top: "0px", width: `${i2.width}px`, height: `${i2.height}px`, overflow: "hidden" }, children: l3 }, `overlay-${t3.getAnchor()}-${o2}`);
|
|
1524
1492
|
})(t2, 0));
|
|
1525
|
-
}, Tt =
|
|
1493
|
+
}, Tt = b(() => {
|
|
1526
1494
|
const e2 = {}, t2 = Object.keys(st), n2 = t2.length;
|
|
1527
1495
|
for (let o2 = 0; o2 < n2; o2++) {
|
|
1528
1496
|
const n3 = t2[o2], r3 = [];
|
|
1529
1497
|
Pt(st[n3], r3), e2[n3] = { overlays: r3 };
|
|
1530
1498
|
}
|
|
1531
1499
|
return e2;
|
|
1532
|
-
}, [
|
|
1500
|
+
}, [Oe2, X2, a2, d2, rt, lt]), Dt = (t2, n2, o2, r3, l3, c3, s3) => {
|
|
1533
1501
|
if (!t2) return;
|
|
1534
1502
|
const a3 = t2.getVisibleColumns(), d3 = t2.getVisibleRows();
|
|
1535
1503
|
if (0 === a3.length || 0 === d3.length) return;
|
|
1536
1504
|
let u3 = null;
|
|
1537
|
-
if (
|
|
1505
|
+
if (ie2) u3 = ie2(t2);
|
|
1538
1506
|
else {
|
|
1539
1507
|
u3 = [];
|
|
1540
1508
|
const e2 = d3.length, t3 = a3.length;
|
|
@@ -1542,115 +1510,115 @@ const Ce = -10, Ie = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
1542
1510
|
const e3 = d3[n3];
|
|
1543
1511
|
for (let n4 = 0; n4 < t3; n4++) {
|
|
1544
1512
|
const t4 = { rowIndex: e3, colIndex: a3[n4] };
|
|
1545
|
-
if (
|
|
1546
|
-
const o3 = { coords: t4, range:
|
|
1513
|
+
if (le2?.(t4)) continue;
|
|
1514
|
+
const o3 = { coords: t4, range: we2(t4) };
|
|
1547
1515
|
u3.push(o3);
|
|
1548
1516
|
}
|
|
1549
1517
|
}
|
|
1550
1518
|
}
|
|
1551
|
-
const h3 = t2.getVisibleColumnOffsets(),
|
|
1552
|
-
const l4 = `view:${e2.getAnchor()}:cell:${
|
|
1519
|
+
const h3 = t2.getVisibleColumnOffsets(), g3 = t2.getVisibleRowOffsets(), f2 = t2.getScrollTopLeft(), w3 = t2.getFreezeTopLeft(), x2 = f2.left + w3.left, p2 = f2.top + w3.top, m2 = Math.trunc(x2 / ze), v2 = Math.trunc(p2 / ze), S2 = {}, y2 = (e2, t3, n3, o3, r4) => {
|
|
1520
|
+
const l4 = `view:${e2.getAnchor()}:cell:${ne(t3.rowIndex, t3.colIndex)}`, a4 = o3.x, d4 = o3.y, u4 = Math.trunc((x2 + a4) / ze) - m2, h4 = Math.trunc((p2 + d4) / ze) - v2;
|
|
1553
1521
|
S2[h4] || (S2[h4] = {});
|
|
1554
|
-
let
|
|
1555
|
-
|
|
1556
|
-
let
|
|
1557
|
-
if (!
|
|
1558
|
-
const c4 = (x2 + a4) %
|
|
1559
|
-
|
|
1522
|
+
let g4 = S2[h4][u4];
|
|
1523
|
+
g4 || (g4 = S2[h4][u4] = []);
|
|
1524
|
+
let f3 = c3?.get(l4);
|
|
1525
|
+
if (!f3) {
|
|
1526
|
+
const c4 = (x2 + a4) % ze, s4 = (p2 + d4) % ze;
|
|
1527
|
+
f3 = N2({ key: l4, coords: t3, bounds: o3, zoom: ue2, range: n3, view: e2, value: r4, style: { left: i.boundPixel(c4), top: i.boundPixel(s4), width: i.boundPixel(o3.width, true), height: i.boundPixel(o3.height, true) } });
|
|
1560
1528
|
}
|
|
1561
|
-
s3?.set(l4,
|
|
1562
|
-
},
|
|
1563
|
-
for (let e2 = 0; u3 && e2 <
|
|
1529
|
+
s3?.set(l4, f3), g4.push(f3);
|
|
1530
|
+
}, b2 = u3.length;
|
|
1531
|
+
for (let e2 = 0; u3 && e2 < b2; e2++) {
|
|
1564
1532
|
const n3 = u3[e2], i2 = n3?.coords ?? n3;
|
|
1565
1533
|
if (!i2) continue;
|
|
1566
1534
|
const c4 = n3?.range ?? { rowStart: i2.rowIndex, colStart: i2.colIndex, rowEnd: i2.rowIndex, colEnd: i2.colIndex }, s4 = t2.getVisibleRangeCoords();
|
|
1567
|
-
if (!
|
|
1568
|
-
const a4 = c4 && !
|
|
1569
|
-
if (!a4 &&
|
|
1570
|
-
const d4 = i2.rowIndex,
|
|
1535
|
+
if (!P.isRangesIntersect(c4, s4) && !P.isRangeWithinRange(c4, s4)) continue;
|
|
1536
|
+
const a4 = c4 && !P.isSingleCell(c4);
|
|
1537
|
+
if (!a4 && le2?.(i2)) continue;
|
|
1538
|
+
const d4 = i2.rowIndex, f3 = i2.colIndex, w4 = g3[d4], x3 = h3[f3];
|
|
1571
1539
|
let p3 = null;
|
|
1572
|
-
|
|
1573
|
-
const m3 =
|
|
1540
|
+
w4 && x3 && (p3 = { x: x3.offset, y: w4.offset, width: x3.size, height: w4.size });
|
|
1541
|
+
const m3 = ne(c4.rowStart, c4.colStart);
|
|
1574
1542
|
if (a4) {
|
|
1575
1543
|
if (l3.has(m3)) continue;
|
|
1576
1544
|
l3.add(m3), c4.rowEnd - c4.rowStart > 0 && o2.push(c4), c4.colEnd - c4.colStart > 0 && r3.push(c4);
|
|
1577
1545
|
}
|
|
1578
|
-
if (a4 && (p3 =
|
|
1546
|
+
if (a4 && (p3 = ae(t2.getLayout(), c4)), !p3) {
|
|
1579
1547
|
console.warn("no bounds for cell", m3);
|
|
1580
1548
|
continue;
|
|
1581
1549
|
}
|
|
1582
1550
|
const v3 = n3?.value;
|
|
1583
1551
|
y2(t2, i2, c4, p3, v3);
|
|
1584
1552
|
}
|
|
1585
|
-
const C3 = x2 %
|
|
1586
|
-
for (let o3 = 0; o3 <
|
|
1587
|
-
const r4 =
|
|
1553
|
+
const C3 = x2 % ze, I3 = p2 % ze, E2 = Object.keys(S2), R3 = E2.length;
|
|
1554
|
+
for (let o3 = 0; o3 < R3; o3++) {
|
|
1555
|
+
const r4 = E2[o3], l4 = S2[r4];
|
|
1588
1556
|
if (!l4) continue;
|
|
1589
1557
|
const c4 = Object.keys(l4), s4 = c4.length;
|
|
1590
1558
|
for (let o4 = 0; o4 < s4; o4++) {
|
|
1591
1559
|
const s5 = c4[o4], a4 = l4[s5];
|
|
1592
1560
|
if (!a4) continue;
|
|
1593
|
-
const d4 = parseInt(r4), u4 = parseInt(s5), h4 = d4 + v2,
|
|
1594
|
-
n2.push(e("div", { className: "cell-container", style: { transform: `translate(${i.boundPixel(u4 *
|
|
1561
|
+
const d4 = parseInt(r4), u4 = parseInt(s5), h4 = d4 + v2, g4 = u4 + m2, f3 = `view:${t2.getAnchor()}:segment:${g4}:${h4}`;
|
|
1562
|
+
n2.push(e("div", { className: "cell-container", style: { transform: `translate(${i.boundPixel(u4 * ze - C3, true)}px, ${i.boundPixel(d4 * ze - I3, true)}px)`, willChange: "transform" }, children: a4 }, f3));
|
|
1595
1563
|
}
|
|
1596
1564
|
}
|
|
1597
|
-
}, Ot =
|
|
1565
|
+
}, Ot = b(() => {
|
|
1598
1566
|
const e2 = je2.current, t2 = /* @__PURE__ */ new Map(), n2 = {}, o2 = Object.keys(st), r3 = o2.length;
|
|
1599
1567
|
for (let l3 = 0; l3 < r3; l3++) {
|
|
1600
1568
|
const r4 = o2[l3], i2 = [], c3 = [], s3 = [];
|
|
1601
1569
|
Dt(st[r4], s3, i2, c3, /* @__PURE__ */ new Set(), e2, t2), n2[r4] = { cells: s3, rangesH: i2, rangesV: c3 };
|
|
1602
1570
|
}
|
|
1603
1571
|
return je2.current = t2, n2;
|
|
1604
|
-
}, [
|
|
1572
|
+
}, [Oe2, a2, d2, rt, lt, D2, pe2, F2, le2, ie2, re2, te2, we2]), zt = (t2, n2, o2, r3, l3) => {
|
|
1605
1573
|
if (!t2) return;
|
|
1606
1574
|
const c3 = t2.getLayout(), s3 = window.devicePixelRatio || 1, a3 = String(1 / s3);
|
|
1607
1575
|
if (n2) {
|
|
1608
1576
|
const e2 = `view:${t2.getAnchor()}:hl:`, n3 = t2.getVisibleRows();
|
|
1609
1577
|
if (0 === (n3 ? n3.length : 0)) return;
|
|
1610
|
-
const s4 = l3.sort(
|
|
1611
|
-
let
|
|
1578
|
+
const s4 = l3.sort(P.rowFirstRangeComparator), d3 = t2.getVisibleRangeCoords(), u3 = 0, h3 = Math.min(t2.getBounds().width, c3.getColOffset(d3.colEnd + 1));
|
|
1579
|
+
let g3 = [];
|
|
1612
1580
|
for (let t3 = 0; t3 < n3.length && n3[t3] <= d3.rowEnd; t3++) {
|
|
1613
1581
|
const l4 = n3[t3];
|
|
1614
1582
|
if (l4 < d3.rowStart) continue;
|
|
1615
|
-
let
|
|
1583
|
+
let f2 = false;
|
|
1616
1584
|
for (; s4.length > 0 && s4[0].rowStart <= l4; ) {
|
|
1617
1585
|
const e3 = s4.shift();
|
|
1618
|
-
e3.rowEnd > l4 && (
|
|
1586
|
+
e3.rowEnd > l4 && (g3.push(e3), f2 = true);
|
|
1619
1587
|
}
|
|
1620
|
-
|
|
1621
|
-
const
|
|
1588
|
+
f2 && (g3 = g3.sort(P.columnFirstRangeComparator));
|
|
1589
|
+
const w3 = c3.getRowOffset(l4 + 1);
|
|
1622
1590
|
let x2 = u3;
|
|
1623
|
-
const p2 =
|
|
1591
|
+
const p2 = g3.length;
|
|
1624
1592
|
for (let t4 = 0; t4 < p2 + 1; t4++) {
|
|
1625
1593
|
let n4 = x2, s5 = h3;
|
|
1626
|
-
const d4 =
|
|
1627
|
-
t4 < p2 && (s5 = Math.min(h3, c3.getColOffset(d4.colStart)), x2 = Math.min(h3, c3.getColOffset(d4.colEnd + 1))), r3.push(
|
|
1594
|
+
const d4 = g3[t4];
|
|
1595
|
+
t4 < p2 && (s5 = Math.min(h3, c3.getColOffset(d4.colStart)), x2 = Math.min(h3, c3.getColOffset(d4.colEnd + 1))), r3.push(E("path", { d: `M ${i.boundPixel(n4)} ${i.boundPixel(w3, false, o2)} L ${i.boundPixel(s5)} ${i.boundPixel(w3, false, o2)}`, stroke: L2, strokeWidth: a3, vectorEffect: "non-scaling-stroke", ...$2, key: e2 + l4 + ":" + t4 }));
|
|
1628
1596
|
}
|
|
1629
|
-
for (let e3 = p2 - 1; e3 >= 0; e3--)
|
|
1597
|
+
for (let e3 = p2 - 1; e3 >= 0; e3--) g3[e3].rowEnd <= n3[t3 + 1] && g3.splice(e3, 1);
|
|
1630
1598
|
}
|
|
1631
1599
|
} else {
|
|
1632
1600
|
const n3 = `view:${t2.getAnchor()}:vl:`, s4 = t2.getVisibleColumns(), d3 = s4 ? s4.length : 0;
|
|
1633
1601
|
if (0 === d3) return;
|
|
1634
|
-
const u3 = l3.sort(
|
|
1635
|
-
let
|
|
1602
|
+
const u3 = l3.sort(P.columnFirstRangeComparator), h3 = t2.getVisibleRangeCoords(), g3 = 0, f2 = Math.min(t2.getBounds().height, c3.getRowOffset(h3.rowEnd + 1));
|
|
1603
|
+
let w3 = [];
|
|
1636
1604
|
for (let t3 = 0; t3 < d3 && s4[t3] <= h3.colEnd; t3++) {
|
|
1637
1605
|
const l4 = s4[t3];
|
|
1638
1606
|
if (l4 < h3.colStart) continue;
|
|
1639
1607
|
let d4 = false;
|
|
1640
1608
|
for (; u3.length > 0 && u3[0].colStart <= l4; ) {
|
|
1641
1609
|
const e2 = u3.shift();
|
|
1642
|
-
e2.colEnd > l4 && (
|
|
1610
|
+
e2.colEnd > l4 && (w3.push(e2), d4 = true);
|
|
1643
1611
|
}
|
|
1644
|
-
d4 && (
|
|
1612
|
+
d4 && (w3 = w3.sort(P.rowFirstRangeComparator));
|
|
1645
1613
|
const x2 = c3.getColOffset(l4 + 1);
|
|
1646
|
-
let p2 =
|
|
1647
|
-
const m2 =
|
|
1614
|
+
let p2 = g3;
|
|
1615
|
+
const m2 = w3.length;
|
|
1648
1616
|
for (let t4 = 0; t4 < m2 + 1; t4++) {
|
|
1649
|
-
let s5 = p2, d5 =
|
|
1650
|
-
const u4 =
|
|
1651
|
-
t4 < m2 && (d5 = Math.min(
|
|
1617
|
+
let s5 = p2, d5 = f2;
|
|
1618
|
+
const u4 = w3[t4];
|
|
1619
|
+
t4 < m2 && (d5 = Math.min(f2, c3.getRowOffset(u4.rowStart)), p2 = Math.min(f2, c3.getRowOffset(u4.rowEnd + 1))), r3.push(e("path", { d: `M ${i.boundPixel(x2, false, o2)} ${i.boundPixel(s5)} L ${i.boundPixel(x2, false, o2)} ${i.boundPixel(d5)}`, stroke: L2, strokeWidth: a3, vectorEffect: "non-scaling-stroke", ...B2 }, n3 + l4 + ":" + t4));
|
|
1652
1620
|
}
|
|
1653
|
-
for (let e2 = m2 - 1; e2 >= 0; e2--)
|
|
1621
|
+
for (let e2 = m2 - 1; e2 >= 0; e2--) w3[e2].colEnd <= s4[t3 + 1] && w3.splice(e2, 1);
|
|
1654
1622
|
}
|
|
1655
1623
|
}
|
|
1656
1624
|
}, Lt = (t2) => {
|
|
@@ -1663,7 +1631,7 @@ const Ce = -10, Ie = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
1663
1631
|
n2[o3] = e("svg", { width: `${s3}`, height: `${a3}`, viewBox: `0 0 ${s3} ${a3}`, preserveAspectRatio: "none", shapeRendering: "crispEdges", style: { position: "absolute" }, children: i2 });
|
|
1664
1632
|
}
|
|
1665
1633
|
return n2;
|
|
1666
|
-
}, $t =
|
|
1634
|
+
}, $t = b(() => true === D2 || true === D2?.horizontal ? Lt(true) : null, [Oe2, D2, rt, V2, A2, L2, $2, a2, d2, Qe, dt, st, Ot]), Bt = b(() => true === D2 || true === D2?.vertical ? Lt(false) : null, [Oe2, D2, lt, V2, A2, L2, B2, a2, d2, et, ut, st, Ot]), Ft = b(() => 0 === ht.left ? null : e(he, { linePoints: [0, 0, 0, et + 1], bounds: { x: ht.left, y: 0, width: 1, height: et + 1 }, ...H2 }), [Oe2, ht.left, et, H2]), Wt = b(() => 0 === ht.top ? null : e(he, { linePoints: [0, 0, Qe + 1, 0], bounds: { x: 0, y: ht.top, width: Qe + 1, height: 1 }, ...K2 }), [Oe2, ht.top, Qe, K2]), At = b(() => {
|
|
1667
1635
|
const o2 = [], r3 = (e2) => {
|
|
1668
1636
|
if (!e2 || !st[e2]) return;
|
|
1669
1637
|
const n2 = st[e2].getBounds();
|
|
@@ -1671,7 +1639,7 @@ const Ce = -10, Ie = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
1671
1639
|
}, l3 = at.length;
|
|
1672
1640
|
for (let e2 = 0; e2 < l3; e2++) o2.push(r3(at[e2]));
|
|
1673
1641
|
return e(n, { children: o2 });
|
|
1674
|
-
}, [st, $t, Bt, Ot]), Vt =
|
|
1642
|
+
}, [st, $t, Bt, Ot]), Vt = b(() => {
|
|
1675
1643
|
if (!l2) return;
|
|
1676
1644
|
const e2 = (e3, t2, n3, o3) => {
|
|
1677
1645
|
if (!o3 || 0 === o3.length) return;
|
|
@@ -1679,95 +1647,95 @@ const Ce = -10, Ie = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
|
|
|
1679
1647
|
for (let i3 = 0; i3 < l3; i3++) {
|
|
1680
1648
|
const l4 = o3[i3];
|
|
1681
1649
|
let c4 = e3?.get(l4);
|
|
1682
|
-
c4 !==
|
|
1650
|
+
c4 !== Le && (c4 = l4(n3) ?? Le), t2.set(l4, c4), c4 && c4 !== Le && r4.push(c4);
|
|
1683
1651
|
}
|
|
1684
1652
|
return r4;
|
|
1685
1653
|
}, n2 = (n3, o3, r4) => {
|
|
1686
1654
|
if (!r4) return;
|
|
1687
1655
|
const l3 = r4.getBounds(), i3 = r4.getInsets(), c4 = r4.getAnchor();
|
|
1688
|
-
return t("div", { className:
|
|
1656
|
+
return t("div", { className: k("view", `view-${c4}`, Me.view), style: { position: "absolute", pointerEvents: "none", left: l3.x - i3.left, top: l3.y - i3.top, width: l3.width - (i3.left + i3.right), height: l3.height - (i3.top + i3.bottom), clipPath: _2 ? "inset(-2px)" : "inset(0px)" }, children: [e2(n3, o3, r4, G2), Tt?.[c4].overlays] }, `view:${c4}`);
|
|
1689
1657
|
}, o2 = it.current, r3 = {}, i2 = [], c3 = Object.keys(st), s3 = c3.length;
|
|
1690
1658
|
for (let e3 = 0; e3 < s3; e3++) {
|
|
1691
1659
|
const t2 = c3[e3], l3 = o2?.[t2], s4 = r3[t2] = /* @__PURE__ */ new Map();
|
|
1692
1660
|
i2.push(n2(l3, s4, st[t2]));
|
|
1693
1661
|
}
|
|
1694
1662
|
return it.current = r3, i2;
|
|
1695
|
-
}, [
|
|
1696
|
-
const { style: t2, ...n2 } =
|
|
1697
|
-
return e("div", { style: { width:
|
|
1698
|
-
}, [
|
|
1699
|
-
return
|
|
1663
|
+
}, [Oe2, st, _2, G2]), Ut = b(() => {
|
|
1664
|
+
const { style: t2, ...n2 } = Q2 ?? {};
|
|
1665
|
+
return e("div", { style: { width: Qe, height: et, ...t2 }, className: "sheetxl-stage", tabIndex: 0, ref: Ie2, ...n2, ...me2, children: ee2 ? ee2(At) : At });
|
|
1666
|
+
}, [Qe, et, At, Q2, ee2]), Ht = x(false);
|
|
1667
|
+
return v(() => {
|
|
1700
1668
|
!Ht.current && Ot && (Ht.current = true, Ce2?.(Mt.current));
|
|
1701
|
-
}, [Ot]), t("div", { className:
|
|
1669
|
+
}, [Ot]), t("div", { className: k("sheetxl-grid", Me["sheetxl-grid"]), style: { overflow: "visible", cursor: W2, maxWidth: Qe, maxHeight: et, width: Qe, height: et, ...pe2 }, ref: Mt, children: [Ut, t("div", { className: k("sheetxl-overlays"), ref: Ee2, ...Z2, children: [Vt, Ft, Wt] })] });
|
|
1702
1670
|
}));
|
|
1703
|
-
|
|
1704
|
-
const
|
|
1705
|
-
const { width: o2, height: r2, style: l2 = {}, className: i2, ...c2 } = t2, [s2, { width: a2, height: d2 }] =
|
|
1706
|
-
return e("div", { className: i2, style: { ...l2 }, children: e("div", { style: { position: "relative", top: "0px", left: "0px", width: "100%", height: "100%", maxWidth: "100%", maxHeight: "100%", boxSizing: "content-box" }, ref: s2, children: e(
|
|
1671
|
+
$e.displayName = "BaseGrid";
|
|
1672
|
+
const Be = C(I((t2, n2) => {
|
|
1673
|
+
const { width: o2, height: r2, style: l2 = {}, className: i2, ...c2 } = t2, [s2, { width: a2, height: d2 }] = L();
|
|
1674
|
+
return e("div", { className: i2, style: { ...l2 }, children: e("div", { style: { position: "relative", top: "0px", left: "0px", width: "100%", height: "100%", maxWidth: "100%", maxHeight: "100%", boxSizing: "content-box" }, ref: s2, children: e($e, { ref: n2, width: o2 ?? a2, height: r2 ?? d2, ...c2 }) }) });
|
|
1707
1675
|
}));
|
|
1708
|
-
|
|
1709
|
-
const
|
|
1710
|
-
const { showVerticalScrollbar: o2, showHorizontalScrollbar: r2, createHorizontalScrollbar: l2, createVerticalScrollbar: i2, createScrollCorner: c2, viewport: s2, onScrollViewport: a2, style: d2 = {}, className: u2, onScroll: h2, ...g2 } = t2, [
|
|
1711
|
-
|
|
1712
|
-
const b2 =
|
|
1676
|
+
Be.displayName = "Grid";
|
|
1677
|
+
const Fe = C(I((t2, n2) => {
|
|
1678
|
+
const { showVerticalScrollbar: o2, showHorizontalScrollbar: r2, createHorizontalScrollbar: l2, createVerticalScrollbar: i2, createScrollCorner: c2, viewport: s2, onScrollViewport: a2, style: d2 = {}, className: u2, onScroll: h2, ...g2 } = t2, [f2, p2] = m(null), v2 = x(null), y2 = x(null);
|
|
1679
|
+
M(!s2, "Viewport can not be specified"), R(n2, () => y2.current && v2.current ? Object.assign(y2.current, v2.current) : null);
|
|
1680
|
+
const b2 = S((e2) => {
|
|
1713
1681
|
y2.current?.scrollTo(e2), a2?.(e2);
|
|
1714
1682
|
}, []);
|
|
1715
|
-
return e(
|
|
1683
|
+
return e(w, { className: u2, style: d2, ref: v2, showVerticalScrollbar: o2, showHorizontalScrollbar: r2, createHorizontalScrollbar: l2, createVerticalScrollbar: i2, createScrollCorner: c2, viewport: f2, onScrollViewport: b2, children: e(Be, { style: { width: "100%", height: "100%" }, ...g2, onViewportChange: (e2) => p2(e2), ref: y2 }) });
|
|
1716
1684
|
}));
|
|
1717
|
-
|
|
1718
|
-
const
|
|
1719
|
-
const { index: n2, value: o2, zoom: r2, zoomScale: l2 = 100, headerText: c2 = (e2) => `${e2}`, headerStyle: s2, headerStyleSelect: a2 = s2, headerStyleSelectAll: d2 = a2, headerStyleHover: u2 = d2, verticalPadding: h2 = 0, horizontalPadding: g2 = 0, isSelected: f2 =
|
|
1685
|
+
Fe.displayName = "ScrollableGrid";
|
|
1686
|
+
const We = () => false, Ae = C((t2) => {
|
|
1687
|
+
const { index: n2, value: o2, zoom: r2, zoomScale: l2 = 100, headerText: c2 = (e2) => `${e2}`, headerStyle: s2, headerStyleSelect: a2 = s2, headerStyleSelectAll: d2 = a2, headerStyleHover: u2 = d2, verticalPadding: h2 = 0, horizontalPadding: g2 = 0, isSelected: f2 = We, isSelectedAll: w2 = We, coords: p2, bounds: v2, range: S2, orientation: y2, view: b2, style: C2, ...I2 } = t2, E2 = l2 / 100, R2 = x(null), [M2, k2] = m(false), P2 = f2?.(n2) || false, O2 = w2?.(n2) || false ? d2 : P2 ? a2 : s2;
|
|
1720
1688
|
let z2 = O2;
|
|
1721
1689
|
if (M2) {
|
|
1722
1690
|
let e2 = u2;
|
|
1723
|
-
"function" == typeof u2 && (e2 = u2(O2)), z2 =
|
|
1691
|
+
"function" == typeof u2 && (e2 = u2(O2)), z2 = T.mergeContentful(O2, e2);
|
|
1724
1692
|
}
|
|
1725
|
-
return e("div", { ref: R2, style: { background: z2.fill, color: z2.text?.fill, fontFamily: z2.text?.fontFamily ?? s2.text?.fontFamily, fontSize: 96 * (z2.text?.fontSize ?? 11) / 72 * E2, fontStyle: z2.text?.fontStyle, fontWeight: z2.text?.fontWeight, lineHeight: 1.2, display: "flex", justifyContent: "center", alignItems: "end", pointerEvents: "auto", paddingBottom: `${E2}px`, ...C2, left: C2.left - (y2 ===
|
|
1693
|
+
return e("div", { ref: R2, style: { background: z2.fill, color: z2.text?.fill, fontFamily: z2.text?.fontFamily ?? s2.text?.fontFamily, fontSize: 96 * (z2.text?.fontSize ?? 11) / 72 * E2, fontStyle: z2.text?.fontStyle, fontWeight: z2.text?.fontWeight, lineHeight: 1.2, display: "flex", justifyContent: "center", alignItems: "end", pointerEvents: "auto", paddingBottom: `${E2}px`, ...C2, left: C2.left - (y2 === D.Column ? 1 : 0), top: C2.top - (y2 === D.Row ? 1 : 0), width: C2.width + 1, height: C2.height + 1, overflow: "hidden" }, ...I2, onMouseMove: (e2) => {
|
|
1726
1694
|
"touch" !== i.detectIt().primaryInput && 0 === e2.buttons && k2(true);
|
|
1727
1695
|
}, onMouseOut: (e2) => {
|
|
1728
1696
|
k2(false);
|
|
1729
1697
|
}, children: c2(n2) });
|
|
1730
1698
|
});
|
|
1731
|
-
|
|
1732
|
-
const
|
|
1733
|
-
const { orientation: r2, view: l2, index: c2, className: s2, style: a2, disabled: d2 = false, disabledResize: u2 = false, isNextHidden: h2, isHidden: g2, isSelected: f2, isSelectedAll: w2, showTouchDivider: x2, headerStyle: p2, headerStyleSelect: m2, headerStyleSelectAll: v2, headerStyleHover: S2, bounds: y2, onPointerDown: b2, onAutoFit: C2, ...I2 } = n2, E2 = r2 ===
|
|
1699
|
+
Ae.displayName = "HeaderRenderer";
|
|
1700
|
+
const Ve = "ew-resize", Ue = "ns-resize", He = C(I((n2, o2) => {
|
|
1701
|
+
const { orientation: r2, view: l2, index: c2, className: s2, style: a2, disabled: d2 = false, disabledResize: u2 = false, isNextHidden: h2, isHidden: g2, isSelected: f2, isSelectedAll: w2, showTouchDivider: x2, headerStyle: p2, headerStyleSelect: m2, headerStyleSelectAll: v2, headerStyleHover: S2, bounds: y2, onPointerDown: b2, onAutoFit: C2, ...I2 } = n2, E2 = r2 === D.Column;
|
|
1734
1702
|
let R2 = p2;
|
|
1735
1703
|
f2 && m2 && (R2 = m2), w2 && v2 && (R2 = v2);
|
|
1736
|
-
const
|
|
1737
|
-
let P2 = E2 ? 14 : 8,
|
|
1738
|
-
h2 && (O2 = -2), g2 && (O2 = 2), g2 && (P2 = P2 / 2 + O2,
|
|
1704
|
+
const M2 = "touch" === i.detectIt().primaryInput;
|
|
1705
|
+
let P2 = E2 ? 14 : 8, T2 = P2 / 2, O2 = 0;
|
|
1706
|
+
h2 && (O2 = -2), g2 && (O2 = 2), g2 && (P2 = P2 / 2 + O2, T2 = 2 * O2);
|
|
1739
1707
|
let z2 = R2.dividerStrokeFill ?? R2.strokeFill;
|
|
1740
|
-
return !(f2 || w2) && 0 === O2 && (z2 = `linear-gradient(${E2 ? 180 : 90}deg, ${R2.fill}, ${z2} 55%, ${z2} 100%)`), t("div", { className:
|
|
1741
|
-
})),
|
|
1742
|
-
const { orientation: i2, view: c2, index: a2, disabled:
|
|
1743
|
-
let P2 =
|
|
1744
|
-
P2.length > 0 && (
|
|
1745
|
-
const O2 =
|
|
1746
|
-
if (E2?.(e2), !
|
|
1747
|
-
const e3 =
|
|
1748
|
-
O2.current = { isResizing: false, startSize: t2, index: a2, view: c2, orientation: i2, onDividerMouseDown:
|
|
1708
|
+
return !(f2 || w2) && 0 === O2 && (z2 = `linear-gradient(${E2 ? 180 : 90}deg, ${R2.fill}, ${z2} 55%, ${z2} 100%)`), t("div", { className: k("header-divider", { disabled: d2 }, s2, `index-${c2}`), ref: o2, onPointerDown: M2 ? void 0 : b2, onDoubleClick: M2 ? void 0 : () => C2?.(), style: { top: (E2 ? 0 : -P2 / 2 + (O2 - 1)) + "px", left: (E2 ? -P2 / 2 + (O2 - 1) : 0) + "px", width: E2 ? P2 : "calc(100% + 1px)", height: E2 ? "calc(100% + 1px)" : P2, position: "absolute", overflow: "visible", pointerEvents: "all", cursor: d2 || u2 || M2 ? void 0 : E2 ? Ve : Ue, ...a2 }, ...I2, children: [e("div", { style: { position: "relative", top: `${E2 ? 0 : T2}px`, left: `${E2 ? T2 : 0}px`, width: E2 ? 1 : "100%", height: E2 ? "100%" : 1, background: z2 }, onDoubleClick: () => C2?.() }), x2 && M2 ? e("div", { style: { position: "absolute", cursor: "grab", zIndex: 1, borderRadius: "4px", right: E2 ? "-6px" : "2px", bottom: E2 ? "2px" : "-9px", height: "24px", width: E2 ? "24px" : "18px", maxHeight: E2 ? "calc(100% - 4px)" : void 0, maxWidth: E2 ? void 0 : "calc(100% - 4px)", background: R2.fill, border: `${v2.edgeStrokeFill} solid 1px`, boxShadow: `0.5px 0.5px 0px 0px ${p2.text.fill}`, display: "flex", alignItems: "center", justifyContent: "center" }, onPointerDown: b2, children: e("div", { style: { width: "6.4px", height: "12px", backgroundImage: `url("data:image/svg+xml,%3Csvg width='6.4' height='12' viewBox='0 0 9.6 16' version='1.1' fill='${encodeURIComponent(m2.text.fill)}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='M 9.60008,14.40009 C 9.60008,15.28374 8.88368,16 8.00003,16 7.11639,16 6.40012,15.28374 6.40012,14.40009 c 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40012 c 0,0.88364 -0.7164,1.60004 -1.60005,1.60004 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60004 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40006 c 0,0.88365 -0.7164,1.60005 -1.60005,1.60005 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60005 C 6.40012,0.71626 7.11639,0 8.00003,0 8.88368,0 9.60008,0.71626 9.60008,1.59991 M 3.19996,14.40009 C 3.19996,15.28374 2.48369,16 1.60005,16 0.7164,16 0,15.28374 0,14.40009 c 0,-0.88365 0.7164,-1.60005 1.60005,-1.60005 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40012 c 0,0.88364 -0.71627,1.60004 -1.59991,1.60004 C 0.7164,9.60001 0,8.88361 0,7.99997 0,7.11632 0.7164,6.39992 1.60005,6.39992 c 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40006 c 0,0.88365 -0.71627,1.60005 -1.59991,1.60005 C 0.7164,3.19996 0,2.48356 0,1.59991 0,0.71626 0.7164,0 1.60005,0 2.48369,0 3.19996,0.71626 3.19996,1.59991' /%3E%3C/svg%3E%0A")`, backgroundRepeat: "no-repeat", backgroundPosition: "center", transform: E2 ? void 0 : "rotate(90deg)" } }) }) : null] });
|
|
1709
|
+
})), Ke = (t2, n2) => e(He, { ...t2, ref: n2 }), Ne = C(I((r2, l2) => {
|
|
1710
|
+
const { orientation: i2, view: c2, index: a2, disabled: d2 = false, disabledResize: h2 = false, resizeThreshold: g2 = 1, dividerRenderer: f2 = Ke, onDividerMouseDown: w2, onDividerResizeStart: p2, onDividerResize: v2, onDividerResizeEnd: S2, onDividerMouseUp: y2, onDividerAutoFit: b2, onPointerDown: C2, ...I2 } = r2, E2 = o(C2, [C2]), R2 = o(b2, [b2]), M2 = i2 === D.Column;
|
|
1711
|
+
let P2 = M2 ? c2.getVisibleColumns() : c2.getVisibleRows(), T2 = null;
|
|
1712
|
+
P2.length > 0 && (M2 ? T2 = c2.getRangeCoordsBounds({ rowStart: 0, rowEnd: 0, colStart: P2[0], colEnd: P2[P2.length - 1] }) : c2.getRangeCoordsBounds({ rowStart: P2[0], rowEnd: P2[P2.length - 1], colStart: 0, colEnd: 0 }), T2 = c2.toClipBounds(T2, ve));
|
|
1713
|
+
const O2 = x(null), [z2, L2] = m(null), B2 = (e2, t2) => M2 ? e2.clientX - t2.clientX : e2.clientY - t2.clientY, F2 = c2.getLayout(), W2 = M2 ? F2.getColOffset(a2 + 1) : F2.getRowOffset(a2 + 1), A2 = s({ processTouch: true, onPointerDown: (e2) => {
|
|
1714
|
+
if (E2?.(e2), !d2 && !h2) {
|
|
1715
|
+
const e3 = M2 ? F2.getColOffset(a2) : F2.getRowOffset(a2), t2 = W2 - e3;
|
|
1716
|
+
O2.current = { isResizing: false, startSize: t2, index: a2, view: c2, orientation: i2, onDividerMouseDown: w2, onDividerResizeStart: p2, onDividerResize: v2, onDividerResizeEnd: S2, onDividerMouseUp: y2 }, L2(O2.current), w2?.(a2, t2);
|
|
1749
1717
|
}
|
|
1750
1718
|
e2.stopPropagation(), e2.preventDefault();
|
|
1751
1719
|
}, onPointerUp: (e2, t2, n2) => {
|
|
1752
1720
|
if (!O2.current) return;
|
|
1753
1721
|
O2.current.isResizing && O2.current.onDividerResizeEnd?.(O2.current.index, Math.max(0, O2.current.startSize + B2(e2, n2)), O2.current.startSize);
|
|
1754
1722
|
const o2 = O2.current;
|
|
1755
|
-
O2.current = null,
|
|
1723
|
+
O2.current = null, L2(O2.current), o2.onDividerMouseUp?.(o2.index);
|
|
1756
1724
|
}, onPointerMoveOrWait: (e2, t2, n2) => {
|
|
1757
1725
|
if (!O2.current) return;
|
|
1758
1726
|
const o2 = B2(e2, n2);
|
|
1759
|
-
O2.current.isResizing ? O2.current.onDividerResize?.(O2.current.index, Math.max(0, O2.current.startSize + o2), O2.current.startSize) : Math.abs(o2) > Math.max(1, g2) && (O2.current = { ...O2.current, isResizing: true },
|
|
1727
|
+
O2.current.isResizing ? O2.current.onDividerResize?.(O2.current.index, Math.max(0, O2.current.startSize + o2), O2.current.startSize) : Math.abs(o2) > Math.max(1, g2) && (O2.current = { ...O2.current, isResizing: true }, L2(O2.current), O2.current.onDividerResizeStart?.(O2.current.index, Math.max(0, O2.current.startSize + o2))), e2.stopPropagation(), e2.preventDefault();
|
|
1760
1728
|
} }), V2 = o(() => {
|
|
1761
1729
|
R2?.(a2);
|
|
1762
1730
|
}, [a2]);
|
|
1763
|
-
if (!
|
|
1764
|
-
const U2 = f2({ bounds:
|
|
1731
|
+
if (!T2) return;
|
|
1732
|
+
const U2 = f2({ bounds: T2, orientation: i2, view: c2, index: a2, disabled: d2, disabledResize: h2, onAutoFit: V2, onPointerDown: A2, ...I2 }, l2);
|
|
1765
1733
|
if (!U2) return;
|
|
1766
|
-
const { getPortalContainer: H2 } =
|
|
1734
|
+
const { getPortalContainer: H2 } = u();
|
|
1767
1735
|
let K2 = null;
|
|
1768
|
-
return z2 && z2.isResizing && z2.index === a2 && (K2 =
|
|
1736
|
+
return z2 && z2.isResizing && z2.index === a2 && (K2 = $(e("div", { style: { position: "absolute", cursor: M2 ? Ve : Ue, left: 0, top: 0, width: "100%", height: "100%" } }), H2(), "divider:" + a2)), t(n, { children: [K2, e("div", { className: k("header-divider-anchor"), style: { position: "absolute", pointerEvents: "auto", top: `${M2 ? T2.y : W2}px`, left: `${M2 ? W2 : T2.x}px`, width: (M2 ? 0 : T2.width - 1) + "px", height: (M2 ? T2.height - 1 : 0) + "px", display: "flex" }, tabIndex: -1, children: U2 })] });
|
|
1769
1737
|
}));
|
|
1770
|
-
class
|
|
1738
|
+
class qe {
|
|
1771
1739
|
naturalDimensions(e2, t2 = {}) {
|
|
1772
1740
|
const n2 = document.createElement("div");
|
|
1773
1741
|
let o2 = t2?.lineHeight ?? "1";
|
|
@@ -1784,21 +1752,21 @@ class Ge {
|
|
|
1784
1752
|
return r2.remove(), { width: i2.width, height: i2.height, maxLineHeight: 1.2 * (t2.paintableText?.fontSize || 1056 / 72) };
|
|
1785
1753
|
}
|
|
1786
1754
|
}
|
|
1787
|
-
const
|
|
1788
|
-
const { editState: r2 =
|
|
1789
|
-
|
|
1755
|
+
const je = (e2 = void 0) => Object.freeze({ clean: e2, dirty: void 0, editMode: false }), Xe = je(), Ye = C(I((t2, n2) => {
|
|
1756
|
+
const { editState: r2 = Xe, defaultTextStyle: i2, onStartEdit: c2, onChangeEdit: s2, onSubmitEdit: a2, onCancelEdit: d2, onDoneEdit: u2, containerBounds: h2, setNaturalSize: g2, onNavigate: w2, textProperties: p2, style: C2, autoFocus: I2, ...E2 } = t2, R2 = x(null), { width: M2 = 0 } = h2 ?? {}, [k2, P2] = m(() => r2);
|
|
1757
|
+
v(() => {
|
|
1790
1758
|
P2(r2);
|
|
1791
1759
|
}, [r2]);
|
|
1792
|
-
const T2 =
|
|
1760
|
+
const T2 = p2?.align || "left", D2 = p2?.vAlign || "middle", z2 = p2?.fill || "#040404", L2 = p2?.wrap || "wrap", $2 = p2?.fontFamily || "Calibri", B2 = p2?.fontSize || 11, F2 = p2?.fontWeight || 400, W2 = p2?.fontStyle || "normal", A2 = k2.dirty ?? k2.clean ?? "";
|
|
1793
1761
|
let V2 = 2;
|
|
1794
|
-
const
|
|
1795
|
-
"right" ===
|
|
1796
|
-
const N2 =
|
|
1797
|
-
|
|
1762
|
+
const U2 = 96 * B2 / 72, K2 = 1.2 * U2;
|
|
1763
|
+
"right" === D2 && (V2 += 1);
|
|
1764
|
+
const N2 = b(() => new qe().naturalDimensions(A2, { maxWidth: "wrap" === L2 ? M2 - V2 : void 0, lineHeight: `${K2}px`, paintableText: { fontStyle: W2, wrap: L2, letterSpacing: -0.25 } }), [A2, L2, V2, U2, $2, F2, W2, g2, M2]), q2 = S(() => N2.maxLineHeight ? N2.maxLineHeight + "px" : "1.2", [N2]), [j2, X2] = m(q2);
|
|
1765
|
+
y(() => {
|
|
1798
1766
|
X2(q2());
|
|
1799
|
-
}, [h2, N2]),
|
|
1800
|
-
|
|
1801
|
-
}, [N2,
|
|
1767
|
+
}, [h2, N2]), y(() => {
|
|
1768
|
+
g2?.({ width: "wrap" === L2 ? void 0 : N2.width + V2, height: N2.height });
|
|
1769
|
+
}, [N2, g2]);
|
|
1802
1770
|
const Y2 = o(s2, [s2]), G2 = o((e2) => {
|
|
1803
1771
|
if (k2.dirty === e2) return;
|
|
1804
1772
|
const t3 = { ...k2 };
|
|
@@ -1817,36 +1785,36 @@ const Ze = (e2 = void 0) => Object.freeze({ clean: e2, dirty: void 0, editMode:
|
|
|
1817
1785
|
P2(r2), d2?.(), u2?.();
|
|
1818
1786
|
}, [d2, r2]), Q2 = o((e2) => {
|
|
1819
1787
|
if (!R2.current) return;
|
|
1820
|
-
if (e2.isDefaultPrevented(), !(e2.isTrusted || e2.nativeEvent.ctrlKey || e2.nativeEvent.metaKey || e2.nativeEvent.altKey || e2.nativeEvent.isComposing) && -1 !==
|
|
1788
|
+
if (e2.isDefaultPrevented(), !(e2.isTrusted || e2.nativeEvent.ctrlKey || e2.nativeEvent.metaKey || e2.nativeEvent.altKey || e2.nativeEvent.isComposing) && -1 !== H.indexOf(e2.nativeEvent.key)) {
|
|
1821
1789
|
const t4 = { ...k2 };
|
|
1822
1790
|
return t4.dirty = "Backspace" === e2.nativeEvent.key ? "" : (t4.dirty ?? "") + e2.key, P2(t4), Y2?.(t4), void e2.preventDefault();
|
|
1823
1791
|
}
|
|
1824
1792
|
const t3 = e2.nativeEvent.shiftKey;
|
|
1825
1793
|
if (e2.which === l.Escape) return e2.preventDefault(), void J2();
|
|
1826
1794
|
if (e2.which === l.F2) return Z2(true), void e2.preventDefault();
|
|
1827
|
-
if (e2.which === l.Enter && (e2.preventDefault(), _2() &&
|
|
1795
|
+
if (e2.which === l.Enter && (e2.preventDefault(), _2() && w2?.(t3 ? O.Up : O.Down)), e2.which === l.Tab) return e2.preventDefault(), void (_2() && w2?.(t3 ? O.Left : O.Right));
|
|
1828
1796
|
if (!k2.editMode) {
|
|
1829
1797
|
let t4 = null;
|
|
1830
1798
|
switch (e2.which) {
|
|
1831
1799
|
case l.Left:
|
|
1832
|
-
t4 =
|
|
1800
|
+
t4 = O.Left;
|
|
1833
1801
|
break;
|
|
1834
1802
|
case l.Right:
|
|
1835
|
-
t4 =
|
|
1803
|
+
t4 = O.Right;
|
|
1836
1804
|
break;
|
|
1837
1805
|
case l.Up:
|
|
1838
|
-
t4 =
|
|
1806
|
+
t4 = O.Up;
|
|
1839
1807
|
break;
|
|
1840
1808
|
case l.Down:
|
|
1841
|
-
t4 =
|
|
1809
|
+
t4 = O.Down;
|
|
1842
1810
|
}
|
|
1843
1811
|
if (t4) return void _2();
|
|
1844
1812
|
}
|
|
1845
|
-
}, [k2,
|
|
1846
|
-
|
|
1813
|
+
}, [k2, w2]), [ee2, te2] = m(!I2);
|
|
1814
|
+
v(() => {
|
|
1847
1815
|
te2(false);
|
|
1848
1816
|
}, []);
|
|
1849
|
-
const ne2 =
|
|
1817
|
+
const ne2 = f(n2, () => ({ startEdit(e2) {
|
|
1850
1818
|
let t3 = e2?.initialSelection;
|
|
1851
1819
|
if (!t3) {
|
|
1852
1820
|
const e3 = R2.current.value.length ?? 0;
|
|
@@ -1860,40 +1828,39 @@ const Ze = (e2 = void 0) => Object.freeze({ clean: e2, dirty: void 0, editMode:
|
|
|
1860
1828
|
}, autoFocus() {
|
|
1861
1829
|
R2.current?.focus();
|
|
1862
1830
|
}, getLineHeight: () => N2?.maxLineHeight ?? K2, dispatchEvent: (e2) => R2.current.dispatchEvent(e2) }), [r2, c2]);
|
|
1863
|
-
return e("div", { ref: ne2, ...E2, style: { background: "transparent", display: "flex", flexGrow: 1, alignSelf: "center", height: N2.height, maxWidth: "100%", maxHeight: "100%", ...C2 }, children: e("textarea", { spellCheck: "false", ref: R2, value:
|
|
1831
|
+
return e("div", { ref: ne2, ...E2, style: { background: "transparent", display: "flex", flexGrow: 1, alignSelf: "center", height: N2.height, maxWidth: "100%", maxHeight: "100%", ...C2 }, children: e("textarea", { spellCheck: "false", ref: R2, value: A2, autoFocus: false, disabled: ee2, name: "cell-editor", autoComplete: "off", autoCapitalize: "off", style: { flex: "1 1 100%", position: "relative", fontSize: `${U2}px`, fontFamily: `${$2}`, fontWeight: `${F2}`, fontStyle: `${W2}`, padding: "0px", marginRight: "right" === T2 ? "3px" : "0px", marginLeft: "left" === T2 ? "2px" : "0px", lineHeight: j2, height: N2.height, textRendering: "geometricPrecision", letterSpacing: "-0.25px", boxSizing: "border-box", borderWidth: 0, outline: "none", resize: "none", overflow: "hidden", verticalAlign: "baseline", textAlign: T2, background: "transparent", color: z2, marginBottom: "0px", userSelect: "text", maxHeight: "100%", whiteSpace: "wrap" === L2 ? "break-spaces" : "pre", wordWrap: "break-word" }, onChange: (e2) => {
|
|
1864
1832
|
G2(e2.target.value);
|
|
1865
1833
|
}, onDoubleClick: (e2) => {
|
|
1866
1834
|
e2.isTrusted;
|
|
1867
1835
|
}, onMouseDown: (e2) => {
|
|
1868
1836
|
Z2(true);
|
|
1869
1837
|
}, onKeyDown: Q2 }) });
|
|
1870
|
-
})),
|
|
1838
|
+
})), Ge = C((t2) => {
|
|
1871
1839
|
const { value: n2, view: o2, bounds: r2, range: l2, zoom: i2, children: c2, style: s2, ...a2 } = t2;
|
|
1872
1840
|
return e("div", { style: { padding: "2px 4px", fontFamily: "Calibri", letterSpacing: -0.25, lineHeight: 1.2, fontSize: s2?.fontSize || 1056 / 72, ...s2 }, ...a2, children: n2 });
|
|
1873
1841
|
});
|
|
1874
1842
|
export {
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
Te as useSelection
|
|
1843
|
+
$e as BaseGrid,
|
|
1844
|
+
Ye as DefaultCellEditor,
|
|
1845
|
+
Ge as DefaultCellRenderer,
|
|
1846
|
+
He as DefaultHeaderDivider,
|
|
1847
|
+
xe as FillHandle,
|
|
1848
|
+
Be as Grid,
|
|
1849
|
+
Ne as HeaderDivider,
|
|
1850
|
+
Ae as HeaderRenderer,
|
|
1851
|
+
Oe as RESET_SCROLL_EVENTS_DEBOUNCE_INTERVAL,
|
|
1852
|
+
ve as SELECTION_CLIP_INSETS,
|
|
1853
|
+
H as STANDARD_KEY_CHARS,
|
|
1854
|
+
he as SVGLine,
|
|
1855
|
+
ge as SVGRect,
|
|
1856
|
+
Fe as ScrollableGrid,
|
|
1857
|
+
we as Selection,
|
|
1858
|
+
me as TouchSelectHandle,
|
|
1859
|
+
fe as defaultSelectionRenderer,
|
|
1860
|
+
je as getDefaultStringEditState,
|
|
1861
|
+
Ce as safeSelectionCoords,
|
|
1862
|
+
U as useCellLayout,
|
|
1863
|
+
Z as useHeaderSelection,
|
|
1864
|
+
Y as useKeyboardEditorOverlay,
|
|
1865
|
+
Re as useSelection
|
|
1899
1866
|
};
|