From 6dae24d4249e4df06566f6fdb8f1469145903409 Mon Sep 17 00:00:00 2001 From: Thomas Hunter Date: Mon, 16 Aug 2021 11:34:44 +0100 Subject: [PATCH] [ADF-5460] Add placeholder to SearchTextInputComponent (#7208) --- docs/core/components/search-text-input.component.md | 1 + lib/core/search-text/search-text-input.component.html | 1 + lib/core/search-text/search-text-input.component.ts | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/core/components/search-text-input.component.md b/docs/core/components/search-text-input.component.md index 9cbedb1011..fdf0f0972a 100644 --- a/docs/core/components/search-text-input.component.md +++ b/docs/core/components/search-text-input.component.md @@ -40,6 +40,7 @@ Displays a input text that supports autocompletion | searchTerm | `string` | "" | Search term preselected. | | collapseOnBlur | `boolean` | "true" | Toggles whether to collapse the search on blur. | | showClearButton | `boolean` | "false" | Toggles whether to show a clear button that closes the search. | +| placeholder | `string` | "" | Placeholder text to show in the input field | ### Events diff --git a/lib/core/search-text/search-text-input.component.html b/lib/core/search-text/search-text-input.component.html index 3e6897b92b..d27053c7f0 100644 --- a/lib/core/search-text/search-text-input.component.html +++ b/lib/core/search-text/search-text-input.component.html @@ -18,6 +18,7 @@ [autocomplete]="getAutoComplete()" id="adf-control-input" [(ngModel)]="searchTerm" + [placeholder]="placeholder" (focus)="activateToolbar()" (blur)="onBlur($event)" (keyup.escape)="toggleSearchBar()" diff --git a/lib/core/search-text/search-text-input.component.ts b/lib/core/search-text/search-text-input.component.ts index a98db869b8..8aa7401b62 100644 --- a/lib/core/search-text/search-text-input.component.ts +++ b/lib/core/search-text/search-text-input.component.ts @@ -73,7 +73,7 @@ export class SearchTextInputComponent implements OnInit, OnDestroy { collapseOnSubmit: boolean = true; /** Default state expanded or Collapsed. */ - @Input() + @Input() defaultState: SearchTextStateEnum = SearchTextStateEnum.collapsed; /** Toggles whether to collapse the search on blur. */ @@ -84,6 +84,10 @@ export class SearchTextInputComponent implements OnInit, OnDestroy { @Input() showClearButton: boolean = false; + /** Placeholder text to show in the input field */ + @Input() + placeholder: string = ''; + /** Emitted when the search term is changed. The search term is provided * in the 'value' property of the returned object. If the term is less * than three characters in length then it is truncated to an empty