jrs-react 1.1.8 → 1.1.9
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/build/index.es.js +41415 -268
- package/build/index.js +41415 -268
- package/package.json +3 -3
- package/src/components/JRSubmit.jsx +3 -3
- package/src/components/Message.jsx +89 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jrs-react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"module": "build/index.es.js",
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"storybook": "storybook dev -p 6006",
|
|
11
11
|
"build-storybook": "storybook build"
|
|
12
12
|
},
|
|
13
|
-
"author": "",
|
|
13
|
+
"author": "JorenLai",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@rollup/plugin-commonjs": "^28.0.3",
|
|
17
17
|
"@rollup/plugin-json": "^6.1.0",
|
|
18
|
-
"antd": "^5.
|
|
18
|
+
"antd": "^5.12.5",
|
|
19
19
|
"axios": "^1.6.2",
|
|
20
20
|
"react": "^18.2.0",
|
|
21
21
|
"react-dom": "^18.2.0",
|
|
@@ -2,7 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import axios from 'axios'
|
|
3
3
|
import { colonValueString, flexType, po } from './JRUtils'
|
|
4
4
|
import { displaySpinner } from './LoadingBar'
|
|
5
|
-
|
|
5
|
+
import msg from './Message'
|
|
6
6
|
import styled from 'styled-components'
|
|
7
7
|
|
|
8
8
|
|
|
@@ -274,11 +274,11 @@ export default class JRSubmit extends React.Component {
|
|
|
274
274
|
this.setRes(isSuccess,response,config)
|
|
275
275
|
if (isSuccess) {
|
|
276
276
|
if (config.successMessage) {
|
|
277
|
-
|
|
277
|
+
msg.success({ message:config.successMessage })
|
|
278
278
|
}
|
|
279
279
|
} else {
|
|
280
280
|
if (config.failedMessage) {
|
|
281
|
-
|
|
281
|
+
msg.error({ message:config.failedMessage })
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
config.callback?.bind(this)(isSuccess,response,payload)
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { message } from "antd";
|
|
2
|
+
import { CloseOutlined } from "@ant-design/icons";
|
|
3
|
+
|
|
4
|
+
message.config({ duration: 3 });
|
|
5
|
+
|
|
6
|
+
const info = (props) => {
|
|
7
|
+
const key = Date.now();
|
|
8
|
+
message.info({
|
|
9
|
+
content: (
|
|
10
|
+
<>
|
|
11
|
+
<div className="message">{props.message}</div>
|
|
12
|
+
<CloseOutlined
|
|
13
|
+
onClick={() => {
|
|
14
|
+
message.destroy(key);
|
|
15
|
+
}}
|
|
16
|
+
/>
|
|
17
|
+
</>
|
|
18
|
+
),
|
|
19
|
+
className: "info",
|
|
20
|
+
key,
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const success = (props) => {
|
|
26
|
+
const key = Date.now();
|
|
27
|
+
message.success({
|
|
28
|
+
content: (
|
|
29
|
+
<>
|
|
30
|
+
<div className="message">{props.message}</div>
|
|
31
|
+
<CloseOutlined
|
|
32
|
+
onClick={() => {
|
|
33
|
+
message.destroy(key);
|
|
34
|
+
}}
|
|
35
|
+
/>
|
|
36
|
+
</>
|
|
37
|
+
),
|
|
38
|
+
className: "success",
|
|
39
|
+
key,
|
|
40
|
+
...props
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const warning = (props) => {
|
|
45
|
+
const key = Date.now();
|
|
46
|
+
message.warning({
|
|
47
|
+
content: (
|
|
48
|
+
<>
|
|
49
|
+
<div className="message">{props.message}</div>
|
|
50
|
+
<CloseOutlined
|
|
51
|
+
onClick={() => {
|
|
52
|
+
message.destroy(key);
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
</>
|
|
56
|
+
),
|
|
57
|
+
className: "warning",
|
|
58
|
+
key,
|
|
59
|
+
...props
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const error = (props) => {
|
|
64
|
+
const key = Date.now();
|
|
65
|
+
message.error({
|
|
66
|
+
content: (
|
|
67
|
+
<>
|
|
68
|
+
<div className="message">{props.message}</div>
|
|
69
|
+
<CloseOutlined
|
|
70
|
+
onClick={() => {
|
|
71
|
+
message.destroy(key);
|
|
72
|
+
}}
|
|
73
|
+
/>
|
|
74
|
+
</>
|
|
75
|
+
),
|
|
76
|
+
className: "error",
|
|
77
|
+
key,
|
|
78
|
+
...props
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const msg = {
|
|
83
|
+
info,
|
|
84
|
+
success,
|
|
85
|
+
warning,
|
|
86
|
+
error
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export default msg;
|