11import { Event , StyleClassHelper } from '@ui5/webcomponents-react-base' ;
2- import React , { forwardRef , ReactNode , RefObject , useMemo , FC } from 'react' ;
2+ import React , { FC , forwardRef , ReactNode , RefObject , useMemo } from 'react' ;
33import { CommonProps } from '../../interfaces/CommonProps' ;
44import { BusyIndicator } from '../../lib/BusyIndicator' ;
55import { FilterType } from '../../lib/FilterType' ;
66import { Input } from '../../lib/Input' ;
77import { Label } from '../../lib/Label' ;
88import { createUseStyles } from 'react-jss' ;
99import { Select } from '../../lib/Select' ;
10+ import { MultiComboBox } from '../../lib/MultiComboBox' ;
11+ import { StandardListItem } from '../../lib/StandardListItem' ;
1012import { Option } from '../../lib/Option' ;
1113import styles from './FilterItem.jss' ;
1214import { BusyIndicatorType } from '../../lib/BusyIndicatorType' ;
@@ -52,6 +54,17 @@ const FilterItem: FC<FilterItemPropTypes> = forwardRef((props: FilterItemPropTyp
5254 onChange ( Event . of ( null , e . getOriginalEvent ( ) , { selectedItem : item } ) ) ;
5355 }
5456
57+ function onMultiCbChange ( e ) {
58+ const selectedItems = e . getParameter ( 'items' ) ;
59+ onChange (
60+ Event . of ( null , e . getOriginalEvent ( ) , {
61+ selectedItems : selectedItems . map ( ( item ) => {
62+ return getItemByKey ( item . getAttribute ( 'data-key' ) ) ;
63+ } )
64+ } )
65+ ) ;
66+ }
67+
5568 const filterComponent = useMemo ( ( ) => {
5669 if ( loading ) {
5770 return (
@@ -68,6 +81,16 @@ const FilterItem: FC<FilterItemPropTypes> = forwardRef((props: FilterItemPropTyp
6881 switch ( type ) {
6982 case FilterType . Default :
7083 return < Input placeholder = { placeholder } onChange = { onSelect } style = { { width : '100%' } } /> ;
84+ case FilterType . MultiSelect :
85+ return (
86+ < MultiComboBox onSelectionChange = { onMultiCbChange } >
87+ { filterItems . map ( ( item ) => (
88+ < StandardListItem data-key = { item . key } key = { item . key } >
89+ { item . text }
90+ </ StandardListItem >
91+ ) ) }
92+ </ MultiComboBox >
93+ ) ;
7194 case FilterType . Select :
7295 return (
7396 < Select onChange = { onSelect } style = { { width : '100%' } } >
0 commit comments