@chaoswise/ui 2.3.18 → 2.4.1
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/index.js +8 -3
- package/lib/BasicLayout/locale/index.js +9 -4
- package/lib/BasicLayout/locale/zh_TW.js +4 -0
- package/lib/CWMessage/MessageContent/TabList/index.js +6 -15
- package/lib/CWMessage/MessageContent/index.js +20 -9
- package/lib/CWMessage/locale/en_US.js +4 -1
- package/lib/CWMessage/locale/index.js +10 -11
- package/lib/CWMessage/locale/zh_CN.js +4 -1
- package/lib/CWMessage/locale/zh_TW.js +6 -0
- package/lib/CWRangePicker/DropdownMenu/MoreHistoryList/index.js +7 -8
- package/lib/CWRangePicker/DropdownMenu/MoreTimeList/index.js +6 -15
- package/lib/CWRangePicker/DropdownMenu/index.js +10 -9
- package/lib/CWRangePicker/Refresh/index.js +7 -8
- package/lib/CWRangePicker/TimeSpan/index.js +10 -17
- package/lib/CWRangePicker/index.js +26 -16
- package/lib/CWRangePicker/locale/en_US.js +2 -9
- package/lib/CWRangePicker/locale/index.js +10 -11
- package/lib/CWRangePicker/locale/zh_CN.js +2 -9
- package/lib/CWRangePicker/locale/zh_TW.js +29 -0
- package/lib/CWRangePicker/utils/index.js +7 -4
- package/lib/CWSelect/index.js +7 -9
- package/lib/CWSelect/locale/index.js +10 -11
- package/lib/CWSelect/locale/zh_TW.js +4 -0
- package/lib/CWTable/EditLine.js +8 -9
- package/lib/CWTable/Filter.js +6 -7
- package/lib/CWTable/locale/index.js +10 -11
- package/lib/CWTable/locale/zh_TW.js +6 -0
- package/lib/CWTree/index.js +6 -7
- package/lib/CWTree/locale/index.js +10 -11
- package/lib/CWTree/locale/zh_TW.js +3 -0
- package/lib/CWUpload/locale/en_US.js +0 -8
- package/lib/CWUpload/locale/index.js +10 -11
- package/lib/CWUpload/locale/zh_TW.js +6 -0
- package/lib/CWUpload/upload/Dragger.js +6 -7
- package/lib/CWUpload/upload/UploadList.js +11 -12
- package/lib/ColorPicker/index.js +7 -10
- package/lib/ColorPicker/locale/index.js +10 -11
- package/lib/ColorPicker/locale/zh_TW.js +4 -0
- package/lib/ConfigProvider/ConfigProvider.js +50 -23
- package/lib/ConfigProvider/Switch.js +29 -11
- package/lib/DateRangePicker/components/ExtraQuickFooter.js +24 -20
- package/lib/DateRangePicker/locale/index.js +10 -11
- package/lib/DateRangePicker/locale/zh_TW.js +5 -0
- package/lib/DropdownDatePicker/DropdownMenu/MoreTimeList/index.js +6 -7
- package/lib/DropdownDatePicker/DropdownMenu/index.js +7 -8
- package/lib/DropdownDatePicker/index.js +8 -7
- package/lib/DropdownDatePicker/locale/index.js +10 -11
- package/lib/DropdownDatePicker/locale/zh_TW.js +21 -0
- package/lib/DropdownDatePicker/utils/index.js +4 -2
- package/lib/Empty/index.js +6 -7
- package/lib/Empty/locale/index.js +10 -11
- package/lib/Empty/locale/zh_TW.js +3 -0
- package/lib/Exception/index.js +12 -13
- package/lib/Exception/locale/en_US.js +3 -1
- package/lib/Exception/locale/index.js +10 -11
- package/lib/Exception/locale/zh_CN.js +3 -1
- package/lib/Exception/locale/zh_TW.js +9 -0
- package/lib/FilterDropDown/index.js +6 -7
- package/lib/FilterDropDown/locale/index.js +10 -11
- package/lib/FilterDropDown/locale/zh_TW.js +3 -0
- package/lib/Header/UserSetting/index.js +14 -2
- package/lib/IconSelect/components/CustomImg/index.js +11 -12
- package/lib/IconSelect/components/SearchIcon/index.js +10 -8
- package/lib/IconSelect/index.js +7 -8
- package/lib/IconSelect/locale/index.js +10 -11
- package/lib/IconSelect/locale/zh_TW.js +11 -0
- package/lib/Joyride/List.js +8 -9
- package/lib/Joyride/index.js +21 -22
- package/lib/Joyride/locale/index.js +10 -11
- package/lib/Joyride/locale/zh_TW.js +25 -0
- package/lib/Pagination/index.js +21 -18
- package/lib/Pagination/locale/en_US.js +4 -10
- package/lib/Pagination/locale/index.js +10 -11
- package/lib/Pagination/locale/zh_CN.js +6 -13
- package/lib/Pagination/locale/zh_TW.js +8 -0
- package/lib/Progress/index.js +6 -15
- package/lib/Progress/locale/en_US.js +1 -1
- package/lib/Progress/locale/index.js +10 -11
- package/lib/Progress/locale/zh_CN.js +1 -1
- package/lib/Progress/locale/zh_TW.js +3 -0
- package/lib/QuickTransfer/DragList.js +6 -7
- package/lib/QuickTransfer/index.js +9 -10
- package/lib/QuickTransfer/locale/index.js +10 -11
- package/lib/QuickTransfer/locale/zh_TW.js +8 -0
- package/lib/RangePicker/components/ExtraTimeFooter.js +6 -13
- package/lib/RangePicker/locale/index.js +10 -11
- package/lib/RangePicker/locale/zh_TW.js +5 -0
- package/lib/SearchBar/index.js +9 -10
- package/lib/SearchBar/locale/index.js +10 -11
- package/lib/SearchBar/locale/zh_CN.js +0 -8
- package/lib/SearchBar/locale/zh_TW.js +6 -0
- package/lib/TreeSelect111/index.js +6 -15
- package/lib/TreeSelect111/locale/index.js +10 -11
- package/lib/TreeSelect111/locale/zh_TW.js +3 -0
- package/lib/WangEditor/index.js +13 -7
- package/lib/WangEditor/locale/index.js +60 -29
- package/lib/utils/index.js +11 -0
- package/package.json +2 -2
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
1
|
+
import zh_CN from './zh_CN.js';
|
|
2
|
+
import en_US from './en_US.js';
|
|
3
|
+
import zh_TW from './zh_TW.js';
|
|
4
|
+
export default {
|
|
5
|
+
zh_CN: zh_CN,
|
|
6
|
+
en_US: en_US,
|
|
7
|
+
zh_TW: zh_TW,
|
|
8
|
+
// 兼容
|
|
9
|
+
zh: zh_CN,
|
|
10
|
+
en: en_US
|
|
12
11
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
2
|
import "antd/es/config-provider/style";
|
|
3
3
|
import _ConfigProvider from "antd/es/config-provider";
|
|
4
|
-
var _excluded = ["children", "locales", "defaultLocale"];
|
|
4
|
+
var _excluded = ["children", "locales", "defaultLocale", "messages"];
|
|
5
5
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
6
6
|
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; }
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -19,10 +19,29 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
19
19
|
import React, { useEffect, useState } from 'react';
|
|
20
20
|
import Antd4ConfigProvider from '../Antd4/config-provider';
|
|
21
21
|
import { IntlProvider } from 'react-intl';
|
|
22
|
-
import zh_antd from '../Antd4/locale/zh_CN';
|
|
23
|
-
import en_antd from '../Antd4/locale/en_US';
|
|
24
22
|
import moment from 'moment';
|
|
25
23
|
import 'moment/locale/zh-cn';
|
|
24
|
+
import zh_CN_antd4 from '../Antd4/locale/zh_CN';
|
|
25
|
+
import en_US_antd4 from '../Antd4/locale/en_US';
|
|
26
|
+
import zh_TW_antd4 from '../Antd4/locale/zh_TW';
|
|
27
|
+
import zh_CN_antd from 'antd/es/locale/zh_CN';
|
|
28
|
+
import zh_TW_antd from 'antd/es/locale/zh_TW';
|
|
29
|
+
import en_US_antd from 'antd/es/locale/en_US';
|
|
30
|
+
var ANTD4_LOCALE_MAP = {
|
|
31
|
+
zh_CN: zh_CN_antd4,
|
|
32
|
+
en_US: en_US_antd4,
|
|
33
|
+
zh_TW: zh_TW_antd4
|
|
34
|
+
};
|
|
35
|
+
var ANTD3_LOCALE_MAP = {
|
|
36
|
+
zh_CN: zh_CN_antd,
|
|
37
|
+
en_US: en_US_antd,
|
|
38
|
+
zh_TW: zh_TW_antd
|
|
39
|
+
};
|
|
40
|
+
var I18N_MAP = {
|
|
41
|
+
zh_CN: 'zh',
|
|
42
|
+
en_US: 'en',
|
|
43
|
+
zh_TW: 'zh'
|
|
44
|
+
};
|
|
26
45
|
export var intlContext = /*#__PURE__*/React.createContext({
|
|
27
46
|
localeContext: {
|
|
28
47
|
locale: '',
|
|
@@ -30,36 +49,44 @@ export var intlContext = /*#__PURE__*/React.createContext({
|
|
|
30
49
|
}
|
|
31
50
|
});
|
|
32
51
|
var Provider = intlContext.Provider;
|
|
52
|
+
|
|
53
|
+
// 兼容映射
|
|
54
|
+
var LOCALE_MAP = {
|
|
55
|
+
zh: 'zh_CN',
|
|
56
|
+
en: 'en_US'
|
|
57
|
+
};
|
|
33
58
|
var AllProvider = function AllProvider(_ref) {
|
|
59
|
+
var _locales$locale;
|
|
34
60
|
var children = _ref.children,
|
|
35
61
|
_ref$locales = _ref.locales,
|
|
36
62
|
locales = _ref$locales === void 0 ? {} : _ref$locales,
|
|
37
63
|
_ref$defaultLocale = _ref.defaultLocale,
|
|
38
|
-
defaultLocale = _ref$defaultLocale === void 0 ? '
|
|
64
|
+
defaultLocale = _ref$defaultLocale === void 0 ? 'zh_CN' : _ref$defaultLocale,
|
|
65
|
+
messages = _ref.messages,
|
|
39
66
|
resProps = _objectWithoutProperties(_ref, _excluded);
|
|
40
67
|
var _useState = useState(defaultLocale),
|
|
41
68
|
_useState2 = _slicedToArray(_useState, 2),
|
|
42
69
|
locale = _useState2[0],
|
|
43
70
|
setLocale = _useState2[1];
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
71
|
+
var currentLocale = LOCALE_MAP[locale] || locale;
|
|
72
|
+
var getMomentLocale = function getMomentLocale(currentLocale) {
|
|
73
|
+
if (['zh_CN', 'zh_TW'].includes(currentLocale)) {
|
|
74
|
+
return 'zh-cn';
|
|
47
75
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
76
|
+
return 'en';
|
|
77
|
+
};
|
|
78
|
+
useEffect(function () {
|
|
79
|
+
moment.locale(getMomentLocale(currentLocale));
|
|
80
|
+
|
|
81
|
+
// 文案按UX规范,原始为 No Data
|
|
82
|
+
if (currentLocale === 'en_US') {
|
|
83
|
+
ANTD3_LOCALE_MAP[currentLocale].Empty.description = 'No data';
|
|
53
84
|
}
|
|
54
|
-
}
|
|
85
|
+
}, [currentLocale]);
|
|
55
86
|
var configProps = _objectSpread({
|
|
56
|
-
locale:
|
|
87
|
+
locale: ANTD3_LOCALE_MAP[currentLocale],
|
|
57
88
|
autoInsertSpaceInButton: false
|
|
58
89
|
}, resProps);
|
|
59
|
-
var Antd4Local = {
|
|
60
|
-
'zh': zh_antd,
|
|
61
|
-
'en': en_antd
|
|
62
|
-
};
|
|
63
90
|
return /*#__PURE__*/React.createElement(Provider, {
|
|
64
91
|
value: {
|
|
65
92
|
locale: locale,
|
|
@@ -67,10 +94,10 @@ var AllProvider = function AllProvider(_ref) {
|
|
|
67
94
|
locales: locales
|
|
68
95
|
}
|
|
69
96
|
}, /*#__PURE__*/React.createElement(_ConfigProvider, configProps, /*#__PURE__*/React.createElement(Antd4ConfigProvider, _extends({}, configProps, {
|
|
70
|
-
locale:
|
|
71
|
-
}),
|
|
72
|
-
locale:
|
|
73
|
-
messages:
|
|
74
|
-
}, children)
|
|
97
|
+
locale: ANTD4_LOCALE_MAP[currentLocale]
|
|
98
|
+
}), /*#__PURE__*/React.createElement(IntlProvider, {
|
|
99
|
+
locale: I18N_MAP[currentLocale],
|
|
100
|
+
messages: messages ? messages : (_locales$locale = locales[locale]) === null || _locales$locale === void 0 ? void 0 : _locales$locale.messages
|
|
101
|
+
}, children))));
|
|
75
102
|
};
|
|
76
103
|
export default AllProvider;
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import _Button from "antd/es/button";
|
|
1
|
+
import _Select from "@chaoswise/ui/lib/Antd/Select";
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import useLocale from './useLocale';
|
|
4
|
+
var LANG_LIST = [{
|
|
5
|
+
label: '简体中文',
|
|
6
|
+
value: 'zh_CN'
|
|
7
|
+
}, {
|
|
8
|
+
label: '繁体中文',
|
|
9
|
+
value: 'zh_TW'
|
|
10
|
+
}, {
|
|
11
|
+
label: 'English',
|
|
12
|
+
value: 'en_US'
|
|
13
|
+
}];
|
|
5
14
|
var Switch = function Switch(_ref) {
|
|
6
15
|
var render = _ref.render;
|
|
7
16
|
var _useLocale = useLocale(),
|
|
8
17
|
locale = _useLocale.locale,
|
|
9
18
|
setLocale = _useLocale.setLocale,
|
|
10
19
|
locales = _useLocale.locales;
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
setLocale('zh');
|
|
14
|
-
} else {
|
|
15
|
-
setLocale('en');
|
|
16
|
-
}
|
|
20
|
+
var onLangChange = function onLangChange(locale) {
|
|
21
|
+
setLocale(locale);
|
|
17
22
|
};
|
|
18
23
|
if (render) {
|
|
19
24
|
return render({
|
|
@@ -22,8 +27,21 @@ var Switch = function Switch(_ref) {
|
|
|
22
27
|
locales: locales
|
|
23
28
|
});
|
|
24
29
|
}
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
return (
|
|
31
|
+
/*#__PURE__*/
|
|
32
|
+
// <Button onClick={toggleLocal}>语言切换</Button>
|
|
33
|
+
React.createElement(_Select, {
|
|
34
|
+
defaultValue: "zh_CN",
|
|
35
|
+
style: {
|
|
36
|
+
width: 100
|
|
37
|
+
},
|
|
38
|
+
onChange: onLangChange
|
|
39
|
+
}, LANG_LIST.map(function (item) {
|
|
40
|
+
return /*#__PURE__*/React.createElement(_Select.Option, {
|
|
41
|
+
key: item.value,
|
|
42
|
+
value: item.value
|
|
43
|
+
}, item.label);
|
|
44
|
+
}))
|
|
45
|
+
);
|
|
28
46
|
};
|
|
29
47
|
export default Switch;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import _Button from "
|
|
3
|
-
import "
|
|
4
|
-
import _Tooltip from "
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import "@chaoswise/ui/lib/Button/index.less";
|
|
2
|
+
import _Button from "@chaoswise/ui/lib/Button";
|
|
3
|
+
import "@chaoswise/ui/lib/Tooltip/index.less";
|
|
4
|
+
import _Tooltip from "@chaoswise/ui/lib/Tooltip";
|
|
5
|
+
import _useLocale2 from "@chaoswise/ui/lib/useLocale";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import classnames from "classnames";
|
|
8
|
+
import langConfig from '../locale';
|
|
9
|
+
import { formatMessage } from "../../utils";
|
|
8
10
|
export default function ExtraFooter(_ref) {
|
|
9
11
|
var firstFewArr = _ref.firstFewArr,
|
|
10
12
|
moreArr = _ref.moreArr,
|
|
@@ -25,14 +27,16 @@ export default function ExtraFooter(_ref) {
|
|
|
25
27
|
quickOverlayStyle = _ref.quickOverlayStyle,
|
|
26
28
|
quickMoreItemClassName = _ref.quickMoreItemClassName,
|
|
27
29
|
quickMoreItemStyle = _ref.quickMoreItemStyle;
|
|
30
|
+
var _useLocale = _useLocale2(langConfig),
|
|
31
|
+
localeObj = _useLocale.langObj;
|
|
28
32
|
//渲染快速选择每一项
|
|
29
33
|
var renderItem = function renderItem(data) {
|
|
30
34
|
return /*#__PURE__*/React.createElement(React.Fragment, null, data.map(function (item) {
|
|
31
35
|
return /*#__PURE__*/React.createElement("span", {
|
|
32
|
-
className:
|
|
36
|
+
className: "cw-presetRange-item-wrapper"
|
|
33
37
|
}, /*#__PURE__*/React.createElement("span", {
|
|
34
38
|
key: item.value,
|
|
35
|
-
className: classnames(
|
|
39
|
+
className: classnames("cw-presetRange-item", quickItemClassName),
|
|
36
40
|
style: quickItemStyle,
|
|
37
41
|
onClick: function onClick(e) {
|
|
38
42
|
return quickClick(e, item);
|
|
@@ -43,39 +47,39 @@ export default function ExtraFooter(_ref) {
|
|
|
43
47
|
return /*#__PURE__*/React.createElement("div", {
|
|
44
48
|
className: "cw-rangePicker-extraQuickContainer",
|
|
45
49
|
style: !quickSelect && !showOperation ? {
|
|
46
|
-
display:
|
|
50
|
+
display: "none"
|
|
47
51
|
} : {}
|
|
48
52
|
}, quickSelect ? /*#__PURE__*/React.createElement("div", {
|
|
49
53
|
className: classnames("cw-rangePicker-quickSelect", quickSelectClassName),
|
|
50
54
|
style: quickSelectStyle
|
|
51
55
|
}, /*#__PURE__*/React.createElement("div", {
|
|
52
|
-
className:
|
|
56
|
+
className: "cw-presetRange-wrapper"
|
|
53
57
|
}, renderItem(firstFewArr), moreArr.length === 0 ? null : /*#__PURE__*/React.createElement(_Tooltip, {
|
|
54
58
|
placement: "topRight",
|
|
55
59
|
title: renderItem(moreArr),
|
|
56
60
|
overlayClassName: classnames({
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
"cw-presetRange-toolTip": moreArr.length > 1,
|
|
62
|
+
"cw-presetRange-toolTip-onlyOne": moreArr.length === 1
|
|
59
63
|
}, quickOverlayClassName),
|
|
60
64
|
overlayStyle: quickOverlayStyle,
|
|
61
|
-
trigger: [
|
|
65
|
+
trigger: ["hover"],
|
|
62
66
|
getPopupContainer: function getPopupContainer(e) {
|
|
63
67
|
return e.parentElement;
|
|
64
68
|
}
|
|
65
69
|
}, /*#__PURE__*/React.createElement("span", {
|
|
66
|
-
className: classnames(
|
|
70
|
+
className: classnames("cw-presetRange-more", quickMoreItemClassName),
|
|
67
71
|
style: quickMoreItemStyle
|
|
68
|
-
},
|
|
72
|
+
}, formatMessage(localeObj["more"]))))) : null, showOperation ? /*#__PURE__*/React.createElement("div", {
|
|
69
73
|
className: "cw-rangePicker-operation"
|
|
70
74
|
}, /*#__PURE__*/React.createElement(_Button, {
|
|
71
75
|
className: "cw-operation-cancel",
|
|
72
76
|
onClick: onCancel,
|
|
73
|
-
size:
|
|
74
|
-
},
|
|
77
|
+
size: "small"
|
|
78
|
+
}, formatMessage(localeObj["cancel"])), /*#__PURE__*/React.createElement(_Button, {
|
|
75
79
|
type: "primary",
|
|
76
80
|
className: "cw-operation-confirm",
|
|
77
|
-
size:
|
|
81
|
+
size: "small",
|
|
78
82
|
disabled: disabledConfirm,
|
|
79
83
|
onClick: disabledConfirm ? function () {} : onOk
|
|
80
|
-
},
|
|
84
|
+
}, formatMessage(localeObj["confirm"]))) : null);
|
|
81
85
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
1
|
+
import zh_CN from './zh_CN.js';
|
|
2
|
+
import en_US from './en_US.js';
|
|
3
|
+
import zh_TW from './zh_TW.js';
|
|
4
|
+
export default {
|
|
5
|
+
zh_CN: zh_CN,
|
|
6
|
+
en_US: en_US,
|
|
7
|
+
zh_TW: zh_TW,
|
|
8
|
+
// 兼容
|
|
9
|
+
zh: zh_CN,
|
|
10
|
+
en: en_US
|
|
12
11
|
};
|
|
@@ -2,20 +2,19 @@ import _Row from "@chaoswise/ui/lib/Antd/Row";
|
|
|
2
2
|
import _Col from "@chaoswise/ui/lib/Antd/Col";
|
|
3
3
|
import "@chaoswise/ui/lib/TooltipText/index.less";
|
|
4
4
|
import _TooltipText from "@chaoswise/ui/lib/TooltipText";
|
|
5
|
-
import
|
|
5
|
+
import _useLocale2 from "@chaoswise/ui/lib/useLocale";
|
|
6
6
|
import React from "react";
|
|
7
7
|
import classnames from "classnames";
|
|
8
|
-
import { getLocale } from "../../locale";
|
|
9
8
|
import _ from "lodash";
|
|
9
|
+
import langConfig from '../../locale';
|
|
10
|
+
import { formatMessage } from "../../../utils";
|
|
10
11
|
import "./index.less";
|
|
11
12
|
var MoreTimeList = function MoreTimeList(props) {
|
|
12
13
|
var regroupDataSource = props.regroupDataSource,
|
|
13
14
|
recordDateValue = props.recordDateValue,
|
|
14
15
|
onClickItem = props.onClickItem;
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
locale = _ConfigProvider$useLo2 === void 0 ? "zh" : _ConfigProvider$useLo2;
|
|
18
|
-
var localeObj = getLocale(locale);
|
|
16
|
+
var _useLocale = _useLocale2(langConfig),
|
|
17
|
+
localeObj = _useLocale.langObj;
|
|
19
18
|
// 点击Menu.Item中切换常规模式
|
|
20
19
|
var onClickMoreItem = function onClickMoreItem(item) {
|
|
21
20
|
onClickItem(item);
|
|
@@ -29,7 +28,7 @@ var MoreTimeList = function MoreTimeList(props) {
|
|
|
29
28
|
borderBottom: regroupDataSource.length - 1 !== index ? "1px solid rgba(0,0,0,0.06)" : ""
|
|
30
29
|
},
|
|
31
30
|
key: timeTypeItem.type
|
|
32
|
-
}, /*#__PURE__*/React.createElement("h3", null, localeObj[timeTypeItem.type]), /*#__PURE__*/React.createElement(_Row, null, timeTypeItem.timeList.map(function (item) {
|
|
31
|
+
}, /*#__PURE__*/React.createElement("h3", null, formatMessage(localeObj[timeTypeItem.type])), /*#__PURE__*/React.createElement(_Row, null, timeTypeItem.timeList.map(function (item) {
|
|
33
32
|
return /*#__PURE__*/React.createElement(_Col, {
|
|
34
33
|
key: item.key,
|
|
35
34
|
span: timeTypeItem.type === "absolute" || timeTypeItem.type == "unixTimestamp" ? 12 : 8,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
2
|
import _Dropdown from "@chaoswise/ui/lib/Antd/Dropdown";
|
|
3
3
|
import _Icon from "@chaoswise/ui/lib/Antd/Icon";
|
|
4
|
-
import
|
|
4
|
+
import _useLocale2 from "@chaoswise/ui/lib/useLocale";
|
|
5
5
|
var _excluded = ["timeDomain", "number", "unit", "value", "isRecently"];
|
|
6
6
|
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; }
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -12,13 +12,14 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
12
12
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
13
13
|
import React from "react";
|
|
14
14
|
import classnames from "classnames";
|
|
15
|
-
import { getLocale } from "../locale";
|
|
16
15
|
import Calendar2Svg from "../assets/Calendar2";
|
|
17
16
|
import LiveSvg from "../assets/live";
|
|
18
17
|
import MoreSvg from "../assets/more";
|
|
19
18
|
import MoreTimeList from "./MoreTimeList";
|
|
20
19
|
import { funcValueChangeArrayValue, getCorrectValue } from "../utils";
|
|
21
20
|
import _ from "lodash";
|
|
21
|
+
import langConfig from '../locale';
|
|
22
|
+
import { formatMessage } from "../../utils";
|
|
22
23
|
import "./index.less";
|
|
23
24
|
var DropdownMenu = function DropdownMenu(props) {
|
|
24
25
|
var dataSource = props.dataSource,
|
|
@@ -30,10 +31,8 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
30
31
|
onChange = props.onChange,
|
|
31
32
|
menuOption = props.menuOption,
|
|
32
33
|
setIsFocus = props.setIsFocus;
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
locale = _ConfigProvider$useLo2 === void 0 ? "zh" : _ConfigProvider$useLo2;
|
|
36
|
-
var localeObj = getLocale(locale);
|
|
34
|
+
var _useLocale = _useLocale2(langConfig),
|
|
35
|
+
localeObj = _useLocale.langObj;
|
|
37
36
|
var _menuOption$showCalen = menuOption.showCalendar,
|
|
38
37
|
showCalendar = _menuOption$showCalen === void 0 ? true : _menuOption$showCalen,
|
|
39
38
|
_menuOption$showDefau = menuOption.showDefaultCount,
|
|
@@ -107,7 +106,7 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
107
106
|
style: {
|
|
108
107
|
marginLeft: "4px"
|
|
109
108
|
}
|
|
110
|
-
}, localeObj
|
|
109
|
+
}, formatMessage(localeObj["more"]))), /*#__PURE__*/React.createElement(_Icon, {
|
|
111
110
|
type: "right"
|
|
112
111
|
}))), showCalendar && /*#__PURE__*/React.createElement("div", {
|
|
113
112
|
className: classnames("cw-dropdown-date-picker-dropdown-menu-_item"),
|
|
@@ -121,6 +120,6 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
121
120
|
style: {
|
|
122
121
|
marginLeft: "4px"
|
|
123
122
|
}
|
|
124
|
-
}, localeObj["select-calendar"])));
|
|
123
|
+
}, formatMessage(localeObj["select-calendar"]))));
|
|
125
124
|
};
|
|
126
125
|
export default DropdownMenu;
|
|
@@ -8,7 +8,7 @@ import "@chaoswise/ui/lib/RangePicker/index.less";
|
|
|
8
8
|
import _RangePicker from "@chaoswise/ui/lib/RangePicker";
|
|
9
9
|
import "@chaoswise/ui/lib/Tooltip/index.less";
|
|
10
10
|
import _Tooltip from "@chaoswise/ui/lib/Tooltip";
|
|
11
|
-
import
|
|
11
|
+
import _useLocale2 from "@chaoswise/ui/lib/useLocale";
|
|
12
12
|
var _excluded = ["inputPrefixIcon", "className"],
|
|
13
13
|
_excluded2 = ["value"],
|
|
14
14
|
_excluded3 = ["value"];
|
|
@@ -32,11 +32,12 @@ import classnames from "classnames";
|
|
|
32
32
|
import DropDownMenu from "./DropdownMenu";
|
|
33
33
|
import LiveSvg from "./assets/live";
|
|
34
34
|
import RecoverSvg from "./assets/Recover";
|
|
35
|
-
import { getLocale } from "./locale";
|
|
36
35
|
import _ from "lodash";
|
|
37
36
|
import { regroupDataSourceFn, echoInputValue, isEmptyObject, funcValueChangeArrayValue, getCorrectValue } from "./utils";
|
|
38
37
|
import moment from "moment";
|
|
39
38
|
import { v4 as uuidv4 } from 'uuid';
|
|
39
|
+
import langConfig from './locale';
|
|
40
|
+
import { formatMessage } from "../utils";
|
|
40
41
|
import "./index.less";
|
|
41
42
|
var DropdownDatePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
42
43
|
var defaultValue = props.defaultValue,
|
|
@@ -53,10 +54,10 @@ var DropdownDatePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
53
54
|
_props$format = props.format,
|
|
54
55
|
format = _props$format === void 0 ? "YYYY/MM/DD HH:mm:ss" : _props$format,
|
|
55
56
|
recordDateValueRender = props.recordDateValueRender;
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
locale =
|
|
59
|
-
|
|
57
|
+
var _useLocale = _useLocale2(langConfig),
|
|
58
|
+
localeObj = _useLocale.langObj,
|
|
59
|
+
_useLocale$locale = _useLocale.locale,
|
|
60
|
+
locale = _useLocale$locale === void 0 ? "zh_CN" : _useLocale$locale;
|
|
60
61
|
var _menuOption$showCalen = menuOption.showCalendar,
|
|
61
62
|
showCalendar = _menuOption$showCalen === void 0 ? true : _menuOption$showCalen,
|
|
62
63
|
_menuOption$isRangePi = menuOption.isRangePickerCalendar,
|
|
@@ -195,7 +196,7 @@ var DropdownDatePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
195
196
|
}, [recordDateValue, dateValue]);
|
|
196
197
|
// 输入框尾缀图标
|
|
197
198
|
var inputSuffix = !isEqual && /*#__PURE__*/React.createElement(_Tooltip, {
|
|
198
|
-
title: localeObj
|
|
199
|
+
title: formatMessage(localeObj["recover"])
|
|
199
200
|
}, /*#__PURE__*/React.createElement(RecoverSvg, {
|
|
200
201
|
onClick: onRecover,
|
|
201
202
|
className: classnames("cw-dropdown-date-picker-suffix-recover")
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
1
|
+
import zh_CN from './zh_CN.js';
|
|
2
|
+
import en_US from './en_US.js';
|
|
3
|
+
import zh_TW from './zh_TW.js';
|
|
4
|
+
export default {
|
|
5
|
+
zh_CN: zh_CN,
|
|
6
|
+
en_US: en_US,
|
|
7
|
+
zh_TW: zh_TW,
|
|
8
|
+
// 兼容
|
|
9
|
+
zh: zh_CN,
|
|
10
|
+
en: en_US
|
|
12
11
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
recover: "恢復默認值",
|
|
3
|
+
s: "秒",
|
|
4
|
+
m: "分鐘",
|
|
5
|
+
h: "小時",
|
|
6
|
+
d: "天",
|
|
7
|
+
mo: "個月",
|
|
8
|
+
y: "年",
|
|
9
|
+
more: "更多",
|
|
10
|
+
"select-calendar": "日曆選擇",
|
|
11
|
+
recently: "最近",
|
|
12
|
+
relative: "相對",
|
|
13
|
+
absolute: "絕對",
|
|
14
|
+
unixTimestamp: "Unix",
|
|
15
|
+
other: "其他",
|
|
16
|
+
history: "歷史記錄",
|
|
17
|
+
clear: "清空",
|
|
18
|
+
"enter manually": "可根據以下類型,按查詢語句格式手動輸入",
|
|
19
|
+
"fit-the-input-format": "符合輸入格式",
|
|
20
|
+
"does-not-match-the-input-format": "不符合輸入格式,請重新輸入"
|
|
21
|
+
};
|
|
@@ -109,7 +109,8 @@ export var judgeType = function judgeType(recordDateValue) {
|
|
|
109
109
|
return [isRule, captureUnit, recordUnit];
|
|
110
110
|
};
|
|
111
111
|
export var echoRecentlyTimeTitle = function echoRecentlyTimeTitle(locale, captureUnit) {
|
|
112
|
-
|
|
112
|
+
// todo: 需要优化
|
|
113
|
+
if (locale == "zh_CN" || locale == "zh" || locale == "zh_TW") {
|
|
113
114
|
if (captureUnit[1] === "mo") {
|
|
114
115
|
return "\u6700\u8FD1".concat(captureUnit[0], "\u4E2A").concat(ENUM_TimeUnit.mo[2]);
|
|
115
116
|
}
|
|
@@ -120,6 +121,7 @@ export var echoRecentlyTimeTitle = function echoRecentlyTimeTitle(locale, captur
|
|
|
120
121
|
}
|
|
121
122
|
return "Past ".concat(captureUnit[0], " ").concat(ENUM_TimeUnit[captureUnit[1]][1]);
|
|
122
123
|
}
|
|
124
|
+
ƒ;
|
|
123
125
|
};
|
|
124
126
|
export var echoAbsoluteTimeTitle = function echoAbsoluteTimeTitle(value, format) {
|
|
125
127
|
var hasTimeSpan = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -136,7 +138,7 @@ export var echoAbsoluteTimeTitle = function echoAbsoluteTimeTitle(value, format)
|
|
|
136
138
|
export var echoInputValue = function echoInputValue() {
|
|
137
139
|
var _value;
|
|
138
140
|
var recordDateValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
139
|
-
var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "
|
|
141
|
+
var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "zh_CN";
|
|
140
142
|
var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "YYYY/MM/DD HH:mm:ss";
|
|
141
143
|
var recordDateValueRender = arguments.length > 3 ? arguments[3] : undefined;
|
|
142
144
|
var values = recordDateValue.value,
|
package/lib/Empty/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _useLocale2 from "@chaoswise/ui/lib/useLocale";
|
|
2
2
|
import "antd/es/empty/style";
|
|
3
3
|
import _Empty from "antd/es/empty";
|
|
4
4
|
var _excluded = ["image", "onlyDescription", "description"];
|
|
@@ -8,8 +8,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
8
8
|
import React, { forwardRef } from "react";
|
|
9
9
|
import PropTypes from "prop-types";
|
|
10
10
|
import classnames from "classnames";
|
|
11
|
-
import { getLocale } from "./locale";
|
|
12
11
|
import { cloneComProps } from "../utils";
|
|
12
|
+
import langConfig from './locale';
|
|
13
|
+
import { formatMessage } from "../utils";
|
|
13
14
|
import "./index.less";
|
|
14
15
|
var CWEmpty = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
15
16
|
var _props$image = props.image,
|
|
@@ -18,16 +19,14 @@ var CWEmpty = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
18
19
|
onlyDescription = _props$onlyDescriptio === void 0 ? false : _props$onlyDescriptio,
|
|
19
20
|
description = props.description,
|
|
20
21
|
rest = _objectWithoutProperties(props, _excluded);
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
locale = _ConfigProvider$useLo2 === void 0 ? "zh" : _ConfigProvider$useLo2;
|
|
24
|
-
var localeObj = getLocale(locale);
|
|
22
|
+
var _useLocale = _useLocale2(langConfig),
|
|
23
|
+
localeObj = _useLocale.langObj;
|
|
25
24
|
if (onlyDescription) {
|
|
26
25
|
return /*#__PURE__*/React.createElement("div", {
|
|
27
26
|
className: classnames({
|
|
28
27
|
"cw-empty-only-description": true
|
|
29
28
|
}, rest.className)
|
|
30
|
-
}, /*#__PURE__*/React.createElement("div", null, description ? description : localeObj
|
|
29
|
+
}, /*#__PURE__*/React.createElement("div", null, description ? description : formatMessage(localeObj["nodata"])), props.children && /*#__PURE__*/React.createElement("div", {
|
|
31
30
|
style: {
|
|
32
31
|
marginTop: "16px"
|
|
33
32
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
1
|
+
import zh_CN from './zh_CN.js';
|
|
2
|
+
import en_US from './en_US.js';
|
|
3
|
+
import zh_TW from './zh_TW.js';
|
|
4
|
+
export default {
|
|
5
|
+
zh_CN: zh_CN,
|
|
6
|
+
en_US: en_US,
|
|
7
|
+
zh_TW: zh_TW,
|
|
8
|
+
// 兼容
|
|
9
|
+
zh: zh_CN,
|
|
10
|
+
en: en_US
|
|
12
11
|
};
|