Skip to content

Commit

Permalink
Merge pull request #40 from VISIONSBOX/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
johndatserakis authored Oct 18, 2021
2 parents 5b35145 + 287cb20 commit 68910ad
Show file tree
Hide file tree
Showing 7 changed files with 8,771 additions and 145 deletions.
99 changes: 50 additions & 49 deletions dist/vue-simple-context-menu.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import vClickOutside from 'v-click-outside';
Vue.use(vClickOutside);

var script = {
name: 'VueSimpleContextMenu',
name: "VueSimpleContextMenu",
props: {
elementId: {
type: String,
Expand All @@ -16,20 +16,20 @@ var script = {
required: true
}
},
data: function data () {
data: function data() {
return {
item: null,
menuWidth: null,
menuHeight: null
}
};
},
methods: {
showMenu: function showMenu (event, item) {
showMenu: function showMenu(event, item) {
this.item = item;

var menu = document.getElementById(this.elementId);
if (!menu) {
return
return;
}

if (!this.menuWidth || !this.menuHeight) {
Expand All @@ -40,47 +40,48 @@ var script = {
menu.removeAttribute("style");
}

if ((this.menuWidth + event.pageX) >= window.innerWidth) {
menu.style.left = (event.pageX - this.menuWidth + 2) + "px";
if (this.menuWidth + event.pageX >= window.innerWidth) {
menu.style.left = event.pageX - this.menuWidth + 2 + "px";
} else {
menu.style.left = (event.pageX - 2) + "px";
menu.style.left = event.pageX - 2 + "px";
}

if ((this.menuHeight + event.pageY) >= window.innerHeight) {
menu.style.top = (event.pageY - this.menuHeight + 2) + "px";
if (this.menuHeight + event.pageY >= window.innerHeight) {
menu.style.top = event.pageY - this.menuHeight + 2 + "px";
} else {
menu.style.top = (event.pageY - 2) + "px";
menu.style.top = event.pageY - 2 + "px";
}

menu.classList.add('vue-simple-context-menu--active');
menu.classList.add("vue-simple-context-menu--active");
},
hideContextMenu: function hideContextMenu () {
hideContextMenu: function hideContextMenu() {
var element = document.getElementById(this.elementId);
if (element) {
element.classList.remove('vue-simple-context-menu--active');
element.classList.remove("vue-simple-context-menu--active");
this.$emit("menu-closed");
}
},
onClickOutside: function onClickOutside () {
onClickOutside: function onClickOutside() {
this.hideContextMenu();
},
optionClicked: function optionClicked (option) {
optionClicked: function optionClicked(option) {
this.hideContextMenu();
this.$emit('option-clicked', {
this.$emit("option-clicked", {
item: this.item,
option: option
});
},
onEscKeyRelease: function onEscKeyRelease (event) {
onEscKeyRelease: function onEscKeyRelease(event) {
if (event.keyCode === 27) {
this.hideContextMenu();
}
}
},
mounted: function mounted () {
document.body.addEventListener('keyup', this.onEscKeyRelease);
mounted: function mounted() {
document.body.addEventListener("keyup", this.onEscKeyRelease);
},
beforeDestroy: function beforeDestroy () {
document.removeEventListener('keyup', this.onEscKeyRelease);
beforeDestroy: function beforeDestroy() {
document.removeEventListener("keyup", this.onEscKeyRelease);
}
};

Expand Down Expand Up @@ -239,33 +240,33 @@ __vue_render__._withStripped = true;
undefined
);

// Import vue component

// install function executed by Vue.use()
function install (Vue) {
if (install.installed) { return; }
install.installed = true;
Vue.component('VueSimpleContextMenu', __vue_component__);
}

// Create module definition for Vue.use()
var plugin = {
install: install,
};

// To auto-install when vue is found
var GlobalVue = null;
if (typeof window !== 'undefined') {
GlobalVue = window.Vue;
} else if (typeof global !== 'undefined') {
GlobalVue = global.Vue;
}
if (GlobalVue) {
GlobalVue.use(plugin);
}

// It's possible to expose named exports when writing components that can
// also be used as directives, etc. - eg. import { RollupDemoDirective } from 'rollup-demo';
// Import vue component

// install function executed by Vue.use()
function install (Vue) {
if (install.installed) { return; }
install.installed = true;
Vue.component('VueSimpleContextMenu', __vue_component__);
}

// Create module definition for Vue.use()
var plugin = {
install: install,
};

// To auto-install when vue is found
var GlobalVue = null;
if (typeof window !== 'undefined') {
GlobalVue = window.Vue;
} else if (typeof global !== 'undefined') {
GlobalVue = global.Vue;
}
if (GlobalVue) {
GlobalVue.use(plugin);
}

// It's possible to expose named exports when writing components that can
// also be used as directives, etc. - eg. import { RollupDemoDirective } from 'rollup-demo';
// export const RollupDemoDirective = component;

export default __vue_component__;
Expand Down
2 changes: 1 addition & 1 deletion dist/vue-simple-context-menu.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

99 changes: 50 additions & 49 deletions dist/vue-simple-context-menu.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Vue.use(vClickOutside);

var script = {
name: 'VueSimpleContextMenu',
name: "VueSimpleContextMenu",
props: {
elementId: {
type: String,
Expand All @@ -22,20 +22,20 @@
required: true
}
},
data: function data () {
data: function data() {
return {
item: null,
menuWidth: null,
menuHeight: null
}
};
},
methods: {
showMenu: function showMenu (event, item) {
showMenu: function showMenu(event, item) {
this.item = item;

var menu = document.getElementById(this.elementId);
if (!menu) {
return
return;
}

if (!this.menuWidth || !this.menuHeight) {
Expand All @@ -46,47 +46,48 @@
menu.removeAttribute("style");
}

if ((this.menuWidth + event.pageX) >= window.innerWidth) {
menu.style.left = (event.pageX - this.menuWidth + 2) + "px";
if (this.menuWidth + event.pageX >= window.innerWidth) {
menu.style.left = event.pageX - this.menuWidth + 2 + "px";
} else {
menu.style.left = (event.pageX - 2) + "px";
menu.style.left = event.pageX - 2 + "px";
}

if ((this.menuHeight + event.pageY) >= window.innerHeight) {
menu.style.top = (event.pageY - this.menuHeight + 2) + "px";
if (this.menuHeight + event.pageY >= window.innerHeight) {
menu.style.top = event.pageY - this.menuHeight + 2 + "px";
} else {
menu.style.top = (event.pageY - 2) + "px";
menu.style.top = event.pageY - 2 + "px";
}

menu.classList.add('vue-simple-context-menu--active');
menu.classList.add("vue-simple-context-menu--active");
},
hideContextMenu: function hideContextMenu () {
hideContextMenu: function hideContextMenu() {
var element = document.getElementById(this.elementId);
if (element) {
element.classList.remove('vue-simple-context-menu--active');
element.classList.remove("vue-simple-context-menu--active");
this.$emit("menu-closed");
}
},
onClickOutside: function onClickOutside () {
onClickOutside: function onClickOutside() {
this.hideContextMenu();
},
optionClicked: function optionClicked (option) {
optionClicked: function optionClicked(option) {
this.hideContextMenu();
this.$emit('option-clicked', {
this.$emit("option-clicked", {
item: this.item,
option: option
});
},
onEscKeyRelease: function onEscKeyRelease (event) {
onEscKeyRelease: function onEscKeyRelease(event) {
if (event.keyCode === 27) {
this.hideContextMenu();
}
}
},
mounted: function mounted () {
document.body.addEventListener('keyup', this.onEscKeyRelease);
mounted: function mounted() {
document.body.addEventListener("keyup", this.onEscKeyRelease);
},
beforeDestroy: function beforeDestroy () {
document.removeEventListener('keyup', this.onEscKeyRelease);
beforeDestroy: function beforeDestroy() {
document.removeEventListener("keyup", this.onEscKeyRelease);
}
};

Expand Down Expand Up @@ -245,33 +246,33 @@
undefined
);

// Import vue component

// install function executed by Vue.use()
function install (Vue) {
if (install.installed) { return; }
install.installed = true;
Vue.component('VueSimpleContextMenu', __vue_component__);
}

// Create module definition for Vue.use()
var plugin = {
install: install,
};

// To auto-install when vue is found
var GlobalVue = null;
if (typeof window !== 'undefined') {
GlobalVue = window.Vue;
} else if (typeof global !== 'undefined') {
GlobalVue = global.Vue;
}
if (GlobalVue) {
GlobalVue.use(plugin);
}

// It's possible to expose named exports when writing components that can
// also be used as directives, etc. - eg. import { RollupDemoDirective } from 'rollup-demo';
// Import vue component

// install function executed by Vue.use()
function install (Vue) {
if (install.installed) { return; }
install.installed = true;
Vue.component('VueSimpleContextMenu', __vue_component__);
}

// Create module definition for Vue.use()
var plugin = {
install: install,
};

// To auto-install when vue is found
var GlobalVue = null;
if (typeof window !== 'undefined') {
GlobalVue = window.Vue;
} else if (typeof global !== 'undefined') {
GlobalVue = global.Vue;
}
if (GlobalVue) {
GlobalVue.use(plugin);
}

// It's possible to expose named exports when writing components that can
// also be used as directives, etc. - eg. import { RollupDemoDirective } from 'rollup-demo';
// export const RollupDemoDirective = component;

exports.default = __vue_component__;
Expand Down
6 changes: 3 additions & 3 deletions docs/build.js

Large diffs are not rendered by default.

Loading

0 comments on commit 68910ad

Please sign in to comment.