UNPKG

igniteui-react-core

Version:
633 lines (632 loc) 22.3 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 { stringReplace, stringStartsWith, stringContains } from "./string"; import { tryParseInt32_1 } from "./numberExtended"; /** * @hidden */ export var IComponentRendererAdapter_$type = /*@__PURE__*/ 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.ac = function (a) { if (!this.s.contains(a)) { this.s.add_1(a); } }; TypeDescriptionContext.prototype.k = function (a) { return this.s.contains(a); }; TypeDescriptionContext.prototype.ad = function (a, b) { this.s.add_1(b); this.r.item(a, b); }; TypeDescriptionContext.prototype.ae = function (a, b) { this.q.item(a, b); }; TypeDescriptionContext.ab = function (key_) { if (key_ == null) { return null; } return key_.substr(0, 1).toUpperCase() + key_.substr(1); }; TypeDescriptionContext.aa = 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.b = 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; var j = e.split(')'); if (j.length > 1) { var k = j[0]; e = j[1]; k = stringReplace(k, "(", ""); var l = k.split(','); for (var n = 0; n < l.length; n++) { var m = l[n]; var o = m.split(':'); var p = o[0]; var q = o[1]; var r = 3; switch (p) { case "web": c.r(3, q); c.r(2, q); c.r(4, q); c.r(1, q); continue; case "xam": c.r(6, q); c.r(7, q); c.r(5, q); c.r(9, q); c.r(10, q); continue; case "w": r = 0; break; case "a": r = 3; break; case "r": r = 2; break; case "j": r = 1; break; case "wc": r = 4; break; case "xf": r = 5; break; case "xa": r = 6; break; case "xi": r = 7; break; case "wf": r = 8; break; case "uwp": r = 9; break; case "winui": r = 10; break; } c.r(r, q); } } var s = e.split(':'); if (s.length >= 4) { i = s[3]; } if (s.length >= 3) { g = s[2]; } if (s.length >= 2) { h = s[1]; } if (s.length >= 1) { f = s[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.w = function (a) { if (this.q.containsKey(a)) { return this.q.item(a)(); } return null; }; TypeDescriptionContext.prototype.af = function (a, b, c, d) { if (TypeDescriptionMetadata.shouldCamelize(this.i)) { b = TypeDescriptionContext.aa(b); } else { b = TypeDescriptionContext.ab(b); } this.g.setPropertyValue(a, b, c, d, null, null); }; TypeDescriptionContext.prototype.ag = function (a, b, c, d) { b = TypeDescriptionContext.ab(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) { 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 };