@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
package/es/locale/en.d.ts
CHANGED
|
@@ -530,6 +530,8 @@ declare const _default: {
|
|
|
530
530
|
conditionformat_equal_title: string;
|
|
531
531
|
conditionformat_textContains: string;
|
|
532
532
|
conditionformat_textContains_title: string;
|
|
533
|
+
conditionformat_empty: string;
|
|
534
|
+
conditionformat_empty_title: string;
|
|
533
535
|
conditionformat_occurrenceDate: string;
|
|
534
536
|
conditionformat_occurrenceDate_title: string;
|
|
535
537
|
conditionformat_duplicateValue: string;
|
|
@@ -633,6 +635,7 @@ declare const _default: {
|
|
|
633
635
|
between2: string;
|
|
634
636
|
contain: string;
|
|
635
637
|
textContains: string;
|
|
638
|
+
empty: string;
|
|
636
639
|
duplicateValue: string;
|
|
637
640
|
uniqueValue: string;
|
|
638
641
|
top: string;
|
package/es/locale/en.js
CHANGED
|
@@ -9628,6 +9628,8 @@ export default {
|
|
|
9628
9628
|
conditionformat_equal_title: "Format cells equal to",
|
|
9629
9629
|
conditionformat_textContains: "Conditional format - Text Contains",
|
|
9630
9630
|
conditionformat_textContains_title: "Format cells containing the following text",
|
|
9631
|
+
conditionformat_empty: "Conditional format - Empty",
|
|
9632
|
+
conditionformat_empty_title: "Format cells that are empty",
|
|
9631
9633
|
conditionformat_occurrenceDate: "Conditional format - Occurrence Date",
|
|
9632
9634
|
conditionformat_occurrenceDate_title: "Format cells containing the following dates",
|
|
9633
9635
|
conditionformat_duplicateValue: "Conditional format - Duplicate Value",
|
|
@@ -9731,6 +9733,7 @@ export default {
|
|
|
9731
9733
|
between2: "",
|
|
9732
9734
|
contain: "Contain",
|
|
9733
9735
|
textContains: "Text contains",
|
|
9736
|
+
empty: "Empty",
|
|
9734
9737
|
duplicateValue: "Duplicate value",
|
|
9735
9738
|
uniqueValue: "Unique value",
|
|
9736
9739
|
top: "Top",
|
package/es/locale/es.d.ts
CHANGED
|
@@ -688,6 +688,8 @@ declare const _default: {
|
|
|
688
688
|
conditionformat_equal_title: string;
|
|
689
689
|
conditionformat_textContains: string;
|
|
690
690
|
conditionformat_textContains_title: string;
|
|
691
|
+
conditionformat_empty: string;
|
|
692
|
+
conditionformat_empty_title: string;
|
|
691
693
|
conditionformat_occurrenceDate: string;
|
|
692
694
|
conditionformat_occurrenceDate_title: string;
|
|
693
695
|
conditionformat_duplicateValue: string;
|
|
@@ -789,6 +791,7 @@ declare const _default: {
|
|
|
789
791
|
between2: string;
|
|
790
792
|
contain: string;
|
|
791
793
|
textContains: string;
|
|
794
|
+
empty: string;
|
|
792
795
|
duplicateValue: string;
|
|
793
796
|
uniqueValue: string;
|
|
794
797
|
top: string;
|
package/es/locale/es.js
CHANGED
|
@@ -9565,6 +9565,8 @@ export default {
|
|
|
9565
9565
|
conditionformat_equal_title: "Dar formato a celdas iguales a",
|
|
9566
9566
|
conditionformat_textContains: "Conditionformat-TextContains",
|
|
9567
9567
|
conditionformat_textContains_title: "Dar formato a las celdas que contienen el siguiente texto",
|
|
9568
|
+
conditionformat_empty: "Conditional format - Empty",
|
|
9569
|
+
conditionformat_empty_title: "Dar formato a las celdas vacías",
|
|
9568
9570
|
conditionformat_occurrenceDate: "Conditionformat-OccurrenceDate",
|
|
9569
9571
|
conditionformat_occurrenceDate_title: "Dar formato a celdas que contienen las siguientes fechas",
|
|
9570
9572
|
conditionformat_duplicateValue: "Conditionformat-DuplicateValue",
|
|
@@ -9666,6 +9668,7 @@ export default {
|
|
|
9666
9668
|
between2: "",
|
|
9667
9669
|
contain: "Contiene",
|
|
9668
9670
|
textContains: "Texto contiene",
|
|
9671
|
+
empty: "Vacío",
|
|
9669
9672
|
duplicateValue: "Valor duplicado",
|
|
9670
9673
|
uniqueValue: "Valor Unico",
|
|
9671
9674
|
top: "Mejor",
|
package/es/locale/hi.d.ts
CHANGED
|
@@ -563,6 +563,8 @@ declare const _default: {
|
|
|
563
563
|
conditionformat_equal_title: string;
|
|
564
564
|
conditionformat_textContains: string;
|
|
565
565
|
conditionformat_textContains_title: string;
|
|
566
|
+
conditionformat_empty: string;
|
|
567
|
+
conditionformat_empty_title: string;
|
|
566
568
|
conditionformat_occurrenceDate: string;
|
|
567
569
|
conditionformat_occurrenceDate_title: string;
|
|
568
570
|
conditionformat_duplicateValue: string;
|
|
@@ -664,6 +666,7 @@ declare const _default: {
|
|
|
664
666
|
between2: string;
|
|
665
667
|
contain: string;
|
|
666
668
|
textContains: string;
|
|
669
|
+
empty: string;
|
|
667
670
|
duplicateValue: string;
|
|
668
671
|
uniqueValue: string;
|
|
669
672
|
top: string;
|
package/es/locale/hi.js
CHANGED
|
@@ -10078,6 +10078,8 @@ export default {
|
|
|
10078
10078
|
conditionformat_equal_title: "के बराबर कोशिकाओं को प्रारूपित करें",
|
|
10079
10079
|
conditionformat_textContains: "Conditionformat-TextContains",
|
|
10080
10080
|
conditionformat_textContains_title: "निम्नलिखित पाठ वाली कोशिकाओं को प्रारूपित करें",
|
|
10081
|
+
conditionformat_empty: "Conditional format - Empty",
|
|
10082
|
+
conditionformat_empty_title: "खाली कोशिकाओं को प्रारूपित करें",
|
|
10081
10083
|
conditionformat_occurrenceDate: "Conditionformat-OccurrenceDate",
|
|
10082
10084
|
conditionformat_occurrenceDate_title: "निम्नलिखित तिथियों वाली कोशिकाओं को प्रारूपित करें",
|
|
10083
10085
|
conditionformat_duplicateValue: "Conditionformat-DuplicateValue",
|
|
@@ -10179,6 +10181,7 @@ export default {
|
|
|
10179
10181
|
between2: "",
|
|
10180
10182
|
contain: "शामिल",
|
|
10181
10183
|
textContains: "पाठ शामिल है",
|
|
10184
|
+
empty: "खाली",
|
|
10182
10185
|
duplicateValue: "डुप्लिकेट मान",
|
|
10183
10186
|
uniqueValue: "अद्वितीय मान",
|
|
10184
10187
|
top: "शीर्ष",
|
package/es/locale/index.d.ts
CHANGED
|
@@ -583,6 +583,8 @@ declare function locale(ctx: Context): {
|
|
|
583
583
|
conditionformat_equal_title: string;
|
|
584
584
|
conditionformat_textContains: string;
|
|
585
585
|
conditionformat_textContains_title: string;
|
|
586
|
+
conditionformat_empty: string;
|
|
587
|
+
conditionformat_empty_title: string;
|
|
586
588
|
conditionformat_occurrenceDate: string;
|
|
587
589
|
conditionformat_occurrenceDate_title: string;
|
|
588
590
|
conditionformat_duplicateValue: string;
|
|
@@ -685,6 +687,7 @@ declare function locale(ctx: Context): {
|
|
|
685
687
|
between2: string;
|
|
686
688
|
contain: string;
|
|
687
689
|
textContains: string;
|
|
690
|
+
empty: string;
|
|
688
691
|
duplicateValue: string;
|
|
689
692
|
uniqueValue: string;
|
|
690
693
|
top: string;
|
package/es/locale/zh.d.ts
CHANGED
|
@@ -582,6 +582,8 @@ declare const _default: {
|
|
|
582
582
|
conditionformat_equal_title: string;
|
|
583
583
|
conditionformat_textContains: string;
|
|
584
584
|
conditionformat_textContains_title: string;
|
|
585
|
+
conditionformat_empty: string;
|
|
586
|
+
conditionformat_empty_title: string;
|
|
585
587
|
conditionformat_occurrenceDate: string;
|
|
586
588
|
conditionformat_occurrenceDate_title: string;
|
|
587
589
|
conditionformat_duplicateValue: string;
|
|
@@ -684,6 +686,7 @@ declare const _default: {
|
|
|
684
686
|
between2: string;
|
|
685
687
|
contain: string;
|
|
686
688
|
textContains: string;
|
|
689
|
+
empty: string;
|
|
687
690
|
duplicateValue: string;
|
|
688
691
|
uniqueValue: string;
|
|
689
692
|
top: string;
|
package/es/locale/zh.js
CHANGED
|
@@ -10097,6 +10097,8 @@ export default {
|
|
|
10097
10097
|
conditionformat_equal_title: "为等于以下值的单元格设置格式",
|
|
10098
10098
|
conditionformat_textContains: "条件格式——文本包含",
|
|
10099
10099
|
conditionformat_textContains_title: "为包含以下文本的单元格设置格式",
|
|
10100
|
+
conditionformat_empty: "条件格式——空值",
|
|
10101
|
+
conditionformat_empty_title: "为空单元格设置格式",
|
|
10100
10102
|
conditionformat_occurrenceDate: "条件格式——发生日期",
|
|
10101
10103
|
conditionformat_occurrenceDate_title: "为包含以下日期的单元格设置格式",
|
|
10102
10104
|
conditionformat_duplicateValue: "条件格式——重复值",
|
|
@@ -10199,6 +10201,7 @@ export default {
|
|
|
10199
10201
|
between2: "之间",
|
|
10200
10202
|
contain: "包含",
|
|
10201
10203
|
textContains: "文本包含",
|
|
10204
|
+
empty: "空值",
|
|
10202
10205
|
duplicateValue: "重复值",
|
|
10203
10206
|
uniqueValue: "唯一值",
|
|
10204
10207
|
top: "前",
|
package/es/locale/zh_tw.d.ts
CHANGED
|
@@ -726,6 +726,8 @@ declare const _default: {
|
|
|
726
726
|
conditionformat_equal_title: string;
|
|
727
727
|
conditionformat_textContains: string;
|
|
728
728
|
conditionformat_textContains_title: string;
|
|
729
|
+
conditionformat_empty: string;
|
|
730
|
+
conditionformat_empty_title: string;
|
|
729
731
|
conditionformat_occurrenceDate: string;
|
|
730
732
|
conditionformat_occurrenceDate_title: string;
|
|
731
733
|
conditionformat_duplicateValue: string;
|
|
@@ -828,6 +830,7 @@ declare const _default: {
|
|
|
828
830
|
between2: string;
|
|
829
831
|
contain: string;
|
|
830
832
|
textContains: string;
|
|
833
|
+
empty: string;
|
|
831
834
|
duplicateValue: string;
|
|
832
835
|
uniqueValue: string;
|
|
833
836
|
top: string;
|
package/es/locale/zh_tw.js
CHANGED
|
@@ -9612,6 +9612,8 @@ export default {
|
|
|
9612
9612
|
conditionformat_equal_title: "為等於以下值的儲存格設定格式",
|
|
9613
9613
|
conditionformat_textContains: "條件格式——文字包含",
|
|
9614
9614
|
conditionformat_textContains_title: "為包含以下文字的儲存格設定格式",
|
|
9615
|
+
conditionformat_empty: "條件格式——空值",
|
|
9616
|
+
conditionformat_empty_title: "為空儲存格設定格式",
|
|
9615
9617
|
conditionformat_occurrenceDate: "條件格式——發生日期",
|
|
9616
9618
|
conditionformat_occurrenceDate_title: "為包含以下日期的儲存格設定格式",
|
|
9617
9619
|
conditionformat_duplicateValue: "條件格式——重複值",
|
|
@@ -9714,6 +9716,7 @@ export default {
|
|
|
9714
9716
|
between2: "之間",
|
|
9715
9717
|
contain: "包含",
|
|
9716
9718
|
textContains: "文字包含",
|
|
9719
|
+
empty: "空值",
|
|
9717
9720
|
duplicateValue: "重複值",
|
|
9718
9721
|
uniqueValue: "唯一值",
|
|
9719
9722
|
top: "前",
|
|
@@ -691,6 +691,32 @@ export function compute(ctx, ruleArr, d) {
|
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
693
|
}
|
|
694
|
+
} else if (conditionName === "empty") {
|
|
695
|
+
for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
|
|
696
|
+
for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
|
|
697
|
+
var cell = _.isNil(d[r]) || _.isNil(d[r][c]) ? null : d[r][c];
|
|
698
|
+
var isEmpty = _.isNil(cell) || _.isNil(cell.v) || isRealNull(cell.v);
|
|
699
|
+
if (isEmpty) {
|
|
700
|
+
if ("".concat(r, "_").concat(c) in computeMap) {
|
|
701
|
+
computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
|
|
702
|
+
computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
|
|
703
|
+
computeMap["".concat(r, "_").concat(c)].bold = bold_1;
|
|
704
|
+
computeMap["".concat(r, "_").concat(c)].italic = italic_1;
|
|
705
|
+
computeMap["".concat(r, "_").concat(c)].underline = underline_1;
|
|
706
|
+
computeMap["".concat(r, "_").concat(c)].strikethrough = strikethrough_1;
|
|
707
|
+
} else {
|
|
708
|
+
computeMap["".concat(r, "_").concat(c)] = {
|
|
709
|
+
textColor: textColor_1,
|
|
710
|
+
cellColor: cellColor_1,
|
|
711
|
+
bold: bold_1,
|
|
712
|
+
italic: italic_1,
|
|
713
|
+
underline: underline_1,
|
|
714
|
+
strikethrough: strikethrough_1
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
}
|
|
694
720
|
} else if (conditionName === "between") {
|
|
695
721
|
for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
|
|
696
722
|
for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
|
package/es/modules/cell.js
CHANGED
|
@@ -809,7 +809,7 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
809
809
|
var newValue_1 = _.cloneDeep(d[r][c]);
|
|
810
810
|
setTimeout(function () {
|
|
811
811
|
var _a, _b;
|
|
812
|
-
return (_b = (_a = ctx.hooks).afterUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c,
|
|
812
|
+
return (_b = (_a = ctx.hooks).afterUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, oldValue_1, newValue_1);
|
|
813
813
|
});
|
|
814
814
|
}
|
|
815
815
|
ctx.formulaCache.execFunctionGlobalData = null;
|
|
@@ -1262,13 +1262,16 @@ function keepOnlyValueParts(cell) {
|
|
|
1262
1262
|
} : null;
|
|
1263
1263
|
}
|
|
1264
1264
|
export function clearSelectedCellFormat(ctx) {
|
|
1265
|
+
var _a;
|
|
1265
1266
|
var activeSheetIndex = getSheetIndex(ctx, ctx.currentSheetId);
|
|
1266
1267
|
if (activeSheetIndex == null) return;
|
|
1268
|
+
var changeMap = new Map();
|
|
1267
1269
|
var activeSheetFile = ctx.luckysheetfile[activeSheetIndex];
|
|
1268
1270
|
var selectedRanges = ctx.luckysheet_select_save;
|
|
1269
1271
|
if (!activeSheetFile || !selectedRanges) return;
|
|
1270
1272
|
var sheetData = activeSheetFile.data;
|
|
1271
1273
|
selectedRanges.forEach(function (_a) {
|
|
1274
|
+
var _b;
|
|
1272
1275
|
var rowRange = _a.row,
|
|
1273
1276
|
columnRange = _a.column;
|
|
1274
1277
|
var startRow = rowRange[0],
|
|
@@ -1281,20 +1284,38 @@ export function clearSelectedCellFormat(ctx) {
|
|
|
1281
1284
|
for (var columnIndex = startColumn; columnIndex <= endColumn; columnIndex++) {
|
|
1282
1285
|
if (rowCells[columnIndex] === undefined) continue;
|
|
1283
1286
|
rowCells[columnIndex] = keepOnlyValueParts(rowCells[columnIndex]);
|
|
1287
|
+
var v = (_b = rowCells[columnIndex]) !== null && _b !== void 0 ? _b : null;
|
|
1288
|
+
var key = "".concat(rowIndex, "_").concat(columnIndex);
|
|
1289
|
+
changeMap.set(key, {
|
|
1290
|
+
sheetId: ctx.currentSheetId,
|
|
1291
|
+
path: ["celldata"],
|
|
1292
|
+
key: key,
|
|
1293
|
+
value: {
|
|
1294
|
+
r: rowIndex,
|
|
1295
|
+
c: columnIndex,
|
|
1296
|
+
v: v
|
|
1297
|
+
},
|
|
1298
|
+
type: v == null ? "delete" : "update"
|
|
1299
|
+
});
|
|
1284
1300
|
}
|
|
1285
1301
|
}
|
|
1286
1302
|
});
|
|
1303
|
+
if (((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc) && changeMap.size > 0) {
|
|
1304
|
+
ctx.hooks.updateCellYdoc(Array.from(changeMap.values()));
|
|
1305
|
+
}
|
|
1287
1306
|
}
|
|
1288
1307
|
export function clearRowsCellsFormat(ctx) {
|
|
1289
|
-
var _a, _b;
|
|
1308
|
+
var _a, _b, _c;
|
|
1290
1309
|
var activeSheetIndex = getSheetIndex(ctx, ctx.currentSheetId);
|
|
1291
1310
|
if (activeSheetIndex == null) return;
|
|
1311
|
+
var changeMap = new Map();
|
|
1292
1312
|
var activeSheetFile = ctx.luckysheetfile[activeSheetIndex];
|
|
1293
1313
|
var selectedRanges = ctx.luckysheet_select_save;
|
|
1294
1314
|
if (!activeSheetFile || !selectedRanges) return;
|
|
1295
1315
|
var sheetData = activeSheetFile.data;
|
|
1296
1316
|
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;
|
|
1297
1317
|
selectedRanges.forEach(function (_a) {
|
|
1318
|
+
var _b;
|
|
1298
1319
|
var rowRange = _a.row;
|
|
1299
1320
|
var startRow = rowRange[0],
|
|
1300
1321
|
endRow = rowRange[1];
|
|
@@ -1304,19 +1325,38 @@ export function clearRowsCellsFormat(ctx) {
|
|
|
1304
1325
|
for (var columnIndex = 0; columnIndex < columnCount; columnIndex++) {
|
|
1305
1326
|
if (rowCells[columnIndex] === undefined) continue;
|
|
1306
1327
|
rowCells[columnIndex] = keepOnlyValueParts(rowCells[columnIndex]);
|
|
1328
|
+
var v = (_b = rowCells[columnIndex]) !== null && _b !== void 0 ? _b : null;
|
|
1329
|
+
var key = "".concat(rowIndex, "_").concat(columnIndex);
|
|
1330
|
+
changeMap.set(key, {
|
|
1331
|
+
sheetId: ctx.currentSheetId,
|
|
1332
|
+
path: ["celldata"],
|
|
1333
|
+
key: key,
|
|
1334
|
+
value: {
|
|
1335
|
+
r: rowIndex,
|
|
1336
|
+
c: columnIndex,
|
|
1337
|
+
v: v
|
|
1338
|
+
},
|
|
1339
|
+
type: v == null ? "delete" : "update"
|
|
1340
|
+
});
|
|
1307
1341
|
}
|
|
1308
1342
|
}
|
|
1309
1343
|
});
|
|
1344
|
+
if (((_c = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _c === void 0 ? void 0 : _c.updateCellYdoc) && changeMap.size > 0) {
|
|
1345
|
+
ctx.hooks.updateCellYdoc(Array.from(changeMap.values()));
|
|
1346
|
+
}
|
|
1310
1347
|
}
|
|
1311
1348
|
export function clearColumnsCellsFormat(ctx) {
|
|
1349
|
+
var _a;
|
|
1312
1350
|
var activeSheetIndex = getSheetIndex(ctx, ctx.currentSheetId);
|
|
1313
1351
|
if (activeSheetIndex == null) return;
|
|
1352
|
+
var changeMap = new Map();
|
|
1314
1353
|
var activeSheetFile = ctx.luckysheetfile[activeSheetIndex];
|
|
1315
1354
|
var selectedRanges = ctx.luckysheet_select_save;
|
|
1316
1355
|
if (!activeSheetFile || !selectedRanges) return;
|
|
1317
1356
|
var sheetData = activeSheetFile.data;
|
|
1318
1357
|
var rowCount = sheetData.length;
|
|
1319
1358
|
selectedRanges.forEach(function (_a) {
|
|
1359
|
+
var _b;
|
|
1320
1360
|
var columnRange = _a.column;
|
|
1321
1361
|
var startColumn = columnRange[0],
|
|
1322
1362
|
endColumn = columnRange[1];
|
|
@@ -1326,7 +1366,23 @@ export function clearColumnsCellsFormat(ctx) {
|
|
|
1326
1366
|
for (var columnIndex = startColumn; columnIndex <= endColumn; columnIndex++) {
|
|
1327
1367
|
if (rowCells[columnIndex] === undefined) continue;
|
|
1328
1368
|
rowCells[columnIndex] = keepOnlyValueParts(rowCells[columnIndex]);
|
|
1369
|
+
var v = (_b = rowCells[columnIndex]) !== null && _b !== void 0 ? _b : null;
|
|
1370
|
+
var key = "".concat(rowIndex, "_").concat(columnIndex);
|
|
1371
|
+
changeMap.set(key, {
|
|
1372
|
+
sheetId: ctx.currentSheetId,
|
|
1373
|
+
path: ["celldata"],
|
|
1374
|
+
key: key,
|
|
1375
|
+
value: {
|
|
1376
|
+
r: rowIndex,
|
|
1377
|
+
c: columnIndex,
|
|
1378
|
+
v: v
|
|
1379
|
+
},
|
|
1380
|
+
type: v == null ? "delete" : "update"
|
|
1381
|
+
});
|
|
1329
1382
|
}
|
|
1330
1383
|
}
|
|
1331
1384
|
});
|
|
1385
|
+
if (((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc) && changeMap.size > 0) {
|
|
1386
|
+
ctx.hooks.updateCellYdoc(Array.from(changeMap.values()));
|
|
1387
|
+
}
|
|
1332
1388
|
}
|
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) {
|