GULP DIST
This commit is contained in:
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
|
||||
|
||||
Reference in New Issue
Block a user