From 5cbd68d72076af62c79981d3affd3a3068823eec 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: Mon, 14 Feb 2022 11:09:03 +0300 Subject: [PATCH] Fixed #2152 - New input event for Calendar --- api-generator/components/calendar.js | 11 +++++++++++ src/components/calendar/Calendar.d.ts | 5 +++++ src/components/calendar/Calendar.vue | 2 ++ src/views/calendar/CalendarDoc.vue | 5 +++++ 4 files changed, 23 insertions(+) diff --git a/api-generator/components/calendar.js b/api-generator/components/calendar.js index d95f4def3..a6f7a817c 100644 --- a/api-generator/components/calendar.js +++ b/api-generator/components/calendar.js @@ -249,6 +249,17 @@ const CalendarProps = [ ]; const CalendarEvents = [ + { + name: "input", + description: "Callback to invoke when input field is being typed.", + arguments: [ + { + name: "event", + type: "object", + description: "New date" + } + ] + }, { name: "date-select", description: "Callback to invoke when a date is selected.", diff --git a/src/components/calendar/Calendar.d.ts b/src/components/calendar/Calendar.d.ts index 0888f5375..56257afa4 100755 --- a/src/components/calendar/Calendar.d.ts +++ b/src/components/calendar/Calendar.d.ts @@ -276,6 +276,11 @@ export declare type CalendarEmits = { * @param {CalendarValueType} value - New value. */ 'update:modelValue': (value: CalendarValueType) => void; + /** + * Callback to invoke when input field is being typed. + * @param {Event} event - Browser event + */ + 'input': (event: Event) => void; /** * Callback to invoke when a date is selected. * @param {Date} value - Selected value. diff --git a/src/components/calendar/Calendar.vue b/src/components/calendar/Calendar.vue index 64b01a3b5..6ada6aa95 100755 --- a/src/components/calendar/Calendar.vue +++ b/src/components/calendar/Calendar.vue @@ -2171,6 +2171,8 @@ export default { catch(err) { /* NoOp */ } + + this.$emit('input', event); }, onFocus() { if (this.showOnFocus && this.isEnabled()) { diff --git a/src/views/calendar/CalendarDoc.vue b/src/views/calendar/CalendarDoc.vue index 310fca93f..bdbf5fc41 100755 --- a/src/views/calendar/CalendarDoc.vue +++ b/src/views/calendar/CalendarDoc.vue @@ -457,6 +457,11 @@ export default { + + input + event + Callback to invoke when input field is being typed. + date-select value: Selected value