Skip to content

Commit c596c6e

Browse files
committed
Add aria-label and loadingInitialValue property to DsDynamicOneboxComponent
1 parent 8d25ba7 commit c596c6e

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
</ng-template>
2222

2323
<div *ngIf="!(isHierarchicalVocabulary() | async)" class="position-relative right-addon">
24-
<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>
25-
<i *ngIf="!searching"
24+
<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>
25+
<i *ngIf="!searching && !loadingInitialValue"
2626
dsAuthorityConfidenceState
2727
class="far fa-circle fa-2x fa-fw position-absolute mt-1 p-0"
2828
aria-hidden="true"
@@ -32,6 +32,7 @@
3232
class="form-control"
3333
[attr.aria-labelledby]="'label_' + model.id"
3434
[attr.autoComplete]="model.autoComplete"
35+
[attr.aria-label]="model.label | translate"
3536
[class.is-invalid]="showErrorMessages"
3637
[id]="model.id"
3738
[inputFormatter]="formatter"
@@ -58,6 +59,7 @@
5859
<input class="form-control"
5960
[attr.aria-labelledby]="'label_' + model.id"
6061
[attr.autoComplete]="model.autoComplete"
62+
[attr.aria-label]="model.label | translate"
6163
[class.is-invalid]="showErrorMessages"
6264
[class.tree-input]="!model.readOnly"
6365
[id]="id"

src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export class DsDynamicOneboxComponent extends DsDynamicVocabularyComponent imple
5555

5656
pageInfo: PageInfo = new PageInfo();
5757
searching = false;
58+
loadingInitialValue = false;
5859
searchFailed = false;
5960
hideSearchingWhenUnsubscribed$ = new Observable(() => () => this.changeSearchingStatus(false));
6061
click$ = new Subject<string>();
@@ -151,6 +152,15 @@ export class DsDynamicOneboxComponent extends DsDynamicVocabularyComponent imple
151152
this.cdr.detectChanges();
152153
}
153154

155+
/**
156+
* Changes the loadingInitialValue status
157+
* @param status
158+
*/
159+
changeLoadingInitialValueStatus(status: boolean) {
160+
this.loadingInitialValue = status;
161+
this.cdr.detectChanges();
162+
}
163+
154164
/**
155165
* Checks if configured vocabulary is Hierarchical or not
156166
*/
@@ -257,8 +267,10 @@ export class DsDynamicOneboxComponent extends DsDynamicVocabularyComponent imple
257267
setCurrentValue(value: any, init = false): void {
258268
let result: string;
259269
if (init) {
270+
this.changeLoadingInitialValueStatus(true);
260271
this.getInitValueFromModel()
261272
.subscribe((formValue: FormFieldMetadataValueObject) => {
273+
this.changeLoadingInitialValueStatus(false);
262274
this.currentValue = formValue;
263275
this.cdr.detectChanges();
264276
});

0 commit comments

Comments
 (0)