/**
 * ldesign v0.4.6
 * (c) 2023 ldesign
 * @license MIT
 */

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
var iconsVue = require('@ldesign/icons-vue');
var button_index = require('../../button/index.js');
var utils_mixins = require('../../utils/mixins.js');
var configProvider_configReceiver = require('../../config-provider/config-receiver.js');
require('../../utils/withInstall.js');
require('@babel/runtime/helpers/defineProperty');
require('vue');
require('lodash/capitalize');
require('../../button/button.js');
require('../../loading/index.js');
require('../../loading/directive.js');
require('lodash/isObject');
require('lodash/mapKeys');
require('lodash/isEqual');
require('../../loading/plugin.js');
require('../../config.js');
require('../../utils/dom.js');
require('raf');
require('lodash/isString');
require('../../utils/easing.js');
require('../../loading/loading.js');
require('../../utils/render-tnode.js');
require('@babel/runtime/helpers/typeof');
require('@vue/composition-api');
require('lodash/camelCase');
require('lodash/kebabCase');
require('../../utils/transfer-dom.js');
require('../../loading/props.js');
require('../../loading/icon/gradient.js');
require('../../_common/js/loading/circle-adapter.js');
require('../../_common/js/utils/set-style.js');
require('../../_common/js/utils/helper.js');
require('@babel/runtime/helpers/toConsumableArray');
require('@babel/runtime/helpers/objectWithoutProperties');
require('lodash/isNull');
require('lodash/isUndefined');
require('lodash/isNumber');
require('lodash/isArray');
require('lodash/mergeWith');
require('../../config-provider/context.js');
require('lodash/merge');
require('../../_common/js/global-config/default-config.js');
require('../../_common/js/global-config/locale/zh_CN.js');
require('../../_chunks/dep-7c884501.js');
require('dayjs');
require('../../utils/ripple.js');
require('../../button/props.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);

var classPrefixMixins = configProvider_configReceiver.getClassPrefixMixins("transfer");
var TransferOperations = utils_mixins["default"](classPrefixMixins, configProvider_configReceiver.getGlobalIconMixins()).extend({
  name: "TTransferOperations",
  props: {
    leftDisabled: {
      type: Boolean,
      required: true
    },
    rightDisabled: {
      type: Boolean,
      required: true
    },
    operation: {
      type: [String, Array, Function, Boolean]
    }
  },
  methods: {
    moveToRight: function moveToRight() {
      this.$emit("moveToRight");
    },
    moveToLeft: function moveToLeft() {
      this.$emit("moveToLeft");
    },
    getIconRight: function getIconRight() {
      var h = this.$createElement;
      var _this$useGlobalIcon = this.useGlobalIcon({
          ChevronRightIcon: iconsVue.ChevronRightIcon
        }),
        ChevronRightIcon = _this$useGlobalIcon.ChevronRightIcon;
      return h(ChevronRightIcon);
    },
    getIconLeft: function getIconLeft() {
      var h = this.$createElement;
      var _this$useGlobalIcon2 = this.useGlobalIcon({
          ChevronLeftIcon: iconsVue.ChevronLeftIcon
        }),
        ChevronLeftIcon = _this$useGlobalIcon2.ChevronLeftIcon;
      return h(ChevronLeftIcon);
    },
    getIcon: function getIcon(direction) {
      if (typeof this.operation === "function") return null;
      if (direction === "right" && this.operation && typeof this.operation[0] === "function") return null;
      if (direction === "left" && this.operation && typeof this.operation[1] === "function") return null;
      if (this.$scopedSlots.operation) return null;
      return direction === "left" ? this.getIconLeft : this.getIconRight;
    },
    _renderButton: function _renderButton(h, direction) {
      if (typeof this.$scopedSlots.operation === "function") {
        return this.$scopedSlots.operation({
          direction: direction
        });
      }
      if (typeof this.operation === "function") {
        var renderContent2 = this.operation;
        return renderContent2(h, {
          direction: direction
        });
      }
      var renderContent;
      if (Array.isArray(this.operation)) {
        var _this$operation = _slicedToArray__default["default"](this.operation, 2),
          left = _this$operation[0],
          right = _this$operation[1];
        renderContent = direction === "right" ? right : left;
      } else {
        renderContent = "";
      }
      return renderContent;
    }
  },
  render: function render(h) {
    var _this$operation2, _this$operation3;
    var _this$$props = this.$props,
      leftDisabled = _this$$props.leftDisabled,
      rightDisabled = _this$$props.rightDisabled;
    return h("div", {
      "class": "".concat(this.componentName, "__operations")
    }, [h(button_index.Button, {
      "attrs": {
        "variant": "outline",
        "size": "small",
        "shape": typeof ((_this$operation2 = this.operation) === null || _this$operation2 === void 0 ? void 0 : _this$operation2[1]) === "string" ? "rectangle" : "square",
        "disabled": rightDisabled,
        "icon": this.getIcon("right")
      },
      "key": rightDisabled ? "right-outline" : "right-base",
      "on": {
        "click": this.moveToRight
      }
    }, [this._renderButton(h, "right")]), h(button_index.Button, {
      "attrs": {
        "variant": "outline",
        "size": "small",
        "shape": typeof ((_this$operation3 = this.operation) === null || _this$operation3 === void 0 ? void 0 : _this$operation3[0]) === "string" ? "rectangle" : "square",
        "disabled": leftDisabled,
        "icon": this.getIcon("left")
      },
      "key": leftDisabled ? "left-outline" : "left-base",
      "on": {
        "click": this.moveToLeft
      }
    }, [this._renderButton(h, "left")])]);
  }
});

exports["default"] = TransferOperations;
//# sourceMappingURL=transfer-operations.js.map
