Skip to content

Commit

Permalink
chore: removed methods from the generated components' code
Browse files Browse the repository at this point in the history
  • Loading branch information
g-cheishvili committed Feb 14, 2024
1 parent 0031b49 commit ac7b8df
Show file tree
Hide file tree
Showing 4 changed files with 514 additions and 12,508 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ export class ComponentFile extends AngularGeneratedFile {
if (this.componentData.inputs.length) {
this.addImport(['ProxyInputs'], utilsFile.relativePathFrom);
}
if (this.componentData.methods.length) {
this.addImport(['ProxyMethods'], utilsFile.relativePathFrom);
}
if (this.componentData.formData.length > 0) {
this.addImport(() => genericCva.className, genericCva.relativePathFrom);
}
Expand Down Expand Up @@ -111,14 +108,6 @@ export class ComponentFile extends AngularGeneratedFile {
${i.name}${i.defaultValue ? '!' : '?'}: ${i.type}`).join(';\n');
}

get methodsCode(): string {
return this.componentData.methods.map(m => `
/**
${m.description}
*/
${m.name}!: ${this.componentData.baseName}['${m.name}']`).join(';\n');
}

set cvaGetterCode(val: string) {
this._cvaGetterCode = val;
}
Expand Down Expand Up @@ -177,8 +166,6 @@ export class ComponentFile extends AngularGeneratedFile {
this.cdr.detach();
${this.componentData.formData.length > 0 ? `this._cva.host = this;` : ''}
}
${this.methodsCode}
}`;
}

Expand Down Expand Up @@ -210,8 +197,7 @@ export class ComponentFile extends AngularGeneratedFile {
private componentProxiesCode() {
return [
this.componentData.inputs.length ? `@ProxyInputs(${JSON.stringify(this.componentData.inputs.map(i => i.name))})` : '',
this.componentData.outputs.length ? `@ProxyOutputs(${JSON.stringify(this.componentData.outputs.map(i => `${i.name}: ${this.outputPublicName(i)}`))})` : '',
this.componentData.methods.length ? `@ProxyMethods(${JSON.stringify(this.componentData.methods.map(i => i.name))})` : '',
this.componentData.outputs.length ? `@ProxyOutputs(${JSON.stringify(this.componentData.outputs.map(i => `${i.name}: ${this.outputPublicName(i)}`))})` : ''
].join('\n');
}
}
18 changes: 0 additions & 18 deletions libs/angular-generator/src/lib/ui5-webcomponents/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ export class UtilsFile extends AngularGeneratedFile {
exported: 'ProxyInputs',
types: [ExportSpecifierType.Function]
},
{
local: 'ProxyMethods',
exported: 'ProxyMethods',
types: [ExportSpecifierType.Function]
},
{
local: 'ProxyOutputs',
exported: 'ProxyOutputs',
Expand Down Expand Up @@ -50,19 +45,6 @@ export class UtilsFile extends AngularGeneratedFile {
}
}
function ProxyMethods(methodNames: string[]) {
return (cls: any) => {
methodNames.forEach(methodName => {
cls.prototype[methodName] = function (...args: any[]) {
return this.zone.runOutsideAngular(() =>
// eslint-disable-next-line prefer-spread
this.element[methodName].apply(this.element, args)
);
};
});
}
}
function ProxyOutputs(outputNames: string[]) {
return (cls: any) => {
outputNames.forEach((outputName) => {
Expand Down
Loading

0 comments on commit ac7b8df

Please sign in to comment.