@chaoswise/ui 3.1.22 → 3.2.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/BasicLayout/Nav.js +3 -1
- package/lib/BasicLayout/index.js +7 -10
- package/lib/CWMessage/MessageContent/index.js +7 -7
- package/lib/CWRangePicker/DropdownMenu/index.js +3 -3
- package/lib/CWRangePicker/index.js +7 -7
- package/lib/CWRangePicker/utils/generate/dayjs.js +6 -104
- package/lib/CWRangePicker/utils/generate/moment.js +6 -104
- package/lib/CardSelect/index.js +24 -17
- package/lib/CitySelect/index.js +3 -1
- package/lib/ConfigProvider/ConfigProvider.js +45 -37
- package/lib/ConfigProvider/Switch.js +9 -3
- package/lib/ConfigProvider/generate/dayjs.js +67 -16
- package/lib/ConfigProvider/generate/moment.js +66 -12
- package/lib/ConfigProvider/locale.js +25 -0
- package/lib/ErrorBoundary/ErrorPage.js +3 -2
- package/lib/Flow/tools/index.js +1 -1
- package/lib/Header/LocaleSwitcher.js +8 -13
- package/lib/Header/UserSetting/i18n/index.js +9 -0
- package/lib/Header/UserSetting/index.js +8 -26
- package/lib/IconSelect/components/SearchIcon/index.js +3 -3
- package/lib/Pagination/index.js +3 -12
- package/lib/SimpleCard/index.js +3 -1
- package/lib/SingleSpa/index.js +3 -1
- package/lib/ThemeProvider/Switcher.js +3 -1
- package/lib/TimeRangeSlider/index.js +7 -7
- package/lib/TimeRangeSlider/utils/generate/dayjs.js +6 -90
- package/lib/TimeRangeSlider/utils/generate/moment.js +6 -104
- package/lib/WangEditor/i18n/extra.js +18 -0
- package/lib/WangEditor/i18n/index.js +43 -0
- package/lib/WangEditor/i18n/messages.js +52 -0
- package/lib/WangEditor/index.js +6 -13
- package/lib/WangEditor/locale/index.js +1 -0
- package/lib/WangEditor/wangEditor.js +61 -29
- package/lib/locales/en_US.json +1 -1
- package/lib/locales/index.js +54 -47
- package/lib/locales/intl.js +1 -5
- package/lib/locales/ja_JP.json +1 -1
- package/lib/locales/locale.js +33 -0
- package/lib/locales/zh_CN.json +1 -1
- package/lib/locales/zh_HK.json +1 -0
- package/lib/locales/zh_TW.json +1 -1
- package/lib/utils/i18n/getLocaleIntl.js +44 -0
- package/lib/utils/i18n/recently.js +52 -0
- package/lib/utils/index.js +2 -1
- package/package.json +5 -2
package/lib/BasicLayout/Nav.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useIntl } from "../locales";
|
|
2
3
|
function Nav(_ref) {
|
|
3
4
|
var customContent = _ref.customContent,
|
|
4
5
|
showBreadcrumb = _ref.showBreadcrumb,
|
|
@@ -8,6 +9,7 @@ function Nav(_ref) {
|
|
|
8
9
|
_ref$onClickBack = _ref.onClickBack,
|
|
9
10
|
onClickBack = _ref$onClickBack === void 0 ? function () {} : _ref$onClickBack,
|
|
10
11
|
breadCrumb = _ref.breadCrumb;
|
|
12
|
+
var intl = useIntl();
|
|
11
13
|
if (customContent) {
|
|
12
14
|
return null;
|
|
13
15
|
}
|
|
@@ -25,7 +27,7 @@ function Nav(_ref) {
|
|
|
25
27
|
className: "cw-content-nav-back-btn"
|
|
26
28
|
}, backIcon), /*#__PURE__*/React.createElement("div", {
|
|
27
29
|
className: "cw-content-nav-back-title"
|
|
28
|
-
}, backNavigationTitle ||
|
|
30
|
+
}, backNavigationTitle || intl.get("26935dff-3710-42be-bf75-175785ea86a1").d("返回")))));
|
|
29
31
|
}
|
|
30
32
|
if (showBreadcrumb) {
|
|
31
33
|
return /*#__PURE__*/React.createElement("div", {
|
package/lib/BasicLayout/index.js
CHANGED
|
@@ -19,7 +19,8 @@ import Sider from "./Sider";
|
|
|
19
19
|
import Nav from "./Nav";
|
|
20
20
|
import { eventManager } from '../utils';
|
|
21
21
|
import { judgeIsIframe } from "./utils";
|
|
22
|
-
import
|
|
22
|
+
import { useIntl } from "../locales";
|
|
23
|
+
import useLocale from "../ConfigProvider/useLocale";
|
|
23
24
|
import useStyle from "./style/index";
|
|
24
25
|
var Content = _Layout.Content,
|
|
25
26
|
AntHeader = _Layout.Header;
|
|
@@ -92,6 +93,7 @@ var BasicLayout = function BasicLayout(_ref) {
|
|
|
92
93
|
topNavigationOption = _ref$topNavigationOpt === void 0 ? {} : _ref$topNavigationOpt,
|
|
93
94
|
_ref$style = _ref.style,
|
|
94
95
|
style = _ref$style === void 0 ? {} : _ref$style;
|
|
96
|
+
var intl = useIntl();
|
|
95
97
|
var isInIrame = judgeIsIframe();
|
|
96
98
|
var _useConfigContext = _useConfigContext2(),
|
|
97
99
|
getPrefixCls = _useConfigContext.getPrefixCls;
|
|
@@ -101,8 +103,8 @@ var BasicLayout = function BasicLayout(_ref) {
|
|
|
101
103
|
wrapCSSVar = _useStyle2[0],
|
|
102
104
|
hashId = _useStyle2[1],
|
|
103
105
|
cssVarCls = _useStyle2[2];
|
|
104
|
-
var
|
|
105
|
-
currentLocale =
|
|
106
|
+
var _useLocale = useLocale(),
|
|
107
|
+
currentLocale = _useLocale.locale;
|
|
106
108
|
var menuData = menuOptions.menuData,
|
|
107
109
|
_menuOptions$resizabl = menuOptions.resizableProps,
|
|
108
110
|
_menuOptions$resizabl2 = _menuOptions$resizabl === void 0 ? {} : _menuOptions$resizabl,
|
|
@@ -121,12 +123,7 @@ var BasicLayout = function BasicLayout(_ref) {
|
|
|
121
123
|
// footer -- todo:删除+文档描述
|
|
122
124
|
var contentRef = useRef(null);
|
|
123
125
|
var layoutRef = useRef(null);
|
|
124
|
-
var
|
|
125
|
-
en_US: siderWidth + 40,
|
|
126
|
-
zh_CN: siderWidth,
|
|
127
|
-
zh_TW: siderWidth
|
|
128
|
-
};
|
|
129
|
-
var defaultSiderWidth = SIDER_WIDTH_MAP[currentLocale];
|
|
126
|
+
var defaultSiderWidth = currentLocale === "en_US" ? siderWidth + 40 : siderWidth;
|
|
130
127
|
var _useState5 = useState(defaultSiderWidth),
|
|
131
128
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
132
129
|
_siderDragWidth = _useState6[0],
|
|
@@ -257,7 +254,7 @@ var BasicLayout = function BasicLayout(_ref) {
|
|
|
257
254
|
topNavigationClassName: topNavigationClassName,
|
|
258
255
|
topNavigationTrigger: topNavigationTrigger,
|
|
259
256
|
onClickTopNavigation: onClickTopNavigation,
|
|
260
|
-
allProductsTitle: allProductsTitle || "所有产品",
|
|
257
|
+
allProductsTitle: allProductsTitle || intl.get("ec46c0b7-b38a-4048-af67-6ae0ec477c52").d("所有产品"),
|
|
261
258
|
localeSwitcherOption: localeSwitcherOption,
|
|
262
259
|
messageOption: messageOption,
|
|
263
260
|
documentOption: documentOption,
|
|
@@ -27,6 +27,7 @@ import TabList from './TabList';
|
|
|
27
27
|
import { useHistory } from 'react-router-dom';
|
|
28
28
|
import { useTheme } from '../../antd-style';
|
|
29
29
|
import { useIntl } from '../../locales';
|
|
30
|
+
import useLocale from '../../ConfigProvider/useLocale';
|
|
30
31
|
var TabPane = _Tabs.TabPane;
|
|
31
32
|
var localOptionsMap = {
|
|
32
33
|
en: 'enName',
|
|
@@ -104,12 +105,11 @@ var MessageContent = function MessageContent(props) {
|
|
|
104
105
|
}, _callee);
|
|
105
106
|
}))();
|
|
106
107
|
}, []);
|
|
107
|
-
var
|
|
108
|
-
|
|
109
|
-
locale = _ref2$currentLocale === void 0 ? 'zh_CN' : _ref2$currentLocale;
|
|
108
|
+
var _useLocale = useLocale(),
|
|
109
|
+
locale = _useLocale.locale;
|
|
110
110
|
// 查询消息列表(接口)
|
|
111
111
|
var getMessageList = /*#__PURE__*/function () {
|
|
112
|
-
var
|
|
112
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(params) {
|
|
113
113
|
var resRequestApi, res, _res$data, _total, _res$data$records, records;
|
|
114
114
|
return _regenerator().w(function (_context2) {
|
|
115
115
|
while (1) switch (_context2.n) {
|
|
@@ -133,12 +133,12 @@ var MessageContent = function MessageContent(props) {
|
|
|
133
133
|
}, _callee2);
|
|
134
134
|
}));
|
|
135
135
|
return function getMessageList(_x) {
|
|
136
|
-
return
|
|
136
|
+
return _ref2.apply(this, arguments);
|
|
137
137
|
};
|
|
138
138
|
}();
|
|
139
139
|
// 查询所有类型的未读消息数(接口)
|
|
140
140
|
var getMessageUnreadCount = /*#__PURE__*/function () {
|
|
141
|
-
var
|
|
141
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
142
142
|
var resRequestApi, res, _res$data$byType, byType, _unreadTypeArr;
|
|
143
143
|
return _regenerator().w(function (_context3) {
|
|
144
144
|
while (1) switch (_context3.n) {
|
|
@@ -159,7 +159,7 @@ var MessageContent = function MessageContent(props) {
|
|
|
159
159
|
}, _callee3);
|
|
160
160
|
}));
|
|
161
161
|
return function getMessageUnreadCount() {
|
|
162
|
-
return
|
|
162
|
+
return _ref3.apply(this, arguments);
|
|
163
163
|
};
|
|
164
164
|
}();
|
|
165
165
|
|
|
@@ -31,6 +31,7 @@ import MoreHistoryList from './MoreHistoryList';
|
|
|
31
31
|
import useConfigContext from '../../useConfigContext';
|
|
32
32
|
import { judgeType, funcValueChangeArrayValue, getCorrectValue, getHistoryInfo } from '../utils/generate/dayjs';
|
|
33
33
|
import { useIntl } from '../../locales';
|
|
34
|
+
import useLocale from '../../ConfigProvider/useLocale';
|
|
34
35
|
import useStyle from './index.style';
|
|
35
36
|
var DropdownMenu = function DropdownMenu(props) {
|
|
36
37
|
var dataSource = props.dataSource,
|
|
@@ -56,9 +57,8 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
56
57
|
hashId = _useStyle2[1],
|
|
57
58
|
cssVarCls = _useStyle2[2];
|
|
58
59
|
var intl = useIntl();
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
locale = _ref$currentLocale === void 0 ? 'zh_CN' : _ref$currentLocale;
|
|
60
|
+
var _useLocale = useLocale(),
|
|
61
|
+
locale = _useLocale.locale;
|
|
62
62
|
var _timeSpanOption$timeS = timeSpanOption.timeSpanBoundary,
|
|
63
63
|
timeSpanBoundary = _timeSpanOption$timeS === void 0 ? 94608000 : _timeSpanOption$timeS;
|
|
64
64
|
var _menuOption$showCalen = menuOption.showCalendar,
|
|
@@ -39,6 +39,7 @@ import useConfigContext from '../useConfigContext';
|
|
|
39
39
|
import dayjs, { regroupDataSourceFn, echoInputValue, getUnit, judgeType, getChangeUnitDate, isInvalidDate, range, funcValueChangeArrayValue, getCorrectValue, getHistoryInfo, getFinalDateOption, getTruthDateCount, isAfterDate, isSameDate, isExceedMaxTimeSpan, getYears, computedRecentlyValue } from './utils/generate/dayjs';
|
|
40
40
|
import { isEqual } from 'lodash-es';
|
|
41
41
|
import { useIntl } from '../locales';
|
|
42
|
+
import useLocale from '../ConfigProvider/useLocale';
|
|
42
43
|
import useStyle from './index.style';
|
|
43
44
|
var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
44
45
|
var defaultValue = props.defaultValue,
|
|
@@ -68,9 +69,8 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
68
69
|
_props$rangePickerFor = props.rangePickerFormat,
|
|
69
70
|
rangePickerFormat = _props$rangePickerFor === void 0 ? 'YYYY/MM/DD' : _props$rangePickerFor;
|
|
70
71
|
var intl = useIntl();
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
locale = _ref$currentLocale === void 0 ? 'zh_CN' : _ref$currentLocale;
|
|
72
|
+
var _useLocale = useLocale(),
|
|
73
|
+
locale = _useLocale.locale;
|
|
74
74
|
var _refreshOption$onAuto = refreshOption.onAutoRefresh,
|
|
75
75
|
onAutoRefresh = _refreshOption$onAuto === void 0 ? function () {} : _refreshOption$onAuto,
|
|
76
76
|
_refreshOption$onAuto2 = refreshOption.onAutoRefreshChange,
|
|
@@ -637,10 +637,10 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
637
637
|
value: rangePickerValue // 默认为当前已经选择的时间
|
|
638
638
|
,
|
|
639
639
|
onCalendarChange: function onCalendarChange(date, dataString, info) {
|
|
640
|
-
var
|
|
641
|
-
|
|
642
|
-
date0 =
|
|
643
|
-
date1 =
|
|
640
|
+
var _ref = date || [],
|
|
641
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
642
|
+
date0 = _ref2[0],
|
|
643
|
+
date1 = _ref2[1];
|
|
644
644
|
var range = info.range;
|
|
645
645
|
if (range === 'start' && date0) {
|
|
646
646
|
date0 = dayjs(date0).set('hour', 0).set('minute', 0).set('second', 0).set('millisecond', 0);
|
|
@@ -16,6 +16,9 @@ import duration from 'dayjs/plugin/duration';
|
|
|
16
16
|
import utc from 'dayjs/plugin/utc';
|
|
17
17
|
import timezone from 'dayjs/plugin/timezone';
|
|
18
18
|
import { v4 as uuidv4 } from 'uuid';
|
|
19
|
+
import intl from '../../../locales';
|
|
20
|
+
import { formatRecentlyTimeTitle } from '../../../utils/i18n/recently';
|
|
21
|
+
import { getLocaleIntl } from '../../../utils/i18n/getLocaleIntl';
|
|
19
22
|
originalDayjs.extend(duration);
|
|
20
23
|
// 扩展 dayjs 支持时区
|
|
21
24
|
originalDayjs.extend(utc);
|
|
@@ -29,63 +32,21 @@ var dayjs = function dayjs() {
|
|
|
29
32
|
// 枚举时间单位
|
|
30
33
|
var ENUM_TimeUnit = {
|
|
31
34
|
s: {
|
|
32
|
-
zh_CN: '秒',
|
|
33
|
-
en_US: {
|
|
34
|
-
singular: 'Second',
|
|
35
|
-
plural: 'Seconds'
|
|
36
|
-
},
|
|
37
|
-
zh_TW: '秒',
|
|
38
|
-
ja_JP: '秒',
|
|
39
35
|
unit: 'seconds'
|
|
40
36
|
},
|
|
41
37
|
m: {
|
|
42
|
-
zh_CN: '分钟',
|
|
43
|
-
en_US: {
|
|
44
|
-
singular: 'Minute',
|
|
45
|
-
plural: 'Minutes'
|
|
46
|
-
},
|
|
47
|
-
zh_TW: '分鐘',
|
|
48
|
-
ja_JP: '分',
|
|
49
38
|
unit: 'minutes'
|
|
50
39
|
},
|
|
51
40
|
h: {
|
|
52
|
-
zh_CN: '小时',
|
|
53
|
-
en_US: {
|
|
54
|
-
singular: 'Hour',
|
|
55
|
-
plural: 'Hours'
|
|
56
|
-
},
|
|
57
|
-
zh_TW: '小時',
|
|
58
|
-
ja_JP: '時間',
|
|
59
41
|
unit: 'hours'
|
|
60
42
|
},
|
|
61
43
|
d: {
|
|
62
|
-
zh_CN: '天',
|
|
63
|
-
en_US: {
|
|
64
|
-
singular: 'Day',
|
|
65
|
-
plural: 'Days'
|
|
66
|
-
},
|
|
67
|
-
zh_TW: '天',
|
|
68
|
-
ja_JP: '日',
|
|
69
44
|
unit: 'days'
|
|
70
45
|
},
|
|
71
46
|
mo: {
|
|
72
|
-
zh_CN: '月',
|
|
73
|
-
en_US: {
|
|
74
|
-
singular: 'Month',
|
|
75
|
-
plural: 'Months'
|
|
76
|
-
},
|
|
77
|
-
zh_TW: '月',
|
|
78
|
-
ja_JP: 'ヶ月',
|
|
79
47
|
unit: 'mo'
|
|
80
48
|
},
|
|
81
49
|
y: {
|
|
82
|
-
zh_CN: '年',
|
|
83
|
-
en_US: {
|
|
84
|
-
singular: 'Year',
|
|
85
|
-
plural: 'Years'
|
|
86
|
-
},
|
|
87
|
-
zh_TW: '年',
|
|
88
|
-
ja_JP: '年',
|
|
89
50
|
unit: 'years'
|
|
90
51
|
}
|
|
91
52
|
};
|
|
@@ -172,69 +133,10 @@ export var judgeType = function judgeType(recordDateValue) {
|
|
|
172
133
|
}
|
|
173
134
|
return [isRule, captureUnit, recordUnit];
|
|
174
135
|
};
|
|
175
|
-
export var echoRecentlyTimeTitle = function echoRecentlyTimeTitle(locale, captureUnit) {
|
|
176
|
-
// 参数验证
|
|
177
|
-
if (!captureUnit || !Array.isArray(captureUnit) || captureUnit.length < 2) {
|
|
178
|
-
return '';
|
|
179
|
-
}
|
|
180
|
-
var _captureUnit3 = _slicedToArray(captureUnit, 2),
|
|
181
|
-
count = _captureUnit3[0],
|
|
182
|
-
unit = _captureUnit3[1];
|
|
183
|
-
var timeUnit = ENUM_TimeUnit[unit];
|
|
184
|
-
if (!timeUnit) {
|
|
185
|
-
return '';
|
|
186
|
-
}
|
|
187
|
-
var countNum = parseInt(count, 10);
|
|
188
|
-
|
|
189
|
-
// 语言配置映射
|
|
190
|
-
var localeConfig = {
|
|
191
|
-
zh_CN: {
|
|
192
|
-
template: function template(count, unitText) {
|
|
193
|
-
return "\u6700\u8FD1".concat(count).concat(unit === 'mo' ? '个' : '').concat(unitText);
|
|
194
|
-
},
|
|
195
|
-
getUnitText: function getUnitText() {
|
|
196
|
-
return timeUnit.zh_CN;
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
zh: {
|
|
200
|
-
template: function template(count, unitText) {
|
|
201
|
-
return "\u6700\u8FD1".concat(count).concat(unit === 'mo' ? '个' : '').concat(unitText);
|
|
202
|
-
},
|
|
203
|
-
getUnitText: function getUnitText() {
|
|
204
|
-
return timeUnit.zh_CN;
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
zh_TW: {
|
|
208
|
-
template: function template(count, unitText) {
|
|
209
|
-
return "\u6700\u8FD1".concat(count).concat(unit === 'mo' ? '個' : '').concat(unitText);
|
|
210
|
-
},
|
|
211
|
-
getUnitText: function getUnitText() {
|
|
212
|
-
return timeUnit.zh_TW;
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
ja_JP: {
|
|
216
|
-
template: function template(count, unitText) {
|
|
217
|
-
return "\u904E\u53BB".concat(count).concat(unitText);
|
|
218
|
-
},
|
|
219
|
-
getUnitText: function getUnitText() {
|
|
220
|
-
return timeUnit.ja_JP;
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
|
-
"default": {
|
|
224
|
-
template: function template(count, unitText) {
|
|
225
|
-
return "Past ".concat(count, " ").concat(unitText);
|
|
226
|
-
},
|
|
227
|
-
getUnitText: function getUnitText() {
|
|
228
|
-
var isPlural = countNum !== 1;
|
|
229
|
-
return isPlural ? timeUnit.en_US.plural : timeUnit.en_US.singular;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
136
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
return config.template(count, unitText);
|
|
137
|
+
// 复用完整词条消息,同时保留旧工具显式 locale 参数,不回写主语言。
|
|
138
|
+
export var echoRecentlyTimeTitle = function echoRecentlyTimeTitle(locale, captureUnit) {
|
|
139
|
+
return formatRecentlyTimeTitle(getLocaleIntl(locale, intl), captureUnit);
|
|
238
140
|
};
|
|
239
141
|
export var echoAbsoluteTimeTitle = function echoAbsoluteTimeTitle(value, format) {
|
|
240
142
|
var hasTimeSpan = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -12,66 +12,27 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
12
12
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
13
13
|
import moment from 'moment';
|
|
14
14
|
import { v4 as uuidv4 } from 'uuid';
|
|
15
|
+
import intl from '../../../locales';
|
|
16
|
+
import { formatRecentlyTimeTitle } from '../../../utils/i18n/recently';
|
|
17
|
+
import { getLocaleIntl } from '../../../utils/i18n/getLocaleIntl';
|
|
15
18
|
// 枚举时间单位
|
|
16
19
|
var ENUM_TimeUnit = {
|
|
17
20
|
s: {
|
|
18
|
-
zh_CN: '秒',
|
|
19
|
-
en_US: {
|
|
20
|
-
singular: 'Second',
|
|
21
|
-
plural: 'Seconds'
|
|
22
|
-
},
|
|
23
|
-
zh_TW: '秒',
|
|
24
|
-
ja_JP: '秒',
|
|
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
|
-
ja_JP: '分',
|
|
35
24
|
unit: 'minutes'
|
|
36
25
|
},
|
|
37
26
|
h: {
|
|
38
|
-
zh_CN: '小时',
|
|
39
|
-
en_US: {
|
|
40
|
-
singular: 'Hour',
|
|
41
|
-
plural: 'Hours'
|
|
42
|
-
},
|
|
43
|
-
zh_TW: '小時',
|
|
44
|
-
ja_JP: '時間',
|
|
45
27
|
unit: 'hours'
|
|
46
28
|
},
|
|
47
29
|
d: {
|
|
48
|
-
zh_CN: '天',
|
|
49
|
-
en_US: {
|
|
50
|
-
singular: 'Day',
|
|
51
|
-
plural: 'Days'
|
|
52
|
-
},
|
|
53
|
-
zh_TW: '天',
|
|
54
|
-
ja_JP: '日',
|
|
55
30
|
unit: 'days'
|
|
56
31
|
},
|
|
57
32
|
mo: {
|
|
58
|
-
zh_CN: '月',
|
|
59
|
-
en_US: {
|
|
60
|
-
singular: 'Month',
|
|
61
|
-
plural: 'Months'
|
|
62
|
-
},
|
|
63
|
-
zh_TW: '月',
|
|
64
|
-
ja_JP: 'ヶ月',
|
|
65
33
|
unit: 'mo'
|
|
66
34
|
},
|
|
67
35
|
y: {
|
|
68
|
-
zh_CN: '年',
|
|
69
|
-
en_US: {
|
|
70
|
-
singular: 'Year',
|
|
71
|
-
plural: 'Years'
|
|
72
|
-
},
|
|
73
|
-
zh_TW: '年',
|
|
74
|
-
ja_JP: '年',
|
|
75
36
|
unit: 'years'
|
|
76
37
|
}
|
|
77
38
|
};
|
|
@@ -157,69 +118,10 @@ export var judgeType = function judgeType(recordDateValue) {
|
|
|
157
118
|
}
|
|
158
119
|
return [isRule, captureUnit, recordUnit];
|
|
159
120
|
};
|
|
160
|
-
export var echoRecentlyTimeTitle = function echoRecentlyTimeTitle(locale, captureUnit) {
|
|
161
|
-
// 参数验证
|
|
162
|
-
if (!captureUnit || !Array.isArray(captureUnit) || captureUnit.length < 2) {
|
|
163
|
-
return '';
|
|
164
|
-
}
|
|
165
|
-
var _captureUnit3 = _slicedToArray(captureUnit, 2),
|
|
166
|
-
count = _captureUnit3[0],
|
|
167
|
-
unit = _captureUnit3[1];
|
|
168
|
-
var timeUnit = ENUM_TimeUnit[unit];
|
|
169
|
-
if (!timeUnit) {
|
|
170
|
-
return '';
|
|
171
|
-
}
|
|
172
|
-
var countNum = parseInt(count, 10);
|
|
173
|
-
|
|
174
|
-
// 语言配置映射
|
|
175
|
-
var localeConfig = {
|
|
176
|
-
zh_CN: {
|
|
177
|
-
template: function template(count, unitText) {
|
|
178
|
-
return "\u6700\u8FD1".concat(count).concat(unit === 'mo' ? '个' : '').concat(unitText);
|
|
179
|
-
},
|
|
180
|
-
getUnitText: function getUnitText() {
|
|
181
|
-
return timeUnit.zh_CN;
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
zh: {
|
|
185
|
-
template: function template(count, unitText) {
|
|
186
|
-
return "\u6700\u8FD1".concat(count).concat(unit === 'mo' ? '个' : '').concat(unitText);
|
|
187
|
-
},
|
|
188
|
-
getUnitText: function getUnitText() {
|
|
189
|
-
return timeUnit.zh_CN;
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
zh_TW: {
|
|
193
|
-
template: function template(count, unitText) {
|
|
194
|
-
return "\u6700\u8FD1".concat(count).concat(unit === 'mo' ? '個' : '').concat(unitText);
|
|
195
|
-
},
|
|
196
|
-
getUnitText: function getUnitText() {
|
|
197
|
-
return timeUnit.zh_TW;
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
ja_JP: {
|
|
201
|
-
template: function template(count, unitText) {
|
|
202
|
-
return "\u904E\u53BB".concat(count).concat(unitText);
|
|
203
|
-
},
|
|
204
|
-
getUnitText: function getUnitText() {
|
|
205
|
-
return timeUnit.ja_JP;
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
"default": {
|
|
209
|
-
template: function template(count, unitText) {
|
|
210
|
-
return "Past ".concat(count, " ").concat(unitText);
|
|
211
|
-
},
|
|
212
|
-
getUnitText: function getUnitText() {
|
|
213
|
-
var isPlural = countNum !== 1;
|
|
214
|
-
return isPlural ? timeUnit.en_US.plural : timeUnit.en_US.singular;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
121
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
return config.template(count, unitText);
|
|
122
|
+
// 复用完整词条消息,同时保留旧工具显式 locale 参数,不回写主语言。
|
|
123
|
+
export var echoRecentlyTimeTitle = function echoRecentlyTimeTitle(locale, captureUnit) {
|
|
124
|
+
return formatRecentlyTimeTitle(getLocaleIntl(locale, intl), captureUnit);
|
|
223
125
|
};
|
|
224
126
|
export var echoAbsoluteTimeTitle = function echoAbsoluteTimeTitle(value, format) {
|
|
225
127
|
var hasTimeSpan = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
package/lib/CardSelect/index.js
CHANGED
|
@@ -19,25 +19,27 @@ import PropTypes from "prop-types";
|
|
|
19
19
|
import useStyle from "./index.style";
|
|
20
20
|
import classnames from "classnames";
|
|
21
21
|
import useConfigContext from "../useConfigContext";
|
|
22
|
+
import { useIntl } from "../locales";
|
|
22
23
|
/**
|
|
23
24
|
*
|
|
24
25
|
* 带图标的下拉菜单,支持自定义菜单内容和菜单提示文字,支持受控和非受控
|
|
25
26
|
*/
|
|
26
27
|
|
|
27
|
-
var CWCardSelect = function CWCardSelect(
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
defaultTitle =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
labelInValue =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
onClick =
|
|
40
|
-
|
|
28
|
+
var CWCardSelect = function CWCardSelect(props) {
|
|
29
|
+
var intl = useIntl();
|
|
30
|
+
var _props$menuTitle = props.menuTitle,
|
|
31
|
+
menuTitle = _props$menuTitle === void 0 ? intl.get("6566e451-97df-4da4-887a-e218bb5984f0").d("请选择图表类型") : _props$menuTitle,
|
|
32
|
+
_props$defaultTitle = props.defaultTitle,
|
|
33
|
+
defaultTitle = _props$defaultTitle === void 0 ? intl.get("857ecc4e-d0c2-44b1-a588-c898380e6a4e").d("展现方式") : _props$defaultTitle,
|
|
34
|
+
defaultValue = props.defaultValue,
|
|
35
|
+
_props$labelInValue = props.labelInValue,
|
|
36
|
+
labelInValue = _props$labelInValue === void 0 ? false : _props$labelInValue,
|
|
37
|
+
value = props.value,
|
|
38
|
+
menuData = props.menuData,
|
|
39
|
+
children = props.children,
|
|
40
|
+
_props$onClick = props.onClick,
|
|
41
|
+
onClick = _props$onClick === void 0 ? function () {} : _props$onClick,
|
|
42
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
41
43
|
var _useConfigContext = useConfigContext(),
|
|
42
44
|
getPrefixCls = _useConfigContext.getPrefixCls;
|
|
43
45
|
var prefixCls = getPrefixCls("card-select-dropdown-menu");
|
|
@@ -55,7 +57,10 @@ var CWCardSelect = function CWCardSelect(_ref) {
|
|
|
55
57
|
}
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
|
-
|
|
60
|
+
// 只保存选中项标题;未选择时直接使用本轮渲染的默认文案。
|
|
61
|
+
var _useState = useState(defaultValue ? {
|
|
62
|
+
name: defaultName
|
|
63
|
+
} : null),
|
|
59
64
|
_useState2 = _slicedToArray(_useState, 2),
|
|
60
65
|
dropdownTitle = _useState2[0],
|
|
61
66
|
changeDropdownTitle = _useState2[1];
|
|
@@ -64,7 +69,9 @@ var CWCardSelect = function CWCardSelect(_ref) {
|
|
|
64
69
|
selectValue = _useState4[0],
|
|
65
70
|
changeValue = _useState4[1];
|
|
66
71
|
var onClickItem = function onClickItem(value, name, item) {
|
|
67
|
-
changeDropdownTitle(
|
|
72
|
+
changeDropdownTitle({
|
|
73
|
+
name: name
|
|
74
|
+
});
|
|
68
75
|
changeValue(value);
|
|
69
76
|
onClick(value, name, item);
|
|
70
77
|
};
|
|
@@ -101,7 +108,7 @@ var CWCardSelect = function CWCardSelect(_ref) {
|
|
|
101
108
|
return wrapCSSVar(/*#__PURE__*/React.createElement(_Dropdown, _extends({
|
|
102
109
|
overlay: menu,
|
|
103
110
|
placement: "bottomRight"
|
|
104
|
-
}, rest), children ? children : /*#__PURE__*/React.createElement(_Button, null, title ? title : dropdownTitle, " ")));
|
|
111
|
+
}, rest), children ? children : /*#__PURE__*/React.createElement(_Button, null, title ? title : dropdownTitle ? dropdownTitle.name : defaultTitle, " ")));
|
|
105
112
|
};
|
|
106
113
|
CWCardSelect.propTypes = {
|
|
107
114
|
/**
|
package/lib/CitySelect/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import _Cascader from "@chaoswise/ui/lib/Cascader";
|
|
|
2
2
|
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); }
|
|
3
3
|
import React from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
|
+
import { useIntl } from "../locales";
|
|
5
6
|
// 城市数据
|
|
6
7
|
import cities from "./citys";
|
|
7
8
|
|
|
@@ -10,9 +11,10 @@ import cities from "./citys";
|
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
13
|
function CitySelect(props) {
|
|
14
|
+
var intl = useIntl();
|
|
13
15
|
return /*#__PURE__*/React.createElement(_Cascader, _extends({
|
|
14
16
|
options: cities,
|
|
15
|
-
placeholder: "
|
|
17
|
+
placeholder: intl.get("2eae9bf2-695b-4914-a3e5-27f3af64dbfd").d("请选择机构城市")
|
|
16
18
|
}, props));
|
|
17
19
|
}
|
|
18
20
|
CitySelect.propTypes = {
|