Skip to content

Commit

Permalink
Fix primefaces#4348: Dropdown optionGroupChildren fix
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed May 8, 2023
1 parent 57bfaa5 commit 27ba573
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions components/lib/dropdown/Dropdown.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as React from 'react';
import PrimeReact, { FilterService } from '../api/Api';
import { useMountEffect, useOverlayListener, useUnmountEffect, useUpdateEffect } from '../hooks/Hooks';
import { ChevronDownIcon } from '../icons/chevrondown';
import { TimesIcon } from '../icons/times';
import { OverlayService } from '../overlayservice/OverlayService';
import { Tooltip } from '../tooltip/Tooltip';
import { classNames, DomHandler, IconUtils, ObjectUtils, ZIndexUtils } from '../utils/Utils';
import { DomHandler, IconUtils, ObjectUtils, ZIndexUtils, classNames } from '../utils/Utils';
import { DropdownBase } from './DropdownBase';
import { DropdownPanel } from './DropdownPanel';
import { ChevronDownIcon } from '../icons/chevrondown';
import { TimesIcon } from '../icons/times';

export const Dropdown = React.memo(
React.forwardRef((inProps, ref) => {
Expand Down Expand Up @@ -50,7 +50,7 @@ export const Dropdown = React.memo(
let filteredSubOptions = FilterService.filter(getOptionGroupChildren(optgroup), searchFields, filterValue, props.filterMatchMode, props.filterLocale);

if (filteredSubOptions && filteredSubOptions.length) {
filteredGroups.push({ ...optgroup, ...{ items: filteredSubOptions } });
filteredGroups.push({ ...optgroup, ...{ [`${props.optionGroupChildren}`]: filteredSubOptions } });
}
}

Expand Down
2 changes: 1 addition & 1 deletion components/lib/dropdown/DropdownBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const DropdownBase = {
onMouseDown: null,
onShow: null,
optionDisabled: null,
optionGroupChildren: null,
optionGroupChildren: 'items',
optionGroupLabel: null,
optionGroupTemplate: null,
optionLabel: null,
Expand Down
1 change: 1 addition & 0 deletions components/lib/dropdown/dropdown.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ export interface DropdownProps extends Omit<React.DetailedHTMLProps<React.InputH
optionDisabled?: string | ((option: any) => boolean) | undefined;
/**
* Property name or getter function that refers to the children options of option group.
* @defaultValue items
*/
optionGroupChildren?: string | undefined;
/**
Expand Down

0 comments on commit 27ba573

Please sign in to comment.