1
1
import BarDesign from '@ui5/webcomponents/dist/types/BarDesign.js' ;
2
2
import ButtonDesign from '@ui5/webcomponents/dist/types/ButtonDesign.js' ;
3
- import TableSelectionMode from '@ui5/webcomponents/dist/types/TableSelectionMode.js' ;
4
3
import TitleLevel from '@ui5/webcomponents/dist/types/TitleLevel.js' ;
5
4
import group2Icon from '@ui5/webcomponents-icons/dist/group-2.js' ;
6
5
import listIcon from '@ui5/webcomponents-icons/dist/list.js' ;
@@ -37,7 +36,8 @@ import type {
37
36
DialogDomRef ,
38
37
InputPropTypes ,
39
38
SegmentedButtonPropTypes ,
40
- TableSelectionDomRef
39
+ TableSelectionMultiDomRef ,
40
+ TableSelectionMultiPropTypes
41
41
} from '../../webComponents/index.js' ;
42
42
import {
43
43
Bar ,
@@ -53,7 +53,7 @@ import {
53
53
Table ,
54
54
TableHeaderCell ,
55
55
TableHeaderRow ,
56
- TableSelection ,
56
+ TableSelectionMulti ,
57
57
Title
58
58
} from '../../webComponents/index.js' ;
59
59
import type { FilterGroupItemInternalProps } from '../FilterGroupItem/types.js' ;
@@ -64,7 +64,7 @@ import type { FilterBarPropTypes } from './types.js';
64
64
65
65
interface ForceRequiredObject {
66
66
required : string [ ] ;
67
- target : TableSelectionDomRef ;
67
+ target : TableSelectionMultiDomRef ;
68
68
selected : Set < string > ;
69
69
prevSelected : Set < string > ;
70
70
selectedKeys : Set < string > ;
@@ -234,9 +234,10 @@ export const FilterDialog = (props: FilterDialogPropTypes) => {
234
234
)
235
235
: orderedChildren ;
236
236
237
- return filteredChildren . map ( ( child , index ) => {
237
+ return filteredChildren . map ( ( child , index , arr ) => {
238
238
return cloneElement < FilterGroupItemInternalProps > ( child , {
239
- 'data-index' : index
239
+ 'data-index' : index ,
240
+ 'data-filters-count' : arr . length
240
241
} ) ;
241
242
} ) ;
242
243
} ;
@@ -378,9 +379,10 @@ export const FilterDialog = (props: FilterDialogPropTypes) => {
378
379
}
379
380
} , [ selectedFilters ] ) ;
380
381
381
- const handleCheckBoxChange = ( e ) => {
382
- if ( e . target . hasAttribute ( 'ui5-table-selection' ) ) {
383
- const _selected : Set < string > = new Set ( e . target . selected . length ? e . target . selected . split ( ' ' ) : [ ] ) ;
382
+ const handleCheckBoxChange : TableSelectionMultiPropTypes [ 'onChange' ] = ( e ) => {
383
+ const selectionFeature = e . target ;
384
+ if ( selectionFeature . hasAttribute ( 'ui5-table-selection-multi' ) ) {
385
+ const _selected : Set < string > = selectionFeature . getSelectedAsSet ( ) ;
384
386
const prevSelected : Set < string > = new Set ( selectedFilters ?? [ ] ) ;
385
387
const alwaysSelected = Object . keys ( requiredFilters ) . filter ( ( key ) => requiredFilters [ key ] ) ;
386
388
const selectedKeys : Set < string > = _selected . symmetricDifference ( prevSelected ) ;
@@ -389,7 +391,7 @@ export const FilterDialog = (props: FilterDialogPropTypes) => {
389
391
if ( alwaysSelected . length ) {
390
392
setForceRequired ( {
391
393
required : alwaysSelected ,
392
- target : e . target ,
394
+ target : selectionFeature ,
393
395
selected : _selected ,
394
396
prevSelected,
395
397
selectedKeys
@@ -443,13 +445,7 @@ export const FilterDialog = (props: FilterDialogPropTypes) => {
443
445
className = { classNames . tableInGroup }
444
446
data-component-name = "FilterBarDialogPanelTable"
445
447
data-with-value = { showValues }
446
- features = {
447
- < TableSelection
448
- mode = { TableSelectionMode . Multiple }
449
- selected = { selected }
450
- onChange = { handleCheckBoxChange }
451
- />
452
- }
448
+ features = { < TableSelectionMulti selected = { selected } onChange = { handleCheckBoxChange } /> }
453
449
headerRow = {
454
450
< TableHeaderRow className = { classNames . groupedTableHeader } >
455
451
< TableHeaderCell > { filterText } </ TableHeaderCell >
@@ -617,7 +613,7 @@ export const FilterDialog = (props: FilterDialogPropTypes) => {
617
613
tabIndex = { ! isListView ? - 1 : undefined }
618
614
features = {
619
615
< >
620
- < TableSelection mode = { TableSelectionMode . Multiple } onChange = { handleCheckBoxChange } selected = { selected } />
616
+ < TableSelectionMulti onChange = { handleCheckBoxChange } selected = { selected } />
621
617
</ >
622
618
}
623
619
headerRow = {
0 commit comments