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
@@ -8,9 +8,8 @@ describe('FormDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FormDialogComponent ]
})
.compileComponents();
declarations: [FormDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -14,14 +14,13 @@ const layoutGap = 2;
styleUrls: ['./form-dialog.component.scss']
})
export class FormDialogComponent implements OnInit {
layout: {
columns: number,
columnWidth?: number,
flex?: number,
gap?: number,
cancelButtonText?: string,
addButtonText?: string
columns: number;
columnWidth?: number;
flex?: number;
gap?: number;
cancelButtonText?: string;
addButtonText?: string;
} = {
columns: 1,
columnWidth: 400,
@@ -34,15 +33,19 @@ export class FormDialogComponent implements OnInit {
formfields: FormfieldBase[];
pristine: boolean;
constructor(public dialogRef: MatDialogRef<FormDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,
private formGroupService: FormGroupService) {
constructor(
public dialogRef: MatDialogRef<FormDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,
private formGroupService: FormGroupService
) {
this.dialogRef.disableClose = data.disableClose !== undefined ? data.disableClose : true;
this.formfields = data.formfields.sort((formfieldA: FormfieldBase, formfieldB: FormfieldBase) => formfieldA.order - formfieldB.order);
this.formfields = data.formfields.sort(
(formfieldA: FormfieldBase, formfieldB: FormfieldBase) => formfieldA.order - formfieldB.order
);
this.pristine = data.pristine !== undefined ? data.pristine : true;
this.layout = { ...this.layout, ...data.layout };
this.layout.gap = this.layout.columns > 1 ? layoutGap : 0;
this.layout.flex = (this.layout.flex / this.layout.columns) - this.layout.gap;
this.layout.flex = this.layout.flex / this.layout.columns - this.layout.gap;
}
ngOnInit() {
@@ -52,5 +55,4 @@ export class FormDialogComponent implements OnInit {
this.form.markAsDirty();
}
}
}
@@ -7,17 +7,17 @@ import { FormfieldBase } from './formfield/model/formfield-base';
providedIn: 'root'
})
export class FormGroupService {
constructor() { }
constructor() {}
createFormGroup(formfields: FormfieldBase[]) {
const group: any = {};
formfields.forEach(formfield => {
group[formfield.controlName] = formfield.required ? new UntypedFormControl(formfield.value, Validators.required) : new UntypedFormControl(formfield.value);
formfields.forEach((formfield) => {
group[formfield.controlName] = formfield.required
? new UntypedFormControl(formfield.value, Validators.required)
: new UntypedFormControl(formfield.value);
});
return new UntypedFormGroup(group);
}
}
@@ -8,9 +8,8 @@ describe('FormfieldComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FormfieldComponent ]
})
.compileComponents();
declarations: [FormfieldComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -9,10 +9,8 @@ import { FormfieldBase } from './model/formfield-base';
styleUrls: ['./formfield.component.scss']
})
export class FormfieldComponent {
@Input() form: UntypedFormGroup;
@Input() formfield: FormfieldBase;
constructor() { }
constructor() {}
}
@@ -1,10 +1,9 @@
import { FormfieldBase } from './formfield-base';
export class CheckboxBase extends FormfieldBase {
controlType = 'checkbox';
constructor(options: any) {
super(options);
}
controlType = 'checkbox';
constructor(options: any) {
super(options);
}
}
@@ -1,7 +1,6 @@
import { FormfieldBase } from './formfield-base';
export class DatepickerBase extends FormfieldBase {
controlType = 'datepicker';
minDate: Date;
maxDate: Date;
@@ -11,5 +10,4 @@ export class DatepickerBase extends FormfieldBase {
this.minDate = options['minDate'] || new Date(2000, 0, 1);
this.maxDate = options['maxDate'] || new Date();
}
}
@@ -1,7 +1,6 @@
import { FormfieldBase } from './formfield-base';
export class DateTimepickerBase extends FormfieldBase {
controlType = 'datetimepicker';
minDate: Date;
maxDate: Date;
@@ -11,5 +10,4 @@ export class DateTimepickerBase extends FormfieldBase {
this.minDate = options['minDate'] || new Date(2000, 0, 1);
this.maxDate = options['maxDate'] || new Date();
}
}
@@ -1,5 +1,4 @@
export class FormfieldBase {
controlType: string;
controlName: string;
label: string;
@@ -7,20 +6,21 @@ export class FormfieldBase {
required: boolean;
order: number;
constructor(options: {
controlType?: string,
controlName?: string,
label?: string,
value?: any,
required?: boolean,
order?: number
} = {}) {
this.controlType = options.controlType || '';
this.controlName = options.controlName || '';
this.label = options.label || '';
this.value = options.value === undefined ? '' : options.value;
this.required = !!options.required;
this.order = options.order === undefined ? 1 : options.order;
constructor(
options: {
controlType?: string;
controlName?: string;
label?: string;
value?: any;
required?: boolean;
order?: number;
} = {}
) {
this.controlType = options.controlType || '';
this.controlName = options.controlName || '';
this.label = options.label || '';
this.value = options.value === undefined ? '' : options.value;
this.required = !!options.required;
this.order = options.order === undefined ? 1 : options.order;
}
}
@@ -1,7 +1,6 @@
import { FormfieldBase } from './formfield-base';
export class InputBase extends FormfieldBase {
controlType = 'input';
type: string;
@@ -9,5 +8,4 @@ export class InputBase extends FormfieldBase {
super(options);
this.type = options['type'] || 'text';
}
}
@@ -1,17 +1,15 @@
import { FormfieldBase } from './formfield-base';
export class SelectBase extends FormfieldBase {
controlType = 'select';
options: {
label: string,
value: string,
data: {}[]
label: string;
value: string;
data: {}[];
};
constructor(options: {} = {}) {
super(options);
this.options = options['options'];
}
}