@fileverse-dev/fortune-react 1.2.81-yield → 1.2.81

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.
@@ -342,9 +342,11 @@ var ConditionRules = function ConditionRules(_a) {
342
342
  var _a;
343
343
  setEditConditionFormatKey(key);
344
344
  setContext(function (ctx) {
345
- var _a, _b;
345
+ var _a, _b, _c, _d;
346
346
  var index = getSheetIndex(ctx, ctx.currentSheetId);
347
- if (((_b = (_a = ctx.luckysheetfile[index]) === null || _a === void 0 ? void 0 : _a.conditionRules) === null || _b === void 0 ? void 0 : _b.editKey) === undefined) {
347
+ console.log("why set editkey", (_b = (_a = ctx.luckysheetfile[index]) === null || _a === void 0 ? void 0 : _a.conditionRules) === null || _b === void 0 ? void 0 : _b.editKey);
348
+ if (((_d = (_c = ctx.luckysheetfile[index]) === null || _c === void 0 ? void 0 : _c.conditionRules) === null || _d === void 0 ? void 0 : _d.editKey) === undefined) {
349
+ console.log("set editkey");
348
350
  ctx.luckysheetfile[index].conditionRules.editKey = key;
349
351
  }
350
352
  });
@@ -22,7 +22,7 @@ var ErrorBoxes = function ErrorBoxes() {
22
22
  zIndex: 100,
23
23
  borderRadius: "4px"
24
24
  },
25
- className: "shadow-lg flex flex-col gap-2 break-all"
25
+ className: "shadow-lg flex flex-col gap-2"
26
26
  }, /*#__PURE__*/React.createElement("h3", {
27
27
  className: "text-heading-xsm color-text-danger"
28
28
  }, title), /*#__PURE__*/React.createElement("div", {
@@ -11,26 +11,26 @@ import usePrevious from "../../hooks/usePrevious";
11
11
  import { LucideIcon } from "../../components/SheetOverlay/LucideIcon";
12
12
  import { countCommasBeforeCursor, isLetterNumberPattern, moveCursorToEnd } from "../../components/SheetOverlay/helper";
13
13
  var FxEditor = function FxEditor() {
14
- var _a;
14
+ var _a, _b, _c;
15
15
  var hideFormulaHintLocal = localStorage.getItem("formulaMore") === "true";
16
- var _b = useState(false),
17
- showSearchHint = _b[0],
18
- setShowSearchHint = _b[1];
19
- var _c = useState(!hideFormulaHintLocal),
20
- showFormulaHint = _c[0],
21
- setShowFormulaHint = _c[1];
22
- var _d = useState(0),
23
- commaCount = _d[0],
24
- setCommaCount = _d[1];
25
- var _e = useContext(WorkbookContext),
26
- context = _e.context,
27
- setContext = _e.setContext,
28
- refs = _e.refs;
16
+ var _d = useState(false),
17
+ showSearchHint = _d[0],
18
+ setShowSearchHint = _d[1];
19
+ var _e = useState(!hideFormulaHintLocal),
20
+ showFormulaHint = _e[0],
21
+ setShowFormulaHint = _e[1];
22
+ var _f = useState(0),
23
+ commaCount = _f[0],
24
+ setCommaCount = _f[1];
25
+ var _g = useContext(WorkbookContext),
26
+ context = _g.context,
27
+ setContext = _g.setContext,
28
+ refs = _g.refs;
29
29
  var lastKeyDownEventRef = useRef(null);
30
30
  var inputContainerRef = useRef(null);
31
- var _f = useState(false),
32
- isHidenRC = _f[0],
33
- setIsHidenRC = _f[1];
31
+ var _h = useState(false),
32
+ isHidenRC = _h[0],
33
+ setIsHidenRC = _h[1];
34
34
  var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
35
35
  var prevFirstSelection = usePrevious(firstSelection);
36
36
  var prevSheetId = usePrevious(context.currentSheetId);
@@ -267,24 +267,6 @@ var FxEditor = function FxEditor() {
267
267
  });
268
268
  }
269
269
  }, [refs.cellInput, refs.fxInput, setContext]);
270
- var getFunctionNameFromInput = useCallback(function () {
271
- var _a, _b, _c, _d;
272
- var inputText = ((_b = (_a = refs.fxInput) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.innerText) || "";
273
- if (!inputText.startsWith("=")) return null;
274
- var functionMatch = inputText.match(/^=([A-Za-z_][A-Za-z0-9_]*)\s*\(/);
275
- if (functionMatch) {
276
- return functionMatch[1].toUpperCase();
277
- }
278
- if ((_c = refs.fxInput) === null || _c === void 0 ? void 0 : _c.current) {
279
- var funcSpan = refs.fxInput.current.querySelector(".luckysheet-formula-text-func");
280
- if (funcSpan) {
281
- return ((_d = funcSpan.textContent) === null || _d === void 0 ? void 0 : _d.toUpperCase()) || null;
282
- }
283
- }
284
- return null;
285
- }, []);
286
- var functionName = context.functionHint || getFunctionNameFromInput();
287
- var fn = functionName ? context.formulaCache.functionlistMap[functionName] : null;
288
270
  var allowEdit = useMemo(function () {
289
271
  if (context.allowEdit === false) {
290
272
  return false;
@@ -298,9 +280,9 @@ var FxEditor = function FxEditor() {
298
280
  return true;
299
281
  }, [context.config, context.luckysheet_select_save, context.luckysheetfile, context.currentSheetId, isHidenRC]);
300
282
  var divRef = useRef(null);
301
- var _g = useState(false),
302
- isResizing = _g[0],
303
- setIsResizing = _g[1];
283
+ var _j = useState(false),
284
+ isResizing = _j[0],
285
+ setIsResizing = _j[1];
304
286
  var startResize = function startResize(e) {
305
287
  e.preventDefault();
306
288
  setIsResizing(true);
@@ -376,12 +358,11 @@ var FxEditor = function FxEditor() {
376
358
  }
377
359
  })), /*#__PURE__*/React.createElement("div", {
378
360
  className: "fx-hint"
379
- }, showFormulaHint && fn && (/*#__PURE__*/React.createElement(FormulaHint, {
361
+ }, context.functionHint && ((_c = (_b = refs.fxInput) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.innerText.includes("(")) && (/*#__PURE__*/React.createElement(FormulaHint, {
380
362
  handleShowFormulaHint: handleShowFormulaHint,
381
363
  showFormulaHint: showFormulaHint,
382
- commaCount: commaCount,
383
- functionName: functionName
384
- })), !showFormulaHint && fn && (/*#__PURE__*/React.createElement("div", {
364
+ commaCount: commaCount
365
+ })), context.functionHint && !showFormulaHint && (/*#__PURE__*/React.createElement("div", {
385
366
  className: "luckysheet-hin absolute show-more-btn",
386
367
  onClick: function onClick() {
387
368
  handleShowFormulaHint();
@@ -18,13 +18,12 @@ var FormulaHint = function FormulaHint(props) {
18
18
  var _a;
19
19
  var showFormulaHint = props.showFormulaHint,
20
20
  handleShowFormulaHint = props.handleShowFormulaHint,
21
- commaCount = props.commaCount,
22
- functionName = props.functionName;
21
+ commaCount = props.commaCount;
23
22
  var dragHasMoved = useRef(false);
24
23
  var context = useContext(WorkbookContext).context;
25
24
  var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
26
25
  var formulaMore = locale(context).formulaMore;
27
- var fn = functionName ? context.formulaCache.functionlistMap[functionName] : context.formulaCache.functionlistMap[(context === null || context === void 0 ? void 0 : context.functionHint) || ""];
26
+ var fn = context.formulaCache.functionlistMap[context.functionHint];
28
27
  var _b = useState(localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY)),
29
28
  API_KEY = _b[0],
30
29
  setAPI_KEY = _b[1];
@@ -20,47 +20,47 @@ import usePrevious from "../../hooks/usePrevious";
20
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;
24
- var _h = useContext(WorkbookContext),
25
- context = _h.context,
26
- setContext = _h.setContext,
27
- refs = _h.refs;
23
+ var _a, _b, _c, _d, _e, _f, _g, _h;
24
+ var _j = useContext(WorkbookContext),
25
+ context = _j.context,
26
+ setContext = _j.setContext,
27
+ refs = _j.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 _j = useState(false),
33
- isHidenRC = _j[0],
34
- setIsHidenRC = _j[1];
35
32
  var _k = useState(false),
36
- isInputBoxActive = _k[0],
37
- setIsInputBoxActive = _k[1];
38
- var _l = useState(""),
39
- activeCell = _l[0],
40
- setActiveCell = _l[1];
33
+ isHidenRC = _k[0],
34
+ setIsHidenRC = _k[1];
35
+ var _l = useState(false),
36
+ isInputBoxActive = _l[0],
37
+ setIsInputBoxActive = _l[1];
41
38
  var _m = useState(""),
42
- activeRefCell = _m[0],
43
- setActiveRefCell = _m[1];
44
- var _o = useState({
39
+ activeCell = _m[0],
40
+ setActiveCell = _m[1];
41
+ var _o = useState(""),
42
+ activeRefCell = _o[0],
43
+ setActiveRefCell = _o[1];
44
+ var _p = useState({
45
45
  left: 0,
46
46
  top: 0
47
47
  }),
48
- frozenPosition = _o[0],
49
- setFrozenPosition = _o[1];
48
+ frozenPosition = _p[0],
49
+ setFrozenPosition = _p[1];
50
50
  var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
51
- var _p = useState({}),
52
- firstSelectionActiveCell = _p[0],
53
- setFirstSelectionActiveCell = _p[1];
54
- var _q = useState(0),
55
- commaCount = _q[0],
56
- setCommaCount = _q[1];
51
+ var _q = useState({}),
52
+ firstSelectionActiveCell = _q[0],
53
+ setFirstSelectionActiveCell = _q[1];
54
+ var _r = useState(0),
55
+ commaCount = _r[0],
56
+ setCommaCount = _r[1];
57
57
  var hideFormulaHintLocal = localStorage.getItem("formulaMore") === "true";
58
- var _r = useState(!hideFormulaHintLocal),
59
- showFormulaHint = _r[0],
60
- setShowFormulaHint = _r[1];
61
- var _s = useState(false),
62
- showSearchHint = _s[0],
63
- setShowSearchHint = _s[1];
58
+ var _s = useState(!hideFormulaHintLocal),
59
+ showFormulaHint = _s[0],
60
+ setShowFormulaHint = _s[1];
61
+ var _t = useState(false),
62
+ showSearchHint = _t[0],
63
+ setShowSearchHint = _t[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("");
@@ -517,24 +517,7 @@ var InputBox = function InputBox() {
517
517
  }
518
518
  return activeCell || cell;
519
519
  };
520
- var getFunctionNameFromInput = useCallback(function () {
521
- var _a, _b;
522
- var inputText = ((_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.innerText) || "";
523
- if (!inputText.startsWith("=")) return null;
524
- var functionMatch = inputText.match(/^=([A-Za-z_][A-Za-z0-9_]*)\s*\(/);
525
- if (functionMatch) {
526
- return functionMatch[1].toUpperCase();
527
- }
528
- if (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) {
529
- var funcSpan = inputRef.current.querySelector(".luckysheet-formula-text-func");
530
- if (funcSpan) {
531
- return ((_b = funcSpan.textContent) === null || _b === void 0 ? void 0 : _b.toUpperCase()) || null;
532
- }
533
- }
534
- return null;
535
- }, []);
536
- var functionName = context.functionHint || getFunctionNameFromInput();
537
- var fn = functionName ? context.formulaCache.functionlistMap[functionName] : null;
520
+ var fn = context.formulaCache.functionlistMap[context.functionHint];
538
521
  return /*#__PURE__*/React.createElement("div", {
539
522
  className: "luckysheet-input-box",
540
523
  id: "luckysheet-input-box",
@@ -578,7 +561,7 @@ var InputBox = function InputBox() {
578
561
  onKeyDown: onKeyDown,
579
562
  onPaste: onPaste,
580
563
  allowEdit: edit ? !isHidenRC : edit
581
- })), (context.functionCandidates.length > 0 || context.functionHint || context.defaultCandidates.length > 0 || fn) && (/*#__PURE__*/React.createElement(React.Fragment, null, showSearchHint && (/*#__PURE__*/React.createElement(FormulaSearch, {
564
+ })), (context.functionCandidates.length > 0 || context.functionHint || context.defaultCandidates.length > 0) && (/*#__PURE__*/React.createElement(React.Fragment, null, showSearchHint && (/*#__PURE__*/React.createElement(FormulaSearch, {
582
565
  onMouseMove: function onMouseMove(e) {
583
566
  if (document.getElementById("luckysheet-formula-search-c")) {
584
567
  var hoveredItem = e.target.closest(".luckysheet-formula-search-item");
@@ -593,11 +576,10 @@ var InputBox = function InputBox() {
593
576
  }
594
577
  })), /*#__PURE__*/React.createElement("div", {
595
578
  className: "cell-hint"
596
- }, showFormulaHint && fn && (/*#__PURE__*/React.createElement(FormulaHint, {
579
+ }, showFormulaHint && fn && ((_h = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _h === void 0 ? void 0 : _h.innerText.includes("(")) && (/*#__PURE__*/React.createElement(FormulaHint, {
597
580
  handleShowFormulaHint: handleShowFormulaHint,
598
581
  showFormulaHint: showFormulaHint,
599
- commaCount: commaCount,
600
- functionName: functionName
582
+ commaCount: commaCount
601
583
  })), !showFormulaHint && fn && (/*#__PURE__*/React.createElement(Tooltip, {
602
584
  text: "Turn on formula suggestions (F10)",
603
585
  placement: "top",
@@ -351,9 +351,11 @@ var ConditionRules = function ConditionRules(_a) {
351
351
  var _a;
352
352
  setEditConditionFormatKey(key);
353
353
  setContext(function (ctx) {
354
- var _a, _b;
354
+ var _a, _b, _c, _d;
355
355
  var index = (0, _fortuneCore.getSheetIndex)(ctx, ctx.currentSheetId);
356
- if (((_b = (_a = ctx.luckysheetfile[index]) === null || _a === void 0 ? void 0 : _a.conditionRules) === null || _b === void 0 ? void 0 : _b.editKey) === undefined) {
356
+ console.log("why set editkey", (_b = (_a = ctx.luckysheetfile[index]) === null || _a === void 0 ? void 0 : _a.conditionRules) === null || _b === void 0 ? void 0 : _b.editKey);
357
+ if (((_d = (_c = ctx.luckysheetfile[index]) === null || _c === void 0 ? void 0 : _c.conditionRules) === null || _d === void 0 ? void 0 : _d.editKey) === undefined) {
358
+ console.log("set editkey");
357
359
  ctx.luckysheetfile[index].conditionRules.editKey = key;
358
360
  }
359
361
  });
@@ -31,7 +31,7 @@ var ErrorBoxes = function ErrorBoxes() {
31
31
  zIndex: 100,
32
32
  borderRadius: "4px"
33
33
  },
34
- className: "shadow-lg flex flex-col gap-2 break-all"
34
+ className: "shadow-lg flex flex-col gap-2"
35
35
  }, /*#__PURE__*/_react.default.createElement("h3", {
36
36
  className: "text-heading-xsm color-text-danger"
37
37
  }, title), /*#__PURE__*/_react.default.createElement("div", {
@@ -20,26 +20,26 @@ var _helper = require("../../components/SheetOverlay/helper");
20
20
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
21
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
22
22
  var FxEditor = function FxEditor() {
23
- var _a;
23
+ var _a, _b, _c;
24
24
  var hideFormulaHintLocal = localStorage.getItem("formulaMore") === "true";
25
- var _b = (0, _react.useState)(false),
26
- showSearchHint = _b[0],
27
- setShowSearchHint = _b[1];
28
- var _c = (0, _react.useState)(!hideFormulaHintLocal),
29
- showFormulaHint = _c[0],
30
- setShowFormulaHint = _c[1];
31
- var _d = (0, _react.useState)(0),
32
- commaCount = _d[0],
33
- setCommaCount = _d[1];
34
- var _e = (0, _react.useContext)(_context.default),
35
- context = _e.context,
36
- setContext = _e.setContext,
37
- refs = _e.refs;
25
+ var _d = (0, _react.useState)(false),
26
+ showSearchHint = _d[0],
27
+ setShowSearchHint = _d[1];
28
+ var _e = (0, _react.useState)(!hideFormulaHintLocal),
29
+ showFormulaHint = _e[0],
30
+ setShowFormulaHint = _e[1];
31
+ var _f = (0, _react.useState)(0),
32
+ commaCount = _f[0],
33
+ setCommaCount = _f[1];
34
+ var _g = (0, _react.useContext)(_context.default),
35
+ context = _g.context,
36
+ setContext = _g.setContext,
37
+ refs = _g.refs;
38
38
  var lastKeyDownEventRef = (0, _react.useRef)(null);
39
39
  var inputContainerRef = (0, _react.useRef)(null);
40
- var _f = (0, _react.useState)(false),
41
- isHidenRC = _f[0],
42
- setIsHidenRC = _f[1];
40
+ var _h = (0, _react.useState)(false),
41
+ isHidenRC = _h[0],
42
+ setIsHidenRC = _h[1];
43
43
  var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
44
44
  var prevFirstSelection = (0, _usePrevious.default)(firstSelection);
45
45
  var prevSheetId = (0, _usePrevious.default)(context.currentSheetId);
@@ -276,24 +276,6 @@ var FxEditor = function FxEditor() {
276
276
  });
277
277
  }
278
278
  }, [refs.cellInput, refs.fxInput, setContext]);
279
- var getFunctionNameFromInput = (0, _react.useCallback)(function () {
280
- var _a, _b, _c, _d;
281
- var inputText = ((_b = (_a = refs.fxInput) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.innerText) || "";
282
- if (!inputText.startsWith("=")) return null;
283
- var functionMatch = inputText.match(/^=([A-Za-z_][A-Za-z0-9_]*)\s*\(/);
284
- if (functionMatch) {
285
- return functionMatch[1].toUpperCase();
286
- }
287
- if ((_c = refs.fxInput) === null || _c === void 0 ? void 0 : _c.current) {
288
- var funcSpan = refs.fxInput.current.querySelector(".luckysheet-formula-text-func");
289
- if (funcSpan) {
290
- return ((_d = funcSpan.textContent) === null || _d === void 0 ? void 0 : _d.toUpperCase()) || null;
291
- }
292
- }
293
- return null;
294
- }, []);
295
- var functionName = context.functionHint || getFunctionNameFromInput();
296
- var fn = functionName ? context.formulaCache.functionlistMap[functionName] : null;
297
279
  var allowEdit = (0, _react.useMemo)(function () {
298
280
  if (context.allowEdit === false) {
299
281
  return false;
@@ -307,9 +289,9 @@ var FxEditor = function FxEditor() {
307
289
  return true;
308
290
  }, [context.config, context.luckysheet_select_save, context.luckysheetfile, context.currentSheetId, isHidenRC]);
309
291
  var divRef = (0, _react.useRef)(null);
310
- var _g = (0, _react.useState)(false),
311
- isResizing = _g[0],
312
- setIsResizing = _g[1];
292
+ var _j = (0, _react.useState)(false),
293
+ isResizing = _j[0],
294
+ setIsResizing = _j[1];
313
295
  var startResize = function startResize(e) {
314
296
  e.preventDefault();
315
297
  setIsResizing(true);
@@ -385,12 +367,11 @@ var FxEditor = function FxEditor() {
385
367
  }
386
368
  })), /*#__PURE__*/_react.default.createElement("div", {
387
369
  className: "fx-hint"
388
- }, showFormulaHint && fn && (/*#__PURE__*/_react.default.createElement(_FormulaHint.default, {
370
+ }, context.functionHint && ((_c = (_b = refs.fxInput) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.innerText.includes("(")) && (/*#__PURE__*/_react.default.createElement(_FormulaHint.default, {
389
371
  handleShowFormulaHint: handleShowFormulaHint,
390
372
  showFormulaHint: showFormulaHint,
391
- commaCount: commaCount,
392
- functionName: functionName
393
- })), !showFormulaHint && fn && (/*#__PURE__*/_react.default.createElement("div", {
373
+ commaCount: commaCount
374
+ })), context.functionHint && !showFormulaHint && (/*#__PURE__*/_react.default.createElement("div", {
394
375
  className: "luckysheet-hin absolute show-more-btn",
395
376
  onClick: function onClick() {
396
377
  handleShowFormulaHint();
@@ -27,13 +27,12 @@ var FormulaHint = function FormulaHint(props) {
27
27
  var _a;
28
28
  var showFormulaHint = props.showFormulaHint,
29
29
  handleShowFormulaHint = props.handleShowFormulaHint,
30
- commaCount = props.commaCount,
31
- functionName = props.functionName;
30
+ commaCount = props.commaCount;
32
31
  var dragHasMoved = (0, _react.useRef)(false);
33
32
  var context = (0, _react.useContext)(_context.default).context;
34
33
  var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
35
34
  var formulaMore = (0, _fortuneCore.locale)(context).formulaMore;
36
- var fn = functionName ? context.formulaCache.functionlistMap[functionName] : context.formulaCache.functionlistMap[(context === null || context === void 0 ? void 0 : context.functionHint) || ""];
35
+ var fn = context.formulaCache.functionlistMap[context.functionHint];
37
36
  var _b = (0, _react.useState)(localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY)),
38
37
  API_KEY = _b[0],
39
38
  setAPI_KEY = _b[1];
@@ -17,7 +17,7 @@ var _usePrevious = _interopRequireDefault(require("../../hooks/usePrevious"));
17
17
  var _helper = require("./helper");
18
18
  var _LucideIcon = require("./LucideIcon");
19
19
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
20
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
20
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
21
21
  var __assign = void 0 && (void 0).__assign || function () {
22
22
  __assign = Object.assign || function (t) {
23
23
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -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;
33
- var _h = (0, _react.useContext)(_context.default),
34
- context = _h.context,
35
- setContext = _h.setContext,
36
- refs = _h.refs;
32
+ var _a, _b, _c, _d, _e, _f, _g, _h;
33
+ var _j = (0, _react.useContext)(_context.default),
34
+ context = _j.context,
35
+ setContext = _j.setContext,
36
+ refs = _j.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 _j = (0, _react.useState)(false),
42
- isHidenRC = _j[0],
43
- setIsHidenRC = _j[1];
44
41
  var _k = (0, _react.useState)(false),
45
- isInputBoxActive = _k[0],
46
- setIsInputBoxActive = _k[1];
47
- var _l = (0, _react.useState)(""),
48
- activeCell = _l[0],
49
- setActiveCell = _l[1];
42
+ isHidenRC = _k[0],
43
+ setIsHidenRC = _k[1];
44
+ var _l = (0, _react.useState)(false),
45
+ isInputBoxActive = _l[0],
46
+ setIsInputBoxActive = _l[1];
50
47
  var _m = (0, _react.useState)(""),
51
- activeRefCell = _m[0],
52
- setActiveRefCell = _m[1];
53
- var _o = (0, _react.useState)({
48
+ activeCell = _m[0],
49
+ setActiveCell = _m[1];
50
+ var _o = (0, _react.useState)(""),
51
+ activeRefCell = _o[0],
52
+ setActiveRefCell = _o[1];
53
+ var _p = (0, _react.useState)({
54
54
  left: 0,
55
55
  top: 0
56
56
  }),
57
- frozenPosition = _o[0],
58
- setFrozenPosition = _o[1];
57
+ frozenPosition = _p[0],
58
+ setFrozenPosition = _p[1];
59
59
  var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
60
- var _p = (0, _react.useState)({}),
61
- firstSelectionActiveCell = _p[0],
62
- setFirstSelectionActiveCell = _p[1];
63
- var _q = (0, _react.useState)(0),
64
- commaCount = _q[0],
65
- setCommaCount = _q[1];
60
+ var _q = (0, _react.useState)({}),
61
+ firstSelectionActiveCell = _q[0],
62
+ setFirstSelectionActiveCell = _q[1];
63
+ var _r = (0, _react.useState)(0),
64
+ commaCount = _r[0],
65
+ setCommaCount = _r[1];
66
66
  var hideFormulaHintLocal = localStorage.getItem("formulaMore") === "true";
67
- var _r = (0, _react.useState)(!hideFormulaHintLocal),
68
- showFormulaHint = _r[0],
69
- setShowFormulaHint = _r[1];
70
- var _s = (0, _react.useState)(false),
71
- showSearchHint = _s[0],
72
- setShowSearchHint = _s[1];
67
+ var _s = (0, _react.useState)(!hideFormulaHintLocal),
68
+ showFormulaHint = _s[0],
69
+ setShowFormulaHint = _s[1];
70
+ var _t = (0, _react.useState)(false),
71
+ showSearchHint = _t[0],
72
+ setShowSearchHint = _t[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)("");
@@ -526,24 +526,7 @@ var InputBox = function InputBox() {
526
526
  }
527
527
  return activeCell || cell;
528
528
  };
529
- var getFunctionNameFromInput = (0, _react.useCallback)(function () {
530
- var _a, _b;
531
- var inputText = ((_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.innerText) || "";
532
- if (!inputText.startsWith("=")) return null;
533
- var functionMatch = inputText.match(/^=([A-Za-z_][A-Za-z0-9_]*)\s*\(/);
534
- if (functionMatch) {
535
- return functionMatch[1].toUpperCase();
536
- }
537
- if (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) {
538
- var funcSpan = inputRef.current.querySelector(".luckysheet-formula-text-func");
539
- if (funcSpan) {
540
- return ((_b = funcSpan.textContent) === null || _b === void 0 ? void 0 : _b.toUpperCase()) || null;
541
- }
542
- }
543
- return null;
544
- }, []);
545
- var functionName = context.functionHint || getFunctionNameFromInput();
546
- var fn = functionName ? context.formulaCache.functionlistMap[functionName] : null;
529
+ var fn = context.formulaCache.functionlistMap[context.functionHint];
547
530
  return /*#__PURE__*/_react.default.createElement("div", {
548
531
  className: "luckysheet-input-box",
549
532
  id: "luckysheet-input-box",
@@ -587,7 +570,7 @@ var InputBox = function InputBox() {
587
570
  onKeyDown: onKeyDown,
588
571
  onPaste: onPaste,
589
572
  allowEdit: edit ? !isHidenRC : edit
590
- })), (context.functionCandidates.length > 0 || context.functionHint || context.defaultCandidates.length > 0 || fn) && (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showSearchHint && (/*#__PURE__*/_react.default.createElement(_FormulaSearch.default, {
573
+ })), (context.functionCandidates.length > 0 || context.functionHint || context.defaultCandidates.length > 0) && (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showSearchHint && (/*#__PURE__*/_react.default.createElement(_FormulaSearch.default, {
591
574
  onMouseMove: function onMouseMove(e) {
592
575
  if (document.getElementById("luckysheet-formula-search-c")) {
593
576
  var hoveredItem = e.target.closest(".luckysheet-formula-search-item");
@@ -602,11 +585,10 @@ var InputBox = function InputBox() {
602
585
  }
603
586
  })), /*#__PURE__*/_react.default.createElement("div", {
604
587
  className: "cell-hint"
605
- }, showFormulaHint && fn && (/*#__PURE__*/_react.default.createElement(_FormulaHint.default, {
588
+ }, showFormulaHint && fn && ((_h = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _h === void 0 ? void 0 : _h.innerText.includes("(")) && (/*#__PURE__*/_react.default.createElement(_FormulaHint.default, {
606
589
  handleShowFormulaHint: handleShowFormulaHint,
607
590
  showFormulaHint: showFormulaHint,
608
- commaCount: commaCount,
609
- functionName: functionName
591
+ commaCount: commaCount
610
592
  })), !showFormulaHint && fn && (/*#__PURE__*/_react.default.createElement(_ui.Tooltip, {
611
593
  text: "Turn on formula suggestions (F10)",
612
594
  placement: "top",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.2.81-yield",
3
+ "version": "1.2.81",
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.2.81-yield",
19
+ "@fileverse-dev/fortune-core": "1.2.81",
20
20
  "@fileverse/ui": "^4.1.7-patch-40",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",