@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
|
@@ -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/lib/Popconfirm/index.js
CHANGED
|
@@ -5,9 +5,123 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
require("antd/es/popover/style");
|
|
9
|
+
|
|
10
|
+
var _popover = _interopRequireDefault(require("antd/es/popover"));
|
|
11
|
+
|
|
12
|
+
var _useMergedState3 = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _Button = _interopRequireDefault(require("../Button"));
|
|
17
|
+
|
|
18
|
+
require("./style/index.less");
|
|
19
|
+
|
|
20
|
+
var _excluded = ["title", "icon", "okText", "okType", "cancelText", "cancelType", "okButtonProps", "cancelButtonProps", "showCancel", "children", "footer"];
|
|
21
|
+
|
|
22
|
+
var _this = void 0;
|
|
9
23
|
|
|
10
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
25
|
|
|
12
|
-
|
|
26
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
+
|
|
28
|
+
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."); }
|
|
29
|
+
|
|
30
|
+
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); }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
36
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
|
+
|
|
38
|
+
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; }
|
|
39
|
+
|
|
40
|
+
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; }
|
|
41
|
+
|
|
42
|
+
var Popconfirm = function Popconfirm(_ref) {
|
|
43
|
+
var title = _ref.title,
|
|
44
|
+
icon = _ref.icon,
|
|
45
|
+
_ref$okText = _ref.okText,
|
|
46
|
+
okText = _ref$okText === void 0 ? '确认' : _ref$okText,
|
|
47
|
+
_ref$okType = _ref.okType,
|
|
48
|
+
okType = _ref$okType === void 0 ? 'primary' : _ref$okType,
|
|
49
|
+
_ref$cancelText = _ref.cancelText,
|
|
50
|
+
cancelText = _ref$cancelText === void 0 ? '取消' : _ref$cancelText,
|
|
51
|
+
_ref$cancelType = _ref.cancelType,
|
|
52
|
+
cancelType = _ref$cancelType === void 0 ? 'text' : _ref$cancelType,
|
|
53
|
+
okButtonProps = _ref.okButtonProps,
|
|
54
|
+
cancelButtonProps = _ref.cancelButtonProps,
|
|
55
|
+
_ref$showCancel = _ref.showCancel,
|
|
56
|
+
showCancel = _ref$showCancel === void 0 ? true : _ref$showCancel,
|
|
57
|
+
children = _ref.children,
|
|
58
|
+
footer = _ref.footer,
|
|
59
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
60
|
+
|
|
61
|
+
var _useMergedState = (0, _useMergedState3.default)(false, {
|
|
62
|
+
value: props.open,
|
|
63
|
+
defaultValue: props.defaultOpen
|
|
64
|
+
}),
|
|
65
|
+
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
|
66
|
+
open = _useMergedState2[0],
|
|
67
|
+
setOpen = _useMergedState2[1];
|
|
68
|
+
|
|
69
|
+
var settingOpen = function settingOpen(value, e) {
|
|
70
|
+
var _props$onOpenChange;
|
|
71
|
+
|
|
72
|
+
setOpen(value, true);
|
|
73
|
+
(_props$onOpenChange = props.onOpenChange) === null || _props$onOpenChange === void 0 ? void 0 : _props$onOpenChange.call(props, value, e);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
var onConfirm = function onConfirm(e) {
|
|
77
|
+
var _props$onConfirm;
|
|
78
|
+
|
|
79
|
+
settingOpen(false, e);
|
|
80
|
+
(_props$onConfirm = props.onConfirm) === null || _props$onConfirm === void 0 ? void 0 : _props$onConfirm.call(_this, e);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
var onCancel = function onCancel(e) {
|
|
84
|
+
var _props$onCancel;
|
|
85
|
+
|
|
86
|
+
settingOpen(false, e);
|
|
87
|
+
(_props$onCancel = props.onCancel) === null || _props$onCancel === void 0 ? void 0 : _props$onCancel.call(_this, e);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
var onOpenChange = function onOpenChange(value) {
|
|
91
|
+
settingOpen(value);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
var content = /*#__PURE__*/_react.default.createElement("div", {
|
|
95
|
+
className: "content"
|
|
96
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
97
|
+
className: "contentTitle"
|
|
98
|
+
}, icon && /*#__PURE__*/_react.default.createElement("span", {
|
|
99
|
+
className: "icon"
|
|
100
|
+
}, icon), /*#__PURE__*/_react.default.createElement("p", {
|
|
101
|
+
className: "desc"
|
|
102
|
+
}, typeof title === 'function' ? title() : title)), /*#__PURE__*/_react.default.createElement("div", {
|
|
103
|
+
className: "contentFooter"
|
|
104
|
+
}, footer || /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showCancel && /*#__PURE__*/_react.default.createElement(_Button.default, Object.assign({
|
|
105
|
+
type: cancelType
|
|
106
|
+
}, cancelButtonProps, {
|
|
107
|
+
onClick: onCancel
|
|
108
|
+
}), cancelText), /*#__PURE__*/_react.default.createElement(_Button.default, Object.assign({
|
|
109
|
+
type: okType
|
|
110
|
+
}, okButtonProps, {
|
|
111
|
+
onClick: onConfirm
|
|
112
|
+
}), okText))));
|
|
113
|
+
|
|
114
|
+
return /*#__PURE__*/_react.default.createElement(_popover.default, Object.assign({
|
|
115
|
+
content: content,
|
|
116
|
+
open: open,
|
|
117
|
+
onVisibleChange: onOpenChange,
|
|
118
|
+
trigger: ['click']
|
|
119
|
+
}, props), /*#__PURE__*/_react.default.createElement("span", {
|
|
120
|
+
onClick: function onClick() {
|
|
121
|
+
setOpen(!open);
|
|
122
|
+
}
|
|
123
|
+
}, children));
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
var _default = Popconfirm;
|
|
13
127
|
exports.default = _default;
|
|
@@ -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/lib/Table/Table.js
CHANGED
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _classnames3 = _interopRequireDefault(require("classnames"));
|
|
11
11
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
|
|
@@ -31,8 +31,6 @@ var _TableHead = _interopRequireDefault(require("./components/TableHead"));
|
|
|
31
31
|
|
|
32
32
|
var _TableBodyRowList = _interopRequireDefault(require("./components/TableBodyRowList"));
|
|
33
33
|
|
|
34
|
-
var _useFrame = require("./hooks/useFrame");
|
|
35
|
-
|
|
36
34
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
35
|
|
|
38
36
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -58,13 +56,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
58
56
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
59
57
|
|
|
60
58
|
var tableHeadRowHeight = 44;
|
|
61
|
-
var SCROLLBAR_SIZE = 15;
|
|
62
59
|
var ZERO = 0;
|
|
63
60
|
|
|
64
61
|
function Table(props, ref) {
|
|
65
|
-
var
|
|
62
|
+
var _classnames2;
|
|
66
63
|
|
|
67
|
-
var
|
|
64
|
+
var outerKey = props.key,
|
|
68
65
|
columns = props.columns,
|
|
69
66
|
data = props.data,
|
|
70
67
|
onRowSelected = props.onRowSelected,
|
|
@@ -100,7 +97,6 @@ function Table(props, ref) {
|
|
|
100
97
|
|
|
101
98
|
var prefixCls = (0, _usePrefixCls.default)('', 'ald-table');
|
|
102
99
|
var tableRef = (0, _react.useRef)(null);
|
|
103
|
-
var tableHeadRef = (0, _react.useRef)(null);
|
|
104
100
|
var tableBodyRef = (0, _react.useRef)(null);
|
|
105
101
|
var columnsWidthMapRef = (0, _react.useRef)();
|
|
106
102
|
var columnsTotalWidthRef = (0, _react.useRef)(ZERO);
|
|
@@ -110,14 +106,23 @@ function Table(props, ref) {
|
|
|
110
106
|
loadMoreLoading = _useState6[0],
|
|
111
107
|
setLoadMoreLoading = _useState6[1];
|
|
112
108
|
|
|
113
|
-
var lastOffsetLeftRef = (0, _react.useRef)(ZERO);
|
|
114
109
|
var lastOffsetTopRef = (0, _react.useRef)(ZERO);
|
|
115
110
|
|
|
116
|
-
var
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
var _useState7 = (0, _react.useState)(ZERO),
|
|
112
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
113
|
+
tableBodyContentHeight = _useState8[0],
|
|
114
|
+
setTableBodyContentHeight = _useState8[1]; // 如果列长度存在变化时,触发重新计算页面的宽度,否则需要用户手动更改key
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
var tableKey = (0, _react.useMemo)(function () {
|
|
118
|
+
var columnLength = (columns === null || columns === void 0 ? void 0 : columns.length) || ZERO;
|
|
119
|
+
|
|
120
|
+
if (outerKey) {
|
|
121
|
+
return "".concat(outerKey, "-").concat(columnLength);
|
|
122
|
+
}
|
|
120
123
|
|
|
124
|
+
return "".concat(columnLength);
|
|
125
|
+
}, [columns === null || columns === void 0 ? void 0 : columns.length, outerKey]); // 初始化进入时 渲染表格容器宽度
|
|
121
126
|
|
|
122
127
|
(0, _react.useEffect)(function () {
|
|
123
128
|
if (tableRef.current) {
|
|
@@ -243,7 +248,6 @@ function Table(props, ref) {
|
|
|
243
248
|
var tableHeadNode = /*#__PURE__*/_react.default.createElement(_TableHead.default, {
|
|
244
249
|
canResizeColumn: resizeColumn,
|
|
245
250
|
headerGroups: headerGroups,
|
|
246
|
-
// tableContentWidth={columnsTotalWidthRef.current}
|
|
247
251
|
defaultSort: defaultSort,
|
|
248
252
|
sortable: sortable,
|
|
249
253
|
columns: newColumns,
|
|
@@ -281,37 +285,31 @@ function Table(props, ref) {
|
|
|
281
285
|
};
|
|
282
286
|
|
|
283
287
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
284
|
-
className: (0,
|
|
288
|
+
className: (0, _classnames3.default)("".concat(prefixCls, "-inner-wrap"))
|
|
285
289
|
}, tableHeadNode, /*#__PURE__*/_react.default.createElement("div", Object.assign({}, getTableBodyProps(), {
|
|
286
|
-
className: (0,
|
|
290
|
+
className: (0, _classnames3.default)("".concat(prefixCls, "-tbody")),
|
|
287
291
|
style: {
|
|
288
292
|
width: columnsTotalWidthRef.current
|
|
289
293
|
}
|
|
290
294
|
}), renderNoHeightTableBody()));
|
|
291
|
-
};
|
|
295
|
+
}; // 存在高度时,内部的纵向的滚动
|
|
292
296
|
|
|
293
|
-
|
|
294
|
-
|
|
297
|
+
|
|
298
|
+
var onBodyVerticalScroll = (0, _react.useCallback)(function (e) {
|
|
299
|
+
if (!tableClientHeight) {
|
|
295
300
|
return;
|
|
296
301
|
}
|
|
297
302
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
target.scrollLeft = scrollLeftNum;
|
|
303
|
-
}
|
|
304
|
-
}, []); // 内部滚动时 纵向的滚动
|
|
303
|
+
var _e$target = e.target,
|
|
304
|
+
scrollHeight = _e$target.scrollHeight,
|
|
305
|
+
clientHeight = _e$target.clientHeight,
|
|
306
|
+
currentTargetScrollTop = _e$target.scrollTop; // 说明是横向滚动
|
|
305
307
|
|
|
306
|
-
|
|
307
|
-
if (!tableClientHeight) {
|
|
308
|
+
if (lastOffsetTopRef.current === currentTargetScrollTop) {
|
|
308
309
|
return;
|
|
309
310
|
}
|
|
310
311
|
|
|
311
|
-
var
|
|
312
|
-
clientHeight = target.clientHeight,
|
|
313
|
-
scrollTop = target.scrollTop;
|
|
314
|
-
var currentPosToBottomGap = scrollHeight - clientHeight - scrollTop; // 当前滚动条到底部的距离
|
|
312
|
+
var currentPosToBottomGap = scrollHeight - clientHeight - currentTargetScrollTop + tableHeadRowHeight; // 当前滚动条到底部的距离
|
|
315
313
|
|
|
316
314
|
var scrollThresholdValue = (0, _utils.getValidScrollThreshold)(scrollThreshold, tableClientHeight);
|
|
317
315
|
|
|
@@ -324,36 +322,8 @@ function Table(props, ref) {
|
|
|
324
322
|
});
|
|
325
323
|
}
|
|
326
324
|
|
|
327
|
-
lastOffsetTopRef.current =
|
|
328
|
-
}, [hasNextPage, loadMore, loadMoreLoading, scrollThreshold, tableClientHeight]);
|
|
329
|
-
|
|
330
|
-
var onBodyScroll = (0, _react.useCallback)(function (e) {
|
|
331
|
-
var currentTarget = e.target;
|
|
332
|
-
|
|
333
|
-
if (!currentTarget) {
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
var scrollLeftNum = currentTarget.scrollLeft;
|
|
338
|
-
var scrollTopNum = currentTarget.scrollTop; // 纵向滚动
|
|
339
|
-
|
|
340
|
-
if (scrollTopNum !== lastOffsetLeftRef.current) {
|
|
341
|
-
onBodyVerticalScroll(currentTarget);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
if (scrollLeftNum === lastOffsetLeftRef.current) {
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
var compareTarget = currentTarget; // 横向滚动
|
|
349
|
-
|
|
350
|
-
if (!getScrollTarget() || getScrollTarget() === compareTarget) {
|
|
351
|
-
setScrollTarget(compareTarget);
|
|
352
|
-
forceScroll(scrollLeftNum, tableBodyRef.current);
|
|
353
|
-
forceScroll(scrollLeftNum, tableHeadRef.current);
|
|
354
|
-
lastOffsetLeftRef.current = scrollLeftNum;
|
|
355
|
-
}
|
|
356
|
-
}, [forceScroll, getScrollTarget, onBodyVerticalScroll, setScrollTarget]);
|
|
325
|
+
lastOffsetTopRef.current = currentTargetScrollTop;
|
|
326
|
+
}, [hasNextPage, loadMore, loadMoreLoading, scrollThreshold, tableClientHeight]);
|
|
357
327
|
(0, _react.useEffect)(function () {
|
|
358
328
|
if (!hasNextPage) {
|
|
359
329
|
setLoadMoreLoading(false);
|
|
@@ -365,7 +335,7 @@ function Table(props, ref) {
|
|
|
365
335
|
return null;
|
|
366
336
|
}
|
|
367
337
|
|
|
368
|
-
var
|
|
338
|
+
var renderTableBody = function renderTableBody() {
|
|
369
339
|
if (loading && !rows.length) {
|
|
370
340
|
return /*#__PURE__*/_react.default.createElement(_Loading.default, null);
|
|
371
341
|
}
|
|
@@ -374,25 +344,28 @@ function Table(props, ref) {
|
|
|
374
344
|
return /*#__PURE__*/_react.default.createElement(_Empty.default, null);
|
|
375
345
|
}
|
|
376
346
|
|
|
377
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
ref: tableBodyRef,
|
|
384
|
-
onScroll: onBodyScroll
|
|
385
|
-
}, tableRowListNode, loadMoreLoading && /*#__PURE__*/_react.default.createElement(_Loading.default, null));
|
|
347
|
+
return /*#__PURE__*/_react.default.createElement(_rcResizeObserver.default, {
|
|
348
|
+
onResize: function onResize(_ref2) {
|
|
349
|
+
var clientHeight = _ref2.height;
|
|
350
|
+
setTableBodyContentHeight(clientHeight);
|
|
351
|
+
}
|
|
352
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, tableRowListNode, loadMoreLoading && /*#__PURE__*/_react.default.createElement(_Loading.default, null)));
|
|
386
353
|
};
|
|
387
354
|
|
|
388
355
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
389
|
-
className: (0,
|
|
356
|
+
className: (0, _classnames3.default)("".concat(prefixCls, "-inner-wrap"), _defineProperty({}, "".concat(prefixCls, "-innerScroll"), !!height)),
|
|
357
|
+
ref: tableBodyRef,
|
|
358
|
+
onScroll: onBodyVerticalScroll
|
|
359
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
360
|
+
style: {
|
|
361
|
+
width: columnsTotalWidthRef.current,
|
|
362
|
+
height: tableBodyContentHeight
|
|
363
|
+
}
|
|
390
364
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
391
|
-
ref: tableHeadRef,
|
|
392
365
|
className: "".concat(prefixCls, "-tableHeadScrollWrap")
|
|
393
366
|
}, tableHeadNode), /*#__PURE__*/_react.default.createElement("div", Object.assign({}, getTableBodyProps(), {
|
|
394
|
-
className: (0,
|
|
395
|
-
}),
|
|
367
|
+
className: (0, _classnames3.default)("".concat(prefixCls, "-tbody"))
|
|
368
|
+
}), renderTableBody())));
|
|
396
369
|
};
|
|
397
370
|
|
|
398
371
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -403,14 +376,14 @@ function Table(props, ref) {
|
|
|
403
376
|
height: !height ? 'unset' : height
|
|
404
377
|
}
|
|
405
378
|
}, /*#__PURE__*/_react.default.createElement(_rcResizeObserver.default, {
|
|
406
|
-
onResize: function onResize(
|
|
407
|
-
var clientWidth =
|
|
408
|
-
clientHeight =
|
|
379
|
+
onResize: function onResize(_ref3) {
|
|
380
|
+
var clientWidth = _ref3.width,
|
|
381
|
+
clientHeight = _ref3.height;
|
|
409
382
|
setTableClientWidth(clientWidth);
|
|
410
383
|
setTableClientHeight(clientHeight);
|
|
411
384
|
}
|
|
412
385
|
}, !tableClientWidth ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", null)) : /*#__PURE__*/_react.default.createElement("div", Object.assign({}, getTableProps(), {
|
|
413
|
-
className: (0,
|
|
386
|
+
className: (0, _classnames3.default)("".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))
|
|
414
387
|
}), height ? renderTableWithHeight() : renderTableWithoutHeight())));
|
|
415
388
|
}
|
|
416
389
|
|
|
@@ -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/lib/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/lib/Tabs/index.js
CHANGED
|
@@ -15,8 +15,6 @@ var _tabs = _interopRequireDefault(require("antd/es/tabs"));
|
|
|
15
15
|
|
|
16
16
|
var _react = _interopRequireDefault(require("react"));
|
|
17
17
|
|
|
18
|
-
var _TabPane = _interopRequireDefault(require("./TabPane"));
|
|
19
|
-
|
|
20
18
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
21
19
|
|
|
22
20
|
var _excluded = ["size", "className", "popupClassName", "adaptHeight"];
|
|
@@ -59,6 +57,4 @@ function Tabs(props) {
|
|
|
59
57
|
'ald-tabs-default': size !== 'large'
|
|
60
58
|
})
|
|
61
59
|
}, tabsProps));
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
Tabs.TabPane = _TabPane.default;
|
|
60
|
+
}
|
package/lib/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';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aloudata/aloudata-design",
|
|
3
|
-
"version": "0.4.0-beta.
|
|
3
|
+
"version": "0.4.0-beta.11",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@aloudata/icons-react": "^0.0.12",
|
|
56
56
|
"@ant-design/icons": "^4.7.0",
|
|
57
|
+
"ahooks": "^3.7.2",
|
|
57
58
|
"antd": "^4.23.5",
|
|
58
59
|
"babel-preset-react-app": "^10.0.1",
|
|
59
60
|
"classnames": "^2.3.1",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare type Updater<State> = (prev: State) => State;
|
|
2
|
-
/**
|
|
3
|
-
* Execute code before next frame but async
|
|
4
|
-
*/
|
|
5
|
-
export declare function useLayoutState<State>(defaultState: State): [State, (updater: Updater<State>) => void];
|
|
6
|
-
/** Lock frame, when frame pass reset the lock. */
|
|
7
|
-
export declare function useTimeoutLock<State>(defaultState?: State): [(state: State) => void, () => State];
|