Commit 9fe4fa3c authored by niksmr's avatar niksmr Committed by GitHub

Merge branch 'master' into feature/mask-as-object

parents 1056f6d3 61211263
node_modules/**/*
dist/**/*
src/ff-polyfill.js
\ No newline at end of file
{
"extends": "airbnb-base",
"env": {
"browser": true
}
}
\ No newline at end of file
!function(t){function e(i){if(s[i])return s[i].exports;var n=s[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var s={};return e.m=t,e.c=s,e.i=function(t){return t},e.d=function(t,s,i){e.o(t,s)||Object.defineProperty(t,s,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var s=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(s,"a",s),s},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=88)}({59:function(t,e,s){"use strict";e.a=function(){function t(t){var e="focus"===t.type?"focusin":"focusout",s=new CustomEvent(e,{bubbles:!0,cancelable:!1});s.c1Generated=!0,t.target.dispatchEvent(s)}function e(s){s.c1Generated||(i.removeEventListener("focus",t,!0),i.removeEventListener("blur",t,!0),i.removeEventListener("focusin",e,!0),i.removeEventListener("focusout",e,!0)),setTimeout(function(){i.removeEventListener("focusin",e,!0),i.removeEventListener("focusout",e,!0)})}var s=window,i=s.document;void 0===s.onfocusin&&(i.addEventListener("focus",t,!0),i.addEventListener("blur",t,!0),i.addEventListener("focusin",e,!0),i.addEventListener("focusout",e,!0))}},60:function(t,e,s){"use strict";function i(t,e){if(e)for(var s=Object.keys(e),i=0,n=s.length;i<n;i++)t[s[i]]=e[s[i]];return t}function n(t){return i({},t)}function r(t){var e=n(f);if(t)for(var s=Object.keys(t),i=0,r=s.length;i<r;i++){var a=s[i];null==t[a]?delete e[a]:e[a]=t[a]}return e}function a(t,e,s,i){return this instanceof a?(this.placeholderChar=s||p,this.formatCharacters=e||f,this.source=t,this.pattern=[],this.length=0,this.firstEditableIndex=null,this.lastEditableIndex=null,this._editableIndices={},this.isRevealingMask=i||!1,void this._parse()):new a(t,e,s)}function o(t){if(!(this instanceof o))return new o(t);if(t=i({formatCharacters:null,pattern:null,isRevealingMask:!1,placeholderChar:p,selection:{start:0,end:0},value:""},t),null==t.pattern)throw new Error("InputMask: you must provide a pattern.");if("string"!=typeof t.placeholderChar||t.placeholderChar.length>1)throw new Error("InputMask: placeholderChar should be a single character or an empty string.");this.placeholderChar=t.placeholderChar,this.formatCharacters=r(t.formatCharacters),this.setPattern(t.pattern,{value:t.value,selection:t.selection,isRevealingMask:t.isRevealingMask})}var l="\\",h=/^\d$/,u=/^[A-Za-z]$/,c=/^[\dA-Za-z]$/,p="_",f={"*":{validate:function(t){return c.test(t)}},1:{validate:function(t){return h.test(t)}},a:{validate:function(t){return u.test(t)}},A:{validate:function(t){return u.test(t)},transform:function(t){return t.toUpperCase()}},"#":{validate:function(t){return c.test(t)},transform:function(t){return t.toUpperCase()}}};a.prototype._parse=function(){for(var t=this.source.split(""),e=0,s=[],i=0,n=t.length;i<n;i++){var r=t[i];if(r===l){if(i===n-1)throw new Error("InputMask: pattern ends with a raw "+l);r=t[++i]}else r in this.formatCharacters&&(null===this.firstEditableIndex&&(this.firstEditableIndex=e),this.lastEditableIndex=e,this._editableIndices[e]=!0);s.push(r),e++}if(null===this.firstEditableIndex)throw new Error('InputMask: pattern "'+this.source+'" does not contain any editable characters.');this.pattern=s,this.length=s.length},a.prototype.formatValue=function(t){for(var e=new Array(this.length),s=0,i=0,n=this.length;i<n;i++)if(this.isEditableIndex(i)){if(this.isRevealingMask&&t.length<=s&&!this.isValidAtIndex(t[s],i))break;e[i]=t.length>s&&this.isValidAtIndex(t[s],i)?this.transform(t[s],i):this.placeholderChar,s++}else e[i]=this.pattern[i],t.length>s&&t[s]===this.pattern[i]&&s++;return e},a.prototype.isEditableIndex=function(t){return!!this._editableIndices[t]},a.prototype.isValidAtIndex=function(t,e){return this.formatCharacters[this.pattern[e]].validate(t)},a.prototype.transform=function(t,e){var s=this.formatCharacters[this.pattern[e]];return"function"==typeof s.transform?s.transform(t):t},o.prototype.input=function(t){if(this.selection.start===this.selection.end&&this.selection.start===this.pattern.length)return!1;var e=n(this.selection),s=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&&(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:s,selection:e,lastOp:this._lastOp}),this._lastOp="input",this._lastSelection=n(this.selection),!0},o.prototype.backspace=function(){if(0===this.selection.start&&0===this.selection.end)return!1;var t=n(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 s=this.selection.end-1;s>=this.selection.start;)this.pattern.isEditableIndex(s)&&(this.value[s]=this.placeholderChar),s--;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=n(this.selection),!0},o.prototype.paste=function(t){var e={value:this.value.slice(),selection:n(this.selection),_lastOp:this._lastOp,_history:this._history.slice(),_historyIndex:this._historyIndex,_lastSelection:n(this._lastSelection)};if(this.selection.start<this.pattern.firstEditableIndex){for(var s=0,r=this.pattern.firstEditableIndex-this.selection.start;s<r;s++)if(t.charAt(s)!==this.pattern.pattern[s])return!1;t=t.substring(this.pattern.firstEditableIndex-this.selection.start),this.selection.start=this.pattern.firstEditableIndex}for(s=0,r=t.length;s<r&&this.selection.start<=this.pattern.lastEditableIndex;s++){var a=this.input(t.charAt(s));if(!a){if(this.selection.start>0){var o=this.selection.start-1;if(!this.pattern.isEditableIndex(o)&&t.charAt(s)===this.pattern.pattern[o])continue}return i(this,e),!1}}return!0},o.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:n(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},o.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},o.prototype.setPattern=function(t,e){e=i({selection:{start:0,end:0},value:""},e),this.pattern=new a(t,this.formatCharacters,this.placeholderChar,e.isRevealingMask),this.setValue(e.value),this.emptyValue=this.pattern.formatValue([]).join(""),this.selection=e.selection,this._resetHistory()},o.prototype.setSelection=function(t){if(this.selection=n(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;for(var e=this.selection.start;e>=this.pattern.firstEditableIndex;){if(this.pattern.isEditableIndex(e-1)&&this.value[e-1]!==this.placeholderChar||e===this.pattern.firstEditableIndex){this.selection.start=this.selection.end=e;break}e--}return!0}return!1},o.prototype.setValue=function(t){null==t&&(t=""),this.value=this.pattern.formatValue(t.split(""))},o.prototype.getValue=function(){return this.value.join("")},o.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("")},o.prototype._resetHistory=function(){this._history=[],this._historyIndex=null,this._lastOp=null,this._lastSelection=n(this.selection)},o.Pattern=a,t.exports=o},88:function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=s(60),n=s.n(i),r=s(59);s.i(r.a)(),e.default={template:'\n <input ref="input"\n :value="value"\n @keydown="keyDown(arguments[0])"\n @keypress="keyPress(arguments[0])"\n @keyup="keyUp(arguments[0])"\n @textInput="textInput(arguments[0])"\n @mouseup="mouseUp(arguments[0])"\n @focus.prevent="focusin(arguments[0])"\n @focusout="focusout(arguments[0])"\n @cut="cut(arguments[0])"\n @copy="copy(arguments[0])"\n @paste="paste(arguments[0])"\n :disabled="mask_core===null || disabled"\n />\n ',name:"MaskedInput",data:function(){return{marginLeft:0,mask_core:null,updateAfterAll:!1}},props:{value:{type:String},mask:{type:String,required:!0,validator:function(t){return!!(t&&t.length>=1)}},placeholderChar:{type:String,default:"_",validator:function(t){return!(!t||1!==t.length)}},disabled:{type:Boolean,default:!1}},watch:{mask:function(t){this.initMask()},value:function(t){this.mask_core&&this.mask_core.setValue(t)}},mounted:function(){this.initMask()},methods:{initMask:function(){try{this.mask_core=new n.a({pattern:this.mask,value:"",placeholderChar:this.placeholderChar,formatCharacters:{a:{validate:function(t){return/^[A-Za-zА-Яа-я]$/.test(t)}},A:{validate:function(t){return/^[A-Za-zА-Яа-я]$/.test(t)},transform:function(t){return t.toUpperCase()}},"*":{validate:function(t){return/^[\dA-Za-zА-Яа-я]$/.test(t)}},"#":{validate:function(t){return/^[\dA-Za-zА-Яа-я]$/.test(t)},transform:function(t){return t.toUpperCase()}},"+":{validate:function(t){return!0}}}});for(var t=0;t<this.$refs.input.value.length;++t)this.mask_core.input(this.$refs.input.value[t]);this.mask_core.setSelection({start:0,end:0}),""===this.$refs.input.value?this.$emit("input","",""):this.updateToCoreState()}catch(t){console.error(t.message),this.mask_core=null,this.$refs.input.value="Error, see console",this.$emit("input",this.$refs.input.value,"")}},getValue:function(){return null===this.mask_core?"":this.mask_core.getValue()},keyDown:function(t){if(null===this.mask_core)return void t.preventDefault();switch(this.setNativeSelection(),t.keyCode){case 8:t.preventDefault(),(this.mask_core.selection.start>this.marginLeft||this.mask_core.selection.start!=this.mask_core.selection.end)&&(this.mask_core.backspace(),this.updateToCoreState());break;case 37:t.preventDefault(),this.$refs.input.selectionStart===this.$refs.input.selectionEnd&&(this.$refs.input.selectionEnd=this.$refs.input.selectionStart--),this.mask_core.selection={start:this.$refs.input.selectionStart,end:this.$refs.input.selectionStart},this.updateToCoreState();break;case 39:t.preventDefault(),this.$refs.input.selectionStart===this.$refs.input.selectionEnd&&this.$refs.input.selectionEnd++,this.mask_core.selection={start:this.$refs.input.selectionEnd,end:this.$refs.input.selectionEnd},this.updateToCoreState();break;case 35:t.preventDefault(),this.$refs.input.selectionStart=this.$refs.input.selectionEnd=this.$refs.input.value.length,this.mask_core.selection={start:this.$refs.input.selectionEnd,end:this.$refs.input.selectionEnd},this.updateToCoreState();break;case 36:t.preventDefault(),this.$refs.input.selectionStart=this.$refs.input.selectionEnd=0,this.mask_core.selection={start:this.$refs.input.selectionStart,end:this.$refs.input.selectionStart},this.updateToCoreState();break;case 46:t.preventDefault(),this.$refs.input.selectionStart===this.$refs.input.selectionEnd?(this.mask_core.setValue(""),this.mask_core.setSelection({start:0,end:0}),this.$refs.input.selectionStart=this.mask_core.selection.start,this.$refs.input.selectionEnd=this.mask_core.selection.start):this.mask_core.backspace(),this.updateToCoreState()}},input:function(t){},keyPress:function(t){if(!t.ctrlKey){var e=!!document.documentMode,s="undefined"!=typeof InstallTrigger;(e||s)&&(t.preventDefault(),t.data=t.key,this.textInput(t))}},textInput:function(t){t.preventDefault&&t.preventDefault(),this.mask_core.input(t.data)&&(this.updateAfterAll=!0),this.updateToCoreState()},keyUp:function(t){this.updateToCoreState(),this.updateAfterAll=!1},cut:function(t){if(t.preventDefault(),this.$refs.input.selectionStart!==this.$refs.input.selectionEnd){try{document.execCommand("copy")}catch(t){}this.mask_core.backspace(),this.updateToCoreState()}},copy:function(t){},paste:function(t){t.preventDefault();for(var e=t.clipboardData.getData("text"),s=0;s<e.length;++s)this.mask_core.input(e[s]);this.updateToCoreState()},updateToCoreState:function(){null!==this.mask_core&&(this.$refs.input.value!==this.mask_core.getValue()&&(this.$refs.input.value=this.mask_core.getValue(),this.$emit("input",this.$refs.input.value,this.mask_core.getRawValue())),this.$refs.input.selectionStart=this.mask_core.selection.start,this.$refs.input.selectionEnd=this.mask_core.selection.end)},focusin:function(t){},isEmpty:function(){return null===this.mask_core||this.mask_core.getValue()===this.mask_core.emptyValue},focusout:function(t){this.isEmpty()&&(this.$refs.input.value="",this.mask_core.setSelection({start:0,end:0}),this.$emit("input","",""))},setNativeSelection:function(){this.mask_core.selection={start:this.$refs.input.selectionStart,end:this.$refs.input.selectionEnd}},mouseUp:function(t){this.isEmpty()&&this.$refs.input.selectionStart===this.$refs.input.selectionEnd?(this.mask_core.setSelection({start:0,end:0}),this.$refs.input.selectionStart=this.mask_core.selection.start,this.$refs.input.selectionEnd=this.mask_core.selection.start,this.marginLeft=this.mask_core.selection.start,this.updateToCoreState()):this.setNativeSelection()}}}}});
//# sourceMappingURL=component.js.map
\ No newline at end of file
{"version":3,"sources":["webpack:///component.js","webpack:///webpack/bootstrap 47a8ae8809f0d5b186bd?698a","webpack:///./src/ff-polyfill.js?7c2c","webpack:///./~/inputmask-core/lib/index.js?3294","webpack:///./src/MaskedInput.js?cf87"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","59","__webpack_exports__","addPolyfill","e","type","event","CustomEvent","bubbles","cancelable","c1Generated","target","dispatchEvent","removePolyfill","removeEventListener","setTimeout","w","window","document","undefined","onfocusin","addEventListener","60","extend","dest","src","props","keys","length","copy","obj","mergeFormatCharacters","formatCharacters","merged","DEFAULT_FORMAT_CHARACTERS","chars","char","Pattern","source","placeholderChar","isRevealingMask","this","DEFAULT_PLACEHOLDER_CHAR","pattern","firstEditableIndex","lastEditableIndex","_editableIndices","_parse","InputMask","options","selection","start","end","Error","setPattern","ESCAPE_CHAR","DIGIT_RE","LETTER_RE","ALPHANNUMERIC_RE","*","validate","test","1","a","A","transform","toUpperCase","#","sourceChars","split","patternIndex","push","formatValue","valueBuffer","Array","valueIndex","isEditableIndex","isValidAtIndex","index","format","input","selectionBefore","valueBefore","getValue","inputIndex","_historyIndex","_history","splice","_lastOp","_lastSelection","lastOp","backspace","paste","initialState","slice","charAt","substring","valid","undo","historyItem","startUndo","redo","pop","setValue","emptyValue","join","_resetHistory","setSelection","getRawValue","rawValue","88","__WEBPACK_IMPORTED_MODULE_0_inputmask_core__","__WEBPACK_IMPORTED_MODULE_0_inputmask_core___default","__WEBPACK_IMPORTED_MODULE_1__ff_polyfill_js__","template","data","marginLeft","mask_core","updateAfterAll","String","mask","required","validator","default","disabled","Boolean","watch","newMask","initMask","newValue","mounted","methods","+","$refs","$emit","updateToCoreState","console","error","message","keyDown","preventDefault","setNativeSelection","keyCode","selectionStart","selectionEnd","keyPress","ctrlKey","isIE","documentMode","isFirefox","InstallTrigger","key","textInput","keyUp","cut","execCommand","err","text","clipboardData","getData","focusin","isEmpty","focusout","mouseUp"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA+DA,OAnCAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAK,EAAA,SAAAK,GAA2C,MAAAA,IAG3CV,EAAAW,EAAA,SAAAR,EAAAS,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ACPC,IAAK,IAEPX,KAAK6F,MAAM,QAAS,GAAI,MAI5BO,mBAlPO,WAmPLpG,KAAK4E,UAAUnE,WACbC,MAAOV,KAAK4F,MAAMrD,MAAM+D,eACxB3F,IAAKX,KAAK4F,MAAMrD,MAAMgE,eAI1BmB,QAzPO,SAyPC/J,GACFqC,KAAKwH,WACPxH,KAAK4F,MAAMrD,MAAM+D,iBAAmBtG,KAAK4F,MAAMrD,MAAMgE,cACrDvG,KAAK4E,UAAUV,cACbxD,MAAO,EACPC,IAAK,IAEPX,KAAK4F,MAAMrD,MAAM+D,eAAiBtG,KAAK4E,UAAUnE,UAAUC,MAC3DV,KAAK4F,MAAMrD,MAAMgE,aAAevG,KAAK4E,UAAUnE,UAAUC,MACzDV,KAAK2E,WAAa3E,KAAK4E,UAAUnE,UAAUC,MAC3CV,KAAK8F,qBAGL9F,KAAKoG","file":"component.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"/dist/\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 88);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 59:\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n//https://gist.github.com/nuxodin/9250e56a3ce6c0446efa\n/* harmony default export */ __webpack_exports__[\"a\"] = function () {\n var w = window,\n d = w.document;\n\n if (w.onfocusin === undefined) {\n d.addEventListener('focus', addPolyfill, true);\n d.addEventListener('blur', addPolyfill, true);\n d.addEventListener('focusin', removePolyfill, true);\n d.addEventListener('focusout', removePolyfill, true);\n }\n\n function addPolyfill(e) {\n var type = e.type === 'focus' ? 'focusin' : 'focusout';\n var event = new CustomEvent(type, {\n bubbles: true,\n cancelable: false\n });\n event.c1Generated = true;\n e.target.dispatchEvent(event);\n }\n\n function removePolyfill(e) {\n if (!e.c1Generated) {\n // focus after focusin, so chrome will the first time trigger tow times focusin\n d.removeEventListener('focus', addPolyfill, true);\n d.removeEventListener('blur', addPolyfill, true);\n d.removeEventListener('focusin', removePolyfill, true);\n d.removeEventListener('focusout', removePolyfill, true);\n }\n setTimeout(function () {\n d.removeEventListener('focusin', removePolyfill, true);\n d.removeEventListener('focusout', removePolyfill, true);\n });\n }\n};;\n\n/***/ }),\n\n/***/ 60:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction extend(dest, src) {\n if (src) {\n var props = Object.keys(src)\n for (var i = 0, l = props.length; i < l ; i++) {\n dest[props[i]] = src[props[i]]\n }\n }\n return dest\n}\n\nfunction copy(obj) {\n return extend({}, obj)\n}\n\n/**\n * Merge an object defining format characters into the defaults.\n * Passing null/undefined for en existing format character removes it.\n * Passing a definition for an existing format character overrides it.\n * @param {?Object} formatCharacters.\n */\nfunction mergeFormatCharacters(formatCharacters) {\n var merged = copy(DEFAULT_FORMAT_CHARACTERS)\n if (formatCharacters) {\n var chars = Object.keys(formatCharacters)\n for (var i = 0, l = chars.length; i < l ; i++) {\n var char = chars[i]\n if (formatCharacters[char] == null) {\n delete merged[char]\n }\n else {\n merged[char] = formatCharacters[char]\n }\n }\n }\n return merged\n}\n\nvar ESCAPE_CHAR = '\\\\'\n\nvar DIGIT_RE = /^\\d$/\nvar LETTER_RE = /^[A-Za-z]$/\nvar ALPHANNUMERIC_RE = /^[\\dA-Za-z]$/\n\nvar DEFAULT_PLACEHOLDER_CHAR = '_'\nvar DEFAULT_FORMAT_CHARACTERS = {\n '*': {\n validate: function(char) { return ALPHANNUMERIC_RE.test(char) }\n },\n '1': {\n validate: function(char) { return DIGIT_RE.test(char) }\n },\n 'a': {\n validate: function(char) { return LETTER_RE.test(char) }\n },\n 'A': {\n validate: function(char) { return LETTER_RE.test(char) },\n transform: function(char) { return char.toUpperCase() }\n },\n '#': {\n validate: function(char) { return ALPHANNUMERIC_RE.test(char) },\n transform: function(char) { return char.toUpperCase() }\n }\n}\n\n/**\n * @param {string} source\n * @patam {?Object} formatCharacters\n */\nfunction Pattern(source, formatCharacters, placeholderChar, isRevealingMask) {\n if (!(this instanceof Pattern)) {\n return new Pattern(source, formatCharacters, placeholderChar)\n }\n\n /** Placeholder character */\n this.placeholderChar = placeholderChar || DEFAULT_PLACEHOLDER_CHAR\n /** Format character definitions. */\n this.formatCharacters = formatCharacters || DEFAULT_FORMAT_CHARACTERS\n /** Pattern definition string with escape characters. */\n this.source = source\n /** Pattern characters after escape characters have been processed. */\n this.pattern = []\n /** Length of the pattern after escape characters have been processed. */\n this.length = 0\n /** Index of the first editable character. */\n this.firstEditableIndex = null\n /** Index of the last editable character. */\n this.lastEditableIndex = null\n /** Lookup for indices of editable characters in the pattern. */\n this._editableIndices = {}\n /** If true, only the pattern before the last valid value character shows. */\n this.isRevealingMask = isRevealingMask || false\n\n this._parse()\n}\n\nPattern.prototype._parse = function parse() {\n var sourceChars = this.source.split('')\n var patternIndex = 0\n var pattern = []\n\n for (var i = 0, l = sourceChars.length; i < l; i++) {\n var char = sourceChars[i]\n if (char === ESCAPE_CHAR) {\n if (i === l - 1) {\n throw new Error('InputMask: pattern ends with a raw ' + ESCAPE_CHAR)\n }\n char = sourceChars[++i]\n }\n else if (char in this.formatCharacters) {\n if (this.firstEditableIndex === null) {\n this.firstEditableIndex = patternIndex\n }\n this.lastEditableIndex = patternIndex\n this._editableIndices[patternIndex] = true\n }\n\n pattern.push(char)\n patternIndex++\n }\n\n if (this.firstEditableIndex === null) {\n throw new Error(\n 'InputMask: pattern \"' + this.source + '\" does not contain any editable characters.'\n )\n }\n\n this.pattern = pattern\n this.length = pattern.length\n}\n\n/**\n * @param {Array<string>} value\n * @return {Array<string>}\n */\nPattern.prototype.formatValue = function format(value) {\n var valueBuffer = new Array(this.length)\n var valueIndex = 0\n\n for (var i = 0, l = this.length; i < l ; i++) {\n if (this.isEditableIndex(i)) {\n if (this.isRevealingMask &&\n value.length <= valueIndex &&\n !this.isValidAtIndex(value[valueIndex], i)) {\n break\n }\n valueBuffer[i] = (value.length > valueIndex && this.isValidAtIndex(value[valueIndex], i)\n ? this.transform(value[valueIndex], i)\n : this.placeholderChar)\n valueIndex++\n }\n else {\n valueBuffer[i] = this.pattern[i]\n // Also allow the value to contain static values from the pattern by\n // advancing its index.\n if (value.length > valueIndex && value[valueIndex] === this.pattern[i]) {\n valueIndex++\n }\n }\n }\n\n return valueBuffer\n}\n\n/**\n * @param {number} index\n * @return {boolean}\n */\nPattern.prototype.isEditableIndex = function isEditableIndex(index) {\n return !!this._editableIndices[index]\n}\n\n/**\n * @param {string} char\n * @param {number} index\n * @return {boolean}\n */\nPattern.prototype.isValidAtIndex = function isValidAtIndex(char, index) {\n return this.formatCharacters[this.pattern[index]].validate(char)\n}\n\nPattern.prototype.transform = function transform(char, index) {\n var format = this.formatCharacters[this.pattern[index]]\n return typeof format.transform == 'function' ? format.transform(char) : char\n}\n\nfunction InputMask(options) {\n if (!(this instanceof InputMask)) { return new InputMask(options) }\n options = extend({\n formatCharacters: null,\n pattern: null,\n isRevealingMask: false,\n placeholderChar: DEFAULT_PLACEHOLDER_CHAR,\n selection: {start: 0, end: 0},\n value: ''\n }, options)\n\n if (options.pattern == null) {\n throw new Error('InputMask: you must provide a pattern.')\n }\n\n if (typeof options.placeholderChar !== 'string' || options.placeholderChar.length > 1) {\n throw new Error('InputMask: placeholderChar should be a single character or an empty string.')\n }\n\n this.placeholderChar = options.placeholderChar\n this.formatCharacters = mergeFormatCharacters(options.formatCharacters)\n this.setPattern(options.pattern, {\n value: options.value,\n selection: options.selection,\n isRevealingMask: options.isRevealingMask\n })\n}\n\n// Editing\n\n/**\n * Applies a single character of input based on the current selection.\n * @param {string} char\n * @return {boolean} true if a change has been made to value or selection as a\n * result of the input, false otherwise.\n */\nInputMask.prototype.input = function input(char) {\n // Ignore additional input if the cursor's at the end of the pattern\n if (this.selection.start === this.selection.end &&\n this.selection.start === this.pattern.length) {\n return false\n }\n\n var selectionBefore = copy(this.selection)\n var valueBefore = this.getValue()\n\n var inputIndex = this.selection.start\n\n // If the cursor or selection is prior to the first editable character, make\n // sure any input given is applied to it.\n if (inputIndex < this.pattern.firstEditableIndex) {\n inputIndex = this.pattern.firstEditableIndex\n }\n\n // Bail out or add the character to input\n if (this.pattern.isEditableIndex(inputIndex)) {\n if (!this.pattern.isValidAtIndex(char, inputIndex)) {\n return false\n }\n this.value[inputIndex] = this.pattern.transform(char, inputIndex)\n }\n\n // If multiple characters were selected, blank the remainder out based on the\n // pattern.\n var end = this.selection.end - 1\n while (end > inputIndex) {\n if (this.pattern.isEditableIndex(end)) {\n this.value[end] = this.placeholderChar\n }\n end--\n }\n\n // Advance the cursor to the next character\n this.selection.start = this.selection.end = inputIndex + 1\n\n // Skip over any subsequent static characters\n while (this.pattern.length > this.selection.start &&\n !this.pattern.isEditableIndex(this.selection.start)) {\n this.selection.start++\n this.selection.end++\n }\n\n // History\n if (this._historyIndex != null) {\n // Took more input after undoing, so blow any subsequent history away\n this._history.splice(this._historyIndex, this._history.length - this._historyIndex)\n this._historyIndex = null\n }\n if (this._lastOp !== 'input' ||\n selectionBefore.start !== selectionBefore.end ||\n this._lastSelection !== null && selectionBefore.start !== this._lastSelection.start) {\n this._history.push({value: valueBefore, selection: selectionBefore, lastOp: this._lastOp})\n }\n this._lastOp = 'input'\n this._lastSelection = copy(this.selection)\n\n return true\n}\n\n/**\n * Attempts to delete from the value based on the current cursor position or\n * selection.\n * @return {boolean} true if the value or selection changed as the result of\n * backspacing, false otherwise.\n */\nInputMask.prototype.backspace = function backspace() {\n // If the cursor is at the start there's nothing to do\n if (this.selection.start === 0 && this.selection.end === 0) {\n return false\n }\n\n var selectionBefore = copy(this.selection)\n var valueBefore = this.getValue()\n\n // No range selected - work on the character preceding the cursor\n if (this.selection.start === this.selection.end) {\n if (this.pattern.isEditableIndex(this.selection.start - 1)) {\n this.value[this.selection.start - 1] = this.placeholderChar\n }\n this.selection.start--\n this.selection.end--\n }\n // Range selected - delete characters and leave the cursor at the start of the selection\n else {\n var end = this.selection.end - 1\n while (end >= this.selection.start) {\n if (this.pattern.isEditableIndex(end)) {\n this.value[end] = this.placeholderChar\n }\n end--\n }\n this.selection.end = this.selection.start\n }\n\n // History\n if (this._historyIndex != null) {\n // Took more input after undoing, so blow any subsequent history away\n this._history.splice(this._historyIndex, this._history.length - this._historyIndex)\n }\n if (this._lastOp !== 'backspace' ||\n selectionBefore.start !== selectionBefore.end ||\n this._lastSelection !== null && selectionBefore.start !== this._lastSelection.start) {\n this._history.push({value: valueBefore, selection: selectionBefore, lastOp: this._lastOp})\n }\n this._lastOp = 'backspace'\n this._lastSelection = copy(this.selection)\n\n return true\n}\n\n/**\n * Attempts to paste a string of input at the current cursor position or over\n * the top of the current selection.\n * Invalid content at any position will cause the paste to be rejected, and it\n * may contain static parts of the mask's pattern.\n * @param {string} input\n * @return {boolean} true if the paste was successful, false otherwise.\n */\nInputMask.prototype.paste = function paste(input) {\n // This is necessary because we're just calling input() with each character\n // and rolling back if any were invalid, rather than checking up-front.\n var initialState = {\n value: this.value.slice(),\n selection: copy(this.selection),\n _lastOp: this._lastOp,\n _history: this._history.slice(),\n _historyIndex: this._historyIndex,\n _lastSelection: copy(this._lastSelection)\n }\n\n // If there are static characters at the start of the pattern and the cursor\n // or selection is within them, the static characters must match for a valid\n // paste.\n if (this.selection.start < this.pattern.firstEditableIndex) {\n for (var i = 0, l = this.pattern.firstEditableIndex - this.selection.start; i < l; i++) {\n if (input.charAt(i) !== this.pattern.pattern[i]) {\n return false\n }\n }\n\n // Continue as if the selection and input started from the editable part of\n // the pattern.\n input = input.substring(this.pattern.firstEditableIndex - this.selection.start)\n this.selection.start = this.pattern.firstEditableIndex\n }\n\n for (i = 0, l = input.length;\n i < l && this.selection.start <= this.pattern.lastEditableIndex;\n i++) {\n var valid = this.input(input.charAt(i))\n // Allow static parts of the pattern to appear in pasted input - they will\n // already have been stepped over by input(), so verify that the value\n // deemed invalid by input() was the expected static character.\n if (!valid) {\n if (this.selection.start > 0) {\n // XXX This only allows for one static character to be skipped\n var patternIndex = this.selection.start - 1\n if (!this.pattern.isEditableIndex(patternIndex) &&\n input.charAt(i) === this.pattern.pattern[patternIndex]) {\n continue\n }\n }\n extend(this, initialState)\n return false\n }\n }\n\n return true\n}\n\n// History\n\nInputMask.prototype.undo = function undo() {\n // If there is no history, or nothing more on the history stack, we can't undo\n if (this._history.length === 0 || this._historyIndex === 0) {\n return false\n }\n\n var historyItem\n if (this._historyIndex == null) {\n // Not currently undoing, set up the initial history index\n this._historyIndex = this._history.length - 1\n historyItem = this._history[this._historyIndex]\n // Add a new history entry if anything has changed since the last one, so we\n // can redo back to the initial state we started undoing from.\n var value = this.getValue()\n if (historyItem.value !== value ||\n historyItem.selection.start !== this.selection.start ||\n historyItem.selection.end !== this.selection.end) {\n this._history.push({value: value, selection: copy(this.selection), lastOp: this._lastOp, startUndo: true})\n }\n }\n else {\n historyItem = this._history[--this._historyIndex]\n }\n\n this.value = historyItem.value.split('')\n this.selection = historyItem.selection\n this._lastOp = historyItem.lastOp\n return true\n}\n\nInputMask.prototype.redo = function redo() {\n if (this._history.length === 0 || this._historyIndex == null) {\n return false\n }\n var historyItem = this._history[++this._historyIndex]\n // If this is the last history item, we're done redoing\n if (this._historyIndex === this._history.length - 1) {\n this._historyIndex = null\n // If the last history item was only added to start undoing, remove it\n if (historyItem.startUndo) {\n this._history.pop()\n }\n }\n this.value = historyItem.value.split('')\n this.selection = historyItem.selection\n this._lastOp = historyItem.lastOp\n return true\n}\n\n// Getters & setters\n\nInputMask.prototype.setPattern = function setPattern(pattern, options) {\n options = extend({\n selection: {start: 0, end: 0},\n value: ''\n }, options)\n this.pattern = new Pattern(pattern, this.formatCharacters, this.placeholderChar, options.isRevealingMask)\n this.setValue(options.value)\n this.emptyValue = this.pattern.formatValue([]).join('')\n this.selection = options.selection\n this._resetHistory()\n}\n\nInputMask.prototype.setSelection = function setSelection(selection) {\n this.selection = copy(selection)\n if (this.selection.start === this.selection.end) {\n if (this.selection.start < this.pattern.firstEditableIndex) {\n this.selection.start = this.selection.end = this.pattern.firstEditableIndex\n return true\n }\n // Set selection to the first editable, non-placeholder character before the selection\n // OR to the beginning of the pattern\n var index = this.selection.start\n while (index >= this.pattern.firstEditableIndex) {\n if (this.pattern.isEditableIndex(index - 1) &&\n this.value[index - 1] !== this.placeholderChar ||\n index === this.pattern.firstEditableIndex) {\n this.selection.start = this.selection.end = index\n break\n }\n index--\n }\n return true\n }\n return false\n}\n\nInputMask.prototype.setValue = function setValue(value) {\n if (value == null) {\n value = ''\n }\n this.value = this.pattern.formatValue(value.split(''))\n}\n\nInputMask.prototype.getValue = function getValue() {\n return this.value.join('')\n}\n\nInputMask.prototype.getRawValue = function getRawValue() {\n var rawValue = []\n for (var i = 0; i < this.value.length; i++) {\n if (this.pattern._editableIndices[i] === true) {\n rawValue.push(this.value[i])\n }\n }\n return rawValue.join('')\n}\n\nInputMask.prototype._resetHistory = function _resetHistory() {\n this._history = []\n this._historyIndex = null\n this._lastOp = null\n this._lastSelection = copy(this.selection)\n}\n\nInputMask.Pattern = Pattern\n\nmodule.exports = InputMask\n\n\n/***/ }),\n\n/***/ 88:\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_inputmask_core__ = __webpack_require__(60);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_inputmask_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_inputmask_core__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ff_polyfill_js__ = __webpack_require__(59);\n\n //Firefox Polyfill for focus events\n__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__ff_polyfill_js__[\"a\" /* default */])();\n\n/* harmony default export */ __webpack_exports__[\"default\"] = {\n\n template: '\\n <input ref=\"input\"\\n :value=\"value\"\\n @keydown=\"keyDown(arguments[0])\"\\n @keypress=\"keyPress(arguments[0])\"\\n @keyup=\"keyUp(arguments[0])\"\\n @textInput=\"textInput(arguments[0])\"\\n @mouseup=\"mouseUp(arguments[0])\"\\n @focus.prevent=\"focusin(arguments[0])\"\\n @focusout=\"focusout(arguments[0])\"\\n @cut=\"cut(arguments[0])\"\\n @copy=\"copy(arguments[0])\"\\n @paste=\"paste(arguments[0])\"\\n :disabled=\"mask_core===null || disabled\"\\n />\\n ',\n\n name: 'MaskedInput',\n\n data: function data() {\n return {\n marginLeft: 0,\n mask_core: null,\n updateAfterAll: false\n };\n },\n\n props: {\n value: {\n type: String\n },\n mask: {\n type: String,\n required: true,\n validator: function validator(value) {\n return !!(value && value.length >= 1);\n }\n },\n placeholderChar: {\n type: String,\n default: '_',\n validator: function validator(value) {\n return !!(value && value.length === 1);\n }\n },\n disabled: {\n type: Boolean,\n default: false\n }\n },\n\n watch: {\n mask: function mask(newMask) {\n this.initMask();\n },\n value: function value(newValue) {\n if (this.mask_core) this.mask_core.setValue(newValue); //For multiple inputs support\n }\n },\n\n mounted: function mounted() {\n this.initMask();\n },\n\n\n methods: {\n initMask: function initMask() {\n try {\n this.mask_core = new __WEBPACK_IMPORTED_MODULE_0_inputmask_core___default.a({\n pattern: this.mask,\n value: '',\n placeholderChar: this.placeholderChar,\n formatCharacters: {\n 'a': {\n validate: function validate(char) {\n return (/^[A-Za-zА-Яа-я]$/.test(char)\n );\n }\n },\n 'A': {\n validate: function validate(char) {\n return (/^[A-Za-zА-Яа-я]$/.test(char)\n );\n },\n transform: function transform(char) {\n return char.toUpperCase();\n }\n },\n '*': {\n validate: function validate(char) {\n return (/^[\\dA-Za-zА-Яа-я]$/.test(char)\n );\n }\n },\n '#': {\n validate: function validate(char) {\n return (/^[\\dA-Za-zА-Яа-я]$/.test(char)\n );\n },\n transform: function transform(char) {\n return char.toUpperCase();\n }\n },\n '+': {\n validate: function validate(char) {\n return true;\n }\n }\n }\n });\n for (var i = 0; i < this.$refs.input.value.length; ++i) {\n this.mask_core.input(this.$refs.input.value[i]);\n }\n this.mask_core.setSelection({\n start: 0,\n end: 0\n });\n if (this.$refs.input.value === '') {\n this.$emit('input', '', '');\n } else {\n this.updateToCoreState();\n }\n } catch (e) {\n console.error(e.message);\n this.mask_core = null;\n this.$refs.input.value = 'Error, see console';\n this.$emit('input', this.$refs.input.value, '');\n }\n },\n getValue: function getValue() {\n if (this.mask_core === null) return '';\n return this.mask_core.getValue();\n },\n keyDown: function keyDown(e) {\n //Always\n if (this.mask_core === null) {\n e.preventDefault();\n return;\n }\n this.setNativeSelection();\n\n switch (e.keyCode) {\n\n //backspace\n case 8:\n e.preventDefault();\n if (this.mask_core.selection.start > this.marginLeft || this.mask_core.selection.start != this.mask_core.selection.end) {\n this.mask_core.backspace();\n this.updateToCoreState();\n }\n break;\n\n //left arrow\n case 37:\n e.preventDefault();\n\n if (this.$refs.input.selectionStart === this.$refs.input.selectionEnd) this.$refs.input.selectionEnd = this.$refs.input.selectionStart--;\n\n this.mask_core.selection = {\n start: this.$refs.input.selectionStart,\n end: this.$refs.input.selectionStart\n };\n this.updateToCoreState();\n break;\n\n //right arrow\n case 39:\n e.preventDefault();\n\n if (this.$refs.input.selectionStart === this.$refs.input.selectionEnd) this.$refs.input.selectionEnd++;\n\n this.mask_core.selection = {\n start: this.$refs.input.selectionEnd,\n end: this.$refs.input.selectionEnd\n };\n this.updateToCoreState();\n break;\n\n //end\n case 35:\n e.preventDefault();\n this.$refs.input.selectionStart = this.$refs.input.selectionEnd = this.$refs.input.value.length;\n\n this.mask_core.selection = {\n start: this.$refs.input.selectionEnd,\n end: this.$refs.input.selectionEnd\n };\n this.updateToCoreState();\n break;\n\n //home\n case 36:\n e.preventDefault();\n this.$refs.input.selectionStart = this.$refs.input.selectionEnd = 0;\n this.mask_core.selection = {\n start: this.$refs.input.selectionStart,\n end: this.$refs.input.selectionStart\n };\n this.updateToCoreState();\n break;\n\n //delete\n case 46:\n e.preventDefault();\n\n if (this.$refs.input.selectionStart === this.$refs.input.selectionEnd) {\n this.mask_core.setValue('');\n this.mask_core.setSelection({\n start: 0,\n end: 0\n });\n this.$refs.input.selectionStart = this.mask_core.selection.start;\n this.$refs.input.selectionEnd = this.mask_core.selection.start;\n } else {\n this.mask_core.backspace();\n }\n this.updateToCoreState();\n break;\n }\n },\n input: function input(e) {},\n keyPress: function keyPress(e) {\n //works only on Desktop\n if (e.ctrlKey) return; //Fix FF copy/paste issue\n /*\r\n IE & FF are not trigger textInput event, so we have to force it\r\n */\n var isIE = /*@cc_on!@*/false || !!document.documentMode; //by http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser\n var isFirefox = typeof InstallTrigger !== 'undefined';\n\n if (isIE || isFirefox) {\n e.preventDefault();\n e.data = e.key;\n this.textInput(e);\n }\n },\n textInput: function textInput(e) {\n if (e.preventDefault) e.preventDefault();\n if (this.mask_core.input(e.data)) {\n this.updateAfterAll = true;\n }\n this.updateToCoreState();\n },\n keyUp: function keyUp(e) {\n this.updateToCoreState();\n this.updateAfterAll = false;\n },\n cut: function cut(e) {\n e.preventDefault();\n if (this.$refs.input.selectionStart !== this.$refs.input.selectionEnd) {\n /*let text = this.$refs.input.value.slice(\r\n this.$refs.input.selectionStart,\r\n this.$refs.input.selectionEnd\r\n )*/\n try {\n document.execCommand('copy');\n } catch (err) {}\n this.mask_core.backspace();\n this.updateToCoreState();\n }\n },\n copy: function copy(e) {},\n paste: function paste(e) {\n e.preventDefault();\n var text = e.clipboardData.getData('text');\n for (var i = 0; i < text.length; ++i) {\n this.mask_core.input(text[i]);\n }\n this.updateToCoreState();\n },\n updateToCoreState: function updateToCoreState() {\n if (this.mask_core === null) {\n return;\n }\n if (this.$refs.input.value !== this.mask_core.getValue()) {\n this.$refs.input.value = this.mask_core.getValue();\n this.$emit('input', this.$refs.input.value, this.mask_core.getRawValue());\n }\n this.$refs.input.selectionStart = this.mask_core.selection.start;\n this.$refs.input.selectionEnd = this.mask_core.selection.end;\n },\n focusin: function focusin(e) {},\n isEmpty: function isEmpty() {\n if (this.mask_core === null) return true;\n return this.mask_core.getValue() === this.mask_core.emptyValue;\n },\n focusout: function focusout(e) {\n if (this.isEmpty()) {\n this.$refs.input.value = '';\n this.mask_core.setSelection({\n start: 0,\n end: 0\n });\n this.$emit('input', '', '');\n }\n },\n setNativeSelection: function setNativeSelection() {\n this.mask_core.selection = {\n start: this.$refs.input.selectionStart,\n end: this.$refs.input.selectionEnd\n };\n },\n mouseUp: function mouseUp(e) {\n if (this.isEmpty() && this.$refs.input.selectionStart === this.$refs.input.selectionEnd) {\n this.mask_core.setSelection({\n start: 0,\n end: 0\n });\n this.$refs.input.selectionStart = this.mask_core.selection.start;\n this.$refs.input.selectionEnd = this.mask_core.selection.start;\n this.marginLeft = this.mask_core.selection.start;\n this.updateToCoreState();\n } else {\n this.setNativeSelection();\n }\n }\n }\n\n};\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// component.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/dist/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 88);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 47a8ae8809f0d5b186bd","//https://gist.github.com/nuxodin/9250e56a3ce6c0446efa\nexport default function() {\n var w = window,\n d = w.document;\n\n if (w.onfocusin === undefined) {\n d.addEventListener('focus', addPolyfill, true);\n d.addEventListener('blur', addPolyfill, true);\n d.addEventListener('focusin', removePolyfill, true);\n d.addEventListener('focusout', removePolyfill, true);\n }\n\n function addPolyfill(e) {\n var type = e.type === 'focus' ? 'focusin' : 'focusout';\n var event = new CustomEvent(type, {\n bubbles: true,\n cancelable: false\n });\n event.c1Generated = true;\n e.target.dispatchEvent(event);\n }\n\n function removePolyfill(e) {\n if (!e.c1Generated) { // focus after focusin, so chrome will the first time trigger tow times focusin\n d.removeEventListener('focus', addPolyfill, true);\n d.removeEventListener('blur', addPolyfill, true);\n d.removeEventListener('focusin', removePolyfill, true);\n d.removeEventListener('focusout', removePolyfill, true);\n }\n setTimeout(function () {\n d.removeEventListener('focusin', removePolyfill, true);\n d.removeEventListener('focusout', removePolyfill, true);\n });\n }\n\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/ff-polyfill.js","'use strict'\n\nfunction extend(dest, src) {\n if (src) {\n var props = Object.keys(src)\n for (var i = 0, l = props.length; i < l ; i++) {\n dest[props[i]] = src[props[i]]\n }\n }\n return dest\n}\n\nfunction copy(obj) {\n return extend({}, obj)\n}\n\n/**\n * Merge an object defining format characters into the defaults.\n * Passing null/undefined for en existing format character removes it.\n * Passing a definition for an existing format character overrides it.\n * @param {?Object} formatCharacters.\n */\nfunction mergeFormatCharacters(formatCharacters) {\n var merged = copy(DEFAULT_FORMAT_CHARACTERS)\n if (formatCharacters) {\n var chars = Object.keys(formatCharacters)\n for (var i = 0, l = chars.length; i < l ; i++) {\n var char = chars[i]\n if (formatCharacters[char] == null) {\n delete merged[char]\n }\n else {\n merged[char] = formatCharacters[char]\n }\n }\n }\n return merged\n}\n\nvar ESCAPE_CHAR = '\\\\'\n\nvar DIGIT_RE = /^\\d$/\nvar LETTER_RE = /^[A-Za-z]$/\nvar ALPHANNUMERIC_RE = /^[\\dA-Za-z]$/\n\nvar DEFAULT_PLACEHOLDER_CHAR = '_'\nvar DEFAULT_FORMAT_CHARACTERS = {\n '*': {\n validate: function(char) { return ALPHANNUMERIC_RE.test(char) }\n },\n '1': {\n validate: function(char) { return DIGIT_RE.test(char) }\n },\n 'a': {\n validate: function(char) { return LETTER_RE.test(char) }\n },\n 'A': {\n validate: function(char) { return LETTER_RE.test(char) },\n transform: function(char) { return char.toUpperCase() }\n },\n '#': {\n validate: function(char) { return ALPHANNUMERIC_RE.test(char) },\n transform: function(char) { return char.toUpperCase() }\n }\n}\n\n/**\n * @param {string} source\n * @patam {?Object} formatCharacters\n */\nfunction Pattern(source, formatCharacters, placeholderChar, isRevealingMask) {\n if (!(this instanceof Pattern)) {\n return new Pattern(source, formatCharacters, placeholderChar)\n }\n\n /** Placeholder character */\n this.placeholderChar = placeholderChar || DEFAULT_PLACEHOLDER_CHAR\n /** Format character definitions. */\n this.formatCharacters = formatCharacters || DEFAULT_FORMAT_CHARACTERS\n /** Pattern definition string with escape characters. */\n this.source = source\n /** Pattern characters after escape characters have been processed. */\n this.pattern = []\n /** Length of the pattern after escape characters have been processed. */\n this.length = 0\n /** Index of the first editable character. */\n this.firstEditableIndex = null\n /** Index of the last editable character. */\n this.lastEditableIndex = null\n /** Lookup for indices of editable characters in the pattern. */\n this._editableIndices = {}\n /** If true, only the pattern before the last valid value character shows. */\n this.isRevealingMask = isRevealingMask || false\n\n this._parse()\n}\n\nPattern.prototype._parse = function parse() {\n var sourceChars = this.source.split('')\n var patternIndex = 0\n var pattern = []\n\n for (var i = 0, l = sourceChars.length; i < l; i++) {\n var char = sourceChars[i]\n if (char === ESCAPE_CHAR) {\n if (i === l - 1) {\n throw new Error('InputMask: pattern ends with a raw ' + ESCAPE_CHAR)\n }\n char = sourceChars[++i]\n }\n else if (char in this.formatCharacters) {\n if (this.firstEditableIndex === null) {\n this.firstEditableIndex = patternIndex\n }\n this.lastEditableIndex = patternIndex\n this._editableIndices[patternIndex] = true\n }\n\n pattern.push(char)\n patternIndex++\n }\n\n if (this.firstEditableIndex === null) {\n throw new Error(\n 'InputMask: pattern \"' + this.source + '\" does not contain any editable characters.'\n )\n }\n\n this.pattern = pattern\n this.length = pattern.length\n}\n\n/**\n * @param {Array<string>} value\n * @return {Array<string>}\n */\nPattern.prototype.formatValue = function format(value) {\n var valueBuffer = new Array(this.length)\n var valueIndex = 0\n\n for (var i = 0, l = this.length; i < l ; i++) {\n if (this.isEditableIndex(i)) {\n if (this.isRevealingMask &&\n value.length <= valueIndex &&\n !this.isValidAtIndex(value[valueIndex], i)) {\n break\n }\n valueBuffer[i] = (value.length > valueIndex && this.isValidAtIndex(value[valueIndex], i)\n ? this.transform(value[valueIndex], i)\n : this.placeholderChar)\n valueIndex++\n }\n else {\n valueBuffer[i] = this.pattern[i]\n // Also allow the value to contain static values from the pattern by\n // advancing its index.\n if (value.length > valueIndex && value[valueIndex] === this.pattern[i]) {\n valueIndex++\n }\n }\n }\n\n return valueBuffer\n}\n\n/**\n * @param {number} index\n * @return {boolean}\n */\nPattern.prototype.isEditableIndex = function isEditableIndex(index) {\n return !!this._editableIndices[index]\n}\n\n/**\n * @param {string} char\n * @param {number} index\n * @return {boolean}\n */\nPattern.prototype.isValidAtIndex = function isValidAtIndex(char, index) {\n return this.formatCharacters[this.pattern[index]].validate(char)\n}\n\nPattern.prototype.transform = function transform(char, index) {\n var format = this.formatCharacters[this.pattern[index]]\n return typeof format.transform == 'function' ? format.transform(char) : char\n}\n\nfunction InputMask(options) {\n if (!(this instanceof InputMask)) { return new InputMask(options) }\n options = extend({\n formatCharacters: null,\n pattern: null,\n isRevealingMask: false,\n placeholderChar: DEFAULT_PLACEHOLDER_CHAR,\n selection: {start: 0, end: 0},\n value: ''\n }, options)\n\n if (options.pattern == null) {\n throw new Error('InputMask: you must provide a pattern.')\n }\n\n if (typeof options.placeholderChar !== 'string' || options.placeholderChar.length > 1) {\n throw new Error('InputMask: placeholderChar should be a single character or an empty string.')\n }\n\n this.placeholderChar = options.placeholderChar\n this.formatCharacters = mergeFormatCharacters(options.formatCharacters)\n this.setPattern(options.pattern, {\n value: options.value,\n selection: options.selection,\n isRevealingMask: options.isRevealingMask\n })\n}\n\n// Editing\n\n/**\n * Applies a single character of input based on the current selection.\n * @param {string} char\n * @return {boolean} true if a change has been made to value or selection as a\n * result of the input, false otherwise.\n */\nInputMask.prototype.input = function input(char) {\n // Ignore additional input if the cursor's at the end of the pattern\n if (this.selection.start === this.selection.end &&\n this.selection.start === this.pattern.length) {\n return false\n }\n\n var selectionBefore = copy(this.selection)\n var valueBefore = this.getValue()\n\n var inputIndex = this.selection.start\n\n // If the cursor or selection is prior to the first editable character, make\n // sure any input given is applied to it.\n if (inputIndex < this.pattern.firstEditableIndex) {\n inputIndex = this.pattern.firstEditableIndex\n }\n\n // Bail out or add the character to input\n if (this.pattern.isEditableIndex(inputIndex)) {\n if (!this.pattern.isValidAtIndex(char, inputIndex)) {\n return false\n }\n this.value[inputIndex] = this.pattern.transform(char, inputIndex)\n }\n\n // If multiple characters were selected, blank the remainder out based on the\n // pattern.\n var end = this.selection.end - 1\n while (end > inputIndex) {\n if (this.pattern.isEditableIndex(end)) {\n this.value[end] = this.placeholderChar\n }\n end--\n }\n\n // Advance the cursor to the next character\n this.selection.start = this.selection.end = inputIndex + 1\n\n // Skip over any subsequent static characters\n while (this.pattern.length > this.selection.start &&\n !this.pattern.isEditableIndex(this.selection.start)) {\n this.selection.start++\n this.selection.end++\n }\n\n // History\n if (this._historyIndex != null) {\n // Took more input after undoing, so blow any subsequent history away\n this._history.splice(this._historyIndex, this._history.length - this._historyIndex)\n this._historyIndex = null\n }\n if (this._lastOp !== 'input' ||\n selectionBefore.start !== selectionBefore.end ||\n this._lastSelection !== null && selectionBefore.start !== this._lastSelection.start) {\n this._history.push({value: valueBefore, selection: selectionBefore, lastOp: this._lastOp})\n }\n this._lastOp = 'input'\n this._lastSelection = copy(this.selection)\n\n return true\n}\n\n/**\n * Attempts to delete from the value based on the current cursor position or\n * selection.\n * @return {boolean} true if the value or selection changed as the result of\n * backspacing, false otherwise.\n */\nInputMask.prototype.backspace = function backspace() {\n // If the cursor is at the start there's nothing to do\n if (this.selection.start === 0 && this.selection.end === 0) {\n return false\n }\n\n var selectionBefore = copy(this.selection)\n var valueBefore = this.getValue()\n\n // No range selected - work on the character preceding the cursor\n if (this.selection.start === this.selection.end) {\n if (this.pattern.isEditableIndex(this.selection.start - 1)) {\n this.value[this.selection.start - 1] = this.placeholderChar\n }\n this.selection.start--\n this.selection.end--\n }\n // Range selected - delete characters and leave the cursor at the start of the selection\n else {\n var end = this.selection.end - 1\n while (end >= this.selection.start) {\n if (this.pattern.isEditableIndex(end)) {\n this.value[end] = this.placeholderChar\n }\n end--\n }\n this.selection.end = this.selection.start\n }\n\n // History\n if (this._historyIndex != null) {\n // Took more input after undoing, so blow any subsequent history away\n this._history.splice(this._historyIndex, this._history.length - this._historyIndex)\n }\n if (this._lastOp !== 'backspace' ||\n selectionBefore.start !== selectionBefore.end ||\n this._lastSelection !== null && selectionBefore.start !== this._lastSelection.start) {\n this._history.push({value: valueBefore, selection: selectionBefore, lastOp: this._lastOp})\n }\n this._lastOp = 'backspace'\n this._lastSelection = copy(this.selection)\n\n return true\n}\n\n/**\n * Attempts to paste a string of input at the current cursor position or over\n * the top of the current selection.\n * Invalid content at any position will cause the paste to be rejected, and it\n * may contain static parts of the mask's pattern.\n * @param {string} input\n * @return {boolean} true if the paste was successful, false otherwise.\n */\nInputMask.prototype.paste = function paste(input) {\n // This is necessary because we're just calling input() with each character\n // and rolling back if any were invalid, rather than checking up-front.\n var initialState = {\n value: this.value.slice(),\n selection: copy(this.selection),\n _lastOp: this._lastOp,\n _history: this._history.slice(),\n _historyIndex: this._historyIndex,\n _lastSelection: copy(this._lastSelection)\n }\n\n // If there are static characters at the start of the pattern and the cursor\n // or selection is within them, the static characters must match for a valid\n // paste.\n if (this.selection.start < this.pattern.firstEditableIndex) {\n for (var i = 0, l = this.pattern.firstEditableIndex - this.selection.start; i < l; i++) {\n if (input.charAt(i) !== this.pattern.pattern[i]) {\n return false\n }\n }\n\n // Continue as if the selection and input started from the editable part of\n // the pattern.\n input = input.substring(this.pattern.firstEditableIndex - this.selection.start)\n this.selection.start = this.pattern.firstEditableIndex\n }\n\n for (i = 0, l = input.length;\n i < l && this.selection.start <= this.pattern.lastEditableIndex;\n i++) {\n var valid = this.input(input.charAt(i))\n // Allow static parts of the pattern to appear in pasted input - they will\n // already have been stepped over by input(), so verify that the value\n // deemed invalid by input() was the expected static character.\n if (!valid) {\n if (this.selection.start > 0) {\n // XXX This only allows for one static character to be skipped\n var patternIndex = this.selection.start - 1\n if (!this.pattern.isEditableIndex(patternIndex) &&\n input.charAt(i) === this.pattern.pattern[patternIndex]) {\n continue\n }\n }\n extend(this, initialState)\n return false\n }\n }\n\n return true\n}\n\n// History\n\nInputMask.prototype.undo = function undo() {\n // If there is no history, or nothing more on the history stack, we can't undo\n if (this._history.length === 0 || this._historyIndex === 0) {\n return false\n }\n\n var historyItem\n if (this._historyIndex == null) {\n // Not currently undoing, set up the initial history index\n this._historyIndex = this._history.length - 1\n historyItem = this._history[this._historyIndex]\n // Add a new history entry if anything has changed since the last one, so we\n // can redo back to the initial state we started undoing from.\n var value = this.getValue()\n if (historyItem.value !== value ||\n historyItem.selection.start !== this.selection.start ||\n historyItem.selection.end !== this.selection.end) {\n this._history.push({value: value, selection: copy(this.selection), lastOp: this._lastOp, startUndo: true})\n }\n }\n else {\n historyItem = this._history[--this._historyIndex]\n }\n\n this.value = historyItem.value.split('')\n this.selection = historyItem.selection\n this._lastOp = historyItem.lastOp\n return true\n}\n\nInputMask.prototype.redo = function redo() {\n if (this._history.length === 0 || this._historyIndex == null) {\n return false\n }\n var historyItem = this._history[++this._historyIndex]\n // If this is the last history item, we're done redoing\n if (this._historyIndex === this._history.length - 1) {\n this._historyIndex = null\n // If the last history item was only added to start undoing, remove it\n if (historyItem.startUndo) {\n this._history.pop()\n }\n }\n this.value = historyItem.value.split('')\n this.selection = historyItem.selection\n this._lastOp = historyItem.lastOp\n return true\n}\n\n// Getters & setters\n\nInputMask.prototype.setPattern = function setPattern(pattern, options) {\n options = extend({\n selection: {start: 0, end: 0},\n value: ''\n }, options)\n this.pattern = new Pattern(pattern, this.formatCharacters, this.placeholderChar, options.isRevealingMask)\n this.setValue(options.value)\n this.emptyValue = this.pattern.formatValue([]).join('')\n this.selection = options.selection\n this._resetHistory()\n}\n\nInputMask.prototype.setSelection = function setSelection(selection) {\n this.selection = copy(selection)\n if (this.selection.start === this.selection.end) {\n if (this.selection.start < this.pattern.firstEditableIndex) {\n this.selection.start = this.selection.end = this.pattern.firstEditableIndex\n return true\n }\n // Set selection to the first editable, non-placeholder character before the selection\n // OR to the beginning of the pattern\n var index = this.selection.start\n while (index >= this.pattern.firstEditableIndex) {\n if (this.pattern.isEditableIndex(index - 1) &&\n this.value[index - 1] !== this.placeholderChar ||\n index === this.pattern.firstEditableIndex) {\n this.selection.start = this.selection.end = index\n break\n }\n index--\n }\n return true\n }\n return false\n}\n\nInputMask.prototype.setValue = function setValue(value) {\n if (value == null) {\n value = ''\n }\n this.value = this.pattern.formatValue(value.split(''))\n}\n\nInputMask.prototype.getValue = function getValue() {\n return this.value.join('')\n}\n\nInputMask.prototype.getRawValue = function getRawValue() {\n var rawValue = []\n for (var i = 0; i < this.value.length; i++) {\n if (this.pattern._editableIndices[i] === true) {\n rawValue.push(this.value[i])\n }\n }\n return rawValue.join('')\n}\n\nInputMask.prototype._resetHistory = function _resetHistory() {\n this._history = []\n this._historyIndex = null\n this._lastOp = null\n this._lastSelection = copy(this.selection)\n}\n\nInputMask.Pattern = Pattern\n\nmodule.exports = InputMask\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/inputmask-core/lib/index.js\n// module id = 60\n// module chunks = 0 1","import InputMask from 'inputmask-core'\r\nimport ffpoly from './ff-polyfill.js' //Firefox Polyfill for focus events\r\nffpoly()\r\n\r\nexport default {\r\n\r\n template: `\r\n <input ref=\"input\"\r\n :value=\"value\"\r\n @keydown=\"keyDown(arguments[0])\"\r\n @keypress=\"keyPress(arguments[0])\"\r\n @keyup=\"keyUp(arguments[0])\"\r\n @textInput=\"textInput(arguments[0])\"\r\n @mouseup=\"mouseUp(arguments[0])\"\r\n @focus.prevent=\"focusin(arguments[0])\"\r\n @focusout=\"focusout(arguments[0])\"\r\n @cut=\"cut(arguments[0])\"\r\n @copy=\"copy(arguments[0])\"\r\n @paste=\"paste(arguments[0])\"\r\n :disabled=\"mask_core===null || disabled\"\r\n />\r\n `,\r\n\r\n name: 'MaskedInput',\r\n\r\n data: () => ({\r\n marginLeft: 0,\r\n mask_core: null,\r\n updateAfterAll: false\r\n }),\r\n\r\n props: {\r\n value: {\r\n type: String\r\n },\r\n mask: {\r\n type: String,\r\n required: true,\r\n validator: value => !! (value && value.length >= 1)\r\n },\r\n placeholderChar: {\r\n type: String,\r\n default: '_',\r\n validator: value => !! (value && value.length === 1)\r\n },\r\n disabled: {\r\n type: Boolean,\r\n default: false\r\n }\r\n },\r\n\r\n watch: {\r\n mask: function(newMask) {\r\n this.initMask()\r\n },\r\n value: function(newValue) {\r\n if (this.mask_core) this.mask_core.setValue(newValue) //For multiple inputs support\r\n },\r\n },\r\n\r\n mounted() {\r\n this.initMask()\r\n },\r\n\r\n methods: {\r\n\r\n initMask() {\r\n try {\r\n this.mask_core = new InputMask({\r\n pattern: this.mask,\r\n value: '',\r\n placeholderChar: this.placeholderChar,\r\n formatCharacters: {\r\n 'a': {\r\n validate: char => /^[A-Za-zА-Яа-я]$/.test(char),\r\n },\r\n 'A': {\r\n validate: char => /^[A-Za-zА-Яа-я]$/.test(char) ,\r\n transform: char => char.toUpperCase()\r\n },\r\n '*': {\r\n validate: char => /^[\\dA-Za-zА-Яа-я]$/.test(char),\r\n },\r\n '#': {\r\n validate: char => /^[\\dA-Za-zА-Яа-я]$/.test(char),\r\n transform: char => char.toUpperCase()\r\n },\r\n '+': {\r\n validate: char => true,\r\n },\r\n }\r\n })\r\n for (let i = 0; i < this.$refs.input.value.length; ++i) {\r\n this.mask_core.input(this.$refs.input.value[i])\r\n }\r\n this.mask_core.setSelection({\r\n start: 0,\r\n end: 0\r\n })\r\n if (this.$refs.input.value === '') {\r\n this.$emit('input', '', '')\r\n }\r\n else {\r\n this.updateToCoreState()\r\n }\r\n\r\n\r\n }\r\n catch (e) {\r\n console.error(e.message);\r\n this.mask_core = null\r\n this.$refs.input.value = 'Error, see console'\r\n this.$emit('input', this.$refs.input.value, '')\r\n }\r\n },\r\n\r\n getValue() {\r\n if (this.mask_core === null) return '';\r\n return this.mask_core.getValue()\r\n },\r\n\r\n keyDown(e) { //Always\r\n if (this.mask_core === null) {\r\n e.preventDefault()\r\n return;\r\n }\r\n this.setNativeSelection()\r\n\r\n\r\n switch (e.keyCode) {\r\n\r\n //backspace\r\n case 8:\r\n e.preventDefault()\r\n if (\r\n this.mask_core.selection.start > this.marginLeft ||\r\n this.mask_core.selection.start != this.mask_core.selection.end\r\n ) {\r\n this.mask_core.backspace()\r\n this.updateToCoreState()\r\n }\r\n break;\r\n\r\n //left arrow\r\n case 37:\r\n e.preventDefault()\r\n\r\n if (this.$refs.input.selectionStart === this.$refs.input.selectionEnd)\r\n this.$refs.input.selectionEnd = this.$refs.input.selectionStart--\r\n\r\n this.mask_core.selection = {\r\n start: this.$refs.input.selectionStart,\r\n end: this.$refs.input.selectionStart\r\n }\r\n this.updateToCoreState()\r\n break;\r\n\r\n //right arrow\r\n case 39:\r\n e.preventDefault()\r\n\r\n if (this.$refs.input.selectionStart === this.$refs.input.selectionEnd)\r\n this.$refs.input.selectionEnd++;\r\n\r\n this.mask_core.selection = {\r\n start: this.$refs.input.selectionEnd,\r\n end: this.$refs.input.selectionEnd\r\n }\r\n this.updateToCoreState()\r\n break;\r\n\r\n //end\r\n case 35:\r\n e.preventDefault()\r\n this.$refs.input.selectionStart = this.$refs.input.selectionEnd = this.$refs.input.value.length\r\n\r\n this.mask_core.selection = {\r\n start: this.$refs.input.selectionEnd,\r\n end: this.$refs.input.selectionEnd\r\n }\r\n this.updateToCoreState()\r\n break;\r\n\r\n //home\r\n case 36:\r\n e.preventDefault()\r\n this.$refs.input.selectionStart = this.$refs.input.selectionEnd = 0\r\n this.mask_core.selection = {\r\n start: this.$refs.input.selectionStart,\r\n end: this.$refs.input.selectionStart\r\n }\r\n this.updateToCoreState()\r\n break;\r\n\r\n //delete\r\n case 46:\r\n e.preventDefault()\r\n\r\n if (this.$refs.input.selectionStart === this.$refs.input.selectionEnd) {\r\n this.mask_core.setValue('');\r\n this.mask_core.setSelection({\r\n start: 0,\r\n end: 0\r\n })\r\n this.$refs.input.selectionStart = this.mask_core.selection.start;\r\n this.$refs.input.selectionEnd = this.mask_core.selection.start;\r\n\r\n } else {\r\n this.mask_core.backspace()\r\n }\r\n this.updateToCoreState()\r\n break;\r\n }\r\n },\r\n\r\n input(e) {\r\n },\r\n\r\n keyPress(e) { //works only on Desktop\r\n if (e.ctrlKey) return; //Fix FF copy/paste issue\r\n /*\r\n IE & FF are not trigger textInput event, so we have to force it\r\n */\r\n let isIE = /*@cc_on!@*/false || !!document.documentMode; //by http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser\r\n let isFirefox = typeof InstallTrigger !== 'undefined';\r\n\r\n\r\n if (isIE || isFirefox) {\r\n e.preventDefault()\r\n e.data = e.key\r\n this.textInput(e)\r\n }\r\n },\r\n\r\n textInput(e) {\r\n if (e.preventDefault) e.preventDefault()\r\n if (this.mask_core.input(e.data)) {\r\n this.updateAfterAll = true\r\n }\r\n this.updateToCoreState()\r\n },\r\n\r\n keyUp(e) {\r\n this.updateToCoreState()\r\n this.updateAfterAll = false\r\n },\r\n\r\n\r\n cut(e) {\r\n e.preventDefault();\r\n if (this.$refs.input.selectionStart !== this.$refs.input.selectionEnd) {\r\n /*let text = this.$refs.input.value.slice(\r\n this.$refs.input.selectionStart,\r\n this.$refs.input.selectionEnd\r\n )*/\r\n try {\r\n document.execCommand('copy')\r\n } catch (err) {}\r\n this.mask_core.backspace()\r\n this.updateToCoreState()\r\n }\r\n },\r\n\r\n copy(e) {\r\n },\r\n\r\n paste(e) {\r\n e.preventDefault()\r\n let text = e.clipboardData.getData('text')\r\n for (let i = 0; i < text.length; ++i) {\r\n this.mask_core.input(text[i])\r\n }\r\n this.updateToCoreState()\r\n },\r\n\r\n updateToCoreState() {\r\n if (this.mask_core === null) {\r\n return;\r\n }\r\n if (this.$refs.input.value !== this.mask_core.getValue()) {\r\n this.$refs.input.value = this.mask_core.getValue()\r\n this.$emit('input', this.$refs.input.value, this.mask_core.getRawValue())\r\n }\r\n this.$refs.input.selectionStart = this.mask_core.selection.start;\r\n this.$refs.input.selectionEnd = this.mask_core.selection.end;\r\n },\r\n\r\n focusin(e) {\r\n },\r\n\r\n isEmpty() {\r\n if (this.mask_core === null) return true;\r\n return this.mask_core.getValue() === this.mask_core.emptyValue\r\n },\r\n\r\n focusout(e) {\r\n if (this.isEmpty()) {\r\n this.$refs.input.value = ''\r\n this.mask_core.setSelection({\r\n start: 0,\r\n end: 0\r\n })\r\n this.$emit('input', '', '')\r\n }\r\n },\r\n\r\n setNativeSelection() {\r\n this.mask_core.selection = {\r\n start: this.$refs.input.selectionStart,\r\n end: this.$refs.input.selectionEnd\r\n }\r\n },\r\n\r\n mouseUp(e) {\r\n if (this.isEmpty() &&\r\n this.$refs.input.selectionStart === this.$refs.input.selectionEnd) {\r\n this.mask_core.setSelection({\r\n start: 0,\r\n end: 0\r\n })\r\n this.$refs.input.selectionStart = this.mask_core.selection.start;\r\n this.$refs.input.selectionEnd = this.mask_core.selection.start;\r\n this.marginLeft = this.mask_core.selection.start;\r\n this.updateToCoreState();\r\n }\r\n else {\r\n this.setNativeSelection();\r\n }\r\n }\r\n }\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/MaskedInput.js"],"sourceRoot":""}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
// Copy paste from https://gist.github.com/nuxodin/9250e56a3ce6c0446efa
export default function () {
var w = window,
d = w.document;
if (w.onfocusin === undefined) {
d.addEventListener('focus', addPolyfill, true);
d.addEventListener('blur', addPolyfill, true);
d.addEventListener('focusin', removePolyfill, true);
d.addEventListener('focusout', removePolyfill, true);
}
function addPolyfill(e) {
var type = e.type === 'focus' ? 'focusin' : 'focusout';
var event = new CustomEvent(type, {
bubbles: true,
cancelable: false
});
event.c1Generated = true;
e.target.dispatchEvent(event);
}
function removePolyfill(e) {
if (!e.c1Generated) {
// focus after focusin, so chrome will the first time trigger tow times focusin
d.removeEventListener('focus', addPolyfill, true);
d.removeEventListener('blur', addPolyfill, true);
d.removeEventListener('focusin', removePolyfill, true);
d.removeEventListener('focusout', removePolyfill, true);
}
setTimeout(function () {
d.removeEventListener('focusin', removePolyfill, true);
d.removeEventListener('focusout', removePolyfill, true);
});
}
};
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
import InputMask from 'inputmask-core';
import ffpoly from './ff-polyfill'; // Firefox Polyfill for focus events
ffpoly();
export default {
name: 'MaskedInput',
render: function render(h) {
return h('input', {
ref: 'input',
attrs: {
disabled: this.maskCore === null || this.disabled
},
domProps: {
value: this.value
},
on: {
keydown: this.keyDown,
keypress: this.keyPress,
keyup: this.keyUp,
textInput: this.textInput,
mouseup: this.mouseUp,
focusout: this.focusOut,
cut: this.cut,
copy: this.copy,
paste: this.paste
}
});
},
data: function data() {
return {
marginLeft: 0,
maskCore: null,
updateAfterAll: false
};
},
props: {
value: {
type: String
},
mask: {
type: String,
required: true,
validator: function validator(value) {
return !!(value && value.length >= 1);
}
},
placeholderChar: {
type: String,
default: '_',
validator: function validator(value) {
return !!(value && value.length === 1);
}
},
disabled: {
type: Boolean,
default: false
}
},
watch: {
mask: function mask() {
this.initMask();
},
value: function value(newValue) {
if (this.maskCore) this.maskCore.setValue(newValue); // For multiple inputs support
}
},
mounted: function mounted() {
this.initMask();
},
methods: {
initMask: function initMask() {
var _this = this;
try {
this.maskCore = new InputMask({
pattern: this.mask,
value: '',
placeholderChar: this.placeholderChar,
/* eslint-disable quote-props */
formatCharacters: {
'a': {
validate: function validate(char) {
return (/^[A-Za-zА-Яа-я]$/.test(char)
);
}
},
'A': {
validate: function validate(char) {
return (/^[A-Za-zА-Яа-я]$/.test(char)
);
},
transform: function transform(char) {
return char.toUpperCase();
}
},
'*': {
validate: function validate(char) {
return (/^[\dA-Za-zА-Яа-я]$/.test(char)
);
}
},
'#': {
validate: function validate(char) {
return (/^[\dA-Za-zА-Яа-я]$/.test(char)
);
},
transform: function transform(char) {
return char.toUpperCase();
}
},
'+': {
validate: function validate() {
return true;
}
}
}
});
[].concat(_toConsumableArray(this.$refs.input.value)).reduce(function (memo, item) {
return _this.maskCore.input(item);
}, null);
this.maskCore.setSelection({
start: 0,
end: 0
});
if (this.$refs.input.value === '') {
this.$emit('input', '', '');
} else {
this.updateToCoreState();
}
} catch (e) {
this.maskCore = null;
this.$refs.input.value = 'Error';
this.$emit('input', this.$refs.input.value, '');
}
},
getValue: function getValue() {
return this.maskCore ? this.maskCore.getValue() : '';
},
keyDown: function keyDown(e) {
// Always
if (this.maskCore === null) {
e.preventDefault();
return;
}
this.setNativeSelection();
switch (e.keyCode) {
// backspace
case 8:
e.preventDefault();
if (this.maskCore.selection.start > this.marginLeft || this.maskCore.selection.start !== this.maskCore.selection.end) {
this.maskCore.backspace();
this.updateToCoreState();
}
break;
// left arrow
case 37:
e.preventDefault();
if (this.$refs.input.selectionStart === this.$refs.input.selectionEnd) {
// this.$refs.input.selectionEnd = this.$refs.input.selectionStart - 1; @TODO
this.$refs.input.selectionStart -= 1;
}
this.maskCore.selection = {
start: this.$refs.input.selectionStart,
end: this.$refs.input.selectionStart
};
this.updateToCoreState();
break;
// right arrow
case 39:
e.preventDefault();
if (this.$refs.input.selectionStart === this.$refs.input.selectionEnd) {
this.$refs.input.selectionEnd += 1;
}
this.maskCore.selection = {
start: this.$refs.input.selectionEnd,
end: this.$refs.input.selectionEnd
};
this.updateToCoreState();
break;
// end
case 35:
e.preventDefault();
this.$refs.input.selectionStart = this.$refs.input.value.length;
this.$refs.input.selectionEnd = this.$refs.input.value.length;
this.maskCore.selection = {
start: this.$refs.input.selectionEnd,
end: this.$refs.input.selectionEnd
};
this.updateToCoreState();
break;
// home
case 36:
e.preventDefault();
this.$refs.input.selectionStart = 0;
this.$refs.input.selectionEnd = 0;
this.maskCore.selection = {
start: this.$refs.input.selectionStart,
end: this.$refs.input.selectionStart
};
this.updateToCoreState();
break;
// delete
case 46:
e.preventDefault();
if (this.$refs.input.selectionStart === this.$refs.input.selectionEnd) {
this.maskCore.setValue('');
this.maskCore.setSelection({
start: 0,
end: 0
});
this.$refs.input.selectionStart = this.maskCore.selection.start;
this.$refs.input.selectionEnd = this.maskCore.selection.start;
} else {
this.maskCore.backspace();
}
this.updateToCoreState();
break;
default:
break;
}
},
keyPress: function keyPress(e) {
// works only on Desktop
if (e.ctrlKey) return; // Fix FF copy/paste issue
// IE & FF are not trigger textInput event, so we have to force it
/* eslint-disable */
var isIE = /*@cc_on!@*/false || !!document.documentMode; //by http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
/* eslint-enable */
var isFirefox = typeof InstallTrigger !== 'undefined';
if (isIE || isFirefox) {
e.preventDefault();
e.data = e.key;
this.textInput(e);
}
},
textInput: function textInput(e) {
if (e.preventDefault) e.preventDefault();
if (this.maskCore.input(e.data)) {
this.updateAfterAll = true;
}
this.updateToCoreState();
},
keyUp: function keyUp(e) {
if (e.keyCode === 9) {
// Preven change selection for Tab in
return;
}
this.updateToCoreState();
this.updateAfterAll = false;
},
cut: function cut(e) {
e.preventDefault();
if (this.$refs.input.selectionStart !== this.$refs.input.selectionEnd) {
try {
document.execCommand('copy');
} catch (err) {} // eslint-disable-line no-empty
this.maskCore.backspace();
this.updateToCoreState();
}
},
copy: function copy() {},
paste: function paste(e) {
var _this2 = this;
e.preventDefault();
var text = e.clipboardData.getData('text');
[].concat(_toConsumableArray(text)).reduce(function (memo, item) {
return _this2.maskCore.input(item);
}, null);
this.updateToCoreState();
},
updateToCoreState: function updateToCoreState() {
if (this.maskCore === null) {
return;
}
if (this.$refs.input.value !== this.maskCore.getValue()) {
this.$refs.input.value = this.maskCore.getValue();
this.$emit('input', this.$refs.input.value, this.maskCore.getRawValue());
}
this.$refs.input.selectionStart = this.maskCore.selection.start;
this.$refs.input.selectionEnd = this.maskCore.selection.end;
},
isEmpty: function isEmpty() {
if (this.maskCore === null) return true;
return this.maskCore.getValue() === this.maskCore.emptyValue;
},
focusOut: function focusOut() {
if (this.isEmpty()) {
this.$refs.input.value = '';
this.maskCore.setSelection({
start: 0,
end: 0
});
this.$emit('input', '', '');
}
},
setNativeSelection: function setNativeSelection() {
this.maskCore.selection = {
start: this.$refs.input.selectionStart,
end: this.$refs.input.selectionEnd
};
},
mouseUp: function mouseUp() {
if (this.isEmpty() && this.$refs.input.selectionStart === this.$refs.input.selectionEnd) {
this.maskCore.setSelection({
start: 0,
end: 0
});
this.$refs.input.selectionStart = this.maskCore.selection.start;
this.$refs.input.selectionEnd = this.maskCore.selection.start;
this.marginLeft = this.maskCore.selection.start;
this.updateToCoreState();
} else {
this.setNativeSelection();
}
}
}
};
{ {
"name": "vue-masked-input", "name": "vue-masked-input",
"description": "Masked input component for Vue.js 2.X", "description": "Masked input component for Vue.js 2.X",
"version": "0.4.1", "version": "0.5.1",
"author": "niksmr", "author": "niksmr",
"license": "MIT", "license": "MIT",
"homepage": "https://github.com/niksmr/vue-masked-input", "homepage": "https://github.com/niksmr/vue-masked-input",
"main": "src/MaskedInput.js", "main": "dist/maskedInput.js",
"scripts": { "scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --inline --hot", "dev": "cross-env NODE_ENV=development webpack-dev-server --open --inline --hot",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules" "babel": "npm run babel-component & npm run babel-poly",
"babel-component": "babel src/ff-polyfill.js --out-file dist/ff-polyfill.js",
"babel-poly": "babel src/MaskedInput.js --out-file dist/maskedInput.js",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules & npm run babel"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
...@@ -22,17 +25,21 @@ ...@@ -22,17 +25,21 @@
], ],
"dependencies": { "dependencies": {
"inputmask-core": "^2.2.0", "inputmask-core": "^2.2.0",
"vue": "^2.1.0" "vue": "^2.2.6"
}, },
"devDependencies": { "devDependencies": {
"babel-cli": "^6.24.1",
"babel-core": "^6.0.0", "babel-core": "^6.0.0",
"babel-loader": "^6.0.0", "babel-loader": "^7.0.0",
"babel-polyfill": "^6.22.0", "babel-polyfill": "^6.22.0",
"babel-preset-es2015": "^6.0.0", "babel-preset-es2015": "^6.0.0",
"cross-env": "^3.0.0", "cross-env": "^4.0.0",
"css-loader": "^0.25.0", "css-loader": "^0.28.0",
"file-loader": "^0.9.0", "eslint": "^3.19.0",
"vue-loader": "^10.0.0", "eslint-config-airbnb-base": "^11.1.3",
"eslint-plugin-import": "^2.2.0",
"file-loader": "^0.11.1",
"vue-loader": "^12.0.0",
"vue-template-compiler": "^2.1.0", "vue-template-compiler": "^2.1.0",
"webpack": "^2.2.0", "webpack": "^2.2.0",
"webpack-dev-server": "^2.2.0" "webpack-dev-server": "^2.2.0"
......
import InputMask from 'inputmask-core' import InputMask from 'inputmask-core';
import ffpoly from './ff-polyfill.js' //Firefox Polyfill for focus events import ffpoly from './ff-polyfill'; // Firefox Polyfill for focus events
ffpoly()
export default { ffpoly();
template: `
<input ref="input"
:value="value"
@keydown="keyDown(arguments[0])"
@keypress="keyPress(arguments[0])"
@keyup="keyUp(arguments[0])"
@textInput="textInput(arguments[0])"
@mouseup="mouseUp(arguments[0])"
@focus.prevent="focusin(arguments[0])"
@focusout="focusout(arguments[0])"
@cut="cut(arguments[0])"
@copy="copy(arguments[0])"
@paste="paste(arguments[0])"
@blur="$emit('blur')"
:disabled="mask_core===null || disabled"
/>
`,
export default {
name: 'MaskedInput', name: 'MaskedInput',
render(h) {
return h('input', {
ref: 'input',
attrs: {
disabled: this.maskCore === null || this.disabled,
},
domProps: {
value: this.value,
},
on: {
keydown: this.keyDown,
keypress: this.keyPress,
keyup: this.keyUp,
textInput: this.textInput,
mouseup: this.mouseUp,
focusout: this.focusOut,
cut: this.cut,
copy: this.copy,
paste: this.paste,
},
});
},
data: () => ({ data: () => ({
marginLeft: 0, marginLeft: 0,
mask_core: null, maskCore: null,
updateAfterAll: false updateAfterAll: false,
}), }),
props: { props: {
value: { value: {
type: String type: String,
}, },
mask: { mask: {
required: true, required: true,
...@@ -41,296 +45,272 @@ export default { ...@@ -41,296 +45,272 @@ export default {
placeholderChar: { placeholderChar: {
type: String, type: String,
default: '_', default: '_',
validator: value => !! (value && value.length === 1) validator: value => !!(value && value.length === 1),
}, },
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false,
} },
}, },
watch: { watch: {
mask: function(newMask) { mask() {
this.initMask() this.initMask();
}, },
value: function(newValue) { value(newValue) {
if (this.mask_core) this.mask_core.setValue(newValue) //For multiple inputs support if (this.maskCore) this.maskCore.setValue(newValue); // For multiple inputs support
}, },
}, },
mounted() { mounted() {
this.initMask() this.initMask();
}, },
methods: { methods: {
initMask() { initMask() {
try { try {
if (this.mask instanceof Object) { if (this.mask instanceof Object) {
this.mask_core = new InputMask(this.mask) this.maskСore = new InputMask(this.mask)
} else { } else {
this.mask_core = new InputMask({ this.maskCore = new InputMask({
pattern: this.mask, pattern: this.mask,
value: '', value: '',
placeholderChar: this.placeholderChar, placeholderChar: this.placeholderChar,
/* eslint-disable quote-props */
formatCharacters: { formatCharacters: {
'a': { 'a': {
validate: char => /^[A-Za-zА-Яа-я]$/.test(char), validate: char => /^[A-Za-zА-Яа-я]$/.test(char),
}, },
'A': { 'A': {
validate: char => /^[A-Za-zА-Яа-я]$/.test(char), validate: char => /^[A-Za-zА-Яа-я]$/.test(char),
transform: char => char.toUpperCase() transform: char => char.toUpperCase(),
}, },
'*': { '*': {
validate: char => /^[\dA-Za-zА-Яа-я]$/.test(char), validate: char => /^[\dA-Za-zА-Яа-я]$/.test(char),
}, },
'#': { '#': {
validate: char => /^[\dA-Za-zА-Яа-я]$/.test(char), validate: char => /^[\dA-Za-zА-Яа-я]$/.test(char),
transform: char => char.toUpperCase() transform: char => char.toUpperCase(),
}, },
'+': { '+': {
validate: char => true, validate: () => true,
}, },
},
/* eslint-enable */
});
} }
}) [...this.$refs.input.value].reduce((memo, item) => this.maskCore.input(item), null);
} this.maskCore.setSelection({
for (let i = 0; i < this.$refs.input.value.length; ++i) {
this.mask_core.input(this.$refs.input.value[i])
}
this.mask_core.setSelection({
start: 0, start: 0,
end: 0 end: 0,
}) });
if (this.$refs.input.value === '') { if (this.$refs.input.value === '') {
this.$emit('input', '', '') this.$emit('input', '', '');
} } else {
else { this.updateToCoreState();
this.updateToCoreState()
}
} }
catch (e) { } catch (e) {
console.error(e.message); this.maskCore = null;
this.mask_core = null this.$refs.input.value = 'Error';
this.$refs.input.value = 'Error, see console' this.$emit('input', this.$refs.input.value, '');
this.$emit('input', this.$refs.input.value, '')
} }
}, },
getValue() { getValue() {
if (this.mask_core === null) return ''; return this.maskCore ? this.maskCore.getValue() : '';
return this.mask_core.getValue()
}, },
keyDown(e) { //Always keyDown(e) { // Always
if (this.mask_core === null) { if (this.maskCore === null) {
e.preventDefault() e.preventDefault();
return; return;
} }
this.setNativeSelection() this.setNativeSelection();
switch (e.keyCode) { switch (e.keyCode) {
// backspace
//backspace
case 8: case 8:
e.preventDefault() e.preventDefault();
if ( if (
this.mask_core.selection.start > this.marginLeft || this.maskCore.selection.start > this.marginLeft ||
this.mask_core.selection.start != this.mask_core.selection.end this.maskCore.selection.start !== this.maskCore.selection.end
) { ) {
this.mask_core.backspace() this.maskCore.backspace();
this.updateToCoreState() this.updateToCoreState();
} }
break; break;
//left arrow // left arrow
case 37: case 37:
e.preventDefault() e.preventDefault();
if (this.$refs.input.selectionStart === this.$refs.input.selectionEnd) {
if (this.$refs.input.selectionStart === this.$refs.input.selectionEnd) // this.$refs.input.selectionEnd = this.$refs.input.selectionStart - 1; @TODO
this.$refs.input.selectionEnd = this.$refs.input.selectionStart-- this.$refs.input.selectionStart -= 1;
this.mask_core.selection = {
start: this.$refs.input.selectionStart,
end: this.$refs.input.selectionStart
} }
this.updateToCoreState() this.maskCore.selection = {
start: this.$refs.input.selectionStart,
end: this.$refs.input.selectionStart,
};
this.updateToCoreState();
break; break;
//right arrow // right arrow
case 39: case 39:
e.preventDefault() e.preventDefault();
if (this.$refs.input.selectionStart === this.$refs.input.selectionEnd) {
if (this.$refs.input.selectionStart === this.$refs.input.selectionEnd) this.$refs.input.selectionEnd += 1;
this.$refs.input.selectionEnd++;
this.mask_core.selection = {
start: this.$refs.input.selectionEnd,
end: this.$refs.input.selectionEnd
} }
this.updateToCoreState() this.maskCore.selection = {
start: this.$refs.input.selectionEnd,
end: this.$refs.input.selectionEnd,
};
this.updateToCoreState();
break; break;
//end // end
case 35: case 35:
e.preventDefault() e.preventDefault();
this.$refs.input.selectionStart = this.$refs.input.selectionEnd = this.$refs.input.value.length this.$refs.input.selectionStart = this.$refs.input.value.length;
this.$refs.input.selectionEnd = this.$refs.input.value.length;
this.mask_core.selection = { this.maskCore.selection = {
start: this.$refs.input.selectionEnd, start: this.$refs.input.selectionEnd,
end: this.$refs.input.selectionEnd end: this.$refs.input.selectionEnd,
} };
this.updateToCoreState() this.updateToCoreState();
break; break;
//home // home
case 36: case 36:
e.preventDefault() e.preventDefault();
this.$refs.input.selectionStart = this.$refs.input.selectionEnd = 0 this.$refs.input.selectionStart = 0;
this.mask_core.selection = { this.$refs.input.selectionEnd = 0;
this.maskCore.selection = {
start: this.$refs.input.selectionStart, start: this.$refs.input.selectionStart,
end: this.$refs.input.selectionStart end: this.$refs.input.selectionStart,
} };
this.updateToCoreState() this.updateToCoreState();
break; break;
//delete // delete
case 46: case 46:
e.preventDefault() e.preventDefault();
if (this.$refs.input.selectionStart === this.$refs.input.selectionEnd) { if (this.$refs.input.selectionStart === this.$refs.input.selectionEnd) {
this.mask_core.setValue(''); this.maskCore.setValue('');
this.mask_core.setSelection({ this.maskCore.setSelection({
start: 0, start: 0,
end: 0 end: 0,
}) });
this.$refs.input.selectionStart = this.mask_core.selection.start; this.$refs.input.selectionStart = this.maskCore.selection.start;
this.$refs.input.selectionEnd = this.mask_core.selection.start; this.$refs.input.selectionEnd = this.maskCore.selection.start;
} else { } else {
this.mask_core.backspace() this.maskCore.backspace();
} }
this.updateToCoreState() this.updateToCoreState();
break; break;
}
},
input(e) { default:
break;
}
}, },
keyPress(e) { //works only on Desktop keyPress(e) { // works only on Desktop
if (e.ctrlKey) return; //Fix FF copy/paste issue if (e.ctrlKey) return; // Fix FF copy/paste issue
/* // IE & FF are not trigger textInput event, so we have to force it
IE & FF are not trigger textInput event, so we have to force it /* eslint-disable */
*/ const isIE = /*@cc_on!@*/false || !!document.documentMode; //by http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
let isIE = /*@cc_on!@*/false || !!document.documentMode; //by http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser /* eslint-enable */
let isFirefox = typeof InstallTrigger !== 'undefined'; const isFirefox = typeof InstallTrigger !== 'undefined';
if (isIE || isFirefox) { if (isIE || isFirefox) {
e.preventDefault() e.preventDefault();
e.data = e.key e.data = e.key;
this.textInput(e) this.textInput(e);
} }
}, },
textInput(e) { textInput(e) {
if (e.preventDefault) e.preventDefault() if (e.preventDefault) e.preventDefault();
if (this.mask_core.input(e.data)) { if (this.maskCore.input(e.data)) {
this.updateAfterAll = true this.updateAfterAll = true;
} }
this.updateToCoreState() this.updateToCoreState();
}, },
keyUp(e) { keyUp(e) {
this.updateToCoreState() if (e.keyCode === 9) { // Preven change selection for Tab in
this.updateAfterAll = false return;
}
this.updateToCoreState();
this.updateAfterAll = false;
}, },
cut(e) { cut(e) {
e.preventDefault(); e.preventDefault();
if (this.$refs.input.selectionStart !== this.$refs.input.selectionEnd) { if (this.$refs.input.selectionStart !== this.$refs.input.selectionEnd) {
/*let text = this.$refs.input.value.slice(
this.$refs.input.selectionStart,
this.$refs.input.selectionEnd
)*/
try { try {
document.execCommand('copy') document.execCommand('copy');
} catch (err) {} } catch (err) {} // eslint-disable-line no-empty
this.mask_core.backspace() this.maskCore.backspace();
this.updateToCoreState() this.updateToCoreState();
} }
}, },
copy(e) { copy() {},
},
paste(e) { paste(e) {
e.preventDefault() e.preventDefault();
let text = e.clipboardData.getData('text') const text = e.clipboardData.getData('text');
for (let i = 0; i < text.length; ++i) { [...text].reduce((memo, item) => this.maskCore.input(item), null);
this.mask_core.input(text[i]) this.updateToCoreState();
}
this.updateToCoreState()
}, },
updateToCoreState() { updateToCoreState() {
if (this.mask_core === null) { if (this.maskCore === null) {
return; return;
} }
if (this.$refs.input.value !== this.mask_core.getValue()) { if (this.$refs.input.value !== this.maskCore.getValue()) {
this.$refs.input.value = this.mask_core.getValue() this.$refs.input.value = this.maskCore.getValue();
this.$emit('input', this.$refs.input.value, this.mask_core.getRawValue()) this.$emit('input', this.$refs.input.value, this.maskCore.getRawValue());
} }
this.$refs.input.selectionStart = this.mask_core.selection.start; this.$refs.input.selectionStart = this.maskCore.selection.start;
this.$refs.input.selectionEnd = this.mask_core.selection.end; this.$refs.input.selectionEnd = this.maskCore.selection.end;
},
focusin(e) {
}, },
isEmpty() { isEmpty() {
if (this.mask_core === null) return true; if (this.maskCore === null) return true;
return this.mask_core.getValue() === this.mask_core.emptyValue return this.maskCore.getValue() === this.maskCore.emptyValue;
}, },
focusout(e) { focusOut() {
if (this.isEmpty()) { if (this.isEmpty()) {
this.$refs.input.value = '' this.$refs.input.value = '';
this.mask_core.setSelection({ this.maskCore.setSelection({
start: 0, start: 0,
end: 0 end: 0,
}) });
this.$emit('input', '', '') this.$emit('input', '', '');
} }
}, },
setNativeSelection() { setNativeSelection() {
this.mask_core.selection = { this.maskCore.selection = {
start: this.$refs.input.selectionStart, start: this.$refs.input.selectionStart,
end: this.$refs.input.selectionEnd end: this.$refs.input.selectionEnd,
} };
}, },
mouseUp(e) { mouseUp() {
if (this.isEmpty() && if (this.isEmpty() &&
this.$refs.input.selectionStart === this.$refs.input.selectionEnd) { this.$refs.input.selectionStart === this.$refs.input.selectionEnd) {
this.mask_core.setSelection({ this.maskCore.setSelection({
start: 0, start: 0,
end: 0 end: 0,
}) });
this.$refs.input.selectionStart = this.mask_core.selection.start; this.$refs.input.selectionStart = this.maskCore.selection.start;
this.$refs.input.selectionEnd = this.mask_core.selection.start; this.$refs.input.selectionEnd = this.maskCore.selection.start;
this.marginLeft = this.mask_core.selection.start; this.marginLeft = this.maskCore.selection.start;
this.updateToCoreState(); this.updateToCoreState();
} } else {
else {
this.setNativeSelection(); this.setNativeSelection();
} }
} },
} },
};
}
//https://gist.github.com/nuxodin/9250e56a3ce6c0446efa // Copy paste from https://gist.github.com/nuxodin/9250e56a3ce6c0446efa
export default function() { export default function() {
var w = window, var w = window,
d = w.document; d = w.document;
if (w.onfocusin === undefined) { if (w.onfocusin === undefined) {
...@@ -32,5 +32,4 @@ export default function() { ...@@ -32,5 +32,4 @@ export default function() {
d.removeEventListener('focusout', removePolyfill, true); d.removeEventListener('focusout', removePolyfill, true);
}); });
} }
}; };
import Vue from 'vue' import Vue from 'vue';
import App from './App.vue' import App from './App.vue';
// eslint-disable-next-line no-new
new Vue({ new Vue({
el: '#app', el: '#app',
render: h => h(App) render: h => h(App),
}) });
...@@ -3,8 +3,7 @@ var webpack = require('webpack') ...@@ -3,8 +3,7 @@ var webpack = require('webpack')
module.exports = { module.exports = {
entry: { entry: {
demo: './src/main.js', demo: './src/main.js'
component: './src/MaskedInput.js'
}, },
output: { output: {
path: path.resolve(__dirname, './dist'), path: path.resolve(__dirname, './dist'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment