@fileverse-dev/fortune-core 1.0.62 → 1.0.64
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/es/modules/cell.js +2 -0
- package/es/modules/formula.js +3 -2
- package/lib/modules/cell.js +2 -0
- package/lib/modules/formula.js +7 -6
- package/package.json +2 -2
package/es/modules/cell.js
CHANGED
|
@@ -616,6 +616,7 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
616
616
|
var coin_1 = (_h = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _h === void 0 ? void 0 : _h.toString().split(" ")[1];
|
|
617
617
|
if (_typeof(curv) === "object" && (curv === null || curv === void 0 ? void 0 : curv.baseValue)) {
|
|
618
618
|
curv.m = "".concat((parseFloat(value) / (oldValue === null || oldValue === void 0 ? void 0 : oldValue.baseCurrencyPrice)).toFixed(decemialCount_1), " ").concat(coin_1);
|
|
619
|
+
curv.baseValue = value;
|
|
619
620
|
}
|
|
620
621
|
execFunctionGroup(ctx, r, c, curv);
|
|
621
622
|
isRunExecFunction = false;
|
|
@@ -679,6 +680,7 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
679
680
|
var coin = (_l = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _l === void 0 ? void 0 : _l.toString().split(" ")[1];
|
|
680
681
|
if (_typeof(value) === "object" && value.baseValue && !(value === null || value === void 0 ? void 0 : value.m)) {
|
|
681
682
|
value.m = "".concat((parseFloat(value === null || value === void 0 ? void 0 : value.v) / (oldValue === null || oldValue === void 0 ? void 0 : oldValue.baseCurrencyPrice)).toFixed(decemialCount), " ").concat(coin);
|
|
683
|
+
value.baseValue = value === null || value === void 0 ? void 0 : value.v;
|
|
682
684
|
}
|
|
683
685
|
setCellValue(ctx, r, c, d, value);
|
|
684
686
|
cancelNormalSelected(ctx);
|
package/es/modules/formula.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
}
|
package/lib/modules/cell.js
CHANGED
|
@@ -646,6 +646,7 @@ function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
646
646
|
var coin_1 = (_h = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _h === void 0 ? void 0 : _h.toString().split(" ")[1];
|
|
647
647
|
if (_typeof(curv) === "object" && (curv === null || curv === void 0 ? void 0 : curv.baseValue)) {
|
|
648
648
|
curv.m = "".concat((parseFloat(value) / (oldValue === null || oldValue === void 0 ? void 0 : oldValue.baseCurrencyPrice)).toFixed(decemialCount_1), " ").concat(coin_1);
|
|
649
|
+
curv.baseValue = value;
|
|
649
650
|
}
|
|
650
651
|
(0, _formula.execFunctionGroup)(ctx, r, c, curv);
|
|
651
652
|
isRunExecFunction = false;
|
|
@@ -709,6 +710,7 @@ function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
709
710
|
var coin = (_l = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _l === void 0 ? void 0 : _l.toString().split(" ")[1];
|
|
710
711
|
if (_typeof(value) === "object" && value.baseValue && !(value === null || value === void 0 ? void 0 : value.m)) {
|
|
711
712
|
value.m = "".concat((parseFloat(value === null || value === void 0 ? void 0 : value.v) / (oldValue === null || oldValue === void 0 ? void 0 : oldValue.baseCurrencyPrice)).toFixed(decemialCount), " ").concat(coin);
|
|
713
|
+
value.baseValue = value === null || value === void 0 ? void 0 : value.v;
|
|
712
714
|
}
|
|
713
715
|
setCellValue(ctx, r, c, d, value);
|
|
714
716
|
cancelNormalSelected(ctx);
|
package/lib/modules/formula.js
CHANGED
|
@@ -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
|
|
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
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "1.0.64",
|
|
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.
|
|
18
|
+
"@fileverse-dev/formula-parser": "0.2.41",
|
|
19
19
|
"dayjs": "^1.11.0",
|
|
20
20
|
"immer": "^9.0.12",
|
|
21
21
|
"lodash": "^4.17.21",
|