"use strict";

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

var _vue = _interopRequireWildcard(require("vue"));

var _UpOutlined = _interopRequireDefault(require("@ant-design/icons-vue/UpOutlined"));

var _DownOutlined = _interopRequireDefault(require("@ant-design/icons-vue/DownOutlined"));

var _LeftOutlined = _interopRequireDefault(require("@ant-design/icons-vue/LeftOutlined"));

var _RightOutlined = _interopRequireDefault(require("@ant-design/icons-vue/RightOutlined"));

var _ScrollableInkTabBar = _interopRequireDefault(require("../vc-tabs/src/ScrollableInkTabBar"));

var _vueTypes = _interopRequireDefault(require("../_util/vue-types"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

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 _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

var TabBar = {
  name: 'TabBar',
  inheritAttrs: false,
  props: {
    prefixCls: _vueTypes.default.string,
    tabBarStyle: _vueTypes.default.object,
    tabBarExtraContent: _vueTypes.default.any,
    type: _vueTypes.default.oneOf(['line', 'card', 'editable-card']),
    tabPosition: _vueTypes.default.oneOf(['top', 'right', 'bottom', 'left']).def('top'),
    tabBarPosition: _vueTypes.default.oneOf(['top', 'right', 'bottom', 'left']),
    size: _vueTypes.default.oneOf(['default', 'small', 'large']),
    animated: _vueTypes.default.oneOfType([_vueTypes.default.bool, _vueTypes.default.object]),
    renderTabBar: _vueTypes.default.func,
    panels: _vueTypes.default.array.def([]),
    activeKey: _vueTypes.default.oneOfType([_vueTypes.default.string, _vueTypes.default.number]),
    tabBarGutter: _vueTypes.default.number
  },
  render: function render() {
    var _cls;

    var _this$$props = this.$props,
        tabBarStyle = _this$$props.tabBarStyle,
        _this$$props$animated = _this$$props.animated,
        animated = _this$$props$animated === void 0 ? true : _this$$props$animated,
        renderTabBar = _this$$props.renderTabBar,
        tabBarExtraContent = _this$$props.tabBarExtraContent,
        tabPosition = _this$$props.tabPosition,
        prefixCls = _this$$props.prefixCls,
        _this$$props$type = _this$$props.type,
        type = _this$$props$type === void 0 ? 'line' : _this$$props$type,
        size = _this$$props.size;
    var inkBarAnimated = _typeof(animated) === 'object' ? animated.inkBar : animated;
    var isVertical = tabPosition === 'left' || tabPosition === 'right';

    var prevIcon = _vue.createVNode("span", {
      "class": "".concat(prefixCls, "-tab-prev-icon")
    }, [isVertical ? _vue.createVNode(_UpOutlined.default, {
      "class": "".concat(prefixCls, "-tab-prev-icon-target")
    }, null) : _vue.createVNode(_LeftOutlined.default, {
      "class": "".concat(prefixCls, "-tab-prev-icon-target")
    }, null)]);

    var nextIcon = _vue.createVNode("span", {
      "class": "".concat(prefixCls, "-tab-next-icon")
    }, [isVertical ? _vue.createVNode(_DownOutlined.default, {
      "class": "".concat(prefixCls, "-tab-next-icon-target")
    }, null) : _vue.createVNode(_RightOutlined.default, {
      "class": "".concat(prefixCls, "-tab-next-icon-target")
    }, null)]); // Additional className for style usage


    var cls = (_cls = {}, _defineProperty(_cls, this.$attrs.class, this.$attrs.class), _defineProperty(_cls, "".concat(prefixCls, "-").concat(tabPosition, "-bar"), true), _defineProperty(_cls, "".concat(prefixCls, "-").concat(size, "-bar"), !!size), _defineProperty(_cls, "".concat(prefixCls, "-card-bar"), type && type.indexOf('card') >= 0), _cls);

    var renderProps = _objectSpread(_objectSpread(_objectSpread({}, this.$props), this.$attrs), {}, {
      children: null,
      inkBarAnimated: inkBarAnimated,
      extraContent: tabBarExtraContent,
      prevIcon: prevIcon,
      nextIcon: nextIcon,
      style: tabBarStyle,
      class: cls
    });

    if (renderTabBar) {
      return renderTabBar(_objectSpread(_objectSpread({}, renderProps), {}, {
        DefaultTabBar: _ScrollableInkTabBar.default
      }));
    } else {
      return _vue.createVNode(_ScrollableInkTabBar.default, renderProps, null);
    }
  }
};
var _default = TabBar;
exports.default = _default;