RED-5445: emit event when date picker is opened/closed

This commit is contained in:
Valentin Mihai 2023-02-26 19:38:53 +02:00
parent d9a92992c3
commit cdfd0b59b4
2 changed files with 12 additions and 2 deletions

View File

@ -14,7 +14,7 @@
<mat-datepicker-toggle [for]="picker" matSuffix>
<mat-icon matDatepickerToggleIcon svgIcon="red:calendar"></mat-icon>
</mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
<mat-datepicker #picker (closed)="onCloseDatepicker()" (opened)="onOpenDatepicker()"></mat-datepicker>
</ng-container>
<input

View File

@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
import { NG_VALIDATORS, NG_VALUE_ACCESSOR } from '@angular/forms';
import { FormFieldComponent } from '../form-field/form-field-component.directive';
@ -46,6 +46,8 @@ export class DynamicInputComponent extends FormFieldComponent<DynamicInput> {
@Input() input!: DynamicInput;
@Output() closedDatepicker = new EventEmitter<boolean>();
get isDate() {
return this.type === InputTypes.DATE;
}
@ -61,4 +63,12 @@ export class DynamicInputComponent extends FormFieldComponent<DynamicInput> {
writeValue(input: DynamicInput): void {
this.input = input;
}
onCloseDatepicker() {
this.closedDatepicker.emit(true);
}
onOpenDatepicker() {
this.closedDatepicker.emit(false);
}
}