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