@fileverse-dev/fortune-core 1.3.10-yjs → 1.3.10-yjs-2

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.
@@ -180,7 +180,7 @@ export function selectTitlesRange(map) {
180
180
  return rangeArr;
181
181
  }
182
182
  export function pasteHandlerOfPaintModel(ctx, copyRange) {
183
- var _a;
183
+ var _a, _b, _c;
184
184
  var cfg = ctx.config;
185
185
  if (cfg.merge == null) {
186
186
  cfg.merge = {};
@@ -219,6 +219,7 @@ export function pasteHandlerOfPaintModel(ctx, copyRange) {
219
219
  var timesC = Math.ceil((maxc - minc + 1) / copyc);
220
220
  var flowdata = getFlowdata(ctx);
221
221
  if (flowdata == null) return;
222
+ var cellChanges = [];
222
223
  var cellMaxLength = flowdata[0].length;
223
224
  var rowMaxLength = flowdata.length;
224
225
  var borderInfoCompute = getBorderInfoCompute(ctx, copySheetIndex);
@@ -356,6 +357,17 @@ export function pasteHandlerOfPaintModel(ctx, copyRange) {
356
357
  }
357
358
  }
358
359
  }
360
+ cellChanges.push({
361
+ sheetId: ctx.currentSheetId,
362
+ path: ["celldata"],
363
+ value: {
364
+ r: h,
365
+ c: c,
366
+ v: (_a = x[c]) !== null && _a !== void 0 ? _a : null
367
+ },
368
+ key: "".concat(h, "_").concat(c),
369
+ type: "update"
370
+ });
359
371
  };
360
372
  for (var c = mtc; c < maxcellCahe; c += 1) {
361
373
  _loop_2(c);
@@ -368,6 +380,9 @@ export function pasteHandlerOfPaintModel(ctx, copyRange) {
368
380
  }
369
381
  }
370
382
  }
383
+ if (cellChanges.length > 0 && ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _b === void 0 ? void 0 : _b.updateCellYdoc)) {
384
+ ctx.hooks.updateCellYdoc(cellChanges);
385
+ }
371
386
  var currFile = ctx.luckysheetfile[getSheetIndex(ctx, ctx.currentSheetId)];
372
387
  currFile.config = cfg;
373
388
  if (dataVerification != null) {
@@ -379,7 +394,7 @@ export function pasteHandlerOfPaintModel(ctx, copyRange) {
379
394
  if (!_.isNil(ruleArr) && ruleArr.length > 0) {
380
395
  var currentIndex = getSheetIndex(ctx, ctx.currentSheetId);
381
396
  var existingCf = ctx.luckysheetfile[currentIndex].luckysheet_conditionformat_save;
382
- var cdformat = (_a = _.cloneDeep(existingCf)) !== null && _a !== void 0 ? _a : [];
397
+ var cdformat = (_c = _.cloneDeep(existingCf)) !== null && _c !== void 0 ? _c : [];
383
398
  for (var i = 0; i < ruleArr.length; i += 1) {
384
399
  var cdformat_cellrange = ruleArr[i].cellrange;
385
400
  var emptyRange = [];
@@ -1501,7 +1516,7 @@ export function copy(ctx) {
1501
1516
  }
1502
1517
  }
1503
1518
  export function deleteSelectedCellText(ctx) {
1504
- var _a, _b, _c, _d;
1519
+ var _a, _b, _c, _d, _e;
1505
1520
  var allowEdit = isAllowEdit(ctx);
1506
1521
  if (allowEdit === false || ctx.isFlvReadOnly) {
1507
1522
  return "allowEdit";
@@ -1511,6 +1526,7 @@ export function deleteSelectedCellText(ctx) {
1511
1526
  var d = getFlowdata(ctx);
1512
1527
  if (!d) return "dataNullError";
1513
1528
  var has_PartMC = false;
1529
+ var cellChanges = [];
1514
1530
  for (var s = 0; s < selection.length; s += 1) {
1515
1531
  var r1 = selection[s].row[0];
1516
1532
  var r2 = selection[s].row[1];
@@ -1571,15 +1587,21 @@ export function deleteSelectedCellText(ctx) {
1571
1587
  r: r,
1572
1588
  c: c,
1573
1589
  v: d[r][c]
1574
- }
1590
+ },
1591
+ key: "".concat(r, "_").concat(c),
1592
+ type: "update"
1575
1593
  });
1576
1594
  }
1577
1595
  }
1596
+ if (changes.length > 0 && ((_e = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _e === void 0 ? void 0 : _e.updateCellYdoc)) {
1597
+ ctx.hooks.updateCellYdoc(changes);
1598
+ }
1578
1599
  }
1579
1600
  }
1580
1601
  return "success";
1581
1602
  }
1582
1603
  export function deleteSelectedCellFormat(ctx) {
1604
+ var _a;
1583
1605
  var allowEdit = isAllowEdit(ctx);
1584
1606
  if (allowEdit === false) {
1585
1607
  return "allowEdit";
@@ -1602,6 +1624,7 @@ export function deleteSelectedCellFormat(ctx) {
1602
1624
  if (has_PartMC) {
1603
1625
  return "partMC";
1604
1626
  }
1627
+ var cellChanges = [];
1605
1628
  for (var s = 0; s < selection.length; s += 1) {
1606
1629
  var r1 = selection[s].row[0];
1607
1630
  var r2 = selection[s].row[1];
@@ -1620,10 +1643,24 @@ export function deleteSelectedCellFormat(ctx) {
1620
1643
  delete cell.bg;
1621
1644
  delete cell.tb;
1622
1645
  }
1646
+ cellChanges.push({
1647
+ sheetId: ctx.currentSheetId,
1648
+ path: ["celldata"],
1649
+ value: {
1650
+ r: r,
1651
+ c: c,
1652
+ v: d[r][c]
1653
+ },
1654
+ key: "".concat(r, "_").concat(c),
1655
+ type: "update"
1656
+ });
1623
1657
  }
1624
1658
  }
1625
1659
  }
1626
1660
  }
1661
+ if (cellChanges.length > 0 && ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc)) {
1662
+ ctx.hooks.updateCellYdoc(cellChanges);
1663
+ }
1627
1664
  }
1628
1665
  return "success";
1629
1666
  }
@@ -143,32 +143,53 @@ export function sortSelection(ctx, isAsc, colIndex) {
143
143
  sortDataRange(ctx, d, data, colIndex, isAsc, str, edr, c1, c2);
144
144
  }
145
145
  function createRowsOrColumnsForSpilledValues(ctx, startRow, startColumn, spillRows, spillCols) {
146
+ var _a, _b;
146
147
  var flowdata = getFlowdata(ctx);
147
148
  if (!flowdata) return;
149
+ var cellChanges = [];
148
150
  try {
149
151
  var sheetIndex = getSheetIndex(ctx, ctx.currentSheetId);
150
152
  var sheet = ctx.luckysheetfile[sheetIndex];
151
- var requiredRowCount = startRow + spillRows;
152
- var requiredColCount = startColumn + spillCols;
153
- if (sheet.row && sheet.row < requiredRowCount) {
154
- sheet.row = requiredRowCount;
153
+ var requiredRowCount_1 = startRow + spillRows;
154
+ var requiredColCount_1 = startColumn + spillCols;
155
+ if (sheet.row && sheet.row < requiredRowCount_1) {
156
+ sheet.row = requiredRowCount_1;
155
157
  }
156
- if (sheet.column && sheet.column < requiredColCount) {
157
- sheet.column = requiredColCount;
158
+ if (sheet.column && sheet.column < requiredColCount_1) {
159
+ sheet.column = requiredColCount_1;
158
160
  }
159
161
  } catch (error) {
160
162
  console.error("Failed to update sheet metadata for spill operation", error);
161
163
  }
162
- while (flowdata.length < startRow + spillRows) {
164
+ var requiredRowCount = startRow + spillRows;
165
+ var requiredColCount = startColumn + spillCols;
166
+ while (flowdata.length < requiredRowCount) {
163
167
  flowdata.push([]);
164
168
  }
165
- for (var rowIndex = startRow; rowIndex < startRow + spillRows; rowIndex++) {
169
+ for (var rowIndex = startRow; rowIndex < requiredRowCount; rowIndex++) {
166
170
  if (!Array.isArray(flowdata[rowIndex])) {
167
171
  flowdata[rowIndex] = [];
168
172
  }
169
- while (flowdata[rowIndex].length < startColumn + spillCols) {
173
+ var prevLen = flowdata[rowIndex].length;
174
+ while (flowdata[rowIndex].length < requiredColCount) {
170
175
  flowdata[rowIndex].push(null);
171
176
  }
177
+ for (var c = Math.max(prevLen, startColumn); c < requiredColCount; c += 1) {
178
+ cellChanges.push({
179
+ sheetId: ctx.currentSheetId,
180
+ path: ["celldata"],
181
+ value: {
182
+ r: rowIndex,
183
+ c: c,
184
+ v: (_a = flowdata[rowIndex][c]) !== null && _a !== void 0 ? _a : null
185
+ },
186
+ key: "".concat(rowIndex, "_").concat(c),
187
+ type: "update"
188
+ });
189
+ }
190
+ }
191
+ if (cellChanges.length > 0 && ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _b === void 0 ? void 0 : _b.updateCellYdoc)) {
192
+ ctx.hooks.updateCellYdoc(cellChanges);
172
193
  }
173
194
  }
174
195
  export function spillSortResult(ctx, startRow, startCol, formulaResult, flowdata) {
package/es/settings.d.ts CHANGED
@@ -19,6 +19,7 @@ export type Hooks = {
19
19
  cellDataChange?: () => void;
20
20
  hyperlinkChange?: () => void;
21
21
  updateCellYdoc?: (changes: SheetChangePath[]) => void;
22
+ updateAllCell?: (sheetId: string) => void;
22
23
  beforeUpdateCell?: (r: number, c: number, value: any) => boolean;
23
24
  afterUpdateCell?: (row: number, column: number, oldValue: any, newValue: any) => void;
24
25
  afterSelectionChange?: (sheetId: string, selection: Selection) => void;
@@ -216,19 +216,19 @@ var handleFormulaOnPaste = function handleFormulaOnPaste(ctx, d) {
216
216
  cell.f = f;
217
217
  cell.m = v.toString();
218
218
  x[c] = cell;
219
+ changes.push({
220
+ sheetId: ctx.currentSheetId,
221
+ path: ["celldata"],
222
+ value: {
223
+ r: r,
224
+ c: c,
225
+ v: d[r][c]
226
+ },
227
+ key: "".concat(r, "_").concat(c),
228
+ type: "update"
229
+ });
219
230
  }
220
231
  d[r] = x;
221
- changes.push({
222
- sheetId: ctx.currentSheetId,
223
- path: ["celldata"],
224
- value: {
225
- r: r,
226
- c: c,
227
- v: d[r][c]
228
- },
229
- key: "".concat(r, "_").concat(c),
230
- type: "update"
231
- });
232
232
  }
233
233
  }
234
234
  if ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _b === void 0 ? void 0 : _b.updateCellYdoc) {
@@ -362,7 +362,9 @@ function pasteHandler(ctx, data, borderInfo) {
362
362
  ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)].config = cfg;
363
363
  }
364
364
  (0, _refresh.jfrefreshgrid)(ctx, null, undefined);
365
- handleFormulaOnPaste(ctx, d);
365
+ if (data.includes("=")) {
366
+ handleFormulaOnPaste(ctx, d);
367
+ }
366
368
  } else {
367
369
  data = data.replace(/\r/g, "");
368
370
  var dataChe = [];
@@ -492,17 +494,17 @@ function pasteHandler(ctx, data, borderInfo) {
492
494
  }
493
495
  x[c + curC] = cell;
494
496
  }
495
- changes.push(changes.push({
497
+ changes.push({
496
498
  sheetId: ctx.currentSheetId,
497
499
  path: ["celldata"],
498
500
  value: {
499
- r: r,
500
- c: c,
501
- v: d[r][c]
501
+ r: r + curR,
502
+ c: c + curC,
503
+ v: d[r + curR][c + curC]
502
504
  },
503
- key: "".concat(r, "_").concat(c),
505
+ key: "".concat(r + curR, "_").concat(c + curC),
504
506
  type: "update"
505
- }));
507
+ });
506
508
  }
507
509
  d[r + curR] = x;
508
510
  }
@@ -512,7 +514,9 @@ function pasteHandler(ctx, data, borderInfo) {
512
514
  last.row = [curR, curR + rlen - 1];
513
515
  last.column = [curC, curC + clen - 1];
514
516
  (0, _refresh.jfrefreshgrid)(ctx, null, undefined);
515
- handleFormulaOnPaste(ctx, d);
517
+ if (data.includes("=")) {
518
+ handleFormulaOnPaste(ctx, d);
519
+ }
516
520
  }
517
521
  }
518
522
  function setCellHyperlink(ctx, id, r, c, link) {
@@ -523,7 +527,7 @@ function setCellHyperlink(ctx, id, r, c, link) {
523
527
  ctx.luckysheetfile[index].hyperlink["".concat(r, "_").concat(c)] = link;
524
528
  }
525
529
  function pasteHandlerOfCutPaste(ctx, copyRange) {
526
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
530
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
527
531
  var allowEdit = (0, _utils.isAllowEdit)(ctx);
528
532
  if (!allowEdit || ctx.isFlvReadOnly) return;
529
533
  if (!copyRange) return;
@@ -566,6 +570,7 @@ function pasteHandlerOfCutPaste(ctx, copyRange) {
566
570
  if (addr > 0 || addc > 0) {
567
571
  (0, _sheet.expandRowsAndColumns)(d, addr, addc);
568
572
  }
573
+ var changes = [];
569
574
  var borderInfoCompute = (0, _border.getBorderInfoCompute)(ctx, copySheetId);
570
575
  var c_dataVerification = _lodash.default.cloneDeep(ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, copySheetId)].dataVerification) || {};
571
576
  var dataVerification = _lodash.default.cloneDeep(ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)].dataVerification) || {};
@@ -597,6 +602,17 @@ function pasteHandlerOfCutPaste(ctx, copyRange) {
597
602
  delete cell.mc;
598
603
  }
599
604
  d[i][j] = null;
605
+ changes.push({
606
+ sheetId: ctx.currentSheetId,
607
+ path: ["celldata"],
608
+ value: {
609
+ r: i,
610
+ c: j,
611
+ v: null
612
+ },
613
+ key: "".concat(i, "_").concat(j),
614
+ type: "update"
615
+ });
600
616
  delete dataVerification["".concat(i, "_").concat(j)];
601
617
  (_f = ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)].hyperlink) === null || _f === void 0 ? true : delete _f["".concat(i, "_").concat(j)];
602
618
  }
@@ -696,6 +712,17 @@ function pasteHandlerOfCutPaste(ctx, copyRange) {
696
712
  value = copyData[h - minh][c - minc];
697
713
  }
698
714
  x[c] = _lodash.default.cloneDeep(value);
715
+ changes.push({
716
+ sheetId: ctx.currentSheetId,
717
+ path: ["celldata"],
718
+ value: {
719
+ r: h,
720
+ c: c,
721
+ v: d[h][c]
722
+ },
723
+ key: "".concat(h, "_").concat(c),
724
+ type: "update"
725
+ });
699
726
  if (value != null && copyHasMC && ((_k = x[c]) === null || _k === void 0 ? void 0 : _k.mc)) {
700
727
  if (x[c].mc.rs != null) {
701
728
  x[c].mc.r = h;
@@ -716,6 +743,9 @@ function pasteHandlerOfCutPaste(ctx, copyRange) {
716
743
  }
717
744
  last.row = [minh, maxh];
718
745
  last.column = [minc, maxc];
746
+ if (changes.length > 0 && ((_l = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _l === void 0 ? void 0 : _l.updateCellYdoc)) {
747
+ ctx.hooks.updateCellYdoc(changes);
748
+ }
719
749
  if (copyRowlChange) {}
720
750
  var source;
721
751
  var target;
@@ -798,7 +828,7 @@ function pasteHandlerOfCutPaste(ctx, copyRange) {
798
828
  }
799
829
  source_curCdformat[i].cellrange = emptyRange;
800
830
  if (emptyRange2.length > 0) {
801
- var ruleObj = (_l = source_curCdformat[i]) !== null && _l !== void 0 ? _l : {};
831
+ var ruleObj = (_m = source_curCdformat[i]) !== null && _m !== void 0 ? _m : {};
802
832
  ruleObj.cellrange = emptyRange2;
803
833
  ruleArr.push(ruleObj);
804
834
  }
@@ -902,7 +932,7 @@ function pasteHandlerOfCutPaste(ctx, copyRange) {
902
932
  }
903
933
  }
904
934
  function pasteHandlerOfCopyPaste(ctx, copyRange) {
905
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
935
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
906
936
  var allowEdit = (0, _utils.isAllowEdit)(ctx);
907
937
  if (!allowEdit || ctx.isFlvReadOnly) return;
908
938
  if (!copyRange) return;
@@ -993,6 +1023,7 @@ function pasteHandlerOfCopyPaste(ctx, copyRange) {
993
1023
  if (addr > 0 || addc > 0) {
994
1024
  (0, _sheet.expandRowsAndColumns)(d, addr, addc);
995
1025
  }
1026
+ var changes = [];
996
1027
  var borderInfoCompute = (0, _border.getBorderInfoCompute)(ctx, copySheetIndex);
997
1028
  var c_dataVerification = _lodash.default.cloneDeep(ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, copySheetIndex)].dataVerification) || {};
998
1029
  var dataVerification = null;
@@ -1154,6 +1185,17 @@ function pasteHandlerOfCopyPaste(ctx, copyRange) {
1154
1185
  };
1155
1186
  }
1156
1187
  }
1188
+ changes.push({
1189
+ sheetId: ctx.currentSheetId,
1190
+ path: ["celldata"],
1191
+ value: {
1192
+ r: h,
1193
+ c: c,
1194
+ v: d[h][c]
1195
+ },
1196
+ key: "".concat(h, "_").concat(c),
1197
+ type: "update"
1198
+ });
1157
1199
  }
1158
1200
  d[h] = x;
1159
1201
  }
@@ -1261,6 +1303,9 @@ function pasteHandlerOfCopyPaste(ctx, copyRange) {
1261
1303
  }
1262
1304
  }
1263
1305
  }
1306
+ if (changes.length > 0 && ((_s = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _s === void 0 ? void 0 : _s.updateCellYdoc)) {
1307
+ ctx.hooks.updateCellYdoc(changes);
1308
+ }
1264
1309
  if (copyRowlChange || addr > 0 || addc > 0) {
1265
1310
  (0, _refresh.jfrefreshgrid)(ctx, d, ctx.luckysheet_select_save);
1266
1311
  } else {
@@ -143,12 +143,13 @@ function getCellValue(r, c, data, attr) {
143
143
  return retv;
144
144
  }
145
145
  function setCellValue(ctx, r, c, d, v) {
146
- var _a, _b, _c, _d, _e, _f, _g;
146
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
147
147
  if (ctx.allowEdit === false || ctx.isFlvReadOnly) return;
148
148
  if (_lodash.default.isNil(d)) {
149
149
  d = (0, _context.getFlowdata)(ctx);
150
150
  }
151
151
  if (!d) return;
152
+ var oldValue = _lodash.default.cloneDeep(d[r][c]);
152
153
  var cell = d[r][c];
153
154
  var vupdate;
154
155
  if (_lodash.default.isPlainObject(v)) {
@@ -196,6 +197,9 @@ function setCellValue(ctx, r, c, d, v) {
196
197
  cell = null;
197
198
  }
198
199
  d[r][c] = cell;
200
+ if ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.afterUpdateCell) {
201
+ ctx.hooks.afterUpdateCell(r, c, oldValue, (_b = d[r][c]) !== null && _b !== void 0 ? _b : null);
202
+ }
199
203
  return;
200
204
  }
201
205
  if ((0, _validation.isRealNull)(cell) || (_lodash.default.isString(cell) || _lodash.default.isNumber(cell)) && cell === v) {
@@ -218,21 +222,21 @@ function setCellValue(ctx, r, c, d, v) {
218
222
  t: "s"
219
223
  };
220
224
  cell.v = vupdateStr;
221
- } else if (vupdateStr.toUpperCase() === "TRUE" && (_lodash.default.isNil((_a = cell.ct) === null || _a === void 0 ? void 0 : _a.fa) || ((_b = cell.ct) === null || _b === void 0 ? void 0 : _b.fa) !== "@")) {
225
+ } else if (vupdateStr.toUpperCase() === "TRUE" && (_lodash.default.isNil((_c = cell.ct) === null || _c === void 0 ? void 0 : _c.fa) || ((_d = cell.ct) === null || _d === void 0 ? void 0 : _d.fa) !== "@")) {
222
226
  cell.m = "TRUE";
223
227
  cell.ct = {
224
228
  fa: "General",
225
229
  t: "b"
226
230
  };
227
231
  cell.v = true;
228
- } else if (vupdateStr.toUpperCase() === "FALSE" && (_lodash.default.isNil((_c = cell.ct) === null || _c === void 0 ? void 0 : _c.fa) || ((_d = cell.ct) === null || _d === void 0 ? void 0 : _d.fa) !== "@")) {
232
+ } else if (vupdateStr.toUpperCase() === "FALSE" && (_lodash.default.isNil((_e = cell.ct) === null || _e === void 0 ? void 0 : _e.fa) || ((_f = cell.ct) === null || _f === void 0 ? void 0 : _f.fa) !== "@")) {
229
233
  cell.m = "FALSE";
230
234
  cell.ct = {
231
235
  fa: "General",
232
236
  t: "b"
233
237
  };
234
238
  cell.v = false;
235
- } else if (vupdateStr.substr(-1) === "%" && (0, _validation.isRealNum)(vupdateStr.substring(0, vupdateStr.length - 1)) && (_lodash.default.isNil((_e = cell.ct) === null || _e === void 0 ? void 0 : _e.fa) || ((_f = cell.ct) === null || _f === void 0 ? void 0 : _f.fa) !== "@")) {
239
+ } else if (vupdateStr.substr(-1) === "%" && (0, _validation.isRealNum)(vupdateStr.substring(0, vupdateStr.length - 1)) && (_lodash.default.isNil((_g = cell.ct) === null || _g === void 0 ? void 0 : _g.fa) || ((_h = cell.ct) === null || _h === void 0 ? void 0 : _h.fa) !== "@")) {
236
240
  cell.ct = {
237
241
  fa: "0%",
238
242
  t: "n"
@@ -262,7 +266,7 @@ function setCellValue(ctx, r, c, d, v) {
262
266
  var isDigit = /^\d+$/.test(vupdate);
263
267
  if (isDigit) {
264
268
  var flowdata = (0, _context.getFlowdata)(ctx);
265
- var args = (_g = (0, _utils.getContentInParentheses)(cell === null || cell === void 0 ? void 0 : cell.f)) === null || _g === void 0 ? void 0 : _g.split(",");
269
+ var args = (_j = (0, _utils.getContentInParentheses)(cell === null || cell === void 0 ? void 0 : cell.f)) === null || _j === void 0 ? void 0 : _j.split(",");
266
270
  var cellRefs = args === null || args === void 0 ? void 0 : args.map(function (arg) {
267
271
  return arg.trim().toUpperCase();
268
272
  });
@@ -385,6 +389,9 @@ function setCellValue(ctx, r, c, d, v) {
385
389
  }
386
390
  }
387
391
  d[r][c] = cell;
392
+ if ((_k = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _k === void 0 ? void 0 : _k.afterUpdateCell) {
393
+ ctx.hooks.afterUpdateCell(r, c, oldValue, (_l = d[r][c]) !== null && _l !== void 0 ? _l : null);
394
+ }
388
395
  if (ctx.luckysheet_selection_range) {
389
396
  ctx.luckysheet_selection_range = [];
390
397
  }
@@ -842,7 +849,7 @@ function updateCell(ctx, r, c, $input, value, canvas) {
842
849
  var newValue_1 = _lodash.default.cloneDeep(d[r][c]);
843
850
  setTimeout(function () {
844
851
  var _a, _b;
845
- return (_b = (_a = ctx.hooks).afterUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, null, newValue_1);
852
+ return (_b = (_a = ctx.hooks).afterUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, oldValue_1, newValue_1);
846
853
  });
847
854
  }
848
855
  ctx.formulaCache.execFunctionGlobalData = null;
@@ -892,13 +899,6 @@ function updateCell(ctx, r, c, $input, value, canvas) {
892
899
  }
893
900
  }
894
901
  }
895
- if (ctx.hooks.afterUpdateCell) {
896
- var newValue_2 = _lodash.default.cloneDeep(flowdata[r][c]);
897
- var afterUpdateCell_1 = ctx.hooks.afterUpdateCell;
898
- setTimeout(function () {
899
- afterUpdateCell_1 === null || afterUpdateCell_1 === void 0 ? void 0 : afterUpdateCell_1(r, c, oldValue_1, newValue_2);
900
- });
901
- }
902
902
  ctx.formulaCache.execFunctionGlobalData = null;
903
903
  } catch (e) {
904
904
  console.error(e);