@leankylin-sheet/core 6.0.3 → 6.0.4

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
@@ -35581,6 +35581,7 @@ var FormulaCache = /*#__PURE__*/function () {
35581
35581
  this.functionlistMap = void 0;
35582
35582
  this.execFunctionExist = void 0;
35583
35583
  this.execFunctionGlobalData = void 0;
35584
+ this._lastDataRowCache = null;
35584
35585
  var that = this;
35585
35586
  this.data_parm_index = 0;
35586
35587
  this.selectingRangeIndex = -1;
@@ -35614,8 +35615,13 @@ var FormulaCache = /*#__PURE__*/function () {
35614
35615
  startRow = 0;
35615
35616
  }
35616
35617
  if (endRow === -1) {
35617
- var _flowdata$length;
35618
- endRow = (_flowdata$length = flowdata === null || flowdata === void 0 ? void 0 : flowdata.length) !== null && _flowdata$length !== void 0 ? _flowdata$length : 0;
35618
+ var sheetCache = that._lastDataRowCache;
35619
+ if (sheetCache && sheetCache[id] !== undefined) {
35620
+ endRow = sheetCache[id];
35621
+ } else {
35622
+ var _flowdata$length;
35623
+ endRow = (_flowdata$length = flowdata === null || flowdata === void 0 ? void 0 : flowdata.length) !== null && _flowdata$length !== void 0 ? _flowdata$length : 0;
35624
+ }
35619
35625
  }
35620
35626
  if (startCol === -1) {
35621
35627
  startCol = 0;
@@ -36594,17 +36600,31 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36594
36600
  }
36595
36601
  formulaRunList.reverse();
36596
36602
  console.timeEnd('execFunctionGroup-before');
36603
+ var lastDataRowSheets = Object.create(null);
36604
+ for (var _i14 = 0; _i14 < formulaRunList.length; _i14++) {
36605
+ var sheetId = formulaRunList[_i14].id;
36606
+ if (lastDataRowSheets[sheetId] !== undefined) continue;
36607
+ var fd = getFlowdata(ctx, sheetId);
36608
+ var lastDataRow = 0;
36609
+ if (fd) {
36610
+ for (var r = fd.length - 1; r >= 0; r--) {
36611
+ if (fd[r] && fd[r].join('')) {
36612
+ lastDataRow = r;
36613
+ break;
36614
+ }
36615
+ }
36616
+ }
36617
+ lastDataRowSheets[sheetId] = lastDataRow;
36618
+ }
36619
+ ctx.formulaCache._lastDataRowCache = lastDataRowSheets;
36597
36620
  console.time('formulaRunList');
36598
36621
  console.log('formulaRunList', formulaRunList);
36599
- var map = {};
36600
- var ssTime = +new Date();
36601
- for (var _i14 = 0; _i14 < formulaRunList.length; _i14 += 1) {
36602
- var formulaCell = formulaRunList[_i14];
36622
+ for (var _i15 = 0; _i15 < formulaRunList.length; _i15 += 1) {
36623
+ var formulaCell = formulaRunList[_i15];
36603
36624
  if (formulaCell.level === Math.max) {
36604
36625
  continue;
36605
36626
  }
36606
36627
  var calc_funcStr = formulaCell.calc_funcStr;
36607
- var sTime = +new Date();
36608
36628
  var v = execfunction(ctx, calc_funcStr, formulaCell.r, formulaCell.c, formulaCell.id, false, notInsertFunc);
36609
36629
  ctx.groupValuesRefreshData.push({
36610
36630
  r: formulaCell.r,
@@ -36618,12 +36638,9 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36618
36638
  v: v[1],
36619
36639
  f: v[2]
36620
36640
  };
36621
- var eTime = +new Date();
36622
- map[calc_funcStr] = eTime - sTime;
36623
36641
  }
36624
- var eeTime = +new Date();
36625
- console.log('map', map, eeTime - ssTime);
36626
36642
  console.timeEnd('formulaRunList');
36643
+ ctx.formulaCache._lastDataRowCache = null;
36627
36644
  ctx.formulaCache.execFunctionExist = undefined;
36628
36645
  }
36629
36646
  function findrangeindex(ctx, v, vp) {
@@ -36637,26 +36654,26 @@ function findrangeindex(ctx, v, vp) {
36637
36654
  var vplen = vp_a.length;
36638
36655
  var vlen = v_a.length;
36639
36656
  if (vplen === vlen) {
36640
- var _i15 = pfri[0];
36641
- var p = vp_a[_i15];
36642
- var n = v_a[_i15];
36657
+ var _i16 = pfri[0];
36658
+ var p = vp_a[_i16];
36659
+ var n = v_a[_i16];
36643
36660
  if (_.isNil(p)) {
36644
- if (vp_a.length <= _i15) {
36661
+ if (vp_a.length <= _i16) {
36645
36662
  pfri = [vp_a.length - 1, vp_a.length - 1];
36646
- } else if (v_a.length <= _i15) {
36663
+ } else if (v_a.length <= _i16) {
36647
36664
  pfri = [v_a.length - 1, v_a.length - 1];
36648
36665
  }
36649
36666
  return pfri;
36650
36667
  }
36651
36668
  if (p.length === n.length) {
36652
- if (!_.isNil(vp_a[_i15 + 1]) && !_.isNil(v_a[_i15 + 1]) && vp_a[_i15 + 1].length < v_a[_i15 + 1].length) {
36669
+ if (!_.isNil(vp_a[_i16 + 1]) && !_.isNil(v_a[_i16 + 1]) && vp_a[_i16 + 1].length < v_a[_i16 + 1].length) {
36653
36670
  pfri[0] += 1;
36654
36671
  pfri[1] = 1;
36655
36672
  }
36656
36673
  return pfri;
36657
36674
  }
36658
36675
  if (p.length > n.length) {
36659
- if (!_.isNil(p) && !_.isNil(v_a[_i15 + 1]) && v_a[_i15 + 1].substring(0, 1) === '"' && (p.indexOf("{") > -1 || p.indexOf("}") > -1)) {
36676
+ if (!_.isNil(p) && !_.isNil(v_a[_i16 + 1]) && v_a[_i16 + 1].substring(0, 1) === '"' && (p.indexOf("{") > -1 || p.indexOf("}") > -1)) {
36660
36677
  pfri[0] += 1;
36661
36678
  pfri[1] = 1;
36662
36679
  }
@@ -36669,34 +36686,34 @@ function findrangeindex(ctx, v, vp) {
36669
36686
  return pfri;
36670
36687
  }
36671
36688
  } else if (vplen > vlen) {
36672
- var _i16 = pfri[0];
36673
- var _p = vp_a[_i16];
36674
- var _n = v_a[_i16];
36689
+ var _i17 = pfri[0];
36690
+ var _p = vp_a[_i17];
36691
+ var _n = v_a[_i17];
36675
36692
  if (_.isNil(_n)) {
36676
- if (v_a[_i16 - 1].indexOf("{") > -1) {
36693
+ if (v_a[_i17 - 1].indexOf("{") > -1) {
36677
36694
  pfri[0] -= 1;
36678
- var start = v_a[_i16 - 1].search("{");
36695
+ var start = v_a[_i17 - 1].search("{");
36679
36696
  pfri[1] += start;
36680
36697
  } else {
36681
36698
  pfri[0] = 0;
36682
36699
  pfri[1] = 0;
36683
36700
  }
36684
36701
  } else if (_p.length === _n.length) {
36685
- if (!_.isNil(v_a[_i16 + 1]) && (v_a[_i16 + 1].substring(0, 1) === '"' || v_a[_i16 + 1].substring(0, 1) === "{" || v_a[_i16 + 1].substring(0, 1) === "}")) {
36702
+ if (!_.isNil(v_a[_i17 + 1]) && (v_a[_i17 + 1].substring(0, 1) === '"' || v_a[_i17 + 1].substring(0, 1) === "{" || v_a[_i17 + 1].substring(0, 1) === "}")) {
36686
36703
  pfri[0] += 1;
36687
36704
  pfri[1] = 1;
36688
- } else if (!_.isNil(_p) && _p.length > 2 && _p.substring(0, 1) === '"' && _p.substring(_p.length - 1, 1) === '"') ; else if (!_.isNil(v_a[_i16]) && v_a[_i16] === '")') {
36705
+ } else if (!_.isNil(_p) && _p.length > 2 && _p.substring(0, 1) === '"' && _p.substring(_p.length - 1, 1) === '"') ; else if (!_.isNil(v_a[_i17]) && v_a[_i17] === '")') {
36689
36706
  pfri[1] = 1;
36690
- } else if (!_.isNil(v_a[_i16]) && v_a[_i16] === '"}') {
36707
+ } else if (!_.isNil(v_a[_i17]) && v_a[_i17] === '"}') {
36691
36708
  pfri[1] = 1;
36692
- } else if (!_.isNil(v_a[_i16]) && v_a[_i16] === "{)") {
36709
+ } else if (!_.isNil(v_a[_i17]) && v_a[_i17] === "{)") {
36693
36710
  pfri[1] = 1;
36694
36711
  } else {
36695
36712
  pfri[1] = _n.length;
36696
36713
  }
36697
36714
  return pfri;
36698
36715
  } else if (_p.length > _n.length) {
36699
- if (!_.isNil(v_a[_i16 + 1]) && (v_a[_i16 + 1].substring(0, 1) === '"' || v_a[_i16 + 1].substring(0, 1) === "{" || v_a[_i16 + 1].substring(0, 1) === "}")) {
36716
+ if (!_.isNil(v_a[_i17 + 1]) && (v_a[_i17 + 1].substring(0, 1) === '"' || v_a[_i17 + 1].substring(0, 1) === "{" || v_a[_i17 + 1].substring(0, 1) === "}")) {
36700
36717
  pfri[0] += 1;
36701
36718
  pfri[1] = 1;
36702
36719
  }
@@ -36706,17 +36723,17 @@ function findrangeindex(ctx, v, vp) {
36706
36723
  }
36707
36724
  return pfri;
36708
36725
  } else if (vplen < vlen) {
36709
- var _i17 = pfri[0];
36710
- var _p2 = vp_a[_i17];
36711
- var _n2 = v_a[_i17];
36726
+ var _i18 = pfri[0];
36727
+ var _p2 = vp_a[_i18];
36728
+ var _n2 = v_a[_i18];
36712
36729
  if (_.isNil(_p2)) {
36713
36730
  pfri[0] = v_a.length - 1;
36714
36731
  var last = v_a[pfri[0]];
36715
36732
  pfri[1] = _.isNil(last) ? 1 : last.length;
36716
36733
  } else if (_p2.length === _n2.length) {
36717
- 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) === "}")) {
36734
+ if (vp_a[_i18 + 1] != null && (vp_a[_i18 + 1].substring(0, 1) === '"' || vp_a[_i18 + 1].substring(0, 1) === "{" || vp_a[_i18 + 1].substring(0, 1) === "}")) {
36718
36735
  pfri[1] = _n2.length;
36719
- } else if (!_.isNil(v_a[_i17 + 1]) && v_a[_i17 + 1].substring(0, 1) === '"' && (v_a[_i17 + 1].substring(0, 1) === "{" || v_a[_i17 + 1].substring(0, 1) === "}")) {
36736
+ } else if (!_.isNil(v_a[_i18 + 1]) && v_a[_i18 + 1].substring(0, 1) === '"' && (v_a[_i18 + 1].substring(0, 1) === "{" || v_a[_i18 + 1].substring(0, 1) === "}")) {
36720
36737
  pfri[0] += 1;
36721
36738
  pfri[1] = 1;
36722
36739
  } else if (!_.isNil(_n2) && _n2.substring(0, 1) === '"' && _n2.substring(_n2.length - 1, 1) === '"' && _p2.substring(0, 1) === '"' && _p2.substring(_p2.length - 1, 1) === ")") {
@@ -36726,7 +36743,7 @@ function findrangeindex(ctx, v, vp) {
36726
36743
  } else {
36727
36744
  pfri[0] = pfri[0] + vlen - vplen;
36728
36745
  if (v_a.length > vp_a.length) {
36729
- pfri[1] = v_a[_i17 + 1].length;
36746
+ pfri[1] = v_a[_i18 + 1].length;
36730
36747
  } else {
36731
36748
  pfri[1] = 1;
36732
36749
  }
@@ -36735,17 +36752,17 @@ function findrangeindex(ctx, v, vp) {
36735
36752
  } else if (_p2.length > _n2.length) {
36736
36753
  if (!_.isNil(_p2) && _p2.substring(0, 1) === '"') {
36737
36754
  pfri[1] = _n2.length;
36738
- } else if (_.isNil(v_a[_i17 + 1]) && /{.*?}/.test(v_a[_i17 + 1])) {
36755
+ } else if (_.isNil(v_a[_i18 + 1]) && /{.*?}/.test(v_a[_i18 + 1])) {
36739
36756
  pfri[0] += 1;
36740
- pfri[1] = v_a[_i17 + 1].length;
36741
- } else if (!_.isNil(_p2) && v_a[_i17 + 1].substring(0, 1) === '"' && (_p2.indexOf("{") > -1 || _p2.indexOf("}") > -1)) {
36757
+ pfri[1] = v_a[_i18 + 1].length;
36758
+ } else if (!_.isNil(_p2) && v_a[_i18 + 1].substring(0, 1) === '"' && (_p2.indexOf("{") > -1 || _p2.indexOf("}") > -1)) {
36742
36759
  pfri[0] += 1;
36743
36760
  pfri[1] = 1;
36744
36761
  } else if (!_.isNil(_p2) && (_p2.indexOf("{") > -1 || _p2.indexOf("}") > -1)) ; else if (!_.isNil(_p2) && !_.startsWith(_p2[0], "=") && _.startsWith(_n2, "=")) {
36745
36762
  return [vlen - 1, v_a[vlen - 1].length];
36746
36763
  } else {
36747
36764
  pfri[0] = pfri[0] + vlen - vplen - 1;
36748
- pfri[1] = v_a[(_i17 || 1) - 1].length;
36765
+ pfri[1] = v_a[(_i18 || 1) - 1].length;
36749
36766
  }
36750
36767
  return pfri;
36751
36768
  } else if (_p2.length < _n2.length) {
@@ -36792,9 +36809,9 @@ function locateTextOffset(node, offset) {
36792
36809
  text = walker.nextNode();
36793
36810
  }
36794
36811
  var acc = 0;
36795
- for (var _i18 = 0; _i18 < texts.length; _i18 += 1) {
36812
+ for (var _i19 = 0; _i19 < texts.length; _i19 += 1) {
36796
36813
  var _item$textContent$len, _item$textContent;
36797
- var item = texts[_i18];
36814
+ var item = texts[_i19];
36798
36815
  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;
36799
36816
  if (offset <= acc + len) {
36800
36817
  return [item, Math.max(0, offset - acc)];
@@ -36880,8 +36897,8 @@ function searchFunction(ctx, searchtxt) {
36880
36897
  var f = [];
36881
36898
  var s = [];
36882
36899
  var t = [];
36883
- for (var _i19 = 0; _i19 < functionlist.length; _i19 += 1) {
36884
- var item = functionlist[_i19];
36900
+ for (var _i20 = 0; _i20 < functionlist.length; _i20 += 1) {
36901
+ var item = functionlist[_i20];
36885
36902
  var n = item.n;
36886
36903
  if (n === searchtxt) {
36887
36904
  f.unshift(item);
@@ -36937,8 +36954,8 @@ function helpFunctionExe($editer, currSelection, ctx) {
36937
36954
  var _locale2 = locale(ctx),
36938
36955
  functionlist = _locale2.functionlist;
36939
36956
  if (_.isEmpty(ctx.formulaCache.functionlistMap)) {
36940
- for (var _i20 = 0; _i20 < functionlist.length; _i20 += 1) {
36941
- ctx.formulaCache.functionlistMap[functionlist[_i20].n] = functionlist[_i20];
36957
+ for (var _i21 = 0; _i21 < functionlist.length; _i21 += 1) {
36958
+ ctx.formulaCache.functionlistMap[functionlist[_i21].n] = functionlist[_i21];
36942
36959
  }
36943
36960
  }
36944
36961
  if (!currSelection) {
package/dist/index.js CHANGED
@@ -35591,6 +35591,7 @@ var FormulaCache = /*#__PURE__*/function () {
35591
35591
  this.functionlistMap = void 0;
35592
35592
  this.execFunctionExist = void 0;
35593
35593
  this.execFunctionGlobalData = void 0;
35594
+ this._lastDataRowCache = null;
35594
35595
  var that = this;
35595
35596
  this.data_parm_index = 0;
35596
35597
  this.selectingRangeIndex = -1;
@@ -35624,8 +35625,13 @@ var FormulaCache = /*#__PURE__*/function () {
35624
35625
  startRow = 0;
35625
35626
  }
35626
35627
  if (endRow === -1) {
35627
- var _flowdata$length;
35628
- endRow = (_flowdata$length = flowdata === null || flowdata === void 0 ? void 0 : flowdata.length) !== null && _flowdata$length !== void 0 ? _flowdata$length : 0;
35628
+ var sheetCache = that._lastDataRowCache;
35629
+ if (sheetCache && sheetCache[id] !== undefined) {
35630
+ endRow = sheetCache[id];
35631
+ } else {
35632
+ var _flowdata$length;
35633
+ endRow = (_flowdata$length = flowdata === null || flowdata === void 0 ? void 0 : flowdata.length) !== null && _flowdata$length !== void 0 ? _flowdata$length : 0;
35634
+ }
35629
35635
  }
35630
35636
  if (startCol === -1) {
35631
35637
  startCol = 0;
@@ -36604,17 +36610,31 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36604
36610
  }
36605
36611
  formulaRunList.reverse();
36606
36612
  console.timeEnd('execFunctionGroup-before');
36613
+ var lastDataRowSheets = Object.create(null);
36614
+ for (var _i14 = 0; _i14 < formulaRunList.length; _i14++) {
36615
+ var sheetId = formulaRunList[_i14].id;
36616
+ if (lastDataRowSheets[sheetId] !== undefined) continue;
36617
+ var fd = getFlowdata(ctx, sheetId);
36618
+ var lastDataRow = 0;
36619
+ if (fd) {
36620
+ for (var r = fd.length - 1; r >= 0; r--) {
36621
+ if (fd[r] && fd[r].join('')) {
36622
+ lastDataRow = r;
36623
+ break;
36624
+ }
36625
+ }
36626
+ }
36627
+ lastDataRowSheets[sheetId] = lastDataRow;
36628
+ }
36629
+ ctx.formulaCache._lastDataRowCache = lastDataRowSheets;
36607
36630
  console.time('formulaRunList');
36608
36631
  console.log('formulaRunList', formulaRunList);
36609
- var map = {};
36610
- var ssTime = +new Date();
36611
- for (var _i14 = 0; _i14 < formulaRunList.length; _i14 += 1) {
36612
- var formulaCell = formulaRunList[_i14];
36632
+ for (var _i15 = 0; _i15 < formulaRunList.length; _i15 += 1) {
36633
+ var formulaCell = formulaRunList[_i15];
36613
36634
  if (formulaCell.level === Math.max) {
36614
36635
  continue;
36615
36636
  }
36616
36637
  var calc_funcStr = formulaCell.calc_funcStr;
36617
- var sTime = +new Date();
36618
36638
  var v = execfunction(ctx, calc_funcStr, formulaCell.r, formulaCell.c, formulaCell.id, false, notInsertFunc);
36619
36639
  ctx.groupValuesRefreshData.push({
36620
36640
  r: formulaCell.r,
@@ -36628,12 +36648,9 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36628
36648
  v: v[1],
36629
36649
  f: v[2]
36630
36650
  };
36631
- var eTime = +new Date();
36632
- map[calc_funcStr] = eTime - sTime;
36633
36651
  }
36634
- var eeTime = +new Date();
36635
- console.log('map', map, eeTime - ssTime);
36636
36652
  console.timeEnd('formulaRunList');
36653
+ ctx.formulaCache._lastDataRowCache = null;
36637
36654
  ctx.formulaCache.execFunctionExist = undefined;
36638
36655
  }
36639
36656
  function findrangeindex(ctx, v, vp) {
@@ -36647,26 +36664,26 @@ function findrangeindex(ctx, v, vp) {
36647
36664
  var vplen = vp_a.length;
36648
36665
  var vlen = v_a.length;
36649
36666
  if (vplen === vlen) {
36650
- var _i15 = pfri[0];
36651
- var p = vp_a[_i15];
36652
- var n = v_a[_i15];
36667
+ var _i16 = pfri[0];
36668
+ var p = vp_a[_i16];
36669
+ var n = v_a[_i16];
36653
36670
  if (___default['default'].isNil(p)) {
36654
- if (vp_a.length <= _i15) {
36671
+ if (vp_a.length <= _i16) {
36655
36672
  pfri = [vp_a.length - 1, vp_a.length - 1];
36656
- } else if (v_a.length <= _i15) {
36673
+ } else if (v_a.length <= _i16) {
36657
36674
  pfri = [v_a.length - 1, v_a.length - 1];
36658
36675
  }
36659
36676
  return pfri;
36660
36677
  }
36661
36678
  if (p.length === n.length) {
36662
- if (!___default['default'].isNil(vp_a[_i15 + 1]) && !___default['default'].isNil(v_a[_i15 + 1]) && vp_a[_i15 + 1].length < v_a[_i15 + 1].length) {
36679
+ if (!___default['default'].isNil(vp_a[_i16 + 1]) && !___default['default'].isNil(v_a[_i16 + 1]) && vp_a[_i16 + 1].length < v_a[_i16 + 1].length) {
36663
36680
  pfri[0] += 1;
36664
36681
  pfri[1] = 1;
36665
36682
  }
36666
36683
  return pfri;
36667
36684
  }
36668
36685
  if (p.length > n.length) {
36669
- if (!___default['default'].isNil(p) && !___default['default'].isNil(v_a[_i15 + 1]) && v_a[_i15 + 1].substring(0, 1) === '"' && (p.indexOf("{") > -1 || p.indexOf("}") > -1)) {
36686
+ if (!___default['default'].isNil(p) && !___default['default'].isNil(v_a[_i16 + 1]) && v_a[_i16 + 1].substring(0, 1) === '"' && (p.indexOf("{") > -1 || p.indexOf("}") > -1)) {
36670
36687
  pfri[0] += 1;
36671
36688
  pfri[1] = 1;
36672
36689
  }
@@ -36679,34 +36696,34 @@ function findrangeindex(ctx, v, vp) {
36679
36696
  return pfri;
36680
36697
  }
36681
36698
  } else if (vplen > vlen) {
36682
- var _i16 = pfri[0];
36683
- var _p = vp_a[_i16];
36684
- var _n = v_a[_i16];
36699
+ var _i17 = pfri[0];
36700
+ var _p = vp_a[_i17];
36701
+ var _n = v_a[_i17];
36685
36702
  if (___default['default'].isNil(_n)) {
36686
- if (v_a[_i16 - 1].indexOf("{") > -1) {
36703
+ if (v_a[_i17 - 1].indexOf("{") > -1) {
36687
36704
  pfri[0] -= 1;
36688
- var start = v_a[_i16 - 1].search("{");
36705
+ var start = v_a[_i17 - 1].search("{");
36689
36706
  pfri[1] += start;
36690
36707
  } else {
36691
36708
  pfri[0] = 0;
36692
36709
  pfri[1] = 0;
36693
36710
  }
36694
36711
  } else if (_p.length === _n.length) {
36695
- if (!___default['default'].isNil(v_a[_i16 + 1]) && (v_a[_i16 + 1].substring(0, 1) === '"' || v_a[_i16 + 1].substring(0, 1) === "{" || v_a[_i16 + 1].substring(0, 1) === "}")) {
36712
+ if (!___default['default'].isNil(v_a[_i17 + 1]) && (v_a[_i17 + 1].substring(0, 1) === '"' || v_a[_i17 + 1].substring(0, 1) === "{" || v_a[_i17 + 1].substring(0, 1) === "}")) {
36696
36713
  pfri[0] += 1;
36697
36714
  pfri[1] = 1;
36698
- } else if (!___default['default'].isNil(_p) && _p.length > 2 && _p.substring(0, 1) === '"' && _p.substring(_p.length - 1, 1) === '"') ; else if (!___default['default'].isNil(v_a[_i16]) && v_a[_i16] === '")') {
36715
+ } else if (!___default['default'].isNil(_p) && _p.length > 2 && _p.substring(0, 1) === '"' && _p.substring(_p.length - 1, 1) === '"') ; else if (!___default['default'].isNil(v_a[_i17]) && v_a[_i17] === '")') {
36699
36716
  pfri[1] = 1;
36700
- } else if (!___default['default'].isNil(v_a[_i16]) && v_a[_i16] === '"}') {
36717
+ } else if (!___default['default'].isNil(v_a[_i17]) && v_a[_i17] === '"}') {
36701
36718
  pfri[1] = 1;
36702
- } else if (!___default['default'].isNil(v_a[_i16]) && v_a[_i16] === "{)") {
36719
+ } else if (!___default['default'].isNil(v_a[_i17]) && v_a[_i17] === "{)") {
36703
36720
  pfri[1] = 1;
36704
36721
  } else {
36705
36722
  pfri[1] = _n.length;
36706
36723
  }
36707
36724
  return pfri;
36708
36725
  } else if (_p.length > _n.length) {
36709
- if (!___default['default'].isNil(v_a[_i16 + 1]) && (v_a[_i16 + 1].substring(0, 1) === '"' || v_a[_i16 + 1].substring(0, 1) === "{" || v_a[_i16 + 1].substring(0, 1) === "}")) {
36726
+ if (!___default['default'].isNil(v_a[_i17 + 1]) && (v_a[_i17 + 1].substring(0, 1) === '"' || v_a[_i17 + 1].substring(0, 1) === "{" || v_a[_i17 + 1].substring(0, 1) === "}")) {
36710
36727
  pfri[0] += 1;
36711
36728
  pfri[1] = 1;
36712
36729
  }
@@ -36716,17 +36733,17 @@ function findrangeindex(ctx, v, vp) {
36716
36733
  }
36717
36734
  return pfri;
36718
36735
  } else if (vplen < vlen) {
36719
- var _i17 = pfri[0];
36720
- var _p2 = vp_a[_i17];
36721
- var _n2 = v_a[_i17];
36736
+ var _i18 = pfri[0];
36737
+ var _p2 = vp_a[_i18];
36738
+ var _n2 = v_a[_i18];
36722
36739
  if (___default['default'].isNil(_p2)) {
36723
36740
  pfri[0] = v_a.length - 1;
36724
36741
  var last = v_a[pfri[0]];
36725
36742
  pfri[1] = ___default['default'].isNil(last) ? 1 : last.length;
36726
36743
  } else if (_p2.length === _n2.length) {
36727
- 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) === "}")) {
36744
+ if (vp_a[_i18 + 1] != null && (vp_a[_i18 + 1].substring(0, 1) === '"' || vp_a[_i18 + 1].substring(0, 1) === "{" || vp_a[_i18 + 1].substring(0, 1) === "}")) {
36728
36745
  pfri[1] = _n2.length;
36729
- } else if (!___default['default'].isNil(v_a[_i17 + 1]) && v_a[_i17 + 1].substring(0, 1) === '"' && (v_a[_i17 + 1].substring(0, 1) === "{" || v_a[_i17 + 1].substring(0, 1) === "}")) {
36746
+ } else if (!___default['default'].isNil(v_a[_i18 + 1]) && v_a[_i18 + 1].substring(0, 1) === '"' && (v_a[_i18 + 1].substring(0, 1) === "{" || v_a[_i18 + 1].substring(0, 1) === "}")) {
36730
36747
  pfri[0] += 1;
36731
36748
  pfri[1] = 1;
36732
36749
  } else if (!___default['default'].isNil(_n2) && _n2.substring(0, 1) === '"' && _n2.substring(_n2.length - 1, 1) === '"' && _p2.substring(0, 1) === '"' && _p2.substring(_p2.length - 1, 1) === ")") {
@@ -36736,7 +36753,7 @@ function findrangeindex(ctx, v, vp) {
36736
36753
  } else {
36737
36754
  pfri[0] = pfri[0] + vlen - vplen;
36738
36755
  if (v_a.length > vp_a.length) {
36739
- pfri[1] = v_a[_i17 + 1].length;
36756
+ pfri[1] = v_a[_i18 + 1].length;
36740
36757
  } else {
36741
36758
  pfri[1] = 1;
36742
36759
  }
@@ -36745,17 +36762,17 @@ function findrangeindex(ctx, v, vp) {
36745
36762
  } else if (_p2.length > _n2.length) {
36746
36763
  if (!___default['default'].isNil(_p2) && _p2.substring(0, 1) === '"') {
36747
36764
  pfri[1] = _n2.length;
36748
- } else if (___default['default'].isNil(v_a[_i17 + 1]) && /{.*?}/.test(v_a[_i17 + 1])) {
36765
+ } else if (___default['default'].isNil(v_a[_i18 + 1]) && /{.*?}/.test(v_a[_i18 + 1])) {
36749
36766
  pfri[0] += 1;
36750
- pfri[1] = v_a[_i17 + 1].length;
36751
- } else if (!___default['default'].isNil(_p2) && v_a[_i17 + 1].substring(0, 1) === '"' && (_p2.indexOf("{") > -1 || _p2.indexOf("}") > -1)) {
36767
+ pfri[1] = v_a[_i18 + 1].length;
36768
+ } else if (!___default['default'].isNil(_p2) && v_a[_i18 + 1].substring(0, 1) === '"' && (_p2.indexOf("{") > -1 || _p2.indexOf("}") > -1)) {
36752
36769
  pfri[0] += 1;
36753
36770
  pfri[1] = 1;
36754
36771
  } else if (!___default['default'].isNil(_p2) && (_p2.indexOf("{") > -1 || _p2.indexOf("}") > -1)) ; else if (!___default['default'].isNil(_p2) && !___default['default'].startsWith(_p2[0], "=") && ___default['default'].startsWith(_n2, "=")) {
36755
36772
  return [vlen - 1, v_a[vlen - 1].length];
36756
36773
  } else {
36757
36774
  pfri[0] = pfri[0] + vlen - vplen - 1;
36758
- pfri[1] = v_a[(_i17 || 1) - 1].length;
36775
+ pfri[1] = v_a[(_i18 || 1) - 1].length;
36759
36776
  }
36760
36777
  return pfri;
36761
36778
  } else if (_p2.length < _n2.length) {
@@ -36802,9 +36819,9 @@ function locateTextOffset(node, offset) {
36802
36819
  text = walker.nextNode();
36803
36820
  }
36804
36821
  var acc = 0;
36805
- for (var _i18 = 0; _i18 < texts.length; _i18 += 1) {
36822
+ for (var _i19 = 0; _i19 < texts.length; _i19 += 1) {
36806
36823
  var _item$textContent$len, _item$textContent;
36807
- var item = texts[_i18];
36824
+ var item = texts[_i19];
36808
36825
  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;
36809
36826
  if (offset <= acc + len) {
36810
36827
  return [item, Math.max(0, offset - acc)];
@@ -36890,8 +36907,8 @@ function searchFunction(ctx, searchtxt) {
36890
36907
  var f = [];
36891
36908
  var s = [];
36892
36909
  var t = [];
36893
- for (var _i19 = 0; _i19 < functionlist.length; _i19 += 1) {
36894
- var item = functionlist[_i19];
36910
+ for (var _i20 = 0; _i20 < functionlist.length; _i20 += 1) {
36911
+ var item = functionlist[_i20];
36895
36912
  var n = item.n;
36896
36913
  if (n === searchtxt) {
36897
36914
  f.unshift(item);
@@ -36947,8 +36964,8 @@ function helpFunctionExe($editer, currSelection, ctx) {
36947
36964
  var _locale2 = locale(ctx),
36948
36965
  functionlist = _locale2.functionlist;
36949
36966
  if (___default['default'].isEmpty(ctx.formulaCache.functionlistMap)) {
36950
- for (var _i20 = 0; _i20 < functionlist.length; _i20 += 1) {
36951
- ctx.formulaCache.functionlistMap[functionlist[_i20].n] = functionlist[_i20];
36967
+ for (var _i21 = 0; _i21 < functionlist.length; _i21 += 1) {
36968
+ ctx.formulaCache.functionlistMap[functionlist[_i21].n] = functionlist[_i21];
36952
36969
  }
36953
36970
  }
36954
36971
  if (!currSelection) {
@@ -24,6 +24,7 @@ export declare class FormulaCache {
24
24
  functionlistMap: any;
25
25
  execFunctionExist?: any[];
26
26
  execFunctionGlobalData: any;
27
+ _lastDataRowCache: Record<string, number> | null;
27
28
  constructor();
28
29
  tryGetCellAsNumber(cell: Cell): string | number | boolean | null;
29
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "6.0.3",
3
+ "version": "6.0.4",
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": "6.0.3",
16
+ "@leankylin-sheet/formula-parser": "6.0.4",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",