primevue-mirror/components/lib/inputmask/InputMask.d.ts

232 lines
5.9 KiB
TypeScript
Raw Normal View History

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';
import { DefineComponent, DesignToken, EmitFn, 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 {
/**
* Defines instance.
*/
2023-07-26 07:58:30 +00:00
instance: any;
/**
* Defines valid properties.
*/
2023-07-26 07:58:30 +00:00
props: InputMaskProps;
/**
* Defines current options.
*/
2023-07-26 07:58:30 +00:00
context: InputMaskContext;
/**
* Defines valid attributes.
*/
attrs: any;
/**
* 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;
/**
* Placeholder text for the input.
*/
placeholder?: string | undefined;
2022-09-06 12:03:37 +00:00
/**
* 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;
/**
* It generates scoped CSS variables using design tokens for the component.
*/
dt?: DesignToken<any>;
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}
*/
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.
*/
2024-05-16 14:05:43 +00:00
export interface InputMaskEmitsOptions {
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
export declare type InputMaskEmits = EmitFn<InputMaskEmitsOptions>;
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
*
*/
declare const InputMask: DefineComponent<InputMaskProps, InputMaskSlots, InputMaskEmits>;
2022-09-06 12:03:37 +00:00
declare module 'vue' {
export interface GlobalComponents {
InputMask: GlobalComponentConstructor<InputMaskProps, InputMaskSlots, InputMaskEmits>;
2022-09-06 12:03:37 +00:00
}
}
export default InputMask;