@tabler/core 1.0.0-beta5 → 1.0.0-beta9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/.DS_Store +0 -0
- package/dist/css/demo.css +373 -246
- package/dist/css/demo.min.css +5 -5
- package/dist/css/demo.rtl.css +373 -246
- package/dist/css/demo.rtl.min.css +5 -5
- package/dist/css/tabler-flags.css +531 -268
- package/dist/css/tabler-flags.min.css +5 -5
- package/dist/css/tabler-flags.rtl.css +531 -268
- package/dist/css/tabler-flags.rtl.min.css +5 -5
- package/dist/css/tabler-payments.css +255 -130
- package/dist/css/tabler-payments.min.css +5 -5
- package/dist/css/tabler-payments.rtl.css +255 -130
- package/dist/css/tabler-payments.rtl.min.css +5 -5
- package/dist/css/tabler-vendors.css +731 -409
- package/dist/css/tabler-vendors.min.css +5 -5
- package/dist/css/tabler-vendors.rtl.css +731 -409
- package/dist/css/tabler-vendors.rtl.min.css +5 -5
- package/dist/css/tabler.css +12600 -7027
- package/dist/css/tabler.min.css +6 -6
- package/dist/css/tabler.rtl.css +12616 -7044
- package/dist/css/tabler.rtl.min.css +6 -6
- package/dist/js/demo.js +7 -7
- package/dist/js/demo.min.js +5 -5
- package/dist/js/tabler.esm.js +614 -294
- package/dist/js/tabler.esm.min.js +5 -5
- package/dist/js/tabler.js +615 -295
- package/dist/js/tabler.min.js +5 -5
- package/dist/libs/apexcharts/dist/apexcharts.min.js +5 -5
- package/dist/libs/jsvectormap/dist/js/jsvectormap.min.js +1 -0
- package/dist/libs/jsvectormap/dist/maps/world-merc.js +1 -0
- package/dist/libs/jsvectormap/dist/maps/world.js +1 -0
- package/dist/libs/nouislider/dist/nouislider.min.js +1 -1
- package/dist/libs/tom-select/dist/js/tom-select.base.min.js +171 -169
- package/package.json +38 -36
- package/src/js/demo.js +4 -5
- package/src/js/src/tab.js +2 -0
- package/src/js/tabler.js +1 -3
- package/src/scss/_core.scss +2 -1
- package/src/scss/_utilities.scss +0 -21
- package/src/scss/_variables.scss +39 -22
- package/src/scss/demo/_highlight.scss +0 -1
- package/src/scss/demo.scss +2 -2
- package/src/scss/fonts/_webfonts.scss +56 -6
- package/src/scss/layout/_core.scss +33 -1
- package/src/scss/layout/_dark.scss +29 -4
- package/src/scss/layout/_navbar.scss +3 -1
- package/src/scss/layout/_page.scss +1 -1
- package/src/scss/mixins/_functions.scss +16 -2
- package/src/scss/mixins/_mixins.scss +6 -6
- package/src/scss/tabler-vendors.scss +1 -0
- package/src/scss/ui/_avatars.scss +1 -5
- package/src/scss/ui/_badges.scss +11 -9
- package/src/scss/ui/_breadcrumbs.scss +1 -3
- package/src/scss/ui/_buttons.scss +47 -11
- package/src/scss/ui/_cards.scss +153 -61
- package/src/scss/ui/_dropdowns.scss +1 -0
- package/src/scss/ui/_forms.scss +2 -2
- package/src/scss/ui/_grid.scss +14 -0
- package/src/scss/ui/_icons.scss +6 -0
- package/src/scss/ui/_lists.scss +25 -0
- package/src/scss/ui/_markdown.scss +1 -0
- package/src/scss/ui/_nav.scss +1 -4
- package/src/scss/ui/_placeholder.scss +9 -0
- package/src/scss/ui/_status.scss +172 -0
- package/src/scss/ui/_switch-icon.scss +1 -0
- package/src/scss/ui/_type.scss +1 -1
- package/src/scss/ui/forms/_form-custom.scss +12 -0
- package/src/scss/ui/forms/_validation.scss +1 -1
- package/src/scss/utils/_colors.scss +10 -37
- package/src/scss/vendor/_jsvectormap.scss +48 -0
- package/src/scss/vendor/_litepicker.scss +3 -1
- package/src/scss/ui/_skeleton.scss +0 -98
package/dist/js/tabler.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Tabler v1.0.0-
|
|
3
|
-
* @version 1.0.0-
|
|
2
|
+
* Tabler v1.0.0-beta9 (https://tabler.io)
|
|
3
|
+
* @version 1.0.0-beta9
|
|
4
4
|
* @link https://tabler.io
|
|
5
|
-
* Copyright 2018-
|
|
6
|
-
* Copyright 2018-
|
|
5
|
+
* Copyright 2018-2022 The Tabler Authors
|
|
6
|
+
* Copyright 2018-2022 codecalm.net Paweł Kuna
|
|
7
7
|
* Licensed under MIT (https://github.com/tabler/tabler/blob/master/LICENSE)
|
|
8
8
|
*/
|
|
9
9
|
var e,t,n="function"==typeof Map?new Map:(e=[],t=[],{has:function(t){return e.indexOf(t)>-1},get:function(n){return t[e.indexOf(n)]},set:function(n,o){-1===e.indexOf(n)&&(e.push(n),t.push(o));},delete:function(n){var o=e.indexOf(n);o>-1&&(e.splice(o,1),t.splice(o,1));}}),o=function(e){return new Event(e,{bubbles:!0})};try{new Event("test");}catch(e){o=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t};}function r(e){var t=n.get(e);t&&t.destroy();}function i(e){var t=n.get(e);t&&t.update();}var l=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?((l=function(e){return e}).destroy=function(e){return e},l.update=function(e){return e}):((l=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(e){return function(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!n.has(e)){var t,r=null,i=null,l=null,d=function(){e.clientWidth!==i&&c();},a=function(t){window.removeEventListener("resize",d,!1),e.removeEventListener("input",c,!1),e.removeEventListener("keyup",c,!1),e.removeEventListener("autosize:destroy",a,!1),e.removeEventListener("autosize:update",c,!1),Object.keys(t).forEach(function(n){e.style[n]=t[n];}),n.delete(e);}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",a,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",c,!1),window.addEventListener("resize",d,!1),e.addEventListener("input",c,!1),e.addEventListener("autosize:update",c,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",n.set(e,{destroy:a,update:c}),"vertical"===(t=window.getComputedStyle(e,null)).resize?e.style.resize="none":"both"===t.resize&&(e.style.resize="horizontal"),r="content-box"===t.boxSizing?-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),isNaN(r)&&(r=0),c();}function u(t){var n=e.style.width;e.style.width="0px",e.style.width=n,e.style.overflowY=t;}function s(){if(0!==e.scrollHeight){var t=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}(e),n=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+r+"px",i=e.clientWidth,t.forEach(function(e){e.node.scrollTop=e.scrollTop;}),n&&(document.documentElement.scrollTop=n);}}function c(){s();var t=Math.round(parseFloat(e.style.height)),n=window.getComputedStyle(e,null),r="content-box"===n.boxSizing?Math.round(parseFloat(n.height)):e.offsetHeight;if(r<t?"hidden"===n.overflowY&&(u("scroll"),s(),r="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight):"hidden"!==n.overflowY&&(u("hidden"),s(),r="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight),l!==r){l=r;var i=o("autosize:resized");try{e.dispatchEvent(i);}catch(e){}}}}(e)}),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],r),e},l.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],i),e});var d=l;
|
|
@@ -17,16 +17,11 @@ if (elements.length) {
|
|
|
17
17
|
|
|
18
18
|
function _typeof(obj) {
|
|
19
19
|
"@babel/helpers - typeof";
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
_typeof = function (obj) {
|
|
26
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
return _typeof(obj);
|
|
20
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
21
|
+
return typeof obj;
|
|
22
|
+
} : function (obj) {
|
|
23
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
24
|
+
}, _typeof(obj);
|
|
30
25
|
}
|
|
31
26
|
function _classCallCheck(instance, Constructor) {
|
|
32
27
|
if (!(instance instanceof Constructor)) {
|
|
@@ -45,6 +40,9 @@ function _defineProperties(target, props) {
|
|
|
45
40
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
46
41
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
47
42
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
43
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
44
|
+
writable: false
|
|
45
|
+
});
|
|
48
46
|
return Constructor;
|
|
49
47
|
}
|
|
50
48
|
function _defineProperty(obj, key, value) {
|
|
@@ -71,6 +69,9 @@ function _inherits(subClass, superClass) {
|
|
|
71
69
|
configurable: true
|
|
72
70
|
}
|
|
73
71
|
});
|
|
72
|
+
Object.defineProperty(subClass, "prototype", {
|
|
73
|
+
writable: false
|
|
74
|
+
});
|
|
74
75
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
75
76
|
}
|
|
76
77
|
function _getPrototypeOf(o) {
|
|
@@ -159,7 +160,7 @@ function _superPropBase(object, property) {
|
|
|
159
160
|
}
|
|
160
161
|
return object;
|
|
161
162
|
}
|
|
162
|
-
function _get(
|
|
163
|
+
function _get() {
|
|
163
164
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
164
165
|
_get = Reflect.get;
|
|
165
166
|
} else {
|
|
@@ -168,12 +169,12 @@ function _get(target, property, receiver) {
|
|
|
168
169
|
if (!base) return;
|
|
169
170
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
170
171
|
if (desc.get) {
|
|
171
|
-
return desc.get.call(receiver);
|
|
172
|
+
return desc.get.call(arguments.length < 3 ? target : receiver);
|
|
172
173
|
}
|
|
173
174
|
return desc.value;
|
|
174
175
|
};
|
|
175
176
|
}
|
|
176
|
-
return _get(
|
|
177
|
+
return _get.apply(this, arguments);
|
|
177
178
|
}
|
|
178
179
|
function set(target, property, value, receiver) {
|
|
179
180
|
if (typeof Reflect !== "undefined" && Reflect.set) {
|
|
@@ -260,6 +261,34 @@ function _nonIterableRest() {
|
|
|
260
261
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
261
262
|
}
|
|
262
263
|
|
|
264
|
+
var ChangeDetails = function () {
|
|
265
|
+
function ChangeDetails(details) {
|
|
266
|
+
_classCallCheck(this, ChangeDetails);
|
|
267
|
+
Object.assign(this, {
|
|
268
|
+
inserted: '',
|
|
269
|
+
rawInserted: '',
|
|
270
|
+
skip: false,
|
|
271
|
+
tailShift: 0
|
|
272
|
+
}, details);
|
|
273
|
+
}
|
|
274
|
+
_createClass(ChangeDetails, [{
|
|
275
|
+
key: "aggregate",
|
|
276
|
+
value: function aggregate(details) {
|
|
277
|
+
this.rawInserted += details.rawInserted;
|
|
278
|
+
this.skip = this.skip || details.skip;
|
|
279
|
+
this.inserted += details.inserted;
|
|
280
|
+
this.tailShift += details.tailShift;
|
|
281
|
+
return this;
|
|
282
|
+
}
|
|
283
|
+
}, {
|
|
284
|
+
key: "offset",
|
|
285
|
+
get: function get() {
|
|
286
|
+
return this.tailShift + this.inserted.length;
|
|
287
|
+
}
|
|
288
|
+
}]);
|
|
289
|
+
return ChangeDetails;
|
|
290
|
+
}();
|
|
291
|
+
|
|
263
292
|
function isString(str) {
|
|
264
293
|
return typeof str === 'string' || str instanceof String;
|
|
265
294
|
}
|
|
@@ -283,6 +312,9 @@ function forceDirection(direction) {
|
|
|
283
312
|
function escapeRegExp(str) {
|
|
284
313
|
return str.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
|
|
285
314
|
}
|
|
315
|
+
function normalizePrepare(prep) {
|
|
316
|
+
return Array.isArray(prep) ? prep : [prep, new ChangeDetails()];
|
|
317
|
+
}
|
|
286
318
|
function objectIncludes(b, a) {
|
|
287
319
|
if (a === b) return true;
|
|
288
320
|
var arrA = Array.isArray(a),
|
|
@@ -370,40 +402,13 @@ var ActionDetails = function () {
|
|
|
370
402
|
key: "removeDirection",
|
|
371
403
|
get: function get() {
|
|
372
404
|
if (!this.removedCount || this.insertedCount) return DIRECTION.NONE;
|
|
373
|
-
return this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos
|
|
405
|
+
return (this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos) &&
|
|
406
|
+
this.oldSelection.end === this.oldSelection.start ? DIRECTION.RIGHT : DIRECTION.LEFT;
|
|
374
407
|
}
|
|
375
408
|
}]);
|
|
376
409
|
return ActionDetails;
|
|
377
410
|
}();
|
|
378
411
|
|
|
379
|
-
var ChangeDetails = function () {
|
|
380
|
-
function ChangeDetails(details) {
|
|
381
|
-
_classCallCheck(this, ChangeDetails);
|
|
382
|
-
Object.assign(this, {
|
|
383
|
-
inserted: '',
|
|
384
|
-
rawInserted: '',
|
|
385
|
-
skip: false,
|
|
386
|
-
tailShift: 0
|
|
387
|
-
}, details);
|
|
388
|
-
}
|
|
389
|
-
_createClass(ChangeDetails, [{
|
|
390
|
-
key: "aggregate",
|
|
391
|
-
value: function aggregate(details) {
|
|
392
|
-
this.rawInserted += details.rawInserted;
|
|
393
|
-
this.skip = this.skip || details.skip;
|
|
394
|
-
this.inserted += details.inserted;
|
|
395
|
-
this.tailShift += details.tailShift;
|
|
396
|
-
return this;
|
|
397
|
-
}
|
|
398
|
-
}, {
|
|
399
|
-
key: "offset",
|
|
400
|
-
get: function get() {
|
|
401
|
-
return this.tailShift + this.inserted.length;
|
|
402
|
-
}
|
|
403
|
-
}]);
|
|
404
|
-
return ChangeDetails;
|
|
405
|
-
}();
|
|
406
|
-
|
|
407
412
|
var ContinuousTailDetails = function () {
|
|
408
413
|
function ContinuousTailDetails() {
|
|
409
414
|
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
@@ -444,13 +449,21 @@ var ContinuousTailDetails = function () {
|
|
|
444
449
|
Object.assign(this, state);
|
|
445
450
|
}
|
|
446
451
|
}, {
|
|
447
|
-
key: "
|
|
448
|
-
value: function
|
|
449
|
-
if (this.
|
|
452
|
+
key: "unshift",
|
|
453
|
+
value: function unshift(beforePos) {
|
|
454
|
+
if (!this.value.length || beforePos != null && this.from >= beforePos) return '';
|
|
450
455
|
var shiftChar = this.value[0];
|
|
451
456
|
this.value = this.value.slice(1);
|
|
452
457
|
return shiftChar;
|
|
453
458
|
}
|
|
459
|
+
}, {
|
|
460
|
+
key: "shift",
|
|
461
|
+
value: function shift() {
|
|
462
|
+
if (!this.value.length) return '';
|
|
463
|
+
var shiftChar = this.value[this.value.length - 1];
|
|
464
|
+
this.value = this.value.slice(0, -1);
|
|
465
|
+
return shiftChar;
|
|
466
|
+
}
|
|
454
467
|
}]);
|
|
455
468
|
return ContinuousTailDetails;
|
|
456
469
|
}();
|
|
@@ -548,6 +561,11 @@ var Masked = function () {
|
|
|
548
561
|
get: function get() {
|
|
549
562
|
return true;
|
|
550
563
|
}
|
|
564
|
+
}, {
|
|
565
|
+
key: "isFilled",
|
|
566
|
+
get: function get() {
|
|
567
|
+
return this.isComplete;
|
|
568
|
+
}
|
|
551
569
|
}, {
|
|
552
570
|
key: "nearestInputPos",
|
|
553
571
|
value: function nearestInputPos(cursorPos, direction) {
|
|
@@ -589,18 +607,30 @@ var Masked = function () {
|
|
|
589
607
|
var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
590
608
|
var checkTail = arguments.length > 2 ? arguments[2] : undefined;
|
|
591
609
|
var consistentState = this.state;
|
|
592
|
-
var details
|
|
610
|
+
var details;
|
|
611
|
+
var _normalizePrepare = normalizePrepare(this.doPrepare(ch, flags));
|
|
612
|
+
var _normalizePrepare2 = _slicedToArray(_normalizePrepare, 2);
|
|
613
|
+
ch = _normalizePrepare2[0];
|
|
614
|
+
details = _normalizePrepare2[1];
|
|
615
|
+
details = details.aggregate(this._appendCharRaw(ch, flags));
|
|
593
616
|
if (details.inserted) {
|
|
594
617
|
var consistentTail;
|
|
595
618
|
var appended = this.doValidate(flags) !== false;
|
|
596
619
|
if (appended && checkTail != null) {
|
|
597
620
|
var beforeTailState = this.state;
|
|
598
|
-
if (this.overwrite) {
|
|
621
|
+
if (this.overwrite === true) {
|
|
599
622
|
consistentTail = checkTail.state;
|
|
600
|
-
checkTail.
|
|
623
|
+
checkTail.unshift(this.value.length);
|
|
601
624
|
}
|
|
602
625
|
var tailDetails = this.appendTail(checkTail);
|
|
603
626
|
appended = tailDetails.rawInserted === checkTail.toString();
|
|
627
|
+
if (!(appended && tailDetails.inserted) && this.overwrite === 'shift') {
|
|
628
|
+
this.state = beforeTailState;
|
|
629
|
+
consistentTail = checkTail.state;
|
|
630
|
+
checkTail.shift();
|
|
631
|
+
tailDetails = this.appendTail(checkTail);
|
|
632
|
+
appended = tailDetails.rawInserted === checkTail.toString();
|
|
633
|
+
}
|
|
604
634
|
if (appended && tailDetails.inserted) this.state = beforeTailState;
|
|
605
635
|
}
|
|
606
636
|
if (!appended) {
|
|
@@ -616,6 +646,11 @@ var Masked = function () {
|
|
|
616
646
|
value: function _appendPlaceholder() {
|
|
617
647
|
return new ChangeDetails();
|
|
618
648
|
}
|
|
649
|
+
}, {
|
|
650
|
+
key: "_appendEager",
|
|
651
|
+
value: function _appendEager() {
|
|
652
|
+
return new ChangeDetails();
|
|
653
|
+
}
|
|
619
654
|
}, {
|
|
620
655
|
key: "append",
|
|
621
656
|
value: function append(str, flags, tail) {
|
|
@@ -629,6 +664,9 @@ var Masked = function () {
|
|
|
629
664
|
if (checkTail != null) {
|
|
630
665
|
details.tailShift += this.appendTail(checkTail).tailShift;
|
|
631
666
|
}
|
|
667
|
+
if (this.eager && flags !== null && flags !== void 0 && flags.input && str) {
|
|
668
|
+
details.aggregate(this._appendEager());
|
|
669
|
+
}
|
|
632
670
|
return details;
|
|
633
671
|
}
|
|
634
672
|
}, {
|
|
@@ -696,13 +734,37 @@ var Masked = function () {
|
|
|
696
734
|
value: function splice(start, deleteCount, inserted, removeDirection) {
|
|
697
735
|
var tailPos = start + deleteCount;
|
|
698
736
|
var tail = this.extractTail(tailPos);
|
|
699
|
-
var
|
|
700
|
-
|
|
737
|
+
var oldRawValue;
|
|
738
|
+
if (this.eager) {
|
|
739
|
+
removeDirection = forceDirection(removeDirection);
|
|
740
|
+
oldRawValue = this.extractInput(0, tailPos, {
|
|
741
|
+
raw: true
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
var startChangePos = this.nearestInputPos(start, deleteCount > 1 && start !== 0 && !this.eager ? DIRECTION.NONE : removeDirection);
|
|
745
|
+
var details = new ChangeDetails({
|
|
701
746
|
tailShift: startChangePos - start
|
|
702
|
-
}).aggregate(this.remove(startChangePos))
|
|
747
|
+
}).aggregate(this.remove(startChangePos));
|
|
748
|
+
if (this.eager && removeDirection !== DIRECTION.NONE && oldRawValue === this.rawInputValue) {
|
|
749
|
+
if (removeDirection === DIRECTION.FORCE_LEFT) {
|
|
750
|
+
var valLength;
|
|
751
|
+
while (oldRawValue === this.rawInputValue && (valLength = this.value.length)) {
|
|
752
|
+
details.aggregate(new ChangeDetails({
|
|
753
|
+
tailShift: -1
|
|
754
|
+
})).aggregate(this.remove(valLength - 1));
|
|
755
|
+
}
|
|
756
|
+
} else if (removeDirection === DIRECTION.FORCE_RIGHT) {
|
|
757
|
+
tail.unshift();
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
return details.aggregate(this.append(inserted, {
|
|
703
761
|
input: true
|
|
704
762
|
}, tail));
|
|
705
|
-
|
|
763
|
+
}
|
|
764
|
+
}, {
|
|
765
|
+
key: "maskEquals",
|
|
766
|
+
value: function maskEquals(mask) {
|
|
767
|
+
return this.mask === mask;
|
|
706
768
|
}
|
|
707
769
|
}]);
|
|
708
770
|
return Masked;
|
|
@@ -727,8 +789,8 @@ function maskedClass(mask) {
|
|
|
727
789
|
if (mask instanceof Number || typeof mask === 'number' || mask === Number) return IMask.MaskedNumber;
|
|
728
790
|
if (Array.isArray(mask) || mask === Array) return IMask.MaskedDynamic;
|
|
729
791
|
if (IMask.Masked && mask.prototype instanceof IMask.Masked) return mask;
|
|
730
|
-
if (mask instanceof Function) return IMask.MaskedFunction;
|
|
731
792
|
if (mask instanceof IMask.Masked) return mask.constructor;
|
|
793
|
+
if (mask instanceof Function) return IMask.MaskedFunction;
|
|
732
794
|
console.warn('Mask not found for mask', mask);
|
|
733
795
|
return IMask.Masked;
|
|
734
796
|
}
|
|
@@ -762,7 +824,7 @@ var PatternInputDefinition = function () {
|
|
|
762
824
|
_createClass(PatternInputDefinition, [{
|
|
763
825
|
key: "reset",
|
|
764
826
|
value: function reset() {
|
|
765
|
-
this.
|
|
827
|
+
this.isFilled = false;
|
|
766
828
|
this.masked.reset();
|
|
767
829
|
}
|
|
768
830
|
}, {
|
|
@@ -771,7 +833,7 @@ var PatternInputDefinition = function () {
|
|
|
771
833
|
var fromPos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
772
834
|
var toPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.value.length;
|
|
773
835
|
if (fromPos === 0 && toPos >= 1) {
|
|
774
|
-
this.
|
|
836
|
+
this.isFilled = false;
|
|
775
837
|
return this.masked.remove(fromPos, toPos);
|
|
776
838
|
}
|
|
777
839
|
return new ChangeDetails();
|
|
@@ -779,7 +841,7 @@ var PatternInputDefinition = function () {
|
|
|
779
841
|
}, {
|
|
780
842
|
key: "value",
|
|
781
843
|
get: function get() {
|
|
782
|
-
return this.masked.value || (this.
|
|
844
|
+
return this.masked.value || (this.isFilled && !this.isOptional ? this.placeholderChar : '');
|
|
783
845
|
}
|
|
784
846
|
}, {
|
|
785
847
|
key: "unmaskedValue",
|
|
@@ -793,11 +855,11 @@ var PatternInputDefinition = function () {
|
|
|
793
855
|
}
|
|
794
856
|
}, {
|
|
795
857
|
key: "_appendChar",
|
|
796
|
-
value: function _appendChar(
|
|
858
|
+
value: function _appendChar(ch) {
|
|
797
859
|
var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
798
|
-
if (this.
|
|
860
|
+
if (this.isFilled) return new ChangeDetails();
|
|
799
861
|
var state = this.masked.state;
|
|
800
|
-
var details = this.masked._appendChar(
|
|
862
|
+
var details = this.masked._appendChar(ch, flags);
|
|
801
863
|
if (details.inserted && this.doValidate(flags) === false) {
|
|
802
864
|
details.inserted = details.rawInserted = '';
|
|
803
865
|
this.masked.state = state;
|
|
@@ -806,7 +868,7 @@ var PatternInputDefinition = function () {
|
|
|
806
868
|
details.inserted = this.placeholderChar;
|
|
807
869
|
}
|
|
808
870
|
details.skip = !details.inserted && !this.isOptional;
|
|
809
|
-
this.
|
|
871
|
+
this.isFilled = Boolean(details.inserted);
|
|
810
872
|
return details;
|
|
811
873
|
}
|
|
812
874
|
}, {
|
|
@@ -819,11 +881,16 @@ var PatternInputDefinition = function () {
|
|
|
819
881
|
key: "_appendPlaceholder",
|
|
820
882
|
value: function _appendPlaceholder() {
|
|
821
883
|
var details = new ChangeDetails();
|
|
822
|
-
if (this.
|
|
823
|
-
this.
|
|
884
|
+
if (this.isFilled || this.isOptional) return details;
|
|
885
|
+
this.isFilled = true;
|
|
824
886
|
details.inserted = this.placeholderChar;
|
|
825
887
|
return details;
|
|
826
888
|
}
|
|
889
|
+
}, {
|
|
890
|
+
key: "_appendEager",
|
|
891
|
+
value: function _appendEager() {
|
|
892
|
+
return new ChangeDetails();
|
|
893
|
+
}
|
|
827
894
|
}, {
|
|
828
895
|
key: "extractTail",
|
|
829
896
|
value: function extractTail() {
|
|
@@ -879,12 +946,12 @@ var PatternInputDefinition = function () {
|
|
|
879
946
|
get: function get() {
|
|
880
947
|
return {
|
|
881
948
|
masked: this.masked.state,
|
|
882
|
-
|
|
949
|
+
isFilled: this.isFilled
|
|
883
950
|
};
|
|
884
951
|
},
|
|
885
952
|
set: function set(state) {
|
|
886
953
|
this.masked.state = state.masked;
|
|
887
|
-
this.
|
|
954
|
+
this.isFilled = state.isFilled;
|
|
888
955
|
}
|
|
889
956
|
}]);
|
|
890
957
|
return PatternInputDefinition;
|
|
@@ -895,6 +962,7 @@ var PatternFixedDefinition = function () {
|
|
|
895
962
|
_classCallCheck(this, PatternFixedDefinition);
|
|
896
963
|
Object.assign(this, opts);
|
|
897
964
|
this._value = '';
|
|
965
|
+
this.isFixed = true;
|
|
898
966
|
}
|
|
899
967
|
_createClass(PatternFixedDefinition, [{
|
|
900
968
|
key: "value",
|
|
@@ -951,19 +1019,29 @@ var PatternFixedDefinition = function () {
|
|
|
951
1019
|
get: function get() {
|
|
952
1020
|
return true;
|
|
953
1021
|
}
|
|
1022
|
+
}, {
|
|
1023
|
+
key: "isFilled",
|
|
1024
|
+
get: function get() {
|
|
1025
|
+
return Boolean(this._value);
|
|
1026
|
+
}
|
|
954
1027
|
}, {
|
|
955
1028
|
key: "_appendChar",
|
|
956
|
-
value: function _appendChar(
|
|
1029
|
+
value: function _appendChar(ch) {
|
|
957
1030
|
var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
958
1031
|
var details = new ChangeDetails();
|
|
959
1032
|
if (this._value) return details;
|
|
960
|
-
var appended = this.char ===
|
|
961
|
-
var isResolved = appended && (this.isUnmasking || flags.input || flags.raw) && !flags.tail;
|
|
1033
|
+
var appended = this.char === ch;
|
|
1034
|
+
var isResolved = appended && (this.isUnmasking || flags.input || flags.raw) && !this.eager && !flags.tail;
|
|
962
1035
|
if (isResolved) details.rawInserted = this.char;
|
|
963
1036
|
this._value = details.inserted = this.char;
|
|
964
1037
|
this._isRawInput = isResolved && (flags.raw || flags.input);
|
|
965
1038
|
return details;
|
|
966
1039
|
}
|
|
1040
|
+
}, {
|
|
1041
|
+
key: "_appendEager",
|
|
1042
|
+
value: function _appendEager() {
|
|
1043
|
+
return this._appendChar(this.char);
|
|
1044
|
+
}
|
|
967
1045
|
}, {
|
|
968
1046
|
key: "_appendPlaceholder",
|
|
969
1047
|
value: function _appendPlaceholder() {
|
|
@@ -987,7 +1065,7 @@ var PatternFixedDefinition = function () {
|
|
|
987
1065
|
}, {
|
|
988
1066
|
key: "append",
|
|
989
1067
|
value: function append(str, flags, tail) {
|
|
990
|
-
var details = this._appendChar(str, flags);
|
|
1068
|
+
var details = this._appendChar(str[0], flags);
|
|
991
1069
|
if (tail != null) {
|
|
992
1070
|
details.tailShift += this.appendTail(tail).tailShift;
|
|
993
1071
|
}
|
|
@@ -1031,7 +1109,8 @@ var ChunksTailDetails = function () {
|
|
|
1031
1109
|
if (!String(tailChunk)) return;
|
|
1032
1110
|
if (isString(tailChunk)) tailChunk = new ContinuousTailDetails(String(tailChunk));
|
|
1033
1111
|
var lastChunk = this.chunks[this.chunks.length - 1];
|
|
1034
|
-
var extendLast = lastChunk && (
|
|
1112
|
+
var extendLast = lastChunk && (
|
|
1113
|
+
lastChunk.stop === tailChunk.stop || tailChunk.stop == null) &&
|
|
1035
1114
|
tailChunk.from === lastChunk.from + lastChunk.toString().length;
|
|
1036
1115
|
if (tailChunk instanceof ContinuousTailDetails) {
|
|
1037
1116
|
if (extendLast) {
|
|
@@ -1067,7 +1146,8 @@ var ChunksTailDetails = function () {
|
|
|
1067
1146
|
var lastBlockIter = masked._mapPosToBlock(masked.value.length);
|
|
1068
1147
|
var stop = chunk.stop;
|
|
1069
1148
|
var chunkBlock = void 0;
|
|
1070
|
-
if (stop != null && (
|
|
1149
|
+
if (stop != null && (
|
|
1150
|
+
!lastBlockIter || lastBlockIter.index <= stop)) {
|
|
1071
1151
|
if (chunk instanceof ChunksTailDetails ||
|
|
1072
1152
|
masked._stops.indexOf(stop) >= 0) {
|
|
1073
1153
|
details.aggregate(masked._appendPlaceholder(stop));
|
|
@@ -1114,14 +1194,14 @@ var ChunksTailDetails = function () {
|
|
|
1114
1194
|
});
|
|
1115
1195
|
}
|
|
1116
1196
|
}, {
|
|
1117
|
-
key: "
|
|
1118
|
-
value: function
|
|
1119
|
-
if (this.
|
|
1120
|
-
var chunkShiftPos =
|
|
1197
|
+
key: "unshift",
|
|
1198
|
+
value: function unshift(beforePos) {
|
|
1199
|
+
if (!this.chunks.length || beforePos != null && this.from >= beforePos) return '';
|
|
1200
|
+
var chunkShiftPos = beforePos != null ? beforePos - this.from : beforePos;
|
|
1121
1201
|
var ci = 0;
|
|
1122
1202
|
while (ci < this.chunks.length) {
|
|
1123
1203
|
var chunk = this.chunks[ci];
|
|
1124
|
-
var shiftChar = chunk.
|
|
1204
|
+
var shiftChar = chunk.unshift(chunkShiftPos);
|
|
1125
1205
|
if (chunk.toString()) {
|
|
1126
1206
|
if (!shiftChar) break;
|
|
1127
1207
|
++ci;
|
|
@@ -1132,10 +1212,178 @@ var ChunksTailDetails = function () {
|
|
|
1132
1212
|
}
|
|
1133
1213
|
return '';
|
|
1134
1214
|
}
|
|
1215
|
+
}, {
|
|
1216
|
+
key: "shift",
|
|
1217
|
+
value: function shift() {
|
|
1218
|
+
if (!this.chunks.length) return '';
|
|
1219
|
+
var ci = this.chunks.length - 1;
|
|
1220
|
+
while (0 <= ci) {
|
|
1221
|
+
var chunk = this.chunks[ci];
|
|
1222
|
+
var shiftChar = chunk.shift();
|
|
1223
|
+
if (chunk.toString()) {
|
|
1224
|
+
if (!shiftChar) break;
|
|
1225
|
+
--ci;
|
|
1226
|
+
} else {
|
|
1227
|
+
this.chunks.splice(ci, 1);
|
|
1228
|
+
}
|
|
1229
|
+
if (shiftChar) return shiftChar;
|
|
1230
|
+
}
|
|
1231
|
+
return '';
|
|
1232
|
+
}
|
|
1135
1233
|
}]);
|
|
1136
1234
|
return ChunksTailDetails;
|
|
1137
1235
|
}();
|
|
1138
1236
|
|
|
1237
|
+
var PatternCursor = function () {
|
|
1238
|
+
function PatternCursor(masked, pos) {
|
|
1239
|
+
_classCallCheck(this, PatternCursor);
|
|
1240
|
+
this.masked = masked;
|
|
1241
|
+
this._log = [];
|
|
1242
|
+
var _ref = masked._mapPosToBlock(pos) || (pos < 0 ?
|
|
1243
|
+
{
|
|
1244
|
+
index: 0,
|
|
1245
|
+
offset: 0
|
|
1246
|
+
} :
|
|
1247
|
+
{
|
|
1248
|
+
index: this.masked._blocks.length,
|
|
1249
|
+
offset: 0
|
|
1250
|
+
}),
|
|
1251
|
+
offset = _ref.offset,
|
|
1252
|
+
index = _ref.index;
|
|
1253
|
+
this.offset = offset;
|
|
1254
|
+
this.index = index;
|
|
1255
|
+
this.ok = false;
|
|
1256
|
+
}
|
|
1257
|
+
_createClass(PatternCursor, [{
|
|
1258
|
+
key: "block",
|
|
1259
|
+
get: function get() {
|
|
1260
|
+
return this.masked._blocks[this.index];
|
|
1261
|
+
}
|
|
1262
|
+
}, {
|
|
1263
|
+
key: "pos",
|
|
1264
|
+
get: function get() {
|
|
1265
|
+
return this.masked._blockStartPos(this.index) + this.offset;
|
|
1266
|
+
}
|
|
1267
|
+
}, {
|
|
1268
|
+
key: "state",
|
|
1269
|
+
get: function get() {
|
|
1270
|
+
return {
|
|
1271
|
+
index: this.index,
|
|
1272
|
+
offset: this.offset,
|
|
1273
|
+
ok: this.ok
|
|
1274
|
+
};
|
|
1275
|
+
},
|
|
1276
|
+
set: function set(s) {
|
|
1277
|
+
Object.assign(this, s);
|
|
1278
|
+
}
|
|
1279
|
+
}, {
|
|
1280
|
+
key: "pushState",
|
|
1281
|
+
value: function pushState() {
|
|
1282
|
+
this._log.push(this.state);
|
|
1283
|
+
}
|
|
1284
|
+
}, {
|
|
1285
|
+
key: "popState",
|
|
1286
|
+
value: function popState() {
|
|
1287
|
+
var s = this._log.pop();
|
|
1288
|
+
this.state = s;
|
|
1289
|
+
return s;
|
|
1290
|
+
}
|
|
1291
|
+
}, {
|
|
1292
|
+
key: "bindBlock",
|
|
1293
|
+
value: function bindBlock() {
|
|
1294
|
+
if (this.block) return;
|
|
1295
|
+
if (this.index < 0) {
|
|
1296
|
+
this.index = 0;
|
|
1297
|
+
this.offset = 0;
|
|
1298
|
+
}
|
|
1299
|
+
if (this.index >= this.masked._blocks.length) {
|
|
1300
|
+
this.index = this.masked._blocks.length - 1;
|
|
1301
|
+
this.offset = this.block.value.length;
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
}, {
|
|
1305
|
+
key: "_pushLeft",
|
|
1306
|
+
value: function _pushLeft(fn) {
|
|
1307
|
+
this.pushState();
|
|
1308
|
+
for (this.bindBlock(); 0 <= this.index; --this.index, this.offset = ((_this$block = this.block) === null || _this$block === void 0 ? void 0 : _this$block.value.length) || 0) {
|
|
1309
|
+
var _this$block;
|
|
1310
|
+
if (fn()) return this.ok = true;
|
|
1311
|
+
}
|
|
1312
|
+
return this.ok = false;
|
|
1313
|
+
}
|
|
1314
|
+
}, {
|
|
1315
|
+
key: "_pushRight",
|
|
1316
|
+
value: function _pushRight(fn) {
|
|
1317
|
+
this.pushState();
|
|
1318
|
+
for (this.bindBlock(); this.index < this.masked._blocks.length; ++this.index, this.offset = 0) {
|
|
1319
|
+
if (fn()) return this.ok = true;
|
|
1320
|
+
}
|
|
1321
|
+
return this.ok = false;
|
|
1322
|
+
}
|
|
1323
|
+
}, {
|
|
1324
|
+
key: "pushLeftBeforeFilled",
|
|
1325
|
+
value: function pushLeftBeforeFilled() {
|
|
1326
|
+
var _this = this;
|
|
1327
|
+
return this._pushLeft(function () {
|
|
1328
|
+
if (_this.block.isFixed || !_this.block.value) return;
|
|
1329
|
+
_this.offset = _this.block.nearestInputPos(_this.offset, DIRECTION.FORCE_LEFT);
|
|
1330
|
+
if (_this.offset !== 0) return true;
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
}, {
|
|
1334
|
+
key: "pushLeftBeforeInput",
|
|
1335
|
+
value: function pushLeftBeforeInput() {
|
|
1336
|
+
var _this2 = this;
|
|
1337
|
+
return this._pushLeft(function () {
|
|
1338
|
+
if (_this2.block.isFixed) return;
|
|
1339
|
+
_this2.offset = _this2.block.nearestInputPos(_this2.offset, DIRECTION.LEFT);
|
|
1340
|
+
return true;
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
}, {
|
|
1344
|
+
key: "pushLeftBeforeRequired",
|
|
1345
|
+
value: function pushLeftBeforeRequired() {
|
|
1346
|
+
var _this3 = this;
|
|
1347
|
+
return this._pushLeft(function () {
|
|
1348
|
+
if (_this3.block.isFixed || _this3.block.isOptional && !_this3.block.value) return;
|
|
1349
|
+
_this3.offset = _this3.block.nearestInputPos(_this3.offset, DIRECTION.LEFT);
|
|
1350
|
+
return true;
|
|
1351
|
+
});
|
|
1352
|
+
}
|
|
1353
|
+
}, {
|
|
1354
|
+
key: "pushRightBeforeFilled",
|
|
1355
|
+
value: function pushRightBeforeFilled() {
|
|
1356
|
+
var _this4 = this;
|
|
1357
|
+
return this._pushRight(function () {
|
|
1358
|
+
if (_this4.block.isFixed || !_this4.block.value) return;
|
|
1359
|
+
_this4.offset = _this4.block.nearestInputPos(_this4.offset, DIRECTION.FORCE_RIGHT);
|
|
1360
|
+
if (_this4.offset !== _this4.block.value.length) return true;
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
}, {
|
|
1364
|
+
key: "pushRightBeforeInput",
|
|
1365
|
+
value: function pushRightBeforeInput() {
|
|
1366
|
+
var _this5 = this;
|
|
1367
|
+
return this._pushRight(function () {
|
|
1368
|
+
if (_this5.block.isFixed) return;
|
|
1369
|
+
_this5.offset = _this5.block.nearestInputPos(_this5.offset, DIRECTION.NONE);
|
|
1370
|
+
return true;
|
|
1371
|
+
});
|
|
1372
|
+
}
|
|
1373
|
+
}, {
|
|
1374
|
+
key: "pushRightBeforeRequired",
|
|
1375
|
+
value: function pushRightBeforeRequired() {
|
|
1376
|
+
var _this6 = this;
|
|
1377
|
+
return this._pushRight(function () {
|
|
1378
|
+
if (_this6.block.isFixed || _this6.block.isOptional && !_this6.block.value) return;
|
|
1379
|
+
_this6.offset = _this6.block.nearestInputPos(_this6.offset, DIRECTION.NONE);
|
|
1380
|
+
return true;
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
}]);
|
|
1384
|
+
return PatternCursor;
|
|
1385
|
+
}();
|
|
1386
|
+
|
|
1139
1387
|
var MaskedRegExp = function (_Masked) {
|
|
1140
1388
|
_inherits(MaskedRegExp, _Masked);
|
|
1141
1389
|
var _super = _createSuper(MaskedRegExp);
|
|
@@ -1202,6 +1450,7 @@ var MaskedPattern = function (_Masked) {
|
|
|
1202
1450
|
var maskedBlock = createMask(Object.assign({
|
|
1203
1451
|
parent: _this,
|
|
1204
1452
|
lazy: _this.lazy,
|
|
1453
|
+
eager: _this.eager,
|
|
1205
1454
|
placeholderChar: _this.placeholderChar,
|
|
1206
1455
|
overwrite: _this.overwrite
|
|
1207
1456
|
}, _this.blocks[bName]));
|
|
@@ -1217,7 +1466,7 @@ var MaskedPattern = function (_Masked) {
|
|
|
1217
1466
|
if (_ret === "continue") continue;
|
|
1218
1467
|
}
|
|
1219
1468
|
var char = pattern[i];
|
|
1220
|
-
var
|
|
1469
|
+
var isInput = (char in defs);
|
|
1221
1470
|
if (char === MaskedPattern.STOP_CHAR) {
|
|
1222
1471
|
this._stops.push(this._blocks.length);
|
|
1223
1472
|
continue;
|
|
@@ -1234,16 +1483,18 @@ var MaskedPattern = function (_Masked) {
|
|
|
1234
1483
|
++i;
|
|
1235
1484
|
char = pattern[i];
|
|
1236
1485
|
if (!char) break;
|
|
1237
|
-
|
|
1486
|
+
isInput = false;
|
|
1238
1487
|
}
|
|
1239
|
-
var def =
|
|
1488
|
+
var def = isInput ? new PatternInputDefinition({
|
|
1240
1489
|
parent: this,
|
|
1241
1490
|
lazy: this.lazy,
|
|
1491
|
+
eager: this.eager,
|
|
1242
1492
|
placeholderChar: this.placeholderChar,
|
|
1243
1493
|
mask: defs[char],
|
|
1244
1494
|
isOptional: optionalBlock
|
|
1245
1495
|
}) : new PatternFixedDefinition({
|
|
1246
1496
|
char: char,
|
|
1497
|
+
eager: this.eager,
|
|
1247
1498
|
isUnmasking: unmaskingBlock
|
|
1248
1499
|
});
|
|
1249
1500
|
this._blocks.push(def);
|
|
@@ -1281,6 +1532,27 @@ var MaskedPattern = function (_Masked) {
|
|
|
1281
1532
|
return b.isComplete;
|
|
1282
1533
|
});
|
|
1283
1534
|
}
|
|
1535
|
+
}, {
|
|
1536
|
+
key: "isFilled",
|
|
1537
|
+
get: function get() {
|
|
1538
|
+
return this._blocks.every(function (b) {
|
|
1539
|
+
return b.isFilled;
|
|
1540
|
+
});
|
|
1541
|
+
}
|
|
1542
|
+
}, {
|
|
1543
|
+
key: "isFixed",
|
|
1544
|
+
get: function get() {
|
|
1545
|
+
return this._blocks.every(function (b) {
|
|
1546
|
+
return b.isFixed;
|
|
1547
|
+
});
|
|
1548
|
+
}
|
|
1549
|
+
}, {
|
|
1550
|
+
key: "isOptional",
|
|
1551
|
+
get: function get() {
|
|
1552
|
+
return this._blocks.every(function (b) {
|
|
1553
|
+
return b.isOptional;
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1284
1556
|
}, {
|
|
1285
1557
|
key: "doCommit",
|
|
1286
1558
|
value: function doCommit() {
|
|
@@ -1314,6 +1586,21 @@ var MaskedPattern = function (_Masked) {
|
|
|
1314
1586
|
value: function appendTail(tail) {
|
|
1315
1587
|
return _get(_getPrototypeOf(MaskedPattern.prototype), "appendTail", this).call(this, tail).aggregate(this._appendPlaceholder());
|
|
1316
1588
|
}
|
|
1589
|
+
}, {
|
|
1590
|
+
key: "_appendEager",
|
|
1591
|
+
value: function _appendEager() {
|
|
1592
|
+
var _this$_mapPosToBlock;
|
|
1593
|
+
var details = new ChangeDetails();
|
|
1594
|
+
var startBlockIndex = (_this$_mapPosToBlock = this._mapPosToBlock(this.value.length)) === null || _this$_mapPosToBlock === void 0 ? void 0 : _this$_mapPosToBlock.index;
|
|
1595
|
+
if (startBlockIndex == null) return details;
|
|
1596
|
+
if (this._blocks[startBlockIndex].isFilled) ++startBlockIndex;
|
|
1597
|
+
for (var bi = startBlockIndex; bi < this._blocks.length; ++bi) {
|
|
1598
|
+
var d = this._blocks[bi]._appendEager();
|
|
1599
|
+
if (!d.inserted) break;
|
|
1600
|
+
details.aggregate(d);
|
|
1601
|
+
}
|
|
1602
|
+
return details;
|
|
1603
|
+
}
|
|
1317
1604
|
}, {
|
|
1318
1605
|
key: "_appendCharRaw",
|
|
1319
1606
|
value: function _appendCharRaw(ch) {
|
|
@@ -1322,9 +1609,12 @@ var MaskedPattern = function (_Masked) {
|
|
|
1322
1609
|
var details = new ChangeDetails();
|
|
1323
1610
|
if (!blockIter) return details;
|
|
1324
1611
|
for (var bi = blockIter.index;; ++bi) {
|
|
1612
|
+
var _flags$_beforeTailSta;
|
|
1325
1613
|
var _block = this._blocks[bi];
|
|
1326
1614
|
if (!_block) break;
|
|
1327
|
-
var blockDetails = _block._appendChar(ch, flags
|
|
1615
|
+
var blockDetails = _block._appendChar(ch, Object.assign({}, flags, {
|
|
1616
|
+
_beforeTailState: (_flags$_beforeTailSta = flags._beforeTailState) === null || _flags$_beforeTailSta === void 0 ? void 0 : _flags$_beforeTailSta._blocks[bi]
|
|
1617
|
+
}));
|
|
1328
1618
|
var skip = blockDetails.skip;
|
|
1329
1619
|
details.aggregate(blockDetails);
|
|
1330
1620
|
if (skip || blockDetails.rawInserted) break;
|
|
@@ -1449,136 +1739,49 @@ var MaskedPattern = function (_Masked) {
|
|
|
1449
1739
|
key: "nearestInputPos",
|
|
1450
1740
|
value: function nearestInputPos(cursorPos) {
|
|
1451
1741
|
var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DIRECTION.NONE;
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
offset: 0
|
|
1455
|
-
};
|
|
1456
|
-
var beginBlockOffset = beginBlockData.offset,
|
|
1457
|
-
beginBlockIndex = beginBlockData.index;
|
|
1458
|
-
var beginBlock = this._blocks[beginBlockIndex];
|
|
1459
|
-
if (!beginBlock) return cursorPos;
|
|
1460
|
-
var beginBlockCursorPos = beginBlockOffset;
|
|
1461
|
-
if (beginBlockCursorPos !== 0 && beginBlockCursorPos < beginBlock.value.length) {
|
|
1462
|
-
beginBlockCursorPos = beginBlock.nearestInputPos(beginBlockOffset, forceDirection(direction));
|
|
1463
|
-
}
|
|
1464
|
-
var cursorAtRight = beginBlockCursorPos === beginBlock.value.length;
|
|
1465
|
-
var cursorAtLeft = beginBlockCursorPos === 0;
|
|
1466
|
-
if (!cursorAtLeft && !cursorAtRight) return this._blockStartPos(beginBlockIndex) + beginBlockCursorPos;
|
|
1467
|
-
var searchBlockIndex = cursorAtRight ? beginBlockIndex + 1 : beginBlockIndex;
|
|
1742
|
+
if (!this._blocks.length) return 0;
|
|
1743
|
+
var cursor = new PatternCursor(this, cursorPos);
|
|
1468
1744
|
if (direction === DIRECTION.NONE) {
|
|
1469
|
-
if (
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
if (!blockAtLeft.value.length || blockInputPos !== blockAtLeft.value.length) {
|
|
1474
|
-
return this._blockStartPos(searchBlockIndex);
|
|
1475
|
-
}
|
|
1476
|
-
}
|
|
1477
|
-
var firstInputAtRight = searchBlockIndex;
|
|
1478
|
-
for (var bi = firstInputAtRight; bi < this._blocks.length; ++bi) {
|
|
1479
|
-
var blockAtRight = this._blocks[bi];
|
|
1480
|
-
var _blockInputPos = blockAtRight.nearestInputPos(0, DIRECTION.NONE);
|
|
1481
|
-
if (!blockAtRight.value.length || _blockInputPos !== blockAtRight.value.length) {
|
|
1482
|
-
return this._blockStartPos(bi) + _blockInputPos;
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
for (var _bi = searchBlockIndex - 1; _bi >= 0; --_bi) {
|
|
1486
|
-
var _block3 = this._blocks[_bi];
|
|
1487
|
-
var _blockInputPos2 = _block3.nearestInputPos(0, DIRECTION.NONE);
|
|
1488
|
-
if (!_block3.value.length || _blockInputPos2 !== _block3.value.length) {
|
|
1489
|
-
return this._blockStartPos(_bi) + _block3.value.length;
|
|
1490
|
-
}
|
|
1491
|
-
}
|
|
1492
|
-
return cursorPos;
|
|
1745
|
+
if (cursor.pushRightBeforeInput()) return cursor.pos;
|
|
1746
|
+
cursor.popState();
|
|
1747
|
+
if (cursor.pushLeftBeforeInput()) return cursor.pos;
|
|
1748
|
+
return this.value.length;
|
|
1493
1749
|
}
|
|
1494
1750
|
if (direction === DIRECTION.LEFT || direction === DIRECTION.FORCE_LEFT) {
|
|
1495
|
-
var firstFilledBlockIndexAtRight;
|
|
1496
|
-
for (var _bi2 = searchBlockIndex; _bi2 < this._blocks.length; ++_bi2) {
|
|
1497
|
-
if (this._blocks[_bi2].value) {
|
|
1498
|
-
firstFilledBlockIndexAtRight = _bi2;
|
|
1499
|
-
break;
|
|
1500
|
-
}
|
|
1501
|
-
}
|
|
1502
|
-
if (firstFilledBlockIndexAtRight != null) {
|
|
1503
|
-
var filledBlock = this._blocks[firstFilledBlockIndexAtRight];
|
|
1504
|
-
var _blockInputPos3 = filledBlock.nearestInputPos(0, DIRECTION.RIGHT);
|
|
1505
|
-
if (_blockInputPos3 === 0 && filledBlock.unmaskedValue.length) {
|
|
1506
|
-
return this._blockStartPos(firstFilledBlockIndexAtRight) + _blockInputPos3;
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
var firstFilledInputBlockIndex = -1;
|
|
1510
|
-
var firstEmptyInputBlockIndex;
|
|
1511
|
-
for (var _bi3 = searchBlockIndex - 1; _bi3 >= 0; --_bi3) {
|
|
1512
|
-
var _block4 = this._blocks[_bi3];
|
|
1513
|
-
var _blockInputPos4 = _block4.nearestInputPos(_block4.value.length, DIRECTION.FORCE_LEFT);
|
|
1514
|
-
if (!_block4.value || _blockInputPos4 !== 0) firstEmptyInputBlockIndex = _bi3;
|
|
1515
|
-
if (_blockInputPos4 !== 0) {
|
|
1516
|
-
if (_blockInputPos4 !== _block4.value.length) {
|
|
1517
|
-
return this._blockStartPos(_bi3) + _blockInputPos4;
|
|
1518
|
-
} else {
|
|
1519
|
-
firstFilledInputBlockIndex = _bi3;
|
|
1520
|
-
break;
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
1751
|
if (direction === DIRECTION.LEFT) {
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
var blockAlignedPos = this._blockStartPos(_bi4) + _blockInputPos5;
|
|
1529
|
-
if (blockAlignedPos > cursorPos) break;
|
|
1530
|
-
if (_blockInputPos5 !== _block5.value.length) return blockAlignedPos;
|
|
1531
|
-
}
|
|
1532
|
-
}
|
|
1533
|
-
if (firstFilledInputBlockIndex >= 0) {
|
|
1534
|
-
return this._blockStartPos(firstFilledInputBlockIndex) + this._blocks[firstFilledInputBlockIndex].value.length;
|
|
1535
|
-
}
|
|
1536
|
-
if (direction === DIRECTION.FORCE_LEFT || this.lazy && !this.extractInput() && !isInput(this._blocks[searchBlockIndex])) {
|
|
1537
|
-
return 0;
|
|
1752
|
+
cursor.pushRightBeforeFilled();
|
|
1753
|
+
if (cursor.ok && cursor.pos === cursorPos) return cursorPos;
|
|
1754
|
+
cursor.popState();
|
|
1538
1755
|
}
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
if (
|
|
1546
|
-
|
|
1547
|
-
|
|
1756
|
+
cursor.pushLeftBeforeInput();
|
|
1757
|
+
cursor.pushLeftBeforeRequired();
|
|
1758
|
+
cursor.pushLeftBeforeFilled();
|
|
1759
|
+
if (direction === DIRECTION.LEFT) {
|
|
1760
|
+
cursor.pushRightBeforeInput();
|
|
1761
|
+
cursor.pushRightBeforeRequired();
|
|
1762
|
+
if (cursor.ok && cursor.pos <= cursorPos) return cursor.pos;
|
|
1763
|
+
cursor.popState();
|
|
1764
|
+
if (cursor.ok && cursor.pos <= cursorPos) return cursor.pos;
|
|
1765
|
+
cursor.popState();
|
|
1548
1766
|
}
|
|
1767
|
+
if (cursor.ok) return cursor.pos;
|
|
1768
|
+
if (direction === DIRECTION.FORCE_LEFT) return 0;
|
|
1769
|
+
cursor.popState();
|
|
1770
|
+
if (cursor.ok) return cursor.pos;
|
|
1771
|
+
cursor.popState();
|
|
1772
|
+
if (cursor.ok) return cursor.pos;
|
|
1549
1773
|
return 0;
|
|
1550
1774
|
}
|
|
1551
1775
|
if (direction === DIRECTION.RIGHT || direction === DIRECTION.FORCE_RIGHT) {
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
}
|
|
1562
|
-
}
|
|
1563
|
-
if (firstInputBlockAlignedIndex != null && firstInputBlockAlignedPos != null) {
|
|
1564
|
-
for (var _bi7 = firstInputBlockAlignedIndex; _bi7 < this._blocks.length; ++_bi7) {
|
|
1565
|
-
var _block8 = this._blocks[_bi7];
|
|
1566
|
-
var _blockInputPos8 = _block8.nearestInputPos(0, DIRECTION.FORCE_RIGHT);
|
|
1567
|
-
if (_blockInputPos8 !== _block8.value.length) {
|
|
1568
|
-
return this._blockStartPos(_bi7) + _blockInputPos8;
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
return direction === DIRECTION.FORCE_RIGHT ? this.value.length : firstInputBlockAlignedPos;
|
|
1572
|
-
}
|
|
1573
|
-
for (var _bi8 = Math.min(searchBlockIndex, this._blocks.length - 1); _bi8 >= 0; --_bi8) {
|
|
1574
|
-
var _block9 = this._blocks[_bi8];
|
|
1575
|
-
var _blockInputPos9 = _block9.nearestInputPos(_block9.value.length, DIRECTION.LEFT);
|
|
1576
|
-
if (_blockInputPos9 !== 0) {
|
|
1577
|
-
var alignedPos = this._blockStartPos(_bi8) + _blockInputPos9;
|
|
1578
|
-
if (alignedPos >= cursorPos) return alignedPos;
|
|
1579
|
-
break;
|
|
1580
|
-
}
|
|
1581
|
-
}
|
|
1776
|
+
cursor.pushRightBeforeInput();
|
|
1777
|
+
cursor.pushRightBeforeRequired();
|
|
1778
|
+
if (cursor.pushRightBeforeFilled()) return cursor.pos;
|
|
1779
|
+
if (direction === DIRECTION.FORCE_RIGHT) return this.value.length;
|
|
1780
|
+
cursor.popState();
|
|
1781
|
+
if (cursor.ok) return cursor.pos;
|
|
1782
|
+
cursor.popState();
|
|
1783
|
+
if (cursor.ok) return cursor.pos;
|
|
1784
|
+
return this.nearestInputPos(cursorPos, DIRECTION.LEFT);
|
|
1582
1785
|
}
|
|
1583
1786
|
return cursorPos;
|
|
1584
1787
|
}
|
|
@@ -1608,11 +1811,6 @@ MaskedPattern.STOP_CHAR = '`';
|
|
|
1608
1811
|
MaskedPattern.ESCAPE_CHAR = '\\';
|
|
1609
1812
|
MaskedPattern.InputDefinition = PatternInputDefinition;
|
|
1610
1813
|
MaskedPattern.FixedDefinition = PatternFixedDefinition;
|
|
1611
|
-
function isInput(block) {
|
|
1612
|
-
if (!block) return false;
|
|
1613
|
-
var value = block.value;
|
|
1614
|
-
return !value || block.nearestInputPos(0, DIRECTION.NONE) !== value.length;
|
|
1615
|
-
}
|
|
1616
1814
|
IMask.MaskedPattern = MaskedPattern;
|
|
1617
1815
|
|
|
1618
1816
|
var MaskedRange = function (_MaskedPattern) {
|
|
@@ -1633,7 +1831,8 @@ var MaskedRange = function (_MaskedPattern) {
|
|
|
1633
1831
|
value: function _update(opts) {
|
|
1634
1832
|
opts = Object.assign({
|
|
1635
1833
|
to: this.to || 0,
|
|
1636
|
-
from: this.from || 0
|
|
1834
|
+
from: this.from || 0,
|
|
1835
|
+
maxLength: this.maxLength || 0
|
|
1637
1836
|
}, opts);
|
|
1638
1837
|
var maxLength = String(opts.to).length;
|
|
1639
1838
|
if (opts.maxLength != null) maxLength = Math.max(maxLength, opts.maxLength);
|
|
@@ -1671,23 +1870,30 @@ var MaskedRange = function (_MaskedPattern) {
|
|
|
1671
1870
|
}
|
|
1672
1871
|
}, {
|
|
1673
1872
|
key: "doPrepare",
|
|
1674
|
-
value: function doPrepare(
|
|
1873
|
+
value: function doPrepare(ch) {
|
|
1675
1874
|
var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1676
|
-
|
|
1677
|
-
|
|
1875
|
+
var details;
|
|
1876
|
+
var _normalizePrepare = normalizePrepare(_get(_getPrototypeOf(MaskedRange.prototype), "doPrepare", this).call(this, ch.replace(/\D/g, ''), flags));
|
|
1877
|
+
var _normalizePrepare2 = _slicedToArray(_normalizePrepare, 2);
|
|
1878
|
+
ch = _normalizePrepare2[0];
|
|
1879
|
+
details = _normalizePrepare2[1];
|
|
1880
|
+
if (!this.autofix || !ch) return ch;
|
|
1678
1881
|
var fromStr = String(this.from).padStart(this.maxLength, '0');
|
|
1679
1882
|
var toStr = String(this.to).padStart(this.maxLength, '0');
|
|
1680
|
-
var
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
if (
|
|
1883
|
+
var nextVal = this.value + ch;
|
|
1884
|
+
if (nextVal.length > this.maxLength) return '';
|
|
1885
|
+
var _this$boundaries = this.boundaries(nextVal),
|
|
1886
|
+
_this$boundaries2 = _slicedToArray(_this$boundaries, 2),
|
|
1887
|
+
minstr = _this$boundaries2[0],
|
|
1888
|
+
maxstr = _this$boundaries2[1];
|
|
1889
|
+
if (Number(maxstr) < this.from) return fromStr[nextVal.length - 1];
|
|
1890
|
+
if (Number(minstr) > this.to) {
|
|
1891
|
+
if (this.autofix === 'pad' && nextVal.length < this.maxLength) {
|
|
1892
|
+
return ['', details.aggregate(this.append(fromStr[nextVal.length - 1] + ch, flags))];
|
|
1893
|
+
}
|
|
1894
|
+
return toStr[nextVal.length - 1];
|
|
1689
1895
|
}
|
|
1690
|
-
return
|
|
1896
|
+
return ch;
|
|
1691
1897
|
}
|
|
1692
1898
|
}, {
|
|
1693
1899
|
key: "doValidate",
|
|
@@ -1734,10 +1940,10 @@ var MaskedDate = function (_MaskedPattern) {
|
|
|
1734
1940
|
opts.blocks.d.to = opts.max.getDate();
|
|
1735
1941
|
}
|
|
1736
1942
|
}
|
|
1737
|
-
Object.assign(opts.blocks, blocks);
|
|
1943
|
+
Object.assign(opts.blocks, this.blocks, blocks);
|
|
1738
1944
|
Object.keys(opts.blocks).forEach(function (bk) {
|
|
1739
1945
|
var b = opts.blocks[bk];
|
|
1740
|
-
if (!('autofix' in b)) b.autofix = opts.autofix;
|
|
1946
|
+
if (!('autofix' in b) && 'autofix' in opts) b.autofix = opts.autofix;
|
|
1741
1947
|
});
|
|
1742
1948
|
_get(_getPrototypeOf(MaskedDate.prototype), "_update", this).call(this, opts);
|
|
1743
1949
|
}
|
|
@@ -1772,12 +1978,18 @@ var MaskedDate = function (_MaskedPattern) {
|
|
|
1772
1978
|
set: function set(value) {
|
|
1773
1979
|
_set(_getPrototypeOf(MaskedDate.prototype), "typedValue", value, this, true);
|
|
1774
1980
|
}
|
|
1981
|
+
}, {
|
|
1982
|
+
key: "maskEquals",
|
|
1983
|
+
value: function maskEquals(mask) {
|
|
1984
|
+
return mask === Date || _get(_getPrototypeOf(MaskedDate.prototype), "maskEquals", this).call(this, mask);
|
|
1985
|
+
}
|
|
1775
1986
|
}]);
|
|
1776
1987
|
return MaskedDate;
|
|
1777
1988
|
}(MaskedPattern);
|
|
1778
1989
|
MaskedDate.DEFAULTS = {
|
|
1779
1990
|
pattern: 'd{.}`m{.}`Y',
|
|
1780
1991
|
format: function format(date) {
|
|
1992
|
+
if (!date) return '';
|
|
1781
1993
|
var day = String(date.getDate()).padStart(2, '0');
|
|
1782
1994
|
var month = String(date.getMonth() + 1).padStart(2, '0');
|
|
1783
1995
|
var year = date.getFullYear();
|
|
@@ -1879,7 +2091,8 @@ var HTMLMaskElement = function (_MaskElement) {
|
|
|
1879
2091
|
_createClass(HTMLMaskElement, [{
|
|
1880
2092
|
key: "rootElement",
|
|
1881
2093
|
get: function get() {
|
|
1882
|
-
|
|
2094
|
+
var _this$input$getRootNo, _this$input$getRootNo2, _this$input;
|
|
2095
|
+
return (_this$input$getRootNo = (_this$input$getRootNo2 = (_this$input = this.input).getRootNode) === null || _this$input$getRootNo2 === void 0 ? void 0 : _this$input$getRootNo2.call(_this$input)) !== null && _this$input$getRootNo !== void 0 ? _this$input$getRootNo : document;
|
|
1883
2096
|
}
|
|
1884
2097
|
}, {
|
|
1885
2098
|
key: "isActive",
|
|
@@ -1963,14 +2176,24 @@ var HTMLContenteditableMaskElement = function (_HTMLMaskElement) {
|
|
|
1963
2176
|
function get() {
|
|
1964
2177
|
var root = this.rootElement;
|
|
1965
2178
|
var selection = root.getSelection && root.getSelection();
|
|
1966
|
-
|
|
2179
|
+
var anchorOffset = selection && selection.anchorOffset;
|
|
2180
|
+
var focusOffset = selection && selection.focusOffset;
|
|
2181
|
+
if (focusOffset == null || anchorOffset == null || anchorOffset < focusOffset) {
|
|
2182
|
+
return anchorOffset;
|
|
2183
|
+
}
|
|
2184
|
+
return focusOffset;
|
|
1967
2185
|
}
|
|
1968
2186
|
}, {
|
|
1969
2187
|
key: "_unsafeSelectionEnd",
|
|
1970
2188
|
get: function get() {
|
|
1971
2189
|
var root = this.rootElement;
|
|
1972
2190
|
var selection = root.getSelection && root.getSelection();
|
|
1973
|
-
|
|
2191
|
+
var anchorOffset = selection && selection.anchorOffset;
|
|
2192
|
+
var focusOffset = selection && selection.focusOffset;
|
|
2193
|
+
if (focusOffset == null || anchorOffset == null || anchorOffset > focusOffset) {
|
|
2194
|
+
return anchorOffset;
|
|
2195
|
+
}
|
|
2196
|
+
return focusOffset;
|
|
1974
2197
|
}
|
|
1975
2198
|
}, {
|
|
1976
2199
|
key: "_unsafeSelect",
|
|
@@ -2042,7 +2265,8 @@ var InputMask = function () {
|
|
|
2042
2265
|
}, {
|
|
2043
2266
|
key: "maskEquals",
|
|
2044
2267
|
value: function maskEquals(mask) {
|
|
2045
|
-
|
|
2268
|
+
var _this$masked;
|
|
2269
|
+
return mask == null || ((_this$masked = this.masked) === null || _this$masked === void 0 ? void 0 : _this$masked.maskEquals(mask));
|
|
2046
2270
|
}
|
|
2047
2271
|
}, {
|
|
2048
2272
|
key: "value",
|
|
@@ -2120,7 +2344,8 @@ var InputMask = function () {
|
|
|
2120
2344
|
}
|
|
2121
2345
|
}, {
|
|
2122
2346
|
key: "_saveSelection",
|
|
2123
|
-
value: function
|
|
2347
|
+
value: function
|
|
2348
|
+
_saveSelection() {
|
|
2124
2349
|
if (this.value !== this.el.value) {
|
|
2125
2350
|
console.warn('Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly.');
|
|
2126
2351
|
}
|
|
@@ -2193,7 +2418,7 @@ var InputMask = function () {
|
|
|
2193
2418
|
}, {
|
|
2194
2419
|
key: "alignCursor",
|
|
2195
2420
|
value: function alignCursor() {
|
|
2196
|
-
this.cursorPos = this.masked.nearestInputPos(this.cursorPos, DIRECTION.LEFT);
|
|
2421
|
+
this.cursorPos = this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos, DIRECTION.LEFT));
|
|
2197
2422
|
}
|
|
2198
2423
|
}, {
|
|
2199
2424
|
key: "alignCursorFriendly",
|
|
@@ -2233,6 +2458,7 @@ var InputMask = function () {
|
|
|
2233
2458
|
var offset = this.masked.splice(details.startChangePos, details.removed.length, details.inserted, details.removeDirection).offset;
|
|
2234
2459
|
var removeDirection = oldRawValue === this.masked.rawInputValue ? details.removeDirection : DIRECTION.NONE;
|
|
2235
2460
|
var cursorPos = this.masked.nearestInputPos(details.startChangePos + offset, removeDirection);
|
|
2461
|
+
if (removeDirection !== DIRECTION.NONE) cursorPos = this.masked.nearestInputPos(cursorPos, DIRECTION.NONE);
|
|
2236
2462
|
this.updateControl();
|
|
2237
2463
|
this.updateCursor(cursorPos);
|
|
2238
2464
|
delete this._inputEvent;
|
|
@@ -2345,12 +2571,19 @@ var MaskedNumber = function (_Masked) {
|
|
|
2345
2571
|
}
|
|
2346
2572
|
}, {
|
|
2347
2573
|
key: "doPrepare",
|
|
2348
|
-
value: function doPrepare(
|
|
2574
|
+
value: function doPrepare(ch) {
|
|
2349
2575
|
var _get2;
|
|
2576
|
+
ch = ch.replace(this._mapToRadixRegExp, this.radix);
|
|
2577
|
+
var noSepCh = this._removeThousandsSeparators(ch);
|
|
2350
2578
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
2351
2579
|
args[_key - 1] = arguments[_key];
|
|
2352
2580
|
}
|
|
2353
|
-
|
|
2581
|
+
var _normalizePrepare = normalizePrepare((_get2 = _get(_getPrototypeOf(MaskedNumber.prototype), "doPrepare", this)).call.apply(_get2, [this, noSepCh].concat(args))),
|
|
2582
|
+
_normalizePrepare2 = _slicedToArray(_normalizePrepare, 2),
|
|
2583
|
+
prepCh = _normalizePrepare2[0],
|
|
2584
|
+
details = _normalizePrepare2[1];
|
|
2585
|
+
if (ch && !noSepCh) details.skip = true;
|
|
2586
|
+
return [prepCh, details];
|
|
2354
2587
|
}
|
|
2355
2588
|
}, {
|
|
2356
2589
|
key: "_separatorsCount",
|
|
@@ -2472,7 +2705,9 @@ var MaskedNumber = function (_Masked) {
|
|
|
2472
2705
|
var valid = regexp.test(this._removeThousandsSeparators(this.value));
|
|
2473
2706
|
if (valid) {
|
|
2474
2707
|
var number = this.number;
|
|
2475
|
-
valid = valid && !isNaN(number) && (
|
|
2708
|
+
valid = valid && !isNaN(number) && (
|
|
2709
|
+
this.min == null || this.min >= 0 || this.min <= this.number) && (
|
|
2710
|
+
this.max == null || this.max <= 0 || this.number <= this.max);
|
|
2476
2711
|
}
|
|
2477
2712
|
return valid && _get(_getPrototypeOf(MaskedNumber.prototype), "doValidate", this).call(this, flags);
|
|
2478
2713
|
}
|
|
@@ -2487,7 +2722,7 @@ var MaskedNumber = function (_Masked) {
|
|
|
2487
2722
|
if (validnum !== number) this.unmaskedValue = String(validnum);
|
|
2488
2723
|
var formatted = this.value;
|
|
2489
2724
|
if (this.normalizeZeros) formatted = this._normalizeZeros(formatted);
|
|
2490
|
-
if (this.padFractionalZeros) formatted = this._padFractionalZeros(formatted);
|
|
2725
|
+
if (this.padFractionalZeros && this.scale > 0) formatted = this._padFractionalZeros(formatted);
|
|
2491
2726
|
this._value = formatted;
|
|
2492
2727
|
}
|
|
2493
2728
|
_get(_getPrototypeOf(MaskedNumber.prototype), "doCommit", this).call(this);
|
|
@@ -2652,6 +2887,15 @@ var MaskedDynamic = function (_Masked) {
|
|
|
2652
2887
|
}
|
|
2653
2888
|
return details;
|
|
2654
2889
|
}
|
|
2890
|
+
}, {
|
|
2891
|
+
key: "_appendEager",
|
|
2892
|
+
value: function _appendEager() {
|
|
2893
|
+
var details = this._applyDispatch.apply(this, arguments);
|
|
2894
|
+
if (this.currentMask) {
|
|
2895
|
+
details.aggregate(this.currentMask._appendEager());
|
|
2896
|
+
}
|
|
2897
|
+
return details;
|
|
2898
|
+
}
|
|
2655
2899
|
}, {
|
|
2656
2900
|
key: "doDispatch",
|
|
2657
2901
|
value: function doDispatch(appended) {
|
|
@@ -2670,7 +2914,8 @@ var MaskedDynamic = function (_Masked) {
|
|
|
2670
2914
|
}, {
|
|
2671
2915
|
key: "reset",
|
|
2672
2916
|
value: function reset() {
|
|
2673
|
-
|
|
2917
|
+
var _this$currentMask2;
|
|
2918
|
+
(_this$currentMask2 = this.currentMask) === null || _this$currentMask2 === void 0 ? void 0 : _this$currentMask2.reset();
|
|
2674
2919
|
this.compiledMasks.forEach(function (m) {
|
|
2675
2920
|
return m.reset();
|
|
2676
2921
|
});
|
|
@@ -2708,15 +2953,22 @@ var MaskedDynamic = function (_Masked) {
|
|
|
2708
2953
|
}, {
|
|
2709
2954
|
key: "isComplete",
|
|
2710
2955
|
get: function get() {
|
|
2711
|
-
|
|
2956
|
+
var _this$currentMask3;
|
|
2957
|
+
return Boolean((_this$currentMask3 = this.currentMask) === null || _this$currentMask3 === void 0 ? void 0 : _this$currentMask3.isComplete);
|
|
2958
|
+
}
|
|
2959
|
+
}, {
|
|
2960
|
+
key: "isFilled",
|
|
2961
|
+
get: function get() {
|
|
2962
|
+
var _this$currentMask4;
|
|
2963
|
+
return Boolean((_this$currentMask4 = this.currentMask) === null || _this$currentMask4 === void 0 ? void 0 : _this$currentMask4.isFilled);
|
|
2712
2964
|
}
|
|
2713
2965
|
}, {
|
|
2714
2966
|
key: "remove",
|
|
2715
2967
|
value: function remove() {
|
|
2716
2968
|
var details = new ChangeDetails();
|
|
2717
2969
|
if (this.currentMask) {
|
|
2718
|
-
var _this$
|
|
2719
|
-
details.aggregate((_this$
|
|
2970
|
+
var _this$currentMask5;
|
|
2971
|
+
details.aggregate((_this$currentMask5 = this.currentMask).remove.apply(_this$currentMask5, arguments))
|
|
2720
2972
|
.aggregate(this._applyDispatch());
|
|
2721
2973
|
}
|
|
2722
2974
|
return details;
|
|
@@ -2750,17 +3002,17 @@ var MaskedDynamic = function (_Masked) {
|
|
|
2750
3002
|
}, {
|
|
2751
3003
|
key: "extractInput",
|
|
2752
3004
|
value: function extractInput() {
|
|
2753
|
-
var _this$
|
|
2754
|
-
return this.currentMask ? (_this$
|
|
3005
|
+
var _this$currentMask6;
|
|
3006
|
+
return this.currentMask ? (_this$currentMask6 = this.currentMask).extractInput.apply(_this$currentMask6, arguments) : '';
|
|
2755
3007
|
}
|
|
2756
3008
|
}, {
|
|
2757
3009
|
key: "extractTail",
|
|
2758
3010
|
value: function extractTail() {
|
|
2759
|
-
var _this$
|
|
3011
|
+
var _this$currentMask7, _get3;
|
|
2760
3012
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
2761
3013
|
args[_key2] = arguments[_key2];
|
|
2762
3014
|
}
|
|
2763
|
-
return this.currentMask ? (_this$
|
|
3015
|
+
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));
|
|
2764
3016
|
}
|
|
2765
3017
|
}, {
|
|
2766
3018
|
key: "doCommit",
|
|
@@ -2771,11 +3023,11 @@ var MaskedDynamic = function (_Masked) {
|
|
|
2771
3023
|
}, {
|
|
2772
3024
|
key: "nearestInputPos",
|
|
2773
3025
|
value: function nearestInputPos() {
|
|
2774
|
-
var _this$
|
|
3026
|
+
var _this$currentMask8, _get4;
|
|
2775
3027
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
2776
3028
|
args[_key3] = arguments[_key3];
|
|
2777
3029
|
}
|
|
2778
|
-
return this.currentMask ? (_this$
|
|
3030
|
+
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));
|
|
2779
3031
|
}
|
|
2780
3032
|
}, {
|
|
2781
3033
|
key: "overwrite",
|
|
@@ -2785,6 +3037,22 @@ var MaskedDynamic = function (_Masked) {
|
|
|
2785
3037
|
set: function set(overwrite) {
|
|
2786
3038
|
console.warn('"overwrite" option is not available in dynamic mask, use this option in siblings');
|
|
2787
3039
|
}
|
|
3040
|
+
}, {
|
|
3041
|
+
key: "eager",
|
|
3042
|
+
get: function get() {
|
|
3043
|
+
return this.currentMask ? this.currentMask.eager : _get(_getPrototypeOf(MaskedDynamic.prototype), "eager", this);
|
|
3044
|
+
},
|
|
3045
|
+
set: function set(eager) {
|
|
3046
|
+
console.warn('"eager" option is not available in dynamic mask, use this option in siblings');
|
|
3047
|
+
}
|
|
3048
|
+
}, {
|
|
3049
|
+
key: "maskEquals",
|
|
3050
|
+
value: function maskEquals(mask) {
|
|
3051
|
+
return Array.isArray(mask) && this.compiledMasks.every(function (m, mi) {
|
|
3052
|
+
var _mask$mi;
|
|
3053
|
+
return m.maskEquals((_mask$mi = mask[mi]) === null || _mask$mi === void 0 ? void 0 : _mask$mi.mask);
|
|
3054
|
+
});
|
|
3055
|
+
}
|
|
2788
3056
|
}]);
|
|
2789
3057
|
return MaskedDynamic;
|
|
2790
3058
|
}(Masked);
|
|
@@ -2981,11 +3249,27 @@ function getBasePlacement(placement) {
|
|
|
2981
3249
|
return placement.split('-')[0];
|
|
2982
3250
|
}
|
|
2983
3251
|
|
|
2984
|
-
|
|
2985
|
-
|
|
3252
|
+
var max = Math.max;
|
|
3253
|
+
var min = Math.min;
|
|
3254
|
+
var round = Math.round;
|
|
3255
|
+
|
|
3256
|
+
function getBoundingClientRect(element, includeScale) {
|
|
3257
|
+
if (includeScale === void 0) {
|
|
3258
|
+
includeScale = false;
|
|
3259
|
+
}
|
|
2986
3260
|
var rect = element.getBoundingClientRect();
|
|
2987
3261
|
var scaleX = 1;
|
|
2988
3262
|
var scaleY = 1;
|
|
3263
|
+
if (isHTMLElement(element) && includeScale) {
|
|
3264
|
+
var offsetHeight = element.offsetHeight;
|
|
3265
|
+
var offsetWidth = element.offsetWidth;
|
|
3266
|
+
if (offsetWidth > 0) {
|
|
3267
|
+
scaleX = round(rect.width) / offsetWidth || 1;
|
|
3268
|
+
}
|
|
3269
|
+
if (offsetHeight > 0) {
|
|
3270
|
+
scaleY = round(rect.height) / offsetHeight || 1;
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
2989
3273
|
return {
|
|
2990
3274
|
width: rect.width / scaleX,
|
|
2991
3275
|
height: rect.height / scaleY,
|
|
@@ -3101,13 +3385,13 @@ function getMainAxisFromPlacement(placement) {
|
|
|
3101
3385
|
return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
|
|
3102
3386
|
}
|
|
3103
3387
|
|
|
3104
|
-
var max = Math.max;
|
|
3105
|
-
var min = Math.min;
|
|
3106
|
-
var round = Math.round;
|
|
3107
|
-
|
|
3108
3388
|
function within(min$1, value, max$1) {
|
|
3109
3389
|
return max(min$1, min(value, max$1));
|
|
3110
3390
|
}
|
|
3391
|
+
function withinMaxClamp(min, value, max) {
|
|
3392
|
+
var v = within(min, value, max);
|
|
3393
|
+
return v > max ? max : v;
|
|
3394
|
+
}
|
|
3111
3395
|
|
|
3112
3396
|
function getFreshSideObject() {
|
|
3113
3397
|
return {
|
|
@@ -3210,8 +3494,8 @@ function roundOffsetsByDPR(_ref) {
|
|
|
3210
3494
|
var win = window;
|
|
3211
3495
|
var dpr = win.devicePixelRatio || 1;
|
|
3212
3496
|
return {
|
|
3213
|
-
x: round(
|
|
3214
|
-
y: round(
|
|
3497
|
+
x: round(x * dpr) / dpr || 0,
|
|
3498
|
+
y: round(y * dpr) / dpr || 0
|
|
3215
3499
|
};
|
|
3216
3500
|
}
|
|
3217
3501
|
function mapToStyles(_ref2) {
|
|
@@ -3224,12 +3508,21 @@ function mapToStyles(_ref2) {
|
|
|
3224
3508
|
position = _ref2.position,
|
|
3225
3509
|
gpuAcceleration = _ref2.gpuAcceleration,
|
|
3226
3510
|
adaptive = _ref2.adaptive,
|
|
3227
|
-
roundOffsets = _ref2.roundOffsets
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
x =
|
|
3231
|
-
|
|
3232
|
-
y =
|
|
3511
|
+
roundOffsets = _ref2.roundOffsets,
|
|
3512
|
+
isFixed = _ref2.isFixed;
|
|
3513
|
+
var _offsets$x = offsets.x,
|
|
3514
|
+
x = _offsets$x === void 0 ? 0 : _offsets$x,
|
|
3515
|
+
_offsets$y = offsets.y,
|
|
3516
|
+
y = _offsets$y === void 0 ? 0 : _offsets$y;
|
|
3517
|
+
var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
|
|
3518
|
+
x: x,
|
|
3519
|
+
y: y
|
|
3520
|
+
}) : {
|
|
3521
|
+
x: x,
|
|
3522
|
+
y: y
|
|
3523
|
+
};
|
|
3524
|
+
x = _ref3.x;
|
|
3525
|
+
y = _ref3.y;
|
|
3233
3526
|
var hasX = offsets.hasOwnProperty('x');
|
|
3234
3527
|
var hasY = offsets.hasOwnProperty('y');
|
|
3235
3528
|
var sideX = left;
|
|
@@ -3249,27 +3542,40 @@ function mapToStyles(_ref2) {
|
|
|
3249
3542
|
offsetParent = offsetParent;
|
|
3250
3543
|
if (placement === top || (placement === left || placement === right) && variation === end) {
|
|
3251
3544
|
sideY = bottom;
|
|
3252
|
-
|
|
3545
|
+
var offsetY = isFixed && win.visualViewport ? win.visualViewport.height :
|
|
3546
|
+
offsetParent[heightProp];
|
|
3547
|
+
y -= offsetY - popperRect.height;
|
|
3253
3548
|
y *= gpuAcceleration ? 1 : -1;
|
|
3254
3549
|
}
|
|
3255
3550
|
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
|
3256
3551
|
sideX = right;
|
|
3257
|
-
|
|
3552
|
+
var offsetX = isFixed && win.visualViewport ? win.visualViewport.width :
|
|
3553
|
+
offsetParent[widthProp];
|
|
3554
|
+
x -= offsetX - popperRect.width;
|
|
3258
3555
|
x *= gpuAcceleration ? 1 : -1;
|
|
3259
3556
|
}
|
|
3260
3557
|
}
|
|
3261
3558
|
var commonStyles = Object.assign({
|
|
3262
3559
|
position: position
|
|
3263
3560
|
}, adaptive && unsetSides);
|
|
3561
|
+
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
|
|
3562
|
+
x: x,
|
|
3563
|
+
y: y
|
|
3564
|
+
}) : {
|
|
3565
|
+
x: x,
|
|
3566
|
+
y: y
|
|
3567
|
+
};
|
|
3568
|
+
x = _ref4.x;
|
|
3569
|
+
y = _ref4.y;
|
|
3264
3570
|
if (gpuAcceleration) {
|
|
3265
3571
|
var _Object$assign;
|
|
3266
3572
|
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
|
|
3267
3573
|
}
|
|
3268
3574
|
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
|
|
3269
3575
|
}
|
|
3270
|
-
function computeStyles(
|
|
3271
|
-
var state =
|
|
3272
|
-
options =
|
|
3576
|
+
function computeStyles(_ref5) {
|
|
3577
|
+
var state = _ref5.state,
|
|
3578
|
+
options = _ref5.options;
|
|
3273
3579
|
var _options$gpuAccelerat = options.gpuAcceleration,
|
|
3274
3580
|
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
|
|
3275
3581
|
_options$adaptive = options.adaptive,
|
|
@@ -3281,7 +3587,8 @@ function computeStyles(_ref4) {
|
|
|
3281
3587
|
variation: getVariation(state.placement),
|
|
3282
3588
|
popper: state.elements.popper,
|
|
3283
3589
|
popperRect: state.rects.popper,
|
|
3284
|
-
gpuAcceleration: gpuAcceleration
|
|
3590
|
+
gpuAcceleration: gpuAcceleration,
|
|
3591
|
+
isFixed: state.options.strategy === 'fixed'
|
|
3285
3592
|
};
|
|
3286
3593
|
if (state.modifiersData.popperOffsets != null) {
|
|
3287
3594
|
state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
|
|
@@ -3486,7 +3793,7 @@ function getInnerBoundingClientRect(element) {
|
|
|
3486
3793
|
return rect;
|
|
3487
3794
|
}
|
|
3488
3795
|
function getClientRectFromMixedType(element, clippingParent) {
|
|
3489
|
-
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) :
|
|
3796
|
+
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement$1(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
|
3490
3797
|
}
|
|
3491
3798
|
function getClippingParents(element) {
|
|
3492
3799
|
var clippingParents = listScrollParents(getParentNode(element));
|
|
@@ -3929,6 +4236,14 @@ function preventOverflow(_ref) {
|
|
|
3929
4236
|
var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
|
|
3930
4237
|
placement: state.placement
|
|
3931
4238
|
})) : tetherOffset;
|
|
4239
|
+
var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
|
|
4240
|
+
mainAxis: tetherOffsetValue,
|
|
4241
|
+
altAxis: tetherOffsetValue
|
|
4242
|
+
} : Object.assign({
|
|
4243
|
+
mainAxis: 0,
|
|
4244
|
+
altAxis: 0
|
|
4245
|
+
}, tetherOffsetValue);
|
|
4246
|
+
var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
|
|
3932
4247
|
var data = {
|
|
3933
4248
|
x: 0,
|
|
3934
4249
|
y: 0
|
|
@@ -3936,13 +4251,14 @@ function preventOverflow(_ref) {
|
|
|
3936
4251
|
if (!popperOffsets) {
|
|
3937
4252
|
return;
|
|
3938
4253
|
}
|
|
3939
|
-
if (checkMainAxis
|
|
4254
|
+
if (checkMainAxis) {
|
|
4255
|
+
var _offsetModifierState$;
|
|
3940
4256
|
var mainSide = mainAxis === 'y' ? top : left;
|
|
3941
4257
|
var altSide = mainAxis === 'y' ? bottom : right;
|
|
3942
4258
|
var len = mainAxis === 'y' ? 'height' : 'width';
|
|
3943
4259
|
var offset = popperOffsets[mainAxis];
|
|
3944
|
-
var min$1 =
|
|
3945
|
-
var max$1 =
|
|
4260
|
+
var min$1 = offset + overflow[mainSide];
|
|
4261
|
+
var max$1 = offset - overflow[altSide];
|
|
3946
4262
|
var additive = tether ? -popperRect[len] / 2 : 0;
|
|
3947
4263
|
var minLen = variation === start ? referenceRect[len] : popperRect[len];
|
|
3948
4264
|
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
|
|
@@ -3955,28 +4271,32 @@ function preventOverflow(_ref) {
|
|
|
3955
4271
|
var arrowPaddingMin = arrowPaddingObject[mainSide];
|
|
3956
4272
|
var arrowPaddingMax = arrowPaddingObject[altSide];
|
|
3957
4273
|
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
|
|
3958
|
-
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin -
|
|
3959
|
-
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax +
|
|
4274
|
+
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
|
|
4275
|
+
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
|
|
3960
4276
|
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
|
|
3961
4277
|
var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
|
|
3962
|
-
var offsetModifierValue =
|
|
3963
|
-
var tetherMin =
|
|
3964
|
-
var tetherMax =
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
4278
|
+
var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
|
|
4279
|
+
var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
|
|
4280
|
+
var tetherMax = offset + maxOffset - offsetModifierValue;
|
|
4281
|
+
var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
|
|
4282
|
+
popperOffsets[mainAxis] = preventedOffset;
|
|
4283
|
+
data[mainAxis] = preventedOffset - offset;
|
|
4284
|
+
}
|
|
4285
|
+
if (checkAltAxis) {
|
|
4286
|
+
var _offsetModifierState$2;
|
|
4287
|
+
var _mainSide = mainAxis === 'x' ? top : left;
|
|
4288
|
+
var _altSide = mainAxis === 'x' ? bottom : right;
|
|
4289
|
+
var _offset = popperOffsets[altAxis];
|
|
4290
|
+
var _len = altAxis === 'y' ? 'height' : 'width';
|
|
4291
|
+
var _min = _offset + overflow[_mainSide];
|
|
4292
|
+
var _max = _offset - overflow[_altSide];
|
|
4293
|
+
var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
|
|
4294
|
+
var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
|
|
4295
|
+
var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
|
|
4296
|
+
var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
|
|
4297
|
+
var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
|
|
4298
|
+
popperOffsets[altAxis] = _preventedOffset;
|
|
4299
|
+
data[altAxis] = _preventedOffset - _offset;
|
|
3980
4300
|
}
|
|
3981
4301
|
state.modifiersData[name] = data;
|
|
3982
4302
|
}
|
|
@@ -4005,8 +4325,8 @@ function getNodeScroll(node) {
|
|
|
4005
4325
|
|
|
4006
4326
|
function isElementScaled(element) {
|
|
4007
4327
|
var rect = element.getBoundingClientRect();
|
|
4008
|
-
var scaleX = rect.width / element.offsetWidth || 1;
|
|
4009
|
-
var scaleY = rect.height / element.offsetHeight || 1;
|
|
4328
|
+
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
|
4329
|
+
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
|
4010
4330
|
return scaleX !== 1 || scaleY !== 1;
|
|
4011
4331
|
}
|
|
4012
4332
|
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
@@ -4014,9 +4334,9 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
|
4014
4334
|
isFixed = false;
|
|
4015
4335
|
}
|
|
4016
4336
|
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
4017
|
-
isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
|
4337
|
+
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
|
4018
4338
|
var documentElement = getDocumentElement(offsetParent);
|
|
4019
|
-
var rect = getBoundingClientRect(elementOrVirtualElement);
|
|
4339
|
+
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
|
|
4020
4340
|
var scroll = {
|
|
4021
4341
|
scrollLeft: 0,
|
|
4022
4342
|
scrollTop: 0
|
|
@@ -4031,7 +4351,7 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
|
4031
4351
|
scroll = getNodeScroll(offsetParent);
|
|
4032
4352
|
}
|
|
4033
4353
|
if (isHTMLElement(offsetParent)) {
|
|
4034
|
-
offsets = getBoundingClientRect(offsetParent);
|
|
4354
|
+
offsets = getBoundingClientRect(offsetParent, true);
|
|
4035
4355
|
offsets.x += offsetParent.clientLeft;
|
|
4036
4356
|
offsets.y += offsetParent.clientTop;
|
|
4037
4357
|
} else if (documentElement) {
|