@@ -25,6 +25,7 @@ export const BorderTabSet = (props: IBorderTabSetProps) => {
25
25
const { border, layout, size } = props ;
26
26
27
27
const toolbarRef = React . useRef < HTMLDivElement | null > ( null ) ;
28
+ const miniScrollRef = React . useRef < HTMLDivElement | null > ( null ) ;
28
29
const overflowbuttonRef = React . useRef < HTMLButtonElement | null > ( null ) ;
29
30
const stickyButtonsRef = React . useRef < HTMLDivElement | null > ( null ) ;
30
31
const tabStripInnerRef = React . useRef < HTMLDivElement | null > ( null ) ;
@@ -34,11 +35,11 @@ export const BorderTabSet = (props: IBorderTabSetProps) => {
34
35
React . useLayoutEffect ( ( ) => {
35
36
border . setTabHeaderRect ( Rect . getBoundingClientRect ( selfRef . current ! ) . relativeTo ( layout . getDomRect ( ) ! ) ) ;
36
37
} ) ;
37
-
38
- const { selfRef, userControlledPositionRef, onScroll, hiddenTabs, onMouseWheel, isTabOverflow } =
39
- useTabOverflow ( layout , border , Orientation . flip ( border . getOrientation ( ) ) , tabStripInnerRef ,
38
+
39
+ const { selfRef, userControlledPositionRef, onScroll, onScrollPointerDown , hiddenTabs, onMouseWheel, isTabOverflow } =
40
+ useTabOverflow ( layout , border , Orientation . flip ( border . getOrientation ( ) ) , tabStripInnerRef , miniScrollRef ,
40
41
layout . getClassName ( CLASSES . FLEXLAYOUT__BORDER_BUTTON )
41
- ) ;
42
+ ) ;
42
43
43
44
const onAuxMouseClick = ( event : React . MouseEvent < HTMLElement , MouseEvent > ) => {
44
45
if ( isAuxMouseEvent ( event ) ) {
@@ -56,13 +57,15 @@ export const BorderTabSet = (props: IBorderTabSetProps) => {
56
57
57
58
const onOverflowClick = ( event : React . MouseEvent < HTMLElement , MouseEvent > ) => {
58
59
const callback = layout . getShowOverflowMenu ( ) ;
59
- const items = hiddenTabs . map ( h => { return { index : h , node : ( border . getChildren ( ) [ h ] as TabNode ) } ; } ) ;
60
+ const items = hiddenTabs . map ( h => { return { index : h , node : ( border . getChildren ( ) [ h ] as TabNode ) } ; } ) ;
60
61
if ( callback !== undefined ) {
61
62
62
63
callback ( border , event , items , onOverflowItemSelect ) ;
63
64
} else {
64
65
const element = overflowbuttonRef . current ! ;
65
- showPopup ( element ,
66
+ showPopup (
67
+ element ,
68
+ border ,
66
69
items ,
67
70
onOverflowItemSelect ,
68
71
layout ) ;
@@ -72,7 +75,7 @@ export const BorderTabSet = (props: IBorderTabSetProps) => {
72
75
73
76
const onOverflowItemSelect = ( item : { node : TabNode ; index : number } ) => {
74
77
layout . doAction ( Actions . selectTab ( item . node . getId ( ) ) ) ;
75
- userControlledPositionRef . current = false ;
78
+ userControlledPositionRef . current = false ;
76
79
} ;
77
80
78
81
const onPopoutTab = ( event : React . MouseEvent < HTMLElement , MouseEvent > ) => {
@@ -149,7 +152,7 @@ export const BorderTabSet = (props: IBorderTabSetProps) => {
149
152
const overflowTitle = layout . i18nName ( I18nLabel . Overflow_Menu_Tooltip ) ;
150
153
let overflowContent ;
151
154
if ( typeof icons . more === "function" ) {
152
- const items = hiddenTabs . map ( h => { return { index : h , node : ( border . getChildren ( ) [ h ] as TabNode ) } ; } ) ;
155
+ const items = hiddenTabs . map ( h => { return { index : h , node : ( border . getChildren ( ) [ h ] as TabNode ) } ; } ) ;
153
156
154
157
overflowContent = icons . more ( border , items ) ;
155
158
} else {
@@ -200,17 +203,25 @@ export const BorderTabSet = (props: IBorderTabSetProps) => {
200
203
let outerStyle = { } ;
201
204
const borderHeight = size - 1 ;
202
205
if ( border . getLocation ( ) === DockLocation . LEFT ) {
203
- innerStyle = { right : "100%" , top :0 } ;
204
- outerStyle = { width : borderHeight , overflowY : "auto" } ;
206
+ innerStyle = { right : "100%" , top : 0 } ;
207
+ outerStyle = { width : borderHeight , overflowY : "auto" } ;
205
208
} else if ( border . getLocation ( ) === DockLocation . RIGHT ) {
206
- innerStyle = { left : "100%" , top :0 } ;
209
+ innerStyle = { left : "100%" , top : 0 } ;
207
210
outerStyle = { width : borderHeight , overflowY : "auto" } ;
208
211
} else {
209
- innerStyle = { left :0 } ;
212
+ innerStyle = { left : 0 } ;
210
213
outerStyle = { height : borderHeight , overflowX : "auto" } ;
211
214
}
212
- const miniScrollbarClasses = cm ( CLASSES . FLEXLAYOUT__MINI_SCROLLBAR ) + ( border . isEnableTabScrollbar ( ) ?"" :" " + cm ( CLASSES . FLEXLAYOUT__MINI_SCROLLBAR_HIDDEN ) ) ;
213
-
215
+
216
+ let miniScrollbar = undefined ;
217
+ if ( border . isEnableTabScrollbar ( ) ) {
218
+ miniScrollbar = (
219
+ < div ref = { miniScrollRef }
220
+ className = { cm ( CLASSES . FLEXLAYOUT__MINI_SCROLLBAR ) }
221
+ onPointerDown = { onScrollPointerDown }
222
+ />
223
+ ) ;
224
+ }
214
225
215
226
return (
216
227
< div
@@ -226,21 +237,24 @@ export const BorderTabSet = (props: IBorderTabSetProps) => {
226
237
onContextMenu = { onContextMenu }
227
238
onWheel = { onMouseWheel }
228
239
>
229
- < div
230
- ref = { tabStripInnerRef }
231
- className = { cm ( CLASSES . FLEXLAYOUT__BORDER_INNER ) + " " + cm ( CLASSES . FLEXLAYOUT__BORDER_INNER_ + border . getLocation ( ) . getName ( ) ) + " " + miniScrollbarClasses }
232
- style = { outerStyle }
233
- onScroll = { onScroll }
234
- >
240
+ < div className = { cm ( CLASSES . FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER ) } >
235
241
< div
236
- style = { innerStyle }
237
- className = { cm ( CLASSES . FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER ) + " " + cm ( CLASSES . FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_ + border . getLocation ( ) . getName ( ) ) }
242
+ ref = { tabStripInnerRef }
243
+ className = { cm ( CLASSES . FLEXLAYOUT__BORDER_INNER ) + " " + cm ( CLASSES . FLEXLAYOUT__BORDER_INNER_ + border . getLocation ( ) . getName ( ) ) }
244
+ style = { outerStyle }
245
+ onScroll = { onScroll }
238
246
>
239
- { tabButtons }
247
+ < div
248
+ style = { innerStyle }
249
+ className = { cm ( CLASSES . FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER ) + " " + cm ( CLASSES . FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_ + border . getLocation ( ) . getName ( ) ) }
250
+ >
251
+ { tabButtons }
252
+ </ div >
240
253
</ div >
254
+ { miniScrollbar }
241
255
</ div >
242
256
{ toolbar }
243
- </ div >
257
+ </ div >
244
258
) ;
245
259
246
260
} ;
0 commit comments