igniteui-angular-core
Version:
Ignite UI Angular Core logic used in multiple UI components.
169 lines (168 loc) • 6.47 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 { __extends } from "tslib";
import { Base, IEnumerable_$type, typeCast, Date_$type, Boolean_$type, Array_$type, markType } from "./type";
import { DataSourceLocalDataProvider } from "./DataSourceLocalDataProvider";
import { stringStartsWith } from "./string";
/**
* @hidden
*/
var ComponentRendererSerializationProvider = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(ComponentRendererSerializationProvider, _super);
function ComponentRendererSerializationProvider() {
return _super.call(this) || this;
}
ComponentRendererSerializationProvider.prototype.c = function (a) {
if (typeof a === 'string') {
return true;
}
if (typeof a === 'number' || typeof a === 'number' || typeof a === 'number' || typeof a === 'number' || typeof a === 'number' || typeof a === 'number' || typeof a === 'number') {
return true;
}
if (typeCast(Date_$type, a) !== null) {
return true;
}
if (typeCast(Boolean_$type, a) !== null) {
return true;
}
return false;
};
ComponentRendererSerializationProvider.prototype.b = function (a) {
if (typeCast(Array_$type, a) !== null) {
return true;
}
if (typeCast(IEnumerable_$type, a) !== null) {
return true;
}
return false;
};
ComponentRendererSerializationProvider.prototype.e = function (a, b, c) {
a.append("\"" + b + "\": ");
this.f(a, c);
};
ComponentRendererSerializationProvider.prototype.f = function (a, b) {
if (this.c(b)) {
if (typeof b === 'string') {
a.append(b == null ? "null" : "\"" + b.toString() + "\"");
}
else if (typeof b === 'number') {
a.append(b == null ? "null" : b.toString());
}
else if (typeof b === 'number') {
a.append(b == null ? "null" : b.toString());
}
else if (typeof b === 'number') {
a.append(b == null ? "null" : b.toString());
}
else if (typeof b === 'number') {
a.append(b == null ? "null" : b.toString());
}
else if (typeof b === 'number') {
a.append(b == null ? "null" : b.toString());
}
else if (typeof b === 'number') {
a.append(b == null ? "null" : b.toString());
}
else if (typeof b === 'number') {
a.append(b == null ? "null" : b.toString());
}
else if (typeCast(Date_$type, b) !== null) {
var v_ = b;
a.append("\"" + (v_.toJSON()) + "\"");
}
else if (typeCast(Boolean_$type, b) !== null) {
a.append(b == null ? "null" : b.toString().toLowerCase());
}
else {
a.append("null");
}
}
else {
if (b == null) {
a.append("null");
return;
}
if (this.b(b)) {
a.appendLine("[");
a.increaseTabLevel();
var c = new DataSourceLocalDataProvider();
c.dataSource = b;
for (var d = 0; d < c.actualCount; d++) {
if (d > 0) {
a.appendLine(",");
}
this.d(a, c, d);
}
a.appendLine("");
a.decreaseTabLevel();
a.append("]");
}
else {
var e = [b];
var f = new DataSourceLocalDataProvider();
f.dataSource = e;
this.d(a, f, 0);
}
}
};
ComponentRendererSerializationProvider.prototype.d = function (a, b, c) {
a.appendLine("{");
a.increaseTabLevel();
var d = b.actualSchema;
for (var e = 0; e < d.propertyNames.length; e++) {
if (e > 0) {
a.appendLine(",");
}
var f = d.propertyNames[e];
if (stringStartsWith(f, "[")) {
f = f.substr(1, f.length - 2);
}
a.append("\"" + f + "\"");
a.append(": ");
var g = b.getItemValue(b.getItemAtIndex(c), d.propertyNames[e]);
switch (d.propertyTypes[e]) {
case 0:
a.append(g == null ? "null" : "\"" + g.toString() + "\"");
break;
case 2:
a.append(g == null ? "null" : "\"" + g.toString() + "\"");
break;
case 10:
case 6:
case 5:
case 1:
case 3:
case 4:
case 7:
a.append(g == null ? "null" : g.toString());
break;
case 8:
var v_ = g;
a.append("\"" + (v_.toJSON()) + "\"");
break;
case 11:
this.f(a, g);
break;
}
}
a.decreaseTabLevel();
a.appendLine("}");
};
ComponentRendererSerializationProvider.prototype.a = function (a, b) {
if (b == null) {
return true;
}
var v_ = b;
if ((typeof v_ === 'function')) {
return false;
}
return true;
};
ComponentRendererSerializationProvider.$t = markType(ComponentRendererSerializationProvider, 'ComponentRendererSerializationProvider');
return ComponentRendererSerializationProvider;
}(Base));
export { ComponentRendererSerializationProvider };