@gridsheet/react-core 3.0.4 → 3.0.6
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/Editor.d.ts.map +1 -1
- package/dist/components/FormulaBar.d.ts.map +1 -1
- package/dist/components/GridSheet.d.ts.map +1 -1
- package/dist/components/Tabular.d.ts.map +1 -1
- package/dist/hooks-CcD8I6FA.mjs +1147 -0
- package/dist/hooks-CcD8I6FA.mjs.map +1 -0
- package/dist/index.js +1993 -1953
- package/dist/index.js.map +1 -1
- package/dist/spellbook.js +1 -1
- package/dist/store/actions.d.ts +4 -0
- package/dist/store/actions.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/hooks-Y7BI_RNj.mjs +0 -1103
- package/dist/hooks-Y7BI_RNj.mjs.map +0 -1
|
@@ -0,0 +1,1147 @@
|
|
|
1
|
+
import { useRef as j, useEffect as O, useState as N } from "react";
|
|
2
|
+
import { x2c as ne, y2r as se, a2p as $, Autofill as ie, areaToZone as L, zoneToArea as z, areaDiff as G, restrictZone as U, matrixShape as oe, superposeArea as re, p2a as ce, operations as K, DEFAULT_HEIGHT as F, DEFAULT_WIDTH as k, smartScroll as J, createBook as ue } from "@gridsheet/core";
|
|
3
|
+
const y = (o) => {
|
|
4
|
+
const e = { ...o };
|
|
5
|
+
return e.selectingZone != null && e.selectingZone.endY === -1 && e.selectingZone.endX === -1 && delete e.selectingZone, e;
|
|
6
|
+
}, W = (o, e) => {
|
|
7
|
+
const { choosing: s, selectingZone: t } = o;
|
|
8
|
+
let { y: n, x: i } = s, { startY: r, startX: u, endY: c, endX: l } = t;
|
|
9
|
+
const [d, a] = [e.numRows, e.numCols];
|
|
10
|
+
return n > d && (n = d), i > a && (i = a), r > d && (r = d), c > d && (c = d), u > a && (u = a), l > a && (l = a), {
|
|
11
|
+
choosing: { y: n, x: i },
|
|
12
|
+
selectingZone: { startY: r, startX: u, endY: c, endX: l }
|
|
13
|
+
};
|
|
14
|
+
}, _ = "gs-flash-overlay--active", de = 600, D = (o) => {
|
|
15
|
+
o && (o.classList.remove(_), o.offsetWidth, o.classList.add(_), setTimeout(() => o.classList.remove(_), de));
|
|
16
|
+
}, ee = (o, e, s) => ({
|
|
17
|
+
...o,
|
|
18
|
+
sheetReactive: { current: e },
|
|
19
|
+
callback: (t) => {
|
|
20
|
+
s == null || s(t), D(o.flashRef.current);
|
|
21
|
+
}
|
|
22
|
+
}), M = (o, e) => {
|
|
23
|
+
const { searchQuery: s, searchCaseSensitive: t, searchRegex: n, searchRange: i } = e;
|
|
24
|
+
let { choosing: r } = e;
|
|
25
|
+
if (!s)
|
|
26
|
+
return { matchingCells: [] };
|
|
27
|
+
const u = [];
|
|
28
|
+
let c;
|
|
29
|
+
if (n)
|
|
30
|
+
try {
|
|
31
|
+
const x = t ? "" : "i", w = new RegExp(s, x);
|
|
32
|
+
c = (f) => w.test(f);
|
|
33
|
+
} catch {
|
|
34
|
+
const w = t ? s : s.toLowerCase();
|
|
35
|
+
c = (f) => (t ? f : f.toLowerCase()).indexOf(w) !== -1;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
const x = t ? s : s.toLowerCase();
|
|
39
|
+
c = (w) => (t ? w : w.toLowerCase()).indexOf(x) !== -1;
|
|
40
|
+
}
|
|
41
|
+
let l = 1, d = o.bottom, a = 1, g = o.right;
|
|
42
|
+
i && (l = i.startY, d = i.endY, a = i.startX, g = i.endX);
|
|
43
|
+
for (let x = l; x <= d; x++)
|
|
44
|
+
for (let w = a; w <= g; w++) {
|
|
45
|
+
const f = o.getSerializedValue({ point: { y: x, x: w } });
|
|
46
|
+
c(f) && u.push(`${ne(w)}${se(x)}`);
|
|
47
|
+
}
|
|
48
|
+
const p = u.length === e.matchingCells.length ? e.matchingCellIndex : 0;
|
|
49
|
+
if (u.length > 0) {
|
|
50
|
+
const x = u[p];
|
|
51
|
+
r = $(x);
|
|
52
|
+
}
|
|
53
|
+
return { matchingCells: u, searchQuery: s, matchingCellIndex: p, choosing: r };
|
|
54
|
+
}, Zt = (o) => {
|
|
55
|
+
const { sheetId: e, sheetReactive: s } = o, t = s.current;
|
|
56
|
+
return !t || e === t.registry.editingSheetId ? !1 : !!t.registry.editingAddress;
|
|
57
|
+
}, E = { startY: -1, startX: -1, endY: -1, endX: -1 }, q = {}, Xt = (o, e) => {
|
|
58
|
+
var u, c;
|
|
59
|
+
const s = q[e.type];
|
|
60
|
+
if (s == null)
|
|
61
|
+
return o;
|
|
62
|
+
const t = (u = o.sheetReactive.current) == null ? void 0 : u.registry;
|
|
63
|
+
if ((c = t == null ? void 0 : t._strictModeCache) != null && c.has(e)) {
|
|
64
|
+
const l = t._strictModeCache.get(e);
|
|
65
|
+
return t._strictModeCache.delete(e), l;
|
|
66
|
+
}
|
|
67
|
+
const { callback: n, ...i } = s.reduce(o, e.value);
|
|
68
|
+
n == null || n(i);
|
|
69
|
+
const r = { ...o, ...i };
|
|
70
|
+
return t && (t._strictModeCache || (t._strictModeCache = /* @__PURE__ */ new Map()), t._strictModeCache.set(e, r), queueMicrotask(() => {
|
|
71
|
+
var l;
|
|
72
|
+
(l = t._strictModeCache) == null || l.delete(e);
|
|
73
|
+
})), r;
|
|
74
|
+
}, B = class B {
|
|
75
|
+
constructor() {
|
|
76
|
+
this.actionId = 1, this.mutation = !1;
|
|
77
|
+
}
|
|
78
|
+
reduce(e, s) {
|
|
79
|
+
return e;
|
|
80
|
+
}
|
|
81
|
+
call(e) {
|
|
82
|
+
return {
|
|
83
|
+
type: this.actionId,
|
|
84
|
+
value: e
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
bind() {
|
|
88
|
+
return this.actionId = B.head++, q[this.actionId] = this, this.call.bind(this);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
B.head = 1;
|
|
92
|
+
let h = B;
|
|
93
|
+
const Mt = (o) => {
|
|
94
|
+
var e;
|
|
95
|
+
return ((e = q[o]) == null ? void 0 : e.mutation) === !0;
|
|
96
|
+
};
|
|
97
|
+
class ae extends h {
|
|
98
|
+
reduce(e, s) {
|
|
99
|
+
const t = s, { sheetReactive: n } = e;
|
|
100
|
+
return n.current == null ? e : {
|
|
101
|
+
...e,
|
|
102
|
+
...M(n.current, { ...e, searchQuery: t }),
|
|
103
|
+
searchQuery: t
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const Et = new ae().bind();
|
|
108
|
+
class le extends h {
|
|
109
|
+
reduce(e, s) {
|
|
110
|
+
const t = s, { sheetReactive: n } = e;
|
|
111
|
+
return n.current == null ? e : {
|
|
112
|
+
...e,
|
|
113
|
+
...M(n.current, { ...e, searchCaseSensitive: t }),
|
|
114
|
+
searchCaseSensitive: t
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const Tt = new le().bind();
|
|
119
|
+
class he extends h {
|
|
120
|
+
reduce(e, s) {
|
|
121
|
+
const t = s, { sheetReactive: n } = e;
|
|
122
|
+
return n.current == null ? e : {
|
|
123
|
+
...e,
|
|
124
|
+
...M(n.current, { ...e, searchRegex: t }),
|
|
125
|
+
searchRegex: t
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const Ht = new he().bind();
|
|
130
|
+
class ge extends h {
|
|
131
|
+
reduce(e, s) {
|
|
132
|
+
const t = s, { sheetReactive: n } = e;
|
|
133
|
+
return n.current == null ? e : {
|
|
134
|
+
...e,
|
|
135
|
+
...M(n.current, { ...e, searchRange: t }),
|
|
136
|
+
searchRange: t
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
const Ft = new ge().bind();
|
|
141
|
+
class fe extends h {
|
|
142
|
+
reduce(e, s) {
|
|
143
|
+
return {
|
|
144
|
+
...e,
|
|
145
|
+
editingAddress: s
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const kt = new fe().bind();
|
|
150
|
+
class Re extends h {
|
|
151
|
+
reduce(e, s) {
|
|
152
|
+
return {
|
|
153
|
+
...e,
|
|
154
|
+
autofillDraggingTo: s
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const Lt = new Re().bind();
|
|
159
|
+
class we extends h {
|
|
160
|
+
reduce(e, s) {
|
|
161
|
+
const t = new ie(e, s), n = t.applied, i = L(t.wholeArea);
|
|
162
|
+
return {
|
|
163
|
+
...e,
|
|
164
|
+
sheetReactive: { current: n },
|
|
165
|
+
...M(n, e),
|
|
166
|
+
...W(e, n),
|
|
167
|
+
selectingZone: i,
|
|
168
|
+
leftHeaderSelecting: !1,
|
|
169
|
+
topHeaderSelecting: !1,
|
|
170
|
+
autofillDraggingTo: null
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
const Dt = new we().bind();
|
|
175
|
+
class Se extends h {
|
|
176
|
+
reduce(e, s) {
|
|
177
|
+
return {
|
|
178
|
+
...e,
|
|
179
|
+
contextMenuPosition: s
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
const Pt = new Se().bind();
|
|
184
|
+
class xe extends h {
|
|
185
|
+
reduce(e, s) {
|
|
186
|
+
return {
|
|
187
|
+
...e,
|
|
188
|
+
resizingPositionY: s
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const zt = new xe().bind();
|
|
193
|
+
class me extends h {
|
|
194
|
+
reduce(e, s) {
|
|
195
|
+
return {
|
|
196
|
+
...e,
|
|
197
|
+
resizingPositionX: s
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const Bt = new me().bind();
|
|
202
|
+
class ye extends h {
|
|
203
|
+
reduce(e, s) {
|
|
204
|
+
return {
|
|
205
|
+
...e,
|
|
206
|
+
entering: s
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const Wt = new ye().bind();
|
|
211
|
+
class pe extends h {
|
|
212
|
+
reduce(e, s) {
|
|
213
|
+
return {
|
|
214
|
+
...e,
|
|
215
|
+
sheetReactive: { current: s },
|
|
216
|
+
...M(s, e),
|
|
217
|
+
...W(e, s)
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
const ve = new pe().bind();
|
|
222
|
+
class be extends h {
|
|
223
|
+
reduce(e, s) {
|
|
224
|
+
return {
|
|
225
|
+
...e,
|
|
226
|
+
editorRect: s
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const Ut = new be().bind();
|
|
231
|
+
class Ae extends h {
|
|
232
|
+
reduce(e, s) {
|
|
233
|
+
return {
|
|
234
|
+
...e,
|
|
235
|
+
dragging: s
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
const _t = new Ae().bind();
|
|
240
|
+
class Ce extends h {
|
|
241
|
+
reduce(e, s) {
|
|
242
|
+
return {
|
|
243
|
+
...e,
|
|
244
|
+
editingAddress: ""
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
const Ie = new Ce().bind();
|
|
249
|
+
class Ye extends h {
|
|
250
|
+
reduce(e, s) {
|
|
251
|
+
const { sheetReactive: t } = e, n = t.current;
|
|
252
|
+
return n ? {
|
|
253
|
+
...e,
|
|
254
|
+
callback: ({ sheetReactive: i }) => {
|
|
255
|
+
n.registry.transmit({
|
|
256
|
+
copyingSheetId: n.id,
|
|
257
|
+
copyingZone: s,
|
|
258
|
+
cutting: !1
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
} : e;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
const Ze = new Ye().bind();
|
|
265
|
+
class Xe extends h {
|
|
266
|
+
constructor() {
|
|
267
|
+
super(...arguments), this.mutation = !0;
|
|
268
|
+
}
|
|
269
|
+
reduce(e, s) {
|
|
270
|
+
const { sheetReactive: t } = e, n = t.current;
|
|
271
|
+
return n ? {
|
|
272
|
+
...e,
|
|
273
|
+
callback: ({ sheetReactive: i }) => {
|
|
274
|
+
n.registry.transmit({
|
|
275
|
+
copyingSheetId: n.id,
|
|
276
|
+
copyingZone: s,
|
|
277
|
+
cutting: !0
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
} : e;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
const Me = new Xe().bind();
|
|
284
|
+
class Ee extends h {
|
|
285
|
+
constructor() {
|
|
286
|
+
super(...arguments), this.mutation = !0;
|
|
287
|
+
}
|
|
288
|
+
reduce(e, s) {
|
|
289
|
+
const { choosing: t, selectingZone: n, sheetReactive: i } = e, r = i.current;
|
|
290
|
+
if (!r)
|
|
291
|
+
return e;
|
|
292
|
+
const { registry: u } = r, { copyingSheetId: c, copyingZone: l, cutting: d } = u, a = r.getSheetBySheetId(c);
|
|
293
|
+
let g = z(n);
|
|
294
|
+
const p = z(l), { matrix: x, onlyValue: w } = s;
|
|
295
|
+
if (d) {
|
|
296
|
+
if (!a)
|
|
297
|
+
return e;
|
|
298
|
+
const Y = p, { rows: C, cols: v } = G(p), R = g.top !== -1 ? {
|
|
299
|
+
top: g.top,
|
|
300
|
+
left: g.left,
|
|
301
|
+
bottom: g.top + C,
|
|
302
|
+
right: g.left + v
|
|
303
|
+
} : {
|
|
304
|
+
top: t.y,
|
|
305
|
+
left: t.x,
|
|
306
|
+
bottom: t.y + C,
|
|
307
|
+
right: t.x + v
|
|
308
|
+
}, m = U(L(R)), X = r.move({
|
|
309
|
+
srcSheet: a,
|
|
310
|
+
src: Y,
|
|
311
|
+
dst: R,
|
|
312
|
+
operator: "USER",
|
|
313
|
+
undoReflection: y({
|
|
314
|
+
sheetId: a.id,
|
|
315
|
+
selectingZone: m,
|
|
316
|
+
choosing: t,
|
|
317
|
+
transmit: { copyingSheetId: a.id, copyingZone: l, cutting: !0 }
|
|
318
|
+
}),
|
|
319
|
+
redoReflection: y({
|
|
320
|
+
sheetId: a.id,
|
|
321
|
+
choosing: t,
|
|
322
|
+
transmit: { copyingSheetId: a.id, copyingZone: E }
|
|
323
|
+
})
|
|
324
|
+
});
|
|
325
|
+
return {
|
|
326
|
+
...e,
|
|
327
|
+
...M(X, e),
|
|
328
|
+
sheetReactive: { current: X },
|
|
329
|
+
selectingZone: m,
|
|
330
|
+
inputting: X.getSerializedValue({ point: t, resolution: "RAW" }),
|
|
331
|
+
callback: ({ sheetReactive: H }) => {
|
|
332
|
+
u.transmit({
|
|
333
|
+
cutting: !1,
|
|
334
|
+
copyingZone: E
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
let f, { y: S, x: Z } = t;
|
|
340
|
+
if (p.top === -1) {
|
|
341
|
+
const { rows: Y, cols: C } = oe({ matrix: x, base: -1 });
|
|
342
|
+
g = {
|
|
343
|
+
top: S,
|
|
344
|
+
left: Z,
|
|
345
|
+
bottom: S + Y,
|
|
346
|
+
right: Z + C
|
|
347
|
+
};
|
|
348
|
+
const v = U(L(g));
|
|
349
|
+
f = r.writeRawCellMatrix({
|
|
350
|
+
point: { y: S, x: Z },
|
|
351
|
+
matrix: x,
|
|
352
|
+
onlyValue: w,
|
|
353
|
+
undoReflection: y({
|
|
354
|
+
sheetId: r.id,
|
|
355
|
+
selectingZone: v,
|
|
356
|
+
choosing: t
|
|
357
|
+
}),
|
|
358
|
+
redoReflection: y({
|
|
359
|
+
sheetId: r.id,
|
|
360
|
+
selectingZone: v,
|
|
361
|
+
choosing: t
|
|
362
|
+
})
|
|
363
|
+
});
|
|
364
|
+
} else {
|
|
365
|
+
if (a == null)
|
|
366
|
+
return e;
|
|
367
|
+
let { rows: Y, cols: C } = G(p);
|
|
368
|
+
if (g.top !== -1) {
|
|
369
|
+
S = g.top, Z = g.left;
|
|
370
|
+
const v = re(g, p);
|
|
371
|
+
Y = v.rows, C = v.cols;
|
|
372
|
+
}
|
|
373
|
+
g = { top: S, left: Z, bottom: S + Y, right: Z + C }, f = r.copy({
|
|
374
|
+
srcSheet: a,
|
|
375
|
+
src: p,
|
|
376
|
+
dst: g,
|
|
377
|
+
onlyValue: w,
|
|
378
|
+
operator: "USER",
|
|
379
|
+
undoReflection: y({
|
|
380
|
+
sheetId: a.id,
|
|
381
|
+
transmit: { copyingZone: l },
|
|
382
|
+
choosing: t,
|
|
383
|
+
selectingZone: n
|
|
384
|
+
}),
|
|
385
|
+
redoReflection: y({
|
|
386
|
+
sheetId: a.id,
|
|
387
|
+
transmit: { copyingSheetId: a.id, copyingZone: E },
|
|
388
|
+
choosing: t,
|
|
389
|
+
selectingZone: L(g)
|
|
390
|
+
})
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
const I = U(L(g));
|
|
394
|
+
return I.endX = Math.min(I.endX, f.numCols), I.endY = Math.min(I.endY, f.numRows), {
|
|
395
|
+
...e,
|
|
396
|
+
sheetReactive: { current: f },
|
|
397
|
+
selectingZone: I,
|
|
398
|
+
inputting: f.getSerializedValue({ point: t, resolution: "RAW" }),
|
|
399
|
+
...M(f, e),
|
|
400
|
+
callback: ({ sheetReactive: Y }) => {
|
|
401
|
+
u.transmit({
|
|
402
|
+
copyingZone: E
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
const Te = new Ee().bind();
|
|
409
|
+
class He extends h {
|
|
410
|
+
reduce(e, s) {
|
|
411
|
+
const { sheetReactive: t } = e;
|
|
412
|
+
return {
|
|
413
|
+
...e,
|
|
414
|
+
editingAddress: "",
|
|
415
|
+
leftHeaderSelecting: !1,
|
|
416
|
+
topHeaderSelecting: !1,
|
|
417
|
+
callback: ({ sheetReactive: n }) => {
|
|
418
|
+
n.current.registry.transmit({
|
|
419
|
+
copyingZone: E,
|
|
420
|
+
cutting: !1
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
const Fe = new He().bind();
|
|
427
|
+
class ke extends h {
|
|
428
|
+
reduce(e, s) {
|
|
429
|
+
return {
|
|
430
|
+
...e,
|
|
431
|
+
choosing: s,
|
|
432
|
+
entering: !0
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
const Le = new ke().bind();
|
|
437
|
+
class De extends h {
|
|
438
|
+
reduce(e, s) {
|
|
439
|
+
return {
|
|
440
|
+
...e,
|
|
441
|
+
selectingZone: s,
|
|
442
|
+
leftHeaderSelecting: !1,
|
|
443
|
+
topHeaderSelecting: !1
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
const Pe = new De().bind();
|
|
448
|
+
class ze extends h {
|
|
449
|
+
reduce(e, s) {
|
|
450
|
+
const { range: t, numCols: n } = s, { start: i, end: r } = t, u = e.sheetReactive.current, c = {
|
|
451
|
+
startY: i,
|
|
452
|
+
startX: 1,
|
|
453
|
+
endY: r,
|
|
454
|
+
endX: n
|
|
455
|
+
};
|
|
456
|
+
let l = i;
|
|
457
|
+
if (u) {
|
|
458
|
+
for (let d = i; d <= r; d++)
|
|
459
|
+
if (!u.isRowFiltered(d)) {
|
|
460
|
+
l = d;
|
|
461
|
+
break;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
return {
|
|
465
|
+
...e,
|
|
466
|
+
selectingZone: c,
|
|
467
|
+
choosing: { y: l, x: 1 },
|
|
468
|
+
leftHeaderSelecting: !0,
|
|
469
|
+
topHeaderSelecting: !1
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
const Be = new ze().bind();
|
|
474
|
+
class We extends h {
|
|
475
|
+
reduce(e, s) {
|
|
476
|
+
const { range: t, numRows: n } = s, { start: i, end: r } = t, u = e.sheetReactive.current, c = {
|
|
477
|
+
startY: 1,
|
|
478
|
+
startX: i,
|
|
479
|
+
endY: n,
|
|
480
|
+
endX: r
|
|
481
|
+
};
|
|
482
|
+
let l = 1;
|
|
483
|
+
if (u) {
|
|
484
|
+
for (let d = 1; d <= n; d++)
|
|
485
|
+
if (!u.isRowFiltered(d)) {
|
|
486
|
+
l = d;
|
|
487
|
+
break;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
return {
|
|
491
|
+
...e,
|
|
492
|
+
selectingZone: c,
|
|
493
|
+
choosing: { y: l, x: i },
|
|
494
|
+
leftHeaderSelecting: !1,
|
|
495
|
+
topHeaderSelecting: !0
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
const Ue = new We().bind();
|
|
500
|
+
class _e extends h {
|
|
501
|
+
reduce(e, s) {
|
|
502
|
+
const { startY: t, startX: n } = e.selectingZone, i = {
|
|
503
|
+
startY: t,
|
|
504
|
+
startX: n,
|
|
505
|
+
endY: s.y,
|
|
506
|
+
endX: s.x
|
|
507
|
+
};
|
|
508
|
+
return t === s.y && n === s.x && (i.endY = -1, i.endX = -1), { ...e, selectingZone: i };
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
const Oe = new _e().bind();
|
|
512
|
+
class qe extends h {
|
|
513
|
+
reduce(e, s) {
|
|
514
|
+
const { matchingCells: t } = e;
|
|
515
|
+
let { matchingCellIndex: n, choosing: i } = e;
|
|
516
|
+
if (n += s, n >= t.length ? n = 0 : n < 0 && (n = t.length - 1), t.length > 0) {
|
|
517
|
+
const r = t[n];
|
|
518
|
+
i = $(r);
|
|
519
|
+
}
|
|
520
|
+
return { ...e, matchingCells: t, matchingCellIndex: n, choosing: i };
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
const Qe = new qe().bind();
|
|
524
|
+
class Ve extends h {
|
|
525
|
+
reduce(e, s) {
|
|
526
|
+
let { value: t, point: n } = s;
|
|
527
|
+
const { choosing: i, selectingZone: r, sheetReactive: u } = e;
|
|
528
|
+
n == null && (n = i);
|
|
529
|
+
const c = u.current;
|
|
530
|
+
if (!c)
|
|
531
|
+
return e;
|
|
532
|
+
const l = c.write({
|
|
533
|
+
point: n,
|
|
534
|
+
value: t,
|
|
535
|
+
operator: "USER",
|
|
536
|
+
undoReflection: y({
|
|
537
|
+
sheetId: c.id,
|
|
538
|
+
selectingZone: r,
|
|
539
|
+
choosing: n
|
|
540
|
+
}),
|
|
541
|
+
redoReflection: y({
|
|
542
|
+
sheetId: c.id,
|
|
543
|
+
selectingZone: r,
|
|
544
|
+
choosing: n
|
|
545
|
+
})
|
|
546
|
+
});
|
|
547
|
+
return {
|
|
548
|
+
...e,
|
|
549
|
+
...M(l, e),
|
|
550
|
+
sheetReactive: { current: l },
|
|
551
|
+
callback: ({ sheetReactive: d }) => {
|
|
552
|
+
c.registry.transmit({
|
|
553
|
+
copyingZone: E
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
const je = new Ve().bind();
|
|
560
|
+
class Ge extends h {
|
|
561
|
+
constructor() {
|
|
562
|
+
super(...arguments), this.mutation = !0;
|
|
563
|
+
}
|
|
564
|
+
reduce(e, s) {
|
|
565
|
+
var x;
|
|
566
|
+
const { choosing: t, selectingZone: n, sheetReactive: i } = e, r = i.current;
|
|
567
|
+
if (!r)
|
|
568
|
+
return e;
|
|
569
|
+
let u = z(n);
|
|
570
|
+
if (u.top === -1) {
|
|
571
|
+
const { y: w, x: f } = t;
|
|
572
|
+
u = { top: w, left: f, bottom: w, right: f };
|
|
573
|
+
}
|
|
574
|
+
const { top: c, left: l, bottom: d, right: a } = u, g = {};
|
|
575
|
+
let p = 0;
|
|
576
|
+
for (let w = c; w <= d; w++)
|
|
577
|
+
if (!r.isRowFiltered(w))
|
|
578
|
+
for (let f = l; f <= a; f++) {
|
|
579
|
+
const S = r.getCell({ y: w, x: f }, { resolution: "SYSTEM" }), Z = ce({ y: w, x: f });
|
|
580
|
+
K.hasOperation(S == null ? void 0 : S.prevention, K.Write) || ((x = r.getSystem({ y: w, x: f })) == null ? void 0 : x.spilledFrom) == null && (S == null ? void 0 : S.value) != null && (g[Z] = { value: void 0 }, p++);
|
|
581
|
+
}
|
|
582
|
+
return p === 0 ? e : (r.update({
|
|
583
|
+
diff: g,
|
|
584
|
+
partial: !0,
|
|
585
|
+
operator: "USER",
|
|
586
|
+
undoReflection: y({
|
|
587
|
+
sheetId: r.id,
|
|
588
|
+
selectingZone: n,
|
|
589
|
+
choosing: t
|
|
590
|
+
}),
|
|
591
|
+
redoReflection: y({
|
|
592
|
+
sheetId: r.id,
|
|
593
|
+
selectingZone: n,
|
|
594
|
+
choosing: t
|
|
595
|
+
})
|
|
596
|
+
}), {
|
|
597
|
+
...e,
|
|
598
|
+
...M(r, e),
|
|
599
|
+
sheetReactive: { current: r }
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
const Ke = new Ge().bind();
|
|
604
|
+
class Ne extends h {
|
|
605
|
+
constructor() {
|
|
606
|
+
super(...arguments), this.mutation = !0;
|
|
607
|
+
}
|
|
608
|
+
reduce(e, s) {
|
|
609
|
+
const { sheetReactive: t } = e, n = t.current;
|
|
610
|
+
if (!n)
|
|
611
|
+
return e;
|
|
612
|
+
const { history: i, callback: r } = n.undo();
|
|
613
|
+
if (i == null)
|
|
614
|
+
return e;
|
|
615
|
+
if (i.dstSheetId !== n.id) {
|
|
616
|
+
const { dispatch: u, store: c } = n.registry.contextsBySheetId[i.dstSheetId];
|
|
617
|
+
return u(
|
|
618
|
+
te({
|
|
619
|
+
...c,
|
|
620
|
+
...i.undoReflection,
|
|
621
|
+
sheetReactive: { current: c.sheetReactive.current }
|
|
622
|
+
})
|
|
623
|
+
), D(c.flashRef.current), i.srcSheetId === n.id ? ee(e, n, r) : e;
|
|
624
|
+
}
|
|
625
|
+
return {
|
|
626
|
+
...e,
|
|
627
|
+
...W(e, n),
|
|
628
|
+
...i.undoReflection,
|
|
629
|
+
...M(n, e),
|
|
630
|
+
sheetReactive: { current: n },
|
|
631
|
+
callback: (u) => {
|
|
632
|
+
r == null || r(u), D(e.flashRef.current);
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
const $e = new Ne().bind();
|
|
638
|
+
class Je extends h {
|
|
639
|
+
constructor() {
|
|
640
|
+
super(...arguments), this.mutation = !0;
|
|
641
|
+
}
|
|
642
|
+
reduce(e, s) {
|
|
643
|
+
const { sheetReactive: t } = e, n = t.current;
|
|
644
|
+
if (n == null)
|
|
645
|
+
return e;
|
|
646
|
+
const { history: i, newSheet: r, callback: u } = n.redo();
|
|
647
|
+
if (i == null)
|
|
648
|
+
return e;
|
|
649
|
+
if (i.dstSheetId !== n.id) {
|
|
650
|
+
const { dispatch: c, store: l } = n.registry.contextsBySheetId[i.dstSheetId];
|
|
651
|
+
return c(
|
|
652
|
+
te({
|
|
653
|
+
...l,
|
|
654
|
+
...i.redoReflection,
|
|
655
|
+
sheetReactive: { current: l.sheetReactive.current }
|
|
656
|
+
})
|
|
657
|
+
), D(l.flashRef.current), i.srcSheetId === n.id ? ee(e, n, u) : e;
|
|
658
|
+
}
|
|
659
|
+
return {
|
|
660
|
+
...e,
|
|
661
|
+
...W(e, n),
|
|
662
|
+
...i.redoReflection,
|
|
663
|
+
...M(n, e),
|
|
664
|
+
sheetReactive: { current: n },
|
|
665
|
+
callback: (c) => {
|
|
666
|
+
u == null || u(c), D(e.flashRef.current);
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
const et = new Je().bind();
|
|
672
|
+
class tt extends h {
|
|
673
|
+
reduce(e, s) {
|
|
674
|
+
var R, m, X, H;
|
|
675
|
+
const { shiftKey: t, deltaY: n, deltaX: i, numRows: r, numCols: u } = s, { choosing: c, sheetReactive: l, tabularRef: d } = e, a = l.current;
|
|
676
|
+
if (a == null)
|
|
677
|
+
return e;
|
|
678
|
+
let { selectingZone: g } = e;
|
|
679
|
+
const { y: p, x } = c;
|
|
680
|
+
if (t) {
|
|
681
|
+
const [b, P] = [
|
|
682
|
+
g.endY === -1 ? p : g.endY,
|
|
683
|
+
g.endX === -1 ? x : g.endX
|
|
684
|
+
], [T, A] = [b + n, P + i];
|
|
685
|
+
return T < 1 || r < T || A < 1 || u < A ? e : (g = p === T && x === A ? { startY: -1, startX: -1, endY: -1, endX: -1 } : { startY: p, startX: x, endY: T, endX: A }, {
|
|
686
|
+
...e,
|
|
687
|
+
selectingZone: g
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
const [w, f] = [p + n, x + i];
|
|
691
|
+
if (w < 1 || r < w || f < 1 || u < f)
|
|
692
|
+
return e;
|
|
693
|
+
let S = w;
|
|
694
|
+
if (a.isRowFiltered(S)) {
|
|
695
|
+
const b = n >= 0 ? 1 : -1;
|
|
696
|
+
for (; S >= 1 && S <= r && a.isRowFiltered(S); )
|
|
697
|
+
S += b;
|
|
698
|
+
if (S < 1 || S > r)
|
|
699
|
+
return e;
|
|
700
|
+
}
|
|
701
|
+
let { y: Z, x: I, height: Y, width: C } = e.editorRect;
|
|
702
|
+
if (n > 0)
|
|
703
|
+
for (let b = p; b < S; b++)
|
|
704
|
+
Z += ((R = a.getCell({ y: b, x: 0 }, { resolution: "SYSTEM" })) == null ? void 0 : R.height) || F;
|
|
705
|
+
else if (n < 0)
|
|
706
|
+
for (let b = p - 1; b >= S; b--)
|
|
707
|
+
Z -= ((m = a.getCell({ y: b, x: 0 }, { resolution: "SYSTEM" })) == null ? void 0 : m.height) || F;
|
|
708
|
+
if (i > 0)
|
|
709
|
+
for (let b = x; b < f; b++)
|
|
710
|
+
I += ((X = a.getCell({ y: 0, x: b }, { resolution: "SYSTEM" })) == null ? void 0 : X.width) || k;
|
|
711
|
+
else if (i < 0)
|
|
712
|
+
for (let b = x - 1; b >= f; b--)
|
|
713
|
+
I -= ((H = a.getCell({ y: 0, x: b }, { resolution: "SYSTEM" })) == null ? void 0 : H.width) || k;
|
|
714
|
+
const v = a.getCell({ y: S, x: f }, { resolution: "SYSTEM" });
|
|
715
|
+
return Y = (v == null ? void 0 : v.height) || F, C = (v == null ? void 0 : v.width) || k, J(a, d.current, { y: S, x: f }), {
|
|
716
|
+
...e,
|
|
717
|
+
selectingZone: { startY: -1, startX: -1, endY: -1, endX: -1 },
|
|
718
|
+
choosing: { y: S, x: f },
|
|
719
|
+
editorRect: { y: Z, x: I, height: Y, width: C }
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
const nt = new tt().bind();
|
|
724
|
+
class st extends h {
|
|
725
|
+
reduce(e, s) {
|
|
726
|
+
var H, b, P, T;
|
|
727
|
+
const { numRows: t, numCols: n } = s;
|
|
728
|
+
let { deltaY: i, deltaX: r } = s;
|
|
729
|
+
const { choosing: u, selectingZone: c, sheetReactive: l, tabularRef: d } = e, a = l.current;
|
|
730
|
+
if (a == null)
|
|
731
|
+
return e;
|
|
732
|
+
let { y: g, x: p, height: x, width: w } = e.editorRect;
|
|
733
|
+
const { y: f, x: S } = u, Z = z(c), { top: I, left: Y, bottom: C, right: v } = Z;
|
|
734
|
+
let [R, m] = [f + i, S + r];
|
|
735
|
+
if (R < I && I !== -1 && (i = C - R, R = C, m > Y ? (m--, r--) : (r = v - m, m = v)), R > C && C !== -1 && (i = I - R, R = I, m < v ? (m++, r++) : (r = Y - m, m = Y)), m < Y && Y !== -1 && (r = v - m, m = v, R > I ? (R--, i--) : (i = C - R, R = C)), m > v && v !== -1 && (r = Y - m, m = Y, R < C ? (R++, i++) : (i = I - R, R = I)), R < 1 || t < R || m < 1 || n < m)
|
|
736
|
+
return e;
|
|
737
|
+
if (a.isRowFiltered(R)) {
|
|
738
|
+
const A = i >= 0 ? 1 : -1, Q = I !== -1 ? I : 1, V = C !== -1 ? C : t;
|
|
739
|
+
for (; R >= Q && R <= V && a.isRowFiltered(R); )
|
|
740
|
+
R += A;
|
|
741
|
+
if (R < Q || R > V || a.isRowFiltered(R))
|
|
742
|
+
return e;
|
|
743
|
+
}
|
|
744
|
+
if (i > 0)
|
|
745
|
+
for (let A = f; A < R; A++)
|
|
746
|
+
g += ((H = a.getCell({ y: A, x: 0 }, { resolution: "SYSTEM" })) == null ? void 0 : H.height) || F;
|
|
747
|
+
else if (i < 0)
|
|
748
|
+
for (let A = f - 1; A >= R; A--)
|
|
749
|
+
g -= ((b = a.getCell({ y: A, x: 0 }, { resolution: "SYSTEM" })) == null ? void 0 : b.height) || F;
|
|
750
|
+
if (r > 0)
|
|
751
|
+
for (let A = S; A < m; A++)
|
|
752
|
+
p += ((P = a.getCell({ y: 0, x: A }, { resolution: "SYSTEM" })) == null ? void 0 : P.width) || k;
|
|
753
|
+
else if (r < 0)
|
|
754
|
+
for (let A = S - 1; A >= m; A--)
|
|
755
|
+
p -= ((T = a.getCell({ y: 0, x: A }, { resolution: "SYSTEM" })) == null ? void 0 : T.width) || k;
|
|
756
|
+
const X = a.getCell({ y: R, x: m }, { resolution: "SYSTEM" });
|
|
757
|
+
return x = (X == null ? void 0 : X.height) || F, w = (X == null ? void 0 : X.width) || k, J(a, d.current, { y: R, x: m }), {
|
|
758
|
+
...e,
|
|
759
|
+
choosing: { y: R, x: m },
|
|
760
|
+
editorRect: { y: g, x: p, height: x, width: w }
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
const it = new st().bind();
|
|
765
|
+
class ot extends h {
|
|
766
|
+
reduce(e, s) {
|
|
767
|
+
return {
|
|
768
|
+
...e,
|
|
769
|
+
inputting: s
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
const Ot = new ot().bind();
|
|
774
|
+
class rt extends h {
|
|
775
|
+
constructor() {
|
|
776
|
+
super(...arguments), this.mutation = !0;
|
|
777
|
+
}
|
|
778
|
+
reduce(e, s) {
|
|
779
|
+
const { numRows: t, y: n, operator: i } = s, { sheetReactive: r, selectingZone: u, choosing: c } = e, l = r.current;
|
|
780
|
+
return l == null ? e : (l.insertRows({
|
|
781
|
+
y: n,
|
|
782
|
+
numRows: t,
|
|
783
|
+
baseY: n,
|
|
784
|
+
operator: i,
|
|
785
|
+
undoReflection: y({
|
|
786
|
+
sheetId: l.id,
|
|
787
|
+
selectingZone: u,
|
|
788
|
+
choosing: c
|
|
789
|
+
}),
|
|
790
|
+
redoReflection: y({
|
|
791
|
+
sheetId: l.id,
|
|
792
|
+
selectingZone: u,
|
|
793
|
+
choosing: c
|
|
794
|
+
})
|
|
795
|
+
}), {
|
|
796
|
+
...e,
|
|
797
|
+
sheetReactive: { current: l }
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
const ct = new rt().bind();
|
|
802
|
+
class ut extends h {
|
|
803
|
+
constructor() {
|
|
804
|
+
super(...arguments), this.mutation = !0;
|
|
805
|
+
}
|
|
806
|
+
reduce(e, s) {
|
|
807
|
+
const { numRows: t, y: n, operator: i } = s, { sheetReactive: r, selectingZone: u, choosing: c, editorRef: l } = e, d = r.current;
|
|
808
|
+
if (d == null)
|
|
809
|
+
return e;
|
|
810
|
+
const a = {
|
|
811
|
+
...u,
|
|
812
|
+
startY: u.startY + t,
|
|
813
|
+
endY: u.endY + t
|
|
814
|
+
}, g = { ...c, y: c.y + t };
|
|
815
|
+
return d.insertRows({
|
|
816
|
+
y: n + 1,
|
|
817
|
+
numRows: t,
|
|
818
|
+
baseY: n,
|
|
819
|
+
operator: i,
|
|
820
|
+
undoReflection: y({
|
|
821
|
+
sheetId: d.id,
|
|
822
|
+
selectingZone: u,
|
|
823
|
+
choosing: c
|
|
824
|
+
}),
|
|
825
|
+
redoReflection: y({
|
|
826
|
+
sheetId: d.id,
|
|
827
|
+
selectingZone: a,
|
|
828
|
+
choosing: g
|
|
829
|
+
})
|
|
830
|
+
}), {
|
|
831
|
+
...e,
|
|
832
|
+
selectingZone: a,
|
|
833
|
+
choosing: g,
|
|
834
|
+
sheetReactive: { current: d }
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
const dt = new ut().bind();
|
|
839
|
+
class at extends h {
|
|
840
|
+
constructor() {
|
|
841
|
+
super(...arguments), this.mutation = !0;
|
|
842
|
+
}
|
|
843
|
+
reduce(e, s) {
|
|
844
|
+
const { numCols: t, x: n, operator: i } = s, { sheetReactive: r, selectingZone: u, choosing: c, editorRef: l } = e, d = r.current;
|
|
845
|
+
return d == null ? e : (d.insertCols({
|
|
846
|
+
x: n,
|
|
847
|
+
numCols: t,
|
|
848
|
+
baseX: n,
|
|
849
|
+
operator: i,
|
|
850
|
+
undoReflection: y({
|
|
851
|
+
sheetId: d.id,
|
|
852
|
+
selectingZone: u,
|
|
853
|
+
choosing: c
|
|
854
|
+
}),
|
|
855
|
+
redoReflection: y({
|
|
856
|
+
sheetId: d.id,
|
|
857
|
+
selectingZone: u,
|
|
858
|
+
choosing: c
|
|
859
|
+
})
|
|
860
|
+
}), {
|
|
861
|
+
...e,
|
|
862
|
+
sheetReactive: { current: d }
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
const lt = new at().bind();
|
|
867
|
+
class ht extends h {
|
|
868
|
+
constructor() {
|
|
869
|
+
super(...arguments), this.mutation = !0;
|
|
870
|
+
}
|
|
871
|
+
reduce(e, s) {
|
|
872
|
+
const { numCols: t, x: n, operator: i } = s, { sheetReactive: r, selectingZone: u, choosing: c } = e, l = r.current;
|
|
873
|
+
if (l == null)
|
|
874
|
+
return e;
|
|
875
|
+
const d = {
|
|
876
|
+
...u,
|
|
877
|
+
startX: u.startX + t,
|
|
878
|
+
endX: u.endX + t
|
|
879
|
+
}, a = { ...c, x: c.x + t };
|
|
880
|
+
return u.startX += t, u.endX += t, l.insertCols({
|
|
881
|
+
x: n + 1,
|
|
882
|
+
numCols: t,
|
|
883
|
+
baseX: n,
|
|
884
|
+
operator: i,
|
|
885
|
+
undoReflection: y({
|
|
886
|
+
sheetId: l.id,
|
|
887
|
+
selectingZone: u,
|
|
888
|
+
choosing: c
|
|
889
|
+
}),
|
|
890
|
+
redoReflection: y({
|
|
891
|
+
sheetId: l.id,
|
|
892
|
+
selectingZone: d,
|
|
893
|
+
choosing: a
|
|
894
|
+
})
|
|
895
|
+
}), {
|
|
896
|
+
...e,
|
|
897
|
+
selectingZone: d,
|
|
898
|
+
choosing: a,
|
|
899
|
+
sheetReactive: { current: l }
|
|
900
|
+
};
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
const gt = new ht().bind();
|
|
904
|
+
class ft extends h {
|
|
905
|
+
constructor() {
|
|
906
|
+
super(...arguments), this.mutation = !0;
|
|
907
|
+
}
|
|
908
|
+
reduce(e, s) {
|
|
909
|
+
const { numRows: t, y: n, operator: i } = s, { sheetReactive: r, selectingZone: u, choosing: c, editorRef: l } = e, d = r.current;
|
|
910
|
+
return d == null ? e : (d.removeRows({
|
|
911
|
+
y: n,
|
|
912
|
+
numRows: t,
|
|
913
|
+
operator: i,
|
|
914
|
+
undoReflection: y({
|
|
915
|
+
sheetId: d.id,
|
|
916
|
+
selectingZone: u,
|
|
917
|
+
choosing: c,
|
|
918
|
+
sheetHeight: e.sheetHeight
|
|
919
|
+
}),
|
|
920
|
+
redoReflection: y({
|
|
921
|
+
sheetId: d.id,
|
|
922
|
+
selectingZone: u,
|
|
923
|
+
choosing: c
|
|
924
|
+
})
|
|
925
|
+
}), {
|
|
926
|
+
...e,
|
|
927
|
+
sheetReactive: { current: d }
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
const Rt = new ft().bind();
|
|
932
|
+
class wt extends h {
|
|
933
|
+
constructor() {
|
|
934
|
+
super(...arguments), this.mutation = !0;
|
|
935
|
+
}
|
|
936
|
+
reduce(e, s) {
|
|
937
|
+
const { numCols: t, x: n, operator: i } = s, { sheetReactive: r, selectingZone: u, choosing: c, editorRef: l } = e, d = r.current;
|
|
938
|
+
return d == null ? e : (d.removeCols({
|
|
939
|
+
x: n,
|
|
940
|
+
numCols: t,
|
|
941
|
+
operator: i,
|
|
942
|
+
undoReflection: y({
|
|
943
|
+
sheetId: d.id,
|
|
944
|
+
selectingZone: u,
|
|
945
|
+
choosing: c,
|
|
946
|
+
sheetWidth: e.sheetWidth
|
|
947
|
+
}),
|
|
948
|
+
redoReflection: y({
|
|
949
|
+
sheetId: d.id,
|
|
950
|
+
selectingZone: u,
|
|
951
|
+
choosing: c
|
|
952
|
+
})
|
|
953
|
+
}), {
|
|
954
|
+
...e,
|
|
955
|
+
sheetReactive: { current: d }
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
const St = new wt().bind();
|
|
960
|
+
class xt extends h {
|
|
961
|
+
constructor() {
|
|
962
|
+
super(...arguments), this.mutation = !0;
|
|
963
|
+
}
|
|
964
|
+
reduce(e, s) {
|
|
965
|
+
const { x: t, direction: n } = s, { sheetReactive: i, selectingZone: r, choosing: u } = e, c = i.current;
|
|
966
|
+
if (c == null)
|
|
967
|
+
return e;
|
|
968
|
+
c.sortRows({ x: t, direction: n });
|
|
969
|
+
const l = y({ sheetId: c.id, selectingZone: r, choosing: u });
|
|
970
|
+
return c.registry.lastHistory && (c.registry.lastHistory.undoReflection = l, c.registry.lastHistory.redoReflection = l), {
|
|
971
|
+
...e,
|
|
972
|
+
sheetReactive: { current: c }
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
const mt = new xt().bind();
|
|
977
|
+
class yt extends h {
|
|
978
|
+
constructor() {
|
|
979
|
+
super(...arguments), this.mutation = !0;
|
|
980
|
+
}
|
|
981
|
+
reduce(e, s) {
|
|
982
|
+
const { x: t, filter: n } = s, { sheetReactive: i, selectingZone: r, choosing: u } = e, c = i.current;
|
|
983
|
+
if (c == null)
|
|
984
|
+
return e;
|
|
985
|
+
c.filterRows({ x: t, filter: n });
|
|
986
|
+
const l = y({ sheetId: c.id, selectingZone: r, choosing: u });
|
|
987
|
+
c.registry.lastHistory && (c.registry.lastHistory.undoReflection = l, c.registry.lastHistory.redoReflection = l);
|
|
988
|
+
let d = u;
|
|
989
|
+
if (c.isRowFiltered(u.y)) {
|
|
990
|
+
for (let a = 1; a <= c.numRows; a++)
|
|
991
|
+
if (!c.isRowFiltered(a)) {
|
|
992
|
+
d = { y: a, x: u.x };
|
|
993
|
+
break;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
return {
|
|
997
|
+
...e,
|
|
998
|
+
choosing: d,
|
|
999
|
+
selectingZone: d !== u ? E : r,
|
|
1000
|
+
sheetReactive: { current: c },
|
|
1001
|
+
callback: ({ sheetReactive: a }) => {
|
|
1002
|
+
const g = a.current;
|
|
1003
|
+
g && g.registry.transmit({
|
|
1004
|
+
cutting: !1,
|
|
1005
|
+
copyingZone: E
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
const pt = new yt().bind();
|
|
1012
|
+
class vt extends h {
|
|
1013
|
+
reduce(e, s) {
|
|
1014
|
+
return {
|
|
1015
|
+
...e,
|
|
1016
|
+
columnMenuState: s
|
|
1017
|
+
};
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
const qt = new vt().bind();
|
|
1021
|
+
class bt extends h {
|
|
1022
|
+
reduce(e, s) {
|
|
1023
|
+
return {
|
|
1024
|
+
...e,
|
|
1025
|
+
rowMenuState: s
|
|
1026
|
+
};
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
const Qt = new bt().bind();
|
|
1030
|
+
class At extends h {
|
|
1031
|
+
reduce(e, s) {
|
|
1032
|
+
return {
|
|
1033
|
+
...e,
|
|
1034
|
+
editorHovering: s
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
const Vt = new At().bind();
|
|
1039
|
+
class Ct extends h {
|
|
1040
|
+
reduce(e, s) {
|
|
1041
|
+
return {
|
|
1042
|
+
...e,
|
|
1043
|
+
...s
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
const te = new Ct().bind(), jt = {
|
|
1048
|
+
blur: Ie,
|
|
1049
|
+
copy: Ze,
|
|
1050
|
+
cut: Me,
|
|
1051
|
+
paste: Te,
|
|
1052
|
+
escape: Fe,
|
|
1053
|
+
choose: Le,
|
|
1054
|
+
select: Pe,
|
|
1055
|
+
selectRows: Be,
|
|
1056
|
+
selectCols: Ue,
|
|
1057
|
+
drag: Oe,
|
|
1058
|
+
search: Qe,
|
|
1059
|
+
write: je,
|
|
1060
|
+
clear: Ke,
|
|
1061
|
+
undo: $e,
|
|
1062
|
+
redo: et,
|
|
1063
|
+
arrow: nt,
|
|
1064
|
+
walk: it,
|
|
1065
|
+
insertRowsAbove: ct,
|
|
1066
|
+
insertRowsBelow: dt,
|
|
1067
|
+
insertColsLeft: lt,
|
|
1068
|
+
insertColsRight: gt,
|
|
1069
|
+
removeRows: Rt,
|
|
1070
|
+
removeCols: St,
|
|
1071
|
+
sortRows: mt,
|
|
1072
|
+
filterRows: pt
|
|
1073
|
+
}, Gt = () => {
|
|
1074
|
+
const [o, e] = N(!1);
|
|
1075
|
+
return O(() => {
|
|
1076
|
+
e(!0);
|
|
1077
|
+
}, []), o && typeof window < "u" ? { window, document } : { window: null, document: null };
|
|
1078
|
+
}, Kt = (o, e = 100) => {
|
|
1079
|
+
const s = j(o), t = j();
|
|
1080
|
+
return O(() => {
|
|
1081
|
+
s.current = o;
|
|
1082
|
+
}, [o]), (...n) => {
|
|
1083
|
+
window.clearTimeout(t.current), t.current = window.setTimeout(() => {
|
|
1084
|
+
s.current(...n);
|
|
1085
|
+
}, e);
|
|
1086
|
+
};
|
|
1087
|
+
}, Nt = (o = {}) => {
|
|
1088
|
+
const [e, s] = N(() => ue(o)), { registry: t } = e;
|
|
1089
|
+
return t.updateSheet = ve, t.transmit = (n) => {
|
|
1090
|
+
Object.assign(t, n), t.ready && requestAnimationFrame(() => s({ registry: t }));
|
|
1091
|
+
}, O(() => {
|
|
1092
|
+
Object.assign(t, o);
|
|
1093
|
+
}, [o]), e;
|
|
1094
|
+
};
|
|
1095
|
+
export {
|
|
1096
|
+
lt as A,
|
|
1097
|
+
dt as B,
|
|
1098
|
+
ct as C,
|
|
1099
|
+
Pt as D,
|
|
1100
|
+
qt as E,
|
|
1101
|
+
Qt as F,
|
|
1102
|
+
Zt as G,
|
|
1103
|
+
Ut as H,
|
|
1104
|
+
Le as I,
|
|
1105
|
+
Oe as J,
|
|
1106
|
+
_t as K,
|
|
1107
|
+
Dt as L,
|
|
1108
|
+
Lt as M,
|
|
1109
|
+
Ue as N,
|
|
1110
|
+
Kt as O,
|
|
1111
|
+
Be as P,
|
|
1112
|
+
Qe as Q,
|
|
1113
|
+
Tt as R,
|
|
1114
|
+
Ht as S,
|
|
1115
|
+
Ft as T,
|
|
1116
|
+
Nt as U,
|
|
1117
|
+
Xt as V,
|
|
1118
|
+
Mt as W,
|
|
1119
|
+
jt as X,
|
|
1120
|
+
Ot as a,
|
|
1121
|
+
ve as b,
|
|
1122
|
+
$e as c,
|
|
1123
|
+
Me as d,
|
|
1124
|
+
Et as e,
|
|
1125
|
+
Wt as f,
|
|
1126
|
+
Ze as g,
|
|
1127
|
+
Pe as h,
|
|
1128
|
+
nt as i,
|
|
1129
|
+
Fe as j,
|
|
1130
|
+
Ke as k,
|
|
1131
|
+
it as l,
|
|
1132
|
+
Vt as m,
|
|
1133
|
+
te as n,
|
|
1134
|
+
zt as o,
|
|
1135
|
+
Te as p,
|
|
1136
|
+
Bt as q,
|
|
1137
|
+
et as r,
|
|
1138
|
+
kt as s,
|
|
1139
|
+
pt as t,
|
|
1140
|
+
Gt as u,
|
|
1141
|
+
mt as v,
|
|
1142
|
+
je as w,
|
|
1143
|
+
St as x,
|
|
1144
|
+
Rt as y,
|
|
1145
|
+
gt as z
|
|
1146
|
+
};
|
|
1147
|
+
//# sourceMappingURL=hooks-CcD8I6FA.mjs.map
|