Skip to content

Commit 5b7602f

Browse files
committed
Bring dynamic onebox suggest changes in line with 10.x
1 parent d0333fa commit 5b7602f

2 files changed

Lines changed: 40 additions & 42 deletions

File tree

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

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -36,38 +36,42 @@
3636
</ng-template>
3737

3838
@if (isSolrSuggest()) {
39-
40-
<div *ngIf="(model.vocabularyOptions?.type === 'suggest')" class="position-relative right-addon">
41-
<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>
42-
<i *ngIf="!searching && !loadingInitialValue"
43-
dsAuthorityConfidenceState
44-
class="far fa-circle fa-2x fa-fw position-absolute mt-1 p-0"
45-
aria-hidden="true"
46-
[authorityValue]="currentValue"
47-
(whenClickOnConfidenceNotAccepted)="whenClickOnConfidenceNotAccepted($event)"></i>
48-
<input #instance="ngbTypeahead"
49-
class="form-control"
50-
[attr.aria-labelledby]="'label_' + model.id"
51-
[attr.autoComplete]="model.autoComplete"
52-
[attr.aria-label]="model.label | translate"
53-
[class.is-invalid]="showErrorMessages || (this.model.errorMessages !== null)"
54-
[id]="model.id"
55-
[inputFormatter]="formatter"
56-
[name]="model.name"
57-
[ngbTypeahead]="searchSuggest"
58-
[placeholder]="model.placeholder"
59-
[readonly]="model.readOnly"
60-
[disabled]="model.readOnly"
61-
[resultTemplate]="suggestrt"
62-
[type]="model.inputType"
63-
[(ngModel)]="currentValue"
64-
(blur)="onBlur($event)"
65-
(focus)="onFocus($event)"
66-
(change)="onChange($event)"
67-
(input)="onInput($event)"
68-
(selectItem)="onSelectSuggestedTerm($event)">
69-
<div class="invalid-feedback" *ngIf="searchFailed">Sorry, suggestions could not be loaded.</div>
70-
</div>
39+
@if (model.vocabularyOptions?.type === 'suggest') {
40+
<div *ngIf="(model.vocabularyOptions?.type === 'suggest')" class="position-relative right-addon">
41+
@if (searching || loadingInitialValue) {
42+
<i class="fas fa-circle-notch fa-spin fa-2x fa-fw text-primary position-absolute mt-1 p-0" aria-hidden="true"></i>
43+
}
44+
@else {
45+
<i dsAuthorityConfidenceState
46+
class="far fa-circle fa-2x fa-fw position-absolute mt-1 p-0"
47+
aria-hidden="true"
48+
[authorityValue]="currentValue"
49+
(whenClickOnConfidenceNotAccepted)="whenClickOnConfidenceNotAccepted($event)"></i>
50+
}
51+
<input #instance="ngbTypeahead"
52+
class="form-control"
53+
[attr.aria-labelledby]="'label_' + model.id"
54+
[attr.autoComplete]="model.autoComplete"
55+
[attr.aria-label]="model.label | translate"
56+
[class.is-invalid]="showErrorMessages || (this.model.errorMessages !== null)"
57+
[id]="model.id"
58+
[inputFormatter]="formatter"
59+
[name]="model.name"
60+
[ngbTypeahead]="searchSuggest"
61+
[placeholder]="model.placeholder"
62+
[readonly]="model.readOnly"
63+
[disabled]="model.readOnly"
64+
[resultTemplate]="suggestrt"
65+
[type]="model.inputType"
66+
[(ngModel)]="currentValue"
67+
(blur)="onBlur($event)"
68+
(focus)="onFocus($event)"
69+
(change)="onChange($event)"
70+
(input)="onInput($event)"
71+
(selectItem)="onSelectSuggestedTerm($event)">
72+
<div class="invalid-feedback" *ngIf="searchFailed">Sorry, suggestions could not be loaded.</div>
73+
</div>
74+
}
7175

7276
} @else {
7377

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import {
22
AsyncPipe,
3-
NgClass,
4-
NgForOf,
5-
NgIf,
63
NgTemplateOutlet,
74
} from '@angular/common';
85
import {
@@ -86,16 +83,13 @@ import { DynamicOneboxModel } from './dynamic-onebox.model';
8683
imports: [
8784
AsyncPipe,
8885
AuthorityConfidenceStateDirective,
86+
BtnDisabledDirective,
87+
FormsModule,
88+
NgbTypeaheadModule,
8989
NgTemplateOutlet,
9090
ObjNgFor,
91-
TranslateModule,
9291
ObjNgFor,
93-
NgForOf,
94-
FormsModule,
95-
BtnDisabledDirective,
96-
NgClass,
97-
NgIf,
98-
NgbTypeaheadModule,
92+
TranslateModule,
9993
],
10094
standalone: true,
10195
})

0 commit comments

Comments
 (0)