@leankylin-sheet/core 5.2.72 → 5.2.74

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
@@ -36704,11 +36704,8 @@ function findrangeindex(ctx, v, vp) {
36704
36704
  var _n2 = v_a[_i17];
36705
36705
  if (_.isNil(_p2)) {
36706
36706
  pfri[0] = v_a.length - 1;
36707
- if (!_.isNil(_n2)) {
36708
- pfri[1] = _n2.length;
36709
- } else {
36710
- pfri[1] = 1;
36711
- }
36707
+ var last = v_a[pfri[0]];
36708
+ pfri[1] = _.isNil(last) ? 1 : last.length;
36712
36709
  } else if (_p2.length === _n2.length) {
36713
36710
  if (vp_a[_i17 + 1] != null && (vp_a[_i17 + 1].substring(0, 1) === '"' || vp_a[_i17 + 1].substring(0, 1) === "{" || vp_a[_i17 + 1].substring(0, 1) === "}")) {
36714
36711
  pfri[1] = _n2.length;
@@ -36776,20 +36773,73 @@ function createRangeHightlight(ctx, inputInnerHtmlStr) {
36776
36773
  });
36777
36774
  ctx.formulaRangeHighlight = formulaRanges;
36778
36775
  }
36776
+ function locateTextOffset(node, offset) {
36777
+ var texts = [];
36778
+ if (node.nodeType === Node.TEXT_NODE) {
36779
+ texts.push(node);
36780
+ }
36781
+ var walker = document.createTreeWalker(node, NodeFilter.SHOW_TEXT);
36782
+ var text = walker.nextNode();
36783
+ while (text) {
36784
+ texts.push(text);
36785
+ text = walker.nextNode();
36786
+ }
36787
+ var acc = 0;
36788
+ for (var _i18 = 0; _i18 < texts.length; _i18 += 1) {
36789
+ var _item$textContent$len, _item$textContent;
36790
+ var item = texts[_i18];
36791
+ var len = (_item$textContent$len = (_item$textContent = item.textContent) === null || _item$textContent === void 0 ? void 0 : _item$textContent.length) !== null && _item$textContent$len !== void 0 ? _item$textContent$len : 0;
36792
+ if (offset <= acc + len) {
36793
+ return [item, Math.max(0, offset - acc)];
36794
+ }
36795
+ acc += len;
36796
+ }
36797
+ var lastText = texts[texts.length - 1];
36798
+ if (lastText) {
36799
+ var _lastText$textContent, _lastText$textContent2;
36800
+ return [lastText, (_lastText$textContent = (_lastText$textContent2 = lastText.textContent) === null || _lastText$textContent2 === void 0 ? void 0 : _lastText$textContent2.length) !== null && _lastText$textContent !== void 0 ? _lastText$textContent : 0];
36801
+ }
36802
+ return [node, 0];
36803
+ }
36804
+ function textOffsetIn(node, textNode, offset) {
36805
+ if (!node || !textNode || node === textNode) return offset;
36806
+ if (textNode.nodeType !== Node.TEXT_NODE) return offset;
36807
+ var walker = document.createTreeWalker(node, NodeFilter.SHOW_TEXT);
36808
+ var acc = 0;
36809
+ var text = walker.nextNode();
36810
+ while (text) {
36811
+ var _text$textContent$len, _text$textContent;
36812
+ if (text === textNode) return acc + offset;
36813
+ acc += (_text$textContent$len = (_text$textContent = text.textContent) === null || _text$textContent === void 0 ? void 0 : _text$textContent.length) !== null && _text$textContent$len !== void 0 ? _text$textContent$len : 0;
36814
+ text = walker.nextNode();
36815
+ }
36816
+ return acc + offset;
36817
+ }
36779
36818
  function setCaretPosition(ctx, textDom, children, pos) {
36780
36819
  try {
36820
+ var _ref, _el$childNodes$childr;
36781
36821
  var el = textDom;
36822
+ if (!el) {
36823
+ var _ctx$formulaCache, _ctx$formulaCache$ran;
36824
+ moveToEnd((_ctx$formulaCache = ctx.formulaCache) === null || _ctx$formulaCache === void 0 ? void 0 : (_ctx$formulaCache$ran = _ctx$formulaCache.rangeResizeTo) === null || _ctx$formulaCache$ran === void 0 ? void 0 : _ctx$formulaCache$ran[0]);
36825
+ return;
36826
+ }
36827
+ var startNode = children === 0 ? el : (_ref = (_el$childNodes$childr = el.childNodes[children]) !== null && _el$childNodes$childr !== void 0 ? _el$childNodes$childr : el.lastChild) !== null && _ref !== void 0 ? _ref : el;
36828
+ var _locateTextOffset = locateTextOffset(startNode, pos),
36829
+ _locateTextOffset2 = _slicedToArray(_locateTextOffset, 2),
36830
+ node = _locateTextOffset2[0],
36831
+ offset = _locateTextOffset2[1];
36782
36832
  var range = document.createRange();
36783
36833
  var sel = window.getSelection();
36784
- range.setStart(el.childNodes[children], pos);
36834
+ range.setStart(node, offset);
36785
36835
  range.collapse(true);
36786
36836
  sel === null || sel === void 0 ? void 0 : sel.removeAllRanges();
36787
36837
  sel === null || sel === void 0 ? void 0 : sel.addRange(range);
36788
36838
  el.focus();
36789
36839
  } catch (err) {
36790
- var _ctx$formulaCache, _ctx$formulaCache$ran;
36840
+ var _ctx$formulaCache2, _ctx$formulaCache2$ra;
36791
36841
  console.error(err);
36792
- moveToEnd((_ctx$formulaCache = ctx.formulaCache) === null || _ctx$formulaCache === void 0 ? void 0 : (_ctx$formulaCache$ran = _ctx$formulaCache.rangeResizeTo) === null || _ctx$formulaCache$ran === void 0 ? void 0 : _ctx$formulaCache$ran[0]);
36842
+ moveToEnd((_ctx$formulaCache2 = ctx.formulaCache) === null || _ctx$formulaCache2 === void 0 ? void 0 : (_ctx$formulaCache2$ra = _ctx$formulaCache2.rangeResizeTo) === null || _ctx$formulaCache2$ra === void 0 ? void 0 : _ctx$formulaCache2$ra[0]);
36793
36843
  }
36794
36844
  }
36795
36845
  function functionRange(ctx, obj, v, vp) {
@@ -36797,12 +36847,20 @@ function functionRange(ctx, obj, v, vp) {
36797
36847
  var currSelection = window.getSelection();
36798
36848
  if (!currSelection) return;
36799
36849
  var fri = findrangeindex(ctx, v, vp);
36800
- if (_.isNil(fri)) {
36850
+ var spanIndex = fri === null || fri === void 0 ? void 0 : fri[0];
36851
+ var caretOffset = fri === null || fri === void 0 ? void 0 : fri[1];
36852
+ if (_.isNil(spanIndex) || _.isNil(caretOffset)) {
36801
36853
  currSelection.selectAllChildren(obj);
36802
36854
  currSelection.collapseToEnd();
36803
- } else {
36804
- setCaretPosition(ctx, obj.querySelectorAll("span")[fri[0]], 0, fri[1]);
36855
+ return;
36856
+ }
36857
+ var targetSpan = obj.querySelectorAll("span")[spanIndex];
36858
+ if (!targetSpan) {
36859
+ currSelection.selectAllChildren(obj);
36860
+ currSelection.collapseToEnd();
36861
+ return;
36805
36862
  }
36863
+ setCaretPosition(ctx, targetSpan, 0, caretOffset);
36806
36864
  } else if (document.selection) {
36807
36865
  ctx.formulaCache.functionRangeIndex.moveToElementText(obj);
36808
36866
  ctx.formulaCache.functionRangeIndex.collapse(false);
@@ -36815,8 +36873,8 @@ function searchFunction(ctx, searchtxt) {
36815
36873
  var f = [];
36816
36874
  var s = [];
36817
36875
  var t = [];
36818
- for (var _i18 = 0; _i18 < functionlist.length; _i18 += 1) {
36819
- var item = functionlist[_i18];
36876
+ for (var _i19 = 0; _i19 < functionlist.length; _i19 += 1) {
36877
+ var item = functionlist[_i19];
36820
36878
  var n = item.n;
36821
36879
  if (n === searchtxt) {
36822
36880
  f.unshift(item);
@@ -36872,8 +36930,8 @@ function helpFunctionExe($editer, currSelection, ctx) {
36872
36930
  var _locale2 = locale(ctx),
36873
36931
  functionlist = _locale2.functionlist;
36874
36932
  if (_.isEmpty(ctx.formulaCache.functionlistMap)) {
36875
- for (var _i19 = 0; _i19 < functionlist.length; _i19 += 1) {
36876
- ctx.formulaCache.functionlistMap[functionlist[_i19].n] = functionlist[_i19];
36933
+ for (var _i20 = 0; _i20 < functionlist.length; _i20 += 1) {
36934
+ ctx.formulaCache.functionlistMap[functionlist[_i20].n] = functionlist[_i20];
36877
36935
  }
36878
36936
  }
36879
36937
  if (!currSelection) {
@@ -36886,6 +36944,9 @@ function helpFunctionExe($editer, currSelection, ctx) {
36886
36944
  if ($prev == null) {
36887
36945
  return null;
36888
36946
  }
36947
+ if (i < 0 || i >= $span.length || !($span[i] instanceof Element)) {
36948
+ return null;
36949
+ }
36889
36950
  var funcName = null;
36890
36951
  if ($span[i].classList.contains("luckysheet-formula-text-func")) {
36891
36952
  funcName = $span[i].textContent;
@@ -36921,6 +36982,9 @@ function helpFunctionExe($editer, currSelection, ctx) {
36921
36982
  function rangeHightlightselected(ctx, $editor) {
36922
36983
  var currSelection = getrangeseleciton();
36923
36984
  if (!currSelection) return;
36985
+ if (!($editor.contains(currSelection) || $editor === currSelection) || currSelection.nodeType !== Node.ELEMENT_NODE) {
36986
+ return;
36987
+ }
36924
36988
  var currText = _.trimStart(currSelection.textContent || "");
36925
36989
  if (currText === null || currText === void 0 ? void 0 : currText.match(/^[a-zA-Z_]+$/)) {
36926
36990
  searchFunction(ctx, currText.toUpperCase());
@@ -37094,16 +37158,20 @@ function handleFormulaInput(ctx, $copyTo, $editor, kcode, preText) {
37094
37158
  value1 = functionHTMLGenerate(value1txt);
37095
37159
  rangeIndexes = [];
37096
37160
  if (window.getSelection) {
37097
- var _currSelection$anchor;
37098
37161
  var currSelection = window.getSelection();
37099
37162
  if (!currSelection) return;
37100
- if (((_currSelection$anchor = currSelection.anchorNode) === null || _currSelection$anchor === void 0 ? void 0 : _currSelection$anchor.nodeName.toLowerCase()) === "div") {
37101
- var _$editor$querySelecto;
37102
- var editorlen = $editor.querySelectorAll("span").length;
37103
- ctx.formulaCache.functionRangeIndex = [editorlen - 1, (_$editor$querySelecto = $editor.querySelectorAll("span").item(editorlen - 1).textContent) === null || _$editor$querySelecto === void 0 ? void 0 : _$editor$querySelecto.length];
37163
+ var anchorNode = currSelection.anchorNode;
37164
+ if ((anchorNode === null || anchorNode === void 0 ? void 0 : anchorNode.nodeName.toLowerCase()) === "div" || (anchorNode === null || anchorNode === void 0 ? void 0 : anchorNode.parentNode) === $editor) {
37165
+ var _lastSpan$textContent, _lastSpan$textContent2;
37166
+ var spanList = $editor.querySelectorAll("span");
37167
+ var lastSpan = spanList.item(spanList.length - 1);
37168
+ ctx.formulaCache.functionRangeIndex = [spanList.length - 1, (_lastSpan$textContent = lastSpan === null || lastSpan === void 0 ? void 0 : (_lastSpan$textContent2 = lastSpan.textContent) === null || _lastSpan$textContent2 === void 0 ? void 0 : _lastSpan$textContent2.length) !== null && _lastSpan$textContent !== void 0 ? _lastSpan$textContent : 0];
37104
37169
  } else {
37105
- var _currSelection$anchor2, _currSelection$anchor3, _currSelection$anchor4, _currSelection$anchor5;
37106
- ctx.formulaCache.functionRangeIndex = [_.indexOf((_currSelection$anchor2 = currSelection.anchorNode) === null || _currSelection$anchor2 === void 0 ? void 0 : (_currSelection$anchor3 = _currSelection$anchor2.parentNode) === null || _currSelection$anchor3 === void 0 ? void 0 : (_currSelection$anchor4 = _currSelection$anchor3.parentNode) === null || _currSelection$anchor4 === void 0 ? void 0 : _currSelection$anchor4.childNodes, (_currSelection$anchor5 = currSelection.anchorNode) === null || _currSelection$anchor5 === void 0 ? void 0 : _currSelection$anchor5.parentNode), currSelection.anchorOffset];
37170
+ var span = (anchorNode === null || anchorNode === void 0 ? void 0 : anchorNode.nodeType) === Node.TEXT_NODE ? anchorNode.parentNode : anchorNode;
37171
+ while (span && span.parentNode !== $editor) {
37172
+ span = span.parentNode;
37173
+ }
37174
+ ctx.formulaCache.functionRangeIndex = [_.indexOf($editor.childNodes, span), textOffsetIn(span, anchorNode, currSelection.anchorOffset)];
37107
37175
  }
37108
37176
  } else {
37109
37177
  var textRange = document.selection.createRange();
@@ -58319,12 +58387,15 @@ function handleCellAreaDoubleClick(ctx, globalCache, settings, e, container) {
58319
58387
  var _margeset$column3 = _slicedToArray(margeset.column, 3);
58320
58388
  col_index = _margeset$column3[2];
58321
58389
  }
58322
- var _ctx$luckysheet_selec3 = ctx.luckysheet_select_save[0],
58323
- column_focus = _ctx$luckysheet_selec3.column_focus,
58324
- row_focus = _ctx$luckysheet_selec3.row_focus;
58325
- if (!_.isNil(column_focus) && !_.isNil(row_focus) && (column_focus !== col_index || row_focus !== row_index)) {
58326
- row_index = row_focus;
58327
- col_index = column_focus;
58390
+ var selectSave = ctx.luckysheet_select_save;
58391
+ if (selectSave && selectSave.length > 0) {
58392
+ var _selectSave$ = selectSave[0],
58393
+ column_focus = _selectSave$.column_focus,
58394
+ row_focus = _selectSave$.row_focus;
58395
+ if (!_.isNil(column_focus) && !_.isNil(row_focus) && (column_focus !== col_index || row_focus !== row_index)) {
58396
+ row_index = row_focus;
58397
+ col_index = column_focus;
58398
+ }
58328
58399
  }
58329
58400
  luckysheetUpdateCell(ctx, row_index, col_index);
58330
58401
  }
@@ -58368,14 +58439,14 @@ function handleContextMenu(ctx, settings, e, workbookContainer, container, area)
58368
58439
  return obj_s.row != null && row_index >= obj_s.row[0] && row_index <= obj_s.row[1] && col_index >= obj_s.column[0] && col_index <= obj_s.column[1];
58369
58440
  });
58370
58441
  if (!isInSelection && (e.metaKey || e.ctrlKey)) {
58371
- var _flowdata$row_index$c, _ctx$luckysheet_selec5;
58442
+ var _flowdata$row_index$c, _ctx$luckysheet_selec4;
58372
58443
  if ((_flowdata$row_index$c = flowdata[row_index][col_index]) === null || _flowdata$row_index$c === void 0 ? void 0 : _flowdata$row_index$c.mc) {
58373
58444
  var changeparam = mergeMoveMain(ctx, [col_index, col_index], [row_index, row_index], {
58374
58445
  row_focus: row_index,
58375
58446
  column_focus: col_index
58376
58447
  }, row_pre, row, col_pre, col);
58377
58448
  if (changeparam != null) {
58378
- var _ctx$luckysheet_selec4;
58449
+ var _ctx$luckysheet_selec3;
58379
58450
  var _changeparam4 = _slicedToArray(changeparam, 6),
58380
58451
  columnseleted = _changeparam4[0],
58381
58452
  rowseleted = _changeparam4[1],
@@ -58383,7 +58454,7 @@ function handleContextMenu(ctx, settings, e, workbookContainer, container, area)
58383
58454
  height = _changeparam4[3],
58384
58455
  left = _changeparam4[4],
58385
58456
  width = _changeparam4[5];
58386
- (_ctx$luckysheet_selec4 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec4 === void 0 ? void 0 : _ctx$luckysheet_selec4.push({
58457
+ (_ctx$luckysheet_selec3 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec3 === void 0 ? void 0 : _ctx$luckysheet_selec3.push({
58387
58458
  left: left,
58388
58459
  width: width - 1,
58389
58460
  top: top,
@@ -58400,7 +58471,7 @@ function handleContextMenu(ctx, settings, e, workbookContainer, container, area)
58400
58471
  return;
58401
58472
  }
58402
58473
  }
58403
- (_ctx$luckysheet_selec5 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec5 === void 0 ? void 0 : _ctx$luckysheet_selec5.push({
58474
+ (_ctx$luckysheet_selec4 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec4 === void 0 ? void 0 : _ctx$luckysheet_selec4.push({
58404
58475
  left: col_pre,
58405
58476
  width: col - col_pre - 1,
58406
58477
  top: row_pre,
@@ -58576,7 +58647,7 @@ function mouseRender(ctx, globalCache, e, cellInput, scrollX, scrollY, container
58576
58647
  return;
58577
58648
  }
58578
58649
  if (ctx.luckysheet_select_status) {
58579
- var _globalCache$freezen6, _ctx$luckysheet_selec6, _globalCache$freezen7;
58650
+ var _globalCache$freezen6, _ctx$luckysheet_selec5, _globalCache$freezen7;
58580
58651
  var mouseX = e.pageX - rect.left - window.scrollX;
58581
58652
  var mouseY = e.pageY - rect.top - window.scrollY;
58582
58653
  var _x = mouseX - ctx.rowHeaderWidth + ctx.scrollLeft;
@@ -58597,7 +58668,7 @@ function mouseRender(ctx, globalCache, e, cellInput, scrollX, scrollY, container
58597
58668
  ctx.luckysheet_select_status = false;
58598
58669
  return;
58599
58670
  }
58600
- var last = _.cloneDeep((_ctx$luckysheet_selec6 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec6 === void 0 ? void 0 : _ctx$luckysheet_selec6[ctx.luckysheet_select_save.length - 1]);
58671
+ var last = _.cloneDeep((_ctx$luckysheet_selec5 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec5 === void 0 ? void 0 : _ctx$luckysheet_selec5[ctx.luckysheet_select_save.length - 1]);
58601
58672
  if (!last || _.isNil(last.left) || _.isNil(last.top) || _.isNil(last.height) || _.isNil(last.width) || _.isNil(last.row_focus) || _.isNil(last.column_focus)) {
58602
58673
  return;
58603
58674
  }
@@ -58796,7 +58867,7 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58796
58867
  ctx.luckysheet_cols_selected_status = false;
58797
58868
  ctx.luckysheet_model_move_state = false;
58798
58869
  if (ctx.luckysheet_rows_change_size) {
58799
- var _ctx$luckysheet_selec7, _ctx$luckysheet_selec8;
58870
+ var _ctx$luckysheet_selec6, _ctx$luckysheet_selec7;
58800
58871
  ctx.luckysheet_rows_change_size = false;
58801
58872
  var scrollTop = ctx.scrollTop;
58802
58873
  var y = e.pageY - rect.top - ctx.columnHeaderHeight + scrollTop - window.scrollY;
@@ -58823,11 +58894,11 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58823
58894
  cfg.customHeight[ctx.luckysheet_rows_change_size_start[1]] = 1;
58824
58895
  var changeRowIndex = ctx.luckysheet_rows_change_size_start[1];
58825
58896
  var changeRowSelected = false;
58826
- if (((_ctx$luckysheet_selec7 = (_ctx$luckysheet_selec8 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec8 === void 0 ? void 0 : _ctx$luckysheet_selec8.length) !== null && _ctx$luckysheet_selec7 !== void 0 ? _ctx$luckysheet_selec7 : 0) > 0) {
58827
- var _ctx$luckysheet_selec9, _ctx$luckysheet_selec10;
58828
- (_ctx$luckysheet_selec9 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec9 === void 0 ? void 0 : (_ctx$luckysheet_selec10 = _ctx$luckysheet_selec9.filter(function (select) {
58897
+ if (((_ctx$luckysheet_selec6 = (_ctx$luckysheet_selec7 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec7 === void 0 ? void 0 : _ctx$luckysheet_selec7.length) !== null && _ctx$luckysheet_selec6 !== void 0 ? _ctx$luckysheet_selec6 : 0) > 0) {
58898
+ var _ctx$luckysheet_selec8, _ctx$luckysheet_selec9;
58899
+ (_ctx$luckysheet_selec8 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec8 === void 0 ? void 0 : (_ctx$luckysheet_selec9 = _ctx$luckysheet_selec8.filter(function (select) {
58829
58900
  return select.row_select;
58830
- })) === null || _ctx$luckysheet_selec10 === void 0 ? void 0 : _ctx$luckysheet_selec10.some(function (select) {
58901
+ })) === null || _ctx$luckysheet_selec9 === void 0 ? void 0 : _ctx$luckysheet_selec9.some(function (select) {
58831
58902
  if (changeRowIndex >= select.row[0] && changeRowIndex <= select.row[1]) {
58832
58903
  changeRowSelected = true;
58833
58904
  }
@@ -58835,11 +58906,11 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58835
58906
  });
58836
58907
  }
58837
58908
  if (changeRowSelected) {
58838
- var _ctx$luckysheet_selec11, _ctx$luckysheet_selec12;
58909
+ var _ctx$luckysheet_selec10, _ctx$luckysheet_selec11;
58839
58910
  cfg.rowlen || (cfg.rowlen = {});
58840
- (_ctx$luckysheet_selec11 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec11 === void 0 ? void 0 : (_ctx$luckysheet_selec12 = _ctx$luckysheet_selec11.filter(function (select) {
58911
+ (_ctx$luckysheet_selec10 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec10 === void 0 ? void 0 : (_ctx$luckysheet_selec11 = _ctx$luckysheet_selec10.filter(function (select) {
58841
58912
  return select.row_select;
58842
- })) === null || _ctx$luckysheet_selec12 === void 0 ? void 0 : _ctx$luckysheet_selec12.forEach(function (select) {
58913
+ })) === null || _ctx$luckysheet_selec11 === void 0 ? void 0 : _ctx$luckysheet_selec11.forEach(function (select) {
58843
58914
  for (var r = select.row[0]; r <= select.row[1]; r += 1) {
58844
58915
  cfg.rowlen[r] = Math.ceil(size / ctx.zoomRatio);
58845
58916
  }
@@ -58853,7 +58924,7 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58853
58924
  ctx.luckysheetfile[idx].config = ctx.config;
58854
58925
  }
58855
58926
  if (ctx.luckysheet_cols_change_size) {
58856
- var _ctx$luckysheet_selec13, _ctx$luckysheet_selec14;
58927
+ var _ctx$luckysheet_selec12, _ctx$luckysheet_selec13;
58857
58928
  ctx.luckysheet_cols_change_size = false;
58858
58929
  var scrollLeft = ctx.scrollLeft;
58859
58930
  var x = e.pageX - rect.left - ctx.rowHeaderWidth + scrollLeft - window.scrollX;
@@ -58884,11 +58955,11 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58884
58955
  _cfg.customWidth[ctx.luckysheet_cols_change_size_start[1]] = 1;
58885
58956
  var changeColumnIndex = ctx.luckysheet_cols_change_size_start[1];
58886
58957
  var changeColumnSelected = false;
58887
- if (((_ctx$luckysheet_selec13 = (_ctx$luckysheet_selec14 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec14 === void 0 ? void 0 : _ctx$luckysheet_selec14.length) !== null && _ctx$luckysheet_selec13 !== void 0 ? _ctx$luckysheet_selec13 : 0) > 0) {
58888
- var _ctx$luckysheet_selec15, _ctx$luckysheet_selec16;
58889
- (_ctx$luckysheet_selec15 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec15 === void 0 ? void 0 : (_ctx$luckysheet_selec16 = _ctx$luckysheet_selec15.filter(function (select) {
58958
+ if (((_ctx$luckysheet_selec12 = (_ctx$luckysheet_selec13 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec13 === void 0 ? void 0 : _ctx$luckysheet_selec13.length) !== null && _ctx$luckysheet_selec12 !== void 0 ? _ctx$luckysheet_selec12 : 0) > 0) {
58959
+ var _ctx$luckysheet_selec14, _ctx$luckysheet_selec15;
58960
+ (_ctx$luckysheet_selec14 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec14 === void 0 ? void 0 : (_ctx$luckysheet_selec15 = _ctx$luckysheet_selec14.filter(function (select) {
58890
58961
  return select.column_select;
58891
- })) === null || _ctx$luckysheet_selec16 === void 0 ? void 0 : _ctx$luckysheet_selec16.some(function (select) {
58962
+ })) === null || _ctx$luckysheet_selec15 === void 0 ? void 0 : _ctx$luckysheet_selec15.some(function (select) {
58892
58963
  if (changeColumnIndex >= select.column[0] && changeColumnIndex <= select.column[1]) {
58893
58964
  changeColumnSelected = true;
58894
58965
  }
@@ -58896,11 +58967,11 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58896
58967
  });
58897
58968
  }
58898
58969
  if (changeColumnSelected) {
58899
- var _ctx$luckysheet_selec17, _ctx$luckysheet_selec18;
58970
+ var _ctx$luckysheet_selec16, _ctx$luckysheet_selec17;
58900
58971
  _cfg.columnlen || (_cfg.columnlen = {});
58901
- (_ctx$luckysheet_selec17 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec17 === void 0 ? void 0 : (_ctx$luckysheet_selec18 = _ctx$luckysheet_selec17.filter(function (select) {
58972
+ (_ctx$luckysheet_selec16 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec16 === void 0 ? void 0 : (_ctx$luckysheet_selec17 = _ctx$luckysheet_selec16.filter(function (select) {
58902
58973
  return select.column_select;
58903
- })) === null || _ctx$luckysheet_selec18 === void 0 ? void 0 : _ctx$luckysheet_selec18.forEach(function (select) {
58974
+ })) === null || _ctx$luckysheet_selec17 === void 0 ? void 0 : _ctx$luckysheet_selec17.forEach(function (select) {
58904
58975
  for (var r = select.column[0]; r <= select.column[1]; r += 1) {
58905
58976
  _cfg.columnlen[r] = Math.ceil(_size / ctx.zoomRatio);
58906
58977
  }
@@ -59184,8 +59255,8 @@ function handleRowHeaderMouseDown(ctx, globalCache, e, container, cellInput, fxI
59184
59255
  }
59185
59256
  if (ctx.luckysheet_rows_selected_status) {
59186
59257
  if (e.shiftKey) {
59187
- var _ctx$luckysheet_selec19;
59188
- var _last2 = _.cloneDeep((_ctx$luckysheet_selec19 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec19 === void 0 ? void 0 : _ctx$luckysheet_selec19[ctx.luckysheet_select_save.length - 1]);
59258
+ var _ctx$luckysheet_selec18;
59259
+ var _last2 = _.cloneDeep((_ctx$luckysheet_selec18 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec18 === void 0 ? void 0 : _ctx$luckysheet_selec18[ctx.luckysheet_select_save.length - 1]);
59189
59260
  if (!_last2 || _.isNil(_last2.top) || _.isNil(_last2.height) || _.isNil(_last2.row_focus)) {
59190
59261
  return;
59191
59262
  }
@@ -59216,8 +59287,8 @@ function handleRowHeaderMouseDown(ctx, globalCache, e, container, cellInput, fxI
59216
59287
  _last2.height_move = _height;
59217
59288
  ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1] = _last2;
59218
59289
  } else if (e.ctrlKey || e.metaKey) {
59219
- var _ctx$luckysheet_selec20;
59220
- (_ctx$luckysheet_selec20 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec20 === void 0 ? void 0 : _ctx$luckysheet_selec20.push({
59290
+ var _ctx$luckysheet_selec19;
59291
+ (_ctx$luckysheet_selec19 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec19 === void 0 ? void 0 : _ctx$luckysheet_selec19.push({
59221
59292
  left: colLocationByIndex(0, ctx.visibledatacolumn)[0],
59222
59293
  width: colLocationByIndex(0, ctx.visibledatacolumn)[1] - colLocationByIndex(0, ctx.visibledatacolumn)[0] - 1,
59223
59294
  top: top,
@@ -59424,8 +59495,8 @@ function handleColumnHeaderMouseDown(ctx, globalCache, e, container, cellInput,
59424
59495
  }
59425
59496
  if (ctx.luckysheet_cols_selected_status) {
59426
59497
  if (e.shiftKey) {
59427
- var _ctx$luckysheet_selec21;
59428
- var _last3 = _.cloneDeep((_ctx$luckysheet_selec21 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec21 === void 0 ? void 0 : _ctx$luckysheet_selec21[ctx.luckysheet_select_save.length - 1]);
59498
+ var _ctx$luckysheet_selec20;
59499
+ var _last3 = _.cloneDeep((_ctx$luckysheet_selec20 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec20 === void 0 ? void 0 : _ctx$luckysheet_selec20[ctx.luckysheet_select_save.length - 1]);
59429
59500
  var _left = 0;
59430
59501
  var _width = 0;
59431
59502
  var _columnseleted = [];
@@ -59456,8 +59527,8 @@ function handleColumnHeaderMouseDown(ctx, globalCache, e, container, cellInput,
59456
59527
  _last3.width_move = _width;
59457
59528
  ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1] = _last3;
59458
59529
  } else if (e.ctrlKey || e.metaKey) {
59459
- var _ctx$luckysheet_selec22;
59460
- (_ctx$luckysheet_selec22 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec22 === void 0 ? void 0 : _ctx$luckysheet_selec22.push({
59530
+ var _ctx$luckysheet_selec21;
59531
+ (_ctx$luckysheet_selec21 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec21 === void 0 ? void 0 : _ctx$luckysheet_selec21.push({
59461
59532
  left: left,
59462
59533
  width: width,
59463
59534
  top: rowLocationByIndex(0, ctx.visibledatarow)[0],
package/dist/index.js CHANGED
@@ -36714,11 +36714,8 @@ function findrangeindex(ctx, v, vp) {
36714
36714
  var _n2 = v_a[_i17];
36715
36715
  if (___default['default'].isNil(_p2)) {
36716
36716
  pfri[0] = v_a.length - 1;
36717
- if (!___default['default'].isNil(_n2)) {
36718
- pfri[1] = _n2.length;
36719
- } else {
36720
- pfri[1] = 1;
36721
- }
36717
+ var last = v_a[pfri[0]];
36718
+ pfri[1] = ___default['default'].isNil(last) ? 1 : last.length;
36722
36719
  } else if (_p2.length === _n2.length) {
36723
36720
  if (vp_a[_i17 + 1] != null && (vp_a[_i17 + 1].substring(0, 1) === '"' || vp_a[_i17 + 1].substring(0, 1) === "{" || vp_a[_i17 + 1].substring(0, 1) === "}")) {
36724
36721
  pfri[1] = _n2.length;
@@ -36786,20 +36783,73 @@ function createRangeHightlight(ctx, inputInnerHtmlStr) {
36786
36783
  });
36787
36784
  ctx.formulaRangeHighlight = formulaRanges;
36788
36785
  }
36786
+ function locateTextOffset(node, offset) {
36787
+ var texts = [];
36788
+ if (node.nodeType === Node.TEXT_NODE) {
36789
+ texts.push(node);
36790
+ }
36791
+ var walker = document.createTreeWalker(node, NodeFilter.SHOW_TEXT);
36792
+ var text = walker.nextNode();
36793
+ while (text) {
36794
+ texts.push(text);
36795
+ text = walker.nextNode();
36796
+ }
36797
+ var acc = 0;
36798
+ for (var _i18 = 0; _i18 < texts.length; _i18 += 1) {
36799
+ var _item$textContent$len, _item$textContent;
36800
+ var item = texts[_i18];
36801
+ var len = (_item$textContent$len = (_item$textContent = item.textContent) === null || _item$textContent === void 0 ? void 0 : _item$textContent.length) !== null && _item$textContent$len !== void 0 ? _item$textContent$len : 0;
36802
+ if (offset <= acc + len) {
36803
+ return [item, Math.max(0, offset - acc)];
36804
+ }
36805
+ acc += len;
36806
+ }
36807
+ var lastText = texts[texts.length - 1];
36808
+ if (lastText) {
36809
+ var _lastText$textContent, _lastText$textContent2;
36810
+ return [lastText, (_lastText$textContent = (_lastText$textContent2 = lastText.textContent) === null || _lastText$textContent2 === void 0 ? void 0 : _lastText$textContent2.length) !== null && _lastText$textContent !== void 0 ? _lastText$textContent : 0];
36811
+ }
36812
+ return [node, 0];
36813
+ }
36814
+ function textOffsetIn(node, textNode, offset) {
36815
+ if (!node || !textNode || node === textNode) return offset;
36816
+ if (textNode.nodeType !== Node.TEXT_NODE) return offset;
36817
+ var walker = document.createTreeWalker(node, NodeFilter.SHOW_TEXT);
36818
+ var acc = 0;
36819
+ var text = walker.nextNode();
36820
+ while (text) {
36821
+ var _text$textContent$len, _text$textContent;
36822
+ if (text === textNode) return acc + offset;
36823
+ acc += (_text$textContent$len = (_text$textContent = text.textContent) === null || _text$textContent === void 0 ? void 0 : _text$textContent.length) !== null && _text$textContent$len !== void 0 ? _text$textContent$len : 0;
36824
+ text = walker.nextNode();
36825
+ }
36826
+ return acc + offset;
36827
+ }
36789
36828
  function setCaretPosition(ctx, textDom, children, pos) {
36790
36829
  try {
36830
+ var _ref, _el$childNodes$childr;
36791
36831
  var el = textDom;
36832
+ if (!el) {
36833
+ var _ctx$formulaCache, _ctx$formulaCache$ran;
36834
+ moveToEnd((_ctx$formulaCache = ctx.formulaCache) === null || _ctx$formulaCache === void 0 ? void 0 : (_ctx$formulaCache$ran = _ctx$formulaCache.rangeResizeTo) === null || _ctx$formulaCache$ran === void 0 ? void 0 : _ctx$formulaCache$ran[0]);
36835
+ return;
36836
+ }
36837
+ var startNode = children === 0 ? el : (_ref = (_el$childNodes$childr = el.childNodes[children]) !== null && _el$childNodes$childr !== void 0 ? _el$childNodes$childr : el.lastChild) !== null && _ref !== void 0 ? _ref : el;
36838
+ var _locateTextOffset = locateTextOffset(startNode, pos),
36839
+ _locateTextOffset2 = _slicedToArray(_locateTextOffset, 2),
36840
+ node = _locateTextOffset2[0],
36841
+ offset = _locateTextOffset2[1];
36792
36842
  var range = document.createRange();
36793
36843
  var sel = window.getSelection();
36794
- range.setStart(el.childNodes[children], pos);
36844
+ range.setStart(node, offset);
36795
36845
  range.collapse(true);
36796
36846
  sel === null || sel === void 0 ? void 0 : sel.removeAllRanges();
36797
36847
  sel === null || sel === void 0 ? void 0 : sel.addRange(range);
36798
36848
  el.focus();
36799
36849
  } catch (err) {
36800
- var _ctx$formulaCache, _ctx$formulaCache$ran;
36850
+ var _ctx$formulaCache2, _ctx$formulaCache2$ra;
36801
36851
  console.error(err);
36802
- moveToEnd((_ctx$formulaCache = ctx.formulaCache) === null || _ctx$formulaCache === void 0 ? void 0 : (_ctx$formulaCache$ran = _ctx$formulaCache.rangeResizeTo) === null || _ctx$formulaCache$ran === void 0 ? void 0 : _ctx$formulaCache$ran[0]);
36852
+ moveToEnd((_ctx$formulaCache2 = ctx.formulaCache) === null || _ctx$formulaCache2 === void 0 ? void 0 : (_ctx$formulaCache2$ra = _ctx$formulaCache2.rangeResizeTo) === null || _ctx$formulaCache2$ra === void 0 ? void 0 : _ctx$formulaCache2$ra[0]);
36803
36853
  }
36804
36854
  }
36805
36855
  function functionRange(ctx, obj, v, vp) {
@@ -36807,12 +36857,20 @@ function functionRange(ctx, obj, v, vp) {
36807
36857
  var currSelection = window.getSelection();
36808
36858
  if (!currSelection) return;
36809
36859
  var fri = findrangeindex(ctx, v, vp);
36810
- if (___default['default'].isNil(fri)) {
36860
+ var spanIndex = fri === null || fri === void 0 ? void 0 : fri[0];
36861
+ var caretOffset = fri === null || fri === void 0 ? void 0 : fri[1];
36862
+ if (___default['default'].isNil(spanIndex) || ___default['default'].isNil(caretOffset)) {
36811
36863
  currSelection.selectAllChildren(obj);
36812
36864
  currSelection.collapseToEnd();
36813
- } else {
36814
- setCaretPosition(ctx, obj.querySelectorAll("span")[fri[0]], 0, fri[1]);
36865
+ return;
36866
+ }
36867
+ var targetSpan = obj.querySelectorAll("span")[spanIndex];
36868
+ if (!targetSpan) {
36869
+ currSelection.selectAllChildren(obj);
36870
+ currSelection.collapseToEnd();
36871
+ return;
36815
36872
  }
36873
+ setCaretPosition(ctx, targetSpan, 0, caretOffset);
36816
36874
  } else if (document.selection) {
36817
36875
  ctx.formulaCache.functionRangeIndex.moveToElementText(obj);
36818
36876
  ctx.formulaCache.functionRangeIndex.collapse(false);
@@ -36825,8 +36883,8 @@ function searchFunction(ctx, searchtxt) {
36825
36883
  var f = [];
36826
36884
  var s = [];
36827
36885
  var t = [];
36828
- for (var _i18 = 0; _i18 < functionlist.length; _i18 += 1) {
36829
- var item = functionlist[_i18];
36886
+ for (var _i19 = 0; _i19 < functionlist.length; _i19 += 1) {
36887
+ var item = functionlist[_i19];
36830
36888
  var n = item.n;
36831
36889
  if (n === searchtxt) {
36832
36890
  f.unshift(item);
@@ -36882,8 +36940,8 @@ function helpFunctionExe($editer, currSelection, ctx) {
36882
36940
  var _locale2 = locale(ctx),
36883
36941
  functionlist = _locale2.functionlist;
36884
36942
  if (___default['default'].isEmpty(ctx.formulaCache.functionlistMap)) {
36885
- for (var _i19 = 0; _i19 < functionlist.length; _i19 += 1) {
36886
- ctx.formulaCache.functionlistMap[functionlist[_i19].n] = functionlist[_i19];
36943
+ for (var _i20 = 0; _i20 < functionlist.length; _i20 += 1) {
36944
+ ctx.formulaCache.functionlistMap[functionlist[_i20].n] = functionlist[_i20];
36887
36945
  }
36888
36946
  }
36889
36947
  if (!currSelection) {
@@ -36896,6 +36954,9 @@ function helpFunctionExe($editer, currSelection, ctx) {
36896
36954
  if ($prev == null) {
36897
36955
  return null;
36898
36956
  }
36957
+ if (i < 0 || i >= $span.length || !($span[i] instanceof Element)) {
36958
+ return null;
36959
+ }
36899
36960
  var funcName = null;
36900
36961
  if ($span[i].classList.contains("luckysheet-formula-text-func")) {
36901
36962
  funcName = $span[i].textContent;
@@ -36931,6 +36992,9 @@ function helpFunctionExe($editer, currSelection, ctx) {
36931
36992
  function rangeHightlightselected(ctx, $editor) {
36932
36993
  var currSelection = getrangeseleciton();
36933
36994
  if (!currSelection) return;
36995
+ if (!($editor.contains(currSelection) || $editor === currSelection) || currSelection.nodeType !== Node.ELEMENT_NODE) {
36996
+ return;
36997
+ }
36934
36998
  var currText = ___default['default'].trimStart(currSelection.textContent || "");
36935
36999
  if (currText === null || currText === void 0 ? void 0 : currText.match(/^[a-zA-Z_]+$/)) {
36936
37000
  searchFunction(ctx, currText.toUpperCase());
@@ -37104,16 +37168,20 @@ function handleFormulaInput(ctx, $copyTo, $editor, kcode, preText) {
37104
37168
  value1 = functionHTMLGenerate(value1txt);
37105
37169
  rangeIndexes = [];
37106
37170
  if (window.getSelection) {
37107
- var _currSelection$anchor;
37108
37171
  var currSelection = window.getSelection();
37109
37172
  if (!currSelection) return;
37110
- if (((_currSelection$anchor = currSelection.anchorNode) === null || _currSelection$anchor === void 0 ? void 0 : _currSelection$anchor.nodeName.toLowerCase()) === "div") {
37111
- var _$editor$querySelecto;
37112
- var editorlen = $editor.querySelectorAll("span").length;
37113
- ctx.formulaCache.functionRangeIndex = [editorlen - 1, (_$editor$querySelecto = $editor.querySelectorAll("span").item(editorlen - 1).textContent) === null || _$editor$querySelecto === void 0 ? void 0 : _$editor$querySelecto.length];
37173
+ var anchorNode = currSelection.anchorNode;
37174
+ if ((anchorNode === null || anchorNode === void 0 ? void 0 : anchorNode.nodeName.toLowerCase()) === "div" || (anchorNode === null || anchorNode === void 0 ? void 0 : anchorNode.parentNode) === $editor) {
37175
+ var _lastSpan$textContent, _lastSpan$textContent2;
37176
+ var spanList = $editor.querySelectorAll("span");
37177
+ var lastSpan = spanList.item(spanList.length - 1);
37178
+ ctx.formulaCache.functionRangeIndex = [spanList.length - 1, (_lastSpan$textContent = lastSpan === null || lastSpan === void 0 ? void 0 : (_lastSpan$textContent2 = lastSpan.textContent) === null || _lastSpan$textContent2 === void 0 ? void 0 : _lastSpan$textContent2.length) !== null && _lastSpan$textContent !== void 0 ? _lastSpan$textContent : 0];
37114
37179
  } else {
37115
- var _currSelection$anchor2, _currSelection$anchor3, _currSelection$anchor4, _currSelection$anchor5;
37116
- ctx.formulaCache.functionRangeIndex = [___default['default'].indexOf((_currSelection$anchor2 = currSelection.anchorNode) === null || _currSelection$anchor2 === void 0 ? void 0 : (_currSelection$anchor3 = _currSelection$anchor2.parentNode) === null || _currSelection$anchor3 === void 0 ? void 0 : (_currSelection$anchor4 = _currSelection$anchor3.parentNode) === null || _currSelection$anchor4 === void 0 ? void 0 : _currSelection$anchor4.childNodes, (_currSelection$anchor5 = currSelection.anchorNode) === null || _currSelection$anchor5 === void 0 ? void 0 : _currSelection$anchor5.parentNode), currSelection.anchorOffset];
37180
+ var span = (anchorNode === null || anchorNode === void 0 ? void 0 : anchorNode.nodeType) === Node.TEXT_NODE ? anchorNode.parentNode : anchorNode;
37181
+ while (span && span.parentNode !== $editor) {
37182
+ span = span.parentNode;
37183
+ }
37184
+ ctx.formulaCache.functionRangeIndex = [___default['default'].indexOf($editor.childNodes, span), textOffsetIn(span, anchorNode, currSelection.anchorOffset)];
37117
37185
  }
37118
37186
  } else {
37119
37187
  var textRange = document.selection.createRange();
@@ -58329,12 +58397,15 @@ function handleCellAreaDoubleClick(ctx, globalCache, settings, e, container) {
58329
58397
  var _margeset$column3 = _slicedToArray(margeset.column, 3);
58330
58398
  col_index = _margeset$column3[2];
58331
58399
  }
58332
- var _ctx$luckysheet_selec3 = ctx.luckysheet_select_save[0],
58333
- column_focus = _ctx$luckysheet_selec3.column_focus,
58334
- row_focus = _ctx$luckysheet_selec3.row_focus;
58335
- if (!___default['default'].isNil(column_focus) && !___default['default'].isNil(row_focus) && (column_focus !== col_index || row_focus !== row_index)) {
58336
- row_index = row_focus;
58337
- col_index = column_focus;
58400
+ var selectSave = ctx.luckysheet_select_save;
58401
+ if (selectSave && selectSave.length > 0) {
58402
+ var _selectSave$ = selectSave[0],
58403
+ column_focus = _selectSave$.column_focus,
58404
+ row_focus = _selectSave$.row_focus;
58405
+ if (!___default['default'].isNil(column_focus) && !___default['default'].isNil(row_focus) && (column_focus !== col_index || row_focus !== row_index)) {
58406
+ row_index = row_focus;
58407
+ col_index = column_focus;
58408
+ }
58338
58409
  }
58339
58410
  luckysheetUpdateCell(ctx, row_index, col_index);
58340
58411
  }
@@ -58378,14 +58449,14 @@ function handleContextMenu(ctx, settings, e, workbookContainer, container, area)
58378
58449
  return obj_s.row != null && row_index >= obj_s.row[0] && row_index <= obj_s.row[1] && col_index >= obj_s.column[0] && col_index <= obj_s.column[1];
58379
58450
  });
58380
58451
  if (!isInSelection && (e.metaKey || e.ctrlKey)) {
58381
- var _flowdata$row_index$c, _ctx$luckysheet_selec5;
58452
+ var _flowdata$row_index$c, _ctx$luckysheet_selec4;
58382
58453
  if ((_flowdata$row_index$c = flowdata[row_index][col_index]) === null || _flowdata$row_index$c === void 0 ? void 0 : _flowdata$row_index$c.mc) {
58383
58454
  var changeparam = mergeMoveMain(ctx, [col_index, col_index], [row_index, row_index], {
58384
58455
  row_focus: row_index,
58385
58456
  column_focus: col_index
58386
58457
  }, row_pre, row, col_pre, col);
58387
58458
  if (changeparam != null) {
58388
- var _ctx$luckysheet_selec4;
58459
+ var _ctx$luckysheet_selec3;
58389
58460
  var _changeparam4 = _slicedToArray(changeparam, 6),
58390
58461
  columnseleted = _changeparam4[0],
58391
58462
  rowseleted = _changeparam4[1],
@@ -58393,7 +58464,7 @@ function handleContextMenu(ctx, settings, e, workbookContainer, container, area)
58393
58464
  height = _changeparam4[3],
58394
58465
  left = _changeparam4[4],
58395
58466
  width = _changeparam4[5];
58396
- (_ctx$luckysheet_selec4 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec4 === void 0 ? void 0 : _ctx$luckysheet_selec4.push({
58467
+ (_ctx$luckysheet_selec3 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec3 === void 0 ? void 0 : _ctx$luckysheet_selec3.push({
58397
58468
  left: left,
58398
58469
  width: width - 1,
58399
58470
  top: top,
@@ -58410,7 +58481,7 @@ function handleContextMenu(ctx, settings, e, workbookContainer, container, area)
58410
58481
  return;
58411
58482
  }
58412
58483
  }
58413
- (_ctx$luckysheet_selec5 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec5 === void 0 ? void 0 : _ctx$luckysheet_selec5.push({
58484
+ (_ctx$luckysheet_selec4 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec4 === void 0 ? void 0 : _ctx$luckysheet_selec4.push({
58414
58485
  left: col_pre,
58415
58486
  width: col - col_pre - 1,
58416
58487
  top: row_pre,
@@ -58586,7 +58657,7 @@ function mouseRender(ctx, globalCache, e, cellInput, scrollX, scrollY, container
58586
58657
  return;
58587
58658
  }
58588
58659
  if (ctx.luckysheet_select_status) {
58589
- var _globalCache$freezen6, _ctx$luckysheet_selec6, _globalCache$freezen7;
58660
+ var _globalCache$freezen6, _ctx$luckysheet_selec5, _globalCache$freezen7;
58590
58661
  var mouseX = e.pageX - rect.left - window.scrollX;
58591
58662
  var mouseY = e.pageY - rect.top - window.scrollY;
58592
58663
  var _x = mouseX - ctx.rowHeaderWidth + ctx.scrollLeft;
@@ -58607,7 +58678,7 @@ function mouseRender(ctx, globalCache, e, cellInput, scrollX, scrollY, container
58607
58678
  ctx.luckysheet_select_status = false;
58608
58679
  return;
58609
58680
  }
58610
- var last = ___default['default'].cloneDeep((_ctx$luckysheet_selec6 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec6 === void 0 ? void 0 : _ctx$luckysheet_selec6[ctx.luckysheet_select_save.length - 1]);
58681
+ var last = ___default['default'].cloneDeep((_ctx$luckysheet_selec5 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec5 === void 0 ? void 0 : _ctx$luckysheet_selec5[ctx.luckysheet_select_save.length - 1]);
58611
58682
  if (!last || ___default['default'].isNil(last.left) || ___default['default'].isNil(last.top) || ___default['default'].isNil(last.height) || ___default['default'].isNil(last.width) || ___default['default'].isNil(last.row_focus) || ___default['default'].isNil(last.column_focus)) {
58612
58683
  return;
58613
58684
  }
@@ -58806,7 +58877,7 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58806
58877
  ctx.luckysheet_cols_selected_status = false;
58807
58878
  ctx.luckysheet_model_move_state = false;
58808
58879
  if (ctx.luckysheet_rows_change_size) {
58809
- var _ctx$luckysheet_selec7, _ctx$luckysheet_selec8;
58880
+ var _ctx$luckysheet_selec6, _ctx$luckysheet_selec7;
58810
58881
  ctx.luckysheet_rows_change_size = false;
58811
58882
  var scrollTop = ctx.scrollTop;
58812
58883
  var y = e.pageY - rect.top - ctx.columnHeaderHeight + scrollTop - window.scrollY;
@@ -58833,11 +58904,11 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58833
58904
  cfg.customHeight[ctx.luckysheet_rows_change_size_start[1]] = 1;
58834
58905
  var changeRowIndex = ctx.luckysheet_rows_change_size_start[1];
58835
58906
  var changeRowSelected = false;
58836
- if (((_ctx$luckysheet_selec7 = (_ctx$luckysheet_selec8 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec8 === void 0 ? void 0 : _ctx$luckysheet_selec8.length) !== null && _ctx$luckysheet_selec7 !== void 0 ? _ctx$luckysheet_selec7 : 0) > 0) {
58837
- var _ctx$luckysheet_selec9, _ctx$luckysheet_selec10;
58838
- (_ctx$luckysheet_selec9 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec9 === void 0 ? void 0 : (_ctx$luckysheet_selec10 = _ctx$luckysheet_selec9.filter(function (select) {
58907
+ if (((_ctx$luckysheet_selec6 = (_ctx$luckysheet_selec7 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec7 === void 0 ? void 0 : _ctx$luckysheet_selec7.length) !== null && _ctx$luckysheet_selec6 !== void 0 ? _ctx$luckysheet_selec6 : 0) > 0) {
58908
+ var _ctx$luckysheet_selec8, _ctx$luckysheet_selec9;
58909
+ (_ctx$luckysheet_selec8 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec8 === void 0 ? void 0 : (_ctx$luckysheet_selec9 = _ctx$luckysheet_selec8.filter(function (select) {
58839
58910
  return select.row_select;
58840
- })) === null || _ctx$luckysheet_selec10 === void 0 ? void 0 : _ctx$luckysheet_selec10.some(function (select) {
58911
+ })) === null || _ctx$luckysheet_selec9 === void 0 ? void 0 : _ctx$luckysheet_selec9.some(function (select) {
58841
58912
  if (changeRowIndex >= select.row[0] && changeRowIndex <= select.row[1]) {
58842
58913
  changeRowSelected = true;
58843
58914
  }
@@ -58845,11 +58916,11 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58845
58916
  });
58846
58917
  }
58847
58918
  if (changeRowSelected) {
58848
- var _ctx$luckysheet_selec11, _ctx$luckysheet_selec12;
58919
+ var _ctx$luckysheet_selec10, _ctx$luckysheet_selec11;
58849
58920
  cfg.rowlen || (cfg.rowlen = {});
58850
- (_ctx$luckysheet_selec11 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec11 === void 0 ? void 0 : (_ctx$luckysheet_selec12 = _ctx$luckysheet_selec11.filter(function (select) {
58921
+ (_ctx$luckysheet_selec10 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec10 === void 0 ? void 0 : (_ctx$luckysheet_selec11 = _ctx$luckysheet_selec10.filter(function (select) {
58851
58922
  return select.row_select;
58852
- })) === null || _ctx$luckysheet_selec12 === void 0 ? void 0 : _ctx$luckysheet_selec12.forEach(function (select) {
58923
+ })) === null || _ctx$luckysheet_selec11 === void 0 ? void 0 : _ctx$luckysheet_selec11.forEach(function (select) {
58853
58924
  for (var r = select.row[0]; r <= select.row[1]; r += 1) {
58854
58925
  cfg.rowlen[r] = Math.ceil(size / ctx.zoomRatio);
58855
58926
  }
@@ -58863,7 +58934,7 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58863
58934
  ctx.luckysheetfile[idx].config = ctx.config;
58864
58935
  }
58865
58936
  if (ctx.luckysheet_cols_change_size) {
58866
- var _ctx$luckysheet_selec13, _ctx$luckysheet_selec14;
58937
+ var _ctx$luckysheet_selec12, _ctx$luckysheet_selec13;
58867
58938
  ctx.luckysheet_cols_change_size = false;
58868
58939
  var scrollLeft = ctx.scrollLeft;
58869
58940
  var x = e.pageX - rect.left - ctx.rowHeaderWidth + scrollLeft - window.scrollX;
@@ -58894,11 +58965,11 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58894
58965
  _cfg.customWidth[ctx.luckysheet_cols_change_size_start[1]] = 1;
58895
58966
  var changeColumnIndex = ctx.luckysheet_cols_change_size_start[1];
58896
58967
  var changeColumnSelected = false;
58897
- if (((_ctx$luckysheet_selec13 = (_ctx$luckysheet_selec14 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec14 === void 0 ? void 0 : _ctx$luckysheet_selec14.length) !== null && _ctx$luckysheet_selec13 !== void 0 ? _ctx$luckysheet_selec13 : 0) > 0) {
58898
- var _ctx$luckysheet_selec15, _ctx$luckysheet_selec16;
58899
- (_ctx$luckysheet_selec15 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec15 === void 0 ? void 0 : (_ctx$luckysheet_selec16 = _ctx$luckysheet_selec15.filter(function (select) {
58968
+ if (((_ctx$luckysheet_selec12 = (_ctx$luckysheet_selec13 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec13 === void 0 ? void 0 : _ctx$luckysheet_selec13.length) !== null && _ctx$luckysheet_selec12 !== void 0 ? _ctx$luckysheet_selec12 : 0) > 0) {
58969
+ var _ctx$luckysheet_selec14, _ctx$luckysheet_selec15;
58970
+ (_ctx$luckysheet_selec14 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec14 === void 0 ? void 0 : (_ctx$luckysheet_selec15 = _ctx$luckysheet_selec14.filter(function (select) {
58900
58971
  return select.column_select;
58901
- })) === null || _ctx$luckysheet_selec16 === void 0 ? void 0 : _ctx$luckysheet_selec16.some(function (select) {
58972
+ })) === null || _ctx$luckysheet_selec15 === void 0 ? void 0 : _ctx$luckysheet_selec15.some(function (select) {
58902
58973
  if (changeColumnIndex >= select.column[0] && changeColumnIndex <= select.column[1]) {
58903
58974
  changeColumnSelected = true;
58904
58975
  }
@@ -58906,11 +58977,11 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58906
58977
  });
58907
58978
  }
58908
58979
  if (changeColumnSelected) {
58909
- var _ctx$luckysheet_selec17, _ctx$luckysheet_selec18;
58980
+ var _ctx$luckysheet_selec16, _ctx$luckysheet_selec17;
58910
58981
  _cfg.columnlen || (_cfg.columnlen = {});
58911
- (_ctx$luckysheet_selec17 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec17 === void 0 ? void 0 : (_ctx$luckysheet_selec18 = _ctx$luckysheet_selec17.filter(function (select) {
58982
+ (_ctx$luckysheet_selec16 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec16 === void 0 ? void 0 : (_ctx$luckysheet_selec17 = _ctx$luckysheet_selec16.filter(function (select) {
58912
58983
  return select.column_select;
58913
- })) === null || _ctx$luckysheet_selec18 === void 0 ? void 0 : _ctx$luckysheet_selec18.forEach(function (select) {
58984
+ })) === null || _ctx$luckysheet_selec17 === void 0 ? void 0 : _ctx$luckysheet_selec17.forEach(function (select) {
58914
58985
  for (var r = select.column[0]; r <= select.column[1]; r += 1) {
58915
58986
  _cfg.columnlen[r] = Math.ceil(_size / ctx.zoomRatio);
58916
58987
  }
@@ -59194,8 +59265,8 @@ function handleRowHeaderMouseDown(ctx, globalCache, e, container, cellInput, fxI
59194
59265
  }
59195
59266
  if (ctx.luckysheet_rows_selected_status) {
59196
59267
  if (e.shiftKey) {
59197
- var _ctx$luckysheet_selec19;
59198
- var _last2 = ___default['default'].cloneDeep((_ctx$luckysheet_selec19 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec19 === void 0 ? void 0 : _ctx$luckysheet_selec19[ctx.luckysheet_select_save.length - 1]);
59268
+ var _ctx$luckysheet_selec18;
59269
+ var _last2 = ___default['default'].cloneDeep((_ctx$luckysheet_selec18 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec18 === void 0 ? void 0 : _ctx$luckysheet_selec18[ctx.luckysheet_select_save.length - 1]);
59199
59270
  if (!_last2 || ___default['default'].isNil(_last2.top) || ___default['default'].isNil(_last2.height) || ___default['default'].isNil(_last2.row_focus)) {
59200
59271
  return;
59201
59272
  }
@@ -59226,8 +59297,8 @@ function handleRowHeaderMouseDown(ctx, globalCache, e, container, cellInput, fxI
59226
59297
  _last2.height_move = _height;
59227
59298
  ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1] = _last2;
59228
59299
  } else if (e.ctrlKey || e.metaKey) {
59229
- var _ctx$luckysheet_selec20;
59230
- (_ctx$luckysheet_selec20 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec20 === void 0 ? void 0 : _ctx$luckysheet_selec20.push({
59300
+ var _ctx$luckysheet_selec19;
59301
+ (_ctx$luckysheet_selec19 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec19 === void 0 ? void 0 : _ctx$luckysheet_selec19.push({
59231
59302
  left: colLocationByIndex(0, ctx.visibledatacolumn)[0],
59232
59303
  width: colLocationByIndex(0, ctx.visibledatacolumn)[1] - colLocationByIndex(0, ctx.visibledatacolumn)[0] - 1,
59233
59304
  top: top,
@@ -59434,8 +59505,8 @@ function handleColumnHeaderMouseDown(ctx, globalCache, e, container, cellInput,
59434
59505
  }
59435
59506
  if (ctx.luckysheet_cols_selected_status) {
59436
59507
  if (e.shiftKey) {
59437
- var _ctx$luckysheet_selec21;
59438
- var _last3 = ___default['default'].cloneDeep((_ctx$luckysheet_selec21 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec21 === void 0 ? void 0 : _ctx$luckysheet_selec21[ctx.luckysheet_select_save.length - 1]);
59508
+ var _ctx$luckysheet_selec20;
59509
+ var _last3 = ___default['default'].cloneDeep((_ctx$luckysheet_selec20 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec20 === void 0 ? void 0 : _ctx$luckysheet_selec20[ctx.luckysheet_select_save.length - 1]);
59439
59510
  var _left = 0;
59440
59511
  var _width = 0;
59441
59512
  var _columnseleted = [];
@@ -59466,8 +59537,8 @@ function handleColumnHeaderMouseDown(ctx, globalCache, e, container, cellInput,
59466
59537
  _last3.width_move = _width;
59467
59538
  ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1] = _last3;
59468
59539
  } else if (e.ctrlKey || e.metaKey) {
59469
- var _ctx$luckysheet_selec22;
59470
- (_ctx$luckysheet_selec22 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec22 === void 0 ? void 0 : _ctx$luckysheet_selec22.push({
59540
+ var _ctx$luckysheet_selec21;
59541
+ (_ctx$luckysheet_selec21 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec21 === void 0 ? void 0 : _ctx$luckysheet_selec21.push({
59471
59542
  left: left,
59472
59543
  width: width,
59473
59544
  top: rowLocationByIndex(0, ctx.visibledatarow)[0],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "5.2.72",
3
+ "version": "5.2.74",
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.72",
16
+ "@leankylin-sheet/formula-parser": "5.2.74",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",