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