@chaoswise/ui 2.7.11 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AlgorithmChart/common/chart.option.js +14 -11
- package/lib/AlgorithmChart/index.js +29 -26
- package/lib/Antd4/comment/index.js +1 -1
- package/lib/Antd4Form/FormItem.js +1 -1
- package/lib/BasicLayout/Nav.js +3 -5
- package/lib/BasicLayout/index.js +9 -10
- package/lib/CWCascader/rc-cascader/OptionList/Column.js +17 -18
- package/lib/CWMessage/MessageContent/TabList/index.js +19 -17
- package/lib/CWMessage/MessageContent/index.js +86 -73
- package/lib/CWMessage/index.js +62 -50
- package/lib/CWMessage/service/index.js +14 -14
- package/lib/CWMessage/utils/index.js +18 -11
- package/lib/CWRangePicker/DropdownMenu/MoreHistoryList/index.js +16 -10
- package/lib/CWRangePicker/DropdownMenu/MoreTimeList/index.js +4 -6
- package/lib/CWRangePicker/DropdownMenu/index.js +20 -13
- package/lib/CWRangePicker/Refresh/index.js +4 -7
- package/lib/CWRangePicker/TimeSpan/index.js +6 -9
- package/lib/CWRangePicker/index.js +39 -32
- package/lib/CWRangePicker/utils/index.js +45 -114
- package/lib/CWSelect/index.js +7 -10
- package/lib/CWTable/CWTable.js +23 -23
- package/lib/CWTable/EditLine.js +5 -8
- package/lib/CWTable/Filter.js +5 -8
- package/lib/CWTable/index.js +3 -0
- package/lib/CWTree/index.js +4 -7
- package/lib/CWUpload/upload/Dragger.js +4 -7
- package/lib/CWUpload/upload/UploadList.js +12 -15
- package/lib/CardSelect/index.js +16 -14
- package/lib/CitySelect/index.js +3 -1
- package/lib/ColorPicker/index.js +4 -7
- package/lib/ConfigProvider/ConfigProvider.js +143 -48
- package/lib/ConfigProvider/Switch.js +10 -2
- package/lib/ConfigProvider/context.js +8 -0
- package/lib/ConfigProvider/useLocale.js +1 -1
- package/lib/DatePicker/useLocale.js +17 -10
- package/lib/DateRangePicker/RangeDateTimePicker.js +3 -3
- package/lib/DateRangePicker/components/ExtraQuickFooter.js +5 -8
- package/lib/DateRangePicker/index.js +6 -5
- package/lib/DropdownDatePicker/DropdownMenu/MoreTimeList/index.js +4 -6
- package/lib/DropdownDatePicker/DropdownMenu/index.js +4 -7
- package/lib/DropdownDatePicker/index.js +12 -13
- package/lib/DropdownDatePicker/utils/index.js +5 -93
- package/lib/EchartsBar/index.js +1 -1
- package/lib/Empty/index.js +3 -6
- package/lib/ErrorBoundary/ErrorPage.js +8 -9
- package/lib/Exception/index.js +9 -12
- package/lib/FilterDropDown/index.js +3 -6
- package/lib/Flow/tools/index.js +4 -1
- package/lib/Header/Document/index.js +3 -8
- package/lib/Header/LocaleSwitcher.js +2 -0
- package/lib/Header/UserSetting/index.js +27 -45
- package/lib/IconSelect/components/CustomImg/index.js +8 -11
- package/lib/IconSelect/components/SearchIcon/index.js +9 -9
- package/lib/IconSelect/index.js +4 -7
- package/lib/ImagePreview/index.js +3 -1
- package/lib/Joyride/List.js +9 -8
- package/lib/Joyride/index.js +22 -25
- package/lib/ModuleFederation/react-dynamic-remote-component/RemoteComponent.js +38 -39
- package/lib/ModuleFederation/react-dynamic-remote-component/load-module.js +22 -23
- package/lib/Pagination/index.js +14 -14
- package/lib/PolymerizationSearch/DropdownMenu.js +4 -2
- package/lib/PolymerizationSearch/index.js +7 -7
- package/lib/Progress/index.js +3 -6
- package/lib/QuickTransfer/DragList.js +3 -6
- package/lib/QuickTransfer/index.js +19 -22
- package/lib/RangePicker/components/ExtraTimeFooter.js +4 -7
- package/lib/SearchBar/OutSearch.js +9 -2
- package/lib/SearchBar/index.js +13 -16
- package/lib/SimpleCard/index.js +3 -1
- package/lib/SingleSpa/index.js +30 -26
- package/lib/ThemeProvider/Switcher.js +3 -1
- package/lib/TimeRangeSlider/Refresh/index.js +4 -7
- package/lib/TimeRangeSlider/TimeRangeSliderCmp/hooks/useMouse.js +3 -3
- package/lib/TimeRangeSlider/TimeSpan/index.js +6 -9
- package/lib/TimeRangeSlider/index.js +28 -24
- package/lib/TimeRangeSlider/utils/index.js +20 -100
- package/lib/TimeZoneSelect/index.js +21 -22
- package/lib/TreeSelect111/index.js +3 -6
- package/lib/Upload-back/index.js +27 -25
- package/lib/VerticalLayout/index.js +3 -1
- package/lib/WangEditor/extraLanguage.js +19 -0
- package/lib/WangEditor/index.js +19 -13
- package/lib/WangEditor/messages.js +49 -0
- package/lib/WangEditor/wangEditor.js +47 -20
- package/lib/index.js +1 -0
- package/lib/locales/en_US.json +1 -0
- package/lib/locales/index.js +2 -0
- package/lib/locales/ja_JP.json +1 -0
- package/lib/locales/load.js +48 -0
- package/lib/locales/messages/antd.js +404 -0
- package/lib/locales/messages/editor.js +42 -0
- package/lib/locales/messages/timeRanges.js +36 -0
- package/lib/locales/messages/timeTypes.js +11 -0
- package/lib/locales/runtime.js +127 -0
- package/lib/locales/zh_CN.json +1 -0
- package/lib/locales/zh_HK.json +1 -0
- package/lib/locales/zh_TW.json +1 -0
- package/lib/useIntl/index.js +9 -0
- package/lib/useLocale/index.js +16 -13
- package/lib/utils/index.js +4 -1
- package/package.json +14 -3
- package/lib/BasicLayout/locale/en_US.js +0 -4
- package/lib/BasicLayout/locale/index.js +0 -13
- package/lib/BasicLayout/locale/ja_JP.js +0 -4
- package/lib/BasicLayout/locale/zh_CN.js +0 -4
- package/lib/BasicLayout/locale/zh_TW.js +0 -4
- package/lib/CWMessage/locale/en_US.js +0 -8
- package/lib/CWMessage/locale/index.js +0 -13
- package/lib/CWMessage/locale/ja_JP.js +0 -8
- package/lib/CWMessage/locale/zh_CN.js +0 -8
- package/lib/CWMessage/locale/zh_TW.js +0 -8
- package/lib/CWRangePicker/locale/en_US.js +0 -29
- package/lib/CWRangePicker/locale/index.js +0 -13
- package/lib/CWRangePicker/locale/ja_JP.js +0 -29
- package/lib/CWRangePicker/locale/zh_CN.js +0 -29
- package/lib/CWRangePicker/locale/zh_TW.js +0 -29
- package/lib/CWSelect/locale/en_US.js +0 -4
- package/lib/CWSelect/locale/index.js +0 -13
- package/lib/CWSelect/locale/ja_JP.js +0 -4
- package/lib/CWSelect/locale/zh_CN.js +0 -4
- package/lib/CWSelect/locale/zh_TW.js +0 -4
- package/lib/CWTable/locale/en_US.js +0 -6
- package/lib/CWTable/locale/index.js +0 -13
- package/lib/CWTable/locale/ja_JP.js +0 -6
- package/lib/CWTable/locale/zh_CN.js +0 -6
- package/lib/CWTable/locale/zh_TW.js +0 -6
- package/lib/CWTree/locale/en_US.js +0 -3
- package/lib/CWTree/locale/index.js +0 -13
- package/lib/CWTree/locale/ja_JP.js +0 -3
- package/lib/CWTree/locale/zh_CN.js +0 -3
- package/lib/CWTree/locale/zh_TW.js +0 -3
- package/lib/CWUpload/locale/en_US.js +0 -6
- package/lib/CWUpload/locale/index.js +0 -13
- package/lib/CWUpload/locale/ja_JP.js +0 -6
- package/lib/CWUpload/locale/zh_CN.js +0 -6
- package/lib/CWUpload/locale/zh_TW.js +0 -6
- package/lib/Card/index.less +0 -10
- package/lib/ColorPicker/locale/en_US.js +0 -4
- package/lib/ColorPicker/locale/index.js +0 -13
- package/lib/ColorPicker/locale/ja_JP.js +0 -4
- package/lib/ColorPicker/locale/zh_CN.js +0 -4
- package/lib/ColorPicker/locale/zh_TW.js +0 -4
- package/lib/DateRangePicker/locale/en_US.js +0 -5
- package/lib/DateRangePicker/locale/index.js +0 -13
- package/lib/DateRangePicker/locale/ja_JP.js +0 -5
- package/lib/DateRangePicker/locale/zh_CN.js +0 -5
- package/lib/DateRangePicker/locale/zh_TW.js +0 -5
- package/lib/DropdownDatePicker/locale/en_US.js +0 -21
- package/lib/DropdownDatePicker/locale/index.js +0 -13
- package/lib/DropdownDatePicker/locale/ja_JP.js +0 -21
- package/lib/DropdownDatePicker/locale/zh_CN.js +0 -21
- package/lib/DropdownDatePicker/locale/zh_TW.js +0 -21
- package/lib/Empty/locale/en_US.js +0 -3
- package/lib/Empty/locale/index.js +0 -13
- package/lib/Empty/locale/ja_JP.js +0 -3
- package/lib/Empty/locale/zh_CN.js +0 -3
- package/lib/Empty/locale/zh_TW.js +0 -3
- package/lib/ErrorBoundary/index.less +0 -15
- package/lib/ErrorBoundary/locale/en_US.js +0 -5
- package/lib/ErrorBoundary/locale/index.js +0 -13
- package/lib/ErrorBoundary/locale/ja_JP.js +0 -5
- package/lib/ErrorBoundary/locale/zh_CN.js +0 -5
- package/lib/ErrorBoundary/locale/zh_TW.js +0 -5
- package/lib/Exception/locale/en_US.js +0 -9
- package/lib/Exception/locale/index.js +0 -13
- package/lib/Exception/locale/ja_JP.js +0 -9
- package/lib/Exception/locale/zh_CN.js +0 -9
- package/lib/Exception/locale/zh_TW.js +0 -9
- package/lib/FilterDropDown/locale/en_US.js +0 -3
- package/lib/FilterDropDown/locale/index.js +0 -13
- package/lib/FilterDropDown/locale/ja_JP.js +0 -3
- package/lib/FilterDropDown/locale/zh_CN.js +0 -3
- package/lib/FilterDropDown/locale/zh_TW.js +0 -3
- package/lib/IconSelect/locale/en_US.js +0 -11
- package/lib/IconSelect/locale/index.js +0 -13
- package/lib/IconSelect/locale/ja_JP.js +0 -11
- package/lib/IconSelect/locale/zh_CN.js +0 -11
- package/lib/IconSelect/locale/zh_TW.js +0 -11
- package/lib/Joyride/locale/en_US.js +0 -25
- package/lib/Joyride/locale/index.js +0 -13
- package/lib/Joyride/locale/ja_JP.js +0 -25
- package/lib/Joyride/locale/zh_CN.js +0 -25
- package/lib/Joyride/locale/zh_TW.js +0 -25
- package/lib/Pagination/locale/en_US.js +0 -8
- package/lib/Pagination/locale/index.js +0 -13
- package/lib/Pagination/locale/ja_JP.js +0 -8
- package/lib/Pagination/locale/zh_CN.js +0 -8
- package/lib/Pagination/locale/zh_TW.js +0 -8
- package/lib/Progress/locale/en_US.js +0 -3
- package/lib/Progress/locale/index.js +0 -13
- package/lib/Progress/locale/ja_JP.js +0 -3
- package/lib/Progress/locale/zh_CN.js +0 -3
- package/lib/Progress/locale/zh_TW.js +0 -3
- package/lib/QuickTransfer/locale/en_US.js +0 -8
- package/lib/QuickTransfer/locale/index.js +0 -13
- package/lib/QuickTransfer/locale/ja_JP.js +0 -8
- package/lib/QuickTransfer/locale/zh_CN.js +0 -8
- package/lib/QuickTransfer/locale/zh_TW.js +0 -8
- package/lib/RangePicker/locale/en_US.js +0 -5
- package/lib/RangePicker/locale/index.js +0 -13
- package/lib/RangePicker/locale/ja_JP.js +0 -5
- package/lib/RangePicker/locale/zh_CN.js +0 -5
- package/lib/RangePicker/locale/zh_TW.js +0 -5
- package/lib/SearchBar/locale/en_US.js +0 -6
- package/lib/SearchBar/locale/index.js +0 -13
- package/lib/SearchBar/locale/ja_JP.js +0 -6
- package/lib/SearchBar/locale/zh_CN.js +0 -6
- package/lib/SearchBar/locale/zh_TW.js +0 -6
- package/lib/TimeRangeSlider/locale/en_US.js +0 -31
- package/lib/TimeRangeSlider/locale/index.js +0 -13
- package/lib/TimeRangeSlider/locale/ja_JP.js +0 -31
- package/lib/TimeRangeSlider/locale/zh_CN.js +0 -31
- package/lib/TimeRangeSlider/locale/zh_TW.js +0 -31
- package/lib/TreeSelect111/locale/en_US.js +0 -3
- package/lib/TreeSelect111/locale/index.js +0 -13
- package/lib/TreeSelect111/locale/ja_JP.js +0 -3
- package/lib/TreeSelect111/locale/zh_CN.js +0 -3
- package/lib/TreeSelect111/locale/zh_TW.js +0 -3
- package/lib/WangEditor/locale/index.js +0 -93
|
@@ -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 =
|
|
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
|
|
517
|
-
var
|
|
518
|
-
|
|
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 =
|
|
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
|
|
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__*/
|
|
39
|
-
var response, data, timeZoneData, _timeZoneData, initialTimeZone;
|
|
40
|
-
return
|
|
41
|
-
while (1) switch (_context.
|
|
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.
|
|
45
|
-
_context.
|
|
44
|
+
_context.p = 1;
|
|
45
|
+
_context.n = 2;
|
|
46
46
|
return getSystemTimeZoneInfoApi();
|
|
47
|
-
case
|
|
48
|
-
response = _context.
|
|
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.
|
|
78
|
+
_context.n = 4;
|
|
79
79
|
break;
|
|
80
|
-
case
|
|
81
|
-
_context.
|
|
82
|
-
|
|
83
|
-
console.error("获取时区列表失败:",
|
|
84
|
-
case
|
|
85
|
-
_context.
|
|
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.
|
|
88
|
-
case
|
|
89
|
-
|
|
90
|
-
return _context.stop();
|
|
87
|
+
return _context.f(4);
|
|
88
|
+
case 5:
|
|
89
|
+
return _context.a(2);
|
|
91
90
|
}
|
|
92
|
-
}, _callee, null, [[1,
|
|
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
|
|
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
|
-
},
|
|
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,
|
package/lib/Upload-back/index.js
CHANGED
|
@@ -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(
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
uploadResult =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
showUploadList =
|
|
38
|
-
|
|
39
|
-
openMethod =
|
|
40
|
-
|
|
41
|
-
clickContent =
|
|
42
|
-
|
|
43
|
-
errorTitle =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
}, "
|
|
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
|
-
}, "
|
|
102
|
+
}, intl.get("2cccb02f-cef2-42b0-9fdd-29f136b2155b").d("上传失败!")), /*#__PURE__*/React.createElement(_Button, {
|
|
101
103
|
onClick: onCancel
|
|
102
|
-
}, "
|
|
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
|
-
}, "
|
|
120
|
+
}, intl.get("4bcc7372-6859-4d38-87f3-5edd439aac11").d("上传成功!")), /*#__PURE__*/React.createElement(_Button, {
|
|
119
121
|
onClick: onCancel
|
|
120
|
-
}, "
|
|
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
|
-
}, "
|
|
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
|
+
}
|
package/lib/WangEditor/index.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
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
|
+
}
|