igniteui-react-core
Version:
Ignite UI React Core.
200 lines (199 loc) • 7.94 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 { 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
*/
export let BreakEvenDataRule = /*@__PURE__*/ (() => {
class BreakEvenDataRule extends PriorityDataRule {
constructor() {
super();
this.priority = 100;
}
evaluate(a) {
let b = this.b(a);
if (b != null && b.k != 0) {
this.d(a, b);
}
}
d(a, b) {
let c = a.ab("BreakEvenTitle_ProfitArea", "Profit Area");
let d = a.ab("BreakEvenTitle_LossArea", "Loss Area");
let e = a.ab("BreakEvenTitle_SafetyMargin", "Safety Margin");
let f = a.ab("BreakEvenTitle_SalesRevenue", "Sales Revenue");
let g = a.ab("BreakEvenTitle_TotalCost", "Total Cost");
let h = a.ab("BreakEvenTitle_FixedCost", "Fixed Cost");
let i = a.ab("BreakEvenTitle_VariableCost", "Variable Cost");
let j = a.ab("BreakEvenTitle_MarginalProfit", "Marginal Profit");
let k = a.ab("BreakEvenTitle_BreakEven", "Break Even");
let l = a.getCurrentPath();
let 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);
let 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);
let 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);
let 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);
let 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);
let 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);
let 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);
let 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);
}
let 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);
}
c(a) {
let b = new List$1(BreakEvenPoints.$, 0);
let c = new BreakEvenPoints();
c.Points = a;
b.add(c);
return b;
}
e(a, b, c, d) {
let e = new DataSeriesMemberPathHint();
e.intent = 25;
e.path = d + "." + c.path;
a.addMemberPathHint(e);
}
b(a) {
let b = new BreakEvenDataInfo(a);
if (b.p == 0) {
return null;
}
for (let c = 0; c < b.p; c++) {
if (c == 0) {
let d = this.a(b.b.getAllStringProperties());
let 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;
}
}
let f = b.l.getItemAtIndex(c);
let 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());
let 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 = /*@__PURE__*/ markType(BreakEvenDataRule, 'BreakEvenDataRule', PriorityDataRule.$);
return BreakEvenDataRule;
})();