@fileverse-dev/fortune-react 1.2.78-fx-helper-patch-1 → 1.2.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/FxEditor/index.js +23 -42
- package/es/components/SheetOverlay/FormulaHint/index.js +57 -13
- package/es/components/SheetOverlay/InputBox.js +34 -52
- package/lib/components/FxEditor/index.js +23 -42
- package/lib/components/SheetOverlay/FormulaHint/index.js +57 -13
- package/lib/components/SheetOverlay/InputBox.js +35 -53
- package/package.json +2 -2
|
@@ -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
|
|
17
|
-
showSearchHint =
|
|
18
|
-
setShowSearchHint =
|
|
19
|
-
var
|
|
20
|
-
showFormulaHint =
|
|
21
|
-
setShowFormulaHint =
|
|
22
|
-
var
|
|
23
|
-
commaCount =
|
|
24
|
-
setCommaCount =
|
|
25
|
-
var
|
|
26
|
-
context =
|
|
27
|
-
setContext =
|
|
28
|
-
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
|
|
32
|
-
isHidenRC =
|
|
33
|
-
setIsHidenRC =
|
|
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
|
|
302
|
-
isResizing =
|
|
303
|
-
setIsResizing =
|
|
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
|
-
},
|
|
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
|
-
|
|
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 =
|
|
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];
|
|
@@ -186,13 +185,19 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
186
185
|
className: " flex-grow color-text-default"
|
|
187
186
|
}, /*#__PURE__*/React.createElement("code", {
|
|
188
187
|
style: {
|
|
189
|
-
fontWeight:
|
|
188
|
+
fontWeight: "bold"
|
|
190
189
|
},
|
|
191
190
|
className: "luckysheet-arguments-help-function-name font-family-mono mb-1 mt-2 color-text-default font-family-mono"
|
|
192
191
|
}, fn.n), /*#__PURE__*/React.createElement("code", {
|
|
193
|
-
className: "luckysheet-arguments-paren font-family-mono mb-1 mt-2 color-text-default"
|
|
192
|
+
className: "luckysheet-arguments-paren font-family-mono mb-1 mt-2 color-text-default",
|
|
193
|
+
style: {
|
|
194
|
+
fontWeight: "bold"
|
|
195
|
+
}
|
|
194
196
|
}, "("), /*#__PURE__*/React.createElement("code", {
|
|
195
|
-
className: "luckysheet-arguments-parameter-holder font-family-mono mb-1 mt-2 color-text-default"
|
|
197
|
+
className: "luckysheet-arguments-parameter-holder font-family-mono mb-1 mt-2 color-text-default",
|
|
198
|
+
style: {
|
|
199
|
+
fontWeight: "bold"
|
|
200
|
+
}
|
|
196
201
|
}, fn.p.map(function (param, i) {
|
|
197
202
|
var name = param.name;
|
|
198
203
|
if (param.repeat === "y") {
|
|
@@ -206,7 +211,8 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
206
211
|
dir: "auto",
|
|
207
212
|
key: name,
|
|
208
213
|
style: {
|
|
209
|
-
backgroundColor: commaCount === i ? bgColor(fn.BRAND_SECONDARY_COLOR) : "transparent"
|
|
214
|
+
backgroundColor: commaCount === i ? bgColor(fn.BRAND_SECONDARY_COLOR) : "transparent",
|
|
215
|
+
fontWeight: "bold"
|
|
210
216
|
}
|
|
211
217
|
}, name), i !== fn.p.length - 1 && ", ");
|
|
212
218
|
})), /*#__PURE__*/React.createElement("code", {
|
|
@@ -336,12 +342,13 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
336
342
|
className: "font-family-mono mb-1 color-text-secondary"
|
|
337
343
|
}, formulaMore.helpExample), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("code", {
|
|
338
344
|
style: {
|
|
339
|
-
overflowWrap: "break-word"
|
|
345
|
+
overflowWrap: "break-word",
|
|
346
|
+
fontWeight: "bold"
|
|
340
347
|
},
|
|
341
348
|
className: "example-value-code"
|
|
342
349
|
}, /*#__PURE__*/React.createElement("span", {
|
|
343
350
|
className: "luckysheet-arguments-help-function-name"
|
|
344
|
-
}, fn.n), /*#__PURE__*/React.createElement("span", {
|
|
351
|
+
}, "=", fn.n), /*#__PURE__*/React.createElement("span", {
|
|
345
352
|
className: "luckysheet-arguments-paren"
|
|
346
353
|
}, "("), /*#__PURE__*/React.createElement("span", {
|
|
347
354
|
className: "luckysheet-arguments-parameter-holder"
|
|
@@ -349,8 +356,15 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
349
356
|
return /*#__PURE__*/React.createElement("span", {
|
|
350
357
|
key: param.name,
|
|
351
358
|
className: "luckysheet-arguments-help-parameter",
|
|
352
|
-
dir: "auto"
|
|
353
|
-
|
|
359
|
+
dir: "auto",
|
|
360
|
+
style: {
|
|
361
|
+
color: param.type === "string" ? "#177E23" : "black"
|
|
362
|
+
}
|
|
363
|
+
}, param.example, /*#__PURE__*/React.createElement("span", {
|
|
364
|
+
style: {
|
|
365
|
+
color: "black"
|
|
366
|
+
}
|
|
367
|
+
}, i !== fn.p.length - 1 && ", "));
|
|
354
368
|
})), /*#__PURE__*/React.createElement("span", {
|
|
355
369
|
className: "luckysheet-arguments-paren"
|
|
356
370
|
}, ")")))), /*#__PURE__*/React.createElement("div", {
|
|
@@ -382,6 +396,7 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
382
396
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("code", {
|
|
383
397
|
className: "font-family-mono mb-1 mt-2 color-text-default font-family-mono",
|
|
384
398
|
style: {
|
|
399
|
+
fontWeight: 600,
|
|
385
400
|
backgroundColor: commaCount === index ? bgColor(fn.BRAND_SECONDARY_COLOR) : "transparent"
|
|
386
401
|
}
|
|
387
402
|
}, param.name, param.repeat === "y" && (/*#__PURE__*/React.createElement("span", {
|
|
@@ -407,13 +422,42 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
407
422
|
borderBottomLeftRadius: "10px",
|
|
408
423
|
borderBottomRightRadius: "10px"
|
|
409
424
|
},
|
|
410
|
-
className: "w-full"
|
|
425
|
+
className: "w-full flex items-center gap-4"
|
|
411
426
|
}, /*#__PURE__*/React.createElement("div", {
|
|
412
427
|
onClick: function onClick() {
|
|
413
428
|
var _a;
|
|
414
429
|
(_a = document.getElementById("function-button")) === null || _a === void 0 ? void 0 : _a.click();
|
|
415
430
|
},
|
|
416
431
|
className: "color-text-link cursor-pointer text-helper-text-sm"
|
|
417
|
-
}, "Learn More"))))
|
|
432
|
+
}, "Learn More"), (fn.n.includes("SMARTCONTRACT") || fn.n.includes("smartcontract")) && (/*#__PURE__*/React.createElement("div", {
|
|
433
|
+
className: "flex justify-center items-center gap-1 color-text-link cursor-pointer text-helper-text-sm ml-2",
|
|
434
|
+
onClick: function onClick() {
|
|
435
|
+
var _a;
|
|
436
|
+
(_a = document.getElementById("smartcontract-button")) === null || _a === void 0 ? void 0 : _a.click();
|
|
437
|
+
}
|
|
438
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
439
|
+
className: ""
|
|
440
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
441
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
442
|
+
width: "17",
|
|
443
|
+
height: "17",
|
|
444
|
+
viewBox: "0 0 24 24",
|
|
445
|
+
fill: "none",
|
|
446
|
+
stroke: "currentColor",
|
|
447
|
+
strokeWidth: "2",
|
|
448
|
+
strokeLinecap: "round",
|
|
449
|
+
strokeLinejoin: "round",
|
|
450
|
+
className: "lucide lucide-circle-question-mark-icon lucide-circle-question-mark"
|
|
451
|
+
}, /*#__PURE__*/React.createElement("circle", {
|
|
452
|
+
cx: "12",
|
|
453
|
+
cy: "12",
|
|
454
|
+
r: "10"
|
|
455
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
456
|
+
d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"
|
|
457
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
458
|
+
d: "M12 17h.01"
|
|
459
|
+
}))), /*#__PURE__*/React.createElement("span", {
|
|
460
|
+
className: "font-normal text-xs text-[#5c0aff]"
|
|
461
|
+
}, "How to use imported contract?")))))))));
|
|
418
462
|
};
|
|
419
463
|
export default FormulaHint;
|
|
@@ -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
|
|
25
|
-
context =
|
|
26
|
-
setContext =
|
|
27
|
-
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
|
-
|
|
37
|
-
|
|
38
|
-
var _l = useState(
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
43
|
-
|
|
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 =
|
|
49
|
-
setFrozenPosition =
|
|
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
|
|
52
|
-
firstSelectionActiveCell =
|
|
53
|
-
setFirstSelectionActiveCell =
|
|
54
|
-
var
|
|
55
|
-
commaCount =
|
|
56
|
-
setCommaCount =
|
|
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
|
|
59
|
-
showFormulaHint =
|
|
60
|
-
setShowFormulaHint =
|
|
61
|
-
var
|
|
62
|
-
showSearchHint =
|
|
63
|
-
setShowSearchHint =
|
|
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
|
|
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
|
|
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",
|
|
@@ -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
|
|
26
|
-
showSearchHint =
|
|
27
|
-
setShowSearchHint =
|
|
28
|
-
var
|
|
29
|
-
showFormulaHint =
|
|
30
|
-
setShowFormulaHint =
|
|
31
|
-
var
|
|
32
|
-
commaCount =
|
|
33
|
-
setCommaCount =
|
|
34
|
-
var
|
|
35
|
-
context =
|
|
36
|
-
setContext =
|
|
37
|
-
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
|
|
41
|
-
isHidenRC =
|
|
42
|
-
setIsHidenRC =
|
|
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
|
|
311
|
-
isResizing =
|
|
312
|
-
setIsResizing =
|
|
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
|
-
},
|
|
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
|
-
|
|
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 =
|
|
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];
|
|
@@ -195,13 +194,19 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
195
194
|
className: " flex-grow color-text-default"
|
|
196
195
|
}, /*#__PURE__*/_react.default.createElement("code", {
|
|
197
196
|
style: {
|
|
198
|
-
fontWeight:
|
|
197
|
+
fontWeight: "bold"
|
|
199
198
|
},
|
|
200
199
|
className: "luckysheet-arguments-help-function-name font-family-mono mb-1 mt-2 color-text-default font-family-mono"
|
|
201
200
|
}, fn.n), /*#__PURE__*/_react.default.createElement("code", {
|
|
202
|
-
className: "luckysheet-arguments-paren font-family-mono mb-1 mt-2 color-text-default"
|
|
201
|
+
className: "luckysheet-arguments-paren font-family-mono mb-1 mt-2 color-text-default",
|
|
202
|
+
style: {
|
|
203
|
+
fontWeight: "bold"
|
|
204
|
+
}
|
|
203
205
|
}, "("), /*#__PURE__*/_react.default.createElement("code", {
|
|
204
|
-
className: "luckysheet-arguments-parameter-holder font-family-mono mb-1 mt-2 color-text-default"
|
|
206
|
+
className: "luckysheet-arguments-parameter-holder font-family-mono mb-1 mt-2 color-text-default",
|
|
207
|
+
style: {
|
|
208
|
+
fontWeight: "bold"
|
|
209
|
+
}
|
|
205
210
|
}, fn.p.map(function (param, i) {
|
|
206
211
|
var name = param.name;
|
|
207
212
|
if (param.repeat === "y") {
|
|
@@ -215,7 +220,8 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
215
220
|
dir: "auto",
|
|
216
221
|
key: name,
|
|
217
222
|
style: {
|
|
218
|
-
backgroundColor: commaCount === i ? bgColor(fn.BRAND_SECONDARY_COLOR) : "transparent"
|
|
223
|
+
backgroundColor: commaCount === i ? bgColor(fn.BRAND_SECONDARY_COLOR) : "transparent",
|
|
224
|
+
fontWeight: "bold"
|
|
219
225
|
}
|
|
220
226
|
}, name), i !== fn.p.length - 1 && ", ");
|
|
221
227
|
})), /*#__PURE__*/_react.default.createElement("code", {
|
|
@@ -345,12 +351,13 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
345
351
|
className: "font-family-mono mb-1 color-text-secondary"
|
|
346
352
|
}, formulaMore.helpExample), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("code", {
|
|
347
353
|
style: {
|
|
348
|
-
overflowWrap: "break-word"
|
|
354
|
+
overflowWrap: "break-word",
|
|
355
|
+
fontWeight: "bold"
|
|
349
356
|
},
|
|
350
357
|
className: "example-value-code"
|
|
351
358
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
352
359
|
className: "luckysheet-arguments-help-function-name"
|
|
353
|
-
}, fn.n), /*#__PURE__*/_react.default.createElement("span", {
|
|
360
|
+
}, "=", fn.n), /*#__PURE__*/_react.default.createElement("span", {
|
|
354
361
|
className: "luckysheet-arguments-paren"
|
|
355
362
|
}, "("), /*#__PURE__*/_react.default.createElement("span", {
|
|
356
363
|
className: "luckysheet-arguments-parameter-holder"
|
|
@@ -358,8 +365,15 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
358
365
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
359
366
|
key: param.name,
|
|
360
367
|
className: "luckysheet-arguments-help-parameter",
|
|
361
|
-
dir: "auto"
|
|
362
|
-
|
|
368
|
+
dir: "auto",
|
|
369
|
+
style: {
|
|
370
|
+
color: param.type === "string" ? "#177E23" : "black"
|
|
371
|
+
}
|
|
372
|
+
}, param.example, /*#__PURE__*/_react.default.createElement("span", {
|
|
373
|
+
style: {
|
|
374
|
+
color: "black"
|
|
375
|
+
}
|
|
376
|
+
}, i !== fn.p.length - 1 && ", "));
|
|
363
377
|
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
364
378
|
className: "luckysheet-arguments-paren"
|
|
365
379
|
}, ")")))), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -391,6 +405,7 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
391
405
|
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("code", {
|
|
392
406
|
className: "font-family-mono mb-1 mt-2 color-text-default font-family-mono",
|
|
393
407
|
style: {
|
|
408
|
+
fontWeight: 600,
|
|
394
409
|
backgroundColor: commaCount === index ? bgColor(fn.BRAND_SECONDARY_COLOR) : "transparent"
|
|
395
410
|
}
|
|
396
411
|
}, param.name, param.repeat === "y" && (/*#__PURE__*/_react.default.createElement("span", {
|
|
@@ -416,13 +431,42 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
416
431
|
borderBottomLeftRadius: "10px",
|
|
417
432
|
borderBottomRightRadius: "10px"
|
|
418
433
|
},
|
|
419
|
-
className: "w-full"
|
|
434
|
+
className: "w-full flex items-center gap-4"
|
|
420
435
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
421
436
|
onClick: function onClick() {
|
|
422
437
|
var _a;
|
|
423
438
|
(_a = document.getElementById("function-button")) === null || _a === void 0 ? void 0 : _a.click();
|
|
424
439
|
},
|
|
425
440
|
className: "color-text-link cursor-pointer text-helper-text-sm"
|
|
426
|
-
}, "Learn More"))))
|
|
441
|
+
}, "Learn More"), (fn.n.includes("SMARTCONTRACT") || fn.n.includes("smartcontract")) && (/*#__PURE__*/_react.default.createElement("div", {
|
|
442
|
+
className: "flex justify-center items-center gap-1 color-text-link cursor-pointer text-helper-text-sm ml-2",
|
|
443
|
+
onClick: function onClick() {
|
|
444
|
+
var _a;
|
|
445
|
+
(_a = document.getElementById("smartcontract-button")) === null || _a === void 0 ? void 0 : _a.click();
|
|
446
|
+
}
|
|
447
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
448
|
+
className: ""
|
|
449
|
+
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
450
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
451
|
+
width: "17",
|
|
452
|
+
height: "17",
|
|
453
|
+
viewBox: "0 0 24 24",
|
|
454
|
+
fill: "none",
|
|
455
|
+
stroke: "currentColor",
|
|
456
|
+
strokeWidth: "2",
|
|
457
|
+
strokeLinecap: "round",
|
|
458
|
+
strokeLinejoin: "round",
|
|
459
|
+
className: "lucide lucide-circle-question-mark-icon lucide-circle-question-mark"
|
|
460
|
+
}, /*#__PURE__*/_react.default.createElement("circle", {
|
|
461
|
+
cx: "12",
|
|
462
|
+
cy: "12",
|
|
463
|
+
r: "10"
|
|
464
|
+
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
465
|
+
d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"
|
|
466
|
+
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
467
|
+
d: "M12 17h.01"
|
|
468
|
+
}))), /*#__PURE__*/_react.default.createElement("span", {
|
|
469
|
+
className: "font-normal text-xs text-[#5c0aff]"
|
|
470
|
+
}, "How to use imported contract?")))))))));
|
|
427
471
|
};
|
|
428
472
|
var _default = exports.default = FormulaHint;
|
|
@@ -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
|
|
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
|
|
34
|
-
context =
|
|
35
|
-
setContext =
|
|
36
|
-
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
|
-
|
|
46
|
-
|
|
47
|
-
var _l = (0, _react.useState)(
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
52
|
-
|
|
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 =
|
|
58
|
-
setFrozenPosition =
|
|
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
|
|
61
|
-
firstSelectionActiveCell =
|
|
62
|
-
setFirstSelectionActiveCell =
|
|
63
|
-
var
|
|
64
|
-
commaCount =
|
|
65
|
-
setCommaCount =
|
|
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
|
|
68
|
-
showFormulaHint =
|
|
69
|
-
setShowFormulaHint =
|
|
70
|
-
var
|
|
71
|
-
showSearchHint =
|
|
72
|
-
setShowSearchHint =
|
|
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
|
|
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
|
|
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.
|
|
3
|
+
"version": "1.2.79",
|
|
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.
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.2.79",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-40",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|