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