1.14.6 • Published 6 months ago

@types/jquery-mask-plugin v1.14.6

Weekly downloads
1,810
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/jquery-mask-plugin

Summary

This package contains type definitions for jQuery Mask Plugin (https://igorescobar.github.io/jQuery-Mask-Plugin/).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jquery-mask-plugin.

index.d.ts

// Type definitions for jQuery Mask Plugin 1.14
// Project: https://igorescobar.github.io/jQuery-Mask-Plugin/
// Definitions by: Anže Videnič <https://github.com/avidenic>
//                 Igor Escobar <http://www.igorescobar.com/>
//                 Anderson Friaça <https://github.com/AndersonFriaca>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

/// <reference types="jquery" />

declare namespace jQueryMask {
    interface Invalid {
        p: number;
        v: string;
        e: string;
    }

    interface Options {
        maskElements?: string | undefined;
        dataMaskAttr?: string | undefined;
        dataMask?: boolean | undefined;
        watchInterval?: number | undefined;
        watchInputs?: boolean | undefined;
        watchDataMask?: boolean | undefined;
        byPassKeys?: number[] | undefined;
        translation?: Translation | undefined;
        selectOnFocus?: boolean | undefined;
        reverse?: boolean | undefined;
        clearIfNotMatch?: boolean | undefined;
        placeholder?: string | undefined;
        onComplete?(value: string, e: Event, $element: JQuery, options: Options): void;
        onKeyPress?(value: string, e: Event, $element: JQuery, options: Options): void;
        onChange?(value: string, e: Event, $element: JQuery, options: Options): void;
        onInvalid?(value: string, e: Event, $element: JQuery, invalid: Invalid[], options: Options): void;
    }

    interface Pattern {
        pattern?: RegExp | undefined;
        recursive?: boolean | undefined;
        optional?: boolean | undefined;
        fallback?: string | undefined;
    }

    interface Translation {
        [key: string]: Pattern | {} | undefined;
        placeholder?: string | undefined;
    }
}

interface JQuery {
    /**
     * Applies the mask to the matching selector elements.
     * @param mask should be a string or a function.
     * @param options should be an options object.
     * @returns The element.
     */
    mask(mask: ((value: string) => string) | string, options?: jQueryMask.Options): JQuery;

    /**
     * Seek and destroy.
     * @returns The element.
     */
    unmask(): JQuery;

    /**
     * Gets the value of the field without the mask.
     * @returns Value without the mask.
     */
    cleanVal(): string;

    /**
     * Gets masked value programmatically
     * @returns Masked value.
     */
    masked(value: string): string;
}

Additional Details

  • Last updated: Thu, 08 Jul 2021 16:22:28 GMT
  • Dependencies: @types/jquery
  • Global values: none

Credits

These definitions were written by Anže Videnič, Igor Escobar, and Anderson Friaça.