Skip to content

Commit

Permalink
Fix #5047: Dropdown add label to itemGroup passthrough (#5052)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Oct 6, 2023
1 parent 944766d commit bfba175
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion components/lib/dropdown/DropdownBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ const classes = {
}),
trigger: 'p-dropdown-trigger',
emptyMessage: 'p-dropdown-empty-message',
itemGroup: 'p-dropdown-item-group',
itemGroup: ({ optionGroupLabel }) =>
classNames('p-dropdown-item-group', {
'p-dropdown-item-empty': !optionGroupLabel || optionGroupLabel.length === 0
}),
dropdownIcon: 'p-dropdown-trigger-icon p-clickable',
clearIcon: 'p-dropdown-clear-icon p-clickable',
filterIcon: 'p-dropdown-filter-icon',
Expand Down
3 changes: 2 additions & 1 deletion components/lib/dropdown/DropdownPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ export const DropdownPanel = React.memo(
style = { ...style, ...option.style };

if (props.optionGroupLabel) {
const { optionGroupLabel } = props;
const groupContent = props.optionGroupTemplate ? ObjectUtils.getJSXElement(props.optionGroupTemplate, option, index) : props.getOptionGroupLabel(option);
const groupChildrenContent = createGroupChildren(option, style);
const key = index + '_' + props.getOptionGroupRenderKey(option);
const itemGroupProps = mergeProps(
{
className: cx('itemGroup'),
className: cx('itemGroup', { optionGroupLabel }),
style
},
getPTOptions('itemGroup')
Expand Down

0 comments on commit bfba175

Please sign in to comment.