@lemon-fe/components 1.6.0 → 1.6.1

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.
@@ -7,8 +7,10 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import { ConfigProvider, Typography } from 'antd';
8
8
  import React, { useContext } from 'react';
9
9
  import { useLocaleReceiver } from "../locale-receiver";
10
+ import { prefixClassName } from "../utils";
10
11
  import { CheckOutlined, CopyOutlined } from '@ant-design/icons';
11
12
  import { isRequestError } from '@lemon-fe/utils';
13
+ var prefix = prefixClassName('error-message');
12
14
  export default function ErrorMessage(props) {
13
15
  var err = props.error;
14
16
  var _useLocaleReceiver = useLocaleReceiver('RequestErrorMessage'),
@@ -17,9 +19,11 @@ export default function ErrorMessage(props) {
17
19
  var _useContext = useContext(ConfigProvider.ConfigContext),
18
20
  getPrefixCls = _useContext.getPrefixCls;
19
21
  var prefixCls = getPrefixCls();
22
+ var traceID;
23
+ var errorCode;
20
24
  if (isRequestError(err)) {
21
- var traceID = err.request.otlpTraceID;
22
- var errorCode = /*#__PURE__*/React.createElement(Typography.Text, {
25
+ traceID = err.request.otlpTraceID;
26
+ errorCode = /*#__PURE__*/React.createElement(Typography.Text, {
23
27
  style: {
24
28
  color: 'rgba(51, 51, 51, 0.7)'
25
29
  },
@@ -39,7 +43,8 @@ export default function ErrorMessage(props) {
39
43
  })]
40
44
  }
41
45
  }, "".concat(locale.errorCode, ": ").concat(traceID || ''));
42
- return /*#__PURE__*/React.createElement(React.Fragment, null, traceID ? /*#__PURE__*/React.createElement("span", null, err.message, /*#__PURE__*/React.createElement("br", null), errorCode) : err.message);
43
46
  }
44
- return /*#__PURE__*/React.createElement(React.Fragment, null, err.message);
47
+ return /*#__PURE__*/React.createElement("span", {
48
+ className: prefix('container')
49
+ }, traceID ? /*#__PURE__*/React.createElement("span", null, err.message, /*#__PURE__*/React.createElement("br", null), errorCode) : err.message);
45
50
  }
@@ -0,0 +1,5 @@
1
+ .@{prefixCls}-error-message {
2
+ &-container {
3
+ white-space: pre-wrap;
4
+ }
5
+ }
@@ -27,3 +27,4 @@
27
27
  @import '../input-compact/index.less';
28
28
  @import '../select-panel/index.less';
29
29
  @import '../modal/index.less';
30
+ @import '../request-error-message/index.less';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "registry": "https://registry.npmjs.org"
60
60
  },
61
- "gitHead": "a3a98d934b427f2ed25bf991a5b0e6e0319beb45"
61
+ "gitHead": "98bd762090b853c65c146bd1fc955fdccd4fa4af"
62
62
  }