@leankylin-sheet/core 5.2.77 → 6.0.0

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
@@ -57129,17 +57129,19 @@ function setCellValuesByRange(ctx, data, range, cellInput) {
57129
57129
  cfg.merge = {};
57130
57130
  }
57131
57131
  var formulaCells = [];
57132
- var modifiedCells = [];
57132
+ var changedCells = [];
57133
57133
  for (var i = 0; i < rowCount; i += 1) {
57134
57134
  for (var j = 0; j < columnCount; j += 1) {
57135
57135
  var row = rowStart + i;
57136
57136
  var column = colStart + j;
57137
57137
  var value = data[i][j];
57138
- modifiedCells.push({
57139
- r: row,
57140
- c: column,
57141
- i: sheet.id
57142
- });
57138
+ if (!isCellValueUnchanged(sheet, row, column, value)) {
57139
+ changedCells.push({
57140
+ r: row,
57141
+ c: column,
57142
+ i: sheet.id
57143
+ });
57144
+ }
57143
57145
  setCellValueInBatch(ctx, sheet, row, column, value, cellInput, formulaCells);
57144
57146
  if (setMerge) {
57145
57147
  var _value$mc, _value$mc2, _value$mc3, _value$mc4;
@@ -57161,22 +57163,23 @@ function setCellValuesByRange(ctx, data, range, cellInput) {
57161
57163
  if (setMerge) {
57162
57164
  sheet.config = cfg;
57163
57165
  }
57164
- if (modifiedCells.length > 0) {
57165
- registerExecFunctionExist(ctx, sheet, formulaCells, modifiedCells);
57166
- for (var k = 0; k < formulaCells.length; k += 1) {
57167
- var fc = formulaCells[k];
57168
- var v = execfunction(ctx, fc.f, fc.r, fc.c, sheet.id, false, true);
57169
- setCellValue(ctx, fc.r, fc.c, flowdata, {
57170
- v: v[1],
57171
- f: v[2]
57172
- });
57173
- }
57174
- ctx.formulaCache.execFunctionExist.reverse();
57175
- execFunctionGroup(ctx, null, null, null, null, flowdata, false, true);
57176
- groupValuesRefresh(ctx);
57177
- updateFunctionGroup(ctx);
57178
- ctx.formulaCache.execFunctionGlobalData = null;
57166
+ if (formulaCells.length === 0 && changedCells.length === 0) {
57167
+ return;
57179
57168
  }
57169
+ registerExecFunctionExist(ctx, sheet, formulaCells, changedCells);
57170
+ for (var k = 0; k < formulaCells.length; k += 1) {
57171
+ var fc = formulaCells[k];
57172
+ var v = execfunction(ctx, fc.f, fc.r, fc.c, sheet.id, false, true);
57173
+ setCellValue(ctx, fc.r, fc.c, flowdata, {
57174
+ v: v[1],
57175
+ f: v[2]
57176
+ });
57177
+ }
57178
+ ctx.formulaCache.execFunctionExist.reverse();
57179
+ execFunctionGroup(ctx, null, null, null, null, flowdata, false, true);
57180
+ groupValuesRefresh(ctx);
57181
+ updateFunctionGroup(ctx);
57182
+ ctx.formulaCache.execFunctionGlobalData = null;
57180
57183
  }
57181
57184
  function setCellValues(ctx, data, cellInput) {
57182
57185
  var _data$, _data$2;
@@ -61245,8 +61248,8 @@ function handlePasteByLeanklin(_x2, _x3, _x4) {
61245
61248
  }
61246
61249
  function _handlePasteByLeanklin() {
61247
61250
  _handlePasteByLeanklin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(ctx, e, copyRich) {
61248
- var _ctx$luckysheet_selec8, _data$0$;
61249
- var allowEdit, selectRange, rows, columns, _getClipboardData, copyData, borderInfo, merge, _ctx$config$borderInf, index, data, copyOne, pasteData, r, rIndex, c, row, column, range;
61251
+ var _ctx$luckysheet_selec8, _data$0$, _prevSelectSave$, _prevSelectSave$$row, _prevSelectSave$2, _prevSelectSave$2$row, _prevSelectSave$3, _prevSelectSave$3$col, _prevSelectSave$4, _prevSelectSave$4$col;
61252
+ var allowEdit, selectRange, rows, columns, _getClipboardData, copyData, borderInfo, merge, _ctx$config$borderInf, index, data, copyOne, pasteData, r, rIndex, c, row, column, range, nextSelectSave, prevSelectSave, isSame;
61250
61253
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
61251
61254
  while (1) switch (_context2.prev = _context2.next) {
61252
61255
  case 0:
@@ -61309,9 +61312,14 @@ function _handlePasteByLeanklin() {
61309
61312
  console.time('setCellValuesByRange');
61310
61313
  setCellValuesByRange(ctx, pasteData, range, null);
61311
61314
  console.timeEnd('setCellValuesByRange');
61312
- ctx.luckysheet_select_save = [range];
61315
+ nextSelectSave = [range];
61316
+ prevSelectSave = ctx.luckysheet_select_save;
61317
+ isSame = Array.isArray(prevSelectSave) && prevSelectSave.length === 1 && ((_prevSelectSave$ = prevSelectSave[0]) === null || _prevSelectSave$ === void 0 ? void 0 : (_prevSelectSave$$row = _prevSelectSave$.row) === null || _prevSelectSave$$row === void 0 ? void 0 : _prevSelectSave$$row[0]) === range.row[0] && ((_prevSelectSave$2 = prevSelectSave[0]) === null || _prevSelectSave$2 === void 0 ? void 0 : (_prevSelectSave$2$row = _prevSelectSave$2.row) === null || _prevSelectSave$2$row === void 0 ? void 0 : _prevSelectSave$2$row[1]) === range.row[1] && ((_prevSelectSave$3 = prevSelectSave[0]) === null || _prevSelectSave$3 === void 0 ? void 0 : (_prevSelectSave$3$col = _prevSelectSave$3.column) === null || _prevSelectSave$3$col === void 0 ? void 0 : _prevSelectSave$3$col[0]) === range.column[0] && ((_prevSelectSave$4 = prevSelectSave[0]) === null || _prevSelectSave$4 === void 0 ? void 0 : (_prevSelectSave$4$col = _prevSelectSave$4.column) === null || _prevSelectSave$4$col === void 0 ? void 0 : _prevSelectSave$4$col[1]) === range.column[1];
61318
+ if (!isSame) {
61319
+ ctx.luckysheet_select_save = nextSelectSave;
61320
+ }
61313
61321
  console.timeEnd('handlePasteByLeanklin');
61314
- case 30:
61322
+ case 33:
61315
61323
  case "end":
61316
61324
  return _context2.stop();
61317
61325
  }
package/dist/index.js CHANGED
@@ -57139,17 +57139,19 @@ function setCellValuesByRange(ctx, data, range, cellInput) {
57139
57139
  cfg.merge = {};
57140
57140
  }
57141
57141
  var formulaCells = [];
57142
- var modifiedCells = [];
57142
+ var changedCells = [];
57143
57143
  for (var i = 0; i < rowCount; i += 1) {
57144
57144
  for (var j = 0; j < columnCount; j += 1) {
57145
57145
  var row = rowStart + i;
57146
57146
  var column = colStart + j;
57147
57147
  var value = data[i][j];
57148
- modifiedCells.push({
57149
- r: row,
57150
- c: column,
57151
- i: sheet.id
57152
- });
57148
+ if (!isCellValueUnchanged(sheet, row, column, value)) {
57149
+ changedCells.push({
57150
+ r: row,
57151
+ c: column,
57152
+ i: sheet.id
57153
+ });
57154
+ }
57153
57155
  setCellValueInBatch(ctx, sheet, row, column, value, cellInput, formulaCells);
57154
57156
  if (setMerge) {
57155
57157
  var _value$mc, _value$mc2, _value$mc3, _value$mc4;
@@ -57171,22 +57173,23 @@ function setCellValuesByRange(ctx, data, range, cellInput) {
57171
57173
  if (setMerge) {
57172
57174
  sheet.config = cfg;
57173
57175
  }
57174
- if (modifiedCells.length > 0) {
57175
- registerExecFunctionExist(ctx, sheet, formulaCells, modifiedCells);
57176
- for (var k = 0; k < formulaCells.length; k += 1) {
57177
- var fc = formulaCells[k];
57178
- var v = execfunction(ctx, fc.f, fc.r, fc.c, sheet.id, false, true);
57179
- setCellValue(ctx, fc.r, fc.c, flowdata, {
57180
- v: v[1],
57181
- f: v[2]
57182
- });
57183
- }
57184
- ctx.formulaCache.execFunctionExist.reverse();
57185
- execFunctionGroup(ctx, null, null, null, null, flowdata, false, true);
57186
- groupValuesRefresh(ctx);
57187
- updateFunctionGroup(ctx);
57188
- ctx.formulaCache.execFunctionGlobalData = null;
57176
+ if (formulaCells.length === 0 && changedCells.length === 0) {
57177
+ return;
57189
57178
  }
57179
+ registerExecFunctionExist(ctx, sheet, formulaCells, changedCells);
57180
+ for (var k = 0; k < formulaCells.length; k += 1) {
57181
+ var fc = formulaCells[k];
57182
+ var v = execfunction(ctx, fc.f, fc.r, fc.c, sheet.id, false, true);
57183
+ setCellValue(ctx, fc.r, fc.c, flowdata, {
57184
+ v: v[1],
57185
+ f: v[2]
57186
+ });
57187
+ }
57188
+ ctx.formulaCache.execFunctionExist.reverse();
57189
+ execFunctionGroup(ctx, null, null, null, null, flowdata, false, true);
57190
+ groupValuesRefresh(ctx);
57191
+ updateFunctionGroup(ctx);
57192
+ ctx.formulaCache.execFunctionGlobalData = null;
57190
57193
  }
57191
57194
  function setCellValues(ctx, data, cellInput) {
57192
57195
  var _data$, _data$2;
@@ -61255,8 +61258,8 @@ function handlePasteByLeanklin(_x2, _x3, _x4) {
61255
61258
  }
61256
61259
  function _handlePasteByLeanklin() {
61257
61260
  _handlePasteByLeanklin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(ctx, e, copyRich) {
61258
- var _ctx$luckysheet_selec8, _data$0$;
61259
- var allowEdit, selectRange, rows, columns, _getClipboardData, copyData, borderInfo, merge, _ctx$config$borderInf, index, data, copyOne, pasteData, r, rIndex, c, row, column, range;
61261
+ var _ctx$luckysheet_selec8, _data$0$, _prevSelectSave$, _prevSelectSave$$row, _prevSelectSave$2, _prevSelectSave$2$row, _prevSelectSave$3, _prevSelectSave$3$col, _prevSelectSave$4, _prevSelectSave$4$col;
61262
+ var allowEdit, selectRange, rows, columns, _getClipboardData, copyData, borderInfo, merge, _ctx$config$borderInf, index, data, copyOne, pasteData, r, rIndex, c, row, column, range, nextSelectSave, prevSelectSave, isSame;
61260
61263
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
61261
61264
  while (1) switch (_context2.prev = _context2.next) {
61262
61265
  case 0:
@@ -61319,9 +61322,14 @@ function _handlePasteByLeanklin() {
61319
61322
  console.time('setCellValuesByRange');
61320
61323
  setCellValuesByRange(ctx, pasteData, range, null);
61321
61324
  console.timeEnd('setCellValuesByRange');
61322
- ctx.luckysheet_select_save = [range];
61325
+ nextSelectSave = [range];
61326
+ prevSelectSave = ctx.luckysheet_select_save;
61327
+ isSame = Array.isArray(prevSelectSave) && prevSelectSave.length === 1 && ((_prevSelectSave$ = prevSelectSave[0]) === null || _prevSelectSave$ === void 0 ? void 0 : (_prevSelectSave$$row = _prevSelectSave$.row) === null || _prevSelectSave$$row === void 0 ? void 0 : _prevSelectSave$$row[0]) === range.row[0] && ((_prevSelectSave$2 = prevSelectSave[0]) === null || _prevSelectSave$2 === void 0 ? void 0 : (_prevSelectSave$2$row = _prevSelectSave$2.row) === null || _prevSelectSave$2$row === void 0 ? void 0 : _prevSelectSave$2$row[1]) === range.row[1] && ((_prevSelectSave$3 = prevSelectSave[0]) === null || _prevSelectSave$3 === void 0 ? void 0 : (_prevSelectSave$3$col = _prevSelectSave$3.column) === null || _prevSelectSave$3$col === void 0 ? void 0 : _prevSelectSave$3$col[0]) === range.column[0] && ((_prevSelectSave$4 = prevSelectSave[0]) === null || _prevSelectSave$4 === void 0 ? void 0 : (_prevSelectSave$4$col = _prevSelectSave$4.column) === null || _prevSelectSave$4$col === void 0 ? void 0 : _prevSelectSave$4$col[1]) === range.column[1];
61328
+ if (!isSame) {
61329
+ ctx.luckysheet_select_save = nextSelectSave;
61330
+ }
61323
61331
  console.timeEnd('handlePasteByLeanklin');
61324
- case 30:
61332
+ case 33:
61325
61333
  case "end":
61326
61334
  return _context2.stop();
61327
61335
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "5.2.77",
3
+ "version": "6.0.0",
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.77",
16
+ "@leankylin-sheet/formula-parser": "6.0.0",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",