UNPKG

igniteui-angular-core

Version:

Ignite UI Angular Core logic used in multiple UI components.

412 lines (411 loc) 16.1 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 } from "tslib"; import { Base, String_$type, Delegate_$type, markType } from "./type"; import { ITypeDescriptionPropertyTransforms_$type } from "./ITypeDescriptionPropertyTransforms"; import { Dictionary$2 } from "./Dictionary$2"; import { CodeGenerationSpecialValue } from "./CodeGenerationSpecialValue"; import { stringContains, stringReplace } from "./string"; /** * @hidden */ var CodeGenerationTransformer = /** @class */ /*@__PURE__*/ (function (_super) { __extends(CodeGenerationTransformer, _super); function CodeGenerationTransformer(a) { var _this = _super.call(this) || this; _this.a = 0; _this.b = new Dictionary$2(String_$type, Delegate_$type, 0); _this.a = a; _this.b.item("VisibilityToBooleanTransform", function (b, c) { if (b.toString().toLowerCase() == "visible") { return true; } return false; }); if (a == 0) { _this.b.item("AxisLabelTransform", function (b, c) { var d = b; if (d == null) { return null; } if (!stringContains(d, "{")) { return "{" + d + "}"; } return d; }); _this.b.item("FontFamilyTransform", function (b, c) { var d = b; if (d == null) { return null; } return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 0; $ret.b = d; return $ret; })()); }); _this.b.item("FontStyleTransform", function (b, c) { var d = b; if (d == null) { return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Normal"; return $ret; })()); } d = d.toLowerCase(); switch (d) { case "normal": return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Normal"; return $ret; })()); case "italic": return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Italic"; return $ret; })()); } return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Normal"; return $ret; })()); }); _this.b.item("FontWeightTransform", function (b, c) { var d = b; if (d == null) { return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Normal"; return $ret; })()); } d = d.toLowerCase(); switch (d) { case "normal": return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 2; $ret.b = "Normal"; return $ret; })()); case "bold": return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 2; $ret.b = "Bold"; return $ret; })()); } return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Normal"; return $ret; })()); }); } if (a == 4) { _this.b.item("ColorTransform", function (b, c) { return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 3; $ret.b = b; return $ret; })()); }); _this.b.item("FontFamilyTransform", function (b, c) { var d = b; if (d == null) { return null; } return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 0; $ret.b = d; return $ret; })()); }); _this.b.item("FontStyleTransform", function (b, c) { var d = b; var e = c.j; var f = stringReplace(e, "Style", "Weight"); var g = false; if (c.c.c(f)) { var h = c.c.a(f); var i = h.b; if (i != null && i.toLowerCase() == "bold") { g = true; } } if (d == null) { if (g) { return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Bold"; return $ret; })()); } else { return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Regular"; return $ret; })()); } } d = d.toLowerCase(); switch (d) { case "normal": if (g) { return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Bold"; return $ret; })()); } else { return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Regular"; return $ret; })()); } case "italic": if (g) { return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "BoldItalic"; return $ret; })()); } else { return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Italic"; return $ret; })()); } } if (g) { return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Bold"; return $ret; })()); } else { return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Regular"; return $ret; })()); } }); _this.b.item("FontWeightTransform", function (b, c) { var d = b; var e = c.j; var f = stringReplace(e, "Weight", "Style"); var g = false; if (c.c.c(f)) { var h = c.c.a(f); var i = h.b; if (i != null && i.toLowerCase() == "italic") { g = true; } } if (d == null) { if (g) { return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Italic"; return $ret; })()); } else { return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Regular"; return $ret; })()); } } d = d.toLowerCase(); switch (d) { case "normal": if (g) { return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Italic"; return $ret; })()); } else { return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Regular"; return $ret; })()); } case "bold": if (g) { return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "BoldItalic"; return $ret; })()); } else { return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Bold"; return $ret; })()); } } if (g) { return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Italic"; return $ret; })()); } else { return ((function () { var $ret = new CodeGenerationSpecialValue(); $ret.a = 1; $ret.b = "Regular"; return $ret; })()); } }); } if (a == 1 || a == 2 || a == 3) { _this.b.item("FontFamilyTransform", function (b, c) { var d = _this.e(c); var e = _this.d(c); var f = _this.f(c); var g = b; if (g == null) { g = "Verdana"; } return d + " " + f + " " + e + " " + g; }); _this.b.item("FontStyleTransform", function (b, c) { var d = _this.c(c); var e = _this.d(c); var f = _this.f(c); var g = b; if (g == null) { g = "normal"; } return g + " " + f + " " + e + " " + d; }); _this.b.item("FontSizeTransform", function (b, c) { var d = _this.c(c); var e = _this.e(c); var f = _this.f(c); var g = b != null ? b.toString() + "px" : null; if (g == null) { g = "14px"; } return e + " " + f + " " + g + " " + d; }); _this.b.item("FontWeightTransform", function (b, c) { var d = _this.c(c); var e = _this.d(c); var f = _this.e(c); var g = b != null ? b.toString() : null; if (g == null) { g = "normal"; } g = g.toLowerCase(); return f + " " + g + " " + e + " " + d; }); } return _this; } CodeGenerationTransformer.prototype.c = function (a) { var b = stringReplace(stringReplace(stringReplace(a.j, "Style", "Family"), "Weight", "Family"), "Size", "Family"); var c = "Verdana"; if (a.c.c(b)) { c = a.c.a(b).b; if (c == null) { c = "Verdana"; } } return c; }; CodeGenerationTransformer.prototype.e = function (a) { var b = stringReplace(stringReplace(stringReplace(a.j, "Family", "Style"), "Weight", "Style"), "Size", "Style"); var c = "normal"; if (a.c.c(b)) { c = a.c.a(b).b; if (c == null) { c = "normal"; } } return c; }; CodeGenerationTransformer.prototype.d = function (a) { var b = stringReplace(stringReplace(stringReplace(a.j, "Family", "Size"), "Weight", "Size"), "Style", "Size"); var c = "14px"; if (a.c.c(b)) { c = a.c.a(b).b.toString(); if (c == null) { c = "14px"; } else { c = c.toString() + "px"; } } return c; }; CodeGenerationTransformer.prototype.f = function (a) { var b = stringReplace(stringReplace(stringReplace(a.j, "Family", "Weight"), "Size", "Weight"), "Style", "Weight"); var c = "normal"; if (a.c.c(b)) { c = a.c.a(b).b; if (c == null) { c = "normal"; } c = c.toLowerCase(); } return c; }; CodeGenerationTransformer.prototype.transform = function (a, b, c) { var d = c.d; if (d == null) { return b; } var e = d.l(a); if (e != null && this.b.containsKey(e)) { var f = this.b.item(e); return f(b, c); } return b; }; CodeGenerationTransformer.$t = markType(CodeGenerationTransformer, 'CodeGenerationTransformer', Base.$, [ITypeDescriptionPropertyTransforms_$type]); return CodeGenerationTransformer; }(Base)); export { CodeGenerationTransformer };