|
1 | | -<ng-template #rt let-listEntry="result" let-t="term"> |
2 | | - <ng-container |
3 | | - [ngTemplateOutlet]="(listEntry.hasOtherInformation()) ? hasInfo : noInfo" |
4 | | - [ngTemplateOutletContext]="{entry: listEntry}"> |
5 | | - </ng-container> |
6 | | -</ng-template> |
7 | | - |
8 | | -<ng-template #hasInfo let-entry="entry"> |
| 1 | +<ng-template #rt let-listEntry="result"> |
9 | 2 | <ul class="list-unstyled mb-0"> |
10 | | - <li class="list-item text-truncate text-primary fw-bold">{{entry.value}}</li> |
11 | | - @for (item of entry.otherInformation | dsObjNgFor; track item) { |
12 | | - <li class="list-item text-truncate text-secondary" > |
13 | | - {{ 'form.other-information.' + item.key | translate }} : {{item.value}} |
14 | | - </li> |
| 3 | + @if (listEntry.display) { |
| 4 | + <li |
| 5 | + class="list-item text-truncate text-primary" |
| 6 | + [innerHtml]="listEntry.display"> |
| 7 | + </li> |
| 8 | + } @else { |
| 9 | + <li class="list-item text-truncate text-primary fw-bold"> |
| 10 | + {{listEntry.value}} |
| 11 | + </li> |
15 | 12 | } |
16 | | - </ul> |
17 | | -</ng-template> |
18 | 13 |
|
19 | | -<ng-template #noInfo let-entry="entry"> |
20 | | - <ul class="list-unstyled mb-0"> |
21 | | - <li class="list-item text-truncate text-primary fw-bold">{{entry.value}}</li> |
| 14 | + @if (listEntry.hasOtherInformation()) { |
| 15 | + @for (item of listEntry.otherInformation | dsObjNgFor; track item.key) { |
| 16 | + |
| 17 | + <li class="list-item text-truncate text-secondary" > |
| 18 | + {{ 'form.other-information.' + item.key | translate }} : {{item.value}} |
| 19 | + </li> |
| 20 | + |
| 21 | + }} |
22 | 22 | </ul> |
23 | 23 | </ng-template> |
24 | 24 |
|
25 | | -@if ((isHierarchicalVocabulary() | async) !== true) { |
26 | | - <div class="position-relative right-addon"> |
27 | | - <div class="authority-icons position-absolute d-flex align-items-center"> |
28 | | - @if (searching || loadingInitialValue) { |
29 | | - <i class="fas fa-circle-notch fa-spin fa-2x fa-fw text-primary my-auto p-0" aria-hidden="true"></i> |
30 | | - } |
31 | | - @if (!searching && !loadingInitialValue) { |
32 | | - <i |
33 | | - dsAuthorityConfidenceState |
34 | | - class="far fa-circle fa-2x fa-fw my-auto p-0" |
35 | | - aria-hidden="true" |
36 | | - [authorityValue]="currentValue" |
37 | | - (whenClickOnConfidenceNotAccepted)="whenClickOnConfidenceNotAccepted($event)"></i> |
38 | | - } |
39 | | - </div> |
40 | | - <input #instance="ngbTypeahead" |
41 | | - class="form-control" |
42 | | - [attr.aria-labelledby]="'label_' + model.id" |
43 | | - [attr.autoComplete]="model.autoComplete" |
44 | | - [attr.aria-label]="model.label | translate" |
45 | | - [class.is-invalid]="showErrorMessages" |
46 | | - [id]="model.id" |
47 | | - [inputFormatter]="formatter" |
48 | | - [name]="model.name" |
49 | | - [ngbTypeahead]="search" |
50 | | - [placeholder]="model.placeholder" |
51 | | - [readonly]="model.readOnly" |
52 | | - [disabled]="model.readOnly" |
53 | | - [resultTemplate]="rt" |
54 | | - [type]="model.inputType" |
55 | | - [(ngModel)]="currentValue" |
56 | | - (blur)="onBlur($event)" |
57 | | - (focus)="onFocus($event)" |
58 | | - (change)="onChange($event)" |
59 | | - (input)="onInput($event)" |
60 | | - (selectItem)="onSelectItem($event)"> |
61 | | - @if (searchFailed) { |
62 | | - <div class="invalid-feedback">Sorry, suggestions could not be loaded.</div> |
63 | | - } |
64 | | - </div> |
65 | | -} |
| 25 | +<div class="position-relative right-addon"> |
| 26 | + |
| 27 | + @if ((vocabulary$ | async)?.hierarchical) { |
| 28 | + |
| 29 | + <i class="dropdown-toggle position-absolute tree-toggle" (click)="openTree($event)" |
| 30 | + aria-hidden="true"></i> |
| 31 | + <input class="form-control" |
| 32 | + [attr.aria-labelledby]="'label_' + model.id" |
| 33 | + [attr.autoComplete]="model.autoComplete" |
| 34 | + [attr.aria-label]="model.label | translate" |
| 35 | + [class.is-invalid]="showErrorMessages" |
| 36 | + [class.tree-input]="!model.readOnly" |
| 37 | + [id]="id" |
| 38 | + [name]="model.name" |
| 39 | + [placeholder]="model.placeholder" |
| 40 | + [readonly]="true" |
| 41 | + [disabled]="model.readOnly" |
| 42 | + [type]="model.inputType" |
| 43 | + [value]="currentValue?.display" |
| 44 | + (focus)="onFocus($event)" |
| 45 | + (change)="onChange($event)" |
| 46 | + (click)="openTree($event)" |
| 47 | + (keydown)="$event.preventDefault()" |
| 48 | + (keypress)="$event.preventDefault()" |
| 49 | + (keyup)="$event.preventDefault()"> |
| 50 | + |
| 51 | + } @else { |
| 52 | + |
| 53 | + @if (loading) { |
| 54 | + <i |
| 55 | + class="fas fa-circle-notch fa-spin fa-2x fa-fw text-primary position-absolute mt-1 p-0" |
| 56 | + aria-hidden="true"> |
| 57 | + </i> |
| 58 | + } @else { |
| 59 | + <i |
| 60 | + dsAuthorityConfidenceState |
| 61 | + class="far fa-circle fa-2x fa-fw position-absolute mt-1 p-0" |
| 62 | + aria-hidden="true" |
| 63 | + [authorityValue]="currentValue" |
| 64 | + (whenClickOnConfidenceNotAccepted)="whenClickOnConfidenceNotAccepted($event)"> |
| 65 | + </i> |
| 66 | + } |
| 67 | + |
| 68 | + <input #typeahead="ngbTypeahead" |
| 69 | + class="form-control" |
| 70 | + [attr.aria-labelledby]="'label_' + model.id" |
| 71 | + [attr.autoComplete]="model.autoComplete" |
| 72 | + [attr.aria-label]="model.label | translate" |
| 73 | + [class.is-invalid]="showErrorMessages" |
| 74 | + [id]="model.id" |
| 75 | + [name]="model.name" |
| 76 | + [ngbTypeahead]="search" |
| 77 | + [placeholder]="model.placeholder" |
| 78 | + [readonly]="model.readOnly" |
| 79 | + [disabled]="model.readOnly" |
| 80 | + [resultTemplate]="rt" |
| 81 | + [type]="model.inputType" |
| 82 | + [(ngModel)]="currentValue" |
| 83 | + (blur)="onBlur($event)" |
| 84 | + (focus)="onFocus($event)" |
| 85 | + (change)="onChange($event)" |
| 86 | + (input)="onInput($event)" |
| 87 | + (selectItem)="onSelectItem($event)"> |
| 88 | + |
| 89 | + @if (searchFailed) { |
| 90 | + <div class="invalid-feedback">Sorry, suggestions could not be loaded.</div> |
| 91 | + } |
66 | 92 |
|
67 | | -@if ((isHierarchicalVocabulary() | async)) { |
68 | | - <div class="position-relative right-addon"> |
69 | | - <i class="dropdown-toggle position-absolute tree-toggle" (click)="openTree($event)" |
70 | | - aria-hidden="true"></i> |
71 | | - <input class="form-control" |
72 | | - [attr.aria-labelledby]="'label_' + model.id" |
73 | | - [attr.autoComplete]="model.autoComplete" |
74 | | - [attr.aria-label]="model.label | translate" |
75 | | - [class.is-invalid]="showErrorMessages" |
76 | | - [class.tree-input]="!model.readOnly" |
77 | | - [id]="id" |
78 | | - [name]="model.name" |
79 | | - [placeholder]="model.placeholder" |
80 | | - [readonly]="true" |
81 | | - [disabled]="model.readOnly" |
82 | | - [type]="model.inputType" |
83 | | - [value]="currentValue?.display" |
84 | | - (focus)="onFocus($event)" |
85 | | - (change)="onChange($event)" |
86 | | - (click)="openTree($event)" |
87 | | - (keydown)="$event.preventDefault()" |
88 | | - (keypress)="$event.preventDefault()" |
89 | | - (keyup)="$event.preventDefault()"> |
90 | | - </div> |
91 | | -} |
| 93 | + } |
| 94 | +</div> |
0 commit comments