profile
viewpoint
Alexandre AlexandreBonneau Earth "Use computers without dishonor" - RMS

autoNumeric/autoNumeric 1418

autoNumeric is a standalone library that provides live as-you-type formatting for international numbers and currencies.

autoNumeric/vue-autoNumeric 59

A Vue.js component that wraps the awesome autoNumeric input formatter library

AlexandreBonneau/devSnaps 1

Everyday solutions to everyday dev problems

AlexandreBonneau/devSnaps-back 1

Back-end for the DevSnaps app

AlexandreBonneau/autoNumeric 0

autoNumeric is a standalone library that provides live as-you-type formatting for international numbers and currencies.

AlexandreBonneau/awesome-javascript 0

🐢 A collection of awesome browser-side JavaScript libraries, resources and shiny things.

AlexandreBonneau/awesome-vue 0

🎉 A curated list of awesome things related to Vue.js

AlexandreBonneau/blessed-vue 0

A VueJS runtime to render Blessed to build command line UI.

AlexandreBonneau/cdnjs 0

🌍 The best FOSS web front-end resource CDN

AlexandreBonneau/contracts 0

[READ ONLY] Subtree split of the Illuminate Contracts component (see laravel/framework)

issue commentsignalapp/Signal-Android

Signal adds the wrong country code on received SMS with dual-sim phone

For info, this critical bug is still happening in version 4.55.8.

AlexandreBonneau

comment created time in 6 days

issue commentautoNumeric/autoNumeric

Possible feature request: Minimum and maximum decimal places

@ragulka please create a new issue if you encounter a new problem allowDecimalPadding (or aPad) before has been changed so that you can either choose when you want AutoNumeric to pad the decimals (see the documentation).

The upgrade guide do mention how decimals are set now.

If you want to be able to define the number of decimals, you need to checkout the decimalPlaces option. This has been done to make options more consistent with one option allowDecimalPadding to decide if and how to pad the decimals, and decimalPlaces (and its variants) to define how many decimal places you want.

ragulka

comment created time in 7 days

issue closedautoNumeric/autoNumeric

when i submit 1 but autonumeric view 100

I inspect with mozilla inspector <td class="nomor" value="1,00">100</td>

sorry english not my mother language

closed time in 7 days

whitedevil0303

issue commentautoNumeric/autoNumeric

when i submit 1 but autonumeric view 100

This is the expected behavior. 100% is equal to 1, 50% is equal to 0.5 and so on. Since you are using the predefined AutoNumeric.getPredefinedOptions().percentageUS2decPos option, you (unwillingly apparently ;p) are using the rawValueDivisor option so that any number you enter will be divided by 100 on blur.

If you want your previous behavior, you could just define the option by yourself, omitting the rawValueDivisor one, for instance :

const anElement = new AutoNumeric('input', 0.5, {
	currencySymbol : AutoNumeric.options.currencySymbol.none,
	suffixText : AutoNumeric.options.suffixText.percentage,
	wheelStep : 0.01,
});

(see the live example)

whitedevil0303

comment created time in 7 days

created tagautoNumeric/autoNumeric

tagv4.5.13

autoNumeric is a standalone library that provides live as-you-type formatting for international numbers and currencies.

created time in 7 days

push eventautoNumeric/autoNumeric

Alexandre Bonneau

commit sha f7a2989a1230df070604c5bde12304b76b0f5c1f

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 Signed-off-by: Alexandre Bonneau <alexandre.bonneau@linuxfr.eu>

view details

push time in 7 days

issue closedautoNumeric/autoNumeric

The caret position is wrongly positionned when setting the raw value to zero on numbers with a prefix currency symbol

Current behavior

When the user tries to delete the first digit on a number with 5 or more digits, the cursor jumps to the end. It did not do this in prior versions.

Expected behavior

The cursor should stay put. If the user is trying to for example change 50,000 to 60,000, they should just have to delete the '5' and then enter '6'. This bug jumps the cursor to the end and requires them to either delete the whole number or click back to the front.

Steps to reproduce the problem

  1. Open the demo codepen: https://codepen.io/AnotherLinuxUser/pen/JyBGpz
  2. Type 55,000.00 into the input box.
  3. Click to the position on the right side of the '5' and click delete.
  4. Notice how the cursor jumps to the end.
  5. Try using version 4.5.8 and it doesn't happen, so it must have been introduced in 4.5.9.

closed time in 7 days

joepetrakovich

issue commentautoNumeric/autoNumeric

Deleting the first digit on a value with greater than 5 digits moves the cursor to the end

I was able to reproduce the behavior. If you have the value 80,000.00, then put the caret on 8|0,000.00 and hit backspace, then you get the usual value , but with the caret set at the end 0,000.00|.

joepetrakovich

comment created time in 7 days

pull request commentautoNumeric/autoNumeric

TypeScript definitions, another try

This is now live in v4.5.12 !

sbusch

comment created time in 7 days

created tagautoNumeric/autoNumeric

tagv4.5.12

autoNumeric is a standalone library that provides live as-you-type formatting for international numbers and currencies.

created time in 7 days

push eventautoNumeric/autoNumeric

Alexandre Bonneau

commit sha 6ad46df60430084c25e5c69a7dd9159a217d379b

Synchronizes the AutoNumeric version with the published npm one Signed-off-by: Alexandre Bonneau <alexandre.bonneau@linuxfr.eu>

view details

push time in 7 days

created tagautoNumeric/autoNumeric

tagv4.5.11

autoNumeric is a standalone library that provides live as-you-type formatting for international numbers and currencies.

created time in 7 days

push eventautoNumeric/autoNumeric

Alexandre Bonneau

commit sha 737edcde1b08492b3dd4e14597eb51430e6e0ab5

Bumps the library versions in `package.json` Signed-off-by: Alexandre Bonneau <alexandre.bonneau@linuxfr.eu>

view details

push time in 7 days

push eventautoNumeric/autoNumeric

Alexandre Bonneau

commit sha b4d9b6d57307e244af299b1263fbef7e287f3709

Fixes some errors in the typescript definitions file and fixes the indentation Signed-off-by: Alexandre Bonneau <alexandre.bonneau@linuxfr.eu>

view details

push time in 7 days

issue closedautoNumeric/autoNumeric

Accept %-character

I want to define a field for numeric input - with an optional %-character, The idea is that users may enter "0.5" or "50%". I only found suffixText which would add it permanently - and obviously that is not appropriate for an input like 0.5. This is more something like ignoreChars, I think - except that this isn't implemented (yet). Is there another way to make it possible for a field to enter "%" (w/o it affecting the numeric value)?

closed time in 7 days

mbaas2

issue commentautoNumeric/autoNumeric

Accept %-character

You could use showOnlyNumbersOnFocus in combination with the divisorWhenUnfocused option to multiply by 100 on blur, so that if your user enters 0.5, then it would show 50% on blur.

However we will not complexify AutoNumeric to detect if a value is in the [0;1] range ; you can use minimumValue and maximumValue for this.

mbaas2

comment created time in 7 days

issue commentpwr-Solaar/Solaar

Device support: MX Anywhere 2S

Using solaar version 1.0.1 (1.0.1+dfsg-3 from Debian to be exact), the MX Anywhere 2S dongle is shown in the solaar window, however it stays grayed out. Am I missing something?

yochananmarqos

comment created time in 19 days

issue commentsignalapp/Signal-Android

Signal adds the wrong country code on received SMS with dual-sim phone

Any news on this? This is a pretty critical bug, since it has 2 consequences :

  1. When you answer, you send your message to a wrong number (which is pretty bad for privacy, and cost-wise since you're contacting another country), and
  2. You cannot follow a conversation with some numbers since you'll receive their message on the wrong number, but have to change of conversation thread to reply.

All in all it makes Signal useless in dual-sim configuration if one or two sims do not share the country code used to create the Signal account.

AlexandreBonneau

comment created time in 21 days

issue commentsignalapp/Signal-Android

Text message are sent, but randomly never received

Unfortunately, they are never received, even when opening the Signal app, or closing and reopening it. The battery optimizations are disabled on the receiver phone for The Signal app.

AlexandreBonneau

comment created time in a month

issue openedsignalapp/Signal-Android

Text message are sent, but randomly never received

  • [x] I have searched open and closed issues for duplicates
  • [x] I am submitting a bug report for existing functionality that does not work as intended
  • [x] I have read https://github.com/signalapp/Signal-Android/wiki/Submitting-useful-bug-reports
  • [x] This isn't a feature request or a discussion topic

Bug description

For a couple days now, when I send some messages either via the Android signal app, or the desktop one, some message are sent, but never arrive on the receiver's phone. The bug seems totally random, except that once a message isn't received, subsequent messages within a span of approximately an hour are not received either.

Steps to reproduce

  • Use the android app to send a text message
  • The first 'check' is shown
  • The second 'check' is never shown, and on the other end the receiver never receive the message
  • Do note that when sending a message via Android, the desktop app will correctly picked it up and show it (as sent only, not received)

Device info

<!-- replace the examples with your info --> Device: Realme x2 pro Android version: 9 Signal version: 4.53.7

Link to debug log

The bug is random, capturing a log is tricky

created time in a month

issue commentnextcloud/calendar

Allow configuration (or change default) of slotDuration in v2.0.0+ to 30m

Note from people like me ; if the default slotDuration would be configurable, we couldn't care less about the default value on a fresh installation ;)

raoulbhatia

comment created time in a month

issue commentwebdriverio/webdriverio

Simplify special keys in add/set value commands

@erwinheitzman has the Key object any other capability? If not I don't see any value to have Key.Enter instead of just Enter.

Using such an object means your IDE will help you, and this is very, very important compared to just having to guess if the delete key is written Delete or delete ;)

christian-bromann

comment created time in a month

issue commentwebdriverio/webdriverio

Simplify special keys in add/set value commands

Perhaps somebody more knowledgeable than me could weigh in about choosing Key over key, or vice versa ! My guess is that if Key is an class, they write it like that, otherwise if it's simple object, you could use key.

In that example, yes, key could be an attribute imported from webdriverio. For instance with AutoNumeric we have a similar attribute.

christian-bromann

comment created time in a month

issue closedautoNumeric/autoNumeric

The event passed as a parameter is not a valid wheel event, 'wheel' given.

  1. Open http://autonumeric.js on macbook
  2. Focus the currency input
  3. Scroll to the left or right in the input by using touchpad

image

closed time in a month

serginnios

issue commentautoNumeric/autoNumeric

AutoNumber doesn't allow persian or arabic number in input box via android

I'm not sure to follow. Are you using persian.js in combination with AutoNumeric ? Could you please describle precisely what you are doing to reproduce the bug ? Would you have a screencast if you feel reproducing it will be hard for non-arabic/persian speakers ?

For instance, when you enter ۳۴۵ in the autoNumeric field, do you get 345? For instance, when you enter ٣٤٥ in the autoNumeric field, do you get 345?

sonsy-soft

comment created time in a month

issue commentautoNumeric/autoNumeric

Android allows dot `.` after value with `decimalPlaces: 0` set

Using Android 9 with Firefox mobile, I get another weird behavior ; When putting the caret after 42|, then typing once ., nothing happens which is normal. But if you enter . again, then the 2 is dropped and you get 4|. Again, if you type . once more, nothing happens, but typing . a fourth time removes the 4 as well.

cooksworld

comment created time in a month

issue commentautoNumeric/autoNumeric

Inconsistent behaviour of onInvalidPaste

Indeed, since you are using onInvalidPaste: 'clamp', selecting all the content of the field should not change the result, and clamp the value to the maximum allowed.

JamesKhoury

comment created time in a month

PR closed autoNumeric/autoNumeric

Typescript declaration file

I wrote a Typescript typings declaration file for using AutoNumeric as an ambient JS include in a TypeScript project. It contains most methods and properties, but not all. Some of the documentation isn't clear but it will be fine for 90% of projects.

+348 -0

10 comments

1 changed file

jimmythecoder

pr closed time in a month

pull request commentautoNumeric/autoNumeric

Typescript declaration file

The updated definition file has been merged in #661, based on your work. Thanks @jimmythecoder and @chadbengen !

jimmythecoder

comment created time in a month

push eventautoNumeric/autoNumeric

Sebastian Busch

commit sha aef0733bf14db055c2b9e830a81cdf3ea959e7b9

Adds a Typescript definitions file This commit adds the first draft of a Typescript definitions file, to be improved subsequently. This is the result of the work of @jimmythecoder, @chadbengen and @sbusch.

view details

push time in a month

PR merged autoNumeric/autoNumeric

TypeScript definitions, another try

Another try for TypeScript definitions, after #531 and https://gist.github.com/chadbengen/7a3b696789b4af73b6be9ee4ccdbf05d

We have primarily added definitions for the parts we're using, so many methods and options are missing at the moment. But this IMO shouldn't be a blocker since it is a good starting point for others to contribute for methods/options they're using and there shouldn't be any regression for anyone using autoNumeric with TS at the moment (most probably using autoNumeric as a typeless black-box via declare module 'autonumeric')

Some more notes:

  • in contrast to previous attempts, this one tries to properly follow the TS recommendation for class definitions by using declare class
  • some of @AlexandreBonneau comments at #531 regarding constructor and multiple() have been addressed

We're very interested in getting this merged, so we're eager for your feedback!

(Edit: typos)

+522 -3

7 comments

2 changed files

sbusch

pr closed time in a month

pull request commentautoNumeric/autoNumeric

Typescript declaration file

@mseele #661 is on the way, which merge work from this PR

jimmythecoder

comment created time in a month

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

 To solve that, you'd need to either set \`decimalPlacesRawValue\` to \`null\`, o     /**      * Process deletion of characters when the minus sign is to the right of the numeric characters.      *-     * @param {string} left The part on the left of the caret or selection-     * @param {string} right The part on the right of the caret or selection+     * @param {[string, string]} [left, right] The part on the left and on the right of the caret or selection

The CI tests fails while choking on that JSDoc syntax. The JSDoc is indeed wrong, but the change must be accepted by the linter

sbusch

comment created time in a month

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

-/*~ Note that ES6 modules cannot directly export class objects.- *~ This file should be imported using the CommonJS-style:- *~   import x = require('autonumeric');- *~- *~ Alternatively, if --allowSyntheticDefaultImports or- *~ --esModuleInterop is turned on, this file can also be- *~ imported as a default import:- *~   import x from 'autonumeric';- *~- *~ Refer to the TypeScript documentation at- *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require- *~ to understand common workarounds for this limitation of ES6 modules.+/**+ * Note that ES6 modules cannot directly export class objects.+ * This file should be imported using the CommonJS-style:+ *   import AutoNumeric = require('autonumeric');+ *+ * Alternatively, if --allowSyntheticDefaultImports or+ * --esModuleInterop is turned on, this file can also be+ * imported as a default import:+ *   import AutoNumeric from 'autonumeric';+ *+ * Refer to the TypeScript documentation at+ * https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ * to understand common workarounds for this limitation of ES6 modules.  */  -/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when- *~ loaded outside a module loader environment, declare that global here:- *~ export as namespace myClassLib;+/**+ * If this module is a UMD module that exposes a global variable 'myClassLib' when+ * loaded outside a module loader environment, declare that global here:+ * export as namespace myClassLib;  */ -/* The class constructor function is the exported object from the file */+/**+ * The class constructor function is the exported object from the file+ */ export = AutoNumeric;  declare class AutoNumeric {   constructor(     elementOrSelector: string | HTMLInputElement | HTMLElement,-    defaultValue: string | number = null,-    options: AutoNumericOptions | string = null-  ): Input;--  // someProperty: string[];+    initialValue: string | number = null,+    options: Options | string = null+  ): AutoNumeric; -  multiple(+  static multiple(     elementsOrSelector:       | string       | HTMLElement[]       | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },     initialValue: number | Array<number | null> = null,-    options: AutoNumericOptions | AutoNumericOptions[] = null-  ): Input;+    options: Options | Options[] = null+  ): AutoNumeric[];++  /**+   * Return true in the settings are valid+   */+  static areSettingsValid(options: Options): boolean;++  /**+   * Format the given number with the given options. This returns the formatted value as a string.+   */+  static format(value: number | string | HTMLElement, options: Options): string;++  /**+   * Format the domElement value with the given options and returns the formatted value as a string.+   */+  static formatAndSet(domElement: HTMLElement, options: Options): string;++  /**+   * Return the AutoNumeric object that manages the given DOM element+   */+  static getAutoNumericElement(domElement: HTMLElement): Input;    /**-   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   * Return the default autoNumeric settings+   */+  static getDefaultConfig(): Options;++  /**+   * Return all the predefined options in one object+   */+  static getPredefinedOptions(): PredefinedOptions;++  /**+   * Return true if the given DOM element has an AutoNumeric object that manages it.+   */+  static isManagedByAutoNumeric(domElement: HTMLElement): boolean;++  /**+   * Unformat and localize the given formatted string with the given options.+   */+  static localize(value: string | HTMLElement, options: Options): string;++  static localizeAndSet(domElement: HTMLElement, options: Options): string;++  static mergeOptions(...options: Options[]): Options;++  static reformatAndSet(referenceToTheDomElement: HTMLElement): void;++  static test(domElement: HTMLElement): boolean;++  static validate(options: Options): boolean;++  static version(): string;++  /**+   * Set the given element value, and format it immediately.+   * Additionally, this `set()` method can accept options that will be merged into the current AutoNumeric element, taking precedence over any previous settings.+   *+   * @example anElement.set('12345.67') // Formats the value+   * @example anElement.set(12345.67) // Formats the value+   * @example anElement.set(12345.67, { decimalCharacter : ',' }) // Update the settings and formats the value in one go+   * @example anElement.northAmerican().set('$12,345.67') // Set an already formatted value (this does not _exactly_ respect the currency symbol/negative placements, but only remove all non-numbers characters, according to the ones given in the settings)+   * @example anElement.set(null) // Set the rawValue and element value to `null`+   *+   * @param {number|string|null} newValue The value must be a Number, a numeric string or `null` (if `emptyInputBehavior` is set to `'null'`)+   * @param {object} options A settings object that will override the current settings. Note: the update is done only if the `newValue` is defined.+   * @param {boolean} saveChangeToHistory If set to `true`, then the change is recorded in the history table+   * @returns {AutoNumeric}+   * @throws    */   set(     value: number | string | null,-    options?: AutoNumericOptions,-    save?: boolean+    options?: Options,+    saveChangeToHistory?: boolean   ): void; -  update(...options: AutoNumericOptions[]): void;+  setUnformatted(value: number, options?: Options): void; -  remove(): void;+  get(callback?: (value: string, instance: AutoNumeric) => void): string; +  getFormatted(+    callback?: (value: string, instance: AutoNumeric) => void+  ): string;++  /**+   * Returns a plain number value without formatting+   */   getNumber(     callback: (value: number | null, instance: AutoNumeric) => void = null   ): number | null;    getNumericString(-    callback: (value: string | null, instance: AutoNumeric) => void = null+    callback?: (value: string | null, instance: AutoNumeric) => void = null   ): string | null; -  static getPredefinedOptions(): AutoNumericOptions;+  getLocalized(callback: (value: string) => void): string;++  reformat(): void;++  unformat(): void;++  unformatLocalized(forcedOutputFormat?: OutputFormatOption): void;++  isPristine(): boolean;++  select(): void;++  selectNumber(): void;++  selectInteger(): void;++  selectDecimal(): void;++  clear(reset?: boolean): void;++  update(...options: Options[]): Input;++  /**+   * Remove the autoNumeric listeners from the element (previous name : 'destroy'). Keep the element content intact.+   */+  remove(): void;++  /**+   * Remove the autoNumeric listeners from the element, and reset its value to ''+   */+  wipe(): void;++  /**+   * Remove the autoNumeric listeners from the element, and delete the DOM element altogether+   */+  nuke(): void;++  /**+   * Return the DOM element reference of the autoNumeric-managed element+   */+  node(): HTMLInputElement;++  parent(): HTMLElement;++  detach(): void;++  attach(otherAnElement: HTMLElement, reFormat?: boolean): void;++  init(domeElement2: HTMLElement): Input;++  form(forcedSearch?: boolean): HTMLFormElement;++  formNumericString(): string;++  formFormatted(): string;++  formLocalized(forcedOutputFormat?: PredefinedLanguages): string;++  formArrayNumericString(): HTMLInputElement[];++  formArrayFormatted(): HTMLInputElement[];++  formArrayLocalized(): HTMLInputElement[];++  formJsonNumericString(): string;++  formJsonFormatted(): string;++  formJsonLocalized(): string;++  formUnformat(): void;++  formReformat(): void;++  formSubmitArrayNumericString(callback: Function): Input;++  formSubmitArrayFormatted(callback: Function): Input;++  formSubmitArrayLocalized(callback: Function): Input;++  formSubmitJsonNumericString(callback: Function): Input;++  formSubmitJsonFormatted(callback: Function): Input;++  formSubmitJsonLocalized(callback: Function): Input; } -/* Expose types as well */+/**+ * Expose types as well+ */ declare namespace AutoNumeric {-  export type OutputFormat = 'string' | 'number';+  export type OutputFormatOption =+    | "string"+    | "number"+    | "."+    | "-."+    | ","+    | "-,"+    | ".-"+    | ",-"+    | null;++  export type CaretPositionOption =+    | "start"+    | "end"+    | "decimalLeft"+    | "decimalRight"+    | "doNoForceCaretPosition";

I unfortunately have close to no time to investigate the --declaration and --allowJs flags and typescript compilers, nor typescript tests.

It would be great if you could continue your work on that subject even after I merge your PR ;)

sbusch

comment created time in a month

issue commentwebdriverio/webdriverio

Simplify special keys in add/set value commands

On my end, and for most newcomers, using:

browser.addValue("foobar {Enter}");

means you append the "foobar {Enter}" string to the current input value.

Using your approach it would mean that when the user wants to enter the { or } characters, he will need to escape those so that they are not interpreted?

browser.addValue("foobar \{Enter\}");

I do not like that hackery! (Also, I'm not sure parsing this correctly will be simple enough)

All in all, I think after re-reading that issue that the browser.addValue(["foobar", "Enter"]) approach is good since you clearly indicate what you want to enter as a string, but not good enough since strings and keys are not explicitly distinct. On the other hand browser.addValue("foobar {Enter}"); is bad since you mix in the same argument characters and keys, making it hard to decipher. For instance in that example above, I assume webdriver will first enter the "foobar " string (notice the trailing space), then input the Enter key.

When you need to input multiple keys, that version starts to be hell to manage ; for instance if you want to do browser.addValue("foo{Ctrl}a{Ctrl}bar{Ctrl}ac{Ctrl}{Tab}{Ctrl}v{Ctrl}"); (essentially entering foo, then selecting all then replacing it with bar, then selecting bar, coping it in the clipboard, then focusing on the next input and pasting bar. If at one point you want to modify one of those commands, you won't get a good diff if everything is on one line, instead you would want to have something like this :

browser.addValue(
    "foo
    {Ctrl}a{Ctrl}
    bar
    {Ctrl}ac{Ctrl}
    {Tab}
    {Ctrl}v{Ctrl}"
);

...however in that case you'll append the newlines and 4 whitespaces before/after each strings.

The current array approach here is better in my opinion, but could be even clearer by using a specific Key object (to be defined), like this:

browser.addValue([
    "foo",
    Key.Ctrl, "a", Key.Ctrl,
    "bar",
    Key.Ctrl, "ac", Key.Ctrl,
    Key.Tab,
    Key.Ctrl, "v", Key.Ctrl
]);
christian-bromann

comment created time in a month

issue openedautoNumeric/autoNumeric

Add an option to `allowDecimalPadding` for displaying '--' instead of '00'

In some countries, integer only prices are shown like 5,-- €, instead of 5,00 €. We should add an option to allowDecimalPadding for displaying '--' instead of '00'.

created time in 2 months

startedsharkwouter/minigalaxy

started time in 2 months

issue commentsignalapp/Signal-Android

Unable to restore encrypted backup

This made me a little curious, as the second passphrase I was given was definitely different from the first one. I tried the original (first) passphrase, and it began decrypting immediately. I suspect my particular issue stems from some kind of race condition, because I tapped the switch to disable/enable backups very quickly and clicked to make a new backup immediately afterwards. It generated a new key, but didn't use it for the newer backup at all.

I can confirm this. Backup that I created immediately after disabling and reenabling backup creation could not be decrypted with passphrase displayed on backup creation but that one I created ~30 minutes later was working fine.

Well, this comment saved my day! I had a 3.7GB backup file that couldn't be restored, so I first removed some media and got to a 3.1GB backup size, then removed the previous saves, waited a few minutes (and even rebooted the phone), then created a new one, and then the code was ok.

johanw666

comment created time in 2 months

issue commentautoNumeric/autoNumeric

AutoNumber doesn't allow persian or arabic number in input box via android

Do you have to compose the numbers, or can you input it directly?

sonsy-soft

comment created time in 2 months

issue commentautoNumeric/autoNumeric

when i submit 1 but autonumeric view 100

Thanks for reporting this issue, however with the few information you gave us, we are not able to correctly reproduce it. Could you please create a reproducible test case so we can fix your bug?

whitedevil0303

comment created time in 2 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

-/*~ Note that ES6 modules cannot directly export class objects.- *~ This file should be imported using the CommonJS-style:- *~   import x = require('autonumeric');- *~- *~ Alternatively, if --allowSyntheticDefaultImports or- *~ --esModuleInterop is turned on, this file can also be- *~ imported as a default import:- *~   import x from 'autonumeric';- *~- *~ Refer to the TypeScript documentation at- *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require- *~ to understand common workarounds for this limitation of ES6 modules.+/**+ * Note that ES6 modules cannot directly export class objects.+ * This file should be imported using the CommonJS-style:+ *   import AutoNumeric = require('autonumeric');+ *+ * Alternatively, if --allowSyntheticDefaultImports or+ * --esModuleInterop is turned on, this file can also be+ * imported as a default import:+ *   import AutoNumeric from 'autonumeric';+ *+ * Refer to the TypeScript documentation at+ * https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ * to understand common workarounds for this limitation of ES6 modules.  */  -/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when- *~ loaded outside a module loader environment, declare that global here:- *~ export as namespace myClassLib;+/**+ * If this module is a UMD module that exposes a global variable 'myClassLib' when+ * loaded outside a module loader environment, declare that global here:+ * export as namespace myClassLib;  */ -/* The class constructor function is the exported object from the file */+/**+ * The class constructor function is the exported object from the file+ */ export = AutoNumeric;  declare class AutoNumeric {   constructor(     elementOrSelector: string | HTMLInputElement | HTMLElement,-    defaultValue: string | number = null,-    options: AutoNumericOptions | string = null-  ): Input;--  // someProperty: string[];+    initialValue: string | number = null,+    options: Options | string = null+  ): AutoNumeric; -  multiple(+  static multiple(     elementsOrSelector:       | string       | HTMLElement[]       | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },     initialValue: number | Array<number | null> = null,-    options: AutoNumericOptions | AutoNumericOptions[] = null-  ): Input;+    options: Options | Options[] = null+  ): AutoNumeric[];++  /**+   * Return true in the settings are valid+   */+  static areSettingsValid(options: Options): boolean;++  /**+   * Format the given number with the given options. This returns the formatted value as a string.+   */+  static format(value: number | string | HTMLElement, options: Options): string;++  /**+   * Format the domElement value with the given options and returns the formatted value as a string.+   */+  static formatAndSet(domElement: HTMLElement, options: Options): string;++  /**+   * Return the AutoNumeric object that manages the given DOM element+   */+  static getAutoNumericElement(domElement: HTMLElement): Input;    /**-   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   * Return the default autoNumeric settings+   */+  static getDefaultConfig(): Options;++  /**+   * Return all the predefined options in one object+   */+  static getPredefinedOptions(): PredefinedOptions;++  /**+   * Return true if the given DOM element has an AutoNumeric object that manages it.+   */+  static isManagedByAutoNumeric(domElement: HTMLElement): boolean;++  /**+   * Unformat and localize the given formatted string with the given options.+   */+  static localize(value: string | HTMLElement, options: Options): string;++  static localizeAndSet(domElement: HTMLElement, options: Options): string;++  static mergeOptions(...options: Options[]): Options;++  static reformatAndSet(referenceToTheDomElement: HTMLElement): void;++  static test(domElement: HTMLElement): boolean;++  static validate(options: Options): boolean;++  static version(): string;++  /**+   * Set the given element value, and format it immediately.+   * Additionally, this `set()` method can accept options that will be merged into the current AutoNumeric element, taking precedence over any previous settings.+   *+   * @example anElement.set('12345.67') // Formats the value+   * @example anElement.set(12345.67) // Formats the value+   * @example anElement.set(12345.67, { decimalCharacter : ',' }) // Update the settings and formats the value in one go+   * @example anElement.northAmerican().set('$12,345.67') // Set an already formatted value (this does not _exactly_ respect the currency symbol/negative placements, but only remove all non-numbers characters, according to the ones given in the settings)+   * @example anElement.set(null) // Set the rawValue and element value to `null`+   *+   * @param {number|string|null} newValue The value must be a Number, a numeric string or `null` (if `emptyInputBehavior` is set to `'null'`)+   * @param {object} options A settings object that will override the current settings. Note: the update is done only if the `newValue` is defined.+   * @param {boolean} saveChangeToHistory If set to `true`, then the change is recorded in the history table+   * @returns {AutoNumeric}+   * @throws    */   set(     value: number | string | null,-    options?: AutoNumericOptions,-    save?: boolean+    options?: Options,+    saveChangeToHistory?: boolean   ): void; -  update(...options: AutoNumericOptions[]): void;+  setUnformatted(value: number, options?: Options): void; -  remove(): void;+  get(callback?: (value: string, instance: AutoNumeric) => void): string; +  getFormatted(+    callback?: (value: string, instance: AutoNumeric) => void+  ): string;++  /**+   * Returns a plain number value without formatting+   */   getNumber(     callback: (value: number | null, instance: AutoNumeric) => void = null   ): number | null;    getNumericString(-    callback: (value: string | null, instance: AutoNumeric) => void = null+    callback?: (value: string | null, instance: AutoNumeric) => void = null   ): string | null; -  static getPredefinedOptions(): AutoNumericOptions;+  getLocalized(callback: (value: string) => void): string;++  reformat(): void;++  unformat(): void;++  unformatLocalized(forcedOutputFormat?: OutputFormatOption): void;++  isPristine(): boolean;++  select(): void;++  selectNumber(): void;++  selectInteger(): void;++  selectDecimal(): void;++  clear(reset?: boolean): void;++  update(...options: Options[]): Input;++  /**+   * Remove the autoNumeric listeners from the element (previous name : 'destroy'). Keep the element content intact.+   */+  remove(): void;++  /**+   * Remove the autoNumeric listeners from the element, and reset its value to ''+   */+  wipe(): void;++  /**+   * Remove the autoNumeric listeners from the element, and delete the DOM element altogether+   */+  nuke(): void;++  /**+   * Return the DOM element reference of the autoNumeric-managed element+   */+  node(): HTMLInputElement;++  parent(): HTMLElement;++  detach(): void;++  attach(otherAnElement: HTMLElement, reFormat?: boolean): void;++  init(domeElement2: HTMLElement): Input;++  form(forcedSearch?: boolean): HTMLFormElement;++  formNumericString(): string;++  formFormatted(): string;++  formLocalized(forcedOutputFormat?: PredefinedLanguages): string;++  formArrayNumericString(): HTMLInputElement[];++  formArrayFormatted(): HTMLInputElement[];++  formArrayLocalized(): HTMLInputElement[];++  formJsonNumericString(): string;++  formJsonFormatted(): string;++  formJsonLocalized(): string;++  formUnformat(): void;++  formReformat(): void;++  formSubmitArrayNumericString(callback: Function): Input;++  formSubmitArrayFormatted(callback: Function): Input;++  formSubmitArrayLocalized(callback: Function): Input;++  formSubmitJsonNumericString(callback: Function): Input;++  formSubmitJsonFormatted(callback: Function): Input;++  formSubmitJsonLocalized(callback: Function): Input; } -/* Expose types as well */+/**+ * Expose types as well+ */ declare namespace AutoNumeric {-  export type OutputFormat = 'string' | 'number';+  export type OutputFormatOption =+    | "string"+    | "number"+    | "."+    | "-."+    | ","+    | "-,"+    | ".-"+    | ",-"+    | null;++  export type CaretPositionOption =+    | "start"+    | "end"+    | "decimalLeft"+    | "decimalRight"+    | "doNoForceCaretPosition";

Well, I'm not a typescript user so your choice will be better than mine.

However regarding code quality, I strive to make code that is 100% green in tests, with maximum coverage and more importantly, that is not in an "half-state".

This is why I asked insistently if there was a way to automate the generation of such definition since the AutoNumeric jsdoc is 100% accurate and up-to-date. Your point B mentions that sync problem that would invariably happen over time (specially since I do not have any automated tests to check against that TS definition).

However, since it seems from the very first tries to add a TS definition to the project that's it's difficult and/or takes time to do, I'm willing to accept to merge that first version when corrected, given that the goal is still to make it perfectly synchronized in the near future with the current code base.

sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

-/*~ Note that ES6 modules cannot directly export class objects.- *~ This file should be imported using the CommonJS-style:- *~   import x = require('autonumeric');- *~- *~ Alternatively, if --allowSyntheticDefaultImports or- *~ --esModuleInterop is turned on, this file can also be- *~ imported as a default import:- *~   import x from 'autonumeric';- *~- *~ Refer to the TypeScript documentation at- *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require- *~ to understand common workarounds for this limitation of ES6 modules.+/**+ * Note that ES6 modules cannot directly export class objects.+ * This file should be imported using the CommonJS-style:+ *   import AutoNumeric = require('autonumeric');+ *+ * Alternatively, if --allowSyntheticDefaultImports or+ * --esModuleInterop is turned on, this file can also be+ * imported as a default import:+ *   import AutoNumeric from 'autonumeric';+ *+ * Refer to the TypeScript documentation at+ * https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ * to understand common workarounds for this limitation of ES6 modules.  */  -/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when- *~ loaded outside a module loader environment, declare that global here:- *~ export as namespace myClassLib;+/**+ * If this module is a UMD module that exposes a global variable 'myClassLib' when+ * loaded outside a module loader environment, declare that global here:+ * export as namespace myClassLib;  */ -/* The class constructor function is the exported object from the file */+/**+ * The class constructor function is the exported object from the file+ */ export = AutoNumeric;  declare class AutoNumeric {   constructor(     elementOrSelector: string | HTMLInputElement | HTMLElement,-    defaultValue: string | number = null,-    options: AutoNumericOptions | string = null-  ): Input;--  // someProperty: string[];+    initialValue: string | number = null,+    options: Options | string = null+  ): AutoNumeric; -  multiple(+  static multiple(     elementsOrSelector:       | string       | HTMLElement[]       | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },     initialValue: number | Array<number | null> = null,-    options: AutoNumericOptions | AutoNumericOptions[] = null-  ): Input;+    options: Options | Options[] = null+  ): AutoNumeric[];++  /**+   * Return true in the settings are valid+   */+  static areSettingsValid(options: Options): boolean;++  /**+   * Format the given number with the given options. This returns the formatted value as a string.+   */+  static format(value: number | string | HTMLElement, options: Options): string;++  /**+   * Format the domElement value with the given options and returns the formatted value as a string.+   */+  static formatAndSet(domElement: HTMLElement, options: Options): string;++  /**+   * Return the AutoNumeric object that manages the given DOM element+   */+  static getAutoNumericElement(domElement: HTMLElement): Input;    /**-   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   * Return the default autoNumeric settings+   */+  static getDefaultConfig(): Options;++  /**+   * Return all the predefined options in one object+   */+  static getPredefinedOptions(): PredefinedOptions;++  /**+   * Return true if the given DOM element has an AutoNumeric object that manages it.+   */+  static isManagedByAutoNumeric(domElement: HTMLElement): boolean;++  /**+   * Unformat and localize the given formatted string with the given options.+   */+  static localize(value: string | HTMLElement, options: Options): string;++  static localizeAndSet(domElement: HTMLElement, options: Options): string;++  static mergeOptions(...options: Options[]): Options;++  static reformatAndSet(referenceToTheDomElement: HTMLElement): void;++  static test(domElement: HTMLElement): boolean;++  static validate(options: Options): boolean;++  static version(): string;++  /**+   * Set the given element value, and format it immediately.+   * Additionally, this `set()` method can accept options that will be merged into the current AutoNumeric element, taking precedence over any previous settings.+   *+   * @example anElement.set('12345.67') // Formats the value+   * @example anElement.set(12345.67) // Formats the value+   * @example anElement.set(12345.67, { decimalCharacter : ',' }) // Update the settings and formats the value in one go+   * @example anElement.northAmerican().set('$12,345.67') // Set an already formatted value (this does not _exactly_ respect the currency symbol/negative placements, but only remove all non-numbers characters, according to the ones given in the settings)+   * @example anElement.set(null) // Set the rawValue and element value to `null`+   *+   * @param {number|string|null} newValue The value must be a Number, a numeric string or `null` (if `emptyInputBehavior` is set to `'null'`)+   * @param {object} options A settings object that will override the current settings. Note: the update is done only if the `newValue` is defined.+   * @param {boolean} saveChangeToHistory If set to `true`, then the change is recorded in the history table+   * @returns {AutoNumeric}+   * @throws    */   set(     value: number | string | null,-    options?: AutoNumericOptions,-    save?: boolean+    options?: Options,+    saveChangeToHistory?: boolean   ): void; -  update(...options: AutoNumericOptions[]): void;+  setUnformatted(value: number, options?: Options): void; -  remove(): void;+  get(callback?: (value: string, instance: AutoNumeric) => void): string; +  getFormatted(+    callback?: (value: string, instance: AutoNumeric) => void+  ): string;++  /**+   * Returns a plain number value without formatting+   */   getNumber(     callback: (value: number | null, instance: AutoNumeric) => void = null   ): number | null;    getNumericString(-    callback: (value: string | null, instance: AutoNumeric) => void = null+    callback?: (value: string | null, instance: AutoNumeric) => void = null   ): string | null; -  static getPredefinedOptions(): AutoNumericOptions;+  getLocalized(callback: (value: string) => void): string;++  reformat(): void;++  unformat(): void;

To neither of those ; it seems my selection was wrong, that comment I mentioned should go above the update() function.

sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

-/*~ Note that ES6 modules cannot directly export class objects.- *~ This file should be imported using the CommonJS-style:- *~   import x = require('autonumeric');- *~- *~ Alternatively, if --allowSyntheticDefaultImports or- *~ --esModuleInterop is turned on, this file can also be- *~ imported as a default import:- *~   import x from 'autonumeric';- *~- *~ Refer to the TypeScript documentation at- *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require- *~ to understand common workarounds for this limitation of ES6 modules.+/**+ * Note that ES6 modules cannot directly export class objects.+ * This file should be imported using the CommonJS-style:+ *   import AutoNumeric = require('autonumeric');+ *+ * Alternatively, if --allowSyntheticDefaultImports or+ * --esModuleInterop is turned on, this file can also be+ * imported as a default import:+ *   import AutoNumeric from 'autonumeric';+ *+ * Refer to the TypeScript documentation at+ * https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ * to understand common workarounds for this limitation of ES6 modules.  */  -/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when- *~ loaded outside a module loader environment, declare that global here:- *~ export as namespace myClassLib;+/**+ * If this module is a UMD module that exposes a global variable 'myClassLib' when+ * loaded outside a module loader environment, declare that global here:+ * export as namespace myClassLib;

That assumption is correct.

sbusch

comment created time in 3 months

push eventautoNumeric/vue-autoNumeric

shrpne

commit sha 606ecd090e94ced65c76947c1de052c4ba709b68

fix initial null value

view details

Alexandre

commit sha ee37562abaf99efdc0d0b0790dcba6f0d37f5efd

Merge pull request #36 from shrpne/fix-initial-null-value fix initial null value

view details

push time in 3 months

issue closedautoNumeric/vue-autoNumeric

Set value to zero after null

Hello. I have a problem displaying a zero value after null. null is not displayed in the input, but if I change the value to 0, it also does not appear... Maybe I'm doing something wrong? Or is there a way to avoid this problem?

Example https://codepen.io/Zeroox/pen/mddyerR

This has been fixed with a workaround by setting the value to '0'... But I think this is not good.

closed time in 3 months

Zettex

pull request commentautoNumeric/vue-autoNumeric

fix initial null value

Well, this is great! Sorry for the delay, I'm swamped at work for a few months now.

I'm wondering why I added those conditions initially, since AutoNumeric does accept the null and '' value when using set(). Oh well ;)

shrpne

comment created time in 3 months

issue closedautoNumeric/autoNumeric

'formulaMode: true' - not working

'formulaMode: true' - not working Tested at http://autonumeric.org/configurator

closed time in 3 months

vietmeta

issue commentautoNumeric/autoNumeric

'formulaMode: true' - not working

Well, when used in a 'normal' code, it works as expected (see that codepen). Apparently the bug is in the autonumeric website. Could you please create an issue on that repository ? Thanks !

vietmeta

comment created time in 3 months

issue commentautoNumeric/autoNumeric

Need option to indicate seed value is already localized

By the way, in your example you are using

var noDec = new AutoNumeric(document.getElementById('noDecimal'), 'euro');

while you could be using the shorter version:

let noDec = new AutoNumeric('#noDecimal', 'euro');
AndyWorral

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

-/*~ Note that ES6 modules cannot directly export class objects.- *~ This file should be imported using the CommonJS-style:- *~   import x = require('autonumeric');- *~- *~ Alternatively, if --allowSyntheticDefaultImports or- *~ --esModuleInterop is turned on, this file can also be- *~ imported as a default import:- *~   import x from 'autonumeric';- *~- *~ Refer to the TypeScript documentation at- *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require- *~ to understand common workarounds for this limitation of ES6 modules.+/**+ * Note that ES6 modules cannot directly export class objects.+ * This file should be imported using the CommonJS-style:+ *   import AutoNumeric = require('autonumeric');+ *+ * Alternatively, if --allowSyntheticDefaultImports or+ * --esModuleInterop is turned on, this file can also be+ * imported as a default import:+ *   import AutoNumeric from 'autonumeric';+ *+ * Refer to the TypeScript documentation at+ * https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ * to understand common workarounds for this limitation of ES6 modules.  */  -/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when- *~ loaded outside a module loader environment, declare that global here:- *~ export as namespace myClassLib;+/**+ * If this module is a UMD module that exposes a global variable 'myClassLib' when+ * loaded outside a module loader environment, declare that global here:+ * export as namespace myClassLib;  */ -/* The class constructor function is the exported object from the file */+/**+ * The class constructor function is the exported object from the file+ */ export = AutoNumeric;  declare class AutoNumeric {   constructor(     elementOrSelector: string | HTMLInputElement | HTMLElement,-    defaultValue: string | number = null,-    options: AutoNumericOptions | string = null-  ): Input;--  // someProperty: string[];+    initialValue: string | number = null,+    options: Options | string = null+  ): AutoNumeric; -  multiple(+  static multiple(     elementsOrSelector:       | string       | HTMLElement[]       | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },     initialValue: number | Array<number | null> = null,-    options: AutoNumericOptions | AutoNumericOptions[] = null-  ): Input;+    options: Options | Options[] = null+  ): AutoNumeric[];++  /**+   * Return true in the settings are valid+   */+  static areSettingsValid(options: Options): boolean;++  /**+   * Format the given number with the given options. This returns the formatted value as a string.+   */+  static format(value: number | string | HTMLElement, options: Options): string;++  /**+   * Format the domElement value with the given options and returns the formatted value as a string.+   */+  static formatAndSet(domElement: HTMLElement, options: Options): string;++  /**+   * Return the AutoNumeric object that manages the given DOM element+   */+  static getAutoNumericElement(domElement: HTMLElement): Input;    /**-   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   * Return the default autoNumeric settings+   */+  static getDefaultConfig(): Options;++  /**+   * Return all the predefined options in one object+   */+  static getPredefinedOptions(): PredefinedOptions;++  /**+   * Return true if the given DOM element has an AutoNumeric object that manages it.+   */+  static isManagedByAutoNumeric(domElement: HTMLElement): boolean;++  /**+   * Unformat and localize the given formatted string with the given options.+   */+  static localize(value: string | HTMLElement, options: Options): string;++  static localizeAndSet(domElement: HTMLElement, options: Options): string;++  static mergeOptions(...options: Options[]): Options;++  static reformatAndSet(referenceToTheDomElement: HTMLElement): void;++  static test(domElement: HTMLElement): boolean;++  static validate(options: Options): boolean;++  static version(): string;++  /**+   * Set the given element value, and format it immediately.+   * Additionally, this `set()` method can accept options that will be merged into the current AutoNumeric element, taking precedence over any previous settings.+   *+   * @example anElement.set('12345.67') // Formats the value+   * @example anElement.set(12345.67) // Formats the value+   * @example anElement.set(12345.67, { decimalCharacter : ',' }) // Update the settings and formats the value in one go+   * @example anElement.northAmerican().set('$12,345.67') // Set an already formatted value (this does not _exactly_ respect the currency symbol/negative placements, but only remove all non-numbers characters, according to the ones given in the settings)+   * @example anElement.set(null) // Set the rawValue and element value to `null`+   *+   * @param {number|string|null} newValue The value must be a Number, a numeric string or `null` (if `emptyInputBehavior` is set to `'null'`)+   * @param {object} options A settings object that will override the current settings. Note: the update is done only if the `newValue` is defined.+   * @param {boolean} saveChangeToHistory If set to `true`, then the change is recorded in the history table+   * @returns {AutoNumeric}+   * @throws    */   set(     value: number | string | null,-    options?: AutoNumericOptions,-    save?: boolean+    options?: Options,+    saveChangeToHistory?: boolean   ): void; -  update(...options: AutoNumericOptions[]): void;+  setUnformatted(value: number, options?: Options): void; -  remove(): void;+  get(callback?: (value: string, instance: AutoNumeric) => void): string; +  getFormatted(+    callback?: (value: string, instance: AutoNumeric) => void+  ): string;++  /**+   * Returns a plain number value without formatting+   */   getNumber(     callback: (value: number | null, instance: AutoNumeric) => void = null   ): number | null;    getNumericString(

Since the get* functions are one of the most important and used ones, it could help to add the jsdoc to those at least :

Return the unformatted value as a string.
This can also return `null` if `rawValue` is null.
sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

-/*~ Note that ES6 modules cannot directly export class objects.- *~ This file should be imported using the CommonJS-style:- *~   import x = require('autonumeric');- *~- *~ Alternatively, if --allowSyntheticDefaultImports or- *~ --esModuleInterop is turned on, this file can also be- *~ imported as a default import:- *~   import x from 'autonumeric';- *~- *~ Refer to the TypeScript documentation at- *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require- *~ to understand common workarounds for this limitation of ES6 modules.+/**+ * Note that ES6 modules cannot directly export class objects.+ * This file should be imported using the CommonJS-style:+ *   import AutoNumeric = require('autonumeric');+ *+ * Alternatively, if --allowSyntheticDefaultImports or+ * --esModuleInterop is turned on, this file can also be+ * imported as a default import:+ *   import AutoNumeric from 'autonumeric';+ *+ * Refer to the TypeScript documentation at+ * https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ * to understand common workarounds for this limitation of ES6 modules.  */  -/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when- *~ loaded outside a module loader environment, declare that global here:- *~ export as namespace myClassLib;+/**+ * If this module is a UMD module that exposes a global variable 'myClassLib' when+ * loaded outside a module loader environment, declare that global here:+ * export as namespace myClassLib;  */ -/* The class constructor function is the exported object from the file */+/**+ * The class constructor function is the exported object from the file+ */ export = AutoNumeric;  declare class AutoNumeric {   constructor(     elementOrSelector: string | HTMLInputElement | HTMLElement,-    defaultValue: string | number = null,-    options: AutoNumericOptions | string = null-  ): Input;--  // someProperty: string[];+    initialValue: string | number = null,+    options: Options | string = null+  ): AutoNumeric; -  multiple(+  static multiple(     elementsOrSelector:       | string       | HTMLElement[]       | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },     initialValue: number | Array<number | null> = null,-    options: AutoNumericOptions | AutoNumericOptions[] = null-  ): Input;+    options: Options | Options[] = null+  ): AutoNumeric[];++  /**+   * Return true in the settings are valid+   */+  static areSettingsValid(options: Options): boolean;++  /**+   * Format the given number with the given options. This returns the formatted value as a string.+   */+  static format(value: number | string | HTMLElement, options: Options): string;++  /**+   * Format the domElement value with the given options and returns the formatted value as a string.+   */+  static formatAndSet(domElement: HTMLElement, options: Options): string;++  /**+   * Return the AutoNumeric object that manages the given DOM element+   */+  static getAutoNumericElement(domElement: HTMLElement): Input;    /**-   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   * Return the default autoNumeric settings+   */+  static getDefaultConfig(): Options;++  /**+   * Return all the predefined options in one object+   */+  static getPredefinedOptions(): PredefinedOptions;++  /**+   * Return true if the given DOM element has an AutoNumeric object that manages it.+   */+  static isManagedByAutoNumeric(domElement: HTMLElement): boolean;++  /**+   * Unformat and localize the given formatted string with the given options.+   */+  static localize(value: string | HTMLElement, options: Options): string;++  static localizeAndSet(domElement: HTMLElement, options: Options): string;++  static mergeOptions(...options: Options[]): Options;++  static reformatAndSet(referenceToTheDomElement: HTMLElement): void;++  static test(domElement: HTMLElement): boolean;++  static validate(options: Options): boolean;++  static version(): string;++  /**+   * Set the given element value, and format it immediately.+   * Additionally, this `set()` method can accept options that will be merged into the current AutoNumeric element, taking precedence over any previous settings.+   *+   * @example anElement.set('12345.67') // Formats the value+   * @example anElement.set(12345.67) // Formats the value+   * @example anElement.set(12345.67, { decimalCharacter : ',' }) // Update the settings and formats the value in one go+   * @example anElement.northAmerican().set('$12,345.67') // Set an already formatted value (this does not _exactly_ respect the currency symbol/negative placements, but only remove all non-numbers characters, according to the ones given in the settings)+   * @example anElement.set(null) // Set the rawValue and element value to `null`+   *+   * @param {number|string|null} newValue The value must be a Number, a numeric string or `null` (if `emptyInputBehavior` is set to `'null'`)+   * @param {object} options A settings object that will override the current settings. Note: the update is done only if the `newValue` is defined.+   * @param {boolean} saveChangeToHistory If set to `true`, then the change is recorded in the history table+   * @returns {AutoNumeric}+   * @throws    */   set(     value: number | string | null,-    options?: AutoNumericOptions,-    save?: boolean+    options?: Options,+    saveChangeToHistory?: boolean   ): void; -  update(...options: AutoNumericOptions[]): void;+  setUnformatted(value: number, options?: Options): void; -  remove(): void;+  get(callback?: (value: string, instance: AutoNumeric) => void): string; +  getFormatted(+    callback?: (value: string, instance: AutoNumeric) => void+  ): string;++  /**+   * Returns a plain number value without formatting+   */   getNumber(     callback: (value: number | null, instance: AutoNumeric) => void = null   ): number | null;    getNumericString(-    callback: (value: string | null, instance: AutoNumeric) => void = null+    callback?: (value: string | null, instance: AutoNumeric) => void = null   ): string | null; -  static getPredefinedOptions(): AutoNumericOptions;+  getLocalized(callback: (value: string) => void): string;++  reformat(): void;++  unformat(): void;++  unformatLocalized(forcedOutputFormat?: OutputFormatOption): void;++  isPristine(): boolean;++  select(): void;++  selectNumber(): void;++  selectInteger(): void;++  selectDecimal(): void;++  clear(reset?: boolean): void;++  update(...options: Options[]): Input;++  /**+   * Remove the autoNumeric listeners from the element (previous name : 'destroy'). Keep the element content intact.+   */+  remove(): void;++  /**+   * Remove the autoNumeric listeners from the element, and reset its value to ''+   */+  wipe(): void;++  /**+   * Remove the autoNumeric listeners from the element, and delete the DOM element altogether+   */+  nuke(): void;++  /**+   * Return the DOM element reference of the autoNumeric-managed element+   */+  node(): HTMLInputElement;++  parent(): HTMLElement;++  detach(): void;++  attach(otherAnElement: HTMLElement, reFormat?: boolean): void;++  init(domeElement2: HTMLElement): Input;++  form(forcedSearch?: boolean): HTMLFormElement;++  formNumericString(): string;++  formFormatted(): string;++  formLocalized(forcedOutputFormat?: PredefinedLanguages): string;++  formArrayNumericString(): HTMLInputElement[];++  formArrayFormatted(): HTMLInputElement[];++  formArrayLocalized(): HTMLInputElement[];++  formJsonNumericString(): string;++  formJsonFormatted(): string;++  formJsonLocalized(): string;++  formUnformat(): void;++  formReformat(): void;++  formSubmitArrayNumericString(callback: Function): Input;++  formSubmitArrayFormatted(callback: Function): Input;++  formSubmitArrayLocalized(callback: Function): Input;++  formSubmitJsonNumericString(callback: Function): Input;++  formSubmitJsonFormatted(callback: Function): Input;++  formSubmitJsonLocalized(callback: Function): Input; } -/* Expose types as well */+/**+ * Expose types as well+ */ declare namespace AutoNumeric {-  export type OutputFormat = 'string' | 'number';+  export type OutputFormatOption =+    | "string"+    | "number"+    | "."+    | "-."+    | ","+    | "-,"+    | ".-"+    | ",-"+    | null;++  export type CaretPositionOption =+    | "start"+    | "end"+    | "decimalLeft"+    | "decimalRight"+    | "doNoForceCaretPosition";

This should be null if I understood how Typescript type definitions works

sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

-/*~ Note that ES6 modules cannot directly export class objects.- *~ This file should be imported using the CommonJS-style:- *~   import x = require('autonumeric');- *~- *~ Alternatively, if --allowSyntheticDefaultImports or- *~ --esModuleInterop is turned on, this file can also be- *~ imported as a default import:- *~   import x from 'autonumeric';- *~- *~ Refer to the TypeScript documentation at- *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require- *~ to understand common workarounds for this limitation of ES6 modules.+/**+ * Note that ES6 modules cannot directly export class objects.+ * This file should be imported using the CommonJS-style:+ *   import AutoNumeric = require('autonumeric');+ *+ * Alternatively, if --allowSyntheticDefaultImports or+ * --esModuleInterop is turned on, this file can also be+ * imported as a default import:+ *   import AutoNumeric from 'autonumeric';+ *+ * Refer to the TypeScript documentation at+ * https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ * to understand common workarounds for this limitation of ES6 modules.  */  -/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when- *~ loaded outside a module loader environment, declare that global here:- *~ export as namespace myClassLib;+/**+ * If this module is a UMD module that exposes a global variable 'myClassLib' when+ * loaded outside a module loader environment, declare that global here:+ * export as namespace myClassLib;  */ -/* The class constructor function is the exported object from the file */+/**+ * The class constructor function is the exported object from the file+ */ export = AutoNumeric;  declare class AutoNumeric {   constructor(     elementOrSelector: string | HTMLInputElement | HTMLElement,-    defaultValue: string | number = null,-    options: AutoNumericOptions | string = null-  ): Input;--  // someProperty: string[];+    initialValue: string | number = null,+    options: Options | string = null+  ): AutoNumeric; -  multiple(+  static multiple(     elementsOrSelector:       | string       | HTMLElement[]       | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },     initialValue: number | Array<number | null> = null,-    options: AutoNumericOptions | AutoNumericOptions[] = null-  ): Input;+    options: Options | Options[] = null+  ): AutoNumeric[];++  /**+   * Return true in the settings are valid+   */+  static areSettingsValid(options: Options): boolean;++  /**+   * Format the given number with the given options. This returns the formatted value as a string.+   */+  static format(value: number | string | HTMLElement, options: Options): string;++  /**+   * Format the domElement value with the given options and returns the formatted value as a string.+   */+  static formatAndSet(domElement: HTMLElement, options: Options): string;++  /**+   * Return the AutoNumeric object that manages the given DOM element+   */+  static getAutoNumericElement(domElement: HTMLElement): Input;    /**-   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   * Return the default autoNumeric settings+   */+  static getDefaultConfig(): Options;++  /**+   * Return all the predefined options in one object+   */+  static getPredefinedOptions(): PredefinedOptions;++  /**+   * Return true if the given DOM element has an AutoNumeric object that manages it.+   */+  static isManagedByAutoNumeric(domElement: HTMLElement): boolean;++  /**+   * Unformat and localize the given formatted string with the given options.+   */+  static localize(value: string | HTMLElement, options: Options): string;++  static localizeAndSet(domElement: HTMLElement, options: Options): string;++  static mergeOptions(...options: Options[]): Options;++  static reformatAndSet(referenceToTheDomElement: HTMLElement): void;++  static test(domElement: HTMLElement): boolean;++  static validate(options: Options): boolean;++  static version(): string;++  /**+   * Set the given element value, and format it immediately.+   * Additionally, this `set()` method can accept options that will be merged into the current AutoNumeric element, taking precedence over any previous settings.+   *+   * @example anElement.set('12345.67') // Formats the value+   * @example anElement.set(12345.67) // Formats the value+   * @example anElement.set(12345.67, { decimalCharacter : ',' }) // Update the settings and formats the value in one go+   * @example anElement.northAmerican().set('$12,345.67') // Set an already formatted value (this does not _exactly_ respect the currency symbol/negative placements, but only remove all non-numbers characters, according to the ones given in the settings)+   * @example anElement.set(null) // Set the rawValue and element value to `null`+   *+   * @param {number|string|null} newValue The value must be a Number, a numeric string or `null` (if `emptyInputBehavior` is set to `'null'`)+   * @param {object} options A settings object that will override the current settings. Note: the update is done only if the `newValue` is defined.+   * @param {boolean} saveChangeToHistory If set to `true`, then the change is recorded in the history table+   * @returns {AutoNumeric}+   * @throws    */   set(     value: number | string | null,-    options?: AutoNumericOptions,-    save?: boolean+    options?: Options,+    saveChangeToHistory?: boolean   ): void; -  update(...options: AutoNumericOptions[]): void;+  setUnformatted(value: number, options?: Options): void; -  remove(): void;+  get(callback?: (value: string, instance: AutoNumeric) => void): string; +  getFormatted(+    callback?: (value: string, instance: AutoNumeric) => void+  ): string;++  /**+   * Returns a plain number value without formatting+   */   getNumber(     callback: (value: number | null, instance: AutoNumeric) => void = null   ): number | null;    getNumericString(-    callback: (value: string | null, instance: AutoNumeric) => void = null+    callback?: (value: string | null, instance: AutoNumeric) => void = null   ): string | null; -  static getPredefinedOptions(): AutoNumericOptions;+  getLocalized(callback: (value: string) => void): string;++  reformat(): void;++  unformat(): void;++  unformatLocalized(forcedOutputFormat?: OutputFormatOption): void;++  isPristine(): boolean;++  select(): void;++  selectNumber(): void;++  selectInteger(): void;++  selectDecimal(): void;++  clear(reset?: boolean): void;++  update(...options: Options[]): Input;++  /**+   * Remove the autoNumeric listeners from the element (previous name : 'destroy'). Keep the element content intact.+   */+  remove(): void;++  /**+   * Remove the autoNumeric listeners from the element, and reset its value to ''+   */+  wipe(): void;++  /**+   * Remove the autoNumeric listeners from the element, and delete the DOM element altogether

Please change the string to:

Remove the autoNumeric data and event listeners from the element, and delete the DOM element altogether
sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

-/*~ Note that ES6 modules cannot directly export class objects.- *~ This file should be imported using the CommonJS-style:- *~   import x = require('autonumeric');- *~- *~ Alternatively, if --allowSyntheticDefaultImports or- *~ --esModuleInterop is turned on, this file can also be- *~ imported as a default import:- *~   import x from 'autonumeric';- *~- *~ Refer to the TypeScript documentation at- *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require- *~ to understand common workarounds for this limitation of ES6 modules.+/**+ * Note that ES6 modules cannot directly export class objects.+ * This file should be imported using the CommonJS-style:+ *   import AutoNumeric = require('autonumeric');+ *+ * Alternatively, if --allowSyntheticDefaultImports or+ * --esModuleInterop is turned on, this file can also be+ * imported as a default import:+ *   import AutoNumeric from 'autonumeric';+ *+ * Refer to the TypeScript documentation at+ * https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ * to understand common workarounds for this limitation of ES6 modules.  */  -/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when- *~ loaded outside a module loader environment, declare that global here:- *~ export as namespace myClassLib;+/**+ * If this module is a UMD module that exposes a global variable 'myClassLib' when+ * loaded outside a module loader environment, declare that global here:+ * export as namespace myClassLib;  */ -/* The class constructor function is the exported object from the file */+/**+ * The class constructor function is the exported object from the file+ */ export = AutoNumeric;  declare class AutoNumeric {   constructor(     elementOrSelector: string | HTMLInputElement | HTMLElement,-    defaultValue: string | number = null,-    options: AutoNumericOptions | string = null-  ): Input;--  // someProperty: string[];+    initialValue: string | number = null,+    options: Options | string = null+  ): AutoNumeric; -  multiple(+  static multiple(     elementsOrSelector:       | string       | HTMLElement[]       | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },     initialValue: number | Array<number | null> = null,-    options: AutoNumericOptions | AutoNumericOptions[] = null-  ): Input;+    options: Options | Options[] = null+  ): AutoNumeric[];++  /**+   * Return true in the settings are valid+   */+  static areSettingsValid(options: Options): boolean;++  /**+   * Format the given number with the given options. This returns the formatted value as a string.+   */+  static format(value: number | string | HTMLElement, options: Options): string;++  /**+   * Format the domElement value with the given options and returns the formatted value as a string.+   */+  static formatAndSet(domElement: HTMLElement, options: Options): string;++  /**+   * Return the AutoNumeric object that manages the given DOM element+   */+  static getAutoNumericElement(domElement: HTMLElement): Input;    /**-   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   * Return the default autoNumeric settings+   */+  static getDefaultConfig(): Options;++  /**+   * Return all the predefined options in one object+   */+  static getPredefinedOptions(): PredefinedOptions;++  /**+   * Return true if the given DOM element has an AutoNumeric object that manages it.+   */+  static isManagedByAutoNumeric(domElement: HTMLElement): boolean;++  /**+   * Unformat and localize the given formatted string with the given options.+   */+  static localize(value: string | HTMLElement, options: Options): string;++  static localizeAndSet(domElement: HTMLElement, options: Options): string;++  static mergeOptions(...options: Options[]): Options;++  static reformatAndSet(referenceToTheDomElement: HTMLElement): void;++  static test(domElement: HTMLElement): boolean;++  static validate(options: Options): boolean;++  static version(): string;++  /**+   * Set the given element value, and format it immediately.+   * Additionally, this `set()` method can accept options that will be merged into the current AutoNumeric element, taking precedence over any previous settings.+   *+   * @example anElement.set('12345.67') // Formats the value+   * @example anElement.set(12345.67) // Formats the value+   * @example anElement.set(12345.67, { decimalCharacter : ',' }) // Update the settings and formats the value in one go+   * @example anElement.northAmerican().set('$12,345.67') // Set an already formatted value (this does not _exactly_ respect the currency symbol/negative placements, but only remove all non-numbers characters, according to the ones given in the settings)+   * @example anElement.set(null) // Set the rawValue and element value to `null`+   *+   * @param {number|string|null} newValue The value must be a Number, a numeric string or `null` (if `emptyInputBehavior` is set to `'null'`)+   * @param {object} options A settings object that will override the current settings. Note: the update is done only if the `newValue` is defined.+   * @param {boolean} saveChangeToHistory If set to `true`, then the change is recorded in the history table+   * @returns {AutoNumeric}+   * @throws    */   set(     value: number | string | null,-    options?: AutoNumericOptions,-    save?: boolean+    options?: Options,+    saveChangeToHistory?: boolean   ): void; -  update(...options: AutoNumericOptions[]): void;+  setUnformatted(value: number, options?: Options): void; -  remove(): void;+  get(callback?: (value: string, instance: AutoNumeric) => void): string; +  getFormatted(+    callback?: (value: string, instance: AutoNumeric) => void+  ): string;++  /**+   * Returns a plain number value without formatting+   */   getNumber(     callback: (value: number | null, instance: AutoNumeric) => void = null   ): number | null;    getNumericString(-    callback: (value: string | null, instance: AutoNumeric) => void = null+    callback?: (value: string | null, instance: AutoNumeric) => void = null   ): string | null; -  static getPredefinedOptions(): AutoNumericOptions;+  getLocalized(callback: (value: string) => void): string;

Since the get* functions are one of the most important and used ones, it could help to add the jsdoc to those at least :

Returns the unformatted value, but following the `outputFormat` setting, which means the output can either be :
- a string (that could or could not represent a number (ie. "12345,67-")), or
- a plain number (if the setting 'number' is used).

By default the returned values are an ISO numeric string "1234.56" or "-1234.56" where the decimal character is a period.
Check the "outputFormat" option definition for more details.
sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

-/*~ Note that ES6 modules cannot directly export class objects.- *~ This file should be imported using the CommonJS-style:- *~   import x = require('autonumeric');- *~- *~ Alternatively, if --allowSyntheticDefaultImports or- *~ --esModuleInterop is turned on, this file can also be- *~ imported as a default import:- *~   import x from 'autonumeric';- *~- *~ Refer to the TypeScript documentation at- *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require- *~ to understand common workarounds for this limitation of ES6 modules.+/**+ * Note that ES6 modules cannot directly export class objects.+ * This file should be imported using the CommonJS-style:+ *   import AutoNumeric = require('autonumeric');+ *+ * Alternatively, if --allowSyntheticDefaultImports or+ * --esModuleInterop is turned on, this file can also be+ * imported as a default import:+ *   import AutoNumeric from 'autonumeric';+ *+ * Refer to the TypeScript documentation at+ * https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ * to understand common workarounds for this limitation of ES6 modules.  */  -/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when- *~ loaded outside a module loader environment, declare that global here:- *~ export as namespace myClassLib;+/**+ * If this module is a UMD module that exposes a global variable 'myClassLib' when+ * loaded outside a module loader environment, declare that global here:+ * export as namespace myClassLib;  */ -/* The class constructor function is the exported object from the file */+/**+ * The class constructor function is the exported object from the file+ */ export = AutoNumeric;  declare class AutoNumeric {   constructor(     elementOrSelector: string | HTMLInputElement | HTMLElement,-    defaultValue: string | number = null,-    options: AutoNumericOptions | string = null-  ): Input;--  // someProperty: string[];+    initialValue: string | number = null,+    options: Options | string = null+  ): AutoNumeric; -  multiple(+  static multiple(     elementsOrSelector:       | string       | HTMLElement[]       | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },     initialValue: number | Array<number | null> = null,-    options: AutoNumericOptions | AutoNumericOptions[] = null-  ): Input;+    options: Options | Options[] = null+  ): AutoNumeric[];++  /**+   * Return true in the settings are valid+   */+  static areSettingsValid(options: Options): boolean;++  /**+   * Format the given number with the given options. This returns the formatted value as a string.+   */+  static format(value: number | string | HTMLElement, options: Options): string;++  /**+   * Format the domElement value with the given options and returns the formatted value as a string.+   */+  static formatAndSet(domElement: HTMLElement, options: Options): string;++  /**+   * Return the AutoNumeric object that manages the given DOM element+   */+  static getAutoNumericElement(domElement: HTMLElement): Input;    /**-   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   * Return the default autoNumeric settings+   */+  static getDefaultConfig(): Options;++  /**+   * Return all the predefined options in one object+   */+  static getPredefinedOptions(): PredefinedOptions;++  /**+   * Return true if the given DOM element has an AutoNumeric object that manages it.+   */+  static isManagedByAutoNumeric(domElement: HTMLElement): boolean;++  /**+   * Unformat and localize the given formatted string with the given options.+   */+  static localize(value: string | HTMLElement, options: Options): string;++  static localizeAndSet(domElement: HTMLElement, options: Options): string;++  static mergeOptions(...options: Options[]): Options;++  static reformatAndSet(referenceToTheDomElement: HTMLElement): void;++  static test(domElement: HTMLElement): boolean;++  static validate(options: Options): boolean;++  static version(): string;++  /**+   * Set the given element value, and format it immediately.+   * Additionally, this `set()` method can accept options that will be merged into the current AutoNumeric element, taking precedence over any previous settings.+   *+   * @example anElement.set('12345.67') // Formats the value+   * @example anElement.set(12345.67) // Formats the value+   * @example anElement.set(12345.67, { decimalCharacter : ',' }) // Update the settings and formats the value in one go+   * @example anElement.northAmerican().set('$12,345.67') // Set an already formatted value (this does not _exactly_ respect the currency symbol/negative placements, but only remove all non-numbers characters, according to the ones given in the settings)+   * @example anElement.set(null) // Set the rawValue and element value to `null`+   *+   * @param {number|string|null} newValue The value must be a Number, a numeric string or `null` (if `emptyInputBehavior` is set to `'null'`)+   * @param {object} options A settings object that will override the current settings. Note: the update is done only if the `newValue` is defined.+   * @param {boolean} saveChangeToHistory If set to `true`, then the change is recorded in the history table+   * @returns {AutoNumeric}+   * @throws    */   set(     value: number | string | null,-    options?: AutoNumericOptions,-    save?: boolean+    options?: Options,+    saveChangeToHistory?: boolean   ): void; -  update(...options: AutoNumericOptions[]): void;+  setUnformatted(value: number, options?: Options): void; -  remove(): void;+  get(callback?: (value: string, instance: AutoNumeric) => void): string; +  getFormatted(+    callback?: (value: string, instance: AutoNumeric) => void+  ): string;++  /**+   * Returns a plain number value without formatting+   */   getNumber(     callback: (value: number | null, instance: AutoNumeric) => void = null   ): number | null;    getNumericString(-    callback: (value: string | null, instance: AutoNumeric) => void = null+    callback?: (value: string | null, instance: AutoNumeric) => void = null   ): string | null; -  static getPredefinedOptions(): AutoNumericOptions;+  getLocalized(callback: (value: string) => void): string;++  reformat(): void;++  unformat(): void;++  unformatLocalized(forcedOutputFormat?: OutputFormatOption): void;++  isPristine(): boolean;++  select(): void;++  selectNumber(): void;++  selectInteger(): void;++  selectDecimal(): void;++  clear(reset?: boolean): void;++  update(...options: Options[]): Input;++  /**+   * Remove the autoNumeric listeners from the element (previous name : 'destroy'). Keep the element content intact.+   */+  remove(): void;++  /**+   * Remove the autoNumeric listeners from the element, and reset its value to ''

Please change the string to:

Remove the autoNumeric data and event listeners from the element, and reset its value to the empty string ''.
This also clears the value from sessionStorage (or cookie, depending on browser supports).
sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

-/*~ Note that ES6 modules cannot directly export class objects.- *~ This file should be imported using the CommonJS-style:- *~   import x = require('autonumeric');- *~- *~ Alternatively, if --allowSyntheticDefaultImports or- *~ --esModuleInterop is turned on, this file can also be- *~ imported as a default import:- *~   import x from 'autonumeric';- *~- *~ Refer to the TypeScript documentation at- *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require- *~ to understand common workarounds for this limitation of ES6 modules.+/**+ * Note that ES6 modules cannot directly export class objects.+ * This file should be imported using the CommonJS-style:+ *   import AutoNumeric = require('autonumeric');+ *+ * Alternatively, if --allowSyntheticDefaultImports or+ * --esModuleInterop is turned on, this file can also be+ * imported as a default import:+ *   import AutoNumeric from 'autonumeric';+ *+ * Refer to the TypeScript documentation at+ * https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ * to understand common workarounds for this limitation of ES6 modules.  */  -/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when- *~ loaded outside a module loader environment, declare that global here:- *~ export as namespace myClassLib;+/**+ * If this module is a UMD module that exposes a global variable 'myClassLib' when+ * loaded outside a module loader environment, declare that global here:+ * export as namespace myClassLib;  */ -/* The class constructor function is the exported object from the file */+/**+ * The class constructor function is the exported object from the file+ */ export = AutoNumeric;  declare class AutoNumeric {   constructor(     elementOrSelector: string | HTMLInputElement | HTMLElement,-    defaultValue: string | number = null,-    options: AutoNumericOptions | string = null-  ): Input;--  // someProperty: string[];+    initialValue: string | number = null,+    options: Options | string = null+  ): AutoNumeric; -  multiple(+  static multiple(     elementsOrSelector:       | string       | HTMLElement[]       | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },     initialValue: number | Array<number | null> = null,-    options: AutoNumericOptions | AutoNumericOptions[] = null-  ): Input;+    options: Options | Options[] = null+  ): AutoNumeric[];++  /**+   * Return true in the settings are valid+   */+  static areSettingsValid(options: Options): boolean;++  /**+   * Format the given number with the given options. This returns the formatted value as a string.+   */+  static format(value: number | string | HTMLElement, options: Options): string;++  /**+   * Format the domElement value with the given options and returns the formatted value as a string.+   */+  static formatAndSet(domElement: HTMLElement, options: Options): string;++  /**+   * Return the AutoNumeric object that manages the given DOM element+   */+  static getAutoNumericElement(domElement: HTMLElement): Input;    /**-   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   * Return the default autoNumeric settings+   */+  static getDefaultConfig(): Options;++  /**+   * Return all the predefined options in one object+   */+  static getPredefinedOptions(): PredefinedOptions;++  /**+   * Return true if the given DOM element has an AutoNumeric object that manages it.+   */+  static isManagedByAutoNumeric(domElement: HTMLElement): boolean;++  /**+   * Unformat and localize the given formatted string with the given options.+   */+  static localize(value: string | HTMLElement, options: Options): string;++  static localizeAndSet(domElement: HTMLElement, options: Options): string;++  static mergeOptions(...options: Options[]): Options;++  static reformatAndSet(referenceToTheDomElement: HTMLElement): void;++  static test(domElement: HTMLElement): boolean;++  static validate(options: Options): boolean;++  static version(): string;++  /**+   * Set the given element value, and format it immediately.+   * Additionally, this `set()` method can accept options that will be merged into the current AutoNumeric element, taking precedence over any previous settings.+   *+   * @example anElement.set('12345.67') // Formats the value+   * @example anElement.set(12345.67) // Formats the value+   * @example anElement.set(12345.67, { decimalCharacter : ',' }) // Update the settings and formats the value in one go+   * @example anElement.northAmerican().set('$12,345.67') // Set an already formatted value (this does not _exactly_ respect the currency symbol/negative placements, but only remove all non-numbers characters, according to the ones given in the settings)+   * @example anElement.set(null) // Set the rawValue and element value to `null`+   *+   * @param {number|string|null} newValue The value must be a Number, a numeric string or `null` (if `emptyInputBehavior` is set to `'null'`)+   * @param {object} options A settings object that will override the current settings. Note: the update is done only if the `newValue` is defined.+   * @param {boolean} saveChangeToHistory If set to `true`, then the change is recorded in the history table+   * @returns {AutoNumeric}+   * @throws    */   set(     value: number | string | null,-    options?: AutoNumericOptions,-    save?: boolean+    options?: Options,+    saveChangeToHistory?: boolean   ): void; -  update(...options: AutoNumericOptions[]): void;+  setUnformatted(value: number, options?: Options): void; -  remove(): void;+  get(callback?: (value: string, instance: AutoNumeric) => void): string; +  getFormatted(+    callback?: (value: string, instance: AutoNumeric) => void+  ): string;++  /**+   * Returns a plain number value without formatting+   */   getNumber(     callback: (value: number | null, instance: AutoNumeric) => void = null   ): number | null;    getNumericString(-    callback: (value: string | null, instance: AutoNumeric) => void = null+    callback?: (value: string | null, instance: AutoNumeric) => void = null   ): string | null; -  static getPredefinedOptions(): AutoNumericOptions;+  getLocalized(callback: (value: string) => void): string;++  reformat(): void;++  unformat(): void;++  unformatLocalized(forcedOutputFormat?: OutputFormatOption): void;++  isPristine(): boolean;++  select(): void;++  selectNumber(): void;++  selectInteger(): void;++  selectDecimal(): void;++  clear(reset?: boolean): void;++  update(...options: Options[]): Input;++  /**+   * Remove the autoNumeric listeners from the element (previous name : 'destroy'). Keep the element content intact.

Please change the string to:

Remove the autoNumeric data and event listeners from the element, but keep the element content intact.
This also clears the value from sessionStorage (or cookie, depending on browser supports).
Note: this does not remove the formatting.
sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

-/*~ Note that ES6 modules cannot directly export class objects.- *~ This file should be imported using the CommonJS-style:- *~   import x = require('autonumeric');- *~- *~ Alternatively, if --allowSyntheticDefaultImports or- *~ --esModuleInterop is turned on, this file can also be- *~ imported as a default import:- *~   import x from 'autonumeric';- *~- *~ Refer to the TypeScript documentation at- *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require- *~ to understand common workarounds for this limitation of ES6 modules.+/**+ * Note that ES6 modules cannot directly export class objects.+ * This file should be imported using the CommonJS-style:+ *   import AutoNumeric = require('autonumeric');+ *+ * Alternatively, if --allowSyntheticDefaultImports or+ * --esModuleInterop is turned on, this file can also be+ * imported as a default import:+ *   import AutoNumeric from 'autonumeric';+ *+ * Refer to the TypeScript documentation at+ * https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ * to understand common workarounds for this limitation of ES6 modules.  */  -/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when- *~ loaded outside a module loader environment, declare that global here:- *~ export as namespace myClassLib;+/**+ * If this module is a UMD module that exposes a global variable 'myClassLib' when+ * loaded outside a module loader environment, declare that global here:+ * export as namespace myClassLib;  */ -/* The class constructor function is the exported object from the file */+/**+ * The class constructor function is the exported object from the file+ */ export = AutoNumeric;  declare class AutoNumeric {   constructor(     elementOrSelector: string | HTMLInputElement | HTMLElement,-    defaultValue: string | number = null,-    options: AutoNumericOptions | string = null-  ): Input;--  // someProperty: string[];+    initialValue: string | number = null,+    options: Options | string = null+  ): AutoNumeric; -  multiple(+  static multiple(     elementsOrSelector:       | string       | HTMLElement[]       | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },     initialValue: number | Array<number | null> = null,-    options: AutoNumericOptions | AutoNumericOptions[] = null-  ): Input;+    options: Options | Options[] = null+  ): AutoNumeric[];++  /**+   * Return true in the settings are valid+   */+  static areSettingsValid(options: Options): boolean;++  /**+   * Format the given number with the given options. This returns the formatted value as a string.+   */+  static format(value: number | string | HTMLElement, options: Options): string;++  /**+   * Format the domElement value with the given options and returns the formatted value as a string.+   */+  static formatAndSet(domElement: HTMLElement, options: Options): string;++  /**+   * Return the AutoNumeric object that manages the given DOM element+   */+  static getAutoNumericElement(domElement: HTMLElement): Input;    /**-   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   * Return the default autoNumeric settings+   */+  static getDefaultConfig(): Options;++  /**+   * Return all the predefined options in one object+   */+  static getPredefinedOptions(): PredefinedOptions;++  /**+   * Return true if the given DOM element has an AutoNumeric object that manages it.+   */+  static isManagedByAutoNumeric(domElement: HTMLElement): boolean;++  /**+   * Unformat and localize the given formatted string with the given options.+   */+  static localize(value: string | HTMLElement, options: Options): string;++  static localizeAndSet(domElement: HTMLElement, options: Options): string;++  static mergeOptions(...options: Options[]): Options;++  static reformatAndSet(referenceToTheDomElement: HTMLElement): void;++  static test(domElement: HTMLElement): boolean;++  static validate(options: Options): boolean;++  static version(): string;++  /**+   * Set the given element value, and format it immediately.+   * Additionally, this `set()` method can accept options that will be merged into the current AutoNumeric element, taking precedence over any previous settings.+   *+   * @example anElement.set('12345.67') // Formats the value+   * @example anElement.set(12345.67) // Formats the value+   * @example anElement.set(12345.67, { decimalCharacter : ',' }) // Update the settings and formats the value in one go+   * @example anElement.northAmerican().set('$12,345.67') // Set an already formatted value (this does not _exactly_ respect the currency symbol/negative placements, but only remove all non-numbers characters, according to the ones given in the settings)+   * @example anElement.set(null) // Set the rawValue and element value to `null`+   *+   * @param {number|string|null} newValue The value must be a Number, a numeric string or `null` (if `emptyInputBehavior` is set to `'null'`)+   * @param {object} options A settings object that will override the current settings. Note: the update is done only if the `newValue` is defined.+   * @param {boolean} saveChangeToHistory If set to `true`, then the change is recorded in the history table+   * @returns {AutoNumeric}+   * @throws    */   set(     value: number | string | null,-    options?: AutoNumericOptions,-    save?: boolean+    options?: Options,+    saveChangeToHistory?: boolean   ): void; -  update(...options: AutoNumericOptions[]): void;+  setUnformatted(value: number, options?: Options): void; -  remove(): void;+  get(callback?: (value: string, instance: AutoNumeric) => void): string; +  getFormatted(+    callback?: (value: string, instance: AutoNumeric) => void+  ): string;++  /**+   * Returns a plain number value without formatting+   */   getNumber(     callback: (value: number | null, instance: AutoNumeric) => void = null   ): number | null;    getNumericString(-    callback: (value: string | null, instance: AutoNumeric) => void = null+    callback?: (value: string | null, instance: AutoNumeric) => void = null   ): string | null; -  static getPredefinedOptions(): AutoNumericOptions;+  getLocalized(callback: (value: string) => void): string;++  reformat(): void;++  unformat(): void;++  unformatLocalized(forcedOutputFormat?: OutputFormatOption): void;++  isPristine(): boolean;++  select(): void;++  selectNumber(): void;++  selectInteger(): void;++  selectDecimal(): void;++  clear(reset?: boolean): void;++  update(...options: Options[]): Input;++  /**+   * Remove the autoNumeric listeners from the element (previous name : 'destroy'). Keep the element content intact.+   */+  remove(): void;++  /**+   * Remove the autoNumeric listeners from the element, and reset its value to ''+   */+  wipe(): void;++  /**+   * Remove the autoNumeric listeners from the element, and delete the DOM element altogether+   */+  nuke(): void;++  /**+   * Return the DOM element reference of the autoNumeric-managed element+   */+  node(): HTMLInputElement;++  parent(): HTMLElement;++  detach(): void;++  attach(otherAnElement: HTMLElement, reFormat?: boolean): void;++  init(domeElement2: HTMLElement): Input;++  form(forcedSearch?: boolean): HTMLFormElement;++  formNumericString(): string;++  formFormatted(): string;++  formLocalized(forcedOutputFormat?: PredefinedLanguages): string;++  formArrayNumericString(): HTMLInputElement[];++  formArrayFormatted(): HTMLInputElement[];++  formArrayLocalized(): HTMLInputElement[];++  formJsonNumericString(): string;++  formJsonFormatted(): string;++  formJsonLocalized(): string;++  formUnformat(): void;++  formReformat(): void;++  formSubmitArrayNumericString(callback: Function): Input;++  formSubmitArrayFormatted(callback: Function): Input;++  formSubmitArrayLocalized(callback: Function): Input;++  formSubmitJsonNumericString(callback: Function): Input;++  formSubmitJsonFormatted(callback: Function): Input;++  formSubmitJsonLocalized(callback: Function): Input; } -/* Expose types as well */+/**+ * Expose types as well+ */ declare namespace AutoNumeric {-  export type OutputFormat = 'string' | 'number';+  export type OutputFormatOption =+    | "string"+    | "number"+    | "."+    | "-."+    | ","+    | "-,"+    | ".-"+    | ",-"+    | null;++  export type CaretPositionOption =+    | "start"+    | "end"+    | "decimalLeft"+    | "decimalRight"+    | "doNoForceCaretPosition";+  export type CurrencySymbolPlacementOption = "p" | "s";+  export type EmptyInputBehaviorOption =+    | "null"+    | "focus"+    | "press"+    | "always"+    | "min"+    | "max"+    | "zero"+    | number+    | string /* representing a number */;+  export type LeadingZeroOption = "allow" | "deny" | "keep";+  export type NegativePositiveSignPlacementOption =+    | "p"+    | "s"+    | "l"+    | "r"+    | null;+  export type OnInvalidPasteOption =+    | "error"+    | "ignore"+    | "clamp"+    | "truncate"+    | "replace";+  export type OverrideMinMaxLimitsOption =+    | "ceiling"+    | "floor"+    | "ignore"+    | null;+  export type RoundingMethodOption =+    | "S"+    | "A"+    | "s"+    | "a"+    | "B"+    | "U"+    | "D"+    | "C"+    | "F"+    | "N05"+    | "CHF"+    | "U05"+    | "D05";+  export type SerializeSpacesOption = "+" | "%20";    export interface Options {-    allowDecimalPadding?: boolean | 'floats';-    suffixText?: string;+    /**+     * Allow padding the decimal places with zeros.+     * @default true+     */+    allowDecimalPadding?: boolean | "floats";++    /**+     * Determine where should be positioned the caret on focus+     * @default null+     */+    caretPositionOnFocus?: CaretPositionOption;++    /**+     * Determine if a local list of AutoNumeric objects must be kept when initializing the elements and others+     * @default true+     */+    createLocalList?: boolean;++    /**+     * Currency symbol+     * @default ''+     */     currencySymbol?: string;-    currencySymbolPlacement?: string;++    /**+     * Placement of the currency sign, relative to the number (as a prefix or a suffix)+     * @default 'p'+     */+    currencySymbolPlacement?: CurrencySymbolPlacementOption;+    /**+     * Decimal separator character+     * @default '.'+     */     decimalCharacter?: string;++    /**+     * Allow to declare alternative decimal separator which is automatically replaced by the real decimal character+     * @default null+     */     decimalCharacterAlternative?: string | null;-    decimalPlaces?: number; // 0 or positive integer++    /**+     * Defines the default number of decimal places to show on the formatted value, and to keep as the precision for the rawValue+     * 0 or positive integer+     * @default 2+     */+    decimalPlaces?: number;++    /**+     * Defines how many decimal places should be kept for the raw value.+     * @default null+     */+    decimalPlacesRawValue?: number | null;++    /**+     * The number of decimal places to show when unfocused+     * @default null+     */+    decimalPlacesShownOnBlur?: number | null;++    /**+     * The number of decimal places to show when focused+     * @default null+     */+    decimalPlacesShownOnFocus?: number | null;++    /**+     * Helper option for ASP.NET postback+     * This should be set as the value of the unformatted default value+     * examples:+     * no default value="" {defaultValueOverride: ""}+     * value=1234.56 {defaultValueOverride: '1234.56'}+     * @default null+     */+    defaultValueOverride?: string | { doNotOverride: null };++    /**+     * Digital grouping for the thousand separator+     * @default '3'+     */+    digitalGroupSpacing?: string;++    /**+     * Thousand separator character+     * @default ','+     */     digitGroupSeparator?: string;-    emptyInputBehavior?:-      | 'null'-      | 'focus'-      | 'press'-      | 'always'-      | 'min'-      | 'max'-      | 'zero'-      | number-      | string /* representing a number */;++    /**+     * Define the number that will divide the current value shown when unfocused+     * @default null+     */+    divisorWhenUnfocused?: number | null;++    emptyInputBehavior?: EmptyInputBehaviorOption;++    failOnUnknownOption?: boolean;++    formatOnPageLoad?: boolean;++    historySize?: number;++    isCancellable?: boolean;++    leadingZero?: LeadingZeroOption;++    maximumValue?: string;++    minimumValue?: string;++    /**+     * Determine if the element value can be incremented / decremented with the mouse wheel.+     */+     modifyValueOnWheel?: boolean;-    outputFormat?: AutoNumericOutputFormat;++    negativeBracketsTypeOnBlur?: string | null;++    /**+     * Placement of negative/positive sign relative to the currency symbol (possible options are l (left), r (right), p (prefix) and s (suffix))+     * @default null+     */+    negativePositiveSignPlacement?: NegativePositiveSignPlacementOption;++    noEventListeners?: boolean;++    onInvalidPaste?: OnInvalidPasteOption;++    outputFormat?: OutputFormatOption;++    overrideMinMaxLimits?: OverrideMinMaxLimitsOption;++    rawValueDivisor?: number | null;+     readOnly?: boolean;-    negativePositiveSignPlacement?: 'p';++    roundingMethod?: RoundingMethodOption;++    saveValueToSessionStorage?: boolean;++    selectNumberOnly?: boolean;++    selectOnFocus?: boolean;++    serializeSpaces?: SerializeSpacesOption;++    showOnlyNumbersOnFocus?: boolean;++    showPositiveSign?: boolean;++    showWarnings?: boolean;++    // FIXME     styleRules?: {-      positive: string;-      negative: string;-    };-    minimumValue?: string;-    maximumValue?: string;+      positive?: string | null;+      negative?: string;+      ranges?: Array<{+        min: number;+        max: number;+        class: string;+      }>;+      userDefined?: Array<+        | {+            callback: (rawValue: number) => boolean;+            classes: [string] | [string, string];+          }+        | {+            callback: (rawValue: number) => number | number[] | null;+            classes: string[];+          }+        | { callback: (autoNumericInstance: AutoNumeric) => void }+      >;+    } | null;++    suffixText?: string;++    symbolWhenUnfocused?: string | null;++    unformatOnHover?: boolean;++    unformatOnSubmit?: boolean;++    wheelStep?: number | "progressive";+  }++  interface PredefinedLanguages {+    French: Partial<Options>;+    Spanish: Partial<Options>;+    NorthAmerican: Partial<Options>;+    British: Partial<Options>;+    Swiss: Partial<Options>;+    Japanese: Partial<Options>;+    Chinese: Partial<Options>;+    Brazilian: Partial<Options>;

It misses the Turkish one

sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

-/*~ Note that ES6 modules cannot directly export class objects.- *~ This file should be imported using the CommonJS-style:- *~   import x = require('autonumeric');- *~- *~ Alternatively, if --allowSyntheticDefaultImports or- *~ --esModuleInterop is turned on, this file can also be- *~ imported as a default import:- *~   import x from 'autonumeric';- *~- *~ Refer to the TypeScript documentation at- *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require- *~ to understand common workarounds for this limitation of ES6 modules.+/**+ * Note that ES6 modules cannot directly export class objects.+ * This file should be imported using the CommonJS-style:+ *   import AutoNumeric = require('autonumeric');+ *+ * Alternatively, if --allowSyntheticDefaultImports or+ * --esModuleInterop is turned on, this file can also be+ * imported as a default import:+ *   import AutoNumeric from 'autonumeric';+ *+ * Refer to the TypeScript documentation at+ * https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ * to understand common workarounds for this limitation of ES6 modules.  */  -/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when- *~ loaded outside a module loader environment, declare that global here:- *~ export as namespace myClassLib;+/**+ * If this module is a UMD module that exposes a global variable 'myClassLib' when+ * loaded outside a module loader environment, declare that global here:+ * export as namespace myClassLib;  */ -/* The class constructor function is the exported object from the file */+/**+ * The class constructor function is the exported object from the file+ */ export = AutoNumeric;  declare class AutoNumeric {   constructor(     elementOrSelector: string | HTMLInputElement | HTMLElement,-    defaultValue: string | number = null,-    options: AutoNumericOptions | string = null-  ): Input;--  // someProperty: string[];+    initialValue: string | number = null,+    options: Options | string = null+  ): AutoNumeric; -  multiple(+  static multiple(     elementsOrSelector:       | string       | HTMLElement[]       | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },     initialValue: number | Array<number | null> = null,-    options: AutoNumericOptions | AutoNumericOptions[] = null-  ): Input;+    options: Options | Options[] = null+  ): AutoNumeric[];++  /**+   * Return true in the settings are valid+   */+  static areSettingsValid(options: Options): boolean;++  /**+   * Format the given number with the given options. This returns the formatted value as a string.+   */+  static format(value: number | string | HTMLElement, options: Options): string;++  /**+   * Format the domElement value with the given options and returns the formatted value as a string.+   */+  static formatAndSet(domElement: HTMLElement, options: Options): string;++  /**+   * Return the AutoNumeric object that manages the given DOM element+   */+  static getAutoNumericElement(domElement: HTMLElement): Input;    /**-   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   * Return the default autoNumeric settings+   */+  static getDefaultConfig(): Options;++  /**+   * Return all the predefined options in one object+   */+  static getPredefinedOptions(): PredefinedOptions;++  /**+   * Return true if the given DOM element has an AutoNumeric object that manages it.+   */+  static isManagedByAutoNumeric(domElement: HTMLElement): boolean;++  /**+   * Unformat and localize the given formatted string with the given options.+   */+  static localize(value: string | HTMLElement, options: Options): string;++  static localizeAndSet(domElement: HTMLElement, options: Options): string;++  static mergeOptions(...options: Options[]): Options;++  static reformatAndSet(referenceToTheDomElement: HTMLElement): void;++  static test(domElement: HTMLElement): boolean;++  static validate(options: Options): boolean;++  static version(): string;++  /**+   * Set the given element value, and format it immediately.+   * Additionally, this `set()` method can accept options that will be merged into the current AutoNumeric element, taking precedence over any previous settings.+   *+   * @example anElement.set('12345.67') // Formats the value+   * @example anElement.set(12345.67) // Formats the value+   * @example anElement.set(12345.67, { decimalCharacter : ',' }) // Update the settings and formats the value in one go+   * @example anElement.northAmerican().set('$12,345.67') // Set an already formatted value (this does not _exactly_ respect the currency symbol/negative placements, but only remove all non-numbers characters, according to the ones given in the settings)+   * @example anElement.set(null) // Set the rawValue and element value to `null`+   *+   * @param {number|string|null} newValue The value must be a Number, a numeric string or `null` (if `emptyInputBehavior` is set to `'null'`)+   * @param {object} options A settings object that will override the current settings. Note: the update is done only if the `newValue` is defined.+   * @param {boolean} saveChangeToHistory If set to `true`, then the change is recorded in the history table+   * @returns {AutoNumeric}+   * @throws    */   set(     value: number | string | null,-    options?: AutoNumericOptions,-    save?: boolean+    options?: Options,+    saveChangeToHistory?: boolean   ): void; -  update(...options: AutoNumericOptions[]): void;+  setUnformatted(value: number, options?: Options): void; -  remove(): void;+  get(callback?: (value: string, instance: AutoNumeric) => void): string; +  getFormatted(+    callback?: (value: string, instance: AutoNumeric) => void+  ): string;++  /**+   * Returns a plain number value without formatting+   */   getNumber(     callback: (value: number | null, instance: AutoNumeric) => void = null   ): number | null;    getNumericString(-    callback: (value: string | null, instance: AutoNumeric) => void = null+    callback?: (value: string | null, instance: AutoNumeric) => void = null   ): string | null; -  static getPredefinedOptions(): AutoNumericOptions;+  getLocalized(callback: (value: string) => void): string;++  reformat(): void;++  unformat(): void;

Add the comment:

/**
 * Updates the AutoNumeric settings, and immediately format the element accordingly.
 */
sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

-/*~ Note that ES6 modules cannot directly export class objects.- *~ This file should be imported using the CommonJS-style:- *~   import x = require('autonumeric');- *~- *~ Alternatively, if --allowSyntheticDefaultImports or- *~ --esModuleInterop is turned on, this file can also be- *~ imported as a default import:- *~   import x from 'autonumeric';- *~- *~ Refer to the TypeScript documentation at- *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require- *~ to understand common workarounds for this limitation of ES6 modules.+/**+ * Note that ES6 modules cannot directly export class objects.+ * This file should be imported using the CommonJS-style:+ *   import AutoNumeric = require('autonumeric');+ *+ * Alternatively, if --allowSyntheticDefaultImports or+ * --esModuleInterop is turned on, this file can also be+ * imported as a default import:+ *   import AutoNumeric from 'autonumeric';+ *+ * Refer to the TypeScript documentation at+ * https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ * to understand common workarounds for this limitation of ES6 modules.  */  -/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when- *~ loaded outside a module loader environment, declare that global here:- *~ export as namespace myClassLib;+/**+ * If this module is a UMD module that exposes a global variable 'myClassLib' when+ * loaded outside a module loader environment, declare that global here:+ * export as namespace myClassLib;  */ -/* The class constructor function is the exported object from the file */+/**+ * The class constructor function is the exported object from the file+ */ export = AutoNumeric;  declare class AutoNumeric {   constructor(     elementOrSelector: string | HTMLInputElement | HTMLElement,-    defaultValue: string | number = null,-    options: AutoNumericOptions | string = null-  ): Input;--  // someProperty: string[];+    initialValue: string | number = null,+    options: Options | string = null+  ): AutoNumeric; -  multiple(+  static multiple(     elementsOrSelector:       | string       | HTMLElement[]       | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },     initialValue: number | Array<number | null> = null,-    options: AutoNumericOptions | AutoNumericOptions[] = null-  ): Input;+    options: Options | Options[] = null+  ): AutoNumeric[];++  /**+   * Return true in the settings are valid+   */+  static areSettingsValid(options: Options): boolean;++  /**+   * Format the given number with the given options. This returns the formatted value as a string.+   */+  static format(value: number | string | HTMLElement, options: Options): string;++  /**+   * Format the domElement value with the given options and returns the formatted value as a string.+   */+  static formatAndSet(domElement: HTMLElement, options: Options): string;++  /**+   * Return the AutoNumeric object that manages the given DOM element+   */+  static getAutoNumericElement(domElement: HTMLElement): Input;    /**-   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   * Return the default autoNumeric settings+   */+  static getDefaultConfig(): Options;++  /**+   * Return all the predefined options in one object+   */+  static getPredefinedOptions(): PredefinedOptions;++  /**+   * Return true if the given DOM element has an AutoNumeric object that manages it.+   */+  static isManagedByAutoNumeric(domElement: HTMLElement): boolean;++  /**+   * Unformat and localize the given formatted string with the given options.+   */+  static localize(value: string | HTMLElement, options: Options): string;++  static localizeAndSet(domElement: HTMLElement, options: Options): string;++  static mergeOptions(...options: Options[]): Options;++  static reformatAndSet(referenceToTheDomElement: HTMLElement): void;++  static test(domElement: HTMLElement): boolean;++  static validate(options: Options): boolean;++  static version(): string;++  /**+   * Set the given element value, and format it immediately.+   * Additionally, this `set()` method can accept options that will be merged into the current AutoNumeric element, taking precedence over any previous settings.+   *+   * @example anElement.set('12345.67') // Formats the value+   * @example anElement.set(12345.67) // Formats the value+   * @example anElement.set(12345.67, { decimalCharacter : ',' }) // Update the settings and formats the value in one go+   * @example anElement.northAmerican().set('$12,345.67') // Set an already formatted value (this does not _exactly_ respect the currency symbol/negative placements, but only remove all non-numbers characters, according to the ones given in the settings)+   * @example anElement.set(null) // Set the rawValue and element value to `null`+   *+   * @param {number|string|null} newValue The value must be a Number, a numeric string or `null` (if `emptyInputBehavior` is set to `'null'`)+   * @param {object} options A settings object that will override the current settings. Note: the update is done only if the `newValue` is defined.+   * @param {boolean} saveChangeToHistory If set to `true`, then the change is recorded in the history table+   * @returns {AutoNumeric}+   * @throws    */   set(     value: number | string | null,-    options?: AutoNumericOptions,-    save?: boolean+    options?: Options,+    saveChangeToHistory?: boolean   ): void; -  update(...options: AutoNumericOptions[]): void;+  setUnformatted(value: number, options?: Options): void;

Add the comment:

/**
 * Set the given value directly as the DOM element value, without formatting it beforehand.
 * You can also set the value and update the setting in one go (the value will again not be formatted immediately).
 */
sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

-/*~ Note that ES6 modules cannot directly export class objects.- *~ This file should be imported using the CommonJS-style:- *~   import x = require('autonumeric');- *~- *~ Alternatively, if --allowSyntheticDefaultImports or- *~ --esModuleInterop is turned on, this file can also be- *~ imported as a default import:- *~   import x from 'autonumeric';- *~- *~ Refer to the TypeScript documentation at- *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require- *~ to understand common workarounds for this limitation of ES6 modules.+/**+ * Note that ES6 modules cannot directly export class objects.+ * This file should be imported using the CommonJS-style:+ *   import AutoNumeric = require('autonumeric');+ *+ * Alternatively, if --allowSyntheticDefaultImports or+ * --esModuleInterop is turned on, this file can also be+ * imported as a default import:+ *   import AutoNumeric from 'autonumeric';+ *+ * Refer to the TypeScript documentation at+ * https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ * to understand common workarounds for this limitation of ES6 modules.  */  -/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when- *~ loaded outside a module loader environment, declare that global here:- *~ export as namespace myClassLib;+/**+ * If this module is a UMD module that exposes a global variable 'myClassLib' when+ * loaded outside a module loader environment, declare that global here:+ * export as namespace myClassLib;  */ -/* The class constructor function is the exported object from the file */+/**+ * The class constructor function is the exported object from the file+ */ export = AutoNumeric;  declare class AutoNumeric {   constructor(     elementOrSelector: string | HTMLInputElement | HTMLElement,-    defaultValue: string | number = null,-    options: AutoNumericOptions | string = null-  ): Input;--  // someProperty: string[];+    initialValue: string | number = null,+    options: Options | string = null+  ): AutoNumeric; -  multiple(+  static multiple(     elementsOrSelector:       | string       | HTMLElement[]       | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },     initialValue: number | Array<number | null> = null,-    options: AutoNumericOptions | AutoNumericOptions[] = null-  ): Input;+    options: Options | Options[] = null+  ): AutoNumeric[];++  /**+   * Return true in the settings are valid+   */+  static areSettingsValid(options: Options): boolean;++  /**+   * Format the given number with the given options. This returns the formatted value as a string.+   */+  static format(value: number | string | HTMLElement, options: Options): string;++  /**+   * Format the domElement value with the given options and returns the formatted value as a string.+   */+  static formatAndSet(domElement: HTMLElement, options: Options): string;++  /**+   * Return the AutoNumeric object that manages the given DOM element+   */+  static getAutoNumericElement(domElement: HTMLElement): Input;    /**-   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   * Return the default autoNumeric settings+   */+  static getDefaultConfig(): Options;++  /**+   * Return all the predefined options in one object+   */+  static getPredefinedOptions(): PredefinedOptions;++  /**+   * Return true if the given DOM element has an AutoNumeric object that manages it.+   */+  static isManagedByAutoNumeric(domElement: HTMLElement): boolean;++  /**+   * Unformat and localize the given formatted string with the given options.+   */+  static localize(value: string | HTMLElement, options: Options): string;++  static localizeAndSet(domElement: HTMLElement, options: Options): string;++  static mergeOptions(...options: Options[]): Options;++  static reformatAndSet(referenceToTheDomElement: HTMLElement): void;++  static test(domElement: HTMLElement): boolean;++  static validate(options: Options): boolean;++  static version(): string;++  /**+   * Set the given element value, and format it immediately.+   * Additionally, this `set()` method can accept options that will be merged into the current AutoNumeric element, taking precedence over any previous settings.+   *+   * @example anElement.set('12345.67') // Formats the value+   * @example anElement.set(12345.67) // Formats the value+   * @example anElement.set(12345.67, { decimalCharacter : ',' }) // Update the settings and formats the value in one go+   * @example anElement.northAmerican().set('$12,345.67') // Set an already formatted value (this does not _exactly_ respect the currency symbol/negative placements, but only remove all non-numbers characters, according to the ones given in the settings)+   * @example anElement.set(null) // Set the rawValue and element value to `null`+   *+   * @param {number|string|null} newValue The value must be a Number, a numeric string or `null` (if `emptyInputBehavior` is set to `'null'`)+   * @param {object} options A settings object that will override the current settings. Note: the update is done only if the `newValue` is defined.+   * @param {boolean} saveChangeToHistory If set to `true`, then the change is recorded in the history table+   * @returns {AutoNumeric}+   * @throws    */   set(     value: number | string | null,-    options?: AutoNumericOptions,-    save?: boolean+    options?: Options,+    saveChangeToHistory?: boolean   ): void; -  update(...options: AutoNumericOptions[]): void;+  setUnformatted(value: number, options?: Options): void; -  remove(): void;+  get(callback?: (value: string, instance: AutoNumeric) => void): string; +  getFormatted(+    callback?: (value: string, instance: AutoNumeric) => void+  ): string;++  /**+   * Returns a plain number value without formatting

That comment should be changed to Return the element unformatted value as a real Javascript number., since its not entirely clear it does no returns a string

sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

-/*~ Note that ES6 modules cannot directly export class objects.- *~ This file should be imported using the CommonJS-style:- *~   import x = require('autonumeric');- *~- *~ Alternatively, if --allowSyntheticDefaultImports or- *~ --esModuleInterop is turned on, this file can also be- *~ imported as a default import:- *~   import x from 'autonumeric';- *~- *~ Refer to the TypeScript documentation at- *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require- *~ to understand common workarounds for this limitation of ES6 modules.+/**+ * Note that ES6 modules cannot directly export class objects.+ * This file should be imported using the CommonJS-style:+ *   import AutoNumeric = require('autonumeric');+ *+ * Alternatively, if --allowSyntheticDefaultImports or+ * --esModuleInterop is turned on, this file can also be+ * imported as a default import:+ *   import AutoNumeric from 'autonumeric';+ *+ * Refer to the TypeScript documentation at+ * https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ * to understand common workarounds for this limitation of ES6 modules.  */  -/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when- *~ loaded outside a module loader environment, declare that global here:- *~ export as namespace myClassLib;+/**+ * If this module is a UMD module that exposes a global variable 'myClassLib' when+ * loaded outside a module loader environment, declare that global here:+ * export as namespace myClassLib;  */ -/* The class constructor function is the exported object from the file */+/**+ * The class constructor function is the exported object from the file+ */ export = AutoNumeric;  declare class AutoNumeric {   constructor(     elementOrSelector: string | HTMLInputElement | HTMLElement,-    defaultValue: string | number = null,-    options: AutoNumericOptions | string = null-  ): Input;--  // someProperty: string[];+    initialValue: string | number = null,+    options: Options | string = null+  ): AutoNumeric; -  multiple(+  static multiple(     elementsOrSelector:       | string       | HTMLElement[]       | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },     initialValue: number | Array<number | null> = null,-    options: AutoNumericOptions | AutoNumericOptions[] = null-  ): Input;+    options: Options | Options[] = null+  ): AutoNumeric[];++  /**+   * Return true in the settings are valid+   */+  static areSettingsValid(options: Options): boolean;++  /**+   * Format the given number with the given options. This returns the formatted value as a string.+   */+  static format(value: number | string | HTMLElement, options: Options): string;++  /**+   * Format the domElement value with the given options and returns the formatted value as a string.+   */+  static formatAndSet(domElement: HTMLElement, options: Options): string;++  /**+   * Return the AutoNumeric object that manages the given DOM element+   */+  static getAutoNumericElement(domElement: HTMLElement): Input;    /**-   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   * Return the default autoNumeric settings+   */+  static getDefaultConfig(): Options;++  /**+   * Return all the predefined options in one object+   */+  static getPredefinedOptions(): PredefinedOptions;++  /**+   * Return true if the given DOM element has an AutoNumeric object that manages it.+   */+  static isManagedByAutoNumeric(domElement: HTMLElement): boolean;++  /**+   * Unformat and localize the given formatted string with the given options.+   */+  static localize(value: string | HTMLElement, options: Options): string;++  static localizeAndSet(domElement: HTMLElement, options: Options): string;++  static mergeOptions(...options: Options[]): Options;++  static reformatAndSet(referenceToTheDomElement: HTMLElement): void;++  static test(domElement: HTMLElement): boolean;++  static validate(options: Options): boolean;++  static version(): string;++  /**+   * Set the given element value, and format it immediately.+   * Additionally, this `set()` method can accept options that will be merged into the current AutoNumeric element, taking precedence over any previous settings.+   *+   * @example anElement.set('12345.67') // Formats the value+   * @example anElement.set(12345.67) // Formats the value+   * @example anElement.set(12345.67, { decimalCharacter : ',' }) // Update the settings and formats the value in one go+   * @example anElement.northAmerican().set('$12,345.67') // Set an already formatted value (this does not _exactly_ respect the currency symbol/negative placements, but only remove all non-numbers characters, according to the ones given in the settings)+   * @example anElement.set(null) // Set the rawValue and element value to `null`+   *+   * @param {number|string|null} newValue The value must be a Number, a numeric string or `null` (if `emptyInputBehavior` is set to `'null'`)+   * @param {object} options A settings object that will override the current settings. Note: the update is done only if the `newValue` is defined.+   * @param {boolean} saveChangeToHistory If set to `true`, then the change is recorded in the history table+   * @returns {AutoNumeric}+   * @throws    */   set(     value: number | string | null,-    options?: AutoNumericOptions,-    save?: boolean+    options?: Options,+    saveChangeToHistory?: boolean   ): void; -  update(...options: AutoNumericOptions[]): void;+  setUnformatted(value: number, options?: Options): void; -  remove(): void;+  get(callback?: (value: string, instance: AutoNumeric) => void): string; +  getFormatted(+    callback?: (value: string, instance: AutoNumeric) => void+  ): string;++  /**+   * Returns a plain number value without formatting+   */   getNumber(     callback: (value: number | null, instance: AutoNumeric) => void = null

In the parameter above and below, you used callback?. I think using the trailing interrogation point is clearer to see which parameter is optional.

sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

-/*~ Note that ES6 modules cannot directly export class objects.- *~ This file should be imported using the CommonJS-style:- *~   import x = require('autonumeric');- *~- *~ Alternatively, if --allowSyntheticDefaultImports or- *~ --esModuleInterop is turned on, this file can also be- *~ imported as a default import:- *~   import x from 'autonumeric';- *~- *~ Refer to the TypeScript documentation at- *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require- *~ to understand common workarounds for this limitation of ES6 modules.+/**+ * Note that ES6 modules cannot directly export class objects.+ * This file should be imported using the CommonJS-style:+ *   import AutoNumeric = require('autonumeric');+ *+ * Alternatively, if --allowSyntheticDefaultImports or+ * --esModuleInterop is turned on, this file can also be+ * imported as a default import:+ *   import AutoNumeric from 'autonumeric';+ *+ * Refer to the TypeScript documentation at+ * https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ * to understand common workarounds for this limitation of ES6 modules.  */  -/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when- *~ loaded outside a module loader environment, declare that global here:- *~ export as namespace myClassLib;+/**+ * If this module is a UMD module that exposes a global variable 'myClassLib' when+ * loaded outside a module loader environment, declare that global here:+ * export as namespace myClassLib;  */ -/* The class constructor function is the exported object from the file */+/**+ * The class constructor function is the exported object from the file+ */ export = AutoNumeric;  declare class AutoNumeric {   constructor(     elementOrSelector: string | HTMLInputElement | HTMLElement,-    defaultValue: string | number = null,-    options: AutoNumericOptions | string = null-  ): Input;--  // someProperty: string[];+    initialValue: string | number = null,+    options: Options | string = null+  ): AutoNumeric; -  multiple(+  static multiple(     elementsOrSelector:       | string       | HTMLElement[]       | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },     initialValue: number | Array<number | null> = null,-    options: AutoNumericOptions | AutoNumericOptions[] = null-  ): Input;+    options: Options | Options[] = null+  ): AutoNumeric[];++  /**+   * Return true in the settings are valid+   */+  static areSettingsValid(options: Options): boolean;++  /**+   * Format the given number with the given options. This returns the formatted value as a string.+   */+  static format(value: number | string | HTMLElement, options: Options): string;++  /**+   * Format the domElement value with the given options and returns the formatted value as a string.+   */+  static formatAndSet(domElement: HTMLElement, options: Options): string;++  /**+   * Return the AutoNumeric object that manages the given DOM element+   */+  static getAutoNumericElement(domElement: HTMLElement): Input;    /**-   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   * Return the default autoNumeric settings+   */+  static getDefaultConfig(): Options;++  /**+   * Return all the predefined options in one object+   */+  static getPredefinedOptions(): PredefinedOptions;++  /**+   * Return true if the given DOM element has an AutoNumeric object that manages it.+   */+  static isManagedByAutoNumeric(domElement: HTMLElement): boolean;++  /**+   * Unformat and localize the given formatted string with the given options.+   */+  static localize(value: string | HTMLElement, options: Options): string;++  static localizeAndSet(domElement: HTMLElement, options: Options): string;++  static mergeOptions(...options: Options[]): Options;++  static reformatAndSet(referenceToTheDomElement: HTMLElement): void;++  static test(domElement: HTMLElement): boolean;++  static validate(options: Options): boolean;++  static version(): string;++  /**+   * Set the given element value, and format it immediately.+   * Additionally, this `set()` method can accept options that will be merged into the current AutoNumeric element, taking precedence over any previous settings.+   *+   * @example anElement.set('12345.67') // Formats the value+   * @example anElement.set(12345.67) // Formats the value+   * @example anElement.set(12345.67, { decimalCharacter : ',' }) // Update the settings and formats the value in one go+   * @example anElement.northAmerican().set('$12,345.67') // Set an already formatted value (this does not _exactly_ respect the currency symbol/negative placements, but only remove all non-numbers characters, according to the ones given in the settings)+   * @example anElement.set(null) // Set the rawValue and element value to `null`+   *+   * @param {number|string|null} newValue The value must be a Number, a numeric string or `null` (if `emptyInputBehavior` is set to `'null'`)+   * @param {object} options A settings object that will override the current settings. Note: the update is done only if the `newValue` is defined.+   * @param {boolean} saveChangeToHistory If set to `true`, then the change is recorded in the history table+   * @returns {AutoNumeric}+   * @throws    */   set(     value: number | string | null,-    options?: AutoNumericOptions,-    save?: boolean+    options?: Options,+    saveChangeToHistory?: boolean   ): void; -  update(...options: AutoNumericOptions[]): void;+  setUnformatted(value: number, options?: Options): void; -  remove(): void;+  get(callback?: (value: string, instance: AutoNumeric) => void): string; +  getFormatted(+    callback?: (value: string, instance: AutoNumeric) => void+  ): string;++  /**+   * Returns a plain number value without formatting+   */   getNumber(     callback: (value: number | null, instance: AutoNumeric) => void = null   ): number | null;    getNumericString(-    callback: (value: string | null, instance: AutoNumeric) => void = null+    callback?: (value: string | null, instance: AutoNumeric) => void = null   ): string | null; -  static getPredefinedOptions(): AutoNumericOptions;+  getLocalized(callback: (value: string) => void): string;

In the parameter above, you used callback?. I think using the trailing interrogation point is clearer to see which parameter is optional.

sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

-/*~ Note that ES6 modules cannot directly export class objects.- *~ This file should be imported using the CommonJS-style:- *~   import x = require('autonumeric');- *~- *~ Alternatively, if --allowSyntheticDefaultImports or- *~ --esModuleInterop is turned on, this file can also be- *~ imported as a default import:- *~   import x from 'autonumeric';- *~- *~ Refer to the TypeScript documentation at- *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require- *~ to understand common workarounds for this limitation of ES6 modules.+/**+ * Note that ES6 modules cannot directly export class objects.+ * This file should be imported using the CommonJS-style:+ *   import AutoNumeric = require('autonumeric');+ *+ * Alternatively, if --allowSyntheticDefaultImports or+ * --esModuleInterop is turned on, this file can also be+ * imported as a default import:+ *   import AutoNumeric from 'autonumeric';+ *+ * Refer to the TypeScript documentation at+ * https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ * to understand common workarounds for this limitation of ES6 modules.  */  -/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when- *~ loaded outside a module loader environment, declare that global here:- *~ export as namespace myClassLib;+/**+ * If this module is a UMD module that exposes a global variable 'myClassLib' when+ * loaded outside a module loader environment, declare that global here:+ * export as namespace myClassLib;  */ -/* The class constructor function is the exported object from the file */+/**+ * The class constructor function is the exported object from the file+ */ export = AutoNumeric;  declare class AutoNumeric {   constructor(     elementOrSelector: string | HTMLInputElement | HTMLElement,-    defaultValue: string | number = null,-    options: AutoNumericOptions | string = null-  ): Input;--  // someProperty: string[];+    initialValue: string | number = null,+    options: Options | string = null+  ): AutoNumeric; -  multiple(+  static multiple(     elementsOrSelector:       | string       | HTMLElement[]       | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },     initialValue: number | Array<number | null> = null,-    options: AutoNumericOptions | AutoNumericOptions[] = null-  ): Input;+    options: Options | Options[] = null+  ): AutoNumeric[];++  /**+   * Return true in the settings are valid+   */+  static areSettingsValid(options: Options): boolean;++  /**+   * Format the given number with the given options. This returns the formatted value as a string.+   */+  static format(value: number | string | HTMLElement, options: Options): string;++  /**+   * Format the domElement value with the given options and returns the formatted value as a string.+   */+  static formatAndSet(domElement: HTMLElement, options: Options): string;++  /**+   * Return the AutoNumeric object that manages the given DOM element+   */+  static getAutoNumericElement(domElement: HTMLElement): Input;    /**-   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   * Return the default autoNumeric settings+   */+  static getDefaultConfig(): Options;++  /**+   * Return all the predefined options in one object+   */+  static getPredefinedOptions(): PredefinedOptions;++  /**+   * Return true if the given DOM element has an AutoNumeric object that manages it.+   */+  static isManagedByAutoNumeric(domElement: HTMLElement): boolean;++  /**+   * Unformat and localize the given formatted string with the given options.+   */+  static localize(value: string | HTMLElement, options: Options): string;++  static localizeAndSet(domElement: HTMLElement, options: Options): string;++  static mergeOptions(...options: Options[]): Options;++  static reformatAndSet(referenceToTheDomElement: HTMLElement): void;++  static test(domElement: HTMLElement): boolean;++  static validate(options: Options): boolean;++  static version(): string;++  /**+   * Set the given element value, and format it immediately.+   * Additionally, this `set()` method can accept options that will be merged into the current AutoNumeric element, taking precedence over any previous settings.+   *+   * @example anElement.set('12345.67') // Formats the value+   * @example anElement.set(12345.67) // Formats the value+   * @example anElement.set(12345.67, { decimalCharacter : ',' }) // Update the settings and formats the value in one go+   * @example anElement.northAmerican().set('$12,345.67') // Set an already formatted value (this does not _exactly_ respect the currency symbol/negative placements, but only remove all non-numbers characters, according to the ones given in the settings)+   * @example anElement.set(null) // Set the rawValue and element value to `null`+   *+   * @param {number|string|null} newValue The value must be a Number, a numeric string or `null` (if `emptyInputBehavior` is set to `'null'`)+   * @param {object} options A settings object that will override the current settings. Note: the update is done only if the `newValue` is defined.+   * @param {boolean} saveChangeToHistory If set to `true`, then the change is recorded in the history table+   * @returns {AutoNumeric}+   * @throws    */   set(     value: number | string | null,-    options?: AutoNumericOptions,-    save?: boolean+    options?: Options,+    saveChangeToHistory?: boolean   ): void; -  update(...options: AutoNumericOptions[]): void;+  setUnformatted(value: number, options?: Options): void; -  remove(): void;+  get(callback?: (value: string, instance: AutoNumeric) => void): string; +  getFormatted(

Since the get* functions are one of the most important and used ones, it could help to add the jsdoc to those at least : Return the current formatted value of the AutoNumeric element as a string

sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

-/*~ Note that ES6 modules cannot directly export class objects.- *~ This file should be imported using the CommonJS-style:- *~   import x = require('autonumeric');- *~- *~ Alternatively, if --allowSyntheticDefaultImports or- *~ --esModuleInterop is turned on, this file can also be- *~ imported as a default import:- *~   import x from 'autonumeric';- *~- *~ Refer to the TypeScript documentation at- *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require- *~ to understand common workarounds for this limitation of ES6 modules.+/**+ * Note that ES6 modules cannot directly export class objects.+ * This file should be imported using the CommonJS-style:+ *   import AutoNumeric = require('autonumeric');+ *+ * Alternatively, if --allowSyntheticDefaultImports or+ * --esModuleInterop is turned on, this file can also be+ * imported as a default import:+ *   import AutoNumeric from 'autonumeric';+ *+ * Refer to the TypeScript documentation at+ * https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ * to understand common workarounds for this limitation of ES6 modules.  */  -/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when- *~ loaded outside a module loader environment, declare that global here:- *~ export as namespace myClassLib;+/**+ * If this module is a UMD module that exposes a global variable 'myClassLib' when+ * loaded outside a module loader environment, declare that global here:+ * export as namespace myClassLib;  */ -/* The class constructor function is the exported object from the file */+/**+ * The class constructor function is the exported object from the file+ */ export = AutoNumeric;  declare class AutoNumeric {   constructor(     elementOrSelector: string | HTMLInputElement | HTMLElement,-    defaultValue: string | number = null,-    options: AutoNumericOptions | string = null-  ): Input;--  // someProperty: string[];+    initialValue: string | number = null,+    options: Options | string = null+  ): AutoNumeric; -  multiple(+  static multiple(     elementsOrSelector:       | string       | HTMLElement[]       | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },     initialValue: number | Array<number | null> = null,-    options: AutoNumericOptions | AutoNumericOptions[] = null-  ): Input;+    options: Options | Options[] = null+  ): AutoNumeric[];++  /**+   * Return true in the settings are valid+   */+  static areSettingsValid(options: Options): boolean;++  /**+   * Format the given number with the given options. This returns the formatted value as a string.+   */+  static format(value: number | string | HTMLElement, options: Options): string;++  /**+   * Format the domElement value with the given options and returns the formatted value as a string.+   */+  static formatAndSet(domElement: HTMLElement, options: Options): string;++  /**+   * Return the AutoNumeric object that manages the given DOM element+   */+  static getAutoNumericElement(domElement: HTMLElement): Input;    /**-   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   * Return the default autoNumeric settings+   */+  static getDefaultConfig(): Options;++  /**+   * Return all the predefined options in one object+   */+  static getPredefinedOptions(): PredefinedOptions;++  /**+   * Return true if the given DOM element has an AutoNumeric object that manages it.+   */+  static isManagedByAutoNumeric(domElement: HTMLElement): boolean;++  /**+   * Unformat and localize the given formatted string with the given options.+   */+  static localize(value: string | HTMLElement, options: Options): string;++  static localizeAndSet(domElement: HTMLElement, options: Options): string;++  static mergeOptions(...options: Options[]): Options;++  static reformatAndSet(referenceToTheDomElement: HTMLElement): void;++  static test(domElement: HTMLElement): boolean;++  static validate(options: Options): boolean;++  static version(): string;++  /**+   * Set the given element value, and format it immediately.+   * Additionally, this `set()` method can accept options that will be merged into the current AutoNumeric element, taking precedence over any previous settings.+   *+   * @example anElement.set('12345.67') // Formats the value+   * @example anElement.set(12345.67) // Formats the value+   * @example anElement.set(12345.67, { decimalCharacter : ',' }) // Update the settings and formats the value in one go+   * @example anElement.northAmerican().set('$12,345.67') // Set an already formatted value (this does not _exactly_ respect the currency symbol/negative placements, but only remove all non-numbers characters, according to the ones given in the settings)+   * @example anElement.set(null) // Set the rawValue and element value to `null`+   *+   * @param {number|string|null} newValue The value must be a Number, a numeric string or `null` (if `emptyInputBehavior` is set to `'null'`)+   * @param {object} options A settings object that will override the current settings. Note: the update is done only if the `newValue` is defined.+   * @param {boolean} saveChangeToHistory If set to `true`, then the change is recorded in the history table+   * @returns {AutoNumeric}+   * @throws    */   set(     value: number | string | null,-    options?: AutoNumericOptions,-    save?: boolean+    options?: Options,+    saveChangeToHistory?: boolean   ): void; -  update(...options: AutoNumericOptions[]): void;+  setUnformatted(value: number, options?: Options): void; -  remove(): void;+  get(callback?: (value: string, instance: AutoNumeric) => void): string;

The get() function is deprecated and should not be used. Please remove that line so that TypeScript user will only use the other get*() functions.

sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

-/*~ Note that ES6 modules cannot directly export class objects.- *~ This file should be imported using the CommonJS-style:- *~   import x = require('autonumeric');- *~- *~ Alternatively, if --allowSyntheticDefaultImports or- *~ --esModuleInterop is turned on, this file can also be- *~ imported as a default import:- *~   import x from 'autonumeric';- *~- *~ Refer to the TypeScript documentation at- *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require- *~ to understand common workarounds for this limitation of ES6 modules.+/**+ * Note that ES6 modules cannot directly export class objects.+ * This file should be imported using the CommonJS-style:+ *   import AutoNumeric = require('autonumeric');+ *+ * Alternatively, if --allowSyntheticDefaultImports or+ * --esModuleInterop is turned on, this file can also be+ * imported as a default import:+ *   import AutoNumeric from 'autonumeric';+ *+ * Refer to the TypeScript documentation at+ * https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ * to understand common workarounds for this limitation of ES6 modules.  */  -/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when- *~ loaded outside a module loader environment, declare that global here:- *~ export as namespace myClassLib;+/**+ * If this module is a UMD module that exposes a global variable 'myClassLib' when+ * loaded outside a module loader environment, declare that global here:+ * export as namespace myClassLib;

The Webpack configuration configuration is indeed set to generate an UMD module. Perhaps then that sentence should be changed to remove the conditionality ? And perhaps even merge that tip with the multi-line comment above ?

sbusch

comment created time in 3 months

issue closedautoNumeric/autoNumeric

The value [] being set falls outside of the minimumValue [] and maximumValue [] range set for this element

Steps to reproduce the problem

  1. Use autoNumeric version 4.5.10
  2. In the browser Chrome open http://autonumeric.org/configurator
  3. Set configuration option: maximumValue: "10"
  4. Paste any value into input which is greater than maximum (10).

image

closed time in 3 months

serginnios

issue commentautoNumeric/autoNumeric

The value [] being set falls outside of the minimumValue [] and maximumValue [] range set for this element

As a user, when you paste something in an element, and see nothing happens, you must have a way to know why it failed. This error will be hidden for most of the users, and will be used by devs mainly. It can even be caught and shown differently to the user.

The error messages will be kept, since pasting in AutoNumeric offers a wide range of behaviors, and that would help debug things.

Thanks for taking the time to share your point of view on that matter.

serginnios

comment created time in 3 months

issue commentautoNumeric/autoNumeric

The value [] being set falls outside of the minimumValue [] and maximumValue [] range set for this element

I fail to see why this is a bug, could please explain what bothers you here?

serginnios

comment created time in 3 months

issue commentautoNumeric/vue-autoNumeric

Library naming issue

The files in dist are auto-generated by Webpack. On my end, vue-autonumeric works like a charm with that require. I'll have to check if that require change does no break existing softwares.

ErcinDedeoglu

comment created time in 3 months

startedlouisabraham/ffpass

started time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

+/*~ Note that ES6 modules cannot directly export class objects.+ *~ This file should be imported using the CommonJS-style:+ *~   import x = require('autonumeric');+ *~+ *~ Alternatively, if --allowSyntheticDefaultImports or+ *~ --esModuleInterop is turned on, this file can also be+ *~ imported as a default import:+ *~   import x from 'autonumeric';+ *~+ *~ Refer to the TypeScript documentation at+ *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ *~ to understand common workarounds for this limitation of ES6 modules.+ */+ +/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when+ *~ loaded outside a module loader environment, declare that global here:+ *~ export as namespace myClassLib;+ */++/* The class constructor function is the exported object from the file */+export = AutoNumeric;++declare class AutoNumeric {+  constructor(+    elementOrSelector: string | HTMLInputElement | HTMLElement,+    defaultValue: string | number = null,+    options: AutoNumericOptions | string = null+  ): Input;++  // someProperty: string[];++  multiple(+    elementsOrSelector:+      | string+      | HTMLElement[]+      | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },+    initialValue: number | Array<number | null> = null,+    options: AutoNumericOptions | AutoNumericOptions[] = null+  ): Input;++  /**+   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   */+  set(+    value: number | string | null,+    options?: AutoNumericOptions,+    save?: boolean+  ): void;++  update(...options: AutoNumericOptions[]): void;++  remove(): void;++  getNumber(+    callback: (value: number | null, instance: AutoNumeric) => void = null+  ): number | null;++  getNumericString(+    callback: (value: string | null, instance: AutoNumeric) => void = null+  ): string | null;++  static getPredefinedOptions(): AutoNumericOptions;+}

It misses the function definitions from #531 (ie. version(), isManagedByAutoNumeric(), etc.)

sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

+/*~ Note that ES6 modules cannot directly export class objects.+ *~ This file should be imported using the CommonJS-style:+ *~   import x = require('autonumeric');+ *~+ *~ Alternatively, if --allowSyntheticDefaultImports or+ *~ --esModuleInterop is turned on, this file can also be+ *~ imported as a default import:+ *~   import x from 'autonumeric';+ *~+ *~ Refer to the TypeScript documentation at+ *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ *~ to understand common workarounds for this limitation of ES6 modules.+ */+ +/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when+ *~ loaded outside a module loader environment, declare that global here:+ *~ export as namespace myClassLib;+ */++/* The class constructor function is the exported object from the file */+export = AutoNumeric;++declare class AutoNumeric {+  constructor(+    elementOrSelector: string | HTMLInputElement | HTMLElement,+    defaultValue: string | number = null,+    options: AutoNumericOptions | string = null+  ): Input;++  // someProperty: string[];++  multiple(+    elementsOrSelector:+      | string+      | HTMLElement[]+      | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },+    initialValue: number | Array<number | null> = null,+    options: AutoNumericOptions | AutoNumericOptions[] = null+  ): Input;++  /**+   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   */+  set(+    value: number | string | null,+    options?: AutoNumericOptions,+    save?: boolean+  ): void;++  update(...options: AutoNumericOptions[]): void;++  remove(): void;++  getNumber(+    callback: (value: number | null, instance: AutoNumeric) => void = null+  ): number | null;++  getNumericString(+    callback: (value: string | null, instance: AutoNumeric) => void = null+  ): string | null;++  static getPredefinedOptions(): AutoNumericOptions;+}++/* Expose types as well */+declare namespace AutoNumeric {+  export type OutputFormat = 'string' | 'number';++  export interface Options {

The Options interface was more complete in #531

sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

+/*~ Note that ES6 modules cannot directly export class objects.+ *~ This file should be imported using the CommonJS-style:+ *~   import x = require('autonumeric');+ *~+ *~ Alternatively, if --allowSyntheticDefaultImports or+ *~ --esModuleInterop is turned on, this file can also be+ *~ imported as a default import:+ *~   import x from 'autonumeric';+ *~+ *~ Refer to the TypeScript documentation at+ *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ *~ to understand common workarounds for this limitation of ES6 modules.+ */+ +/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when+ *~ loaded outside a module loader environment, declare that global here:+ *~ export as namespace myClassLib;+ */++/* The class constructor function is the exported object from the file */+export = AutoNumeric;++declare class AutoNumeric {+  constructor(+    elementOrSelector: string | HTMLInputElement | HTMLElement,+    defaultValue: string | number = null,+    options: AutoNumericOptions | string = null+  ): Input;++  // someProperty: string[];++  multiple(+    elementsOrSelector:+      | string+      | HTMLElement[]+      | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },+    initialValue: number | Array<number | null> = null,+    options: AutoNumericOptions | AutoNumericOptions[] = null+  ): Input;

The multiple() function returns an array of AutoNumeric objects, not an input

sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

+/*~ Note that ES6 modules cannot directly export class objects.+ *~ This file should be imported using the CommonJS-style:+ *~   import x = require('autonumeric');+ *~+ *~ Alternatively, if --allowSyntheticDefaultImports or+ *~ --esModuleInterop is turned on, this file can also be+ *~ imported as a default import:+ *~   import x from 'autonumeric';+ *~+ *~ Refer to the TypeScript documentation at+ *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ *~ to understand common workarounds for this limitation of ES6 modules.+ */+ +/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when+ *~ loaded outside a module loader environment, declare that global here:+ *~ export as namespace myClassLib;+ */++/* The class constructor function is the exported object from the file */+export = AutoNumeric;++declare class AutoNumeric {+  constructor(+    elementOrSelector: string | HTMLInputElement | HTMLElement,+    defaultValue: string | number = null,+    options: AutoNumericOptions | string = null+  ): Input;++  // someProperty: string[];++  multiple(+    elementsOrSelector:+      | string+      | HTMLElement[]+      | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },+    initialValue: number | Array<number | null> = null,+    options: AutoNumericOptions | AutoNumericOptions[] = null+  ): Input;++  /**+   * Set the value, but do not save the new state in the history table (used for undo/redo actions)

This comment is false is the third argument is set to true. Also, if such comment is needed, then perhaps you could mention that passing an objet with some options will merge those in the current options used by the AutoNumeric element.

sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

+/*~ Note that ES6 modules cannot directly export class objects.+ *~ This file should be imported using the CommonJS-style:+ *~   import x = require('autonumeric');+ *~+ *~ Alternatively, if --allowSyntheticDefaultImports or+ *~ --esModuleInterop is turned on, this file can also be+ *~ imported as a default import:+ *~   import x from 'autonumeric';+ *~+ *~ Refer to the TypeScript documentation at+ *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ *~ to understand common workarounds for this limitation of ES6 modules.+ */+ +/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when+ *~ loaded outside a module loader environment, declare that global here:+ *~ export as namespace myClassLib;+ */++/* The class constructor function is the exported object from the file */+export = AutoNumeric;++declare class AutoNumeric {+  constructor(+    elementOrSelector: string | HTMLInputElement | HTMLElement,+    defaultValue: string | number = null,+    options: AutoNumericOptions | string = null+  ): Input;

The constructor returns an AutoNumeric object, not an input

sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

+/*~ Note that ES6 modules cannot directly export class objects.+ *~ This file should be imported using the CommonJS-style:+ *~   import x = require('autonumeric');+ *~+ *~ Alternatively, if --allowSyntheticDefaultImports or+ *~ --esModuleInterop is turned on, this file can also be+ *~ imported as a default import:+ *~   import x from 'autonumeric';+ *~+ *~ Refer to the TypeScript documentation at+ *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ *~ to understand common workarounds for this limitation of ES6 modules.+ */+ +/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when+ *~ loaded outside a module loader environment, declare that global here:+ *~ export as namespace myClassLib;+ */++/* The class constructor function is the exported object from the file */+export = AutoNumeric;++declare class AutoNumeric {+  constructor(+    elementOrSelector: string | HTMLInputElement | HTMLElement,+    defaultValue: string | number = null,+    options: AutoNumericOptions | string = null+  ): Input;++  // someProperty: string[];

What is the purpose of that commented line?

sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

+/*~ Note that ES6 modules cannot directly export class objects.+ *~ This file should be imported using the CommonJS-style:+ *~   import x = require('autonumeric');+ *~+ *~ Alternatively, if --allowSyntheticDefaultImports or+ *~ --esModuleInterop is turned on, this file can also be+ *~ imported as a default import:+ *~   import x from 'autonumeric';

Shouldn't x be renamed to AutoNumeric in that example?

sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

+/*~ Note that ES6 modules cannot directly export class objects.+ *~ This file should be imported using the CommonJS-style:+ *~   import x = require('autonumeric');+ *~+ *~ Alternatively, if --allowSyntheticDefaultImports or+ *~ --esModuleInterop is turned on, this file can also be+ *~ imported as a default import:+ *~   import x from 'autonumeric';+ *~+ *~ Refer to the TypeScript documentation at+ *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ *~ to understand common workarounds for this limitation of ES6 modules.+ */+ +/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when+ *~ loaded outside a module loader environment, declare that global here:+ *~ export as namespace myClassLib;+ */++/* The class constructor function is the exported object from the file */

Please use the multi-line comment style, ie.:

/**
 * The class constructor function is the exported object from the file
 */
sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

+/*~ Note that ES6 modules cannot directly export class objects.+ *~ This file should be imported using the CommonJS-style:+ *~   import x = require('autonumeric');+ *~+ *~ Alternatively, if --allowSyntheticDefaultImports or+ *~ --esModuleInterop is turned on, this file can also be+ *~ imported as a default import:+ *~   import x from 'autonumeric';+ *~+ *~ Refer to the TypeScript documentation at+ *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ *~ to understand common workarounds for this limitation of ES6 modules.+ */+ +/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when+ *~ loaded outside a module loader environment, declare that global here:+ *~ export as namespace myClassLib;+ */++/* The class constructor function is the exported object from the file */+export = AutoNumeric;++declare class AutoNumeric {+  constructor(+    elementOrSelector: string | HTMLInputElement | HTMLElement,+    defaultValue: string | number = null,+    options: AutoNumericOptions | string = null+  ): Input;++  // someProperty: string[];++  multiple(+    elementsOrSelector:+      | string+      | HTMLElement[]+      | { rootElement: HTMLElement; exclude?: HTMLInputElement[] },+    initialValue: number | Array<number | null> = null,+    options: AutoNumericOptions | AutoNumericOptions[] = null+  ): Input;++  /**+   * Set the value, but do not save the new state in the history table (used for undo/redo actions)+   */+  set(+    value: number | string | null,+    options?: AutoNumericOptions,+    save?: boolean

save is not explicit enough, and could use the variable name used in the code ; saveChangeToHistory

sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

+/*~ Note that ES6 modules cannot directly export class objects.+ *~ This file should be imported using the CommonJS-style:+ *~   import x = require('autonumeric');+ *~+ *~ Alternatively, if --allowSyntheticDefaultImports or+ *~ --esModuleInterop is turned on, this file can also be+ *~ imported as a default import:+ *~   import x from 'autonumeric';+ *~+ *~ Refer to the TypeScript documentation at+ *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ *~ to understand common workarounds for this limitation of ES6 modules.+ */+ +/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when+ *~ loaded outside a module loader environment, declare that global here:+ *~ export as namespace myClassLib;+ */++/* The class constructor function is the exported object from the file */+export = AutoNumeric;++declare class AutoNumeric {+  constructor(+    elementOrSelector: string | HTMLInputElement | HTMLElement,+    defaultValue: string | number = null,

Let's use initialValue instead of defaultValue (like for multiple() and in the AutoNumeric code)

sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

+/*~ Note that ES6 modules cannot directly export class objects.+ *~ This file should be imported using the CommonJS-style:+ *~   import x = require('autonumeric');+ *~+ *~ Alternatively, if --allowSyntheticDefaultImports or+ *~ --esModuleInterop is turned on, this file can also be+ *~ imported as a default import:+ *~   import x from 'autonumeric';+ *~+ *~ Refer to the TypeScript documentation at+ *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ *~ to understand common workarounds for this limitation of ES6 modules.+ */+ +/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when+ *~ loaded outside a module loader environment, declare that global here:+ *~ export as namespace myClassLib;+ */

Please use the multi-line comment style, ie.:

/**
 * This is the first line
 * This is the last one
 */
sbusch

comment created time in 3 months

Pull request review commentautoNumeric/autoNumeric

TypeScript definitions, another try

+/*~ Note that ES6 modules cannot directly export class objects.+ *~ This file should be imported using the CommonJS-style:+ *~   import x = require('autonumeric');+ *~+ *~ Alternatively, if --allowSyntheticDefaultImports or+ *~ --esModuleInterop is turned on, this file can also be+ *~ imported as a default import:+ *~   import x from 'autonumeric';+ *~+ *~ Refer to the TypeScript documentation at+ *~ https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require+ *~ to understand common workarounds for this limitation of ES6 modules.+ */+ +/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when+ *~ loaded outside a module loader environment, declare that global here:+ *~ export as namespace myClassLib;+ */++/* The class constructor function is the exported object from the file */+export = AutoNumeric;++declare class AutoNumeric {+  constructor(+    elementOrSelector: string | HTMLInputElement | HTMLElement,+    defaultValue: string | number = null,+    options: AutoNumericOptions | string = null

In #531 , defaultValue and options were set like options?. Since both of those parameters are optional, shouldn't it be the case here too ?

sbusch

comment created time in 3 months

issue closedautoNumeric/autoNumeric

digitGroupSeparator not reconize '&#xA0;'

Hi,

I face a problem using autonumeric in an asp.net core multilingual application. I use .net @System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberGroupSeparator for getting the digitGroup separator according to the current language.

        const autoNumericOptions = {
            digitGroupSeparator: '@System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberGroupSeparator',
            decimalCharacter: '@System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator',
            decimalCharacterAlternative : "."
        };


        jQuery(function ($) {
            new AutoNumeric('#OverallLength', autoNumericOptions);
        });

it produce this code

<script src="https://cdn.jsdelivr.net/npm/autonumeric@4.5.10/dist/autoNumeric.js" type="text/javascript"></script>
<script type="text/javascript">

            // The options are...optional :)
            const autoNumericOptions = {
                digitGroupSeparator: '&#xA0;',
                decimalCharacter: ',',
                decimalCharacterAlternative : "."
            };


            jQuery(function ($) {
                new AutoNumeric('#OverallLength', autoNumericOptions);
            });
        });
</script>

It works when using english or spain language. When i select french language i get this message

jquery.js:3827 Uncaught Error: The thousand separator character option 'digitGroupSeparator' is invalid ; it should be ',', '.', '٬', '˙', "'", '’', ' ', ' ', ' ', ' ' or empty (''), [&#xA0;] given.
    at Function.throwError (AutoNumericHelper.js:935)
    at Function.validate (AutoNumeric.js:7916)
    at AutoNumeric._setSettings (AutoNumeric.js:6443)
    at new AutoNumeric (AutoNumeric.js:148)
    at HTMLDocument.<anonymous> (1:1162)
    at mightThrow (jquery.js:3534)
    at process (jquery.js:3602)

i use latest version of autonumeric 4.5.10

Thanks for your help.

closed time in 3 months

alphafoxtrotmike

issue commentautoNumeric/autoNumeric

digitGroupSeparator not reconize '&#xA0;'

&#xA0; is the "No-Break Space", and you can already use that for the digitGroupSeparator option.

Check : https://github.com/autoNumeric/autoNumeric/blob/28e5e4ed7185c9bdc7168d181316c7c2c74f3801/src/AutoNumeric.js#L3844

What you want is to use '\u00a0'.

alphafoxtrotmike

comment created time in 3 months

pull request commentautoNumeric/autoNumeric

TypeScript definitions, another try

I just got back from vacation, and will take a look at the PR as soon as possible. Thanks for the PR!

sbusch

comment created time in 3 months

issue commentautoNumeric/autoNumeric

Problem with currencySymbol containing dollar sign character

Hello @zedmartins , thanks for taking the time to report this issue, and with it a potential solution!

My main rig is currently out of order, so I'll be able to check and fix that issue only in a few weeks, sorry :x

zedmartins

comment created time in 4 months

PR closed autoNumeric/autoNumeric

Merge `v4.5.10` from the `next` branch into `master`

This release brings many, many fixes and is considered stable (like most commits in next).

+10965 -5865

0 comment

32 changed files

AlexandreBonneau

pr closed time in 4 months

issue commentyarnpkg/yarn

yarn install fails with git archive failure on travis

I see that happening on node 6 (but not on node 8, 10 or 12) (see the travis log here).

Could somebody please re-open that issue ?

doug-wade

comment created time in 4 months

PR opened autoNumeric/autoNumeric

Merge `v4.5.10` from the `next` branch into `master`

This release brings many, many fixes and is considered stable (like most commits in next).

+10965 -5865

0 comment

32 changed files

pr created time in 4 months

startedodoo/odoo

started time in 4 months

push eventautoNumeric/autoNumeric

Alexandre Bonneau

commit sha 28e5e4ed7185c9bdc7168d181316c7c2c74f3801

Fixes the travis unit test call Signed-off-by: Alexandre Bonneau <alexandre.bonneau@linuxfr.eu>

view details

push time in 4 months

push eventautoNumeric/autoNumeric

Alexandre Bonneau

commit sha f396eb2c2c1803faf2b39b9bc071cc0bf33323ba

Updates the unit tests run on the CI server to use major browsers in headless mode Signed-off-by: Alexandre Bonneau <alexandre.bonneau@linuxfr.eu>

view details

push time in 4 months

push eventautoNumeric/autoNumeric

Alexandre Bonneau

commit sha 70fd4a5bbb13337768b5c0ce168ea8502e763f0d

Fix a typo in the readme Signed-off-by: Alexandre Bonneau <alexandre.bonneau@linuxfr.eu>

view details

push time in 4 months

push eventautoNumeric/autoNumeric

Alexandre Bonneau

commit sha d32d110911545436b8ce96997e99680f2ba37ef0

Update the readme by removing the reference to Browserstack that we never really used Signed-off-by: Alexandre Bonneau <alexandre.bonneau@linuxfr.eu>

view details

push time in 4 months

issue commentautoNumeric/autoNumeric

Admit locales (es-ES, en-GB, etc.) to format the numbers

I was wondering if we could use the formatting info each browser now have internally using the Intl.NumberFormat objet, unfortunately, its prototype is pretty scarce, and does not provide all the options it uses to format the numbers.

Currently, the .resolvedOptions() method returns only a subset of those options:

let nf = new Intl.NumberFormat();
nf.resolvedOptions();
// returns:
{
    locale: "fr"
    maximumFractionDigits: 3
    minimumFractionDigits: 0
    minimumIntegerDigits: 1
    numberingSystem: "latn"
    style: "decimal"
    useGrouping: true
}

Mainly, it lacks the decimal character, the grouping character, the currency symbol and the currency symbol position.

If you have more ideas on the subject, do not hesitate to comment.

j-a-m-l

comment created time in 4 months

issue commentautoNumeric/autoNumeric

Input value will undo on focusout when using only Ctrl+Backspace

This is fixed in 4.5.10.

camilova

comment created time in 4 months

created tagautoNumeric/autoNumeric

tagv4.5.10

autoNumeric is a standalone library that provides live as-you-type formatting for international numbers and currencies.

created time in 4 months

push eventautoNumeric/autoNumeric

Alexandre Bonneau

commit sha dc868f860e8c131913c7669f77b1e3ef7f516a39

Fixes #656 Input value will undo on focusout when using only Ctrl+Backspace Signed-off-by: Alexandre Bonneau <alexandre.bonneau@linuxfr.eu>

view details

push time in 4 months

issue closedautoNumeric/autoNumeric

Input value will undo on focusout when using only Ctrl+Backspace

Current behavior

If you use the next options on initialization with version 4.5.8:

autonumeric_options = { digitGroupSeparator: '.', decimalCharacter: ',' };

And you focus the input and hit CTRL+BACK or CTRL+SUPR to clear the value quickly, then after focusout the change will undo, showing the last value.

Expected behavior

The input should be empty after you press CTRL+SUPR and focusout.

Steps to reproduce the problem

  • Initialize a simple input with the options:
autonumeric_options = {
  digitGroupSeparator: '.',
  decimalCharacter: ','
};
AutoNumeric.multiple("input", autonumeric_options);
  • Focus the input
  • Press CTRL+BACK
  • Click on any place to focusout the input or press TAB

Here is a example showing the behavior

This behavior happens on Chrome, but in Firefox the value is not cleared at all.

closed time in 4 months

camilova
more