@fileverse-dev/fortune-core 1.3.12-copyPaste-4 → 1.3.12-mixed-a

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.
@@ -169,63 +169,72 @@ function moveToEdge(sheetData, key, curr, rowDelta, colDelta, startR, endR, star
169
169
  return colDelta === 0 ? r : c;
170
170
  }
171
171
  function handleControlPlusArrowKey(ctx, e, shiftPressed) {
172
- if (ctx.luckysheetCellUpdate.length > 0) return;
172
+ var _a, _b, _c, _d;
173
173
  var idx = getSheetIndex(ctx, ctx.currentSheetId);
174
174
  if (_.isNil(idx)) return;
175
175
  var file = ctx.luckysheetfile[idx];
176
- if (!file || !file.row || !file.column) return;
177
176
  var maxRow = file.row;
178
177
  var maxCol = file.column;
179
- var last;
180
- if (ctx.luckysheet_select_save && ctx.luckysheet_select_save.length > 0) last = ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1];
178
+ if (_.isNil(maxRow) || _.isNil(maxCol)) return;
179
+ var last = ctx.luckysheet_select_save && ctx.luckysheet_select_save.length > 0 ? ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1] : undefined;
181
180
  if (!last) return;
182
181
  var currR = last.row_focus;
183
182
  var currC = last.column_focus;
184
183
  if (_.isNil(currR) || _.isNil(currC)) return;
185
- var startR = last.row[0];
186
- var endR = last.row[1];
187
- var startC = last.column[0];
188
- var endC = last.column[1];
184
+ var startR = (_a = last.row) === null || _a === void 0 ? void 0 : _a[0];
185
+ var endR = (_b = last.row) === null || _b === void 0 ? void 0 : _b[1];
186
+ var startC = (_c = last.column) === null || _c === void 0 ? void 0 : _c[0];
187
+ var endC = (_d = last.column) === null || _d === void 0 ? void 0 : _d[1];
188
+ if (_.isNil(startR) || _.isNil(endR) || _.isNil(startC) || _.isNil(endC)) {
189
+ return;
190
+ }
189
191
  var horizontalOffset = currC - endC !== 0 ? currC - endC : currC - startC;
190
192
  var verticalOffset = currR - endR !== 0 ? currR - endR : currR - startR;
191
193
  var sheetData = file.data;
192
194
  if (!sheetData) return;
193
- var selectedLimit;
194
195
  switch (e.key) {
195
196
  case "ArrowUp":
196
- selectedLimit = moveToEdge(sheetData, e.key, currC, -1, 0, startR, endR, startC, endC, maxRow, maxCol);
197
- if (shiftPressed) {
198
- moveHighlightRange(ctx, "down", verticalOffset, "rangeOfSelect");
199
- moveHighlightRange(ctx, "down", selectedLimit - currR, "rangeOfSelect");
200
- } else {
201
- moveHighlightCell(ctx, "down", selectedLimit - currR, "rangeOfSelect");
197
+ {
198
+ var selectedLimit = moveToEdge(sheetData, e.key, currC, -1, 0, startR, endR, startC, endC, maxRow, maxCol);
199
+ if (shiftPressed) {
200
+ moveHighlightRange(ctx, "down", verticalOffset, "rangeOfSelect");
201
+ moveHighlightRange(ctx, "down", selectedLimit - currR, "rangeOfSelect");
202
+ } else {
203
+ moveHighlightCell(ctx, "down", selectedLimit - currR, "rangeOfSelect");
204
+ }
202
205
  }
203
206
  break;
204
207
  case "ArrowDown":
205
- selectedLimit = moveToEdge(sheetData, e.key, currC, 1, 0, startR, endR, startC, endC, maxRow, maxCol);
206
- if (shiftPressed) {
207
- moveHighlightRange(ctx, "down", verticalOffset, "rangeOfSelect");
208
- moveHighlightRange(ctx, "down", selectedLimit - currR, "rangeOfSelect");
209
- } else {
210
- moveHighlightCell(ctx, "down", selectedLimit - currR, "rangeOfSelect");
208
+ {
209
+ var selectedLimit = moveToEdge(sheetData, e.key, currC, 1, 0, startR, endR, startC, endC, maxRow, maxCol);
210
+ if (shiftPressed) {
211
+ moveHighlightRange(ctx, "down", verticalOffset, "rangeOfSelect");
212
+ moveHighlightRange(ctx, "down", selectedLimit - currR, "rangeOfSelect");
213
+ } else {
214
+ moveHighlightCell(ctx, "down", selectedLimit - currR, "rangeOfSelect");
215
+ }
211
216
  }
212
217
  break;
213
218
  case "ArrowLeft":
214
- selectedLimit = moveToEdge(sheetData, e.key, currR, 0, -1, startR, endR, startC, endC, maxRow, maxCol);
215
- if (shiftPressed) {
216
- moveHighlightRange(ctx, "right", horizontalOffset, "rangeOfSelect");
217
- moveHighlightRange(ctx, "right", selectedLimit - currC, "rangeOfSelect");
218
- } else {
219
- moveHighlightCell(ctx, "right", selectedLimit - currC, "rangeOfSelect");
219
+ {
220
+ var selectedLimit = moveToEdge(sheetData, e.key, currR, 0, -1, startR, endR, startC, endC, maxRow, maxCol);
221
+ if (shiftPressed) {
222
+ moveHighlightRange(ctx, "right", horizontalOffset, "rangeOfSelect");
223
+ moveHighlightRange(ctx, "right", selectedLimit - currC, "rangeOfSelect");
224
+ } else {
225
+ moveHighlightCell(ctx, "right", selectedLimit - currC, "rangeOfSelect");
226
+ }
220
227
  }
221
228
  break;
222
229
  case "ArrowRight":
223
- selectedLimit = moveToEdge(sheetData, e.key, currR, 0, 1, startR, endR, startC, endC, maxRow, maxCol);
224
- if (shiftPressed) {
225
- moveHighlightRange(ctx, "right", horizontalOffset, "rangeOfSelect");
226
- moveHighlightRange(ctx, "right", selectedLimit - currC, "rangeOfSelect");
227
- } else {
228
- moveHighlightCell(ctx, "right", selectedLimit - currC, "rangeOfSelect");
230
+ {
231
+ var selectedLimit = moveToEdge(sheetData, e.key, currR, 0, 1, startR, endR, startC, endC, maxRow, maxCol);
232
+ if (shiftPressed) {
233
+ moveHighlightRange(ctx, "right", horizontalOffset, "rangeOfSelect");
234
+ moveHighlightRange(ctx, "right", selectedLimit - currC, "rangeOfSelect");
235
+ } else {
236
+ moveHighlightCell(ctx, "right", selectedLimit - currC, "rangeOfSelect");
237
+ }
229
238
  }
230
239
  break;
231
240
  default:
@@ -378,10 +387,10 @@ export function handleArrowKey(ctx, e) {
378
387
  }
379
388
  }
380
389
  export function handleGlobalKeyDown(ctx, cellInput, fxInput, e, cache, handleUndo, handleRedo, canvas) {
381
- var _a, _b, _c;
390
+ var _a, _b, _c, _d;
382
391
  return __awaiter(this, void 0, void 0, function () {
383
- var handledFlvShortcut, kcode, kstr, allowEdit, isFxInput, ignoredKeys, restCod, last, row_index, col_index, last, row_index, col_index;
384
- return __generator(this, function (_d) {
392
+ var handledFlvShortcut, kcode, kstr, allowEdit, isFxInput, ignoredKeys, restCod, last, row_index, col_index, isEditing, inputText, isFormulaEdit, enteredByTyping, last, row_index, col_index;
393
+ return __generator(this, function (_e) {
385
394
  if (e.shiftKey && e.code === "Space") {
386
395
  e.stopImmediatePropagation();
387
396
  e.stopPropagation();
@@ -489,7 +498,18 @@ export function handleGlobalKeyDown(ctx, cellInput, fxInput, e, cache, handleUnd
489
498
  jfrefreshgrid(ctx, null, undefined);
490
499
  e.preventDefault();
491
500
  } else if (kstr === "ArrowUp" || kstr === "ArrowDown" || kstr === "ArrowLeft" || kstr === "ArrowRight") {
492
- handleArrowKey(ctx, e);
501
+ isEditing = ctx.luckysheetCellUpdate.length > 0;
502
+ inputText = (_d = cellInput === null || cellInput === void 0 ? void 0 : cellInput.innerText) !== null && _d !== void 0 ? _d : "";
503
+ isFormulaEdit = isEditing && inputText.trim().startsWith("=");
504
+ enteredByTyping = cache.enteredEditByTyping === true;
505
+ if (isEditing && !isFormulaEdit && enteredByTyping) {
506
+ updateCell(ctx, ctx.luckysheetCellUpdate[0], ctx.luckysheetCellUpdate[1], cellInput, undefined, canvas);
507
+ cache.enteredEditByTyping = false;
508
+ handleArrowKey(ctx, e);
509
+ e.preventDefault();
510
+ } else {
511
+ handleArrowKey(ctx, e);
512
+ }
493
513
  } else if (!(kcode >= 112 && kcode <= 123 || kcode <= 46 || kcode === 144 || kcode === 108 || e.ctrlKey || e.altKey || e.shiftKey && (kcode === 37 || kcode === 38 || kcode === 39 || kcode === 40)) || kcode === 8 || kcode === 32 || kcode === 46 || kcode === 0 || e.ctrlKey && kcode === 86) {
494
514
  if (!allowEdit) return [2];
495
515
  if (String.fromCharCode(kcode) != null && !_.isEmpty(ctx.luckysheet_select_save) && kstr !== "CapsLock" && kstr !== "Win" && kcode !== 18) {
@@ -498,7 +518,10 @@ export function handleGlobalKeyDown(ctx, cellInput, fxInput, e, cache, handleUnd
498
518
  col_index = last.column_focus;
499
519
  ctx.luckysheetCellUpdate = [row_index, col_index];
500
520
  cache.overwriteCell = true;
521
+ cache.overwriteCellFirstChar = e.key;
522
+ cache.enteredEditByTyping = true;
501
523
  handleFormulaInput(ctx, fxInput, cellInput, kcode);
524
+ e.preventDefault();
502
525
  }
503
526
  }
504
527
  }
@@ -487,6 +487,7 @@ export function handleCellAreaDoubleClick(ctx, globalCache, settings, e, contain
487
487
  row_index = row_focus;
488
488
  col_index = column_focus;
489
489
  }
490
+ globalCache.enteredEditByTyping = false;
490
491
  luckysheetUpdateCell(ctx, row_index, col_index);
491
492
  }
492
493
  export function handleContextMenu(ctx, settings, e, workbookContainer, container, area) {
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: "शीर्ष",
@@ -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: "前",
@@ -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;
@@ -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) {
@@ -1041,7 +1041,7 @@ export function getFontStyleByCell(cell, checksAF, checksCF, isCheck) {
1041
1041
  if (key === "it" && valueNum !== 0) {
1042
1042
  style.fontStyle = "italic";
1043
1043
  }
1044
- if (key === "fs" && !_.isNil(value)) {
1044
+ if (key === "fs" && valueNum !== 10) {
1045
1045
  style.fontSize = "".concat(valueNum, "pt");
1046
1046
  }
1047
1047
  if (key === "fc" && value !== "#000000" || ((_a = checksAF === null || checksAF === void 0 ? void 0 : checksAF.length) !== null && _a !== void 0 ? _a : 0) > 0 || (checksCF === null || checksCF === void 0 ? void 0 : checksCF.textColor)) {
@@ -1186,7 +1186,7 @@ export function rangeValueToHtml(ctx, sheetId, ranges) {
1186
1186
  cpdata += "<tr height=".concat(rowLen, "px >");
1187
1187
  var _loop_3 = function _loop_3(j) {
1188
1188
  var c = colIndexArr[j];
1189
- var column = '<td ${span} style="${style}" data-fortune-cell="${cellData}">';
1189
+ var column = '<td ${span} style="${style}">';
1190
1190
  var cell = (_f = d[r]) === null || _f === void 0 ? void 0 : _f[c];
1191
1191
  if (cell != null) {
1192
1192
  var style = "";
@@ -1397,14 +1397,9 @@ export function rangeValueToHtml(ctx, sheetId, ranges) {
1397
1397
  }
1398
1398
  }
1399
1399
  }
1400
- var cellData = encodeURIComponent(JSON.stringify(__assign(__assign({}, cell), {
1401
- _srcRow: r,
1402
- _srcCol: c
1403
- })));
1404
1400
  column = replaceHtml(column, {
1405
1401
  style: style,
1406
- span: span,
1407
- cellData: cellData
1402
+ span: span
1408
1403
  });
1409
1404
  if (_.isNil(c_value)) {
1410
1405
  c_value = getCellValue(r, c, d);
@@ -1454,8 +1449,7 @@ export function rangeValueToHtml(ctx, sheetId, ranges) {
1454
1449
  }
1455
1450
  column = replaceHtml(column, {
1456
1451
  style: style,
1457
- span: "",
1458
- cellData: ""
1452
+ span: ""
1459
1453
  });
1460
1454
  column += "";
1461
1455
  }
@@ -9,20 +9,11 @@ var __assign = this && this.__assign || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- var __rest = this && this.__rest || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
15
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
17
- }
18
- return t;
19
- };
20
12
  import _ from "lodash";
21
13
  import { locale } from "./locale";
22
14
  import { getQKBorder, saveHyperlink } from "./modules";
23
15
  import { getSheetIndex } from "./utils";
24
16
  import { setRowHeight, setColumnWidth } from "./api";
25
- import { adjustFormulaForPaste } from "./events/paste";
26
17
  export var DEFAULT_FONT_SIZE = 12;
27
18
  var parseStylesheetPairs = function parseStylesheetPairs(styleInner) {
28
19
  var patternReg = /{([^}]*)}/g;
@@ -136,28 +127,6 @@ function brToNewline(str) {
136
127
  }
137
128
  var buildCellFromTd = function buildCellFromTd(td, classStyles, ctx) {
138
129
  var _a, _b, _c, _d;
139
- var fortuneCellAttr = td.getAttribute("data-fortune-cell");
140
- if (fortuneCellAttr) {
141
- try {
142
- var _e = JSON.parse(decodeURIComponent(fortuneCellAttr)),
143
- _srcRow = _e._srcRow,
144
- _srcCol = _e._srcCol,
145
- parsed = __rest(_e, ["_srcRow", "_srcCol"]);
146
- var cell_1 = parsed;
147
- delete cell_1.mc;
148
- delete cell_1.hl;
149
- var rowspan_1 = parseInt(td.getAttribute("rowspan") || "1", 10);
150
- var colspan_1 = parseInt(td.getAttribute("colspan") || "1", 10);
151
- return {
152
- cell: cell_1,
153
- rowspan: Number.isNaN(rowspan_1) ? 1 : rowspan_1,
154
- colspan: Number.isNaN(colspan_1) ? 1 : colspan_1,
155
- hyperlink: detectHyperlink(td),
156
- srcRow: _srcRow,
157
- srcCol: _srcCol
158
- };
159
- } catch (_f) {}
160
- }
161
130
  var cell = {};
162
131
  var rawText = (td.innerText || td.innerHTML || "").trim();
163
132
  var isLineBreak = rawText.includes("<br />");
@@ -308,17 +277,10 @@ export function handlePastedTable(ctx, html, pasteHandler) {
308
277
  cell = _a.cell,
309
278
  rowspan = _a.rowspan,
310
279
  colspan = _a.colspan,
311
- hyperlink = _a.hyperlink,
312
- srcRow = _a.srcRow,
313
- srcCol = _a.srcCol;
280
+ hyperlink = _a.hyperlink;
314
281
  var anchorCol = ctx.luckysheet_select_save[0].column[0];
315
282
  var absoluteRow = anchorRow + localRowIndex;
316
283
  var absoluteCol = anchorCol + localColIndex;
317
- if (cell.f && srcRow != null && srcCol != null) {
318
- try {
319
- cell.f = adjustFormulaForPaste(cell.f, srcCol, srcRow, absoluteCol, absoluteRow);
320
- } catch (_b) {}
321
- }
322
284
  pastedMatrix[localRowIndex][localColIndex] = cell;
323
285
  if (hyperlink) {
324
286
  saveHyperlink(ctx, absoluteRow, absoluteCol, hyperlink.href, "webpage", hyperlink.display);
package/es/types.d.ts CHANGED
@@ -328,6 +328,8 @@ export type GlobalCache = {
328
328
  verticalScrollLock?: boolean;
329
329
  horizontalScrollLock?: boolean;
330
330
  overwriteCell?: boolean;
331
+ overwriteCellFirstChar?: string;
332
+ enteredEditByTyping?: boolean;
331
333
  ignoreWriteCell?: boolean;
332
334
  doNotFocus?: boolean;
333
335
  doNotUpdateCell?: boolean;
@@ -179,63 +179,72 @@ function moveToEdge(sheetData, key, curr, rowDelta, colDelta, startR, endR, star
179
179
  return colDelta === 0 ? r : c;
180
180
  }
181
181
  function handleControlPlusArrowKey(ctx, e, shiftPressed) {
182
- if (ctx.luckysheetCellUpdate.length > 0) return;
182
+ var _a, _b, _c, _d;
183
183
  var idx = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
184
184
  if (_lodash.default.isNil(idx)) return;
185
185
  var file = ctx.luckysheetfile[idx];
186
- if (!file || !file.row || !file.column) return;
187
186
  var maxRow = file.row;
188
187
  var maxCol = file.column;
189
- var last;
190
- if (ctx.luckysheet_select_save && ctx.luckysheet_select_save.length > 0) last = ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1];
188
+ if (_lodash.default.isNil(maxRow) || _lodash.default.isNil(maxCol)) return;
189
+ var last = ctx.luckysheet_select_save && ctx.luckysheet_select_save.length > 0 ? ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1] : undefined;
191
190
  if (!last) return;
192
191
  var currR = last.row_focus;
193
192
  var currC = last.column_focus;
194
193
  if (_lodash.default.isNil(currR) || _lodash.default.isNil(currC)) return;
195
- var startR = last.row[0];
196
- var endR = last.row[1];
197
- var startC = last.column[0];
198
- var endC = last.column[1];
194
+ var startR = (_a = last.row) === null || _a === void 0 ? void 0 : _a[0];
195
+ var endR = (_b = last.row) === null || _b === void 0 ? void 0 : _b[1];
196
+ var startC = (_c = last.column) === null || _c === void 0 ? void 0 : _c[0];
197
+ var endC = (_d = last.column) === null || _d === void 0 ? void 0 : _d[1];
198
+ if (_lodash.default.isNil(startR) || _lodash.default.isNil(endR) || _lodash.default.isNil(startC) || _lodash.default.isNil(endC)) {
199
+ return;
200
+ }
199
201
  var horizontalOffset = currC - endC !== 0 ? currC - endC : currC - startC;
200
202
  var verticalOffset = currR - endR !== 0 ? currR - endR : currR - startR;
201
203
  var sheetData = file.data;
202
204
  if (!sheetData) return;
203
- var selectedLimit;
204
205
  switch (e.key) {
205
206
  case "ArrowUp":
206
- selectedLimit = moveToEdge(sheetData, e.key, currC, -1, 0, startR, endR, startC, endC, maxRow, maxCol);
207
- if (shiftPressed) {
208
- (0, _selection.moveHighlightRange)(ctx, "down", verticalOffset, "rangeOfSelect");
209
- (0, _selection.moveHighlightRange)(ctx, "down", selectedLimit - currR, "rangeOfSelect");
210
- } else {
211
- (0, _selection.moveHighlightCell)(ctx, "down", selectedLimit - currR, "rangeOfSelect");
207
+ {
208
+ var selectedLimit = moveToEdge(sheetData, e.key, currC, -1, 0, startR, endR, startC, endC, maxRow, maxCol);
209
+ if (shiftPressed) {
210
+ (0, _selection.moveHighlightRange)(ctx, "down", verticalOffset, "rangeOfSelect");
211
+ (0, _selection.moveHighlightRange)(ctx, "down", selectedLimit - currR, "rangeOfSelect");
212
+ } else {
213
+ (0, _selection.moveHighlightCell)(ctx, "down", selectedLimit - currR, "rangeOfSelect");
214
+ }
212
215
  }
213
216
  break;
214
217
  case "ArrowDown":
215
- selectedLimit = moveToEdge(sheetData, e.key, currC, 1, 0, startR, endR, startC, endC, maxRow, maxCol);
216
- if (shiftPressed) {
217
- (0, _selection.moveHighlightRange)(ctx, "down", verticalOffset, "rangeOfSelect");
218
- (0, _selection.moveHighlightRange)(ctx, "down", selectedLimit - currR, "rangeOfSelect");
219
- } else {
220
- (0, _selection.moveHighlightCell)(ctx, "down", selectedLimit - currR, "rangeOfSelect");
218
+ {
219
+ var selectedLimit = moveToEdge(sheetData, e.key, currC, 1, 0, startR, endR, startC, endC, maxRow, maxCol);
220
+ if (shiftPressed) {
221
+ (0, _selection.moveHighlightRange)(ctx, "down", verticalOffset, "rangeOfSelect");
222
+ (0, _selection.moveHighlightRange)(ctx, "down", selectedLimit - currR, "rangeOfSelect");
223
+ } else {
224
+ (0, _selection.moveHighlightCell)(ctx, "down", selectedLimit - currR, "rangeOfSelect");
225
+ }
221
226
  }
222
227
  break;
223
228
  case "ArrowLeft":
224
- selectedLimit = moveToEdge(sheetData, e.key, currR, 0, -1, startR, endR, startC, endC, maxRow, maxCol);
225
- if (shiftPressed) {
226
- (0, _selection.moveHighlightRange)(ctx, "right", horizontalOffset, "rangeOfSelect");
227
- (0, _selection.moveHighlightRange)(ctx, "right", selectedLimit - currC, "rangeOfSelect");
228
- } else {
229
- (0, _selection.moveHighlightCell)(ctx, "right", selectedLimit - currC, "rangeOfSelect");
229
+ {
230
+ var selectedLimit = moveToEdge(sheetData, e.key, currR, 0, -1, startR, endR, startC, endC, maxRow, maxCol);
231
+ if (shiftPressed) {
232
+ (0, _selection.moveHighlightRange)(ctx, "right", horizontalOffset, "rangeOfSelect");
233
+ (0, _selection.moveHighlightRange)(ctx, "right", selectedLimit - currC, "rangeOfSelect");
234
+ } else {
235
+ (0, _selection.moveHighlightCell)(ctx, "right", selectedLimit - currC, "rangeOfSelect");
236
+ }
230
237
  }
231
238
  break;
232
239
  case "ArrowRight":
233
- selectedLimit = moveToEdge(sheetData, e.key, currR, 0, 1, startR, endR, startC, endC, maxRow, maxCol);
234
- if (shiftPressed) {
235
- (0, _selection.moveHighlightRange)(ctx, "right", horizontalOffset, "rangeOfSelect");
236
- (0, _selection.moveHighlightRange)(ctx, "right", selectedLimit - currC, "rangeOfSelect");
237
- } else {
238
- (0, _selection.moveHighlightCell)(ctx, "right", selectedLimit - currC, "rangeOfSelect");
240
+ {
241
+ var selectedLimit = moveToEdge(sheetData, e.key, currR, 0, 1, startR, endR, startC, endC, maxRow, maxCol);
242
+ if (shiftPressed) {
243
+ (0, _selection.moveHighlightRange)(ctx, "right", horizontalOffset, "rangeOfSelect");
244
+ (0, _selection.moveHighlightRange)(ctx, "right", selectedLimit - currC, "rangeOfSelect");
245
+ } else {
246
+ (0, _selection.moveHighlightCell)(ctx, "right", selectedLimit - currC, "rangeOfSelect");
247
+ }
239
248
  }
240
249
  break;
241
250
  default:
@@ -388,10 +397,10 @@ function handleArrowKey(ctx, e) {
388
397
  }
389
398
  }
390
399
  function handleGlobalKeyDown(ctx, cellInput, fxInput, e, cache, handleUndo, handleRedo, canvas) {
391
- var _a, _b, _c;
400
+ var _a, _b, _c, _d;
392
401
  return __awaiter(this, void 0, void 0, function () {
393
- var handledFlvShortcut, kcode, kstr, allowEdit, isFxInput, ignoredKeys, restCod, last, row_index, col_index, last, row_index, col_index;
394
- return __generator(this, function (_d) {
402
+ var handledFlvShortcut, kcode, kstr, allowEdit, isFxInput, ignoredKeys, restCod, last, row_index, col_index, isEditing, inputText, isFormulaEdit, enteredByTyping, last, row_index, col_index;
403
+ return __generator(this, function (_e) {
395
404
  if (e.shiftKey && e.code === "Space") {
396
405
  e.stopImmediatePropagation();
397
406
  e.stopPropagation();
@@ -499,7 +508,18 @@ function handleGlobalKeyDown(ctx, cellInput, fxInput, e, cache, handleUndo, hand
499
508
  (0, _refresh.jfrefreshgrid)(ctx, null, undefined);
500
509
  e.preventDefault();
501
510
  } else if (kstr === "ArrowUp" || kstr === "ArrowDown" || kstr === "ArrowLeft" || kstr === "ArrowRight") {
502
- handleArrowKey(ctx, e);
511
+ isEditing = ctx.luckysheetCellUpdate.length > 0;
512
+ inputText = (_d = cellInput === null || cellInput === void 0 ? void 0 : cellInput.innerText) !== null && _d !== void 0 ? _d : "";
513
+ isFormulaEdit = isEditing && inputText.trim().startsWith("=");
514
+ enteredByTyping = cache.enteredEditByTyping === true;
515
+ if (isEditing && !isFormulaEdit && enteredByTyping) {
516
+ (0, _cell.updateCell)(ctx, ctx.luckysheetCellUpdate[0], ctx.luckysheetCellUpdate[1], cellInput, undefined, canvas);
517
+ cache.enteredEditByTyping = false;
518
+ handleArrowKey(ctx, e);
519
+ e.preventDefault();
520
+ } else {
521
+ handleArrowKey(ctx, e);
522
+ }
503
523
  } else if (!(kcode >= 112 && kcode <= 123 || kcode <= 46 || kcode === 144 || kcode === 108 || e.ctrlKey || e.altKey || e.shiftKey && (kcode === 37 || kcode === 38 || kcode === 39 || kcode === 40)) || kcode === 8 || kcode === 32 || kcode === 46 || kcode === 0 || e.ctrlKey && kcode === 86) {
504
524
  if (!allowEdit) return [2];
505
525
  if (String.fromCharCode(kcode) != null && !_lodash.default.isEmpty(ctx.luckysheet_select_save) && kstr !== "CapsLock" && kstr !== "Win" && kcode !== 18) {
@@ -508,7 +528,10 @@ function handleGlobalKeyDown(ctx, cellInput, fxInput, e, cache, handleUndo, hand
508
528
  col_index = last.column_focus;
509
529
  ctx.luckysheetCellUpdate = [row_index, col_index];
510
530
  cache.overwriteCell = true;
531
+ cache.overwriteCellFirstChar = e.key;
532
+ cache.enteredEditByTyping = true;
511
533
  (0, _formula.handleFormulaInput)(ctx, fxInput, cellInput, kcode);
534
+ e.preventDefault();
512
535
  }
513
536
  }
514
537
  }
@@ -508,6 +508,7 @@ function handleCellAreaDoubleClick(ctx, globalCache, settings, e, container) {
508
508
  row_index = row_focus;
509
509
  col_index = column_focus;
510
510
  }
511
+ globalCache.enteredEditByTyping = false;
511
512
  (0, _cell.luckysheetUpdateCell)(ctx, row_index, col_index);
512
513
  }
513
514
  function handleContextMenu(ctx, settings, e, workbookContainer, container, area) {
@@ -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/lib/locale/en.js CHANGED
@@ -9634,6 +9634,8 @@ var _default = exports.default = {
9634
9634
  conditionformat_equal_title: "Format cells equal to",
9635
9635
  conditionformat_textContains: "Conditional format - Text Contains",
9636
9636
  conditionformat_textContains_title: "Format cells containing the following text",
9637
+ conditionformat_empty: "Conditional format - Empty",
9638
+ conditionformat_empty_title: "Format cells that are empty",
9637
9639
  conditionformat_occurrenceDate: "Conditional format - Occurrence Date",
9638
9640
  conditionformat_occurrenceDate_title: "Format cells containing the following dates",
9639
9641
  conditionformat_duplicateValue: "Conditional format - Duplicate Value",
@@ -9737,6 +9739,7 @@ var _default = exports.default = {
9737
9739
  between2: "",
9738
9740
  contain: "Contain",
9739
9741
  textContains: "Text contains",
9742
+ empty: "Empty",
9740
9743
  duplicateValue: "Duplicate value",
9741
9744
  uniqueValue: "Unique value",
9742
9745
  top: "Top",
@@ -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/lib/locale/es.js CHANGED
@@ -9571,6 +9571,8 @@ var _default = exports.default = {
9571
9571
  conditionformat_equal_title: "Dar formato a celdas iguales a",
9572
9572
  conditionformat_textContains: "Conditionformat-TextContains",
9573
9573
  conditionformat_textContains_title: "Dar formato a las celdas que contienen el siguiente texto",
9574
+ conditionformat_empty: "Conditional format - Empty",
9575
+ conditionformat_empty_title: "Dar formato a las celdas vacías",
9574
9576
  conditionformat_occurrenceDate: "Conditionformat-OccurrenceDate",
9575
9577
  conditionformat_occurrenceDate_title: "Dar formato a celdas que contienen las siguientes fechas",
9576
9578
  conditionformat_duplicateValue: "Conditionformat-DuplicateValue",
@@ -9672,6 +9674,7 @@ var _default = exports.default = {
9672
9674
  between2: "",
9673
9675
  contain: "Contiene",
9674
9676
  textContains: "Texto contiene",
9677
+ empty: "Vacío",
9675
9678
  duplicateValue: "Valor duplicado",
9676
9679
  uniqueValue: "Valor Unico",
9677
9680
  top: "Mejor",
@@ -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/lib/locale/hi.js CHANGED
@@ -10084,6 +10084,8 @@ var _default = exports.default = {
10084
10084
  conditionformat_equal_title: "के बराबर कोशिकाओं को प्रारूपित करें",
10085
10085
  conditionformat_textContains: "Conditionformat-TextContains",
10086
10086
  conditionformat_textContains_title: "निम्नलिखित पाठ वाली कोशिकाओं को प्रारूपित करें",
10087
+ conditionformat_empty: "Conditional format - Empty",
10088
+ conditionformat_empty_title: "खाली कोशिकाओं को प्रारूपित करें",
10087
10089
  conditionformat_occurrenceDate: "Conditionformat-OccurrenceDate",
10088
10090
  conditionformat_occurrenceDate_title: "निम्नलिखित तिथियों वाली कोशिकाओं को प्रारूपित करें",
10089
10091
  conditionformat_duplicateValue: "Conditionformat-DuplicateValue",
@@ -10185,6 +10187,7 @@ var _default = exports.default = {
10185
10187
  between2: "",
10186
10188
  contain: "शामिल",
10187
10189
  textContains: "पाठ शामिल है",
10190
+ empty: "खाली",
10188
10191
  duplicateValue: "डुप्लिकेट मान",
10189
10192
  uniqueValue: "अद्वितीय मान",
10190
10193
  top: "शीर्ष",
@@ -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;
@@ -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/lib/locale/zh.js CHANGED
@@ -10103,6 +10103,8 @@ var _default = exports.default = {
10103
10103
  conditionformat_equal_title: "为等于以下值的单元格设置格式",
10104
10104
  conditionformat_textContains: "条件格式——文本包含",
10105
10105
  conditionformat_textContains_title: "为包含以下文本的单元格设置格式",
10106
+ conditionformat_empty: "条件格式——空值",
10107
+ conditionformat_empty_title: "为空单元格设置格式",
10106
10108
  conditionformat_occurrenceDate: "条件格式——发生日期",
10107
10109
  conditionformat_occurrenceDate_title: "为包含以下日期的单元格设置格式",
10108
10110
  conditionformat_duplicateValue: "条件格式——重复值",
@@ -10205,6 +10207,7 @@ var _default = exports.default = {
10205
10207
  between2: "之间",
10206
10208
  contain: "包含",
10207
10209
  textContains: "文本包含",
10210
+ empty: "空值",
10208
10211
  duplicateValue: "重复值",
10209
10212
  uniqueValue: "唯一值",
10210
10213
  top: "前",
@@ -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;
@@ -9618,6 +9618,8 @@ var _default = exports.default = {
9618
9618
  conditionformat_equal_title: "為等於以下值的儲存格設定格式",
9619
9619
  conditionformat_textContains: "條件格式——文字包含",
9620
9620
  conditionformat_textContains_title: "為包含以下文字的儲存格設定格式",
9621
+ conditionformat_empty: "條件格式——空值",
9622
+ conditionformat_empty_title: "為空儲存格設定格式",
9621
9623
  conditionformat_occurrenceDate: "條件格式——發生日期",
9622
9624
  conditionformat_occurrenceDate_title: "為包含以下日期的儲存格設定格式",
9623
9625
  conditionformat_duplicateValue: "條件格式——重複值",
@@ -9720,6 +9722,7 @@ var _default = exports.default = {
9720
9722
  between2: "之間",
9721
9723
  contain: "包含",
9722
9724
  textContains: "文字包含",
9725
+ empty: "空值",
9723
9726
  duplicateValue: "重複值",
9724
9727
  uniqueValue: "唯一值",
9725
9728
  top: "前",
@@ -706,6 +706,32 @@ function compute(ctx, ruleArr, d) {
706
706
  }
707
707
  }
708
708
  }
709
+ } else if (conditionName === "empty") {
710
+ for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
711
+ for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
712
+ var cell = _lodash.default.isNil(d[r]) || _lodash.default.isNil(d[r][c]) ? null : d[r][c];
713
+ var isEmpty = _lodash.default.isNil(cell) || _lodash.default.isNil(cell.v) || (0, _validation.isRealNull)(cell.v);
714
+ if (isEmpty) {
715
+ if ("".concat(r, "_").concat(c) in computeMap) {
716
+ computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
717
+ computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
718
+ computeMap["".concat(r, "_").concat(c)].bold = bold_1;
719
+ computeMap["".concat(r, "_").concat(c)].italic = italic_1;
720
+ computeMap["".concat(r, "_").concat(c)].underline = underline_1;
721
+ computeMap["".concat(r, "_").concat(c)].strikethrough = strikethrough_1;
722
+ } else {
723
+ computeMap["".concat(r, "_").concat(c)] = {
724
+ textColor: textColor_1,
725
+ cellColor: cellColor_1,
726
+ bold: bold_1,
727
+ italic: italic_1,
728
+ underline: underline_1,
729
+ strikethrough: strikethrough_1
730
+ };
731
+ }
732
+ }
733
+ }
734
+ }
709
735
  } else if (conditionName === "between") {
710
736
  for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
711
737
  for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
@@ -1074,7 +1074,7 @@ function getFontStyleByCell(cell, checksAF, checksCF, isCheck) {
1074
1074
  if (key === "it" && valueNum !== 0) {
1075
1075
  style.fontStyle = "italic";
1076
1076
  }
1077
- if (key === "fs" && !_lodash.default.isNil(value)) {
1077
+ if (key === "fs" && valueNum !== 10) {
1078
1078
  style.fontSize = "".concat(valueNum, "pt");
1079
1079
  }
1080
1080
  if (key === "fc" && value !== "#000000" || ((_a = checksAF === null || checksAF === void 0 ? void 0 : checksAF.length) !== null && _a !== void 0 ? _a : 0) > 0 || (checksCF === null || checksCF === void 0 ? void 0 : checksCF.textColor)) {
@@ -1221,7 +1221,7 @@ function rangeValueToHtml(ctx, sheetId, ranges) {
1221
1221
  cpdata += "<tr height=".concat(rowLen, "px >");
1222
1222
  var _loop_3 = function _loop_3(j) {
1223
1223
  var c = colIndexArr[j];
1224
- var column = '<td ${span} style="${style}" data-fortune-cell="${cellData}">';
1224
+ var column = '<td ${span} style="${style}">';
1225
1225
  var cell = (_f = d[r]) === null || _f === void 0 ? void 0 : _f[c];
1226
1226
  if (cell != null) {
1227
1227
  var style = "";
@@ -1432,14 +1432,9 @@ function rangeValueToHtml(ctx, sheetId, ranges) {
1432
1432
  }
1433
1433
  }
1434
1434
  }
1435
- var cellData = encodeURIComponent(JSON.stringify(__assign(__assign({}, cell), {
1436
- _srcRow: r,
1437
- _srcCol: c
1438
- })));
1439
1435
  column = (0, _utils.replaceHtml)(column, {
1440
1436
  style: style,
1441
- span: span,
1442
- cellData: cellData
1437
+ span: span
1443
1438
  });
1444
1439
  if (_lodash.default.isNil(c_value)) {
1445
1440
  c_value = (0, _cell.getCellValue)(r, c, d);
@@ -1489,8 +1484,7 @@ function rangeValueToHtml(ctx, sheetId, ranges) {
1489
1484
  }
1490
1485
  column = (0, _utils.replaceHtml)(column, {
1491
1486
  style: style,
1492
- span: "",
1493
- cellData: ""
1487
+ span: ""
1494
1488
  });
1495
1489
  column += "";
1496
1490
  }
@@ -10,7 +10,6 @@ var _locale = require("./locale");
10
10
  var _modules = require("./modules");
11
11
  var _utils = require("./utils");
12
12
  var _api = require("./api");
13
- var _paste = require("./events/paste");
14
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
14
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
16
15
  var __assign = void 0 && (void 0).__assign || function () {
@@ -23,14 +22,6 @@ var __assign = void 0 && (void 0).__assign || function () {
23
22
  };
24
23
  return __assign.apply(this, arguments);
25
24
  };
26
- var __rest = void 0 && (void 0).__rest || function (s, e) {
27
- var t = {};
28
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
29
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
30
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
31
- }
32
- return t;
33
- };
34
25
  var DEFAULT_FONT_SIZE = exports.DEFAULT_FONT_SIZE = 12;
35
26
  var parseStylesheetPairs = function parseStylesheetPairs(styleInner) {
36
27
  var patternReg = /{([^}]*)}/g;
@@ -144,28 +135,6 @@ function brToNewline(str) {
144
135
  }
145
136
  var buildCellFromTd = function buildCellFromTd(td, classStyles, ctx) {
146
137
  var _a, _b, _c, _d;
147
- var fortuneCellAttr = td.getAttribute("data-fortune-cell");
148
- if (fortuneCellAttr) {
149
- try {
150
- var _e = JSON.parse(decodeURIComponent(fortuneCellAttr)),
151
- _srcRow = _e._srcRow,
152
- _srcCol = _e._srcCol,
153
- parsed = __rest(_e, ["_srcRow", "_srcCol"]);
154
- var cell_1 = parsed;
155
- delete cell_1.mc;
156
- delete cell_1.hl;
157
- var rowspan_1 = parseInt(td.getAttribute("rowspan") || "1", 10);
158
- var colspan_1 = parseInt(td.getAttribute("colspan") || "1", 10);
159
- return {
160
- cell: cell_1,
161
- rowspan: Number.isNaN(rowspan_1) ? 1 : rowspan_1,
162
- colspan: Number.isNaN(colspan_1) ? 1 : colspan_1,
163
- hyperlink: detectHyperlink(td),
164
- srcRow: _srcRow,
165
- srcCol: _srcCol
166
- };
167
- } catch (_f) {}
168
- }
169
138
  var cell = {};
170
139
  var rawText = (td.innerText || td.innerHTML || "").trim();
171
140
  var isLineBreak = rawText.includes("<br />");
@@ -316,17 +285,10 @@ function handlePastedTable(ctx, html, pasteHandler) {
316
285
  cell = _a.cell,
317
286
  rowspan = _a.rowspan,
318
287
  colspan = _a.colspan,
319
- hyperlink = _a.hyperlink,
320
- srcRow = _a.srcRow,
321
- srcCol = _a.srcCol;
288
+ hyperlink = _a.hyperlink;
322
289
  var anchorCol = ctx.luckysheet_select_save[0].column[0];
323
290
  var absoluteRow = anchorRow + localRowIndex;
324
291
  var absoluteCol = anchorCol + localColIndex;
325
- if (cell.f && srcRow != null && srcCol != null) {
326
- try {
327
- cell.f = (0, _paste.adjustFormulaForPaste)(cell.f, srcCol, srcRow, absoluteCol, absoluteRow);
328
- } catch (_b) {}
329
- }
330
292
  pastedMatrix[localRowIndex][localColIndex] = cell;
331
293
  if (hyperlink) {
332
294
  (0, _modules.saveHyperlink)(ctx, absoluteRow, absoluteCol, hyperlink.href, "webpage", hyperlink.display);
package/lib/types.d.ts CHANGED
@@ -328,6 +328,8 @@ export type GlobalCache = {
328
328
  verticalScrollLock?: boolean;
329
329
  horizontalScrollLock?: boolean;
330
330
  overwriteCell?: boolean;
331
+ overwriteCellFirstChar?: string;
332
+ enteredEditByTyping?: boolean;
331
333
  ignoreWriteCell?: boolean;
332
334
  doNotFocus?: boolean;
333
335
  doNotUpdateCell?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.3.12-copyPaste-4",
3
+ "version": "1.3.12-mixed-a",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",