@leankylin-sheet/core 5.2.37 → 5.2.39

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/dist/index.esm.js CHANGED
@@ -476,6 +476,57 @@ function _nonIterableSpread() {
476
476
  function _nonIterableRest() {
477
477
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
478
478
  }
479
+ function _createForOfIteratorHelper(o, allowArrayLike) {
480
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
481
+ if (!it) {
482
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
483
+ if (it) o = it;
484
+ var i = 0;
485
+ var F = function () {};
486
+ return {
487
+ s: F,
488
+ n: function () {
489
+ if (i >= o.length) return {
490
+ done: true
491
+ };
492
+ return {
493
+ done: false,
494
+ value: o[i++]
495
+ };
496
+ },
497
+ e: function (e) {
498
+ throw e;
499
+ },
500
+ f: F
501
+ };
502
+ }
503
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
504
+ }
505
+ var normalCompletion = true,
506
+ didErr = false,
507
+ err;
508
+ return {
509
+ s: function () {
510
+ it = it.call(o);
511
+ },
512
+ n: function () {
513
+ var step = it.next();
514
+ normalCompletion = step.done;
515
+ return step;
516
+ },
517
+ e: function (e) {
518
+ didErr = true;
519
+ err = e;
520
+ },
521
+ f: function () {
522
+ try {
523
+ if (!normalCompletion && it.return != null) it.return();
524
+ } finally {
525
+ if (didErr) throw err;
526
+ }
527
+ }
528
+ };
529
+ }
479
530
 
480
531
  var en = {
481
532
  generalDialog: {
@@ -10517,6 +10568,8 @@ var en = {
10517
10568
  searchTargetSheet: "Sheet",
10518
10569
  searchTargetCell: "Cell",
10519
10570
  searchTargetValue: "Value",
10571
+ searchTargetFormula: "Formula",
10572
+ searchTargetDisplayValue: "Display Value",
10520
10573
  searchInputTip: "Please enter the search content",
10521
10574
  noReplceTip: "There is nothing to replace",
10522
10575
  noMatchTip: "No match found",
@@ -21103,6 +21156,8 @@ var zh = {
21103
21156
  searchTargetSheet: "工作表",
21104
21157
  searchTargetCell: "单元格",
21105
21158
  searchTargetValue: "值",
21159
+ searchTargetFormula: "公式",
21160
+ searchTargetDisplayValue: "显示值",
21106
21161
  searchInputTip: "请输入查找内容",
21107
21162
  noReplceTip: "没有可替换的内容",
21108
21163
  noMatchTip: "找不到匹配项",
@@ -31147,6 +31202,8 @@ var es = {
31147
31202
  searchTargetSheet: "Hoja",
31148
31203
  searchTargetCell: "Celda",
31149
31204
  searchTargetValue: "Valor",
31205
+ searchTargetFormula: "Fórmula",
31206
+ searchTargetDisplayValue: "Valor mostrado",
31150
31207
  searchInputTip: "Introduce el contenido de la búsqueda",
31151
31208
  noReplceTip: "No hay nada que reemplazar",
31152
31209
  noMatchTip: "No se encontraron coincidencias",
@@ -46706,48 +46763,11 @@ function copySheet(ctx, sheetId, hooks) {
46706
46763
  (_hooks$onCopySheet = hooks.onCopySheet) === null || _hooks$onCopySheet === void 0 ? void 0 : _hooks$onCopySheet.call(hooks, sheetId, copyId);
46707
46764
  }
46708
46765
  function calculateSheetFromula(ctx, id, isrefresh) {
46709
- console.time("calcTime:".concat(id));
46710
- if (isrefresh) {
46711
- execFunctionGroup(ctx, null, null, null, id, [], true);
46712
- groupValuesRefresh(ctx);
46713
- } else {
46714
- var index$1 = getSheetIndex(ctx, id);
46715
- var luckysheetfile = ctx.luckysheetfile;
46716
- var sheetData = luckysheetfile[index$1].data;
46717
- if (!sheetData) return;
46718
- var calcChain = luckysheetfile[index$1].calcChain || [];
46719
- var cellsToUpdate = [];
46720
- for (var i = 0; i < calcChain.length; i += 1) {
46721
- var _calcChain$i = calcChain[i],
46722
- r = _calcChain$i.r,
46723
- c = _calcChain$i.c;
46724
- var cell = sheetData[r][c];
46725
- if (!(cell === null || cell === void 0 ? void 0 : cell.f)) {
46726
- continue;
46727
- }
46728
- var result = execfunction(ctx, cell.f, r, c, id, false, true);
46729
- var newV = result[1];
46730
- if (newV === cell.v) {
46731
- continue;
46732
- }
46733
- cellsToUpdate.push({
46734
- r: r,
46735
- c: c,
46736
- v: newV
46737
- });
46738
- }
46739
- for (var _i = 0; _i < cellsToUpdate.length; _i += 1) {
46740
- var _cellsToUpdate$_i = cellsToUpdate[_i],
46741
- _r = _cellsToUpdate$_i.r,
46742
- _c = _cellsToUpdate$_i.c,
46743
- v = _cellsToUpdate$_i.v;
46744
- setCellValue$1(ctx, _r, _c, v, null, {
46745
- id: id
46746
- });
46747
- }
46748
- }
46749
- console.timeEnd("calcTime:".concat(id));
46766
+ console.time("calcTime:all}");
46767
+ execFunctionGroup(ctx, null, null, null, undefined, [], true);
46768
+ groupValuesRefresh(ctx);
46750
46769
  }
46770
+ console.timeEnd("calcTime:".concat(id));
46751
46771
  function updateFunctionGroupBySheetId(ctx, id) {
46752
46772
  var _ctx$luckysheetfile$i, _ctx$luckysheetfile$i2, _ctx$luckysheetfile$i3;
46753
46773
  var luckysheetfile = ctx.luckysheetfile;
@@ -46809,8 +46829,8 @@ function calculateSheetByCells(ctx, cells) {
46809
46829
  var _cells$index = cells[index$1],
46810
46830
  r = _cells$index.r,
46811
46831
  c = _cells$index.c,
46812
- id = _cells$index.id;
46813
- updatedMap["".concat(sheetIdNameMap[id], "!").concat(indexToColumnChar(c) + (r + 1))] = true;
46832
+ _id = _cells$index.id;
46833
+ updatedMap["".concat(sheetIdNameMap[_id], "!").concat(indexToColumnChar(c) + (r + 1))] = true;
46814
46834
  }
46815
46835
  var _loop = function _loop() {
46816
46836
  var file = fileList[fIndex];
@@ -46820,9 +46840,9 @@ function calculateSheetByCells(ctx, cells) {
46820
46840
  for (var _index = 0; _index < calcChain.length; _index++) {
46821
46841
  var _parseCellReferences;
46822
46842
  var _calcChain$_index = calcChain[_index],
46823
- _r3 = _calcChain$_index.r,
46824
- _c3 = _calcChain$_index.c;
46825
- var cell = file.data[_r3][_c3];
46843
+ _r2 = _calcChain$_index.r,
46844
+ _c2 = _calcChain$_index.c;
46845
+ var cell = file.data[_r2][_c2];
46826
46846
  if (!(cell === null || cell === void 0 ? void 0 : cell.f)) {
46827
46847
  continue;
46828
46848
  }
@@ -46834,8 +46854,8 @@ function calculateSheetByCells(ctx, cells) {
46834
46854
  });
46835
46855
  if (n) {
46836
46856
  needUpdateCell.push({
46837
- r: _r3,
46838
- c: _c3,
46857
+ r: _r2,
46858
+ c: _c2,
46839
46859
  id: sheetId,
46840
46860
  f: cell.f,
46841
46861
  v: cell.v
@@ -46851,18 +46871,18 @@ function calculateSheetByCells(ctx, cells) {
46851
46871
  });
46852
46872
  for (var nIndex = 0; nIndex < needUpdateCell.length; nIndex++) {
46853
46873
  var _needUpdateCell$nInde = needUpdateCell[nIndex],
46854
- _r2 = _needUpdateCell$nInde.r,
46855
- _c2 = _needUpdateCell$nInde.c,
46856
- _id = _needUpdateCell$nInde.id,
46874
+ _r = _needUpdateCell$nInde.r,
46875
+ _c = _needUpdateCell$nInde.c,
46876
+ _id2 = _needUpdateCell$nInde.id,
46857
46877
  _f = _needUpdateCell$nInde.f,
46858
46878
  v = _needUpdateCell$nInde.v;
46859
- var result = execfunction(ctx, _f, _r2, _c2, _id, undefined, true);
46879
+ var result = execfunction(ctx, _f, _r, _c, _id2, undefined, true);
46860
46880
  var newV = result[1];
46861
46881
  if (newV === v) {
46862
46882
  continue;
46863
46883
  }
46864
- setCellValue$1(ctx, _r2, _c2, result[1], null, {
46865
- id: _id
46884
+ setCellValue$1(ctx, _r, _c, result[1], null, {
46885
+ id: _id2
46866
46886
  });
46867
46887
  }
46868
46888
  console.timeEnd("calculateSheetByCellsTime");
@@ -53996,15 +54016,19 @@ function searchAll(ctx, searchText, checkModes) {
53996
54016
  var flowdata = sheet.data;
53997
54017
  if (!flowdata) continue;
53998
54018
  for (var i = 0; i < matches.length; i += 1) {
54019
+ var _flowdata$match$r;
53999
54020
  var match = matches[i];
54000
54021
  var value_ShowEs = valueShowEs(match.r, match.c, flowdata).toString();
54022
+ var cell = (_flowdata$match$r = flowdata[match.r]) === null || _flowdata$match$r === void 0 ? void 0 : _flowdata$match$r[match.c];
54001
54023
  searchResult.push({
54002
54024
  r: match.r,
54003
54025
  c: match.c,
54004
54026
  sheetName: sheet.name,
54005
54027
  sheetId: sheet.id,
54006
54028
  cellPosition: "".concat(chatatABC(match.c)).concat(match.r + 1),
54007
- value: value_ShowEs
54029
+ value: value_ShowEs,
54030
+ formula: !_.isNil(cell === null || cell === void 0 ? void 0 : cell.f) ? cell.f.toString() : "",
54031
+ displayValue: _.isString(cell === null || cell === void 0 ? void 0 : cell.m) ? cell.m : value_ShowEs
54008
54032
  });
54009
54033
  if (!firstMatch) {
54010
54034
  firstMatch = {
@@ -54123,16 +54147,28 @@ function replace(ctx, searchText, replaceText, checkModes) {
54123
54147
  var v = replaceText;
54124
54148
  setCellValue(ctx, r, c, d, v);
54125
54149
  } else {
54150
+ var regSource = checkModes.regCheck ? getRegExpStr(searchText) : escapeRegExpStr(searchText);
54126
54151
  var reg;
54127
54152
  if (checkModes.caseCheck) {
54128
- reg = new RegExp(getRegExpStr(searchText), "g");
54153
+ reg = new RegExp(regSource, "g");
54129
54154
  } else {
54130
- reg = new RegExp(getRegExpStr(searchText), "ig");
54155
+ reg = new RegExp(regSource, "ig");
54131
54156
  }
54132
54157
  r = searchIndexArr[count].r;
54133
54158
  c = searchIndexArr[count].c;
54134
- var _v = valueShowEs(r, c, d).toString().replace(reg, replaceText);
54135
- setCellValue(ctx, r, c, d, _v);
54159
+ var cell = d[r][c];
54160
+ if (searchType === "f" && !_.isNil(cell === null || cell === void 0 ? void 0 : cell.f)) {
54161
+ var newFormula = cell.f.toString().replace(reg, replaceText);
54162
+ cell.f = newFormula;
54163
+ var exec = execfunction(ctx, newFormula, r, c, ctx.currentSheetId, false, true);
54164
+ setCellValue(ctx, r, c, d, {
54165
+ v: exec[1],
54166
+ f: exec[2]
54167
+ });
54168
+ } else {
54169
+ var _v = valueShowEs(r, c, d).toString().replace(reg, replaceText);
54170
+ setCellValue(ctx, r, c, d, _v);
54171
+ }
54136
54172
  }
54137
54173
  ctx.luckysheet_select_save = normalizeSelection(ctx, [{
54138
54174
  row: [r, r],
@@ -54163,44 +54199,93 @@ function replaceAll(ctx, searchText, replaceText, checkModes) {
54163
54199
  } else {
54164
54200
  range = _.assign([], ctx.luckysheet_select_save);
54165
54201
  }
54166
- var searchIndexArr = getSearchIndexArr(searchText, range, flowdata, checkModes, searchType);
54167
- if (searchIndexArr.length === 0) {
54202
+ var matches = [];
54203
+ var _iterator = _createForOfIteratorHelper(ctx.luckysheetfile),
54204
+ _step;
54205
+ try {
54206
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
54207
+ var sheet = _step.value;
54208
+ var _fd2 = sheet.data;
54209
+ if (!_fd2 || _fd2.length === 0) continue;
54210
+ var sheetRange = sheet.id === ctx.currentSheetId ? range : [{
54211
+ row: [0, _fd2.length - 1],
54212
+ column: [0, _fd2[0].length - 1]
54213
+ }];
54214
+ var arr = getSearchIndexArr(searchText, sheetRange, _fd2, checkModes, searchType);
54215
+ for (var _i2 = 0; _i2 < arr.length; _i2 += 1) {
54216
+ matches.push({
54217
+ r: arr[_i2].r,
54218
+ c: arr[_i2].c,
54219
+ sheetId: sheet.id,
54220
+ flowdata: _fd2
54221
+ });
54222
+ }
54223
+ }
54224
+ } catch (err) {
54225
+ _iterator.e(err);
54226
+ } finally {
54227
+ _iterator.f();
54228
+ }
54229
+ if (matches.length === 0) {
54168
54230
  return findAndReplace.noReplceTip;
54169
54231
  }
54170
- var d = flowdata;
54232
+ var replacedInCurrentSheet = [];
54171
54233
  var replaceCount = 0;
54172
54234
  if (checkModes.wordCheck) {
54173
- for (var i = 0; i < searchIndexArr.length; i += 1) {
54174
- var r = searchIndexArr[i].r;
54175
- var c = searchIndexArr[i].c;
54176
- var v = replaceText;
54177
- setCellValue(ctx, r, c, d, v);
54178
- range.push({
54179
- row: [r, r],
54180
- column: [c, c]
54181
- });
54235
+ for (var i = 0; i < matches.length; i += 1) {
54236
+ var _matches$i = matches[i],
54237
+ r = _matches$i.r,
54238
+ c = _matches$i.c,
54239
+ sheetId = _matches$i.sheetId,
54240
+ fd = _matches$i.flowdata;
54241
+ setCellValue(ctx, r, c, fd, replaceText);
54242
+ if (sheetId === ctx.currentSheetId) {
54243
+ replacedInCurrentSheet.push({
54244
+ row: [r, r],
54245
+ column: [c, c]
54246
+ });
54247
+ }
54182
54248
  replaceCount += 1;
54183
54249
  }
54184
54250
  } else {
54251
+ var regSource = checkModes.regCheck ? getRegExpStr(searchText) : escapeRegExpStr(searchText);
54185
54252
  var reg;
54186
54253
  if (checkModes.caseCheck) {
54187
- reg = new RegExp(getRegExpStr(searchText), "g");
54254
+ reg = new RegExp(regSource, "g");
54188
54255
  } else {
54189
- reg = new RegExp(getRegExpStr(searchText), "ig");
54190
- }
54191
- for (var _i = 0; _i < searchIndexArr.length; _i += 1) {
54192
- var _r = searchIndexArr[_i].r;
54193
- var _c = searchIndexArr[_i].c;
54194
- var _v2 = valueShowEs(_r, _c, d).toString().replace(reg, replaceText);
54195
- setCellValue(ctx, _r, _c, d, _v2);
54196
- range.push({
54197
- row: [_r, _r],
54198
- column: [_c, _c]
54199
- });
54256
+ reg = new RegExp(regSource, "ig");
54257
+ }
54258
+ for (var _i = 0; _i < matches.length; _i += 1) {
54259
+ var _matches$_i = matches[_i],
54260
+ _r = _matches$_i.r,
54261
+ _c = _matches$_i.c,
54262
+ _sheetId = _matches$_i.sheetId,
54263
+ _fd = _matches$_i.flowdata;
54264
+ var cell = _fd[_r][_c];
54265
+ if (searchType === "f" && !_.isNil(cell === null || cell === void 0 ? void 0 : cell.f)) {
54266
+ var newFormula = cell.f.toString().replace(reg, replaceText);
54267
+ cell.f = newFormula;
54268
+ var exec = execfunction(ctx, newFormula, _r, _c, _sheetId, false, true);
54269
+ setCellValue(ctx, _r, _c, _fd, {
54270
+ v: exec[1],
54271
+ f: exec[2]
54272
+ });
54273
+ } else {
54274
+ var v = valueShowEs(_r, _c, _fd).toString().replace(reg, replaceText);
54275
+ setCellValue(ctx, _r, _c, _fd, v);
54276
+ }
54277
+ if (_sheetId === ctx.currentSheetId) {
54278
+ replacedInCurrentSheet.push({
54279
+ row: [_r, _r],
54280
+ column: [_c, _c]
54281
+ });
54282
+ }
54200
54283
  replaceCount += 1;
54201
54284
  }
54202
54285
  }
54203
- ctx.luckysheet_select_save = normalizeSelection(ctx, range);
54286
+ if (replacedInCurrentSheet.length > 0) {
54287
+ ctx.luckysheet_select_save = normalizeSelection(ctx, replacedInCurrentSheet);
54288
+ }
54204
54289
  var succeedInfo = replaceHtml(findAndReplace.successTip, {
54205
54290
  xlength: replaceCount
54206
54291
  });
@@ -55852,6 +55937,9 @@ function replaceHtml(temp, dataarry) {
55852
55937
  function getRegExpStr(str) {
55853
55938
  return str.replace("~*", "\\*").replace("~?", "\\?").replace(".", "\\.").replace("*", ".*").replace("?", ".");
55854
55939
  }
55940
+ function escapeRegExpStr(str) {
55941
+ return str.replace(/[.*+?^${}()|[\]\\-]/g, "\\$&");
55942
+ }
55855
55943
  function chatatABC(n) {
55856
55944
  var orda = "a".charCodeAt(0);
55857
55945
  var ordz = "z".charCodeAt(0);
@@ -60787,4 +60875,4 @@ function handlePasteByClick(ctx, triggerType) {
60787
60875
  } else if (data.indexOf("leankylin-copy-action-image") > -1) ; else ;
60788
60876
  }
60789
60877
 
60790
- export { CFSplitRange, Canvas, FormulaCache, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, index as api, applyLocation, attrToCssName, autoSelectionFormula, calcSelectionInfo, cancelActiveImgItem, cancelFunctionrangeSelected, cancelNormalSelected, cancelPaintModel, cellFocus, cfSplitRange, changeSheet, chatatABC, checkCF, checkCellIsLocked, checkProtectionAllSelected, checkProtectionFormatCells, checkProtectionSelectLockedOrUnLockedCells, checkboxChange, clearFilter, clearMeasureTextCache, colHasMerged, colLocation, colLocationByIndex, colors, columnCharToIndex, commentBoxProps, compute, computeRowlenArr, confirmMessage, convertCssToStyleList, convertSpanToShareString, copy, copy2, createDropCellRange, createFilter, createFilterOptions, createFormulaRangeSelect, createRangeHightlight, dataRangeSelection, datenum_local, defaultContext, defaultFont, defaultSettings, defaultStyle, delFunctionGroup, deleteCellInSave, deleteComment, deleteRowCol, deleteSelectedCellText, deleteSheet, diff, drawArrow, drawLineInfo, dropCellCache, editComment, editSheetName, ensureSheetIndex, error, escapeHTMLTag, escapeScriptTag, execFunctionGroup, execfunction, expandRowsAndColumns, extractFormulaCellOps, filterPatch, fixColumnStyleOverflowInFreeze, fixPositionOnFrozenCells, fixRowStyleOverflowInFreeze, functionCopy, functionHTMLGenerate, functionStrChange, genarate, generateRandomId, generateRandomSheetName, getAllFunctionGroup, getArrowCanvasSize, getBorderInfoCompute, getBorderInfoComputeRange, getCellHyperlink, getCellRowColumn, getCellTextInfo, getCellTopRightPostion, getCellValue, getClipboardContent, getColMerge, getColorGradation, getCommentBoxByRC, getCommentBoxPosition, getComputeMap, getCurrentRules, getDataArr, getDataBySelectionNoCopy, getDropdownList, getFailureText, getFilterColumnColors, getFilterColumnValues, getFlattenedRange, getFlowdata, getFontSet, getFontStyleByCell, getFrozenHandleLeft, getFrozenHandleTop, getHLColor, getHintText, getHistoryRules, getInlineStringHTML, getInlineStringNoStyle, getMeasureText, getNowDateTime, getNullData, getOptionValue, getOrigincell, getQKBorder, getRange, getRangeArr, getRangeByTxt, getRangetxt, getRealCellValue, getRegExpStr, getRegStr, getRowMerge, getSearchIndexArr, getSelectRange, getSheetByIndex, getSheetIdByName, getSheetIndex, getStyleByCell, getTypeItemHide, getcellFormula, getcellrange, getdatabyselection, getrangeseleciton, goToLink, groupValuesRefresh, handleArrowKey, handleBold, handleBorder, handleCellAreaDoubleClick, handleCellAreaDragOver, handleCellAreaMouseDown, handleCellAreaMouseMove, handleCellDrop, handleClearFormat, handleColFreezeHandleMouseDown, handleColSizeHandleMouseDown, handleColumnHeaderMouseDown, handleContextMenu, handleCopy, handleCurrencyFormat, handleFormatPainter, handleFormulaInput, handleFreeze, handleGlobalEnter, handleGlobalKeyDown, handleGlobalWheel, handleHorizontalAlign, handleItalic, handleKeydownForZoom, handleLink, handleMerge, handleNumberDecrease, handleNumberIncrease, handleOverlayMouseMove, handleOverlayMouseUp, handleOverlayTouchEnd, handleOverlayTouchMove, handleOverlayTouchStart, handlePaste, handlePasteByClick, handlePasteByLeanklin, handlePercentageFormat, handleRowFreezeHandleMouseDown, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleScreenShot, handleSort, handleStrikeThrough, handleSum, handleTextBackground, handleTextColor, handleTextSize, handleUnderline, handleVerticalAlign, handleWithCtrlOrMetaKey, hasChinaword, hasPartMC, hideCRCount, hideDropCellSelection, hideSelected, imageProps, indexToColumnChar, initFreeze, initSheetIndex, inlineStyleAffectAttribute, inlineStyleAffectCssName, insertImage, insertRowCol, insertUpdateFunctionGroup, inverseRowColOptions, isAllSelectedCellsInStatus, isAllowEdit, isInlineStringCT, isInlineStringCell, isLinkValid, isRealNull, isRealNum, isShowHidenCR, isSupportBoundingBox, is_date, iscelldata, isdatatype, isdatatypemulti, isdatetime, israngeseleciton, jfrefreshgrid, labelFilterOptionState, locale, luckysheetUpdateCell, mergeBorder, mergeCells, mergeMoveMain, mousePosition, moveHighlightCell, moveHighlightRange, moveToEnd, newComment, normalizeSelection, normalizedAttr, normalizedCellAttr, onCellsMove, onCellsMoveEnd, onCellsMoveStart, onCommentBoxMove, onCommentBoxMoveEnd, onCommentBoxMoveStart, onCommentBoxResize, onCommentBoxResizeEnd, onCommentBoxResizeStart, onDropCellSelect, onDropCellSelectEnd, onFormulaRangeDragEnd, onImageMove, onImageMoveEnd, onImageMoveStart, onImageResize, onImageResizeEnd, onImageResizeStart, onRangeSelectionModalMove, onRangeSelectionModalMoveEnd, onRangeSelectionModalMoveStart, onSearchDialogMove, onSearchDialogMoveEnd, onSearchDialogMoveStart, opToPatch, orderbydata, orderbydatafiler, overShowComment, pasteHandlerOfPaintModel, patchToOp, rangeDrag, rangeDragColumn, rangeDragRow, rangeHightlightselected, rangeSetValue, rangeValueToHtml, removeActiveImage, removeEditingComment, removeHyperlink, replace, replaceAll, replaceHtml, rgbToHex, rowHasMerged, rowLocation, rowLocationByIndex, saveFilter, saveHyperlink, saveImage, scrollToFrozenRowCol, scrollToHighlightCell, searchAll, searchNext, selectAll, selectIsOverlap, selectTextContent, selectTextContentCross, selectTitlesMap, selectTitlesRange, selectionCache, selectionCopyShow, seletedHighlistByindex, setCaretPosition, setCellValue, setConditionRules, setDropcownValue, setEditingComment, setNextSheet, showComments, showDropCellSelection, showHideAllComments, showHideComment, showImgChooser, showLinkCard, showSelected, sortDataRange, sortSelection, storeSheetParamALL, toolbarItemClickHandler, toolbarItemSelectedFunc, update, updateCell, updateContextWithCanvas, updateContextWithSheetData, updateDropCell, updateFormat, updateFormatCell, updateInlineStringFormat, updateInlineStringFormatOutside, updateItem, updateMoreCell, updateSheet, validateCellData, validateIdCard, valueIsError, valueShowEs };
60878
+ export { CFSplitRange, Canvas, FormulaCache, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, index as api, applyLocation, attrToCssName, autoSelectionFormula, calcSelectionInfo, cancelActiveImgItem, cancelFunctionrangeSelected, cancelNormalSelected, cancelPaintModel, cellFocus, cfSplitRange, changeSheet, chatatABC, checkCF, checkCellIsLocked, checkProtectionAllSelected, checkProtectionFormatCells, checkProtectionSelectLockedOrUnLockedCells, checkboxChange, clearFilter, clearMeasureTextCache, colHasMerged, colLocation, colLocationByIndex, colors, columnCharToIndex, commentBoxProps, compute, computeRowlenArr, confirmMessage, convertCssToStyleList, convertSpanToShareString, copy, copy2, createDropCellRange, createFilter, createFilterOptions, createFormulaRangeSelect, createRangeHightlight, dataRangeSelection, datenum_local, defaultContext, defaultFont, defaultSettings, defaultStyle, delFunctionGroup, deleteCellInSave, deleteComment, deleteRowCol, deleteSelectedCellText, deleteSheet, diff, drawArrow, drawLineInfo, dropCellCache, editComment, editSheetName, ensureSheetIndex, error, escapeHTMLTag, escapeRegExpStr, escapeScriptTag, execFunctionGroup, execfunction, expandRowsAndColumns, extractFormulaCellOps, filterPatch, fixColumnStyleOverflowInFreeze, fixPositionOnFrozenCells, fixRowStyleOverflowInFreeze, functionCopy, functionHTMLGenerate, functionStrChange, genarate, generateRandomId, generateRandomSheetName, getAllFunctionGroup, getArrowCanvasSize, getBorderInfoCompute, getBorderInfoComputeRange, getCellHyperlink, getCellRowColumn, getCellTextInfo, getCellTopRightPostion, getCellValue, getClipboardContent, getColMerge, getColorGradation, getCommentBoxByRC, getCommentBoxPosition, getComputeMap, getCurrentRules, getDataArr, getDataBySelectionNoCopy, getDropdownList, getFailureText, getFilterColumnColors, getFilterColumnValues, getFlattenedRange, getFlowdata, getFontSet, getFontStyleByCell, getFrozenHandleLeft, getFrozenHandleTop, getHLColor, getHintText, getHistoryRules, getInlineStringHTML, getInlineStringNoStyle, getMeasureText, getNowDateTime, getNullData, getOptionValue, getOrigincell, getQKBorder, getRange, getRangeArr, getRangeByTxt, getRangetxt, getRealCellValue, getRegExpStr, getRegStr, getRowMerge, getSearchIndexArr, getSelectRange, getSheetByIndex, getSheetIdByName, getSheetIndex, getStyleByCell, getTypeItemHide, getcellFormula, getcellrange, getdatabyselection, getrangeseleciton, goToLink, groupValuesRefresh, handleArrowKey, handleBold, handleBorder, handleCellAreaDoubleClick, handleCellAreaDragOver, handleCellAreaMouseDown, handleCellAreaMouseMove, handleCellDrop, handleClearFormat, handleColFreezeHandleMouseDown, handleColSizeHandleMouseDown, handleColumnHeaderMouseDown, handleContextMenu, handleCopy, handleCurrencyFormat, handleFormatPainter, handleFormulaInput, handleFreeze, handleGlobalEnter, handleGlobalKeyDown, handleGlobalWheel, handleHorizontalAlign, handleItalic, handleKeydownForZoom, handleLink, handleMerge, handleNumberDecrease, handleNumberIncrease, handleOverlayMouseMove, handleOverlayMouseUp, handleOverlayTouchEnd, handleOverlayTouchMove, handleOverlayTouchStart, handlePaste, handlePasteByClick, handlePasteByLeanklin, handlePercentageFormat, handleRowFreezeHandleMouseDown, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleScreenShot, handleSort, handleStrikeThrough, handleSum, handleTextBackground, handleTextColor, handleTextSize, handleUnderline, handleVerticalAlign, handleWithCtrlOrMetaKey, hasChinaword, hasPartMC, hideCRCount, hideDropCellSelection, hideSelected, imageProps, indexToColumnChar, initFreeze, initSheetIndex, inlineStyleAffectAttribute, inlineStyleAffectCssName, insertImage, insertRowCol, insertUpdateFunctionGroup, inverseRowColOptions, isAllSelectedCellsInStatus, isAllowEdit, isInlineStringCT, isInlineStringCell, isLinkValid, isRealNull, isRealNum, isShowHidenCR, isSupportBoundingBox, is_date, iscelldata, isdatatype, isdatatypemulti, isdatetime, israngeseleciton, jfrefreshgrid, labelFilterOptionState, locale, luckysheetUpdateCell, mergeBorder, mergeCells, mergeMoveMain, mousePosition, moveHighlightCell, moveHighlightRange, moveToEnd, newComment, normalizeSelection, normalizedAttr, normalizedCellAttr, onCellsMove, onCellsMoveEnd, onCellsMoveStart, onCommentBoxMove, onCommentBoxMoveEnd, onCommentBoxMoveStart, onCommentBoxResize, onCommentBoxResizeEnd, onCommentBoxResizeStart, onDropCellSelect, onDropCellSelectEnd, onFormulaRangeDragEnd, onImageMove, onImageMoveEnd, onImageMoveStart, onImageResize, onImageResizeEnd, onImageResizeStart, onRangeSelectionModalMove, onRangeSelectionModalMoveEnd, onRangeSelectionModalMoveStart, onSearchDialogMove, onSearchDialogMoveEnd, onSearchDialogMoveStart, opToPatch, orderbydata, orderbydatafiler, overShowComment, pasteHandlerOfPaintModel, patchToOp, rangeDrag, rangeDragColumn, rangeDragRow, rangeHightlightselected, rangeSetValue, rangeValueToHtml, removeActiveImage, removeEditingComment, removeHyperlink, replace, replaceAll, replaceHtml, rgbToHex, rowHasMerged, rowLocation, rowLocationByIndex, saveFilter, saveHyperlink, saveImage, scrollToFrozenRowCol, scrollToHighlightCell, searchAll, searchNext, selectAll, selectIsOverlap, selectTextContent, selectTextContentCross, selectTitlesMap, selectTitlesRange, selectionCache, selectionCopyShow, seletedHighlistByindex, setCaretPosition, setCellValue, setConditionRules, setDropcownValue, setEditingComment, setNextSheet, showComments, showDropCellSelection, showHideAllComments, showHideComment, showImgChooser, showLinkCard, showSelected, sortDataRange, sortSelection, storeSheetParamALL, toolbarItemClickHandler, toolbarItemSelectedFunc, update, updateCell, updateContextWithCanvas, updateContextWithSheetData, updateDropCell, updateFormat, updateFormatCell, updateInlineStringFormat, updateInlineStringFormatOutside, updateItem, updateMoreCell, updateSheet, validateCellData, validateIdCard, valueIsError, valueShowEs };
package/dist/index.js CHANGED
@@ -486,6 +486,57 @@ function _nonIterableSpread() {
486
486
  function _nonIterableRest() {
487
487
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
488
488
  }
489
+ function _createForOfIteratorHelper(o, allowArrayLike) {
490
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
491
+ if (!it) {
492
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
493
+ if (it) o = it;
494
+ var i = 0;
495
+ var F = function () {};
496
+ return {
497
+ s: F,
498
+ n: function () {
499
+ if (i >= o.length) return {
500
+ done: true
501
+ };
502
+ return {
503
+ done: false,
504
+ value: o[i++]
505
+ };
506
+ },
507
+ e: function (e) {
508
+ throw e;
509
+ },
510
+ f: F
511
+ };
512
+ }
513
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
514
+ }
515
+ var normalCompletion = true,
516
+ didErr = false,
517
+ err;
518
+ return {
519
+ s: function () {
520
+ it = it.call(o);
521
+ },
522
+ n: function () {
523
+ var step = it.next();
524
+ normalCompletion = step.done;
525
+ return step;
526
+ },
527
+ e: function (e) {
528
+ didErr = true;
529
+ err = e;
530
+ },
531
+ f: function () {
532
+ try {
533
+ if (!normalCompletion && it.return != null) it.return();
534
+ } finally {
535
+ if (didErr) throw err;
536
+ }
537
+ }
538
+ };
539
+ }
489
540
 
490
541
  var en = {
491
542
  generalDialog: {
@@ -10527,6 +10578,8 @@ var en = {
10527
10578
  searchTargetSheet: "Sheet",
10528
10579
  searchTargetCell: "Cell",
10529
10580
  searchTargetValue: "Value",
10581
+ searchTargetFormula: "Formula",
10582
+ searchTargetDisplayValue: "Display Value",
10530
10583
  searchInputTip: "Please enter the search content",
10531
10584
  noReplceTip: "There is nothing to replace",
10532
10585
  noMatchTip: "No match found",
@@ -21113,6 +21166,8 @@ var zh = {
21113
21166
  searchTargetSheet: "工作表",
21114
21167
  searchTargetCell: "单元格",
21115
21168
  searchTargetValue: "值",
21169
+ searchTargetFormula: "公式",
21170
+ searchTargetDisplayValue: "显示值",
21116
21171
  searchInputTip: "请输入查找内容",
21117
21172
  noReplceTip: "没有可替换的内容",
21118
21173
  noMatchTip: "找不到匹配项",
@@ -31157,6 +31212,8 @@ var es = {
31157
31212
  searchTargetSheet: "Hoja",
31158
31213
  searchTargetCell: "Celda",
31159
31214
  searchTargetValue: "Valor",
31215
+ searchTargetFormula: "Fórmula",
31216
+ searchTargetDisplayValue: "Valor mostrado",
31160
31217
  searchInputTip: "Introduce el contenido de la búsqueda",
31161
31218
  noReplceTip: "No hay nada que reemplazar",
31162
31219
  noMatchTip: "No se encontraron coincidencias",
@@ -46716,48 +46773,11 @@ function copySheet(ctx, sheetId, hooks) {
46716
46773
  (_hooks$onCopySheet = hooks.onCopySheet) === null || _hooks$onCopySheet === void 0 ? void 0 : _hooks$onCopySheet.call(hooks, sheetId, copyId);
46717
46774
  }
46718
46775
  function calculateSheetFromula(ctx, id, isrefresh) {
46719
- console.time("calcTime:".concat(id));
46720
- if (isrefresh) {
46721
- execFunctionGroup(ctx, null, null, null, id, [], true);
46722
- groupValuesRefresh(ctx);
46723
- } else {
46724
- var index$1 = getSheetIndex(ctx, id);
46725
- var luckysheetfile = ctx.luckysheetfile;
46726
- var sheetData = luckysheetfile[index$1].data;
46727
- if (!sheetData) return;
46728
- var calcChain = luckysheetfile[index$1].calcChain || [];
46729
- var cellsToUpdate = [];
46730
- for (var i = 0; i < calcChain.length; i += 1) {
46731
- var _calcChain$i = calcChain[i],
46732
- r = _calcChain$i.r,
46733
- c = _calcChain$i.c;
46734
- var cell = sheetData[r][c];
46735
- if (!(cell === null || cell === void 0 ? void 0 : cell.f)) {
46736
- continue;
46737
- }
46738
- var result = execfunction(ctx, cell.f, r, c, id, false, true);
46739
- var newV = result[1];
46740
- if (newV === cell.v) {
46741
- continue;
46742
- }
46743
- cellsToUpdate.push({
46744
- r: r,
46745
- c: c,
46746
- v: newV
46747
- });
46748
- }
46749
- for (var _i = 0; _i < cellsToUpdate.length; _i += 1) {
46750
- var _cellsToUpdate$_i = cellsToUpdate[_i],
46751
- _r = _cellsToUpdate$_i.r,
46752
- _c = _cellsToUpdate$_i.c,
46753
- v = _cellsToUpdate$_i.v;
46754
- setCellValue$1(ctx, _r, _c, v, null, {
46755
- id: id
46756
- });
46757
- }
46758
- }
46759
- console.timeEnd("calcTime:".concat(id));
46776
+ console.time("calcTime:all}");
46777
+ execFunctionGroup(ctx, null, null, null, undefined, [], true);
46778
+ groupValuesRefresh(ctx);
46760
46779
  }
46780
+ console.timeEnd("calcTime:".concat(id));
46761
46781
  function updateFunctionGroupBySheetId(ctx, id) {
46762
46782
  var _ctx$luckysheetfile$i, _ctx$luckysheetfile$i2, _ctx$luckysheetfile$i3;
46763
46783
  var luckysheetfile = ctx.luckysheetfile;
@@ -46819,8 +46839,8 @@ function calculateSheetByCells(ctx, cells) {
46819
46839
  var _cells$index = cells[index$1],
46820
46840
  r = _cells$index.r,
46821
46841
  c = _cells$index.c,
46822
- id = _cells$index.id;
46823
- updatedMap["".concat(sheetIdNameMap[id], "!").concat(indexToColumnChar(c) + (r + 1))] = true;
46842
+ _id = _cells$index.id;
46843
+ updatedMap["".concat(sheetIdNameMap[_id], "!").concat(indexToColumnChar(c) + (r + 1))] = true;
46824
46844
  }
46825
46845
  var _loop = function _loop() {
46826
46846
  var file = fileList[fIndex];
@@ -46830,9 +46850,9 @@ function calculateSheetByCells(ctx, cells) {
46830
46850
  for (var _index = 0; _index < calcChain.length; _index++) {
46831
46851
  var _parseCellReferences;
46832
46852
  var _calcChain$_index = calcChain[_index],
46833
- _r3 = _calcChain$_index.r,
46834
- _c3 = _calcChain$_index.c;
46835
- var cell = file.data[_r3][_c3];
46853
+ _r2 = _calcChain$_index.r,
46854
+ _c2 = _calcChain$_index.c;
46855
+ var cell = file.data[_r2][_c2];
46836
46856
  if (!(cell === null || cell === void 0 ? void 0 : cell.f)) {
46837
46857
  continue;
46838
46858
  }
@@ -46844,8 +46864,8 @@ function calculateSheetByCells(ctx, cells) {
46844
46864
  });
46845
46865
  if (n) {
46846
46866
  needUpdateCell.push({
46847
- r: _r3,
46848
- c: _c3,
46867
+ r: _r2,
46868
+ c: _c2,
46849
46869
  id: sheetId,
46850
46870
  f: cell.f,
46851
46871
  v: cell.v
@@ -46861,18 +46881,18 @@ function calculateSheetByCells(ctx, cells) {
46861
46881
  });
46862
46882
  for (var nIndex = 0; nIndex < needUpdateCell.length; nIndex++) {
46863
46883
  var _needUpdateCell$nInde = needUpdateCell[nIndex],
46864
- _r2 = _needUpdateCell$nInde.r,
46865
- _c2 = _needUpdateCell$nInde.c,
46866
- _id = _needUpdateCell$nInde.id,
46884
+ _r = _needUpdateCell$nInde.r,
46885
+ _c = _needUpdateCell$nInde.c,
46886
+ _id2 = _needUpdateCell$nInde.id,
46867
46887
  _f = _needUpdateCell$nInde.f,
46868
46888
  v = _needUpdateCell$nInde.v;
46869
- var result = execfunction(ctx, _f, _r2, _c2, _id, undefined, true);
46889
+ var result = execfunction(ctx, _f, _r, _c, _id2, undefined, true);
46870
46890
  var newV = result[1];
46871
46891
  if (newV === v) {
46872
46892
  continue;
46873
46893
  }
46874
- setCellValue$1(ctx, _r2, _c2, result[1], null, {
46875
- id: _id
46894
+ setCellValue$1(ctx, _r, _c, result[1], null, {
46895
+ id: _id2
46876
46896
  });
46877
46897
  }
46878
46898
  console.timeEnd("calculateSheetByCellsTime");
@@ -54006,15 +54026,19 @@ function searchAll(ctx, searchText, checkModes) {
54006
54026
  var flowdata = sheet.data;
54007
54027
  if (!flowdata) continue;
54008
54028
  for (var i = 0; i < matches.length; i += 1) {
54029
+ var _flowdata$match$r;
54009
54030
  var match = matches[i];
54010
54031
  var value_ShowEs = valueShowEs(match.r, match.c, flowdata).toString();
54032
+ var cell = (_flowdata$match$r = flowdata[match.r]) === null || _flowdata$match$r === void 0 ? void 0 : _flowdata$match$r[match.c];
54011
54033
  searchResult.push({
54012
54034
  r: match.r,
54013
54035
  c: match.c,
54014
54036
  sheetName: sheet.name,
54015
54037
  sheetId: sheet.id,
54016
54038
  cellPosition: "".concat(chatatABC(match.c)).concat(match.r + 1),
54017
- value: value_ShowEs
54039
+ value: value_ShowEs,
54040
+ formula: !___default['default'].isNil(cell === null || cell === void 0 ? void 0 : cell.f) ? cell.f.toString() : "",
54041
+ displayValue: ___default['default'].isString(cell === null || cell === void 0 ? void 0 : cell.m) ? cell.m : value_ShowEs
54018
54042
  });
54019
54043
  if (!firstMatch) {
54020
54044
  firstMatch = {
@@ -54133,16 +54157,28 @@ function replace(ctx, searchText, replaceText, checkModes) {
54133
54157
  var v = replaceText;
54134
54158
  setCellValue(ctx, r, c, d, v);
54135
54159
  } else {
54160
+ var regSource = checkModes.regCheck ? getRegExpStr(searchText) : escapeRegExpStr(searchText);
54136
54161
  var reg;
54137
54162
  if (checkModes.caseCheck) {
54138
- reg = new RegExp(getRegExpStr(searchText), "g");
54163
+ reg = new RegExp(regSource, "g");
54139
54164
  } else {
54140
- reg = new RegExp(getRegExpStr(searchText), "ig");
54165
+ reg = new RegExp(regSource, "ig");
54141
54166
  }
54142
54167
  r = searchIndexArr[count].r;
54143
54168
  c = searchIndexArr[count].c;
54144
- var _v = valueShowEs(r, c, d).toString().replace(reg, replaceText);
54145
- setCellValue(ctx, r, c, d, _v);
54169
+ var cell = d[r][c];
54170
+ if (searchType === "f" && !___default['default'].isNil(cell === null || cell === void 0 ? void 0 : cell.f)) {
54171
+ var newFormula = cell.f.toString().replace(reg, replaceText);
54172
+ cell.f = newFormula;
54173
+ var exec = execfunction(ctx, newFormula, r, c, ctx.currentSheetId, false, true);
54174
+ setCellValue(ctx, r, c, d, {
54175
+ v: exec[1],
54176
+ f: exec[2]
54177
+ });
54178
+ } else {
54179
+ var _v = valueShowEs(r, c, d).toString().replace(reg, replaceText);
54180
+ setCellValue(ctx, r, c, d, _v);
54181
+ }
54146
54182
  }
54147
54183
  ctx.luckysheet_select_save = normalizeSelection(ctx, [{
54148
54184
  row: [r, r],
@@ -54173,44 +54209,93 @@ function replaceAll(ctx, searchText, replaceText, checkModes) {
54173
54209
  } else {
54174
54210
  range = ___default['default'].assign([], ctx.luckysheet_select_save);
54175
54211
  }
54176
- var searchIndexArr = getSearchIndexArr(searchText, range, flowdata, checkModes, searchType);
54177
- if (searchIndexArr.length === 0) {
54212
+ var matches = [];
54213
+ var _iterator = _createForOfIteratorHelper(ctx.luckysheetfile),
54214
+ _step;
54215
+ try {
54216
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
54217
+ var sheet = _step.value;
54218
+ var _fd2 = sheet.data;
54219
+ if (!_fd2 || _fd2.length === 0) continue;
54220
+ var sheetRange = sheet.id === ctx.currentSheetId ? range : [{
54221
+ row: [0, _fd2.length - 1],
54222
+ column: [0, _fd2[0].length - 1]
54223
+ }];
54224
+ var arr = getSearchIndexArr(searchText, sheetRange, _fd2, checkModes, searchType);
54225
+ for (var _i2 = 0; _i2 < arr.length; _i2 += 1) {
54226
+ matches.push({
54227
+ r: arr[_i2].r,
54228
+ c: arr[_i2].c,
54229
+ sheetId: sheet.id,
54230
+ flowdata: _fd2
54231
+ });
54232
+ }
54233
+ }
54234
+ } catch (err) {
54235
+ _iterator.e(err);
54236
+ } finally {
54237
+ _iterator.f();
54238
+ }
54239
+ if (matches.length === 0) {
54178
54240
  return findAndReplace.noReplceTip;
54179
54241
  }
54180
- var d = flowdata;
54242
+ var replacedInCurrentSheet = [];
54181
54243
  var replaceCount = 0;
54182
54244
  if (checkModes.wordCheck) {
54183
- for (var i = 0; i < searchIndexArr.length; i += 1) {
54184
- var r = searchIndexArr[i].r;
54185
- var c = searchIndexArr[i].c;
54186
- var v = replaceText;
54187
- setCellValue(ctx, r, c, d, v);
54188
- range.push({
54189
- row: [r, r],
54190
- column: [c, c]
54191
- });
54245
+ for (var i = 0; i < matches.length; i += 1) {
54246
+ var _matches$i = matches[i],
54247
+ r = _matches$i.r,
54248
+ c = _matches$i.c,
54249
+ sheetId = _matches$i.sheetId,
54250
+ fd = _matches$i.flowdata;
54251
+ setCellValue(ctx, r, c, fd, replaceText);
54252
+ if (sheetId === ctx.currentSheetId) {
54253
+ replacedInCurrentSheet.push({
54254
+ row: [r, r],
54255
+ column: [c, c]
54256
+ });
54257
+ }
54192
54258
  replaceCount += 1;
54193
54259
  }
54194
54260
  } else {
54261
+ var regSource = checkModes.regCheck ? getRegExpStr(searchText) : escapeRegExpStr(searchText);
54195
54262
  var reg;
54196
54263
  if (checkModes.caseCheck) {
54197
- reg = new RegExp(getRegExpStr(searchText), "g");
54264
+ reg = new RegExp(regSource, "g");
54198
54265
  } else {
54199
- reg = new RegExp(getRegExpStr(searchText), "ig");
54200
- }
54201
- for (var _i = 0; _i < searchIndexArr.length; _i += 1) {
54202
- var _r = searchIndexArr[_i].r;
54203
- var _c = searchIndexArr[_i].c;
54204
- var _v2 = valueShowEs(_r, _c, d).toString().replace(reg, replaceText);
54205
- setCellValue(ctx, _r, _c, d, _v2);
54206
- range.push({
54207
- row: [_r, _r],
54208
- column: [_c, _c]
54209
- });
54266
+ reg = new RegExp(regSource, "ig");
54267
+ }
54268
+ for (var _i = 0; _i < matches.length; _i += 1) {
54269
+ var _matches$_i = matches[_i],
54270
+ _r = _matches$_i.r,
54271
+ _c = _matches$_i.c,
54272
+ _sheetId = _matches$_i.sheetId,
54273
+ _fd = _matches$_i.flowdata;
54274
+ var cell = _fd[_r][_c];
54275
+ if (searchType === "f" && !___default['default'].isNil(cell === null || cell === void 0 ? void 0 : cell.f)) {
54276
+ var newFormula = cell.f.toString().replace(reg, replaceText);
54277
+ cell.f = newFormula;
54278
+ var exec = execfunction(ctx, newFormula, _r, _c, _sheetId, false, true);
54279
+ setCellValue(ctx, _r, _c, _fd, {
54280
+ v: exec[1],
54281
+ f: exec[2]
54282
+ });
54283
+ } else {
54284
+ var v = valueShowEs(_r, _c, _fd).toString().replace(reg, replaceText);
54285
+ setCellValue(ctx, _r, _c, _fd, v);
54286
+ }
54287
+ if (_sheetId === ctx.currentSheetId) {
54288
+ replacedInCurrentSheet.push({
54289
+ row: [_r, _r],
54290
+ column: [_c, _c]
54291
+ });
54292
+ }
54210
54293
  replaceCount += 1;
54211
54294
  }
54212
54295
  }
54213
- ctx.luckysheet_select_save = normalizeSelection(ctx, range);
54296
+ if (replacedInCurrentSheet.length > 0) {
54297
+ ctx.luckysheet_select_save = normalizeSelection(ctx, replacedInCurrentSheet);
54298
+ }
54214
54299
  var succeedInfo = replaceHtml(findAndReplace.successTip, {
54215
54300
  xlength: replaceCount
54216
54301
  });
@@ -55862,6 +55947,9 @@ function replaceHtml(temp, dataarry) {
55862
55947
  function getRegExpStr(str) {
55863
55948
  return str.replace("~*", "\\*").replace("~?", "\\?").replace(".", "\\.").replace("*", ".*").replace("?", ".");
55864
55949
  }
55950
+ function escapeRegExpStr(str) {
55951
+ return str.replace(/[.*+?^${}()|[\]\\-]/g, "\\$&");
55952
+ }
55865
55953
  function chatatABC(n) {
55866
55954
  var orda = "a".charCodeAt(0);
55867
55955
  var ordz = "z".charCodeAt(0);
@@ -60863,6 +60951,7 @@ exports.editSheetName = editSheetName;
60863
60951
  exports.ensureSheetIndex = ensureSheetIndex;
60864
60952
  exports.error = error;
60865
60953
  exports.escapeHTMLTag = escapeHTMLTag;
60954
+ exports.escapeRegExpStr = escapeRegExpStr;
60866
60955
  exports.escapeScriptTag = escapeScriptTag;
60867
60956
  exports.execFunctionGroup = execFunctionGroup;
60868
60957
  exports.execfunction = execfunction;
@@ -513,6 +513,8 @@ declare const _default: {
513
513
  searchTargetSheet: string;
514
514
  searchTargetCell: string;
515
515
  searchTargetValue: string;
516
+ searchTargetFormula: string;
517
+ searchTargetDisplayValue: string;
516
518
  searchInputTip: string;
517
519
  noReplceTip: string;
518
520
  noMatchTip: string;
@@ -638,6 +638,8 @@ declare const _default: {
638
638
  searchTargetSheet: string;
639
639
  searchTargetCell: string;
640
640
  searchTargetValue: string;
641
+ searchTargetFormula: string;
642
+ searchTargetDisplayValue: string;
641
643
  searchInputTip: string;
642
644
  noReplceTip: string;
643
645
  noMatchTip: string;
@@ -531,6 +531,8 @@ declare function locale(ctx: Context): {
531
531
  searchTargetSheet: string;
532
532
  searchTargetCell: string;
533
533
  searchTargetValue: string;
534
+ searchTargetFormula: string;
535
+ searchTargetDisplayValue: string;
534
536
  searchInputTip: string;
535
537
  noReplceTip: string;
536
538
  noMatchTip: string;
@@ -530,6 +530,8 @@ declare const _default: {
530
530
  searchTargetSheet: string;
531
531
  searchTargetCell: string;
532
532
  searchTargetValue: string;
533
+ searchTargetFormula: string;
534
+ searchTargetDisplayValue: string;
533
535
  searchInputTip: string;
534
536
  noReplceTip: string;
535
537
  noMatchTip: string;
@@ -676,6 +676,8 @@ declare const _default: {
676
676
  searchTargetSheet: string;
677
677
  searchTargetCell: string;
678
678
  searchTargetValue: string;
679
+ searchTargetFormula: string;
680
+ searchTargetDisplayValue: string;
679
681
  searchInputTip: string;
680
682
  noReplceTip: string;
681
683
  noMatchTip: string;
package/dist/types.d.ts CHANGED
@@ -190,6 +190,8 @@ export type SearchResult = {
190
190
  sheetId: string;
191
191
  cellPosition: string;
192
192
  value: string;
193
+ formula?: string;
194
+ displayValue?: string;
193
195
  };
194
196
  export type LinkCardProps = {
195
197
  sheetId: string;
@@ -13,5 +13,6 @@ export declare function getSheetByIndex(ctx: Context, id: string): Sheet | null;
13
13
  export declare function getNowDateTime(format: number): string;
14
14
  export declare function replaceHtml(temp: string, dataarry: any): string;
15
15
  export declare function getRegExpStr(str: string): string;
16
+ export declare function escapeRegExpStr(str: string): string;
16
17
  export declare function chatatABC(n: number): string;
17
18
  export declare function isAllowEdit(ctx: Context, range?: Sheet["luckysheet_select_save"]): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "5.2.37",
3
+ "version": "5.2.39",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "typings": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "build": "father-build"
14
14
  },
15
15
  "dependencies": {
16
- "@leankylin-sheet/formula-parser": "5.2.37",
16
+ "@leankylin-sheet/formula-parser": "5.2.39",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",