@fileverse-dev/fortune-core 1.3.12 → 1.3.13-create-1

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.
Files changed (65) hide show
  1. package/es/events/keyboard.d.ts +2 -2
  2. package/es/events/keyboard.js +204 -30
  3. package/es/events/mouse.js +79 -44
  4. package/es/events/paste.js +177 -56
  5. package/es/locale/en.d.ts +3 -0
  6. package/es/locale/en.js +3 -0
  7. package/es/locale/es.d.ts +3 -0
  8. package/es/locale/es.js +3 -0
  9. package/es/locale/hi.d.ts +3 -0
  10. package/es/locale/hi.js +3 -0
  11. package/es/locale/index.d.ts +3 -0
  12. package/es/locale/zh.d.ts +3 -0
  13. package/es/locale/zh.js +3 -0
  14. package/es/locale/zh_tw.d.ts +3 -0
  15. package/es/locale/zh_tw.js +3 -0
  16. package/es/modules/ConditionFormat.js +26 -0
  17. package/es/modules/cell.d.ts +4 -1
  18. package/es/modules/cell.js +124 -15
  19. package/es/modules/clipboard.js +111 -2
  20. package/es/modules/format.js +12 -7
  21. package/es/modules/formula.d.ts +23 -0
  22. package/es/modules/formula.js +610 -51
  23. package/es/modules/hyperlink.js +18 -6
  24. package/es/modules/inline-string.js +21 -4
  25. package/es/modules/moveCells.js +52 -9
  26. package/es/modules/selection.d.ts +1 -0
  27. package/es/modules/selection.js +102 -16
  28. package/es/modules/validation.js +6 -3
  29. package/es/paste-helpers/calculate-range-cell-size.js +5 -4
  30. package/es/paste-table-helpers.d.ts +1 -1
  31. package/es/paste-table-helpers.js +170 -21
  32. package/es/types.d.ts +3 -0
  33. package/lib/events/keyboard.d.ts +2 -2
  34. package/lib/events/keyboard.js +203 -29
  35. package/lib/events/mouse.js +78 -43
  36. package/lib/events/paste.js +175 -54
  37. package/lib/locale/en.d.ts +3 -0
  38. package/lib/locale/en.js +3 -0
  39. package/lib/locale/es.d.ts +3 -0
  40. package/lib/locale/es.js +3 -0
  41. package/lib/locale/hi.d.ts +3 -0
  42. package/lib/locale/hi.js +3 -0
  43. package/lib/locale/index.d.ts +3 -0
  44. package/lib/locale/zh.d.ts +3 -0
  45. package/lib/locale/zh.js +3 -0
  46. package/lib/locale/zh_tw.d.ts +3 -0
  47. package/lib/locale/zh_tw.js +3 -0
  48. package/lib/modules/ConditionFormat.js +26 -0
  49. package/lib/modules/cell.d.ts +4 -1
  50. package/lib/modules/cell.js +123 -14
  51. package/lib/modules/clipboard.js +111 -2
  52. package/lib/modules/format.js +12 -7
  53. package/lib/modules/formula.d.ts +23 -0
  54. package/lib/modules/formula.js +623 -51
  55. package/lib/modules/hyperlink.js +18 -6
  56. package/lib/modules/inline-string.js +21 -4
  57. package/lib/modules/moveCells.js +52 -9
  58. package/lib/modules/selection.d.ts +1 -0
  59. package/lib/modules/selection.js +101 -15
  60. package/lib/modules/validation.js +6 -3
  61. package/lib/paste-helpers/calculate-range-cell-size.js +5 -4
  62. package/lib/paste-table-helpers.d.ts +1 -1
  63. package/lib/paste-table-helpers.js +170 -21
  64. package/lib/types.d.ts +3 -0
  65. package/package.json +1 -1
@@ -34,10 +34,10 @@ import { handlePastedTable } from "../paste-table-helpers";
34
34
  import { getFlowdata } from "../context";
35
35
  import { execfunction } from "../modules/formula";
36
36
  import { getdatabyselection } from "../modules/cell";
37
- import { update, datenum_local } from "../modules/format";
37
+ import { update, genarate } from "../modules/format";
38
38
  import { normalizeSelection, selectionCache } from "../modules/selection";
39
39
  import { getSheetIndex, isAllowEdit } from "../utils";
40
- import { hasPartMC, isRealNum, detectDateFormat } from "../modules/validation";
40
+ import { hasPartMC, isRealNum } from "../modules/validation";
41
41
  import { getBorderInfoCompute } from "../modules/border";
42
42
  import { expandRowsAndColumns, storeSheetParamALL } from "../modules/sheet";
43
43
  import { jfrefreshgrid } from "../modules/refresh";
@@ -223,7 +223,7 @@ var handleFormulaOnPaste = function handleFormulaOnPaste(ctx, d) {
223
223
  }
224
224
  };
225
225
  function pasteHandler(ctx, data, borderInfo) {
226
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
226
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
227
227
  if (ctx.luckysheet_selection_range) {
228
228
  ctx.luckysheet_selection_range = [];
229
229
  }
@@ -355,13 +355,21 @@ function pasteHandler(ctx, data, borderInfo) {
355
355
  } else {
356
356
  data = data.replace(/\r/g, "");
357
357
  var dataChe = [];
358
- var che = data.split("\n");
359
- var colchelen = che[0].split("\t").length;
360
- for (var i = 0; i < che.length; i += 1) {
361
- if (che[i].split("\t").length < colchelen) {
362
- continue;
358
+ if (data.startsWith('"') && data.endsWith('"') && data.length > 1) {
359
+ var inner = data.slice(1, -1);
360
+ if (inner.includes("\n") && !inner.includes("\t")) {
361
+ dataChe.push([inner.replace(/""/g, '"')]);
362
+ }
363
+ }
364
+ if (dataChe.length === 0) {
365
+ var che = data.split("\n");
366
+ var colchelen = che[0].split("\t").length;
367
+ for (var i = 0; i < che.length; i += 1) {
368
+ if (che[i].split("\t").length < colchelen) {
369
+ continue;
370
+ }
371
+ dataChe.push(che[i].split("\t"));
363
372
  }
364
- dataChe.push(che[i].split("\t"));
365
373
  }
366
374
  var d = getFlowdata(ctx);
367
375
  if (!d) return;
@@ -390,6 +398,28 @@ function pasteHandler(ctx, data, borderInfo) {
390
398
  if (!/^(https?:\/\/|www\.)\S+$/i.test(t)) return null;
391
399
  return t.startsWith("http") ? t : "https://".concat(t);
392
400
  };
401
+ var applyMultilineTextToCell = function applyMultilineTextToCell(cell, text) {
402
+ var _a;
403
+ var normalizedText = text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
404
+ var inlineStringSegment = {
405
+ v: normalizedText
406
+ };
407
+ ["fs", "fc", "ff", "bl", "it", "un", "cl"].forEach(function (key) {
408
+ var typedKey = key;
409
+ var currentValue = cell[typedKey];
410
+ if (currentValue != null) {
411
+ inlineStringSegment[typedKey] = currentValue;
412
+ }
413
+ });
414
+ cell.v = normalizedText;
415
+ cell.m = normalizedText;
416
+ cell.ct = {
417
+ fa: ((_a = cell.ct) === null || _a === void 0 ? void 0 : _a.fa) === "@" ? "@" : "General",
418
+ t: "inlineStr",
419
+ s: [inlineStringSegment]
420
+ };
421
+ cell.tb = "2";
422
+ };
393
423
  var changes = [];
394
424
  for (var r = 0; r < rlen; r += 1) {
395
425
  var x = d[r + curR];
@@ -397,9 +427,11 @@ function pasteHandler(ctx, data, borderInfo) {
397
427
  var originCell = x[c + curC];
398
428
  var value = dataChe[r][c];
399
429
  var originalValueStr = String(value);
400
- var url = getUrlFromText(originalValueStr);
430
+ var normalizedValueStr = originalValueStr.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
431
+ var isMultilineValue = normalizedValueStr.includes("\n");
432
+ var url = getUrlFromText(normalizedValueStr);
401
433
  var isUrl = url !== null;
402
- if (!isUrl && isRealNum(value)) {
434
+ if (!isUrl && !isMultilineValue && isRealNum(value)) {
403
435
  if (originCell && originCell.ct && originCell.ct.fa === "@") {
404
436
  value = String(value);
405
437
  } else if (!/^0x?[a-fA-F0-9]+$/.test(value)) {
@@ -407,25 +439,41 @@ function pasteHandler(ctx, data, borderInfo) {
407
439
  }
408
440
  }
409
441
  if (originCell) {
410
- if (originCell.ct && originCell.ct.t === "d" && !isUrl) {
411
- var df = detectDateFormat(originalValueStr);
412
- if (df) {
413
- var dateObj = new Date(df.year, df.month - 1, df.day, df.hours, df.minutes, df.seconds);
414
- originCell.v = datenum_local(dateObj);
415
- } else {
416
- originCell.v = originalValueStr;
417
- }
418
- } else {
419
- originCell.v = isUrl ? originalValueStr : value;
420
- }
421
- if (originCell.ct != null && originCell.ct.fa != null) {
422
- if (originCell.ct.t === "d" && typeof originCell.v !== "number") {
423
- originCell.m = String(originCell.v);
442
+ if (!isUrl && isMultilineValue) {
443
+ applyMultilineTextToCell(originCell, normalizedValueStr);
444
+ } else if (!isUrl) {
445
+ var generated = genarate(originalValueStr);
446
+ if (generated) {
447
+ var genM = generated[0],
448
+ genCt = generated[1],
449
+ genV = generated[2];
450
+ if ((genCt === null || genCt === void 0 ? void 0 : genCt.t) === "d") {
451
+ originCell.v = genV;
452
+ originCell.m = genM !== null && genM !== void 0 ? genM : originalValueStr;
453
+ originCell.ct = genCt;
454
+ } else {
455
+ originCell.v = value;
456
+ if (originCell.ct != null && originCell.ct.fa != null) {
457
+ if (originCell.ct.t === "d" && typeof originCell.v !== "number") {
458
+ originCell.m = String(originCell.v);
459
+ } else {
460
+ originCell.m = update(originCell.ct.fa, originCell.v);
461
+ }
462
+ } else {
463
+ originCell.m = typeof originCell.v === "boolean" ? String(originCell.v) : originCell.v;
464
+ }
465
+ }
424
466
  } else {
425
- originCell.m = update(originCell.ct.fa, originCell.v);
467
+ originCell.v = value;
468
+ if (originCell.ct != null && originCell.ct.fa != null) {
469
+ originCell.m = update(originCell.ct.fa, originCell.v);
470
+ } else {
471
+ originCell.m = typeof originCell.v === "boolean" ? String(originCell.v) : originCell.v;
472
+ }
426
473
  }
427
474
  } else {
428
- originCell.m = typeof originCell.v === "boolean" ? String(originCell.v) : originCell.v;
475
+ originCell.v = originalValueStr;
476
+ originCell.m = originalValueStr;
429
477
  }
430
478
  if (originCell.f != null && originCell.f.length > 0) {
431
479
  originCell.f = "";
@@ -451,20 +499,27 @@ function pasteHandler(ctx, data, borderInfo) {
451
499
  fa: "@",
452
500
  t: "s"
453
501
  };
502
+ } else if (isMultilineValue) {
503
+ applyMultilineTextToCell(cell, normalizedValueStr);
454
504
  } else {
455
- cell.v = originalValueStr;
456
- cell.m = originalValueStr;
457
- cell.ct = {
458
- fa: "General",
459
- t: "g"
460
- };
461
505
  if (/^0x?[a-fA-F0-9]+$/.test(value)) {
506
+ cell.v = value;
462
507
  cell.m = value;
463
508
  cell.ct = {
464
509
  fa: "@",
465
510
  t: "s"
466
511
  };
467
- cell.v = value;
512
+ } else {
513
+ var _m = (_j = genarate(originalValueStr)) !== null && _j !== void 0 ? _j : [],
514
+ m = _m[0],
515
+ ct = _m[1],
516
+ v = _m[2];
517
+ cell.v = v !== null && v !== void 0 ? v : originalValueStr;
518
+ cell.m = m != null ? String(m) : originalValueStr;
519
+ cell.ct = ct !== null && ct !== void 0 ? ct : {
520
+ fa: "General",
521
+ t: "g"
522
+ };
468
523
  }
469
524
  }
470
525
  if (isUrl && url) {
@@ -479,6 +534,9 @@ function pasteHandler(ctx, data, borderInfo) {
479
534
  cell.fc = cell.fc || "rgb(0, 0, 255)";
480
535
  cell.un = cell.un !== undefined ? cell.un : 1;
481
536
  }
537
+ if (cell.tb == null) {
538
+ cell.tb = "1";
539
+ }
482
540
  x[c + curC] = cell;
483
541
  }
484
542
  changes.push({
@@ -495,8 +553,8 @@ function pasteHandler(ctx, data, borderInfo) {
495
553
  }
496
554
  d[r + curR] = x;
497
555
  }
498
- if ((_j = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _j === void 0 ? void 0 : _j.updateCellYdoc) {
499
- (_k = ctx.hooks) === null || _k === void 0 ? void 0 : _k.updateCellYdoc(changes);
556
+ if ((_k = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _k === void 0 ? void 0 : _k.updateCellYdoc) {
557
+ (_l = ctx.hooks) === null || _l === void 0 ? void 0 : _l.updateCellYdoc(changes);
500
558
  }
501
559
  last.row = [curR, curR + rlen - 1];
502
560
  last.column = [curC, curC + clen - 1];
@@ -918,8 +976,11 @@ function pasteHandlerOfCutPaste(ctx, copyRange) {
918
976
  postPasteCut(ctx, source, target, copyRowlChange);
919
977
  }
920
978
  }
921
- function pasteHandlerOfCopyPaste(ctx, copyRange) {
979
+ function pasteHandlerOfCopyPaste(ctx, copyRange, valuesOnly) {
922
980
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
981
+ if (valuesOnly === void 0) {
982
+ valuesOnly = false;
983
+ }
923
984
  var allowEdit = isAllowEdit(ctx);
924
985
  if (!allowEdit || ctx.isFlvReadOnly) return;
925
986
  if (!copyRange) return;
@@ -968,6 +1029,28 @@ function pasteHandlerOfCopyPaste(ctx, copyRange) {
968
1029
  });
969
1030
  }
970
1031
  var copyData = _.cloneDeep(arr);
1032
+ if (valuesOnly) {
1033
+ for (var i = 0; i < copyData.length; i += 1) {
1034
+ for (var j = 0; j < copyData[i].length; j += 1) {
1035
+ var cell = copyData[i][j];
1036
+ if (!cell) continue;
1037
+ delete cell.f;
1038
+ delete cell.spl;
1039
+ delete cell.bl;
1040
+ delete cell.it;
1041
+ delete cell.ff;
1042
+ delete cell.fs;
1043
+ delete cell.fc;
1044
+ delete cell.ht;
1045
+ delete cell.vt;
1046
+ delete cell.tb;
1047
+ delete cell.cl;
1048
+ delete cell.un;
1049
+ delete cell.tr;
1050
+ delete cell.bg;
1051
+ }
1052
+ }
1053
+ }
971
1054
  if (copyRange.copyRange.length > 1) {
972
1055
  for (var i = 0; i < copyData.length; i += 1) {
973
1056
  for (var j = 0; j < copyData[i].length; j += 1) {
@@ -1359,8 +1442,35 @@ function resizePastedCellsToContent(ctx) {
1359
1442
  if (sheetIdx == null) return;
1360
1443
  updateSheetCellSizes(ctx, sheetIdx, rangeCellSize);
1361
1444
  }
1445
+ function shouldHandleNonTableHtml(html) {
1446
+ if (!html || /<table[\s/>]/i.test(html)) return false;
1447
+ return /<[a-z]/i.test(html);
1448
+ }
1449
+ function convertNonTableHtmlToTable(html) {
1450
+ var container = document.createElement("div");
1451
+ container.innerHTML = html;
1452
+ var rows = [];
1453
+ container.querySelectorAll("p").forEach(function (p) {
1454
+ var _a;
1455
+ if ((_a = p.textContent) === null || _a === void 0 ? void 0 : _a.trim()) {
1456
+ rows.push("<tr><td>".concat(p.innerHTML, "</td></tr>"));
1457
+ }
1458
+ });
1459
+ if (rows.length === 0) {
1460
+ container.querySelectorAll("li").forEach(function (li) {
1461
+ var _a;
1462
+ if (!li.querySelector("p") && ((_a = li.textContent) === null || _a === void 0 ? void 0 : _a.trim())) {
1463
+ rows.push("<tr><td>".concat(li.innerHTML, "</td></tr>"));
1464
+ }
1465
+ });
1466
+ }
1467
+ if (rows.length > 0) {
1468
+ return "<table>".concat(rows.join(""), "</table>");
1469
+ }
1470
+ return "<table><tr><td>".concat(html, "</td></tr></table>");
1471
+ }
1362
1472
  export function handlePaste(ctx, e) {
1363
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
1473
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
1364
1474
  var allowEdit = isAllowEdit(ctx);
1365
1475
  if (!allowEdit || ctx.isFlvReadOnly) return;
1366
1476
  if (!selectionCache.isPasteAction) {
@@ -1369,6 +1479,8 @@ export function handlePaste(ctx, e) {
1369
1479
  if (selectionCache.isPasteAction) {
1370
1480
  ctx.luckysheetCellUpdate = [];
1371
1481
  selectionCache.isPasteAction = false;
1482
+ var pasteValuesOnly = selectionCache.isPasteValuesOnly;
1483
+ selectionCache.isPasteValuesOnly = false;
1372
1484
  var clipboardData = e.clipboardData;
1373
1485
  if (!clipboardData) {
1374
1486
  clipboardData = window.clipboardData;
@@ -1379,8 +1491,11 @@ export function handlePaste(ctx, e) {
1379
1491
  parseAsLinkIfUrl(text, ctx);
1380
1492
  }
1381
1493
  var txtdata = clipboardData.getData("text/html") || clipboardData.getData("text/plain");
1494
+ if (pasteValuesOnly && txtdata.indexOf("fortune-copy-action-table") === -1 && txtdata.indexOf("fortune-copy-action-span") === -1) {
1495
+ txtdata = clipboardData.getData("text/plain");
1496
+ }
1382
1497
  var isEqual = true;
1383
- if (txtdata.indexOf("fortune-copy-action-table") > -1 && ((_a = ctx.luckysheet_copy_save) === null || _a === void 0 ? void 0 : _a.copyRange) != null && ctx.luckysheet_copy_save.copyRange.length > 0) {
1498
+ if (txtdata.indexOf("fortune-copy-action-span") > -1 && ((_a = ctx.luckysheet_copy_save) === null || _a === void 0 ? void 0 : _a.copyRange) != null && ctx.luckysheet_copy_save.copyRange.length === 1) {} else if (txtdata.indexOf("fortune-copy-action-table") > -1 && ((_b = ctx.luckysheet_copy_save) === null || _b === void 0 ? void 0 : _b.copyRange) != null && ctx.luckysheet_copy_save.copyRange.length > 0) {
1384
1499
  var cpDataArr = [];
1385
1500
  var reg = /<tr.*?>(.*?)<\/tr>/g;
1386
1501
  var reg2 = /<td.*?>(.*?)<\/td>/g;
@@ -1396,10 +1511,10 @@ export function handlePaste(ctx, e) {
1396
1511
  }
1397
1512
  cpDataArr.push(cpRowArr);
1398
1513
  }
1399
- var copy_r1 = (_c = (_b = ctx.luckysheet_copy_save) === null || _b === void 0 ? void 0 : _b.copyRange[0]) === null || _c === void 0 ? void 0 : _c.row[0];
1400
- var copy_r2 = (_e = (_d = ctx.luckysheet_copy_save) === null || _d === void 0 ? void 0 : _d.copyRange[0]) === null || _e === void 0 ? void 0 : _e.row[1];
1401
- var copy_c1 = (_g = (_f = ctx.luckysheet_copy_save) === null || _f === void 0 ? void 0 : _f.copyRange[0]) === null || _g === void 0 ? void 0 : _g.column[0];
1402
- var copy_c2 = (_j = (_h = ctx.luckysheet_copy_save) === null || _h === void 0 ? void 0 : _h.copyRange[0]) === null || _j === void 0 ? void 0 : _j.column[1];
1514
+ var copy_r1 = (_d = (_c = ctx.luckysheet_copy_save) === null || _c === void 0 ? void 0 : _c.copyRange[0]) === null || _d === void 0 ? void 0 : _d.row[0];
1515
+ var copy_r2 = (_f = (_e = ctx.luckysheet_copy_save) === null || _e === void 0 ? void 0 : _e.copyRange[0]) === null || _f === void 0 ? void 0 : _f.row[1];
1516
+ var copy_c1 = (_h = (_g = ctx.luckysheet_copy_save) === null || _g === void 0 ? void 0 : _g.copyRange[0]) === null || _h === void 0 ? void 0 : _h.column[0];
1517
+ var copy_c2 = (_k = (_j = ctx.luckysheet_copy_save) === null || _j === void 0 ? void 0 : _j.copyRange[0]) === null || _k === void 0 ? void 0 : _k.column[1];
1403
1518
  var copy_index = ctx.luckysheet_copy_save.dataSheetId || ctx.currentSheetId;
1404
1519
  var d = void 0;
1405
1520
  if (copy_index === ctx.currentSheetId) {
@@ -1422,15 +1537,15 @@ export function handlePaste(ctx, e) {
1422
1537
  }
1423
1538
  var v = void 0;
1424
1539
  if (!_.isNil(cell)) {
1425
- if (((_m = (_l = (_k = cell.ct) === null || _k === void 0 ? void 0 : _k.fa) === null || _l === void 0 ? void 0 : _l.indexOf("w")) !== null && _m !== void 0 ? _m : -1) > -1) {
1426
- v = (_p = (_o = d[r]) === null || _o === void 0 ? void 0 : _o[c]) === null || _p === void 0 ? void 0 : _p.v;
1540
+ if (((_o = (_m = (_l = cell.ct) === null || _l === void 0 ? void 0 : _l.fa) === null || _m === void 0 ? void 0 : _m.indexOf("w")) !== null && _o !== void 0 ? _o : -1) > -1) {
1541
+ v = (_q = (_p = d[r]) === null || _p === void 0 ? void 0 : _p[c]) === null || _q === void 0 ? void 0 : _q.v;
1427
1542
  } else {
1428
- v = (_r = (_q = d[r]) === null || _q === void 0 ? void 0 : _q[c]) === null || _r === void 0 ? void 0 : _r.m;
1543
+ v = (_s = (_r = d[r]) === null || _r === void 0 ? void 0 : _r[c]) === null || _s === void 0 ? void 0 : _s.m;
1429
1544
  }
1430
1545
  } else {
1431
1546
  v = "";
1432
1547
  }
1433
- if (_.isNil(v) && ((_u = (_t = (_s = d[r]) === null || _s === void 0 ? void 0 : _s[c]) === null || _t === void 0 ? void 0 : _t.ct) === null || _u === void 0 ? void 0 : _u.t) === "inlineStr") {
1548
+ if (_.isNil(v) && ((_v = (_u = (_t = d[r]) === null || _t === void 0 ? void 0 : _t[c]) === null || _u === void 0 ? void 0 : _u.ct) === null || _v === void 0 ? void 0 : _v.t) === "inlineStr") {
1434
1549
  v = d[r][c].ct.s.map(function (val) {
1435
1550
  return val.v;
1436
1551
  }).join("");
@@ -1448,21 +1563,27 @@ export function handlePaste(ctx, e) {
1448
1563
  }
1449
1564
  }
1450
1565
  }
1451
- if (((_w = (_v = ctx.hooks).beforePaste) === null || _w === void 0 ? void 0 : _w.call(_v, ctx.luckysheet_select_save, txtdata)) === false) {
1566
+ if (((_x = (_w = ctx.hooks).beforePaste) === null || _x === void 0 ? void 0 : _x.call(_w, ctx.luckysheet_select_save, txtdata)) === false) {
1452
1567
  return;
1453
1568
  }
1454
- if (txtdata.indexOf("fortune-copy-action-table") > -1 && ((_x = ctx.luckysheet_copy_save) === null || _x === void 0 ? void 0 : _x.copyRange) != null && ctx.luckysheet_copy_save.copyRange.length > 0 && isEqual) {
1569
+ if ((txtdata.indexOf("fortune-copy-action-table") > -1 || txtdata.indexOf("fortune-copy-action-span") > -1) && ((_y = ctx.luckysheet_copy_save) === null || _y === void 0 ? void 0 : _y.copyRange) != null && ctx.luckysheet_copy_save.copyRange.length > 0 && isEqual) {
1455
1570
  if (ctx.luckysheet_paste_iscut) {
1456
1571
  ctx.luckysheet_paste_iscut = false;
1457
1572
  pasteHandlerOfCutPaste(ctx, ctx.luckysheet_copy_save);
1458
1573
  ctx.luckysheet_selection_range = [];
1459
1574
  } else {
1460
- pasteHandlerOfCopyPaste(ctx, ctx.luckysheet_copy_save);
1575
+ pasteHandlerOfCopyPaste(ctx, ctx.luckysheet_copy_save, pasteValuesOnly);
1461
1576
  }
1462
1577
  resizePastedCellsToContent(ctx);
1463
1578
  } else if (txtdata.indexOf("fortune-copy-action-image") > -1) {} else {
1464
- if (txtdata.indexOf("table") > -1) {
1465
- handlePastedTable(ctx, txtdata, pasteHandler);
1579
+ var shouldHandleAsHtml = /<table[\s/>]/i.test(txtdata) || shouldHandleNonTableHtml(txtdata);
1580
+ if (shouldHandleAsHtml) {
1581
+ var hasNativeTable = /<table[\s/>]/i.test(txtdata);
1582
+ var converted = hasNativeTable ? txtdata : convertNonTableHtmlToTable(txtdata);
1583
+ handlePastedTable(ctx, converted, pasteHandler);
1584
+ if (hasNativeTable) {
1585
+ resizePastedCellsToContent(ctx);
1586
+ }
1466
1587
  } else if (clipboardData.files.length === 1 && clipboardData.files[0].type.indexOf("image") > -1) {} else {
1467
1588
  txtdata = clipboardData.getData("text/plain");
1468
1589
  var isExcelFormula = txtdata.startsWith("=");
@@ -1473,10 +1594,10 @@ export function handlePaste(ctx, e) {
1473
1594
  var _txtdata = clipboardData.getData("text/html") || clipboardData.getData("text/plain");
1474
1595
  var embedUrl = sanitizeDuneUrl(_txtdata);
1475
1596
  if (embedUrl) {
1476
- var last = (_y = ctx.luckysheet_select_save) === null || _y === void 0 ? void 0 : _y[ctx.luckysheet_select_save.length - 1];
1597
+ var last = (_z = ctx.luckysheet_select_save) === null || _z === void 0 ? void 0 : _z[ctx.luckysheet_select_save.length - 1];
1477
1598
  if (last) {
1478
- var rowIndex = (_1 = (_z = last.row_focus) !== null && _z !== void 0 ? _z : (_0 = last.row) === null || _0 === void 0 ? void 0 : _0[0]) !== null && _1 !== void 0 ? _1 : 0;
1479
- var colIndex = (_4 = (_2 = last.column_focus) !== null && _2 !== void 0 ? _2 : (_3 = last.column) === null || _3 === void 0 ? void 0 : _3[0]) !== null && _4 !== void 0 ? _4 : 0;
1599
+ var rowIndex = (_2 = (_0 = last.row_focus) !== null && _0 !== void 0 ? _0 : (_1 = last.row) === null || _1 === void 0 ? void 0 : _1[0]) !== null && _2 !== void 0 ? _2 : 0;
1600
+ var colIndex = (_5 = (_3 = last.column_focus) !== null && _3 !== void 0 ? _3 : (_4 = last.column) === null || _4 === void 0 ? void 0 : _4[0]) !== null && _5 !== void 0 ? _5 : 0;
1480
1601
  var left = colIndex === 0 ? 0 : ctx.visibledatacolumn[colIndex - 1];
1481
1602
  var top_1 = rowIndex === 0 ? 0 : ctx.visibledatarow[rowIndex + 5];
1482
1603
  ctx.showDunePreview = {
@@ -1520,7 +1641,7 @@ export function handlePasteByClick(ctx, clipboardData, triggerType) {
1520
1641
  if (((_b = (_a = ctx.hooks).beforePaste) === null || _b === void 0 ? void 0 : _b.call(_a, ctx.luckysheet_select_save, data)) === false) {
1521
1642
  return;
1522
1643
  }
1523
- if (data.indexOf("fortune-copy-action-table") > -1 && ((_c = ctx.luckysheet_copy_save) === null || _c === void 0 ? void 0 : _c.copyRange) != null && ctx.luckysheet_copy_save.copyRange.length > 0) {
1644
+ if ((data.indexOf("fortune-copy-action-table") > -1 || data.indexOf("fortune-copy-action-span") > -1) && ((_c = ctx.luckysheet_copy_save) === null || _c === void 0 ? void 0 : _c.copyRange) != null && ctx.luckysheet_copy_save.copyRange.length > 0) {
1524
1645
  if (ctx.luckysheet_paste_iscut) {
1525
1646
  ctx.luckysheet_paste_iscut = false;
1526
1647
  pasteHandlerOfCutPaste(ctx, ctx.luckysheet_copy_save);
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) {
@@ -25,7 +25,10 @@ export declare function getRangeByTxt(ctx: Context, txt: string): any[];
25
25
  export declare function isAllSelectedCellsInStatus(ctx: Context, attr: keyof Cell, status: any): boolean;
26
26
  export declare function getFontStyleByCell(cell: Cell | null | undefined, checksAF?: any[], checksCF?: any, isCheck?: boolean): any;
27
27
  export declare function getStyleByCell(ctx: Context, d: CellMatrix, r: number, c: number): any;
28
- export declare function getInlineStringHTML(r: number, c: number, data: CellMatrix): string;
28
+ export declare function getInlineStringHTML(r: number, c: number, data: CellMatrix, options?: {
29
+ useSemanticMarkup?: boolean;
30
+ inheritedStyle?: Record<string, string>;
31
+ }): string;
29
32
  export declare function getQKBorder(width: string, type: string, color: string): (string | number)[];
30
33
  export declare function getdatabyselection(ctx: Context, range: Selection | undefined, sheetId: string): (Cell | null)[][];
31
34
  export declare function luckysheetUpdateCell(ctx: Context, row_index: number, col_index: number): void;