igniteui-angular-core
Version:
Ignite UI Angular Core logic used in multiple UI components.
214 lines (213 loc) • 9.21 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 { __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 CodeGeneratingComponentRendererHandlerEmitter = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(CodeGeneratingComponentRendererHandlerEmitter, _super);
function CodeGeneratingComponentRendererHandlerEmitter(a, b) {
var _this = _super.call(this) || this;
_this.m = null;
_this.k = null;
_this.d = null;
_this.a = null;
_this.i = new CodeGeneratingImportManager();
_this.b = null;
_this.c = null;
_this.n = new HashSet$1(String_$type, 0);
_this.m = a;
_this.k = b;
_this.d = new CodeGeneratingCodeWriter(_this.m);
_this.b = new CodeGeneratingCodeWriter(_this.m);
_this.c = new CodeGeneratingCodeWriter(_this.m);
_this.a = new CodeGeneratingCodeWriter(_this.m);
return _this;
}
Object.defineProperty(CodeGeneratingComponentRendererHandlerEmitter.prototype, "l", {
get: function () {
return this.k;
},
enumerable: false,
configurable: true
});
Object.defineProperty(CodeGeneratingComponentRendererHandlerEmitter.prototype, "h", {
get: function () {
return this.d;
},
enumerable: false,
configurable: true
});
Object.defineProperty(CodeGeneratingComponentRendererHandlerEmitter.prototype, "e", {
get: function () {
return this.a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(CodeGeneratingComponentRendererHandlerEmitter.prototype, "j", {
get: function () {
return this.i;
},
enumerable: false,
configurable: true
});
Object.defineProperty(CodeGeneratingComponentRendererHandlerEmitter.prototype, "f", {
get: function () {
return this.b;
},
enumerable: false,
configurable: true
});
Object.defineProperty(CodeGeneratingComponentRendererHandlerEmitter.prototype, "g", {
get: function () {
return this.c;
},
enumerable: false,
configurable: true
});
CodeGeneratingComponentRendererHandlerEmitter.prototype.s = function (a, b) {
};
CodeGeneratingComponentRendererHandlerEmitter.prototype.r = function (a, b) {
};
CodeGeneratingComponentRendererHandlerEmitter.prototype.q = function (a, b) {
var c = new HashSet$1(String_$type, 0);
if (a != null && a.length > 0) {
for (var d = 0; d < a.length; d++) {
var e = a[d];
if (e != null) {
this.p(e, c, true, false);
}
}
}
if (b != null && b.length > 0) {
for (var f = 0; f < b.length; f++) {
var g = b[f];
if (g != null) {
this.p(g, c, false, true);
}
}
}
for (var h = 0; h < this.k.t.count; h++) {
var i = this.k.t._inner[h];
if (i.a != null && i.c == null) {
this.p(i.a.e, c, false, false);
}
}
this.k.addContainerResult("eventHandlers", this.h.toString());
this.k.addContainerResult("eventScript", this.e.toString());
this.k.addImportResult("handlersImports", this.j);
this.k.addContainerResult("onInit", this.f.toString());
this.k.addContainerResult("onViewInit", this.g.toString());
};
CodeGeneratingComponentRendererHandlerEmitter.prototype.p = function (a, b, c, d) {
if (this.m.library != null && this.m.library.hasItem(a)) {
if (b.contains(a)) {
return;
}
b.add_1(a);
var e = this.m.library.getItem(a);
if (e.type == 1) {
var f = e.getContentForPlatform(this.k.platform);
if (f != null) {
if (f.isJson) {
var g = new JsonDictionaryParser();
var h = g.parse(f.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.n.contains(k)) {
this.n.add_1(k);
this.t(this.j, k);
}
}
}
if (h.g("handler")) {
var m = this.h;
if (f.isJSContent) {
m = this.e;
}
var n = h.item("handler").value;
n = this.o(n);
var o = stringReplace(n, "\r\n", "\n").split('\n');
var p = 0x7FFFFFFF;
var q = "";
for (var r = 0; r < this.m.indentSpaces; r++) {
q += " ";
}
for (var t = 0; t < o.length; t++) {
var s = o[t];
var u = s;
if (u.trim().length == 0) {
continue;
}
u = stringReplace(s, "\t", q);
var v = 0;
for (var w = 0; w < u.length; w++) {
if (u.charAt(w) != ' ' && u.charAt(w) != '\t') {
break;
}
v++;
}
if (v < p) {
p = v;
}
}
for (var y = 0; y < o.length; y++) {
var x = o[y];
var z = x;
var aa = 0;
if (z.trim().length > 0) {
while (z.length > 0 && (z.charAt(0) == ' ' || z.charAt(0) == '\t') && aa < p) {
if (z.charAt(0) == ' ') {
z = z.substr(1);
aa++;
}
if (z.charAt(0) == '\t') {
z = z.substr(1);
aa += this.m.indentSpaces;
}
}
}
m.l(z);
}
}
}
else {
var ab = f.content;
this.h.l(ab);
}
}
if (c) {
this.r(a, f.isJSContent);
}
if (d) {
this.s(a, f.isJSContent);
}
}
}
};
CodeGeneratingComponentRendererHandlerEmitter.prototype.t = function (a, b) {
};
CodeGeneratingComponentRendererHandlerEmitter.prototype.o = function (a) {
return a;
};
CodeGeneratingComponentRendererHandlerEmitter.$t = markType(CodeGeneratingComponentRendererHandlerEmitter, 'CodeGeneratingComponentRendererHandlerEmitter');
return CodeGeneratingComponentRendererHandlerEmitter;
}(Base));
export { CodeGeneratingComponentRendererHandlerEmitter };