From aba41078f9dc80318b0212cc66c615dc656aa499 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: Tue, 1 Mar 2022 12:45:08 +0300 Subject: [PATCH] Fixed #2235 - Added InputNumber focus and blur events --- api-generator/components/inputnumber.js | 27 +++++++++++++++++++++ src/components/inputnumber/InputNumber.d.ts | 27 ++++++++++++++++++++- src/components/inputnumber/InputNumber.vue | 10 +++++--- src/views/inputnumber/InputNumberDoc.vue | 12 +++++++++ 4 files changed, 72 insertions(+), 4 deletions(-) diff --git a/api-generator/components/inputnumber.js b/api-generator/components/inputnumber.js index c29ec3e20..a26c00166 100644 --- a/api-generator/components/inputnumber.js +++ b/api-generator/components/inputnumber.js @@ -173,6 +173,33 @@ const InputNumberEvents = [ description: "New value" } ] + }, + { + name: "focus", + description: "Callback to invoke on focus of input field.", + arguments: [ + { + name: "event", + type: "object", + description: "Focus event" + } + ] + }, + { + name: "blur", + description: "Callback to invoke on blur of input field.", + arguments: [ + { + name: "event.originalEvent", + type: "object", + description: "Browser event" + }, + { + name: "event.value", + type: "string", + description: "Input value" + } + ] } ]; diff --git a/src/components/inputnumber/InputNumber.d.ts b/src/components/inputnumber/InputNumber.d.ts index c674ff1d0..94c6424ef 100755 --- a/src/components/inputnumber/InputNumber.d.ts +++ b/src/components/inputnumber/InputNumber.d.ts @@ -17,6 +17,17 @@ export interface InputNumberInputEvent { value: string | number | undefined; } +export interface InputNumberBlurEvent { + /** + * Browser event + */ + originalEvent: Event; + /** + * Input value + */ + value: string; +} + export interface InputNumberProps { /** * Value of the component. @@ -149,11 +160,25 @@ export declare type InputNumberEmits = { * @param {number} value - New value. */ 'update:modelValue': (value: number) => void; - /** + /** * Callback to invoke when the value is entered. * @param {InputNumberInputEvent} event - Custom input event. */ 'input': (event: InputNumberInputEvent) => void; + /** + * Callback to invoke on focus of input field. + * @param {Event} event - Focus event + */ + 'focus': (event: Event) => void; + /** + * Callback to invoke on blur of input field. + * @param {InputNumberBlurEvent} event - Blur event + */ + 'blur': (event: InputNumberBlurEvent) => void; + /** + * Callback to invoke when a key is pressed. + */ + 'keydown': (event: Event) => void; } declare class InputNumber extends ClassComponent { diff --git a/src/components/inputnumber/InputNumber.vue b/src/components/inputnumber/InputNumber.vue index ad25accbc..03774246a 100755 --- a/src/components/inputnumber/InputNumber.vue +++ b/src/components/inputnumber/InputNumber.vue @@ -1,7 +1,7 @@