"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _vue = require("vue");

var _antDesignVue = require("ant-design-vue");

var _utils = require("../utils");

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _isSlot(s) {
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !(0, _vue.isVNode)(s);
}

var Action = function Action(props, _ref) {
  var _slots$default;

  var slots = _ref.slots;
  var show = props.show,
      title = props.title,
      tips = props.tips,
      onClick = props.onClick,
      className = props.className,
      style = props.style;
  if (!show) return null;
  var classNames = ['action', _defineProperty({}, "".concat(className), !!className)];
  var name = ((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)) || title;
  var dom = (0, _vue.createVNode)("span", {
    "class": classNames,
    "style": style,
    "onClick": onClick
  }, _isSlot(name) ? name : {
    default: function _default() {
      return [name];
    }
  });
  return tips ? (0, _vue.createVNode)(_antDesignVue.Tooltip, {
    "title": tips,
    "placement": 'bottom'
  }, _isSlot(dom) ? dom : {
    default: function _default() {
      return [dom];
    }
  }) : dom;
};

Action.displayName = 'Action';
Action.props = {
  id: _utils.PropTypes.string.isRequired,
  className: {
    type: [String, Array, Object]
  },
  style: _utils.PropTypes.object,
  show: _utils.PropTypes.bool.def(true),
  sort: _utils.PropTypes.number.def(0),
  tips: [String, Boolean],
  title: {},
  onClick: _utils.PropTypes.func
};

var _default2 = (0, _utils.withInstall)(Action);

exports.default = _default2;