@leankylin-sheet/core 5.2.22 → 5.2.23

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
@@ -46589,19 +46589,39 @@ function calculateSheetFromula(ctx, id, isrefresh) {
46589
46589
  console.time("calcTime:".concat(id));
46590
46590
  var index$1 = getSheetIndex(ctx, id);
46591
46591
  var luckysheetfile = ctx.luckysheetfile;
46592
- if (!ctx.luckysheetfile[index$1].data) return;
46593
- for (var r = 0; r < ctx.luckysheetfile[index$1].data.length; r += 1) {
46594
- for (var c = 0; c < ctx.luckysheetfile[index$1].data[r].length; c += 1) {
46595
- var cell = ctx.luckysheetfile[index$1].data[r][c];
46592
+ var sheetData = luckysheetfile[index$1].data;
46593
+ if (!sheetData) return;
46594
+ var calcChain = luckysheetfile[index$1].calcChain || [];
46595
+ if (isrefresh && calcChain.length > 0) {
46596
+ execFunctionGroup(ctx, null, null, null, id, sheetData, true);
46597
+ groupValuesRefresh(ctx);
46598
+ } else {
46599
+ var cellsToUpdate = [];
46600
+ for (var i = 0; i < calcChain.length; i += 1) {
46601
+ var _calcChain$i = calcChain[i],
46602
+ r = _calcChain$i.r,
46603
+ c = _calcChain$i.c;
46604
+ var cell = sheetData[r][c];
46596
46605
  if (!(cell === null || cell === void 0 ? void 0 : cell.f)) {
46597
46606
  continue;
46598
46607
  }
46599
- var result = execfunction(ctx, cell === null || cell === void 0 ? void 0 : cell.f, r, c, id, isrefresh, true);
46608
+ var result = execfunction(ctx, cell.f, r, c, id, false, true);
46600
46609
  var newV = result[1];
46601
46610
  if (newV === cell.v) {
46602
46611
  continue;
46603
46612
  }
46604
- setCellValue$1(ctx, r, c, result[1], null, {
46613
+ cellsToUpdate.push({
46614
+ r: r,
46615
+ c: c,
46616
+ v: newV
46617
+ });
46618
+ }
46619
+ for (var _i = 0; _i < cellsToUpdate.length; _i += 1) {
46620
+ var _cellsToUpdate$_i = cellsToUpdate[_i],
46621
+ _r = _cellsToUpdate$_i.r,
46622
+ _c = _cellsToUpdate$_i.c,
46623
+ v = _cellsToUpdate$_i.v;
46624
+ setCellValue$1(ctx, _r, _c, v, null, {
46605
46625
  id: id
46606
46626
  });
46607
46627
  }
@@ -46671,9 +46691,9 @@ function calculateSheetByCells(ctx, cells) {
46671
46691
  for (var _index = 0; _index < calcChain.length; _index++) {
46672
46692
  var _parseCellReferences;
46673
46693
  var _calcChain$_index = calcChain[_index],
46674
- _r2 = _calcChain$_index.r,
46675
- _c2 = _calcChain$_index.c;
46676
- var cell = file.data[_r2][_c2];
46694
+ _r3 = _calcChain$_index.r,
46695
+ _c3 = _calcChain$_index.c;
46696
+ var cell = file.data[_r3][_c3];
46677
46697
  if (!(cell === null || cell === void 0 ? void 0 : cell.f)) {
46678
46698
  continue;
46679
46699
  }
@@ -46685,8 +46705,8 @@ function calculateSheetByCells(ctx, cells) {
46685
46705
  });
46686
46706
  if (n) {
46687
46707
  needUpdateCell.push({
46688
- r: _r2,
46689
- c: _c2,
46708
+ r: _r3,
46709
+ c: _c3,
46690
46710
  id: sheetId,
46691
46711
  f: cell.f,
46692
46712
  v: cell.v
@@ -46702,17 +46722,17 @@ function calculateSheetByCells(ctx, cells) {
46702
46722
  });
46703
46723
  for (var nIndex = 0; nIndex < needUpdateCell.length; nIndex++) {
46704
46724
  var _needUpdateCell$nInde = needUpdateCell[nIndex],
46705
- _r = _needUpdateCell$nInde.r,
46706
- _c = _needUpdateCell$nInde.c,
46725
+ _r2 = _needUpdateCell$nInde.r,
46726
+ _c2 = _needUpdateCell$nInde.c,
46707
46727
  _id = _needUpdateCell$nInde.id,
46708
46728
  _f = _needUpdateCell$nInde.f,
46709
46729
  v = _needUpdateCell$nInde.v;
46710
- var result = execfunction(ctx, _f, _r, _c, _id, undefined, true);
46730
+ var result = execfunction(ctx, _f, _r2, _c2, _id, undefined, true);
46711
46731
  var newV = result[1];
46712
46732
  if (newV === v) {
46713
46733
  continue;
46714
46734
  }
46715
- setCellValue$1(ctx, _r, _c, result[1], null, {
46735
+ setCellValue$1(ctx, _r2, _c2, result[1], null, {
46716
46736
  id: _id
46717
46737
  });
46718
46738
  }
package/dist/index.js CHANGED
@@ -46599,19 +46599,39 @@ function calculateSheetFromula(ctx, id, isrefresh) {
46599
46599
  console.time("calcTime:".concat(id));
46600
46600
  var index$1 = getSheetIndex(ctx, id);
46601
46601
  var luckysheetfile = ctx.luckysheetfile;
46602
- if (!ctx.luckysheetfile[index$1].data) return;
46603
- for (var r = 0; r < ctx.luckysheetfile[index$1].data.length; r += 1) {
46604
- for (var c = 0; c < ctx.luckysheetfile[index$1].data[r].length; c += 1) {
46605
- var cell = ctx.luckysheetfile[index$1].data[r][c];
46602
+ var sheetData = luckysheetfile[index$1].data;
46603
+ if (!sheetData) return;
46604
+ var calcChain = luckysheetfile[index$1].calcChain || [];
46605
+ if (isrefresh && calcChain.length > 0) {
46606
+ execFunctionGroup(ctx, null, null, null, id, sheetData, true);
46607
+ groupValuesRefresh(ctx);
46608
+ } else {
46609
+ var cellsToUpdate = [];
46610
+ for (var i = 0; i < calcChain.length; i += 1) {
46611
+ var _calcChain$i = calcChain[i],
46612
+ r = _calcChain$i.r,
46613
+ c = _calcChain$i.c;
46614
+ var cell = sheetData[r][c];
46606
46615
  if (!(cell === null || cell === void 0 ? void 0 : cell.f)) {
46607
46616
  continue;
46608
46617
  }
46609
- var result = execfunction(ctx, cell === null || cell === void 0 ? void 0 : cell.f, r, c, id, isrefresh, true);
46618
+ var result = execfunction(ctx, cell.f, r, c, id, false, true);
46610
46619
  var newV = result[1];
46611
46620
  if (newV === cell.v) {
46612
46621
  continue;
46613
46622
  }
46614
- setCellValue$1(ctx, r, c, result[1], null, {
46623
+ cellsToUpdate.push({
46624
+ r: r,
46625
+ c: c,
46626
+ v: newV
46627
+ });
46628
+ }
46629
+ for (var _i = 0; _i < cellsToUpdate.length; _i += 1) {
46630
+ var _cellsToUpdate$_i = cellsToUpdate[_i],
46631
+ _r = _cellsToUpdate$_i.r,
46632
+ _c = _cellsToUpdate$_i.c,
46633
+ v = _cellsToUpdate$_i.v;
46634
+ setCellValue$1(ctx, _r, _c, v, null, {
46615
46635
  id: id
46616
46636
  });
46617
46637
  }
@@ -46681,9 +46701,9 @@ function calculateSheetByCells(ctx, cells) {
46681
46701
  for (var _index = 0; _index < calcChain.length; _index++) {
46682
46702
  var _parseCellReferences;
46683
46703
  var _calcChain$_index = calcChain[_index],
46684
- _r2 = _calcChain$_index.r,
46685
- _c2 = _calcChain$_index.c;
46686
- var cell = file.data[_r2][_c2];
46704
+ _r3 = _calcChain$_index.r,
46705
+ _c3 = _calcChain$_index.c;
46706
+ var cell = file.data[_r3][_c3];
46687
46707
  if (!(cell === null || cell === void 0 ? void 0 : cell.f)) {
46688
46708
  continue;
46689
46709
  }
@@ -46695,8 +46715,8 @@ function calculateSheetByCells(ctx, cells) {
46695
46715
  });
46696
46716
  if (n) {
46697
46717
  needUpdateCell.push({
46698
- r: _r2,
46699
- c: _c2,
46718
+ r: _r3,
46719
+ c: _c3,
46700
46720
  id: sheetId,
46701
46721
  f: cell.f,
46702
46722
  v: cell.v
@@ -46712,17 +46732,17 @@ function calculateSheetByCells(ctx, cells) {
46712
46732
  });
46713
46733
  for (var nIndex = 0; nIndex < needUpdateCell.length; nIndex++) {
46714
46734
  var _needUpdateCell$nInde = needUpdateCell[nIndex],
46715
- _r = _needUpdateCell$nInde.r,
46716
- _c = _needUpdateCell$nInde.c,
46735
+ _r2 = _needUpdateCell$nInde.r,
46736
+ _c2 = _needUpdateCell$nInde.c,
46717
46737
  _id = _needUpdateCell$nInde.id,
46718
46738
  _f = _needUpdateCell$nInde.f,
46719
46739
  v = _needUpdateCell$nInde.v;
46720
- var result = execfunction(ctx, _f, _r, _c, _id, undefined, true);
46740
+ var result = execfunction(ctx, _f, _r2, _c2, _id, undefined, true);
46721
46741
  var newV = result[1];
46722
46742
  if (newV === v) {
46723
46743
  continue;
46724
46744
  }
46725
- setCellValue$1(ctx, _r, _c, result[1], null, {
46745
+ setCellValue$1(ctx, _r2, _c2, result[1], null, {
46726
46746
  id: _id
46727
46747
  });
46728
46748
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "5.2.22",
3
+ "version": "5.2.23",
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.22",
16
+ "@leankylin-sheet/formula-parser": "5.2.23",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",