File tree Expand file tree Collapse file tree 4 files changed +39
-8
lines changed Expand file tree Collapse file tree 4 files changed +39
-8
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,6 @@ import 'core-js/es7/object'
2626// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
2727// import 'core-js/es7/reflect'
2828
29- import 'element-closest'
30-
3129// CustomEvent() constructor functionality in IE9, IE10, IE11
3230( function ( ) {
3331
Original file line number Diff line number Diff line change 3737 "dependencies" : {
3838 "@coreui/icons" : " 0.3.0" ,
3939 "classnames" : " ^2.2.6" ,
40- "core-js" : " ^2.5.7" ,
41- "element-closest" : " ^2.0.2" ,
40+ "core-js" : " ^2.6.1" ,
4241 "prop-types" : " ^15.6.2" ,
4342 "react-onclickout" : " ^2.0.8" ,
4443 "react-perfect-scrollbar" : " ^1.4.2" ,
Original file line number Diff line number Diff line change 1+ ( function ( ElementProto ) {
2+ if ( ! ElementProto ) {
3+ return ;
4+ }
5+ if ( typeof ElementProto . matches !== 'function' ) {
6+ ElementProto . matches = ElementProto . msMatchesSelector || ElementProto . mozMatchesSelector || ElementProto . webkitMatchesSelector || function matches ( selector ) {
7+ const element = this ;
8+ const elements = ( element . document || element . ownerDocument ) . querySelectorAll ( selector ) ;
9+ let index = 0 ;
10+
11+ while ( elements [ index ] && elements [ index ] !== element ) {
12+ ++ index ;
13+ }
14+
15+ return Boolean ( elements [ index ] ) ;
16+ } ;
17+ }
18+
19+ if ( typeof ElementProto . closest !== 'function' ) {
20+ ElementProto . closest = function closest ( selector ) {
21+ let element = this ;
22+
23+ while ( element && element . nodeType === 1 ) {
24+ if ( element . matches ( selector ) ) {
25+ return element ;
26+ }
27+ element = element . parentNode ;
28+ }
29+
30+ return null ;
31+ } ;
32+ }
33+ } ) ( typeof window !== 'undefined' && window . Element . prototype ) ;
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import classNames from 'classnames';
33import PropTypes from 'prop-types' ;
44import { sidebarCssClasses } from './Shared' ;
55import ClickOutHandler from 'react-onclickout'
6- import 'element-closest'
6+ import './Shared/ element-closest'
77
88const propTypes = {
99 children : PropTypes . node ,
@@ -80,10 +80,11 @@ class AppSidebar extends Component {
8080 }
8181
8282 onClickOut ( e ) {
83- if ( ! e . target . closest ( '[data-sidebar-toggler]' ) ) {
84- this . hideMobile ( ) ;
83+ if ( typeof window !== 'undefined' && document . body . classList . contains ( 'sidebar-show' ) ) {
84+ if ( ! e . target . closest ( '[data-sidebar-toggler]' ) ) {
85+ this . hideMobile ( ) ;
86+ }
8587 }
86-
8788 }
8889
8990 render ( ) {
You can’t perform that action at this time.
0 commit comments