igniteui-angular-core
Version:
Ignite UI Angular Core logic used in multiple UI components.
212 lines (211 loc) • 9.64 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, stringContains } from "./string";
/**
* @hidden
*/
export let CodeGeneratingComponentRendererHandlerEmitter = /*@__PURE__*/ (() => {
class CodeGeneratingComponentRendererHandlerEmitter extends Base {
constructor(a, b) {
super();
this.o = null;
this.m = null;
this.e = null;
this.a = null;
this.k = new CodeGeneratingImportManager();
this.b = null;
this.d = null;
this.c = null;
this.p = new HashSet$1(String_$type, 0);
this.o = a;
this.m = b;
this.e = new CodeGeneratingCodeWriter(this.o);
this.b = new CodeGeneratingCodeWriter(this.o);
this.d = new CodeGeneratingCodeWriter(this.o);
this.c = new CodeGeneratingCodeWriter(this.o);
this.a = new CodeGeneratingCodeWriter(this.o);
}
get n() {
return this.m;
}
get j() {
return this.e;
}
get f() {
return this.a;
}
get l() {
return this.k;
}
get g() {
return this.b;
}
get i() {
return this.d;
}
get h() {
return this.c;
}
u(a, b) {
}
t(a, b) {
}
s(a, b) {
let c = new HashSet$1(String_$type, 0);
if (a != null && a.length > 0) {
for (let d = 0; d < a.length; d++) {
let e = a[d];
if (e != null) {
this.r(e, c, true, false);
}
}
}
if (b != null && b.length > 0) {
for (let f = 0; f < b.length; f++) {
let g = b[f];
if (g != null) {
this.r(g, c, false, true);
}
}
}
for (let h = 0; h < this.m.t.count; h++) {
let i = this.m.t._inner[h];
if (i.a != null && i.c == null) {
this.r(i.a.e, c, false, false);
}
}
this.m.addContainerResult("eventHandlers", this.j.toString());
this.m.addContainerResult("eventScript", this.f.toString());
this.m.addImportResult("handlersImports", this.l);
this.m.addContainerResult("onInit", this.g.toString());
this.m.addContainerResult("handlersStyles", this.i.toString());
this.m.addContainerResult("onViewInit", this.h.toString());
}
r(a, b, c, d) {
if (this.o.library != null && this.o.library.hasItem(a)) {
if (b.contains(a)) {
return;
}
b.add_1(a);
let e = this.o.library.getItem(a);
if (e.type == 1) {
let f = false;
let g = e.getContentForPlatform(this.m.platform);
if (g != null) {
if (g.isJson) {
let h = new JsonDictionaryParser();
let i = h.parse(g.content);
if (i.g("imports")) {
let j = i.item("imports").value;
let k = stringReplace(j, "\r\n", "\n").split('\n');
for (let m = 0; m < k.length; m++) {
let l = k[m];
let n = l;
if (n.trim().length == 0) {
continue;
}
if (this.n.platform == 4) {
if (stringContains(n, "using System.Windows.")) {
n = "using Infragistics.Win.DataVisualization;";
}
if (stringContains(n, "using Infragistics.Controls")) {
n = "using Infragistics.Win.DataVisualization;";
}
}
if (!this.p.contains(n)) {
this.p.add_1(n);
this.v(this.l, n);
}
}
}
if (i.g("styles")) {
this.i.k(i.item("styles").value);
}
if (i.g("handler")) {
let o = this.j;
if (g.isJSContent) {
o = this.f;
}
let p = i.item("handler").value;
p = this.q(p, a);
if (!stringContains(p, "OMIT HANDLER")) {
let q = stringReplace(p, "\r\n", "\n").split('\n');
let r = 0x7FFFFFFF;
let s = "";
for (let t = 0; t < this.o.indentSpaces; t++) {
s += " ";
}
for (let v = 0; v < q.length; v++) {
let u = q[v];
let w = u;
if (w.trim().length == 0) {
continue;
}
w = stringReplace(u, "\t", s);
let x = 0;
for (let y = 0; y < w.length; y++) {
if (w.charAt(y) != ' ' && w.charAt(y) != '\t') {
break;
}
x++;
}
if (x < r) {
r = x;
}
}
for (let aa = 0; aa < q.length; aa++) {
let z = q[aa];
let ab = z;
let ac = 0;
if (ab.trim().length > 0) {
while (ab.length > 0 && (ab.charAt(0) == ' ' || ab.charAt(0) == '\t') && ac < r) {
if (ab.charAt(0) == ' ') {
ab = ab.substr(1);
ac++;
}
if (ab.charAt(0) == '\t') {
ab = ab.substr(1);
ac += this.o.indentSpaces;
}
}
}
o.l(ab);
}
}
else {
f = true;
}
}
}
else {
let ad = g.content;
this.j.l(ad);
}
}
if (c && !f) {
this.t(a, g.isJSContent);
}
if (d && !f) {
this.u(a, g.isJSContent);
}
}
}
}
v(a, b) {
}
q(a, b) {
return a;
}
}
CodeGeneratingComponentRendererHandlerEmitter.$t = markType(CodeGeneratingComponentRendererHandlerEmitter, 'CodeGeneratingComponentRendererHandlerEmitter');
return CodeGeneratingComponentRendererHandlerEmitter;
})();