@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.
Files changed (214) hide show
  1. package/lib/AlgorithmChart/common/chart.option.js +14 -11
  2. package/lib/AlgorithmChart/index.js +29 -26
  3. package/lib/Antd4Form/FormItem.js +1 -1
  4. package/lib/BasicLayout/Nav.js +3 -5
  5. package/lib/BasicLayout/index.js +6 -7
  6. package/lib/CWMessage/MessageContent/TabList/index.js +9 -7
  7. package/lib/CWMessage/MessageContent/index.js +63 -48
  8. package/lib/CWMessage/index.js +28 -13
  9. package/lib/CWMessage/service/index.js +14 -14
  10. package/lib/CWMessage/utils/index.js +18 -11
  11. package/lib/CWRangePicker/DropdownMenu/MoreHistoryList/index.js +16 -10
  12. package/lib/CWRangePicker/DropdownMenu/MoreTimeList/index.js +4 -6
  13. package/lib/CWRangePicker/DropdownMenu/index.js +20 -13
  14. package/lib/CWRangePicker/Refresh/index.js +4 -7
  15. package/lib/CWRangePicker/TimeSpan/index.js +6 -9
  16. package/lib/CWRangePicker/index.js +28 -21
  17. package/lib/CWRangePicker/utils/index.js +45 -114
  18. package/lib/CWSelect/index.js +4 -7
  19. package/lib/CWTable/EditLine.js +5 -8
  20. package/lib/CWTable/Filter.js +5 -8
  21. package/lib/CWTable/index.js +3 -0
  22. package/lib/CWTree/index.js +4 -7
  23. package/lib/CWUpload/upload/Dragger.js +4 -7
  24. package/lib/CWUpload/upload/UploadList.js +12 -15
  25. package/lib/CardSelect/index.js +16 -14
  26. package/lib/CitySelect/index.js +3 -1
  27. package/lib/ColorPicker/index.js +4 -7
  28. package/lib/ConfigProvider/ConfigProvider.js +143 -48
  29. package/lib/ConfigProvider/Switch.js +10 -2
  30. package/lib/ConfigProvider/context.js +8 -0
  31. package/lib/ConfigProvider/useLocale.js +1 -1
  32. package/lib/DatePicker/useLocale.js +17 -10
  33. package/lib/DateRangePicker/components/ExtraQuickFooter.js +5 -8
  34. package/lib/DateRangePicker/index.js +6 -5
  35. package/lib/DropdownDatePicker/DropdownMenu/MoreTimeList/index.js +4 -6
  36. package/lib/DropdownDatePicker/DropdownMenu/index.js +4 -7
  37. package/lib/DropdownDatePicker/index.js +9 -10
  38. package/lib/DropdownDatePicker/utils/index.js +5 -93
  39. package/lib/EchartsBar/index.js +1 -1
  40. package/lib/Empty/index.js +3 -6
  41. package/lib/ErrorBoundary/ErrorPage.js +8 -9
  42. package/lib/Exception/index.js +9 -12
  43. package/lib/FilterDropDown/index.js +3 -6
  44. package/lib/Flow/tools/index.js +4 -1
  45. package/lib/Header/Document/index.js +3 -8
  46. package/lib/Header/LocaleSwitcher.js +2 -0
  47. package/lib/Header/UserSetting/index.js +27 -45
  48. package/lib/IconSelect/components/CustomImg/index.js +8 -11
  49. package/lib/IconSelect/components/SearchIcon/index.js +9 -9
  50. package/lib/IconSelect/index.js +4 -7
  51. package/lib/ImagePreview/index.js +3 -1
  52. package/lib/Joyride/List.js +9 -8
  53. package/lib/Joyride/index.js +19 -22
  54. package/lib/Pagination/index.js +14 -14
  55. package/lib/PolymerizationSearch/DropdownMenu.js +4 -2
  56. package/lib/Progress/index.js +3 -6
  57. package/lib/QuickTransfer/DragList.js +3 -6
  58. package/lib/QuickTransfer/index.js +6 -9
  59. package/lib/RangePicker/components/ExtraTimeFooter.js +4 -7
  60. package/lib/SearchBar/index.js +6 -9
  61. package/lib/SimpleCard/index.js +3 -1
  62. package/lib/SingleSpa/index.js +10 -4
  63. package/lib/ThemeProvider/Switcher.js +3 -1
  64. package/lib/TimeRangeSlider/Refresh/index.js +4 -7
  65. package/lib/TimeRangeSlider/TimeSpan/index.js +6 -9
  66. package/lib/TimeRangeSlider/index.js +22 -18
  67. package/lib/TimeRangeSlider/utils/index.js +20 -100
  68. package/lib/TimeZoneSelect/index.js +1 -1
  69. package/lib/TreeSelect111/index.js +3 -6
  70. package/lib/Upload-back/index.js +27 -25
  71. package/lib/VerticalLayout/index.js +3 -1
  72. package/lib/WangEditor/extraLanguage.js +19 -0
  73. package/lib/WangEditor/index.js +19 -13
  74. package/lib/WangEditor/messages.js +49 -0
  75. package/lib/WangEditor/wangEditor.js +47 -20
  76. package/lib/index.js +1 -0
  77. package/lib/locales/en_US.json +1 -0
  78. package/lib/locales/index.js +2 -0
  79. package/lib/locales/ja_JP.json +1 -0
  80. package/lib/locales/load.js +48 -0
  81. package/lib/locales/messages/antd.js +404 -0
  82. package/lib/locales/messages/editor.js +42 -0
  83. package/lib/locales/messages/timeRanges.js +36 -0
  84. package/lib/locales/messages/timeTypes.js +11 -0
  85. package/lib/locales/runtime.js +127 -0
  86. package/lib/locales/zh_CN.json +1 -0
  87. package/lib/locales/zh_HK.json +1 -0
  88. package/lib/locales/zh_TW.json +1 -0
  89. package/lib/useIntl/index.js +9 -0
  90. package/lib/useLocale/index.js +16 -13
  91. package/lib/utils/index.js +4 -1
  92. package/package.json +11 -2
  93. package/lib/Antd4/notification/index.copy.js +0 -301
  94. package/lib/BasicLayout/locale/en_US.js +0 -4
  95. package/lib/BasicLayout/locale/index.js +0 -13
  96. package/lib/BasicLayout/locale/ja_JP.js +0 -4
  97. package/lib/BasicLayout/locale/zh_CN.js +0 -4
  98. package/lib/BasicLayout/locale/zh_TW.js +0 -4
  99. package/lib/CWMessage/locale/en_US.js +0 -8
  100. package/lib/CWMessage/locale/index.js +0 -13
  101. package/lib/CWMessage/locale/ja_JP.js +0 -8
  102. package/lib/CWMessage/locale/zh_CN.js +0 -8
  103. package/lib/CWMessage/locale/zh_TW.js +0 -8
  104. package/lib/CWRangePicker/locale/en_US.js +0 -29
  105. package/lib/CWRangePicker/locale/index.js +0 -13
  106. package/lib/CWRangePicker/locale/ja_JP.js +0 -29
  107. package/lib/CWRangePicker/locale/zh_CN.js +0 -29
  108. package/lib/CWRangePicker/locale/zh_TW.js +0 -29
  109. package/lib/CWSelect/locale/en_US.js +0 -4
  110. package/lib/CWSelect/locale/index.js +0 -13
  111. package/lib/CWSelect/locale/ja_JP.js +0 -4
  112. package/lib/CWSelect/locale/zh_CN.js +0 -4
  113. package/lib/CWSelect/locale/zh_TW.js +0 -4
  114. package/lib/CWTable/locale/en_US.js +0 -6
  115. package/lib/CWTable/locale/index.js +0 -13
  116. package/lib/CWTable/locale/ja_JP.js +0 -6
  117. package/lib/CWTable/locale/zh_CN.js +0 -6
  118. package/lib/CWTable/locale/zh_TW.js +0 -6
  119. package/lib/CWTree/locale/en_US.js +0 -3
  120. package/lib/CWTree/locale/index.js +0 -13
  121. package/lib/CWTree/locale/ja_JP.js +0 -3
  122. package/lib/CWTree/locale/zh_CN.js +0 -3
  123. package/lib/CWTree/locale/zh_TW.js +0 -3
  124. package/lib/CWUpload/locale/en_US.js +0 -6
  125. package/lib/CWUpload/locale/index.js +0 -13
  126. package/lib/CWUpload/locale/ja_JP.js +0 -6
  127. package/lib/CWUpload/locale/zh_CN.js +0 -6
  128. package/lib/CWUpload/locale/zh_TW.js +0 -6
  129. package/lib/ColorPicker/locale/en_US.js +0 -4
  130. package/lib/ColorPicker/locale/index.js +0 -13
  131. package/lib/ColorPicker/locale/ja_JP.js +0 -4
  132. package/lib/ColorPicker/locale/zh_CN.js +0 -4
  133. package/lib/ColorPicker/locale/zh_TW.js +0 -4
  134. package/lib/DateRangePicker/locale/en_US.js +0 -5
  135. package/lib/DateRangePicker/locale/index.js +0 -13
  136. package/lib/DateRangePicker/locale/ja_JP.js +0 -5
  137. package/lib/DateRangePicker/locale/zh_CN.js +0 -5
  138. package/lib/DateRangePicker/locale/zh_TW.js +0 -5
  139. package/lib/DropdownDatePicker/locale/en_US.js +0 -21
  140. package/lib/DropdownDatePicker/locale/index.js +0 -13
  141. package/lib/DropdownDatePicker/locale/ja_JP.js +0 -21
  142. package/lib/DropdownDatePicker/locale/zh_CN.js +0 -21
  143. package/lib/DropdownDatePicker/locale/zh_TW.js +0 -21
  144. package/lib/Empty/locale/en_US.js +0 -3
  145. package/lib/Empty/locale/index.js +0 -13
  146. package/lib/Empty/locale/ja_JP.js +0 -3
  147. package/lib/Empty/locale/zh_CN.js +0 -3
  148. package/lib/Empty/locale/zh_TW.js +0 -3
  149. package/lib/ErrorBoundary/index.less +0 -15
  150. package/lib/ErrorBoundary/locale/en_US.js +0 -5
  151. package/lib/ErrorBoundary/locale/index.js +0 -13
  152. package/lib/ErrorBoundary/locale/ja_JP.js +0 -5
  153. package/lib/ErrorBoundary/locale/zh_CN.js +0 -5
  154. package/lib/ErrorBoundary/locale/zh_TW.js +0 -5
  155. package/lib/Exception/locale/en_US.js +0 -9
  156. package/lib/Exception/locale/index.js +0 -13
  157. package/lib/Exception/locale/ja_JP.js +0 -9
  158. package/lib/Exception/locale/zh_CN.js +0 -9
  159. package/lib/Exception/locale/zh_TW.js +0 -9
  160. package/lib/FilterDropDown/drag.svg +0 -17
  161. package/lib/FilterDropDown/locale/en_US.js +0 -3
  162. package/lib/FilterDropDown/locale/index.js +0 -13
  163. package/lib/FilterDropDown/locale/ja_JP.js +0 -3
  164. package/lib/FilterDropDown/locale/zh_CN.js +0 -3
  165. package/lib/FilterDropDown/locale/zh_TW.js +0 -3
  166. package/lib/IconSelect/locale/en_US.js +0 -11
  167. package/lib/IconSelect/locale/index.js +0 -13
  168. package/lib/IconSelect/locale/ja_JP.js +0 -11
  169. package/lib/IconSelect/locale/zh_CN.js +0 -11
  170. package/lib/IconSelect/locale/zh_TW.js +0 -11
  171. package/lib/Joyride/locale/en_US.js +0 -25
  172. package/lib/Joyride/locale/index.js +0 -13
  173. package/lib/Joyride/locale/ja_JP.js +0 -25
  174. package/lib/Joyride/locale/zh_CN.js +0 -25
  175. package/lib/Joyride/locale/zh_TW.js +0 -25
  176. package/lib/Pagination/locale/en_US.js +0 -8
  177. package/lib/Pagination/locale/index.js +0 -13
  178. package/lib/Pagination/locale/ja_JP.js +0 -8
  179. package/lib/Pagination/locale/zh_CN.js +0 -8
  180. package/lib/Pagination/locale/zh_TW.js +0 -8
  181. package/lib/Progress/locale/en_US.js +0 -3
  182. package/lib/Progress/locale/index.js +0 -13
  183. package/lib/Progress/locale/ja_JP.js +0 -3
  184. package/lib/Progress/locale/zh_CN.js +0 -3
  185. package/lib/Progress/locale/zh_TW.js +0 -3
  186. package/lib/QuickTransfer/CheckList.js +0 -47
  187. package/lib/QuickTransfer/TopicList.js +0 -152
  188. package/lib/QuickTransfer/locale/en_US.js +0 -8
  189. package/lib/QuickTransfer/locale/index.js +0 -13
  190. package/lib/QuickTransfer/locale/ja_JP.js +0 -8
  191. package/lib/QuickTransfer/locale/zh_CN.js +0 -8
  192. package/lib/QuickTransfer/locale/zh_TW.js +0 -8
  193. package/lib/RangePicker/locale/en_US.js +0 -5
  194. package/lib/RangePicker/locale/index.js +0 -13
  195. package/lib/RangePicker/locale/ja_JP.js +0 -5
  196. package/lib/RangePicker/locale/zh_CN.js +0 -5
  197. package/lib/RangePicker/locale/zh_TW.js +0 -5
  198. package/lib/SearchBar/locale/en_US.js +0 -6
  199. package/lib/SearchBar/locale/index.js +0 -13
  200. package/lib/SearchBar/locale/ja_JP.js +0 -6
  201. package/lib/SearchBar/locale/zh_CN.js +0 -6
  202. package/lib/SearchBar/locale/zh_TW.js +0 -6
  203. package/lib/TimeRangeSlider/locale/en_US.js +0 -31
  204. package/lib/TimeRangeSlider/locale/index.js +0 -13
  205. package/lib/TimeRangeSlider/locale/ja_JP.js +0 -31
  206. package/lib/TimeRangeSlider/locale/zh_CN.js +0 -31
  207. package/lib/TimeRangeSlider/locale/zh_TW.js +0 -31
  208. package/lib/TreeSelect111/locale/en_US.js +0 -3
  209. package/lib/TreeSelect111/locale/index.js +0 -13
  210. package/lib/TreeSelect111/locale/ja_JP.js +0 -3
  211. package/lib/TreeSelect111/locale/zh_CN.js +0 -3
  212. package/lib/TreeSelect111/locale/zh_TW.js +0 -3
  213. package/lib/WangEditor/locale/index.js +0 -93
  214. package/lib/useConfgiContext/index.js +0 -6
@@ -6,7 +6,6 @@ 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"];
@@ -28,6 +27,8 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
28
27
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
29
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; }
30
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';
31
32
  import React, { useState, useEffect, useMemo, useRef } from "react";
32
33
  import messageIcon from "./message.svg";
33
34
  import CommonIcon from "./CommonIcon";
@@ -37,8 +38,6 @@ import classnames from "classnames";
37
38
  import PropTypes from "prop-types";
38
39
  import io from "socket.io-client";
39
40
  import audioMp3 from "./audioMp3.wav";
40
- import langConfig from "./locale";
41
- import { formatMessage } from "../utils";
42
41
  import "./index.less";
43
42
  function Message(props) {
44
43
  var _props$hideOnSinglePa = props.hideOnSinglePage,
@@ -76,8 +75,14 @@ function Message(props) {
76
75
  var _useConfigContext = _useConfigContext2(),
77
76
  getPrefixCls = _useConfigContext.getPrefixCls;
78
77
  var prefixCls = getPrefixCls();
79
- var _useLocale = _useLocale2(langConfig),
80
- localeObj = _useLocale.langObj;
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;
81
86
  var messageImg = imgOption.messageImg,
82
87
  _imgOption$badgeOptio = imgOption.badgeOption,
83
88
  badgeOption = _imgOption$badgeOptio === void 0 ? {} : _imgOption$badgeOptio;
@@ -189,20 +194,22 @@ function Message(props) {
189
194
  audio.play()["catch"](function (err) {
190
195
  var _err$message;
191
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;
192
198
  if (!modal.current) {
193
199
  modal.current = _Modal.warning({
194
- title: formatMessage(localeObj["playAutomatically"]),
200
+ title: _intl.get("de6eaecc-9d39-41f1-82d3-80694c558028").d("消息提醒需要有交互行为才可以自动播放"),
195
201
  prefixCls: "".concat(prefixCls, "-modal"),
196
202
  okButtonProps: {
197
203
  prefixCls: "".concat(prefixCls, "-btn")
198
204
  },
199
- okText: formatMessage(localeObj["ok"]),
205
+ okText: _intl.get("4253417c-d699-4eed-8c75-34d2a8b18a68").d("确定"),
200
206
  mask: true,
201
207
  maskClosable: true
202
208
  });
203
209
  } else {
204
- modal.current.update(function (prevConfig) {
205
- return _objectSpread({}, prevConfig);
210
+ modal.current.update({
211
+ title: _intl.get("de6eaecc-9d39-41f1-82d3-80694c558028").d("消息提醒需要有交互行为才可以自动播放"),
212
+ okText: _intl.get("4253417c-d699-4eed-8c75-34d2a8b18a68").d("确定")
206
213
  });
207
214
  }
208
215
  }
@@ -219,7 +226,9 @@ function Message(props) {
219
226
  userMessageId: id,
220
227
  clientType: "BROWSER"
221
228
  };
222
- resRequestApi = _getMessageDetailApi || getMessageDetailApi;
229
+ resRequestApi = _getMessageDetailApi || function (params, gateway) {
230
+ return getMessageDetailApi(params, gateway, localeRef.current);
231
+ };
223
232
  _context.n = 1;
224
233
  return resRequestApi(params, gatewayPrefix);
225
234
  case 1:
@@ -261,7 +270,9 @@ function Message(props) {
261
270
  return _regenerator().w(function (_context2) {
262
271
  while (1) switch (_context2.n) {
263
272
  case 0:
264
- resRequestApi = _readInnerMessageApi || readInnerMessageApi;
273
+ resRequestApi = _readInnerMessageApi || function (params, gateway) {
274
+ return readInnerMessageApi(params, gateway, localeRef.current);
275
+ };
265
276
  resRequestApi(params, gatewayPrefix);
266
277
  case 1:
267
278
  return _context2.a(2);
@@ -307,7 +318,9 @@ function Message(props) {
307
318
  while (1) switch (_context3.n) {
308
319
  case 0:
309
320
  // 获取sessionId
310
- resRequestApi = _getSessionId || getSessionId;
321
+ resRequestApi = _getSessionId || function (gateway) {
322
+ return getSessionId(gateway, localeRef.current);
323
+ };
311
324
  _context3.n = 1;
312
325
  return resRequestApi(gatewayPrefix);
313
326
  case 1:
@@ -348,7 +361,9 @@ function Message(props) {
348
361
  return _regenerator().w(function (_context4) {
349
362
  while (1) switch (_context4.n) {
350
363
  case 0:
351
- resRequestApi = _getMessageQuerySettingsApi || getMessageQuerySettingsApi;
364
+ resRequestApi = _getMessageQuerySettingsApi || function (gateway) {
365
+ return getMessageQuerySettingsApi(gateway, localeRef.current);
366
+ };
352
367
  _context4.n = 1;
353
368
  return resRequestApi(gatewayPrefix);
354
369
  case 1:
@@ -1,35 +1,35 @@
1
1
  import { fetchGet, fetchPost } from "../utils";
2
2
 
3
3
  // 用户登录预处理接口
4
- export var getSessionId = function getSessionId(gateway) {
5
- return fetchGet("".concat(gateway, "/message/api/v1/tool/getSessionId"));
4
+ export var getSessionId = function getSessionId(gateway, locale) {
5
+ return fetchGet("".concat(gateway, "/message/api/v1/tool/getSessionId"), undefined, locale);
6
6
  };
7
7
 
8
8
  // 查询权限对应的tab栏信息
9
- export var getMessageTypeApi = function getMessageTypeApi(gateway) {
10
- return fetchGet("".concat(gateway, "/message/api/v1/messageType/list"));
9
+ export var getMessageTypeApi = function getMessageTypeApi(gateway, locale) {
10
+ return fetchGet("".concat(gateway, "/message/api/v1/messageType/list"), undefined, locale);
11
11
  };
12
12
 
13
13
  // 查询消息列表
14
- export var getMessageListApi = function getMessageListApi(params, gateway) {
15
- return fetchGet("".concat(gateway, "/message/api/v1/innerMessage/page"), params);
14
+ export var getMessageListApi = function getMessageListApi(params, gateway, locale) {
15
+ return fetchGet("".concat(gateway, "/message/api/v1/innerMessage/page"), params, locale);
16
16
  };
17
17
 
18
18
  // 已读指定信息
19
- export var readInnerMessageApi = function readInnerMessageApi(params, gateway) {
20
- return fetchPost("".concat(gateway, "/message/api/v1/innerMessage/read"), params);
19
+ export var readInnerMessageApi = function readInnerMessageApi(params, gateway, locale) {
20
+ return fetchPost("".concat(gateway, "/message/api/v1/innerMessage/read"), params, locale);
21
21
  };
22
22
 
23
23
  // 查询所有类型的未读信息
24
- export var getMessageUnreadCountApi = function getMessageUnreadCountApi(gateway) {
25
- return fetchGet("".concat(gateway, "/message/api/v1/innerMessage/unreadCount"));
24
+ export var getMessageUnreadCountApi = function getMessageUnreadCountApi(gateway, locale) {
25
+ return fetchGet("".concat(gateway, "/message/api/v1/innerMessage/unreadCount"), undefined, locale);
26
26
  };
27
27
 
28
28
  // 查询消息详情
29
- export var getMessageDetailApi = function getMessageDetailApi(params, gateway) {
30
- return fetchGet("".concat(gateway, "/message/api/v1/innerMessage/getDetail"), params);
29
+ export var getMessageDetailApi = function getMessageDetailApi(params, gateway, locale) {
30
+ return fetchGet("".concat(gateway, "/message/api/v1/innerMessage/getDetail"), params, locale);
31
31
  };
32
32
  // 查询强提醒配置
33
- export var getMessageQuerySettingsApi = function getMessageQuerySettingsApi(gateway) {
34
- return fetchGet("".concat(gateway, "/message/api/v1/notice/querySettings"));
33
+ export var getMessageQuerySettingsApi = function getMessageQuerySettingsApi(gateway, locale) {
34
+ return fetchGet("".concat(gateway, "/message/api/v1/notice/querySettings"), undefined, locale);
35
35
  };
@@ -1,12 +1,19 @@
1
- var _window$localStorage$;
2
- var headers = {
3
- withCredentials: true,
4
- userId: window.localStorage.getItem("accountUserId") || "2",
5
- accountId: window.localStorage.getItem("accountId") || "110",
6
- "Content-Type": "application/json",
7
- language: (_window$localStorage$ = window.localStorage.getItem("language")) !== null && _window$localStorage$ !== void 0 && _window$localStorage$.includes("en") ? "en_US" : "zh_CN"
1
+ import { normalizeLocale } from '../../locales/runtime';
2
+
3
+ // Forward the current language using company locale codes, without reducing it
4
+ // to Chinese/English. Provider callers take precedence over fresh host storage.
5
+ var getHeaders = function getHeaders(locale) {
6
+ var storage = typeof window === 'undefined' ? null : window.localStorage;
7
+ var language = locale !== undefined ? locale : storage === null || storage === void 0 ? void 0 : storage.getItem('language');
8
+ return {
9
+ withCredentials: true,
10
+ userId: (storage === null || storage === void 0 ? void 0 : storage.getItem('accountUserId')) || '2',
11
+ accountId: (storage === null || storage === void 0 ? void 0 : storage.getItem('accountId')) || '110',
12
+ 'Content-Type': 'application/json',
13
+ language: normalizeLocale(language || 'zh_CN')
14
+ };
8
15
  };
9
- export var fetchGet = function fetchGet(url, params) {
16
+ export var fetchGet = function fetchGet(url, params, locale) {
10
17
  var str = "";
11
18
  if (params) {
12
19
  var arr = [];
@@ -17,16 +24,16 @@ export var fetchGet = function fetchGet(url, params) {
17
24
  }
18
25
  return fetch(url + "?" + str, {
19
26
  method: "GET",
20
- headers: headers
27
+ headers: getHeaders(locale)
21
28
  }).then(function (response) {
22
29
  return response.json();
23
30
  });
24
31
  };
25
- export var fetchPost = function fetchPost(url, params) {
32
+ export var fetchPost = function fetchPost(url, params, locale) {
26
33
  return fetch(url, {
27
34
  method: "POST",
28
35
  body: JSON.stringify(params),
29
- headers: headers
36
+ headers: getHeaders(locale)
30
37
  }).then(function (response) {
31
38
  return response.json();
32
39
  });
@@ -1,23 +1,26 @@
1
1
  import "@chaoswise/ui/lib/Tag/index.less";
2
2
  import _Tag from "@chaoswise/ui/lib/Tag";
3
3
  import _Icon from "@chaoswise/ui/lib/Icon";
4
- import _useLocale2 from "@chaoswise/ui/lib/useLocale";
4
+ import useIntl from '../../../useIntl';
5
+ import useConfigLocale from '../../../ConfigProvider/useLocale';
6
+ import { getHistoryTitle } from '../../utils';
5
7
  import React from "react";
6
- import langConfig from "../../locale";
7
- import { formatMessage } from "../../../utils";
8
8
  import "./index.less";
9
9
  export default function MoreHistoryList(props) {
10
10
  var historyList = props.historyList,
11
11
  onClickTag = props.onClickTag,
12
12
  onCloseTag = props.onCloseTag,
13
- onCloseAllTag = props.onCloseAllTag;
14
- var _useLocale = _useLocale2(langConfig),
15
- localeObj = _useLocale.langObj;
13
+ onCloseAllTag = props.onCloseAllTag,
14
+ format = props.format,
15
+ timeSpanBoundary = props.timeSpanBoundary;
16
+ var intl = useIntl();
17
+ var _useConfigLocale = useConfigLocale(),
18
+ locale = _useConfigLocale.locale;
16
19
  return /*#__PURE__*/React.createElement("div", {
17
20
  className: "cw-dropdown-menu-history-popup-more-wrapper"
18
21
  }, /*#__PURE__*/React.createElement("div", {
19
22
  className: "cw-dropdown-menu-history-popup-more-header"
20
- }, /*#__PURE__*/React.createElement("span", null, formatMessage(localeObj["history"])), /*#__PURE__*/React.createElement("div", {
23
+ }, /*#__PURE__*/React.createElement("span", null, intl.get("294afc43-e2de-4d72-ba99-1f25d6f7a1d7").d("历史记录")), /*#__PURE__*/React.createElement("div", {
21
24
  onClick: onCloseAllTag
22
25
  }, /*#__PURE__*/React.createElement(_Icon, {
23
26
  type: "delete"
@@ -25,11 +28,11 @@ export default function MoreHistoryList(props) {
25
28
  style: {
26
29
  marginLeft: "4px"
27
30
  }
28
- }, formatMessage(localeObj["clear"])))), /*#__PURE__*/React.createElement("div", {
31
+ }, intl.get("53e957d9-8aee-4322-a144-31d4cff11c9f").d("清空")))), /*#__PURE__*/React.createElement("div", {
29
32
  className: "cw-dropdown-menu-history-popup-more-content"
30
33
  }, historyList.map(function (tag) {
31
34
  return /*#__PURE__*/React.createElement(_Tag, {
32
- key: tag.title,
35
+ key: tag.key,
33
36
  closable: true,
34
37
  onClose: function onClose(e) {
35
38
  return onCloseTag(e, tag);
@@ -39,6 +42,9 @@ export default function MoreHistoryList(props) {
39
42
  },
40
43
  type: "custom_type01",
41
44
  className: "cw-dropdown-menu-history-popup-more-content-tag-title"
42
- }, tag.title);
45
+ }, getHistoryTitle(tag, {
46
+ locale: locale,
47
+ intl: intl
48
+ }, format, timeSpanBoundary));
43
49
  })));
44
50
  }
@@ -2,18 +2,16 @@ import _Row from "@chaoswise/ui/lib/Row";
2
2
  import _Col from "@chaoswise/ui/lib/Col";
3
3
  import "@chaoswise/ui/lib/TooltipText/index.less";
4
4
  import _TooltipText from "@chaoswise/ui/lib/TooltipText";
5
- import _useLocale2 from "@chaoswise/ui/lib/useLocale";
5
+ import useIntl from '../../../useIntl';
6
+ import getTimeTypeLabel from '../../../locales/messages/timeTypes';
6
7
  import React from "react";
7
8
  import classnames from "classnames";
8
- import langConfig from "../../locale";
9
- import { formatMessage } from "../../../utils";
10
9
  import "./index.less";
11
10
  var MoreTimeList = function MoreTimeList(props) {
12
11
  var regroupDataSource = props.regroupDataSource,
13
12
  recordDateValue = props.recordDateValue,
14
13
  onClickItem = props.onClickItem;
15
- var _useLocale = _useLocale2(langConfig),
16
- localeObj = _useLocale.langObj;
14
+ var intl = useIntl();
17
15
  // 点击Menu.Item中切换常规模式
18
16
  var onClickMoreItem = function onClickMoreItem(item) {
19
17
  onClickItem(item);
@@ -27,7 +25,7 @@ var MoreTimeList = function MoreTimeList(props) {
27
25
  borderBottom: regroupDataSource.length - 1 !== index ? "1px solid rgba(0,0,0,0.06)" : ""
28
26
  },
29
27
  key: timeTypeItem.type
30
- }, /*#__PURE__*/React.createElement("h3", null, formatMessage(localeObj[timeTypeItem.type])), /*#__PURE__*/React.createElement(_Row, null, timeTypeItem.timeList.map(function (item) {
28
+ }, /*#__PURE__*/React.createElement("h3", null, getTimeTypeLabel(intl, timeTypeItem.type)), /*#__PURE__*/React.createElement(_Row, null, timeTypeItem.timeList.map(function (item) {
31
29
  return /*#__PURE__*/React.createElement(_Col, {
32
30
  key: item.key,
33
31
  span: timeTypeItem.type === "absolute" || timeTypeItem.type == "unixTimestamp" ? 12 : 8,
@@ -3,7 +3,6 @@ import "@chaoswise/ui/lib/Tag/index.less";
3
3
  import _Tag from "@chaoswise/ui/lib/Tag";
4
4
  import _Dropdown from "@chaoswise/ui/lib/Dropdown";
5
5
  import _Icon from "@chaoswise/ui/lib/Icon";
6
- import _useLocale2 from "@chaoswise/ui/lib/useLocale";
7
6
  var _excluded = ["timeDomain", "number", "unit", "value", "isRecently"];
8
7
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
9
8
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -22,6 +21,8 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
22
21
  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); }
23
22
  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; }
24
23
  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; }
24
+ import useIntl from '../../useIntl';
25
+ import useConfigLocale from '../../ConfigProvider/useLocale';
25
26
  import React from "react";
26
27
  import classnames from "classnames";
27
28
  import CalendarSvg from "../assets/Calendar";
@@ -30,9 +31,7 @@ import LiveSvg from "../assets/live";
30
31
  import MoreSvg from "../assets/more";
31
32
  import MoreTimeList from "./MoreTimeList";
32
33
  import MoreHistoryList from "./MoreHistoryList";
33
- import { judgeType, funcValueChangeArrayValue, getCorrectValue, getHistoryInfo } from "../utils";
34
- import langConfig from "../locale";
35
- import { formatMessage } from "../../utils";
34
+ import { judgeType, funcValueChangeArrayValue, getCorrectValue, getHistoryInfo, getHistoryTitle } from "../utils";
36
35
  import "./index.less";
37
36
  var DropdownMenu = function DropdownMenu(props) {
38
37
  var dataSource = props.dataSource,
@@ -49,10 +48,10 @@ var DropdownMenu = function DropdownMenu(props) {
49
48
  setHistoryList = props.setHistoryList,
50
49
  format = props.format,
51
50
  timeSpanOption = props.timeSpanOption;
52
- var _useLocale = _useLocale2(langConfig),
53
- localeObj = _useLocale.langObj,
54
- _useLocale$locale = _useLocale.locale,
55
- locale = _useLocale$locale === void 0 ? "zh_CN" : _useLocale$locale;
51
+ var intl = useIntl();
52
+ var _useConfigLocale = useConfigLocale(),
53
+ _useConfigLocale$loca = _useConfigLocale.locale,
54
+ locale = _useConfigLocale$loca === void 0 ? "zh_CN" : _useConfigLocale$loca;
56
55
  var _timeSpanOption$timeS = timeSpanOption.timeSpanBoundary,
57
56
  timeSpanBoundary = _timeSpanOption$timeS === void 0 ? 94608000 : _timeSpanOption$timeS;
58
57
  var _menuOption$showCalen = menuOption.showCalendar,
@@ -81,7 +80,10 @@ var DropdownMenu = function DropdownMenu(props) {
81
80
  });
82
81
  returnValue = getCorrectValue(returnValue, item.key);
83
82
  onChange(returnValue);
84
- var _getHistoryInfo = getHistoryInfo(returnValue, historyList, locale, format, timeSpanBoundary),
83
+ var _getHistoryInfo = getHistoryInfo(returnValue, historyList, {
84
+ intl: intl,
85
+ locale: locale
86
+ }, format, timeSpanBoundary),
85
87
  _getHistoryInfo2 = _slicedToArray(_getHistoryInfo, 2),
86
88
  isRepeat = _getHistoryInfo2[0],
87
89
  historyValue = _getHistoryInfo2[1];
@@ -182,7 +184,7 @@ var DropdownMenu = function DropdownMenu(props) {
182
184
  style: {
183
185
  marginLeft: "4px"
184
186
  }
185
- }, formatMessage(localeObj["more"]))), /*#__PURE__*/React.createElement(_Icon, {
187
+ }, intl.get("a30db643-5238-42bc-bc5e-98a9d0c7df51").d("更多"))), /*#__PURE__*/React.createElement(_Icon, {
186
188
  type: "right"
187
189
  }))), showCalendar && /*#__PURE__*/React.createElement("div", {
188
190
  className: classnames("cw-dropdown-menu-_item"),
@@ -196,9 +198,11 @@ var DropdownMenu = function DropdownMenu(props) {
196
198
  style: {
197
199
  marginLeft: "4px"
198
200
  }
199
- }, formatMessage(localeObj["select-calendar"]))), showHistoryList && Boolean(historyList.length) && /*#__PURE__*/React.createElement(_Dropdown, {
201
+ }, intl.get("02fc19b1-7fc7-4859-b2e0-a65ac2039828").d("日历选择"))), showHistoryList && Boolean(historyList.length) && /*#__PURE__*/React.createElement(_Dropdown, {
200
202
  overlay: /*#__PURE__*/React.createElement(MoreHistoryList, {
201
203
  historyList: historyList,
204
+ format: format,
205
+ timeSpanBoundary: timeSpanBoundary,
202
206
  onClickTag: onClickTag,
203
207
  onCloseTag: onCloseTag,
204
208
  onCloseAllTag: onCloseAllTag
@@ -215,7 +219,7 @@ var DropdownMenu = function DropdownMenu(props) {
215
219
  className: classnames("cw-dropdown-menu-history-wrapper")
216
220
  }, /*#__PURE__*/React.createElement("span", {
217
221
  className: "cw-dropdown-menu-history-title"
218
- }, formatMessage(localeObj["history"]), ":"), historyList.slice(0, showDefaultHistoryCount).map(function (tag) {
222
+ }, intl.get("294afc43-e2de-4d72-ba99-1f25d6f7a1d7").d("历史记录"), ":"), historyList.slice(0, showDefaultHistoryCount).map(function (tag) {
219
223
  return /*#__PURE__*/React.createElement(_Tag, {
220
224
  type: "custom_type01",
221
225
  closable: true,
@@ -227,7 +231,10 @@ var DropdownMenu = function DropdownMenu(props) {
227
231
  onClose: function onClose(e) {
228
232
  return onCloseTag(e, tag);
229
233
  }
230
- }, tag.title);
234
+ }, getHistoryTitle(tag, {
235
+ locale: locale,
236
+ intl: intl
237
+ }, format, timeSpanBoundary));
231
238
  }), historyList.length > showDefaultHistoryCount && /*#__PURE__*/React.createElement("span", {
232
239
  className: "cw-dropdown-menu-history-more-ellipsis"
233
240
  }, "...")), /*#__PURE__*/React.createElement(_Icon, {
@@ -3,7 +3,6 @@ import "@chaoswise/ui/lib/Tooltip/index.less";
3
3
  import _Tooltip from "@chaoswise/ui/lib/Tooltip";
4
4
  import "@chaoswise/ui/lib/Button/index.less";
5
5
  import _Button from "@chaoswise/ui/lib/Button";
6
- import _useLocale2 from "@chaoswise/ui/lib/useLocale";
7
6
  var _excluded = ["value", "key"];
8
7
  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; }
9
8
  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; }
@@ -18,14 +17,13 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
18
17
  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; }
19
18
  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; } }
20
19
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
20
+ import useIntl from '../../useIntl';
21
21
  import React, { forwardRef, useImperativeHandle } from "react";
22
22
  import classnames from "classnames";
23
23
  import Refresh1Svg from "../assets/Refresh1";
24
24
  import Refresh2Svg from "../assets/Refresh2";
25
25
  import Refresh3Svg from "../assets/Refresh3";
26
26
  import { getChangeUnitDate, funcValueChangeArrayValue, getTimeSpanFromValue, computedRecentlyValue, judgeType } from "../utils";
27
- import langConfig from "../locale";
28
- import { formatMessage } from "../../utils";
29
27
  import "./index.less";
30
28
  var Refresh = /*#__PURE__*/forwardRef(function (props, ref) {
31
29
  var recordDateValue = props.recordDateValue,
@@ -55,8 +53,7 @@ var Refresh = /*#__PURE__*/forwardRef(function (props, ref) {
55
53
  isSpecialRelativeTime = _refreshOption$isSpec === void 0 ? false : _refreshOption$isSpec;
56
54
  var _timeSpanOption$timeS = timeSpanOption.timeSpanBoundary,
57
55
  timeSpanBoundary = _timeSpanOption$timeS === void 0 ? 94608000 : _timeSpanOption$timeS;
58
- var _useLocale = _useLocale2(langConfig),
59
- localeObj = _useLocale.langObj;
56
+ var intl = useIntl();
60
57
  // 手动刷新
61
58
  var onRefresh = function onRefresh() {
62
59
  var values = recordDateValue.value,
@@ -154,12 +151,12 @@ var Refresh = /*#__PURE__*/forwardRef(function (props, ref) {
154
151
  return (showRefresh || showAutoRefresh) && /*#__PURE__*/React.createElement(_Button.Group, {
155
152
  className: "cw-range-picker-refresh-wrapper"
156
153
  }, showRefresh && /*#__PURE__*/React.createElement(_Tooltip, {
157
- title: formatMessage(localeObj["refresh"])
154
+ title: intl.get("1d0f3c0c-188f-4f83-bff0-2792dffcdc2d").d("刷新")
158
155
  }, /*#__PURE__*/React.createElement(_Button, {
159
156
  onClick: onRefresh,
160
157
  disabled: isDisabledRefresh
161
158
  }, /*#__PURE__*/React.createElement(Refresh1Svg, null))), showAutoRefresh && /*#__PURE__*/React.createElement(_Tooltip, {
162
- title: formatMessage(localeObj["autoRefresh"])
159
+ title: intl.get("502d0d23-e942-4ecd-89e4-e85431a3098f").d("自动刷新")
163
160
  }, /*#__PURE__*/React.createElement(_Button, {
164
161
  onClick: onAutoRefresh,
165
162
  disabled: isDisabledAutoRefresh,
@@ -1,12 +1,10 @@
1
1
  import "@chaoswise/ui/lib/Tooltip/index.less";
2
2
  import _Tooltip from "@chaoswise/ui/lib/Tooltip";
3
- import _useLocale2 from "@chaoswise/ui/lib/useLocale";
4
3
  import "@chaoswise/ui/lib/Button/index.less";
5
4
  import _Button from "@chaoswise/ui/lib/Button";
5
+ import useIntl from '../../useIntl';
6
6
  import React from "react";
7
7
  import { getChangeDate } from "../utils";
8
- import langConfig from "../locale";
9
- import { formatMessage } from "../../utils";
10
8
  import "./index.less";
11
9
  _Button.__ANT_BUTTON = true;
12
10
  var TimeSpan = function TimeSpan(props) {
@@ -19,8 +17,7 @@ var TimeSpan = function TimeSpan(props) {
19
17
  timeSpanOption = props.timeSpanOption,
20
18
  isRightDisabled = props.isRightDisabled,
21
19
  isDisabledEnlargeBtn = props.isDisabledEnlargeBtn;
22
- var _useLocale = _useLocale2(langConfig),
23
- localeObj = _useLocale.langObj;
20
+ var intl = useIntl();
24
21
  var _timeSpanOption$showF = timeSpanOption.showForwardBtn,
25
22
  showForwardBtn = _timeSpanOption$showF === void 0 ? true : _timeSpanOption$showF,
26
23
  _timeSpanOption$showB = timeSpanOption.showBackwardBtn,
@@ -43,13 +40,13 @@ var TimeSpan = function TimeSpan(props) {
43
40
  _timeSpanOption$timeS = timeSpanOption.timeSpanBoundary,
44
41
  timeSpanBoundary = _timeSpanOption$timeS === void 0 ? 94608000 : _timeSpanOption$timeS;
45
42
  var _tooltipTitleCustom$f = tooltipTitleCustom.forwardTitle,
46
- forwardTitle = _tooltipTitleCustom$f === void 0 ? formatMessage(localeObj["forwardSmooth"]) : _tooltipTitleCustom$f,
43
+ forwardTitle = _tooltipTitleCustom$f === void 0 ? intl.get("df9a3bfb-00df-44cd-9761-87dc21ffc0e8").d("向前平滑") : _tooltipTitleCustom$f,
47
44
  _tooltipTitleCustom$b = tooltipTitleCustom.backTitle,
48
- backTitle = _tooltipTitleCustom$b === void 0 ? formatMessage(localeObj["backSmooth"]) : _tooltipTitleCustom$b,
45
+ backTitle = _tooltipTitleCustom$b === void 0 ? intl.get("cefeccff-2f9e-4b59-925c-af11c28aa8ed").d("向后平滑") : _tooltipTitleCustom$b,
49
46
  _tooltipTitleCustom$e = tooltipTitleCustom.expandTitle,
50
- expandTitle = _tooltipTitleCustom$e === void 0 ? formatMessage(localeObj["ExpandSpan"], {
47
+ expandTitle = _tooltipTitleCustom$e === void 0 ? intl.get("56a89179-5086-4c43-8814-06eac1ba9983", {
51
48
  span: "".concat(growSize)
52
- }) : _tooltipTitleCustom$e;
49
+ }).d("按{span}倍增加时间跨度") : _tooltipTitleCustom$e;
53
50
  var onChangeTimeSpan = function onChangeTimeSpan(direction) {
54
51
  var _getChangeDate = getChangeDate(recordDateValue, direction, growSize, timeSpanBoundary),
55
52
  value = _getChangeDate.value,