d3-context-menu
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -1,1 +0,1 @@ | ||
!function(t,e){if("object"==typeof module&&module.exports){var n=require("d3");module.exports=e(n)}else if("function"==typeof define&&define.amd){try{n=require("d3")}catch(e){n=t.d3}n.contextMenu=e(n),define([],function(){return n.contextMenu})}else t.d3&&(t.d3.contextMenu=e(t.d3))}(this,function(t){var e={noop:function(){},isFn:function(t){return"function"==typeof t},const:function(t){return function(){return t}},toFactory:function(t,n){return t=void 0===t?n:t,e.isFn(t)?t:e.const(t)}},n=null,o=function(){n&&(t.select(".d3-context-menu").remove(),t.select("body").on("mousedown.d3-context-menu",null),n.boundCloseCallback(),n=null)};return function(i,c){if("close"===i)return o();i=e.toFactory(i);var r=(c=e.isFn(c)?{onOpen:c}:c||{}).onOpen||e.noop,d=c.onClose||e.noop,u=e.toFactory(c.position),l=e.toFactory(c.theme,"d3-context-menu-theme");return function(c,a){var s=this;if(o(),n={boundCloseCallback:d.bind(s,c,a)},t.selectAll(".d3-context-menu").data([1]).enter().append("div").attr("class","d3-context-menu "+l.bind(s)(c,a)),t.select("body").on("mousedown.d3-context-menu",o),t.selectAll(".d3-context-menu").on("contextmenu",function(){o(),t.event.preventDefault(),t.event.stopPropagation()}).append("ul").selectAll("li").data(i.bind(s)(c,a)).enter().append("li").attr("class",function(t){var n="";return e.toFactory(t.divider).bind(s)(c,a)&&(n+=" is-divider"),e.toFactory(t.disabled).bind(s)(c,a)&&(n+=" is-disabled"),t.action||(n+=" is-header"),n}).html(function(t){return e.toFactory(t.divider).bind(s)(c,a)?"<hr>":(t.title||console.error("No title attribute set. Check the spelling of your options."),e.toFactory(t.title).bind(s)(c,a))}).on("click",function(t,n){e.toFactory(t.disabled).bind(s)(c,a)||t.action&&(t.action.bind(s)(c,a),o())}),!1!==r.bind(s)(c,a)){var f=u.bind(s)(c,a);t.select(".d3-context-menu").style("left",(f?f.left:t.event.pageX-2)+"px").style("top",(f?f.top:t.event.pageY-2)+"px"),t.event.preventDefault(),t.event.stopPropagation()}}}}); | ||
!function(t,e){if("object"==typeof module&&module.exports){var n=require("d3");module.exports=e(n)}else if("function"==typeof define&&define.amd){try{n=require("d3")}catch(e){n=t.d3}n.contextMenu=e(n),define([],function(){return n.contextMenu})}else t.d3&&(t.d3.contextMenu=e(t.d3))}(this,function(t){var e={noop:function(){},isFn:function(t){return"function"==typeof t},const:function(t){return function(){return t}},toFactory:function(t,n){return t=void 0===t?n:t,e.isFn(t)?t:e.const(t)}},n=null,o=function(){n&&(t.select(".d3-context-menu").remove(),t.select("body").on("mousedown.d3-context-menu",null),n.boundCloseCallback(),n=null)};return function(i,c){if("close"===i)return o();i=e.toFactory(i);var r=(c=e.isFn(c)?{onOpen:c}:c||{}).onOpen||e.noop,d=c.onClose||e.noop,l=e.toFactory(c.position),u=e.toFactory(c.theme,"d3-context-menu-theme");return function(c,a){var s=this;if(o(),n={boundCloseCallback:d.bind(s,c,a)},t.selectAll(".d3-context-menu").data([1]).enter().append("div").attr("class","d3-context-menu "+u.bind(s)(c,a)),t.select("body").on("mousedown.d3-context-menu",o),t.selectAll(".d3-context-menu").on("contextmenu",function(){o(),t.event.preventDefault(),t.event.stopPropagation()}).append("ul").selectAll("li").data(i.bind(s)(c,a)).enter().append("li").attr("class",function(t){var n="";return e.toFactory(t.divider).bind(s)(c,a)&&(n+=" is-divider"),e.toFactory(t.disabled).bind(s)(c,a)&&(n+=" is-disabled"),t.action||(n+=" is-header"),n}).html(function(t){return e.toFactory(t.divider).bind(s)(c,a)?"<hr>":(t.title||console.error("No title attribute set. Check the spelling of your options."),e.toFactory(t.title).bind(s)(c,a))}).on("click",function(t,n){e.toFactory(t.disabled).bind(s)(c,a)||t.action&&(t.action.bind(s)(c,a),o())}),!1!==r.bind(s)(c,a)){var f=l.bind(s)(c,a);t.select(".d3-context-menu").style("left",(f?f.left:t.event.pageX-2)+"px").style("top",(f?f.top:t.event.pageY-2)+"px").style("display","block"),t.event.preventDefault(),t.event.stopPropagation()}}}}); |
@@ -171,3 +171,4 @@ (function(root, factory) { | ||
.style('left', (position ? position.left : d3.event.pageX - 2) + 'px') | ||
.style('top', (position ? position.top : d3.event.pageY - 2) + 'px'); | ||
.style('top', (position ? position.top : d3.event.pageY - 2) + 'px') | ||
.style('display', 'block'); | ||
@@ -174,0 +175,0 @@ d3.event.preventDefault(); |
{ | ||
"name": "d3-context-menu", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A plugin for d3.js that allows you to easily use context menus in your visualizations.", | ||
@@ -5,0 +5,0 @@ "main": "js/d3-context-menu.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
31328
265