File tree 3 files changed +15
-2
lines changed
3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ export function builtInPanelProblems(): IPanelItem {
51
51
id : PANEL_PROBLEMS ,
52
52
name : localize ( PANEL_PROBLEMS , 'problems' ) ,
53
53
data : null ,
54
+ sortIndex : 1 ,
54
55
} ;
55
56
}
56
57
Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ export interface IPanelItem<T = any> extends ITabProps<T> {
13
13
title ?: string ;
14
14
toolbox ?: IActionBarItemProps [ ] ;
15
15
data ?: T ;
16
+ /**
17
+ * The sort of panel item
18
+ */
19
+ sortIndex ?: number ;
16
20
}
17
21
18
22
export enum PanelEvent {
@@ -44,6 +48,7 @@ export function builtInOutputPanel() {
44
48
id : PANEL_OUTPUT ,
45
49
name : localize ( PANEL_OUTPUT , 'output' ) ,
46
50
data : '' ,
51
+ sortIndex : 2 ,
47
52
} ;
48
53
49
54
function onUpdateEditorIns (
Original file line number Diff line number Diff line change 1
1
import * as React from 'react' ;
2
2
import { getBEMElement , prefixClaName } from 'mo/common/className' ;
3
- import { IPanel } from 'mo/model/workbench/panel' ;
3
+ import { IPanel , IPanelItem } from 'mo/model/workbench/panel' ;
4
4
import { IPanelController } from 'mo/controller/panel' ;
5
5
import { Tabs } from 'mo/components/tabs' ;
6
6
import { ActionBar } from 'mo/components/actionBar' ;
@@ -30,13 +30,20 @@ export function Panel(props: IPanel & IPanelController) {
30
30
? current ?. renderPane ?.( current )
31
31
: current ?. renderPane ;
32
32
33
+ const sortedPanels = data ?. sort ( ( a : IPanelItem , b : IPanelItem ) => {
34
+ if ( a . sortIndex && b . sortIndex ) {
35
+ return a . sortIndex - b . sortIndex ;
36
+ }
37
+ return 1 ;
38
+ } ) ;
39
+
33
40
return (
34
41
< div className = { defaultClassName } >
35
42
< div className = { panelHeaderClassName } >
36
43
< Scrollable noScrollY isShowShadow >
37
44
< Tabs
38
45
activeTab = { current ?. id }
39
- data = { data }
46
+ data = { sortedPanels }
40
47
onSelectTab = { onTabChange }
41
48
onCloseTab = { onClose }
42
49
/>
You can’t perform that action at this time.
0 commit comments