@bee-design/ui
Version:
Bee Design React UI Library.
28 lines (27 loc) • 1.32 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importDefault(require("react"));
var constant_1 = require("./constant");
function fixedWidth(width) {
return typeof width === 'number' || typeof width === 'string'
? {
width: width,
}
: {};
}
function ColGroup(props) {
var prefixCls = props.prefixCls, columns = props.columns;
return (react_1.default.createElement("colgroup", null, columns.map(function (col, index) {
if (col.title === constant_1.INTERNAL_EXPAND_KEY) {
return (react_1.default.createElement("col", { key: constant_1.INTERNAL_EXPAND_KEY, className: prefixCls + "-expand-icon-col", style: fixedWidth(col.width) }));
}
if (col.title === constant_1.INTERNAL_SELECTION_KEY) {
return (react_1.default.createElement("col", { key: constant_1.INTERNAL_SELECTION_KEY, className: prefixCls + "-selection-col", style: fixedWidth(col.width) }));
}
return react_1.default.createElement("col", { key: col.key || index, style: fixedWidth(col.width) });
})));
}
exports.default = ColGroup;