From 0c360b05ee15caa78ce902a6b30c11e0f7381c4a Mon Sep 17 00:00:00 2001 From: fzaninotto Date: Tue, 26 May 2020 23:21:46 +0200 Subject: [PATCH 1/2] Add ability to deselect rows in a Datagrid --- packages/ra-language-english/src/index.ts | 1 + packages/ra-language-french/src/index.ts | 1 + .../src/list/BulkActionsToolbar.js | 17 +++++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/packages/ra-language-english/src/index.ts b/packages/ra-language-english/src/index.ts index 104a434fcd7..01c8d3dbd1b 100644 --- a/packages/ra-language-english/src/index.ts +++ b/packages/ra-language-english/src/index.ts @@ -24,6 +24,7 @@ const englishMessages: TranslationMessages = { show: 'Show', sort: 'Sort', undo: 'Undo', + unselect: 'Unselect', expand: 'Expand', close: 'Close', open_menu: 'Open menu', diff --git a/packages/ra-language-french/src/index.ts b/packages/ra-language-french/src/index.ts index 00a1e2c1951..d24e9c8c117 100644 --- a/packages/ra-language-french/src/index.ts +++ b/packages/ra-language-french/src/index.ts @@ -25,6 +25,7 @@ const frenchMessages: TranslationMessages = { show: 'Afficher', sort: 'Trier', undo: 'Annuler', + unselect: 'Désélectionner', expand: 'Étendre', close: 'Fermer', open_menu: 'Ouvrir le menu', diff --git a/packages/ra-ui-materialui/src/list/BulkActionsToolbar.js b/packages/ra-ui-materialui/src/list/BulkActionsToolbar.js index 9c36721e25c..caf56bdc48b 100644 --- a/packages/ra-ui-materialui/src/list/BulkActionsToolbar.js +++ b/packages/ra-ui-materialui/src/list/BulkActionsToolbar.js @@ -5,6 +5,8 @@ import Toolbar from '@material-ui/core/Toolbar'; import Typography from '@material-ui/core/Typography'; import { makeStyles } from '@material-ui/core/styles'; import { lighten } from '@material-ui/core/styles/colorManipulator'; +import IconButton from '@material-ui/core/IconButton'; +import CloseIcon from '@material-ui/icons/Close'; import { useTranslate, sanitizeListRestProps } from 'ra-core'; import TopToolbar from '../layout/TopToolbar'; @@ -35,8 +37,13 @@ const useStyles = makeStyles( overflowY: 'hidden', }, title: { + display: 'flex', flex: '0 0 auto', }, + icon: { + marginLeft: '-0.5em', + marginRight: '0.5em', + }, }), { name: 'RaBulkActionsToolbar' } ); @@ -49,6 +56,7 @@ const BulkActionsToolbar = props => { label, resource, selectedIds, + onUnselectItems, children, ...rest } = props; @@ -64,6 +72,15 @@ const BulkActionsToolbar = props => { {...sanitizeListRestProps(rest)} >
+ + + {translate(label, { _: label, From 0cffec31057fad432870dab0657e2b7c3c23bd2f Mon Sep 17 00:00:00 2001 From: fzaninotto Date: Tue, 26 May 2020 23:38:56 +0200 Subject: [PATCH 2/2] Fix e2e tests --- cypress/support/ListPage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/support/ListPage.js b/cypress/support/ListPage.js index 3435a2b4905..02f873b8024 100644 --- a/cypress/support/ListPage.js +++ b/cypress/support/ListPage.js @@ -21,9 +21,9 @@ export default url => ({ logout: '.logout', bulkActionsToolbar: '[data-test=bulk-actions-toolbar]', customBulkActionsButton: - '[data-test=bulk-actions-toolbar] button:first-child', + '[data-test=bulk-actions-toolbar] button[aria-label="Reset views"]', deleteBulkActionsButton: - '[data-test=bulk-actions-toolbar] button:nth-child(2)', + '[data-test=bulk-actions-toolbar] button[aria-label="Delete"]', selectAll: '.select-all', selectedItem: '.select-item input:checked', selectItem: '.select-item input',