Refactor #3922 - For InputNumber

This commit is contained in:
Tuğçe Küçükoğlu 2023-05-05 15:56:22 +03:00
parent 409005b671
commit ee16b59f15
4 changed files with 90 additions and 11 deletions

View file

@ -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;
}
/**