@@ -29,6 +29,9 @@ import {
2929NavLayoutItemStyle ,
3030NavLayoutItemHoverStyle ,
3131NavLayoutItemActiveStyle ,
32+ NavSubMenuItemStyle ,
33+ NavSubMenuItemHoverStyle ,
34+ NavSubMenuItemActiveStyle ,
3235} from "comps/controls/styleControlConstants" ;
3336import { hiddenPropertyView , showDataLoadingIndicatorsPropertyView } from "comps/utils/propertyUtils" ;
3437import { trans } from "i18n" ;
@@ -152,9 +155,61 @@ const ItemList = styled.div<{ $align: string, $orientation?: string }>`
152155 justify-content:${ ( props ) => props . $align } ;
153156` ;
154157
155- const StyledMenu = styled ( Menu ) < MenuProps > `
156- &.ant-dropdown-menu {
157- min-width: 160px;
158+ const StyledMenu = styled ( Menu ) <
159+ MenuProps & {
160+ $color :string ;
161+ $hoverColor :string ;
162+ $activeColor :string ;
163+ $bg ?:string ;
164+ $hoverBg ?:string ;
165+ $activeBg ?:string ;
166+ $border ?:string ;
167+ $hoverBorder ?:string ;
168+ $activeBorder ?:string ;
169+ $radius ?:string ;
170+ $fontFamily ?:string ;
171+ $fontStyle ?:string ;
172+ $textWeight ?:string ;
173+ $textSize ?:string ;
174+ $padding ?:string ;
175+ $margin ?:string ;
176+ $textTransform ?:string ;
177+ $textDecoration ?:string ;
178+ }
179+ > `
180+ /* Base submenu item styles */
181+ .ant-dropdown-menu-item{
182+ color:${ ( p ) => p . $color } ;
183+ background-color:${ ( p ) => p . $bg || "transparent" } ;
184+ border-radius:${ ( p ) => p . $radius || "0px" } ;
185+ font-weight:${ ( p ) => p . $textWeight || 500 } ;
186+ font-family:${ ( p ) => p . $fontFamily || "sans-serif" } ;
187+ font-style:${ ( p ) => p . $fontStyle || "normal" } ;
188+ font-size:${ ( p ) => p . $textSize || "14px" } ;
189+ text-transform:${ ( p ) => p . $textTransform || "none" } ;
190+ text-decoration:${ ( p ) => p . $textDecoration || "none" } ;
191+ padding:${ ( p ) => p . $padding || "0 16px" } ;
192+ margin:${ ( p ) => p . $margin || "0px" } ;
193+ line-height: 30px;
194+ }
195+ /* Hover state */
196+ .ant-dropdown-menu-item:hover{
197+ color:${ ( p ) => p . $hoverColor || p . $activeColor } ;
198+ background-color:${ ( p ) => p . $hoverBg || "transparent" } ;
199+ cursor: pointer;
200+ }
201+ /* Selected/active state */
202+ .ant-dropdown-menu-item-selected,
203+ .ant-menu-item-selected {
204+ color:${ ( p ) => p . $activeColor } ;
205+ background-color:${ ( p ) => p . $activeBg || p . $bg || "transparent" } ;
206+ border:${ ( p ) => ( p . $activeBorder ?`1px solid${ p . $activeBorder } ` :"1px solid transparent" ) } ;
207+ }
208+ /* Disabled state */
209+ .ant-dropdown-menu-item-disabled,
210+ .ant-menu-item-disabled {
211+ opacity: 0.5;
212+ cursor: not-allowed;
158213 }
159214` ;
160215
@@ -333,7 +388,13 @@ function renderAdvancedSection(children: any) {
333388) ;
334389}
335390
336- function renderStyleSections ( children :any , styleSegment :MenuItemStyleOptionValue , setStyleSegment :( k :MenuItemStyleOptionValue ) => void ) {
391+ function renderStyleSections (
392+ children :any ,
393+ styleSegment :MenuItemStyleOptionValue ,
394+ setStyleSegment :( k :MenuItemStyleOptionValue ) => void ,
395+ subStyleSegment :MenuItemStyleOptionValue ,
396+ setSubStyleSegment :( k :MenuItemStyleOptionValue ) => void
397+ ) {
337398const isHamburger = children . displayMode . getView ( ) === 'hamburger' ;
338399return (
339400< >
@@ -355,6 +416,19 @@ function renderStyleSections(children: any, styleSegment: MenuItemStyleOptionVal
355416{ styleSegment === "hover" && children . navItemHoverStyle . getPropertyView ( ) }
356417{ styleSegment === "active" && children . navItemActiveStyle . getPropertyView ( ) }
357418</ Section >
419+ < Section name = { "Submenu Item Style" } >
420+ { controlItem ( { } , (
421+ < Segmented
422+ block
423+ options = { menuItemStyleOptions as any }
424+ value = { subStyleSegment }
425+ onChange = { ( k ) => setSubStyleSegment ( k as MenuItemStyleOptionValue ) }
426+ />
427+ ) ) }
428+ { subStyleSegment === "normal" && children . subNavItemStyle . getPropertyView ( ) }
429+ { subStyleSegment === "hover" && children . subNavItemHoverStyle . getPropertyView ( ) }
430+ { subStyleSegment === "active" && children . subNavItemActiveStyle . getPropertyView ( ) }
431+ </ Section >
358432{ isHamburger && (
359433< >
360434< Section name = { "Hamburger Button Style" } >
@@ -402,6 +476,9 @@ const childrenMap = {
402476hamburgerButtonStyle :styleControl ( HamburgerButtonStyle , 'hamburgerButtonStyle' ) ,
403477drawerContainerStyle :styleControl ( DrawerContainerStyle , 'drawerContainerStyle' ) ,
404478animationStyle :styleControl ( AnimationStyle , 'animationStyle' ) ,
479+ subNavItemStyle :styleControl ( NavSubMenuItemStyle , 'subNavItemStyle' ) ,
480+ subNavItemHoverStyle :styleControl ( NavSubMenuItemHoverStyle , 'subNavItemHoverStyle' ) ,
481+ subNavItemActiveStyle :styleControl ( NavSubMenuItemActiveStyle , 'subNavItemActiveStyle' ) ,
405482items :withDefault ( migrateOldData ( createNavItemsControl ( ) , fixOldItemsData ) , {
406483optionType :"manual" ,
407484manual :[
@@ -502,13 +579,32 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
502579 ...item ,
503580icon :item . icon || undefined ,
504581} ) ) }
582+ $color = { ( props . subNavItemStyle && props . subNavItemStyle . text ) || props . style . text }
583+ $hoverColor = { ( props . subNavItemHoverStyle && props . subNavItemHoverStyle . text ) || props . style . accent }
584+ $activeColor = { ( props . subNavItemActiveStyle && props . subNavItemActiveStyle . text ) || props . style . accent }
585+ $bg = { ( props . subNavItemStyle && props . subNavItemStyle . background ) || undefined }
586+ $hoverBg = { ( props . subNavItemHoverStyle && props . subNavItemHoverStyle . background ) || undefined }
587+ $activeBg = { ( props . subNavItemActiveStyle && props . subNavItemActiveStyle . background ) || undefined }
588+ $border = { ( props . subNavItemStyle && props . subNavItemStyle . border ) || undefined }
589+ $hoverBorder = { ( props . subNavItemHoverStyle && props . subNavItemHoverStyle . border ) || undefined }
590+ $activeBorder = { ( props . subNavItemActiveStyle && props . subNavItemActiveStyle . border ) || undefined }
591+ $radius = { ( props . subNavItemStyle && props . subNavItemStyle . radius ) || undefined }
592+ $fontFamily = { props . style . fontFamily }
593+ $fontStyle = { props . style . fontStyle }
594+ $textWeight = { props . style . textWeight }
595+ $textSize = { props . style . textSize }
596+ $padding = { ( props . subNavItemStyle && props . subNavItemStyle . padding ) || props . style . padding }
597+ $margin = { ( props . subNavItemStyle && props . subNavItemStyle . margin ) || props . style . margin }
598+ $textTransform = { props . style . textTransform }
599+ $textDecoration = { props . style . textDecoration }
505600/>
506601) ;
507602return (
508603< Dropdown
509604key = { idx }
510605popupRender = { ( ) => subMenu }
511606disabled = { disabled }
607+ trigger = { [ "click" ] }
512608>
513609{ item }
514610</ Dropdown >
@@ -603,14 +699,15 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
603699const showLogic = mode === "logic" || mode === "both" ;
604700const showLayout = mode === "layout" || mode === "both" ;
605701const [ styleSegment , setStyleSegment ] = useState < MenuItemStyleOptionValue > ( "normal" ) ;
702+ const [ subStyleSegment , setSubStyleSegment ] = useState < MenuItemStyleOptionValue > ( "normal" ) ;
606703
607704return (
608705< >
609706{ renderBasicSection ( children ) }
610707{ showLogic && renderInteractionSection ( children ) }
611708{ showLayout && renderLayoutSection ( children ) }
612709{ showLogic && renderAdvancedSection ( children ) }
613- { showLayout && renderStyleSections ( children , styleSegment , setStyleSegment ) }
710+ { showLayout && renderStyleSections ( children , styleSegment , setStyleSegment , subStyleSegment , setSubStyleSegment ) }
614711</ >
615712) ;
616713} )