@aloudata/aloudata-design 1.9.8 → 1.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AldTable/helper.js +21 -23
- package/dist/AldTable/index.d.ts +2 -2
- package/dist/AldTable/index.js +40 -50
- package/dist/AldTable/style/index.less +26 -6
- package/dist/AldTable/types.d.ts +2 -0
- package/dist/App/index.js +2 -9
- package/dist/Avatar/component/Avatar/avatar.d.ts +2 -2
- package/dist/Avatar/component/Avatar/avatar.js +0 -2
- package/dist/Avatar/component/Avatar/index.d.ts +1 -1
- package/dist/Avatar/component/Avatar/index.js +6 -20
- package/dist/Breadcrumb/index.d.ts +1 -1
- package/dist/Breadcrumb/index.js +6 -16
- package/dist/Button/index.d.ts +4 -4
- package/dist/Button/index.js +21 -41
- package/dist/Checkbox/component/CheckboxGroup/index.d.ts +2 -2
- package/dist/Checkbox/component/CheckboxGroup/index.js +4 -10
- package/dist/Checkbox/index.d.ts +3 -3
- package/dist/Checkbox/index.js +5 -14
- package/dist/Checkbox/type.js +3 -4
- package/dist/ColorPicker/constant.js +2 -1
- package/dist/ColorPicker/index.d.ts +1 -1
- package/dist/ColorPicker/index.js +15 -42
- package/dist/ConfigProvider/defaultRenderEmpty.d.ts +1 -1
- package/dist/ConfigProvider/defaultRenderEmpty.js +0 -5
- package/dist/ConfigProvider/getUserList.d.ts +4 -4
- package/dist/ConfigProvider/getUserList.js +2 -2
- package/dist/ConfigProvider/hooks/useGetUserList.js +2 -5
- package/dist/ConfigProvider/index.js +2 -6
- package/dist/ConfigProvider/sizeContext.d.ts +1 -1
- package/dist/ConfigProvider/sizeContext.js +1 -1
- package/dist/DataPreviewTable/components/Body/Cell.d.ts +1 -1
- package/dist/DataPreviewTable/components/Body/Cell.js +4 -10
- package/dist/DataPreviewTable/components/Body/Error.d.ts +1 -1
- package/dist/DataPreviewTable/components/Body/Error.js +3 -5
- package/dist/DataPreviewTable/components/Body/SkeletonBody.d.ts +1 -1
- package/dist/DataPreviewTable/components/Body/SkeletonBody.js +10 -19
- package/dist/DataPreviewTable/components/Body/index.d.ts +1 -1
- package/dist/DataPreviewTable/components/Body/index.js +10 -19
- package/dist/DataPreviewTable/components/DragBar/index.d.ts +1 -1
- package/dist/DataPreviewTable/components/DragBar/index.js +14 -24
- package/dist/DataPreviewTable/components/Header/index.d.ts +2 -2
- package/dist/DataPreviewTable/components/Header/index.js +7 -15
- package/dist/DataPreviewTable/hooks/useDirection.js +32 -57
- package/dist/DataPreviewTable/index.js +22 -29
- package/dist/DataPreviewTable/interface.d.ts +2 -2
- package/dist/DataPreviewTable/interface.js +6 -9
- package/dist/DataPreviewTable/utils/findRange.js +2 -20
- package/dist/DataPreviewTable/utils/getColumnRange.js +3 -7
- package/dist/DataPreviewTable/utils/getRowRange.js +2 -8
- package/dist/DataPreviewTable/utils/getTableLayout.js +0 -1
- package/dist/DatePicker/index.d.ts +11 -11
- package/dist/DatePicker/index.js +85 -116
- package/dist/Divider/index.d.ts +1 -1
- package/dist/Divider/index.js +0 -3
- package/dist/DoubleCircleIcon/index.d.ts +2 -2
- package/dist/DoubleCircleIcon/index.js +7 -9
- package/dist/Dropdown/Button.d.ts +2 -2
- package/dist/Dropdown/Button.js +7 -11
- package/dist/Dropdown/index.d.ts +4 -4
- package/dist/Dropdown/index.js +11 -21
- package/dist/Dropdown/style/index.less +5 -0
- package/dist/Empty/image/Data.d.ts +2 -2
- package/dist/Empty/image/Data.js +0 -2
- package/dist/Empty/image/Search.d.ts +2 -2
- package/dist/Empty/image/Search.js +0 -2
- package/dist/Empty/image/SearchSmall.d.ts +2 -2
- package/dist/Empty/image/SearchSmall.js +0 -2
- package/dist/Empty/image/User.d.ts +2 -2
- package/dist/Empty/image/User.js +0 -2
- package/dist/Empty/image/WorkBook.d.ts +2 -2
- package/dist/Empty/image/WorkBook.js +0 -2
- package/dist/Empty/index.d.ts +1 -1
- package/dist/Empty/index.js +13 -23
- package/dist/Form/index.d.ts +4 -4
- package/dist/Form/index.js +16 -27
- package/dist/Icon/components/AlertTriangleDuotone.d.ts +1 -1
- package/dist/Icon/components/AlertTriangleDuotone.js +4 -11
- package/dist/Icon/components/CancelCircleDuotone.d.ts +1 -1
- package/dist/Icon/components/CancelCircleDuotone.js +9 -16
- package/dist/Icon/components/CheckCircleDuotone.d.ts +1 -1
- package/dist/Icon/components/CheckCircleDuotone.js +4 -11
- package/dist/Icon/components/Icon.d.ts +1 -1
- package/dist/Icon/components/Icon.js +9 -13
- package/dist/Icon/components/InfoCircleLine.d.ts +1 -1
- package/dist/Icon/components/InfoCircleLine.js +4 -11
- package/dist/Icon/components/createFromScripts.js +2 -8
- package/dist/IconButton/index.js +36 -57
- package/dist/IconButton/style/index.less +4 -0
- package/dist/Input/components/Group/index.d.ts +2 -2
- package/dist/Input/components/Group/index.js +4 -9
- package/dist/Input/components/Input/index.d.ts +2 -2
- package/dist/Input/components/Input/index.js +9 -17
- package/dist/Input/components/Password/index.js +4 -9
- package/dist/Input/components/TextArea/index.js +5 -10
- package/dist/InputNumber/index.d.ts +2 -2
- package/dist/InputNumber/index.js +13 -20
- package/dist/MemberPicker/components/MemberSelection.d.ts +2 -2
- package/dist/MemberPicker/components/MemberSelection.js +12 -20
- package/dist/MemberPicker/components/MultipleOption.d.ts +2 -2
- package/dist/MemberPicker/components/MultipleOption.js +8 -9
- package/dist/MemberPicker/components/NickLabel.js +2 -4
- package/dist/MemberPicker/components/Panel.d.ts +2 -2
- package/dist/MemberPicker/components/Panel.js +14 -25
- package/dist/MemberPicker/components/SelectedMemberTags.d.ts +2 -2
- package/dist/MemberPicker/components/SelectedMemberTags.js +2 -4
- package/dist/MemberPicker/components/SelectorFooter.d.ts +2 -2
- package/dist/MemberPicker/components/SingleOption.d.ts +2 -2
- package/dist/MemberPicker/components/SingleOption.js +9 -10
- package/dist/MemberPicker/index.js +46 -79
- package/dist/MemberPicker/interface.d.ts +2 -2
- package/dist/MemberPicker/utils/getUsersWithUserId.js +0 -1
- package/dist/Menu/Divider.d.ts +3 -3
- package/dist/Menu/MenuItem.d.ts +1 -1
- package/dist/Menu/SubMenu.d.ts +1 -1
- package/dist/Menu/SubMenu.js +1 -6
- package/dist/Menu/index.d.ts +2 -2
- package/dist/Menu/index.js +7 -16
- package/dist/Menu/style/dropdown.less +4 -2
- package/dist/Modal/index.d.ts +4 -4
- package/dist/Modal/index.js +108 -130
- package/dist/Modal/locale.js +4 -6
- package/dist/Navigator/components/Header/index.d.ts +2 -2
- package/dist/Navigator/components/Header/index.js +0 -2
- package/dist/Navigator/components/Menu/index.d.ts +2 -2
- package/dist/Navigator/components/Menu/index.js +8 -19
- package/dist/Navigator/components/MenuItem/index.d.ts +1 -1
- package/dist/Navigator/components/MenuItem/index.js +6 -9
- package/dist/Navigator/index.d.ts +1 -1
- package/dist/Navigator/index.js +5 -7
- package/dist/Pagination/index.d.ts +3 -3
- package/dist/Pagination/index.js +18 -43
- package/dist/Popconfirm/index.d.ts +2 -2
- package/dist/Popconfirm/index.js +19 -27
- package/dist/Popover/index.d.ts +2 -2
- package/dist/Popover/index.js +2 -9
- package/dist/Progress/index.js +21 -33
- package/dist/Radio/components/Group/index.d.ts +1 -1
- package/dist/Radio/components/Group/index.js +27 -36
- package/dist/Radio/components/Radio/index.d.ts +2 -2
- package/dist/Radio/components/Radio/index.js +10 -18
- package/dist/Radio/interface/radioGroup.d.ts +3 -3
- package/dist/Result/index.d.ts +7 -7
- package/dist/Result/index.js +17 -26
- package/dist/Result/noFound.js +0 -3
- package/dist/Result/serverError.js +0 -3
- package/dist/Result/unauthorized.js +1 -4
- package/dist/ScrollArea/index.js +6 -13
- package/dist/Select/components/MultipleOption.d.ts +2 -2
- package/dist/Select/components/MultipleOption.js +4 -8
- package/dist/Select/components/SingleOption.d.ts +2 -2
- package/dist/Select/components/SingleOption.js +5 -9
- package/dist/Select/index.d.ts +2 -2
- package/dist/Select/index.js +66 -134
- package/dist/Spin/CustomIcon/index.d.ts +2 -2
- package/dist/Spin/CustomIcon/index.js +0 -2
- package/dist/Spin/Icon/index.d.ts +2 -2
- package/dist/Spin/index.d.ts +2 -2
- package/dist/Spin/index.js +1 -10
- package/dist/Steps/components/ProcessIcon/index.d.ts +2 -2
- package/dist/Steps/components/ProcessIcon/index.js +0 -2
- package/dist/Steps/components/Step/index.d.ts +3 -3
- package/dist/Steps/components/Step/index.js +2 -8
- package/dist/Steps/index.d.ts +3 -3
- package/dist/Steps/index.js +8 -10
- package/dist/Switch/index.js +17 -30
- package/dist/Table/Table.js +88 -131
- package/dist/Table/components/Empty/index.d.ts +2 -2
- package/dist/Table/components/Empty/index.js +0 -2
- package/dist/Table/components/Loading/index.d.ts +2 -2
- package/dist/Table/components/Loading/index.js +0 -2
- package/dist/Table/components/TableBodyRowList/index.d.ts +2 -2
- package/dist/Table/components/TableBodyRowList/index.js +19 -39
- package/dist/Table/components/TableHead/index.d.ts +1 -1
- package/dist/Table/components/TableHead/index.js +56 -82
- package/dist/Table/hooks/useFrame.d.ts +1 -1
- package/dist/Table/hooks/useFrame.js +9 -24
- package/dist/Table/interface.d.ts +1 -1
- package/dist/Table/utils.js +8 -28
- package/dist/Tabs/TabPane.d.ts +2 -2
- package/dist/Tabs/index.d.ts +2 -2
- package/dist/Tabs/index.js +18 -33
- package/dist/Tooltip/index.d.ts +2 -2
- package/dist/Tooltip/index.js +12 -12
- package/dist/Tree/demo/basic/index.d.ts +2 -2
- package/dist/Tree/index.d.ts +1 -1
- package/dist/Tree/index.js +2 -4
- package/dist/_utils/hooks/useControlledState.js +9 -21
- package/dist/_utils/hooks/useId.js +4 -5
- package/dist/_utils/hooks/usePrefixCls.js +2 -5
- package/dist/index.js +3 -1
- package/dist/locale-provider/context.d.ts +1 -1
- package/dist/locale-provider/index.d.ts +1 -1
- package/dist/locale-provider/index.js +8 -33
- package/dist/message/index.js +3 -7
- package/dist/notification/demo/index.d.ts +2 -2
- package/dist/notification/demo/index.js +0 -1
- package/dist/notification/index.js +23 -32
- package/package.json +1 -1
package/dist/Table/Table.js
CHANGED
|
@@ -1,23 +1,16 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
1
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
3
|
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; }
|
|
4
|
-
|
|
5
4
|
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; }
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
9
8
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
-
|
|
11
9
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
-
|
|
13
10
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
-
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
18
|
-
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
12
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
19
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
-
|
|
21
14
|
/* eslint-disable no-unneeded-ternary */
|
|
22
15
|
/// <reference types ='./react-table-config' />
|
|
23
16
|
import classnames from 'classnames';
|
|
@@ -35,93 +28,82 @@ import "./style/index";
|
|
|
35
28
|
import { getColumnsWidthMap, getValidScrollThreshold } from "./utils";
|
|
36
29
|
var tableHeadRowHeight = 44;
|
|
37
30
|
var ZERO = 0;
|
|
38
|
-
|
|
39
31
|
function Table(props, ref) {
|
|
40
32
|
var _classnames3;
|
|
41
|
-
|
|
42
33
|
var tableKey = props.key,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
34
|
+
columns = props.columns,
|
|
35
|
+
data = props.data,
|
|
36
|
+
onRowSelected = props.onRowSelected,
|
|
37
|
+
loadMore = props.loadMore,
|
|
38
|
+
loading = props.loading,
|
|
39
|
+
hasNextPage = props.hasNextPage,
|
|
40
|
+
_props$sortable = props.sortable,
|
|
41
|
+
sortable = _props$sortable === void 0 ? false : _props$sortable,
|
|
42
|
+
defaultSort = props.defaultSort,
|
|
43
|
+
_props$resizeColumn = props.resizeColumn,
|
|
44
|
+
resizeColumn = _props$resizeColumn === void 0 ? false : _props$resizeColumn,
|
|
45
|
+
allSortDirections = props.sortDirections,
|
|
46
|
+
_props$onChange = props.onChange,
|
|
47
|
+
onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
|
|
48
|
+
_props$scrollThreshol = props.scrollThreshold,
|
|
49
|
+
scrollThreshold = _props$scrollThreshol === void 0 ? '150px' : _props$scrollThreshol,
|
|
50
|
+
_props$rowClassName = props.rowClassName,
|
|
51
|
+
rowClassName = _props$rowClassName === void 0 ? '' : _props$rowClassName,
|
|
52
|
+
_props$ellipsis = props.ellipsis,
|
|
53
|
+
ellipsis = _props$ellipsis === void 0 ? true : _props$ellipsis,
|
|
54
|
+
rowKey = props.rowKey,
|
|
55
|
+
height = props.height,
|
|
56
|
+
_props$canSelected = props.canSelected,
|
|
57
|
+
canSelected = _props$canSelected === void 0 ? false : _props$canSelected;
|
|
68
58
|
var _useState = useState(undefined),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
59
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
60
|
+
tableClientWidth = _useState2[0],
|
|
61
|
+
setTableClientWidth = _useState2[1];
|
|
73
62
|
var _useState3 = useState(undefined),
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
63
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
64
|
+
tableClientHeight = _useState4[0],
|
|
65
|
+
setTableClientHeight = _useState4[1];
|
|
78
66
|
var prefixCls = usePrefixCls('', 'ald-table');
|
|
79
67
|
var tableRef = useRef(null);
|
|
80
68
|
var tableHeadRef = useRef(null);
|
|
81
69
|
var tableBodyRef = useRef(null);
|
|
82
70
|
var columnsWidthMapRef = useRef();
|
|
83
71
|
var columnsTotalWidthRef = useRef(ZERO);
|
|
84
|
-
|
|
85
72
|
var _useState5 = useState(false),
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
73
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
74
|
+
loadMoreLoading = _useState6[0],
|
|
75
|
+
setLoadMoreLoading = _useState6[1];
|
|
90
76
|
var lastOffsetLeftRef = useRef(ZERO);
|
|
91
77
|
var lastOffsetTopRef = useRef(ZERO);
|
|
92
|
-
|
|
93
78
|
var _useTimeoutLock = useTimeoutLock(),
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
79
|
+
_useTimeoutLock2 = _slicedToArray(_useTimeoutLock, 2),
|
|
80
|
+
setScrollTarget = _useTimeoutLock2[0],
|
|
81
|
+
getScrollTarget = _useTimeoutLock2[1];
|
|
98
82
|
|
|
83
|
+
// 初始化进入时 渲染表格容器宽度
|
|
99
84
|
useEffect(function () {
|
|
100
85
|
if (tableRef.current) {
|
|
101
86
|
setTableClientWidth(tableRef.current.clientWidth);
|
|
102
87
|
}
|
|
103
|
-
}, []);
|
|
88
|
+
}, []);
|
|
104
89
|
|
|
90
|
+
// 转换外部传入的columns
|
|
105
91
|
var newColumns = useMemo(function () {
|
|
106
92
|
if (!tableClientWidth) {
|
|
107
93
|
return [];
|
|
108
94
|
}
|
|
109
|
-
|
|
110
95
|
var _getColumnsWidthMap = getColumnsWidthMap(columns, tableClientWidth, columnsWidthMapRef.current),
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
96
|
+
columnsWidthMap = _getColumnsWidthMap.columnsWidthMap,
|
|
97
|
+
totalColumnWidth = _getColumnsWidthMap.totalColumnWidth;
|
|
114
98
|
columnsWidthMapRef.current = columnsWidthMap;
|
|
115
99
|
columnsTotalWidthRef.current = totalColumnWidth;
|
|
116
100
|
return columns.map(function (column, index) {
|
|
117
101
|
var _columnsWidthMapRef$c, _columnsWidthMapRef$c2;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
102
|
+
var key = index.toString();
|
|
103
|
+
// 不设置dataIndex同时进行排序 则报错
|
|
121
104
|
if (column.dataIndex === undefined && sortable) {
|
|
122
105
|
message.error('不支持未设置dataIndex时进行排序设置');
|
|
123
106
|
}
|
|
124
|
-
|
|
125
107
|
return _objectSpread(_objectSpread({}, column), {}, {
|
|
126
108
|
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,
|
|
127
109
|
Header: column.title ? column.title : function () {
|
|
@@ -130,38 +112,36 @@ function Table(props, ref) {
|
|
|
130
112
|
disableSortBy: !sortable || typeof column.sorter === 'boolean',
|
|
131
113
|
accessor: column.dataIndex,
|
|
132
114
|
Cell: function (_Cell) {
|
|
133
|
-
function Cell(
|
|
115
|
+
function Cell(_x2) {
|
|
134
116
|
return _Cell.apply(this, arguments);
|
|
135
117
|
}
|
|
136
|
-
|
|
137
118
|
Cell.toString = function () {
|
|
138
119
|
return _Cell.toString();
|
|
139
120
|
};
|
|
140
|
-
|
|
141
121
|
return Cell;
|
|
142
122
|
}(function (_ref) {
|
|
143
123
|
var row = _ref.row,
|
|
144
|
-
|
|
124
|
+
value = _ref.value;
|
|
145
125
|
return typeof column.render === 'function' ? column.render(value, row.original, row.index) : value;
|
|
146
126
|
})
|
|
147
127
|
});
|
|
148
128
|
});
|
|
149
|
-
}, [columns, sortable, tableClientWidth]);
|
|
150
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
129
|
+
}, [columns, sortable, tableClientWidth]);
|
|
151
130
|
|
|
131
|
+
// 将rowId转为React Table支持的值
|
|
132
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
152
133
|
var transformRowId = function transformRowId(row, relativeIndex, parent) {
|
|
153
134
|
if (rowKey && parent) {
|
|
154
135
|
if (typeof rowKey === 'string') {
|
|
155
136
|
return [rowKey, relativeIndex].join('.');
|
|
156
137
|
}
|
|
157
|
-
|
|
158
138
|
if (typeof rowKey === 'function') {
|
|
159
139
|
return [rowKey(row), relativeIndex].join('.');
|
|
160
140
|
}
|
|
161
141
|
}
|
|
162
|
-
|
|
163
142
|
return relativeIndex.toString();
|
|
164
143
|
};
|
|
144
|
+
|
|
165
145
|
/**
|
|
166
146
|
* 计算初始传递给 React Table的排序字段
|
|
167
147
|
* 1. 不存在 sortable 或者存在loadMore(内部滚动时),不进行排序操作防止内部滚动时冲突;
|
|
@@ -169,57 +149,46 @@ function Table(props, ref) {
|
|
|
169
149
|
* 3. 如果给了排序但没有默认,则按第一行排序
|
|
170
150
|
* @returns
|
|
171
151
|
*/
|
|
172
|
-
|
|
173
|
-
|
|
174
152
|
var getTableInitSort = function getTableInitSort() {
|
|
175
153
|
var EMPTY_SIZE = 0;
|
|
176
|
-
|
|
177
154
|
if (!sortable || loadMore || newColumns.length === EMPTY_SIZE) {
|
|
178
155
|
return [];
|
|
179
156
|
}
|
|
180
|
-
|
|
181
157
|
if (defaultSort && defaultSort.id) {
|
|
182
158
|
return [defaultSort];
|
|
183
159
|
}
|
|
184
|
-
|
|
185
160
|
var firstColumnSortData = {
|
|
186
161
|
id: newColumns[ZERO].accessor,
|
|
187
162
|
desc: !!(newColumns[ZERO].sortOrder && newColumns[ZERO].sortOrder === 'descend')
|
|
188
163
|
};
|
|
189
|
-
|
|
190
164
|
if (firstColumnSortData.id) {
|
|
191
165
|
return [firstColumnSortData];
|
|
192
166
|
}
|
|
193
|
-
|
|
194
167
|
return [];
|
|
195
168
|
};
|
|
196
|
-
|
|
197
169
|
var _useTable = useTable({
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
170
|
+
columns: newColumns,
|
|
171
|
+
// 对齐columns属性
|
|
172
|
+
data: data,
|
|
173
|
+
disableMultiSort: true,
|
|
174
|
+
disableSortBy: !sortable,
|
|
175
|
+
getRowId: transformRowId,
|
|
176
|
+
initialState: {
|
|
177
|
+
sortBy: getTableInitSort()
|
|
178
|
+
}
|
|
179
|
+
}, useBlockLayout, useSortBy, useRowSelect, useResizeColumns),
|
|
180
|
+
getTableProps = _useTable.getTableProps,
|
|
181
|
+
getTableBodyProps = _useTable.getTableBodyProps,
|
|
182
|
+
headerGroups = _useTable.headerGroups,
|
|
183
|
+
rows = _useTable.rows,
|
|
184
|
+
prepareRow = _useTable.prepareRow,
|
|
185
|
+
setSortBy = _useTable.setSortBy;
|
|
215
186
|
var scrollToTop = function scrollToTop() {
|
|
216
187
|
var INITIAL_OFFSET_TOP = 0;
|
|
217
|
-
|
|
218
188
|
if (tableBodyRef && tableBodyRef.current) {
|
|
219
189
|
tableBodyRef.current.scrollTop = INITIAL_OFFSET_TOP;
|
|
220
190
|
}
|
|
221
191
|
};
|
|
222
|
-
|
|
223
192
|
React.useImperativeHandle(ref, function () {
|
|
224
193
|
return {
|
|
225
194
|
backToTop: function backToTop() {
|
|
@@ -230,7 +199,8 @@ function Table(props, ref) {
|
|
|
230
199
|
var tableHeadNode = /*#__PURE__*/React.createElement(TableHead, {
|
|
231
200
|
tableHeadRef: tableHeadRef,
|
|
232
201
|
canResizeColumn: resizeColumn,
|
|
233
|
-
headerGroups: headerGroups
|
|
202
|
+
headerGroups: headerGroups
|
|
203
|
+
// tableContentWidth={columnsTotalWidthRef.current}
|
|
234
204
|
,
|
|
235
205
|
defaultSort: defaultSort,
|
|
236
206
|
sortable: sortable,
|
|
@@ -249,23 +219,21 @@ function Table(props, ref) {
|
|
|
249
219
|
rowClassName: rowClassName,
|
|
250
220
|
ellipsis: ellipsis,
|
|
251
221
|
onRowSelected: onRowSelected
|
|
252
|
-
});
|
|
222
|
+
});
|
|
253
223
|
|
|
224
|
+
// 渲染没有设置高度的表格
|
|
254
225
|
var renderTableWithoutHeight = function renderTableWithoutHeight() {
|
|
255
226
|
var renderNoHeightTableBody = function renderNoHeightTableBody() {
|
|
256
227
|
if (loading && !rows.length) {
|
|
257
228
|
return /*#__PURE__*/React.createElement(Loading, null);
|
|
258
229
|
}
|
|
259
|
-
|
|
260
230
|
if (!loading && !rows.length) {
|
|
261
231
|
return /*#__PURE__*/React.createElement(Empty, null);
|
|
262
232
|
}
|
|
263
|
-
|
|
264
233
|
return /*#__PURE__*/React.createElement("div", {
|
|
265
234
|
className: "".concat(prefixCls, "-list")
|
|
266
235
|
}, tableRowListNode);
|
|
267
236
|
};
|
|
268
|
-
|
|
269
237
|
return /*#__PURE__*/React.createElement("div", {
|
|
270
238
|
className: classnames("".concat(prefixCls, "-inner-wrap"))
|
|
271
239
|
}, tableHeadNode, /*#__PURE__*/React.createElement("div", _extends({}, getTableBodyProps(), {
|
|
@@ -275,64 +243,58 @@ function Table(props, ref) {
|
|
|
275
243
|
}
|
|
276
244
|
}), renderNoHeightTableBody()));
|
|
277
245
|
};
|
|
278
|
-
|
|
279
246
|
var forceScroll = useCallback(function (scrollLeftNum, target) {
|
|
280
247
|
if (!target) {
|
|
281
248
|
return;
|
|
282
249
|
}
|
|
283
|
-
|
|
284
250
|
if (typeof target === 'function') {
|
|
285
251
|
target(scrollLeftNum);
|
|
286
252
|
} else if (target.scrollLeft !== scrollLeftNum) {
|
|
287
253
|
// eslint-disable-next-line no-param-reassign
|
|
288
254
|
target.scrollLeft = scrollLeftNum;
|
|
289
255
|
}
|
|
290
|
-
}, []);
|
|
256
|
+
}, []);
|
|
291
257
|
|
|
258
|
+
// 内部滚动时 纵向的滚动
|
|
292
259
|
var onBodyVerticalScroll = useCallback(function (target) {
|
|
293
260
|
if (!tableClientHeight) {
|
|
294
261
|
return;
|
|
295
262
|
}
|
|
296
|
-
|
|
297
263
|
var scrollHeight = target.scrollHeight,
|
|
298
|
-
|
|
299
|
-
|
|
264
|
+
clientHeight = target.clientHeight,
|
|
265
|
+
scrollTop = target.scrollTop;
|
|
300
266
|
var currentPosToBottomGap = scrollHeight - clientHeight - scrollTop; // 当前滚动条到底部的距离
|
|
301
267
|
|
|
302
268
|
var scrollThresholdValue = getValidScrollThreshold(scrollThreshold, tableClientHeight);
|
|
303
|
-
|
|
304
269
|
if (currentPosToBottomGap < scrollThresholdValue && hasNextPage && !loadMoreLoading) {
|
|
305
270
|
var _ref2;
|
|
306
|
-
|
|
307
271
|
setLoadMoreLoading(true);
|
|
308
272
|
(_ref2 = loadMore()) === null || _ref2 === void 0 ? void 0 : _ref2.then(function () {
|
|
309
273
|
setLoadMoreLoading(false);
|
|
310
274
|
});
|
|
311
275
|
}
|
|
312
|
-
|
|
313
276
|
lastOffsetTopRef.current = scrollTop;
|
|
314
|
-
}, [hasNextPage, loadMore, loadMoreLoading, scrollThreshold, tableClientHeight]);
|
|
277
|
+
}, [hasNextPage, loadMore, loadMoreLoading, scrollThreshold, tableClientHeight]);
|
|
315
278
|
|
|
279
|
+
// 内部滚动 对于滚动的处理
|
|
316
280
|
var onBodyScroll = useCallback(function (e) {
|
|
317
281
|
var currentTarget = e.target;
|
|
318
|
-
|
|
319
282
|
if (!currentTarget) {
|
|
320
283
|
return;
|
|
321
284
|
}
|
|
322
|
-
|
|
323
285
|
var scrollLeftNum = currentTarget.scrollLeft;
|
|
324
|
-
var scrollTopNum = currentTarget.scrollTop;
|
|
286
|
+
var scrollTopNum = currentTarget.scrollTop;
|
|
325
287
|
|
|
288
|
+
// 纵向滚动
|
|
326
289
|
if (scrollTopNum !== lastOffsetLeftRef.current) {
|
|
327
290
|
onBodyVerticalScroll(currentTarget);
|
|
328
291
|
}
|
|
329
|
-
|
|
330
292
|
if (scrollLeftNum === lastOffsetLeftRef.current) {
|
|
331
293
|
return;
|
|
332
294
|
}
|
|
295
|
+
var compareTarget = currentTarget;
|
|
333
296
|
|
|
334
|
-
|
|
335
|
-
|
|
297
|
+
// 横向滚动
|
|
336
298
|
if (!getScrollTarget() || getScrollTarget() === compareTarget) {
|
|
337
299
|
setScrollTarget(compareTarget);
|
|
338
300
|
forceScroll(scrollLeftNum, tableBodyRef.current);
|
|
@@ -344,22 +306,20 @@ function Table(props, ref) {
|
|
|
344
306
|
if (!hasNextPage) {
|
|
345
307
|
setLoadMoreLoading(false);
|
|
346
308
|
}
|
|
347
|
-
}, [hasNextPage]);
|
|
309
|
+
}, [hasNextPage]);
|
|
348
310
|
|
|
311
|
+
// 渲染有设置高度的表格
|
|
349
312
|
var renderTableWithHeight = function renderTableWithHeight() {
|
|
350
313
|
if (!tableClientWidth || !tableClientHeight) {
|
|
351
314
|
return null;
|
|
352
315
|
}
|
|
353
|
-
|
|
354
316
|
var renderNoHeightTableBody = function renderNoHeightTableBody() {
|
|
355
317
|
if (loading && !rows.length) {
|
|
356
318
|
return /*#__PURE__*/React.createElement(Loading, null);
|
|
357
319
|
}
|
|
358
|
-
|
|
359
320
|
if (!loading && !rows.length) {
|
|
360
321
|
return /*#__PURE__*/React.createElement(Empty, null);
|
|
361
322
|
}
|
|
362
|
-
|
|
363
323
|
return /*#__PURE__*/React.createElement("div", {
|
|
364
324
|
style: {
|
|
365
325
|
overflow: 'auto',
|
|
@@ -370,7 +330,6 @@ function Table(props, ref) {
|
|
|
370
330
|
onScroll: onBodyScroll
|
|
371
331
|
}, tableRowListNode, loadMoreLoading && /*#__PURE__*/React.createElement(Loading, null));
|
|
372
332
|
};
|
|
373
|
-
|
|
374
333
|
return /*#__PURE__*/React.createElement("div", {
|
|
375
334
|
className: classnames("".concat(prefixCls, "-inner-wrap"), _defineProperty({}, "".concat(prefixCls, "-innerScroll"), !!height))
|
|
376
335
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -379,7 +338,6 @@ function Table(props, ref) {
|
|
|
379
338
|
className: classnames("".concat(prefixCls, "-tbody"), _defineProperty({}, "".concat(prefixCls, "-tbody-innerScroll"), !!height))
|
|
380
339
|
}), renderNoHeightTableBody()));
|
|
381
340
|
};
|
|
382
|
-
|
|
383
341
|
return /*#__PURE__*/React.createElement("div", {
|
|
384
342
|
key: tableKey,
|
|
385
343
|
className: prefixCls,
|
|
@@ -391,7 +349,7 @@ function Table(props, ref) {
|
|
|
391
349
|
}, /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
392
350
|
onResize: function onResize(_ref3) {
|
|
393
351
|
var clientWidth = _ref3.width,
|
|
394
|
-
|
|
352
|
+
clientHeight = _ref3.height;
|
|
395
353
|
setTableClientWidth(clientWidth);
|
|
396
354
|
setTableClientHeight(clientHeight);
|
|
397
355
|
}
|
|
@@ -399,5 +357,4 @@ function Table(props, ref) {
|
|
|
399
357
|
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))
|
|
400
358
|
}), height ? renderTableWithHeight() : renderTableWithoutHeight())));
|
|
401
359
|
}
|
|
402
|
-
|
|
403
360
|
export default /*#__PURE__*/React.forwardRef(Table);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare function LoadingNode(): JSX.Element;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare function LoadingNode(): React.JSX.Element;
|
|
3
3
|
export default LoadingNode;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Empty from "../../../Empty";
|
|
3
3
|
import usePrefixCls from "../../../_utils/hooks/usePrefixCls";
|
|
4
|
-
|
|
5
4
|
function LoadingNode() {
|
|
6
5
|
var prefixCls = usePrefixCls('', 'ald-table');
|
|
7
6
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -12,5 +11,4 @@ function LoadingNode() {
|
|
|
12
11
|
image: Empty.PRESENTED_IMAGE_DATA
|
|
13
12
|
}));
|
|
14
13
|
}
|
|
15
|
-
|
|
16
14
|
export default LoadingNode;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare function LoadingNode(): JSX.Element;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare function LoadingNode(): React.JSX.Element;
|
|
3
3
|
export default LoadingNode;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Spin from "../../../Spin";
|
|
3
3
|
import usePrefixCls from "../../../_utils/hooks/usePrefixCls";
|
|
4
|
-
|
|
5
4
|
function LoadingNode() {
|
|
6
5
|
var prefixCls = usePrefixCls('', 'ald-table');
|
|
7
6
|
return /*#__PURE__*/React.createElement(Spin, {
|
|
@@ -10,5 +9,4 @@ function LoadingNode() {
|
|
|
10
9
|
className: "".concat(prefixCls, "-loading")
|
|
11
10
|
}));
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
export default LoadingNode;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MutableRefObject } from 'react';
|
|
1
|
+
import React, { MutableRefObject } from 'react';
|
|
2
2
|
import { Row } from 'react-table';
|
|
3
3
|
interface ITableBodyRowListProps<T extends object> {
|
|
4
4
|
data: T[];
|
|
@@ -9,5 +9,5 @@ interface ITableBodyRowListProps<T extends object> {
|
|
|
9
9
|
ellipsis?: boolean;
|
|
10
10
|
onRowSelected?: (row: T) => void;
|
|
11
11
|
}
|
|
12
|
-
declare function TableBodyRowList<T extends object>(props: ITableBodyRowListProps<T>): JSX.Element;
|
|
12
|
+
declare function TableBodyRowList<T extends object>(props: ITableBodyRowListProps<T>): React.JSX.Element;
|
|
13
13
|
export default TableBodyRowList;
|
|
@@ -1,69 +1,52 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
1
2
|
var _excluded = ["style"];
|
|
2
|
-
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
4
|
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; }
|
|
6
|
-
|
|
7
5
|
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; }
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
11
9
|
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; }
|
|
12
|
-
|
|
13
10
|
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; }
|
|
14
|
-
|
|
15
11
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
|
-
|
|
17
12
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
18
|
-
|
|
19
13
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
20
|
-
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
24
|
-
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
25
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
|
-
|
|
27
17
|
import classnames from 'classnames';
|
|
28
18
|
import React, { useCallback, useState } from 'react';
|
|
29
19
|
import usePrefixCls from "../../../_utils/hooks/usePrefixCls";
|
|
30
20
|
import { getValidWidthByNumber } from "../../utils";
|
|
31
|
-
|
|
32
21
|
function TableBodyRowList(props) {
|
|
33
22
|
var _props$ellipsis = props.ellipsis,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
23
|
+
ellipsis = _props$ellipsis === void 0 ? true : _props$ellipsis,
|
|
24
|
+
data = props.data,
|
|
25
|
+
rows = props.rows,
|
|
26
|
+
prepareRow = props.prepareRow,
|
|
27
|
+
columnsTotalWidthRef = props.columnsTotalWidthRef,
|
|
28
|
+
_props$rowClassName = props.rowClassName,
|
|
29
|
+
rowClassName = _props$rowClassName === void 0 ? '' : _props$rowClassName,
|
|
30
|
+
onRowSelected = props.onRowSelected;
|
|
43
31
|
var _useState = useState(null),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
selectedRowId = _useState2[0],
|
|
34
|
+
setSelectedRowId = _useState2[1];
|
|
48
35
|
var prefixCls = usePrefixCls('', 'ald-table');
|
|
49
36
|
var onRowClick = useCallback(function (row) {
|
|
50
37
|
if (!onRowSelected) {
|
|
51
38
|
return;
|
|
52
39
|
}
|
|
53
|
-
|
|
54
40
|
setSelectedRowId(row.id);
|
|
55
41
|
onRowSelected(row.original);
|
|
56
42
|
}, [onRowSelected, setSelectedRowId]);
|
|
57
43
|
return /*#__PURE__*/React.createElement(React.Fragment, null, data.map(function (item, index) {
|
|
58
44
|
var _classnames;
|
|
59
|
-
|
|
60
45
|
var row = rows[index];
|
|
61
46
|
prepareRow(row);
|
|
62
|
-
|
|
63
47
|
var _row$getRowProps = row.getRowProps(),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
48
|
+
rowStyle = _row$getRowProps.style,
|
|
49
|
+
rowProps = _objectWithoutProperties(_row$getRowProps, _excluded);
|
|
67
50
|
return /*#__PURE__*/React.createElement("div", _extends({}, rowProps, {
|
|
68
51
|
style: _objectSpread(_objectSpread({}, rowStyle), {}, {
|
|
69
52
|
width: columnsTotalWidthRef.current
|
|
@@ -75,9 +58,7 @@ function TableBodyRowList(props) {
|
|
|
75
58
|
key: row.id
|
|
76
59
|
}), row.cells.map(function (cell, index) {
|
|
77
60
|
var _cell$getCellProps$st, _cell$getCellProps$st2;
|
|
78
|
-
|
|
79
61
|
var currentRenderWidth = Number((_cell$getCellProps$st = cell.getCellProps().style) === null || _cell$getCellProps$st === void 0 ? void 0 : (_cell$getCellProps$st2 = _cell$getCellProps$st.width) === null || _cell$getCellProps$st2 === void 0 ? void 0 : _cell$getCellProps$st2.toString().replace('px', '')); // 表格内置计算的宽度 'px'
|
|
80
|
-
|
|
81
62
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
82
63
|
key: index
|
|
83
64
|
}, cell.getCellProps(), {
|
|
@@ -91,5 +72,4 @@ function TableBodyRowList(props) {
|
|
|
91
72
|
}));
|
|
92
73
|
}));
|
|
93
74
|
}
|
|
94
|
-
|
|
95
75
|
export default TableBodyRowList;
|
|
@@ -19,5 +19,5 @@ interface ITableWithoutHeightProps<T extends object> {
|
|
|
19
19
|
columnsWidthMapRef: MutableRefObject<Map<string, IWidthDetail> | undefined>;
|
|
20
20
|
columnsTotalWidthRef: MutableRefObject<number>;
|
|
21
21
|
}
|
|
22
|
-
declare function TableHead<T extends object>(props: ITableWithoutHeightProps<T>): JSX.Element;
|
|
22
|
+
declare function TableHead<T extends object>(props: ITableWithoutHeightProps<T>): React.JSX.Element;
|
|
23
23
|
export default TableHead;
|