@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
|
@@ -14642,6 +14642,11 @@ class TextExtraFormulas extends FormulaModuleBase {
|
|
|
14642
14642
|
return this.substringSide(args, false);
|
|
14643
14643
|
}
|
|
14644
14644
|
substringSide(args, fromLeft) {
|
|
14645
|
+
let nestedFormula;
|
|
14646
|
+
if (args && args.length > 0 && args[args.length - 1] === 'nestedFormulaTrue') {
|
|
14647
|
+
nestedFormula = true;
|
|
14648
|
+
args.pop();
|
|
14649
|
+
}
|
|
14645
14650
|
const errCollection = this.parent.getErrorStrings();
|
|
14646
14651
|
if (isNullOrUndefined(args) || (args.length === 1 && args[0] === '')) {
|
|
14647
14652
|
return this.parent.formulaErrorStrings[FormulasErrorsStrings.InvalidArguments];
|
|
@@ -14664,10 +14669,8 @@ class TextExtraFormulas extends FormulaModuleBase {
|
|
|
14664
14669
|
return errCollection[CommonErrors.Value];
|
|
14665
14670
|
}
|
|
14666
14671
|
}
|
|
14667
|
-
|
|
14668
|
-
|
|
14669
|
-
}
|
|
14670
|
-
return count >= text.length ? text : text.substring(text.length - count);
|
|
14672
|
+
const result = fromLeft ? text.substring(0, count) : (count >= text.length ? text : text.substring(text.length - count));
|
|
14673
|
+
return nestedFormula ? this.parent.tic + result + this.parent.tic : result;
|
|
14671
14674
|
}
|
|
14672
14675
|
/**
|
|
14673
14676
|
* Returns a specific number of characters from a text string starting at the position you specify.
|
|
@@ -14747,6 +14750,11 @@ class TextExtraFormulas extends FormulaModuleBase {
|
|
|
14747
14750
|
* @returns {string | number} - Computed text result or an Excel error token such as `#VALUE!`.
|
|
14748
14751
|
*/
|
|
14749
14752
|
ComputeTRIM(...args) {
|
|
14753
|
+
let nestedFormula;
|
|
14754
|
+
if (args && args.length > 0 && args[args.length - 1] === 'nestedFormulaTrue') {
|
|
14755
|
+
nestedFormula = true;
|
|
14756
|
+
args.pop();
|
|
14757
|
+
}
|
|
14750
14758
|
const errCollection = this.parent.getErrorStrings();
|
|
14751
14759
|
if (isNullOrUndefined(args) || args.length !== 1) {
|
|
14752
14760
|
return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
|
|
@@ -14755,7 +14763,8 @@ class TextExtraFormulas extends FormulaModuleBase {
|
|
|
14755
14763
|
if (errCollection.indexOf(text) > -1) {
|
|
14756
14764
|
return text;
|
|
14757
14765
|
}
|
|
14758
|
-
|
|
14766
|
+
const result = text.trim().replace(/\s+/g, ' ');
|
|
14767
|
+
return nestedFormula ? this.parent.tic + result + this.parent.tic : result;
|
|
14759
14768
|
}
|
|
14760
14769
|
/**
|
|
14761
14770
|
* Replaces characters within text.
|
|
@@ -19701,12 +19710,23 @@ class Parser {
|
|
|
19701
19710
|
const criteriaStr = this.parent.substring(substr, leftBraceIdx, substr.indexOf('}') - leftBraceIdx + 1);
|
|
19702
19711
|
substr = substr.split(criteriaStr).join(criteriaStr.split(argsSep).join(this.parent.tic + this.parent.tic));
|
|
19703
19712
|
}
|
|
19704
|
-
|
|
19705
|
-
|
|
19706
|
-
|
|
19707
|
-
|
|
19708
|
-
.
|
|
19709
|
-
|
|
19713
|
+
if ((libFormula === 'VLOOKUP' || libFormula === 'HLOOKUP') && substr.includes('{')) {
|
|
19714
|
+
let searchStartIdx = 0;
|
|
19715
|
+
let leftBraceIdx = substr.indexOf('{', searchStartIdx);
|
|
19716
|
+
while (leftBraceIdx > -1) {
|
|
19717
|
+
const rightBraceIdx = substr.indexOf('}', leftBraceIdx);
|
|
19718
|
+
if (rightBraceIdx > leftBraceIdx) {
|
|
19719
|
+
const criteriaStr = this.parent.substring(substr, leftBraceIdx, rightBraceIdx - leftBraceIdx + 1);
|
|
19720
|
+
const protectedStr = criteriaStr.split(';').join(this.parent.tic + 'RSEP' + this.parent.tic)
|
|
19721
|
+
.split(argsSep).join(this.parent.tic + 'CSEP' + this.parent.tic);
|
|
19722
|
+
substr = substr.split(criteriaStr).join(protectedStr);
|
|
19723
|
+
searchStartIdx = leftBraceIdx + protectedStr.length;
|
|
19724
|
+
leftBraceIdx = substr.indexOf('{', searchStartIdx);
|
|
19725
|
+
}
|
|
19726
|
+
else {
|
|
19727
|
+
break;
|
|
19728
|
+
}
|
|
19729
|
+
}
|
|
19710
19730
|
}
|
|
19711
19731
|
}
|
|
19712
19732
|
try {
|
|
@@ -21251,7 +21271,7 @@ let Calculate = class Calculate extends Base {
|
|
|
21251
21271
|
}
|
|
21252
21272
|
if (nestedFormula && libFormula) {
|
|
21253
21273
|
const formulas = ['IF', 'INDEX', 'SORT', 'T', 'EXACT',
|
|
21254
|
-
'PROPER', 'DOLLAR', 'DATE', 'TEXT', 'ISNUMBER'];
|
|
21274
|
+
'PROPER', 'DOLLAR', 'DATE', 'TEXT', 'ISNUMBER', 'TRIM', 'LEFT'];
|
|
21255
21275
|
if (formulas.some((formula) => formula === libFormula)) {
|
|
21256
21276
|
args.push('nestedFormulaTrue');
|
|
21257
21277
|
}
|
|
@@ -23297,8 +23317,8 @@ let Calculate = class Calculate extends Base {
|
|
|
23297
23317
|
return { op, criteria };
|
|
23298
23318
|
}
|
|
23299
23319
|
processNestedFormula(pText, sFormula, fResult) {
|
|
23300
|
-
if (!fResult.toString().includes('"')) {
|
|
23301
|
-
const formulaEndIdx = pText.
|
|
23320
|
+
if (fResult && !fResult.toString().includes('"')) {
|
|
23321
|
+
const formulaEndIdx = pText.indexOf(sFormula) + sFormula.length;
|
|
23302
23322
|
if (pText[formulaEndIdx] === '"' && this.getErrorStrings().indexOf(fResult.toString()) < 0 &&
|
|
23303
23323
|
!this.isNumber(fResult) && fResult !== this.trueValue && fResult !== this.falseValue) {
|
|
23304
23324
|
return pText.split(sFormula).join('"' + fResult + '"');
|