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';
|
2023-09-05 08:50:46 +00:00
|
|
|
import { PassThroughOptions } from '../passthrough';
|
2023-08-17 23:51:01 +00:00
|
|
|
import { ClassComponent, GlobalComponentConstructor, PTOptions } 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-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
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link InputMaskProps.pt}
|
|
|
|
*/
|
|
|
|
export interface InputMaskPassThroughOptions {
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the root's DOM element.
|
2023-05-05 11:08:41 +00:00
|
|
|
*/
|
|
|
|
root?: InputMaskPassThroughOptionType;
|
2023-07-06 11:09:01 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +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;
|
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-08-17 23:51:01 +00:00
|
|
|
pt?: PTOptions<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;
|