igniteui-react-core
Version:
Ignite UI React Core.
189 lines (188 loc) • 7.11 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, 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
*/
export let CodeGenerationLibraryItem = /*@__PURE__*/ (() => {
class CodeGenerationLibraryItem extends Base {
constructor() {
super(...arguments);
this._name = null;
this._type = 0;
this.m = new Dictionary$2(CodeGenerationLibraryItemPlatform_$type, CodeGenerationLibraryItemContent.$, 0);
this.n = new List$1(CodeGenerationLibraryItemContent.$, 0);
}
get name() {
return this._name;
}
set name(a) {
this._name = a;
}
get type() {
return this._type;
}
set type(a) {
this._type = a;
}
getContentForPlatformString(a) {
let b;
b = EnumUtil.getEnumValue(CodeGenerationTargetPlatforms_$type, EnumUtil.parse(CodeGenerationTargetPlatforms_$type, a, true));
return this.getContentForPlatform(b);
}
getConfigForPlatformString(a) {
let b;
b = EnumUtil.getEnumValue(CodeGenerationTargetPlatforms_$type, EnumUtil.parse(CodeGenerationTargetPlatforms_$type, a, true));
return this.getConfigForPlatform(b);
}
getContentForPlatform(a) {
for (let b of fromEnum(this.n)) {
if (this.l(b, a)) {
return b;
}
}
return null;
}
getConfigForPlatform(a) {
let b = this.getContentForPlatform(a);
if (b == null) {
return null;
}
if (b.configs != null) {
let e = b.configs;
for (let d = 0; d < e.length; d++) {
let c = e[d];
if (this.j(c, a)) {
return c;
}
}
}
return null;
}
j(a, b) {
return this.k(a.platform, b);
}
l(a, b) {
return this.k(a.platform, b);
}
k(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;
}
addPlatformContent(a, b) {
if (b == null) {
return;
}
this.m.item(a, b);
b.platform = a;
this.n.add(b);
}
b(a) {
if (a == null) {
return null;
}
return ((() => {
let $ret = new CodeGenerationLibraryItemContent();
$ret.content = a;
return $ret;
})());
}
e(a) {
if (a == null) {
return null;
}
return ((() => {
let $ret = new CodeGenerationLibraryItemContent();
$ret.content = a;
$ret.isJson = true;
return $ret;
})());
}
static a(a) {
let b = new CodeGenerationLibraryItem();
if (typeCast(JsonDictionaryObject.$, a) !== null) {
let c = a;
if (c.g("name")) {
b.name = c.item("name").value.toString();
}
if (c.g("type")) {
let d = c.item("type").value.toString();
let e = 3;
let f = EnumUtil.tryParse$1(CodeGenerationLibraryItemType_$type, d, true, e);
e = f.p2;
b.type = e;
}
if (c.g("content")) {
let g = c.item("content");
if (typeCast(JsonDictionaryArray.$, g) !== null) {
let h = g;
if (h.items != null && h.items.length > 0) {
for (let i = 0; i < h.items.length; i++) {
let j = CodeGenerationLibraryItemContent.b(h.items[i]);
b.n.add(j);
b.m.addItem(j.platform, j);
}
}
}
}
}
return b;
}
i() {
let a = new JsonDictionaryObject();
a.item("name", ((() => {
let $ret = new JsonDictionaryValue();
$ret.e = 2;
$ret.value = this.name;
return $ret;
})()));
let b = new JsonDictionaryArray();
a.item("content", b);
a.item("type", ((() => {
let $ret = new JsonDictionaryValue();
$ret.e = 2;
$ret.value = EnumUtil.getName(CodeGenerationLibraryItemType_$type, this.type);
return $ret;
})()));
let c = new List$1(JsonDictionaryItem.$, 0);
for (let d of fromEnum(this.n)) {
let e = d.e();
c.add(e);
}
b.items = c.toArray();
return a;
}
}
CodeGenerationLibraryItem.$t = /*@__PURE__*/ markType(CodeGenerationLibraryItem, 'CodeGenerationLibraryItem');
return CodeGenerationLibraryItem;
})();