@fileverse-dev/fortune-core 1.0.62 → 1.0.63

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.
@@ -18,7 +18,7 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
18
18
  return to.concat(ar || Array.prototype.slice.call(from));
19
19
  };
20
20
  import _ from "lodash";
21
- import { Parser, ERROR_REF } from "@fileverse-dev/formula-parser/src/index";
21
+ import { Parser, ERROR_REF } from "@fileverse-dev/formula-parser";
22
22
  import { getFlowdata } from "../context";
23
23
  import { columnCharToIndex, escapeScriptTag, getSheetIndex, indexToColumnChar, getSheetIdByName, escapeHTMLTag } from "../utils";
24
24
  import { getcellFormula, getRangetxt, mergeMoveMain, setCellValue } from "./cell";
@@ -121,7 +121,8 @@ var FormulaCache = function () {
121
121
  }
122
122
  FormulaCache.prototype.tryGetCellAsNumber = function (cell) {
123
123
  var _a, _b, _c, _d;
124
- if (((_a = cell.m) === null || _a === void 0 ? void 0 : _a.includes("ETH")) || ((_b = cell.m) === null || _b === void 0 ? void 0 : _b.includes("SOL")) || ((_c = cell.m) === null || _c === void 0 ? void 0 : _c.includes("BTC"))) {
124
+ var isCryptoDeno = ((_a = cell === null || cell === void 0 ? void 0 : cell.m) === null || _a === void 0 ? void 0 : _a.includes("ETH")) || ((_b = cell === null || cell === void 0 ? void 0 : cell.m) === null || _b === void 0 ? void 0 : _b.includes("SOL")) || ((_c = cell === null || cell === void 0 ? void 0 : cell.m) === null || _c === void 0 ? void 0 : _c.includes("BTC"));
125
+ if (isCryptoDeno) {
125
126
  var splitedNumberString = cell.m.split(" ")[0];
126
127
  return Number(splitedNumberString);
127
128
  }
@@ -28,7 +28,7 @@ exports.rangeHightlightselected = rangeHightlightselected;
28
28
  exports.rangeSetValue = rangeSetValue;
29
29
  exports.setCaretPosition = setCaretPosition;
30
30
  var _lodash = _interopRequireDefault(require("lodash"));
31
- var _index = require("@fileverse-dev/formula-parser/src/index");
31
+ var _formulaParser = require("@fileverse-dev/formula-parser");
32
32
  var _context = require("../context");
33
33
  var _utils = require("../utils");
34
34
  var _cell = require("./cell");
@@ -87,12 +87,12 @@ var FormulaCache = exports.FormulaCache = function () {
87
87
  this.functionlistMap = {};
88
88
  this.execFunctionGlobalData = {};
89
89
  this.cellTextToIndexList = {};
90
- this.parser = new _index.Parser();
90
+ this.parser = new _formulaParser.Parser();
91
91
  this.parser.on("callCellValue", function (cellCoord, options, done) {
92
92
  var _a, _b;
93
93
  var context = that.parser.context;
94
94
  var id = cellCoord.sheetName == null ? options.sheetId : (0, _utils.getSheetIdByName)(context, cellCoord.sheetName);
95
- if (id == null) throw Error(_index.ERROR_REF);
95
+ if (id == null) throw Error(_formulaParser.ERROR_REF);
96
96
  var flowdata = (0, _context.getFlowdata)(context, id);
97
97
  var cell = ((_a = context === null || context === void 0 ? void 0 : context.formulaCache.execFunctionGlobalData) === null || _a === void 0 ? void 0 : _a["".concat(cellCoord.row.index, "_").concat(cellCoord.column.index, "_").concat(id)]) || ((_b = flowdata === null || flowdata === void 0 ? void 0 : flowdata[cellCoord.row.index]) === null || _b === void 0 ? void 0 : _b[cellCoord.column.index]);
98
98
  var v = that.tryGetCellAsNumber(cell);
@@ -102,7 +102,7 @@ var FormulaCache = exports.FormulaCache = function () {
102
102
  var _a, _b, _c, _d, _e, _f, _g;
103
103
  var context = that.parser.context;
104
104
  var id = startCellCoord.sheetName == null ? options.sheetId : (0, _utils.getSheetIdByName)(context, startCellCoord.sheetName);
105
- if (id == null) throw Error(_index.ERROR_REF);
105
+ if (id == null) throw Error(_formulaParser.ERROR_REF);
106
106
  var flowdata = (0, _context.getFlowdata)(context, id);
107
107
  var fragment = [];
108
108
  var startRow = startCellCoord.row.index;
@@ -119,7 +119,7 @@ var FormulaCache = exports.FormulaCache = function () {
119
119
  startCol = 0;
120
120
  endCol = (_b = flowdata === null || flowdata === void 0 ? void 0 : flowdata[0].length) !== null && _b !== void 0 ? _b : 0;
121
121
  }
122
- if (emptyRow && emptyCol) throw Error(_index.ERROR_REF);
122
+ if (emptyRow && emptyCol) throw Error(_formulaParser.ERROR_REF);
123
123
  var cryptoDenomination = "";
124
124
  var cryptoDecimal = 0;
125
125
  for (var row = startRow; row <= endRow; row += 1) {
@@ -151,7 +151,8 @@ var FormulaCache = exports.FormulaCache = function () {
151
151
  }
152
152
  FormulaCache.prototype.tryGetCellAsNumber = function (cell) {
153
153
  var _a, _b, _c, _d;
154
- if (((_a = cell.m) === null || _a === void 0 ? void 0 : _a.includes("ETH")) || ((_b = cell.m) === null || _b === void 0 ? void 0 : _b.includes("SOL")) || ((_c = cell.m) === null || _c === void 0 ? void 0 : _c.includes("BTC"))) {
154
+ var isCryptoDeno = ((_a = cell === null || cell === void 0 ? void 0 : cell.m) === null || _a === void 0 ? void 0 : _a.includes("ETH")) || ((_b = cell === null || cell === void 0 ? void 0 : cell.m) === null || _b === void 0 ? void 0 : _b.includes("SOL")) || ((_c = cell === null || cell === void 0 ? void 0 : cell.m) === null || _c === void 0 ? void 0 : _c.includes("BTC"));
155
+ if (isCryptoDeno) {
155
156
  var splitedNumberString = cell.m.split(" ")[0];
156
157
  return Number(splitedNumberString);
157
158
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.0.62",
3
+ "version": "1.0.63",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -15,7 +15,7 @@
15
15
  "dev": "father-build --watch"
16
16
  },
17
17
  "dependencies": {
18
- "@fileverse-dev/formula-parser": "0.2.39",
18
+ "@fileverse-dev/formula-parser": "0.2.40",
19
19
  "dayjs": "^1.11.0",
20
20
  "immer": "^9.0.12",
21
21
  "lodash": "^4.17.21",