mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Merge pull request #3795 from alexandrevryghem/w2p-122005_fixed-dropdown-values-resetting-on-enter_contribute-7_x
[Port dspace-7_x] Fixed dropdown/lookup & lookup-name fields being reset when hitting enter
This commit is contained in:
@@ -94,11 +94,11 @@
|
|||||||
(scrolled)="onScroll()"
|
(scrolled)="onScroll()"
|
||||||
[scrollWindow]="false">
|
[scrollWindow]="false">
|
||||||
|
|
||||||
<button class="dropdown-item disabled"
|
<button class="dropdown-item disabled" type="button"
|
||||||
*ngIf="optionsList && optionsList.length == 0"
|
*ngIf="optionsList && optionsList.length == 0"
|
||||||
(click)="$event.stopPropagation(); clearFields(); sdRef.close();">{{'form.no-results' | translate}}
|
(click)="$event.stopPropagation(); clearFields(); sdRef.close();">{{'form.no-results' | translate}}
|
||||||
</button>
|
</button>
|
||||||
<button class="dropdown-item lookup-item"
|
<button class="dropdown-item lookup-item" type="button"
|
||||||
*ngFor="let listEntry of optionsList"
|
*ngFor="let listEntry of optionsList"
|
||||||
(click)="$event.stopPropagation(); onSelect(listEntry); sdRef.close();"
|
(click)="$event.stopPropagation(); onSelect(listEntry); sdRef.close();"
|
||||||
title="{{ listEntry.display }}">
|
title="{{ listEntry.display }}">
|
||||||
|
@@ -40,18 +40,20 @@
|
|||||||
(scrolled)="onScroll()"
|
(scrolled)="onScroll()"
|
||||||
[scrollWindow]="false">
|
[scrollWindow]="false">
|
||||||
|
|
||||||
<button class="dropdown-item disabled" *ngIf="optionsList && optionsList.length === 0">{{'form.no-results' | translate}}</button>
|
<button class="dropdown-item disabled" type="button" *ngIf="optionsList && optionsList.length === 0">
|
||||||
|
{{ 'form.no-results' | translate }}
|
||||||
|
</button>
|
||||||
<button class="dropdown-item collection-item text-truncate"
|
<button class="dropdown-item collection-item text-truncate"
|
||||||
(click)="onSelect(undefined); sdRef.close()" (mousedown)="onSelect(undefined); sdRef.close()"
|
(click)="onSelect(undefined); sdRef.close()" (mousedown)="onSelect(undefined); sdRef.close()"
|
||||||
title="{{ 'dropdown.clear.tooltip' | translate }}" role="option"
|
title="{{ 'dropdown.clear.tooltip' | translate }}" role="option"
|
||||||
>
|
type="button">
|
||||||
<i>{{ 'dropdown.clear' | translate }}</i>
|
<i>{{ 'dropdown.clear' | translate }}</i>
|
||||||
</button>
|
</button>
|
||||||
<button class="dropdown-item collection-item text-truncate" *ngFor="let listEntry of optionsList; let i = index"
|
<button class="dropdown-item collection-item text-truncate" *ngFor="let listEntry of optionsList; let i = index"
|
||||||
[class.active]="i === selectedIndex"
|
[class.active]="i === selectedIndex"
|
||||||
(keydown.enter)="onSelect(listEntry); sdRef.close()" (mousedown)="onSelect(listEntry); sdRef.close()"
|
(keydown.enter)="onSelect(listEntry); sdRef.close()" (mousedown)="onSelect(listEntry); sdRef.close()"
|
||||||
title="{{ listEntry.display }}" role="option"
|
title="{{ listEntry.display }}" role="option" type="button"
|
||||||
[attr.id]="listEntry.display == (currentValue|async) ? ('combobox_' + id + '_selected') : null">
|
[attr.id]="listEntry.display === (currentValue|async) ? ('combobox_' + id + '_selected') : null">
|
||||||
{{inputFormatter(listEntry)}}
|
{{inputFormatter(listEntry)}}
|
||||||
</button>
|
</button>
|
||||||
<div class="scrollable-dropdown-loading text-center" *ngIf="loading"><p>{{'form.loading' | translate}}</p></div>
|
<div class="scrollable-dropdown-loading text-center" *ngIf="loading"><p>{{'form.loading' | translate}}</p></div>
|
||||||
|
@@ -130,6 +130,9 @@ export class FormService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public addControlErrors(field: AbstractControl, formId: string, fieldId: string, fieldIndex: number) {
|
public addControlErrors(field: AbstractControl, formId: string, fieldId: string, fieldIndex: number) {
|
||||||
|
if (field.errors === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const errors: string[] = Object.keys(field.errors)
|
const errors: string[] = Object.keys(field.errors)
|
||||||
.filter((errorKey) => field.errors[errorKey] === true)
|
.filter((errorKey) => field.errors[errorKey] === true)
|
||||||
.map((errorKey) => `error.validation.${errorKey}`);
|
.map((errorKey) => `error.validation.${errorKey}`);
|
||||||
|
Reference in New Issue
Block a user