vue-input-facade
Advanced tools
Comparing version 2.1.2 to 2.1.3
@@ -660,8 +660,8 @@ module.exports = | ||
}); | ||
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"3d99fa88-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/component.vue?vue&type=template&id=62e0c8a4& | ||
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('input',{directives:[{name:"facade",rawName:"v-facade",value:(_vm.config),expression:"config"}],attrs:{"type":"text"},domProps:{"value":_vm.maskedValue},on:{"input":_vm.onInput,"change":_vm.onChange,"blur":function($event){return _vm.$emit('blur')},"focus":function($event){return _vm.$emit('focus')},"keyup":function($event){return _vm.$emit('keyup')},"keydown":function($event){return _vm.$emit('keydown')}}})} | ||
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"3d99fa88-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/component.vue?vue&type=template&id=e1f89d4c& | ||
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('input',{directives:[{name:"facade",rawName:"v-facade",value:(_vm.config),expression:"config"}],attrs:{"type":"text"},domProps:{"value":_vm.maskedValue},on:{"input":_vm.onInput,"change":_vm.onChange,"blur":function($event){return _vm.$emit('blur')},"focus":function($event){return _vm.$emit('focus')},"keyup":function($event){return _vm.$emit('keyup', $event)},"keydown":function($event){return _vm.$emit('keydown', $event)}}})} | ||
var staticRenderFns = [] | ||
// CONCATENATED MODULE: ./src/component.vue?vue&type=template&id=62e0c8a4& | ||
// CONCATENATED MODULE: ./src/component.vue?vue&type=template&id=e1f89d4c& | ||
@@ -668,0 +668,0 @@ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/component.vue?vue&type=script&lang=js& |
@@ -669,8 +669,8 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
}); | ||
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"3d99fa88-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/component.vue?vue&type=template&id=62e0c8a4& | ||
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('input',{directives:[{name:"facade",rawName:"v-facade",value:(_vm.config),expression:"config"}],attrs:{"type":"text"},domProps:{"value":_vm.maskedValue},on:{"input":_vm.onInput,"change":_vm.onChange,"blur":function($event){return _vm.$emit('blur')},"focus":function($event){return _vm.$emit('focus')},"keyup":function($event){return _vm.$emit('keyup')},"keydown":function($event){return _vm.$emit('keydown')}}})} | ||
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"3d99fa88-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/component.vue?vue&type=template&id=e1f89d4c& | ||
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('input',{directives:[{name:"facade",rawName:"v-facade",value:(_vm.config),expression:"config"}],attrs:{"type":"text"},domProps:{"value":_vm.maskedValue},on:{"input":_vm.onInput,"change":_vm.onChange,"blur":function($event){return _vm.$emit('blur')},"focus":function($event){return _vm.$emit('focus')},"keyup":function($event){return _vm.$emit('keyup', $event)},"keydown":function($event){return _vm.$emit('keydown', $event)}}})} | ||
var staticRenderFns = [] | ||
// CONCATENATED MODULE: ./src/component.vue?vue&type=template&id=62e0c8a4& | ||
// CONCATENATED MODULE: ./src/component.vue?vue&type=template&id=e1f89d4c& | ||
@@ -677,0 +677,0 @@ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/component.vue?vue&type=script&lang=js& |
@@ -1,1 +0,1 @@ | ||
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["vue-input-facade"]=t():e["vue-input-facade"]=t()})("undefined"!==typeof self?self:this,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="fb15")}({fb15:function(e,t,n){"use strict";if(n.r(t),n.d(t,"InputFacade",(function(){return j})),n.d(t,"facade",(function(){return _})),n.d(t,"tokens",(function(){return a})),n.d(t,"masker",(function(){return b})),n.d(t,"filter",(function(){return T})),"undefined"!==typeof window){var o=window.document.currentScript,i=o&&o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);i&&(n.p=i[1])}var a={"#":{pattern:/\d/},X:{pattern:/[0-9a-z]/i},S:{pattern:/[a-z]/i},A:{pattern:/[a-z]/i,transform:e=>e.toLocaleUpperCase()},a:{pattern:/[a-z]/i,transform:e=>e.toLocaleLowerCase()},"\\":{escape:!0},"?":{optional:!0},"*":{repeat:!0},"|":{pipe:!0}};const r="__input-facade__";function s(e){this.masked=this.unmasked=e||""}function u(){return new CustomEvent("input",{bubbles:!0,cancelable:!0,detail:{facade:!0}})}function l(e,t){return(Array.isArray(e)||"string"===typeof e)&&(e={mask:e}),Object.assign(e||{},t)}function d(e){const t=e instanceof HTMLInputElement?e:e.querySelector("input");if(!t)throw new Error("facade directive requires an input element");return t}function c(e,t){const{target:n,detail:o,inputType:i}=e;if(null!==o&&void 0!==o&&o.facade)return!1;if(e.stopPropagation(),["insertCompositionText","insertFromComposition"].includes(i)&&t[r].config.mask)return!1;const a=n.value,s=n.selectionEnd,{oldValue:l}=n[r];p(n,null,{emit:!1},e),f(e,a,s),l!==n.value&&n.dispatchEvent(u())}function f(e,t,n){const{target:o}=e,i=["text","tel","search",null].includes(o.getAttribute("type")),a=o[r]&&o[r].config;if(o!==document.activeElement||!i||!a.mask&&!a.masked)return;const s=e.inputType||"insertText",u=["insertText","insertFromPaste"].includes(s),l=u&&n==t.length;let d=u&&t[n-1];const c=o.value.toLocaleLowerCase();let f=n;if(l)f=c.length;else if(d){d=d.toLocaleLowerCase();let e=f;while(e<=c.length&&c.charAt(e-1)!==d)e++;f=e<=c.length?e:f-1}o.setSelectionRange(f,f),setTimeout((function(){o.setSelectionRange(f,f)}),0)}function p(e,t,{emit:n=!0,force:o=!1}={},i){var a,s;let{config:l,oldValue:d,isComposing:c}=e[r],f=(null===t||void 0===t||null===(a=t.data)||void 0===a||null===(s=a.model)||void 0===s?void 0:s.value)||e.value;if((!l.mask||!c)&&(d=d||"",f=f||"",o||d!==f)){["deleteByCut","deleteContent","deleteContentBackward","deleteContentForward"].includes(null===i||void 0===i?void 0:i.inputType)&&(l={...l,short:!0});let t=b(f,l);if(i&&"function"===typeof l.formatter){const n=l.formatter(t,i);if("string"===typeof n)t=b(n,l);else if(!1===n)return void(e.value=d)}e[r].oldValue=t.masked,e.unmaskedValue=t.unmasked,e.value!==t.masked&&(e.value=t.masked),n&&e.dispatchEvent(u())}}let m=a,v=!1;try{"a".localeCompare("b","i")}catch(I){v="RangeError"===I.name}function h(e){e&&(m=e)}function k(e,t){const n=t.masks.slice().sort((e,t)=>e.length-t.length),o=e=>Object.assign({},t,e),i=(t,n)=>{const i=g(e,o({mask:n})),a=t.unmasked.length,r=i.unmasked.length;return r>a?i:t};if(!n.length)return new s;const a=n.shift();let r=g(e,o({mask:a}));while(n.length){const e=n.shift();r=i(r,e)}return r}function g(e,t){let{mask:n="",tokens:o,prefill:i=!1,short:a=!1}=t;o=o?Object.assign({},m,o):m;let r=new s,u=!1,l=0,d=0,c="";function f(e){const t=n[d+1],i=o[t];return{escape:!(null===e||void 0===e||!e.escape),optional:!(null===i||void 0===i||!i.optional),repeat:!(null===i||void 0===i||!i.repeat),...(null===i||void 0===i?void 0:i.pipe)&&{pipe:n.substring(d).match(/^(.\|)+./g)[0].split("|")}}}while(d<n.length){const t=n[d],i=o[t];let a=e[l];const s=f(i);if(!i||u||s.pipe)if(s.pipe){if(!a)break;const e=s.pipe.find(y.bind(null,a));e&&(r.unmasked+=e,r.masked+=c+e,d+=2*s.pipe.length-1,c=""),l++}else y(a,t)?(r.masked+=c+t,l++,c="",s.optional&&(r.unmasked+=t)):s.optional||(c+=t),u=!1,d+=s.optional?2:1;else{var p,v;if(s.escape){u=!0,d++;continue}if(!a)break;if(null!==(p=i.pattern)&&void 0!==p&&p.test(a))a=(null===(v=i.transform)||void 0===v?void 0:v.call(i,a))||a,r.unmasked+=a,r.masked+=c+a,c="",s.repeat||(d+=s.optional?2:1);else if(s.optional||s.repeat){d+=2;continue}l++}}return(i&&!r.unmasked||!a&&r.unmasked)&&(r.masked+=c),r}function y(e,t){return v?0===(null===e||void 0===e?void 0:e.localeCompare(t,void 0,{sensitivity:"base"})):(null===e||void 0===e?void 0:e.toLocaleLowerCase())===(null===t||void 0===t?void 0:t.toLocaleLowerCase())}function b(e,t){return e=(e||"").toString(),t=l(t),t.mask?Array.isArray(t.mask)?k(e,Object.assign({},t,{masks:t.mask})):g(e,t):new s(e)}const w=r;var _={bind:(e,{value:t,modifiers:n},o)=>{e=d(e);const i=l(t,n);e[w]={config:i},p(e,o,{force:i.prefill})},inserted:e=>{e=d(e);const t=e[w],n=e.parentElement||e,o=t=>{t.target===e&&c(t,e)},i=t=>{t.target===e&&("compositionend"===t.type?(e[w].isComposing=!1,c(t,e)):e[w].isComposing=!0)};n.addEventListener("input",o,!0),n.addEventListener("compositionstart",i,!0),n.addEventListener("compositionupdate",i,!0),n.addEventListener("compositionend",i,!0),t.cleanup=()=>{n.removeEventListener("input",o,!0),n.removeEventListener("compositionstart",i,!0),n.removeEventListener("compositionend",i,!0),n.removeEventListener("compositionupdate",i,!0)}},update:(e,{value:t,oldValue:n,modifiers:o},i)=>{e=d(e),t!==n?(e[w].config=l(t,o),p(e,i,{force:!0})):p(e,i)},unbind:e=>{d(e)[w].cleanup()}},C=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("input",{directives:[{name:"facade",rawName:"v-facade",value:e.config,expression:"config"}],attrs:{type:"text"},domProps:{value:e.maskedValue},on:{input:e.onInput,change:e.onChange,blur:function(t){return e.$emit("blur")},focus:function(t){return e.$emit("focus")},keyup:function(t){return e.$emit("keyup")},keydown:function(t){return e.$emit("keydown")}}})},V=[],E={name:"InputFacade",props:{formatter:Function,lazy:{type:Boolean,default:!1},mask:[String,Array],masked:{type:Boolean,default:!1},prefill:{type:Boolean,default:!1},short:{type:Boolean,default:!1},tokens:Object,value:[String,Number]},directives:{facade:_},data(){return{maskedValue:this.value,unmaskedValue:null}},watch:{value(e){e!==this.emittedValue&&(this.maskedValue=e)},mask(e){e||this.masked||(this.maskedValue=this.unmaskedValue)},masked(){this.emitInput()}},computed:{config(){return{mask:this.mask,masked:this.masked,tokens:this.tokens,formatter:this.formatter,prefill:this.prefill,short:this.short}},emittedValue(){return this.mask&&this.masked?this.maskedValue:this.unmaskedValue}},methods:{onInput({target:e}){this.maskedValue=e.value,this.unmaskedValue=e.unmaskedValue,this.lazy||this.emitInput()},onChange(){this.$emit("change",this.emittedValue),this.lazy&&this.emitInput()},emitInput(){this.$emit("input",this.emittedValue)}}},L=E;function x(e,t,n,o,i,a,r,s){var u,l="function"===typeof e?e.options:e;if(t&&(l.render=t,l.staticRenderFns=n,l._compiled=!0),o&&(l.functional=!0),a&&(l._scopeId="data-v-"+a),r?(u=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),i&&i.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(r)},l._ssrRegister=u):i&&(u=s?function(){i.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:i),u)if(l.functional){l._injectStyles=u;var d=l.render;l.render=function(e,t){return u.call(t),d(e,t)}}else{var c=l.beforeCreate;l.beforeCreate=c?[].concat(c,u):[u]}return{exports:e,options:l}}var S=x(L,C,V,!1,null,null,null),j=S.exports;function O(e,t={}){t.tokens&&h(t.tokens),e.component(j.name,j),e.directive(t.name||"facade",_),e.filter(t.name||"facade",T)}function T(e,t){return b(e,t).masked}var $=O;"undefined"!==typeof window&&window.Vue&&window.Vue.use(O);t["default"]=$}})})); | ||
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["vue-input-facade"]=t():e["vue-input-facade"]=t()})("undefined"!==typeof self?self:this,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="fb15")}({fb15:function(e,t,n){"use strict";if(n.r(t),n.d(t,"InputFacade",(function(){return j})),n.d(t,"facade",(function(){return _})),n.d(t,"tokens",(function(){return a})),n.d(t,"masker",(function(){return b})),n.d(t,"filter",(function(){return T})),"undefined"!==typeof window){var o=window.document.currentScript,i=o&&o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);i&&(n.p=i[1])}var a={"#":{pattern:/\d/},X:{pattern:/[0-9a-z]/i},S:{pattern:/[a-z]/i},A:{pattern:/[a-z]/i,transform:e=>e.toLocaleUpperCase()},a:{pattern:/[a-z]/i,transform:e=>e.toLocaleLowerCase()},"\\":{escape:!0},"?":{optional:!0},"*":{repeat:!0},"|":{pipe:!0}};const r="__input-facade__";function s(e){this.masked=this.unmasked=e||""}function u(){return new CustomEvent("input",{bubbles:!0,cancelable:!0,detail:{facade:!0}})}function l(e,t){return(Array.isArray(e)||"string"===typeof e)&&(e={mask:e}),Object.assign(e||{},t)}function d(e){const t=e instanceof HTMLInputElement?e:e.querySelector("input");if(!t)throw new Error("facade directive requires an input element");return t}function c(e,t){const{target:n,detail:o,inputType:i}=e;if(null!==o&&void 0!==o&&o.facade)return!1;if(e.stopPropagation(),["insertCompositionText","insertFromComposition"].includes(i)&&t[r].config.mask)return!1;const a=n.value,s=n.selectionEnd,{oldValue:l}=n[r];p(n,null,{emit:!1},e),f(e,a,s),l!==n.value&&n.dispatchEvent(u())}function f(e,t,n){const{target:o}=e,i=["text","tel","search",null].includes(o.getAttribute("type")),a=o[r]&&o[r].config;if(o!==document.activeElement||!i||!a.mask&&!a.masked)return;const s=e.inputType||"insertText",u=["insertText","insertFromPaste"].includes(s),l=u&&n==t.length;let d=u&&t[n-1];const c=o.value.toLocaleLowerCase();let f=n;if(l)f=c.length;else if(d){d=d.toLocaleLowerCase();let e=f;while(e<=c.length&&c.charAt(e-1)!==d)e++;f=e<=c.length?e:f-1}o.setSelectionRange(f,f),setTimeout((function(){o.setSelectionRange(f,f)}),0)}function p(e,t,{emit:n=!0,force:o=!1}={},i){var a,s;let{config:l,oldValue:d,isComposing:c}=e[r],f=(null===t||void 0===t||null===(a=t.data)||void 0===a||null===(s=a.model)||void 0===s?void 0:s.value)||e.value;if((!l.mask||!c)&&(d=d||"",f=f||"",o||d!==f)){["deleteByCut","deleteContent","deleteContentBackward","deleteContentForward"].includes(null===i||void 0===i?void 0:i.inputType)&&(l={...l,short:!0});let t=b(f,l);if(i&&"function"===typeof l.formatter){const n=l.formatter(t,i);if("string"===typeof n)t=b(n,l);else if(!1===n)return void(e.value=d)}e[r].oldValue=t.masked,e.unmaskedValue=t.unmasked,e.value!==t.masked&&(e.value=t.masked),n&&e.dispatchEvent(u())}}let m=a,v=!1;try{"a".localeCompare("b","i")}catch(I){v="RangeError"===I.name}function h(e){e&&(m=e)}function k(e,t){const n=t.masks.slice().sort((e,t)=>e.length-t.length),o=e=>Object.assign({},t,e),i=(t,n)=>{const i=g(e,o({mask:n})),a=t.unmasked.length,r=i.unmasked.length;return r>a?i:t};if(!n.length)return new s;const a=n.shift();let r=g(e,o({mask:a}));while(n.length){const e=n.shift();r=i(r,e)}return r}function g(e,t){let{mask:n="",tokens:o,prefill:i=!1,short:a=!1}=t;o=o?Object.assign({},m,o):m;let r=new s,u=!1,l=0,d=0,c="";function f(e){const t=n[d+1],i=o[t];return{escape:!(null===e||void 0===e||!e.escape),optional:!(null===i||void 0===i||!i.optional),repeat:!(null===i||void 0===i||!i.repeat),...(null===i||void 0===i?void 0:i.pipe)&&{pipe:n.substring(d).match(/^(.\|)+./g)[0].split("|")}}}while(d<n.length){const t=n[d],i=o[t];let a=e[l];const s=f(i);if(!i||u||s.pipe)if(s.pipe){if(!a)break;const e=s.pipe.find(y.bind(null,a));e&&(r.unmasked+=e,r.masked+=c+e,d+=2*s.pipe.length-1,c=""),l++}else y(a,t)?(r.masked+=c+t,l++,c="",s.optional&&(r.unmasked+=t)):s.optional||(c+=t),u=!1,d+=s.optional?2:1;else{var p,v;if(s.escape){u=!0,d++;continue}if(!a)break;if(null!==(p=i.pattern)&&void 0!==p&&p.test(a))a=(null===(v=i.transform)||void 0===v?void 0:v.call(i,a))||a,r.unmasked+=a,r.masked+=c+a,c="",s.repeat||(d+=s.optional?2:1);else if(s.optional||s.repeat){d+=2;continue}l++}}return(i&&!r.unmasked||!a&&r.unmasked)&&(r.masked+=c),r}function y(e,t){return v?0===(null===e||void 0===e?void 0:e.localeCompare(t,void 0,{sensitivity:"base"})):(null===e||void 0===e?void 0:e.toLocaleLowerCase())===(null===t||void 0===t?void 0:t.toLocaleLowerCase())}function b(e,t){return e=(e||"").toString(),t=l(t),t.mask?Array.isArray(t.mask)?k(e,Object.assign({},t,{masks:t.mask})):g(e,t):new s(e)}const w=r;var _={bind:(e,{value:t,modifiers:n},o)=>{e=d(e);const i=l(t,n);e[w]={config:i},p(e,o,{force:i.prefill})},inserted:e=>{e=d(e);const t=e[w],n=e.parentElement||e,o=t=>{t.target===e&&c(t,e)},i=t=>{t.target===e&&("compositionend"===t.type?(e[w].isComposing=!1,c(t,e)):e[w].isComposing=!0)};n.addEventListener("input",o,!0),n.addEventListener("compositionstart",i,!0),n.addEventListener("compositionupdate",i,!0),n.addEventListener("compositionend",i,!0),t.cleanup=()=>{n.removeEventListener("input",o,!0),n.removeEventListener("compositionstart",i,!0),n.removeEventListener("compositionend",i,!0),n.removeEventListener("compositionupdate",i,!0)}},update:(e,{value:t,oldValue:n,modifiers:o},i)=>{e=d(e),t!==n?(e[w].config=l(t,o),p(e,i,{force:!0})):p(e,i)},unbind:e=>{d(e)[w].cleanup()}},C=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("input",{directives:[{name:"facade",rawName:"v-facade",value:e.config,expression:"config"}],attrs:{type:"text"},domProps:{value:e.maskedValue},on:{input:e.onInput,change:e.onChange,blur:function(t){return e.$emit("blur")},focus:function(t){return e.$emit("focus")},keyup:function(t){return e.$emit("keyup",t)},keydown:function(t){return e.$emit("keydown",t)}}})},V=[],E={name:"InputFacade",props:{formatter:Function,lazy:{type:Boolean,default:!1},mask:[String,Array],masked:{type:Boolean,default:!1},prefill:{type:Boolean,default:!1},short:{type:Boolean,default:!1},tokens:Object,value:[String,Number]},directives:{facade:_},data(){return{maskedValue:this.value,unmaskedValue:null}},watch:{value(e){e!==this.emittedValue&&(this.maskedValue=e)},mask(e){e||this.masked||(this.maskedValue=this.unmaskedValue)},masked(){this.emitInput()}},computed:{config(){return{mask:this.mask,masked:this.masked,tokens:this.tokens,formatter:this.formatter,prefill:this.prefill,short:this.short}},emittedValue(){return this.mask&&this.masked?this.maskedValue:this.unmaskedValue}},methods:{onInput({target:e}){this.maskedValue=e.value,this.unmaskedValue=e.unmaskedValue,this.lazy||this.emitInput()},onChange(){this.$emit("change",this.emittedValue),this.lazy&&this.emitInput()},emitInput(){this.$emit("input",this.emittedValue)}}},L=E;function x(e,t,n,o,i,a,r,s){var u,l="function"===typeof e?e.options:e;if(t&&(l.render=t,l.staticRenderFns=n,l._compiled=!0),o&&(l.functional=!0),a&&(l._scopeId="data-v-"+a),r?(u=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),i&&i.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(r)},l._ssrRegister=u):i&&(u=s?function(){i.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:i),u)if(l.functional){l._injectStyles=u;var d=l.render;l.render=function(e,t){return u.call(t),d(e,t)}}else{var c=l.beforeCreate;l.beforeCreate=c?[].concat(c,u):[u]}return{exports:e,options:l}}var S=x(L,C,V,!1,null,null,null),j=S.exports;function O(e,t={}){t.tokens&&h(t.tokens),e.component(j.name,j),e.directive(t.name||"facade",_),e.filter(t.name||"facade",T)}function T(e,t){return b(e,t).masked}var $=O;"undefined"!==typeof window&&window.Vue&&window.Vue.use(O);t["default"]=$}})})); |
{ | ||
"name": "vue-input-facade", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "A lightweight and dependency free input masking library created specific for Vue", | ||
@@ -5,0 +5,0 @@ "author": "Ronald Jerez <dlanor@gmail.com> (https://github.com/RonaldJerez/)", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
78249