## Changelog for autoNumeric ### 4.6.2 + Fixes issue #757 Converted scientific numbers returns NaN when using `formArrayNumericString()` + Fixes warning messages in the IDE ### 4.6.1 + Updates all the dependencies + Removes the PhantomJS dependency in favor of Puppeteer + Fixes and cleans the Karma configuration files to support v6.4.1 + Fixes and cleans the Webpack configuration files to support v5.75.0 + Fixes the failing unit tests on the `validate()` function for the `allowDecimalPadding` option + Updates the Webdriverio configuration to v8 + Updates the Webdriver end-to-end tests to v8, i.e. removing the `@wdio/sync` package in favor of using async/await everywhere, and updating all the `keys()` calls to use the Webdriver `Key` object, and arrays of individual characters + Adds unit tests for feature request #741 + Completes the `validate()` function with additional tests for the new `allowDecimalPadding` option as a number + Fixes #761 Undo and redo actions are done twice, on Z and Control KeyUp events + Fixes missing variable update in #739 (`this.onGoingRedo`) + Fixes the warning message when a faulty `styleRules` callback is passed as a parameter + Fixes typos and grammar in comments + Fixes #734 Fire change event onBlur only if number is changed (#735) + Fixes #753 Correct invalid JS imports + Fixes #758 Adding missing predefined options to typescript interface file + Update the readme with the new documentation website + Fixes #739 Add CTRL+Y shortcut for redo + Fixes the currency symbol for Brazilian real + Fixes #697 Currency can be deleted (#725) + Updates the README related to PR #742 + Fixes #741 + Ability to set a numeric allowDecimalPadding (#742) + Adds default export to modules (#747) + Fixes #737 Undo/redo not firing input event + Fixes #684 Caret always set far right when deleting or inserting numbers using $ (#716) + Fixes unit tests following the changes in `v4.6.0` ### 4.6.0 + Adds a new option `invalidClass`, which default to `an-invalid`, that defines the CSS class name to use when a contenteditable-enabled element value is invalid + Adds a new option value `'invalid'` for the `overrideMinMaxLimits` option, that will allow users to enter out-of-bound numbers + Fixes #543 Allow users to enter out-of-bound numbers, outside of the `minimumValue` and `maximumValue` range + This allows users to type temporary invalid numbers when the `minimumValue` is superior to `0`, or the `maximumValue` is inferior to `0` + While in this out-of-bound state, the element validity status is set to `invalid` + Users can then target the CSS `:invalid` and/or `:valid` state as they wish to display a visual feedback as needed + Do note that contenteditable-enabled elements cannot have a validity state set, so AutoNumeric instead sets by default the `an-invalid` CSS class on such 'invalid' elements + Whenever the user type an invalid number (out of range), the new `'autoNumeric:invalidValue'` event is sent. When the value is corrected, the new `'autoNumeric:correctedValue'` event is sent. + Beware; To reduce complexity, the `'autoNumeric:invalidValue'` event as well as the `'autoNumeric:minExceeded'` or `'autoNumeric:maxExceeded'` events are now sent up to three times for a single input; on keypress, keyup and blur + From now on, whenever the user sets a `minimumValue` higher than `0`, or a `maximumValue` lower than `0`, a warning will be displayed in the console telling him to perhaps use the `overrideMinMaxLimits` `invalid` option. For information, the `overrideMinMaxLimits` `doNotOverride` is still the default behavior. + Simplify the min and max range tests with the new private `_isWithinRangeWithOverrideOption()` function + Fixes the bug where you could always clear the input even if the limit were preventing you to do so (the last valid value was then set back on blur). Now AutoNumeric correctly prevents you to clear the input if the resulting value is out-of-bound. + Fixes #676 36 errors in index.d.ts when using with typescript + TypeScript users should now remove the `declare module 'autonumeric';` line from their script (cf. PR #677) + Removes node 6 from the CI tests (cf. PR #678) + Fixes the detection of wheel events when using a touchpad/trackball (cf. PR #672) ### 4.5.13 + Fixes #675 The caret position is wrongly positioned when setting the raw value to zero on numbers with a prefix currency symbol (The bug was introduced in `v4.5.9` with the fix for #647) ### 4.5.12 + Synchronizes the AutoNumeric version with the published npm one ### 4.5.11 + Adds a typescript definitions file to the library + Fixes some errors in the typescript definitions file and fixes the indentation ### 4.5.10 + Fixes #656 Input value will undo on focusout when using only Ctrl+Backspace ### 4.5.9 + Fixes #647 Caret position is incorrectly set when the `currencySymbol` in prefix position contains the first value entered *(ie. a numeric value)* ### 4.5.8 + Fixes #652 On initialization, `allowDecimalPadding` option `'floats'` does not hide the decimal zeroes if set in the html attribute ### 4.5.7 + Fixes #621 The `autoNumeric:formatted` event should be triggered when the input field is cleared while continuously pressing the `Backspace` or `Delete` keys *(for real this time, see `v4.5.2`)* ### 4.5.6 + Fix #602 Numpad decimal separator does not work on IE11 with a keyboard whose numpad decimal key outputs a comma + Adds a reference for the Angular 4+ implementation `ng-angular` component in the README ### 4.5.5 + Update the dev dependencies, fix the unit and end-to-end tests + Update the Babel version and fix the related configuration files + Update the Karma version and fix the related configuration files + Update the Webdriver.io version and fix the related configuration files + Update the Webpack version and fix the related configuration files ### 4.5.4 + Fixes #626 Missing the `\u0092` digit group separator ### 4.5.3 + Fixes #622 `freezeOptions()` can create issues in some browsers ### 4.5.2 + Fixes #621 The `autoNumeric:formatted` event should be triggered when the input field is cleared while continuously pressing the `Backspace` or `Delete`keys ### 4.5.1 + Fixes #611 The html `readonly` attribute is ignored on initial load + Fix how readonly and disabled inputs should not process keyboard events + Fix the formula mode so that the custom decimal character set with `decimalCharacter` is used instead of the default `'.'` character when writing float numbers ### 4.5.0 + Closes #542 Allow basic calculations when entering expressions like `=12*78` + Introduces the *formula mode* which allows a user to enter a math expression in the element using the `=` key, then evaluate it with the `Enter` one + Adds the `formulaMode` option, set to `false` by default, that controls if the *formula mode* is enabled + Adds the `Lexer`, `Parser`, `Evaluator`, `ASTNode` and `Token` classes for managing math expressions + Fixes #612 Dist files contain eval + The webpack `devtool` option for the `development` configuration has been changed from `cheap-module-eval-source-map` to `cheap-source-map`; This removes any `eval()` from the generated `dist/autoNumeric.js` file, and makes the source maps works in all cases in the browsers + Merge the changes from `4.4.1` while making sure there is no regression with #609; this adds the `browser` field alongside the `main` one in `package.json` + Note: The `browser` option points to the minified library `dist/autoNumeric.min.js` + Update the `index.html` test file to use the un-minified `development` library `dist/autoNumeric.js` This allows to *temporarily* use forbidden functions like `console` or wrong formatting while debugging, using `yarn build:dev` + Fixes a call to `_reformatAltHovered()` even when the `unformatOnHover` option was set to `false` ### 4.4.3 + Fixes #598 The `unformatOnHover` config value isn't used when set to `false` ### 4.4.2 + Fixes #609 Uncaught Error: Cannot find module 'autonumeric' on v4.4.1 + Reverts the changes from `4.4.1` : "Modify the `package.json` configuration `main` field to `browser`" ### 4.4.1 + Modify the `package.json` configuration `main` field to `browser` + This is useful per npm's documentation when the module is using browser-specific features like the `window` object ### 4.4.0 + Closes #476 Add a feature where `emptyInputBehavior` could be set to the minimum or maximum value + `emptyInputBehavior` now accepts either a number (or a string representing a number), or the `'min'` or `'max'` option + Fix the `emptyInputBehavior` validation test when checking the value limits + Fixes #579 Allow `emptyInputBehavior` to be set to min, max, or a number ### 4.3.7 + Fixes #594 Currency at wrong position for empty fields with euro/french preset after typing minus sign + Fixes #565 Entering a single minus character in a `negativeBracketsTypeOnBlur` input invert the currency sign and that minus sign ### 4.3.6 + Fixes #219 'Bug on form reset' that was re-opened + AutoNumeric now listens to the `reset` event on the parent form, and react accordingly if detected ### 4.3.5 + Really fixes issue #596 this time ### 4.3.4 + Fixes #596 Change event not firing depending on cursor movement ### 4.3.3 + Fixes #593 Pasting a negative value over a negative value that as a currency symbol and its numbers selected throws an error + Refactor the `_onPaste()` handler by removing duplicated parts + Fix the initialization call `new AutoNumeric()` where using as arguments a `string` (element selector), a `number` (initial value) and an `array` (array of options), in that particular order, would not be recognized ### 4.3.2 + Fixes #589 The `percentageUS*` predefined options do not have the `rawValueDivisor` option set ### 4.3.1 + Modify the `tenTrillions` and `oneBillion` limits to be exact + Remove the `maximumValue` and `minimumValue` `tenTrillionsNoDecimals` option, and update `tenTrillions` so that it equals ten trillions + The `tenTrillions` sub-option is now equal to `'10000000000000'`, and the `oneBillion` sub-option is now equal to `'1000000000'` + This change was long overdue since we modified in `v4.0.0-beta.22` how the number of decimal places was defined by the user using the `decimalPlaces` options instead of adding a specific number of decimal to the min/max values. ### 4.3.0 + Fixes #559 Allow AutoNumeric to accept the decimal character input even when there is already one in the element + Add the new `alwaysAllowDecimalCharacter` option set to `false` by default + Fixes AutoNumeric so that elements now correctly accepts entering a decimal char on the far left of a negative number ### 4.2.15 + Fixes #585 Internet Explorer 11 throws when freezing the options ### 4.2.14 + Fixes #526 Memory / speed improvement in options + Fixes #583 AutoNumeric `v4.2.13` forces the contenteditable attribute to `true` when set on the html source + Fixes #584 Event listeners are not set/reset on option updates ### 4.2.13 + Fixes #580 Allow non-input tags with the `readOnly` option to set the `contenteditable` attribute to `false` + Fix the `readonly` and `contenteditable` attributes so that they can be updated to read/write mode + Modify `_setReadOnly()` so that it *always* sets the element to read-only mode + Create a new `_setReadWrite()` function that sets the element to read-write mode + Create a new `_setWritePermissions()` function that sets the element read only/write mode according to the `readOnly` setting + Fix the urls to autonumeric.org in the readme ### 4.2.12 + Fixes #574 The fractional part is converted to an integer if the part on the cursor left-hand side is equal to 0 ### 4.2.11 + Fixes #570 The minified version of AutoNumeric does not expose some of its static functions (ie. `AutoNumeric.getNumber()`) + Removing the standard `Function.name` feature fixes the bug in IE now. In the near future IE users will need to require a polyfill for this. + Reduce the size of the generated library by tuning the UglifyJs options + Fix the end-to-end tests so that they are run against AutoNumeric's minified version ### 4.2.10 + Fix various bugs regarding the incorrect static and instantiated function calls + Fix the polyfill so that `Array.from()` is correctly 'polyfilled' even if the `CustomEvent` object already exists + Fix the `CustomEvent` polyfill + Merges PR #572 Use `AutoNumericHelper.contains()` instead of `String.includes()` for the time being + Update the dev dependencies + Update the babel preset from `latest` to `env` ### 4.2.9 + Fixes #568 Using brackets for negative numbers in AutoNumeric.format returns "undefined" ### 4.2.8 + Fixes #566 Add the Turkish predefined currency ### 4.2.7 + Fixes #521 The `input` event is not fired on `paste` if the element is empty or is completely selected beforehand + Fixes #563 The `import AutoNumeric from 'AutoNumeric'` line in the readme does not work on case sensitive OS (like Linux) ### 4.2.6 + Fixes #561 Webpack bundles the already compiled library when imported in another project ### 4.2.5 + Fix issue #550 The `change` event is sent twice on change + Fix the bug when an input with the `negativeBracketsTypeOnBlur` options was focused then blurred, it would dispatch a `change` event. ### 4.2.4 + Fix issue #558 Switch the webpack 4 ### 4.2.3 + Fix issue #556 Modify the `update()` function so that it can accept an array of options ### 4.2.2 + Fix issue #555 The `update()` function does not accept predefined option names (ie. `'euro'`) ### 4.2.1 + Fix issue #553 Missing support for very small or very big numbers displayed by Javascript as scientific numbers + This adds support for using scientific notation for setting the input value (ie. `aNInput.set('6.1349392e-13');`, ``) ### 4.2.0 + Fix issue #535 Prevent entering any decimal character when only positive numbers are accepted + Change how the decimal character can be entered: + Before, the comma `','` and dot `'.'` where always accepted + Now, only the characters defined in `decimalCharacter` and `decimalCharacterAlternative` are accepted ### 4.1.3 + Fix the `.travis.yml` file so that the `dist` file are built on the CI server ### 4.1.2 + Fix the `.npmignore` file so that the npm autonumeric package can be installed ### 4.1.1 + Fix issue #554 Automatize the build and publishing process of releases with Travis CI + Remove the generated files from the git repository + Instead of polluting the repo with the `dist/*` files that can be generated using `yarn build`, those files are now generated and published to npm automatically when tagging a commit. ### 4.1.0 + Release `v4.1.0` The highlights of this version are: + New features + AutoNumeric static functions can now be used in web workers (#494) + Add the new `valuesToStrings` option to allow displaying a pre-defined string depending on the `rawValue` (#450) + Allow the positive & negative signs to be specified via the two options `positiveSignCharacter` and `negativeSignCharacter` (#478) + Add more details to the `'autoNumeric:formatted'` event payload (#485) + Add a new event hook `autoNumeric:rawValueModified` that will be sent only when the `rawValue` is modified (#488) + Add a new custom AutoNumeric event `'autoNumeric:initialized'` sent as soon as an AutoNumeric element is initialized + Add the static `set` and `get*` functions that will allow setting the given DOM element on getting its value without having a reference to its AutoNumeric object (#515) + Add support for watching external changes when setting the input `value` directly with Javascript without using the `set()` method (Note: watching the external changes from `textContent` is not yet supported) (#513) + Add the new option `watchExternalChanges` (set to `false` by default) that defines if the AutoNumeric object should watch and react to external changes (not made via `.set()`) + Add the new option `wheelOn` that defines when we should be listening to the `wheel` event, either on 'hover' or on 'focus' (#456) + Changes + Change the `modifyValueOnWheel` default behaviour to act only when the element is focused. If you want to be able to use the mouse wheel on a non-focused AutoNumeric element, you'll now need to press the `Shift` key while doing so. You can change that behavior back like it was before by setting the new option `wheelOn` to `hover` (#456) + Allow changing the `bubble` and `cancelable` attributes of events sent by AutoNumeric. This adds two new options `eventBubbles` and `eventIsCancelable` that defaults to `true` to manage those event attributes (#524) + Modify the static `getAutoNumericElement()`, `test()` and `isManagedByAutoNumeric()` functions so that they accept either a DOM element or a selector string (#514) + When the `rawValue` is allowed to be `null` and is effectively `null`, the min/max limits are now ignored + Form serialization now outputs the empty string `''` on empty inputs, instead of `0` or `0.00` (#512) + Improvements + Switch to Webpack 3.* for leaner bundle creations (#438) + Migration to eslint 4.* for a cleaner codebase (#475) + The `decimalCharacterAlternative` now correctly ignores the 'comma' or 'dot' when set to `none` (#432) + Unit test now use the `mocha` profile as default instead of `progress` + Fixes + Coverage information is back (#490) + Workaround a geckodriver bug when trying to input an hyphen (#480) + Fix lots of pasting issues (#481, #482, #483, #484, #505, #510, #547) + Create workarounds (*hacks* really) for various IE-related bugs (#495, #516, #518) + `AutoNumeric.multiple()` now correctly add only one event listener to the parent form, if any (#457) + The `input` event is not fired on mouse wheel (#525) + Prevent using the `wheel` event on `disabled` input elements + The value of a read-only field can be changed with a scroll input (#541) + Cut text reappears when leaving the field (#527) + Input is duplicated and reversed on devices with Android < 7.0 using Android Chrome (#522) + Formatted numbers on Android Chrome do not get deleted on blur anymore ...and [more](https://github.com/autoNumeric/autoNumeric/projects/2). ### 4.1.0-beta.28 + Fix issue #477 Modifying an input by selecting all its content and entering `0` drop the current selection, if 0 is out of the limit boundaries ### 4.1.0-beta.27 + Fix issue #432 The `decimalCharacterAlternative` option does not ignore the comma when it's set to `none` ### 4.1.0-beta.26 + Fix issue #522 Input is duplicated and reversed on devices with Android < 7.0 + Remove the `input` event listener + Refactor parts of the `_stripAllNonNumberCharacters` and `_convertToNumericString()` functions by creating a `_normalizeCurrencySuffixAndNegativeSignCharacters()` function + Rename `_stripAllNonNumberCharacters()` to `_stripAllNonNumberCharactersExceptCustomDecimalChar()` + Create a `_stripAllNonNumberCharacters()` function that also normalize the decimal character + Remove the obsolete `skipFirstAutoStrip` and `skipLastAutoStrip` regex + Prevent the conversion of the `decimalCharacterAlternative` into the `decimalCharacter` when stripping the value + Simplify `_addBrackets()` and `_setBrackets()` + Simplify the `_removeBrackets()` calls + Fix `_convertToNumericString()` so that it normalize the positive sign and remove the brackets if any + Fix the bug where the formatted numbers on Android Chrome gets deleted on blur + Simplify the generated cached regex + Refactor `_processCharacterDeletionIfTrailingNegativeSign()` so `contains()` is called only once ### 4.1.0-beta.25 + Add a new custom AutoNumeric event `'autoNumeric:initialized'` sent as soon as an AutoNumeric element is initialized ### 4.1.0-beta.24 + Fix issue #527 Cut text reappears when leaving the field ### 4.1.0-beta.23 + Fix issue #547 Newer version of Firefox breaks pasting in `contenteditable` elements + Fix issue #510 Pasting values in a `disabled` element should not be possible + Also prevent using the `wheel` event on `disabled` input elements. ### 4.1.0-beta.22 + Fix issue #525 The `input` event is not fired on mouse wheel ### 4.1.0-beta.21 + Fix issue #541 The value of a read-only field can be changed with a scroll input ### 4.1.0-beta.20 + Fix issue #489 `valuesToStrings` is ignored when using the static `format()` and `unformat()` functions ### 4.1.0-beta.19 + Add an option `watchExternalChanges` to react to external changes By default, an AutoNumeric element only format the value set with the `.set()` function. If you want the element to watch and format value set by third party script using the `aNElement.node().value = 42` notation, then you need to set the `watchExternalChanges` option to `true`. ### 4.1.0-beta.18 + Fix issue #524 Allow changing the `bubble` and `cancelable` attributes of events sent by AutoNumeric + Add two new options `eventBubbles` and `eventIsCancelable` that defaults to `true` to manage the event attributes. ### 4.1.0-beta.17 + Fix issue #457 Using `AutoNumeric.multiple()` generate many `submit` event listeners on the parent `form` + Fix the `drop` event handler removal that was omitted. + Add a global `aNFormHandlerMap` Map on the `window` object, that keep track of all `submit` event handler for each `