@fileverse-dev/fortune-react 1.0.2-mod-89-patch-006 → 1.0.2-mod-93

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.
@@ -88,6 +88,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
88
88
  luckysheet_conditionformat_save?: any[] | undefined;
89
89
  luckysheet_alternateformat_save?: any[] | undefined;
90
90
  dataVerification?: any;
91
+ conditionRules?: import("@fileverse-dev/fortune-core").ConditionRulesProps | undefined;
91
92
  hyperlink?: Record<string, {
92
93
  linkType: string;
93
94
  linkAddress: string;
@@ -95,6 +95,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
95
95
  luckysheet_conditionformat_save?: any[] | undefined;
96
96
  luckysheet_alternateformat_save?: any[] | undefined;
97
97
  dataVerification?: any;
98
+ conditionRules?: import("@fileverse-dev/fortune-core").ConditionRulesProps | undefined;
98
99
  hyperlink?: Record<string, {
99
100
  linkType: string;
100
101
  linkAddress: string;
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defaultContext, defaultSettings, getSheetIndex, colLocationByIndex, fixPositionOnFrozenCells, colLocation, getFlowdata, isAllowEdit, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColFreezeHandleMouseDown, selectTitlesMap, selectTitlesRange, fixColumnStyleOverflowInFreeze, rowLocationByIndex, rowLocation, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleRowFreezeHandleMouseDown, handleContextMenu, fixRowStyleOverflowInFreeze, locale, getStyleByCell, getCellValue, createRangeHightlight, isInlineStringCell, getInlineStringHTML, valueShowEs, escapeHTMLTag, escapeScriptTag, moveToEnd, isShowHidenCR, getrangeseleciton, cancelNormalSelected, moveHighlightCell, israngeseleciton, handleFormulaInput, onSearchDialogMoveStart, replaceAll, replace, searchAll, searchNext, normalizeSelection, scrollToHighlightCell, isLinkValid, goToLink, replaceHtml, removeHyperlink, saveHyperlink, createFilterOptions, onImageMoveStart, onImageResizeStart, showComments, setEditingComment, onCommentBoxMoveStart, confirmMessage, getRangeByTxt, getDropdownList, setCellValue, getRangetxt, setConditionRules, mergeBorder, setDropdownValue, onIframeMoveStart, onIframeResizeStart, saveIframe, onIframeMove, onIframeMoveEnd, onIframeResize, onIframeResizeEnd, handleCellAreaMouseDown, handleCellAreaDoubleClick, selectAll, showLinkCard, getCellRowColumn, getCellHyperlink, handleOverlayMouseMove, handleOverlayMouseUp, handleKeydownForZoom, handleOverlayTouchStart, handleOverlayTouchMove, handleOverlayTouchEnd, insertRowCol, drawArrow, onCellsMoveStart, createDropCellRange, updateContextWithSheetData, updateContextWithCanvas, initFreeze, Canvas, handleGlobalWheel, getDataArr, updateMoreCell, getRegStr, getOptionValue, getSelectRange, applyLocation, updateItem, update, sanitizeDuneUrl, normalizedCellAttr, updateFormat, handleTextSize, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, showImgChooser, insertImage, editComment, deleteComment, showHideComment, showHideAllComments, newComment, handleSum, autoSelectionFormula, handleMerge, handleBorder, handleFreeze, handleSort, createFilter, clearFilter, toolbarItemSelectedFunc, toolbarItemClickHandler, insertDuneChart, handleTextColor, handleTextBackground, getInlineStringNoStyle, rangeHightlightselected, updateCell, editSheetName, cancelActiveImgItem, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, api, getFreezeState, toggleFreeze, jfrefreshgrid, handleCopy, removeActiveImage, deleteSelectedCellText, deleteRowCol, hideSelected, showSelected, sortSelection, handleLink, handlePasteByClick, deleteSheet, opToPatch, setCaretPosition, orderbydatafiler, getFilterColumnValues, getFilterColumnColors, saveFilter, calcSelectionInfo, patchToOp, filterPatch, inverseRowColOptions, ensureSheetIndex, initSheetIndex, handleGlobalKeyDown, handlePaste, groupValuesRefresh } from '@fileverse-dev/fortune-core';
1
+ import { defaultContext, defaultSettings, getSheetIndex, colLocationByIndex, fixPositionOnFrozenCells, colLocation, getFlowdata, isAllowEdit, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColFreezeHandleMouseDown, selectTitlesMap, selectTitlesRange, fixColumnStyleOverflowInFreeze, rowLocationByIndex, rowLocation, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleRowFreezeHandleMouseDown, handleContextMenu, fixRowStyleOverflowInFreeze, locale, getStyleByCell, getCellValue, createRangeHightlight, isInlineStringCell, getInlineStringHTML, valueShowEs, escapeHTMLTag, escapeScriptTag, moveToEnd, isShowHidenCR, getrangeseleciton, cancelNormalSelected, moveHighlightCell, israngeseleciton, handleFormulaInput, onSearchDialogMoveStart, replaceAll, replace, searchAll, searchNext, normalizeSelection, scrollToHighlightCell, isLinkValid, goToLink, replaceHtml, removeHyperlink, saveHyperlink, createFilterOptions, onImageMoveStart, onImageResizeStart, showComments, setEditingComment, onCommentBoxMoveStart, confirmMessage, getRangeByTxt, getDropdownList, setCellValue, getRangetxt, setConditionRules, mergeBorder, setDropdownValue, onIframeMoveStart, onIframeResizeStart, onIframeMove, onIframeMoveEnd, onIframeResize, onIframeResizeEnd, handleCellAreaMouseDown, handleCellAreaDoubleClick, selectAll, showLinkCard, getCellRowColumn, getCellHyperlink, handleOverlayMouseMove, handleOverlayMouseUp, handleKeydownForZoom, handleOverlayTouchStart, handleOverlayTouchMove, handleOverlayTouchEnd, insertRowCol, drawArrow, onCellsMoveStart, createDropCellRange, updateContextWithSheetData, updateContextWithCanvas, initFreeze, Canvas, handleGlobalWheel, getDataArr, updateMoreCell, getRegStr, getOptionValue, getSelectRange, applyLocation, updateItem, update, sanitizeDuneUrl, normalizedCellAttr, updateFormat, handleTextSize, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, showImgChooser, insertImage, editComment, deleteComment, showHideComment, showHideAllComments, newComment, handleSum, autoSelectionFormula, handleMerge, handleBorder, handleFreeze, handleSort, createFilter, clearFilter, toolbarItemSelectedFunc, toolbarItemClickHandler, insertDuneChart, handleTextColor, handleTextBackground, getInlineStringNoStyle, rangeHightlightselected, updateCell, editSheetName, cancelActiveImgItem, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, api, getFreezeState, toggleFreeze, jfrefreshgrid, handleCopy, removeActiveImage, deleteSelectedCellText, deleteRowCol, hideSelected, showSelected, sortSelection, handleLink, handlePasteByClick, deleteSheet, opToPatch, setCaretPosition, orderbydatafiler, getFilterColumnValues, getFilterColumnColors, saveFilter, calcSelectionInfo, patchToOp, filterPatch, inverseRowColOptions, ensureSheetIndex, initSheetIndex, handleGlobalKeyDown, handlePaste, groupValuesRefresh } from '@fileverse-dev/fortune-core';
2
2
  export { PROMOTED_CRYPTO_FUNCTIONS } from '@fileverse-dev/fortune-core';
3
3
  import { SERVICE_API_KEY } from '@fileverse-dev/formulajs/crypto-constants';
4
4
  export * from '@fileverse-dev/formulajs/crypto-constants';
@@ -813,8 +813,8 @@ var FormulaSearch = function FormulaSearch(props) {
813
813
  top = _useState2[0],
814
814
  setTop = _useState2[1];
815
815
  var calcuatePopUpPlacement = function calcuatePopUpPlacement() {
816
- var _hintRef$current;
817
- if (!(firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.top) || !firstSelection.height_move || !hintRef.current) return;
816
+ var _firstSelection$top, _firstSelection$heigh, _hintRef$current;
817
+ if (!(firstSelection === null || firstSelection === void 0 ? void 0 : (_firstSelection$top = firstSelection.top) === null || _firstSelection$top === void 0 ? void 0 : _firstSelection$top.toString()) || !((_firstSelection$heigh = firstSelection.height_move) === null || _firstSelection$heigh === void 0 ? void 0 : _firstSelection$heigh.toString()) || !hintRef.current) return;
818
818
  var hintHeight = 360;
819
819
  var inputBottom = firstSelection.top + firstSelection.height_move;
820
820
  var availableBelow = window.innerHeight - inputBottom;
@@ -1046,8 +1046,8 @@ var FormulaHint = function FormulaHint(props) {
1046
1046
  top = _useState0[0],
1047
1047
  setTop = _useState0[1];
1048
1048
  var calcuatePopUpPlacement = function calcuatePopUpPlacement() {
1049
- var _hintRef$current;
1050
- if (!(firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.top) || !firstSelection.height_move || !hintRef.current) return;
1049
+ var _firstSelection$top, _firstSelection$heigh, _hintRef$current;
1050
+ if (!(firstSelection === null || firstSelection === void 0 ? void 0 : (_firstSelection$top = firstSelection.top) === null || _firstSelection$top === void 0 ? void 0 : _firstSelection$top.toString()) || !((_firstSelection$heigh = firstSelection.height_move) === null || _firstSelection$heigh === void 0 ? void 0 : _firstSelection$heigh.toString()) || !hintRef.current) return;
1051
1051
  var hintHeight = 360;
1052
1052
  var inputBottom = firstSelection.top + firstSelection.height_move;
1053
1053
  var availableBelow = window.innerHeight - inputBottom;
@@ -1436,32 +1436,44 @@ var InputBox = function InputBox() {
1436
1436
  return document.querySelector(".luckysheet-formula-search-item-active");
1437
1437
  }, []);
1438
1438
  var insertSelectedFormula = useCallback(function (formulaName) {
1439
- var _getrangeseleciton;
1439
+ var _selection, _getrangeseleciton;
1440
1440
  var textEditor = document.getElementById("luckysheet-rich-text-editor");
1441
1441
  if (!textEditor) return;
1442
- var searchTxt = ((_getrangeseleciton = getrangeseleciton()) === null || _getrangeseleciton === void 0 ? void 0 : _getrangeseleciton.textContent) || "";
1443
- var deleteCount = searchTxt === "=" ? 0 : searchTxt.length;
1444
1442
  textEditor.focus();
1445
1443
  var selection = window.getSelection();
1446
- if (!selection || selection.rangeCount === 0) return;
1447
- var range = selection.getRangeAt(0);
1448
- if (deleteCount !== 0 && range) {
1444
+ var range = ((_selection = selection) === null || _selection === void 0 ? void 0 : _selection.rangeCount) ? selection.getRangeAt(0) : null;
1445
+ if (!selection || !range || !textEditor.contains(range.startContainer)) {
1446
+ var _selection2, _selection3;
1447
+ range = document.createRange();
1448
+ range.selectNodeContents(textEditor);
1449
+ range.collapse(false);
1450
+ selection = window.getSelection();
1451
+ (_selection2 = selection) === null || _selection2 === void 0 ? void 0 : _selection2.removeAllRanges();
1452
+ (_selection3 = selection) === null || _selection3 === void 0 ? void 0 : _selection3.addRange(range);
1453
+ }
1454
+ var searchTxt = ((_getrangeseleciton = getrangeseleciton()) === null || _getrangeseleciton === void 0 ? void 0 : _getrangeseleciton.textContent) || "";
1455
+ var deleteCount = searchTxt === "=" ? 0 : searchTxt.length;
1456
+ if (deleteCount > 0 && range.startContainer.nodeType === Node.TEXT_NODE && textEditor.contains(range.startContainer)) {
1449
1457
  var startOffset = Math.max(range.startOffset - deleteCount, 0);
1450
1458
  var endOffset = range.startOffset;
1451
1459
  range.setStart(range.startContainer, startOffset);
1452
1460
  range.setEnd(range.startContainer, endOffset);
1453
1461
  range.deleteContents();
1454
1462
  }
1463
+ textEditor.querySelectorAll(".luckysheet-formula-text-func, .luckysheet-formula-text-lpar").forEach(function (el) {
1464
+ return el.remove();
1465
+ });
1455
1466
  var funcNode = new DOMParser().parseFromString("<span dir=\"auto\" class=\"luckysheet-formula-text-func\">".concat(formulaName, "</span>"), "text/html").body.firstChild;
1456
1467
  var parNode = new DOMParser().parseFromString("<span dir=\"auto\" class=\"luckysheet-formula-text-lpar\">(</span>", "text/html").body.firstChild;
1457
- if (range === null || range === void 0 ? void 0 : range.startContainer.parentNode) {
1458
- range.setStart(range.startContainer.parentNode, 1);
1459
- }
1460
- if (parNode) range.insertNode(parNode);
1461
- if (funcNode) range.insertNode(funcNode);
1462
- range.collapse();
1463
- selection.removeAllRanges();
1464
- selection.addRange(range);
1468
+ if (range && parNode && funcNode) {
1469
+ var _selection4, _selection5;
1470
+ range.insertNode(funcNode);
1471
+ range.collapse(false);
1472
+ range.insertNode(parNode);
1473
+ range.collapse(false);
1474
+ (_selection4 = selection) === null || _selection4 === void 0 ? void 0 : _selection4.removeAllRanges();
1475
+ (_selection5 = selection) === null || _selection5 === void 0 ? void 0 : _selection5.addRange(range);
1476
+ }
1465
1477
  setContext(function (draftCtx) {
1466
1478
  draftCtx.functionCandidates = [];
1467
1479
  draftCtx.defaultCandidates = [];
@@ -1543,11 +1555,16 @@ var InputBox = function InputBox() {
1543
1555
  e.preventDefault();
1544
1556
  }
1545
1557
  }, [clearSearchItemActiveClass, context.luckysheetCellUpdate.length, selectActiveFormula, setContext, firstSelection]);
1558
+ var _useState3 = useState(false),
1559
+ _useState4 = _slicedToArray(_useState3, 2),
1560
+ showCrypoModal = _useState4[0],
1561
+ setShowCryptoModal = _useState4[1];
1546
1562
  var onChange = useCallback(function (__, isBlur) {
1547
1563
  var e = lastKeyDownEventRef.current;
1548
1564
  if (!e) return;
1549
1565
  var kcode = e.keyCode;
1550
1566
  if (!kcode) return;
1567
+ setShowCryptoModal(!document.getElementById("luckysheet-formula-search-c"));
1551
1568
  if (!(kcode >= 112 && kcode <= 123 || kcode <= 46 || kcode === 144 || kcode === 108 || e.ctrlKey || e.altKey || e.shiftKey && (kcode === 37 || kcode === 38 || kcode === 39 || kcode === 40)) || kcode === 8 || kcode === 32 || kcode === 46 || e.ctrlKey && kcode === 86) {
1552
1569
  setContext(function (draftCtx) {
1553
1570
  if ((draftCtx.formulaCache.rangestart || draftCtx.formulaCache.rangedrag_column_start || draftCtx.formulaCache.rangedrag_row_start || israngeseleciton(draftCtx)) && isBlur) return;
@@ -1609,7 +1626,7 @@ var InputBox = function InputBox() {
1609
1626
  onKeyDown: onKeyDown,
1610
1627
  onPaste: onPaste,
1611
1628
  allowEdit: edit ? !isHidenRC : edit
1612
- })), (context.functionCandidates.length > 0 || context.functionHint || context.defaultCandidates.length > 0) && (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormulaSearch, {
1629
+ })), (context.functionCandidates.length > 0 || context.functionHint || context.defaultCandidates.length > 0) && showCrypoModal && (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormulaSearch, {
1613
1630
  onMouseOver: function onMouseOver(e) {
1614
1631
  if (document.getElementById("luckysheet-formula-search-c")) {
1615
1632
  var hoveredItem = e.target.closest(".luckysheet-formula-search-item");
@@ -3383,7 +3400,10 @@ var ConditionRules = function ConditionRules(_ref) {
3383
3400
  }, conditionformat.applyRange), /*#__PURE__*/React.createElement(TextField, {
3384
3401
  rightIcon: /*#__PURE__*/React.createElement(LucideIcon, {
3385
3402
  name: "Grid2x2",
3386
- size: "sm"
3403
+ size: "sm",
3404
+ onClick: function onClick() {
3405
+ dataSelectRange("conditionRules".concat(type));
3406
+ }
3387
3407
  }),
3388
3408
  "aria-hidden": "true",
3389
3409
  readOnly: true,
@@ -3846,7 +3866,6 @@ var IframeBoxs = function IframeBoxs() {
3846
3866
  });
3847
3867
  }
3848
3868
  ctx.activeIframe = undefined;
3849
- saveIframe(ctx);
3850
3869
  });
3851
3870
  },
3852
3871
  variant: "ghost",
@@ -5471,14 +5490,14 @@ var FormatSearch = function FormatSearch(_ref) {
5471
5490
  var index = getSheetIndex(ctx, ctx.currentSheetId);
5472
5491
  if (_.isNil(index)) return;
5473
5492
  var selectedFormat = toolbarFormat[selectedFormatIndex].value;
5493
+ var formatString = "".concat(selectedFormat, "#,##0.").concat("0".repeat(decimalPlace));
5474
5494
  _.forEach(ctx.luckysheet_select_save, function (selection) {
5475
5495
  for (var r = selection.row[0]; r <= selection.row[1]; r += 1) {
5476
5496
  for (var c = selection.column[0]; c <= selection.column[1]; c += 1) {
5477
5497
  var _ctx$luckysheetfile$i, _ctx$luckysheetfile$i2, _ctx$luckysheetfile$i3, _ctx$luckysheetfile$i4;
5478
5498
  if (((_ctx$luckysheetfile$i = ctx.luckysheetfile[index].data) === null || _ctx$luckysheetfile$i === void 0 ? void 0 : _ctx$luckysheetfile$i[r][c]) && ((_ctx$luckysheetfile$i2 = ctx.luckysheetfile[index].data) === null || _ctx$luckysheetfile$i2 === void 0 ? void 0 : (_ctx$luckysheetfile$i3 = _ctx$luckysheetfile$i2[r][c]) === null || _ctx$luckysheetfile$i3 === void 0 ? void 0 : (_ctx$luckysheetfile$i4 = _ctx$luckysheetfile$i3.ct) === null || _ctx$luckysheetfile$i4 === void 0 ? void 0 : _ctx$luckysheetfile$i4.t) === "n") {
5479
- var zero = 0;
5480
- ctx.luckysheetfile[index].data[r][c].ct.fa = "".concat(selectedFormat).concat(zero.toFixed(decimalPlace));
5481
- ctx.luckysheetfile[index].data[r][c].m = update("".concat(selectedFormat).concat(zero.toFixed(decimalPlace)), ctx.luckysheetfile[index].data[r][c].v);
5499
+ ctx.luckysheetfile[index].data[r][c].ct.fa = formatString;
5500
+ ctx.luckysheetfile[index].data[r][c].m = update(formatString, ctx.luckysheetfile[index].data[r][c].v);
5482
5501
  }
5483
5502
  }
5484
5503
  }
package/dist/index.js CHANGED
@@ -823,8 +823,8 @@ var FormulaSearch = function FormulaSearch(props) {
823
823
  top = _useState2[0],
824
824
  setTop = _useState2[1];
825
825
  var calcuatePopUpPlacement = function calcuatePopUpPlacement() {
826
- var _hintRef$current;
827
- if (!(firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.top) || !firstSelection.height_move || !hintRef.current) return;
826
+ var _firstSelection$top, _firstSelection$heigh, _hintRef$current;
827
+ if (!(firstSelection === null || firstSelection === void 0 ? void 0 : (_firstSelection$top = firstSelection.top) === null || _firstSelection$top === void 0 ? void 0 : _firstSelection$top.toString()) || !((_firstSelection$heigh = firstSelection.height_move) === null || _firstSelection$heigh === void 0 ? void 0 : _firstSelection$heigh.toString()) || !hintRef.current) return;
828
828
  var hintHeight = 360;
829
829
  var inputBottom = firstSelection.top + firstSelection.height_move;
830
830
  var availableBelow = window.innerHeight - inputBottom;
@@ -1056,8 +1056,8 @@ var FormulaHint = function FormulaHint(props) {
1056
1056
  top = _useState0[0],
1057
1057
  setTop = _useState0[1];
1058
1058
  var calcuatePopUpPlacement = function calcuatePopUpPlacement() {
1059
- var _hintRef$current;
1060
- if (!(firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.top) || !firstSelection.height_move || !hintRef.current) return;
1059
+ var _firstSelection$top, _firstSelection$heigh, _hintRef$current;
1060
+ if (!(firstSelection === null || firstSelection === void 0 ? void 0 : (_firstSelection$top = firstSelection.top) === null || _firstSelection$top === void 0 ? void 0 : _firstSelection$top.toString()) || !((_firstSelection$heigh = firstSelection.height_move) === null || _firstSelection$heigh === void 0 ? void 0 : _firstSelection$heigh.toString()) || !hintRef.current) return;
1061
1061
  var hintHeight = 360;
1062
1062
  var inputBottom = firstSelection.top + firstSelection.height_move;
1063
1063
  var availableBelow = window.innerHeight - inputBottom;
@@ -1446,32 +1446,44 @@ var InputBox = function InputBox() {
1446
1446
  return document.querySelector(".luckysheet-formula-search-item-active");
1447
1447
  }, []);
1448
1448
  var insertSelectedFormula = React.useCallback(function (formulaName) {
1449
- var _getrangeseleciton;
1449
+ var _selection, _getrangeseleciton;
1450
1450
  var textEditor = document.getElementById("luckysheet-rich-text-editor");
1451
1451
  if (!textEditor) return;
1452
- var searchTxt = ((_getrangeseleciton = fortuneCore.getrangeseleciton()) === null || _getrangeseleciton === void 0 ? void 0 : _getrangeseleciton.textContent) || "";
1453
- var deleteCount = searchTxt === "=" ? 0 : searchTxt.length;
1454
1452
  textEditor.focus();
1455
1453
  var selection = window.getSelection();
1456
- if (!selection || selection.rangeCount === 0) return;
1457
- var range = selection.getRangeAt(0);
1458
- if (deleteCount !== 0 && range) {
1454
+ var range = ((_selection = selection) === null || _selection === void 0 ? void 0 : _selection.rangeCount) ? selection.getRangeAt(0) : null;
1455
+ if (!selection || !range || !textEditor.contains(range.startContainer)) {
1456
+ var _selection2, _selection3;
1457
+ range = document.createRange();
1458
+ range.selectNodeContents(textEditor);
1459
+ range.collapse(false);
1460
+ selection = window.getSelection();
1461
+ (_selection2 = selection) === null || _selection2 === void 0 ? void 0 : _selection2.removeAllRanges();
1462
+ (_selection3 = selection) === null || _selection3 === void 0 ? void 0 : _selection3.addRange(range);
1463
+ }
1464
+ var searchTxt = ((_getrangeseleciton = fortuneCore.getrangeseleciton()) === null || _getrangeseleciton === void 0 ? void 0 : _getrangeseleciton.textContent) || "";
1465
+ var deleteCount = searchTxt === "=" ? 0 : searchTxt.length;
1466
+ if (deleteCount > 0 && range.startContainer.nodeType === Node.TEXT_NODE && textEditor.contains(range.startContainer)) {
1459
1467
  var startOffset = Math.max(range.startOffset - deleteCount, 0);
1460
1468
  var endOffset = range.startOffset;
1461
1469
  range.setStart(range.startContainer, startOffset);
1462
1470
  range.setEnd(range.startContainer, endOffset);
1463
1471
  range.deleteContents();
1464
1472
  }
1473
+ textEditor.querySelectorAll(".luckysheet-formula-text-func, .luckysheet-formula-text-lpar").forEach(function (el) {
1474
+ return el.remove();
1475
+ });
1465
1476
  var funcNode = new DOMParser().parseFromString("<span dir=\"auto\" class=\"luckysheet-formula-text-func\">".concat(formulaName, "</span>"), "text/html").body.firstChild;
1466
1477
  var parNode = new DOMParser().parseFromString("<span dir=\"auto\" class=\"luckysheet-formula-text-lpar\">(</span>", "text/html").body.firstChild;
1467
- if (range === null || range === void 0 ? void 0 : range.startContainer.parentNode) {
1468
- range.setStart(range.startContainer.parentNode, 1);
1469
- }
1470
- if (parNode) range.insertNode(parNode);
1471
- if (funcNode) range.insertNode(funcNode);
1472
- range.collapse();
1473
- selection.removeAllRanges();
1474
- selection.addRange(range);
1478
+ if (range && parNode && funcNode) {
1479
+ var _selection4, _selection5;
1480
+ range.insertNode(funcNode);
1481
+ range.collapse(false);
1482
+ range.insertNode(parNode);
1483
+ range.collapse(false);
1484
+ (_selection4 = selection) === null || _selection4 === void 0 ? void 0 : _selection4.removeAllRanges();
1485
+ (_selection5 = selection) === null || _selection5 === void 0 ? void 0 : _selection5.addRange(range);
1486
+ }
1475
1487
  setContext(function (draftCtx) {
1476
1488
  draftCtx.functionCandidates = [];
1477
1489
  draftCtx.defaultCandidates = [];
@@ -1553,11 +1565,16 @@ var InputBox = function InputBox() {
1553
1565
  e.preventDefault();
1554
1566
  }
1555
1567
  }, [clearSearchItemActiveClass, context.luckysheetCellUpdate.length, selectActiveFormula, setContext, firstSelection]);
1568
+ var _useState3 = React.useState(false),
1569
+ _useState4 = _slicedToArray(_useState3, 2),
1570
+ showCrypoModal = _useState4[0],
1571
+ setShowCryptoModal = _useState4[1];
1556
1572
  var onChange = React.useCallback(function (__, isBlur) {
1557
1573
  var e = lastKeyDownEventRef.current;
1558
1574
  if (!e) return;
1559
1575
  var kcode = e.keyCode;
1560
1576
  if (!kcode) return;
1577
+ setShowCryptoModal(!document.getElementById("luckysheet-formula-search-c"));
1561
1578
  if (!(kcode >= 112 && kcode <= 123 || kcode <= 46 || kcode === 144 || kcode === 108 || e.ctrlKey || e.altKey || e.shiftKey && (kcode === 37 || kcode === 38 || kcode === 39 || kcode === 40)) || kcode === 8 || kcode === 32 || kcode === 46 || e.ctrlKey && kcode === 86) {
1562
1579
  setContext(function (draftCtx) {
1563
1580
  if ((draftCtx.formulaCache.rangestart || draftCtx.formulaCache.rangedrag_column_start || draftCtx.formulaCache.rangedrag_row_start || fortuneCore.israngeseleciton(draftCtx)) && isBlur) return;
@@ -1619,7 +1636,7 @@ var InputBox = function InputBox() {
1619
1636
  onKeyDown: onKeyDown,
1620
1637
  onPaste: onPaste,
1621
1638
  allowEdit: edit ? !isHidenRC : edit
1622
- })), (context.functionCandidates.length > 0 || context.functionHint || context.defaultCandidates.length > 0) && (/*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(FormulaSearch, {
1639
+ })), (context.functionCandidates.length > 0 || context.functionHint || context.defaultCandidates.length > 0) && showCrypoModal && (/*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(FormulaSearch, {
1623
1640
  onMouseOver: function onMouseOver(e) {
1624
1641
  if (document.getElementById("luckysheet-formula-search-c")) {
1625
1642
  var hoveredItem = e.target.closest(".luckysheet-formula-search-item");
@@ -3393,7 +3410,10 @@ var ConditionRules = function ConditionRules(_ref) {
3393
3410
  }, conditionformat.applyRange), /*#__PURE__*/React__default['default'].createElement(ui.TextField, {
3394
3411
  rightIcon: /*#__PURE__*/React__default['default'].createElement(ui.LucideIcon, {
3395
3412
  name: "Grid2x2",
3396
- size: "sm"
3413
+ size: "sm",
3414
+ onClick: function onClick() {
3415
+ dataSelectRange("conditionRules".concat(type));
3416
+ }
3397
3417
  }),
3398
3418
  "aria-hidden": "true",
3399
3419
  readOnly: true,
@@ -3856,7 +3876,6 @@ var IframeBoxs = function IframeBoxs() {
3856
3876
  });
3857
3877
  }
3858
3878
  ctx.activeIframe = undefined;
3859
- fortuneCore.saveIframe(ctx);
3860
3879
  });
3861
3880
  },
3862
3881
  variant: "ghost",
@@ -5481,14 +5500,14 @@ var FormatSearch = function FormatSearch(_ref) {
5481
5500
  var index = fortuneCore.getSheetIndex(ctx, ctx.currentSheetId);
5482
5501
  if (___default['default'].isNil(index)) return;
5483
5502
  var selectedFormat = toolbarFormat[selectedFormatIndex].value;
5503
+ var formatString = "".concat(selectedFormat, "#,##0.").concat("0".repeat(decimalPlace));
5484
5504
  ___default['default'].forEach(ctx.luckysheet_select_save, function (selection) {
5485
5505
  for (var r = selection.row[0]; r <= selection.row[1]; r += 1) {
5486
5506
  for (var c = selection.column[0]; c <= selection.column[1]; c += 1) {
5487
5507
  var _ctx$luckysheetfile$i, _ctx$luckysheetfile$i2, _ctx$luckysheetfile$i3, _ctx$luckysheetfile$i4;
5488
5508
  if (((_ctx$luckysheetfile$i = ctx.luckysheetfile[index].data) === null || _ctx$luckysheetfile$i === void 0 ? void 0 : _ctx$luckysheetfile$i[r][c]) && ((_ctx$luckysheetfile$i2 = ctx.luckysheetfile[index].data) === null || _ctx$luckysheetfile$i2 === void 0 ? void 0 : (_ctx$luckysheetfile$i3 = _ctx$luckysheetfile$i2[r][c]) === null || _ctx$luckysheetfile$i3 === void 0 ? void 0 : (_ctx$luckysheetfile$i4 = _ctx$luckysheetfile$i3.ct) === null || _ctx$luckysheetfile$i4 === void 0 ? void 0 : _ctx$luckysheetfile$i4.t) === "n") {
5489
- var zero = 0;
5490
- ctx.luckysheetfile[index].data[r][c].ct.fa = "".concat(selectedFormat).concat(zero.toFixed(decimalPlace));
5491
- ctx.luckysheetfile[index].data[r][c].m = fortuneCore.update("".concat(selectedFormat).concat(zero.toFixed(decimalPlace)), ctx.luckysheetfile[index].data[r][c].v);
5509
+ ctx.luckysheetfile[index].data[r][c].ct.fa = formatString;
5510
+ ctx.luckysheetfile[index].data[r][c].m = fortuneCore.update(formatString, ctx.luckysheetfile[index].data[r][c].v);
5492
5511
  }
5493
5512
  }
5494
5513
  }