Skip to content

Commit

Permalink
Merge pull request #3517 from Kunnu01/removeBulkActions
Browse files Browse the repository at this point in the history
[RFR] Remove BulkActions in V3
  • Loading branch information
fzaninotto authored Aug 20, 2019
2 parents 3f888d5 + 26ff71f commit d5fb353
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 233 deletions.
27 changes: 27 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,33 @@ 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)

```diff
- const PostBulkActions = props => (
- <BulkActions {...props}>
- <CustomBulkMenuItem />
- {/* Add the default bulk delete action */}
- <BulkDeleteMenuItem />
- </BulkActions>
- );
+ const PostBulkActionButtons = props => (
+ <Fragment>
+ <ResetViewsButton label="Reset Views" {...props} />
+ {/* Add the default bulk delete action */}
+ <BulkDeleteButton {...props} />
+ </Fragment>
+ );

export const PostList = (props) => (
<List
{...props}
- bulkActions={<PostBulkActions />}
+ bulkActionButtons={<PostBulkActionButtons />}>
...
</List>
);
```

## 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,
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

0 comments on commit d5fb353

Please sign in to comment.