@aloudata/aloudata-design 0.4.0-beta.10 → 0.4.0-beta.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/es/Button/style/index.less +1 -1
- package/es/Popconfirm/index.d.ts +89 -2
- package/es/Popconfirm/index.js +110 -1
- package/es/Popconfirm/style/index.less +56 -0
- package/es/Table/Table.js +49 -75
- package/es/Table/style/index.less +8 -4
- package/es/Tabs/index.d.ts +21 -6
- package/es/Tabs/index.js +1 -3
- package/es/index.d.ts +1 -1
- package/lib/Button/style/index.less +1 -1
- package/lib/Popconfirm/index.d.ts +89 -2
- package/lib/Popconfirm/index.js +116 -2
- package/lib/Popconfirm/style/index.less +56 -0
- package/lib/Table/Table.js +52 -79
- package/lib/Table/style/index.less +8 -4
- package/lib/Tabs/index.d.ts +21 -6
- package/lib/Tabs/index.js +1 -5
- package/lib/index.d.ts +1 -1
- package/package.json +2 -1
- package/es/Table/hooks/useFrame.d.ts +0 -7
- package/es/Table/hooks/useFrame.js +0 -90
- package/es/Tabs/TabPane.d.ts +0 -21
- package/es/Tabs/TabPane.js +0 -6
- package/lib/Table/hooks/useFrame.d.ts +0 -7
- package/lib/Table/hooks/useFrame.js +0 -98
- package/lib/Tabs/TabPane.d.ts +0 -21
- package/lib/Tabs/TabPane.js +0 -18
package/es/Popconfirm/index.d.ts
CHANGED
|
@@ -1,3 +1,90 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import type { AbstractTooltipProps, RenderFunction } from 'antd/lib/tooltip';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ButtonType, IButtonProps } from '../Button';
|
|
4
|
+
import './style/index.less';
|
|
5
|
+
export interface IPopconfirmProps extends AbstractTooltipProps {
|
|
6
|
+
/**
|
|
7
|
+
* @description 确认框的描述
|
|
8
|
+
* @type string | RenderFunction
|
|
9
|
+
* @default -
|
|
10
|
+
*/
|
|
11
|
+
title: string | RenderFunction;
|
|
12
|
+
/**
|
|
13
|
+
* @description 点击确认的回调
|
|
14
|
+
* @type (e?: React.MouseEvent<HTMLElement>) => void
|
|
15
|
+
* @default -
|
|
16
|
+
*/
|
|
17
|
+
onConfirm?: (e?: React.MouseEvent<HTMLElement>) => void;
|
|
18
|
+
/**
|
|
19
|
+
* @description 点击取消的回调
|
|
20
|
+
* @type (e?: React.MouseEvent<HTMLElement>) => void
|
|
21
|
+
* @default -
|
|
22
|
+
*/
|
|
23
|
+
onCancel?: (e?: React.MouseEvent<HTMLElement>) => void;
|
|
24
|
+
/**
|
|
25
|
+
* @description 确认按钮文字
|
|
26
|
+
* @type ReactNode
|
|
27
|
+
* @default 确认
|
|
28
|
+
*/
|
|
29
|
+
okText?: React.ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* @description 确认按钮类型
|
|
32
|
+
* @type string
|
|
33
|
+
* @default primary
|
|
34
|
+
*/
|
|
35
|
+
okType?: ButtonType;
|
|
36
|
+
/**
|
|
37
|
+
* @description 取消按钮文字
|
|
38
|
+
* @type ReactNode
|
|
39
|
+
* @default 取消
|
|
40
|
+
*/
|
|
41
|
+
cancelText?: React.ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* @description 取消按钮类型
|
|
44
|
+
* @type string
|
|
45
|
+
* @default text
|
|
46
|
+
*/
|
|
47
|
+
cancelType?: ButtonType;
|
|
48
|
+
/**
|
|
49
|
+
* @description ok按钮props
|
|
50
|
+
* @type IButtonProps
|
|
51
|
+
* @default -
|
|
52
|
+
*/
|
|
53
|
+
okButtonProps?: IButtonProps;
|
|
54
|
+
/**
|
|
55
|
+
* @description cancel按钮props
|
|
56
|
+
* @type IButtonProps
|
|
57
|
+
* @default -
|
|
58
|
+
*/
|
|
59
|
+
cancelButtonProps?: IButtonProps;
|
|
60
|
+
/**
|
|
61
|
+
* @description 是否显示取消按钮
|
|
62
|
+
* @type boolean
|
|
63
|
+
* @default true
|
|
64
|
+
*/
|
|
65
|
+
showCancel?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* @description 自定义弹出气泡的icon图标
|
|
68
|
+
* @type ReactNode
|
|
69
|
+
* @default -
|
|
70
|
+
*/
|
|
71
|
+
icon?: React.ReactNode;
|
|
72
|
+
/**
|
|
73
|
+
* @description 当确认框状态改变时
|
|
74
|
+
* @type (
|
|
75
|
+
open: boolean,
|
|
76
|
+
e?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLDivElement>,
|
|
77
|
+
) => void;
|
|
78
|
+
* @default -
|
|
79
|
+
*/
|
|
80
|
+
onOpenChange?: (open: boolean, e?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLDivElement>) => void;
|
|
81
|
+
/**
|
|
82
|
+
* @description 自定义底部按钮
|
|
83
|
+
* @type ReactNode
|
|
84
|
+
* @default -
|
|
85
|
+
*/
|
|
86
|
+
footer?: React.ReactNode;
|
|
87
|
+
children?: React.ReactNode;
|
|
88
|
+
}
|
|
89
|
+
declare const Popconfirm: ({ title, icon, okText, okType, cancelText, cancelType, okButtonProps, cancelButtonProps, showCancel, children, footer, ...props }: IPopconfirmProps) => JSX.Element;
|
|
3
90
|
export default Popconfirm;
|
package/es/Popconfirm/index.js
CHANGED
|
@@ -1,2 +1,111 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "antd/es/popover/style";
|
|
2
|
+
import _Popover from "antd/es/popover";
|
|
3
|
+
var _excluded = ["title", "icon", "okText", "okType", "cancelText", "cancelType", "okButtonProps", "cancelButtonProps", "showCancel", "children", "footer"];
|
|
4
|
+
|
|
5
|
+
var _this = this;
|
|
6
|
+
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
|
|
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."); }
|
|
10
|
+
|
|
11
|
+
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); }
|
|
12
|
+
|
|
13
|
+
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; }
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
|
|
17
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
+
|
|
19
|
+
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; }
|
|
20
|
+
|
|
21
|
+
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; }
|
|
22
|
+
|
|
23
|
+
import useMergedState from 'rc-util/lib/hooks/useMergedState';
|
|
24
|
+
import React from 'react';
|
|
25
|
+
import Button from '../Button';
|
|
26
|
+
import './style/index.less';
|
|
27
|
+
|
|
28
|
+
var Popconfirm = function Popconfirm(_ref) {
|
|
29
|
+
var title = _ref.title,
|
|
30
|
+
icon = _ref.icon,
|
|
31
|
+
_ref$okText = _ref.okText,
|
|
32
|
+
okText = _ref$okText === void 0 ? '确认' : _ref$okText,
|
|
33
|
+
_ref$okType = _ref.okType,
|
|
34
|
+
okType = _ref$okType === void 0 ? 'primary' : _ref$okType,
|
|
35
|
+
_ref$cancelText = _ref.cancelText,
|
|
36
|
+
cancelText = _ref$cancelText === void 0 ? '取消' : _ref$cancelText,
|
|
37
|
+
_ref$cancelType = _ref.cancelType,
|
|
38
|
+
cancelType = _ref$cancelType === void 0 ? 'text' : _ref$cancelType,
|
|
39
|
+
okButtonProps = _ref.okButtonProps,
|
|
40
|
+
cancelButtonProps = _ref.cancelButtonProps,
|
|
41
|
+
_ref$showCancel = _ref.showCancel,
|
|
42
|
+
showCancel = _ref$showCancel === void 0 ? true : _ref$showCancel,
|
|
43
|
+
children = _ref.children,
|
|
44
|
+
footer = _ref.footer,
|
|
45
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
46
|
+
|
|
47
|
+
var _useMergedState = useMergedState(false, {
|
|
48
|
+
value: props.open,
|
|
49
|
+
defaultValue: props.defaultOpen
|
|
50
|
+
}),
|
|
51
|
+
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
|
52
|
+
open = _useMergedState2[0],
|
|
53
|
+
setOpen = _useMergedState2[1];
|
|
54
|
+
|
|
55
|
+
var settingOpen = function settingOpen(value, e) {
|
|
56
|
+
var _props$onOpenChange;
|
|
57
|
+
|
|
58
|
+
setOpen(value, true);
|
|
59
|
+
(_props$onOpenChange = props.onOpenChange) === null || _props$onOpenChange === void 0 ? void 0 : _props$onOpenChange.call(props, value, e);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
var onConfirm = function onConfirm(e) {
|
|
63
|
+
var _props$onConfirm;
|
|
64
|
+
|
|
65
|
+
settingOpen(false, e);
|
|
66
|
+
(_props$onConfirm = props.onConfirm) === null || _props$onConfirm === void 0 ? void 0 : _props$onConfirm.call(_this, e);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
var onCancel = function onCancel(e) {
|
|
70
|
+
var _props$onCancel;
|
|
71
|
+
|
|
72
|
+
settingOpen(false, e);
|
|
73
|
+
(_props$onCancel = props.onCancel) === null || _props$onCancel === void 0 ? void 0 : _props$onCancel.call(_this, e);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
var onOpenChange = function onOpenChange(value) {
|
|
77
|
+
settingOpen(value);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
var content = /*#__PURE__*/React.createElement("div", {
|
|
81
|
+
className: "content"
|
|
82
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
83
|
+
className: "contentTitle"
|
|
84
|
+
}, icon && /*#__PURE__*/React.createElement("span", {
|
|
85
|
+
className: "icon"
|
|
86
|
+
}, icon), /*#__PURE__*/React.createElement("p", {
|
|
87
|
+
className: "desc"
|
|
88
|
+
}, typeof title === 'function' ? title() : title)), /*#__PURE__*/React.createElement("div", {
|
|
89
|
+
className: "contentFooter"
|
|
90
|
+
}, footer || /*#__PURE__*/React.createElement(React.Fragment, null, showCancel && /*#__PURE__*/React.createElement(Button, Object.assign({
|
|
91
|
+
type: cancelType
|
|
92
|
+
}, cancelButtonProps, {
|
|
93
|
+
onClick: onCancel
|
|
94
|
+
}), cancelText), /*#__PURE__*/React.createElement(Button, Object.assign({
|
|
95
|
+
type: okType
|
|
96
|
+
}, okButtonProps, {
|
|
97
|
+
onClick: onConfirm
|
|
98
|
+
}), okText))));
|
|
99
|
+
return /*#__PURE__*/React.createElement(_Popover, Object.assign({
|
|
100
|
+
content: content,
|
|
101
|
+
open: open,
|
|
102
|
+
onVisibleChange: onOpenChange,
|
|
103
|
+
trigger: ['click']
|
|
104
|
+
}, props), /*#__PURE__*/React.createElement("span", {
|
|
105
|
+
onClick: function onClick() {
|
|
106
|
+
setOpen(!open);
|
|
107
|
+
}
|
|
108
|
+
}, children));
|
|
109
|
+
};
|
|
110
|
+
|
|
2
111
|
export default Popconfirm;
|
|
@@ -1 +1,57 @@
|
|
|
1
1
|
@import '../../style/index.less';
|
|
2
|
+
|
|
3
|
+
.content {
|
|
4
|
+
width: 320px;
|
|
5
|
+
max-height: 152px;
|
|
6
|
+
overflow: auto;
|
|
7
|
+
border-radius: @border-radius-base;
|
|
8
|
+
|
|
9
|
+
.contentTitle {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex: none;
|
|
12
|
+
flex-direction: row;
|
|
13
|
+
flex-grow: 0;
|
|
14
|
+
gap: 4px;
|
|
15
|
+
align-items: flex-start;
|
|
16
|
+
align-self: stretch;
|
|
17
|
+
order: 0;
|
|
18
|
+
width: 300px;
|
|
19
|
+
padding: 16px;
|
|
20
|
+
line-height: 20px;
|
|
21
|
+
|
|
22
|
+
.icon {
|
|
23
|
+
flex: 0 0 20px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.desc {
|
|
27
|
+
flex: 1;
|
|
28
|
+
align-items: center;
|
|
29
|
+
width: 244px;
|
|
30
|
+
color: @NL40;
|
|
31
|
+
font-weight: 400;
|
|
32
|
+
font-size: 14px;
|
|
33
|
+
line-height: 20px;
|
|
34
|
+
word-wrap: break-word;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.contentFooter {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex: none;
|
|
41
|
+
flex-grow: 0;
|
|
42
|
+
gap: 12px;
|
|
43
|
+
align-items: center;
|
|
44
|
+
align-self: stretch;
|
|
45
|
+
justify-content: flex-end;
|
|
46
|
+
order: 1;
|
|
47
|
+
width: 300px;
|
|
48
|
+
height: 60px;
|
|
49
|
+
padding: 16px;
|
|
50
|
+
background: @BG100;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.ant-popover-inner {
|
|
55
|
+
border-radius: @border-radius-base;
|
|
56
|
+
box-shadow: @shadow-lg;
|
|
57
|
+
}
|
package/es/Table/Table.js
CHANGED
|
@@ -30,15 +30,13 @@ import Loading from './components/Loading';
|
|
|
30
30
|
import Empty from './components/Empty';
|
|
31
31
|
import TableHead from './components/TableHead';
|
|
32
32
|
import TableBodyRowList from './components/TableBodyRowList';
|
|
33
|
-
import { useTimeoutLock } from './hooks/useFrame';
|
|
34
33
|
var tableHeadRowHeight = 44;
|
|
35
|
-
var SCROLLBAR_SIZE = 15;
|
|
36
34
|
var ZERO = 0;
|
|
37
35
|
|
|
38
36
|
function Table(props, ref) {
|
|
39
|
-
var
|
|
37
|
+
var _classnames2;
|
|
40
38
|
|
|
41
|
-
var
|
|
39
|
+
var outerKey = props.key,
|
|
42
40
|
columns = props.columns,
|
|
43
41
|
data = props.data,
|
|
44
42
|
onRowSelected = props.onRowSelected,
|
|
@@ -74,7 +72,6 @@ function Table(props, ref) {
|
|
|
74
72
|
|
|
75
73
|
var prefixCls = usePrefixCls('', 'ald-table');
|
|
76
74
|
var tableRef = useRef(null);
|
|
77
|
-
var tableHeadRef = useRef(null);
|
|
78
75
|
var tableBodyRef = useRef(null);
|
|
79
76
|
var columnsWidthMapRef = useRef();
|
|
80
77
|
var columnsTotalWidthRef = useRef(ZERO);
|
|
@@ -84,15 +81,24 @@ function Table(props, ref) {
|
|
|
84
81
|
loadMoreLoading = _useState6[0],
|
|
85
82
|
setLoadMoreLoading = _useState6[1];
|
|
86
83
|
|
|
87
|
-
var lastOffsetLeftRef = useRef(ZERO);
|
|
88
84
|
var lastOffsetTopRef = useRef(ZERO);
|
|
89
85
|
|
|
90
|
-
var
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
var _useState7 = useState(ZERO),
|
|
87
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
88
|
+
tableBodyContentHeight = _useState8[0],
|
|
89
|
+
setTableBodyContentHeight = _useState8[1]; // 如果列长度存在变化时,触发重新计算页面的宽度,否则需要用户手动更改key
|
|
94
90
|
|
|
95
91
|
|
|
92
|
+
var tableKey = useMemo(function () {
|
|
93
|
+
var columnLength = (columns === null || columns === void 0 ? void 0 : columns.length) || ZERO;
|
|
94
|
+
|
|
95
|
+
if (outerKey) {
|
|
96
|
+
return "".concat(outerKey, "-").concat(columnLength);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return "".concat(columnLength);
|
|
100
|
+
}, [columns === null || columns === void 0 ? void 0 : columns.length, outerKey]); // 初始化进入时 渲染表格容器宽度
|
|
101
|
+
|
|
96
102
|
useEffect(function () {
|
|
97
103
|
if (tableRef.current) {
|
|
98
104
|
setTableClientWidth(tableRef.current.clientWidth);
|
|
@@ -216,7 +222,6 @@ function Table(props, ref) {
|
|
|
216
222
|
var tableHeadNode = /*#__PURE__*/React.createElement(TableHead, {
|
|
217
223
|
canResizeColumn: resizeColumn,
|
|
218
224
|
headerGroups: headerGroups,
|
|
219
|
-
// tableContentWidth={columnsTotalWidthRef.current}
|
|
220
225
|
defaultSort: defaultSort,
|
|
221
226
|
sortable: sortable,
|
|
222
227
|
columns: newColumns,
|
|
@@ -259,30 +264,24 @@ function Table(props, ref) {
|
|
|
259
264
|
width: columnsTotalWidthRef.current
|
|
260
265
|
}
|
|
261
266
|
}), renderNoHeightTableBody()));
|
|
262
|
-
};
|
|
267
|
+
}; // 存在高度时,内部的纵向的滚动
|
|
268
|
+
|
|
263
269
|
|
|
264
|
-
var
|
|
265
|
-
if (!
|
|
270
|
+
var onBodyVerticalScroll = useCallback(function (e) {
|
|
271
|
+
if (!tableClientHeight) {
|
|
266
272
|
return;
|
|
267
273
|
}
|
|
268
274
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
target.scrollLeft = scrollLeftNum;
|
|
274
|
-
}
|
|
275
|
-
}, []); // 内部滚动时 纵向的滚动
|
|
275
|
+
var _e$target = e.target,
|
|
276
|
+
scrollHeight = _e$target.scrollHeight,
|
|
277
|
+
clientHeight = _e$target.clientHeight,
|
|
278
|
+
currentTargetScrollTop = _e$target.scrollTop; // 说明是横向滚动
|
|
276
279
|
|
|
277
|
-
|
|
278
|
-
if (!tableClientHeight) {
|
|
280
|
+
if (lastOffsetTopRef.current === currentTargetScrollTop) {
|
|
279
281
|
return;
|
|
280
282
|
}
|
|
281
283
|
|
|
282
|
-
var
|
|
283
|
-
clientHeight = target.clientHeight,
|
|
284
|
-
scrollTop = target.scrollTop;
|
|
285
|
-
var currentPosToBottomGap = scrollHeight - clientHeight - scrollTop; // 当前滚动条到底部的距离
|
|
284
|
+
var currentPosToBottomGap = scrollHeight - clientHeight - currentTargetScrollTop + tableHeadRowHeight; // 当前滚动条到底部的距离
|
|
286
285
|
|
|
287
286
|
var scrollThresholdValue = getValidScrollThreshold(scrollThreshold, tableClientHeight);
|
|
288
287
|
|
|
@@ -295,36 +294,8 @@ function Table(props, ref) {
|
|
|
295
294
|
});
|
|
296
295
|
}
|
|
297
296
|
|
|
298
|
-
lastOffsetTopRef.current =
|
|
299
|
-
}, [hasNextPage, loadMore, loadMoreLoading, scrollThreshold, tableClientHeight]);
|
|
300
|
-
|
|
301
|
-
var onBodyScroll = useCallback(function (e) {
|
|
302
|
-
var currentTarget = e.target;
|
|
303
|
-
|
|
304
|
-
if (!currentTarget) {
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
var scrollLeftNum = currentTarget.scrollLeft;
|
|
309
|
-
var scrollTopNum = currentTarget.scrollTop; // 纵向滚动
|
|
310
|
-
|
|
311
|
-
if (scrollTopNum !== lastOffsetLeftRef.current) {
|
|
312
|
-
onBodyVerticalScroll(currentTarget);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
if (scrollLeftNum === lastOffsetLeftRef.current) {
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
var compareTarget = currentTarget; // 横向滚动
|
|
320
|
-
|
|
321
|
-
if (!getScrollTarget() || getScrollTarget() === compareTarget) {
|
|
322
|
-
setScrollTarget(compareTarget);
|
|
323
|
-
forceScroll(scrollLeftNum, tableBodyRef.current);
|
|
324
|
-
forceScroll(scrollLeftNum, tableHeadRef.current);
|
|
325
|
-
lastOffsetLeftRef.current = scrollLeftNum;
|
|
326
|
-
}
|
|
327
|
-
}, [forceScroll, getScrollTarget, onBodyVerticalScroll, setScrollTarget]);
|
|
297
|
+
lastOffsetTopRef.current = currentTargetScrollTop;
|
|
298
|
+
}, [hasNextPage, loadMore, loadMoreLoading, scrollThreshold, tableClientHeight]);
|
|
328
299
|
useEffect(function () {
|
|
329
300
|
if (!hasNextPage) {
|
|
330
301
|
setLoadMoreLoading(false);
|
|
@@ -336,7 +307,7 @@ function Table(props, ref) {
|
|
|
336
307
|
return null;
|
|
337
308
|
}
|
|
338
309
|
|
|
339
|
-
var
|
|
310
|
+
var renderTableBody = function renderTableBody() {
|
|
340
311
|
if (loading && !rows.length) {
|
|
341
312
|
return /*#__PURE__*/React.createElement(Loading, null);
|
|
342
313
|
}
|
|
@@ -345,25 +316,28 @@ function Table(props, ref) {
|
|
|
345
316
|
return /*#__PURE__*/React.createElement(Empty, null);
|
|
346
317
|
}
|
|
347
318
|
|
|
348
|
-
return /*#__PURE__*/React.createElement(
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
ref: tableBodyRef,
|
|
355
|
-
onScroll: onBodyScroll
|
|
356
|
-
}, tableRowListNode, loadMoreLoading && /*#__PURE__*/React.createElement(Loading, null));
|
|
319
|
+
return /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
320
|
+
onResize: function onResize(_ref2) {
|
|
321
|
+
var clientHeight = _ref2.height;
|
|
322
|
+
setTableBodyContentHeight(clientHeight);
|
|
323
|
+
}
|
|
324
|
+
}, /*#__PURE__*/React.createElement("div", null, tableRowListNode, loadMoreLoading && /*#__PURE__*/React.createElement(Loading, null)));
|
|
357
325
|
};
|
|
358
326
|
|
|
359
327
|
return /*#__PURE__*/React.createElement("div", {
|
|
360
|
-
className: classnames("".concat(prefixCls, "-inner-wrap"), _defineProperty({}, "".concat(prefixCls, "-innerScroll"), !!height))
|
|
328
|
+
className: classnames("".concat(prefixCls, "-inner-wrap"), _defineProperty({}, "".concat(prefixCls, "-innerScroll"), !!height)),
|
|
329
|
+
ref: tableBodyRef,
|
|
330
|
+
onScroll: onBodyVerticalScroll
|
|
331
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
332
|
+
style: {
|
|
333
|
+
width: columnsTotalWidthRef.current,
|
|
334
|
+
height: tableBodyContentHeight
|
|
335
|
+
}
|
|
361
336
|
}, /*#__PURE__*/React.createElement("div", {
|
|
362
|
-
ref: tableHeadRef,
|
|
363
337
|
className: "".concat(prefixCls, "-tableHeadScrollWrap")
|
|
364
338
|
}, tableHeadNode), /*#__PURE__*/React.createElement("div", Object.assign({}, getTableBodyProps(), {
|
|
365
|
-
className: classnames("".concat(prefixCls, "-tbody")
|
|
366
|
-
}),
|
|
339
|
+
className: classnames("".concat(prefixCls, "-tbody"))
|
|
340
|
+
}), renderTableBody())));
|
|
367
341
|
};
|
|
368
342
|
|
|
369
343
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -374,14 +348,14 @@ function Table(props, ref) {
|
|
|
374
348
|
height: !height ? 'unset' : height
|
|
375
349
|
}
|
|
376
350
|
}, /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
377
|
-
onResize: function onResize(
|
|
378
|
-
var clientWidth =
|
|
379
|
-
clientHeight =
|
|
351
|
+
onResize: function onResize(_ref3) {
|
|
352
|
+
var clientWidth = _ref3.width,
|
|
353
|
+
clientHeight = _ref3.height;
|
|
380
354
|
setTableClientWidth(clientWidth);
|
|
381
355
|
setTableClientHeight(clientHeight);
|
|
382
356
|
}
|
|
383
357
|
}, !tableClientWidth ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null)) : /*#__PURE__*/React.createElement("div", Object.assign({}, getTableProps(), {
|
|
384
|
-
className: classnames("".concat(prefixCls, "-table-wrap"), (
|
|
358
|
+
className: classnames("".concat(prefixCls, "-table-wrap"), (_classnames2 = {}, _defineProperty(_classnames2, "".concat(prefixCls, "-init-loading"), data.length === ZERO && loading), _defineProperty(_classnames2, "".concat(prefixCls, "-empty"), data.length === ZERO && loading), _classnames2))
|
|
385
359
|
}), height ? renderTableWithHeight() : renderTableWithoutHeight())));
|
|
386
360
|
}
|
|
387
361
|
|
|
@@ -24,15 +24,19 @@
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
&-inner-wrap {
|
|
27
|
+
position: relative;
|
|
27
28
|
width: 100%;
|
|
28
29
|
height: 100%;
|
|
29
30
|
overflow-x: overlay;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
&-tableHeadScrollWrap {
|
|
34
|
+
position: sticky;
|
|
35
|
+
top: 0;
|
|
36
|
+
z-index: 1;
|
|
33
37
|
display: flex;
|
|
34
38
|
width: 100%;
|
|
35
|
-
overflow
|
|
39
|
+
overflow: hidden;
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
&-cell {
|
|
@@ -67,6 +71,7 @@
|
|
|
67
71
|
.ald-table-row {
|
|
68
72
|
min-width: 9999px; // 防止拖动时的闪动
|
|
69
73
|
height: @table-head-row-height;
|
|
74
|
+
background-color: @BG95;
|
|
70
75
|
}
|
|
71
76
|
|
|
72
77
|
.ald-table-cell {
|
|
@@ -74,7 +79,6 @@
|
|
|
74
79
|
padding: 14px 24px;
|
|
75
80
|
color: @NL50;
|
|
76
81
|
line-height: 20px;
|
|
77
|
-
background-color: @BG95;
|
|
78
82
|
|
|
79
83
|
.ald-table-cell-content {
|
|
80
84
|
overflow: hidden;
|
|
@@ -146,8 +150,8 @@
|
|
|
146
150
|
}
|
|
147
151
|
}
|
|
148
152
|
|
|
149
|
-
&-
|
|
150
|
-
overflow:
|
|
153
|
+
&-innerScroll {
|
|
154
|
+
overflow-y: overlay;
|
|
151
155
|
}
|
|
152
156
|
|
|
153
157
|
&-row-list-wrap {
|
package/es/Tabs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { TabsProps } from 'antd';
|
|
3
3
|
export declare type TabsSize = 'default' | 'large';
|
|
4
4
|
export interface ITabsProps extends Omit<TabsProps, 'size'> {
|
|
@@ -38,10 +38,25 @@ export interface ITabsProps extends Omit<TabsProps, 'size'> {
|
|
|
38
38
|
*/
|
|
39
39
|
tabPosition?: 'left' | 'right' | 'top' | 'bottom';
|
|
40
40
|
className?: string;
|
|
41
|
-
|
|
41
|
+
items: ITabItem[];
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
export default function Tabs(props: ITabsProps): JSX.Element;
|
|
44
|
+
export interface ITabItem {
|
|
45
|
+
/**
|
|
46
|
+
* @description 被隐藏时是否渲染 DOM 结构
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
forceRender?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* @description 对应 activeKey
|
|
52
|
+
* @default -
|
|
53
|
+
*/
|
|
54
|
+
key: string;
|
|
55
|
+
/**
|
|
56
|
+
* @description 选项卡头显示的内容
|
|
57
|
+
* @default -
|
|
58
|
+
*/
|
|
59
|
+
label: ReactNode;
|
|
60
|
+
className?: string;
|
|
61
|
+
children?: ReactNode;
|
|
46
62
|
}
|
|
47
|
-
export default Tabs;
|
package/es/Tabs/index.js
CHANGED
|
@@ -16,7 +16,6 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
16
16
|
|
|
17
17
|
import React from 'react'; // import AntdTabs, { TabsProps } from 'antd/lib/tabs';
|
|
18
18
|
|
|
19
|
-
import TabPane from './TabPane';
|
|
20
19
|
import classNames from 'classnames';
|
|
21
20
|
export default function Tabs(props) {
|
|
22
21
|
var size = props.size,
|
|
@@ -44,5 +43,4 @@ export default function Tabs(props) {
|
|
|
44
43
|
'ald-tabs-default': size !== 'large'
|
|
45
44
|
})
|
|
46
45
|
}, tabsProps));
|
|
47
|
-
}
|
|
48
|
-
Tabs.TabPane = TabPane;
|
|
46
|
+
}
|
package/es/index.d.ts
CHANGED
|
@@ -77,5 +77,5 @@ export type { IAvatarProps as AvatarProps } from './Avatar';
|
|
|
77
77
|
export { default as Icon } from './Icon';
|
|
78
78
|
export type { PageHeaderProps } from './PageHeader';
|
|
79
79
|
export { default as PageHeader } from './PageHeader';
|
|
80
|
-
export type { PopconfirmProps } from './Popconfirm';
|
|
80
|
+
export type { IPopconfirmProps as PopconfirmProps } from './Popconfirm';
|
|
81
81
|
export { default as Popconfirm } from './Popconfirm';
|