@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 { default as React } from 'react';
|
|
2
2
|
interface IProcessIconProps {
|
|
3
3
|
type: 'process' | 'wait' | 'finish' | 'error';
|
|
4
4
|
}
|
|
5
|
-
export declare function ProcessIcon({ type }: IProcessIconProps): JSX.Element;
|
|
5
|
+
export declare function ProcessIcon({ type }: IProcessIconProps): React.JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -7,7 +7,6 @@ export function ProcessIcon(_ref) {
|
|
|
7
7
|
}, /*#__PURE__*/React.createElement("img", {
|
|
8
8
|
src: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTEiIGhlaWdodD0iOCIgdmlld0JveD0iMCAwIDExIDgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0zLjc1IDcuOTQzMjVMMCA0LjE5MzI1TDEuMTkzMjUgM0wzLjc1IDUuNTU2NzVMOS4zMDc1IDBMMTAuNTAzNyAxLjE4ODc1TDMuNzUgNy45NDMyNVoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo="
|
|
9
9
|
}));
|
|
10
|
-
|
|
11
10
|
if (type === 'error') {
|
|
12
11
|
return /*#__PURE__*/React.createElement("span", {
|
|
13
12
|
className: classNames("".concat(type, "-icon-box"), 'icon-box')
|
|
@@ -15,7 +14,6 @@ export function ProcessIcon(_ref) {
|
|
|
15
14
|
src: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMyIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDMgMTAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0wLjI4MTI1MSAwSDEuOTY4NzVWNi41SDAuMjgxMjUxVjBaTTEuMTI1IDEwQzAuOTAyNDk3IDEwIDAuNjg0OTkgOS45MzQwMiAwLjQ5OTk4NSA5LjgxMDRDMC4zMTQ5NzkgOS42ODY3OSAwLjE3MDc4NSA5LjUxMTA4IDAuMDg1NjM2MSA5LjMwNTUyQzAuMDAwNDg3NDQ3IDkuMDk5OTUgLTAuMDIxNzkxMyA4Ljg3Mzc1IDAuMDIxNjE3MSA4LjY1NTUyQzAuMDY1MDI1NSA4LjQzNzI5IDAuMTcyMTcxIDguMjM2ODQgMC4zMjk1MDUgOC4wNzk1MUMwLjQ4Njg0IDcuOTIyMTcgMC42ODcyOTUgNy44MTUwMiAwLjkwNTUyNCA3Ljc3MTYyQzEuMTIzNzUgNy43MjgyMSAxLjM0OTk1IDcuNzUwNDkgMS41NTU1MiA3LjgzNTY0QzEuNzYxMDkgNy45MjA3OCAxLjkzNjc5IDguMDY0OTggMi4wNjA0IDguMjQ5OThDMi4xODQwMiA4LjQzNDk5IDIuMjUgOC42NTI1IDIuMjUgOC44NzVDMi4yNSA5LjE3MzM3IDIuMTMxNDcgOS40NTk1MiAxLjkyMDUgOS42NzA0OUMxLjcwOTUyIDkuODgxNDcgMS40MjMzNyAxMCAxLjEyNSAxMFoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo="
|
|
16
15
|
}));
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
return /*#__PURE__*/React.createElement("span", {
|
|
20
18
|
className: classNames("".concat(type, "-icon-box"), 'icon-box')
|
|
21
19
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
export type TStatus = 'wait' | 'process' | 'finish' | 'error';
|
|
3
3
|
export interface IStepProps {
|
|
4
4
|
/**
|
|
5
5
|
* @description 当前步骤的描述信息
|
|
@@ -17,4 +17,4 @@ export interface IStepProps {
|
|
|
17
17
|
*/
|
|
18
18
|
title?: ReactNode;
|
|
19
19
|
}
|
|
20
|
-
export declare function Step(props: IStepProps): JSX.Element;
|
|
20
|
+
export declare function Step(props: IStepProps): React.JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
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
2
|
import React from 'react';
|
|
4
3
|
import { CheckCircleDuotone, AlertTriangleDuotone } from '@aloudata/icons-react';
|
|
5
4
|
import { ProcessIcon } from "../ProcessIcon";
|
|
@@ -7,7 +6,6 @@ import { Steps as AntdSteps } from 'antd';
|
|
|
7
6
|
var AntdStep = AntdSteps.Step;
|
|
8
7
|
export function Step(props) {
|
|
9
8
|
var status = props.status;
|
|
10
|
-
|
|
11
9
|
var getIcon = function getIcon(stepStatus) {
|
|
12
10
|
if (stepStatus === 'error') {
|
|
13
11
|
return /*#__PURE__*/React.createElement("span", {
|
|
@@ -18,7 +16,6 @@ export function Step(props) {
|
|
|
18
16
|
fill: ['#D92D20', 'fff']
|
|
19
17
|
}));
|
|
20
18
|
}
|
|
21
|
-
|
|
22
19
|
if (stepStatus === 'finish') {
|
|
23
20
|
return /*#__PURE__*/React.createElement("span", {
|
|
24
21
|
className: "check-icon-box icon-box"
|
|
@@ -28,19 +25,16 @@ export function Step(props) {
|
|
|
28
25
|
fill: ['#D92D20', 'fff']
|
|
29
26
|
}));
|
|
30
27
|
}
|
|
31
|
-
|
|
32
28
|
if (stepStatus === 'process') {
|
|
33
29
|
return /*#__PURE__*/React.createElement(ProcessIcon, {
|
|
34
30
|
type: "process"
|
|
35
31
|
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
}
|
|
33
|
+
// wait
|
|
39
34
|
return /*#__PURE__*/React.createElement(ProcessIcon, {
|
|
40
35
|
type: "wait"
|
|
41
36
|
});
|
|
42
37
|
};
|
|
43
|
-
|
|
44
38
|
return /*#__PURE__*/React.createElement(AntdStep, _extends({}, props, {
|
|
45
39
|
icon: getIcon(status)
|
|
46
40
|
}));
|
package/dist/Steps/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from 'react';
|
|
1
|
+
import React, { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { IStepProps } from './components/Step';
|
|
3
3
|
export type { IStepProps };
|
|
4
|
-
export
|
|
4
|
+
export type TStatus = 'wait' | 'process' | 'finish' | 'error';
|
|
5
5
|
export interface IStepsProps {
|
|
6
6
|
/**
|
|
7
7
|
* @description Steps最外层类名
|
|
@@ -39,7 +39,7 @@ export interface IStepItem {
|
|
|
39
39
|
subTitle?: ReactNode;
|
|
40
40
|
title: ReactNode;
|
|
41
41
|
}
|
|
42
|
-
declare function Steps({ className, current, direction, defaultCurrent, status, children, items, }: IStepsProps): JSX.Element;
|
|
42
|
+
declare function Steps({ className, current, direction, defaultCurrent, status, children, items, }: IStepsProps): React.JSX.Element;
|
|
43
43
|
declare namespace Steps {
|
|
44
44
|
var Step: typeof import("./components/Step").Step;
|
|
45
45
|
}
|
package/dist/Steps/index.js
CHANGED
|
@@ -4,17 +4,16 @@ import classNames from 'classnames';
|
|
|
4
4
|
import { CustomDot } from "./components/CustomDot";
|
|
5
5
|
import { Step } from "./components/Step";
|
|
6
6
|
var INITIAL = 0;
|
|
7
|
-
|
|
8
7
|
function Steps(_ref) {
|
|
9
8
|
var className = _ref.className,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
current = _ref.current,
|
|
10
|
+
_ref$direction = _ref.direction,
|
|
11
|
+
direction = _ref$direction === void 0 ? 'horizontal' : _ref$direction,
|
|
12
|
+
_ref$defaultCurrent = _ref.defaultCurrent,
|
|
13
|
+
defaultCurrent = _ref$defaultCurrent === void 0 ? INITIAL : _ref$defaultCurrent,
|
|
14
|
+
status = _ref.status,
|
|
15
|
+
children = _ref.children,
|
|
16
|
+
items = _ref.items;
|
|
18
17
|
return /*#__PURE__*/React.createElement(AntdSteps, {
|
|
19
18
|
className: classNames('ald-steps', className),
|
|
20
19
|
current: current,
|
|
@@ -29,6 +28,5 @@ function Steps(_ref) {
|
|
|
29
28
|
type: "default"
|
|
30
29
|
}, children);
|
|
31
30
|
}
|
|
32
|
-
|
|
33
31
|
Steps.Step = Step;
|
|
34
32
|
export default Steps;
|
package/dist/Switch/index.js
CHANGED
|
@@ -1,54 +1,42 @@
|
|
|
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
|
import { Switch as AntdSwitch } from 'antd';
|
|
14
8
|
import DisabledContext from 'antd/lib/config-provider/DisabledContext';
|
|
15
9
|
import classnames from 'classnames';
|
|
16
10
|
import React, { useContext, useEffect, useState } from 'react';
|
|
17
11
|
import SizeContext from "../ConfigProvider/sizeContext";
|
|
18
|
-
|
|
19
12
|
var Switch = function Switch(_ref) {
|
|
20
13
|
var _ref$className = _ref.className,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
14
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
15
|
+
customDisabled = _ref.disabled,
|
|
16
|
+
_ref$loading = _ref.loading,
|
|
17
|
+
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
18
|
+
customSize = _ref.size,
|
|
19
|
+
checked = _ref.checked,
|
|
20
|
+
_ref$defaultChecked = _ref.defaultChecked,
|
|
21
|
+
defaultChecked = _ref$defaultChecked === void 0 ? false : _ref$defaultChecked,
|
|
22
|
+
onChange = _ref.onChange,
|
|
23
|
+
onClick = _ref.onClick,
|
|
24
|
+
children = _ref.children;
|
|
32
25
|
var contentSize = useContext(SizeContext);
|
|
33
26
|
var size = customSize || contentSize || 'middle';
|
|
34
|
-
|
|
35
27
|
var _useState = useState(typeof checked === 'undefined' ? defaultChecked : checked),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
+
userChecked = _useState2[0],
|
|
30
|
+
setUserChecked = _useState2[1];
|
|
31
|
+
// ===================== Disabled =====================
|
|
41
32
|
var disabled = React.useContext(DisabledContext);
|
|
42
33
|
var mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;
|
|
43
|
-
|
|
44
34
|
var onChangeCB = function onChangeCB(isChecked, event) {
|
|
45
35
|
setUserChecked(isChecked);
|
|
46
|
-
|
|
47
36
|
if (typeof onChange === 'function') {
|
|
48
37
|
onChange(isChecked, event);
|
|
49
38
|
}
|
|
50
39
|
};
|
|
51
|
-
|
|
52
40
|
var currentDisabled = loading ? true : mergedDisabled;
|
|
53
41
|
useEffect(function () {
|
|
54
42
|
if (typeof checked === 'boolean') {
|
|
@@ -72,5 +60,4 @@ var Switch = function Switch(_ref) {
|
|
|
72
60
|
className: "ald-switch-text"
|
|
73
61
|
}, children));
|
|
74
62
|
};
|
|
75
|
-
|
|
76
63
|
export default Switch;
|