@fileverse-dev/fortune-core 1.3.10 → 1.3.11-mixed
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/api/range.js +20 -0
- package/es/api/sheet.js +30 -2
- package/es/events/keyboard.js +74 -37
- package/es/events/mouse.js +1 -0
- package/es/events/paste.js +124 -56
- package/es/locale/en.d.ts +3 -0
- package/es/locale/en.js +3 -0
- package/es/locale/es.d.ts +3 -0
- package/es/locale/es.js +3 -0
- package/es/locale/hi.d.ts +3 -0
- package/es/locale/hi.js +3 -0
- package/es/locale/index.d.ts +3 -0
- package/es/locale/zh.d.ts +3 -0
- package/es/locale/zh.js +3 -0
- package/es/locale/zh_tw.d.ts +3 -0
- package/es/locale/zh_tw.js +3 -0
- package/es/modules/ConditionFormat.js +26 -0
- 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/format.js +12 -7
- 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/modules/validation.js +6 -3
- package/es/settings.d.ts +5 -0
- package/es/types.d.ts +2 -0
- package/lib/api/range.js +20 -0
- package/lib/api/sheet.js +29 -1
- package/lib/events/keyboard.js +74 -37
- package/lib/events/mouse.js +1 -0
- package/lib/events/paste.js +122 -54
- package/lib/locale/en.d.ts +3 -0
- package/lib/locale/en.js +3 -0
- package/lib/locale/es.d.ts +3 -0
- package/lib/locale/es.js +3 -0
- package/lib/locale/hi.d.ts +3 -0
- package/lib/locale/hi.js +3 -0
- package/lib/locale/index.d.ts +3 -0
- package/lib/locale/zh.d.ts +3 -0
- package/lib/locale/zh.js +3 -0
- package/lib/locale/zh_tw.d.ts +3 -0
- package/lib/locale/zh_tw.js +3 -0
- package/lib/modules/ConditionFormat.js +26 -0
- 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/format.js +12 -7
- 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/modules/validation.js +6 -3
- package/lib/settings.d.ts +5 -0
- package/lib/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -257,7 +257,7 @@ export function onSearchDialogMoveEnd(globalCache) {
|
|
|
257
257
|
_.set(globalCache, "searchDialog.moveProps", undefined);
|
|
258
258
|
}
|
|
259
259
|
export function replace(ctx, searchText, replaceText, checkModes) {
|
|
260
|
-
var _a, _b;
|
|
260
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
261
261
|
var findAndReplace = locale(ctx).findAndReplace;
|
|
262
262
|
var allowEdit = isAllowEdit(ctx);
|
|
263
263
|
if (!allowEdit) {
|
|
@@ -304,6 +304,19 @@ export function replace(ctx, searchText, replaceText, checkModes) {
|
|
|
304
304
|
c = searchIndexArr[count].c;
|
|
305
305
|
var v = replaceText;
|
|
306
306
|
setCellValue(ctx, r, c, d, v);
|
|
307
|
+
if ((_c = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _c === void 0 ? void 0 : _c.updateCellYdoc) {
|
|
308
|
+
ctx.hooks.updateCellYdoc([{
|
|
309
|
+
sheetId: ctx.currentSheetId,
|
|
310
|
+
path: ["celldata"],
|
|
311
|
+
value: {
|
|
312
|
+
r: r,
|
|
313
|
+
c: c,
|
|
314
|
+
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
|
|
315
|
+
},
|
|
316
|
+
key: "".concat(r, "_").concat(c),
|
|
317
|
+
type: "update"
|
|
318
|
+
}]);
|
|
319
|
+
}
|
|
307
320
|
} else {
|
|
308
321
|
var reg = void 0;
|
|
309
322
|
if (checkModes.caseCheck) {
|
|
@@ -315,6 +328,19 @@ export function replace(ctx, searchText, replaceText, checkModes) {
|
|
|
315
328
|
c = searchIndexArr[count].c;
|
|
316
329
|
var v = valueShowEs(r, c, d).toString().replace(reg, replaceText);
|
|
317
330
|
setCellValue(ctx, r, c, d, v);
|
|
331
|
+
if ((_f = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _f === void 0 ? void 0 : _f.updateCellYdoc) {
|
|
332
|
+
ctx.hooks.updateCellYdoc([{
|
|
333
|
+
sheetId: ctx.currentSheetId,
|
|
334
|
+
path: ["celldata"],
|
|
335
|
+
value: {
|
|
336
|
+
r: r,
|
|
337
|
+
c: c,
|
|
338
|
+
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
|
|
339
|
+
},
|
|
340
|
+
key: "".concat(r, "_").concat(c),
|
|
341
|
+
type: "update"
|
|
342
|
+
}]);
|
|
343
|
+
}
|
|
318
344
|
}
|
|
319
345
|
ctx.luckysheet_select_save = normalizeSelection(ctx, [{
|
|
320
346
|
row: [r, r],
|
|
@@ -324,7 +350,7 @@ export function replace(ctx, searchText, replaceText, checkModes) {
|
|
|
324
350
|
return null;
|
|
325
351
|
}
|
|
326
352
|
export function replaceAll(ctx, searchText, replaceText, checkModes) {
|
|
327
|
-
var _a;
|
|
353
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
328
354
|
var findAndReplace = locale(ctx).findAndReplace;
|
|
329
355
|
var allowEdit = isAllowEdit(ctx);
|
|
330
356
|
if (!allowEdit) {
|
|
@@ -348,6 +374,7 @@ export function replaceAll(ctx, searchText, replaceText, checkModes) {
|
|
|
348
374
|
return findAndReplace.noReplceTip;
|
|
349
375
|
}
|
|
350
376
|
var d = flowdata;
|
|
377
|
+
var cellChanges = [];
|
|
351
378
|
var replaceCount = 0;
|
|
352
379
|
if (checkModes.wordCheck) {
|
|
353
380
|
for (var i = 0; i < searchIndexArr.length; i += 1) {
|
|
@@ -355,6 +382,19 @@ export function replaceAll(ctx, searchText, replaceText, checkModes) {
|
|
|
355
382
|
var c = searchIndexArr[i].c;
|
|
356
383
|
var v = replaceText;
|
|
357
384
|
setCellValue(ctx, r, c, d, v);
|
|
385
|
+
if ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _b === void 0 ? void 0 : _b.updateCellYdoc) {
|
|
386
|
+
cellChanges.push({
|
|
387
|
+
sheetId: ctx.currentSheetId,
|
|
388
|
+
path: ["celldata"],
|
|
389
|
+
value: {
|
|
390
|
+
r: r,
|
|
391
|
+
c: c,
|
|
392
|
+
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
|
|
393
|
+
},
|
|
394
|
+
key: "".concat(r, "_").concat(c),
|
|
395
|
+
type: "update"
|
|
396
|
+
});
|
|
397
|
+
}
|
|
358
398
|
range.push({
|
|
359
399
|
row: [r, r],
|
|
360
400
|
column: [c, c]
|
|
@@ -373,6 +413,19 @@ export function replaceAll(ctx, searchText, replaceText, checkModes) {
|
|
|
373
413
|
var c = searchIndexArr[i].c;
|
|
374
414
|
var v = valueShowEs(r, c, d).toString().replace(reg, replaceText);
|
|
375
415
|
setCellValue(ctx, r, c, d, v);
|
|
416
|
+
if ((_e = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _e === void 0 ? void 0 : _e.updateCellYdoc) {
|
|
417
|
+
cellChanges.push({
|
|
418
|
+
sheetId: ctx.currentSheetId,
|
|
419
|
+
path: ["celldata"],
|
|
420
|
+
value: {
|
|
421
|
+
r: r,
|
|
422
|
+
c: c,
|
|
423
|
+
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
|
|
424
|
+
},
|
|
425
|
+
key: "".concat(r, "_").concat(c),
|
|
426
|
+
type: "update"
|
|
427
|
+
});
|
|
428
|
+
}
|
|
376
429
|
range.push({
|
|
377
430
|
row: [r, r],
|
|
378
431
|
column: [c, c]
|
|
@@ -380,6 +433,9 @@ export function replaceAll(ctx, searchText, replaceText, checkModes) {
|
|
|
380
433
|
replaceCount += 1;
|
|
381
434
|
}
|
|
382
435
|
}
|
|
436
|
+
if (cellChanges.length > 0 && ((_h = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _h === void 0 ? void 0 : _h.updateCellYdoc)) {
|
|
437
|
+
ctx.hooks.updateCellYdoc(cellChanges);
|
|
438
|
+
}
|
|
383
439
|
ctx.luckysheet_select_save = normalizeSelection(ctx, range);
|
|
384
440
|
var succeedInfo = replaceHtml(findAndReplace.successTip, {
|
|
385
441
|
xlength: replaceCount
|
package/es/modules/selection.js
CHANGED
|
@@ -180,7 +180,7 @@ export function selectTitlesRange(map) {
|
|
|
180
180
|
return rangeArr;
|
|
181
181
|
}
|
|
182
182
|
export function pasteHandlerOfPaintModel(ctx, copyRange) {
|
|
183
|
-
var _a;
|
|
183
|
+
var _a, _b, _c;
|
|
184
184
|
var cfg = ctx.config;
|
|
185
185
|
if (cfg.merge == null) {
|
|
186
186
|
cfg.merge = {};
|
|
@@ -219,6 +219,7 @@ export function pasteHandlerOfPaintModel(ctx, copyRange) {
|
|
|
219
219
|
var timesC = Math.ceil((maxc - minc + 1) / copyc);
|
|
220
220
|
var flowdata = getFlowdata(ctx);
|
|
221
221
|
if (flowdata == null) return;
|
|
222
|
+
var cellChanges = [];
|
|
222
223
|
var cellMaxLength = flowdata[0].length;
|
|
223
224
|
var rowMaxLength = flowdata.length;
|
|
224
225
|
var borderInfoCompute = getBorderInfoCompute(ctx, copySheetIndex);
|
|
@@ -356,6 +357,17 @@ export function pasteHandlerOfPaintModel(ctx, copyRange) {
|
|
|
356
357
|
}
|
|
357
358
|
}
|
|
358
359
|
}
|
|
360
|
+
cellChanges.push({
|
|
361
|
+
sheetId: ctx.currentSheetId,
|
|
362
|
+
path: ["celldata"],
|
|
363
|
+
value: {
|
|
364
|
+
r: h,
|
|
365
|
+
c: c,
|
|
366
|
+
v: (_a = x[c]) !== null && _a !== void 0 ? _a : null
|
|
367
|
+
},
|
|
368
|
+
key: "".concat(h, "_").concat(c),
|
|
369
|
+
type: "update"
|
|
370
|
+
});
|
|
359
371
|
};
|
|
360
372
|
for (var c = mtc; c < maxcellCahe; c += 1) {
|
|
361
373
|
_loop_2(c);
|
|
@@ -368,6 +380,9 @@ export function pasteHandlerOfPaintModel(ctx, copyRange) {
|
|
|
368
380
|
}
|
|
369
381
|
}
|
|
370
382
|
}
|
|
383
|
+
if (cellChanges.length > 0 && ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _b === void 0 ? void 0 : _b.updateCellYdoc)) {
|
|
384
|
+
ctx.hooks.updateCellYdoc(cellChanges);
|
|
385
|
+
}
|
|
371
386
|
var currFile = ctx.luckysheetfile[getSheetIndex(ctx, ctx.currentSheetId)];
|
|
372
387
|
currFile.config = cfg;
|
|
373
388
|
if (dataVerification != null) {
|
|
@@ -379,7 +394,7 @@ export function pasteHandlerOfPaintModel(ctx, copyRange) {
|
|
|
379
394
|
if (!_.isNil(ruleArr) && ruleArr.length > 0) {
|
|
380
395
|
var currentIndex = getSheetIndex(ctx, ctx.currentSheetId);
|
|
381
396
|
var existingCf = ctx.luckysheetfile[currentIndex].luckysheet_conditionformat_save;
|
|
382
|
-
var cdformat = (
|
|
397
|
+
var cdformat = (_c = _.cloneDeep(existingCf)) !== null && _c !== void 0 ? _c : [];
|
|
383
398
|
for (var i = 0; i < ruleArr.length; i += 1) {
|
|
384
399
|
var cdformat_cellrange = ruleArr[i].cellrange;
|
|
385
400
|
var emptyRange = [];
|
|
@@ -1501,7 +1516,7 @@ export function copy(ctx) {
|
|
|
1501
1516
|
}
|
|
1502
1517
|
}
|
|
1503
1518
|
export function deleteSelectedCellText(ctx) {
|
|
1504
|
-
var _a, _b, _c, _d;
|
|
1519
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1505
1520
|
var allowEdit = isAllowEdit(ctx);
|
|
1506
1521
|
if (allowEdit === false || ctx.isFlvReadOnly) {
|
|
1507
1522
|
return "allowEdit";
|
|
@@ -1564,22 +1579,30 @@ export function deleteSelectedCellText(ctx) {
|
|
|
1564
1579
|
if ((_d = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _d === void 0 ? void 0 : _d.afterUpdateCell) {
|
|
1565
1580
|
ctx.hooks.afterUpdateCell(r, c, null, d[r][c]);
|
|
1566
1581
|
}
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1582
|
+
if (!((_e = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _e === void 0 ? void 0 : _e.afterUpdateCell)) {
|
|
1583
|
+
changes.push({
|
|
1584
|
+
sheetId: ctx.currentSheetId,
|
|
1585
|
+
path: ["celldata"],
|
|
1586
|
+
value: {
|
|
1587
|
+
r: r,
|
|
1588
|
+
c: c,
|
|
1589
|
+
v: d[r][c]
|
|
1590
|
+
},
|
|
1591
|
+
key: "".concat(r, "_").concat(c),
|
|
1592
|
+
type: "update"
|
|
1593
|
+
});
|
|
1594
|
+
}
|
|
1576
1595
|
}
|
|
1577
1596
|
}
|
|
1597
|
+
if (changes.length > 0 && ((_f = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _f === void 0 ? void 0 : _f.updateCellYdoc)) {
|
|
1598
|
+
ctx.hooks.updateCellYdoc(changes);
|
|
1599
|
+
}
|
|
1578
1600
|
}
|
|
1579
1601
|
}
|
|
1580
1602
|
return "success";
|
|
1581
1603
|
}
|
|
1582
1604
|
export function deleteSelectedCellFormat(ctx) {
|
|
1605
|
+
var _a;
|
|
1583
1606
|
var allowEdit = isAllowEdit(ctx);
|
|
1584
1607
|
if (allowEdit === false) {
|
|
1585
1608
|
return "allowEdit";
|
|
@@ -1602,6 +1625,7 @@ export function deleteSelectedCellFormat(ctx) {
|
|
|
1602
1625
|
if (has_PartMC) {
|
|
1603
1626
|
return "partMC";
|
|
1604
1627
|
}
|
|
1628
|
+
var cellChanges = [];
|
|
1605
1629
|
for (var s = 0; s < selection.length; s += 1) {
|
|
1606
1630
|
var r1 = selection[s].row[0];
|
|
1607
1631
|
var r2 = selection[s].row[1];
|
|
@@ -1620,16 +1644,30 @@ export function deleteSelectedCellFormat(ctx) {
|
|
|
1620
1644
|
delete cell.bg;
|
|
1621
1645
|
delete cell.tb;
|
|
1622
1646
|
}
|
|
1647
|
+
cellChanges.push({
|
|
1648
|
+
sheetId: ctx.currentSheetId,
|
|
1649
|
+
path: ["celldata"],
|
|
1650
|
+
value: {
|
|
1651
|
+
r: r,
|
|
1652
|
+
c: c,
|
|
1653
|
+
v: d[r][c]
|
|
1654
|
+
},
|
|
1655
|
+
key: "".concat(r, "_").concat(c),
|
|
1656
|
+
type: "update"
|
|
1657
|
+
});
|
|
1623
1658
|
}
|
|
1624
1659
|
}
|
|
1625
1660
|
}
|
|
1626
1661
|
}
|
|
1662
|
+
if (cellChanges.length > 0 && ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc)) {
|
|
1663
|
+
ctx.hooks.updateCellYdoc(cellChanges);
|
|
1664
|
+
}
|
|
1627
1665
|
}
|
|
1628
1666
|
return "success";
|
|
1629
1667
|
}
|
|
1630
1668
|
export function fillRightData(ctx) {
|
|
1631
1669
|
var _a, _b, _c, _d;
|
|
1632
|
-
var _e, _f, _g;
|
|
1670
|
+
var _e, _f, _g, _h;
|
|
1633
1671
|
var allowEdit = isAllowEdit(ctx);
|
|
1634
1672
|
if (allowEdit === false) {
|
|
1635
1673
|
return "allowEdit";
|
|
@@ -1652,6 +1690,7 @@ export function fillRightData(ctx) {
|
|
|
1652
1690
|
if (has_PartMC) {
|
|
1653
1691
|
return "partMC";
|
|
1654
1692
|
}
|
|
1693
|
+
var cellChanges = [];
|
|
1655
1694
|
for (var s = 0; s < selection.length; s += 1) {
|
|
1656
1695
|
var r1 = selection[s].row[0];
|
|
1657
1696
|
var r2 = selection[s].row[1];
|
|
@@ -1669,19 +1708,23 @@ export function fillRightData(ctx) {
|
|
|
1669
1708
|
var srcCol = c1 - 1;
|
|
1670
1709
|
var prev = d[r1][c1 - 1];
|
|
1671
1710
|
d[r1][c1] = prev != null ? __assign({}, prev) : {};
|
|
1711
|
+
cellChanges.push({
|
|
1712
|
+
sheetId: ctx.currentSheetId,
|
|
1713
|
+
path: ["celldata"],
|
|
1714
|
+
value: {
|
|
1715
|
+
r: r1,
|
|
1716
|
+
c: c1,
|
|
1717
|
+
v: d[r1][c1]
|
|
1718
|
+
},
|
|
1719
|
+
key: "".concat(r1, "_").concat(c1),
|
|
1720
|
+
type: "update"
|
|
1721
|
+
});
|
|
1672
1722
|
if (file != null) {
|
|
1673
1723
|
var srcKey = "".concat(srcRow, "_").concat(srcCol);
|
|
1674
1724
|
var tgtKey = "".concat(r1, "_").concat(c1);
|
|
1675
1725
|
if (dataVerification != null) {
|
|
1676
1726
|
var dv = dataVerification[srcKey];
|
|
1677
1727
|
if (dv != null) {
|
|
1678
|
-
console.log("[fillRightData] dataVerification copy from", {
|
|
1679
|
-
row: srcRow,
|
|
1680
|
-
col: srcCol
|
|
1681
|
-
}, "→", {
|
|
1682
|
-
row: r1,
|
|
1683
|
-
col: c1
|
|
1684
|
-
}, dv);
|
|
1685
1728
|
file.dataVerification = __assign(__assign({}, file.dataVerification || {}), (_a = {}, _a[tgtKey] = _.cloneDeep(dv), _a));
|
|
1686
1729
|
}
|
|
1687
1730
|
}
|
|
@@ -1718,6 +1761,17 @@ export function fillRightData(ctx) {
|
|
|
1718
1761
|
for (var c = c1 + 1; c <= c2; c += 1) {
|
|
1719
1762
|
if (d[r]) {
|
|
1720
1763
|
d[r][c] = sourceCell != null ? __assign({}, sourceCell) : (_f = d[r][c]) !== null && _f !== void 0 ? _f : {};
|
|
1764
|
+
cellChanges.push({
|
|
1765
|
+
sheetId: ctx.currentSheetId,
|
|
1766
|
+
path: ["celldata"],
|
|
1767
|
+
value: {
|
|
1768
|
+
r: r,
|
|
1769
|
+
c: c,
|
|
1770
|
+
v: d[r][c]
|
|
1771
|
+
},
|
|
1772
|
+
key: "".concat(r, "_").concat(c),
|
|
1773
|
+
type: "update"
|
|
1774
|
+
});
|
|
1721
1775
|
}
|
|
1722
1776
|
if (file != null) {
|
|
1723
1777
|
var srcKey = "".concat(r, "_").concat(c1);
|
|
@@ -1725,13 +1779,6 @@ export function fillRightData(ctx) {
|
|
|
1725
1779
|
if (dataVerification != null) {
|
|
1726
1780
|
var dv = dataVerification[srcKey];
|
|
1727
1781
|
if (dv != null) {
|
|
1728
|
-
console.log("[fillRightData] dataVerification copy from", {
|
|
1729
|
-
row: r,
|
|
1730
|
-
col: c1
|
|
1731
|
-
}, "→", {
|
|
1732
|
-
row: r,
|
|
1733
|
-
col: c
|
|
1734
|
-
}, dv);
|
|
1735
1782
|
file.dataVerification = __assign(__assign({}, file.dataVerification || {}), (_c = {}, _c[tgtKey] = _.cloneDeep(dv), _c));
|
|
1736
1783
|
}
|
|
1737
1784
|
}
|
|
@@ -1765,12 +1812,15 @@ export function fillRightData(ctx) {
|
|
|
1765
1812
|
}
|
|
1766
1813
|
}
|
|
1767
1814
|
}
|
|
1815
|
+
if (cellChanges.length > 0 && ((_h = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _h === void 0 ? void 0 : _h.updateCellYdoc)) {
|
|
1816
|
+
ctx.hooks.updateCellYdoc(cellChanges);
|
|
1817
|
+
}
|
|
1768
1818
|
}
|
|
1769
1819
|
return "success";
|
|
1770
1820
|
}
|
|
1771
1821
|
export function fillDownData(ctx) {
|
|
1772
1822
|
var _a, _b, _c, _d;
|
|
1773
|
-
var _e, _f, _g;
|
|
1823
|
+
var _e, _f, _g, _h;
|
|
1774
1824
|
var allowEdit = isAllowEdit(ctx);
|
|
1775
1825
|
if (allowEdit === false) {
|
|
1776
1826
|
return "allowEdit";
|
|
@@ -1793,6 +1843,7 @@ export function fillDownData(ctx) {
|
|
|
1793
1843
|
if (has_PartMC) {
|
|
1794
1844
|
return "partMC";
|
|
1795
1845
|
}
|
|
1846
|
+
var cellChanges = [];
|
|
1796
1847
|
for (var s = 0; s < selection.length; s += 1) {
|
|
1797
1848
|
var r1 = selection[s].row[0];
|
|
1798
1849
|
var r2 = selection[s].row[1];
|
|
@@ -1811,19 +1862,23 @@ export function fillDownData(ctx) {
|
|
|
1811
1862
|
var prev = d[r1 - 1][c1];
|
|
1812
1863
|
if (!d[r1]) d[r1] = [];
|
|
1813
1864
|
d[r1][c1] = prev != null ? __assign({}, prev) : {};
|
|
1865
|
+
cellChanges.push({
|
|
1866
|
+
sheetId: ctx.currentSheetId,
|
|
1867
|
+
path: ["celldata"],
|
|
1868
|
+
value: {
|
|
1869
|
+
r: r1,
|
|
1870
|
+
c: c1,
|
|
1871
|
+
v: d[r1][c1]
|
|
1872
|
+
},
|
|
1873
|
+
key: "".concat(r1, "_").concat(c1),
|
|
1874
|
+
type: "update"
|
|
1875
|
+
});
|
|
1814
1876
|
if (file != null) {
|
|
1815
1877
|
var srcKey = "".concat(srcRow, "_").concat(srcCol);
|
|
1816
1878
|
var tgtKey = "".concat(r1, "_").concat(c1);
|
|
1817
1879
|
if (dataVerification != null) {
|
|
1818
1880
|
var dv = dataVerification[srcKey];
|
|
1819
1881
|
if (dv != null) {
|
|
1820
|
-
console.log("[fillDownData] dataVerification copy from", {
|
|
1821
|
-
row: srcRow,
|
|
1822
|
-
col: srcCol
|
|
1823
|
-
}, "→", {
|
|
1824
|
-
row: r1,
|
|
1825
|
-
col: c1
|
|
1826
|
-
}, dv);
|
|
1827
1882
|
file.dataVerification = __assign(__assign({}, file.dataVerification || {}), (_a = {}, _a[tgtKey] = _.cloneDeep(dv), _a));
|
|
1828
1883
|
}
|
|
1829
1884
|
}
|
|
@@ -1860,19 +1915,23 @@ export function fillDownData(ctx) {
|
|
|
1860
1915
|
for (var r = r1 + 1; r <= r2; r += 1) {
|
|
1861
1916
|
if (!d[r]) d[r] = [];
|
|
1862
1917
|
d[r][c] = sourceCell != null ? __assign({}, sourceCell) : (_f = d[r][c]) !== null && _f !== void 0 ? _f : {};
|
|
1918
|
+
cellChanges.push({
|
|
1919
|
+
sheetId: ctx.currentSheetId,
|
|
1920
|
+
path: ["celldata"],
|
|
1921
|
+
value: {
|
|
1922
|
+
r: r,
|
|
1923
|
+
c: c,
|
|
1924
|
+
v: d[r][c]
|
|
1925
|
+
},
|
|
1926
|
+
key: "".concat(r, "_").concat(c),
|
|
1927
|
+
type: "update"
|
|
1928
|
+
});
|
|
1863
1929
|
if (file != null) {
|
|
1864
1930
|
var srcKey = "".concat(r1, "_").concat(c);
|
|
1865
1931
|
var tgtKey = "".concat(r, "_").concat(c);
|
|
1866
1932
|
if (dataVerification != null) {
|
|
1867
1933
|
var dv = dataVerification[srcKey];
|
|
1868
1934
|
if (dv != null) {
|
|
1869
|
-
console.log("[fillDownData] dataVerification copy from", {
|
|
1870
|
-
row: r1,
|
|
1871
|
-
col: c
|
|
1872
|
-
}, "→", {
|
|
1873
|
-
row: r,
|
|
1874
|
-
col: c
|
|
1875
|
-
}, dv);
|
|
1876
1935
|
file.dataVerification = __assign(__assign({}, file.dataVerification || {}), (_c = {}, _c[tgtKey] = _.cloneDeep(dv), _c));
|
|
1877
1936
|
}
|
|
1878
1937
|
}
|
|
@@ -1906,10 +1965,14 @@ export function fillDownData(ctx) {
|
|
|
1906
1965
|
}
|
|
1907
1966
|
}
|
|
1908
1967
|
}
|
|
1968
|
+
if (cellChanges.length > 0 && ((_h = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _h === void 0 ? void 0 : _h.updateCellYdoc)) {
|
|
1969
|
+
ctx.hooks.updateCellYdoc(cellChanges);
|
|
1970
|
+
}
|
|
1909
1971
|
}
|
|
1910
1972
|
return "success";
|
|
1911
1973
|
}
|
|
1912
1974
|
export function textFormat(ctx, type) {
|
|
1975
|
+
var _a;
|
|
1913
1976
|
var allowEdit = isAllowEdit(ctx);
|
|
1914
1977
|
if (allowEdit === false) {
|
|
1915
1978
|
return "allowEdit";
|
|
@@ -1918,6 +1981,7 @@ export function textFormat(ctx, type) {
|
|
|
1918
1981
|
if (selection && !_.isEmpty(selection)) {
|
|
1919
1982
|
var d = getFlowdata(ctx);
|
|
1920
1983
|
if (!d) return "dataNullError";
|
|
1984
|
+
var cellChanges = [];
|
|
1921
1985
|
var has_PartMC = false;
|
|
1922
1986
|
for (var s = 0; s < selection.length; s += 1) {
|
|
1923
1987
|
var r1 = selection[s].row[0];
|
|
@@ -1951,14 +2015,29 @@ export function textFormat(ctx, type) {
|
|
|
1951
2015
|
cell.tb = "1";
|
|
1952
2016
|
cell.ht = 2;
|
|
1953
2017
|
}
|
|
2018
|
+
cellChanges.push({
|
|
2019
|
+
sheetId: ctx.currentSheetId,
|
|
2020
|
+
path: ["celldata"],
|
|
2021
|
+
value: {
|
|
2022
|
+
r: r,
|
|
2023
|
+
c: c,
|
|
2024
|
+
v: d[r][c]
|
|
2025
|
+
},
|
|
2026
|
+
key: "".concat(r, "_").concat(c),
|
|
2027
|
+
type: "update"
|
|
2028
|
+
});
|
|
1954
2029
|
}
|
|
1955
2030
|
}
|
|
1956
2031
|
}
|
|
1957
2032
|
}
|
|
2033
|
+
if (cellChanges.length > 0 && ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc)) {
|
|
2034
|
+
ctx.hooks.updateCellYdoc(cellChanges);
|
|
2035
|
+
}
|
|
1958
2036
|
}
|
|
1959
2037
|
return "success";
|
|
1960
2038
|
}
|
|
1961
2039
|
export function fillDate(ctx) {
|
|
2040
|
+
var _a;
|
|
1962
2041
|
var allowEdit = isAllowEdit(ctx);
|
|
1963
2042
|
if (allowEdit === false) {
|
|
1964
2043
|
return "allowEdit";
|
|
@@ -1967,6 +2046,7 @@ export function fillDate(ctx) {
|
|
|
1967
2046
|
if (selection && !_.isEmpty(selection)) {
|
|
1968
2047
|
var d = getFlowdata(ctx);
|
|
1969
2048
|
if (!d) return "dataNullError";
|
|
2049
|
+
var cellChanges = [];
|
|
1970
2050
|
var has_PartMC = false;
|
|
1971
2051
|
for (var s = 0; s < selection.length; s += 1) {
|
|
1972
2052
|
var r1 = selection[s].row[0];
|
|
@@ -1993,13 +2073,28 @@ export function fillDate(ctx) {
|
|
|
1993
2073
|
d[r][c] = {
|
|
1994
2074
|
v: formattedDate
|
|
1995
2075
|
};
|
|
2076
|
+
cellChanges.push({
|
|
2077
|
+
sheetId: ctx.currentSheetId,
|
|
2078
|
+
path: ["celldata"],
|
|
2079
|
+
value: {
|
|
2080
|
+
r: r,
|
|
2081
|
+
c: c,
|
|
2082
|
+
v: d[r][c]
|
|
2083
|
+
},
|
|
2084
|
+
key: "".concat(r, "_").concat(c),
|
|
2085
|
+
type: "update"
|
|
2086
|
+
});
|
|
1996
2087
|
}
|
|
1997
2088
|
}
|
|
1998
2089
|
}
|
|
2090
|
+
if (cellChanges.length > 0 && ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc)) {
|
|
2091
|
+
ctx.hooks.updateCellYdoc(cellChanges);
|
|
2092
|
+
}
|
|
1999
2093
|
}
|
|
2000
2094
|
return "success";
|
|
2001
2095
|
}
|
|
2002
2096
|
export function fillTime(ctx) {
|
|
2097
|
+
var _a;
|
|
2003
2098
|
var allowEdit = isAllowEdit(ctx);
|
|
2004
2099
|
if (allowEdit === false) {
|
|
2005
2100
|
return "allowEdit";
|
|
@@ -2008,6 +2103,7 @@ export function fillTime(ctx) {
|
|
|
2008
2103
|
if (selection && !_.isEmpty(selection)) {
|
|
2009
2104
|
var d = getFlowdata(ctx);
|
|
2010
2105
|
if (!d) return "dataNullError";
|
|
2106
|
+
var cellChanges = [];
|
|
2011
2107
|
var has_PartMC = false;
|
|
2012
2108
|
for (var s = 0; s < selection.length; s += 1) {
|
|
2013
2109
|
var r1 = selection[s].row[0];
|
|
@@ -2034,9 +2130,23 @@ export function fillTime(ctx) {
|
|
|
2034
2130
|
d[r][c] = {
|
|
2035
2131
|
v: formattedTime
|
|
2036
2132
|
};
|
|
2133
|
+
cellChanges.push({
|
|
2134
|
+
sheetId: ctx.currentSheetId,
|
|
2135
|
+
path: ["celldata"],
|
|
2136
|
+
value: {
|
|
2137
|
+
r: r,
|
|
2138
|
+
c: c,
|
|
2139
|
+
v: d[r][c]
|
|
2140
|
+
},
|
|
2141
|
+
key: "".concat(r, "_").concat(c),
|
|
2142
|
+
type: "update"
|
|
2143
|
+
});
|
|
2037
2144
|
}
|
|
2038
2145
|
}
|
|
2039
2146
|
}
|
|
2147
|
+
if (cellChanges.length > 0 && ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc)) {
|
|
2148
|
+
ctx.hooks.updateCellYdoc(cellChanges);
|
|
2149
|
+
}
|
|
2040
2150
|
}
|
|
2041
2151
|
return "success";
|
|
2042
2152
|
}
|
package/es/modules/sort.js
CHANGED
|
@@ -68,6 +68,7 @@ export function orderbydata(isAsc, index, data) {
|
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
export function sortDataRange(ctx, sheetData, dataRange, index, isAsc, str, edr, stc, edc) {
|
|
71
|
+
var _a, _b;
|
|
71
72
|
var sortedData = orderbydata(isAsc, index, dataRange).sortedData;
|
|
72
73
|
for (var r = str; r <= edr; r += 1) {
|
|
73
74
|
for (var c = stc; c <= edc; c += 1) {
|
|
@@ -79,6 +80,26 @@ export function sortDataRange(ctx, sheetData, dataRange, index, isAsc, str, edr,
|
|
|
79
80
|
row: [str, edr],
|
|
80
81
|
column: [stc, edc]
|
|
81
82
|
}]);
|
|
83
|
+
if ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc) {
|
|
84
|
+
var changes = [];
|
|
85
|
+
for (var r = str; r <= edr; r += 1) {
|
|
86
|
+
var row = sheetData[r] || [];
|
|
87
|
+
for (var c = stc; c <= edc; c += 1) {
|
|
88
|
+
changes.push({
|
|
89
|
+
sheetId: ctx.currentSheetId,
|
|
90
|
+
path: ["celldata"],
|
|
91
|
+
value: {
|
|
92
|
+
r: r,
|
|
93
|
+
c: c,
|
|
94
|
+
v: (_b = row === null || row === void 0 ? void 0 : row[c]) !== null && _b !== void 0 ? _b : null
|
|
95
|
+
},
|
|
96
|
+
key: "".concat(r, "_").concat(c),
|
|
97
|
+
type: "update"
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (changes.length > 0) ctx.hooks.updateCellYdoc(changes);
|
|
102
|
+
}
|
|
82
103
|
}
|
|
83
104
|
export function sortSelection(ctx, isAsc, colIndex) {
|
|
84
105
|
var _a;
|
|
@@ -143,35 +164,57 @@ export function sortSelection(ctx, isAsc, colIndex) {
|
|
|
143
164
|
sortDataRange(ctx, d, data, colIndex, isAsc, str, edr, c1, c2);
|
|
144
165
|
}
|
|
145
166
|
function createRowsOrColumnsForSpilledValues(ctx, startRow, startColumn, spillRows, spillCols) {
|
|
167
|
+
var _a, _b;
|
|
146
168
|
var flowdata = getFlowdata(ctx);
|
|
147
169
|
if (!flowdata) return;
|
|
170
|
+
var cellChanges = [];
|
|
148
171
|
try {
|
|
149
172
|
var sheetIndex = getSheetIndex(ctx, ctx.currentSheetId);
|
|
150
173
|
var sheet = ctx.luckysheetfile[sheetIndex];
|
|
151
|
-
var
|
|
152
|
-
var
|
|
153
|
-
if (sheet.row && sheet.row <
|
|
154
|
-
sheet.row =
|
|
174
|
+
var requiredRowCount_1 = startRow + spillRows;
|
|
175
|
+
var requiredColCount_1 = startColumn + spillCols;
|
|
176
|
+
if (sheet.row && sheet.row < requiredRowCount_1) {
|
|
177
|
+
sheet.row = requiredRowCount_1;
|
|
155
178
|
}
|
|
156
|
-
if (sheet.column && sheet.column <
|
|
157
|
-
sheet.column =
|
|
179
|
+
if (sheet.column && sheet.column < requiredColCount_1) {
|
|
180
|
+
sheet.column = requiredColCount_1;
|
|
158
181
|
}
|
|
159
182
|
} catch (error) {
|
|
160
183
|
console.error("Failed to update sheet metadata for spill operation", error);
|
|
161
184
|
}
|
|
162
|
-
|
|
185
|
+
var requiredRowCount = startRow + spillRows;
|
|
186
|
+
var requiredColCount = startColumn + spillCols;
|
|
187
|
+
while (flowdata.length < requiredRowCount) {
|
|
163
188
|
flowdata.push([]);
|
|
164
189
|
}
|
|
165
|
-
for (var rowIndex = startRow; rowIndex <
|
|
190
|
+
for (var rowIndex = startRow; rowIndex < requiredRowCount; rowIndex++) {
|
|
166
191
|
if (!Array.isArray(flowdata[rowIndex])) {
|
|
167
192
|
flowdata[rowIndex] = [];
|
|
168
193
|
}
|
|
169
|
-
|
|
194
|
+
var prevLen = flowdata[rowIndex].length;
|
|
195
|
+
while (flowdata[rowIndex].length < requiredColCount) {
|
|
170
196
|
flowdata[rowIndex].push(null);
|
|
171
197
|
}
|
|
198
|
+
for (var c = Math.max(prevLen, startColumn); c < requiredColCount; c += 1) {
|
|
199
|
+
cellChanges.push({
|
|
200
|
+
sheetId: ctx.currentSheetId,
|
|
201
|
+
path: ["celldata"],
|
|
202
|
+
value: {
|
|
203
|
+
r: rowIndex,
|
|
204
|
+
c: c,
|
|
205
|
+
v: (_a = flowdata[rowIndex][c]) !== null && _a !== void 0 ? _a : null
|
|
206
|
+
},
|
|
207
|
+
key: "".concat(rowIndex, "_").concat(c),
|
|
208
|
+
type: "update"
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (cellChanges.length > 0 && ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _b === void 0 ? void 0 : _b.updateCellYdoc)) {
|
|
213
|
+
ctx.hooks.updateCellYdoc(cellChanges);
|
|
172
214
|
}
|
|
173
215
|
}
|
|
174
216
|
export function spillSortResult(ctx, startRow, startCol, formulaResult, flowdata) {
|
|
217
|
+
var _a, _b;
|
|
175
218
|
var formulaString = formulaResult === null || formulaResult === void 0 ? void 0 : formulaResult.f;
|
|
176
219
|
var formulaValue = formulaResult === null || formulaResult === void 0 ? void 0 : formulaResult.v;
|
|
177
220
|
if (typeof formulaString !== "string" || !(/= *SORT\s*\(/i.test(formulaString) || /= *XLOOKUP\s*\(/i.test(formulaString) || /= *SEQUENCE\s*\(/i.test(formulaString))) return false;
|
|
@@ -203,5 +246,27 @@ export function spillSortResult(ctx, startRow, startCol, formulaResult, flowdata
|
|
|
203
246
|
});
|
|
204
247
|
}
|
|
205
248
|
}
|
|
249
|
+
if ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc) {
|
|
250
|
+
var cellChanges = [];
|
|
251
|
+
for (var r = 0; r < rowCount; r += 1) {
|
|
252
|
+
var rr = startRow + r;
|
|
253
|
+
var row = (sheetData === null || sheetData === void 0 ? void 0 : sheetData[rr]) || [];
|
|
254
|
+
for (var c = 0; c < colCount; c += 1) {
|
|
255
|
+
var cc = startCol + c;
|
|
256
|
+
cellChanges.push({
|
|
257
|
+
sheetId: ctx.currentSheetId,
|
|
258
|
+
path: ["celldata"],
|
|
259
|
+
value: {
|
|
260
|
+
r: rr,
|
|
261
|
+
c: cc,
|
|
262
|
+
v: (_b = row === null || row === void 0 ? void 0 : row[cc]) !== null && _b !== void 0 ? _b : null
|
|
263
|
+
},
|
|
264
|
+
key: "".concat(rr, "_").concat(cc),
|
|
265
|
+
type: "update"
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (cellChanges.length > 0) ctx.hooks.updateCellYdoc(cellChanges);
|
|
270
|
+
}
|
|
206
271
|
return true;
|
|
207
272
|
}
|
|
@@ -13,14 +13,35 @@ export function getNullData(rlen, clen) {
|
|
|
13
13
|
return arr;
|
|
14
14
|
}
|
|
15
15
|
export function updateMoreCell(r, c, dataMatrix, ctx) {
|
|
16
|
+
var _a;
|
|
16
17
|
if (ctx.allowEdit === false) return;
|
|
17
18
|
var flowdata = getFlowdata(ctx);
|
|
19
|
+
var cellChanges = [];
|
|
18
20
|
dataMatrix.forEach(function (datas, i) {
|
|
19
21
|
datas.forEach(function (data, j) {
|
|
22
|
+
var _a, _b, _c;
|
|
20
23
|
var v = dataMatrix[i][j];
|
|
21
24
|
setCellValue(ctx, r + i, c + j, flowdata, v);
|
|
25
|
+
if ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc) {
|
|
26
|
+
var rr = r + i;
|
|
27
|
+
var cc = c + j;
|
|
28
|
+
cellChanges.push({
|
|
29
|
+
sheetId: ctx.currentSheetId,
|
|
30
|
+
path: ["celldata"],
|
|
31
|
+
value: {
|
|
32
|
+
r: rr,
|
|
33
|
+
c: cc,
|
|
34
|
+
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
|
|
35
|
+
},
|
|
36
|
+
key: "".concat(rr, "_").concat(cc),
|
|
37
|
+
type: "update"
|
|
38
|
+
});
|
|
39
|
+
}
|
|
22
40
|
});
|
|
23
41
|
});
|
|
42
|
+
if (cellChanges.length > 0 && ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc)) {
|
|
43
|
+
ctx.hooks.updateCellYdoc(cellChanges);
|
|
44
|
+
}
|
|
24
45
|
}
|
|
25
46
|
export function getRegStr(regStr, splitSymbols) {
|
|
26
47
|
regStr = "";
|