ColGroup.js
1.16 KB
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
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
var _legacyUtil = require("./utils/legacyUtil");
function ColGroup(_ref) {
var colWidths = _ref.colWidths,
columns = _ref.columns,
columCount = _ref.columCount;
var cols = [];
var len = columCount || columns.length; // Only insert col with width & additional props
// Skip if rest col do not have any useful info
var mustInsert = false;
for (var i = len - 1; i >= 0; i -= 1) {
var width = colWidths[i];
var column = columns && columns[i];
var additionalProps = column && column[_legacyUtil.INTERNAL_COL_DEFINE];
if (width || additionalProps || mustInsert) {
cols.unshift(React.createElement("col", Object.assign({
key: i,
style: {
width: width,
minWidth: width
}
}, additionalProps)));
mustInsert = true;
}
}
return React.createElement("colgroup", null, cols);
}
var _default = ColGroup;
exports.default = _default;