31 lines
1012 B
TypeScript
31 lines
1012 B
TypeScript
|
import {Component, Input, OnInit} from '@angular/core';
|
||
|
import {Step} from '../step';
|
||
|
import {Converter} from '../converter/converter';
|
||
|
import {ConverterRegistryService} from '../converter-registry.service';
|
||
|
import {TextInputFieldComponent} from '../text-input-field/text-input-field.component';
|
||
|
|
||
|
@Component({
|
||
|
selector: 'app-converter-selector',
|
||
|
templateUrl: './converter-selector.component.html',
|
||
|
styleUrls: ['./converter-selector.component.scss']
|
||
|
})
|
||
|
export class ConverterSelectorComponent implements OnInit {
|
||
|
@Input()
|
||
|
public step: Step;
|
||
|
@Input()
|
||
|
private textInput: TextInputFieldComponent;
|
||
|
public converters: Converter[] = [];
|
||
|
|
||
|
constructor(private converterRegistryService: ConverterRegistryService) {
|
||
|
}
|
||
|
|
||
|
convert(step: Step, $event: any): void {
|
||
|
step.selectedConverter = this.converterRegistryService.getConverter($event.target.selectedOptions[0].id);
|
||
|
this.textInput.update(step);
|
||
|
}
|
||
|
|
||
|
ngOnInit() {
|
||
|
this.converters = this.converterRegistryService.getAllConverters();
|
||
|
}
|
||
|
}
|