igniteui-angular-core
Version:
Ignite UI Angular Core logic used in multiple UI components.
133 lines (132 loc) • 5.37 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 { Base, String_$type, typeCast, Array_$type, markType } from "./type";
import { List$1 } from "./List$1";
import { HashSet$1 } from "./HashSet$1";
import { DescriptionTreeNode } from "./DescriptionTreeNode";
import { Description } from "./Description";
import { DescriptionTreeBuilderOptions } from "./DescriptionTreeBuilderOptions";
import { RectDescription } from "./RectDescription";
import { PointDescription } from "./PointDescription";
import { SizeDescription } from "./SizeDescription";
/**
* @hidden
*/
var DescriptionTreeBuilder = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(DescriptionTreeBuilder, _super);
function DescriptionTreeBuilder() {
return _super !== null && _super.apply(this, arguments) || this;
}
DescriptionTreeBuilder.e = function (a, item_) {
var propertyKey_ = null;
var ret_ = new List$1(String_$type, 0);
var seen_ = new HashSet$1(String_$type, 0);
var exclusions_ = {};
var seen = new Set();
var comp = item_;
while (comp = (comp.prototype || Object.getPrototypeOf(comp))) {
if (comp == Base.prototype) {
break;
}
var props = Object.getOwnPropertyNames(comp.constructor.prototype);
for (var i = 0; i < props.length; i++) {
if (!seen.has(props[i])) {
seen.add(props[i]);
ret_.add(props[i]);
}
}
}
;
return ret_;
};
DescriptionTreeBuilder.createTree = function (a, description_) {
return DescriptionTreeBuilder.createTreeWithMoreOptions(a, description_, ((function () {
var $ret = new DescriptionTreeBuilderOptions();
$ret.d = false;
return $ret;
})()));
};
DescriptionTreeBuilder.createTreeWithOptions = function (a, description_, b) {
return DescriptionTreeBuilder.createTreeWithMoreOptions(a, description_, ((function () {
var $ret = new DescriptionTreeBuilderOptions();
$ret.d = b;
return $ret;
})()));
};
DescriptionTreeBuilder.d = function (a) {
if (typeCast(RectDescription.$, a) !== null || typeCast(PointDescription.$, a) !== null || typeCast(SizeDescription.$, a) !== null) {
return false;
}
return true;
};
DescriptionTreeBuilder.createTreeWithMoreOptions = function (a, description_, b) {
var c = new DescriptionTreeNode();
if (description_ == null) {
return null;
}
var d = b.d;
var e = b.a;
var f = b.b;
if (e) {
var g = description_.isDescriptionModified();
b.c = b.c || g;
}
if (f) {
description_.clearIsDescriptionModified();
}
var h = DescriptionTreeBuilder.e(a, description_);
for (var i = 0; i < h.count; i++) {
var key_ = h._inner[i];
if (key_.toLowerCase() != "type" && !description_.isDirty(DescriptionTreeBuilder.f(key_))) {
continue;
}
var j = description_[key_];
if (typeCast(Description.$, j) !== null && DescriptionTreeBuilder.d(j)) {
var k = DescriptionTreeBuilder.createTree(a, j);
j = k;
}
if (typeCast(Array_$type, j) !== null) {
var l = j;
var m = new Array(l.length);
for (var n = 0; n < m.length; n++) {
var o = l[n];
if (typeCast(Description.$, o) !== null && DescriptionTreeBuilder.d(o)) {
var p = DescriptionTreeBuilder.createTree(a, o);
m[n] = p;
}
else {
m[n] = o;
}
}
j = m;
}
if (key_.toLowerCase() == "type") {
c.i = j;
}
c.j(DescriptionTreeBuilder.f(key_), j);
}
if (c.c("type")) {
var q = c.a("type").b;
var r = c.f();
for (var s = 0; s < r.count; s++) {
var t = r._inner[s];
t.a = a.getMetadata(q, t.c);
}
}
return c;
};
DescriptionTreeBuilder.f = function (key_) {
if (key_ == null) {
return null;
}
return key_.substr(0, 1).toUpperCase() + key_.substr(1);
};
DescriptionTreeBuilder.$t = markType(DescriptionTreeBuilder, 'DescriptionTreeBuilder');
return DescriptionTreeBuilder;
}(Base));
export { DescriptionTreeBuilder };