@fileverse-dev/fortune-react 1.1.36 → 1.1.38
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/SheetOverlay/InputBox.js +9 -4
- package/es/components/Toolbar/index.d.ts +1 -1
- package/es/components/Workbook/index.d.ts +4 -4
- package/lib/components/SheetOverlay/InputBox.js +11 -6
- package/lib/components/Toolbar/index.d.ts +1 -1
- package/lib/components/Workbook/index.d.ts +4 -4
- package/package.json +2 -2
|
@@ -9,6 +9,7 @@ var __assign = this && this.__assign || function () {
|
|
|
9
9
|
return __assign.apply(this, arguments);
|
|
10
10
|
};
|
|
11
11
|
import { cancelNormalSelected, getCellValue, getInlineStringHTML, getStyleByCell, isInlineStringCell, moveToEnd, getFlowdata, handleFormulaInput, moveHighlightCell, escapeScriptTag, valueShowEs, createRangeHightlight, isShowHidenCR, israngeseleciton, escapeHTMLTag, isAllowEdit, getrangeseleciton, indexToColumnChar } from "@fileverse-dev/fortune-core";
|
|
12
|
+
import { isLetterNumberPattern, removeLastSpan } from "@fileverse-dev/fortune-core/src/utils/index";
|
|
12
13
|
import React, { useContext, useEffect, useMemo, useRef, useCallback, useLayoutEffect, useState } from "react";
|
|
13
14
|
import _ from "lodash";
|
|
14
15
|
import WorkbookContext from "../../context";
|
|
@@ -16,7 +17,7 @@ import ContentEditable from "./ContentEditable";
|
|
|
16
17
|
import FormulaSearch from "./FormulaSearch";
|
|
17
18
|
import FormulaHint from "./FormulaHint";
|
|
18
19
|
import usePrevious from "../../hooks/usePrevious";
|
|
19
|
-
import { moveCursorToEnd,
|
|
20
|
+
import { moveCursorToEnd, incrementColumn, decrementColumn, incrementRow, decrementRow } from "./helper";
|
|
20
21
|
var InputBox = function InputBox() {
|
|
21
22
|
var _a, _b, _c, _d, _e, _f;
|
|
22
23
|
var _g = useContext(WorkbookContext),
|
|
@@ -200,10 +201,10 @@ var InputBox = function InputBox() {
|
|
|
200
201
|
}
|
|
201
202
|
}, [getActiveFormula, insertSelectedFormula]);
|
|
202
203
|
var onKeyDown = useCallback(function (e) {
|
|
203
|
-
var _a;
|
|
204
|
+
var _a, _b;
|
|
204
205
|
lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
|
|
205
206
|
preText.current = inputRef.current.innerText;
|
|
206
|
-
if (e.key
|
|
207
|
+
if (e.key === "Delete" || e.key === "Backspace") {
|
|
207
208
|
setTimeout(function () {
|
|
208
209
|
moveCursorToEnd(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
209
210
|
}, 5);
|
|
@@ -223,8 +224,12 @@ var InputBox = function InputBox() {
|
|
|
223
224
|
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");
|
|
224
225
|
var spans = doc.querySelectorAll("span");
|
|
225
226
|
var lastSpan = spans[spans.length - 1];
|
|
227
|
+
var notFunctionInit = !((_b = document.getElementById("luckysheet-rich-text-editor")) === null || _b === void 0 ? void 0 : _b.innerText.includes("("));
|
|
228
|
+
if ((lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")")) || notFunctionInit && (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.length) >= 1 && !_.includes(["="], lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
226
231
|
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) !== ")") && !isLetterNumberPattern(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
|
|
227
|
-
if (!(
|
|
232
|
+
if (!(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.innerText.includes("(")) && (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.length) > 2 || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.length) === 2 && !isLetterNumberPattern(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
|
|
228
233
|
return;
|
|
229
234
|
}
|
|
230
235
|
inputRef.current.innerHTML = "".concat(inputRef.current.innerHTML, "<span class=\"fortune-formula-functionrange-cell\" rangeindex=\"0\" dir=\"auto\" style=\"color:#c1232b;\">").concat(refCell, "</span>");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Cell } from "@fileverse-dev/fortune-core";
|
|
3
3
|
import "./index.css";
|
|
4
|
-
export declare const getLucideIcon: (title: string) => "Ethereum" | "DollarSign" | "" | "
|
|
4
|
+
export declare const getLucideIcon: (title: string) => "Ethereum" | "DollarSign" | "" | "Undo" | "Redo" | "Underline" | "Border" | "Filter" | "Link" | "Search" | "Percent" | "ChevronDown" | "PaintRoller" | "Bold" | "Italic" | "Strikethrough" | "AlignLeft" | "AlignCenter" | "AlignRight" | "ArrowUpFromLine" | "AlignVerticalMiddle" | "ArrowDownToLine" | "TextOverflow" | "WrapText" | "TextClip" | "Baseline" | "PaintBucket" | "MergeHorizontal" | "DecimalsArrowLeft" | "DecimalsArrowRight" | "PaintbrushVertical" | "MessageSquarePlus" | "Image" | "Sigma" | "ShieldCheck" | "DuneChart" | "Ellipsis";
|
|
5
5
|
export declare const CurrencySelector: ({ cell, defaultTextFormat, toolTipText, }: {
|
|
6
6
|
cell: Cell | null | undefined;
|
|
7
7
|
defaultTextFormat: string;
|
|
@@ -12,17 +12,17 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
12
12
|
applyOp: (ops: Op[]) => void;
|
|
13
13
|
getCryptoPrice: typeof getCryptoPrice;
|
|
14
14
|
getCellValue: (row: number, column: number, options?: api.CommonOptions & {
|
|
15
|
-
type?: "rt" | "
|
|
15
|
+
type?: "rt" | "mc" | "m" | "v" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
|
|
16
16
|
}) => any;
|
|
17
17
|
onboardingActiveCell: (functionName: string) => void;
|
|
18
18
|
initializeComment: (row: number, column: number) => void;
|
|
19
19
|
updateSheetLiveQueryList: (subsheetIndex: number, _data: import("@fileverse-dev/fortune-core").LiveQueryData) => void;
|
|
20
20
|
removeFromLiveQueryList: (subSheetIndex: number, id: string) => void;
|
|
21
21
|
setCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
|
|
22
|
-
type?: "rt" | "
|
|
22
|
+
type?: "rt" | "mc" | "m" | "v" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
|
|
23
23
|
}) => void;
|
|
24
24
|
clearCell: (row: number, column: number, options?: api.CommonOptions) => void;
|
|
25
|
-
setCellFormat: (row: number, column: number, attr: "rt" | "
|
|
25
|
+
setCellFormat: (row: number, column: number, attr: "rt" | "mc" | "m" | "v" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle, value: any, options?: api.CommonOptions) => void;
|
|
26
26
|
autoFillCell: (copyRange: import("@fileverse-dev/fortune-core").SingleRange, applyRange: import("@fileverse-dev/fortune-core").SingleRange, direction: "left" | "right" | "down" | "up") => void;
|
|
27
27
|
freeze: (type: "column" | "both" | "row", range: {
|
|
28
28
|
row: number;
|
|
@@ -53,7 +53,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
53
53
|
getHtmlByRange: (range: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => string | null;
|
|
54
54
|
setSelection: (range: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => void;
|
|
55
55
|
setCellValuesByRange: (data: any[][], range: import("@fileverse-dev/fortune-core").SingleRange, options?: api.CommonOptions) => void;
|
|
56
|
-
setCellFormatByRange: (attr: "rt" | "
|
|
56
|
+
setCellFormatByRange: (attr: "rt" | "mc" | "m" | "v" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle, value: any, range: import("@fileverse-dev/fortune-core").SingleRange | import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => void;
|
|
57
57
|
mergeCells: (ranges: import("@fileverse-dev/fortune-core").Range, type: string, options?: api.CommonOptions) => void;
|
|
58
58
|
cancelMerge: (ranges: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => void;
|
|
59
59
|
getAllSheets: () => SheetType[];
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _fortuneCore = require("@fileverse-dev/fortune-core");
|
|
9
|
+
var _index = require("@fileverse-dev/fortune-core/src/utils/index");
|
|
9
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
11
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
11
12
|
var _context = _interopRequireDefault(require("../../context"));
|
|
@@ -209,10 +210,10 @@ var InputBox = function InputBox() {
|
|
|
209
210
|
}
|
|
210
211
|
}, [getActiveFormula, insertSelectedFormula]);
|
|
211
212
|
var onKeyDown = (0, _react.useCallback)(function (e) {
|
|
212
|
-
var _a;
|
|
213
|
+
var _a, _b;
|
|
213
214
|
lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
|
|
214
215
|
preText.current = inputRef.current.innerText;
|
|
215
|
-
if (e.key
|
|
216
|
+
if (e.key === "Delete" || e.key === "Backspace") {
|
|
216
217
|
setTimeout(function () {
|
|
217
218
|
(0, _helper.moveCursorToEnd)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
218
219
|
}, 5);
|
|
@@ -232,8 +233,12 @@ var InputBox = function InputBox() {
|
|
|
232
233
|
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");
|
|
233
234
|
var spans = doc.querySelectorAll("span");
|
|
234
235
|
var lastSpan = spans[spans.length - 1];
|
|
235
|
-
|
|
236
|
-
|
|
236
|
+
var notFunctionInit = !((_b = document.getElementById("luckysheet-rich-text-editor")) === null || _b === void 0 ? void 0 : _b.innerText.includes("("));
|
|
237
|
+
if ((lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")")) || notFunctionInit && (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.length) >= 1 && !_lodash.default.includes(["="], lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
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) !== ")") && !(0, _index.isLetterNumberPattern)(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
|
|
241
|
+
if (!(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.innerText.includes("(")) && (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.length) > 2 || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.length) === 2 && !(0, _index.isLetterNumberPattern)(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
|
|
237
242
|
return;
|
|
238
243
|
}
|
|
239
244
|
inputRef.current.innerHTML = "".concat(inputRef.current.innerHTML, "<span class=\"fortune-formula-functionrange-cell\" rangeindex=\"0\" dir=\"auto\" style=\"color:#c1232b;\">").concat(refCell, "</span>");
|
|
@@ -242,8 +247,8 @@ var InputBox = function InputBox() {
|
|
|
242
247
|
}, 1);
|
|
243
248
|
return;
|
|
244
249
|
}
|
|
245
|
-
if ((0,
|
|
246
|
-
var htmlR = (0,
|
|
250
|
+
if ((0, _index.isLetterNumberPattern)(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
|
|
251
|
+
var htmlR = (0, _index.removeLastSpan)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.innerHTML);
|
|
247
252
|
inputRef.current.innerHTML = "".concat(htmlR, "<span class=\"fortune-formula-functionrange-cell\" rangeindex=\"0\" dir=\"auto\" style=\"color:#c1232b;\">").concat(refCell, "</span>");
|
|
248
253
|
(0, _helper.moveCursorToEnd)(inputRef.current);
|
|
249
254
|
setTimeout(function () {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Cell } from "@fileverse-dev/fortune-core";
|
|
3
3
|
import "./index.css";
|
|
4
|
-
export declare const getLucideIcon: (title: string) => "Ethereum" | "DollarSign" | "" | "
|
|
4
|
+
export declare const getLucideIcon: (title: string) => "Ethereum" | "DollarSign" | "" | "Undo" | "Redo" | "Underline" | "Border" | "Filter" | "Link" | "Search" | "Percent" | "ChevronDown" | "PaintRoller" | "Bold" | "Italic" | "Strikethrough" | "AlignLeft" | "AlignCenter" | "AlignRight" | "ArrowUpFromLine" | "AlignVerticalMiddle" | "ArrowDownToLine" | "TextOverflow" | "WrapText" | "TextClip" | "Baseline" | "PaintBucket" | "MergeHorizontal" | "DecimalsArrowLeft" | "DecimalsArrowRight" | "PaintbrushVertical" | "MessageSquarePlus" | "Image" | "Sigma" | "ShieldCheck" | "DuneChart" | "Ellipsis";
|
|
5
5
|
export declare const CurrencySelector: ({ cell, defaultTextFormat, toolTipText, }: {
|
|
6
6
|
cell: Cell | null | undefined;
|
|
7
7
|
defaultTextFormat: string;
|
|
@@ -12,17 +12,17 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
12
12
|
applyOp: (ops: Op[]) => void;
|
|
13
13
|
getCryptoPrice: typeof getCryptoPrice;
|
|
14
14
|
getCellValue: (row: number, column: number, options?: api.CommonOptions & {
|
|
15
|
-
type?: "rt" | "
|
|
15
|
+
type?: "rt" | "mc" | "m" | "v" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
|
|
16
16
|
}) => any;
|
|
17
17
|
onboardingActiveCell: (functionName: string) => void;
|
|
18
18
|
initializeComment: (row: number, column: number) => void;
|
|
19
19
|
updateSheetLiveQueryList: (subsheetIndex: number, _data: import("@fileverse-dev/fortune-core").LiveQueryData) => void;
|
|
20
20
|
removeFromLiveQueryList: (subSheetIndex: number, id: string) => void;
|
|
21
21
|
setCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
|
|
22
|
-
type?: "rt" | "
|
|
22
|
+
type?: "rt" | "mc" | "m" | "v" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
|
|
23
23
|
}) => void;
|
|
24
24
|
clearCell: (row: number, column: number, options?: api.CommonOptions) => void;
|
|
25
|
-
setCellFormat: (row: number, column: number, attr: "rt" | "
|
|
25
|
+
setCellFormat: (row: number, column: number, attr: "rt" | "mc" | "m" | "v" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle, value: any, options?: api.CommonOptions) => void;
|
|
26
26
|
autoFillCell: (copyRange: import("@fileverse-dev/fortune-core").SingleRange, applyRange: import("@fileverse-dev/fortune-core").SingleRange, direction: "left" | "right" | "down" | "up") => void;
|
|
27
27
|
freeze: (type: "column" | "both" | "row", range: {
|
|
28
28
|
row: number;
|
|
@@ -53,7 +53,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
53
53
|
getHtmlByRange: (range: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => string | null;
|
|
54
54
|
setSelection: (range: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => void;
|
|
55
55
|
setCellValuesByRange: (data: any[][], range: import("@fileverse-dev/fortune-core").SingleRange, options?: api.CommonOptions) => void;
|
|
56
|
-
setCellFormatByRange: (attr: "rt" | "
|
|
56
|
+
setCellFormatByRange: (attr: "rt" | "mc" | "m" | "v" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle, value: any, range: import("@fileverse-dev/fortune-core").SingleRange | import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => void;
|
|
57
57
|
mergeCells: (ranges: import("@fileverse-dev/fortune-core").Range, type: string, options?: api.CommonOptions) => void;
|
|
58
58
|
cancelMerge: (ranges: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => void;
|
|
59
59
|
getAllSheets: () => SheetType[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.38",
|
|
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.1.
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.1.38",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-21",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|