@leankylin-sheet/core 1.2.17 → 1.2.19

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
@@ -44926,8 +44926,9 @@ var make_ssf = function make_ssf(SSF) {
44926
44926
  return [l, ff];
44927
44927
  }
44928
44928
  function format(fmt, v, o) {
44929
- if (fmt === 'leanky_n') {
44930
- return numberThousands(v);
44929
+ if (fmt === null || fmt === void 0 ? void 0 : fmt.includes('leanky_n')) {
44930
+ var precision = fmt.replace('leanky_n', '');
44931
+ return numberThousands(v, ',', precision);
44931
44932
  }
44932
44933
  if (o == null) o = {};
44933
44934
  var sfmt = "";
@@ -45104,18 +45105,23 @@ var intThousands = function intThousands(number) {
45104
45105
  };
45105
45106
  var numberThousands = function numberThousands(number) {
45106
45107
  var groupSeparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';
45108
+ var precision = arguments.length > 2 ? arguments[2] : undefined;
45107
45109
  if (number === 0) return '0';
45108
45110
  if (!number) return number;
45109
- if (String(number).includes('.')) {
45110
- var _String$split = String(number).split('.'),
45111
+ var _number = !['', undefined].includes(precision) ? formatNumber(number, precision) : number;
45112
+ if (String(_number).includes('.')) {
45113
+ var _String$split = String(_number).split('.'),
45111
45114
  _String$split2 = _slicedToArray(_String$split, 2),
45112
45115
  init = _String$split2[0],
45113
45116
  decimal = _String$split2[1];
45114
45117
  return intThousands(init, groupSeparator) + '.' + decimal;
45115
45118
  } else {
45116
- return intThousands(number, groupSeparator);
45119
+ return intThousands(_number, groupSeparator);
45117
45120
  }
45118
45121
  };
45122
+ function formatNumber(num, precision) {
45123
+ return parseFloat(Number(num).toFixed(precision));
45124
+ }
45119
45125
 
45120
45126
  var base1904 = new Date(1900, 2, 1, 0, 0, 0);
45121
45127
  function datenum_local(v, date1904) {
@@ -52330,10 +52336,11 @@ function copy(ctx) {
52330
52336
  for (var r = rows[0]; r <= rows[1]; r += 1) {
52331
52337
  cpString += "<tr>";
52332
52338
  for (var c = columns[0]; c <= columns[1]; c += 1) {
52333
- var _flowdata$r, _ref, _data$m;
52339
+ var _flowdata$r, _ref, _data$m, _ref2, _data$v;
52334
52340
  var data = flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r = flowdata[r]) === null || _flowdata$r === void 0 ? void 0 : _flowdata$r[c];
52335
52341
  var value = (_ref = (_data$m = data === null || data === void 0 ? void 0 : data.m) !== null && _data$m !== void 0 ? _data$m : data === null || data === void 0 ? void 0 : data.v) !== null && _ref !== void 0 ? _ref : "";
52336
- cpString += "<td> ".concat(value, " </td>");
52342
+ var realValue = (_ref2 = (_data$v = data === null || data === void 0 ? void 0 : data.v) !== null && _data$v !== void 0 ? _data$v : data === null || data === void 0 ? void 0 : data.m) !== null && _ref2 !== void 0 ? _ref2 : "";
52343
+ cpString += "<td x:num=".concat(realValue, "> ").concat(value, " </td>");
52337
52344
  }
52338
52345
  cpString += "</tr>";
52339
52346
  }
@@ -69464,9 +69471,10 @@ function getClipboardData(e) {
69464
69471
  var cells = row.querySelectorAll("td");
69465
69472
  var rowData = [];
69466
69473
  for (var cIndex = 0; cIndex < cells.length; cIndex += 1) {
69467
- var _cell$textContent$tri, _cell$textContent;
69474
+ var _ref, _cell$getAttribute, _cell$textContent;
69468
69475
  var cell = cells[cIndex];
69469
- rowData.push((_cell$textContent$tri = cell === null || cell === void 0 ? void 0 : (_cell$textContent = cell.textContent) === null || _cell$textContent === void 0 ? void 0 : _cell$textContent.trim()) !== null && _cell$textContent$tri !== void 0 ? _cell$textContent$tri : "");
69476
+ var value = (_ref = (_cell$getAttribute = cell.getAttribute("x:num")) !== null && _cell$getAttribute !== void 0 ? _cell$getAttribute : cell === null || cell === void 0 ? void 0 : (_cell$textContent = cell.textContent) === null || _cell$textContent === void 0 ? void 0 : _cell$textContent.trim()) !== null && _ref !== void 0 ? _ref : "";
69477
+ rowData.push(value);
69470
69478
  }
69471
69479
  result.push(rowData);
69472
69480
  }
package/dist/index.js CHANGED
@@ -44936,8 +44936,9 @@ var make_ssf = function make_ssf(SSF) {
44936
44936
  return [l, ff];
44937
44937
  }
44938
44938
  function format(fmt, v, o) {
44939
- if (fmt === 'leanky_n') {
44940
- return numberThousands(v);
44939
+ if (fmt === null || fmt === void 0 ? void 0 : fmt.includes('leanky_n')) {
44940
+ var precision = fmt.replace('leanky_n', '');
44941
+ return numberThousands(v, ',', precision);
44941
44942
  }
44942
44943
  if (o == null) o = {};
44943
44944
  var sfmt = "";
@@ -45114,18 +45115,23 @@ var intThousands = function intThousands(number) {
45114
45115
  };
45115
45116
  var numberThousands = function numberThousands(number) {
45116
45117
  var groupSeparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';
45118
+ var precision = arguments.length > 2 ? arguments[2] : undefined;
45117
45119
  if (number === 0) return '0';
45118
45120
  if (!number) return number;
45119
- if (String(number).includes('.')) {
45120
- var _String$split = String(number).split('.'),
45121
+ var _number = !['', undefined].includes(precision) ? formatNumber(number, precision) : number;
45122
+ if (String(_number).includes('.')) {
45123
+ var _String$split = String(_number).split('.'),
45121
45124
  _String$split2 = _slicedToArray(_String$split, 2),
45122
45125
  init = _String$split2[0],
45123
45126
  decimal = _String$split2[1];
45124
45127
  return intThousands(init, groupSeparator) + '.' + decimal;
45125
45128
  } else {
45126
- return intThousands(number, groupSeparator);
45129
+ return intThousands(_number, groupSeparator);
45127
45130
  }
45128
45131
  };
45132
+ function formatNumber(num, precision) {
45133
+ return parseFloat(Number(num).toFixed(precision));
45134
+ }
45129
45135
 
45130
45136
  var base1904 = new Date(1900, 2, 1, 0, 0, 0);
45131
45137
  function datenum_local(v, date1904) {
@@ -52340,10 +52346,11 @@ function copy(ctx) {
52340
52346
  for (var r = rows[0]; r <= rows[1]; r += 1) {
52341
52347
  cpString += "<tr>";
52342
52348
  for (var c = columns[0]; c <= columns[1]; c += 1) {
52343
- var _flowdata$r, _ref, _data$m;
52349
+ var _flowdata$r, _ref, _data$m, _ref2, _data$v;
52344
52350
  var data = flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r = flowdata[r]) === null || _flowdata$r === void 0 ? void 0 : _flowdata$r[c];
52345
52351
  var value = (_ref = (_data$m = data === null || data === void 0 ? void 0 : data.m) !== null && _data$m !== void 0 ? _data$m : data === null || data === void 0 ? void 0 : data.v) !== null && _ref !== void 0 ? _ref : "";
52346
- cpString += "<td> ".concat(value, " </td>");
52352
+ var realValue = (_ref2 = (_data$v = data === null || data === void 0 ? void 0 : data.v) !== null && _data$v !== void 0 ? _data$v : data === null || data === void 0 ? void 0 : data.m) !== null && _ref2 !== void 0 ? _ref2 : "";
52353
+ cpString += "<td x:num=".concat(realValue, "> ").concat(value, " </td>");
52347
52354
  }
52348
52355
  cpString += "</tr>";
52349
52356
  }
@@ -69474,9 +69481,10 @@ function getClipboardData(e) {
69474
69481
  var cells = row.querySelectorAll("td");
69475
69482
  var rowData = [];
69476
69483
  for (var cIndex = 0; cIndex < cells.length; cIndex += 1) {
69477
- var _cell$textContent$tri, _cell$textContent;
69484
+ var _ref, _cell$getAttribute, _cell$textContent;
69478
69485
  var cell = cells[cIndex];
69479
- rowData.push((_cell$textContent$tri = cell === null || cell === void 0 ? void 0 : (_cell$textContent = cell.textContent) === null || _cell$textContent === void 0 ? void 0 : _cell$textContent.trim()) !== null && _cell$textContent$tri !== void 0 ? _cell$textContent$tri : "");
69486
+ var value = (_ref = (_cell$getAttribute = cell.getAttribute("x:num")) !== null && _cell$getAttribute !== void 0 ? _cell$getAttribute : cell === null || cell === void 0 ? void 0 : (_cell$textContent = cell.textContent) === null || _cell$textContent === void 0 ? void 0 : _cell$textContent.trim()) !== null && _ref !== void 0 ? _ref : "";
69487
+ rowData.push(value);
69480
69488
  }
69481
69489
  result.push(rowData);
69482
69490
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "1.2.17",
3
+ "version": "1.2.19",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "typings": "dist/index.d.ts",
@@ -10,7 +10,7 @@
10
10
  "repository": "http://114.55.85.79:19999/leankylin-front/leankylin-sheet",
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
- "@leankylin-sheet/formula-parser": "^1.2.17",
13
+ "@leankylin-sheet/formula-parser": "^1.2.19",
14
14
  "dayjs": "^1.11.0",
15
15
  "immer": "^9.0.12",
16
16
  "lodash": "^4.17.21",