@chaoswise/ui 2.7.12 → 2.8.0
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/AlgorithmChart/common/chart.option.js +14 -11
- package/lib/AlgorithmChart/index.js +29 -26
- package/lib/Antd4Form/FormItem.js +1 -1
- package/lib/BasicLayout/Nav.js +3 -5
- package/lib/BasicLayout/index.js +6 -7
- package/lib/CWMessage/MessageContent/TabList/index.js +9 -7
- package/lib/CWMessage/MessageContent/index.js +63 -48
- package/lib/CWMessage/index.js +28 -13
- package/lib/CWMessage/service/index.js +14 -14
- package/lib/CWMessage/utils/index.js +18 -11
- package/lib/CWRangePicker/DropdownMenu/MoreHistoryList/index.js +16 -10
- package/lib/CWRangePicker/DropdownMenu/MoreTimeList/index.js +4 -6
- package/lib/CWRangePicker/DropdownMenu/index.js +20 -13
- package/lib/CWRangePicker/Refresh/index.js +4 -7
- package/lib/CWRangePicker/TimeSpan/index.js +6 -9
- package/lib/CWRangePicker/index.js +28 -21
- package/lib/CWRangePicker/utils/index.js +45 -114
- package/lib/CWSelect/index.js +4 -7
- package/lib/CWTable/EditLine.js +5 -8
- package/lib/CWTable/Filter.js +5 -8
- package/lib/CWTable/index.js +3 -0
- package/lib/CWTree/index.js +4 -7
- package/lib/CWUpload/upload/Dragger.js +4 -7
- package/lib/CWUpload/upload/UploadList.js +12 -15
- package/lib/CardSelect/index.js +16 -14
- package/lib/CitySelect/index.js +3 -1
- package/lib/ColorPicker/index.js +4 -7
- package/lib/ConfigProvider/ConfigProvider.js +143 -48
- package/lib/ConfigProvider/Switch.js +10 -2
- package/lib/ConfigProvider/context.js +8 -0
- package/lib/ConfigProvider/useLocale.js +1 -1
- package/lib/DatePicker/useLocale.js +17 -10
- package/lib/DateRangePicker/components/ExtraQuickFooter.js +5 -8
- package/lib/DateRangePicker/index.js +6 -5
- package/lib/DropdownDatePicker/DropdownMenu/MoreTimeList/index.js +4 -6
- package/lib/DropdownDatePicker/DropdownMenu/index.js +4 -7
- package/lib/DropdownDatePicker/index.js +9 -10
- package/lib/DropdownDatePicker/utils/index.js +5 -93
- package/lib/EchartsBar/index.js +1 -1
- package/lib/Empty/index.js +3 -6
- package/lib/ErrorBoundary/ErrorPage.js +8 -9
- package/lib/Exception/index.js +9 -12
- package/lib/FilterDropDown/index.js +3 -6
- package/lib/Flow/tools/index.js +4 -1
- package/lib/Header/Document/index.js +3 -8
- package/lib/Header/LocaleSwitcher.js +2 -0
- package/lib/Header/UserSetting/index.js +27 -45
- package/lib/IconSelect/components/CustomImg/index.js +8 -11
- package/lib/IconSelect/components/SearchIcon/index.js +9 -9
- package/lib/IconSelect/index.js +4 -7
- package/lib/ImagePreview/index.js +3 -1
- package/lib/Joyride/List.js +9 -8
- package/lib/Joyride/index.js +19 -22
- package/lib/Pagination/index.js +14 -14
- package/lib/PolymerizationSearch/DropdownMenu.js +4 -2
- package/lib/Progress/index.js +3 -6
- package/lib/QuickTransfer/DragList.js +3 -6
- package/lib/QuickTransfer/index.js +6 -9
- package/lib/RangePicker/components/ExtraTimeFooter.js +4 -7
- package/lib/SearchBar/index.js +6 -9
- package/lib/SimpleCard/index.js +3 -1
- package/lib/SingleSpa/index.js +10 -4
- package/lib/ThemeProvider/Switcher.js +3 -1
- package/lib/TimeRangeSlider/Refresh/index.js +4 -7
- package/lib/TimeRangeSlider/TimeSpan/index.js +6 -9
- package/lib/TimeRangeSlider/index.js +22 -18
- package/lib/TimeRangeSlider/utils/index.js +20 -100
- package/lib/TimeZoneSelect/index.js +1 -1
- package/lib/TreeSelect111/index.js +3 -6
- package/lib/Upload-back/index.js +27 -25
- package/lib/VerticalLayout/index.js +3 -1
- package/lib/WangEditor/extraLanguage.js +19 -0
- package/lib/WangEditor/index.js +19 -13
- package/lib/WangEditor/messages.js +49 -0
- package/lib/WangEditor/wangEditor.js +47 -20
- package/lib/index.js +1 -0
- package/lib/locales/en_US.json +1 -0
- package/lib/locales/index.js +2 -0
- package/lib/locales/ja_JP.json +1 -0
- package/lib/locales/load.js +48 -0
- package/lib/locales/messages/antd.js +404 -0
- package/lib/locales/messages/editor.js +42 -0
- package/lib/locales/messages/timeRanges.js +36 -0
- package/lib/locales/messages/timeTypes.js +11 -0
- package/lib/locales/runtime.js +127 -0
- package/lib/locales/zh_CN.json +1 -0
- package/lib/locales/zh_HK.json +1 -0
- package/lib/locales/zh_TW.json +1 -0
- package/lib/useIntl/index.js +9 -0
- package/lib/useLocale/index.js +16 -13
- package/lib/utils/index.js +4 -1
- package/package.json +11 -2
- package/lib/Antd4/notification/index.copy.js +0 -301
- package/lib/BasicLayout/locale/en_US.js +0 -4
- package/lib/BasicLayout/locale/index.js +0 -13
- package/lib/BasicLayout/locale/ja_JP.js +0 -4
- package/lib/BasicLayout/locale/zh_CN.js +0 -4
- package/lib/BasicLayout/locale/zh_TW.js +0 -4
- package/lib/CWMessage/locale/en_US.js +0 -8
- package/lib/CWMessage/locale/index.js +0 -13
- package/lib/CWMessage/locale/ja_JP.js +0 -8
- package/lib/CWMessage/locale/zh_CN.js +0 -8
- package/lib/CWMessage/locale/zh_TW.js +0 -8
- package/lib/CWRangePicker/locale/en_US.js +0 -29
- package/lib/CWRangePicker/locale/index.js +0 -13
- package/lib/CWRangePicker/locale/ja_JP.js +0 -29
- package/lib/CWRangePicker/locale/zh_CN.js +0 -29
- package/lib/CWRangePicker/locale/zh_TW.js +0 -29
- package/lib/CWSelect/locale/en_US.js +0 -4
- package/lib/CWSelect/locale/index.js +0 -13
- package/lib/CWSelect/locale/ja_JP.js +0 -4
- package/lib/CWSelect/locale/zh_CN.js +0 -4
- package/lib/CWSelect/locale/zh_TW.js +0 -4
- package/lib/CWTable/locale/en_US.js +0 -6
- package/lib/CWTable/locale/index.js +0 -13
- package/lib/CWTable/locale/ja_JP.js +0 -6
- package/lib/CWTable/locale/zh_CN.js +0 -6
- package/lib/CWTable/locale/zh_TW.js +0 -6
- package/lib/CWTree/locale/en_US.js +0 -3
- package/lib/CWTree/locale/index.js +0 -13
- package/lib/CWTree/locale/ja_JP.js +0 -3
- package/lib/CWTree/locale/zh_CN.js +0 -3
- package/lib/CWTree/locale/zh_TW.js +0 -3
- package/lib/CWUpload/locale/en_US.js +0 -6
- package/lib/CWUpload/locale/index.js +0 -13
- package/lib/CWUpload/locale/ja_JP.js +0 -6
- package/lib/CWUpload/locale/zh_CN.js +0 -6
- package/lib/CWUpload/locale/zh_TW.js +0 -6
- package/lib/ColorPicker/locale/en_US.js +0 -4
- package/lib/ColorPicker/locale/index.js +0 -13
- package/lib/ColorPicker/locale/ja_JP.js +0 -4
- package/lib/ColorPicker/locale/zh_CN.js +0 -4
- package/lib/ColorPicker/locale/zh_TW.js +0 -4
- package/lib/DateRangePicker/locale/en_US.js +0 -5
- package/lib/DateRangePicker/locale/index.js +0 -13
- package/lib/DateRangePicker/locale/ja_JP.js +0 -5
- package/lib/DateRangePicker/locale/zh_CN.js +0 -5
- package/lib/DateRangePicker/locale/zh_TW.js +0 -5
- package/lib/DropdownDatePicker/locale/en_US.js +0 -21
- package/lib/DropdownDatePicker/locale/index.js +0 -13
- package/lib/DropdownDatePicker/locale/ja_JP.js +0 -21
- package/lib/DropdownDatePicker/locale/zh_CN.js +0 -21
- package/lib/DropdownDatePicker/locale/zh_TW.js +0 -21
- package/lib/Empty/locale/en_US.js +0 -3
- package/lib/Empty/locale/index.js +0 -13
- package/lib/Empty/locale/ja_JP.js +0 -3
- package/lib/Empty/locale/zh_CN.js +0 -3
- package/lib/Empty/locale/zh_TW.js +0 -3
- package/lib/ErrorBoundary/index.less +0 -15
- package/lib/ErrorBoundary/locale/en_US.js +0 -5
- package/lib/ErrorBoundary/locale/index.js +0 -13
- package/lib/ErrorBoundary/locale/ja_JP.js +0 -5
- package/lib/ErrorBoundary/locale/zh_CN.js +0 -5
- package/lib/ErrorBoundary/locale/zh_TW.js +0 -5
- package/lib/Exception/locale/en_US.js +0 -9
- package/lib/Exception/locale/index.js +0 -13
- package/lib/Exception/locale/ja_JP.js +0 -9
- package/lib/Exception/locale/zh_CN.js +0 -9
- package/lib/Exception/locale/zh_TW.js +0 -9
- package/lib/FilterDropDown/drag.svg +0 -17
- package/lib/FilterDropDown/locale/en_US.js +0 -3
- package/lib/FilterDropDown/locale/index.js +0 -13
- package/lib/FilterDropDown/locale/ja_JP.js +0 -3
- package/lib/FilterDropDown/locale/zh_CN.js +0 -3
- package/lib/FilterDropDown/locale/zh_TW.js +0 -3
- package/lib/IconSelect/locale/en_US.js +0 -11
- package/lib/IconSelect/locale/index.js +0 -13
- package/lib/IconSelect/locale/ja_JP.js +0 -11
- package/lib/IconSelect/locale/zh_CN.js +0 -11
- package/lib/IconSelect/locale/zh_TW.js +0 -11
- package/lib/Joyride/locale/en_US.js +0 -25
- package/lib/Joyride/locale/index.js +0 -13
- package/lib/Joyride/locale/ja_JP.js +0 -25
- package/lib/Joyride/locale/zh_CN.js +0 -25
- package/lib/Joyride/locale/zh_TW.js +0 -25
- package/lib/Pagination/locale/en_US.js +0 -8
- package/lib/Pagination/locale/index.js +0 -13
- package/lib/Pagination/locale/ja_JP.js +0 -8
- package/lib/Pagination/locale/zh_CN.js +0 -8
- package/lib/Pagination/locale/zh_TW.js +0 -8
- package/lib/Progress/locale/en_US.js +0 -3
- package/lib/Progress/locale/index.js +0 -13
- package/lib/Progress/locale/ja_JP.js +0 -3
- package/lib/Progress/locale/zh_CN.js +0 -3
- package/lib/Progress/locale/zh_TW.js +0 -3
- package/lib/QuickTransfer/CheckList.js +0 -47
- package/lib/QuickTransfer/TopicList.js +0 -152
- package/lib/QuickTransfer/locale/en_US.js +0 -8
- package/lib/QuickTransfer/locale/index.js +0 -13
- package/lib/QuickTransfer/locale/ja_JP.js +0 -8
- package/lib/QuickTransfer/locale/zh_CN.js +0 -8
- package/lib/QuickTransfer/locale/zh_TW.js +0 -8
- package/lib/RangePicker/locale/en_US.js +0 -5
- package/lib/RangePicker/locale/index.js +0 -13
- package/lib/RangePicker/locale/ja_JP.js +0 -5
- package/lib/RangePicker/locale/zh_CN.js +0 -5
- package/lib/RangePicker/locale/zh_TW.js +0 -5
- package/lib/SearchBar/locale/en_US.js +0 -6
- package/lib/SearchBar/locale/index.js +0 -13
- package/lib/SearchBar/locale/ja_JP.js +0 -6
- package/lib/SearchBar/locale/zh_CN.js +0 -6
- package/lib/SearchBar/locale/zh_TW.js +0 -6
- package/lib/TimeRangeSlider/locale/en_US.js +0 -31
- package/lib/TimeRangeSlider/locale/index.js +0 -13
- package/lib/TimeRangeSlider/locale/ja_JP.js +0 -31
- package/lib/TimeRangeSlider/locale/zh_CN.js +0 -31
- package/lib/TimeRangeSlider/locale/zh_TW.js +0 -31
- package/lib/TreeSelect111/locale/en_US.js +0 -3
- package/lib/TreeSelect111/locale/index.js +0 -13
- package/lib/TreeSelect111/locale/ja_JP.js +0 -3
- package/lib/TreeSelect111/locale/zh_CN.js +0 -3
- package/lib/TreeSelect111/locale/zh_TW.js +0 -3
- package/lib/WangEditor/locale/index.js +0 -93
- package/lib/useConfgiContext/index.js +0 -6
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import moment from "moment";
|
|
2
|
-
var ChartOption = function ChartOption() {
|
|
2
|
+
var ChartOption = function ChartOption(intl) {
|
|
3
|
+
var anomalyLabel = intl.get("b38ae1d1-4784-48d0-93bc-5114e5bab2db").d("异常检测点:");
|
|
4
|
+
var realValueLabel = intl.get("25fb8e48-65c5-43f7-a8bf-7709ff04d887").d("真实值");
|
|
3
5
|
var sampling = 'lttb'; ////average,max,min,sum/折线图在数据量远大于像素点时候的降采样策略,开启后可以有效的优化图表的绘制效率,默认关闭,也就是全部绘制不过滤数据点。
|
|
4
6
|
return {
|
|
5
7
|
animation: true,
|
|
6
8
|
title: {
|
|
7
9
|
show: true,
|
|
8
|
-
text:
|
|
10
|
+
text: intl.get("ed0f81b8-b85f-423b-b12a-1aaf718402f6").d("原始数据"),
|
|
9
11
|
textStyle: {
|
|
10
12
|
fontFamily: "Helvetica",
|
|
11
13
|
color: "rgba(0,0,0,0.85)",
|
|
@@ -19,7 +21,7 @@ var ChartOption = function ChartOption() {
|
|
|
19
21
|
formatter: function formatter(params) {
|
|
20
22
|
// console.log(params)
|
|
21
23
|
var upDownLine = params.filter(function (i) {
|
|
22
|
-
return i.seriesName ===
|
|
24
|
+
return i.seriesName === intl.get("38ca4b1d-225d-424d-bd15-b113389de185").d("上下界阈值");
|
|
23
25
|
});
|
|
24
26
|
var dom = (params || []).map(function (item, index) {
|
|
25
27
|
var marker = item.marker,
|
|
@@ -181,7 +183,7 @@ var ChartOption = function ChartOption() {
|
|
|
181
183
|
series: [{
|
|
182
184
|
animation: true,
|
|
183
185
|
animationThreshold: 10000,
|
|
184
|
-
name:
|
|
186
|
+
name: intl.get("ed0f81b8-b85f-423b-b12a-1aaf718402f6").d("原始数据"),
|
|
185
187
|
type: 'line',
|
|
186
188
|
// color: '#0066FF',
|
|
187
189
|
symbol: 'circle',
|
|
@@ -235,7 +237,8 @@ var ChartOption = function ChartOption() {
|
|
|
235
237
|
_data$coord = data.coord,
|
|
236
238
|
coord = _data$coord === void 0 ? [] : _data$coord;
|
|
237
239
|
// console.log(param);
|
|
238
|
-
|
|
240
|
+
// Translate only plain labels; rich-text braces belong to ECharts, not ICU.
|
|
241
|
+
return ["{con|".concat(anomalyLabel, "}"), "{con|".concat(moment(Number(coord[0]) || '').format('YYYY/MM/DD HH:mm:ss'), "}"), "{con|".concat(realValueLabel, ": ").concat(coord[1] + minValue || '', "}")].join('\n');
|
|
239
242
|
},
|
|
240
243
|
rich: {
|
|
241
244
|
con: {
|
|
@@ -257,7 +260,7 @@ var ChartOption = function ChartOption() {
|
|
|
257
260
|
// sampling: sampling,
|
|
258
261
|
}, {
|
|
259
262
|
animation: true,
|
|
260
|
-
name:
|
|
263
|
+
name: intl.get("95b117bb-3f50-4fa0-84ca-2352cc16a353").d("预测基线"),
|
|
261
264
|
type: 'line',
|
|
262
265
|
// color: '#3FBF00',
|
|
263
266
|
symbol: 'circle',
|
|
@@ -286,7 +289,7 @@ var ChartOption = function ChartOption() {
|
|
|
286
289
|
}
|
|
287
290
|
}, {
|
|
288
291
|
animation: true,
|
|
289
|
-
name:
|
|
292
|
+
name: intl.get("24ce035b-1020-49f4-91c0-7d291b97cfb2").d("上界"),
|
|
290
293
|
type: 'line',
|
|
291
294
|
// color: '#00c9c3',
|
|
292
295
|
showSymbol: false,
|
|
@@ -302,7 +305,7 @@ var ChartOption = function ChartOption() {
|
|
|
302
305
|
// sampling: sampling
|
|
303
306
|
}, {
|
|
304
307
|
animation: true,
|
|
305
|
-
name:
|
|
308
|
+
name: intl.get("ecee07fd-fc13-403f-99f3-fe3756c71893").d("下界"),
|
|
306
309
|
type: 'line',
|
|
307
310
|
// color: '#17c9b9',
|
|
308
311
|
showSymbol: false,
|
|
@@ -319,7 +322,7 @@ var ChartOption = function ChartOption() {
|
|
|
319
322
|
// sampling: sampling
|
|
320
323
|
}, {
|
|
321
324
|
animation: true,
|
|
322
|
-
name:
|
|
325
|
+
name: intl.get("154fd914-1948-48bb-bd07-b953ae4e54f8").d("预测上界"),
|
|
323
326
|
type: 'line',
|
|
324
327
|
// color: '#43C914',
|
|
325
328
|
showSymbol: false,
|
|
@@ -335,7 +338,7 @@ var ChartOption = function ChartOption() {
|
|
|
335
338
|
// sampling: sampling
|
|
336
339
|
}, {
|
|
337
340
|
animation: true,
|
|
338
|
-
name:
|
|
341
|
+
name: intl.get("62138181-9a19-4726-b3ba-0290fd83b0a7").d("预测下界"),
|
|
339
342
|
type: 'line',
|
|
340
343
|
// color: '#43C914',
|
|
341
344
|
showSymbol: false,
|
|
@@ -352,7 +355,7 @@ var ChartOption = function ChartOption() {
|
|
|
352
355
|
// sampling: sampling
|
|
353
356
|
}, {
|
|
354
357
|
animation: true,
|
|
355
|
-
name:
|
|
358
|
+
name: intl.get("2dc543f6-e08c-4197-bff4-46ccdcfae4e7").d("基线"),
|
|
356
359
|
type: 'line',
|
|
357
360
|
// color: '#FA8C16',
|
|
358
361
|
data: [],
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
1
2
|
import _EchartsLine from "@chaoswise/ui/lib/EchartsLine";
|
|
3
|
+
import _useIntl from "@chaoswise/ui/lib/useIntl";
|
|
2
4
|
var _excluded = ["data", "chartOption"];
|
|
3
5
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
6
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
8
|
+
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); }
|
|
4
9
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
5
10
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
6
11
|
import React, { useMemo } from "react";
|
|
@@ -12,12 +17,19 @@ import yellow from "./common/images/yellow.svg";
|
|
|
12
17
|
import green from "./common/images/green.svg";
|
|
13
18
|
import lightGreen from "./common/images/lightGreen.svg";
|
|
14
19
|
var AlgorithmChart = function AlgorithmChart(props) {
|
|
20
|
+
var intl = _useIntl();
|
|
15
21
|
var _props$data = props.data,
|
|
16
22
|
data = _props$data === void 0 ? {} : _props$data,
|
|
17
23
|
chartOption = props.chartOption,
|
|
18
24
|
rest = _objectWithoutProperties(props, _excluded);
|
|
19
25
|
var _data = useMemo(function () {
|
|
20
|
-
var option = _option();
|
|
26
|
+
var option = _option(intl);
|
|
27
|
+
var labels = {
|
|
28
|
+
upperThreshold: intl.get("ca04a75e-c8d1-48a3-8620-ae7e1a53d32f").d("上阈值界限"),
|
|
29
|
+
lowerThreshold: intl.get("605a8e37-803b-4bdd-9cd4-3f81766c6f90").d("下阈值界限"),
|
|
30
|
+
fittedUpper: intl.get("c0209052-9ae9-4f22-9b2b-e81d4f8b1f62").d("拟合上界"),
|
|
31
|
+
fittedLower: intl.get("18d4e95e-aafa-4c2b-b68f-17b7e06a4ae3").d("拟合下界")
|
|
32
|
+
};
|
|
21
33
|
var _data$title = data.title,
|
|
22
34
|
title = _data$title === void 0 ? '' : _data$title,
|
|
23
35
|
_data$seriesData = data.seriesData,
|
|
@@ -111,7 +123,7 @@ var AlgorithmChart = function AlgorithmChart(props) {
|
|
|
111
123
|
/*****************添加的上下阈值界限*****************************/
|
|
112
124
|
if (upperThreshold || [0, '0'].includes(upperThreshold)) {
|
|
113
125
|
option.series[0].markLine.data[0] = {
|
|
114
|
-
name:
|
|
126
|
+
name: labels.upperThreshold,
|
|
115
127
|
yAxis: upperThreshold,
|
|
116
128
|
minValue: minValue,
|
|
117
129
|
// type: "median",
|
|
@@ -122,7 +134,7 @@ var AlgorithmChart = function AlgorithmChart(props) {
|
|
|
122
134
|
}
|
|
123
135
|
if (lowerThreshold || [0, '0'].includes(lowerThreshold)) {
|
|
124
136
|
option.series[0].markLine.data[1] = {
|
|
125
|
-
name:
|
|
137
|
+
name: labels.lowerThreshold,
|
|
126
138
|
yAxis: lowerThreshold,
|
|
127
139
|
minValue: minValue,
|
|
128
140
|
// type: "median",
|
|
@@ -147,11 +159,11 @@ var AlgorithmChart = function AlgorithmChart(props) {
|
|
|
147
159
|
|
|
148
160
|
/******检测的上下界,有无预测值,上下界名称不一样******/
|
|
149
161
|
if (forecastUpper.length) {
|
|
150
|
-
option.series[2].name =
|
|
162
|
+
option.series[2].name = labels.fittedUpper;
|
|
151
163
|
}
|
|
152
164
|
option.series[2].data = upper.length ? upper : fitUpper;
|
|
153
165
|
if (forecastLower.length) {
|
|
154
|
-
option.series[3].name =
|
|
166
|
+
option.series[3].name = labels.fittedLower;
|
|
155
167
|
}
|
|
156
168
|
option.series[3].data = lower.length ? lower : fitLower;
|
|
157
169
|
|
|
@@ -166,13 +178,13 @@ var AlgorithmChart = function AlgorithmChart(props) {
|
|
|
166
178
|
if (!!processedData.length || !!seriesData.length) {
|
|
167
179
|
//是否显示原始数据按钮
|
|
168
180
|
legengData.push({
|
|
169
|
-
name:
|
|
181
|
+
name: option.series[0].name,
|
|
170
182
|
icon: blue
|
|
171
183
|
});
|
|
172
184
|
}
|
|
173
185
|
if (forecastBaseline.length) {
|
|
174
186
|
legengData.push({
|
|
175
|
-
name:
|
|
187
|
+
name: option.series[1].name,
|
|
176
188
|
icon: green
|
|
177
189
|
});
|
|
178
190
|
}
|
|
@@ -180,40 +192,40 @@ var AlgorithmChart = function AlgorithmChart(props) {
|
|
|
180
192
|
if (forecastUpper.length) {
|
|
181
193
|
if (!!upper.length || !!fitUpper.length) {
|
|
182
194
|
legengData.push({
|
|
183
|
-
name:
|
|
195
|
+
name: option.series[2].name,
|
|
184
196
|
icon: lightBlue
|
|
185
197
|
});
|
|
186
198
|
}
|
|
187
199
|
if (!!lower.length || !!fitLower.length) {
|
|
188
200
|
legengData.push({
|
|
189
|
-
name:
|
|
201
|
+
name: option.series[3].name,
|
|
190
202
|
icon: lightBlue
|
|
191
203
|
});
|
|
192
204
|
}
|
|
193
205
|
legengData.push({
|
|
194
|
-
name:
|
|
206
|
+
name: option.series[4].name,
|
|
195
207
|
icon: lightGreen
|
|
196
208
|
});
|
|
197
209
|
} else if (!!upper.length || !!fitUpper.length) {
|
|
198
210
|
legengData.push({
|
|
199
|
-
name:
|
|
211
|
+
name: option.series[2].name,
|
|
200
212
|
icon: lightBlue
|
|
201
213
|
});
|
|
202
214
|
}
|
|
203
215
|
if (forecastLower.length) {
|
|
204
216
|
legengData.push({
|
|
205
|
-
name:
|
|
217
|
+
name: option.series[5].name,
|
|
206
218
|
icon: lightGreen
|
|
207
219
|
});
|
|
208
220
|
} else if (!!lower.length || !!fitLower.length) {
|
|
209
221
|
legengData.push({
|
|
210
|
-
name:
|
|
222
|
+
name: option.series[3].name,
|
|
211
223
|
icon: lightBlue
|
|
212
224
|
});
|
|
213
225
|
}
|
|
214
226
|
if (!!baseline.length || !!fitBaseline.length) {
|
|
215
227
|
legengData.push({
|
|
216
|
-
name:
|
|
228
|
+
name: option.series[6].name,
|
|
217
229
|
icon: yellow
|
|
218
230
|
});
|
|
219
231
|
}
|
|
@@ -221,27 +233,18 @@ var AlgorithmChart = function AlgorithmChart(props) {
|
|
|
221
233
|
/******************* 动态加载图例 ********************/
|
|
222
234
|
|
|
223
235
|
/**********************默认展示/隐藏哪几条线*************/
|
|
224
|
-
var legengSelected = {
|
|
225
|
-
'拟合上界': false,
|
|
226
|
-
'拟合下界': false,
|
|
227
|
-
'预测上界': false,
|
|
228
|
-
'预测下界': false,
|
|
229
|
-
'上界': !forecastUpper.length,
|
|
230
|
-
'下界': !forecastLower.length
|
|
231
|
-
};
|
|
236
|
+
var legengSelected = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, option.series[4].name, false), option.series[5].name, false), option.series[2].name, !forecastUpper.length), option.series[3].name, !forecastLower.length);
|
|
232
237
|
/**********************默认展示/隐藏哪几条线*************/
|
|
233
238
|
|
|
234
239
|
/*****************没有预测值时,默认隐藏基线***********/
|
|
235
240
|
if (!forecastBaseline.length) {
|
|
236
|
-
legengSelected = Object.assign({}, legengSelected, {
|
|
237
|
-
'基线': false
|
|
238
|
-
});
|
|
241
|
+
legengSelected = Object.assign({}, legengSelected, _defineProperty({}, option.series[6].name, false));
|
|
239
242
|
}
|
|
240
243
|
/*****************没有预测值时,默认隐藏基线***********/
|
|
241
244
|
|
|
242
245
|
option.legend.selected = legengSelected;
|
|
243
246
|
return option;
|
|
244
|
-
}, [data]);
|
|
247
|
+
}, [data, intl]);
|
|
245
248
|
return /*#__PURE__*/React.createElement(_EchartsLine, _extends({
|
|
246
249
|
option: _data,
|
|
247
250
|
isMergeOption: false
|
|
@@ -70,7 +70,7 @@ function Item(_ref) {
|
|
|
70
70
|
}, [name, children]);
|
|
71
71
|
if (!name) {
|
|
72
72
|
if (typeof children !== 'function') {
|
|
73
|
-
console.warn('不要使用Form.Item进行非表单组件布局, 布局参考 https://formilyjs.org/#/xbS7SW/rpi9iNs5sD');
|
|
73
|
+
console.warn('不要使用Form.Item进行非表单组件布局, 布局参考 https://formilyjs.org/#/xbS7SW/rpi9iNs5sD'); // cw-i18n-disable-line
|
|
74
74
|
}
|
|
75
75
|
return /*#__PURE__*/React.createElement(Fragment, null, renderChildren);
|
|
76
76
|
}
|
package/lib/BasicLayout/Nav.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
import useIntl from '../useIntl';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import useLocale from '../useLocale';
|
|
3
|
-
import langConfig from './locale';
|
|
4
3
|
function Nav(_ref) {
|
|
5
4
|
var customContent = _ref.customContent,
|
|
6
5
|
showBreadcrumb = _ref.showBreadcrumb,
|
|
@@ -10,8 +9,7 @@ function Nav(_ref) {
|
|
|
10
9
|
_ref$onClickBack = _ref.onClickBack,
|
|
11
10
|
onClickBack = _ref$onClickBack === void 0 ? function () {} : _ref$onClickBack,
|
|
12
11
|
breadCrumb = _ref.breadCrumb;
|
|
13
|
-
var
|
|
14
|
-
langObj = _useLocale.langObj;
|
|
12
|
+
var intl = useIntl();
|
|
15
13
|
if (customContent) {
|
|
16
14
|
return null;
|
|
17
15
|
}
|
|
@@ -29,7 +27,7 @@ function Nav(_ref) {
|
|
|
29
27
|
className: "cw-content-nav-back-btn"
|
|
30
28
|
}, backIcon), /*#__PURE__*/React.createElement("div", {
|
|
31
29
|
className: "cw-content-nav-back-title"
|
|
32
|
-
}, backNavigationTitle ||
|
|
30
|
+
}, backNavigationTitle || intl.get("26935dff-3710-42be-bf75-175785ea86a1").d("返回")))));
|
|
33
31
|
}
|
|
34
32
|
if (showBreadcrumb) {
|
|
35
33
|
return /*#__PURE__*/React.createElement("div", {
|
package/lib/BasicLayout/index.js
CHANGED
|
@@ -13,6 +13,8 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
13
13
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
14
14
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
15
15
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
16
|
+
import useIntl from '../useIntl';
|
|
17
|
+
import useConfigLocale from '../ConfigProvider/useLocale';
|
|
16
18
|
import React, { useState, useEffect, useRef } from "react";
|
|
17
19
|
import ReactDOM from "react-dom";
|
|
18
20
|
import PropTypes from 'prop-types';
|
|
@@ -23,9 +25,6 @@ import Sider from './Sider';
|
|
|
23
25
|
import Nav from './Nav';
|
|
24
26
|
import './index.less';
|
|
25
27
|
import { eventManager } from '../utils';
|
|
26
|
-
import useLocale from '../useLocale';
|
|
27
|
-
import langConfig from './locale';
|
|
28
|
-
import { formatMessage } from "../utils";
|
|
29
28
|
import useConfigContext from '../useConfigContext';
|
|
30
29
|
var Content = _Layout.Content,
|
|
31
30
|
AntHeader = _Layout.Header;
|
|
@@ -99,9 +98,9 @@ var BasicLayout = function BasicLayout(_ref) {
|
|
|
99
98
|
var _useConfigContext = useConfigContext(),
|
|
100
99
|
getPrefixCls = _useConfigContext.getPrefixCls;
|
|
101
100
|
var prefixCls = getPrefixCls('basic-layout');
|
|
102
|
-
var
|
|
103
|
-
|
|
104
|
-
locale =
|
|
101
|
+
var intl = useIntl();
|
|
102
|
+
var _useConfigLocale = useConfigLocale(),
|
|
103
|
+
locale = _useConfigLocale.locale;
|
|
105
104
|
var menuData = menuOptions.menuData,
|
|
106
105
|
_menuOptions$resizabl = menuOptions.resizableProps,
|
|
107
106
|
_menuOptions$resizabl2 = _menuOptions$resizabl === void 0 ? {} : _menuOptions$resizabl,
|
|
@@ -270,7 +269,7 @@ var BasicLayout = function BasicLayout(_ref) {
|
|
|
270
269
|
topNavigationClassName: topNavigationClassName,
|
|
271
270
|
topNavigationTrigger: topNavigationTrigger,
|
|
272
271
|
onClickTopNavigation: onClickTopNavigation,
|
|
273
|
-
allProductsTitle: allProductsTitle ||
|
|
272
|
+
allProductsTitle: allProductsTitle || intl.get("ec46c0b7-b38a-4048-af67-6ae0ec477c52").d("所有产品"),
|
|
274
273
|
localeSwitcherOption: localeSwitcherOption,
|
|
275
274
|
messageOption: messageOption,
|
|
276
275
|
documentOption: documentOption,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
import "@chaoswise/ui/lib/Button/index.less";
|
|
3
3
|
import _Button from "@chaoswise/ui/lib/Button";
|
|
4
|
-
import _useLocale2 from "@chaoswise/ui/lib/useLocale";
|
|
5
4
|
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
6
5
|
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
7
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -11,11 +10,11 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
11
10
|
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); }
|
|
12
11
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
13
12
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
13
|
+
import useIntl from '../../../useIntl';
|
|
14
|
+
import useConfigLocale from '../../../ConfigProvider/useLocale';
|
|
14
15
|
import React from "react";
|
|
15
16
|
import moment from "moment";
|
|
16
17
|
import { readInnerMessageApi } from "../../service";
|
|
17
|
-
import langConfig from "../../locale";
|
|
18
|
-
import { formatMessage } from "../../../utils";
|
|
19
18
|
import "./index.less";
|
|
20
19
|
var TabList = function TabList(props) {
|
|
21
20
|
var _props$messages = props.messages,
|
|
@@ -32,8 +31,9 @@ var TabList = function TabList(props) {
|
|
|
32
31
|
code = props.code,
|
|
33
32
|
onTabListAllRead = props.onTabListAllRead,
|
|
34
33
|
renderMessageDateFormat = props.renderMessageDateFormat;
|
|
35
|
-
var
|
|
36
|
-
|
|
34
|
+
var intl = useIntl();
|
|
35
|
+
var _useConfigLocale = useConfigLocale(),
|
|
36
|
+
locale = _useConfigLocale.locale;
|
|
37
37
|
var _readInnerMessageApi = requestOption.readInnerMessageApi;
|
|
38
38
|
var onHandleMessage = function onHandleMessage(message) {
|
|
39
39
|
var userMessageId = message.userMessageId,
|
|
@@ -65,7 +65,9 @@ var TabList = function TabList(props) {
|
|
|
65
65
|
return _regenerator().w(function (_context) {
|
|
66
66
|
while (1) switch (_context.n) {
|
|
67
67
|
case 0:
|
|
68
|
-
resRequestApi = _readInnerMessageApi ||
|
|
68
|
+
resRequestApi = _readInnerMessageApi || function (params, gateway) {
|
|
69
|
+
return readInnerMessageApi(params, gateway, locale);
|
|
70
|
+
};
|
|
69
71
|
_context.n = 1;
|
|
70
72
|
return resRequestApi(params, gatewayPrefix);
|
|
71
73
|
case 1:
|
|
@@ -113,6 +115,6 @@ var TabList = function TabList(props) {
|
|
|
113
115
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Button, {
|
|
114
116
|
className: "cw-message-content-all-read",
|
|
115
117
|
onClick: onHandleReadAllMessage
|
|
116
|
-
},
|
|
118
|
+
}, intl.get("687e715c-51a9-42b7-906e-ddc011056d60").d("全部已读")), messageList);
|
|
117
119
|
};
|
|
118
120
|
export default TabList;
|
|
@@ -7,7 +7,6 @@ import _Empty from "@chaoswise/ui/lib/Empty";
|
|
|
7
7
|
import _Spin from "@chaoswise/ui/lib/Spin";
|
|
8
8
|
import "@chaoswise/ui/lib/Badge/index.less";
|
|
9
9
|
import _Badge from "@chaoswise/ui/lib/Badge";
|
|
10
|
-
import _useLocale2 from "@chaoswise/ui/lib/useLocale";
|
|
11
10
|
import "@chaoswise/ui/lib/Tabs/index.less";
|
|
12
11
|
import _Tabs from "@chaoswise/ui/lib/Tabs";
|
|
13
12
|
import _ThemeProvider from "@chaoswise/ui/lib/ThemeProvider";
|
|
@@ -27,40 +26,15 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
27
26
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
28
27
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
29
28
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
29
|
+
import useIntl from '../../useIntl';
|
|
30
|
+
import useConfigLocale from '../../ConfigProvider/useLocale';
|
|
30
31
|
import React, { useState, useEffect, useRef } from "react";
|
|
31
32
|
import { getMessageTypeApi, getMessageListApi, getMessageUnreadCountApi } from "../service";
|
|
32
33
|
import TabList from "./TabList";
|
|
33
34
|
import { useHistory } from "react-router-dom";
|
|
34
|
-
import langConfig from "../locale";
|
|
35
|
-
import { formatMessage } from "../../utils";
|
|
36
35
|
import "./index.less";
|
|
37
36
|
var useThemeSwitcher = _ThemeProvider.useThemeSwitcher;
|
|
38
37
|
var TabPane = _Tabs.TabPane;
|
|
39
|
-
var localOptionsMap = {
|
|
40
|
-
en: "enName",
|
|
41
|
-
en_US: "enName",
|
|
42
|
-
zh_TW: "name",
|
|
43
|
-
zh: "name",
|
|
44
|
-
zh_CN: "name",
|
|
45
|
-
ja: "jaName",
|
|
46
|
-
ja_JP: "jaName"
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// 获取本地化字段名的方法,提供兜底逻辑
|
|
50
|
-
var getLocalizedField = function getLocalizedField(locale) {
|
|
51
|
-
return localOptionsMap[locale];
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// 获取本地化的 tab 名称,最终兜底到 name 字段
|
|
55
|
-
var getLocalizedTabName = function getLocalizedTabName(item, locale) {
|
|
56
|
-
var fieldName = getLocalizedField(locale);
|
|
57
|
-
// 判断 item 中是否包含转换后的字段
|
|
58
|
-
if (fieldName && fieldName in item) {
|
|
59
|
-
return item[fieldName];
|
|
60
|
-
}
|
|
61
|
-
// 否则使用 name 字段
|
|
62
|
-
return item.name;
|
|
63
|
-
};
|
|
64
38
|
var MessageContent = function MessageContent(props) {
|
|
65
39
|
var hideOnSinglePage = props.hideOnSinglePage,
|
|
66
40
|
setVisible = props.setVisible,
|
|
@@ -80,6 +54,14 @@ var MessageContent = function MessageContent(props) {
|
|
|
80
54
|
var history = useHistory();
|
|
81
55
|
var _useThemeSwitcher = useThemeSwitcher(),
|
|
82
56
|
themeVars = _useThemeSwitcher.themeVars;
|
|
57
|
+
var intl = useIntl();
|
|
58
|
+
var _useConfigLocale = useConfigLocale(),
|
|
59
|
+
_useConfigLocale$loca = _useConfigLocale.locale,
|
|
60
|
+
locale = _useConfigLocale$loca === void 0 ? "zh_CN" : _useConfigLocale$loca;
|
|
61
|
+
var localeRef = useRef(locale);
|
|
62
|
+
localeRef.current = locale;
|
|
63
|
+
var listRequestRef = useRef(0);
|
|
64
|
+
var unreadRequestRef = useRef(0);
|
|
83
65
|
// tabs头部配置项
|
|
84
66
|
var _useState = useState([]),
|
|
85
67
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -104,56 +86,80 @@ var MessageContent = function MessageContent(props) {
|
|
|
104
86
|
_getMessageListApi = requestOption.getMessageListApi,
|
|
105
87
|
_getMessageUnreadCountApi = requestOption.getMessageUnreadCountApi;
|
|
106
88
|
useEffect(function () {
|
|
89
|
+
var cancelled = false;
|
|
107
90
|
_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
108
|
-
var resRequestApi, res, _data$, data, params;
|
|
91
|
+
var resRequestApi, res, _data$, data, selected, params;
|
|
109
92
|
return _regenerator().w(function (_context) {
|
|
110
93
|
while (1) switch (_context.n) {
|
|
111
94
|
case 0:
|
|
112
|
-
resRequestApi = _getMessageTypeApi ||
|
|
95
|
+
resRequestApi = _getMessageTypeApi || function (gateway) {
|
|
96
|
+
return getMessageTypeApi(gateway, locale);
|
|
97
|
+
};
|
|
113
98
|
_context.n = 1;
|
|
114
99
|
return resRequestApi(gatewayPrefix);
|
|
115
100
|
case 1:
|
|
116
101
|
res = _context.v;
|
|
102
|
+
if (!cancelled) {
|
|
103
|
+
_context.n = 2;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
return _context.a(2);
|
|
107
|
+
case 2:
|
|
117
108
|
if (res && res.status == "success") {
|
|
118
109
|
data = res.data;
|
|
119
110
|
setTabOption(data);
|
|
111
|
+
// The backend localizes name. Refresh on language changes without
|
|
112
|
+
// discarding the currently selected category or page conditions.
|
|
113
|
+
selected = data.find(function (item) {
|
|
114
|
+
return item.code === conditionsRef.current.type;
|
|
115
|
+
});
|
|
120
116
|
params = {
|
|
121
|
-
type: (_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.code
|
|
117
|
+
type: selected ? selected.code : (_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.code
|
|
122
118
|
};
|
|
123
119
|
getMessageList(params);
|
|
124
120
|
}
|
|
125
121
|
getMessageUnreadCount();
|
|
126
|
-
case
|
|
122
|
+
case 3:
|
|
127
123
|
return _context.a(2);
|
|
128
124
|
}
|
|
129
125
|
}, _callee);
|
|
130
126
|
}))();
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
127
|
+
return function () {
|
|
128
|
+
cancelled = true;
|
|
129
|
+
listRequestRef.current++;
|
|
130
|
+
unreadRequestRef.current++;
|
|
131
|
+
};
|
|
132
|
+
}, [locale]);
|
|
136
133
|
// 查询消息列表(接口)
|
|
137
134
|
var getMessageList = /*#__PURE__*/function () {
|
|
138
135
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(params) {
|
|
139
|
-
var resRequestApi, res, _res$data, _total, _res$data$records, records;
|
|
136
|
+
var requestId, resRequestApi, res, _res$data, _total, _res$data$records, records;
|
|
140
137
|
return _regenerator().w(function (_context2) {
|
|
141
138
|
while (1) switch (_context2.n) {
|
|
142
139
|
case 0:
|
|
140
|
+
requestId = ++listRequestRef.current;
|
|
143
141
|
setLoading(true);
|
|
144
142
|
conditionsRef.current = _objectSpread(_objectSpread({}, conditionsRef.current), params);
|
|
145
|
-
resRequestApi = _getMessageListApi ||
|
|
143
|
+
resRequestApi = _getMessageListApi || function (params, gateway) {
|
|
144
|
+
return getMessageListApi(params, gateway, locale);
|
|
145
|
+
};
|
|
146
146
|
_context2.n = 1;
|
|
147
147
|
return resRequestApi(conditionsRef.current, gatewayPrefix);
|
|
148
148
|
case 1:
|
|
149
149
|
res = _context2.v;
|
|
150
|
+
if (!(requestId !== listRequestRef.current || localeRef.current !== locale)) {
|
|
151
|
+
_context2.n = 2;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
return _context2.a(2);
|
|
155
|
+
case 2:
|
|
150
156
|
if (res && res.status == "success") {
|
|
151
157
|
_res$data = res.data, _total = _res$data.total, _res$data$records = _res$data.records, records = _res$data$records === void 0 ? [] : _res$data$records;
|
|
152
158
|
setDataSource(records);
|
|
153
159
|
setTotal(_total);
|
|
154
160
|
}
|
|
155
161
|
setLoading(false);
|
|
156
|
-
case
|
|
162
|
+
case 3:
|
|
157
163
|
return _context2.a(2);
|
|
158
164
|
}
|
|
159
165
|
}, _callee2);
|
|
@@ -165,21 +171,30 @@ var MessageContent = function MessageContent(props) {
|
|
|
165
171
|
// 查询所有类型的未读消息数(接口)
|
|
166
172
|
var getMessageUnreadCount = /*#__PURE__*/function () {
|
|
167
173
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
168
|
-
var resRequestApi, res, _res$data$byType, byType, _unreadTypeArr;
|
|
174
|
+
var requestId, resRequestApi, res, _res$data$byType, byType, _unreadTypeArr;
|
|
169
175
|
return _regenerator().w(function (_context3) {
|
|
170
176
|
while (1) switch (_context3.n) {
|
|
171
177
|
case 0:
|
|
172
|
-
|
|
178
|
+
requestId = ++unreadRequestRef.current;
|
|
179
|
+
resRequestApi = _getMessageUnreadCountApi || function (gateway) {
|
|
180
|
+
return getMessageUnreadCountApi(gateway, locale);
|
|
181
|
+
};
|
|
173
182
|
_context3.n = 1;
|
|
174
183
|
return resRequestApi(gatewayPrefix);
|
|
175
184
|
case 1:
|
|
176
185
|
res = _context3.v;
|
|
186
|
+
if (!(requestId !== unreadRequestRef.current || localeRef.current !== locale)) {
|
|
187
|
+
_context3.n = 2;
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
return _context3.a(2);
|
|
191
|
+
case 2:
|
|
177
192
|
if (res && res.status == "success") {
|
|
178
193
|
_res$data$byType = res.data.byType, byType = _res$data$byType === void 0 ? {} : _res$data$byType;
|
|
179
194
|
_unreadTypeArr = Object.keys(byType || {});
|
|
180
195
|
setUnreadTypeArr(_unreadTypeArr);
|
|
181
196
|
}
|
|
182
|
-
case
|
|
197
|
+
case 3:
|
|
183
198
|
return _context3.a(2);
|
|
184
199
|
}
|
|
185
200
|
}, _callee3);
|
|
@@ -234,7 +249,7 @@ var MessageContent = function MessageContent(props) {
|
|
|
234
249
|
total: total
|
|
235
250
|
};
|
|
236
251
|
};
|
|
237
|
-
var emptyDescription =
|
|
252
|
+
var emptyDescription = intl.get("fcdcd88b-3db8-4216-a93a-ab79d854408d").d("暂无新消息");
|
|
238
253
|
return /*#__PURE__*/React.createElement("div", {
|
|
239
254
|
className: "cw-message-content"
|
|
240
255
|
}, tabOption.length ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Tabs, {
|
|
@@ -242,8 +257,8 @@ var MessageContent = function MessageContent(props) {
|
|
|
242
257
|
className: "cw-message-content-tabs",
|
|
243
258
|
animated: false
|
|
244
259
|
}, tabOption.map(function (item) {
|
|
245
|
-
var tabName =
|
|
246
|
-
var moreTitle =
|
|
260
|
+
var tabName = item.name;
|
|
261
|
+
var moreTitle = intl.get("a30db643-5238-42bc-bc5e-98a9d0c7df51").d("更多");
|
|
247
262
|
return /*#__PURE__*/React.createElement(TabPane, {
|
|
248
263
|
tab: unreadTypeArr.includes(item.code) ? /*#__PURE__*/React.createElement(_Badge, {
|
|
249
264
|
color: themeVars["red-5"]
|
|
@@ -282,9 +297,9 @@ var MessageContent = function MessageContent(props) {
|
|
|
282
297
|
})));
|
|
283
298
|
})), total == 0 || hideOnSinglePage && total <= pageInfo.pageSize ? null : /*#__PURE__*/React.createElement("div", {
|
|
284
299
|
className: "cw-message-pagination-wrapper"
|
|
285
|
-
}, /*#__PURE__*/React.createElement("span", null,
|
|
300
|
+
}, /*#__PURE__*/React.createElement("span", null, intl.get("205d9305-0c9e-4384-a5e2-4e1bbdc4a76f", {
|
|
286
301
|
total: total
|
|
287
|
-
})), /*#__PURE__*/React.createElement(_Pagination, _extends({
|
|
302
|
+
}).d("共{total}条")), /*#__PURE__*/React.createElement(_Pagination, _extends({
|
|
288
303
|
simple: true
|
|
289
304
|
}, getPaginationOption())))) : /*#__PURE__*/React.createElement(_Empty, {
|
|
290
305
|
description: emptyDescription
|