2023-03-01 08:50:31 +00:00
/ * *
*
* InputNumber is an input component to provide numerical input .
*
* [ Live Demo ] ( https : //www.primevue.org/inputnumber/)
*
* @module inputnumber
*
* /
2023-04-04 12:40:30 +00:00
import { ButtonHTMLAttributes , InputHTMLAttributes , VNode } from 'vue' ;
2023-07-06 11:17:08 +00:00
import { ComponentHooks } from '../basecomponent' ;
2023-12-05 07:06:55 +00:00
import { ButtonPassThroughOptions } from '../button' ;
import { InputTextPassThroughOptions } from '../inputtext' ;
2023-09-05 08:50:46 +00:00
import { PassThroughOptions } from '../passthrough' ;
2023-09-05 11:28:04 +00:00
import { ClassComponent , GlobalComponentConstructor , Nullable , PassThrough } from '../ts-helpers' ;
2022-09-06 12:03:37 +00:00
2023-12-22 00:25:54 +00:00
export declare type RoundingMode = 'ceil' | 'floor' | 'expand' | 'trunc' | 'halfCeil' | 'halfFloor' | 'halfExpand' | 'halfTrunc' | 'halfEven' ;
2023-12-22 00:24:57 +00:00
2023-12-05 07:06:55 +00:00
export declare type InputNumberPassThroughOptionType < T = any > = InputNumberPassThroughAttributes | ( ( options : InputNumberPassThroughMethodOptions < T > ) = > InputNumberPassThroughAttributes | string ) | string | null | undefined ;
2023-05-05 12:56:22 +00:00
/ * *
* Custom passthrough ( pt ) option method .
* /
2023-12-05 07:06:55 +00:00
export interface InputNumberPassThroughMethodOptions < T > {
2023-09-05 06:50:04 +00:00
/ * *
* Defines instance .
* /
2023-07-06 12:01:33 +00:00
instance : any ;
2023-09-05 06:50:04 +00:00
/ * *
* Defines valid properties .
* /
2023-05-05 12:56:22 +00:00
props : InputNumberProps ;
2023-09-05 06:50:04 +00:00
/ * *
* Defines current inline state .
* /
2023-05-05 12:56:22 +00:00
state : InputNumberState ;
2023-12-05 07:06:55 +00:00
/ * *
* Defines parent instance .
* /
parent : T ;
2023-09-05 08:50:46 +00:00
/ * *
* Defines passthrough ( pt ) options in global config .
* /
global : object | undefined ;
2023-05-05 12:56:22 +00:00
}
2023-12-05 07:06:55 +00:00
/ * *
* Custom shared passthrough ( pt ) option method .
* /
export interface InputNumberSharedPassThroughMethodOptions {
/ * *
* Defines valid properties .
* /
props : InputNumberProps ;
/ * *
* Defines current inline state .
* /
state : InputNumberState ;
}
2023-03-01 08:50:31 +00:00
/ * *
* Custom input event .
2023-03-06 20:35:39 +00:00
* @see { @link InputNumberEmits . input }
2023-03-01 08:50:31 +00:00
* /
2022-09-06 12:03:37 +00:00
export interface InputNumberInputEvent {
/ * *
* Browser event
* /
originalEvent : Event ;
/ * *
* New value
* /
value : string | number | undefined ;
2024-04-19 09:21:20 +00:00
/ * *
* currentValue
* /
formattedValue : string ;
2022-09-06 12:03:37 +00:00
}
2023-03-01 08:50:31 +00:00
/ * *
* Custom blur event .
2023-03-06 20:35:39 +00:00
* @see { @link InputNumberEmits . blur }
2023-03-01 08:50:31 +00:00
* /
2022-09-06 12:03:37 +00:00
export interface InputNumberBlurEvent {
/ * *
* Browser event
* /
originalEvent : Event ;
/ * *
* Input value
* /
value : string ;
}
2023-05-05 12:56:22 +00:00
/ * *
* Custom passthrough ( pt ) options .
* @see { @link InputNumberProps . pt }
* /
2023-12-05 07:06:55 +00:00
export interface InputNumberPassThroughOptions < T = any > {
2023-05-05 12:56:22 +00:00
/ * *
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the root ' s DOM element .
2023-05-05 12:56:22 +00:00
* /
2023-12-05 07:06:55 +00:00
root? : InputNumberPassThroughOptionType < T > ;
2023-05-05 12:56:22 +00:00
/ * *
2023-12-05 07:06:55 +00:00
* Used to pass attributes to the InputText component .
* @see { @link InputTextPassThroughOptions }
2023-05-05 12:56:22 +00:00
* /
2023-12-05 07:06:55 +00:00
input? : InputTextPassThroughOptions < InputNumberSharedPassThroughMethodOptions > ;
2023-05-05 12:56:22 +00:00
/ * *
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the button group ' s DOM element .
2023-05-05 12:56:22 +00:00
* /
2023-12-05 07:06:55 +00:00
buttonGroup? : InputNumberPassThroughOptionType < T > ;
2023-05-05 12:56:22 +00:00
/ * *
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the Button component .
2023-05-05 12:56:22 +00:00
* @see { @link ButtonPassThroughOptions }
* /
2023-12-05 07:06:55 +00:00
incrementButton? : ButtonPassThroughOptions < InputNumberSharedPassThroughMethodOptions > ;
2023-05-05 12:56:22 +00:00
/ * *
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the Button component .
2023-05-05 12:56:22 +00:00
* @see { @link ButtonPassThroughOptions }
* /
2023-12-05 07:06:55 +00:00
decrementButton? : ButtonPassThroughOptions < InputNumberSharedPassThroughMethodOptions > ;
2023-07-06 11:09:01 +00:00
/ * *
2023-11-07 06:16:39 +00:00
* Used to manage all lifecycle hooks .
2023-07-06 11:09:01 +00:00
* @see { @link BaseComponent . ComponentHooks }
* /
hooks? : ComponentHooks ;
2023-05-05 12:56:22 +00:00
}
/ * *
* 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 ;
}
2023-03-01 08:50:31 +00:00
/ * *
* Defines valid properties in InputNumber component .
* /
2022-09-06 12:03:37 +00:00
export interface InputNumberProps {
/ * *
* Value of the component .
* /
modelValue? : Nullable < number > ;
/ * *
* Whether to format the value .
2023-03-01 08:50:31 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
* /
format? : boolean | undefined ;
/ * *
* Displays spinner buttons .
2023-03-01 08:50:31 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
* /
showButtons? : boolean | undefined ;
/ * *
* Layout of the buttons .
2023-03-08 10:51:52 +00:00
* @defaultValue stacked
2022-09-06 12:03:37 +00:00
* /
2023-03-01 08:50:31 +00:00
buttonLayout ? : 'stacked' | 'horizontal' | 'vertical' | undefined ;
2022-09-06 12:03:37 +00:00
/ * *
* Style class of the increment button .
* /
incrementButtonClass? : string | undefined ;
/ * *
* Style class of the decrement button .
* /
decrementButtonClass? : string | undefined ;
/ * *
* Style class of the increment button .
2023-04-18 10:51:10 +00:00
* @deprecated since v3 . 27.0 . Use 'incrementbuttonicon' slot .
2022-09-06 12:03:37 +00:00
* /
incrementButtonIcon? : string | undefined ;
/ * *
* Style class of the decrement button .
2023-04-18 10:51:10 +00:00
* @deprecated since v3 . 27.0 . Use 'decrementbuttonicon' slot .
2022-09-06 12:03:37 +00:00
* /
decrementButtonIcon? : string | undefined ;
/ * *
* Locale to be used in formatting .
* /
locale? : string | undefined ;
/ * *
* The locale matching algorithm to use . Possible values are 'lookup' and 'best fit' ; the default is 'best fit' .
* See [ Locale Negotation ] ( https : //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_negotiation) for details.
2023-03-08 10:51:52 +00:00
* @defaultValue best fit
2022-09-06 12:03:37 +00:00
* /
2023-03-01 08:50:31 +00:00
localeMatcher ? : 'lookup' | 'best fit' | undefined ;
2022-09-06 12:03:37 +00:00
/ * *
* Defines the behavior of the component .
2023-03-08 10:51:52 +00:00
* @defaultValue decimal
2022-09-06 12:03:37 +00:00
* /
2023-03-01 08:50:31 +00:00
mode ? : 'decimal' | 'currency' | undefined ;
2022-09-06 12:03:37 +00:00
/ * *
* Text to display before the value .
* /
prefix? : string | undefined ;
/ * *
* Text to display after the value .
* /
suffix? : string | undefined ;
/ * *
* The currency to use in currency formatting . Possible values are the [ ISO 4217 currency codes ] ( https : //www.six-group.com/en/products-services/financial-information/data-standards.html#scrollTo=maintenance-agency), such as 'USD' for the US dollar, 'EUR' for the euro, or 'CNY' for the Chinese RMB.
* There is no default value ; if the style is 'currency' , the currency property must be provided .
* /
currency? : string | undefined ;
/ * *
* How to display the currency in currency formatting . Possible values are 'symbol' to use a localized currency symbol such as € , 'code' to use the ISO currency code , 'name' to use a localized currency name such as 'dollar' .
2023-03-08 10:51:52 +00:00
* @defaultValue symbol
2022-09-06 12:03:37 +00:00
* /
currencyDisplay? : string | undefined ;
/ * *
* Whether to use grouping separators , such as thousands separators or thousand / lakh / crore separators .
2023-03-01 08:50:31 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
* /
useGrouping? : boolean | undefined ;
/ * *
* The minimum number of fraction digits to use . Possible values are from 0 to 20 ; the default for plain number and percent formatting is 0 ;
* the default for currency formatting is the number of minor unit digits provided by the [ ISO 4217 currency code ] ( https : //www.six-group.com/en/products-services/financial-information/data-standards.html#scrollTo=maintenance-agency) list (2 if the list doesn't provide that information).
* /
minFractionDigits? : number | undefined ;
/ * *
* The maximum number of fraction digits to use . Possible values are from 0 to 20 ; the default for plain number formatting is the larger of minimumFractionDigits and 3 ;
* the default for currency formatting is the larger of minimumFractionDigits and the number of minor unit digits provided by the [ ISO 4217 currency code ] ( https : //www.six-group.com/en/products-services/financial-information/data-standards.html#scrollTo=maintenance-agency) list (2 if the list doesn't provide that information).
* /
maxFractionDigits? : number | undefined ;
2023-12-22 00:24:57 +00:00
/ * *
* How decimals should be rounded .
* The default value is ` "halfExpand" ` , [ further information ] ( https : //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#roundingmode).
* /
roundingMode? : RoundingMode ;
2022-09-06 12:03:37 +00:00
/ * *
* Mininum boundary value .
* /
min? : number | undefined ;
/ * *
* Maximum boundary value .
* /
max? : number | undefined ;
/ * *
* Step factor to increment / decrement the value .
2023-03-01 08:50:31 +00:00
* @defaultValue 1
2022-09-06 12:03:37 +00:00
* /
step? : number | undefined ;
/ * *
* Determines whether the input field is empty .
2023-03-01 08:50:31 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
* /
allowEmpty? : boolean | undefined ;
2022-12-08 11:04:25 +00:00
/ * *
* Highlights automatically the input value .
2023-03-01 08:50:31 +00:00
* @defaultValue false
2022-12-08 11:04:25 +00:00
* /
highlightOnFocus? : boolean | undefined ;
2024-01-30 11:27:56 +00:00
/ * *
* When present , it specifies that the component should have invalid state style .
* @defaultValue false
* /
invalid? : boolean | undefined ;
2022-09-06 12:03:37 +00:00
/ * *
* When present , it specifies that the component should be disabled .
2023-03-01 08:50:31 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
* /
disabled? : boolean | undefined ;
2024-01-31 08:02:53 +00:00
/ * *
* Specifies the input variant of the component .
* @defaultValue outlined
* /
variant ? : 'outlined' | 'filled' | undefined ;
2022-09-06 12:03:37 +00:00
/ * *
* When present , it specifies that an input field is read - only .
2023-03-01 08:50:31 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
* /
readonly ? : boolean | undefined ;
/ * *
* Placeholder text for the input .
* /
placeholder? : string | undefined ;
/ * *
* Identifier of the focus input to match a label defined for the chips .
* /
inputId? : string | undefined ;
/ * *
* Style class of the input field .
* /
2023-03-09 07:02:25 +00:00
inputClass? : string | object | undefined ;
2022-09-06 12:03:37 +00:00
/ * *
* Inline style of the input field .
* /
2023-03-09 07:02:25 +00:00
inputStyle? : object | undefined ;
2022-09-06 12:03:37 +00:00
/ * *
2023-08-01 14:01:12 +00:00
* Used to pass all properties of the HTMLInputElement to the focusable input element inside the component .
2022-09-06 12:03:37 +00:00
* /
inputProps? : InputHTMLAttributes | undefined ;
/ * *
2023-08-01 14:01:12 +00:00
* Used to pass all properties of the HTMLButtonElement to increment button inside the component .
2022-09-06 12:03:37 +00:00
* /
incrementButtonProps? : ButtonHTMLAttributes | undefined ;
/ * *
2023-08-01 14:01:12 +00:00
* Used to pass all properties of the HTMLButtonElement to decrement button inside the component .
2022-09-06 12:03:37 +00:00
* /
decrementButtonProps? : ButtonHTMLAttributes | undefined ;
/ * *
* Establishes relationships between the component and label ( s ) where its value should be one or more element IDs .
* /
2023-11-24 12:21:54 +00:00
ariaLabelledby? : string | undefined ;
2022-09-06 12:03:37 +00:00
/ * *
* Establishes a string value that labels the component .
* /
2023-11-24 12:21:54 +00:00
ariaLabel? : string | undefined ;
2023-05-05 12:56:22 +00:00
/ * *
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component .
2023-05-05 12:56:22 +00:00
* @type { InputNumberPassThroughOptions }
* /
2023-09-05 11:28:04 +00:00
pt? : PassThrough < InputNumberPassThroughOptions > ;
2023-09-05 08:50:46 +00:00
/ * *
* Used to configure passthrough ( pt ) options of the component .
* @type { PassThroughOptions }
* /
ptOptions? : PassThroughOptions ;
2023-05-24 11:03:56 +00:00
/ * *
* When enabled , it removes component related styles in the core .
* @defaultValue false
* /
unstyled? : boolean ;
2022-09-06 12:03:37 +00:00
}
2023-03-01 08:50:31 +00:00
/ * *
* Defines valid slots in InputNumber component .
* /
2023-04-04 12:40:30 +00:00
export interface InputNumberSlots {
/ * *
* Custom increment button icon template .
* /
incrementbuttonicon ( ) : VNode [ ] ;
/ * *
* Custom decrement button icon template .
* /
decrementbuttonicon ( ) : VNode [ ] ;
}
2022-09-06 12:03:37 +00:00
2023-03-01 08:50:31 +00:00
/ * *
* Defines valid emits in InputNumber component .
* /
export interface InputNumberEmits {
2022-09-06 12:03:37 +00:00
/ * *
* Emitted when the value changes .
* @param { number } value - New value .
* /
2023-03-01 08:50:31 +00:00
'update:modelValue' ( value : number ) : void ;
2022-09-06 12:03:37 +00:00
/ * *
2022-09-14 11:26:01 +00:00
* Callback to invoke when the value is entered .
* @param { InputNumberInputEvent } event - Custom input event .
* /
2023-03-01 08:50:31 +00:00
input ( event : InputNumberInputEvent ) : void ;
2022-09-06 12:03:37 +00:00
/ * *
* Callback to invoke on focus of input field .
* @param { Event } event - Focus event
* /
2023-03-01 08:50:31 +00:00
focus ( event : Event ) : void ;
2022-09-06 12:03:37 +00:00
/ * *
2022-09-14 11:26:01 +00:00
* Callback to invoke on blur of input field .
* @param { InputNumberBlurEvent } event - Blur event
* /
2023-03-01 08:50:31 +00:00
blur ( event : InputNumberBlurEvent ) : void ;
}
2022-09-06 12:03:37 +00:00
2023-03-01 08:50:31 +00:00
/ * *
* * * PrimeVue - InputNumber * *
*
* _InputNumber is an input component to provide numerical input . _
*
* [ Live Demo ] ( https : //www.primevue.org/inputnumber/)
* -- - -- -
* ! [ PrimeVue ] ( https : //primefaces.org/cdn/primevue/images/logo-100.png)
*
* @group Component
* /
2023-03-01 14:48:23 +00:00
declare class InputNumber extends ClassComponent < InputNumberProps , InputNumberSlots , InputNumberEmits > {
2022-09-06 12:03:37 +00:00
/ * *
* Returns Intl . NumberFormat object .
*
* @memberof InputNumber
* /
getFormatter : ( ) = > Intl . NumberFormat | undefined ;
}
2024-03-14 22:58:11 +00:00
declare module 'vue' {
export interface GlobalComponents {
2022-09-14 11:26:01 +00:00
InputNumber : GlobalComponentConstructor < InputNumber > ;
2022-09-06 12:03:37 +00:00
}
}
export default InputNumber ;