File tree 4 files changed +39
-8
lines changed 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'
26
26
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
27
27
// import 'core-js/es7/reflect'
28
28
29
- import 'element-closest'
30
-
31
29
// CustomEvent() constructor functionality in IE9, IE10, IE11
32
30
( function ( ) {
33
31
Original file line number Diff line number Diff line change 37
37
"dependencies" : {
38
38
"@coreui/icons" : " 0.3.0" ,
39
39
"classnames" : " ^2.2.6" ,
40
- "core-js" : " ^2.5.7" ,
41
- "element-closest" : " ^2.0.2" ,
40
+ "core-js" : " ^2.6.1" ,
42
41
"prop-types" : " ^15.6.2" ,
43
42
"react-onclickout" : " ^2.0.8" ,
44
43
"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';
3
3
import PropTypes from 'prop-types' ;
4
4
import { sidebarCssClasses } from './Shared' ;
5
5
import ClickOutHandler from 'react-onclickout'
6
- import 'element-closest'
6
+ import './Shared/ element-closest'
7
7
8
8
const propTypes = {
9
9
children : PropTypes . node ,
@@ -80,10 +80,11 @@ class AppSidebar extends Component {
80
80
}
81
81
82
82
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
+ }
85
87
}
86
-
87
88
}
88
89
89
90
render ( ) {
You can’t perform that action at this time.
0 commit comments