@aloudata/aloudata-design 1.9.8 → 1.9.10
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 +14 -21
- package/dist/AldTable/index.d.ts +2 -2
- package/dist/AldTable/index.js +34 -48
- 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 +4 -11
- 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
|
@@ -1,23 +1,17 @@
|
|
|
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
|
+
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
|
3
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; }
|
|
4
|
-
|
|
5
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; }
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
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); }
|
|
9
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
-
|
|
11
10
|
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
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); }
|
|
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
|
-
|
|
12
|
+
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; }
|
|
13
|
+
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
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
-
|
|
21
15
|
import { FoldDownFill, FoldUpFill } from '@aloudata/icons-react';
|
|
22
16
|
import classnames from 'classnames';
|
|
23
17
|
import _ from 'lodash';
|
|
@@ -26,53 +20,51 @@ import message from "../../../message";
|
|
|
26
20
|
import usePrefixCls from "../../../_utils/hooks/usePrefixCls";
|
|
27
21
|
import { getValidWidthByNumber } from "../../utils";
|
|
28
22
|
var ARRAY_FIRST_INDEX = 0;
|
|
29
|
-
|
|
30
23
|
function TableHead(props) {
|
|
31
24
|
var headerGroups = props.headerGroups,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
var prefixCls = usePrefixCls('', 'ald-table');
|
|
49
|
-
|
|
25
|
+
canResizeColumn = props.canResizeColumn,
|
|
26
|
+
defaultSort = props.defaultSort,
|
|
27
|
+
_props$sortable = props.sortable,
|
|
28
|
+
sortable = _props$sortable === void 0 ? false : _props$sortable,
|
|
29
|
+
_props$columns = props.columns,
|
|
30
|
+
columns = _props$columns === void 0 ? [{
|
|
31
|
+
accessor: '',
|
|
32
|
+
sortOrder: 'descend'
|
|
33
|
+
}] : _props$columns,
|
|
34
|
+
allSortDirections = props.sortDirections,
|
|
35
|
+
setSortBy = props.setSortBy,
|
|
36
|
+
_props$onChange = props.onChange,
|
|
37
|
+
onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
|
|
38
|
+
tableHeadRef = props.tableHeadRef,
|
|
39
|
+
columnsWidthMapRef = props.columnsWidthMapRef,
|
|
40
|
+
columnsTotalWidthRef = props.columnsTotalWidthRef;
|
|
41
|
+
var prefixCls = usePrefixCls('', 'ald-table');
|
|
42
|
+
|
|
43
|
+
// 第一列的情况 默认或者恢复是需要用到
|
|
50
44
|
var defaultSortObject = {
|
|
51
45
|
id: columns[ARRAY_FIRST_INDEX].accessor,
|
|
52
46
|
desc: !!(columns[ARRAY_FIRST_INDEX].sortOrder && columns[ARRAY_FIRST_INDEX].sortOrder === 'descend')
|
|
53
|
-
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// 如果支持排序
|
|
54
50
|
// 1. 有默认排序 则按照默认排序
|
|
55
51
|
// 2. 如果没有默认排序,再判断第一列是否符合排序条件,若满足 => 则按第一列排序
|
|
56
|
-
|
|
57
52
|
var getInitialSortDirection = function getInitialSortDirection() {
|
|
58
53
|
if (defaultSort && defaultSort.id) {
|
|
59
54
|
return defaultSort;
|
|
60
55
|
}
|
|
61
|
-
|
|
62
56
|
if (!defaultSortObject.id) {
|
|
63
57
|
message.error('开启了排序,但是没有给予默认排序列,并且第一列不支持排序');
|
|
64
58
|
}
|
|
65
|
-
|
|
66
59
|
return defaultSortObject;
|
|
67
60
|
};
|
|
68
|
-
|
|
69
61
|
var _useState = useState(getInitialSortDirection()),
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
// 获取排序方向以及排序的id
|
|
74
|
-
|
|
62
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
63
|
+
sortDirection = _useState2[0],
|
|
64
|
+
setSortDirection = _useState2[1];
|
|
75
65
|
|
|
66
|
+
// 排序的方向 倒叙{ id: 'xx', desc: true }、正序{ id: 'xx', desc: false }、无序 { id: '', desc: undefined }
|
|
67
|
+
// 获取排序方向以及排序的id
|
|
76
68
|
var getSortBy = function getSortBy(id) {
|
|
77
69
|
var sortDirections = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['ascend', 'descend'];
|
|
78
70
|
var sortOrder // 如果传了列的默认排序方式,则不可以更改
|
|
@@ -80,74 +72,68 @@ function TableHead(props) {
|
|
|
80
72
|
var res = {
|
|
81
73
|
id: id,
|
|
82
74
|
desc: undefined // 给个默认的排序
|
|
83
|
-
|
|
84
75
|
};
|
|
76
|
+
|
|
85
77
|
var isSameCol = sortDirection.id === id;
|
|
86
78
|
var descMap = new Map([['ascend', false], ['descend', true]]);
|
|
87
|
-
var directions = allSortDirections || sortDirections;
|
|
79
|
+
var directions = allSortDirections || sortDirections;
|
|
88
80
|
|
|
81
|
+
// 如果不是同一列 则返回默认排序 或者排序顺序的第一个
|
|
89
82
|
if (!isSameCol) {
|
|
90
83
|
if (sortOrder === 'ascend' || sortOrder === 'descend') {
|
|
91
84
|
res.desc = descMap.get(sortOrder);
|
|
92
85
|
} else {
|
|
93
86
|
res.desc = sortOrder || descMap.get(directions[ARRAY_FIRST_INDEX]);
|
|
94
87
|
}
|
|
95
|
-
|
|
96
88
|
return res;
|
|
97
|
-
}
|
|
98
|
-
// 如果列给了默认的sortOrder则不在变化
|
|
99
|
-
|
|
89
|
+
}
|
|
100
90
|
|
|
91
|
+
// 如果是同一列
|
|
92
|
+
// 如果列给了默认的sortOrder则不在变化
|
|
101
93
|
if (sortOrder === 'ascend' || sortOrder === 'descend') {
|
|
102
94
|
res.desc = descMap.get(sortOrder);
|
|
103
95
|
return res;
|
|
104
|
-
}
|
|
105
|
-
|
|
96
|
+
}
|
|
106
97
|
|
|
98
|
+
// 在所有方向上 往后取一个
|
|
107
99
|
var lastSortDirection = sortDirection.desc ? 'descend' : 'ascend';
|
|
108
|
-
|
|
109
100
|
var index = _.findIndex(directions, function (item) {
|
|
110
101
|
return item === lastSortDirection;
|
|
111
102
|
});
|
|
112
|
-
|
|
113
103
|
var nextIndex = index + 1;
|
|
114
|
-
res.desc = descMap.get(directions[nextIndex]);
|
|
104
|
+
res.desc = descMap.get(directions[nextIndex]);
|
|
115
105
|
|
|
106
|
+
// 如果没有排序方向,则返回默认排序对象
|
|
116
107
|
if (res.desc === undefined) {
|
|
117
108
|
res.id = '';
|
|
118
109
|
}
|
|
119
|
-
|
|
120
110
|
return res;
|
|
121
111
|
};
|
|
122
|
-
|
|
123
112
|
var getHeaderProps = function getHeaderProps(column) {
|
|
124
113
|
// @ts-ignore
|
|
125
114
|
var id = column.id,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
var toggleProps = column.getSortByToggleProps();
|
|
115
|
+
canSort = column.canSort,
|
|
116
|
+
sorter = column.sorter,
|
|
117
|
+
sortOrder = column.sortOrder,
|
|
118
|
+
sortDirections = column.sortDirections;
|
|
119
|
+
var toggleProps = column.getSortByToggleProps();
|
|
131
120
|
|
|
121
|
+
// 仅在Table设置sortable时,所有列的canSort为true,此时为前端排序
|
|
132
122
|
if (canSort) {
|
|
133
123
|
// client sort
|
|
134
124
|
return _objectSpread(_objectSpread({}, column.getHeaderProps(_objectSpread({}, toggleProps))), {}, {
|
|
135
125
|
onClick: function onClick(e) {
|
|
136
126
|
e.stopPropagation();
|
|
137
|
-
|
|
138
127
|
if (typeof toggleProps.onClick === 'function') {
|
|
139
128
|
var _sortBy = getSortBy(id, sortDirections, sortOrder);
|
|
140
|
-
|
|
141
129
|
setSortBy(_sortBy.desc === undefined ? [defaultSortObject] : [_sortBy]); // 客户端排序时 需要重新设置排序
|
|
142
|
-
|
|
143
130
|
setSortDirection(_sortBy);
|
|
144
131
|
onChange(_sortBy);
|
|
145
132
|
}
|
|
146
133
|
}
|
|
147
134
|
});
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
135
|
+
}
|
|
136
|
+
// 当列设置sorter属性时,则为服务端排序
|
|
151
137
|
if (sorter) {
|
|
152
138
|
// server sort
|
|
153
139
|
return _objectSpread(_objectSpread({}, column.getHeaderProps({
|
|
@@ -163,19 +149,15 @@ function TableHead(props) {
|
|
|
163
149
|
}
|
|
164
150
|
});
|
|
165
151
|
}
|
|
166
|
-
|
|
167
152
|
return column.getHeaderProps();
|
|
168
153
|
};
|
|
169
|
-
|
|
170
154
|
var SortIcons = function SortIcons(_ref) {
|
|
171
155
|
var id = _ref.id;
|
|
172
156
|
var currentSortId = sortDirection.id,
|
|
173
|
-
|
|
174
|
-
|
|
157
|
+
desc = sortDirection.desc;
|
|
175
158
|
if (id !== currentSortId || !sortable) {
|
|
176
159
|
return null;
|
|
177
160
|
}
|
|
178
|
-
|
|
179
161
|
return desc ? /*#__PURE__*/React.createElement(FoldDownFill, {
|
|
180
162
|
className: "".concat(prefixCls, "-sortIcon"),
|
|
181
163
|
fill: "currentColor",
|
|
@@ -185,12 +167,11 @@ function TableHead(props) {
|
|
|
185
167
|
fill: "currentColor",
|
|
186
168
|
size: 12
|
|
187
169
|
});
|
|
188
|
-
};
|
|
189
|
-
|
|
170
|
+
};
|
|
190
171
|
|
|
172
|
+
// 在页面拖拽完成之后 更新表格整体宽度以及每个列对应的列宽map
|
|
191
173
|
var adjustColumnsMapAfterDrag = function adjustColumnsMapAfterDrag(key, width) {
|
|
192
174
|
var _$cloneDeep, _columnsWidthMapRef$c, _columnsWidthMapRef$c2, _columnsWidthMapRef$c3;
|
|
193
|
-
|
|
194
175
|
var newMap = (_$cloneDeep = _.cloneDeep(columnsWidthMapRef.current)) !== null && _$cloneDeep !== void 0 ? _$cloneDeep : new Map();
|
|
195
176
|
var originWidth = (_columnsWidthMapRef$c = (_columnsWidthMapRef$c2 = columnsWidthMapRef.current) === null || _columnsWidthMapRef$c2 === void 0 ? void 0 : (_columnsWidthMapRef$c3 = _columnsWidthMapRef$c2.get(key)) === null || _columnsWidthMapRef$c3 === void 0 ? void 0 : _columnsWidthMapRef$c3.width) !== null && _columnsWidthMapRef$c !== void 0 ? _columnsWidthMapRef$c : 0;
|
|
196
177
|
var newWidth = getValidWidthByNumber(width);
|
|
@@ -201,24 +182,19 @@ function TableHead(props) {
|
|
|
201
182
|
columnsWidthMapRef.current = newMap;
|
|
202
183
|
columnsTotalWidthRef.current = columnsTotalWidthRef.current - originWidth + newWidth;
|
|
203
184
|
};
|
|
204
|
-
|
|
205
185
|
var handleStyleAndReturn = function handleStyleAndReturn(column, index) {
|
|
206
186
|
var _columnsWidthMapRef$c4, _columnsWidthMapRef$c5, _getHeaderProps$style, _getHeaderProps$style2;
|
|
207
|
-
|
|
208
187
|
var key = index.toString();
|
|
209
188
|
var lastColumnsMapWidth = (_columnsWidthMapRef$c4 = columnsWidthMapRef.current) === null || _columnsWidthMapRef$c4 === void 0 ? void 0 : (_columnsWidthMapRef$c5 = _columnsWidthMapRef$c4.get(key)) === null || _columnsWidthMapRef$c5 === void 0 ? void 0 : _columnsWidthMapRef$c5.width; // Optional chaining to handle undefined
|
|
210
|
-
|
|
211
189
|
var currentRenderWidth = Number((_getHeaderProps$style = getHeaderProps(column).style) === null || _getHeaderProps$style === void 0 ? void 0 : (_getHeaderProps$style2 = _getHeaderProps$style.width) === null || _getHeaderProps$style2 === void 0 ? void 0 : _getHeaderProps$style2.toString().replace('px', '')); // Table's internal calculated width in 'px'
|
|
212
190
|
|
|
213
191
|
if (lastColumnsMapWidth !== undefined && currentRenderWidth !== lastColumnsMapWidth) {
|
|
214
192
|
adjustColumnsMapAfterDrag(key, currentRenderWidth);
|
|
215
193
|
}
|
|
216
|
-
|
|
217
194
|
return _objectSpread(_objectSpread({}, getHeaderProps(column).style), {}, {
|
|
218
195
|
width: getValidWidthByNumber(currentRenderWidth)
|
|
219
196
|
});
|
|
220
197
|
};
|
|
221
|
-
|
|
222
198
|
return /*#__PURE__*/React.createElement("div", {
|
|
223
199
|
className: "".concat(prefixCls, "-thead"),
|
|
224
200
|
ref: tableHeadRef,
|
|
@@ -227,8 +203,7 @@ function TableHead(props) {
|
|
|
227
203
|
}
|
|
228
204
|
}, headerGroups.map(function (headerGroup) {
|
|
229
205
|
var _headerGroup$getHeade = headerGroup.getHeaderGroupProps(),
|
|
230
|
-
|
|
231
|
-
|
|
206
|
+
headerGroupProps = Object.assign({}, (_objectDestructuringEmpty(_headerGroup$getHeade), _headerGroup$getHeade));
|
|
232
207
|
return /*#__PURE__*/React.createElement("div", _extends({}, headerGroupProps, {
|
|
233
208
|
key: headerGroupProps.key,
|
|
234
209
|
className: "".concat(prefixCls, "-row")
|
|
@@ -253,5 +228,4 @@ function TableHead(props) {
|
|
|
253
228
|
}));
|
|
254
229
|
}));
|
|
255
230
|
}
|
|
256
|
-
|
|
257
231
|
export default TableHead;
|
|
@@ -1,35 +1,25 @@
|
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
2
|
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."); }
|
|
4
|
-
|
|
5
3
|
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); }
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
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; }
|
|
10
|
-
|
|
4
|
+
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; }
|
|
5
|
+
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; } }
|
|
11
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
7
|
// @ts-nocheck
|
|
14
8
|
import { useRef, useState, useEffect } from 'react';
|
|
15
|
-
|
|
16
9
|
/**
|
|
17
10
|
* Execute code before next frame but async
|
|
18
11
|
*/
|
|
19
12
|
export function useLayoutState(defaultState) {
|
|
20
13
|
var stateRef = useRef(defaultState);
|
|
21
|
-
|
|
22
14
|
var _useState = useState({}),
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
+
forceUpdate = _useState2[1];
|
|
26
17
|
var lastPromiseRef = useRef(null);
|
|
27
18
|
var updateBatchRef = useRef([]);
|
|
28
|
-
|
|
29
19
|
function setFrameState(updater) {
|
|
30
20
|
updateBatchRef.current.push(updater);
|
|
31
|
-
var promise = Promise.resolve();
|
|
32
|
-
|
|
21
|
+
var promise = Promise.resolve();
|
|
22
|
+
// @ts-ignore;
|
|
33
23
|
lastPromiseRef.current = promise;
|
|
34
24
|
promise.then(function () {
|
|
35
25
|
if (lastPromiseRef.current === promise) {
|
|
@@ -38,17 +28,16 @@ export function useLayoutState(defaultState) {
|
|
|
38
28
|
updateBatchRef.current = [];
|
|
39
29
|
prevBatch.forEach(function (batchUpdater) {
|
|
40
30
|
stateRef.current = batchUpdater(stateRef.current);
|
|
41
|
-
});
|
|
31
|
+
});
|
|
42
32
|
|
|
33
|
+
// @ts-ignore;
|
|
43
34
|
lastPromiseRef.current = null;
|
|
44
|
-
|
|
45
35
|
if (prevState !== stateRef.current) {
|
|
46
36
|
forceUpdate({});
|
|
47
37
|
}
|
|
48
38
|
}
|
|
49
39
|
});
|
|
50
40
|
}
|
|
51
|
-
|
|
52
41
|
useEffect(function () {
|
|
53
42
|
return function () {
|
|
54
43
|
// @ts-ignore;
|
|
@@ -57,17 +46,15 @@ export function useLayoutState(defaultState) {
|
|
|
57
46
|
}, []);
|
|
58
47
|
return [stateRef.current, setFrameState];
|
|
59
48
|
}
|
|
60
|
-
/** Lock frame, when frame pass reset the lock. */
|
|
61
49
|
|
|
50
|
+
/** Lock frame, when frame pass reset the lock. */
|
|
62
51
|
export function useTimeoutLock(defaultState) {
|
|
63
52
|
var frameRef = useRef(defaultState || null);
|
|
64
53
|
var timeoutRef = useRef();
|
|
65
54
|
var TIMEOUT_DELAY = 50;
|
|
66
|
-
|
|
67
55
|
function cleanUp() {
|
|
68
56
|
window.clearTimeout(timeoutRef.current);
|
|
69
57
|
}
|
|
70
|
-
|
|
71
58
|
function setState(newState) {
|
|
72
59
|
// @ts-ignore;
|
|
73
60
|
frameRef.current = newState;
|
|
@@ -78,11 +65,9 @@ export function useTimeoutLock(defaultState) {
|
|
|
78
65
|
timeoutRef.current = undefined;
|
|
79
66
|
}, TIMEOUT_DELAY);
|
|
80
67
|
}
|
|
81
|
-
|
|
82
68
|
function getState() {
|
|
83
69
|
return frameRef.current;
|
|
84
70
|
}
|
|
85
|
-
|
|
86
71
|
useEffect(function () {
|
|
87
72
|
return cleanUp;
|
|
88
73
|
}, []);
|
package/dist/Table/utils.js
CHANGED
|
@@ -8,11 +8,9 @@ export function isPercentageWidth(width) {
|
|
|
8
8
|
export function isSpecificPxWidth(width) {
|
|
9
9
|
return /[0-9]{1,}(px)$/.test(width);
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
function isSpecificWidth(width) {
|
|
13
12
|
return typeof width === 'number' || !!(width && isSpecificPxWidth(width));
|
|
14
13
|
}
|
|
15
|
-
|
|
16
14
|
export function getValidWidthByNumber(width) {
|
|
17
15
|
return width < COLUMN_MIN_WIDTH ? COLUMN_MIN_WIDTH : width;
|
|
18
16
|
}
|
|
@@ -25,7 +23,6 @@ export function getPxValue(px) {
|
|
|
25
23
|
}
|
|
26
24
|
export function getValidScrollThreshold(height, clientHeight) {
|
|
27
25
|
var scrollThreshold = ZERO;
|
|
28
|
-
|
|
29
26
|
if (typeof height === 'string') {
|
|
30
27
|
if (isPercentageWidth(height)) {
|
|
31
28
|
scrollThreshold = getPercentageValue(height, clientHeight);
|
|
@@ -35,32 +32,25 @@ export function getValidScrollThreshold(height, clientHeight) {
|
|
|
35
32
|
} else {
|
|
36
33
|
scrollThreshold = height;
|
|
37
34
|
}
|
|
38
|
-
|
|
39
35
|
return scrollThreshold;
|
|
40
36
|
}
|
|
41
|
-
|
|
42
37
|
function getWidthByColumnsWidth(clientWidth, width, widthFlex) {
|
|
43
38
|
if (width === undefined || widthFlex) {
|
|
44
39
|
return NOT_SET;
|
|
45
40
|
}
|
|
46
|
-
|
|
47
41
|
if (typeof width === 'number') {
|
|
48
42
|
return getValidWidthByNumber(width);
|
|
49
43
|
}
|
|
50
|
-
|
|
51
44
|
if (isPercentageWidth(width)) {
|
|
52
45
|
return getPercentageValue(width, clientWidth);
|
|
53
46
|
}
|
|
54
|
-
|
|
55
47
|
if (isSpecificPxWidth(width)) {
|
|
56
48
|
var specificNum = getPxValue(width);
|
|
57
49
|
return getValidWidthByNumber(specificNum);
|
|
58
50
|
}
|
|
59
|
-
|
|
60
51
|
return NOT_SET;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
}
|
|
53
|
+
// TODO: 添加单侧
|
|
64
54
|
export function getColumnsWidthMap(columns, clientWidth, lastWidthMap // 容器宽度变化之后才会传入一个最新的map
|
|
65
55
|
) {
|
|
66
56
|
var settedTotalWidth = ZERO;
|
|
@@ -70,67 +60,57 @@ export function getColumnsWidthMap(columns, clientWidth, lastWidthMap // 容器
|
|
|
70
60
|
columns.forEach(function (item, index) {
|
|
71
61
|
var key = index.toString();
|
|
72
62
|
var widthFlex = item.widthFlex;
|
|
73
|
-
var width = getWidthByColumnsWidth(clientWidth, item.width, widthFlex);
|
|
74
|
-
|
|
63
|
+
var width = getWidthByColumnsWidth(clientWidth, item.width, widthFlex);
|
|
64
|
+
// 首先判断是否是否是容器宽度的变化
|
|
75
65
|
var isSpecific;
|
|
76
|
-
|
|
77
66
|
if (widthFlex) {
|
|
78
67
|
isSpecific = false;
|
|
79
68
|
} else {
|
|
80
69
|
var _lastWidthMap$get;
|
|
81
|
-
|
|
82
70
|
isSpecific = lastWidthMap ? (_lastWidthMap$get = lastWidthMap.get(key)) === null || _lastWidthMap$get === void 0 ? void 0 : _lastWidthMap$get.isSpecific : isSpecificWidth(item.width);
|
|
83
71
|
}
|
|
84
|
-
|
|
85
72
|
if (lastWidthMap && isSpecific) {
|
|
86
73
|
var _lastWidthMap$get$wid, _lastWidthMap$get2;
|
|
87
|
-
|
|
88
74
|
width = (_lastWidthMap$get$wid = (_lastWidthMap$get2 = lastWidthMap.get(key)) === null || _lastWidthMap$get2 === void 0 ? void 0 : _lastWidthMap$get2.width) !== null && _lastWidthMap$get$wid !== void 0 ? _lastWidthMap$get$wid : width;
|
|
89
75
|
}
|
|
90
|
-
|
|
91
76
|
if (width === NOT_SET) {
|
|
92
77
|
unsetWidthIndex.push(key);
|
|
93
78
|
} else {
|
|
94
79
|
settedTotalWidth += width;
|
|
95
80
|
}
|
|
96
|
-
|
|
97
81
|
widthMap.set(key, {
|
|
98
82
|
width: width,
|
|
99
83
|
isSpecific: Boolean(isSpecific)
|
|
100
84
|
});
|
|
101
|
-
});
|
|
85
|
+
});
|
|
102
86
|
|
|
87
|
+
// 设定宽度大于容器宽度时
|
|
103
88
|
if (settedTotalWidth < clientWidth) {
|
|
104
89
|
unsetWidthIndex.map(function (item) {
|
|
105
90
|
var _widthMap$get$isSpeci, _widthMap$get;
|
|
106
|
-
|
|
107
91
|
return widthMap.set(item, {
|
|
108
92
|
isSpecific: (_widthMap$get$isSpeci = (_widthMap$get = widthMap.get(item)) === null || _widthMap$get === void 0 ? void 0 : _widthMap$get.isSpecific) !== null && _widthMap$get$isSpeci !== void 0 ? _widthMap$get$isSpeci : false,
|
|
109
93
|
width: COLUMN_MIN_WIDTH
|
|
110
94
|
});
|
|
111
95
|
});
|
|
112
|
-
}
|
|
113
|
-
|
|
96
|
+
}
|
|
114
97
|
|
|
98
|
+
// 设定宽度小于容器宽度时
|
|
115
99
|
if (unsetWidthIndex.length > ZERO) {
|
|
116
100
|
var leftWidth = clientWidth - settedTotalWidth;
|
|
117
101
|
var average = getValidWidthByNumber(leftWidth / unsetWidthIndex.length);
|
|
118
102
|
unsetWidthIndex.map(function (item) {
|
|
119
103
|
var _widthMap$get$isSpeci2, _widthMap$get2;
|
|
120
|
-
|
|
121
104
|
return widthMap.set(item, {
|
|
122
105
|
isSpecific: (_widthMap$get$isSpeci2 = (_widthMap$get2 = widthMap.get(item)) === null || _widthMap$get2 === void 0 ? void 0 : _widthMap$get2.isSpecific) !== null && _widthMap$get$isSpeci2 !== void 0 ? _widthMap$get$isSpeci2 : false,
|
|
123
106
|
width: average
|
|
124
107
|
});
|
|
125
108
|
});
|
|
126
109
|
}
|
|
127
|
-
|
|
128
110
|
columns.forEach(function (item, index) {
|
|
129
111
|
var _widthMap$get3;
|
|
130
|
-
|
|
131
112
|
var key = index.toString();
|
|
132
113
|
var width = (_widthMap$get3 = widthMap.get(key)) === null || _widthMap$get3 === void 0 ? void 0 : _widthMap$get3.width;
|
|
133
|
-
|
|
134
114
|
if (width !== undefined) {
|
|
135
115
|
totalColumnWidth += width;
|
|
136
116
|
}
|
package/dist/Tabs/TabPane.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
export interface ITabPaneProps {
|
|
3
3
|
/**
|
|
4
4
|
* @description 被隐藏时是否渲染 DOM 结构
|
|
@@ -18,4 +18,4 @@ export interface ITabPaneProps {
|
|
|
18
18
|
className?: string;
|
|
19
19
|
children?: ReactNode;
|
|
20
20
|
}
|
|
21
|
-
export default function TabPane(props: ITabPaneProps): JSX.Element;
|
|
21
|
+
export default function TabPane(props: ITabPaneProps): React.JSX.Element;
|
package/dist/Tabs/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TabsProps } from 'antd';
|
|
3
|
-
export
|
|
3
|
+
export type TabsSize = 'default' | 'large';
|
|
4
4
|
export interface ITabsProps extends Omit<TabsProps, 'size'> {
|
|
5
5
|
/**
|
|
6
6
|
* @description 大小
|
|
@@ -60,7 +60,7 @@ export interface ITabsProps extends Omit<TabsProps, 'size'> {
|
|
|
60
60
|
*/
|
|
61
61
|
compact?: boolean;
|
|
62
62
|
}
|
|
63
|
-
declare function Tabs(props: ITabsProps): JSX.Element;
|
|
63
|
+
declare function Tabs(props: ITabsProps): React.JSX.Element;
|
|
64
64
|
declare namespace Tabs {
|
|
65
65
|
var TabPane: typeof import("./TabPane").default;
|
|
66
66
|
}
|
package/dist/Tabs/index.js
CHANGED
|
@@ -1,70 +1,55 @@
|
|
|
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 = ["size", "className", "popupClassName", "adaptHeight", "style", "monospace", "tabPosition", "padding", "compact"];
|
|
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
|
-
|
|
16
|
-
|
|
11
|
+
import React, { useMemo } from 'react';
|
|
12
|
+
// import AntdTabs, { TabsProps } from 'antd/lib/tabs';
|
|
17
13
|
import { MoreVerticalLine } from '@aloudata/icons-react';
|
|
18
14
|
import { Tabs as AntdTabs } from 'antd';
|
|
19
15
|
import classNames from 'classnames';
|
|
20
16
|
import TabPane from "./TabPane";
|
|
21
17
|
export default function Tabs(props) {
|
|
22
18
|
var size = props.size,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
19
|
+
className = props.className,
|
|
20
|
+
popupClassName = props.popupClassName,
|
|
21
|
+
adaptHeight = props.adaptHeight,
|
|
22
|
+
_props$style = props.style,
|
|
23
|
+
style = _props$style === void 0 ? {} : _props$style,
|
|
24
|
+
monospace = props.monospace,
|
|
25
|
+
_props$tabPosition = props.tabPosition,
|
|
26
|
+
tabPosition = _props$tabPosition === void 0 ? 'top' : _props$tabPosition,
|
|
27
|
+
_props$padding = props.padding,
|
|
28
|
+
padding = _props$padding === void 0 ? false : _props$padding,
|
|
29
|
+
compact = props.compact,
|
|
30
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
|
36
31
|
var headerBackgroundColor = props.headerBackgroundColor;
|
|
37
|
-
|
|
38
32
|
var tabsProps = _objectSpread({}, otherProps);
|
|
39
|
-
|
|
40
33
|
if (size === 'large') {
|
|
41
34
|
tabsProps.size = size;
|
|
42
35
|
}
|
|
43
|
-
|
|
44
36
|
var _monospace = tabPosition !== 'top' ? false : monospace;
|
|
45
|
-
|
|
46
37
|
var _padding = useMemo(function () {
|
|
47
38
|
if (tabPosition !== 'top') return 0;
|
|
48
|
-
|
|
49
39
|
if (typeof padding === 'number') {
|
|
50
40
|
return padding;
|
|
51
41
|
}
|
|
52
|
-
|
|
53
42
|
if (typeof padding === 'boolean' && padding) {
|
|
54
43
|
return 16;
|
|
55
44
|
}
|
|
56
|
-
|
|
57
45
|
return 0;
|
|
58
46
|
}, [padding, tabPosition]);
|
|
59
|
-
|
|
60
47
|
var getTabBarGutter = function getTabBarGutter() {
|
|
61
48
|
if (tabPosition === 'top' && !_monospace) {
|
|
62
49
|
return 24;
|
|
63
50
|
}
|
|
64
|
-
|
|
65
51
|
return 0;
|
|
66
52
|
};
|
|
67
|
-
|
|
68
53
|
return /*#__PURE__*/React.createElement(AntdTabs, _extends({
|
|
69
54
|
moreIcon: /*#__PURE__*/React.createElement("div", {
|
|
70
55
|
className: "ald-tabs-more-icon"
|
package/dist/Tooltip/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export
|
|
2
|
+
export type ActionType = 'hover' | 'focus' | 'click' | 'contextMenu';
|
|
3
3
|
export interface ITooltipProps {
|
|
4
4
|
/**
|
|
5
5
|
* @description 提示文字
|
|
@@ -60,4 +60,4 @@ export interface ITooltipProps {
|
|
|
60
60
|
getTooltipContainer?: (node: HTMLElement) => HTMLElement;
|
|
61
61
|
children?: React.ReactNode;
|
|
62
62
|
}
|
|
63
|
-
export default function Tooltip(props: ITooltipProps): JSX.Element;
|
|
63
|
+
export default function Tooltip(props: ITooltipProps): React.JSX.Element;
|