UNPKG

acud

Version:

acg react 组件库

40 lines • 1.55 kB
import _extends from "@babel/runtime/helpers/esm/extends"; var __rest = this && this.__rest || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; import * as React from 'react'; import { INTERNAL_COL_DEFINE } from './utils/legacyUtil'; function ColGroup(_ref) { var colWidths = _ref.colWidths, columns = _ref.columns, columCount = _ref.columCount; var cols = []; var len = columCount || columns.length; // Only insert col with width & additional props // Skip if rest col do not have any useful info var mustInsert = false; for (var i = len - 1; i >= 0; i -= 1) { var width = colWidths[i]; var column = columns && columns[i]; var additionalProps = column && column[INTERNAL_COL_DEFINE]; if (width || additionalProps || mustInsert) { var _a = additionalProps || {}, columnType = _a.columnType, restAdditionalProps = __rest(_a, ["columnType"]); cols.unshift(/*#__PURE__*/React.createElement("col", _extends({ key: i, style: { width: width } }, restAdditionalProps))); mustInsert = true; } } return /*#__PURE__*/React.createElement("colgroup", null, cols); } export default ColGroup;