@@ -16,11 +16,12 @@ export type NavigationTreeNodeType =
16
16
| 'transfer'
17
17
| 'view' ;
18
18
19
- export interface NavigationTreeDataItem {
19
+ export interface NavigationTreeDataItem < M = unknown > {
20
20
name : string ;
21
21
type : NavigationTreeNodeType ;
22
22
/** determined by type by default */
23
23
expandable ?: boolean ;
24
+ meta ?: M ;
24
25
}
25
26
26
27
export interface NavigationTreeState {
@@ -39,6 +40,7 @@ export interface NavigationTreeNodeState {
39
40
error : boolean ;
40
41
children : string [ ] ;
41
42
level ?: number ;
43
+ meta ?: unknown ;
42
44
}
43
45
44
46
export interface NavigationTreeServiceNode {
@@ -52,18 +54,23 @@ export type NavigationTreeNodePartialState = Omit<
52
54
'loading' | 'loaded' | 'error' | 'children'
53
55
> ;
54
56
55
- export interface NavigationTreeProps < D = any > {
57
+ export interface NavigationTreeProps < D = any , M = any > {
56
58
rootState : NavigationTreeNodePartialState ;
57
- fetchPath : ( path : string ) => Promise < NavigationTreeDataItem [ ] > ;
59
+ fetchPath : ( path : string ) => Promise < NavigationTreeDataItem < M > [ ] > ;
58
60
onActionsOpenToggle ?: ( args : {
59
61
path : string ;
60
62
type : NavigationTreeNodeType ;
61
63
isOpen : boolean ;
62
64
} ) => void ;
63
- getActions ?: ( path : string , type : NavigationTreeNodeType ) => DropdownMenuItemMixed < D > [ ] ;
65
+ getActions ?: (
66
+ path : string ,
67
+ type : NavigationTreeNodeType ,
68
+ meta : M ,
69
+ ) => DropdownMenuItemMixed < D > [ ] ;
64
70
renderAdditionalNodeElements ?: (
65
71
path : string ,
66
72
type : NavigationTreeNodeType ,
73
+ meta : M ,
67
74
) => JSX . Element | undefined ;
68
75
activePath ?: string ;
69
76
onActivePathUpdate ?: ( activePath : string ) => void ;
0 commit comments