@fileverse-dev/fortune-react 1.1.38 → 1.1.40

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.
@@ -9,7 +9,6 @@ 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";
13
12
  import React, { useContext, useEffect, useMemo, useRef, useCallback, useLayoutEffect, useState } from "react";
14
13
  import _ from "lodash";
15
14
  import WorkbookContext from "../../context";
@@ -17,7 +16,6 @@ import ContentEditable from "./ContentEditable";
17
16
  import FormulaSearch from "./FormulaSearch";
18
17
  import FormulaHint from "./FormulaHint";
19
18
  import usePrevious from "../../hooks/usePrevious";
20
- import { moveCursorToEnd, incrementColumn, decrementColumn, incrementRow, decrementRow } from "./helper";
21
19
  var InputBox = function InputBox() {
22
20
  var _a, _b, _c, _d, _e, _f;
23
21
  var _g = useContext(WorkbookContext),
@@ -34,28 +32,16 @@ var InputBox = function InputBox() {
34
32
  var _j = useState(false),
35
33
  isInputBoxActive = _j[0],
36
34
  setIsInputBoxActive = _j[1];
37
- var _k = useState(""),
38
- activeCell = _k[0],
39
- setActiveCell = _k[1];
40
- var _l = useState(""),
41
- activeRefCell = _l[0],
42
- setActiveRefCell = _l[1];
43
- var _m = useState({
35
+ var _k = useState({
44
36
  left: 0,
45
37
  top: 0
46
38
  }),
47
- frozenPosition = _m[0],
48
- setFrozenPosition = _m[1];
39
+ frozenPosition = _k[0],
40
+ setFrozenPosition = _k[1];
49
41
  var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
50
42
  var row_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
51
43
  var col_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
52
44
  var preText = useRef("");
53
- var placeRef = useRef("");
54
- useEffect(function () {
55
- if (isInputBoxActive) {
56
- setActiveCell(getCellAddress());
57
- }
58
- }, [isInputBoxActive]);
59
45
  var inputBoxStyle = useMemo(function () {
60
46
  if (firstSelection && context.luckysheetCellUpdate.length > 0) {
61
47
  var flowdata = getFlowdata(context);
@@ -201,53 +187,8 @@ var InputBox = function InputBox() {
201
187
  }
202
188
  }, [getActiveFormula, insertSelectedFormula]);
203
189
  var onKeyDown = useCallback(function (e) {
204
- var _a, _b;
205
190
  lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
206
191
  preText.current = inputRef.current.innerText;
207
- if (e.key === "Delete" || e.key === "Backspace") {
208
- setTimeout(function () {
209
- moveCursorToEnd(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
210
- }, 5);
211
- }
212
- var refCell = placeRef.current;
213
- if (e.key === "ArrowUp") {
214
- refCell = decrementRow(placeRef.current);
215
- } else if (e.key === "ArrowDown") {
216
- refCell = incrementRow(placeRef.current);
217
- } else if (e.key === "ArrowLeft") {
218
- refCell = decrementColumn(placeRef.current);
219
- } else if (e.key === "ArrowRight") {
220
- refCell = incrementColumn(placeRef.current);
221
- }
222
- if (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight") {
223
- var parser = new DOMParser();
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");
225
- var spans = doc.querySelectorAll("span");
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
- }
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)) {
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)) {
233
- return;
234
- }
235
- inputRef.current.innerHTML = "".concat(inputRef.current.innerHTML, "<span class=\"fortune-formula-functionrange-cell\" rangeindex=\"0\" dir=\"auto\" style=\"color:#c1232b;\">").concat(refCell, "</span>");
236
- setTimeout(function () {
237
- moveCursorToEnd(inputRef.current);
238
- }, 1);
239
- return;
240
- }
241
- if (isLetterNumberPattern(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
242
- var htmlR = removeLastSpan(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.innerHTML);
243
- inputRef.current.innerHTML = "".concat(htmlR, "<span class=\"fortune-formula-functionrange-cell\" rangeindex=\"0\" dir=\"auto\" style=\"color:#c1232b;\">").concat(refCell, "</span>");
244
- moveCursorToEnd(inputRef.current);
245
- setTimeout(function () {
246
- moveCursorToEnd(inputRef.current);
247
- }, 1);
248
- return;
249
- }
250
- }
251
192
  if (e.key === "Escape" && context.luckysheetCellUpdate.length > 0) {
252
193
  setContext(function (draftCtx) {
253
194
  cancelNormalSelected(draftCtx);
@@ -399,14 +340,6 @@ var InputBox = function InputBox() {
399
340
  var rowNumber = rowIndex + 1;
400
341
  return "".concat(columnChar).concat(rowNumber);
401
342
  }, [firstSelection]);
402
- var wraperGetCell = function wraperGetCell() {
403
- var cell = getCellAddress();
404
- placeRef.current = cell;
405
- if (activeRefCell !== cell) {
406
- setActiveRefCell(cell);
407
- }
408
- return activeCell || cell;
409
- };
410
343
  return /*#__PURE__*/React.createElement("div", {
411
344
  className: "luckysheet-input-box",
412
345
  style: getInputBoxPosition(),
@@ -419,7 +352,7 @@ var InputBox = function InputBox() {
419
352
  }, firstSelection && !((_f = context.rangeDialog) === null || _f === void 0 ? void 0 : _f.show) && (/*#__PURE__*/React.createElement("div", {
420
353
  className: "luckysheet-cell-address-indicator",
421
354
  style: getAddressIndicatorPosition()
422
- }, wraperGetCell())), /*#__PURE__*/React.createElement("div", {
355
+ }, getCellAddress())), /*#__PURE__*/React.createElement("div", {
423
356
  className: "luckysheet-input-box-inner",
424
357
  style: firstSelection ? __assign({
425
358
  minWidth: firstSelection.width,
@@ -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" | "" | "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";
4
+ export declare const getLucideIcon: (title: string) => "Ethereum" | "DollarSign" | "" | "ChevronDown" | "Undo" | "Redo" | "PaintRoller" | "Bold" | "Italic" | "Strikethrough" | "Underline" | "AlignLeft" | "AlignCenter" | "AlignRight" | "ArrowUpFromLine" | "AlignVerticalMiddle" | "ArrowDownToLine" | "TextOverflow" | "WrapText" | "TextClip" | "Baseline" | "PaintBucket" | "Border" | "MergeHorizontal" | "Percent" | "DecimalsArrowLeft" | "DecimalsArrowRight" | "PaintbrushVertical" | "Filter" | "Link" | "MessageSquarePlus" | "Image" | "Sigma" | "ShieldCheck" | "Search" | "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" | "mc" | "m" | "v" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
15
+ type?: "rt" | "m" | "v" | "mc" | "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" | "mc" | "m" | "v" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
22
+ type?: "rt" | "m" | "v" | "mc" | "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" | "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;
25
+ setCellFormat: (row: number, column: number, attr: "rt" | "m" | "v" | "mc" | "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" | "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;
56
+ setCellFormatByRange: (attr: "rt" | "m" | "v" | "mc" | "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,7 +6,6 @@ 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");
10
9
  var _react = _interopRequireWildcard(require("react"));
11
10
  var _lodash = _interopRequireDefault(require("lodash"));
12
11
  var _context = _interopRequireDefault(require("../../context"));
@@ -14,7 +13,6 @@ var _ContentEditable = _interopRequireDefault(require("./ContentEditable"));
14
13
  var _FormulaSearch = _interopRequireDefault(require("./FormulaSearch"));
15
14
  var _FormulaHint = _interopRequireDefault(require("./FormulaHint"));
16
15
  var _usePrevious = _interopRequireDefault(require("../../hooks/usePrevious"));
17
- var _helper = require("./helper");
18
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
17
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
20
18
  var __assign = void 0 && (void 0).__assign || function () {
@@ -43,28 +41,16 @@ var InputBox = function InputBox() {
43
41
  var _j = (0, _react.useState)(false),
44
42
  isInputBoxActive = _j[0],
45
43
  setIsInputBoxActive = _j[1];
46
- var _k = (0, _react.useState)(""),
47
- activeCell = _k[0],
48
- setActiveCell = _k[1];
49
- var _l = (0, _react.useState)(""),
50
- activeRefCell = _l[0],
51
- setActiveRefCell = _l[1];
52
- var _m = (0, _react.useState)({
44
+ var _k = (0, _react.useState)({
53
45
  left: 0,
54
46
  top: 0
55
47
  }),
56
- frozenPosition = _m[0],
57
- setFrozenPosition = _m[1];
48
+ frozenPosition = _k[0],
49
+ setFrozenPosition = _k[1];
58
50
  var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
59
51
  var row_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
60
52
  var col_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
61
53
  var preText = (0, _react.useRef)("");
62
- var placeRef = (0, _react.useRef)("");
63
- (0, _react.useEffect)(function () {
64
- if (isInputBoxActive) {
65
- setActiveCell(getCellAddress());
66
- }
67
- }, [isInputBoxActive]);
68
54
  var inputBoxStyle = (0, _react.useMemo)(function () {
69
55
  if (firstSelection && context.luckysheetCellUpdate.length > 0) {
70
56
  var flowdata = (0, _fortuneCore.getFlowdata)(context);
@@ -210,53 +196,8 @@ var InputBox = function InputBox() {
210
196
  }
211
197
  }, [getActiveFormula, insertSelectedFormula]);
212
198
  var onKeyDown = (0, _react.useCallback)(function (e) {
213
- var _a, _b;
214
199
  lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
215
200
  preText.current = inputRef.current.innerText;
216
- if (e.key === "Delete" || e.key === "Backspace") {
217
- setTimeout(function () {
218
- (0, _helper.moveCursorToEnd)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
219
- }, 5);
220
- }
221
- var refCell = placeRef.current;
222
- if (e.key === "ArrowUp") {
223
- refCell = (0, _helper.decrementRow)(placeRef.current);
224
- } else if (e.key === "ArrowDown") {
225
- refCell = (0, _helper.incrementRow)(placeRef.current);
226
- } else if (e.key === "ArrowLeft") {
227
- refCell = (0, _helper.decrementColumn)(placeRef.current);
228
- } else if (e.key === "ArrowRight") {
229
- refCell = (0, _helper.incrementColumn)(placeRef.current);
230
- }
231
- if (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight") {
232
- var parser = new DOMParser();
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");
234
- var spans = doc.querySelectorAll("span");
235
- var lastSpan = spans[spans.length - 1];
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)) {
242
- return;
243
- }
244
- inputRef.current.innerHTML = "".concat(inputRef.current.innerHTML, "<span class=\"fortune-formula-functionrange-cell\" rangeindex=\"0\" dir=\"auto\" style=\"color:#c1232b;\">").concat(refCell, "</span>");
245
- setTimeout(function () {
246
- (0, _helper.moveCursorToEnd)(inputRef.current);
247
- }, 1);
248
- return;
249
- }
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);
252
- inputRef.current.innerHTML = "".concat(htmlR, "<span class=\"fortune-formula-functionrange-cell\" rangeindex=\"0\" dir=\"auto\" style=\"color:#c1232b;\">").concat(refCell, "</span>");
253
- (0, _helper.moveCursorToEnd)(inputRef.current);
254
- setTimeout(function () {
255
- (0, _helper.moveCursorToEnd)(inputRef.current);
256
- }, 1);
257
- return;
258
- }
259
- }
260
201
  if (e.key === "Escape" && context.luckysheetCellUpdate.length > 0) {
261
202
  setContext(function (draftCtx) {
262
203
  (0, _fortuneCore.cancelNormalSelected)(draftCtx);
@@ -408,14 +349,6 @@ var InputBox = function InputBox() {
408
349
  var rowNumber = rowIndex + 1;
409
350
  return "".concat(columnChar).concat(rowNumber);
410
351
  }, [firstSelection]);
411
- var wraperGetCell = function wraperGetCell() {
412
- var cell = getCellAddress();
413
- placeRef.current = cell;
414
- if (activeRefCell !== cell) {
415
- setActiveRefCell(cell);
416
- }
417
- return activeCell || cell;
418
- };
419
352
  return /*#__PURE__*/_react.default.createElement("div", {
420
353
  className: "luckysheet-input-box",
421
354
  style: getInputBoxPosition(),
@@ -428,7 +361,7 @@ var InputBox = function InputBox() {
428
361
  }, firstSelection && !((_f = context.rangeDialog) === null || _f === void 0 ? void 0 : _f.show) && (/*#__PURE__*/_react.default.createElement("div", {
429
362
  className: "luckysheet-cell-address-indicator",
430
363
  style: getAddressIndicatorPosition()
431
- }, wraperGetCell())), /*#__PURE__*/_react.default.createElement("div", {
364
+ }, getCellAddress())), /*#__PURE__*/_react.default.createElement("div", {
432
365
  className: "luckysheet-input-box-inner",
433
366
  style: firstSelection ? __assign({
434
367
  minWidth: firstSelection.width,
@@ -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" | "" | "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";
4
+ export declare const getLucideIcon: (title: string) => "Ethereum" | "DollarSign" | "" | "ChevronDown" | "Undo" | "Redo" | "PaintRoller" | "Bold" | "Italic" | "Strikethrough" | "Underline" | "AlignLeft" | "AlignCenter" | "AlignRight" | "ArrowUpFromLine" | "AlignVerticalMiddle" | "ArrowDownToLine" | "TextOverflow" | "WrapText" | "TextClip" | "Baseline" | "PaintBucket" | "Border" | "MergeHorizontal" | "Percent" | "DecimalsArrowLeft" | "DecimalsArrowRight" | "PaintbrushVertical" | "Filter" | "Link" | "MessageSquarePlus" | "Image" | "Sigma" | "ShieldCheck" | "Search" | "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" | "mc" | "m" | "v" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
15
+ type?: "rt" | "m" | "v" | "mc" | "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" | "mc" | "m" | "v" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
22
+ type?: "rt" | "m" | "v" | "mc" | "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" | "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;
25
+ setCellFormat: (row: number, column: number, attr: "rt" | "m" | "v" | "mc" | "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" | "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;
56
+ setCellFormatByRange: (attr: "rt" | "m" | "v" | "mc" | "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.38",
3
+ "version": "1.1.40",
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.38",
19
+ "@fileverse-dev/fortune-core": "1.1.40",
20
20
  "@fileverse/ui": "^4.1.7-patch-21",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",
@@ -1,7 +0,0 @@
1
- export declare function moveCursorToEnd(editableDiv: HTMLDivElement): void;
2
- export declare function isLetterNumberPattern(str: string): boolean;
3
- export declare function removeLastSpan(htmlString: string): string;
4
- export declare function incrementColumn(cell: string): string;
5
- export declare function decrementColumn(cell: string): string;
6
- export declare function incrementRow(cell: string): string;
7
- export declare function decrementRow(cell: string): string;
@@ -1,77 +0,0 @@
1
- export function moveCursorToEnd(editableDiv) {
2
- editableDiv.focus();
3
- var range = document.createRange();
4
- var selection = window.getSelection();
5
- range.selectNodeContents(editableDiv);
6
- range.collapse(false);
7
- if (selection) {
8
- selection.removeAllRanges();
9
- selection.addRange(range);
10
- }
11
- }
12
- export function isLetterNumberPattern(str) {
13
- var regex = /^[a-zA-Z]\d+$/;
14
- return regex.test(str);
15
- }
16
- export function removeLastSpan(htmlString) {
17
- var container = document.createElement("div");
18
- container.innerHTML = htmlString;
19
- var spans = container.querySelectorAll("span");
20
- if (spans.length > 0) {
21
- var lastSpan = spans[spans.length - 1];
22
- lastSpan.remove();
23
- }
24
- return container.innerHTML;
25
- }
26
- function parseCell(input) {
27
- var match = input.match(/^([A-Z]+)(\d+)$/i);
28
- if (!match) return null;
29
- return {
30
- colPart: match[1].toUpperCase(),
31
- rowPart: parseInt(match[2], 10)
32
- };
33
- }
34
- function columnToNumber(colPart) {
35
- var colNumber = 0;
36
- for (var i = 0; i < colPart.length; i++) {
37
- colNumber = colNumber * 26 + (colPart.charCodeAt(i) - 64);
38
- }
39
- return colNumber;
40
- }
41
- function numberToColumn(colNumber) {
42
- var colPart = "";
43
- while (colNumber > 0) {
44
- colNumber--;
45
- colPart = String.fromCharCode(65 + colNumber % 26) + colPart;
46
- colNumber = Math.floor(colNumber / 26);
47
- }
48
- return colPart;
49
- }
50
- export function incrementColumn(cell) {
51
- var parsed = parseCell(cell);
52
- if (!parsed) return "";
53
- var colNumber = columnToNumber(parsed.colPart);
54
- colNumber += 1;
55
- var newColPart = numberToColumn(colNumber);
56
- return newColPart + parsed.rowPart;
57
- }
58
- export function decrementColumn(cell) {
59
- var parsed = parseCell(cell);
60
- if (!parsed) return "";
61
- var colNumber = columnToNumber(parsed.colPart);
62
- colNumber = Math.max(1, colNumber - 1);
63
- var newColPart = numberToColumn(colNumber);
64
- return newColPart + parsed.rowPart;
65
- }
66
- export function incrementRow(cell) {
67
- var parsed = parseCell(cell);
68
- if (!parsed) return "";
69
- var newRowPart = parsed.rowPart + 1;
70
- return parsed.colPart + newRowPart;
71
- }
72
- export function decrementRow(cell) {
73
- var parsed = parseCell(cell);
74
- if (!parsed) return "";
75
- var newRowPart = Math.max(1, parsed.rowPart - 1);
76
- return parsed.colPart + newRowPart;
77
- }
@@ -1,7 +0,0 @@
1
- export declare function moveCursorToEnd(editableDiv: HTMLDivElement): void;
2
- export declare function isLetterNumberPattern(str: string): boolean;
3
- export declare function removeLastSpan(htmlString: string): string;
4
- export declare function incrementColumn(cell: string): string;
5
- export declare function decrementColumn(cell: string): string;
6
- export declare function incrementRow(cell: string): string;
7
- export declare function decrementRow(cell: string): string;
@@ -1,89 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.decrementColumn = decrementColumn;
7
- exports.decrementRow = decrementRow;
8
- exports.incrementColumn = incrementColumn;
9
- exports.incrementRow = incrementRow;
10
- exports.isLetterNumberPattern = isLetterNumberPattern;
11
- exports.moveCursorToEnd = moveCursorToEnd;
12
- exports.removeLastSpan = removeLastSpan;
13
- function moveCursorToEnd(editableDiv) {
14
- editableDiv.focus();
15
- var range = document.createRange();
16
- var selection = window.getSelection();
17
- range.selectNodeContents(editableDiv);
18
- range.collapse(false);
19
- if (selection) {
20
- selection.removeAllRanges();
21
- selection.addRange(range);
22
- }
23
- }
24
- function isLetterNumberPattern(str) {
25
- var regex = /^[a-zA-Z]\d+$/;
26
- return regex.test(str);
27
- }
28
- function removeLastSpan(htmlString) {
29
- var container = document.createElement("div");
30
- container.innerHTML = htmlString;
31
- var spans = container.querySelectorAll("span");
32
- if (spans.length > 0) {
33
- var lastSpan = spans[spans.length - 1];
34
- lastSpan.remove();
35
- }
36
- return container.innerHTML;
37
- }
38
- function parseCell(input) {
39
- var match = input.match(/^([A-Z]+)(\d+)$/i);
40
- if (!match) return null;
41
- return {
42
- colPart: match[1].toUpperCase(),
43
- rowPart: parseInt(match[2], 10)
44
- };
45
- }
46
- function columnToNumber(colPart) {
47
- var colNumber = 0;
48
- for (var i = 0; i < colPart.length; i++) {
49
- colNumber = colNumber * 26 + (colPart.charCodeAt(i) - 64);
50
- }
51
- return colNumber;
52
- }
53
- function numberToColumn(colNumber) {
54
- var colPart = "";
55
- while (colNumber > 0) {
56
- colNumber--;
57
- colPart = String.fromCharCode(65 + colNumber % 26) + colPart;
58
- colNumber = Math.floor(colNumber / 26);
59
- }
60
- return colPart;
61
- }
62
- function incrementColumn(cell) {
63
- var parsed = parseCell(cell);
64
- if (!parsed) return "";
65
- var colNumber = columnToNumber(parsed.colPart);
66
- colNumber += 1;
67
- var newColPart = numberToColumn(colNumber);
68
- return newColPart + parsed.rowPart;
69
- }
70
- function decrementColumn(cell) {
71
- var parsed = parseCell(cell);
72
- if (!parsed) return "";
73
- var colNumber = columnToNumber(parsed.colPart);
74
- colNumber = Math.max(1, colNumber - 1);
75
- var newColPart = numberToColumn(colNumber);
76
- return newColPart + parsed.rowPart;
77
- }
78
- function incrementRow(cell) {
79
- var parsed = parseCell(cell);
80
- if (!parsed) return "";
81
- var newRowPart = parsed.rowPart + 1;
82
- return parsed.colPart + newRowPart;
83
- }
84
- function decrementRow(cell) {
85
- var parsed = parseCell(cell);
86
- if (!parsed) return "";
87
- var newRowPart = Math.max(1, parsed.rowPart - 1);
88
- return parsed.colPart + newRowPart;
89
- }