@ecoding/components.antd 0.1.22 → 0.1.26
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.
|
@@ -19,9 +19,9 @@ const AsyncSlect = memo((props) => {
|
|
|
19
19
|
const r = http.getRequest();
|
|
20
20
|
const [loading, setLoading] = useState(true);
|
|
21
21
|
const [options, setOptions] = useState([]);
|
|
22
|
-
const iface = useMemo(() => props.iface, []);
|
|
23
|
-
const data = useMemo(() => props.data, []);
|
|
24
|
-
const searchIface = useMemo(() => props.searchIface, []);
|
|
22
|
+
const iface = useMemo(() => props.iface, [props]);
|
|
23
|
+
const data = useMemo(() => props.data, [props]);
|
|
24
|
+
const searchIface = useMemo(() => props.searchIface, [props]);
|
|
25
25
|
useEffect(() => {
|
|
26
26
|
const ex = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
27
|
const innerEx = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -70,7 +70,7 @@ const AsyncSlect = memo((props) => {
|
|
|
70
70
|
setLoading(false);
|
|
71
71
|
});
|
|
72
72
|
ex();
|
|
73
|
-
}, [data]);
|
|
73
|
+
}, [data, iface, searchIface]);
|
|
74
74
|
const handleSearch = (newValue) => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
75
|
if (!newValue) {
|
|
76
76
|
return null;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
interface IToastFCProps {
|
|
2
|
+
id?: string;
|
|
3
|
+
key?: string;
|
|
2
4
|
mask?: boolean;
|
|
3
5
|
title?: string;
|
|
4
6
|
maskTheme?: string;
|
|
5
7
|
duration?: number;
|
|
6
8
|
auto?: boolean;
|
|
7
|
-
type?:
|
|
9
|
+
type?: "error" | "warning" | "info" | "success";
|
|
8
10
|
}
|
|
9
11
|
declare const _default: {
|
|
10
12
|
info(props?: IToastFCProps): void;
|
package/lib/core/toast/index.js
CHANGED
|
@@ -1,36 +1,35 @@
|
|
|
1
|
-
import React, { useEffect } from
|
|
2
|
-
import { Alert } from
|
|
3
|
-
import
|
|
4
|
-
const notification = Notification.newInstance();
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { Alert } from "antd";
|
|
3
|
+
import InjectNotification from "../inject-notification";
|
|
5
4
|
var EaskTheme;
|
|
6
5
|
(function (EaskTheme) {
|
|
7
6
|
EaskTheme["dark"] = "#333";
|
|
8
7
|
EaskTheme["light"] = "#fff";
|
|
9
8
|
})(EaskTheme || (EaskTheme = {}));
|
|
10
9
|
const typeMap = {
|
|
11
|
-
error:
|
|
12
|
-
warning:
|
|
13
|
-
info:
|
|
14
|
-
success:
|
|
10
|
+
error: "错误",
|
|
11
|
+
warning: "警告",
|
|
12
|
+
info: "提示",
|
|
13
|
+
success: "成功"
|
|
15
14
|
};
|
|
16
15
|
const ToastFC = (props) => {
|
|
17
16
|
const maskStyle = {
|
|
18
|
-
position:
|
|
17
|
+
position: "fixed",
|
|
19
18
|
top: 0,
|
|
20
19
|
right: 0,
|
|
21
20
|
bottom: 0,
|
|
22
21
|
left: 0,
|
|
23
22
|
zIndex: 9000,
|
|
24
|
-
height:
|
|
23
|
+
height: "100%",
|
|
25
24
|
opacity: 0.45
|
|
26
25
|
};
|
|
27
26
|
const alertStyle = {
|
|
28
|
-
position:
|
|
29
|
-
top:
|
|
30
|
-
left:
|
|
27
|
+
position: "fixed",
|
|
28
|
+
top: "50%",
|
|
29
|
+
left: "50%",
|
|
31
30
|
maxWidth: 340,
|
|
32
31
|
zIndex: 9001,
|
|
33
|
-
transform:
|
|
32
|
+
transform: "translate(-50%, -70%)"
|
|
34
33
|
};
|
|
35
34
|
useEffect(() => {
|
|
36
35
|
if (props.duration === 0) {
|
|
@@ -38,7 +37,7 @@ const ToastFC = (props) => {
|
|
|
38
37
|
}
|
|
39
38
|
const timeout = setTimeout(() => {
|
|
40
39
|
if (props.auto) {
|
|
41
|
-
|
|
40
|
+
InjectNotification.removeNotice(props.id);
|
|
42
41
|
}
|
|
43
42
|
}, props.duration);
|
|
44
43
|
return () => {
|
|
@@ -46,37 +45,33 @@ const ToastFC = (props) => {
|
|
|
46
45
|
};
|
|
47
46
|
}, []);
|
|
48
47
|
return (React.createElement(React.Fragment, null,
|
|
49
|
-
props.mask ? React.createElement("div", { style: Object.assign(maskStyle, { backgroundColor: props.maskTheme ===
|
|
48
|
+
props.mask ? (React.createElement("div", { style: Object.assign(maskStyle, { backgroundColor: props.maskTheme === "light" ? EaskTheme.light : EaskTheme.dark }) })) : null,
|
|
50
49
|
React.createElement("div", { style: alertStyle },
|
|
51
|
-
React.createElement(Alert, { description: props.title, message: typeMap[props.type], type: props.type, showIcon: true, closable: true, onClose: () =>
|
|
50
|
+
React.createElement(Alert, { description: props.title, message: typeMap[props.type], type: props.type, showIcon: true, closable: true, onClose: () => InjectNotification.removeNotice(props.id) }))));
|
|
52
51
|
};
|
|
53
52
|
ToastFC.defaultProps = {
|
|
54
53
|
mask: false,
|
|
55
|
-
title:
|
|
56
|
-
maskTheme:
|
|
54
|
+
title: "提示",
|
|
55
|
+
maskTheme: "light",
|
|
57
56
|
duration: 2000,
|
|
58
57
|
auto: true,
|
|
59
|
-
type:
|
|
58
|
+
type: "success"
|
|
60
59
|
};
|
|
61
60
|
const show = (props = {}) => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
setTimeout(() => {
|
|
66
|
-
notification.notice(React.createElement(ToastFC, Object.assign({}, props, { key: "toast" })));
|
|
67
|
-
}, 1);
|
|
61
|
+
props.id = props.id || props.key || "modals";
|
|
62
|
+
InjectNotification.notice(React.createElement(ToastFC, Object.assign({}, props, { key: props.id })));
|
|
68
63
|
};
|
|
69
64
|
export default {
|
|
70
65
|
info(props = {}) {
|
|
71
|
-
return show(Object.assign(Object.assign({}, props), { type:
|
|
66
|
+
return show(Object.assign(Object.assign({}, props), { type: "info" }));
|
|
72
67
|
},
|
|
73
68
|
success(props = {}) {
|
|
74
|
-
return show(Object.assign(Object.assign({}, props), { type:
|
|
69
|
+
return show(Object.assign(Object.assign({}, props), { type: "success" }));
|
|
75
70
|
},
|
|
76
71
|
warning(props = {}) {
|
|
77
|
-
return show(Object.assign(Object.assign({}, props), { type:
|
|
72
|
+
return show(Object.assign(Object.assign({}, props), { type: "warning" }));
|
|
78
73
|
},
|
|
79
74
|
error(props = {}) {
|
|
80
|
-
return show(Object.assign(Object.assign({}, props), { type:
|
|
81
|
-
}
|
|
75
|
+
return show(Object.assign(Object.assign({}, props), { type: "error" }));
|
|
76
|
+
}
|
|
82
77
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecoding/components.antd",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.26",
|
|
4
4
|
"author": "cxc",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"@ecoding/helper.json": ">=0.0.5",
|
|
30
30
|
"@ecoding/helper.request.hook": ">=0.0.6",
|
|
31
31
|
"@ecoding/helper.url": ">=0.0.5",
|
|
32
|
+
"antd": "5.0.0",
|
|
32
33
|
"axios": ">=1.1.2"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
@@ -42,5 +43,5 @@
|
|
|
42
43
|
"dependencies": {
|
|
43
44
|
"react-quill": "^2.0.0"
|
|
44
45
|
},
|
|
45
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "73c595e4e6d8ea7c79a12ac8f9530655f3737a50"
|
|
46
47
|
}
|