@syncfusion/ej2-calculate 35.1.37
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/.eslintrc.json +263 -0
- package/README.md +132 -0
- package/base.d.ts +4 -0
- package/base.js +4 -0
- package/common.d.ts +4 -0
- package/common.js +4 -0
- package/dist/ej2-calculate.umd.min.js +11 -0
- package/dist/ej2-calculate.umd.min.js.map +1 -0
- package/dist/es6/ej2-calculate.es2015.js +24801 -0
- package/dist/es6/ej2-calculate.es2015.js.map +1 -0
- package/dist/es6/ej2-calculate.es5.js +27229 -0
- package/dist/es6/ej2-calculate.es5.js.map +1 -0
- package/dist/global/ej2-calculate.min.js +11 -0
- package/dist/global/ej2-calculate.min.js.map +1 -0
- package/dist/global/index.d.ts +14 -0
- package/formulas.d.ts +4 -0
- package/formulas.js +4 -0
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/license +10 -0
- package/package.json +30 -0
- package/src/base/calculate-model.d.ts +4 -0
- package/src/base/calculate-model.js +0 -0
- package/src/base/calculate.d.ts +1105 -0
- package/src/base/calculate.js +4720 -0
- package/src/base/index.d.ts +8 -0
- package/src/base/index.js +7 -0
- package/src/base/parser.d.ts +208 -0
- package/src/base/parser.js +1512 -0
- package/src/common/address.d.ts +59 -0
- package/src/common/address.js +96 -0
- package/src/common/cell-ref.d.ts +32 -0
- package/src/common/cell-ref.js +112 -0
- package/src/common/common.d.ts +44 -0
- package/src/common/common.js +134 -0
- package/src/common/enum.d.ts +94 -0
- package/src/common/enum.js +97 -0
- package/src/common/index.d.ts +9 -0
- package/src/common/index.js +8 -0
- package/src/common/interface.d.ts +122 -0
- package/src/common/interface.js +0 -0
- package/src/common/l10n.d.ts +24 -0
- package/src/common/l10n.js +54 -0
- package/src/common/number-date.d.ts +26 -0
- package/src/common/number-date.js +38 -0
- package/src/common/sheet-info.d.ts +10 -0
- package/src/common/sheet-info.js +17 -0
- package/src/common/sort.d.ts +17 -0
- package/src/common/sort.js +44 -0
- package/src/formulas/array.d.ts +47 -0
- package/src/formulas/array.js +718 -0
- package/src/formulas/basic.d.ts +47 -0
- package/src/formulas/basic.js +181 -0
- package/src/formulas/complex-numbers.d.ts +207 -0
- package/src/formulas/complex-numbers.js +549 -0
- package/src/formulas/database.d.ts +152 -0
- package/src/formulas/database.js +579 -0
- package/src/formulas/date-time-extra.d.ts +97 -0
- package/src/formulas/date-time-extra.js +415 -0
- package/src/formulas/date-time-intl.d.ts +57 -0
- package/src/formulas/date-time-intl.js +309 -0
- package/src/formulas/date-time.d.ts +164 -0
- package/src/formulas/date-time.js +1021 -0
- package/src/formulas/engineering-base.d.ts +150 -0
- package/src/formulas/engineering-base.js +404 -0
- package/src/formulas/engineering-bessel.d.ts +65 -0
- package/src/formulas/engineering-bessel.js +167 -0
- package/src/formulas/engineering-convert.d.ts +35 -0
- package/src/formulas/engineering-convert.js +120 -0
- package/src/formulas/engineering-misc.d.ts +64 -0
- package/src/formulas/engineering-misc.js +168 -0
- package/src/formulas/financial-amortization-ecma.d.ts +87 -0
- package/src/formulas/financial-amortization-ecma.js +288 -0
- package/src/formulas/financial-annuity.d.ts +104 -0
- package/src/formulas/financial-annuity.js +419 -0
- package/src/formulas/financial-bond-helpers.d.ts +106 -0
- package/src/formulas/financial-bond-helpers.js +190 -0
- package/src/formulas/financial-cashflow.d.ts +47 -0
- package/src/formulas/financial-cashflow.js +203 -0
- package/src/formulas/financial-coupons.d.ts +227 -0
- package/src/formulas/financial-coupons.js +810 -0
- package/src/formulas/financial-depreciation.d.ts +64 -0
- package/src/formulas/financial-depreciation.js +247 -0
- package/src/formulas/financial-rates.d.ts +54 -0
- package/src/formulas/financial-rates.js +140 -0
- package/src/formulas/financial-securities.d.ts +126 -0
- package/src/formulas/financial-securities.js +488 -0
- package/src/formulas/formula-math-helpers.d.ts +212 -0
- package/src/formulas/formula-math-helpers.js +599 -0
- package/src/formulas/formula-module-base.d.ts +54 -0
- package/src/formulas/formula-module-base.js +125 -0
- package/src/formulas/formula-owner.d.ts +17 -0
- package/src/formulas/formula-owner.js +0 -0
- package/src/formulas/index.d.ts +68 -0
- package/src/formulas/index.js +67 -0
- package/src/formulas/information-advanced.d.ts +44 -0
- package/src/formulas/information-advanced.js +157 -0
- package/src/formulas/information-ecma.d.ts +33 -0
- package/src/formulas/information-ecma.js +88 -0
- package/src/formulas/information-extra.d.ts +146 -0
- package/src/formulas/information-extra.js +351 -0
- package/src/formulas/information.d.ts +34 -0
- package/src/formulas/information.js +78 -0
- package/src/formulas/logical-extra.d.ts +75 -0
- package/src/formulas/logical-extra.js +217 -0
- package/src/formulas/logical.d.ts +83 -0
- package/src/formulas/logical.js +296 -0
- package/src/formulas/lookup-array.d.ts +98 -0
- package/src/formulas/lookup-array.js +364 -0
- package/src/formulas/lookup-ref-extra.d.ts +64 -0
- package/src/formulas/lookup-ref-extra.js +180 -0
- package/src/formulas/lookup-ref.d.ts +84 -0
- package/src/formulas/lookup-ref.js +263 -0
- package/src/formulas/lookup.d.ts +114 -0
- package/src/formulas/lookup.js +881 -0
- package/src/formulas/math-aggregate.d.ts +74 -0
- package/src/formulas/math-aggregate.js +376 -0
- package/src/formulas/math-ceiling-ecma.d.ts +42 -0
- package/src/formulas/math-ceiling-ecma.js +123 -0
- package/src/formulas/math-combinatorics.d.ts +75 -0
- package/src/formulas/math-combinatorics.js +290 -0
- package/src/formulas/math-misc.d.ts +164 -0
- package/src/formulas/math-misc.js +889 -0
- package/src/formulas/math-number.d.ts +76 -0
- package/src/formulas/math-number.js +261 -0
- package/src/formulas/math-rounding.d.ts +115 -0
- package/src/formulas/math-rounding.js +728 -0
- package/src/formulas/math-trig-hyperbolic.d.ts +55 -0
- package/src/formulas/math-trig-hyperbolic.js +113 -0
- package/src/formulas/math-trig.d.ts +165 -0
- package/src/formulas/math-trig.js +334 -0
- package/src/formulas/matrix-base.d.ts +13 -0
- package/src/formulas/matrix-base.js +169 -0
- package/src/formulas/matrix.d.ts +64 -0
- package/src/formulas/matrix.js +161 -0
- package/src/formulas/regression-ecma.d.ts +66 -0
- package/src/formulas/regression-ecma.js +234 -0
- package/src/formulas/statistical-advanced.d.ts +125 -0
- package/src/formulas/statistical-advanced.js +756 -0
- package/src/formulas/statistical-correlation.d.ts +75 -0
- package/src/formulas/statistical-correlation.js +198 -0
- package/src/formulas/statistical-dispersion.d.ts +108 -0
- package/src/formulas/statistical-dispersion.js +337 -0
- package/src/formulas/statistical-distribution-extended.d.ts +176 -0
- package/src/formulas/statistical-distribution-extended.js +668 -0
- package/src/formulas/statistical-distribution.d.ts +104 -0
- package/src/formulas/statistical-distribution.js +368 -0
- package/src/formulas/statistical-ecma.d.ts +95 -0
- package/src/formulas/statistical-ecma.js +392 -0
- package/src/formulas/statistical-extended.d.ts +136 -0
- package/src/formulas/statistical-extended.js +340 -0
- package/src/formulas/statistical-ifs.d.ts +46 -0
- package/src/formulas/statistical-ifs.js +180 -0
- package/src/formulas/statistical-moments.d.ts +84 -0
- package/src/formulas/statistical-moments.js +269 -0
- package/src/formulas/statistical-percentile.d.ts +56 -0
- package/src/formulas/statistical-percentile.js +195 -0
- package/src/formulas/statistical-sample-base.d.ts +14 -0
- package/src/formulas/statistical-sample-base.js +124 -0
- package/src/formulas/statistical.d.ts +135 -0
- package/src/formulas/statistical.js +542 -0
- package/src/formulas/text-advanced.d.ts +64 -0
- package/src/formulas/text-advanced.js +222 -0
- package/src/formulas/text-ecma.d.ts +54 -0
- package/src/formulas/text-ecma.js +106 -0
- package/src/formulas/text-extra.d.ts +216 -0
- package/src/formulas/text-extra.js +657 -0
- package/src/formulas/text.d.ts +125 -0
- package/src/formulas/text.js +628 -0
- package/src/global.js +1 -0
- package/src/index.d.ts +14 -0
- package/src/index.js +14 -0
- package/tslint.json +111 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
2
|
+
import { FormulasErrorsStrings, CommonErrors } from '../common/index';
|
|
3
|
+
/**
|
|
4
|
+
* Base class for formula category modules registered with {@link BasicFormulas}.
|
|
5
|
+
*
|
|
6
|
+
* Provides shared argument parsing helpers used across Compute handlers.
|
|
7
|
+
*
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
var FormulaModuleBase = /** @class */ (function () {
|
|
11
|
+
/**
|
|
12
|
+
* @param {FormulaOwner} owner - Formula registration owner whose `parent` is the Calculate engine.
|
|
13
|
+
*/
|
|
14
|
+
function FormulaModuleBase(owner) {
|
|
15
|
+
this.owner = owner;
|
|
16
|
+
this.parent = owner.parent;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
* @param {string} value - specify the value
|
|
21
|
+
* @returns {number} - Returns parse double value.
|
|
22
|
+
*/
|
|
23
|
+
FormulaModuleBase.prototype.parseDouble = function (value) {
|
|
24
|
+
var val = this.parent.parseFloat(value.toString());
|
|
25
|
+
return !isNaN(val) ? val : NaN;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* @hidden
|
|
29
|
+
* @param {string} range - Cell / range text.
|
|
30
|
+
* @returns {string} - Sheet token prefix when present.
|
|
31
|
+
*/
|
|
32
|
+
FormulaModuleBase.prototype.getSheetReference = function (range) {
|
|
33
|
+
return range.indexOf(this.parent.sheetToken) === 0 && range.lastIndexOf(this.parent.sheetToken) > range.indexOf(this.parent.sheetToken) ? range.substring(0, range.lastIndexOf(this.parent.sheetToken) + 1) : '';
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* @hidden
|
|
37
|
+
* @param {string[]} ranges - IFS ranges / criteria.
|
|
38
|
+
* @param {string} isAvgIfs - AVERAGEIFS marker.
|
|
39
|
+
* @returns {string | number} - Aggregated IFS result.
|
|
40
|
+
*/
|
|
41
|
+
FormulaModuleBase.prototype.calculateIFS = function (ranges, isAvgIfs) {
|
|
42
|
+
var _this = this;
|
|
43
|
+
if (isNullOrUndefined(ranges) || ranges[0] === '' || ranges.length < 2 || ranges.length > 127 || ranges.length % 2 === 0) {
|
|
44
|
+
return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
|
|
45
|
+
}
|
|
46
|
+
if (ranges.length === 3 && ranges[2] !== '""') { // SUMIFS and AVERAGEIFS OR operation will contains only 3 arguments.
|
|
47
|
+
if (ranges[2].includes(this.parent.tic + this.parent.tic)) {
|
|
48
|
+
var result_1 = '';
|
|
49
|
+
var sumVal_1;
|
|
50
|
+
var separator_1 = this.parent.getParseArgumentSeparator();
|
|
51
|
+
var criterias = ranges[2].split(this.parent.tic + this.parent.tic);
|
|
52
|
+
criterias.forEach(function (criteria) {
|
|
53
|
+
criteria = criteria.trim().split(_this.parent.tic).join('');
|
|
54
|
+
if (criteria) {
|
|
55
|
+
sumVal_1 = _this.parent.computeIfsFormulas([ranges[0], ranges[1], criteria], _this.parent.falseValue, isAvgIfs).toString();
|
|
56
|
+
result_1 += (result_1 ? separator_1 : '') + sumVal_1;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return result_1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return this.parent.computeIfsFormulas(ranges, this.parent.falseValue, isAvgIfs);
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Resolve an argument to a display/text value (strips quotes for literals).
|
|
66
|
+
*
|
|
67
|
+
* @hidden
|
|
68
|
+
* @param {string} arg - Formula argument token.
|
|
69
|
+
* @returns {string} - Resolved text (may be an error token).
|
|
70
|
+
*/
|
|
71
|
+
FormulaModuleBase.prototype.resolveTextArg = function (arg) {
|
|
72
|
+
if (isNullOrUndefined(arg)) {
|
|
73
|
+
return '';
|
|
74
|
+
}
|
|
75
|
+
var value = this.parent.getValueFromArg(arg);
|
|
76
|
+
var errCollection = this.parent.getErrorStrings();
|
|
77
|
+
if (errCollection.indexOf(value) > -1) {
|
|
78
|
+
return value;
|
|
79
|
+
}
|
|
80
|
+
if (!this.parent.isCellReference(arg)) {
|
|
81
|
+
value = this.parent.removeTics(value);
|
|
82
|
+
}
|
|
83
|
+
return value;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Resolve an argument to a number (booleans → 1/0).
|
|
87
|
+
*
|
|
88
|
+
* @hidden
|
|
89
|
+
* @param {string} arg - Formula argument token.
|
|
90
|
+
* @returns {number | string} - Number or error token.
|
|
91
|
+
*/
|
|
92
|
+
FormulaModuleBase.prototype.resolveNumberArg = function (arg) {
|
|
93
|
+
var errCollection = this.parent.getErrorStrings();
|
|
94
|
+
var value = this.parent.getValueFromArg(arg);
|
|
95
|
+
if (errCollection.indexOf(value) > -1) {
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
if (value === '') {
|
|
99
|
+
return 0;
|
|
100
|
+
}
|
|
101
|
+
var upper = value.toUpperCase();
|
|
102
|
+
if (upper === this.parent.trueValue) {
|
|
103
|
+
return 1;
|
|
104
|
+
}
|
|
105
|
+
if (upper === this.parent.falseValue) {
|
|
106
|
+
return 0;
|
|
107
|
+
}
|
|
108
|
+
if (!this.parent.isCellReference(arg)) {
|
|
109
|
+
value = this.parent.removeTics(value);
|
|
110
|
+
}
|
|
111
|
+
if (value.indexOf('%') > -1) {
|
|
112
|
+
var pct = value.replace('%', '');
|
|
113
|
+
if (this.parent.isNumber(pct)) {
|
|
114
|
+
return this.parent.parseFloat(pct) / 100;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
var num = this.parent.parseFloat(value);
|
|
118
|
+
if (isNaN(num)) {
|
|
119
|
+
return errCollection[CommonErrors.Value];
|
|
120
|
+
}
|
|
121
|
+
return num;
|
|
122
|
+
};
|
|
123
|
+
return FormulaModuleBase;
|
|
124
|
+
}());
|
|
125
|
+
export { FormulaModuleBase };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Calculate } from '../base/index';
|
|
2
|
+
/**
|
|
3
|
+
* Host surface shared by {@link BasicFormulas} and formula category modules.
|
|
4
|
+
*
|
|
5
|
+
* Category modules register `Compute*` handlers on the owner; cross-formula calls
|
|
6
|
+
* (for example SUBTOTAL delegating to SUM) resolve through this interface.
|
|
7
|
+
*
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
export interface FormulaOwner {
|
|
11
|
+
/** Calculate engine that evaluates cell values and hosts the formula library. */
|
|
12
|
+
parent: Calculate;
|
|
13
|
+
/** When true, CONCATENATE uses empty-string semantics instead of skipping blanks. */
|
|
14
|
+
isConcat?: boolean;
|
|
15
|
+
/** Bound `Compute*` handlers and category-module methods keyed by name. */
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in Excel / ECMA-376 formula modules for `@syncfusion/ej2-calculate`.
|
|
3
|
+
*
|
|
4
|
+
* {@link BasicFormulas} registers every category module with the {@link Calculate}
|
|
5
|
+
* engine. Each category class exposes public `Compute*` handlers documented with
|
|
6
|
+
* TSDoc (Excel name, parameters, return value, and examples).
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
export * from './basic';
|
|
11
|
+
export * from './formula-owner';
|
|
12
|
+
export * from './formula-module-base';
|
|
13
|
+
export * from './formula-math-helpers';
|
|
14
|
+
export * from './math-aggregate';
|
|
15
|
+
export * from './math-rounding';
|
|
16
|
+
export * from './math-misc';
|
|
17
|
+
export * from './math-trig';
|
|
18
|
+
export * from './math-trig-hyperbolic';
|
|
19
|
+
export * from './math-combinatorics';
|
|
20
|
+
export * from './math-number';
|
|
21
|
+
export * from './matrix-base';
|
|
22
|
+
export * from './matrix';
|
|
23
|
+
export * from './engineering-base';
|
|
24
|
+
export * from './engineering-misc';
|
|
25
|
+
export * from './engineering-convert';
|
|
26
|
+
export * from './engineering-bessel';
|
|
27
|
+
export * from './financial-annuity';
|
|
28
|
+
export * from './financial-depreciation';
|
|
29
|
+
export * from './financial-rates';
|
|
30
|
+
export * from './financial-cashflow';
|
|
31
|
+
export * from './financial-securities';
|
|
32
|
+
export * from './statistical';
|
|
33
|
+
export * from './statistical-advanced';
|
|
34
|
+
export * from './statistical-dispersion';
|
|
35
|
+
export * from './statistical-sample-base';
|
|
36
|
+
export * from './statistical-moments';
|
|
37
|
+
export * from './statistical-correlation';
|
|
38
|
+
export * from './statistical-percentile';
|
|
39
|
+
export * from './statistical-distribution';
|
|
40
|
+
export * from './statistical-ifs';
|
|
41
|
+
export * from './statistical-extended';
|
|
42
|
+
export * from './statistical-distribution-extended';
|
|
43
|
+
export * from './complex-numbers';
|
|
44
|
+
export * from './date-time';
|
|
45
|
+
export * from './date-time-extra';
|
|
46
|
+
export * from './logical';
|
|
47
|
+
export * from './logical-extra';
|
|
48
|
+
export * from './lookup';
|
|
49
|
+
export * from './lookup-ref';
|
|
50
|
+
export * from './lookup-ref-extra';
|
|
51
|
+
export * from './lookup-array';
|
|
52
|
+
export * from './array';
|
|
53
|
+
export * from './text';
|
|
54
|
+
export * from './text-extra';
|
|
55
|
+
export * from './text-advanced';
|
|
56
|
+
export * from './information';
|
|
57
|
+
export * from './information-extra';
|
|
58
|
+
export * from './information-advanced';
|
|
59
|
+
export * from './date-time-intl';
|
|
60
|
+
export * from './math-ceiling-ecma';
|
|
61
|
+
export * from './information-ecma';
|
|
62
|
+
export * from './text-ecma';
|
|
63
|
+
export * from './financial-bond-helpers';
|
|
64
|
+
export * from './financial-coupons';
|
|
65
|
+
export * from './financial-amortization-ecma';
|
|
66
|
+
export * from './statistical-ecma';
|
|
67
|
+
export * from './database';
|
|
68
|
+
export * from './regression-ecma';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in Excel / ECMA-376 formula modules for `@syncfusion/ej2-calculate`.
|
|
3
|
+
*
|
|
4
|
+
* {@link BasicFormulas} registers every category module with the {@link Calculate}
|
|
5
|
+
* engine. Each category class exposes public `Compute*` handlers documented with
|
|
6
|
+
* TSDoc (Excel name, parameters, return value, and examples).
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
export * from './basic';
|
|
11
|
+
export * from './formula-module-base';
|
|
12
|
+
export * from './formula-math-helpers';
|
|
13
|
+
export * from './math-aggregate';
|
|
14
|
+
export * from './math-rounding';
|
|
15
|
+
export * from './math-misc';
|
|
16
|
+
export * from './math-trig';
|
|
17
|
+
export * from './math-trig-hyperbolic';
|
|
18
|
+
export * from './math-combinatorics';
|
|
19
|
+
export * from './math-number';
|
|
20
|
+
export * from './matrix-base';
|
|
21
|
+
export * from './matrix';
|
|
22
|
+
export * from './engineering-base';
|
|
23
|
+
export * from './engineering-misc';
|
|
24
|
+
export * from './engineering-convert';
|
|
25
|
+
export * from './engineering-bessel';
|
|
26
|
+
export * from './financial-annuity';
|
|
27
|
+
export * from './financial-depreciation';
|
|
28
|
+
export * from './financial-rates';
|
|
29
|
+
export * from './financial-cashflow';
|
|
30
|
+
export * from './financial-securities';
|
|
31
|
+
export * from './statistical';
|
|
32
|
+
export * from './statistical-advanced';
|
|
33
|
+
export * from './statistical-dispersion';
|
|
34
|
+
export * from './statistical-sample-base';
|
|
35
|
+
export * from './statistical-moments';
|
|
36
|
+
export * from './statistical-correlation';
|
|
37
|
+
export * from './statistical-percentile';
|
|
38
|
+
export * from './statistical-distribution';
|
|
39
|
+
export * from './statistical-ifs';
|
|
40
|
+
export * from './statistical-extended';
|
|
41
|
+
export * from './statistical-distribution-extended';
|
|
42
|
+
export * from './complex-numbers';
|
|
43
|
+
export * from './date-time';
|
|
44
|
+
export * from './date-time-extra';
|
|
45
|
+
export * from './logical';
|
|
46
|
+
export * from './logical-extra';
|
|
47
|
+
export * from './lookup';
|
|
48
|
+
export * from './lookup-ref';
|
|
49
|
+
export * from './lookup-ref-extra';
|
|
50
|
+
export * from './lookup-array';
|
|
51
|
+
export * from './array';
|
|
52
|
+
export * from './text';
|
|
53
|
+
export * from './text-extra';
|
|
54
|
+
export * from './text-advanced';
|
|
55
|
+
export * from './information';
|
|
56
|
+
export * from './information-extra';
|
|
57
|
+
export * from './information-advanced';
|
|
58
|
+
export * from './date-time-intl';
|
|
59
|
+
export * from './math-ceiling-ecma';
|
|
60
|
+
export * from './information-ecma';
|
|
61
|
+
export * from './text-ecma';
|
|
62
|
+
export * from './financial-bond-helpers';
|
|
63
|
+
export * from './financial-coupons';
|
|
64
|
+
export * from './financial-amortization-ecma';
|
|
65
|
+
export * from './statistical-ecma';
|
|
66
|
+
export * from './database';
|
|
67
|
+
export * from './regression-ecma';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { IBasicFormula } from '../common/index';
|
|
2
|
+
import { FormulaOwner } from './formula-owner';
|
|
3
|
+
import { FormulaModuleBase } from './formula-module-base';
|
|
4
|
+
/**
|
|
5
|
+
* Advanced information utilities including SHEET, SHEETS, and structured reference introspection.
|
|
6
|
+
*
|
|
7
|
+
* Registered functions: INFO, CELL.
|
|
8
|
+
*
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export declare class InformationAdvancedFormulas extends FormulaModuleBase {
|
|
12
|
+
/** Formula definitions registered with {@link BasicFormulas}. */
|
|
13
|
+
formulas: IBasicFormula[];
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
* @param {FormulaOwner} owner - Formula registration owner ({@link BasicFormulas}).
|
|
17
|
+
*/
|
|
18
|
+
constructor(owner: FormulaOwner);
|
|
19
|
+
/**
|
|
20
|
+
* Returns information about the current operating environment.
|
|
21
|
+
*
|
|
22
|
+
* Excel: `INFO(...)`.
|
|
23
|
+
*
|
|
24
|
+
* @hidden
|
|
25
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
26
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* engine.computeFormula('=INFO(1)');
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
ComputeINFO(...args: string[]): string | number;
|
|
34
|
+
/**
|
|
35
|
+
* Returns information about the formatting, location, or contents of a cell.
|
|
36
|
+
*
|
|
37
|
+
* Excel: `CELL(...)`.
|
|
38
|
+
*
|
|
39
|
+
* @hidden
|
|
40
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
41
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
42
|
+
*/
|
|
43
|
+
ComputeCELL(...args: string[]): string | number;
|
|
44
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
extendStatics(d, b);
|
|
10
|
+
function __() { this.constructor = d; }
|
|
11
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
+
};
|
|
13
|
+
})();
|
|
14
|
+
import { FormulasErrorsStrings, CommonErrors } from '../common/index';
|
|
15
|
+
import { isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
16
|
+
import { FormulaModuleBase } from './formula-module-base';
|
|
17
|
+
/**
|
|
18
|
+
* Advanced information utilities including SHEET, SHEETS, and structured reference introspection.
|
|
19
|
+
*
|
|
20
|
+
* Registered functions: INFO, CELL.
|
|
21
|
+
*
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
var InformationAdvancedFormulas = /** @class */ (function (_super) {
|
|
25
|
+
__extends(InformationAdvancedFormulas, _super);
|
|
26
|
+
/**
|
|
27
|
+
* @hidden
|
|
28
|
+
* @param {FormulaOwner} owner - Formula registration owner ({@link BasicFormulas}).
|
|
29
|
+
*/
|
|
30
|
+
function InformationAdvancedFormulas(owner) {
|
|
31
|
+
var _this = _super.call(this, owner) || this;
|
|
32
|
+
/** Formula definitions registered with {@link BasicFormulas}. */
|
|
33
|
+
_this.formulas = [
|
|
34
|
+
{ formulaName: 'INFO', category: 'Information', description: 'Returns information about the current operating environment.' },
|
|
35
|
+
{ formulaName: 'CELL', category: 'Information', description: 'Returns information about the formatting, location, or contents of a cell.' }
|
|
36
|
+
];
|
|
37
|
+
return _this;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Returns information about the current operating environment.
|
|
41
|
+
*
|
|
42
|
+
* Excel: `INFO(...)`.
|
|
43
|
+
*
|
|
44
|
+
* @hidden
|
|
45
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
46
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* engine.computeFormula('=INFO(1)');
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
InformationAdvancedFormulas.prototype.ComputeINFO = function () {
|
|
54
|
+
var args = [];
|
|
55
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
56
|
+
args[_i] = arguments[_i];
|
|
57
|
+
}
|
|
58
|
+
var errCollection = this.parent.getErrorStrings();
|
|
59
|
+
if (isNullOrUndefined(args) || args.length !== 1) {
|
|
60
|
+
return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
|
|
61
|
+
}
|
|
62
|
+
var typeText = this.resolveTextArg(args[0]).toLowerCase();
|
|
63
|
+
if (errCollection.indexOf(typeText) > -1) {
|
|
64
|
+
return typeText;
|
|
65
|
+
}
|
|
66
|
+
var validTypes = ['system', 'release', 'numfile', 'directory', 'origin', 'recalc', 'memavail', 'memused'];
|
|
67
|
+
if (validTypes.indexOf(typeText) === -1) {
|
|
68
|
+
return errCollection[CommonErrors.NA];
|
|
69
|
+
}
|
|
70
|
+
var infoType = typeText;
|
|
71
|
+
switch (infoType) {
|
|
72
|
+
case 'system':
|
|
73
|
+
return 'pcdos';
|
|
74
|
+
case 'release':
|
|
75
|
+
return '16.0';
|
|
76
|
+
case 'numfile':
|
|
77
|
+
return '1';
|
|
78
|
+
case 'directory':
|
|
79
|
+
return '/';
|
|
80
|
+
case 'origin':
|
|
81
|
+
return 'A1';
|
|
82
|
+
case 'recalc':
|
|
83
|
+
return this.parent.parentObject.calculationMode === 'Manual' ? 'Manual' : 'Automatic';
|
|
84
|
+
case 'memavail':
|
|
85
|
+
return '1048576';
|
|
86
|
+
case 'memused':
|
|
87
|
+
return '0';
|
|
88
|
+
default: {
|
|
89
|
+
var _exhaustive = infoType;
|
|
90
|
+
return _exhaustive;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Returns information about the formatting, location, or contents of a cell.
|
|
96
|
+
*
|
|
97
|
+
* Excel: `CELL(...)`.
|
|
98
|
+
*
|
|
99
|
+
* @hidden
|
|
100
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
101
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
102
|
+
*/
|
|
103
|
+
InformationAdvancedFormulas.prototype.ComputeCELL = function () {
|
|
104
|
+
var args = [];
|
|
105
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
106
|
+
args[_i] = arguments[_i];
|
|
107
|
+
}
|
|
108
|
+
var errCollection = this.parent.getErrorStrings();
|
|
109
|
+
if (isNullOrUndefined(args) || args.length < 1 || args.length > 2) {
|
|
110
|
+
return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
|
|
111
|
+
}
|
|
112
|
+
var infoType = this.resolveTextArg(args[0]).toLowerCase();
|
|
113
|
+
if (errCollection.indexOf(infoType) > -1) {
|
|
114
|
+
return infoType;
|
|
115
|
+
}
|
|
116
|
+
var ref = args.length === 2 ? args[1] : (this.parent.actCell || this.parent.cell || 'A1');
|
|
117
|
+
ref = ref.split('$').join('');
|
|
118
|
+
if (!this.parent.isCellReference(ref.split(':')[0])) {
|
|
119
|
+
return errCollection[CommonErrors.Value];
|
|
120
|
+
}
|
|
121
|
+
var cell = ref.indexOf(':') > -1 ? ref.split(':')[0] : ref;
|
|
122
|
+
var stripped = cell.indexOf('!') > -1 ? cell.substring(cell.lastIndexOf('!') + 1) : cell;
|
|
123
|
+
var value = this.parent.getValueFromArg(cell);
|
|
124
|
+
switch (infoType) {
|
|
125
|
+
case 'address':
|
|
126
|
+
return '$' + stripped.replace(/([A-Z]+)(\d+)/, '$1$$$2');
|
|
127
|
+
case 'col':
|
|
128
|
+
return this.parent.colIndex(stripped).toString();
|
|
129
|
+
case 'row':
|
|
130
|
+
return this.parent.rowIndex(stripped).toString();
|
|
131
|
+
case 'contents':
|
|
132
|
+
return value;
|
|
133
|
+
case 'format':
|
|
134
|
+
return 'G';
|
|
135
|
+
case 'prefix':
|
|
136
|
+
return '';
|
|
137
|
+
case 'protect':
|
|
138
|
+
return '0';
|
|
139
|
+
case 'type':
|
|
140
|
+
if (value === '') {
|
|
141
|
+
return 'b';
|
|
142
|
+
}
|
|
143
|
+
if (this.parent.isNumber(value)) {
|
|
144
|
+
return 'v';
|
|
145
|
+
}
|
|
146
|
+
return 'l';
|
|
147
|
+
case 'width':
|
|
148
|
+
return '8';
|
|
149
|
+
case 'parentheses':
|
|
150
|
+
return '0';
|
|
151
|
+
default:
|
|
152
|
+
return errCollection[CommonErrors.NA];
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
return InformationAdvancedFormulas;
|
|
156
|
+
}(FormulaModuleBase));
|
|
157
|
+
export { InformationAdvancedFormulas };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { IBasicFormula } from '../common/index';
|
|
2
|
+
import { FormulaOwner } from './formula-owner';
|
|
3
|
+
import { FormulaModuleBase } from './formula-module-base';
|
|
4
|
+
/**
|
|
5
|
+
* ECMA information helpers such as ERROR.TYPE for classifying error values.
|
|
6
|
+
*
|
|
7
|
+
* Registered functions: ERROR.TYPE.
|
|
8
|
+
*
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export declare class InformationEcmaFormulas extends FormulaModuleBase {
|
|
12
|
+
/** Formula definitions registered with {@link BasicFormulas}. */
|
|
13
|
+
formulas: IBasicFormula[];
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
* @param {FormulaOwner} owner - Formula registration owner ({@link BasicFormulas}).
|
|
17
|
+
*/
|
|
18
|
+
constructor(owner: FormulaOwner);
|
|
19
|
+
/**
|
|
20
|
+
* Returns a number corresponding to an error type.
|
|
21
|
+
*
|
|
22
|
+
* Excel: `ERROR.TYPE(...)`.
|
|
23
|
+
*
|
|
24
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
25
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* engine.computeFormula('=ERROR.TYPE(1)');
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
['ComputeERROR.TYPE'](...args: string[]): string | number;
|
|
33
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
extendStatics(d, b);
|
|
10
|
+
function __() { this.constructor = d; }
|
|
11
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
+
};
|
|
13
|
+
})();
|
|
14
|
+
import { FormulasErrorsStrings, CommonErrors } from '../common/index';
|
|
15
|
+
import { isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
16
|
+
import { FormulaModuleBase } from './formula-module-base';
|
|
17
|
+
/**
|
|
18
|
+
* ECMA information helpers such as ERROR.TYPE for classifying error values.
|
|
19
|
+
*
|
|
20
|
+
* Registered functions: ERROR.TYPE.
|
|
21
|
+
*
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
var InformationEcmaFormulas = /** @class */ (function (_super) {
|
|
25
|
+
__extends(InformationEcmaFormulas, _super);
|
|
26
|
+
/**
|
|
27
|
+
* @hidden
|
|
28
|
+
* @param {FormulaOwner} owner - Formula registration owner ({@link BasicFormulas}).
|
|
29
|
+
*/
|
|
30
|
+
function InformationEcmaFormulas(owner) {
|
|
31
|
+
var _this = _super.call(this, owner) || this;
|
|
32
|
+
/** Formula definitions registered with {@link BasicFormulas}. */
|
|
33
|
+
_this.formulas = [
|
|
34
|
+
{ formulaName: 'ERROR.TYPE', category: 'Information', description: 'Returns a number corresponding to an error type.' }
|
|
35
|
+
];
|
|
36
|
+
return _this;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Returns a number corresponding to an error type.
|
|
40
|
+
*
|
|
41
|
+
* Excel: `ERROR.TYPE(...)`.
|
|
42
|
+
*
|
|
43
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
44
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* engine.computeFormula('=ERROR.TYPE(1)');
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
InformationEcmaFormulas.prototype['ComputeERROR.TYPE'] = function () {
|
|
52
|
+
var args = [];
|
|
53
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
54
|
+
args[_i] = arguments[_i];
|
|
55
|
+
}
|
|
56
|
+
var errCollection = this.parent.getErrorStrings();
|
|
57
|
+
if (isNullOrUndefined(args) || args.length !== 1) {
|
|
58
|
+
return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
|
|
59
|
+
}
|
|
60
|
+
var val = this.parent.getValueFromArg(args[0]);
|
|
61
|
+
var map = {
|
|
62
|
+
'#NULL!': 1,
|
|
63
|
+
'#DIV/0!': 2,
|
|
64
|
+
'#VALUE!': 3,
|
|
65
|
+
'#REF!': 4,
|
|
66
|
+
'#NAME?': 5,
|
|
67
|
+
'#NUM!': 6,
|
|
68
|
+
'#N/A': 7,
|
|
69
|
+
'#GETTING_DATA': 8
|
|
70
|
+
};
|
|
71
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
72
|
+
if (map[val] !== undefined) {
|
|
73
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
74
|
+
return map[val].toString();
|
|
75
|
+
}
|
|
76
|
+
for (var i = 0; i < errCollection.length; i++) {
|
|
77
|
+
if (val === errCollection[i]) {
|
|
78
|
+
var idx = i + 1;
|
|
79
|
+
if (idx >= 1 && idx <= 8) {
|
|
80
|
+
return idx.toString();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return errCollection[CommonErrors.NA];
|
|
85
|
+
};
|
|
86
|
+
return InformationEcmaFormulas;
|
|
87
|
+
}(FormulaModuleBase));
|
|
88
|
+
export { InformationEcmaFormulas };
|