@leankylin-sheet/core 5.2.73 → 5.2.75

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) {
@@ -37100,16 +37158,20 @@ function handleFormulaInput(ctx, $copyTo, $editor, kcode, preText) {
37100
37158
  value1 = functionHTMLGenerate(value1txt);
37101
37159
  rangeIndexes = [];
37102
37160
  if (window.getSelection) {
37103
- var _currSelection$anchor;
37104
37161
  var currSelection = window.getSelection();
37105
37162
  if (!currSelection) return;
37106
- if (((_currSelection$anchor = currSelection.anchorNode) === null || _currSelection$anchor === void 0 ? void 0 : _currSelection$anchor.nodeName.toLowerCase()) === "div") {
37107
- var _$editor$querySelecto;
37108
- var editorlen = $editor.querySelectorAll("span").length;
37109
- 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];
37110
37169
  } else {
37111
- var _currSelection$anchor2, _currSelection$anchor3, _currSelection$anchor4, _currSelection$anchor5;
37112
- 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)];
37113
37175
  }
37114
37176
  } else {
37115
37177
  var textRange = document.selection.createRange();
@@ -58325,12 +58387,15 @@ function handleCellAreaDoubleClick(ctx, globalCache, settings, e, container) {
58325
58387
  var _margeset$column3 = _slicedToArray(margeset.column, 3);
58326
58388
  col_index = _margeset$column3[2];
58327
58389
  }
58328
- var _ctx$luckysheet_selec3 = ctx.luckysheet_select_save[0],
58329
- column_focus = _ctx$luckysheet_selec3.column_focus,
58330
- row_focus = _ctx$luckysheet_selec3.row_focus;
58331
- if (!_.isNil(column_focus) && !_.isNil(row_focus) && (column_focus !== col_index || row_focus !== row_index)) {
58332
- row_index = row_focus;
58333
- 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
+ }
58334
58399
  }
58335
58400
  luckysheetUpdateCell(ctx, row_index, col_index);
58336
58401
  }
@@ -58374,14 +58439,14 @@ function handleContextMenu(ctx, settings, e, workbookContainer, container, area)
58374
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];
58375
58440
  });
58376
58441
  if (!isInSelection && (e.metaKey || e.ctrlKey)) {
58377
- var _flowdata$row_index$c, _ctx$luckysheet_selec5;
58442
+ var _flowdata$row_index$c, _ctx$luckysheet_selec4;
58378
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) {
58379
58444
  var changeparam = mergeMoveMain(ctx, [col_index, col_index], [row_index, row_index], {
58380
58445
  row_focus: row_index,
58381
58446
  column_focus: col_index
58382
58447
  }, row_pre, row, col_pre, col);
58383
58448
  if (changeparam != null) {
58384
- var _ctx$luckysheet_selec4;
58449
+ var _ctx$luckysheet_selec3;
58385
58450
  var _changeparam4 = _slicedToArray(changeparam, 6),
58386
58451
  columnseleted = _changeparam4[0],
58387
58452
  rowseleted = _changeparam4[1],
@@ -58389,7 +58454,7 @@ function handleContextMenu(ctx, settings, e, workbookContainer, container, area)
58389
58454
  height = _changeparam4[3],
58390
58455
  left = _changeparam4[4],
58391
58456
  width = _changeparam4[5];
58392
- (_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({
58393
58458
  left: left,
58394
58459
  width: width - 1,
58395
58460
  top: top,
@@ -58406,7 +58471,7 @@ function handleContextMenu(ctx, settings, e, workbookContainer, container, area)
58406
58471
  return;
58407
58472
  }
58408
58473
  }
58409
- (_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({
58410
58475
  left: col_pre,
58411
58476
  width: col - col_pre - 1,
58412
58477
  top: row_pre,
@@ -58582,7 +58647,7 @@ function mouseRender(ctx, globalCache, e, cellInput, scrollX, scrollY, container
58582
58647
  return;
58583
58648
  }
58584
58649
  if (ctx.luckysheet_select_status) {
58585
- var _globalCache$freezen6, _ctx$luckysheet_selec6, _globalCache$freezen7;
58650
+ var _globalCache$freezen6, _ctx$luckysheet_selec5, _globalCache$freezen7;
58586
58651
  var mouseX = e.pageX - rect.left - window.scrollX;
58587
58652
  var mouseY = e.pageY - rect.top - window.scrollY;
58588
58653
  var _x = mouseX - ctx.rowHeaderWidth + ctx.scrollLeft;
@@ -58603,7 +58668,7 @@ function mouseRender(ctx, globalCache, e, cellInput, scrollX, scrollY, container
58603
58668
  ctx.luckysheet_select_status = false;
58604
58669
  return;
58605
58670
  }
58606
- 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]);
58607
58672
  if (!last || _.isNil(last.left) || _.isNil(last.top) || _.isNil(last.height) || _.isNil(last.width) || _.isNil(last.row_focus) || _.isNil(last.column_focus)) {
58608
58673
  return;
58609
58674
  }
@@ -58802,7 +58867,7 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58802
58867
  ctx.luckysheet_cols_selected_status = false;
58803
58868
  ctx.luckysheet_model_move_state = false;
58804
58869
  if (ctx.luckysheet_rows_change_size) {
58805
- var _ctx$luckysheet_selec7, _ctx$luckysheet_selec8;
58870
+ var _ctx$luckysheet_selec6, _ctx$luckysheet_selec7;
58806
58871
  ctx.luckysheet_rows_change_size = false;
58807
58872
  var scrollTop = ctx.scrollTop;
58808
58873
  var y = e.pageY - rect.top - ctx.columnHeaderHeight + scrollTop - window.scrollY;
@@ -58829,11 +58894,11 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58829
58894
  cfg.customHeight[ctx.luckysheet_rows_change_size_start[1]] = 1;
58830
58895
  var changeRowIndex = ctx.luckysheet_rows_change_size_start[1];
58831
58896
  var changeRowSelected = false;
58832
- 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) {
58833
- var _ctx$luckysheet_selec9, _ctx$luckysheet_selec10;
58834
- (_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) {
58835
58900
  return select.row_select;
58836
- })) === 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) {
58837
58902
  if (changeRowIndex >= select.row[0] && changeRowIndex <= select.row[1]) {
58838
58903
  changeRowSelected = true;
58839
58904
  }
@@ -58841,11 +58906,11 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58841
58906
  });
58842
58907
  }
58843
58908
  if (changeRowSelected) {
58844
- var _ctx$luckysheet_selec11, _ctx$luckysheet_selec12;
58909
+ var _ctx$luckysheet_selec10, _ctx$luckysheet_selec11;
58845
58910
  cfg.rowlen || (cfg.rowlen = {});
58846
- (_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) {
58847
58912
  return select.row_select;
58848
- })) === 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) {
58849
58914
  for (var r = select.row[0]; r <= select.row[1]; r += 1) {
58850
58915
  cfg.rowlen[r] = Math.ceil(size / ctx.zoomRatio);
58851
58916
  }
@@ -58859,7 +58924,7 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58859
58924
  ctx.luckysheetfile[idx].config = ctx.config;
58860
58925
  }
58861
58926
  if (ctx.luckysheet_cols_change_size) {
58862
- var _ctx$luckysheet_selec13, _ctx$luckysheet_selec14;
58927
+ var _ctx$luckysheet_selec12, _ctx$luckysheet_selec13;
58863
58928
  ctx.luckysheet_cols_change_size = false;
58864
58929
  var scrollLeft = ctx.scrollLeft;
58865
58930
  var x = e.pageX - rect.left - ctx.rowHeaderWidth + scrollLeft - window.scrollX;
@@ -58890,11 +58955,11 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58890
58955
  _cfg.customWidth[ctx.luckysheet_cols_change_size_start[1]] = 1;
58891
58956
  var changeColumnIndex = ctx.luckysheet_cols_change_size_start[1];
58892
58957
  var changeColumnSelected = false;
58893
- 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) {
58894
- var _ctx$luckysheet_selec15, _ctx$luckysheet_selec16;
58895
- (_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) {
58896
58961
  return select.column_select;
58897
- })) === 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) {
58898
58963
  if (changeColumnIndex >= select.column[0] && changeColumnIndex <= select.column[1]) {
58899
58964
  changeColumnSelected = true;
58900
58965
  }
@@ -58902,11 +58967,11 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58902
58967
  });
58903
58968
  }
58904
58969
  if (changeColumnSelected) {
58905
- var _ctx$luckysheet_selec17, _ctx$luckysheet_selec18;
58970
+ var _ctx$luckysheet_selec16, _ctx$luckysheet_selec17;
58906
58971
  _cfg.columnlen || (_cfg.columnlen = {});
58907
- (_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) {
58908
58973
  return select.column_select;
58909
- })) === 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) {
58910
58975
  for (var r = select.column[0]; r <= select.column[1]; r += 1) {
58911
58976
  _cfg.columnlen[r] = Math.ceil(_size / ctx.zoomRatio);
58912
58977
  }
@@ -59190,8 +59255,8 @@ function handleRowHeaderMouseDown(ctx, globalCache, e, container, cellInput, fxI
59190
59255
  }
59191
59256
  if (ctx.luckysheet_rows_selected_status) {
59192
59257
  if (e.shiftKey) {
59193
- var _ctx$luckysheet_selec19;
59194
- 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]);
59195
59260
  if (!_last2 || _.isNil(_last2.top) || _.isNil(_last2.height) || _.isNil(_last2.row_focus)) {
59196
59261
  return;
59197
59262
  }
@@ -59222,8 +59287,8 @@ function handleRowHeaderMouseDown(ctx, globalCache, e, container, cellInput, fxI
59222
59287
  _last2.height_move = _height;
59223
59288
  ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1] = _last2;
59224
59289
  } else if (e.ctrlKey || e.metaKey) {
59225
- var _ctx$luckysheet_selec20;
59226
- (_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({
59227
59292
  left: colLocationByIndex(0, ctx.visibledatacolumn)[0],
59228
59293
  width: colLocationByIndex(0, ctx.visibledatacolumn)[1] - colLocationByIndex(0, ctx.visibledatacolumn)[0] - 1,
59229
59294
  top: top,
@@ -59430,8 +59495,8 @@ function handleColumnHeaderMouseDown(ctx, globalCache, e, container, cellInput,
59430
59495
  }
59431
59496
  if (ctx.luckysheet_cols_selected_status) {
59432
59497
  if (e.shiftKey) {
59433
- var _ctx$luckysheet_selec21;
59434
- 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]);
59435
59500
  var _left = 0;
59436
59501
  var _width = 0;
59437
59502
  var _columnseleted = [];
@@ -59462,8 +59527,8 @@ function handleColumnHeaderMouseDown(ctx, globalCache, e, container, cellInput,
59462
59527
  _last3.width_move = _width;
59463
59528
  ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1] = _last3;
59464
59529
  } else if (e.ctrlKey || e.metaKey) {
59465
- var _ctx$luckysheet_selec22;
59466
- (_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({
59467
59532
  left: left,
59468
59533
  width: width,
59469
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) {
@@ -37110,16 +37168,20 @@ function handleFormulaInput(ctx, $copyTo, $editor, kcode, preText) {
37110
37168
  value1 = functionHTMLGenerate(value1txt);
37111
37169
  rangeIndexes = [];
37112
37170
  if (window.getSelection) {
37113
- var _currSelection$anchor;
37114
37171
  var currSelection = window.getSelection();
37115
37172
  if (!currSelection) return;
37116
- if (((_currSelection$anchor = currSelection.anchorNode) === null || _currSelection$anchor === void 0 ? void 0 : _currSelection$anchor.nodeName.toLowerCase()) === "div") {
37117
- var _$editor$querySelecto;
37118
- var editorlen = $editor.querySelectorAll("span").length;
37119
- 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];
37120
37179
  } else {
37121
- var _currSelection$anchor2, _currSelection$anchor3, _currSelection$anchor4, _currSelection$anchor5;
37122
- 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)];
37123
37185
  }
37124
37186
  } else {
37125
37187
  var textRange = document.selection.createRange();
@@ -58335,12 +58397,15 @@ function handleCellAreaDoubleClick(ctx, globalCache, settings, e, container) {
58335
58397
  var _margeset$column3 = _slicedToArray(margeset.column, 3);
58336
58398
  col_index = _margeset$column3[2];
58337
58399
  }
58338
- var _ctx$luckysheet_selec3 = ctx.luckysheet_select_save[0],
58339
- column_focus = _ctx$luckysheet_selec3.column_focus,
58340
- row_focus = _ctx$luckysheet_selec3.row_focus;
58341
- if (!___default['default'].isNil(column_focus) && !___default['default'].isNil(row_focus) && (column_focus !== col_index || row_focus !== row_index)) {
58342
- row_index = row_focus;
58343
- 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
+ }
58344
58409
  }
58345
58410
  luckysheetUpdateCell(ctx, row_index, col_index);
58346
58411
  }
@@ -58384,14 +58449,14 @@ function handleContextMenu(ctx, settings, e, workbookContainer, container, area)
58384
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];
58385
58450
  });
58386
58451
  if (!isInSelection && (e.metaKey || e.ctrlKey)) {
58387
- var _flowdata$row_index$c, _ctx$luckysheet_selec5;
58452
+ var _flowdata$row_index$c, _ctx$luckysheet_selec4;
58388
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) {
58389
58454
  var changeparam = mergeMoveMain(ctx, [col_index, col_index], [row_index, row_index], {
58390
58455
  row_focus: row_index,
58391
58456
  column_focus: col_index
58392
58457
  }, row_pre, row, col_pre, col);
58393
58458
  if (changeparam != null) {
58394
- var _ctx$luckysheet_selec4;
58459
+ var _ctx$luckysheet_selec3;
58395
58460
  var _changeparam4 = _slicedToArray(changeparam, 6),
58396
58461
  columnseleted = _changeparam4[0],
58397
58462
  rowseleted = _changeparam4[1],
@@ -58399,7 +58464,7 @@ function handleContextMenu(ctx, settings, e, workbookContainer, container, area)
58399
58464
  height = _changeparam4[3],
58400
58465
  left = _changeparam4[4],
58401
58466
  width = _changeparam4[5];
58402
- (_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({
58403
58468
  left: left,
58404
58469
  width: width - 1,
58405
58470
  top: top,
@@ -58416,7 +58481,7 @@ function handleContextMenu(ctx, settings, e, workbookContainer, container, area)
58416
58481
  return;
58417
58482
  }
58418
58483
  }
58419
- (_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({
58420
58485
  left: col_pre,
58421
58486
  width: col - col_pre - 1,
58422
58487
  top: row_pre,
@@ -58592,7 +58657,7 @@ function mouseRender(ctx, globalCache, e, cellInput, scrollX, scrollY, container
58592
58657
  return;
58593
58658
  }
58594
58659
  if (ctx.luckysheet_select_status) {
58595
- var _globalCache$freezen6, _ctx$luckysheet_selec6, _globalCache$freezen7;
58660
+ var _globalCache$freezen6, _ctx$luckysheet_selec5, _globalCache$freezen7;
58596
58661
  var mouseX = e.pageX - rect.left - window.scrollX;
58597
58662
  var mouseY = e.pageY - rect.top - window.scrollY;
58598
58663
  var _x = mouseX - ctx.rowHeaderWidth + ctx.scrollLeft;
@@ -58613,7 +58678,7 @@ function mouseRender(ctx, globalCache, e, cellInput, scrollX, scrollY, container
58613
58678
  ctx.luckysheet_select_status = false;
58614
58679
  return;
58615
58680
  }
58616
- 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]);
58617
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)) {
58618
58683
  return;
58619
58684
  }
@@ -58812,7 +58877,7 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58812
58877
  ctx.luckysheet_cols_selected_status = false;
58813
58878
  ctx.luckysheet_model_move_state = false;
58814
58879
  if (ctx.luckysheet_rows_change_size) {
58815
- var _ctx$luckysheet_selec7, _ctx$luckysheet_selec8;
58880
+ var _ctx$luckysheet_selec6, _ctx$luckysheet_selec7;
58816
58881
  ctx.luckysheet_rows_change_size = false;
58817
58882
  var scrollTop = ctx.scrollTop;
58818
58883
  var y = e.pageY - rect.top - ctx.columnHeaderHeight + scrollTop - window.scrollY;
@@ -58839,11 +58904,11 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58839
58904
  cfg.customHeight[ctx.luckysheet_rows_change_size_start[1]] = 1;
58840
58905
  var changeRowIndex = ctx.luckysheet_rows_change_size_start[1];
58841
58906
  var changeRowSelected = false;
58842
- 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) {
58843
- var _ctx$luckysheet_selec9, _ctx$luckysheet_selec10;
58844
- (_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) {
58845
58910
  return select.row_select;
58846
- })) === 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) {
58847
58912
  if (changeRowIndex >= select.row[0] && changeRowIndex <= select.row[1]) {
58848
58913
  changeRowSelected = true;
58849
58914
  }
@@ -58851,11 +58916,11 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58851
58916
  });
58852
58917
  }
58853
58918
  if (changeRowSelected) {
58854
- var _ctx$luckysheet_selec11, _ctx$luckysheet_selec12;
58919
+ var _ctx$luckysheet_selec10, _ctx$luckysheet_selec11;
58855
58920
  cfg.rowlen || (cfg.rowlen = {});
58856
- (_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) {
58857
58922
  return select.row_select;
58858
- })) === 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) {
58859
58924
  for (var r = select.row[0]; r <= select.row[1]; r += 1) {
58860
58925
  cfg.rowlen[r] = Math.ceil(size / ctx.zoomRatio);
58861
58926
  }
@@ -58869,7 +58934,7 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58869
58934
  ctx.luckysheetfile[idx].config = ctx.config;
58870
58935
  }
58871
58936
  if (ctx.luckysheet_cols_change_size) {
58872
- var _ctx$luckysheet_selec13, _ctx$luckysheet_selec14;
58937
+ var _ctx$luckysheet_selec12, _ctx$luckysheet_selec13;
58873
58938
  ctx.luckysheet_cols_change_size = false;
58874
58939
  var scrollLeft = ctx.scrollLeft;
58875
58940
  var x = e.pageX - rect.left - ctx.rowHeaderWidth + scrollLeft - window.scrollX;
@@ -58900,11 +58965,11 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58900
58965
  _cfg.customWidth[ctx.luckysheet_cols_change_size_start[1]] = 1;
58901
58966
  var changeColumnIndex = ctx.luckysheet_cols_change_size_start[1];
58902
58967
  var changeColumnSelected = false;
58903
- 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) {
58904
- var _ctx$luckysheet_selec15, _ctx$luckysheet_selec16;
58905
- (_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) {
58906
58971
  return select.column_select;
58907
- })) === 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) {
58908
58973
  if (changeColumnIndex >= select.column[0] && changeColumnIndex <= select.column[1]) {
58909
58974
  changeColumnSelected = true;
58910
58975
  }
@@ -58912,11 +58977,11 @@ function handleOverlayMouseUp(ctx, globalCache, settings, e, scrollbarX, scrollb
58912
58977
  });
58913
58978
  }
58914
58979
  if (changeColumnSelected) {
58915
- var _ctx$luckysheet_selec17, _ctx$luckysheet_selec18;
58980
+ var _ctx$luckysheet_selec16, _ctx$luckysheet_selec17;
58916
58981
  _cfg.columnlen || (_cfg.columnlen = {});
58917
- (_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) {
58918
58983
  return select.column_select;
58919
- })) === 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) {
58920
58985
  for (var r = select.column[0]; r <= select.column[1]; r += 1) {
58921
58986
  _cfg.columnlen[r] = Math.ceil(_size / ctx.zoomRatio);
58922
58987
  }
@@ -59200,8 +59265,8 @@ function handleRowHeaderMouseDown(ctx, globalCache, e, container, cellInput, fxI
59200
59265
  }
59201
59266
  if (ctx.luckysheet_rows_selected_status) {
59202
59267
  if (e.shiftKey) {
59203
- var _ctx$luckysheet_selec19;
59204
- 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]);
59205
59270
  if (!_last2 || ___default['default'].isNil(_last2.top) || ___default['default'].isNil(_last2.height) || ___default['default'].isNil(_last2.row_focus)) {
59206
59271
  return;
59207
59272
  }
@@ -59232,8 +59297,8 @@ function handleRowHeaderMouseDown(ctx, globalCache, e, container, cellInput, fxI
59232
59297
  _last2.height_move = _height;
59233
59298
  ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1] = _last2;
59234
59299
  } else if (e.ctrlKey || e.metaKey) {
59235
- var _ctx$luckysheet_selec20;
59236
- (_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({
59237
59302
  left: colLocationByIndex(0, ctx.visibledatacolumn)[0],
59238
59303
  width: colLocationByIndex(0, ctx.visibledatacolumn)[1] - colLocationByIndex(0, ctx.visibledatacolumn)[0] - 1,
59239
59304
  top: top,
@@ -59440,8 +59505,8 @@ function handleColumnHeaderMouseDown(ctx, globalCache, e, container, cellInput,
59440
59505
  }
59441
59506
  if (ctx.luckysheet_cols_selected_status) {
59442
59507
  if (e.shiftKey) {
59443
- var _ctx$luckysheet_selec21;
59444
- 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]);
59445
59510
  var _left = 0;
59446
59511
  var _width = 0;
59447
59512
  var _columnseleted = [];
@@ -59472,8 +59537,8 @@ function handleColumnHeaderMouseDown(ctx, globalCache, e, container, cellInput,
59472
59537
  _last3.width_move = _width;
59473
59538
  ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1] = _last3;
59474
59539
  } else if (e.ctrlKey || e.metaKey) {
59475
- var _ctx$luckysheet_selec22;
59476
- (_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({
59477
59542
  left: left,
59478
59543
  width: width,
59479
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.73",
3
+ "version": "5.2.75",
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.73",
16
+ "@leankylin-sheet/formula-parser": "5.2.75",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",