2019-01-12 11:33:27 +08:00
|
|
|
import PropTypes from '../_util/vue-types';
|
|
|
|
import { getOptionProps } from '../_util/props-util';
|
|
|
|
import Button from '../button';
|
2018-04-07 00:20:45 +08:00
|
|
|
|
2019-01-12 11:33:27 +08:00
|
|
|
function noop() {}
|
2018-04-07 00:20:45 +08:00
|
|
|
|
|
|
|
export const TransferOperationProps = {
|
|
|
|
className: PropTypes.string,
|
|
|
|
leftArrowText: PropTypes.string,
|
|
|
|
rightArrowText: PropTypes.string,
|
|
|
|
moveToLeft: PropTypes.any,
|
|
|
|
moveToRight: PropTypes.any,
|
|
|
|
leftActive: PropTypes.bool,
|
|
|
|
rightActive: PropTypes.bool,
|
2018-12-05 20:00:13 +08:00
|
|
|
disabled: PropTypes.bool,
|
2019-01-12 11:33:27 +08:00
|
|
|
};
|
2018-04-07 00:20:45 +08:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'Operation',
|
|
|
|
props: { ...TransferOperationProps },
|
2019-01-12 11:33:27 +08:00
|
|
|
render() {
|
2018-04-07 00:20:45 +08:00
|
|
|
const {
|
2018-12-05 20:00:13 +08:00
|
|
|
disabled,
|
2018-04-07 00:20:45 +08:00
|
|
|
moveToLeft = noop,
|
|
|
|
moveToRight = noop,
|
|
|
|
leftArrowText = '',
|
|
|
|
rightArrowText = '',
|
|
|
|
leftActive,
|
|
|
|
rightActive,
|
2019-01-12 11:33:27 +08:00
|
|
|
} = getOptionProps(this);
|
2018-04-07 00:20:45 +08:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<Button
|
2019-01-12 11:33:27 +08:00
|
|
|
type="primary"
|
|
|
|
size="small"
|
2018-12-05 20:00:13 +08:00
|
|
|
disabled={disabled || !rightActive}
|
2018-09-05 21:28:54 +08:00
|
|
|
onClick={moveToRight}
|
2019-01-12 11:33:27 +08:00
|
|
|
icon="right"
|
2018-04-07 00:20:45 +08:00
|
|
|
>
|
2018-09-05 21:28:54 +08:00
|
|
|
{rightArrowText}
|
2018-04-07 00:20:45 +08:00
|
|
|
</Button>
|
|
|
|
<Button
|
2019-01-12 11:33:27 +08:00
|
|
|
type="primary"
|
|
|
|
size="small"
|
2018-12-05 20:00:13 +08:00
|
|
|
disabled={disabled || !leftActive}
|
2018-09-05 21:28:54 +08:00
|
|
|
onClick={moveToLeft}
|
2019-01-12 11:33:27 +08:00
|
|
|
icon="left"
|
2018-04-07 00:20:45 +08:00
|
|
|
>
|
2018-09-05 21:28:54 +08:00
|
|
|
{leftArrowText}
|
2018-04-07 00:20:45 +08:00
|
|
|
</Button>
|
|
|
|
</div>
|
2019-01-12 11:33:27 +08:00
|
|
|
);
|
2018-04-07 00:20:45 +08:00
|
|
|
},
|
2019-01-12 11:33:27 +08:00
|
|
|
};
|