@leankylin-sheet/core 6.0.2 → 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,15 +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
- for (var _i14 = 0; _i14 < formulaRunList.length; _i14 += 1) {
36600
- var formulaCell = formulaRunList[_i14];
36622
+ for (var _i15 = 0; _i15 < formulaRunList.length; _i15 += 1) {
36623
+ var formulaCell = formulaRunList[_i15];
36601
36624
  if (formulaCell.level === Math.max) {
36602
36625
  continue;
36603
36626
  }
36604
36627
  var calc_funcStr = formulaCell.calc_funcStr;
36605
- console.time('formulaRunList' + _i14);
36606
36628
  var v = execfunction(ctx, calc_funcStr, formulaCell.r, formulaCell.c, formulaCell.id, false, notInsertFunc);
36607
36629
  ctx.groupValuesRefreshData.push({
36608
36630
  r: formulaCell.r,
@@ -36616,9 +36638,9 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36616
36638
  v: v[1],
36617
36639
  f: v[2]
36618
36640
  };
36619
- console.timeEnd('formulaRunList' + _i14);
36620
36641
  }
36621
36642
  console.timeEnd('formulaRunList');
36643
+ ctx.formulaCache._lastDataRowCache = null;
36622
36644
  ctx.formulaCache.execFunctionExist = undefined;
36623
36645
  }
36624
36646
  function findrangeindex(ctx, v, vp) {
@@ -36632,26 +36654,26 @@ function findrangeindex(ctx, v, vp) {
36632
36654
  var vplen = vp_a.length;
36633
36655
  var vlen = v_a.length;
36634
36656
  if (vplen === vlen) {
36635
- var _i15 = pfri[0];
36636
- var p = vp_a[_i15];
36637
- var n = v_a[_i15];
36657
+ var _i16 = pfri[0];
36658
+ var p = vp_a[_i16];
36659
+ var n = v_a[_i16];
36638
36660
  if (_.isNil(p)) {
36639
- if (vp_a.length <= _i15) {
36661
+ if (vp_a.length <= _i16) {
36640
36662
  pfri = [vp_a.length - 1, vp_a.length - 1];
36641
- } else if (v_a.length <= _i15) {
36663
+ } else if (v_a.length <= _i16) {
36642
36664
  pfri = [v_a.length - 1, v_a.length - 1];
36643
36665
  }
36644
36666
  return pfri;
36645
36667
  }
36646
36668
  if (p.length === n.length) {
36647
- 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) {
36648
36670
  pfri[0] += 1;
36649
36671
  pfri[1] = 1;
36650
36672
  }
36651
36673
  return pfri;
36652
36674
  }
36653
36675
  if (p.length > n.length) {
36654
- 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)) {
36655
36677
  pfri[0] += 1;
36656
36678
  pfri[1] = 1;
36657
36679
  }
@@ -36664,34 +36686,34 @@ function findrangeindex(ctx, v, vp) {
36664
36686
  return pfri;
36665
36687
  }
36666
36688
  } else if (vplen > vlen) {
36667
- var _i16 = pfri[0];
36668
- var _p = vp_a[_i16];
36669
- var _n = v_a[_i16];
36689
+ var _i17 = pfri[0];
36690
+ var _p = vp_a[_i17];
36691
+ var _n = v_a[_i17];
36670
36692
  if (_.isNil(_n)) {
36671
- if (v_a[_i16 - 1].indexOf("{") > -1) {
36693
+ if (v_a[_i17 - 1].indexOf("{") > -1) {
36672
36694
  pfri[0] -= 1;
36673
- var start = v_a[_i16 - 1].search("{");
36695
+ var start = v_a[_i17 - 1].search("{");
36674
36696
  pfri[1] += start;
36675
36697
  } else {
36676
36698
  pfri[0] = 0;
36677
36699
  pfri[1] = 0;
36678
36700
  }
36679
36701
  } else if (_p.length === _n.length) {
36680
- 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) === "}")) {
36681
36703
  pfri[0] += 1;
36682
36704
  pfri[1] = 1;
36683
- } 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] === '")') {
36684
36706
  pfri[1] = 1;
36685
- } else if (!_.isNil(v_a[_i16]) && v_a[_i16] === '"}') {
36707
+ } else if (!_.isNil(v_a[_i17]) && v_a[_i17] === '"}') {
36686
36708
  pfri[1] = 1;
36687
- } else if (!_.isNil(v_a[_i16]) && v_a[_i16] === "{)") {
36709
+ } else if (!_.isNil(v_a[_i17]) && v_a[_i17] === "{)") {
36688
36710
  pfri[1] = 1;
36689
36711
  } else {
36690
36712
  pfri[1] = _n.length;
36691
36713
  }
36692
36714
  return pfri;
36693
36715
  } else if (_p.length > _n.length) {
36694
- 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) === "}")) {
36695
36717
  pfri[0] += 1;
36696
36718
  pfri[1] = 1;
36697
36719
  }
@@ -36701,17 +36723,17 @@ function findrangeindex(ctx, v, vp) {
36701
36723
  }
36702
36724
  return pfri;
36703
36725
  } else if (vplen < vlen) {
36704
- var _i17 = pfri[0];
36705
- var _p2 = vp_a[_i17];
36706
- var _n2 = v_a[_i17];
36726
+ var _i18 = pfri[0];
36727
+ var _p2 = vp_a[_i18];
36728
+ var _n2 = v_a[_i18];
36707
36729
  if (_.isNil(_p2)) {
36708
36730
  pfri[0] = v_a.length - 1;
36709
36731
  var last = v_a[pfri[0]];
36710
36732
  pfri[1] = _.isNil(last) ? 1 : last.length;
36711
36733
  } else if (_p2.length === _n2.length) {
36712
- 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) === "}")) {
36713
36735
  pfri[1] = _n2.length;
36714
- } 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) === "}")) {
36715
36737
  pfri[0] += 1;
36716
36738
  pfri[1] = 1;
36717
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) === ")") {
@@ -36721,7 +36743,7 @@ function findrangeindex(ctx, v, vp) {
36721
36743
  } else {
36722
36744
  pfri[0] = pfri[0] + vlen - vplen;
36723
36745
  if (v_a.length > vp_a.length) {
36724
- pfri[1] = v_a[_i17 + 1].length;
36746
+ pfri[1] = v_a[_i18 + 1].length;
36725
36747
  } else {
36726
36748
  pfri[1] = 1;
36727
36749
  }
@@ -36730,17 +36752,17 @@ function findrangeindex(ctx, v, vp) {
36730
36752
  } else if (_p2.length > _n2.length) {
36731
36753
  if (!_.isNil(_p2) && _p2.substring(0, 1) === '"') {
36732
36754
  pfri[1] = _n2.length;
36733
- } 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])) {
36734
36756
  pfri[0] += 1;
36735
- pfri[1] = v_a[_i17 + 1].length;
36736
- } 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)) {
36737
36759
  pfri[0] += 1;
36738
36760
  pfri[1] = 1;
36739
36761
  } else if (!_.isNil(_p2) && (_p2.indexOf("{") > -1 || _p2.indexOf("}") > -1)) ; else if (!_.isNil(_p2) && !_.startsWith(_p2[0], "=") && _.startsWith(_n2, "=")) {
36740
36762
  return [vlen - 1, v_a[vlen - 1].length];
36741
36763
  } else {
36742
36764
  pfri[0] = pfri[0] + vlen - vplen - 1;
36743
- pfri[1] = v_a[(_i17 || 1) - 1].length;
36765
+ pfri[1] = v_a[(_i18 || 1) - 1].length;
36744
36766
  }
36745
36767
  return pfri;
36746
36768
  } else if (_p2.length < _n2.length) {
@@ -36787,9 +36809,9 @@ function locateTextOffset(node, offset) {
36787
36809
  text = walker.nextNode();
36788
36810
  }
36789
36811
  var acc = 0;
36790
- for (var _i18 = 0; _i18 < texts.length; _i18 += 1) {
36812
+ for (var _i19 = 0; _i19 < texts.length; _i19 += 1) {
36791
36813
  var _item$textContent$len, _item$textContent;
36792
- var item = texts[_i18];
36814
+ var item = texts[_i19];
36793
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;
36794
36816
  if (offset <= acc + len) {
36795
36817
  return [item, Math.max(0, offset - acc)];
@@ -36875,8 +36897,8 @@ function searchFunction(ctx, searchtxt) {
36875
36897
  var f = [];
36876
36898
  var s = [];
36877
36899
  var t = [];
36878
- for (var _i19 = 0; _i19 < functionlist.length; _i19 += 1) {
36879
- var item = functionlist[_i19];
36900
+ for (var _i20 = 0; _i20 < functionlist.length; _i20 += 1) {
36901
+ var item = functionlist[_i20];
36880
36902
  var n = item.n;
36881
36903
  if (n === searchtxt) {
36882
36904
  f.unshift(item);
@@ -36932,8 +36954,8 @@ function helpFunctionExe($editer, currSelection, ctx) {
36932
36954
  var _locale2 = locale(ctx),
36933
36955
  functionlist = _locale2.functionlist;
36934
36956
  if (_.isEmpty(ctx.formulaCache.functionlistMap)) {
36935
- for (var _i20 = 0; _i20 < functionlist.length; _i20 += 1) {
36936
- 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];
36937
36959
  }
36938
36960
  }
36939
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,15 +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
- for (var _i14 = 0; _i14 < formulaRunList.length; _i14 += 1) {
36610
- var formulaCell = formulaRunList[_i14];
36632
+ for (var _i15 = 0; _i15 < formulaRunList.length; _i15 += 1) {
36633
+ var formulaCell = formulaRunList[_i15];
36611
36634
  if (formulaCell.level === Math.max) {
36612
36635
  continue;
36613
36636
  }
36614
36637
  var calc_funcStr = formulaCell.calc_funcStr;
36615
- console.time('formulaRunList' + _i14);
36616
36638
  var v = execfunction(ctx, calc_funcStr, formulaCell.r, formulaCell.c, formulaCell.id, false, notInsertFunc);
36617
36639
  ctx.groupValuesRefreshData.push({
36618
36640
  r: formulaCell.r,
@@ -36626,9 +36648,9 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36626
36648
  v: v[1],
36627
36649
  f: v[2]
36628
36650
  };
36629
- console.timeEnd('formulaRunList' + _i14);
36630
36651
  }
36631
36652
  console.timeEnd('formulaRunList');
36653
+ ctx.formulaCache._lastDataRowCache = null;
36632
36654
  ctx.formulaCache.execFunctionExist = undefined;
36633
36655
  }
36634
36656
  function findrangeindex(ctx, v, vp) {
@@ -36642,26 +36664,26 @@ function findrangeindex(ctx, v, vp) {
36642
36664
  var vplen = vp_a.length;
36643
36665
  var vlen = v_a.length;
36644
36666
  if (vplen === vlen) {
36645
- var _i15 = pfri[0];
36646
- var p = vp_a[_i15];
36647
- var n = v_a[_i15];
36667
+ var _i16 = pfri[0];
36668
+ var p = vp_a[_i16];
36669
+ var n = v_a[_i16];
36648
36670
  if (___default['default'].isNil(p)) {
36649
- if (vp_a.length <= _i15) {
36671
+ if (vp_a.length <= _i16) {
36650
36672
  pfri = [vp_a.length - 1, vp_a.length - 1];
36651
- } else if (v_a.length <= _i15) {
36673
+ } else if (v_a.length <= _i16) {
36652
36674
  pfri = [v_a.length - 1, v_a.length - 1];
36653
36675
  }
36654
36676
  return pfri;
36655
36677
  }
36656
36678
  if (p.length === n.length) {
36657
- 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) {
36658
36680
  pfri[0] += 1;
36659
36681
  pfri[1] = 1;
36660
36682
  }
36661
36683
  return pfri;
36662
36684
  }
36663
36685
  if (p.length > n.length) {
36664
- 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)) {
36665
36687
  pfri[0] += 1;
36666
36688
  pfri[1] = 1;
36667
36689
  }
@@ -36674,34 +36696,34 @@ function findrangeindex(ctx, v, vp) {
36674
36696
  return pfri;
36675
36697
  }
36676
36698
  } else if (vplen > vlen) {
36677
- var _i16 = pfri[0];
36678
- var _p = vp_a[_i16];
36679
- var _n = v_a[_i16];
36699
+ var _i17 = pfri[0];
36700
+ var _p = vp_a[_i17];
36701
+ var _n = v_a[_i17];
36680
36702
  if (___default['default'].isNil(_n)) {
36681
- if (v_a[_i16 - 1].indexOf("{") > -1) {
36703
+ if (v_a[_i17 - 1].indexOf("{") > -1) {
36682
36704
  pfri[0] -= 1;
36683
- var start = v_a[_i16 - 1].search("{");
36705
+ var start = v_a[_i17 - 1].search("{");
36684
36706
  pfri[1] += start;
36685
36707
  } else {
36686
36708
  pfri[0] = 0;
36687
36709
  pfri[1] = 0;
36688
36710
  }
36689
36711
  } else if (_p.length === _n.length) {
36690
- 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) === "}")) {
36691
36713
  pfri[0] += 1;
36692
36714
  pfri[1] = 1;
36693
- } 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] === '")') {
36694
36716
  pfri[1] = 1;
36695
- } else if (!___default['default'].isNil(v_a[_i16]) && v_a[_i16] === '"}') {
36717
+ } else if (!___default['default'].isNil(v_a[_i17]) && v_a[_i17] === '"}') {
36696
36718
  pfri[1] = 1;
36697
- } else if (!___default['default'].isNil(v_a[_i16]) && v_a[_i16] === "{)") {
36719
+ } else if (!___default['default'].isNil(v_a[_i17]) && v_a[_i17] === "{)") {
36698
36720
  pfri[1] = 1;
36699
36721
  } else {
36700
36722
  pfri[1] = _n.length;
36701
36723
  }
36702
36724
  return pfri;
36703
36725
  } else if (_p.length > _n.length) {
36704
- 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) === "}")) {
36705
36727
  pfri[0] += 1;
36706
36728
  pfri[1] = 1;
36707
36729
  }
@@ -36711,17 +36733,17 @@ function findrangeindex(ctx, v, vp) {
36711
36733
  }
36712
36734
  return pfri;
36713
36735
  } else if (vplen < vlen) {
36714
- var _i17 = pfri[0];
36715
- var _p2 = vp_a[_i17];
36716
- var _n2 = v_a[_i17];
36736
+ var _i18 = pfri[0];
36737
+ var _p2 = vp_a[_i18];
36738
+ var _n2 = v_a[_i18];
36717
36739
  if (___default['default'].isNil(_p2)) {
36718
36740
  pfri[0] = v_a.length - 1;
36719
36741
  var last = v_a[pfri[0]];
36720
36742
  pfri[1] = ___default['default'].isNil(last) ? 1 : last.length;
36721
36743
  } else if (_p2.length === _n2.length) {
36722
- 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) === "}")) {
36723
36745
  pfri[1] = _n2.length;
36724
- } 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) === "}")) {
36725
36747
  pfri[0] += 1;
36726
36748
  pfri[1] = 1;
36727
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) === ")") {
@@ -36731,7 +36753,7 @@ function findrangeindex(ctx, v, vp) {
36731
36753
  } else {
36732
36754
  pfri[0] = pfri[0] + vlen - vplen;
36733
36755
  if (v_a.length > vp_a.length) {
36734
- pfri[1] = v_a[_i17 + 1].length;
36756
+ pfri[1] = v_a[_i18 + 1].length;
36735
36757
  } else {
36736
36758
  pfri[1] = 1;
36737
36759
  }
@@ -36740,17 +36762,17 @@ function findrangeindex(ctx, v, vp) {
36740
36762
  } else if (_p2.length > _n2.length) {
36741
36763
  if (!___default['default'].isNil(_p2) && _p2.substring(0, 1) === '"') {
36742
36764
  pfri[1] = _n2.length;
36743
- } 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])) {
36744
36766
  pfri[0] += 1;
36745
- pfri[1] = v_a[_i17 + 1].length;
36746
- } 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)) {
36747
36769
  pfri[0] += 1;
36748
36770
  pfri[1] = 1;
36749
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, "=")) {
36750
36772
  return [vlen - 1, v_a[vlen - 1].length];
36751
36773
  } else {
36752
36774
  pfri[0] = pfri[0] + vlen - vplen - 1;
36753
- pfri[1] = v_a[(_i17 || 1) - 1].length;
36775
+ pfri[1] = v_a[(_i18 || 1) - 1].length;
36754
36776
  }
36755
36777
  return pfri;
36756
36778
  } else if (_p2.length < _n2.length) {
@@ -36797,9 +36819,9 @@ function locateTextOffset(node, offset) {
36797
36819
  text = walker.nextNode();
36798
36820
  }
36799
36821
  var acc = 0;
36800
- for (var _i18 = 0; _i18 < texts.length; _i18 += 1) {
36822
+ for (var _i19 = 0; _i19 < texts.length; _i19 += 1) {
36801
36823
  var _item$textContent$len, _item$textContent;
36802
- var item = texts[_i18];
36824
+ var item = texts[_i19];
36803
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;
36804
36826
  if (offset <= acc + len) {
36805
36827
  return [item, Math.max(0, offset - acc)];
@@ -36885,8 +36907,8 @@ function searchFunction(ctx, searchtxt) {
36885
36907
  var f = [];
36886
36908
  var s = [];
36887
36909
  var t = [];
36888
- for (var _i19 = 0; _i19 < functionlist.length; _i19 += 1) {
36889
- var item = functionlist[_i19];
36910
+ for (var _i20 = 0; _i20 < functionlist.length; _i20 += 1) {
36911
+ var item = functionlist[_i20];
36890
36912
  var n = item.n;
36891
36913
  if (n === searchtxt) {
36892
36914
  f.unshift(item);
@@ -36942,8 +36964,8 @@ function helpFunctionExe($editer, currSelection, ctx) {
36942
36964
  var _locale2 = locale(ctx),
36943
36965
  functionlist = _locale2.functionlist;
36944
36966
  if (___default['default'].isEmpty(ctx.formulaCache.functionlistMap)) {
36945
- for (var _i20 = 0; _i20 < functionlist.length; _i20 += 1) {
36946
- 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];
36947
36969
  }
36948
36970
  }
36949
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.2",
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.2",
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",