From 657d92915dbde3cd2d1ac05a1da029763c17e385 Mon Sep 17 00:00:00 2001 From: John Leider Date: Sat, 13 Jan 2024 12:40:27 -0600 Subject: [PATCH] feat(VAutocomplete/VCombobox): add new clearOnSelect prop closes #6842 --- packages/api-generator/src/locale/en/VAutocomplete.json | 1 + packages/api-generator/src/locale/en/VCombobox.json | 1 + .../src/components/VAutocomplete/VAutocomplete.tsx | 5 +++++ packages/vuetify/src/components/VCombobox/VCombobox.tsx | 8 +++++++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/api-generator/src/locale/en/VAutocomplete.json b/packages/api-generator/src/locale/en/VAutocomplete.json index d799fbda4bc..4cf1f32964f 100644 --- a/packages/api-generator/src/locale/en/VAutocomplete.json +++ b/packages/api-generator/src/locale/en/VAutocomplete.json @@ -1,6 +1,7 @@ { "props": { "autoSelectFirst": "When searching, will always highlight the first option and select it on blur. `exact` will only highlight and select exact matches.", + "clearOnSelect": "Reset the search text when a selection is made while using the **multiple** prop.", "filter": "The filtering algorithm used when searching. [example](https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/components/VAutocomplete/VAutocomplete.ts#L40).", "items": "Can be an array of objects or strings. By default objects should have **title** and **value** properties, and can optionally have a **props** property containing any [VListItem props](/api/v-list-item/#props). Keys to use for these can be changed with the **item-title**, **item-value**, and **item-props** props.", "noFilter": "Do not apply filtering when searching. Useful when data is being filtered server side." diff --git a/packages/api-generator/src/locale/en/VCombobox.json b/packages/api-generator/src/locale/en/VCombobox.json index eeb900726b8..27d690fac69 100644 --- a/packages/api-generator/src/locale/en/VCombobox.json +++ b/packages/api-generator/src/locale/en/VCombobox.json @@ -1,6 +1,7 @@ { "props": { "autoSelectFirst": "When searching, will always highlight the first option and select it on blur. `exact` will only highlight and select exact matches.", + "clearOnSelect": "Reset the search text when a selection is made while using the **multiple** prop.", "delimiters": "Accepts an array of strings that will trigger a new tag when typing. Does not replace the normal Tab and Enter keys.", "items": "Can be an array of objects or strings. By default objects should have **title** and **value** properties, and can optionally have a **props** property containing any [VListItem props](/api/v-list-item/#props). Keys to use for these can be changed with the **item-title**, **item-value**, and **item-props** props." }, diff --git a/packages/vuetify/src/components/VAutocomplete/VAutocomplete.tsx b/packages/vuetify/src/components/VAutocomplete/VAutocomplete.tsx index 100332b70f9..80e62ee3399 100644 --- a/packages/vuetify/src/components/VAutocomplete/VAutocomplete.tsx +++ b/packages/vuetify/src/components/VAutocomplete/VAutocomplete.tsx @@ -77,6 +77,7 @@ export const makeVAutocompleteProps = propsFactory({ autoSelectFirst: { type: [Boolean, String] as PropType, }, + clearOnSelect: Boolean, search: String, ...makeFilterProps({ filterKeys: ['title'] }), @@ -334,6 +335,10 @@ export const VAutocomplete = genericComponent, }, + clearOnSelect: { + type: Boolean, + default: true, + }, delimiters: Array as PropType, ...makeFilterProps({ filterKeys: ['title'] }), @@ -362,7 +366,9 @@ export const VCombobox = genericComponent