react-maskedinput
Advanced tools
Comparing version 3.2.1 to 3.2.2
@@ -64,2 +64,21 @@ 'use strict'; | ||
componentWillUpdate: function componentWillUpdate(nextProps, nextState) { | ||
if (nextProps.mask !== this.props.mask) { | ||
this._updatePattern(nextProps); | ||
} | ||
}, | ||
componentDidUpdate: function componentDidUpdate(prevProps) { | ||
if (prevProps.mask !== this.props.mask && this.mask.selection.start) { | ||
this._updateInputSelection(); | ||
} | ||
}, | ||
_updatePattern: function _updatePattern(props) { | ||
this.mask.setPattern(props.mask, { | ||
value: this.mask.getRawValue(), | ||
selection: getSelection(this.input) | ||
}); | ||
}, | ||
_updateMaskSelection: function _updateMaskSelection() { | ||
@@ -104,3 +123,5 @@ this.mask.selection = getSelection(this.input); | ||
this._updateInputSelection(); | ||
this.props.onChange(e); | ||
if (this.props.onChange) { | ||
this.props.onChange(e); | ||
} | ||
} | ||
@@ -113,3 +134,5 @@ return; | ||
this._updateInputSelection(); | ||
this.props.onChange(e); | ||
if (this.props.onChange) { | ||
this.props.onChange(e); | ||
} | ||
} | ||
@@ -128,3 +151,5 @@ return; | ||
} | ||
this.props.onChange(e); | ||
if (this.props.onChange) { | ||
this.props.onChange(e); | ||
} | ||
} | ||
@@ -148,3 +173,5 @@ } | ||
this._updateInputSelection(); | ||
this.props.onChange(e); | ||
if (this.props.onChange) { | ||
this.props.onChange(e); | ||
} | ||
} | ||
@@ -163,3 +190,5 @@ }, | ||
setTimeout(this._updateInputSelection, 0); | ||
this.props.onChange(e); | ||
if (this.props.onChange) { | ||
this.props.onChange(e); | ||
} | ||
} | ||
@@ -173,2 +202,10 @@ }, | ||
focus: function focus() { | ||
this.input.focus(); | ||
}, | ||
blur: function blur() { | ||
this.input.blur(); | ||
}, | ||
render: function render() { | ||
@@ -182,4 +219,5 @@ var _this = this; | ||
var placeholder = _props.placeholder; | ||
var placeholderChar = _props.placeholderChar; | ||
var props = _objectWithoutProperties(_props, ['mask', 'formatCharacters', 'size', 'placeholder']); | ||
var props = _objectWithoutProperties(_props, ['mask', 'formatCharacters', 'size', 'placeholder', 'placeholderChar']); | ||
@@ -186,0 +224,0 @@ var patternLength = this.mask.pattern.length; |
@@ -64,2 +64,21 @@ 'use strict'; | ||
componentWillUpdate: function componentWillUpdate(nextProps, nextState) { | ||
if (nextProps.mask !== this.props.mask) { | ||
this._updatePattern(nextProps); | ||
} | ||
}, | ||
componentDidUpdate: function componentDidUpdate(prevProps) { | ||
if (prevProps.mask !== this.props.mask && this.mask.selection.start) { | ||
this._updateInputSelection(); | ||
} | ||
}, | ||
_updatePattern: function _updatePattern(props) { | ||
this.mask.setPattern(props.mask, { | ||
value: this.mask.getRawValue(), | ||
selection: getSelection(this.input) | ||
}); | ||
}, | ||
_updateMaskSelection: function _updateMaskSelection() { | ||
@@ -104,3 +123,5 @@ this.mask.selection = getSelection(this.input); | ||
this._updateInputSelection(); | ||
this.props.onChange(e); | ||
if (this.props.onChange) { | ||
this.props.onChange(e); | ||
} | ||
} | ||
@@ -113,3 +134,5 @@ return; | ||
this._updateInputSelection(); | ||
this.props.onChange(e); | ||
if (this.props.onChange) { | ||
this.props.onChange(e); | ||
} | ||
} | ||
@@ -128,3 +151,5 @@ return; | ||
} | ||
this.props.onChange(e); | ||
if (this.props.onChange) { | ||
this.props.onChange(e); | ||
} | ||
} | ||
@@ -148,3 +173,5 @@ } | ||
this._updateInputSelection(); | ||
this.props.onChange(e); | ||
if (this.props.onChange) { | ||
this.props.onChange(e); | ||
} | ||
} | ||
@@ -163,3 +190,5 @@ }, | ||
setTimeout(this._updateInputSelection, 0); | ||
this.props.onChange(e); | ||
if (this.props.onChange) { | ||
this.props.onChange(e); | ||
} | ||
} | ||
@@ -173,2 +202,10 @@ }, | ||
focus: function focus() { | ||
this.input.focus(); | ||
}, | ||
blur: function blur() { | ||
this.input.blur(); | ||
}, | ||
render: function render() { | ||
@@ -182,4 +219,5 @@ var _this = this; | ||
var placeholder = _props.placeholder; | ||
var placeholderChar = _props.placeholderChar; | ||
var props = _objectWithoutProperties(_props, ['mask', 'formatCharacters', 'size', 'placeholder']); | ||
var props = _objectWithoutProperties(_props, ['mask', 'formatCharacters', 'size', 'placeholder', 'placeholderChar']); | ||
@@ -186,0 +224,0 @@ var patternLength = this.mask.pattern.length; |
{ | ||
"name": "react-maskedinput", | ||
"description": "Masked <input/> React component", | ||
"version": "3.2.1", | ||
"version": "3.2.2", | ||
"main": "./lib/index.js", | ||
@@ -6,0 +6,0 @@ "jsnext:main": "es6/index.js", |
/*! | ||
* react-maskedinput 3.1.0 - https://github.com/insin/react-maskedinput | ||
* react-maskedinput 3.2.1 - https://github.com/insin/react-maskedinput | ||
* MIT Licensed | ||
@@ -124,2 +124,21 @@ */ | ||
componentWillUpdate: function componentWillUpdate(nextProps, nextState) { | ||
if (nextProps.mask !== this.props.mask) { | ||
this._updatePattern(nextProps); | ||
} | ||
}, | ||
componentDidUpdate: function componentDidUpdate(prevProps) { | ||
if (prevProps.mask !== this.props.mask && this.mask.selection.start) { | ||
this._updateInputSelection(); | ||
} | ||
}, | ||
_updatePattern: function _updatePattern(props) { | ||
this.mask.setPattern(props.mask, { | ||
value: this.mask.getRawValue(), | ||
selection: getSelection(this.input) | ||
}); | ||
}, | ||
_updateMaskSelection: function _updateMaskSelection() { | ||
@@ -164,3 +183,5 @@ this.mask.selection = getSelection(this.input); | ||
this._updateInputSelection(); | ||
this.props.onChange(e); | ||
if (this.props.onChange) { | ||
this.props.onChange(e); | ||
} | ||
} | ||
@@ -173,3 +194,5 @@ return; | ||
this._updateInputSelection(); | ||
this.props.onChange(e); | ||
if (this.props.onChange) { | ||
this.props.onChange(e); | ||
} | ||
} | ||
@@ -188,3 +211,5 @@ return; | ||
} | ||
this.props.onChange(e); | ||
if (this.props.onChange) { | ||
this.props.onChange(e); | ||
} | ||
} | ||
@@ -208,3 +233,5 @@ } | ||
this._updateInputSelection(); | ||
this.props.onChange(e); | ||
if (this.props.onChange) { | ||
this.props.onChange(e); | ||
} | ||
} | ||
@@ -223,3 +250,5 @@ }, | ||
setTimeout(this._updateInputSelection, 0); | ||
this.props.onChange(e); | ||
if (this.props.onChange) { | ||
this.props.onChange(e); | ||
} | ||
} | ||
@@ -233,2 +262,10 @@ }, | ||
focus: function focus() { | ||
this.input.focus(); | ||
}, | ||
blur: function blur() { | ||
this.input.blur(); | ||
}, | ||
render: function render() { | ||
@@ -242,4 +279,5 @@ var _this = this; | ||
var placeholder = _props.placeholder; | ||
var placeholderChar = _props.placeholderChar; | ||
var props = _objectWithoutProperties(_props, ['mask', 'formatCharacters', 'size', 'placeholder']); | ||
var props = _objectWithoutProperties(_props, ['mask', 'formatCharacters', 'size', 'placeholder', 'placeholderChar']); | ||
@@ -270,3 +308,3 @@ var patternLength = this.mask.pattern.length; | ||
/** | ||
* Copyright 2013-2015, Facebook, Inc. | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
@@ -278,3 +316,2 @@ * | ||
* | ||
* @providesModule ExecutionEnvironment | ||
*/ | ||
@@ -312,4 +349,6 @@ | ||
'use strict'; | ||
/** | ||
* Copyright 2013-2015, Facebook, Inc. | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
@@ -321,8 +360,5 @@ * | ||
* | ||
* @providesModule containsNode | ||
* @typechecks | ||
* | ||
*/ | ||
'use strict'; | ||
var isTextNode = __webpack_require__(6); | ||
@@ -334,33 +370,18 @@ | ||
* Checks if a given DOM node contains or is another DOM node. | ||
* | ||
* @param {?DOMNode} outerNode Outer DOM node. | ||
* @param {?DOMNode} innerNode Inner DOM node. | ||
* @return {boolean} True if `outerNode` contains or is `innerNode`. | ||
*/ | ||
function containsNode(_x, _x2) { | ||
var _again = true; | ||
_function: while (_again) { | ||
var outerNode = _x, | ||
innerNode = _x2; | ||
_again = false; | ||
if (!outerNode || !innerNode) { | ||
return false; | ||
} else if (outerNode === innerNode) { | ||
return true; | ||
} else if (isTextNode(outerNode)) { | ||
return false; | ||
} else if (isTextNode(innerNode)) { | ||
_x = outerNode; | ||
_x2 = innerNode.parentNode; | ||
_again = true; | ||
continue _function; | ||
} else if (outerNode.contains) { | ||
return outerNode.contains(innerNode); | ||
} else if (outerNode.compareDocumentPosition) { | ||
return !!(outerNode.compareDocumentPosition(innerNode) & 16); | ||
} else { | ||
return false; | ||
} | ||
function containsNode(outerNode, innerNode) { | ||
if (!outerNode || !innerNode) { | ||
return false; | ||
} else if (outerNode === innerNode) { | ||
return true; | ||
} else if (isTextNode(outerNode)) { | ||
return false; | ||
} else if (isTextNode(innerNode)) { | ||
return containsNode(outerNode, innerNode.parentNode); | ||
} else if ('contains' in outerNode) { | ||
return outerNode.contains(innerNode); | ||
} else if (outerNode.compareDocumentPosition) { | ||
return !!(outerNode.compareDocumentPosition(innerNode) & 16); | ||
} else { | ||
return false; | ||
} | ||
@@ -376,3 +397,3 @@ } | ||
/** | ||
* Copyright 2013-2015, Facebook, Inc. | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
@@ -384,3 +405,2 @@ * | ||
* | ||
* @providesModule focusNode | ||
*/ | ||
@@ -393,2 +413,3 @@ | ||
*/ | ||
function focusNode(node) { | ||
@@ -409,4 +430,6 @@ // IE8 can throw "Can't move focus to the control because it is invisible, | ||
'use strict'; | ||
/** | ||
* Copyright 2013-2015, Facebook, Inc. | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
@@ -418,3 +441,2 @@ * | ||
* | ||
* @providesModule getActiveElement | ||
* @typechecks | ||
@@ -432,4 +454,2 @@ */ | ||
*/ | ||
'use strict'; | ||
function getActiveElement() /*?DOMElement*/{ | ||
@@ -452,4 +472,6 @@ if (typeof document === 'undefined') { | ||
'use strict'; | ||
/** | ||
* Copyright 2013-2015, Facebook, Inc. | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
@@ -461,3 +483,2 @@ * | ||
* | ||
* @providesModule isNode | ||
* @typechecks | ||
@@ -470,4 +491,2 @@ */ | ||
*/ | ||
'use strict'; | ||
function isNode(object) { | ||
@@ -483,4 +502,6 @@ return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string')); | ||
'use strict'; | ||
/** | ||
* Copyright 2013-2015, Facebook, Inc. | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
@@ -492,8 +513,5 @@ * | ||
* | ||
* @providesModule isTextNode | ||
* @typechecks | ||
*/ | ||
'use strict'; | ||
var isNode = __webpack_require__(5); | ||
@@ -1024,3 +1042,3 @@ | ||
/** | ||
* Copyright 2013-2015, Facebook, Inc. | ||
* Copyright 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
@@ -1154,3 +1172,3 @@ * | ||
if (typeof offsets.end === 'undefined') { | ||
if (offsets.end === undefined) { | ||
start = offsets.start; | ||
@@ -1179,3 +1197,3 @@ end = start; | ||
* the `extend` method, which means that even in modern IE, it's not possible | ||
* to programatically create a backward selection. Thus, for all IE | ||
* to programmatically create a backward selection. Thus, for all IE | ||
* versions, we use the old IE API to create our selections. | ||
@@ -1194,3 +1212,3 @@ * | ||
var start = Math.min(offsets.start, length); | ||
var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length); | ||
var end = offsets.end === undefined ? start : Math.min(offsets.end, length); | ||
@@ -1245,3 +1263,3 @@ // IE 11 uses modern selection, but doesn't support the extend method. | ||
/** | ||
* Copyright 2013-2015, Facebook, Inc. | ||
* Copyright 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
@@ -1321,3 +1339,3 @@ * | ||
}; | ||
} else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) { | ||
} else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') { | ||
// IE8 input. | ||
@@ -1350,3 +1368,3 @@ var range = document.selection.createRange(); | ||
var end = offsets.end; | ||
if (typeof end === 'undefined') { | ||
if (end === undefined) { | ||
end = start; | ||
@@ -1358,3 +1376,3 @@ } | ||
input.selectionEnd = Math.min(end, input.value.length); | ||
} else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) { | ||
} else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') { | ||
var range = input.createTextRange(); | ||
@@ -1378,3 +1396,3 @@ range.collapse(true); | ||
/** | ||
* Copyright 2013-2015, Facebook, Inc. | ||
* Copyright 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
@@ -1397,2 +1415,3 @@ * | ||
*/ | ||
function getLeafNode(node) { | ||
@@ -1458,3 +1477,3 @@ while (node && node.firstChild) { | ||
/** | ||
* Copyright 2013-2015, Facebook, Inc. | ||
* Copyright 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
@@ -1461,0 +1480,0 @@ * |
/*! | ||
* react-maskedinput 3.1.0 - https://github.com/insin/react-maskedinput | ||
* react-maskedinput 3.2.1 - https://github.com/insin/react-maskedinput | ||
* MIT Licensed | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.MaskedInput=e(require("react")):t.MaskedInput=e(t.React)}(this,function(t){return function(t){function e(s){if(n[s])return n[s].exports;var i=n[s]={exports:{},id:s,loaded:!1};return t[s].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function s(t,e){var n={};for(var s in t)e.indexOf(s)>=0||Object.prototype.hasOwnProperty.call(t,s)&&(n[s]=t[s]);return n}function i(t){return(t.ctrlKey||t.metaKey)&&t.keyCode===(t.shiftKey?d:p)}function r(t){return(t.ctrlKey||t.metaKey)&&t.keyCode===(t.shiftKey?p:d)}var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},o=n(12),l=n(9),h=l.getSelection,c=l.setSelection,u=n(7),p=90,d=89,f=o.createClass({displayName:"MaskedInput",propTypes:{mask:o.PropTypes.string.isRequired,formatCharacters:o.PropTypes.object,placeholderChar:o.PropTypes.string},getDefaultProps:function(){return{value:""}},componentWillMount:function(){var t={pattern:this.props.mask,value:this.props.value,formatCharacters:this.props.formatCharacters};this.props.placeholderChar&&(t.placeholderChar=this.props.placeholderChar),this.mask=new u(t)},componentWillReceiveProps:function(t){this.props.value!==t.value&&this.mask.setValue(t.value),this.props.mask!==t.mask&&this.mask.setPattern(t.mask,{value:this.mask.getRawValue()})},_updateMaskSelection:function(){this.mask.selection=h(this.input)},_updateInputSelection:function(){c(this.input,this.mask.selection)},_onChange:function(t){var e=this.mask.getValue();if(t.target.value!==e){if(t.target.value.length<e.length){var n=e.length-t.target.value.length;this._updateMaskSelection(),this.mask.selection.end=this.mask.selection.start+n,this.mask.backspace()}var s=this._getDisplayValue();t.target.value=s,s&&this._updateInputSelection()}this.props.onChange&&this.props.onChange(t)},_onKeyDown:function(t){if(i(t))return t.preventDefault(),void(this.mask.undo()&&(t.target.value=this._getDisplayValue(),this._updateInputSelection(),this.props.onChange(t)));if(r(t))return t.preventDefault(),void(this.mask.redo()&&(t.target.value=this._getDisplayValue(),this._updateInputSelection(),this.props.onChange(t)));if("Backspace"===t.key&&(t.preventDefault(),this._updateMaskSelection(),this.mask.backspace())){var e=this._getDisplayValue();t.target.value=e,e&&this._updateInputSelection(),this.props.onChange(t)}},_onKeyPress:function(t){t.metaKey||t.altKey||t.ctrlKey||"Enter"===t.key||(t.preventDefault(),this._updateMaskSelection(),this.mask.input(t.key)&&(t.target.value=this.mask.getValue(),this._updateInputSelection(),this.props.onChange(t)))},_onPaste:function(t){t.preventDefault(),this._updateMaskSelection(),this.mask.paste(t.clipboardData.getData("Text"))&&(t.target.value=this.mask.getValue(),setTimeout(this._updateInputSelection,0),this.props.onChange(t))},_getDisplayValue:function(){var t=this.mask.getValue();return t===this.mask.emptyValue?"":t},render:function(){var t=this,e=this.props,n=(e.mask,e.formatCharacters,e.size),i=e.placeholder,r=s(e,["mask","formatCharacters","size","placeholder"]),l=this.mask.pattern.length;return o.createElement("input",a({},r,{ref:function(e){return t.input=e},maxLength:l,onChange:this._onChange,onKeyDown:this._onKeyDown,onKeyPress:this._onKeyPress,onPaste:this._onPaste,placeholder:i||this.mask.emptyValue,size:n||l,value:this._getDisplayValue()}))}});t.exports=f},function(t,e){"use strict";var n=!("undefined"==typeof window||!window.document||!window.document.createElement),s={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};t.exports=s},function(t,e,n){"use strict";function s(t,e){var n=!0;t:for(;n;){var s=t,r=e;if(n=!1,s&&r){if(s===r)return!0;if(i(s))return!1;if(i(r)){t=s,e=r.parentNode,n=!0;continue t}return s.contains?s.contains(r):s.compareDocumentPosition?!!(16&s.compareDocumentPosition(r)):!1}return!1}}var i=n(6);t.exports=s},function(t,e){"use strict";function n(t){try{t.focus()}catch(e){}}t.exports=n},function(t,e){"use strict";function n(){if("undefined"==typeof document)return null;try{return document.activeElement||document.body}catch(t){return document.body}}t.exports=n},function(t,e){"use strict";function n(t){return!(!t||!("function"==typeof Node?t instanceof Node:"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName))}t.exports=n},function(t,e,n){"use strict";function s(t){return i(t)&&3==t.nodeType}var i=n(5);t.exports=s},function(t,e){"use strict";function n(t,e){if(e)for(var n=Object.keys(e),s=0,i=n.length;i>s;s++)t[n[s]]=e[n[s]];return t}function s(t){return n({},t)}function i(t){var e=s(p);if(t)for(var n=Object.keys(t),i=0,r=n.length;r>i;i++){var a=n[i];null==t[a]?delete e[a]:e[a]=t[a]}return e}function r(t,e,n){return this instanceof r?(this.placeholderChar=n||u,this.formatCharacters=e||p,this.source=t,this.pattern=[],this.length=0,this.firstEditableIndex=null,this.lastEditableIndex=null,this._editableIndices={},void this._parse()):new r(t,e,n)}function a(t){if(!(this instanceof a))return new a(t);if(t=n({formatCharacters:null,pattern:null,placeholderChar:u,selection:{start:0,end:0},value:""},t),null==t.pattern)throw new Error("InputMask: you must provide a pattern.");if(1!==t.placeholderChar.length)throw new Error("InputMask: placeholderChar should be a single character.");this.placeholderChar=t.placeholderChar,this.formatCharacters=i(t.formatCharacters),this.setPattern(t.pattern,{value:t.value,selection:t.selection})}var o="\\",l=/^\d$/,h=/^[A-Za-z]$/,c=/^[\dA-Za-z]$/,u="_",p={"*":{validate:function(t){return c.test(t)}},1:{validate:function(t){return l.test(t)}},a:{validate:function(t){return h.test(t)}},A:{validate:function(t){return h.test(t)},transform:function(t){return t.toUpperCase()}},"#":{validate:function(t){return c.test(t)},transform:function(t){return t.toUpperCase()}}};r.prototype._parse=function(){for(var t=this.source.split(""),e=0,n=[],s=0,i=t.length;i>s;s++){var r=t[s];if(r===o){if(s===i-1)throw new Error("InputMask: pattern ends with a raw "+o);r=t[++s]}else r in this.formatCharacters&&(null===this.firstEditableIndex&&(this.firstEditableIndex=e),this.lastEditableIndex=e,this._editableIndices[e]=!0);n.push(r),e++}if(null===this.firstEditableIndex)throw new Error('InputMask: pattern "'+this.source+'" does not contain any editable characters.');this.pattern=n,this.length=n.length},r.prototype.formatValue=function(t){for(var e=new Array(this.length),n=0,s=0,i=this.length;i>s;s++)this.isEditableIndex(s)?(e[s]=t.length>n&&this.isValidAtIndex(t[n],s)?this.transform(t[n],s):this.placeholderChar,n++):(e[s]=this.pattern[s],t.length>n&&t[n]===this.pattern[s]&&n++);return e},r.prototype.isEditableIndex=function(t){return!!this._editableIndices[t]},r.prototype.isValidAtIndex=function(t,e){return this.formatCharacters[this.pattern[e]].validate(t)},r.prototype.transform=function(t,e){var n=this.formatCharacters[this.pattern[e]];return"function"==typeof n.transform?n.transform(t):t},a.prototype.input=function(t){if(this.selection.start===this.selection.end&&this.selection.start===this.pattern.length)return!1;var e=s(this.selection),n=this.getValue(),i=this.selection.start;if(i<this.pattern.firstEditableIndex&&(i=this.pattern.firstEditableIndex),this.pattern.isEditableIndex(i)){if(!this.pattern.isValidAtIndex(t,i))return!1;this.value[i]=this.pattern.transform(t,i)}for(var r=this.selection.end-1;r>i;)this.pattern.isEditableIndex(r)&&(this.value[r]=this.placeholderChar),r--;for(this.selection.start=this.selection.end=i+1;this.pattern.length>this.selection.start&&!this.pattern.isEditableIndex(this.selection.start);)this.selection.start++,this.selection.end++;return null!=this._historyIndex&&(console.log("splice(",this._historyIndex,this._history.length-this._historyIndex,")"),this._history.splice(this._historyIndex,this._history.length-this._historyIndex),this._historyIndex=null),("input"!==this._lastOp||e.start!==e.end||null!==this._lastSelection&&e.start!==this._lastSelection.start)&&this._history.push({value:n,selection:e,lastOp:this._lastOp}),this._lastOp="input",this._lastSelection=s(this.selection),!0},a.prototype.backspace=function(){if(0===this.selection.start&&0===this.selection.end)return!1;var t=s(this.selection),e=this.getValue();if(this.selection.start===this.selection.end)this.pattern.isEditableIndex(this.selection.start-1)&&(this.value[this.selection.start-1]=this.placeholderChar),this.selection.start--,this.selection.end--;else{for(var n=this.selection.end-1;n>=this.selection.start;)this.pattern.isEditableIndex(n)&&(this.value[n]=this.placeholderChar),n--;this.selection.end=this.selection.start}return null!=this._historyIndex&&this._history.splice(this._historyIndex,this._history.length-this._historyIndex),("backspace"!==this._lastOp||t.start!==t.end||null!==this._lastSelection&&t.start!==this._lastSelection.start)&&this._history.push({value:e,selection:t,lastOp:this._lastOp}),this._lastOp="backspace",this._lastSelection=s(this.selection),!0},a.prototype.paste=function(t){var e={value:this.value.slice(),selection:s(this.selection),_lastOp:this._lastOp,_history:this._history.slice(),_historyIndex:this._historyIndex,_lastSelection:s(this._lastSelection)};if(this.selection.start<this.pattern.firstEditableIndex){for(var i=0,r=this.pattern.firstEditableIndex-this.selection.start;r>i;i++)if(t.charAt(i)!==this.pattern.pattern[i])return!1;t=t.substring(this.pattern.firstEditableIndex-this.selection.start),this.selection.start=this.pattern.firstEditableIndex}for(i=0,r=t.length;r>i&&this.selection.start<=this.pattern.lastEditableIndex;i++){var a=this.input(t.charAt(i));if(!a){if(this.selection.start>0){var o=this.selection.start-1;if(!this.pattern.isEditableIndex(o)&&t.charAt(i)===this.pattern.pattern[o])continue}return n(this,e),!1}}return!0},a.prototype.undo=function(){if(0===this._history.length||0===this._historyIndex)return!1;var t;if(null==this._historyIndex){this._historyIndex=this._history.length-1,t=this._history[this._historyIndex];var e=this.getValue();(t.value!==e||t.selection.start!==this.selection.start||t.selection.end!==this.selection.end)&&this._history.push({value:e,selection:s(this.selection),lastOp:this._lastOp,startUndo:!0})}else t=this._history[--this._historyIndex];return this.value=t.value.split(""),this.selection=t.selection,this._lastOp=t.lastOp,!0},a.prototype.redo=function(){if(0===this._history.length||null==this._historyIndex)return!1;var t=this._history[++this._historyIndex];return this._historyIndex===this._history.length-1&&(this._historyIndex=null,t.startUndo&&this._history.pop()),this.value=t.value.split(""),this.selection=t.selection,this._lastOp=t.lastOp,!0},a.prototype.setPattern=function(t,e){e=n({selection:{start:0,end:0},value:""},e),this.pattern=new r(t,this.formatCharacters,this.placeholderChar),this.setValue(e.value),this.emptyValue=this.pattern.formatValue([]).join(""),this.selection=e.selection,this._resetHistory()},a.prototype.setSelection=function(t){if(this.selection=s(t),this.selection.start===this.selection.end){if(this.selection.start<this.pattern.firstEditableIndex)return this.selection.start=this.selection.end=this.pattern.firstEditableIndex,!0;if(this.selection.end>this.pattern.lastEditableIndex+1)return this.selection.start=this.selection.end=this.pattern.lastEditableIndex+1,!0}return!1},a.prototype.setValue=function(t){null==t&&(t=""),this.value=this.pattern.formatValue(t.split(""))},a.prototype.getValue=function(){return this.value.join("")},a.prototype.getRawValue=function(){for(var t=[],e=0;e<this.value.length;e++)this.pattern._editableIndices[e]===!0&&t.push(this.value[e]);return t.join("")},a.prototype._resetHistory=function(){this._history=[],this._historyIndex=null,this._lastOp=null,this._lastSelection=s(this.selection)},a.Pattern=r,t.exports=a},function(t,e,n){"use strict";function s(t,e,n,s){return t===n&&e===s}function i(t){var e=document.selection,n=e.createRange(),s=n.text.length,i=n.duplicate();i.moveToElementText(t),i.setEndPoint("EndToStart",n);var r=i.text.length,a=r+s;return{start:r,end:a}}function r(t){var e=window.getSelection&&window.getSelection();if(!e||0===e.rangeCount)return null;var n=e.anchorNode,i=e.anchorOffset,r=e.focusNode,a=e.focusOffset,o=e.getRangeAt(0);try{o.startContainer.nodeType,o.endContainer.nodeType}catch(l){return null}var h=s(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset),c=h?0:o.toString().length,u=o.cloneRange();u.selectNodeContents(t),u.setEnd(o.startContainer,o.startOffset);var p=s(u.startContainer,u.startOffset,u.endContainer,u.endOffset),d=p?0:u.toString().length,f=d+c,v=document.createRange();v.setStart(n,i),v.setEnd(r,a);var y=v.collapsed;return{start:y?f:d,end:y?d:f}}function a(t,e){var n,s,i=document.selection.createRange().duplicate();"undefined"==typeof e.end?(n=e.start,s=n):e.start>e.end?(n=e.end,s=e.start):(n=e.start,s=e.end),i.moveToElementText(t),i.moveStart("character",n),i.setEndPoint("EndToStart",i),i.moveEnd("character",s-n),i.select()}function o(t,e){if(window.getSelection){var n=window.getSelection(),s=t[c()].length,i=Math.min(e.start,s),r="undefined"==typeof e.end?i:Math.min(e.end,s);if(!n.extend&&i>r){var a=r;r=i,i=a}var o=h(t,i),l=h(t,r);if(o&&l){var u=document.createRange();u.setStart(o.node,o.offset),n.removeAllRanges(),i>r?(n.addRange(u),n.extend(l.node,l.offset)):(u.setEnd(l.node,l.offset),n.addRange(u))}}}var l=n(1),h=n(10),c=n(11),u=l.canUseDOM&&"selection"in document&&!("getSelection"in window),p={getOffsets:u?i:r,setOffsets:u?a:o};t.exports=p},function(t,e,n){"use strict";function s(t){return r(document.documentElement,t)}var i=n(8),r=n(2),a=n(3),o=n(4),l={hasSelectionCapabilities:function(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&("input"===e&&"text"===t.type||"textarea"===e||"true"===t.contentEditable)},getSelectionInformation:function(){var t=o();return{focusedElem:t,selectionRange:l.hasSelectionCapabilities(t)?l.getSelection(t):null}},restoreSelection:function(t){var e=o(),n=t.focusedElem,i=t.selectionRange;e!==n&&s(n)&&(l.hasSelectionCapabilities(n)&&l.setSelection(n,i),a(n))},getSelection:function(t){var e;if("selectionStart"in t)e={start:t.selectionStart,end:t.selectionEnd};else if(document.selection&&t.nodeName&&"input"===t.nodeName.toLowerCase()){var n=document.selection.createRange();n.parentElement()===t&&(e={start:-n.moveStart("character",-t.value.length),end:-n.moveEnd("character",-t.value.length)})}else e=i.getOffsets(t);return e||{start:0,end:0}},setSelection:function(t,e){var n=e.start,s=e.end;if("undefined"==typeof s&&(s=n),"selectionStart"in t)t.selectionStart=n,t.selectionEnd=Math.min(s,t.value.length);else if(document.selection&&t.nodeName&&"input"===t.nodeName.toLowerCase()){var r=t.createTextRange();r.collapse(!0),r.moveStart("character",n),r.moveEnd("character",s-n),r.select()}else i.setOffsets(t,e)}};t.exports=l},function(t,e){"use strict";function n(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function s(t){for(;t;){if(t.nextSibling)return t.nextSibling;t=t.parentNode}}function i(t,e){for(var i=n(t),r=0,a=0;i;){if(3===i.nodeType){if(a=r+i.textContent.length,e>=r&&a>=e)return{node:i,offset:e-r};r=a}i=n(s(i))}}t.exports=i},function(t,e,n){"use strict";function s(){return!r&&i.canUseDOM&&(r="textContent"in document.documentElement?"textContent":"innerText"),r}var i=n(1),r=null;t.exports=s},function(e,n){e.exports=t}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.MaskedInput=e(require("react")):t.MaskedInput=e(t.React)}(this,function(t){return function(t){function e(s){if(n[s])return n[s].exports;var i=n[s]={exports:{},id:s,loaded:!1};return t[s].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function s(t,e){var n={};for(var s in t)e.indexOf(s)>=0||Object.prototype.hasOwnProperty.call(t,s)&&(n[s]=t[s]);return n}function i(t){return(t.ctrlKey||t.metaKey)&&t.keyCode===(t.shiftKey?d:p)}function r(t){return(t.ctrlKey||t.metaKey)&&t.keyCode===(t.shiftKey?p:d)}var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},o=n(12),l=n(9),h=l.getSelection,c=l.setSelection,u=n(7),p=90,d=89,f=o.createClass({displayName:"MaskedInput",propTypes:{mask:o.PropTypes.string.isRequired,formatCharacters:o.PropTypes.object,placeholderChar:o.PropTypes.string},getDefaultProps:function(){return{value:""}},componentWillMount:function(){var t={pattern:this.props.mask,value:this.props.value,formatCharacters:this.props.formatCharacters};this.props.placeholderChar&&(t.placeholderChar=this.props.placeholderChar),this.mask=new u(t)},componentWillReceiveProps:function(t){this.props.value!==t.value&&this.mask.setValue(t.value),this.props.mask!==t.mask&&this.mask.setPattern(t.mask,{value:this.mask.getRawValue()})},componentWillUpdate:function(t,e){t.mask!==this.props.mask&&this._updatePattern(t)},componentDidUpdate:function(t){t.mask!==this.props.mask&&this.mask.selection.start&&this._updateInputSelection()},_updatePattern:function(t){this.mask.setPattern(t.mask,{value:this.mask.getRawValue(),selection:h(this.input)})},_updateMaskSelection:function(){this.mask.selection=h(this.input)},_updateInputSelection:function(){c(this.input,this.mask.selection)},_onChange:function(t){var e=this.mask.getValue();if(t.target.value!==e){if(t.target.value.length<e.length){var n=e.length-t.target.value.length;this._updateMaskSelection(),this.mask.selection.end=this.mask.selection.start+n,this.mask.backspace()}var s=this._getDisplayValue();t.target.value=s,s&&this._updateInputSelection()}this.props.onChange&&this.props.onChange(t)},_onKeyDown:function(t){if(i(t))return t.preventDefault(),void(this.mask.undo()&&(t.target.value=this._getDisplayValue(),this._updateInputSelection(),this.props.onChange&&this.props.onChange(t)));if(r(t))return t.preventDefault(),void(this.mask.redo()&&(t.target.value=this._getDisplayValue(),this._updateInputSelection(),this.props.onChange&&this.props.onChange(t)));if("Backspace"===t.key&&(t.preventDefault(),this._updateMaskSelection(),this.mask.backspace())){var e=this._getDisplayValue();t.target.value=e,e&&this._updateInputSelection(),this.props.onChange&&this.props.onChange(t)}},_onKeyPress:function(t){t.metaKey||t.altKey||t.ctrlKey||"Enter"===t.key||(t.preventDefault(),this._updateMaskSelection(),this.mask.input(t.key)&&(t.target.value=this.mask.getValue(),this._updateInputSelection(),this.props.onChange&&this.props.onChange(t)))},_onPaste:function(t){t.preventDefault(),this._updateMaskSelection(),this.mask.paste(t.clipboardData.getData("Text"))&&(t.target.value=this.mask.getValue(),setTimeout(this._updateInputSelection,0),this.props.onChange&&this.props.onChange(t))},_getDisplayValue:function(){var t=this.mask.getValue();return t===this.mask.emptyValue?"":t},focus:function(){this.input.focus()},blur:function(){this.input.blur()},render:function(){var t=this,e=this.props,n=(e.mask,e.formatCharacters,e.size),i=e.placeholder,r=(e.placeholderChar,s(e,["mask","formatCharacters","size","placeholder","placeholderChar"])),l=this.mask.pattern.length;return o.createElement("input",a({},r,{ref:function(e){return t.input=e},maxLength:l,onChange:this._onChange,onKeyDown:this._onKeyDown,onKeyPress:this._onKeyPress,onPaste:this._onPaste,placeholder:i||this.mask.emptyValue,size:n||l,value:this._getDisplayValue()}))}});t.exports=f},function(t,e){"use strict";var n=!("undefined"==typeof window||!window.document||!window.document.createElement),s={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};t.exports=s},function(t,e,n){"use strict";function s(t,e){return!(!t||!e)&&(t===e||!i(t)&&(i(e)?s(t,e.parentNode):"contains"in t?t.contains(e):!!t.compareDocumentPosition&&!!(16&t.compareDocumentPosition(e))))}var i=n(6);t.exports=s},function(t,e){"use strict";function n(t){try{t.focus()}catch(e){}}t.exports=n},function(t,e){"use strict";function n(){if("undefined"==typeof document)return null;try{return document.activeElement||document.body}catch(t){return document.body}}t.exports=n},function(t,e){"use strict";function n(t){return!(!t||!("function"==typeof Node?t instanceof Node:"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName))}t.exports=n},function(t,e,n){"use strict";function s(t){return i(t)&&3==t.nodeType}var i=n(5);t.exports=s},function(t,e){"use strict";function n(t,e){if(e)for(var n=Object.keys(e),s=0,i=n.length;s<i;s++)t[n[s]]=e[n[s]];return t}function s(t){return n({},t)}function i(t){var e=s(p);if(t)for(var n=Object.keys(t),i=0,r=n.length;i<r;i++){var a=n[i];null==t[a]?delete e[a]:e[a]=t[a]}return e}function r(t,e,n){return this instanceof r?(this.placeholderChar=n||u,this.formatCharacters=e||p,this.source=t,this.pattern=[],this.length=0,this.firstEditableIndex=null,this.lastEditableIndex=null,this._editableIndices={},void this._parse()):new r(t,e,n)}function a(t){if(!(this instanceof a))return new a(t);if(t=n({formatCharacters:null,pattern:null,placeholderChar:u,selection:{start:0,end:0},value:""},t),null==t.pattern)throw new Error("InputMask: you must provide a pattern.");if(1!==t.placeholderChar.length)throw new Error("InputMask: placeholderChar should be a single character.");this.placeholderChar=t.placeholderChar,this.formatCharacters=i(t.formatCharacters),this.setPattern(t.pattern,{value:t.value,selection:t.selection})}var o="\\",l=/^\d$/,h=/^[A-Za-z]$/,c=/^[\dA-Za-z]$/,u="_",p={"*":{validate:function(t){return c.test(t)}},1:{validate:function(t){return l.test(t)}},a:{validate:function(t){return h.test(t)}},A:{validate:function(t){return h.test(t)},transform:function(t){return t.toUpperCase()}},"#":{validate:function(t){return c.test(t)},transform:function(t){return t.toUpperCase()}}};r.prototype._parse=function(){for(var t=this.source.split(""),e=0,n=[],s=0,i=t.length;s<i;s++){var r=t[s];if(r===o){if(s===i-1)throw new Error("InputMask: pattern ends with a raw "+o);r=t[++s]}else r in this.formatCharacters&&(null===this.firstEditableIndex&&(this.firstEditableIndex=e),this.lastEditableIndex=e,this._editableIndices[e]=!0);n.push(r),e++}if(null===this.firstEditableIndex)throw new Error('InputMask: pattern "'+this.source+'" does not contain any editable characters.');this.pattern=n,this.length=n.length},r.prototype.formatValue=function(t){for(var e=new Array(this.length),n=0,s=0,i=this.length;s<i;s++)this.isEditableIndex(s)?(e[s]=t.length>n&&this.isValidAtIndex(t[n],s)?this.transform(t[n],s):this.placeholderChar,n++):(e[s]=this.pattern[s],t.length>n&&t[n]===this.pattern[s]&&n++);return e},r.prototype.isEditableIndex=function(t){return!!this._editableIndices[t]},r.prototype.isValidAtIndex=function(t,e){return this.formatCharacters[this.pattern[e]].validate(t)},r.prototype.transform=function(t,e){var n=this.formatCharacters[this.pattern[e]];return"function"==typeof n.transform?n.transform(t):t},a.prototype.input=function(t){if(this.selection.start===this.selection.end&&this.selection.start===this.pattern.length)return!1;var e=s(this.selection),n=this.getValue(),i=this.selection.start;if(i<this.pattern.firstEditableIndex&&(i=this.pattern.firstEditableIndex),this.pattern.isEditableIndex(i)){if(!this.pattern.isValidAtIndex(t,i))return!1;this.value[i]=this.pattern.transform(t,i)}for(var r=this.selection.end-1;r>i;)this.pattern.isEditableIndex(r)&&(this.value[r]=this.placeholderChar),r--;for(this.selection.start=this.selection.end=i+1;this.pattern.length>this.selection.start&&!this.pattern.isEditableIndex(this.selection.start);)this.selection.start++,this.selection.end++;return null!=this._historyIndex&&(console.log("splice(",this._historyIndex,this._history.length-this._historyIndex,")"),this._history.splice(this._historyIndex,this._history.length-this._historyIndex),this._historyIndex=null),("input"!==this._lastOp||e.start!==e.end||null!==this._lastSelection&&e.start!==this._lastSelection.start)&&this._history.push({value:n,selection:e,lastOp:this._lastOp}),this._lastOp="input",this._lastSelection=s(this.selection),!0},a.prototype.backspace=function(){if(0===this.selection.start&&0===this.selection.end)return!1;var t=s(this.selection),e=this.getValue();if(this.selection.start===this.selection.end)this.pattern.isEditableIndex(this.selection.start-1)&&(this.value[this.selection.start-1]=this.placeholderChar),this.selection.start--,this.selection.end--;else{for(var n=this.selection.end-1;n>=this.selection.start;)this.pattern.isEditableIndex(n)&&(this.value[n]=this.placeholderChar),n--;this.selection.end=this.selection.start}return null!=this._historyIndex&&this._history.splice(this._historyIndex,this._history.length-this._historyIndex),("backspace"!==this._lastOp||t.start!==t.end||null!==this._lastSelection&&t.start!==this._lastSelection.start)&&this._history.push({value:e,selection:t,lastOp:this._lastOp}),this._lastOp="backspace",this._lastSelection=s(this.selection),!0},a.prototype.paste=function(t){var e={value:this.value.slice(),selection:s(this.selection),_lastOp:this._lastOp,_history:this._history.slice(),_historyIndex:this._historyIndex,_lastSelection:s(this._lastSelection)};if(this.selection.start<this.pattern.firstEditableIndex){for(var i=0,r=this.pattern.firstEditableIndex-this.selection.start;i<r;i++)if(t.charAt(i)!==this.pattern.pattern[i])return!1;t=t.substring(this.pattern.firstEditableIndex-this.selection.start),this.selection.start=this.pattern.firstEditableIndex}for(i=0,r=t.length;i<r&&this.selection.start<=this.pattern.lastEditableIndex;i++){var a=this.input(t.charAt(i));if(!a){if(this.selection.start>0){var o=this.selection.start-1;if(!this.pattern.isEditableIndex(o)&&t.charAt(i)===this.pattern.pattern[o])continue}return n(this,e),!1}}return!0},a.prototype.undo=function(){if(0===this._history.length||0===this._historyIndex)return!1;var t;if(null==this._historyIndex){this._historyIndex=this._history.length-1,t=this._history[this._historyIndex];var e=this.getValue();t.value===e&&t.selection.start===this.selection.start&&t.selection.end===this.selection.end||this._history.push({value:e,selection:s(this.selection),lastOp:this._lastOp,startUndo:!0})}else t=this._history[--this._historyIndex];return this.value=t.value.split(""),this.selection=t.selection,this._lastOp=t.lastOp,!0},a.prototype.redo=function(){if(0===this._history.length||null==this._historyIndex)return!1;var t=this._history[++this._historyIndex];return this._historyIndex===this._history.length-1&&(this._historyIndex=null,t.startUndo&&this._history.pop()),this.value=t.value.split(""),this.selection=t.selection,this._lastOp=t.lastOp,!0},a.prototype.setPattern=function(t,e){e=n({selection:{start:0,end:0},value:""},e),this.pattern=new r(t,this.formatCharacters,this.placeholderChar),this.setValue(e.value),this.emptyValue=this.pattern.formatValue([]).join(""),this.selection=e.selection,this._resetHistory()},a.prototype.setSelection=function(t){if(this.selection=s(t),this.selection.start===this.selection.end){if(this.selection.start<this.pattern.firstEditableIndex)return this.selection.start=this.selection.end=this.pattern.firstEditableIndex,!0;if(this.selection.end>this.pattern.lastEditableIndex+1)return this.selection.start=this.selection.end=this.pattern.lastEditableIndex+1,!0}return!1},a.prototype.setValue=function(t){null==t&&(t=""),this.value=this.pattern.formatValue(t.split(""))},a.prototype.getValue=function(){return this.value.join("")},a.prototype.getRawValue=function(){for(var t=[],e=0;e<this.value.length;e++)this.pattern._editableIndices[e]===!0&&t.push(this.value[e]);return t.join("")},a.prototype._resetHistory=function(){this._history=[],this._historyIndex=null,this._lastOp=null,this._lastSelection=s(this.selection)},a.Pattern=r,t.exports=a},function(t,e,n){"use strict";function s(t,e,n,s){return t===n&&e===s}function i(t){var e=document.selection,n=e.createRange(),s=n.text.length,i=n.duplicate();i.moveToElementText(t),i.setEndPoint("EndToStart",n);var r=i.text.length,a=r+s;return{start:r,end:a}}function r(t){var e=window.getSelection&&window.getSelection();if(!e||0===e.rangeCount)return null;var n=e.anchorNode,i=e.anchorOffset,r=e.focusNode,a=e.focusOffset,o=e.getRangeAt(0);try{o.startContainer.nodeType,o.endContainer.nodeType}catch(l){return null}var h=s(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset),c=h?0:o.toString().length,u=o.cloneRange();u.selectNodeContents(t),u.setEnd(o.startContainer,o.startOffset);var p=s(u.startContainer,u.startOffset,u.endContainer,u.endOffset),d=p?0:u.toString().length,f=d+c,v=document.createRange();v.setStart(n,i),v.setEnd(r,a);var m=v.collapsed;return{start:m?f:d,end:m?d:f}}function a(t,e){var n,s,i=document.selection.createRange().duplicate();void 0===e.end?(n=e.start,s=n):e.start>e.end?(n=e.end,s=e.start):(n=e.start,s=e.end),i.moveToElementText(t),i.moveStart("character",n),i.setEndPoint("EndToStart",i),i.moveEnd("character",s-n),i.select()}function o(t,e){if(window.getSelection){var n=window.getSelection(),s=t[c()].length,i=Math.min(e.start,s),r=void 0===e.end?i:Math.min(e.end,s);if(!n.extend&&i>r){var a=r;r=i,i=a}var o=h(t,i),l=h(t,r);if(o&&l){var u=document.createRange();u.setStart(o.node,o.offset),n.removeAllRanges(),i>r?(n.addRange(u),n.extend(l.node,l.offset)):(u.setEnd(l.node,l.offset),n.addRange(u))}}}var l=n(1),h=n(10),c=n(11),u=l.canUseDOM&&"selection"in document&&!("getSelection"in window),p={getOffsets:u?i:r,setOffsets:u?a:o};t.exports=p},function(t,e,n){"use strict";function s(t){return r(document.documentElement,t)}var i=n(8),r=n(2),a=n(3),o=n(4),l={hasSelectionCapabilities:function(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&("input"===e&&"text"===t.type||"textarea"===e||"true"===t.contentEditable)},getSelectionInformation:function(){var t=o();return{focusedElem:t,selectionRange:l.hasSelectionCapabilities(t)?l.getSelection(t):null}},restoreSelection:function(t){var e=o(),n=t.focusedElem,i=t.selectionRange;e!==n&&s(n)&&(l.hasSelectionCapabilities(n)&&l.setSelection(n,i),a(n))},getSelection:function(t){var e;if("selectionStart"in t)e={start:t.selectionStart,end:t.selectionEnd};else if(document.selection&&t.nodeName&&"input"===t.nodeName.toLowerCase()){var n=document.selection.createRange();n.parentElement()===t&&(e={start:-n.moveStart("character",-t.value.length),end:-n.moveEnd("character",-t.value.length)})}else e=i.getOffsets(t);return e||{start:0,end:0}},setSelection:function(t,e){var n=e.start,s=e.end;if(void 0===s&&(s=n),"selectionStart"in t)t.selectionStart=n,t.selectionEnd=Math.min(s,t.value.length);else if(document.selection&&t.nodeName&&"input"===t.nodeName.toLowerCase()){var r=t.createTextRange();r.collapse(!0),r.moveStart("character",n),r.moveEnd("character",s-n),r.select()}else i.setOffsets(t,e)}};t.exports=l},function(t,e){"use strict";function n(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function s(t){for(;t;){if(t.nextSibling)return t.nextSibling;t=t.parentNode}}function i(t,e){for(var i=n(t),r=0,a=0;i;){if(3===i.nodeType){if(a=r+i.textContent.length,r<=e&&a>=e)return{node:i,offset:e-r};r=a}i=n(s(i))}}t.exports=i},function(t,e,n){"use strict";function s(){return!r&&i.canUseDOM&&(r="textContent"in document.documentElement?"textContent":"innerText"),r}var i=n(1),r=null;t.exports=s},function(e,n){e.exports=t}])}); | ||
//# sourceMappingURL=react-maskedinput.min.js.map |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
197710
1710