@@ -67,11 +67,12 @@ const Item = styled.div<{
67
67
$padding : string ;
68
68
$textTransform :string ;
69
69
$textDecoration :string ;
70
+ $disabled ?: boolean ;
70
71
} > `
71
72
height: 30px;
72
73
line-height: 30px;
73
74
padding: ${ ( props ) => props . $padding ? props . $padding : '0 16px' } ;
74
- color: ${ ( props ) => ( props . $active ? props . $activeColor : props . $color ) } ;
75
+ color: ${ ( props ) => props . $disabled ? ` ${ props . $color } 80` : ( props . $active ? props . $activeColor : props . $color ) } ;
75
76
font-weight: ${ ( props ) => ( props . $textWeight ? props . $textWeight : 500 ) } ;
76
77
font-family:${ ( props ) => ( props . $fontFamily ? props . $fontFamily : 'sans-serif' ) } ;
77
78
font-style:${ ( props ) => ( props . $fontStyle ? props . $fontStyle : 'normal' ) } ;
@@ -81,8 +82,8 @@ const Item = styled.div<{
81
82
margin:${ ( props ) => props . $margin ? props . $margin : '0px' } ;
82
83
83
84
&:hover {
84
- color: ${ ( props ) => props . $activeColor } ;
85
- cursor: pointer;
85
+ color: ${ ( props ) => props . $disabled ? ( props . $active ? props . $activeColor : props . $color ) : props . $ activeColor} ;
86
+ cursor: ${ ( props ) => props . $disabled ? 'not-allowed' : ' pointer' } ;
86
87
}
87
88
88
89
.anticon {
@@ -166,6 +167,7 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
166
167
const label = view ?. label ;
167
168
const active = ! ! view ?. active ;
168
169
const onEvent = view ?. onEvent ;
170
+ const disabled = ! ! view ?. disabled ;
169
171
const subItems = isCompItem ? view ?. items : [ ] ;
170
172
171
173
const subMenuItems : Array < { key : string ; label : string } > = [ ] ;
@@ -199,7 +201,8 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
199
201
$textTransform = { props . style . textTransform }
200
202
$textDecoration = { props . style . textDecoration }
201
203
$margin = { props . style . margin }
202
- onClick = { ( ) => onEvent && onEvent ( "click" ) }
204
+ $disabled = { disabled }
205
+ onClick = { ( ) => { if ( ! disabled && onEvent ) onEvent ( "click" ) ; } }
203
206
>
204
207
{ label }
205
208
{ Array . isArray ( subItems ) && subItems . length > 0 && < DownOutlined /> }
@@ -209,6 +212,7 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
209
212
const subMenu = (
210
213
< StyledMenu
211
214
onClick = { ( e ) => {
215
+ if ( disabled ) return ;
212
216
const subItem = subItems [ Number ( e . key ) ] ;
213
217
const onSubEvent = subItem ?. getView ( ) ?. onEvent ;
214
218
onSubEvent && onSubEvent ( "click" ) ;
@@ -221,6 +225,7 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
221
225
< Dropdown
222
226
key = { idx }
223
227
popupRender = { ( ) => subMenu }
228
+ disabled = { disabled }
224
229
>
225
230
{ item }
226
231
</ Dropdown >
@@ -320,6 +325,7 @@ function createNavItemsControl() {
320
325
{
321
326
label : StringControl ,
322
327
hidden : BoolCodeControl ,
328
+ disabled : BoolCodeControl ,
323
329
active : BoolCodeControl ,
324
330
onEvent : eventHandlerControl ( [ clickEvent ] ) ,
325
331
} ,
@@ -330,7 +336,8 @@ function createNavItemsControl() {
330
336
{ children . label . propertyView ( { label : trans ( "label" ) , placeholder : "{{item}}" } ) }
331
337
{ children . active . propertyView ( { label : trans ( "navItemComp.active" ) } ) }
332
338
{ children . hidden . propertyView ( { label : trans ( "hidden" ) } ) }
333
- { children . onEvent . propertyView ( { inline : true } ) }
339
+ { children . disabled . propertyView ( { label : trans ( "disabled" ) } ) }
340
+ { children . onEvent . getPropertyView ( ) }
334
341
</ >
335
342
) )
336
343
. build ( ) ;
0 commit comments