From 18a55ce18dc066ab827b6106a5aaed90d7faf883 Mon Sep 17 00:00:00 2001 From: Edmilson-C Date: Tue, 21 Feb 2023 12:02:28 +0200 Subject: [PATCH 1/3] remove whole deleted option --- src/components/VSelectize.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/VSelectize.vue b/src/components/VSelectize.vue index 9aca0af..6a25da9 100644 --- a/src/components/VSelectize.vue +++ b/src/components/VSelectize.vue @@ -512,7 +512,7 @@ export default { option = option[this.label] } if (this.multiple) { - this.searchText = option !== undefined ? option : '' + this.searchText = '' } this.emitInput() this.updateInputWidth() From fb71914634647c2123a30500c4db7b76b3a23e3e Mon Sep 17 00:00:00 2001 From: Edmilson-C Date: Thu, 30 Mar 2023 15:29:11 +0200 Subject: [PATCH 2/3] refactor: make remove whole deleted option (opt-in) --- src/components/VSelectize.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/VSelectize.vue b/src/components/VSelectize.vue index 6a25da9..c7a1bcf 100644 --- a/src/components/VSelectize.vue +++ b/src/components/VSelectize.vue @@ -159,6 +159,11 @@ export default { * Selectize theme */ theme: { default: '', type: String }, + + /** + * Allows component to delete whole option + */ + clearSearchText: { default: false, type: Boolean } }, data: () => ({ @@ -511,9 +516,13 @@ export default { if (typeof option === 'object' && option !== undefined) { option = option[this.label] } - if (this.multiple) { + + if (this.multiple && this.clearSearchText) { this.searchText = '' + } else if(this.multiple) { + this.searchText = option !== undefined ? option : '' } + this.emitInput() this.updateInputWidth() } From f8ace4837e5f347a586c23e2926c45bc16a654b2 Mon Sep 17 00:00:00 2001 From: Edmilson-C Date: Fri, 21 Apr 2023 09:53:39 +0200 Subject: [PATCH 3/3] docs: :memo: add clearSearchText in props documentation --- docs/api/props.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/api/props.md b/docs/api/props.md index 57fada3..2e11526 100644 --- a/docs/api/props.md +++ b/docs/api/props.md @@ -120,3 +120,11 @@ Selectize.js theme ```js theme: { default: '', type: String } ``` + +## clearSearchText + +Allows component to delete whole option + +```js +clearSearchText: { default: false, type: Boolean } +``` \ No newline at end of file