@aloudata/aloudata-design 0.3.1 → 0.3.4
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/README.md +15 -5
- package/es/Breadcrumb/index.d.ts +1 -0
- package/es/Button/index.js +3 -2
- package/es/Button/style/index.less +135 -126
- package/es/Button/style/variables.less +53 -53
- package/es/Card/index.d.ts +3 -0
- package/es/Card/index.js +3 -0
- package/es/Card/style/index.d.ts +2 -0
- package/es/Card/style/index.js +2 -0
- package/es/Card/style/index.less +1 -0
- package/es/Checkbox/index.d.ts +1 -0
- package/es/ConfigProvider/defaultRenderEmpty.d.ts +4 -0
- package/es/ConfigProvider/defaultRenderEmpty.js +37 -0
- package/es/ConfigProvider/sizeContext.d.ts +9 -0
- package/es/ConfigProvider/sizeContext.js +12 -0
- package/es/Dropdown/Button.js +4 -3
- package/es/Empty/image/Authority.d.ts +1 -0
- package/es/Empty/image/Dataspace.d.ts +1 -0
- package/es/Empty/image/Search.d.ts +1 -0
- package/es/Empty/image/Simple.d.ts +1 -0
- package/es/Empty/image/Worksheet.d.ts +1 -0
- package/es/Empty/image/empty.d.ts +1 -0
- package/es/Icon/icons/CheckLine.d.ts +13 -0
- package/es/Icon/icons/CheckLine.js +73 -0
- package/es/Icon/icons.json +410 -0
- package/es/Input/components/Group/index.d.ts +3 -1
- package/es/Input/components/Group/index.js +6 -12
- package/es/Input/components/Input/index.d.ts +3 -2
- package/es/Input/components/Input/index.js +11 -23
- package/es/Input/components/Password/index.js +11 -16
- package/es/Input/components/TextArea/index.d.ts +8 -1
- package/es/Input/components/TextArea/index.js +8 -1
- package/es/Input/style/index.less +180 -102
- package/es/InputNumber/index.d.ts +1 -0
- package/es/InputNumber/style/index.less +69 -69
- package/es/Menu/Divider.d.ts +1 -0
- package/es/Modal/index.js +20 -16
- package/es/Modal/locale.d.ts +7 -0
- package/es/Modal/locale.js +20 -0
- package/es/Modal/style/index.less +48 -45
- package/es/Navigator/components/Header/index.d.ts +1 -0
- package/es/Navigator/components/Menu/index.d.ts +1 -0
- package/es/Navigator/components/MenuItem/index.d.ts +1 -1
- package/es/Navigator/index.d.ts +1 -1
- package/es/PageHeader/index.d.ts +3 -0
- package/es/PageHeader/index.js +3 -0
- package/es/PageHeader/style/index.d.ts +2 -0
- package/es/PageHeader/style/index.js +2 -0
- package/es/PageHeader/style/index.less +1 -0
- package/es/Popover/index.d.ts +1 -0
- package/es/Radio/components/Group/index.d.ts +6 -0
- package/es/Radio/components/Group/index.js +72 -0
- package/es/Radio/components/Radio/index.d.ts +3 -0
- package/es/Radio/components/Radio/index.js +95 -0
- package/es/Radio/index.d.ts +9 -2
- package/es/Radio/index.js +5 -3
- package/es/Radio/interface/radio.d.ts +24 -0
- package/es/Radio/interface/radio.js +1 -0
- package/es/Radio/interface/radioGroup.d.ts +42 -0
- package/es/Radio/interface/radioGroup.js +1 -0
- package/es/Radio/style/index.less +348 -0
- package/es/Select/index.js +1 -1
- package/es/Select/rc-select/OptionList.js +4 -4
- package/es/Select/rc-select/Selector/MultipleSelector.js +11 -1
- package/es/Select/rc-select/hooks/useOptions.d.ts +1 -1
- package/es/Select/style/index.less +70 -45
- package/es/Select/style/variables.less +45 -45
- package/es/Select/utils/iconUtil.d.ts +2 -2
- package/es/Select/utils/iconUtil.js +9 -5
- package/es/Steps/components/ProcessIcon/index.d.ts +6 -0
- package/es/Steps/components/ProcessIcon/index.js +8 -0
- package/es/Steps/components/Step/index.d.ts +20 -0
- package/es/Steps/components/Step/index.js +45 -0
- package/es/Steps/index.d.ts +36 -2
- package/es/Steps/index.js +30 -1
- package/es/Steps/matchMedia.mock.d.ts +1 -0
- package/es/Steps/matchMedia.mock.js +17 -0
- package/es/Steps/style/index.less +251 -0
- package/es/Switch/index.d.ts +46 -2
- package/es/Switch/index.js +71 -1
- package/es/Switch/style/index.less +129 -0
- package/es/Table/Table.d.ts +2 -1
- package/es/Table/Table.js +223 -330
- package/es/Table/components/Empty/index.d.ts +3 -0
- package/es/Table/components/Empty/index.js +17 -0
- package/es/Table/components/Loading/index.d.ts +3 -0
- package/es/Table/components/Loading/index.js +19 -0
- package/es/Table/components/TableBodyRowList/index.d.ts +13 -0
- package/es/Table/components/TableBodyRowList/index.js +89 -0
- package/es/Table/components/TableHead/index.d.ts +23 -0
- package/es/Table/components/TableHead/index.js +262 -0
- package/es/Table/constant.d.ts +1 -0
- package/es/Table/constant.js +1 -0
- package/es/Table/hooks/useFrame.d.ts +7 -0
- package/es/Table/hooks/useFrame.js +90 -0
- package/es/Table/hooks/useTableColumn.d.ts +28 -0
- package/es/Table/hooks/useTableColumn.js +53 -0
- package/es/Table/interface.d.ts +3 -2
- package/es/Table/style/index.less +33 -30
- package/es/Table/utils.d.ts +15 -0
- package/es/Table/utils.js +131 -0
- package/es/Tabs/index.js +7 -9
- package/es/Tabs/style/index.less +57 -25
- package/es/_utils/hooks/useId.d.ts +4 -0
- package/es/_utils/hooks/useId.js +23 -0
- package/es/index.d.ts +9 -5
- package/es/index.js +3 -1
- package/es/locale/default.d.ts +2 -0
- package/es/locale/default.js +2 -0
- package/es/locale/en_US.d.ts +3 -0
- package/es/locale/en_US.js +132 -0
- package/es/locale/zh_CN.d.ts +3 -2
- package/es/locale/zh_CN.js +131 -2
- package/es/locale-provider/LocaleReceiver.d.ts +4 -0
- package/es/locale-provider/LocaleReceiver.js +3 -0
- package/es/locale-provider/context.d.ts +7 -0
- package/es/locale-provider/context.js +3 -0
- package/es/locale-provider/default.d.ts +2 -0
- package/es/locale-provider/default.js +2 -0
- package/es/locale-provider/en_US.d.ts +2 -0
- package/es/locale-provider/en_US.js +2 -0
- package/es/locale-provider/index.d.ts +65 -0
- package/es/locale-provider/index.js +102 -0
- package/es/locale-provider/style/index.d.ts +1 -0
- package/es/locale-provider/style/index.js +1 -0
- package/es/locale-provider/style/index.less +2 -0
- package/es/locale-provider/zh_CN.d.ts +2 -0
- package/es/locale-provider/zh_CN.js +2 -0
- package/es/style/index.d.ts +0 -1
- package/es/style/index.js +0 -1
- package/es/style/index.less +2 -2
- package/es/style/themes/default/index.less +30 -30
- package/lib/Breadcrumb/index.d.ts +1 -0
- package/lib/Button/index.js +5 -3
- package/lib/Button/style/index.less +135 -126
- package/lib/Button/style/variables.less +53 -53
- package/lib/Card/index.d.ts +3 -0
- package/lib/Card/index.js +15 -0
- package/lib/Card/style/index.d.ts +2 -0
- package/lib/Card/style/index.js +5 -0
- package/lib/Card/style/index.less +1 -0
- package/lib/Checkbox/index.d.ts +1 -0
- package/lib/ConfigProvider/defaultRenderEmpty.d.ts +4 -0
- package/lib/ConfigProvider/defaultRenderEmpty.js +55 -0
- package/lib/ConfigProvider/sizeContext.d.ts +9 -0
- package/lib/ConfigProvider/sizeContext.js +30 -0
- package/lib/Dropdown/Button.js +8 -6
- package/lib/Empty/image/Authority.d.ts +1 -0
- package/lib/Empty/image/Dataspace.d.ts +1 -0
- package/lib/Empty/image/Search.d.ts +1 -0
- package/lib/Empty/image/Simple.d.ts +1 -0
- package/lib/Empty/image/Worksheet.d.ts +1 -0
- package/lib/Empty/image/empty.d.ts +1 -0
- package/lib/Icon/icons/CheckLine.d.ts +13 -0
- package/lib/Icon/icons/CheckLine.js +90 -0
- package/lib/Icon/icons.json +410 -0
- package/lib/Input/components/Group/index.d.ts +3 -1
- package/lib/Input/components/Group/index.js +7 -12
- package/lib/Input/components/Input/index.d.ts +3 -2
- package/lib/Input/components/Input/index.js +13 -23
- package/lib/Input/components/Password/index.js +13 -17
- package/lib/Input/components/TextArea/index.d.ts +8 -1
- package/lib/Input/components/TextArea/index.js +10 -1
- package/lib/Input/style/index.less +180 -102
- package/lib/InputNumber/index.d.ts +1 -0
- package/lib/InputNumber/style/index.less +69 -69
- package/lib/Menu/Divider.d.ts +1 -0
- package/lib/Modal/index.js +25 -18
- package/lib/Modal/locale.d.ts +7 -0
- package/lib/Modal/locale.js +31 -0
- package/lib/Modal/style/index.less +48 -45
- package/lib/Navigator/components/Header/index.d.ts +1 -0
- package/lib/Navigator/components/Menu/index.d.ts +1 -0
- package/lib/Navigator/components/MenuItem/index.d.ts +1 -1
- package/lib/Navigator/index.d.ts +1 -1
- package/lib/PageHeader/index.d.ts +3 -0
- package/lib/PageHeader/index.js +15 -0
- package/lib/PageHeader/style/index.d.ts +2 -0
- package/lib/PageHeader/style/index.js +5 -0
- package/lib/PageHeader/style/index.less +1 -0
- package/lib/Popover/index.d.ts +1 -0
- package/lib/Radio/components/Group/index.d.ts +6 -0
- package/lib/Radio/components/Group/index.js +93 -0
- package/lib/Radio/components/Radio/index.d.ts +3 -0
- package/lib/Radio/components/Radio/index.js +115 -0
- package/lib/Radio/index.d.ts +9 -2
- package/lib/Radio/index.js +5 -3
- package/lib/Radio/interface/radio.d.ts +24 -0
- package/lib/Radio/interface/radio.js +5 -0
- package/lib/Radio/interface/radioGroup.d.ts +42 -0
- package/lib/Radio/interface/radioGroup.js +5 -0
- package/lib/Radio/style/index.less +348 -0
- package/lib/Select/index.js +1 -1
- package/lib/Select/rc-select/OptionList.js +8 -7
- package/lib/Select/rc-select/Selector/MultipleSelector.js +11 -1
- package/lib/Select/rc-select/hooks/useOptions.d.ts +1 -1
- package/lib/Select/style/index.less +70 -45
- package/lib/Select/style/variables.less +45 -45
- package/lib/Select/utils/iconUtil.d.ts +2 -2
- package/lib/Select/utils/iconUtil.js +13 -7
- package/lib/Steps/components/ProcessIcon/index.d.ts +6 -0
- package/lib/Steps/components/ProcessIcon/index.js +19 -0
- package/lib/Steps/components/Step/index.d.ts +20 -0
- package/lib/Steps/components/Step/index.js +61 -0
- package/lib/Steps/index.d.ts +36 -2
- package/lib/Steps/index.js +34 -1
- package/lib/Steps/matchMedia.mock.d.ts +1 -0
- package/lib/Steps/matchMedia.mock.js +17 -0
- package/lib/Steps/style/index.less +251 -0
- package/lib/Switch/index.d.ts +46 -2
- package/lib/Switch/index.js +78 -1
- package/lib/Switch/style/index.less +129 -0
- package/lib/Table/Table.d.ts +2 -1
- package/lib/Table/Table.js +228 -332
- package/lib/Table/components/Empty/index.d.ts +3 -0
- package/lib/Table/components/Empty/index.js +30 -0
- package/lib/Table/components/Loading/index.d.ts +3 -0
- package/lib/Table/components/Loading/index.js +33 -0
- package/lib/Table/components/TableBodyRowList/index.d.ts +13 -0
- package/lib/Table/components/TableBodyRowList/index.js +108 -0
- package/lib/Table/components/TableHead/index.d.ts +23 -0
- package/lib/Table/components/TableHead/index.js +286 -0
- package/lib/Table/constant.d.ts +1 -0
- package/lib/Table/constant.js +1 -0
- package/lib/Table/hooks/useFrame.d.ts +7 -0
- package/lib/Table/hooks/useFrame.js +98 -0
- package/lib/Table/hooks/useTableColumn.d.ts +28 -0
- package/lib/Table/hooks/useTableColumn.js +66 -0
- package/lib/Table/interface.d.ts +3 -2
- package/lib/Table/style/index.less +33 -30
- package/lib/Table/utils.d.ts +15 -0
- package/lib/Table/utils.js +147 -0
- package/lib/Tabs/index.js +9 -11
- package/lib/Tabs/style/index.less +57 -25
- package/lib/_utils/hooks/useId.d.ts +4 -0
- package/lib/_utils/hooks/useId.js +36 -0
- package/lib/index.d.ts +9 -5
- package/lib/index.js +16 -0
- package/lib/locale/default.d.ts +2 -0
- package/lib/locale/default.js +13 -0
- package/lib/locale/en_US.d.ts +3 -0
- package/lib/locale/en_US.js +146 -0
- package/lib/locale/zh_CN.d.ts +3 -2
- package/lib/locale/zh_CN.js +134 -2
- package/lib/locale-provider/LocaleReceiver.d.ts +4 -0
- package/lib/locale-provider/LocaleReceiver.js +23 -0
- package/lib/locale-provider/context.d.ts +7 -0
- package/lib/locale-provider/context.js +12 -0
- package/lib/locale-provider/default.d.ts +2 -0
- package/lib/locale-provider/default.js +13 -0
- package/lib/locale-provider/en_US.d.ts +2 -0
- package/lib/locale-provider/en_US.js +13 -0
- package/lib/locale-provider/index.d.ts +65 -0
- package/lib/locale-provider/index.js +116 -0
- package/lib/locale-provider/style/index.d.ts +1 -0
- package/lib/locale-provider/style/index.js +3 -0
- package/lib/locale-provider/style/index.less +2 -0
- package/lib/locale-provider/zh_CN.d.ts +2 -0
- package/lib/locale-provider/zh_CN.js +13 -0
- package/lib/style/index.d.ts +0 -1
- package/lib/style/index.js +0 -2
- package/lib/style/index.less +2 -2
- package/lib/style/themes/default/index.less +30 -30
- package/package.json +11 -8
package/es/Table/Table.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
var _excluded = ["style"],
|
|
2
|
-
_excluded2 = ["style"];
|
|
3
|
-
|
|
4
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
5
|
-
|
|
6
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
7
|
-
|
|
8
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
2
|
|
|
10
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -25,22 +18,22 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
25
18
|
|
|
26
19
|
/* eslint-disable no-unneeded-ternary */
|
|
27
20
|
/// <reference types ='./react-table-config' />
|
|
28
|
-
import _ from 'lodash';
|
|
29
21
|
import classnames from 'classnames';
|
|
30
|
-
import
|
|
31
|
-
import Ascending from '../Icon/icons/SortAscendingLine';
|
|
32
|
-
import LoadingIcon from '../Icon/icons/Loading';
|
|
33
|
-
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
22
|
+
import React, { useEffect, useMemo, useRef, useState, useCallback } from 'react';
|
|
34
23
|
import usePrefixCls from '../_utils/hooks/usePrefixCls';
|
|
35
|
-
import InfiniteScroll from 'react-infinite-scroll-component';
|
|
36
24
|
import ResizeObserver from 'rc-resize-observer';
|
|
37
|
-
import
|
|
38
|
-
import {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
25
|
+
import { useTable, useBlockLayout, useRowSelect, useSortBy, useResizeColumns } from 'react-table';
|
|
26
|
+
import { getColumnsWidthMap, getValidScrollThreshold } from './utils';
|
|
27
|
+
import './style/index';
|
|
28
|
+
import message from '../message';
|
|
29
|
+
import Loading from './components/Loading';
|
|
30
|
+
import Empty from './components/Empty';
|
|
31
|
+
import TableHead from './components/TableHead';
|
|
32
|
+
import TableBodyRowList from './components/TableBodyRowList';
|
|
33
|
+
import { useTimeoutLock } from './hooks/useFrame';
|
|
34
|
+
var TABLE_HEAD_ROW_HEIGHT = 48;
|
|
35
|
+
var SCROLLBAR_SIZE = 15;
|
|
36
|
+
var ZERO = 0;
|
|
44
37
|
|
|
45
38
|
function Table(props, ref) {
|
|
46
39
|
var _classnames3;
|
|
@@ -59,79 +52,78 @@ function Table(props, ref) {
|
|
|
59
52
|
allSortDirections = props.sortDirections,
|
|
60
53
|
_props$onChange = props.onChange,
|
|
61
54
|
onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
|
|
62
|
-
_props$innerScroll = props.innerScroll,
|
|
63
|
-
innerScroll = _props$innerScroll === void 0 ? false : _props$innerScroll,
|
|
64
55
|
_props$scrollThreshol = props.scrollThreshold,
|
|
65
56
|
scrollThreshold = _props$scrollThreshol === void 0 ? '150px' : _props$scrollThreshol,
|
|
66
57
|
_props$rowClassName = props.rowClassName,
|
|
67
58
|
rowClassName = _props$rowClassName === void 0 ? '' : _props$rowClassName,
|
|
68
59
|
_props$ellipsis = props.ellipsis,
|
|
69
60
|
ellipsis = _props$ellipsis === void 0 ? true : _props$ellipsis,
|
|
70
|
-
rowKey = props.rowKey
|
|
61
|
+
rowKey = props.rowKey,
|
|
62
|
+
height = props.height;
|
|
71
63
|
|
|
72
|
-
var
|
|
73
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
74
|
-
selectedRowId = _React$useState2[0],
|
|
75
|
-
setSelectedRowId = _React$useState2[1];
|
|
76
|
-
|
|
77
|
-
var tableBodyListRef = useRef(null);
|
|
78
|
-
var tableRef = useRef(null);
|
|
79
|
-
|
|
80
|
-
var _useState = useState(DEFAULT_BODY_HEIGHT),
|
|
64
|
+
var _useState = useState(ZERO),
|
|
81
65
|
_useState2 = _slicedToArray(_useState, 2),
|
|
82
66
|
tableClientWidth = _useState2[0],
|
|
83
67
|
setTableClientWidth = _useState2[1];
|
|
84
68
|
|
|
85
|
-
var
|
|
86
|
-
|
|
87
|
-
var _useState3 = useState(DEFAULT_ROW_WIDTH),
|
|
69
|
+
var _useState3 = useState(ZERO),
|
|
88
70
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
89
|
-
|
|
90
|
-
|
|
71
|
+
tableClientHeight = _useState4[0],
|
|
72
|
+
setTableClientHeight = _useState4[1];
|
|
73
|
+
|
|
74
|
+
var prefixCls = usePrefixCls('', 'ald-table');
|
|
75
|
+
var tableRef = useRef(null);
|
|
76
|
+
var tableHeadRef = useRef(null);
|
|
77
|
+
var tableBodyRef = useRef(null);
|
|
78
|
+
var columnsRef = useRef([]);
|
|
79
|
+
var columnsWidthMapRef = useRef();
|
|
80
|
+
var columnsTotalWidthRef = useRef(ZERO);
|
|
81
|
+
|
|
82
|
+
var _useState5 = useState(false),
|
|
83
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
84
|
+
loadMoreLoading = _useState6[0],
|
|
85
|
+
setLoadMoreLoading = _useState6[1];
|
|
86
|
+
|
|
87
|
+
var lastOffsetLeftRef = useRef(ZERO);
|
|
88
|
+
var lastOffsetTopRef = useRef(ZERO);
|
|
89
|
+
|
|
90
|
+
var _useTimeoutLock = useTimeoutLock(),
|
|
91
|
+
_useTimeoutLock2 = _slicedToArray(_useTimeoutLock, 2),
|
|
92
|
+
setScrollTarget = _useTimeoutLock2[0],
|
|
93
|
+
getScrollTarget = _useTimeoutLock2[1]; // 记录初始columns, 后续更改不响应
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
if (columns && columnsRef.current.length === ZERO) {
|
|
97
|
+
columnsRef.current = columns;
|
|
98
|
+
} // 初始化进入时 渲染表格容器宽度
|
|
91
99
|
|
|
92
100
|
|
|
93
101
|
useEffect(function () {
|
|
94
102
|
if (tableRef.current) {
|
|
95
103
|
setTableClientWidth(tableRef.current.clientWidth);
|
|
96
104
|
}
|
|
97
|
-
}, [
|
|
98
|
-
var initialColumnsWidthMap = useMemo(function () {
|
|
99
|
-
var map = new Map();
|
|
100
|
-
|
|
101
|
-
if (tableClientWidth !== DEFAULT_BODY_HEIGHT) {
|
|
102
|
-
var noGivenColumns = 0;
|
|
103
|
-
var givenColumnsTotalWidth = 0;
|
|
104
|
-
columns.forEach(function (column) {
|
|
105
|
-
if (column.width) {
|
|
106
|
-
map.set(column.dataIndex, column.width);
|
|
107
|
-
givenColumnsTotalWidth += column.width;
|
|
108
|
-
} else {
|
|
109
|
-
noGivenColumns += 1;
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
var averageWidth = (tableClientWidth - givenColumnsTotalWidth) / noGivenColumns;
|
|
113
|
-
return {
|
|
114
|
-
columnMap: map,
|
|
115
|
-
averageWidth: averageWidth
|
|
116
|
-
};
|
|
117
|
-
}
|
|
105
|
+
}, []); // 转换外部传入的columns
|
|
118
106
|
|
|
119
|
-
columns.forEach(function (column) {
|
|
120
|
-
if (column.width) {
|
|
121
|
-
map.set(column.dataIndex, column.width);
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
return {
|
|
125
|
-
columnMap: map,
|
|
126
|
-
averageWidth: DEFAULT_ROW_WIDTH
|
|
127
|
-
};
|
|
128
|
-
}, [columns, tableClientWidth]);
|
|
129
107
|
var newColumns = useMemo(function () {
|
|
130
|
-
|
|
108
|
+
var _getColumnsWidthMap = getColumnsWidthMap(columnsRef.current, tableClientWidth, columnsWidthMapRef.current),
|
|
109
|
+
columnsWidthMap = _getColumnsWidthMap.columnsWidthMap,
|
|
110
|
+
totalColumnWidth = _getColumnsWidthMap.totalColumnWidth;
|
|
111
|
+
|
|
112
|
+
columnsWidthMapRef.current = columnsWidthMap;
|
|
113
|
+
columnsTotalWidthRef.current = totalColumnWidth;
|
|
114
|
+
return columnsRef.current.map(function (column, index) {
|
|
115
|
+
var _columnsWidthMapRef$c, _columnsWidthMapRef$c2;
|
|
116
|
+
|
|
117
|
+
var key = index.toString(); // 不设置dataIndex同时进行排序 则报错
|
|
118
|
+
|
|
119
|
+
if (!column.dataIndex === undefined && sortable) {
|
|
120
|
+
message.error('不支持未设置dataIndex时进行排序设置');
|
|
121
|
+
}
|
|
122
|
+
|
|
131
123
|
return _objectSpread(_objectSpread({}, column), {}, {
|
|
132
|
-
width:
|
|
124
|
+
width: (_columnsWidthMapRef$c = columnsWidthMapRef.current) === null || _columnsWidthMapRef$c === void 0 ? void 0 : (_columnsWidthMapRef$c2 = _columnsWidthMapRef$c.get(key)) === null || _columnsWidthMapRef$c2 === void 0 ? void 0 : _columnsWidthMapRef$c2.width,
|
|
133
125
|
Header: column.title ? column.title : function () {
|
|
134
|
-
return null;
|
|
126
|
+
return /*#__PURE__*/React.createElement("span", null, "\xA0");
|
|
135
127
|
},
|
|
136
128
|
disableSortBy: !sortable || typeof column.sorter === 'boolean',
|
|
137
129
|
accessor: column.dataIndex,
|
|
@@ -142,51 +134,10 @@ function Table(props, ref) {
|
|
|
142
134
|
}
|
|
143
135
|
});
|
|
144
136
|
});
|
|
145
|
-
}, [
|
|
137
|
+
}, [sortable, tableClientWidth]); // 将rowId转为React Table支持的值
|
|
138
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
146
139
|
|
|
147
|
-
var
|
|
148
|
-
id: newColumns[ARRAY_FIRST_INDEX].accessor,
|
|
149
|
-
desc: newColumns[ARRAY_FIRST_INDEX].sortOrder && newColumns[ARRAY_FIRST_INDEX].sortOrder === 'descend' ? true : false
|
|
150
|
-
}; // 如果支持排序 但是没有默认排序 则默认按第一列倒叙排序
|
|
151
|
-
|
|
152
|
-
var getInitialSortDirection = function getInitialSortDirection() {
|
|
153
|
-
if (defaultSort && defaultSort.id) {
|
|
154
|
-
return defaultSort;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (sortable) {
|
|
158
|
-
return defaultSortObject;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return {
|
|
162
|
-
id: '',
|
|
163
|
-
desc: false
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
var _React$useState3 = React.useState(getInitialSortDirection()),
|
|
168
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
169
|
-
sortDirection = _React$useState4[0],
|
|
170
|
-
setSortDirection = _React$useState4[1];
|
|
171
|
-
|
|
172
|
-
var getInitSortBy = function getInitSortBy() {
|
|
173
|
-
if (!(sortDirection === null || sortDirection === void 0 ? void 0 : sortDirection.id)) {
|
|
174
|
-
return [];
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
var sortColumn = newColumns.find(function (column) {
|
|
178
|
-
return column.accessor === sortDirection.id;
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
if (sortColumn === null || sortColumn === void 0 ? void 0 : sortColumn.sorter) {
|
|
182
|
-
return [];
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return [sortDirection];
|
|
186
|
-
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
var getRowIdFn = function getRowIdFn(row, relativeIndex, parent) {
|
|
140
|
+
var transformRowId = function transformRowId(row, relativeIndex, parent) {
|
|
190
141
|
if (rowKey && parent) {
|
|
191
142
|
if (typeof rowKey === 'string') {
|
|
192
143
|
return [rowKey, relativeIndex].join('.');
|
|
@@ -198,6 +149,24 @@ function Table(props, ref) {
|
|
|
198
149
|
}
|
|
199
150
|
|
|
200
151
|
return relativeIndex.toString();
|
|
152
|
+
}; // 计算初始传递给 React Table的排序字段
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
var getTableInitSort = function getTableInitSort() {
|
|
156
|
+
if (defaultSort && defaultSort.id) {
|
|
157
|
+
return [defaultSort];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
var firstColumnSortData = {
|
|
161
|
+
id: newColumns[ZERO].accessor,
|
|
162
|
+
desc: !!(newColumns[ZERO].sortOrder && newColumns[ZERO].sortOrder === 'descend')
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
if (firstColumnSortData.id) {
|
|
166
|
+
return [firstColumnSortData];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return [];
|
|
201
170
|
};
|
|
202
171
|
|
|
203
172
|
var _useTable = useTable({
|
|
@@ -205,9 +174,9 @@ function Table(props, ref) {
|
|
|
205
174
|
data: data,
|
|
206
175
|
disableMultiSort: true,
|
|
207
176
|
disableSortBy: !sortable,
|
|
208
|
-
getRowId:
|
|
177
|
+
getRowId: transformRowId,
|
|
209
178
|
initialState: {
|
|
210
|
-
sortBy:
|
|
179
|
+
sortBy: getTableInitSort()
|
|
211
180
|
}
|
|
212
181
|
}, useBlockLayout, useSortBy, useRowSelect, useResizeColumns),
|
|
213
182
|
getTableProps = _useTable.getTableProps,
|
|
@@ -215,259 +184,183 @@ function Table(props, ref) {
|
|
|
215
184
|
headerGroups = _useTable.headerGroups,
|
|
216
185
|
rows = _useTable.rows,
|
|
217
186
|
prepareRow = _useTable.prepareRow,
|
|
218
|
-
setSortBy = _useTable.setSortBy
|
|
219
|
-
totalColumnsWidth = _useTable.totalColumnsWidth;
|
|
187
|
+
setSortBy = _useTable.setSortBy;
|
|
220
188
|
|
|
221
|
-
var
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
if (
|
|
225
|
-
|
|
189
|
+
var scrollToTop = function scrollToTop() {
|
|
190
|
+
var INITIAL_OFFSET_TOP = 0;
|
|
191
|
+
|
|
192
|
+
if (tableBodyRef && tableBodyRef.current) {
|
|
193
|
+
tableBodyRef.current.scrollTop = INITIAL_OFFSET_TOP;
|
|
226
194
|
}
|
|
195
|
+
};
|
|
227
196
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
var getSortBy = function getSortBy(id) {
|
|
234
|
-
var sortDirections = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['ascend', 'descend'];
|
|
235
|
-
var // 如果传了sortDirections,则使用传入的,否则使用默认的
|
|
236
|
-
sortOrder = arguments.length > 2 ? arguments[2] : undefined;
|
|
237
|
-
var res = {
|
|
238
|
-
id: id,
|
|
239
|
-
desc: undefined
|
|
197
|
+
React.useImperativeHandle(ref, function () {
|
|
198
|
+
return {
|
|
199
|
+
backToTop: function backToTop() {
|
|
200
|
+
scrollToTop();
|
|
201
|
+
}
|
|
240
202
|
};
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
203
|
+
});
|
|
204
|
+
var tableHeadNode = /*#__PURE__*/React.createElement(TableHead, {
|
|
205
|
+
canResizeColumn: resizeColumn,
|
|
206
|
+
headerGroups: headerGroups,
|
|
207
|
+
tableContentWidth: columnsTotalWidthRef.current,
|
|
208
|
+
defaultSort: defaultSort,
|
|
209
|
+
sortable: sortable,
|
|
210
|
+
columns: newColumns,
|
|
211
|
+
sortDirections: allSortDirections,
|
|
212
|
+
setSortBy: setSortBy,
|
|
213
|
+
onChange: onChange,
|
|
214
|
+
columnsWidthMapRef: columnsWidthMapRef,
|
|
215
|
+
columnsTotalWidthRef: columnsTotalWidthRef
|
|
216
|
+
});
|
|
217
|
+
var tableRowListNode = /*#__PURE__*/React.createElement(TableBodyRowList, {
|
|
218
|
+
data: data,
|
|
219
|
+
rows: rows,
|
|
220
|
+
prepareRow: prepareRow,
|
|
221
|
+
columnsTotalWidthRef: columnsTotalWidthRef,
|
|
222
|
+
rowClassName: rowClassName,
|
|
223
|
+
ellipsis: ellipsis,
|
|
224
|
+
onRowSelected: onRowSelected
|
|
225
|
+
}); // 渲染没有设置高度的表格
|
|
226
|
+
|
|
227
|
+
var renderTableWithoutHeight = function renderTableWithoutHeight() {
|
|
228
|
+
var renderNoHeightTableBody = function renderNoHeightTableBody() {
|
|
229
|
+
if (loading && !rows.length) {
|
|
230
|
+
return /*#__PURE__*/React.createElement(Loading, null);
|
|
250
231
|
}
|
|
251
232
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
233
|
+
if (!loading && !rows.length) {
|
|
234
|
+
return /*#__PURE__*/React.createElement(Empty, null);
|
|
235
|
+
}
|
|
255
236
|
|
|
237
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
238
|
+
className: "".concat(prefixCls, "-list")
|
|
239
|
+
}, tableRowListNode);
|
|
240
|
+
};
|
|
256
241
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
242
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
243
|
+
className: classnames("".concat(prefixCls, "-inner-wrap"))
|
|
244
|
+
}, tableHeadNode, /*#__PURE__*/React.createElement("div", Object.assign({}, getTableBodyProps(), {
|
|
245
|
+
className: classnames("".concat(prefixCls, "-tbody")),
|
|
246
|
+
style: {
|
|
247
|
+
width: columnsTotalWidthRef.current
|
|
248
|
+
}
|
|
249
|
+
}), renderNoHeightTableBody()));
|
|
250
|
+
};
|
|
261
251
|
|
|
252
|
+
var forceScroll = useCallback(function (scrollLeftNum, target) {
|
|
253
|
+
if (!target) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
262
256
|
|
|
263
|
-
|
|
257
|
+
if (typeof target === 'function') {
|
|
258
|
+
target(scrollLeftNum);
|
|
259
|
+
} else if (target.scrollLeft !== scrollLeftNum) {
|
|
260
|
+
// eslint-disable-next-line no-param-reassign
|
|
261
|
+
target.scrollLeft = scrollLeftNum;
|
|
262
|
+
}
|
|
263
|
+
}, []); // 内部滚动时 纵向的滚动
|
|
264
264
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
265
|
+
var onBodyVerticalScroll = useCallback(function (target) {
|
|
266
|
+
var scrollHeight = target.scrollHeight,
|
|
267
|
+
clientHeight = target.clientHeight,
|
|
268
|
+
scrollTop = target.scrollTop;
|
|
269
|
+
var currentPosToBottomGap = scrollHeight - clientHeight - scrollTop;
|
|
270
|
+
var scrollThresholdValue = getValidScrollThreshold(scrollThreshold, tableClientHeight);
|
|
268
271
|
|
|
269
|
-
|
|
270
|
-
|
|
272
|
+
if (currentPosToBottomGap < scrollThresholdValue && hasNextPage && !loadMoreLoading) {
|
|
273
|
+
var _loadMore;
|
|
271
274
|
|
|
272
|
-
|
|
273
|
-
|
|
275
|
+
setLoadMoreLoading(true);
|
|
276
|
+
(_loadMore = loadMore()) === null || _loadMore === void 0 ? void 0 : _loadMore.then(function () {
|
|
277
|
+
setLoadMoreLoading(false);
|
|
278
|
+
});
|
|
274
279
|
}
|
|
275
280
|
|
|
276
|
-
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
var getHeaderProps = function getHeaderProps(column) {
|
|
280
|
-
// @ts-ignore
|
|
281
|
-
var id = column.id,
|
|
282
|
-
canSort = column.canSort,
|
|
283
|
-
sorter = column.sorter,
|
|
284
|
-
sortOrder = column.sortOrder,
|
|
285
|
-
sortDirections = column.sortDirections;
|
|
286
|
-
var toggleProps = column.getSortByToggleProps(); // 仅在Table设置sortable时,所有列的canSort为true,此时为前端排序
|
|
287
|
-
|
|
288
|
-
if (canSort) {
|
|
289
|
-
// client sort
|
|
290
|
-
return _objectSpread(_objectSpread({}, column.getHeaderProps(_objectSpread({}, toggleProps))), {}, {
|
|
291
|
-
onClick: function onClick(e) {
|
|
292
|
-
e.stopPropagation();
|
|
293
|
-
|
|
294
|
-
if (typeof toggleProps.onClick === 'function') {
|
|
295
|
-
var sortBy = getSortBy(id, sortDirections, sortOrder);
|
|
296
|
-
setSortBy(sortBy.desc === undefined ? [defaultSortObject] : [sortBy]); // 客户端排序时 需要重新设置排序
|
|
297
|
-
|
|
298
|
-
setSortDirection(sortBy);
|
|
299
|
-
onChange(sortBy);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
} // 当列设置sorter属性时,则为服务端排序
|
|
281
|
+
lastOffsetTopRef.current = scrollTop;
|
|
282
|
+
}, [hasNextPage, loadMore, loadMoreLoading, scrollThreshold, tableClientHeight]); // 内部滚动 对于滚动的处理
|
|
304
283
|
|
|
284
|
+
var onBodyScroll = useCallback(function (e) {
|
|
285
|
+
var currentTarget = e.target;
|
|
305
286
|
|
|
306
|
-
if (
|
|
307
|
-
|
|
308
|
-
return _objectSpread(_objectSpread({}, column.getHeaderProps({
|
|
309
|
-
style: {
|
|
310
|
-
cursor: 'pointer'
|
|
311
|
-
}
|
|
312
|
-
})), {}, {
|
|
313
|
-
onClick: function onClick(e) {
|
|
314
|
-
e.stopPropagation();
|
|
315
|
-
var sortBy = getSortBy(id, sortDirections, sortOrder);
|
|
316
|
-
setSortDirection(sortBy);
|
|
317
|
-
onChange(sortBy);
|
|
318
|
-
}
|
|
319
|
-
});
|
|
287
|
+
if (!currentTarget) {
|
|
288
|
+
return;
|
|
320
289
|
}
|
|
321
290
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
var SortIcons = function SortIcons(_ref2) {
|
|
326
|
-
var id = _ref2.id;
|
|
327
|
-
var currentSortId = sortDirection.id,
|
|
328
|
-
desc = sortDirection.desc;
|
|
291
|
+
var scrollLeftNum = currentTarget.scrollLeft;
|
|
292
|
+
var scrollTopNum = currentTarget.scrollTop; // 纵向滚动
|
|
329
293
|
|
|
330
|
-
if (
|
|
331
|
-
|
|
294
|
+
if (scrollTopNum !== lastOffsetLeftRef.current) {
|
|
295
|
+
onBodyVerticalScroll(currentTarget);
|
|
332
296
|
}
|
|
333
297
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
size: 12
|
|
338
|
-
}) : /*#__PURE__*/React.createElement(Ascending, {
|
|
339
|
-
className: "".concat(prefixCls, "-sortIcon"),
|
|
340
|
-
fill: "currentColor",
|
|
341
|
-
size: 12
|
|
342
|
-
});
|
|
343
|
-
};
|
|
298
|
+
if (scrollLeftNum === lastOffsetLeftRef.current) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
344
301
|
|
|
345
|
-
|
|
346
|
-
var INITIAL_OFFSET_TOP = 0;
|
|
302
|
+
var compareTarget = currentTarget; // 横向滚动
|
|
347
303
|
|
|
348
|
-
if (
|
|
349
|
-
|
|
304
|
+
if (!getScrollTarget() || getScrollTarget() === compareTarget) {
|
|
305
|
+
setScrollTarget(compareTarget);
|
|
306
|
+
forceScroll(scrollLeftNum, tableBodyRef.current);
|
|
307
|
+
forceScroll(scrollLeftNum, tableHeadRef.current);
|
|
308
|
+
lastOffsetLeftRef.current = scrollLeftNum;
|
|
350
309
|
}
|
|
351
|
-
};
|
|
310
|
+
}, [forceScroll, getScrollTarget, onBodyVerticalScroll, setScrollTarget]);
|
|
311
|
+
useEffect(function () {
|
|
312
|
+
if (!hasNextPage) {
|
|
313
|
+
setLoadMoreLoading(false);
|
|
314
|
+
}
|
|
315
|
+
}, [hasNextPage]); // 渲染有设置高度的表格
|
|
352
316
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
317
|
+
var renderTableWithHeight = function renderTableWithHeight() {
|
|
318
|
+
var renderNoHeightTableBody = function renderNoHeightTableBody() {
|
|
319
|
+
if (loading && !rows.length) {
|
|
320
|
+
return /*#__PURE__*/React.createElement(Loading, null);
|
|
357
321
|
}
|
|
358
|
-
};
|
|
359
|
-
});
|
|
360
|
-
var LoadingNode = /*#__PURE__*/React.createElement("div", {
|
|
361
|
-
className: classnames("".concat(prefixCls, "-loading"))
|
|
362
|
-
}, /*#__PURE__*/React.createElement(LoadingIcon, {
|
|
363
|
-
size: 16,
|
|
364
|
-
fill: "currentColor",
|
|
365
|
-
spin: true,
|
|
366
|
-
className: classnames("".concat(prefixCls, "-loading-icon"))
|
|
367
|
-
}), "Loading");
|
|
368
|
-
|
|
369
|
-
var renderTableBody = function renderTableBody() {
|
|
370
|
-
if (loading && !rows.length) {
|
|
371
|
-
return LoadingNode;
|
|
372
|
-
}
|
|
373
322
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
}, /*#__PURE__*/React.createElement(Empty, {
|
|
378
|
-
title: "No Data",
|
|
379
|
-
size: "large",
|
|
380
|
-
image: Empty.PRESENTED_IMAGE_SIMPLE
|
|
381
|
-
}));
|
|
382
|
-
}
|
|
323
|
+
if (!loading && !rows.length) {
|
|
324
|
+
return /*#__PURE__*/React.createElement(Empty, null);
|
|
325
|
+
}
|
|
383
326
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
rowProps = _objectWithoutProperties(_row$getRowProps, _excluded);
|
|
394
|
-
|
|
395
|
-
return /*#__PURE__*/React.createElement("div", Object.assign({}, rowProps, {
|
|
396
|
-
style: _objectSpread({}, rowStyle),
|
|
397
|
-
className: classnames("".concat(prefixCls, "-row"), (_classnames = {}, _defineProperty(_classnames, "".concat(prefixCls, "-row-selected"), row.id === selectedRowId), _defineProperty(_classnames, rowClassName, rowClassName), _defineProperty(_classnames, "".concat(prefixCls, "-row-ellipsis"), ellipsis), _classnames)),
|
|
398
|
-
onClick: function onClick() {
|
|
399
|
-
return onRowClick(row);
|
|
400
|
-
},
|
|
401
|
-
key: row.id
|
|
402
|
-
}), row.cells.map(function (cell) {
|
|
403
|
-
return /*#__PURE__*/React.createElement("div", Object.assign({}, cell.getCellProps(), {
|
|
404
|
-
className: classnames("".concat(prefixCls, "-cell"))
|
|
405
|
-
}), cell.render('Cell'));
|
|
406
|
-
}));
|
|
407
|
-
});
|
|
327
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
328
|
+
style: {
|
|
329
|
+
overflow: 'overlay',
|
|
330
|
+
overflowX: tableClientWidth + SCROLLBAR_SIZE > columnsTotalWidthRef.current ? 'hidden' : 'unset',
|
|
331
|
+
height: tableClientHeight - TABLE_HEAD_ROW_HEIGHT - SCROLLBAR_SIZE
|
|
332
|
+
},
|
|
333
|
+
ref: tableBodyRef,
|
|
334
|
+
onScroll: onBodyScroll
|
|
335
|
+
}, tableRowListNode, loadMoreLoading && /*#__PURE__*/React.createElement(Loading, null));
|
|
408
336
|
};
|
|
409
337
|
|
|
410
338
|
return /*#__PURE__*/React.createElement("div", {
|
|
411
|
-
className: classnames("".concat(prefixCls, "-
|
|
412
|
-
|
|
413
|
-
ref:
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
loader: LoadingNode,
|
|
419
|
-
scrollableTarget: RANDOM_ID,
|
|
420
|
-
scrollThreshold: scrollThreshold
|
|
421
|
-
}, renderRowList()) : renderRowList());
|
|
339
|
+
className: classnames("".concat(prefixCls, "-inner-wrap"), _defineProperty({}, "".concat(prefixCls, "-innerScroll"), height))
|
|
340
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
341
|
+
ref: tableHeadRef,
|
|
342
|
+
className: "".concat(prefixCls, "-tableHeadScrollWrap")
|
|
343
|
+
}, tableHeadNode), /*#__PURE__*/React.createElement("div", Object.assign({}, getTableBodyProps(), {
|
|
344
|
+
className: classnames("".concat(prefixCls, "-tbody"), _defineProperty({}, "".concat(prefixCls, "-tbody-innerScroll"), height))
|
|
345
|
+
}), renderNoHeightTableBody()));
|
|
422
346
|
};
|
|
423
347
|
|
|
424
348
|
return /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
425
|
-
onResize: function onResize(
|
|
426
|
-
var
|
|
427
|
-
|
|
349
|
+
onResize: function onResize(_ref2) {
|
|
350
|
+
var clientWidth = _ref2.width,
|
|
351
|
+
clientHeight = _ref2.height;
|
|
352
|
+
setTableClientWidth(clientWidth);
|
|
353
|
+
setTableClientHeight(clientHeight);
|
|
428
354
|
}
|
|
429
355
|
}, /*#__PURE__*/React.createElement("div", {
|
|
430
356
|
className: prefixCls,
|
|
431
|
-
ref: tableRef
|
|
432
|
-
}, /*#__PURE__*/React.createElement("div", Object.assign({}, getTableProps(), {
|
|
433
|
-
className: classnames("".concat(prefixCls, "-table-wrap"), (_classnames3 = {}, _defineProperty(_classnames3, "".concat(prefixCls, "-column-resizable"), resizeColumn), _defineProperty(_classnames3, "".concat(prefixCls, "-init-loading"), data.length === EMPTY_LENGTH && loading), _defineProperty(_classnames3, "".concat(prefixCls, "-empty"), data.length === EMPTY_LENGTH && loading), _classnames3))
|
|
434
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
435
|
-
className: "".concat(prefixCls, "-thead")
|
|
436
|
-
}, headerGroups.map(function (headerGroup) {
|
|
437
|
-
var _headerGroup$getHeade = headerGroup.getHeaderGroupProps(),
|
|
438
|
-
style = _headerGroup$getHeade.style,
|
|
439
|
-
headerGroupProps = _objectWithoutProperties(_headerGroup$getHeade, _excluded2);
|
|
440
|
-
|
|
441
|
-
theadRowWidthRef.current = (style === null || style === void 0 ? void 0 : style.width) || DEFAULT_ROW_WIDTH;
|
|
442
|
-
return /*#__PURE__*/React.createElement("div", Object.assign({}, headerGroupProps, {
|
|
443
|
-
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
444
|
-
width: resizeColumn ? style === null || style === void 0 ? void 0 : style.width : '100%'
|
|
445
|
-
}),
|
|
446
|
-
className: "".concat(prefixCls, "-row")
|
|
447
|
-
}), headerGroup.headers.map(function (column) {
|
|
448
|
-
var barPorps = resizeColumn ? column.getResizerProps() : {};
|
|
449
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
450
|
-
className: classnames(_defineProperty({}, "".concat(prefixCls, "-cell-sorting"), column.id === sortDirection.id), "".concat(prefixCls, "-cell")),
|
|
451
|
-
style: getHeaderProps(column).style,
|
|
452
|
-
key: column.id
|
|
453
|
-
}, /*#__PURE__*/React.createElement("div", Object.assign({
|
|
454
|
-
className: "".concat(prefixCls, "-cell-content")
|
|
455
|
-
}, getHeaderProps(column), {
|
|
456
|
-
style: {
|
|
457
|
-
width: '100%'
|
|
458
|
-
}
|
|
459
|
-
}), column.render('Header'), /*#__PURE__*/React.createElement(SortIcons, {
|
|
460
|
-
id: column.id
|
|
461
|
-
})), /*#__PURE__*/React.createElement("div", Object.assign({}, barPorps, {
|
|
462
|
-
className: classnames(_defineProperty({}, "".concat(prefixCls, "-dragBar"), resizeColumn), "".concat(prefixCls, "-bar"))
|
|
463
|
-
})));
|
|
464
|
-
}));
|
|
465
|
-
})), /*#__PURE__*/React.createElement("div", Object.assign({}, getTableBodyProps(), {
|
|
466
|
-
className: classnames("".concat(prefixCls, "-tbody"), _defineProperty({}, "".concat(prefixCls, "-innerScroll"), innerScroll)),
|
|
357
|
+
ref: tableRef,
|
|
467
358
|
style: {
|
|
468
|
-
|
|
359
|
+
height: !height ? 'unset' : height
|
|
469
360
|
}
|
|
470
|
-
}
|
|
361
|
+
}, /*#__PURE__*/React.createElement("div", Object.assign({}, getTableProps(), {
|
|
362
|
+
className: classnames("".concat(prefixCls, "-table-wrap"), (_classnames3 = {}, _defineProperty(_classnames3, "".concat(prefixCls, "-init-loading"), data.length === ZERO && loading), _defineProperty(_classnames3, "".concat(prefixCls, "-empty"), data.length === ZERO && loading), _classnames3))
|
|
363
|
+
}), height ? renderTableWithHeight() : renderTableWithoutHeight())));
|
|
471
364
|
}
|
|
472
365
|
|
|
473
366
|
export default /*#__PURE__*/React.forwardRef(Table);
|