@chaoswise/ui 2.7.11 → 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/Antd4/comment/index.js +1 -1
- package/lib/Antd4Form/FormItem.js +1 -1
- package/lib/BasicLayout/Nav.js +3 -5
- package/lib/BasicLayout/index.js +9 -10
- package/lib/CWCascader/rc-cascader/OptionList/Column.js +17 -18
- package/lib/CWMessage/MessageContent/TabList/index.js +19 -17
- package/lib/CWMessage/MessageContent/index.js +86 -73
- package/lib/CWMessage/index.js +62 -50
- 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 +39 -32
- package/lib/CWRangePicker/utils/index.js +45 -114
- package/lib/CWSelect/index.js +7 -10
- package/lib/CWTable/CWTable.js +23 -23
- 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/RangeDateTimePicker.js +3 -3
- 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 +12 -13
- 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 +22 -25
- package/lib/ModuleFederation/react-dynamic-remote-component/RemoteComponent.js +38 -39
- package/lib/ModuleFederation/react-dynamic-remote-component/load-module.js +22 -23
- package/lib/Pagination/index.js +14 -14
- package/lib/PolymerizationSearch/DropdownMenu.js +4 -2
- package/lib/PolymerizationSearch/index.js +7 -7
- package/lib/Progress/index.js +3 -6
- package/lib/QuickTransfer/DragList.js +3 -6
- package/lib/QuickTransfer/index.js +19 -22
- package/lib/RangePicker/components/ExtraTimeFooter.js +4 -7
- package/lib/SearchBar/OutSearch.js +9 -2
- package/lib/SearchBar/index.js +13 -16
- package/lib/SimpleCard/index.js +3 -1
- package/lib/SingleSpa/index.js +30 -26
- package/lib/ThemeProvider/Switcher.js +3 -1
- package/lib/TimeRangeSlider/Refresh/index.js +4 -7
- package/lib/TimeRangeSlider/TimeRangeSliderCmp/hooks/useMouse.js +3 -3
- package/lib/TimeRangeSlider/TimeSpan/index.js +6 -9
- package/lib/TimeRangeSlider/index.js +28 -24
- package/lib/TimeRangeSlider/utils/index.js +20 -100
- package/lib/TimeZoneSelect/index.js +21 -22
- 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 +14 -3
- 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/Card/index.less +0 -10
- 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/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/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
|
@@ -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";
|
|
@@ -17,7 +16,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
17
16
|
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; }
|
|
18
17
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
19
18
|
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); }
|
|
20
|
-
function
|
|
19
|
+
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 }; })(); }
|
|
20
|
+
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); }
|
|
21
21
|
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); }
|
|
22
22
|
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); }); }; }
|
|
23
23
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
@@ -26,40 +26,15 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
26
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; }
|
|
27
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; } }
|
|
28
28
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
29
|
+
import useIntl from '../../useIntl';
|
|
30
|
+
import useConfigLocale from '../../ConfigProvider/useLocale';
|
|
29
31
|
import React, { useState, useEffect, useRef } from "react";
|
|
30
32
|
import { getMessageTypeApi, getMessageListApi, getMessageUnreadCountApi } from "../service";
|
|
31
33
|
import TabList from "./TabList";
|
|
32
34
|
import { useHistory } from "react-router-dom";
|
|
33
|
-
import langConfig from "../locale";
|
|
34
|
-
import { formatMessage } from "../../utils";
|
|
35
35
|
import "./index.less";
|
|
36
36
|
var useThemeSwitcher = _ThemeProvider.useThemeSwitcher;
|
|
37
37
|
var TabPane = _Tabs.TabPane;
|
|
38
|
-
var localOptionsMap = {
|
|
39
|
-
en: "enName",
|
|
40
|
-
en_US: "enName",
|
|
41
|
-
zh_TW: "name",
|
|
42
|
-
zh: "name",
|
|
43
|
-
zh_CN: "name",
|
|
44
|
-
ja: "jaName",
|
|
45
|
-
ja_JP: "jaName"
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// 获取本地化字段名的方法,提供兜底逻辑
|
|
49
|
-
var getLocalizedField = function getLocalizedField(locale) {
|
|
50
|
-
return localOptionsMap[locale];
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// 获取本地化的 tab 名称,最终兜底到 name 字段
|
|
54
|
-
var getLocalizedTabName = function getLocalizedTabName(item, locale) {
|
|
55
|
-
var fieldName = getLocalizedField(locale);
|
|
56
|
-
// 判断 item 中是否包含转换后的字段
|
|
57
|
-
if (fieldName && fieldName in item) {
|
|
58
|
-
return item[fieldName];
|
|
59
|
-
}
|
|
60
|
-
// 否则使用 name 字段
|
|
61
|
-
return item.name;
|
|
62
|
-
};
|
|
63
38
|
var MessageContent = function MessageContent(props) {
|
|
64
39
|
var hideOnSinglePage = props.hideOnSinglePage,
|
|
65
40
|
setVisible = props.setVisible,
|
|
@@ -79,6 +54,14 @@ var MessageContent = function MessageContent(props) {
|
|
|
79
54
|
var history = useHistory();
|
|
80
55
|
var _useThemeSwitcher = useThemeSwitcher(),
|
|
81
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);
|
|
82
65
|
// tabs头部配置项
|
|
83
66
|
var _useState = useState([]),
|
|
84
67
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -103,59 +86,81 @@ var MessageContent = function MessageContent(props) {
|
|
|
103
86
|
_getMessageListApi = requestOption.getMessageListApi,
|
|
104
87
|
_getMessageUnreadCountApi = requestOption.getMessageUnreadCountApi;
|
|
105
88
|
useEffect(function () {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
89
|
+
var cancelled = false;
|
|
90
|
+
_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
91
|
+
var resRequestApi, res, _data$, data, selected, params;
|
|
92
|
+
return _regenerator().w(function (_context) {
|
|
93
|
+
while (1) switch (_context.n) {
|
|
110
94
|
case 0:
|
|
111
|
-
resRequestApi = _getMessageTypeApi ||
|
|
112
|
-
|
|
95
|
+
resRequestApi = _getMessageTypeApi || function (gateway) {
|
|
96
|
+
return getMessageTypeApi(gateway, locale);
|
|
97
|
+
};
|
|
98
|
+
_context.n = 1;
|
|
113
99
|
return resRequestApi(gatewayPrefix);
|
|
114
|
-
case
|
|
115
|
-
res = _context.
|
|
100
|
+
case 1:
|
|
101
|
+
res = _context.v;
|
|
102
|
+
if (!cancelled) {
|
|
103
|
+
_context.n = 2;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
return _context.a(2);
|
|
107
|
+
case 2:
|
|
116
108
|
if (res && res.status == "success") {
|
|
117
109
|
data = res.data;
|
|
118
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
|
+
});
|
|
119
116
|
params = {
|
|
120
|
-
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
|
|
121
118
|
};
|
|
122
119
|
getMessageList(params);
|
|
123
120
|
}
|
|
124
121
|
getMessageUnreadCount();
|
|
125
|
-
case
|
|
126
|
-
|
|
127
|
-
return _context.stop();
|
|
122
|
+
case 3:
|
|
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
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/
|
|
139
|
-
var resRequestApi, res, _res$data, _total, _res$data$records, records;
|
|
140
|
-
return
|
|
141
|
-
while (1) switch (_context2.
|
|
135
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(params) {
|
|
136
|
+
var requestId, resRequestApi, res, _res$data, _total, _res$data$records, records;
|
|
137
|
+
return _regenerator().w(function (_context2) {
|
|
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 ||
|
|
146
|
-
|
|
143
|
+
resRequestApi = _getMessageListApi || function (params, gateway) {
|
|
144
|
+
return getMessageListApi(params, gateway, locale);
|
|
145
|
+
};
|
|
146
|
+
_context2.n = 1;
|
|
147
147
|
return resRequestApi(conditionsRef.current, gatewayPrefix);
|
|
148
|
-
case
|
|
149
|
-
res = _context2.
|
|
148
|
+
case 1:
|
|
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
|
|
157
|
-
|
|
158
|
-
return _context2.stop();
|
|
162
|
+
case 3:
|
|
163
|
+
return _context2.a(2);
|
|
159
164
|
}
|
|
160
165
|
}, _callee2);
|
|
161
166
|
}));
|
|
@@ -165,24 +170,32 @@ var MessageContent = function MessageContent(props) {
|
|
|
165
170
|
}();
|
|
166
171
|
// 查询所有类型的未读消息数(接口)
|
|
167
172
|
var getMessageUnreadCount = /*#__PURE__*/function () {
|
|
168
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/
|
|
169
|
-
var resRequestApi, res, _res$data$byType, byType, _unreadTypeArr;
|
|
170
|
-
return
|
|
171
|
-
while (1) switch (_context3.
|
|
173
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
174
|
+
var requestId, resRequestApi, res, _res$data$byType, byType, _unreadTypeArr;
|
|
175
|
+
return _regenerator().w(function (_context3) {
|
|
176
|
+
while (1) switch (_context3.n) {
|
|
172
177
|
case 0:
|
|
173
|
-
|
|
174
|
-
|
|
178
|
+
requestId = ++unreadRequestRef.current;
|
|
179
|
+
resRequestApi = _getMessageUnreadCountApi || function (gateway) {
|
|
180
|
+
return getMessageUnreadCountApi(gateway, locale);
|
|
181
|
+
};
|
|
182
|
+
_context3.n = 1;
|
|
175
183
|
return resRequestApi(gatewayPrefix);
|
|
176
|
-
case
|
|
177
|
-
res = _context3.
|
|
184
|
+
case 1:
|
|
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:
|
|
178
192
|
if (res && res.status == "success") {
|
|
179
193
|
_res$data$byType = res.data.byType, byType = _res$data$byType === void 0 ? {} : _res$data$byType;
|
|
180
194
|
_unreadTypeArr = Object.keys(byType || {});
|
|
181
195
|
setUnreadTypeArr(_unreadTypeArr);
|
|
182
196
|
}
|
|
183
|
-
case
|
|
184
|
-
|
|
185
|
-
return _context3.stop();
|
|
197
|
+
case 3:
|
|
198
|
+
return _context3.a(2);
|
|
186
199
|
}
|
|
187
200
|
}, _callee3);
|
|
188
201
|
}));
|
|
@@ -236,7 +249,7 @@ var MessageContent = function MessageContent(props) {
|
|
|
236
249
|
total: total
|
|
237
250
|
};
|
|
238
251
|
};
|
|
239
|
-
var emptyDescription =
|
|
252
|
+
var emptyDescription = intl.get("fcdcd88b-3db8-4216-a93a-ab79d854408d").d("暂无新消息");
|
|
240
253
|
return /*#__PURE__*/React.createElement("div", {
|
|
241
254
|
className: "cw-message-content"
|
|
242
255
|
}, tabOption.length ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Tabs, {
|
|
@@ -244,8 +257,8 @@ var MessageContent = function MessageContent(props) {
|
|
|
244
257
|
className: "cw-message-content-tabs",
|
|
245
258
|
animated: false
|
|
246
259
|
}, tabOption.map(function (item) {
|
|
247
|
-
var tabName =
|
|
248
|
-
var moreTitle =
|
|
260
|
+
var tabName = item.name;
|
|
261
|
+
var moreTitle = intl.get("a30db643-5238-42bc-bc5e-98a9d0c7df51").d("更多");
|
|
249
262
|
return /*#__PURE__*/React.createElement(TabPane, {
|
|
250
263
|
tab: unreadTypeArr.includes(item.code) ? /*#__PURE__*/React.createElement(_Badge, {
|
|
251
264
|
color: themeVars["red-5"]
|
|
@@ -284,9 +297,9 @@ var MessageContent = function MessageContent(props) {
|
|
|
284
297
|
})));
|
|
285
298
|
})), total == 0 || hideOnSinglePage && total <= pageInfo.pageSize ? null : /*#__PURE__*/React.createElement("div", {
|
|
286
299
|
className: "cw-message-pagination-wrapper"
|
|
287
|
-
}, /*#__PURE__*/React.createElement("span", null,
|
|
300
|
+
}, /*#__PURE__*/React.createElement("span", null, intl.get("205d9305-0c9e-4384-a5e2-4e1bbdc4a76f", {
|
|
288
301
|
total: total
|
|
289
|
-
})), /*#__PURE__*/React.createElement(_Pagination, _extends({
|
|
302
|
+
}).d("共{total}条")), /*#__PURE__*/React.createElement(_Pagination, _extends({
|
|
290
303
|
simple: true
|
|
291
304
|
}, getPaginationOption())))) : /*#__PURE__*/React.createElement(_Empty, {
|
|
292
305
|
description: emptyDescription
|
package/lib/CWMessage/index.js
CHANGED
|
@@ -6,12 +6,12 @@ import "@chaoswise/ui/lib/Modal/index.less";
|
|
|
6
6
|
import _Modal from "@chaoswise/ui/lib/Modal";
|
|
7
7
|
import "@chaoswise/ui/lib/CustomNotification/index.less";
|
|
8
8
|
import _CustomNotification from "@chaoswise/ui/lib/CustomNotification";
|
|
9
|
-
import _useLocale2 from "@chaoswise/ui/lib/useLocale";
|
|
10
9
|
import _useConfigContext2 from "@chaoswise/ui/lib/useConfigContext";
|
|
11
10
|
var _excluded = ["count"],
|
|
12
11
|
_excluded2 = ["onClickStrongMessageItem"];
|
|
13
12
|
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); }
|
|
14
|
-
function
|
|
13
|
+
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 }; })(); }
|
|
14
|
+
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); }
|
|
15
15
|
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); }
|
|
16
16
|
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); }); }; }
|
|
17
17
|
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; }
|
|
@@ -27,6 +27,8 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
27
27
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
28
28
|
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; }
|
|
29
29
|
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; }
|
|
30
|
+
import useIntl from '../useIntl';
|
|
31
|
+
import useConfigLocale from '../ConfigProvider/useLocale';
|
|
30
32
|
import React, { useState, useEffect, useMemo, useRef } from "react";
|
|
31
33
|
import messageIcon from "./message.svg";
|
|
32
34
|
import CommonIcon from "./CommonIcon";
|
|
@@ -36,8 +38,6 @@ import classnames from "classnames";
|
|
|
36
38
|
import PropTypes from "prop-types";
|
|
37
39
|
import io from "socket.io-client";
|
|
38
40
|
import audioMp3 from "./audioMp3.wav";
|
|
39
|
-
import langConfig from "./locale";
|
|
40
|
-
import { formatMessage } from "../utils";
|
|
41
41
|
import "./index.less";
|
|
42
42
|
function Message(props) {
|
|
43
43
|
var _props$hideOnSinglePa = props.hideOnSinglePage,
|
|
@@ -75,8 +75,14 @@ function Message(props) {
|
|
|
75
75
|
var _useConfigContext = _useConfigContext2(),
|
|
76
76
|
getPrefixCls = _useConfigContext.getPrefixCls;
|
|
77
77
|
var prefixCls = getPrefixCls();
|
|
78
|
-
var
|
|
79
|
-
|
|
78
|
+
var intl = useIntl();
|
|
79
|
+
var intlRef = useRef(intl);
|
|
80
|
+
intlRef.current = intl;
|
|
81
|
+
var _useConfigLocale = useConfigLocale(),
|
|
82
|
+
locale = _useConfigLocale.locale;
|
|
83
|
+
// Socket listeners outlive renders; default requests must use the latest language.
|
|
84
|
+
var localeRef = useRef(locale);
|
|
85
|
+
localeRef.current = locale;
|
|
80
86
|
var messageImg = imgOption.messageImg,
|
|
81
87
|
_imgOption$badgeOptio = imgOption.badgeOption,
|
|
82
88
|
badgeOption = _imgOption$badgeOptio === void 0 ? {} : _imgOption$badgeOptio;
|
|
@@ -115,9 +121,9 @@ function Message(props) {
|
|
|
115
121
|
current: 1,
|
|
116
122
|
pageSize: 30
|
|
117
123
|
}),
|
|
118
|
-
|
|
119
|
-
pageInfo =
|
|
120
|
-
setPageInfo =
|
|
124
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
125
|
+
pageInfo = _useState0[0],
|
|
126
|
+
setPageInfo = _useState0[1];
|
|
121
127
|
// 初始化条件
|
|
122
128
|
var conditionsRef = useRef({
|
|
123
129
|
current: 1,
|
|
@@ -188,20 +194,22 @@ function Message(props) {
|
|
|
188
194
|
audio.play()["catch"](function (err) {
|
|
189
195
|
var _err$message;
|
|
190
196
|
if ((err === null || err === void 0 ? void 0 : err.name) === "NotAllowedError" && err !== null && err !== void 0 && (_err$message = err.message) !== null && _err$message !== void 0 && _err$message.includes('play() failed')) {
|
|
197
|
+
var _intl = intlRef.current;
|
|
191
198
|
if (!modal.current) {
|
|
192
199
|
modal.current = _Modal.warning({
|
|
193
|
-
title:
|
|
200
|
+
title: _intl.get("de6eaecc-9d39-41f1-82d3-80694c558028").d("消息提醒需要有交互行为才可以自动播放"),
|
|
194
201
|
prefixCls: "".concat(prefixCls, "-modal"),
|
|
195
202
|
okButtonProps: {
|
|
196
203
|
prefixCls: "".concat(prefixCls, "-btn")
|
|
197
204
|
},
|
|
198
|
-
okText:
|
|
205
|
+
okText: _intl.get("4253417c-d699-4eed-8c75-34d2a8b18a68").d("确定"),
|
|
199
206
|
mask: true,
|
|
200
207
|
maskClosable: true
|
|
201
208
|
});
|
|
202
209
|
} else {
|
|
203
|
-
modal.current.update(
|
|
204
|
-
|
|
210
|
+
modal.current.update({
|
|
211
|
+
title: _intl.get("de6eaecc-9d39-41f1-82d3-80694c558028").d("消息提醒需要有交互行为才可以自动播放"),
|
|
212
|
+
okText: _intl.get("4253417c-d699-4eed-8c75-34d2a8b18a68").d("确定")
|
|
205
213
|
});
|
|
206
214
|
}
|
|
207
215
|
}
|
|
@@ -209,20 +217,22 @@ function Message(props) {
|
|
|
209
217
|
}
|
|
210
218
|
};
|
|
211
219
|
var openNotification = /*#__PURE__*/function () {
|
|
212
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
220
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(time, id) {
|
|
213
221
|
var params, resRequestApi, res, data, _ref2, userMessageId, title, summary;
|
|
214
|
-
return
|
|
215
|
-
while (1) switch (_context.
|
|
222
|
+
return _regenerator().w(function (_context) {
|
|
223
|
+
while (1) switch (_context.n) {
|
|
216
224
|
case 0:
|
|
217
225
|
params = {
|
|
218
226
|
userMessageId: id,
|
|
219
227
|
clientType: "BROWSER"
|
|
220
228
|
};
|
|
221
|
-
resRequestApi = _getMessageDetailApi ||
|
|
222
|
-
|
|
229
|
+
resRequestApi = _getMessageDetailApi || function (params, gateway) {
|
|
230
|
+
return getMessageDetailApi(params, gateway, localeRef.current);
|
|
231
|
+
};
|
|
232
|
+
_context.n = 1;
|
|
223
233
|
return resRequestApi(params, gatewayPrefix);
|
|
224
|
-
case
|
|
225
|
-
res = _context.
|
|
234
|
+
case 1:
|
|
235
|
+
res = _context.v;
|
|
226
236
|
if (res && res.status == "success") {
|
|
227
237
|
data = res.data;
|
|
228
238
|
_ref2 = data || {}, userMessageId = _ref2.userMessageId, title = _ref2.title, summary = _ref2.summary; // 消息语音提示
|
|
@@ -245,9 +255,8 @@ function Message(props) {
|
|
|
245
255
|
key: id
|
|
246
256
|
}, restStrongMessageOption));
|
|
247
257
|
}
|
|
248
|
-
case
|
|
249
|
-
|
|
250
|
-
return _context.stop();
|
|
258
|
+
case 2:
|
|
259
|
+
return _context.a(2);
|
|
251
260
|
}
|
|
252
261
|
}, _callee);
|
|
253
262
|
}));
|
|
@@ -256,16 +265,17 @@ function Message(props) {
|
|
|
256
265
|
};
|
|
257
266
|
}();
|
|
258
267
|
var readInnerMessage = /*#__PURE__*/function () {
|
|
259
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/
|
|
268
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(params) {
|
|
260
269
|
var resRequestApi;
|
|
261
|
-
return
|
|
262
|
-
while (1) switch (_context2.
|
|
270
|
+
return _regenerator().w(function (_context2) {
|
|
271
|
+
while (1) switch (_context2.n) {
|
|
263
272
|
case 0:
|
|
264
|
-
resRequestApi = _readInnerMessageApi ||
|
|
273
|
+
resRequestApi = _readInnerMessageApi || function (params, gateway) {
|
|
274
|
+
return readInnerMessageApi(params, gateway, localeRef.current);
|
|
275
|
+
};
|
|
265
276
|
resRequestApi(params, gatewayPrefix);
|
|
266
|
-
case
|
|
267
|
-
|
|
268
|
-
return _context2.stop();
|
|
277
|
+
case 1:
|
|
278
|
+
return _context2.a(2);
|
|
269
279
|
}
|
|
270
280
|
}, _callee2);
|
|
271
281
|
}));
|
|
@@ -302,17 +312,19 @@ function Message(props) {
|
|
|
302
312
|
}
|
|
303
313
|
};
|
|
304
314
|
var connectSocket = /*#__PURE__*/function () {
|
|
305
|
-
var _ref6 = _asyncToGenerator(/*#__PURE__*/
|
|
315
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
306
316
|
var resRequestApi, res, finalOrigin, socket;
|
|
307
|
-
return
|
|
308
|
-
while (1) switch (_context3.
|
|
317
|
+
return _regenerator().w(function (_context3) {
|
|
318
|
+
while (1) switch (_context3.n) {
|
|
309
319
|
case 0:
|
|
310
320
|
// 获取sessionId
|
|
311
|
-
resRequestApi = _getSessionId ||
|
|
312
|
-
|
|
321
|
+
resRequestApi = _getSessionId || function (gateway) {
|
|
322
|
+
return getSessionId(gateway, localeRef.current);
|
|
323
|
+
};
|
|
324
|
+
_context3.n = 1;
|
|
313
325
|
return resRequestApi(gatewayPrefix);
|
|
314
|
-
case
|
|
315
|
-
res = _context3.
|
|
326
|
+
case 1:
|
|
327
|
+
res = _context3.v;
|
|
316
328
|
if (res && res.status == "success") {
|
|
317
329
|
finalOrigin = socketOrigin || "ws://".concat(window.location.host); // 连接到后端socket服务器
|
|
318
330
|
socket = io(finalOrigin, {
|
|
@@ -334,9 +346,8 @@ function Message(props) {
|
|
|
334
346
|
};
|
|
335
347
|
});
|
|
336
348
|
}
|
|
337
|
-
case
|
|
338
|
-
|
|
339
|
-
return _context3.stop();
|
|
349
|
+
case 2:
|
|
350
|
+
return _context3.a(2);
|
|
340
351
|
}
|
|
341
352
|
}, _callee3);
|
|
342
353
|
}));
|
|
@@ -345,23 +356,24 @@ function Message(props) {
|
|
|
345
356
|
};
|
|
346
357
|
}();
|
|
347
358
|
var getMessageQuerySettings = /*#__PURE__*/function () {
|
|
348
|
-
var _ref7 = _asyncToGenerator(/*#__PURE__*/
|
|
359
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
349
360
|
var resRequestApi, res, data;
|
|
350
|
-
return
|
|
351
|
-
while (1) switch (_context4.
|
|
361
|
+
return _regenerator().w(function (_context4) {
|
|
362
|
+
while (1) switch (_context4.n) {
|
|
352
363
|
case 0:
|
|
353
|
-
resRequestApi = _getMessageQuerySettingsApi ||
|
|
354
|
-
|
|
364
|
+
resRequestApi = _getMessageQuerySettingsApi || function (gateway) {
|
|
365
|
+
return getMessageQuerySettingsApi(gateway, localeRef.current);
|
|
366
|
+
};
|
|
367
|
+
_context4.n = 1;
|
|
355
368
|
return resRequestApi(gatewayPrefix);
|
|
356
|
-
case
|
|
357
|
-
res = _context4.
|
|
369
|
+
case 1:
|
|
370
|
+
res = _context4.v;
|
|
358
371
|
if (res && res.status === "success") {
|
|
359
372
|
data = res.data;
|
|
360
373
|
messageOptionRef.current = data || {};
|
|
361
374
|
}
|
|
362
|
-
case
|
|
363
|
-
|
|
364
|
-
return _context4.stop();
|
|
375
|
+
case 2:
|
|
376
|
+
return _context4.a(2);
|
|
365
377
|
}
|
|
366
378
|
}, _callee4);
|
|
367
379
|
}));
|