igniteui-react-core
Version:
Ignite UI React Core.
97 lines (96 loc) • 4.41 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 { CodeGeneratingComponentRendererTemplateEmitter } from "./CodeGeneratingComponentRendererTemplateEmitter";
import { Dictionary$2 } from "./Dictionary$2";
import { String_$type, markType } from "./type";
import { CodeGeneratingRegexHelper } from "./CodeGeneratingRegexHelper";
import { stringReplace, stringContains, stringStartsWith, stringEndsWith } from "./string";
/**
* @hidden
*/
export let TSCodeGeneratingComponentRendererTemplateEmitter = /*@__PURE__*/ (() => {
class TSCodeGeneratingComponentRendererTemplateEmitter extends CodeGeneratingComponentRendererTemplateEmitter {
constructor(a, b, c) {
super(a, b);
this.t = 0;
this.u = new Dictionary$2(String_$type, String_$type, 0);
this.t = c;
this.u.item("IgxRowType", "RowType");
this.u.item("IgxCellType", "CellType");
}
get v() {
switch (this.t) {
case 1: return "angular";
case 2: return "react";
case 3: return "webcomponents";
}
return "";
}
get w() {
switch (this.t) {
case 1: return "Igx";
case 2: return "Igr";
case 3: return "Igc";
}
return "";
}
s(a, b) {
super.s(a, b);
let c = new CodeGeneratingRegexHelper("import {([^}]+)}\\s+from\\s+['\"]([^'\"]+)['\"]");
c.execute(b, (d, e, f) => {
let g = d(1);
let h = d(2);
h = stringReplace(h, "webcomponents", this.v);
h = stringReplace(h, "react", this.v);
h = stringReplace(h, "angular", this.v);
if (this.v == "angular" || this.v == "react") {
if (stringContains(h, "/grids")) {
h = stringReplace(h, "/grids", "");
}
}
if (this.v == "angular") {
if (stringContains(h, "igniteui-angular-grids")) {
h = stringReplace(h, "igniteui-angular-grids", "igniteui-angular");
}
}
let i = g.split(',');
for (let k = 0; k < i.length; k++) {
let j = i[k];
let l = j.trim();
if (stringStartsWith(l, "Igc")) {
l = this.w + l.substr(3);
}
if (stringStartsWith(l, "Igr")) {
l = this.w + l.substr(3);
}
if (stringStartsWith(l, "Igx")) {
l = this.w + l.substr(3);
}
if (stringStartsWith(l, "Igr") && stringEndsWith(l, "Component")) {
l = l.substr(0, l.length - ("Component").length);
}
if (h.trim() == "igniteui-angular") {
if (this.u.containsKey(l.trim())) {
l = this.u.item(l.trim());
}
if (stringStartsWith(l.trim(), "Igx") && stringEndsWith(l.trim(), "EventArgs")) {
this.u.item(l.trim(), stringReplace(l, "Igx", "I"));
l = stringReplace(l, "Igx", "I");
}
}
a.addPackageImport(h.trim(), l.trim());
}
return null;
});
}
q(a, b) {
return b;
}
}
TSCodeGeneratingComponentRendererTemplateEmitter.$t = /*@__PURE__*/ markType(TSCodeGeneratingComponentRendererTemplateEmitter, 'TSCodeGeneratingComponentRendererTemplateEmitter', CodeGeneratingComponentRendererTemplateEmitter.$);
return TSCodeGeneratingComponentRendererTemplateEmitter;
})();