|
| 1 | +<ng-template #suggestrt let-listEntry="result" let-t="term"> |
| 2 | + <ng-container |
| 3 | + [ngTemplateOutlet]="suggestrte" |
| 4 | + [ngTemplateOutletContext]="{entry: listEntry}"> |
| 5 | + </ng-container> |
| 6 | +</ng-template> |
| 7 | + |
| 8 | +<ng-template #suggestrte let-entry="entry"> |
| 9 | + <ul class="list-unstyled mb=0"> |
| 10 | + <li class="list-item text-truncate text-primary" [innerHTML]="(entry.term + ' (' + entry.weight + ')')"></li> |
| 11 | + </ul> |
| 12 | +</ng-template> |
| 13 | + |
1 | 14 | <ng-template #rt let-listEntry="result" let-t="term"> |
2 | 15 | <ng-container |
3 | 16 | [ngTemplateOutlet]="(listEntry.hasOtherInformation()) ? hasInfo : noInfo" |
|
22 | 35 | </ul> |
23 | 36 | </ng-template> |
24 | 37 |
|
25 | | -@if ((isHierarchicalVocabulary() | async) !== true) { |
26 | | - <div class="position-relative right-addon"> |
27 | | - @if (searching || loadingInitialValue) { |
28 | | - <i class="fas fa-circle-notch fa-spin fa-2x fa-fw text-primary position-absolute mt-1 p-0" aria-hidden="true"></i> |
29 | | - } |
30 | | - @if (!searching && !loadingInitialValue) { |
31 | | - <i |
32 | | - dsAuthorityConfidenceState |
33 | | - class="far fa-circle fa-2x fa-fw position-absolute mt-1 p-0" |
34 | | - aria-hidden="true" |
35 | | - [authorityValue]="currentValue" |
36 | | - (whenClickOnConfidenceNotAccepted)="whenClickOnConfidenceNotAccepted($event)"></i> |
37 | | - } |
| 38 | +@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> |
38 | 48 | <input #instance="ngbTypeahead" |
39 | | - class="form-control" |
40 | | - [attr.aria-labelledby]="'label_' + model.id" |
41 | | - [attr.autoComplete]="model.autoComplete" |
42 | | - [attr.aria-label]="model.label | translate" |
43 | | - [class.is-invalid]="showErrorMessages" |
44 | | - [id]="model.id" |
45 | | - [inputFormatter]="formatter" |
46 | | - [name]="model.name" |
47 | | - [ngbTypeahead]="search" |
48 | | - [placeholder]="model.placeholder" |
49 | | - [readonly]="model.readOnly" |
50 | | - [disabled]="model.readOnly" |
51 | | - [resultTemplate]="rt" |
52 | | - [type]="model.inputType" |
53 | | - [(ngModel)]="currentValue" |
54 | | - (blur)="onBlur($event)" |
55 | | - (focus)="onFocus($event)" |
56 | | - (change)="onChange($event)" |
57 | | - (input)="onInput($event)" |
58 | | - (selectItem)="onSelectItem($event)"> |
59 | | - @if (searchFailed) { |
60 | | - <div class="invalid-feedback">Sorry, suggestions could not be loaded.</div> |
61 | | - } |
| 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> |
62 | 70 | </div> |
63 | | -} |
64 | 71 |
|
65 | | -@if ((isHierarchicalVocabulary() | async)) { |
66 | | - <div class="position-relative right-addon"> |
67 | | - <i class="dropdown-toggle position-absolute tree-toggle" (click)="openTree($event)" |
68 | | - aria-hidden="true"></i> |
69 | | - <input 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 | | - [class.tree-input]="!model.readOnly" |
75 | | - [id]="id" |
76 | | - [name]="model.name" |
77 | | - [placeholder]="model.placeholder" |
78 | | - [readonly]="true" |
79 | | - [disabled]="model.readOnly" |
80 | | - [type]="model.inputType" |
81 | | - [value]="currentValue?.display" |
82 | | - (focus)="onFocus($event)" |
83 | | - (change)="onChange($event)" |
84 | | - (click)="openTree($event)" |
85 | | - (keydown)="$event.preventDefault()" |
86 | | - (keypress)="$event.preventDefault()" |
87 | | - (keyup)="$event.preventDefault()"> |
88 | | - </div> |
| 72 | +} @else { |
| 73 | + |
| 74 | + @if ((isHierarchicalVocabulary() | async) !== true) { |
| 75 | + <div class="position-relative right-addon"> |
| 76 | + @if (searching || loadingInitialValue) { |
| 77 | + <i class="fas fa-circle-notch fa-spin fa-2x fa-fw text-primary position-absolute mt-1 p-0" aria-hidden="true"></i> |
| 78 | + } |
| 79 | + @if (!searching && !loadingInitialValue) { |
| 80 | + <i |
| 81 | + dsAuthorityConfidenceState |
| 82 | + class="far fa-circle fa-2x fa-fw position-absolute mt-1 p-0" |
| 83 | + aria-hidden="true" |
| 84 | + [authorityValue]="currentValue" |
| 85 | + (whenClickOnConfidenceNotAccepted)="whenClickOnConfidenceNotAccepted($event)"></i> |
| 86 | + } |
| 87 | + <input #instance="ngbTypeahead" |
| 88 | + class="form-control" |
| 89 | + [attr.aria-labelledby]="'label_' + model.id" |
| 90 | + [attr.autoComplete]="model.autoComplete" |
| 91 | + [attr.aria-label]="model.label | translate" |
| 92 | + [class.is-invalid]="showErrorMessages" |
| 93 | + [id]="model.id" |
| 94 | + [inputFormatter]="formatter" |
| 95 | + [name]="model.name" |
| 96 | + [ngbTypeahead]="search" |
| 97 | + [placeholder]="model.placeholder" |
| 98 | + [readonly]="model.readOnly" |
| 99 | + [disabled]="model.readOnly" |
| 100 | + [resultTemplate]="rt" |
| 101 | + [type]="model.inputType" |
| 102 | + [(ngModel)]="currentValue" |
| 103 | + (blur)="onBlur($event)" |
| 104 | + (focus)="onFocus($event)" |
| 105 | + (change)="onChange($event)" |
| 106 | + (input)="onInput($event)" |
| 107 | + (selectItem)="onSelectItem($event)"> |
| 108 | + @if (searchFailed) { |
| 109 | + <div class="invalid-feedback">Sorry, suggestions could not be loaded.</div> |
| 110 | + } |
| 111 | + </div> |
| 112 | + } |
| 113 | + |
| 114 | + @if ((isHierarchicalVocabulary() | async)) { |
| 115 | + <div class="position-relative right-addon"> |
| 116 | + <i class="dropdown-toggle position-absolute tree-toggle" (click)="openTree($event)" |
| 117 | + aria-hidden="true"></i> |
| 118 | + <input class="form-control" |
| 119 | + [attr.aria-labelledby]="'label_' + model.id" |
| 120 | + [attr.autoComplete]="model.autoComplete" |
| 121 | + [attr.aria-label]="model.label | translate" |
| 122 | + [class.is-invalid]="showErrorMessages" |
| 123 | + [class.tree-input]="!model.readOnly" |
| 124 | + [id]="id" |
| 125 | + [name]="model.name" |
| 126 | + [placeholder]="model.placeholder" |
| 127 | + [readonly]="true" |
| 128 | + [disabled]="model.readOnly" |
| 129 | + [type]="model.inputType" |
| 130 | + [value]="currentValue?.display" |
| 131 | + (focus)="onFocus($event)" |
| 132 | + (change)="onChange($event)" |
| 133 | + (click)="openTree($event)" |
| 134 | + (keydown)="$event.preventDefault()" |
| 135 | + (keypress)="$event.preventDefault()" |
| 136 | + (keyup)="$event.preventDefault()"> |
| 137 | + </div> |
| 138 | + } |
89 | 139 | } |
0 commit comments