uiw 5.0.0-bate-7 → 5.0.0-bate-8
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 +87 -5
- package/dist/uiw.min.js +1 -1
- package/package.json +60 -60
package/dist/uiw.js
CHANGED
|
@@ -16869,6 +16869,72 @@ function locationFixed(fixed, location, index) {
|
|
|
16869
16869
|
};
|
|
16870
16870
|
}
|
|
16871
16871
|
|
|
16872
|
+
// 通过树获取子节点个数
|
|
16873
|
+
// 记录顶层父级
|
|
16874
|
+
// 通过顶层父级进行获取展开的 key
|
|
16875
|
+
// 通过 key 进行获取个数
|
|
16876
|
+
class NodeTreeData {
|
|
16877
|
+
constructor(dataList, rowKey, childName) {
|
|
16878
|
+
this.parentToChild = new Map([]);
|
|
16879
|
+
this.childToParent = new Map([]);
|
|
16880
|
+
this.childTreeCount = new Map([]);
|
|
16881
|
+
this.rowKey = 'id';
|
|
16882
|
+
this.childName = 'children';
|
|
16883
|
+
this.rowKey = rowKey || this.rowKey;
|
|
16884
|
+
this.childName = childName || this.childName;
|
|
16885
|
+
this.init(dataList);
|
|
16886
|
+
}
|
|
16887
|
+
/**把根据父级 key 存储对应下所有子集的个数*/
|
|
16888
|
+
init(dataList, parentList) {
|
|
16889
|
+
if (parentList === void 0) {
|
|
16890
|
+
parentList = [];
|
|
16891
|
+
}
|
|
16892
|
+
dataList.forEach(item => {
|
|
16893
|
+
if (Array.isArray(item[this.childName])) {
|
|
16894
|
+
var newParent = parentList.concat([item[this.rowKey]]);
|
|
16895
|
+
var parentKey = newParent[0];
|
|
16896
|
+
this.childToParent.set(item[this.rowKey], parentKey);
|
|
16897
|
+
this.parentToChild.set(parentKey, newParent);
|
|
16898
|
+
this.childTreeCount.set(item[this.rowKey], item[this.childName].length);
|
|
16899
|
+
this.init(item[this.childName], newParent);
|
|
16900
|
+
}
|
|
16901
|
+
});
|
|
16902
|
+
}
|
|
16903
|
+
/**获取合并行数*/
|
|
16904
|
+
getSum(key, expandedKeys) {
|
|
16905
|
+
var _this = this;
|
|
16906
|
+
var parentKey = this.childToParent.get(key) || '';
|
|
16907
|
+
var childList = this.parentToChild.get(parentKey) || [];
|
|
16908
|
+
var summary = {};
|
|
16909
|
+
var lg = childList.length;
|
|
16910
|
+
for (var index = 0; index < lg; index++) {
|
|
16911
|
+
var childKey = childList[index];
|
|
16912
|
+
if (expandedKeys.includes(childKey)) {
|
|
16913
|
+
(function () {
|
|
16914
|
+
summary[childKey] = 1;
|
|
16915
|
+
var count = _this.childTreeCount.get(childKey || '') || 0;
|
|
16916
|
+
Object.entries(summary).forEach(_ref => {
|
|
16917
|
+
var [k, value] = _ref;
|
|
16918
|
+
/**计算合并行个数*/
|
|
16919
|
+
summary[k] = value + count;
|
|
16920
|
+
});
|
|
16921
|
+
})();
|
|
16922
|
+
} else {
|
|
16923
|
+
break;
|
|
16924
|
+
}
|
|
16925
|
+
}
|
|
16926
|
+
return summary;
|
|
16927
|
+
}
|
|
16928
|
+
}
|
|
16929
|
+
var getRowSpan = (rowSpan, leve, index) => {
|
|
16930
|
+
var show = leve < index + 1;
|
|
16931
|
+
var newRowSpan = leve === index ? rowSpan : undefined;
|
|
16932
|
+
return {
|
|
16933
|
+
show,
|
|
16934
|
+
rowSpan: newRowSpan
|
|
16935
|
+
};
|
|
16936
|
+
};
|
|
16937
|
+
|
|
16872
16938
|
;// CONCATENATED MODULE: ../react-table/esm/ThComponent.js
|
|
16873
16939
|
|
|
16874
16940
|
|
|
@@ -17041,7 +17107,9 @@ function TableTr(props) {
|
|
|
17041
17107
|
childrenColumnName,
|
|
17042
17108
|
locationWidth,
|
|
17043
17109
|
header,
|
|
17044
|
-
isAutoExpanded = true
|
|
17110
|
+
isAutoExpanded = true,
|
|
17111
|
+
treeData,
|
|
17112
|
+
isAutoMergeRowSpan
|
|
17045
17113
|
} = props;
|
|
17046
17114
|
var [isOpacity, setIsOpacity] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
|
|
17047
17115
|
var [childrenIndex, setChildrenIndex] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0);
|
|
@@ -17083,14 +17151,22 @@ function TableTr(props) {
|
|
|
17083
17151
|
return /*#__PURE__*/(0,jsx_runtime.jsx)((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, {
|
|
17084
17152
|
children: data.map((trData, rowNum) => {
|
|
17085
17153
|
var key = rowKey ? trData[rowKey] : rowNum;
|
|
17154
|
+
var summary = treeData == null ? void 0 : treeData.getSum(key, expandIndex);
|
|
17086
17155
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, {
|
|
17087
17156
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("tr", {
|
|
17088
17157
|
children: keys.map((keyName, colNum) => {
|
|
17158
|
+
var itemShow = {};
|
|
17159
|
+
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, {});
|
|
17163
|
+
}
|
|
17164
|
+
}
|
|
17089
17165
|
var objs = {
|
|
17090
17166
|
children: trData[keyName.key]
|
|
17091
17167
|
};
|
|
17092
17168
|
if (render[keyName.key]) {
|
|
17093
|
-
var child = render[keyName.key](trData[keyName.key], keyName.key, trData, rowNum, colNum);
|
|
17169
|
+
var child = render[keyName.key](trData[keyName.key], keyName.key, trData, rowNum, colNum, itemShow.rowSpan);
|
|
17094
17170
|
if ( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().isValidElement(child)) {
|
|
17095
17171
|
objs.children = child;
|
|
17096
17172
|
} else {
|
|
@@ -17104,6 +17180,8 @@ function TableTr(props) {
|
|
|
17104
17180
|
objs.children = child.children;
|
|
17105
17181
|
}
|
|
17106
17182
|
}
|
|
17183
|
+
} else if (itemShow.rowSpan && isAutoMergeRowSpan) {
|
|
17184
|
+
objs.rowSpan = itemShow.rowSpan;
|
|
17107
17185
|
}
|
|
17108
17186
|
var isHasChildren = Array.isArray(trData[childrenColumnName]);
|
|
17109
17187
|
var isExpanded = false;
|
|
@@ -17162,7 +17240,7 @@ function TableTr(props) {
|
|
|
17162
17240
|
;// CONCATENATED MODULE: ../react-table/esm/index.js
|
|
17163
17241
|
|
|
17164
17242
|
|
|
17165
|
-
var react_table_esm_excluded = ["prefixCls", "className", "columns", "data", "title", "footer", "bordered", "onCell", "onCellHead", "empty", "children", "expandable", "rowKey", "scroll"];
|
|
17243
|
+
var react_table_esm_excluded = ["prefixCls", "className", "columns", "data", "title", "footer", "bordered", "onCell", "onCellHead", "empty", "children", "expandable", "rowKey", "scroll", "isAutoMergeRowSpan"];
|
|
17166
17244
|
|
|
17167
17245
|
|
|
17168
17246
|
|
|
@@ -17195,7 +17273,8 @@ function esm_Table(props) {
|
|
|
17195
17273
|
empty,
|
|
17196
17274
|
expandable,
|
|
17197
17275
|
rowKey,
|
|
17198
|
-
scroll
|
|
17276
|
+
scroll,
|
|
17277
|
+
isAutoMergeRowSpan = false
|
|
17199
17278
|
} = props,
|
|
17200
17279
|
other = _objectWithoutPropertiesLoose(props, react_table_esm_excluded);
|
|
17201
17280
|
var [expandIndex, setExpandIndex] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]);
|
|
@@ -17385,6 +17464,7 @@ function esm_Table(props) {
|
|
|
17385
17464
|
render,
|
|
17386
17465
|
ellipsis
|
|
17387
17466
|
} = 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]);
|
|
17388
17468
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, {
|
|
17389
17469
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(TableStyleWrap, extends_extends({
|
|
17390
17470
|
className: cls
|
|
@@ -17419,7 +17499,9 @@ function esm_Table(props) {
|
|
|
17419
17499
|
isExpandedDom: isExpandedDom,
|
|
17420
17500
|
indentSize: typeof (expandable == null ? void 0 : expandable.indentSize) === 'number' ? expandable == null ? void 0 : expandable.indentSize : 16,
|
|
17421
17501
|
childrenColumnName: (expandable == null ? void 0 : expandable.childrenColumnName) || 'children',
|
|
17422
|
-
isAutoExpanded: expandable == null ? void 0 : expandable.isAutoExpanded
|
|
17502
|
+
isAutoExpanded: expandable == null ? void 0 : expandable.isAutoExpanded,
|
|
17503
|
+
treeData: treeData,
|
|
17504
|
+
isAutoMergeRowSpan: isAutoMergeRowSpan
|
|
17423
17505
|
})
|
|
17424
17506
|
}), data && data.length === 0 && empty && /*#__PURE__*/(0,jsx_runtime.jsx)("tbody", {
|
|
17425
17507
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("tr", {
|