@lingxiteam/assets 4.0.1-alpha.2 → 4.1.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.
- package/es/error/errorDisplay/Web/ErrorMsg/index.js +318 -307
- package/es/error/errorDisplay/Web/Notification/Notice.js +7 -2
- package/es/error/errorDisplay/Web/Notification/Notification.js +26 -7
- package/es/error/errorDisplay/Web/Notification/Notification.less +23 -0
- package/es/error/errorDisplay/Web/Notification/index.js +4 -0
- package/es/error/errorDisplay/Web/defaultGlobalConfig.js +2 -0
- package/lib/error/errorDisplay/Web/ErrorMsg/index.js +318 -307
- package/lib/error/errorDisplay/Web/Notification/Notice.js +7 -2
- package/lib/error/errorDisplay/Web/Notification/Notification.js +26 -7
- package/lib/error/errorDisplay/Web/Notification/Notification.less +23 -0
- package/lib/error/errorDisplay/Web/Notification/index.js +4 -0
- package/lib/error/errorDisplay/Web/defaultGlobalConfig.js +2 -0
- package/package.json +1 -1
|
@@ -114,336 +114,347 @@ var ErrorMsg = {
|
|
|
114
114
|
open: function open(msg) {
|
|
115
115
|
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
116
116
|
var opts = _objectSpread(_objectSpread({}, defaultGlobalConfig), option);
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
117
|
+
var params = _objectSpread({
|
|
118
|
+
title: renderTitle(msg, opts),
|
|
119
|
+
code: msg === null || msg === void 0 ? void 0 : msg.code,
|
|
120
|
+
content: msg === null || msg === void 0 ? void 0 : msg.msg,
|
|
121
|
+
footer: function () {
|
|
122
|
+
var _footer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_param) {
|
|
123
|
+
var _msg$resolve;
|
|
124
|
+
var resolve, _opts$feebackAction, feebackAction, _ref, _ref$target, target, resMsg, stack, footerContent, loadingStates, mapFeebackTxt, feedbackLoading, feedbackUrl, isShowFeedback, pageUrl, getDes, feedbackParams, feebackReturn, handleLoading, handleFeeback, renderTxt, renderDisabled;
|
|
125
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
126
|
+
while (1) {
|
|
127
|
+
switch (_context3.prev = _context3.next) {
|
|
128
|
+
case 0:
|
|
129
|
+
_context3.next = 2;
|
|
130
|
+
return (_msg$resolve = msg === null || msg === void 0 ? void 0 : msg.resolve) !== null && _msg$resolve !== void 0 ? _msg$resolve : opts.resolve;
|
|
131
|
+
case 2:
|
|
132
|
+
resolve = _context3.sent;
|
|
133
|
+
_opts$feebackAction = opts.feebackAction, feebackAction = _opts$feebackAction === void 0 ? false : _opts$feebackAction;
|
|
134
|
+
_ref = msg || {}, _ref$target = _ref.target, target = _ref$target === void 0 ? {} : _ref$target, resMsg = _ref.msg, stack = _ref.stack;
|
|
135
|
+
footerContent = [];
|
|
136
|
+
loadingStates = ['loading', 'finish'];
|
|
137
|
+
mapFeebackTxt = {
|
|
138
|
+
loading: opts.getLocale(feedbackTxts[2].code, feedbackTxts[2].title),
|
|
139
|
+
finish: opts.getLocale(feedbackTxts[1].code, feedbackTxts[1].title)
|
|
140
|
+
}; // 故障上报loading
|
|
141
|
+
feedbackLoading = ''; // 故障上报地址
|
|
142
|
+
feedbackUrl = defaultFeedbackUrl; // 是否显示故障上报
|
|
143
|
+
isShowFeedback = true; // 页面请求路径
|
|
144
|
+
pageUrl = window.location.href;
|
|
145
|
+
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
|
+
feedbackParams = {
|
|
147
|
+
feedbackType: '5000',
|
|
148
|
+
feedbackProductType: '5000',
|
|
149
|
+
feedbackTitle: msg === null || msg === void 0 ? void 0 : msg.code,
|
|
150
|
+
feedbackContent: JSON.stringify({
|
|
151
|
+
target: target,
|
|
152
|
+
description: getDes
|
|
153
|
+
})
|
|
154
|
+
};
|
|
155
|
+
if (typeof feebackAction === 'boolean' && !feebackAction) {
|
|
156
|
+
isShowFeedback = false;
|
|
157
|
+
}
|
|
158
|
+
if (typeof feebackAction === 'string' && feebackAction) {
|
|
159
|
+
feedbackUrl = feebackAction;
|
|
160
|
+
}
|
|
161
|
+
if (!(typeof feebackAction === 'function')) {
|
|
162
|
+
_context3.next = 21;
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
_context3.next = 19;
|
|
166
|
+
return feebackAction(_objectSpread({}, feedbackParams));
|
|
167
|
+
case 19:
|
|
168
|
+
feebackReturn = _context3.sent;
|
|
169
|
+
if (!feebackReturn) {
|
|
170
|
+
isShowFeedback = false;
|
|
171
|
+
} else {
|
|
172
|
+
feedbackUrl = feebackReturn === null || feebackReturn === void 0 ? void 0 : feebackReturn.url;
|
|
173
|
+
feedbackParams = feebackReturn === null || feebackReturn === void 0 ? void 0 : feebackReturn.payload;
|
|
174
|
+
}
|
|
175
|
+
case 21:
|
|
176
|
+
handleLoading = function handleLoading(_key, _state) {
|
|
177
|
+
var _error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
178
|
+
var getAllList = Notification.getOpenList().map(function (v) {
|
|
179
|
+
if (String(v.itemKey) === String(_key)) {
|
|
180
|
+
return _objectSpread(_objectSpread({}, v), {}, {
|
|
181
|
+
feedbackState: _state ? loadingStates[0] : loadingStates[1]
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
return v;
|
|
185
|
+
});
|
|
186
|
+
Notification.setOpenList(_toConsumableArray(getAllList));
|
|
187
|
+
var feedbackDrawerDom = document.getElementById("lx-feedback-drawer-".concat(_key));
|
|
188
|
+
if (feedbackDrawerDom) {
|
|
189
|
+
// eslint-disable-next-line max-len
|
|
190
|
+
feedbackDrawerDom.innerHTML = _state ? opts.getLocale(feedbackTxts[2].code, feedbackTxts[2].title) : opts.getLocale(feedbackTxts[1].code, feedbackTxts[1].title);
|
|
191
|
+
feedbackDrawerDom.classList.add(btnDisableClass[1]);
|
|
192
|
+
if (_error) {
|
|
193
|
+
feedbackDrawerDom.innerHTML = opts.getLocale(feedbackTxts[0].code, feedbackTxts[0].title);
|
|
194
|
+
feedbackDrawerDom.classList.remove(btnDisableClass[1]);
|
|
195
|
+
}
|
|
171
196
|
}
|
|
172
|
-
|
|
173
|
-
|
|
197
|
+
feedbackLoading = _state ? loadingStates[0] : loadingStates[1];
|
|
198
|
+
if (_error) {
|
|
199
|
+
feedbackLoading = '';
|
|
174
200
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
201
|
+
};
|
|
202
|
+
handleFeeback = debounce( /*#__PURE__*/function () {
|
|
203
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(flag, elKey) {
|
|
204
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
205
|
+
while (1) {
|
|
206
|
+
switch (_context.prev = _context.next) {
|
|
207
|
+
case 0:
|
|
208
|
+
_context.prev = 0;
|
|
209
|
+
_context.next = 3;
|
|
210
|
+
return http.post(feedbackUrl, {
|
|
211
|
+
data: _objectSpread({}, feedbackParams)
|
|
212
|
+
});
|
|
213
|
+
case 3:
|
|
214
|
+
handleLoading(elKey, false);
|
|
215
|
+
_context.next = 10;
|
|
216
|
+
break;
|
|
217
|
+
case 6:
|
|
218
|
+
_context.prev = 6;
|
|
219
|
+
_context.t0 = _context["catch"](0);
|
|
220
|
+
handleLoading(elKey, false, true);
|
|
221
|
+
// eslint-disable-next-line no-console
|
|
222
|
+
console.error(new Error("ErrorMsg\u7EC4\u4EF6: \u6545\u969C\u4E0A\u62A5\u5931\u8D25\uFF0C".concat(_context.t0)));
|
|
223
|
+
case 10:
|
|
224
|
+
case "end":
|
|
225
|
+
return _context.stop();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}, _callee, null, [[0, 6]]);
|
|
229
|
+
}));
|
|
230
|
+
return function (_x2, _x3) {
|
|
231
|
+
return _ref2.apply(this, arguments);
|
|
232
|
+
};
|
|
233
|
+
}(), 400);
|
|
234
|
+
renderTxt = function renderTxt(_state) {
|
|
235
|
+
if (_state) {
|
|
236
|
+
// eslint-disable-next-line max-len
|
|
237
|
+
return _state === loadingStates[0] ? opts.getLocale(feedbackTxts[2].code, feedbackTxts[2].title) : opts.getLocale(feedbackTxts[1].code, feedbackTxts[1].title);
|
|
178
238
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
isShowFeedback = false;
|
|
185
|
-
} else {
|
|
186
|
-
feedbackUrl = feebackReturn === null || feebackReturn === void 0 ? void 0 : feebackReturn.url;
|
|
187
|
-
feedbackParams = feebackReturn === null || feebackReturn === void 0 ? void 0 : feebackReturn.payload;
|
|
239
|
+
return opts.getLocale(feedbackTxts[0].code, feedbackTxts[0].title);
|
|
240
|
+
};
|
|
241
|
+
renderDisabled = function renderDisabled(flag, _key) {
|
|
242
|
+
if (_param.feedbackState) {
|
|
243
|
+
return flag === feedbackPlacements[0] ? btnDisableClass[0] : btnDisableClass[1];
|
|
188
244
|
}
|
|
189
|
-
|
|
190
|
-
handleLoading = function handleLoading(_key, _state) {
|
|
191
|
-
var _error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
192
|
-
var getAllList = Notification.getOpenList().map(function (v) {
|
|
193
|
-
if (String(v.itemKey) === String(_key)) {
|
|
194
|
-
return _objectSpread(_objectSpread({}, v), {}, {
|
|
195
|
-
feedbackState: _state ? loadingStates[0] : loadingStates[1]
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
return v;
|
|
199
|
-
});
|
|
200
|
-
Notification.setOpenList(_toConsumableArray(getAllList));
|
|
245
|
+
if (flag === feedbackPlacements[1] && feedbackLoading) {
|
|
201
246
|
var feedbackDrawerDom = document.getElementById("lx-feedback-drawer-".concat(_key));
|
|
202
247
|
if (feedbackDrawerDom) {
|
|
203
|
-
|
|
204
|
-
feedbackDrawerDom.innerHTML = _state ? opts.getLocale(feedbackTxts[2].code, feedbackTxts[2].title) : opts.getLocale(feedbackTxts[1].code, feedbackTxts[1].title);
|
|
205
|
-
feedbackDrawerDom.classList.add(btnDisableClass[1]);
|
|
206
|
-
if (_error) {
|
|
207
|
-
feedbackDrawerDom.innerHTML = opts.getLocale(feedbackTxts[0].code, feedbackTxts[0].title);
|
|
208
|
-
feedbackDrawerDom.classList.remove(btnDisableClass[1]);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
feedbackLoading = _state ? loadingStates[0] : loadingStates[1];
|
|
212
|
-
if (_error) {
|
|
213
|
-
feedbackLoading = '';
|
|
248
|
+
feedbackDrawerDom.innerHTML = feedbackLoading === loadingStates[0] ? feedbackTxts[2] : feedbackTxts[1];
|
|
214
249
|
}
|
|
215
|
-
|
|
216
|
-
handleFeeback = debounce( /*#__PURE__*/function () {
|
|
217
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(flag, elKey) {
|
|
218
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
219
|
-
while (1) {
|
|
220
|
-
switch (_context.prev = _context.next) {
|
|
221
|
-
case 0:
|
|
222
|
-
_context.prev = 0;
|
|
223
|
-
_context.next = 3;
|
|
224
|
-
return http.post(feedbackUrl, {
|
|
225
|
-
data: _objectSpread({}, feedbackParams)
|
|
226
|
-
});
|
|
227
|
-
case 3:
|
|
228
|
-
handleLoading(elKey, false);
|
|
229
|
-
_context.next = 10;
|
|
230
|
-
break;
|
|
231
|
-
case 6:
|
|
232
|
-
_context.prev = 6;
|
|
233
|
-
_context.t0 = _context["catch"](0);
|
|
234
|
-
handleLoading(elKey, false, true);
|
|
235
|
-
// eslint-disable-next-line no-console
|
|
236
|
-
console.error(new Error("ErrorMsg\u7EC4\u4EF6: \u6545\u969C\u4E0A\u62A5\u5931\u8D25\uFF0C".concat(_context.t0)));
|
|
237
|
-
case 10:
|
|
238
|
-
case "end":
|
|
239
|
-
return _context.stop();
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}, _callee, null, [[0, 6]]);
|
|
243
|
-
}));
|
|
244
|
-
return function (_x2, _x3) {
|
|
245
|
-
return _ref2.apply(this, arguments);
|
|
246
|
-
};
|
|
247
|
-
}(), 400);
|
|
248
|
-
renderTxt = function renderTxt(_state) {
|
|
249
|
-
if (_state) {
|
|
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);
|
|
252
|
-
}
|
|
253
|
-
return opts.getLocale(feedbackTxts[0].code, feedbackTxts[0].title);
|
|
254
|
-
};
|
|
255
|
-
renderDisabled = function renderDisabled(flag, _key) {
|
|
256
|
-
if (_param.feedbackState) {
|
|
257
|
-
return flag === feedbackPlacements[0] ? btnDisableClass[0] : btnDisableClass[1];
|
|
258
|
-
}
|
|
259
|
-
if (flag === feedbackPlacements[1] && feedbackLoading) {
|
|
260
|
-
var feedbackDrawerDom = document.getElementById("lx-feedback-drawer-".concat(_key));
|
|
261
|
-
if (feedbackDrawerDom) {
|
|
262
|
-
feedbackDrawerDom.innerHTML = feedbackLoading === loadingStates[0] ? feedbackTxts[2] : feedbackTxts[1];
|
|
263
|
-
}
|
|
264
|
-
return btnDisableClass[1];
|
|
265
|
-
}
|
|
266
|
-
return '';
|
|
267
|
-
};
|
|
268
|
-
if (isShowFeedback) {
|
|
269
|
-
footerContent.push( /*#__PURE__*/React.createElement("a", {
|
|
270
|
-
className: "lx-notification-notice-footer-btn-ghost lx-feedback-notification-".concat(_param.itemKey, " ").concat(renderDisabled(feedbackPlacements[0], _param.itemKey)),
|
|
271
|
-
config: String(_param.itemKey),
|
|
272
|
-
onClick: function onClick(e) {
|
|
273
|
-
if (!(_param === null || _param === void 0 ? void 0 : _param.feedbackState)) {
|
|
274
|
-
var getKey = e.target.getAttribute('config');
|
|
275
|
-
handleLoading(getKey, true);
|
|
276
|
-
handleFeeback(feedbackPlacements[0], getKey);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}, mapFeebackTxt[_param === null || _param === void 0 ? void 0 : _param.feedbackState] || opts.getLocale(feedbackTxts[0].code, feedbackTxts[0].title)));
|
|
250
|
+
return btnDisableClass[1];
|
|
280
251
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
252
|
+
return '';
|
|
253
|
+
};
|
|
254
|
+
if (isShowFeedback) {
|
|
255
|
+
footerContent.push( /*#__PURE__*/React.createElement("a", {
|
|
256
|
+
className: "lx-notification-notice-footer-btn-ghost lx-feedback-notification-".concat(_param.itemKey, " ").concat(renderDisabled(feedbackPlacements[0], _param.itemKey)),
|
|
257
|
+
config: String(_param.itemKey),
|
|
258
|
+
onClick: function onClick(e) {
|
|
259
|
+
if (!(_param === null || _param === void 0 ? void 0 : _param.feedbackState)) {
|
|
260
|
+
var getKey = e.target.getAttribute('config');
|
|
261
|
+
handleLoading(getKey, true);
|
|
262
|
+
handleFeeback(feedbackPlacements[0], getKey);
|
|
263
|
+
}
|
|
286
264
|
}
|
|
265
|
+
}, mapFeebackTxt[_param === null || _param === void 0 ? void 0 : _param.feedbackState] || opts.getLocale(feedbackTxts[0].code, feedbackTxts[0].title)));
|
|
266
|
+
}
|
|
267
|
+
if (opts.extendFooter) {
|
|
268
|
+
if (typeof opts.footer === 'function') {
|
|
269
|
+
footerContent.push(opts.extendFooter());
|
|
270
|
+
} else {
|
|
271
|
+
footerContent.push(opts.extendFooter);
|
|
287
272
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
article: resolve === null || resolve === void 0 ? void 0 : resolve.article,
|
|
302
|
-
extend: resolve === null || resolve === void 0 ? void 0 : resolve.extend
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
article = opts.getArticle(msg.code, opts.getLocale);
|
|
306
|
-
if (!article) {
|
|
307
|
-
_context2.next = 7;
|
|
308
|
-
break;
|
|
309
|
-
}
|
|
310
|
-
// 网络异常无法获取解决方案,使用内置的
|
|
273
|
+
}
|
|
274
|
+
if (resolve) {
|
|
275
|
+
footerContent.push( /*#__PURE__*/React.createElement("a", {
|
|
276
|
+
onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
277
|
+
var _detRes;
|
|
278
|
+
var detRes, article, url, errMsg, renderSubTitle, renderContent;
|
|
279
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
280
|
+
while (1) {
|
|
281
|
+
switch (_context2.prev = _context2.next) {
|
|
282
|
+
case 0:
|
|
283
|
+
detRes = {};
|
|
284
|
+
if ((resolve === null || resolve === void 0 ? void 0 : resolve.article) || (resolve === null || resolve === void 0 ? void 0 : resolve.extend)) {
|
|
285
|
+
// 已预设解决方案
|
|
311
286
|
detRes = {
|
|
312
|
-
article: article,
|
|
313
|
-
extend:
|
|
287
|
+
article: resolve === null || resolve === void 0 ? void 0 : resolve.article,
|
|
288
|
+
extend: resolve === null || resolve === void 0 ? void 0 : resolve.extend
|
|
314
289
|
};
|
|
315
|
-
|
|
290
|
+
}
|
|
291
|
+
article = opts.getArticle(msg.code, opts.getLocale);
|
|
292
|
+
if (!article) {
|
|
293
|
+
_context2.next = 7;
|
|
316
294
|
break;
|
|
317
|
-
|
|
318
|
-
|
|
295
|
+
}
|
|
296
|
+
// 网络异常无法获取解决方案,使用内置的
|
|
297
|
+
detRes = {
|
|
298
|
+
article: article,
|
|
299
|
+
extend: []
|
|
300
|
+
};
|
|
301
|
+
_context2.next = 22;
|
|
302
|
+
break;
|
|
303
|
+
case 7:
|
|
304
|
+
// 请求后端获取解决方案
|
|
319
305
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
306
|
+
if (typeof resolve === 'string') {
|
|
307
|
+
url = resolve;
|
|
308
|
+
} else if (_typeof(resolve) === 'object') {
|
|
309
|
+
url = resolve.href;
|
|
310
|
+
}
|
|
311
|
+
if (!url) {
|
|
312
|
+
_context2.next = 21;
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
_context2.prev = 9;
|
|
316
|
+
_context2.next = 12;
|
|
317
|
+
return http.get(url, {
|
|
318
|
+
params: {
|
|
319
|
+
errorCode: msg === null || msg === void 0 ? void 0 : msg.code,
|
|
320
|
+
errorMsg: msg === null || msg === void 0 ? void 0 : msg.msg
|
|
324
321
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
322
|
+
});
|
|
323
|
+
case 12:
|
|
324
|
+
errMsg = _context2.sent;
|
|
325
|
+
detRes = {
|
|
326
|
+
article: errMsg === null || errMsg === void 0 ? void 0 : errMsg.guidance,
|
|
327
|
+
extend: errMsg === null || errMsg === void 0 ? void 0 : errMsg.errorInfos
|
|
328
|
+
};
|
|
329
|
+
_context2.next = 19;
|
|
330
|
+
break;
|
|
331
|
+
case 16:
|
|
332
|
+
_context2.prev = 16;
|
|
333
|
+
_context2.t0 = _context2["catch"](9);
|
|
334
|
+
// eslint-disable-next-line no-console
|
|
335
|
+
console.error(new Error("ErrorMsg\u7EC4\u4EF6: \u83B7\u53D6\u89E3\u51B3\u65B9\u6848\u5931\u8D25\uFF0C".concat(_context2.t0)));
|
|
336
|
+
case 19:
|
|
337
|
+
_context2.next = 22;
|
|
338
|
+
break;
|
|
339
|
+
case 21:
|
|
340
|
+
// eslint-disable-next-line no-console
|
|
341
|
+
console.error(new Error('ErrorMsg组件: 无效resolve'));
|
|
342
|
+
case 22:
|
|
343
|
+
renderSubTitle = function renderSubTitle() {
|
|
344
|
+
if (target.type === targetTypes[0] && (target === null || target === void 0 ? void 0 : target.id)) {
|
|
345
|
+
return "".concat(opts.getLocale('serviceURL', '服务地址'), "\uFF1A").concat(target === null || target === void 0 ? void 0 : target.id);
|
|
328
346
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
347
|
+
return null;
|
|
348
|
+
};
|
|
349
|
+
renderContent = function renderContent() {
|
|
350
|
+
var baseMsg = (msg === null || msg === void 0 ? void 0 : msg.description) || (msg === null || msg === void 0 ? void 0 : msg.msg);
|
|
351
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, baseMsg ? /*#__PURE__*/React.createElement(React.Fragment, null, baseMsg, /*#__PURE__*/React.createElement("br", null)) : '', msg === null || msg === void 0 ? void 0 : msg.stack);
|
|
352
|
+
};
|
|
353
|
+
drawerHandel.open({
|
|
354
|
+
getLocale: opts.getLocale,
|
|
355
|
+
title: "".concat(renderTitle(msg, opts), "(").concat((msg === null || msg === void 0 ? void 0 : msg.code) || '', ")"),
|
|
356
|
+
status: 'error',
|
|
357
|
+
mode: 'errorInfo',
|
|
358
|
+
content: renderContent(),
|
|
359
|
+
errorInfoProps: {
|
|
360
|
+
tabs: [{
|
|
361
|
+
key: 'article',
|
|
362
|
+
tab: opts.getLocale('ErrorMsg.solution', '解决方案')
|
|
363
|
+
}, {
|
|
364
|
+
key: 'extend',
|
|
365
|
+
tab: opts.getLocale('ErrorMsg.errorMsgMatch', '错误信息匹配')
|
|
366
|
+
}],
|
|
367
|
+
tabsActiveKey: 'article',
|
|
368
|
+
tabsContent: renderGuidance((_detRes = detRes) === null || _detRes === void 0 ? void 0 : _detRes.article, opts),
|
|
369
|
+
onTabsChange: function onTabsChange(record) {
|
|
370
|
+
var _detRes2, _detRes3;
|
|
371
|
+
switch (record === null || record === void 0 ? void 0 : record.key) {
|
|
372
|
+
case 'article':
|
|
373
|
+
record.update({
|
|
374
|
+
errorInfoProps: {
|
|
375
|
+
tabsActiveKey: record === null || record === void 0 ? void 0 : record.key,
|
|
376
|
+
tabsContent: renderGuidance((_detRes2 = detRes) === null || _detRes2 === void 0 ? void 0 : _detRes2.article, opts)
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
break;
|
|
380
|
+
case 'extend':
|
|
381
|
+
record.update({
|
|
382
|
+
errorInfoProps: {
|
|
383
|
+
tabsActiveKey: record === null || record === void 0 ? void 0 : record.key,
|
|
384
|
+
tabsContent: renderErrList((_detRes3 = detRes) === null || _detRes3 === void 0 ? void 0 : _detRes3.extend, opts)
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
break;
|
|
388
|
+
default:
|
|
389
|
+
break;
|
|
390
|
+
}
|
|
335
391
|
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
};
|
|
343
|
-
_context2.next = 19;
|
|
344
|
-
break;
|
|
345
|
-
case 16:
|
|
346
|
-
_context2.prev = 16;
|
|
347
|
-
_context2.t0 = _context2["catch"](9);
|
|
348
|
-
// eslint-disable-next-line no-console
|
|
349
|
-
console.error(new Error("ErrorMsg\u7EC4\u4EF6: \u83B7\u53D6\u89E3\u51B3\u65B9\u6848\u5931\u8D25\uFF0C".concat(_context2.t0)));
|
|
350
|
-
case 19:
|
|
351
|
-
_context2.next = 22;
|
|
352
|
-
break;
|
|
353
|
-
case 21:
|
|
354
|
-
// eslint-disable-next-line no-console
|
|
355
|
-
console.error(new Error('ErrorMsg组件: 无效resolve'));
|
|
356
|
-
case 22:
|
|
357
|
-
renderSubTitle = function renderSubTitle() {
|
|
358
|
-
if (target.type === targetTypes[0] && (target === null || target === void 0 ? void 0 : target.id)) {
|
|
359
|
-
return "".concat(opts.getLocale('serviceURL', '服务地址'), "\uFF1A").concat(target === null || target === void 0 ? void 0 : target.id);
|
|
392
|
+
},
|
|
393
|
+
subTitle: renderSubTitle(),
|
|
394
|
+
footer: isShowFeedback ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("a", {
|
|
395
|
+
className: "lx-drawer-btn",
|
|
396
|
+
onClick: function onClick() {
|
|
397
|
+
drawerHandel.close();
|
|
360
398
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
tabs: [{
|
|
371
|
-
key: 'article',
|
|
372
|
-
tab: opts.getLocale('ErrorMsg.solution', '解决方案')
|
|
373
|
-
}, {
|
|
374
|
-
key: 'extend',
|
|
375
|
-
tab: opts.getLocale('ErrorMsg.errorMsgMatch', '错误信息匹配')
|
|
376
|
-
}],
|
|
377
|
-
tabsActiveKey: 'article',
|
|
378
|
-
tabsContent: renderGuidance((_detRes = detRes) === null || _detRes === void 0 ? void 0 : _detRes.article, opts),
|
|
379
|
-
onTabsChange: function onTabsChange(record) {
|
|
380
|
-
var _detRes2, _detRes3;
|
|
381
|
-
switch (record === null || record === void 0 ? void 0 : record.key) {
|
|
382
|
-
case 'article':
|
|
383
|
-
record.update({
|
|
384
|
-
errorInfoProps: {
|
|
385
|
-
tabsActiveKey: record === null || record === void 0 ? void 0 : record.key,
|
|
386
|
-
tabsContent: renderGuidance((_detRes2 = detRes) === null || _detRes2 === void 0 ? void 0 : _detRes2.article, opts)
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
break;
|
|
390
|
-
case 'extend':
|
|
391
|
-
record.update({
|
|
392
|
-
errorInfoProps: {
|
|
393
|
-
tabsActiveKey: record === null || record === void 0 ? void 0 : record.key,
|
|
394
|
-
tabsContent: renderErrList((_detRes3 = detRes) === null || _detRes3 === void 0 ? void 0 : _detRes3.extend, opts)
|
|
395
|
-
}
|
|
396
|
-
});
|
|
397
|
-
break;
|
|
398
|
-
default:
|
|
399
|
-
break;
|
|
400
|
-
}
|
|
399
|
+
}, opts.cancelText), /*#__PURE__*/React.createElement("a", {
|
|
400
|
+
className: "lx-drawer-btn lx-drawer-btn-primary ".concat(renderDisabled(feedbackPlacements[1], _param.itemKey)),
|
|
401
|
+
id: "lx-feedback-drawer-".concat(_param.itemKey),
|
|
402
|
+
config: _param.itemKey,
|
|
403
|
+
onClick: function onClick(e) {
|
|
404
|
+
if (!_param.feedbackState) {
|
|
405
|
+
var getKey = e.target.getAttribute('config');
|
|
406
|
+
handleLoading(getKey, true);
|
|
407
|
+
handleFeeback(feedbackPlacements[1], getKey);
|
|
401
408
|
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
}
|
|
409
|
-
}, opts.cancelText), /*#__PURE__*/React.createElement("a", {
|
|
410
|
-
className: "lx-drawer-btn lx-drawer-btn-primary ".concat(renderDisabled(feedbackPlacements[1], _param.itemKey)),
|
|
411
|
-
id: "lx-feedback-drawer-".concat(_param.itemKey),
|
|
412
|
-
config: _param.itemKey,
|
|
413
|
-
onClick: function onClick(e) {
|
|
414
|
-
if (!_param.feedbackState) {
|
|
415
|
-
var getKey = e.target.getAttribute('config');
|
|
416
|
-
handleLoading(getKey, true);
|
|
417
|
-
handleFeeback(feedbackPlacements[1], getKey);
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
}, renderTxt(_param.feedbackState))) : null
|
|
421
|
-
});
|
|
422
|
-
case 24:
|
|
423
|
-
case "end":
|
|
424
|
-
return _context2.stop();
|
|
425
|
-
}
|
|
409
|
+
}
|
|
410
|
+
}, renderTxt(_param.feedbackState))) : null
|
|
411
|
+
});
|
|
412
|
+
case 25:
|
|
413
|
+
case "end":
|
|
414
|
+
return _context2.stop();
|
|
426
415
|
}
|
|
427
|
-
}
|
|
428
|
-
})
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
416
|
+
}
|
|
417
|
+
}, _callee2, null, [[9, 16]]);
|
|
418
|
+
})),
|
|
419
|
+
className: "lx-notification-notice-footer-btn-primary"
|
|
420
|
+
}, opts.okText));
|
|
421
|
+
}
|
|
422
|
+
return _context3.abrupt("return", footerContent);
|
|
423
|
+
case 29:
|
|
424
|
+
case "end":
|
|
425
|
+
return _context3.stop();
|
|
437
426
|
}
|
|
438
|
-
}
|
|
439
|
-
})
|
|
440
|
-
|
|
441
|
-
|
|
427
|
+
}
|
|
428
|
+
}, _callee3);
|
|
429
|
+
}));
|
|
430
|
+
function footer(_x) {
|
|
431
|
+
return _footer.apply(this, arguments);
|
|
432
|
+
}
|
|
433
|
+
return footer;
|
|
434
|
+
}()
|
|
435
|
+
}, opts);
|
|
436
|
+
if (msg) {
|
|
437
|
+
// 展示个数控制
|
|
438
|
+
if (defaultGlobalConfig.maxCount) {
|
|
439
|
+
var ins = getInstance(opts.placement);
|
|
440
|
+
if (ins) {
|
|
441
|
+
var openList = ins.getOpenList();
|
|
442
|
+
if (openList.length === defaultGlobalConfig.maxCount) {
|
|
443
|
+
if (defaultGlobalConfig.maxCount === 1 && defaultGlobalConfig.showBadge) {
|
|
444
|
+
Notification.stashOpenListSet(params);
|
|
445
|
+
}
|
|
446
|
+
return false;
|
|
447
|
+
// openList.slice(0, openList.length - defaultGlobalConfig.maxCount + 1).forEach(item => {
|
|
448
|
+
// item.close();
|
|
449
|
+
// });
|
|
442
450
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
// 打开错误提示
|
|
455
|
+
Notification.open(params);
|
|
446
456
|
}
|
|
457
|
+
return true;
|
|
447
458
|
},
|
|
448
459
|
config: function config() {
|
|
449
460
|
var option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|