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