@@ -7,7 +7,10 @@ import TabLabel from './TabLabel'
77import Menu from 'components/Menu'
88import ContextMenu from 'components/ContextMenu'
99import i18n from 'utils/createI18n'
10-
10+ import * as SideBar from 'components/Panel/SideBar/actions'
11+ import config from 'config'
12+ import * as Panel from 'components/Panel/actions'
13+ import panelState from 'components/Panel/state'
1114
1215@defaultProps ( props => ( {
1316 addTab : ( ) => props . tabGroup . addTab ( ) ,
@@ -43,6 +46,7 @@ class TabBar extends Component {
4346 } = this . props
4447
4548 const tabBarId = `tab_bar_${ tabGroup . id } `
49+ const size = panelState . panels . get ( 'PANEL_BOTTOM' ) . size
4650
4751 return (
4852 < div id = { tabBarId }
@@ -67,12 +71,28 @@ class TabBar extends Component {
6771 </ svg >
6872 </ div >
6973 < div onDoubleClick = { addTab } className = 'tab-dbclick-area' />
74+ { ( ! config . isPad || tabGroup . id !== 'terminalGroup' )
75+ && < div className = 'tab-show-list'
76+ style = { { marginBottom : '-2px' } }
77+ onClick = { e => {
78+ e . stopPropagation ( )
79+ this . setState ( { showDropdownMenu : ! this . state . showDropdownMenu } )
80+ } }
81+ >
82+ < i className = 'fa fa-ellipsis-h' />
83+ { this . renderDropdownMenu ( size ) }
84+ </ div > }
85+ { tabGroup . id === 'terminalGroup' &&
7086 < div className = 'tab-show-list'
71- onClick = { ( e ) => { e . stopPropagation ( ) ; this . setState ( { showDropdownMenu : true } ) } }
87+ style = { { marginBottom : size ? '4px' : '-6px' } }
88+ onClick = { e => {
89+ e . stopPropagation ( )
90+ ! size ? Panel . expandPanel ( 'PANEL_BOTTOM' )
91+ : Panel . shrinkPanel ( 'PANEL_BOTTOM' )
92+ } }
7293 >
73- < i className = 'fa fa-sort-desc' />
74- { this . renderDropdownMenu ( ) }
75- </ div >
94+ < i className = { `fa fa-sort-${ size ? 'desc' : 'asc' } ` } />
95+ </ div > }
7696 < ContextMenu
7797 items = { contextMenuItems }
7898 isActive = { this . state . showContextMenu }
@@ -88,20 +108,26 @@ class TabBar extends Component {
88108 e . stopPropagation ( )
89109 e . preventDefault ( )
90110
111+ const rects = e . target . getBoundingClientRect ( )
112+ const isPad = config . isPad
113+
91114 this . setState ( {
92115 showContextMenu : true ,
93- contextMenuPos : { x : e . clientX , y : e . clientY } ,
116+ contextMenuPos : {
117+ x : isPad ? rects . x : e . clientX ,
118+ y : isPad ? rects . y : e . clientY
119+ } ,
94120 contextMenuContext : context ,
95121 } )
96122 }
97123
98- renderDropdownMenu ( ) {
124+ renderDropdownMenu ( size ) {
99125 if ( ! this . state . showDropdownMenu ) return null
100126 const dropdownMenuItems = this . makeDropdownMenuItems ( )
101127 if ( ! dropdownMenuItems . length ) return null
102- return ( < Menu className = 'top-down to-left'
128+ return ( < Menu className = { `${ size ? 'top-down' : 'bottom-top' } to-left` }
129+ style = { { bottom : size ? 'initial' : '15px' , right : '2px' } }
103130 items = { dropdownMenuItems }
104- style = { { right : '2px' } }
105131 deactivate = { e => this . setState ( { showDropdownMenu : false } ) }
106132 /> )
107133 }
0 commit comments