@@ -10,39 +10,39 @@ export enum EditorEvent {
10
10
OpenTab = 'editor.openTab' ,
11
11
OnSelectTab = 'editor.selectTab' ,
12
12
}
13
- export interface IEditor {
13
+ export interface IEditor < T > {
14
14
current : IEditorGroup | undefined ;
15
15
groups : IEditorGroup [ ] ;
16
16
closeAll ?: ( ) => void ;
17
17
onCloseTab ?: ( tabKey ?: string , group ?: number ) => void ;
18
18
render ?: ( ) => React . ReactNode ;
19
- onMoveTab ?: ( tabs : ITab [ ] , group ?: number ) => void ;
19
+ onMoveTab ?: ( tabs : ITab < T > [ ] , group ?: number ) => void ;
20
20
onSelectTab ?: ( tabKey : string , group ?: number ) => void ;
21
21
}
22
22
23
- export interface IEditorGroup < E = any > {
23
+ export interface IEditorGroup < E = any , T = any > {
24
24
id : number ;
25
- activeTab : ITab ;
26
- tabs : ITab [ ] ;
25
+ activeTab : ITab < T > ;
26
+ tabs : ITab < T > [ ] ;
27
27
breadcrumb : any [ ] ;
28
28
actions : any [ ] ;
29
29
menu : any [ ] ;
30
30
editorInstance ?: E | null ;
31
31
}
32
32
33
- export class EditorGroupModel implements IEditorGroup {
33
+ export class EditorGroupModel < T > implements IEditorGroup < T > {
34
34
id : number ;
35
- activeTab : ITab ;
36
- tabs : ITab [ ] ;
35
+ activeTab : ITab < T > ;
36
+ tabs : ITab < T > [ ] ;
37
37
breadcrumb : any [ ] ;
38
38
actions : any [ ] ;
39
39
menu : any [ ] ;
40
40
editorInstance : any ;
41
41
42
42
constructor (
43
43
id : number ,
44
- activeTab : ITab ,
45
- tabs : ITab [ ] ,
44
+ activeTab : ITab < T > ,
45
+ tabs : ITab < T > [ ] ,
46
46
breadcrumb : any [ ] = [ ] ,
47
47
actions : any [ ] = [ ] ,
48
48
menu : any [ ] = [ ] ,
@@ -60,7 +60,7 @@ export class EditorGroupModel implements IEditorGroup {
60
60
61
61
@observable ( )
62
62
@injectable ( )
63
- export class EditorModel implements IEditor {
63
+ export class EditorModel < T > implements IEditor < T > {
64
64
public current : IEditorGroup | undefined ;
65
65
public groups ! : IEditorGroup [ ] ;
66
66
@@ -78,7 +78,7 @@ export class EditorModel implements IEditor {
78
78
public readonly onSelectTab = ( tabKey : string , groupId ?: number ) => {
79
79
EventBus . emit ( EditorEvent . OnSelectTab , tabKey , groupId ) ;
80
80
} ;
81
- public readonly onMoveTab = ( updateTabs : ITab [ ] , groupId ?: number ) => {
81
+ public readonly onMoveTab = ( updateTabs : ITab < T > [ ] , groupId ?: number ) => {
82
82
EventBus . emit ( EditorEvent . OnMoveTab , updateTabs , groupId ) ;
83
83
} ;
84
84
public readonly onCloseTab = ( tabKey ?: string , groupId ?: number ) => {
0 commit comments