Fixed #359 - Filter event for Listbox, Dropdown and MultiSelect
parent
9ba8911b6c
commit
9e76c66793
|
@ -25,6 +25,7 @@ export declare class Dropdown extends Vue {
|
||||||
$emit(eventName: 'before-leave'): this;
|
$emit(eventName: 'before-leave'): this;
|
||||||
$emit(eventName: 'show'): this;
|
$emit(eventName: 'show'): this;
|
||||||
$emit(eventName: 'hide'): this;
|
$emit(eventName: 'hide'): this;
|
||||||
|
$emit(eventName: 'filter', e: { originalEvent: Event, value: string }): this;
|
||||||
$slot: {
|
$slot: {
|
||||||
option: VNode[];
|
option: VNode[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<div ref="overlay" class="p-dropdown-panel p-component" v-if="overlayVisible">
|
<div ref="overlay" class="p-dropdown-panel p-component" v-if="overlayVisible">
|
||||||
<div class="p-dropdown-header" v-if="filter">
|
<div class="p-dropdown-header" v-if="filter">
|
||||||
<div class="p-dropdown-filter-container">
|
<div class="p-dropdown-filter-container">
|
||||||
<input type="text" ref="filterInput" v-model="filterValue" autoComplete="off" class="p-dropdown-filter p-inputtext p-component" :placeholder="filterPlaceholder" @keydown="onFilterKeyDown" />
|
<input type="text" ref="filterInput" v-model="filterValue" autoComplete="off" class="p-dropdown-filter p-inputtext p-component" :placeholder="filterPlaceholder" @keydown="onFilterKeyDown" @input="onFilterChange"/>
|
||||||
<span class="p-dropdown-filter-icon pi pi-search"></span>
|
<span class="p-dropdown-filter-icon pi pi-search"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -407,6 +407,9 @@ export default {
|
||||||
else
|
else
|
||||||
document.getElementById(this.appendTo).removeChild(this.$refs.overlay);
|
document.getElementById(this.appendTo).removeChild(this.$refs.overlay);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
onFilterChange(event) {
|
||||||
|
this.$emit('filter', {originalEvent: event, value: event.target.value});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
@ -17,6 +17,7 @@ export declare class Listbox extends Vue {
|
||||||
ariaLabelledBy?: string;
|
ariaLabelledBy?: string;
|
||||||
$emit(eventName: 'input', value: any): this;
|
$emit(eventName: 'input', value: any): this;
|
||||||
$emit(eventName: 'change', e: { originalEvent: Event, value: any }): this;
|
$emit(eventName: 'change', e: { originalEvent: Event, value: any }): this;
|
||||||
|
$emit(eventName: 'filter', e: { originalEvent: Event, value: string }): this;
|
||||||
$slots: {
|
$slots: {
|
||||||
option: VNode[];
|
option: VNode[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="p-listbox p-component">
|
<div class="p-listbox p-component">
|
||||||
<div class="p-listbox-header" v-if="filter">
|
<div class="p-listbox-header" v-if="filter">
|
||||||
<div class="p-listbox-filter-container">
|
<div class="p-listbox-filter-container">
|
||||||
<input type="text" class="p-listbox-filter p-inputtext p-component" v-model="filterValue" :placeholder="filterPlaceholder">
|
<input type="text" class="p-listbox-filter p-inputtext p-component" v-model="filterValue" :placeholder="filterPlaceholder" @input="onFilterChange">
|
||||||
<span class="p-listbox-filter-icon pi pi-search"></span>
|
<span class="p-listbox-filter-icon pi pi-search"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -216,6 +216,9 @@ export default {
|
||||||
return DomHandler.hasClass(prevItem, 'p-disabled') ? this.findPrevItem(prevItem) : prevItem;
|
return DomHandler.hasClass(prevItem, 'p-disabled') ? this.findPrevItem(prevItem) : prevItem;
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
|
},
|
||||||
|
onFilterChange(event) {
|
||||||
|
this.$emit('filter', {originalEvent: event, value: event.target.value});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
@ -23,6 +23,7 @@ export declare class MultiSelect extends Vue {
|
||||||
$emit(eventName: 'before-leave'): this;
|
$emit(eventName: 'before-leave'): this;
|
||||||
$emit(eventName: 'show'): this;
|
$emit(eventName: 'show'): this;
|
||||||
$emit(eventName: 'hide'): this;
|
$emit(eventName: 'hide'): this;
|
||||||
|
$emit(eventName: 'filter', e: { originalEvent: Event, value: string }): this;
|
||||||
$slots: {
|
$slots: {
|
||||||
value: VNode[];
|
value: VNode[];
|
||||||
option: VNode[];
|
option: VNode[];
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="filter" class="p-multiselect-filter-container">
|
<div v-if="filter" class="p-multiselect-filter-container">
|
||||||
<input type="text" v-model="filterValue" class="p-multiselect-filter p-inputtext p-component" :placeholder="filterPlaceholder">
|
<input type="text" v-model="filterValue" class="p-multiselect-filter p-inputtext p-component" :placeholder="filterPlaceholder" @input="onFilterChange">
|
||||||
<span class="p-multiselect-filter-icon pi pi-search"></span>
|
<span class="p-multiselect-filter-icon pi pi-search"></span>
|
||||||
</div>
|
</div>
|
||||||
<button class="p-multiselect-close p-link" @click="onCloseClick" type="button" v-ripple>
|
<button class="p-multiselect-close p-link" @click="onCloseClick" type="button" v-ripple>
|
||||||
|
@ -339,6 +339,9 @@ export default {
|
||||||
else
|
else
|
||||||
document.getElementById(this.appendTo).removeChild(this.$refs.overlay);
|
document.getElementById(this.appendTo).removeChild(this.$refs.overlay);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
onFilterChange(event) {
|
||||||
|
this.$emit('filter', {originalEvent: event, value: event.target.value});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
@ -229,6 +229,12 @@ data() {
|
||||||
<td>hide</td>
|
<td>hide</td>
|
||||||
<td>-</td>
|
<td>-</td>
|
||||||
<td>Callback to invoke when the overlay is hidden.</td>
|
<td>Callback to invoke when the overlay is hidden.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>filter</td>
|
||||||
|
<td>event.originalEvent: Original event <br />
|
||||||
|
event.value: Filter value </td>
|
||||||
|
<td>Callback to invoke on filter input.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -174,6 +174,12 @@ data() {
|
||||||
<td>input</td>
|
<td>input</td>
|
||||||
<td>value: New value</td>
|
<td>value: New value</td>
|
||||||
<td>Callback to invoke on value change.</td>
|
<td>Callback to invoke on value change.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>filter</td>
|
||||||
|
<td>event.originalEvent: Original event <br />
|
||||||
|
event.value: Filter value </td>
|
||||||
|
<td>Callback to invoke on filter input.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -218,6 +218,12 @@ data() {
|
||||||
<td>-</td>
|
<td>-</td>
|
||||||
<td>Callback to invoke when the overlay is hidden.</td>
|
<td>Callback to invoke when the overlay is hidden.</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>filter</td>
|
||||||
|
<td>event.originalEvent: Original event <br />
|
||||||
|
event.value: Filter value </td>
|
||||||
|
<td>Callback to invoke on filter input.</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue