@leankylin-sheet/core 7.0.34 → 7.0.35
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/dist/index.esm.js +36 -1
- package/dist/index.js +36 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -61444,6 +61444,37 @@ function domStyleToCellAttr(domStyle) {
|
|
|
61444
61444
|
fs: fs
|
|
61445
61445
|
};
|
|
61446
61446
|
}
|
|
61447
|
+
function parseFormattedNumberText(text) {
|
|
61448
|
+
if (text == null) return undefined;
|
|
61449
|
+
var compact = String(text).replace(/[\s\u00a0\u2007\u202f]/g, "");
|
|
61450
|
+
if (compact === "") return undefined;
|
|
61451
|
+
var str = compact;
|
|
61452
|
+
var negative = false;
|
|
61453
|
+
if (/^\(.*\)$/.test(str)) {
|
|
61454
|
+
negative = true;
|
|
61455
|
+
str = str.slice(1, -1);
|
|
61456
|
+
}
|
|
61457
|
+
str = str.replace(/^[+-]?[¥¥$€£₽₩₺₹]/, function (matched) {
|
|
61458
|
+
return matched.replace(/[¥¥$€£₽₩₺₹]/g, "");
|
|
61459
|
+
});
|
|
61460
|
+
str = str.replace(/[¥¥$€£₽₩₺₹]$/, "");
|
|
61461
|
+
var percent = false;
|
|
61462
|
+
if (/%$/.test(str)) {
|
|
61463
|
+
percent = true;
|
|
61464
|
+
str = str.slice(0, -1);
|
|
61465
|
+
}
|
|
61466
|
+
if (/^[+-]?\d{1,3}(,\d{3})+(\.\d+)?$/.test(str)) {
|
|
61467
|
+
str = str.replace(/,/g, "");
|
|
61468
|
+
}
|
|
61469
|
+
if (str === compact) return undefined;
|
|
61470
|
+
if (!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(str)) {
|
|
61471
|
+
return undefined;
|
|
61472
|
+
}
|
|
61473
|
+
var num = Number(str);
|
|
61474
|
+
if (!Number.isFinite(num)) return undefined;
|
|
61475
|
+
if (percent) return num / 100;
|
|
61476
|
+
return negative ? -num : num;
|
|
61477
|
+
}
|
|
61447
61478
|
function getClipboardData(ctx, e, copyRich, startRow, startCol) {
|
|
61448
61479
|
var _ctx$luckysheetfile, _currentSheet$data, _currentSheet$data2, _currentSheet$data2$;
|
|
61449
61480
|
var clipboardData = e.clipboardData;
|
|
@@ -61491,6 +61522,7 @@ function getClipboardData(ctx, e, copyRich, startRow, startCol) {
|
|
|
61491
61522
|
}
|
|
61492
61523
|
var offsetColIndex = 0;
|
|
61493
61524
|
for (var cIndex = 0; cIndex < cells.length; cIndex += 1) {
|
|
61525
|
+
var _cell$getAttribute;
|
|
61494
61526
|
var _colIndex = startCol + offsetColIndex;
|
|
61495
61527
|
var cell = cells[cIndex];
|
|
61496
61528
|
if (cell === null) {
|
|
@@ -61499,7 +61531,10 @@ function getClipboardData(ctx, e, copyRich, startRow, startCol) {
|
|
|
61499
61531
|
}
|
|
61500
61532
|
var m = cell === null || cell === void 0 ? void 0 : cell.textContent;
|
|
61501
61533
|
var allV = JSON.parse(cell.getAttribute("_v") || "{}");
|
|
61502
|
-
var v = cell.getAttribute("x:num");
|
|
61534
|
+
var v = (_cell$getAttribute = cell.getAttribute("x:num")) !== null && _cell$getAttribute !== void 0 ? _cell$getAttribute : undefined;
|
|
61535
|
+
if (v == null && cell.getAttribute("x:str") == null) {
|
|
61536
|
+
v = parseFormattedNumberText(m);
|
|
61537
|
+
}
|
|
61503
61538
|
var f = cell.getAttribute("f");
|
|
61504
61539
|
if (copyRich) {
|
|
61505
61540
|
var style = iframe.contentWindow.getComputedStyle(cell);
|
package/dist/index.js
CHANGED
|
@@ -61454,6 +61454,37 @@ function domStyleToCellAttr(domStyle) {
|
|
|
61454
61454
|
fs: fs
|
|
61455
61455
|
};
|
|
61456
61456
|
}
|
|
61457
|
+
function parseFormattedNumberText(text) {
|
|
61458
|
+
if (text == null) return undefined;
|
|
61459
|
+
var compact = String(text).replace(/[\s\u00a0\u2007\u202f]/g, "");
|
|
61460
|
+
if (compact === "") return undefined;
|
|
61461
|
+
var str = compact;
|
|
61462
|
+
var negative = false;
|
|
61463
|
+
if (/^\(.*\)$/.test(str)) {
|
|
61464
|
+
negative = true;
|
|
61465
|
+
str = str.slice(1, -1);
|
|
61466
|
+
}
|
|
61467
|
+
str = str.replace(/^[+-]?[¥¥$€£₽₩₺₹]/, function (matched) {
|
|
61468
|
+
return matched.replace(/[¥¥$€£₽₩₺₹]/g, "");
|
|
61469
|
+
});
|
|
61470
|
+
str = str.replace(/[¥¥$€£₽₩₺₹]$/, "");
|
|
61471
|
+
var percent = false;
|
|
61472
|
+
if (/%$/.test(str)) {
|
|
61473
|
+
percent = true;
|
|
61474
|
+
str = str.slice(0, -1);
|
|
61475
|
+
}
|
|
61476
|
+
if (/^[+-]?\d{1,3}(,\d{3})+(\.\d+)?$/.test(str)) {
|
|
61477
|
+
str = str.replace(/,/g, "");
|
|
61478
|
+
}
|
|
61479
|
+
if (str === compact) return undefined;
|
|
61480
|
+
if (!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(str)) {
|
|
61481
|
+
return undefined;
|
|
61482
|
+
}
|
|
61483
|
+
var num = Number(str);
|
|
61484
|
+
if (!Number.isFinite(num)) return undefined;
|
|
61485
|
+
if (percent) return num / 100;
|
|
61486
|
+
return negative ? -num : num;
|
|
61487
|
+
}
|
|
61457
61488
|
function getClipboardData(ctx, e, copyRich, startRow, startCol) {
|
|
61458
61489
|
var _ctx$luckysheetfile, _currentSheet$data, _currentSheet$data2, _currentSheet$data2$;
|
|
61459
61490
|
var clipboardData = e.clipboardData;
|
|
@@ -61501,6 +61532,7 @@ function getClipboardData(ctx, e, copyRich, startRow, startCol) {
|
|
|
61501
61532
|
}
|
|
61502
61533
|
var offsetColIndex = 0;
|
|
61503
61534
|
for (var cIndex = 0; cIndex < cells.length; cIndex += 1) {
|
|
61535
|
+
var _cell$getAttribute;
|
|
61504
61536
|
var _colIndex = startCol + offsetColIndex;
|
|
61505
61537
|
var cell = cells[cIndex];
|
|
61506
61538
|
if (cell === null) {
|
|
@@ -61509,7 +61541,10 @@ function getClipboardData(ctx, e, copyRich, startRow, startCol) {
|
|
|
61509
61541
|
}
|
|
61510
61542
|
var m = cell === null || cell === void 0 ? void 0 : cell.textContent;
|
|
61511
61543
|
var allV = JSON.parse(cell.getAttribute("_v") || "{}");
|
|
61512
|
-
var v = cell.getAttribute("x:num");
|
|
61544
|
+
var v = (_cell$getAttribute = cell.getAttribute("x:num")) !== null && _cell$getAttribute !== void 0 ? _cell$getAttribute : undefined;
|
|
61545
|
+
if (v == null && cell.getAttribute("x:str") == null) {
|
|
61546
|
+
v = parseFormattedNumberText(m);
|
|
61547
|
+
}
|
|
61513
61548
|
var f = cell.getAttribute("f");
|
|
61514
61549
|
if (copyRich) {
|
|
61515
61550
|
var style = iframe.contentWindow.getComputedStyle(cell);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leankylin-sheet/core",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.35",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.esm.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"build": "father-build"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@leankylin-sheet/formula-parser": "7.0.
|
|
16
|
+
"@leankylin-sheet/formula-parser": "7.0.35",
|
|
17
17
|
"dayjs": "^1.11.0",
|
|
18
18
|
"immer": "^9.0.12",
|
|
19
19
|
"lodash": "^4.17.21",
|