All files / src/app/shared/components/search/search-box search-box.component.html

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 663x                                                                                                                                  
<div class="search clearfix">
  <input
    #searchInput
    [placeholder]="configuration?.placeholder || ''"
    autocomplete="off"
    type="search"
    class="form-control searchTerm"
    (input)="searchSuggest($event.target)"
    [value]="inputSearchTerms$ | async"
    (blur)="blur()"
    (keydown)="focus()"
    (keydown.esc)="blur()"
    (keydown.arrowleft)="selectSuggestedTerm(-1)"
    (keydown.arrowright)="selectSuggestedTerm(-1)"
    (keydown.arrowdown)="selectSuggestedTerm(activeIndex + 1)"
    (keydown.arrowup)="selectSuggestedTerm(activeIndex - 1)"
    (keydown.enter)="submitSearch(searchInput.value)"
  />
 
  <div class="buttons">
    <button
      *ngIf="inputSearchTerms$ | async"
      class="btn-reset btn btn-primary"
      type="reset"
      name="reset"
      [title]="'search.searchbox.button.reset.title' | translate"
      style="right: 40px"
      (click)="searchSuggest(''); searchInput.focus()"
    >
      <fa-icon [icon]="['fas', 'times-circle']" />
    </button>
 
    <button
      class="btn-search btn btn-primary"
      type="submit"
      name="search"
      [title]="'search.searchbox.button.title' | translate"
      (click)="submitSearch(searchInput.value)"
    >
      <!-- search button with icon -->
      <ng-container *ngIf="!configuration?.buttonText; else textBlock">
        <fa-icon [icon]="['fas', usedIcon]" />
      </ng-container>
      <!-- search button with text -->
      <ng-template #textBlock> {{ configuration?.buttonText }} </ng-template>
    </button>
  </div>
 
  <ng-container *ngIf="searchResults$ | async as results">
    <ul *ngIf="results.length && inputFocused" class="search-suggest-results">
      <li
        *ngFor="let result of results | slice : 0 : configuration?.maxAutoSuggests; let liIndex = index"
        [class.active-suggestion]="activeIndex === liIndex"
        (mousedown)="submitSearch(result.term)"
        (mouseenter)="activeIndex = liIndex"
      >
        <button
          type="button"
          class="search-result"
          [innerHTML]="result.term | titlecase | ishHighlight : (inputSearchTerms$ | async)"
        ></button>
      </li>
    </ul>
  </ng-container>
</div>