UNPKG

igniteui-angular-core

Version:

Ignite UI Angular Core logic used in multiple UI components.

1,358 lines (1,357 loc) 210 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 { CodeGeneratingComponentRendererHandlerEmitter } from "./CodeGeneratingComponentRendererHandlerEmitter"; import { CodeGeneratingRendererResult } from "./CodeGeneratingRendererResult"; import { CodeGeneratingImportManager } from "./CodeGeneratingImportManager"; import { CodeGeneratingCodeWriter } from "./CodeGeneratingCodeWriter"; import { Base, markType, BaseError, fromEnum, typeCast, EnumUtil, getInstanceType, NotSupportedException, IList_$type, String_$type, Array_$type, Boolean_$type, fromEn, Number_$type, Point_$type, typeGetValue, runOn } from "./type"; import { CodeGeneratingComponentRendererDataEmitter } from "./CodeGeneratingComponentRendererDataEmitter"; import { List$1 } from "./List$1"; import { JsonDictionaryValue } from "./JsonDictionaryValue"; import { JsonDictionaryObject } from "./JsonDictionaryObject"; import { JsonDictionaryValueType_$type } from "./JsonDictionaryValueType"; import { JsonDictionaryArray } from "./JsonDictionaryArray"; import { CodeGenerationTargetPlatforms_$type } from "./CodeGenerationTargetPlatforms"; import { stringReplace, stringContains, stringJoin1, stringIsNullOrEmpty, stringStartsWith, stringEndsWith } from "./string"; import { Stack$1 } from "./Stack$1"; import { CodeGenerationItemBuilderPropertyInfo } from "./CodeGenerationItemBuilderPropertyInfo"; import { TypeDescriptionContext } from "./TypeDescriptionContext"; import { TypeDescriptionMetadata } from "./TypeDescriptionMetadata"; import { Rect } from "./Rect"; import { Size } from "./Size"; import { CodeGenerationSpecialValue } from "./CodeGenerationSpecialValue"; import { ColorUtil } from "./ColorUtil"; import { Brush } from "./Brush"; import { StringBuilder } from "./StringBuilder"; import { HashSet$1 } from "./HashSet$1"; import { isNaN_ } from "./number"; import { trimEnd } from "./stringExtended"; import { WebImportsHalper } from "./WebImportsHalper"; import { Dictionary$2 } from "./Dictionary$2"; import { CodeGeneratingRegexHelper } from "./CodeGeneratingRegexHelper"; import { timeSpanFromMilliseconds } from "./timespan"; import { ComponentRenderer } from "./ComponentRenderer"; import { DotNetCodeGeneratingComponentRendererHandlerEmitter } from "./DotNetCodeGeneratingComponentRendererHandlerEmitter"; import { TSCodeGeneratingComponentRendererTemplateEmitter } from "./TSCodeGeneratingComponentRendererTemplateEmitter"; import { KotlinCodeGeneratingComponentRendererTemplateEmitter } from "./KotlinCodeGeneratingComponentRendererTemplateEmitter"; import { SwiftCodeGeneratingComponentRendererTemplateEmitter } from "./SwiftCodeGeneratingComponentRendererTemplateEmitter"; import { DotNetCodeGeneratingComponentRendererTemplateEmitter } from "./DotNetCodeGeneratingComponentRendererTemplateEmitter"; import { TSCodeGeneratingComponentRendererModuleEmitter } from "./TSCodeGeneratingComponentRendererModuleEmitter"; import { DotNetCodeGeneratingComponentRendererModuleEmitter } from "./DotNetCodeGeneratingComponentRendererModuleEmitter"; import { KotlinCodeGeneratingComponentRendererModuleEmitter } from "./KotlinCodeGeneratingComponentRendererModuleEmitter"; import { SwiftCodeGeneratingComponentRendererModuleEmitter } from "./SwiftCodeGeneratingComponentRendererModuleEmitter"; import { BlazorCodeGeneratingComponentRendererModuleEmitter } from "./BlazorCodeGeneratingComponentRendererModuleEmitter"; import { CodeGenerationTransformer } from "./CodeGenerationTransformer"; import { LinearGradientBrush } from "./LinearGradientBrush"; import { IComponentRendererAdapter_$type } from "./IComponentRendererAdapter"; /** * @hidden */ export let KotlinCodeGeneratingComponentRendererHandlerEmitter = /*@__PURE__*/ (() => { class KotlinCodeGeneratingComponentRendererHandlerEmitter extends CodeGeneratingComponentRendererHandlerEmitter { constructor(a, b) { super(a, b); } v(a, b) { super.v(a, b); a.addUsing(b); } t(a, b) { super.t(a, b); this.g.l("this." + CodeGeneratingComponentRenderer.g7(a) + "();"); } u(a, b) { super.u(a, b); this.h.l("this." + CodeGeneratingComponentRenderer.g7(a) + "();"); } q(a, b) { return a; } } KotlinCodeGeneratingComponentRendererHandlerEmitter.$t = markType(KotlinCodeGeneratingComponentRendererHandlerEmitter, 'KotlinCodeGeneratingComponentRendererHandlerEmitter', CodeGeneratingComponentRendererHandlerEmitter.$); return KotlinCodeGeneratingComponentRendererHandlerEmitter; })(); /** * @hidden */ export let KotlinCodeGeneratingComponentRendererDataEmitter = /*@__PURE__*/ (() => { class KotlinCodeGeneratingComponentRendererDataEmitter extends CodeGeneratingComponentRendererDataEmitter { constructor(a, b) { super(a, b); } ab(a, b) { this.l = CodeGeneratingImportManager.merge(this.l, b); } af(a) { a.l("package com.infragistics.mobile.samples;"); super.af(a); } x(a, b = false) { a = CodeGeneratingComponentRenderer.g8(a); a = stringReplace(a, "-", "_"); if (b) { a += "Item"; } return a; } w(a) { a = stringReplace(a, "-", "_"); if (this.p.g) { return a; } return CodeGeneratingComponentRenderer.g7(a); } aq(a) { a = stringReplace(a, "-", "_"); return "_" + CodeGeneratingComponentRenderer.g7(a); } al(a, b, c, d, e, f) { super.al(a, b, c, d, e, f); let g = this.s(this.x(b, true), this.x(b, false), c, d); for (let h of fromEnum(g)) { this.ad(h, e, f); } e.l(""); e.l("public class " + this.x(b, false)); e.h(); e.l(": ArrayList<" + this.x(b, true) + ">"); e.f(); e.l("{"); e.h(); e.l("public constructor() {"); e.h(); } ah(a, b, c) { super.ah(a, b, c); if (b == 3) { let d = this.p.cDNBasePath + this.x(a, false) + ".json"; this.g.l("public RemoteJSON " + this.w(a)); this.g.l("{"); this.g.h(); this.g.l("get"); this.g.l("{"); this.g.h(); this.g.l("return RemoteJSON.LoadFrom(\"" + d + "\");"); this.g.f(); this.g.l("}"); this.g.l(""); return; } let e = this.aq(a) + " = " + "new " + this.x(a, false) + "(); "; let f = ""; if (this.n.platform == 5) { f = " StateHasChanged();"; } else { f = " OnPropertyChanged(\"" + this.x(a, false) + "\");"; } if (c != null && (b == 2 || c.isAsync)) { e = this.x(a, false) + ".Fetch().ContinueWith((t) => {" + this.aq(a) + " = t.Result; " + f + " });"; } this.g.l("private " + this.x(a, false) + " " + this.aq(a) + " = null;"); this.g.l("public " + this.x(a, false) + " " + this.w(a)); this.g.l("{"); this.g.h(); this.g.l("get"); this.g.l("{"); this.g.h(); this.g.l("if (" + this.aq(a) + " == null)"); this.g.l("{"); this.g.h(); this.g.l(e); this.g.f(); this.g.l("}"); this.g.l("return " + this.aq(a) + ";"); this.g.f(); this.g.l("}"); this.g.f(); this.g.l("}"); this.g.l(""); } ai(a, b) { super.ai(a, b); this.g.l("private var " + this.aq(a) + ": " + this.an(b.e) + " = " + this.ao(b) + ";"); this.g.l("public var " + this.w(a) + ": " + this.an(b.e) + " {"); this.g.h(); this.g.l("get () {"); this.g.h(); this.g.l("return " + this.aq(a) + ";"); this.g.f(); this.g.l("}"); this.g.f(); this.g.l(""); } aj(a, b, c, d) { super.aj(a, b, c, d); this.g.l("private var " + this.aq(a) + ": " + this.x(a, false) + "Item " + " = null;"); this.g.l("public var " + this.w(a) + ": " + this.x(a, false) + "Item"); this.g.h(); this.g.l("get () {"); this.g.h(); this.g.l("if (" + this.aq(a) + " == null)"); this.g.l("{"); this.g.h(); this.g.l("_" + a + " = "); this.ar(this.x(a, true), b, c, d, this.g); this.g.f(); this.g.l("}"); this.g.l("return " + this.aq(a) + ";"); this.g.f(); this.g.l("}"); this.g.f(); this.g.l(""); } get_t() { return ".kt"; } ad(a, b, c) { b.l("public class " + a.d + "{"); b.h(); for (let d = 0; d < a.a.length; d++) { let e = a.a[d]; let f = a.b[d]; b.l("private var " + this.aq(e) + ": " + this.ap(a, e, f) + " = " + this.am(a, e, f) + ";"); b.l("public var " + this.w(e) + ": " + this.ap(a, e, f)); b.h(); b.l("get() { return " + this.aq(e) + "; }"); b.l("set(v) { " + this.aq(e) + " = v; }"); b.f(); } b.f(); b.l("}"); } am(a, b, c) { if (c.d) { return "null"; } else if (c.f) { return "null"; } else { switch (c.c) { case 1: return "false"; case 0: return "0.0"; case 2: return "null"; case 3: return "null"; } } return "null"; } an(a) { switch (a) { case 1: return "Boolean"; case 0: return "Double"; case 2: return "String?"; case 3: return "Any?"; } return "Any?"; } get_r() { return true; } ap(a, b, c) { if (c.d) { return "List<" + a.d + "_" + CodeGeneratingComponentRenderer.g8(this.w(b)) + "Item?>?"; } else if (c.f) { return a.d + "_" + CodeGeneratingComponentRenderer.g8(this.w(b)) + "?"; } else { switch (c.c) { case 1: return "Boolean"; case 0: return "Double"; case 2: return "String?"; case 3: return "Any?"; } } return "Any?"; } ak(a, b, c, d, e) { super.ak(a, b, c, d, e); e.f(); e.l("};"); e.f(); e.l("}"); } y(a, b, c, d, e, f, g) { super.y(a, b, c, d, e, f, g); if (a == 2 || a == 3) { return; } g.j("this.add("); this.ar(this.x(b, true), c, d, e, g); g.l(");"); } ar(a, b, c, d, e) { if (d == null) { e.j("null"); return; } if (typeCast(JsonDictionaryArray.$, d) !== null) { let f = d; e.l("mutableListOf<" + a + ">().apply {"); e.h(); if (f.items != null && f.items.length > 0) { for (let g = 0; g < f.items.length; g++) { if (g > 0) { e.l(";"); } e.j("add("); this.ar(a, b, c, f.items[g], e); e.j(")"); } } e.f(); e.l("}"); } else if (typeCast(JsonDictionaryObject.$, d) !== null) { let h = d; e.l("" + a + "().apply {"); e.h(); for (let i = 0; i < b.length; i++) { let j = b[i]; let k = c[i]; if (!h.g(j)) { continue; } if (i > 0) { e.l(";"); } e.j(this.w(j) + " = "); if (k.d) { let l = a + "_" + CodeGeneratingComponentRenderer.g8(this.w(j)) + "Item"; this.ar(l, k.a, k.b, h.item(j), e); } else if (k.f) { let m = a + "_" + CodeGeneratingComponentRenderer.g8(this.w(j)); this.ar(m, k.a, k.b, h.item(j), e); } else { let n = h.item(j); try { e.j(this.u(k, n)); } catch (o) { let p = getInstanceType(n.value).typeName; let q = stringReplace(EnumUtil.getName(JsonDictionaryValueType_$type, k.c), "Value", ""); let r = "'" + j + "' property (" + n.value + ") is '" + p + "' instead of '" + q + "' type."; throw new BaseError(1, "Failed on creating '" + a + "' because " + r + "\n" + o.message); } } } e.l(""); e.f(); e.j("}"); } } u(a, b) { switch (a.c) { case 1: return (b.value ? "true" : "false"); case 0: if (b == null || b.value == null) { return "Double.NaN"; } let c = b.value.toString(); if (!stringContains(c, ".") && !stringContains(c, "E") && !stringContains(c, "e")) { c += ".0"; } return c; case 2: if (b.value == null) { return "null"; } else { return ("\"\"\"" + b.value + "\"\"\""); } case 3: return ("null"); } return ""; } ao(a) { switch (a.e) { case 1: return (a.value ? "true" : "false"); case 0: return (a.value.toString()); case 2: return ("\"\"\"" + a.value + "\"\"\""); case 3: return "null"; } return ""; } } KotlinCodeGeneratingComponentRendererDataEmitter.$t = markType(KotlinCodeGeneratingComponentRendererDataEmitter, 'KotlinCodeGeneratingComponentRendererDataEmitter', CodeGeneratingComponentRendererDataEmitter.$); return KotlinCodeGeneratingComponentRendererDataEmitter; })(); /** * @hidden */ export let CodeGeneratingComponentRendererCodeEmitter = /*@__PURE__*/ (() => { class CodeGeneratingComponentRendererCodeEmitter extends Base { constructor(a, b) { super(); this.l = null; this.j = null; this.aa = new List$1(CodeGenerationItemBuilderPropertyInfo.$, 0); this.d = null; this.a = null; this.c = null; this.b = null; this.ab = new List$1(String_$type, 0); this.ag = new Stack$1(String_$type); this.ae = new Stack$1(String_$type); this.af = new Stack$1(Boolean_$type); this.a6 = null; this.a5 = null; this.l = a; this.j = b; this.d = new CodeGeneratingCodeWriter(this.l); this.a = new CodeGeneratingCodeWriter(this.l); this.c = new CodeGeneratingCodeWriter(this.l); this.b = new CodeGeneratingCodeWriter(this.l); } get_am() { switch (this.j.platform) { case 1: return "Igx"; case 2: return "Igr"; case 3: return "Igc"; case 4: return "Ultra"; case 0: return "Xam"; case 5: return "Igb"; case 6: return "Iga"; case 7: return "Igs"; } return ""; } get am() { return this.get_am(); } get_an() { switch (this.j.platform) { case 1: return "Component"; case 2: return ""; case 3: return "Component"; case 4: return ""; case 0: return ""; case 6: return ""; case 7: return ""; } return ""; } get an() { return this.get_an(); } get a7() { switch (this.j.platform) { case 1: return "angular"; case 2: return "react"; case 3: return "webcomponents"; } return ""; } get m() { return this.l; } bs(a) { this.j.af(a); } get k() { return this.j; } get h() { return this.d; } get e() { return this.a; } get g() { return this.c; } get f() { return this.b; } bc(a) { if (a == null || a == "any") { return; } this.ab.add(a); } w(a, b) { if (this.r) { return false; } if (a.hasMustSetInCodePlatforms(b.b.owningType, b.b.propertyName)) { let c = a.getMustSetInCodePlatforms(b.b.owningType, b.b.propertyName); for (let e = 0; e < c.length; e++) { let d = c[e]; let f = 0; if (((() => { let g = EnumUtil.tryParse$1(CodeGenerationTargetPlatforms_$type, d, true, f); f = g.p2; return g.ret; })())) { if (f == this.j.platform) { return true; } } } } return false; } q(a, b) { if (b.b != null && (b.b.knownType == 20 || b.b.knownType == 19 || b.b.knownType == 22 || b.b.knownType == 18)) { if (b.a != null) { return true; } } if (b.b != null && (b.b.knownType == 8 || b.b.knownType == 9 || b.b.knownType == 10)) { if (this.w(a, b)) { return true; } } return false; } t(a) { if (a.b != null && (a.b.knownType == 19)) { if (a.a != null) { return true; } } return false; } get ar() { return this.ag.d(); } bd(a, b, c) { this.ag.h(a); } u(a, b) { let c = false; if (b.getMetadata(a, "__isPlainObject") != null) { c = true; } return c; } br() { } bl(a) { } bm(a) { this.ag.e(); } x(a, b, c) { return b.b == null && a.toLowerCase() == "type"; } bj(a, b, c, d) { } bk(a, b, c, d) { this.bj(a, b, c, d); } toString() { return this.d.toString(); } a1() { return "null"; } a4(a, b, c) { if (b.b == null) { return b.c; } if (typeCast(CodeGenerationSpecialValue.$, b.c) !== null) { b.c = this.ah(b); } switch (b.b.knownType) { case 10: if (this.w(a, b)) { return this.ap(a, b); } return this.au(a, b); case 23: if (this.w(a, b)) { return this.ap(a, b); } return this.au(a, b); case 7: return b.c ? "true" : "false"; case 4: return this.aj(b); case 6: { return stringJoin1(String_$type, " ", this.ac(b, c)); } case 9: if (this.w(a, b)) { return this.ap(a, b); } throw new NotSupportedException(1, "shouldn't get here"); case 5: return this.al(b); case 16: { return stringJoin1(String_$type, " ", this.ad(b, c)); } case 20: if (b.a != null) { return this.a3(b); } if (b.c == null) { return this.a1(); } break; case 22: if (b.a != null) { return this.a3(b); } if (b.c == null) { return this.a1(); } break; case 15: throw new NotSupportedException(1, "need to figure this out"); case 3: throw new NotSupportedException(1, "need to figure this out"); case 19: if (b.a != null) { return this.ay(b); } else { return this.a1(); } case 8: if (b.b.specificExternalType == "string") { return this.ax(b); } if (b.a != null) { return this.az(b); } if (this.w(a, b)) { return this.ap(a, b); } throw new NotSupportedException(1, "shouldn't get here"); case 13: throw new NotSupportedException(1, "shouldn't get here"); case 18: if (b.a != null) { return this.a0(b); } else { return this.a1(); } case 24: case 1: return b.c.toString(); case 25: case 11: { let d = b.c; return d.x + ", " + d.y; } case 26: case 14: { let e = b.c; return e.left + ", " + e.top + ", " + e.width + ", " + e.height; } case 27: case 12: { let f = b.c; return f.width + ", " + f.height; } case 2: return b.c != null ? b.c.toString() : this.a1(); case 21: return this.ba(b.c); case 17: if (b.c == null) { return "null"; } if (typeof b.c === 'string') { return b.c.toString(); } return b.c.toString(); case 0: throw new NotSupportedException(1, "shouldn't get here"); } return ""; } ac(a, b) { if (a.b == null) { return ((() => { let $ret = new List$1(String_$type, 0); $ret.add(a.c); return $ret; })()); } if (typeCast(CodeGenerationSpecialValue.$, a.c) !== null) { a.c = this.ah(a); } let c = a.c; let d = new List$1(String_$type, 0); for (let e = 0; e < c.count; e++) { d.add(this.ai(c.item(e))); } return d; } ad(a, b) { if (a.b == null) { return ((() => { let $ret = new List$1(String_$type, 0); $ret.add(a.c); return $ret; })()); } if (typeCast(CodeGenerationSpecialValue.$, a.c) !== null) { a.c = this.ah(a); } let c = a.c; let d = new List$1(String_$type, 0); for (let e = 0; e < c.count; e++) { d.add(this.ak(c.item(e))); } return d; } ba(a) { if (a == null) { return ""; } return a.toString(); } ap(a, b) { let c = this.a9(a, b); if (b.c != null) { let d = b.c; if (typeCast(List$1.$.specialize(Base.$), d) !== null) { d = d.toArray(); } if (typeCast(CodeGenerationItemBuilder.$, d) !== null) { let e = this.i(this.l, this.j); let f = this.ao(c, b.c, e); c = this.as(a, b.c, f, c); } else if (typeCast(Array_$type, d) !== null) { let g = d; let h = new List$1(CodeGenerationItemBuilder.$, 0); let i = new List$1(String_$type, 0); for (let j = 0; j < g.length; j++) { if (typeCast(CodeGenerationItemBuilder.$, g[j]) !== null) { let k = this.i(this.l, this.j); let l = c; let m = g[j].p(); if (m == null) { m = g[j].n(); m = this.av(m); } if (m != null) { if (m != l) { l = m; } else { l = c + "_" + j.toString(); } } let n = this.ao(l, g[j], k); h.add(g[j]); i.add(n); } } c = this.at(b, a, h, i, c); } } return c; } ao(a, b, c) { b.u = a; b.v(c, true); let d = c.toString(); for (let e of fromEnum(c.ab)) { this.ab.add(e); } return d; } as(a, b, c, d) { return d; } at(a, b, c, d, e) { return e; } a9(a, b) { if (b.c == null) { return this.a1(); } if (typeCast(CodeGenerationItemBuilder.$, b.c) !== null) { let c = b.c.p(); if (c != null) { return c; } let d = b.c.n(); let e = this.av(d); return e; } else if (typeCast(IList_$type, b.c) !== null) { let f = b.c; if (f.count > 0 && typeCast(CodeGenerationItemBuilder.$, f.item(0)) !== null) { let g = f.item(0); let h = g.p(); if (h != null) { return h; } let i = g.n(); let j = this.av(i); return j; } return this.av(b.b.propertyName); } else if (typeCast(Array_$type, b.c) !== null) { let k = b.c; if (k.length > 0 && typeCast(CodeGenerationItemBuilder.$, k[0]) !== null) { let l = b.c.p(); if (l != null) { return l; } let m = b.c.n(); let n = this.av(m); return n; } return this.av(b.b.propertyName); } return this.a1(); } au(a, b) { return ""; } ah(a) { return a.c; } a3(a) { if (!stringIsNullOrEmpty(a.a.e)) { if (a.a.a) { return this.aw(a); } else { return this.a2(a); } } return this.a1(); } s(a) { if (a.a != null && !stringIsNullOrEmpty(a.a.e)) { if (a.a.a) { return true; } } return false; } a2(a) { return ""; } aw(a) { return ""; } az(a) { if (!stringIsNullOrEmpty(a.a.e)) { return a.a.e; } return this.a1(); } ax(a) { return a.c != null ? a.c.toString() : ""; } a0(a) { return this.ay(a); } ay(a) { if (!stringIsNullOrEmpty(a.a.e)) { this.bs(a); return a.a.e; } return this.a1(); } get_y() { return false; } get y() { return this.get_y(); } al(a) { let b = a.c; return ColorUtil.k(b, this.y); } ak(a) { let b = a; return ColorUtil.k(b, this.y); } aj(a) { if (a.c == null) { return ""; } let b = a.c; return ColorUtil.k(b.color, this.y); } ai(a) { if (a == null) { return ""; } let b = a; return ColorUtil.k(b.color, this.y); } bq(a) { this.ae.h(a); this.af.h(false); } bp(a) { let b = this.av(a); this.ae.h(b); this.af.h(true); } av(a) { let b = stringReplace(stringReplace(a, this.a8, ""), "Component", ""); b = CodeGeneratingComponentRenderer.g7(b); return this.j.v(b); } bn() { this.a5 = this.ae.e(); this.af.e(); } get_a8() { return ""; } get a8() { return this.get_a8(); } get aq() { if (this.ae.f > 0) { return this.ae.d(); } let a = stringReplace(stringReplace(this.ar, this.a8, ""), "Component", ""); return CodeGeneratingComponentRenderer.g7(a); } get v() { return this.ag.f == 1; } get o() { if (this.af.f == 0) { return false; } return this.af.d(); } get p() { if (this.ae.f > 0) { return true; } return false; } get_z() { return true; } get z() { return this.get_z(); } get_n() { return this.r; } get n() { return this.get_n(); } bo() { this.a5 = this.ae.e(); } bf(a) { let b = this.f.toString(); if (b.length > 0) { a.l(b); } } bi(a) { let b = this.g.toString(); if (b.length > 0) { a.l(b); } } be(a) { let b = this.e.toString(); if (b.length > 0) { a.l(b); } } bg(a, b) { if (this.ab.count > 0) { this.bh(a, this.ab, b); } } bh(a, b, c) { } } CodeGeneratingComponentRendererCodeEmitter.$t = markType(CodeGeneratingComponentRendererCodeEmitter, 'CodeGeneratingComponentRendererCodeEmitter'); return CodeGeneratingComponentRendererCodeEmitter; })(); /** * @hidden */ export let KotlinCodeBehindCodeGeneratingComponentRendererCodeEmitter = /*@__PURE__*/ (() => { class KotlinCodeBehindCodeGeneratingComponentRendererCodeEmitter extends CodeGeneratingComponentRendererCodeEmitter { constructor(a, b) { super(a, b); this.bv = 0; this.bt = new HashSet$1(String_$type, 0); this.bu = new HashSet$1(String_$type, 0); } ba(a) { if (a == null || isNaN_(a)) { return ""; } return "TimeSpan.FromMilliseconds(" + a + ")"; } get_r() { return true; } get r() { return this.get_r(); } i(a, b) { return new KotlinCodeBehindCodeGeneratingComponentRendererCodeEmitter(a, b); } get_z() { return false; } au(a, b) { if (b.c == null) { return "null"; } let c = b.c; let d = ""; for (let e = 0; e < c.length; e++) { if (e > 0) { d += ", "; } d += c[e].toString(); } return d; } bd(a, b, c) { super.bd(a, b, c); if (this.v) { this.h.l("var " + this.aq + " = " + a + "();"); } else { this.h.l("var " + this.aq + " = " + a + "();"); } if (!this.bt.contains(this.aq)) { this.bt.add_1(this.aq); if (!this.bu.contains(this.ar)) { this.bu.add_1(this.ar); this.bc(this.ar); } this.f.l("private var " + CodeGeneratingComponentRenderer.g7(this.aq) + ": " + this.ar); if (!this.p) { if (this.v) { this.g.l("var " + CodeGeneratingComponentRenderer.g7(this.aq) + " = this." + CodeGeneratingComponentRenderer.g7(this.aq) + " = document.querySelector('" + CodeGeneratingComponentRenderer.ha(stringReplace(this.ar, "Component", "")) + "') as " + this.ar + ";"); } } else { this.g.l("var " + CodeGeneratingComponentRenderer.g7(this.aq) + " = this." + CodeGeneratingComponentRenderer.g7(this.aq) + " = document.getElementById('" + this.aq + "') as " + this.ar + ";"); } } } br() { this.h.l(""); } bm(a) { { this.h.l(""); } super.bm(a); } bj(a, b, c, d) { let e = CodeGeneratingComponentRenderer.g7(b); if (e == "name" && c.b == null) { return; } if (this.s(c)) { this.bs(c); if (!this.bt.contains(this.aq)) { this.bt.add_1(this.aq); if (!this.bu.contains(this.ar)) { this.bu.add_1(this.ar); this.bc(this.ar); } this.f.l("private var " + CodeGeneratingComponentRenderer.g7(this.aq) + ": " + this.ar); if (!this.p) { if (this.v) { this.g.l("var " + CodeGeneratingComponentRenderer.g7(this.aq) + " = this." + CodeGeneratingComponentRenderer.g7(this.aq) + " = document.querySelector('" + CodeGeneratingComponentRenderer.ha(stringReplace(this.ar, "Component", "")) + "') as " + this.ar + ";"); } } else { this.g.l("var " + CodeGeneratingComponentRenderer.g7(this.aq) + " = this." + CodeGeneratingComponentRenderer.g7(this.aq) + " = document.getElementById('" + this.aq + "') as " + this.ar + ";"); } } let f = CodeGeneratingComponentRenderer.g7(this.a4(d, c, true)); let g = f; if (g != "null" && !stringStartsWith(g, "this.")) { g = "this." + g; } if (this.ar == "any" && stringContains(e, "-")) { this.e.l(CodeGeneratingComponentRenderer.g7(this.aq) + "['" + e + "'] = " + g + ";"); } else { if (c.b != null && c.b.isCustomEvent) { this.e.l(CodeGeneratingComponentRenderer.g7(this.aq) + ".addEventListener(\"" + e + "\", " + g + ");"); } else { this.e.l(CodeGeneratingComponentRenderer.g7(this.aq) + "." + e + " = " + g + ";"); } } return; } if (a > 0) { this.h.l(""); } if (this.ar == "any" && stringContains(e, "-")) { this.h.j(this.aq + "." + CodeGeneratingComponentRenderer.g7(this.aq) + "['" + e + "']"); } else { this.h.j(this.aq + "." + CodeGeneratingComponentRenderer.g7(e)); } this.h.j(" = "); this.h.j(this.a4(d, c, true)); this.h.j(";"); } ah(a) { let b = a.c; switch (b.a) { case 3: return b.b; case 0: return b.b; case 1: return b.b; case 2: return b.b; } return b.b; } a1() { return "null"; } ay(a) { if (!stringIsNullOrEmpty(a.a.e)) { this.bs(a); if (!this.bt.contains(a.a.e)) { this.g.l("this." + CodeGeneratingComponentRenderer.g7(a.a.e) + " = " + "this." + CodeGeneratingComponentRenderer.g7(a.a.e) + ".bind(this);"); } return "this." + CodeGeneratingComponentRenderer.g7(a.a.e); } return this.a1(); } aw(a) { return CodeGeneratingComponentRenderer.g7(a.a.e); } a2(a) { return CodeGeneratingComponentRenderer.g7(a.a.e); } a4(a, b, c) { if (b.b == null) { return "\"" + b.c + "\""; } if (typeCast(CodeGenerationSpecialValue.$, b.c) !== null) { b.c = this.ah(b); } switch (b.b.knownType) { case 25: case 11: { let d = b.c; return "IgaPoint(" + d.x + ", " + d.y + ")"; } case 26: case 14: { let e = b.c; return "IgaRect(" + e.left + ", " + e.top + ", " + e.width + ", " + e.height + ")"; } case 27: case 12: { let f = b.c; return "IgaSize(" + f.width + ", " + f.height + ")"; } case 17: if (b.c == null) { return "null"; } if (typeof b.c === 'string') { return "\"" + b.c.toString() + "\""; } if (typeCast(Boolean_$type, b.c) !== null) { return b.c ? "true" : "false"; } return b.c.toString(); case 5: return "IgaColor.fromString(\"" + super.a4(a, b, c) + "\")"; case 4: return "IgaBrush.fromString(\"" + super.a4(a, b, c) + "\")"; case 2: return "\"" + super.a4(a, b, c) + "\""; case 23: return "DoubleArray(" + super.a4(a, b, c) + ")"; case 6: return "arrayOf<IgaBrush?>(IgaBrush.fromString(\"" + stringJoin1(String_$type, "\"), IgaBrush.fromString(\"", super.ac(b, c)) + "\"))"; case 16: return "arrayOf<IgaColor?>(IgaColor.fromString(\"" + stringJoin1(String_$type, "\"), IgaColor.fromString(\"", super.ac(b, c)) + "\"))"; case 9: throw new NotSupportedException(1, "shouldn't get here"); } return super.a4(a, b, c); } bk(a, b, c, d) { if (c.b.knownType == 9) { let e = typeCast(IList_$type, c.c); if (e != null) { let f = true; for (let g of fromEn(e)) { if (typeCast(CodeGenerationItemBuilder.$, g) !== null) { let h = g; h.v(this, false); let i = c.b.owningType; this.h.l(this.aq + "." + b + ".add(" + this.a5 + ");"); } } } } else if (c.b.knownType == 10) { let j = c.c; if (j != null) { let k = "arrayOf("; for (let l = 0; l < j.length; l++) { let m = j[l]; if (typeCast(CodeGenerationItemBuilder.$, m) !== null) { let n = m; n.v(this, false); k += this.a5 + ","; } } k = trimEnd(k, ','); k += ")"; this.h.l(this.aq + "." + b + " = " + k + ";"); } } else { if (typeCast(CodeGenerationItemBuilder.$, c.c) !== null) { let o = c.c; o.v(this, false); this.h.l(this.aq + "." + b + " = " + this.a5 + ";"); } } } get_a8() { return "Iga"; } } KotlinCodeBehindCodeGeneratingComponentRendererCodeEmitter.$t = markType(KotlinCodeBehindCodeGeneratingComponentRendererCodeEmitter, 'KotlinCodeBehindCodeGeneratingComponentRendererCodeEmitter', CodeGeneratingComponentRendererCodeEmitter.$); return KotlinCodeBehindCodeGeneratingComponentRendererCodeEmitter; })(); /** * @hidden */ export let BlazorRazorCodeGeneratingComponentRendererCodeEmitter = /*@__PURE__*/ (() => { class BlazorRazorCodeGeneratingComponentRendererCodeEmitter extends CodeGeneratingComponentRendererCodeEmitter { constructor(a, b) { super(a, b); this.bv = 0; this.bt = new HashSet$1(String_$type, 0); this.bu = new HashSet$1(String_$type, 0); } get_r() { return false; } get r() { return this.get_r(); } as(a, b, c, d) { d = super.as(a, b, c, d); this.f.l("private " + b.n() + " _" + CodeGeneratingComponentRenderer.g7(d) + " = null;"); this.f.l("public " + b.n() + " " + CodeGeneratingComponentRenderer.g8(d)); this.f.l("{"); this.f.h(); this.f.l("get"); this.f.l("{"); this.f.h(); this.f.l("if (this._" + CodeGeneratingComponentRenderer.g7(d) + " == null)"); this.f.l("{"); this.f.h(); this.f.k(c); this.f.l("this._" + CodeGeneratingComponentRenderer.g7(d) + " = " + d + ";"); this.f.f(); this.f.l("}"); this.f.l("return this._" + CodeGeneratingComponentRenderer.g7(d) + ";"); this.f.f(); this.f.l("}"); this.f.f(); this.f.l("}"); return CodeGeneratingComponentRenderer.g8(d); } at(a, b, c, d, e) { e = super.at(a, b, c, d, e); let f = null; if (c.count > 0) { f = c._inner[0].r() + "[]"; } else { let g = a.b.specificExternalType; f = CodeGenerationItemBuilder.o(this.k.platform, g, b, this.am, this.an) + "[]"; } this.f.l("private " + f + " _" + CodeGeneratingComponentRenderer.g7(e) + " = null;"); this.f.l("public " + f + " " + CodeGeneratingComponentRenderer.g8(e)); this.f.l("{"); this.f.h(); this.f.l("get"); this.f.l("{"); this.f.h(); this.f.l("if (this._" + CodeGeneratingComponentRenderer.g7(e) + " == null)"); this.f.l("{"); this.f.h(); this.f.k("var " + CodeGeneratingComponentRenderer.g7(e) + " = new " + stringReplace(f, "[]", "") + "[" + c.count + "];"); for (let h = 0; h < c.count; h++) { this.f.k(d._inner[h]); this.f.k(e + "[" + h + "] = " + c._inner[h].u + ";"); } this.f.l("this._" + CodeGeneratingComponentRenderer.g7(e) + " = " + e + ";"); this.f.f(); this.f.l("}"); this.f.l("return this._" + CodeGeneratingComponentRenderer.g7(e) + ";"); this.f.f(); this.f.l("}"); this.f.f(); this.f.l("}"); return CodeGeneratingComponentRenderer.g8(e); } i(a, b) { return new BlazorCodeBehindCodeGeneratingComponentRendererCodeEmitter(a, b); } get_z() { return false; } bw(a, b, c) { if (c.c == null) { return "null"; } let d = c.c; let e = b; let f = new CodeGenerationItemBuilderPropertyInfo(); f.b = ((() => { let $ret = new TypeDescriptionMetadata(); $ret.propertyName = c.b.propertyName; $ret.specificType = b; $ret.specificExternalType = b; return $ret; })()); f.b.knownType = 8; f.b.owningType = c.b.owningType; if (f.b.specificType == "string") { f.b.knownType = 2; } if (f.b.specificType == "int") { f.b.knownType = 1; } if (f.b.specificType == "double") { f.b.knownType = 1; } if (f.b.knownType == 8) { e = this.a8 + e; } let g = "@(new " + e + "[] { "; for (let h = 0; h < d.length; h++) { if (h > 0) { g += ", "; } f.c = d[h]; if (f.b.knownType == 2) { g += "\"" + this.a4(a, f, true) + "\""; } else { g += this.a4(a, f, true); } } g += " })"; return g; } au(a, b) { let c = b.b.specificType; if (c == null) { c = b.b.specificExternalType; } return this.bw(a, c, b); }