@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.
- package/es/api/range.js +20 -0
- package/es/api/sheet.js +30 -2
- package/es/events/keyboard.js +15 -1
- package/es/events/paste.js +77 -28
- package/es/modules/cell.js +58 -2
- package/es/modules/comment.js +129 -24
- package/es/modules/dataVerification.js +34 -1
- package/es/modules/dropCell.js +65 -1
- package/es/modules/formula.js +14 -0
- package/es/modules/hyperlink.js +52 -5
- package/es/modules/merge.js +93 -1
- package/es/modules/moveCells.js +35 -9
- package/es/modules/rowcol.js +75 -2
- package/es/modules/searchReplace.js +58 -2
- package/es/modules/selection.js +152 -42
- package/es/modules/sort.js +74 -9
- package/es/modules/splitColumn.js +21 -0
- package/es/modules/toolbar.js +46 -3
- package/es/settings.d.ts +5 -0
- package/lib/api/range.js +20 -0
- package/lib/api/sheet.js +29 -1
- package/lib/events/keyboard.js +15 -1
- package/lib/events/paste.js +77 -28
- package/lib/modules/cell.js +58 -2
- package/lib/modules/comment.js +129 -24
- package/lib/modules/dataVerification.js +34 -1
- package/lib/modules/dropCell.js +65 -1
- package/lib/modules/formula.js +14 -0
- package/lib/modules/hyperlink.js +52 -5
- package/lib/modules/merge.js +93 -1
- package/lib/modules/moveCells.js +35 -9
- package/lib/modules/rowcol.js +75 -2
- package/lib/modules/searchReplace.js +58 -2
- package/lib/modules/selection.js +152 -42
- package/lib/modules/sort.js +74 -9
- package/lib/modules/splitColumn.js +21 -0
- package/lib/modules/toolbar.js +46 -3
- package/lib/settings.d.ts +5 -0
- package/package.json +1 -1
package/es/modules/comment.js
CHANGED
|
@@ -163,7 +163,7 @@ export function setEditingComment(ctx, flowdata, r, c) {
|
|
|
163
163
|
ctx.editingCommentBox = getCommentBoxByRC(ctx, flowdata, r, c);
|
|
164
164
|
}
|
|
165
165
|
export function removeEditingComment(ctx, globalCache) {
|
|
166
|
-
var _a, _b;
|
|
166
|
+
var _a, _b, _c;
|
|
167
167
|
var editingCommentBoxEle = globalCache.editingCommentBoxEle;
|
|
168
168
|
ctx.editingCommentBox = undefined;
|
|
169
169
|
var r = editingCommentBoxEle === null || editingCommentBoxEle === void 0 ? void 0 : editingCommentBoxEle.dataset.r;
|
|
@@ -187,6 +187,19 @@ export function removeEditingComment(ctx, globalCache) {
|
|
|
187
187
|
return v.rc !== "".concat(r, "_").concat(c);
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
|
+
if ((_c = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _c === void 0 ? void 0 : _c.updateCellYdoc) {
|
|
191
|
+
ctx.hooks.updateCellYdoc([{
|
|
192
|
+
sheetId: ctx.currentSheetId,
|
|
193
|
+
path: ["celldata"],
|
|
194
|
+
value: {
|
|
195
|
+
r: r,
|
|
196
|
+
c: c,
|
|
197
|
+
v: cell
|
|
198
|
+
},
|
|
199
|
+
key: "".concat(r, "_").concat(c),
|
|
200
|
+
type: "update"
|
|
201
|
+
}]);
|
|
202
|
+
}
|
|
190
203
|
if (ctx.hooks.afterUpdateComment) {
|
|
191
204
|
setTimeout(function () {
|
|
192
205
|
var _a, _b;
|
|
@@ -195,7 +208,7 @@ export function removeEditingComment(ctx, globalCache) {
|
|
|
195
208
|
}
|
|
196
209
|
}
|
|
197
210
|
export function newComment(ctx, globalCache, r, c) {
|
|
198
|
-
var _a, _b;
|
|
211
|
+
var _a, _b, _c, _d;
|
|
199
212
|
if (((_b = (_a = ctx.hooks).beforeInsertComment) === null || _b === void 0 ? void 0 : _b.call(_a, r, c)) === false) {
|
|
200
213
|
return;
|
|
201
214
|
}
|
|
@@ -220,6 +233,19 @@ export function newComment(ctx, globalCache, r, c) {
|
|
|
220
233
|
ctx.editingCommentBox = __assign(__assign({}, getCommentBoxByRC(ctx, flowdata, r, c)), {
|
|
221
234
|
autoFocus: true
|
|
222
235
|
});
|
|
236
|
+
if ((_c = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _c === void 0 ? void 0 : _c.updateCellYdoc) {
|
|
237
|
+
ctx.hooks.updateCellYdoc([{
|
|
238
|
+
sheetId: ctx.currentSheetId,
|
|
239
|
+
path: ["celldata"],
|
|
240
|
+
value: {
|
|
241
|
+
r: r,
|
|
242
|
+
c: c,
|
|
243
|
+
v: (_d = flowdata[r][c]) !== null && _d !== void 0 ? _d : null
|
|
244
|
+
},
|
|
245
|
+
key: "".concat(r, "_").concat(c),
|
|
246
|
+
type: "update"
|
|
247
|
+
}]);
|
|
248
|
+
}
|
|
223
249
|
if (ctx.hooks.afterInsertComment) {
|
|
224
250
|
setTimeout(function () {
|
|
225
251
|
var _a, _b;
|
|
@@ -246,7 +272,7 @@ export function editComment(ctx, globalCache, r, c) {
|
|
|
246
272
|
}
|
|
247
273
|
}
|
|
248
274
|
export function deleteComment(ctx, globalCache, r, c) {
|
|
249
|
-
var _a, _b;
|
|
275
|
+
var _a, _b, _c;
|
|
250
276
|
var allowEdit = isAllowEdit(ctx);
|
|
251
277
|
if (!allowEdit) return;
|
|
252
278
|
if (((_b = (_a = ctx.hooks).beforeDeleteComment) === null || _b === void 0 ? void 0 : _b.call(_a, r, c)) === false) {
|
|
@@ -257,6 +283,19 @@ export function deleteComment(ctx, globalCache, r, c) {
|
|
|
257
283
|
var cell = flowdata[r][c];
|
|
258
284
|
if (!cell) return;
|
|
259
285
|
cell.ps = undefined;
|
|
286
|
+
if ((_c = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _c === void 0 ? void 0 : _c.updateCellYdoc) {
|
|
287
|
+
ctx.hooks.updateCellYdoc([{
|
|
288
|
+
sheetId: ctx.currentSheetId,
|
|
289
|
+
path: ["celldata"],
|
|
290
|
+
value: {
|
|
291
|
+
r: r,
|
|
292
|
+
c: c,
|
|
293
|
+
v: cell
|
|
294
|
+
},
|
|
295
|
+
key: "".concat(r, "_").concat(c),
|
|
296
|
+
type: "update"
|
|
297
|
+
}]);
|
|
298
|
+
}
|
|
260
299
|
if (ctx.hooks.afterDeleteComment) {
|
|
261
300
|
setTimeout(function () {
|
|
262
301
|
var _a, _b;
|
|
@@ -276,7 +315,7 @@ export function showComments(ctx, commentShowCells) {
|
|
|
276
315
|
}
|
|
277
316
|
}
|
|
278
317
|
export function showHideComment(ctx, globalCache, r, c) {
|
|
279
|
-
var _a;
|
|
318
|
+
var _a, _b, _c;
|
|
280
319
|
var flowdata = getFlowdata(ctx);
|
|
281
320
|
var comment = (_a = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c]) === null || _a === void 0 ? void 0 : _a.ps;
|
|
282
321
|
if (!comment) return;
|
|
@@ -290,9 +329,23 @@ export function showHideComment(ctx, globalCache, r, c) {
|
|
|
290
329
|
} else {
|
|
291
330
|
comment.isShow = true;
|
|
292
331
|
}
|
|
332
|
+
var cell = (_b = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r]) === null || _b === void 0 ? void 0 : _b[c];
|
|
333
|
+
if (cell && ((_c = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _c === void 0 ? void 0 : _c.updateCellYdoc)) {
|
|
334
|
+
ctx.hooks.updateCellYdoc([{
|
|
335
|
+
sheetId: ctx.currentSheetId,
|
|
336
|
+
path: ["celldata"],
|
|
337
|
+
value: {
|
|
338
|
+
r: r,
|
|
339
|
+
c: c,
|
|
340
|
+
v: cell
|
|
341
|
+
},
|
|
342
|
+
key: "".concat(r, "_").concat(c),
|
|
343
|
+
type: "update"
|
|
344
|
+
}]);
|
|
345
|
+
}
|
|
293
346
|
}
|
|
294
347
|
export function showHideAllComments(ctx) {
|
|
295
|
-
var _a, _b;
|
|
348
|
+
var _a, _b, _c, _d, _e;
|
|
296
349
|
var flowdata = getFlowdata(ctx);
|
|
297
350
|
if (!flowdata) return;
|
|
298
351
|
var isAllShow = true;
|
|
@@ -313,29 +366,55 @@ export function showHideAllComments(ctx) {
|
|
|
313
366
|
}
|
|
314
367
|
var rcs = [];
|
|
315
368
|
if (allComments.length > 0) {
|
|
369
|
+
var cellChanges = [];
|
|
316
370
|
if (isAllShow) {
|
|
317
371
|
for (var i = 0; i < allComments.length; i += 1) {
|
|
318
|
-
var
|
|
319
|
-
r =
|
|
320
|
-
c =
|
|
372
|
+
var _f = allComments[i],
|
|
373
|
+
r = _f.r,
|
|
374
|
+
c = _f.c;
|
|
321
375
|
var comment = (_a = flowdata[r][c]) === null || _a === void 0 ? void 0 : _a.ps;
|
|
322
376
|
if (comment === null || comment === void 0 ? void 0 : comment.isShow) {
|
|
323
377
|
comment.isShow = false;
|
|
324
378
|
rcs.push("".concat(r, "_").concat(c));
|
|
379
|
+
cellChanges.push({
|
|
380
|
+
sheetId: ctx.currentSheetId,
|
|
381
|
+
path: ["celldata"],
|
|
382
|
+
value: {
|
|
383
|
+
r: r,
|
|
384
|
+
c: c,
|
|
385
|
+
v: (_b = flowdata[r][c]) !== null && _b !== void 0 ? _b : null
|
|
386
|
+
},
|
|
387
|
+
key: "".concat(r, "_").concat(c),
|
|
388
|
+
type: "update"
|
|
389
|
+
});
|
|
325
390
|
}
|
|
326
391
|
}
|
|
327
392
|
ctx.commentBoxes = [];
|
|
328
393
|
} else {
|
|
329
394
|
for (var i = 0; i < allComments.length; i += 1) {
|
|
330
|
-
var
|
|
331
|
-
r =
|
|
332
|
-
c =
|
|
333
|
-
var comment = (
|
|
395
|
+
var _g = allComments[i],
|
|
396
|
+
r = _g.r,
|
|
397
|
+
c = _g.c;
|
|
398
|
+
var comment = (_c = flowdata[r][c]) === null || _c === void 0 ? void 0 : _c.ps;
|
|
334
399
|
if (comment && !comment.isShow) {
|
|
335
400
|
comment.isShow = true;
|
|
401
|
+
cellChanges.push({
|
|
402
|
+
sheetId: ctx.currentSheetId,
|
|
403
|
+
path: ["celldata"],
|
|
404
|
+
value: {
|
|
405
|
+
r: r,
|
|
406
|
+
c: c,
|
|
407
|
+
v: (_d = flowdata[r][c]) !== null && _d !== void 0 ? _d : null
|
|
408
|
+
},
|
|
409
|
+
key: "".concat(r, "_").concat(c),
|
|
410
|
+
type: "update"
|
|
411
|
+
});
|
|
336
412
|
}
|
|
337
413
|
}
|
|
338
414
|
}
|
|
415
|
+
if (cellChanges.length > 0 && ((_e = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _e === void 0 ? void 0 : _e.updateCellYdoc)) {
|
|
416
|
+
ctx.hooks.updateCellYdoc(cellChanges);
|
|
417
|
+
}
|
|
339
418
|
}
|
|
340
419
|
}
|
|
341
420
|
export function removeOverShowComment(ctx) {
|
|
@@ -497,13 +576,13 @@ export function onCommentBoxResize(ctx, globalCache, e) {
|
|
|
497
576
|
return false;
|
|
498
577
|
}
|
|
499
578
|
export function onCommentBoxResizeEnd(ctx, globalCache) {
|
|
500
|
-
var _a;
|
|
579
|
+
var _a, _b;
|
|
501
580
|
if ((_a = globalCache.commentBox) === null || _a === void 0 ? void 0 : _a.resizingId) {
|
|
502
|
-
var
|
|
503
|
-
resizingId =
|
|
504
|
-
|
|
505
|
-
r =
|
|
506
|
-
c =
|
|
581
|
+
var _c = globalCache.commentBox,
|
|
582
|
+
resizingId = _c.resizingId,
|
|
583
|
+
_d = _c.commentRC,
|
|
584
|
+
r = _d.r,
|
|
585
|
+
c = _d.c;
|
|
507
586
|
globalCache.commentBox.resizingId = undefined;
|
|
508
587
|
var position = getCommentBoxPosition(resizingId);
|
|
509
588
|
if (position) {
|
|
@@ -519,6 +598,19 @@ export function onCommentBoxResizeEnd(ctx, globalCache) {
|
|
|
519
598
|
cell.ps.width = width / ctx.zoomRatio;
|
|
520
599
|
cell.ps.height = height / ctx.zoomRatio;
|
|
521
600
|
setEditingComment(ctx, flowdata, r, c);
|
|
601
|
+
if ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _b === void 0 ? void 0 : _b.updateCellYdoc) {
|
|
602
|
+
ctx.hooks.updateCellYdoc([{
|
|
603
|
+
sheetId: ctx.currentSheetId,
|
|
604
|
+
path: ["celldata"],
|
|
605
|
+
value: {
|
|
606
|
+
r: r,
|
|
607
|
+
c: c,
|
|
608
|
+
v: cell
|
|
609
|
+
},
|
|
610
|
+
key: "".concat(r, "_").concat(c),
|
|
611
|
+
type: "update"
|
|
612
|
+
}]);
|
|
613
|
+
}
|
|
522
614
|
}
|
|
523
615
|
}
|
|
524
616
|
}
|
|
@@ -570,13 +662,13 @@ export function onCommentBoxMove(ctx, globalCache, e) {
|
|
|
570
662
|
return false;
|
|
571
663
|
}
|
|
572
664
|
export function onCommentBoxMoveEnd(ctx, globalCache) {
|
|
573
|
-
var _a;
|
|
665
|
+
var _a, _b;
|
|
574
666
|
if ((_a = globalCache.commentBox) === null || _a === void 0 ? void 0 : _a.movingId) {
|
|
575
|
-
var
|
|
576
|
-
movingId =
|
|
577
|
-
|
|
578
|
-
r =
|
|
579
|
-
c =
|
|
667
|
+
var _c = globalCache.commentBox,
|
|
668
|
+
movingId = _c.movingId,
|
|
669
|
+
_d = _c.commentRC,
|
|
670
|
+
r = _d.r,
|
|
671
|
+
c = _d.c;
|
|
580
672
|
globalCache.commentBox.movingId = undefined;
|
|
581
673
|
var position = getCommentBoxPosition(movingId);
|
|
582
674
|
if (position) {
|
|
@@ -588,6 +680,19 @@ export function onCommentBoxMoveEnd(ctx, globalCache) {
|
|
|
588
680
|
cell.ps.left = left / ctx.zoomRatio;
|
|
589
681
|
cell.ps.top = top_5 / ctx.zoomRatio;
|
|
590
682
|
setEditingComment(ctx, flowdata, r, c);
|
|
683
|
+
if ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _b === void 0 ? void 0 : _b.updateCellYdoc) {
|
|
684
|
+
ctx.hooks.updateCellYdoc([{
|
|
685
|
+
sheetId: ctx.currentSheetId,
|
|
686
|
+
path: ["celldata"],
|
|
687
|
+
value: {
|
|
688
|
+
r: r,
|
|
689
|
+
c: c,
|
|
690
|
+
v: cell
|
|
691
|
+
},
|
|
692
|
+
key: "".concat(r, "_").concat(c),
|
|
693
|
+
type: "update"
|
|
694
|
+
}]);
|
|
695
|
+
}
|
|
591
696
|
}
|
|
592
697
|
}
|
|
593
698
|
}
|
|
@@ -229,7 +229,7 @@ export function validateCellData(ctx, item, cellValue) {
|
|
|
229
229
|
return true;
|
|
230
230
|
}
|
|
231
231
|
export function checkboxChange(ctx, r, c) {
|
|
232
|
-
var _a;
|
|
232
|
+
var _a, _b, _c, _d;
|
|
233
233
|
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
234
234
|
var currentDataVerification = (_a = ctx.luckysheetfile[index].dataVerification) !== null && _a !== void 0 ? _a : {};
|
|
235
235
|
var item = currentDataVerification["".concat(r, "_").concat(c)];
|
|
@@ -240,6 +240,25 @@ export function checkboxChange(ctx, r, c) {
|
|
|
240
240
|
}
|
|
241
241
|
var d = getFlowdata(ctx);
|
|
242
242
|
setCellValue(ctx, r, c, d, value);
|
|
243
|
+
if ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _b === void 0 ? void 0 : _b.updateCellYdoc) {
|
|
244
|
+
ctx.hooks.updateCellYdoc([{
|
|
245
|
+
sheetId: ctx.currentSheetId,
|
|
246
|
+
path: ["celldata"],
|
|
247
|
+
value: {
|
|
248
|
+
r: r,
|
|
249
|
+
c: c,
|
|
250
|
+
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
|
|
251
|
+
},
|
|
252
|
+
key: "".concat(r, "_").concat(c),
|
|
253
|
+
type: "update"
|
|
254
|
+
}, {
|
|
255
|
+
sheetId: ctx.currentSheetId,
|
|
256
|
+
path: ["dataVerification"],
|
|
257
|
+
key: "".concat(r, "_").concat(c),
|
|
258
|
+
value: JSON.parse(JSON.stringify(item)),
|
|
259
|
+
type: "update"
|
|
260
|
+
}]);
|
|
261
|
+
}
|
|
243
262
|
}
|
|
244
263
|
export function getFailureText(ctx, item) {
|
|
245
264
|
var _a, _b, _c, _d, _e;
|
|
@@ -587,6 +606,7 @@ export function cellFocus(ctx, r, c, clickMode) {
|
|
|
587
606
|
}
|
|
588
607
|
export function setDropdownValue(ctx, value, arr) {
|
|
589
608
|
var _a;
|
|
609
|
+
var _b, _c, _d;
|
|
590
610
|
if (!ctx.luckysheet_select_save) return;
|
|
591
611
|
var d = getFlowdata(ctx);
|
|
592
612
|
if (!d) return;
|
|
@@ -632,6 +652,19 @@ export function setDropdownValue(ctx, value, arr) {
|
|
|
632
652
|
v: value,
|
|
633
653
|
pillColor: selectedColor
|
|
634
654
|
});
|
|
655
|
+
if ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _b === void 0 ? void 0 : _b.updateCellYdoc) {
|
|
656
|
+
ctx.hooks.updateCellYdoc([{
|
|
657
|
+
sheetId: ctx.currentSheetId,
|
|
658
|
+
path: ["celldata"],
|
|
659
|
+
value: {
|
|
660
|
+
r: rowIndex,
|
|
661
|
+
c: colIndex,
|
|
662
|
+
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
|
|
663
|
+
},
|
|
664
|
+
key: "".concat(rowIndex, "_").concat(colIndex),
|
|
665
|
+
type: "update"
|
|
666
|
+
}]);
|
|
667
|
+
}
|
|
635
668
|
var currentRowHeight = getRowHeight(ctx, [rowIndex])[rowIndex];
|
|
636
669
|
var newHeight = 22 * (value.split(",").length || (valueData === null || valueData === void 0 ? void 0 : valueData.length)) || 22;
|
|
637
670
|
if (currentRowHeight < newHeight) {
|
package/es/modules/dropCell.js
CHANGED
|
@@ -1779,7 +1779,7 @@ function getApplyData(copyD, csLen, asLen) {
|
|
|
1779
1779
|
}
|
|
1780
1780
|
export function updateDropCell(ctx) {
|
|
1781
1781
|
var _a, _b, _c, _d;
|
|
1782
|
-
var _e, _f, _g;
|
|
1782
|
+
var _e, _f, _g, _h;
|
|
1783
1783
|
var d = getFlowdata(ctx);
|
|
1784
1784
|
var allowEdit = isAllowEdit(ctx);
|
|
1785
1785
|
var isReadOnly = isAllowEditReadOnly(ctx);
|
|
@@ -1815,6 +1815,7 @@ export function updateDropCell(ctx) {
|
|
|
1815
1815
|
var apply_end_r = applyRange.row[1];
|
|
1816
1816
|
var apply_str_c = applyRange.column[0];
|
|
1817
1817
|
var apply_end_c = applyRange.column[1];
|
|
1818
|
+
var cellChanges = [];
|
|
1818
1819
|
if (direction === "down" || direction === "up") {
|
|
1819
1820
|
var asLen = apply_end_r - apply_str_r + 1;
|
|
1820
1821
|
for (var i = apply_str_c; i <= apply_end_c; i += 1) {
|
|
@@ -1825,6 +1826,7 @@ export function updateDropCell(ctx) {
|
|
|
1825
1826
|
for (var j = apply_str_r; j <= apply_end_r; j += 1) {
|
|
1826
1827
|
if (hiddenRows.has("".concat(j))) continue;
|
|
1827
1828
|
var cell = applyData[j - apply_str_r];
|
|
1829
|
+
var afterHookCalled = false;
|
|
1828
1830
|
if ((cell === null || cell === void 0 ? void 0 : cell.f) != null) {
|
|
1829
1831
|
var f = "=".concat(formula.functionCopy(ctx, cell.f, "down", j - apply_str_r + 1));
|
|
1830
1832
|
var v = formula.execfunction(ctx, f, j, i);
|
|
@@ -1836,6 +1838,7 @@ export function updateDropCell(ctx) {
|
|
|
1836
1838
|
v: v[1] instanceof Promise ? v[1] : cell.v,
|
|
1837
1839
|
m: v[1] instanceof Promise ? "[object Promise]" : v[1]
|
|
1838
1840
|
}));
|
|
1841
|
+
afterHookCalled = true;
|
|
1839
1842
|
}
|
|
1840
1843
|
if (cell.spl != null) {
|
|
1841
1844
|
cell.spl = v[3].data;
|
|
@@ -1873,6 +1876,19 @@ export function updateDropCell(ctx) {
|
|
|
1873
1876
|
}
|
|
1874
1877
|
}
|
|
1875
1878
|
d[j][i] = cell || null;
|
|
1879
|
+
if (!afterHookCalled) {
|
|
1880
|
+
cellChanges.push({
|
|
1881
|
+
sheetId: ctx.currentSheetId,
|
|
1882
|
+
path: ["celldata"],
|
|
1883
|
+
value: {
|
|
1884
|
+
r: j,
|
|
1885
|
+
c: i,
|
|
1886
|
+
v: d[j][i]
|
|
1887
|
+
},
|
|
1888
|
+
key: "".concat(j, "_").concat(i),
|
|
1889
|
+
type: "update"
|
|
1890
|
+
});
|
|
1891
|
+
}
|
|
1876
1892
|
var bd_r = copy_str_r + (j - apply_str_r) % csLen;
|
|
1877
1893
|
var bd_c = i;
|
|
1878
1894
|
if (borderInfoCompute["".concat(bd_r, "_").concat(bd_c)]) {
|
|
@@ -1911,6 +1927,7 @@ export function updateDropCell(ctx) {
|
|
|
1911
1927
|
for (var j = apply_end_r; j >= apply_str_r; j -= 1) {
|
|
1912
1928
|
if (hiddenRows.has("".concat(j))) continue;
|
|
1913
1929
|
var cell = applyData[apply_end_r - j];
|
|
1930
|
+
var afterHookCalled = false;
|
|
1914
1931
|
if ((cell === null || cell === void 0 ? void 0 : cell.f) != null) {
|
|
1915
1932
|
var f = "=".concat(formula.functionCopy(ctx, cell.f, "up", apply_end_r - j + 1));
|
|
1916
1933
|
var v = formula.execfunction(ctx, f, j, i);
|
|
@@ -1922,6 +1939,7 @@ export function updateDropCell(ctx) {
|
|
|
1922
1939
|
v: v[1] instanceof Promise ? v[1] : cell.v,
|
|
1923
1940
|
m: v[1] instanceof Promise ? "[object Promise]" : v[1]
|
|
1924
1941
|
}));
|
|
1942
|
+
afterHookCalled = true;
|
|
1925
1943
|
}
|
|
1926
1944
|
if (cell.spl != null) {
|
|
1927
1945
|
cell.spl = v[3].data;
|
|
@@ -1953,6 +1971,19 @@ export function updateDropCell(ctx) {
|
|
|
1953
1971
|
}
|
|
1954
1972
|
}
|
|
1955
1973
|
d[j][i] = cell || null;
|
|
1974
|
+
if (!afterHookCalled) {
|
|
1975
|
+
cellChanges.push({
|
|
1976
|
+
sheetId: ctx.currentSheetId,
|
|
1977
|
+
path: ["celldata"],
|
|
1978
|
+
value: {
|
|
1979
|
+
r: j,
|
|
1980
|
+
c: i,
|
|
1981
|
+
v: d[j][i]
|
|
1982
|
+
},
|
|
1983
|
+
key: "".concat(j, "_").concat(i),
|
|
1984
|
+
type: "update"
|
|
1985
|
+
});
|
|
1986
|
+
}
|
|
1956
1987
|
var bd_r = copy_end_r - (apply_end_r - j) % csLen;
|
|
1957
1988
|
var bd_c = i;
|
|
1958
1989
|
if (borderInfoCompute["".concat(bd_r, "_").concat(bd_c)]) {
|
|
@@ -1998,6 +2029,7 @@ export function updateDropCell(ctx) {
|
|
|
1998
2029
|
for (var j = apply_str_c; j <= apply_end_c; j += 1) {
|
|
1999
2030
|
if (hiddenCols.has("".concat(j))) continue;
|
|
2000
2031
|
var cell = applyData[j - apply_str_c];
|
|
2032
|
+
var afterHookCalled = false;
|
|
2001
2033
|
if ((cell === null || cell === void 0 ? void 0 : cell.f) != null) {
|
|
2002
2034
|
var f = "=".concat(formula.functionCopy(ctx, cell.f, "right", j - apply_str_c + 1));
|
|
2003
2035
|
var v = formula.execfunction(ctx, f, i, j);
|
|
@@ -2009,6 +2041,7 @@ export function updateDropCell(ctx) {
|
|
|
2009
2041
|
v: v[1] instanceof Promise ? v[1] : cell.v,
|
|
2010
2042
|
m: v[1] instanceof Promise ? "[object Promise]" : v[1]
|
|
2011
2043
|
}));
|
|
2044
|
+
afterHookCalled = true;
|
|
2012
2045
|
}
|
|
2013
2046
|
if (cell.spl != null) {
|
|
2014
2047
|
cell.spl = v[3].data;
|
|
@@ -2040,6 +2073,19 @@ export function updateDropCell(ctx) {
|
|
|
2040
2073
|
}
|
|
2041
2074
|
}
|
|
2042
2075
|
d[i][j] = cell || null;
|
|
2076
|
+
if (!afterHookCalled) {
|
|
2077
|
+
cellChanges.push({
|
|
2078
|
+
sheetId: ctx.currentSheetId,
|
|
2079
|
+
path: ["celldata"],
|
|
2080
|
+
value: {
|
|
2081
|
+
r: i,
|
|
2082
|
+
c: j,
|
|
2083
|
+
v: d[i][j]
|
|
2084
|
+
},
|
|
2085
|
+
key: "".concat(i, "_").concat(j),
|
|
2086
|
+
type: "update"
|
|
2087
|
+
});
|
|
2088
|
+
}
|
|
2043
2089
|
var bd_r = i;
|
|
2044
2090
|
var bd_c = copy_str_c + (j - apply_str_c) % csLen;
|
|
2045
2091
|
if (borderInfoCompute["".concat(bd_r, "_").concat(bd_c)]) {
|
|
@@ -2078,6 +2124,7 @@ export function updateDropCell(ctx) {
|
|
|
2078
2124
|
for (var j = apply_end_c; j >= apply_str_c; j -= 1) {
|
|
2079
2125
|
if (hiddenCols.has("".concat(j))) continue;
|
|
2080
2126
|
var cell = applyData[apply_end_c - j];
|
|
2127
|
+
var afterHookCalled = false;
|
|
2081
2128
|
if ((cell === null || cell === void 0 ? void 0 : cell.f) != null) {
|
|
2082
2129
|
var f = "=".concat(formula.functionCopy(ctx, cell.f, "left", apply_end_c - j + 1));
|
|
2083
2130
|
var v = formula.execfunction(ctx, f, i, j);
|
|
@@ -2089,6 +2136,7 @@ export function updateDropCell(ctx) {
|
|
|
2089
2136
|
v: v[1] instanceof Promise ? v[1] : cell.v,
|
|
2090
2137
|
m: v[1] instanceof Promise ? "[object Promise]" : v[1]
|
|
2091
2138
|
}));
|
|
2139
|
+
afterHookCalled = true;
|
|
2092
2140
|
}
|
|
2093
2141
|
if (cell.spl != null) {
|
|
2094
2142
|
cell.spl = v[3].data;
|
|
@@ -2120,6 +2168,19 @@ export function updateDropCell(ctx) {
|
|
|
2120
2168
|
}
|
|
2121
2169
|
}
|
|
2122
2170
|
d[i][j] = cell || null;
|
|
2171
|
+
if (!afterHookCalled) {
|
|
2172
|
+
cellChanges.push({
|
|
2173
|
+
sheetId: ctx.currentSheetId,
|
|
2174
|
+
path: ["celldata"],
|
|
2175
|
+
value: {
|
|
2176
|
+
r: i,
|
|
2177
|
+
c: j,
|
|
2178
|
+
v: d[i][j]
|
|
2179
|
+
},
|
|
2180
|
+
key: "".concat(i, "_").concat(j),
|
|
2181
|
+
type: "update"
|
|
2182
|
+
});
|
|
2183
|
+
}
|
|
2123
2184
|
var bd_r = i;
|
|
2124
2185
|
var bd_c = copy_end_c - (apply_end_c - j) % csLen;
|
|
2125
2186
|
if (borderInfoCompute["".concat(bd_r, "_").concat(bd_c)]) {
|
|
@@ -2156,6 +2217,9 @@ export function updateDropCell(ctx) {
|
|
|
2156
2217
|
}
|
|
2157
2218
|
}
|
|
2158
2219
|
}
|
|
2220
|
+
if (cellChanges.length > 0 && ((_h = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _h === void 0 ? void 0 : _h.updateCellYdoc)) {
|
|
2221
|
+
ctx.hooks.updateCellYdoc(cellChanges);
|
|
2222
|
+
}
|
|
2159
2223
|
var cdformat = file.luckysheet_conditionformat_save;
|
|
2160
2224
|
if (cdformat != null && cdformat.length > 0) {
|
|
2161
2225
|
for (var i = 0; i < cdformat.length; i += 1) {
|
package/es/modules/formula.js
CHANGED
|
@@ -785,6 +785,7 @@ function insertUpdateDynamicArray(ctx, dynamicArrayItem) {
|
|
|
785
785
|
return dynamicArray;
|
|
786
786
|
}
|
|
787
787
|
export function groupValuesRefresh(ctx) {
|
|
788
|
+
var _a, _b, _c;
|
|
788
789
|
var luckysheetfile = ctx.luckysheetfile;
|
|
789
790
|
if (ctx.groupValuesRefreshData.length > 0) {
|
|
790
791
|
for (var i = 0; i < ctx.groupValuesRefreshData.length; i += 1) {
|
|
@@ -807,6 +808,19 @@ export function groupValuesRefresh(ctx) {
|
|
|
807
808
|
updateValue.v = item.v;
|
|
808
809
|
updateValue.f = item.f;
|
|
809
810
|
setCellValue(ctx, item.r, item.c, data, updateValue);
|
|
811
|
+
if ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc) {
|
|
812
|
+
ctx.hooks.updateCellYdoc([{
|
|
813
|
+
sheetId: item.id,
|
|
814
|
+
path: ["celldata"],
|
|
815
|
+
value: {
|
|
816
|
+
r: item.r,
|
|
817
|
+
c: item.c,
|
|
818
|
+
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
|
|
819
|
+
},
|
|
820
|
+
key: "".concat(item.r, "_").concat(item.c),
|
|
821
|
+
type: "update"
|
|
822
|
+
}]);
|
|
823
|
+
}
|
|
810
824
|
}
|
|
811
825
|
ctx.groupValuesRefreshData = [];
|
|
812
826
|
}
|
package/es/modules/hyperlink.js
CHANGED
|
@@ -41,7 +41,7 @@ export function getCellHyperlink(ctx, r, c) {
|
|
|
41
41
|
return undefined;
|
|
42
42
|
}
|
|
43
43
|
export function saveHyperlink(ctx, r, c, linkText, linkType, linkAddress, options) {
|
|
44
|
-
var _a, _b, _c;
|
|
44
|
+
var _a, _b, _c, _d;
|
|
45
45
|
var applyToSelection = (options === null || options === void 0 ? void 0 : options.applyToSelection) && (options === null || options === void 0 ? void 0 : options.cellInput);
|
|
46
46
|
var sheetIndex = getSheetIndex(ctx, ctx.currentSheetId);
|
|
47
47
|
var flowdata = getFlowdata(ctx);
|
|
@@ -61,8 +61,30 @@ export function saveHyperlink(ctx, r, c, linkText, linkType, linkAddress, option
|
|
|
61
61
|
id: ctx.currentSheetId
|
|
62
62
|
};
|
|
63
63
|
flowdata[r][c] = cell;
|
|
64
|
+
if ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc) {
|
|
65
|
+
ctx.hooks.updateCellYdoc([{
|
|
66
|
+
sheetId: ctx.currentSheetId,
|
|
67
|
+
path: ["hyperlink"],
|
|
68
|
+
key: "".concat(r, "_").concat(c),
|
|
69
|
+
value: {
|
|
70
|
+
linkType: linkType,
|
|
71
|
+
linkAddress: linkAddress
|
|
72
|
+
},
|
|
73
|
+
type: "update"
|
|
74
|
+
}, {
|
|
75
|
+
sheetId: ctx.currentSheetId,
|
|
76
|
+
path: ["celldata"],
|
|
77
|
+
value: {
|
|
78
|
+
r: r,
|
|
79
|
+
c: c,
|
|
80
|
+
v: cell
|
|
81
|
+
},
|
|
82
|
+
key: "".concat(r, "_").concat(c),
|
|
83
|
+
type: "update"
|
|
84
|
+
}]);
|
|
85
|
+
}
|
|
64
86
|
}
|
|
65
|
-
var offsets = (
|
|
87
|
+
var offsets = (_b = ctx.linkCard) === null || _b === void 0 ? void 0 : _b.selectionOffsets;
|
|
66
88
|
if (offsets) {
|
|
67
89
|
setSelectionByCharacterOffset(options.cellInput, offsets.start, offsets.end);
|
|
68
90
|
}
|
|
@@ -91,8 +113,8 @@ export function saveHyperlink(ctx, r, c, linkText, linkType, linkAddress, option
|
|
|
91
113
|
};
|
|
92
114
|
flowdata[r][c] = cell;
|
|
93
115
|
ctx.linkCard = undefined;
|
|
94
|
-
if ((
|
|
95
|
-
(
|
|
116
|
+
if ((_c = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _c === void 0 ? void 0 : _c.updateCellYdoc) {
|
|
117
|
+
(_d = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _d === void 0 ? void 0 : _d.updateCellYdoc([{
|
|
96
118
|
sheetId: ctx.currentSheetId,
|
|
97
119
|
path: ["celldata"],
|
|
98
120
|
value: {
|
|
@@ -107,11 +129,12 @@ export function saveHyperlink(ctx, r, c, linkText, linkType, linkAddress, option
|
|
|
107
129
|
}
|
|
108
130
|
}
|
|
109
131
|
export function removeHyperlink(ctx, r, c) {
|
|
110
|
-
var _a, _b, _c;
|
|
132
|
+
var _a, _b, _c, _d;
|
|
111
133
|
var allowEdit = isAllowEdit(ctx);
|
|
112
134
|
if (!allowEdit) return;
|
|
113
135
|
var sheetIndex = getSheetIndex(ctx, ctx.currentSheetId);
|
|
114
136
|
var flowdata = getFlowdata(ctx);
|
|
137
|
+
var updatedCell = null;
|
|
115
138
|
if (flowdata != null && sheetIndex != null) {
|
|
116
139
|
var hyperlink = _.omit(ctx.luckysheetfile[sheetIndex].hyperlink, "".concat(r, "_").concat(c));
|
|
117
140
|
_.set(ctx.luckysheetfile[sheetIndex], "hyperlink", hyperlink);
|
|
@@ -120,9 +143,33 @@ export function removeHyperlink(ctx, r, c) {
|
|
|
120
143
|
(_a = flowdata[r][c]) === null || _a === void 0 ? true : delete _a.hl;
|
|
121
144
|
(_b = flowdata[r][c]) === null || _b === void 0 ? true : delete _b.un;
|
|
122
145
|
(_c = flowdata[r][c]) === null || _c === void 0 ? true : delete _c.fc;
|
|
146
|
+
updatedCell = flowdata[r][c];
|
|
123
147
|
}
|
|
124
148
|
}
|
|
125
149
|
ctx.linkCard = undefined;
|
|
150
|
+
if ((_d = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _d === void 0 ? void 0 : _d.updateCellYdoc) {
|
|
151
|
+
var changes = [{
|
|
152
|
+
sheetId: ctx.currentSheetId,
|
|
153
|
+
path: ["hyperlink"],
|
|
154
|
+
key: "".concat(r, "_").concat(c),
|
|
155
|
+
value: null,
|
|
156
|
+
type: "delete"
|
|
157
|
+
}];
|
|
158
|
+
if (updatedCell != null) {
|
|
159
|
+
changes.push({
|
|
160
|
+
sheetId: ctx.currentSheetId,
|
|
161
|
+
path: ["celldata"],
|
|
162
|
+
value: {
|
|
163
|
+
r: r,
|
|
164
|
+
c: c,
|
|
165
|
+
v: updatedCell
|
|
166
|
+
},
|
|
167
|
+
key: "".concat(r, "_").concat(c),
|
|
168
|
+
type: "update"
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
ctx.hooks.updateCellYdoc(changes);
|
|
172
|
+
}
|
|
126
173
|
}
|
|
127
174
|
export function showLinkCard(ctx, r, c, options, isEditing, isMouseDown) {
|
|
128
175
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|