UNPKG

2.43 kBJavaScriptView Raw
1"use strict";
2
3function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
5Object.defineProperty(exports, "__esModule", {
6 value: true
7});
8exports.default = void 0;
9
10var React = _interopRequireWildcard(require("react"));
11
12var _legacyUtil = require("./utils/legacyUtil");
13
14function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
15
16function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
18function ColGroup(_ref) {
19 var colWidths = _ref.colWidths,
20 columns = _ref.columns,
21 columCount = _ref.columCount;
22 var cols = [];
23 var len = columCount || columns.length; // Only insert col with width & additional props
24 // Skip if rest col do not have any useful info
25
26 var mustInsert = false;
27
28 for (var i = len - 1; i >= 0; i -= 1) {
29 var width = colWidths[i];
30 var column = columns && columns[i];
31 var additionalProps = column && column[_legacyUtil.INTERNAL_COL_DEFINE];
32
33 if (width || additionalProps || mustInsert) {
34 cols.unshift(React.createElement("col", Object.assign({
35 key: i,
36 style: {
37 width: width,
38 minWidth: width
39 }
40 }, additionalProps)));
41 mustInsert = true;
42 }
43 }
44
45 return React.createElement("colgroup", null, cols);
46}
47
48var _default = ColGroup;
49exports.default = _default;
\No newline at end of file