igniteui-react-core
Version:
Ignite UI React Core.
568 lines (567 loc) • 20.4 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, 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 let IComponentRendererAdapter_$type = /*@__PURE__*/ new Type(null, 'IComponentRendererAdapter');
/**
* @hidden
*/
export let TypeDescriptionContext = /*@__PURE__*/ (() => {
class TypeDescriptionContext extends Base {
constructor(a, b) {
super();
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;
}
ac(a) {
if (!this.s.contains(a)) {
this.s.add_1(a);
}
}
k(a) {
return this.s.contains(a);
}
ad(a, b) {
this.s.add_1(b);
this.r.item(a, b);
}
ae(a, b) {
this.q.item(a, b);
}
static ab(key_) {
if (key_ == null) {
return null;
}
return key_.substr(0, 1).toUpperCase() + key_.substr(1);
}
static aa(key_) {
if (key_ == null) {
return null;
}
return key_.substr(0, 1).toLowerCase() + key_.substr(1);
}
a() {
let a = new List$1(String_$type, 0);
for (let b of fromEnum(this.r.keys)) {
a.add(b);
}
return a.toArray();
}
b(a) {
if (this.r.containsKey(a)) {
let b = this.r.item(a);
return new List$1(String_$type, 1, b.keys).toArray();
}
else {
return null;
}
}
getMetadata(a, b) {
if (this.r.containsKey(a + "@@" + b)) {
return this.r.item(a + "@@" + b);
}
if (this.r.containsKey(a)) {
let c = new TypeDescriptionMetadata();
c.owningContext = this;
c.owningType = a;
c.propertyName = b;
let d = this.r.item(a);
if (!d.containsKey(b)) {
this.r.item(a + "@@" + b, null);
return null;
}
let e = d.item(b);
let f = "Unknown";
let g = null;
let h = null;
let i = null;
let j = e.split(')');
if (j.length > 1) {
let k = j[0];
e = j[1];
k = stringReplace(k, "(", "");
let l = k.split(',');
for (let n = 0; n < l.length; n++) {
let m = l[n];
let o = m.split(':');
let p = o[0];
let q = o[1];
let 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);
}
}
let 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;
}
w(a) {
if (this.q.containsKey(a)) {
return this.q.item(a)();
}
return null;
}
af(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);
}
ag(a, b, c, d) {
b = TypeDescriptionContext.ab(b);
this.g.setPropertyValue(a, b, c, d, null, null);
}
v(a) {
return this.g.createColorCollection(a);
}
u(a) {
return this.g.createBrushCollection(a);
}
x(a) {
return this.g.createDoubleCollection(a);
}
y(a, b, c) {
return this.g.createObject(a, b, this, c);
}
t(a, b, c, d) {
if (c != null && c.owningType != null && c.propertyName != null && this.j(c.owningType, c.propertyName) && d) {
let e = this.c(c.owningType, c.propertyName);
let f = this.d(c.owningType, c.propertyName);
if (e != null && f != null) {
for (let g = 0; g < e.length; g++) {
if (e[g].toLowerCase() == b.toLowerCase()) {
let h = 0;
if (((() => { let i = tryParseInt32_1(f[g], h); h = i.p1; return i.ret; })())) {
return h;
}
}
}
}
}
return this.g.coerceToEnum(a, this, b);
}
c(a, b) {
if (this.r.containsKey(a + "@@" + b + "@names")) {
return this.r.item(a + "@@" + b + "@names");
}
if (this.r.containsKey(a)) {
let c = this.r.item(a);
if (!c.containsKey(b + "@names")) {
this.r.item(a + "@@" + b + "@names", null);
return null;
}
let d = c.item(b + "@names");
let e = d.split(';');
this.r.item(a + "@@" + b + "@names", e);
return e;
}
else {
return null;
}
}
j(a, b) {
if (this.r.containsKey(a + "@@" + b + "@constantValues")) {
return this.r.item(a + "@@" + b + "@constantValues") != null;
}
if (this.r.containsKey(a)) {
let c = this.r.item(a);
if (!c.containsKey(b + "@constantValues")) {
this.r.item(a + "@@" + b + "@constantValues", null);
return false;
}
let d = c.item(b + "@constantValues");
let e = d.split(';');
this.r.item(a + "@@" + b + "@constantValues", e);
return e != null;
}
else {
return false;
}
}
d(a, b) {
if (this.r.containsKey(a + "@@" + b + "@constantValues")) {
return this.r.item(a + "@@" + b + "@constantValues");
}
if (this.r.containsKey(a)) {
let c = this.r.item(a);
if (!c.containsKey(b + "@constantValues")) {
this.r.item(a + "@@" + b + "@constantValues", null);
return null;
}
let d = c.item(b + "@constantValues");
let e = d.split(';');
this.r.item(a + "@@" + b + "@constantValues", e);
return e;
}
else {
return null;
}
}
hasNameBinding(a, b) {
if (this.r.containsKey(a + "@@" + b + "@nameBinding")) {
return this.r.item(a + "@@" + b + "@nameBinding") == "true";
}
if (this.r.containsKey(a)) {
let c = this.r.item(a);
if (!c.containsKey(b + "@nameBinding")) {
this.r.item(a + "@@" + b + "@nameBinding", null);
return false;
}
let d = c.item(b + "@nameBinding");
this.r.item(a + "@@" + b + "@names", d);
return d == "true";
}
else {
return false;
}
}
getMustSetInCodePlatforms(a, b) {
if (this.r.containsKey(a + "@@" + b + "@mustSetInCode")) {
return this.r.item(a + "@@" + b + "@mustSetInCode");
}
if (this.r.containsKey(a)) {
let c = this.r.item(a);
if (!c.containsKey(b + "@mustSetInCode")) {
this.r.item(a + "@@" + b + "@mustSetInCode", null);
return null;
}
let d = c.item(b + "@mustSetInCode");
let e = d.split(';');
this.r.item(a + "@@" + b + "@mustSetInCode", e);
return e;
}
else {
return null;
}
}
getStringUnionPlatforms(a, b) {
if (this.r.containsKey(a + "@@" + b + "@stringUnion")) {
return this.r.item(a + "@@" + b + "@stringUnion");
}
if (this.r.containsKey(a)) {
let c = this.r.item(a);
if (!c.containsKey(b + "@stringUnion")) {
this.r.item(a + "@@" + b + "@stringUnion", null);
return null;
}
let d = c.item(b + "@stringUnion");
let e = d.split(';');
this.r.item(a + "@@" + b + "@stringUnion", e);
return e;
}
else {
return null;
}
}
hasMustSetInCodePlatforms(a, b) {
if (this.r.containsKey(a + "@@" + b + "@mustSetInCode")) {
return this.r.item(a + "@@" + b + "@mustSetInCode") != null;
}
if (this.r.containsKey(a)) {
let c = this.r.item(a);
if (!c.containsKey(b + "@mustSetInCode")) {
this.r.item(a + "@@" + b + "@mustSetInCode", null);
return false;
}
let d = c.item(b + "@mustSetInCode");
let e = d.split(';');
this.r.item(a + "@@" + b + "@mustSetInCode", e);
return true;
}
else {
return false;
}
}
hasStringUnionPlatforms(a, b) {
if (this.r.containsKey(a + "@@" + b + "@stringUnion")) {
return this.r.item(a + "@@" + b + "@stringUnion") != null;
}
if (this.r.containsKey(a)) {
let c = this.r.item(a);
if (!c.containsKey(b + "@stringUnion")) {
this.r.item(a + "@@" + b + "@stringUnion", null);
return false;
}
let d = c.item(b + "@stringUnion");
let e = d.split(';');
this.r.item(a + "@@" + b + "@stringUnion", e);
return true;
}
else {
return false;
}
}
hasQueryListName(a, b) {
if (this.r.containsKey(a + "@@" + b + "@ngQueryList")) {
return this.r.item(a + "@@" + b + "@ngQueryList") != null;
}
if (this.r.containsKey(a)) {
let c = this.r.item(a);
if (!c.containsKey(b + "@ngQueryList")) {
this.r.item(a + "@@" + b + "@ngQueryList", null);
return false;
}
let d = c.item(b + "@ngQueryList");
this.r.item(a + "@@" + b + "@ngQueryList", d);
return d != null;
}
else {
return false;
}
}
getQueryListName(a, b) {
if (this.r.containsKey(a + "@@" + b + "@ngQueryList")) {
return this.r.item(a + "@@" + b + "@ngQueryList");
}
if (this.r.containsKey(a)) {
let c = this.r.item(a);
if (!c.containsKey(b + "@ngQueryList")) {
this.r.item(a + "@@" + b + "@ngQueryList", null);
return null;
}
let d = c.item(b + "@ngQueryList");
this.r.item(a + "@@" + b + "@ngQueryList", d);
return d;
}
else {
return null;
}
}
p(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 = /*@__PURE__*/ markType(TypeDescriptionContext, 'TypeDescriptionContext');
return TypeDescriptionContext;
})();
/**
* @hidden
*/
export let TypeDescriptionMetadata = /*@__PURE__*/ (() => {
class TypeDescriptionMetadata extends Base {
constructor() {
super(...arguments);
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);
}
get owningContext() {
return this._owningContext;
}
set owningContext(a) {
this._owningContext = a;
}
get owningType() {
return this._owningType;
}
set owningType(a) {
this._owningType = a;
}
get propertyName() {
return this._propertyName;
}
set propertyName(a) {
this._propertyName = a;
}
get knownType() {
return this._knownType;
}
set knownType(a) {
this._knownType = a;
}
get specificType() {
return this._specificType;
}
set specificType(a) {
this._specificType = a;
}
get specificExternalType() {
return this._specificExternalType;
}
set specificExternalType(a) {
this._specificExternalType = a;
}
get collectionElementType() {
return this._collectionElementType;
}
set collectionElementType(a) {
this._collectionElementType = a;
}
get isCustomEvent() {
return this._isCustomEvent;
}
set isCustomEvent(a) {
this._isCustomEvent = a;
}
get skipWCEventPrefix() {
return this._skipWCEventPrefix;
}
set skipWCEventPrefix(a) {
this._skipWCEventPrefix = a;
}
get mustBeFirst() {
return this._mustBeFirst;
}
set mustBeFirst(a) {
this._mustBeFirst = a;
}
r(a, b) {
if (stringContains(b, "/")) {
let c = b.split('/');
this.h.item(a, c[1].trim());
this.g.item(a, c[0].trim());
}
else {
this.g.item(a, b.trim());
}
}
static camelize(a) {
if (a == null || a.length == 0) {
return a;
}
return a.substr(0, 1).toLowerCase() + a.substr(1);
}
static toPascal(a) {
if (a == null || a.length == 0) {
return a;
}
return a.substr(0, 1).toUpperCase() + a.substr(1);
}
k(a) {
let 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;
}
static shouldCamelize(a) {
if (a == 3 || a == 1 || a == 4 || a == 2) {
return true;
}
return false;
}
l(a) {
if (this.h.containsKey(a)) {
return this.h.item(a);
}
else {
return null;
}
}
}
TypeDescriptionMetadata.$t = /*@__PURE__*/ markType(TypeDescriptionMetadata, 'TypeDescriptionMetadata');
return TypeDescriptionMetadata;
})();