Class Masked<Value>Abstract

Provides common masking stuff

Type Parameters

  • Value = any

Hierarchy (view full)

Constructors

  • Type Parameters

    • Value = any

    Parameters

    • opts: Partial<Pick<Masked<any>, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid" | "autofix">>

    Returns Masked<Value>

Properties

_initialized: boolean
_isolated?: boolean
_refreshing?: boolean
_value: string
autofix?: boolean | "pad"
commit?: ((value, masked) => void)

Does additional processing at the end of editing

Type declaration

    • (value, masked): void
    • Parameters

      • value: string
      • masked: Masked<any>

      Returns void

eager?: boolean | "remove" | "append"
format?: ((value, masked) => string)

Format typed value to string

Type declaration

    • (value, masked): string
    • Parameters

      Returns string

mask: unknown
overwrite?: boolean | "shift"

Enable characters overwriting

parent?: Masked<any>
parse?: ((str, masked) => Value)

Parse string to get typed value

Type declaration

prepare?: ((chars, masked, flags) => string | [string, ChangeDetails])

Transforms value before mask processing

Type declaration

prepareChar?: ((chars, masked, flags) => string | [string, ChangeDetails])

Transforms each char before mask processing

Type declaration

skipInvalid?: boolean
validate?: ((value, masked, flags) => boolean)

Validates if value is acceptable

Type declaration

DEFAULTS: Pick<Partial<Pick<Masked<any>, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid" | "autofix">>, "skipInvalid"> = ...
EMPTY_VALUES: any[] = ...

Accessors

  • get rawInputValue(): string
  • Value that includes raw user input

    Returns string

  • set rawInputValue(value): void
  • Parameters

    • value: string

    Returns void

Methods

  • Sets new options

    Parameters

    • opts: Partial<Partial<Pick<Masked<any>, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid" | "autofix">>>

    Returns void

  • Does additional processing at the end of editing

    Returns void

  • Extracts value in range considering flags

    Parameters

    • fromPos: number = 0
    • toPos: number = ...
    • Optional flags: ExtractFlags

    Returns string

  • Finds nearest input position in direction

    Parameters

    • cursorPos: number
    • Optional direction: Direction

    Returns number

  • Parameters

    • opts: Partial<Partial<Pick<Masked<any>, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid" | "autofix">>>

    Returns boolean

  • Type Parameters

    • T

    Parameters

    • fn: ((masked) => T)
        • (masked): T
        • Parameters

          • masked: this

          Returns T

    Returns T

  • Parameters

    • fromPos: number = 0
    • toPos: number = ...

    Returns number

  • Parameters

    • value: any

    Returns boolean

  • Sets and applies new options

    Parameters

    • opts: Partial<Partial<Pick<Masked<any>, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid" | "autofix">>>

    Returns void

  • Calls function and reapplies current value

    Type Parameters

    • T

    Parameters

    • fn: (() => T)
        • (): T
        • Returns T

    Returns T