@@ -11,6 +11,7 @@ import { registerComponentMate, TTANSITION_DURING_POPUP } from '../../utils';
1111import { DFocusVisible } from '../_focus-visible' ;
1212import { DPopup , useNestedPopup } from '../_popup' ;
1313import { DTransition } from '../_transition' ;
14+ import { DSeparator } from '../separator' ;
1415import { DGroup } from './Group' ;
1516import { DItem } from './Item' ;
1617import { DSub } from './Sub' ;
@@ -26,6 +27,7 @@ export interface DDropdownItem<ID extends DId> {
2627 type : 'item' | 'group' | 'sub' ;
2728 icon ?: React . ReactNode ;
2829 disabled ?: boolean ;
30+ separator ?: boolean ;
2931}
3032
3133export interface DDropdownProps < ID extends DId , T extends DDropdownItem < ID > & { children ?: T [ ] } >
@@ -188,7 +190,15 @@ function Dropdown<ID extends DId, T extends DDropdownItem<ID> & { children?: T[]
188190 const nodes = ( ( ) => {
189191 const getNodes = ( arr : T [ ] , level : number , subParents : T [ ] ) : JSX . Element [ ] =>
190192 arr . map ( ( item ) => {
191- const { id : itemId , label : itemLabel , type : itemType , icon : itemIcon , disabled : itemDisabled , children } = item ;
193+ const {
194+ id : itemId ,
195+ label : itemLabel ,
196+ type : itemType ,
197+ icon : itemIcon ,
198+ disabled : itemDisabled ,
199+ separator : itemSeparator ,
200+ children,
201+ } = item ;
192202
193203 const newSubParents = itemType === 'sub' ? subParents . concat ( [ item ] ) : subParents ;
194204 const id = getItemId ( itemId ) ;
@@ -347,6 +357,7 @@ function Dropdown<ID extends DId, T extends DDropdownItem<ID> & { children?: T[]
347357 { itemLabel }
348358 </ DSub >
349359 ) }
360+ { itemSeparator && < DSeparator style = { { margin : '2px 0' } } /> }
350361 </ React . Fragment >
351362 ) ;
352363 } ) ;
0 commit comments