UNPKG

igniteui-react-core

Version:
234 lines (233 loc) 8.54 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, EnumUtil, fromEnum, typeCast, markType } from "./type"; import { CodeGenerationLibraryItemType_$type } from "./CodeGenerationLibraryItemType"; import { CodeGenerationLibraryItemContent } from "./CodeGenerationLibraryItemContent"; import { CodeGenerationTargetPlatforms_$type } from "./CodeGenerationTargetPlatforms"; import { List$1 } from "./List$1"; import { CodeGenerationLibraryItemPlatform_$type } from "./CodeGenerationLibraryItemPlatform"; import { Dictionary$2 } from "./Dictionary$2"; import { JsonDictionaryItem } from "./JsonDictionaryItem"; import { JsonDictionaryObject } from "./JsonDictionaryObject"; import { JsonDictionaryArray } from "./JsonDictionaryArray"; import { JsonDictionaryValue } from "./JsonDictionaryValue"; /** * @hidden */ var CodeGenerationLibraryItem = /** @class */ /*@__PURE__*/ (function (_super) { __extends(CodeGenerationLibraryItem, _super); function CodeGenerationLibraryItem() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._name = null; _this._type = 0; _this.m = new Dictionary$2(CodeGenerationLibraryItemPlatform_$type, CodeGenerationLibraryItemContent.$, 0); _this.n = new List$1(CodeGenerationLibraryItemContent.$, 0); return _this; } Object.defineProperty(CodeGenerationLibraryItem.prototype, "name", { get: function () { return this._name; }, set: function (a) { this._name = a; }, enumerable: false, configurable: true }); Object.defineProperty(CodeGenerationLibraryItem.prototype, "type", { get: function () { return this._type; }, set: function (a) { this._type = a; }, enumerable: false, configurable: true }); CodeGenerationLibraryItem.prototype.getContentForPlatformString = function (a) { var b; b = EnumUtil.getEnumValue(CodeGenerationTargetPlatforms_$type, EnumUtil.parse(CodeGenerationTargetPlatforms_$type, a, true)); return this.getContentForPlatform(b); }; CodeGenerationLibraryItem.prototype.getConfigForPlatformString = function (a) { var b; b = EnumUtil.getEnumValue(CodeGenerationTargetPlatforms_$type, EnumUtil.parse(CodeGenerationTargetPlatforms_$type, a, true)); return this.getConfigForPlatform(b); }; CodeGenerationLibraryItem.prototype.getContentForPlatform = function (a) { var e_1, _a; try { for (var _b = __values(fromEnum(this.n)), _c = _b.next(); !_c.done; _c = _b.next()) { var b = _c.value; if (this.l(b, a)) { return b; } } } 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 null; }; CodeGenerationLibraryItem.prototype.getConfigForPlatform = function (a) { var b = this.getContentForPlatform(a); if (b == null) { return null; } if (b.configs != null) { var e = b.configs; for (var d = 0; d < e.length; d++) { var c = e[d]; if (this.j(c, a)) { return c; } } } return null; }; CodeGenerationLibraryItem.prototype.j = function (a, b) { return this.k(a.platform, b); }; CodeGenerationLibraryItem.prototype.l = function (a, b) { return this.k(a.platform, b); }; CodeGenerationLibraryItem.prototype.k = function (a, b) { switch (a) { case 11: return true; case 7: return b == 1 || b == 2 || b == 3 || b == 5; case 0: return b == 1; case 8: return b == 0 || b == 4; case 13: return b == 0 || b == 4 || b == 5; case 3: return false; case 1: return b == 2; case 12: return false; case 6: return b == 1 || b == 2 || b == 3; case 2: return b == 3; case 9: return b == 0 || b == 4; case 5: return b == 4; case 4: return b == 0; case 14: return b == 5; case 10: return true; } return false; }; CodeGenerationLibraryItem.prototype.addPlatformContent = function (a, b) { if (b == null) { return; } this.m.item(a, b); b.platform = a; this.n.add(b); }; CodeGenerationLibraryItem.prototype.b = function (a) { if (a == null) { return null; } return ((function () { var $ret = new CodeGenerationLibraryItemContent(); $ret.content = a; return $ret; })()); }; CodeGenerationLibraryItem.prototype.e = function (a) { if (a == null) { return null; } return ((function () { var $ret = new CodeGenerationLibraryItemContent(); $ret.content = a; $ret.isJson = true; return $ret; })()); }; CodeGenerationLibraryItem.a = function (a) { var b = new CodeGenerationLibraryItem(); if (typeCast(JsonDictionaryObject.$, a) !== null) { var c = a; if (c.g("name")) { b.name = c.item("name").value.toString(); } if (c.g("type")) { var d = c.item("type").value.toString(); var e = 3; var f = EnumUtil.tryParse$1(CodeGenerationLibraryItemType_$type, d, true, e); e = f.p2; b.type = e; } if (c.g("content")) { var g = c.item("content"); if (typeCast(JsonDictionaryArray.$, g) !== null) { var h = g; if (h.items != null && h.items.length > 0) { for (var i = 0; i < h.items.length; i++) { var j = CodeGenerationLibraryItemContent.b(h.items[i]); b.n.add(j); b.m.addItem(j.platform, j); } } } } } return b; }; CodeGenerationLibraryItem.prototype.i = function () { var e_2, _a; var _this = this; var a = new JsonDictionaryObject(); a.item("name", ((function () { var $ret = new JsonDictionaryValue(); $ret.e = 2; $ret.value = _this.name; return $ret; })())); var b = new JsonDictionaryArray(); a.item("content", b); a.item("type", ((function () { var $ret = new JsonDictionaryValue(); $ret.e = 2; $ret.value = EnumUtil.getName(CodeGenerationLibraryItemType_$type, _this.type); return $ret; })())); var c = new List$1(JsonDictionaryItem.$, 0); try { for (var _b = __values(fromEnum(this.n)), _c = _b.next(); !_c.done; _c = _b.next()) { var d = _c.value; var e = d.e(); c.add(e); } } 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; } } b.items = c.toArray(); return a; }; CodeGenerationLibraryItem.$t = markType(CodeGenerationLibraryItem, 'CodeGenerationLibraryItem'); return CodeGenerationLibraryItem; }(Base)); export { CodeGenerationLibraryItem };