@fileverse-dev/fortune-react 1.3.11-mixed → 1.3.12-copyPaste-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.
@@ -294,10 +294,6 @@ var ConditionRules = function ConditionRules(_a) {
294
294
  text: "textContains",
295
295
  value: "()",
296
296
  label: "Text Contains"
297
- }, {
298
- text: "empty",
299
- value: "",
300
- label: "Empty"
301
297
  }, {
302
298
  text: "occurrenceDate",
303
299
  value: conditionformat.yesterday,
@@ -338,7 +334,7 @@ var ConditionRules = function ConditionRules(_a) {
338
334
  marginBottom: "16px"
339
335
  }
340
336
  }, matchedConditionFormatKey.map(function (key) {
341
- var _a, _b, _c;
337
+ var _a, _b;
342
338
  return /*#__PURE__*/React.createElement("div", {
343
339
  onClick: function onClick() {
344
340
  var _a;
@@ -389,10 +385,10 @@ var ConditionRules = function ConditionRules(_a) {
389
385
  }, /*#__PURE__*/React.createElement("h3", {
390
386
  className: "fortune-condition-rules__heading condition-list-type",
391
387
  "data-testid": "condition-rules-heading-".concat(key)
392
- }, conditionformat[allConditionFormats[key].conditionName], allConditionFormats[key].conditionName !== "empty" && " ".concat((_b = (_a = allConditionFormats[key].conditionValue) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : "")), /*#__PURE__*/React.createElement("p", {
388
+ }, conditionformat[allConditionFormats[key].conditionName], " ", (_a = allConditionFormats[key].conditionValue) === null || _a === void 0 ? void 0 : _a[0]), /*#__PURE__*/React.createElement("p", {
393
389
  className: "fortune-condition-rules__para condition-list-range",
394
390
  "data-testid": "condition-rules-para-".concat(key)
395
- }, (_c = allConditionFormats[key].cellrange) === null || _c === void 0 ? void 0 : _c.map(function (range) {
391
+ }, (_b = allConditionFormats[key].cellrange) === null || _b === void 0 ? void 0 : _b.map(function (range) {
396
392
  var startCol = numberToColumn(range.column[0] + 1);
397
393
  var endCol = numberToColumn(range.column[1] + 1);
398
394
  var startRow = range.row[0] + 1;
@@ -471,12 +467,6 @@ var ConditionRules = function ConditionRules(_a) {
471
467
  }, "Format cells if"), /*#__PURE__*/React.createElement(Select, {
472
468
  value: type,
473
469
  onValueChange: function onValueChange(value) {
474
- if (value === "empty" || type === "empty") {
475
- setContext(function (ctx) {
476
- ctx.conditionRules.rulesValue = "";
477
- });
478
- setEditConditionFormatValue(null);
479
- }
480
470
  setType(value);
481
471
  }
482
472
  }, /*#__PURE__*/React.createElement(SelectTrigger, null, /*#__PURE__*/React.createElement(SelectValue, null, /*#__PURE__*/React.createElement("div", {
@@ -814,7 +804,7 @@ var ConditionRules = function ConditionRules(_a) {
814
804
  },
815
805
  tabIndex: 0
816
806
  }, button.cancel), editConditionFormatKey !== null ? (/*#__PURE__*/React.createElement(Button, {
817
- disabled: context.conditionRules.rulesValue === "" && type !== "empty",
807
+ disabled: context.conditionRules.rulesValue === "",
818
808
  variant: "default",
819
809
  style: {
820
810
  minWidth: "80px"
@@ -824,7 +814,7 @@ var ConditionRules = function ConditionRules(_a) {
824
814
  },
825
815
  tabIndex: 0
826
816
  }, "Update rule")) : (/*#__PURE__*/React.createElement(Button, {
827
- disabled: context.conditionRules.rulesValue === "" && type !== "empty",
817
+ disabled: context.conditionRules.rulesValue === "",
828
818
  variant: "default",
829
819
  style: {
830
820
  minWidth: "80px"
@@ -107,9 +107,6 @@ var ConditionalFormat = function ConditionalFormat(_a) {
107
107
  }, {
108
108
  text: "textContains",
109
109
  value: "()"
110
- }, {
111
- text: "empty",
112
- value: ""
113
110
  }, {
114
111
  text: "occurrenceDate",
115
112
  value: conditionformat.yesterday
@@ -6,7 +6,7 @@ export var TEXT_COLORS = [{
6
6
  value: "228, 232, 237"
7
7
  }, {
8
8
  name: "White",
9
- value: "219, 233, 236"
9
+ value: "249, 249, 249"
10
10
  }, {
11
11
  name: "Pink",
12
12
  value: "244, 217, 227"
@@ -17,50 +17,50 @@ import ContentEditable from "./ContentEditable";
17
17
  import FormulaSearch from "./FormulaSearch";
18
18
  import FormulaHint from "./FormulaHint";
19
19
  import usePrevious from "../../hooks/usePrevious";
20
- import { moveCursorToEnd, getCursorPosition, isLetterNumberPattern, removeLastSpan, countCommasBeforeCursor } from "./helper";
20
+ import { moveCursorToEnd, getCursorPosition, isLetterNumberPattern, removeLastSpan, incrementColumn, decrementColumn, incrementRow, decrementRow, countCommasBeforeCursor } from "./helper";
21
21
  import { LucideIcon } from "./LucideIcon";
22
22
  var InputBox = function InputBox() {
23
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
24
- var _p = useContext(WorkbookContext),
25
- context = _p.context,
26
- setContext = _p.setContext,
27
- refs = _p.refs;
23
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
24
+ var _m = useContext(WorkbookContext),
25
+ context = _m.context,
26
+ setContext = _m.setContext,
27
+ refs = _m.refs;
28
28
  var inputRef = useRef(null);
29
29
  var lastKeyDownEventRef = useRef(null);
30
30
  var prevCellUpdate = usePrevious(context.luckysheetCellUpdate);
31
31
  var prevSheetId = usePrevious(context.currentSheetId);
32
- var _q = useState(false),
33
- isHidenRC = _q[0],
34
- setIsHidenRC = _q[1];
35
- var _r = useState(false),
36
- isInputBoxActive = _r[0],
37
- setIsInputBoxActive = _r[1];
38
- var _s = useState(""),
39
- activeCell = _s[0],
40
- setActiveCell = _s[1];
41
- var _t = useState(""),
42
- activeRefCell = _t[0],
43
- setActiveRefCell = _t[1];
44
- var _u = useState({
32
+ var _o = useState(false),
33
+ isHidenRC = _o[0],
34
+ setIsHidenRC = _o[1];
35
+ var _p = useState(false),
36
+ isInputBoxActive = _p[0],
37
+ setIsInputBoxActive = _p[1];
38
+ var _q = useState(""),
39
+ activeCell = _q[0],
40
+ setActiveCell = _q[1];
41
+ var _r = useState(""),
42
+ activeRefCell = _r[0],
43
+ setActiveRefCell = _r[1];
44
+ var _s = useState({
45
45
  left: 0,
46
46
  top: 0
47
47
  }),
48
- frozenPosition = _u[0],
49
- setFrozenPosition = _u[1];
48
+ frozenPosition = _s[0],
49
+ setFrozenPosition = _s[1];
50
50
  var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
51
- var _v = useState({}),
52
- firstSelectionActiveCell = _v[0],
53
- setFirstSelectionActiveCell = _v[1];
54
- var _w = useState(0),
55
- commaCount = _w[0],
56
- setCommaCount = _w[1];
51
+ var _t = useState({}),
52
+ firstSelectionActiveCell = _t[0],
53
+ setFirstSelectionActiveCell = _t[1];
54
+ var _u = useState(0),
55
+ commaCount = _u[0],
56
+ setCommaCount = _u[1];
57
57
  var hideFormulaHintLocal = localStorage.getItem("formulaMore") === "true";
58
- var _x = useState(!hideFormulaHintLocal),
59
- showFormulaHint = _x[0],
60
- setShowFormulaHint = _x[1];
61
- var _y = useState(false),
62
- showSearchHint = _y[0],
63
- setShowSearchHint = _y[1];
58
+ var _v = useState(!hideFormulaHintLocal),
59
+ showFormulaHint = _v[0],
60
+ setShowFormulaHint = _v[1];
61
+ var _w = useState(false),
62
+ showSearchHint = _w[0],
63
+ setShowSearchHint = _w[1];
64
64
  var row_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
65
65
  var col_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
66
66
  var preText = useRef("");
@@ -68,9 +68,9 @@ var InputBox = function InputBox() {
68
68
  var isComposingRef = useRef(false);
69
69
  var ZWSP = "\u200B";
70
70
  var inputBoxInnerRef = useRef(null);
71
- var _z = useState([]),
72
- linkSelectionHighlightRects = _z[0],
73
- setLinkSelectionHighlightRects = _z[1];
71
+ var _x = useState([]),
72
+ linkSelectionHighlightRects = _x[0],
73
+ setLinkSelectionHighlightRects = _x[1];
74
74
  var ensureNotEmpty = function ensureNotEmpty() {
75
75
  var el = inputRef.current;
76
76
  if (!el) return;
@@ -106,7 +106,7 @@ var InputBox = function InputBox() {
106
106
  return style;
107
107
  }
108
108
  return {};
109
- }, [context.luckysheetfile, context.currentSheetId, context.luckysheetCellUpdate, (_b = context === null || context === void 0 ? void 0 : context.luckysheetCellUpdate) === null || _b === void 0 ? void 0 : _b.length, firstSelectionActiveCell, (_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.innerText]);
109
+ }, [context.luckysheetfile, context.currentSheetId, context.luckysheetCellUpdate, (_b = context === null || context === void 0 ? void 0 : context.luckysheetCellUpdate) === null || _b === void 0 ? void 0 : _b.length, firstSelectionActiveCell]);
110
110
  useLayoutEffect(function () {
111
111
  var _a;
112
112
  if (!context.allowEdit) {
@@ -129,8 +129,6 @@ var InputBox = function InputBox() {
129
129
  var flowdata = getFlowdata(context);
130
130
  var cell = (_a = flowdata === null || flowdata === void 0 ? void 0 : flowdata[row_index]) === null || _a === void 0 ? void 0 : _a[col_index];
131
131
  var value_1 = "";
132
- var wasOverwrite = refs.globalCache.overwriteCell;
133
- var overwriteFirstChar = refs.globalCache.overwriteCellFirstChar;
134
132
  if (cell && !refs.globalCache.overwriteCell) {
135
133
  if (isInlineStringCell(cell)) {
136
134
  value_1 = getInlineStringHTML(row_index, col_index, flowdata);
@@ -147,15 +145,9 @@ var InputBox = function InputBox() {
147
145
  }
148
146
  }
149
147
  refs.globalCache.overwriteCell = false;
150
- delete refs.globalCache.overwriteCellFirstChar;
151
- if (wasOverwrite && inputRef.current) {
152
- inputRef.current.innerText = overwriteFirstChar !== null && overwriteFirstChar !== void 0 ? overwriteFirstChar : "";
153
- if (overwriteFirstChar) {
154
- moveToEnd(inputRef.current);
155
- }
156
- } else if (!refs.globalCache.ignoreWriteCell && inputRef.current && value_1) {
148
+ if (!refs.globalCache.ignoreWriteCell && inputRef.current && value_1) {
157
149
  inputRef.current.innerHTML = escapeHTMLTag(escapeScriptTag(value_1));
158
- } else if (!refs.globalCache.ignoreWriteCell && inputRef.current && !value_1 && !wasOverwrite) {
150
+ } else if (!refs.globalCache.ignoreWriteCell && inputRef.current && !value_1) {
159
151
  var valueD = getCellValue(row_index, col_index, flowdata, "f");
160
152
  inputRef.current.innerText = valueD;
161
153
  }
@@ -183,7 +175,7 @@ var InputBox = function InputBox() {
183
175
  if (!firstSelection || ((_a = context.rangeDialog) === null || _a === void 0 ? void 0 : _a.show) || _.isEmpty(context.luckysheetCellUpdate)) {
184
176
  setIsInputBoxActive(false);
185
177
  }
186
- }, [firstSelection, (_d = context.rangeDialog) === null || _d === void 0 ? void 0 : _d.show, context.luckysheetCellUpdate]);
178
+ }, [firstSelection, (_c = context.rangeDialog) === null || _c === void 0 ? void 0 : _c.show, context.luckysheetCellUpdate]);
187
179
  var getActiveFormula = useCallback(function () {
188
180
  return document.querySelector(".luckysheet-formula-search-item-active");
189
181
  }, []);
@@ -278,54 +270,6 @@ var InputBox = function InputBox() {
278
270
  event.stopPropagation();
279
271
  event.preventDefault();
280
272
  };
281
- useEffect(function () {
282
- var _a, _b;
283
- var selection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
284
- var editor = inputRef.current;
285
- if (!selection || !editor || !isInputBoxActive || ((_b = context.rangeDialog) === null || _b === void 0 ? void 0 : _b.show)) {
286
- return;
287
- }
288
- var rowSel = selection.row;
289
- var colSel = selection.column;
290
- if (!rowSel || !colSel || rowSel.length < 2 || colSel.length < 2) return;
291
- var rowStart = Math.min(rowSel[0], rowSel[1]);
292
- var rowEnd = Math.max(rowSel[0], rowSel[1]);
293
- var colStart = Math.min(colSel[0], colSel[1]);
294
- var colEnd = Math.max(colSel[0], colSel[1]);
295
- var startRef = "".concat(indexToColumnChar(colStart)).concat(rowStart + 1);
296
- var endRef = "".concat(indexToColumnChar(colEnd)).concat(rowEnd + 1);
297
- var refText = startRef === endRef ? startRef : "".concat(startRef, ":").concat(endRef);
298
- var editorText = editor.innerText || "";
299
- if (!editorText.startsWith("=")) return;
300
- var spans = editor.querySelectorAll("span");
301
- var lastSpan = spans[spans.length - 1];
302
- var lastSpanText = (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) || "";
303
- var isA1RangePattern = /^[a-zA-Z]+\d+:[a-zA-Z]+\d+$/.test(lastSpanText);
304
- var notFunctionInit = !editorText.includes("(");
305
- var refNotAllowed = lastSpanText.includes(")") || notFunctionInit && /^[a-zA-Z]+$/.test(lastSpanText) && !_.includes(["="], lastSpanText);
306
- var shouldHandleRef = (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.classList.contains("fortune-formula-functionrange-cell")) || isLetterNumberPattern(lastSpanText) || isA1RangePattern || (lastSpanText === "(" || lastSpanText === "," || lastSpanText.includes(":") || lastSpanText === "=") && !lastSpanText.includes('"') && !refNotAllowed && !/^[a-zA-Z]+$/.test(lastSpanText);
307
- if (!shouldHandleRef) return;
308
- var refSpanHtml = "<span class=\"fortune-formula-functionrange-cell\" rangeindex=\"0\" dir=\"auto\" style=\"color:#c1232b;\">".concat(refText, "</span>");
309
- if (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.classList.contains("fortune-formula-functionrange-cell")) {
310
- if (lastSpan.textContent !== refText) lastSpan.textContent = refText;
311
- setTimeout(function () {
312
- return moveCursorToEnd(editor);
313
- }, 1);
314
- return;
315
- }
316
- if (isLetterNumberPattern(lastSpanText) || isA1RangePattern) {
317
- var htmlR = removeLastSpan(editor.innerHTML);
318
- editor.innerHTML = "".concat(htmlR).concat(refSpanHtml);
319
- setTimeout(function () {
320
- return moveCursorToEnd(editor);
321
- }, 1);
322
- return;
323
- }
324
- editor.innerHTML = "".concat(editor.innerHTML).concat(refSpanHtml);
325
- setTimeout(function () {
326
- return moveCursorToEnd(editor);
327
- }, 1);
328
- }, [context.luckysheet_select_save, (_e = context.rangeDialog) === null || _e === void 0 ? void 0 : _e.show, isInputBoxActive]);
329
273
  var onKeyDown = useCallback(function (e) {
330
274
  var _a, _b;
331
275
  lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
@@ -358,18 +302,37 @@ var InputBox = function InputBox() {
358
302
  }, 5);
359
303
  }
360
304
  }
361
- var isArrowKey = e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight";
362
- if (isArrowKey && !(getCursorPosition(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) !== (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.innerText.length) && e.key === "ArrowRight")) {
363
- var editorText = ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.innerText) || "";
364
- var lastSpanText = getLastInputSpanText() || "";
365
- var isA1RangePattern = /^[a-zA-Z]+\d+:[a-zA-Z]+\d+$/.test(lastSpanText);
366
- var notFunctionInit = !editorText.includes("(");
367
- var refNotAllowed = lastSpanText.includes(")") || notFunctionInit && /^[a-zA-Z]+$/.test(lastSpanText) && !_.includes(["="], lastSpanText);
368
- var shouldTreatAsRefNavigation = editorText.startsWith("=") && (Boolean((_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.querySelector(".fortune-formula-functionrange-cell")) || isLetterNumberPattern(lastSpanText) || isA1RangePattern || (lastSpanText === "(" || lastSpanText === "," || lastSpanText.includes(":") || lastSpanText === "=") && !lastSpanText.includes('"') && !refNotAllowed && !/^[a-zA-Z]+$/.test(lastSpanText));
369
- if (shouldTreatAsRefNavigation) {
305
+ var refCell = placeRef.current;
306
+ if (e.key === "ArrowUp") {
307
+ refCell = decrementRow(placeRef.current);
308
+ } else if (e.key === "ArrowDown") {
309
+ refCell = incrementRow(placeRef.current);
310
+ } else if (e.key === "ArrowLeft") {
311
+ refCell = decrementColumn(placeRef.current);
312
+ } else if (e.key === "ArrowRight") {
313
+ refCell = incrementColumn(placeRef.current);
314
+ }
315
+ if ((e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight") && !(getCursorPosition(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) !== (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.innerText.length) && e.key === "ArrowRight")) {
316
+ var parser = new DOMParser();
317
+ var doc = parser.parseFromString("<div>".concat((_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.innerHTML, "</div>"), "text/html");
318
+ var spans = doc.querySelectorAll("span");
319
+ var lastSpan = spans[spans.length - 1];
320
+ var notFunctionInit = !((_b = document.getElementById("luckysheet-rich-text-editor")) === null || _b === void 0 ? void 0 : _b.innerText.includes("("));
321
+ var arrowRefNotAllowed = (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")")) || notFunctionInit && /^[a-zA-Z]+$/.test(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) && !_.includes(["="], lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText);
322
+ if (((lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) === "(" || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) === "," || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(":")) || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) !== ")") && !(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes('"')) && !isLetterNumberPattern(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) && !arrowRefNotAllowed && !/^[a-zA-Z]+$/.test(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
323
+ allowListNavigation = false;
324
+ inputRef.current.innerHTML = "".concat(inputRef.current.innerHTML, "<span class=\"fortune-formula-functionrange-cell\" rangeindex=\"0\" dir=\"auto\" style=\"color:#c1232b;\">").concat(refCell, "</span>");
325
+ setTimeout(function () {
326
+ moveCursorToEnd(inputRef.current);
327
+ }, 1);
328
+ }
329
+ if (isLetterNumberPattern(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
370
330
  allowListNavigation = false;
331
+ var htmlR = removeLastSpan(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.innerHTML);
332
+ inputRef.current.innerHTML = "".concat(htmlR, "<span class=\"fortune-formula-functionrange-cell\" rangeindex=\"0\" dir=\"auto\" style=\"color:#c1232b;\">").concat(refCell, "</span>");
333
+ moveCursorToEnd(inputRef.current);
371
334
  setTimeout(function () {
372
- if (inputRef.current) moveCursorToEnd(inputRef.current);
335
+ moveCursorToEnd(inputRef.current);
373
336
  }, 1);
374
337
  }
375
338
  }
@@ -427,7 +390,7 @@ var InputBox = function InputBox() {
427
390
  }
428
391
  e.preventDefault();
429
392
  }
430
- }, [clearSearchItemActiveClass, context.luckysheetCellUpdate.length, selectActiveFormula, setContext]);
393
+ }, [clearSearchItemActiveClass, context.luckysheetCellUpdate.length, selectActiveFormula, setContext, firstSelection]);
431
394
  var handleHideShowHint = function handleHideShowHint() {
432
395
  var _a, _b, _c, _d;
433
396
  var searchElFx = (_a = document.getElementsByClassName("fx-search")) === null || _a === void 0 ? void 0 : _a[0];
@@ -517,7 +480,7 @@ var InputBox = function InputBox() {
517
480
  zIndex: _.isEmpty(context.luckysheetCellUpdate) ? -1 : 19,
518
481
  display: "block"
519
482
  };
520
- }, [firstSelection, (_f = context.rangeDialog) === null || _f === void 0 ? void 0 : _f.show, context.luckysheetCellUpdate, refs.cellArea, isInputBoxActive, frozenPosition, context.scrollLeft, context.scrollTop]);
483
+ }, [firstSelection, (_d = context.rangeDialog) === null || _d === void 0 ? void 0 : _d.show, context.luckysheetCellUpdate, refs.cellArea, isInputBoxActive, frozenPosition, context.scrollLeft, context.scrollTop]);
521
484
  useEffect(function () {
522
485
  var _a;
523
486
  if (firstSelection && !((_a = context.rangeDialog) === null || _a === void 0 ? void 0 : _a.show) && !isInputBoxActive && !_.isEmpty(context.luckysheetCellUpdate)) {
@@ -533,7 +496,7 @@ var InputBox = function InputBox() {
533
496
  setIsInputBoxActive(true);
534
497
  }
535
498
  }
536
- }, [firstSelection, (_g = context.rangeDialog) === null || _g === void 0 ? void 0 : _g.show, context.luckysheetCellUpdate, isInputBoxActive, context.scrollLeft, context.scrollTop, refs.cellArea]);
499
+ }, [firstSelection, (_e = context.rangeDialog) === null || _e === void 0 ? void 0 : _e.show, context.luckysheetCellUpdate, isInputBoxActive, context.scrollLeft, context.scrollTop, refs.cellArea]);
537
500
  var getAddressIndicatorPosition = useCallback(function () {
538
501
  var _a;
539
502
  if (!firstSelection || ((_a = context.rangeDialog) === null || _a === void 0 ? void 0 : _a.show)) {
@@ -546,7 +509,7 @@ var InputBox = function InputBox() {
546
509
  left: "0",
547
510
  display: "block"
548
511
  };
549
- }, [firstSelection, (_h = context.rangeDialog) === null || _h === void 0 ? void 0 : _h.show]);
512
+ }, [firstSelection, (_f = context.rangeDialog) === null || _f === void 0 ? void 0 : _f.show]);
550
513
  var getCellAddress = useCallback(function () {
551
514
  if (!firstSelection) return "";
552
515
  var rowIndex = firstSelection.row_focus || 0;
@@ -596,7 +559,7 @@ var InputBox = function InputBox() {
596
559
  };
597
560
  });
598
561
  setLinkSelectionHighlightRects(relative);
599
- }, [(_j = context.linkCard) === null || _j === void 0 ? void 0 : _j.applyToSelection, (_k = context.linkCard) === null || _k === void 0 ? void 0 : _k.selectionOffsets, (_l = context.linkCard) === null || _l === void 0 ? void 0 : _l.r, (_m = context.linkCard) === null || _m === void 0 ? void 0 : _m.c, context.luckysheetCellUpdate]);
562
+ }, [(_g = context.linkCard) === null || _g === void 0 ? void 0 : _g.applyToSelection, (_h = context.linkCard) === null || _h === void 0 ? void 0 : _h.selectionOffsets, (_j = context.linkCard) === null || _j === void 0 ? void 0 : _j.r, (_k = context.linkCard) === null || _k === void 0 ? void 0 : _k.c, context.luckysheetCellUpdate]);
600
563
  var wraperGetCell = function wraperGetCell() {
601
564
  var cell = getCellAddress();
602
565
  placeRef.current = cell;
@@ -633,7 +596,7 @@ var InputBox = function InputBox() {
633
596
  onMouseUp: function onMouseUp(e) {
634
597
  return e.stopPropagation();
635
598
  }
636
- }, firstSelection && !((_o = context.rangeDialog) === null || _o === void 0 ? void 0 : _o.show) && (/*#__PURE__*/React.createElement("div", {
599
+ }, firstSelection && !((_l = context.rangeDialog) === null || _l === void 0 ? void 0 : _l.show) && (/*#__PURE__*/React.createElement("div", {
637
600
  className: "luckysheet-cell-address-indicator",
638
601
  style: getAddressIndicatorPosition()
639
602
  }, wraperGetCell())), /*#__PURE__*/React.createElement("div", {
@@ -830,12 +830,6 @@
830
830
  cursor: se-resize;
831
831
  }
832
832
 
833
- /* FLV: show blue dashed border for active selection while in edit mode */
834
- .luckysheet-cell-selected-edit-mode .luckysheet-cs-inner-border {
835
- border: 2px dashed #12a5ff;
836
- border-radius: 1px;
837
- }
838
-
839
833
  .fortune-formula-functionrange-highlight .luckysheet-highlight {
840
834
  position: absolute;
841
835
  z-index: 19;
@@ -375,18 +375,18 @@ var SheetOverlay = function SheetOverlay() {
375
375
  }), ((_h = (_g = context.luckysheet_select_save) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0) > 0 && (/*#__PURE__*/React.createElement("div", {
376
376
  id: "luckysheet-cell-selected-boxs"
377
377
  }, context.luckysheet_select_save.map(function (selection, index) {
378
- var _a, _b, _c, _d;
378
+ var _a, _b;
379
379
  return /*#__PURE__*/React.createElement("div", {
380
380
  key: index,
381
381
  id: "luckysheet-cell-selected",
382
- className: "luckysheet-cell-selected".concat(((_b = (_a = context.luckysheetCellUpdate) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0 ? " luckysheet-cell-selected-edit-mode" : ""),
382
+ className: "luckysheet-cell-selected",
383
383
  style: _.assign({
384
384
  left: selection.left_move,
385
385
  top: selection.top_move,
386
386
  width: selection.width_move ? selection.width_move - 1.8 : selection.width_move,
387
387
  height: selection.height_move ? selection.height_move - 1.8 : selection.height_move,
388
388
  display: "block"
389
- }, fixRowStyleOverflowInFreeze(context, selection.row[0], selection.row[1], (_c = refs.globalCache.freezen) === null || _c === void 0 ? void 0 : _c[context.currentSheetId]), fixColumnStyleOverflowInFreeze(context, selection.column[0], selection.column[1], (_d = refs.globalCache.freezen) === null || _d === void 0 ? void 0 : _d[context.currentSheetId])),
389
+ }, fixRowStyleOverflowInFreeze(context, selection.row[0], selection.row[1], (_a = refs.globalCache.freezen) === null || _a === void 0 ? void 0 : _a[context.currentSheetId]), fixColumnStyleOverflowInFreeze(context, selection.column[0], selection.column[1], (_b = refs.globalCache.freezen) === null || _b === void 0 ? void 0 : _b[context.currentSheetId])),
390
390
  onMouseDown: function onMouseDown(e) {
391
391
  e.stopPropagation();
392
392
  var nativeEvent = e.nativeEvent;
@@ -728,8 +728,6 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
728
728
  conditionformat_equal_title: string;
729
729
  conditionformat_textContains: string;
730
730
  conditionformat_textContains_title: string;
731
- conditionformat_empty: string;
732
- conditionformat_empty_title: string;
733
731
  conditionformat_occurrenceDate: string;
734
732
  conditionformat_occurrenceDate_title: string;
735
733
  conditionformat_duplicateValue: string;
@@ -832,7 +830,6 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
832
830
  between2: string;
833
831
  contain: string;
834
832
  textContains: string;
835
- empty: string;
836
833
  duplicateValue: string;
837
834
  uniqueValue: string;
838
835
  top: string;
@@ -735,8 +735,6 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
735
735
  conditionformat_equal_title: string;
736
736
  conditionformat_textContains: string;
737
737
  conditionformat_textContains_title: string;
738
- conditionformat_empty: string;
739
- conditionformat_empty_title: string;
740
738
  conditionformat_occurrenceDate: string;
741
739
  conditionformat_occurrenceDate_title: string;
742
740
  conditionformat_duplicateValue: string;
@@ -839,7 +837,6 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
839
837
  between2: string;
840
838
  contain: string;
841
839
  textContains: string;
842
- empty: string;
843
840
  duplicateValue: string;
844
841
  uniqueValue: string;
845
842
  top: string;
@@ -303,10 +303,6 @@ var ConditionRules = function ConditionRules(_a) {
303
303
  text: "textContains",
304
304
  value: "()",
305
305
  label: "Text Contains"
306
- }, {
307
- text: "empty",
308
- value: "",
309
- label: "Empty"
310
306
  }, {
311
307
  text: "occurrenceDate",
312
308
  value: conditionformat.yesterday,
@@ -347,7 +343,7 @@ var ConditionRules = function ConditionRules(_a) {
347
343
  marginBottom: "16px"
348
344
  }
349
345
  }, matchedConditionFormatKey.map(function (key) {
350
- var _a, _b, _c;
346
+ var _a, _b;
351
347
  return /*#__PURE__*/_react.default.createElement("div", {
352
348
  onClick: function onClick() {
353
349
  var _a;
@@ -398,10 +394,10 @@ var ConditionRules = function ConditionRules(_a) {
398
394
  }, /*#__PURE__*/_react.default.createElement("h3", {
399
395
  className: "fortune-condition-rules__heading condition-list-type",
400
396
  "data-testid": "condition-rules-heading-".concat(key)
401
- }, conditionformat[allConditionFormats[key].conditionName], allConditionFormats[key].conditionName !== "empty" && " ".concat((_b = (_a = allConditionFormats[key].conditionValue) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : "")), /*#__PURE__*/_react.default.createElement("p", {
397
+ }, conditionformat[allConditionFormats[key].conditionName], " ", (_a = allConditionFormats[key].conditionValue) === null || _a === void 0 ? void 0 : _a[0]), /*#__PURE__*/_react.default.createElement("p", {
402
398
  className: "fortune-condition-rules__para condition-list-range",
403
399
  "data-testid": "condition-rules-para-".concat(key)
404
- }, (_c = allConditionFormats[key].cellrange) === null || _c === void 0 ? void 0 : _c.map(function (range) {
400
+ }, (_b = allConditionFormats[key].cellrange) === null || _b === void 0 ? void 0 : _b.map(function (range) {
405
401
  var startCol = (0, _helper.numberToColumn)(range.column[0] + 1);
406
402
  var endCol = (0, _helper.numberToColumn)(range.column[1] + 1);
407
403
  var startRow = range.row[0] + 1;
@@ -480,12 +476,6 @@ var ConditionRules = function ConditionRules(_a) {
480
476
  }, "Format cells if"), /*#__PURE__*/_react.default.createElement(_ui.Select, {
481
477
  value: type,
482
478
  onValueChange: function onValueChange(value) {
483
- if (value === "empty" || type === "empty") {
484
- setContext(function (ctx) {
485
- ctx.conditionRules.rulesValue = "";
486
- });
487
- setEditConditionFormatValue(null);
488
- }
489
479
  setType(value);
490
480
  }
491
481
  }, /*#__PURE__*/_react.default.createElement(_ui.SelectTrigger, null, /*#__PURE__*/_react.default.createElement(_ui.SelectValue, null, /*#__PURE__*/_react.default.createElement("div", {
@@ -823,7 +813,7 @@ var ConditionRules = function ConditionRules(_a) {
823
813
  },
824
814
  tabIndex: 0
825
815
  }, button.cancel), editConditionFormatKey !== null ? (/*#__PURE__*/_react.default.createElement(_ui.Button, {
826
- disabled: context.conditionRules.rulesValue === "" && type !== "empty",
816
+ disabled: context.conditionRules.rulesValue === "",
827
817
  variant: "default",
828
818
  style: {
829
819
  minWidth: "80px"
@@ -833,7 +823,7 @@ var ConditionRules = function ConditionRules(_a) {
833
823
  },
834
824
  tabIndex: 0
835
825
  }, "Update rule")) : (/*#__PURE__*/_react.default.createElement(_ui.Button, {
836
- disabled: context.conditionRules.rulesValue === "" && type !== "empty",
826
+ disabled: context.conditionRules.rulesValue === "",
837
827
  variant: "default",
838
828
  style: {
839
829
  minWidth: "80px"
@@ -116,9 +116,6 @@ var ConditionalFormat = function ConditionalFormat(_a) {
116
116
  }, {
117
117
  text: "textContains",
118
118
  value: "()"
119
- }, {
120
- text: "empty",
121
- value: ""
122
119
  }, {
123
120
  text: "occurrenceDate",
124
121
  value: conditionformat.yesterday
@@ -14,7 +14,7 @@ var TEXT_COLORS = exports.TEXT_COLORS = [{
14
14
  value: "228, 232, 237"
15
15
  }, {
16
16
  name: "White",
17
- value: "219, 233, 236"
17
+ value: "249, 249, 249"
18
18
  }, {
19
19
  name: "Pink",
20
20
  value: "244, 217, 227"
@@ -29,47 +29,47 @@ var __assign = void 0 && (void 0).__assign || function () {
29
29
  return __assign.apply(this, arguments);
30
30
  };
31
31
  var InputBox = function InputBox() {
32
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
33
- var _p = (0, _react.useContext)(_context.default),
34
- context = _p.context,
35
- setContext = _p.setContext,
36
- refs = _p.refs;
32
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
33
+ var _m = (0, _react.useContext)(_context.default),
34
+ context = _m.context,
35
+ setContext = _m.setContext,
36
+ refs = _m.refs;
37
37
  var inputRef = (0, _react.useRef)(null);
38
38
  var lastKeyDownEventRef = (0, _react.useRef)(null);
39
39
  var prevCellUpdate = (0, _usePrevious.default)(context.luckysheetCellUpdate);
40
40
  var prevSheetId = (0, _usePrevious.default)(context.currentSheetId);
41
- var _q = (0, _react.useState)(false),
42
- isHidenRC = _q[0],
43
- setIsHidenRC = _q[1];
44
- var _r = (0, _react.useState)(false),
45
- isInputBoxActive = _r[0],
46
- setIsInputBoxActive = _r[1];
47
- var _s = (0, _react.useState)(""),
48
- activeCell = _s[0],
49
- setActiveCell = _s[1];
50
- var _t = (0, _react.useState)(""),
51
- activeRefCell = _t[0],
52
- setActiveRefCell = _t[1];
53
- var _u = (0, _react.useState)({
41
+ var _o = (0, _react.useState)(false),
42
+ isHidenRC = _o[0],
43
+ setIsHidenRC = _o[1];
44
+ var _p = (0, _react.useState)(false),
45
+ isInputBoxActive = _p[0],
46
+ setIsInputBoxActive = _p[1];
47
+ var _q = (0, _react.useState)(""),
48
+ activeCell = _q[0],
49
+ setActiveCell = _q[1];
50
+ var _r = (0, _react.useState)(""),
51
+ activeRefCell = _r[0],
52
+ setActiveRefCell = _r[1];
53
+ var _s = (0, _react.useState)({
54
54
  left: 0,
55
55
  top: 0
56
56
  }),
57
- frozenPosition = _u[0],
58
- setFrozenPosition = _u[1];
57
+ frozenPosition = _s[0],
58
+ setFrozenPosition = _s[1];
59
59
  var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
60
- var _v = (0, _react.useState)({}),
61
- firstSelectionActiveCell = _v[0],
62
- setFirstSelectionActiveCell = _v[1];
63
- var _w = (0, _react.useState)(0),
64
- commaCount = _w[0],
65
- setCommaCount = _w[1];
60
+ var _t = (0, _react.useState)({}),
61
+ firstSelectionActiveCell = _t[0],
62
+ setFirstSelectionActiveCell = _t[1];
63
+ var _u = (0, _react.useState)(0),
64
+ commaCount = _u[0],
65
+ setCommaCount = _u[1];
66
66
  var hideFormulaHintLocal = localStorage.getItem("formulaMore") === "true";
67
- var _x = (0, _react.useState)(!hideFormulaHintLocal),
68
- showFormulaHint = _x[0],
69
- setShowFormulaHint = _x[1];
70
- var _y = (0, _react.useState)(false),
71
- showSearchHint = _y[0],
72
- setShowSearchHint = _y[1];
67
+ var _v = (0, _react.useState)(!hideFormulaHintLocal),
68
+ showFormulaHint = _v[0],
69
+ setShowFormulaHint = _v[1];
70
+ var _w = (0, _react.useState)(false),
71
+ showSearchHint = _w[0],
72
+ setShowSearchHint = _w[1];
73
73
  var row_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
74
74
  var col_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
75
75
  var preText = (0, _react.useRef)("");
@@ -77,9 +77,9 @@ var InputBox = function InputBox() {
77
77
  var isComposingRef = (0, _react.useRef)(false);
78
78
  var ZWSP = "\u200B";
79
79
  var inputBoxInnerRef = (0, _react.useRef)(null);
80
- var _z = (0, _react.useState)([]),
81
- linkSelectionHighlightRects = _z[0],
82
- setLinkSelectionHighlightRects = _z[1];
80
+ var _x = (0, _react.useState)([]),
81
+ linkSelectionHighlightRects = _x[0],
82
+ setLinkSelectionHighlightRects = _x[1];
83
83
  var ensureNotEmpty = function ensureNotEmpty() {
84
84
  var el = inputRef.current;
85
85
  if (!el) return;
@@ -115,7 +115,7 @@ var InputBox = function InputBox() {
115
115
  return style;
116
116
  }
117
117
  return {};
118
- }, [context.luckysheetfile, context.currentSheetId, context.luckysheetCellUpdate, (_b = context === null || context === void 0 ? void 0 : context.luckysheetCellUpdate) === null || _b === void 0 ? void 0 : _b.length, firstSelectionActiveCell, (_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.innerText]);
118
+ }, [context.luckysheetfile, context.currentSheetId, context.luckysheetCellUpdate, (_b = context === null || context === void 0 ? void 0 : context.luckysheetCellUpdate) === null || _b === void 0 ? void 0 : _b.length, firstSelectionActiveCell]);
119
119
  (0, _react.useLayoutEffect)(function () {
120
120
  var _a;
121
121
  if (!context.allowEdit) {
@@ -138,8 +138,6 @@ var InputBox = function InputBox() {
138
138
  var flowdata = (0, _fortuneCore.getFlowdata)(context);
139
139
  var cell = (_a = flowdata === null || flowdata === void 0 ? void 0 : flowdata[row_index]) === null || _a === void 0 ? void 0 : _a[col_index];
140
140
  var value_1 = "";
141
- var wasOverwrite = refs.globalCache.overwriteCell;
142
- var overwriteFirstChar = refs.globalCache.overwriteCellFirstChar;
143
141
  if (cell && !refs.globalCache.overwriteCell) {
144
142
  if ((0, _fortuneCore.isInlineStringCell)(cell)) {
145
143
  value_1 = (0, _fortuneCore.getInlineStringHTML)(row_index, col_index, flowdata);
@@ -156,15 +154,9 @@ var InputBox = function InputBox() {
156
154
  }
157
155
  }
158
156
  refs.globalCache.overwriteCell = false;
159
- delete refs.globalCache.overwriteCellFirstChar;
160
- if (wasOverwrite && inputRef.current) {
161
- inputRef.current.innerText = overwriteFirstChar !== null && overwriteFirstChar !== void 0 ? overwriteFirstChar : "";
162
- if (overwriteFirstChar) {
163
- (0, _fortuneCore.moveToEnd)(inputRef.current);
164
- }
165
- } else if (!refs.globalCache.ignoreWriteCell && inputRef.current && value_1) {
157
+ if (!refs.globalCache.ignoreWriteCell && inputRef.current && value_1) {
166
158
  inputRef.current.innerHTML = (0, _fortuneCore.escapeHTMLTag)((0, _fortuneCore.escapeScriptTag)(value_1));
167
- } else if (!refs.globalCache.ignoreWriteCell && inputRef.current && !value_1 && !wasOverwrite) {
159
+ } else if (!refs.globalCache.ignoreWriteCell && inputRef.current && !value_1) {
168
160
  var valueD = (0, _fortuneCore.getCellValue)(row_index, col_index, flowdata, "f");
169
161
  inputRef.current.innerText = valueD;
170
162
  }
@@ -192,7 +184,7 @@ var InputBox = function InputBox() {
192
184
  if (!firstSelection || ((_a = context.rangeDialog) === null || _a === void 0 ? void 0 : _a.show) || _lodash.default.isEmpty(context.luckysheetCellUpdate)) {
193
185
  setIsInputBoxActive(false);
194
186
  }
195
- }, [firstSelection, (_d = context.rangeDialog) === null || _d === void 0 ? void 0 : _d.show, context.luckysheetCellUpdate]);
187
+ }, [firstSelection, (_c = context.rangeDialog) === null || _c === void 0 ? void 0 : _c.show, context.luckysheetCellUpdate]);
196
188
  var getActiveFormula = (0, _react.useCallback)(function () {
197
189
  return document.querySelector(".luckysheet-formula-search-item-active");
198
190
  }, []);
@@ -287,54 +279,6 @@ var InputBox = function InputBox() {
287
279
  event.stopPropagation();
288
280
  event.preventDefault();
289
281
  };
290
- (0, _react.useEffect)(function () {
291
- var _a, _b;
292
- var selection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
293
- var editor = inputRef.current;
294
- if (!selection || !editor || !isInputBoxActive || ((_b = context.rangeDialog) === null || _b === void 0 ? void 0 : _b.show)) {
295
- return;
296
- }
297
- var rowSel = selection.row;
298
- var colSel = selection.column;
299
- if (!rowSel || !colSel || rowSel.length < 2 || colSel.length < 2) return;
300
- var rowStart = Math.min(rowSel[0], rowSel[1]);
301
- var rowEnd = Math.max(rowSel[0], rowSel[1]);
302
- var colStart = Math.min(colSel[0], colSel[1]);
303
- var colEnd = Math.max(colSel[0], colSel[1]);
304
- var startRef = "".concat((0, _fortuneCore.indexToColumnChar)(colStart)).concat(rowStart + 1);
305
- var endRef = "".concat((0, _fortuneCore.indexToColumnChar)(colEnd)).concat(rowEnd + 1);
306
- var refText = startRef === endRef ? startRef : "".concat(startRef, ":").concat(endRef);
307
- var editorText = editor.innerText || "";
308
- if (!editorText.startsWith("=")) return;
309
- var spans = editor.querySelectorAll("span");
310
- var lastSpan = spans[spans.length - 1];
311
- var lastSpanText = (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) || "";
312
- var isA1RangePattern = /^[a-zA-Z]+\d+:[a-zA-Z]+\d+$/.test(lastSpanText);
313
- var notFunctionInit = !editorText.includes("(");
314
- var refNotAllowed = lastSpanText.includes(")") || notFunctionInit && /^[a-zA-Z]+$/.test(lastSpanText) && !_lodash.default.includes(["="], lastSpanText);
315
- var shouldHandleRef = (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.classList.contains("fortune-formula-functionrange-cell")) || (0, _helper.isLetterNumberPattern)(lastSpanText) || isA1RangePattern || (lastSpanText === "(" || lastSpanText === "," || lastSpanText.includes(":") || lastSpanText === "=") && !lastSpanText.includes('"') && !refNotAllowed && !/^[a-zA-Z]+$/.test(lastSpanText);
316
- if (!shouldHandleRef) return;
317
- var refSpanHtml = "<span class=\"fortune-formula-functionrange-cell\" rangeindex=\"0\" dir=\"auto\" style=\"color:#c1232b;\">".concat(refText, "</span>");
318
- if (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.classList.contains("fortune-formula-functionrange-cell")) {
319
- if (lastSpan.textContent !== refText) lastSpan.textContent = refText;
320
- setTimeout(function () {
321
- return (0, _helper.moveCursorToEnd)(editor);
322
- }, 1);
323
- return;
324
- }
325
- if ((0, _helper.isLetterNumberPattern)(lastSpanText) || isA1RangePattern) {
326
- var htmlR = (0, _helper.removeLastSpan)(editor.innerHTML);
327
- editor.innerHTML = "".concat(htmlR).concat(refSpanHtml);
328
- setTimeout(function () {
329
- return (0, _helper.moveCursorToEnd)(editor);
330
- }, 1);
331
- return;
332
- }
333
- editor.innerHTML = "".concat(editor.innerHTML).concat(refSpanHtml);
334
- setTimeout(function () {
335
- return (0, _helper.moveCursorToEnd)(editor);
336
- }, 1);
337
- }, [context.luckysheet_select_save, (_e = context.rangeDialog) === null || _e === void 0 ? void 0 : _e.show, isInputBoxActive]);
338
282
  var onKeyDown = (0, _react.useCallback)(function (e) {
339
283
  var _a, _b;
340
284
  lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
@@ -367,18 +311,37 @@ var InputBox = function InputBox() {
367
311
  }, 5);
368
312
  }
369
313
  }
370
- var isArrowKey = e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight";
371
- if (isArrowKey && !((0, _helper.getCursorPosition)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) !== (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.innerText.length) && e.key === "ArrowRight")) {
372
- var editorText = ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.innerText) || "";
373
- var lastSpanText = getLastInputSpanText() || "";
374
- var isA1RangePattern = /^[a-zA-Z]+\d+:[a-zA-Z]+\d+$/.test(lastSpanText);
375
- var notFunctionInit = !editorText.includes("(");
376
- var refNotAllowed = lastSpanText.includes(")") || notFunctionInit && /^[a-zA-Z]+$/.test(lastSpanText) && !_lodash.default.includes(["="], lastSpanText);
377
- var shouldTreatAsRefNavigation = editorText.startsWith("=") && (Boolean((_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.querySelector(".fortune-formula-functionrange-cell")) || (0, _helper.isLetterNumberPattern)(lastSpanText) || isA1RangePattern || (lastSpanText === "(" || lastSpanText === "," || lastSpanText.includes(":") || lastSpanText === "=") && !lastSpanText.includes('"') && !refNotAllowed && !/^[a-zA-Z]+$/.test(lastSpanText));
378
- if (shouldTreatAsRefNavigation) {
314
+ var refCell = placeRef.current;
315
+ if (e.key === "ArrowUp") {
316
+ refCell = (0, _helper.decrementRow)(placeRef.current);
317
+ } else if (e.key === "ArrowDown") {
318
+ refCell = (0, _helper.incrementRow)(placeRef.current);
319
+ } else if (e.key === "ArrowLeft") {
320
+ refCell = (0, _helper.decrementColumn)(placeRef.current);
321
+ } else if (e.key === "ArrowRight") {
322
+ refCell = (0, _helper.incrementColumn)(placeRef.current);
323
+ }
324
+ if ((e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight") && !((0, _helper.getCursorPosition)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) !== (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.innerText.length) && e.key === "ArrowRight")) {
325
+ var parser = new DOMParser();
326
+ var doc = parser.parseFromString("<div>".concat((_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.innerHTML, "</div>"), "text/html");
327
+ var spans = doc.querySelectorAll("span");
328
+ var lastSpan = spans[spans.length - 1];
329
+ var notFunctionInit = !((_b = document.getElementById("luckysheet-rich-text-editor")) === null || _b === void 0 ? void 0 : _b.innerText.includes("("));
330
+ var arrowRefNotAllowed = (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")")) || notFunctionInit && /^[a-zA-Z]+$/.test(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) && !_lodash.default.includes(["="], lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText);
331
+ if (((lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) === "(" || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) === "," || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(":")) || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) !== ")") && !(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes('"')) && !(0, _helper.isLetterNumberPattern)(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) && !arrowRefNotAllowed && !/^[a-zA-Z]+$/.test(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
332
+ allowListNavigation = false;
333
+ inputRef.current.innerHTML = "".concat(inputRef.current.innerHTML, "<span class=\"fortune-formula-functionrange-cell\" rangeindex=\"0\" dir=\"auto\" style=\"color:#c1232b;\">").concat(refCell, "</span>");
334
+ setTimeout(function () {
335
+ (0, _helper.moveCursorToEnd)(inputRef.current);
336
+ }, 1);
337
+ }
338
+ if ((0, _helper.isLetterNumberPattern)(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
379
339
  allowListNavigation = false;
340
+ var htmlR = (0, _helper.removeLastSpan)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.innerHTML);
341
+ inputRef.current.innerHTML = "".concat(htmlR, "<span class=\"fortune-formula-functionrange-cell\" rangeindex=\"0\" dir=\"auto\" style=\"color:#c1232b;\">").concat(refCell, "</span>");
342
+ (0, _helper.moveCursorToEnd)(inputRef.current);
380
343
  setTimeout(function () {
381
- if (inputRef.current) (0, _helper.moveCursorToEnd)(inputRef.current);
344
+ (0, _helper.moveCursorToEnd)(inputRef.current);
382
345
  }, 1);
383
346
  }
384
347
  }
@@ -436,7 +399,7 @@ var InputBox = function InputBox() {
436
399
  }
437
400
  e.preventDefault();
438
401
  }
439
- }, [clearSearchItemActiveClass, context.luckysheetCellUpdate.length, selectActiveFormula, setContext]);
402
+ }, [clearSearchItemActiveClass, context.luckysheetCellUpdate.length, selectActiveFormula, setContext, firstSelection]);
440
403
  var handleHideShowHint = function handleHideShowHint() {
441
404
  var _a, _b, _c, _d;
442
405
  var searchElFx = (_a = document.getElementsByClassName("fx-search")) === null || _a === void 0 ? void 0 : _a[0];
@@ -526,7 +489,7 @@ var InputBox = function InputBox() {
526
489
  zIndex: _lodash.default.isEmpty(context.luckysheetCellUpdate) ? -1 : 19,
527
490
  display: "block"
528
491
  };
529
- }, [firstSelection, (_f = context.rangeDialog) === null || _f === void 0 ? void 0 : _f.show, context.luckysheetCellUpdate, refs.cellArea, isInputBoxActive, frozenPosition, context.scrollLeft, context.scrollTop]);
492
+ }, [firstSelection, (_d = context.rangeDialog) === null || _d === void 0 ? void 0 : _d.show, context.luckysheetCellUpdate, refs.cellArea, isInputBoxActive, frozenPosition, context.scrollLeft, context.scrollTop]);
530
493
  (0, _react.useEffect)(function () {
531
494
  var _a;
532
495
  if (firstSelection && !((_a = context.rangeDialog) === null || _a === void 0 ? void 0 : _a.show) && !isInputBoxActive && !_lodash.default.isEmpty(context.luckysheetCellUpdate)) {
@@ -542,7 +505,7 @@ var InputBox = function InputBox() {
542
505
  setIsInputBoxActive(true);
543
506
  }
544
507
  }
545
- }, [firstSelection, (_g = context.rangeDialog) === null || _g === void 0 ? void 0 : _g.show, context.luckysheetCellUpdate, isInputBoxActive, context.scrollLeft, context.scrollTop, refs.cellArea]);
508
+ }, [firstSelection, (_e = context.rangeDialog) === null || _e === void 0 ? void 0 : _e.show, context.luckysheetCellUpdate, isInputBoxActive, context.scrollLeft, context.scrollTop, refs.cellArea]);
546
509
  var getAddressIndicatorPosition = (0, _react.useCallback)(function () {
547
510
  var _a;
548
511
  if (!firstSelection || ((_a = context.rangeDialog) === null || _a === void 0 ? void 0 : _a.show)) {
@@ -555,7 +518,7 @@ var InputBox = function InputBox() {
555
518
  left: "0",
556
519
  display: "block"
557
520
  };
558
- }, [firstSelection, (_h = context.rangeDialog) === null || _h === void 0 ? void 0 : _h.show]);
521
+ }, [firstSelection, (_f = context.rangeDialog) === null || _f === void 0 ? void 0 : _f.show]);
559
522
  var getCellAddress = (0, _react.useCallback)(function () {
560
523
  if (!firstSelection) return "";
561
524
  var rowIndex = firstSelection.row_focus || 0;
@@ -605,7 +568,7 @@ var InputBox = function InputBox() {
605
568
  };
606
569
  });
607
570
  setLinkSelectionHighlightRects(relative);
608
- }, [(_j = context.linkCard) === null || _j === void 0 ? void 0 : _j.applyToSelection, (_k = context.linkCard) === null || _k === void 0 ? void 0 : _k.selectionOffsets, (_l = context.linkCard) === null || _l === void 0 ? void 0 : _l.r, (_m = context.linkCard) === null || _m === void 0 ? void 0 : _m.c, context.luckysheetCellUpdate]);
571
+ }, [(_g = context.linkCard) === null || _g === void 0 ? void 0 : _g.applyToSelection, (_h = context.linkCard) === null || _h === void 0 ? void 0 : _h.selectionOffsets, (_j = context.linkCard) === null || _j === void 0 ? void 0 : _j.r, (_k = context.linkCard) === null || _k === void 0 ? void 0 : _k.c, context.luckysheetCellUpdate]);
609
572
  var wraperGetCell = function wraperGetCell() {
610
573
  var cell = getCellAddress();
611
574
  placeRef.current = cell;
@@ -642,7 +605,7 @@ var InputBox = function InputBox() {
642
605
  onMouseUp: function onMouseUp(e) {
643
606
  return e.stopPropagation();
644
607
  }
645
- }, firstSelection && !((_o = context.rangeDialog) === null || _o === void 0 ? void 0 : _o.show) && (/*#__PURE__*/_react.default.createElement("div", {
608
+ }, firstSelection && !((_l = context.rangeDialog) === null || _l === void 0 ? void 0 : _l.show) && (/*#__PURE__*/_react.default.createElement("div", {
646
609
  className: "luckysheet-cell-address-indicator",
647
610
  style: getAddressIndicatorPosition()
648
611
  }, wraperGetCell())), /*#__PURE__*/_react.default.createElement("div", {
@@ -830,12 +830,6 @@
830
830
  cursor: se-resize;
831
831
  }
832
832
 
833
- /* FLV: show blue dashed border for active selection while in edit mode */
834
- .luckysheet-cell-selected-edit-mode .luckysheet-cs-inner-border {
835
- border: 2px dashed #12a5ff;
836
- border-radius: 1px;
837
- }
838
-
839
833
  .fortune-formula-functionrange-highlight .luckysheet-highlight {
840
834
  position: absolute;
841
835
  z-index: 19;
@@ -384,18 +384,18 @@ var SheetOverlay = function SheetOverlay() {
384
384
  }), ((_h = (_g = context.luckysheet_select_save) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0) > 0 && (/*#__PURE__*/_react.default.createElement("div", {
385
385
  id: "luckysheet-cell-selected-boxs"
386
386
  }, context.luckysheet_select_save.map(function (selection, index) {
387
- var _a, _b, _c, _d;
387
+ var _a, _b;
388
388
  return /*#__PURE__*/_react.default.createElement("div", {
389
389
  key: index,
390
390
  id: "luckysheet-cell-selected",
391
- className: "luckysheet-cell-selected".concat(((_b = (_a = context.luckysheetCellUpdate) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0 ? " luckysheet-cell-selected-edit-mode" : ""),
391
+ className: "luckysheet-cell-selected",
392
392
  style: _lodash.default.assign({
393
393
  left: selection.left_move,
394
394
  top: selection.top_move,
395
395
  width: selection.width_move ? selection.width_move - 1.8 : selection.width_move,
396
396
  height: selection.height_move ? selection.height_move - 1.8 : selection.height_move,
397
397
  display: "block"
398
- }, (0, _fortuneCore.fixRowStyleOverflowInFreeze)(context, selection.row[0], selection.row[1], (_c = refs.globalCache.freezen) === null || _c === void 0 ? void 0 : _c[context.currentSheetId]), (0, _fortuneCore.fixColumnStyleOverflowInFreeze)(context, selection.column[0], selection.column[1], (_d = refs.globalCache.freezen) === null || _d === void 0 ? void 0 : _d[context.currentSheetId])),
398
+ }, (0, _fortuneCore.fixRowStyleOverflowInFreeze)(context, selection.row[0], selection.row[1], (_a = refs.globalCache.freezen) === null || _a === void 0 ? void 0 : _a[context.currentSheetId]), (0, _fortuneCore.fixColumnStyleOverflowInFreeze)(context, selection.column[0], selection.column[1], (_b = refs.globalCache.freezen) === null || _b === void 0 ? void 0 : _b[context.currentSheetId])),
399
399
  onMouseDown: function onMouseDown(e) {
400
400
  e.stopPropagation();
401
401
  var nativeEvent = e.nativeEvent;
@@ -728,8 +728,6 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
728
728
  conditionformat_equal_title: string;
729
729
  conditionformat_textContains: string;
730
730
  conditionformat_textContains_title: string;
731
- conditionformat_empty: string;
732
- conditionformat_empty_title: string;
733
731
  conditionformat_occurrenceDate: string;
734
732
  conditionformat_occurrenceDate_title: string;
735
733
  conditionformat_duplicateValue: string;
@@ -832,7 +830,6 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
832
830
  between2: string;
833
831
  contain: string;
834
832
  textContains: string;
835
- empty: string;
836
833
  duplicateValue: string;
837
834
  uniqueValue: string;
838
835
  top: string;
@@ -735,8 +735,6 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
735
735
  conditionformat_equal_title: string;
736
736
  conditionformat_textContains: string;
737
737
  conditionformat_textContains_title: string;
738
- conditionformat_empty: string;
739
- conditionformat_empty_title: string;
740
738
  conditionformat_occurrenceDate: string;
741
739
  conditionformat_occurrenceDate_title: string;
742
740
  conditionformat_duplicateValue: string;
@@ -839,7 +837,6 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
839
837
  between2: string;
840
838
  contain: string;
841
839
  textContains: string;
842
- empty: string;
843
840
  duplicateValue: string;
844
841
  uniqueValue: string;
845
842
  top: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.3.11-mixed",
3
+ "version": "1.3.12-copyPaste-4",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "module": "es/index.js",
@@ -16,7 +16,7 @@
16
16
  "tsc": "tsc"
17
17
  },
18
18
  "dependencies": {
19
- "@fileverse-dev/fortune-core": "1.3.11-mixed",
19
+ "@fileverse-dev/fortune-core": "1.3.12-copyPaste-4",
20
20
  "@fileverse/ui": "5.0.0",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",