@fileverse-dev/fortune-react 1.3.13-create-3 → 1.3.13-create-5
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/es/components/FxEditor/index.js +73 -18
- package/es/components/SheetOverlay/ContentEditable.js +4 -3
- package/es/components/SheetOverlay/InputBox.js +193 -44
- package/es/components/SheetOverlay/drag_and_drop/column-helpers.js +4 -27
- package/es/components/SheetOverlay/drag_and_drop/row-helpers.js +4 -25
- package/es/components/SheetOverlay/formula-segment-boundary.js +1 -1
- package/es/components/SheetOverlay/helper.d.ts +7 -0
- package/es/components/SheetOverlay/helper.js +75 -0
- package/es/components/SheetOverlay/index.css +10 -83
- package/es/components/SheetOverlay/index.js +1 -26
- package/es/components/Toolbar/ColorPicker.js +3 -2
- package/es/components/Toolbar/CustomColor.js +7 -3
- package/es/components/Toolbar/index.js +11 -2
- package/es/hooks/useFormulaEditorHistory.d.ts +4 -4
- package/es/hooks/useFormulaEditorHistory.js +87 -59
- package/es/hooks/useRerenderOnFormulaCaret.d.ts +1 -1
- package/es/hooks/useRerenderOnFormulaCaret.js +6 -3
- package/lib/components/FxEditor/index.js +72 -17
- package/lib/components/SheetOverlay/ContentEditable.js +4 -3
- package/lib/components/SheetOverlay/InputBox.js +192 -43
- package/lib/components/SheetOverlay/drag_and_drop/column-helpers.js +3 -26
- package/lib/components/SheetOverlay/drag_and_drop/row-helpers.js +3 -24
- package/lib/components/SheetOverlay/formula-segment-boundary.js +1 -1
- package/lib/components/SheetOverlay/helper.d.ts +7 -0
- package/lib/components/SheetOverlay/helper.js +79 -0
- package/lib/components/SheetOverlay/index.css +10 -83
- package/lib/components/SheetOverlay/index.js +1 -26
- package/lib/components/Toolbar/ColorPicker.js +3 -2
- package/lib/components/Toolbar/CustomColor.js +7 -3
- package/lib/components/Toolbar/index.js +10 -1
- package/lib/hooks/useFormulaEditorHistory.d.ts +4 -4
- package/lib/hooks/useFormulaEditorHistory.js +85 -58
- package/lib/hooks/useRerenderOnFormulaCaret.d.ts +1 -1
- package/lib/hooks/useRerenderOnFormulaCaret.js +5 -2
- package/package.json +2 -2
|
@@ -12,7 +12,7 @@ import usePrevious from "../../hooks/usePrevious";
|
|
|
12
12
|
import { useFormulaEditorHistory } from "../../hooks/useFormulaEditorHistory";
|
|
13
13
|
import { useRerenderOnFormulaCaret } from "../../hooks/useRerenderOnFormulaCaret";
|
|
14
14
|
import { LucideIcon } from "../SheetOverlay/LucideIcon";
|
|
15
|
-
import { countCommasBeforeCursor, getCursorPosition, getFunctionNameFromFormulaCaretSpans, isLetterNumberPattern, setCursorPosition, buildFormulaSuggestionText, shouldShowFormulaFunctionList } from "../SheetOverlay/helper";
|
|
15
|
+
import { countCommasBeforeCursor, getCursorPosition, getFunctionNameFromFormulaCaretSpans, isEditorUndoRedoKeyEvent, isLetterNumberPattern, setCursorPosition, buildFormulaSuggestionText, shouldShowFormulaFunctionList } from "../SheetOverlay/helper";
|
|
16
16
|
import { isFormulaSegmentBoundaryKey } from "../SheetOverlay/formula-segment-boundary";
|
|
17
17
|
var FxEditor = function FxEditor() {
|
|
18
18
|
var _a, _b, _c;
|
|
@@ -32,12 +32,11 @@ var FxEditor = function FxEditor() {
|
|
|
32
32
|
refs = _g.refs;
|
|
33
33
|
var lastKeyDownEventRef = useRef(null);
|
|
34
34
|
var _h = useFormulaEditorHistory(refs.fxInput, refs.cellInput, refs.fxInput, setContext, "fx"),
|
|
35
|
-
formulaHistoryRef = _h.formulaHistoryRef,
|
|
36
35
|
preTextRef = _h.preTextRef,
|
|
37
36
|
resetFormulaHistory = _h.resetFormulaHistory,
|
|
38
37
|
handleFormulaHistoryUndoRedo = _h.handleFormulaHistoryUndoRedo,
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
capturePreEditorHistoryState = _h.capturePreEditorHistoryState,
|
|
39
|
+
appendEditorHistoryFromPrimaryEditor = _h.appendEditorHistoryFromPrimaryEditor;
|
|
41
40
|
var inputContainerRef = useRef(null);
|
|
42
41
|
var _j = useState(false),
|
|
43
42
|
isHidenRC = _j[0],
|
|
@@ -279,7 +278,20 @@ var FxEditor = function FxEditor() {
|
|
|
279
278
|
var currentCommaCount = countCommasBeforeCursor((_a = refs.fxInput) === null || _a === void 0 ? void 0 : _a.current);
|
|
280
279
|
setCommaCount(currentCommaCount);
|
|
281
280
|
lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
|
|
282
|
-
|
|
281
|
+
if (!isEditorUndoRedoKeyEvent(e.nativeEvent)) {
|
|
282
|
+
capturePreEditorHistoryState();
|
|
283
|
+
}
|
|
284
|
+
var isPotentialContentKey = !e.metaKey && !e.ctrlKey && !e.altKey && (e.key.length === 1 || e.key === "Backspace" || e.key === "Delete" || e.key === "Enter" || e.key === "Tab");
|
|
285
|
+
if (isPotentialContentKey) {
|
|
286
|
+
requestAnimationFrame(function () {
|
|
287
|
+
requestAnimationFrame(function () {
|
|
288
|
+
if (getFormulaEditorOwner(context) !== "fx") return;
|
|
289
|
+
appendEditorHistoryFromPrimaryEditor(function () {
|
|
290
|
+
return getCursorPosition(refs.fxInput.current);
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
}
|
|
283
295
|
recentText.current = refs.fxInput.current.innerText;
|
|
284
296
|
var key = e.key;
|
|
285
297
|
var currentInputText = ((_c = (_b = refs.fxInput.current) === null || _b === void 0 ? void 0 : _b.innerText) === null || _c === void 0 ? void 0 : _c.trim()) || "";
|
|
@@ -331,14 +343,20 @@ var FxEditor = function FxEditor() {
|
|
|
331
343
|
}
|
|
332
344
|
if ((e.metaKey || e.ctrlKey) && context.luckysheetCellUpdate.length > 0) {
|
|
333
345
|
if (e.code === "KeyZ" || e.code === "KeyY") {
|
|
334
|
-
var
|
|
335
|
-
|
|
336
|
-
var handledByFormulaHistory = handleFormulaHistoryUndoRedo(e.code === "KeyY" || e.code === "KeyZ" && e.shiftKey);
|
|
337
|
-
if (handledByFormulaHistory) {
|
|
338
|
-
e.preventDefault();
|
|
339
|
-
}
|
|
340
|
-
}
|
|
346
|
+
var isRedo_1 = e.code === "KeyY" || e.code === "KeyZ" && e.shiftKey;
|
|
347
|
+
e.preventDefault();
|
|
341
348
|
e.stopPropagation();
|
|
349
|
+
var _attempt_ = function attempt_1(triesLeft) {
|
|
350
|
+
var handled = handleFormulaHistoryUndoRedo(isRedo_1);
|
|
351
|
+
if (handled) return;
|
|
352
|
+
if (triesLeft <= 0) return;
|
|
353
|
+
requestAnimationFrame(function () {
|
|
354
|
+
requestAnimationFrame(function () {
|
|
355
|
+
return _attempt_(triesLeft - 1);
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
};
|
|
359
|
+
_attempt_(2);
|
|
342
360
|
return;
|
|
343
361
|
}
|
|
344
362
|
}
|
|
@@ -431,7 +449,7 @@ var FxEditor = function FxEditor() {
|
|
|
431
449
|
}
|
|
432
450
|
}
|
|
433
451
|
});
|
|
434
|
-
}, [
|
|
452
|
+
}, [capturePreEditorHistoryState, context.allowEdit, context.luckysheetCellUpdate, handleFormulaHistoryUndoRedo, refs.cellInput, refs.fxInput, setContext]);
|
|
435
453
|
var handleHideShowHint = function handleHideShowHint() {
|
|
436
454
|
var _a, _b, _c, _d;
|
|
437
455
|
var el = (_a = document.getElementsByClassName("cell-hint")) === null || _a === void 0 ? void 0 : _a[0];
|
|
@@ -483,23 +501,55 @@ var FxEditor = function FxEditor() {
|
|
|
483
501
|
if (editor_1) {
|
|
484
502
|
setContext(function (draftCtx) {
|
|
485
503
|
if (!isAllowEdit(draftCtx, draftCtx.luckysheet_select_save)) return;
|
|
504
|
+
if (getFormulaEditorOwner(draftCtx) !== "fx") return;
|
|
505
|
+
if (draftCtx.formulaCache.rangestart || draftCtx.formulaCache.rangedrag_column_start || draftCtx.formulaCache.rangedrag_row_start) {
|
|
506
|
+
rangeHightlightselected(draftCtx, editor_1);
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
draftCtx.formulaCache.selectingRangeIndex = -1;
|
|
510
|
+
createRangeHightlight(draftCtx, editor_1.innerHTML);
|
|
486
511
|
rangeHightlightselected(draftCtx, editor_1);
|
|
487
512
|
});
|
|
488
513
|
}
|
|
489
514
|
return;
|
|
490
515
|
}
|
|
516
|
+
if (isEditorUndoRedoKeyEvent(e)) {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
491
519
|
var kcode = e.keyCode;
|
|
492
520
|
if (!kcode) return;
|
|
493
|
-
appendFormulaHistoryFromPrimaryEditor(function () {
|
|
494
|
-
return getCursorPosition(refs.fxInput.current);
|
|
495
|
-
});
|
|
496
521
|
if (!(kcode >= 112 && kcode <= 123 || kcode <= 46 || kcode === 144 || kcode === 108 || e.ctrlKey || e.altKey || e.shiftKey && (kcode === 37 || kcode === 38 || kcode === 39 || kcode === 40)) || kcode === 8 || kcode === 32 || kcode === 46 || e.ctrlKey && kcode === 86) {
|
|
497
522
|
setContext(function (draftCtx) {
|
|
498
523
|
handleFormulaInput(draftCtx, refs.cellInput.current, refs.fxInput.current, kcode, recentText.current);
|
|
499
524
|
});
|
|
500
525
|
}
|
|
501
|
-
|
|
502
|
-
|
|
526
|
+
requestAnimationFrame(function () {
|
|
527
|
+
if (getFormulaEditorOwner(context) !== "fx") return;
|
|
528
|
+
appendEditorHistoryFromPrimaryEditor(function () {
|
|
529
|
+
return getCursorPosition(refs.fxInput.current);
|
|
530
|
+
});
|
|
531
|
+
});
|
|
532
|
+
}, [appendEditorHistoryFromPrimaryEditor, context.isFlvReadOnly, context.luckysheetCellUpdate, refs.cellInput, refs.fxInput, setContext]);
|
|
533
|
+
var refreshFxFormulaRangeHighlights = useCallback(function () {
|
|
534
|
+
var el = refs.fxInput.current;
|
|
535
|
+
if (!el) return;
|
|
536
|
+
setContext(function (draftCtx) {
|
|
537
|
+
var _a, _b;
|
|
538
|
+
if (draftCtx.luckysheetCellUpdate.length === 0) return;
|
|
539
|
+
if (getFormulaEditorOwner(draftCtx) !== "fx") return;
|
|
540
|
+
if (!isAllowEdit(draftCtx, draftCtx.luckysheet_select_save)) return;
|
|
541
|
+
var t = (_b = (_a = el.innerText) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : "";
|
|
542
|
+
if (!t.startsWith("=")) return;
|
|
543
|
+
if (draftCtx.formulaCache.rangestart || draftCtx.formulaCache.rangedrag_column_start || draftCtx.formulaCache.rangedrag_row_start) {
|
|
544
|
+
rangeHightlightselected(draftCtx, el);
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
draftCtx.formulaCache.selectingRangeIndex = -1;
|
|
548
|
+
createRangeHightlight(draftCtx, el.innerHTML);
|
|
549
|
+
rangeHightlightselected(draftCtx, el);
|
|
550
|
+
});
|
|
551
|
+
}, [refs.fxInput, setContext]);
|
|
552
|
+
useRerenderOnFormulaCaret(refs.fxInput, context.luckysheetCellUpdate.length > 0, refreshFxFormulaRangeHighlights);
|
|
503
553
|
var getFunctionNameFromInput = useCallback(function () {
|
|
504
554
|
var _a, _b, _c, _d;
|
|
505
555
|
var inputText = ((_b = (_a = refs.fxInput) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.innerText) || "";
|
|
@@ -587,11 +637,16 @@ var FxEditor = function FxEditor() {
|
|
|
587
637
|
var currentCommaCount = countCommasBeforeCursor(editor);
|
|
588
638
|
setCommaCount(currentCommaCount);
|
|
589
639
|
setContext(function (draftCtx) {
|
|
640
|
+
var _a;
|
|
590
641
|
if (draftCtx.formulaCache.rangeSelectionActive !== true) return;
|
|
591
642
|
var clickedInsideManagedRange = getFormulaRangeIndexAtCaret(editor) !== null;
|
|
592
643
|
var atValidInsertionPoint = isCaretAtValidFormulaRangeInsertionPoint(editor);
|
|
593
644
|
if (clickedInsideManagedRange || !atValidInsertionPoint) {
|
|
594
645
|
markRangeSelectionDirty(draftCtx);
|
|
646
|
+
if ((_a = editor.innerText) === null || _a === void 0 ? void 0 : _a.trim().startsWith("=")) {
|
|
647
|
+
createRangeHightlight(draftCtx, editor.innerHTML);
|
|
648
|
+
rangeHightlightselected(draftCtx, editor);
|
|
649
|
+
}
|
|
595
650
|
}
|
|
596
651
|
});
|
|
597
652
|
},
|
|
@@ -41,10 +41,11 @@ var ContentEditable = function ContentEditable(_a) {
|
|
|
41
41
|
if (root.current != null) {
|
|
42
42
|
html = root.current.innerHTML;
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
var htmlStr = html || "";
|
|
45
|
+
if (onChange && htmlStr !== lastHtml.current) {
|
|
46
|
+
onChange(htmlStr, isBlur);
|
|
46
47
|
}
|
|
47
|
-
lastHtml.current =
|
|
48
|
+
lastHtml.current = htmlStr;
|
|
48
49
|
}, [root, onChange]);
|
|
49
50
|
var innerRef = props.innerRef,
|
|
50
51
|
_onBlur = props.onBlur;
|
|
@@ -19,9 +19,23 @@ import FormulaHint from "./FormulaHint";
|
|
|
19
19
|
import usePrevious from "../../hooks/usePrevious";
|
|
20
20
|
import { useFormulaEditorHistory } from "../../hooks/useFormulaEditorHistory";
|
|
21
21
|
import { useRerenderOnFormulaCaret } from "../../hooks/useRerenderOnFormulaCaret";
|
|
22
|
-
import { moveCursorToEnd, getCursorPosition, setCursorPosition, buildFormulaSuggestionText, getFunctionNameFromFormulaCaretSpans, isLetterNumberPattern, countCommasBeforeCursor, shouldShowFormulaFunctionList } from "./helper";
|
|
22
|
+
import { moveCursorToEnd, getCursorPosition, setCursorPosition, buildFormulaSuggestionText, getFunctionNameFromFormulaCaretSpans, isLetterNumberPattern, countCommasBeforeCursor, shouldShowFormulaFunctionList, isEditorUndoRedoKeyEvent } from "./helper";
|
|
23
23
|
import { isFormulaSegmentBoundaryKey } from "./formula-segment-boundary";
|
|
24
24
|
import { LucideIcon } from "./LucideIcon";
|
|
25
|
+
var CELL_EDIT_INPUT_EXTRA_RIGHT_PX = 10;
|
|
26
|
+
function measureCellEditorContentWidth(el) {
|
|
27
|
+
var _a;
|
|
28
|
+
if (!el) return 0;
|
|
29
|
+
try {
|
|
30
|
+
var range = document.createRange();
|
|
31
|
+
range.selectNodeContents(el);
|
|
32
|
+
var w = range.getBoundingClientRect().width;
|
|
33
|
+
(_a = range.detach) === null || _a === void 0 ? void 0 : _a.call(range);
|
|
34
|
+
return w;
|
|
35
|
+
} catch (_b) {
|
|
36
|
+
return el.scrollWidth;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
25
39
|
var InputBox = function InputBox() {
|
|
26
40
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
27
41
|
var _q = useContext(WorkbookContext),
|
|
@@ -71,24 +85,29 @@ var InputBox = function InputBox() {
|
|
|
71
85
|
var _1 = useState(false),
|
|
72
86
|
showSearchHint = _1[0],
|
|
73
87
|
setShowSearchHint = _1[1];
|
|
88
|
+
var _2 = useState(0),
|
|
89
|
+
editorLayoutTick = _2[0],
|
|
90
|
+
setEditorLayoutTick = _2[1];
|
|
91
|
+
var _3 = useState(false),
|
|
92
|
+
cellEditorExtendRight = _3[0],
|
|
93
|
+
setCellEditorExtendRight = _3[1];
|
|
74
94
|
var row_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
|
|
75
95
|
var col_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
|
|
76
96
|
var isComposingRef = useRef(false);
|
|
77
97
|
var formulaAnchorCellRef = useRef(null);
|
|
78
98
|
var skipNextAnchorSelectionSyncRef = useRef(false);
|
|
79
99
|
var lastHandledMouseDragSignatureRef = useRef("");
|
|
80
|
-
var
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
appendFormulaHistoryFromPrimaryEditor = _2.appendFormulaHistoryFromPrimaryEditor;
|
|
100
|
+
var _4 = useFormulaEditorHistory(inputRef, refs.cellInput, refs.fxInput, setContext, "cell"),
|
|
101
|
+
preTextRef = _4.preTextRef,
|
|
102
|
+
resetFormulaHistory = _4.resetFormulaHistory,
|
|
103
|
+
handleFormulaHistoryUndoRedo = _4.handleFormulaHistoryUndoRedo,
|
|
104
|
+
capturePreEditorHistoryState = _4.capturePreEditorHistoryState,
|
|
105
|
+
appendEditorHistoryFromPrimaryEditor = _4.appendEditorHistoryFromPrimaryEditor;
|
|
87
106
|
var ZWSP = "\u200B";
|
|
88
107
|
var inputBoxInnerRef = useRef(null);
|
|
89
|
-
var
|
|
90
|
-
linkSelectionHighlightRects =
|
|
91
|
-
setLinkSelectionHighlightRects =
|
|
108
|
+
var _5 = useState([]),
|
|
109
|
+
linkSelectionHighlightRects = _5[0],
|
|
110
|
+
setLinkSelectionHighlightRects = _5[1];
|
|
92
111
|
var ensureNotEmpty = function ensureNotEmpty() {
|
|
93
112
|
var el = inputRef.current;
|
|
94
113
|
if (!el) return;
|
|
@@ -405,12 +424,25 @@ var InputBox = function InputBox() {
|
|
|
405
424
|
});
|
|
406
425
|
}, [formulaMouseDragSignature, context.formulaCache.func_selectedrange, refs.cellInput, setContext]);
|
|
407
426
|
var onKeyDown = useCallback(function (e) {
|
|
408
|
-
var _a, _b, _c;
|
|
427
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
409
428
|
setContext(function (draftCtx) {
|
|
410
429
|
setFormulaEditorOwner(draftCtx, "cell");
|
|
411
430
|
});
|
|
412
431
|
lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
|
|
413
|
-
|
|
432
|
+
if (!isEditorUndoRedoKeyEvent(e.nativeEvent)) {
|
|
433
|
+
capturePreEditorHistoryState();
|
|
434
|
+
}
|
|
435
|
+
var isPotentialContentKey = !e.metaKey && !e.ctrlKey && !e.altKey && (e.key.length === 1 || e.key === "Backspace" || e.key === "Delete" || e.key === "Enter" || e.key === "Tab");
|
|
436
|
+
if (isPotentialContentKey) {
|
|
437
|
+
requestAnimationFrame(function () {
|
|
438
|
+
requestAnimationFrame(function () {
|
|
439
|
+
if (getFormulaEditorOwner(context) !== "cell") return;
|
|
440
|
+
appendEditorHistoryFromPrimaryEditor(function () {
|
|
441
|
+
return getCursorPosition(inputRef.current);
|
|
442
|
+
});
|
|
443
|
+
});
|
|
444
|
+
});
|
|
445
|
+
}
|
|
414
446
|
var currentInputText = ((_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.innerText) === null || _b === void 0 ? void 0 : _b.trim()) || "";
|
|
415
447
|
if ((e.key === "=" || currentInputText.startsWith("=")) && context.luckysheetCellUpdate.length === 2 && formulaAnchorCellRef.current == null) {
|
|
416
448
|
setContext(function (draftCtx) {
|
|
@@ -427,9 +459,9 @@ var InputBox = function InputBox() {
|
|
|
427
459
|
setContext(function (draftCtx) {
|
|
428
460
|
draftCtx.formulaCache.rangeSelectionActive = null;
|
|
429
461
|
});
|
|
430
|
-
var
|
|
431
|
-
anchorRow_1 =
|
|
432
|
-
anchorCol_1 =
|
|
462
|
+
var _m = formulaAnchorCellRef.current,
|
|
463
|
+
anchorRow_1 = _m[0],
|
|
464
|
+
anchorCol_1 = _m[1];
|
|
433
465
|
skipNextAnchorSelectionSyncRef.current = true;
|
|
434
466
|
setTimeout(function () {
|
|
435
467
|
setContext(function (draftCtx) {
|
|
@@ -455,39 +487,93 @@ var InputBox = function InputBox() {
|
|
|
455
487
|
}
|
|
456
488
|
if ((e.metaKey || e.ctrlKey) && context.luckysheetCellUpdate.length > 0) {
|
|
457
489
|
if (e.code === "KeyZ" || e.code === "KeyY") {
|
|
458
|
-
var
|
|
459
|
-
|
|
460
|
-
var handledByFormulaHistory = handleFormulaHistoryUndoRedo(e.code === "KeyY" || e.code === "KeyZ" && e.shiftKey);
|
|
461
|
-
if (handledByFormulaHistory) {
|
|
462
|
-
e.preventDefault();
|
|
463
|
-
}
|
|
464
|
-
}
|
|
490
|
+
var isRedo_1 = e.code === "KeyY" || e.code === "KeyZ" && e.shiftKey;
|
|
491
|
+
e.preventDefault();
|
|
465
492
|
e.stopPropagation();
|
|
493
|
+
var _attempt_ = function attempt_1(triesLeft) {
|
|
494
|
+
var handled = handleFormulaHistoryUndoRedo(isRedo_1);
|
|
495
|
+
if (handled) return;
|
|
496
|
+
if (triesLeft <= 0) return;
|
|
497
|
+
requestAnimationFrame(function () {
|
|
498
|
+
requestAnimationFrame(function () {
|
|
499
|
+
return _attempt_(triesLeft - 1);
|
|
500
|
+
});
|
|
501
|
+
});
|
|
502
|
+
};
|
|
503
|
+
_attempt_(2);
|
|
466
504
|
return;
|
|
467
505
|
}
|
|
468
506
|
if (e.code === "KeyB") {
|
|
507
|
+
var beforeHtml_1 = (_d = (_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.innerHTML) !== null && _d !== void 0 ? _d : "";
|
|
469
508
|
handleBold(context, inputRef.current);
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
509
|
+
var _pushFormattingSnapshot_ = function pushFormattingSnapshot_1(triesLeft) {
|
|
510
|
+
requestAnimationFrame(function () {
|
|
511
|
+
var _a, _b;
|
|
512
|
+
var afterHtml = (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.innerHTML) !== null && _b !== void 0 ? _b : "";
|
|
513
|
+
if (afterHtml !== beforeHtml_1 || triesLeft <= 0) {
|
|
514
|
+
appendEditorHistoryFromPrimaryEditor(function () {
|
|
515
|
+
return getCursorPosition(inputRef.current);
|
|
516
|
+
});
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
_pushFormattingSnapshot_(triesLeft - 1);
|
|
520
|
+
});
|
|
521
|
+
};
|
|
522
|
+
_pushFormattingSnapshot_(2);
|
|
473
523
|
stopPropagation(e);
|
|
474
524
|
} else if (e.code === "KeyI") {
|
|
525
|
+
var beforeHtml_2 = (_f = (_e = inputRef.current) === null || _e === void 0 ? void 0 : _e.innerHTML) !== null && _f !== void 0 ? _f : "";
|
|
475
526
|
handleItalic(context, inputRef.current);
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
527
|
+
var _pushFormattingSnapshot_2 = function pushFormattingSnapshot_2(triesLeft) {
|
|
528
|
+
requestAnimationFrame(function () {
|
|
529
|
+
var _a, _b;
|
|
530
|
+
var afterHtml = (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.innerHTML) !== null && _b !== void 0 ? _b : "";
|
|
531
|
+
if (afterHtml !== beforeHtml_2 || triesLeft <= 0) {
|
|
532
|
+
appendEditorHistoryFromPrimaryEditor(function () {
|
|
533
|
+
return getCursorPosition(inputRef.current);
|
|
534
|
+
});
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
_pushFormattingSnapshot_2(triesLeft - 1);
|
|
538
|
+
});
|
|
539
|
+
};
|
|
540
|
+
_pushFormattingSnapshot_2(2);
|
|
479
541
|
stopPropagation(e);
|
|
480
542
|
} else if (e.code === "KeyU") {
|
|
543
|
+
var beforeHtml_3 = (_h = (_g = inputRef.current) === null || _g === void 0 ? void 0 : _g.innerHTML) !== null && _h !== void 0 ? _h : "";
|
|
481
544
|
handleUnderline(context, inputRef.current);
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
545
|
+
var _pushFormattingSnapshot_3 = function pushFormattingSnapshot_3(triesLeft) {
|
|
546
|
+
requestAnimationFrame(function () {
|
|
547
|
+
var _a, _b;
|
|
548
|
+
var afterHtml = (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.innerHTML) !== null && _b !== void 0 ? _b : "";
|
|
549
|
+
if (afterHtml !== beforeHtml_3 || triesLeft <= 0) {
|
|
550
|
+
appendEditorHistoryFromPrimaryEditor(function () {
|
|
551
|
+
return getCursorPosition(inputRef.current);
|
|
552
|
+
});
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
_pushFormattingSnapshot_3(triesLeft - 1);
|
|
556
|
+
});
|
|
557
|
+
};
|
|
558
|
+
_pushFormattingSnapshot_3(2);
|
|
485
559
|
stopPropagation(e);
|
|
486
560
|
} else if (e.code === "KeyS") {
|
|
561
|
+
var beforeHtml_4 = (_k = (_j = inputRef.current) === null || _j === void 0 ? void 0 : _j.innerHTML) !== null && _k !== void 0 ? _k : "";
|
|
487
562
|
handleStrikeThrough(context, inputRef.current);
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
563
|
+
var _pushFormattingSnapshot_4 = function pushFormattingSnapshot_4(triesLeft) {
|
|
564
|
+
requestAnimationFrame(function () {
|
|
565
|
+
var _a, _b;
|
|
566
|
+
var afterHtml = (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.innerHTML) !== null && _b !== void 0 ? _b : "";
|
|
567
|
+
if (afterHtml !== beforeHtml_4 || triesLeft <= 0) {
|
|
568
|
+
appendEditorHistoryFromPrimaryEditor(function () {
|
|
569
|
+
return getCursorPosition(inputRef.current);
|
|
570
|
+
});
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
_pushFormattingSnapshot_4(triesLeft - 1);
|
|
574
|
+
});
|
|
575
|
+
};
|
|
576
|
+
_pushFormattingSnapshot_4(2);
|
|
491
577
|
stopPropagation(e);
|
|
492
578
|
}
|
|
493
579
|
}
|
|
@@ -497,7 +583,7 @@ var InputBox = function InputBox() {
|
|
|
497
583
|
}
|
|
498
584
|
var allowListNavigation = true;
|
|
499
585
|
var isArrowKey = e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight";
|
|
500
|
-
var isInPlaceEditMode = ((
|
|
586
|
+
var isInPlaceEditMode = ((_l = refs.globalCache) === null || _l === void 0 ? void 0 : _l.enteredEditByTyping) !== true;
|
|
501
587
|
if (e.key === "Delete" || e.key === "Backspace") {
|
|
502
588
|
var anchor = formulaAnchorCellRef.current;
|
|
503
589
|
if (anchor != null) {
|
|
@@ -586,7 +672,7 @@ var InputBox = function InputBox() {
|
|
|
586
672
|
}
|
|
587
673
|
e.preventDefault();
|
|
588
674
|
}
|
|
589
|
-
}, [
|
|
675
|
+
}, [capturePreEditorHistoryState, clearSearchItemActiveClass, context.luckysheetCellUpdate.length, handleFormulaHistoryUndoRedo, selectActiveFormula, setContext, firstSelection, refs.cellInput]);
|
|
590
676
|
var handleHideShowHint = function handleHideShowHint() {
|
|
591
677
|
var _a, _b, _c, _d;
|
|
592
678
|
var searchElFx = (_a = document.getElementsByClassName("fx-search")) === null || _a === void 0 ? void 0 : _a[0];
|
|
@@ -628,11 +714,11 @@ var InputBox = function InputBox() {
|
|
|
628
714
|
}
|
|
629
715
|
return;
|
|
630
716
|
}
|
|
717
|
+
if (isEditorUndoRedoKeyEvent(e)) {
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
631
720
|
var kcode = e.keyCode;
|
|
632
721
|
if (!kcode) return;
|
|
633
|
-
appendFormulaHistoryFromPrimaryEditor(function () {
|
|
634
|
-
return getCursorPosition(inputRef.current);
|
|
635
|
-
});
|
|
636
722
|
if (!(kcode >= 112 && kcode <= 123 || kcode <= 46 || kcode === 144 || kcode === 108 || e.ctrlKey || e.altKey || e.shiftKey && (kcode === 37 || kcode === 38 || kcode === 39 || kcode === 40)) || kcode === 8 || kcode === 32 || kcode === 46 || e.ctrlKey && kcode === 86) {
|
|
637
723
|
setContext(function (draftCtx) {
|
|
638
724
|
var _a, _b;
|
|
@@ -647,7 +733,13 @@ var InputBox = function InputBox() {
|
|
|
647
733
|
}
|
|
648
734
|
});
|
|
649
735
|
}
|
|
650
|
-
|
|
736
|
+
requestAnimationFrame(function () {
|
|
737
|
+
if (getFormulaEditorOwner(context) !== "cell") return;
|
|
738
|
+
appendEditorHistoryFromPrimaryEditor(function () {
|
|
739
|
+
return getCursorPosition(inputRef.current);
|
|
740
|
+
});
|
|
741
|
+
});
|
|
742
|
+
}, [refs.cellInput, refs.fxInput, setContext, appendEditorHistoryFromPrimaryEditor]);
|
|
651
743
|
var onPaste = useCallback(function (e) {
|
|
652
744
|
var plainText = e.clipboardData.getData("text/plain");
|
|
653
745
|
e.preventDefault();
|
|
@@ -668,6 +760,19 @@ var InputBox = function InputBox() {
|
|
|
668
760
|
var rowReadOnly = cfg.rowReadOnly || {};
|
|
669
761
|
var colReadOnly = cfg.colReadOnly || {};
|
|
670
762
|
var edit = !((colReadOnly[col_index] || rowReadOnly[row_index]) && context.allowEdit === true);
|
|
763
|
+
var onInputBoxInnerMouseDown = useCallback(function (e) {
|
|
764
|
+
if (!edit || isHidenRC || context.luckysheetCellUpdate.length === 0) {
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
var editor = refs.cellInput.current;
|
|
768
|
+
if (!editor) return;
|
|
769
|
+
if (editor.contains(e.target)) return;
|
|
770
|
+
e.preventDefault();
|
|
771
|
+
moveCursorToEnd(editor);
|
|
772
|
+
setContext(function (draftCtx) {
|
|
773
|
+
setFormulaEditorOwner(draftCtx, "cell");
|
|
774
|
+
});
|
|
775
|
+
}, [edit, isHidenRC, context.luckysheetCellUpdate.length, refs.cellInput, setContext]);
|
|
671
776
|
var getInputBoxPosition = useCallback(function () {
|
|
672
777
|
var _a;
|
|
673
778
|
if (!firstSelection || ((_a = context.rangeDialog) === null || _a === void 0 ? void 0 : _a.show)) {
|
|
@@ -805,6 +910,20 @@ var InputBox = function InputBox() {
|
|
|
805
910
|
});
|
|
806
911
|
setLinkSelectionHighlightRects(relative);
|
|
807
912
|
}, [(_h = context.linkCard) === null || _h === void 0 ? void 0 : _h.applyToSelection, (_j = context.linkCard) === null || _j === void 0 ? void 0 : _j.selectionOffsets, (_k = context.linkCard) === null || _k === void 0 ? void 0 : _k.r, (_l = context.linkCard) === null || _l === void 0 ? void 0 : _l.c, context.luckysheetCellUpdate]);
|
|
913
|
+
useLayoutEffect(function () {
|
|
914
|
+
if (context.luckysheetCellUpdate.length === 0) {
|
|
915
|
+
setCellEditorExtendRight(false);
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
918
|
+
var baseSel = isInputBoxActive && firstSelectionActiveCell ? firstSelectionActiveCell : firstSelection;
|
|
919
|
+
var cellW = baseSel === null || baseSel === void 0 ? void 0 : baseSel.width;
|
|
920
|
+
if (cellW == null || !inputRef.current) {
|
|
921
|
+
setCellEditorExtendRight(false);
|
|
922
|
+
return;
|
|
923
|
+
}
|
|
924
|
+
var contentW = measureCellEditorContentWidth(inputRef.current);
|
|
925
|
+
setCellEditorExtendRight(contentW + CELL_EDIT_INPUT_EXTRA_RIGHT_PX > cellW);
|
|
926
|
+
}, [editorLayoutTick, context.luckysheetCellUpdate.length, isInputBoxActive, firstSelectionActiveCell, firstSelection, context.zoomRatio]);
|
|
808
927
|
var wraperGetCell = function wraperGetCell() {
|
|
809
928
|
var cell = getCellAddress();
|
|
810
929
|
if (activeRefCell !== cell) {
|
|
@@ -812,7 +931,26 @@ var InputBox = function InputBox() {
|
|
|
812
931
|
}
|
|
813
932
|
return activeCell || cell;
|
|
814
933
|
};
|
|
815
|
-
|
|
934
|
+
var refreshCellFormulaRangeHighlights = useCallback(function () {
|
|
935
|
+
var el = inputRef.current;
|
|
936
|
+
if (!el) return;
|
|
937
|
+
setContext(function (draftCtx) {
|
|
938
|
+
var _a, _b;
|
|
939
|
+
if (draftCtx.luckysheetCellUpdate.length === 0) return;
|
|
940
|
+
if (getFormulaEditorOwner(draftCtx) !== "cell") return;
|
|
941
|
+
if (!isAllowEdit(draftCtx, draftCtx.luckysheet_select_save)) return;
|
|
942
|
+
var t = (_b = (_a = el.innerText) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : "";
|
|
943
|
+
if (!t.startsWith("=")) return;
|
|
944
|
+
if (draftCtx.formulaCache.rangestart || draftCtx.formulaCache.rangedrag_column_start || draftCtx.formulaCache.rangedrag_row_start) {
|
|
945
|
+
rangeHightlightselected(draftCtx, el);
|
|
946
|
+
return;
|
|
947
|
+
}
|
|
948
|
+
draftCtx.formulaCache.selectingRangeIndex = -1;
|
|
949
|
+
createRangeHightlight(draftCtx, el.innerHTML);
|
|
950
|
+
rangeHightlightselected(draftCtx, el);
|
|
951
|
+
});
|
|
952
|
+
}, [setContext]);
|
|
953
|
+
useRerenderOnFormulaCaret(inputRef, context.luckysheetCellUpdate.length > 0, refreshCellFormulaRangeHighlights);
|
|
816
954
|
var getFunctionNameFromInput = useCallback(function () {
|
|
817
955
|
var _a, _b;
|
|
818
956
|
var inputText = ((_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.innerText) || "";
|
|
@@ -849,11 +987,14 @@ var InputBox = function InputBox() {
|
|
|
849
987
|
}, wraperGetCell())), /*#__PURE__*/React.createElement("div", {
|
|
850
988
|
ref: inputBoxInnerRef,
|
|
851
989
|
className: "luckysheet-input-box-inner",
|
|
852
|
-
|
|
990
|
+
onMouseDown: onInputBoxInnerMouseDown,
|
|
991
|
+
style: inputBoxBaseSelection ? __assign(__assign({
|
|
853
992
|
position: "relative",
|
|
854
993
|
minWidth: inputBoxBaseSelection.width,
|
|
855
994
|
minHeight: inputBoxBaseSelection.height
|
|
856
|
-
}, inputBoxStyle)
|
|
995
|
+
}, inputBoxStyle), cellEditorExtendRight ? {
|
|
996
|
+
paddingRight: 2 + CELL_EDIT_INPUT_EXTRA_RIGHT_PX
|
|
997
|
+
} : {}) : {
|
|
857
998
|
position: "relative"
|
|
858
999
|
}
|
|
859
1000
|
}, /*#__PURE__*/React.createElement(ContentEditable, {
|
|
@@ -870,6 +1011,9 @@ var InputBox = function InputBox() {
|
|
|
870
1011
|
}
|
|
871
1012
|
ensureNotEmpty();
|
|
872
1013
|
isComposingRef.current = false;
|
|
1014
|
+
setEditorLayoutTick(function (t) {
|
|
1015
|
+
return t + 1;
|
|
1016
|
+
});
|
|
873
1017
|
},
|
|
874
1018
|
onMouseUp: function onMouseUp() {
|
|
875
1019
|
handleHideShowHint();
|
|
@@ -883,11 +1027,16 @@ var InputBox = function InputBox() {
|
|
|
883
1027
|
var editor = inputRef.current;
|
|
884
1028
|
if (!editor) return;
|
|
885
1029
|
setContext(function (draftCtx) {
|
|
1030
|
+
var _a;
|
|
886
1031
|
if (draftCtx.formulaCache.rangeSelectionActive !== true) return;
|
|
887
1032
|
var clickedInsideManagedRange = getFormulaRangeIndexAtCaret(editor) !== null;
|
|
888
1033
|
var atValidInsertionPoint = isCaretAtValidFormulaRangeInsertionPoint(editor);
|
|
889
1034
|
if (clickedInsideManagedRange || !atValidInsertionPoint) {
|
|
890
1035
|
markRangeSelectionDirty(draftCtx);
|
|
1036
|
+
if ((_a = editor.innerText) === null || _a === void 0 ? void 0 : _a.trim().startsWith("=")) {
|
|
1037
|
+
createRangeHightlight(draftCtx, editor.innerHTML);
|
|
1038
|
+
rangeHightlightselected(draftCtx, editor);
|
|
1039
|
+
}
|
|
891
1040
|
}
|
|
892
1041
|
});
|
|
893
1042
|
},
|
|
@@ -8,33 +8,8 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
8
8
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
9
|
};
|
|
10
10
|
import { useContext, useRef } from "react";
|
|
11
|
-
import { fixPositionOnFrozenCells, getSheetIndex, getFlowdata, colLocation, colLocationByIndex, updateContextWithSheetData, api, indexToColumnChar,
|
|
11
|
+
import { fixPositionOnFrozenCells, getSheetIndex, getFlowdata, colLocation, colLocationByIndex, updateContextWithSheetData, api, indexToColumnChar, remapFormulaReferencesByMap } from "@fileverse-dev/fortune-core";
|
|
12
12
|
import WorkbookContext from "../../../context";
|
|
13
|
-
var REF_TOKEN_REGEX = /((?:'(?:[^']|'')+'|[A-Za-z_][A-Za-z0-9_.]*)!)?(\$?)([A-Za-z]+)(\$?)(\d+)(?::(\$?)([A-Za-z]+)(\$?)(\d+))?/g;
|
|
14
|
-
function normalizeSheetName(raw) {
|
|
15
|
-
if (!raw) return "";
|
|
16
|
-
var noBang = raw.endsWith("!") ? raw.slice(0, -1) : raw;
|
|
17
|
-
if (noBang.startsWith("'") && noBang.endsWith("'")) {
|
|
18
|
-
return noBang.slice(1, -1).replace(/''/g, "'");
|
|
19
|
-
}
|
|
20
|
-
return noBang;
|
|
21
|
-
}
|
|
22
|
-
function remapFormulaCols(formula, formulaSheetName, movedSheetName, colMap) {
|
|
23
|
-
return formula.replace(REF_TOKEN_REGEX, function (token, sheetPrefix, colAbs0, col0, rowAbs0, row0, colAbs1, col1, rowAbs1, row1) {
|
|
24
|
-
var refSheet = normalizeSheetName(sheetPrefix) || formulaSheetName;
|
|
25
|
-
if (refSheet !== movedSheetName) return token;
|
|
26
|
-
var colIdx0 = columnCharToIndex(col0);
|
|
27
|
-
var mapped0 = colMap[colIdx0];
|
|
28
|
-
var nextCol0 = mapped0 == null ? col0 : indexToColumnChar(mapped0);
|
|
29
|
-
if (!col1) {
|
|
30
|
-
return "".concat(sheetPrefix || "").concat(colAbs0).concat(nextCol0).concat(rowAbs0).concat(row0);
|
|
31
|
-
}
|
|
32
|
-
var colIdx1 = columnCharToIndex(col1);
|
|
33
|
-
var mapped1 = colMap[colIdx1];
|
|
34
|
-
var nextCol1 = mapped1 == null ? col1 : indexToColumnChar(mapped1);
|
|
35
|
-
return "".concat(sheetPrefix || "").concat(colAbs0).concat(nextCol0).concat(rowAbs0).concat(row0, ":").concat(colAbs1).concat(nextCol1).concat(rowAbs1).concat(row1);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
13
|
export function numberToColumnName(num) {
|
|
39
14
|
return indexToColumnChar(num);
|
|
40
15
|
}
|
|
@@ -299,7 +274,9 @@ export var useColumnDragAndDrop = function useColumnDragAndDrop(containerRef, se
|
|
|
299
274
|
}
|
|
300
275
|
if (cell.f) {
|
|
301
276
|
var sheetName = _sheet.name || "";
|
|
302
|
-
cell.f =
|
|
277
|
+
cell.f = remapFormulaReferencesByMap(cell.f, sheetName, sheetName, {
|
|
278
|
+
colMap: colMap_1
|
|
279
|
+
});
|
|
303
280
|
}
|
|
304
281
|
}
|
|
305
282
|
});
|
|
@@ -8,31 +8,8 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
8
8
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
9
|
};
|
|
10
10
|
import { useContext, useRef } from "react";
|
|
11
|
-
import { fixPositionOnFrozenCells, getSheetIndex, rowLocation, getFlowdata, rowLocationByIndex, updateContextWithSheetData, api } from "@fileverse-dev/fortune-core";
|
|
11
|
+
import { fixPositionOnFrozenCells, getSheetIndex, rowLocation, getFlowdata, rowLocationByIndex, updateContextWithSheetData, api, remapFormulaReferencesByMap } from "@fileverse-dev/fortune-core";
|
|
12
12
|
import WorkbookContext from "../../../context";
|
|
13
|
-
var REF_TOKEN_REGEX = /((?:'(?:[^']|'')+'|[A-Za-z_][A-Za-z0-9_.]*)!)?(\$?)([A-Za-z]+)(\$?)(\d+)(?::(\$?)([A-Za-z]+)(\$?)(\d+))?/g;
|
|
14
|
-
function normalizeSheetName(raw) {
|
|
15
|
-
if (!raw) return "";
|
|
16
|
-
var noBang = raw.endsWith("!") ? raw.slice(0, -1) : raw;
|
|
17
|
-
if (noBang.startsWith("'") && noBang.endsWith("'")) {
|
|
18
|
-
return noBang.slice(1, -1).replace(/''/g, "'");
|
|
19
|
-
}
|
|
20
|
-
return noBang;
|
|
21
|
-
}
|
|
22
|
-
function remapFormulaRows(formula, formulaSheetName, movedSheetName, rowMap) {
|
|
23
|
-
return formula.replace(REF_TOKEN_REGEX, function (token, sheetPrefix, colAbs0, col0, rowAbs0, row0, colAbs1, col1, rowAbs1, row1) {
|
|
24
|
-
var refSheet = normalizeSheetName(sheetPrefix) || formulaSheetName;
|
|
25
|
-
if (refSheet !== movedSheetName) return token;
|
|
26
|
-
var mapped0 = rowMap[parseInt(row0, 10) - 1];
|
|
27
|
-
var nextRow0 = mapped0 == null ? parseInt(row0, 10) : mapped0 + 1;
|
|
28
|
-
if (!row1) {
|
|
29
|
-
return "".concat(sheetPrefix || "").concat(colAbs0).concat(col0).concat(rowAbs0).concat(nextRow0);
|
|
30
|
-
}
|
|
31
|
-
var mapped1 = rowMap[parseInt(row1, 10) - 1];
|
|
32
|
-
var nextRow1 = mapped1 == null ? parseInt(row1, 10) : mapped1 + 1;
|
|
33
|
-
return "".concat(sheetPrefix || "").concat(colAbs0).concat(col0).concat(rowAbs0).concat(nextRow0, ":").concat(colAbs1).concat(col1).concat(rowAbs1).concat(nextRow1);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
13
|
export var useRowDragAndDrop = function useRowDragAndDrop(containerRef, selectedLocationRef) {
|
|
37
14
|
var DOUBLE_MS = 300;
|
|
38
15
|
var START_DRAG_THRESHOLD_PX = 6;
|
|
@@ -293,7 +270,9 @@ export var useRowDragAndDrop = function useRowDragAndDrop(containerRef, selected
|
|
|
293
270
|
}
|
|
294
271
|
if (cell.f) {
|
|
295
272
|
var sheetName = _sheet.name || "";
|
|
296
|
-
cell.f =
|
|
273
|
+
cell.f = remapFormulaReferencesByMap(cell.f, sheetName, sheetName, {
|
|
274
|
+
rowMap: rowMap_1
|
|
275
|
+
});
|
|
297
276
|
}
|
|
298
277
|
}
|
|
299
278
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var FORMULA_SEGMENT_BOUNDARY_KEYS = new Set([",", "+", "-", "*", "/", "%", "^", "&"]);
|
|
1
|
+
var FORMULA_SEGMENT_BOUNDARY_KEYS = new Set([",", "+", "-", "*", "/", "%", "^", "&", ">", "<", ")"]);
|
|
2
2
|
export function isFormulaSegmentBoundaryKey(key) {
|
|
3
3
|
return FORMULA_SEGMENT_BOUNDARY_KEYS.has(key);
|
|
4
4
|
}
|