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