UNPKG

igniteui-react-core

Version:
229 lines (228 loc) 11.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, markType } from "./type"; import { CodeGeneratingCodeWriter } from "./CodeGeneratingCodeWriter"; import { CodeGeneratingImportManager } from "./CodeGeneratingImportManager"; import { HashSet$1 } from "./HashSet$1"; import { JsonDictionaryParser } from "./JsonDictionaryParser"; import { stringReplace } from "./string"; /** * @hidden */ var CodeGeneratingComponentRendererTemplateEmitter = /** @class */ /*@__PURE__*/ (function (_super) { __extends(CodeGeneratingComponentRendererTemplateEmitter, _super); function CodeGeneratingComponentRendererTemplateEmitter(a, b) { var _this = _super.call(this) || this; _this.o = null; _this.m = null; _this.e = null; _this.b = null; _this.c = null; _this.d = null; _this.a = null; _this.k = new CodeGeneratingImportManager(); _this.p = new HashSet$1(String_$type, 0); _this.o = a; _this.m = b; _this.e = new CodeGeneratingCodeWriter(_this.o); _this.a = new CodeGeneratingCodeWriter(_this.o); _this.b = new CodeGeneratingCodeWriter(_this.o); _this.c = new CodeGeneratingCodeWriter(_this.o); _this.d = new CodeGeneratingCodeWriter(_this.o); return _this; } Object.defineProperty(CodeGeneratingComponentRendererTemplateEmitter.prototype, "n", { get: function () { return this.m; }, enumerable: false, configurable: true }); Object.defineProperty(CodeGeneratingComponentRendererTemplateEmitter.prototype, "j", { get: function () { return this.e; }, enumerable: false, configurable: true }); Object.defineProperty(CodeGeneratingComponentRendererTemplateEmitter.prototype, "g", { get: function () { return this.b; }, enumerable: false, configurable: true }); Object.defineProperty(CodeGeneratingComponentRendererTemplateEmitter.prototype, "h", { get: function () { return this.c; }, enumerable: false, configurable: true }); Object.defineProperty(CodeGeneratingComponentRendererTemplateEmitter.prototype, "i", { get: function () { return this.d; }, enumerable: false, configurable: true }); Object.defineProperty(CodeGeneratingComponentRendererTemplateEmitter.prototype, "f", { get: function () { return this.a; }, enumerable: false, configurable: true }); Object.defineProperty(CodeGeneratingComponentRendererTemplateEmitter.prototype, "l", { get: function () { return this.k; }, enumerable: false, configurable: true }); CodeGeneratingComponentRendererTemplateEmitter.prototype.r = function () { var a = new HashSet$1(String_$type, 0); for (var b = 0; b < this.m.t.count; b++) { var c = this.m.t._inner[b]; if (c.a != null && c.c == null) { if (this.o.library != null && this.o.library.hasItem(c.a.e)) { if (a.contains(c.a.e)) { continue; } a.add_1(c.a.e); var d = this.o.library.getItem(c.a.e); if (d.type == 2) { var e = d.getContentForPlatform(this.m.platform); if (e != null) { if (e.isJSContent) { var f = e.content; this.f.l(f); } else if (e.isJson) { var g = new JsonDictionaryParser(); var h = g.parse(e.content); if (h.g("imports")) { var i = h.item("imports").value; var j = stringReplace(i, "\r\n", "\n").split('\n'); for (var l = 0; l < j.length; l++) { var k = j[l]; if (k.trim().length == 0) { continue; } if (!this.p.contains(k)) { this.p.add_1(k); this.s(this.l, k); } } } if (h.g("styles")) { var m = h.item("styles").value; var n = stringReplace(m, "\r\n", "\n").split('\n'); for (var p = 0; p < n.length; p++) { var o = n[p]; if (o.trim().length == 0) { continue; } this.g.l(o); } } if (h.g("supportingMethods")) { var q = h.item("supportingMethods").value; q = this.q(c.a.e, q); var r = stringReplace(q, "\r\n", "\n").split('\n'); for (var t = 0; t < r.length; t++) { var s = r[t]; if (s.trim().length == 0) { continue; } this.h.l(s); } } if (h.g("content")) { var u = h.item("content").value; u = this.q(c.a.e, u); var v = stringReplace(u, "\r\n", "\n").split('\n'); var w = 0x7FFFFFFF; var x = ""; for (var y = 0; y < this.o.indentSpaces; y++) { x += " "; } for (var aa = 0; aa < v.length; aa++) { var z = v[aa]; var ab = z; if (ab.trim().length == 0) { continue; } ab = stringReplace(z, "\t", x); var ac = 0; for (var ad = 0; ad < ab.length; ad++) { if (ab.charAt(ad) != ' ' && ab.charAt(ad) != '\t') { break; } ac++; } if (ac < w) { w = ac; } } for (var af = 0; af < v.length; af++) { var ae = v[af]; var ag = ae; var ah = 0; if (ag.trim().length > 0) { while (ag.length > 0 && (ag.charAt(0) == ' ' || ag.charAt(0) == '\t') && ah < w) { if (ag.charAt(0) == ' ') { ag = ag.substr(1); ah++; } if (ag.charAt(0) == '\t') { ag = ag.substr(1); ah += this.o.indentSpaces; } } } this.j.l(ag); } } if (h.g("supportingTypes")) { var ai = h.item("supportingTypes").value; var aj = stringReplace(ai, "\r\n", "\n").split('\n'); for (var al = 0; al < aj.length; al++) { var ak = aj[al]; if (ak.trim().length == 0) { continue; } this.i.l(ak); } } } else { var am = e.content; this.j.l(am); } } } } } } this.m.addContainerResult("templateContents", this.j.toString()); this.m.addImportResult("templateImports", this.l); this.m.addContainerResult("templateSupportingMethods", this.h.toString()); this.m.addContainerResult("templateSupportingTypes", this.i.toString()); this.m.addContainerResult("templateStyles", this.g.toString()); this.m.addContainerResult("templateScripts", this.f.toString()); }; CodeGeneratingComponentRendererTemplateEmitter.prototype.s = function (a, b) { }; CodeGeneratingComponentRendererTemplateEmitter.prototype.q = function (a, b) { return b; }; CodeGeneratingComponentRendererTemplateEmitter.$t = markType(CodeGeneratingComponentRendererTemplateEmitter, 'CodeGeneratingComponentRendererTemplateEmitter'); return CodeGeneratingComponentRendererTemplateEmitter; }(Base)); export { CodeGeneratingComponentRendererTemplateEmitter };