operation.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { createVNode as _createVNode } from "vue";
  2. import LeftOutlined from "@ant-design/icons-vue/es/icons/LeftOutlined";
  3. import RightOutlined from "@ant-design/icons-vue/es/icons/RightOutlined";
  4. import Button from '../button';
  5. function noop() {}
  6. const Operation = props => {
  7. const {
  8. disabled,
  9. moveToLeft = noop,
  10. moveToRight = noop,
  11. leftArrowText = '',
  12. rightArrowText = '',
  13. leftActive,
  14. rightActive,
  15. class: className,
  16. style,
  17. direction,
  18. oneWay
  19. } = props;
  20. return _createVNode("div", {
  21. "class": className,
  22. "style": style
  23. }, [_createVNode(Button, {
  24. "type": "primary",
  25. "size": "small",
  26. "disabled": disabled || !rightActive,
  27. "onClick": moveToRight,
  28. "icon": direction !== 'rtl' ? _createVNode(RightOutlined, null, null) : _createVNode(LeftOutlined, null, null)
  29. }, {
  30. default: () => [rightArrowText]
  31. }), !oneWay && _createVNode(Button, {
  32. "type": "primary",
  33. "size": "small",
  34. "disabled": disabled || !leftActive,
  35. "onClick": moveToLeft,
  36. "icon": direction !== 'rtl' ? _createVNode(LeftOutlined, null, null) : _createVNode(RightOutlined, null, null)
  37. }, {
  38. default: () => [leftArrowText]
  39. })]);
  40. };
  41. Operation.displayName = 'Operation';
  42. Operation.inheritAttrs = false;
  43. export default Operation;