@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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 35.1.37
3
+ * version : 35.1.39
4
4
  * Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@syncfusion/ej2-calculate",
3
- "version": "35.1.37",
3
+ "version": "35.1.39",
4
4
  "description": "JavaScript formula calculation engine for Syncfusion Spreadsheet and compatible workbook/xlsx hosts",
5
5
  "author": "Syncfusion Inc.",
6
6
  "license": "SEE LICENSE IN license",
7
- "main": "./src/index.js",
7
+ "main": "./dist/ej2-calculate.umd.min.js",
8
8
  "module": "./index.js",
9
- "es2015": "./src/index.js",
9
+ "es2015": "./dist/es6/ej2-calculate.es5.js",
10
10
  "typings": "index.d.ts",
11
11
  "dependencies": {
12
12
  "@syncfusion/ej2-base": "~35.1.37"
@@ -1541,7 +1541,52 @@ var Calculate = /** @class */ (function (_super) {
1541
1541
  return errorStrings[CommonErrors.Value];
1542
1542
  }
1543
1543
  }
1544
- var rangeArr = argArr[1].split(':');
1544
+ var rangeArg = argArr[1];
1545
+ var rowSepMarker = this.tic + 'RSEP' + this.tic;
1546
+ var isInlineArray = rangeArg.includes(rowSepMarker) ||
1547
+ (rangeArg.startsWith('(') && rangeArg.endsWith(')') && rangeArg.includes(rowSepMarker));
1548
+ if (isInlineArray) {
1549
+ var innerStr = rangeArg.startsWith('(') && rangeArg.endsWith(')')
1550
+ ? rangeArg.substring(1, rangeArg.length - 1) : rangeArg;
1551
+ var rowBoundary = this.tic + 'RSEP' + this.tic;
1552
+ var colBoundary_1 = this.tic + 'CSEP' + this.tic;
1553
+ var rows = innerStr.split(rowBoundary).map(function (rowStr) {
1554
+ return rowStr.split(colBoundary_1).map(function (cell) {
1555
+ if (cell.startsWith(_this.tic) && cell.endsWith(_this.tic)) {
1556
+ return cell.substring(1, cell.length - 1);
1557
+ }
1558
+ if (_this.isCellReference(cell.trim())) {
1559
+ return _this.getValueFromArg(cell.trim());
1560
+ }
1561
+ return cell.trim();
1562
+ });
1563
+ });
1564
+ var numRows = rows.length;
1565
+ var numCols = rows[0] ? rows[0].length : 0;
1566
+ var matchColIdx = colNumIdx - 1;
1567
+ if (isVlookup && numCols <= matchColIdx) {
1568
+ return errorStrings[CommonErrors.Ref];
1569
+ }
1570
+ if (!isVlookup && numRows <= matchColIdx) {
1571
+ return errorStrings[CommonErrors.Ref];
1572
+ }
1573
+ var lookupValUpper = lookupValue.toUpperCase();
1574
+ var iterCount = isVlookup ? numRows : numCols;
1575
+ for (var r = 0; r < iterCount; r++) {
1576
+ var cellVal = (isVlookup ? rows[r][0] : rows[0][r]) || '';
1577
+ var isMatch = this.isNumber(lookupValue) && this.isNumber(cellVal)
1578
+ ? this.parseFloat(lookupValue) === this.parseFloat(cellVal) : cellVal.toUpperCase() === lookupValUpper;
1579
+ if (isMatch) {
1580
+ var matchVal = isVlookup
1581
+ ? (rows[r][matchColIdx] !== undefined ? rows[r][matchColIdx] : '')
1582
+ : (rows[matchColIdx] !== undefined && rows[matchColIdx][r] !== undefined
1583
+ ? rows[matchColIdx][r] : '');
1584
+ return matchVal !== '' ? matchVal : '';
1585
+ }
1586
+ }
1587
+ return errorStrings[CommonErrors.NA];
1588
+ }
1589
+ var rangeArr = rangeArg.split(':');
1545
1590
  var startIdx;
1546
1591
  var endIdx;
1547
1592
  var idx;
@@ -3154,8 +3199,8 @@ var Calculate = /** @class */ (function (_super) {
3154
3199
  return { op: op, criteria: criteria };
3155
3200
  };
3156
3201
  Calculate.prototype.processNestedFormula = function (pText, sFormula, fResult) {
3157
- if (fResult && !fResult.toString().includes('"')) {
3158
- var formulaEndIdx = pText.indexOf(sFormula) + sFormula.length;
3202
+ if (!fResult.toString().includes('"')) {
3203
+ var formulaEndIdx = pText.lastIndexOf(sFormula) + sFormula.length;
3159
3204
  if (pText[formulaEndIdx] === '"' && this.getErrorStrings().indexOf(fResult.toString()) < 0 &&
3160
3205
  !this.isNumber(fResult) && fResult !== this.trueValue && fResult !== this.falseValue) {
3161
3206
  return pText.split(sFormula).join('"' + fResult + '"');
@@ -1067,6 +1067,13 @@ var Parser = /** @class */ (function () {
1067
1067
  var criteriaStr = this_1.parent.substring(substr, leftBraceIdx, substr.indexOf('}') - leftBraceIdx + 1);
1068
1068
  substr = substr.split(criteriaStr).join(criteriaStr.split(argsSep).join(this_1.parent.tic + this_1.parent.tic));
1069
1069
  }
1070
+ else if ((libFormula === 'VLOOKUP' || libFormula === 'HLOOKUP') && substr.includes('{')) {
1071
+ var leftBraceIdx = substr.indexOf('{');
1072
+ var criteriaStr = this_1.parent.substring(substr, leftBraceIdx, substr.indexOf('}') - leftBraceIdx + 1);
1073
+ var protectedStr = criteriaStr.split(';').join(this_1.parent.tic + 'RSEP' + this_1.parent.tic)
1074
+ .split(argsSep).join(this_1.parent.tic + 'CSEP' + this_1.parent.tic);
1075
+ substr = substr.split(criteriaStr).join(protectedStr);
1076
+ }
1070
1077
  }
1071
1078
  try {
1072
1079
  var args = void 0;