Fixed #944 - Dropdown component does not fire focus or blur events
parent
c67bf1a764
commit
feb3187d68
|
@ -201,6 +201,28 @@ const DividerEvents = [
|
||||||
name: "hide",
|
name: "hide",
|
||||||
description: "Callback to invoke when the overlay is hidden."
|
description: "Callback to invoke when the overlay is hidden."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "focus",
|
||||||
|
description: "Callback to invoke when component receives focus.",
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: "event",
|
||||||
|
type: "object",
|
||||||
|
description: "Browser event"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "blur",
|
||||||
|
description: "Callback to invoke when component loses focus.",
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: "event",
|
||||||
|
type: "object",
|
||||||
|
description: "Browser event"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "filter",
|
name: "filter",
|
||||||
description: "Callback to invoke when the overlay is shown.",
|
description: "Callback to invoke when the overlay is shown.",
|
||||||
|
|
|
@ -38,6 +38,8 @@ declare class Dropdown {
|
||||||
$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: 'focus', e: Event): this;
|
||||||
|
$emit(eventName: 'blur', e: Event): this;
|
||||||
$emit(eventName: 'filter', e: { originalEvent: Event, value: string }): this;
|
$emit(eventName: 'filter', e: { originalEvent: Event, value: string }): this;
|
||||||
$slot: {
|
$slot: {
|
||||||
option: VNode[];
|
option: VNode[];
|
||||||
|
|
|
@ -65,7 +65,7 @@ import Ripple from 'primevue/ripple';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Dropdown',
|
name: 'Dropdown',
|
||||||
emits: ['update:modelValue', 'before-show', 'before-hide', 'show', 'hide', 'change', 'filter'],
|
emits: ['update:modelValue', 'before-show', 'before-hide', 'show', 'hide', 'change', 'filter', 'focus', 'blur'],
|
||||||
props: {
|
props: {
|
||||||
modelValue: null,
|
modelValue: null,
|
||||||
options: Array,
|
options: Array,
|
||||||
|
@ -214,11 +214,13 @@ export default {
|
||||||
this.$emit('before-hide');
|
this.$emit('before-hide');
|
||||||
this.overlayVisible = false;
|
this.overlayVisible = false;
|
||||||
},
|
},
|
||||||
onFocus() {
|
onFocus(event) {
|
||||||
this.focused = true;
|
this.focused = true;
|
||||||
|
this.$emit('focus', event);
|
||||||
},
|
},
|
||||||
onBlur() {
|
onBlur(event) {
|
||||||
this.focused = false;
|
this.focused = false;
|
||||||
|
this.$emit('blur', event);
|
||||||
},
|
},
|
||||||
onKeyDown(event) {
|
onKeyDown(event) {
|
||||||
switch(event.which) {
|
switch(event.which) {
|
||||||
|
|
|
@ -334,6 +334,16 @@ export default {
|
||||||
<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>focus</td>
|
||||||
|
<td>event</td>
|
||||||
|
<td>Callback to invoke when the component receives focus.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>blur</td>
|
||||||
|
<td>event</td>
|
||||||
|
<td>Callback to invoke when the component loses focus.</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>filter</td>
|
<td>filter</td>
|
||||||
<td>event.originalEvent: Original event <br />
|
<td>event.originalEvent: Original event <br />
|
||||||
|
|
Loading…
Reference in New Issue