@chaoswise/ui 2.6.1 → 2.6.3
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/lib/BasicLayout/index.js +0 -1
- package/lib/CWMessage/index.js +1 -1
- package/lib/ErrorBoundary/ErrorPage.js +44 -0
- package/lib/ErrorBoundary/index.js +2 -20
- package/lib/ErrorBoundary/locale/en_US.js +5 -0
- package/lib/ErrorBoundary/locale/index.js +11 -0
- package/lib/ErrorBoundary/locale/zh_CN.js +5 -0
- package/lib/ErrorBoundary/locale/zh_TW.js +5 -0
- package/package.json +3 -2
- package/lib/ErrorBoundary/index.less +0 -15
package/lib/BasicLayout/index.js
CHANGED
package/lib/CWMessage/index.js
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import _useLocale2 from "@chaoswise/ui/lib/useLocale";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import NoPage from "./assets/images/No-data.png";
|
|
4
|
+
import { formatMessage } from "../utils";
|
|
5
|
+
import langConfig from "./locale";
|
|
6
|
+
var ErrorPage = function ErrorPage() {
|
|
7
|
+
var _useLocale = _useLocale2(langConfig),
|
|
8
|
+
localeObj = _useLocale.langObj,
|
|
9
|
+
_useLocale$locale = _useLocale.locale,
|
|
10
|
+
locale = _useLocale$locale === void 0 ? "zh_CN" : _useLocale$locale;
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
className: "errorBox",
|
|
13
|
+
style: {
|
|
14
|
+
width: "100%",
|
|
15
|
+
height: "100%",
|
|
16
|
+
display: "flex",
|
|
17
|
+
justifyContent: "center",
|
|
18
|
+
flexDirection: "column",
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
fontSize: "16px",
|
|
21
|
+
color: "#333",
|
|
22
|
+
fontWeight: "bold"
|
|
23
|
+
}
|
|
24
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
25
|
+
src: NoPage,
|
|
26
|
+
alt: "",
|
|
27
|
+
style: {
|
|
28
|
+
maxWidth: 200,
|
|
29
|
+
maxHeight: 200
|
|
30
|
+
}
|
|
31
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
32
|
+
style: {
|
|
33
|
+
display: "flex"
|
|
34
|
+
}
|
|
35
|
+
}, formatMessage(localeObj["thePageIsMissing"]), /*#__PURE__*/React.createElement("a", {
|
|
36
|
+
onClick: function onClick() {
|
|
37
|
+
window.location.reload();
|
|
38
|
+
},
|
|
39
|
+
style: {
|
|
40
|
+
margin: locale === "en_US" ? "0 3px" : 0
|
|
41
|
+
}
|
|
42
|
+
}, formatMessage(localeObj["refresh"])), formatMessage(localeObj["retry"])));
|
|
43
|
+
};
|
|
44
|
+
export default ErrorPage;
|
|
@@ -13,9 +13,8 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
13
13
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
14
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
15
|
import React from 'react';
|
|
16
|
-
import NoPage from './assets/images/No-data.png';
|
|
17
16
|
import './history';
|
|
18
|
-
import './
|
|
17
|
+
import ErrorPage from './ErrorPage';
|
|
19
18
|
var ErrorBoundary = /*#__PURE__*/function (_React$PureComponent) {
|
|
20
19
|
function ErrorBoundary(props) {
|
|
21
20
|
var _this;
|
|
@@ -82,24 +81,7 @@ var ErrorBoundary = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
82
81
|
key: "render",
|
|
83
82
|
value: function render() {
|
|
84
83
|
if (this.state.hasError) {
|
|
85
|
-
return /*#__PURE__*/React.createElement(
|
|
86
|
-
className: "errorBox"
|
|
87
|
-
}, /*#__PURE__*/React.createElement("img", {
|
|
88
|
-
src: NoPage,
|
|
89
|
-
alt: "",
|
|
90
|
-
style: {
|
|
91
|
-
maxWidth: 200,
|
|
92
|
-
maxHeight: 200
|
|
93
|
-
}
|
|
94
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
95
|
-
style: {
|
|
96
|
-
display: 'flex'
|
|
97
|
-
}
|
|
98
|
-
}, "\u54CE\u5440\uFF0C\u9875\u9762\u8D70\u4E22\u4E86\uFF0C\u8BF7", /*#__PURE__*/React.createElement("a", {
|
|
99
|
-
onClick: function onClick() {
|
|
100
|
-
window.location.reload();
|
|
101
|
-
}
|
|
102
|
-
}, "\u5237\u65B0"), "\u91CD\u8BD5"));
|
|
84
|
+
return /*#__PURE__*/React.createElement(ErrorPage, null);
|
|
103
85
|
}
|
|
104
86
|
return this.props.children;
|
|
105
87
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chaoswise/ui",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.3",
|
|
4
4
|
"description": "公共UI库",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui",
|
|
@@ -147,5 +147,6 @@
|
|
|
147
147
|
"publishConfig": {
|
|
148
148
|
"access": "public"
|
|
149
149
|
},
|
|
150
|
-
"license": "MIT"
|
|
150
|
+
"license": "MIT",
|
|
151
|
+
"gitHead": "1ee91e903831067fe007771a07bf5d8ca54ccdd1"
|
|
151
152
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
.errorBox {
|
|
2
|
-
height: 100%;
|
|
3
|
-
width: 100%;
|
|
4
|
-
display: flex;
|
|
5
|
-
display: -ms-flex;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
-ms-flex-direction: column;
|
|
8
|
-
justify-content: center;
|
|
9
|
-
-webkit-justify-content: center;
|
|
10
|
-
align-items: center;
|
|
11
|
-
-webkit-align-items: center;
|
|
12
|
-
font-size: 16px;
|
|
13
|
-
color: #333;
|
|
14
|
-
font-weight: bold;
|
|
15
|
-
}
|