@fileverse-dev/fortune-core 1.0.61 → 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.
- package/es/modules/cell.js +27 -8
- package/es/modules/formula.js +31 -5
- package/lib/modules/cell.js +27 -8
- package/lib/modules/formula.js +31 -5
- package/package.json +2 -2
package/es/modules/cell.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
1
2
|
import _ from "lodash";
|
|
2
3
|
import { getFlowdata } from "../context";
|
|
3
4
|
import { getSheetIndex, indexToColumnChar, rgbToHex } from "../utils";
|
|
@@ -238,7 +239,11 @@ export function setCellValue(ctx, r, c, d, v) {
|
|
|
238
239
|
cell.m = mask[0].toString();
|
|
239
240
|
cell.ct = mask[1], cell.v = mask[2];
|
|
240
241
|
} else {
|
|
241
|
-
|
|
242
|
+
if (v.m) {
|
|
243
|
+
cell.m = v.m;
|
|
244
|
+
} else {
|
|
245
|
+
cell.m = mask.toString();
|
|
246
|
+
}
|
|
242
247
|
cell.v = vupdate;
|
|
243
248
|
}
|
|
244
249
|
} else {
|
|
@@ -261,7 +266,11 @@ export function setCellValue(ctx, r, c, d, v) {
|
|
|
261
266
|
} else if (cell.v != null) {
|
|
262
267
|
var mask = genarate(cell.v);
|
|
263
268
|
if (mask) {
|
|
264
|
-
|
|
269
|
+
if (v.m) {
|
|
270
|
+
cell.m = v.m;
|
|
271
|
+
} else {
|
|
272
|
+
cell.m = mask[0].toString();
|
|
273
|
+
}
|
|
265
274
|
}
|
|
266
275
|
}
|
|
267
276
|
} else {
|
|
@@ -462,7 +471,7 @@ export function cancelNormalSelected(ctx) {
|
|
|
462
471
|
ctx.formulaCache.rangedrag_row_start = false;
|
|
463
472
|
}
|
|
464
473
|
export function updateCell(ctx, r, c, $input, value, canvas) {
|
|
465
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
474
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
466
475
|
var inputText = $input === null || $input === void 0 ? void 0 : $input.innerText;
|
|
467
476
|
var inputHtml = $input === null || $input === void 0 ? void 0 : $input.innerHTML;
|
|
468
477
|
var flowdata = getFlowdata(ctx);
|
|
@@ -599,12 +608,17 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
599
608
|
}
|
|
600
609
|
} else {
|
|
601
610
|
delFunctionGroup(ctx, r, c);
|
|
602
|
-
execFunctionGroup(ctx, r, c, value);
|
|
603
|
-
isRunExecFunction = false;
|
|
604
611
|
curv = _.cloneDeep(((_e = d === null || d === void 0 ? void 0 : d[r]) === null || _e === void 0 ? void 0 : _e[c]) || {});
|
|
605
612
|
curv.v = value;
|
|
606
613
|
delete curv.f;
|
|
607
614
|
delete curv.spl;
|
|
615
|
+
var decemialCount_1 = ((_f = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _f === void 0 ? void 0 : _f.toString().includes(".")) ? (_g = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _g === void 0 ? void 0 : _g.toString().split(" ")[0].split(".")[1].length : 0;
|
|
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
|
+
if (_typeof(curv) === "object" && (curv === null || curv === void 0 ? void 0 : curv.baseValue)) {
|
|
618
|
+
curv.m = "".concat((parseFloat(value) / (oldValue === null || oldValue === void 0 ? void 0 : oldValue.baseCurrencyPrice)).toFixed(decemialCount_1), " ").concat(coin_1);
|
|
619
|
+
}
|
|
620
|
+
execFunctionGroup(ctx, r, c, curv);
|
|
621
|
+
isRunExecFunction = false;
|
|
608
622
|
if (curv.qp === 1 && "".concat(value).substring(0, 1) !== "'") {
|
|
609
623
|
curv.qp = 0;
|
|
610
624
|
if (curv.ct) {
|
|
@@ -661,13 +675,18 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
661
675
|
isRunExecFunction = false;
|
|
662
676
|
}
|
|
663
677
|
}
|
|
678
|
+
var decemialCount = ((_j = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _j === void 0 ? void 0 : _j.toString().includes(".")) ? (_k = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _k === void 0 ? void 0 : _k.toString().split(" ")[0].split(".")[1].length : 0;
|
|
679
|
+
var coin = (_l = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _l === void 0 ? void 0 : _l.toString().split(" ")[1];
|
|
680
|
+
if (_typeof(value) === "object" && value.baseValue && !(value === null || value === void 0 ? void 0 : value.m)) {
|
|
681
|
+
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);
|
|
682
|
+
}
|
|
664
683
|
setCellValue(ctx, r, c, d, value);
|
|
665
684
|
cancelNormalSelected(ctx);
|
|
666
685
|
if ((curv === null || curv === void 0 ? void 0 : curv.tb) === "2" && curv.v || isInlineStringCell(d[r][c])) {
|
|
667
686
|
var defaultrowlen = ctx.defaultrowlen;
|
|
668
687
|
var cfg = ctx.luckysheetfile[getSheetIndex(ctx, ctx.currentSheetId)].config || {};
|
|
669
|
-
if (!(((
|
|
670
|
-
var cellWidth = ((
|
|
688
|
+
if (!(((_m = cfg.columnlen) === null || _m === void 0 ? void 0 : _m[c]) && ((_o = cfg.rowlen) === null || _o === void 0 ? void 0 : _o[r]))) {
|
|
689
|
+
var cellWidth = ((_p = cfg.columnlen) === null || _p === void 0 ? void 0 : _p[c]) || ctx.defaultcollen;
|
|
671
690
|
var textInfo = canvas ? getCellTextInfo(d[r][c], canvas, ctx, {
|
|
672
691
|
r: r,
|
|
673
692
|
c: c,
|
|
@@ -678,7 +697,7 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
678
697
|
currentRowLen = textInfo.textHeightAll + 2;
|
|
679
698
|
}
|
|
680
699
|
var previousRowHeight = getRowHeight(ctx, [r])[r];
|
|
681
|
-
if (currentRowLen > defaultrowlen && !((
|
|
700
|
+
if (currentRowLen > defaultrowlen && !((_q = cfg.customHeight) === null || _q === void 0 ? void 0 : _q[r]) && previousRowHeight < currentRowLen) {
|
|
682
701
|
if (_.isNil(cfg.rowlen)) cfg.rowlen = {};
|
|
683
702
|
cfg.rowlen[r] = currentRowLen;
|
|
684
703
|
}
|
package/es/modules/formula.js
CHANGED
|
@@ -69,7 +69,7 @@ var FormulaCache = function () {
|
|
|
69
69
|
done(v);
|
|
70
70
|
});
|
|
71
71
|
this.parser.on("callRangeValue", function (startCellCoord, endCellCoord, options, done) {
|
|
72
|
-
var _a, _b, _c, _d;
|
|
72
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
73
73
|
var context = that.parser.context;
|
|
74
74
|
var id = startCellCoord.sheetName == null ? options.sheetId : getSheetIdByName(context, startCellCoord.sheetName);
|
|
75
75
|
if (id == null) throw Error(ERROR_REF);
|
|
@@ -90,23 +90,43 @@ var FormulaCache = function () {
|
|
|
90
90
|
endCol = (_b = flowdata === null || flowdata === void 0 ? void 0 : flowdata[0].length) !== null && _b !== void 0 ? _b : 0;
|
|
91
91
|
}
|
|
92
92
|
if (emptyRow && emptyCol) throw Error(ERROR_REF);
|
|
93
|
+
var cryptoDenomination = "";
|
|
94
|
+
var cryptoDecimal = 0;
|
|
93
95
|
for (var row = startRow; row <= endRow; row += 1) {
|
|
94
96
|
var colFragment = [];
|
|
95
97
|
for (var col = startCol; col <= endCol; col += 1) {
|
|
96
98
|
var cell = ((_c = context === null || context === void 0 ? void 0 : context.formulaCache.execFunctionGlobalData) === null || _c === void 0 ? void 0 : _c["".concat(row, "_").concat(col, "_").concat(id)]) || ((_d = flowdata === null || flowdata === void 0 ? void 0 : flowdata[row]) === null || _d === void 0 ? void 0 : _d[col]);
|
|
97
99
|
var v = that.tryGetCellAsNumber(cell);
|
|
100
|
+
if ((((_e = cell === null || cell === void 0 ? void 0 : cell.m) === null || _e === void 0 ? void 0 : _e.includes("ETH")) || ((_f = cell === null || cell === void 0 ? void 0 : cell.m) === null || _f === void 0 ? void 0 : _f.includes("SOL")) || ((_g = cell === null || cell === void 0 ? void 0 : cell.m) === null || _g === void 0 ? void 0 : _g.includes("BTC"))) && cryptoDenomination !== "Error") {
|
|
101
|
+
var visualString = cell === null || cell === void 0 ? void 0 : cell.m.split(" ");
|
|
102
|
+
if (cryptoDenomination !== "" && cryptoDenomination !== visualString[1]) {
|
|
103
|
+
cryptoDenomination = "Error";
|
|
104
|
+
} else {
|
|
105
|
+
cryptoDenomination = visualString[1];
|
|
106
|
+
}
|
|
107
|
+
cryptoDecimal = visualString[0].includes(".") ? visualString[0].split(".")[1].length : 0;
|
|
108
|
+
}
|
|
98
109
|
colFragment.push(v);
|
|
99
110
|
}
|
|
100
111
|
fragment.push(colFragment);
|
|
101
112
|
}
|
|
113
|
+
if (cryptoDenomination === "Error") {
|
|
114
|
+
cryptoDenomination = "";
|
|
115
|
+
cryptoDecimal = 0;
|
|
116
|
+
}
|
|
102
117
|
if (fragment) {
|
|
103
|
-
done(fragment);
|
|
118
|
+
done(fragment, cryptoDenomination, cryptoDecimal);
|
|
104
119
|
}
|
|
105
120
|
});
|
|
106
121
|
}
|
|
107
122
|
FormulaCache.prototype.tryGetCellAsNumber = function (cell) {
|
|
108
|
-
var _a;
|
|
109
|
-
|
|
123
|
+
var _a, _b, _c, _d;
|
|
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) {
|
|
126
|
+
var splitedNumberString = cell.m.split(" ")[0];
|
|
127
|
+
return Number(splitedNumberString);
|
|
128
|
+
}
|
|
129
|
+
if (((_d = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _d === void 0 ? void 0 : _d.t) === "n") {
|
|
110
130
|
var n = Number(cell === null || cell === void 0 ? void 0 : cell.v);
|
|
111
131
|
return Number.isNaN(n) ? cell.v : n;
|
|
112
132
|
}
|
|
@@ -166,6 +186,7 @@ export function iscelldata(txt) {
|
|
|
166
186
|
return false;
|
|
167
187
|
}
|
|
168
188
|
function addToCellIndexList(ctx, txt, infoObj) {
|
|
189
|
+
console.log("heheeheheh");
|
|
169
190
|
if (_.isNil(txt) || txt.length === 0 || _.isNil(infoObj)) {
|
|
170
191
|
return;
|
|
171
192
|
}
|
|
@@ -693,7 +714,12 @@ export function execfunction(ctx, txt, r, c, id, calcChainSet, isrefresh, notIns
|
|
|
693
714
|
insertUpdateFunctionGroup(ctx, r, c, id, calcChainSet);
|
|
694
715
|
}
|
|
695
716
|
}
|
|
696
|
-
|
|
717
|
+
var finalResult = result;
|
|
718
|
+
if (ctx.formulaCache.parser.cryptoDenomination && ctx.formulaCache.parser.cryptoDenomination !== "") {
|
|
719
|
+
var resultStr = Number(result).toFixed(ctx.formulaCache.parser.cryptoDecimals).toLowerCase();
|
|
720
|
+
finalResult = "".concat(resultStr, " ").concat(ctx.formulaCache.parser.cryptoDenomination);
|
|
721
|
+
}
|
|
722
|
+
return [true, _.isNil(formulaError) ? finalResult : formulaError, txt];
|
|
697
723
|
}
|
|
698
724
|
function insertUpdateDynamicArray(ctx, dynamicArrayItem) {
|
|
699
725
|
var r = dynamicArrayItem.r,
|
package/lib/modules/cell.js
CHANGED
|
@@ -39,6 +39,7 @@ var _inlineString = require("./inline-string");
|
|
|
39
39
|
var _validation = require("./validation");
|
|
40
40
|
var _text = require("./text");
|
|
41
41
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
42
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
42
43
|
function normalizedCellAttr(cell, attr, defaultFontSize) {
|
|
43
44
|
if (defaultFontSize === void 0) {
|
|
44
45
|
defaultFontSize = 10;
|
|
@@ -268,7 +269,11 @@ function setCellValue(ctx, r, c, d, v) {
|
|
|
268
269
|
cell.m = mask[0].toString();
|
|
269
270
|
cell.ct = mask[1], cell.v = mask[2];
|
|
270
271
|
} else {
|
|
271
|
-
|
|
272
|
+
if (v.m) {
|
|
273
|
+
cell.m = v.m;
|
|
274
|
+
} else {
|
|
275
|
+
cell.m = mask.toString();
|
|
276
|
+
}
|
|
272
277
|
cell.v = vupdate;
|
|
273
278
|
}
|
|
274
279
|
} else {
|
|
@@ -291,7 +296,11 @@ function setCellValue(ctx, r, c, d, v) {
|
|
|
291
296
|
} else if (cell.v != null) {
|
|
292
297
|
var mask = (0, _format.genarate)(cell.v);
|
|
293
298
|
if (mask) {
|
|
294
|
-
|
|
299
|
+
if (v.m) {
|
|
300
|
+
cell.m = v.m;
|
|
301
|
+
} else {
|
|
302
|
+
cell.m = mask[0].toString();
|
|
303
|
+
}
|
|
295
304
|
}
|
|
296
305
|
}
|
|
297
306
|
} else {
|
|
@@ -492,7 +501,7 @@ function cancelNormalSelected(ctx) {
|
|
|
492
501
|
ctx.formulaCache.rangedrag_row_start = false;
|
|
493
502
|
}
|
|
494
503
|
function updateCell(ctx, r, c, $input, value, canvas) {
|
|
495
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
504
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
496
505
|
var inputText = $input === null || $input === void 0 ? void 0 : $input.innerText;
|
|
497
506
|
var inputHtml = $input === null || $input === void 0 ? void 0 : $input.innerHTML;
|
|
498
507
|
var flowdata = (0, _context.getFlowdata)(ctx);
|
|
@@ -629,12 +638,17 @@ function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
629
638
|
}
|
|
630
639
|
} else {
|
|
631
640
|
(0, _formula.delFunctionGroup)(ctx, r, c);
|
|
632
|
-
(0, _formula.execFunctionGroup)(ctx, r, c, value);
|
|
633
|
-
isRunExecFunction = false;
|
|
634
641
|
curv = _lodash.default.cloneDeep(((_e = d === null || d === void 0 ? void 0 : d[r]) === null || _e === void 0 ? void 0 : _e[c]) || {});
|
|
635
642
|
curv.v = value;
|
|
636
643
|
delete curv.f;
|
|
637
644
|
delete curv.spl;
|
|
645
|
+
var decemialCount_1 = ((_f = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _f === void 0 ? void 0 : _f.toString().includes(".")) ? (_g = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _g === void 0 ? void 0 : _g.toString().split(" ")[0].split(".")[1].length : 0;
|
|
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
|
+
if (_typeof(curv) === "object" && (curv === null || curv === void 0 ? void 0 : curv.baseValue)) {
|
|
648
|
+
curv.m = "".concat((parseFloat(value) / (oldValue === null || oldValue === void 0 ? void 0 : oldValue.baseCurrencyPrice)).toFixed(decemialCount_1), " ").concat(coin_1);
|
|
649
|
+
}
|
|
650
|
+
(0, _formula.execFunctionGroup)(ctx, r, c, curv);
|
|
651
|
+
isRunExecFunction = false;
|
|
638
652
|
if (curv.qp === 1 && "".concat(value).substring(0, 1) !== "'") {
|
|
639
653
|
curv.qp = 0;
|
|
640
654
|
if (curv.ct) {
|
|
@@ -691,13 +705,18 @@ function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
691
705
|
isRunExecFunction = false;
|
|
692
706
|
}
|
|
693
707
|
}
|
|
708
|
+
var decemialCount = ((_j = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _j === void 0 ? void 0 : _j.toString().includes(".")) ? (_k = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _k === void 0 ? void 0 : _k.toString().split(" ")[0].split(".")[1].length : 0;
|
|
709
|
+
var coin = (_l = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _l === void 0 ? void 0 : _l.toString().split(" ")[1];
|
|
710
|
+
if (_typeof(value) === "object" && value.baseValue && !(value === null || value === void 0 ? void 0 : value.m)) {
|
|
711
|
+
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);
|
|
712
|
+
}
|
|
694
713
|
setCellValue(ctx, r, c, d, value);
|
|
695
714
|
cancelNormalSelected(ctx);
|
|
696
715
|
if ((curv === null || curv === void 0 ? void 0 : curv.tb) === "2" && curv.v || (0, _inlineString.isInlineStringCell)(d[r][c])) {
|
|
697
716
|
var defaultrowlen = ctx.defaultrowlen;
|
|
698
717
|
var cfg = ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)].config || {};
|
|
699
|
-
if (!(((
|
|
700
|
-
var cellWidth = ((
|
|
718
|
+
if (!(((_m = cfg.columnlen) === null || _m === void 0 ? void 0 : _m[c]) && ((_o = cfg.rowlen) === null || _o === void 0 ? void 0 : _o[r]))) {
|
|
719
|
+
var cellWidth = ((_p = cfg.columnlen) === null || _p === void 0 ? void 0 : _p[c]) || ctx.defaultcollen;
|
|
701
720
|
var textInfo = canvas ? (0, _text.getCellTextInfo)(d[r][c], canvas, ctx, {
|
|
702
721
|
r: r,
|
|
703
722
|
c: c,
|
|
@@ -708,7 +727,7 @@ function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
708
727
|
currentRowLen = textInfo.textHeightAll + 2;
|
|
709
728
|
}
|
|
710
729
|
var previousRowHeight = (0, _api.getRowHeight)(ctx, [r])[r];
|
|
711
|
-
if (currentRowLen > defaultrowlen && !((
|
|
730
|
+
if (currentRowLen > defaultrowlen && !((_q = cfg.customHeight) === null || _q === void 0 ? void 0 : _q[r]) && previousRowHeight < currentRowLen) {
|
|
712
731
|
if (_lodash.default.isNil(cfg.rowlen)) cfg.rowlen = {};
|
|
713
732
|
cfg.rowlen[r] = currentRowLen;
|
|
714
733
|
}
|
package/lib/modules/formula.js
CHANGED
|
@@ -99,7 +99,7 @@ var FormulaCache = exports.FormulaCache = function () {
|
|
|
99
99
|
done(v);
|
|
100
100
|
});
|
|
101
101
|
this.parser.on("callRangeValue", function (startCellCoord, endCellCoord, options, done) {
|
|
102
|
-
var _a, _b, _c, _d;
|
|
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
105
|
if (id == null) throw Error(_formulaParser.ERROR_REF);
|
|
@@ -120,23 +120,43 @@ var FormulaCache = exports.FormulaCache = function () {
|
|
|
120
120
|
endCol = (_b = flowdata === null || flowdata === void 0 ? void 0 : flowdata[0].length) !== null && _b !== void 0 ? _b : 0;
|
|
121
121
|
}
|
|
122
122
|
if (emptyRow && emptyCol) throw Error(_formulaParser.ERROR_REF);
|
|
123
|
+
var cryptoDenomination = "";
|
|
124
|
+
var cryptoDecimal = 0;
|
|
123
125
|
for (var row = startRow; row <= endRow; row += 1) {
|
|
124
126
|
var colFragment = [];
|
|
125
127
|
for (var col = startCol; col <= endCol; col += 1) {
|
|
126
128
|
var cell = ((_c = context === null || context === void 0 ? void 0 : context.formulaCache.execFunctionGlobalData) === null || _c === void 0 ? void 0 : _c["".concat(row, "_").concat(col, "_").concat(id)]) || ((_d = flowdata === null || flowdata === void 0 ? void 0 : flowdata[row]) === null || _d === void 0 ? void 0 : _d[col]);
|
|
127
129
|
var v = that.tryGetCellAsNumber(cell);
|
|
130
|
+
if ((((_e = cell === null || cell === void 0 ? void 0 : cell.m) === null || _e === void 0 ? void 0 : _e.includes("ETH")) || ((_f = cell === null || cell === void 0 ? void 0 : cell.m) === null || _f === void 0 ? void 0 : _f.includes("SOL")) || ((_g = cell === null || cell === void 0 ? void 0 : cell.m) === null || _g === void 0 ? void 0 : _g.includes("BTC"))) && cryptoDenomination !== "Error") {
|
|
131
|
+
var visualString = cell === null || cell === void 0 ? void 0 : cell.m.split(" ");
|
|
132
|
+
if (cryptoDenomination !== "" && cryptoDenomination !== visualString[1]) {
|
|
133
|
+
cryptoDenomination = "Error";
|
|
134
|
+
} else {
|
|
135
|
+
cryptoDenomination = visualString[1];
|
|
136
|
+
}
|
|
137
|
+
cryptoDecimal = visualString[0].includes(".") ? visualString[0].split(".")[1].length : 0;
|
|
138
|
+
}
|
|
128
139
|
colFragment.push(v);
|
|
129
140
|
}
|
|
130
141
|
fragment.push(colFragment);
|
|
131
142
|
}
|
|
143
|
+
if (cryptoDenomination === "Error") {
|
|
144
|
+
cryptoDenomination = "";
|
|
145
|
+
cryptoDecimal = 0;
|
|
146
|
+
}
|
|
132
147
|
if (fragment) {
|
|
133
|
-
done(fragment);
|
|
148
|
+
done(fragment, cryptoDenomination, cryptoDecimal);
|
|
134
149
|
}
|
|
135
150
|
});
|
|
136
151
|
}
|
|
137
152
|
FormulaCache.prototype.tryGetCellAsNumber = function (cell) {
|
|
138
|
-
var _a;
|
|
139
|
-
|
|
153
|
+
var _a, _b, _c, _d;
|
|
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) {
|
|
156
|
+
var splitedNumberString = cell.m.split(" ")[0];
|
|
157
|
+
return Number(splitedNumberString);
|
|
158
|
+
}
|
|
159
|
+
if (((_d = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _d === void 0 ? void 0 : _d.t) === "n") {
|
|
140
160
|
var n = Number(cell === null || cell === void 0 ? void 0 : cell.v);
|
|
141
161
|
return Number.isNaN(n) ? cell.v : n;
|
|
142
162
|
}
|
|
@@ -195,6 +215,7 @@ function iscelldata(txt) {
|
|
|
195
215
|
return false;
|
|
196
216
|
}
|
|
197
217
|
function addToCellIndexList(ctx, txt, infoObj) {
|
|
218
|
+
console.log("heheeheheh");
|
|
198
219
|
if (_lodash.default.isNil(txt) || txt.length === 0 || _lodash.default.isNil(infoObj)) {
|
|
199
220
|
return;
|
|
200
221
|
}
|
|
@@ -722,7 +743,12 @@ function execfunction(ctx, txt, r, c, id, calcChainSet, isrefresh, notInsertFunc
|
|
|
722
743
|
insertUpdateFunctionGroup(ctx, r, c, id, calcChainSet);
|
|
723
744
|
}
|
|
724
745
|
}
|
|
725
|
-
|
|
746
|
+
var finalResult = result;
|
|
747
|
+
if (ctx.formulaCache.parser.cryptoDenomination && ctx.formulaCache.parser.cryptoDenomination !== "") {
|
|
748
|
+
var resultStr = Number(result).toFixed(ctx.formulaCache.parser.cryptoDecimals).toLowerCase();
|
|
749
|
+
finalResult = "".concat(resultStr, " ").concat(ctx.formulaCache.parser.cryptoDenomination);
|
|
750
|
+
}
|
|
751
|
+
return [true, _lodash.default.isNil(formulaError) ? finalResult : formulaError, txt];
|
|
726
752
|
}
|
|
727
753
|
function insertUpdateDynamicArray(ctx, dynamicArrayItem) {
|
|
728
754
|
var r = dynamicArrayItem.r,
|
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.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.
|
|
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",
|