@@ -8,34 +8,34 @@ import {
8
8
} from 'mo/common/className' ;
9
9
import { useContextMenu } from 'mo/components/contextMenu' ;
10
10
import { select } from 'mo/common/dom' ;
11
- import { IMenuItem , Menu } from 'mo/components/menu' ;
11
+ import { IMenuItemProps , Menu } from 'mo/components/menu' ;
12
12
import { mergeFunctions } from 'mo/common/utils' ;
13
13
14
- export interface IActionBarItem < T = any > {
14
+ export interface IActionBarItemProps < T = any > {
15
15
id ?: string ;
16
16
name ?: string ;
17
17
title ?: string ;
18
18
iconName ?: string ;
19
19
disabled ?: boolean ;
20
20
checked ?: boolean ;
21
21
data ?: T ;
22
- contextMenu ?: IMenuItem [ ] ;
22
+ contextMenu ?: IMenuItemProps [ ] ;
23
23
className ?: string ;
24
24
onContextMenuClick ?: (
25
25
e : React . MouseEvent ,
26
- item : IMenuItem | undefined
26
+ item : IMenuItemProps | undefined
27
27
) => void ;
28
- onClick ?( event : React . MouseEvent , item : IActionBarItem ) : void ;
28
+ onClick ?( event : React . MouseEvent , item : IActionBarItemProps ) : void ;
29
29
}
30
30
31
- export interface IActionBar < T = any > {
32
- data : IActionBarItem < T > [ ] ;
31
+ export interface IActionBarProps < T = any > {
32
+ data : IActionBarItemProps < T > [ ] ;
33
33
className ?: string ;
34
34
onContextMenuClick ?: (
35
35
e : React . MouseEvent ,
36
- item : IMenuItem | undefined
36
+ item : IMenuItemProps | undefined
37
37
) => void ;
38
- onClick ?( event : React . MouseEvent , item : IActionBarItem ) : void ;
38
+ onClick ?( event : React . MouseEvent , item : IActionBarItemProps ) : void ;
39
39
}
40
40
41
41
const defaultActionBarClassName = prefixClaName ( 'action-bar' ) ;
@@ -48,7 +48,7 @@ const itemDisabledClassName = getBEMModifier(itemClassName, 'disabled');
48
48
const itemCheckedClassName = getBEMModifier ( itemClassName , 'checked' ) ;
49
49
const labelClassName = getBEMElement ( defaultActionBarClassName , 'label' ) ;
50
50
51
- export function ActionBarItem ( props : IActionBarItem ) {
51
+ export function ActionBarItem ( props : IActionBarItemProps ) {
52
52
const {
53
53
id,
54
54
title,
@@ -71,7 +71,7 @@ export function ActionBarItem(props: IActionBarItem) {
71
71
let contextViewMenu ;
72
72
73
73
const onClickMenuItem = useCallback (
74
- ( e : React . MouseEvent , item : IMenuItem | undefined ) => {
74
+ ( e : React . MouseEvent , item : IMenuItemProps | undefined ) => {
75
75
onContextMenuClick ?.( e , item ) ;
76
76
contextViewMenu ?. dispose ( ) ;
77
77
} ,
@@ -118,7 +118,7 @@ export function ActionBarItem(props: IActionBarItem) {
118
118
) ;
119
119
}
120
120
121
- export default function ActionBar < T = any > ( props : IActionBar < T > ) {
121
+ export function ActionBar < T = any > ( props : IActionBarProps < T > ) {
122
122
const {
123
123
data = [ ] ,
124
124
onClick,
@@ -129,7 +129,7 @@ export default function ActionBar<T = any>(props: IActionBar<T>) {
129
129
130
130
const claNames = classNames ( defaultActionBarClassName , className ) ;
131
131
132
- const items = data . map ( ( item : IActionBarItem < T > , index ) => (
132
+ const items = data . map ( ( item : IActionBarItemProps < T > , index ) => (
133
133
< ActionBarItem
134
134
key = { item . id }
135
135
{ ...item }
0 commit comments