@@ -13,10 +13,12 @@ import { default as DownOutlined } from "@ant-design/icons/DownOutlined";
1313import { default as MenuOutlined } from "@ant-design/icons/MenuOutlined" ;
1414import { default as Dropdown } from "antd/es/dropdown" ;
1515import { default as Menu , MenuProps } from "antd/es/menu" ;
16+ import Segmented from "antd/es/segmented" ;
1617import { default as Drawer } from "antd/es/drawer" ;
1718import { migrateOldData } from "comps/generators/simpleGenerators" ;
1819import { styleControl } from "comps/controls/styleControl" ;
1920import { IconControl } from "comps/controls/iconControl" ;
21+ import { controlItem } from "components/control" ;
2022import {
2123AnimationStyle ,
2224AnimationStyleType ,
@@ -68,6 +70,13 @@ function transToPxSize(size: string | number) {
6870return isNumeric ( size ) ?size + "px" :( size as string ) ;
6971}
7072
73+ type MenuItemStyleOptionValue = "normal" | "hover" | "active" ;
74+ const menuItemStyleOptions = [
75+ { label :"Normal" , value :"normal" } ,
76+ { label :"Hover" , value :"hover" } ,
77+ { label :"Active" , value :"active" } ,
78+ ] as const ;
79+
7180const NavInner = styled ( "div" ) < Pick < IProps , "$justify" | "$orientation" > > `
7281 // margin: 0 -16px;
7382 height: 100%;
@@ -285,26 +294,28 @@ function renderAdvancedSection(children: any) {
285294) ;
286295}
287296
288- function renderStyleSections ( children :any ) {
297+ function renderStyleSections ( children :any , styleSegment : MenuItemStyleOptionValue , setStyleSegment : ( k : MenuItemStyleOptionValue ) => void ) {
289298const isHamburger = children . displayMode . getView ( ) === 'hamburger' ;
290299return (
291300< >
292301{ ! isHamburger && (
293- < >
294- < Section name = { sectionNames . style } >
295- { children . style . getPropertyView ( ) }
296- </ Section >
297- < Section name = { "Item Style" } >
298- { children . navItemStyle . getPropertyView ( ) }
299- </ Section >
300- < Section name = { "Item Hover Style" } >
301- { children . navItemHoverStyle . getPropertyView ( ) }
302- </ Section >
303- < Section name = { "Item Active Style" } >
304- { children . navItemActiveStyle . getPropertyView ( ) }
305- </ Section >
306- </ >
302+ < Section name = { sectionNames . style } >
303+ { children . style . getPropertyView ( ) }
304+ </ Section >
307305) }
306+ < Section name = { isHamburger ?"Drawer Item Style" :trans ( "navLayout.navItemStyle" ) } >
307+ { controlItem ( { } , (
308+ < Segmented
309+ block
310+ options = { menuItemStyleOptions as any }
311+ value = { styleSegment }
312+ onChange = { ( k ) => setStyleSegment ( k as MenuItemStyleOptionValue ) }
313+ />
314+ ) ) }
315+ { styleSegment === "normal" && children . navItemStyle . getPropertyView ( ) }
316+ { styleSegment === "hover" && children . navItemHoverStyle . getPropertyView ( ) }
317+ { styleSegment === "active" && children . navItemActiveStyle . getPropertyView ( ) }
318+ </ Section >
308319{ isHamburger && (
309320< >
310321< Section name = { "Hamburger Button Style" } >
@@ -526,14 +537,15 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
526537const mode = useContext ( EditorContext ) . editorModeStatus ;
527538const showLogic = mode === "logic" || mode === "both" ;
528539const showLayout = mode === "layout" || mode === "both" ;
540+ const [ styleSegment , setStyleSegment ] = useState < MenuItemStyleOptionValue > ( "normal" ) ;
529541
530542return (
531543< >
532544{ renderBasicSection ( children ) }
533545{ showLogic && renderInteractionSection ( children ) }
534546{ showLayout && renderLayoutSection ( children ) }
535547{ showLogic && renderAdvancedSection ( children ) }
536- { showLayout && renderStyleSections ( children ) }
548+ { showLayout && renderStyleSections ( children , styleSegment , setStyleSegment ) }
537549</ >
538550) ;
539551} )