From 8c07c4a7c2c14c651f6564bec26aa78614bfbf33 Mon Sep 17 00:00:00 2001 From: Will Abson Date: Mon, 27 Jun 2016 10:28:34 +0100 Subject: [PATCH] Emit event when live search bar is expanded Refs #228 --- .../components/alfresco-search-control.component.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ng2-components/ng2-alfresco-search/src/components/alfresco-search-control.component.ts b/ng2-components/ng2-alfresco-search/src/components/alfresco-search-control.component.ts index 3cd9d5464c..753ade330f 100644 --- a/ng2-components/ng2-alfresco-search/src/components/alfresco-search-control.component.ts +++ b/ng2-components/ng2-alfresco-search/src/components/alfresco-search-control.component.ts @@ -53,6 +53,9 @@ export class AlfrescoSearchControlComponent implements AfterViewInit { @Output() preview = new EventEmitter(); + @Output() + expand = new EventEmitter(); + searchControl: Control; @Input() @@ -123,12 +126,22 @@ export class AlfrescoSearchControlComponent implements AfterViewInit { onFocus(): void { this.searchActive = true; + if (this.expandable) { + this.expand.emit({ + expanded: true + }); + } } onBlur(): void { window.setTimeout(() => { this.searchActive = false; }, 200); + if (this.expandable && (this.searchControl.value === '' || this.searchControl.value === undefined)) { + this.expand.emit({ + expanded: false + }); + } } }