Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: could not save selection from upload has many drawer #9325

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions packages/ui/src/views/List/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { Pagination } from '../../elements/Pagination/index.js'
import { PerPage } from '../../elements/PerPage/index.js'
import { PublishMany } from '../../elements/PublishMany/index.js'
import { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'
import { SelectMany } from '../../elements/SelectMany/index.js'
import { useStepNav } from '../../elements/StepNav/index.js'
import { RelationshipProvider } from '../../elements/Table/RelationshipProvider/index.js'
import { TableColumnsProvider } from '../../elements/TableColumns/index.js'
Expand All @@ -36,8 +37,8 @@ import { useListQuery } from '../../providers/ListQuery/index.js'
import { SelectionProvider } from '../../providers/Selection/index.js'
import { useTranslation } from '../../providers/Translation/index.js'
import { useWindowInfo } from '../../providers/WindowInfo/index.js'
import './index.scss'
import { ListHeader } from './ListHeader/index.js'
import './index.scss'

const baseClass = 'collection-list'
const Link = (LinkImport.default || LinkImport) as unknown as typeof LinkImport.default
Expand Down Expand Up @@ -88,7 +89,7 @@ export const DefaultListView: React.FC<ListViewClientProps> = (props) => {

const [Table, setTable] = useState(InitialTable)

const { createNewDrawerSlug, drawerSlug: listDrawerSlug } = useListDrawerContext()
const { createNewDrawerSlug, drawerSlug: listDrawerSlug, onBulkSelect } = useListDrawerContext()

useEffect(() => {
if (InitialTable) {
Expand Down Expand Up @@ -197,7 +198,13 @@ export const DefaultListView: React.FC<ListViewClientProps> = (props) => {
t={t}
/>
<ListControls
beforeActions={beforeActions}
beforeActions={
enableRowSelections && typeof onBulkSelect === 'function'
? beforeActions
? [...beforeActions, <SelectMany key="select-many" onClick={onBulkSelect} />]
: [<SelectMany key="select-many" onClick={onBulkSelect} />]
: beforeActions
}
collectionConfig={collectionConfig}
collectionSlug={collectionSlug}
disableBulkDelete={disableBulkDelete}
Expand Down Expand Up @@ -265,7 +272,14 @@ export const DefaultListView: React.FC<ListViewClientProps> = (props) => {
label={getTranslation(collectionConfig.labels.plural, i18n)}
/>
<div className={`${baseClass}__list-selection-actions`}>
{beforeActions && beforeActions}
{enableRowSelections && typeof onBulkSelect === 'function'
? beforeActions
? [
...beforeActions,
<SelectMany key="select-many" onClick={onBulkSelect} />,
]
: [<SelectMany key="select-many" onClick={onBulkSelect} />]
: beforeActions}
{!disableBulkEdit && (
<Fragment>
<EditMany collection={collectionConfig} />
Expand Down
Loading