fix: Primefaces#5060, Dropdown: After selecting an option, clearing the value using close icon should clear the filter input (#5061)
* fix: Primefaces#5060, Dropdown: After selecting an option, clearing the value using close icon should clear the filter input * fix: Primefaces#5060, Dropdown: After selecting an option, clearing the value using close icon should clear the filter input --------- Co-authored-by: Akshay Antony <akshayantony55@gmail.com>pull/5098/head
parent
6b75f1a565
commit
6f71f8195e
|
@ -185,6 +185,12 @@ const DropdownProps = [
|
|||
default: 'false',
|
||||
description: 'Clears the filter value when hiding the dropdown.'
|
||||
},
|
||||
{
|
||||
name: 'resetFilterOnClear',
|
||||
type: 'boolean',
|
||||
default: 'false',
|
||||
description: 'Clears the filter value when clicking on the clear icon.'
|
||||
},
|
||||
{
|
||||
name: 'virtualScrollerOptions',
|
||||
type: 'object',
|
||||
|
|
|
@ -106,6 +106,10 @@ export default {
|
|||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
resetFilterOnClear: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
virtualScrollerOptions: {
|
||||
type: Object,
|
||||
default: null
|
||||
|
|
|
@ -389,6 +389,11 @@ export interface DropdownProps {
|
|||
* @defaultValue false
|
||||
*/
|
||||
resetFilterOnHide?: boolean;
|
||||
/**
|
||||
* Clears the filter value when clicking on the clear icon.
|
||||
* @defaultValue false
|
||||
*/
|
||||
resetFilterOnClear?: boolean;
|
||||
/**
|
||||
* Whether to use the virtualScroller feature. The properties of VirtualScroller component can be used like an object in it.
|
||||
*/
|
||||
|
|
|
@ -421,6 +421,7 @@ export default {
|
|||
},
|
||||
onClearClick(event) {
|
||||
this.updateModel(event, null);
|
||||
this.resetFilterOnClear && (this.filterValue = null);
|
||||
},
|
||||
onFirstHiddenFocus(event) {
|
||||
const focusableEl = event.relatedTarget === this.$refs.focusInput ? DomHandler.getFirstFocusableElement(this.overlay, ':not([data-p-hidden-focusable="true"])') : this.$refs.focusInput;
|
||||
|
|
|
@ -24158,6 +24158,14 @@
|
|||
"default": "false",
|
||||
"description": "Clears the filter value when hiding the dropdown."
|
||||
},
|
||||
{
|
||||
"name": "resetFilterOnClear",
|
||||
"optional": true,
|
||||
"readonly": false,
|
||||
"type": "boolean",
|
||||
"default": "false",
|
||||
"description": "Clears the filter value when clicking on the dropdown."
|
||||
},
|
||||
{
|
||||
"name": "virtualScrollerOptions",
|
||||
"optional": true,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<p>Dropdown provides built-in filtering that is enabled by adding the <i>filter</i> property.</p>
|
||||
</DocSectionText>
|
||||
<div class="card flex justify-content-center">
|
||||
<Dropdown v-model="selectedCountry" :options="countries" filter optionLabel="name" placeholder="Select a Country" class="w-full md:w-14rem">
|
||||
<Dropdown v-model="selectedCountry" :options="countries" filter optionLabel="name" placeholder="Select a Country" class="w-full md:w-14rem" showClear>
|
||||
<template #value="slotProps">
|
||||
<div v-if="slotProps.value" class="flex align-items-center">
|
||||
<img :alt="slotProps.value.label" src="https://primefaces.org/cdn/primevue/images/flag/flag_placeholder.png" :class="`mr-2 flag flag-${slotProps.value.code.toLowerCase()}`" style="width: 18px" />
|
||||
|
|
Loading…
Reference in New Issue