mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-08-07 17:48:54 +00:00
Update search component to work with 0.4.0 JS API
- Use new search (query) methods - Allow search parameters to be overridden by component - Fix up tests Refs #555
This commit is contained in:
@@ -56,16 +56,29 @@ export class AlfrescoSearchControlComponent implements OnInit, OnDestroy {
|
||||
|
||||
searchControl: FormControl;
|
||||
|
||||
@ViewChild('searchInput', {}) searchInput: ElementRef;
|
||||
@ViewChild('searchInput', {})
|
||||
searchInput: ElementRef;
|
||||
|
||||
@ViewChild('autocomplete')
|
||||
autocompleteComponent: AlfrescoSearchAutocompleteComponent;
|
||||
@ViewChild(AlfrescoSearchAutocompleteComponent)
|
||||
liveSearchComponent: AlfrescoSearchAutocompleteComponent;
|
||||
|
||||
@Input()
|
||||
autocompleteEnabled = true;
|
||||
liveSearchEnabled: boolean = true;
|
||||
|
||||
@Input()
|
||||
autocompleteSearchTerm = '';
|
||||
liveSearchTerm: string = '';
|
||||
|
||||
@Input()
|
||||
liveSearchRoot: string = '-root-';
|
||||
|
||||
@Input()
|
||||
liveSearchResultType: string = 'cm:content';
|
||||
|
||||
@Input()
|
||||
liveSearchResultSort: string = null;
|
||||
|
||||
@Input()
|
||||
liveSearchMaxResults: number = 5;
|
||||
|
||||
searchActive = false;
|
||||
|
||||
@@ -99,7 +112,7 @@ export class AlfrescoSearchControlComponent implements OnInit, OnDestroy {
|
||||
|
||||
private onSearchTermChange(value: string): void {
|
||||
this.setAutoCompleteDisplayed(true);
|
||||
this.autocompleteSearchTerm = value;
|
||||
this.liveSearchTerm = value;
|
||||
this.searchControl.setValue(value, true);
|
||||
this.searchValid = this.searchControl.valid;
|
||||
this.searchChange.emit({
|
||||
@@ -195,7 +208,7 @@ export class AlfrescoSearchControlComponent implements OnInit, OnDestroy {
|
||||
|
||||
onArrowDown(): void {
|
||||
if (this.isAutoCompleteDisplayed()) {
|
||||
this.autocompleteComponent.focusResult();
|
||||
this.liveSearchComponent.focusResult();
|
||||
} else {
|
||||
this.setAutoCompleteDisplayed(true);
|
||||
}
|
||||
|
Reference in New Issue
Block a user