uiw 5.0.0-bate-8 → 5.0.0-bate-10

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.
package/dist/uiw.js CHANGED
@@ -16906,24 +16906,35 @@ class NodeTreeData {
16906
16906
  var parentKey = this.childToParent.get(key) || '';
16907
16907
  var childList = this.parentToChild.get(parentKey) || [];
16908
16908
  var summary = {};
16909
+ var summaryCount = {};
16909
16910
  var lg = childList.length;
16910
16911
  for (var index = 0; index < lg; index++) {
16911
16912
  var childKey = childList[index];
16912
16913
  if (expandedKeys.includes(childKey)) {
16913
16914
  (function () {
16914
- summary[childKey] = 1;
16915
+ summary[childKey] = {
16916
+ count: 1,
16917
+ level: index
16918
+ };
16915
16919
  var count = _this.childTreeCount.get(childKey || '') || 0;
16916
16920
  Object.entries(summary).forEach(_ref => {
16917
16921
  var [k, value] = _ref;
16918
16922
  /**计算合并行个数*/
16919
- summary[k] = value + count;
16923
+ summary[k] = {
16924
+ count: value.count + count,
16925
+ level: value.level
16926
+ };
16927
+ summaryCount[value.level] = value.count + count;
16920
16928
  });
16921
16929
  })();
16922
16930
  } else {
16923
16931
  break;
16924
16932
  }
16925
16933
  }
16926
- return summary;
16934
+ return {
16935
+ summary,
16936
+ summaryCount
16937
+ };
16927
16938
  }
16928
16939
  }
16929
16940
  var getRowSpan = (rowSpan, leve, index) => {
@@ -17109,11 +17120,13 @@ function TableTr(props) {
17109
17120
  header,
17110
17121
  isAutoExpanded = true,
17111
17122
  treeData,
17112
- isAutoMergeRowSpan
17123
+ isAutoMergeRowSpan,
17124
+ expandIndex,
17125
+ setExpandIndex
17113
17126
  } = props;
17114
17127
  var [isOpacity, setIsOpacity] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
17115
17128
  var [childrenIndex, setChildrenIndex] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0);
17116
- var [expandIndex, setExpandIndex] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]);
17129
+ // const [expandIndex, setExpandIndex] = useState<Array<T[keyof T] | number>>([]);
17117
17130
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
17118
17131
  setIsOpacity(!!(data != null && data.find(it => it[childrenColumnName])));
17119
17132
  setChildrenIndex((keys == null ? void 0 : keys.findIndex(it => it.key === 'uiw-expanded')) === -1 ? 0 : 1);
@@ -17151,22 +17164,30 @@ function TableTr(props) {
17151
17164
  return /*#__PURE__*/(0,jsx_runtime.jsx)((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, {
17152
17165
  children: data.map((trData, rowNum) => {
17153
17166
  var key = rowKey ? trData[rowKey] : rowNum;
17154
- var summary = treeData == null ? void 0 : treeData.getSum(key, expandIndex);
17167
+ var summary = treeData == null ? void 0 : treeData.getSum(key, expandIndex || []);
17155
17168
  return /*#__PURE__*/(0,jsx_runtime.jsxs)((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, {
17156
17169
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)("tr", {
17157
17170
  children: keys.map((keyName, colNum) => {
17171
+ var isHasChildren = Array.isArray(trData[childrenColumnName]);
17158
17172
  var itemShow = {};
17159
17173
  if (isAutoMergeRowSpan && summary) {
17160
- itemShow = getRowSpan(summary[key], hierarchy, colNum);
17161
- if (!itemShow.show) {
17162
- return /*#__PURE__*/(0,jsx_runtime.jsx)(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {});
17174
+ var newLaval = Reflect.get(keyName, 'level');
17175
+ var summaryCount = summary.summaryCount[newLaval];
17176
+ if (hierarchy === newLaval && isHasChildren) {
17177
+ itemShow.rowSpan = summaryCount;
17178
+ } else if (hierarchy && Reflect.has(keyName, 'level') && hierarchy > newLaval) {
17179
+ return /*#__PURE__*/(0,jsx_runtime.jsx)(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {}, colNum);
17163
17180
  }
17164
17181
  }
17165
17182
  var objs = {
17166
17183
  children: trData[keyName.key]
17167
17184
  };
17168
17185
  if (render[keyName.key]) {
17169
- var child = render[keyName.key](trData[keyName.key], keyName.key, trData, rowNum, colNum, itemShow.rowSpan);
17186
+ var child = render[keyName.key](trData[keyName.key], keyName.key, trData, rowNum, colNum, {
17187
+ level: hierarchy,
17188
+ rowSpan: itemShow.rowSpan,
17189
+ summary
17190
+ });
17170
17191
  if ( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().isValidElement(child)) {
17171
17192
  objs.children = child;
17172
17193
  } else {
@@ -17183,7 +17204,6 @@ function TableTr(props) {
17183
17204
  } else if (itemShow.rowSpan && isAutoMergeRowSpan) {
17184
17205
  objs.rowSpan = itemShow.rowSpan;
17185
17206
  }
17186
- var isHasChildren = Array.isArray(trData[childrenColumnName]);
17187
17207
  var isExpanded = false;
17188
17208
  if ((isOpacity || hierarchy || isHasChildren) && colNum === childrenIndex && isAutoExpanded) {
17189
17209
  isExpanded = true;
@@ -17464,7 +17484,7 @@ function esm_Table(props) {
17464
17484
  render,
17465
17485
  ellipsis
17466
17486
  } = getLevelItems(self.selfColumns);
17467
- var treeData = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => isAutoMergeRowSpan && new NodeTreeData(data, rowKey, (expandable == null ? void 0 : expandable.childrenColumnName) || 'children') || undefined, [data, rowKey, expandable == null ? void 0 : expandable.childrenColumnName, isAutoMergeRowSpan]);
17487
+ var treeData = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => new NodeTreeData(data, rowKey, (expandable == null ? void 0 : expandable.childrenColumnName) || 'children'), [data, rowKey, expandable == null ? void 0 : expandable.childrenColumnName, isAutoMergeRowSpan]);
17468
17488
  return /*#__PURE__*/(0,jsx_runtime.jsxs)((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, {
17469
17489
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)(TableStyleWrap, extends_extends({
17470
17490
  className: cls
@@ -17501,7 +17521,9 @@ function esm_Table(props) {
17501
17521
  childrenColumnName: (expandable == null ? void 0 : expandable.childrenColumnName) || 'children',
17502
17522
  isAutoExpanded: expandable == null ? void 0 : expandable.isAutoExpanded,
17503
17523
  treeData: treeData,
17504
- isAutoMergeRowSpan: isAutoMergeRowSpan
17524
+ isAutoMergeRowSpan: isAutoMergeRowSpan,
17525
+ expandIndex: expandIndex,
17526
+ setExpandIndex: setExpandIndex
17505
17527
  })
17506
17528
  }), data && data.length === 0 && empty && /*#__PURE__*/(0,jsx_runtime.jsx)("tbody", {
17507
17529
  children: /*#__PURE__*/(0,jsx_runtime.jsx)("tr", {