@hi-ui/table 4.1.2 → 4.1.3-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/BaseTable.js +126 -71
- package/lib/cjs/ColGroupContent.js +56 -0
- package/lib/cjs/Table.js +14 -3
- package/lib/cjs/TableBody.js +6 -64
- package/lib/cjs/TableHeader.js +5 -71
- package/lib/cjs/TbodyContent.js +129 -0
- package/lib/cjs/TheadContent.js +115 -0
- package/lib/cjs/hooks/use-col-width.js +11 -13
- package/lib/cjs/styles/index.scss.js +1 -1
- package/lib/cjs/use-table.js +18 -8
- package/lib/esm/BaseTable.js +123 -71
- package/lib/esm/ColGroupContent.js +37 -0
- package/lib/esm/Table.js +14 -3
- package/lib/esm/TableBody.js +3 -62
- package/lib/esm/TableHeader.js +5 -69
- package/lib/esm/TbodyContent.js +105 -0
- package/lib/esm/TheadContent.js +91 -0
- package/lib/esm/hooks/use-col-width.js +11 -13
- package/lib/esm/styles/index.scss.js +1 -1
- package/lib/esm/use-table.js +18 -8
- package/lib/types/BaseTable.d.ts +4 -0
- package/lib/types/ColGroupContent.d.ts +8 -0
- package/lib/types/TbodyContent.d.ts +18 -0
- package/lib/types/TheadContent.d.ts +9 -0
- package/lib/types/context.d.ts +8 -8
- package/lib/types/use-table.d.ts +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** @LICENSE
|
|
2
|
+
* @hi-ui/table
|
|
3
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/table#readme
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
import React__default, { forwardRef } from 'react';
|
|
11
|
+
import { getPrefixCls } from '@hi-ui/classname';
|
|
12
|
+
import { __DEV__ } from '@hi-ui/env';
|
|
13
|
+
import { useTableContext } from './context.js';
|
|
14
|
+
|
|
15
|
+
var _prefix = getPrefixCls('table-colgroup');
|
|
16
|
+
|
|
17
|
+
var ColGroupContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
18
|
+
var _ref$prefixCls = _ref.prefixCls,
|
|
19
|
+
prefixCls = _ref$prefixCls === void 0 ? _prefix : _ref$prefixCls;
|
|
20
|
+
|
|
21
|
+
var _useTableContext = useTableContext(),
|
|
22
|
+
getColgroupProps = _useTableContext.getColgroupProps,
|
|
23
|
+
leafColumns = _useTableContext.leafColumns;
|
|
24
|
+
|
|
25
|
+
return /*#__PURE__*/React__default.createElement("colgroup", null, leafColumns.map(function (col, idx) {
|
|
26
|
+
return /*#__PURE__*/React__default.createElement("col", Object.assign({
|
|
27
|
+
key: idx,
|
|
28
|
+
className: prefixCls + "-col"
|
|
29
|
+
}, getColgroupProps(col, idx)));
|
|
30
|
+
}));
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (__DEV__) {
|
|
34
|
+
ColGroupContent.displayName = 'ColGroupContent';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { ColGroupContent };
|
package/lib/esm/Table.js
CHANGED
|
@@ -27,7 +27,13 @@ import { uuid } from './utils/index.js';
|
|
|
27
27
|
import { useColSet } from './hooks/use-col-set.js';
|
|
28
28
|
|
|
29
29
|
var _prefix = getPrefixCls('table');
|
|
30
|
+
/**
|
|
31
|
+
* 需要使用双表格的场景对应的 API
|
|
32
|
+
* 这些场景下的功能无法通过单表格实现,故而设计成双表格,即表头和表体分别用一个 table 实现
|
|
33
|
+
*/
|
|
34
|
+
|
|
30
35
|
|
|
36
|
+
var DOUBLE_TABLE_SCENE = ['maxHeight', 'sticky', 'stickyTop', 'setting', 'virtual'];
|
|
31
37
|
var STANDARD_PRESET = {
|
|
32
38
|
striped: true,
|
|
33
39
|
bordered: true,
|
|
@@ -46,7 +52,6 @@ var DEFAULT_PAGINATION = {
|
|
|
46
52
|
*/
|
|
47
53
|
|
|
48
54
|
var Table = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
49
|
-
// ************************ 预置标准模式 ************************ //
|
|
50
55
|
var _a$prefixCls = _a.prefixCls,
|
|
51
56
|
prefixCls = _a$prefixCls === void 0 ? _prefix : _a$prefixCls,
|
|
52
57
|
_a$standard = _a.standard,
|
|
@@ -69,8 +74,13 @@ var Table = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
69
74
|
extra = _a.extra,
|
|
70
75
|
_a$data = _a.data,
|
|
71
76
|
data = _a$data === void 0 ? DEFAULT_DATA : _a$data,
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
rest = __rest(_a, ["prefixCls", "standard", "loading", "dataSource", "pagination", "uniqueId", "columns", "hiddenColKeys", "onHiddenColKeysChange", "sortedColKeys", "onSortedColKeysChange", "checkDisabledColKeys", "onSetColKeysChange", "rowSelection", "fieldKey", "extra", "data"]); // 是否需要双表格
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
var needDoubleTable = DOUBLE_TABLE_SCENE.some(function (prop) {
|
|
81
|
+
return !!rest[prop];
|
|
82
|
+
});
|
|
83
|
+
var virtual = rest.virtual; // ************************ 预置标准模式 ************************ //
|
|
74
84
|
|
|
75
85
|
var tableProps = withDefaultProps(rest, standard ? STANDARD_PRESET : undefined);
|
|
76
86
|
|
|
@@ -282,6 +292,7 @@ var Table = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
282
292
|
data: mergedData,
|
|
283
293
|
fieldKey: fieldKey,
|
|
284
294
|
virtual: virtual,
|
|
295
|
+
needDoubleTable: needDoubleTable,
|
|
285
296
|
extra: Object.assign({
|
|
286
297
|
header: setting ? /*#__PURE__*/React__default.createElement(TableSettingMenu, {
|
|
287
298
|
prefixCls: prefixCls + "-setting",
|
package/lib/esm/TableBody.js
CHANGED
|
@@ -13,9 +13,10 @@ import { getPrefixCls, cx } from '@hi-ui/classname';
|
|
|
13
13
|
import { __DEV__ } from '@hi-ui/env';
|
|
14
14
|
import { useLatestCallback } from '@hi-ui/use-latest';
|
|
15
15
|
import { isArrayNonEmpty } from '@hi-ui/type-assertion';
|
|
16
|
-
import { EmptyState } from '@hi-ui/empty-state';
|
|
17
16
|
import { TableRow } from './TableRow.js';
|
|
18
17
|
import { useTableContext } from './context.js';
|
|
18
|
+
import { ColGroupContent } from './ColGroupContent.js';
|
|
19
|
+
import { renderEmptyContent, TbodyContent } from './TbodyContent.js';
|
|
19
20
|
var _role = 'table';
|
|
20
21
|
|
|
21
22
|
var _prefix = getPrefixCls(_role);
|
|
@@ -29,10 +30,8 @@ var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
29
30
|
|
|
30
31
|
var _useTableContext = useTableContext(),
|
|
31
32
|
columns = _useTableContext.columns,
|
|
32
|
-
leafColumns = _useTableContext.leafColumns,
|
|
33
33
|
isExpandTreeRows = _useTableContext.isExpandTreeRows,
|
|
34
34
|
transitionData = _useTableContext.transitionData,
|
|
35
|
-
getColgroupProps = _useTableContext.getColgroupProps,
|
|
36
35
|
bodyTableRef = _useTableContext.bodyTableRef,
|
|
37
36
|
scrollBodyElementRef = _useTableContext.scrollBodyElementRef,
|
|
38
37
|
onTableBodyScroll = _useTableContext.onTableBodyScroll,
|
|
@@ -40,10 +39,6 @@ var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
40
39
|
maxHeight = _useTableContext.maxHeight,
|
|
41
40
|
canScroll = _useTableContext.canScroll,
|
|
42
41
|
scrollWidth = _useTableContext.scrollWidth,
|
|
43
|
-
hasAvgColumn = _useTableContext.hasAvgColumn,
|
|
44
|
-
avgRow = _useTableContext.avgRow,
|
|
45
|
-
hasSumColumn = _useTableContext.hasSumColumn,
|
|
46
|
-
sumRow = _useTableContext.sumRow,
|
|
47
42
|
colWidths = _useTableContext.colWidths,
|
|
48
43
|
virtual = _useTableContext.virtual,
|
|
49
44
|
measureRowElementRef = _useTableContext.measureRowElementRef;
|
|
@@ -156,65 +151,11 @@ var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
156
151
|
style: {
|
|
157
152
|
width: canScroll && scrollWidth !== undefined ? scrollWidth : '100%'
|
|
158
153
|
}
|
|
159
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
160
|
-
return /*#__PURE__*/React__default.createElement("col", Object.assign({
|
|
161
|
-
key: idx,
|
|
162
|
-
className: prefixCls + "-col"
|
|
163
|
-
}, getColgroupProps(col, idx)));
|
|
164
|
-
})), /*#__PURE__*/React__default.createElement("tbody", null, isArrayNonEmpty(transitionData) ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, transitionData.map(function (row, index) {
|
|
165
|
-
return /*#__PURE__*/React__default.createElement(TableRow, Object.assign({
|
|
166
|
-
ref: index === 0 ? measureRowElementRef : null,
|
|
167
|
-
// key={depth + index}
|
|
168
|
-
key: row.id,
|
|
169
|
-
// @ts-ignore
|
|
170
|
-
rowIndex: index,
|
|
171
|
-
rowData: row
|
|
172
|
-
}, getRequiredProps(row.id)));
|
|
173
|
-
}), hasSumColumn ? /*#__PURE__*/React__default.createElement(TableRow, {
|
|
174
|
-
key: sumRow.id,
|
|
175
|
-
rowIndex: transitionData.length,
|
|
176
|
-
rowData: sumRow,
|
|
177
|
-
isSumRow: true
|
|
178
|
-
}) : null, hasAvgColumn ? /*#__PURE__*/React__default.createElement(TableRow, {
|
|
179
|
-
key: avgRow.id,
|
|
180
|
-
rowIndex: transitionData.length + 1,
|
|
181
|
-
rowData: avgRow,
|
|
182
|
-
isAvgRow: true
|
|
183
|
-
}) : null) : // 空状态,colSpan 占满表格整行
|
|
184
|
-
renderEmptyContent(Object.assign({
|
|
185
|
-
className: prefixCls + "-empty-content",
|
|
186
|
-
colSpan: columns.length,
|
|
187
|
-
emptyContent: emptyContent
|
|
188
|
-
}, scrollBodyElementRef.current ? {
|
|
189
|
-
scrollBodyWidth: window.getComputedStyle(scrollBodyElementRef.current).getPropertyValue('width')
|
|
190
|
-
} : {})))));
|
|
154
|
+
}, /*#__PURE__*/React__default.createElement(ColGroupContent, null), /*#__PURE__*/React__default.createElement(TbodyContent, null)));
|
|
191
155
|
});
|
|
192
156
|
|
|
193
157
|
if (__DEV__) {
|
|
194
158
|
TableBody.displayName = 'TableBody';
|
|
195
159
|
}
|
|
196
|
-
/**
|
|
197
|
-
* 负责空状态渲染
|
|
198
|
-
*/
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
var renderEmptyContent = function renderEmptyContent(_ref2) {
|
|
202
|
-
var className = _ref2.className,
|
|
203
|
-
colSpan = _ref2.colSpan,
|
|
204
|
-
emptyContent = _ref2.emptyContent,
|
|
205
|
-
scrollBodyWidth = _ref2.scrollBodyWidth;
|
|
206
|
-
return /*#__PURE__*/React__default.createElement("tr", {
|
|
207
|
-
className: className
|
|
208
|
-
}, /*#__PURE__*/React__default.createElement("td", {
|
|
209
|
-
colSpan: colSpan
|
|
210
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
211
|
-
style: {
|
|
212
|
-
position: 'sticky',
|
|
213
|
-
left: 0,
|
|
214
|
-
width: scrollBodyWidth !== null && scrollBodyWidth !== void 0 ? scrollBodyWidth : '100%',
|
|
215
|
-
overflow: 'hidden'
|
|
216
|
-
}
|
|
217
|
-
}, emptyContent || /*#__PURE__*/React__default.createElement(EmptyState, null))));
|
|
218
|
-
};
|
|
219
160
|
|
|
220
161
|
export { TableBody };
|
package/lib/esm/TableHeader.js
CHANGED
|
@@ -8,13 +8,11 @@
|
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
10
|
import React__default, { forwardRef } from 'react';
|
|
11
|
-
import { Resizable } from 'react-resizable';
|
|
12
11
|
import { getPrefixCls, cx } from '@hi-ui/classname';
|
|
13
12
|
import { __DEV__ } from '@hi-ui/env';
|
|
14
|
-
import { isFunction } from '@hi-ui/type-assertion';
|
|
15
13
|
import { useTableContext } from './context.js';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
14
|
+
import { ColGroupContent } from './ColGroupContent.js';
|
|
15
|
+
import { TheadContent } from './TheadContent.js';
|
|
18
16
|
|
|
19
17
|
var _prefix = getPrefixCls('table-header');
|
|
20
18
|
|
|
@@ -24,21 +22,10 @@ var TableHeader = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
24
22
|
className = _ref.className;
|
|
25
23
|
|
|
26
24
|
var _useTableContext = useTableContext(),
|
|
27
|
-
groupedColumns = _useTableContext.groupedColumns,
|
|
28
|
-
resizable = _useTableContext.resizable,
|
|
29
|
-
colWidths = _useTableContext.colWidths,
|
|
30
|
-
isHoveredHighlightCol = _useTableContext.isHoveredHighlightCol,
|
|
31
|
-
isHighlightedCol = _useTableContext.isHighlightedCol,
|
|
32
|
-
getColgroupProps = _useTableContext.getColgroupProps,
|
|
33
|
-
onColumnResizable = _useTableContext.onColumnResizable,
|
|
34
|
-
getStickyColProps = _useTableContext.getStickyColProps,
|
|
35
25
|
onTableBodyScrollMock = _useTableContext.onTableBodyScrollMock,
|
|
36
26
|
scrollHeaderElementRef = _useTableContext.scrollHeaderElementRef,
|
|
37
|
-
|
|
38
|
-
getTableHeaderProps = _useTableContext.getTableHeaderProps,
|
|
39
|
-
showColMenu = _useTableContext.showColMenu;
|
|
27
|
+
getTableHeaderProps = _useTableContext.getTableHeaderProps;
|
|
40
28
|
|
|
41
|
-
var activeColumnKeysAction = useCheckState();
|
|
42
29
|
var cls = cx(prefixCls, className);
|
|
43
30
|
return /*#__PURE__*/React__default.createElement("div", Object.assign({
|
|
44
31
|
className: cls,
|
|
@@ -48,60 +35,9 @@ var TableHeader = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
48
35
|
width: '100%',
|
|
49
36
|
position: 'relative'
|
|
50
37
|
}
|
|
51
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
52
|
-
return /*#__PURE__*/React__default.createElement("col", Object.assign({
|
|
53
|
-
key: idx,
|
|
54
|
-
className: prefixCls + "-col"
|
|
55
|
-
}, getColgroupProps(col, idx)));
|
|
56
|
-
})), /*#__PURE__*/React__default.createElement("thead", {
|
|
38
|
+
}, /*#__PURE__*/React__default.createElement(ColGroupContent, null), /*#__PURE__*/React__default.createElement(TheadContent, {
|
|
57
39
|
onWheel: onTableBodyScrollMock
|
|
58
|
-
}
|
|
59
|
-
return /*#__PURE__*/React__default.createElement("tr", {
|
|
60
|
-
key: colsIndex
|
|
61
|
-
}, cols.map(function (col, colIndex) {
|
|
62
|
-
var _ref2 = col || {},
|
|
63
|
-
dataKey = _ref2.dataKey,
|
|
64
|
-
title = _ref2.title,
|
|
65
|
-
raw = _ref2.raw;
|
|
66
|
-
|
|
67
|
-
var titleContent = isFunction(title) ? title(col) : title;
|
|
68
|
-
var cell = /*#__PURE__*/React__default.createElement("th", Object.assign({
|
|
69
|
-
key: dataKey
|
|
70
|
-
}, getStickyColProps(col), {
|
|
71
|
-
className: cx(prefixCls + "-cell", raw.className, isHighlightedCol(dataKey) && prefixCls + "-cell__col--highlight", isHoveredHighlightCol(dataKey) && prefixCls + "-cell__col--hovered-highlight", activeColumnKeysAction.has(dataKey) && prefixCls + "-cell__col--active"),
|
|
72
|
-
// @ts-ignore
|
|
73
|
-
colSpan: col.colSpan,
|
|
74
|
-
// @ts-ignore
|
|
75
|
-
rowSpan: col.rowSpan
|
|
76
|
-
}), titleContent, renderFilter({
|
|
77
|
-
prefixCls: prefixCls + "-filter",
|
|
78
|
-
columnKey: dataKey,
|
|
79
|
-
showColMenu: showColMenu,
|
|
80
|
-
column: col,
|
|
81
|
-
onOpen: function onOpen() {
|
|
82
|
-
return activeColumnKeysAction.add(dataKey);
|
|
83
|
-
},
|
|
84
|
-
onClose: function onClose() {
|
|
85
|
-
return activeColumnKeysAction.remove(dataKey);
|
|
86
|
-
}
|
|
87
|
-
}));
|
|
88
|
-
return resizable && colIndex !== colWidths.length - 1 ? /*#__PURE__*/React__default.createElement(Resizable, {
|
|
89
|
-
key: colIndex,
|
|
90
|
-
className: prefixCls + "__resizable",
|
|
91
|
-
draggableOpts: {
|
|
92
|
-
enableUserSelectHack: false
|
|
93
|
-
},
|
|
94
|
-
handle: /*#__PURE__*/React__default.createElement("span", {
|
|
95
|
-
className: prefixCls + "__resizable-handle"
|
|
96
|
-
}),
|
|
97
|
-
height: 0,
|
|
98
|
-
width: colWidths[colIndex],
|
|
99
|
-
onResize: function onResize(evt, options) {
|
|
100
|
-
onColumnResizable(evt, options, colIndex);
|
|
101
|
-
}
|
|
102
|
-
}, cell) : cell;
|
|
103
|
-
}));
|
|
104
|
-
}))));
|
|
40
|
+
})));
|
|
105
41
|
});
|
|
106
42
|
|
|
107
43
|
if (__DEV__) {
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/** @LICENSE
|
|
2
|
+
* @hi-ui/table
|
|
3
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/table#readme
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
import React__default, { forwardRef } from 'react';
|
|
11
|
+
import { getPrefixCls } from '@hi-ui/classname';
|
|
12
|
+
import { __DEV__ } from '@hi-ui/env';
|
|
13
|
+
import { useLatestCallback } from '@hi-ui/use-latest';
|
|
14
|
+
import { isArrayNonEmpty } from '@hi-ui/type-assertion';
|
|
15
|
+
import { EmptyState } from '@hi-ui/empty-state';
|
|
16
|
+
import { TableRow } from './TableRow.js';
|
|
17
|
+
import { useTableContext } from './context.js';
|
|
18
|
+
|
|
19
|
+
var _prefix = getPrefixCls('table-body');
|
|
20
|
+
|
|
21
|
+
var TbodyContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
22
|
+
var _ref$prefixCls = _ref.prefixCls,
|
|
23
|
+
prefixCls = _ref$prefixCls === void 0 ? _prefix : _ref$prefixCls,
|
|
24
|
+
emptyContent = _ref.emptyContent;
|
|
25
|
+
|
|
26
|
+
var _useTableContext = useTableContext(),
|
|
27
|
+
columns = _useTableContext.columns,
|
|
28
|
+
isExpandTreeRows = _useTableContext.isExpandTreeRows,
|
|
29
|
+
transitionData = _useTableContext.transitionData,
|
|
30
|
+
scrollBodyElementRef = _useTableContext.scrollBodyElementRef,
|
|
31
|
+
hasAvgColumn = _useTableContext.hasAvgColumn,
|
|
32
|
+
avgRow = _useTableContext.avgRow,
|
|
33
|
+
hasSumColumn = _useTableContext.hasSumColumn,
|
|
34
|
+
sumRow = _useTableContext.sumRow,
|
|
35
|
+
measureRowElementRef = _useTableContext.measureRowElementRef;
|
|
36
|
+
|
|
37
|
+
var getRequiredProps = useLatestCallback(function (id) {
|
|
38
|
+
return {
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
expandedTree: isExpandTreeRows(id) // checked: isCheckedId(id),
|
|
41
|
+
// semiChecked: isSemiCheckedId(id),
|
|
42
|
+
// selected: selectedId === id,
|
|
43
|
+
// loading: isLoadingId(id),
|
|
44
|
+
// focused: focusedId === id,
|
|
45
|
+
|
|
46
|
+
};
|
|
47
|
+
}); // 外层增加 div 作为滚动容器
|
|
48
|
+
|
|
49
|
+
return /*#__PURE__*/React__default.createElement("tbody", null, isArrayNonEmpty(transitionData) ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, transitionData.map(function (row, index) {
|
|
50
|
+
return /*#__PURE__*/React__default.createElement(TableRow, Object.assign({
|
|
51
|
+
ref: index === 0 ? measureRowElementRef : null,
|
|
52
|
+
// key={depth + index}
|
|
53
|
+
key: row.id,
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
rowIndex: index,
|
|
56
|
+
rowData: row
|
|
57
|
+
}, getRequiredProps(row.id)));
|
|
58
|
+
}), hasSumColumn ? /*#__PURE__*/React__default.createElement(TableRow, {
|
|
59
|
+
key: sumRow.id,
|
|
60
|
+
rowIndex: transitionData.length,
|
|
61
|
+
rowData: sumRow,
|
|
62
|
+
isSumRow: true
|
|
63
|
+
}) : null, hasAvgColumn ? /*#__PURE__*/React__default.createElement(TableRow, {
|
|
64
|
+
key: avgRow.id,
|
|
65
|
+
rowIndex: transitionData.length + 1,
|
|
66
|
+
rowData: avgRow,
|
|
67
|
+
isAvgRow: true
|
|
68
|
+
}) : null) : // 空状态,colSpan 占满表格整行
|
|
69
|
+
renderEmptyContent(Object.assign({
|
|
70
|
+
className: prefixCls + "-empty-content",
|
|
71
|
+
colSpan: columns.length,
|
|
72
|
+
emptyContent: emptyContent
|
|
73
|
+
}, scrollBodyElementRef.current ? {
|
|
74
|
+
scrollBodyWidth: window.getComputedStyle(scrollBodyElementRef.current).getPropertyValue('width')
|
|
75
|
+
} : {})));
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
if (__DEV__) {
|
|
79
|
+
TbodyContent.displayName = 'TbodyContent';
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* 负责空状态渲染
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
var renderEmptyContent = function renderEmptyContent(_ref2) {
|
|
87
|
+
var className = _ref2.className,
|
|
88
|
+
colSpan = _ref2.colSpan,
|
|
89
|
+
emptyContent = _ref2.emptyContent,
|
|
90
|
+
scrollBodyWidth = _ref2.scrollBodyWidth;
|
|
91
|
+
return /*#__PURE__*/React__default.createElement("tr", {
|
|
92
|
+
className: className
|
|
93
|
+
}, /*#__PURE__*/React__default.createElement("td", {
|
|
94
|
+
colSpan: colSpan
|
|
95
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
96
|
+
style: {
|
|
97
|
+
position: 'sticky',
|
|
98
|
+
left: 0,
|
|
99
|
+
width: scrollBodyWidth !== null && scrollBodyWidth !== void 0 ? scrollBodyWidth : '100%',
|
|
100
|
+
overflow: 'hidden'
|
|
101
|
+
}
|
|
102
|
+
}, emptyContent || /*#__PURE__*/React__default.createElement(EmptyState, null))));
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export { TbodyContent, renderEmptyContent };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/** @LICENSE
|
|
2
|
+
* @hi-ui/table
|
|
3
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/table#readme
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
import { __rest } from 'tslib';
|
|
11
|
+
import React__default, { forwardRef } from 'react';
|
|
12
|
+
import { Resizable } from 'react-resizable';
|
|
13
|
+
import { getPrefixCls, cx } from '@hi-ui/classname';
|
|
14
|
+
import { __DEV__ } from '@hi-ui/env';
|
|
15
|
+
import { isFunction } from '@hi-ui/type-assertion';
|
|
16
|
+
import { useCheckState } from '@hi-ui/use-check-state';
|
|
17
|
+
import { useTableContext } from './context.js';
|
|
18
|
+
import { renderFilter } from './TableAdvancedFilter.js';
|
|
19
|
+
|
|
20
|
+
var _prefix = getPrefixCls('table-header');
|
|
21
|
+
|
|
22
|
+
var TheadContent = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
23
|
+
var _a$prefixCls = _a.prefixCls,
|
|
24
|
+
prefixCls = _a$prefixCls === void 0 ? _prefix : _a$prefixCls,
|
|
25
|
+
rest = __rest(_a, ["prefixCls"]);
|
|
26
|
+
|
|
27
|
+
var _useTableContext = useTableContext(),
|
|
28
|
+
groupedColumns = _useTableContext.groupedColumns,
|
|
29
|
+
resizable = _useTableContext.resizable,
|
|
30
|
+
colWidths = _useTableContext.colWidths,
|
|
31
|
+
isHoveredHighlightCol = _useTableContext.isHoveredHighlightCol,
|
|
32
|
+
isHighlightedCol = _useTableContext.isHighlightedCol,
|
|
33
|
+
onColumnResizable = _useTableContext.onColumnResizable,
|
|
34
|
+
getStickyColProps = _useTableContext.getStickyColProps,
|
|
35
|
+
showColMenu = _useTableContext.showColMenu;
|
|
36
|
+
|
|
37
|
+
var activeColumnKeysAction = useCheckState();
|
|
38
|
+
return /*#__PURE__*/React__default.createElement("thead", Object.assign({}, rest), groupedColumns.map(function (cols, colsIndex) {
|
|
39
|
+
return /*#__PURE__*/React__default.createElement("tr", {
|
|
40
|
+
key: colsIndex
|
|
41
|
+
}, cols.map(function (col, colIndex) {
|
|
42
|
+
var _ref = col || {},
|
|
43
|
+
dataKey = _ref.dataKey,
|
|
44
|
+
title = _ref.title,
|
|
45
|
+
raw = _ref.raw;
|
|
46
|
+
|
|
47
|
+
var titleContent = isFunction(title) ? title(col) : title;
|
|
48
|
+
var cell = /*#__PURE__*/React__default.createElement("th", Object.assign({
|
|
49
|
+
key: dataKey
|
|
50
|
+
}, getStickyColProps(col), {
|
|
51
|
+
className: cx(prefixCls + "-cell", raw.className, isHighlightedCol(dataKey) && prefixCls + "-cell__col--highlight", isHoveredHighlightCol(dataKey) && prefixCls + "-cell__col--hovered-highlight", activeColumnKeysAction.has(dataKey) && prefixCls + "-cell__col--active"),
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
colSpan: col.colSpan,
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
rowSpan: col.rowSpan
|
|
56
|
+
}), titleContent, renderFilter({
|
|
57
|
+
prefixCls: prefixCls + "-filter",
|
|
58
|
+
columnKey: dataKey,
|
|
59
|
+
showColMenu: showColMenu,
|
|
60
|
+
column: col,
|
|
61
|
+
onOpen: function onOpen() {
|
|
62
|
+
return activeColumnKeysAction.add(dataKey);
|
|
63
|
+
},
|
|
64
|
+
onClose: function onClose() {
|
|
65
|
+
return activeColumnKeysAction.remove(dataKey);
|
|
66
|
+
}
|
|
67
|
+
}));
|
|
68
|
+
return resizable && colIndex !== colWidths.length - 1 ? /*#__PURE__*/React__default.createElement(Resizable, {
|
|
69
|
+
key: colIndex,
|
|
70
|
+
className: prefixCls + "__resizable",
|
|
71
|
+
draggableOpts: {
|
|
72
|
+
enableUserSelectHack: false
|
|
73
|
+
},
|
|
74
|
+
handle: /*#__PURE__*/React__default.createElement("span", {
|
|
75
|
+
className: prefixCls + "__resizable-handle"
|
|
76
|
+
}),
|
|
77
|
+
height: 0,
|
|
78
|
+
width: colWidths[colIndex],
|
|
79
|
+
onResize: function onResize(evt, options) {
|
|
80
|
+
onColumnResizable(evt, options, colIndex);
|
|
81
|
+
}
|
|
82
|
+
}, cell) : cell;
|
|
83
|
+
}));
|
|
84
|
+
}));
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
if (__DEV__) {
|
|
88
|
+
TheadContent.displayName = 'TheadContent';
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export { TheadContent };
|
|
@@ -72,19 +72,17 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
72
72
|
var _resizeObserver = new ResizeObserver(function () {
|
|
73
73
|
if (virtual) {
|
|
74
74
|
setColWidths(getVirtualWidths());
|
|
75
|
-
} else {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
}
|
|
75
|
+
} // else {
|
|
76
|
+
// if (measureRowElement.childNodes) {
|
|
77
|
+
// const _realColumnsWidth = Array.from(measureRowElement.childNodes).map((node) => {
|
|
78
|
+
// return (node as HTMLElement).getBoundingClientRect().width || 0
|
|
79
|
+
// })
|
|
80
|
+
// if (_realColumnsWidth.some((width) => width && width > 0)) {
|
|
81
|
+
// setColWidths(_realColumnsWidth)
|
|
82
|
+
// }
|
|
83
|
+
// }
|
|
84
|
+
// }
|
|
85
|
+
|
|
88
86
|
});
|
|
89
87
|
|
|
90
88
|
_resizeObserver.observe(measureRowElement);
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
10
|
import __styleInject__ from 'style-inject';
|
|
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; }";
|
|
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, .hi-v4-table-content {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);
|
|
14
14
|
|
package/lib/esm/use-table.js
CHANGED
|
@@ -217,6 +217,14 @@ var useTable = function useTable(_a) {
|
|
|
217
217
|
}, [setFixedToColumn]);
|
|
218
218
|
|
|
219
219
|
var _React$useMemo = React__default.useMemo(function () {
|
|
220
|
+
if (!leftFreezeColumn && !rightFreezeColumn) {
|
|
221
|
+
return {
|
|
222
|
+
leftFrozenColKeys: [],
|
|
223
|
+
rightFrozenColKeys: [],
|
|
224
|
+
columns: mergedColumns2
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
220
228
|
var leftFrozenColKey = leftFreezeColumn;
|
|
221
229
|
var rightFrozenKey = rightFreezeColumn; // 获取左右冻结列的下标
|
|
222
230
|
// 获取左右冻结列的下标
|
|
@@ -435,16 +443,18 @@ var useTable = function useTable(_a) {
|
|
|
435
443
|
return !isArrayNonEmpty(col.children);
|
|
436
444
|
});
|
|
437
445
|
}, [mergedColumns1]);
|
|
438
|
-
var groupedColumns =
|
|
439
|
-
|
|
446
|
+
var groupedColumns = React__default.useMemo(function () {
|
|
447
|
+
return mergedColumns1.reduce(function (acc, cur) {
|
|
448
|
+
var depth = cur.depth;
|
|
440
449
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
450
|
+
if (!acc[depth]) {
|
|
451
|
+
acc[depth] = [];
|
|
452
|
+
}
|
|
444
453
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
454
|
+
acc[depth].push(cur);
|
|
455
|
+
return acc;
|
|
456
|
+
}, []);
|
|
457
|
+
}, [mergedColumns1]);
|
|
448
458
|
var getStickyColProps = useLatestCallback(function (column) {
|
|
449
459
|
var rightStickyWidth = column.rightStickyWidth,
|
|
450
460
|
leftStickyWidth = column.leftStickyWidth,
|
package/lib/types/BaseTable.d.ts
CHANGED