@syncfusion/ej2-calculate 35.1.37 → 35.1.39
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 +55 -3
- package/dist/es6/ej2-calculate.es2015.js.map +1 -1
- package/dist/es6/ej2-calculate.es5.js +55 -3
- 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 +3 -3
- package/src/base/calculate.js +48 -3
- package/src/base/parser.js +7 -0
|
@@ -19701,6 +19701,13 @@ class Parser {
|
|
|
19701
19701
|
const criteriaStr = this.parent.substring(substr, leftBraceIdx, substr.indexOf('}') - leftBraceIdx + 1);
|
|
19702
19702
|
substr = substr.split(criteriaStr).join(criteriaStr.split(argsSep).join(this.parent.tic + this.parent.tic));
|
|
19703
19703
|
}
|
|
19704
|
+
else if ((libFormula === 'VLOOKUP' || libFormula === 'HLOOKUP') && substr.includes('{')) {
|
|
19705
|
+
const leftBraceIdx = substr.indexOf('{');
|
|
19706
|
+
const criteriaStr = this.parent.substring(substr, leftBraceIdx, substr.indexOf('}') - leftBraceIdx + 1);
|
|
19707
|
+
const protectedStr = criteriaStr.split(';').join(this.parent.tic + 'RSEP' + this.parent.tic)
|
|
19708
|
+
.split(argsSep).join(this.parent.tic + 'CSEP' + this.parent.tic);
|
|
19709
|
+
substr = substr.split(criteriaStr).join(protectedStr);
|
|
19710
|
+
}
|
|
19704
19711
|
}
|
|
19705
19712
|
try {
|
|
19706
19713
|
let args;
|
|
@@ -21633,7 +21640,52 @@ let Calculate = class Calculate extends Base {
|
|
|
21633
21640
|
return errorStrings[CommonErrors.Value];
|
|
21634
21641
|
}
|
|
21635
21642
|
}
|
|
21636
|
-
const
|
|
21643
|
+
const rangeArg = argArr[1];
|
|
21644
|
+
const rowSepMarker = this.tic + 'RSEP' + this.tic;
|
|
21645
|
+
const isInlineArray = rangeArg.includes(rowSepMarker) ||
|
|
21646
|
+
(rangeArg.startsWith('(') && rangeArg.endsWith(')') && rangeArg.includes(rowSepMarker));
|
|
21647
|
+
if (isInlineArray) {
|
|
21648
|
+
const innerStr = rangeArg.startsWith('(') && rangeArg.endsWith(')')
|
|
21649
|
+
? rangeArg.substring(1, rangeArg.length - 1) : rangeArg;
|
|
21650
|
+
const rowBoundary = this.tic + 'RSEP' + this.tic;
|
|
21651
|
+
const colBoundary = this.tic + 'CSEP' + this.tic;
|
|
21652
|
+
const rows = innerStr.split(rowBoundary).map((rowStr) => {
|
|
21653
|
+
return rowStr.split(colBoundary).map((cell) => {
|
|
21654
|
+
if (cell.startsWith(this.tic) && cell.endsWith(this.tic)) {
|
|
21655
|
+
return cell.substring(1, cell.length - 1);
|
|
21656
|
+
}
|
|
21657
|
+
if (this.isCellReference(cell.trim())) {
|
|
21658
|
+
return this.getValueFromArg(cell.trim());
|
|
21659
|
+
}
|
|
21660
|
+
return cell.trim();
|
|
21661
|
+
});
|
|
21662
|
+
});
|
|
21663
|
+
const numRows = rows.length;
|
|
21664
|
+
const numCols = rows[0] ? rows[0].length : 0;
|
|
21665
|
+
const matchColIdx = colNumIdx - 1;
|
|
21666
|
+
if (isVlookup && numCols <= matchColIdx) {
|
|
21667
|
+
return errorStrings[CommonErrors.Ref];
|
|
21668
|
+
}
|
|
21669
|
+
if (!isVlookup && numRows <= matchColIdx) {
|
|
21670
|
+
return errorStrings[CommonErrors.Ref];
|
|
21671
|
+
}
|
|
21672
|
+
const lookupValUpper = lookupValue.toUpperCase();
|
|
21673
|
+
const iterCount = isVlookup ? numRows : numCols;
|
|
21674
|
+
for (let r = 0; r < iterCount; r++) {
|
|
21675
|
+
const cellVal = (isVlookup ? rows[r][0] : rows[0][r]) || '';
|
|
21676
|
+
const isMatch = this.isNumber(lookupValue) && this.isNumber(cellVal)
|
|
21677
|
+
? this.parseFloat(lookupValue) === this.parseFloat(cellVal) : cellVal.toUpperCase() === lookupValUpper;
|
|
21678
|
+
if (isMatch) {
|
|
21679
|
+
const matchVal = isVlookup
|
|
21680
|
+
? (rows[r][matchColIdx] !== undefined ? rows[r][matchColIdx] : '')
|
|
21681
|
+
: (rows[matchColIdx] !== undefined && rows[matchColIdx][r] !== undefined
|
|
21682
|
+
? rows[matchColIdx][r] : '');
|
|
21683
|
+
return matchVal !== '' ? matchVal : '';
|
|
21684
|
+
}
|
|
21685
|
+
}
|
|
21686
|
+
return errorStrings[CommonErrors.NA];
|
|
21687
|
+
}
|
|
21688
|
+
const rangeArr = rangeArg.split(':');
|
|
21637
21689
|
let startIdx;
|
|
21638
21690
|
let endIdx;
|
|
21639
21691
|
let idx;
|
|
@@ -23245,8 +23297,8 @@ let Calculate = class Calculate extends Base {
|
|
|
23245
23297
|
return { op, criteria };
|
|
23246
23298
|
}
|
|
23247
23299
|
processNestedFormula(pText, sFormula, fResult) {
|
|
23248
|
-
if (
|
|
23249
|
-
const formulaEndIdx = pText.
|
|
23300
|
+
if (!fResult.toString().includes('"')) {
|
|
23301
|
+
const formulaEndIdx = pText.lastIndexOf(sFormula) + sFormula.length;
|
|
23250
23302
|
if (pText[formulaEndIdx] === '"' && this.getErrorStrings().indexOf(fResult.toString()) < 0 &&
|
|
23251
23303
|
!this.isNumber(fResult) && fResult !== this.trueValue && fResult !== this.falseValue) {
|
|
23252
23304
|
return pText.split(sFormula).join('"' + fResult + '"');
|