igniteui-angular-core
Version:
Ignite UI Angular Core logic used in multiple UI components.
202 lines (201 loc) • 7.78 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { __extends } from "tslib";
import { PriorityDataRule } from "./PriorityDataRule";
import { BreakEvenDataInfo } from "./BreakEvenDataInfo";
import { DataSeries } from "./DataSeries";
import { DataSeriesMemberPathHint } from "./DataSeriesMemberPathHint";
import { List$1 } from "./List$1";
import { BreakEvenPoints } from "./BreakEvenPoints";
import { markType } from "./type";
import { BreakEvenItem } from "./BreakEvenItem";
import { isNaN_, isInfinity } from "./number";
/**
* @hidden
*/
var BreakEvenDataRule = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(BreakEvenDataRule, _super);
function BreakEvenDataRule() {
var _this = _super.call(this) || this;
_this.priority = 100;
return _this;
}
BreakEvenDataRule.prototype.evaluate = function (a) {
var b = this.b(a);
if (b != null && b.k != 0) {
this.d(a, b);
}
};
BreakEvenDataRule.prototype.d = function (a, b) {
var c = a.aj("BreakEvenTitle_ProfitArea", "Profit Area");
var d = a.aj("BreakEvenTitle_LossArea", "Loss Area");
var e = a.aj("BreakEvenTitle_SafetyMargin", "Safety Margin");
var f = a.aj("BreakEvenTitle_SalesRevenue", "Sales Revenue");
var g = a.aj("BreakEvenTitle_TotalCost", "Total Cost");
var h = a.aj("BreakEvenTitle_FixedCost", "Fixed Cost");
var i = a.aj("BreakEvenTitle_VariableCost", "Variable Cost");
var j = a.aj("BreakEvenTitle_MarginalProfit", "Marginal Profit");
var k = a.aj("BreakEvenTitle_BreakEven", "Break Even");
var l = a.getCurrentPath();
var m = new DataSeries();
m.data = this.c(b.ag);
m.dataPath = "PositiveRevenuePoints";
m.addMemberPathHint2("Points", 7);
m.suggestedSeries = 18;
m.suggestedPrimaryAxis = 1;
m.suggestedSecondaryAxis = 1;
m.suggestedMarker = 1;
m.title = c;
a.addDataSeries(m, this);
var n = new DataSeries();
n.data = this.c(b.ae);
n.dataPath = "NegativeRevenuePoints";
n.addMemberPathHint2("Points", 7);
n.suggestedSeries = 18;
n.suggestedPrimaryAxis = 1;
n.suggestedSecondaryAxis = 1;
n.suggestedMarker = 1;
n.title = d;
a.addDataSeries(n, this);
var o = new DataSeries();
o.data = this.c(b.ah);
o.dataPath = "ProfitPoints";
o.addMemberPathHint2("Points", 7);
o.suggestedSeries = 18;
o.suggestedPrimaryAxis = 1;
o.suggestedSecondaryAxis = 1;
o.suggestedMarker = 1;
o.title = e;
a.addDataSeries(o, this);
var p = new DataSeries();
p.data = b.ac;
p.dataPath = "SalesRevenue";
p.addMemberPathHint2("SalesRevenue", 2);
p.addMemberPathHint2("Units", 1);
p.suggestedSeries = 12;
p.suggestedPrimaryAxis = 1;
p.suggestedSecondaryAxis = 1;
p.suggestedMarker = 1;
p.title = f;
a.addDataSeries(p, this);
this.e(p, a, b.w, l);
var q = new DataSeries();
q.data = b.ac;
q.dataPath = "TotalCost";
q.addMemberPathHint2("TotalCost", 2);
q.addMemberPathHint2("Units", 1);
q.suggestedSeries = 12;
q.suggestedPrimaryAxis = 1;
q.suggestedSecondaryAxis = 1;
q.suggestedMarker = 1;
q.title = g;
a.addDataSeries(q, this);
var r = new DataSeries();
r.data = b.ac;
r.dataPath = "FixedCost";
r.addMemberPathHint2("FixedCost", 2);
r.addMemberPathHint2("Units", 1);
r.suggestedSeries = 12;
r.suggestedPrimaryAxis = 1;
r.suggestedSecondaryAxis = 1;
r.suggestedMarker = 1;
r.title = h;
a.addDataSeries(r, this);
this.e(r, a, b.u, l);
var s = new DataSeries();
s.data = b.ac;
s.dataPath = "VariableCost";
s.addMemberPathHint2("VariableCost", 2);
s.addMemberPathHint2("Units", 1);
s.suggestedSeries = 12;
s.suggestedPrimaryAxis = 1;
s.suggestedSecondaryAxis = 1;
s.suggestedMarker = 1;
s.title = i;
a.addDataSeries(s, this);
this.e(s, a, b.z, l);
var t = new DataSeries();
t.data = b.ac;
t.dataPath = "MarginalProfit";
t.addMemberPathHint2("MarginalProfit", 2);
t.addMemberPathHint2("Units", 1);
t.suggestedSeries = 12;
t.suggestedPrimaryAxis = 1;
t.suggestedSecondaryAxis = 1;
t.suggestedMarker = 1;
t.title = j;
a.addDataSeries(t, this);
if (b.v.hasPath()) {
this.e(o, a, b.v, l);
}
var u = new DataSeries();
u.data = b.ad;
u.dataPath = "BreakEvenLines";
u.addMemberPathHint2("SalesRevenue", 2);
u.addMemberPathHint2("Units", 1);
u.suggestedSeries = 12;
u.suggestedPrimaryAxis = 1;
u.suggestedSecondaryAxis = 1;
u.suggestedMarker = 1;
u.title = k;
a.addDataSeries(u, this);
this.e(u, a, b.y, l);
};
BreakEvenDataRule.prototype.c = function (a) {
var b = new List$1(BreakEvenPoints.$, 0);
var c = new BreakEvenPoints();
c.Points = a;
b.add(c);
return b;
};
BreakEvenDataRule.prototype.e = function (a, b, c, d) {
var e = new DataSeriesMemberPathHint();
e.intent = 25;
e.path = d + "." + c.path;
a.addMemberPathHint(e);
};
BreakEvenDataRule.prototype.b = function (a) {
var b = new BreakEvenDataInfo(a);
if (b.p == 0) {
return null;
}
for (var c = 0; c < b.p; c++) {
if (c == 0) {
var d = this.a(b.b.getAllStringProperties());
var e = this.a(b.b.getAllNumericProperties());
b.s(e, null);
b.t(d, null);
if (!b.y.hasPath() || !b.w.hasPath() || !b.u.hasPath() || !b.z.hasPath()) {
return null;
}
}
var f = b.l.getItemAtIndex(c);
var g = new BreakEvenItem();
g.FixedCost = parseFloat(b.l.getItemValue(f, b.u.path).toString());
g.VariableCost = parseFloat(b.l.getItemValue(f, b.z.path).toString());
g.Units = parseFloat(b.l.getItemValue(f, b.y.path).toString());
g.SalesRevenue = parseFloat(b.l.getItemValue(f, b.w.path).toString());
var h = NaN;
if (b.v.hasPath()) {
h = parseFloat(b.l.getItemValue(f, b.v.path).toString());
}
if (isNaN_(h) || isInfinity(h)) {
g.MarginalProfit = g.SalesRevenue - g.VariableCost;
}
else {
g.MarginalProfit = h;
}
b.af.add(g);
}
b.ai();
b.k = 4;
return b;
};
BreakEvenDataRule.$t = markType(BreakEvenDataRule, 'BreakEvenDataRule', PriorityDataRule.$);
return BreakEvenDataRule;
}(PriorityDataRule));
export { BreakEvenDataRule };