@fileverse-dev/fortune-core 1.3.10 → 1.3.11-input-ref
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 +50 -15
- package/es/events/mouse.js +36 -20
- package/es/events/paste.js +77 -28
- package/es/modules/cell.js +59 -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.d.ts +7 -0
- package/es/modules/formula.js +356 -45
- 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 +49 -14
- package/lib/events/mouse.js +35 -19
- package/lib/events/paste.js +77 -28
- package/lib/modules/cell.js +59 -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.d.ts +7 -0
- package/lib/modules/formula.js +362 -45
- 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/lib/modules/cell.js
CHANGED
|
@@ -574,6 +574,7 @@ function cancelNormalSelected(ctx) {
|
|
|
574
574
|
ctx.formulaCache.rangestart = false;
|
|
575
575
|
ctx.formulaCache.rangedrag_column_start = false;
|
|
576
576
|
ctx.formulaCache.rangedrag_row_start = false;
|
|
577
|
+
ctx.formulaCache.rangeSelectionActive = null;
|
|
577
578
|
}
|
|
578
579
|
function updateCell(ctx, r, c, $input, value, canvas) {
|
|
579
580
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
@@ -842,7 +843,7 @@ function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
842
843
|
var newValue_1 = _lodash.default.cloneDeep(d[r][c]);
|
|
843
844
|
setTimeout(function () {
|
|
844
845
|
var _a, _b;
|
|
845
|
-
return (_b = (_a = ctx.hooks).afterUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c,
|
|
846
|
+
return (_b = (_a = ctx.hooks).afterUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, oldValue_1, newValue_1);
|
|
846
847
|
});
|
|
847
848
|
}
|
|
848
849
|
ctx.formulaCache.execFunctionGlobalData = null;
|
|
@@ -1295,13 +1296,16 @@ function keepOnlyValueParts(cell) {
|
|
|
1295
1296
|
} : null;
|
|
1296
1297
|
}
|
|
1297
1298
|
function clearSelectedCellFormat(ctx) {
|
|
1299
|
+
var _a;
|
|
1298
1300
|
var activeSheetIndex = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
|
|
1299
1301
|
if (activeSheetIndex == null) return;
|
|
1302
|
+
var changeMap = new Map();
|
|
1300
1303
|
var activeSheetFile = ctx.luckysheetfile[activeSheetIndex];
|
|
1301
1304
|
var selectedRanges = ctx.luckysheet_select_save;
|
|
1302
1305
|
if (!activeSheetFile || !selectedRanges) return;
|
|
1303
1306
|
var sheetData = activeSheetFile.data;
|
|
1304
1307
|
selectedRanges.forEach(function (_a) {
|
|
1308
|
+
var _b;
|
|
1305
1309
|
var rowRange = _a.row,
|
|
1306
1310
|
columnRange = _a.column;
|
|
1307
1311
|
var startRow = rowRange[0],
|
|
@@ -1314,20 +1318,38 @@ function clearSelectedCellFormat(ctx) {
|
|
|
1314
1318
|
for (var columnIndex = startColumn; columnIndex <= endColumn; columnIndex++) {
|
|
1315
1319
|
if (rowCells[columnIndex] === undefined) continue;
|
|
1316
1320
|
rowCells[columnIndex] = keepOnlyValueParts(rowCells[columnIndex]);
|
|
1321
|
+
var v = (_b = rowCells[columnIndex]) !== null && _b !== void 0 ? _b : null;
|
|
1322
|
+
var key = "".concat(rowIndex, "_").concat(columnIndex);
|
|
1323
|
+
changeMap.set(key, {
|
|
1324
|
+
sheetId: ctx.currentSheetId,
|
|
1325
|
+
path: ["celldata"],
|
|
1326
|
+
key: key,
|
|
1327
|
+
value: {
|
|
1328
|
+
r: rowIndex,
|
|
1329
|
+
c: columnIndex,
|
|
1330
|
+
v: v
|
|
1331
|
+
},
|
|
1332
|
+
type: v == null ? "delete" : "update"
|
|
1333
|
+
});
|
|
1317
1334
|
}
|
|
1318
1335
|
}
|
|
1319
1336
|
});
|
|
1337
|
+
if (((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc) && changeMap.size > 0) {
|
|
1338
|
+
ctx.hooks.updateCellYdoc(Array.from(changeMap.values()));
|
|
1339
|
+
}
|
|
1320
1340
|
}
|
|
1321
1341
|
function clearRowsCellsFormat(ctx) {
|
|
1322
|
-
var _a, _b;
|
|
1342
|
+
var _a, _b, _c;
|
|
1323
1343
|
var activeSheetIndex = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
|
|
1324
1344
|
if (activeSheetIndex == null) return;
|
|
1345
|
+
var changeMap = new Map();
|
|
1325
1346
|
var activeSheetFile = ctx.luckysheetfile[activeSheetIndex];
|
|
1326
1347
|
var selectedRanges = ctx.luckysheet_select_save;
|
|
1327
1348
|
if (!activeSheetFile || !selectedRanges) return;
|
|
1328
1349
|
var sheetData = activeSheetFile.data;
|
|
1329
1350
|
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
1351
|
selectedRanges.forEach(function (_a) {
|
|
1352
|
+
var _b;
|
|
1331
1353
|
var rowRange = _a.row;
|
|
1332
1354
|
var startRow = rowRange[0],
|
|
1333
1355
|
endRow = rowRange[1];
|
|
@@ -1337,19 +1359,38 @@ function clearRowsCellsFormat(ctx) {
|
|
|
1337
1359
|
for (var columnIndex = 0; columnIndex < columnCount; columnIndex++) {
|
|
1338
1360
|
if (rowCells[columnIndex] === undefined) continue;
|
|
1339
1361
|
rowCells[columnIndex] = keepOnlyValueParts(rowCells[columnIndex]);
|
|
1362
|
+
var v = (_b = rowCells[columnIndex]) !== null && _b !== void 0 ? _b : null;
|
|
1363
|
+
var key = "".concat(rowIndex, "_").concat(columnIndex);
|
|
1364
|
+
changeMap.set(key, {
|
|
1365
|
+
sheetId: ctx.currentSheetId,
|
|
1366
|
+
path: ["celldata"],
|
|
1367
|
+
key: key,
|
|
1368
|
+
value: {
|
|
1369
|
+
r: rowIndex,
|
|
1370
|
+
c: columnIndex,
|
|
1371
|
+
v: v
|
|
1372
|
+
},
|
|
1373
|
+
type: v == null ? "delete" : "update"
|
|
1374
|
+
});
|
|
1340
1375
|
}
|
|
1341
1376
|
}
|
|
1342
1377
|
});
|
|
1378
|
+
if (((_c = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _c === void 0 ? void 0 : _c.updateCellYdoc) && changeMap.size > 0) {
|
|
1379
|
+
ctx.hooks.updateCellYdoc(Array.from(changeMap.values()));
|
|
1380
|
+
}
|
|
1343
1381
|
}
|
|
1344
1382
|
function clearColumnsCellsFormat(ctx) {
|
|
1383
|
+
var _a;
|
|
1345
1384
|
var activeSheetIndex = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
|
|
1346
1385
|
if (activeSheetIndex == null) return;
|
|
1386
|
+
var changeMap = new Map();
|
|
1347
1387
|
var activeSheetFile = ctx.luckysheetfile[activeSheetIndex];
|
|
1348
1388
|
var selectedRanges = ctx.luckysheet_select_save;
|
|
1349
1389
|
if (!activeSheetFile || !selectedRanges) return;
|
|
1350
1390
|
var sheetData = activeSheetFile.data;
|
|
1351
1391
|
var rowCount = sheetData.length;
|
|
1352
1392
|
selectedRanges.forEach(function (_a) {
|
|
1393
|
+
var _b;
|
|
1353
1394
|
var columnRange = _a.column;
|
|
1354
1395
|
var startColumn = columnRange[0],
|
|
1355
1396
|
endColumn = columnRange[1];
|
|
@@ -1359,7 +1400,23 @@ function clearColumnsCellsFormat(ctx) {
|
|
|
1359
1400
|
for (var columnIndex = startColumn; columnIndex <= endColumn; columnIndex++) {
|
|
1360
1401
|
if (rowCells[columnIndex] === undefined) continue;
|
|
1361
1402
|
rowCells[columnIndex] = keepOnlyValueParts(rowCells[columnIndex]);
|
|
1403
|
+
var v = (_b = rowCells[columnIndex]) !== null && _b !== void 0 ? _b : null;
|
|
1404
|
+
var key = "".concat(rowIndex, "_").concat(columnIndex);
|
|
1405
|
+
changeMap.set(key, {
|
|
1406
|
+
sheetId: ctx.currentSheetId,
|
|
1407
|
+
path: ["celldata"],
|
|
1408
|
+
key: key,
|
|
1409
|
+
value: {
|
|
1410
|
+
r: rowIndex,
|
|
1411
|
+
c: columnIndex,
|
|
1412
|
+
v: v
|
|
1413
|
+
},
|
|
1414
|
+
type: v == null ? "delete" : "update"
|
|
1415
|
+
});
|
|
1362
1416
|
}
|
|
1363
1417
|
}
|
|
1364
1418
|
});
|
|
1419
|
+
if (((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc) && changeMap.size > 0) {
|
|
1420
|
+
ctx.hooks.updateCellYdoc(Array.from(changeMap.values()));
|
|
1421
|
+
}
|
|
1365
1422
|
}
|
package/lib/modules/comment.js
CHANGED
|
@@ -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
|
|
347
|
-
r =
|
|
348
|
-
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
|
|
359
|
-
r =
|
|
360
|
-
c =
|
|
361
|
-
var comment = (
|
|
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
|
|
531
|
-
resizingId =
|
|
532
|
-
|
|
533
|
-
r =
|
|
534
|
-
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
|
|
604
|
-
movingId =
|
|
605
|
-
|
|
606
|
-
r =
|
|
607
|
-
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) {
|
package/lib/modules/dropCell.js
CHANGED
|
@@ -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) {
|
package/lib/modules/formula.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare class FormulaCache {
|
|
|
20
20
|
rangetosheet?: string;
|
|
21
21
|
rangedrag_column_start?: boolean;
|
|
22
22
|
rangedrag_row_start?: boolean;
|
|
23
|
+
rangeSelectionActive?: boolean | null;
|
|
23
24
|
functionRangeIndex?: number[];
|
|
24
25
|
functionlistMap: any;
|
|
25
26
|
execFunctionExist?: any[];
|
|
@@ -44,8 +45,14 @@ export declare function setCaretPosition(ctx: Context, textDom: HTMLElement, chi
|
|
|
44
45
|
export declare function getrangeseleciton(): ParentNode | ChildNode | null | undefined;
|
|
45
46
|
export declare function rangeHightlightselected(ctx: Context, $editor: HTMLDivElement): void;
|
|
46
47
|
export declare function functionHTMLGenerate(txt: string): string;
|
|
48
|
+
export declare function getLastFormulaRangeIndex($editor: HTMLDivElement): number | null;
|
|
49
|
+
export declare function getFormulaRangeIndexAtCaret($editor: HTMLDivElement): number | null;
|
|
50
|
+
export declare function markRangeSelectionDirty(ctx: Context): void;
|
|
51
|
+
export declare function getFormulaRangeIndexForKeyboardSync($editor: HTMLDivElement): number | null;
|
|
47
52
|
export declare function handleFormulaInput(ctx: Context, $copyTo: HTMLDivElement | null | undefined, $editor: HTMLDivElement, kcode: number, preText?: string, refreshRangeSelect?: boolean): void;
|
|
48
53
|
export declare function israngeseleciton(ctx: Context, istooltip?: boolean): boolean;
|
|
54
|
+
export declare function isFormulaReferenceInputMode(ctx: Context): boolean;
|
|
55
|
+
export declare function maybeRecoverDirtyRangeSelection(ctx: Context): boolean;
|
|
49
56
|
export declare function functionStrChange(txt: string, type: string, rc: "row" | "col", orient: string | null, stindex: number, step: number): string;
|
|
50
57
|
export declare function rangeSetValue(ctx: Context, cellInput: HTMLDivElement, selected: any, fxInput?: HTMLDivElement | null): void;
|
|
51
58
|
export declare function onFormulaRangeDragEnd(ctx: Context): void;
|