feat: update modal action for batch items
When selecting multi items in the table list page, and the action is a ModalAction, update the judgment: whether the OK button is clickable. Change-Id: Ib14934b510e3788530e758a406d9801d7e22ab52
This commit is contained in:
parent
87238aa2f8
commit
2d6eeec796
@ -463,17 +463,21 @@ export class ActionButton extends Component {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
getModalOkButtonProps = (item, action) => {
|
getModalOkButtonProps = ({ item, action, items }) => {
|
||||||
const { disableSubmit = false, okButtonProps } = action;
|
const { disableSubmit = false, okButtonProps } = action;
|
||||||
if (okButtonProps) {
|
if (okButtonProps) {
|
||||||
return okButtonProps;
|
return okButtonProps;
|
||||||
}
|
}
|
||||||
|
const disabled = isFunction(disableSubmit)
|
||||||
|
? disableSubmit({ item, items, action })
|
||||||
|
: disableSubmit;
|
||||||
return {
|
return {
|
||||||
disabled: disableSubmit,
|
disabled,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
getModalCancelButtonProps = (item, action) => {
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
getModalCancelButtonProps = ({ item, action, items }) => {
|
||||||
const { readOnly, cancelButtonProps } = action;
|
const { readOnly, cancelButtonProps } = action;
|
||||||
if (cancelButtonProps) {
|
if (cancelButtonProps) {
|
||||||
return cancelButtonProps;
|
return cancelButtonProps;
|
||||||
@ -509,8 +513,12 @@ export class ActionButton extends Component {
|
|||||||
const ActionComponent = action;
|
const ActionComponent = action;
|
||||||
const { okText, cancelText, id, className } = action;
|
const { okText, cancelText, id, className } = action;
|
||||||
const width = this.getModalWidth(action);
|
const width = this.getModalWidth(action);
|
||||||
const okButtonProps = this.getModalOkButtonProps(item, action);
|
const okButtonProps = this.getModalOkButtonProps({ item, action, items });
|
||||||
const cancelButtonProps = this.getModalCancelButtonProps(item, action);
|
const cancelButtonProps = this.getModalCancelButtonProps({
|
||||||
|
item,
|
||||||
|
action,
|
||||||
|
items,
|
||||||
|
});
|
||||||
const modalProps = {
|
const modalProps = {
|
||||||
title,
|
title,
|
||||||
visible,
|
visible,
|
||||||
|
Loading…
Reference in New Issue
Block a user