igniteui-react-core
Version:
Ignite UI React Core.
173 lines (172 loc) • 7.05 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 { Base, typeCast, Array_$type, String_$type, fromEnum, markType, getInstanceType } from "./type";
import { DescriptionPathEvaluatorResult } from "./DescriptionPathEvaluatorResult";
import { DescriptionTreeNode } from "./DescriptionTreeNode";
import { DescriptionTreeBuilder } from "./DescriptionTreeBuilder";
import { List$1 } from "./List$1";
/**
* @hidden
*/
export let DescriptionPathEvaluator = /*@__PURE__*/ (() => {
class DescriptionPathEvaluator extends Base {
a(a, b, c) {
let d = DescriptionTreeBuilder.createTree(a, b);
return this.b(d, a, c);
}
b(a, b, c) {
if (c.operator == 1) {
let d = new List$1(DescriptionPathEvaluatorResult.$, 0);
for (let e = 0; e < c.rootSegments.length; e++) {
if (c.rootSegments == null || c.rootSegments.length < 1) {
return null;
}
let f = this.d(a, b, c.rootSegments[e]);
if (f != null) {
d.add(f);
}
}
return d.toArray();
}
else {
if (c.rootSegments == null || c.rootSegments.length < 1) {
return null;
}
let g = this.d(a, b, c.rootSegments[0]);
if (g != null) {
return [g];
}
return null;
}
}
d(a, b, c) {
let d = a;
let e = d;
for (let f = 0; f < c.length; f++) {
let g = this.c(a, b, c[f]);
if (g == null) {
return null;
}
let h = g.a;
if (typeCast(DescriptionTreeNode.$, h) !== null) {
d = h;
e = d;
}
else {
e = h;
}
}
return ((() => {
let $ret = new DescriptionPathEvaluatorResult();
$ret.a = e;
return $ret;
})());
}
c(a, b, c) {
let d = null;
if (c.elementName != null) {
if (!a.c(c.elementName)) {
return null;
}
let e = a.a(c.elementName);
if (e != null) {
d = e.b;
}
else {
return null;
}
if (c.indexers != null) {
if (e.a.knownType == 9 || e.a.knownType == 10 || e.a.knownType == 17) {
if (!(typeCast(Array_$type, d) !== null)) {
return null;
}
let f = d;
if (f == null) {
return null;
}
for (let g = 0; g < c.indexers.length; g++) {
let h = c.indexers[g];
if (h != null) {
if (h.a) {
if (h.c != null) {
for (let i = 0; i < f.length; i++) {
let j = f[i];
if (typeCast(DescriptionTreeNode.$, j) !== null) {
if (this.e(b, j, h.c)) {
return ((() => {
let $ret = new DescriptionPathEvaluatorResult();
$ret.a = j;
return $ret;
})());
}
}
}
}
else {
if (f.length > 0) {
return ((() => {
let $ret = new DescriptionPathEvaluatorResult();
$ret.a = f[0];
return $ret;
})());
}
else {
return null;
}
}
}
else {
if (h.b >= 0 && h.b < f.length) {
return ((() => {
let $ret = new DescriptionPathEvaluatorResult();
$ret.a = f[h.b];
return $ret;
})());
}
else {
return null;
}
}
}
}
}
return null;
}
}
return ((() => {
let $ret = new DescriptionPathEvaluatorResult();
$ret.a = d;
return $ret;
})());
}
f(a) {
let b = new List$1(String_$type, 0);
while (a != null && a.typeName != "Description" && a != Base.$) {
b.insert(0, a.typeName);
a = a.baseType;
}
return b;
}
e(a, b, c) {
if (b == null) {
return false;
}
let d = b.i;
let e = a.w(d);
let f = getInstanceType(e);
let g = this.f(f);
for (let h of fromEnum(g)) {
if (Base.equalsStatic(h, c)) {
return true;
}
}
return false;
}
}
DescriptionPathEvaluator.$t = /*@__PURE__*/ markType(DescriptionPathEvaluator, 'DescriptionPathEvaluator');
return DescriptionPathEvaluator;
})();