mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
* configurable animation * bind state attribute to value * configure animation state based on direction * update tests * lint * direction style
82 lines
3.8 KiB
HTML
82 lines
3.8 KiB
HTML
<div class="adf-search-container" [attr.state]="subscriptAnimationState.value">
|
|
<div *ngIf="isLoggedIn()" [@transitionMessages]="subscriptAnimationState"
|
|
(@transitionMessages.done)="applySearchFocus($event)">
|
|
<button mat-icon-button
|
|
*ngIf="expandable"
|
|
id="adf-search-button"
|
|
class="adf-search-button"
|
|
[title]="'SEARCH.BUTTON.TOOLTIP' | translate"
|
|
(click)="toggleSearchBar()"
|
|
(keyup.enter)="toggleSearchBar()">
|
|
<mat-icon [attr.aria-label]="'SEARCH.BUTTON.ARIA-LABEL' | translate">search</mat-icon>
|
|
</button>
|
|
<mat-form-field class="adf-input-form-field-divider">
|
|
<input matInput
|
|
#searchInput
|
|
[attr.aria-label]="'SEARCH.INPUT.ARIA-LABEL' | translate"
|
|
[attr.type]="inputType"
|
|
[autocomplete]="getAutoComplete()"
|
|
id="adf-control-input"
|
|
[(ngModel)]="searchTerm"
|
|
(focus)="activateToolbar()"
|
|
(blur)="onBlur($event)"
|
|
(keyup.escape)="toggleSearchBar()"
|
|
(keyup.arrowdown)="selectFirstResult()"
|
|
(ngModelChange)="inputChange($event)"
|
|
[searchAutocomplete]="auto"
|
|
(keyup.enter)="searchSubmit($event)">
|
|
</mat-form-field>
|
|
</div>
|
|
</div>
|
|
|
|
<adf-search #search
|
|
#auto="searchAutocomplete"
|
|
class="adf-search-result-autocomplete"
|
|
[maxResults]="liveSearchMaxResults">
|
|
<ng-template let-data>
|
|
<mat-list *ngIf="isSearchBarActive()" id="autocomplete-search-result-list">
|
|
<mat-list-item
|
|
*ngFor="let item of data?.list?.entries; let idx = index"
|
|
id="result_option_{{idx}}"
|
|
[attr.data-automation-id]="'autocomplete_for_' + item.entry.name"
|
|
[tabindex]="0"
|
|
(focus)="onFocus($event)"
|
|
(blur)="onBlur($event)"
|
|
(keyup.arrowdown)="onRowArrowDown($event)"
|
|
(keyup.arrowup)="onRowArrowUp($event)"
|
|
class="adf-search-autocomplete-item"
|
|
(click)="elementClicked(item)"
|
|
(keyup.enter)="elementClicked(item)"
|
|
(touchend)="elementClicked(item)">
|
|
<!-- This is a comment -->
|
|
<mat-icon mat-list-icon>
|
|
<img [alt]="getMimeType(item)" [src]="getMimeTypeIcon(item)"/>
|
|
</mat-icon>
|
|
<h4 mat-line id="result_name_{{idx}}"
|
|
*ngIf="highlight; else elseBlock"
|
|
class="adf-search-fixed-text"
|
|
[innerHtml]="item.entry.name | highlight: searchTerm">
|
|
{{ item?.entry.name }}
|
|
</h4>
|
|
<ng-template #elseBlock>
|
|
<h4 class="adf-search-fixed-text" mat-line id="result_name_{{idx}}"
|
|
[innerHtml]="item.entry.name"></h4>
|
|
</ng-template>
|
|
<p mat-line class="adf-search-fixed-text"> {{item?.entry.createdByUser.displayName}} </p>
|
|
</mat-list-item>
|
|
<mat-list-item id="search_no_result"
|
|
data-automation-id="search_no_result_found"
|
|
*ngIf="data?.list?.entries.length === 0">
|
|
<ng-content
|
|
selector="adf-empty-search-result"
|
|
*ngIf="isNoSearchTemplatePresent() else defaultNoResult">
|
|
</ng-content>
|
|
<ng-template #defaultNoResult>
|
|
<p mat-line class="adf-search-fixed-text">{{ 'SEARCH.RESULTS.NONE' | translate:{searchTerm:
|
|
searchTerm} }}</p>
|
|
</ng-template>
|
|
</mat-list-item>
|
|
</mat-list>
|
|
</ng-template>
|
|
</adf-search>
|