GULP DIST
This commit is contained in:
88
dist/assets/vendor/imask/esm/masked/base.js
vendored
88
dist/assets/vendor/imask/esm/masked/base.js
vendored
@@ -1,7 +1,7 @@
|
||||
import { _ as _createClass, a as _classCallCheck } from '../_rollupPluginBabelHelpers-a0b34764.js';
|
||||
import { _ as _createClass, a as _classCallCheck, f as _slicedToArray } from '../_rollupPluginBabelHelpers-b054ecd2.js';
|
||||
import ChangeDetails from '../core/change-details.js';
|
||||
import ContinuousTailDetails from '../core/continuous-tail-details.js';
|
||||
import { isString } from '../core/utils.js';
|
||||
import { isString, normalizePrepare, forceDirection, DIRECTION } from '../core/utils.js';
|
||||
import IMask from '../core/holder.js';
|
||||
|
||||
/** Supported mask type */
|
||||
@@ -27,6 +27,8 @@ var Masked = /*#__PURE__*/function () {
|
||||
|
||||
/** Enable characters overwriting */
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
function Masked(opts) {
|
||||
_classCallCheck(this, Masked);
|
||||
@@ -43,7 +45,8 @@ var Masked = /*#__PURE__*/function () {
|
||||
_createClass(Masked, [{
|
||||
key: "updateOptions",
|
||||
value: function updateOptions(opts) {
|
||||
if (!Object.keys(opts).length) return;
|
||||
if (!Object.keys(opts).length) return; // $FlowFixMe
|
||||
|
||||
this.withValueRefresh(this._update.bind(this, opts));
|
||||
}
|
||||
/**
|
||||
@@ -142,6 +145,13 @@ var Masked = /*#__PURE__*/function () {
|
||||
get: function get() {
|
||||
return true;
|
||||
}
|
||||
/** */
|
||||
|
||||
}, {
|
||||
key: "isFilled",
|
||||
get: function get() {
|
||||
return this.isComplete;
|
||||
}
|
||||
/** Finds nearest input position in direction */
|
||||
|
||||
}, {
|
||||
@@ -196,8 +206,15 @@ var Masked = /*#__PURE__*/function () {
|
||||
var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
var checkTail = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var consistentState = this.state;
|
||||
var details;
|
||||
|
||||
var details = this._appendCharRaw(this.doPrepare(ch, flags), flags);
|
||||
var _normalizePrepare = normalizePrepare(this.doPrepare(ch, flags));
|
||||
|
||||
var _normalizePrepare2 = _slicedToArray(_normalizePrepare, 2);
|
||||
|
||||
ch = _normalizePrepare2[0];
|
||||
details = _normalizePrepare2[1];
|
||||
details = details.aggregate(this._appendCharRaw(ch, flags));
|
||||
|
||||
if (details.inserted) {
|
||||
var consistentTail;
|
||||
@@ -207,13 +224,22 @@ var Masked = /*#__PURE__*/function () {
|
||||
// validation ok, check tail
|
||||
var beforeTailState = this.state;
|
||||
|
||||
if (this.overwrite) {
|
||||
if (this.overwrite === true) {
|
||||
consistentTail = checkTail.state;
|
||||
checkTail.shiftBefore(this.value.length);
|
||||
checkTail.unshift(this.value.length);
|
||||
}
|
||||
|
||||
var tailDetails = this.appendTail(checkTail);
|
||||
appended = tailDetails.rawInserted === checkTail.toString(); // if ok, rollback state after tail
|
||||
appended = tailDetails.rawInserted === checkTail.toString(); // not ok, try shift
|
||||
|
||||
if (!(appended && tailDetails.inserted) && this.overwrite === 'shift') {
|
||||
this.state = beforeTailState;
|
||||
consistentTail = checkTail.state;
|
||||
checkTail.shift();
|
||||
tailDetails = this.appendTail(checkTail);
|
||||
appended = tailDetails.rawInserted === checkTail.toString();
|
||||
} // if ok, rollback state after tail
|
||||
|
||||
|
||||
if (appended && tailDetails.inserted) this.state = beforeTailState;
|
||||
} // revert all if something went wrong
|
||||
@@ -235,6 +261,13 @@ var Masked = /*#__PURE__*/function () {
|
||||
value: function _appendPlaceholder() {
|
||||
return new ChangeDetails();
|
||||
}
|
||||
/** Appends optional eager placeholder at end */
|
||||
|
||||
}, {
|
||||
key: "_appendEager",
|
||||
value: function _appendEager() {
|
||||
return new ChangeDetails();
|
||||
}
|
||||
/** Appends symbols considering flags */
|
||||
// $FlowFixMe no ideas
|
||||
|
||||
@@ -257,6 +290,10 @@ var Masked = /*#__PURE__*/function () {
|
||||
// this._resetBeforeTailState();
|
||||
}
|
||||
|
||||
if (this.eager && flags !== null && flags !== void 0 && flags.input && str) {
|
||||
details.aggregate(this._appendEager());
|
||||
}
|
||||
|
||||
return details;
|
||||
}
|
||||
/** */
|
||||
@@ -353,14 +390,43 @@ var Masked = /*#__PURE__*/function () {
|
||||
value: function splice(start, deleteCount, inserted, removeDirection) {
|
||||
var tailPos = start + deleteCount;
|
||||
var tail = this.extractTail(tailPos);
|
||||
var startChangePos = this.nearestInputPos(start, removeDirection);
|
||||
var changeDetails = new ChangeDetails({
|
||||
var oldRawValue;
|
||||
|
||||
if (this.eager) {
|
||||
removeDirection = forceDirection(removeDirection);
|
||||
oldRawValue = this.extractInput(0, tailPos, {
|
||||
raw: true
|
||||
});
|
||||
}
|
||||
|
||||
var startChangePos = this.nearestInputPos(start, deleteCount > 1 && start !== 0 && !this.eager ? DIRECTION.NONE : removeDirection);
|
||||
var details = new ChangeDetails({
|
||||
tailShift: startChangePos - start // adjust tailShift if start was aligned
|
||||
|
||||
}).aggregate(this.remove(startChangePos)).aggregate(this.append(inserted, {
|
||||
}).aggregate(this.remove(startChangePos));
|
||||
|
||||
if (this.eager && removeDirection !== DIRECTION.NONE && oldRawValue === this.rawInputValue) {
|
||||
if (removeDirection === DIRECTION.FORCE_LEFT) {
|
||||
var valLength;
|
||||
|
||||
while (oldRawValue === this.rawInputValue && (valLength = this.value.length)) {
|
||||
details.aggregate(new ChangeDetails({
|
||||
tailShift: -1
|
||||
})).aggregate(this.remove(valLength - 1));
|
||||
}
|
||||
} else if (removeDirection === DIRECTION.FORCE_RIGHT) {
|
||||
tail.unshift();
|
||||
}
|
||||
}
|
||||
|
||||
return details.aggregate(this.append(inserted, {
|
||||
input: true
|
||||
}, tail));
|
||||
return changeDetails;
|
||||
}
|
||||
}, {
|
||||
key: "maskEquals",
|
||||
value: function maskEquals(mask) {
|
||||
return this.mask === mask;
|
||||
}
|
||||
}]);
|
||||
|
||||
|
||||
17
dist/assets/vendor/imask/esm/masked/date.js
vendored
17
dist/assets/vendor/imask/esm/masked/date.js
vendored
@@ -1,4 +1,4 @@
|
||||
import { d as _inherits, e as _createSuper, a as _classCallCheck, _ as _createClass, f as _slicedToArray, g as _get, h as _getPrototypeOf, i as _set } from '../_rollupPluginBabelHelpers-a0b34764.js';
|
||||
import { d as _inherits, e as _createSuper, a as _classCallCheck, _ as _createClass, f as _slicedToArray, g as _get, h as _getPrototypeOf, i as _set } from '../_rollupPluginBabelHelpers-b054ecd2.js';
|
||||
import MaskedPattern from './pattern.js';
|
||||
import MaskedRange from './range.js';
|
||||
import IMask from '../core/holder.js';
|
||||
@@ -10,6 +10,7 @@ import './pattern/input-definition.js';
|
||||
import './factory.js';
|
||||
import './pattern/fixed-definition.js';
|
||||
import './pattern/chunk-tail-details.js';
|
||||
import './pattern/cursor.js';
|
||||
import './regexp.js';
|
||||
|
||||
/** Date mask */
|
||||
@@ -61,11 +62,11 @@ var MaskedDate = /*#__PURE__*/function (_MaskedPattern) {
|
||||
}
|
||||
}
|
||||
|
||||
Object.assign(opts.blocks, blocks); // add autofix
|
||||
Object.assign(opts.blocks, this.blocks, blocks); // add autofix
|
||||
|
||||
Object.keys(opts.blocks).forEach(function (bk) {
|
||||
var b = opts.blocks[bk];
|
||||
if (!('autofix' in b)) b.autofix = opts.autofix;
|
||||
if (!('autofix' in b) && 'autofix' in opts) b.autofix = opts.autofix;
|
||||
});
|
||||
|
||||
_get(_getPrototypeOf(MaskedDate.prototype), "_update", this).call(this, opts);
|
||||
@@ -116,6 +117,15 @@ var MaskedDate = /*#__PURE__*/function (_MaskedPattern) {
|
||||
set: function set(value) {
|
||||
_set(_getPrototypeOf(MaskedDate.prototype), "typedValue", value, this, true);
|
||||
}
|
||||
/**
|
||||
@override
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "maskEquals",
|
||||
value: function maskEquals(mask) {
|
||||
return mask === Date || _get(_getPrototypeOf(MaskedDate.prototype), "maskEquals", this).call(this, mask);
|
||||
}
|
||||
}]);
|
||||
|
||||
return MaskedDate;
|
||||
@@ -123,6 +133,7 @@ var MaskedDate = /*#__PURE__*/function (_MaskedPattern) {
|
||||
MaskedDate.DEFAULTS = {
|
||||
pattern: 'd{.}`m{.}`Y',
|
||||
format: function format(date) {
|
||||
if (!date) return '';
|
||||
var day = String(date.getDate()).padStart(2, '0');
|
||||
var month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
var year = date.getFullYear();
|
||||
|
||||
73
dist/assets/vendor/imask/esm/masked/dynamic.js
vendored
73
dist/assets/vendor/imask/esm/masked/dynamic.js
vendored
@@ -1,4 +1,4 @@
|
||||
import { d as _inherits, e as _createSuper, a as _classCallCheck, _ as _createClass, g as _get, h as _getPrototypeOf, i as _set, b as _objectWithoutProperties } from '../_rollupPluginBabelHelpers-a0b34764.js';
|
||||
import { d as _inherits, e as _createSuper, a as _classCallCheck, _ as _createClass, g as _get, h as _getPrototypeOf, i as _set, b as _objectWithoutProperties } from '../_rollupPluginBabelHelpers-b054ecd2.js';
|
||||
import ChangeDetails from '../core/change-details.js';
|
||||
import createMask from './factory.js';
|
||||
import Masked from './base.js';
|
||||
@@ -122,6 +122,21 @@ var MaskedDynamic = /*#__PURE__*/function (_Masked) {
|
||||
|
||||
return details;
|
||||
}
|
||||
/**
|
||||
@override
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "_appendEager",
|
||||
value: function _appendEager() {
|
||||
var details = this._applyDispatch.apply(this, arguments);
|
||||
|
||||
if (this.currentMask) {
|
||||
details.aggregate(this.currentMask._appendEager());
|
||||
}
|
||||
|
||||
return details;
|
||||
}
|
||||
/**
|
||||
@override
|
||||
*/
|
||||
@@ -154,7 +169,9 @@ var MaskedDynamic = /*#__PURE__*/function (_Masked) {
|
||||
}, {
|
||||
key: "reset",
|
||||
value: function reset() {
|
||||
if (this.currentMask) this.currentMask.reset();
|
||||
var _this$currentMask2;
|
||||
|
||||
(_this$currentMask2 = this.currentMask) === null || _this$currentMask2 === void 0 ? void 0 : _this$currentMask2.reset();
|
||||
this.compiledMasks.forEach(function (m) {
|
||||
return m.reset();
|
||||
});
|
||||
@@ -210,7 +227,20 @@ var MaskedDynamic = /*#__PURE__*/function (_Masked) {
|
||||
}, {
|
||||
key: "isComplete",
|
||||
get: function get() {
|
||||
return !!this.currentMask && this.currentMask.isComplete;
|
||||
var _this$currentMask3;
|
||||
|
||||
return Boolean((_this$currentMask3 = this.currentMask) === null || _this$currentMask3 === void 0 ? void 0 : _this$currentMask3.isComplete);
|
||||
}
|
||||
/**
|
||||
@override
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "isFilled",
|
||||
get: function get() {
|
||||
var _this$currentMask4;
|
||||
|
||||
return Boolean((_this$currentMask4 = this.currentMask) === null || _this$currentMask4 === void 0 ? void 0 : _this$currentMask4.isFilled);
|
||||
}
|
||||
/**
|
||||
@override
|
||||
@@ -222,9 +252,9 @@ var MaskedDynamic = /*#__PURE__*/function (_Masked) {
|
||||
var details = new ChangeDetails();
|
||||
|
||||
if (this.currentMask) {
|
||||
var _this$currentMask2;
|
||||
var _this$currentMask5;
|
||||
|
||||
details.aggregate((_this$currentMask2 = this.currentMask).remove.apply(_this$currentMask2, arguments)) // update with dispatch
|
||||
details.aggregate((_this$currentMask5 = this.currentMask).remove.apply(_this$currentMask5, arguments)) // update with dispatch
|
||||
.aggregate(this._applyDispatch());
|
||||
}
|
||||
|
||||
@@ -270,9 +300,9 @@ var MaskedDynamic = /*#__PURE__*/function (_Masked) {
|
||||
}, {
|
||||
key: "extractInput",
|
||||
value: function extractInput() {
|
||||
var _this$currentMask3;
|
||||
var _this$currentMask6;
|
||||
|
||||
return this.currentMask ? (_this$currentMask3 = this.currentMask).extractInput.apply(_this$currentMask3, arguments) : '';
|
||||
return this.currentMask ? (_this$currentMask6 = this.currentMask).extractInput.apply(_this$currentMask6, arguments) : '';
|
||||
}
|
||||
/**
|
||||
@override
|
||||
@@ -281,13 +311,13 @@ var MaskedDynamic = /*#__PURE__*/function (_Masked) {
|
||||
}, {
|
||||
key: "extractTail",
|
||||
value: function extractTail() {
|
||||
var _this$currentMask4, _get3;
|
||||
var _this$currentMask7, _get3;
|
||||
|
||||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
||||
args[_key2] = arguments[_key2];
|
||||
}
|
||||
|
||||
return this.currentMask ? (_this$currentMask4 = this.currentMask).extractTail.apply(_this$currentMask4, args) : (_get3 = _get(_getPrototypeOf(MaskedDynamic.prototype), "extractTail", this)).call.apply(_get3, [this].concat(args));
|
||||
return this.currentMask ? (_this$currentMask7 = this.currentMask).extractTail.apply(_this$currentMask7, args) : (_get3 = _get(_getPrototypeOf(MaskedDynamic.prototype), "extractTail", this)).call.apply(_get3, [this].concat(args));
|
||||
}
|
||||
/**
|
||||
@override
|
||||
@@ -307,13 +337,13 @@ var MaskedDynamic = /*#__PURE__*/function (_Masked) {
|
||||
}, {
|
||||
key: "nearestInputPos",
|
||||
value: function nearestInputPos() {
|
||||
var _this$currentMask5, _get4;
|
||||
var _this$currentMask8, _get4;
|
||||
|
||||
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
||||
args[_key3] = arguments[_key3];
|
||||
}
|
||||
|
||||
return this.currentMask ? (_this$currentMask5 = this.currentMask).nearestInputPos.apply(_this$currentMask5, args) : (_get4 = _get(_getPrototypeOf(MaskedDynamic.prototype), "nearestInputPos", this)).call.apply(_get4, [this].concat(args));
|
||||
return this.currentMask ? (_this$currentMask8 = this.currentMask).nearestInputPos.apply(_this$currentMask8, args) : (_get4 = _get(_getPrototypeOf(MaskedDynamic.prototype), "nearestInputPos", this)).call.apply(_get4, [this].concat(args));
|
||||
}
|
||||
}, {
|
||||
key: "overwrite",
|
||||
@@ -323,6 +353,27 @@ var MaskedDynamic = /*#__PURE__*/function (_Masked) {
|
||||
set: function set(overwrite) {
|
||||
console.warn('"overwrite" option is not available in dynamic mask, use this option in siblings');
|
||||
}
|
||||
}, {
|
||||
key: "eager",
|
||||
get: function get() {
|
||||
return this.currentMask ? this.currentMask.eager : _get(_getPrototypeOf(MaskedDynamic.prototype), "eager", this);
|
||||
},
|
||||
set: function set(eager) {
|
||||
console.warn('"eager" option is not available in dynamic mask, use this option in siblings');
|
||||
}
|
||||
/**
|
||||
@override
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "maskEquals",
|
||||
value: function maskEquals(mask) {
|
||||
return Array.isArray(mask) && this.compiledMasks.every(function (m, mi) {
|
||||
var _mask$mi;
|
||||
|
||||
return m.maskEquals((_mask$mi = mask[mi]) === null || _mask$mi === void 0 ? void 0 : _mask$mi.mask);
|
||||
});
|
||||
}
|
||||
}]);
|
||||
|
||||
return MaskedDynamic;
|
||||
|
||||
3
dist/assets/vendor/imask/esm/masked/enum.js
vendored
3
dist/assets/vendor/imask/esm/masked/enum.js
vendored
@@ -1,4 +1,4 @@
|
||||
import { d as _inherits, e as _createSuper, a as _classCallCheck, _ as _createClass, g as _get, h as _getPrototypeOf } from '../_rollupPluginBabelHelpers-a0b34764.js';
|
||||
import { d as _inherits, e as _createSuper, a as _classCallCheck, _ as _createClass, g as _get, h as _getPrototypeOf } from '../_rollupPluginBabelHelpers-b054ecd2.js';
|
||||
import MaskedPattern from './pattern.js';
|
||||
import IMask from '../core/holder.js';
|
||||
import '../core/utils.js';
|
||||
@@ -9,6 +9,7 @@ import './pattern/input-definition.js';
|
||||
import './factory.js';
|
||||
import './pattern/fixed-definition.js';
|
||||
import './pattern/chunk-tail-details.js';
|
||||
import './pattern/cursor.js';
|
||||
import './regexp.js';
|
||||
|
||||
/** Pattern which validates enum values */
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { isString } from '../core/utils.js';
|
||||
import IMask from '../core/holder.js';
|
||||
import '../_rollupPluginBabelHelpers-a0b34764.js';
|
||||
import '../_rollupPluginBabelHelpers-b054ecd2.js';
|
||||
import '../core/change-details.js';
|
||||
|
||||
/** Get Masked class by mask type */
|
||||
|
||||
@@ -22,9 +23,9 @@ function maskedClass(mask) {
|
||||
|
||||
if (IMask.Masked && mask.prototype instanceof IMask.Masked) return mask; // $FlowFixMe
|
||||
|
||||
if (mask instanceof Function) return IMask.MaskedFunction; // $FlowFixMe
|
||||
if (mask instanceof IMask.Masked) return mask.constructor; // $FlowFixMe
|
||||
|
||||
if (mask instanceof IMask.Masked) return mask.constructor;
|
||||
if (mask instanceof Function) return IMask.MaskedFunction;
|
||||
console.warn('Mask not found for mask', mask); // eslint-disable-line no-console
|
||||
// $FlowFixMe
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { d as _inherits, e as _createSuper, a as _classCallCheck, _ as _createClass, g as _get, h as _getPrototypeOf } from '../_rollupPluginBabelHelpers-a0b34764.js';
|
||||
import { d as _inherits, e as _createSuper, a as _classCallCheck, _ as _createClass, g as _get, h as _getPrototypeOf } from '../_rollupPluginBabelHelpers-b054ecd2.js';
|
||||
import Masked from './base.js';
|
||||
import IMask from '../core/holder.js';
|
||||
import '../core/change-details.js';
|
||||
|
||||
24
dist/assets/vendor/imask/esm/masked/number.js
vendored
24
dist/assets/vendor/imask/esm/masked/number.js
vendored
@@ -1,5 +1,5 @@
|
||||
import { d as _inherits, e as _createSuper, a as _classCallCheck, _ as _createClass, g as _get, h as _getPrototypeOf, f as _slicedToArray, i as _set } from '../_rollupPluginBabelHelpers-a0b34764.js';
|
||||
import { escapeRegExp, DIRECTION } from '../core/utils.js';
|
||||
import { d as _inherits, e as _createSuper, a as _classCallCheck, _ as _createClass, g as _get, h as _getPrototypeOf, f as _slicedToArray, i as _set } from '../_rollupPluginBabelHelpers-b054ecd2.js';
|
||||
import { escapeRegExp, normalizePrepare, DIRECTION } from '../core/utils.js';
|
||||
import ChangeDetails from '../core/change-details.js';
|
||||
import Masked from './base.js';
|
||||
import IMask from '../core/holder.js';
|
||||
@@ -95,14 +95,24 @@ var MaskedNumber = /*#__PURE__*/function (_Masked) {
|
||||
|
||||
}, {
|
||||
key: "doPrepare",
|
||||
value: function doPrepare(str) {
|
||||
value: function doPrepare(ch) {
|
||||
var _get2;
|
||||
|
||||
ch = ch.replace(this._mapToRadixRegExp, this.radix);
|
||||
|
||||
var noSepCh = this._removeThousandsSeparators(ch);
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
args[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
return (_get2 = _get(_getPrototypeOf(MaskedNumber.prototype), "doPrepare", this)).call.apply(_get2, [this, this._removeThousandsSeparators(str.replace(this._mapToRadixRegExp, this.radix))].concat(args));
|
||||
var _normalizePrepare = normalizePrepare((_get2 = _get(_getPrototypeOf(MaskedNumber.prototype), "doPrepare", this)).call.apply(_get2, [this, noSepCh].concat(args))),
|
||||
_normalizePrepare2 = _slicedToArray(_normalizePrepare, 2),
|
||||
prepCh = _normalizePrepare2[0],
|
||||
details = _normalizePrepare2[1];
|
||||
|
||||
if (ch && !noSepCh) details.skip = true;
|
||||
return [prepCh, details];
|
||||
}
|
||||
/** */
|
||||
|
||||
@@ -282,7 +292,9 @@ var MaskedNumber = /*#__PURE__*/function (_Masked) {
|
||||
if (valid) {
|
||||
// validate as number
|
||||
var number = this.number;
|
||||
valid = valid && !isNaN(number) && (this.min == null || this.min >= 0 || this.min <= this.number) && (this.max == null || this.max <= 0 || this.number <= this.max);
|
||||
valid = valid && !isNaN(number) && ( // check min bound for negative values
|
||||
this.min == null || this.min >= 0 || this.min <= this.number) && ( // check max bound for positive values
|
||||
this.max == null || this.max <= 0 || this.number <= this.max);
|
||||
}
|
||||
|
||||
return valid && _get(_getPrototypeOf(MaskedNumber.prototype), "doValidate", this).call(this, flags);
|
||||
@@ -303,7 +315,7 @@ var MaskedNumber = /*#__PURE__*/function (_Masked) {
|
||||
if (validnum !== number) this.unmaskedValue = String(validnum);
|
||||
var formatted = this.value;
|
||||
if (this.normalizeZeros) formatted = this._normalizeZeros(formatted);
|
||||
if (this.padFractionalZeros) formatted = this._padFractionalZeros(formatted);
|
||||
if (this.padFractionalZeros && this.scale > 0) formatted = this._padFractionalZeros(formatted);
|
||||
this._value = formatted;
|
||||
}
|
||||
|
||||
|
||||
320
dist/assets/vendor/imask/esm/masked/pattern.js
vendored
320
dist/assets/vendor/imask/esm/masked/pattern.js
vendored
@@ -1,10 +1,11 @@
|
||||
import { d as _inherits, e as _createSuper, a as _classCallCheck, _ as _createClass, g as _get, h as _getPrototypeOf, b as _objectWithoutProperties, i as _set } from '../_rollupPluginBabelHelpers-a0b34764.js';
|
||||
import { DIRECTION, forceDirection } from '../core/utils.js';
|
||||
import { d as _inherits, e as _createSuper, a as _classCallCheck, _ as _createClass, g as _get, h as _getPrototypeOf, b as _objectWithoutProperties, i as _set } from '../_rollupPluginBabelHelpers-b054ecd2.js';
|
||||
import { DIRECTION } from '../core/utils.js';
|
||||
import ChangeDetails from '../core/change-details.js';
|
||||
import Masked from './base.js';
|
||||
import PatternInputDefinition, { DEFAULT_INPUT_DEFINITIONS } from './pattern/input-definition.js';
|
||||
import PatternFixedDefinition from './pattern/fixed-definition.js';
|
||||
import ChunksTailDetails from './pattern/chunk-tail-details.js';
|
||||
import PatternCursor from './pattern/cursor.js';
|
||||
import createMask from './factory.js';
|
||||
import IMask from '../core/holder.js';
|
||||
import './regexp.js';
|
||||
@@ -92,6 +93,7 @@ var MaskedPattern = /*#__PURE__*/function (_Masked) {
|
||||
var maskedBlock = createMask(Object.assign({
|
||||
parent: _this,
|
||||
lazy: _this.lazy,
|
||||
eager: _this.eager,
|
||||
placeholderChar: _this.placeholderChar,
|
||||
overwrite: _this.overwrite
|
||||
}, _this.blocks[bName]));
|
||||
@@ -114,8 +116,7 @@ var MaskedPattern = /*#__PURE__*/function (_Masked) {
|
||||
}
|
||||
|
||||
var char = pattern[i];
|
||||
|
||||
var _isInput = (char in defs);
|
||||
var isInput = (char in defs);
|
||||
|
||||
if (char === MaskedPattern.STOP_CHAR) {
|
||||
this._stops.push(this._blocks.length);
|
||||
@@ -137,17 +138,19 @@ var MaskedPattern = /*#__PURE__*/function (_Masked) {
|
||||
++i;
|
||||
char = pattern[i];
|
||||
if (!char) break;
|
||||
_isInput = false;
|
||||
isInput = false;
|
||||
}
|
||||
|
||||
var def = _isInput ? new PatternInputDefinition({
|
||||
var def = isInput ? new PatternInputDefinition({
|
||||
parent: this,
|
||||
lazy: this.lazy,
|
||||
eager: this.eager,
|
||||
placeholderChar: this.placeholderChar,
|
||||
mask: defs[char],
|
||||
isOptional: optionalBlock
|
||||
}) : new PatternFixedDefinition({
|
||||
char: char,
|
||||
eager: this.eager,
|
||||
isUnmasking: unmaskingBlock
|
||||
});
|
||||
|
||||
@@ -205,6 +208,31 @@ var MaskedPattern = /*#__PURE__*/function (_Masked) {
|
||||
@override
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "isFilled",
|
||||
get: function get() {
|
||||
return this._blocks.every(function (b) {
|
||||
return b.isFilled;
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "isFixed",
|
||||
get: function get() {
|
||||
return this._blocks.every(function (b) {
|
||||
return b.isFixed;
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "isOptional",
|
||||
get: function get() {
|
||||
return this._blocks.every(function (b) {
|
||||
return b.isOptional;
|
||||
});
|
||||
}
|
||||
/**
|
||||
@override
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "doCommit",
|
||||
value: function doCommit() {
|
||||
@@ -256,6 +284,30 @@ var MaskedPattern = /*#__PURE__*/function (_Masked) {
|
||||
@override
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "_appendEager",
|
||||
value: function _appendEager() {
|
||||
var _this$_mapPosToBlock;
|
||||
|
||||
var details = new ChangeDetails();
|
||||
var startBlockIndex = (_this$_mapPosToBlock = this._mapPosToBlock(this.value.length)) === null || _this$_mapPosToBlock === void 0 ? void 0 : _this$_mapPosToBlock.index;
|
||||
if (startBlockIndex == null) return details; // TODO test if it works for nested pattern masks
|
||||
|
||||
if (this._blocks[startBlockIndex].isFilled) ++startBlockIndex;
|
||||
|
||||
for (var bi = startBlockIndex; bi < this._blocks.length; ++bi) {
|
||||
var d = this._blocks[bi]._appendEager();
|
||||
|
||||
if (!d.inserted) break;
|
||||
details.aggregate(d);
|
||||
}
|
||||
|
||||
return details;
|
||||
}
|
||||
/**
|
||||
@override
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "_appendCharRaw",
|
||||
value: function _appendCharRaw(ch) {
|
||||
@@ -267,10 +319,14 @@ var MaskedPattern = /*#__PURE__*/function (_Masked) {
|
||||
if (!blockIter) return details;
|
||||
|
||||
for (var bi = blockIter.index;; ++bi) {
|
||||
var _flags$_beforeTailSta;
|
||||
|
||||
var _block = this._blocks[bi];
|
||||
if (!_block) break;
|
||||
|
||||
var blockDetails = _block._appendChar(ch, flags);
|
||||
var blockDetails = _block._appendChar(ch, Object.assign({}, flags, {
|
||||
_beforeTailState: (_flags$_beforeTailSta = flags._beforeTailState) === null || _flags$_beforeTailSta === void 0 ? void 0 : _flags$_beforeTailSta._blocks[bi]
|
||||
}));
|
||||
|
||||
var skip = blockDetails.skip;
|
||||
details.aggregate(blockDetails);
|
||||
@@ -449,220 +505,69 @@ var MaskedPattern = /*#__PURE__*/function (_Masked) {
|
||||
key: "nearestInputPos",
|
||||
value: function nearestInputPos(cursorPos) {
|
||||
var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DIRECTION.NONE;
|
||||
// TODO refactor - extract alignblock
|
||||
var beginBlockData = this._mapPosToBlock(cursorPos) || {
|
||||
index: 0,
|
||||
offset: 0
|
||||
};
|
||||
var beginBlockOffset = beginBlockData.offset,
|
||||
beginBlockIndex = beginBlockData.index;
|
||||
var beginBlock = this._blocks[beginBlockIndex];
|
||||
if (!beginBlock) return cursorPos;
|
||||
var beginBlockCursorPos = beginBlockOffset; // if position inside block - try to adjust it
|
||||
|
||||
if (beginBlockCursorPos !== 0 && beginBlockCursorPos < beginBlock.value.length) {
|
||||
beginBlockCursorPos = beginBlock.nearestInputPos(beginBlockOffset, forceDirection(direction));
|
||||
}
|
||||
|
||||
var cursorAtRight = beginBlockCursorPos === beginBlock.value.length;
|
||||
var cursorAtLeft = beginBlockCursorPos === 0; // cursor is INSIDE first block (not at bounds)
|
||||
|
||||
if (!cursorAtLeft && !cursorAtRight) return this._blockStartPos(beginBlockIndex) + beginBlockCursorPos;
|
||||
var searchBlockIndex = cursorAtRight ? beginBlockIndex + 1 : beginBlockIndex;
|
||||
if (!this._blocks.length) return 0;
|
||||
var cursor = new PatternCursor(this, cursorPos);
|
||||
|
||||
if (direction === DIRECTION.NONE) {
|
||||
// NONE direction used to calculate start input position if no chars were removed
|
||||
// FOR NONE:
|
||||
// -
|
||||
// input|any
|
||||
// ->
|
||||
// any|input
|
||||
// <-
|
||||
// filled-input|any
|
||||
// check if first block at left is input
|
||||
if (searchBlockIndex > 0) {
|
||||
var blockIndexAtLeft = searchBlockIndex - 1;
|
||||
var blockAtLeft = this._blocks[blockIndexAtLeft];
|
||||
var blockInputPos = blockAtLeft.nearestInputPos(0, DIRECTION.NONE); // is input
|
||||
// -------------------------------------------------
|
||||
// NONE should only go out from fixed to the right!
|
||||
// -------------------------------------------------
|
||||
if (cursor.pushRightBeforeInput()) return cursor.pos;
|
||||
cursor.popState();
|
||||
if (cursor.pushLeftBeforeInput()) return cursor.pos;
|
||||
return this.value.length;
|
||||
} // FORCE is only about a|* otherwise is 0
|
||||
|
||||
if (!blockAtLeft.value.length || blockInputPos !== blockAtLeft.value.length) {
|
||||
return this._blockStartPos(searchBlockIndex);
|
||||
}
|
||||
} // ->
|
||||
|
||||
|
||||
var firstInputAtRight = searchBlockIndex;
|
||||
|
||||
for (var bi = firstInputAtRight; bi < this._blocks.length; ++bi) {
|
||||
var blockAtRight = this._blocks[bi];
|
||||
|
||||
var _blockInputPos = blockAtRight.nearestInputPos(0, DIRECTION.NONE);
|
||||
|
||||
if (!blockAtRight.value.length || _blockInputPos !== blockAtRight.value.length) {
|
||||
return this._blockStartPos(bi) + _blockInputPos;
|
||||
}
|
||||
} // <-
|
||||
// find first non-fixed symbol
|
||||
|
||||
|
||||
for (var _bi = searchBlockIndex - 1; _bi >= 0; --_bi) {
|
||||
var _block3 = this._blocks[_bi];
|
||||
|
||||
var _blockInputPos2 = _block3.nearestInputPos(0, DIRECTION.NONE); // is input
|
||||
|
||||
|
||||
if (!_block3.value.length || _blockInputPos2 !== _block3.value.length) {
|
||||
return this._blockStartPos(_bi) + _block3.value.length;
|
||||
}
|
||||
}
|
||||
|
||||
return cursorPos;
|
||||
}
|
||||
|
||||
if (direction === DIRECTION.LEFT || direction === DIRECTION.FORCE_LEFT) {
|
||||
// -
|
||||
// any|filled-input
|
||||
// <-
|
||||
// any|first not empty is not-len-aligned
|
||||
// not-0-aligned|any
|
||||
// ->
|
||||
// any|not-len-aligned or end
|
||||
// check if first block at right is filled input
|
||||
var firstFilledBlockIndexAtRight;
|
||||
|
||||
for (var _bi2 = searchBlockIndex; _bi2 < this._blocks.length; ++_bi2) {
|
||||
if (this._blocks[_bi2].value) {
|
||||
firstFilledBlockIndexAtRight = _bi2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (firstFilledBlockIndexAtRight != null) {
|
||||
var filledBlock = this._blocks[firstFilledBlockIndexAtRight];
|
||||
|
||||
var _blockInputPos3 = filledBlock.nearestInputPos(0, DIRECTION.RIGHT);
|
||||
|
||||
if (_blockInputPos3 === 0 && filledBlock.unmaskedValue.length) {
|
||||
// filled block is input
|
||||
return this._blockStartPos(firstFilledBlockIndexAtRight) + _blockInputPos3;
|
||||
}
|
||||
} // <-
|
||||
// find this vars
|
||||
// try to break fast when *|a
|
||||
if (direction === DIRECTION.LEFT) {
|
||||
cursor.pushRightBeforeFilled();
|
||||
if (cursor.ok && cursor.pos === cursorPos) return cursorPos;
|
||||
cursor.popState();
|
||||
} // forward flow
|
||||
|
||||
|
||||
var firstFilledInputBlockIndex = -1;
|
||||
var firstEmptyInputBlockIndex; // TODO consider nested empty inputs
|
||||
|
||||
for (var _bi3 = searchBlockIndex - 1; _bi3 >= 0; --_bi3) {
|
||||
var _block4 = this._blocks[_bi3];
|
||||
|
||||
var _blockInputPos4 = _block4.nearestInputPos(_block4.value.length, DIRECTION.FORCE_LEFT);
|
||||
|
||||
if (!_block4.value || _blockInputPos4 !== 0) firstEmptyInputBlockIndex = _bi3;
|
||||
|
||||
if (_blockInputPos4 !== 0) {
|
||||
if (_blockInputPos4 !== _block4.value.length) {
|
||||
// aligned inside block - return immediately
|
||||
return this._blockStartPos(_bi3) + _blockInputPos4;
|
||||
} else {
|
||||
// found filled
|
||||
firstFilledInputBlockIndex = _bi3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
cursor.pushLeftBeforeInput();
|
||||
cursor.pushLeftBeforeRequired();
|
||||
cursor.pushLeftBeforeFilled(); // backward flow
|
||||
|
||||
if (direction === DIRECTION.LEFT) {
|
||||
// try find first empty input before start searching position only when not forced
|
||||
for (var _bi4 = firstFilledInputBlockIndex + 1; _bi4 <= Math.min(searchBlockIndex, this._blocks.length - 1); ++_bi4) {
|
||||
var _block5 = this._blocks[_bi4];
|
||||
|
||||
var _blockInputPos5 = _block5.nearestInputPos(0, DIRECTION.NONE);
|
||||
|
||||
var blockAlignedPos = this._blockStartPos(_bi4) + _blockInputPos5;
|
||||
|
||||
if (blockAlignedPos > cursorPos) break; // if block is not lazy input
|
||||
|
||||
if (_blockInputPos5 !== _block5.value.length) return blockAlignedPos;
|
||||
}
|
||||
} // process overflow
|
||||
|
||||
|
||||
if (firstFilledInputBlockIndex >= 0) {
|
||||
return this._blockStartPos(firstFilledInputBlockIndex) + this._blocks[firstFilledInputBlockIndex].value.length;
|
||||
} // for lazy if has aligned left inside fixed and has came to the start - use start position
|
||||
|
||||
|
||||
if (direction === DIRECTION.FORCE_LEFT || this.lazy && !this.extractInput() && !isInput(this._blocks[searchBlockIndex])) {
|
||||
return 0;
|
||||
cursor.pushRightBeforeInput();
|
||||
cursor.pushRightBeforeRequired();
|
||||
if (cursor.ok && cursor.pos <= cursorPos) return cursor.pos;
|
||||
cursor.popState();
|
||||
if (cursor.ok && cursor.pos <= cursorPos) return cursor.pos;
|
||||
cursor.popState();
|
||||
}
|
||||
|
||||
if (firstEmptyInputBlockIndex != null) {
|
||||
return this._blockStartPos(firstEmptyInputBlockIndex);
|
||||
} // find first input
|
||||
|
||||
|
||||
for (var _bi5 = searchBlockIndex; _bi5 < this._blocks.length; ++_bi5) {
|
||||
var _block6 = this._blocks[_bi5];
|
||||
|
||||
var _blockInputPos6 = _block6.nearestInputPos(0, DIRECTION.NONE); // is input
|
||||
|
||||
|
||||
if (!_block6.value.length || _blockInputPos6 !== _block6.value.length) {
|
||||
return this._blockStartPos(_bi5) + _blockInputPos6;
|
||||
}
|
||||
}
|
||||
if (cursor.ok) return cursor.pos;
|
||||
if (direction === DIRECTION.FORCE_LEFT) return 0;
|
||||
cursor.popState();
|
||||
if (cursor.ok) return cursor.pos;
|
||||
cursor.popState();
|
||||
if (cursor.ok) return cursor.pos; // cursor.popState();
|
||||
// if (
|
||||
// cursor.pushRightBeforeInput() &&
|
||||
// // TODO HACK for lazy if has aligned left inside fixed and has came to the start - use start position
|
||||
// (!this.lazy || this.extractInput())
|
||||
// ) return cursor.pos;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (direction === DIRECTION.RIGHT || direction === DIRECTION.FORCE_RIGHT) {
|
||||
// ->
|
||||
// any|not-len-aligned and filled
|
||||
// any|not-len-aligned
|
||||
// <-
|
||||
// not-0-aligned or start|any
|
||||
var firstInputBlockAlignedIndex;
|
||||
var firstInputBlockAlignedPos;
|
||||
// forward flow
|
||||
cursor.pushRightBeforeInput();
|
||||
cursor.pushRightBeforeRequired();
|
||||
if (cursor.pushRightBeforeFilled()) return cursor.pos;
|
||||
if (direction === DIRECTION.FORCE_RIGHT) return this.value.length; // backward flow
|
||||
|
||||
for (var _bi6 = searchBlockIndex; _bi6 < this._blocks.length; ++_bi6) {
|
||||
var _block7 = this._blocks[_bi6];
|
||||
|
||||
var _blockInputPos7 = _block7.nearestInputPos(0, DIRECTION.NONE);
|
||||
|
||||
if (_blockInputPos7 !== _block7.value.length) {
|
||||
firstInputBlockAlignedPos = this._blockStartPos(_bi6) + _blockInputPos7;
|
||||
firstInputBlockAlignedIndex = _bi6;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (firstInputBlockAlignedIndex != null && firstInputBlockAlignedPos != null) {
|
||||
for (var _bi7 = firstInputBlockAlignedIndex; _bi7 < this._blocks.length; ++_bi7) {
|
||||
var _block8 = this._blocks[_bi7];
|
||||
|
||||
var _blockInputPos8 = _block8.nearestInputPos(0, DIRECTION.FORCE_RIGHT);
|
||||
|
||||
if (_blockInputPos8 !== _block8.value.length) {
|
||||
return this._blockStartPos(_bi7) + _blockInputPos8;
|
||||
}
|
||||
}
|
||||
|
||||
return direction === DIRECTION.FORCE_RIGHT ? this.value.length : firstInputBlockAlignedPos;
|
||||
}
|
||||
|
||||
for (var _bi8 = Math.min(searchBlockIndex, this._blocks.length - 1); _bi8 >= 0; --_bi8) {
|
||||
var _block9 = this._blocks[_bi8];
|
||||
|
||||
var _blockInputPos9 = _block9.nearestInputPos(_block9.value.length, DIRECTION.LEFT);
|
||||
|
||||
if (_blockInputPos9 !== 0) {
|
||||
var alignedPos = this._blockStartPos(_bi8) + _blockInputPos9;
|
||||
|
||||
if (alignedPos >= cursorPos) return alignedPos;
|
||||
break;
|
||||
}
|
||||
}
|
||||
cursor.popState();
|
||||
if (cursor.ok) return cursor.pos;
|
||||
cursor.popState();
|
||||
if (cursor.ok) return cursor.pos;
|
||||
return this.nearestInputPos(cursorPos, DIRECTION.LEFT);
|
||||
}
|
||||
|
||||
return cursorPos;
|
||||
@@ -699,13 +604,6 @@ MaskedPattern.STOP_CHAR = '`';
|
||||
MaskedPattern.ESCAPE_CHAR = '\\';
|
||||
MaskedPattern.InputDefinition = PatternInputDefinition;
|
||||
MaskedPattern.FixedDefinition = PatternFixedDefinition;
|
||||
|
||||
function isInput(block) {
|
||||
if (!block) return false;
|
||||
var value = block.value;
|
||||
return !value || block.nearestInputPos(0, DIRECTION.NONE) !== value.length;
|
||||
}
|
||||
|
||||
IMask.MaskedPattern = MaskedPattern;
|
||||
|
||||
export { MaskedPattern as default };
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}]);
|
||||
|
||||
|
||||
3
dist/assets/vendor/imask/esm/masked/pipe.js
vendored
3
dist/assets/vendor/imask/esm/masked/pipe.js
vendored
@@ -1,7 +1,8 @@
|
||||
import createMask from './factory.js';
|
||||
import IMask from '../core/holder.js';
|
||||
import '../core/utils.js';
|
||||
import '../_rollupPluginBabelHelpers-a0b34764.js';
|
||||
import '../_rollupPluginBabelHelpers-b054ecd2.js';
|
||||
import '../core/change-details.js';
|
||||
|
||||
/** Mask pipe source and destination types */
|
||||
|
||||
|
||||
48
dist/assets/vendor/imask/esm/masked/range.js
vendored
48
dist/assets/vendor/imask/esm/masked/range.js
vendored
@@ -1,7 +1,7 @@
|
||||
import { d as _inherits, e as _createSuper, a as _classCallCheck, _ as _createClass, g as _get, h as _getPrototypeOf, f as _slicedToArray } from '../_rollupPluginBabelHelpers-a0b34764.js';
|
||||
import { d as _inherits, e as _createSuper, a as _classCallCheck, _ as _createClass, g as _get, h as _getPrototypeOf, f as _slicedToArray } from '../_rollupPluginBabelHelpers-b054ecd2.js';
|
||||
import MaskedPattern from './pattern.js';
|
||||
import { normalizePrepare } from '../core/utils.js';
|
||||
import IMask from '../core/holder.js';
|
||||
import '../core/utils.js';
|
||||
import '../core/change-details.js';
|
||||
import './base.js';
|
||||
import '../core/continuous-tail-details.js';
|
||||
@@ -9,6 +9,7 @@ import './pattern/input-definition.js';
|
||||
import './factory.js';
|
||||
import './pattern/fixed-definition.js';
|
||||
import './pattern/chunk-tail-details.js';
|
||||
import './pattern/cursor.js';
|
||||
import './regexp.js';
|
||||
|
||||
/** Pattern which accepts ranges */
|
||||
@@ -50,7 +51,8 @@ var MaskedRange = /*#__PURE__*/function (_MaskedPattern) {
|
||||
// TODO type
|
||||
opts = Object.assign({
|
||||
to: this.to || 0,
|
||||
from: this.from || 0
|
||||
from: this.from || 0,
|
||||
maxLength: this.maxLength || 0
|
||||
}, opts);
|
||||
var maxLength = String(opts.to).length;
|
||||
if (opts.maxLength != null) maxLength = Math.max(maxLength, opts.maxLength);
|
||||
@@ -95,34 +97,46 @@ var MaskedRange = /*#__PURE__*/function (_MaskedPattern) {
|
||||
minstr = minstr.padEnd(this.maxLength, '0');
|
||||
maxstr = maxstr.padEnd(this.maxLength, '9');
|
||||
return [minstr, maxstr];
|
||||
}
|
||||
} // TODO str is a single char everytime
|
||||
|
||||
/**
|
||||
@override
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "doPrepare",
|
||||
value: function doPrepare(str) {
|
||||
value: function doPrepare(ch) {
|
||||
var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
str = _get(_getPrototypeOf(MaskedRange.prototype), "doPrepare", this).call(this, str, flags).replace(/\D/g, '');
|
||||
if (!this.autofix) return str;
|
||||
var details;
|
||||
|
||||
var _normalizePrepare = normalizePrepare(_get(_getPrototypeOf(MaskedRange.prototype), "doPrepare", this).call(this, ch.replace(/\D/g, ''), flags));
|
||||
|
||||
var _normalizePrepare2 = _slicedToArray(_normalizePrepare, 2);
|
||||
|
||||
ch = _normalizePrepare2[0];
|
||||
details = _normalizePrepare2[1];
|
||||
if (!this.autofix || !ch) return ch;
|
||||
var fromStr = String(this.from).padStart(this.maxLength, '0');
|
||||
var toStr = String(this.to).padStart(this.maxLength, '0');
|
||||
var val = this.value;
|
||||
var prepStr = '';
|
||||
var nextVal = this.value + ch;
|
||||
if (nextVal.length > this.maxLength) return '';
|
||||
|
||||
for (var ci = 0; ci < str.length; ++ci) {
|
||||
var nextVal = val + prepStr + str[ci];
|
||||
var _this$boundaries = this.boundaries(nextVal),
|
||||
_this$boundaries2 = _slicedToArray(_this$boundaries, 2),
|
||||
minstr = _this$boundaries2[0],
|
||||
maxstr = _this$boundaries2[1];
|
||||
|
||||
var _this$boundaries = this.boundaries(nextVal),
|
||||
_this$boundaries2 = _slicedToArray(_this$boundaries, 2),
|
||||
minstr = _this$boundaries2[0],
|
||||
maxstr = _this$boundaries2[1];
|
||||
if (Number(maxstr) < this.from) return fromStr[nextVal.length - 1];
|
||||
|
||||
if (Number(maxstr) < this.from) prepStr += fromStr[nextVal.length - 1];else if (Number(minstr) > this.to) prepStr += toStr[nextVal.length - 1];else prepStr += str[ci];
|
||||
if (Number(minstr) > this.to) {
|
||||
if (this.autofix === 'pad' && nextVal.length < this.maxLength) {
|
||||
return ['', details.aggregate(this.append(fromStr[nextVal.length - 1] + ch, flags))];
|
||||
}
|
||||
|
||||
return toStr[nextVal.length - 1];
|
||||
}
|
||||
|
||||
return prepStr;
|
||||
return ch;
|
||||
}
|
||||
/**
|
||||
@override
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { d as _inherits, e as _createSuper, _ as _createClass, a as _classCallCheck, g as _get, h as _getPrototypeOf } from '../_rollupPluginBabelHelpers-a0b34764.js';
|
||||
import { d as _inherits, e as _createSuper, _ as _createClass, a as _classCallCheck, g as _get, h as _getPrototypeOf } from '../_rollupPluginBabelHelpers-b054ecd2.js';
|
||||
import Masked from './base.js';
|
||||
import IMask from '../core/holder.js';
|
||||
import '../core/change-details.js';
|
||||
|
||||
Reference in New Issue
Block a user