@fileverse-dev/fortune-core 1.3.10 → 1.3.11-mixed

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.
Files changed (71) hide show
  1. package/es/api/range.js +20 -0
  2. package/es/api/sheet.js +30 -2
  3. package/es/events/keyboard.js +74 -37
  4. package/es/events/mouse.js +1 -0
  5. package/es/events/paste.js +124 -56
  6. package/es/locale/en.d.ts +3 -0
  7. package/es/locale/en.js +3 -0
  8. package/es/locale/es.d.ts +3 -0
  9. package/es/locale/es.js +3 -0
  10. package/es/locale/hi.d.ts +3 -0
  11. package/es/locale/hi.js +3 -0
  12. package/es/locale/index.d.ts +3 -0
  13. package/es/locale/zh.d.ts +3 -0
  14. package/es/locale/zh.js +3 -0
  15. package/es/locale/zh_tw.d.ts +3 -0
  16. package/es/locale/zh_tw.js +3 -0
  17. package/es/modules/ConditionFormat.js +26 -0
  18. package/es/modules/cell.js +58 -2
  19. package/es/modules/comment.js +129 -24
  20. package/es/modules/dataVerification.js +34 -1
  21. package/es/modules/dropCell.js +65 -1
  22. package/es/modules/format.js +12 -7
  23. package/es/modules/formula.js +14 -0
  24. package/es/modules/hyperlink.js +52 -5
  25. package/es/modules/merge.js +93 -1
  26. package/es/modules/moveCells.js +35 -9
  27. package/es/modules/rowcol.js +75 -2
  28. package/es/modules/searchReplace.js +58 -2
  29. package/es/modules/selection.js +152 -42
  30. package/es/modules/sort.js +74 -9
  31. package/es/modules/splitColumn.js +21 -0
  32. package/es/modules/toolbar.js +46 -3
  33. package/es/modules/validation.js +6 -3
  34. package/es/settings.d.ts +5 -0
  35. package/es/types.d.ts +2 -0
  36. package/lib/api/range.js +20 -0
  37. package/lib/api/sheet.js +29 -1
  38. package/lib/events/keyboard.js +74 -37
  39. package/lib/events/mouse.js +1 -0
  40. package/lib/events/paste.js +122 -54
  41. package/lib/locale/en.d.ts +3 -0
  42. package/lib/locale/en.js +3 -0
  43. package/lib/locale/es.d.ts +3 -0
  44. package/lib/locale/es.js +3 -0
  45. package/lib/locale/hi.d.ts +3 -0
  46. package/lib/locale/hi.js +3 -0
  47. package/lib/locale/index.d.ts +3 -0
  48. package/lib/locale/zh.d.ts +3 -0
  49. package/lib/locale/zh.js +3 -0
  50. package/lib/locale/zh_tw.d.ts +3 -0
  51. package/lib/locale/zh_tw.js +3 -0
  52. package/lib/modules/ConditionFormat.js +26 -0
  53. package/lib/modules/cell.js +58 -2
  54. package/lib/modules/comment.js +129 -24
  55. package/lib/modules/dataVerification.js +34 -1
  56. package/lib/modules/dropCell.js +65 -1
  57. package/lib/modules/format.js +12 -7
  58. package/lib/modules/formula.js +14 -0
  59. package/lib/modules/hyperlink.js +52 -5
  60. package/lib/modules/merge.js +93 -1
  61. package/lib/modules/moveCells.js +35 -9
  62. package/lib/modules/rowcol.js +75 -2
  63. package/lib/modules/searchReplace.js +58 -2
  64. package/lib/modules/selection.js +152 -42
  65. package/lib/modules/sort.js +74 -9
  66. package/lib/modules/splitColumn.js +21 -0
  67. package/lib/modules/toolbar.js +46 -3
  68. package/lib/modules/validation.js +6 -3
  69. package/lib/settings.d.ts +5 -0
  70. package/lib/types.d.ts +2 -0
  71. package/package.json +1 -1
@@ -842,7 +842,7 @@ function updateCell(ctx, r, c, $input, value, canvas) {
842
842
  var newValue_1 = _lodash.default.cloneDeep(d[r][c]);
843
843
  setTimeout(function () {
844
844
  var _a, _b;
845
- return (_b = (_a = ctx.hooks).afterUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, null, newValue_1);
845
+ return (_b = (_a = ctx.hooks).afterUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, oldValue_1, newValue_1);
846
846
  });
847
847
  }
848
848
  ctx.formulaCache.execFunctionGlobalData = null;
@@ -1295,13 +1295,16 @@ function keepOnlyValueParts(cell) {
1295
1295
  } : null;
1296
1296
  }
1297
1297
  function clearSelectedCellFormat(ctx) {
1298
+ var _a;
1298
1299
  var activeSheetIndex = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
1299
1300
  if (activeSheetIndex == null) return;
1301
+ var changeMap = new Map();
1300
1302
  var activeSheetFile = ctx.luckysheetfile[activeSheetIndex];
1301
1303
  var selectedRanges = ctx.luckysheet_select_save;
1302
1304
  if (!activeSheetFile || !selectedRanges) return;
1303
1305
  var sheetData = activeSheetFile.data;
1304
1306
  selectedRanges.forEach(function (_a) {
1307
+ var _b;
1305
1308
  var rowRange = _a.row,
1306
1309
  columnRange = _a.column;
1307
1310
  var startRow = rowRange[0],
@@ -1314,20 +1317,38 @@ function clearSelectedCellFormat(ctx) {
1314
1317
  for (var columnIndex = startColumn; columnIndex <= endColumn; columnIndex++) {
1315
1318
  if (rowCells[columnIndex] === undefined) continue;
1316
1319
  rowCells[columnIndex] = keepOnlyValueParts(rowCells[columnIndex]);
1320
+ var v = (_b = rowCells[columnIndex]) !== null && _b !== void 0 ? _b : null;
1321
+ var key = "".concat(rowIndex, "_").concat(columnIndex);
1322
+ changeMap.set(key, {
1323
+ sheetId: ctx.currentSheetId,
1324
+ path: ["celldata"],
1325
+ key: key,
1326
+ value: {
1327
+ r: rowIndex,
1328
+ c: columnIndex,
1329
+ v: v
1330
+ },
1331
+ type: v == null ? "delete" : "update"
1332
+ });
1317
1333
  }
1318
1334
  }
1319
1335
  });
1336
+ if (((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc) && changeMap.size > 0) {
1337
+ ctx.hooks.updateCellYdoc(Array.from(changeMap.values()));
1338
+ }
1320
1339
  }
1321
1340
  function clearRowsCellsFormat(ctx) {
1322
- var _a, _b;
1341
+ var _a, _b, _c;
1323
1342
  var activeSheetIndex = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
1324
1343
  if (activeSheetIndex == null) return;
1344
+ var changeMap = new Map();
1325
1345
  var activeSheetFile = ctx.luckysheetfile[activeSheetIndex];
1326
1346
  var selectedRanges = ctx.luckysheet_select_save;
1327
1347
  if (!activeSheetFile || !selectedRanges) return;
1328
1348
  var sheetData = activeSheetFile.data;
1329
1349
  var columnCount = (_b = (_a = sheetData === null || sheetData === void 0 ? void 0 : sheetData[0]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
1330
1350
  selectedRanges.forEach(function (_a) {
1351
+ var _b;
1331
1352
  var rowRange = _a.row;
1332
1353
  var startRow = rowRange[0],
1333
1354
  endRow = rowRange[1];
@@ -1337,19 +1358,38 @@ function clearRowsCellsFormat(ctx) {
1337
1358
  for (var columnIndex = 0; columnIndex < columnCount; columnIndex++) {
1338
1359
  if (rowCells[columnIndex] === undefined) continue;
1339
1360
  rowCells[columnIndex] = keepOnlyValueParts(rowCells[columnIndex]);
1361
+ var v = (_b = rowCells[columnIndex]) !== null && _b !== void 0 ? _b : null;
1362
+ var key = "".concat(rowIndex, "_").concat(columnIndex);
1363
+ changeMap.set(key, {
1364
+ sheetId: ctx.currentSheetId,
1365
+ path: ["celldata"],
1366
+ key: key,
1367
+ value: {
1368
+ r: rowIndex,
1369
+ c: columnIndex,
1370
+ v: v
1371
+ },
1372
+ type: v == null ? "delete" : "update"
1373
+ });
1340
1374
  }
1341
1375
  }
1342
1376
  });
1377
+ if (((_c = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _c === void 0 ? void 0 : _c.updateCellYdoc) && changeMap.size > 0) {
1378
+ ctx.hooks.updateCellYdoc(Array.from(changeMap.values()));
1379
+ }
1343
1380
  }
1344
1381
  function clearColumnsCellsFormat(ctx) {
1382
+ var _a;
1345
1383
  var activeSheetIndex = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
1346
1384
  if (activeSheetIndex == null) return;
1385
+ var changeMap = new Map();
1347
1386
  var activeSheetFile = ctx.luckysheetfile[activeSheetIndex];
1348
1387
  var selectedRanges = ctx.luckysheet_select_save;
1349
1388
  if (!activeSheetFile || !selectedRanges) return;
1350
1389
  var sheetData = activeSheetFile.data;
1351
1390
  var rowCount = sheetData.length;
1352
1391
  selectedRanges.forEach(function (_a) {
1392
+ var _b;
1353
1393
  var columnRange = _a.column;
1354
1394
  var startColumn = columnRange[0],
1355
1395
  endColumn = columnRange[1];
@@ -1359,7 +1399,23 @@ function clearColumnsCellsFormat(ctx) {
1359
1399
  for (var columnIndex = startColumn; columnIndex <= endColumn; columnIndex++) {
1360
1400
  if (rowCells[columnIndex] === undefined) continue;
1361
1401
  rowCells[columnIndex] = keepOnlyValueParts(rowCells[columnIndex]);
1402
+ var v = (_b = rowCells[columnIndex]) !== null && _b !== void 0 ? _b : null;
1403
+ var key = "".concat(rowIndex, "_").concat(columnIndex);
1404
+ changeMap.set(key, {
1405
+ sheetId: ctx.currentSheetId,
1406
+ path: ["celldata"],
1407
+ key: key,
1408
+ value: {
1409
+ r: rowIndex,
1410
+ c: columnIndex,
1411
+ v: v
1412
+ },
1413
+ type: v == null ? "delete" : "update"
1414
+ });
1362
1415
  }
1363
1416
  }
1364
1417
  });
1418
+ if (((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc) && changeMap.size > 0) {
1419
+ ctx.hooks.updateCellYdoc(Array.from(changeMap.values()));
1420
+ }
1365
1421
  }
@@ -191,7 +191,7 @@ function setEditingComment(ctx, flowdata, r, c) {
191
191
  ctx.editingCommentBox = getCommentBoxByRC(ctx, flowdata, r, c);
192
192
  }
193
193
  function removeEditingComment(ctx, globalCache) {
194
- var _a, _b;
194
+ var _a, _b, _c;
195
195
  var editingCommentBoxEle = globalCache.editingCommentBoxEle;
196
196
  ctx.editingCommentBox = undefined;
197
197
  var r = editingCommentBoxEle === null || editingCommentBoxEle === void 0 ? void 0 : editingCommentBoxEle.dataset.r;
@@ -215,6 +215,19 @@ function removeEditingComment(ctx, globalCache) {
215
215
  return v.rc !== "".concat(r, "_").concat(c);
216
216
  });
217
217
  }
218
+ if ((_c = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _c === void 0 ? void 0 : _c.updateCellYdoc) {
219
+ ctx.hooks.updateCellYdoc([{
220
+ sheetId: ctx.currentSheetId,
221
+ path: ["celldata"],
222
+ value: {
223
+ r: r,
224
+ c: c,
225
+ v: cell
226
+ },
227
+ key: "".concat(r, "_").concat(c),
228
+ type: "update"
229
+ }]);
230
+ }
218
231
  if (ctx.hooks.afterUpdateComment) {
219
232
  setTimeout(function () {
220
233
  var _a, _b;
@@ -223,7 +236,7 @@ function removeEditingComment(ctx, globalCache) {
223
236
  }
224
237
  }
225
238
  function newComment(ctx, globalCache, r, c) {
226
- var _a, _b;
239
+ var _a, _b, _c, _d;
227
240
  if (((_b = (_a = ctx.hooks).beforeInsertComment) === null || _b === void 0 ? void 0 : _b.call(_a, r, c)) === false) {
228
241
  return;
229
242
  }
@@ -248,6 +261,19 @@ function newComment(ctx, globalCache, r, c) {
248
261
  ctx.editingCommentBox = __assign(__assign({}, getCommentBoxByRC(ctx, flowdata, r, c)), {
249
262
  autoFocus: true
250
263
  });
264
+ if ((_c = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _c === void 0 ? void 0 : _c.updateCellYdoc) {
265
+ ctx.hooks.updateCellYdoc([{
266
+ sheetId: ctx.currentSheetId,
267
+ path: ["celldata"],
268
+ value: {
269
+ r: r,
270
+ c: c,
271
+ v: (_d = flowdata[r][c]) !== null && _d !== void 0 ? _d : null
272
+ },
273
+ key: "".concat(r, "_").concat(c),
274
+ type: "update"
275
+ }]);
276
+ }
251
277
  if (ctx.hooks.afterInsertComment) {
252
278
  setTimeout(function () {
253
279
  var _a, _b;
@@ -274,7 +300,7 @@ function editComment(ctx, globalCache, r, c) {
274
300
  }
275
301
  }
276
302
  function deleteComment(ctx, globalCache, r, c) {
277
- var _a, _b;
303
+ var _a, _b, _c;
278
304
  var allowEdit = (0, _utils.isAllowEdit)(ctx);
279
305
  if (!allowEdit) return;
280
306
  if (((_b = (_a = ctx.hooks).beforeDeleteComment) === null || _b === void 0 ? void 0 : _b.call(_a, r, c)) === false) {
@@ -285,6 +311,19 @@ function deleteComment(ctx, globalCache, r, c) {
285
311
  var cell = flowdata[r][c];
286
312
  if (!cell) return;
287
313
  cell.ps = undefined;
314
+ if ((_c = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _c === void 0 ? void 0 : _c.updateCellYdoc) {
315
+ ctx.hooks.updateCellYdoc([{
316
+ sheetId: ctx.currentSheetId,
317
+ path: ["celldata"],
318
+ value: {
319
+ r: r,
320
+ c: c,
321
+ v: cell
322
+ },
323
+ key: "".concat(r, "_").concat(c),
324
+ type: "update"
325
+ }]);
326
+ }
288
327
  if (ctx.hooks.afterDeleteComment) {
289
328
  setTimeout(function () {
290
329
  var _a, _b;
@@ -304,7 +343,7 @@ function showComments(ctx, commentShowCells) {
304
343
  }
305
344
  }
306
345
  function showHideComment(ctx, globalCache, r, c) {
307
- var _a;
346
+ var _a, _b, _c;
308
347
  var flowdata = (0, _context.getFlowdata)(ctx);
309
348
  var comment = (_a = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c]) === null || _a === void 0 ? void 0 : _a.ps;
310
349
  if (!comment) return;
@@ -318,9 +357,23 @@ function showHideComment(ctx, globalCache, r, c) {
318
357
  } else {
319
358
  comment.isShow = true;
320
359
  }
360
+ var cell = (_b = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r]) === null || _b === void 0 ? void 0 : _b[c];
361
+ if (cell && ((_c = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _c === void 0 ? void 0 : _c.updateCellYdoc)) {
362
+ ctx.hooks.updateCellYdoc([{
363
+ sheetId: ctx.currentSheetId,
364
+ path: ["celldata"],
365
+ value: {
366
+ r: r,
367
+ c: c,
368
+ v: cell
369
+ },
370
+ key: "".concat(r, "_").concat(c),
371
+ type: "update"
372
+ }]);
373
+ }
321
374
  }
322
375
  function showHideAllComments(ctx) {
323
- var _a, _b;
376
+ var _a, _b, _c, _d, _e;
324
377
  var flowdata = (0, _context.getFlowdata)(ctx);
325
378
  if (!flowdata) return;
326
379
  var isAllShow = true;
@@ -341,29 +394,55 @@ function showHideAllComments(ctx) {
341
394
  }
342
395
  var rcs = [];
343
396
  if (allComments.length > 0) {
397
+ var cellChanges = [];
344
398
  if (isAllShow) {
345
399
  for (var i = 0; i < allComments.length; i += 1) {
346
- var _c = allComments[i],
347
- r = _c.r,
348
- c = _c.c;
400
+ var _f = allComments[i],
401
+ r = _f.r,
402
+ c = _f.c;
349
403
  var comment = (_a = flowdata[r][c]) === null || _a === void 0 ? void 0 : _a.ps;
350
404
  if (comment === null || comment === void 0 ? void 0 : comment.isShow) {
351
405
  comment.isShow = false;
352
406
  rcs.push("".concat(r, "_").concat(c));
407
+ cellChanges.push({
408
+ sheetId: ctx.currentSheetId,
409
+ path: ["celldata"],
410
+ value: {
411
+ r: r,
412
+ c: c,
413
+ v: (_b = flowdata[r][c]) !== null && _b !== void 0 ? _b : null
414
+ },
415
+ key: "".concat(r, "_").concat(c),
416
+ type: "update"
417
+ });
353
418
  }
354
419
  }
355
420
  ctx.commentBoxes = [];
356
421
  } else {
357
422
  for (var i = 0; i < allComments.length; i += 1) {
358
- var _d = allComments[i],
359
- r = _d.r,
360
- c = _d.c;
361
- var comment = (_b = flowdata[r][c]) === null || _b === void 0 ? void 0 : _b.ps;
423
+ var _g = allComments[i],
424
+ r = _g.r,
425
+ c = _g.c;
426
+ var comment = (_c = flowdata[r][c]) === null || _c === void 0 ? void 0 : _c.ps;
362
427
  if (comment && !comment.isShow) {
363
428
  comment.isShow = true;
429
+ cellChanges.push({
430
+ sheetId: ctx.currentSheetId,
431
+ path: ["celldata"],
432
+ value: {
433
+ r: r,
434
+ c: c,
435
+ v: (_d = flowdata[r][c]) !== null && _d !== void 0 ? _d : null
436
+ },
437
+ key: "".concat(r, "_").concat(c),
438
+ type: "update"
439
+ });
364
440
  }
365
441
  }
366
442
  }
443
+ if (cellChanges.length > 0 && ((_e = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _e === void 0 ? void 0 : _e.updateCellYdoc)) {
444
+ ctx.hooks.updateCellYdoc(cellChanges);
445
+ }
367
446
  }
368
447
  }
369
448
  function removeOverShowComment(ctx) {
@@ -525,13 +604,13 @@ function onCommentBoxResize(ctx, globalCache, e) {
525
604
  return false;
526
605
  }
527
606
  function onCommentBoxResizeEnd(ctx, globalCache) {
528
- var _a;
607
+ var _a, _b;
529
608
  if ((_a = globalCache.commentBox) === null || _a === void 0 ? void 0 : _a.resizingId) {
530
- var _b = globalCache.commentBox,
531
- resizingId = _b.resizingId,
532
- _c = _b.commentRC,
533
- r = _c.r,
534
- c = _c.c;
609
+ var _c = globalCache.commentBox,
610
+ resizingId = _c.resizingId,
611
+ _d = _c.commentRC,
612
+ r = _d.r,
613
+ c = _d.c;
535
614
  globalCache.commentBox.resizingId = undefined;
536
615
  var position = getCommentBoxPosition(resizingId);
537
616
  if (position) {
@@ -547,6 +626,19 @@ function onCommentBoxResizeEnd(ctx, globalCache) {
547
626
  cell.ps.width = width / ctx.zoomRatio;
548
627
  cell.ps.height = height / ctx.zoomRatio;
549
628
  setEditingComment(ctx, flowdata, r, c);
629
+ if ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _b === void 0 ? void 0 : _b.updateCellYdoc) {
630
+ ctx.hooks.updateCellYdoc([{
631
+ sheetId: ctx.currentSheetId,
632
+ path: ["celldata"],
633
+ value: {
634
+ r: r,
635
+ c: c,
636
+ v: cell
637
+ },
638
+ key: "".concat(r, "_").concat(c),
639
+ type: "update"
640
+ }]);
641
+ }
550
642
  }
551
643
  }
552
644
  }
@@ -598,13 +690,13 @@ function onCommentBoxMove(ctx, globalCache, e) {
598
690
  return false;
599
691
  }
600
692
  function onCommentBoxMoveEnd(ctx, globalCache) {
601
- var _a;
693
+ var _a, _b;
602
694
  if ((_a = globalCache.commentBox) === null || _a === void 0 ? void 0 : _a.movingId) {
603
- var _b = globalCache.commentBox,
604
- movingId = _b.movingId,
605
- _c = _b.commentRC,
606
- r = _c.r,
607
- c = _c.c;
695
+ var _c = globalCache.commentBox,
696
+ movingId = _c.movingId,
697
+ _d = _c.commentRC,
698
+ r = _d.r,
699
+ c = _d.c;
608
700
  globalCache.commentBox.movingId = undefined;
609
701
  var position = getCommentBoxPosition(movingId);
610
702
  if (position) {
@@ -616,6 +708,19 @@ function onCommentBoxMoveEnd(ctx, globalCache) {
616
708
  cell.ps.left = left / ctx.zoomRatio;
617
709
  cell.ps.top = top_5 / ctx.zoomRatio;
618
710
  setEditingComment(ctx, flowdata, r, c);
711
+ if ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _b === void 0 ? void 0 : _b.updateCellYdoc) {
712
+ ctx.hooks.updateCellYdoc([{
713
+ sheetId: ctx.currentSheetId,
714
+ path: ["celldata"],
715
+ value: {
716
+ r: r,
717
+ c: c,
718
+ v: cell
719
+ },
720
+ key: "".concat(r, "_").concat(c),
721
+ type: "update"
722
+ }]);
723
+ }
619
724
  }
620
725
  }
621
726
  }
@@ -244,7 +244,7 @@ function validateCellData(ctx, item, cellValue) {
244
244
  return true;
245
245
  }
246
246
  function checkboxChange(ctx, r, c) {
247
- var _a;
247
+ var _a, _b, _c, _d;
248
248
  var index = (0, _.getSheetIndex)(ctx, ctx.currentSheetId);
249
249
  var currentDataVerification = (_a = ctx.luckysheetfile[index].dataVerification) !== null && _a !== void 0 ? _a : {};
250
250
  var item = currentDataVerification["".concat(r, "_").concat(c)];
@@ -255,6 +255,25 @@ function checkboxChange(ctx, r, c) {
255
255
  }
256
256
  var d = (0, _.getFlowdata)(ctx);
257
257
  (0, _.setCellValue)(ctx, r, c, d, value);
258
+ if ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _b === void 0 ? void 0 : _b.updateCellYdoc) {
259
+ ctx.hooks.updateCellYdoc([{
260
+ sheetId: ctx.currentSheetId,
261
+ path: ["celldata"],
262
+ value: {
263
+ r: r,
264
+ c: c,
265
+ v: (_d = (_c = d === null || d === void 0 ? void 0 : d[r]) === null || _c === void 0 ? void 0 : _c[c]) !== null && _d !== void 0 ? _d : null
266
+ },
267
+ key: "".concat(r, "_").concat(c),
268
+ type: "update"
269
+ }, {
270
+ sheetId: ctx.currentSheetId,
271
+ path: ["dataVerification"],
272
+ key: "".concat(r, "_").concat(c),
273
+ value: JSON.parse(JSON.stringify(item)),
274
+ type: "update"
275
+ }]);
276
+ }
258
277
  }
259
278
  function getFailureText(ctx, item) {
260
279
  var _a, _b, _c, _d, _e;
@@ -602,6 +621,7 @@ function cellFocus(ctx, r, c, clickMode) {
602
621
  }
603
622
  function setDropdownValue(ctx, value, arr) {
604
623
  var _a;
624
+ var _b, _c, _d;
605
625
  if (!ctx.luckysheet_select_save) return;
606
626
  var d = (0, _.getFlowdata)(ctx);
607
627
  if (!d) return;
@@ -647,6 +667,19 @@ function setDropdownValue(ctx, value, arr) {
647
667
  v: value,
648
668
  pillColor: selectedColor
649
669
  });
670
+ if ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _b === void 0 ? void 0 : _b.updateCellYdoc) {
671
+ ctx.hooks.updateCellYdoc([{
672
+ sheetId: ctx.currentSheetId,
673
+ path: ["celldata"],
674
+ value: {
675
+ r: rowIndex,
676
+ c: colIndex,
677
+ v: (_d = (_c = d === null || d === void 0 ? void 0 : d[rowIndex]) === null || _c === void 0 ? void 0 : _c[colIndex]) !== null && _d !== void 0 ? _d : null
678
+ },
679
+ key: "".concat(rowIndex, "_").concat(colIndex),
680
+ type: "update"
681
+ }]);
682
+ }
650
683
  var currentRowHeight = (0, _api.getRowHeight)(ctx, [rowIndex])[rowIndex];
651
684
  var newHeight = 22 * (value.split(",").length || (valueData === null || valueData === void 0 ? void 0 : valueData.length)) || 22;
652
685
  if (currentRowHeight < newHeight) {
@@ -1795,7 +1795,7 @@ function getApplyData(copyD, csLen, asLen) {
1795
1795
  }
1796
1796
  function updateDropCell(ctx) {
1797
1797
  var _a, _b, _c, _d;
1798
- var _e, _f, _g;
1798
+ var _e, _f, _g, _h;
1799
1799
  var d = (0, _context.getFlowdata)(ctx);
1800
1800
  var allowEdit = (0, _utils.isAllowEdit)(ctx);
1801
1801
  var isReadOnly = (0, _utils.isAllowEditReadOnly)(ctx);
@@ -1831,6 +1831,7 @@ function updateDropCell(ctx) {
1831
1831
  var apply_end_r = applyRange.row[1];
1832
1832
  var apply_str_c = applyRange.column[0];
1833
1833
  var apply_end_c = applyRange.column[1];
1834
+ var cellChanges = [];
1834
1835
  if (direction === "down" || direction === "up") {
1835
1836
  var asLen = apply_end_r - apply_str_r + 1;
1836
1837
  for (var i = apply_str_c; i <= apply_end_c; i += 1) {
@@ -1841,6 +1842,7 @@ function updateDropCell(ctx) {
1841
1842
  for (var j = apply_str_r; j <= apply_end_r; j += 1) {
1842
1843
  if (hiddenRows.has("".concat(j))) continue;
1843
1844
  var cell = applyData[j - apply_str_r];
1845
+ var afterHookCalled = false;
1844
1846
  if ((cell === null || cell === void 0 ? void 0 : cell.f) != null) {
1845
1847
  var f = "=".concat(formula.functionCopy(ctx, cell.f, "down", j - apply_str_r + 1));
1846
1848
  var v = formula.execfunction(ctx, f, j, i);
@@ -1852,6 +1854,7 @@ function updateDropCell(ctx) {
1852
1854
  v: v[1] instanceof Promise ? v[1] : cell.v,
1853
1855
  m: v[1] instanceof Promise ? "[object Promise]" : v[1]
1854
1856
  }));
1857
+ afterHookCalled = true;
1855
1858
  }
1856
1859
  if (cell.spl != null) {
1857
1860
  cell.spl = v[3].data;
@@ -1889,6 +1892,19 @@ function updateDropCell(ctx) {
1889
1892
  }
1890
1893
  }
1891
1894
  d[j][i] = cell || null;
1895
+ if (!afterHookCalled) {
1896
+ cellChanges.push({
1897
+ sheetId: ctx.currentSheetId,
1898
+ path: ["celldata"],
1899
+ value: {
1900
+ r: j,
1901
+ c: i,
1902
+ v: d[j][i]
1903
+ },
1904
+ key: "".concat(j, "_").concat(i),
1905
+ type: "update"
1906
+ });
1907
+ }
1892
1908
  var bd_r = copy_str_r + (j - apply_str_r) % csLen;
1893
1909
  var bd_c = i;
1894
1910
  if (borderInfoCompute["".concat(bd_r, "_").concat(bd_c)]) {
@@ -1927,6 +1943,7 @@ function updateDropCell(ctx) {
1927
1943
  for (var j = apply_end_r; j >= apply_str_r; j -= 1) {
1928
1944
  if (hiddenRows.has("".concat(j))) continue;
1929
1945
  var cell = applyData[apply_end_r - j];
1946
+ var afterHookCalled = false;
1930
1947
  if ((cell === null || cell === void 0 ? void 0 : cell.f) != null) {
1931
1948
  var f = "=".concat(formula.functionCopy(ctx, cell.f, "up", apply_end_r - j + 1));
1932
1949
  var v = formula.execfunction(ctx, f, j, i);
@@ -1938,6 +1955,7 @@ function updateDropCell(ctx) {
1938
1955
  v: v[1] instanceof Promise ? v[1] : cell.v,
1939
1956
  m: v[1] instanceof Promise ? "[object Promise]" : v[1]
1940
1957
  }));
1958
+ afterHookCalled = true;
1941
1959
  }
1942
1960
  if (cell.spl != null) {
1943
1961
  cell.spl = v[3].data;
@@ -1969,6 +1987,19 @@ function updateDropCell(ctx) {
1969
1987
  }
1970
1988
  }
1971
1989
  d[j][i] = cell || null;
1990
+ if (!afterHookCalled) {
1991
+ cellChanges.push({
1992
+ sheetId: ctx.currentSheetId,
1993
+ path: ["celldata"],
1994
+ value: {
1995
+ r: j,
1996
+ c: i,
1997
+ v: d[j][i]
1998
+ },
1999
+ key: "".concat(j, "_").concat(i),
2000
+ type: "update"
2001
+ });
2002
+ }
1972
2003
  var bd_r = copy_end_r - (apply_end_r - j) % csLen;
1973
2004
  var bd_c = i;
1974
2005
  if (borderInfoCompute["".concat(bd_r, "_").concat(bd_c)]) {
@@ -2014,6 +2045,7 @@ function updateDropCell(ctx) {
2014
2045
  for (var j = apply_str_c; j <= apply_end_c; j += 1) {
2015
2046
  if (hiddenCols.has("".concat(j))) continue;
2016
2047
  var cell = applyData[j - apply_str_c];
2048
+ var afterHookCalled = false;
2017
2049
  if ((cell === null || cell === void 0 ? void 0 : cell.f) != null) {
2018
2050
  var f = "=".concat(formula.functionCopy(ctx, cell.f, "right", j - apply_str_c + 1));
2019
2051
  var v = formula.execfunction(ctx, f, i, j);
@@ -2025,6 +2057,7 @@ function updateDropCell(ctx) {
2025
2057
  v: v[1] instanceof Promise ? v[1] : cell.v,
2026
2058
  m: v[1] instanceof Promise ? "[object Promise]" : v[1]
2027
2059
  }));
2060
+ afterHookCalled = true;
2028
2061
  }
2029
2062
  if (cell.spl != null) {
2030
2063
  cell.spl = v[3].data;
@@ -2056,6 +2089,19 @@ function updateDropCell(ctx) {
2056
2089
  }
2057
2090
  }
2058
2091
  d[i][j] = cell || null;
2092
+ if (!afterHookCalled) {
2093
+ cellChanges.push({
2094
+ sheetId: ctx.currentSheetId,
2095
+ path: ["celldata"],
2096
+ value: {
2097
+ r: i,
2098
+ c: j,
2099
+ v: d[i][j]
2100
+ },
2101
+ key: "".concat(i, "_").concat(j),
2102
+ type: "update"
2103
+ });
2104
+ }
2059
2105
  var bd_r = i;
2060
2106
  var bd_c = copy_str_c + (j - apply_str_c) % csLen;
2061
2107
  if (borderInfoCompute["".concat(bd_r, "_").concat(bd_c)]) {
@@ -2094,6 +2140,7 @@ function updateDropCell(ctx) {
2094
2140
  for (var j = apply_end_c; j >= apply_str_c; j -= 1) {
2095
2141
  if (hiddenCols.has("".concat(j))) continue;
2096
2142
  var cell = applyData[apply_end_c - j];
2143
+ var afterHookCalled = false;
2097
2144
  if ((cell === null || cell === void 0 ? void 0 : cell.f) != null) {
2098
2145
  var f = "=".concat(formula.functionCopy(ctx, cell.f, "left", apply_end_c - j + 1));
2099
2146
  var v = formula.execfunction(ctx, f, i, j);
@@ -2105,6 +2152,7 @@ function updateDropCell(ctx) {
2105
2152
  v: v[1] instanceof Promise ? v[1] : cell.v,
2106
2153
  m: v[1] instanceof Promise ? "[object Promise]" : v[1]
2107
2154
  }));
2155
+ afterHookCalled = true;
2108
2156
  }
2109
2157
  if (cell.spl != null) {
2110
2158
  cell.spl = v[3].data;
@@ -2136,6 +2184,19 @@ function updateDropCell(ctx) {
2136
2184
  }
2137
2185
  }
2138
2186
  d[i][j] = cell || null;
2187
+ if (!afterHookCalled) {
2188
+ cellChanges.push({
2189
+ sheetId: ctx.currentSheetId,
2190
+ path: ["celldata"],
2191
+ value: {
2192
+ r: i,
2193
+ c: j,
2194
+ v: d[i][j]
2195
+ },
2196
+ key: "".concat(i, "_").concat(j),
2197
+ type: "update"
2198
+ });
2199
+ }
2139
2200
  var bd_r = i;
2140
2201
  var bd_c = copy_end_c - (apply_end_c - j) % csLen;
2141
2202
  if (borderInfoCompute["".concat(bd_r, "_").concat(bd_c)]) {
@@ -2172,6 +2233,9 @@ function updateDropCell(ctx) {
2172
2233
  }
2173
2234
  }
2174
2235
  }
2236
+ if (cellChanges.length > 0 && ((_h = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _h === void 0 ? void 0 : _h.updateCellYdoc)) {
2237
+ ctx.hooks.updateCellYdoc(cellChanges);
2238
+ }
2175
2239
  var cdformat = file.luckysheet_conditionformat_save;
2176
2240
  if (cdformat != null && cdformat.length > 0) {
2177
2241
  for (var i = 0; i < cdformat.length; i += 1) {
@@ -251,20 +251,24 @@ function genarate(value) {
251
251
  v = datenum_local(dateObj);
252
252
  ct.t = "d";
253
253
  var map = {
254
- "yyyy-MM-dd": "dd/MM/yyyy",
255
- "yyyy-MM-dd HH:mm": "dd/MM/yyyy",
256
- "yyyy-MM-ddTHH:mm": "dd/MM/yyyy",
257
- "yyyy/MM/dd": "dd/MM/yyyy",
258
- "yyyy/MM/dd HH:mm": "dd/MM/yyyy",
254
+ "yyyy-MM-dd": "yyyy-MM-dd",
255
+ "yyyy-MM-dd HH:mm": "yyyy-MM-dd HH:mm",
256
+ "yyyy-MM-ddTHH:mm": "yyyy-MM-dd HH:mm",
257
+ "yyyy/MM/dd": "yyyy/MM/dd",
258
+ "yyyy/MM/dd HH:mm": "yyyy/MM/dd HH:mm",
259
259
  "yyyy.MM.dd": "yyyy.MM.dd",
260
260
  "MM/dd/yyyy h:mm AM/PM": "MM/dd/yyyy h:mm AM/PM",
261
261
  "MM/dd/yyyy": "MM/dd/yyyy",
262
262
  "M/d/yyyy": "M/d/yyyy",
263
263
  "MM/dd/yy": "MM/dd/yy",
264
264
  "dd/MM/yyyy": "dd/MM/yyyy",
265
- "dd-MM-yyyy": "dd/MM/yyyy",
265
+ "dd-MM-yyyy": "dd-MM-yyyy",
266
266
  "dd.MM.yyyy": "dd.MM.yyyy",
267
- named: "dd/MM/yyyy"
267
+ "named-mdy-full": "mmmm d, yyyy",
268
+ "named-mdy-abbr": "mmm d, yyyy",
269
+ "named-dmy-full": "d mmmm yyyy",
270
+ "named-dmy-abbr": "d mmm yyyy",
271
+ "named-abbr-dashes": "mmm-d-yyyy"
268
272
  };
269
273
  ct.fa = map[df.formatType] || "dd/MM/yyyy";
270
274
  m = _ssf.default.format(ct.fa, v);
@@ -284,6 +288,7 @@ function update(fmt, v) {
284
288
  return _ssf.default.format(fmt, v);
285
289
  }
286
290
  function is_date(fmt, v) {
291
+ console.log(_ssf.default.is_date(fmt, v), "is_date");
287
292
  return _ssf.default.is_date(fmt, v);
288
293
  }
289
294
  function fuzzynum(s) {
@@ -815,6 +815,7 @@ function insertUpdateDynamicArray(ctx, dynamicArrayItem) {
815
815
  return dynamicArray;
816
816
  }
817
817
  function groupValuesRefresh(ctx) {
818
+ var _a, _b, _c;
818
819
  var luckysheetfile = ctx.luckysheetfile;
819
820
  if (ctx.groupValuesRefreshData.length > 0) {
820
821
  for (var i = 0; i < ctx.groupValuesRefreshData.length; i += 1) {
@@ -837,6 +838,19 @@ function groupValuesRefresh(ctx) {
837
838
  updateValue.v = item.v;
838
839
  updateValue.f = item.f;
839
840
  (0, _cell.setCellValue)(ctx, item.r, item.c, data, updateValue);
841
+ if ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc) {
842
+ ctx.hooks.updateCellYdoc([{
843
+ sheetId: item.id,
844
+ path: ["celldata"],
845
+ value: {
846
+ r: item.r,
847
+ c: item.c,
848
+ v: (_c = (_b = data === null || data === void 0 ? void 0 : data[item.r]) === null || _b === void 0 ? void 0 : _b[item.c]) !== null && _c !== void 0 ? _c : null
849
+ },
850
+ key: "".concat(item.r, "_").concat(item.c),
851
+ type: "update"
852
+ }]);
853
+ }
840
854
  }
841
855
  ctx.groupValuesRefreshData = [];
842
856
  }