@@ -107,7 +107,6 @@ const Item = styled.div<{
107107 $radius ?: string ;
108108 $disabled ?: boolean ;
109109} > `
110- height: 30px;
111110 line-height: 30px;
112111 padding: ${ ( props ) => props . $padding ? props . $padding : '0 16px' } ;
113112 color: ${ ( props ) => props . $disabled ? `${ props . $color } 80` : ( props . $active ? props . $activeColor : props . $color ) } ;
@@ -303,7 +302,7 @@ function renderStyleSections(children: any, styleSegment: MenuItemStyleOptionVal
303302 { children . style . getPropertyView ( ) }
304303 </ Section >
305304 ) }
306- < Section name = { isHamburger ? "Drawer Item Style" : trans ( "navLayout.navItemStyle" ) } >
305+ < Section name = { trans ( "navLayout.navItemStyle" ) } >
307306 { controlItem ( { } , (
308307 < Segmented
309308 block
@@ -391,12 +390,13 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
391390 }
392391
393392 const label = view ?. label ;
393+ const icon = hasIcon ( view ?. icon ) ? view . icon : undefined ;
394394 const active = ! ! view ?. active ;
395395 const onEvent = view ?. onEvent ;
396396 const disabled = ! ! view ?. disabled ;
397397 const subItems = isCompItem ? view ?. items : [ ] ;
398398
399- const subMenuItems : Array < { key : string ; label : any ; disabled ?: boolean } > = [ ] ;
399+ const subMenuItems : Array < { key : string ; label : any ; icon ?: any ; disabled ?: boolean } > = [ ] ;
400400 const subMenuSelectedKeys : Array < string > = [ ] ;
401401
402402 if ( Array . isArray ( subItems ) ) {
@@ -406,9 +406,11 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
406406 }
407407 const key = originalIndex + "" ;
408408 subItem . children . active . getView ( ) && subMenuSelectedKeys . push ( key ) ;
409+ const subIcon = hasIcon ( subItem . children . icon ?. getView ?.( ) ) ? subItem . children . icon . getView ( ) : undefined ;
409410 subMenuItems . push ( {
410411 key : key ,
411412 label : subItem . children . label . getView ( ) ,
413+ icon : subIcon ,
412414 disabled : ! ! subItem . children . disabled . getView ( ) ,
413415 } ) ;
414416 } ) ;
@@ -439,6 +441,7 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
439441 $disabled = { disabled }
440442 onClick = { ( ) => { if ( ! disabled && onEvent ) onEvent ( "click" ) ; } }
441443 >
444+ { icon && < span style = { { display : 'inline-flex' , marginRight : '8px' } } > { icon } </ span > }
442445 { label }
443446 { Array . isArray ( subItems ) && subItems . length > 0 && < DownOutlined /> }
444447 </ Item >
@@ -455,7 +458,10 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
455458 onSubEvent && onSubEvent ( "click" ) ;
456459 } }
457460 selectedKeys = { subMenuSelectedKeys }
458- items = { subMenuItems }
461+ items = { subMenuItems . map ( item => ( {
462+ ...item ,
463+ icon : item . icon || undefined ,
464+ } ) ) }
459465 />
460466 ) ;
461467 return (
0 commit comments