preact-arco-design
Version:
Arco Design React UI Library.
37 lines (32 loc) • 1.03 kB
JavaScript
import React from "preact/compat";
import { INTERNAL_EXPAND_KEY, INTERNAL_SELECTION_KEY } from "./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.createElement("colgroup", null, columns.map(function (col, index) {
if (col.title === INTERNAL_EXPAND_KEY) {
return React.createElement("col", {
key: INTERNAL_EXPAND_KEY,
className: "".concat(prefixCls, "-expand-icon-col"),
style: fixedWidth(col.width)
});
}
if (col.title === INTERNAL_SELECTION_KEY) {
return React.createElement("col", {
key: INTERNAL_SELECTION_KEY,
className: "".concat(prefixCls, "-selection-col"),
style: fixedWidth(col.width)
});
}
return React.createElement("col", {
key: col.key || index,
style: fixedWidth(col.width)
});
}));
}
export default ColGroup;