@fileverse-dev/fortune-core 1.3.10-yjs-4 → 1.3.10-yjs-6
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 +28 -1
- package/es/events/paste.js +23 -19
- package/es/modules/dataVerification.js +34 -1
- package/es/modules/dropCell.js +60 -44
- package/es/modules/formula.js +14 -0
- package/es/modules/searchReplace.js +58 -2
- package/es/modules/selection.js +15 -13
- package/es/modules/sort.js +23 -0
- package/es/modules/splitColumn.js +21 -0
- package/es/modules/toolbar.js +46 -3
- package/es/settings.d.ts +2 -0
- package/lib/api/range.js +20 -0
- package/lib/api/sheet.js +28 -1
- package/lib/events/paste.js +23 -19
- package/lib/modules/dataVerification.js +34 -1
- package/lib/modules/dropCell.js +60 -44
- package/lib/modules/formula.js +14 -0
- package/lib/modules/searchReplace.js +58 -2
- package/lib/modules/selection.js +15 -13
- package/lib/modules/sort.js +23 -0
- package/lib/modules/splitColumn.js +21 -0
- package/lib/modules/toolbar.js +46 -3
- package/lib/settings.d.ts +2 -0
- package/package.json +1 -1
|
@@ -271,7 +271,7 @@ function onSearchDialogMoveEnd(globalCache) {
|
|
|
271
271
|
_lodash.default.set(globalCache, "searchDialog.moveProps", undefined);
|
|
272
272
|
}
|
|
273
273
|
function replace(ctx, searchText, replaceText, checkModes) {
|
|
274
|
-
var _a, _b;
|
|
274
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
275
275
|
var findAndReplace = (0, _locale.locale)(ctx).findAndReplace;
|
|
276
276
|
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
277
277
|
if (!allowEdit) {
|
|
@@ -318,6 +318,19 @@ function replace(ctx, searchText, replaceText, checkModes) {
|
|
|
318
318
|
c = searchIndexArr[count].c;
|
|
319
319
|
var v = replaceText;
|
|
320
320
|
(0, _cell.setCellValue)(ctx, r, c, d, v);
|
|
321
|
+
if ((_c = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _c === void 0 ? void 0 : _c.updateCellYdoc) {
|
|
322
|
+
ctx.hooks.updateCellYdoc([{
|
|
323
|
+
sheetId: ctx.currentSheetId,
|
|
324
|
+
path: ["celldata"],
|
|
325
|
+
value: {
|
|
326
|
+
r: r,
|
|
327
|
+
c: c,
|
|
328
|
+
v: (_e = (_d = d === null || d === void 0 ? void 0 : d[r]) === null || _d === void 0 ? void 0 : _d[c]) !== null && _e !== void 0 ? _e : null
|
|
329
|
+
},
|
|
330
|
+
key: "".concat(r, "_").concat(c),
|
|
331
|
+
type: "update"
|
|
332
|
+
}]);
|
|
333
|
+
}
|
|
321
334
|
} else {
|
|
322
335
|
var reg = void 0;
|
|
323
336
|
if (checkModes.caseCheck) {
|
|
@@ -329,6 +342,19 @@ function replace(ctx, searchText, replaceText, checkModes) {
|
|
|
329
342
|
c = searchIndexArr[count].c;
|
|
330
343
|
var v = (0, _format.valueShowEs)(r, c, d).toString().replace(reg, replaceText);
|
|
331
344
|
(0, _cell.setCellValue)(ctx, r, c, d, v);
|
|
345
|
+
if ((_f = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _f === void 0 ? void 0 : _f.updateCellYdoc) {
|
|
346
|
+
ctx.hooks.updateCellYdoc([{
|
|
347
|
+
sheetId: ctx.currentSheetId,
|
|
348
|
+
path: ["celldata"],
|
|
349
|
+
value: {
|
|
350
|
+
r: r,
|
|
351
|
+
c: c,
|
|
352
|
+
v: (_h = (_g = d === null || d === void 0 ? void 0 : d[r]) === null || _g === void 0 ? void 0 : _g[c]) !== null && _h !== void 0 ? _h : null
|
|
353
|
+
},
|
|
354
|
+
key: "".concat(r, "_").concat(c),
|
|
355
|
+
type: "update"
|
|
356
|
+
}]);
|
|
357
|
+
}
|
|
332
358
|
}
|
|
333
359
|
ctx.luckysheet_select_save = (0, _selection.normalizeSelection)(ctx, [{
|
|
334
360
|
row: [r, r],
|
|
@@ -338,7 +364,7 @@ function replace(ctx, searchText, replaceText, checkModes) {
|
|
|
338
364
|
return null;
|
|
339
365
|
}
|
|
340
366
|
function replaceAll(ctx, searchText, replaceText, checkModes) {
|
|
341
|
-
var _a;
|
|
367
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
342
368
|
var findAndReplace = (0, _locale.locale)(ctx).findAndReplace;
|
|
343
369
|
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
344
370
|
if (!allowEdit) {
|
|
@@ -362,6 +388,7 @@ function replaceAll(ctx, searchText, replaceText, checkModes) {
|
|
|
362
388
|
return findAndReplace.noReplceTip;
|
|
363
389
|
}
|
|
364
390
|
var d = flowdata;
|
|
391
|
+
var cellChanges = [];
|
|
365
392
|
var replaceCount = 0;
|
|
366
393
|
if (checkModes.wordCheck) {
|
|
367
394
|
for (var i = 0; i < searchIndexArr.length; i += 1) {
|
|
@@ -369,6 +396,19 @@ function replaceAll(ctx, searchText, replaceText, checkModes) {
|
|
|
369
396
|
var c = searchIndexArr[i].c;
|
|
370
397
|
var v = replaceText;
|
|
371
398
|
(0, _cell.setCellValue)(ctx, r, c, d, v);
|
|
399
|
+
if ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _b === void 0 ? void 0 : _b.updateCellYdoc) {
|
|
400
|
+
cellChanges.push({
|
|
401
|
+
sheetId: ctx.currentSheetId,
|
|
402
|
+
path: ["celldata"],
|
|
403
|
+
value: {
|
|
404
|
+
r: r,
|
|
405
|
+
c: c,
|
|
406
|
+
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
|
|
407
|
+
},
|
|
408
|
+
key: "".concat(r, "_").concat(c),
|
|
409
|
+
type: "update"
|
|
410
|
+
});
|
|
411
|
+
}
|
|
372
412
|
range.push({
|
|
373
413
|
row: [r, r],
|
|
374
414
|
column: [c, c]
|
|
@@ -387,6 +427,19 @@ function replaceAll(ctx, searchText, replaceText, checkModes) {
|
|
|
387
427
|
var c = searchIndexArr[i].c;
|
|
388
428
|
var v = (0, _format.valueShowEs)(r, c, d).toString().replace(reg, replaceText);
|
|
389
429
|
(0, _cell.setCellValue)(ctx, r, c, d, v);
|
|
430
|
+
if ((_e = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _e === void 0 ? void 0 : _e.updateCellYdoc) {
|
|
431
|
+
cellChanges.push({
|
|
432
|
+
sheetId: ctx.currentSheetId,
|
|
433
|
+
path: ["celldata"],
|
|
434
|
+
value: {
|
|
435
|
+
r: r,
|
|
436
|
+
c: c,
|
|
437
|
+
v: (_g = (_f = d === null || d === void 0 ? void 0 : d[r]) === null || _f === void 0 ? void 0 : _f[c]) !== null && _g !== void 0 ? _g : null
|
|
438
|
+
},
|
|
439
|
+
key: "".concat(r, "_").concat(c),
|
|
440
|
+
type: "update"
|
|
441
|
+
});
|
|
442
|
+
}
|
|
390
443
|
range.push({
|
|
391
444
|
row: [r, r],
|
|
392
445
|
column: [c, c]
|
|
@@ -394,6 +447,9 @@ function replaceAll(ctx, searchText, replaceText, checkModes) {
|
|
|
394
447
|
replaceCount += 1;
|
|
395
448
|
}
|
|
396
449
|
}
|
|
450
|
+
if (cellChanges.length > 0 && ((_h = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _h === void 0 ? void 0 : _h.updateCellYdoc)) {
|
|
451
|
+
ctx.hooks.updateCellYdoc(cellChanges);
|
|
452
|
+
}
|
|
397
453
|
ctx.luckysheet_select_save = (0, _selection.normalizeSelection)(ctx, range);
|
|
398
454
|
var succeedInfo = (0, _utils.replaceHtml)(findAndReplace.successTip, {
|
|
399
455
|
xlength: replaceCount
|
package/lib/modules/selection.js
CHANGED
|
@@ -1551,7 +1551,7 @@ function copy(ctx) {
|
|
|
1551
1551
|
}
|
|
1552
1552
|
}
|
|
1553
1553
|
function deleteSelectedCellText(ctx) {
|
|
1554
|
-
var _a, _b, _c, _d, _e;
|
|
1554
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1555
1555
|
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
1556
1556
|
if (allowEdit === false || ctx.isFlvReadOnly) {
|
|
1557
1557
|
return "allowEdit";
|
|
@@ -1614,20 +1614,22 @@ function deleteSelectedCellText(ctx) {
|
|
|
1614
1614
|
if ((_d = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _d === void 0 ? void 0 : _d.afterUpdateCell) {
|
|
1615
1615
|
ctx.hooks.afterUpdateCell(r, c, null, d[r][c]);
|
|
1616
1616
|
}
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1617
|
+
if (!((_e = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _e === void 0 ? void 0 : _e.afterUpdateCell)) {
|
|
1618
|
+
changes.push({
|
|
1619
|
+
sheetId: ctx.currentSheetId,
|
|
1620
|
+
path: ["celldata"],
|
|
1621
|
+
value: {
|
|
1622
|
+
r: r,
|
|
1623
|
+
c: c,
|
|
1624
|
+
v: d[r][c]
|
|
1625
|
+
},
|
|
1626
|
+
key: "".concat(r, "_").concat(c),
|
|
1627
|
+
type: "update"
|
|
1628
|
+
});
|
|
1629
|
+
}
|
|
1628
1630
|
}
|
|
1629
1631
|
}
|
|
1630
|
-
if (changes.length > 0 && ((
|
|
1632
|
+
if (changes.length > 0 && ((_f = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _f === void 0 ? void 0 : _f.updateCellYdoc)) {
|
|
1631
1633
|
ctx.hooks.updateCellYdoc(changes);
|
|
1632
1634
|
}
|
|
1633
1635
|
}
|
package/lib/modules/sort.js
CHANGED
|
@@ -224,6 +224,7 @@ function createRowsOrColumnsForSpilledValues(ctx, startRow, startColumn, spillRo
|
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
function spillSortResult(ctx, startRow, startCol, formulaResult, flowdata) {
|
|
227
|
+
var _a, _b;
|
|
227
228
|
var formulaString = formulaResult === null || formulaResult === void 0 ? void 0 : formulaResult.f;
|
|
228
229
|
var formulaValue = formulaResult === null || formulaResult === void 0 ? void 0 : formulaResult.v;
|
|
229
230
|
if (typeof formulaString !== "string" || !(/= *SORT\s*\(/i.test(formulaString) || /= *XLOOKUP\s*\(/i.test(formulaString) || /= *SEQUENCE\s*\(/i.test(formulaString))) return false;
|
|
@@ -255,5 +256,27 @@ function spillSortResult(ctx, startRow, startCol, formulaResult, flowdata) {
|
|
|
255
256
|
});
|
|
256
257
|
}
|
|
257
258
|
}
|
|
259
|
+
if ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc) {
|
|
260
|
+
var cellChanges = [];
|
|
261
|
+
for (var r = 0; r < rowCount; r += 1) {
|
|
262
|
+
var rr = startRow + r;
|
|
263
|
+
var row = (sheetData === null || sheetData === void 0 ? void 0 : sheetData[rr]) || [];
|
|
264
|
+
for (var c = 0; c < colCount; c += 1) {
|
|
265
|
+
var cc = startCol + c;
|
|
266
|
+
cellChanges.push({
|
|
267
|
+
sheetId: ctx.currentSheetId,
|
|
268
|
+
path: ["celldata"],
|
|
269
|
+
value: {
|
|
270
|
+
r: rr,
|
|
271
|
+
c: cc,
|
|
272
|
+
v: (_b = row === null || row === void 0 ? void 0 : row[cc]) !== null && _b !== void 0 ? _b : null
|
|
273
|
+
},
|
|
274
|
+
key: "".concat(rr, "_").concat(cc),
|
|
275
|
+
type: "update"
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (cellChanges.length > 0) ctx.hooks.updateCellYdoc(cellChanges);
|
|
280
|
+
}
|
|
258
281
|
return true;
|
|
259
282
|
}
|
|
@@ -23,14 +23,35 @@ function getNullData(rlen, clen) {
|
|
|
23
23
|
return arr;
|
|
24
24
|
}
|
|
25
25
|
function updateMoreCell(r, c, dataMatrix, ctx) {
|
|
26
|
+
var _a;
|
|
26
27
|
if (ctx.allowEdit === false) return;
|
|
27
28
|
var flowdata = (0, _context.getFlowdata)(ctx);
|
|
29
|
+
var cellChanges = [];
|
|
28
30
|
dataMatrix.forEach(function (datas, i) {
|
|
29
31
|
datas.forEach(function (data, j) {
|
|
32
|
+
var _a, _b, _c;
|
|
30
33
|
var v = dataMatrix[i][j];
|
|
31
34
|
(0, _cell.setCellValue)(ctx, r + i, c + j, flowdata, v);
|
|
35
|
+
if ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc) {
|
|
36
|
+
var rr = r + i;
|
|
37
|
+
var cc = c + j;
|
|
38
|
+
cellChanges.push({
|
|
39
|
+
sheetId: ctx.currentSheetId,
|
|
40
|
+
path: ["celldata"],
|
|
41
|
+
value: {
|
|
42
|
+
r: rr,
|
|
43
|
+
c: cc,
|
|
44
|
+
v: (_c = (_b = flowdata === null || flowdata === void 0 ? void 0 : flowdata[rr]) === null || _b === void 0 ? void 0 : _b[cc]) !== null && _c !== void 0 ? _c : null
|
|
45
|
+
},
|
|
46
|
+
key: "".concat(rr, "_").concat(cc),
|
|
47
|
+
type: "update"
|
|
48
|
+
});
|
|
49
|
+
}
|
|
32
50
|
});
|
|
33
51
|
});
|
|
52
|
+
if (cellChanges.length > 0 && ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc)) {
|
|
53
|
+
ctx.hooks.updateCellYdoc(cellChanges);
|
|
54
|
+
}
|
|
34
55
|
}
|
|
35
56
|
function getRegStr(regStr, splitSymbols) {
|
|
36
57
|
regStr = "";
|
package/lib/modules/toolbar.js
CHANGED
|
@@ -429,7 +429,8 @@ function activeFormulaInput(cellInput, fxInput, ctx, row_index, col_index, rowh,
|
|
|
429
429
|
});
|
|
430
430
|
}
|
|
431
431
|
function backFormulaInput(d, r, c, rowh, columnh, formula, ctx) {
|
|
432
|
-
var _a;
|
|
432
|
+
var _a, _b, _c;
|
|
433
|
+
var _d;
|
|
433
434
|
var f = "=".concat(formula.toUpperCase(), "(").concat((0, _cell.getRangetxt)(ctx, ctx.currentSheetId, {
|
|
434
435
|
row: rowh,
|
|
435
436
|
column: columnh
|
|
@@ -440,7 +441,20 @@ function backFormulaInput(d, r, c, rowh, columnh, formula, ctx) {
|
|
|
440
441
|
f: v[2]
|
|
441
442
|
};
|
|
442
443
|
(0, _cell.setCellValue)(ctx, r, c, d, value);
|
|
443
|
-
(_a = ctx.
|
|
444
|
+
if ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc) {
|
|
445
|
+
ctx.hooks.updateCellYdoc([{
|
|
446
|
+
sheetId: ctx.currentSheetId,
|
|
447
|
+
path: ["celldata"],
|
|
448
|
+
value: {
|
|
449
|
+
r: r,
|
|
450
|
+
c: c,
|
|
451
|
+
v: (_c = (_b = d === null || d === void 0 ? void 0 : d[r]) === null || _b === void 0 ? void 0 : _b[c]) !== null && _c !== void 0 ? _c : null
|
|
452
|
+
},
|
|
453
|
+
key: "".concat(r, "_").concat(c),
|
|
454
|
+
type: "update"
|
|
455
|
+
}]);
|
|
456
|
+
}
|
|
457
|
+
(_d = ctx.formulaCache).execFunctionExist || (_d.execFunctionExist = []);
|
|
444
458
|
ctx.formulaCache.execFunctionExist.push({
|
|
445
459
|
r: r,
|
|
446
460
|
c: c,
|
|
@@ -869,10 +883,12 @@ function handleFormatPainter(ctx) {
|
|
|
869
883
|
ctx.luckysheetPaintSingle = true;
|
|
870
884
|
}
|
|
871
885
|
function handleClearFormat(ctx) {
|
|
872
|
-
var _a;
|
|
886
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
873
887
|
if (ctx.allowEdit === false) return;
|
|
874
888
|
var flowdata = (0, _context.getFlowdata)(ctx);
|
|
875
889
|
if (!flowdata) return;
|
|
890
|
+
var ydocChanges = [];
|
|
891
|
+
var borderInfoChanged = false;
|
|
876
892
|
(_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a.every(function (selection) {
|
|
877
893
|
var _a = selection.row,
|
|
878
894
|
rowSt = _a[0],
|
|
@@ -888,6 +904,17 @@ function handleClearFormat(ctx) {
|
|
|
888
904
|
var cell = flowdata[r][c];
|
|
889
905
|
if (!cell) continue;
|
|
890
906
|
flowdata[r][c] = _lodash.default.pick(cell, "v", "m", "mc", "f", "ct");
|
|
907
|
+
ydocChanges.push({
|
|
908
|
+
sheetId: ctx.currentSheetId,
|
|
909
|
+
path: ["celldata"],
|
|
910
|
+
key: "".concat(r, "_").concat(c),
|
|
911
|
+
value: {
|
|
912
|
+
r: r,
|
|
913
|
+
c: c,
|
|
914
|
+
v: flowdata[r][c]
|
|
915
|
+
},
|
|
916
|
+
type: "update"
|
|
917
|
+
});
|
|
891
918
|
}
|
|
892
919
|
}
|
|
893
920
|
var index = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
|
|
@@ -923,9 +950,25 @@ function handleClearFormat(ctx) {
|
|
|
923
950
|
}
|
|
924
951
|
}
|
|
925
952
|
ctx.luckysheetfile[index].config.borderInfo = source_borderInfo;
|
|
953
|
+
borderInfoChanged = true;
|
|
926
954
|
}
|
|
927
955
|
return true;
|
|
928
956
|
});
|
|
957
|
+
if ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _b === void 0 ? void 0 : _b.updateCellYdoc) {
|
|
958
|
+
if (borderInfoChanged) {
|
|
959
|
+
var index = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
|
|
960
|
+
var borderInfo = index == null ? (_d = (_c = ctx.config) === null || _c === void 0 ? void 0 : _c.borderInfo) !== null && _d !== void 0 ? _d : [] : (_g = (_f = (_e = ctx.luckysheetfile[index]) === null || _e === void 0 ? void 0 : _e.config) === null || _f === void 0 ? void 0 : _f.borderInfo) !== null && _g !== void 0 ? _g : [];
|
|
961
|
+
ydocChanges.push({
|
|
962
|
+
sheetId: ctx.currentSheetId,
|
|
963
|
+
path: ["config", "borderInfo"],
|
|
964
|
+
value: borderInfo,
|
|
965
|
+
type: "update"
|
|
966
|
+
});
|
|
967
|
+
}
|
|
968
|
+
if (ydocChanges.length > 0) {
|
|
969
|
+
ctx.hooks.updateCellYdoc(ydocChanges);
|
|
970
|
+
}
|
|
971
|
+
}
|
|
929
972
|
}
|
|
930
973
|
function handleTextColor(ctx, cellInput, color) {
|
|
931
974
|
setAttr(ctx, cellInput, "fc", color);
|
package/lib/settings.d.ts
CHANGED
|
@@ -79,6 +79,8 @@ export type Hooks = {
|
|
|
79
79
|
afterIframesChange?: () => void;
|
|
80
80
|
afterFrozenChange?: () => void;
|
|
81
81
|
afterOrderChanges?: () => void;
|
|
82
|
+
afterColorChanges?: () => void;
|
|
83
|
+
afterHideChanges?: () => void;
|
|
82
84
|
afterConfigChanges?: () => void;
|
|
83
85
|
afterColRowChanges?: () => void;
|
|
84
86
|
afterShowGridLinesChange?: () => void;
|