UNPKG

@true-directive/base

Version:

The set of base classes for the TrueDirective Grid

36 lines (35 loc) 1.3 kB
var MaskSectionValue = /** @class */ (function () { function MaskSectionValue(value, sectionPos, selStart) { var selStart_local = selStart - sectionPos; if (selStart_local < 0 || selStart_local > value.length) { this.beforeChars = value; this.currentChar = ''; this.afterChars = ''; return; } this.beforeChars = value.substring(0, selStart_local); this.currentChar = value.substring(selStart_local, selStart_local + 1); this.afterChars = value.substring(selStart_local + 1); } MaskSectionValue.prototype.append = function (s) { this.afterChars += s; }; MaskSectionValue.prototype.value = function (newChar) { if (newChar === void 0) { newChar = null; } if (newChar !== null) { return this.beforeChars + newChar + this.afterChars; } else { return this.beforeChars + this.currentChar + this.afterChars; } }; Object.defineProperty(MaskSectionValue.prototype, "length", { get: function () { return this.value().length; }, enumerable: true, configurable: true }); return MaskSectionValue; }()); export { MaskSectionValue };