Add cell component
parent
4a466a9531
commit
ac6af032f2
@ -0,0 +1,6 @@
|
||||
<mat-form-field *ngIf="editable; else nonEditableText">
|
||||
<input matInput [type]="inputType" [ngModel]="value" (ngModelChange)="change($event)"/>
|
||||
</mat-form-field>
|
||||
<ng-template #nonEditableText>
|
||||
{{ value }}
|
||||
</ng-template>
|
@ -0,0 +1,21 @@
|
||||
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-string-cell',
|
||||
templateUrl: './string-cell.component.html',
|
||||
styleUrls: ['./string-cell.component.scss'],
|
||||
})
|
||||
export class StringCellComponent {
|
||||
@Input()
|
||||
value: number | string;
|
||||
@Output() valueChange = new EventEmitter<number | string>();
|
||||
@Input()
|
||||
editable = false;
|
||||
@Input()
|
||||
inputType = 'text';
|
||||
|
||||
change(newValue) {
|
||||
this.value = newValue;
|
||||
this.valueChange.emit(newValue);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue