ant-design-vue/components/transfer/operation.jsx

46 lines
974 B
Vue
Raw Normal View History

2020-03-28 07:52:26 +00:00
import LeftOutlined from '@ant-design/icons-vue/LeftOutlined';
import RightOutlined from '@ant-design/icons-vue/RightOutlined';
2019-01-12 03:33:27 +00:00
import Button from '../button';
2018-04-06 16:20:45 +00:00
2019-01-12 03:33:27 +00:00
function noop() {}
2018-04-06 16:20:45 +00:00
2020-07-19 14:40:35 +00:00
const Operation = (_, { attrs }) => {
const {
disabled,
moveToLeft = noop,
moveToRight = noop,
leftArrowText = '',
rightArrowText = '',
leftActive,
rightActive,
class: className,
style,
} = attrs;
2018-04-06 16:20:45 +00:00
2020-07-19 14:40:35 +00:00
return (
<div class={className} style={style}>
2020-08-05 09:17:07 +00:00
<Button
type="primary"
size="small"
disabled={disabled || !rightActive}
onClick={moveToRight}
icon={<RightOutlined />}
>
2020-07-19 14:40:35 +00:00
{rightArrowText}
</Button>
2020-08-05 09:17:07 +00:00
<Button
type="primary"
size="small"
disabled={disabled || !leftActive}
onClick={moveToLeft}
icon={<LeftOutlined />}
>
2020-07-19 14:40:35 +00:00
{leftArrowText}
</Button>
</div>
);
2019-01-12 03:33:27 +00:00
};
2020-07-19 14:40:35 +00:00
Operation.inheritAttrs = false;
export default Operation;