@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
|
@@ -22083,6 +22083,13 @@ var Parser = /** @__PURE__ @class */ (function () {
|
|
|
22083
22083
|
var criteriaStr = this_1.parent.substring(substr, leftBraceIdx, substr.indexOf('}') - leftBraceIdx + 1);
|
|
22084
22084
|
substr = substr.split(criteriaStr).join(criteriaStr.split(argsSep).join(this_1.parent.tic + this_1.parent.tic));
|
|
22085
22085
|
}
|
|
22086
|
+
else if ((libFormula === 'VLOOKUP' || libFormula === 'HLOOKUP') && substr.includes('{')) {
|
|
22087
|
+
var leftBraceIdx = substr.indexOf('{');
|
|
22088
|
+
var criteriaStr = this_1.parent.substring(substr, leftBraceIdx, substr.indexOf('}') - leftBraceIdx + 1);
|
|
22089
|
+
var protectedStr = criteriaStr.split(';').join(this_1.parent.tic + 'RSEP' + this_1.parent.tic)
|
|
22090
|
+
.split(argsSep).join(this_1.parent.tic + 'CSEP' + this_1.parent.tic);
|
|
22091
|
+
substr = substr.split(criteriaStr).join(protectedStr);
|
|
22092
|
+
}
|
|
22086
22093
|
}
|
|
22087
22094
|
try {
|
|
22088
22095
|
var args = void 0;
|
|
@@ -24052,7 +24059,52 @@ var Calculate = /** @__PURE__ @class */ (function (_super) {
|
|
|
24052
24059
|
return errorStrings[CommonErrors.Value];
|
|
24053
24060
|
}
|
|
24054
24061
|
}
|
|
24055
|
-
var
|
|
24062
|
+
var rangeArg = argArr[1];
|
|
24063
|
+
var rowSepMarker = this.tic + 'RSEP' + this.tic;
|
|
24064
|
+
var isInlineArray = rangeArg.includes(rowSepMarker) ||
|
|
24065
|
+
(rangeArg.startsWith('(') && rangeArg.endsWith(')') && rangeArg.includes(rowSepMarker));
|
|
24066
|
+
if (isInlineArray) {
|
|
24067
|
+
var innerStr = rangeArg.startsWith('(') && rangeArg.endsWith(')')
|
|
24068
|
+
? rangeArg.substring(1, rangeArg.length - 1) : rangeArg;
|
|
24069
|
+
var rowBoundary = this.tic + 'RSEP' + this.tic;
|
|
24070
|
+
var colBoundary_1 = this.tic + 'CSEP' + this.tic;
|
|
24071
|
+
var rows = innerStr.split(rowBoundary).map(function (rowStr) {
|
|
24072
|
+
return rowStr.split(colBoundary_1).map(function (cell) {
|
|
24073
|
+
if (cell.startsWith(_this.tic) && cell.endsWith(_this.tic)) {
|
|
24074
|
+
return cell.substring(1, cell.length - 1);
|
|
24075
|
+
}
|
|
24076
|
+
if (_this.isCellReference(cell.trim())) {
|
|
24077
|
+
return _this.getValueFromArg(cell.trim());
|
|
24078
|
+
}
|
|
24079
|
+
return cell.trim();
|
|
24080
|
+
});
|
|
24081
|
+
});
|
|
24082
|
+
var numRows = rows.length;
|
|
24083
|
+
var numCols = rows[0] ? rows[0].length : 0;
|
|
24084
|
+
var matchColIdx = colNumIdx - 1;
|
|
24085
|
+
if (isVlookup && numCols <= matchColIdx) {
|
|
24086
|
+
return errorStrings[CommonErrors.Ref];
|
|
24087
|
+
}
|
|
24088
|
+
if (!isVlookup && numRows <= matchColIdx) {
|
|
24089
|
+
return errorStrings[CommonErrors.Ref];
|
|
24090
|
+
}
|
|
24091
|
+
var lookupValUpper = lookupValue.toUpperCase();
|
|
24092
|
+
var iterCount = isVlookup ? numRows : numCols;
|
|
24093
|
+
for (var r = 0; r < iterCount; r++) {
|
|
24094
|
+
var cellVal = (isVlookup ? rows[r][0] : rows[0][r]) || '';
|
|
24095
|
+
var isMatch = this.isNumber(lookupValue) && this.isNumber(cellVal)
|
|
24096
|
+
? this.parseFloat(lookupValue) === this.parseFloat(cellVal) : cellVal.toUpperCase() === lookupValUpper;
|
|
24097
|
+
if (isMatch) {
|
|
24098
|
+
var matchVal = isVlookup
|
|
24099
|
+
? (rows[r][matchColIdx] !== undefined ? rows[r][matchColIdx] : '')
|
|
24100
|
+
: (rows[matchColIdx] !== undefined && rows[matchColIdx][r] !== undefined
|
|
24101
|
+
? rows[matchColIdx][r] : '');
|
|
24102
|
+
return matchVal !== '' ? matchVal : '';
|
|
24103
|
+
}
|
|
24104
|
+
}
|
|
24105
|
+
return errorStrings[CommonErrors.NA];
|
|
24106
|
+
}
|
|
24107
|
+
var rangeArr = rangeArg.split(':');
|
|
24056
24108
|
var startIdx;
|
|
24057
24109
|
var endIdx;
|
|
24058
24110
|
var idx;
|
|
@@ -25665,8 +25717,8 @@ var Calculate = /** @__PURE__ @class */ (function (_super) {
|
|
|
25665
25717
|
return { op: op, criteria: criteria };
|
|
25666
25718
|
};
|
|
25667
25719
|
Calculate.prototype.processNestedFormula = function (pText, sFormula, fResult) {
|
|
25668
|
-
if (
|
|
25669
|
-
var formulaEndIdx = pText.
|
|
25720
|
+
if (!fResult.toString().includes('"')) {
|
|
25721
|
+
var formulaEndIdx = pText.lastIndexOf(sFormula) + sFormula.length;
|
|
25670
25722
|
if (pText[formulaEndIdx] === '"' && this.getErrorStrings().indexOf(fResult.toString()) < 0 &&
|
|
25671
25723
|
!this.isNumber(fResult) && fResult !== this.trueValue && fResult !== this.falseValue) {
|
|
25672
25724
|
return pText.split(sFormula).join('"' + fResult + '"');
|