bulkAction 可以配置不要求选中

This commit is contained in:
liaoxuezhi 2019-08-05 11:56:13 +08:00
parent b86e69b479
commit a2fa03a322
2 changed files with 4 additions and 3 deletions

View File

@ -35,7 +35,8 @@ const ActionProps = [
'mergeData',
'index',
'copy',
'payload'
'payload',
'requireSelected'
];
import {filterContents} from './Remark';
import {ClassNamesFn, themeable} from '../theme';

View File

@ -307,7 +307,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
handleBulkAction(selectedItems: Array<any>, unSelectedItems: Array<any>, e: React.UIEvent<any>, action: Action) {
const {store, primaryField, onAction, messages, pageField, stopAutoRefreshWhenModalIsOpen} = this.props;
if (!selectedItems.length) {
if (!selectedItems.length && action.requireSelected !== false) {
return;
}
@ -971,7 +971,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
{
key: `bulk-${index}`,
data: ctx,
disabled: btn.disabled || !selectedItems.length,
disabled: btn.disabled || (btn.requireSelected !== false ? !selectedItems.length : false),
onAction: this.handleBulkAction.bind(
this,
selectedItems.concat(),