diff --git a/components/lib/dropdown/Dropdown.js b/components/lib/dropdown/Dropdown.js index 76da3ef9e7..cac69f4cec 100644 --- a/components/lib/dropdown/Dropdown.js +++ b/components/lib/dropdown/Dropdown.js @@ -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) => { @@ -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 } }); } } diff --git a/components/lib/dropdown/DropdownBase.js b/components/lib/dropdown/DropdownBase.js index 465b200da8..317c95b455 100644 --- a/components/lib/dropdown/DropdownBase.js +++ b/components/lib/dropdown/DropdownBase.js @@ -40,7 +40,7 @@ export const DropdownBase = { onMouseDown: null, onShow: null, optionDisabled: null, - optionGroupChildren: null, + optionGroupChildren: 'items', optionGroupLabel: null, optionGroupTemplate: null, optionLabel: null, diff --git a/components/lib/dropdown/dropdown.d.ts b/components/lib/dropdown/dropdown.d.ts index 7de0969b6f..85b2a0fbcb 100644 --- a/components/lib/dropdown/dropdown.d.ts +++ b/components/lib/dropdown/dropdown.d.ts @@ -190,6 +190,7 @@ export interface DropdownProps extends Omit boolean) | undefined; /** * Property name or getter function that refers to the children options of option group. + * @defaultValue items */ optionGroupChildren?: string | undefined; /**