@fileverse-dev/fortune-react 1.1.97 → 1.1.99-patch-1
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/DataVerification/DropdownList.js +10 -1
- package/es/components/DataVerification/DropdownOption.js +12 -1
- package/es/components/DataVerification/index.js +0 -8
- package/es/components/SheetOverlay/FormulaHint/index.js +11 -4
- package/es/components/SheetOverlay/InputBox.js +21 -8
- package/es/components/SheetOverlay/drag_and_drop/column-helpers.js +20 -0
- package/es/components/SheetOverlay/drag_and_drop/row-helpers.js +20 -0
- package/es/components/SheetOverlay/helper.d.ts +1 -0
- package/es/components/SheetOverlay/helper.js +20 -0
- package/es/components/Toolbar/index.d.ts +1 -1
- package/es/components/Toolbar/index.js +2 -2
- package/lib/components/DataVerification/DropdownList.js +10 -1
- package/lib/components/DataVerification/DropdownOption.js +12 -1
- package/lib/components/DataVerification/index.js +0 -8
- package/lib/components/SheetOverlay/FormulaHint/index.js +11 -4
- package/lib/components/SheetOverlay/InputBox.js +21 -8
- package/lib/components/SheetOverlay/drag_and_drop/column-helpers.js +20 -0
- package/lib/components/SheetOverlay/drag_and_drop/row-helpers.js +20 -0
- package/lib/components/SheetOverlay/helper.d.ts +1 -0
- package/lib/components/SheetOverlay/helper.js +21 -0
- package/lib/components/Toolbar/index.d.ts +1 -1
- package/lib/components/Toolbar/index.js +2 -2
- package/package.json +2 -2
|
@@ -24,7 +24,16 @@ var DropDownList = function DropDownList() {
|
|
|
24
24
|
var _f = useState([]),
|
|
25
25
|
rbgColor = _f[0],
|
|
26
26
|
setRbgColor = _f[1];
|
|
27
|
-
var close = useCallback(function () {
|
|
27
|
+
var close = useCallback(function () {
|
|
28
|
+
setContext(function (ctx) {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
31
|
+
var verification = context.luckysheetfile[index].dataVerification;
|
|
32
|
+
if (!verification["".concat((_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0].row_focus, "_").concat((_b = ctx.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0].column_focus)]) {
|
|
33
|
+
ctx.dataVerificationDropDownList = false;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}, [setContext]);
|
|
28
37
|
useOutsideClick(containerRef, close, [close]);
|
|
29
38
|
useEffect(function () {
|
|
30
39
|
var _a, _b;
|
|
@@ -235,11 +235,22 @@ var DynamicInputList = function DynamicInputList(_a) {
|
|
|
235
235
|
})), /*#__PURE__*/React.createElement("div", {
|
|
236
236
|
className: "flex flex-1 optionItems-center transition"
|
|
237
237
|
}, /*#__PURE__*/React.createElement(TextField, {
|
|
238
|
+
type: "text",
|
|
239
|
+
onMouseDown: function onMouseDown(e) {
|
|
240
|
+
e.stopPropagation();
|
|
241
|
+
e.target.focus();
|
|
242
|
+
},
|
|
243
|
+
key: item.id,
|
|
244
|
+
onKeyDown: function onKeyDown(e) {
|
|
245
|
+
e.stopPropagation();
|
|
246
|
+
},
|
|
238
247
|
className: "w-full",
|
|
239
248
|
placeholder: "Option ".concat(index + 1),
|
|
240
249
|
value: item.value,
|
|
241
250
|
onChange: function onChange(e) {
|
|
242
|
-
|
|
251
|
+
e.stopPropagation();
|
|
252
|
+
handleChange(index, e.target.value);
|
|
253
|
+
e.target.focus();
|
|
243
254
|
},
|
|
244
255
|
"aria-label": "Option ".concat(index + 1)
|
|
245
256
|
})), optionItems.length > 1 && (/*#__PURE__*/React.createElement(IconButton, {
|
|
@@ -84,14 +84,6 @@ var DataVerification = function DataVerification() {
|
|
|
84
84
|
}));
|
|
85
85
|
}
|
|
86
86
|
}, []);
|
|
87
|
-
var dataSelectRange = useCallback(function (type, value) {
|
|
88
|
-
hideDialog();
|
|
89
|
-
setContext(function (ctx) {
|
|
90
|
-
ctx.rangeDialog.show = true;
|
|
91
|
-
ctx.rangeDialog.type = type;
|
|
92
|
-
ctx.rangeDialog.rangeTxt = value;
|
|
93
|
-
});
|
|
94
|
-
}, [hideDialog, setContext]);
|
|
95
87
|
var btn = useCallback(function (type) {
|
|
96
88
|
if (type === "confirm") {
|
|
97
89
|
setContext(function (ctx) {
|
|
@@ -17,7 +17,8 @@ import { DraggableDiv } from "./dragable-div";
|
|
|
17
17
|
var FormulaHint = function FormulaHint(props) {
|
|
18
18
|
var _a;
|
|
19
19
|
var showFormulaHint = props.showFormulaHint,
|
|
20
|
-
handleShowFormulaHint = props.handleShowFormulaHint
|
|
20
|
+
handleShowFormulaHint = props.handleShowFormulaHint,
|
|
21
|
+
commaCount = props.commaCount;
|
|
21
22
|
var dragHasMoved = useRef(false);
|
|
22
23
|
var context = useContext(WorkbookContext).context;
|
|
23
24
|
var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
|
|
@@ -186,7 +187,10 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
186
187
|
return /*#__PURE__*/React.createElement("code", {
|
|
187
188
|
className: "luckysheet-arguments-help-parameter font-family-mono mb-1 mt-2 color-text-default",
|
|
188
189
|
dir: "auto",
|
|
189
|
-
key: name
|
|
190
|
+
key: name,
|
|
191
|
+
style: {
|
|
192
|
+
backgroundColor: commaCount === i ? (fn === null || fn === void 0 ? void 0 : fn.BRAND_SECONDARY_COLOR) || "#FFDF0A" : "transparent"
|
|
193
|
+
}
|
|
190
194
|
}, name, i !== fn.p.length - 1 && ", ");
|
|
191
195
|
})), /*#__PURE__*/React.createElement("code", {
|
|
192
196
|
className: "luckysheet-arguments-paren font-family-mono mb-1 mt-2 color-text-default"
|
|
@@ -354,12 +358,15 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
354
358
|
paddingTop: "16px"
|
|
355
359
|
},
|
|
356
360
|
className: "luckysheet-formula-help-content-param"
|
|
357
|
-
}, fn.p.map(function (param) {
|
|
361
|
+
}, fn.p.map(function (param, index) {
|
|
358
362
|
return /*#__PURE__*/React.createElement("div", {
|
|
359
363
|
className: "",
|
|
360
364
|
key: param.name
|
|
361
365
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("code", {
|
|
362
|
-
className: "font-family-mono mb-1 mt-2 color-text-default font-family-mono"
|
|
366
|
+
className: "font-family-mono mb-1 mt-2 color-text-default font-family-mono",
|
|
367
|
+
style: {
|
|
368
|
+
backgroundColor: commaCount === index ? (fn === null || fn === void 0 ? void 0 : fn.BRAND_SECONDARY_COLOR) || "#FFDF0A" : "transparent"
|
|
369
|
+
}
|
|
363
370
|
}, param.name, param.repeat === "y" && (/*#__PURE__*/React.createElement("span", {
|
|
364
371
|
className: "luckysheet-arguments-help-argument-info example-value",
|
|
365
372
|
style: {
|
|
@@ -17,7 +17,7 @@ import ContentEditable from "./ContentEditable";
|
|
|
17
17
|
import FormulaSearch from "./FormulaSearch";
|
|
18
18
|
import FormulaHint from "./FormulaHint";
|
|
19
19
|
import usePrevious from "../../hooks/usePrevious";
|
|
20
|
-
import { moveCursorToEnd, getCursorPosition, isLetterNumberPattern, removeLastSpan, incrementColumn, decrementColumn, incrementRow, decrementRow } from "./helper";
|
|
20
|
+
import { moveCursorToEnd, getCursorPosition, isLetterNumberPattern, removeLastSpan, incrementColumn, decrementColumn, incrementRow, decrementRow, countCommasBeforeCursor } from "./helper";
|
|
21
21
|
import { LucideIcon } from "./LucideIcon";
|
|
22
22
|
var InputBox = function InputBox() {
|
|
23
23
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -51,13 +51,16 @@ var InputBox = function InputBox() {
|
|
|
51
51
|
var _q = useState({}),
|
|
52
52
|
firstSelectionActiveCell = _q[0],
|
|
53
53
|
setFirstSelectionActiveCell = _q[1];
|
|
54
|
+
var _r = useState(0),
|
|
55
|
+
commaCount = _r[0],
|
|
56
|
+
setCommaCount = _r[1];
|
|
54
57
|
var hideFormulaHintLocal = localStorage.getItem("formulaMore") === "true";
|
|
55
|
-
var
|
|
56
|
-
showFormulaHint =
|
|
57
|
-
setShowFormulaHint =
|
|
58
|
-
var
|
|
59
|
-
showSearchHint =
|
|
60
|
-
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];
|
|
61
64
|
var row_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
|
|
62
65
|
var col_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
|
|
63
66
|
var preText = useRef("");
|
|
@@ -242,6 +245,9 @@ var InputBox = function InputBox() {
|
|
|
242
245
|
var _a, _b;
|
|
243
246
|
lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
|
|
244
247
|
preText.current = inputRef.current.innerText;
|
|
248
|
+
var currentCommaCount = countCommasBeforeCursor(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
249
|
+
console.log("currentCommaCount", currentCommaCount);
|
|
250
|
+
setCommaCount(currentCommaCount);
|
|
245
251
|
var allowListNavigation = true;
|
|
246
252
|
if ((e.key === "Delete" || e.key === "Backspace") && getCursorPosition(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.innerText.length)) {
|
|
247
253
|
setTimeout(function () {
|
|
@@ -344,6 +350,8 @@ var InputBox = function InputBox() {
|
|
|
344
350
|
} else {
|
|
345
351
|
setShowSearchHint(false);
|
|
346
352
|
}
|
|
353
|
+
var currentCommaCount = countCommasBeforeCursor(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
354
|
+
setCommaCount(currentCommaCount);
|
|
347
355
|
var e = lastKeyDownEventRef.current;
|
|
348
356
|
if (!e) return;
|
|
349
357
|
var kcode = e.keyCode;
|
|
@@ -487,6 +495,10 @@ var InputBox = function InputBox() {
|
|
|
487
495
|
minHeight: firstSelection.height
|
|
488
496
|
}, inputBoxStyle) : {}
|
|
489
497
|
}, /*#__PURE__*/React.createElement(ContentEditable, {
|
|
498
|
+
onMouseUp: function onMouseUp() {
|
|
499
|
+
var currentCommaCount = countCommasBeforeCursor(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
500
|
+
setCommaCount(currentCommaCount);
|
|
501
|
+
},
|
|
490
502
|
innerRef: function innerRef(e) {
|
|
491
503
|
inputRef.current = e;
|
|
492
504
|
refs.cellInput.current = e;
|
|
@@ -520,7 +532,8 @@ var InputBox = function InputBox() {
|
|
|
520
532
|
}
|
|
521
533
|
})), 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, {
|
|
522
534
|
handleShowFormulaHint: handleShowFormulaHint,
|
|
523
|
-
showFormulaHint: showFormulaHint
|
|
535
|
+
showFormulaHint: showFormulaHint,
|
|
536
|
+
commaCount: commaCount
|
|
524
537
|
})), !showFormulaHint && fn && (/*#__PURE__*/React.createElement(Tooltip, {
|
|
525
538
|
text: "Turn on formula suggestions (F10)",
|
|
526
539
|
placement: "top",
|
|
@@ -272,6 +272,26 @@ export var useColumnDragAndDrop = function useColumnDragAndDrop(containerRef, se
|
|
|
272
272
|
}
|
|
273
273
|
});
|
|
274
274
|
});
|
|
275
|
+
if (_sheet.dataVerification) {
|
|
276
|
+
var newDataVerification_1 = {};
|
|
277
|
+
Object.keys(_sheet.dataVerification).forEach(function (item) {
|
|
278
|
+
var _a;
|
|
279
|
+
var itemData = (_a = _sheet.dataVerification) === null || _a === void 0 ? void 0 : _a[item];
|
|
280
|
+
var colRow = item.split("_");
|
|
281
|
+
if (colRow.length !== 2) return;
|
|
282
|
+
var presentcol = parseInt(colRow[1], 10);
|
|
283
|
+
var updatedCol = presentcol;
|
|
284
|
+
if (presentcol === sourceIndex_1) {
|
|
285
|
+
updatedCol = targetIndex;
|
|
286
|
+
} else if (presentcol > sourceIndex_1 && presentcol < targetIndex) {
|
|
287
|
+
updatedCol -= 1;
|
|
288
|
+
} else if (presentcol < sourceIndex_1 && presentcol >= targetIndex) {
|
|
289
|
+
updatedCol += 1;
|
|
290
|
+
}
|
|
291
|
+
newDataVerification_1["".concat(colRow[0], "_").concat(updatedCol)] = itemData;
|
|
292
|
+
});
|
|
293
|
+
_sheet.dataVerification = newDataVerification_1;
|
|
294
|
+
}
|
|
275
295
|
(_c = _sheet.calcChain) === null || _c === void 0 ? void 0 : _c.forEach(function (item) {
|
|
276
296
|
if (item.c === sourceIndex_1) {
|
|
277
297
|
item.c = targetIndex;
|
|
@@ -253,6 +253,26 @@ export var useRowDragAndDrop = function useRowDragAndDrop(containerRef, selected
|
|
|
253
253
|
}
|
|
254
254
|
});
|
|
255
255
|
});
|
|
256
|
+
if (_sheet.dataVerification) {
|
|
257
|
+
var newDataVerification_1 = {};
|
|
258
|
+
Object.keys(_sheet.dataVerification).forEach(function (item) {
|
|
259
|
+
var _a;
|
|
260
|
+
var itemData = (_a = _sheet.dataVerification) === null || _a === void 0 ? void 0 : _a[item];
|
|
261
|
+
var colRow = item.split("_");
|
|
262
|
+
if (colRow.length !== 2) return;
|
|
263
|
+
var presentRow = parseInt(colRow[0], 10);
|
|
264
|
+
var updatedRow = presentRow;
|
|
265
|
+
if (presentRow === sourceIndex_1) {
|
|
266
|
+
updatedRow = targetIndex;
|
|
267
|
+
} else if (presentRow > sourceIndex_1 && presentRow < targetIndex) {
|
|
268
|
+
updatedRow -= 1;
|
|
269
|
+
} else if (presentRow < sourceIndex_1 && presentRow >= targetIndex) {
|
|
270
|
+
updatedRow += 1;
|
|
271
|
+
}
|
|
272
|
+
newDataVerification_1["".concat(updatedRow, "_").concat(colRow[1])] = itemData;
|
|
273
|
+
});
|
|
274
|
+
_sheet.dataVerification = newDataVerification_1;
|
|
275
|
+
}
|
|
256
276
|
(_a = _sheet.calcChain) === null || _a === void 0 ? void 0 : _a.forEach(function (item) {
|
|
257
277
|
if (item.r === sourceIndex_1) {
|
|
258
278
|
item.r = targetIndex;
|
|
@@ -6,3 +6,4 @@ export declare function incrementColumn(cell: string): string;
|
|
|
6
6
|
export declare function decrementColumn(cell: string): string;
|
|
7
7
|
export declare function incrementRow(cell: string): string;
|
|
8
8
|
export declare function decrementRow(cell: string): string;
|
|
9
|
+
export declare function countCommasBeforeCursor(editableDiv: HTMLDivElement): number;
|
|
@@ -83,4 +83,24 @@ export function decrementRow(cell) {
|
|
|
83
83
|
if (!parsed) return "";
|
|
84
84
|
var newRowPart = Math.max(1, parsed.rowPart - 1);
|
|
85
85
|
return parsed.colPart + newRowPart;
|
|
86
|
+
}
|
|
87
|
+
export function countCommasBeforeCursor(editableDiv) {
|
|
88
|
+
var selection = window.getSelection();
|
|
89
|
+
if (!(selection === null || selection === void 0 ? void 0 : selection.rangeCount)) return 0;
|
|
90
|
+
var range = selection.getRangeAt(0);
|
|
91
|
+
var preCaretRange = range.cloneRange();
|
|
92
|
+
preCaretRange.selectNodeContents(editableDiv);
|
|
93
|
+
preCaretRange.setEnd(range.endContainer, range.endOffset);
|
|
94
|
+
var textBeforeCursor = preCaretRange.toString();
|
|
95
|
+
var inQuotes = false;
|
|
96
|
+
var count = 0;
|
|
97
|
+
for (var i = 0; i < textBeforeCursor.length; i += 1) {
|
|
98
|
+
var char = textBeforeCursor[i];
|
|
99
|
+
if (char === '"') {
|
|
100
|
+
inQuotes = !inQuotes;
|
|
101
|
+
} else if (char === "," && !inQuotes) {
|
|
102
|
+
count += 1;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return count;
|
|
86
106
|
}
|
|
@@ -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" | "" | "ChevronDown" | "Undo" | "Redo" | "
|
|
4
|
+
export declare const getLucideIcon: (title: string) => "Ethereum" | "DollarSign" | "" | "ChevronDown" | "Undo" | "Redo" | "Underline" | "Border" | "Filter" | "Link" | "Search" | "Percent" | "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;
|
|
@@ -123,11 +123,11 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
123
123
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
124
124
|
};
|
|
125
125
|
import React, { useContext, useCallback, useRef, useEffect, useState } from "react";
|
|
126
|
-
import DataVerificationPortal from "./dataVerificationPortal";
|
|
127
126
|
import { toolbarItemClickHandler, handleTextBackground, handleTextColor, handleTextSize, normalizedCellAttr, getFlowdata, newComment, editComment, deleteComment, showHideComment, showHideAllComments, autoSelectionFormula, handleSum, locale, handleMerge, handleBorder, toolbarItemSelectedFunc, handleFreeze, insertImage, showImgChooser, updateFormat, handleSort, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, createFilter, clearFilter, applyLocation, insertDuneChart } from "@fileverse-dev/fortune-core";
|
|
128
|
-
import { setSelection, getSelection } from "@fileverse-dev/fortune-core/
|
|
127
|
+
import { setSelection, getSelection } from "@fileverse-dev/fortune-core/src/api";
|
|
129
128
|
import _ from "lodash";
|
|
130
129
|
import { IconButton, LucideIcon, Tooltip, Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from "@fileverse/ui";
|
|
130
|
+
import DataVerificationPortal from "./dataVerificationPortal";
|
|
131
131
|
import WorkbookContext from "../../context";
|
|
132
132
|
import "./index.css";
|
|
133
133
|
import Button from "./Button";
|
|
@@ -33,7 +33,16 @@ var DropDownList = function DropDownList() {
|
|
|
33
33
|
var _f = (0, _react.useState)([]),
|
|
34
34
|
rbgColor = _f[0],
|
|
35
35
|
setRbgColor = _f[1];
|
|
36
|
-
var close = (0, _react.useCallback)(function () {
|
|
36
|
+
var close = (0, _react.useCallback)(function () {
|
|
37
|
+
setContext(function (ctx) {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
var index = (0, _fortuneCore.getSheetIndex)(ctx, ctx.currentSheetId);
|
|
40
|
+
var verification = context.luckysheetfile[index].dataVerification;
|
|
41
|
+
if (!verification["".concat((_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0].row_focus, "_").concat((_b = ctx.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0].column_focus)]) {
|
|
42
|
+
ctx.dataVerificationDropDownList = false;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}, [setContext]);
|
|
37
46
|
(0, _useOutsideClick.useOutsideClick)(containerRef, close, [close]);
|
|
38
47
|
(0, _react.useEffect)(function () {
|
|
39
48
|
var _a, _b;
|
|
@@ -242,11 +242,22 @@ var DynamicInputList = function DynamicInputList(_a) {
|
|
|
242
242
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
243
243
|
className: "flex flex-1 optionItems-center transition"
|
|
244
244
|
}, /*#__PURE__*/_react.default.createElement(_ui.TextField, {
|
|
245
|
+
type: "text",
|
|
246
|
+
onMouseDown: function onMouseDown(e) {
|
|
247
|
+
e.stopPropagation();
|
|
248
|
+
e.target.focus();
|
|
249
|
+
},
|
|
250
|
+
key: item.id,
|
|
251
|
+
onKeyDown: function onKeyDown(e) {
|
|
252
|
+
e.stopPropagation();
|
|
253
|
+
},
|
|
245
254
|
className: "w-full",
|
|
246
255
|
placeholder: "Option ".concat(index + 1),
|
|
247
256
|
value: item.value,
|
|
248
257
|
onChange: function onChange(e) {
|
|
249
|
-
|
|
258
|
+
e.stopPropagation();
|
|
259
|
+
handleChange(index, e.target.value);
|
|
260
|
+
e.target.focus();
|
|
250
261
|
},
|
|
251
262
|
"aria-label": "Option ".concat(index + 1)
|
|
252
263
|
})), optionItems.length > 1 && (/*#__PURE__*/_react.default.createElement(_ui.IconButton, {
|
|
@@ -93,14 +93,6 @@ var DataVerification = function DataVerification() {
|
|
|
93
93
|
}));
|
|
94
94
|
}
|
|
95
95
|
}, []);
|
|
96
|
-
var dataSelectRange = (0, _react.useCallback)(function (type, value) {
|
|
97
|
-
hideDialog();
|
|
98
|
-
setContext(function (ctx) {
|
|
99
|
-
ctx.rangeDialog.show = true;
|
|
100
|
-
ctx.rangeDialog.type = type;
|
|
101
|
-
ctx.rangeDialog.rangeTxt = value;
|
|
102
|
-
});
|
|
103
|
-
}, [hideDialog, setContext]);
|
|
104
96
|
var btn = (0, _react.useCallback)(function (type) {
|
|
105
97
|
if (type === "confirm") {
|
|
106
98
|
setContext(function (ctx) {
|
|
@@ -26,7 +26,8 @@ var __assign = void 0 && (void 0).__assign || function () {
|
|
|
26
26
|
var FormulaHint = function FormulaHint(props) {
|
|
27
27
|
var _a;
|
|
28
28
|
var showFormulaHint = props.showFormulaHint,
|
|
29
|
-
handleShowFormulaHint = props.handleShowFormulaHint
|
|
29
|
+
handleShowFormulaHint = props.handleShowFormulaHint,
|
|
30
|
+
commaCount = props.commaCount;
|
|
30
31
|
var dragHasMoved = (0, _react.useRef)(false);
|
|
31
32
|
var context = (0, _react.useContext)(_context.default).context;
|
|
32
33
|
var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
|
|
@@ -195,7 +196,10 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
195
196
|
return /*#__PURE__*/_react.default.createElement("code", {
|
|
196
197
|
className: "luckysheet-arguments-help-parameter font-family-mono mb-1 mt-2 color-text-default",
|
|
197
198
|
dir: "auto",
|
|
198
|
-
key: name
|
|
199
|
+
key: name,
|
|
200
|
+
style: {
|
|
201
|
+
backgroundColor: commaCount === i ? (fn === null || fn === void 0 ? void 0 : fn.BRAND_SECONDARY_COLOR) || "#FFDF0A" : "transparent"
|
|
202
|
+
}
|
|
199
203
|
}, name, i !== fn.p.length - 1 && ", ");
|
|
200
204
|
})), /*#__PURE__*/_react.default.createElement("code", {
|
|
201
205
|
className: "luckysheet-arguments-paren font-family-mono mb-1 mt-2 color-text-default"
|
|
@@ -363,12 +367,15 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
363
367
|
paddingTop: "16px"
|
|
364
368
|
},
|
|
365
369
|
className: "luckysheet-formula-help-content-param"
|
|
366
|
-
}, fn.p.map(function (param) {
|
|
370
|
+
}, fn.p.map(function (param, index) {
|
|
367
371
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
368
372
|
className: "",
|
|
369
373
|
key: param.name
|
|
370
374
|
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("code", {
|
|
371
|
-
className: "font-family-mono mb-1 mt-2 color-text-default font-family-mono"
|
|
375
|
+
className: "font-family-mono mb-1 mt-2 color-text-default font-family-mono",
|
|
376
|
+
style: {
|
|
377
|
+
backgroundColor: commaCount === index ? (fn === null || fn === void 0 ? void 0 : fn.BRAND_SECONDARY_COLOR) || "#FFDF0A" : "transparent"
|
|
378
|
+
}
|
|
372
379
|
}, param.name, param.repeat === "y" && (/*#__PURE__*/_react.default.createElement("span", {
|
|
373
380
|
className: "luckysheet-arguments-help-argument-info example-value",
|
|
374
381
|
style: {
|
|
@@ -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++) {
|
|
@@ -60,13 +60,16 @@ var InputBox = function InputBox() {
|
|
|
60
60
|
var _q = (0, _react.useState)({}),
|
|
61
61
|
firstSelectionActiveCell = _q[0],
|
|
62
62
|
setFirstSelectionActiveCell = _q[1];
|
|
63
|
+
var _r = (0, _react.useState)(0),
|
|
64
|
+
commaCount = _r[0],
|
|
65
|
+
setCommaCount = _r[1];
|
|
63
66
|
var hideFormulaHintLocal = localStorage.getItem("formulaMore") === "true";
|
|
64
|
-
var
|
|
65
|
-
showFormulaHint =
|
|
66
|
-
setShowFormulaHint =
|
|
67
|
-
var
|
|
68
|
-
showSearchHint =
|
|
69
|
-
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];
|
|
70
73
|
var row_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
|
|
71
74
|
var col_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
|
|
72
75
|
var preText = (0, _react.useRef)("");
|
|
@@ -251,6 +254,9 @@ var InputBox = function InputBox() {
|
|
|
251
254
|
var _a, _b;
|
|
252
255
|
lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
|
|
253
256
|
preText.current = inputRef.current.innerText;
|
|
257
|
+
var currentCommaCount = (0, _helper.countCommasBeforeCursor)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
258
|
+
console.log("currentCommaCount", currentCommaCount);
|
|
259
|
+
setCommaCount(currentCommaCount);
|
|
254
260
|
var allowListNavigation = true;
|
|
255
261
|
if ((e.key === "Delete" || e.key === "Backspace") && (0, _helper.getCursorPosition)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.innerText.length)) {
|
|
256
262
|
setTimeout(function () {
|
|
@@ -353,6 +359,8 @@ var InputBox = function InputBox() {
|
|
|
353
359
|
} else {
|
|
354
360
|
setShowSearchHint(false);
|
|
355
361
|
}
|
|
362
|
+
var currentCommaCount = (0, _helper.countCommasBeforeCursor)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
363
|
+
setCommaCount(currentCommaCount);
|
|
356
364
|
var e = lastKeyDownEventRef.current;
|
|
357
365
|
if (!e) return;
|
|
358
366
|
var kcode = e.keyCode;
|
|
@@ -496,6 +504,10 @@ var InputBox = function InputBox() {
|
|
|
496
504
|
minHeight: firstSelection.height
|
|
497
505
|
}, inputBoxStyle) : {}
|
|
498
506
|
}, /*#__PURE__*/_react.default.createElement(_ContentEditable.default, {
|
|
507
|
+
onMouseUp: function onMouseUp() {
|
|
508
|
+
var currentCommaCount = (0, _helper.countCommasBeforeCursor)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
509
|
+
setCommaCount(currentCommaCount);
|
|
510
|
+
},
|
|
499
511
|
innerRef: function innerRef(e) {
|
|
500
512
|
inputRef.current = e;
|
|
501
513
|
refs.cellInput.current = e;
|
|
@@ -529,7 +541,8 @@ var InputBox = function InputBox() {
|
|
|
529
541
|
}
|
|
530
542
|
})), 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, {
|
|
531
543
|
handleShowFormulaHint: handleShowFormulaHint,
|
|
532
|
-
showFormulaHint: showFormulaHint
|
|
544
|
+
showFormulaHint: showFormulaHint,
|
|
545
|
+
commaCount: commaCount
|
|
533
546
|
})), !showFormulaHint && fn && (/*#__PURE__*/_react.default.createElement(_ui.Tooltip, {
|
|
534
547
|
text: "Turn on formula suggestions (F10)",
|
|
535
548
|
placement: "top",
|
|
@@ -280,6 +280,26 @@ var useColumnDragAndDrop = exports.useColumnDragAndDrop = function useColumnDrag
|
|
|
280
280
|
}
|
|
281
281
|
});
|
|
282
282
|
});
|
|
283
|
+
if (_sheet.dataVerification) {
|
|
284
|
+
var newDataVerification_1 = {};
|
|
285
|
+
Object.keys(_sheet.dataVerification).forEach(function (item) {
|
|
286
|
+
var _a;
|
|
287
|
+
var itemData = (_a = _sheet.dataVerification) === null || _a === void 0 ? void 0 : _a[item];
|
|
288
|
+
var colRow = item.split("_");
|
|
289
|
+
if (colRow.length !== 2) return;
|
|
290
|
+
var presentcol = parseInt(colRow[1], 10);
|
|
291
|
+
var updatedCol = presentcol;
|
|
292
|
+
if (presentcol === sourceIndex_1) {
|
|
293
|
+
updatedCol = targetIndex;
|
|
294
|
+
} else if (presentcol > sourceIndex_1 && presentcol < targetIndex) {
|
|
295
|
+
updatedCol -= 1;
|
|
296
|
+
} else if (presentcol < sourceIndex_1 && presentcol >= targetIndex) {
|
|
297
|
+
updatedCol += 1;
|
|
298
|
+
}
|
|
299
|
+
newDataVerification_1["".concat(colRow[0], "_").concat(updatedCol)] = itemData;
|
|
300
|
+
});
|
|
301
|
+
_sheet.dataVerification = newDataVerification_1;
|
|
302
|
+
}
|
|
283
303
|
(_c = _sheet.calcChain) === null || _c === void 0 ? void 0 : _c.forEach(function (item) {
|
|
284
304
|
if (item.c === sourceIndex_1) {
|
|
285
305
|
item.c = targetIndex;
|
|
@@ -260,6 +260,26 @@ var useRowDragAndDrop = exports.useRowDragAndDrop = function useRowDragAndDrop(c
|
|
|
260
260
|
}
|
|
261
261
|
});
|
|
262
262
|
});
|
|
263
|
+
if (_sheet.dataVerification) {
|
|
264
|
+
var newDataVerification_1 = {};
|
|
265
|
+
Object.keys(_sheet.dataVerification).forEach(function (item) {
|
|
266
|
+
var _a;
|
|
267
|
+
var itemData = (_a = _sheet.dataVerification) === null || _a === void 0 ? void 0 : _a[item];
|
|
268
|
+
var colRow = item.split("_");
|
|
269
|
+
if (colRow.length !== 2) return;
|
|
270
|
+
var presentRow = parseInt(colRow[0], 10);
|
|
271
|
+
var updatedRow = presentRow;
|
|
272
|
+
if (presentRow === sourceIndex_1) {
|
|
273
|
+
updatedRow = targetIndex;
|
|
274
|
+
} else if (presentRow > sourceIndex_1 && presentRow < targetIndex) {
|
|
275
|
+
updatedRow -= 1;
|
|
276
|
+
} else if (presentRow < sourceIndex_1 && presentRow >= targetIndex) {
|
|
277
|
+
updatedRow += 1;
|
|
278
|
+
}
|
|
279
|
+
newDataVerification_1["".concat(updatedRow, "_").concat(colRow[1])] = itemData;
|
|
280
|
+
});
|
|
281
|
+
_sheet.dataVerification = newDataVerification_1;
|
|
282
|
+
}
|
|
263
283
|
(_a = _sheet.calcChain) === null || _a === void 0 ? void 0 : _a.forEach(function (item) {
|
|
264
284
|
if (item.r === sourceIndex_1) {
|
|
265
285
|
item.r = targetIndex;
|
|
@@ -6,3 +6,4 @@ export declare function incrementColumn(cell: string): string;
|
|
|
6
6
|
export declare function decrementColumn(cell: string): string;
|
|
7
7
|
export declare function incrementRow(cell: string): string;
|
|
8
8
|
export declare function decrementRow(cell: string): string;
|
|
9
|
+
export declare function countCommasBeforeCursor(editableDiv: HTMLDivElement): number;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.countCommasBeforeCursor = countCommasBeforeCursor;
|
|
6
7
|
exports.decrementColumn = decrementColumn;
|
|
7
8
|
exports.decrementRow = decrementRow;
|
|
8
9
|
exports.getCursorPosition = getCursorPosition;
|
|
@@ -96,4 +97,24 @@ function decrementRow(cell) {
|
|
|
96
97
|
if (!parsed) return "";
|
|
97
98
|
var newRowPart = Math.max(1, parsed.rowPart - 1);
|
|
98
99
|
return parsed.colPart + newRowPart;
|
|
100
|
+
}
|
|
101
|
+
function countCommasBeforeCursor(editableDiv) {
|
|
102
|
+
var selection = window.getSelection();
|
|
103
|
+
if (!(selection === null || selection === void 0 ? void 0 : selection.rangeCount)) return 0;
|
|
104
|
+
var range = selection.getRangeAt(0);
|
|
105
|
+
var preCaretRange = range.cloneRange();
|
|
106
|
+
preCaretRange.selectNodeContents(editableDiv);
|
|
107
|
+
preCaretRange.setEnd(range.endContainer, range.endOffset);
|
|
108
|
+
var textBeforeCursor = preCaretRange.toString();
|
|
109
|
+
var inQuotes = false;
|
|
110
|
+
var count = 0;
|
|
111
|
+
for (var i = 0; i < textBeforeCursor.length; i += 1) {
|
|
112
|
+
var char = textBeforeCursor[i];
|
|
113
|
+
if (char === '"') {
|
|
114
|
+
inQuotes = !inQuotes;
|
|
115
|
+
} else if (char === "," && !inQuotes) {
|
|
116
|
+
count += 1;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return count;
|
|
99
120
|
}
|
|
@@ -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" | "" | "ChevronDown" | "Undo" | "Redo" | "
|
|
4
|
+
export declare const getLucideIcon: (title: string) => "Ethereum" | "DollarSign" | "" | "ChevronDown" | "Undo" | "Redo" | "Underline" | "Border" | "Filter" | "Link" | "Search" | "Percent" | "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;
|
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.getLucideIcon = exports.default = exports.CurrencySelector = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _dataVerificationPortal = _interopRequireDefault(require("./dataVerificationPortal"));
|
|
10
9
|
var _fortuneCore = require("@fileverse-dev/fortune-core");
|
|
11
|
-
var _api = require("@fileverse-dev/fortune-core/
|
|
10
|
+
var _api = require("@fileverse-dev/fortune-core/src/api");
|
|
12
11
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
13
12
|
var _ui = require("@fileverse/ui");
|
|
13
|
+
var _dataVerificationPortal = _interopRequireDefault(require("./dataVerificationPortal"));
|
|
14
14
|
var _context = _interopRequireDefault(require("../../context"));
|
|
15
15
|
require("./index.css");
|
|
16
16
|
var _Button = _interopRequireDefault(require("./Button"));
|
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.99-patch-1",
|
|
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.99-patch-1",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-21",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|