@@ -73,6 +73,7 @@ export const ActionsButton = injector(observer(({ store, size, hasSelected, ...r
73
73
const onClick = useCallback ( ( e ) => {
74
74
e . preventDefault ( ) ;
75
75
e . stopPropagation ( ) ;
76
+ if ( action . disabled ) return ;
76
77
action ?. callback ? action ?. callback ( store . currentView ?. selected ?. snapshot , action ) : invokeAction ( action , isDeleteAction ) ;
77
78
parentRef ?. current ?. close ?. ( ) ;
78
79
} , [ store . currentView ?. selected ] ) ;
@@ -88,12 +89,13 @@ export const ActionsButton = injector(observer(({ store, size, hasSelected, ...r
88
89
isSeparator : action . isSeparator ,
89
90
isTitle : action . isTitle ,
90
91
danger : isDeleteAction ,
92
+ disabled : action . disabled ,
91
93
} }
92
94
name = 'actionButton'
93
95
>
94
- < Elem name = 'titleContainer' >
96
+ < Elem name = 'titleContainer' { ... ( action . disabled ? { title : action . disabledReason } : { } ) } >
95
97
< Elem name = 'title' > { action . title } </ Elem >
96
- { hasChildren ? < Elem name = 'icon' tag = { FaChevronRight } /> : null }
98
+ { ( hasChildren ) ? < Elem name = 'icon' tag = { FaChevronRight } /> : null }
97
99
</ Elem >
98
100
</ Block >
99
101
) ;
@@ -125,8 +127,9 @@ export const ActionsButton = injector(observer(({ store, size, hasSelected, ...r
125
127
key = { action . id }
126
128
danger = { isDeleteAction }
127
129
onClick = { onClick }
128
- className = { `actionButton${ action . isSeparator ? "_isSeparator" : ( action . isTitle ? "_isTitle" : "" ) } ` }
130
+ className = { `actionButton${ action . isSeparator ? "_isSeparator" : ( action . isTitle ? "_isTitle" : "" ) } ${ ( action . disabled ) ? "actionButton_disabled" : "" } ` }
129
131
icon = { isDeleteAction && < FaTrash /> }
132
+ title = { action . disabled ? action . disabledReason : null }
130
133
>
131
134
{ action . title }
132
135
</ Menu . Item >
0 commit comments