2023-03-01 12:40:56 +00:00
|
|
|
/**
|
|
|
|
*
|
2023-03-01 12:59:47 +00:00
|
|
|
* InputMask component is used to enter input in a certain format such as numeric, date, currency, email and phone.
|
2023-03-01 12:40:56 +00:00
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/inputmask/)
|
|
|
|
*
|
|
|
|
* @module inputmask
|
|
|
|
*
|
|
|
|
*/
|
2023-07-06 11:17:08 +00:00
|
|
|
import { ComponentHooks } from '../basecomponent';
|
2024-03-18 10:02:00 +00:00
|
|
|
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, PassThrough } from '../ts-helpers';
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-07-26 07:58:30 +00:00
|
|
|
export declare type InputMaskPassThroughOptionType = InputMaskPassThroughAttributes | ((options: InputMaskPassThroughMethodOptions) => InputMaskPassThroughAttributes | string) | string | null | undefined;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface InputMaskPassThroughMethodOptions {
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines instance.
|
|
|
|
*/
|
2023-07-26 07:58:30 +00:00
|
|
|
instance: any;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties.
|
|
|
|
*/
|
2023-07-26 07:58:30 +00:00
|
|
|
props: InputMaskProps;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines current options.
|
|
|
|
*/
|
2023-07-26 07:58:30 +00:00
|
|
|
context: InputMaskContext;
|
2023-12-10 21:41:17 +00:00
|
|
|
/**
|
|
|
|
* Defines valid attributes.
|
|
|
|
*/
|
|
|
|
attrs: any;
|
2023-12-05 11:06:32 +00:00
|
|
|
/**
|
|
|
|
* Defines parent options.
|
|
|
|
*/
|
|
|
|
parent: any;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Defines passthrough(pt) options in global config.
|
|
|
|
*/
|
|
|
|
global: object | undefined;
|
2023-07-26 07:58:30 +00:00
|
|
|
}
|
2023-05-05 11:08:41 +00:00
|
|
|
|
2024-03-18 10:02:00 +00:00
|
|
|
/**
|
|
|
|
* Custom shared passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface InputMaskSharedPassThroughMethodOptions {
|
|
|
|
/**
|
|
|
|
* Defines valid properties.
|
|
|
|
*/
|
|
|
|
props: InputMaskProps;
|
|
|
|
}
|
|
|
|
|
2023-05-05 11:08:41 +00:00
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link InputMaskProps.pt}
|
|
|
|
*/
|
|
|
|
export interface InputMaskPassThroughOptions {
|
|
|
|
/**
|
2024-03-18 10:02:00 +00:00
|
|
|
* Used to pass attributes to the InputText component.
|
|
|
|
* @see {@link InputTextPassThroughOptions}
|
2023-05-05 11:08:41 +00:00
|
|
|
*/
|
2024-03-18 10:02:00 +00:00
|
|
|
root?: InputTextPassThroughOptions<InputMaskSharedPassThroughMethodOptions>;
|
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 11:08:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface InputMaskPassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
2023-07-26 07:58:30 +00:00
|
|
|
/**
|
|
|
|
* Defines current options in InputMask component.
|
|
|
|
*/
|
|
|
|
export interface InputMaskContext {
|
|
|
|
/**
|
|
|
|
* Current filled state of the component as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
filled: boolean;
|
|
|
|
/**
|
|
|
|
* Current disabled state of the component as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
disabled: boolean;
|
|
|
|
}
|
|
|
|
|
2023-03-01 12:40:56 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in InputMask component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface InputMaskProps {
|
|
|
|
/**
|
|
|
|
* Value of the component.
|
|
|
|
*/
|
|
|
|
modelValue?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Placeholder character in mask, default is underscore.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue _
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
slotChar?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Mask pattern.
|
|
|
|
*/
|
|
|
|
mask?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Clears the incomplete value on blur.
|
2023-03-01 12:40:56 +00:00
|
|
|
* @defaultValue true
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
autoClear?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Defines if model sets the raw unmasked value to bound value or the formatted mask value.
|
2023-03-01 12:40:56 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
unmask?: boolean | undefined;
|
2023-03-01 12:40:56 +00:00
|
|
|
/**
|
|
|
|
* Whether the items are clickable or not.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
readonly?: boolean | undefined;
|
2024-01-31 08:02:53 +00:00
|
|
|
/**
|
|
|
|
* When present, it specifies that the component should have invalid state style.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
invalid?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Specifies the input variant of the component.
|
|
|
|
* @defaultValue outlined
|
|
|
|
*/
|
|
|
|
variant?: 'outlined' | 'filled' | undefined;
|
2024-03-18 10:02:00 +00:00
|
|
|
/**
|
|
|
|
* When present, it specifies that the component should be disabled.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
disabled?: boolean | undefined;
|
2023-05-05 11:08:41 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to DOM elements inside the component.
|
2023-05-05 11:08:41 +00:00
|
|
|
* @type {InputMaskPassThroughOptions}
|
|
|
|
*/
|
2023-09-05 11:28:04 +00:00
|
|
|
pt?: PassThrough<InputMaskPassThroughOptions>;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Used to configure passthrough(pt) options of the component.
|
|
|
|
* @type {PassThroughOptions}
|
|
|
|
*/
|
|
|
|
ptOptions?: PassThroughOptions;
|
2023-05-24 10:28:20 +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-07-26 07:58:30 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in InputMask component.
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
export interface InputMaskSlots {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 12:40:56 +00:00
|
|
|
/**
|
|
|
|
* Defines valid emits in InputMask component.
|
|
|
|
*/
|
|
|
|
export interface InputMaskEmits {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Emitted when the value changes.
|
|
|
|
* @param {string} value - New value.
|
|
|
|
*/
|
2023-03-01 12:40:56 +00:00
|
|
|
'update:modelValue'(value: string): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when the component receives focus.
|
|
|
|
*/
|
2023-03-01 12:40:56 +00:00
|
|
|
focus(event: Event): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when the component loses focus.
|
|
|
|
*/
|
2023-03-01 12:40:56 +00:00
|
|
|
blur(event: Event): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when a key is pressed.
|
|
|
|
*/
|
2023-03-01 12:40:56 +00:00
|
|
|
keydown(event: Event): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when a key that produces a character value is pressed down.
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
keypress: (event: Event) => void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when the user has initiated a 'paste' action through the browser's user interface.
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
paste: (event: Event) => void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when the mask is completed.
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
complete: (event: Event) => void;
|
2023-03-01 12:40:56 +00:00
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 12:40:56 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - InputMask**
|
|
|
|
*
|
2023-03-01 12:59:47 +00:00
|
|
|
* _InputMask component is used to enter input in a certain format such as numeric, date, currency, email and phone._
|
2023-03-01 12:40:56 +00:00
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/inputmask/)
|
|
|
|
* --- ---
|
2023-03-03 10:55:20 +00:00
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
2023-03-01 12:40:56 +00:00
|
|
|
*
|
|
|
|
* @group Component
|
|
|
|
*
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
declare class InputMask extends ClassComponent<InputMaskProps, InputMaskSlots, InputMaskEmits> {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
InputMask: GlobalComponentConstructor<InputMask>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default InputMask;
|