Options
All
  • Public
  • Public/Protected
  • All
Menu

Whenever {@link init} is used to initialize other DOM elements, a shared local init list of those elements is stored in the AutoNumeric instances.

This allows for neat things like modifying all those linked AutoNumeric elements globally, with only one call.

Use the {@link AutoNumeric.global} property to access the handler that provides methods to modify all linked elements.

Hierarchy

  • AutoNumericGlobal

Index

Methods

  • addObject(element: HTMLElement | export=): void
  • Add an existing AutoNumeric object (or DOM element) to the local AutoNumeric element list, using the DOM element as the key. This manages the case where addObject is used on an AutoNumeric object that already has multiple elements in its local list.

    Parameters

    • element: HTMLElement | export=

      The AutoNumeric element to add.

    Returns void

  • clear(forceClearAll?: boolean): void
  • Execute the {@link AutoNumeric.prototype.clear} method on each AutoNumeric object in the local AutoNumeric element list

    Parameters

    • Optional forceClearAll: boolean

      true to clear the the entire input, including the currency sign.

    Returns void

  • elements(): HTMLElement[]
  • Gets an array containing all the AutoNumeric DOM elements that have been initialized by each other.

    Returns HTMLElement[]

    An array with all AutoNumeric DOM elements.

  • empty(keepEachAnObjectInItsOwnList?: boolean): void
  • Remove all elements from the shared list, effectively emptying it. This is the equivalent of calling {@link AutoNumeric.detach} on each of its elements.

    Parameters

    • Optional keepEachAnObjectInItsOwnList: boolean

      If set to true, then instead of completely emptying the local list of each AutoNumeric objects, each one of those keeps itself in its own local list.

    Returns void

  • Execute the {@link AutoNumeric.prototype.getFormatted} method on each AutoNumeric object in the local AutoNumeric element list.

    Return an array of the current formatted values of each AutoNumeric element of the local AutoNumeric element list

    Parameters

    • Optional callback: null | export=.GetValueCallback<string[]>

      Optional callback that, when given, is called with the value and the AutoNumeric instance.

    Returns string[]

    The formatted value for each linked AutoNumeric instance.

  • getList(): Map<HTMLElement, export=>
  • Gets a map containing all the AutoNumeric DOM elements that have been initialized by each other. The key is the DOM element, the value the corresponding AutoNumeric instance.

    Returns Map<HTMLElement, export=>

    A map with all AutoNumeric instances.

  • Execute the {@link AutoNumeric.prototype.getLocalized} method on each AutoNumeric object in the local AutoNumeric element list.

    Returns the unformatted values (following the outputFormat) setting of each element of the local AutoNumeric element list into an array.

    Parameters

    • callback: export=.GetValueCallback<(string | number)[]>

      Optional callback that, when given, is called with the value and the AutoNumeric instance.

    Returns (string | number)[]

    The localized value for each linked AutoNumeric instance.

  • Execute the {@link AutoNumeric.prototype.getNumber} method on each AutoNumeric object in the local AutoNumeric element list.

    Return an array of the element unformatted values (as a real Javascript number), for each element of the local AutoNumeric element list.

    Parameters

    • Optional callback: null | export=.GetValueCallback<(null | number)[]>

      Optional callback that, when given, is called with the value and the AutoNumeric instance.

    Returns (null | number)[]

    The number value for each linked AutoNumeric instance.

  • Execute the {@link AutoNumeric.prototype.getNumericString} method on each AutoNumeric object in the local AutoNumeric element list.

    Return an array of the unformatted values of each AutoNumeric element of the local AutoNumeric element list This can also return null if rawValue is null.

    Parameters

    • Optional callback: null | export=.GetValueCallback<(null | string)[]>

      Optional callback that, when given, is called with the value and the AutoNumeric instance.

    Returns (null | string)[]

    The numeric value for each linked AutoNumeric instance.

  • has(element: HTMLElement | export=): unknown
  • Return true if the given AutoNumeric instance (or DOM element) is in the local AutoNumeric element list.

    Parameters

    • element: HTMLElement | export=

      The element to check.

    Returns unknown

    Whether the given element is in the local AutoNumeric element list.

  • isPristine(checkOnlyRawValue?: boolean): boolean
  • Return true if all the AutoNumeric-managed elements are pristine, i.e. if their raw value hasn't changed. By default, this returns true if the raw unformatted value is still the same even if the formatted one has changed (due to a configuration update for instance).

    Parameters

    • Optional checkOnlyRawValue: boolean

      If set to true, the pristine value is done on the raw unformatted value, not the formatted one. If set to false, this also checks that the formatted value hasn't changed.

    Returns boolean

    Whether all AutoNumeric-managed elements are pristine.

  • nuke(): void
  • Execute the {@link AutoNumeric.prototype.nuke} method on each AutoNumeric object in the local AutoNumeric element list.

    Returns void

  • reformat(): void
  • Execute the {@link AutoNumeric.prototype.reformat} method on each AutoNumeric object in the local AutoNumeric element list.

    Force each element of the local AutoNumeric element list to reformat its value.

    Returns void

  • remove(): void
  • Execute the {@link AutoNumeric.prototype.remove} method on each AutoNumeric object in the local AutoNumeric element list.

    Returns void

  • removeObject(element: HTMLElement | export=, keepCurrentAnObject?: boolean): void
  • Remove the given AutoNumeric object (or DOM element) from the local AutoNumeric element list, using the DOM element as the key. If this function attempts to remove the current AutoNumeric object from the local list, a warning is shown, but the deletion is still done.

    Special cases :

    • If the current object removes itself, then it's removed from the shared local list, then a new empty local list is used/created
    • If another object remove this object, then a local list with only this object is used/created

    Parameters

    • element: HTMLElement | export=

      The AutoNumeric element to remove.

    • Optional keepCurrentAnObject: boolean

      If set to false, then the function will also remove the current AutoNumeric object if asked, otherwise it will ignore it and print a warning message.

    Returns void

  • Execute the {@link AutoNumeric.prototype.set} method on each AutoNumeric object in the local AutoNumeric element list.

    Set the same given element value for each element in the local AutoNumeric element list, and format those elements immediately.

    Parameters

    • newValue: null | string | number

      The new value to set.

    • Optional options: export=.CallbackOptions

      A settings object that will override the current settings. Note: the update is done only if the newValue is defined.

    Returns void

  • Execute the {@link AutoNumeric.prototype.setUnformatted} method on each AutoNumeric object in the local AutoNumeric element list.

    Set the value given value directly as the DOM element value, without formatting it beforehand. This sets the same unformatted value for each element in the local AutoNumeric element list.

    Parameters

    • value: null | string | number

      The new value to set.

    • Optional options: export=.CallbackOptions

      A settings object that will override the current settings. Note: the update is done only if the newValue is defined.

    Returns void

  • size(): number
  • Return the number of element in the local AutoNumeric element list.

    Returns number

    The number of linked AutoNumeric elements.

  • unformat(): void
  • Execute the {@link AutoNumeric.prototype.unformat} method on each AutoNumeric object in the local AutoNumeric element list.

    Remove the formatting and keep only the raw unformatted value (as a numericString) in each element of the local AutoNumeric element list

    Returns void

  • Execute the {@link AutoNumeric.prototype.unformatLocalized} method on each AutoNumeric object in the local AutoNumeric element list.

    Remove the formatting and keep only the localized unformatted value in the element.

    Parameters

    Returns void

  • Execute the {@link AutoNumeric.prototype.update} method on each AutoNumeric object in the local AutoNumeric element list.

    Updates the AutoNumeric settings, and immediately format the elements accordingly, for each element of the local AutoNumeric element list.

    Parameters

    • Rest ...newOptions: export=.CallbackOptions[]

      New options to set. When multiple options are specified, later options override previous options.

    Returns void

  • wipe(): void
  • Execute the {@link AutoNumeric.prototype.wipe} method on each AutoNumeric object in the local AutoNumeric element list.

    Returns void

Generated using TypeDoc