Hierarchy

  • default

Constructors

  • Parameters

    • inputElement: HTMLInputElement

      An HTML element inside which to place the currency input

    • Optional initialValue: string

      The default value to display. This also controls the amount of digits after the decimal separator. When omitted defaults to 0.00 (value 0 with two values after separator).

    • Optional initializer: FormatterInitializer

      A Moneydew MoneyFormatter initializer. Refer to Moneydew documentation. This controls the formatting of the input. When omitted defaults to settings of default constructor for MoneyFormatter.

    Returns default

Properties

_allowNegativeZero: boolean = false
_eventListener: ((e: InputEvent) => void)

Type declaration

    • (e: InputEvent): void
    • Parameters

      • e: InputEvent

      Returns void

_formatter: MoneyFormatter
_input: HTMLInputElement
_inputValue: string
_invalidCallback: null | (() => void) = null
_max: null | Money = null
_min: null | Money = null
_money: Money
_negPrefix: string
_negPrefixPattern: RegExp
_negSuffix: string
_negSuffixPattern: RegExp
_posPrefix: string
_posPrefixPattern: RegExp
_posSuffix: string
_posSuffixPattern: RegExp
_strictMode: boolean = false
_validCallback: null | (() => void) = null

Methods

  • Desc

    Add a value to the current input

    Parameters

    • value: string | Money

    Returns void

  • Desc

    If set to true, values like -0 or -0.00 cannot be entered. This only has an effect on the displayed value. Note that getValue doesn't return zero values with a leading dash either way, so it's not affected by this.

    Parameters

    • yes: boolean

    Returns void

  • Desc

    Disables the input element.

    Returns void

  • Desc

    Disables strict mode after enableStrictMode was called. When strict mode is disabled, the decimal separator can be deleted and so can the numbers to the right of the decimal separator. This allows for more flexibility when the user is typing but may require extra validation. Keep in my that getFormattedValue and getValue always return a valid value. Strict mode only controls the displayed value and user interaction.

    Returns void

  • Desc

    Enables the input element.

    Returns void

  • Desc

    Enables strict mode. In strict mode the decimal separator cannot be removed and typing with the caret touching the digits right of the decimal separator will overwrite the digit to the right of the caret. This implicitly means that the value held by the currency input is always valid. Keep in my that getFormattedValue and getValue always return a valid value. Strict mode only controls the displayed value and user interaction.

    Returns void

  • Desc

    Checks if currently held value is within boundaries and adjusts value accordingly.

    Returns

    A bool representing whether the previous value was out of bounds and an adjustment was made.

    Returns boolean

  • Desc

    Replaces the Moneydew formatter currently in use with a new one and automatically adjusts displayed value. It is not recommended to change this formatter afterward as the currency will not automatically register those changes.

    Parameters

    • f: FormatterInitializer

      The new formatter - refer to Moneydew documentation for details

    Returns void

  • Returns

    the current value of the input that is displayed. Missing decimal places are filled with zeroes.

    Returns string

  • Returns

    a string representing the currently held value matching the following pattern: ^(0|[1-9]\d*)\.\d{x,x}$ where x is the amount of current decimal places. Missing decimal places are filled with zeroes. This string can be easily converted to a number but be careful as it may be larger than the largest integer.

    Returns string

  • Parameters

    • e: InputEvent

    Returns void

  • Desc

    Allows specifying a callback function that is called after the user makes an invalid input. If a callback (for invalid input) has already been specified, the old one will be overwritten by the new one.

    Parameters

    • callback: (() => void)

      A parameterless function returning void

        • (): void
        • Returns void

    Returns void

  • Returns

    whether the input is disabled

    Returns boolean

  • Desc

    Detaches the input from the current input, and attaches to new one. Does nothing if old container is same as new one.

    Parameters

    • inputElement: HTMLInputElement

      The new element to mount to

    Returns void

  • Parameters

    • max: null | string

    Returns void

  • Desc

    Sets the lowest possible value that the input can hold. Defaults to zero. Set to null to remove lower limit. Use this function to allow input of negative values.

    Parameters

    • min: null | string

    Returns void

  • Desc

    Sets the current value held by the input. This implicitly determines the amount of decimal places displayed. If the input currently has a minimum and/or maximum defined and those have a different floating point precision from value, then those limits are removed.

    Parameters

    • value: string

    Returns void

  • Desc

    Subtract a value from the current input

    Parameters

    • value: string | Money

    Returns void

  • Desc

    Unmounts the currency input. Trying to use member functions other than remount after unmounting will result in undefined behaviour until remount is called or the variable has been overwritten by a new instance of IntlCurrencyInput. Note that you don't have to call this function before remount. This function is useful if you want to stop input restrictions on the input element. It is recommended to unmount before the currency input gets destroyed by the garbage collector. Otherwise, you end up with a rogue event listener on your input element.

    Returns void

  • Desc

    Allows specifying a callback function that is called after the user makes a valid input. If a callback (for valid input) has already been specified, the old one will be overwritten by the new one.

    Parameters

    • callback: (() => void)

      A parameterless function returning void

        • (): void
        • Returns void

    Returns void

Generated using TypeDoc