@fileverse-dev/fortune-react 1.3.11-input-ref-2 → 1.3.11-input-ref-3

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.
@@ -244,7 +244,7 @@ var FxEditor = function FxEditor() {
244
244
  }
245
245
  }, [getActiveFormula, insertSelectedFormula]);
246
246
  var onKeyDown = useCallback(function (e) {
247
- var _a, _b, _c;
247
+ var _a, _b, _c, _d;
248
248
  if (e.key === "Delete" || e.key === "Backspace") {
249
249
  var anchor = formulaAnchorCellRef.current;
250
250
  if (anchor != null) {
@@ -292,9 +292,9 @@ var FxEditor = function FxEditor() {
292
292
  setContext(function (draftCtx) {
293
293
  draftCtx.formulaCache.rangeSelectionActive = null;
294
294
  });
295
- var _d = formulaAnchorCellRef.current,
296
- anchorRow_2 = _d[0],
297
- anchorCol_2 = _d[1];
295
+ var _e = formulaAnchorCellRef.current,
296
+ anchorRow_2 = _e[0],
297
+ anchorCol_2 = _e[1];
298
298
  setTimeout(function () {
299
299
  setContext(function (draftCtx) {
300
300
  var _a, _b;
@@ -317,7 +317,10 @@ var FxEditor = function FxEditor() {
317
317
  });
318
318
  }, 0);
319
319
  }
320
- if (key === "ArrowLeft" || key === "ArrowRight") {
320
+ var isArrowKey = key === "ArrowUp" || key === "ArrowDown" || key === "ArrowLeft" || key === "ArrowRight";
321
+ var isDirectPlainTypeEdit = context.luckysheetCellUpdate.length > 0 && ((_d = refs.globalCache) === null || _d === void 0 ? void 0 : _d.enteredEditByTyping) === true && !currentInputText.startsWith("=");
322
+ var sheetArrowShortcut = isArrowKey && (e.metaKey || e.ctrlKey || e.shiftKey);
323
+ if ((key === "ArrowLeft" || key === "ArrowRight") && !(isDirectPlainTypeEdit && sheetArrowShortcut)) {
321
324
  e.stopPropagation();
322
325
  }
323
326
  if ((e.metaKey || e.ctrlKey) && context.luckysheetCellUpdate.length > 0) {
@@ -400,7 +400,7 @@ var InputBox = function InputBox() {
400
400
  });
401
401
  }, [formulaMouseDragSignature, context.formulaCache.func_selectedrange, refs.cellInput, setContext]);
402
402
  var onKeyDown = useCallback(function (e) {
403
- var _a, _b;
403
+ var _a, _b, _c;
404
404
  setContext(function (draftCtx) {
405
405
  setFormulaEditorOwner(draftCtx, "cell");
406
406
  });
@@ -422,9 +422,9 @@ var InputBox = function InputBox() {
422
422
  setContext(function (draftCtx) {
423
423
  draftCtx.formulaCache.rangeSelectionActive = null;
424
424
  });
425
- var _c = formulaAnchorCellRef.current,
426
- anchorRow_1 = _c[0],
427
- anchorCol_1 = _c[1];
425
+ var _d = formulaAnchorCellRef.current,
426
+ anchorRow_1 = _d[0],
427
+ anchorCol_1 = _d[1];
428
428
  skipNextAnchorSelectionSyncRef.current = true;
429
429
  setTimeout(function () {
430
430
  setContext(function (draftCtx) {
@@ -480,6 +480,7 @@ var InputBox = function InputBox() {
480
480
  }
481
481
  var allowListNavigation = true;
482
482
  var isArrowKey = e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight";
483
+ var isInPlaceEditMode = ((_c = refs.globalCache) === null || _c === void 0 ? void 0 : _c.enteredEditByTyping) !== true;
483
484
  if (e.key === "Delete" || e.key === "Backspace") {
484
485
  var anchor = formulaAnchorCellRef.current;
485
486
  if (anchor != null) {
@@ -531,7 +532,7 @@ var InputBox = function InputBox() {
531
532
  e.preventDefault();
532
533
  } else if (e.key === "F4" && context.luckysheetCellUpdate.length > 0) {
533
534
  e.preventDefault();
534
- } else if (!(e.metaKey || e.ctrlKey) && e.key === "ArrowUp" && context.luckysheetCellUpdate.length > 0 && allowListNavigation) {
535
+ } else if (!(e.metaKey || e.ctrlKey) && e.key === "ArrowUp" && context.luckysheetCellUpdate.length > 0 && allowListNavigation && !(e.shiftKey && isInPlaceEditMode)) {
535
536
  if (document.getElementById("luckysheet-formula-search-c")) {
536
537
  var formulaSearchContainer = document.getElementById("luckysheet-formula-search-c");
537
538
  var activeItem = formulaSearchContainer === null || formulaSearchContainer === void 0 ? void 0 : formulaSearchContainer.querySelector(".luckysheet-formula-search-item-active");
@@ -550,7 +551,7 @@ var InputBox = function InputBox() {
550
551
  }
551
552
  }
552
553
  e.preventDefault();
553
- } else if (!(e.metaKey || e.ctrlKey) && e.key === "ArrowDown" && context.luckysheetCellUpdate.length > 0 && allowListNavigation) {
554
+ } else if (!(e.metaKey || e.ctrlKey) && e.key === "ArrowDown" && context.luckysheetCellUpdate.length > 0 && allowListNavigation && !(e.shiftKey && isInPlaceEditMode)) {
554
555
  if (document.getElementById("luckysheet-formula-search-c")) {
555
556
  var formulaSearchContainer = document.getElementById("luckysheet-formula-search-c");
556
557
  var activeItem = formulaSearchContainer === null || formulaSearchContainer === void 0 ? void 0 : formulaSearchContainer.querySelector(".luckysheet-formula-search-item-active");
@@ -801,44 +801,11 @@
801
801
  }
802
802
 
803
803
  .fortune-formula-functionrange-highlight .fortune-selection-copy-hc {
804
- border: 2px solid #5e5e5e;
805
- opacity: 0.03;
804
+ border-width: 2px;
805
+ border-style: dotted;
806
806
  z-index: initial;
807
807
  }
808
808
 
809
- .fortune-selection-highlight-lt {
810
- left: -3px;
811
- top: -3px;
812
- cursor: se-resize;
813
- }
814
-
815
- .fortune-selection-highlight-rt {
816
- right: -3px;
817
- top: -3px;
818
- cursor: ne-resize;
819
- }
820
-
821
- .fortune-selection-highlight-lb {
822
- left: -3px;
823
- bottom: -3px;
824
- cursor: ne-resize;
825
- }
826
-
827
- .fortune-selection-highlight-rb {
828
- right: -3px;
829
- bottom: -3px;
830
- cursor: se-resize;
831
- }
832
-
833
- .fortune-formula-functionrange-highlight .luckysheet-highlight {
834
- position: absolute;
835
- z-index: 19;
836
- border: 1px solid #fff;
837
- background: #0188fb;
838
- width: 6px;
839
- height: 6px;
840
- }
841
-
842
809
  .fortune-presence-username {
843
810
  position: absolute;
844
811
  padding-left: 6px;
@@ -28,6 +28,22 @@ import { useDialog } from "../../hooks/useDialog";
28
28
  import DropDownList from "../DataVerification/DropdownList";
29
29
  import IframeBoxs from "../IFrameBoxs/iFrameBoxs";
30
30
  import ErrorBoxes from "../ErrorState";
31
+ function formulaRangeHighlightHcStyle(hex) {
32
+ var h = hex.replace("#", "");
33
+ if (h.length !== 6) {
34
+ return {
35
+ backgroundColor: hex,
36
+ borderColor: hex
37
+ };
38
+ }
39
+ var r = parseInt(h.slice(0, 2), 16);
40
+ var g = parseInt(h.slice(2, 4), 16);
41
+ var b = parseInt(h.slice(4, 6), 16);
42
+ return {
43
+ backgroundColor: "rgba(".concat(r, ",").concat(g, ",").concat(b, ",0.08)"),
44
+ borderColor: hex
45
+ };
46
+ }
31
47
  var SheetOverlay = function SheetOverlay() {
32
48
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
33
49
  var _o = useContext(WorkbookContext),
@@ -297,18 +313,7 @@ var SheetOverlay = function SheetOverlay() {
297
313
  });
298
314
  }), /*#__PURE__*/React.createElement("div", {
299
315
  className: "fortune-selection-copy-hc",
300
- style: {
301
- backgroundColor: backgroundColor
302
- }
303
- }), ["lt", "rt", "lb", "rb"].map(function (d) {
304
- return /*#__PURE__*/React.createElement("div", {
305
- key: d,
306
- "data-type": d,
307
- className: "fortune-selection-highlight-".concat(d, " luckysheet-highlight"),
308
- style: {
309
- backgroundColor: backgroundColor
310
- }
311
- });
316
+ style: formulaRangeHighlightHcStyle(backgroundColor)
312
317
  }));
313
318
  }), /*#__PURE__*/React.createElement("div", {
314
319
  className: "luckysheet-row-count-show luckysheet-count-show",
@@ -253,7 +253,7 @@ var FxEditor = function FxEditor() {
253
253
  }
254
254
  }, [getActiveFormula, insertSelectedFormula]);
255
255
  var onKeyDown = (0, _react.useCallback)(function (e) {
256
- var _a, _b, _c;
256
+ var _a, _b, _c, _d;
257
257
  if (e.key === "Delete" || e.key === "Backspace") {
258
258
  var anchor = formulaAnchorCellRef.current;
259
259
  if (anchor != null) {
@@ -301,9 +301,9 @@ var FxEditor = function FxEditor() {
301
301
  setContext(function (draftCtx) {
302
302
  draftCtx.formulaCache.rangeSelectionActive = null;
303
303
  });
304
- var _d = formulaAnchorCellRef.current,
305
- anchorRow_2 = _d[0],
306
- anchorCol_2 = _d[1];
304
+ var _e = formulaAnchorCellRef.current,
305
+ anchorRow_2 = _e[0],
306
+ anchorCol_2 = _e[1];
307
307
  setTimeout(function () {
308
308
  setContext(function (draftCtx) {
309
309
  var _a, _b;
@@ -326,7 +326,10 @@ var FxEditor = function FxEditor() {
326
326
  });
327
327
  }, 0);
328
328
  }
329
- if (key === "ArrowLeft" || key === "ArrowRight") {
329
+ var isArrowKey = key === "ArrowUp" || key === "ArrowDown" || key === "ArrowLeft" || key === "ArrowRight";
330
+ var isDirectPlainTypeEdit = context.luckysheetCellUpdate.length > 0 && ((_d = refs.globalCache) === null || _d === void 0 ? void 0 : _d.enteredEditByTyping) === true && !currentInputText.startsWith("=");
331
+ var sheetArrowShortcut = isArrowKey && (e.metaKey || e.ctrlKey || e.shiftKey);
332
+ if ((key === "ArrowLeft" || key === "ArrowRight") && !(isDirectPlainTypeEdit && sheetArrowShortcut)) {
330
333
  e.stopPropagation();
331
334
  }
332
335
  if ((e.metaKey || e.ctrlKey) && context.luckysheetCellUpdate.length > 0) {
@@ -409,7 +409,7 @@ var InputBox = function InputBox() {
409
409
  });
410
410
  }, [formulaMouseDragSignature, context.formulaCache.func_selectedrange, refs.cellInput, setContext]);
411
411
  var onKeyDown = (0, _react.useCallback)(function (e) {
412
- var _a, _b;
412
+ var _a, _b, _c;
413
413
  setContext(function (draftCtx) {
414
414
  (0, _fortuneCore.setFormulaEditorOwner)(draftCtx, "cell");
415
415
  });
@@ -431,9 +431,9 @@ var InputBox = function InputBox() {
431
431
  setContext(function (draftCtx) {
432
432
  draftCtx.formulaCache.rangeSelectionActive = null;
433
433
  });
434
- var _c = formulaAnchorCellRef.current,
435
- anchorRow_1 = _c[0],
436
- anchorCol_1 = _c[1];
434
+ var _d = formulaAnchorCellRef.current,
435
+ anchorRow_1 = _d[0],
436
+ anchorCol_1 = _d[1];
437
437
  skipNextAnchorSelectionSyncRef.current = true;
438
438
  setTimeout(function () {
439
439
  setContext(function (draftCtx) {
@@ -489,6 +489,7 @@ var InputBox = function InputBox() {
489
489
  }
490
490
  var allowListNavigation = true;
491
491
  var isArrowKey = e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight";
492
+ var isInPlaceEditMode = ((_c = refs.globalCache) === null || _c === void 0 ? void 0 : _c.enteredEditByTyping) !== true;
492
493
  if (e.key === "Delete" || e.key === "Backspace") {
493
494
  var anchor = formulaAnchorCellRef.current;
494
495
  if (anchor != null) {
@@ -540,7 +541,7 @@ var InputBox = function InputBox() {
540
541
  e.preventDefault();
541
542
  } else if (e.key === "F4" && context.luckysheetCellUpdate.length > 0) {
542
543
  e.preventDefault();
543
- } else if (!(e.metaKey || e.ctrlKey) && e.key === "ArrowUp" && context.luckysheetCellUpdate.length > 0 && allowListNavigation) {
544
+ } else if (!(e.metaKey || e.ctrlKey) && e.key === "ArrowUp" && context.luckysheetCellUpdate.length > 0 && allowListNavigation && !(e.shiftKey && isInPlaceEditMode)) {
544
545
  if (document.getElementById("luckysheet-formula-search-c")) {
545
546
  var formulaSearchContainer = document.getElementById("luckysheet-formula-search-c");
546
547
  var activeItem = formulaSearchContainer === null || formulaSearchContainer === void 0 ? void 0 : formulaSearchContainer.querySelector(".luckysheet-formula-search-item-active");
@@ -559,7 +560,7 @@ var InputBox = function InputBox() {
559
560
  }
560
561
  }
561
562
  e.preventDefault();
562
- } else if (!(e.metaKey || e.ctrlKey) && e.key === "ArrowDown" && context.luckysheetCellUpdate.length > 0 && allowListNavigation) {
563
+ } else if (!(e.metaKey || e.ctrlKey) && e.key === "ArrowDown" && context.luckysheetCellUpdate.length > 0 && allowListNavigation && !(e.shiftKey && isInPlaceEditMode)) {
563
564
  if (document.getElementById("luckysheet-formula-search-c")) {
564
565
  var formulaSearchContainer = document.getElementById("luckysheet-formula-search-c");
565
566
  var activeItem = formulaSearchContainer === null || formulaSearchContainer === void 0 ? void 0 : formulaSearchContainer.querySelector(".luckysheet-formula-search-item-active");
@@ -801,44 +801,11 @@
801
801
  }
802
802
 
803
803
  .fortune-formula-functionrange-highlight .fortune-selection-copy-hc {
804
- border: 2px solid #5e5e5e;
805
- opacity: 0.03;
804
+ border-width: 2px;
805
+ border-style: dotted;
806
806
  z-index: initial;
807
807
  }
808
808
 
809
- .fortune-selection-highlight-lt {
810
- left: -3px;
811
- top: -3px;
812
- cursor: se-resize;
813
- }
814
-
815
- .fortune-selection-highlight-rt {
816
- right: -3px;
817
- top: -3px;
818
- cursor: ne-resize;
819
- }
820
-
821
- .fortune-selection-highlight-lb {
822
- left: -3px;
823
- bottom: -3px;
824
- cursor: ne-resize;
825
- }
826
-
827
- .fortune-selection-highlight-rb {
828
- right: -3px;
829
- bottom: -3px;
830
- cursor: se-resize;
831
- }
832
-
833
- .fortune-formula-functionrange-highlight .luckysheet-highlight {
834
- position: absolute;
835
- z-index: 19;
836
- border: 1px solid #fff;
837
- background: #0188fb;
838
- width: 6px;
839
- height: 6px;
840
- }
841
-
842
809
  .fortune-presence-username {
843
810
  position: absolute;
844
811
  padding-left: 6px;
@@ -37,6 +37,22 @@ var __assign = void 0 && (void 0).__assign || function () {
37
37
  };
38
38
  return __assign.apply(this, arguments);
39
39
  };
40
+ function formulaRangeHighlightHcStyle(hex) {
41
+ var h = hex.replace("#", "");
42
+ if (h.length !== 6) {
43
+ return {
44
+ backgroundColor: hex,
45
+ borderColor: hex
46
+ };
47
+ }
48
+ var r = parseInt(h.slice(0, 2), 16);
49
+ var g = parseInt(h.slice(2, 4), 16);
50
+ var b = parseInt(h.slice(4, 6), 16);
51
+ return {
52
+ backgroundColor: "rgba(".concat(r, ",").concat(g, ",").concat(b, ",0.08)"),
53
+ borderColor: hex
54
+ };
55
+ }
40
56
  var SheetOverlay = function SheetOverlay() {
41
57
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
42
58
  var _o = (0, _react.useContext)(_context.default),
@@ -306,18 +322,7 @@ var SheetOverlay = function SheetOverlay() {
306
322
  });
307
323
  }), /*#__PURE__*/_react.default.createElement("div", {
308
324
  className: "fortune-selection-copy-hc",
309
- style: {
310
- backgroundColor: backgroundColor
311
- }
312
- }), ["lt", "rt", "lb", "rb"].map(function (d) {
313
- return /*#__PURE__*/_react.default.createElement("div", {
314
- key: d,
315
- "data-type": d,
316
- className: "fortune-selection-highlight-".concat(d, " luckysheet-highlight"),
317
- style: {
318
- backgroundColor: backgroundColor
319
- }
320
- });
325
+ style: formulaRangeHighlightHcStyle(backgroundColor)
321
326
  }));
322
327
  }), /*#__PURE__*/_react.default.createElement("div", {
323
328
  className: "luckysheet-row-count-show luckysheet-count-show",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.3.11-input-ref-2",
3
+ "version": "1.3.11-input-ref-3",
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-input-ref-2",
19
+ "@fileverse-dev/fortune-core": "1.3.11-input-ref-3",
20
20
  "@fileverse/ui": "5.0.0",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",