ColGroup.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  3. Object.defineProperty(exports, "__esModule", {
  4. value: true
  5. });
  6. exports.default = void 0;
  7. var _vue = require("vue");
  8. var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
  9. var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
  10. var _legacyUtil = require("./utils/legacyUtil");
  11. var _excluded = ["columnType"];
  12. function ColGroup(_ref) {
  13. var colWidths = _ref.colWidths,
  14. columns = _ref.columns,
  15. columCount = _ref.columCount;
  16. var cols = [];
  17. var len = columCount || columns.length;
  18. // Only insert col with width & additional props
  19. // Skip if rest col do not have any useful info
  20. var mustInsert = false;
  21. for (var i = len - 1; i >= 0; i -= 1) {
  22. var width = colWidths[i];
  23. var column = columns && columns[i];
  24. var additionalProps = column && column[_legacyUtil.INTERNAL_COL_DEFINE];
  25. if (width || additionalProps || mustInsert) {
  26. var _ref2 = additionalProps || {},
  27. columnType = _ref2.columnType,
  28. restAdditionalProps = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
  29. cols.unshift((0, _vue.createVNode)("col", (0, _objectSpread2.default)({
  30. "key": i,
  31. "style": {
  32. width: typeof width === 'number' ? "".concat(width, "px") : width
  33. }
  34. }, restAdditionalProps), null));
  35. mustInsert = true;
  36. }
  37. }
  38. return (0, _vue.createVNode)("colgroup", null, [cols]);
  39. }
  40. var _default = ColGroup;
  41. exports.default = _default;