Skip to content

Commit 118e845

Browse files
authored
update search due to edcarroll#343
1 parent 09165eb commit 118e845

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/modules/search/components/search.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ export interface IResultContext<T> extends ITemplateRefContext<T> {
5454
export class SuiSearch<T> implements AfterViewInit, OnDestroy {
5555
public dropdownService:DropdownService;
5656
public searchService:SearchService<T, T>;
57-
57+
private _inputValue:any = false;
58+
5859
@ViewChild(SuiDropdownMenu)
5960
private _menu:SuiDropdownMenu;
6061

@@ -85,6 +86,11 @@ export class SuiSearch<T> implements AfterViewInit, OnDestroy {
8586
this._placeholder = placeholder;
8687
}
8788

89+
@Input()
90+
public set inputValue(query:string) {
91+
this._inputValue = (query == '' || query == null) ? false : query;
92+
}
93+
8894
private _localeValues:ISearchLocaleValues;
8995

9096
public localeOverrides:RecursivePartial<ISearchLocaleValues>;
@@ -94,10 +100,15 @@ export class SuiSearch<T> implements AfterViewInit, OnDestroy {
94100
}
95101

96102
public get query():string {
97-
return this.searchService.query;
103+
if(this._inputValue) {
104+
return this._inputValue;
105+
} else {
106+
return this.searchService.query;
107+
}
98108
}
99109

100110
public set query(query:string) {
111+
this._inputValue = false;
101112
this.selectedResult = undefined;
102113
// Initialise a delayed search.
103114
this.searchService.updateQueryDelayed(query, () =>

0 commit comments

Comments
 (0)