From 586936fd95c755b5e3188496b2c76c79c72e80ef Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Mon, 18 Mar 2024 13:02:11 +0300 Subject: [PATCH] Refactor #5426 - For InputNumber --- components/lib/inputnumber/InputNumber.d.ts | 73 +++++++++++++++-- components/lib/inputnumber/InputNumber.vue | 81 +++++++++---------- .../lib/inputnumber/style/InputNumberStyle.js | 10 +-- 3 files changed, 105 insertions(+), 59 deletions(-) diff --git a/components/lib/inputnumber/InputNumber.d.ts b/components/lib/inputnumber/InputNumber.d.ts index fdf35efd3..6b0b66038 100755 --- a/components/lib/inputnumber/InputNumber.d.ts +++ b/components/lib/inputnumber/InputNumber.d.ts @@ -9,7 +9,6 @@ */ import { ButtonHTMLAttributes, InputHTMLAttributes, VNode } from 'vue'; import { ComponentHooks } from '../basecomponent'; -import { ButtonPassThroughOptions } from '../button'; import { InputTextPassThroughOptions } from '../inputtext'; import { PassThroughOptions } from '../passthrough'; import { ClassComponent, GlobalComponentConstructor, Nullable, PassThrough } from '../ts-helpers'; @@ -107,15 +106,13 @@ export interface InputNumberPassThroughOptions { */ buttonGroup?: InputNumberPassThroughOptionType; /** - * Used to pass attributes to the Button component. - * @see {@link ButtonPassThroughOptions} + * Used to pass attributes to the increment button's DOM element. */ - incrementButton?: ButtonPassThroughOptions; + incrementButton?: InputNumberPassThroughOptionType; /** - * Used to pass attributes to the Button component. - * @see {@link ButtonPassThroughOptions} + * Used to pass attributes to the decrement button's DOM element. */ - decrementButton?: ButtonPassThroughOptions; + decrementButton?: InputNumberPassThroughOptionType; /** * Used to manage all lifecycle hooks. * @see {@link BaseComponent.ComponentHooks} @@ -240,7 +237,7 @@ export interface InputNumberProps { */ roundingMode?: RoundingMode; /** - * Mininum boundary value. + * Minimum boundary value. */ min?: number | undefined; /** @@ -339,6 +336,66 @@ export interface InputNumberProps { * Defines valid slots in InputNumber component. */ export interface InputNumberSlots { + /** + * Custom increment button template. + */ + incrementbutton(scope: { + /** + * Mouse down event of increment button. + * @param {Event} event - Browser event + */ + onMousedown: (event: Event) => void; + /** + * Mouse up event of increment button. + * @param {Event} event - Browser event + */ + onMouseup: (event: Event) => void; + /** + * Mouse leave event of increment button. + * @param {Event} event - Browser event + */ + onMouseleave: (event: Event) => void; + /** + * Key down event of increment button. + * @param {Event} event - Browser event + */ + onKeydown: (event: Event) => void; + /** + * Key up event of increment button. + * @param {Event} event - Browser event + */ + onKeyup: (event: Event) => void; + }): VNode[]; + /** + * Custom decrement button template. + */ + decrementbutton(scope: { + /** + * Mouse down event of decrement button. + * @param {Event} event - Browser event + */ + onMousedown: (event: Event) => void; + /** + * Mouse up event of decrement button. + * @param {Event} event - Browser event + */ + onMouseup: (event: Event) => void; + /** + * Mouse leave event of decrement button. + * @param {Event} event - Browser event + */ + onMouseleave: (event: Event) => void; + /** + * Key down event of decrement button. + * @param {Event} event - Browser event + */ + onKeydown: (event: Event) => void; + /** + * Key up event of decrement button. + * @param {Event} event - Browser event + */ + onKeyup: (event: Event) => void; + }): VNode[]; /** * Custom increment button icon template. */ diff --git a/components/lib/inputnumber/InputNumber.vue b/components/lib/inputnumber/InputNumber.vue index 1f7a3201b..b76c4bd2b 100755 --- a/components/lib/inputnumber/InputNumber.vue +++ b/components/lib/inputnumber/InputNumber.vue @@ -15,7 +15,8 @@ :placeholder="placeholder" :aria-labelledby="ariaLabelledby" :aria-label="ariaLabel" - :aria-invalid="invalid || undefined" + :invalid="invalid" + :variant="variant" @input="onUserInput" @keydown="onInputKeyDown" @paste="onPaste" @@ -27,60 +28,55 @@ :unstyled="unstyled" /> - - + + - - + +