UNPKG

igniteui-angular-core

Version:

Ignite UI Angular Core logic used in multiple UI components.

677 lines (676 loc) 24.6 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, Type, String_$type, Delegate_$type, fromEnum, EnumUtil, markType } from "./type"; import { TypeDescriptionPlatform_$type } from "./TypeDescriptionPlatform"; import { Dictionary$2 } from "./Dictionary$2"; import { HashSet$1 } from "./HashSet$1"; import { List$1 } from "./List$1"; import { TypeDescriptionWellKnownType_$type } from "./TypeDescriptionWellKnownType"; import { stringContains, stringReplace, stringStartsWith } from "./string"; import { tryParseInt32_1 } from "./numberExtended"; /** * @hidden */ export var IComponentRendererAdapter_$type = new Type(null, 'IComponentRendererAdapter'); /** * @hidden */ var TypeDescriptionContext = /** @class */ /*@__PURE__*/ (function (_super) { __extends(TypeDescriptionContext, _super); function TypeDescriptionContext(a, b) { var _this = _super.call(this) || this; _this.r = new Dictionary$2(String_$type, Base.$, 0); _this.q = new Dictionary$2(String_$type, Delegate_$type, 0); _this.g = null; _this.i = 0; _this.s = new HashSet$1(Dictionary$2.$.specialize(String_$type, String_$type), 0); _this.g = a; _this.i = b; return _this; } TypeDescriptionContext.prototype.ad = function (a) { if (!this.s.contains(a)) { this.s.add_1(a); } }; TypeDescriptionContext.prototype.k = function (a) { return this.s.contains(a); }; TypeDescriptionContext.prototype.ae = function (a, b) { this.s.add_1(b); this.r.item(a, b); }; TypeDescriptionContext.prototype.af = function (a, b) { this.q.item(a, b); }; TypeDescriptionContext.ac = function (key_) { if (key_ == null) { return null; } return key_.substr(0, 1).toUpperCase() + key_.substr(1); }; TypeDescriptionContext.ab = function (key_) { if (key_ == null) { return null; } return key_.substr(0, 1).toLowerCase() + key_.substr(1); }; TypeDescriptionContext.prototype.a = function () { var e_1, _a; var a = new List$1(String_$type, 0); try { for (var _b = __values(fromEnum(this.r.keys)), _c = _b.next(); !_c.done; _c = _b.next()) { var b = _c.value; a.add(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 a.toArray(); }; TypeDescriptionContext.prototype.getAllProperties = function (a) { if (this.r.containsKey(a)) { var b = this.r.item(a); return new List$1(String_$type, 1, b.keys).toArray(); } else { return null; } }; TypeDescriptionContext.prototype.getMetadata = function (a, b) { if (this.r.containsKey(a + "@@" + b)) { return this.r.item(a + "@@" + b); } if (this.r.containsKey(a)) { var c = new TypeDescriptionMetadata(); c.owningContext = this; c.owningType = a; c.propertyName = b; var d = this.r.item(a); if (!d.containsKey(b)) { this.r.item(a + "@@" + b, null); return null; } var e = d.item(b); var f = "Unknown"; var g = null; var h = null; var i = null; if (stringContains(e, "[")) { var j = e.indexOf('['); var k = e.indexOf(']'); if (j != 0 && e.charAt(j - 1) == ',') { j = j - 1; } if (k != e.length - 1 && e.charAt(k + 1) == ',') { k = k + 1; } var l = e.substr(j, k - j + 1); e = stringReplace(e, l, ""); } var m = e.split(')'); if (m.length > 1) { var n = m[0]; e = m[1]; n = stringReplace(n, "(", ""); var o = n.split(','); for (var q = 0; q < o.length; q++) { var p = o[q]; var r = p.split(':'); var s = r[0]; var t = r[1]; var u = 3; switch (s) { case "web": c.r(3, t); c.r(2, t); c.r(4, t); c.r(1, t); continue; case "xam": c.r(6, t); c.r(7, t); c.r(5, t); c.r(9, t); c.r(10, t); continue; case "w": u = 0; break; case "a": u = 3; break; case "r": u = 2; break; case "j": u = 1; break; case "wc": u = 4; break; case "xf": u = 5; break; case "xa": u = 6; break; case "xi": u = 7; break; case "wf": u = 8; break; case "uwp": u = 9; break; case "winui": u = 10; break; case "k": u = 13; break; case "s": u = 14; break; case "p": c.r(6, t); c.r(7, t); c.r(5, t); c.r(9, t); c.r(10, t); c.r(8, t); c.r(13, t); c.r(14, t); continue; } c.r(u, t); } } var v = e.split(':'); if (v.length >= 4) { i = v[3]; } if (v.length >= 3) { g = v[2]; } if (v.length >= 2) { h = v[1]; } if (v.length >= 1) { f = v[0]; } if (stringStartsWith(f, "*")) { c.mustBeFirst = true; f = f.substr(1); } c.knownType = EnumUtil.getEnumValue(TypeDescriptionWellKnownType_$type, EnumUtil.parse(TypeDescriptionWellKnownType_$type, f, true)); c.specificExternalType = h; c.specificType = g; if (c.knownType == 19) { if (i == "customEvent") { c.isCustomEvent = true; } if (i == "skipWCPrefix") { c.skipWCEventPrefix = true; } } c.collectionElementType = i; this.r.item(a + "@@" + b, c); return c; } return null; }; TypeDescriptionContext.prototype.z = function (a, b) { if (this.r.containsKey(a + "@@" + b + "@args")) { return this.r.item(a + "@@" + b + "@args"); } if (this.r.containsKey(a)) { var c = this.r.item(a); if (!c.containsKey(b + "@args")) { this.r.item(a + "@@" + b + "@args", null); return null; } var d = c.item(b + "@args"); this.r.item(a + "@@" + b + "@args", d); return d; } return null; }; TypeDescriptionContext.prototype.w = function (a) { if (this.q.containsKey(a)) { return this.q.item(a)(); } return null; }; TypeDescriptionContext.prototype.ag = function (a, b, c, d) { if (TypeDescriptionMetadata.shouldCamelize(this.i)) { b = TypeDescriptionContext.ab(b); } else { b = TypeDescriptionContext.ac(b); } this.g.setPropertyValue(a, b, c, d, null, null); }; TypeDescriptionContext.prototype.ah = function (a, b, c, d) { b = TypeDescriptionContext.ac(b); this.g.setPropertyValue(a, b, c, d, null, null); }; TypeDescriptionContext.prototype.v = function (a) { return this.g.createColorCollection(a); }; TypeDescriptionContext.prototype.u = function (a) { return this.g.createBrushCollection(a); }; TypeDescriptionContext.prototype.x = function (a) { return this.g.createDoubleCollection(a); }; TypeDescriptionContext.prototype.y = function (a, b, c) { return this.g.createObject(a, b, this, c); }; TypeDescriptionContext.prototype.t = function (a, b, c, d) { if (c != null && c.owningType != null && c.propertyName != null && this.j(c.owningType, c.propertyName) && d) { var e = this.c(c.owningType, c.propertyName); var f_1 = this.d(c.owningType, c.propertyName); if (e != null && f_1 != null) { var _loop_1 = function (g) { if (e[g].toLowerCase() == b.toLowerCase()) { var h_1 = 0; if (((function () { var i = tryParseInt32_1(f_1[g], h_1); h_1 = i.p1; return i.ret; })())) { return { value: h_1 }; } } }; for (var g = 0; g < e.length; g++) { var state_1 = _loop_1(g); if (typeof state_1 === "object") return state_1.value; } } } return this.g.coerceToEnum(a, this, b); }; TypeDescriptionContext.prototype.c = function (a, b) { if (this.r.containsKey(a + "@@" + b + "@names")) { return this.r.item(a + "@@" + b + "@names"); } if (this.r.containsKey(a)) { var c = this.r.item(a); if (!c.containsKey(b + "@names")) { this.r.item(a + "@@" + b + "@names", null); return null; } var d = c.item(b + "@names"); var e = d.split(';'); this.r.item(a + "@@" + b + "@names", e); return e; } else { return null; } }; TypeDescriptionContext.prototype.j = function (a, b) { if (this.r.containsKey(a + "@@" + b + "@constantValues")) { return this.r.item(a + "@@" + b + "@constantValues") != null; } if (this.r.containsKey(a)) { var c = this.r.item(a); if (!c.containsKey(b + "@constantValues")) { this.r.item(a + "@@" + b + "@constantValues", null); return false; } var d = c.item(b + "@constantValues"); var e = d.split(';'); this.r.item(a + "@@" + b + "@constantValues", e); return e != null; } else { return false; } }; TypeDescriptionContext.prototype.d = function (a, b) { if (this.r.containsKey(a + "@@" + b + "@constantValues")) { return this.r.item(a + "@@" + b + "@constantValues"); } if (this.r.containsKey(a)) { var c = this.r.item(a); if (!c.containsKey(b + "@constantValues")) { this.r.item(a + "@@" + b + "@constantValues", null); return null; } var d = c.item(b + "@constantValues"); var e = d.split(';'); this.r.item(a + "@@" + b + "@constantValues", e); return e; } else { return null; } }; TypeDescriptionContext.prototype.hasNameBinding = function (a, b) { if (this.r.containsKey(a + "@@" + b + "@nameBinding")) { return this.r.item(a + "@@" + b + "@nameBinding") == "true"; } if (this.r.containsKey(a)) { var c = this.r.item(a); if (!c.containsKey(b + "@nameBinding")) { this.r.item(a + "@@" + b + "@nameBinding", null); return false; } var d = c.item(b + "@nameBinding"); this.r.item(a + "@@" + b + "@names", d); return d == "true"; } else { return false; } }; TypeDescriptionContext.prototype.getMustSetInCodePlatforms = function (a, b) { if (this.r.containsKey(a + "@@" + b + "@mustSetInCode")) { return this.r.item(a + "@@" + b + "@mustSetInCode"); } if (this.r.containsKey(a)) { var c = this.r.item(a); if (!c.containsKey(b + "@mustSetInCode")) { this.r.item(a + "@@" + b + "@mustSetInCode", null); return null; } var d = c.item(b + "@mustSetInCode"); var e = d.split(';'); this.r.item(a + "@@" + b + "@mustSetInCode", e); return e; } else { return null; } }; TypeDescriptionContext.prototype.getStringUnionPlatforms = function (a, b) { if (this.r.containsKey(a + "@@" + b + "@stringUnion")) { return this.r.item(a + "@@" + b + "@stringUnion"); } if (this.r.containsKey(a)) { var c = this.r.item(a); if (!c.containsKey(b + "@stringUnion")) { this.r.item(a + "@@" + b + "@stringUnion", null); return null; } var d = c.item(b + "@stringUnion"); var e = d.split(';'); this.r.item(a + "@@" + b + "@stringUnion", e); return e; } else { return null; } }; TypeDescriptionContext.prototype.hasMustSetInCodePlatforms = function (a, b) { if (this.r.containsKey(a + "@@" + b + "@mustSetInCode")) { return this.r.item(a + "@@" + b + "@mustSetInCode") != null; } if (this.r.containsKey(a)) { var c = this.r.item(a); if (!c.containsKey(b + "@mustSetInCode")) { this.r.item(a + "@@" + b + "@mustSetInCode", null); return false; } var d = c.item(b + "@mustSetInCode"); var e = d.split(';'); this.r.item(a + "@@" + b + "@mustSetInCode", e); return true; } else { return false; } }; TypeDescriptionContext.prototype.hasStringUnionPlatforms = function (a, b) { if (this.r.containsKey(a + "@@" + b + "@stringUnion")) { return this.r.item(a + "@@" + b + "@stringUnion") != null; } if (this.r.containsKey(a)) { var c = this.r.item(a); if (!c.containsKey(b + "@stringUnion")) { this.r.item(a + "@@" + b + "@stringUnion", null); return false; } var d = c.item(b + "@stringUnion"); var e = d.split(';'); this.r.item(a + "@@" + b + "@stringUnion", e); return true; } else { return false; } }; TypeDescriptionContext.prototype.hasQueryListName = function (a, b) { if (this.r.containsKey(a + "@@" + b + "@ngQueryList")) { return this.r.item(a + "@@" + b + "@ngQueryList") != null; } if (this.r.containsKey(a)) { var c = this.r.item(a); if (!c.containsKey(b + "@ngQueryList")) { this.r.item(a + "@@" + b + "@ngQueryList", null); return false; } var d = c.item(b + "@ngQueryList"); this.r.item(a + "@@" + b + "@ngQueryList", d); return d != null; } else { return false; } }; TypeDescriptionContext.prototype.getQueryListName = function (a, b) { if (this.r.containsKey(a + "@@" + b + "@ngQueryList")) { return this.r.item(a + "@@" + b + "@ngQueryList"); } if (this.r.containsKey(a)) { var c = this.r.item(a); if (!c.containsKey(b + "@ngQueryList")) { this.r.item(a + "@@" + b + "@ngQueryList", null); return null; } var d = c.item(b + "@ngQueryList"); this.r.item(a + "@@" + b + "@ngQueryList", d); return d; } else { return null; } }; TypeDescriptionContext.prototype.p = function (a) { return a == "int" || a == "Int32" || a == "short" || a == "Int16" || a == "double" || a == "Double" || a == "float" || a == "Float" || a == "Single" || a == "single" || a == "DateTime" || a == "decimal" || a == "Decimal" || a == "long" || a == "Int64" || a == "byte" || a == "bool" || a == "string" || a == "String"; }; TypeDescriptionContext.$t = markType(TypeDescriptionContext, 'TypeDescriptionContext'); return TypeDescriptionContext; }(Base)); export { TypeDescriptionContext }; /** * @hidden */ var TypeDescriptionMetadata = /** @class */ /*@__PURE__*/ (function (_super) { __extends(TypeDescriptionMetadata, _super); function TypeDescriptionMetadata() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._owningContext = null; _this._owningType = null; _this._propertyName = null; _this._knownType = 0; _this._specificType = null; _this._specificExternalType = null; _this._collectionElementType = null; _this._isCustomEvent = false; _this._skipWCEventPrefix = false; _this._mustBeFirst = false; _this.g = new Dictionary$2(TypeDescriptionPlatform_$type, String_$type, 0); _this.h = new Dictionary$2(TypeDescriptionPlatform_$type, String_$type, 0); return _this; } Object.defineProperty(TypeDescriptionMetadata.prototype, "owningContext", { get: function () { return this._owningContext; }, set: function (a) { this._owningContext = a; }, enumerable: false, configurable: true }); Object.defineProperty(TypeDescriptionMetadata.prototype, "owningType", { get: function () { return this._owningType; }, set: function (a) { this._owningType = a; }, enumerable: false, configurable: true }); Object.defineProperty(TypeDescriptionMetadata.prototype, "propertyName", { get: function () { return this._propertyName; }, set: function (a) { this._propertyName = a; }, enumerable: false, configurable: true }); Object.defineProperty(TypeDescriptionMetadata.prototype, "knownType", { get: function () { return this._knownType; }, set: function (a) { this._knownType = a; }, enumerable: false, configurable: true }); Object.defineProperty(TypeDescriptionMetadata.prototype, "specificType", { get: function () { return this._specificType; }, set: function (a) { this._specificType = a; }, enumerable: false, configurable: true }); Object.defineProperty(TypeDescriptionMetadata.prototype, "specificExternalType", { get: function () { return this._specificExternalType; }, set: function (a) { this._specificExternalType = a; }, enumerable: false, configurable: true }); Object.defineProperty(TypeDescriptionMetadata.prototype, "collectionElementType", { get: function () { return this._collectionElementType; }, set: function (a) { this._collectionElementType = a; }, enumerable: false, configurable: true }); Object.defineProperty(TypeDescriptionMetadata.prototype, "isCustomEvent", { get: function () { return this._isCustomEvent; }, set: function (a) { this._isCustomEvent = a; }, enumerable: false, configurable: true }); Object.defineProperty(TypeDescriptionMetadata.prototype, "skipWCEventPrefix", { get: function () { return this._skipWCEventPrefix; }, set: function (a) { this._skipWCEventPrefix = a; }, enumerable: false, configurable: true }); Object.defineProperty(TypeDescriptionMetadata.prototype, "mustBeFirst", { get: function () { return this._mustBeFirst; }, set: function (a) { this._mustBeFirst = a; }, enumerable: false, configurable: true }); TypeDescriptionMetadata.prototype.r = function (a, b) { if (stringContains(b, "/")) { var c = b.split('/'); this.h.item(a, c[1].trim()); this.g.item(a, c[0].trim()); } else { this.g.item(a, b.trim()); } }; TypeDescriptionMetadata.camelize = function (a) { if (a == null || a.length == 0) { return a; } return a.substr(0, 1).toLowerCase() + a.substr(1); }; TypeDescriptionMetadata.toPascal = function (a) { if (a == null || a.length == 0) { return a; } return a.substr(0, 1).toUpperCase() + a.substr(1); }; TypeDescriptionMetadata.prototype.k = function (a) { var b = ""; if (this.g.containsKey(a)) { b = this.g.item(a); } else { b = this.propertyName; } if (TypeDescriptionMetadata.shouldCamelize(a)) { return TypeDescriptionMetadata.camelize(b); } return b; }; TypeDescriptionMetadata.shouldCamelize = function (a) { if (a == 3 || a == 1 || a == 4 || a == 2 || a == 14) { return true; } return false; }; TypeDescriptionMetadata.prototype.l = function (a) { if (this.h.containsKey(a)) { return this.h.item(a); } else { return null; } }; TypeDescriptionMetadata.$t = markType(TypeDescriptionMetadata, 'TypeDescriptionMetadata'); return TypeDescriptionMetadata; }(Base)); export { TypeDescriptionMetadata };