igniteui-react-core
Version:
Ignite UI React Core.
214 lines (213 loc) • 6.8 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, __values } from "tslib";
import { Base, fromEnum, markType } from "./type";
import { CSSColorUtil } from "./CSSColorUtil";
import { JsonDictionaryObject } from "./JsonDictionaryObject";
import { JsonDictionaryValue } from "./JsonDictionaryValue";
import { CultureInfo } from "./culture";
import { timeSpanTotalMilliseconds } from "./timespan";
import { numberToString } from "./numberExtended";
/**
* @hidden
*/
var ComponentRendererSerializationHelper = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(ComponentRendererSerializationHelper, _super);
function ComponentRendererSerializationHelper() {
return _super !== null && _super.apply(this, arguments) || this;
}
ComponentRendererSerializationHelper.serializeBrush = function (a) {
if (a == null) {
return null;
}
var b = a;
return CSSColorUtil.c(b);
};
ComponentRendererSerializationHelper.serializeColor = function (a) {
if (a == null) {
return null;
}
return CSSColorUtil.d(a);
};
ComponentRendererSerializationHelper.serializeBrushCollection = function (a) {
var e_1, _a;
if (a == null) {
return null;
}
var b = "";
var c = a;
var d = true;
try {
for (var _b = __values(fromEnum(c)), _c = _b.next(); !_c.done; _c = _b.next()) {
var e = _c.value;
if (d) {
d = false;
}
else {
b += ", ";
}
b += ComponentRendererSerializationHelper.serializeBrush(e);
}
}
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 b;
};
ComponentRendererSerializationHelper.serializePoint = function (a) {
var b = a;
var c = new JsonDictionaryObject();
c.item("x", ((function () {
var $ret = new JsonDictionaryValue();
$ret.e = 0;
$ret.value = b.x;
return $ret;
})()));
c.item("y", ((function () {
var $ret = new JsonDictionaryValue();
$ret.e = 0;
$ret.value = b.y;
return $ret;
})()));
return c;
};
ComponentRendererSerializationHelper.serializeSize = function (a) {
var b = a;
var c = new JsonDictionaryObject();
c.item("width", ((function () {
var $ret = new JsonDictionaryValue();
$ret.e = 0;
$ret.value = b.width;
return $ret;
})()));
c.item("height", ((function () {
var $ret = new JsonDictionaryValue();
$ret.e = 0;
$ret.value = b.height;
return $ret;
})()));
return c;
};
ComponentRendererSerializationHelper.serializeRect = function (a) {
var b = a;
var c = new JsonDictionaryObject();
c.item("left", ((function () {
var $ret = new JsonDictionaryValue();
$ret.e = 0;
$ret.value = b.left;
return $ret;
})()));
c.item("top", ((function () {
var $ret = new JsonDictionaryValue();
$ret.e = 0;
$ret.value = b.top;
return $ret;
})()));
c.item("width", ((function () {
var $ret = new JsonDictionaryValue();
$ret.e = 0;
$ret.value = b.width;
return $ret;
})()));
c.item("height", ((function () {
var $ret = new JsonDictionaryValue();
$ret.e = 0;
$ret.value = b.height;
return $ret;
})()));
return c;
};
ComponentRendererSerializationHelper.serializeColorCollection = function (a) {
var e_2, _a;
if (a == null) {
return null;
}
var b = "";
var c = a;
var d = true;
try {
for (var _b = __values(fromEnum(c)), _c = _b.next(); !_c.done; _c = _b.next()) {
var e = _c.value;
if (d) {
d = false;
}
else {
b += ", ";
}
b += CSSColorUtil.d(e);
}
}
catch (e_2_1) {
e_2 = { error: e_2_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_2)
throw e_2.error;
}
}
return b;
};
ComponentRendererSerializationHelper.serializeTimespan = function (a) {
if (a == null) {
return null;
}
return timeSpanTotalMilliseconds(a);
};
ComponentRendererSerializationHelper.serializeDoubleCollection = function (a) {
var e_3, _a;
if (a == null) {
return null;
}
var b = "";
var c = a;
var d = true;
try {
for (var _b = __values(fromEnum(c)), _c = _b.next(); !_c.done; _c = _b.next()) {
var e = _c.value;
if (d) {
d = false;
}
else {
b += ", ";
}
b += numberToString(e, CultureInfo.invariantCulture);
}
}
catch (e_3_1) {
e_3 = { error: e_3_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_3)
throw e_3.error;
}
}
return b;
};
ComponentRendererSerializationHelper.$t = markType(ComponentRendererSerializationHelper, 'ComponentRendererSerializationHelper');
return ComponentRendererSerializationHelper;
}(Base));
export { ComponentRendererSerializationHelper };