choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
35 lines (32 loc) • 1.15 kB
JavaScript
import React, { useContext } from 'react';
import TableContext from './TableContext';
export default function ColGroup(props) {
var table = useContext(TableContext);
var _table$props = table.props,
prefixCls = _table$props.prefixCls,
expandIconAsCell = _table$props.expandIconAsCell;
var fixed = props.fixed;
var expandCol = expandIconAsCell && fixed !== 'right' ? /*#__PURE__*/React.createElement("col", {
className: "".concat(prefixCls, "-expand-icon-col"),
key: "rc-table-expand-icon-col"
}) : null;
var leafColumns;
if (fixed === 'left') {
leafColumns = table.columnManager.leftLeafColumns();
} else if (fixed === 'right') {
leafColumns = table.columnManager.rightLeafColumns();
} else {
leafColumns = table.columnManager.leafColumns();
}
var cols = leafColumns.map(function (c) {
return /*#__PURE__*/React.createElement("col", {
key: c.key || c.dataIndex,
style: {
width: c.width,
minWidth: c.minWidth || c.width
}
});
});
return /*#__PURE__*/React.createElement("colgroup", null, expandCol, cols);
}
//# sourceMappingURL=ColGroup.js.map