[ADF-1876] added custom empty result tag for search result control (#2940)

* [ADF-1876] added custom empty template for no search result

* [ADF-1876] added custom empty result tag for search result control

* [ADF-1876] added custom no search result tag for search control component

* [ADF-1876] added documentation for template no result
This commit is contained in:
Vito
2018-02-13 18:11:09 +00:00
committed by Eugenio Romano
parent 5d3f005b60
commit b3955b3f6c
11 changed files with 167 additions and 6 deletions

View File

@@ -18,12 +18,13 @@
import { AuthenticationService, ThumbnailService } from '@alfresco/adf-core';
import { animate, state, style, transition, trigger } from '@angular/animations';
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output,
QueryList, ViewEncapsulation, ViewChild, ViewChildren, ElementRef } from '@angular/core';
QueryList, ViewEncapsulation, ViewChild, ViewChildren, ElementRef, TemplateRef, ContentChild } from '@angular/core';
import { MinimalNodeEntity, QueryBody } from 'alfresco-js-api';
import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject';
import { SearchComponent } from './search.component';
import { MatListItem } from '@angular/material';
import { EmptySearchResultComponent } from './empty-search-result.component';
@Component({
selector: 'adf-search-control',
@@ -102,8 +103,12 @@ export class SearchControlComponent implements OnInit, OnDestroy {
@ViewChildren(MatListItem)
private listResultElement: QueryList<MatListItem>;
@ContentChild(EmptySearchResultComponent)
emptySearchTemplate: EmptySearchResultComponent;
searchTerm: string = '';
subscriptAnimationState: string;
noSearchResultTemplate: TemplateRef <any> = null;
private toggleSearch = new Subject<any>();
private focusSubject = new Subject<FocusEvent>();
@@ -137,6 +142,10 @@ export class SearchControlComponent implements OnInit, OnDestroy {
this.setupFocusEventHandlers();
}
isNoSearchTemplatePresent(): boolean {
return this.emptySearchTemplate ? true : false;
}
ngOnDestroy(): void {
if (this.focusSubject) {
this.focusSubject.unsubscribe();