UNPKG

igniteui-react-core

Version:
205 lines (204 loc) 8.13 kB
/* 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, __values } from "tslib"; 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 */ var DescriptionPathEvaluator = /** @class */ /*@__PURE__*/ (function (_super) { __extends(DescriptionPathEvaluator, _super); function DescriptionPathEvaluator() { return _super !== null && _super.apply(this, arguments) || this; } DescriptionPathEvaluator.prototype.a = function (a, b, c) { var d = DescriptionTreeBuilder.createTree(a, b); return this.b(d, a, c); }; DescriptionPathEvaluator.prototype.b = function (a, b, c) { if (c.operator == 1) { var d = new List$1(DescriptionPathEvaluatorResult.$, 0); for (var e = 0; e < c.rootSegments.length; e++) { if (c.rootSegments == null || c.rootSegments.length < 1) { return null; } var 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; } var g = this.d(a, b, c.rootSegments[0]); if (g != null) { return [g]; } return null; } }; DescriptionPathEvaluator.prototype.d = function (a, b, c) { var d = a; var e = d; for (var f = 0; f < c.length; f++) { var g = this.c(a, b, c[f]); if (g == null) { return null; } var h = g.a; if (typeCast(DescriptionTreeNode.$, h) !== null) { d = h; e = d; } else { e = h; } } return ((function () { var $ret = new DescriptionPathEvaluatorResult(); $ret.a = e; return $ret; })()); }; DescriptionPathEvaluator.prototype.c = function (a, b, c) { var d = null; if (c.elementName != null) { if (!a.c(c.elementName)) { return null; } var 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; } var f_1 = d; if (f_1 == null) { return null; } var _loop_1 = function (g) { var h = c.indexers[g]; if (h != null) { if (h.a) { if (h.c != null) { var _loop_2 = function (i) { var j = f_1[i]; if (typeCast(DescriptionTreeNode.$, j) !== null) { if (this_1.e(b, j, h.c)) { return { value: ((function () { var $ret = new DescriptionPathEvaluatorResult(); $ret.a = j; return $ret; })()) }; } } }; for (var i = 0; i < f_1.length; i++) { var state_2 = _loop_2(i); if (typeof state_2 === "object") return state_2; } } else { if (f_1.length > 0) { return { value: ((function () { var $ret = new DescriptionPathEvaluatorResult(); $ret.a = f_1[0]; return $ret; })()) }; } else { return { value: null }; } } } else { if (h.b >= 0 && h.b < f_1.length) { return { value: ((function () { var $ret = new DescriptionPathEvaluatorResult(); $ret.a = f_1[h.b]; return $ret; })()) }; } else { return { value: null }; } } } }; var this_1 = this; for (var g = 0; g < c.indexers.length; g++) { var state_1 = _loop_1(g); if (typeof state_1 === "object") return state_1.value; } } return null; } } return ((function () { var $ret = new DescriptionPathEvaluatorResult(); $ret.a = d; return $ret; })()); }; DescriptionPathEvaluator.prototype.f = function (a) { var 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; }; DescriptionPathEvaluator.prototype.e = function (a, b, c) { var e_1, _a; if (b == null) { return false; } var d = b.i; var e = a.w(d); var f = getInstanceType(e); var g = this.f(f); try { for (var _b = __values(fromEnum(g)), _c = _b.next(); !_c.done; _c = _b.next()) { var h = _c.value; if (Base.equalsStatic(h, c)) { return true; } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } return false; }; DescriptionPathEvaluator.$t = markType(DescriptionPathEvaluator, 'DescriptionPathEvaluator'); return DescriptionPathEvaluator; }(Base)); export { DescriptionPathEvaluator };