@hi-ui/table 4.1.1-beta.0 → 4.1.2
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/CHANGELOG.md +18 -2
- package/lib/cjs/BaseTable.js +0 -4
- package/lib/cjs/TableBody.js +18 -25
- package/lib/cjs/TableHeader.js +0 -4
- package/lib/cjs/TableRow.js +0 -4
- package/lib/cjs/hooks/use-col-width.js +18 -17
- package/lib/cjs/hooks/use-expand.js +8 -1
- package/lib/cjs/styles/index.scss.js +1 -1
- package/lib/cjs/use-table.js +30 -22
- package/lib/esm/BaseTable.js +0 -4
- package/lib/esm/TableBody.js +18 -25
- package/lib/esm/TableHeader.js +0 -4
- package/lib/esm/TableRow.js +0 -4
- package/lib/esm/hooks/use-col-width.js +18 -17
- package/lib/esm/hooks/use-expand.js +8 -1
- package/lib/esm/styles/index.scss.js +1 -1
- package/lib/esm/use-table.js +31 -23
- package/lib/types/BaseTable.d.ts +0 -3
- package/lib/types/TableBody.d.ts +0 -3
- package/lib/types/TableHeader.d.ts +0 -3
- package/lib/types/TableRow.d.ts +0 -3
- package/lib/types/context.d.ts +4 -4
- package/lib/types/hooks/use-col-width.d.ts +1 -2
- package/lib/types/types.d.ts +4 -1
- package/lib/types/use-table.d.ts +5 -5
- package/package.json +5 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
# @hi-ui/table
|
|
2
2
|
|
|
3
|
-
## 4.1.
|
|
3
|
+
## 4.1.2
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- [#2572](https://github.com/XiaoMi/hiui/pull/2572) [`eee5e6d16`](https://github.com/XiaoMi/hiui/commit/eee5e6d1658685a6119b5aa40038c572145b3b4e) Thanks [@zyprepare](https://github.com/zyprepare)! - perf: 表格性能优化
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`937052db3`](https://github.com/XiaoMi/hiui/commit/937052db36ecfa50fef53df13d159bee0d08fa41), [`ccb1eec12`](https://github.com/XiaoMi/hiui/commit/ccb1eec122a33466536b365d443f175d1e16dc86), [`eee5e6d16`](https://github.com/XiaoMi/hiui/commit/eee5e6d1658685a6119b5aa40038c572145b3b4e)]:
|
|
10
|
+
- @hi-ui/icons@4.0.14
|
|
11
|
+
- @hi-ui/popper@4.1.0
|
|
12
|
+
- @hi-ui/tree-utils@4.1.1
|
|
13
|
+
|
|
14
|
+
## 4.1.1
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [#2557](https://github.com/XiaoMi/hiui/pull/2557) [`ef7aae038`](https://github.com/XiaoMi/hiui/commit/ef7aae038362d3a7700611737c474c29d1ba07b4) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: maxHeight 支持表达式
|
|
19
|
+
|
|
20
|
+
- [#2558](https://github.com/XiaoMi/hiui/pull/2558) [`bdd913d71`](https://github.com/XiaoMi/hiui/commit/bdd913d7173de64952437014ab9ffd1947ed506c) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: 增加树形结构排序
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [[`bdd913d71`](https://github.com/XiaoMi/hiui/commit/bdd913d7173de64952437014ab9ffd1947ed506c)]:
|
|
23
|
+
- @hi-ui/tree-utils@4.1.0
|
|
8
24
|
|
|
9
25
|
## 4.1.0
|
|
10
26
|
|
package/lib/cjs/BaseTable.js
CHANGED
|
@@ -60,10 +60,6 @@ var _prefix = classname.getPrefixCls('table');
|
|
|
60
60
|
var EMBED_DATA_KEY = "TABLE_EMBED_DATA_KEY_" + index.uuid();
|
|
61
61
|
var DEFAULT_COLUMNS = [];
|
|
62
62
|
var DEFAULT_DATA = [];
|
|
63
|
-
/**
|
|
64
|
-
* TODO: What is BaseTable
|
|
65
|
-
*/
|
|
66
|
-
|
|
67
63
|
var BaseTable = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
68
64
|
// ********************** 内嵌式面板 *********************** //
|
|
69
65
|
var _a$prefixCls = _a.prefixCls,
|
package/lib/cjs/TableBody.js
CHANGED
|
@@ -44,20 +44,17 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
44
44
|
var _role = 'table';
|
|
45
45
|
|
|
46
46
|
var _prefix = classname.getPrefixCls(_role);
|
|
47
|
-
/**
|
|
48
|
-
* TODO: What is TableBody
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
47
|
|
|
52
48
|
var TableBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
53
49
|
var _ref$prefixCls = _ref.prefixCls,
|
|
54
50
|
prefixCls = _ref$prefixCls === void 0 ? _prefix : _ref$prefixCls,
|
|
55
51
|
emptyContent = _ref.emptyContent;
|
|
56
52
|
|
|
53
|
+
var _a;
|
|
54
|
+
|
|
57
55
|
var _useTableContext = context.useTableContext(),
|
|
58
56
|
columns = _useTableContext.columns,
|
|
59
57
|
leafColumns = _useTableContext.leafColumns,
|
|
60
|
-
setMeasureRowElement = _useTableContext.setMeasureRowElement,
|
|
61
58
|
isExpandTreeRows = _useTableContext.isExpandTreeRows,
|
|
62
59
|
transitionData = _useTableContext.transitionData,
|
|
63
60
|
getColgroupProps = _useTableContext.getColgroupProps,
|
|
@@ -73,7 +70,8 @@ var TableBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
73
70
|
hasSumColumn = _useTableContext.hasSumColumn,
|
|
74
71
|
sumRow = _useTableContext.sumRow,
|
|
75
72
|
colWidths = _useTableContext.colWidths,
|
|
76
|
-
virtual = _useTableContext.virtual
|
|
73
|
+
virtual = _useTableContext.virtual,
|
|
74
|
+
measureRowElementRef = _useTableContext.measureRowElementRef;
|
|
77
75
|
|
|
78
76
|
var cls = classname.cx(prefixCls + "-body");
|
|
79
77
|
var getRequiredProps = useLatest.useLatestCallback(function (id) {
|
|
@@ -90,10 +88,8 @@ var TableBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
90
88
|
|
|
91
89
|
var _useState = React.useState(0),
|
|
92
90
|
scrollLeft = _useState[0],
|
|
93
|
-
setScrollLeft = _useState[1];
|
|
94
|
-
|
|
91
|
+
setScrollLeft = _useState[1];
|
|
95
92
|
|
|
96
|
-
var showVirtual = virtual && typeAssertion.isArrayNonEmpty(transitionData);
|
|
97
93
|
var rowWidth = React.useMemo(function () {
|
|
98
94
|
var tmpWidth = 0;
|
|
99
95
|
colWidths.forEach(function (width) {
|
|
@@ -108,9 +104,10 @@ var TableBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
108
104
|
onTableBodyScroll(evt);
|
|
109
105
|
}, [scrollBodyElementRef, onTableBodyScroll]);
|
|
110
106
|
|
|
111
|
-
if (
|
|
107
|
+
if (virtual) {
|
|
112
108
|
// TODO: avg和summay row的逻辑
|
|
113
|
-
var
|
|
109
|
+
var realHeight = (_a = scrollBodyElementRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().height;
|
|
110
|
+
var vMaxHeight = maxHeight ? !isNaN(Number(String(maxHeight).replace(/px/, ''))) ? Number(maxHeight) : realHeight : 300;
|
|
114
111
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
115
112
|
ref: scrollBodyElementRef,
|
|
116
113
|
className: cls,
|
|
@@ -118,15 +115,11 @@ var TableBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
118
115
|
onWheel: onTableBodyScrollMock,
|
|
119
116
|
style: {
|
|
120
117
|
maxHeight: maxHeight !== undefined ? maxHeight : undefined,
|
|
121
|
-
// maxHeight 小于 table 实际高度才出现纵向滚动条
|
|
122
|
-
overflowY: maxHeight !== undefined && bodyTableRef.current && bodyTableRef.current.clientHeight > maxHeight ? 'scroll' : undefined,
|
|
123
118
|
// 表格宽度大于div宽度才出现横向滚动条
|
|
124
119
|
overflowX: canScroll ? 'scroll' : undefined
|
|
125
120
|
}
|
|
126
121
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
127
|
-
ref:
|
|
128
|
-
setMeasureRowElement(domElement);
|
|
129
|
-
},
|
|
122
|
+
ref: measureRowElementRef,
|
|
130
123
|
style: {
|
|
131
124
|
height: 1,
|
|
132
125
|
background: 'transparent'
|
|
@@ -138,7 +131,7 @@ var TableBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
138
131
|
background: 'transparent',
|
|
139
132
|
width: rowWidth
|
|
140
133
|
}
|
|
141
|
-
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
134
|
+
}), typeAssertion.isArrayNonEmpty(transitionData) ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
142
135
|
style: {
|
|
143
136
|
width: '100%',
|
|
144
137
|
position: 'sticky',
|
|
@@ -164,7 +157,13 @@ var TableBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
164
157
|
rowData: row
|
|
165
158
|
}, getRequiredProps(row.id))));
|
|
166
159
|
}
|
|
167
|
-
}))
|
|
160
|
+
})) : renderEmptyContent(Object.assign({
|
|
161
|
+
className: prefixCls + "-empty-content",
|
|
162
|
+
colSpan: columns.length,
|
|
163
|
+
emptyContent: emptyContent
|
|
164
|
+
}, scrollBodyElementRef.current ? {
|
|
165
|
+
scrollBodyWidth: window.getComputedStyle(scrollBodyElementRef.current).getPropertyValue('width')
|
|
166
|
+
} : {})));
|
|
168
167
|
} // 外层增加 div 作为滚动容器
|
|
169
168
|
|
|
170
169
|
|
|
@@ -174,8 +173,6 @@ var TableBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
174
173
|
onScroll: onTableBodyScroll,
|
|
175
174
|
style: {
|
|
176
175
|
maxHeight: maxHeight !== undefined ? maxHeight : undefined,
|
|
177
|
-
// maxHeight 小于 table 实际高度才出现纵向滚动条
|
|
178
|
-
overflowY: maxHeight !== undefined && bodyTableRef.current && bodyTableRef.current.clientHeight > maxHeight ? 'scroll' : undefined,
|
|
179
176
|
// 表格宽度大于div宽度才出现横向滚动条
|
|
180
177
|
overflowX: canScroll ? 'scroll' : undefined
|
|
181
178
|
}
|
|
@@ -191,11 +188,7 @@ var TableBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
191
188
|
}, getColgroupProps(col, idx)));
|
|
192
189
|
})), /*#__PURE__*/React__default["default"].createElement("tbody", null, typeAssertion.isArrayNonEmpty(transitionData) ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, transitionData.map(function (row, index) {
|
|
193
190
|
return /*#__PURE__*/React__default["default"].createElement(TableRow.TableRow, Object.assign({
|
|
194
|
-
ref:
|
|
195
|
-
if (index === 0) {
|
|
196
|
-
setMeasureRowElement(dom);
|
|
197
|
-
}
|
|
198
|
-
},
|
|
191
|
+
ref: index === 0 ? measureRowElementRef : null,
|
|
199
192
|
// key={depth + index}
|
|
200
193
|
key: row.id,
|
|
201
194
|
// @ts-ignore
|
package/lib/cjs/TableHeader.js
CHANGED
|
@@ -40,10 +40,6 @@ function _interopDefaultLegacy(e) {
|
|
|
40
40
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
41
41
|
|
|
42
42
|
var _prefix = classname.getPrefixCls('table-header');
|
|
43
|
-
/**
|
|
44
|
-
* TODO: What is TableHeader
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
43
|
|
|
48
44
|
var TableHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
49
45
|
var _ref$prefixCls = _ref.prefixCls,
|
package/lib/cjs/TableRow.js
CHANGED
|
@@ -50,10 +50,6 @@ var _role = 'table';
|
|
|
50
50
|
var _prefix = classname.getPrefixCls(_role);
|
|
51
51
|
|
|
52
52
|
var EMBED_ON_ROW_PROPS = {};
|
|
53
|
-
/**
|
|
54
|
-
* TODO: What is TableRow
|
|
55
|
-
*/
|
|
56
|
-
|
|
57
53
|
var TableRow = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
58
54
|
var _ref$prefixCls = _ref.prefixCls,
|
|
59
55
|
prefixCls = _ref$prefixCls === void 0 ? _prefix : _ref$prefixCls,
|
|
@@ -32,18 +32,17 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
32
32
|
var useColWidth = function useColWidth(_ref) {
|
|
33
33
|
var columns = _ref.columns,
|
|
34
34
|
virtual = _ref.virtual;
|
|
35
|
+
var measureRowElementRef = React__default["default"].useRef(null);
|
|
35
36
|
|
|
36
|
-
var _React$useState = React__default["default"].useState(
|
|
37
|
-
measureRowElement = _React$useState[0],
|
|
38
|
-
setMeasureRowElement = _React$useState[1];
|
|
39
|
-
|
|
40
|
-
var _React$useState2 = React__default["default"].useState(function () {
|
|
37
|
+
var _React$useState = React__default["default"].useState(function () {
|
|
41
38
|
return index.getGroupItemWidth(columns);
|
|
42
39
|
}),
|
|
43
|
-
colWidths = _React$
|
|
44
|
-
setColWidths = _React$
|
|
40
|
+
colWidths = _React$useState[0],
|
|
41
|
+
setColWidths = _React$useState[1];
|
|
45
42
|
|
|
46
43
|
var getVirtualWidths = React.useCallback(function () {
|
|
44
|
+
var measureRowElement = measureRowElementRef.current;
|
|
45
|
+
|
|
47
46
|
if (!measureRowElement) {
|
|
48
47
|
return index.getGroupItemWidth(columns);
|
|
49
48
|
}
|
|
@@ -70,20 +69,23 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
70
69
|
return columnItem.width || columnDefaultWidth;
|
|
71
70
|
});
|
|
72
71
|
}
|
|
73
|
-
}, [
|
|
72
|
+
}, [columns]);
|
|
74
73
|
useUpdateEffect.useUpdateEffect(function () {
|
|
75
74
|
if (virtual) {
|
|
76
75
|
// 虚拟滚动的计算需要根据容器来做分配,不能使用没有witdh默认设置为0的方式来做表格平均分配
|
|
77
76
|
setColWidths(getVirtualWidths());
|
|
78
|
-
} else {
|
|
79
|
-
setColWidths(index.getGroupItemWidth(columns));
|
|
80
77
|
}
|
|
81
|
-
}, [
|
|
78
|
+
}, [getVirtualWidths, virtual]);
|
|
79
|
+
useUpdateEffect.useUpdateEffect(function () {
|
|
80
|
+
setColWidths(index.getGroupItemWidth(columns));
|
|
81
|
+
}, [columns]);
|
|
82
82
|
/**
|
|
83
83
|
* 根据实际内容区(table 的第一行)渲染,再次精确收集并设置每列宽度
|
|
84
84
|
*/
|
|
85
85
|
|
|
86
86
|
React__default["default"].useEffect(function () {
|
|
87
|
+
var measureRowElement = measureRowElementRef.current;
|
|
88
|
+
|
|
87
89
|
if (measureRowElement) {
|
|
88
90
|
var _resizeObserver = new ResizeObserver(function () {
|
|
89
91
|
if (virtual) {
|
|
@@ -107,11 +109,11 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
return function () {}; // 测量元素在内容列为空时会是空,切换会使测量元素变化,导致后续的resize时间无法响应,此处测量元素变化时需要重新绑定
|
|
110
|
-
}, [
|
|
112
|
+
}, [getVirtualWidths, virtual]);
|
|
111
113
|
|
|
112
|
-
var _React$
|
|
113
|
-
headerTableElement = _React$
|
|
114
|
-
setHeaderTableElement = _React$
|
|
114
|
+
var _React$useState2 = React__default["default"].useState(null),
|
|
115
|
+
headerTableElement = _React$useState2[0],
|
|
116
|
+
setHeaderTableElement = _React$useState2[1];
|
|
115
117
|
/**
|
|
116
118
|
* 控制列最小可调整宽度
|
|
117
119
|
*/
|
|
@@ -165,8 +167,7 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
165
167
|
};
|
|
166
168
|
}, [colWidths]);
|
|
167
169
|
return {
|
|
168
|
-
|
|
169
|
-
setMeasureRowElement: setMeasureRowElement,
|
|
170
|
+
measureRowElementRef: measureRowElementRef,
|
|
170
171
|
onColumnResizable: onColumnResizable,
|
|
171
172
|
getColgroupProps: getColgroupProps,
|
|
172
173
|
setHeaderTableElement: setHeaderTableElement,
|
|
@@ -66,7 +66,14 @@ var useExpand = function useExpand(flattedData, defaultExpandedIds, expandedIdsP
|
|
|
66
66
|
|
|
67
67
|
var transitionDataRef = useLatest.useLatestRef(transitionData);
|
|
68
68
|
var trySetTransitionData = React.useCallback(function (data, expandedIds) {
|
|
69
|
-
var nextData =
|
|
69
|
+
var nextData = data; // 当有 children 时,在构造新的数据,防止重复刷新组件
|
|
70
|
+
|
|
71
|
+
if (data.some(function (item) {
|
|
72
|
+
return !!item.children && item.children.length > 0;
|
|
73
|
+
})) {
|
|
74
|
+
nextData = flattenTreeDataWithExpand(data, expandedIds);
|
|
75
|
+
}
|
|
76
|
+
|
|
70
77
|
setTransitionData(nextData);
|
|
71
78
|
}, []); // 用来确保一次折叠动画是一次加锁的单元任务
|
|
72
79
|
// 防止用户频繁折叠展开导致动画渲染(存在 DOM 操作)异常
|
|
@@ -14,7 +14,7 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
14
14
|
});
|
|
15
15
|
var css_248z = ".hi-v4-table {-webkit-box-sizing: border-box;box-sizing: border-box;font-size: 14px;position: relative; }.hi-v4-table table {width: 100%;text-align: left;background-color: var(--hi-v4-color-static-white, #fff);border-radius: 2px 2px 0 0;border-spacing: 0;border-collapse: separate;display: table;table-layout: fixed; }.hi-v4-table__wrapper {position: relative;z-index: 0; }.hi-v4-table__switcher.hi-v4-icon-button {color: var(--hi-v4-color-gray-500, #929aa6); }.hi-v4-table__switcher--expanded.hi-v4-icon-button {color: var(--hi-v4-color-primary-400, var(--hi-v4-color-brandblue-400, #4a9eff)); }.hi-v4-table--size-md table tbody > tr:not(.hi-v4-table-empty-content) > td {padding: var(--hi-v4-spacing-7, 14px); }.hi-v4-table--size-md table thead > tr > th {padding: var(--hi-v4-spacing-7, 14px); }.hi-v4-table--size-sm table tbody > tr:not(.hi-v4-table-empty-content) > td {padding: var(--hi-v4-spacing-5, 10px); }.hi-v4-table--size-sm table thead > tr > th {padding: var(--hi-v4-spacing-5, 10px); }.hi-v4-table--size-lg table tbody > tr:not(.hi-v4-table-empty-content) > td {padding: var(--hi-v4-spacing-9, 18px); }.hi-v4-table--size-lg table thead > tr > th {padding: var(--hi-v4-spacing-9, 18px); }.hi-v4-table--bordered table thead > tr > th {border-right: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0); }.hi-v4-table--bordered table td {border-right: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0); }.hi-v4-table--bordered .hi-v4-table-header {border-top: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0);border-left: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0); }.hi-v4-table--bordered .hi-v4-table-body {border-left: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0); }.hi-v4-table--sticky {position: -webkit-sticky;position: sticky;top: 0; }.hi-v4-table--virtual {width: 100%;overflow: hidden; }.hi-v4-table--virtual .hi-v4-table-cell {-webkit-box-sizing: border-box;box-sizing: border-box; }.hi-v4-table-header {position: relative;-webkit-box-sizing: border-box;box-sizing: border-box;overflow: hidden; }.hi-v4-table-header__resizable {position: relative;background-clip: padding-box; }.hi-v4-table-header__resizable-handle {-webkit-box-sizing: content-box;box-sizing: content-box;position: absolute;width: 2px;height: 100%;bottom: 0;right: 0;border-left: 2px solid var(--hi-v4-color-gray-50, #f5f7fa);cursor: col-resize;z-index: 1; }.hi-v4-table-header__resizable:hover .hi-v4-table-header__resizable-handle {background-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-table-header-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-header-cell.hi-v4-table-header-cell__col--highlight, .hi-v4-table-header-cell.hi-v4-table-header-cell__col--hovered-highlight, .hi-v4-table-header-cell.hi-v4-table-header-cell__col--active {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-table-header-cell.hi-v4-table-header-cell__col--highlight[data-sticky], .hi-v4-table-header-cell.hi-v4-table-header-cell__col--hovered-highlight[data-sticky], .hi-v4-table-header-cell.hi-v4-table-header-cell__col--active[data-sticky] {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-table-row--hover:hover > .hi-v4-table-cell {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-row--striped > .hi-v4-table-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-row--expanded > .hi-v4-table-cell {color: var(--hi-v4-color-gray-800, #1f2937); }.hi-v4-table-row--error > .hi-v4-table-cell {color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }.hi-v4-table-row--highlight > .hi-v4-table-cell {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-row--dragging > .hi-v4-table-cell {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-row--drag-top > .hi-v4-table-cell {border-top: 2px dashed var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-table-row--drag-bottom > .hi-v4-table-cell {border-bottom: 2px dashed var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-table-row--avg > .hi-v4-table-cell, .hi-v4-table-row--total > .hi-v4-table-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-row--avg:hover > .hi-v4-table-cell, .hi-v4-table-row--total:hover > .hi-v4-table-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-row--virtual {display: -webkit-box;display: -ms-flexbox;display: flex; }.hi-v4-table-header .hi-v4-table-header-col, .hi-v4-table-header .hi-v4-table-col {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-body .hi-v4-table-header-col[data-hover-highlight], .hi-v4-table-body .hi-v4-table-col[data-hover-highlight] {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-header .hi-v4-table-header-col[data-hover-highlight], .hi-v4-table-header .hi-v4-table-col[data-hover-highlight] {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-table-body {position: relative;overflow: auto; }.hi-v4-table-header-cell {color: var(--hi-v4-color-gray-700, #1f2733);font-size: var(--hi-v4-text-size-md, 0.875rem);font-weight: var(--hi-v4-text-weight-medium, 500);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-8, 16px);border-bottom: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8); }.hi-v4-table-header-cell.hi-v4-table__embed-col, .hi-v4-table-header-cell.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-5, 10px); }.hi-v4-table-cell {word-break: break-word;border-bottom: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8);font-size: var(--hi-v4-text-size-md, 0.875rem);font-weight: var(--hi-v4-text-weight-normal, 400);color: var(--hi-v4-color-gray-700, #1f2733);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-8, 16px);background-color: var(--hi-v4-color-static-white, #fff); }.hi-v4-table-cell__indent {display: inline-block;width: 14px;height: 100%;margin-right: var(--hi-v4-spacing-1, 2px); }.hi-v4-table-cell__switcher.hi-v4-icon-button {margin-right: var(--hi-v4-spacing-1, 2px);color: var(--hi-v4-color-gray-500, #929aa6); }.hi-v4-table-cell.hi-v4-table__embed-col, .hi-v4-table-cell.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-5, 10px); }.hi-v4-table-cell.hi-v4-table-cell__col--highlight {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-cell.hi-v4-table-cell__col--hovered-highlight {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-freeze-shadow {position: absolute;top: 0;bottom: 0;z-index: 20;pointer-events: none;overflow: hidden;height: 100%;width: 200px; }.hi-v4-table-freeze-shadow--left {margin-right: 10px;left: 0;-webkit-box-shadow: 6px 0 6px -4px rgba(0, 0, 0, 0.15);box-shadow: 6px 0 6px -4px rgba(0, 0, 0, 0.15); }.hi-v4-table-freeze-shadow--right {margin-left: 10px;right: 0;-webkit-box-shadow: -6px 0 6px -4px rgba(0, 0, 0, 0.15);box-shadow: -6px 0 6px -4px rgba(0, 0, 0, 0.15); }.hi-v4-table-header-filter-dropdown__trigger.hi-v4-icon-button {margin-left: 4px; }.hi-v4-table-header-filter-dropdown__content {width: 124px;padding: var(--hi-v4-spacing-6, 12px) var(--hi-v4-spacing-4, 8px);font-weight: var(--hi-v4-text-weight-normal, 400); }.hi-v4-table-header-filter-dropdown__item {margin-top: var(--hi-v4-spacing-4, 8px);padding: var(--hi-v4-spacing-3, 6px) var(--hi-v4-spacing-4, 8px);border-radius: var(--hi-v4-border-radius-md, 4px);display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;-webkit-box-align: center;-ms-flex-align: center;align-items: center;cursor: pointer;color: var(--hi-v4-color-gray-700, #1f2733);font-size: var(--hi-v4-text-size-md, 0.875rem); }.hi-v4-table-header-filter-dropdown__item:first-child {margin-top: 0; }.hi-v4-table-header-filter-dropdown__item:hover {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-header-filter-dropdown__item--active {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-header-filter-dropdown__item--active:hover {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-header-filter-sorter {display: -webkit-inline-box;display: -ms-inline-flexbox;display: inline-flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;height: 20px;vertical-align: middle;margin-left: 6px; }.hi-v4-table-header-filter-sorter__icon {display: inline-block;height: 8px;cursor: pointer;overflow: hidden;font-weight: var(--hi-v4-text-weight-normal, 400);color: var(--hi-v4-color-gray-500, #929aa6); }.hi-v4-table-header-filter-sorter__icon svg {position: relative;top: -5px; }.hi-v4-table-header-filter-sorter__icon--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-table-header-filter-custom__trigger {margin-left: 6px;color: var(--hi-v4-color-gray-500, #929aa6);cursor: pointer; }.hi-v4-table-header-filter-custom__content {padding: 12px 8px; }.hi-v4-table-embed-row {position: relative;z-index: 0; }.hi-v4-table-embed-row > td {background-color: var(--hi-v4-color-gray-200, #ebedf0);padding: var(--hi-v4-spacing-10, 20px); }.hi-v4-table-setting {position: absolute;height: 100%;z-index: 11;-webkit-box-sizing: border-box;box-sizing: border-box;right: 0;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;border-left: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8);border-bottom: none;border-top: none;color: var(--hi-v4-color-gray-500, #929aa6);cursor: pointer;font-size: var(--hi-v4-text-size-sm, 0.75rem);width: 18px;background: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-setting__btn-group {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: end;-ms-flex-pack: end;justify-content: flex-end; }.hi-v4-table-setting-item {position: relative;padding-top: var(--hi-v4-spacing-1, 2px);padding-bottom: var(--hi-v4-spacing-1, 2px);-webkit-box-sizing: border-box;box-sizing: border-box; }.hi-v4-table-setting-item__wrap {-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;cursor: move;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-orient: horizontal;-webkit-box-direction: normal;-ms-flex-direction: row;flex-direction: row;padding: var(--hi-v4-spacing-3, 6px) var(--hi-v4-spacing-4, 8px);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);border-radius: var(--hi-v4-border-radius-md, 4px); }.hi-v4-table-setting-item__wrap:hover {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-setting-item--dragging .hi-v4-table-setting-item__wrap {opacity: 0.6; }.hi-v4-table-setting-item::before {position: absolute;left: 0;z-index: 9999;display: none;-webkit-box-sizing: border-box;box-sizing: border-box;width: 8px;height: 8px;content: '';background-color: var(--hi-v4-color-static-white, #fff);border: 1px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));border-radius: 100%; }.hi-v4-table-setting-item::after {position: absolute;content: '';z-index: 9998;display: block;-webkit-box-sizing: border-box;box-sizing: border-box;border-bottom-width: 0;border-bottom-style: solid;border-bottom-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));left: 0;width: 100%; }.hi-v4-table-setting-item::before, .hi-v4-table-setting-item::after {margin-left: -10px;margin-right: -10px; }.hi-v4-table-setting-item--direction-before::before {display: block;top: -0.5px;-webkit-transform: translateY(-4px);transform: translateY(-4px); }.hi-v4-table-setting-item--direction-before::after {top: -0.5px;border-bottom-width: 1px; }.hi-v4-table-setting-item--direction-after::before {display: block;bottom: 0.5px;-webkit-transform: translateY(4px);transform: translateY(4px); }.hi-v4-table-setting-item--direction-after::after {bottom: 0.5px;border-bottom-width: 1px; }.hi-v4-table-pagination {display: -webkit-box;display: -ms-flexbox;display: flex;-ms-flex-wrap: wrap;flex-wrap: wrap;row-gap: 8px;padding: var(--hi-v4-spacing-6, 12px) 0;background-color: var(--hi-v4-color-static-white, #fff); }.hi-v4-table-pagination--placement-left {-webkit-box-pack: start;-ms-flex-pack: start;justify-content: flex-start; }.hi-v4-table-pagination--placement-right {-webkit-box-pack: end;-ms-flex-pack: end;justify-content: flex-end; }.hi-v4-table-pagination--placement-middle {-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center; }.hi-v4-table-empty-content td {text-align: center;padding: var(--hi-v4-spacing-12, 24px) 0; }.hi-v4-table--bordered .hi-v4-table-empty-content td {border-bottom: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8); }.hi-v4-setting-drawer .hi-v4-setting__btn-group {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: end;-ms-flex-pack: end;justify-content: flex-end; }.hi-v4-setting-item {position: relative;padding-top: var(--hi-v4-spacing-1, 2px);padding-bottom: var(--hi-v4-spacing-1, 2px);-webkit-box-sizing: border-box;box-sizing: border-box; }.hi-v4-setting-item__wrap {-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;cursor: move;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-orient: horizontal;-webkit-box-direction: normal;-ms-flex-direction: row;flex-direction: row;padding: var(--hi-v4-spacing-3, 6px) var(--hi-v4-spacing-4, 8px);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);border-radius: var(--hi-v4-border-radius-md, 4px); }.hi-v4-setting-item__wrap:hover {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-setting-item--dragging .hi-v4-setting-item__wrap {opacity: 0.6; }.hi-v4-setting-item::before {position: absolute;left: 0;z-index: 9999;display: none;-webkit-box-sizing: border-box;box-sizing: border-box;width: 8px;height: 8px;content: '';background-color: var(--hi-v4-color-static-white, #fff);border: 1px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));border-radius: 100%; }.hi-v4-setting-item::after {position: absolute;content: '';z-index: 9998;display: block;-webkit-box-sizing: border-box;box-sizing: border-box;border-bottom-width: 0;border-bottom-style: solid;border-bottom-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));left: 0;width: 100%; }.hi-v4-setting-item::before, .hi-v4-setting-item::after {margin-left: -10px;margin-right: -10px; }.hi-v4-setting-item--direction-before::before {display: block;top: -0.5px;-webkit-transform: translateY(-4px);transform: translateY(-4px); }.hi-v4-setting-item--direction-before::after {top: -0.5px;border-bottom-width: 1px; }.hi-v4-setting-item--direction-after::before {display: block;bottom: 0.5px;-webkit-transform: translateY(4px);transform: translateY(4px); }.hi-v4-setting-item--direction-after::after {bottom: 0.5px;border-bottom-width: 1px; }";
|
|
16
16
|
|
|
17
|
-
var __styleInject__ = require('inject
|
|
17
|
+
var __styleInject__ = require('style-inject')["default"];
|
|
18
18
|
|
|
19
19
|
__styleInject__(css_248z);
|
|
20
20
|
|
package/lib/cjs/use-table.js
CHANGED
|
@@ -215,7 +215,7 @@ var useTable = function useTable(_a) {
|
|
|
215
215
|
resizable: resizable,
|
|
216
216
|
virtual: virtual
|
|
217
217
|
}),
|
|
218
|
-
|
|
218
|
+
measureRowElementRef = _useColWidth.measureRowElementRef,
|
|
219
219
|
getColgroupProps = _useColWidth.getColgroupProps,
|
|
220
220
|
onColumnResizable = _useColWidth.onColumnResizable,
|
|
221
221
|
colWidths = _useColWidth.colWidths; // ************************ 列冻结 ************************ //
|
|
@@ -378,20 +378,22 @@ var useTable = function useTable(_a) {
|
|
|
378
378
|
setScrollSize = _useState2[1];
|
|
379
379
|
|
|
380
380
|
React.useEffect(function () {
|
|
381
|
-
var _a, _b, _c, _d, _e, _f;
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
381
|
+
var _a, _b, _c, _d, _e, _f;
|
|
382
|
+
|
|
383
|
+
if (leftFrozenColKeys.length > 0 || rightFrozenColKeys.length > 0) {
|
|
384
|
+
// 计算冻结列的宽度
|
|
385
|
+
// mutationObserver
|
|
386
|
+
var tableWidth = (_c = (_b = (_a = bodyTableRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect) === null || _b === void 0 ? void 0 : _b.call(_a).width) !== null && _c !== void 0 ? _c : 0;
|
|
387
|
+
var tableBodyWidth = (_f = (_e = (_d = scrollBodyElementRef.current) === null || _d === void 0 ? void 0 : _d.getBoundingClientRect) === null || _e === void 0 ? void 0 : _e.call(_d).width) !== null && _f !== void 0 ? _f : 0;
|
|
388
|
+
var scrollRight = tableWidth - tableBodyWidth; // const scrollLeft = 0
|
|
389
|
+
|
|
390
|
+
setScrollSize(function (prev) {
|
|
391
|
+
return {
|
|
392
|
+
scrollLeft: prev.scrollLeft,
|
|
393
|
+
scrollRight: scrollRight
|
|
394
|
+
};
|
|
395
|
+
});
|
|
396
|
+
}
|
|
395
397
|
}, [leftFrozenColKeys, rightFrozenColKeys]); // const canScroll = scrollSize.scrollRight > 0
|
|
396
398
|
// 实时计算
|
|
397
399
|
|
|
@@ -527,23 +529,30 @@ var useTable = function useTable(_a) {
|
|
|
527
529
|
|
|
528
530
|
|
|
529
531
|
var showData = React.useMemo(function () {
|
|
530
|
-
var
|
|
532
|
+
var _a;
|
|
533
|
+
|
|
534
|
+
var _data = [].concat(transitionData);
|
|
531
535
|
|
|
532
536
|
if (activeSorterColumn) {
|
|
533
|
-
var sorter = columns.filter(function (d) {
|
|
537
|
+
var sorter = (_a = columns.filter(function (d) {
|
|
534
538
|
return d.dataKey === activeSorterColumn;
|
|
535
|
-
})[0]
|
|
536
|
-
return d.dataKey === activeSorterColumn;
|
|
537
|
-
})[0].sorter;
|
|
539
|
+
})[0]) === null || _a === void 0 ? void 0 : _a.sorter;
|
|
538
540
|
|
|
539
541
|
if (sorter) {
|
|
540
|
-
|
|
542
|
+
activeSorterType === 'ascend' ? _data.sort(sorter) : _data.sort(sorter).reverse(); // 平铺的树形结构排序
|
|
543
|
+
|
|
544
|
+
if (_data.some(function (d) {
|
|
545
|
+
return d.depth !== 0;
|
|
546
|
+
})) {
|
|
547
|
+
_data = treeUtils.flattedTreeSort(_data);
|
|
548
|
+
}
|
|
541
549
|
}
|
|
542
550
|
}
|
|
543
551
|
|
|
544
552
|
return _data;
|
|
545
553
|
}, [activeSorterColumn, activeSorterType, transitionData, columns]);
|
|
546
554
|
return Object.assign(Object.assign({
|
|
555
|
+
measureRowElementRef: measureRowElementRef,
|
|
547
556
|
rootProps: rootProps,
|
|
548
557
|
scrollWidth: scrollWidth,
|
|
549
558
|
activeSorterColumn: activeSorterColumn,
|
|
@@ -565,7 +574,6 @@ var useTable = function useTable(_a) {
|
|
|
565
574
|
// 行多选
|
|
566
575
|
rowSelection: rowSelection,
|
|
567
576
|
cacheData: cacheData,
|
|
568
|
-
setMeasureRowElement: setMeasureRowElement,
|
|
569
577
|
leafColumns: leafColumns,
|
|
570
578
|
// ui
|
|
571
579
|
// 有表头分组那么也要 bordered
|
package/lib/esm/BaseTable.js
CHANGED
|
@@ -29,10 +29,6 @@ var _prefix = getPrefixCls('table');
|
|
|
29
29
|
var EMBED_DATA_KEY = "TABLE_EMBED_DATA_KEY_" + uuid();
|
|
30
30
|
var DEFAULT_COLUMNS = [];
|
|
31
31
|
var DEFAULT_DATA = [];
|
|
32
|
-
/**
|
|
33
|
-
* TODO: What is BaseTable
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
32
|
var BaseTable = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
37
33
|
// ********************** 内嵌式面板 *********************** //
|
|
38
34
|
var _a$prefixCls = _a.prefixCls,
|
package/lib/esm/TableBody.js
CHANGED
|
@@ -19,20 +19,17 @@ import { useTableContext } from './context.js';
|
|
|
19
19
|
var _role = 'table';
|
|
20
20
|
|
|
21
21
|
var _prefix = getPrefixCls(_role);
|
|
22
|
-
/**
|
|
23
|
-
* TODO: What is TableBody
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
22
|
|
|
27
23
|
var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
28
24
|
var _ref$prefixCls = _ref.prefixCls,
|
|
29
25
|
prefixCls = _ref$prefixCls === void 0 ? _prefix : _ref$prefixCls,
|
|
30
26
|
emptyContent = _ref.emptyContent;
|
|
31
27
|
|
|
28
|
+
var _a;
|
|
29
|
+
|
|
32
30
|
var _useTableContext = useTableContext(),
|
|
33
31
|
columns = _useTableContext.columns,
|
|
34
32
|
leafColumns = _useTableContext.leafColumns,
|
|
35
|
-
setMeasureRowElement = _useTableContext.setMeasureRowElement,
|
|
36
33
|
isExpandTreeRows = _useTableContext.isExpandTreeRows,
|
|
37
34
|
transitionData = _useTableContext.transitionData,
|
|
38
35
|
getColgroupProps = _useTableContext.getColgroupProps,
|
|
@@ -48,7 +45,8 @@ var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
48
45
|
hasSumColumn = _useTableContext.hasSumColumn,
|
|
49
46
|
sumRow = _useTableContext.sumRow,
|
|
50
47
|
colWidths = _useTableContext.colWidths,
|
|
51
|
-
virtual = _useTableContext.virtual
|
|
48
|
+
virtual = _useTableContext.virtual,
|
|
49
|
+
measureRowElementRef = _useTableContext.measureRowElementRef;
|
|
52
50
|
|
|
53
51
|
var cls = cx(prefixCls + "-body");
|
|
54
52
|
var getRequiredProps = useLatestCallback(function (id) {
|
|
@@ -65,10 +63,8 @@ var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
65
63
|
|
|
66
64
|
var _useState = useState(0),
|
|
67
65
|
scrollLeft = _useState[0],
|
|
68
|
-
setScrollLeft = _useState[1];
|
|
69
|
-
|
|
66
|
+
setScrollLeft = _useState[1];
|
|
70
67
|
|
|
71
|
-
var showVirtual = virtual && isArrayNonEmpty(transitionData);
|
|
72
68
|
var rowWidth = useMemo(function () {
|
|
73
69
|
var tmpWidth = 0;
|
|
74
70
|
colWidths.forEach(function (width) {
|
|
@@ -83,9 +79,10 @@ var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
83
79
|
onTableBodyScroll(evt);
|
|
84
80
|
}, [scrollBodyElementRef, onTableBodyScroll]);
|
|
85
81
|
|
|
86
|
-
if (
|
|
82
|
+
if (virtual) {
|
|
87
83
|
// TODO: avg和summay row的逻辑
|
|
88
|
-
var
|
|
84
|
+
var realHeight = (_a = scrollBodyElementRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().height;
|
|
85
|
+
var vMaxHeight = maxHeight ? !isNaN(Number(String(maxHeight).replace(/px/, ''))) ? Number(maxHeight) : realHeight : 300;
|
|
89
86
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
90
87
|
ref: scrollBodyElementRef,
|
|
91
88
|
className: cls,
|
|
@@ -93,15 +90,11 @@ var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
93
90
|
onWheel: onTableBodyScrollMock,
|
|
94
91
|
style: {
|
|
95
92
|
maxHeight: maxHeight !== undefined ? maxHeight : undefined,
|
|
96
|
-
// maxHeight 小于 table 实际高度才出现纵向滚动条
|
|
97
|
-
overflowY: maxHeight !== undefined && bodyTableRef.current && bodyTableRef.current.clientHeight > maxHeight ? 'scroll' : undefined,
|
|
98
93
|
// 表格宽度大于div宽度才出现横向滚动条
|
|
99
94
|
overflowX: canScroll ? 'scroll' : undefined
|
|
100
95
|
}
|
|
101
96
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
102
|
-
ref:
|
|
103
|
-
setMeasureRowElement(domElement);
|
|
104
|
-
},
|
|
97
|
+
ref: measureRowElementRef,
|
|
105
98
|
style: {
|
|
106
99
|
height: 1,
|
|
107
100
|
background: 'transparent'
|
|
@@ -113,7 +106,7 @@ var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
113
106
|
background: 'transparent',
|
|
114
107
|
width: rowWidth
|
|
115
108
|
}
|
|
116
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
109
|
+
}), isArrayNonEmpty(transitionData) ? /*#__PURE__*/React__default.createElement("div", {
|
|
117
110
|
style: {
|
|
118
111
|
width: '100%',
|
|
119
112
|
position: 'sticky',
|
|
@@ -139,7 +132,13 @@ var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
139
132
|
rowData: row
|
|
140
133
|
}, getRequiredProps(row.id))));
|
|
141
134
|
}
|
|
142
|
-
}))
|
|
135
|
+
})) : renderEmptyContent(Object.assign({
|
|
136
|
+
className: prefixCls + "-empty-content",
|
|
137
|
+
colSpan: columns.length,
|
|
138
|
+
emptyContent: emptyContent
|
|
139
|
+
}, scrollBodyElementRef.current ? {
|
|
140
|
+
scrollBodyWidth: window.getComputedStyle(scrollBodyElementRef.current).getPropertyValue('width')
|
|
141
|
+
} : {})));
|
|
143
142
|
} // 外层增加 div 作为滚动容器
|
|
144
143
|
|
|
145
144
|
|
|
@@ -149,8 +148,6 @@ var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
149
148
|
onScroll: onTableBodyScroll,
|
|
150
149
|
style: {
|
|
151
150
|
maxHeight: maxHeight !== undefined ? maxHeight : undefined,
|
|
152
|
-
// maxHeight 小于 table 实际高度才出现纵向滚动条
|
|
153
|
-
overflowY: maxHeight !== undefined && bodyTableRef.current && bodyTableRef.current.clientHeight > maxHeight ? 'scroll' : undefined,
|
|
154
151
|
// 表格宽度大于div宽度才出现横向滚动条
|
|
155
152
|
overflowX: canScroll ? 'scroll' : undefined
|
|
156
153
|
}
|
|
@@ -166,11 +163,7 @@ var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
166
163
|
}, getColgroupProps(col, idx)));
|
|
167
164
|
})), /*#__PURE__*/React__default.createElement("tbody", null, isArrayNonEmpty(transitionData) ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, transitionData.map(function (row, index) {
|
|
168
165
|
return /*#__PURE__*/React__default.createElement(TableRow, Object.assign({
|
|
169
|
-
ref:
|
|
170
|
-
if (index === 0) {
|
|
171
|
-
setMeasureRowElement(dom);
|
|
172
|
-
}
|
|
173
|
-
},
|
|
166
|
+
ref: index === 0 ? measureRowElementRef : null,
|
|
174
167
|
// key={depth + index}
|
|
175
168
|
key: row.id,
|
|
176
169
|
// @ts-ignore
|
package/lib/esm/TableHeader.js
CHANGED
|
@@ -17,10 +17,6 @@ import { renderFilter } from './TableAdvancedFilter.js';
|
|
|
17
17
|
import { useCheckState } from '@hi-ui/use-check-state';
|
|
18
18
|
|
|
19
19
|
var _prefix = getPrefixCls('table-header');
|
|
20
|
-
/**
|
|
21
|
-
* TODO: What is TableHeader
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
20
|
|
|
25
21
|
var TableHeader = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
26
22
|
var _ref$prefixCls = _ref.prefixCls,
|
package/lib/esm/TableRow.js
CHANGED
|
@@ -23,10 +23,6 @@ var _role = 'table';
|
|
|
23
23
|
var _prefix = getPrefixCls(_role);
|
|
24
24
|
|
|
25
25
|
var EMBED_ON_ROW_PROPS = {};
|
|
26
|
-
/**
|
|
27
|
-
* TODO: What is TableRow
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
26
|
var TableRow = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
31
27
|
var _ref$prefixCls = _ref.prefixCls,
|
|
32
28
|
prefixCls = _ref$prefixCls === void 0 ? _prefix : _ref$prefixCls,
|
|
@@ -14,18 +14,17 @@ import { useUpdateEffect } from '@hi-ui/use-update-effect';
|
|
|
14
14
|
var useColWidth = function useColWidth(_ref) {
|
|
15
15
|
var columns = _ref.columns,
|
|
16
16
|
virtual = _ref.virtual;
|
|
17
|
+
var measureRowElementRef = React__default.useRef(null);
|
|
17
18
|
|
|
18
|
-
var _React$useState = React__default.useState(
|
|
19
|
-
measureRowElement = _React$useState[0],
|
|
20
|
-
setMeasureRowElement = _React$useState[1];
|
|
21
|
-
|
|
22
|
-
var _React$useState2 = React__default.useState(function () {
|
|
19
|
+
var _React$useState = React__default.useState(function () {
|
|
23
20
|
return getGroupItemWidth(columns);
|
|
24
21
|
}),
|
|
25
|
-
colWidths = _React$
|
|
26
|
-
setColWidths = _React$
|
|
22
|
+
colWidths = _React$useState[0],
|
|
23
|
+
setColWidths = _React$useState[1];
|
|
27
24
|
|
|
28
25
|
var getVirtualWidths = useCallback(function () {
|
|
26
|
+
var measureRowElement = measureRowElementRef.current;
|
|
27
|
+
|
|
29
28
|
if (!measureRowElement) {
|
|
30
29
|
return getGroupItemWidth(columns);
|
|
31
30
|
}
|
|
@@ -52,20 +51,23 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
52
51
|
return columnItem.width || columnDefaultWidth;
|
|
53
52
|
});
|
|
54
53
|
}
|
|
55
|
-
}, [
|
|
54
|
+
}, [columns]);
|
|
56
55
|
useUpdateEffect(function () {
|
|
57
56
|
if (virtual) {
|
|
58
57
|
// 虚拟滚动的计算需要根据容器来做分配,不能使用没有witdh默认设置为0的方式来做表格平均分配
|
|
59
58
|
setColWidths(getVirtualWidths());
|
|
60
|
-
} else {
|
|
61
|
-
setColWidths(getGroupItemWidth(columns));
|
|
62
59
|
}
|
|
63
|
-
}, [
|
|
60
|
+
}, [getVirtualWidths, virtual]);
|
|
61
|
+
useUpdateEffect(function () {
|
|
62
|
+
setColWidths(getGroupItemWidth(columns));
|
|
63
|
+
}, [columns]);
|
|
64
64
|
/**
|
|
65
65
|
* 根据实际内容区(table 的第一行)渲染,再次精确收集并设置每列宽度
|
|
66
66
|
*/
|
|
67
67
|
|
|
68
68
|
React__default.useEffect(function () {
|
|
69
|
+
var measureRowElement = measureRowElementRef.current;
|
|
70
|
+
|
|
69
71
|
if (measureRowElement) {
|
|
70
72
|
var _resizeObserver = new ResizeObserver(function () {
|
|
71
73
|
if (virtual) {
|
|
@@ -89,11 +91,11 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
return function () {}; // 测量元素在内容列为空时会是空,切换会使测量元素变化,导致后续的resize时间无法响应,此处测量元素变化时需要重新绑定
|
|
92
|
-
}, [
|
|
94
|
+
}, [getVirtualWidths, virtual]);
|
|
93
95
|
|
|
94
|
-
var _React$
|
|
95
|
-
headerTableElement = _React$
|
|
96
|
-
setHeaderTableElement = _React$
|
|
96
|
+
var _React$useState2 = React__default.useState(null),
|
|
97
|
+
headerTableElement = _React$useState2[0],
|
|
98
|
+
setHeaderTableElement = _React$useState2[1];
|
|
97
99
|
/**
|
|
98
100
|
* 控制列最小可调整宽度
|
|
99
101
|
*/
|
|
@@ -147,8 +149,7 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
147
149
|
};
|
|
148
150
|
}, [colWidths]);
|
|
149
151
|
return {
|
|
150
|
-
|
|
151
|
-
setMeasureRowElement: setMeasureRowElement,
|
|
152
|
+
measureRowElementRef: measureRowElementRef,
|
|
152
153
|
onColumnResizable: onColumnResizable,
|
|
153
154
|
getColgroupProps: getColgroupProps,
|
|
154
155
|
setHeaderTableElement: setHeaderTableElement,
|
|
@@ -56,7 +56,14 @@ var useExpand = function useExpand(flattedData, defaultExpandedIds, expandedIdsP
|
|
|
56
56
|
|
|
57
57
|
var transitionDataRef = useLatestRef(transitionData);
|
|
58
58
|
var trySetTransitionData = useCallback(function (data, expandedIds) {
|
|
59
|
-
var nextData =
|
|
59
|
+
var nextData = data; // 当有 children 时,在构造新的数据,防止重复刷新组件
|
|
60
|
+
|
|
61
|
+
if (data.some(function (item) {
|
|
62
|
+
return !!item.children && item.children.length > 0;
|
|
63
|
+
})) {
|
|
64
|
+
nextData = flattenTreeDataWithExpand(data, expandedIds);
|
|
65
|
+
}
|
|
66
|
+
|
|
60
67
|
setTransitionData(nextData);
|
|
61
68
|
}, []); // 用来确保一次折叠动画是一次加锁的单元任务
|
|
62
69
|
// 防止用户频繁折叠展开导致动画渲染(存在 DOM 操作)异常
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
|
-
import __styleInject__ from 'inject
|
|
10
|
+
import __styleInject__ from 'style-inject';
|
|
11
11
|
var css_248z = ".hi-v4-table {-webkit-box-sizing: border-box;box-sizing: border-box;font-size: 14px;position: relative; }.hi-v4-table table {width: 100%;text-align: left;background-color: var(--hi-v4-color-static-white, #fff);border-radius: 2px 2px 0 0;border-spacing: 0;border-collapse: separate;display: table;table-layout: fixed; }.hi-v4-table__wrapper {position: relative;z-index: 0; }.hi-v4-table__switcher.hi-v4-icon-button {color: var(--hi-v4-color-gray-500, #929aa6); }.hi-v4-table__switcher--expanded.hi-v4-icon-button {color: var(--hi-v4-color-primary-400, var(--hi-v4-color-brandblue-400, #4a9eff)); }.hi-v4-table--size-md table tbody > tr:not(.hi-v4-table-empty-content) > td {padding: var(--hi-v4-spacing-7, 14px); }.hi-v4-table--size-md table thead > tr > th {padding: var(--hi-v4-spacing-7, 14px); }.hi-v4-table--size-sm table tbody > tr:not(.hi-v4-table-empty-content) > td {padding: var(--hi-v4-spacing-5, 10px); }.hi-v4-table--size-sm table thead > tr > th {padding: var(--hi-v4-spacing-5, 10px); }.hi-v4-table--size-lg table tbody > tr:not(.hi-v4-table-empty-content) > td {padding: var(--hi-v4-spacing-9, 18px); }.hi-v4-table--size-lg table thead > tr > th {padding: var(--hi-v4-spacing-9, 18px); }.hi-v4-table--bordered table thead > tr > th {border-right: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0); }.hi-v4-table--bordered table td {border-right: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0); }.hi-v4-table--bordered .hi-v4-table-header {border-top: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0);border-left: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0); }.hi-v4-table--bordered .hi-v4-table-body {border-left: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0); }.hi-v4-table--sticky {position: -webkit-sticky;position: sticky;top: 0; }.hi-v4-table--virtual {width: 100%;overflow: hidden; }.hi-v4-table--virtual .hi-v4-table-cell {-webkit-box-sizing: border-box;box-sizing: border-box; }.hi-v4-table-header {position: relative;-webkit-box-sizing: border-box;box-sizing: border-box;overflow: hidden; }.hi-v4-table-header__resizable {position: relative;background-clip: padding-box; }.hi-v4-table-header__resizable-handle {-webkit-box-sizing: content-box;box-sizing: content-box;position: absolute;width: 2px;height: 100%;bottom: 0;right: 0;border-left: 2px solid var(--hi-v4-color-gray-50, #f5f7fa);cursor: col-resize;z-index: 1; }.hi-v4-table-header__resizable:hover .hi-v4-table-header__resizable-handle {background-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-table-header-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-header-cell.hi-v4-table-header-cell__col--highlight, .hi-v4-table-header-cell.hi-v4-table-header-cell__col--hovered-highlight, .hi-v4-table-header-cell.hi-v4-table-header-cell__col--active {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-table-header-cell.hi-v4-table-header-cell__col--highlight[data-sticky], .hi-v4-table-header-cell.hi-v4-table-header-cell__col--hovered-highlight[data-sticky], .hi-v4-table-header-cell.hi-v4-table-header-cell__col--active[data-sticky] {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-table-row--hover:hover > .hi-v4-table-cell {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-row--striped > .hi-v4-table-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-row--expanded > .hi-v4-table-cell {color: var(--hi-v4-color-gray-800, #1f2937); }.hi-v4-table-row--error > .hi-v4-table-cell {color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }.hi-v4-table-row--highlight > .hi-v4-table-cell {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-row--dragging > .hi-v4-table-cell {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-row--drag-top > .hi-v4-table-cell {border-top: 2px dashed var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-table-row--drag-bottom > .hi-v4-table-cell {border-bottom: 2px dashed var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-table-row--avg > .hi-v4-table-cell, .hi-v4-table-row--total > .hi-v4-table-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-row--avg:hover > .hi-v4-table-cell, .hi-v4-table-row--total:hover > .hi-v4-table-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-row--virtual {display: -webkit-box;display: -ms-flexbox;display: flex; }.hi-v4-table-header .hi-v4-table-header-col, .hi-v4-table-header .hi-v4-table-col {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-body .hi-v4-table-header-col[data-hover-highlight], .hi-v4-table-body .hi-v4-table-col[data-hover-highlight] {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-header .hi-v4-table-header-col[data-hover-highlight], .hi-v4-table-header .hi-v4-table-col[data-hover-highlight] {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-table-body {position: relative;overflow: auto; }.hi-v4-table-header-cell {color: var(--hi-v4-color-gray-700, #1f2733);font-size: var(--hi-v4-text-size-md, 0.875rem);font-weight: var(--hi-v4-text-weight-medium, 500);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-8, 16px);border-bottom: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8); }.hi-v4-table-header-cell.hi-v4-table__embed-col, .hi-v4-table-header-cell.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-5, 10px); }.hi-v4-table-cell {word-break: break-word;border-bottom: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8);font-size: var(--hi-v4-text-size-md, 0.875rem);font-weight: var(--hi-v4-text-weight-normal, 400);color: var(--hi-v4-color-gray-700, #1f2733);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-8, 16px);background-color: var(--hi-v4-color-static-white, #fff); }.hi-v4-table-cell__indent {display: inline-block;width: 14px;height: 100%;margin-right: var(--hi-v4-spacing-1, 2px); }.hi-v4-table-cell__switcher.hi-v4-icon-button {margin-right: var(--hi-v4-spacing-1, 2px);color: var(--hi-v4-color-gray-500, #929aa6); }.hi-v4-table-cell.hi-v4-table__embed-col, .hi-v4-table-cell.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-5, 10px); }.hi-v4-table-cell.hi-v4-table-cell__col--highlight {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-cell.hi-v4-table-cell__col--hovered-highlight {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-freeze-shadow {position: absolute;top: 0;bottom: 0;z-index: 20;pointer-events: none;overflow: hidden;height: 100%;width: 200px; }.hi-v4-table-freeze-shadow--left {margin-right: 10px;left: 0;-webkit-box-shadow: 6px 0 6px -4px rgba(0, 0, 0, 0.15);box-shadow: 6px 0 6px -4px rgba(0, 0, 0, 0.15); }.hi-v4-table-freeze-shadow--right {margin-left: 10px;right: 0;-webkit-box-shadow: -6px 0 6px -4px rgba(0, 0, 0, 0.15);box-shadow: -6px 0 6px -4px rgba(0, 0, 0, 0.15); }.hi-v4-table-header-filter-dropdown__trigger.hi-v4-icon-button {margin-left: 4px; }.hi-v4-table-header-filter-dropdown__content {width: 124px;padding: var(--hi-v4-spacing-6, 12px) var(--hi-v4-spacing-4, 8px);font-weight: var(--hi-v4-text-weight-normal, 400); }.hi-v4-table-header-filter-dropdown__item {margin-top: var(--hi-v4-spacing-4, 8px);padding: var(--hi-v4-spacing-3, 6px) var(--hi-v4-spacing-4, 8px);border-radius: var(--hi-v4-border-radius-md, 4px);display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;-webkit-box-align: center;-ms-flex-align: center;align-items: center;cursor: pointer;color: var(--hi-v4-color-gray-700, #1f2733);font-size: var(--hi-v4-text-size-md, 0.875rem); }.hi-v4-table-header-filter-dropdown__item:first-child {margin-top: 0; }.hi-v4-table-header-filter-dropdown__item:hover {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-header-filter-dropdown__item--active {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-header-filter-dropdown__item--active:hover {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-header-filter-sorter {display: -webkit-inline-box;display: -ms-inline-flexbox;display: inline-flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;height: 20px;vertical-align: middle;margin-left: 6px; }.hi-v4-table-header-filter-sorter__icon {display: inline-block;height: 8px;cursor: pointer;overflow: hidden;font-weight: var(--hi-v4-text-weight-normal, 400);color: var(--hi-v4-color-gray-500, #929aa6); }.hi-v4-table-header-filter-sorter__icon svg {position: relative;top: -5px; }.hi-v4-table-header-filter-sorter__icon--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-table-header-filter-custom__trigger {margin-left: 6px;color: var(--hi-v4-color-gray-500, #929aa6);cursor: pointer; }.hi-v4-table-header-filter-custom__content {padding: 12px 8px; }.hi-v4-table-embed-row {position: relative;z-index: 0; }.hi-v4-table-embed-row > td {background-color: var(--hi-v4-color-gray-200, #ebedf0);padding: var(--hi-v4-spacing-10, 20px); }.hi-v4-table-setting {position: absolute;height: 100%;z-index: 11;-webkit-box-sizing: border-box;box-sizing: border-box;right: 0;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;border-left: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8);border-bottom: none;border-top: none;color: var(--hi-v4-color-gray-500, #929aa6);cursor: pointer;font-size: var(--hi-v4-text-size-sm, 0.75rem);width: 18px;background: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-setting__btn-group {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: end;-ms-flex-pack: end;justify-content: flex-end; }.hi-v4-table-setting-item {position: relative;padding-top: var(--hi-v4-spacing-1, 2px);padding-bottom: var(--hi-v4-spacing-1, 2px);-webkit-box-sizing: border-box;box-sizing: border-box; }.hi-v4-table-setting-item__wrap {-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;cursor: move;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-orient: horizontal;-webkit-box-direction: normal;-ms-flex-direction: row;flex-direction: row;padding: var(--hi-v4-spacing-3, 6px) var(--hi-v4-spacing-4, 8px);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);border-radius: var(--hi-v4-border-radius-md, 4px); }.hi-v4-table-setting-item__wrap:hover {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-setting-item--dragging .hi-v4-table-setting-item__wrap {opacity: 0.6; }.hi-v4-table-setting-item::before {position: absolute;left: 0;z-index: 9999;display: none;-webkit-box-sizing: border-box;box-sizing: border-box;width: 8px;height: 8px;content: '';background-color: var(--hi-v4-color-static-white, #fff);border: 1px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));border-radius: 100%; }.hi-v4-table-setting-item::after {position: absolute;content: '';z-index: 9998;display: block;-webkit-box-sizing: border-box;box-sizing: border-box;border-bottom-width: 0;border-bottom-style: solid;border-bottom-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));left: 0;width: 100%; }.hi-v4-table-setting-item::before, .hi-v4-table-setting-item::after {margin-left: -10px;margin-right: -10px; }.hi-v4-table-setting-item--direction-before::before {display: block;top: -0.5px;-webkit-transform: translateY(-4px);transform: translateY(-4px); }.hi-v4-table-setting-item--direction-before::after {top: -0.5px;border-bottom-width: 1px; }.hi-v4-table-setting-item--direction-after::before {display: block;bottom: 0.5px;-webkit-transform: translateY(4px);transform: translateY(4px); }.hi-v4-table-setting-item--direction-after::after {bottom: 0.5px;border-bottom-width: 1px; }.hi-v4-table-pagination {display: -webkit-box;display: -ms-flexbox;display: flex;-ms-flex-wrap: wrap;flex-wrap: wrap;row-gap: 8px;padding: var(--hi-v4-spacing-6, 12px) 0;background-color: var(--hi-v4-color-static-white, #fff); }.hi-v4-table-pagination--placement-left {-webkit-box-pack: start;-ms-flex-pack: start;justify-content: flex-start; }.hi-v4-table-pagination--placement-right {-webkit-box-pack: end;-ms-flex-pack: end;justify-content: flex-end; }.hi-v4-table-pagination--placement-middle {-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center; }.hi-v4-table-empty-content td {text-align: center;padding: var(--hi-v4-spacing-12, 24px) 0; }.hi-v4-table--bordered .hi-v4-table-empty-content td {border-bottom: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8); }.hi-v4-setting-drawer .hi-v4-setting__btn-group {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: end;-ms-flex-pack: end;justify-content: flex-end; }.hi-v4-setting-item {position: relative;padding-top: var(--hi-v4-spacing-1, 2px);padding-bottom: var(--hi-v4-spacing-1, 2px);-webkit-box-sizing: border-box;box-sizing: border-box; }.hi-v4-setting-item__wrap {-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;cursor: move;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-orient: horizontal;-webkit-box-direction: normal;-ms-flex-direction: row;flex-direction: row;padding: var(--hi-v4-spacing-3, 6px) var(--hi-v4-spacing-4, 8px);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);border-radius: var(--hi-v4-border-radius-md, 4px); }.hi-v4-setting-item__wrap:hover {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-setting-item--dragging .hi-v4-setting-item__wrap {opacity: 0.6; }.hi-v4-setting-item::before {position: absolute;left: 0;z-index: 9999;display: none;-webkit-box-sizing: border-box;box-sizing: border-box;width: 8px;height: 8px;content: '';background-color: var(--hi-v4-color-static-white, #fff);border: 1px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));border-radius: 100%; }.hi-v4-setting-item::after {position: absolute;content: '';z-index: 9998;display: block;-webkit-box-sizing: border-box;box-sizing: border-box;border-bottom-width: 0;border-bottom-style: solid;border-bottom-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));left: 0;width: 100%; }.hi-v4-setting-item::before, .hi-v4-setting-item::after {margin-left: -10px;margin-right: -10px; }.hi-v4-setting-item--direction-before::before {display: block;top: -0.5px;-webkit-transform: translateY(-4px);transform: translateY(-4px); }.hi-v4-setting-item--direction-before::after {top: -0.5px;border-bottom-width: 1px; }.hi-v4-setting-item--direction-after::before {display: block;bottom: 0.5px;-webkit-transform: translateY(4px);transform: translateY(4px); }.hi-v4-setting-item--direction-after::after {bottom: 0.5px;border-bottom-width: 1px; }";
|
|
12
12
|
|
|
13
13
|
__styleInject__(css_248z);
|
package/lib/esm/use-table.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
10
|
import { __rest } from 'tslib';
|
|
11
|
-
import { cloneTree, flattenTree, getLeafChildren, getNodeRootParent } from '@hi-ui/tree-utils';
|
|
11
|
+
import { cloneTree, flattenTree, getLeafChildren, getNodeRootParent, flattedTreeSort } from '@hi-ui/tree-utils';
|
|
12
12
|
import React__default, { useMemo, useState, useRef, useCallback, useEffect } from 'react';
|
|
13
13
|
import { useUncontrolledState } from '@hi-ui/use-uncontrolled-state';
|
|
14
14
|
import { useColWidth } from './hooks/use-col-width.js';
|
|
@@ -183,7 +183,7 @@ var useTable = function useTable(_a) {
|
|
|
183
183
|
resizable: resizable,
|
|
184
184
|
virtual: virtual
|
|
185
185
|
}),
|
|
186
|
-
|
|
186
|
+
measureRowElementRef = _useColWidth.measureRowElementRef,
|
|
187
187
|
getColgroupProps = _useColWidth.getColgroupProps,
|
|
188
188
|
onColumnResizable = _useColWidth.onColumnResizable,
|
|
189
189
|
colWidths = _useColWidth.colWidths; // ************************ 列冻结 ************************ //
|
|
@@ -346,20 +346,22 @@ var useTable = function useTable(_a) {
|
|
|
346
346
|
setScrollSize = _useState2[1];
|
|
347
347
|
|
|
348
348
|
useEffect(function () {
|
|
349
|
-
var _a, _b, _c, _d, _e, _f;
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
349
|
+
var _a, _b, _c, _d, _e, _f;
|
|
350
|
+
|
|
351
|
+
if (leftFrozenColKeys.length > 0 || rightFrozenColKeys.length > 0) {
|
|
352
|
+
// 计算冻结列的宽度
|
|
353
|
+
// mutationObserver
|
|
354
|
+
var tableWidth = (_c = (_b = (_a = bodyTableRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect) === null || _b === void 0 ? void 0 : _b.call(_a).width) !== null && _c !== void 0 ? _c : 0;
|
|
355
|
+
var tableBodyWidth = (_f = (_e = (_d = scrollBodyElementRef.current) === null || _d === void 0 ? void 0 : _d.getBoundingClientRect) === null || _e === void 0 ? void 0 : _e.call(_d).width) !== null && _f !== void 0 ? _f : 0;
|
|
356
|
+
var scrollRight = tableWidth - tableBodyWidth; // const scrollLeft = 0
|
|
357
|
+
|
|
358
|
+
setScrollSize(function (prev) {
|
|
359
|
+
return {
|
|
360
|
+
scrollLeft: prev.scrollLeft,
|
|
361
|
+
scrollRight: scrollRight
|
|
362
|
+
};
|
|
363
|
+
});
|
|
364
|
+
}
|
|
363
365
|
}, [leftFrozenColKeys, rightFrozenColKeys]); // const canScroll = scrollSize.scrollRight > 0
|
|
364
366
|
// 实时计算
|
|
365
367
|
|
|
@@ -495,23 +497,30 @@ var useTable = function useTable(_a) {
|
|
|
495
497
|
|
|
496
498
|
|
|
497
499
|
var showData = useMemo(function () {
|
|
498
|
-
var
|
|
500
|
+
var _a;
|
|
501
|
+
|
|
502
|
+
var _data = [].concat(transitionData);
|
|
499
503
|
|
|
500
504
|
if (activeSorterColumn) {
|
|
501
|
-
var sorter = columns.filter(function (d) {
|
|
505
|
+
var sorter = (_a = columns.filter(function (d) {
|
|
502
506
|
return d.dataKey === activeSorterColumn;
|
|
503
|
-
})[0]
|
|
504
|
-
return d.dataKey === activeSorterColumn;
|
|
505
|
-
})[0].sorter;
|
|
507
|
+
})[0]) === null || _a === void 0 ? void 0 : _a.sorter;
|
|
506
508
|
|
|
507
509
|
if (sorter) {
|
|
508
|
-
|
|
510
|
+
activeSorterType === 'ascend' ? _data.sort(sorter) : _data.sort(sorter).reverse(); // 平铺的树形结构排序
|
|
511
|
+
|
|
512
|
+
if (_data.some(function (d) {
|
|
513
|
+
return d.depth !== 0;
|
|
514
|
+
})) {
|
|
515
|
+
_data = flattedTreeSort(_data);
|
|
516
|
+
}
|
|
509
517
|
}
|
|
510
518
|
}
|
|
511
519
|
|
|
512
520
|
return _data;
|
|
513
521
|
}, [activeSorterColumn, activeSorterType, transitionData, columns]);
|
|
514
522
|
return Object.assign(Object.assign({
|
|
523
|
+
measureRowElementRef: measureRowElementRef,
|
|
515
524
|
rootProps: rootProps,
|
|
516
525
|
scrollWidth: scrollWidth,
|
|
517
526
|
activeSorterColumn: activeSorterColumn,
|
|
@@ -533,7 +542,6 @@ var useTable = function useTable(_a) {
|
|
|
533
542
|
// 行多选
|
|
534
543
|
rowSelection: rowSelection,
|
|
535
544
|
cacheData: cacheData,
|
|
536
|
-
setMeasureRowElement: setMeasureRowElement,
|
|
537
545
|
leafColumns: leafColumns,
|
|
538
546
|
// ui
|
|
539
547
|
// 有表头分组那么也要 bordered
|
package/lib/types/BaseTable.d.ts
CHANGED
|
@@ -4,9 +4,6 @@ import { TableExtra, TableColumnItem, TableOnRowReturn } from './types';
|
|
|
4
4
|
import { UseTableProps } from './use-table';
|
|
5
5
|
import { UseEmbedExpandProps } from './hooks/use-embed-expand';
|
|
6
6
|
export declare const EMBED_DATA_KEY: string;
|
|
7
|
-
/**
|
|
8
|
-
* TODO: What is BaseTable
|
|
9
|
-
*/
|
|
10
7
|
export declare const BaseTable: React.ForwardRefExoticComponent<BaseTableProps & React.RefAttributes<HTMLDivElement | null>>;
|
|
11
8
|
export interface BaseTableProps extends Omit<HiBaseHTMLProps<'div'>, 'onDrop' | 'draggable' | 'onDragStart'>, UseTableProps, UseEmbedExpandProps {
|
|
12
9
|
/**
|
package/lib/types/TableBody.d.ts
CHANGED
package/lib/types/TableRow.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FlattedTableRowData } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* TODO: What is TableRow
|
|
5
|
-
*/
|
|
6
3
|
export declare const TableRow: React.ForwardRefExoticComponent<TableRowProps & React.RefAttributes<HTMLTableRowElement | null>>;
|
|
7
4
|
export interface TableRowProps {
|
|
8
5
|
/**
|
package/lib/types/context.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ export declare const TableProvider: import("react").Provider<(Omit<{
|
|
|
41
41
|
onLoadChildren: ((item: import("./types").TableRowEventData) => void | Promise<void | any[]>) | undefined;
|
|
42
42
|
scrollLeft: number;
|
|
43
43
|
scrollRight: number;
|
|
44
|
+
measureRowElementRef: import("react").MutableRefObject<HTMLTableRowElement | null>;
|
|
44
45
|
rootProps: {
|
|
45
46
|
bordered?: boolean | undefined;
|
|
46
47
|
pagination?: import("packages/ui/pagination/lib/types").PaginationProps | undefined;
|
|
@@ -54,7 +55,7 @@ export declare const TableProvider: import("react").Provider<(Omit<{
|
|
|
54
55
|
activeSorterType: string | null;
|
|
55
56
|
setActiveSorterType: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
56
57
|
canScroll: boolean;
|
|
57
|
-
maxHeight: number | undefined;
|
|
58
|
+
maxHeight: string | number | undefined;
|
|
58
59
|
getTableHeaderProps: () => {
|
|
59
60
|
style: import("react").CSSProperties;
|
|
60
61
|
'data-sticky': "" | undefined;
|
|
@@ -69,7 +70,6 @@ export declare const TableProvider: import("react").Provider<(Omit<{
|
|
|
69
70
|
flattedColumnsWithoutChildren: import("./types").FlattedTableColumnItemData[];
|
|
70
71
|
rowSelection: import("./types").TableRowSelection | undefined;
|
|
71
72
|
cacheData: object[];
|
|
72
|
-
setMeasureRowElement: import("react").Dispatch<import("react").SetStateAction<Element | null>>;
|
|
73
73
|
leafColumns: import("packages/utils/tree-utils/lib/types/types").BaseFlattedTreeNodeData<any, any>[];
|
|
74
74
|
bordered: boolean;
|
|
75
75
|
scrollHeaderElementRef: import("react").RefObject<HTMLTableElement>;
|
|
@@ -146,6 +146,7 @@ export declare const useTableContext: () => Omit<{
|
|
|
146
146
|
onLoadChildren: ((item: import("./types").TableRowEventData) => void | Promise<void | any[]>) | undefined;
|
|
147
147
|
scrollLeft: number;
|
|
148
148
|
scrollRight: number;
|
|
149
|
+
measureRowElementRef: import("react").MutableRefObject<HTMLTableRowElement | null>;
|
|
149
150
|
rootProps: {
|
|
150
151
|
bordered?: boolean | undefined;
|
|
151
152
|
pagination?: import("packages/ui/pagination/lib/types").PaginationProps | undefined;
|
|
@@ -159,7 +160,7 @@ export declare const useTableContext: () => Omit<{
|
|
|
159
160
|
activeSorterType: string | null;
|
|
160
161
|
setActiveSorterType: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
161
162
|
canScroll: boolean;
|
|
162
|
-
maxHeight: number | undefined;
|
|
163
|
+
maxHeight: string | number | undefined;
|
|
163
164
|
getTableHeaderProps: () => {
|
|
164
165
|
style: import("react").CSSProperties;
|
|
165
166
|
'data-sticky': "" | undefined;
|
|
@@ -174,7 +175,6 @@ export declare const useTableContext: () => Omit<{
|
|
|
174
175
|
flattedColumnsWithoutChildren: import("./types").FlattedTableColumnItemData[];
|
|
175
176
|
rowSelection: import("./types").TableRowSelection | undefined;
|
|
176
177
|
cacheData: object[];
|
|
177
|
-
setMeasureRowElement: import("react").Dispatch<import("react").SetStateAction<Element | null>>;
|
|
178
178
|
leafColumns: import("packages/utils/tree-utils/lib/types/types").BaseFlattedTreeNodeData<any, any>[];
|
|
179
179
|
bordered: boolean;
|
|
180
180
|
scrollHeaderElementRef: import("react").RefObject<HTMLTableElement>;
|
|
@@ -6,8 +6,7 @@ export declare const useColWidth: ({ resizable, data, columns, virtual, }: {
|
|
|
6
6
|
columns: TableColumnItem[];
|
|
7
7
|
virtual?: boolean | undefined;
|
|
8
8
|
}) => {
|
|
9
|
-
|
|
10
|
-
setMeasureRowElement: React.Dispatch<React.SetStateAction<Element | null>>;
|
|
9
|
+
measureRowElementRef: React.MutableRefObject<HTMLTableRowElement | null>;
|
|
11
10
|
onColumnResizable: (_: any, { size }: any, index: number) => void;
|
|
12
11
|
getColgroupProps: (column: FlattedTableColumnItemData, index: number) => {
|
|
13
12
|
style: {
|
package/lib/types/types.d.ts
CHANGED
|
@@ -198,12 +198,15 @@ export interface FlattedTableRowData extends TableRowData {
|
|
|
198
198
|
/**
|
|
199
199
|
* 该节点的父节点
|
|
200
200
|
*/
|
|
201
|
-
parent?:
|
|
201
|
+
parent?: FlattedTableRowDataWithChildren;
|
|
202
202
|
/**
|
|
203
203
|
* 节点所在列表数据中的下标
|
|
204
204
|
*/
|
|
205
205
|
pos?: number;
|
|
206
206
|
}
|
|
207
|
+
export interface FlattedTableRowDataWithChildren extends FlattedTableRowData {
|
|
208
|
+
children: FlattedTableRowData[];
|
|
209
|
+
}
|
|
207
210
|
export interface FlattedTableColumnItemData extends TableColumnItem {
|
|
208
211
|
/**
|
|
209
212
|
* 树节点唯一 id
|
package/lib/types/use-table.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TableColumnItem, TableFrozenColumnOptions, TableRowEventData, TableRowSelection, FlattedTableColumnItemData } from './types';
|
|
2
|
+
import { TableColumnItem, TableFrozenColumnOptions, TableRowEventData, TableRowSelection, FlattedTableColumnItemData, FlattedTableRowData } from './types';
|
|
3
3
|
import { PaginationProps } from '@hi-ui/pagination';
|
|
4
4
|
export declare const useTable: ({ data, columns: columnsProp, defaultFixedToColumn, fixedToColumn: fixedToColumnProp, onFixedToColumn, scrollWidth, resizable, errorRowKeys, highlightedColKeys: highlightedColKeysProp, highlightedRowKeys: highlightedRowKeysProp, showColHighlight, showRowHighlight, highlightRowOnDoubleClick, defaultExpandedRowKeys, expandedRowKeys: expandRowKeysProp, onExpand, defaultExpandAll, onLoadChildren, maxHeight, sticky, stickyTop, draggable, onDragStart, onDrop: onDropProp, onDropEnd, showColMenu, rowSelection, cellRender, fieldKey, virtual, ...rootProps }: UseTableProps) => {
|
|
5
5
|
getColgroupProps: (column: FlattedTableColumnItemData, index: number) => {
|
|
@@ -42,6 +42,7 @@ export declare const useTable: ({ data, columns: columnsProp, defaultFixedToColu
|
|
|
42
42
|
onLoadChildren: ((item: TableRowEventData) => Promise<any[] | void> | void) | undefined;
|
|
43
43
|
scrollLeft: number;
|
|
44
44
|
scrollRight: number;
|
|
45
|
+
measureRowElementRef: React.MutableRefObject<HTMLTableRowElement | null>;
|
|
45
46
|
rootProps: {
|
|
46
47
|
/**
|
|
47
48
|
* 是否显示边框(表头分组模式下,表格自带边框)
|
|
@@ -70,7 +71,7 @@ export declare const useTable: ({ data, columns: columnsProp, defaultFixedToColu
|
|
|
70
71
|
activeSorterType: string | null;
|
|
71
72
|
setActiveSorterType: React.Dispatch<React.SetStateAction<string | null>>;
|
|
72
73
|
canScroll: boolean;
|
|
73
|
-
maxHeight: number | undefined;
|
|
74
|
+
maxHeight: string | number | undefined;
|
|
74
75
|
getTableHeaderProps: () => {
|
|
75
76
|
style: React.CSSProperties;
|
|
76
77
|
'data-sticky': "" | undefined;
|
|
@@ -80,12 +81,11 @@ export declare const useTable: ({ data, columns: columnsProp, defaultFixedToColu
|
|
|
80
81
|
scrollBodyElementRef: React.RefObject<HTMLTableElement>;
|
|
81
82
|
columns: FlattedTableColumnItemData[];
|
|
82
83
|
data: object[];
|
|
83
|
-
transitionData:
|
|
84
|
+
transitionData: FlattedTableRowData[];
|
|
84
85
|
flattedColumns: import("packages/utils/tree-utils/lib/types/types").BaseFlattedTreeNodeData<any, any>[];
|
|
85
86
|
flattedColumnsWithoutChildren: FlattedTableColumnItemData[];
|
|
86
87
|
rowSelection: TableRowSelection | undefined;
|
|
87
88
|
cacheData: object[];
|
|
88
|
-
setMeasureRowElement: React.Dispatch<React.SetStateAction<Element | null>>;
|
|
89
89
|
leafColumns: import("packages/utils/tree-utils/lib/types/types").BaseFlattedTreeNodeData<any, any>[];
|
|
90
90
|
bordered: boolean;
|
|
91
91
|
scrollHeaderElementRef: React.RefObject<HTMLTableElement>;
|
|
@@ -147,7 +147,7 @@ export interface UseTableProps {
|
|
|
147
147
|
/**
|
|
148
148
|
* 表格最大高度,当穿过该高度时,展示滚动条且表头固定
|
|
149
149
|
*/
|
|
150
|
-
maxHeight?: number;
|
|
150
|
+
maxHeight?: number | string;
|
|
151
151
|
/**
|
|
152
152
|
* 表格列冻结默认设置,为 string 时仅支持从左侧冻结至某一列
|
|
153
153
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hi-ui/table",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.2",
|
|
4
4
|
"description": "A sub-package for @hi-ui/hiui.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "HiUI <mi-hiui@xiaomi.com>",
|
|
@@ -53,16 +53,16 @@
|
|
|
53
53
|
"@hi-ui/env": "^4.0.1",
|
|
54
54
|
"@hi-ui/func-utils": "^4.0.1",
|
|
55
55
|
"@hi-ui/icon-button": "^4.0.4",
|
|
56
|
-
"@hi-ui/icons": "^4.0.
|
|
56
|
+
"@hi-ui/icons": "^4.0.14",
|
|
57
57
|
"@hi-ui/loading": "^4.1.0",
|
|
58
58
|
"@hi-ui/object-utils": "^4.0.1",
|
|
59
|
-
"@hi-ui/pagination": "^4.0.
|
|
60
|
-
"@hi-ui/popper": "^4.0
|
|
59
|
+
"@hi-ui/pagination": "^4.0.8",
|
|
60
|
+
"@hi-ui/popper": "^4.1.0",
|
|
61
61
|
"@hi-ui/react-utils": "^4.0.1",
|
|
62
62
|
"@hi-ui/select": "^4.0.8",
|
|
63
63
|
"@hi-ui/spinner": "^4.0.4",
|
|
64
64
|
"@hi-ui/times": "^4.0.1",
|
|
65
|
-
"@hi-ui/tree-utils": "^4.
|
|
65
|
+
"@hi-ui/tree-utils": "^4.1.1",
|
|
66
66
|
"@hi-ui/type-assertion": "^4.0.1",
|
|
67
67
|
"@hi-ui/use-cache": "^4.0.1",
|
|
68
68
|
"@hi-ui/use-check": "^4.0.2",
|
|
@@ -83,7 +83,6 @@
|
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@hi-ui/core": "^4.0.4",
|
|
85
85
|
"@hi-ui/core-css": "^4.0.1",
|
|
86
|
-
"@hi-ui/hi-build": "^4.0.1",
|
|
87
86
|
"@types/react-resizable": "^1.7.4",
|
|
88
87
|
"react": "^17.0.1",
|
|
89
88
|
"react-dom": "^17.0.1"
|