GULP DIST
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { _ as _createClass, a as _classCallCheck, b as _objectWithoutProperties } from '../../_rollupPluginBabelHelpers-a0b34764.js';
|
||||
import { _ as _createClass, a as _classCallCheck, b as _objectWithoutProperties } from '../../_rollupPluginBabelHelpers-b054ecd2.js';
|
||||
import ChangeDetails from '../../core/change-details.js';
|
||||
import { isString } from '../../core/utils.js';
|
||||
import ContinuousTailDetails from '../../core/continuous-tail-details.js';
|
||||
@@ -30,7 +30,8 @@ var ChunksTailDetails = /*#__PURE__*/function () {
|
||||
if (!String(tailChunk)) return;
|
||||
if (isString(tailChunk)) tailChunk = new ContinuousTailDetails(String(tailChunk));
|
||||
var lastChunk = this.chunks[this.chunks.length - 1];
|
||||
var extendLast = lastChunk && (lastChunk.stop === tailChunk.stop || tailChunk.stop == null) && // if tail chunk goes just after last chunk
|
||||
var extendLast = lastChunk && ( // if stops are same or tail has no stop
|
||||
lastChunk.stop === tailChunk.stop || tailChunk.stop == null) && // if tail chunk goes just after last chunk
|
||||
tailChunk.from === lastChunk.from + lastChunk.toString().length;
|
||||
|
||||
if (tailChunk instanceof ContinuousTailDetails) {
|
||||
@@ -81,7 +82,8 @@ var ChunksTailDetails = /*#__PURE__*/function () {
|
||||
var stop = chunk.stop;
|
||||
var chunkBlock = void 0;
|
||||
|
||||
if (stop != null && (!lastBlockIter || lastBlockIter.index <= stop)) {
|
||||
if (stop != null && ( // if block not found or stop is behind lastBlock
|
||||
!lastBlockIter || lastBlockIter.index <= stop)) {
|
||||
if (chunk instanceof ChunksTailDetails || // for continuous block also check if stop is exist
|
||||
masked._stops.indexOf(stop) >= 0) {
|
||||
details.aggregate(masked._appendPlaceholder(stop));
|
||||
@@ -134,15 +136,15 @@ var ChunksTailDetails = /*#__PURE__*/function () {
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "shiftBefore",
|
||||
value: function shiftBefore(pos) {
|
||||
if (this.from >= pos || !this.chunks.length) return '';
|
||||
var chunkShiftPos = pos - this.from;
|
||||
key: "unshift",
|
||||
value: function unshift(beforePos) {
|
||||
if (!this.chunks.length || beforePos != null && this.from >= beforePos) return '';
|
||||
var chunkShiftPos = beforePos != null ? beforePos - this.from : beforePos;
|
||||
var ci = 0;
|
||||
|
||||
while (ci < this.chunks.length) {
|
||||
var chunk = this.chunks[ci];
|
||||
var shiftChar = chunk.shiftBefore(chunkShiftPos);
|
||||
var shiftChar = chunk.unshift(chunkShiftPos);
|
||||
|
||||
if (chunk.toString()) {
|
||||
// chunk still contains value
|
||||
@@ -157,6 +159,31 @@ var ChunksTailDetails = /*#__PURE__*/function () {
|
||||
if (shiftChar) return shiftChar;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}, {
|
||||
key: "shift",
|
||||
value: function shift() {
|
||||
if (!this.chunks.length) return '';
|
||||
var ci = this.chunks.length - 1;
|
||||
|
||||
while (0 <= ci) {
|
||||
var chunk = this.chunks[ci];
|
||||
var shiftChar = chunk.shift();
|
||||
|
||||
if (chunk.toString()) {
|
||||
// chunk still contains value
|
||||
// but not shifted - means no more available chars to shift
|
||||
if (!shiftChar) break;
|
||||
--ci;
|
||||
} else {
|
||||
// clean if chunk has no value
|
||||
this.chunks.splice(ci, 1);
|
||||
}
|
||||
|
||||
if (shiftChar) return shiftChar;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}]);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { _ as _createClass, a as _classCallCheck } from '../../_rollupPluginBabelHelpers-a0b34764.js';
|
||||
import { _ as _createClass, a as _classCallCheck } from '../../_rollupPluginBabelHelpers-b054ecd2.js';
|
||||
import ChangeDetails from '../../core/change-details.js';
|
||||
import { DIRECTION, isString } from '../../core/utils.js';
|
||||
import ContinuousTailDetails from '../../core/continuous-tail-details.js';
|
||||
@@ -10,12 +10,17 @@ var PatternFixedDefinition = /*#__PURE__*/function () {
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
function PatternFixedDefinition(opts) {
|
||||
_classCallCheck(this, PatternFixedDefinition);
|
||||
|
||||
Object.assign(this, opts);
|
||||
this._value = '';
|
||||
this.isFixed = true;
|
||||
}
|
||||
|
||||
_createClass(PatternFixedDefinition, [{
|
||||
@@ -75,19 +80,29 @@ var PatternFixedDefinition = /*#__PURE__*/function () {
|
||||
get: function get() {
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: "isFilled",
|
||||
get: function get() {
|
||||
return Boolean(this._value);
|
||||
}
|
||||
}, {
|
||||
key: "_appendChar",
|
||||
value: function _appendChar(str) {
|
||||
value: function _appendChar(ch) {
|
||||
var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
var details = new ChangeDetails();
|
||||
if (this._value) return details;
|
||||
var appended = this.char === str[0];
|
||||
var isResolved = appended && (this.isUnmasking || flags.input || flags.raw) && !flags.tail;
|
||||
var appended = this.char === ch;
|
||||
var isResolved = appended && (this.isUnmasking || flags.input || flags.raw) && !this.eager && !flags.tail;
|
||||
if (isResolved) details.rawInserted = this.char;
|
||||
this._value = details.inserted = this.char;
|
||||
this._isRawInput = isResolved && (flags.raw || flags.input);
|
||||
return details;
|
||||
}
|
||||
}, {
|
||||
key: "_appendEager",
|
||||
value: function _appendEager() {
|
||||
return this._appendChar(this.char);
|
||||
}
|
||||
}, {
|
||||
key: "_appendPlaceholder",
|
||||
value: function _appendPlaceholder() {
|
||||
@@ -112,7 +127,7 @@ var PatternFixedDefinition = /*#__PURE__*/function () {
|
||||
}, {
|
||||
key: "append",
|
||||
value: function append(str, flags, tail) {
|
||||
var details = this._appendChar(str, flags);
|
||||
var details = this._appendChar(str[0], flags);
|
||||
|
||||
if (tail != null) {
|
||||
details.tailShift += this.appendTail(tail).tailShift;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { _ as _createClass, a as _classCallCheck, b as _objectWithoutProperties } from '../../_rollupPluginBabelHelpers-a0b34764.js';
|
||||
import { _ as _createClass, a as _classCallCheck, b as _objectWithoutProperties } from '../../_rollupPluginBabelHelpers-b054ecd2.js';
|
||||
import createMask from '../factory.js';
|
||||
import ChangeDetails from '../../core/change-details.js';
|
||||
import { DIRECTION } from '../../core/utils.js';
|
||||
@@ -24,6 +24,8 @@ var PatternInputDefinition = /*#__PURE__*/function () {
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
function PatternInputDefinition(opts) {
|
||||
_classCallCheck(this, PatternInputDefinition);
|
||||
@@ -40,7 +42,7 @@ var PatternInputDefinition = /*#__PURE__*/function () {
|
||||
_createClass(PatternInputDefinition, [{
|
||||
key: "reset",
|
||||
value: function reset() {
|
||||
this._isFilled = false;
|
||||
this.isFilled = false;
|
||||
this.masked.reset();
|
||||
}
|
||||
}, {
|
||||
@@ -50,7 +52,7 @@ var PatternInputDefinition = /*#__PURE__*/function () {
|
||||
var toPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.value.length;
|
||||
|
||||
if (fromPos === 0 && toPos >= 1) {
|
||||
this._isFilled = false;
|
||||
this.isFilled = false;
|
||||
return this.masked.remove(fromPos, toPos);
|
||||
}
|
||||
|
||||
@@ -59,7 +61,7 @@ var PatternInputDefinition = /*#__PURE__*/function () {
|
||||
}, {
|
||||
key: "value",
|
||||
get: function get() {
|
||||
return this.masked.value || (this._isFilled && !this.isOptional ? this.placeholderChar : '');
|
||||
return this.masked.value || (this.isFilled && !this.isOptional ? this.placeholderChar : '');
|
||||
}
|
||||
}, {
|
||||
key: "unmaskedValue",
|
||||
@@ -73,12 +75,12 @@ var PatternInputDefinition = /*#__PURE__*/function () {
|
||||
}
|
||||
}, {
|
||||
key: "_appendChar",
|
||||
value: function _appendChar(str) {
|
||||
value: function _appendChar(ch) {
|
||||
var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
if (this._isFilled) return new ChangeDetails();
|
||||
if (this.isFilled) return new ChangeDetails();
|
||||
var state = this.masked.state; // simulate input
|
||||
|
||||
var details = this.masked._appendChar(str, flags);
|
||||
var details = this.masked._appendChar(ch, flags);
|
||||
|
||||
if (details.inserted && this.doValidate(flags) === false) {
|
||||
details.inserted = details.rawInserted = '';
|
||||
@@ -90,7 +92,7 @@ var PatternInputDefinition = /*#__PURE__*/function () {
|
||||
}
|
||||
|
||||
details.skip = !details.inserted && !this.isOptional;
|
||||
this._isFilled = Boolean(details.inserted);
|
||||
this.isFilled = Boolean(details.inserted);
|
||||
return details;
|
||||
}
|
||||
}, {
|
||||
@@ -98,17 +100,23 @@ var PatternInputDefinition = /*#__PURE__*/function () {
|
||||
value: function append() {
|
||||
var _this$masked;
|
||||
|
||||
// TODO probably should be done via _appendChar
|
||||
return (_this$masked = this.masked).append.apply(_this$masked, arguments);
|
||||
}
|
||||
}, {
|
||||
key: "_appendPlaceholder",
|
||||
value: function _appendPlaceholder() {
|
||||
var details = new ChangeDetails();
|
||||
if (this._isFilled || this.isOptional) return details;
|
||||
this._isFilled = true;
|
||||
if (this.isFilled || this.isOptional) return details;
|
||||
this.isFilled = true;
|
||||
details.inserted = this.placeholderChar;
|
||||
return details;
|
||||
}
|
||||
}, {
|
||||
key: "_appendEager",
|
||||
value: function _appendEager() {
|
||||
return new ChangeDetails();
|
||||
}
|
||||
}, {
|
||||
key: "extractTail",
|
||||
value: function extractTail() {
|
||||
@@ -170,12 +178,12 @@ var PatternInputDefinition = /*#__PURE__*/function () {
|
||||
get: function get() {
|
||||
return {
|
||||
masked: this.masked.state,
|
||||
_isFilled: this._isFilled
|
||||
isFilled: this.isFilled
|
||||
};
|
||||
},
|
||||
set: function set(state) {
|
||||
this.masked.state = state.masked;
|
||||
this._isFilled = state._isFilled;
|
||||
this.isFilled = state.isFilled;
|
||||
}
|
||||
}]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user