Seperated DateRange Inputs
parent
3f4a01e2a6
commit
183b534775
@ -1,25 +1,38 @@
|
|||||||
<mat-form-field *ngIf="editable || label; else stringValue">
|
<div class="dateRange-wrapper" *ngIf="editable || label; else stringValue" [formGroup]="dateRangeGroup">
|
||||||
<mat-label *ngIf="label">{{label}}</mat-label>
|
<mat-label *ngIf="label">{{ label }}</mat-label>
|
||||||
<mat-date-range-input [rangePicker]="picker" disabled class="date-range-input">
|
<mat-form-field class="date-range-input">
|
||||||
<input
|
<input
|
||||||
matStartDate
|
matInput
|
||||||
placeholder="Startdatum"
|
placeholder="Startdatum"
|
||||||
|
[matDatepicker]="fromPicker"
|
||||||
[value]="from"
|
[value]="from"
|
||||||
|
disabled
|
||||||
|
formControlName="from"
|
||||||
(dateChange)="startDateChange($event)"
|
(dateChange)="startDateChange($event)"
|
||||||
/>
|
/>
|
||||||
|
<mat-datepicker-toggle matSuffix [for]="fromPicker"></mat-datepicker-toggle>
|
||||||
|
<mat-datepicker #fromPicker [disabled]="!editable"></mat-datepicker>
|
||||||
|
</mat-form-field>
|
||||||
|
<i class="spacer-string">bis</i>
|
||||||
|
<mat-form-field class="date-range-input">
|
||||||
<input
|
<input
|
||||||
matEndDate
|
matInput
|
||||||
placeholder="Enddatum"
|
placeholder="Enddatum"
|
||||||
|
[matDatepicker]="toPicker"
|
||||||
[value]="to"
|
[value]="to"
|
||||||
|
disabled
|
||||||
|
formControlName="to"
|
||||||
(dateChange)="endDateChange($event)"
|
(dateChange)="endDateChange($event)"
|
||||||
/>
|
/>
|
||||||
</mat-date-range-input>
|
<button mat-button *ngIf="editable && to" matSuffix mat-icon-button aria-label="Clear" (click)="endDateChange({value: null})">
|
||||||
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
|
<mat-icon>close</mat-icon>
|
||||||
<mat-date-range-picker
|
</button>
|
||||||
#picker
|
<mat-datepicker-toggle matSuffix [for]="toPicker"></mat-datepicker-toggle>
|
||||||
[disabled]="!editable"
|
<mat-datepicker #toPicker [disabled]="!editable"></mat-datepicker>
|
||||||
></mat-date-range-picker>
|
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<ng-template #stringValue>
|
</div>
|
||||||
<div class="date-string">{{toLocaleDate(from)}} <i>bis</i> {{toLocaleDate(to)}}</div>
|
<ng-template #stringValue>
|
||||||
</ng-template>
|
<div class="date-string">
|
||||||
|
{{ toLocaleDate(from) }} <i>bis</i> {{ toLocaleDate(to) }}
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
.date-range-input {
|
.dateRange-wrapper {
|
||||||
min-width: 11em;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.spacer-string {
|
||||||
|
margin: 0 0.5em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.date-string {
|
.date-string {
|
||||||
min-width: 10em;
|
min-width: 10em;
|
||||||
|
Loading…
Reference in New Issue