igniteui-angular-core
Version:
Ignite UI Angular Core logic used in multiple UI components.
111 lines (110 loc) • 4.22 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, __values } from "tslib";
import { Base, String_$type, typeCast, fromEnum, markType } from "./type";
import { JsonDictionaryParser } from "./JsonDictionaryParser";
import { JsonDictionaryItem } from "./JsonDictionaryItem";
import { JsonDictionaryObject } from "./JsonDictionaryObject";
import { JsonDictionaryArray } from "./JsonDictionaryArray";
import { CodeGenerationLibraryItem } from "./CodeGenerationLibraryItem";
import { List$1 } from "./List$1";
import { Dictionary$2 } from "./Dictionary$2";
/**
* @hidden
*/
var CodeGenerationLibrary = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(CodeGenerationLibrary, _super);
function CodeGenerationLibrary() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.f = new List$1(CodeGenerationLibraryItem.$, 0);
_this.e = new Dictionary$2(String_$type, CodeGenerationLibraryItem.$, 0);
return _this;
}
CodeGenerationLibrary.fromJson = function (a) {
var b = new JsonDictionaryParser();
var c = b.parse(a);
var d = new CodeGenerationLibrary();
if (typeCast(JsonDictionaryObject.$, c) !== null) {
var e = c;
if (e.g("items")) {
var f = typeCast(JsonDictionaryArray.$, e.item("items"));
if (f != null) {
var i = f.items;
for (var h = 0; h < i.length; h++) {
var g = i[h];
var j = CodeGenerationLibraryItem.a(g);
d.f.add(j);
d.e.addItem(j.name, j);
}
}
}
}
return d;
};
CodeGenerationLibrary.prototype.toJson = function () {
var e_1, _a;
var a = new JsonDictionaryObject();
var b = new JsonDictionaryArray();
a.item("items", b);
var c = new List$1(JsonDictionaryItem.$, 0);
try {
for (var _b = __values(fromEnum(this.f)), _c = _b.next(); !_c.done; _c = _b.next()) {
var d = _c.value;
var e = d.i();
c.add(e);
}
}
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;
}
}
b.items = c.toArray();
return a.b();
};
CodeGenerationLibrary.prototype.hasItem = function (a) {
return this.e.containsKey(a);
};
CodeGenerationLibrary.prototype.getKeys = function () {
var e_2, _a;
var a = new List$1(String_$type, 0);
try {
for (var _b = __values(fromEnum(this.e.keys)), _c = _b.next(); !_c.done; _c = _b.next()) {
var b = _c.value;
a.add(b);
}
}
catch (e_2_1) {
e_2 = { error: e_2_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_2)
throw e_2.error;
}
}
return a.toArray();
};
CodeGenerationLibrary.prototype.getItem = function (a) {
return this.e.item(a);
};
CodeGenerationLibrary.$t = markType(CodeGenerationLibrary, 'CodeGenerationLibrary');
return CodeGenerationLibrary;
}(Base));
export { CodeGenerationLibrary };