@@ -24,6 +24,7 @@ import { Pagination } from '../../elements/Pagination/index.js'
24
24
import { PerPage } from '../../elements/PerPage/index.js'
25
25
import { PublishMany } from '../../elements/PublishMany/index.js'
26
26
import { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'
27
+ import { SelectMany } from '../../elements/SelectMany/index.js'
27
28
import { useStepNav } from '../../elements/StepNav/index.js'
28
29
import { RelationshipProvider } from '../../elements/Table/RelationshipProvider/index.js'
29
30
import { TableColumnsProvider } from '../../elements/TableColumns/index.js'
@@ -36,8 +37,8 @@ import { useListQuery } from '../../providers/ListQuery/index.js'
36
37
import { SelectionProvider } from '../../providers/Selection/index.js'
37
38
import { useTranslation } from '../../providers/Translation/index.js'
38
39
import { useWindowInfo } from '../../providers/WindowInfo/index.js'
39
- import './index.scss'
40
40
import { ListHeader } from './ListHeader/index.js'
41
+ import './index.scss'
41
42
42
43
const baseClass = 'collection-list'
43
44
const Link = ( LinkImport . default || LinkImport ) as unknown as typeof LinkImport . default
@@ -88,7 +89,7 @@ export const DefaultListView: React.FC<ListViewClientProps> = (props) => {
88
89
89
90
const [ Table , setTable ] = useState ( InitialTable )
90
91
91
- const { createNewDrawerSlug, drawerSlug : listDrawerSlug } = useListDrawerContext ( )
92
+ const { createNewDrawerSlug, drawerSlug : listDrawerSlug , onBulkSelect } = useListDrawerContext ( )
92
93
93
94
useEffect ( ( ) => {
94
95
if ( InitialTable ) {
@@ -197,7 +198,13 @@ export const DefaultListView: React.FC<ListViewClientProps> = (props) => {
197
198
t = { t }
198
199
/>
199
200
< ListControls
200
- beforeActions = { beforeActions }
201
+ beforeActions = {
202
+ enableRowSelections && typeof onBulkSelect === 'function'
203
+ ? beforeActions
204
+ ? [ ...beforeActions , < SelectMany key = "select-many" onClick = { onBulkSelect } /> ]
205
+ : [ < SelectMany key = "select-many" onClick = { onBulkSelect } /> ]
206
+ : beforeActions
207
+ }
201
208
collectionConfig = { collectionConfig }
202
209
collectionSlug = { collectionSlug }
203
210
disableBulkDelete = { disableBulkDelete }
@@ -265,7 +272,14 @@ export const DefaultListView: React.FC<ListViewClientProps> = (props) => {
265
272
label = { getTranslation ( collectionConfig . labels . plural , i18n ) }
266
273
/>
267
274
< div className = { `${ baseClass } __list-selection-actions` } >
268
- { beforeActions && beforeActions }
275
+ { enableRowSelections && typeof onBulkSelect === 'function'
276
+ ? beforeActions
277
+ ? [
278
+ ...beforeActions ,
279
+ < SelectMany key = "select-many" onClick = { onBulkSelect } /> ,
280
+ ]
281
+ : [ < SelectMany key = "select-many" onClick = { onBulkSelect } /> ]
282
+ : beforeActions }
269
283
{ ! disableBulkEdit && (
270
284
< Fragment >
271
285
< EditMany collection = { collectionConfig } />
0 commit comments