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

[RFR] Remove BulkActions in V3 #3517

Merged
merged 6 commits into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ Components deprecated in 2.X have been removed in 3.x. This includes:
* `ViewTitle` (use `Title` instead)
* `RecordTitle` (use `TitleForRecord` instead)
* `TitleDeprecated` (use `Title` instead)
* `BulkActions` (use the [`bulkActionButtons` prop](https://marmelab.com/react-admin/List.html#bulk-action-buttons) instead)

## Replace papaparse with a lighter library

Expand Down
202 changes: 0 additions & 202 deletions packages/ra-ui-materialui/src/list/BulkActions.js

This file was deleted.

22 changes: 6 additions & 16 deletions packages/ra-ui-materialui/src/list/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export const useStyles = makeStyles(theme => ({
const sanitizeRestProps = ({
actions,
basePath,
bulkActions,
changeListParams,
children,
classes,
Expand Down Expand Up @@ -112,7 +111,6 @@ export const ListView = props => {
aside,
filter,
filters,
bulkActions,
bulkActionButtons,
pagination,
children,
Expand Down Expand Up @@ -140,7 +138,6 @@ export const ListView = props => {
filters={filters}
{...controllerProps}
actions={actions}
bulkActions={bulkActions}
exporter={exporter}
permanentFilter={filter}
/>
Expand All @@ -153,20 +150,15 @@ export const ListView = props => {
})}
key={version}
>
{bulkActions !== false &&
bulkActionButtons !== false &&
bulkActionButtons &&
!bulkActions && (
<BulkActionsToolbar {...controllerProps}>
{bulkActionButtons}
</BulkActionsToolbar>
)}
{bulkActionButtons !== false && bulkActionButtons && (
<BulkActionsToolbar {...controllerProps}>
{bulkActionButtons}
</BulkActionsToolbar>
)}
{children &&
cloneElement(Children.only(children), {
...controllerProps,
hasBulkActions:
bulkActions !== false &&
bulkActionButtons !== false,
hasBulkActions: bulkActionButtons !== false,
})}
{pagination && cloneElement(pagination, controllerProps)}
</Content>
Expand All @@ -180,7 +172,6 @@ ListView.propTypes = {
actions: PropTypes.element,
aside: PropTypes.element,
basePath: PropTypes.string,
bulkActions: PropTypes.oneOfType([PropTypes.bool, PropTypes.element]),
bulkActionButtons: PropTypes.oneOfType([PropTypes.bool, PropTypes.element]),
children: PropTypes.element,
className: PropTypes.string,
Expand Down Expand Up @@ -275,7 +266,6 @@ List.propTypes = {
// the props you can change
actions: PropTypes.element,
aside: PropTypes.element,
bulkActions: PropTypes.oneOfType([PropTypes.element, PropTypes.bool]),
bulkActionButtons: PropTypes.oneOfType([PropTypes.element, PropTypes.bool]),
children: PropTypes.node,
classes: PropTypes.object,
Expand Down
10 changes: 0 additions & 10 deletions packages/ra-ui-materialui/src/list/ListActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import TopToolbar from '../layout/TopToolbar';
import { CreateButton, ExportButton } from '../button';

const ListActions = ({
bulkActions,
currentSort,
className,
resource,
Expand All @@ -26,14 +25,6 @@ const ListActions = ({
useMemo(
() => (
<TopToolbar className={className} {...sanitizeListRestProps(rest)}>
{bulkActions &&
cloneElement(bulkActions, {
basePath,
filterValues,
resource,
selectedIds,
onUnselectItems,
})}
{filters &&
cloneElement(filters, {
resource,
Expand All @@ -58,7 +49,6 @@ const ListActions = ({
);

ListActions.propTypes = {
bulkActions: PropTypes.oneOfType([PropTypes.element, PropTypes.bool]),
basePath: PropTypes.string,
className: PropTypes.string,
currentSort: PropTypes.object,
Expand Down
3 changes: 0 additions & 3 deletions packages/ra-ui-materialui/src/list/ListToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const ListToolbar = ({
filterValues, // dynamically set via the UI by the user
permanentFilter, // set in the List component by the developer
actions,
bulkActions,
exporter,
...rest
}) => {
Expand All @@ -52,7 +51,6 @@ const ListToolbar = ({
React.cloneElement(actions, {
...rest,
className: styles.actions,
bulkActions,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you'll have to update the default ListActions too

exporter,
filters,
filterValues,
Expand All @@ -68,7 +66,6 @@ ListToolbar.propTypes = {
filters: PropTypes.element,
permanentFilter: PropTypes.object,
actions: PropTypes.element,
bulkActions: PropTypes.oneOfType([PropTypes.element, PropTypes.bool]),
exporter: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
};

Expand Down
2 changes: 0 additions & 2 deletions packages/ra-ui-materialui/src/list/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import BulkActions from './BulkActions';
import BulkActionsToolbar from './BulkActionsToolbar';
import BulkDeleteAction from './BulkDeleteAction';
import Datagrid from './Datagrid';
Expand All @@ -20,7 +19,6 @@ import SimpleList from './SimpleList';
import SingleFieldList from './SingleFieldList';

export {
BulkActions,
BulkActionsToolbar,
BulkDeleteAction,
Datagrid,
Expand Down