mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-16 06:23:03 +00:00
Add aria-label and loadingInitialValue property to DsDynamicOneboxComponent
This commit is contained in:
@@ -21,8 +21,8 @@
|
|||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
<div *ngIf="!(isHierarchicalVocabulary() | async)" class="position-relative right-addon">
|
<div *ngIf="!(isHierarchicalVocabulary() | async)" class="position-relative right-addon">
|
||||||
<i *ngIf="searching" class="fas fa-circle-notch fa-spin fa-2x fa-fw text-primary position-absolute mt-1 p-0" aria-hidden="true"></i>
|
<i *ngIf="searching || loadingInitialValue" class="fas fa-circle-notch fa-spin fa-2x fa-fw text-primary position-absolute mt-1 p-0" aria-hidden="true"></i>
|
||||||
<i *ngIf="!searching"
|
<i *ngIf="!searching && !loadingInitialValue"
|
||||||
dsAuthorityConfidenceState
|
dsAuthorityConfidenceState
|
||||||
class="far fa-circle fa-2x fa-fw position-absolute mt-1 p-0"
|
class="far fa-circle fa-2x fa-fw position-absolute mt-1 p-0"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
@@ -32,6 +32,7 @@
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
[attr.aria-labelledby]="'label_' + model.id"
|
[attr.aria-labelledby]="'label_' + model.id"
|
||||||
[attr.autoComplete]="model.autoComplete"
|
[attr.autoComplete]="model.autoComplete"
|
||||||
|
[attr.aria-label]="model.label | translate"
|
||||||
[class.is-invalid]="showErrorMessages"
|
[class.is-invalid]="showErrorMessages"
|
||||||
[id]="model.id"
|
[id]="model.id"
|
||||||
[inputFormatter]="formatter"
|
[inputFormatter]="formatter"
|
||||||
@@ -58,6 +59,7 @@
|
|||||||
<input class="form-control"
|
<input class="form-control"
|
||||||
[attr.aria-labelledby]="'label_' + model.id"
|
[attr.aria-labelledby]="'label_' + model.id"
|
||||||
[attr.autoComplete]="model.autoComplete"
|
[attr.autoComplete]="model.autoComplete"
|
||||||
|
[attr.aria-label]="model.label | translate"
|
||||||
[class.is-invalid]="showErrorMessages"
|
[class.is-invalid]="showErrorMessages"
|
||||||
[class.tree-input]="!model.readOnly"
|
[class.tree-input]="!model.readOnly"
|
||||||
[id]="id"
|
[id]="id"
|
||||||
|
@@ -55,6 +55,7 @@ export class DsDynamicOneboxComponent extends DsDynamicVocabularyComponent imple
|
|||||||
|
|
||||||
pageInfo: PageInfo = new PageInfo();
|
pageInfo: PageInfo = new PageInfo();
|
||||||
searching = false;
|
searching = false;
|
||||||
|
loadingInitialValue = false;
|
||||||
searchFailed = false;
|
searchFailed = false;
|
||||||
hideSearchingWhenUnsubscribed$ = new Observable(() => () => this.changeSearchingStatus(false));
|
hideSearchingWhenUnsubscribed$ = new Observable(() => () => this.changeSearchingStatus(false));
|
||||||
click$ = new Subject<string>();
|
click$ = new Subject<string>();
|
||||||
@@ -151,6 +152,15 @@ export class DsDynamicOneboxComponent extends DsDynamicVocabularyComponent imple
|
|||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the loadingInitialValue status
|
||||||
|
* @param status
|
||||||
|
*/
|
||||||
|
changeLoadingInitialValueStatus(status: boolean) {
|
||||||
|
this.loadingInitialValue = status;
|
||||||
|
this.cdr.detectChanges();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if configured vocabulary is Hierarchical or not
|
* Checks if configured vocabulary is Hierarchical or not
|
||||||
*/
|
*/
|
||||||
@@ -257,8 +267,10 @@ export class DsDynamicOneboxComponent extends DsDynamicVocabularyComponent imple
|
|||||||
setCurrentValue(value: any, init = false): void {
|
setCurrentValue(value: any, init = false): void {
|
||||||
let result: string;
|
let result: string;
|
||||||
if (init) {
|
if (init) {
|
||||||
|
this.changeLoadingInitialValueStatus(true);
|
||||||
this.getInitValueFromModel()
|
this.getInitValueFromModel()
|
||||||
.subscribe((formValue: FormFieldMetadataValueObject) => {
|
.subscribe((formValue: FormFieldMetadataValueObject) => {
|
||||||
|
this.changeLoadingInitialValueStatus(false);
|
||||||
this.currentValue = formValue;
|
this.currentValue = formValue;
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user