vue-numeric-keypad
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -19,2 +19,14 @@ // | ||
// | ||
if (!Object.entries) { | ||
Object.entries = function (obj) { | ||
var ownProps = Object.keys(obj), | ||
i = ownProps.length, | ||
resArray = new Array(i); // preallocate the Array | ||
while (i--) resArray[i] = [ownProps[i], obj[ownProps[i]]]; | ||
return resArray; | ||
}; | ||
} | ||
var script = { | ||
@@ -21,0 +33,0 @@ name: "VueNumericKeypad", |
@@ -1,1 +0,1 @@ | ||
var VueNumericKeypad=function(){"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var o,i,r=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(o=n.next()).done)&&(r.push(o.value),!e||r.length!==e);s=!0);}catch(t){a=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return n(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);"Object"===o&&t.constructor&&(o=t.constructor.name);if("Map"===o||"Set"===o)return Array.from(t);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return n(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function o(t,e,n,o,i,r,s,a,l,u){"boolean"!=typeof s&&(l=a,a=s,s=!1);const d="function"==typeof n?n.options:n;let h;if(t&&t.render&&(d.render=t.render,d.staticRenderFns=t.staticRenderFns,d._compiled=!0,i&&(d.functional=!0)),o&&(d._scopeId=o),r?(h=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,l(t)),t&&t._registeredComponents&&t._registeredComponents.add(r)},d._ssrRegister=h):e&&(h=s?function(t){e.call(this,u(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),h)if(d.functional){const t=d.render;d.render=function(e,n){return h.call(n),t(e,n)}}else{const t=d.beforeCreate;d.beforeCreate=t?[].concat(t,h):[h]}return n}var i=o({render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{directives:[{name:"show",rawName:"v-show",value:t.show,expression:"show"}],class:t.keypadClass,style:t.keypadStyles,attrs:{id:t.id},on:{click:function(e){t.stopPropagation&&e.stopPropagation()}}},[n("div",{class:t.buttonWrapClass,style:t.buttonWrapStyles},t._l(t.keyArray,(function(e,o){return n("button",{key:o,ref:"button",refInFor:!0,class:t.buttonClass+" "+(-1===e?t.deleteButtonClass:""===e?t.blankButtonClass:""),style:t.btnStyle(e),attrs:{type:"button"},on:{click:function(n){return t.click(e)}}},[t._v("\n "+t._s(t.showKey(e))+"\n ")])})),0)])},staticRenderFns:[]},undefined,{name:"VueNumericKeypad",props:{id:{type:String,required:!1},value:{type:String,default:"",required:!0},show:{type:[Boolean,Number],default:!1,required:!0},options:{type:Object,default:function(){return{}},validator:function(e){if(!e.keyArray)return!0;for(var n=0;n<e.keyArray;n++){var o=e.keyArray[n];switch(t(o)){case"number":if(!Number.isInteger(o)||o<-1||o>9)return console.error("keyArray can only have an integer 'number' between -1 and 9 and an empty 'string' type."),!1;break;case"string":if(o)return console.error("keyArray can only have an integer 'number' between -1 and 9 and an empty 'string' type."),!1;break;default:return!1}}return!0},required:!1}},data:function(){var t=Number(this.options.columns)||3;return{keyArray:void 0===this.options.keyArray?3===t?[1,2,3,4,5,6,7,8,9,"",0,-1]:[1,2,3,4,5,6,7,8,9,0,"",-1]:this.options.keyArray,keyRandomize:void 0===this.options.keyRandomize||Boolean(this.options.keyRandomize),randomizeWhenClick:void 0!==this.options.randomizeWhenClick&&Boolean(this.options.randomizeWhenClick),fixDeleteKey:void 0===this.options.fixDeleteKey||Boolean(this.options.fixDeleteKey),stopPropagation:void 0===this.options.stopPropagation||Boolean(this.options.stopPropagation),keypadClass:void 0===this.options.keypadClass?"numeric-keypad":String(this.options.keypadClass),buttonWrapClass:void 0===this.options.buttonWrapClass?"numeric-keypad__button-wrap":String(this.options.buttonWrapClass),buttonClass:void 0===this.options.buttonClass?"numeric-keypad__button":String(this.options.buttonClass),deleteButtonClass:void 0===this.options.deleteButtonClass?"numeric-keypad__button--delete":String(this.options.deleteButtonClass),blankButtonClass:void 0===this.options.blankButtonClass?"numeric-keypad__button--blank":String(this.options.blankButtonClass),rows:Number(this.options.rows)||4,columns:t,zIndex:Number(this.options.zIndex)||1,cellWidth:0,cellHeight:0}},watch:{show:function(){this.$nextTick(function(){this.show&&(this.cellWidth=this.$refs.button[0].offsetWidth,this.cellHeight=this.$refs.button[0].offsetHeight)}.bind(this)),this.keyRandomize&&this.randomize(this.fixDeleteKey)}},computed:{keypadStyles:function(){var t=.3*Math.min(this.cellWidth,this.cellHeight);return this.options.keypadStyles||{position:"fixed",zIndex:this.zIndex,bottom:0,left:0,right:0,height:"40vh",padding:"10px",backgroundColor:"#fff",borderRadius:"10px 10px 0 0",boxShadow:"0 -4px 4px rgba(0, 0, 0, 0.1)",color:"#000",overflow:"hidden",fontSize:t+"px"}},buttonWrapStyles:function(){return this.options.buttonWrapStyles||{display:"grid",width:"100%",height:"100%",gridTemplateColumns:"repeat(".concat(this.columns,", 1fr)"),gridTemplateRows:"repeat(".concat(this.rows,", 1fr)"),gridGap:"5px"}},buttonStyles:function(){return this.options.buttonStyles||{display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"#fff",border:"1px solid #000",borderRadius:"5px",fontSize:"inherit"}},deleteButtonStyles:function(){return this.options.deleteButtonStyles||this.options.buttonStyles||this.buttonStyles},blankButtonStyles:function(){return this.options.blankButtonStyles||this.options.buttonStyles||this.buttonStyles}},methods:{click:function(t){var e="";e=-1===t?this.value.slice(0,-1):this.value+t,this.$emit("update:value",String(e)),this.keyRandomize&&this.randomizeWhenClick&&this.randomize(this.fixDeleteKey)},randomize:function(t){for(var e=[],n=0,o=0;o<this.keyArray.length;o++){var i=Math.random();t&&-1==this.keyArray[o]?n++:i<.5?e.push(this.keyArray[o]):e.unshift(this.keyArray[o])}if(n)for(var r=0;r<n;r++)e.push(-1);this.keyArray=e},showKey:function(t){return-1===t?"del":t},btnStyle:function(t){return-1===t?this.deleteButtonStyles:"number"==typeof t?this.buttonStyles:this.blankButtonStyles},resize:function(){this.cellWidth=this.$refs.button[0].offsetWidth,this.cellHeight=this.$refs.button[0].offsetHeight}},mounted:function(){window.addEventListener("resize",this.resize),this.cellWidth=this.$refs.button[0].offsetWidth,this.cellHeight=this.$refs.button[0].offsetHeight,this.keyRandomize&&this.randomize(this.fixDeleteKey)},beforeDestroy:function(){window.removeEventListener("resize",this.resize)}},undefined,false,undefined,!1,void 0,void 0,void 0),r=function(){var t=i;return t.install=function(e){e.component("VueNumericKeypad",t)},t}(),s=Object.freeze({__proto__:null,default:r});return Object.entries(s).forEach((function(t){var n=e(t,2),o=n[0],i=n[1];"default"!==o&&(r[o]=i)})),r}(); | ||
var VueNumericKeypad=function(){"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var o,i,r=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(o=n.next()).done)&&(r.push(o.value),!e||r.length!==e);s=!0);}catch(t){a=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return n(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);"Object"===o&&t.constructor&&(o=t.constructor.name);if("Map"===o||"Set"===o)return Array.from(t);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return n(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function o(t,e,n,o,i,r,s,a,l,u){"boolean"!=typeof s&&(l=a,a=s,s=!1);const d="function"==typeof n?n.options:n;let h;if(t&&t.render&&(d.render=t.render,d.staticRenderFns=t.staticRenderFns,d._compiled=!0,i&&(d.functional=!0)),o&&(d._scopeId=o),r?(h=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,l(t)),t&&t._registeredComponents&&t._registeredComponents.add(r)},d._ssrRegister=h):e&&(h=s?function(t){e.call(this,u(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),h)if(d.functional){const t=d.render;d.render=function(e,n){return h.call(n),t(e,n)}}else{const t=d.beforeCreate;d.beforeCreate=t?[].concat(t,h):[h]}return n}Object.entries||(Object.entries=function(t){for(var e=Object.keys(t),n=e.length,o=new Array(n);n--;)o[n]=[e[n],t[e[n]]];return o});var i=o({render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{directives:[{name:"show",rawName:"v-show",value:t.show,expression:"show"}],class:t.keypadClass,style:t.keypadStyles,attrs:{id:t.id},on:{click:function(e){t.stopPropagation&&e.stopPropagation()}}},[n("div",{class:t.buttonWrapClass,style:t.buttonWrapStyles},t._l(t.keyArray,(function(e,o){return n("button",{key:o,ref:"button",refInFor:!0,class:t.buttonClass+" "+(-1===e?t.deleteButtonClass:""===e?t.blankButtonClass:""),style:t.btnStyle(e),attrs:{type:"button"},on:{click:function(n){return t.click(e)}}},[t._v("\n "+t._s(t.showKey(e))+"\n ")])})),0)])},staticRenderFns:[]},undefined,{name:"VueNumericKeypad",props:{id:{type:String,required:!1},value:{type:String,default:"",required:!0},show:{type:[Boolean,Number],default:!1,required:!0},options:{type:Object,default:function(){return{}},validator:function(e){if(!e.keyArray)return!0;for(var n=0;n<e.keyArray;n++){var o=e.keyArray[n];switch(t(o)){case"number":if(!Number.isInteger(o)||o<-1||o>9)return console.error("keyArray can only have an integer 'number' between -1 and 9 and an empty 'string' type."),!1;break;case"string":if(o)return console.error("keyArray can only have an integer 'number' between -1 and 9 and an empty 'string' type."),!1;break;default:return!1}}return!0},required:!1}},data:function(){var t=Number(this.options.columns)||3;return{keyArray:void 0===this.options.keyArray?3===t?[1,2,3,4,5,6,7,8,9,"",0,-1]:[1,2,3,4,5,6,7,8,9,0,"",-1]:this.options.keyArray,keyRandomize:void 0===this.options.keyRandomize||Boolean(this.options.keyRandomize),randomizeWhenClick:void 0!==this.options.randomizeWhenClick&&Boolean(this.options.randomizeWhenClick),fixDeleteKey:void 0===this.options.fixDeleteKey||Boolean(this.options.fixDeleteKey),stopPropagation:void 0===this.options.stopPropagation||Boolean(this.options.stopPropagation),keypadClass:void 0===this.options.keypadClass?"numeric-keypad":String(this.options.keypadClass),buttonWrapClass:void 0===this.options.buttonWrapClass?"numeric-keypad__button-wrap":String(this.options.buttonWrapClass),buttonClass:void 0===this.options.buttonClass?"numeric-keypad__button":String(this.options.buttonClass),deleteButtonClass:void 0===this.options.deleteButtonClass?"numeric-keypad__button--delete":String(this.options.deleteButtonClass),blankButtonClass:void 0===this.options.blankButtonClass?"numeric-keypad__button--blank":String(this.options.blankButtonClass),rows:Number(this.options.rows)||4,columns:t,zIndex:Number(this.options.zIndex)||1,cellWidth:0,cellHeight:0}},watch:{show:function(){this.$nextTick(function(){this.show&&(this.cellWidth=this.$refs.button[0].offsetWidth,this.cellHeight=this.$refs.button[0].offsetHeight)}.bind(this)),this.keyRandomize&&this.randomize(this.fixDeleteKey)}},computed:{keypadStyles:function(){var t=.3*Math.min(this.cellWidth,this.cellHeight);return this.options.keypadStyles||{position:"fixed",zIndex:this.zIndex,bottom:0,left:0,right:0,height:"40vh",padding:"10px",backgroundColor:"#fff",borderRadius:"10px 10px 0 0",boxShadow:"0 -4px 4px rgba(0, 0, 0, 0.1)",color:"#000",overflow:"hidden",fontSize:t+"px"}},buttonWrapStyles:function(){return this.options.buttonWrapStyles||{display:"grid",width:"100%",height:"100%",gridTemplateColumns:"repeat(".concat(this.columns,", 1fr)"),gridTemplateRows:"repeat(".concat(this.rows,", 1fr)"),gridGap:"5px"}},buttonStyles:function(){return this.options.buttonStyles||{display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"#fff",border:"1px solid #000",borderRadius:"5px",fontSize:"inherit"}},deleteButtonStyles:function(){return this.options.deleteButtonStyles||this.options.buttonStyles||this.buttonStyles},blankButtonStyles:function(){return this.options.blankButtonStyles||this.options.buttonStyles||this.buttonStyles}},methods:{click:function(t){var e="";e=-1===t?this.value.slice(0,-1):this.value+t,this.$emit("update:value",String(e)),this.keyRandomize&&this.randomizeWhenClick&&this.randomize(this.fixDeleteKey)},randomize:function(t){for(var e=[],n=0,o=0;o<this.keyArray.length;o++){var i=Math.random();t&&-1==this.keyArray[o]?n++:i<.5?e.push(this.keyArray[o]):e.unshift(this.keyArray[o])}if(n)for(var r=0;r<n;r++)e.push(-1);this.keyArray=e},showKey:function(t){return-1===t?"del":t},btnStyle:function(t){return-1===t?this.deleteButtonStyles:"number"==typeof t?this.buttonStyles:this.blankButtonStyles},resize:function(){this.cellWidth=this.$refs.button[0].offsetWidth,this.cellHeight=this.$refs.button[0].offsetHeight}},mounted:function(){window.addEventListener("resize",this.resize),this.cellWidth=this.$refs.button[0].offsetWidth,this.cellHeight=this.$refs.button[0].offsetHeight,this.keyRandomize&&this.randomize(this.fixDeleteKey)},beforeDestroy:function(){window.removeEventListener("resize",this.resize)}},undefined,false,undefined,!1,void 0,void 0,void 0),r=function(){var t=i;return t.install=function(e){e.component("VueNumericKeypad",t)},t}(),s=Object.freeze({__proto__:null,default:r});return Object.entries(s).forEach((function(t){var n=e(t,2),o=n[0],i=n[1];"default"!==o&&(r[o]=i)})),r}(); |
@@ -92,2 +92,16 @@ 'use strict';function _typeof(obj) { | ||
// | ||
if (!Object.entries) { | ||
Object.entries = function (obj) { | ||
var ownProps = Object.keys(obj), | ||
i = ownProps.length, | ||
resArray = new Array(i); // preallocate the Array | ||
while (i--) { | ||
resArray[i] = [ownProps[i], obj[ownProps[i]]]; | ||
} | ||
return resArray; | ||
}; | ||
} | ||
var script = { | ||
@@ -411,3 +425,3 @@ name: "VueNumericKeypad", | ||
var __vue_module_identifier__ = "data-v-5ef9e1a0"; | ||
var __vue_module_identifier__ = "data-v-6e789d66"; | ||
/* functional template */ | ||
@@ -414,0 +428,0 @@ |
{ | ||
"name": "vue-numeric-keypad", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "The virtual numeric keypad that can be used on Vue.", | ||
@@ -5,0 +5,0 @@ "main": "dist/vue-numeric-keypad.ssr.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49272
774