@kdcloudjs/table 1.2.2-canary.12 → 1.2.2-canary.12-hotfix.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * @kdcloudjs/table v1.2.2-canary.11
3
+ * @kdcloudjs/table v1.2.2-canary.12
4
4
  *
5
5
  * Copyright 2020-present, Kingdee, Inc.
6
6
  * All rights reserved.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * @kdcloudjs/table v1.2.2-canary.11
3
+ * @kdcloudjs/table v1.2.2-canary.12
4
4
  *
5
5
  * Copyright 2020-present, Kingdee, Inc.
6
6
  * All rights reserved.
@@ -1505,12 +1505,12 @@ function calculateLeveledAndFlat(inputNested, rowCount) {
1505
1505
  leveled.push([]);
1506
1506
  }
1507
1507
  var flat = [];
1508
- dfs(inputNested, 0);
1508
+ dfs(inputNested, 0, false);
1509
1509
  return {
1510
1510
  flat: flat,
1511
1511
  leveled: leveled
1512
1512
  };
1513
- function dfs(input, depth) {
1513
+ function dfs(input, depth, suppressLeveled) {
1514
1514
  var leafCount = 0;
1515
1515
  for (var i = 0; i < input.length; i++) {
1516
1516
  var indexedCol = input[i];
@@ -1524,12 +1524,16 @@ function calculateLeveledAndFlat(inputNested, rowCount) {
1524
1524
  colSpan: 1,
1525
1525
  isLeaf: true
1526
1526
  };
1527
- leveled[depth].push(wrapped);
1527
+ if (!suppressLeveled) {
1528
+ leveled[depth].push(wrapped);
1529
+ }
1528
1530
  flat.push(wrapped);
1529
1531
  } else {
1530
- var dfsRes = dfs(indexedCol.children, depth + 1);
1532
+ var _indexedCol$col;
1533
+ var mergeHeader = Boolean((_indexedCol$col = indexedCol.col) === null || _indexedCol$col === void 0 ? void 0 : _indexedCol$col.isHeaderMerge);
1534
+ var dfsRes = dfs(indexedCol.children, depth + 1, suppressLeveled || mergeHeader);
1531
1535
  leafCount += dfsRes.leafCount;
1532
- if (dfsRes.leafCount > 0) {
1536
+ if (dfsRes.leafCount > 0 && !suppressLeveled) {
1533
1537
  leveled[depth].push({
1534
1538
  type: 'normal',
1535
1539
  width: indexedCol.col.width,
@@ -1674,9 +1678,9 @@ function TableHeader(_ref2) {
1674
1678
  var cell = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_24___default.a.createElement("th", _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_15___default()({
1675
1679
  key: colIndex
1676
1680
  }, headerCellProps, {
1677
- className: classnames__WEBPACK_IMPORTED_MODULE_23___default()(_styles__WEBPACK_IMPORTED_MODULE_26__["Classes"].tableHeaderCell, headerCellProps.className, (_cx = {}, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_16___default()(_cx, _styles__WEBPACK_IMPORTED_MODULE_26__["Classes"].first, colIndex === 0), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_16___default()(_cx, _styles__WEBPACK_IMPORTED_MODULE_26__["Classes"].last, colIndex + colSpan === fullFlatCount), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_16___default()(_cx, _styles__WEBPACK_IMPORTED_MODULE_26__["Classes"].lockLeft, colIndex < leftFlatCount || theaderPosition === 'left'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_16___default()(_cx, _styles__WEBPACK_IMPORTED_MODULE_26__["Classes"].lockRight, colIndex >= fullFlatCount - rightFlatCount || theaderPosition === 'right'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_16___default()(_cx, _styles__WEBPACK_IMPORTED_MODULE_26__["Classes"].leaf, wrapped.isLeaf), _cx)),
1681
+ className: classnames__WEBPACK_IMPORTED_MODULE_23___default()(_styles__WEBPACK_IMPORTED_MODULE_26__["Classes"].tableHeaderCell, headerCellProps.className, (_cx = {}, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_16___default()(_cx, _styles__WEBPACK_IMPORTED_MODULE_26__["Classes"].first, colIndex === 0), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_16___default()(_cx, _styles__WEBPACK_IMPORTED_MODULE_26__["Classes"].last, colIndex + colSpan === fullFlatCount), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_16___default()(_cx, _styles__WEBPACK_IMPORTED_MODULE_26__["Classes"].lockLeft, colIndex < leftFlatCount || theaderPosition === 'left'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_16___default()(_cx, _styles__WEBPACK_IMPORTED_MODULE_26__["Classes"].lockRight, colIndex >= fullFlatCount - rightFlatCount || theaderPosition === 'right'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_16___default()(_cx, _styles__WEBPACK_IMPORTED_MODULE_26__["Classes"].leaf, wrapped.isLeaf || col.isHeaderMerge), _cx)),
1678
1682
  colSpan: colSpan,
1679
- rowSpan: isLeaf ? rowCount - level : undefined,
1683
+ rowSpan: isLeaf || col.isHeaderMerge ? rowCount - level : undefined,
1680
1684
  style: _objectSpread(_objectSpread({
1681
1685
  textAlign: col.align,
1682
1686
  verticalAlign: (_col$verticalAlign = col.verticalAlign) !== null && _col$verticalAlign !== void 0 ? _col$verticalAlign : 'middle'
@@ -14216,7 +14220,9 @@ function getTreeDepth(nodes) {
14216
14220
  try {
14217
14221
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
14218
14222
  var column = _step.value;
14219
- if (Object(_isLeafNode__WEBPACK_IMPORTED_MODULE_11__["default"])(column)) {
14223
+ var isHeaderMerge = (column === null || column === void 0 ? void 0 : column.isHeaderMerge) === true;
14224
+ // 当列配置了 isHeaderMerge 时,将其视作“可视叶子”,不再深入子层计算深度
14225
+ if (Object(_isLeafNode__WEBPACK_IMPORTED_MODULE_11__["default"])(column) || isHeaderMerge) {
14220
14226
  maxDepth = Math.max(maxDepth, depth);
14221
14227
  } else {
14222
14228
  dfs(column.children, depth + 1);