import { cloneVNode, isVNode, createVNode as _createVNode } from 'vue';
import LeftOutlined from "@ant-design/icons-vue/es/icons/LeftOutlined";
import RightOutlined from "@ant-design/icons-vue/es/icons/RightOutlined";
import Button from '../button';
import '../_util/type';
function noop() {}
const Operation = props => {
  const {
    disabled,
    moveToLeft = noop,
    moveToRight = noop,
    leftActive,
    rightActive,
    class: className,
    style,
    direction,
    oneWay,
    operations
  } = props;
  const toRightOperation = isVNode(operations[0]) ? cloneVNode(operations[0], {
    disabled: disabled || !rightActive,
    onClick: moveToRight
  }) : _createVNode(Button, {
    "type": "primary",
    "size": "small",
    "disabled": disabled || !rightActive,
    "onClick": moveToRight,
    "icon": direction !== 'rtl' ? _createVNode(RightOutlined, null, null) : _createVNode(LeftOutlined, null, null)
  }, {
    default: () => [operations[0]]
  });
  const toLeftOperation = isVNode(operations[1]) ? cloneVNode(operations[1], {
    disabled: disabled || !leftActive,
    onClick: moveToLeft
  }) : _createVNode(Button, {
    "type": "primary",
    "size": "small",
    "disabled": disabled || !leftActive,
    "onClick": moveToLeft,
    "icon": direction !== 'rtl' ? _createVNode(LeftOutlined, null, null) : _createVNode(RightOutlined, null, null)
  }, {
    default: () => [operations[1]]
  });
  return _createVNode("div", {
    "class": className,
    "style": style
  }, [toRightOperation, !oneWay && toLeftOperation, operations.slice(oneWay ? 1 : 2)]);
};
Operation.displayName = 'Operation';
Operation.inheritAttrs = false;
export default Operation;