|
|
@ -4,12 +4,10 @@ import {
|
|
|
|
Input,
|
|
|
|
Input,
|
|
|
|
Output,
|
|
|
|
Output,
|
|
|
|
EventEmitter,
|
|
|
|
EventEmitter,
|
|
|
|
ChangeDetectionStrategy,
|
|
|
|
|
|
|
|
ViewChild,
|
|
|
|
ViewChild,
|
|
|
|
ChangeDetectorRef,
|
|
|
|
ChangeDetectorRef,
|
|
|
|
AfterViewInit,
|
|
|
|
AfterViewInit,
|
|
|
|
} from '@angular/core';
|
|
|
|
} from '@angular/core';
|
|
|
|
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
@Component({
|
|
|
|
selector: 'app-cell',
|
|
|
|
selector: 'app-cell',
|
|
|
@ -33,6 +31,10 @@ export class CellComponent implements AfterViewInit {
|
|
|
|
@Input()
|
|
|
|
@Input()
|
|
|
|
set editable(value: boolean) {
|
|
|
|
set editable(value: boolean) {
|
|
|
|
this._editable = value;
|
|
|
|
this._editable = value;
|
|
|
|
|
|
|
|
if (value) {
|
|
|
|
|
|
|
|
this.input?.control?.markAsTouched();
|
|
|
|
|
|
|
|
this.checkIfValid();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
get editable(): boolean {
|
|
|
|
get editable(): boolean {
|
|
|
|
return this._editable;
|
|
|
|
return this._editable;
|
|
|
@ -82,10 +84,7 @@ export class CellComponent implements AfterViewInit {
|
|
|
|
this.checkIfValid();
|
|
|
|
this.checkIfValid();
|
|
|
|
this.cdr.detectChanges();
|
|
|
|
this.cdr.detectChanges();
|
|
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
if (this.inputType === 'Boolean' && this.editable) {
|
|
|
|
this.inputType === 'Boolean' &&
|
|
|
|
|
|
|
|
this.editable
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
setTimeout(() => {
|
|
|
|
this.change(false);
|
|
|
|
this.change(false);
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -143,9 +142,11 @@ export class CellComponent implements AfterViewInit {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
checkIfValid() {
|
|
|
|
checkIfValid() {
|
|
|
|
if (this.required && this.inputType !== 'Boolean') {
|
|
|
|
setTimeout(() => {
|
|
|
|
this.isValid = this.input?.control?.valid || false;
|
|
|
|
if (this.editable && this.required && this.inputType !== 'Boolean') {
|
|
|
|
this.validityChange.emit(this.isValid);
|
|
|
|
this.isValid = this.input?.control?.valid || false;
|
|
|
|
}
|
|
|
|
this.validityChange.emit(this.isValid);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|