From 207b27f41e5fd419a34bedb92e302b4800e70f20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Tue, 14 Jun 2022 11:44:47 +0300 Subject: [PATCH] Fixed #2664 - MultiSelect | resetFilterOnHide property --- api-generator/components/multiselect.js | 8 +++++++- src/components/multiselect/MultiSelect.d.ts | 12 ++++++++---- src/components/multiselect/MultiSelect.vue | 12 ++++++------ src/views/multiselect/MultiSelectDemo.vue | 11 +---------- src/views/multiselect/MultiSelectDoc.vue | 12 ++++++------ 5 files changed, 28 insertions(+), 27 deletions(-) diff --git a/api-generator/components/multiselect.js b/api-generator/components/multiselect.js index a21205705..0ee9aa57e 100644 --- a/api-generator/components/multiselect.js +++ b/api-generator/components/multiselect.js @@ -179,12 +179,18 @@ const MultiSelectProps = [ default: "false", description: "Whether all data is selected." }, + { + name: "resetFilterOnHide", + type: "boolean", + default: "false", + description: "Clears the filter value when hiding the dropdown." + }, { name: "virtualScrollerOptions", type: "object", default: "null", description: "Whether to use the virtualScroller feature. The properties of VirtualScroller component can be used like an object in it." - } + }, ]; const MultiSelectEvents = [ diff --git a/src/components/multiselect/MultiSelect.d.ts b/src/components/multiselect/MultiSelect.d.ts index 8895a3d0e..f6d77c35c 100755 --- a/src/components/multiselect/MultiSelect.d.ts +++ b/src/components/multiselect/MultiSelect.d.ts @@ -182,15 +182,19 @@ export interface MultiSelectProps { * Default value is 'pi pi-spinner pi-spin'. */ loadingIcon?: string | undefined; + /** + * Whether all data is selected. + */ + selectAll?: boolean | undefined; + /** + * Clears the filter value when hiding the dropdown. + */ + resetFilterOnHide?: boolean; /** * Whether to use the virtualScroller feature. The properties of VirtualScroller component can be used like an object in it. * @see VirtualScroller.VirtualScrollerProps */ virtualScrollerOptions?: VirtualScrollerProps; - /** - * Whether all data is selected. - */ - selectAll?: boolean | undefined; } export interface MultiSelectSlots { diff --git a/src/components/multiselect/MultiSelect.vue b/src/components/multiselect/MultiSelect.vue index d970b019c..c441e3478 100755 --- a/src/components/multiselect/MultiSelect.vue +++ b/src/components/multiselect/MultiSelect.vue @@ -184,16 +184,16 @@ export default { type: String, default: 'pi pi-spinner pi-spin' }, - virtualScrollerOptions: { - type: Object, - default: null - }, selectAll: { type: Boolean, default: null }, - clearFilterOnHide: { + resetFilterOnHide: { type: Boolean, + default: false + }, + virtualScrollerOptions: { + type: Object, default: null } }, @@ -290,7 +290,7 @@ export default { hide() { this.$emit('before-hide'); this.overlayVisible = false; - if (this.clearFilterOnHide) { + if (this.resetFilterOnHide) { this.filterValue = null; } }, diff --git a/src/views/multiselect/MultiSelectDemo.vue b/src/views/multiselect/MultiSelectDemo.vue index a68f522b5..7979cfc70 100755 --- a/src/views/multiselect/MultiSelectDemo.vue +++ b/src/views/multiselect/MultiSelectDemo.vue @@ -27,7 +27,7 @@
Advanced with Templating and Filtering
- + -
Loading State
@@ -74,7 +69,6 @@ export default { selectedGroupedCities: null, selectedItems: null, selectAll: false, - // clearFilterOnHide: false, cities: [ {name: 'New York', code: 'NY'}, {name: 'Rome', code: 'RM'}, @@ -131,9 +125,6 @@ export default { }, onChange(event) { this.selectAll = event.value.length === this.items.length - }, - clearAdvancedTemplatingFilterInput() { - this.$refs.advancedMultiselect.clearFilter() } }, components: { diff --git a/src/views/multiselect/MultiSelectDoc.vue b/src/views/multiselect/MultiSelectDoc.vue index 824213954..02f23350b 100755 --- a/src/views/multiselect/MultiSelectDoc.vue +++ b/src/views/multiselect/MultiSelectDoc.vue @@ -327,17 +327,17 @@ export default { false Whether all data is selected. + + resetFilterOnHide + boolean + false + Clears the filter value when hiding the dropdown. + virtualScrollerOptions object null Whether to use the virtualScroller feature. The properties of VirtualScroller component can be used like an object in it. - - - clearFilterOnHide - boolean - false - Whether to clear filterInput when the overlay is hidden.