@@ -67,11 +67,12 @@ const Item = styled.div<{
6767 $padding : string ;
6868 $textTransform :string ;
6969 $textDecoration :string ;
70+ $disabled ?: boolean ;
7071} > `
7172 height: 30px;
7273 line-height: 30px;
7374 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 ) } ;
7576 font-weight: ${ ( props ) => ( props . $textWeight ? props . $textWeight : 500 ) } ;
7677 font-family:${ ( props ) => ( props . $fontFamily ? props . $fontFamily : 'sans-serif' ) } ;
7778 font-style:${ ( props ) => ( props . $fontStyle ? props . $fontStyle : 'normal' ) } ;
@@ -81,8 +82,8 @@ const Item = styled.div<{
8182 margin:${ ( props ) => props . $margin ? props . $margin : '0px' } ;
8283
8384 &: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' } ;
8687 }
8788
8889 .anticon {
@@ -166,6 +167,7 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
166167 const label = view ?. label ;
167168 const active = ! ! view ?. active ;
168169 const onEvent = view ?. onEvent ;
170+ const disabled = ! ! view ?. disabled ;
169171 const subItems = isCompItem ? view ?. items : [ ] ;
170172
171173 const subMenuItems : Array < { key : string ; label : string } > = [ ] ;
@@ -199,7 +201,8 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
199201 $textTransform = { props . style . textTransform }
200202 $textDecoration = { props . style . textDecoration }
201203 $margin = { props . style . margin }
202- onClick = { ( ) => onEvent && onEvent ( "click" ) }
204+ $disabled = { disabled }
205+ onClick = { ( ) => { if ( ! disabled && onEvent ) onEvent ( "click" ) ; } }
203206 >
204207 { label }
205208 { Array . isArray ( subItems ) && subItems . length > 0 && < DownOutlined /> }
@@ -209,6 +212,7 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
209212 const subMenu = (
210213 < StyledMenu
211214 onClick = { ( e ) => {
215+ if ( disabled ) return ;
212216 const subItem = subItems [ Number ( e . key ) ] ;
213217 const onSubEvent = subItem ?. getView ( ) ?. onEvent ;
214218 onSubEvent && onSubEvent ( "click" ) ;
@@ -221,6 +225,7 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
221225 < Dropdown
222226 key = { idx }
223227 popupRender = { ( ) => subMenu }
228+ disabled = { disabled }
224229 >
225230 { item }
226231 </ Dropdown >
@@ -320,6 +325,7 @@ function createNavItemsControl() {
320325 {
321326 label : StringControl ,
322327 hidden : BoolCodeControl ,
328+ disabled : BoolCodeControl ,
323329 active : BoolCodeControl ,
324330 onEvent : eventHandlerControl ( [ clickEvent ] ) ,
325331 } ,
@@ -330,7 +336,8 @@ function createNavItemsControl() {
330336 { children . label . propertyView ( { label : trans ( "label" ) , placeholder : "{{item}}" } ) }
331337 { children . active . propertyView ( { label : trans ( "navItemComp.active" ) } ) }
332338 { children . hidden . propertyView ( { label : trans ( "hidden" ) } ) }
333- { children . onEvent . propertyView ( { inline : true } ) }
339+ { children . disabled . propertyView ( { label : trans ( "disabled" ) } ) }
340+ { children . onEvent . getPropertyView ( ) }
334341 </ >
335342 ) )
336343 . build ( ) ;
0 commit comments