@lingxiteam/assets 3.2.1 → 3.3.1-alpha.2
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/es/error/errorDisplay/Mobile/Drawer/Drawer.js +9 -3
- package/es/error/errorDisplay/Mobile/ErrorMsg/index.js +29 -26
- package/es/error/errorDisplay/Mobile/Modal/Modal.js +5 -3
- package/es/error/errorDisplay/Mobile/defaultGlobalConfig.js +9 -1
- package/es/error/errorDisplay/Web/Drawer/Drawer.js +10 -4
- package/es/error/errorDisplay/Web/ErrorMsg/index.js +64 -46
- package/es/error/errorDisplay/Web/defaultGlobalConfig.js +10 -2
- package/es/error/errorDisplay/const.js +29 -7
- package/es/rootConfig/mobile/MobileModal.d.ts +33 -0
- package/es/rootConfig/mobile/MobileModal.js +49 -4
- package/es/rootConfig/mobile/MobilePopover.d.ts +3 -0
- package/es/rootConfig/mobile/MobilePopover.js +4 -1
- package/es/rootConfig/mobile/page.d.ts +13 -0
- package/es/rootConfig/mobile/page.js +15 -2
- package/es/rootConfig/pc/Drawer.d.ts +9 -0
- package/es/rootConfig/pc/Drawer.js +10 -1
- package/es/rootConfig/pc/Modal.d.ts +3 -0
- package/es/rootConfig/pc/Modal.js +4 -1
- package/es/rootConfig/pc/Popover.d.ts +3 -0
- package/es/rootConfig/pc/Popover.js +4 -1
- package/es/rootConfig/pc/page.d.ts +3 -18
- package/es/rootConfig/pc/page.js +4 -14
- package/es/rootConfig/todoActionList.d.ts +408 -65
- package/es/rootConfig/todoActionList.js +517 -118
- package/es/rootConfig/todoOptionList.d.ts +13 -2
- package/es/rootConfig/todoOptionList.js +16 -7
- package/es/security/encipher/sign.js +4 -3
- package/es/security/fetch.js +7 -0
- package/es/theme/bin/default/theme.js +1 -1
- package/es/theme/bin/default/theme.less +1 -1
- package/es/theme/bin/default/theme.scss +1 -1
- package/es/theme/index.js +54 -0
- package/es/theme/src/default/index.js +1 -1
- package/es/utils/url.d.ts +1 -0
- package/es/utils/url.js +5 -0
- package/lib/error/errorDisplay/Mobile/Drawer/Drawer.js +9 -3
- package/lib/error/errorDisplay/Mobile/ErrorMsg/index.js +29 -26
- package/lib/error/errorDisplay/Mobile/Modal/Modal.js +5 -3
- package/lib/error/errorDisplay/Mobile/defaultGlobalConfig.js +9 -1
- package/lib/error/errorDisplay/Web/Drawer/Drawer.js +10 -4
- package/lib/error/errorDisplay/Web/ErrorMsg/index.js +64 -46
- package/lib/error/errorDisplay/Web/defaultGlobalConfig.js +10 -1
- package/lib/error/errorDisplay/const.js +33 -9
- package/lib/rootConfig/mobile/MobileModal.d.ts +33 -0
- package/lib/rootConfig/mobile/MobileModal.js +49 -4
- package/lib/rootConfig/mobile/MobilePopover.d.ts +3 -0
- package/lib/rootConfig/mobile/MobilePopover.js +4 -1
- package/lib/rootConfig/mobile/page.d.ts +13 -0
- package/lib/rootConfig/mobile/page.js +15 -2
- package/lib/rootConfig/pc/Drawer.d.ts +9 -0
- package/lib/rootConfig/pc/Drawer.js +10 -1
- package/lib/rootConfig/pc/Modal.d.ts +3 -0
- package/lib/rootConfig/pc/Modal.js +4 -1
- package/lib/rootConfig/pc/Popover.d.ts +3 -0
- package/lib/rootConfig/pc/Popover.js +4 -1
- package/lib/rootConfig/pc/page.d.ts +3 -18
- package/lib/rootConfig/pc/page.js +4 -14
- package/lib/rootConfig/todoActionList.d.ts +408 -65
- package/lib/rootConfig/todoActionList.js +517 -118
- package/lib/rootConfig/todoOptionList.d.ts +13 -2
- package/lib/rootConfig/todoOptionList.js +16 -7
- package/lib/security/encipher/sign.js +3 -2
- package/lib/security/fetch.js +7 -0
- package/lib/theme/bin/default/theme.js +1 -1
- package/lib/theme/bin/default/theme.less +1 -1
- package/lib/theme/bin/default/theme.scss +1 -1
- package/lib/theme/index.js +61 -0
- package/lib/theme/src/default/index.js +1 -1
- package/lib/utils/url.d.ts +1 -0
- package/lib/utils/url.js +7 -1
- package/package.json +4 -3
|
@@ -17,7 +17,8 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
17
17
|
onCancel = props.onCancel,
|
|
18
18
|
onClickRecord = props.onClickRecord,
|
|
19
19
|
_props$mode = props.mode,
|
|
20
|
-
mode = _props$mode === void 0 ? 'content' : _props$mode
|
|
20
|
+
mode = _props$mode === void 0 ? 'content' : _props$mode,
|
|
21
|
+
getLocale = props.getLocale;
|
|
21
22
|
var renderItems = function renderItems() {
|
|
22
23
|
if (Array.isArray(dataSource) && dataSource.length > 0) {
|
|
23
24
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -42,7 +43,7 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
42
43
|
}
|
|
43
44
|
return /*#__PURE__*/React.createElement("div", {
|
|
44
45
|
className: "lxm-drawer-empty"
|
|
45
|
-
},
|
|
46
|
+
}, getLocale('noData', '暂无数据'));
|
|
46
47
|
};
|
|
47
48
|
var renderContent = function renderContent() {
|
|
48
49
|
if (dataSource && ((dataSource === null || dataSource === void 0 ? void 0 : dataSource.title) || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.author) || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.content))) {
|
|
@@ -65,7 +66,7 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
65
66
|
}
|
|
66
67
|
return /*#__PURE__*/React.createElement("div", {
|
|
67
68
|
className: "lxm-drawer-empty"
|
|
68
|
-
}, emptyTxt);
|
|
69
|
+
}, getLocale('ErrorMsg.no-information', emptyTxt));
|
|
69
70
|
};
|
|
70
71
|
return visible ? /*#__PURE__*/React.createElement("div", {
|
|
71
72
|
ref: ref,
|
|
@@ -101,4 +102,9 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
101
102
|
className: "lxm-drawer-main"
|
|
102
103
|
}, mode === 'list' ? renderItems() : renderContent()))) : '';
|
|
103
104
|
});
|
|
105
|
+
Drawer.defaultProps = {
|
|
106
|
+
getLocale: function getLocale(t, p) {
|
|
107
|
+
return p !== null && p !== void 0 ? p : '';
|
|
108
|
+
}
|
|
109
|
+
};
|
|
104
110
|
export default Drawer;
|
|
@@ -11,7 +11,7 @@ import { isValidElement } from 'react';
|
|
|
11
11
|
import Modal from '../Modal';
|
|
12
12
|
import Drawer from '../Drawer';
|
|
13
13
|
import http from '../../http';
|
|
14
|
-
import { statusClrMap
|
|
14
|
+
import { statusClrMap } from '../../const';
|
|
15
15
|
import { defaultGlobalConfig, setGlobalConfig } from '../defaultGlobalConfig';
|
|
16
16
|
var isElm = function isElm(val) {
|
|
17
17
|
return ['number', 'string'].includes(_typeof(val)) || /*#__PURE__*/isValidElement(val);
|
|
@@ -31,7 +31,8 @@ var renderErrList = function renderErrList(errList) {
|
|
|
31
31
|
}
|
|
32
32
|
return null;
|
|
33
33
|
};
|
|
34
|
-
var renderTitle = function renderTitle(msg) {
|
|
34
|
+
var renderTitle = function renderTitle(msg, opts) {
|
|
35
|
+
var errTypeTitMap = opts.errTypeTitMap;
|
|
35
36
|
if (isElm(msg === null || msg === void 0 ? void 0 : msg.title)) {
|
|
36
37
|
return msg.title;
|
|
37
38
|
}
|
|
@@ -47,7 +48,7 @@ var ErrorMsg = {
|
|
|
47
48
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
48
49
|
var opts = _objectSpread(_objectSpread({}, defaultGlobalConfig), options);
|
|
49
50
|
if (msg) {
|
|
50
|
-
var title = renderTitle(msg);
|
|
51
|
+
var title = renderTitle(msg, opts);
|
|
51
52
|
Modal.open(_objectSpread({
|
|
52
53
|
title: title,
|
|
53
54
|
subtitle: msg === null || msg === void 0 ? void 0 : msg.code,
|
|
@@ -55,7 +56,7 @@ var ErrorMsg = {
|
|
|
55
56
|
onOk: function () {
|
|
56
57
|
var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
57
58
|
var _msg$resolve;
|
|
58
|
-
var resolve, _detRes, detRes, url, errMsg;
|
|
59
|
+
var resolve, _detRes, detRes, article, url, errMsg;
|
|
59
60
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
60
61
|
while (1) {
|
|
61
62
|
switch (_context.prev = _context.next) {
|
|
@@ -65,7 +66,7 @@ var ErrorMsg = {
|
|
|
65
66
|
case 2:
|
|
66
67
|
resolve = _context.sent;
|
|
67
68
|
if (!resolve) {
|
|
68
|
-
_context.next =
|
|
69
|
+
_context.next = 27;
|
|
69
70
|
break;
|
|
70
71
|
}
|
|
71
72
|
detRes = {};
|
|
@@ -76,18 +77,19 @@ var ErrorMsg = {
|
|
|
76
77
|
extend: resolve === null || resolve === void 0 ? void 0 : resolve.extend
|
|
77
78
|
};
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
article = opts.getArticle(msg.code, opts.getLocale);
|
|
81
|
+
if (!article) {
|
|
82
|
+
_context.next = 11;
|
|
81
83
|
break;
|
|
82
84
|
}
|
|
83
85
|
// 网络异常无法获取解决方案,使用内置的
|
|
84
86
|
detRes = {
|
|
85
|
-
article:
|
|
87
|
+
article: article,
|
|
86
88
|
extend: []
|
|
87
89
|
};
|
|
88
|
-
_context.next =
|
|
90
|
+
_context.next = 26;
|
|
89
91
|
break;
|
|
90
|
-
case
|
|
92
|
+
case 11:
|
|
91
93
|
// 请求后端获取解决方案
|
|
92
94
|
|
|
93
95
|
if (typeof resolve === 'string') {
|
|
@@ -96,45 +98,46 @@ var ErrorMsg = {
|
|
|
96
98
|
url = resolve.href;
|
|
97
99
|
}
|
|
98
100
|
if (!url) {
|
|
99
|
-
_context.next =
|
|
101
|
+
_context.next = 25;
|
|
100
102
|
break;
|
|
101
103
|
}
|
|
102
|
-
_context.prev =
|
|
103
|
-
_context.next =
|
|
104
|
+
_context.prev = 13;
|
|
105
|
+
_context.next = 16;
|
|
104
106
|
return http.get(url, {
|
|
105
107
|
params: {
|
|
106
108
|
errorCode: msg === null || msg === void 0 ? void 0 : msg.code,
|
|
107
109
|
errorMsg: msg === null || msg === void 0 ? void 0 : msg.msg
|
|
108
110
|
}
|
|
109
111
|
});
|
|
110
|
-
case
|
|
112
|
+
case 16:
|
|
111
113
|
errMsg = _context.sent;
|
|
112
114
|
detRes = {
|
|
113
115
|
article: errMsg === null || errMsg === void 0 ? void 0 : errMsg.guidance,
|
|
114
116
|
extend: errMsg === null || errMsg === void 0 ? void 0 : errMsg.errorInfos
|
|
115
117
|
};
|
|
116
|
-
_context.next =
|
|
118
|
+
_context.next = 23;
|
|
117
119
|
break;
|
|
118
|
-
case
|
|
119
|
-
_context.prev =
|
|
120
|
-
_context.t0 = _context["catch"](
|
|
120
|
+
case 20:
|
|
121
|
+
_context.prev = 20;
|
|
122
|
+
_context.t0 = _context["catch"](13);
|
|
121
123
|
// eslint-disable-next-line no-console
|
|
122
124
|
console.error(new Error("ErrorMsg\u7EC4\u4EF6: \u83B7\u53D6\u89E3\u51B3\u65B9\u6848\u5931\u8D25\uFF0C".concat(_context.t0)));
|
|
123
|
-
case
|
|
124
|
-
_context.next =
|
|
125
|
+
case 23:
|
|
126
|
+
_context.next = 26;
|
|
125
127
|
break;
|
|
126
|
-
case
|
|
128
|
+
case 25:
|
|
127
129
|
// eslint-disable-next-line no-console
|
|
128
130
|
console.error(new Error('ErrorMsg组件: 无效resolve'));
|
|
129
|
-
case
|
|
131
|
+
case 26:
|
|
130
132
|
Drawer.open({
|
|
133
|
+
getLocale: opts.getLocale,
|
|
131
134
|
title: title,
|
|
132
135
|
tabs: [{
|
|
133
136
|
key: 'article',
|
|
134
|
-
tab: '解决方案'
|
|
137
|
+
tab: opts.getLocale('ErrorMsg.solution', '解决方案')
|
|
135
138
|
}, {
|
|
136
139
|
key: 'extend',
|
|
137
|
-
tab: '错误信息匹配'
|
|
140
|
+
tab: opts.getLocale('ErrorMsg.errorMsgMatch', '错误信息匹配')
|
|
138
141
|
}],
|
|
139
142
|
activeTabsKey: 'article',
|
|
140
143
|
mode: 'content',
|
|
@@ -176,12 +179,12 @@ var ErrorMsg = {
|
|
|
176
179
|
}
|
|
177
180
|
}
|
|
178
181
|
});
|
|
179
|
-
case
|
|
182
|
+
case 27:
|
|
180
183
|
case "end":
|
|
181
184
|
return _context.stop();
|
|
182
185
|
}
|
|
183
186
|
}
|
|
184
|
-
}, _callee, null, [[
|
|
187
|
+
}, _callee, null, [[13, 20]]);
|
|
185
188
|
}));
|
|
186
189
|
function onOk() {
|
|
187
190
|
return _onOk.apply(this, arguments);
|
|
@@ -9,7 +9,9 @@ var Modal = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
9
9
|
content = props.content,
|
|
10
10
|
footer = props.footer,
|
|
11
11
|
onOk = props.onOk,
|
|
12
|
-
onCancel = props.onCancel
|
|
12
|
+
onCancel = props.onCancel,
|
|
13
|
+
okText = props.okText,
|
|
14
|
+
cancelText = props.cancelText;
|
|
13
15
|
return visible ? /*#__PURE__*/React.createElement("div", {
|
|
14
16
|
className: "lxm-modal-wraper",
|
|
15
17
|
ref: ref
|
|
@@ -35,9 +37,9 @@ var Modal = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
35
37
|
}, typeof footer === 'function' ? footer() : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
36
38
|
className: "lxm-modal-btn lxm-modal-def-btn",
|
|
37
39
|
onClick: onCancel
|
|
38
|
-
},
|
|
40
|
+
}, cancelText), /*#__PURE__*/React.createElement("div", {
|
|
39
41
|
className: "lxm-modal-btn lxm-modal-prm-btn",
|
|
40
42
|
onClick: onOk
|
|
41
|
-
},
|
|
43
|
+
}, okText)))))) : '';
|
|
42
44
|
});
|
|
43
45
|
export default Modal;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { resolveRequestPath } from '../compUtils';
|
|
2
|
+
import { errTypeTitMap, getArticle } from '../const';
|
|
2
3
|
export var defaultGlobalConfig = {
|
|
3
4
|
duration: null,
|
|
4
5
|
maxLine: null,
|
|
5
6
|
maxLen: null,
|
|
6
7
|
showType: 'modal',
|
|
7
8
|
maxCount: null,
|
|
8
|
-
resolve: process.env.LingXi_ERROR_RESOLVE || resolveRequestPath('/lcdp/error/queryErrorInfoByCodeOrMsg')
|
|
9
|
+
resolve: process.env.LingXi_ERROR_RESOLVE || resolveRequestPath('/lcdp/error/queryErrorInfoByCodeOrMsg'),
|
|
10
|
+
okText: '查看详情',
|
|
11
|
+
cancelText: '知道了',
|
|
12
|
+
getLocale: function getLocale(k, p) {
|
|
13
|
+
return p !== null && p !== void 0 ? p : '';
|
|
14
|
+
},
|
|
15
|
+
errTypeTitMap: errTypeTitMap,
|
|
16
|
+
getArticle: getArticle
|
|
9
17
|
};
|
|
10
18
|
export var setGlobalConfig = function setGlobalConfig() {
|
|
11
19
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -47,7 +47,8 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
47
47
|
errorInfoProps = _props$errorInfoProps === void 0 ? {
|
|
48
48
|
tabs: []
|
|
49
49
|
} : _props$errorInfoProps,
|
|
50
|
-
subTitle = props.subTitle
|
|
50
|
+
subTitle = props.subTitle,
|
|
51
|
+
getLocale = props.getLocale;
|
|
51
52
|
var _useState = useState([]),
|
|
52
53
|
_useState2 = _slicedToArray(_useState, 2),
|
|
53
54
|
extraConts = _useState2[0],
|
|
@@ -113,7 +114,7 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
113
114
|
return [].concat(_toConsumableArray(cloneList), [item[contentRowKey]]);
|
|
114
115
|
});
|
|
115
116
|
}
|
|
116
|
-
}, extraConts.includes(item[contentRowKey]) ? '收起' : '展开') : null) : null);
|
|
117
|
+
}, extraConts.includes(item[contentRowKey]) ? getLocale('packUp', '收起') : getLocale('open', '展开')) : null) : null);
|
|
117
118
|
});
|
|
118
119
|
}
|
|
119
120
|
return null;
|
|
@@ -157,7 +158,7 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
157
158
|
return _objectSpread(_objectSpread({}, pre), {}, _defineProperty({}, item[tabsRowKey], !errorCollapseMap[item[tabsRowKey]]));
|
|
158
159
|
});
|
|
159
160
|
}
|
|
160
|
-
}, errorCollapseMap[item[tabsRowKey]] ? '收起' : '展开', /*#__PURE__*/React.createElement("img", {
|
|
161
|
+
}, errorCollapseMap[item[tabsRowKey]] ? getLocale('packUp', '收起') : getLocale('open', '展开'), /*#__PURE__*/React.createElement("img", {
|
|
161
162
|
src: getSvgImageBase64(ArrowIcon),
|
|
162
163
|
alt: "",
|
|
163
164
|
className: classnames('lx-drawer-err-item-head-extra-arrow', {
|
|
@@ -177,7 +178,7 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
177
178
|
href: item.url,
|
|
178
179
|
target: "_blank",
|
|
179
180
|
rel: "noreferrer"
|
|
180
|
-
},
|
|
181
|
+
}, getLocale('documentLink', '文档链接')))));
|
|
181
182
|
})));
|
|
182
183
|
}
|
|
183
184
|
return isDomEle(tabsCont) ? tabsCont : null;
|
|
@@ -265,4 +266,9 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
265
266
|
className: "lx-drawer-footer"
|
|
266
267
|
}, footer) : null));
|
|
267
268
|
});
|
|
269
|
+
Drawer.defaultProps = {
|
|
270
|
+
getLocale: function getLocale(t, p) {
|
|
271
|
+
return p !== null && p !== void 0 ? p : '';
|
|
272
|
+
}
|
|
273
|
+
};
|
|
268
274
|
export default Drawer;
|
|
@@ -19,7 +19,7 @@ import Notification, { notificationInstance } from '../Notification';
|
|
|
19
19
|
import { resolveRequestPath, debounce } from '../../compUtils';
|
|
20
20
|
import { drawerHandel } from '../Drawer';
|
|
21
21
|
import http from '../../http';
|
|
22
|
-
import { statusClrMap
|
|
22
|
+
import { statusClrMap } from '../../const';
|
|
23
23
|
import { defaultGlobalConfig, setGlobalConfig } from '../defaultGlobalConfig';
|
|
24
24
|
var isElm = function isElm(val) {
|
|
25
25
|
return ['number', 'string'].includes(_typeof(val)) || /*#__PURE__*/isValidElement(val);
|
|
@@ -27,14 +27,27 @@ var isElm = function isElm(val) {
|
|
|
27
27
|
var emptyTxt = '暂无匹配信息,请联系平台管理员';
|
|
28
28
|
var defaultFeedbackUrl = process.env.LingXi_ERROR_FEEBACK_URL || resolveRequestPath('/portal/IssueFeedback/addUserIssueFeedback');
|
|
29
29
|
var feedbackPlacements = ['notification', 'drawer'];
|
|
30
|
-
var feedbackTxts = [
|
|
30
|
+
var feedbackTxts = [{
|
|
31
|
+
code: 'faultReport',
|
|
32
|
+
title: '故障上报'
|
|
33
|
+
}, {
|
|
34
|
+
code: 'hasReported',
|
|
35
|
+
title: '故障已上报'
|
|
36
|
+
}, {
|
|
37
|
+
code: 'reporting',
|
|
38
|
+
title: '故障上报中...'
|
|
39
|
+
}];
|
|
31
40
|
var targetTypes = ['request', 'dom', 'event'];
|
|
32
41
|
var btnDisableClass = ['lx-notification-btn-disabled', 'lx-drawer-btn-disabled'];
|
|
33
42
|
var getInstance = function getInstance(placement) {
|
|
34
43
|
return notificationInstance["lx-notification-root ".concat(placement)];
|
|
35
44
|
};
|
|
36
45
|
var renderErrList = function renderErrList(errList, opts) {
|
|
37
|
-
var erorrListShowType = opts.erorrListShowType
|
|
46
|
+
var erorrListShowType = opts.erorrListShowType,
|
|
47
|
+
_opts$getLocale = opts.getLocale,
|
|
48
|
+
getLocale = _opts$getLocale === void 0 ? function (k, p) {
|
|
49
|
+
return p;
|
|
50
|
+
} : _opts$getLocale;
|
|
38
51
|
if (Array.isArray(errList) && errList.length > 0) {
|
|
39
52
|
return errList.map(function (item) {
|
|
40
53
|
var _item$guidance, _item$guidance2;
|
|
@@ -61,15 +74,15 @@ var renderErrList = function renderErrList(errList, opts) {
|
|
|
61
74
|
})
|
|
62
75
|
});
|
|
63
76
|
}
|
|
64
|
-
},
|
|
77
|
+
}, getLocale('detail', ' 详情'))
|
|
65
78
|
};
|
|
66
79
|
});
|
|
67
80
|
}
|
|
68
81
|
return /*#__PURE__*/React.createElement("div", {
|
|
69
82
|
className: "lx-drawer-empty"
|
|
70
|
-
}, emptyTxt);
|
|
83
|
+
}, getLocale('ErrorMsg.no-information', emptyTxt));
|
|
71
84
|
};
|
|
72
|
-
var renderGuidance = function renderGuidance(guidance) {
|
|
85
|
+
var renderGuidance = function renderGuidance(guidance, opts) {
|
|
73
86
|
return (guidance === null || guidance === void 0 ? void 0 : guidance.title) || (guidance === null || guidance === void 0 ? void 0 : guidance.content) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
74
87
|
className: "lx-drawer-group-article lx-drawer-article"
|
|
75
88
|
// eslint-disable-next-line react/no-danger
|
|
@@ -81,11 +94,12 @@ var renderGuidance = function renderGuidance(guidance) {
|
|
|
81
94
|
onClick: function onClick() {
|
|
82
95
|
window.open(guidance === null || guidance === void 0 ? void 0 : guidance.guidanceUrl, '_blank');
|
|
83
96
|
}
|
|
84
|
-
},
|
|
97
|
+
}, opts.getLocale('documentLink', '文档链接'))) : null) : /*#__PURE__*/React.createElement("div", {
|
|
85
98
|
className: "lx-drawer-empty"
|
|
86
|
-
}, emptyTxt);
|
|
99
|
+
}, opts.getLocale('ErrorMsg.no-information', emptyTxt));
|
|
87
100
|
};
|
|
88
|
-
var renderTitle = function renderTitle(msg) {
|
|
101
|
+
var renderTitle = function renderTitle(msg, opts) {
|
|
102
|
+
var errTypeTitMap = opts.errTypeTitMap;
|
|
89
103
|
if (isElm(msg === null || msg === void 0 ? void 0 : msg.title)) {
|
|
90
104
|
return msg.title;
|
|
91
105
|
}
|
|
@@ -115,7 +129,7 @@ var ErrorMsg = {
|
|
|
115
129
|
}
|
|
116
130
|
// 打开错误提示
|
|
117
131
|
Notification.open(_objectSpread({
|
|
118
|
-
title: renderTitle(msg),
|
|
132
|
+
title: renderTitle(msg, opts),
|
|
119
133
|
code: msg === null || msg === void 0 ? void 0 : msg.code,
|
|
120
134
|
content: msg === null || msg === void 0 ? void 0 : msg.msg,
|
|
121
135
|
footer: function () {
|
|
@@ -135,14 +149,14 @@ var ErrorMsg = {
|
|
|
135
149
|
footerContent = [];
|
|
136
150
|
loadingStates = ['loading', 'finish'];
|
|
137
151
|
mapFeebackTxt = {
|
|
138
|
-
loading: feedbackTxts[2],
|
|
139
|
-
finish: feedbackTxts[1]
|
|
152
|
+
loading: opts.getLocale(feedbackTxts[2].code, feedbackTxts[2].title),
|
|
153
|
+
finish: opts.getLocale(feedbackTxts[1].code, feedbackTxts[1].title)
|
|
140
154
|
}; // 故障上报loading
|
|
141
155
|
feedbackLoading = ''; // 故障上报地址
|
|
142
156
|
feedbackUrl = defaultFeedbackUrl; // 是否显示故障上报
|
|
143
157
|
isShowFeedback = true; // 页面请求路径
|
|
144
158
|
pageUrl = window.location.href;
|
|
145
|
-
getDes = "<h3
|
|
159
|
+
getDes = "<h3>".concat(opts.getLocale('PageRequestPath', '页面请求路径'), "<h3><p>").concat(pageUrl, "</p><h3>").concat(opts.getLocale('PageRequestPath', '接口请求路径'), "<h3><p>").concat(target === null || target === void 0 ? void 0 : target.id, "</p><h3>").concat(opts.getLocale('PageRequestPath', '接口返回报文'), "<h3><p>").concat(resMsg, " ").concat(stack, "</p>"); // 故障上报数据
|
|
146
160
|
feedbackParams = {
|
|
147
161
|
feedbackType: '5000',
|
|
148
162
|
feedbackProductType: '5000',
|
|
@@ -186,10 +200,11 @@ var ErrorMsg = {
|
|
|
186
200
|
Notification.setOpenList(_toConsumableArray(getAllList));
|
|
187
201
|
var feedbackDrawerDom = document.getElementById("lx-feedback-drawer-".concat(_key));
|
|
188
202
|
if (feedbackDrawerDom) {
|
|
189
|
-
|
|
203
|
+
// eslint-disable-next-line max-len
|
|
204
|
+
feedbackDrawerDom.innerHTML = _state ? opts.getLocale(feedbackTxts[2].code, feedbackTxts[2].title) : opts.getLocale(feedbackTxts[1].code, feedbackTxts[1].title);
|
|
190
205
|
feedbackDrawerDom.classList.add(btnDisableClass[1]);
|
|
191
206
|
if (_error) {
|
|
192
|
-
feedbackDrawerDom.innerHTML = feedbackTxts[0];
|
|
207
|
+
feedbackDrawerDom.innerHTML = opts.getLocale(feedbackTxts[0].code, feedbackTxts[0].title);
|
|
193
208
|
feedbackDrawerDom.classList.remove(btnDisableClass[1]);
|
|
194
209
|
}
|
|
195
210
|
}
|
|
@@ -232,9 +247,10 @@ var ErrorMsg = {
|
|
|
232
247
|
}(), 400);
|
|
233
248
|
renderTxt = function renderTxt(_state) {
|
|
234
249
|
if (_state) {
|
|
235
|
-
|
|
250
|
+
// eslint-disable-next-line max-len
|
|
251
|
+
return _state === loadingStates[0] ? opts.getLocale(feedbackTxts[2].code, feedbackTxts[2].title) : opts.getLocale(feedbackTxts[1].code, feedbackTxts[1].title);
|
|
236
252
|
}
|
|
237
|
-
return feedbackTxts[0];
|
|
253
|
+
return opts.getLocale(feedbackTxts[0].code, feedbackTxts[0].title);
|
|
238
254
|
};
|
|
239
255
|
renderDisabled = function renderDisabled(flag, _key) {
|
|
240
256
|
if (_param.feedbackState) {
|
|
@@ -260,7 +276,7 @@ var ErrorMsg = {
|
|
|
260
276
|
handleFeeback(feedbackPlacements[0], getKey);
|
|
261
277
|
}
|
|
262
278
|
}
|
|
263
|
-
}, mapFeebackTxt[_param === null || _param === void 0 ? void 0 : _param.feedbackState] || feedbackTxts[0]));
|
|
279
|
+
}, mapFeebackTxt[_param === null || _param === void 0 ? void 0 : _param.feedbackState] || opts.getLocale(feedbackTxts[0].code, feedbackTxts[0].title)));
|
|
264
280
|
}
|
|
265
281
|
if (opts.extendFooter) {
|
|
266
282
|
if (typeof opts.footer === 'function') {
|
|
@@ -273,7 +289,7 @@ var ErrorMsg = {
|
|
|
273
289
|
footerContent.push( /*#__PURE__*/React.createElement("a", {
|
|
274
290
|
onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
275
291
|
var _detRes;
|
|
276
|
-
var detRes, url, errMsg, renderSubTitle;
|
|
292
|
+
var detRes, article, url, errMsg, renderSubTitle;
|
|
277
293
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
278
294
|
while (1) {
|
|
279
295
|
switch (_context2.prev = _context2.next) {
|
|
@@ -286,18 +302,19 @@ var ErrorMsg = {
|
|
|
286
302
|
extend: resolve === null || resolve === void 0 ? void 0 : resolve.extend
|
|
287
303
|
};
|
|
288
304
|
}
|
|
289
|
-
|
|
290
|
-
|
|
305
|
+
article = opts.getArticle(msg.code, opts.getLocale);
|
|
306
|
+
if (!article) {
|
|
307
|
+
_context2.next = 7;
|
|
291
308
|
break;
|
|
292
309
|
}
|
|
293
310
|
// 网络异常无法获取解决方案,使用内置的
|
|
294
311
|
detRes = {
|
|
295
|
-
article:
|
|
312
|
+
article: article,
|
|
296
313
|
extend: []
|
|
297
314
|
};
|
|
298
|
-
_context2.next =
|
|
315
|
+
_context2.next = 22;
|
|
299
316
|
break;
|
|
300
|
-
case
|
|
317
|
+
case 7:
|
|
301
318
|
// 请求后端获取解决方案
|
|
302
319
|
|
|
303
320
|
if (typeof resolve === 'string') {
|
|
@@ -306,58 +323,59 @@ var ErrorMsg = {
|
|
|
306
323
|
url = resolve.href;
|
|
307
324
|
}
|
|
308
325
|
if (!url) {
|
|
309
|
-
_context2.next =
|
|
326
|
+
_context2.next = 21;
|
|
310
327
|
break;
|
|
311
328
|
}
|
|
312
|
-
_context2.prev =
|
|
313
|
-
_context2.next =
|
|
329
|
+
_context2.prev = 9;
|
|
330
|
+
_context2.next = 12;
|
|
314
331
|
return http.get(url, {
|
|
315
332
|
params: {
|
|
316
333
|
errorCode: msg === null || msg === void 0 ? void 0 : msg.code,
|
|
317
334
|
errorMsg: msg === null || msg === void 0 ? void 0 : msg.msg
|
|
318
335
|
}
|
|
319
336
|
});
|
|
320
|
-
case
|
|
337
|
+
case 12:
|
|
321
338
|
errMsg = _context2.sent;
|
|
322
339
|
detRes = {
|
|
323
340
|
article: errMsg === null || errMsg === void 0 ? void 0 : errMsg.guidance,
|
|
324
341
|
extend: errMsg === null || errMsg === void 0 ? void 0 : errMsg.errorInfos
|
|
325
342
|
};
|
|
326
|
-
_context2.next =
|
|
343
|
+
_context2.next = 19;
|
|
327
344
|
break;
|
|
328
|
-
case
|
|
329
|
-
_context2.prev =
|
|
330
|
-
_context2.t0 = _context2["catch"](
|
|
345
|
+
case 16:
|
|
346
|
+
_context2.prev = 16;
|
|
347
|
+
_context2.t0 = _context2["catch"](9);
|
|
331
348
|
// eslint-disable-next-line no-console
|
|
332
349
|
console.error(new Error("ErrorMsg\u7EC4\u4EF6: \u83B7\u53D6\u89E3\u51B3\u65B9\u6848\u5931\u8D25\uFF0C".concat(_context2.t0)));
|
|
333
|
-
case
|
|
334
|
-
_context2.next =
|
|
350
|
+
case 19:
|
|
351
|
+
_context2.next = 22;
|
|
335
352
|
break;
|
|
336
|
-
case
|
|
353
|
+
case 21:
|
|
337
354
|
// eslint-disable-next-line no-console
|
|
338
355
|
console.error(new Error('ErrorMsg组件: 无效resolve'));
|
|
339
|
-
case
|
|
356
|
+
case 22:
|
|
340
357
|
renderSubTitle = function renderSubTitle() {
|
|
341
358
|
if (target.type === targetTypes[0] && (target === null || target === void 0 ? void 0 : target.id)) {
|
|
342
|
-
return "\
|
|
359
|
+
return "".concat(opts.getLocale('serviceURL', '服务地址'), "\uFF1A").concat(target === null || target === void 0 ? void 0 : target.id);
|
|
343
360
|
}
|
|
344
361
|
return null;
|
|
345
362
|
};
|
|
346
363
|
drawerHandel.open({
|
|
347
|
-
|
|
364
|
+
getLocale: opts.getLocale,
|
|
365
|
+
title: "".concat(renderTitle(msg, opts), "(").concat((msg === null || msg === void 0 ? void 0 : msg.code) || '', ")"),
|
|
348
366
|
status: 'error',
|
|
349
367
|
mode: 'errorInfo',
|
|
350
368
|
content: /*#__PURE__*/React.createElement(React.Fragment, null, (msg === null || msg === void 0 ? void 0 : msg.msg) ? /*#__PURE__*/React.createElement(React.Fragment, null, msg.msg, /*#__PURE__*/React.createElement("br", null)) : '', msg === null || msg === void 0 ? void 0 : msg.stack),
|
|
351
369
|
errorInfoProps: {
|
|
352
370
|
tabs: [{
|
|
353
371
|
key: 'article',
|
|
354
|
-
tab: '解决方案'
|
|
372
|
+
tab: opts.getLocale('ErrorMsg.solution', '解决方案')
|
|
355
373
|
}, {
|
|
356
374
|
key: 'extend',
|
|
357
|
-
tab: '错误信息匹配'
|
|
375
|
+
tab: opts.getLocale('ErrorMsg.errorMsgMatch', '错误信息匹配')
|
|
358
376
|
}],
|
|
359
377
|
tabsActiveKey: 'article',
|
|
360
|
-
tabsContent: renderGuidance((_detRes = detRes) === null || _detRes === void 0 ? void 0 : _detRes.article),
|
|
378
|
+
tabsContent: renderGuidance((_detRes = detRes) === null || _detRes === void 0 ? void 0 : _detRes.article, opts),
|
|
361
379
|
onTabsChange: function onTabsChange(record) {
|
|
362
380
|
var _detRes2, _detRes3;
|
|
363
381
|
switch (record === null || record === void 0 ? void 0 : record.key) {
|
|
@@ -365,7 +383,7 @@ var ErrorMsg = {
|
|
|
365
383
|
record.update({
|
|
366
384
|
errorInfoProps: {
|
|
367
385
|
tabsActiveKey: record === null || record === void 0 ? void 0 : record.key,
|
|
368
|
-
tabsContent: renderGuidance((_detRes2 = detRes) === null || _detRes2 === void 0 ? void 0 : _detRes2.article)
|
|
386
|
+
tabsContent: renderGuidance((_detRes2 = detRes) === null || _detRes2 === void 0 ? void 0 : _detRes2.article, opts)
|
|
369
387
|
}
|
|
370
388
|
});
|
|
371
389
|
break;
|
|
@@ -388,7 +406,7 @@ var ErrorMsg = {
|
|
|
388
406
|
onClick: function onClick() {
|
|
389
407
|
drawerHandel.close();
|
|
390
408
|
}
|
|
391
|
-
},
|
|
409
|
+
}, opts.cancelText), /*#__PURE__*/React.createElement("a", {
|
|
392
410
|
className: "lx-drawer-btn lx-drawer-btn-primary ".concat(renderDisabled(feedbackPlacements[1], _param.itemKey)),
|
|
393
411
|
id: "lx-feedback-drawer-".concat(_param.itemKey),
|
|
394
412
|
config: _param.itemKey,
|
|
@@ -401,14 +419,14 @@ var ErrorMsg = {
|
|
|
401
419
|
}
|
|
402
420
|
}, renderTxt(_param.feedbackState))) : null
|
|
403
421
|
});
|
|
404
|
-
case
|
|
422
|
+
case 24:
|
|
405
423
|
case "end":
|
|
406
424
|
return _context2.stop();
|
|
407
425
|
}
|
|
408
426
|
}
|
|
409
|
-
}, _callee2, null, [[
|
|
427
|
+
}, _callee2, null, [[9, 16]]);
|
|
410
428
|
}))
|
|
411
|
-
},
|
|
429
|
+
}, opts.okText));
|
|
412
430
|
}
|
|
413
431
|
return _context3.abrupt("return", footerContent);
|
|
414
432
|
case 29:
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { resolveRequestPath } from '../compUtils';
|
|
2
|
+
import { errTypeTitMap, getArticle } from '../const';
|
|
2
3
|
export var defaultGlobalConfig = {
|
|
3
4
|
duration: 3500,
|
|
4
5
|
maxLine: null,
|
|
@@ -14,9 +15,16 @@ export var defaultGlobalConfig = {
|
|
|
14
15
|
erorrListShowType: 'innerWindow',
|
|
15
16
|
// 'innerWindow' , 'openDrawer'
|
|
16
17
|
resolve: process.env.LingXi_ERROR_RESOLVE || resolveRequestPath('/lcdp/error/queryErrorInfoByCodeOrMsg'),
|
|
17
|
-
feebackAction: false
|
|
18
|
+
feebackAction: false,
|
|
19
|
+
// 故障上报地址,默认不展示故障上报
|
|
20
|
+
okText: '异常帮助',
|
|
21
|
+
cancelText: '取消',
|
|
22
|
+
getLocale: function getLocale(k, p) {
|
|
23
|
+
return p !== null && p !== void 0 ? p : '';
|
|
24
|
+
},
|
|
25
|
+
errTypeTitMap: errTypeTitMap,
|
|
26
|
+
getArticle: getArticle
|
|
18
27
|
};
|
|
19
|
-
|
|
20
28
|
export var setGlobalConfig = function setGlobalConfig() {
|
|
21
29
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
22
30
|
Object.assign(defaultGlobalConfig, config);
|