UNPKG

igniteui-react-core

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