@leankylin-sheet/core 5.2.33 → 5.2.34

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.
@@ -9,7 +9,8 @@ export declare function hideSheet(ctx: Context, sheetId: string): void;
9
9
  export declare function showSheet(ctx: Context, sheetId: string): void;
10
10
  export declare function copySheet(ctx: Context, sheetId: string, hooks: Hooks): void;
11
11
  export declare function calculateSheetFromula(ctx: Context, id: string, isrefresh: boolean): void;
12
- export declare function updateFunctionGroup(ctx: Context): void;
12
+ export declare function updateFunctionGroupBySheetId(ctx: Context, id: string): void;
13
+ export declare function updateFunctionGroup(ctx: Context, id?: string): void;
13
14
  export declare function calculateSheetByCells(ctx: Context, cells: {
14
15
  r: number;
15
16
  c: number;
package/dist/index.esm.js CHANGED
@@ -36227,6 +36227,7 @@ function groupValuesRefresh(ctx) {
36227
36227
  function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36228
36228
  var isForce = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
36229
36229
  var notInsertFunc = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : true;
36230
+ console.time('execFunctionGroup-before');
36230
36231
  if (_.isNil(data)) {
36231
36232
  data = getFlowdata(ctx);
36232
36233
  }
@@ -36264,6 +36265,7 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36264
36265
  updateValueOjects[_key] = 1;
36265
36266
  }
36266
36267
  }
36268
+ console.time('arrayMatchCache');
36267
36269
  var arrayMatchCache = {};
36268
36270
  var arrayMatch = function arrayMatch(formulaArray, _formulaObjects, _updateValueOjects, func) {
36269
36271
  for (var a = 0; a < formulaArray.length; a += 1) {
@@ -36296,6 +36298,8 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36296
36298
  }
36297
36299
  }
36298
36300
  };
36301
+ console.timeEnd('arrayMatchCache');
36302
+ console.time('cache1');
36299
36303
  var _loop = function _loop() {
36300
36304
  var formulaCell = calcChains[_i12];
36301
36305
  var key = "r".concat(formulaCell.r, "c").concat(formulaCell.c, "i").concat(formulaCell.id);
@@ -36398,6 +36402,8 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36398
36402
  for (var _i12 = 0; _i12 < calcChains.length; _i12 += 1) {
36399
36403
  if (_loop()) continue;
36400
36404
  }
36405
+ console.timeEnd('cache1');
36406
+ console.time('cache2');
36401
36407
  Object.keys(formulaObjects).forEach(function (key) {
36402
36408
  var formulaObject = formulaObjects[key];
36403
36409
  arrayMatch(formulaObject.formulaArray, formulaObjects, updateValueOjects, function (childKey) {
@@ -36414,6 +36420,8 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36414
36420
  updateValueArray.push(formulaObject);
36415
36421
  }
36416
36422
  });
36423
+ console.timeEnd('cache2');
36424
+ console.time('dev');
36417
36425
  var visited = {};
36418
36426
  var inStack = {};
36419
36427
  var circularNodes = {};
@@ -36476,6 +36484,7 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36476
36484
  }
36477
36485
  });
36478
36486
  }
36487
+ console.timeEnd('dev');
36479
36488
  var formulaRunList = [];
36480
36489
  var stack = updateValueArray;
36481
36490
  var existsFormulaRunList = {};
@@ -36511,7 +36520,9 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36511
36520
  if (_ret === 0) continue;
36512
36521
  }
36513
36522
  formulaRunList.reverse();
36523
+ console.timeEnd('execFunctionGroup-before');
36514
36524
  console.time('formulaRunList');
36525
+ console.log('formulaRunList', formulaRunList);
36515
36526
  for (var _i14 = 0; _i14 < formulaRunList.length; _i14 += 1) {
36516
36527
  var formulaCell = formulaRunList[_i14];
36517
36528
  if (formulaCell.level === Math.max) {
@@ -42613,9 +42624,7 @@ function deepClear(ctx) {
42613
42624
  var _d$r2;
42614
42625
  var cell = d === null || d === void 0 ? void 0 : (_d$r2 = d[r]) === null || _d$r2 === void 0 ? void 0 : _d$r2[c];
42615
42626
  d[r][c] = null;
42616
- if ((cell === null || cell === void 0 ? void 0 : cell.f) != null) {
42617
- delFunctionGroup(ctx, r, c, ctx.currentSheetId);
42618
- }
42627
+ if ((cell === null || cell === void 0 ? void 0 : cell.f) != null) ;
42619
42628
  if (hyperlinkMap && hyperlinkMap["".concat(r, "_").concat(c)]) {
42620
42629
  delete hyperlinkMap["".concat(r, "_").concat(c)];
42621
42630
  }
@@ -42623,6 +42632,7 @@ function deepClear(ctx) {
42623
42632
  }
42624
42633
  }
42625
42634
  }
42635
+ updateFunctionGroup(ctx);
42626
42636
  return "success";
42627
42637
  }
42628
42638
  function deleteSelectedCellText(ctx, deep) {
@@ -42665,7 +42675,6 @@ function deleteSelectedCellText(ctx, deep) {
42665
42675
  delete cell.v;
42666
42676
  if (cell.f != null) {
42667
42677
  delete cell.f;
42668
- delFunctionGroup(ctx, r, c, ctx.currentSheetId);
42669
42678
  delete cell.spl;
42670
42679
  }
42671
42680
  if (cell.ct != null && cell.ct.t === "inlineStr") {
@@ -42680,6 +42689,9 @@ function deleteSelectedCellText(ctx, deep) {
42680
42689
  }
42681
42690
  }
42682
42691
  }
42692
+ console.time('deleteSelectedCellText');
42693
+ updateFunctionGroup(ctx);
42694
+ console.timeEnd('deleteSelectedCellText');
42683
42695
  }
42684
42696
  return "success";
42685
42697
  }
@@ -46736,29 +46748,39 @@ function calculateSheetFromula(ctx, id, isrefresh) {
46736
46748
  }
46737
46749
  console.timeEnd("calcTime:".concat(id));
46738
46750
  }
46739
- function updateFunctionGroup(ctx) {
46751
+ function updateFunctionGroupBySheetId(ctx, id) {
46752
+ var _ctx$luckysheetfile$i, _ctx$luckysheetfile$i2, _ctx$luckysheetfile$i3;
46740
46753
  var luckysheetfile = ctx.luckysheetfile;
46741
- for (var index = 0; index < luckysheetfile.length; index++) {
46742
- var _ctx$luckysheetfile$i, _ctx$luckysheetfile$i2, _ctx$luckysheetfile$i3;
46743
- var file = luckysheetfile[index];
46744
- var calcChain = [];
46745
- var rows = (_ctx$luckysheetfile$i = (_ctx$luckysheetfile$i2 = ctx.luckysheetfile[index]) === null || _ctx$luckysheetfile$i2 === void 0 ? void 0 : (_ctx$luckysheetfile$i3 = _ctx$luckysheetfile$i2.data) === null || _ctx$luckysheetfile$i3 === void 0 ? void 0 : _ctx$luckysheetfile$i3.length) !== null && _ctx$luckysheetfile$i !== void 0 ? _ctx$luckysheetfile$i : 0;
46746
- for (var r = 0; r < rows; r += 1) {
46747
- for (var c = 0; c < ctx.luckysheetfile[index].data[r].length; c += 1) {
46748
- var cell = ctx.luckysheetfile[index].data[r][c];
46749
- if (!(cell === null || cell === void 0 ? void 0 : cell.f)) {
46750
- continue;
46751
- }
46752
- var cc = {
46753
- r: r,
46754
- c: c,
46755
- id: file.id,
46756
- f: cell === null || cell === void 0 ? void 0 : cell.f
46757
- };
46758
- calcChain.push(cc);
46754
+ var index = getSheetIndex(ctx, id);
46755
+ var file = luckysheetfile[index];
46756
+ var calcChain = [];
46757
+ var rows = (_ctx$luckysheetfile$i = (_ctx$luckysheetfile$i2 = ctx.luckysheetfile[index]) === null || _ctx$luckysheetfile$i2 === void 0 ? void 0 : (_ctx$luckysheetfile$i3 = _ctx$luckysheetfile$i2.data) === null || _ctx$luckysheetfile$i3 === void 0 ? void 0 : _ctx$luckysheetfile$i3.length) !== null && _ctx$luckysheetfile$i !== void 0 ? _ctx$luckysheetfile$i : 0;
46758
+ for (var r = 0; r < rows; r += 1) {
46759
+ for (var c = 0; c < ctx.luckysheetfile[index].data[r].length; c += 1) {
46760
+ var cell = ctx.luckysheetfile[index].data[r][c];
46761
+ if (!(cell === null || cell === void 0 ? void 0 : cell.f)) {
46762
+ continue;
46759
46763
  }
46764
+ var cc = {
46765
+ r: r,
46766
+ c: c,
46767
+ id: file.id,
46768
+ f: cell === null || cell === void 0 ? void 0 : cell.f
46769
+ };
46770
+ calcChain.push(cc);
46760
46771
  }
46761
- file.calcChain = calcChain;
46772
+ }
46773
+ file.calcChain = calcChain;
46774
+ }
46775
+ function updateFunctionGroup(ctx, id) {
46776
+ if (id) {
46777
+ updateFunctionGroupBySheetId(ctx, id);
46778
+ return;
46779
+ }
46780
+ var luckysheetfile = ctx.luckysheetfile;
46781
+ for (var index = 0; index < luckysheetfile.length; index++) {
46782
+ var file = luckysheetfile[index];
46783
+ updateFunctionGroupBySheetId(ctx, file.id);
46762
46784
  }
46763
46785
  }
46764
46786
  function parseCellReferences(expression) {
@@ -47620,7 +47642,9 @@ function runExecFunction(ctx, range, index, data) {
47620
47642
  }
47621
47643
  }
47622
47644
  ctx.formulaCache.execFunctionExist.reverse();
47645
+ console.time('execFunctionGroup');
47623
47646
  execFunctionGroup(ctx, null, null, null, null, data);
47647
+ console.timeEnd('execFunctionGroup');
47624
47648
  ctx.formulaCache.execFunctionGlobalData = null;
47625
47649
  updateFunctionGroup(ctx);
47626
47650
  }
@@ -47633,6 +47657,7 @@ function jfrefreshgrid(ctx, data, range) {
47633
47657
  range = ctx.luckysheet_select_save;
47634
47658
  if (range == null) return;
47635
47659
  }
47660
+ console.log('isRunExecFunction', isRunExecFunction);
47636
47661
  if (isRunExecFunction) {
47637
47662
  runExecFunction(ctx, range, ctx.currentSheetId, data);
47638
47663
  }
@@ -56821,6 +56846,7 @@ var index = /*#__PURE__*/Object.freeze({
56821
56846
  showSheet: showSheet,
56822
56847
  copySheet: copySheet,
56823
56848
  calculateSheetFromula: calculateSheetFromula,
56849
+ updateFunctionGroupBySheetId: updateFunctionGroupBySheetId,
56824
56850
  updateFunctionGroup: updateFunctionGroup,
56825
56851
  calculateSheetByCells: calculateSheetByCells,
56826
56852
  addSheet: addSheet$1,
package/dist/index.js CHANGED
@@ -36237,6 +36237,7 @@ function groupValuesRefresh(ctx) {
36237
36237
  function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36238
36238
  var isForce = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
36239
36239
  var notInsertFunc = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : true;
36240
+ console.time('execFunctionGroup-before');
36240
36241
  if (___default['default'].isNil(data)) {
36241
36242
  data = getFlowdata(ctx);
36242
36243
  }
@@ -36274,6 +36275,7 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36274
36275
  updateValueOjects[_key] = 1;
36275
36276
  }
36276
36277
  }
36278
+ console.time('arrayMatchCache');
36277
36279
  var arrayMatchCache = {};
36278
36280
  var arrayMatch = function arrayMatch(formulaArray, _formulaObjects, _updateValueOjects, func) {
36279
36281
  for (var a = 0; a < formulaArray.length; a += 1) {
@@ -36306,6 +36308,8 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36306
36308
  }
36307
36309
  }
36308
36310
  };
36311
+ console.timeEnd('arrayMatchCache');
36312
+ console.time('cache1');
36309
36313
  var _loop = function _loop() {
36310
36314
  var formulaCell = calcChains[_i12];
36311
36315
  var key = "r".concat(formulaCell.r, "c").concat(formulaCell.c, "i").concat(formulaCell.id);
@@ -36408,6 +36412,8 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36408
36412
  for (var _i12 = 0; _i12 < calcChains.length; _i12 += 1) {
36409
36413
  if (_loop()) continue;
36410
36414
  }
36415
+ console.timeEnd('cache1');
36416
+ console.time('cache2');
36411
36417
  Object.keys(formulaObjects).forEach(function (key) {
36412
36418
  var formulaObject = formulaObjects[key];
36413
36419
  arrayMatch(formulaObject.formulaArray, formulaObjects, updateValueOjects, function (childKey) {
@@ -36424,6 +36430,8 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36424
36430
  updateValueArray.push(formulaObject);
36425
36431
  }
36426
36432
  });
36433
+ console.timeEnd('cache2');
36434
+ console.time('dev');
36427
36435
  var visited = {};
36428
36436
  var inStack = {};
36429
36437
  var circularNodes = {};
@@ -36486,6 +36494,7 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36486
36494
  }
36487
36495
  });
36488
36496
  }
36497
+ console.timeEnd('dev');
36489
36498
  var formulaRunList = [];
36490
36499
  var stack = updateValueArray;
36491
36500
  var existsFormulaRunList = {};
@@ -36521,7 +36530,9 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
36521
36530
  if (_ret === 0) continue;
36522
36531
  }
36523
36532
  formulaRunList.reverse();
36533
+ console.timeEnd('execFunctionGroup-before');
36524
36534
  console.time('formulaRunList');
36535
+ console.log('formulaRunList', formulaRunList);
36525
36536
  for (var _i14 = 0; _i14 < formulaRunList.length; _i14 += 1) {
36526
36537
  var formulaCell = formulaRunList[_i14];
36527
36538
  if (formulaCell.level === Math.max) {
@@ -42623,9 +42634,7 @@ function deepClear(ctx) {
42623
42634
  var _d$r2;
42624
42635
  var cell = d === null || d === void 0 ? void 0 : (_d$r2 = d[r]) === null || _d$r2 === void 0 ? void 0 : _d$r2[c];
42625
42636
  d[r][c] = null;
42626
- if ((cell === null || cell === void 0 ? void 0 : cell.f) != null) {
42627
- delFunctionGroup(ctx, r, c, ctx.currentSheetId);
42628
- }
42637
+ if ((cell === null || cell === void 0 ? void 0 : cell.f) != null) ;
42629
42638
  if (hyperlinkMap && hyperlinkMap["".concat(r, "_").concat(c)]) {
42630
42639
  delete hyperlinkMap["".concat(r, "_").concat(c)];
42631
42640
  }
@@ -42633,6 +42642,7 @@ function deepClear(ctx) {
42633
42642
  }
42634
42643
  }
42635
42644
  }
42645
+ updateFunctionGroup(ctx);
42636
42646
  return "success";
42637
42647
  }
42638
42648
  function deleteSelectedCellText(ctx, deep) {
@@ -42675,7 +42685,6 @@ function deleteSelectedCellText(ctx, deep) {
42675
42685
  delete cell.v;
42676
42686
  if (cell.f != null) {
42677
42687
  delete cell.f;
42678
- delFunctionGroup(ctx, r, c, ctx.currentSheetId);
42679
42688
  delete cell.spl;
42680
42689
  }
42681
42690
  if (cell.ct != null && cell.ct.t === "inlineStr") {
@@ -42690,6 +42699,9 @@ function deleteSelectedCellText(ctx, deep) {
42690
42699
  }
42691
42700
  }
42692
42701
  }
42702
+ console.time('deleteSelectedCellText');
42703
+ updateFunctionGroup(ctx);
42704
+ console.timeEnd('deleteSelectedCellText');
42693
42705
  }
42694
42706
  return "success";
42695
42707
  }
@@ -46746,29 +46758,39 @@ function calculateSheetFromula(ctx, id, isrefresh) {
46746
46758
  }
46747
46759
  console.timeEnd("calcTime:".concat(id));
46748
46760
  }
46749
- function updateFunctionGroup(ctx) {
46761
+ function updateFunctionGroupBySheetId(ctx, id) {
46762
+ var _ctx$luckysheetfile$i, _ctx$luckysheetfile$i2, _ctx$luckysheetfile$i3;
46750
46763
  var luckysheetfile = ctx.luckysheetfile;
46751
- for (var index = 0; index < luckysheetfile.length; index++) {
46752
- var _ctx$luckysheetfile$i, _ctx$luckysheetfile$i2, _ctx$luckysheetfile$i3;
46753
- var file = luckysheetfile[index];
46754
- var calcChain = [];
46755
- var rows = (_ctx$luckysheetfile$i = (_ctx$luckysheetfile$i2 = ctx.luckysheetfile[index]) === null || _ctx$luckysheetfile$i2 === void 0 ? void 0 : (_ctx$luckysheetfile$i3 = _ctx$luckysheetfile$i2.data) === null || _ctx$luckysheetfile$i3 === void 0 ? void 0 : _ctx$luckysheetfile$i3.length) !== null && _ctx$luckysheetfile$i !== void 0 ? _ctx$luckysheetfile$i : 0;
46756
- for (var r = 0; r < rows; r += 1) {
46757
- for (var c = 0; c < ctx.luckysheetfile[index].data[r].length; c += 1) {
46758
- var cell = ctx.luckysheetfile[index].data[r][c];
46759
- if (!(cell === null || cell === void 0 ? void 0 : cell.f)) {
46760
- continue;
46761
- }
46762
- var cc = {
46763
- r: r,
46764
- c: c,
46765
- id: file.id,
46766
- f: cell === null || cell === void 0 ? void 0 : cell.f
46767
- };
46768
- calcChain.push(cc);
46764
+ var index = getSheetIndex(ctx, id);
46765
+ var file = luckysheetfile[index];
46766
+ var calcChain = [];
46767
+ var rows = (_ctx$luckysheetfile$i = (_ctx$luckysheetfile$i2 = ctx.luckysheetfile[index]) === null || _ctx$luckysheetfile$i2 === void 0 ? void 0 : (_ctx$luckysheetfile$i3 = _ctx$luckysheetfile$i2.data) === null || _ctx$luckysheetfile$i3 === void 0 ? void 0 : _ctx$luckysheetfile$i3.length) !== null && _ctx$luckysheetfile$i !== void 0 ? _ctx$luckysheetfile$i : 0;
46768
+ for (var r = 0; r < rows; r += 1) {
46769
+ for (var c = 0; c < ctx.luckysheetfile[index].data[r].length; c += 1) {
46770
+ var cell = ctx.luckysheetfile[index].data[r][c];
46771
+ if (!(cell === null || cell === void 0 ? void 0 : cell.f)) {
46772
+ continue;
46769
46773
  }
46774
+ var cc = {
46775
+ r: r,
46776
+ c: c,
46777
+ id: file.id,
46778
+ f: cell === null || cell === void 0 ? void 0 : cell.f
46779
+ };
46780
+ calcChain.push(cc);
46770
46781
  }
46771
- file.calcChain = calcChain;
46782
+ }
46783
+ file.calcChain = calcChain;
46784
+ }
46785
+ function updateFunctionGroup(ctx, id) {
46786
+ if (id) {
46787
+ updateFunctionGroupBySheetId(ctx, id);
46788
+ return;
46789
+ }
46790
+ var luckysheetfile = ctx.luckysheetfile;
46791
+ for (var index = 0; index < luckysheetfile.length; index++) {
46792
+ var file = luckysheetfile[index];
46793
+ updateFunctionGroupBySheetId(ctx, file.id);
46772
46794
  }
46773
46795
  }
46774
46796
  function parseCellReferences(expression) {
@@ -47630,7 +47652,9 @@ function runExecFunction(ctx, range, index, data) {
47630
47652
  }
47631
47653
  }
47632
47654
  ctx.formulaCache.execFunctionExist.reverse();
47655
+ console.time('execFunctionGroup');
47633
47656
  execFunctionGroup(ctx, null, null, null, null, data);
47657
+ console.timeEnd('execFunctionGroup');
47634
47658
  ctx.formulaCache.execFunctionGlobalData = null;
47635
47659
  updateFunctionGroup(ctx);
47636
47660
  }
@@ -47643,6 +47667,7 @@ function jfrefreshgrid(ctx, data, range) {
47643
47667
  range = ctx.luckysheet_select_save;
47644
47668
  if (range == null) return;
47645
47669
  }
47670
+ console.log('isRunExecFunction', isRunExecFunction);
47646
47671
  if (isRunExecFunction) {
47647
47672
  runExecFunction(ctx, range, ctx.currentSheetId, data);
47648
47673
  }
@@ -56831,6 +56856,7 @@ var index = /*#__PURE__*/Object.freeze({
56831
56856
  showSheet: showSheet,
56832
56857
  copySheet: copySheet,
56833
56858
  calculateSheetFromula: calculateSheetFromula,
56859
+ updateFunctionGroupBySheetId: updateFunctionGroupBySheetId,
56834
56860
  updateFunctionGroup: updateFunctionGroup,
56835
56861
  calculateSheetByCells: calculateSheetByCells,
56836
56862
  addSheet: addSheet$1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "5.2.33",
3
+ "version": "5.2.34",
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.33",
16
+ "@leankylin-sheet/formula-parser": "5.2.34",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",