build: Use prettier for typescript

Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
Ralph Hopman
2025-01-15 11:59:30 +00:00
committed by Adam Saghy
parent 9d6cf1514a
commit cac1d11ad7
1812 changed files with 22516 additions and 16862 deletions
+9 -3
View File
@@ -15,7 +15,13 @@ import { FormatAmountDirective } from './format-amount.directive';
imports: [
CommonModule
],
declarations: [HasPermissionDirective, FormatAmountDirective],
exports: [HasPermissionDirective, FormatAmountDirective]
declarations: [
HasPermissionDirective,
FormatAmountDirective
],
exports: [
HasPermissionDirective,
FormatAmountDirective
]
})
export class DirectivesModule { }
export class DirectivesModule {}
+35 -36
View File
@@ -4,47 +4,46 @@ import { NgControl } from '@angular/forms';
import { LOCALE_ID } from '@angular/core';
@Directive({
selector: '[mifosxFormatAmount]',
selector: '[mifosxFormatAmount]'
})
export class FormatAmountDirective implements OnInit {
format = 'N0';
digitsInfo = '1.0-0';
currencyCode: string;
displaySymbol: string;
@Input() sufix = '';
format = 'N0';
digitsInfo = '1.0-0';
currencyCode: string;
displaySymbol: string;
@Input() sufix = '';
@Input('mifosxFormatAmount') set _(values: string) {
const parts: string[] = values.split(':');
this.currencyCode = parts[0];
this.displaySymbol = (parts.length > 1) ? parts[1] : '$';
this.digitsInfo = (parts.length > 2) ? parts[2] : '1.2-2';
@Input('mifosxFormatAmount') set _(values: string) {
const parts: string[] = values.split(':');
this.currencyCode = parts[0];
this.displaySymbol = parts.length > 1 ? parts[1] : '$';
this.digitsInfo = parts.length > 2 ? parts[2] : '1.2-2';
}
@HostListener('blur', ['$event.target']) blur(target: any) {
target.value = this.parse(target.value);
}
@HostListener('focus', ['$event.target']) focus(target: any) {
if (typeof this.control.value === 'undefined') {
target.value = '';
} else {
target.value = this.control.value;
}
}
@HostListener('blur', ['$event.target']) blur(target: any) {
target.value = this.parse(target.value);
}
@HostListener('focus', ['$event.target']) focus(target: any) {
if (typeof this.control.value === 'undefined') {
target.value = '';
} else {
target.value = this.control.value;
}
}
ngOnInit() {
setTimeout(() => {
this.el.nativeElement.value = this.parse(this.el.nativeElement.value);
});
}
ngOnInit() {
setTimeout(() => {
this.el.nativeElement.value = this.parse(this.el.nativeElement.value);
});
}
constructor(
@Inject(LOCALE_ID) private locale: string,
private el: ElementRef,
private control: NgControl
) { }
parse(value: any) {
return formatCurrency(value, this.locale, this.displaySymbol, this.currencyCode, this.digitsInfo) + this.sufix;
}
constructor(
@Inject(LOCALE_ID) private locale: string,
private el: ElementRef,
private control: NgControl
) {}
parse(value: any) {
return formatCurrency(value, this.locale, this.displaySymbol, this.currencyCode, this.digitsInfo) + this.sufix;
}
}
@@ -11,7 +11,6 @@ import { AuthenticationService } from '../../core/authentication/authentication.
selector: '[mifosxHasPermission]'
})
export class HasPermissionDirective {
/** User Permissions */
private userPermissions: any[];
@@ -21,9 +20,11 @@ export class HasPermissionDirective {
* @param {ViewContainerRef} viewContainer View Container Reference
* @param {AuthenticationService} authenticationService AuthenticationService
*/
constructor(private templateRef: TemplateRef<any>,
private viewContainer: ViewContainerRef,
private authenticationService: AuthenticationService) {
constructor(
private templateRef: TemplateRef<any>,
private viewContainer: ViewContainerRef,
private authenticationService: AuthenticationService
) {
const savedCredentials = this.authenticationService.getCredentials();
this.userPermissions = savedCredentials.permissions;
}
@@ -60,16 +61,15 @@ export class HasPermissionDirective {
if (this.userPermissions.includes('ALL_FUNCTIONS')) {
return true;
} else if (permission !== '') {
if (permission.substring(0, 5) === 'READ_' && this.userPermissions.includes('ALL_FUNCTIONS_READ')) {
return true;
} else if (this.userPermissions.includes(permission)) {
return true;
} else {
return false;
}
if (permission.substring(0, 5) === 'READ_' && this.userPermissions.includes('ALL_FUNCTIONS_READ')) {
return true;
} else if (this.userPermissions.includes(permission)) {
return true;
} else {
return false;
}
} else {
return false;
}
}
}