@syncfusion/ej2-calculate 35.1.39 → 35.1.40
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/ej2-calculate.umd.min.js +2 -2
- package/dist/ej2-calculate.umd.min.js.map +1 -1
- package/dist/es6/ej2-calculate.es2015.js +34 -14
- package/dist/es6/ej2-calculate.es2015.js.map +1 -1
- package/dist/es6/ej2-calculate.es5.js +34 -14
- package/dist/es6/ej2-calculate.es5.js.map +1 -1
- package/dist/global/ej2-calculate.min.js +2 -2
- package/dist/global/ej2-calculate.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/base/calculate.js +3 -3
- package/src/base/parser.js +17 -6
- package/src/formulas/text-extra.js +14 -5
|
@@ -16423,6 +16423,11 @@ var TextExtraFormulas = /** @__PURE__ @class */ (function (_super) {
|
|
|
16423
16423
|
return this.substringSide(args, false);
|
|
16424
16424
|
};
|
|
16425
16425
|
TextExtraFormulas.prototype.substringSide = function (args, fromLeft) {
|
|
16426
|
+
var nestedFormula;
|
|
16427
|
+
if (args && args.length > 0 && args[args.length - 1] === 'nestedFormulaTrue') {
|
|
16428
|
+
nestedFormula = true;
|
|
16429
|
+
args.pop();
|
|
16430
|
+
}
|
|
16426
16431
|
var errCollection = this.parent.getErrorStrings();
|
|
16427
16432
|
if (isNullOrUndefined(args) || (args.length === 1 && args[0] === '')) {
|
|
16428
16433
|
return this.parent.formulaErrorStrings[FormulasErrorsStrings.InvalidArguments];
|
|
@@ -16445,10 +16450,8 @@ var TextExtraFormulas = /** @__PURE__ @class */ (function (_super) {
|
|
|
16445
16450
|
return errCollection[CommonErrors.Value];
|
|
16446
16451
|
}
|
|
16447
16452
|
}
|
|
16448
|
-
|
|
16449
|
-
|
|
16450
|
-
}
|
|
16451
|
-
return count >= text.length ? text : text.substring(text.length - count);
|
|
16453
|
+
var result = fromLeft ? text.substring(0, count) : (count >= text.length ? text : text.substring(text.length - count));
|
|
16454
|
+
return nestedFormula ? this.parent.tic + result + this.parent.tic : result;
|
|
16452
16455
|
};
|
|
16453
16456
|
/**
|
|
16454
16457
|
* Returns a specific number of characters from a text string starting at the position you specify.
|
|
@@ -16544,6 +16547,11 @@ var TextExtraFormulas = /** @__PURE__ @class */ (function (_super) {
|
|
|
16544
16547
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
16545
16548
|
args[_i] = arguments[_i];
|
|
16546
16549
|
}
|
|
16550
|
+
var nestedFormula;
|
|
16551
|
+
if (args && args.length > 0 && args[args.length - 1] === 'nestedFormulaTrue') {
|
|
16552
|
+
nestedFormula = true;
|
|
16553
|
+
args.pop();
|
|
16554
|
+
}
|
|
16547
16555
|
var errCollection = this.parent.getErrorStrings();
|
|
16548
16556
|
if (isNullOrUndefined(args) || args.length !== 1) {
|
|
16549
16557
|
return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
|
|
@@ -16552,7 +16560,8 @@ var TextExtraFormulas = /** @__PURE__ @class */ (function (_super) {
|
|
|
16552
16560
|
if (errCollection.indexOf(text) > -1) {
|
|
16553
16561
|
return text;
|
|
16554
16562
|
}
|
|
16555
|
-
|
|
16563
|
+
var result = text.trim().replace(/\s+/g, ' ');
|
|
16564
|
+
return nestedFormula ? this.parent.tic + result + this.parent.tic : result;
|
|
16556
16565
|
};
|
|
16557
16566
|
/**
|
|
16558
16567
|
* Replaces characters within text.
|
|
@@ -22083,12 +22092,23 @@ var Parser = /** @__PURE__ @class */ (function () {
|
|
|
22083
22092
|
var criteriaStr = this_1.parent.substring(substr, leftBraceIdx, substr.indexOf('}') - leftBraceIdx + 1);
|
|
22084
22093
|
substr = substr.split(criteriaStr).join(criteriaStr.split(argsSep).join(this_1.parent.tic + this_1.parent.tic));
|
|
22085
22094
|
}
|
|
22086
|
-
|
|
22087
|
-
var
|
|
22088
|
-
var
|
|
22089
|
-
|
|
22090
|
-
.
|
|
22091
|
-
|
|
22095
|
+
if ((libFormula === 'VLOOKUP' || libFormula === 'HLOOKUP') && substr.includes('{')) {
|
|
22096
|
+
var searchStartIdx = 0;
|
|
22097
|
+
var leftBraceIdx = substr.indexOf('{', searchStartIdx);
|
|
22098
|
+
while (leftBraceIdx > -1) {
|
|
22099
|
+
var rightBraceIdx = substr.indexOf('}', leftBraceIdx);
|
|
22100
|
+
if (rightBraceIdx > leftBraceIdx) {
|
|
22101
|
+
var criteriaStr = this_1.parent.substring(substr, leftBraceIdx, rightBraceIdx - leftBraceIdx + 1);
|
|
22102
|
+
var protectedStr = criteriaStr.split(';').join(this_1.parent.tic + 'RSEP' + this_1.parent.tic)
|
|
22103
|
+
.split(argsSep).join(this_1.parent.tic + 'CSEP' + this_1.parent.tic);
|
|
22104
|
+
substr = substr.split(criteriaStr).join(protectedStr);
|
|
22105
|
+
searchStartIdx = leftBraceIdx + protectedStr.length;
|
|
22106
|
+
leftBraceIdx = substr.indexOf('{', searchStartIdx);
|
|
22107
|
+
}
|
|
22108
|
+
else {
|
|
22109
|
+
break;
|
|
22110
|
+
}
|
|
22111
|
+
}
|
|
22092
22112
|
}
|
|
22093
22113
|
}
|
|
22094
22114
|
try {
|
|
@@ -23662,7 +23682,7 @@ var Calculate = /** @__PURE__ @class */ (function (_super) {
|
|
|
23662
23682
|
}
|
|
23663
23683
|
if (nestedFormula && libFormula) {
|
|
23664
23684
|
var formulas = ['IF', 'INDEX', 'SORT', 'T', 'EXACT',
|
|
23665
|
-
'PROPER', 'DOLLAR', 'DATE', 'TEXT', 'ISNUMBER'];
|
|
23685
|
+
'PROPER', 'DOLLAR', 'DATE', 'TEXT', 'ISNUMBER', 'TRIM', 'LEFT'];
|
|
23666
23686
|
if (formulas.some(function (formula) { return formula === libFormula; })) {
|
|
23667
23687
|
args.push('nestedFormulaTrue');
|
|
23668
23688
|
}
|
|
@@ -25717,8 +25737,8 @@ var Calculate = /** @__PURE__ @class */ (function (_super) {
|
|
|
25717
25737
|
return { op: op, criteria: criteria };
|
|
25718
25738
|
};
|
|
25719
25739
|
Calculate.prototype.processNestedFormula = function (pText, sFormula, fResult) {
|
|
25720
|
-
if (!fResult.toString().includes('"')) {
|
|
25721
|
-
var formulaEndIdx = pText.
|
|
25740
|
+
if (fResult && !fResult.toString().includes('"')) {
|
|
25741
|
+
var formulaEndIdx = pText.indexOf(sFormula) + sFormula.length;
|
|
25722
25742
|
if (pText[formulaEndIdx] === '"' && this.getErrorStrings().indexOf(fResult.toString()) < 0 &&
|
|
25723
25743
|
!this.isNumber(fResult) && fResult !== this.trueValue && fResult !== this.falseValue) {
|
|
25724
25744
|
return pText.split(sFormula).join('"' + fResult + '"');
|