@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
@@ -236,7 +236,7 @@ var handleFormulaOnPaste = function handleFormulaOnPaste(ctx, d) {
236
236
  }
237
237
  };
238
238
  function pasteHandler(ctx, data, borderInfo) {
239
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
239
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
240
240
  if (ctx.luckysheet_selection_range) {
241
241
  ctx.luckysheet_selection_range = [];
242
242
  }
@@ -368,13 +368,21 @@ function pasteHandler(ctx, data, borderInfo) {
368
368
  } else {
369
369
  data = data.replace(/\r/g, "");
370
370
  var dataChe = [];
371
- var che = data.split("\n");
372
- var colchelen = che[0].split("\t").length;
373
- for (var i = 0; i < che.length; i += 1) {
374
- if (che[i].split("\t").length < colchelen) {
375
- continue;
371
+ if (data.startsWith('"') && data.endsWith('"') && data.length > 1) {
372
+ var inner = data.slice(1, -1);
373
+ if (inner.includes("\n") && !inner.includes("\t")) {
374
+ dataChe.push([inner.replace(/""/g, '"')]);
375
+ }
376
+ }
377
+ if (dataChe.length === 0) {
378
+ var che = data.split("\n");
379
+ var colchelen = che[0].split("\t").length;
380
+ for (var i = 0; i < che.length; i += 1) {
381
+ if (che[i].split("\t").length < colchelen) {
382
+ continue;
383
+ }
384
+ dataChe.push(che[i].split("\t"));
376
385
  }
377
- dataChe.push(che[i].split("\t"));
378
386
  }
379
387
  var d = (0, _context.getFlowdata)(ctx);
380
388
  if (!d) return;
@@ -403,6 +411,28 @@ function pasteHandler(ctx, data, borderInfo) {
403
411
  if (!/^(https?:\/\/|www\.)\S+$/i.test(t)) return null;
404
412
  return t.startsWith("http") ? t : "https://".concat(t);
405
413
  };
414
+ var applyMultilineTextToCell = function applyMultilineTextToCell(cell, text) {
415
+ var _a;
416
+ var normalizedText = text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
417
+ var inlineStringSegment = {
418
+ v: normalizedText
419
+ };
420
+ ["fs", "fc", "ff", "bl", "it", "un", "cl"].forEach(function (key) {
421
+ var typedKey = key;
422
+ var currentValue = cell[typedKey];
423
+ if (currentValue != null) {
424
+ inlineStringSegment[typedKey] = currentValue;
425
+ }
426
+ });
427
+ cell.v = normalizedText;
428
+ cell.m = normalizedText;
429
+ cell.ct = {
430
+ fa: ((_a = cell.ct) === null || _a === void 0 ? void 0 : _a.fa) === "@" ? "@" : "General",
431
+ t: "inlineStr",
432
+ s: [inlineStringSegment]
433
+ };
434
+ cell.tb = "2";
435
+ };
406
436
  var changes = [];
407
437
  for (var r = 0; r < rlen; r += 1) {
408
438
  var x = d[r + curR];
@@ -410,9 +440,11 @@ function pasteHandler(ctx, data, borderInfo) {
410
440
  var originCell = x[c + curC];
411
441
  var value = dataChe[r][c];
412
442
  var originalValueStr = String(value);
413
- var url = getUrlFromText(originalValueStr);
443
+ var normalizedValueStr = originalValueStr.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
444
+ var isMultilineValue = normalizedValueStr.includes("\n");
445
+ var url = getUrlFromText(normalizedValueStr);
414
446
  var isUrl = url !== null;
415
- if (!isUrl && (0, _validation.isRealNum)(value)) {
447
+ if (!isUrl && !isMultilineValue && (0, _validation.isRealNum)(value)) {
416
448
  if (originCell && originCell.ct && originCell.ct.fa === "@") {
417
449
  value = String(value);
418
450
  } else if (!/^0x?[a-fA-F0-9]+$/.test(value)) {
@@ -420,25 +452,41 @@ function pasteHandler(ctx, data, borderInfo) {
420
452
  }
421
453
  }
422
454
  if (originCell) {
423
- if (originCell.ct && originCell.ct.t === "d" && !isUrl) {
424
- var df = (0, _validation.detectDateFormat)(originalValueStr);
425
- if (df) {
426
- var dateObj = new Date(df.year, df.month - 1, df.day, df.hours, df.minutes, df.seconds);
427
- originCell.v = (0, _format.datenum_local)(dateObj);
428
- } else {
429
- originCell.v = originalValueStr;
430
- }
431
- } else {
432
- originCell.v = isUrl ? originalValueStr : value;
433
- }
434
- if (originCell.ct != null && originCell.ct.fa != null) {
435
- if (originCell.ct.t === "d" && typeof originCell.v !== "number") {
436
- originCell.m = String(originCell.v);
455
+ if (!isUrl && isMultilineValue) {
456
+ applyMultilineTextToCell(originCell, normalizedValueStr);
457
+ } else if (!isUrl) {
458
+ var generated = (0, _format.genarate)(originalValueStr);
459
+ if (generated) {
460
+ var genM = generated[0],
461
+ genCt = generated[1],
462
+ genV = generated[2];
463
+ if ((genCt === null || genCt === void 0 ? void 0 : genCt.t) === "d") {
464
+ originCell.v = genV;
465
+ originCell.m = genM !== null && genM !== void 0 ? genM : originalValueStr;
466
+ originCell.ct = genCt;
467
+ } else {
468
+ originCell.v = value;
469
+ if (originCell.ct != null && originCell.ct.fa != null) {
470
+ if (originCell.ct.t === "d" && typeof originCell.v !== "number") {
471
+ originCell.m = String(originCell.v);
472
+ } else {
473
+ originCell.m = (0, _format.update)(originCell.ct.fa, originCell.v);
474
+ }
475
+ } else {
476
+ originCell.m = typeof originCell.v === "boolean" ? String(originCell.v) : originCell.v;
477
+ }
478
+ }
437
479
  } else {
438
- originCell.m = (0, _format.update)(originCell.ct.fa, originCell.v);
480
+ originCell.v = value;
481
+ if (originCell.ct != null && originCell.ct.fa != null) {
482
+ originCell.m = (0, _format.update)(originCell.ct.fa, originCell.v);
483
+ } else {
484
+ originCell.m = typeof originCell.v === "boolean" ? String(originCell.v) : originCell.v;
485
+ }
439
486
  }
440
487
  } else {
441
- originCell.m = typeof originCell.v === "boolean" ? String(originCell.v) : originCell.v;
488
+ originCell.v = originalValueStr;
489
+ originCell.m = originalValueStr;
442
490
  }
443
491
  if (originCell.f != null && originCell.f.length > 0) {
444
492
  originCell.f = "";
@@ -464,20 +512,27 @@ function pasteHandler(ctx, data, borderInfo) {
464
512
  fa: "@",
465
513
  t: "s"
466
514
  };
515
+ } else if (isMultilineValue) {
516
+ applyMultilineTextToCell(cell, normalizedValueStr);
467
517
  } else {
468
- cell.v = originalValueStr;
469
- cell.m = originalValueStr;
470
- cell.ct = {
471
- fa: "General",
472
- t: "g"
473
- };
474
518
  if (/^0x?[a-fA-F0-9]+$/.test(value)) {
519
+ cell.v = value;
475
520
  cell.m = value;
476
521
  cell.ct = {
477
522
  fa: "@",
478
523
  t: "s"
479
524
  };
480
- cell.v = value;
525
+ } else {
526
+ var _m = (_j = (0, _format.genarate)(originalValueStr)) !== null && _j !== void 0 ? _j : [],
527
+ m = _m[0],
528
+ ct = _m[1],
529
+ v = _m[2];
530
+ cell.v = v !== null && v !== void 0 ? v : originalValueStr;
531
+ cell.m = m != null ? String(m) : originalValueStr;
532
+ cell.ct = ct !== null && ct !== void 0 ? ct : {
533
+ fa: "General",
534
+ t: "g"
535
+ };
481
536
  }
482
537
  }
483
538
  if (isUrl && url) {
@@ -492,6 +547,9 @@ function pasteHandler(ctx, data, borderInfo) {
492
547
  cell.fc = cell.fc || "rgb(0, 0, 255)";
493
548
  cell.un = cell.un !== undefined ? cell.un : 1;
494
549
  }
550
+ if (cell.tb == null) {
551
+ cell.tb = "1";
552
+ }
495
553
  x[c + curC] = cell;
496
554
  }
497
555
  changes.push({
@@ -508,8 +566,8 @@ function pasteHandler(ctx, data, borderInfo) {
508
566
  }
509
567
  d[r + curR] = x;
510
568
  }
511
- if ((_j = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _j === void 0 ? void 0 : _j.updateCellYdoc) {
512
- (_k = ctx.hooks) === null || _k === void 0 ? void 0 : _k.updateCellYdoc(changes);
569
+ if ((_k = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _k === void 0 ? void 0 : _k.updateCellYdoc) {
570
+ (_l = ctx.hooks) === null || _l === void 0 ? void 0 : _l.updateCellYdoc(changes);
513
571
  }
514
572
  last.row = [curR, curR + rlen - 1];
515
573
  last.column = [curC, curC + clen - 1];
@@ -931,8 +989,11 @@ function pasteHandlerOfCutPaste(ctx, copyRange) {
931
989
  postPasteCut(ctx, source, target, copyRowlChange);
932
990
  }
933
991
  }
934
- function pasteHandlerOfCopyPaste(ctx, copyRange) {
992
+ function pasteHandlerOfCopyPaste(ctx, copyRange, valuesOnly) {
935
993
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
994
+ if (valuesOnly === void 0) {
995
+ valuesOnly = false;
996
+ }
936
997
  var allowEdit = (0, _utils.isAllowEdit)(ctx);
937
998
  if (!allowEdit || ctx.isFlvReadOnly) return;
938
999
  if (!copyRange) return;
@@ -981,6 +1042,28 @@ function pasteHandlerOfCopyPaste(ctx, copyRange) {
981
1042
  });
982
1043
  }
983
1044
  var copyData = _lodash.default.cloneDeep(arr);
1045
+ if (valuesOnly) {
1046
+ for (var i = 0; i < copyData.length; i += 1) {
1047
+ for (var j = 0; j < copyData[i].length; j += 1) {
1048
+ var cell = copyData[i][j];
1049
+ if (!cell) continue;
1050
+ delete cell.f;
1051
+ delete cell.spl;
1052
+ delete cell.bl;
1053
+ delete cell.it;
1054
+ delete cell.ff;
1055
+ delete cell.fs;
1056
+ delete cell.fc;
1057
+ delete cell.ht;
1058
+ delete cell.vt;
1059
+ delete cell.tb;
1060
+ delete cell.cl;
1061
+ delete cell.un;
1062
+ delete cell.tr;
1063
+ delete cell.bg;
1064
+ }
1065
+ }
1066
+ }
984
1067
  if (copyRange.copyRange.length > 1) {
985
1068
  for (var i = 0; i < copyData.length; i += 1) {
986
1069
  for (var j = 0; j < copyData[i].length; j += 1) {
@@ -1372,8 +1455,35 @@ function resizePastedCellsToContent(ctx) {
1372
1455
  if (sheetIdx == null) return;
1373
1456
  (0, _calculateRangeCellSize.updateSheetCellSizes)(ctx, sheetIdx, rangeCellSize);
1374
1457
  }
1458
+ function shouldHandleNonTableHtml(html) {
1459
+ if (!html || /<table[\s/>]/i.test(html)) return false;
1460
+ return /<[a-z]/i.test(html);
1461
+ }
1462
+ function convertNonTableHtmlToTable(html) {
1463
+ var container = document.createElement("div");
1464
+ container.innerHTML = html;
1465
+ var rows = [];
1466
+ container.querySelectorAll("p").forEach(function (p) {
1467
+ var _a;
1468
+ if ((_a = p.textContent) === null || _a === void 0 ? void 0 : _a.trim()) {
1469
+ rows.push("<tr><td>".concat(p.innerHTML, "</td></tr>"));
1470
+ }
1471
+ });
1472
+ if (rows.length === 0) {
1473
+ container.querySelectorAll("li").forEach(function (li) {
1474
+ var _a;
1475
+ if (!li.querySelector("p") && ((_a = li.textContent) === null || _a === void 0 ? void 0 : _a.trim())) {
1476
+ rows.push("<tr><td>".concat(li.innerHTML, "</td></tr>"));
1477
+ }
1478
+ });
1479
+ }
1480
+ if (rows.length > 0) {
1481
+ return "<table>".concat(rows.join(""), "</table>");
1482
+ }
1483
+ return "<table><tr><td>".concat(html, "</td></tr></table>");
1484
+ }
1375
1485
  function handlePaste(ctx, e) {
1376
- 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;
1486
+ 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;
1377
1487
  var allowEdit = (0, _utils.isAllowEdit)(ctx);
1378
1488
  if (!allowEdit || ctx.isFlvReadOnly) return;
1379
1489
  if (!_selection.selectionCache.isPasteAction) {
@@ -1382,6 +1492,8 @@ function handlePaste(ctx, e) {
1382
1492
  if (_selection.selectionCache.isPasteAction) {
1383
1493
  ctx.luckysheetCellUpdate = [];
1384
1494
  _selection.selectionCache.isPasteAction = false;
1495
+ var pasteValuesOnly = _selection.selectionCache.isPasteValuesOnly;
1496
+ _selection.selectionCache.isPasteValuesOnly = false;
1385
1497
  var clipboardData = e.clipboardData;
1386
1498
  if (!clipboardData) {
1387
1499
  clipboardData = window.clipboardData;
@@ -1392,8 +1504,11 @@ function handlePaste(ctx, e) {
1392
1504
  parseAsLinkIfUrl(text, ctx);
1393
1505
  }
1394
1506
  var txtdata = clipboardData.getData("text/html") || clipboardData.getData("text/plain");
1507
+ if (pasteValuesOnly && txtdata.indexOf("fortune-copy-action-table") === -1 && txtdata.indexOf("fortune-copy-action-span") === -1) {
1508
+ txtdata = clipboardData.getData("text/plain");
1509
+ }
1395
1510
  var isEqual = true;
1396
- 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) {
1511
+ 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) {
1397
1512
  var cpDataArr = [];
1398
1513
  var reg = /<tr.*?>(.*?)<\/tr>/g;
1399
1514
  var reg2 = /<td.*?>(.*?)<\/td>/g;
@@ -1409,10 +1524,10 @@ function handlePaste(ctx, e) {
1409
1524
  }
1410
1525
  cpDataArr.push(cpRowArr);
1411
1526
  }
1412
- 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];
1413
- 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];
1414
- 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];
1415
- 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];
1527
+ 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];
1528
+ 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];
1529
+ 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];
1530
+ 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];
1416
1531
  var copy_index = ctx.luckysheet_copy_save.dataSheetId || ctx.currentSheetId;
1417
1532
  var d = void 0;
1418
1533
  if (copy_index === ctx.currentSheetId) {
@@ -1435,15 +1550,15 @@ function handlePaste(ctx, e) {
1435
1550
  }
1436
1551
  var v = void 0;
1437
1552
  if (!_lodash.default.isNil(cell)) {
1438
- 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) {
1439
- v = (_p = (_o = d[r]) === null || _o === void 0 ? void 0 : _o[c]) === null || _p === void 0 ? void 0 : _p.v;
1553
+ 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) {
1554
+ v = (_q = (_p = d[r]) === null || _p === void 0 ? void 0 : _p[c]) === null || _q === void 0 ? void 0 : _q.v;
1440
1555
  } else {
1441
- v = (_r = (_q = d[r]) === null || _q === void 0 ? void 0 : _q[c]) === null || _r === void 0 ? void 0 : _r.m;
1556
+ v = (_s = (_r = d[r]) === null || _r === void 0 ? void 0 : _r[c]) === null || _s === void 0 ? void 0 : _s.m;
1442
1557
  }
1443
1558
  } else {
1444
1559
  v = "";
1445
1560
  }
1446
- if (_lodash.default.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") {
1561
+ if (_lodash.default.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") {
1447
1562
  v = d[r][c].ct.s.map(function (val) {
1448
1563
  return val.v;
1449
1564
  }).join("");
@@ -1461,21 +1576,27 @@ function handlePaste(ctx, e) {
1461
1576
  }
1462
1577
  }
1463
1578
  }
1464
- if (((_w = (_v = ctx.hooks).beforePaste) === null || _w === void 0 ? void 0 : _w.call(_v, ctx.luckysheet_select_save, txtdata)) === false) {
1579
+ if (((_x = (_w = ctx.hooks).beforePaste) === null || _x === void 0 ? void 0 : _x.call(_w, ctx.luckysheet_select_save, txtdata)) === false) {
1465
1580
  return;
1466
1581
  }
1467
- 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) {
1582
+ 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) {
1468
1583
  if (ctx.luckysheet_paste_iscut) {
1469
1584
  ctx.luckysheet_paste_iscut = false;
1470
1585
  pasteHandlerOfCutPaste(ctx, ctx.luckysheet_copy_save);
1471
1586
  ctx.luckysheet_selection_range = [];
1472
1587
  } else {
1473
- pasteHandlerOfCopyPaste(ctx, ctx.luckysheet_copy_save);
1588
+ pasteHandlerOfCopyPaste(ctx, ctx.luckysheet_copy_save, pasteValuesOnly);
1474
1589
  }
1475
1590
  resizePastedCellsToContent(ctx);
1476
1591
  } else if (txtdata.indexOf("fortune-copy-action-image") > -1) {} else {
1477
- if (txtdata.indexOf("table") > -1) {
1478
- (0, _pasteTableHelpers.handlePastedTable)(ctx, txtdata, pasteHandler);
1592
+ var shouldHandleAsHtml = /<table[\s/>]/i.test(txtdata) || shouldHandleNonTableHtml(txtdata);
1593
+ if (shouldHandleAsHtml) {
1594
+ var hasNativeTable = /<table[\s/>]/i.test(txtdata);
1595
+ var converted = hasNativeTable ? txtdata : convertNonTableHtmlToTable(txtdata);
1596
+ (0, _pasteTableHelpers.handlePastedTable)(ctx, converted, pasteHandler);
1597
+ if (hasNativeTable) {
1598
+ resizePastedCellsToContent(ctx);
1599
+ }
1479
1600
  } else if (clipboardData.files.length === 1 && clipboardData.files[0].type.indexOf("image") > -1) {} else {
1480
1601
  txtdata = clipboardData.getData("text/plain");
1481
1602
  var isExcelFormula = txtdata.startsWith("=");
@@ -1486,10 +1607,10 @@ function handlePaste(ctx, e) {
1486
1607
  var _txtdata = clipboardData.getData("text/html") || clipboardData.getData("text/plain");
1487
1608
  var embedUrl = (0, _modules.sanitizeDuneUrl)(_txtdata);
1488
1609
  if (embedUrl) {
1489
- var last = (_y = ctx.luckysheet_select_save) === null || _y === void 0 ? void 0 : _y[ctx.luckysheet_select_save.length - 1];
1610
+ var last = (_z = ctx.luckysheet_select_save) === null || _z === void 0 ? void 0 : _z[ctx.luckysheet_select_save.length - 1];
1490
1611
  if (last) {
1491
- 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;
1492
- 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;
1612
+ 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;
1613
+ 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;
1493
1614
  var left = colIndex === 0 ? 0 : ctx.visibledatacolumn[colIndex - 1];
1494
1615
  var top_1 = rowIndex === 0 ? 0 : ctx.visibledatarow[rowIndex + 5];
1495
1616
  ctx.showDunePreview = {
@@ -1533,7 +1654,7 @@ function handlePasteByClick(ctx, clipboardData, triggerType) {
1533
1654
  if (((_b = (_a = ctx.hooks).beforePaste) === null || _b === void 0 ? void 0 : _b.call(_a, ctx.luckysheet_select_save, data)) === false) {
1534
1655
  return;
1535
1656
  }
1536
- 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) {
1657
+ 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) {
1537
1658
  if (ctx.luckysheet_paste_iscut) {
1538
1659
  ctx.luckysheet_paste_iscut = false;
1539
1660
  pasteHandlerOfCutPaste(ctx, ctx.luckysheet_copy_save);
@@ -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) {
@@ -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;