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

import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
import { ChevronRightIcon, ChevronLeftIcon } from '@ldesign/icons-vue';
import { Button } from '../../button/index.js';
import mixins from '../../utils/mixins.js';
import { getClassPrefixMixins, getGlobalIconMixins } from '../../config-provider/config-receiver.js';
import '../../utils/withInstall.js';
import '@babel/runtime/helpers/defineProperty';
import 'vue';
import 'lodash/capitalize';
import '../../button/button.js';
import '../../loading/index.js';
import '../../loading/directive.js';
import 'lodash/isObject';
import 'lodash/mapKeys';
import 'lodash/isEqual';
import '../../loading/plugin.js';
import '../../config.js';
import '../../utils/dom.js';
import 'raf';
import 'lodash/isString';
import '../../utils/easing.js';
import '../../loading/loading.js';
import '../../utils/render-tnode.js';
import '@babel/runtime/helpers/typeof';
import '@vue/composition-api';
import 'lodash/camelCase';
import 'lodash/kebabCase';
import '../../utils/transfer-dom.js';
import '../../loading/props.js';
import '../../loading/icon/gradient.js';
import '../../_common/js/loading/circle-adapter.js';
import '../../_common/js/utils/set-style.js';
import '../../_common/js/utils/helper.js';
import '@babel/runtime/helpers/toConsumableArray';
import '@babel/runtime/helpers/objectWithoutProperties';
import 'lodash/isNull';
import 'lodash/isUndefined';
import 'lodash/isNumber';
import 'lodash/isArray';
import 'lodash/mergeWith';
import '../../config-provider/context.js';
import 'lodash/merge';
import '../../_common/js/global-config/default-config.js';
import '../../_common/js/global-config/locale/zh_CN.js';
import '../../_chunks/dep-be599ec8.js';
import 'dayjs';
import '../../_chunks/dep-67ff4010.js';
import '../../config-provider/type.js';
import '../../loading/style';
import '../../loading/type.js';
import '../../utils/ripple.js';
import '../../button/props.js';
import '../../button/style';
import '../../button/type.js';

var classPrefixMixins = getClassPrefixMixins("transfer");
var TransferOperations = mixins(classPrefixMixins, 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: ChevronRightIcon
        }),
        ChevronRightIcon$1 = _this$useGlobalIcon.ChevronRightIcon;
      return h(ChevronRightIcon$1);
    },
    getIconLeft: function getIconLeft() {
      var h = this.$createElement;
      var _this$useGlobalIcon2 = this.useGlobalIcon({
          ChevronLeftIcon: ChevronLeftIcon
        }),
        ChevronLeftIcon$1 = _this$useGlobalIcon2.ChevronLeftIcon;
      return h(ChevronLeftIcon$1);
    },
    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(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, {
      "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, {
      "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")])]);
  }
});

export { TransferOperations as default };
//# sourceMappingURL=transfer-operations.js.map
