[SDC-29] rebase continue work to align source
[sdc.git] / catalog-ui / src / app / ng2 / components / inputs-table / inputs-table.component.ts
1 /**
2  * Created by rc2122 on 5/4/2017.
3  */
4 import {Component, Input, Output, EventEmitter, ViewChild} from "@angular/core";
5 import {InputFEModel} from "app/models";
6 import {ConfirmationDeleteInputComponent} from "./confirmation-delete-input/confirmation-delete-input.component";
7
8 @Component({
9     selector: 'inputs-table',
10     templateUrl: './inputs-table.component.html',
11     styleUrls: ['../inputs-table/inputs-table.component.less']
12 })
13 export class InputsTableComponent {
14
15     @Input() inputs: Array<InputFEModel>;
16     @Input() readonly:boolean;
17     @Input() isLoading:boolean;
18     @Output() inputValueChanged: EventEmitter<any> = new EventEmitter<any>();
19     @Output() deleteInput: EventEmitter<any> = new EventEmitter<any>();
20     @ViewChild ('deleteInputConfirmation') deleteInputConfirmation:ConfirmationDeleteInputComponent;
21
22     selectedInputToDelete:InputFEModel;
23
24     constructor (){
25     }
26
27     onInputValueChanged = (input) => {
28         this.inputValueChanged.emit(input);
29     };
30
31     onDeleteInput = () => {
32         this.deleteInput.emit(this.selectedInputToDelete);
33     };
34
35     openDeleteModal = (input:InputFEModel) => {
36         this.selectedInputToDelete = input;
37         this.deleteInputConfirmation.openModal();
38     }
39 }
40
41