Skip to content

@serenity-is/corelib / AutoNumeric

Class: AutoNumeric

Defined in: src/ui/editors/autonumeric.ts:966

A jQuery-independent port of the autoNumeric library for formatting numeric inputs.

Constructors

Constructor

new AutoNumeric(): AutoNumeric

Returns

AutoNumeric

Properties

allowedSettingKeys

readonly static allowedSettingKeys: Set<string>

Defined in: src/ui/editors/autonumeric.ts:1315

Setting keys that can be passed through from editor options.


defaults

static defaults: AutoNumericOptions

Defined in: src/ui/editors/autonumeric.ts:969

Default autoNumeric options.

Methods

destroy()

static destroy(input): void

Defined in: src/ui/editors/autonumeric.ts:1185

Removes autoNumeric settings and event handlers from an input.

Parameters

input

HTMLInputElement

The input element.

Returns

void


getSettings()

static getSettings(input): AutoNumericOptions

Defined in: src/ui/editors/autonumeric.ts:1301

Returns the autoNumeric settings for an input.

Parameters

input

HTMLInputElement

The input element.

Returns

AutoNumericOptions

The settings.


getValue()

static getValue(input): string

Defined in: src/ui/editors/autonumeric.ts:1261

Returns the unformatted numeric value of an input.

Parameters

input

HTMLInputElement

The input element.

Returns

string

The numeric value as a string.


hasInstance()

static hasInstance(input): boolean

Defined in: src/ui/editors/autonumeric.ts:1310

Whether an input has an autoNumeric instance.

Parameters

input

HTMLInputElement

The input element.

Returns

boolean

True when initialized.


init()

static init(input, options): void

Defined in: src/ui/editors/autonumeric.ts:993

Initializes autoNumeric on an input element.

Parameters

input

HTMLInputElement

The input element.

options

AutoNumericOptions

AutoNumeric options.

Returns

void


setValue()

static setValue(input, valueIn): string

Defined in: src/ui/editors/autonumeric.ts:1219

Sets the formatted value of an input.

Parameters

input

HTMLInputElement

The input element.

valueIn

The value to set.

string | number

Returns

string

The formatted value.


updateOptions()

static updateOptions(input, options): void

Defined in: src/ui/editors/autonumeric.ts:1195

Updates autoNumeric settings on an input.

Parameters

input

HTMLInputElement

The input element.

options

AutoNumericOptions

The options to update.

Returns

void