"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _vue = require("vue");
var _LeftOutlined = _interopRequireDefault(require("@ant-design/icons-vue/lib/icons/LeftOutlined"));
var _RightOutlined = _interopRequireDefault(require("@ant-design/icons-vue/lib/icons/RightOutlined"));
var _button = _interopRequireDefault(require("../button"));
require("../_util/type");
function noop() {}
const Operation = props => {
  const {
    disabled,
    moveToLeft = noop,
    moveToRight = noop,
    leftActive,
    rightActive,
    class: className,
    style,
    direction,
    oneWay,
    operations
  } = props;
  const toRightOperation = (0, _vue.isVNode)(operations[0]) ? (0, _vue.cloneVNode)(operations[0], {
    disabled: disabled || !rightActive,
    onClick: moveToRight
  }) : (0, _vue.createVNode)(_button.default, {
    "type": "primary",
    "size": "small",
    "disabled": disabled || !rightActive,
    "onClick": moveToRight,
    "icon": direction !== 'rtl' ? (0, _vue.createVNode)(_RightOutlined.default, null, null) : (0, _vue.createVNode)(_LeftOutlined.default, null, null)
  }, {
    default: () => [operations[0]]
  });
  const toLeftOperation = (0, _vue.isVNode)(operations[1]) ? (0, _vue.cloneVNode)(operations[1], {
    disabled: disabled || !leftActive,
    onClick: moveToLeft
  }) : (0, _vue.createVNode)(_button.default, {
    "type": "primary",
    "size": "small",
    "disabled": disabled || !leftActive,
    "onClick": moveToLeft,
    "icon": direction !== 'rtl' ? (0, _vue.createVNode)(_LeftOutlined.default, null, null) : (0, _vue.createVNode)(_RightOutlined.default, null, null)
  }, {
    default: () => [operations[1]]
  });
  return (0, _vue.createVNode)("div", {
    "class": className,
    "style": style
  }, [toRightOperation, !oneWay && toLeftOperation, operations.slice(oneWay ? 1 : 2)]);
};
Operation.displayName = 'Operation';
Operation.inheritAttrs = false;
var _default = exports.default = Operation;