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