@hi-ui/table 4.3.1 → 4.3.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 +40 -0
- package/lib/cjs/BaseTable.js +136 -189
- package/lib/cjs/ColGroupContent.js +5 -28
- package/lib/cjs/SettingDrawer.js +76 -127
- package/lib/cjs/Table.js +107 -171
- package/lib/cjs/TableAdvancedFilter.js +49 -85
- package/lib/cjs/TableBody.js +33 -69
- package/lib/cjs/TableCell.js +56 -102
- package/lib/cjs/TableColumnMenu.js +39 -77
- package/lib/cjs/TableEmbedRow.js +11 -38
- package/lib/cjs/TableHeader.js +8 -33
- package/lib/cjs/TableRow.js +48 -88
- package/lib/cjs/TableSettingMenu.js +48 -94
- package/lib/cjs/TbodyContent.js +28 -56
- package/lib/cjs/TheadContent.js +20 -49
- package/lib/cjs/_virtual/index.js +0 -3
- package/lib/cjs/_virtual/index2.js +0 -3
- package/lib/cjs/_virtual/react-is.development.js +0 -3
- package/lib/cjs/_virtual/react-is.production.min.js +0 -3
- package/lib/cjs/context.js +0 -9
- package/lib/cjs/hooks/use-async-switch.js +13 -51
- package/lib/cjs/hooks/use-check.js +47 -77
- package/lib/cjs/hooks/use-col-hidden.js +16 -28
- package/lib/cjs/hooks/use-col-set.js +5 -18
- package/lib/cjs/hooks/use-col-sorter.js +18 -32
- package/lib/cjs/hooks/use-col-width.js +21 -57
- package/lib/cjs/hooks/use-colgroup.js +63 -85
- package/lib/cjs/hooks/use-drag.js +10 -31
- package/lib/cjs/hooks/use-embed-expand.js +23 -68
- package/lib/cjs/hooks/use-expand.js +32 -64
- package/lib/cjs/hooks/use-pagination.js +19 -50
- package/lib/cjs/hooks/use-queue.js +2 -14
- package/lib/cjs/icons/index.js +4 -21
- package/lib/cjs/index.js +0 -4
- package/lib/cjs/node_modules/classnames/index.js +2 -11
- package/lib/cjs/node_modules/perfect-scrollbar/dist/perfect-scrollbar.esm.js +31 -227
- package/lib/cjs/node_modules/rc-resize-observer/es/index.js +10 -68
- package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/Children/toArray.js +1 -17
- package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/Dom/findDOMNode.js +1 -14
- package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/ref.js +1 -25
- package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/warning.js +1 -5
- package/lib/cjs/node_modules/rc-util/es/Dom/canUseDom.js +0 -2
- package/lib/cjs/node_modules/rc-util/es/Dom/findDOMNode.js +1 -14
- package/lib/cjs/node_modules/rc-util/es/hooks/useLayoutEffect.js +2 -9
- package/lib/cjs/node_modules/rc-util/es/raf.js +0 -11
- package/lib/cjs/node_modules/rc-virtual-list/es/Filler.js +6 -25
- package/lib/cjs/node_modules/rc-virtual-list/es/Item.js +3 -14
- package/lib/cjs/node_modules/rc-virtual-list/es/List.js +103 -194
- package/lib/cjs/node_modules/rc-virtual-list/es/ScrollBar.js +16 -96
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useChildren.js +2 -11
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useDiffItem.js +8 -34
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useFrameWheel.js +0 -10
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useHeights.js +6 -39
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useMobileTouchMove.js +0 -16
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useOriginScroll.js +4 -9
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useScrollTo.js +3 -28
- package/lib/cjs/node_modules/rc-virtual-list/es/index.js +0 -2
- package/lib/cjs/node_modules/rc-virtual-list/es/utils/CacheMap.js +2 -9
- package/lib/cjs/node_modules/rc-virtual-list/es/utils/algorithmUtil.js +0 -15
- package/lib/cjs/node_modules/rc-virtual-list/es/utils/isFirefox.js +0 -2
- package/lib/cjs/node_modules/react-is/cjs/react-is.development.js +3 -29
- package/lib/cjs/node_modules/react-is/cjs/react-is.production.min.js +19 -45
- package/lib/cjs/node_modules/react-is/index.js +0 -5
- package/lib/cjs/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +83 -248
- package/lib/cjs/packages/hooks/use-merge-refs/lib/esm/index.js +3 -14
- package/lib/cjs/packages/ui/scrollbar/lib/esm/Scrollbar.js +48 -86
- package/lib/cjs/packages/ui/scrollbar/lib/esm/styles/index.scss.js +1 -15
- package/lib/cjs/packages/ui/scrollbar/lib/esm/utils/index.js +0 -13
- package/lib/cjs/styles/index.scss.js +1 -4
- package/lib/cjs/use-table.js +268 -355
- package/lib/cjs/utils/index.js +11 -45
- package/lib/esm/BaseTable.js +117 -138
- package/lib/esm/ColGroupContent.js +3 -9
- package/lib/esm/SettingDrawer.js +64 -83
- package/lib/esm/Table.js +97 -124
- package/lib/esm/TableAdvancedFilter.js +37 -47
- package/lib/esm/TableBody.js +24 -34
- package/lib/esm/TableCell.js +48 -72
- package/lib/esm/TableColumnMenu.js +24 -38
- package/lib/esm/TableEmbedRow.js +8 -15
- package/lib/esm/TableHeader.js +5 -11
- package/lib/esm/TableRow.js +36 -51
- package/lib/esm/TableSettingMenu.js +33 -49
- package/lib/esm/TbodyContent.js +20 -27
- package/lib/esm/TheadContent.js +14 -21
- package/lib/esm/context.js +0 -4
- package/lib/esm/hooks/use-async-switch.js +9 -28
- package/lib/esm/hooks/use-check.js +42 -55
- package/lib/esm/hooks/use-col-hidden.js +16 -21
- package/lib/esm/hooks/use-col-set.js +5 -13
- package/lib/esm/hooks/use-col-sorter.js +18 -23
- package/lib/esm/hooks/use-col-width.js +14 -34
- package/lib/esm/hooks/use-colgroup.js +60 -66
- package/lib/esm/hooks/use-drag.js +9 -13
- package/lib/esm/hooks/use-embed-expand.js +20 -42
- package/lib/esm/hooks/use-expand.js +32 -56
- package/lib/esm/hooks/use-pagination.js +13 -25
- package/lib/esm/hooks/use-queue.js +2 -10
- package/lib/esm/node_modules/classnames/index.js +2 -9
- package/lib/esm/node_modules/perfect-scrollbar/dist/perfect-scrollbar.esm.js +31 -228
- package/lib/esm/node_modules/rc-resize-observer/es/index.js +3 -26
- package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/Children/toArray.js +0 -3
- package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/Dom/findDOMNode.js +1 -2
- package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/ref.js +0 -8
- package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/warning.js +0 -5
- package/lib/esm/node_modules/rc-util/es/Dom/canUseDom.js +0 -1
- package/lib/esm/node_modules/rc-util/es/Dom/findDOMNode.js +1 -2
- package/lib/esm/node_modules/rc-util/es/hooks/useLayoutEffect.js +1 -0
- package/lib/esm/node_modules/rc-util/es/raf.js +0 -10
- package/lib/esm/node_modules/rc-virtual-list/es/Filler.js +4 -15
- package/lib/esm/node_modules/rc-virtual-list/es/Item.js +1 -3
- package/lib/esm/node_modules/rc-virtual-list/es/List.js +101 -174
- package/lib/esm/node_modules/rc-virtual-list/es/ScrollBar.js +14 -86
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useChildren.js +0 -2
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useDiffItem.js +6 -25
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useFrameWheel.js +0 -6
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useHeights.js +4 -28
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useMobileTouchMove.js +0 -13
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useOriginScroll.js +4 -8
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useScrollTo.js +1 -19
- package/lib/esm/node_modules/rc-virtual-list/es/index.js +1 -1
- package/lib/esm/node_modules/rc-virtual-list/es/utils/CacheMap.js +2 -8
- package/lib/esm/node_modules/rc-virtual-list/es/utils/algorithmUtil.js +1 -12
- package/lib/esm/node_modules/rc-virtual-list/es/utils/isFirefox.js +0 -1
- package/lib/esm/node_modules/react-is/cjs/react-is.development.js +4 -27
- package/lib/esm/node_modules/react-is/cjs/react-is.production.min.js +20 -44
- package/lib/esm/node_modules/react-is/index.js +0 -1
- package/lib/esm/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +82 -248
- package/lib/esm/packages/hooks/use-merge-refs/lib/esm/index.js +3 -9
- package/lib/esm/packages/ui/scrollbar/lib/esm/Scrollbar.js +47 -64
- package/lib/esm/packages/ui/scrollbar/lib/esm/styles/index.scss.js +1 -3
- package/lib/esm/packages/ui/scrollbar/lib/esm/utils/index.js +0 -10
- package/lib/esm/styles/index.scss.js +1 -3
- package/lib/esm/use-table.js +261 -318
- package/lib/esm/utils/index.js +11 -41
- package/lib/types/BaseTable.d.ts +2 -2
- package/package.json +33 -33
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @hi-ui/table
|
|
2
2
|
|
|
3
|
+
## 4.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2672](https://github.com/XiaoMi/hiui/pull/2672) [`1ebe27830`](https://github.com/XiaoMi/hiui/commit/1ebe2783098b3a8cd980bd10076d67635463800e) Thanks [@zyprepare](https://github.com/zyprepare)! - build: 升级到 rollup3,重新构建发布组件
|
|
8
|
+
|
|
9
|
+
- [#2671](https://github.com/XiaoMi/hiui/pull/2671) [`6d7909444`](https://github.com/XiaoMi/hiui/commit/6d790944418f36689b34805f858a1268530864b9) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复组件参数类型错误
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`1ebe27830`](https://github.com/XiaoMi/hiui/commit/1ebe2783098b3a8cd980bd10076d67635463800e)]:
|
|
12
|
+
- @hi-ui/core@4.0.6
|
|
13
|
+
- @hi-ui/use-cache@4.0.2
|
|
14
|
+
- @hi-ui/use-check@4.0.3
|
|
15
|
+
- @hi-ui/use-check-state@4.0.2
|
|
16
|
+
- @hi-ui/use-drag-sorter@4.0.2
|
|
17
|
+
- @hi-ui/use-latest@4.0.2
|
|
18
|
+
- @hi-ui/use-toggle@4.0.2
|
|
19
|
+
- @hi-ui/use-uncontrolled-state@4.0.2
|
|
20
|
+
- @hi-ui/use-update-effect@4.0.2
|
|
21
|
+
- @hi-ui/icons@4.0.16
|
|
22
|
+
- @hi-ui/button@4.0.7
|
|
23
|
+
- @hi-ui/checkbox@4.0.6
|
|
24
|
+
- @hi-ui/drawer@4.1.1
|
|
25
|
+
- @hi-ui/empty-state@4.0.5
|
|
26
|
+
- @hi-ui/icon-button@4.0.6
|
|
27
|
+
- @hi-ui/loading@4.1.1
|
|
28
|
+
- @hi-ui/pagination@4.0.12
|
|
29
|
+
- @hi-ui/popper@4.1.1
|
|
30
|
+
- @hi-ui/select@4.2.3
|
|
31
|
+
- @hi-ui/spinner@4.0.6
|
|
32
|
+
- @hi-ui/array-utils@4.0.2
|
|
33
|
+
- @hi-ui/classname@4.0.2
|
|
34
|
+
- @hi-ui/dom-utils@4.0.5
|
|
35
|
+
- @hi-ui/env@4.0.2
|
|
36
|
+
- @hi-ui/func-utils@4.0.2
|
|
37
|
+
- @hi-ui/object-utils@4.0.2
|
|
38
|
+
- @hi-ui/react-utils@4.0.2
|
|
39
|
+
- @hi-ui/times@4.0.2
|
|
40
|
+
- @hi-ui/tree-utils@4.1.2
|
|
41
|
+
- @hi-ui/type-assertion@4.0.2
|
|
42
|
+
|
|
3
43
|
## 4.3.1
|
|
4
44
|
|
|
5
45
|
### Patch Changes
|
package/lib/cjs/BaseTable.js
CHANGED
|
@@ -9,115 +9,78 @@
|
|
|
9
9
|
*/
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
13
|
-
|
|
14
|
-
Object.defineProperty(exports, '__esModule', {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
|
|
18
12
|
var tslib = require('tslib');
|
|
19
|
-
|
|
20
13
|
var React = require('react');
|
|
21
|
-
|
|
22
14
|
var classname = require('@hi-ui/classname');
|
|
23
|
-
|
|
24
15
|
var env = require('@hi-ui/env');
|
|
25
|
-
|
|
26
16
|
var core = require('@hi-ui/core');
|
|
27
|
-
|
|
28
17
|
var iconButton = require('@hi-ui/icon-button');
|
|
29
|
-
|
|
30
18
|
var icons = require('@hi-ui/icons');
|
|
31
|
-
|
|
32
19
|
var typeAssertion = require('@hi-ui/type-assertion');
|
|
33
|
-
|
|
34
20
|
var TableBody = require('./TableBody.js');
|
|
35
|
-
|
|
36
21
|
var TableHeader = require('./TableHeader.js');
|
|
37
|
-
|
|
38
22
|
var index$1 = require('./icons/index.js');
|
|
39
|
-
|
|
40
23
|
var context = require('./context.js');
|
|
41
|
-
|
|
42
24
|
var index = require('./utils/index.js');
|
|
43
|
-
|
|
44
25
|
var useTable = require('./use-table.js');
|
|
45
|
-
|
|
46
26
|
var useEmbedExpand = require('./hooks/use-embed-expand.js');
|
|
47
|
-
|
|
48
27
|
var TheadContent = require('./TheadContent.js');
|
|
49
|
-
|
|
50
28
|
var ColGroupContent = require('./ColGroupContent.js');
|
|
51
|
-
|
|
52
29
|
var TbodyContent = require('./TbodyContent.js');
|
|
53
|
-
|
|
54
|
-
function _interopDefaultLegacy(e) {
|
|
55
|
-
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
56
|
-
'default': e
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
61
|
-
|
|
62
30
|
var _role = 'table';
|
|
63
|
-
|
|
64
31
|
var _prefix = classname.getPrefixCls('table');
|
|
65
|
-
|
|
66
32
|
var EMBED_DATA_KEY = "TABLE_EMBED_DATA_KEY_" + index.uuid();
|
|
67
33
|
var DEFAULT_COLUMNS = [];
|
|
68
34
|
var DEFAULT_DATA = [];
|
|
69
35
|
var BaseTable = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
70
36
|
var _a$prefixCls = _a.prefixCls,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
37
|
+
prefixCls = _a$prefixCls === void 0 ? _prefix : _a$prefixCls,
|
|
38
|
+
_a$role = _a.role,
|
|
39
|
+
role = _a$role === void 0 ? _role : _a$role,
|
|
40
|
+
className = _a.className,
|
|
41
|
+
_a$columns = _a.columns,
|
|
42
|
+
columns = _a$columns === void 0 ? DEFAULT_COLUMNS : _a$columns,
|
|
43
|
+
_a$data = _a.data,
|
|
44
|
+
data = _a$data === void 0 ? DEFAULT_DATA : _a$data,
|
|
45
|
+
_a$striped = _a.striped,
|
|
46
|
+
striped = _a$striped === void 0 ? false : _a$striped,
|
|
47
|
+
borderedProp = _a.bordered,
|
|
48
|
+
rowExpandable = _a.rowExpandable,
|
|
49
|
+
defaultExpandedEmbedRowKeys = _a.defaultExpandedEmbedRowKeys,
|
|
50
|
+
expandedEmbedRowKeys = _a.expandedEmbedRowKeys,
|
|
51
|
+
onEmbedExpand = _a.onEmbedExpand,
|
|
52
|
+
expandedRender = _a.expandedRender,
|
|
53
|
+
_a$size = _a.size,
|
|
54
|
+
size = _a$size === void 0 ? 'md' : _a$size,
|
|
55
|
+
extra = _a.extra,
|
|
56
|
+
onRow = _a.onRow,
|
|
57
|
+
stickyFooter = _a.stickyFooter,
|
|
58
|
+
_a$stickyFooterBottom = _a.stickyFooterBottom,
|
|
59
|
+
stickyFooterBottom = _a$stickyFooterBottom === void 0 ? 0 : _a$stickyFooterBottom,
|
|
60
|
+
_a$fixedColumnTrigger = _a.fixedColumnTrigger,
|
|
61
|
+
fixedColumnTrigger = _a$fixedColumnTrigger === void 0 ? 'auto' : _a$fixedColumnTrigger,
|
|
62
|
+
emptyContent = _a.emptyContent,
|
|
63
|
+
virtual = _a.virtual,
|
|
64
|
+
needDoubleTable = _a.needDoubleTable,
|
|
65
|
+
rest = tslib.__rest(_a, ["prefixCls", "role", "className", "columns", "data", "striped", "bordered", "rowExpandable", "defaultExpandedEmbedRowKeys", "expandedEmbedRowKeys", "onEmbedExpand", "expandedRender", "size", "extra", "onRow", "onHeaderRow", "stickyFooter", "stickyFooterBottom", "fixedColumnTrigger", "emptyContent", "virtual", "needDoubleTable"]);
|
|
66
|
+
// ********************** 内嵌式面板 *********************** //
|
|
102
67
|
var _useEmbedExpand = useEmbedExpand.useEmbedExpand({
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
68
|
+
defaultExpandedEmbedRowKeys: defaultExpandedEmbedRowKeys,
|
|
69
|
+
rowExpandable: rowExpandable,
|
|
70
|
+
expandedEmbedRowKeys: expandedEmbedRowKeys,
|
|
71
|
+
onEmbedExpand: onEmbedExpand,
|
|
72
|
+
expandedRender: expandedRender
|
|
73
|
+
}),
|
|
74
|
+
embedExpandable = _useEmbedExpand.embedExpandable,
|
|
75
|
+
onEmbedSwitch = _useEmbedExpand.onEmbedSwitch,
|
|
76
|
+
isEmbedLoadingId = _useEmbedExpand.isEmbedLoadingId,
|
|
77
|
+
getEmbedPanelById = _useEmbedExpand.getEmbedPanelById,
|
|
78
|
+
isExpandEmbedRows = _useEmbedExpand.isExpandEmbedRows,
|
|
79
|
+
onExpandEmbedRowsChange = _useEmbedExpand.onExpandEmbedRowsChange;
|
|
115
80
|
/**
|
|
116
81
|
* 表格列展开折叠操作区
|
|
117
82
|
*/
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
var getEmbedPanelColumn = React__default["default"].useCallback(function (embedExpandable) {
|
|
83
|
+
var getEmbedPanelColumn = React.useCallback(function (embedExpandable) {
|
|
121
84
|
var embedPanelColumn = {
|
|
122
85
|
dataKey: EMBED_DATA_KEY,
|
|
123
86
|
title: '',
|
|
@@ -138,111 +101,104 @@ var BaseTable = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
138
101
|
onSwitch: function onSwitch(shouldExpanded) {
|
|
139
102
|
onExpandEmbedRowsChange(rowItem, shouldExpanded);
|
|
140
103
|
},
|
|
141
|
-
expandedIcon: /*#__PURE__*/
|
|
142
|
-
collapsedIcon: /*#__PURE__*/
|
|
104
|
+
expandedIcon: /*#__PURE__*/React.createElement(icons.MinusSquareOutlined, null),
|
|
105
|
+
collapsedIcon: /*#__PURE__*/React.createElement(icons.PlusSquareOutlined, null)
|
|
143
106
|
});
|
|
144
107
|
}
|
|
145
108
|
};
|
|
146
109
|
return embedPanelColumn;
|
|
147
110
|
}, [prefixCls, isExpandEmbedRows, onExpandEmbedRowsChange, isEmbedLoadingId]);
|
|
148
|
-
var mergedColumns =
|
|
111
|
+
var mergedColumns = React.useMemo(function () {
|
|
149
112
|
if (embedExpandable) {
|
|
150
113
|
var embedColumn = getEmbedPanelColumn(embedExpandable);
|
|
151
114
|
return [embedColumn].concat(columns);
|
|
152
115
|
}
|
|
153
|
-
|
|
154
116
|
return columns;
|
|
155
117
|
}, [embedExpandable, getEmbedPanelColumn, columns]);
|
|
156
118
|
var i18n = core.useLocaleContext();
|
|
157
|
-
|
|
158
119
|
var _useMemo = React.useMemo(function () {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
hasAvgColumn = _useMemo.hasAvgColumn;
|
|
187
|
-
|
|
120
|
+
// 确保包含 avg 属性,且值为数字类型的字符串
|
|
121
|
+
var avgRow = {
|
|
122
|
+
id: 'avg',
|
|
123
|
+
raw: {
|
|
124
|
+
key: 'avg'
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
var hasAvgColumn = false;
|
|
128
|
+
columns.forEach(function (column, index$1) {
|
|
129
|
+
if (index$1 === 0) {
|
|
130
|
+
// @ts-ignore
|
|
131
|
+
avgRow.raw[column.dataKey] = i18n.get('table.average');
|
|
132
|
+
}
|
|
133
|
+
if (index.checkNeedTotalOrEvg(data, column, 'avg')) {
|
|
134
|
+
hasAvgColumn = true;
|
|
135
|
+
// @ts-ignore
|
|
136
|
+
// @ts-ignore
|
|
137
|
+
avgRow.raw[column.dataKey] = index.getTotalOrEvgRowData(data, column, true);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
return {
|
|
141
|
+
avgRow: avgRow,
|
|
142
|
+
hasAvgColumn: hasAvgColumn
|
|
143
|
+
};
|
|
144
|
+
}, [columns, data, i18n]),
|
|
145
|
+
avgRow = _useMemo.avgRow,
|
|
146
|
+
hasAvgColumn = _useMemo.hasAvgColumn;
|
|
188
147
|
var _useMemo2 = React.useMemo(function () {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
hasSumColumn = _useMemo2.hasSumColumn;
|
|
219
|
-
|
|
148
|
+
// 确保包含total属性,且值为数字类型的字符串
|
|
149
|
+
var sumRow = {
|
|
150
|
+
id: 'sum',
|
|
151
|
+
raw: {
|
|
152
|
+
key: 'sum'
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
var hasSumColumn = false;
|
|
156
|
+
columns.forEach(function (column, index$1) {
|
|
157
|
+
if (index$1 === 0) {
|
|
158
|
+
// @ts-ignore
|
|
159
|
+
sumRow.raw[column.dataKey] = i18n.get('table.total');
|
|
160
|
+
}
|
|
161
|
+
if (index.checkNeedTotalOrEvg(data, column, 'total')) {
|
|
162
|
+
hasSumColumn = true;
|
|
163
|
+
// 获取当前数据最大小数点个数,并设置最后总和值小数点
|
|
164
|
+
// @ts-ignore
|
|
165
|
+
// 获取当前数据最大小数点个数,并设置最后总和值小数点
|
|
166
|
+
// @ts-ignore
|
|
167
|
+
sumRow.raw[column.dataKey] = index.getTotalOrEvgRowData(data, column, false);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
return {
|
|
171
|
+
sumRow: sumRow,
|
|
172
|
+
hasSumColumn: hasSumColumn
|
|
173
|
+
};
|
|
174
|
+
}, [columns, data, i18n]),
|
|
175
|
+
sumRow = _useMemo2.sumRow,
|
|
176
|
+
hasSumColumn = _useMemo2.hasSumColumn;
|
|
220
177
|
var providedValue = useTable.useTable(Object.assign(Object.assign({}, rest), {
|
|
221
178
|
columns: mergedColumns,
|
|
222
179
|
data: data,
|
|
223
180
|
virtual: virtual
|
|
224
181
|
}));
|
|
225
182
|
var rootProps = providedValue.rootProps,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
183
|
+
bordered = providedValue.bordered,
|
|
184
|
+
leftFrozenColKeys = providedValue.leftFrozenColKeys,
|
|
185
|
+
rightFrozenColKeys = providedValue.rightFrozenColKeys,
|
|
186
|
+
leftFixedColumnsWidth = providedValue.leftFixedColumnsWidth,
|
|
187
|
+
rightFixedColumnsWidth = providedValue.rightFixedColumnsWidth,
|
|
188
|
+
scrollSize = providedValue.scrollSize,
|
|
189
|
+
getTableHeaderProps = providedValue.getTableHeaderProps,
|
|
190
|
+
scrollBodyElementRef = providedValue.scrollBodyElementRef,
|
|
191
|
+
onTableBodyScroll = providedValue.onTableBodyScroll,
|
|
192
|
+
canScroll = providedValue.canScroll,
|
|
193
|
+
bodyTableRef = providedValue.bodyTableRef,
|
|
194
|
+
scrollWidth = providedValue.scrollWidth,
|
|
195
|
+
footerRender = providedValue.footerRender;
|
|
239
196
|
var hasBorder = borderedProp !== null && borderedProp !== void 0 ? borderedProp : bordered;
|
|
240
197
|
var extraHeader = extra && extra.header;
|
|
241
198
|
var extraFooter = extra && extra.footer;
|
|
242
199
|
var alwaysFixedColumn = fixedColumnTrigger === 'always';
|
|
243
|
-
|
|
244
200
|
var renderTable = function renderTable() {
|
|
245
|
-
return needDoubleTable ? /*#__PURE__*/
|
|
201
|
+
return needDoubleTable ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", Object.assign({}, getTableHeaderProps()), /*#__PURE__*/React.createElement(TableHeader.TableHeader, null), extraHeader ? /*#__PURE__*/React.createElement("div", {
|
|
246
202
|
style: {
|
|
247
203
|
position: 'absolute',
|
|
248
204
|
right: 0,
|
|
@@ -250,9 +206,9 @@ var BaseTable = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
250
206
|
bottom: 0,
|
|
251
207
|
top: 0
|
|
252
208
|
}
|
|
253
|
-
}, extraHeader) : null), /*#__PURE__*/
|
|
209
|
+
}, extraHeader) : null), /*#__PURE__*/React.createElement(TableBody.TableBody, {
|
|
254
210
|
emptyContent: emptyContent
|
|
255
|
-
})) : /*#__PURE__*/
|
|
211
|
+
})) : /*#__PURE__*/React.createElement("div", {
|
|
256
212
|
ref: scrollBodyElementRef,
|
|
257
213
|
className: prefixCls + "-content",
|
|
258
214
|
onScroll: onTableBodyScroll,
|
|
@@ -260,45 +216,43 @@ var BaseTable = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
260
216
|
// 表格宽度大于div宽度才出现横向滚动条
|
|
261
217
|
overflowX: canScroll ? 'scroll' : undefined
|
|
262
218
|
}
|
|
263
|
-
}, /*#__PURE__*/
|
|
219
|
+
}, /*#__PURE__*/React.createElement("table", {
|
|
264
220
|
ref: bodyTableRef,
|
|
265
221
|
style: {
|
|
266
222
|
width: canScroll && scrollWidth !== undefined ? scrollWidth : '100%'
|
|
267
223
|
}
|
|
268
|
-
}, /*#__PURE__*/
|
|
224
|
+
}, /*#__PURE__*/React.createElement(ColGroupContent.ColGroupContent, null), /*#__PURE__*/React.createElement(TheadContent.TheadContent, null), /*#__PURE__*/React.createElement(TbodyContent.TbodyContent, {
|
|
269
225
|
emptyContent: emptyContent
|
|
270
226
|
})));
|
|
271
227
|
};
|
|
272
|
-
|
|
273
228
|
var renderFreezeShadow = function renderFreezeShadow() {
|
|
274
|
-
return /*#__PURE__*/
|
|
229
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, (alwaysFixedColumn || scrollSize.scrollLeft > 0) && leftFrozenColKeys.length > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
275
230
|
className: prefixCls + "-freeze-shadow " + prefixCls + "-freeze-shadow--left",
|
|
276
231
|
style: {
|
|
277
232
|
width: leftFixedColumnsWidth + 'px'
|
|
278
233
|
}
|
|
279
|
-
}) : null, (alwaysFixedColumn || scrollSize.scrollRight > 0) && rightFrozenColKeys.length > 0 ? /*#__PURE__*/
|
|
234
|
+
}) : null, (alwaysFixedColumn || scrollSize.scrollRight > 0) && rightFrozenColKeys.length > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
280
235
|
className: prefixCls + "-freeze-shadow " + prefixCls + "-freeze-shadow--right",
|
|
281
236
|
style: {
|
|
282
237
|
width: rightFixedColumnsWidth + 'px'
|
|
283
238
|
}
|
|
284
239
|
}) : null);
|
|
285
240
|
};
|
|
286
|
-
|
|
287
|
-
var tableFooter = /*#__PURE__*/React__default["default"].createElement("div", {
|
|
241
|
+
var tableFooter = /*#__PURE__*/React.createElement("div", {
|
|
288
242
|
className: prefixCls + "-footer",
|
|
289
243
|
style: stickyFooter ? {
|
|
290
244
|
position: 'sticky',
|
|
291
245
|
bottom: stickyFooterBottom
|
|
292
246
|
} : undefined
|
|
293
|
-
}, typeAssertion.isFunction(footerRender) ? footerRender( /*#__PURE__*/
|
|
247
|
+
}, typeAssertion.isFunction(footerRender) ? footerRender( /*#__PURE__*/React.createElement(React.Fragment, null, extraFooter)) : extraFooter);
|
|
294
248
|
var cls = classname.cx(prefixCls, className, hasBorder && prefixCls + "--bordered", striped && prefixCls + "--striped", size && prefixCls + "--size-" + size, virtual && prefixCls + "--virtual");
|
|
295
|
-
return /*#__PURE__*/
|
|
249
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
296
250
|
ref: ref,
|
|
297
251
|
role: role,
|
|
298
252
|
className: cls
|
|
299
|
-
}, rootProps), /*#__PURE__*/
|
|
253
|
+
}, rootProps), /*#__PURE__*/React.createElement("div", {
|
|
300
254
|
className: prefixCls + "__wrapper"
|
|
301
|
-
}, /*#__PURE__*/
|
|
255
|
+
}, /*#__PURE__*/React.createElement(context.TableProvider, {
|
|
302
256
|
value: Object.assign(Object.assign({}, providedValue), {
|
|
303
257
|
striped: striped,
|
|
304
258
|
onRow: onRow,
|
|
@@ -316,33 +270,28 @@ var BaseTable = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
316
270
|
})
|
|
317
271
|
}, renderTable()), renderFreezeShadow()), tableFooter);
|
|
318
272
|
});
|
|
319
|
-
|
|
320
273
|
if (env.__DEV__) {
|
|
321
274
|
BaseTable.displayName = 'BaseTable';
|
|
322
275
|
}
|
|
323
|
-
|
|
324
276
|
var renderSwitcher = function renderSwitcher(_ref) {
|
|
325
277
|
var prefixCls = _ref.prefixCls,
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
if ( /*#__PURE__*/React__default["default"].isValidElement(rowExpand)) {
|
|
278
|
+
rowExpand = _ref.rowExpand,
|
|
279
|
+
loading = _ref.loading,
|
|
280
|
+
expanded = _ref.expanded,
|
|
281
|
+
onSwitch = _ref.onSwitch,
|
|
282
|
+
expandedIcon = _ref.expandedIcon,
|
|
283
|
+
collapsedIcon = _ref.collapsedIcon;
|
|
284
|
+
if ( /*#__PURE__*/React.isValidElement(rowExpand)) {
|
|
334
285
|
return rowExpand;
|
|
335
286
|
}
|
|
336
|
-
|
|
337
287
|
if (rowExpand === true) {
|
|
338
288
|
if (loading) {
|
|
339
|
-
return /*#__PURE__*/
|
|
289
|
+
return /*#__PURE__*/React.createElement(iconButton.IconButton, {
|
|
340
290
|
className: classname.cx(prefixCls + "__switcher", prefixCls + "__switcher--loading"),
|
|
341
291
|
icon: index$1.defaultLoadingIcon
|
|
342
292
|
});
|
|
343
293
|
}
|
|
344
|
-
|
|
345
|
-
return /*#__PURE__*/React__default["default"].createElement(iconButton.IconButton, {
|
|
294
|
+
return /*#__PURE__*/React.createElement(iconButton.IconButton, {
|
|
346
295
|
tabIndex: -1,
|
|
347
296
|
className: classname.cx(prefixCls + "__switcher", prefixCls + "__switcher--" + (expanded ? 'expanded' : 'collapse')),
|
|
348
297
|
icon: expanded ? expandedIcon : collapsedIcon,
|
|
@@ -353,9 +302,7 @@ var renderSwitcher = function renderSwitcher(_ref) {
|
|
|
353
302
|
}
|
|
354
303
|
});
|
|
355
304
|
}
|
|
356
|
-
|
|
357
305
|
return null;
|
|
358
306
|
};
|
|
359
|
-
|
|
360
307
|
exports.BaseTable = BaseTable;
|
|
361
308
|
exports.EMBED_DATA_KEY = EMBED_DATA_KEY;
|
|
@@ -9,48 +9,25 @@
|
|
|
9
9
|
*/
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
13
|
-
|
|
14
|
-
Object.defineProperty(exports, '__esModule', {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
|
|
18
12
|
var React = require('react');
|
|
19
|
-
|
|
20
13
|
var classname = require('@hi-ui/classname');
|
|
21
|
-
|
|
22
14
|
var env = require('@hi-ui/env');
|
|
23
|
-
|
|
24
15
|
var context = require('./context.js');
|
|
25
|
-
|
|
26
|
-
function _interopDefaultLegacy(e) {
|
|
27
|
-
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
28
|
-
'default': e
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
33
|
-
|
|
34
16
|
var _prefix = classname.getPrefixCls('table-colgroup');
|
|
35
|
-
|
|
36
17
|
var ColGroupContent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
37
18
|
var _ref$prefixCls = _ref.prefixCls,
|
|
38
|
-
|
|
39
|
-
|
|
19
|
+
prefixCls = _ref$prefixCls === void 0 ? _prefix : _ref$prefixCls;
|
|
40
20
|
var _useTableContext = context.useTableContext(),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return /*#__PURE__*/React__default["default"].createElement("col", Object.assign({
|
|
21
|
+
getColgroupProps = _useTableContext.getColgroupProps,
|
|
22
|
+
leafColumns = _useTableContext.leafColumns;
|
|
23
|
+
return /*#__PURE__*/React.createElement("colgroup", null, leafColumns.map(function (col, idx) {
|
|
24
|
+
return /*#__PURE__*/React.createElement("col", Object.assign({
|
|
46
25
|
key: idx,
|
|
47
26
|
className: prefixCls + "-col"
|
|
48
27
|
}, getColgroupProps(col, idx)));
|
|
49
28
|
}));
|
|
50
29
|
});
|
|
51
|
-
|
|
52
30
|
if (env.__DEV__) {
|
|
53
31
|
ColGroupContent.displayName = 'ColGroupContent';
|
|
54
32
|
}
|
|
55
|
-
|
|
56
33
|
exports.ColGroupContent = ColGroupContent;
|