UNPKG

932 BJavaScriptView Raw
1import * as React from 'react';
2import { INTERNAL_COL_DEFINE } from './utils/legacyUtil';
3
4function ColGroup(_ref) {
5 var colWidths = _ref.colWidths,
6 columns = _ref.columns,
7 columCount = _ref.columCount;
8 var cols = [];
9 var len = columCount || columns.length; // Only insert col with width & additional props
10 // Skip if rest col do not have any useful info
11
12 var mustInsert = false;
13
14 for (var i = len - 1; i >= 0; i -= 1) {
15 var width = colWidths[i];
16 var column = columns && columns[i];
17 var additionalProps = column && column[INTERNAL_COL_DEFINE];
18
19 if (width || additionalProps || mustInsert) {
20 cols.unshift(React.createElement("col", Object.assign({
21 key: i,
22 style: {
23 width: width,
24 minWidth: width
25 }
26 }, additionalProps)));
27 mustInsert = true;
28 }
29 }
30
31 return React.createElement("colgroup", null, cols);
32}
33
34export default ColGroup;
\No newline at end of file