igniteui-angular-core
Version:
Ignite UI Angular Core logic used in multiple UI components.
85 lines (84 loc) • 3.86 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 { CodeGeneratingComponentRendererTemplateEmitter } from "./CodeGeneratingComponentRendererTemplateEmitter";
import { markType } from "./type";
import { CodeGeneratingRegexHelper } from "./CodeGeneratingRegexHelper";
import { stringReplace, stringStartsWith, stringEndsWith } from "./string";
/**
* @hidden
*/
var TSCodeGeneratingComponentRendererTemplateEmitter = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(TSCodeGeneratingComponentRendererTemplateEmitter, _super);
function TSCodeGeneratingComponentRendererTemplateEmitter(a, b, c) {
var _this = _super.call(this, a, b) || this;
_this.r = 0;
_this.r = c;
return _this;
}
Object.defineProperty(TSCodeGeneratingComponentRendererTemplateEmitter.prototype, "s", {
get: function () {
switch (this.r) {
case 1: return "angular";
case 2: return "react";
case 3: return "webcomponents";
}
return "";
},
enumerable: false,
configurable: true
});
Object.defineProperty(TSCodeGeneratingComponentRendererTemplateEmitter.prototype, "t", {
get: function () {
switch (this.r) {
case 1: return "Igx";
case 2: return "Igr";
case 3: return "Igc";
}
return "";
},
enumerable: false,
configurable: true
});
TSCodeGeneratingComponentRendererTemplateEmitter.prototype.q = function (a, b) {
var _this = this;
_super.prototype.q.call(this, a, b);
var c = new CodeGeneratingRegexHelper("import {([^}]+)}\\s+from\\s+['\"]([^'\"]+)['\"]");
c.execute(b, function (d, e, f) {
var g = d(1);
var h = d(2);
h = stringReplace(h, "webcomponents", _this.s);
h = stringReplace(h, "react", _this.s);
h = stringReplace(h, "angular", _this.s);
var i = g.split(',');
for (var k = 0; k < i.length; k++) {
var j = i[k];
var l = j.trim();
if (stringStartsWith(l, "Igc")) {
l = _this.t + l.substr(3);
}
if (stringStartsWith(l, "Igr")) {
l = _this.t + l.substr(3);
}
if (stringStartsWith(l, "Igx")) {
l = _this.t + l.substr(3);
}
if (stringStartsWith(l, "Igr") && stringEndsWith(l, "Component")) {
l = l.substr(0, l.length - ("Component").length);
}
a.addPackageImport(h.trim(), l.trim());
}
return null;
});
};
TSCodeGeneratingComponentRendererTemplateEmitter.prototype.o = function (a, b) {
return b;
};
TSCodeGeneratingComponentRendererTemplateEmitter.$t = markType(TSCodeGeneratingComponentRendererTemplateEmitter, 'TSCodeGeneratingComponentRendererTemplateEmitter', CodeGeneratingComponentRendererTemplateEmitter.$);
return TSCodeGeneratingComponentRendererTemplateEmitter;
}(CodeGeneratingComponentRendererTemplateEmitter));
export { TSCodeGeneratingComponentRendererTemplateEmitter };