@fileverse-dev/fortune-core 1.3.12 → 1.3.13-create-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/events/keyboard.d.ts +2 -2
- package/es/events/keyboard.js +204 -30
- package/es/events/mouse.js +79 -44
- package/es/events/paste.js +240 -56
- package/es/locale/en.d.ts +3 -0
- package/es/locale/en.js +3 -0
- package/es/locale/es.d.ts +3 -0
- package/es/locale/es.js +3 -0
- package/es/locale/hi.d.ts +3 -0
- package/es/locale/hi.js +3 -0
- package/es/locale/index.d.ts +3 -0
- package/es/locale/zh.d.ts +3 -0
- package/es/locale/zh.js +3 -0
- package/es/locale/zh_tw.d.ts +3 -0
- package/es/locale/zh_tw.js +3 -0
- package/es/modules/ConditionFormat.js +26 -0
- package/es/modules/cell.d.ts +5 -1
- package/es/modules/cell.js +182 -38
- package/es/modules/clipboard.js +111 -2
- package/es/modules/format.js +12 -7
- package/es/modules/formula.d.ts +23 -0
- package/es/modules/formula.js +610 -51
- package/es/modules/hyperlink.js +18 -6
- package/es/modules/inline-string.js +61 -8
- package/es/modules/moveCells.js +52 -9
- package/es/modules/selection.d.ts +1 -0
- package/es/modules/selection.js +102 -16
- package/es/modules/validation.js +6 -3
- package/es/paste-helpers/calculate-range-cell-size.js +5 -4
- package/es/paste-table-helpers.d.ts +1 -1
- package/es/paste-table-helpers.js +170 -21
- package/es/types.d.ts +3 -0
- package/lib/events/keyboard.d.ts +2 -2
- package/lib/events/keyboard.js +203 -29
- package/lib/events/mouse.js +78 -43
- package/lib/events/paste.js +238 -54
- package/lib/locale/en.d.ts +3 -0
- package/lib/locale/en.js +3 -0
- package/lib/locale/es.d.ts +3 -0
- package/lib/locale/es.js +3 -0
- package/lib/locale/hi.d.ts +3 -0
- package/lib/locale/hi.js +3 -0
- package/lib/locale/index.d.ts +3 -0
- package/lib/locale/zh.d.ts +3 -0
- package/lib/locale/zh.js +3 -0
- package/lib/locale/zh_tw.d.ts +3 -0
- package/lib/locale/zh_tw.js +3 -0
- package/lib/modules/ConditionFormat.js +26 -0
- package/lib/modules/cell.d.ts +5 -1
- package/lib/modules/cell.js +180 -36
- package/lib/modules/clipboard.js +111 -2
- package/lib/modules/format.js +12 -7
- package/lib/modules/formula.d.ts +23 -0
- package/lib/modules/formula.js +623 -51
- package/lib/modules/hyperlink.js +18 -6
- package/lib/modules/inline-string.js +61 -8
- package/lib/modules/moveCells.js +52 -9
- package/lib/modules/selection.d.ts +1 -0
- package/lib/modules/selection.js +101 -15
- package/lib/modules/validation.js +6 -3
- package/lib/paste-helpers/calculate-range-cell-size.js +5 -4
- package/lib/paste-table-helpers.d.ts +1 -1
- package/lib/paste-table-helpers.js +170 -21
- package/lib/types.d.ts +3 -0
- package/package.json +1 -1
package/es/events/paste.js
CHANGED
|
@@ -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,
|
|
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
|
|
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
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
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
|
|
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 (
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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 ((
|
|
499
|
-
(
|
|
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,98 @@ 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 convertAnyHtmlToTable(html) {
|
|
1450
|
+
var container = document.createElement("div");
|
|
1451
|
+
container.innerHTML = html;
|
|
1452
|
+
var rows = [];
|
|
1453
|
+
var currentParts = [];
|
|
1454
|
+
var BLOCK_TAGS = new Set(["P", "DIV", "SECTION", "ARTICLE", "ASIDE", "HEADER", "FOOTER", "MAIN", "NAV", "BLOCKQUOTE", "PRE", "H1", "H2", "H3", "H4", "H5", "H6", "UL", "OL", "LI", "DL", "DT", "DD", "TABLE", "THEAD", "TBODY", "TFOOT", "TR", "TD", "TH", "HR"]);
|
|
1455
|
+
var SKIP_TAGS = new Set(["SCRIPT", "STYLE", "NOSCRIPT", "META", "LINK", "HEAD", "SVG", "CANVAS", "IFRAME", "OBJECT"]);
|
|
1456
|
+
var escapeHtml = function escapeHtml(text) {
|
|
1457
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1458
|
+
};
|
|
1459
|
+
var normalizeText = function normalizeText(text) {
|
|
1460
|
+
return text.replace(/\u00A0/g, " ").replace(/\s+/g, " ");
|
|
1461
|
+
};
|
|
1462
|
+
var flushRow = function flushRow() {
|
|
1463
|
+
var htmlContent = currentParts.join("").trim();
|
|
1464
|
+
var textOnly = htmlContent.replace(/<br\s*\/?>/gi, "").replace(/ /gi, " ").replace(/\s+/g, " ").trim();
|
|
1465
|
+
if (textOnly) {
|
|
1466
|
+
rows.push("<tr><td>".concat(htmlContent, "</td></tr>"));
|
|
1467
|
+
}
|
|
1468
|
+
currentParts = [];
|
|
1469
|
+
};
|
|
1470
|
+
var appendText = function appendText(text) {
|
|
1471
|
+
var normalized = normalizeText(text);
|
|
1472
|
+
if (!normalized.trim()) return;
|
|
1473
|
+
var prev = currentParts[currentParts.length - 1] || "";
|
|
1474
|
+
var needsSpace = prev && !prev.endsWith(" ") && !prev.endsWith("<br>") && !/>\s*$/.test(prev);
|
|
1475
|
+
currentParts.push((needsSpace ? " " : "") + escapeHtml(normalized.trim()));
|
|
1476
|
+
};
|
|
1477
|
+
var isBlock = function isBlock(node) {
|
|
1478
|
+
return node.nodeType === Node.ELEMENT_NODE && BLOCK_TAGS.has(node.tagName);
|
|
1479
|
+
};
|
|
1480
|
+
var _walk = function walk(node) {
|
|
1481
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
1482
|
+
appendText(node.textContent || "");
|
|
1483
|
+
return;
|
|
1484
|
+
}
|
|
1485
|
+
if (node.nodeType !== Node.ELEMENT_NODE) return;
|
|
1486
|
+
var el = node;
|
|
1487
|
+
var tag = el.tagName;
|
|
1488
|
+
if (SKIP_TAGS.has(tag)) return;
|
|
1489
|
+
if (tag === "BR" || tag === "HR") {
|
|
1490
|
+
flushRow();
|
|
1491
|
+
return;
|
|
1492
|
+
}
|
|
1493
|
+
if (tag === "TABLE") {
|
|
1494
|
+
flushRow();
|
|
1495
|
+
var trs = el.querySelectorAll(":scope > tbody > tr, :scope > thead > tr, :scope > tfoot > tr, :scope > tr");
|
|
1496
|
+
if (trs.length > 0) {
|
|
1497
|
+
trs.forEach(function (tr) {
|
|
1498
|
+
var cells = Array.from(tr.children).filter(function (child) {
|
|
1499
|
+
return /^(TD|TH)$/.test(child.tagName);
|
|
1500
|
+
});
|
|
1501
|
+
if (!cells.length) return;
|
|
1502
|
+
var rowHtml = cells.map(function (cell) {
|
|
1503
|
+
return "<td>".concat(escapeHtml((cell.textContent || "").replace(/\s+/g, " ").trim()), "</td>");
|
|
1504
|
+
}).join("");
|
|
1505
|
+
if (rowHtml.replace(/<[^>]+>/g, "").trim()) {
|
|
1506
|
+
rows.push("<tr>".concat(rowHtml, "</tr>"));
|
|
1507
|
+
}
|
|
1508
|
+
});
|
|
1509
|
+
} else {
|
|
1510
|
+
var text = (el.textContent || "").replace(/\s+/g, " ").trim();
|
|
1511
|
+
if (text) rows.push("<tr><td>".concat(escapeHtml(text), "</td></tr>"));
|
|
1512
|
+
}
|
|
1513
|
+
return;
|
|
1514
|
+
}
|
|
1515
|
+
var block = isBlock(el);
|
|
1516
|
+
if (block && currentParts.length > 0 && tag !== "LI") {
|
|
1517
|
+
flushRow();
|
|
1518
|
+
}
|
|
1519
|
+
if (tag === "LI") {
|
|
1520
|
+
flushRow();
|
|
1521
|
+
}
|
|
1522
|
+
Array.from(el.childNodes).forEach(_walk);
|
|
1523
|
+
if (block) {
|
|
1524
|
+
flushRow();
|
|
1525
|
+
}
|
|
1526
|
+
};
|
|
1527
|
+
Array.from(container.childNodes).forEach(_walk);
|
|
1528
|
+
flushRow();
|
|
1529
|
+
if (!rows.length) {
|
|
1530
|
+
var text = (container.textContent || "").replace(/\s+/g, " ").trim();
|
|
1531
|
+
return "<table><tr><td>".concat(escapeHtml(text), "</td></tr></table>");
|
|
1532
|
+
}
|
|
1533
|
+
return "<table>".concat(rows.join(""), "</table>");
|
|
1534
|
+
}
|
|
1362
1535
|
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;
|
|
1536
|
+
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
1537
|
var allowEdit = isAllowEdit(ctx);
|
|
1365
1538
|
if (!allowEdit || ctx.isFlvReadOnly) return;
|
|
1366
1539
|
if (!selectionCache.isPasteAction) {
|
|
@@ -1369,6 +1542,8 @@ export function handlePaste(ctx, e) {
|
|
|
1369
1542
|
if (selectionCache.isPasteAction) {
|
|
1370
1543
|
ctx.luckysheetCellUpdate = [];
|
|
1371
1544
|
selectionCache.isPasteAction = false;
|
|
1545
|
+
var pasteValuesOnly = selectionCache.isPasteValuesOnly;
|
|
1546
|
+
selectionCache.isPasteValuesOnly = false;
|
|
1372
1547
|
var clipboardData = e.clipboardData;
|
|
1373
1548
|
if (!clipboardData) {
|
|
1374
1549
|
clipboardData = window.clipboardData;
|
|
@@ -1379,8 +1554,11 @@ export function handlePaste(ctx, e) {
|
|
|
1379
1554
|
parseAsLinkIfUrl(text, ctx);
|
|
1380
1555
|
}
|
|
1381
1556
|
var txtdata = clipboardData.getData("text/html") || clipboardData.getData("text/plain");
|
|
1557
|
+
if (pasteValuesOnly && txtdata.indexOf("fortune-copy-action-table") === -1 && txtdata.indexOf("fortune-copy-action-span") === -1) {
|
|
1558
|
+
txtdata = clipboardData.getData("text/plain");
|
|
1559
|
+
}
|
|
1382
1560
|
var isEqual = true;
|
|
1383
|
-
if (txtdata.indexOf("fortune-copy-action-
|
|
1561
|
+
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
1562
|
var cpDataArr = [];
|
|
1385
1563
|
var reg = /<tr.*?>(.*?)<\/tr>/g;
|
|
1386
1564
|
var reg2 = /<td.*?>(.*?)<\/td>/g;
|
|
@@ -1396,10 +1574,10 @@ export function handlePaste(ctx, e) {
|
|
|
1396
1574
|
}
|
|
1397
1575
|
cpDataArr.push(cpRowArr);
|
|
1398
1576
|
}
|
|
1399
|
-
var copy_r1 = (
|
|
1400
|
-
var copy_r2 = (
|
|
1401
|
-
var copy_c1 = (
|
|
1402
|
-
var copy_c2 = (
|
|
1577
|
+
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];
|
|
1578
|
+
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];
|
|
1579
|
+
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];
|
|
1580
|
+
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
1581
|
var copy_index = ctx.luckysheet_copy_save.dataSheetId || ctx.currentSheetId;
|
|
1404
1582
|
var d = void 0;
|
|
1405
1583
|
if (copy_index === ctx.currentSheetId) {
|
|
@@ -1422,15 +1600,15 @@ export function handlePaste(ctx, e) {
|
|
|
1422
1600
|
}
|
|
1423
1601
|
var v = void 0;
|
|
1424
1602
|
if (!_.isNil(cell)) {
|
|
1425
|
-
if (((
|
|
1426
|
-
v = (
|
|
1603
|
+
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) {
|
|
1604
|
+
v = (_q = (_p = d[r]) === null || _p === void 0 ? void 0 : _p[c]) === null || _q === void 0 ? void 0 : _q.v;
|
|
1427
1605
|
} else {
|
|
1428
|
-
v = (
|
|
1606
|
+
v = (_s = (_r = d[r]) === null || _r === void 0 ? void 0 : _r[c]) === null || _s === void 0 ? void 0 : _s.m;
|
|
1429
1607
|
}
|
|
1430
1608
|
} else {
|
|
1431
1609
|
v = "";
|
|
1432
1610
|
}
|
|
1433
|
-
if (_.isNil(v) && ((
|
|
1611
|
+
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
1612
|
v = d[r][c].ct.s.map(function (val) {
|
|
1435
1613
|
return val.v;
|
|
1436
1614
|
}).join("");
|
|
@@ -1448,21 +1626,27 @@ export function handlePaste(ctx, e) {
|
|
|
1448
1626
|
}
|
|
1449
1627
|
}
|
|
1450
1628
|
}
|
|
1451
|
-
if (((
|
|
1629
|
+
if (((_x = (_w = ctx.hooks).beforePaste) === null || _x === void 0 ? void 0 : _x.call(_w, ctx.luckysheet_select_save, txtdata)) === false) {
|
|
1452
1630
|
return;
|
|
1453
1631
|
}
|
|
1454
|
-
if (txtdata.indexOf("fortune-copy-action-table") > -1 && ((
|
|
1632
|
+
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
1633
|
if (ctx.luckysheet_paste_iscut) {
|
|
1456
1634
|
ctx.luckysheet_paste_iscut = false;
|
|
1457
1635
|
pasteHandlerOfCutPaste(ctx, ctx.luckysheet_copy_save);
|
|
1458
1636
|
ctx.luckysheet_selection_range = [];
|
|
1459
1637
|
} else {
|
|
1460
|
-
pasteHandlerOfCopyPaste(ctx, ctx.luckysheet_copy_save);
|
|
1638
|
+
pasteHandlerOfCopyPaste(ctx, ctx.luckysheet_copy_save, pasteValuesOnly);
|
|
1461
1639
|
}
|
|
1462
1640
|
resizePastedCellsToContent(ctx);
|
|
1463
1641
|
} else if (txtdata.indexOf("fortune-copy-action-image") > -1) {} else {
|
|
1464
|
-
|
|
1465
|
-
|
|
1642
|
+
var shouldHandleAsHtml = /<table[\s/>]/i.test(txtdata) || shouldHandleNonTableHtml(txtdata);
|
|
1643
|
+
if (shouldHandleAsHtml) {
|
|
1644
|
+
var hasNativeTable = /<table[\s/>]/i.test(txtdata);
|
|
1645
|
+
var converted = hasNativeTable ? txtdata : convertAnyHtmlToTable(txtdata);
|
|
1646
|
+
handlePastedTable(ctx, converted, pasteHandler);
|
|
1647
|
+
if (hasNativeTable) {
|
|
1648
|
+
resizePastedCellsToContent(ctx);
|
|
1649
|
+
}
|
|
1466
1650
|
} else if (clipboardData.files.length === 1 && clipboardData.files[0].type.indexOf("image") > -1) {} else {
|
|
1467
1651
|
txtdata = clipboardData.getData("text/plain");
|
|
1468
1652
|
var isExcelFormula = txtdata.startsWith("=");
|
|
@@ -1473,10 +1657,10 @@ export function handlePaste(ctx, e) {
|
|
|
1473
1657
|
var _txtdata = clipboardData.getData("text/html") || clipboardData.getData("text/plain");
|
|
1474
1658
|
var embedUrl = sanitizeDuneUrl(_txtdata);
|
|
1475
1659
|
if (embedUrl) {
|
|
1476
|
-
var last = (
|
|
1660
|
+
var last = (_z = ctx.luckysheet_select_save) === null || _z === void 0 ? void 0 : _z[ctx.luckysheet_select_save.length - 1];
|
|
1477
1661
|
if (last) {
|
|
1478
|
-
var rowIndex = (
|
|
1479
|
-
var colIndex = (
|
|
1662
|
+
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;
|
|
1663
|
+
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
1664
|
var left = colIndex === 0 ? 0 : ctx.visibledatacolumn[colIndex - 1];
|
|
1481
1665
|
var top_1 = rowIndex === 0 ? 0 : ctx.visibledatarow[rowIndex + 5];
|
|
1482
1666
|
ctx.showDunePreview = {
|
|
@@ -1520,7 +1704,7 @@ export function handlePasteByClick(ctx, clipboardData, triggerType) {
|
|
|
1520
1704
|
if (((_b = (_a = ctx.hooks).beforePaste) === null || _b === void 0 ? void 0 : _b.call(_a, ctx.luckysheet_select_save, data)) === false) {
|
|
1521
1705
|
return;
|
|
1522
1706
|
}
|
|
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) {
|
|
1707
|
+
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
1708
|
if (ctx.luckysheet_paste_iscut) {
|
|
1525
1709
|
ctx.luckysheet_paste_iscut = false;
|
|
1526
1710
|
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: "शीर्ष",
|
package/es/locale/index.d.ts
CHANGED
|
@@ -583,6 +583,8 @@ declare function locale(ctx: Context): {
|
|
|
583
583
|
conditionformat_equal_title: string;
|
|
584
584
|
conditionformat_textContains: string;
|
|
585
585
|
conditionformat_textContains_title: string;
|
|
586
|
+
conditionformat_empty: string;
|
|
587
|
+
conditionformat_empty_title: string;
|
|
586
588
|
conditionformat_occurrenceDate: string;
|
|
587
589
|
conditionformat_occurrenceDate_title: string;
|
|
588
590
|
conditionformat_duplicateValue: string;
|
|
@@ -685,6 +687,7 @@ declare function locale(ctx: Context): {
|
|
|
685
687
|
between2: string;
|
|
686
688
|
contain: string;
|
|
687
689
|
textContains: string;
|
|
690
|
+
empty: string;
|
|
688
691
|
duplicateValue: string;
|
|
689
692
|
uniqueValue: string;
|
|
690
693
|
top: string;
|
package/es/locale/zh.d.ts
CHANGED
|
@@ -582,6 +582,8 @@ declare const _default: {
|
|
|
582
582
|
conditionformat_equal_title: string;
|
|
583
583
|
conditionformat_textContains: string;
|
|
584
584
|
conditionformat_textContains_title: string;
|
|
585
|
+
conditionformat_empty: string;
|
|
586
|
+
conditionformat_empty_title: string;
|
|
585
587
|
conditionformat_occurrenceDate: string;
|
|
586
588
|
conditionformat_occurrenceDate_title: string;
|
|
587
589
|
conditionformat_duplicateValue: string;
|
|
@@ -684,6 +686,7 @@ declare const _default: {
|
|
|
684
686
|
between2: string;
|
|
685
687
|
contain: string;
|
|
686
688
|
textContains: string;
|
|
689
|
+
empty: string;
|
|
687
690
|
duplicateValue: string;
|
|
688
691
|
uniqueValue: string;
|
|
689
692
|
top: string;
|
package/es/locale/zh.js
CHANGED
|
@@ -10097,6 +10097,8 @@ export default {
|
|
|
10097
10097
|
conditionformat_equal_title: "为等于以下值的单元格设置格式",
|
|
10098
10098
|
conditionformat_textContains: "条件格式——文本包含",
|
|
10099
10099
|
conditionformat_textContains_title: "为包含以下文本的单元格设置格式",
|
|
10100
|
+
conditionformat_empty: "条件格式——空值",
|
|
10101
|
+
conditionformat_empty_title: "为空单元格设置格式",
|
|
10100
10102
|
conditionformat_occurrenceDate: "条件格式——发生日期",
|
|
10101
10103
|
conditionformat_occurrenceDate_title: "为包含以下日期的单元格设置格式",
|
|
10102
10104
|
conditionformat_duplicateValue: "条件格式——重复值",
|
|
@@ -10199,6 +10201,7 @@ export default {
|
|
|
10199
10201
|
between2: "之间",
|
|
10200
10202
|
contain: "包含",
|
|
10201
10203
|
textContains: "文本包含",
|
|
10204
|
+
empty: "空值",
|
|
10202
10205
|
duplicateValue: "重复值",
|
|
10203
10206
|
uniqueValue: "唯一值",
|
|
10204
10207
|
top: "前",
|
package/es/locale/zh_tw.d.ts
CHANGED
|
@@ -726,6 +726,8 @@ declare const _default: {
|
|
|
726
726
|
conditionformat_equal_title: string;
|
|
727
727
|
conditionformat_textContains: string;
|
|
728
728
|
conditionformat_textContains_title: string;
|
|
729
|
+
conditionformat_empty: string;
|
|
730
|
+
conditionformat_empty_title: string;
|
|
729
731
|
conditionformat_occurrenceDate: string;
|
|
730
732
|
conditionformat_occurrenceDate_title: string;
|
|
731
733
|
conditionformat_duplicateValue: string;
|
|
@@ -828,6 +830,7 @@ declare const _default: {
|
|
|
828
830
|
between2: string;
|
|
829
831
|
contain: string;
|
|
830
832
|
textContains: string;
|
|
833
|
+
empty: string;
|
|
831
834
|
duplicateValue: string;
|
|
832
835
|
uniqueValue: string;
|
|
833
836
|
top: string;
|
package/es/locale/zh_tw.js
CHANGED
|
@@ -9612,6 +9612,8 @@ export default {
|
|
|
9612
9612
|
conditionformat_equal_title: "為等於以下值的儲存格設定格式",
|
|
9613
9613
|
conditionformat_textContains: "條件格式——文字包含",
|
|
9614
9614
|
conditionformat_textContains_title: "為包含以下文字的儲存格設定格式",
|
|
9615
|
+
conditionformat_empty: "條件格式——空值",
|
|
9616
|
+
conditionformat_empty_title: "為空儲存格設定格式",
|
|
9615
9617
|
conditionformat_occurrenceDate: "條件格式——發生日期",
|
|
9616
9618
|
conditionformat_occurrenceDate_title: "為包含以下日期的儲存格設定格式",
|
|
9617
9619
|
conditionformat_duplicateValue: "條件格式——重複值",
|
|
@@ -9714,6 +9716,7 @@ export default {
|
|
|
9714
9716
|
between2: "之間",
|
|
9715
9717
|
contain: "包含",
|
|
9716
9718
|
textContains: "文字包含",
|
|
9719
|
+
empty: "空值",
|
|
9717
9720
|
duplicateValue: "重複值",
|
|
9718
9721
|
uniqueValue: "唯一值",
|
|
9719
9722
|
top: "前",
|