@aloudata/aloudata-design 1.9.7 → 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 +38 -49
- package/dist/AldTable/style/index.less +4 -0
- package/dist/AldTable/types.d.ts +2 -1
- package/dist/App/index.js +2 -9
- package/dist/Avatar/component/Avatar/avatar.d.ts +2 -2
- package/dist/Avatar/component/Avatar/avatar.js +0 -2
- package/dist/Avatar/component/Avatar/index.d.ts +1 -1
- package/dist/Avatar/component/Avatar/index.js +6 -20
- package/dist/Breadcrumb/index.d.ts +1 -1
- package/dist/Breadcrumb/index.js +6 -16
- package/dist/Button/index.d.ts +4 -4
- package/dist/Button/index.js +21 -41
- package/dist/Checkbox/component/CheckboxGroup/index.d.ts +2 -2
- package/dist/Checkbox/component/CheckboxGroup/index.js +4 -10
- package/dist/Checkbox/index.d.ts +3 -3
- package/dist/Checkbox/index.js +5 -14
- package/dist/Checkbox/type.js +3 -4
- package/dist/ColorPicker/constant.js +2 -1
- package/dist/ColorPicker/index.d.ts +1 -1
- package/dist/ColorPicker/index.js +15 -42
- package/dist/ConfigProvider/defaultRenderEmpty.d.ts +1 -1
- package/dist/ConfigProvider/defaultRenderEmpty.js +0 -5
- package/dist/ConfigProvider/getUserList.d.ts +4 -4
- package/dist/ConfigProvider/getUserList.js +2 -2
- package/dist/ConfigProvider/hooks/useGetUserList.js +2 -5
- package/dist/ConfigProvider/index.js +2 -6
- package/dist/ConfigProvider/sizeContext.d.ts +1 -1
- package/dist/ConfigProvider/sizeContext.js +1 -1
- package/dist/DataPreviewTable/components/Body/Cell.d.ts +1 -1
- package/dist/DataPreviewTable/components/Body/Cell.js +4 -10
- package/dist/DataPreviewTable/components/Body/Error.d.ts +1 -1
- package/dist/DataPreviewTable/components/Body/Error.js +3 -5
- package/dist/DataPreviewTable/components/Body/SkeletonBody.d.ts +1 -1
- package/dist/DataPreviewTable/components/Body/SkeletonBody.js +10 -19
- package/dist/DataPreviewTable/components/Body/index.d.ts +1 -1
- package/dist/DataPreviewTable/components/Body/index.js +10 -19
- package/dist/DataPreviewTable/components/DragBar/index.d.ts +1 -1
- package/dist/DataPreviewTable/components/DragBar/index.js +14 -24
- package/dist/DataPreviewTable/components/Header/index.d.ts +2 -2
- package/dist/DataPreviewTable/components/Header/index.js +7 -15
- package/dist/DataPreviewTable/hooks/useDirection.js +32 -57
- package/dist/DataPreviewTable/index.js +22 -29
- package/dist/DataPreviewTable/interface.d.ts +2 -2
- package/dist/DataPreviewTable/interface.js +6 -9
- package/dist/DataPreviewTable/utils/findRange.js +2 -20
- package/dist/DataPreviewTable/utils/getColumnRange.js +3 -7
- package/dist/DataPreviewTable/utils/getRowRange.js +2 -8
- package/dist/DataPreviewTable/utils/getTableLayout.js +0 -1
- package/dist/DatePicker/index.d.ts +11 -11
- package/dist/DatePicker/index.js +85 -116
- package/dist/Divider/index.d.ts +1 -1
- package/dist/Divider/index.js +0 -3
- package/dist/DoubleCircleIcon/index.d.ts +2 -2
- package/dist/DoubleCircleIcon/index.js +7 -9
- package/dist/Dropdown/Button.d.ts +2 -2
- package/dist/Dropdown/Button.js +7 -11
- package/dist/Dropdown/index.d.ts +4 -4
- package/dist/Dropdown/index.js +11 -21
- package/dist/Dropdown/style/index.less +5 -0
- package/dist/Empty/image/Data.d.ts +2 -2
- package/dist/Empty/image/Data.js +0 -2
- package/dist/Empty/image/Search.d.ts +2 -2
- package/dist/Empty/image/Search.js +0 -2
- package/dist/Empty/image/SearchSmall.d.ts +2 -2
- package/dist/Empty/image/SearchSmall.js +0 -2
- package/dist/Empty/image/User.d.ts +2 -2
- package/dist/Empty/image/User.js +0 -2
- package/dist/Empty/image/WorkBook.d.ts +2 -2
- package/dist/Empty/image/WorkBook.js +0 -2
- package/dist/Empty/index.d.ts +1 -1
- package/dist/Empty/index.js +13 -23
- package/dist/Form/index.d.ts +4 -4
- package/dist/Form/index.js +16 -27
- package/dist/Icon/components/AlertTriangleDuotone.d.ts +1 -1
- package/dist/Icon/components/AlertTriangleDuotone.js +4 -11
- package/dist/Icon/components/CancelCircleDuotone.d.ts +1 -1
- package/dist/Icon/components/CancelCircleDuotone.js +9 -16
- package/dist/Icon/components/CheckCircleDuotone.d.ts +1 -1
- package/dist/Icon/components/CheckCircleDuotone.js +4 -11
- package/dist/Icon/components/Icon.d.ts +1 -1
- package/dist/Icon/components/Icon.js +9 -13
- package/dist/Icon/components/InfoCircleLine.d.ts +1 -1
- package/dist/Icon/components/InfoCircleLine.js +4 -11
- package/dist/Icon/components/createFromScripts.js +2 -8
- package/dist/IconButton/index.js +36 -57
- package/dist/IconButton/style/index.less +4 -0
- package/dist/Input/components/Group/index.d.ts +2 -2
- package/dist/Input/components/Group/index.js +4 -9
- package/dist/Input/components/Input/index.d.ts +2 -2
- package/dist/Input/components/Input/index.js +9 -17
- package/dist/Input/components/Password/index.js +4 -9
- package/dist/Input/components/TextArea/index.js +5 -10
- package/dist/InputNumber/index.d.ts +2 -2
- package/dist/InputNumber/index.js +13 -20
- package/dist/MemberPicker/components/MemberSelection.d.ts +2 -2
- package/dist/MemberPicker/components/MemberSelection.js +12 -20
- package/dist/MemberPicker/components/MultipleOption.d.ts +2 -2
- package/dist/MemberPicker/components/MultipleOption.js +8 -9
- package/dist/MemberPicker/components/NickLabel.js +2 -4
- package/dist/MemberPicker/components/Panel.d.ts +2 -2
- package/dist/MemberPicker/components/Panel.js +14 -25
- package/dist/MemberPicker/components/SelectedMemberTags.d.ts +2 -2
- package/dist/MemberPicker/components/SelectedMemberTags.js +2 -4
- package/dist/MemberPicker/components/SelectorFooter.d.ts +2 -2
- package/dist/MemberPicker/components/SingleOption.d.ts +2 -2
- package/dist/MemberPicker/components/SingleOption.js +9 -10
- package/dist/MemberPicker/index.js +46 -79
- package/dist/MemberPicker/interface.d.ts +2 -2
- package/dist/MemberPicker/utils/getUsersWithUserId.js +0 -1
- package/dist/Menu/Divider.d.ts +3 -3
- package/dist/Menu/MenuItem.d.ts +1 -1
- package/dist/Menu/SubMenu.d.ts +1 -1
- package/dist/Menu/SubMenu.js +1 -6
- package/dist/Menu/index.d.ts +2 -2
- package/dist/Menu/index.js +7 -16
- package/dist/Menu/style/dropdown.less +4 -2
- package/dist/Modal/index.d.ts +4 -4
- package/dist/Modal/index.js +108 -130
- package/dist/Modal/locale.js +4 -6
- package/dist/Navigator/components/Header/index.d.ts +2 -2
- package/dist/Navigator/components/Header/index.js +0 -2
- package/dist/Navigator/components/Menu/index.d.ts +2 -2
- package/dist/Navigator/components/Menu/index.js +8 -19
- package/dist/Navigator/components/MenuItem/index.d.ts +1 -1
- package/dist/Navigator/components/MenuItem/index.js +6 -9
- package/dist/Navigator/index.d.ts +1 -1
- package/dist/Navigator/index.js +5 -7
- package/dist/Pagination/index.d.ts +3 -3
- package/dist/Pagination/index.js +18 -43
- package/dist/Popconfirm/index.d.ts +2 -2
- package/dist/Popconfirm/index.js +19 -27
- package/dist/Popover/index.d.ts +2 -2
- package/dist/Popover/index.js +2 -9
- package/dist/Progress/index.js +21 -33
- package/dist/Radio/components/Group/index.d.ts +1 -1
- package/dist/Radio/components/Group/index.js +27 -36
- package/dist/Radio/components/Radio/index.d.ts +2 -2
- package/dist/Radio/components/Radio/index.js +10 -18
- package/dist/Radio/interface/radioGroup.d.ts +3 -3
- package/dist/Result/index.d.ts +7 -7
- package/dist/Result/index.js +17 -26
- package/dist/Result/noFound.js +0 -3
- package/dist/Result/serverError.js +0 -3
- package/dist/Result/unauthorized.js +1 -4
- package/dist/ScrollArea/index.js +6 -13
- package/dist/Select/components/MultipleOption.d.ts +2 -2
- package/dist/Select/components/MultipleOption.js +4 -8
- package/dist/Select/components/SingleOption.d.ts +2 -2
- package/dist/Select/components/SingleOption.js +5 -9
- package/dist/Select/index.d.ts +2 -2
- package/dist/Select/index.js +66 -134
- package/dist/Spin/CustomIcon/index.d.ts +2 -2
- package/dist/Spin/CustomIcon/index.js +0 -2
- package/dist/Spin/Icon/index.d.ts +2 -2
- package/dist/Spin/index.d.ts +2 -2
- package/dist/Spin/index.js +1 -10
- package/dist/Steps/components/ProcessIcon/index.d.ts +2 -2
- package/dist/Steps/components/ProcessIcon/index.js +0 -2
- package/dist/Steps/components/Step/index.d.ts +3 -3
- package/dist/Steps/components/Step/index.js +2 -8
- package/dist/Steps/index.d.ts +3 -3
- package/dist/Steps/index.js +8 -10
- package/dist/Switch/index.js +17 -30
- package/dist/Table/Table.js +88 -131
- package/dist/Table/components/Empty/index.d.ts +2 -2
- package/dist/Table/components/Empty/index.js +0 -2
- package/dist/Table/components/Loading/index.d.ts +2 -2
- package/dist/Table/components/Loading/index.js +0 -2
- package/dist/Table/components/TableBodyRowList/index.d.ts +2 -2
- package/dist/Table/components/TableBodyRowList/index.js +19 -39
- package/dist/Table/components/TableHead/index.d.ts +1 -1
- package/dist/Table/components/TableHead/index.js +56 -82
- package/dist/Table/hooks/useFrame.d.ts +1 -1
- package/dist/Table/hooks/useFrame.js +9 -24
- package/dist/Table/interface.d.ts +1 -1
- package/dist/Table/utils.js +8 -28
- package/dist/Tabs/TabPane.d.ts +2 -2
- package/dist/Tabs/index.d.ts +2 -2
- package/dist/Tabs/index.js +18 -33
- package/dist/Tooltip/index.d.ts +2 -2
- package/dist/Tooltip/index.js +12 -12
- package/dist/Tree/demo/basic/index.d.ts +2 -2
- package/dist/Tree/index.d.ts +1 -1
- package/dist/Tree/index.js +2 -4
- package/dist/_utils/hooks/useControlledState.js +9 -21
- package/dist/_utils/hooks/useId.js +4 -5
- package/dist/_utils/hooks/usePrefixCls.js +2 -5
- package/dist/index.js +3 -1
- package/dist/locale-provider/context.d.ts +1 -1
- package/dist/locale-provider/index.d.ts +1 -1
- package/dist/locale-provider/index.js +8 -33
- package/dist/message/index.js +3 -7
- package/dist/notification/demo/index.d.ts +2 -2
- package/dist/notification/demo/index.js +0 -1
- package/dist/notification/index.js +23 -32
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IMenuItem } from './components/Menu';
|
|
3
|
-
declare function Navigator(props: INavigatorProps): JSX.Element;
|
|
3
|
+
declare function Navigator(props: INavigatorProps): React.JSX.Element;
|
|
4
4
|
export interface INavigatorProps {
|
|
5
5
|
/**
|
|
6
6
|
* @description 应用logo
|
package/dist/Navigator/index.js
CHANGED
|
@@ -2,14 +2,13 @@ import React, { useCallback } from 'react';
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import Menu from "./components/Menu";
|
|
4
4
|
import Header from "./components/Header";
|
|
5
|
-
|
|
6
5
|
function Navigator(props) {
|
|
7
6
|
var logoSrc = props.logoSrc,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
menuList = props.menuList,
|
|
8
|
+
selectedKey = props.selectedKey,
|
|
9
|
+
_props$footer = props.footer,
|
|
10
|
+
footer = _props$footer === void 0 ? null : _props$footer,
|
|
11
|
+
onMenuSelect = props.onMenuSelect;
|
|
13
12
|
var renderMenu = useCallback(function () {
|
|
14
13
|
return /*#__PURE__*/React.createElement(Menu, {
|
|
15
14
|
menuList: menuList,
|
|
@@ -31,5 +30,4 @@ function Navigator(props) {
|
|
|
31
30
|
className: "ald-nav-footer-wrap"
|
|
32
31
|
}, footer)));
|
|
33
32
|
}
|
|
34
|
-
|
|
35
33
|
export default Navigator;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { IPaginationProps } from './types';
|
|
3
|
-
declare function Pagination(props: IPaginationProps): JSX.Element;
|
|
3
|
+
declare function Pagination(props: IPaginationProps): React.JSX.Element;
|
|
4
4
|
export default Pagination;
|
|
5
5
|
/**
|
|
6
6
|
* 获取在安全范围内的当前页数
|
|
7
7
|
*/
|
|
8
8
|
export declare function getSafeCurrent(totalPage: number, current?: number): number;
|
|
9
9
|
export declare const ELLIPSIS = "...";
|
|
10
|
-
export
|
|
10
|
+
export type PaginationItemType = number | typeof ELLIPSIS;
|
|
11
11
|
/**
|
|
12
12
|
* 获取分页组件需要显示的页码范围。
|
|
13
13
|
*
|
package/dist/Pagination/index.js
CHANGED
|
@@ -1,51 +1,41 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
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); }
|
|
2
|
+
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; }
|
|
3
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
|
+
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); }
|
|
3
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
-
|
|
5
6
|
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."); }
|
|
6
|
-
|
|
7
7
|
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); }
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
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; }
|
|
12
|
-
|
|
8
|
+
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; }
|
|
9
|
+
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; } }
|
|
13
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
-
|
|
15
11
|
import { ChevronLeftLine, ChevronRightLine } from '@aloudata/icons-react';
|
|
16
12
|
import classnames from 'classnames';
|
|
17
13
|
import _ from 'lodash';
|
|
18
14
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
19
15
|
import Button from "../Button";
|
|
20
|
-
|
|
21
16
|
function Pagination(props) {
|
|
22
17
|
var _props$current = props.current,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
currPage = _props$current === void 0 ? 1 : _props$current,
|
|
19
|
+
pageSize = props.pageSize,
|
|
20
|
+
total = props.total,
|
|
21
|
+
onChange = props.onChange;
|
|
27
22
|
var totalPage = getTotalPage(total, pageSize);
|
|
28
|
-
|
|
29
23
|
var _useState = useState(getSafeCurrent(totalPage, currPage)),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
25
|
+
current = _useState2[0],
|
|
26
|
+
setCurrent = _useState2[1];
|
|
34
27
|
useEffect(function () {
|
|
35
28
|
var safeCurrent = getSafeCurrent(totalPage, currPage);
|
|
36
29
|
setCurrent(safeCurrent);
|
|
37
30
|
}, [currPage, totalPage]);
|
|
38
|
-
|
|
39
31
|
if (pageSize === 0) {
|
|
40
32
|
throw new Error('pageSize must be greater than 0');
|
|
41
33
|
}
|
|
42
|
-
|
|
43
34
|
var onChangePage = useCallback(function (page) {
|
|
44
35
|
return function () {
|
|
45
36
|
if (page === current) {
|
|
46
37
|
return;
|
|
47
38
|
}
|
|
48
|
-
|
|
49
39
|
setCurrent(page);
|
|
50
40
|
onChange(page);
|
|
51
41
|
};
|
|
@@ -66,7 +56,6 @@ function Pagination(props) {
|
|
|
66
56
|
className: prefixCls('ellipsis')
|
|
67
57
|
}, "...");
|
|
68
58
|
}
|
|
69
|
-
|
|
70
59
|
return /*#__PURE__*/React.createElement(Button, {
|
|
71
60
|
key: index,
|
|
72
61
|
icon: /*#__PURE__*/React.createElement("span", null, page),
|
|
@@ -81,26 +70,21 @@ function Pagination(props) {
|
|
|
81
70
|
disabled: current >= totalPage
|
|
82
71
|
}));
|
|
83
72
|
}
|
|
84
|
-
|
|
85
73
|
export default Pagination;
|
|
74
|
+
|
|
86
75
|
/**
|
|
87
76
|
* 获取在安全范围内的当前页数
|
|
88
77
|
*/
|
|
89
|
-
|
|
90
78
|
export function getSafeCurrent(totalPage, current) {
|
|
91
79
|
if (current === undefined) {
|
|
92
80
|
return 1;
|
|
93
81
|
}
|
|
94
|
-
|
|
95
82
|
return Math.max(1, Math.min(current, totalPage));
|
|
96
83
|
}
|
|
97
|
-
|
|
98
84
|
function getTotalPage(total, pageSize) {
|
|
99
85
|
return Math.max(1, Math.ceil(total / pageSize));
|
|
100
86
|
}
|
|
101
|
-
|
|
102
87
|
export var ELLIPSIS = '...';
|
|
103
|
-
|
|
104
88
|
/**
|
|
105
89
|
* 获取分页组件需要显示的页码范围。
|
|
106
90
|
*
|
|
@@ -123,49 +107,40 @@ export function getPaginationRange(totalPage, currentPage) {
|
|
|
123
107
|
return i + 1;
|
|
124
108
|
});
|
|
125
109
|
}
|
|
126
|
-
|
|
127
110
|
var surroundCount = 2;
|
|
128
111
|
var current = Math.max(1, Math.min(currentPage, totalPage));
|
|
129
112
|
var start = Math.max(2, current - surroundCount);
|
|
130
|
-
var end = Math.min(totalPage - 1, current + surroundCount);
|
|
113
|
+
var end = Math.min(totalPage - 1, current + surroundCount);
|
|
131
114
|
|
|
115
|
+
// Adjust start and end based on current page
|
|
132
116
|
if (current - start < surroundCount) {
|
|
133
117
|
end = Math.min(end + (surroundCount - (current - start)), totalPage - 1);
|
|
134
118
|
}
|
|
135
|
-
|
|
136
119
|
if (end - current < surroundCount) {
|
|
137
120
|
start = Math.max(start - (surroundCount - (end - current)), 2);
|
|
138
|
-
}
|
|
139
|
-
|
|
121
|
+
}
|
|
140
122
|
|
|
123
|
+
// Check if current page is out of range
|
|
141
124
|
if (current < start || current > end) {
|
|
142
125
|
start = Math.max(2, current - surroundCount);
|
|
143
126
|
end = Math.min(totalPage - 1, current + surroundCount);
|
|
144
127
|
}
|
|
145
|
-
|
|
146
128
|
var range = [];
|
|
147
|
-
|
|
148
129
|
for (var i = start; i <= end; i++) {
|
|
149
130
|
range.push(i);
|
|
150
131
|
}
|
|
151
|
-
|
|
152
132
|
range.unshift(1);
|
|
153
|
-
|
|
154
133
|
if (start > 2 && range[1] !== ELLIPSIS) {
|
|
155
134
|
range.splice(1, 0, ELLIPSIS);
|
|
156
135
|
}
|
|
157
|
-
|
|
158
136
|
if (totalPage !== range[range.length - 1]) {
|
|
159
137
|
if (end < totalPage - 1 && range[range.length - 1] !== ELLIPSIS) {
|
|
160
138
|
range.splice(range.length, 0, ELLIPSIS);
|
|
161
139
|
}
|
|
162
|
-
|
|
163
140
|
range.push(totalPage);
|
|
164
141
|
}
|
|
165
|
-
|
|
166
142
|
return range;
|
|
167
143
|
}
|
|
168
|
-
|
|
169
144
|
function prefixCls(name) {
|
|
170
145
|
return "ald-pagination-".concat(name);
|
|
171
146
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { PopconfirmProps as AntdPopconfirmProps } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { ButtonType, IButtonProps } from '../Button';
|
|
4
4
|
export interface PopconfirmProps extends Omit<AntdPopconfirmProps, 'okButtonProps' | 'cancelButtonProps' | 'okType' | 'description'> {
|
|
5
5
|
okButtonProps?: IButtonProps;
|
|
6
6
|
cancelButtonProps?: IButtonProps;
|
|
7
7
|
okType?: ButtonType;
|
|
8
8
|
}
|
|
9
|
-
declare function MyPopconfirm(props: PopconfirmProps): JSX.Element;
|
|
9
|
+
declare function MyPopconfirm(props: PopconfirmProps): React.JSX.Element;
|
|
10
10
|
export default MyPopconfirm;
|
package/dist/Popconfirm/index.js
CHANGED
|
@@ -1,43 +1,37 @@
|
|
|
1
1
|
var _excluded = ["okButtonProps", "cancelButtonProps", "okType", "icon"];
|
|
2
|
-
|
|
3
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); }
|
|
4
|
-
|
|
5
3
|
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; }
|
|
6
|
-
|
|
7
4
|
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; }
|
|
8
|
-
|
|
9
5
|
import { AlertTriangleDuotone } from '@aloudata/icons-react';
|
|
10
6
|
import { Popconfirm } from 'antd';
|
|
11
7
|
import classNames from 'classnames';
|
|
12
8
|
import React from 'react';
|
|
13
9
|
import { btnPrefix, getButtonSizeClass, getButtonType, getDangerStatus, getShape } from "../Button";
|
|
14
10
|
import themeColor from "../style/themes/default/themeColor.module.less";
|
|
15
|
-
|
|
16
11
|
function MyPopconfirm(props) {
|
|
17
12
|
var _props$okButtonProps = props.okButtonProps,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
13
|
+
okButtonProps = _props$okButtonProps === void 0 ? {} : _props$okButtonProps,
|
|
14
|
+
_props$cancelButtonPr = props.cancelButtonProps,
|
|
15
|
+
cancelButtonProps = _props$cancelButtonPr === void 0 ? {} : _props$cancelButtonPr,
|
|
16
|
+
okType = props.okType,
|
|
17
|
+
_props$icon = props.icon,
|
|
18
|
+
icon = _props$icon === void 0 ? /*#__PURE__*/React.createElement(AlertTriangleDuotone, {
|
|
19
|
+
size: 16,
|
|
20
|
+
theme: "multi-color",
|
|
21
|
+
fill: [themeColor.SB40, themeColor.BG100]
|
|
22
|
+
}) : _props$icon,
|
|
23
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
30
24
|
function getButtonProps(buttonProps, defaultBtnType) {
|
|
31
25
|
var btnType = defaultBtnType === 'dangerous' ? okType || 'dangerous' : 'secondary';
|
|
32
26
|
var className = buttonProps.className,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
27
|
+
_buttonProps$type = buttonProps.type,
|
|
28
|
+
type = _buttonProps$type === void 0 ? btnType : _buttonProps$type,
|
|
29
|
+
loading = buttonProps.loading,
|
|
30
|
+
_buttonProps$size = buttonProps.size,
|
|
31
|
+
size = _buttonProps$size === void 0 ? 'small' : _buttonProps$size,
|
|
32
|
+
disabled = buttonProps.disabled,
|
|
33
|
+
_buttonProps$shape = buttonProps.shape,
|
|
34
|
+
shape = _buttonProps$shape === void 0 ? 'default' : _buttonProps$shape;
|
|
41
35
|
return {
|
|
42
36
|
disable: loading ? true : disabled,
|
|
43
37
|
type: getButtonType(type),
|
|
@@ -46,7 +40,6 @@ function MyPopconfirm(props) {
|
|
|
46
40
|
shape: getShape(shape)
|
|
47
41
|
};
|
|
48
42
|
}
|
|
49
|
-
|
|
50
43
|
return /*#__PURE__*/React.createElement(Popconfirm, _extends({}, restProps, {
|
|
51
44
|
icon: icon,
|
|
52
45
|
okButtonProps: getButtonProps(okButtonProps, 'dangerous'),
|
|
@@ -54,5 +47,4 @@ function MyPopconfirm(props) {
|
|
|
54
47
|
description: null
|
|
55
48
|
}));
|
|
56
49
|
}
|
|
57
|
-
|
|
58
50
|
export default MyPopconfirm;
|
package/dist/Popover/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { PopoverProps } from 'antd';
|
|
3
3
|
export type { PopoverProps };
|
|
4
|
-
declare function Popover(props: PopoverProps): JSX.Element;
|
|
4
|
+
declare function Popover(props: PopoverProps): React.JSX.Element;
|
|
5
5
|
export default Popover;
|
package/dist/Popover/index.js
CHANGED
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
var _excluded = ["overlayClassName", "children"];
|
|
2
|
-
|
|
3
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); }
|
|
4
|
-
|
|
5
3
|
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; }
|
|
6
|
-
|
|
7
4
|
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; }
|
|
8
|
-
|
|
9
5
|
import React from 'react';
|
|
10
6
|
import { Popover as AntdPopover } from 'antd';
|
|
11
7
|
import classnames from 'classnames';
|
|
12
|
-
|
|
13
8
|
function Popover(props) {
|
|
14
9
|
var overlayClassName = props.overlayClassName,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
children = props.children,
|
|
11
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
18
12
|
return /*#__PURE__*/React.createElement(AntdPopover, _extends({
|
|
19
13
|
overlayClassName: classnames('ald-popover', overlayClassName)
|
|
20
14
|
}, restProps), children);
|
|
21
15
|
}
|
|
22
|
-
|
|
23
16
|
export default Popover;
|
package/dist/Progress/index.js
CHANGED
|
@@ -1,46 +1,36 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
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); }
|
|
2
|
+
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; }
|
|
3
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
|
+
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); }
|
|
3
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
-
|
|
5
6
|
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."); }
|
|
6
|
-
|
|
7
7
|
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); }
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
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; }
|
|
12
|
-
|
|
8
|
+
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; }
|
|
9
|
+
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; } }
|
|
13
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
-
|
|
15
11
|
import classNames from 'classnames';
|
|
16
12
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useState } from 'react';
|
|
17
|
-
var ELoadingState
|
|
18
|
-
/**
|
|
19
|
-
* 条状进度条组件
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
(function (ELoadingState) {
|
|
13
|
+
var ELoadingState = /*#__PURE__*/function (ELoadingState) {
|
|
23
14
|
ELoadingState["IDLE"] = "IDLE";
|
|
24
15
|
ELoadingState["LOADING"] = "LOADING";
|
|
25
16
|
ELoadingState["LOADED"] = "LOADED";
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
return ELoadingState;
|
|
18
|
+
}(ELoadingState || {});
|
|
19
|
+
/**
|
|
20
|
+
* 条状进度条组件
|
|
21
|
+
*/
|
|
28
22
|
export default /*#__PURE__*/forwardRef(function Progress(props, ref) {
|
|
29
23
|
var _classNames2;
|
|
30
|
-
|
|
31
24
|
var loading = props.loading,
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
className = props.className;
|
|
34
26
|
var _useState = useState(ELoadingState.IDLE),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
loadingState = _useState2[0],
|
|
29
|
+
setLoadingState = _useState2[1];
|
|
39
30
|
var _useState3 = useState(0),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
32
|
+
key = _useState4[0],
|
|
33
|
+
setKey = _useState4[1];
|
|
44
34
|
useImperativeHandle(ref, function () {
|
|
45
35
|
return {
|
|
46
36
|
restart: function restart() {
|
|
@@ -56,11 +46,9 @@ export default /*#__PURE__*/forwardRef(function Progress(props, ref) {
|
|
|
56
46
|
// loading 变为 false 时,进度条开始消失
|
|
57
47
|
setLoadingState(ELoadingState.LOADED);
|
|
58
48
|
}
|
|
59
|
-
|
|
60
49
|
return;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
}
|
|
51
|
+
// 防止 loading 快速变化导致的闪烁
|
|
64
52
|
var DELAY_TIME = 200;
|
|
65
53
|
var timer = setTimeout(function () {
|
|
66
54
|
if (loading) {
|
|
@@ -3,4 +3,4 @@ import { IRadioGroupProps } from '../../interface/radioGroup';
|
|
|
3
3
|
export declare const RadioGroupContext: React.Context<Omit<IRadioGroupProps, "children" | "className"> & {
|
|
4
4
|
sliderRef?: React.RefObject<HTMLDivElement> | undefined;
|
|
5
5
|
}>;
|
|
6
|
-
export default function RadioGroup(props: IRadioGroupProps): JSX.Element;
|
|
6
|
+
export default function RadioGroup(props: IRadioGroupProps): React.JSX.Element;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
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); }
|
|
2
|
+
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; }
|
|
3
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
|
+
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); }
|
|
3
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
-
|
|
5
6
|
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."); }
|
|
6
|
-
|
|
7
7
|
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); }
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
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; }
|
|
12
|
-
|
|
8
|
+
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; }
|
|
9
|
+
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; } }
|
|
13
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
-
|
|
15
11
|
import classNames from 'classnames';
|
|
16
12
|
import useMergedState from 'rc-util/lib/hooks/useMergedState';
|
|
17
13
|
import React, { createContext, useRef } from 'react';
|
|
@@ -19,48 +15,43 @@ import DisabledContext from 'antd/lib/config-provider/DisabledContext';
|
|
|
19
15
|
export var RadioGroupContext = /*#__PURE__*/createContext({});
|
|
20
16
|
export default function RadioGroup(props) {
|
|
21
17
|
var children = props.children,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var sliderRef = useRef(null);
|
|
32
|
-
|
|
18
|
+
_props$radioGroupStyl = props.radioGroupStyle,
|
|
19
|
+
radioGroupStyle = _props$radioGroupStyl === void 0 ? 'border' : _props$radioGroupStyl,
|
|
20
|
+
_props$size = props.size,
|
|
21
|
+
size = _props$size === void 0 ? 'middle' : _props$size,
|
|
22
|
+
_props$type = props.type,
|
|
23
|
+
type = _props$type === void 0 ? 'radio' : _props$type,
|
|
24
|
+
className = props.className,
|
|
25
|
+
customDisabled = props.disabled;
|
|
26
|
+
// 滑块的ref
|
|
27
|
+
var sliderRef = useRef(null);
|
|
28
|
+
// 该hooks与useState相同,但是当props中有value值时,优先使用value的值
|
|
33
29
|
var _useMergedState = useMergedState(props.defaultValue, {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
value: props === null || props === void 0 ? void 0 : props.value
|
|
31
|
+
}),
|
|
32
|
+
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
|
33
|
+
value = _useMergedState2[0],
|
|
34
|
+
setValue = _useMergedState2[1];
|
|
35
|
+
// ===================== Disabled =====================
|
|
41
36
|
var disabled = React.useContext(DisabledContext);
|
|
42
|
-
var mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;
|
|
43
|
-
|
|
37
|
+
var mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
39
|
var onRadioChange = function onRadioChange(selectedValue) {
|
|
45
|
-
var lastValue = value;
|
|
40
|
+
var lastValue = value;
|
|
41
|
+
// const val = ev.target.value;
|
|
46
42
|
// console.log(selectValue);
|
|
47
|
-
|
|
48
43
|
setValue(selectedValue);
|
|
49
44
|
var onChange = props.onChange;
|
|
50
|
-
|
|
51
45
|
if (onChange && selectedValue !== lastValue) {
|
|
52
46
|
onChange(selectedValue);
|
|
53
47
|
}
|
|
54
48
|
};
|
|
55
|
-
|
|
56
49
|
var getWrapperClass = function getWrapperClass() {
|
|
57
50
|
var _classNames;
|
|
58
|
-
|
|
59
51
|
var isButton = ['button', 'iconButton'].includes(type);
|
|
60
52
|
var tempType = type === 'iconButton' ? 'icon-button' : type;
|
|
61
53
|
return classNames('ald-radio-group', className, "ald-radio-group-".concat(tempType), (_classNames = {}, _defineProperty(_classNames, "ald-radio-group-".concat(radioGroupStyle), isButton), _defineProperty(_classNames, "ald-radio-group-".concat(size), isButton), _classNames));
|
|
62
54
|
};
|
|
63
|
-
|
|
64
55
|
return /*#__PURE__*/React.createElement(RadioGroupContext.Provider, {
|
|
65
56
|
value: {
|
|
66
57
|
onChange: onRadioChange,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { IRadioProps } from '../../interface/radio';
|
|
3
|
-
export default function Radio(props: IRadioProps): JSX.Element;
|
|
3
|
+
export default function Radio(props: IRadioProps): React.JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
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 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; }
|
|
2
|
-
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
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); }
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import _ from 'lodash';
|
|
9
9
|
import React, { useContext, useEffect, useRef } from 'react';
|
|
@@ -13,25 +13,21 @@ export default function Radio(props) {
|
|
|
13
13
|
var groupContext = useContext(RadioGroupContext);
|
|
14
14
|
var labelRef = useRef(null);
|
|
15
15
|
var id = getUUID().toString();
|
|
16
|
-
|
|
17
16
|
var radioProps = _objectSpread({}, props);
|
|
18
|
-
|
|
19
17
|
if (!_.isEmpty(groupContext)) {
|
|
20
18
|
radioProps.disabled = groupContext.disabled || props.disabled;
|
|
21
19
|
radioProps.checked = !props.disabled && groupContext.value === props.value;
|
|
22
20
|
} else {
|
|
23
21
|
radioProps.checked = !('checked' in props) ? props.defaultChecked : radioProps.checked;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
}
|
|
23
|
+
// 设置input外层盒子的class
|
|
27
24
|
var aldRadioClass = classNames('ald-radio', {
|
|
28
25
|
'ald-radio-checked': radioProps.checked,
|
|
29
26
|
'ald-radio-disabled': radioProps.disabled
|
|
30
|
-
});
|
|
31
|
-
|
|
27
|
+
});
|
|
28
|
+
// 根据属性设置最外层的class
|
|
32
29
|
var getWrapperClass = function getWrapperClass() {
|
|
33
30
|
var otherClass = '';
|
|
34
|
-
|
|
35
31
|
if (groupContext.type === 'button') {
|
|
36
32
|
if (groupContext.radioGroupStyle === 'filled') {
|
|
37
33
|
otherClass = 'ald-radio-button-wrapper-filled';
|
|
@@ -56,30 +52,26 @@ export default function Radio(props) {
|
|
|
56
52
|
// 当type未设置或者是radio时
|
|
57
53
|
otherClass = 'ald-radio-wrapper';
|
|
58
54
|
}
|
|
59
|
-
|
|
60
55
|
return classNames('ald-radio-label', otherClass, {
|
|
61
56
|
'ald-radio-wrapper-checked': radioProps.checked,
|
|
62
57
|
'ald-radio-wrapper-disabled': radioProps.disabled
|
|
63
58
|
});
|
|
64
|
-
};
|
|
65
|
-
|
|
59
|
+
};
|
|
66
60
|
|
|
61
|
+
// filled button模式下,更改滑块的位置
|
|
67
62
|
useEffect(function () {
|
|
68
63
|
var _groupContext$sliderR;
|
|
69
|
-
|
|
70
64
|
if (radioProps.checked && groupContext !== null && groupContext !== void 0 && (_groupContext$sliderR = groupContext.sliderRef) !== null && _groupContext$sliderR !== void 0 && _groupContext$sliderR.current && labelRef !== null && labelRef !== void 0 && labelRef.current) {
|
|
71
65
|
groupContext.sliderRef.current.style.left = "".concat(labelRef.current.offsetLeft, "px");
|
|
72
66
|
groupContext.sliderRef.current.style.width = "".concat(labelRef.current.offsetWidth, "px");
|
|
73
67
|
}
|
|
74
68
|
}, [groupContext.sliderRef, radioProps.checked]);
|
|
75
|
-
|
|
76
69
|
var onChange = function onChange() {
|
|
77
70
|
if (groupContext !== null && groupContext !== void 0 && groupContext.onChange) {
|
|
78
71
|
// input事件的value会被toString,所以此处进行一个覆盖
|
|
79
72
|
groupContext.onChange(props.value);
|
|
80
73
|
}
|
|
81
74
|
};
|
|
82
|
-
|
|
83
75
|
return /*#__PURE__*/React.createElement("label", {
|
|
84
76
|
className: getWrapperClass(),
|
|
85
77
|
htmlFor: id,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
2
|
+
export type TRadioGroupStyle = 'border' | 'filled' | 'borderPrimary' | 'filter';
|
|
3
|
+
export type TRadioSize = 'large' | 'middle' | 'small' | 'default';
|
|
4
|
+
export type TRadioType = 'radio' | 'button' | 'iconButton';
|
|
5
5
|
export interface IRadioGroupProps {
|
|
6
6
|
/**
|
|
7
7
|
* @description 按钮组的样式 'border' | 'filled'
|