@aloudata/aloudata-design 2.5.1 → 2.6.0
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/DataPreviewTable/components/Body/Error.d.ts +1 -2
- package/dist/DataPreviewTable/components/Body/Error.js +5 -7
- package/dist/DataPreviewTable/components/Header/index.d.ts +1 -0
- package/dist/DataPreviewTable/components/Header/index.js +3 -4
- package/dist/DataPreviewTable/index.js +16 -15
- package/dist/DataPreviewTable/interface.d.ts +2 -2
- package/dist/DataPreviewTable/style/index.less +6 -0
- package/dist/Icon/components/CancelledCircleFill.d.ts +11 -0
- package/dist/Icon/components/CancelledCircleFill.js +35 -0
- package/dist/Icon/components/InProgressFill.d.ts +11 -0
- package/dist/Icon/components/InProgressFill.js +38 -0
- package/dist/Icon/index.d.ts +2 -0
- package/dist/Icon/index.js +2 -0
- package/dist/Icon/svg/Cancelled-Circle-fill.svg +5 -0
- package/dist/Icon/svg/In-Progress-fill.svg +8 -0
- package/dist/Radio/components/Radio/index.js +45 -9
- package/dist/Radio/interface/radio.d.ts +3 -0
- package/dist/Radio/style/index.less +32 -2
- package/dist/Spin/CustomIcon/index.js +4 -1
- package/dist/StatusLight/index.d.ts +12 -0
- package/dist/StatusLight/index.js +74 -0
- package/dist/StatusLight/style/index.d.ts +2 -0
- package/dist/StatusLight/style/index.js +2 -0
- package/dist/StatusLight/style/index.less +47 -0
- package/dist/Table/helper.d.ts +6 -4
- package/dist/Table/helper.js +20 -5
- package/dist/Table/hooks/useFixed.d.ts +10 -0
- package/dist/Table/hooks/useFixed.js +56 -0
- package/dist/Table/hooks/useScroll.d.ts +5 -1
- package/dist/Table/hooks/useScroll.js +79 -11
- package/dist/Table/index.js +56 -51
- package/dist/Table/style/index.less +70 -4
- package/dist/Table/types.d.ts +4 -0
- package/dist/ald.min.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.less +1 -0
- package/package.json +2 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface IErrorProps {
|
|
3
|
-
contentWidth: number;
|
|
4
3
|
wrapWidth: number;
|
|
5
|
-
errorMsg?: string;
|
|
4
|
+
errorMsg?: string | React.ReactNode;
|
|
6
5
|
}
|
|
7
6
|
declare function ErrorBody(props: IErrorProps): React.JSX.Element;
|
|
8
7
|
declare const _default: React.MemoExoticComponent<typeof ErrorBody>;
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
import Result from "../../../Result";
|
|
3
3
|
function ErrorBody(props) {
|
|
4
|
-
var
|
|
5
|
-
wrapWidth = props.wrapWidth,
|
|
4
|
+
var wrapWidth = props.wrapWidth,
|
|
6
5
|
_props$errorMsg = props.errorMsg,
|
|
7
6
|
errorMsg = _props$errorMsg === void 0 ? '加载失败' : _props$errorMsg;
|
|
8
|
-
var width = contentWidth > wrapWidth ? wrapWidth : contentWidth;
|
|
9
7
|
return /*#__PURE__*/React.createElement("div", {
|
|
10
8
|
className: "ald-data-preview-table-error",
|
|
11
9
|
style: {
|
|
12
|
-
width:
|
|
10
|
+
width: wrapWidth
|
|
13
11
|
}
|
|
14
|
-
}, /*#__PURE__*/React.createElement(Result, {
|
|
12
|
+
}, typeof errorMsg === 'string' ? /*#__PURE__*/React.createElement(Result, {
|
|
15
13
|
status: "warning",
|
|
16
|
-
|
|
17
|
-
}));
|
|
14
|
+
subTitle: errorMsg
|
|
15
|
+
}) : errorMsg);
|
|
18
16
|
}
|
|
19
17
|
export default /*#__PURE__*/memo(ErrorBody);
|
|
@@ -8,7 +8,8 @@ import React from 'react';
|
|
|
8
8
|
import { HEADER_HEIGHT } from "../../constant";
|
|
9
9
|
import DragBar from "../DragBar";
|
|
10
10
|
export default function Header(props) {
|
|
11
|
-
var
|
|
11
|
+
var contentWidth = props.contentWidth,
|
|
12
|
+
columns = props.columns,
|
|
12
13
|
columnLayout = props.columnLayout,
|
|
13
14
|
setWidth = props.setWidth,
|
|
14
15
|
_props$columnRange = _slicedToArray(props.columnRange, 2),
|
|
@@ -17,9 +18,7 @@ export default function Header(props) {
|
|
|
17
18
|
return /*#__PURE__*/React.createElement("div", {
|
|
18
19
|
className: "ald-data-preview-header",
|
|
19
20
|
style: {
|
|
20
|
-
|
|
21
|
-
top: 0,
|
|
22
|
-
left: 0
|
|
21
|
+
width: contentWidth
|
|
23
22
|
}
|
|
24
23
|
}, columns.slice(startIndex, endIndex + 1).map(function (column) {
|
|
25
24
|
var _column$renderHeader;
|
|
@@ -31,8 +31,8 @@ var DataPreviewTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
31
31
|
onScroll = _useDirection.onScroll,
|
|
32
32
|
columnLayout = _useDirection.columnLayout,
|
|
33
33
|
setColumnsWidth = _useDirection.setColumnsWidth,
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
tableColumns = _useDirection.tableColumns,
|
|
35
|
+
contentWidth = _useDirection.contentWidth;
|
|
36
36
|
useImperativeHandle(ref, function () {
|
|
37
37
|
return {
|
|
38
38
|
scrollToColumnInView: function scrollToColumnInView(columnId) {
|
|
@@ -70,10 +70,10 @@ var DataPreviewTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
70
70
|
});
|
|
71
71
|
var skeletonRows = useMemo(function () {
|
|
72
72
|
var _wrapRef$current4;
|
|
73
|
-
|
|
73
|
+
if (!wrapRef.current) return 0;
|
|
74
|
+
var rows = Math.ceil(((((_wrapRef$current4 = wrapRef.current) === null || _wrapRef$current4 === void 0 ? void 0 : _wrapRef$current4.clientHeight) || 0) - HEADER_HEIGHT) / CELL_HEIGHT);
|
|
74
75
|
return rows - 1 < 0 ? 0 : rows - 1;
|
|
75
|
-
|
|
76
|
-
}, [wrapRef.current]);
|
|
76
|
+
}, []);
|
|
77
77
|
return /*#__PURE__*/React.createElement(ScrollArea, {
|
|
78
78
|
ref: wrapRef,
|
|
79
79
|
style: {
|
|
@@ -88,22 +88,24 @@ var DataPreviewTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
88
88
|
className: classNames(props.className, 'ald-data-preview-table', {
|
|
89
89
|
'ald-data-preview-table-show-skeleton': dataStatus === 'pending'
|
|
90
90
|
})
|
|
91
|
-
}, /*#__PURE__*/React.createElement(
|
|
92
|
-
className: "ald-data-preview-progress",
|
|
93
|
-
loading: !!loading,
|
|
94
|
-
ref: progressRef
|
|
95
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
96
92
|
style: {
|
|
97
93
|
height: dataStatus === 'pending' ? skeletonRows * CELL_HEIGHT + HEADER_HEIGHT : contentHeight,
|
|
98
|
-
width: contentWidth,
|
|
99
94
|
position: 'relative'
|
|
100
95
|
}
|
|
101
|
-
}, /*#__PURE__*/React.createElement(
|
|
96
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
className: "ald-data-preview-sticky"
|
|
98
|
+
}, /*#__PURE__*/React.createElement(Progress, {
|
|
99
|
+
className: "ald-data-preview-progress",
|
|
100
|
+
loading: !!loading,
|
|
101
|
+
ref: progressRef
|
|
102
|
+
}), /*#__PURE__*/React.createElement(Header, {
|
|
103
|
+
contentWidth: contentWidth,
|
|
102
104
|
columns: tableColumns,
|
|
103
105
|
columnLayout: columnLayout,
|
|
104
106
|
setWidth: setColumnsWidth,
|
|
105
107
|
columnRange: columnRange
|
|
106
|
-
}), dataStatus === 'pending' && tableColumns.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
})), dataStatus === 'pending' && tableColumns.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
107
109
|
className: "ald-data-preview-loading"
|
|
108
110
|
}, /*#__PURE__*/React.createElement(Spin, null)), dataStatus === 'success' && /*#__PURE__*/React.createElement(Body, {
|
|
109
111
|
columns: tableColumns,
|
|
@@ -113,8 +115,7 @@ var DataPreviewTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
113
115
|
rowRange: rowRange
|
|
114
116
|
}), dataStatus === 'error' && /*#__PURE__*/React.createElement(Error, {
|
|
115
117
|
errorMsg: errorMsg,
|
|
116
|
-
wrapWidth: ((_wrapRef$current5 = wrapRef.current) === null || _wrapRef$current5 === void 0 ? void 0 : _wrapRef$current5.clientWidth) || 0
|
|
117
|
-
contentWidth: contentWidth
|
|
118
|
+
wrapWidth: ((_wrapRef$current5 = wrapRef.current) === null || _wrapRef$current5 === void 0 ? void 0 : _wrapRef$current5.clientWidth) || 0
|
|
118
119
|
})));
|
|
119
120
|
});
|
|
120
121
|
export default /*#__PURE__*/memo(DataPreviewTable);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSProperties } from 'react';
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
2
|
export interface ITableProps {
|
|
3
3
|
columns?: PreviewColumn[];
|
|
4
4
|
datasource?: TValue[][];
|
|
@@ -6,7 +6,7 @@ export interface ITableProps {
|
|
|
6
6
|
height?: CSSProperties['height'];
|
|
7
7
|
dataStatus?: 'pending' | 'success' | 'error';
|
|
8
8
|
loading?: boolean;
|
|
9
|
-
errorMsg?: string;
|
|
9
|
+
errorMsg?: string | React.ReactNode;
|
|
10
10
|
className?: string;
|
|
11
11
|
}
|
|
12
12
|
export interface DataPreviewTableRef {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SVGProps } from 'react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
interface SVGRProps {
|
|
4
|
+
size?: number | string;
|
|
5
|
+
title?: string;
|
|
6
|
+
titleId?: string;
|
|
7
|
+
desc?: string;
|
|
8
|
+
descId?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Memo: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<SVGProps<SVGSVGElement> & SVGRProps, "ref"> & React.RefAttributes<SVGSVGElement>>>;
|
|
11
|
+
export default Memo;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var _excluded = ["title", "titleId", "desc", "descId"];
|
|
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); }
|
|
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; }
|
|
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; }
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { forwardRef, memo } from 'react';
|
|
7
|
+
var CancelledCircleFill = function CancelledCircleFill(_ref, ref) {
|
|
8
|
+
var title = _ref.title,
|
|
9
|
+
titleId = _ref.titleId,
|
|
10
|
+
desc = _ref.desc,
|
|
11
|
+
descId = _ref.descId,
|
|
12
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
13
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
14
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
15
|
+
width: props.width || props.size || 16,
|
|
16
|
+
height: props.height || props.size || 16,
|
|
17
|
+
fill: "none",
|
|
18
|
+
viewBox: "0 0 20 20",
|
|
19
|
+
ref: ref,
|
|
20
|
+
"aria-labelledby": titleId,
|
|
21
|
+
"aria-describedby": descId
|
|
22
|
+
}, props), desc ? /*#__PURE__*/React.createElement("desc", {
|
|
23
|
+
id: descId
|
|
24
|
+
}, desc) : null, title ? /*#__PURE__*/React.createElement("title", {
|
|
25
|
+
id: titleId
|
|
26
|
+
}, title) : null, /*#__PURE__*/React.createElement("path", {
|
|
27
|
+
fill: "#6B7280",
|
|
28
|
+
fillRule: "evenodd",
|
|
29
|
+
d: "M1.667 10a8.333 8.333 0 1 1 16.666 0 8.333 8.333 0 0 1-16.666 0Zm5.976-.833a.833.833 0 1 0 0 1.666h4.714a.833.833 0 0 0 0-1.666H7.643Z",
|
|
30
|
+
clipRule: "evenodd"
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
var ForwardRef = /*#__PURE__*/forwardRef(CancelledCircleFill);
|
|
34
|
+
var Memo = /*#__PURE__*/memo(ForwardRef);
|
|
35
|
+
export default Memo;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SVGProps } from 'react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
interface SVGRProps {
|
|
4
|
+
size?: number | string;
|
|
5
|
+
title?: string;
|
|
6
|
+
titleId?: string;
|
|
7
|
+
desc?: string;
|
|
8
|
+
descId?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Memo: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<SVGProps<SVGSVGElement> & SVGRProps, "ref"> & React.RefAttributes<SVGSVGElement>>>;
|
|
11
|
+
export default Memo;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var _excluded = ["title", "titleId", "desc", "descId"];
|
|
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); }
|
|
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; }
|
|
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; }
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { forwardRef, memo } from 'react';
|
|
7
|
+
var InProgressFill = function InProgressFill(_ref, ref) {
|
|
8
|
+
var title = _ref.title,
|
|
9
|
+
titleId = _ref.titleId,
|
|
10
|
+
desc = _ref.desc,
|
|
11
|
+
descId = _ref.descId,
|
|
12
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
13
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
14
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
15
|
+
width: props.width || props.size || 16,
|
|
16
|
+
height: props.height || props.size || 16,
|
|
17
|
+
fill: "none",
|
|
18
|
+
viewBox: "0 0 20 20",
|
|
19
|
+
ref: ref,
|
|
20
|
+
"aria-labelledby": titleId,
|
|
21
|
+
"aria-describedby": descId
|
|
22
|
+
}, props), desc ? /*#__PURE__*/React.createElement("desc", {
|
|
23
|
+
id: descId
|
|
24
|
+
}, desc) : null, title ? /*#__PURE__*/React.createElement("title", {
|
|
25
|
+
id: titleId
|
|
26
|
+
}, title) : null, /*#__PURE__*/React.createElement("g", {
|
|
27
|
+
fill: "#2986F4"
|
|
28
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
29
|
+
d: "M15 10a5 5 0 0 1-5 5V5a5 5 0 0 1 5 5Z"
|
|
30
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
31
|
+
fillRule: "evenodd",
|
|
32
|
+
d: "M18.333 10a8.333 8.333 0 1 1-16.666 0 8.333 8.333 0 0 1 16.666 0Zm-1.666 0a6.667 6.667 0 1 1-13.334 0 6.667 6.667 0 0 1 13.334 0Z",
|
|
33
|
+
clipRule: "evenodd"
|
|
34
|
+
})));
|
|
35
|
+
};
|
|
36
|
+
var ForwardRef = /*#__PURE__*/forwardRef(InProgressFill);
|
|
37
|
+
var Memo = /*#__PURE__*/memo(ForwardRef);
|
|
38
|
+
export default Memo;
|
package/dist/Icon/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { default as AttentionCircleFill } from './components/AttentionCircleFill
|
|
|
6
6
|
export { default as AttentionTriangleFill } from './components/AttentionTriangleFill';
|
|
7
7
|
export { default as AttentionTriangleLightLine } from './components/AttentionTriangleLightLine';
|
|
8
8
|
export { default as CancelCircleDuotone } from './components/CancelCircleDuotone';
|
|
9
|
+
export { default as CancelledCircleFill } from './components/CancelledCircleFill';
|
|
9
10
|
export { default as CheckCircleDuotone } from './components/CheckCircleDuotone';
|
|
10
11
|
export { default as CheckCircleFill } from './components/CheckCircleFill';
|
|
11
12
|
export { default as CheckCircleLightLine } from './components/CheckCircleLightLine';
|
|
@@ -25,6 +26,7 @@ export { default as EyeOffLine } from './components/EyeOffLine';
|
|
|
25
26
|
export { default as EyeOnLine } from './components/EyeOnLine';
|
|
26
27
|
export { default as FoldDownFill } from './components/FoldDownFill';
|
|
27
28
|
export { default as FoldUpFill } from './components/FoldUpFill';
|
|
29
|
+
export { default as InProgressFill } from './components/InProgressFill';
|
|
28
30
|
export { default as InfoCircleDuotone } from './components/InfoCircleDuotone';
|
|
29
31
|
export { default as InfoCircleLine } from './components/InfoCircleLine';
|
|
30
32
|
export { default as InformationCircleFill } from './components/InformationCircleFill';
|
package/dist/Icon/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export { default as AttentionCircleFill } from "./components/AttentionCircleFill
|
|
|
6
6
|
export { default as AttentionTriangleFill } from "./components/AttentionTriangleFill";
|
|
7
7
|
export { default as AttentionTriangleLightLine } from "./components/AttentionTriangleLightLine";
|
|
8
8
|
export { default as CancelCircleDuotone } from "./components/CancelCircleDuotone";
|
|
9
|
+
export { default as CancelledCircleFill } from "./components/CancelledCircleFill";
|
|
9
10
|
export { default as CheckCircleDuotone } from "./components/CheckCircleDuotone";
|
|
10
11
|
export { default as CheckCircleFill } from "./components/CheckCircleFill";
|
|
11
12
|
export { default as CheckCircleLightLine } from "./components/CheckCircleLightLine";
|
|
@@ -25,6 +26,7 @@ export { default as EyeOffLine } from "./components/EyeOffLine";
|
|
|
25
26
|
export { default as EyeOnLine } from "./components/EyeOnLine";
|
|
26
27
|
export { default as FoldDownFill } from "./components/FoldDownFill";
|
|
27
28
|
export { default as FoldUpFill } from "./components/FoldUpFill";
|
|
29
|
+
export { default as InProgressFill } from "./components/InProgressFill";
|
|
28
30
|
export { default as InfoCircleDuotone } from "./components/InfoCircleDuotone";
|
|
29
31
|
export { default as InfoCircleLine } from "./components/InfoCircleLine";
|
|
30
32
|
export { default as InformationCircleFill } from "./components/InformationCircleFill";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g id=" Icon / Fill / Interface /Cancelled-Circle-fill">
|
|
3
|
+
<path id="Icon" fill-rule="evenodd" clip-rule="evenodd" d="M1.66675 9.9999C1.66675 5.39753 5.39771 1.66656 10.0001 1.66656C14.6025 1.66656 18.3334 5.39753 18.3334 9.9999C18.3334 14.6023 14.6025 18.3332 10.0001 18.3332C5.39771 18.3332 1.66675 14.6023 1.66675 9.9999ZM7.64295 9.16667C7.18271 9.16667 6.80961 9.53976 6.80961 10C6.80961 10.4602 7.18271 10.8333 7.64295 10.8333H12.357C12.8172 10.8333 13.1903 10.4602 13.1903 10C13.1903 9.53976 12.8172 9.16667 12.357 9.16667H7.64295Z" fill="#6B7280"/>
|
|
4
|
+
</g>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g id=" Icon / Fill / Interface / In-Progress-fill">
|
|
3
|
+
<g id="Icon">
|
|
4
|
+
<path d="M15.0001 10C15.0001 12.7614 12.7615 15 10.0001 15V5.00001C12.7615 5.00001 15.0001 7.23858 15.0001 10Z" fill="#2986F4"/>
|
|
5
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.3334 10C18.3334 14.6024 14.6025 18.3333 10.0001 18.3333C5.39771 18.3333 1.66675 14.6024 1.66675 10C1.66675 5.39763 5.39771 1.66667 10.0001 1.66667C14.6025 1.66667 18.3334 5.39763 18.3334 10ZM16.6667 10C16.6667 13.6819 13.682 16.6667 10.0001 16.6667C6.31818 16.6667 3.33341 13.6819 3.33341 10C3.33341 6.31811 6.31818 3.33334 10.0001 3.33334C13.682 3.33334 16.6667 6.31811 16.6667 10Z" fill="#2986F4"/>
|
|
6
|
+
</g>
|
|
7
|
+
</g>
|
|
8
|
+
</svg>
|
|
@@ -1,4 +1,10 @@
|
|
|
1
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
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
|
+
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); }
|
|
5
|
+
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; }
|
|
6
|
+
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; } }
|
|
7
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
2
8
|
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; }
|
|
3
9
|
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
10
|
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; }
|
|
@@ -6,7 +12,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
6
12
|
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
13
|
import classNames from 'classnames';
|
|
8
14
|
import _ from 'lodash';
|
|
9
|
-
import React, { useContext, useRef } from 'react';
|
|
15
|
+
import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
10
16
|
import { getUUID } from "../../../_utils/hooks/useId";
|
|
11
17
|
import { RadioGroupContext } from "../Group";
|
|
12
18
|
export default function Radio(props) {
|
|
@@ -14,15 +20,26 @@ export default function Radio(props) {
|
|
|
14
20
|
var labelRef = useRef(null);
|
|
15
21
|
var id = getUUID().toString();
|
|
16
22
|
var radioProps = _objectSpread({}, props);
|
|
23
|
+
var initChecked = useCallback(function () {
|
|
24
|
+
if (!_.isEmpty(groupContext)) {
|
|
25
|
+
return !props.disabled && groupContext.value === props.value;
|
|
26
|
+
} else {
|
|
27
|
+
return !('checked' in props) ? props.defaultChecked : radioProps.checked;
|
|
28
|
+
}
|
|
29
|
+
}, [groupContext, props, radioProps.checked]);
|
|
30
|
+
var _useState = useState(initChecked),
|
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
+
checked = _useState2[0],
|
|
33
|
+
setChecked = _useState2[1];
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
setChecked(initChecked);
|
|
36
|
+
}, [initChecked, groupContext.value, props.value, props.disabled]);
|
|
17
37
|
if (!_.isEmpty(groupContext)) {
|
|
18
38
|
radioProps.disabled = groupContext.disabled || props.disabled;
|
|
19
|
-
radioProps.checked = !props.disabled && groupContext.value === props.value;
|
|
20
|
-
} else {
|
|
21
|
-
radioProps.checked = !('checked' in props) ? props.defaultChecked : radioProps.checked;
|
|
22
39
|
}
|
|
23
40
|
// 设置input外层盒子的class
|
|
24
41
|
var aldRadioClass = classNames('ald-radio', {
|
|
25
|
-
'ald-radio-checked':
|
|
42
|
+
'ald-radio-checked': checked,
|
|
26
43
|
'ald-radio-disabled': radioProps.disabled
|
|
27
44
|
});
|
|
28
45
|
// 根据属性设置最外层的class
|
|
@@ -51,17 +68,25 @@ export default function Radio(props) {
|
|
|
51
68
|
} else {
|
|
52
69
|
// 当type未设置或者是radio时
|
|
53
70
|
otherClass = 'ald-radio-wrapper';
|
|
71
|
+
if (props.indeterminate) {
|
|
72
|
+
otherClass = otherClass + ' ald-radio-wrapper-indeterminate';
|
|
73
|
+
}
|
|
54
74
|
}
|
|
55
75
|
return classNames('ald-radio-label', otherClass, {
|
|
56
|
-
'ald-radio-wrapper-checked':
|
|
76
|
+
'ald-radio-wrapper-checked': checked,
|
|
57
77
|
'ald-radio-wrapper-disabled': radioProps.disabled
|
|
58
78
|
});
|
|
59
79
|
};
|
|
60
|
-
var onChange = function onChange() {
|
|
80
|
+
var onChange = function onChange(e) {
|
|
81
|
+
var _props$onChange;
|
|
61
82
|
if (groupContext !== null && groupContext !== void 0 && groupContext.onChange) {
|
|
62
83
|
// input事件的value会被toString,所以此处进行一个覆盖
|
|
63
84
|
groupContext.onChange(props.value);
|
|
64
85
|
}
|
|
86
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, e);
|
|
87
|
+
if (_.isEmpty(groupContext)) {
|
|
88
|
+
setChecked(e.target.checked);
|
|
89
|
+
}
|
|
65
90
|
};
|
|
66
91
|
return /*#__PURE__*/React.createElement("label", {
|
|
67
92
|
className: getWrapperClass(),
|
|
@@ -73,10 +98,21 @@ export default function Radio(props) {
|
|
|
73
98
|
id: id,
|
|
74
99
|
type: "radio",
|
|
75
100
|
className: "ald-radio-input",
|
|
76
|
-
|
|
101
|
+
defaultChecked: checked,
|
|
77
102
|
disabled: radioProps.disabled,
|
|
78
103
|
value: props.value,
|
|
79
|
-
onChange: onChange
|
|
104
|
+
onChange: onChange,
|
|
105
|
+
onClick: function onClick(e) {
|
|
106
|
+
var _props$onClick;
|
|
107
|
+
(_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props, e);
|
|
108
|
+
if (!_.isEmpty(groupContext)) {
|
|
109
|
+
if (groupContext !== null && groupContext !== void 0 && groupContext.onChange) {
|
|
110
|
+
// input事件的value会被toString,所以此处进行一个覆盖
|
|
111
|
+
groupContext.onChange(props.value);
|
|
112
|
+
}
|
|
113
|
+
setChecked(!checked);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
80
116
|
}), /*#__PURE__*/React.createElement("span", {
|
|
81
117
|
className: "ald-radio-inner"
|
|
82
118
|
})), /*#__PURE__*/React.createElement("span", {
|
|
@@ -79,8 +79,9 @@
|
|
|
79
79
|
user-select: none;
|
|
80
80
|
white-space: nowrap;
|
|
81
81
|
}
|
|
82
|
+
|
|
82
83
|
// 绘制选中时的圆圈样式
|
|
83
|
-
.ald-radio-checked > .ald-radio-inner {
|
|
84
|
+
:not(.ald-radio-wrapper-indeterminate) > .ald-radio-checked > .ald-radio-inner {
|
|
84
85
|
background-color: var(--alias-colors-bg-selected-strong-default, #126fdd);
|
|
85
86
|
border: 0;
|
|
86
87
|
transform: background 0.5s ease;
|
|
@@ -105,10 +106,39 @@
|
|
|
105
106
|
background-color: var(--alias-colors-bg-selected-strong-press, #0b4385);
|
|
106
107
|
}
|
|
107
108
|
}
|
|
109
|
+
// 半选的样式
|
|
110
|
+
.ald-radio-wrapper-indeterminate > .ald-radio > .ald-radio-inner[class] {
|
|
111
|
+
background-color: var(--alias-colors-bg-selected-strong-default, #126fdd);
|
|
112
|
+
border: 0;
|
|
113
|
+
transform: background 0.5s ease;
|
|
114
|
+
|
|
115
|
+
&::after {
|
|
116
|
+
position: absolute;
|
|
117
|
+
top: 50%;
|
|
118
|
+
left: 50%;
|
|
119
|
+
width: 8.5px;
|
|
120
|
+
height: 2px;
|
|
121
|
+
background-color: var(--alias-colors-icon-inverse-default, #fff);
|
|
122
|
+
border-radius: 2px;
|
|
123
|
+
transform: translate(-50%, -50%);
|
|
124
|
+
content: '';
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&:hover {
|
|
128
|
+
background-color: var(--alias-colors-bg-selected-strong-hover, #0f59b1);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&:active {
|
|
132
|
+
background-color: var(--alias-colors-bg-selected-strong-press, #0b4385);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
108
135
|
|
|
109
136
|
// 禁用状态下的样式
|
|
110
137
|
.ald-radio-disabled > .ald-radio-inner {
|
|
111
|
-
background-color: var(
|
|
138
|
+
background-color: var(
|
|
139
|
+
--alias-colors-bg-disabled,
|
|
140
|
+
rgba(0, 0, 0, 0.05)
|
|
141
|
+
) !important;
|
|
112
142
|
border: 1px solid var(--alias-colors-border-disabled, rgba(0, 0, 0, 0.1));
|
|
113
143
|
|
|
114
144
|
&::after {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { LoadingDuotone } from "../../Icon";
|
|
4
|
+
import { getUUID } from "../../_utils/hooks/useId";
|
|
4
5
|
var Icon = function Icon(props) {
|
|
5
6
|
var size = props.size,
|
|
6
7
|
tip = props.tip,
|
|
@@ -10,7 +11,9 @@ var Icon = function Icon(props) {
|
|
|
10
11
|
className = props.className,
|
|
11
12
|
inContainer = props.inContainer;
|
|
12
13
|
if (!spinning) return null;
|
|
13
|
-
return /*#__PURE__*/React.createElement(React.Fragment,
|
|
14
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
15
|
+
key: getUUID().toString()
|
|
16
|
+
}, inContainer && /*#__PURE__*/React.createElement("div", {
|
|
14
17
|
className: "spinner-mask"
|
|
15
18
|
}), /*#__PURE__*/React.createElement("div", {
|
|
16
19
|
className: classNames('spinner', className, {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface IProps {
|
|
3
|
+
size?: 'middle' | 'small';
|
|
4
|
+
style?: 'dot' | 'icon';
|
|
5
|
+
dotColor?: string;
|
|
6
|
+
icon?: React.ReactNode;
|
|
7
|
+
text: string;
|
|
8
|
+
status?: 'info' | 'neutral' | 'danger' | 'success' | 'warning';
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
declare function StatusLight({ size, style, dotColor, icon, text, status, className, }: IProps): React.JSX.Element;
|
|
12
|
+
export default StatusLight;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AttentionCircleFill, CancelledCircleFill, CheckCircleFill, CloseCircleFill, InProgressFill } from "../Icon";
|
|
4
|
+
function StatusLight(_ref) {
|
|
5
|
+
var _ref$size = _ref.size,
|
|
6
|
+
size = _ref$size === void 0 ? 'middle' : _ref$size,
|
|
7
|
+
_ref$style = _ref.style,
|
|
8
|
+
style = _ref$style === void 0 ? 'dot' : _ref$style,
|
|
9
|
+
dotColor = _ref.dotColor,
|
|
10
|
+
icon = _ref.icon,
|
|
11
|
+
text = _ref.text,
|
|
12
|
+
_ref$status = _ref.status,
|
|
13
|
+
status = _ref$status === void 0 ? 'info' : _ref$status,
|
|
14
|
+
className = _ref.className;
|
|
15
|
+
var getIcon = function getIcon() {
|
|
16
|
+
if (icon) return icon;
|
|
17
|
+
var iconSize = size === 'middle' ? 20 : 16;
|
|
18
|
+
switch (status) {
|
|
19
|
+
case 'info':
|
|
20
|
+
return /*#__PURE__*/React.createElement(InProgressFill, {
|
|
21
|
+
color: "#2986F4",
|
|
22
|
+
size: iconSize
|
|
23
|
+
});
|
|
24
|
+
case 'neutral':
|
|
25
|
+
return /*#__PURE__*/React.createElement(CancelledCircleFill, {
|
|
26
|
+
color: "#6B7280",
|
|
27
|
+
size: iconSize
|
|
28
|
+
});
|
|
29
|
+
case 'danger':
|
|
30
|
+
return /*#__PURE__*/React.createElement(CloseCircleFill, {
|
|
31
|
+
color: "#EF4444",
|
|
32
|
+
size: iconSize
|
|
33
|
+
});
|
|
34
|
+
case 'success':
|
|
35
|
+
return /*#__PURE__*/React.createElement(CheckCircleFill, {
|
|
36
|
+
color: "#22C55E",
|
|
37
|
+
size: iconSize
|
|
38
|
+
});
|
|
39
|
+
case 'warning':
|
|
40
|
+
return /*#__PURE__*/React.createElement(AttentionCircleFill, {
|
|
41
|
+
color: "#EAB308",
|
|
42
|
+
size: iconSize
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
var getDotColor = function getDotColor() {
|
|
47
|
+
if (dotColor) return dotColor;
|
|
48
|
+
switch (status) {
|
|
49
|
+
case 'info':
|
|
50
|
+
return '#2986F4';
|
|
51
|
+
case 'neutral':
|
|
52
|
+
return '#6B7280';
|
|
53
|
+
case 'danger':
|
|
54
|
+
return '#EF4444';
|
|
55
|
+
case 'success':
|
|
56
|
+
return '#22C55E';
|
|
57
|
+
case 'warning':
|
|
58
|
+
return '#EAB308';
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
className: classNames('ald-status-light', "ald-status-light-".concat(size), className)
|
|
63
|
+
}, style === 'dot' && /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: "ald-prefix-dot",
|
|
65
|
+
style: {
|
|
66
|
+
backgroundColor: getDotColor()
|
|
67
|
+
}
|
|
68
|
+
}), style === 'icon' && /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
className: "ald-prefix-icon"
|
|
70
|
+
}, getIcon()), /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
className: "ald-text"
|
|
72
|
+
}, text));
|
|
73
|
+
}
|
|
74
|
+
export default StatusLight;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@import '../../style/index.less';
|
|
2
|
+
|
|
3
|
+
.ald-status-light {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: flex-start;
|
|
7
|
+
|
|
8
|
+
.ald-prefix-icon {
|
|
9
|
+
height: 100%;
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.ald-status-light-small {
|
|
16
|
+
gap: 4px;
|
|
17
|
+
|
|
18
|
+
.ald-prefix-dot {
|
|
19
|
+
width: var(--global-grid-75, 6px);
|
|
20
|
+
height: var(--global-grid-75, 6px);
|
|
21
|
+
border-radius: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.ald-text {
|
|
25
|
+
color: var(--alias-colors-text-default, #1f2937);
|
|
26
|
+
font-size: 12px;
|
|
27
|
+
font-weight: 400;
|
|
28
|
+
line-height: 16px; /* 133.333% */
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ald-status-light-middle {
|
|
33
|
+
gap: 6px;
|
|
34
|
+
|
|
35
|
+
.ald-prefix-dot {
|
|
36
|
+
width: var(--global-grid-100, 8px);
|
|
37
|
+
height: var(--global-grid-100, 8px);
|
|
38
|
+
border-radius: 100%;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ald-text {
|
|
42
|
+
color: var(--alias-colors-text-default, #1f2937);
|
|
43
|
+
font-size: 14px;
|
|
44
|
+
font-weight: 400;
|
|
45
|
+
line-height: 20px; /* 142.857% */
|
|
46
|
+
}
|
|
47
|
+
}
|