@leankylin-sheet/core 7.0.34 → 7.0.36

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 CHANGED
@@ -57723,6 +57723,9 @@ var defaultSettings = {
57723
57723
  showFormulaBar: true,
57724
57724
  showSheetTabs: true,
57725
57725
  showAddSheetButton: true,
57726
+ showGridLinesControl: true,
57727
+ showHeadersControl: true,
57728
+ showZoomControl: true,
57726
57729
  onAddSheetClick: undefined,
57727
57730
  onSheetRename: undefined,
57728
57731
  onSheetDelete: undefined,
@@ -61444,6 +61447,37 @@ function domStyleToCellAttr(domStyle) {
61444
61447
  fs: fs
61445
61448
  };
61446
61449
  }
61450
+ function parseFormattedNumberText(text) {
61451
+ if (text == null) return undefined;
61452
+ var compact = String(text).replace(/[\s\u00a0\u2007\u202f]/g, "");
61453
+ if (compact === "") return undefined;
61454
+ var str = compact;
61455
+ var negative = false;
61456
+ if (/^\(.*\)$/.test(str)) {
61457
+ negative = true;
61458
+ str = str.slice(1, -1);
61459
+ }
61460
+ str = str.replace(/^[+-]?[¥¥$€£₽₩₺₹]/, function (matched) {
61461
+ return matched.replace(/[¥¥$€£₽₩₺₹]/g, "");
61462
+ });
61463
+ str = str.replace(/[¥¥$€£₽₩₺₹]$/, "");
61464
+ var percent = false;
61465
+ if (/%$/.test(str)) {
61466
+ percent = true;
61467
+ str = str.slice(0, -1);
61468
+ }
61469
+ if (/^[+-]?\d{1,3}(,\d{3})+(\.\d+)?$/.test(str)) {
61470
+ str = str.replace(/,/g, "");
61471
+ }
61472
+ if (str === compact) return undefined;
61473
+ if (!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(str)) {
61474
+ return undefined;
61475
+ }
61476
+ var num = Number(str);
61477
+ if (!Number.isFinite(num)) return undefined;
61478
+ if (percent) return num / 100;
61479
+ return negative ? -num : num;
61480
+ }
61447
61481
  function getClipboardData(ctx, e, copyRich, startRow, startCol) {
61448
61482
  var _ctx$luckysheetfile, _currentSheet$data, _currentSheet$data2, _currentSheet$data2$;
61449
61483
  var clipboardData = e.clipboardData;
@@ -61491,6 +61525,7 @@ function getClipboardData(ctx, e, copyRich, startRow, startCol) {
61491
61525
  }
61492
61526
  var offsetColIndex = 0;
61493
61527
  for (var cIndex = 0; cIndex < cells.length; cIndex += 1) {
61528
+ var _cell$getAttribute;
61494
61529
  var _colIndex = startCol + offsetColIndex;
61495
61530
  var cell = cells[cIndex];
61496
61531
  if (cell === null) {
@@ -61499,7 +61534,10 @@ function getClipboardData(ctx, e, copyRich, startRow, startCol) {
61499
61534
  }
61500
61535
  var m = cell === null || cell === void 0 ? void 0 : cell.textContent;
61501
61536
  var allV = JSON.parse(cell.getAttribute("_v") || "{}");
61502
- var v = cell.getAttribute("x:num");
61537
+ var v = (_cell$getAttribute = cell.getAttribute("x:num")) !== null && _cell$getAttribute !== void 0 ? _cell$getAttribute : undefined;
61538
+ if (v == null && cell.getAttribute("x:str") == null) {
61539
+ v = parseFormattedNumberText(m);
61540
+ }
61503
61541
  var f = cell.getAttribute("f");
61504
61542
  if (copyRich) {
61505
61543
  var style = iframe.contentWindow.getComputedStyle(cell);
package/dist/index.js CHANGED
@@ -57733,6 +57733,9 @@ var defaultSettings = {
57733
57733
  showFormulaBar: true,
57734
57734
  showSheetTabs: true,
57735
57735
  showAddSheetButton: true,
57736
+ showGridLinesControl: true,
57737
+ showHeadersControl: true,
57738
+ showZoomControl: true,
57736
57739
  onAddSheetClick: undefined,
57737
57740
  onSheetRename: undefined,
57738
57741
  onSheetDelete: undefined,
@@ -61454,6 +61457,37 @@ function domStyleToCellAttr(domStyle) {
61454
61457
  fs: fs
61455
61458
  };
61456
61459
  }
61460
+ function parseFormattedNumberText(text) {
61461
+ if (text == null) return undefined;
61462
+ var compact = String(text).replace(/[\s\u00a0\u2007\u202f]/g, "");
61463
+ if (compact === "") return undefined;
61464
+ var str = compact;
61465
+ var negative = false;
61466
+ if (/^\(.*\)$/.test(str)) {
61467
+ negative = true;
61468
+ str = str.slice(1, -1);
61469
+ }
61470
+ str = str.replace(/^[+-]?[¥¥$€£₽₩₺₹]/, function (matched) {
61471
+ return matched.replace(/[¥¥$€£₽₩₺₹]/g, "");
61472
+ });
61473
+ str = str.replace(/[¥¥$€£₽₩₺₹]$/, "");
61474
+ var percent = false;
61475
+ if (/%$/.test(str)) {
61476
+ percent = true;
61477
+ str = str.slice(0, -1);
61478
+ }
61479
+ if (/^[+-]?\d{1,3}(,\d{3})+(\.\d+)?$/.test(str)) {
61480
+ str = str.replace(/,/g, "");
61481
+ }
61482
+ if (str === compact) return undefined;
61483
+ if (!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(str)) {
61484
+ return undefined;
61485
+ }
61486
+ var num = Number(str);
61487
+ if (!Number.isFinite(num)) return undefined;
61488
+ if (percent) return num / 100;
61489
+ return negative ? -num : num;
61490
+ }
61457
61491
  function getClipboardData(ctx, e, copyRich, startRow, startCol) {
61458
61492
  var _ctx$luckysheetfile, _currentSheet$data, _currentSheet$data2, _currentSheet$data2$;
61459
61493
  var clipboardData = e.clipboardData;
@@ -61501,6 +61535,7 @@ function getClipboardData(ctx, e, copyRich, startRow, startCol) {
61501
61535
  }
61502
61536
  var offsetColIndex = 0;
61503
61537
  for (var cIndex = 0; cIndex < cells.length; cIndex += 1) {
61538
+ var _cell$getAttribute;
61504
61539
  var _colIndex = startCol + offsetColIndex;
61505
61540
  var cell = cells[cIndex];
61506
61541
  if (cell === null) {
@@ -61509,7 +61544,10 @@ function getClipboardData(ctx, e, copyRich, startRow, startCol) {
61509
61544
  }
61510
61545
  var m = cell === null || cell === void 0 ? void 0 : cell.textContent;
61511
61546
  var allV = JSON.parse(cell.getAttribute("_v") || "{}");
61512
- var v = cell.getAttribute("x:num");
61547
+ var v = (_cell$getAttribute = cell.getAttribute("x:num")) !== null && _cell$getAttribute !== void 0 ? _cell$getAttribute : undefined;
61548
+ if (v == null && cell.getAttribute("x:str") == null) {
61549
+ v = parseFormattedNumberText(m);
61550
+ }
61513
61551
  var f = cell.getAttribute("f");
61514
61552
  if (copyRich) {
61515
61553
  var style = iframe.contentWindow.getComputedStyle(cell);
@@ -185,6 +185,9 @@ export type Settings = {
185
185
  showFormulaBar?: boolean;
186
186
  showSheetTabs?: boolean;
187
187
  showAddSheetButton?: boolean;
188
+ showGridLinesControl?: boolean;
189
+ showHeadersControl?: boolean;
190
+ showZoomControl?: boolean;
188
191
  onAddSheetClick?: (() => void) | undefined;
189
192
  onSheetRename?: ((newName: string) => void) | undefined;
190
193
  onSheetDelete?: ((sheetId: string, sheet: Sheet) => void) | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "7.0.34",
3
+ "version": "7.0.36",
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.34",
16
+ "@leankylin-sheet/formula-parser": "7.0.36",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",