1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import _mergeJSXProps from 'babel-helper-vue-jsx-merge-props';
import _extends from 'babel-runtime/helpers/extends';
import _defineProperty from 'babel-runtime/helpers/defineProperty';
import { cloneElement } from '../../_util/vnode';
import PropTypes from '../../_util/vue-types';
import BaseMixin from '../../_util/BaseMixin';
function noop() {}
export default {
name: 'TabBarRootNode',
mixins: [BaseMixin],
props: {
saveRef: PropTypes.func.def(noop),
getRef: PropTypes.func.def(noop),
prefixCls: PropTypes.string.def(''),
tabBarPosition: PropTypes.string.def('top'),
extraContent: PropTypes.any
},
methods: {
onKeyDown: function onKeyDown(e) {
this.__emit('keydown', e);
}
},
render: function render() {
var h = arguments[0];
var prefixCls = this.prefixCls,
onKeyDown = this.onKeyDown,
tabBarPosition = this.tabBarPosition,
extraContent = this.extraContent;
var cls = _defineProperty({}, prefixCls + '-bar', true);
var topOrBottom = tabBarPosition === 'top' || tabBarPosition === 'bottom';
var tabBarExtraContentStyle = topOrBottom ? { float: 'right' } : {};
var children = this.$slots['default'];
var newChildren = children;
if (extraContent) {
newChildren = [cloneElement(extraContent, {
key: 'extra',
style: _extends({}, tabBarExtraContentStyle)
}), cloneElement(children, { key: 'content' })];
newChildren = topOrBottom ? newChildren : newChildren.reverse();
}
return h(
'div',
_mergeJSXProps([{
attrs: {
role: 'tablist',
tabIndex: '0'
},
'class': cls, on: {
'keydown': onKeyDown
}
}, {
directives: [{
name: 'ant-ref',
value: this.saveRef('root')
}]
}]),
[newChildren]
);
}
};