powerpagestoolkit
Version:
Reference, manipulate, and engage with Power Pages sites through the nodes in the DOM; use a variety of custom methods that allow customizing your power pages site quicker and easier.
37 lines (36 loc) • 1.25 kB
TypeScript
/// <reference path="../globals.d.ts" />
import InputMask from "./InputMask.d.ts";
interface MoneyInputMaskOptions extends InputMaskOptions {
prefix: CurrencySymbol;
decimalPlaces: number;
thousandsSeparator: string;
decimalSeparator: string;
allowNegative: boolean;
}
export default class MoneyMask extends InputMask {
input: HTMLInputElement;
protected options: MoneyInputMaskOptions;
private buffer;
private charAtSelection;
private charBeforeSelection;
private lengthOf0FormattedValue;
private readonly digitRegex;
private readonly nonDigitRegex;
private readonly thousandsRegex;
private readonly separatorRegex;
constructor(inputElement: HTMLInputElement, options?: Partial<MoneyInputMaskOptions>);
private escapeRegExp;
private formatAndDisplay;
protected setupEventListeners(): void;
protected formatInput(): void;
protected formatNumber(value: number): string;
protected onSelectionChange(_e: Event): void;
protected onInput(_e: Event): void;
private mapRawIndexToFormattedPosition;
protected onFocus(): void;
protected onBlur(): void;
getNumericalValue(): number;
setValue(value: number): void;
destroy(): void;
}
export {};