From 5373183e445b2abfea7f852adff69a495ab69b76 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Tue, 21 Mar 2023 14:37:28 +0000 Subject: [PATCH 1/2] docs(select): fix typeahead search --- .../v6/select/typeahead/angular/modal-example_component_ts.md | 2 +- static/usage/v6/select/typeahead/demo.html | 4 ++-- static/usage/v6/select/typeahead/javascript.md | 2 +- .../v6/select/typeahead/react/typeahead_component_tsx.md | 2 +- .../usage/v6/select/typeahead/vue/typeahead_component_vue.md | 2 +- .../v7/select/typeahead/angular/modal-example_component_ts.md | 4 ++-- static/usage/v7/select/typeahead/demo.html | 4 ++-- static/usage/v7/select/typeahead/javascript.md | 2 +- .../v7/select/typeahead/react/typeahead_component_tsx.md | 2 +- .../usage/v7/select/typeahead/vue/typeahead_component_vue.md | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/static/usage/v6/select/typeahead/angular/modal-example_component_ts.md b/static/usage/v6/select/typeahead/angular/modal-example_component_ts.md index e1b536e723e..5631319f98c 100644 --- a/static/usage/v6/select/typeahead/angular/modal-example_component_ts.md +++ b/static/usage/v6/select/typeahead/angular/modal-example_component_ts.md @@ -60,7 +60,7 @@ export class TypeaheadComponent implements OnInit { */ const normalizedQuery = searchQuery.toLowerCase(); this.filteredItems = this.items.filter(item => { - return item.value.includes(normalizedQuery); + return item.text.toLowerCase().includes(normalizedQuery); }); } } diff --git a/static/usage/v6/select/typeahead/demo.html b/static/usage/v6/select/typeahead/demo.html index 2f7410fb810..c21cd779caf 100644 --- a/static/usage/v6/select/typeahead/demo.html +++ b/static/usage/v6/select/typeahead/demo.html @@ -108,7 +108,7 @@ const normalizedQuery = searchQuery.toLowerCase(); - return fruits.filter(fruit => fruit.value.includes(normalizedQuery)); + return fruits.filter(fruit => fruit.text.toLowerCase().includes(normalizedQuery)); } /** @@ -121,7 +121,7 @@ let template = ''; data.forEach((item, index) => { - const checked = workingSelectedFruits.includes(item.value); + const checked = workingSelectedFruits.includes(item.text.toLowerCase()); template += ` ${item.text} diff --git a/static/usage/v6/select/typeahead/javascript.md b/static/usage/v6/select/typeahead/javascript.md index 247c8ed10f2..c7aa9352267 100644 --- a/static/usage/v6/select/typeahead/javascript.md +++ b/static/usage/v6/select/typeahead/javascript.md @@ -94,7 +94,7 @@ const normalizedQuery = searchQuery.toLowerCase(); - return fruits.filter(fruit => fruit.value.includes(normalizedQuery)); + return fruits.filter(fruit => fruit.text.toLowerCase().includes(normalizedQuery)); } /** diff --git a/static/usage/v6/select/typeahead/react/typeahead_component_tsx.md b/static/usage/v6/select/typeahead/react/typeahead_component_tsx.md index 1192f3bc2a3..0df268e172b 100644 --- a/static/usage/v6/select/typeahead/react/typeahead_component_tsx.md +++ b/static/usage/v6/select/typeahead/react/typeahead_component_tsx.md @@ -59,7 +59,7 @@ function AppTypeahead(props: TypeaheadProps) { */ const normalizedQuery = searchQuery.toLowerCase(); setFilteredItems(props.items.filter(item => { - return item.value.includes(normalizedQuery); + return item.text.toLowerCase().includes(normalizedQuery); })); } } diff --git a/static/usage/v6/select/typeahead/vue/typeahead_component_vue.md b/static/usage/v6/select/typeahead/vue/typeahead_component_vue.md index c49e7113678..e80c0fc09cd 100644 --- a/static/usage/v6/select/typeahead/vue/typeahead_component_vue.md +++ b/static/usage/v6/select/typeahead/vue/typeahead_component_vue.md @@ -89,7 +89,7 @@ */ const normalizedQuery = searchQuery.toLowerCase(); filteredItems.value = props.items.filter(item => { - return item.value.includes(normalizedQuery); + return item.text.toLowerCase().includes(normalizedQuery); }); } } diff --git a/static/usage/v7/select/typeahead/angular/modal-example_component_ts.md b/static/usage/v7/select/typeahead/angular/modal-example_component_ts.md index 129db1ed94b..5631319f98c 100644 --- a/static/usage/v7/select/typeahead/angular/modal-example_component_ts.md +++ b/static/usage/v7/select/typeahead/angular/modal-example_component_ts.md @@ -7,7 +7,7 @@ import { Item } from './types'; selector: 'app-typeahead', templateUrl: 'typeahead.component.html', }) -export class TypeaheadComponentt implements OnInit { +export class TypeaheadComponent implements OnInit { @Input() items: Item[] = []; @Input() selectedItems: string[] = []; @Input() title = 'Select Items'; @@ -60,7 +60,7 @@ export class TypeaheadComponentt implements OnInit { */ const normalizedQuery = searchQuery.toLowerCase(); this.filteredItems = this.items.filter(item => { - return item.value.includes(normalizedQuery); + return item.text.toLowerCase().includes(normalizedQuery); }); } } diff --git a/static/usage/v7/select/typeahead/demo.html b/static/usage/v7/select/typeahead/demo.html index df815850f89..9fa9bb8e5af 100644 --- a/static/usage/v7/select/typeahead/demo.html +++ b/static/usage/v7/select/typeahead/demo.html @@ -13,7 +13,7 @@ -
 +
Favorite Fruits @@ -108,7 +108,7 @@ const normalizedQuery = searchQuery.toLowerCase(); - return fruits.filter(fruit => fruit.value.includes(normalizedQuery)); + return fruits.filter(fruit => fruit.text.toLowerCase().includes(normalizedQuery)); } /** diff --git a/static/usage/v7/select/typeahead/javascript.md b/static/usage/v7/select/typeahead/javascript.md index 9d5e5f7bc4a..51438ee8d84 100644 --- a/static/usage/v7/select/typeahead/javascript.md +++ b/static/usage/v7/select/typeahead/javascript.md @@ -94,7 +94,7 @@ const normalizedQuery = searchQuery.toLowerCase(); - return fruits.filter(fruit => fruit.value.includes(normalizedQuery)); + return fruits.filter(fruit => fruit.text.toLowerCase().includes(normalizedQuery)); } /** diff --git a/static/usage/v7/select/typeahead/react/typeahead_component_tsx.md b/static/usage/v7/select/typeahead/react/typeahead_component_tsx.md index 7c0f89d905e..c87cc1d926b 100644 --- a/static/usage/v7/select/typeahead/react/typeahead_component_tsx.md +++ b/static/usage/v7/select/typeahead/react/typeahead_component_tsx.md @@ -59,7 +59,7 @@ function AppTypeahead(props: TypeaheadProps) { */ const normalizedQuery = searchQuery.toLowerCase(); setFilteredItems(props.items.filter(item => { - return item.value.includes(normalizedQuery); + return item.text.toLowerCase().includes(normalizedQuery); })); } } diff --git a/static/usage/v7/select/typeahead/vue/typeahead_component_vue.md b/static/usage/v7/select/typeahead/vue/typeahead_component_vue.md index 486bb000586..07bac7f44e5 100644 --- a/static/usage/v7/select/typeahead/vue/typeahead_component_vue.md +++ b/static/usage/v7/select/typeahead/vue/typeahead_component_vue.md @@ -88,7 +88,7 @@ */ const normalizedQuery = searchQuery.toLowerCase(); filteredItems.value = props.items.filter(item => { - return item.value.includes(normalizedQuery); + return item.text.toLowerCase().includes(normalizedQuery); }); } } From 11279a4a5ad80dfc6cb1117dd4ec215fa451bbd5 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Tue, 21 Mar 2023 10:38:25 -0400 Subject: [PATCH 2/2] Update demo.html --- static/usage/v6/select/typeahead/demo.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/usage/v6/select/typeahead/demo.html b/static/usage/v6/select/typeahead/demo.html index c21cd779caf..f4687ec9959 100644 --- a/static/usage/v6/select/typeahead/demo.html +++ b/static/usage/v6/select/typeahead/demo.html @@ -121,7 +121,7 @@ let template = ''; data.forEach((item, index) => { - const checked = workingSelectedFruits.includes(item.text.toLowerCase()); + const checked = workingSelectedFruits.includes(item.value); template += ` ${item.text}