igniteui-angular-core
Version:
Ignite UI Angular Core logic used in multiple UI components.
181 lines (180 loc) • 9.38 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 { 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
*/
export let CodeGeneratingComponentRendererTemplateEmitter = /*@__PURE__*/ (() => {
class CodeGeneratingComponentRendererTemplateEmitter extends Base {
constructor(a, b) {
super();
this.m = null;
this.k = null;
this.d = null;
this.b = null;
this.c = null;
this.a = null;
this.i = new CodeGeneratingImportManager();
this.n = new HashSet$1(String_$type, 0);
this.m = a;
this.k = b;
this.d = new CodeGeneratingCodeWriter(this.m);
this.a = new CodeGeneratingCodeWriter(this.m);
this.b = new CodeGeneratingCodeWriter(this.m);
this.c = new CodeGeneratingCodeWriter(this.m);
}
get l() {
return this.k;
}
get h() {
return this.d;
}
get f() {
return this.b;
}
get g() {
return this.c;
}
get e() {
return this.a;
}
get j() {
return this.i;
}
p() {
let a = new HashSet$1(String_$type, 0);
for (let b = 0; b < this.k.t.count; b++) {
let c = this.k.t._inner[b];
if (c.a != null && c.c == null) {
if (this.m.library != null && this.m.library.hasItem(c.a.e)) {
if (a.contains(c.a.e)) {
continue;
}
a.add_1(c.a.e);
let d = this.m.library.getItem(c.a.e);
if (d.type == 2) {
let e = d.getContentForPlatform(this.k.platform);
if (e != null) {
if (e.isJSContent) {
let f = e.content;
this.e.l(f);
}
else if (e.isJson) {
let g = new JsonDictionaryParser();
let h = g.parse(e.content);
if (h.g("imports")) {
let i = h.item("imports").value;
let j = stringReplace(i, "\r\n", "\n").split('\n');
for (let l = 0; l < j.length; l++) {
let k = j[l];
if (k.trim().length == 0) {
continue;
}
if (!this.n.contains(k)) {
this.n.add_1(k);
this.q(this.j, k);
}
}
}
if (h.g("styles")) {
let m = h.item("styles").value;
let n = stringReplace(m, "\r\n", "\n").split('\n');
for (let p = 0; p < n.length; p++) {
let o = n[p];
if (o.trim().length == 0) {
continue;
}
this.f.l(o);
}
}
if (h.g("supportingMethods")) {
let q = h.item("supportingMethods").value;
let r = stringReplace(q, "\r\n", "\n").split('\n');
for (let t = 0; t < r.length; t++) {
let s = r[t];
if (s.trim().length == 0) {
continue;
}
this.g.l(s);
}
}
if (h.g("content")) {
let u = h.item("content").value;
u = this.o(c.a.e, u);
let v = stringReplace(u, "\r\n", "\n").split('\n');
let w = 0x7FFFFFFF;
let x = "";
for (let y = 0; y < this.m.indentSpaces; y++) {
x += " ";
}
for (let aa = 0; aa < v.length; aa++) {
let z = v[aa];
let ab = z;
if (ab.trim().length == 0) {
continue;
}
ab = stringReplace(z, "\t", x);
let ac = 0;
for (let ad = 0; ad < ab.length; ad++) {
if (ab.charAt(ad) != ' ' && ab.charAt(ad) != '\t') {
break;
}
ac++;
}
if (ac < w) {
w = ac;
}
}
for (let af = 0; af < v.length; af++) {
let ae = v[af];
let ag = ae;
let 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.m.indentSpaces;
}
}
}
this.h.l(ag);
}
}
}
else {
let ai = e.content;
this.h.l(ai);
}
}
}
}
}
}
this.k.addContainerResult("templateContents", this.h.toString());
this.k.addImportResult("templateImports", this.j);
this.k.addContainerResult("templateSupportingMethods", this.g.toString());
this.k.addContainerResult("templateStyles", this.f.toString());
this.k.addContainerResult("templateScripts", this.e.toString());
}
q(a, b) {
}
o(a, b) {
return b;
}
}
CodeGeneratingComponentRendererTemplateEmitter.$t = markType(CodeGeneratingComponentRendererTemplateEmitter, 'CodeGeneratingComponentRendererTemplateEmitter');
return CodeGeneratingComponentRendererTemplateEmitter;
})();