autonumeric
Advanced tools
Changelog
3.0.0-beta.12
AutoNumeric.options
object attribute valuesChangelog
3.0.0-beta.11
event.key
instead of event.keyCode
and event.which
since those two attributes are deprecatedChangelog
3.0.0-beta.10
dotDecimalCharCommaSeparator
, commaDecimalCharDotSeparator
, integer
, integerPos
, integerNeg
, float
, floatPos
, floatNeg
, numeric
, numericPos
, numericNeg
, euro
, euroPos
, euroNeg
, euroSpace
, euroSpacePos
, euroSpaceNeg
, percentageEU2dec
, percentageEU2decPos
, percentageEU2decNeg
, percentageEU3dec
, percentageEU3decPos
, percentageEU3decNeg
, dollar
, dollarPos
, dollarNeg
, percentageUS2dec
, percentageUS2decPos
, percentageUS2decNeg
, percentageUS3dec
, percentageUS3decPos
and percentageUS3decNeg
.getLanguages()
to getPredefinedOptions()
.suffixText
options.AutoNumeric.options
object values.selectNumberOnly
value to true
AutoNumeric.languageOptions
object.decimalCharacterAlternative
option enumeration.selectNumberOnly
.AutoNumeric.languageOptions.French
.Changelog
3.0.0-beta.9
savedCancellableValue
variable when unneeded.hasFocus
calls and sets.format()
function, since this used the _addGroupSeparators
function that calls the _stripAllNonNumberCharacters
one that extensively uses those.this.settings
object.set()
if the value hasn't changed when calling the 'cancellable' event._setsAlternativeDecimalSeparatorCharacter()
to _setAlternativeDecimalSeparatorCharacter()
.aScale
reference from a test.this.settings
object the following variables : caretFix
, throwInput
, tagList
, originalDecimalPlacesOverride
, originalAllowDecimalPadding
, originalNegativeBracketsTypeOnBlur
, originalDigitGroupSeparator
, originalCurrencySymbol
, originalSuffixText
and aNegRegAutoStrip
._formatValue()
.Changelog
3.0.0-beta.7
Changelog
3.0.0-beta.3
src/main.js
for bundling the library.autoNumeric.js
, which contains the AutoNumeric class,AutoNumericEnum.js
which contains the enumerations used by AutoNumeric, andAutoNumericHelper.js
which contains the AutoNumericHelper class which provides static helper functions.allowedTagList
, keyCode
and keyName
into AutoNumericEnum
.isEmptyString
, isNumberOrArabic
, isFunction
, isElement
, isInputElement
, arabicToLatinNumbers
, triggerEvent
, randomString
, getElementValue
, setElementValue
, cloneObject
, camelize
, text
, setText
and filterOut
functions to the helper functions.preparePastedText
, runCallbacksFoundInTheSettingsObject
, maximumVMinAndVMaxDecimalLength
, stripAllNonNumberCharacters
, toggleNegativeBracket
, convertToNumericString
, toLocale
, modifyNegativeSignAndDecimalCharacterForRawValue
, modifyNegativeSignAndDecimalCharacterForFormattedValue
, checkEmpty
, addGroupSeparators
, truncateZeros
, roundValue
, truncateDecimal
, checkIfInRangeWithOverrideOption
functions into the AutoNumeric object.character()
method to take into account the quirks of some obsolete browsers.getCurrentElement()
function since we now only need to access the this.domElement
property.AutoNumericHolder
class and the getAutoNumericHolder()
function since we are now using the AutoNumeric class as the 'property holder'._setArgumentsValues()
method).serializeSpaces
option that allows the user to defines how the serialize function will managed the spaces, either by converting them to '%20'
, or to the '+'
string, the latter now being the default.noEventListeners
option that allows the user to initialize an AutoNumeric <input>
element without adding any AutoNumeric event listeners.readOnly
option to the settings that allow the <input>
element to be set to read-only on initialization..global.*
functions).isPristine()
method to test if an AutoNumeric-managed element value
/textContent
has been changed since its initialization.unset
to unformat
.reSet
to reformat
.unformatLocalized()
function to unformat the element value while using the outputFormat
setting.clear()
method to empty the element value.nuke()
method to remove the DOM element from the DOM tree..global.has()
method to check if the given AutoNumeric object (or DOM element) is in the local AutoNumeric element list..global.addObject()
method that adds an existing AutoNumeric object (or DOM element) to the local AutoNumeric element list..global.removeObject()
method that removes the given AutoNumeric object (or DOM element) from the local AutoNumeric element list..global.empty()
method to remove all elements from the shared list..global.elements()
method to retrieve all the AutoNumeric object that share the same local list..global.getList()
method to retrieve the local AutoNumeric element list.version()
method to output the current AutoNumeric version (for debug purpose).set()
method so that the rawValue
is updated when the value is set to ''
.setUnformatted()
method to set the value given value directly as the DOM element value, without formatting it beforehand.get()
method to the renamed getNumericString()
which bares more meaning.getFormatted()
method to retrieve the current formatted value of the AutoNumeric element as a string.getNumber()
method that returns the element unformatted value as a real Javascript number.getLocalized()
method that returns the unformatted value, but following the outputFormat
setting.unformatLocalized()
method that unformats the element value by removing the formatting and keeping only the localized unformatted value in the element.selectNumber()
method that select only the numbers in the formatted element content, leaving out the currency symbol, whatever the value of the selectNumberOnly
option.selectInteger()
method that select only the integer part in the formatted element content, whatever the value of the selectNumberOnly
option.selectDecimal()
method that select only the decimal part in the formatted element content, whatever the value of selectNumberOnly
.node()
method that returns the DOM element reference of the autoNumeric-managed element.parent()
method that returns the DOM element reference of the parent node of the autoNumeric-managed element.detach()
method that detach the current AutoNumeric element from the shared local 'init' list.attach()
method that attach the given AutoNumeric element to the shared local 'init' list.formatOther()
method that format and return the given value, or set the formatted value into the given DOM element if one is passed as an argument.unformatOther()
method that unformat and return the raw numeric string corresponding to the given value, or directly set the unformatted value into the given DOM element if one is passed as an argument.init()
method that allows to use the current AutoNumeric element settings to initialize the DOM element given as a parameter. This effectively link the two AutoNumeric element by making them share the same local AutoNumeric element list.form()
method that return a reference to the parent <form> element if it exists, otherwise return null
.formNumericString()
method that returns a string in standard URL-encoded notation with the form input values being unformatted.formFormatted()
method that returns a string in standard URL-encoded notation with the form input values being formatted.formLocalized()
method that returns a string in standard URL-encoded notation with the form input values, with localized values.formArrayNumericString()
method that returns an array containing an object for each form <input>
element.formArrayFormatted()
method that returns an array containing an object for each form <input>
element, with the value formatted.formArrayLocalized()
method that returns an array containing an object for each form <input>
element, with the value localized.formJsonNumericString()
method that returns a JSON string containing an object representing the form input values.formJsonFormatted()
method that returns a JSON string containing an object representing the form input values, with the value formatted.formJsonLocalized()
method that returns a JSON string containing an object representing the form input values, with the value localized.formUnformat()
method that unformat all the autoNumeric-managed elements that are a child of the parent <form> element of this DOM element, to numeric strings.formUnformatLocalized()
method that unformat all the autoNumeric-managed elements that are a child of the parent <form> element of this DOM element, to localized strings.formReformat()
method that reformat all the autoNumeric-managed elements that are a child of the parent <form> element of this DOM element.formSubmitNumericString()
method that convert the input values to numeric strings, submit the form, then reformat those back.formSubmitFormatted()
method that submit the form with the current formatted values.formSubmitLocalized()
method that convert the input values to localized strings, submit the form, then reformat those back.formSubmitArrayNumericString()
method that generate an array of numeric strings from the <input>
elements, and pass it to the given callback.formSubmitArrayFormatted()
method that generate an array of the current formatted values from the <input>
elements, and pass it to the given callback.formSubmitArrayLocalized()
method that generate an array of localized strings from the <input>
elements, and pass it to the given callback.formSubmitJsonNumericString()
method that generate a JSON string with the numeric strings values from the <input>
elements, and pass it to the given callback.formSubmitJsonFormatted()
method that generate a JSON string with the current formatted values from the <input>
elements, and pass it to the given callback.formSubmitJsonLocalized()
method that generate a JSON string with the localized strings values from the <input>
elements, and pass it to the given callback.test()
method that if the given domElement is already managed by AutoNumeric (if it has been initialized on the current page)._mergeSettings()
and _cloneAndMergeSettings()
to do what they are named about.format()
method so that it formats the given number (or numeric string) with the given options, and returns the formatted value as a string.formatAndSet()
method that format the given DOM element value, and set the resulting value back as the element value.unformat()
method so that it unformats the given formatted string with the given options, and returns a numeric string.unformatAndSet()
method that unformat the given DOM element value, and set the resulting value back as the element value.localize()
method that unformat and localize the given formatted string with the given options, and returns a numeric string.isManagedByAutoNumeric()
method that returns true
is the given DOM element has an AutoNumeric object that manages it.getAutoNumericElement()
method that returns the AutoNumeric object that manages the given DOM element.french()
, northAmerican()
, british()
, swiss()
, japanese()
, spanish()
and chinese()
methods that update the settings to use the named pre-defined language options.setReal
from some functions.this.settings
directly).isNan()
on non-number elements like strings.this.isFocused
variable.getElementValue()
function to retrieve the element value
or textContent
(depending if the element in an <input>
or another tag), which allow AutoNumeric to perform some operations on non-input elements too. This is the first changes needed for the goal of managing the non-input tags with contentEditable
with AutoNumeric.getElementValue()
function as well in order to be able to set the value
or textContent
transparently where needed._updateAutoNumericHolderProperties()
to _updateInternalProperties()
._checkElement()
method). This simplify the process by calling the new _isElementTagSupported()
, _isInputElement()
and _isInputTypeSupported()
functions which respect the separation of concerns._formatDefaultValueOnPageLoad()
method now accepts a 'forced' initial value instead of the default one.set()
methods, since those cannot change once AutoNumeric has been initialized, simplifying the code.settings.formatOnPageLoad
inside the formatDefaultValueOnPageLoad()
function that is only called if settings.formatOnPageLoad
is already set).getInitialSettings()
method to _setSettings()
._getSignPosition()
function._serialize()
function that take care of serializing the form data into multiple output as needed, which is called by the _serializeNumericString()
, _serializeFormatted()
,_serializeLocalized()
, _serializeNumericStringArray()
, _serializeFormattedArray()
and _serializeLocalizedArray()
methods.AutoNumeric.defaultSettings
.AutoNumeric.options
object that gives access to all the possible options values, with a semantic name (handy for IDE autocompletion).AutoNumeric.languageOptions
object.AutoNumeric.multiple()
function that allows to initialize numerous AutoNumeric object (on numerous DOM elements) in one call (and possibly pass multiple values that will be mapped to each DOM element).<input>
tags.noEventListeners
or readOnly
options.serializeSpaces
, noEventListeners
and readOnly
options.rawValue
was correctly set when using getSettings()
..global.*
methods.AutoNumeric.multiple()
methods.selectDecimal
, selectInteger
, reformat
, unformat
and unformatLocalized
methods..form*
methods.babel-plugin-transform-object-assign
dev dependency in order to be able to use Object.assign()
in the ES6 source.Changelog
2.0.8
Changelog
2.0.5", "2.0.6" & "2.0.7
npm install
for version 2.0.4 does not work on Windows machinesChangelog
2.0.5", "2.0.6" & "2.0.7
npm install
for version 2.0.4 does not work on Windows machines