diff --git a/docs/asset-manifest.json b/docs/asset-manifest.json index 284ac6d..386981d 100644 --- a/docs/asset-manifest.json +++ b/docs/asset-manifest.json @@ -1,6 +1,6 @@ { - "index.css": "static/css/index.5ab0f80c.chunk.css", - "index.js": "static/js/index.5ab0f80c.chunk.js", + "index.css": "static/css/index.3a6ba616.chunk.css", + "index.js": "static/js/index.3a6ba616.chunk.js", "runtime-index.js": "static/js/runtime-index.7c9988e7.js", "static/js/2.14d2c2bc.chunk.js": "static/js/2.14d2c2bc.chunk.js", "index.html": "index.html" diff --git a/docs/index.html b/docs/index.html index 9d82e54..f737410 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ -trigger
\ No newline at end of file +trigger
\ No newline at end of file diff --git a/docs/static/css/index.5ab0f80c.chunk.css b/docs/static/css/index.3a6ba616.chunk.css similarity index 100% rename from docs/static/css/index.5ab0f80c.chunk.css rename to docs/static/css/index.3a6ba616.chunk.css diff --git a/docs/static/js/index.3a6ba616.chunk.js b/docs/static/js/index.3a6ba616.chunk.js new file mode 100644 index 0000000..8a46f56 --- /dev/null +++ b/docs/static/js/index.3a6ba616.chunk.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{127:function(e,t,o){},128:function(e,t,o){},129:function(e,t,o){},140:function(e,t,o){"use strict";o.r(t);var n=o(0),i=o.n(n),r=o(3),a=o.n(r),s=(o(127),o(128),o(129),o(47),o(131),o(2)),l=o.n(s),u=o(8),c=o.n(u),p=o(1),d=o.n(p),h=o(9),m=o.n(h),f=o(29),v=o.n(f),g=(o(133),o(134),o(82),o(75),o(135),o(87)),b=o(18),T=o(23),y=o(31),w=o(33),M=o(86),E=o(85);function H(e,t,o){var n=o[0],i=o[1];return"top"===t&&(i*=-1),"left"===e&&(n*=-1),n&&(e+=n>0?"+"+n:n),i&&(t+=i>0?"+"+i:i),[e,t].join(" ")}var k={left:function(e){return{at:H("left","center",e),my:"right center"}},top:function(e){return{at:H("center","top",e),my:"center bottom"}},right:function(e){return{at:H("right","center",e),my:"left center"}},bottom:function(e){return{at:H("center","bottom",e),my:"center top"}},topLeft:function(e){return{at:H("left","top",e),my:"left bottom"}},topRight:function(e){return{at:H("right","top",e),my:"right bottom"}},leftTop:function(e){return{at:H("left","top",e),my:"right top"}},leftBottom:function(e){return{at:H("left","bottom",e),my:"right bottom"}},rightTop:function(e){return{at:H("right","top",e),my:"left top"}},rightBottom:function(e){return{at:H("right","bottom",e),my:"left bottom"}},bottomLeft:function(e){return{at:H("left","bottom",e),my:"left top"}},bottomRight:function(e){return{at:H("right","bottom",e),my:"right top"}}};var C=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),i=0;i0?"+"+n:n),i&&(t+=i>0?"+"+i:i),[e,t].join(" ")}var k={left:function(e){return{at:H("left","center",e),my:"right center"}},top:function(e){return{at:H("center","top",e),my:"center bottom"}},right:function(e){return{at:H("right","center",e),my:"left center"}},bottom:function(e){return{at:H("center","bottom",e),my:"center top"}},topLeft:function(e){return{at:H("left","top",e),my:"left bottom"}},topRight:function(e){return{at:H("right","top",e),my:"right bottom"}},leftTop:function(e){return{at:H("left","top",e),my:"right top"}},leftBottom:function(e){return{at:H("left","bottom",e),my:"right bottom"}},rightTop:function(e){return{at:H("right","top",e),my:"left top"}},rightBottom:function(e){return{at:H("right","bottom",e),my:"left bottom"}},bottomLeft:function(e){return{at:H("left","bottom",e),my:"left top"}},bottomRight:function(e){return{at:H("right","bottom",e),my:"right top"}}};var C=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),i=0;i { action: ["click"], showAction: [], hideAction: [], - outsideHideEventName: ["mousedown", "click", "scroll"], + outsideHideEventName: ["mousedown", "click"], //, "scroll" delay: 0, getDocument: () => window.document, container: document.body, @@ -177,7 +177,7 @@ export class Trigger extends React.Component { protected delayTimer: number | null = null; - popupInstance: Popup; + popupInstance?: Popup; triggerInstance: React.ReactInstance; protected refHandlers = { @@ -250,7 +250,11 @@ export class Trigger extends React.Component { // close popup when trigger type contains 'onContextMenu' and window is blur. if (!this.contextMenuOutsideHandler2 && this.isContextMenuToShow()) { //@ts-ignore - this.contextMenuOutsideHandler2 = listen(window, "blur", this.onContextMenuClose); + this.contextMenuOutsideHandler2 = listen( + window as any, + "blur", + this.onContextMenuClose + ); } // if (!this.windowScrollHandler && this.isWindowScrollToHide()) { @@ -275,7 +279,7 @@ export class Trigger extends React.Component { } getPopupNode() { - return this.popupInstance.getPopupDOM(); + return this.popupInstance?.getPopupDOM(); } protected getComponentNode() { @@ -285,9 +289,9 @@ export class Trigger extends React.Component { protected onOutsideClickToHide = (event: MouseEvent) => { const target = event.target as Element; const triggerNode = this.getTriggerNode(); - const popupRootNode = this.popupInstance.getRootDOM(); + const popupRootNode = this.popupInstance?.getRootDOM(); - if (!contains(triggerNode, target) && !contains(popupRootNode!, target)) { + if (popupRootNode && !contains(triggerNode, target) && !contains(popupRootNode!, target)) { this.hide(); } };