diff --git a/api-generator/components/inputnumber.js b/api-generator/components/inputnumber.js index 9204a3c80..e3587c5bc 100644 --- a/api-generator/components/inputnumber.js +++ b/api-generator/components/inputnumber.js @@ -182,6 +182,12 @@ const InputNumberProps = [ type: 'object', default: 'null', description: 'Uses to pass all properties of the HTMLButtonElement to decrement button inside the component.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/components/lib/config/PrimeVue.d.ts b/components/lib/config/PrimeVue.d.ts index 7594bd442..1cc8a8e37 100644 --- a/components/lib/config/PrimeVue.d.ts +++ b/components/lib/config/PrimeVue.d.ts @@ -31,6 +31,7 @@ import { ImagePassThroughOptions } from '../image'; import { InlineMessagePassThroughOptions } from '../inlinemessage'; import { InplacePassThroughOptions } from '../inplace'; import { InputMaskPassThroughOptions } from '../inputmask'; +import { InputNumberPassThroughOptions } from '../inputnumber'; import { InputTextPassThroughOptions } from '../inputtext'; import { MegaMenuPassThroughOptions } from '../megamenu'; import { MenuPassThroughOptions } from '../menu'; @@ -108,6 +109,7 @@ interface PrimeVuePTOptions { inlinemessage?: InlineMessagePassThroughOptions; inplace?: InplacePassThroughOptions; inputmask?: InputMaskPassThroughOptions; + inputnumber?: InputNumberPassThroughOptions; inputtext?: InputTextPassThroughOptions; megamenu?: MegaMenuPassThroughOptions; menu?: MenuPassThroughOptions; diff --git a/components/lib/inputnumber/InputNumber.d.ts b/components/lib/inputnumber/InputNumber.d.ts index 47ab67606..3cb6edd5f 100755 --- a/components/lib/inputnumber/InputNumber.d.ts +++ b/components/lib/inputnumber/InputNumber.d.ts @@ -8,8 +8,20 @@ * */ import { ButtonHTMLAttributes, InputHTMLAttributes, VNode } from 'vue'; +import { ButtonPassThroughOptionType } from '../button'; +import { InputTextPassThroughOptionType } from '../inputtext'; import { ClassComponent, GlobalComponentConstructor, Nullable } from '../ts-helpers'; +export declare type InputNumberPassThroughOptionType = InputNumberPassThroughAttributes | ((options: InputNumberPassThroughMethodOptions) => InputNumberPassThroughAttributes) | null | undefined; + +/** + * Custom passthrough(pt) option method. + */ +export interface InputNumberPassThroughMethodOptions { + props: InputNumberProps; + state: InputNumberState; +} + /** * Custom input event. * @see {@link InputNumberEmits.input} @@ -40,6 +52,58 @@ export interface InputNumberBlurEvent { value: string; } +/** + * Custom passthrough(pt) options. + * @see {@link InputNumberProps.pt} + */ +export interface InputNumberPassThroughOptions { + /** + * Uses to pass attributes to the root's DOM element. + */ + root?: InputNumberPassThroughOptionType; + /** + * Uses to pass attributes to the Input component. + * @see {@link InputTextPassThroughOptionType} + */ + input?: InputTextPassThroughOptionType; + /** + * Uses to pass attributes to the button group's DOM element. + */ + buttonGroup?: InputNumberPassThroughOptionType; + /** + * Uses to pass attributes to the Button component. + * @see {@link ButtonPassThroughOptions} + */ + incrementButton?: ButtonPassThroughOptionType; + /** + * Uses to pass attributes to the Button component. + * @see {@link ButtonPassThroughOptions} + */ + decrementButton?: ButtonPassThroughOptionType; +} + +/** + * Custom passthrough attributes for each DOM elements + */ +export interface InputNumberPassThroughAttributes { + [key: string]: any; +} + +/** + * Defines current inline state in InputNumber component. + */ +export interface InputNumberState { + /** + * Current value state as a number. + */ + d_modelValue: number; + /** + * Current focused state as a boolean. + * @defaultValue false + */ + focused: boolean; +} + /** * Defines valid properties in InputNumber component. */ @@ -198,6 +262,11 @@ export interface InputNumberProps { * Establishes a string value that labels the component. */ 'aria-label'?: string | undefined; + /** + * Uses to pass attributes to DOM elements inside the component. + * @type {InputNumberPassThroughOptions} + */ + pt?: InputNumberPassThroughOptions; } /** diff --git a/components/lib/inputnumber/InputNumber.vue b/components/lib/inputnumber/InputNumber.vue index 444f9db87..7b0b4cfe1 100755 --- a/components/lib/inputnumber/InputNumber.vue +++ b/components/lib/inputnumber/InputNumber.vue @@ -1,5 +1,5 @@