UNPKG

@fe6/water-pro

Version:

An enterprise-class UI design language and Vue-based implementation

107 lines (89 loc) 5.36 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _vue = require("vue"); var _type = require("../_util/type"); var _UpOutlined = _interopRequireDefault(require("@ant-design/icons-vue/lib/icons/UpOutlined")); var _DownOutlined = _interopRequireDefault(require("@ant-design/icons-vue/lib/icons/DownOutlined")); var _LeftOutlined = _interopRequireDefault(require("@ant-design/icons-vue/lib/icons/LeftOutlined")); var _RightOutlined = _interopRequireDefault(require("@ant-design/icons-vue/lib/icons/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 _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); } 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 = (0, _vue.defineComponent)({ name: 'TabBar', inheritAttrs: false, props: { prefixCls: _vueTypes.default.string, centered: _vueTypes.default.looseBool.def(false), tabBarStyle: _vueTypes.default.style, tabBarExtraContent: _vueTypes.default.VNodeChild, type: _vueTypes.default.oneOf((0, _type.tuple)('line', 'card', 'editable-card')), tabPosition: _vueTypes.default.oneOf((0, _type.tuple)('top', 'right', 'bottom', 'left')).def('top'), tabBarPosition: _vueTypes.default.oneOf((0, _type.tuple)('top', 'right', 'bottom', 'left')), size: _vueTypes.default.oneOf((0, _type.tuple)('default', 'small', 'large')), animated: { type: [Boolean, Object], default: undefined }, 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, centered = _this$$props.centered, 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 = (0, _vue.createVNode)("span", { "class": "".concat(prefixCls, "-tab-prev-icon") }, [isVertical ? (0, _vue.createVNode)(_UpOutlined.default, { "class": "".concat(prefixCls, "-tab-prev-icon-target") }, null) : (0, _vue.createVNode)(_LeftOutlined.default, { "class": "".concat(prefixCls, "-tab-prev-icon-target") }, null)]); var nextIcon = (0, _vue.createVNode)("span", { "class": "".concat(prefixCls, "-tab-next-icon") }, [isVertical ? (0, _vue.createVNode)(_DownOutlined.default, { "class": "".concat(prefixCls, "-tab-next-icon-target") }, null) : (0, _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, "-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.includes('card')), _cls); var renderProps = _extends(_extends(_extends({}, this.$props), this.$attrs), { children: null, inkBarAnimated: inkBarAnimated, extraContent: tabBarExtraContent, prevIcon: prevIcon, nextIcon: nextIcon, style: tabBarStyle, class: cls }); if (renderTabBar) { return renderTabBar(_extends(_extends({}, renderProps), { DefaultTabBar: _ScrollableInkTabBar.default })); } else { return (0, _vue.createVNode)(_ScrollableInkTabBar.default, renderProps, null); } } }); var _default = TabBar; exports.default = _default;