@gridsheet/react-core 3.0.2 → 3.0.4
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/dist/components/Cell.d.ts.map +1 -1
- package/dist/components/CellStateOverlay.d.ts.map +1 -1
- package/dist/components/GridSheet.d.ts.map +1 -1
- package/dist/components/HeaderCellLeft.d.ts.map +1 -1
- package/dist/components/HeaderCellTop.d.ts.map +1 -1
- package/dist/index.js +1061 -1042
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { calcSideStyle as Vn, clampPopup as Jt, clampLeft as qn, zoneToArea as
|
|
2
|
-
import { BaseFunction as Ir, BaseFunctionAsync as Fr, DEFAULT_HISTORY_LIMIT as Yr, FormulaError as $r, FormulaParser as Pr, Lexer as Xr, Pending as Or, PercentagePolicyMixin as Hr, Policy as Lr, RangeEntity as Br, RefEntity as Kr, Registry as Zr, Sheet as Ur, Spilling as zr, ThousandSeparatorPolicyMixin as Wr, Time as _r, ValueEntity as jr, a2p as Vr, aa2oa as qr, addressesToAreas as Gr, addressesToCols as Qr, addressesToRows as Jr, areaToRange as eo, areaToZone as to, buildInitialCells as no, buildInitialCellsFromOrigin as so, c2x as ro, ch as oo, check as io, conditionArg as lo, createBook as ao, createBooleanMask as co, createRegistry as uo, eachMatrix as go, ensureBoolean as ho, ensureDate as fo, ensureNumber as mo, ensureString as po, matrixShape as yo, oa2aa as vo, operations as bo, p2a as wo, r2y as Ro, rh as Co, stripMatrix as So, toCellCols as No, toCellMatrix as
|
|
1
|
+
import { calcSideStyle as Vn, clampPopup as Jt, clampLeft as qn, zoneToArea as ge, focus as L, Lexer as qe, getFunctionHelps as $t, expandInput as Gn, y2r as ve, x2c as me, resetInput as Qn, handleFormulaQuoteAutoClose as en, areaToZone as Ge, insertTextAtCursor as tn, operations as H, isRefInsertable as nn, COLOR_PALETTE as De, DEFAULT_WIDTH as yt, DEFAULT_HEIGHT as vt, between as Te, makeSequence as Pt, p2a as Ne, MIN_HEIGHT as Xt, MIN_WIDTH as Ot, zoneShape as ne, getLabel as bt, FormulaError as Jn, Pending as es, insertRef as Me, areaToRange as sn, calcBelowPosition as ts, hAlignTransform as ns, among as ss, getAreaInTabular as Ht, isFocus as rs, Autofill as os, getCellRectPositions as Ie, a2p as wt, virtualize as Lt, stripAddressAbsolute as is, stripSheetName as ls, preventSafariBounce as as, smartScroll as cs, isZoneNotSelected as us, Sheet as ds, embedStyle as gs, getMaxSizesFromCells as rn, HEADER_HEIGHT as hs, DEFAULT_ROW_KEY as fs, SHEET_HEIGHT as Bt, HEADER_WIDTH as ms, DEFAULT_COL_KEY as ps, SHEET_WIDTH as Kt } from "@gridsheet/core";
|
|
2
|
+
import { BaseFunction as Ir, BaseFunctionAsync as Fr, DEFAULT_HISTORY_LIMIT as Yr, FormulaError as $r, FormulaParser as Pr, Lexer as Xr, Pending as Or, PercentagePolicyMixin as Hr, Policy as Lr, RangeEntity as Br, RefEntity as Kr, Registry as Zr, Sheet as Ur, Spilling as zr, ThousandSeparatorPolicyMixin as Wr, Time as _r, ValueEntity as jr, a2p as Vr, aa2oa as qr, addressesToAreas as Gr, addressesToCols as Qr, addressesToRows as Jr, areaToRange as eo, areaToZone as to, buildInitialCells as no, buildInitialCellsFromOrigin as so, c2x as ro, ch as oo, check as io, conditionArg as lo, createBook as ao, createBooleanMask as co, createRegistry as uo, eachMatrix as go, ensureBoolean as ho, ensureDate as fo, ensureNumber as mo, ensureString as po, matrixShape as yo, oa2aa as vo, operations as bo, p2a as wo, r2y as Ro, rh as Co, stripMatrix as So, toCellCols as No, toCellMatrix as xo, toCellObject as Eo, toCellRows as ko, toValueCols as To, toValueMatrix as Ao, toValueObject as Mo, toValueRows as Do, x2c as Io, y2r as Fo, zoneToArea as Yo } from "@gridsheet/core";
|
|
3
3
|
import { jsxs as F, jsx as c, Fragment as we } from "react/jsx-runtime";
|
|
4
|
-
import lt, { createContext as on, useRef as
|
|
5
|
-
import { u as vs, s as
|
|
4
|
+
import lt, { createContext as on, useRef as ie, useContext as le, useLayoutEffect as at, useState as te, useMemo as Ye, useCallback as A, memo as tt, useEffect as z, createRef as ln, useReducer as ys } from "react";
|
|
5
|
+
import { u as vs, s as de, w as Ze, a as oe, b as Ue, r as ct, c as an, d as cn, e as $e, f as un, g as dn, h as be, i as _e, j as bs, k as Zt, l as ut, p as dt, m as Qe, n as Se, o as gt, q as ht, t as Fe, v as Rt, x as gn, y as hn, z as fn, A as mn, B as pn, C as yn, D as ze, E as Je, F as ft, G as nt, H as ws, I as Pe, J as fe, K as Ee, L as vn, M as Ke, N as Ut, O as bn, P as zt, Q as Wt, R as Rs, S as Cs, T as _t, U as Ss, V as Ns } from "./hooks-Y7BI_RNj.mjs";
|
|
6
6
|
import { W as Po } from "./hooks-Y7BI_RNj.mjs";
|
|
7
7
|
import { createPortal as Ct } from "react-dom";
|
|
8
|
-
const
|
|
8
|
+
const ae = on(
|
|
9
9
|
{}
|
|
10
10
|
), St = ({
|
|
11
11
|
option: e,
|
|
@@ -14,7 +14,7 @@ const le = on(
|
|
|
14
14
|
top: s,
|
|
15
15
|
left: r
|
|
16
16
|
}) => {
|
|
17
|
-
const o =
|
|
17
|
+
const o = ie(null), i = ie(null), { store: h } = le(ae), f = !h.editorHovering;
|
|
18
18
|
return at(() => {
|
|
19
19
|
const a = i.current;
|
|
20
20
|
a && Vn(a);
|
|
@@ -35,7 +35,7 @@ const le = on(
|
|
|
35
35
|
e.isFunction && /* @__PURE__ */ F(we, { children: [
|
|
36
36
|
/* @__PURE__ */ c("div", { className: "gs-fn-guide1-example", children: e.example }),
|
|
37
37
|
e.description && /* @__PURE__ */ c("div", { className: "gs-fn-guide1-desc", style: { whiteSpace: "pre-line" }, children: e.description }),
|
|
38
|
-
e.defs && e.defs.length > 0 && /* @__PURE__ */ c("div", { className: "gs-fn-guide1-args", children: e.defs.map((a,
|
|
38
|
+
e.defs && e.defs.length > 0 && /* @__PURE__ */ c("div", { className: "gs-fn-guide1-args", children: e.defs.map((a, d) => {
|
|
39
39
|
var w;
|
|
40
40
|
return /* @__PURE__ */ F("div", { className: "gs-fn-guide1-arg", children: [
|
|
41
41
|
/* @__PURE__ */ c("span", { className: "gs-fn-guide1-arg-name", children: a.name }),
|
|
@@ -46,7 +46,7 @@ const le = on(
|
|
|
46
46
|
" — ",
|
|
47
47
|
a.description
|
|
48
48
|
] })
|
|
49
|
-
] },
|
|
49
|
+
] }, d);
|
|
50
50
|
}) })
|
|
51
51
|
] })
|
|
52
52
|
]
|
|
@@ -61,46 +61,46 @@ const le = on(
|
|
|
61
61
|
n.category && /* @__PURE__ */ c("span", { className: `gs-fn-guide-category gs-fn-guide-category-${n.category}`, children: n.category }),
|
|
62
62
|
/* @__PURE__ */ c("div", { className: "gs-fn-guide2-name", children: n.example }),
|
|
63
63
|
/* @__PURE__ */ c("div", { className: "gs-fn-guide2-args-inline", children: (() => {
|
|
64
|
-
const a = n.defs ?? [],
|
|
65
|
-
return a.map((b,
|
|
64
|
+
const a = n.defs ?? [], d = a.filter((b) => b.variadic).length, w = a.length - d;
|
|
65
|
+
return a.map((b, g) => {
|
|
66
66
|
let m;
|
|
67
67
|
if (t < w)
|
|
68
|
-
m = t ===
|
|
69
|
-
else if (
|
|
70
|
-
const y = (t - w) %
|
|
71
|
-
m =
|
|
68
|
+
m = t === g;
|
|
69
|
+
else if (d > 0 && g >= w) {
|
|
70
|
+
const y = (t - w) % d;
|
|
71
|
+
m = g === w + y;
|
|
72
72
|
} else
|
|
73
73
|
m = !1;
|
|
74
74
|
return /* @__PURE__ */ F(lt.Fragment, { children: [
|
|
75
|
-
|
|
75
|
+
g > 0 ? ", " : "",
|
|
76
76
|
/* @__PURE__ */ F("span", { className: m ? "gs-active-arg" : "", children: [
|
|
77
77
|
b.optional ? "[" : "",
|
|
78
78
|
b.name,
|
|
79
79
|
b.variadic ? ", ..." : "",
|
|
80
80
|
b.optional ? "]" : ""
|
|
81
81
|
] })
|
|
82
|
-
] },
|
|
82
|
+
] }, g);
|
|
83
83
|
});
|
|
84
84
|
})() }),
|
|
85
85
|
(() => {
|
|
86
86
|
var m;
|
|
87
|
-
const a = n.defs ?? [],
|
|
87
|
+
const a = n.defs ?? [], d = a.filter((y) => y.variadic).length, w = a.length - d;
|
|
88
88
|
let b;
|
|
89
|
-
if (t < w ||
|
|
89
|
+
if (t < w || d === 0)
|
|
90
90
|
b = Math.min(t, a.length - 1);
|
|
91
91
|
else {
|
|
92
|
-
const y = (t - w) %
|
|
92
|
+
const y = (t - w) % d;
|
|
93
93
|
b = w + y;
|
|
94
94
|
}
|
|
95
|
-
const
|
|
96
|
-
return
|
|
95
|
+
const g = a[b];
|
|
96
|
+
return g != null && g.description ? /* @__PURE__ */ c("div", { className: "gs-fn-guide2-desc", style: { marginTop: 8, fontSize: 12, color: "#888" }, children: /* @__PURE__ */ F("p", { children: [
|
|
97
97
|
/* @__PURE__ */ F("strong", { children: [
|
|
98
|
-
|
|
98
|
+
g.name,
|
|
99
99
|
":"
|
|
100
100
|
] }),
|
|
101
101
|
" ",
|
|
102
|
-
/* @__PURE__ */ c("code", { className: "gs-fn-guide2-arg-type", children: ((m =
|
|
103
|
-
|
|
102
|
+
/* @__PURE__ */ c("code", { className: "gs-fn-guide2-arg-type", children: ((m = g.acceptedTypes) == null ? void 0 : m.join(" | ")) || "any" }),
|
|
103
|
+
g.description
|
|
104
104
|
] }) }) : null;
|
|
105
105
|
})(),
|
|
106
106
|
n.description && /* @__PURE__ */ c("div", { className: "gs-fn-guide2-desc", style: { whiteSpace: "pre-line" }, children: n.description })
|
|
@@ -114,7 +114,7 @@ const le = on(
|
|
|
114
114
|
selected: s,
|
|
115
115
|
onOptionMouseDown: r
|
|
116
116
|
}) => {
|
|
117
|
-
const o =
|
|
117
|
+
const o = ie(null), [i, h] = te(t);
|
|
118
118
|
return at(() => {
|
|
119
119
|
if (!o.current)
|
|
120
120
|
return;
|
|
@@ -124,7 +124,7 @@ const le = on(
|
|
|
124
124
|
"li",
|
|
125
125
|
{
|
|
126
126
|
className: `gs-editor-option ${s === a ? " gs-editor-option-selected" : ""}`,
|
|
127
|
-
onMouseDown: (
|
|
127
|
+
onMouseDown: (d) => r(d, a),
|
|
128
128
|
children: [
|
|
129
129
|
/* @__PURE__ */ F("div", { className: "gs-editor-option-content", children: [
|
|
130
130
|
/* @__PURE__ */ c("span", { children: f.label ?? f.value }),
|
|
@@ -140,24 +140,24 @@ const le = on(
|
|
|
140
140
|
if (!o)
|
|
141
141
|
return { top: 0, left: 0, bottom: 0, right: 0 };
|
|
142
142
|
const { y: i, x: h } = t;
|
|
143
|
-
let a =
|
|
143
|
+
let a = ge(n);
|
|
144
144
|
a.left === -1 && (a = { top: i, left: h, bottom: i, right: h });
|
|
145
|
-
const
|
|
145
|
+
const d = s.current, w = o.trim(a), b = xs(w, {
|
|
146
146
|
getter: (m, y) => m.getPolicy(y).serializeForClipboard({ point: y, sheet: m })
|
|
147
|
-
}),
|
|
147
|
+
}), g = Es(w, {
|
|
148
148
|
getter: (m, y) => m.getPolicy(y).serializeForClipboard({ point: y, sheet: m })
|
|
149
149
|
});
|
|
150
150
|
if (navigator.clipboard) {
|
|
151
|
-
const m = new Blob([b], { type: "text/plain" }), y = new Blob([
|
|
151
|
+
const m = new Blob([b], { type: "text/plain" }), y = new Blob([g], { type: "text/html" });
|
|
152
152
|
navigator.clipboard.write([
|
|
153
153
|
new ClipboardItem({
|
|
154
154
|
"text/plain": m,
|
|
155
155
|
"text/html": y
|
|
156
156
|
})
|
|
157
157
|
]);
|
|
158
|
-
} else
|
|
158
|
+
} else d != null && (d.value = b, L(d), d.select(), document.execCommand("copy"), d.value = "", d.blur());
|
|
159
159
|
return a;
|
|
160
|
-
},
|
|
160
|
+
}, xs = (e, {
|
|
161
161
|
getter: n = (i, h) => {
|
|
162
162
|
var f;
|
|
163
163
|
return String(((f = i.getCell(h)) == null ? void 0 : f.value) ?? "");
|
|
@@ -174,8 +174,8 @@ const le = on(
|
|
|
174
174
|
continue;
|
|
175
175
|
const f = [];
|
|
176
176
|
let a = !0;
|
|
177
|
-
for (let
|
|
178
|
-
const b = n(e, { y: h, x:
|
|
177
|
+
for (let d = e.left; d <= e.right; d++) {
|
|
178
|
+
const b = n(e, { y: h, x: d });
|
|
179
179
|
b !== "" && (a = !1), b.indexOf(`
|
|
180
180
|
`) !== -1 ? f.push(`"${b.replace(/"/g, '""')}"`) : f.push(b);
|
|
181
181
|
}
|
|
@@ -185,7 +185,7 @@ const le = on(
|
|
|
185
185
|
for (; i.length > 0 && i[i.length - 1].isEmpty; )
|
|
186
186
|
i.pop();
|
|
187
187
|
return i.map((h) => h.line).join(o);
|
|
188
|
-
},
|
|
188
|
+
}, Es = (e, {
|
|
189
189
|
getter: n = (r, o) => {
|
|
190
190
|
var i;
|
|
191
191
|
return String(((i = r.getCell(o)) == null ? void 0 : i.value) ?? "");
|
|
@@ -200,9 +200,9 @@ const le = on(
|
|
|
200
200
|
const i = [];
|
|
201
201
|
let h = !0;
|
|
202
202
|
for (let f = e.left; f <= e.right; f++) {
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
const w =
|
|
203
|
+
const d = n(e, { y: o, x: f });
|
|
204
|
+
d !== "" && (h = !1);
|
|
205
|
+
const w = d.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">");
|
|
206
206
|
i.push(`<td>${w}</td>`);
|
|
207
207
|
}
|
|
208
208
|
r.push({ isEmpty: h, html: `<tr>${i.join("")}</tr>` });
|
|
@@ -212,77 +212,77 @@ const le = on(
|
|
|
212
212
|
r.pop();
|
|
213
213
|
return `<table>${r.map((o) => o.html).join("")}</table>`;
|
|
214
214
|
}, Rn = ({ inputting: e, selectionStart: n, optionsAll: t, functions: s }) => {
|
|
215
|
-
const [r, o] =
|
|
216
|
-
var
|
|
217
|
-
const
|
|
215
|
+
const [r, o] = te(0), { filteredOptions: i, matchParams: h, activeFunctionHelp: f, activeArgIndex: a } = Ye(() => {
|
|
216
|
+
var C, p;
|
|
217
|
+
const g = e.startsWith("=");
|
|
218
218
|
let m = null, y = 0;
|
|
219
|
-
const D = e.slice(0, n),
|
|
220
|
-
if (
|
|
219
|
+
const D = e.slice(0, n), E = e.slice(n);
|
|
220
|
+
if (g && D.length > 1)
|
|
221
221
|
try {
|
|
222
|
-
const l = D.slice(1),
|
|
223
|
-
|
|
222
|
+
const l = D.slice(1), u = new qe(l);
|
|
223
|
+
u.tokenize();
|
|
224
224
|
const v = [];
|
|
225
|
-
for (let x = 0; x <
|
|
226
|
-
const
|
|
227
|
-
if (
|
|
228
|
-
const
|
|
229
|
-
(
|
|
230
|
-
} else
|
|
225
|
+
for (let x = 0; x < u.tokens.length; x++) {
|
|
226
|
+
const T = u.tokens[x];
|
|
227
|
+
if (T.type === "FUNCTION") {
|
|
228
|
+
const R = u.tokens[x + 1];
|
|
229
|
+
(R == null ? void 0 : R.type) === "OPEN" ? (v.push({ name: T.entity, argIndex: 0, hasWaitComma: !1 }), x++) : u.tokens.length - 1;
|
|
230
|
+
} else T.type === "COMMA" ? v.length > 0 && (v[v.length - 1].argIndex++, v[v.length - 1].hasWaitComma = !0) : T.type === "CLOSE" ? v.length > 0 && v.pop() : T.type !== "SPACE" && v.length > 0 && (v[v.length - 1].hasWaitComma = !1);
|
|
231
231
|
}
|
|
232
232
|
if (v.length > 0) {
|
|
233
|
-
const x = v[v.length - 1],
|
|
234
|
-
y = x.argIndex, m =
|
|
233
|
+
const x = v[v.length - 1], T = $t(s);
|
|
234
|
+
y = x.argIndex, m = T.find((R) => R.name === x.name.toUpperCase()) || null;
|
|
235
235
|
}
|
|
236
236
|
} catch {
|
|
237
237
|
}
|
|
238
|
-
const
|
|
239
|
-
let
|
|
240
|
-
if (
|
|
238
|
+
const S = ((C = D.match(/[a-zA-Z0-9_.]+$/)) == null ? void 0 : C[0]) || "", $ = ((p = E.match(/^[a-zA-Z0-9_.]+/)) == null ? void 0 : p[0]) || "", N = g ? (S + $).toLowerCase() : e.toLocaleLowerCase(), M = g && E.slice($.length).trimStart().startsWith("(");
|
|
239
|
+
let P = [], X = !1;
|
|
240
|
+
if (g)
|
|
241
241
|
try {
|
|
242
242
|
const l = new qe(e.slice(1));
|
|
243
243
|
l.tokenize();
|
|
244
|
-
let
|
|
244
|
+
let u = 1;
|
|
245
245
|
for (const v of l.tokens) {
|
|
246
246
|
const x = v.length();
|
|
247
|
-
if (n >
|
|
248
|
-
["REF", "RANGE", "ID", "ID_RANGE", "UNREFERENCED"].includes(v.type) && (
|
|
247
|
+
if (n > u && n < u + x) {
|
|
248
|
+
["REF", "RANGE", "ID", "ID_RANGE", "UNREFERENCED"].includes(v.type) && (X = !0), v.type === "VALUE" && typeof v.entity == "string" && (X = !0);
|
|
249
249
|
break;
|
|
250
250
|
}
|
|
251
|
-
(n ===
|
|
251
|
+
(n === u || n === u + x) && ["REF", "RANGE", "ID", "ID_RANGE", "UNREFERENCED"].includes(v.type) && (X = !0), u += x;
|
|
252
252
|
}
|
|
253
253
|
} catch {
|
|
254
254
|
}
|
|
255
|
-
return
|
|
256
|
-
const
|
|
255
|
+
return g && !X ? N.length > 0 && !M && (P = $t(s).map((l) => {
|
|
256
|
+
const u = l.name.toLowerCase(), v = u.startsWith(N), x = v ? 0 : -1, T = l.defs.length === 0;
|
|
257
257
|
return {
|
|
258
|
-
option: { ...l, value: l.name + (
|
|
258
|
+
option: { ...l, value: l.name + (T ? "()" : "("), isFunction: !0, label: l.name },
|
|
259
259
|
index: x,
|
|
260
260
|
startsWith: v,
|
|
261
261
|
keywordCount: 1,
|
|
262
|
-
keyword:
|
|
262
|
+
keyword: u
|
|
263
263
|
};
|
|
264
|
-
}).filter(({ startsWith: l }) => l).sort((l,
|
|
265
|
-
const
|
|
264
|
+
}).filter(({ startsWith: l }) => l).sort((l, u) => l.startsWith !== u.startsWith ? u.startsWith ? 1 : -1 : l.index !== u.index ? l.index - u.index : l.keyword.localeCompare(u.keyword)).map(({ option: l }) => l)) : P = t.map((l) => {
|
|
265
|
+
const u = l.keywords ?? [String(l.value)];
|
|
266
266
|
let v = { index: -1, startsWith: !1, keyword: "" };
|
|
267
|
-
for (const x of
|
|
268
|
-
const
|
|
269
|
-
if (
|
|
270
|
-
const
|
|
271
|
-
(v.index === -1 ||
|
|
267
|
+
for (const x of u) {
|
|
268
|
+
const T = x.toLowerCase(), R = T.indexOf(N);
|
|
269
|
+
if (R !== -1) {
|
|
270
|
+
const B = T.startsWith(N);
|
|
271
|
+
(v.index === -1 || R < v.index || R === v.index && B && !v.startsWith) && (v = { index: R, startsWith: B, keyword: x });
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
return {
|
|
275
275
|
option: l,
|
|
276
276
|
...v,
|
|
277
|
-
keywordCount:
|
|
277
|
+
keywordCount: u.length
|
|
278
278
|
};
|
|
279
|
-
}).filter(({ index: l }) => l !== -1).sort((l,
|
|
280
|
-
filteredOptions:
|
|
279
|
+
}).filter(({ index: l }) => l !== -1).sort((l, u) => l.startsWith !== u.startsWith ? u.startsWith ? 1 : -1 : l.index !== u.index ? l.index - u.index : l.keywordCount !== u.keywordCount ? u.keywordCount - l.keywordCount : l.keyword.localeCompare(u.keyword)).map(({ option: l }) => l), {
|
|
280
|
+
filteredOptions: P,
|
|
281
281
|
matchParams: {
|
|
282
|
-
isFormula:
|
|
283
|
-
currentWord:
|
|
284
|
-
matchLengthBefore:
|
|
285
|
-
matchLengthAfter:
|
|
282
|
+
isFormula: g,
|
|
283
|
+
currentWord: N,
|
|
284
|
+
matchLengthBefore: S.length,
|
|
285
|
+
matchLengthAfter: $.length
|
|
286
286
|
},
|
|
287
287
|
activeFunctionHelp: m,
|
|
288
288
|
activeArgIndex: y
|
|
@@ -291,29 +291,29 @@ const le = on(
|
|
|
291
291
|
Ye(() => {
|
|
292
292
|
r >= i.length && o(0);
|
|
293
293
|
}, [i.length, r]);
|
|
294
|
-
const
|
|
295
|
-
(
|
|
296
|
-
if (!
|
|
294
|
+
const d = A(
|
|
295
|
+
(g) => {
|
|
296
|
+
if (!g)
|
|
297
297
|
return { value: e, selectionStart: n };
|
|
298
298
|
if (h.isFormula) {
|
|
299
299
|
const m = e.slice(0, n - h.matchLengthBefore), y = e.slice(n + h.matchLengthAfter);
|
|
300
|
-
return { value: m +
|
|
300
|
+
return { value: m + g.value + y, selectionStart: m.length + g.value.length };
|
|
301
301
|
} else
|
|
302
|
-
return { value: String(
|
|
302
|
+
return { value: String(g.value), selectionStart: String(g.value).length };
|
|
303
303
|
},
|
|
304
304
|
[e, n, h]
|
|
305
|
-
), w =
|
|
306
|
-
(
|
|
305
|
+
), w = A(
|
|
306
|
+
(g) => i.length > 1 ? (o((m) => m <= 0 ? i.length - 1 : m - 1), g.preventDefault(), !0) : !1,
|
|
307
307
|
[i.length]
|
|
308
|
-
), b =
|
|
309
|
-
(
|
|
308
|
+
), b = A(
|
|
309
|
+
(g) => i.length > 1 ? (o((m) => m >= i.length - 1 ? 0 : m + 1), g.preventDefault(), !0) : !1,
|
|
310
310
|
[i.length]
|
|
311
311
|
);
|
|
312
312
|
return {
|
|
313
313
|
filteredOptions: i,
|
|
314
314
|
selected: r,
|
|
315
315
|
setSelected: o,
|
|
316
|
-
replaceWithOption:
|
|
316
|
+
replaceWithOption: d,
|
|
317
317
|
handleArrowUp: w,
|
|
318
318
|
handleArrowDown: b,
|
|
319
319
|
isFormula: h.isFormula,
|
|
@@ -329,40 +329,40 @@ const le = on(
|
|
|
329
329
|
}, Cn = (e, n = !1) => {
|
|
330
330
|
const s = new DOMParser().parseFromString(e, "text/html"), r = [], o = (f) => {
|
|
331
331
|
var w, b;
|
|
332
|
-
const a = /* @__PURE__ */ new Set(),
|
|
333
|
-
for (let
|
|
334
|
-
const m =
|
|
332
|
+
const a = /* @__PURE__ */ new Set(), d = f.querySelectorAll("tr,caption");
|
|
333
|
+
for (let g = 0; g < d.length; g++) {
|
|
334
|
+
const m = d[g];
|
|
335
335
|
if (m.tagName === "CAPTION") {
|
|
336
|
-
const
|
|
337
|
-
|
|
336
|
+
const S = ((w = m.textContent) == null ? void 0 : w.trim()) ?? "";
|
|
337
|
+
S && r.push([{ value: S }]);
|
|
338
338
|
continue;
|
|
339
339
|
}
|
|
340
340
|
const y = Array.from(m.querySelectorAll("td, th")), D = [];
|
|
341
|
-
let
|
|
342
|
-
for (const
|
|
343
|
-
const
|
|
344
|
-
const
|
|
345
|
-
return { ...jt(
|
|
341
|
+
let E = 0;
|
|
342
|
+
for (const S of y) {
|
|
343
|
+
const $ = ((b = S.textContent) == null ? void 0 : b.trim()) ?? "", N = n ? void 0 : (() => {
|
|
344
|
+
const X = jt(S.firstElementChild);
|
|
345
|
+
return { ...jt(S), ...X };
|
|
346
346
|
})();
|
|
347
|
-
for (; a.has(`${
|
|
348
|
-
D.push({ value: "", style:
|
|
349
|
-
D.push({ value:
|
|
350
|
-
const
|
|
351
|
-
for (let
|
|
352
|
-
for (let
|
|
353
|
-
a.add(`${
|
|
347
|
+
for (; a.has(`${g}-${++E}`); )
|
|
348
|
+
D.push({ value: "", style: N, skip: !0 });
|
|
349
|
+
D.push({ value: $, style: N });
|
|
350
|
+
const M = parseInt(S.getAttribute("rowspan") ?? "1", 10), P = parseInt(S.getAttribute("colspan") ?? "1", 10);
|
|
351
|
+
for (let X = 0; X < M; X++)
|
|
352
|
+
for (let C = 0; C < P; C++)
|
|
353
|
+
a.add(`${g + X}-${E + C}`);
|
|
354
354
|
}
|
|
355
355
|
r.push(D);
|
|
356
356
|
}
|
|
357
357
|
}, i = (f, a = []) => {
|
|
358
358
|
if (f.nodeType === Node.ELEMENT_NODE) {
|
|
359
|
-
const
|
|
360
|
-
w === "TABLE" ? (a.length > 0 && (r.push(a.slice()), a.length = 0), o(
|
|
359
|
+
const d = f, w = d.tagName;
|
|
360
|
+
w === "TABLE" ? (a.length > 0 && (r.push(a.slice()), a.length = 0), o(d)) : w === "BR" ? (r.push(a.slice()), a.length = 0) : ks.has(w) ? (a.length > 0 && (r.push(a.slice()), a.length = 0), d.childNodes.forEach((b) => i(b, a)), a.length > 0 && (r.push(a.slice()), a.length = 0)) : d.childNodes.forEach((b) => i(b, a));
|
|
361
361
|
} else if (f.nodeType === Node.TEXT_NODE) {
|
|
362
362
|
const w = (f.textContent ?? "").split(/\r?\n/);
|
|
363
363
|
for (const b of w) {
|
|
364
|
-
const
|
|
365
|
-
|
|
364
|
+
const g = b.trim();
|
|
365
|
+
g && a.push({ value: g });
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
}, h = [];
|
|
@@ -480,157 +480,157 @@ const Sn = (e, n = " ") => {
|
|
|
480
480
|
"UL"
|
|
481
481
|
]), Ts = ({ mode: e }) => {
|
|
482
482
|
var It, Ft;
|
|
483
|
-
const { store: n, dispatch: t } =
|
|
483
|
+
const { store: n, dispatch: t } = le(ae), [s, r] = te(!1), [o, i] = te(0), [h, f] = te(!1), {
|
|
484
484
|
choosing: a,
|
|
485
|
-
inputting:
|
|
485
|
+
inputting: d,
|
|
486
486
|
selectingZone: w,
|
|
487
487
|
editorRect: b,
|
|
488
|
-
editingAddress:
|
|
488
|
+
editingAddress: g,
|
|
489
489
|
entering: m,
|
|
490
490
|
matchingCells: y,
|
|
491
491
|
matchingCellIndex: D,
|
|
492
|
-
searchQuery:
|
|
493
|
-
editorRef:
|
|
494
|
-
largeEditorRef:
|
|
495
|
-
searchInputRef:
|
|
496
|
-
editingOnEnter:
|
|
497
|
-
sheetReactive:
|
|
498
|
-
sheetId:
|
|
499
|
-
dragging:
|
|
500
|
-
} = n, p =
|
|
501
|
-
var
|
|
502
|
-
if (!h || !
|
|
492
|
+
searchQuery: E,
|
|
493
|
+
editorRef: S,
|
|
494
|
+
largeEditorRef: $,
|
|
495
|
+
searchInputRef: N,
|
|
496
|
+
editingOnEnter: M,
|
|
497
|
+
sheetReactive: P,
|
|
498
|
+
sheetId: X,
|
|
499
|
+
dragging: C
|
|
500
|
+
} = n, p = P.current, l = () => {
|
|
501
|
+
var ue;
|
|
502
|
+
if (!h || !O || typeof document > "u" || S.current !== document.activeElement)
|
|
503
503
|
return null;
|
|
504
|
-
const k = (
|
|
504
|
+
const k = (ue = S.current) == null ? void 0 : ue.getBoundingClientRect();
|
|
505
505
|
if (!k)
|
|
506
506
|
return null;
|
|
507
|
-
const { bottom: j, left:
|
|
507
|
+
const { bottom: j, left: re } = k;
|
|
508
508
|
return Ct(
|
|
509
509
|
/* @__PURE__ */ F(we, { children: [
|
|
510
|
-
|
|
510
|
+
ce && T.length === 0 && (!w || w.endY === -1 && w.endX === -1) && /* @__PURE__ */ c(
|
|
511
511
|
St,
|
|
512
512
|
{
|
|
513
|
-
activeFunctionGuide:
|
|
514
|
-
activeArgIndex:
|
|
513
|
+
activeFunctionGuide: ce,
|
|
514
|
+
activeArgIndex: K,
|
|
515
515
|
top: j,
|
|
516
|
-
left:
|
|
516
|
+
left: re
|
|
517
517
|
}
|
|
518
518
|
),
|
|
519
|
-
|
|
519
|
+
T.length > 0 && /* @__PURE__ */ c(
|
|
520
520
|
wn,
|
|
521
521
|
{
|
|
522
|
-
filteredOptions:
|
|
522
|
+
filteredOptions: T,
|
|
523
523
|
top: j,
|
|
524
|
-
left:
|
|
525
|
-
selected:
|
|
524
|
+
left: re,
|
|
525
|
+
selected: R,
|
|
526
526
|
onOptionMouseDown: jn
|
|
527
527
|
}
|
|
528
528
|
)
|
|
529
529
|
] }),
|
|
530
530
|
document.body
|
|
531
531
|
);
|
|
532
|
-
},
|
|
532
|
+
}, u = p == null ? void 0 : p.getPolicy(a), v = (u == null ? void 0 : u.getSelectOptions()) ?? [], x = A((k) => {
|
|
533
533
|
i(k.currentTarget.selectionStart);
|
|
534
534
|
}, []), {
|
|
535
|
-
filteredOptions:
|
|
536
|
-
selected:
|
|
537
|
-
setSelected:
|
|
535
|
+
filteredOptions: T,
|
|
536
|
+
selected: R,
|
|
537
|
+
setSelected: B,
|
|
538
538
|
replaceWithOption: q,
|
|
539
|
-
handleArrowUp:
|
|
540
|
-
handleArrowDown:
|
|
541
|
-
activeFunctionHelp:
|
|
542
|
-
activeArgIndex:
|
|
539
|
+
handleArrowUp: _,
|
|
540
|
+
handleArrowDown: se,
|
|
541
|
+
activeFunctionHelp: ce,
|
|
542
|
+
activeArgIndex: K
|
|
543
543
|
} = Rn({
|
|
544
|
-
inputting:
|
|
544
|
+
inputting: d,
|
|
545
545
|
selectionStart: o,
|
|
546
546
|
optionsAll: v,
|
|
547
547
|
functions: p == null ? void 0 : p.registry.functions
|
|
548
548
|
});
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
}, [
|
|
552
|
-
p && p.registry.lastFocused != null && p.registry.lastFocused ===
|
|
553
|
-
}, [p == null ? void 0 : p.registry.lastFocused, p,
|
|
554
|
-
p && (p.registry.editingSheetId =
|
|
555
|
-
}, [
|
|
556
|
-
Gn(
|
|
557
|
-
}, [
|
|
558
|
-
const { y:
|
|
549
|
+
z(() => {
|
|
550
|
+
L(S == null ? void 0 : S.current);
|
|
551
|
+
}, [S]), z(() => {
|
|
552
|
+
p && p.registry.lastFocused != null && p.registry.lastFocused === S.current && p.registry.lastFocused === $.current && t(de(""));
|
|
553
|
+
}, [p == null ? void 0 : p.registry.lastFocused, p, S, $, t]), z(() => {
|
|
554
|
+
p && (p.registry.editingSheetId = X, p.registry.editingAddress = g);
|
|
555
|
+
}, [g, p, X]), z(() => {
|
|
556
|
+
Gn(S.current);
|
|
557
|
+
}, [d, g, S]);
|
|
558
|
+
const { y: U, x: Z } = a, G = `${ve(U)}`, W = `${me(Z)}${G}`, O = g === W, Q = p == null ? void 0 : p.getCell({ y: U, x: Z }, { resolution: "RAW" }), Y = p ? p.getSerializedValue({ point: a, cell: Q, resolution: "RAW" }) : "", [I, ee] = te(Y), J = A(
|
|
559
559
|
(k) => {
|
|
560
|
-
|
|
560
|
+
I !== k && t(Ze({ value: k })), ee(k);
|
|
561
561
|
},
|
|
562
|
-
[
|
|
563
|
-
), pe =
|
|
562
|
+
[I, t]
|
|
563
|
+
), pe = A(
|
|
564
564
|
(k) => {
|
|
565
565
|
if (!p)
|
|
566
566
|
return;
|
|
567
|
-
const j =
|
|
567
|
+
const j = T[k];
|
|
568
568
|
if (j) {
|
|
569
569
|
if (j.isFunction) {
|
|
570
|
-
const { value:
|
|
571
|
-
t(re
|
|
572
|
-
|
|
570
|
+
const { value: re, selectionStart: ue } = q(j);
|
|
571
|
+
t(oe(re)), setTimeout(() => {
|
|
572
|
+
S.current && (L(S.current), S.current.setSelectionRange(ue, ue));
|
|
573
573
|
}, 0);
|
|
574
574
|
} else {
|
|
575
|
-
const
|
|
576
|
-
diff: { [
|
|
575
|
+
const re = p.update({
|
|
576
|
+
diff: { [W]: { value: j.value } },
|
|
577
577
|
partial: !0
|
|
578
578
|
});
|
|
579
|
-
t(Ue(
|
|
579
|
+
t(Ue(re.clone())), t(de("")), t(oe(""));
|
|
580
580
|
}
|
|
581
|
-
|
|
581
|
+
B(0);
|
|
582
582
|
}
|
|
583
583
|
},
|
|
584
|
-
[
|
|
584
|
+
[T, p, W, d, J, t, S]
|
|
585
585
|
);
|
|
586
|
-
|
|
587
|
-
p && (
|
|
588
|
-
}, [a,
|
|
589
|
-
const { y:
|
|
590
|
-
`).length, [Mt, Dt] =
|
|
586
|
+
z(() => {
|
|
587
|
+
p && (ee(Y), t(oe(Y)), Qn(S.current, p, a));
|
|
588
|
+
}, [a, Y, t, S, p]);
|
|
589
|
+
const { y: xe, x: We, height: Tt, width: At } = b, Ln = Y.split(`
|
|
590
|
+
`).length, [Mt, Dt] = te(!1), Bn = A(
|
|
591
591
|
(k) => {
|
|
592
|
-
var
|
|
592
|
+
var ue, Oe, Ae, He, Le, Yt;
|
|
593
593
|
if (!p || Mt)
|
|
594
594
|
return;
|
|
595
595
|
k.key === "Meta" || k.key === "Control" || (Dt(!0), requestAnimationFrame(() => {
|
|
596
596
|
Dt(!1);
|
|
597
597
|
}));
|
|
598
598
|
const j = k.currentTarget;
|
|
599
|
-
if (en(k,
|
|
600
|
-
return t(
|
|
601
|
-
const
|
|
599
|
+
if (en(k, d))
|
|
600
|
+
return t(oe(j.value)), !1;
|
|
601
|
+
const re = k.shiftKey;
|
|
602
602
|
switch (k.key) {
|
|
603
603
|
case "Tab":
|
|
604
|
-
if (k.preventDefault(),
|
|
605
|
-
if (
|
|
606
|
-
const ye = (
|
|
607
|
-
if (pe(
|
|
604
|
+
if (k.preventDefault(), O)
|
|
605
|
+
if (T.length) {
|
|
606
|
+
const ye = (ue = T[R]) == null ? void 0 : ue.isFunction;
|
|
607
|
+
if (pe(R), ye)
|
|
608
608
|
return !1;
|
|
609
609
|
} else
|
|
610
|
-
|
|
610
|
+
J(j.value), t(de("")), t(oe(""));
|
|
611
611
|
return t(
|
|
612
612
|
ut({
|
|
613
613
|
numRows: p.numRows,
|
|
614
614
|
numCols: p.numCols,
|
|
615
615
|
deltaY: 0,
|
|
616
|
-
deltaX:
|
|
616
|
+
deltaX: re ? -1 : 1
|
|
617
617
|
})
|
|
618
|
-
), t(
|
|
618
|
+
), t(de("")), !1;
|
|
619
619
|
case "Enter":
|
|
620
|
-
if (
|
|
621
|
-
if (
|
|
622
|
-
const ye = (Oe =
|
|
623
|
-
if (pe(
|
|
620
|
+
if (O)
|
|
621
|
+
if (T.length) {
|
|
622
|
+
const ye = (Oe = T[R]) == null ? void 0 : Oe.isFunction;
|
|
623
|
+
if (pe(R), ye)
|
|
624
624
|
return k.preventDefault(), !1;
|
|
625
625
|
} else {
|
|
626
626
|
if (k.altKey)
|
|
627
627
|
return tn(j, `
|
|
628
|
-
`), t(
|
|
628
|
+
`), t(oe(j.value)), k.preventDefault(), !1;
|
|
629
629
|
if (k.nativeEvent.isComposing)
|
|
630
630
|
return !1;
|
|
631
|
-
|
|
631
|
+
J(j.value), t(de("")), t(oe(""));
|
|
632
632
|
}
|
|
633
|
-
else if (
|
|
633
|
+
else if (M && w.endY === -1) {
|
|
634
634
|
const ye = document.createEvent("MouseEvents");
|
|
635
635
|
return ye.initEvent("dblclick", !0, !0), j.dispatchEvent(ye), k.preventDefault(), !1;
|
|
636
636
|
}
|
|
@@ -638,17 +638,17 @@ const Sn = (e, n = " ") => {
|
|
|
638
638
|
ut({
|
|
639
639
|
numRows: p.numRows,
|
|
640
640
|
numCols: p.numCols,
|
|
641
|
-
deltaY:
|
|
641
|
+
deltaY: re ? -1 : 1,
|
|
642
642
|
deltaX: 0
|
|
643
643
|
})
|
|
644
644
|
), k.preventDefault(), !1;
|
|
645
645
|
case "Backspace":
|
|
646
|
-
if (!
|
|
647
|
-
return ((Ae = p.getSystem({ y:
|
|
646
|
+
if (!O)
|
|
647
|
+
return ((Ae = p.getSystem({ y: U, x: Z })) == null ? void 0 : Ae.spilledFrom) != null ? (k.preventDefault(), !1) : (t(Zt(null)), t(oe("")), !1);
|
|
648
648
|
break;
|
|
649
649
|
case "Delete":
|
|
650
|
-
if (!
|
|
651
|
-
return ((He = p.getSystem({ y:
|
|
650
|
+
if (!O)
|
|
651
|
+
return ((He = p.getSystem({ y: U, x: Z })) == null ? void 0 : He.spilledFrom) != null ? (k.preventDefault(), !1) : (t(Zt(null)), t(oe("")), !1);
|
|
652
652
|
break;
|
|
653
653
|
case "Shift":
|
|
654
654
|
return r(!0), !1;
|
|
@@ -661,12 +661,12 @@ const Sn = (e, n = " ") => {
|
|
|
661
661
|
case "NumLock":
|
|
662
662
|
return !1;
|
|
663
663
|
case "Escape":
|
|
664
|
-
return t(bs(null)), t($e(void 0)), t(
|
|
664
|
+
return t(bs(null)), t($e(void 0)), t(oe(I)), !1;
|
|
665
665
|
case "ArrowLeft":
|
|
666
|
-
if (!
|
|
666
|
+
if (!O)
|
|
667
667
|
return t(
|
|
668
668
|
_e({
|
|
669
|
-
shiftKey:
|
|
669
|
+
shiftKey: re,
|
|
670
670
|
numRows: p.numRows,
|
|
671
671
|
numCols: p.numCols,
|
|
672
672
|
deltaY: 0,
|
|
@@ -675,24 +675,24 @@ const Sn = (e, n = " ") => {
|
|
|
675
675
|
), !1;
|
|
676
676
|
break;
|
|
677
677
|
case "ArrowUp":
|
|
678
|
-
if (!
|
|
678
|
+
if (!O)
|
|
679
679
|
return t(
|
|
680
680
|
_e({
|
|
681
|
-
shiftKey:
|
|
681
|
+
shiftKey: re,
|
|
682
682
|
numRows: p.numRows,
|
|
683
683
|
numCols: p.numCols,
|
|
684
684
|
deltaY: -1,
|
|
685
685
|
deltaX: 0
|
|
686
686
|
})
|
|
687
687
|
), !1;
|
|
688
|
-
if (
|
|
688
|
+
if (_(k))
|
|
689
689
|
return !0;
|
|
690
690
|
break;
|
|
691
691
|
case "ArrowRight":
|
|
692
|
-
if (!
|
|
692
|
+
if (!O)
|
|
693
693
|
return t(
|
|
694
694
|
_e({
|
|
695
|
-
shiftKey:
|
|
695
|
+
shiftKey: re,
|
|
696
696
|
numRows: p.numRows,
|
|
697
697
|
numCols: p.numCols,
|
|
698
698
|
deltaY: 0,
|
|
@@ -701,21 +701,21 @@ const Sn = (e, n = " ") => {
|
|
|
701
701
|
), !1;
|
|
702
702
|
break;
|
|
703
703
|
case "ArrowDown":
|
|
704
|
-
if (!
|
|
704
|
+
if (!O)
|
|
705
705
|
return t(
|
|
706
706
|
_e({
|
|
707
|
-
shiftKey:
|
|
707
|
+
shiftKey: re,
|
|
708
708
|
numRows: p.numRows,
|
|
709
709
|
numCols: p.numCols,
|
|
710
710
|
deltaY: 1,
|
|
711
711
|
deltaX: 0
|
|
712
712
|
})
|
|
713
713
|
), !1;
|
|
714
|
-
if (
|
|
714
|
+
if (se(k))
|
|
715
715
|
return !0;
|
|
716
716
|
break;
|
|
717
717
|
case "a":
|
|
718
|
-
if ((k.ctrlKey || k.metaKey) && !
|
|
718
|
+
if ((k.ctrlKey || k.metaKey) && !O)
|
|
719
719
|
return k.preventDefault(), t(
|
|
720
720
|
be({
|
|
721
721
|
startY: 1,
|
|
@@ -727,26 +727,26 @@ const Sn = (e, n = " ") => {
|
|
|
727
727
|
break;
|
|
728
728
|
case "c":
|
|
729
729
|
if (k.ctrlKey || k.metaKey) {
|
|
730
|
-
if (!
|
|
730
|
+
if (!O) {
|
|
731
731
|
k.preventDefault();
|
|
732
732
|
const ye = et(n);
|
|
733
|
-
return t(dn(Ge(ye))),
|
|
733
|
+
return t(dn(Ge(ye))), L(j), !1;
|
|
734
734
|
}
|
|
735
735
|
return !0;
|
|
736
736
|
}
|
|
737
737
|
break;
|
|
738
738
|
case "f":
|
|
739
|
-
if ((k.ctrlKey || k.metaKey) && !
|
|
740
|
-
return k.preventDefault(), typeof
|
|
739
|
+
if ((k.ctrlKey || k.metaKey) && !O)
|
|
740
|
+
return k.preventDefault(), typeof E > "u" && t($e("")), t(un(!1)), requestAnimationFrame(() => L(N.current)), !1;
|
|
741
741
|
break;
|
|
742
742
|
case "r":
|
|
743
743
|
// R
|
|
744
744
|
case "y":
|
|
745
|
-
if ((k.ctrlKey || k.metaKey) && !
|
|
746
|
-
return k.preventDefault(), t(ct(null)), requestAnimationFrame(() => t(
|
|
745
|
+
if ((k.ctrlKey || k.metaKey) && !O)
|
|
746
|
+
return k.preventDefault(), t(ct(null)), requestAnimationFrame(() => t(oe(""))), !1;
|
|
747
747
|
break;
|
|
748
748
|
case "s":
|
|
749
|
-
if ((k.ctrlKey || k.metaKey) && !
|
|
749
|
+
if ((k.ctrlKey || k.metaKey) && !O)
|
|
750
750
|
return k.preventDefault(), (Yt = (Le = p.registry).onSave) == null || Yt.call(Le, {
|
|
751
751
|
sheet: p,
|
|
752
752
|
points: {
|
|
@@ -767,91 +767,91 @@ const Sn = (e, n = " ") => {
|
|
|
767
767
|
return k.stopPropagation(), !1;
|
|
768
768
|
break;
|
|
769
769
|
case "x":
|
|
770
|
-
if ((k.ctrlKey || k.metaKey) && !
|
|
770
|
+
if ((k.ctrlKey || k.metaKey) && !O) {
|
|
771
771
|
k.preventDefault();
|
|
772
772
|
const ye = et(n);
|
|
773
|
-
return t(cn(Ge(ye))),
|
|
773
|
+
return t(cn(Ge(ye))), L(j), !1;
|
|
774
774
|
}
|
|
775
775
|
break;
|
|
776
776
|
case "z":
|
|
777
|
-
if ((k.ctrlKey || k.metaKey) && !
|
|
777
|
+
if ((k.ctrlKey || k.metaKey) && !O)
|
|
778
778
|
return k.preventDefault(), k.shiftKey ? t(ct(null)) : t(an(null)), !1;
|
|
779
779
|
break;
|
|
780
780
|
case ";":
|
|
781
|
-
(k.ctrlKey || k.metaKey) && (
|
|
781
|
+
(k.ctrlKey || k.metaKey) && (O || (k.preventDefault(), J((/* @__PURE__ */ new Date()).toDateString())));
|
|
782
782
|
break;
|
|
783
783
|
}
|
|
784
|
-
return k.ctrlKey || k.metaKey ? !1 :
|
|
784
|
+
return k.ctrlKey || k.metaKey ? !1 : H.hasOperation(Q == null ? void 0 : Q.prevention, H.Write) ? (console.warn("This cell is protected from writing."), !1) : (t(de(W)), O || t(oe("")), B(0), !1);
|
|
785
785
|
},
|
|
786
786
|
[
|
|
787
787
|
Mt,
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
788
|
+
O,
|
|
789
|
+
T,
|
|
790
|
+
R,
|
|
791
|
+
M,
|
|
792
792
|
w,
|
|
793
|
-
|
|
793
|
+
I,
|
|
794
794
|
p,
|
|
795
795
|
a,
|
|
796
796
|
n,
|
|
797
797
|
Q,
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
798
|
+
W,
|
|
799
|
+
J,
|
|
800
|
+
E,
|
|
801
|
+
d
|
|
802
802
|
]
|
|
803
|
-
), Kn =
|
|
803
|
+
), Kn = A(
|
|
804
804
|
(k) => {
|
|
805
805
|
f(!0), p && (p.registry.lastFocused = k.currentTarget);
|
|
806
806
|
},
|
|
807
807
|
[p]
|
|
808
|
-
), Zn =
|
|
808
|
+
), Zn = A(
|
|
809
809
|
(k) => {
|
|
810
|
-
if (
|
|
810
|
+
if (H.hasOperation(Q == null ? void 0 : Q.prevention, H.Write)) {
|
|
811
811
|
console.warn("This cell is protected from writing.");
|
|
812
812
|
return;
|
|
813
813
|
}
|
|
814
814
|
const j = k.currentTarget;
|
|
815
|
-
|
|
815
|
+
O || (t(oe(Y)), t(de(W)), requestAnimationFrame(() => {
|
|
816
816
|
j.style.width = `${j.scrollWidth}px`, j.style.height = `${j.scrollHeight}px`;
|
|
817
|
-
const
|
|
818
|
-
j.setSelectionRange(
|
|
817
|
+
const re = new String(Y).length;
|
|
818
|
+
j.setSelectionRange(re, re);
|
|
819
819
|
}));
|
|
820
820
|
},
|
|
821
|
-
[Q,
|
|
822
|
-
), Un =
|
|
821
|
+
[Q, O, Y, W]
|
|
822
|
+
), Un = A(
|
|
823
823
|
(k) => {
|
|
824
824
|
if (f(!1), nn(k.currentTarget))
|
|
825
825
|
return !0;
|
|
826
|
-
|
|
826
|
+
O && J(k.currentTarget.value), t(de(""));
|
|
827
827
|
},
|
|
828
|
-
[
|
|
829
|
-
), zn =
|
|
828
|
+
[O, J, t]
|
|
829
|
+
), zn = A(
|
|
830
830
|
(k) => {
|
|
831
|
-
|
|
831
|
+
H.hasOperation(Q == null ? void 0 : Q.prevention, H.Write) || (t(oe(k.currentTarget.value)), i(k.currentTarget.selectionStart), B(0));
|
|
832
832
|
},
|
|
833
833
|
[Q]
|
|
834
|
-
), Wn =
|
|
834
|
+
), Wn = A(
|
|
835
835
|
(k) => {
|
|
836
|
-
var
|
|
837
|
-
if (
|
|
836
|
+
var ue, Oe, Ae, He;
|
|
837
|
+
if (O)
|
|
838
838
|
return !0;
|
|
839
|
-
const j = s,
|
|
840
|
-
if (
|
|
841
|
-
t(dt({ matrix: Cn(
|
|
839
|
+
const j = s, re = (Oe = (ue = k.clipboardData) == null ? void 0 : ue.getData) == null ? void 0 : Oe.call(ue, "text/html");
|
|
840
|
+
if (re)
|
|
841
|
+
t(dt({ matrix: Cn(re), onlyValue: j }));
|
|
842
842
|
else {
|
|
843
843
|
const Le = (He = (Ae = k.clipboardData) == null ? void 0 : Ae.getData) == null ? void 0 : He.call(Ae, "text/plain");
|
|
844
844
|
Le ? t(dt({ matrix: Sn(Le), onlyValue: j })) : console.warn("No clipboard data found.");
|
|
845
845
|
}
|
|
846
846
|
return k.preventDefault(), k.stopPropagation(), !1;
|
|
847
847
|
},
|
|
848
|
-
[
|
|
849
|
-
), _n =
|
|
848
|
+
[O, s]
|
|
849
|
+
), _n = A(
|
|
850
850
|
(k) => {
|
|
851
|
-
var
|
|
851
|
+
var re, ue;
|
|
852
852
|
r(!1);
|
|
853
|
-
const j =
|
|
854
|
-
(
|
|
853
|
+
const j = ge(n.selectingZone);
|
|
854
|
+
(ue = p == null ? void 0 : (re = p.registry).onKeyUp) == null || ue.call(re, {
|
|
855
855
|
e: k,
|
|
856
856
|
points: {
|
|
857
857
|
pointing: a,
|
|
@@ -861,19 +861,19 @@ const Sn = (e, n = " ") => {
|
|
|
861
861
|
});
|
|
862
862
|
},
|
|
863
863
|
[n.selectingZone, a, p]
|
|
864
|
-
), jn =
|
|
864
|
+
), jn = A(
|
|
865
865
|
(k, j) => (pe(j), k.preventDefault(), k.stopPropagation(), !1),
|
|
866
866
|
[pe]
|
|
867
867
|
);
|
|
868
868
|
return p ? /* @__PURE__ */ F(
|
|
869
869
|
st,
|
|
870
870
|
{
|
|
871
|
-
className: `gs-editor ${
|
|
872
|
-
style:
|
|
871
|
+
className: `gs-editor ${O ? "gs-editing" : ""}`,
|
|
872
|
+
style: O ? { top: xe, left: We, height: Tt } : {},
|
|
873
873
|
"data-mode": e,
|
|
874
|
-
"data-sheet-id":
|
|
874
|
+
"data-sheet-id": X,
|
|
875
875
|
children: [
|
|
876
|
-
/* @__PURE__ */ c("div", { className: `gs-cell-label ${
|
|
876
|
+
/* @__PURE__ */ c("div", { className: `gs-cell-label ${O ? " gs-hidden" : ""}`, children: W }),
|
|
877
877
|
/* @__PURE__ */ F("div", { className: "gs-editor-inner", style: { width: At }, children: [
|
|
878
878
|
/* @__PURE__ */ c(
|
|
879
879
|
"pre",
|
|
@@ -881,28 +881,28 @@ const Sn = (e, n = " ") => {
|
|
|
881
881
|
className: "gs-editor-hl",
|
|
882
882
|
style: {
|
|
883
883
|
//...cell?.style,
|
|
884
|
-
height: (It =
|
|
885
|
-
width: (((Ft =
|
|
884
|
+
height: (It = S.current) == null ? void 0 : It.scrollHeight,
|
|
885
|
+
width: (((Ft = S.current) == null ? void 0 : Ft.scrollWidth) ?? 0) - 4
|
|
886
886
|
},
|
|
887
|
-
children: (Q == null ? void 0 : Q.formulaEnabled) ?? !0 ? Nn(
|
|
887
|
+
children: (Q == null ? void 0 : Q.formulaEnabled) ?? !0 ? Nn(d) : d
|
|
888
888
|
}
|
|
889
889
|
),
|
|
890
890
|
/* @__PURE__ */ c(
|
|
891
891
|
"textarea",
|
|
892
892
|
{
|
|
893
|
-
"data-sheet-id":
|
|
893
|
+
"data-sheet-id": X,
|
|
894
894
|
name: "gs-editor-input",
|
|
895
895
|
"data-size": "small",
|
|
896
896
|
autoFocus: !0,
|
|
897
897
|
spellCheck: !1,
|
|
898
898
|
draggable: !1,
|
|
899
|
-
ref:
|
|
899
|
+
ref: S,
|
|
900
900
|
rows: Ln,
|
|
901
901
|
onFocus: Kn,
|
|
902
902
|
style: { minWidth: At, minHeight: Tt },
|
|
903
903
|
onDoubleClick: Zn,
|
|
904
904
|
onBlur: Un,
|
|
905
|
-
value:
|
|
905
|
+
value: d,
|
|
906
906
|
onChange: zn,
|
|
907
907
|
onSelect: x,
|
|
908
908
|
onPaste: Wn,
|
|
@@ -949,13 +949,13 @@ const Sn = (e, n = " ") => {
|
|
|
949
949
|
},
|
|
950
950
|
h
|
|
951
951
|
);
|
|
952
|
-
const
|
|
952
|
+
const d = De[t % De.length];
|
|
953
953
|
return s[f] = t++, /* @__PURE__ */ c(
|
|
954
954
|
ot,
|
|
955
955
|
{
|
|
956
956
|
token: o,
|
|
957
957
|
tokenKey: h,
|
|
958
|
-
color:
|
|
958
|
+
color: d,
|
|
959
959
|
className: `gs-token-type-${o.type}`
|
|
960
960
|
},
|
|
961
961
|
h
|
|
@@ -972,9 +972,9 @@ const Sn = (e, n = " ") => {
|
|
|
972
972
|
);
|
|
973
973
|
})
|
|
974
974
|
] });
|
|
975
|
-
},
|
|
975
|
+
}, xn = on({});
|
|
976
976
|
function Cr() {
|
|
977
|
-
const [e, n] =
|
|
977
|
+
const [e, n] = te(void 0), [t, s] = te();
|
|
978
978
|
return {
|
|
979
979
|
provided: !0,
|
|
980
980
|
store: e,
|
|
@@ -983,13 +983,13 @@ function Cr() {
|
|
|
983
983
|
setApply: s
|
|
984
984
|
};
|
|
985
985
|
}
|
|
986
|
-
function
|
|
987
|
-
const e =
|
|
986
|
+
function En() {
|
|
987
|
+
const e = le(xn);
|
|
988
988
|
return (e == null ? void 0 : e.provided) == null ? [!1, e] : [!0, e];
|
|
989
989
|
}
|
|
990
990
|
function Sr({ children: e, context: n }) {
|
|
991
|
-
const [t] =
|
|
992
|
-
return t ? /* @__PURE__ */ c(we, { children: e }) : /* @__PURE__ */ c(
|
|
991
|
+
const [t] = En();
|
|
992
|
+
return t ? /* @__PURE__ */ c(we, { children: e }) : /* @__PURE__ */ c(xn.Provider, { value: n, children: e });
|
|
993
993
|
}
|
|
994
994
|
const As = ({
|
|
995
995
|
sheetName: e,
|
|
@@ -1000,15 +1000,15 @@ const As = ({
|
|
|
1000
1000
|
editingOnEnter: o,
|
|
1001
1001
|
mode: i
|
|
1002
1002
|
}) => {
|
|
1003
|
-
const { store: h, dispatch: f } =
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
}, [e]),
|
|
1007
|
-
if (!
|
|
1003
|
+
const { store: h, dispatch: f } = le(ae), { sheetReactive: a } = h, d = a.current;
|
|
1004
|
+
z(() => {
|
|
1005
|
+
d && e && e !== d.name && (d.name = e, d.registry.sheetIdsByName[e] = d.id, delete d.registry.sheetIdsByName[d.prevName], d.prevName = e);
|
|
1006
|
+
}, [e]), z(() => {
|
|
1007
|
+
if (!d)
|
|
1008
1008
|
return;
|
|
1009
|
-
const { registry:
|
|
1010
|
-
requestAnimationFrame(() =>
|
|
1011
|
-
sheet:
|
|
1009
|
+
const { registry: g } = d;
|
|
1010
|
+
requestAnimationFrame(() => g.boot()), g.contextsBySheetId[d.id] = { store: h, dispatch: f }, g.transmit(), s && (s.current = {
|
|
1011
|
+
sheet: d,
|
|
1012
1012
|
apply: (m) => {
|
|
1013
1013
|
f(Ue(m));
|
|
1014
1014
|
}
|
|
@@ -1019,21 +1019,21 @@ const As = ({
|
|
|
1019
1019
|
},
|
|
1020
1020
|
dispatch: f
|
|
1021
1021
|
});
|
|
1022
|
-
}, [h,
|
|
1022
|
+
}, [h, d, s, r]), z(() => {
|
|
1023
1023
|
n && f(Se({ sheetHeight: n }));
|
|
1024
|
-
}, [n, f]),
|
|
1024
|
+
}, [n, f]), z(() => {
|
|
1025
1025
|
t && f(Se({ sheetWidth: t }));
|
|
1026
|
-
}, [t]),
|
|
1026
|
+
}, [t]), z(() => {
|
|
1027
1027
|
typeof o < "u" && f(Se({ editingOnEnter: o }));
|
|
1028
|
-
}, [o]),
|
|
1028
|
+
}, [o]), z(() => {
|
|
1029
1029
|
i && f(Se({ mode: i }));
|
|
1030
1030
|
}, [i]);
|
|
1031
|
-
const [w, b] =
|
|
1032
|
-
return
|
|
1031
|
+
const [w, b] = En();
|
|
1032
|
+
return z(() => {
|
|
1033
1033
|
w && (b.setStore(h), b.setApply(() => f));
|
|
1034
1034
|
}, [h, w, b]), /* @__PURE__ */ c(we, {});
|
|
1035
1035
|
}, Ms = () => {
|
|
1036
|
-
const { store: e, dispatch: n } =
|
|
1036
|
+
const { store: e, dispatch: n } = le(ae), {
|
|
1037
1037
|
resizingPositionY: t,
|
|
1038
1038
|
resizingPositionX: s,
|
|
1039
1039
|
sheetReactive: r,
|
|
@@ -1042,65 +1042,65 @@ const As = ({
|
|
|
1042
1042
|
selectingZone: h,
|
|
1043
1043
|
editorRef: f,
|
|
1044
1044
|
mainRef: a
|
|
1045
|
-
} = e,
|
|
1046
|
-
if (a.current == null || f.current == null || !
|
|
1045
|
+
} = e, d = r.current, [w, b, g] = t, [m, y, D] = s;
|
|
1046
|
+
if (a.current == null || f.current == null || !d)
|
|
1047
1047
|
return /* @__PURE__ */ c("div", { className: "gs-resizing gs-hidden" });
|
|
1048
|
-
const
|
|
1048
|
+
const E = d.getCell({ y: w === -1 ? 0 : w, x: m === -1 ? 0 : m }, { resolution: "SYSTEM" }), { y: S, x: $ } = a.current.getBoundingClientRect(), N = (E == null ? void 0 : E.width) || yt, M = (E == null ? void 0 : E.height) || vt, P = N + (D - y), X = M + (g - b);
|
|
1049
1049
|
return /* @__PURE__ */ F(
|
|
1050
1050
|
"div",
|
|
1051
1051
|
{
|
|
1052
1052
|
className: `gs-resizing ${w === -1 && m === -1 ? "gs-hidden" : ""}`,
|
|
1053
1053
|
onMouseUp: () => {
|
|
1054
|
-
const l =
|
|
1054
|
+
const l = ge(h), { top: u, left: v, bottom: x, right: T } = l, R = {};
|
|
1055
1055
|
if (m !== -1) {
|
|
1056
|
-
let
|
|
1057
|
-
i && Te({ start: v, end:
|
|
1058
|
-
|
|
1056
|
+
let B = [m];
|
|
1057
|
+
i && Te({ start: v, end: T }, m) && (B = Pt(v, T + 1)), B.forEach((q) => {
|
|
1058
|
+
R[Ne({ y: 0, x: q })] = { width: P };
|
|
1059
1059
|
});
|
|
1060
1060
|
}
|
|
1061
1061
|
if (w !== -1) {
|
|
1062
|
-
let
|
|
1063
|
-
o && Te({ start:
|
|
1064
|
-
|
|
1062
|
+
let B = [w];
|
|
1063
|
+
o && Te({ start: u, end: x }, w) && (B = Pt(u, x + 1)), B.forEach((q) => {
|
|
1064
|
+
R[Ne({ y: q, x: 0 })] = { height: X };
|
|
1065
1065
|
});
|
|
1066
1066
|
}
|
|
1067
|
-
|
|
1068
|
-
diff:
|
|
1067
|
+
d.update({
|
|
1068
|
+
diff: R,
|
|
1069
1069
|
partial: !0,
|
|
1070
1070
|
operator: "USER",
|
|
1071
|
-
undoReflection: { selectingZone: h, sheetId:
|
|
1071
|
+
undoReflection: { selectingZone: h, sheetId: d.id }
|
|
1072
1072
|
}), n(
|
|
1073
1073
|
Se({
|
|
1074
|
-
sheetReactive: { current:
|
|
1074
|
+
sheetReactive: { current: d }
|
|
1075
1075
|
})
|
|
1076
|
-
), n(gt([-1, -1, -1])), n(ht([-1, -1, -1])),
|
|
1076
|
+
), n(gt([-1, -1, -1])), n(ht([-1, -1, -1])), L(f.current);
|
|
1077
1077
|
},
|
|
1078
1078
|
onMouseMove: (l) => {
|
|
1079
1079
|
if (w !== -1) {
|
|
1080
|
-
let
|
|
1081
|
-
const v =
|
|
1082
|
-
v < Xt && (
|
|
1080
|
+
let u = l.clientY;
|
|
1081
|
+
const v = M + (u - b);
|
|
1082
|
+
v < Xt && (u += Xt - v), n(gt([w, b, u]));
|
|
1083
1083
|
} else if (m !== -1) {
|
|
1084
|
-
let
|
|
1085
|
-
const v =
|
|
1086
|
-
v < Ot && (
|
|
1084
|
+
let u = l.clientX;
|
|
1085
|
+
const v = N + (u - y);
|
|
1086
|
+
v < Ot && (u += Ot - v), n(ht([m, y, u]));
|
|
1087
1087
|
}
|
|
1088
1088
|
},
|
|
1089
1089
|
children: [
|
|
1090
|
-
/* @__PURE__ */ c("div", { className: `gs-line-vertical ${m === -1 ? "gs-hidden" : ""}`, children: /* @__PURE__ */ c("div", { className: "gs-line", style: { width: 1, height: "100%", left: D -
|
|
1091
|
-
|
|
1090
|
+
/* @__PURE__ */ c("div", { className: `gs-line-vertical ${m === -1 ? "gs-hidden" : ""}`, children: /* @__PURE__ */ c("div", { className: "gs-line", style: { width: 1, height: "100%", left: D - $ }, children: /* @__PURE__ */ F("span", { style: { left: "-50%" }, children: [
|
|
1091
|
+
P,
|
|
1092
1092
|
"px"
|
|
1093
1093
|
] }) }) }),
|
|
1094
|
-
/* @__PURE__ */ c("div", { className: `gs-line-horizontal ${w === -1 ? "gs-hidden" : ""}`, children: /* @__PURE__ */ c("div", { className: "gs-line", style: { width: "100%", height: 1, top:
|
|
1095
|
-
|
|
1094
|
+
/* @__PURE__ */ c("div", { className: `gs-line-horizontal ${w === -1 ? "gs-hidden" : ""}`, children: /* @__PURE__ */ c("div", { className: "gs-line", style: { width: "100%", height: 1, top: g - S }, children: /* @__PURE__ */ F("span", { style: { top: "-50%" }, children: [
|
|
1095
|
+
X,
|
|
1096
1096
|
"px"
|
|
1097
1097
|
] }) }) })
|
|
1098
1098
|
]
|
|
1099
1099
|
}
|
|
1100
1100
|
);
|
|
1101
1101
|
}, Ds = () => {
|
|
1102
|
-
const { store: e } =
|
|
1103
|
-
return
|
|
1102
|
+
const { store: e } = le(ae), { choosing: n, selectingZone: t, sheetReactive: s } = e, r = s.current;
|
|
1103
|
+
return z(() => {
|
|
1104
1104
|
r != null && r.isInitialized && r.currentVersion > 0 && r.registry.onChange && r.registry.onChange({
|
|
1105
1105
|
sheet: r,
|
|
1106
1106
|
points: {
|
|
@@ -1109,7 +1109,7 @@ const As = ({
|
|
|
1109
1109
|
selectingTo: { y: t.endY, x: t.endX }
|
|
1110
1110
|
}
|
|
1111
1111
|
});
|
|
1112
|
-
}, [s]),
|
|
1112
|
+
}, [s]), z(() => {
|
|
1113
1113
|
r && r.registry.onSelect && r.registry.onSelect({
|
|
1114
1114
|
sheet: r,
|
|
1115
1115
|
points: {
|
|
@@ -1121,10 +1121,10 @@ const As = ({
|
|
|
1121
1121
|
}, [n, t]), null;
|
|
1122
1122
|
}, kn = async ({ store: e, dispatch: n }) => {
|
|
1123
1123
|
const { editorRef: t } = e, s = et(e);
|
|
1124
|
-
n(dn(Ge(s))),
|
|
1124
|
+
n(dn(Ge(s))), L(t.current);
|
|
1125
1125
|
}, Tn = async ({ store: e, dispatch: n }) => {
|
|
1126
1126
|
const { editorRef: t } = e, s = et(e);
|
|
1127
|
-
n(cn(Ge(s))),
|
|
1127
|
+
n(cn(Ge(s))), L(t.current);
|
|
1128
1128
|
}, An = async ({ store: e, dispatch: n }, t = !1) => {
|
|
1129
1129
|
const { editorRef: s } = e, r = await navigator.clipboard.read();
|
|
1130
1130
|
let o = [];
|
|
@@ -1144,56 +1144,56 @@ const As = ({
|
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
1146
1146
|
}
|
|
1147
|
-
n(dt({ matrix: o, onlyValue: t })),
|
|
1147
|
+
n(dt({ matrix: o, onlyValue: t })), L(s.current);
|
|
1148
1148
|
}, Mn = async ({ store: e, dispatch: n }) => {
|
|
1149
1149
|
const { editorRef: t } = e;
|
|
1150
|
-
n(an(null)),
|
|
1150
|
+
n(an(null)), L(t.current);
|
|
1151
1151
|
}, Dn = async ({ store: e, dispatch: n }) => {
|
|
1152
1152
|
const { editorRef: t } = e;
|
|
1153
|
-
n(ct(null)),
|
|
1153
|
+
n(ct(null)), L(t.current);
|
|
1154
1154
|
}, Is = async ({ store: e, dispatch: n }) => {
|
|
1155
|
-
const { selectingZone: t, editorRef: s } = e, { top: r } =
|
|
1156
|
-
n(yn({ numRows: o, y: r, operator: "USER" })),
|
|
1155
|
+
const { selectingZone: t, editorRef: s } = e, { top: r } = ge(t), o = ne(t).rows;
|
|
1156
|
+
n(yn({ numRows: o, y: r, operator: "USER" })), L(s.current);
|
|
1157
1157
|
}, Fs = async ({ store: e, dispatch: n }) => {
|
|
1158
|
-
const { selectingZone: t, editorRef: s } = e, { bottom: r } =
|
|
1159
|
-
n(pn({ numRows: o, y: r, operator: "USER" })),
|
|
1158
|
+
const { selectingZone: t, editorRef: s } = e, { bottom: r } = ge(t), o = ne(t).rows;
|
|
1159
|
+
n(pn({ numRows: o, y: r, operator: "USER" })), L(s.current);
|
|
1160
1160
|
}, Ys = async ({ store: e, dispatch: n }) => {
|
|
1161
|
-
const { selectingZone: t, editorRef: s } = e, { left: r } =
|
|
1162
|
-
n(mn({ numCols: o, x: r, operator: "USER" })),
|
|
1161
|
+
const { selectingZone: t, editorRef: s } = e, { left: r } = ge(t), o = ne(t).cols;
|
|
1162
|
+
n(mn({ numCols: o, x: r, operator: "USER" })), L(s.current);
|
|
1163
1163
|
}, $s = async ({ store: e, dispatch: n }) => {
|
|
1164
|
-
const { selectingZone: t, editorRef: s } = e, { right: r } =
|
|
1165
|
-
n(fn({ numCols: o, x: r, operator: "USER" })),
|
|
1164
|
+
const { selectingZone: t, editorRef: s } = e, { right: r } = ge(t), o = ne(t).cols;
|
|
1165
|
+
n(fn({ numCols: o, x: r, operator: "USER" })), L(s.current);
|
|
1166
1166
|
}, Ps = async ({ store: e, dispatch: n }) => {
|
|
1167
|
-
const { selectingZone: t, editorRef: s } = e, { top: r } =
|
|
1168
|
-
n(hn({ numRows: o, y: r, operator: "USER" })),
|
|
1167
|
+
const { selectingZone: t, editorRef: s } = e, { top: r } = ge(t), o = ne(t).rows;
|
|
1168
|
+
n(hn({ numRows: o, y: r, operator: "USER" })), L(s.current);
|
|
1169
1169
|
}, Xs = async ({ store: e, dispatch: n }) => {
|
|
1170
|
-
const { selectingZone: t, editorRef: s } = e, { left: r } =
|
|
1171
|
-
n(gn({ numCols: o, x: r, operator: "USER" })),
|
|
1170
|
+
const { selectingZone: t, editorRef: s } = e, { left: r } = ge(t), o = ne(t).cols;
|
|
1171
|
+
n(gn({ numCols: o, x: r, operator: "USER" })), L(s.current);
|
|
1172
1172
|
}, In = async ({ store: e, dispatch: n }, t) => {
|
|
1173
1173
|
const s = e.sheetReactive.current;
|
|
1174
|
-
s && (s.hasPendingCells() || s.registry.asyncPending.size > 0) && await s.waitForPending(), n(Rt({ x: t, direction: "asc" })),
|
|
1174
|
+
s && (s.hasPendingCells() || s.registry.asyncPending.size > 0) && await s.waitForPending(), n(Rt({ x: t, direction: "asc" })), L(e.editorRef.current);
|
|
1175
1175
|
}, Fn = async ({ store: e, dispatch: n }, t) => {
|
|
1176
1176
|
const s = e.sheetReactive.current;
|
|
1177
|
-
s && (s.hasPendingCells() || s.registry.asyncPending.size > 0) && await s.waitForPending(), n(Rt({ x: t, direction: "desc" })),
|
|
1177
|
+
s && (s.hasPendingCells() || s.registry.asyncPending.size > 0) && await s.waitForPending(), n(Rt({ x: t, direction: "desc" })), L(e.editorRef.current);
|
|
1178
1178
|
}, Yn = async ({ store: e, dispatch: n }, t, s) => {
|
|
1179
1179
|
const r = e.sheetReactive.current;
|
|
1180
|
-
r && (r.hasPendingCells() || r.registry.asyncPending.size > 0) && await r.waitForPending(), n(Fe({ x: t, filter: s })),
|
|
1180
|
+
r && (r.hasPendingCells() || r.registry.asyncPending.size > 0) && await r.waitForPending(), n(Fe({ x: t, filter: s })), L(e.editorRef.current);
|
|
1181
1181
|
}, mt = async ({ store: e, dispatch: n }, t) => {
|
|
1182
|
-
n(Fe({ x: t })),
|
|
1182
|
+
n(Fe({ x: t })), L(e.editorRef.current);
|
|
1183
1183
|
}, $n = ({ store: e, dispatch: n }, t) => {
|
|
1184
1184
|
const s = e.sheetReactive.current;
|
|
1185
1185
|
if (!s)
|
|
1186
1186
|
return;
|
|
1187
1187
|
const r = Ne({ y: t, x: 0 }), o = s.getCell({ y: t, x: 0 }, { resolution: "SYSTEM" }), i = !(o != null && o.sortFixed) || void 0;
|
|
1188
|
-
s.update({ diff: { [r]: { sortFixed: i } }, partial: !0 }), n(Ue(s)),
|
|
1188
|
+
s.update({ diff: { [r]: { sortFixed: i } }, partial: !0 }), n(Ue(s)), L(e.editorRef.current);
|
|
1189
1189
|
}, Pn = ({ store: e, dispatch: n }, t) => {
|
|
1190
1190
|
const s = e.sheetReactive.current;
|
|
1191
1191
|
if (!s)
|
|
1192
1192
|
return;
|
|
1193
1193
|
const r = Ne({ y: t, x: 0 }), o = s.getCell({ y: t, x: 0 }, { resolution: "SYSTEM" }), i = !(o != null && o.filterFixed) || void 0;
|
|
1194
|
-
s.update({ diff: { [r]: { filterFixed: i } }, partial: !0 }), n(Ue(s)),
|
|
1194
|
+
s.update({ diff: { [r]: { filterFixed: i } }, partial: !0 }), n(Ue(s)), L(e.editorRef.current);
|
|
1195
1195
|
}, Xn = async ({ store: e, dispatch: n }) => {
|
|
1196
|
-
typeof e.searchQuery > "u" && n($e("")), n(un(!1)), requestAnimationFrame(() =>
|
|
1196
|
+
typeof e.searchQuery > "u" && n($e("")), n(un(!1)), requestAnimationFrame(() => L(e.searchInputRef.current));
|
|
1197
1197
|
}, Nr = {
|
|
1198
1198
|
copy: kn,
|
|
1199
1199
|
cut: Tn,
|
|
@@ -1248,80 +1248,80 @@ const As = ({
|
|
|
1248
1248
|
{
|
|
1249
1249
|
id: "insert-rows-above",
|
|
1250
1250
|
label: (e) => {
|
|
1251
|
-
const n =
|
|
1251
|
+
const n = ne(e.selectingZone).rows;
|
|
1252
1252
|
return `Insert ${n} row${n > 1 ? "s" : ""} above`;
|
|
1253
1253
|
},
|
|
1254
1254
|
visible: (e) => e.leftHeaderSelecting,
|
|
1255
1255
|
disabled: (e) => {
|
|
1256
|
-
const n =
|
|
1257
|
-
return t.maxNumRows !== -1 && t.numRows + n > t.maxNumRows ||
|
|
1256
|
+
const n = ne(e.selectingZone).rows, t = e.sheet, s = t.getCell({ y: e.choosing.y, x: 0 }, { resolution: "SYSTEM" });
|
|
1257
|
+
return t.maxNumRows !== -1 && t.numRows + n > t.maxNumRows || H.hasOperation(s == null ? void 0 : s.prevention, H.InsertRowsAbove);
|
|
1258
1258
|
},
|
|
1259
|
-
onClick: (e) => e.insertRowsAbove(e.choosing.y,
|
|
1259
|
+
onClick: (e) => e.insertRowsAbove(e.choosing.y, ne(e.selectingZone).rows)
|
|
1260
1260
|
},
|
|
1261
1261
|
{
|
|
1262
1262
|
id: "insert-rows-below",
|
|
1263
1263
|
label: (e) => {
|
|
1264
|
-
const n =
|
|
1264
|
+
const n = ne(e.selectingZone).rows;
|
|
1265
1265
|
return `Insert ${n} row${n > 1 ? "s" : ""} below`;
|
|
1266
1266
|
},
|
|
1267
1267
|
visible: (e) => e.leftHeaderSelecting,
|
|
1268
1268
|
disabled: (e) => {
|
|
1269
|
-
const n =
|
|
1270
|
-
return t.maxNumRows !== -1 && t.numRows + n > t.maxNumRows ||
|
|
1269
|
+
const n = ne(e.selectingZone).rows, t = e.sheet, s = t.getCell({ y: e.choosing.y, x: 0 }, { resolution: "SYSTEM" });
|
|
1270
|
+
return t.maxNumRows !== -1 && t.numRows + n > t.maxNumRows || H.hasOperation(s == null ? void 0 : s.prevention, H.InsertRowsBelow);
|
|
1271
1271
|
},
|
|
1272
|
-
onClick: (e) => e.insertRowsBelow(e.choosing.y,
|
|
1272
|
+
onClick: (e) => e.insertRowsBelow(e.choosing.y, ne(e.selectingZone).rows)
|
|
1273
1273
|
},
|
|
1274
1274
|
{
|
|
1275
1275
|
id: "insert-cols-left",
|
|
1276
1276
|
label: (e) => {
|
|
1277
|
-
const n =
|
|
1277
|
+
const n = ne(e.selectingZone).cols;
|
|
1278
1278
|
return `Insert ${n} column${n > 1 ? "s" : ""} left`;
|
|
1279
1279
|
},
|
|
1280
1280
|
visible: (e) => e.topHeaderSelecting,
|
|
1281
1281
|
disabled: (e) => {
|
|
1282
|
-
const n =
|
|
1283
|
-
return t.maxNumCols !== -1 && t.numCols + n > t.maxNumCols ||
|
|
1282
|
+
const n = ne(e.selectingZone).cols, t = e.sheet, s = t.getCell({ y: 0, x: e.choosing.x }, { resolution: "SYSTEM" });
|
|
1283
|
+
return t.maxNumCols !== -1 && t.numCols + n > t.maxNumCols || H.hasOperation(s == null ? void 0 : s.prevention, H.InsertColsLeft);
|
|
1284
1284
|
},
|
|
1285
|
-
onClick: (e) => e.insertColsLeft(e.choosing.x,
|
|
1285
|
+
onClick: (e) => e.insertColsLeft(e.choosing.x, ne(e.selectingZone).cols)
|
|
1286
1286
|
},
|
|
1287
1287
|
{
|
|
1288
1288
|
id: "insert-cols-right",
|
|
1289
1289
|
label: (e) => {
|
|
1290
|
-
const n =
|
|
1290
|
+
const n = ne(e.selectingZone).cols;
|
|
1291
1291
|
return `Insert ${n} column${n > 1 ? "s" : ""} right`;
|
|
1292
1292
|
},
|
|
1293
1293
|
visible: (e) => e.topHeaderSelecting,
|
|
1294
1294
|
disabled: (e) => {
|
|
1295
|
-
const n =
|
|
1296
|
-
return t.maxNumCols !== -1 && t.numCols + n > t.maxNumCols ||
|
|
1295
|
+
const n = ne(e.selectingZone).cols, t = e.sheet, s = t.getCell({ y: 0, x: e.choosing.x }, { resolution: "SYSTEM" });
|
|
1296
|
+
return t.maxNumCols !== -1 && t.numCols + n > t.maxNumCols || H.hasOperation(s == null ? void 0 : s.prevention, H.InsertColsRight);
|
|
1297
1297
|
},
|
|
1298
|
-
onClick: (e) => e.insertColsRight(e.choosing.x,
|
|
1298
|
+
onClick: (e) => e.insertColsRight(e.choosing.x, ne(e.selectingZone).cols)
|
|
1299
1299
|
},
|
|
1300
1300
|
{
|
|
1301
1301
|
id: "remove-rows",
|
|
1302
1302
|
label: (e) => {
|
|
1303
|
-
const n =
|
|
1303
|
+
const n = ne(e.selectingZone).rows;
|
|
1304
1304
|
return `Remove ${n} row${n > 1 ? "s" : ""}`;
|
|
1305
1305
|
},
|
|
1306
1306
|
visible: (e) => e.leftHeaderSelecting,
|
|
1307
1307
|
disabled: (e) => {
|
|
1308
|
-
const n =
|
|
1309
|
-
return t.minNumRows !== -1 && t.numRows - n < t.minNumRows ||
|
|
1308
|
+
const n = ne(e.selectingZone).rows, t = e.sheet, s = t.getCell({ y: e.choosing.y, x: 0 }, { resolution: "SYSTEM" });
|
|
1309
|
+
return t.minNumRows !== -1 && t.numRows - n < t.minNumRows || H.hasOperation(s == null ? void 0 : s.prevention, H.RemoveRows);
|
|
1310
1310
|
},
|
|
1311
|
-
onClick: (e) => e.removeRows(e.choosing.y,
|
|
1311
|
+
onClick: (e) => e.removeRows(e.choosing.y, ne(e.selectingZone).rows)
|
|
1312
1312
|
},
|
|
1313
1313
|
{
|
|
1314
1314
|
id: "remove-cols",
|
|
1315
1315
|
label: (e) => {
|
|
1316
|
-
const n =
|
|
1316
|
+
const n = ne(e.selectingZone).cols;
|
|
1317
1317
|
return `Remove ${n} column${n > 1 ? "s" : ""}`;
|
|
1318
1318
|
},
|
|
1319
1319
|
visible: (e) => e.topHeaderSelecting,
|
|
1320
1320
|
disabled: (e) => {
|
|
1321
|
-
const n =
|
|
1322
|
-
return t.minNumCols !== -1 && t.numCols - n < t.minNumCols ||
|
|
1321
|
+
const n = ne(e.selectingZone).cols, t = e.sheet, s = t.getCell({ y: 0, x: e.choosing.x }, { resolution: "SYSTEM" });
|
|
1322
|
+
return t.minNumCols !== -1 && t.numCols - n < t.minNumCols || H.hasOperation(s == null ? void 0 : s.prevention, H.RemoveCols);
|
|
1323
1323
|
},
|
|
1324
|
-
onClick: (e) => e.removeCols(e.choosing.x,
|
|
1324
|
+
onClick: (e) => e.removeCols(e.choosing.x, ne(e.selectingZone).cols)
|
|
1325
1325
|
},
|
|
1326
1326
|
{ type: "divider" },
|
|
1327
1327
|
{
|
|
@@ -1379,7 +1379,7 @@ const As = ({
|
|
|
1379
1379
|
},
|
|
1380
1380
|
disabled: (e, n) => {
|
|
1381
1381
|
const t = Re(e, n), s = e.sheet, r = s.getCell({ y: n, x: 0 }, { resolution: "SYSTEM" });
|
|
1382
|
-
return s.maxNumRows !== -1 && s.numRows + t > s.maxNumRows ||
|
|
1382
|
+
return s.maxNumRows !== -1 && s.numRows + t > s.maxNumRows || H.hasOperation(r == null ? void 0 : r.prevention, H.InsertRowsAbove);
|
|
1383
1383
|
},
|
|
1384
1384
|
onClick: (e, n) => e.insertRowsAbove(n, Re(e, n))
|
|
1385
1385
|
},
|
|
@@ -1391,7 +1391,7 @@ const As = ({
|
|
|
1391
1391
|
},
|
|
1392
1392
|
disabled: (e, n) => {
|
|
1393
1393
|
const t = Re(e, n), s = e.sheet, r = s.getCell({ y: n, x: 0 }, { resolution: "SYSTEM" });
|
|
1394
|
-
return s.maxNumRows !== -1 && s.numRows + t > s.maxNumRows ||
|
|
1394
|
+
return s.maxNumRows !== -1 && s.numRows + t > s.maxNumRows || H.hasOperation(r == null ? void 0 : r.prevention, H.InsertRowsBelow);
|
|
1395
1395
|
},
|
|
1396
1396
|
onClick: (e, n) => e.insertRowsBelow(n, Re(e, n))
|
|
1397
1397
|
},
|
|
@@ -1403,7 +1403,7 @@ const As = ({
|
|
|
1403
1403
|
},
|
|
1404
1404
|
disabled: (e, n) => {
|
|
1405
1405
|
const t = Re(e, n), s = e.sheet, r = s.getCell({ y: n, x: 0 }, { resolution: "SYSTEM" });
|
|
1406
|
-
return s.minNumRows !== -1 && s.numRows - t < s.minNumRows ||
|
|
1406
|
+
return s.minNumRows !== -1 && s.numRows - t < s.minNumRows || H.hasOperation(r == null ? void 0 : r.prevention, H.RemoveRows);
|
|
1407
1407
|
},
|
|
1408
1408
|
onClick: (e, n) => e.removeRows(n, Re(e, n))
|
|
1409
1409
|
},
|
|
@@ -1471,7 +1471,7 @@ const As = ({
|
|
|
1471
1471
|
},
|
|
1472
1472
|
disabled: (e, n) => {
|
|
1473
1473
|
const t = Ce(e, n), s = e.sheet, r = s.getCell({ y: 0, x: n }, { resolution: "SYSTEM" });
|
|
1474
|
-
return s.maxNumCols !== -1 && s.numCols + t > s.maxNumCols ||
|
|
1474
|
+
return s.maxNumCols !== -1 && s.numCols + t > s.maxNumCols || H.hasOperation(r == null ? void 0 : r.prevention, H.InsertColsLeft);
|
|
1475
1475
|
},
|
|
1476
1476
|
onClick: (e, n) => e.insertColsLeft(n, Ce(e, n))
|
|
1477
1477
|
},
|
|
@@ -1483,7 +1483,7 @@ const As = ({
|
|
|
1483
1483
|
},
|
|
1484
1484
|
disabled: (e, n) => {
|
|
1485
1485
|
const t = Ce(e, n), s = e.sheet, r = s.getCell({ y: 0, x: n }, { resolution: "SYSTEM" });
|
|
1486
|
-
return s.maxNumCols !== -1 && s.numCols + t > s.maxNumCols ||
|
|
1486
|
+
return s.maxNumCols !== -1 && s.numCols + t > s.maxNumCols || H.hasOperation(r == null ? void 0 : r.prevention, H.InsertColsRight);
|
|
1487
1487
|
},
|
|
1488
1488
|
onClick: (e, n) => e.insertColsRight(n, Ce(e, n))
|
|
1489
1489
|
},
|
|
@@ -1495,7 +1495,7 @@ const As = ({
|
|
|
1495
1495
|
},
|
|
1496
1496
|
disabled: (e, n) => {
|
|
1497
1497
|
const t = Ce(e, n), s = e.sheet, r = s.getCell({ y: 0, x: n }, { resolution: "SYSTEM" });
|
|
1498
|
-
return s.minNumCols !== -1 && s.numCols - t < s.minNumCols ||
|
|
1498
|
+
return s.minNumCols !== -1 && s.numCols - t < s.minNumCols || H.hasOperation(r == null ? void 0 : r.prevention, H.RemoveCols);
|
|
1499
1499
|
},
|
|
1500
1500
|
onClick: (e, n) => e.removeCols(n, Ce(e, n))
|
|
1501
1501
|
},
|
|
@@ -1573,13 +1573,13 @@ function Nt(e, n, t) {
|
|
|
1573
1573
|
};
|
|
1574
1574
|
}
|
|
1575
1575
|
const On = /* @__PURE__ */ new Map();
|
|
1576
|
-
function
|
|
1576
|
+
function xt(e, n) {
|
|
1577
1577
|
On.set(e, n);
|
|
1578
1578
|
}
|
|
1579
1579
|
function Bs(e) {
|
|
1580
1580
|
return On.get(e);
|
|
1581
1581
|
}
|
|
1582
|
-
const
|
|
1582
|
+
const Et = ({
|
|
1583
1583
|
label: e,
|
|
1584
1584
|
shortcuts: n,
|
|
1585
1585
|
disabled: t = !1,
|
|
@@ -1603,18 +1603,18 @@ const xt = ({
|
|
|
1603
1603
|
n != null && n.length > 0 && /* @__PURE__ */ c("div", { className: "gs-menu-shortcut", children: n.map((f, a) => /* @__PURE__ */ F("span", { children: [
|
|
1604
1604
|
a > 0 && /* @__PURE__ */ c("span", { className: "gs-menu-shortcut-sep", children: ", " }),
|
|
1605
1605
|
/* @__PURE__ */ c("span", { className: "gs-menu-shortcut-badge", children: f.split("+").map(
|
|
1606
|
-
(
|
|
1607
|
-
|
|
1606
|
+
(d, w, b) => w < b.length - 1 ? /* @__PURE__ */ F("span", { children: [
|
|
1607
|
+
d,
|
|
1608
1608
|
"+"
|
|
1609
|
-
] }, w) : /* @__PURE__ */ c("span", { className: "gs-menu-underline", children:
|
|
1609
|
+
] }, w) : /* @__PURE__ */ c("span", { className: "gs-menu-underline", children: d }, w)
|
|
1610
1610
|
) })
|
|
1611
1611
|
] }, a)) })
|
|
1612
1612
|
]
|
|
1613
1613
|
}
|
|
1614
1614
|
);
|
|
1615
1615
|
}, kt = () => /* @__PURE__ */ c("li", { className: "gs-menu-divider" }), Ks = () => {
|
|
1616
|
-
const { store: e, dispatch: n } =
|
|
1617
|
-
if (
|
|
1616
|
+
const { store: e, dispatch: n } = le(ae), { contextMenuPosition: t, contextMenu: s } = e, { y: r, x: o } = t, i = ie(null);
|
|
1617
|
+
if (z(() => {
|
|
1618
1618
|
i.current && Jt(i.current);
|
|
1619
1619
|
}), r === -1)
|
|
1620
1620
|
return null;
|
|
@@ -1624,24 +1624,24 @@ const xt = ({
|
|
|
1624
1624
|
{
|
|
1625
1625
|
className: "gs-menu-modal gs-context-menu-modal",
|
|
1626
1626
|
onClick: (a) => (a.preventDefault(), h(), !1),
|
|
1627
|
-
children: /* @__PURE__ */ c("div", { ref: i, className: "gs-context-menu", style: { top: r, left: o }, children: /* @__PURE__ */ c("ul", { className: "gs-menu-items", children: s.map((a,
|
|
1628
|
-
var D,
|
|
1627
|
+
children: /* @__PURE__ */ c("div", { ref: i, className: "gs-context-menu", style: { top: r, left: o }, children: /* @__PURE__ */ c("ul", { className: "gs-menu-items", children: s.map((a, d) => {
|
|
1628
|
+
var D, E;
|
|
1629
1629
|
if (a.type === "divider")
|
|
1630
|
-
return a.visible && !a.visible(f) ? null : /* @__PURE__ */ c(kt, {},
|
|
1630
|
+
return a.visible && !a.visible(f) ? null : /* @__PURE__ */ c(kt, {}, d);
|
|
1631
1631
|
if (a.type === "component" || !(!a.visible || a.visible(f)))
|
|
1632
1632
|
return null;
|
|
1633
|
-
const b = ((D = a.disabled) == null ? void 0 : D.call(a, f)) ?? !1,
|
|
1633
|
+
const b = ((D = a.disabled) == null ? void 0 : D.call(a, f)) ?? !1, g = typeof a.label == "function" ? a.label(f) : a.label, m = typeof a.shortcuts == "function" ? a.shortcuts(f) : a.shortcuts, y = (E = a.checked) == null ? void 0 : E.call(a, f);
|
|
1634
1634
|
return /* @__PURE__ */ c(
|
|
1635
|
-
|
|
1635
|
+
Et,
|
|
1636
1636
|
{
|
|
1637
|
-
label:
|
|
1637
|
+
label: g,
|
|
1638
1638
|
shortcuts: m,
|
|
1639
1639
|
disabled: b,
|
|
1640
1640
|
checked: y,
|
|
1641
1641
|
testId: a.id ? `${a.id}-item` : void 0,
|
|
1642
1642
|
onClick: () => a.onClick(f)
|
|
1643
1643
|
},
|
|
1644
|
-
|
|
1644
|
+
d
|
|
1645
1645
|
);
|
|
1646
1646
|
}) }) })
|
|
1647
1647
|
}
|
|
@@ -1658,62 +1658,62 @@ const xt = ({
|
|
|
1658
1658
|
includes: "Includes",
|
|
1659
1659
|
excludes: "Excludes"
|
|
1660
1660
|
}, qt = ["blank", "nonblank"], je = { method: "eq", value: [""] }, Zs = ({ x: e, close: n, onWaiting: t }) => {
|
|
1661
|
-
const { store: s, dispatch: r } =
|
|
1662
|
-
(
|
|
1663
|
-
|
|
1661
|
+
const { store: s, dispatch: r } = le(ae), { sheetReactive: o } = s, i = o.current, [h, f] = te([{ ...je }]), [a, d] = te("or"), [w, b] = te(null), g = A(
|
|
1662
|
+
(C) => {
|
|
1663
|
+
C && C.focus();
|
|
1664
1664
|
},
|
|
1665
1665
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1666
1666
|
[e]
|
|
1667
1667
|
);
|
|
1668
|
-
|
|
1668
|
+
z(() => {
|
|
1669
1669
|
if (i) {
|
|
1670
|
-
const
|
|
1671
|
-
p && p.conditions.length > 0 ? (f(p.conditions.map((l) => ({ ...l, value: [...l.value] }))),
|
|
1670
|
+
const C = i.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), p = C == null ? void 0 : C.filter;
|
|
1671
|
+
p && p.conditions.length > 0 ? (f(p.conditions.map((l) => ({ ...l, value: [...l.value] }))), d(p.mode || "or")) : (f([{ ...je, value: [""] }]), d("or"));
|
|
1672
1672
|
}
|
|
1673
1673
|
}, [e, i]);
|
|
1674
|
-
const m =
|
|
1674
|
+
const m = A(() => {
|
|
1675
1675
|
b(null), t == null || t(null), n();
|
|
1676
1676
|
}, [n, t]);
|
|
1677
|
-
|
|
1677
|
+
z(() => {
|
|
1678
1678
|
w && (t == null || t("Filtering…", m));
|
|
1679
|
-
}, [w]),
|
|
1679
|
+
}, [w]), z(() => {
|
|
1680
1680
|
if (!w)
|
|
1681
1681
|
return;
|
|
1682
|
-
let
|
|
1682
|
+
let C = !1;
|
|
1683
1683
|
const p = () => {
|
|
1684
|
-
if (
|
|
1684
|
+
if (C || !o.current)
|
|
1685
1685
|
return;
|
|
1686
|
-
const { x: v, conditions: x, mode:
|
|
1687
|
-
x.length > 0 ? r(Fe({ x: v, filter: { mode:
|
|
1686
|
+
const { x: v, conditions: x, mode: T } = w;
|
|
1687
|
+
x.length > 0 ? r(Fe({ x: v, filter: { mode: T, conditions: x } })) : r(Fe({ x: v })), t == null || t(null), b(null), n();
|
|
1688
1688
|
}, l = o.current;
|
|
1689
1689
|
return l && (l.hasPendingCells() || l.registry.asyncPending.size > 0) ? l.waitForPending().then(p) : p(), () => {
|
|
1690
|
-
|
|
1690
|
+
C = !0;
|
|
1691
1691
|
};
|
|
1692
1692
|
}, [w]);
|
|
1693
|
-
const y =
|
|
1693
|
+
const y = A((C, p) => {
|
|
1694
1694
|
f((l) => {
|
|
1695
|
-
const
|
|
1696
|
-
return
|
|
1695
|
+
const u = [...l];
|
|
1696
|
+
return u[C] = { ...u[C], ...p }, u;
|
|
1697
1697
|
});
|
|
1698
|
-
}, []), D =
|
|
1699
|
-
f((
|
|
1700
|
-
}, []),
|
|
1701
|
-
f((p) => p.length <= 1 ? [{ ...je, value: [""] }] : p.filter((l,
|
|
1702
|
-
}, []),
|
|
1703
|
-
const
|
|
1704
|
-
b({ x: e, conditions:
|
|
1705
|
-
}, [e, h, a]),
|
|
1698
|
+
}, []), D = A(() => {
|
|
1699
|
+
f((C) => [...C, { ...je, value: [""] }]);
|
|
1700
|
+
}, []), E = A((C) => {
|
|
1701
|
+
f((p) => p.length <= 1 ? [{ ...je, value: [""] }] : p.filter((l, u) => u !== C));
|
|
1702
|
+
}, []), S = A(() => {
|
|
1703
|
+
const C = h.filter((p) => qt.includes(p.method) ? !0 : p.value.some((l) => l.trim() !== ""));
|
|
1704
|
+
b({ x: e, conditions: C, mode: a });
|
|
1705
|
+
}, [e, h, a]), $ = A(() => {
|
|
1706
1706
|
b(null), r(Fe({ x: e })), n();
|
|
1707
|
-
}, [r, e, n]),
|
|
1707
|
+
}, [r, e, n]), N = A(() => {
|
|
1708
1708
|
b(null), r(Fe({})), n();
|
|
1709
1709
|
}, [r, n]);
|
|
1710
1710
|
if (!i)
|
|
1711
1711
|
return null;
|
|
1712
|
-
const
|
|
1713
|
-
return /* @__PURE__ */ c("li", { className: `gs-column-menu-filter${
|
|
1712
|
+
const M = i.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), P = H.hasOperation(M == null ? void 0 : M.prevention, H.Filter), X = i.hasActiveFilters();
|
|
1713
|
+
return /* @__PURE__ */ c("li", { className: `gs-column-menu-filter${P ? " gs-disabled" : ""}`, children: /* @__PURE__ */ F(we, { children: [
|
|
1714
1714
|
/* @__PURE__ */ F("div", { className: "gs-filter-header", children: [
|
|
1715
1715
|
/* @__PURE__ */ c("div", { className: "gs-menu-name", children: "Filter:" }),
|
|
1716
|
-
/* @__PURE__ */ c("button", { className: "gs-filter-add-btn", onClick: D, disabled:
|
|
1716
|
+
/* @__PURE__ */ c("button", { className: "gs-filter-add-btn", onClick: D, disabled: P, children: "+ ADD" }),
|
|
1717
1717
|
/* @__PURE__ */ F("div", { className: `gs-filter-mode-toggle${h.length <= 1 ? " gs-disabled" : ""}`, children: [
|
|
1718
1718
|
/* @__PURE__ */ F("label", { className: a === "and" ? "gs-active" : "", children: [
|
|
1719
1719
|
/* @__PURE__ */ c(
|
|
@@ -1722,8 +1722,8 @@ const xt = ({
|
|
|
1722
1722
|
type: "radio",
|
|
1723
1723
|
name: "gs-filter-mode",
|
|
1724
1724
|
checked: a === "and",
|
|
1725
|
-
onChange: () =>
|
|
1726
|
-
disabled:
|
|
1725
|
+
onChange: () => d("and"),
|
|
1726
|
+
disabled: P || h.length <= 1
|
|
1727
1727
|
}
|
|
1728
1728
|
),
|
|
1729
1729
|
"AND"
|
|
@@ -1735,39 +1735,39 @@ const xt = ({
|
|
|
1735
1735
|
type: "radio",
|
|
1736
1736
|
name: "gs-filter-mode",
|
|
1737
1737
|
checked: a === "or",
|
|
1738
|
-
onChange: () =>
|
|
1739
|
-
disabled:
|
|
1738
|
+
onChange: () => d("or"),
|
|
1739
|
+
disabled: P || h.length <= 1
|
|
1740
1740
|
}
|
|
1741
1741
|
),
|
|
1742
1742
|
"OR"
|
|
1743
1743
|
] })
|
|
1744
1744
|
] })
|
|
1745
1745
|
] }),
|
|
1746
|
-
/* @__PURE__ */ c("div", { className: "gs-filter-conditions", children: h.map((
|
|
1746
|
+
/* @__PURE__ */ c("div", { className: "gs-filter-conditions", children: h.map((C, p) => /* @__PURE__ */ F("div", { className: "gs-filter-condition-row", children: [
|
|
1747
1747
|
/* @__PURE__ */ c(
|
|
1748
1748
|
"select",
|
|
1749
1749
|
{
|
|
1750
1750
|
className: "gs-filter-method-select",
|
|
1751
|
-
value:
|
|
1752
|
-
disabled:
|
|
1751
|
+
value: C.method,
|
|
1752
|
+
disabled: P,
|
|
1753
1753
|
tabIndex: p * 2 + 1,
|
|
1754
1754
|
onChange: (l) => y(p, { method: l.target.value }),
|
|
1755
1755
|
children: Object.keys(Vt).map((l) => /* @__PURE__ */ c("option", { value: l, children: Vt[l] }, l))
|
|
1756
1756
|
}
|
|
1757
1757
|
),
|
|
1758
|
-
!qt.includes(
|
|
1758
|
+
!qt.includes(C.method) && /* @__PURE__ */ c(
|
|
1759
1759
|
"input",
|
|
1760
1760
|
{
|
|
1761
|
-
ref: p === 0 ?
|
|
1761
|
+
ref: p === 0 ? g : void 0,
|
|
1762
1762
|
className: "gs-filter-value-input",
|
|
1763
1763
|
type: "text",
|
|
1764
1764
|
placeholder: "Value",
|
|
1765
|
-
value:
|
|
1766
|
-
disabled:
|
|
1765
|
+
value: C.value[0] || "",
|
|
1766
|
+
disabled: P,
|
|
1767
1767
|
tabIndex: p * 2 + 2,
|
|
1768
1768
|
onChange: (l) => y(p, { value: [l.target.value] }),
|
|
1769
1769
|
onKeyDown: (l) => {
|
|
1770
|
-
l.nativeEvent.isComposing || (l.key === "Enter" &&
|
|
1770
|
+
l.nativeEvent.isComposing || (l.key === "Enter" && S(), l.key === "Escape" && n());
|
|
1771
1771
|
}
|
|
1772
1772
|
}
|
|
1773
1773
|
),
|
|
@@ -1775,42 +1775,42 @@ const xt = ({
|
|
|
1775
1775
|
"button",
|
|
1776
1776
|
{
|
|
1777
1777
|
className: "gs-filter-remove-btn",
|
|
1778
|
-
onClick: () =>
|
|
1779
|
-
disabled:
|
|
1778
|
+
onClick: () => E(p),
|
|
1779
|
+
disabled: P,
|
|
1780
1780
|
title: "Remove condition",
|
|
1781
1781
|
children: "✕"
|
|
1782
1782
|
}
|
|
1783
1783
|
)
|
|
1784
1784
|
] }, p)) }),
|
|
1785
1785
|
/* @__PURE__ */ F("div", { className: "gs-filter-actions", children: [
|
|
1786
|
-
|
|
1786
|
+
X && /* @__PURE__ */ c("button", { className: "gs-filter-reset-all-btn", onClick: N, children: "RESET ALL" }),
|
|
1787
1787
|
/* @__PURE__ */ F("div", { className: "gs-filter-actions-right", children: [
|
|
1788
|
-
(
|
|
1789
|
-
/* @__PURE__ */ c("button", { className: "gs-filter-apply-btn", onClick:
|
|
1788
|
+
(M == null ? void 0 : M.filter) && /* @__PURE__ */ c("button", { className: "gs-filter-reset-btn", onClick: $, children: "RESET" }),
|
|
1789
|
+
/* @__PURE__ */ c("button", { className: "gs-filter-apply-btn", onClick: S, disabled: P, children: "APPLY" })
|
|
1790
1790
|
] })
|
|
1791
1791
|
] })
|
|
1792
1792
|
] }) });
|
|
1793
1793
|
};
|
|
1794
|
-
|
|
1794
|
+
xt("col-filter", Zs);
|
|
1795
1795
|
const Us = ({ x: e, close: n, onWaiting: t }) => {
|
|
1796
|
-
const { store: s, dispatch: r } =
|
|
1796
|
+
const { store: s, dispatch: r } = le(ae), { sheetReactive: o } = s, i = o.current, [h, f] = te(null), a = A(() => {
|
|
1797
1797
|
f(null), t == null || t(null), n();
|
|
1798
1798
|
}, [n, t]);
|
|
1799
|
-
if (
|
|
1799
|
+
if (z(() => {
|
|
1800
1800
|
h && (t == null || t("Sorting…", a));
|
|
1801
|
-
}, [h]),
|
|
1801
|
+
}, [h]), z(() => {
|
|
1802
1802
|
if (!h)
|
|
1803
1803
|
return;
|
|
1804
1804
|
let b = !1;
|
|
1805
|
-
const
|
|
1805
|
+
const g = () => {
|
|
1806
1806
|
b || !o.current || (r(Rt({ x: h.x, direction: h.direction })), t == null || t(null), f(null), n());
|
|
1807
1807
|
}, m = o.current;
|
|
1808
|
-
return m && (m.hasPendingCells() || m.registry.asyncPending.size > 0) ? m.waitForPending().then(
|
|
1808
|
+
return m && (m.hasPendingCells() || m.registry.asyncPending.size > 0) ? m.waitForPending().then(g) : g(), () => {
|
|
1809
1809
|
b = !0;
|
|
1810
1810
|
};
|
|
1811
1811
|
}, [h]), !i)
|
|
1812
1812
|
return null;
|
|
1813
|
-
const
|
|
1813
|
+
const d = i.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), w = H.hasOperation(d == null ? void 0 : d.prevention, H.Sort);
|
|
1814
1814
|
return /* @__PURE__ */ F("li", { className: `gs-menu-item gs-column-menu-sort${w ? " gs-disabled" : ""}`, children: [
|
|
1815
1815
|
/* @__PURE__ */ c("div", { className: "gs-menu-name", children: "Sort:" }),
|
|
1816
1816
|
/* @__PURE__ */ F("div", { className: "gs-sort-buttons", children: [
|
|
@@ -1839,21 +1839,21 @@ const Us = ({ x: e, close: n, onWaiting: t }) => {
|
|
|
1839
1839
|
] })
|
|
1840
1840
|
] });
|
|
1841
1841
|
};
|
|
1842
|
-
|
|
1842
|
+
xt("col-sort", Us);
|
|
1843
1843
|
const zs = ({ x: e, close: n }) => {
|
|
1844
|
-
const { store: t, dispatch: s } =
|
|
1845
|
-
|
|
1844
|
+
const { store: t, dispatch: s } = le(ae), { sheetReactive: r } = t, o = r.current, i = ie(null), [h, f] = te("");
|
|
1845
|
+
z(() => {
|
|
1846
1846
|
if (o) {
|
|
1847
|
-
const
|
|
1848
|
-
f((
|
|
1847
|
+
const g = o.getCell({ y: 0, x: e }, { resolution: "SYSTEM" });
|
|
1848
|
+
f((g == null ? void 0 : g.label) ?? "");
|
|
1849
1849
|
}
|
|
1850
1850
|
}, [e, o]);
|
|
1851
|
-
const a =
|
|
1851
|
+
const a = A(() => {
|
|
1852
1852
|
if (!o)
|
|
1853
1853
|
return;
|
|
1854
|
-
const
|
|
1854
|
+
const g = Ne({ y: 0, x: e });
|
|
1855
1855
|
o.update({
|
|
1856
|
-
diff: { [
|
|
1856
|
+
diff: { [g]: { label: h || void 0 } },
|
|
1857
1857
|
partial: !0,
|
|
1858
1858
|
ignoreFields: [],
|
|
1859
1859
|
undoReflection: {
|
|
@@ -1870,7 +1870,7 @@ const zs = ({ x: e, close: n }) => {
|
|
|
1870
1870
|
}, [s, e, h, n, o, t.selectingZone, t.choosing]);
|
|
1871
1871
|
if (!o)
|
|
1872
1872
|
return null;
|
|
1873
|
-
const
|
|
1873
|
+
const d = o.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), w = H.hasOperation(d == null ? void 0 : d.prevention, H.SetLabel), b = bt(o, d == null ? void 0 : d.label, { y: 0, x: e }, e) ?? me(e);
|
|
1874
1874
|
return /* @__PURE__ */ c("li", { className: `gs-menu-item gs-column-menu-label${w ? " gs-disabled" : ""}`, children: /* @__PURE__ */ F("label", { className: "gs-label-input-row", children: [
|
|
1875
1875
|
/* @__PURE__ */ c("div", { className: "gs-label-input-label", children: "Label:" }),
|
|
1876
1876
|
/* @__PURE__ */ c(
|
|
@@ -1882,62 +1882,62 @@ const zs = ({ x: e, close: n }) => {
|
|
|
1882
1882
|
placeholder: b,
|
|
1883
1883
|
value: h,
|
|
1884
1884
|
disabled: w,
|
|
1885
|
-
onChange: (
|
|
1886
|
-
onKeyDown: (
|
|
1887
|
-
|
|
1885
|
+
onChange: (g) => f(g.target.value),
|
|
1886
|
+
onKeyDown: (g) => {
|
|
1887
|
+
g.nativeEvent.isComposing || (g.key === "Enter" && a(), g.key === "Escape" && n());
|
|
1888
1888
|
}
|
|
1889
1889
|
}
|
|
1890
1890
|
),
|
|
1891
1891
|
/* @__PURE__ */ c("button", { className: "gs-label-apply-btn", onClick: a, disabled: w, children: "UPDATE" })
|
|
1892
1892
|
] }) });
|
|
1893
1893
|
};
|
|
1894
|
-
|
|
1894
|
+
xt("col-label", zs);
|
|
1895
1895
|
const Ws = () => {
|
|
1896
|
-
const { store: e, dispatch: n } =
|
|
1897
|
-
n(Je(null)),
|
|
1898
|
-
}, [n, s]), w =
|
|
1899
|
-
(
|
|
1900
|
-
a(
|
|
1896
|
+
const { store: e, dispatch: n } = le(ae), { columnMenuState: t, editorRef: s, colMenu: r } = e, o = e.sheetReactive.current, i = t == null ? void 0 : t.x, h = t == null ? void 0 : t.position, [f, a] = te(null), d = A(() => {
|
|
1897
|
+
n(Je(null)), L(s.current);
|
|
1898
|
+
}, [n, s]), w = A(
|
|
1899
|
+
(g, m) => {
|
|
1900
|
+
a(g ? { message: g, cancel: m ?? d } : null);
|
|
1901
1901
|
},
|
|
1902
|
-
[
|
|
1902
|
+
[d]
|
|
1903
1903
|
);
|
|
1904
1904
|
if (!t || !o || i == null || !h)
|
|
1905
1905
|
return null;
|
|
1906
|
-
const b = Nt(e, n,
|
|
1906
|
+
const b = Nt(e, n, d);
|
|
1907
1907
|
return /* @__PURE__ */ F(
|
|
1908
1908
|
st,
|
|
1909
1909
|
{
|
|
1910
1910
|
className: "gs-menu-modal gs-column-menu-modal",
|
|
1911
|
-
onClick: (
|
|
1911
|
+
onClick: (g) => (g.preventDefault(), f || d(), !1),
|
|
1912
1912
|
children: [
|
|
1913
1913
|
/* @__PURE__ */ c(
|
|
1914
1914
|
"div",
|
|
1915
1915
|
{
|
|
1916
1916
|
className: "gs-column-menu",
|
|
1917
1917
|
style: { top: h.y, left: h.x, display: f ? "none" : void 0 },
|
|
1918
|
-
onClick: (
|
|
1919
|
-
children: /* @__PURE__ */ c("ul", { className: "gs-menu-items", children: r.map((
|
|
1920
|
-
var
|
|
1921
|
-
if (
|
|
1922
|
-
if (!(!
|
|
1918
|
+
onClick: (g) => g.stopPropagation(),
|
|
1919
|
+
children: /* @__PURE__ */ c("ul", { className: "gs-menu-items", children: r.map((g, m) => {
|
|
1920
|
+
var $;
|
|
1921
|
+
if (g.type === "component") {
|
|
1922
|
+
if (!(!g.visible || g.visible(b, i)))
|
|
1923
1923
|
return null;
|
|
1924
|
-
const
|
|
1925
|
-
return
|
|
1924
|
+
const M = Bs(g.componentId);
|
|
1925
|
+
return M ? /* @__PURE__ */ c(M, { x: i, close: d, onWaiting: w }, m) : null;
|
|
1926
1926
|
}
|
|
1927
|
-
if (
|
|
1928
|
-
return
|
|
1929
|
-
if (!(!
|
|
1927
|
+
if (g.type === "divider")
|
|
1928
|
+
return g.visible && !g.visible(b) ? null : /* @__PURE__ */ c(kt, {}, m);
|
|
1929
|
+
if (!(!g.visible || g.visible(b, i)))
|
|
1930
1930
|
return null;
|
|
1931
|
-
const D = ((
|
|
1931
|
+
const D = (($ = g.disabled) == null ? void 0 : $.call(g, b, i)) ?? !1, E = typeof g.label == "function" ? g.label(b, i) : g.label, S = typeof g.shortcuts == "function" ? g.shortcuts(b, i) : g.shortcuts;
|
|
1932
1932
|
return /* @__PURE__ */ c(
|
|
1933
|
-
|
|
1933
|
+
Et,
|
|
1934
1934
|
{
|
|
1935
|
-
label:
|
|
1936
|
-
shortcuts:
|
|
1935
|
+
label: E,
|
|
1936
|
+
shortcuts: S,
|
|
1937
1937
|
disabled: D,
|
|
1938
|
-
testId:
|
|
1938
|
+
testId: g.id ? `${g.id}-item` : void 0,
|
|
1939
1939
|
onClick: () => {
|
|
1940
|
-
|
|
1940
|
+
g.onClick(b, i), n(Je(null));
|
|
1941
1941
|
}
|
|
1942
1942
|
},
|
|
1943
1943
|
m
|
|
@@ -1950,7 +1950,7 @@ const Ws = () => {
|
|
|
1950
1950
|
{
|
|
1951
1951
|
className: "gs-column-menu gs-column-menu-waiting",
|
|
1952
1952
|
style: { top: h.y, left: h.x },
|
|
1953
|
-
onClick: (
|
|
1953
|
+
onClick: (g) => g.stopPropagation(),
|
|
1954
1954
|
children: [
|
|
1955
1955
|
/* @__PURE__ */ c("div", { className: "gs-waiting-message", children: f.message }),
|
|
1956
1956
|
/* @__PURE__ */ c("div", { className: "gs-waiting-spinner" }),
|
|
@@ -1963,14 +1963,14 @@ const Ws = () => {
|
|
|
1963
1963
|
);
|
|
1964
1964
|
};
|
|
1965
1965
|
function _s(e, n, t, s, r) {
|
|
1966
|
-
var
|
|
1966
|
+
var d;
|
|
1967
1967
|
if (e.type === "divider")
|
|
1968
1968
|
return /* @__PURE__ */ c(kt, {}, s);
|
|
1969
1969
|
if (e.type === "component" || !(!e.visible || e.visible(n, t)))
|
|
1970
1970
|
return null;
|
|
1971
|
-
const i = ((
|
|
1971
|
+
const i = ((d = e.disabled) == null ? void 0 : d.call(e, n, t)) ?? !1, h = typeof e.label == "function" ? e.label(n, t) : e.label, f = typeof e.shortcuts == "function" ? e.shortcuts(n, t) : e.shortcuts, a = e.checked != null ? e.checked(n, t) : void 0;
|
|
1972
1972
|
return /* @__PURE__ */ c(
|
|
1973
|
-
|
|
1973
|
+
Et,
|
|
1974
1974
|
{
|
|
1975
1975
|
label: h,
|
|
1976
1976
|
shortcuts: f,
|
|
@@ -1985,18 +1985,18 @@ function _s(e, n, t, s, r) {
|
|
|
1985
1985
|
);
|
|
1986
1986
|
}
|
|
1987
1987
|
const js = () => {
|
|
1988
|
-
const { store: e, dispatch: n } =
|
|
1989
|
-
n(ft(null)),
|
|
1988
|
+
const { store: e, dispatch: n } = le(ae), { rowMenuState: t, sheetReactive: s, editorRef: r, rowMenu: o } = e, i = s.current, h = t == null ? void 0 : t.y, f = t == null ? void 0 : t.position, a = () => {
|
|
1989
|
+
n(ft(null)), L(r.current);
|
|
1990
1990
|
};
|
|
1991
1991
|
if (!t || !i || h == null || !f)
|
|
1992
1992
|
return null;
|
|
1993
|
-
const
|
|
1993
|
+
const d = Nt(e, n, a);
|
|
1994
1994
|
return /* @__PURE__ */ c(
|
|
1995
1995
|
st,
|
|
1996
1996
|
{
|
|
1997
1997
|
className: "gs-menu-modal gs-row-menu-modal",
|
|
1998
1998
|
onClick: (w) => (w.preventDefault(), a(), !1),
|
|
1999
|
-
children: /* @__PURE__ */ c("div", { className: "gs-row-menu", style: { top: f.y, left: f.x }, onClick: (w) => w.stopPropagation(), children: /* @__PURE__ */ c("ul", { className: "gs-menu-items", children: o.map((w, b) => _s(w,
|
|
1999
|
+
children: /* @__PURE__ */ c("div", { className: "gs-row-menu", style: { top: f.y, left: f.x }, onClick: (w) => w.stopPropagation(), children: /* @__PURE__ */ c("ul", { className: "gs-menu-items", children: o.map((w, b) => _s(w, d, h, b, a)) }) })
|
|
2000
2000
|
}
|
|
2001
2001
|
);
|
|
2002
2002
|
}, Xe = (e) => {
|
|
@@ -2010,157 +2010,158 @@ const js = () => {
|
|
|
2010
2010
|
}, he = (e) => {
|
|
2011
2011
|
e.type.startsWith("touch") || e.preventDefault();
|
|
2012
2012
|
}, Vs = tt(({ y: e, x: n }) => {
|
|
2013
|
-
|
|
2013
|
+
var Y;
|
|
2014
|
+
const t = ve(e), r = `${me(n)}${t}`, { store: o, dispatch: i } = le(ae), h = ie(!0), f = ie(null), [a, d] = te(null), {
|
|
2014
2015
|
sheetReactive: w,
|
|
2015
2016
|
editingAddress: b,
|
|
2016
|
-
choosing:
|
|
2017
|
+
choosing: g,
|
|
2017
2018
|
selectingZone: m,
|
|
2018
2019
|
leftHeaderSelecting: y,
|
|
2019
2020
|
topHeaderSelecting: D,
|
|
2020
|
-
editorRef:
|
|
2021
|
-
autofillDraggingTo:
|
|
2022
|
-
contextMenu:
|
|
2023
|
-
} = o,
|
|
2024
|
-
var
|
|
2025
|
-
const
|
|
2026
|
-
if (
|
|
2021
|
+
editorRef: E,
|
|
2022
|
+
autofillDraggingTo: S,
|
|
2023
|
+
contextMenu: $
|
|
2024
|
+
} = o, N = w.current, M = nt(o), P = N == null ? void 0 : N.registry.lastFocused, X = ge(m), C = b === r, p = g.y === e && g.x === n, l = A(() => {
|
|
2025
|
+
var ee;
|
|
2026
|
+
const I = (ee = f.current) == null ? void 0 : ee.getBoundingClientRect();
|
|
2027
|
+
if (I == null)
|
|
2027
2028
|
return null;
|
|
2028
2029
|
i(
|
|
2029
2030
|
ws({
|
|
2030
|
-
y:
|
|
2031
|
-
x:
|
|
2032
|
-
height:
|
|
2033
|
-
width:
|
|
2031
|
+
y: I.y,
|
|
2032
|
+
x: I.x,
|
|
2033
|
+
height: I.height,
|
|
2034
|
+
width: I.width
|
|
2034
2035
|
})
|
|
2035
2036
|
);
|
|
2036
2037
|
}, [i]);
|
|
2037
|
-
|
|
2038
|
+
z(() => {
|
|
2038
2039
|
if (p && !h.current) {
|
|
2039
2040
|
l();
|
|
2040
2041
|
return;
|
|
2041
2042
|
}
|
|
2042
2043
|
h.current = !1;
|
|
2043
|
-
}, [p,
|
|
2044
|
-
const
|
|
2045
|
-
(
|
|
2046
|
-
i(Ze({ value:
|
|
2044
|
+
}, [p, C, l]);
|
|
2045
|
+
const u = N == null ? void 0 : N.getCell({ y: e, x: n }, { resolution: "SYSTEM" }), v = A(
|
|
2046
|
+
(I) => {
|
|
2047
|
+
i(Ze({ value: I }));
|
|
2047
2048
|
},
|
|
2048
2049
|
[i]
|
|
2049
|
-
), x =
|
|
2050
|
-
(
|
|
2051
|
-
i(Se({ sheetReactive: { current:
|
|
2050
|
+
), x = A(
|
|
2051
|
+
(I) => {
|
|
2052
|
+
i(Se({ sheetReactive: { current: I.__raw__ } }));
|
|
2052
2053
|
},
|
|
2053
2054
|
[i]
|
|
2054
2055
|
);
|
|
2055
|
-
let
|
|
2056
|
+
let T = "", R;
|
|
2056
2057
|
try {
|
|
2057
|
-
|
|
2058
|
-
} catch (
|
|
2059
|
-
Jn.is(
|
|
2058
|
+
N && (R = N.render({ sheet: N, point: { y: e, x: n }, apply: x, value: void 0 }));
|
|
2059
|
+
} catch (I) {
|
|
2060
|
+
Jn.is(I) ? (T = I.message, R = I.code) : (T = I.message, R = "#UNKNOWN");
|
|
2060
2061
|
}
|
|
2061
|
-
const [,
|
|
2062
|
-
(
|
|
2063
|
-
if (
|
|
2062
|
+
const [, B] = (N == null ? void 0 : N.getSolvedCache({ y: e, x: n })) ?? [void 0, void 0], q = es.is(B), _ = E.current, se = !!(N != null && N.registry.editingAddress || b), ce = A(
|
|
2063
|
+
(I) => {
|
|
2064
|
+
if (I.stopPropagation(), he(I), !N || !Xe(I) || !_)
|
|
2064
2065
|
return !1;
|
|
2065
|
-
if (
|
|
2066
|
-
return
|
|
2067
|
-
|
|
2068
|
-
const
|
|
2069
|
-
return
|
|
2070
|
-
},
|
|
2071
|
-
[
|
|
2072
|
-
),
|
|
2073
|
-
(
|
|
2074
|
-
if (
|
|
2075
|
-
if (he(
|
|
2076
|
-
return i(vn(
|
|
2077
|
-
|
|
2066
|
+
if (I.type.startsWith("touch"))
|
|
2067
|
+
return se && _ && _.blur(), i(Pe({ y: e, x: n })), i(be({ startY: e, startX: n, endY: e, endX: n })), !0;
|
|
2068
|
+
I.shiftKey ? i(fe({ y: e, x: n })) : i(be({ startY: e, startX: n, endY: -1, endX: -1 })), i(Ee(!0));
|
|
2069
|
+
const ee = `${N.sheetPrefix(!M)}${r}`;
|
|
2070
|
+
return se && Me({ input: P || null, ref: ee }) || (N.registry.lastFocused = _, L(_), i(de("")), S) ? !1 : (se && v(_.value), I.shiftKey || i(Pe({ y: e, x: n })), !0);
|
|
2071
|
+
},
|
|
2072
|
+
[se, _, r, M, P, S, v, N]
|
|
2073
|
+
), K = A(
|
|
2074
|
+
(I) => {
|
|
2075
|
+
if (I.stopPropagation(), !I.type.startsWith("touch")) {
|
|
2076
|
+
if (he(I), i(Ee(!1)), S)
|
|
2077
|
+
return i(vn(S)), L(_), !1;
|
|
2078
|
+
se && i(fe({ y: -1, x: -1 }));
|
|
2078
2079
|
}
|
|
2079
2080
|
},
|
|
2080
|
-
[
|
|
2081
|
-
),
|
|
2082
|
-
(
|
|
2083
|
-
if (!Xe(
|
|
2081
|
+
[S, se, _]
|
|
2082
|
+
), U = A(
|
|
2083
|
+
(I) => {
|
|
2084
|
+
if (!Xe(I) || I.type.startsWith("touch") || !N)
|
|
2084
2085
|
return !1;
|
|
2085
|
-
if (he(
|
|
2086
|
+
if (he(I), I.stopPropagation(), S)
|
|
2086
2087
|
return i(Ke({ x: n, y: e })), !1;
|
|
2087
2088
|
if (y)
|
|
2088
|
-
return i(fe({ y: e, x:
|
|
2089
|
+
return i(fe({ y: e, x: N.numCols })), !1;
|
|
2089
2090
|
if (D)
|
|
2090
|
-
return i(fe({ y:
|
|
2091
|
-
if (
|
|
2091
|
+
return i(fe({ y: N.numRows, x: n })), !1;
|
|
2092
|
+
if (se && !nn(P || null))
|
|
2092
2093
|
return !1;
|
|
2093
|
-
if (i(fe({ y: e, x: n })),
|
|
2094
|
-
const
|
|
2095
|
-
Me({ input:
|
|
2094
|
+
if (i(fe({ y: e, x: n })), se) {
|
|
2095
|
+
const ee = ge({ ...m, endY: e, endX: n }), J = `${N.sheetPrefix(!M)}${sn(ee)}`;
|
|
2096
|
+
Me({ input: P || null, ref: J });
|
|
2096
2097
|
}
|
|
2097
2098
|
return !0;
|
|
2098
2099
|
},
|
|
2099
2100
|
[
|
|
2100
|
-
|
|
2101
|
+
S,
|
|
2101
2102
|
y,
|
|
2102
2103
|
D,
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2104
|
+
N,
|
|
2105
|
+
se,
|
|
2106
|
+
P,
|
|
2106
2107
|
m,
|
|
2107
|
-
|
|
2108
|
+
M
|
|
2108
2109
|
]
|
|
2109
|
-
),
|
|
2110
|
-
(
|
|
2111
|
-
i(Ke({ x: n, y: e })), i(
|
|
2110
|
+
), Z = A(
|
|
2111
|
+
(I) => {
|
|
2112
|
+
i(Ke({ x: n, y: e })), i(Ee(!0)), I.stopPropagation();
|
|
2112
2113
|
},
|
|
2113
2114
|
[i, n, e]
|
|
2114
|
-
), G =
|
|
2115
|
-
var
|
|
2116
|
-
const
|
|
2117
|
-
|
|
2118
|
-
}, []), V =
|
|
2119
|
-
|
|
2120
|
-
}, []),
|
|
2121
|
-
(
|
|
2122
|
-
[
|
|
2123
|
-
),
|
|
2124
|
-
(
|
|
2125
|
-
|
|
2126
|
-
const
|
|
2127
|
-
return
|
|
2128
|
-
},
|
|
2129
|
-
[r,
|
|
2130
|
-
), Q = Ye(() => !
|
|
2131
|
-
return
|
|
2115
|
+
), G = A(() => {
|
|
2116
|
+
var ee;
|
|
2117
|
+
const I = (ee = f.current) == null ? void 0 : ee.getBoundingClientRect();
|
|
2118
|
+
I && d(ts(I));
|
|
2119
|
+
}, []), V = A(() => {
|
|
2120
|
+
d(null);
|
|
2121
|
+
}, []), W = A(
|
|
2122
|
+
(I) => $.length > 0 ? (I.stopPropagation(), he(I), i(ze({ y: I.clientY, x: I.clientX })), !1) : !0,
|
|
2123
|
+
[$.length]
|
|
2124
|
+
), O = A(
|
|
2125
|
+
(I) => {
|
|
2126
|
+
I.stopPropagation(), he(I), de(r);
|
|
2127
|
+
const ee = document.createEvent("MouseEvents");
|
|
2128
|
+
return ee.initEvent("dblclick", !0, !0), _ == null || _.dispatchEvent(ee), !1;
|
|
2129
|
+
},
|
|
2130
|
+
[r, _]
|
|
2131
|
+
), Q = Ye(() => !C && p && X.bottom === -1 || X.bottom === e && X.right === n ? "gs-autofill-drag" : "gs-autofill-drag gs-hidden", [C, p, X]);
|
|
2132
|
+
return N ? _ ? /* @__PURE__ */ c(
|
|
2132
2133
|
"td",
|
|
2133
2134
|
{
|
|
2134
2135
|
ref: f,
|
|
2135
2136
|
"data-x": n,
|
|
2136
2137
|
"data-y": e,
|
|
2137
2138
|
"data-address": r,
|
|
2138
|
-
className: `gs-cell ${ss(
|
|
2139
|
+
className: `gs-cell ${ss(X, { y: e, x: n }) ? "gs-selecting" : ""} ${p ? "gs-choosing" : ""} ${C ? "gs-editing" : ""} ${q ? "gs-pending" : ""}`,
|
|
2139
2140
|
style: {
|
|
2140
|
-
...
|
|
2141
|
+
...u == null ? void 0 : u.style
|
|
2141
2142
|
},
|
|
2142
|
-
onContextMenu:
|
|
2143
|
-
onDoubleClick:
|
|
2143
|
+
onContextMenu: W,
|
|
2144
|
+
onDoubleClick: O,
|
|
2144
2145
|
children: /* @__PURE__ */ F(
|
|
2145
2146
|
"div",
|
|
2146
2147
|
{
|
|
2147
2148
|
className: "gs-cell-inner-wrap",
|
|
2148
|
-
onMouseDown:
|
|
2149
|
-
onTouchStart:
|
|
2150
|
-
onMouseEnter:
|
|
2151
|
-
onMouseUp:
|
|
2149
|
+
onMouseDown: ce,
|
|
2150
|
+
onTouchStart: ce,
|
|
2151
|
+
onMouseEnter: U,
|
|
2152
|
+
onMouseUp: K,
|
|
2152
2153
|
children: [
|
|
2153
2154
|
/* @__PURE__ */ F(
|
|
2154
2155
|
"div",
|
|
2155
2156
|
{
|
|
2156
2157
|
className: "gs-cell-inner",
|
|
2157
2158
|
style: {
|
|
2158
|
-
...
|
|
2159
|
-
|
|
2160
|
-
alignItems: (
|
|
2159
|
+
...u == null ? void 0 : u.style,
|
|
2160
|
+
textAlign: ((Y = u == null ? void 0 : u.style) == null ? void 0 : Y.textAlign) || (u == null ? void 0 : u.justifyContent) || "left",
|
|
2161
|
+
alignItems: (u == null ? void 0 : u.alignItems) || "start"
|
|
2161
2162
|
},
|
|
2162
2163
|
children: [
|
|
2163
|
-
|
|
2164
|
+
T && /* @__PURE__ */ c(
|
|
2164
2165
|
"div",
|
|
2165
2166
|
{
|
|
2166
2167
|
className: "gs-formula-error-triangle",
|
|
@@ -2168,11 +2169,22 @@ const js = () => {
|
|
|
2168
2169
|
onMouseLeave: V
|
|
2169
2170
|
}
|
|
2170
2171
|
),
|
|
2171
|
-
/* @__PURE__ */ c(
|
|
2172
|
+
/* @__PURE__ */ c(
|
|
2173
|
+
"div",
|
|
2174
|
+
{
|
|
2175
|
+
className: "gs-cell-rendered",
|
|
2176
|
+
style: u != null && u.alignItems ? {
|
|
2177
|
+
display: "flex",
|
|
2178
|
+
flexDirection: "column",
|
|
2179
|
+
justifyContent: u.alignItems === "center" ? "center" : u.alignItems === "end" ? "flex-end" : void 0
|
|
2180
|
+
} : void 0,
|
|
2181
|
+
children: R
|
|
2182
|
+
}
|
|
2183
|
+
)
|
|
2172
2184
|
]
|
|
2173
2185
|
}
|
|
2174
2186
|
),
|
|
2175
|
-
|
|
2187
|
+
T && a && /* @__PURE__ */ c(
|
|
2176
2188
|
"div",
|
|
2177
2189
|
{
|
|
2178
2190
|
className: "gs-formula-error-tooltip",
|
|
@@ -2181,10 +2193,10 @@ const js = () => {
|
|
|
2181
2193
|
left: a.x,
|
|
2182
2194
|
transform: ns(a.hAlign)
|
|
2183
2195
|
},
|
|
2184
|
-
children:
|
|
2196
|
+
children: T
|
|
2185
2197
|
}
|
|
2186
2198
|
),
|
|
2187
|
-
/* @__PURE__ */ c("div", { className: Q, onMouseDown:
|
|
2199
|
+
/* @__PURE__ */ c("div", { className: Q, onMouseDown: Z })
|
|
2188
2200
|
]
|
|
2189
2201
|
}
|
|
2190
2202
|
)
|
|
@@ -2197,51 +2209,51 @@ const js = () => {
|
|
|
2197
2209
|
}), qs = 0.4, Gs = 200;
|
|
2198
2210
|
let Gt = (/* @__PURE__ */ new Date()).getTime(), Be = 0;
|
|
2199
2211
|
function ke({ style: e, horizontal: n = 0, vertical: t = 0, className: s = "" }) {
|
|
2200
|
-
const r =
|
|
2212
|
+
const r = ie(null), { store: o, dispatch: i } = le(ae), {
|
|
2201
2213
|
tabularRef: h,
|
|
2202
2214
|
autofillDraggingTo: f,
|
|
2203
2215
|
dragging: a,
|
|
2204
|
-
selectingZone:
|
|
2216
|
+
selectingZone: d,
|
|
2205
2217
|
editorRef: w,
|
|
2206
2218
|
sheetReactive: b,
|
|
2207
|
-
searchInputRef:
|
|
2219
|
+
searchInputRef: g,
|
|
2208
2220
|
editingAddress: m
|
|
2209
2221
|
} = o, y = b.current;
|
|
2210
2222
|
let D = !1;
|
|
2211
|
-
const
|
|
2223
|
+
const E = nt(o), S = !!(y != null && y.registry.editingAddress || m), $ = A(
|
|
2212
2224
|
(l) => {
|
|
2213
2225
|
if (!y)
|
|
2214
2226
|
return { x: -1, y: -1 };
|
|
2215
2227
|
if (n == 0 && t == 0) {
|
|
2216
|
-
const
|
|
2217
|
-
n = l.pageX > q ? 1 : l.pageX <
|
|
2228
|
+
const T = h.current.getBoundingClientRect(), { left: R, top: B, right: q, bottom: _ } = T;
|
|
2229
|
+
n = l.pageX > q ? 1 : l.pageX < R ? -1 : 0, n === 0 && (t = l.pageY > _ ? 1 : l.pageY < B ? -1 : 0);
|
|
2218
2230
|
}
|
|
2219
|
-
const
|
|
2220
|
-
let { endX: v, endY: x } =
|
|
2221
|
-
return n ? v = n > 0 ?
|
|
2231
|
+
const u = Ht(h.current);
|
|
2232
|
+
let { endX: v, endY: x } = d;
|
|
2233
|
+
return n ? v = n > 0 ? u.right : u.left : t && (x = t > 0 ? u.bottom : u.top), { x: v, y: x };
|
|
2222
2234
|
},
|
|
2223
|
-
[y, n, t,
|
|
2224
|
-
),
|
|
2235
|
+
[y, n, t, d]
|
|
2236
|
+
), N = A(
|
|
2225
2237
|
(l) => {
|
|
2226
2238
|
if (!D || h.current === null || !y)
|
|
2227
2239
|
return;
|
|
2228
|
-
const
|
|
2229
|
-
|
|
2240
|
+
const u = (/* @__PURE__ */ new Date()).getTime();
|
|
2241
|
+
u - Gt > 1e3 && (Be = 0), Gt = u, h.current.scrollBy({
|
|
2230
2242
|
left: Be * n,
|
|
2231
2243
|
top: Be * t
|
|
2232
|
-
}),
|
|
2233
|
-
const { x: v, y: x } =
|
|
2244
|
+
}), L(w.current);
|
|
2245
|
+
const { x: v, y: x } = $(l);
|
|
2234
2246
|
if (f) {
|
|
2235
|
-
const { y:
|
|
2236
|
-
i(Ke({ y: x === -1 ?
|
|
2247
|
+
const { y: T, x: R } = f;
|
|
2248
|
+
i(Ke({ y: x === -1 ? T : x, x: v === -1 ? R : v }));
|
|
2237
2249
|
} else {
|
|
2238
|
-
if (
|
|
2239
|
-
const
|
|
2250
|
+
if (S) {
|
|
2251
|
+
const T = ge({ ...d, endY: x, endX: v }), R = y.sheetPrefix(!E), B = sn(T), q = `${R}${B}`;
|
|
2240
2252
|
Me({ input: w.current, ref: q });
|
|
2241
2253
|
}
|
|
2242
2254
|
i(fe({ y: x, x: v }));
|
|
2243
2255
|
}
|
|
2244
|
-
Be = Math.min(Be + qs, Gs), r.current = requestAnimationFrame(() =>
|
|
2256
|
+
Be = Math.min(Be + qs, Gs), r.current = requestAnimationFrame(() => N(l));
|
|
2245
2257
|
},
|
|
2246
2258
|
[
|
|
2247
2259
|
D,
|
|
@@ -2249,87 +2261,87 @@ function ke({ style: e, horizontal: n = 0, vertical: t = 0, className: s = "" })
|
|
|
2249
2261
|
n,
|
|
2250
2262
|
t,
|
|
2251
2263
|
f,
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2264
|
+
S,
|
|
2265
|
+
d,
|
|
2266
|
+
E,
|
|
2267
|
+
$
|
|
2256
2268
|
]
|
|
2257
|
-
),
|
|
2269
|
+
), M = A(
|
|
2258
2270
|
(l) => {
|
|
2259
2271
|
if (l.preventDefault(), l.stopPropagation(), !D) {
|
|
2260
2272
|
if (D = !0, n === 0 || t === 0) {
|
|
2261
|
-
const
|
|
2262
|
-
n || (n = l.pageX >
|
|
2273
|
+
const u = h.current.getBoundingClientRect(), { left: v, top: x, right: T, bottom: R } = u;
|
|
2274
|
+
n || (n = l.pageX > T ? 1 : l.pageX < v ? -1 : 0), n === 0 && (t || (t = l.pageY > R ? 1 : l.pageY < x ? -1 : 0));
|
|
2263
2275
|
}
|
|
2264
|
-
r.current = requestAnimationFrame(() =>
|
|
2276
|
+
r.current = requestAnimationFrame(() => N(l));
|
|
2265
2277
|
}
|
|
2266
2278
|
},
|
|
2267
|
-
[D, n, t,
|
|
2268
|
-
),
|
|
2269
|
-
r.current !== null && (cancelAnimationFrame(r.current), r.current = null), D = !1, rs(
|
|
2270
|
-
}, []),
|
|
2279
|
+
[D, n, t, N]
|
|
2280
|
+
), P = A(() => {
|
|
2281
|
+
r.current !== null && (cancelAnimationFrame(r.current), r.current = null), D = !1, rs(g.current) || L(w.current);
|
|
2282
|
+
}, []), X = A(
|
|
2271
2283
|
(l) => {
|
|
2272
2284
|
l.preventDefault(), l.stopPropagation();
|
|
2273
|
-
const
|
|
2274
|
-
if (
|
|
2285
|
+
const u = Ht(h.current);
|
|
2286
|
+
if (u.bottom === -1 || u.right === -1)
|
|
2275
2287
|
return;
|
|
2276
|
-
const { x: v, y: x } =
|
|
2288
|
+
const { x: v, y: x } = $(l);
|
|
2277
2289
|
if (f) {
|
|
2278
|
-
const { y:
|
|
2279
|
-
i(vn({ y: x === -1 ?
|
|
2290
|
+
const { y: T, x: R } = f;
|
|
2291
|
+
i(vn({ y: x === -1 ? T : x, x: v === -1 ? R : v })), L(w.current);
|
|
2280
2292
|
} else
|
|
2281
|
-
|
|
2293
|
+
S && i(fe({ y: -1, x: -1 }));
|
|
2282
2294
|
},
|
|
2283
|
-
[f,
|
|
2284
|
-
),
|
|
2295
|
+
[f, S, $]
|
|
2296
|
+
), C = A(
|
|
2285
2297
|
(l) => {
|
|
2286
|
-
|
|
2298
|
+
P(), i(Ee(!1)), requestAnimationFrame(() => X(l));
|
|
2287
2299
|
},
|
|
2288
|
-
[
|
|
2289
|
-
), p =
|
|
2290
|
-
|
|
2291
|
-
}, [
|
|
2292
|
-
return
|
|
2300
|
+
[P, X]
|
|
2301
|
+
), p = A(() => {
|
|
2302
|
+
P();
|
|
2303
|
+
}, [P]);
|
|
2304
|
+
return z(() => P, [P]), !w.current || !a && !f ? /* @__PURE__ */ c("div", { className: `gs-scroll-handle gs-hidden ${s}` }) : /* @__PURE__ */ c(
|
|
2293
2305
|
"div",
|
|
2294
2306
|
{
|
|
2295
2307
|
style: e,
|
|
2296
2308
|
className: `gs-scroll-handle ${s}`,
|
|
2297
2309
|
onMouseUp: (l) => {
|
|
2298
|
-
|
|
2310
|
+
C(l);
|
|
2299
2311
|
},
|
|
2300
|
-
onMouseEnter:
|
|
2312
|
+
onMouseEnter: M,
|
|
2301
2313
|
onMouseLeave: p
|
|
2302
2314
|
}
|
|
2303
2315
|
);
|
|
2304
2316
|
}
|
|
2305
2317
|
const Qs = tt(({ x: e }) => {
|
|
2306
|
-
const n = me(e), { store: t, dispatch: s } =
|
|
2318
|
+
const n = me(e), { store: t, dispatch: s } = le(ae), {
|
|
2307
2319
|
sheetReactive: r,
|
|
2308
2320
|
editingAddress: o,
|
|
2309
2321
|
choosing: i,
|
|
2310
2322
|
selectingZone: h,
|
|
2311
2323
|
topHeaderSelecting: f,
|
|
2312
2324
|
editorRef: a,
|
|
2313
|
-
autofillDraggingTo:
|
|
2325
|
+
autofillDraggingTo: d,
|
|
2314
2326
|
dragging: w,
|
|
2315
2327
|
contextMenu: b,
|
|
2316
|
-
columnMenuState:
|
|
2317
|
-
} = t, m = r.current, y = m == null ? void 0 : m.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), D = (y == null ? void 0 : y.width) || yt,
|
|
2328
|
+
columnMenuState: g
|
|
2329
|
+
} = t, m = r.current, y = m == null ? void 0 : m.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), D = (y == null ? void 0 : y.width) || yt, E = !!(y != null && y.filter && y.filter.conditions.length > 0), S = nt(t), $ = m == null ? void 0 : m.registry.lastFocused, N = !!(m != null && m.registry.editingAddress || o), M = A(
|
|
2318
2330
|
(l) => {
|
|
2319
2331
|
s(Ze({ value: l, point: i }));
|
|
2320
2332
|
},
|
|
2321
2333
|
[i]
|
|
2322
|
-
),
|
|
2334
|
+
), P = A((l) => {
|
|
2323
2335
|
s(ht([e, l.clientX, l.clientX])), l.stopPropagation(), he(l);
|
|
2324
|
-
}, []),
|
|
2336
|
+
}, []), X = A(
|
|
2325
2337
|
(l) => {
|
|
2326
2338
|
if (l.stopPropagation(), he(l), !Xe(l) || !m || w)
|
|
2327
2339
|
return !1;
|
|
2328
2340
|
if (l.type.startsWith("touch"))
|
|
2329
|
-
return
|
|
2341
|
+
return N && a.current && a.current.blur(), s(Pe({ y: 1, x: e })), s(be({ startY: 1, startX: e, endY: m.numRows, endX: e })), !0;
|
|
2330
2342
|
s(be({ startY: 1, startX: e, endY: -1, endX: e }));
|
|
2331
|
-
const
|
|
2332
|
-
if (
|
|
2343
|
+
const u = `${m.sheetPrefix(!S)}${n}:${n}`;
|
|
2344
|
+
if (N && Me({ input: $ || null, ref: u }))
|
|
2333
2345
|
return s(be({ startY: m.numRows, startX: e, endY: 0, endX: e })), !1;
|
|
2334
2346
|
let v = l.shiftKey ? h.startX : e;
|
|
2335
2347
|
return v === -1 && (v = i.x), s(
|
|
@@ -2337,37 +2349,37 @@ const Qs = tt(({ x: e }) => {
|
|
|
2337
2349
|
range: { start: v, end: e },
|
|
2338
2350
|
numRows: m.numRows
|
|
2339
2351
|
})
|
|
2340
|
-
),
|
|
2352
|
+
), N && M(($ == null ? void 0 : $.value) ?? ""), s(de("")), s(Ee(!0)), L(a.current), !d;
|
|
2341
2353
|
},
|
|
2342
2354
|
[
|
|
2343
2355
|
w,
|
|
2344
|
-
E,
|
|
2345
2356
|
N,
|
|
2357
|
+
S,
|
|
2346
2358
|
n,
|
|
2347
|
-
|
|
2359
|
+
$,
|
|
2348
2360
|
h,
|
|
2349
2361
|
i,
|
|
2350
|
-
|
|
2362
|
+
d,
|
|
2351
2363
|
a
|
|
2352
2364
|
]
|
|
2353
|
-
),
|
|
2365
|
+
), C = A(
|
|
2354
2366
|
(l) => {
|
|
2355
|
-
if (l.stopPropagation(), !l.type.startsWith("touch") && (he(l), s(
|
|
2356
|
-
return
|
|
2367
|
+
if (l.stopPropagation(), !l.type.startsWith("touch") && (he(l), s(Ee(!1)), d))
|
|
2368
|
+
return L(a.current), !1;
|
|
2357
2369
|
},
|
|
2358
|
-
[
|
|
2370
|
+
[d]
|
|
2359
2371
|
), p = bn((l) => {
|
|
2360
2372
|
if (!Xe(l) || !m || l.type.startsWith("touch"))
|
|
2361
2373
|
return !1;
|
|
2362
|
-
if (he(l), l.stopPropagation(),
|
|
2374
|
+
if (he(l), l.stopPropagation(), d)
|
|
2363
2375
|
return s(Ke({ y: 1, x: e })), !1;
|
|
2364
|
-
if (
|
|
2365
|
-
const
|
|
2366
|
-
Me({ input:
|
|
2376
|
+
if (N) {
|
|
2377
|
+
const u = ge({ ...h, endY: 1, endX: e }), [v, x] = [me(u.left), me(u.right)], T = `${m.sheetPrefix(!S)}${v}:${x}`;
|
|
2378
|
+
Me({ input: $ || null, ref: T });
|
|
2367
2379
|
}
|
|
2368
|
-
if (
|
|
2369
|
-
const { startY:
|
|
2370
|
-
s(
|
|
2380
|
+
if (d == null) {
|
|
2381
|
+
const { startY: u } = h;
|
|
2382
|
+
s(u === 1 ? fe({ y: m.numRows, x: e }) : fe({ y: 1, x: e }));
|
|
2371
2383
|
}
|
|
2372
2384
|
return !1;
|
|
2373
2385
|
}, 100);
|
|
@@ -2382,10 +2394,10 @@ const Qs = tt(({ x: e }) => {
|
|
|
2382
2394
|
"div",
|
|
2383
2395
|
{
|
|
2384
2396
|
className: "gs-th-inner-wrap",
|
|
2385
|
-
onMouseDown:
|
|
2386
|
-
onTouchStart:
|
|
2397
|
+
onMouseDown: X,
|
|
2398
|
+
onTouchStart: X,
|
|
2387
2399
|
onMouseEnter: p,
|
|
2388
|
-
onMouseUp:
|
|
2400
|
+
onMouseUp: C,
|
|
2389
2401
|
children: /* @__PURE__ */ F("div", { className: "gs-th-inner", style: { height: m.headerHeight, position: "relative" }, children: [
|
|
2390
2402
|
/* @__PURE__ */ c(
|
|
2391
2403
|
ke,
|
|
@@ -2404,22 +2416,21 @@ const Qs = tt(({ x: e }) => {
|
|
|
2404
2416
|
l
|
|
2405
2417
|
] }) : l;
|
|
2406
2418
|
})(),
|
|
2407
|
-
!
|
|
2419
|
+
!H.hasOperation(y == null ? void 0 : y.prevention, H.ColumnMenu) && /* @__PURE__ */ c(
|
|
2408
2420
|
"button",
|
|
2409
2421
|
{
|
|
2410
|
-
className: `gs-menu-btn gs-column-menu-btn ${
|
|
2422
|
+
className: `gs-menu-btn gs-column-menu-btn ${E ? "gs-filtered" : ""} ${(g == null ? void 0 : g.x) === e ? "gs-active" : ""}`,
|
|
2411
2423
|
onMouseDown: (l) => {
|
|
2412
2424
|
l.stopPropagation(), l.preventDefault(), l.currentTarget.dataset.pressX = String(l.clientX), l.currentTarget.dataset.pressY = String(l.clientY);
|
|
2413
2425
|
},
|
|
2414
2426
|
onMouseUp: (l) => {
|
|
2415
2427
|
l.stopPropagation();
|
|
2416
|
-
const
|
|
2428
|
+
const u = l.currentTarget, v = Number(u.dataset.pressX ?? l.clientX), x = Number(u.dataset.pressY ?? l.clientY);
|
|
2417
2429
|
if (Math.abs(l.clientX - v) > 4 || Math.abs(l.clientY - x) > 4)
|
|
2418
2430
|
return;
|
|
2419
|
-
const
|
|
2420
|
-
(
|
|
2431
|
+
const R = u.getBoundingClientRect();
|
|
2432
|
+
(g == null ? void 0 : g.x) === e ? s(Je(null)) : (Te({ start: h.startX, end: h.endX }, e) && h.startY === 1 && h.endY === m.numRows || s(Ut({ range: { start: e, end: e }, numRows: m.numRows })), s(Je({ x: e, position: { y: R.bottom, x: R.left } })));
|
|
2421
2433
|
},
|
|
2422
|
-
title: "Sort & Filter",
|
|
2423
2434
|
children: "⋮"
|
|
2424
2435
|
}
|
|
2425
2436
|
),
|
|
@@ -2428,10 +2439,10 @@ const Qs = tt(({ x: e }) => {
|
|
|
2428
2439
|
{
|
|
2429
2440
|
className: `
|
|
2430
2441
|
gs-resizer
|
|
2431
|
-
${
|
|
2442
|
+
${H.hasOperation(y == null ? void 0 : y.prevention, H.Resize) ? "gs-protected" : ""}
|
|
2432
2443
|
${w ? "gs-hidden" : ""}`,
|
|
2433
2444
|
style: { height: m.headerHeight },
|
|
2434
|
-
onMouseDown:
|
|
2445
|
+
onMouseDown: P,
|
|
2435
2446
|
children: /* @__PURE__ */ c("i", {})
|
|
2436
2447
|
}
|
|
2437
2448
|
)
|
|
@@ -2444,33 +2455,33 @@ const Qs = tt(({ x: e }) => {
|
|
|
2444
2455
|
/* @__PURE__ */ c("div", { className: "gs-resizer" })
|
|
2445
2456
|
] }) }) });
|
|
2446
2457
|
}), Js = tt(({ y: e }) => {
|
|
2447
|
-
const n = `${ve(e)}`, { store: t, dispatch: s } =
|
|
2458
|
+
const n = `${ve(e)}`, { store: t, dispatch: s } = le(ae), {
|
|
2448
2459
|
choosing: r,
|
|
2449
2460
|
editingAddress: o,
|
|
2450
2461
|
selectingZone: i,
|
|
2451
2462
|
leftHeaderSelecting: h,
|
|
2452
2463
|
editorRef: f,
|
|
2453
2464
|
sheetReactive: a,
|
|
2454
|
-
autofillDraggingTo:
|
|
2465
|
+
autofillDraggingTo: d,
|
|
2455
2466
|
dragging: w,
|
|
2456
2467
|
contextMenu: b,
|
|
2457
|
-
rowMenuState:
|
|
2458
|
-
} = t, m = a.current, y = m == null ? void 0 : m.getCell({ y: e, x: 0 }, { resolution: "SYSTEM" }), D = (y == null ? void 0 : y.height) || vt,
|
|
2468
|
+
rowMenuState: g
|
|
2469
|
+
} = t, m = a.current, y = m == null ? void 0 : m.getCell({ y: e, x: 0 }, { resolution: "SYSTEM" }), D = (y == null ? void 0 : y.height) || vt, E = nt(t), S = m == null ? void 0 : m.registry.lastFocused, $ = !!(m != null && m.registry.editingAddress || o), N = A(
|
|
2459
2470
|
(l) => {
|
|
2460
2471
|
s(Ze({ value: l, point: r }));
|
|
2461
2472
|
},
|
|
2462
2473
|
[r]
|
|
2463
|
-
),
|
|
2474
|
+
), M = A((l) => {
|
|
2464
2475
|
s(gt([e, l.clientY, l.clientY])), l.stopPropagation(), he(l);
|
|
2465
|
-
}, []),
|
|
2476
|
+
}, []), P = A(
|
|
2466
2477
|
(l) => {
|
|
2467
2478
|
if (l.stopPropagation(), he(l), !Xe(l) || !m || w)
|
|
2468
2479
|
return !1;
|
|
2469
2480
|
if (l.type.startsWith("touch"))
|
|
2470
|
-
return
|
|
2481
|
+
return $ && f.current && f.current.blur(), s(Pe({ y: e, x: 1 })), s(be({ startY: e, startX: 1, endY: e, endX: m.numCols })), !0;
|
|
2471
2482
|
s(be({ startY: e, startX: 1, endY: e, endX: -1 }));
|
|
2472
|
-
const
|
|
2473
|
-
if (
|
|
2483
|
+
const u = `${m.sheetPrefix(!E)}${n}:${n}`;
|
|
2484
|
+
if ($ && Me({ input: S || null, ref: u }))
|
|
2474
2485
|
return s(be({ startY: e, startX: m.numCols, endY: e, endX: 0 })), !1;
|
|
2475
2486
|
let v = l.shiftKey ? i.startY : e;
|
|
2476
2487
|
return v === -1 && (v = r.y), s(
|
|
@@ -2478,40 +2489,40 @@ const Qs = tt(({ x: e }) => {
|
|
|
2478
2489
|
range: { start: v, end: e },
|
|
2479
2490
|
numCols: m.numCols
|
|
2480
2491
|
})
|
|
2481
|
-
),
|
|
2492
|
+
), $ && N((S == null ? void 0 : S.value) ?? ""), s(de("")), s(Ee(!0)), L(f.current), !d;
|
|
2482
2493
|
},
|
|
2483
2494
|
[
|
|
2484
2495
|
w,
|
|
2485
|
-
|
|
2486
|
-
|
|
2496
|
+
$,
|
|
2497
|
+
E,
|
|
2487
2498
|
n,
|
|
2488
|
-
|
|
2499
|
+
S,
|
|
2489
2500
|
i,
|
|
2490
2501
|
r,
|
|
2491
|
-
|
|
2502
|
+
d,
|
|
2492
2503
|
f
|
|
2493
2504
|
]
|
|
2494
|
-
),
|
|
2505
|
+
), X = A(
|
|
2495
2506
|
(l) => {
|
|
2496
|
-
if (l.stopPropagation(), !l.type.startsWith("touch") && (he(l), s(
|
|
2497
|
-
return
|
|
2507
|
+
if (l.stopPropagation(), !l.type.startsWith("touch") && (he(l), s(Ee(!1)), d))
|
|
2508
|
+
return L(f.current), !1;
|
|
2498
2509
|
},
|
|
2499
|
-
[
|
|
2500
|
-
),
|
|
2510
|
+
[d]
|
|
2511
|
+
), C = bn((l) => {
|
|
2501
2512
|
if (!Xe(l) || !m || l.type.startsWith("touch"))
|
|
2502
2513
|
return !1;
|
|
2503
|
-
if (he(l), l.stopPropagation(),
|
|
2514
|
+
if (he(l), l.stopPropagation(), d)
|
|
2504
2515
|
return s(Ke({ y: e, x: 1 })), !1;
|
|
2505
|
-
if (
|
|
2506
|
-
const
|
|
2507
|
-
Me({ input:
|
|
2516
|
+
if ($) {
|
|
2517
|
+
const u = ge({ ...i, endY: e, endX: 1 }), [v, x] = [ve(u.top), ve(u.bottom)], T = `${m.sheetPrefix(!E)}${v}:${x}`;
|
|
2518
|
+
Me({ input: S || null, ref: T });
|
|
2508
2519
|
}
|
|
2509
|
-
if (
|
|
2510
|
-
const { startX:
|
|
2511
|
-
s(
|
|
2520
|
+
if (d == null) {
|
|
2521
|
+
const { startX: u } = i;
|
|
2522
|
+
s(u === 1 ? fe({ y: e, x: m.numCols }) : fe({ y: e, x: 1 }));
|
|
2512
2523
|
}
|
|
2513
2524
|
return !1;
|
|
2514
|
-
}, 100), p =
|
|
2525
|
+
}, 100), p = A(
|
|
2515
2526
|
(l) => b.length > 0 ? (l.stopPropagation(), he(l), s(ze({ y: l.clientY, x: l.clientX })), !1) : !0,
|
|
2516
2527
|
[b.length]
|
|
2517
2528
|
);
|
|
@@ -2526,10 +2537,10 @@ const Qs = tt(({ x: e }) => {
|
|
|
2526
2537
|
"div",
|
|
2527
2538
|
{
|
|
2528
2539
|
className: "gs-th-inner-wrap",
|
|
2529
|
-
onMouseDown:
|
|
2530
|
-
onTouchStart:
|
|
2531
|
-
onMouseEnter:
|
|
2532
|
-
onMouseUp:
|
|
2540
|
+
onMouseDown: P,
|
|
2541
|
+
onTouchStart: P,
|
|
2542
|
+
onMouseEnter: C,
|
|
2543
|
+
onMouseUp: X,
|
|
2533
2544
|
children: /* @__PURE__ */ F("div", { className: "gs-th-inner", style: { width: m.headerWidth, position: "relative" }, children: [
|
|
2534
2545
|
/* @__PURE__ */ c(
|
|
2535
2546
|
ke,
|
|
@@ -2542,22 +2553,21 @@ const Qs = tt(({ x: e }) => {
|
|
|
2542
2553
|
}
|
|
2543
2554
|
),
|
|
2544
2555
|
bt(m, y == null ? void 0 : y.label, { y: e, x: 0 }, e) ?? n,
|
|
2545
|
-
!
|
|
2556
|
+
!H.hasOperation(y == null ? void 0 : y.prevention, H.RowMenu) && /* @__PURE__ */ c(
|
|
2546
2557
|
"button",
|
|
2547
2558
|
{
|
|
2548
|
-
className: `gs-menu-btn gs-row-menu-btn ${(
|
|
2559
|
+
className: `gs-menu-btn gs-row-menu-btn ${(g == null ? void 0 : g.y) === e ? "gs-active" : ""}`,
|
|
2549
2560
|
onMouseDown: (l) => {
|
|
2550
2561
|
l.stopPropagation(), l.preventDefault(), l.currentTarget.dataset.pressX = String(l.clientX), l.currentTarget.dataset.pressY = String(l.clientY);
|
|
2551
2562
|
},
|
|
2552
2563
|
onMouseUp: (l) => {
|
|
2553
2564
|
l.stopPropagation();
|
|
2554
|
-
const
|
|
2565
|
+
const u = l.currentTarget, v = Number(u.dataset.pressX ?? l.clientX), x = Number(u.dataset.pressY ?? l.clientY);
|
|
2555
2566
|
if (Math.abs(l.clientX - v) > 4 || Math.abs(l.clientY - x) > 4)
|
|
2556
2567
|
return;
|
|
2557
|
-
const
|
|
2558
|
-
(
|
|
2568
|
+
const R = u.getBoundingClientRect();
|
|
2569
|
+
(g == null ? void 0 : g.y) === e ? s(ft(null)) : (Te({ start: i.startY, end: i.endY }, e) && i.startX === 1 && i.endX === m.numCols || s(zt({ range: { start: e, end: e }, numCols: m.numCols })), s(ft({ y: e, position: { y: R.bottom, x: R.right } })));
|
|
2559
2570
|
},
|
|
2560
|
-
title: "Row menu",
|
|
2561
2571
|
children: "⋮"
|
|
2562
2572
|
}
|
|
2563
2573
|
),
|
|
@@ -2566,10 +2576,10 @@ const Qs = tt(({ x: e }) => {
|
|
|
2566
2576
|
{
|
|
2567
2577
|
className: `
|
|
2568
2578
|
gs-resizer
|
|
2569
|
-
${
|
|
2579
|
+
${H.hasOperation(y == null ? void 0 : y.prevention, H.Resize) ? "gs-protected" : ""}
|
|
2570
2580
|
${w ? "gs-hidden" : ""}`,
|
|
2571
2581
|
style: { width: m.headerWidth },
|
|
2572
|
-
onMouseDown:
|
|
2582
|
+
onMouseDown: M
|
|
2573
2583
|
}
|
|
2574
2584
|
)
|
|
2575
2585
|
] })
|
|
@@ -2581,14 +2591,14 @@ const Qs = tt(({ x: e }) => {
|
|
|
2581
2591
|
e.fillStyle = o, e.fillRect(n, t, s, r);
|
|
2582
2592
|
}, pt = (e, n, t, s, r, o, i = 2, h = [], f) => {
|
|
2583
2593
|
f && (e.fillStyle = f, e.fillRect(n, t, s, r)), e.strokeStyle = o, e.lineWidth = i, e.setLineDash(h), e.strokeRect(n + i / 2, t + i / 2, s - i, r - i), e.setLineDash([]);
|
|
2584
|
-
}, Ve = (e, n, t, s, r, o, i, h, f = 2, a = [],
|
|
2585
|
-
const { top: w, left: b, bottom:
|
|
2586
|
-
if (w === -1 || b === -1 ||
|
|
2594
|
+
}, Ve = (e, n, t, s, r, o, i, h, f = 2, a = [], d) => {
|
|
2595
|
+
const { top: w, left: b, bottom: g, right: m } = i;
|
|
2596
|
+
if (w === -1 || b === -1 || g === -1 || m === -1)
|
|
2587
2597
|
return;
|
|
2588
|
-
const y = Ie(n, { y: w, x: b }), D = Ie(n, { y:
|
|
2589
|
-
|
|
2598
|
+
const y = Ie(n, { y: w, x: b }), D = Ie(n, { y: g, x: m }), E = y.left - s, S = y.top - t, $ = D.right - s, N = D.bottom - t;
|
|
2599
|
+
$ < 0 || E > r || N < 0 || S > o || pt(e, E, S, $ - E, N - S, h, f, a, d);
|
|
2590
2600
|
}, lr = ({ refs: e = {} }) => {
|
|
2591
|
-
const { store: n } =
|
|
2601
|
+
const { store: n } = le(ae), {
|
|
2592
2602
|
sheetReactive: t,
|
|
2593
2603
|
tabularRef: s,
|
|
2594
2604
|
choosing: r,
|
|
@@ -2597,54 +2607,54 @@ const Qs = tt(({ x: e }) => {
|
|
|
2597
2607
|
matchingCellIndex: h,
|
|
2598
2608
|
autofillDraggingTo: f,
|
|
2599
2609
|
topHeaderSelecting: a,
|
|
2600
|
-
leftHeaderSelecting:
|
|
2610
|
+
leftHeaderSelecting: d,
|
|
2601
2611
|
mode: w,
|
|
2602
2612
|
dragging: b
|
|
2603
|
-
} = n,
|
|
2613
|
+
} = n, g = t.current, m = ie(null), y = ie(0), D = ie(n);
|
|
2604
2614
|
D.current = n;
|
|
2605
|
-
const
|
|
2606
|
-
if (!
|
|
2615
|
+
const E = A(() => {
|
|
2616
|
+
if (!g || !s.current || !m.current)
|
|
2607
2617
|
return;
|
|
2608
|
-
const
|
|
2609
|
-
if (!
|
|
2618
|
+
const N = m.current, M = N.getContext("2d");
|
|
2619
|
+
if (!M)
|
|
2610
2620
|
return;
|
|
2611
|
-
const
|
|
2612
|
-
(
|
|
2613
|
-
const { registry: l } =
|
|
2614
|
-
|
|
2615
|
-
const
|
|
2616
|
-
if (Ve(
|
|
2617
|
-
const
|
|
2618
|
-
Ve(
|
|
2621
|
+
const P = s.current, X = window.devicePixelRatio || 1, C = P.clientWidth, p = P.clientHeight;
|
|
2622
|
+
(N.width !== C * X || N.height !== p * X) && (N.style.width = `${C}px`, N.style.height = `${p}px`, N.width = C * X, N.height = p * X), M.setTransform(X, 0, 0, X, 0, 0), M.clearRect(0, 0, C, p);
|
|
2623
|
+
const { registry: l } = g, u = P.scrollTop, v = P.scrollLeft, x = g.headerWidth, T = g.headerHeight;
|
|
2624
|
+
M.save(), M.beginPath(), M.rect(x, T, C - x, p - T), M.clip();
|
|
2625
|
+
const R = ge(o);
|
|
2626
|
+
if (Ve(M, g, u, v, C, p, R, er, 1, [], tr), f) {
|
|
2627
|
+
const K = new os(D.current, f);
|
|
2628
|
+
Ve(M, g, u, v, C, p, K.wholeArea, ir, 1, [5, 5]);
|
|
2619
2629
|
}
|
|
2620
2630
|
{
|
|
2621
|
-
const { y:
|
|
2622
|
-
if (
|
|
2623
|
-
const
|
|
2624
|
-
pt(
|
|
2631
|
+
const { y: K, x: U } = r;
|
|
2632
|
+
if (K !== -1 && U !== -1) {
|
|
2633
|
+
const Z = Ie(g, { y: K, x: U }), G = Z.left - v, V = Z.top - u;
|
|
2634
|
+
pt(M, G, V, Z.width, Z.height, it, 2, []);
|
|
2625
2635
|
}
|
|
2626
2636
|
}
|
|
2627
|
-
const { copyingSheetId:
|
|
2628
|
-
if (
|
|
2629
|
-
const
|
|
2630
|
-
Ve(
|
|
2637
|
+
const { copyingSheetId: B, copyingZone: q, cutting: _ } = l;
|
|
2638
|
+
if (g.id === B) {
|
|
2639
|
+
const K = ge(q);
|
|
2640
|
+
Ve(M, g, u, v, C, p, K, _ ? sr : nr, 2.5, _ ? [4, 4] : [6, 4]);
|
|
2631
2641
|
}
|
|
2632
|
-
Object.entries(e).forEach(([
|
|
2633
|
-
const
|
|
2642
|
+
Object.entries(e).forEach(([K, U]) => {
|
|
2643
|
+
const Z = De[U % De.length];
|
|
2634
2644
|
try {
|
|
2635
|
-
const G =
|
|
2636
|
-
Ve(
|
|
2645
|
+
const G = g.rangeToArea(K);
|
|
2646
|
+
Ve(M, g, u, v, C, p, G, Z, 2, [5, 5]);
|
|
2637
2647
|
} catch {
|
|
2638
2648
|
}
|
|
2639
|
-
}), i.forEach((
|
|
2640
|
-
const { y:
|
|
2641
|
-
if (
|
|
2649
|
+
}), i.forEach((K, U) => {
|
|
2650
|
+
const { y: Z, x: G } = wt(K), V = Ie(g, { y: Z, x: G }), W = V.left - v, O = V.top - u;
|
|
2651
|
+
if (W + V.width < 0 || W > C || O + V.height < 0 || O > p)
|
|
2642
2652
|
return;
|
|
2643
|
-
const Q =
|
|
2653
|
+
const Q = U === h;
|
|
2644
2654
|
pt(
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2655
|
+
M,
|
|
2656
|
+
W,
|
|
2657
|
+
O,
|
|
2648
2658
|
V.width,
|
|
2649
2659
|
V.height,
|
|
2650
2660
|
Q ? or : "transparent",
|
|
@@ -2652,32 +2662,32 @@ const Qs = tt(({ x: e }) => {
|
|
|
2652
2662
|
[],
|
|
2653
2663
|
rr
|
|
2654
2664
|
);
|
|
2655
|
-
}),
|
|
2656
|
-
const
|
|
2657
|
-
for (let
|
|
2658
|
-
let
|
|
2659
|
-
if (Te({ start: o.startX, end: o.endX },
|
|
2665
|
+
}), M.restore();
|
|
2666
|
+
const se = g.numCols, ce = g.numRows;
|
|
2667
|
+
for (let K = 1; K <= se; K++) {
|
|
2668
|
+
let U = null, Z = null;
|
|
2669
|
+
if (Te({ start: o.startX, end: o.endX }, K) && (U = "rgba(80, 180, 255, 1)", Z = a ? "rgba(128, 128, 128, 0.25)" : "rgba(0, 119, 255, 0.05)"), r.x === K && (U = it, Z = a ? "rgba(128, 128, 128, 0.45)" : "rgba(0, 119, 255, 0.15)"), !U)
|
|
2660
2670
|
continue;
|
|
2661
|
-
const G = Ie(
|
|
2662
|
-
if (V + G.width < x || V >
|
|
2671
|
+
const G = Ie(g, { y: 1, x: K }), V = G.left - v;
|
|
2672
|
+
if (V + G.width < x || V > C)
|
|
2663
2673
|
continue;
|
|
2664
|
-
const
|
|
2665
|
-
|
|
2674
|
+
const W = Math.max(V, x), O = Math.min(V + G.width, C) - W;
|
|
2675
|
+
O > 0 && (Z && Qt(M, W, 0, O, T, Z), M.strokeStyle = U, M.lineWidth = 2, M.beginPath(), M.moveTo(W, T + 1), M.lineTo(W + O, T + 1), M.stroke());
|
|
2666
2676
|
}
|
|
2667
|
-
for (let
|
|
2668
|
-
if (
|
|
2677
|
+
for (let K = 1; K <= ce; K++) {
|
|
2678
|
+
if (g.isRowFiltered(K))
|
|
2669
2679
|
continue;
|
|
2670
|
-
let
|
|
2671
|
-
if (Te({ start: o.startY, end: o.endY },
|
|
2680
|
+
let U = null, Z = null;
|
|
2681
|
+
if (Te({ start: o.startY, end: o.endY }, K) && (U = "rgba(80, 180, 255, 1)", Z = d ? "rgba(128, 128, 128, 0.25)" : "rgba(0, 119, 255, 0.05)"), r.y === K && (U = it, Z = d ? "rgba(128, 128, 128, 0.45)" : "rgba(0, 119, 255, 0.15)"), !U)
|
|
2672
2682
|
continue;
|
|
2673
|
-
const G = Ie(
|
|
2674
|
-
if (V + G.height <
|
|
2683
|
+
const G = Ie(g, { y: K, x: 1 }), V = G.top - u;
|
|
2684
|
+
if (V + G.height < T || V > p)
|
|
2675
2685
|
continue;
|
|
2676
|
-
const
|
|
2677
|
-
|
|
2686
|
+
const W = Math.max(V, T), O = Math.min(V + G.height, p) - W;
|
|
2687
|
+
O > 0 && (Z && Qt(M, 0, W, x, O, Z), M.strokeStyle = U, M.lineWidth = 2, M.beginPath(), M.moveTo(x + 1, W), M.lineTo(x + 1, W + O), M.stroke());
|
|
2678
2688
|
}
|
|
2679
2689
|
}, [
|
|
2680
|
-
|
|
2690
|
+
g,
|
|
2681
2691
|
s,
|
|
2682
2692
|
r,
|
|
2683
2693
|
o,
|
|
@@ -2685,22 +2695,25 @@ const Qs = tt(({ x: e }) => {
|
|
|
2685
2695
|
h,
|
|
2686
2696
|
f,
|
|
2687
2697
|
a,
|
|
2688
|
-
|
|
2698
|
+
d,
|
|
2689
2699
|
w,
|
|
2690
2700
|
b,
|
|
2691
2701
|
e
|
|
2692
|
-
]),
|
|
2693
|
-
cancelAnimationFrame(y.current), y.current = requestAnimationFrame(
|
|
2694
|
-
}, [
|
|
2695
|
-
|
|
2696
|
-
}, [
|
|
2697
|
-
return
|
|
2698
|
-
const
|
|
2699
|
-
if (
|
|
2700
|
-
return
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2702
|
+
]), S = A(() => {
|
|
2703
|
+
cancelAnimationFrame(y.current), y.current = requestAnimationFrame(E);
|
|
2704
|
+
}, [E]), $ = A(() => {
|
|
2705
|
+
E();
|
|
2706
|
+
}, [E]);
|
|
2707
|
+
return z(() => (S(), () => cancelAnimationFrame(y.current)), [S]), z(() => {
|
|
2708
|
+
const N = s.current;
|
|
2709
|
+
if (!N)
|
|
2710
|
+
return;
|
|
2711
|
+
N.addEventListener("scroll", $);
|
|
2712
|
+
const M = new ResizeObserver(() => E());
|
|
2713
|
+
return M.observe(N), () => {
|
|
2714
|
+
N.removeEventListener("scroll", $), M.disconnect();
|
|
2715
|
+
};
|
|
2716
|
+
}, [s, $, E]), /* @__PURE__ */ c(
|
|
2704
2717
|
"div",
|
|
2705
2718
|
{
|
|
2706
2719
|
style: {
|
|
@@ -2727,27 +2740,27 @@ const Qs = tt(({ x: e }) => {
|
|
|
2727
2740
|
}
|
|
2728
2741
|
);
|
|
2729
2742
|
}, ar = () => {
|
|
2730
|
-
var
|
|
2731
|
-
const [e, n] =
|
|
2743
|
+
var P, X, C, p, l, u, v, x, T;
|
|
2744
|
+
const [e, n] = te({}), { store: t, dispatch: s } = le(ae), {
|
|
2732
2745
|
sheetReactive: r,
|
|
2733
2746
|
choosing: o,
|
|
2734
2747
|
editingAddress: i,
|
|
2735
2748
|
tabularRef: h,
|
|
2736
2749
|
mainRef: f,
|
|
2737
2750
|
sheetWidth: a,
|
|
2738
|
-
sheetHeight:
|
|
2751
|
+
sheetHeight: d,
|
|
2739
2752
|
inputting: w,
|
|
2740
2753
|
leftHeaderSelecting: b,
|
|
2741
|
-
topHeaderSelecting:
|
|
2754
|
+
topHeaderSelecting: g,
|
|
2742
2755
|
contextMenu: m
|
|
2743
|
-
} = t, y = r.current, [D,
|
|
2744
|
-
|
|
2745
|
-
}, []),
|
|
2746
|
-
(
|
|
2747
|
-
y &&
|
|
2756
|
+
} = t, y = r.current, [D, E] = te(null), S = A((R) => {
|
|
2757
|
+
R.preventDefault(), R.stopPropagation();
|
|
2758
|
+
}, []), $ = A(
|
|
2759
|
+
(R) => {
|
|
2760
|
+
y && E(Lt(y, R.currentTarget));
|
|
2748
2761
|
},
|
|
2749
2762
|
[r]
|
|
2750
|
-
),
|
|
2763
|
+
), N = A(() => {
|
|
2751
2764
|
y && (s(Pe({ y: -1, x: -1 })), requestAnimationFrame(() => {
|
|
2752
2765
|
s(Pe({ y: 1, x: 1 })), s(
|
|
2753
2766
|
be({
|
|
@@ -2759,38 +2772,38 @@ const Qs = tt(({ x: e }) => {
|
|
|
2759
2772
|
);
|
|
2760
2773
|
}));
|
|
2761
2774
|
}, [r]);
|
|
2762
|
-
|
|
2775
|
+
z(() => {
|
|
2763
2776
|
if (!y)
|
|
2764
2777
|
return;
|
|
2765
2778
|
if (!(i && w.startsWith("="))) {
|
|
2766
2779
|
n({}), y.registry.paletteBySheetName = {};
|
|
2767
2780
|
return;
|
|
2768
2781
|
}
|
|
2769
|
-
const
|
|
2770
|
-
|
|
2771
|
-
let
|
|
2772
|
-
for (const
|
|
2773
|
-
if (
|
|
2774
|
-
const
|
|
2775
|
-
if (
|
|
2776
|
-
const
|
|
2777
|
-
q[V] == null && (q[V] = {}), q[V][
|
|
2782
|
+
const B = {}, q = {}, _ = new qe(w.substring(1));
|
|
2783
|
+
_.tokenize();
|
|
2784
|
+
let se = 0;
|
|
2785
|
+
for (const ce of _.tokens)
|
|
2786
|
+
if (ce.type === "REF" || ce.type === "RANGE") {
|
|
2787
|
+
const K = is(ce.stringify()), U = K.indexOf("!");
|
|
2788
|
+
if (U !== -1) {
|
|
2789
|
+
const Z = K.substring(0, U), G = K.substring(U + 1), V = ls(Z), W = G.toUpperCase();
|
|
2790
|
+
q[V] == null && (q[V] = {}), q[V][W] == null && (q[V][W] = se++);
|
|
2778
2791
|
} else {
|
|
2779
|
-
const
|
|
2780
|
-
|
|
2792
|
+
const Z = K.toUpperCase();
|
|
2793
|
+
B[Z] == null && (B[Z] = se++);
|
|
2781
2794
|
}
|
|
2782
2795
|
}
|
|
2783
|
-
n(
|
|
2784
|
-
}, [t.inputting, t.editingAddress, r]),
|
|
2796
|
+
n(B), y.registry.paletteBySheetName = q;
|
|
2797
|
+
}, [t.inputting, t.editingAddress, r]), z(() => {
|
|
2785
2798
|
y && (y.registry.choosingAddress = Ne(o), y.registry.choosingSheetId = y.id);
|
|
2786
|
-
}, [o]),
|
|
2787
|
-
y &&
|
|
2788
|
-
}, [h.current, r, (
|
|
2789
|
-
const
|
|
2790
|
-
if (
|
|
2791
|
-
return as(
|
|
2799
|
+
}, [o]), z(() => {
|
|
2800
|
+
y && E(Lt(y, h.current));
|
|
2801
|
+
}, [h.current, r, (P = f.current) == null ? void 0 : P.clientHeight, (X = f.current) == null ? void 0 : X.clientWidth]), z(() => {
|
|
2802
|
+
const R = h.current;
|
|
2803
|
+
if (R)
|
|
2804
|
+
return as(R);
|
|
2792
2805
|
}, [r]);
|
|
2793
|
-
const
|
|
2806
|
+
const M = {
|
|
2794
2807
|
...e,
|
|
2795
2808
|
...y ? y.registry.paletteBySheetName[y.name] : {}
|
|
2796
2809
|
};
|
|
@@ -2800,21 +2813,22 @@ const Qs = tt(({ x: e }) => {
|
|
|
2800
2813
|
className: "gs-tabular",
|
|
2801
2814
|
style: {
|
|
2802
2815
|
width: a === -1 ? void 0 : a,
|
|
2803
|
-
height:
|
|
2816
|
+
height: d === -1 ? void 0 : d
|
|
2804
2817
|
},
|
|
2805
2818
|
ref: h,
|
|
2806
|
-
onMouseMove:
|
|
2807
|
-
onScroll:
|
|
2819
|
+
onMouseMove: S,
|
|
2820
|
+
onScroll: $,
|
|
2808
2821
|
children: /* @__PURE__ */ F(
|
|
2809
2822
|
"div",
|
|
2810
2823
|
{
|
|
2811
2824
|
className: "gs-tabular-inner",
|
|
2812
2825
|
style: {
|
|
2813
|
-
width: y.totalWidth
|
|
2814
|
-
height: y.totalHeight
|
|
2826
|
+
width: y.totalWidth,
|
|
2827
|
+
height: y.totalHeight,
|
|
2828
|
+
overflow: "clip"
|
|
2815
2829
|
},
|
|
2816
2830
|
children: [
|
|
2817
|
-
/* @__PURE__ */ c(lr, { refs:
|
|
2831
|
+
/* @__PURE__ */ c(lr, { refs: M }),
|
|
2818
2832
|
/* @__PURE__ */ F("table", { className: "gs-table", children: [
|
|
2819
2833
|
/* @__PURE__ */ c("thead", { className: "gs-thead", style: { height: y.headerHeight }, children: /* @__PURE__ */ F("tr", { className: "gs-row", children: [
|
|
2820
2834
|
/* @__PURE__ */ c(
|
|
@@ -2822,33 +2836,32 @@ const Qs = tt(({ x: e }) => {
|
|
|
2822
2836
|
{
|
|
2823
2837
|
className: "gs-th gs-th-left gs-th-top",
|
|
2824
2838
|
style: { position: "sticky", width: y.headerWidth, height: y.headerHeight },
|
|
2825
|
-
onClick:
|
|
2839
|
+
onClick: N,
|
|
2826
2840
|
children: /* @__PURE__ */ F("div", { className: "gs-th-inner", children: [
|
|
2827
2841
|
/* @__PURE__ */ c(
|
|
2828
2842
|
ke,
|
|
2829
2843
|
{
|
|
2830
|
-
className: b ||
|
|
2844
|
+
className: b || g ? "gs-hidden" : "",
|
|
2831
2845
|
style: { position: "absolute" },
|
|
2832
2846
|
horizontal: b ? 0 : -1,
|
|
2833
|
-
vertical:
|
|
2847
|
+
vertical: g ? 0 : -1
|
|
2834
2848
|
}
|
|
2835
2849
|
),
|
|
2836
2850
|
m.length > 0 && /* @__PURE__ */ c(
|
|
2837
2851
|
"button",
|
|
2838
2852
|
{
|
|
2839
2853
|
className: "gs-menu-btn gs-corner-menu-btn",
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
C.preventDefault(), C.currentTarget.dataset.pressX = String(C.clientX), C.currentTarget.dataset.pressY = String(C.clientY);
|
|
2854
|
+
onClick: (R) => R.stopPropagation(),
|
|
2855
|
+
onMouseDown: (R) => {
|
|
2856
|
+
R.preventDefault(), R.currentTarget.dataset.pressX = String(R.clientX), R.currentTarget.dataset.pressY = String(R.clientY);
|
|
2844
2857
|
},
|
|
2845
|
-
onMouseUp: (
|
|
2846
|
-
|
|
2847
|
-
const
|
|
2848
|
-
if (Math.abs(
|
|
2858
|
+
onMouseUp: (R) => {
|
|
2859
|
+
R.stopPropagation();
|
|
2860
|
+
const B = R.currentTarget, q = Number(B.dataset.pressX ?? R.clientX), _ = Number(B.dataset.pressY ?? R.clientY);
|
|
2861
|
+
if (Math.abs(R.clientX - q) > 4 || Math.abs(R.clientY - _) > 4)
|
|
2849
2862
|
return;
|
|
2850
|
-
const
|
|
2851
|
-
s(ze({ y:
|
|
2863
|
+
const ce = B.getBoundingClientRect();
|
|
2864
|
+
s(ze({ y: ce.bottom, x: ce.left }));
|
|
2852
2865
|
},
|
|
2853
2866
|
children: "⋮"
|
|
2854
2867
|
}
|
|
@@ -2860,15 +2873,15 @@ const Qs = tt(({ x: e }) => {
|
|
|
2860
2873
|
"th",
|
|
2861
2874
|
{
|
|
2862
2875
|
className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-horizontal-left",
|
|
2863
|
-
style: { width: ((
|
|
2876
|
+
style: { width: ((C = D == null ? void 0 : D.adjuster) == null ? void 0 : C.left) ?? 1 }
|
|
2864
2877
|
}
|
|
2865
2878
|
),
|
|
2866
|
-
(l = (p = D == null ? void 0 : D.xs) == null ? void 0 : p.map) == null ? void 0 : l.call(p, (
|
|
2879
|
+
(l = (p = D == null ? void 0 : D.xs) == null ? void 0 : p.map) == null ? void 0 : l.call(p, (R) => /* @__PURE__ */ c(Qs, { x: R }, R)),
|
|
2867
2880
|
/* @__PURE__ */ c(
|
|
2868
2881
|
"th",
|
|
2869
2882
|
{
|
|
2870
2883
|
className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-horizontal-right",
|
|
2871
|
-
style: { width: (
|
|
2884
|
+
style: { width: (u = D == null ? void 0 : D.adjuster) == null ? void 0 : u.right }
|
|
2872
2885
|
}
|
|
2873
2886
|
)
|
|
2874
2887
|
] }) }),
|
|
@@ -2881,17 +2894,17 @@ const Qs = tt(({ x: e }) => {
|
|
|
2881
2894
|
}
|
|
2882
2895
|
),
|
|
2883
2896
|
/* @__PURE__ */ c("td", { className: "gs-adjuster gs-adjuster-vertical" }),
|
|
2884
|
-
(x = D == null ? void 0 : D.xs) == null ? void 0 : x.map((
|
|
2897
|
+
(x = D == null ? void 0 : D.xs) == null ? void 0 : x.map((R) => /* @__PURE__ */ c("td", { className: "gs-adjuster gs-adjuster-vertical" }, R)),
|
|
2885
2898
|
/* @__PURE__ */ c("th", { className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-vertical" })
|
|
2886
2899
|
] }) }),
|
|
2887
|
-
/* @__PURE__ */ c("tbody", { className: "gs-sheet-body-data", children: (
|
|
2888
|
-
var
|
|
2889
|
-
return /* @__PURE__ */ F("tr", { className: `gs-row ${
|
|
2890
|
-
/* @__PURE__ */ c(Js, { y:
|
|
2900
|
+
/* @__PURE__ */ c("tbody", { className: "gs-sheet-body-data", children: (T = D == null ? void 0 : D.ys) == null ? void 0 : T.map((R) => {
|
|
2901
|
+
var B;
|
|
2902
|
+
return /* @__PURE__ */ F("tr", { className: `gs-row ${R % 2 === 0 ? "gs-row-even" : "gs-row-odd"}`, children: [
|
|
2903
|
+
/* @__PURE__ */ c(Js, { y: R }),
|
|
2891
2904
|
/* @__PURE__ */ c("td", { className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-horizontal-left" }),
|
|
2892
|
-
(
|
|
2905
|
+
(B = D == null ? void 0 : D.xs) == null ? void 0 : B.map((q) => /* @__PURE__ */ c(Vs, { y: R, x: q }, q)),
|
|
2893
2906
|
/* @__PURE__ */ c("td", { className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-horizontal-right" })
|
|
2894
|
-
] },
|
|
2907
|
+
] }, R);
|
|
2895
2908
|
}) })
|
|
2896
2909
|
] })
|
|
2897
2910
|
]
|
|
@@ -2900,202 +2913,202 @@ const Qs = tt(({ x: e }) => {
|
|
|
2900
2913
|
}
|
|
2901
2914
|
) });
|
|
2902
2915
|
}, cr = ({ ready: e }) => {
|
|
2903
|
-
var
|
|
2904
|
-
const { store: n, dispatch: t } =
|
|
2916
|
+
var O, Q;
|
|
2917
|
+
const { store: n, dispatch: t } = le(ae), [s, r] = te(""), [o, i] = te(0), [h, f] = te(!1), {
|
|
2905
2918
|
choosing: a,
|
|
2906
|
-
selectingZone:
|
|
2919
|
+
selectingZone: d,
|
|
2907
2920
|
editorRef: w,
|
|
2908
2921
|
largeEditorRef: b,
|
|
2909
|
-
sheetReactive:
|
|
2922
|
+
sheetReactive: g,
|
|
2910
2923
|
inputting: m,
|
|
2911
2924
|
editingAddress: y,
|
|
2912
2925
|
dragging: D
|
|
2913
|
-
} = n,
|
|
2914
|
-
|
|
2915
|
-
var
|
|
2916
|
-
if (!
|
|
2926
|
+
} = n, E = g.current, S = ie(null), $ = a.x === -1 ? "" : Ne(a), N = E == null ? void 0 : E.getCell(a, { resolution: "SYSTEM" }), M = (O = E == null ? void 0 : E.getSystem(a)) == null ? void 0 : O.spilledFrom, P = M ? wt(M) : void 0, X = P != null ? Ne(P) : void 0;
|
|
2927
|
+
z(() => {
|
|
2928
|
+
var I;
|
|
2929
|
+
if (!E)
|
|
2917
2930
|
return;
|
|
2918
|
-
let
|
|
2919
|
-
|
|
2920
|
-
}, [
|
|
2921
|
-
const
|
|
2922
|
-
(
|
|
2923
|
-
s !==
|
|
2931
|
+
let Y = ((I = E.getCell(a, { resolution: "SYSTEM" })) == null ? void 0 : I.value) ?? "";
|
|
2932
|
+
Y = E.getSerializedValue({ point: a, cell: { ...N, value: Y }, resolution: "RAW" }), b.current.value = Y, r(Y);
|
|
2933
|
+
}, [$, E]);
|
|
2934
|
+
const C = A(
|
|
2935
|
+
(Y) => {
|
|
2936
|
+
s !== Y && t(Ze({ value: Y })), t(de("")), L(w.current);
|
|
2924
2937
|
},
|
|
2925
2938
|
[s]
|
|
2926
2939
|
);
|
|
2927
|
-
|
|
2928
|
-
const
|
|
2929
|
-
|
|
2940
|
+
z(() => {
|
|
2941
|
+
const Y = new ResizeObserver((I) => {
|
|
2942
|
+
I.forEach(K);
|
|
2930
2943
|
});
|
|
2931
|
-
return b.current &&
|
|
2932
|
-
|
|
2944
|
+
return b.current && Y.observe(b.current), () => {
|
|
2945
|
+
Y.disconnect();
|
|
2933
2946
|
};
|
|
2934
2947
|
}, []);
|
|
2935
|
-
const p =
|
|
2936
|
-
filteredOptions:
|
|
2948
|
+
const p = E == null ? void 0 : E.getPolicy(a), l = (p == null ? void 0 : p.getSelectOptions()) || [], {
|
|
2949
|
+
filteredOptions: u,
|
|
2937
2950
|
selected: v,
|
|
2938
2951
|
replaceWithOption: x,
|
|
2939
|
-
handleArrowUp:
|
|
2940
|
-
handleArrowDown:
|
|
2941
|
-
activeFunctionHelp:
|
|
2952
|
+
handleArrowUp: T,
|
|
2953
|
+
handleArrowDown: R,
|
|
2954
|
+
activeFunctionHelp: B,
|
|
2942
2955
|
activeArgIndex: q
|
|
2943
2956
|
} = Rn({
|
|
2944
2957
|
inputting: m,
|
|
2945
2958
|
selectionStart: o,
|
|
2946
2959
|
optionsAll: l,
|
|
2947
|
-
functions:
|
|
2948
|
-
}),
|
|
2949
|
-
t(
|
|
2950
|
-
}, []),
|
|
2951
|
-
i(
|
|
2952
|
-
}, []),
|
|
2953
|
-
!
|
|
2954
|
-
}, []),
|
|
2955
|
-
(
|
|
2956
|
-
!
|
|
2957
|
-
},
|
|
2958
|
-
[
|
|
2960
|
+
functions: E == null ? void 0 : E.registry.functions
|
|
2961
|
+
}), _ = b.current, se = A((Y) => {
|
|
2962
|
+
t(oe(Y.currentTarget.value)), i(Y.currentTarget.selectionStart);
|
|
2963
|
+
}, []), ce = A((Y) => {
|
|
2964
|
+
i(Y.currentTarget.selectionStart);
|
|
2965
|
+
}, []), K = A(() => {
|
|
2966
|
+
!S.current || !b.current || (S.current.style.height = `${b.current.clientHeight}px`, S.current.scrollLeft = b.current.scrollLeft, S.current.scrollTop = b.current.scrollTop);
|
|
2967
|
+
}, []), U = A(
|
|
2968
|
+
(Y) => {
|
|
2969
|
+
!_ || !E || (f(!0), t(de($)), E.registry.lastFocused = Y.currentTarget);
|
|
2970
|
+
},
|
|
2971
|
+
[_, $, E]
|
|
2959
2972
|
);
|
|
2960
|
-
|
|
2961
|
-
(
|
|
2962
|
-
if (f(!1),
|
|
2973
|
+
A(
|
|
2974
|
+
(Y) => {
|
|
2975
|
+
if (f(!1), Y.currentTarget.value.startsWith("="))
|
|
2963
2976
|
return !0;
|
|
2964
|
-
y &&
|
|
2977
|
+
y && C(Y.currentTarget.value);
|
|
2965
2978
|
},
|
|
2966
|
-
[y,
|
|
2979
|
+
[y, C]
|
|
2967
2980
|
);
|
|
2968
|
-
const
|
|
2969
|
-
(
|
|
2970
|
-
if (
|
|
2981
|
+
const Z = A(
|
|
2982
|
+
(Y) => {
|
|
2983
|
+
if (Y.ctrlKey || !E)
|
|
2971
2984
|
return !0;
|
|
2972
|
-
const
|
|
2973
|
-
if (en(
|
|
2974
|
-
return t(
|
|
2975
|
-
switch (
|
|
2985
|
+
const I = Y.currentTarget;
|
|
2986
|
+
if (en(Y, m))
|
|
2987
|
+
return t(oe(I.value)), !1;
|
|
2988
|
+
switch (Y.key) {
|
|
2976
2989
|
case "Tab":
|
|
2977
|
-
if (
|
|
2978
|
-
const
|
|
2979
|
-
if (
|
|
2980
|
-
const { value:
|
|
2981
|
-
return t(
|
|
2982
|
-
b.current && (
|
|
2990
|
+
if (Y.preventDefault(), u.length) {
|
|
2991
|
+
const J = u[v];
|
|
2992
|
+
if (J == null ? void 0 : J.isFunction) {
|
|
2993
|
+
const { value: xe, selectionStart: We } = x(J);
|
|
2994
|
+
return t(oe(xe)), setTimeout(() => {
|
|
2995
|
+
b.current && (L(b.current), b.current.setSelectionRange(We, We));
|
|
2983
2996
|
}, 0), !1;
|
|
2984
2997
|
} else {
|
|
2985
|
-
const
|
|
2986
|
-
t(Ue(
|
|
2998
|
+
const xe = E.update({ diff: { [$]: { value: J.value } }, partial: !0 });
|
|
2999
|
+
t(Ue(xe.clone())), t(de("")), t(oe(""));
|
|
2987
3000
|
}
|
|
2988
3001
|
}
|
|
2989
3002
|
break;
|
|
2990
3003
|
case "ArrowUp":
|
|
2991
|
-
if (
|
|
3004
|
+
if (T(Y))
|
|
2992
3005
|
return !0;
|
|
2993
3006
|
break;
|
|
2994
3007
|
case "ArrowDown":
|
|
2995
|
-
if (
|
|
3008
|
+
if (R(Y))
|
|
2996
3009
|
return !0;
|
|
2997
3010
|
break;
|
|
2998
3011
|
case "Enter": {
|
|
2999
|
-
if (
|
|
3000
|
-
const
|
|
3001
|
-
if (
|
|
3002
|
-
const { value: pe, selectionStart:
|
|
3003
|
-
return t(
|
|
3004
|
-
b.current && (
|
|
3005
|
-
}, 0),
|
|
3012
|
+
if (u.length) {
|
|
3013
|
+
const J = u[v];
|
|
3014
|
+
if (J != null && J.isFunction) {
|
|
3015
|
+
const { value: pe, selectionStart: xe } = x(J);
|
|
3016
|
+
return t(oe(pe)), setTimeout(() => {
|
|
3017
|
+
b.current && (L(b.current), b.current.setSelectionRange(xe, xe));
|
|
3018
|
+
}, 0), Y.preventDefault(), !1;
|
|
3006
3019
|
}
|
|
3007
3020
|
}
|
|
3008
|
-
if (
|
|
3009
|
-
tn(
|
|
3021
|
+
if (Y.altKey)
|
|
3022
|
+
tn(I, `
|
|
3010
3023
|
`);
|
|
3011
3024
|
else
|
|
3012
|
-
return
|
|
3025
|
+
return C(I.value), t(oe("")), t(
|
|
3013
3026
|
ut({
|
|
3014
|
-
numRows:
|
|
3015
|
-
numCols:
|
|
3027
|
+
numRows: E.numRows,
|
|
3028
|
+
numCols: E.numCols,
|
|
3016
3029
|
deltaY: 1,
|
|
3017
3030
|
deltaX: 0
|
|
3018
3031
|
})
|
|
3019
|
-
),
|
|
3032
|
+
), Y.preventDefault(), !1;
|
|
3020
3033
|
break;
|
|
3021
3034
|
}
|
|
3022
3035
|
case "Escape": {
|
|
3023
|
-
|
|
3036
|
+
I.value = s, t(oe(s)), t(de("")), Y.preventDefault(), L(w.current);
|
|
3024
3037
|
break;
|
|
3025
3038
|
}
|
|
3026
3039
|
case "a":
|
|
3027
|
-
if (
|
|
3040
|
+
if (Y.ctrlKey || Y.metaKey)
|
|
3028
3041
|
return !0;
|
|
3029
3042
|
case "c":
|
|
3030
|
-
if (
|
|
3043
|
+
if (Y.ctrlKey || Y.metaKey)
|
|
3031
3044
|
return !0;
|
|
3032
3045
|
break;
|
|
3033
3046
|
case "v":
|
|
3034
|
-
if (
|
|
3047
|
+
if (Y.ctrlKey || Y.metaKey)
|
|
3035
3048
|
return !0;
|
|
3036
3049
|
break;
|
|
3037
3050
|
}
|
|
3038
|
-
const
|
|
3039
|
-
return
|
|
3051
|
+
const ee = E.getCell(a, { resolution: "SYSTEM" });
|
|
3052
|
+
return H.hasOperation(ee == null ? void 0 : ee.prevention, H.Write) && (console.warn("This cell is protected from writing."), Y.preventDefault()), K(), !1;
|
|
3040
3053
|
},
|
|
3041
3054
|
[
|
|
3042
|
-
|
|
3055
|
+
E,
|
|
3043
3056
|
a,
|
|
3044
|
-
|
|
3057
|
+
$,
|
|
3045
3058
|
s,
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3059
|
+
C,
|
|
3060
|
+
K,
|
|
3061
|
+
u,
|
|
3049
3062
|
v,
|
|
3050
3063
|
x,
|
|
3051
|
-
|
|
3052
|
-
|
|
3064
|
+
T,
|
|
3065
|
+
R,
|
|
3053
3066
|
m
|
|
3054
3067
|
]
|
|
3055
|
-
), G =
|
|
3056
|
-
(
|
|
3057
|
-
|
|
3058
|
-
const
|
|
3059
|
-
if (
|
|
3060
|
-
const { value:
|
|
3061
|
-
|
|
3062
|
-
b.current && (
|
|
3068
|
+
), G = A(
|
|
3069
|
+
(Y, I) => {
|
|
3070
|
+
Y.preventDefault(), Y.stopPropagation();
|
|
3071
|
+
const ee = u[I];
|
|
3072
|
+
if (ee.isFunction) {
|
|
3073
|
+
const { value: J, selectionStart: pe } = x(ee);
|
|
3074
|
+
C(J), t(oe(J)), setTimeout(() => {
|
|
3075
|
+
b.current && (L(b.current), b.current.setSelectionRange(pe, pe));
|
|
3063
3076
|
}, 0);
|
|
3064
3077
|
}
|
|
3065
3078
|
},
|
|
3066
|
-
[
|
|
3079
|
+
[u, x, C, t]
|
|
3067
3080
|
), V = e ? {} : { visibility: "hidden" };
|
|
3068
|
-
if (!
|
|
3081
|
+
if (!E)
|
|
3069
3082
|
return /* @__PURE__ */ F("label", { className: "gs-formula-bar gs-hidden", style: V, children: [
|
|
3070
3083
|
/* @__PURE__ */ c("div", { className: "gs-selecting-address" }),
|
|
3071
3084
|
/* @__PURE__ */ c("div", { className: "gs-fx", children: "Fx" }),
|
|
3072
3085
|
/* @__PURE__ */ c("div", { className: "gs-formula-bar-editor-inner", children: /* @__PURE__ */ c("textarea", {}) })
|
|
3073
3086
|
] });
|
|
3074
|
-
const
|
|
3075
|
-
var
|
|
3087
|
+
const W = () => {
|
|
3088
|
+
var J;
|
|
3076
3089
|
if (!h || typeof document > "u" || b.current !== document.activeElement)
|
|
3077
3090
|
return null;
|
|
3078
|
-
const
|
|
3079
|
-
if (!
|
|
3091
|
+
const Y = (J = b.current) == null ? void 0 : J.getBoundingClientRect();
|
|
3092
|
+
if (!Y)
|
|
3080
3093
|
return null;
|
|
3081
|
-
const
|
|
3094
|
+
const I = Y.bottom, ee = Y.left;
|
|
3082
3095
|
return Ct(
|
|
3083
3096
|
/* @__PURE__ */ F(we, { children: [
|
|
3084
|
-
|
|
3097
|
+
B && u.length === 0 && (!d || d.endY === -1 && d.endX === -1) && /* @__PURE__ */ c(
|
|
3085
3098
|
St,
|
|
3086
3099
|
{
|
|
3087
|
-
activeFunctionGuide:
|
|
3100
|
+
activeFunctionGuide: B,
|
|
3088
3101
|
activeArgIndex: q,
|
|
3089
|
-
top:
|
|
3090
|
-
left:
|
|
3102
|
+
top: I,
|
|
3103
|
+
left: ee
|
|
3091
3104
|
}
|
|
3092
3105
|
),
|
|
3093
|
-
|
|
3106
|
+
u.length > 0 && a.x !== -1 && /* @__PURE__ */ c(
|
|
3094
3107
|
wn,
|
|
3095
3108
|
{
|
|
3096
|
-
filteredOptions:
|
|
3097
|
-
top:
|
|
3098
|
-
left:
|
|
3109
|
+
filteredOptions: u,
|
|
3110
|
+
top: I,
|
|
3111
|
+
left: ee,
|
|
3099
3112
|
selected: v,
|
|
3100
3113
|
onOptionMouseDown: G
|
|
3101
3114
|
}
|
|
@@ -3109,23 +3122,23 @@ const Qs = tt(({ x: e }) => {
|
|
|
3109
3122
|
{
|
|
3110
3123
|
className: "gs-formula-bar",
|
|
3111
3124
|
"data-sheet-id": n.sheetId,
|
|
3112
|
-
"data-spill":
|
|
3125
|
+
"data-spill": X != null ? "true" : void 0,
|
|
3113
3126
|
style: V,
|
|
3114
3127
|
children: [
|
|
3115
3128
|
/* @__PURE__ */ c(ke, { style: { position: "absolute", left: 0, top: 0, zIndex: 2 }, vertical: -1 }),
|
|
3116
|
-
/* @__PURE__ */ c("div", { className: "gs-selecting-address", children:
|
|
3129
|
+
/* @__PURE__ */ c("div", { className: "gs-selecting-address", children: X ?? $ }),
|
|
3117
3130
|
/* @__PURE__ */ c("div", { className: "gs-fx", children: "Fx" }),
|
|
3118
3131
|
/* @__PURE__ */ F("div", { className: "gs-formula-bar-editor-inner", children: [
|
|
3119
3132
|
/* @__PURE__ */ c(
|
|
3120
3133
|
"div",
|
|
3121
3134
|
{
|
|
3122
3135
|
className: "gs-editor-hl",
|
|
3123
|
-
ref:
|
|
3136
|
+
ref: S,
|
|
3124
3137
|
style: {
|
|
3125
3138
|
height: (Q = b.current) == null ? void 0 : Q.clientHeight,
|
|
3126
3139
|
width: "100%"
|
|
3127
3140
|
},
|
|
3128
|
-
children: (
|
|
3141
|
+
children: (N == null ? void 0 : N.formulaEnabled) ?? !0 ? Nn(m) : m
|
|
3129
3142
|
}
|
|
3130
3143
|
),
|
|
3131
3144
|
/* @__PURE__ */ c(
|
|
@@ -3138,25 +3151,25 @@ const Qs = tt(({ x: e }) => {
|
|
|
3138
3151
|
spellCheck: !1,
|
|
3139
3152
|
ref: b,
|
|
3140
3153
|
value: m,
|
|
3141
|
-
readOnly:
|
|
3142
|
-
onInput:
|
|
3143
|
-
onFocus:
|
|
3144
|
-
onSelect:
|
|
3145
|
-
onPaste: (
|
|
3146
|
-
|
|
3154
|
+
readOnly: X != null,
|
|
3155
|
+
onInput: se,
|
|
3156
|
+
onFocus: U,
|
|
3157
|
+
onSelect: ce,
|
|
3158
|
+
onPaste: (Y) => {
|
|
3159
|
+
Y.stopPropagation();
|
|
3147
3160
|
},
|
|
3148
|
-
onKeyDown:
|
|
3149
|
-
onKeyUp:
|
|
3150
|
-
onScroll:
|
|
3151
|
-
onMouseEnter: (
|
|
3161
|
+
onKeyDown: Z,
|
|
3162
|
+
onKeyUp: K,
|
|
3163
|
+
onScroll: K,
|
|
3164
|
+
onMouseEnter: (Y) => {
|
|
3152
3165
|
t(Qe(!0));
|
|
3153
3166
|
},
|
|
3154
|
-
onMouseLeave: (
|
|
3167
|
+
onMouseLeave: (Y) => {
|
|
3155
3168
|
t(Qe(!1));
|
|
3156
3169
|
}
|
|
3157
3170
|
}
|
|
3158
3171
|
),
|
|
3159
|
-
|
|
3172
|
+
W()
|
|
3160
3173
|
] })
|
|
3161
3174
|
]
|
|
3162
3175
|
}
|
|
@@ -3186,7 +3199,7 @@ const Qs = tt(({ x: e }) => {
|
|
|
3186
3199
|
/* @__PURE__ */ c("path", { d: "M18 6l-12 12", fill: n }),
|
|
3187
3200
|
/* @__PURE__ */ c("path", { d: "M6 6l12 12", fill: n })
|
|
3188
3201
|
] }), gr = () => {
|
|
3189
|
-
const { store: e, dispatch: n } =
|
|
3202
|
+
const { store: e, dispatch: n } = le(ae), {
|
|
3190
3203
|
rootRef: t,
|
|
3191
3204
|
editorRef: s,
|
|
3192
3205
|
searchInputRef: r,
|
|
@@ -3195,68 +3208,68 @@ const Qs = tt(({ x: e }) => {
|
|
|
3195
3208
|
searchCaseSensitive: h,
|
|
3196
3209
|
searchRegex: f,
|
|
3197
3210
|
searchRange: a,
|
|
3198
|
-
selectingZone:
|
|
3211
|
+
selectingZone: d,
|
|
3199
3212
|
matchingCellIndex: w,
|
|
3200
3213
|
matchingCells: b,
|
|
3201
|
-
sheetReactive:
|
|
3202
|
-
} = e, m =
|
|
3203
|
-
|
|
3214
|
+
sheetReactive: g
|
|
3215
|
+
} = e, m = g.current, y = b[w];
|
|
3216
|
+
z(() => {
|
|
3204
3217
|
if (!y || !m)
|
|
3205
3218
|
return;
|
|
3206
|
-
const
|
|
3207
|
-
typeof
|
|
3219
|
+
const u = wt(y);
|
|
3220
|
+
typeof u > "u" || cs(m, o.current, u);
|
|
3208
3221
|
}, [i, w, h, f, m, o]);
|
|
3209
|
-
const D =
|
|
3210
|
-
const v =
|
|
3211
|
-
(v == null ? void 0 : v.nodeName) === "INPUT" &&
|
|
3212
|
-
}, []),
|
|
3222
|
+
const D = A((u) => {
|
|
3223
|
+
const v = u.currentTarget.previousSibling;
|
|
3224
|
+
(v == null ? void 0 : v.nodeName) === "INPUT" && L(v);
|
|
3225
|
+
}, []), E = A(() => {
|
|
3213
3226
|
n(Wt(1));
|
|
3214
|
-
}, []),
|
|
3215
|
-
n($e(
|
|
3216
|
-
}, []),
|
|
3217
|
-
(
|
|
3218
|
-
if (
|
|
3227
|
+
}, []), S = A((u) => {
|
|
3228
|
+
n($e(u.currentTarget.value));
|
|
3229
|
+
}, []), $ = A(
|
|
3230
|
+
(u) => {
|
|
3231
|
+
if (u.key === "Escape") {
|
|
3219
3232
|
const v = s == null ? void 0 : s.current;
|
|
3220
|
-
v &&
|
|
3233
|
+
v && L(v), n($e(void 0));
|
|
3221
3234
|
}
|
|
3222
|
-
return
|
|
3235
|
+
return u.key === "f" && (u.ctrlKey || u.metaKey) ? (u.preventDefault(), !1) : u.key === "Enter" ? (n(Wt(u.shiftKey ? -1 : 1)), u.preventDefault(), !1) : !0;
|
|
3223
3236
|
},
|
|
3224
3237
|
[s]
|
|
3225
|
-
),
|
|
3238
|
+
), N = A(() => {
|
|
3226
3239
|
n(Rs(!h));
|
|
3227
|
-
}, [h]),
|
|
3240
|
+
}, [h]), M = A(() => {
|
|
3228
3241
|
n(Cs(!f));
|
|
3229
|
-
}, [f]),
|
|
3230
|
-
if (!
|
|
3242
|
+
}, [f]), P = Ye(() => {
|
|
3243
|
+
if (!d || us(d))
|
|
3231
3244
|
return !1;
|
|
3232
|
-
const { startY:
|
|
3233
|
-
return !(
|
|
3234
|
-
}, [
|
|
3235
|
-
if (!
|
|
3245
|
+
const { startY: u, startX: v, endY: x, endX: T } = d;
|
|
3246
|
+
return !(u === x && v === T);
|
|
3247
|
+
}, [d]), X = Ye(() => {
|
|
3248
|
+
if (!d || !P)
|
|
3236
3249
|
return "";
|
|
3237
|
-
const { startY:
|
|
3238
|
-
return `${
|
|
3239
|
-
}, [
|
|
3250
|
+
const { startY: u, startX: v, endY: x, endX: T } = d, R = `${me(Math.min(v, T))}${ve(Math.min(u, x))}`, B = `${me(Math.max(v, T))}${ve(Math.max(u, x))}`;
|
|
3251
|
+
return `${R}:${B}`;
|
|
3252
|
+
}, [d, P]), C = A(() => {
|
|
3240
3253
|
if (a)
|
|
3241
3254
|
n(_t(void 0));
|
|
3242
|
-
else if (
|
|
3243
|
-
const { startY:
|
|
3255
|
+
else if (d && P) {
|
|
3256
|
+
const { startY: u, startX: v, endY: x, endX: T } = d;
|
|
3244
3257
|
n(
|
|
3245
3258
|
_t({
|
|
3246
|
-
startY: Math.min(
|
|
3247
|
-
startX: Math.min(v,
|
|
3248
|
-
endY: Math.max(
|
|
3249
|
-
endX: Math.max(v,
|
|
3259
|
+
startY: Math.min(u, x),
|
|
3260
|
+
startX: Math.min(v, T),
|
|
3261
|
+
endY: Math.max(u, x),
|
|
3262
|
+
endX: Math.max(v, T)
|
|
3250
3263
|
})
|
|
3251
3264
|
);
|
|
3252
3265
|
}
|
|
3253
|
-
}, [a,
|
|
3266
|
+
}, [a, d, P]), p = Ye(() => {
|
|
3254
3267
|
if (!a)
|
|
3255
3268
|
return "";
|
|
3256
|
-
const { startY:
|
|
3257
|
-
return `${
|
|
3258
|
-
}, [a]), l =
|
|
3259
|
-
n($e(void 0)),
|
|
3269
|
+
const { startY: u, startX: v, endY: x, endX: T } = a, R = `${me(v)}${ve(u)}`, B = `${me(T)}${ve(x)}`;
|
|
3270
|
+
return `${R}:${B}`;
|
|
3271
|
+
}, [a]), l = A(() => {
|
|
3272
|
+
n($e(void 0)), L(s.current);
|
|
3260
3273
|
}, [s]);
|
|
3261
3274
|
return typeof i > "u" || t.current === null ? null : /* @__PURE__ */ F("label", { className: `gs-search-bar ${b.length > 0 ? "gs-search-found" : ""}`, children: [
|
|
3262
3275
|
/* @__PURE__ */ F("div", { className: "gs-search-progress", onClick: D, children: [
|
|
@@ -3264,7 +3277,7 @@ const Qs = tt(({ x: e }) => {
|
|
|
3264
3277
|
" / ",
|
|
3265
3278
|
b.length
|
|
3266
3279
|
] }),
|
|
3267
|
-
/* @__PURE__ */ c("div", { className: "gs-search-bar-icon", onClick:
|
|
3280
|
+
/* @__PURE__ */ c("div", { className: "gs-search-bar-icon", onClick: E, children: /* @__PURE__ */ c(ur, { style: { verticalAlign: "middle", marginLeft: "5px" } }) }),
|
|
3268
3281
|
/* @__PURE__ */ F("div", { className: "gs-search-input-wrapper", children: [
|
|
3269
3282
|
/* @__PURE__ */ F("div", { className: "gs-search-input-ghost", children: [
|
|
3270
3283
|
/* @__PURE__ */ c("span", { className: "gs-search-ghost-text", children: i }),
|
|
@@ -3275,8 +3288,8 @@ const Qs = tt(({ x: e }) => {
|
|
|
3275
3288
|
{
|
|
3276
3289
|
ref: r,
|
|
3277
3290
|
value: i,
|
|
3278
|
-
onChange:
|
|
3279
|
-
onKeyDown:
|
|
3291
|
+
onChange: S,
|
|
3292
|
+
onKeyDown: $,
|
|
3280
3293
|
placeholder: "Search",
|
|
3281
3294
|
title: "Press Enter to next, Shift+Enter to previous"
|
|
3282
3295
|
}
|
|
@@ -3287,7 +3300,7 @@ const Qs = tt(({ x: e }) => {
|
|
|
3287
3300
|
"span",
|
|
3288
3301
|
{
|
|
3289
3302
|
className: "gs-search-button-on",
|
|
3290
|
-
onClick:
|
|
3303
|
+
onClick: C,
|
|
3291
3304
|
title: `Search range: ${p}`,
|
|
3292
3305
|
children: [
|
|
3293
3306
|
"in ",
|
|
@@ -3295,15 +3308,15 @@ const Qs = tt(({ x: e }) => {
|
|
|
3295
3308
|
]
|
|
3296
3309
|
}
|
|
3297
3310
|
) }),
|
|
3298
|
-
!a &&
|
|
3311
|
+
!a && P && /* @__PURE__ */ c("div", { className: "gs-search-button gs-search-range", children: /* @__PURE__ */ F("span", { onClick: C, title: `Limit to range: ${X}`, children: [
|
|
3299
3312
|
"in ",
|
|
3300
|
-
|
|
3313
|
+
X
|
|
3301
3314
|
] }) }),
|
|
3302
3315
|
/* @__PURE__ */ c("div", { className: "gs-search-button gs-search-casesensitive", children: /* @__PURE__ */ c(
|
|
3303
3316
|
"span",
|
|
3304
3317
|
{
|
|
3305
3318
|
className: `${h ? "gs-search-button-on" : ""}`,
|
|
3306
|
-
onClick:
|
|
3319
|
+
onClick: N,
|
|
3307
3320
|
title: "Case sensitive",
|
|
3308
3321
|
children: "Aa"
|
|
3309
3322
|
}
|
|
@@ -3312,7 +3325,7 @@ const Qs = tt(({ x: e }) => {
|
|
|
3312
3325
|
"span",
|
|
3313
3326
|
{
|
|
3314
3327
|
className: `${f ? "gs-search-button-on" : ""}`,
|
|
3315
|
-
onClick:
|
|
3328
|
+
onClick: M,
|
|
3316
3329
|
title: "Regular expression",
|
|
3317
3330
|
children: ".*"
|
|
3318
3331
|
}
|
|
@@ -3320,7 +3333,7 @@ const Qs = tt(({ x: e }) => {
|
|
|
3320
3333
|
] }),
|
|
3321
3334
|
/* @__PURE__ */ c("a", { className: "gs-search-close", onClick: l, children: /* @__PURE__ */ c(dr, { style: { verticalAlign: "middle" } }) })
|
|
3322
3335
|
] });
|
|
3323
|
-
},
|
|
3336
|
+
}, xr = () => ln(), hr = () => ie(null), Er = () => ln(), fr = () => ie(null);
|
|
3324
3337
|
function kr({
|
|
3325
3338
|
initialCells: e,
|
|
3326
3339
|
sheetName: n = "",
|
|
@@ -3331,25 +3344,25 @@ function kr({
|
|
|
3331
3344
|
style: i,
|
|
3332
3345
|
book: h
|
|
3333
3346
|
}) {
|
|
3334
|
-
var
|
|
3335
|
-
const { sheetResize: f, showFormulaBar: a = !0, mode:
|
|
3347
|
+
var _, se, ce, K;
|
|
3348
|
+
const { sheetResize: f, showFormulaBar: a = !0, mode: d = "light" } = r, w = ie(null), b = ie(null), g = ie(null), m = ie(null), y = ie(null), D = ie(null), E = ie(null), S = hr(), $ = t ?? S, N = fr(), M = s ?? N, P = Ss({}), X = h ?? P, { registry: C } = X, [p] = te(() => n ? (C._componentSheetIds.has(n) || C._componentSheetIds.set(n, ++C.sheetHead), C._componentSheetIds.get(n)) : ++C.sheetHead), l = ie(null), [u] = te(() => {
|
|
3336
3349
|
var Q;
|
|
3337
3350
|
n || (n = `Sheet${p}`, console.debug("GridSheet: sheetName is not provided, using default name:", n));
|
|
3338
|
-
const { limits:
|
|
3339
|
-
limits:
|
|
3351
|
+
const { limits: U, contextMenu: Z, rowMenu: G, colMenu: V } = r, W = new ds({
|
|
3352
|
+
limits: U,
|
|
3340
3353
|
name: n,
|
|
3341
|
-
registry:
|
|
3354
|
+
registry: C
|
|
3342
3355
|
});
|
|
3343
|
-
return
|
|
3356
|
+
return W.id = p, C.sheetIdsByName[n] = p, W.initialize(e), (Q = C.onInit) == null || Q.call(C, { sheet: W }), W.setTotalSize(), l.current = W, {
|
|
3344
3357
|
sheetId: p,
|
|
3345
3358
|
sheetReactive: l,
|
|
3346
3359
|
rootRef: w,
|
|
3347
3360
|
flashRef: b,
|
|
3348
|
-
mainRef:
|
|
3361
|
+
mainRef: g,
|
|
3349
3362
|
searchInputRef: m,
|
|
3350
3363
|
editorRef: y,
|
|
3351
3364
|
largeEditorRef: D,
|
|
3352
|
-
tabularRef:
|
|
3365
|
+
tabularRef: E,
|
|
3353
3366
|
choosing: { y: 1, x: 1 },
|
|
3354
3367
|
inputting: "",
|
|
3355
3368
|
selectingZone: { startY: 1, startX: 1, endY: -1, endX: -1 },
|
|
@@ -3368,7 +3381,7 @@ function kr({
|
|
|
3368
3381
|
searchRegex: !1,
|
|
3369
3382
|
editingOnEnter: !0,
|
|
3370
3383
|
contextMenuPosition: { y: -1, x: -1 },
|
|
3371
|
-
contextMenu:
|
|
3384
|
+
contextMenu: Z ?? Os,
|
|
3372
3385
|
rowMenu: G ?? Hs,
|
|
3373
3386
|
colMenu: V ?? Ls,
|
|
3374
3387
|
resizingPositionY: [-1, -1, -1],
|
|
@@ -3380,55 +3393,61 @@ function kr({
|
|
|
3380
3393
|
};
|
|
3381
3394
|
}), [v, x] = ys(
|
|
3382
3395
|
Ns,
|
|
3383
|
-
|
|
3384
|
-
() =>
|
|
3396
|
+
u,
|
|
3397
|
+
() => u
|
|
3385
3398
|
);
|
|
3386
|
-
|
|
3399
|
+
z(() => {
|
|
3387
3400
|
gs();
|
|
3388
3401
|
}, []);
|
|
3389
|
-
const [
|
|
3390
|
-
return
|
|
3391
|
-
const
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3402
|
+
const [T, R] = te((r == null ? void 0 : r.sheetHeight) || mr(e)), [B, q] = te((r == null ? void 0 : r.sheetWidth) || pr(e));
|
|
3403
|
+
return z(() => {
|
|
3404
|
+
const U = g.current;
|
|
3405
|
+
if (!U)
|
|
3406
|
+
return;
|
|
3407
|
+
let Z = !0;
|
|
3408
|
+
const G = new ResizeObserver(() => {
|
|
3409
|
+
if (Z) {
|
|
3410
|
+
Z = !1;
|
|
3411
|
+
return;
|
|
3412
|
+
}
|
|
3413
|
+
r.sheetHeight || R(U.clientHeight), r.sheetWidth || q(U.clientWidth);
|
|
3414
|
+
});
|
|
3415
|
+
return G.observe(U), () => G.disconnect();
|
|
3416
|
+
}, []), z(() => {
|
|
3417
|
+
r.sheetHeight && R(r.sheetHeight);
|
|
3418
|
+
}, [r.sheetHeight]), z(() => {
|
|
3399
3419
|
r.sheetWidth && q(r.sheetWidth);
|
|
3400
|
-
}, [r.sheetWidth]), /* @__PURE__ */ c(
|
|
3420
|
+
}, [r.sheetWidth]), /* @__PURE__ */ c(ae.Provider, { value: { store: v, dispatch: x }, children: /* @__PURE__ */ F(
|
|
3401
3421
|
"div",
|
|
3402
3422
|
{
|
|
3403
|
-
className: `gs-root1 ${
|
|
3423
|
+
className: `gs-root1 ${C.ready ? "gs-initialized" : ""}`,
|
|
3404
3424
|
ref: w,
|
|
3405
3425
|
"data-sheet-name": n,
|
|
3406
|
-
"data-mode":
|
|
3407
|
-
"data-rows": ((
|
|
3408
|
-
"data-cols": ((
|
|
3426
|
+
"data-mode": d,
|
|
3427
|
+
"data-rows": ((_ = v.sheetReactive.current) == null ? void 0 : _.numRows) ?? 0,
|
|
3428
|
+
"data-cols": ((se = v.sheetReactive.current) == null ? void 0 : se.numCols) ?? 0,
|
|
3409
3429
|
children: [
|
|
3410
3430
|
/* @__PURE__ */ c("div", { className: "gs-flash-overlay", ref: b }),
|
|
3411
3431
|
/* @__PURE__ */ c(ke, { style: { position: "fixed", top: 0, left: 0 } }),
|
|
3412
3432
|
/* @__PURE__ */ c(ke, { style: { position: "absolute", zIndex: 4, right: 0, top: 0, width: 5 }, horizontal: 1 }),
|
|
3413
3433
|
/* @__PURE__ */ c(ke, { style: { position: "absolute", zIndex: 4, left: 0, bottom: 0, height: 5 }, vertical: 1 }),
|
|
3414
|
-
typeof v.searchQuery > "u" ? a && /* @__PURE__ */ c(cr, { ready:
|
|
3434
|
+
typeof v.searchQuery > "u" ? a && /* @__PURE__ */ c(cr, { ready: C.ready }) : /* @__PURE__ */ c(gr, {}),
|
|
3415
3435
|
/* @__PURE__ */ F(
|
|
3416
3436
|
"div",
|
|
3417
3437
|
{
|
|
3418
3438
|
className: `gs-main ${o || ""}`,
|
|
3419
|
-
ref:
|
|
3439
|
+
ref: g,
|
|
3420
3440
|
style: {
|
|
3421
3441
|
//width: '100%',
|
|
3422
|
-
maxWidth: (((
|
|
3423
|
-
maxHeight: (((
|
|
3424
|
-
overflow: "auto",
|
|
3442
|
+
maxWidth: (((ce = v.sheetReactive.current) == null ? void 0 : ce.totalWidth) || 0) + 2,
|
|
3443
|
+
maxHeight: (((K = v.sheetReactive.current) == null ? void 0 : K.fullHeight) || 0) + 2,
|
|
3425
3444
|
resize: f,
|
|
3426
3445
|
...i
|
|
3427
3446
|
},
|
|
3428
3447
|
children: [
|
|
3429
|
-
/* @__PURE__ */ c(Ts, { mode:
|
|
3448
|
+
/* @__PURE__ */ c(Ts, { mode: d }),
|
|
3430
3449
|
/* @__PURE__ */ c(ar, {}),
|
|
3431
|
-
/* @__PURE__ */ c(As, { ...r, sheetHeight:
|
|
3450
|
+
/* @__PURE__ */ c(As, { ...r, sheetHeight: T, sheetWidth: B, sheetName: n, sheetRef: $, storeRef: M }),
|
|
3432
3451
|
/* @__PURE__ */ c(Ks, {}),
|
|
3433
3452
|
/* @__PURE__ */ c(Ws, {}),
|
|
3434
3453
|
/* @__PURE__ */ c(js, {}),
|
|
@@ -3446,10 +3465,10 @@ const mr = (e) => {
|
|
|
3446
3465
|
const n = rn(e);
|
|
3447
3466
|
let t = ((s = e[0]) == null ? void 0 : s.height) ?? hs;
|
|
3448
3467
|
for (let f = 1; f <= n.numRows; f++) {
|
|
3449
|
-
const a = ve(f),
|
|
3450
|
-
if (t +
|
|
3468
|
+
const a = ve(f), d = ((r = e == null ? void 0 : e[a]) == null ? void 0 : r.height) || ((o = e == null ? void 0 : e["0" + a]) == null ? void 0 : o.height) || ((i = e == null ? void 0 : e[fs]) == null ? void 0 : i.height) || ((h = e == null ? void 0 : e.default) == null ? void 0 : h.height) || vt;
|
|
3469
|
+
if (t + d > Bt)
|
|
3451
3470
|
return Bt;
|
|
3452
|
-
t +=
|
|
3471
|
+
t += d;
|
|
3453
3472
|
}
|
|
3454
3473
|
return t + 3;
|
|
3455
3474
|
}, pr = (e) => {
|
|
@@ -3457,10 +3476,10 @@ const mr = (e) => {
|
|
|
3457
3476
|
const n = rn(e);
|
|
3458
3477
|
let t = ((s = e[0]) == null ? void 0 : s.width) ?? ms;
|
|
3459
3478
|
for (let f = 1; f <= n.numCols; f++) {
|
|
3460
|
-
const a = me(f),
|
|
3461
|
-
if (t +
|
|
3479
|
+
const a = me(f), d = ((r = e == null ? void 0 : e[a]) == null ? void 0 : r.width) || ((o = e == null ? void 0 : e[a + "0"]) == null ? void 0 : o.width) || ((i = e == null ? void 0 : e[ps]) == null ? void 0 : i.width) || ((h = e == null ? void 0 : e.default) == null ? void 0 : h.width) || yt;
|
|
3480
|
+
if (t + d > Kt)
|
|
3462
3481
|
return Kt;
|
|
3463
|
-
t +=
|
|
3482
|
+
t += d;
|
|
3464
3483
|
}
|
|
3465
3484
|
return t + 3;
|
|
3466
3485
|
}, Tr = {
|
|
@@ -3491,7 +3510,7 @@ export {
|
|
|
3491
3510
|
kr as GridSheet,
|
|
3492
3511
|
Xr as Lexer,
|
|
3493
3512
|
kt as MenuDivider,
|
|
3494
|
-
|
|
3513
|
+
Et as MenuItem,
|
|
3495
3514
|
Or as Pending,
|
|
3496
3515
|
Hr as PercentagePolicyMixin,
|
|
3497
3516
|
Sr as PluginBase,
|
|
@@ -3522,8 +3541,8 @@ export {
|
|
|
3522
3541
|
ao as createBook,
|
|
3523
3542
|
co as createBooleanMask,
|
|
3524
3543
|
uo as createRegistry,
|
|
3525
|
-
|
|
3526
|
-
|
|
3544
|
+
xr as createSheetRef,
|
|
3545
|
+
Er as createStoreRef,
|
|
3527
3546
|
Ls as defaultColMenuDescriptors,
|
|
3528
3547
|
Os as defaultContextMenuDescriptors,
|
|
3529
3548
|
Hs as defaultRowMenuDescriptors,
|
|
@@ -3538,13 +3557,13 @@ export {
|
|
|
3538
3557
|
bo as operations,
|
|
3539
3558
|
wo as p2a,
|
|
3540
3559
|
Ro as r2y,
|
|
3541
|
-
|
|
3560
|
+
xt as registerMenuComponent,
|
|
3542
3561
|
Co as rh,
|
|
3543
|
-
|
|
3562
|
+
xs as sheet2csv,
|
|
3544
3563
|
So as stripMatrix,
|
|
3545
3564
|
No as toCellCols,
|
|
3546
|
-
|
|
3547
|
-
|
|
3565
|
+
xo as toCellMatrix,
|
|
3566
|
+
Eo as toCellObject,
|
|
3548
3567
|
ko as toCellRows,
|
|
3549
3568
|
To as toValueCols,
|
|
3550
3569
|
Ao as toValueMatrix,
|
|
@@ -3553,7 +3572,7 @@ export {
|
|
|
3553
3572
|
Ue as updateSheet,
|
|
3554
3573
|
Ss as useBook,
|
|
3555
3574
|
Cr as useInitialPluginContext,
|
|
3556
|
-
|
|
3575
|
+
En as usePluginContext,
|
|
3557
3576
|
hr as useSheetRef,
|
|
3558
3577
|
fr as useStoreRef,
|
|
3559
3578
|
Po as userActions,
|