igniteui-angular-core
Version:
Ignite UI Angular Core logic used in multiple UI components.
242 lines (241 loc) • 10.8 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];
var 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")) {
var o = this.j;
if (g.isJSContent) {
o = this.f;
}
var p = i.item("handler").value;
p = this.q(p, a);
if (!stringContains(p, "OMIT HANDLER")) {
var q = stringReplace(p, "\r\n", "\n").split('\n');
var r = 0x7FFFFFFF;
var s = "";
for (var t = 0; t < this.o.indentSpaces; t++) {
s += " ";
}
for (var v = 0; v < q.length; v++) {
var u = q[v];
var w = u;
if (w.trim().length == 0) {
continue;
}
w = stringReplace(u, "\t", s);
var x = 0;
for (var y = 0; y < w.length; y++) {
if (w.charAt(y) != ' ' && w.charAt(y) != '\t') {
break;
}
x++;
}
if (x < r) {
r = x;
}
}
for (var aa = 0; aa < q.length; aa++) {
var z = q[aa];
var ab = z;
var 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 {
var ad = g.content;
this.j.l(ad);
}
}
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 };