@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.
Files changed (219) hide show
  1. package/lib/AlgorithmChart/common/chart.option.js +14 -11
  2. package/lib/AlgorithmChart/index.js +29 -26
  3. package/lib/Antd4/comment/index.js +1 -1
  4. package/lib/Antd4Form/FormItem.js +1 -1
  5. package/lib/BasicLayout/Nav.js +3 -5
  6. package/lib/BasicLayout/index.js +9 -10
  7. package/lib/CWCascader/rc-cascader/OptionList/Column.js +17 -18
  8. package/lib/CWMessage/MessageContent/TabList/index.js +19 -17
  9. package/lib/CWMessage/MessageContent/index.js +86 -73
  10. package/lib/CWMessage/index.js +62 -50
  11. package/lib/CWMessage/service/index.js +14 -14
  12. package/lib/CWMessage/utils/index.js +18 -11
  13. package/lib/CWRangePicker/DropdownMenu/MoreHistoryList/index.js +16 -10
  14. package/lib/CWRangePicker/DropdownMenu/MoreTimeList/index.js +4 -6
  15. package/lib/CWRangePicker/DropdownMenu/index.js +20 -13
  16. package/lib/CWRangePicker/Refresh/index.js +4 -7
  17. package/lib/CWRangePicker/TimeSpan/index.js +6 -9
  18. package/lib/CWRangePicker/index.js +39 -32
  19. package/lib/CWRangePicker/utils/index.js +45 -114
  20. package/lib/CWSelect/index.js +7 -10
  21. package/lib/CWTable/CWTable.js +23 -23
  22. package/lib/CWTable/EditLine.js +5 -8
  23. package/lib/CWTable/Filter.js +5 -8
  24. package/lib/CWTable/index.js +3 -0
  25. package/lib/CWTree/index.js +4 -7
  26. package/lib/CWUpload/upload/Dragger.js +4 -7
  27. package/lib/CWUpload/upload/UploadList.js +12 -15
  28. package/lib/CardSelect/index.js +16 -14
  29. package/lib/CitySelect/index.js +3 -1
  30. package/lib/ColorPicker/index.js +4 -7
  31. package/lib/ConfigProvider/ConfigProvider.js +143 -48
  32. package/lib/ConfigProvider/Switch.js +10 -2
  33. package/lib/ConfigProvider/context.js +8 -0
  34. package/lib/ConfigProvider/useLocale.js +1 -1
  35. package/lib/DatePicker/useLocale.js +17 -10
  36. package/lib/DateRangePicker/RangeDateTimePicker.js +3 -3
  37. package/lib/DateRangePicker/components/ExtraQuickFooter.js +5 -8
  38. package/lib/DateRangePicker/index.js +6 -5
  39. package/lib/DropdownDatePicker/DropdownMenu/MoreTimeList/index.js +4 -6
  40. package/lib/DropdownDatePicker/DropdownMenu/index.js +4 -7
  41. package/lib/DropdownDatePicker/index.js +12 -13
  42. package/lib/DropdownDatePicker/utils/index.js +5 -93
  43. package/lib/EchartsBar/index.js +1 -1
  44. package/lib/Empty/index.js +3 -6
  45. package/lib/ErrorBoundary/ErrorPage.js +8 -9
  46. package/lib/Exception/index.js +9 -12
  47. package/lib/FilterDropDown/index.js +3 -6
  48. package/lib/Flow/tools/index.js +4 -1
  49. package/lib/Header/Document/index.js +3 -8
  50. package/lib/Header/LocaleSwitcher.js +2 -0
  51. package/lib/Header/UserSetting/index.js +27 -45
  52. package/lib/IconSelect/components/CustomImg/index.js +8 -11
  53. package/lib/IconSelect/components/SearchIcon/index.js +9 -9
  54. package/lib/IconSelect/index.js +4 -7
  55. package/lib/ImagePreview/index.js +3 -1
  56. package/lib/Joyride/List.js +9 -8
  57. package/lib/Joyride/index.js +22 -25
  58. package/lib/ModuleFederation/react-dynamic-remote-component/RemoteComponent.js +38 -39
  59. package/lib/ModuleFederation/react-dynamic-remote-component/load-module.js +22 -23
  60. package/lib/Pagination/index.js +14 -14
  61. package/lib/PolymerizationSearch/DropdownMenu.js +4 -2
  62. package/lib/PolymerizationSearch/index.js +7 -7
  63. package/lib/Progress/index.js +3 -6
  64. package/lib/QuickTransfer/DragList.js +3 -6
  65. package/lib/QuickTransfer/index.js +19 -22
  66. package/lib/RangePicker/components/ExtraTimeFooter.js +4 -7
  67. package/lib/SearchBar/OutSearch.js +9 -2
  68. package/lib/SearchBar/index.js +13 -16
  69. package/lib/SimpleCard/index.js +3 -1
  70. package/lib/SingleSpa/index.js +30 -26
  71. package/lib/ThemeProvider/Switcher.js +3 -1
  72. package/lib/TimeRangeSlider/Refresh/index.js +4 -7
  73. package/lib/TimeRangeSlider/TimeRangeSliderCmp/hooks/useMouse.js +3 -3
  74. package/lib/TimeRangeSlider/TimeSpan/index.js +6 -9
  75. package/lib/TimeRangeSlider/index.js +28 -24
  76. package/lib/TimeRangeSlider/utils/index.js +20 -100
  77. package/lib/TimeZoneSelect/index.js +21 -22
  78. package/lib/TreeSelect111/index.js +3 -6
  79. package/lib/Upload-back/index.js +27 -25
  80. package/lib/VerticalLayout/index.js +3 -1
  81. package/lib/WangEditor/extraLanguage.js +19 -0
  82. package/lib/WangEditor/index.js +19 -13
  83. package/lib/WangEditor/messages.js +49 -0
  84. package/lib/WangEditor/wangEditor.js +47 -20
  85. package/lib/index.js +1 -0
  86. package/lib/locales/en_US.json +1 -0
  87. package/lib/locales/index.js +2 -0
  88. package/lib/locales/ja_JP.json +1 -0
  89. package/lib/locales/load.js +48 -0
  90. package/lib/locales/messages/antd.js +404 -0
  91. package/lib/locales/messages/editor.js +42 -0
  92. package/lib/locales/messages/timeRanges.js +36 -0
  93. package/lib/locales/messages/timeTypes.js +11 -0
  94. package/lib/locales/runtime.js +127 -0
  95. package/lib/locales/zh_CN.json +1 -0
  96. package/lib/locales/zh_HK.json +1 -0
  97. package/lib/locales/zh_TW.json +1 -0
  98. package/lib/useIntl/index.js +9 -0
  99. package/lib/useLocale/index.js +16 -13
  100. package/lib/utils/index.js +4 -1
  101. package/package.json +14 -3
  102. package/lib/BasicLayout/locale/en_US.js +0 -4
  103. package/lib/BasicLayout/locale/index.js +0 -13
  104. package/lib/BasicLayout/locale/ja_JP.js +0 -4
  105. package/lib/BasicLayout/locale/zh_CN.js +0 -4
  106. package/lib/BasicLayout/locale/zh_TW.js +0 -4
  107. package/lib/CWMessage/locale/en_US.js +0 -8
  108. package/lib/CWMessage/locale/index.js +0 -13
  109. package/lib/CWMessage/locale/ja_JP.js +0 -8
  110. package/lib/CWMessage/locale/zh_CN.js +0 -8
  111. package/lib/CWMessage/locale/zh_TW.js +0 -8
  112. package/lib/CWRangePicker/locale/en_US.js +0 -29
  113. package/lib/CWRangePicker/locale/index.js +0 -13
  114. package/lib/CWRangePicker/locale/ja_JP.js +0 -29
  115. package/lib/CWRangePicker/locale/zh_CN.js +0 -29
  116. package/lib/CWRangePicker/locale/zh_TW.js +0 -29
  117. package/lib/CWSelect/locale/en_US.js +0 -4
  118. package/lib/CWSelect/locale/index.js +0 -13
  119. package/lib/CWSelect/locale/ja_JP.js +0 -4
  120. package/lib/CWSelect/locale/zh_CN.js +0 -4
  121. package/lib/CWSelect/locale/zh_TW.js +0 -4
  122. package/lib/CWTable/locale/en_US.js +0 -6
  123. package/lib/CWTable/locale/index.js +0 -13
  124. package/lib/CWTable/locale/ja_JP.js +0 -6
  125. package/lib/CWTable/locale/zh_CN.js +0 -6
  126. package/lib/CWTable/locale/zh_TW.js +0 -6
  127. package/lib/CWTree/locale/en_US.js +0 -3
  128. package/lib/CWTree/locale/index.js +0 -13
  129. package/lib/CWTree/locale/ja_JP.js +0 -3
  130. package/lib/CWTree/locale/zh_CN.js +0 -3
  131. package/lib/CWTree/locale/zh_TW.js +0 -3
  132. package/lib/CWUpload/locale/en_US.js +0 -6
  133. package/lib/CWUpload/locale/index.js +0 -13
  134. package/lib/CWUpload/locale/ja_JP.js +0 -6
  135. package/lib/CWUpload/locale/zh_CN.js +0 -6
  136. package/lib/CWUpload/locale/zh_TW.js +0 -6
  137. package/lib/Card/index.less +0 -10
  138. package/lib/ColorPicker/locale/en_US.js +0 -4
  139. package/lib/ColorPicker/locale/index.js +0 -13
  140. package/lib/ColorPicker/locale/ja_JP.js +0 -4
  141. package/lib/ColorPicker/locale/zh_CN.js +0 -4
  142. package/lib/ColorPicker/locale/zh_TW.js +0 -4
  143. package/lib/DateRangePicker/locale/en_US.js +0 -5
  144. package/lib/DateRangePicker/locale/index.js +0 -13
  145. package/lib/DateRangePicker/locale/ja_JP.js +0 -5
  146. package/lib/DateRangePicker/locale/zh_CN.js +0 -5
  147. package/lib/DateRangePicker/locale/zh_TW.js +0 -5
  148. package/lib/DropdownDatePicker/locale/en_US.js +0 -21
  149. package/lib/DropdownDatePicker/locale/index.js +0 -13
  150. package/lib/DropdownDatePicker/locale/ja_JP.js +0 -21
  151. package/lib/DropdownDatePicker/locale/zh_CN.js +0 -21
  152. package/lib/DropdownDatePicker/locale/zh_TW.js +0 -21
  153. package/lib/Empty/locale/en_US.js +0 -3
  154. package/lib/Empty/locale/index.js +0 -13
  155. package/lib/Empty/locale/ja_JP.js +0 -3
  156. package/lib/Empty/locale/zh_CN.js +0 -3
  157. package/lib/Empty/locale/zh_TW.js +0 -3
  158. package/lib/ErrorBoundary/index.less +0 -15
  159. package/lib/ErrorBoundary/locale/en_US.js +0 -5
  160. package/lib/ErrorBoundary/locale/index.js +0 -13
  161. package/lib/ErrorBoundary/locale/ja_JP.js +0 -5
  162. package/lib/ErrorBoundary/locale/zh_CN.js +0 -5
  163. package/lib/ErrorBoundary/locale/zh_TW.js +0 -5
  164. package/lib/Exception/locale/en_US.js +0 -9
  165. package/lib/Exception/locale/index.js +0 -13
  166. package/lib/Exception/locale/ja_JP.js +0 -9
  167. package/lib/Exception/locale/zh_CN.js +0 -9
  168. package/lib/Exception/locale/zh_TW.js +0 -9
  169. package/lib/FilterDropDown/locale/en_US.js +0 -3
  170. package/lib/FilterDropDown/locale/index.js +0 -13
  171. package/lib/FilterDropDown/locale/ja_JP.js +0 -3
  172. package/lib/FilterDropDown/locale/zh_CN.js +0 -3
  173. package/lib/FilterDropDown/locale/zh_TW.js +0 -3
  174. package/lib/IconSelect/locale/en_US.js +0 -11
  175. package/lib/IconSelect/locale/index.js +0 -13
  176. package/lib/IconSelect/locale/ja_JP.js +0 -11
  177. package/lib/IconSelect/locale/zh_CN.js +0 -11
  178. package/lib/IconSelect/locale/zh_TW.js +0 -11
  179. package/lib/Joyride/locale/en_US.js +0 -25
  180. package/lib/Joyride/locale/index.js +0 -13
  181. package/lib/Joyride/locale/ja_JP.js +0 -25
  182. package/lib/Joyride/locale/zh_CN.js +0 -25
  183. package/lib/Joyride/locale/zh_TW.js +0 -25
  184. package/lib/Pagination/locale/en_US.js +0 -8
  185. package/lib/Pagination/locale/index.js +0 -13
  186. package/lib/Pagination/locale/ja_JP.js +0 -8
  187. package/lib/Pagination/locale/zh_CN.js +0 -8
  188. package/lib/Pagination/locale/zh_TW.js +0 -8
  189. package/lib/Progress/locale/en_US.js +0 -3
  190. package/lib/Progress/locale/index.js +0 -13
  191. package/lib/Progress/locale/ja_JP.js +0 -3
  192. package/lib/Progress/locale/zh_CN.js +0 -3
  193. package/lib/Progress/locale/zh_TW.js +0 -3
  194. package/lib/QuickTransfer/locale/en_US.js +0 -8
  195. package/lib/QuickTransfer/locale/index.js +0 -13
  196. package/lib/QuickTransfer/locale/ja_JP.js +0 -8
  197. package/lib/QuickTransfer/locale/zh_CN.js +0 -8
  198. package/lib/QuickTransfer/locale/zh_TW.js +0 -8
  199. package/lib/RangePicker/locale/en_US.js +0 -5
  200. package/lib/RangePicker/locale/index.js +0 -13
  201. package/lib/RangePicker/locale/ja_JP.js +0 -5
  202. package/lib/RangePicker/locale/zh_CN.js +0 -5
  203. package/lib/RangePicker/locale/zh_TW.js +0 -5
  204. package/lib/SearchBar/locale/en_US.js +0 -6
  205. package/lib/SearchBar/locale/index.js +0 -13
  206. package/lib/SearchBar/locale/ja_JP.js +0 -6
  207. package/lib/SearchBar/locale/zh_CN.js +0 -6
  208. package/lib/SearchBar/locale/zh_TW.js +0 -6
  209. package/lib/TimeRangeSlider/locale/en_US.js +0 -31
  210. package/lib/TimeRangeSlider/locale/index.js +0 -13
  211. package/lib/TimeRangeSlider/locale/ja_JP.js +0 -31
  212. package/lib/TimeRangeSlider/locale/zh_CN.js +0 -31
  213. package/lib/TimeRangeSlider/locale/zh_TW.js +0 -31
  214. package/lib/TreeSelect111/locale/en_US.js +0 -3
  215. package/lib/TreeSelect111/locale/index.js +0 -13
  216. package/lib/TreeSelect111/locale/ja_JP.js +0 -3
  217. package/lib/TreeSelect111/locale/zh_CN.js +0 -3
  218. package/lib/TreeSelect111/locale/zh_TW.js +0 -3
  219. package/lib/WangEditor/locale/index.js +0 -93
@@ -10,63 +10,29 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
10
10
  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; }
11
11
  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; } }
12
12
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
13
+ import formatRecentTime from '../../locales/messages/timeRanges';
13
14
  import moment from "moment";
15
+ import { getFallbackIntl } from '../../locales/runtime';
14
16
  var _require = require("uuid"),
15
17
  uuidv4 = _require.v4;
16
18
  // 枚举时间单位
17
19
  var ENUM_TimeUnit = {
18
20
  s: {
19
- zh_CN: "秒",
20
- en_US: {
21
- singular: "Second",
22
- plural: "Seconds"
23
- },
24
- zh_TW: "秒",
25
21
  unit: "seconds"
26
22
  },
27
23
  m: {
28
- zh_CN: "分钟",
29
- en_US: {
30
- singular: "Minute",
31
- plural: "Minutes"
32
- },
33
- zh_TW: "分鐘",
34
24
  unit: "minutes"
35
25
  },
36
26
  h: {
37
- zh_CN: "小时",
38
- en_US: {
39
- singular: "Hour",
40
- plural: "Hours"
41
- },
42
- zh_TW: "小時",
43
27
  unit: "hours"
44
28
  },
45
29
  d: {
46
- zh_CN: "天",
47
- en_US: {
48
- singular: "Day",
49
- plural: "Days"
50
- },
51
- zh_TW: "天",
52
30
  unit: "days"
53
31
  },
54
32
  mo: {
55
- zh_CN: "月",
56
- en_US: {
57
- singular: "Month",
58
- plural: "Months"
59
- },
60
- zh_TW: "月",
61
33
  unit: "mo"
62
34
  },
63
35
  y: {
64
- zh_CN: "年",
65
- en_US: {
66
- singular: "Year",
67
- plural: "Years"
68
- },
69
- zh_TW: "年",
70
36
  unit: "years"
71
37
  }
72
38
  };
@@ -121,62 +87,7 @@ export var judgeType = function judgeType(recordDateValue) {
121
87
  }
122
88
  return [isRule, captureUnit, recordUnit];
123
89
  };
124
- export var echoRecentlyTimeTitle = function echoRecentlyTimeTitle(locale, captureUnit) {
125
- // 参数验证
126
- if (!captureUnit || !Array.isArray(captureUnit) || captureUnit.length < 2) {
127
- return "";
128
- }
129
- var _captureUnit3 = _slicedToArray(captureUnit, 2),
130
- count = _captureUnit3[0],
131
- unit = _captureUnit3[1];
132
- var timeUnit = ENUM_TimeUnit[unit];
133
- if (!timeUnit) {
134
- return "";
135
- }
136
- var countNum = parseInt(count, 10);
137
-
138
- // 语言配置映射
139
- var localeConfig = {
140
- zh_CN: {
141
- template: function template(count, unitText) {
142
- return "\u6700\u8FD1".concat(count).concat(unit === "mo" ? "个" : "").concat(unitText);
143
- },
144
- getUnitText: function getUnitText() {
145
- return timeUnit.zh_CN;
146
- }
147
- },
148
- zh: {
149
- template: function template(count, unitText) {
150
- return "\u6700\u8FD1".concat(count).concat(unit === "mo" ? "个" : "").concat(unitText);
151
- },
152
- getUnitText: function getUnitText() {
153
- return timeUnit.zh_CN;
154
- }
155
- },
156
- zh_TW: {
157
- template: function template(count, unitText) {
158
- return "\u6700\u8FD1".concat(count).concat(unit === "mo" ? "個" : "").concat(unitText);
159
- },
160
- getUnitText: function getUnitText() {
161
- return timeUnit.zh_TW;
162
- }
163
- },
164
- "default": {
165
- template: function template(count, unitText) {
166
- return "Past ".concat(count, " ").concat(unitText);
167
- },
168
- getUnitText: function getUnitText() {
169
- var isPlural = countNum !== 1;
170
- return isPlural ? timeUnit.en_US.plural : timeUnit.en_US.singular;
171
- }
172
- }
173
- };
174
-
175
- // 获取当前语言配置,如果不存在则使用默认配置
176
- var config = localeConfig[locale] || localeConfig["default"];
177
- var unitText = config.getUnitText();
178
- return config.template(count, unitText);
179
- };
90
+ export var echoRecentlyTimeTitle = formatRecentTime;
180
91
  export var echoAbsoluteTimeTitle = function echoAbsoluteTimeTitle(value, format) {
181
92
  var hasTimeSpan = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
182
93
  var timeSpanBoundary = arguments.length > 3 ? arguments[3] : undefined;
@@ -194,6 +105,7 @@ export var echoInputValue = function echoInputValue() {
194
105
  var forceRenderTitle = arguments.length > 4 ? arguments[4] : undefined;
195
106
  var isAutoRefresh = arguments.length > 5 ? arguments[5] : undefined;
196
107
  var timeSpanBoundary = arguments.length > 6 ? arguments[6] : undefined;
108
+ var intl = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : getFallbackIntl(locale);
197
109
  var values = recordDateValue.value,
198
110
  title = recordDateValue.title;
199
111
  var _judgeType = judgeType(recordDateValue),
@@ -209,7 +121,7 @@ export var echoInputValue = function echoInputValue() {
209
121
  var _value2;
210
122
  if (title) return title;
211
123
  if (isRule) {
212
- return echoRecentlyTimeTitle(locale, captureUnit);
124
+ return echoRecentlyTimeTitle(locale, captureUnit, intl);
213
125
  }
214
126
  if (Array.isArray(value) && (_value2 = value) !== null && _value2 !== void 0 && _value2.length) {
215
127
  return echoAbsoluteTimeTitle(value, format, true, timeSpanBoundary);
@@ -223,7 +135,7 @@ export var echoInputValue = function echoInputValue() {
223
135
  if (isFoucs) {
224
136
  return recordUnit;
225
137
  }
226
- return echoRecentlyTimeTitle(locale, captureUnit);
138
+ return echoRecentlyTimeTitle(locale, captureUnit, intl);
227
139
  }
228
140
  if (Array.isArray(value) && (_value3 = value) !== null && _value3 !== void 0 && _value3.length) {
229
141
  return echoAbsoluteTimeTitle(value, format, true, timeSpanBoundary);
@@ -234,7 +146,7 @@ export var echoInputValue = function echoInputValue() {
234
146
  if (isFoucs) {
235
147
  return recordUnit;
236
148
  }
237
- return echoRecentlyTimeTitle(locale, captureUnit);
149
+ return echoRecentlyTimeTitle(locale, captureUnit, intl);
238
150
  }
239
151
  if (Array.isArray(value) && (_value4 = value) !== null && _value4 !== void 0 && _value4.length) {
240
152
  return echoAbsoluteTimeTitle(value, format, true, timeSpanBoundary);
@@ -513,9 +425,17 @@ export var getCorrectValue = function getCorrectValue(value) {
513
425
  * @param {Object} value
514
426
  * @returns
515
427
  */
516
- export var getHistoryInfo = function getHistoryInfo(recordValue, historyList, _ref, format, timeSpanBoundary) {
517
- var localeObj = _ref.localeObj,
518
- locale = _ref.locale;
428
+ export var getHistoryInfo = function getHistoryInfo(recordValue, historyList) {
429
+ var language = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
430
+ var format = arguments.length > 3 ? arguments[3] : undefined;
431
+ var timeSpanBoundary = arguments.length > 4 ? arguments[4] : undefined;
432
+ var _ref = typeof language === 'string' ? {
433
+ locale: language
434
+ } : language,
435
+ _ref$locale = _ref.locale,
436
+ locale = _ref$locale === void 0 ? 'zh_CN' : _ref$locale,
437
+ _ref$intl = _ref.intl,
438
+ intl = _ref$intl === void 0 ? getFallbackIntl(locale) : _ref$intl;
519
439
  var key = recordValue.key,
520
440
  value = recordValue.value,
521
441
  _recordValue$title = recordValue.title,
@@ -531,11 +451,11 @@ export var getHistoryInfo = function getHistoryInfo(recordValue, historyList, _r
531
451
  }
532
452
  if (isRule) {
533
453
  if (!title) {
534
- _title = echoRecentlyTimeTitle(locale, captureUnit);
454
+ _title = echoRecentlyTimeTitle(locale, captureUnit, intl);
535
455
  }
536
456
  }
537
457
  if (!values && !isRule && !_title) {
538
- _title = localeObj(["unconverted-title"]);
458
+ _title = intl.get("bbf8ccde-ab7c-4040-97eb-35b56742de27").d("未转化标题");
539
459
  }
540
460
  var isRepeat = Boolean(historyList.find(function (item) {
541
461
  return item.key === key || item.title === _title;
@@ -1,10 +1,10 @@
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
1
  import "@chaoswise/ui/lib/CWSelect/index.less";
3
2
  import _CWSelect from "@chaoswise/ui/lib/CWSelect";
4
3
  var _excluded = ["getSystemTimeZoneInfoApi", "onInitialChange", "getOptions"],
5
4
  _excluded2 = ["isSelected"];
6
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); }
7
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
6
+ 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 }; })(); }
7
+ 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); }
8
8
  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); }
9
9
  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); }); }; }
10
10
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
@@ -35,17 +35,17 @@ var TimeZoneSelect = function TimeZoneSelect(_ref) {
35
35
  useEffect(function () {
36
36
  // 组件初始化时调用接口获取时区列表
37
37
  var fetchTimeZones = /*#__PURE__*/function () {
38
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
39
- var response, data, timeZoneData, _timeZoneData, initialTimeZone;
40
- return _regeneratorRuntime().wrap(function _callee$(_context) {
41
- while (1) switch (_context.prev = _context.next) {
38
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
39
+ var response, data, timeZoneData, _timeZoneData, initialTimeZone, _t;
40
+ return _regenerator().w(function (_context) {
41
+ while (1) switch (_context.p = _context.n) {
42
42
  case 0:
43
43
  setLoading(true);
44
- _context.prev = 1;
45
- _context.next = 4;
44
+ _context.p = 1;
45
+ _context.n = 2;
46
46
  return getSystemTimeZoneInfoApi();
47
- case 4:
48
- response = _context.sent;
47
+ case 2:
48
+ response = _context.v;
49
49
  if (response.status === "success" && response.code == 100000) {
50
50
  data = response.data;
51
51
  timeZoneData = (data || []).map(function (item) {
@@ -75,21 +75,20 @@ var TimeZoneSelect = function TimeZoneSelect(_ref) {
75
75
  getOptions(_timeZoneData);
76
76
  }
77
77
  }
78
- _context.next = 11;
78
+ _context.n = 4;
79
79
  break;
80
- case 8:
81
- _context.prev = 8;
82
- _context.t0 = _context["catch"](1);
83
- console.error("获取时区列表失败:", _context.t0);
84
- case 11:
85
- _context.prev = 11;
80
+ case 3:
81
+ _context.p = 3;
82
+ _t = _context.v;
83
+ console.error("获取时区列表失败:", _t); // cw-i18n-disable-line
84
+ case 4:
85
+ _context.p = 4;
86
86
  setLoading(false);
87
- return _context.finish(11);
88
- case 14:
89
- case "end":
90
- return _context.stop();
87
+ return _context.f(4);
88
+ case 5:
89
+ return _context.a(2);
91
90
  }
92
- }, _callee, null, [[1, 8, 11, 14]]);
91
+ }, _callee, null, [[1, 3, 4, 5]]);
93
92
  }));
94
93
  return function fetchTimeZones() {
95
94
  return _ref2.apply(this, arguments);
@@ -5,7 +5,6 @@ import "@chaoswise/ui/lib/CWTree/index.less";
5
5
  import _CWTree from "@chaoswise/ui/lib/CWTree";
6
6
  import "@chaoswise/ui/lib/Checkbox/index.less";
7
7
  import _Checkbox from "@chaoswise/ui/lib/Checkbox";
8
- import _useLocale2 from "@chaoswise/ui/lib/useLocale";
9
8
  var _excluded = ["dropdownRender", "treeData", "showCheckAll", "children", "defaultValue", "value", "treeCheckable", "showCheckedStrategy"];
10
9
  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); }
11
10
  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; }
@@ -21,13 +20,12 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
21
20
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
22
21
  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; }
23
22
  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; }
23
+ import useIntl from '../useIntl';
24
24
  import React, { useState, useEffect, useMemo, forwardRef, Fragment, useRef } from "react";
25
25
  import CWTreeSelect from "../Antd4/tree-select";
26
26
  import PropTypes from "prop-types";
27
27
  import { getTreeData, flatTree, changeTreeData, getChild, getFilterPidKey } from "./utils";
28
28
  import { uniq } from "lodash-es";
29
- import langConfig from './locale';
30
- import { formatMessage } from "../utils";
31
29
  import "../Antd4/tree-select/style/index.less";
32
30
  import "./index.less";
33
31
  var TreeSelect = /*#__PURE__*/forwardRef(function (props, ref) {
@@ -42,8 +40,7 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (props, ref) {
42
40
  treeCheckable = props.treeCheckable,
43
41
  showCheckedStrategy = props.showCheckedStrategy,
44
42
  rest = _objectWithoutProperties(props, _excluded);
45
- var _useLocale = _useLocale2(langConfig),
46
- localeObj = _useLocale.langObj;
43
+ var intl = useIntl();
47
44
  var treeRef = useRef(null);
48
45
  // 全选模式选中项
49
46
  var _useState = useState([]),
@@ -116,7 +113,7 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (props, ref) {
116
113
  style: {
117
114
  width: "100%"
118
115
  }
119
- }, formatMessage(localeObj["checkAll"]), "(", treeSelectedKeys.length, "/", flatTreeData.length, ")")), /*#__PURE__*/React.createElement(_CWTree, {
116
+ }, intl.get("3991a1d0-65a8-45ca-94a4-f89fbd9f8555").d("全选"), "(", treeSelectedKeys.length, "/", flatTreeData.length, ")")), /*#__PURE__*/React.createElement(_CWTree, {
120
117
  ref: treeRef,
121
118
  treeData: _treeData,
122
119
  checkable: true,
@@ -6,6 +6,7 @@ import "antd/es/progress/style";
6
6
  import _Progress from "antd/es/progress";
7
7
  import "antd/es/button/style";
8
8
  import _Button from "antd/es/button";
9
+ import _useIntl from "@chaoswise/ui/lib/useIntl";
9
10
  import "antd/es/upload/style";
10
11
  import _Upload from "antd/es/upload";
11
12
  var _excluded = ["onChange", "uploadResult", "errorMessage", "successMessage", "showUploadList", "openMethod", "clickContent", "errorTitle", "draggerContent", "showUploadModal"];
@@ -26,25 +27,26 @@ import './index.less';
26
27
  * Upload上传组件,基于antd的Upload封装,增加进度条显示
27
28
  */
28
29
 
29
- function CWUpload(_ref) {
30
- var _ref$onChange = _ref.onChange,
31
- _onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
32
- _ref$uploadResult = _ref.uploadResult,
33
- uploadResult = _ref$uploadResult === void 0 ? 'noUpload' : _ref$uploadResult,
34
- errorMessage = _ref.errorMessage,
35
- successMessage = _ref.successMessage,
36
- _ref$showUploadList = _ref.showUploadList,
37
- showUploadList = _ref$showUploadList === void 0 ? false : _ref$showUploadList,
38
- _ref$openMethod = _ref.openMethod,
39
- openMethod = _ref$openMethod === void 0 ? 'drag' : _ref$openMethod,
40
- _ref$clickContent = _ref.clickContent,
41
- clickContent = _ref$clickContent === void 0 ? /*#__PURE__*/React.createElement(_Button, null, "\u5BFC\u5165/\u4E0A\u4F20") : _ref$clickContent,
42
- _ref$errorTitle = _ref.errorTitle,
43
- errorTitle = _ref$errorTitle === void 0 ? '错误报告' : _ref$errorTitle,
44
- draggerContent = _ref.draggerContent,
45
- _ref$showUploadModal = _ref.showUploadModal,
46
- showUploadModal = _ref$showUploadModal === void 0 ? true : _ref$showUploadModal,
47
- rest = _objectWithoutProperties(_ref, _excluded);
30
+ function CWUpload(props) {
31
+ var intl = _useIntl();
32
+ var _props$onChange = props.onChange,
33
+ _onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
34
+ _props$uploadResult = props.uploadResult,
35
+ uploadResult = _props$uploadResult === void 0 ? 'noUpload' : _props$uploadResult,
36
+ errorMessage = props.errorMessage,
37
+ successMessage = props.successMessage,
38
+ _props$showUploadList = props.showUploadList,
39
+ showUploadList = _props$showUploadList === void 0 ? false : _props$showUploadList,
40
+ _props$openMethod = props.openMethod,
41
+ openMethod = _props$openMethod === void 0 ? 'drag' : _props$openMethod,
42
+ _props$clickContent = props.clickContent,
43
+ clickContent = _props$clickContent === void 0 ? /*#__PURE__*/React.createElement(_Button, null, intl.get("6c35362b-6eb8-408d-b328-5445fa75c246").d("导入/上传")) : _props$clickContent,
44
+ _props$errorTitle = props.errorTitle,
45
+ errorTitle = _props$errorTitle === void 0 ? intl.get("e80b4a34-b399-4dea-8863-54089e2398cd").d("错误报告") : _props$errorTitle,
46
+ draggerContent = props.draggerContent,
47
+ _props$showUploadModa = props.showUploadModal,
48
+ showUploadModal = _props$showUploadModa === void 0 ? true : _props$showUploadModa,
49
+ rest = _objectWithoutProperties(props, _excluded);
48
50
  var _useState = useState(false),
49
51
  _useState2 = _slicedToArray(_useState, 2),
50
52
  visible = _useState2[0],
@@ -82,7 +84,7 @@ function CWUpload(_ref) {
82
84
  strokeColor: "#69c0ff"
83
85
  }), /*#__PURE__*/React.createElement("p", {
84
86
  className: "cw-upload-modal-process-uploading"
85
- }, "\u4E0A\u4F20\u4E2D..."));
87
+ }, intl.get("186b6eee-ecd8-4cd7-9583-07af23f7dc90").d("上传中...")));
86
88
  } else if (uploadResult === 'error') {
87
89
  if (errorMessage) {
88
90
  return /*#__PURE__*/React.createElement("div", null, errorMessage);
@@ -97,9 +99,9 @@ function CWUpload(_ref) {
97
99
  }
98
100
  }), /*#__PURE__*/React.createElement("p", {
99
101
  className: "cw-upload-modal-process-error"
100
- }, "\u4E0A\u4F20\u5931\u8D25!"), /*#__PURE__*/React.createElement(_Button, {
102
+ }, intl.get("2cccb02f-cef2-42b0-9fdd-29f136b2155b").d("上传失败!")), /*#__PURE__*/React.createElement(_Button, {
101
103
  onClick: onCancel
102
- }, "\u5173\u95ED"));
104
+ }, intl.get("09922d4f-ff2b-48e9-9c3e-d0512a85dd78").d("关闭")));
103
105
  }
104
106
  } else if (uploadResult === 'done') {
105
107
  if (successMessage) {
@@ -115,9 +117,9 @@ function CWUpload(_ref) {
115
117
  }
116
118
  }), /*#__PURE__*/React.createElement("p", {
117
119
  className: "cw-upload-modal-process-success"
118
- }, "\u4E0A\u4F20\u6210\u529F!"), /*#__PURE__*/React.createElement(_Button, {
120
+ }, intl.get("4bcc7372-6859-4d38-87f3-5edd439aac11").d("上传成功!")), /*#__PURE__*/React.createElement(_Button, {
119
121
  onClick: onCancel
120
- }, "\u5173\u95ED"));
122
+ }, intl.get("09922d4f-ff2b-48e9-9c3e-d0512a85dd78").d("关闭")));
121
123
  }
122
124
  }
123
125
  };
@@ -133,7 +135,7 @@ function CWUpload(_ref) {
133
135
  className: "cw-upload-drag-iconfloder"
134
136
  })), /*#__PURE__*/React.createElement("p", {
135
137
  className: "cw-upload-text"
136
- }, "\u5355\u51FB\u6216\u62D6\u52A8\u6587\u4EF6\u5230\u6B64\u533A\u57DF"))), showUploadModal && /*#__PURE__*/React.createElement(_Modal, {
138
+ }, intl.get("dda16720-d447-4d73-9e71-b5af7b5bbcfd").d("单击或拖动文件到此区域")))), showUploadModal && /*#__PURE__*/React.createElement(_Modal, {
137
139
  closable: status !== 'uploading' ? true : false,
138
140
  visible: visible,
139
141
  onCancel: onCancel,
@@ -2,6 +2,7 @@ import "antd/es/icon/style";
2
2
  import _Icon from "antd/es/icon";
3
3
  import "@chaoswise/ui/lib/Header/index.less";
4
4
  import _Header from "@chaoswise/ui/lib/Header";
5
+ import _useIntl from "@chaoswise/ui/lib/useIntl";
5
6
  var _excluded = ["children", "type", "breadCrumb", "backNavigationTitle", "onClickBack", "className", "contentClassName", "backIcon", "hasFooter"];
6
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; }
7
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; }
@@ -27,6 +28,7 @@ function VerticalLayout(_ref) {
27
28
  backIcon = _ref.backIcon,
28
29
  hasFooter = _ref.hasFooter,
29
30
  rest = _objectWithoutProperties(_ref, _excluded);
31
+ var intl = _useIntl();
30
32
  var navigate;
31
33
  var history = useHistory();
32
34
  if (type === 'topNavigation') {
@@ -47,7 +49,7 @@ function VerticalLayout(_ref) {
47
49
  className: "cw-vertical-layout-back-btn"
48
50
  }, backIcon), /*#__PURE__*/React.createElement("div", {
49
51
  className: "cw-vertical-layout-back-title"
50
- }, backNavigationTitle ? backNavigationTitle : '返回')));
52
+ }, backNavigationTitle ? backNavigationTitle : intl.get("26935dff-3710-42be-bf75-175785ea86a1").d("返回"))));
51
53
  }
52
54
  return /*#__PURE__*/React.createElement("div", {
53
55
  className: classnames('cw-vertical-layout', type !== 'topNavigation' && (navigate ? 'cw-vertical-layout-content-show-no-nav' : 'cw-vertical-layout-content-show'),
@@ -0,0 +1,19 @@
1
+ // Keys are the vendor's original text-matching contract, not translatable IDs.
2
+ // Longer labels must match before short keys such as 行/图片/链接.
3
+ export default function createEditorExtraLanguage(intl) {
4
+ return {
5
+ 编辑表格: intl.get("23c6b612-75a3-493a-b013-c0b730491242").d("编辑表格"),
6
+ 增加行: intl.get("f2164183-c243-48b0-af98-c34d7911f8e1").d("增加行"),
7
+ 删除行: intl.get("9741465f-631b-420c-9d3d-2fd42ec38091").d("删除行"),
8
+ 增加列: intl.get("87fe28d0-e61a-4976-a73e-986d4ccc446a").d("增加列"),
9
+ 删除列: intl.get("c7670924-564a-444c-82d0-f1c2aa3a47f9").d("删除列"),
10
+ 删除表格: intl.get("39c2b85f-3214-49b0-814e-f719da94b453").d("删除表格"),
11
+ 编辑图片: intl.get("3a661736-0548-47ce-9b6d-b1c92d27a719").d("编辑图片"),
12
+ 最大宽度: intl.get("f85b3af5-cf2c-494f-880e-96d778921af0").d("最大宽度"),
13
+ 删除图片: intl.get("8197e587-0609-4182-8925-d8c99110b32f").d("删除图片"),
14
+ 删除链接: intl.get("89428c42-3c95-4c92-8c9d-93cbacc18cf2").d("删除链接"),
15
+ 图片链接: intl.get("35c36863-820d-44a0-b764-bdd87601eb00").d("图片链接"),
16
+ 查看链接: intl.get("0008cae5-0e10-4d68-959f-ead9b6ee8ccb").d("查看链接"),
17
+ 取消链接: intl.get("cb9eac1e-5ffd-43fe-80f4-158187fdd94e").d("取消链接")
18
+ };
19
+ }
@@ -2,21 +2,16 @@ import _ConfigProvider from "@chaoswise/ui/lib/ConfigProvider";
2
2
  var _excluded = ["isSeparation", "htmlContent", "value", "disabled", "onChange", "onFocus", "onBlur", "pasteTextHandle", "autoFocus", "isUsePreview", "dropListPosition"];
3
3
  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; }
4
4
  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; }
5
- import React, { useEffect, Fragment, useRef, forwardRef } from "react";
5
+ import React, { useEffect, Fragment, useRef, forwardRef, useMemo } from "react";
6
6
  import E from "./wangEditor";
7
7
  import PropTypes from "prop-types";
8
8
  import "./index.less";
9
- import { localeObj, localObjTW, localObjJA } from "./locale/index";
9
+ import useIntl from '../useIntl';
10
+ import createEditorMessages from '../locales/messages/editor';
11
+ import { formatEditorMessage } from './messages';
10
12
  import usePreview from "../usePreview";
11
13
  import resizeable from "./resizeable";
12
- var localOptionsMap = {
13
- en: localeObj,
14
- en_US: localeObj,
15
- zh_TW: localObjTW,
16
- ja_JP: localObjJA,
17
- zh: {},
18
- zh_CN: {}
19
- };
14
+
20
15
  /**
21
16
  * 基于wangEditor封装 支持value受控 ref获取editor实例;
22
17
  * 如当前API无法满足使用,请查阅官方文档,使用ref获取editor实例来进行操作
@@ -55,6 +50,13 @@ var WangEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
55
50
  var _ConfigProvider$useLo = _ConfigProvider.useLocale(),
56
51
  _ConfigProvider$useLo2 = _ConfigProvider$useLo.locale,
57
52
  locale = _ConfigProvider$useLo2 === void 0 ? "zh_CN" : _ConfigProvider$useLo2;
53
+ var intl = useIntl();
54
+ var intlRef = useRef(intl);
55
+ intlRef.current = intl;
56
+ // WangEditor expects a keyed dictionary, rebuilt only when its Provider changes.
57
+ var editorMessages = useMemo(function () {
58
+ return createEditorMessages(intl);
59
+ }, [intl]);
58
60
 
59
61
  // 初始化编辑器
60
62
  useEffect(function () {
@@ -103,11 +105,11 @@ var WangEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
103
105
  });
104
106
  useEffect(function () {
105
107
  // 切换语言
106
- editor.current.customConfig.lang = localOptionsMap[locale];
108
+ editor.current.customConfig.lang = editorMessages;
107
109
  editor.current._initConfig();
108
110
  editor.current.$toolbarElem.html("");
109
111
  editor.current._initMenus();
110
- }, [locale]);
112
+ }, [locale, editorMessages]);
111
113
  useEffect(function () {
112
114
  editor.current.txt.html(htmlContent, true); // 第二个参数是否外部受控
113
115
  }, [htmlContent]);
@@ -134,7 +136,11 @@ var WangEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
134
136
  editor.customConfig.onblur = onBlur;
135
137
  editor.customConfig.onfocus = onFocus;
136
138
  editor.customConfig.pasteTextHandle = pasteTextHandle;
137
- editor.customConfig.lang = localOptionsMap[locale];
139
+ editor.customConfig.lang = editorMessages;
140
+ // Upload callbacks may outlive a language switch; never use a host singleton.
141
+ editor.customConfig.formatEditorMessage = function (key, values) {
142
+ return formatEditorMessage(intlRef.current, key, values);
143
+ };
138
144
  for (var i in rest) {
139
145
  editor.customConfig[i] = rest[i];
140
146
  }
@@ -0,0 +1,49 @@
1
+ // Complete messages are collected here, never from vendor HTML/regular expressions.
2
+ // Resolve the owning editor's latest instance at call time, including async uploads.
3
+ export function formatEditorMessage(instance, key) {
4
+ var values = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
5
+ var intl = {
6
+ get: function get(id, params) {
7
+ var translated = instance && instance.get(id, params);
8
+ return {
9
+ d: function d(defaultText) {
10
+ // The shared runtime does not interpolate .d() fallbacks. Do not replace
11
+ // placeholders in an already formatted value (a filename may contain braces).
12
+ var fallback = params ? defaultText.replace(/\{(\w+)\}/g, function (match, name) {
13
+ return Object.prototype.hasOwnProperty.call(params, name) ? String(params[name]) : match;
14
+ }) : defaultText;
15
+ return translated ? translated.d(fallback) : fallback;
16
+ }
17
+ };
18
+ }
19
+ };
20
+ switch (key) {
21
+ case 'invalidUrl':
22
+ return intl.get("aaea929d-30e5-4b60-a45a-4256691e8a1d").d("请输入合法Url");
23
+ case 'insertImageError':
24
+ return intl.get("44d3a472-c460-4a95-813a-49964150ae3a").d("插入图片错误");
25
+ case 'validationFailed':
26
+ return intl.get("d1cf4325-4eb7-4c2a-a00d-21b7d1eb2099").d("图片验证未通过:");
27
+ case 'timeout':
28
+ return intl.get("80fae3ef-2b7b-4a9f-b038-3f225ab83f0f").d("上传图片超时");
29
+ case 'uploadError':
30
+ return intl.get("8d5855ff-56ed-4a99-b891-92e44120e08e").d("上传图片发生错误");
31
+ case 'uploadFailed':
32
+ return intl.get("d8cbb0d5-aca8-419e-9490-5e74a72bd679").d("上传图片失败");
33
+ case 'notImage':
34
+ return intl.get("56f81fb7-f329-4a94-85f1-eaab02e1301e", {
35
+ slot0: values.name
36
+ }).d("【{slot0}】不是图片");
37
+ case 'tooLarge':
38
+ return intl.get("7d303d2b-0b2f-4db9-9ff6-380f80c31425", {
39
+ slot0: values.name,
40
+ slot1: values.size
41
+ }).d("【{slot0}】大于 {slot1}M");
42
+ case 'uploadLimit':
43
+ return intl.get("4c55ce9e-3bfc-401f-a9ac-711a36dbe792", {
44
+ slot0: values.count
45
+ }).d("一次最多上传{slot0}张图片");
46
+ default:
47
+ throw new Error("Unknown editor message: ".concat(key));
48
+ }
49
+ }