vue-simple-context-menu
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -60,3 +60,6 @@ import Vue from 'vue'; | ||
hideContextMenu: function hideContextMenu () { | ||
document.getElementById(this.id).classList.remove('vue-simple-context-menu--active'); | ||
var element = document.getElementById(this.id); | ||
if (element) { | ||
element.classList.remove('vue-simple-context-menu--active'); | ||
} | ||
}, | ||
@@ -63,0 +66,0 @@ onClickOutside: function onClickOutside (event) { |
@@ -1,1 +0,1 @@ | ||
var VueSimpleContextMenu=function(e,t,i){"use strict";function n(e){n.installed||(n.installed=!0,e.component("VueSimpleContextMenu",o))}t=t&&t.hasOwnProperty("default")?t.default:t,i=i&&i.hasOwnProperty("default")?i.default:i,function(){if("undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style"),i='.vue-simple-context-menu[data-v-718435e8] { top: 0; left: 0; margin: 0; padding: 0; display: none; list-style: none; position: absolute; z-index: 1000000; background-color: #ECF0F1; border-bottom-width: 0px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; box-shadow: 0 3px 6px 0 rgba(51, 51, 51, 0.2); border-radius: 4px; } .vue-simple-context-menu--active[data-v-718435e8] { display: block; } .vue-simple-context-menu__item[data-v-718435e8] { display: flex; color: #333; cursor: pointer; padding: 5px 15px; align-items: center; } .vue-simple-context-menu__item[data-v-718435e8]:hover { background-color: #3482B5; color: #fff; } .vue-simple-context-menu li[data-v-718435e8]:first-of-type { margin-top: 4px; } .vue-simple-context-menu li[data-v-718435e8]:last-of-type { margin-bottom: 4px; } ';t.type="text/css",t.styleSheet?t.styleSheet.cssText=i:t.appendChild(document.createTextNode(i)),e.appendChild(t)}}(),t.use(i);var o={render:function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("ul",{directives:[{name:"click-outside",rawName:"v-click-outside",value:e.onClickOutside,expression:"onClickOutside"}],staticClass:"vue-simple-context-menu",attrs:{id:e.id}},e._l(e.options,function(t){return i("li",{staticClass:"vue-simple-context-menu__item",on:{click:function(i){e.optionClicked(t)}}},[e._v(" "+e._s(t.name)+" ")])}))])},staticRenderFns:[],_scopeId:"data-v-718435e8",name:"VueSimpleContextMenu",props:{id:{type:String,required:!0},options:{type:Array,required:!0}},data:function(){return{item:null,menuWidth:null,menuHeight:null}},computed:{},methods:{showMenu:function(e,t){this.item=t;var i=document.getElementById(this.id);i&&(this.menuWidth&&this.menuHeight||(i.style.visibility="hidden",i.style.display="block",this.menuWidth=i.offsetWidth,this.menuHeight=i.offsetHeight,i.removeAttribute("style")),this.menuWidth+e.pageX>=window.innerWidth?i.style.left=e.pageX-this.menuWidth+2+"px":i.style.left=e.pageX-2+"px",this.menuHeight+e.pageY>=window.innerHeight?i.style.top=e.pageY-this.menuHeight+2+"px":i.style.top=e.pageY-2+"px",i.classList.add("vue-simple-context-menu--active"))},hideContextMenu:function(){document.getElementById(this.id).classList.remove("vue-simple-context-menu--active")},onClickOutside:function(e){this.hideContextMenu()},optionClicked:function(e){this.hideContextMenu(),this.$emit("optionClicked",{item:this.item,option:e})}}},s={install:n},l=null;return"undefined"!=typeof window?l=window.Vue:"undefined"!=typeof global&&(l=global.Vue),l&&l.use(s),e.install=n,e.default=o,e}({},Vue,vClickOutside); | ||
var VueSimpleContextMenu=function(e,t,i){"use strict";function n(e){n.installed||(n.installed=!0,e.component("VueSimpleContextMenu",o))}t=t&&t.hasOwnProperty("default")?t.default:t,i=i&&i.hasOwnProperty("default")?i.default:i,function(){if("undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style"),i='.vue-simple-context-menu[data-v-718435e8] { top: 0; left: 0; margin: 0; padding: 0; display: none; list-style: none; position: absolute; z-index: 1000000; background-color: #ECF0F1; border-bottom-width: 0px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; box-shadow: 0 3px 6px 0 rgba(51, 51, 51, 0.2); border-radius: 4px; } .vue-simple-context-menu--active[data-v-718435e8] { display: block; } .vue-simple-context-menu__item[data-v-718435e8] { display: flex; color: #333; cursor: pointer; padding: 5px 15px; align-items: center; } .vue-simple-context-menu__item[data-v-718435e8]:hover { background-color: #3482B5; color: #fff; } .vue-simple-context-menu li[data-v-718435e8]:first-of-type { margin-top: 4px; } .vue-simple-context-menu li[data-v-718435e8]:last-of-type { margin-bottom: 4px; } ';t.type="text/css",t.styleSheet?t.styleSheet.cssText=i:t.appendChild(document.createTextNode(i)),e.appendChild(t)}}(),t.use(i);var o={render:function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("ul",{directives:[{name:"click-outside",rawName:"v-click-outside",value:e.onClickOutside,expression:"onClickOutside"}],staticClass:"vue-simple-context-menu",attrs:{id:e.id}},e._l(e.options,function(t){return i("li",{staticClass:"vue-simple-context-menu__item",on:{click:function(i){e.optionClicked(t)}}},[e._v(" "+e._s(t.name)+" ")])}))])},staticRenderFns:[],_scopeId:"data-v-718435e8",name:"VueSimpleContextMenu",props:{id:{type:String,required:!0},options:{type:Array,required:!0}},data:function(){return{item:null,menuWidth:null,menuHeight:null}},computed:{},methods:{showMenu:function(e,t){this.item=t;var i=document.getElementById(this.id);i&&(this.menuWidth&&this.menuHeight||(i.style.visibility="hidden",i.style.display="block",this.menuWidth=i.offsetWidth,this.menuHeight=i.offsetHeight,i.removeAttribute("style")),this.menuWidth+e.pageX>=window.innerWidth?i.style.left=e.pageX-this.menuWidth+2+"px":i.style.left=e.pageX-2+"px",this.menuHeight+e.pageY>=window.innerHeight?i.style.top=e.pageY-this.menuHeight+2+"px":i.style.top=e.pageY-2+"px",i.classList.add("vue-simple-context-menu--active"))},hideContextMenu:function(){var e=document.getElementById(this.id);e&&e.classList.remove("vue-simple-context-menu--active")},onClickOutside:function(e){this.hideContextMenu()},optionClicked:function(e){this.hideContextMenu(),this.$emit("optionClicked",{item:this.item,option:e})}}},s={install:n},l=null;return"undefined"!=typeof window?l=window.Vue:"undefined"!=typeof global&&(l=global.Vue),l&&l.use(s),e.install=n,e.default=o,e}({},Vue,vClickOutside); |
@@ -66,3 +66,6 @@ (function (global, factory) { | ||
hideContextMenu: function hideContextMenu () { | ||
document.getElementById(this.id).classList.remove('vue-simple-context-menu--active'); | ||
var element = document.getElementById(this.id); | ||
if (element) { | ||
element.classList.remove('vue-simple-context-menu--active'); | ||
} | ||
}, | ||
@@ -69,0 +72,0 @@ onClickOutside: function onClickOutside (event) { |
{ | ||
"name": "vue-simple-context-menu", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Simple context-menu component built for Vue. Works well with both left and right clicks. Nothing too fancy, just works and is simple to use.", | ||
@@ -5,0 +5,0 @@ "author": "John Datserakis <johndatserakis@gmail.com>", |
@@ -5,2 +5,10 @@ # vue-simple-context-menu | ||
<p align="left"> | ||
<a href="https://www.npmjs.com/package/vue-simple-context-menu"><img src="https://img.shields.io/npm/v/vue-simple-context-menu.svg" alt="NPM Version"></a> | ||
<a href="https://www.npmjs.com/package/vue-simple-context-menu"><img src="https://img.shields.io/npm/dt/vue-simple-context-menu.svg" alt="NPM Downloads"></a> | ||
<a href="http://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a> | ||
<a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fjohndatserakis%2Fvue-simple-context-menu&text=Check%20out%20vue-simple-context-menu%20on%20GitHub&via=johndatserakis"> | ||
<img src="https://img.shields.io/twitter/url/https/github.com/johndatserakis/vue-simple-context-menu.svg?style=social" alt="Tweet"></a> | ||
</p> | ||
### Demo | ||
@@ -7,0 +15,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1022775
812
150