UNPKG

5.32 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = void 0;
7
8var _vue = require("vue");
9
10var _type = require("../_util/type");
11
12var _UpOutlined = _interopRequireDefault(require("@ant-design/icons-vue/UpOutlined"));
13
14var _DownOutlined = _interopRequireDefault(require("@ant-design/icons-vue/DownOutlined"));
15
16var _LeftOutlined = _interopRequireDefault(require("@ant-design/icons-vue/LeftOutlined"));
17
18var _RightOutlined = _interopRequireDefault(require("@ant-design/icons-vue/RightOutlined"));
19
20var _ScrollableInkTabBar = _interopRequireDefault(require("../vc-tabs/src/ScrollableInkTabBar"));
21
22var _vueTypes = _interopRequireDefault(require("../_util/vue-types"));
23
24function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
26function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
27
28function _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; }
29
30function _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); }
31
32var TabBar = (0, _vue.defineComponent)({
33 name: 'TabBar',
34 inheritAttrs: false,
35 props: {
36 prefixCls: _vueTypes.default.string,
37 centered: _vueTypes.default.looseBool.def(false),
38 tabBarStyle: _vueTypes.default.style,
39 tabBarExtraContent: _vueTypes.default.VNodeChild,
40 type: _vueTypes.default.oneOf((0, _type.tuple)('line', 'card', 'editable-card')),
41 tabPosition: _vueTypes.default.oneOf((0, _type.tuple)('top', 'right', 'bottom', 'left')).def('top'),
42 tabBarPosition: _vueTypes.default.oneOf((0, _type.tuple)('top', 'right', 'bottom', 'left')),
43 size: _vueTypes.default.oneOf((0, _type.tuple)('default', 'small', 'large')),
44 animated: {
45 type: [Boolean, Object],
46 default: undefined
47 },
48 renderTabBar: _vueTypes.default.func,
49 panels: _vueTypes.default.array.def([]),
50 activeKey: _vueTypes.default.oneOfType([_vueTypes.default.string, _vueTypes.default.number]),
51 tabBarGutter: _vueTypes.default.number
52 },
53 render: function render() {
54 var _cls;
55
56 var _this$$props = this.$props,
57 centered = _this$$props.centered,
58 tabBarStyle = _this$$props.tabBarStyle,
59 _this$$props$animated = _this$$props.animated,
60 animated = _this$$props$animated === void 0 ? true : _this$$props$animated,
61 renderTabBar = _this$$props.renderTabBar,
62 tabBarExtraContent = _this$$props.tabBarExtraContent,
63 tabPosition = _this$$props.tabPosition,
64 prefixCls = _this$$props.prefixCls,
65 _this$$props$type = _this$$props.type,
66 type = _this$$props$type === void 0 ? 'line' : _this$$props$type,
67 size = _this$$props.size;
68 var inkBarAnimated = _typeof(animated) === 'object' ? animated.inkBar : animated;
69 var isVertical = tabPosition === 'left' || tabPosition === 'right';
70 var prevIcon = (0, _vue.createVNode)("span", {
71 "class": "".concat(prefixCls, "-tab-prev-icon")
72 }, [isVertical ? (0, _vue.createVNode)(_UpOutlined.default, {
73 "class": "".concat(prefixCls, "-tab-prev-icon-target")
74 }, null) : (0, _vue.createVNode)(_LeftOutlined.default, {
75 "class": "".concat(prefixCls, "-tab-prev-icon-target")
76 }, null)]);
77 var nextIcon = (0, _vue.createVNode)("span", {
78 "class": "".concat(prefixCls, "-tab-next-icon")
79 }, [isVertical ? (0, _vue.createVNode)(_DownOutlined.default, {
80 "class": "".concat(prefixCls, "-tab-next-icon-target")
81 }, null) : (0, _vue.createVNode)(_RightOutlined.default, {
82 "class": "".concat(prefixCls, "-tab-next-icon-target")
83 }, null)]); // Additional className for style usage
84
85 var cls = (_cls = {}, _defineProperty(_cls, this.$attrs.class, this.$attrs.class), _defineProperty(_cls, "".concat(prefixCls, "-centered-bar"), centered), _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);
86
87 var renderProps = _extends(_extends(_extends({}, this.$props), this.$attrs), {
88 children: null,
89 inkBarAnimated: inkBarAnimated,
90 extraContent: tabBarExtraContent,
91 prevIcon: prevIcon,
92 nextIcon: nextIcon,
93 style: tabBarStyle,
94 class: cls
95 });
96
97 if (renderTabBar) {
98 return renderTabBar(_extends(_extends({}, renderProps), {
99 DefaultTabBar: _ScrollableInkTabBar.default
100 }));
101 } else {
102 return (0, _vue.createVNode)(_ScrollableInkTabBar.default, renderProps, null);
103 }
104 }
105});
106var _default = TabBar;
107exports.default = _default;
\No newline at end of file