@leankylin-sheet/core 2.0.20 → 2.0.22

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
@@ -44935,10 +44935,16 @@ var make_ssf = function make_ssf(SSF) {
44935
44935
  }
44936
44936
  function format(fmt, v, o) {
44937
44937
  if (fmt === null || fmt === void 0 ? void 0 : fmt.includes('leanky_n')) {
44938
+ if (isNaN(v)) {
44939
+ return '#VALUE!';
44940
+ }
44938
44941
  var precision = fmt.replace('leanky_n', '');
44939
44942
  return numberThousands(v, ',', precision);
44940
44943
  }
44941
44944
  if (fmt === null || fmt === void 0 ? void 0 : fmt.includes('leanky_p')) {
44945
+ if (isNaN(v)) {
44946
+ return '#VALUE!';
44947
+ }
44942
44948
  var _precision = fmt.replace('leanky_p', '');
44943
44949
  return numberThousands(v * 100, ',', _precision) + '%';
44944
44950
  }
@@ -49918,28 +49924,15 @@ function setCellValue(ctx, r, c, d, v) {
49918
49924
  if (cell.v === Infinity || cell.v === -Infinity) {
49919
49925
  cell.m = cell.v.toString();
49920
49926
  } else {
49921
- if (cell.v.toString().indexOf("e") > -1) {
49922
- var len;
49923
- if (cell.v.toString().split(".").length === 1) {
49924
- len = 0;
49925
- } else {
49926
- len = cell.v.toString().split(".")[1].split("e")[0].length;
49927
+ var v_p = Math.round(cell.v * 1000000000) / 1000000000;
49928
+ if (_.isNil(cell.ct)) {
49929
+ var mask = genarate(v_p);
49930
+ if (mask != null) {
49931
+ cell.m = mask[0].toString();
49927
49932
  }
49928
- if (len > 5) {
49929
- len = 5;
49930
- }
49931
- cell.m = cell.v.toExponential(len).toString();
49932
49933
  } else {
49933
- var v_p = Math.round(cell.v * 1000000000) / 1000000000;
49934
- if (_.isNil(cell.ct)) {
49935
- var mask = genarate(v_p);
49936
- if (mask != null) {
49937
- cell.m = mask[0].toString();
49938
- }
49939
- } else {
49940
- var _mask = update(cell.ct.fa, v_p);
49941
- cell.m = _mask.toString();
49942
- }
49934
+ var _mask = update(cell.ct.fa, v_p);
49935
+ cell.m = _mask.toString();
49943
49936
  }
49944
49937
  }
49945
49938
  } else if (!_.isNil(cell.ct) && cell.ct.fa === "@") {
package/dist/index.js CHANGED
@@ -44945,10 +44945,16 @@ var make_ssf = function make_ssf(SSF) {
44945
44945
  }
44946
44946
  function format(fmt, v, o) {
44947
44947
  if (fmt === null || fmt === void 0 ? void 0 : fmt.includes('leanky_n')) {
44948
+ if (isNaN(v)) {
44949
+ return '#VALUE!';
44950
+ }
44948
44951
  var precision = fmt.replace('leanky_n', '');
44949
44952
  return numberThousands(v, ',', precision);
44950
44953
  }
44951
44954
  if (fmt === null || fmt === void 0 ? void 0 : fmt.includes('leanky_p')) {
44955
+ if (isNaN(v)) {
44956
+ return '#VALUE!';
44957
+ }
44952
44958
  var _precision = fmt.replace('leanky_p', '');
44953
44959
  return numberThousands(v * 100, ',', _precision) + '%';
44954
44960
  }
@@ -49928,28 +49934,15 @@ function setCellValue(ctx, r, c, d, v) {
49928
49934
  if (cell.v === Infinity || cell.v === -Infinity) {
49929
49935
  cell.m = cell.v.toString();
49930
49936
  } else {
49931
- if (cell.v.toString().indexOf("e") > -1) {
49932
- var len;
49933
- if (cell.v.toString().split(".").length === 1) {
49934
- len = 0;
49935
- } else {
49936
- len = cell.v.toString().split(".")[1].split("e")[0].length;
49937
+ var v_p = Math.round(cell.v * 1000000000) / 1000000000;
49938
+ if (___default['default'].isNil(cell.ct)) {
49939
+ var mask = genarate(v_p);
49940
+ if (mask != null) {
49941
+ cell.m = mask[0].toString();
49937
49942
  }
49938
- if (len > 5) {
49939
- len = 5;
49940
- }
49941
- cell.m = cell.v.toExponential(len).toString();
49942
49943
  } else {
49943
- var v_p = Math.round(cell.v * 1000000000) / 1000000000;
49944
- if (___default['default'].isNil(cell.ct)) {
49945
- var mask = genarate(v_p);
49946
- if (mask != null) {
49947
- cell.m = mask[0].toString();
49948
- }
49949
- } else {
49950
- var _mask = update(cell.ct.fa, v_p);
49951
- cell.m = _mask.toString();
49952
- }
49944
+ var _mask = update(cell.ct.fa, v_p);
49945
+ cell.m = _mask.toString();
49953
49946
  }
49954
49947
  }
49955
49948
  } else if (!___default['default'].isNil(cell.ct) && cell.ct.fa === "@") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "2.0.20",
3
+ "version": "2.0.22",
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": "^2.0.20",
16
+ "@leankylin-sheet/formula-parser": "^2.0.22",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",