1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4 |
|
5 | Object.defineProperty(exports, "__esModule", {
|
6 | value: true
|
7 | });
|
8 | exports["default"] = ColGroup;
|
9 |
|
10 | var _react = _interopRequireDefault(require("react"));
|
11 |
|
12 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
13 |
|
14 | function ColGroup(props, _ref) {
|
15 | var table = _ref.table;
|
16 | var _table$props = table.props,
|
17 | prefixCls = _table$props.prefixCls,
|
18 | expandIconAsCell = _table$props.expandIconAsCell;
|
19 | var fixed = props.fixed;
|
20 | var cols = [];
|
21 |
|
22 | if (expandIconAsCell && fixed !== 'right') {
|
23 | cols.push(_react["default"].createElement("col", {
|
24 | className: "".concat(prefixCls, "-expand-icon-col"),
|
25 | key: "rc-table-expand-icon-col"
|
26 | }));
|
27 | }
|
28 |
|
29 | var leafColumns;
|
30 |
|
31 | if (fixed === 'left') {
|
32 | leafColumns = table.columnManager.leftLeafColumns();
|
33 | } else if (fixed === 'right') {
|
34 | leafColumns = table.columnManager.rightLeafColumns();
|
35 | } else {
|
36 | leafColumns = table.columnManager.leafColumns();
|
37 | }
|
38 |
|
39 | cols = cols.concat(leafColumns.map(function (c) {
|
40 | return _react["default"].createElement("col", {
|
41 | key: c.key || c.dataIndex,
|
42 | style: {
|
43 | width: c.width,
|
44 | minWidth: c.width
|
45 | }
|
46 | });
|
47 | }));
|
48 | return _react["default"].createElement("colgroup", null, cols);
|
49 | }
|
50 |
|
51 | ColGroup.propTypes = {
|
52 | fixed: _propTypes["default"].string
|
53 | };
|
54 | ColGroup.contextTypes = {
|
55 | table: _propTypes["default"].any
|
56 | };
|
57 |
|