UNPKG

@true-directive/base

Version:

The set of base classes for the TrueDirective Grid

70 lines (69 loc) 2.68 kB
/** * Copyright (c) 2018-2019 Aleksey Melnikov, True Directive Company. * @link https://truedirective.com/ * @license MIT */ import { MaskSectionType } from './mask-section-type.class'; import { MaskSettings } from './mask-settings.class'; import { MaskValue } from './mask-value.class'; export declare class MaskSectionAction { name: string; static NONE: MaskSectionAction; static APPLY: MaskSectionAction; static SKIP: MaskSectionAction; static GO_FWD: MaskSectionAction; static GO_BACK: MaskSectionAction; static GO_BACK_AND_DELETE: MaskSectionAction; static GO_BACK_AND_BACKSPACE: MaskSectionAction; constructor(name: string); } export declare class MaskResult { newValue: string; action: MaskSectionAction; nextSectionPos: number; inSection: boolean; selStart: number; selLength: number; constructor(newValue: string, action: MaskSectionAction, nextSectionPos: number); } export declare class MaskSection { settings: MaskSettings; section: string; delimiter: string; sectionType: MaskSectionType; constructor(settings: MaskSettings, section: string, // Value of the mask delimiter: string, sectionType?: MaskSectionType); readonly length: number; readonly maxLength: number; private isEmptySection; hasOptions(): boolean; hasRegExp(): boolean; isNumeric(): boolean; numericValue(value: string): number; checkMinMax(n: number): number; removePlaceholders(txt: string): string; private incValue; private decValue; autoCorrectVal(s: string): string; extract(maskValue: string, // Input mask value sectionPos: number, // Section value's first char index selStart?: number, selLength?: number): MaskValue; private skip; private none; private apply; private applyDelimiter; private goBack; private goFwd; private isDigit; applyKey(value: string, // Mask value keyCode: number, // Key which has been pressed keyChar: string, sectionPos: number, // Section's first symbol index selStart: number, // Current carriage position selLength: number, // Number of currently selected chars acceptDelimiterChars?: boolean, // If symbols of delimiter are acceptable isLast?: boolean): MaskResult; setDefaultVariant(value: string, sectionPos: number): string; selectFirst(value: string, sectionPos: number): MaskResult; selectLast(value: string, sectionPos: number, forDelete?: boolean): MaskResult; autoCorrect(value: string, sectionPos: number, selStart: number, selLength: number): MaskResult; }