mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[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:
@@ -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();
|
||||
|
Reference in New Issue
Block a user