@fileverse-dev/fortune-core 1.3.10 → 1.3.11

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.
@@ -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) {
@@ -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
  }
@@ -57,7 +57,7 @@ function getCellHyperlink(ctx, r, c) {
57
57
  return undefined;
58
58
  }
59
59
  function saveHyperlink(ctx, r, c, linkText, linkType, linkAddress, options) {
60
- var _a, _b, _c;
60
+ var _a, _b, _c, _d;
61
61
  var applyToSelection = (options === null || options === void 0 ? void 0 : options.applyToSelection) && (options === null || options === void 0 ? void 0 : options.cellInput);
62
62
  var sheetIndex = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
63
63
  var flowdata = (0, _context.getFlowdata)(ctx);
@@ -77,8 +77,30 @@ function saveHyperlink(ctx, r, c, linkText, linkType, linkAddress, options) {
77
77
  id: ctx.currentSheetId
78
78
  };
79
79
  flowdata[r][c] = cell;
80
+ if ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc) {
81
+ ctx.hooks.updateCellYdoc([{
82
+ sheetId: ctx.currentSheetId,
83
+ path: ["hyperlink"],
84
+ key: "".concat(r, "_").concat(c),
85
+ value: {
86
+ linkType: linkType,
87
+ linkAddress: linkAddress
88
+ },
89
+ type: "update"
90
+ }, {
91
+ sheetId: ctx.currentSheetId,
92
+ path: ["celldata"],
93
+ value: {
94
+ r: r,
95
+ c: c,
96
+ v: cell
97
+ },
98
+ key: "".concat(r, "_").concat(c),
99
+ type: "update"
100
+ }]);
101
+ }
80
102
  }
81
- var offsets = (_a = ctx.linkCard) === null || _a === void 0 ? void 0 : _a.selectionOffsets;
103
+ var offsets = (_b = ctx.linkCard) === null || _b === void 0 ? void 0 : _b.selectionOffsets;
82
104
  if (offsets) {
83
105
  (0, _cursor.setSelectionByCharacterOffset)(options.cellInput, offsets.start, offsets.end);
84
106
  }
@@ -107,8 +129,8 @@ function saveHyperlink(ctx, r, c, linkText, linkType, linkAddress, options) {
107
129
  };
108
130
  flowdata[r][c] = cell;
109
131
  ctx.linkCard = undefined;
110
- if ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _b === void 0 ? void 0 : _b.updateCellYdoc) {
111
- (_c = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _c === void 0 ? void 0 : _c.updateCellYdoc([{
132
+ if ((_c = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _c === void 0 ? void 0 : _c.updateCellYdoc) {
133
+ (_d = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _d === void 0 ? void 0 : _d.updateCellYdoc([{
112
134
  sheetId: ctx.currentSheetId,
113
135
  path: ["celldata"],
114
136
  value: {
@@ -123,11 +145,12 @@ function saveHyperlink(ctx, r, c, linkText, linkType, linkAddress, options) {
123
145
  }
124
146
  }
125
147
  function removeHyperlink(ctx, r, c) {
126
- var _a, _b, _c;
148
+ var _a, _b, _c, _d;
127
149
  var allowEdit = (0, _utils.isAllowEdit)(ctx);
128
150
  if (!allowEdit) return;
129
151
  var sheetIndex = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
130
152
  var flowdata = (0, _context.getFlowdata)(ctx);
153
+ var updatedCell = null;
131
154
  if (flowdata != null && sheetIndex != null) {
132
155
  var hyperlink = _lodash.default.omit(ctx.luckysheetfile[sheetIndex].hyperlink, "".concat(r, "_").concat(c));
133
156
  _lodash.default.set(ctx.luckysheetfile[sheetIndex], "hyperlink", hyperlink);
@@ -136,9 +159,33 @@ function removeHyperlink(ctx, r, c) {
136
159
  (_a = flowdata[r][c]) === null || _a === void 0 ? true : delete _a.hl;
137
160
  (_b = flowdata[r][c]) === null || _b === void 0 ? true : delete _b.un;
138
161
  (_c = flowdata[r][c]) === null || _c === void 0 ? true : delete _c.fc;
162
+ updatedCell = flowdata[r][c];
139
163
  }
140
164
  }
141
165
  ctx.linkCard = undefined;
166
+ if ((_d = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _d === void 0 ? void 0 : _d.updateCellYdoc) {
167
+ var changes = [{
168
+ sheetId: ctx.currentSheetId,
169
+ path: ["hyperlink"],
170
+ key: "".concat(r, "_").concat(c),
171
+ value: null,
172
+ type: "delete"
173
+ }];
174
+ if (updatedCell != null) {
175
+ changes.push({
176
+ sheetId: ctx.currentSheetId,
177
+ path: ["celldata"],
178
+ value: {
179
+ r: r,
180
+ c: c,
181
+ v: updatedCell
182
+ },
183
+ key: "".concat(r, "_").concat(c),
184
+ type: "update"
185
+ });
186
+ }
187
+ ctx.hooks.updateCellYdoc(changes);
188
+ }
142
189
  }
143
190
  function showLinkCard(ctx, r, c, options, isEditing, isMouseDown) {
144
191
  var _a, _b, _c, _d, _e, _f, _g, _h;