@leankylin-sheet/core 5.2.22 → 5.2.24

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