1
1
import Button from 'hew/Button' ;
2
2
import Column from 'hew/Column' ;
3
- import { HandleSelectionChangeType , Sort } from 'hew/DataGrid/DataGrid' ;
3
+ import { Sort } from 'hew/DataGrid/DataGrid' ;
4
4
import Dropdown , { MenuItem } from 'hew/Dropdown' ;
5
5
import Icon , { IconName } from 'hew/Icon' ;
6
6
import { useModal } from 'hew/Modal' ;
@@ -57,7 +57,7 @@ import { capitalizeWord } from 'utils/string';
57
57
import { openCommandResponse } from 'utils/wait' ;
58
58
59
59
import { FilterFormSet } from './FilterForm/components/type' ;
60
- import LoadableCount , { SelectionAction } from './LoadableCount' ;
60
+ import LoadableCount from './LoadableCount' ;
61
61
import css from './TableActionBar.module.scss' ;
62
62
63
63
const batchActions = [
@@ -91,22 +91,22 @@ const actionIcons: Record<BatchAction, IconName> = {
91
91
interface Props {
92
92
compareViewOn ?: boolean ;
93
93
formStore : FilterFormStore ;
94
- handleSelectionChange : HandleSelectionChangeType ;
95
94
heatmapBtnVisible ?: boolean ;
96
95
heatmapOn ?: boolean ;
97
96
initialVisibleColumns : string [ ] ;
98
97
isOpenFilter : boolean ;
99
- isRangeSelected : ( range : [ number , number ] ) => boolean ;
100
98
onActionComplete ?: ( ) => Promise < void > ;
101
99
onActionSuccess ?: ( action : BatchAction , successfulIds : number [ ] ) => void ;
100
+ onActualSelectAll ?: ( ) => void ;
101
+ onClearSelect ?: ( ) => void ;
102
102
onComparisonViewToggle ?: ( ) => void ;
103
103
onHeatmapToggle ?: ( heatmapOn : boolean ) => void ;
104
104
onIsOpenFilterChange ?: ( value : boolean ) => void ;
105
105
onRowHeightChange ?: ( rowHeight : RowHeight ) => void ;
106
106
onSortChange ?: ( sorts : Sort [ ] ) => void ;
107
107
onVisibleColumnChange ?: ( newColumns : string [ ] , pinnedCount ?: number ) => void ;
108
108
onHeatmapSelectionRemove ?: ( id : string ) => void ;
109
- pageSize : number ;
109
+ pageSize ? : number ;
110
110
project : Project ;
111
111
projectColumns : Loadable < ProjectColumn [ ] > ;
112
112
rowHeight : RowHeight ;
@@ -129,14 +129,14 @@ const TableActionBar: React.FC<Props> = ({
129
129
compareViewOn,
130
130
formStore,
131
131
tableFilterString,
132
- handleSelectionChange,
133
132
heatmapBtnVisible,
134
133
heatmapOn,
135
134
initialVisibleColumns,
136
135
isOpenFilter,
137
- isRangeSelected,
138
136
onActionComplete,
139
137
onActionSuccess,
138
+ onActualSelectAll,
139
+ onClearSelect,
140
140
onComparisonViewToggle,
141
141
onHeatmapToggle,
142
142
onIsOpenFilterChange,
@@ -412,20 +412,6 @@ const TableActionBar: React.FC<Props> = ({
412
412
} , [ ] as MenuItem [ ] ) ;
413
413
} , [ availableBatchActions ] ) ;
414
414
415
- const selectionAction : SelectionAction = useMemo ( ( ) => {
416
- return total . match ( {
417
- _ : ( ) => 'NONE' as const ,
418
- Loaded : ( loadedTotal ) => {
419
- if ( isRangeSelected ( [ 0 , pageSize ] ) && selectionSize < loadedTotal ) {
420
- return 'SELECT_ALL' ;
421
- } else if ( selectionSize > pageSize ) {
422
- return 'CLEAR_SELECTION' ;
423
- }
424
- return 'NONE' ;
425
- } ,
426
- } ) ;
427
- } , [ isRangeSelected , selectionSize , pageSize , total ] ) ;
428
-
429
415
return (
430
416
< div className = { css . base } data-test-component = "tableActionBar" >
431
417
< Row >
@@ -469,12 +455,13 @@ const TableActionBar: React.FC<Props> = ({
469
455
</ Dropdown >
470
456
) }
471
457
< LoadableCount
472
- handleSelectionChange = { handleSelectionChange }
473
458
labelPlural = { labelPlural }
474
459
labelSingular = { labelSingular }
460
+ pageSize = { pageSize }
475
461
selectedCount = { selectionSize }
476
- selectionAction = { selectionAction }
477
462
total = { total }
463
+ onActualSelectAll = { onActualSelectAll }
464
+ onClearSelect = { onClearSelect }
478
465
/>
479
466
</ Row >
480
467
</ Column >
0 commit comments