mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
[ADF-2997] The meaning of the range fields is not clear (#3338)
* [ADF-2997] restrict 'to' field not to allow dates in the future * [ADF-2997] more clear labels for start and end date fields the translation team will decide what will be the best values for the date fields
This commit is contained in:
parent
9e3a4aa49f
commit
4e70a116eb
@ -182,8 +182,8 @@
|
|||||||
"RANGE": {
|
"RANGE": {
|
||||||
"FROM": "From",
|
"FROM": "From",
|
||||||
"TO": "To",
|
"TO": "To",
|
||||||
"FROM-DATE": "Choose a date",
|
"FROM-DATE": "From",
|
||||||
"TO-DATE": "Choose a date"
|
"TO-DATE": "To"
|
||||||
},
|
},
|
||||||
"VALIDATION": {
|
"VALIDATION": {
|
||||||
"REQUIRED-VALUE": "Required value",
|
"REQUIRED-VALUE": "Required value",
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<input matInput [formControl]="from" [errorStateMatcher]="matcher"
|
<input matInput [formControl]="from" [errorStateMatcher]="matcher"
|
||||||
placeholder="{{ 'SEARCH.FILTER.RANGE.FROM-DATE' | translate }}"
|
placeholder="{{ 'SEARCH.FILTER.RANGE.FROM-DATE' | translate }}"
|
||||||
[matDatepicker]="fromDatepicker"
|
[matDatepicker]="fromDatepicker"
|
||||||
[max]="maxFrom"
|
[max]="maxDate"
|
||||||
(focusout)="onChangedHandler($event, from)">
|
(focusout)="onChangedHandler($event, from)">
|
||||||
<mat-datepicker-toggle matSuffix [for]="fromDatepicker"></mat-datepicker-toggle>
|
<mat-datepicker-toggle matSuffix [for]="fromDatepicker"></mat-datepicker-toggle>
|
||||||
<mat-datepicker #fromDatepicker></mat-datepicker>
|
<mat-datepicker #fromDatepicker></mat-datepicker>
|
||||||
@ -20,6 +20,7 @@
|
|||||||
placeholder="{{ 'SEARCH.FILTER.RANGE.TO-DATE' | translate }}"
|
placeholder="{{ 'SEARCH.FILTER.RANGE.TO-DATE' | translate }}"
|
||||||
[matDatepicker]="toDatepicker"
|
[matDatepicker]="toDatepicker"
|
||||||
[min]="from.value"
|
[min]="from.value"
|
||||||
|
[max]="maxDate"
|
||||||
(focusout)="onChangedHandler($event, to)">
|
(focusout)="onChangedHandler($event, to)">
|
||||||
<mat-datepicker-toggle matSuffix [for]="toDatepicker"></mat-datepicker-toggle>
|
<mat-datepicker-toggle matSuffix [for]="toDatepicker"></mat-datepicker-toggle>
|
||||||
<mat-datepicker #toDatepicker></mat-datepicker>
|
<mat-datepicker #toDatepicker></mat-datepicker>
|
||||||
@ -29,6 +30,9 @@
|
|||||||
<mat-error *ngIf="to.hasError('matDatepickerMin')">
|
<mat-error *ngIf="to.hasError('matDatepickerMin')">
|
||||||
{{ 'SEARCH.FILTER.VALIDATION.NO-DAYS' | translate }}
|
{{ 'SEARCH.FILTER.VALIDATION.NO-DAYS' | translate }}
|
||||||
</mat-error>
|
</mat-error>
|
||||||
|
<mat-error *ngIf="to.hasError('matDatepickerMax')">
|
||||||
|
{{ 'SEARCH.FILTER.VALIDATION.BEYOND-MAX-DATE' | translate }}
|
||||||
|
</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<div class="facet-buttons">
|
<div class="facet-buttons">
|
||||||
|
@ -69,7 +69,7 @@ export class SearchDateRangeComponent implements SearchWidget, OnInit {
|
|||||||
id: string;
|
id: string;
|
||||||
settings?: SearchWidgetSettings;
|
settings?: SearchWidgetSettings;
|
||||||
context?: SearchQueryBuilderService;
|
context?: SearchQueryBuilderService;
|
||||||
maxFrom: any;
|
maxDate: any;
|
||||||
datePickerDateFormat = DEFAULT_FORMAT_DATE;
|
datePickerDateFormat = DEFAULT_FORMAT_DATE;
|
||||||
|
|
||||||
constructor(private dateAdapter: DateAdapter<Moment>,
|
constructor(private dateAdapter: DateAdapter<Moment>,
|
||||||
@ -99,7 +99,7 @@ export class SearchDateRangeComponent implements SearchWidget, OnInit {
|
|||||||
to: this.to
|
to: this.to
|
||||||
});
|
});
|
||||||
|
|
||||||
this.maxFrom = moment().startOf('day');
|
this.maxDate = moment().startOf('day');
|
||||||
}
|
}
|
||||||
|
|
||||||
apply(model: { from: string, to: string }, isValid: boolean) {
|
apply(model: { from: string, to: string }, isValid: boolean) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user