1
+ import keyboardKey from 'keyboard-key'
1
2
import _ from 'lodash'
2
3
import PropTypes from 'prop-types'
3
4
import React , { Children , cloneElement } from 'react'
8
9
doesNodeContainClick ,
9
10
eventStack ,
10
11
isBrowser ,
11
- keyboardKey ,
12
12
makeDebugger ,
13
13
META ,
14
14
} from '../../lib'
@@ -134,9 +134,7 @@ class Portal extends Component {
134
134
openOnTriggerClick : true ,
135
135
}
136
136
137
- static autoControlledProps = [
138
- 'open' ,
139
- ]
137
+ static autoControlledProps = [ 'open' ]
140
138
141
139
static _meta = {
142
140
name : 'Portal' ,
@@ -179,11 +177,11 @@ class Portal extends Component {
179
177
const { closeOnDocumentClick, closeOnRootNodeClick } = this . props
180
178
181
179
if (
182
- ! this . rootNode // not mounted
183
- || ! this . portalNode // no portal
184
- || doesNodeContainClick ( this . triggerNode , e ) // event happened in trigger (delegate to trigger handlers)
185
- || doesNodeContainClick ( this . portalNode , e ) // event happened in the portal
186
- ) return // ignore the click
180
+ ! this . rootNode || // not mounted
181
+ ! this . portalNode || // no portal
182
+ doesNodeContainClick ( this . triggerNode , e ) || // event happened in trigger (delegate to trigger handlers)
183
+ doesNodeContainClick ( this . portalNode , e ) // event happened in the portal
184
+ ) { return } // ignore the click
187
185
188
186
const didClickInRootNode = doesNodeContainClick ( this . rootNode , e )
189
187
@@ -359,11 +357,8 @@ class Portal extends Component {
359
357
eventStack . unsub ( 'mouseenter' , this . handlePortalMouseEnter , { pool : eventPool , target : this . portalNode } )
360
358
}
361
359
362
- ReactDOM . unstable_renderSubtreeIntoContainer (
363
- this ,
364
- Children . only ( children ) ,
365
- this . rootNode ,
366
- ( ) => this . attachRenderSubTreeSubscribers ( eventPool ) ,
360
+ ReactDOM . unstable_renderSubtreeIntoContainer ( this , Children . only ( children ) , this . rootNode , ( ) =>
361
+ this . attachRenderSubTreeSubscribers ( eventPool ) ,
367
362
)
368
363
}
369
364
@@ -383,11 +378,7 @@ class Portal extends Component {
383
378
384
379
debug ( 'mountPortal()' )
385
380
386
- const {
387
- eventPool,
388
- mountNode = isBrowser ( ) ? document . body : null ,
389
- prepend,
390
- } = this . props
381
+ const { eventPool, mountNode = isBrowser ( ) ? document . body : null , prepend } = this . props
391
382
392
383
this . rootNode = document . createElement ( 'div' )
393
384
0 commit comments