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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _vueTypes = require('../../_util/vue-types');
var _vueTypes2 = _interopRequireDefault(_vueTypes);
var _utils = require('./utils');
var _BaseTable = require('./BaseTable');
var _BaseTable2 = _interopRequireDefault(_BaseTable);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
exports['default'] = {
name: 'HeadTable',
props: {
fixed: _vueTypes2['default'].oneOfType([_vueTypes2['default'].string, _vueTypes2['default'].bool]),
columns: _vueTypes2['default'].array.isRequired,
tableClassName: _vueTypes2['default'].string.isRequired,
handleBodyScrollLeft: _vueTypes2['default'].func.isRequired,
expander: _vueTypes2['default'].object.isRequired
},
inject: {
table: { 'default': function _default() {
return {};
} }
},
mounted: function mounted() {
this.updateTableRef();
},
updated: function updated() {
this.updateTableRef();
},
methods: {
updateTableRef: function updateTableRef() {
var _this = this;
this.$nextTick(function () {
_this.$refs.headTable && _this.table.saveChildrenRef('headTable', _this.$refs.headTable);
});
}
},
render: function render() {
var h = arguments[0];
var columns = this.columns,
fixed = this.fixed,
tableClassName = this.tableClassName,
handleBodyScrollLeft = this.handleBodyScrollLeft,
expander = this.expander,
table = this.table;
var prefixCls = table.prefixCls,
scroll = table.scroll,
showHeader = table.showHeader;
var useFixedHeader = table.useFixedHeader;
var headStyle = {};
if (scroll.y) {
useFixedHeader = true;
// Add negative margin bottom for scroll bar overflow bug
var scrollbarWidth = (0, _utils.measureScrollbar)('horizontal');
if (scrollbarWidth > 0 && !fixed) {
headStyle.marginBottom = '-' + scrollbarWidth + 'px';
headStyle.paddingBottom = '0px';
}
}
if (!useFixedHeader || !showHeader) {
return null;
}
return h(
'div',
{
key: 'headTable',
ref: fixed ? null : 'headTable',
'class': prefixCls + '-header',
style: headStyle,
on: {
'scroll': handleBodyScrollLeft
}
},
[h(_BaseTable2['default'], {
attrs: {
tableClassName: tableClassName,
hasHead: true,
hasBody: false,
fixed: fixed,
columns: columns,
expander: expander
}
})]
);
}
};