Fixed #2219 - Calendar keydown event

pull/2224/head
Tuğçe Küçükoğlu 2022-02-25 16:36:21 +03:00 committed by Tuğçe Küçükoğlu
parent cc0e6c8580
commit db46ee81af
4 changed files with 23 additions and 1 deletions

View File

@ -360,6 +360,17 @@ const CalendarEvents = [
}
]
},
{
name: "keydown",
description: "Callback to invoke when a key is pressed.",
arguments: [
{
name: "event",
type: "object",
description: "Keydown event"
}
]
}
];
const CalendarSlots = [

View File

@ -335,6 +335,10 @@ export declare type CalendarEmits = {
* @param {CalendarBlurEvent} event - Blur event
*/
'blur': (event: CalendarBlurEvent) => void;
/**
* Callback to invoke when a key is pressed.
*/
'keydown': (event: Event) => void;
}
declare class Calendar extends ClassComponent<CalendarProps, CalendarSlots, CalendarEmits> { }

View File

@ -150,7 +150,7 @@ import Ripple from 'primevue/ripple';
export default {
name: 'Calendar',
inheritAttrs: false,
emits: ['show', 'hide', 'input', 'month-change', 'year-change', 'date-select', 'update:modelValue', 'today-click', 'clear-click', 'focus', 'blur'],
emits: ['show', 'hide', 'input', 'month-change', 'year-change', 'date-select', 'update:modelValue', 'today-click', 'clear-click', 'focus', 'blur', 'keydown'],
props: {
modelValue: null,
selectionMode: {
@ -2157,6 +2157,8 @@ export default {
//Noop
break;
}
this.$emit('keydown', event);
},
onInput(event) {
try {

View File

@ -513,6 +513,11 @@ export default {
</td>
<td>Callback to invoke on blur of input field.</td>
</tr>
<tr>
<td>keydown</td>
<td>event: Keyboard event</td>
<td>Callback to invoke when a key is pressed.</td>
</tr>
</tbody>
</table>
</div>