@chaoswise/ui 2.7.12 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AlgorithmChart/common/chart.option.js +14 -11
- package/lib/AlgorithmChart/index.js +29 -26
- package/lib/Antd4Form/FormItem.js +1 -1
- package/lib/BasicLayout/Nav.js +3 -5
- package/lib/BasicLayout/index.js +6 -7
- package/lib/CWMessage/MessageContent/TabList/index.js +9 -7
- package/lib/CWMessage/MessageContent/index.js +63 -48
- package/lib/CWMessage/index.js +28 -13
- 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 +28 -21
- package/lib/CWRangePicker/utils/index.js +45 -114
- package/lib/CWSelect/index.js +4 -7
- 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/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 +9 -10
- 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 +19 -22
- package/lib/Pagination/index.js +14 -14
- package/lib/PolymerizationSearch/DropdownMenu.js +4 -2
- package/lib/Progress/index.js +3 -6
- package/lib/QuickTransfer/DragList.js +3 -6
- package/lib/QuickTransfer/index.js +6 -9
- package/lib/RangePicker/components/ExtraTimeFooter.js +4 -7
- package/lib/SearchBar/index.js +6 -9
- package/lib/SimpleCard/index.js +3 -1
- package/lib/SingleSpa/index.js +10 -4
- package/lib/ThemeProvider/Switcher.js +3 -1
- package/lib/TimeRangeSlider/Refresh/index.js +4 -7
- package/lib/TimeRangeSlider/TimeSpan/index.js +6 -9
- package/lib/TimeRangeSlider/index.js +22 -18
- package/lib/TimeRangeSlider/utils/index.js +20 -100
- package/lib/TimeZoneSelect/index.js +1 -1
- 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 +11 -2
- package/lib/Antd4/notification/index.copy.js +0 -301
- 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/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/drag.svg +0 -17
- 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/CheckList.js +0 -47
- package/lib/QuickTransfer/TopicList.js +0 -152
- 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
- package/lib/useConfgiContext/index.js +0 -6
|
@@ -4,7 +4,6 @@ import _Tooltip from "@chaoswise/ui/lib/Tooltip";
|
|
|
4
4
|
import "@chaoswise/ui/lib/Progress/index.less";
|
|
5
5
|
import _Progress from "@chaoswise/ui/lib/Progress";
|
|
6
6
|
import _Icon from "@chaoswise/ui/lib/Icon";
|
|
7
|
-
import _useLocale2 from "@chaoswise/ui/lib/useLocale";
|
|
8
7
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
9
8
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
10
9
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
@@ -19,6 +18,7 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
|
|
|
19
18
|
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
20
19
|
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
21
20
|
// @ts-nocheck
|
|
21
|
+
import useIntl from '../../useIntl';
|
|
22
22
|
import * as React from "react";
|
|
23
23
|
import Animate from "rc-animate";
|
|
24
24
|
import classNames from "classnames";
|
|
@@ -27,14 +27,11 @@ import { ConfigConsumer } from "antd/es/config-provider";
|
|
|
27
27
|
import { HTML5Backend } from "react-dnd-html5-backend";
|
|
28
28
|
import { DndProvider } from "react-dnd";
|
|
29
29
|
import DragList from "./DragList";
|
|
30
|
-
import langConfig from '../locale';
|
|
31
|
-
import { formatMessage } from "../../utils";
|
|
32
30
|
export default function UploadList(props) {
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, props));
|
|
31
|
+
var intl = useIntl();
|
|
32
|
+
return /*#__PURE__*/React.createElement(IUploadList, Object.assign({}, props, {
|
|
33
|
+
intl: intl
|
|
34
|
+
}));
|
|
38
35
|
}
|
|
39
36
|
var IUploadList = /*#__PURE__*/function (_React$Component) {
|
|
40
37
|
function IUploadList() {
|
|
@@ -78,7 +75,7 @@ var IUploadList = /*#__PURE__*/function (_React$Component) {
|
|
|
78
75
|
renderMethod = _this$props.renderMethod,
|
|
79
76
|
dropSingleFileUpload = _this$props.dropSingleFileUpload,
|
|
80
77
|
onMove = _this$props.onMove,
|
|
81
|
-
|
|
78
|
+
intl = _this$props.intl,
|
|
82
79
|
errorMessage = _this$props.errorMessage,
|
|
83
80
|
successMessage = _this$props.successMessage,
|
|
84
81
|
_this$props$customErr = _this$props.customErrorOption,
|
|
@@ -89,9 +86,9 @@ var IUploadList = /*#__PURE__*/function (_React$Component) {
|
|
|
89
86
|
isCustomErrorMessage = _customErrorOption$is === void 0 ? false : _customErrorOption$is,
|
|
90
87
|
_customErrorOption$op = customErrorOption.operateTitle,
|
|
91
88
|
operateTitle = _customErrorOption$op === void 0 ? {
|
|
92
|
-
reloadTitle:
|
|
93
|
-
deleteTitle:
|
|
94
|
-
downloadExceptionReportTitle:
|
|
89
|
+
reloadTitle: intl.get("340865c8-eaf7-4b90-8dbc-0a5018c155a7").d("重新上传"),
|
|
90
|
+
deleteTitle: intl.get("0ea78d24-5751-4948-8647-41a28895a70e").d("删除"),
|
|
91
|
+
downloadExceptionReportTitle: intl.get("32980121-5932-4714-8ac4-7747d7e48fcc").d("下载异常报告")
|
|
95
92
|
} : _customErrorOption$op,
|
|
96
93
|
_customErrorOption$on = customErrorOption.onDownloadExceptionReport,
|
|
97
94
|
onDownloadExceptionReport = _customErrorOption$on === void 0 ? function () {} : _customErrorOption$on;
|
|
@@ -285,7 +282,7 @@ var IUploadList = /*#__PURE__*/function (_React$Component) {
|
|
|
285
282
|
type: "reload"
|
|
286
283
|
})), /*#__PURE__*/React.createElement("div", {
|
|
287
284
|
className: "".concat(prefixCls, "-one-drag-error")
|
|
288
|
-
},
|
|
285
|
+
}, intl.get("340865c8-eaf7-4b90-8dbc-0a5018c155a7").d("重新上传")))), file.status === "done" && successMessage, (file.status === "done" && !successMessage || file.status == "removed" || !file.status) && (/*#__PURE__*/React.createElement("div", {
|
|
289
286
|
className: "".concat(prefixCls, "-one-drag-uploading")
|
|
290
287
|
}, /*#__PURE__*/React.createElement("div", {
|
|
291
288
|
className: listItemNameClass,
|
|
@@ -323,7 +320,7 @@ var IUploadList = /*#__PURE__*/function (_React$Component) {
|
|
|
323
320
|
fontSize: "16px",
|
|
324
321
|
marginRight: "4px"
|
|
325
322
|
}
|
|
326
|
-
}),
|
|
323
|
+
}), intl.get("340865c8-eaf7-4b90-8dbc-0a5018c155a7").d("重新上传")), /*#__PURE__*/React.createElement("a", {
|
|
327
324
|
title: locale.removeFile,
|
|
328
325
|
onClick: function onClick(e) {
|
|
329
326
|
if (!disabled) {
|
|
@@ -343,7 +340,7 @@ var IUploadList = /*#__PURE__*/function (_React$Component) {
|
|
|
343
340
|
fontSize: "16px",
|
|
344
341
|
marginRight: "4px"
|
|
345
342
|
}
|
|
346
|
-
}),
|
|
343
|
+
}), intl.get("0ea78d24-5751-4948-8647-41a28895a70e").d("删除"))))), file.status === "uploading" && (/*#__PURE__*/React.createElement("div", {
|
|
347
344
|
className: "".concat(prefixCls, "-one-drag-uploading"),
|
|
348
345
|
style: {
|
|
349
346
|
height: "76px",
|
package/lib/CardSelect/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import "antd/es/dropdown/style";
|
|
|
2
2
|
import _Dropdown from "antd/es/dropdown";
|
|
3
3
|
import "antd/es/button/style";
|
|
4
4
|
import _Button from "antd/es/button";
|
|
5
|
+
import _useIntl from "@chaoswise/ui/lib/useIntl";
|
|
5
6
|
var _excluded = ["menuTitle", "defaultTitle", "defaultValue", "labelInValue", "value", "menuData", "children", "onClick"];
|
|
6
7
|
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
8
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
@@ -21,16 +22,19 @@ import './index.less';
|
|
|
21
22
|
* 带图标的下拉菜单,支持自定义菜单内容和菜单提示文字,支持受控和非受控
|
|
22
23
|
*/
|
|
23
24
|
|
|
24
|
-
var CWCardSelect = function CWCardSelect(
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
var CWCardSelect = function CWCardSelect(props) {
|
|
26
|
+
var intl = _useIntl();
|
|
27
|
+
var _props$menuTitle = props.menuTitle,
|
|
28
|
+
menuTitle = _props$menuTitle === void 0 ? intl.get("6566e451-97df-4da4-887a-e218bb5984f0").d("请选择图表类型") : _props$menuTitle,
|
|
29
|
+
_props$defaultTitle = props.defaultTitle,
|
|
30
|
+
defaultTitle = _props$defaultTitle === void 0 ? intl.get("857ecc4e-d0c2-44b1-a588-c898380e6a4e").d("展现方式") : _props$defaultTitle,
|
|
31
|
+
defaultValue = props.defaultValue,
|
|
32
|
+
labelInValue = props.labelInValue,
|
|
33
|
+
value = props.value,
|
|
34
|
+
menuData = props.menuData,
|
|
35
|
+
children = props.children,
|
|
36
|
+
onClick = props.onClick,
|
|
37
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
34
38
|
var menus = menuData;
|
|
35
39
|
var defaultName;
|
|
36
40
|
if (defaultValue) {
|
|
@@ -40,7 +44,7 @@ var CWCardSelect = function CWCardSelect(_ref) {
|
|
|
40
44
|
}
|
|
41
45
|
});
|
|
42
46
|
}
|
|
43
|
-
var _useState = useState(defaultValue ? defaultName :
|
|
47
|
+
var _useState = useState(defaultValue ? defaultName : undefined),
|
|
44
48
|
_useState2 = _slicedToArray(_useState, 2),
|
|
45
49
|
dropdownTitle = _useState2[0],
|
|
46
50
|
changeDropdownTitle = _useState2[1];
|
|
@@ -86,12 +90,10 @@ var CWCardSelect = function CWCardSelect(_ref) {
|
|
|
86
90
|
return /*#__PURE__*/React.createElement(_Dropdown, _extends({
|
|
87
91
|
overlay: menu,
|
|
88
92
|
placement: "bottomRight"
|
|
89
|
-
}, rest), children ? children : /*#__PURE__*/React.createElement(_Button, null, title ? title : dropdownTitle, " "));
|
|
93
|
+
}, rest), children ? children : /*#__PURE__*/React.createElement(_Button, null, title ? title : dropdownTitle === undefined ? defaultTitle : dropdownTitle, " "));
|
|
90
94
|
};
|
|
91
95
|
CWCardSelect.defaultProps = {
|
|
92
|
-
defaultTitle: '展现方式',
|
|
93
96
|
labelInValue: false,
|
|
94
|
-
menuTitle: '请选择图表类型',
|
|
95
97
|
onClick: function onClick(value, name, item) {
|
|
96
98
|
console.log(value, name, item);
|
|
97
99
|
}
|
package/lib/CitySelect/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "@chaoswise/ui/lib/Cascader/index.less";
|
|
2
2
|
import _Cascader from "@chaoswise/ui/lib/Cascader";
|
|
3
|
+
import _useIntl from "@chaoswise/ui/lib/useIntl";
|
|
3
4
|
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); }
|
|
4
5
|
import React from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
@@ -13,9 +14,10 @@ import configCities from '../../config/city/citys';
|
|
|
13
14
|
*/
|
|
14
15
|
|
|
15
16
|
function CitySelect(props) {
|
|
17
|
+
var intl = _useIntl();
|
|
16
18
|
return /*#__PURE__*/React.createElement(_Cascader, _extends({
|
|
17
19
|
options: configCities ? configCities : cities,
|
|
18
|
-
placeholder: "
|
|
20
|
+
placeholder: intl.get("2eae9bf2-695b-4914-a3e5-27f3af64dbfd").d("请选择机构城市")
|
|
19
21
|
}, props));
|
|
20
22
|
}
|
|
21
23
|
CitySelect.propTypes = {
|
package/lib/ColorPicker/index.js
CHANGED
|
@@ -6,7 +6,6 @@ import _Space from "@chaoswise/ui/lib/Space";
|
|
|
6
6
|
import _Icon from "@chaoswise/ui/lib/Icon";
|
|
7
7
|
import "@chaoswise/ui/lib/Input/index.less";
|
|
8
8
|
import _Input from "@chaoswise/ui/lib/Input";
|
|
9
|
-
import _useLocale2 from "@chaoswise/ui/lib/useLocale";
|
|
10
9
|
import "@chaoswise/ui/lib/Tabs/index.less";
|
|
11
10
|
import _Tabs from "@chaoswise/ui/lib/Tabs";
|
|
12
11
|
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); }
|
|
@@ -21,12 +20,11 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
21
20
|
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; }
|
|
22
21
|
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; } }
|
|
23
22
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
23
|
+
import useIntl from '../useIntl';
|
|
24
24
|
import React, { useEffect, useState } from "react";
|
|
25
25
|
import SketchPicker from "./SketchPicker/components/sketch";
|
|
26
26
|
import classnames from "classnames";
|
|
27
27
|
import { formatRgbaObj, hexToRgba } from "./utils";
|
|
28
|
-
import langConfig from "./locale";
|
|
29
|
-
import { formatMessage } from "../utils";
|
|
30
28
|
import PropTypes from "prop-types";
|
|
31
29
|
import "./index.less";
|
|
32
30
|
var TabPane = _Tabs.TabPane;
|
|
@@ -71,8 +69,7 @@ var ColorPicker = function ColorPicker(_ref) {
|
|
|
71
69
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
72
70
|
gradientColorValue = _useState8[0],
|
|
73
71
|
setGradientColorValue = _useState8[1]; //组件渐变色值
|
|
74
|
-
var
|
|
75
|
-
localeObj = _useLocale.langObj;
|
|
72
|
+
var intl = useIntl();
|
|
76
73
|
var _value = value || defaultValue;
|
|
77
74
|
useEffect(function () {
|
|
78
75
|
if (_value) {
|
|
@@ -188,7 +185,7 @@ var ColorPicker = function ColorPicker(_ref) {
|
|
|
188
185
|
onChange: changeTab
|
|
189
186
|
}, /*#__PURE__*/React.createElement(TabPane, {
|
|
190
187
|
key: "single",
|
|
191
|
-
tab:
|
|
188
|
+
tab: intl.get("94482e5c-d90c-49f7-87b0-9877dc8e3824").d("单色")
|
|
192
189
|
}, /*#__PURE__*/React.createElement("div", {
|
|
193
190
|
className: "color-picker"
|
|
194
191
|
}, /*#__PURE__*/React.createElement(_Input, {
|
|
@@ -200,7 +197,7 @@ var ColorPicker = function ColorPicker(_ref) {
|
|
|
200
197
|
onChange: onChangeColor
|
|
201
198
|
}))), showGradient && /*#__PURE__*/React.createElement(TabPane, {
|
|
202
199
|
key: "gradient",
|
|
203
|
-
tab:
|
|
200
|
+
tab: intl.get("4cba455a-5fc7-4174-9a67-8395150a3222").d("渐变")
|
|
204
201
|
}, /*#__PURE__*/React.createElement("div", {
|
|
205
202
|
className: "color-picker"
|
|
206
203
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -1,13 +1,12 @@
|
|
|
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 "antd/es/config-provider/style";
|
|
3
2
|
import _ConfigProvider from "antd/es/config-provider";
|
|
4
|
-
var _excluded = ["children", "locales", "defaultLocale", "messages"];
|
|
3
|
+
var _excluded = ["children", "locales", "defaultLocale", "messages", "uiLocales", "localeLoading", "onLocaleError"];
|
|
4
|
+
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); }
|
|
5
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); }
|
|
6
|
-
function
|
|
7
|
-
function
|
|
8
|
-
function
|
|
9
|
-
function
|
|
10
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
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
|
+
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
|
+
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); }); }; }
|
|
11
10
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
12
11
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
12
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
@@ -16,97 +15,193 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
16
15
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
17
16
|
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; }
|
|
18
17
|
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; }
|
|
19
|
-
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
22
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
20
24
|
import Antd4ConfigProvider from '../Antd4/config-provider';
|
|
21
25
|
import { IntlProvider } from 'react-intl';
|
|
22
26
|
import moment from 'moment';
|
|
23
27
|
import 'moment/locale/zh-cn';
|
|
28
|
+
import 'moment/locale/zh-tw';
|
|
29
|
+
import 'moment/locale/zh-hk';
|
|
30
|
+
import 'moment/locale/ja';
|
|
24
31
|
import zh_CN_antd4 from '../Antd4/locale/zh_CN';
|
|
25
32
|
import en_US_antd4 from '../Antd4/locale/en_US';
|
|
26
33
|
import zh_TW_antd4 from '../Antd4/locale/zh_TW';
|
|
34
|
+
import zh_HK_antd4 from '../Antd4/locale/zh_HK';
|
|
27
35
|
import ja_JP_antd4 from '../Antd4/locale/ja_JP';
|
|
28
36
|
import zh_CN_antd from 'antd/es/locale/zh_CN';
|
|
29
37
|
import zh_TW_antd from 'antd/es/locale/zh_TW';
|
|
30
38
|
import en_US_antd from 'antd/es/locale/en_US';
|
|
31
39
|
import ja_JP_antd from 'antd/es/locale/ja_JP';
|
|
32
|
-
|
|
40
|
+
import { intlContext } from './context';
|
|
41
|
+
import { loadMessages } from '../locales/load';
|
|
42
|
+
import { createRuntime, getFallbackIntl, normalizeLocale, isSupportedLocale, mergeAntdLocale, defaultAntdMessages } from '../locales/runtime';
|
|
43
|
+
import createAntdMessages from '../locales/messages/antd';
|
|
44
|
+
|
|
45
|
+
// Kept for existing consumers, including @chaoswise/business.
|
|
46
|
+
export { intlContext } from './context';
|
|
33
47
|
var ANTD4_LOCALE_MAP = {
|
|
34
48
|
zh_CN: zh_CN_antd4,
|
|
35
49
|
en_US: en_US_antd4,
|
|
36
50
|
zh_TW: zh_TW_antd4,
|
|
51
|
+
zh_HK: zh_HK_antd4,
|
|
37
52
|
ja_JP: ja_JP_antd4
|
|
38
53
|
};
|
|
54
|
+
// Ant Design 3 does not ship zh_HK. Use its TW structure and platform HK text.
|
|
39
55
|
var ANTD3_LOCALE_MAP = {
|
|
40
56
|
zh_CN: zh_CN_antd,
|
|
41
57
|
en_US: en_US_antd,
|
|
42
58
|
zh_TW: zh_TW_antd,
|
|
59
|
+
zh_HK: _objectSpread(_objectSpread({}, zh_TW_antd), {}, {
|
|
60
|
+
locale: 'zh-hk'
|
|
61
|
+
}),
|
|
43
62
|
ja_JP: ja_JP_antd
|
|
44
63
|
};
|
|
45
64
|
var I18N_MAP = {
|
|
46
|
-
zh_CN: 'zh',
|
|
65
|
+
zh_CN: 'zh-CN',
|
|
66
|
+
en_US: 'en-US',
|
|
67
|
+
zh_TW: 'zh-TW',
|
|
68
|
+
zh_HK: 'zh-HK',
|
|
69
|
+
ja_JP: 'ja-JP'
|
|
70
|
+
};
|
|
71
|
+
var MOMENT_MAP = {
|
|
72
|
+
zh_CN: 'zh-cn',
|
|
47
73
|
en_US: 'en',
|
|
48
|
-
zh_TW: 'zh',
|
|
74
|
+
zh_TW: 'zh-tw',
|
|
75
|
+
zh_HK: 'zh-hk',
|
|
49
76
|
ja_JP: 'ja'
|
|
50
77
|
};
|
|
51
|
-
export var intlContext = /*#__PURE__*/React.createContext({
|
|
52
|
-
localeContext: {
|
|
53
|
-
locale: '',
|
|
54
|
-
updateLocale: function updateLocale() {}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
var Provider = intlContext.Provider;
|
|
58
|
-
|
|
59
|
-
// 兼容映射
|
|
60
|
-
var LOCALE_MAP = {
|
|
61
|
-
zh: 'zh_CN',
|
|
62
|
-
en: 'en_US'
|
|
63
|
-
};
|
|
64
78
|
var AllProvider = function AllProvider(_ref) {
|
|
65
|
-
var
|
|
79
|
+
var _ref2;
|
|
66
80
|
var children = _ref.children,
|
|
67
81
|
_ref$locales = _ref.locales,
|
|
68
82
|
locales = _ref$locales === void 0 ? {} : _ref$locales,
|
|
69
83
|
_ref$defaultLocale = _ref.defaultLocale,
|
|
70
84
|
defaultLocale = _ref$defaultLocale === void 0 ? 'zh_CN' : _ref$defaultLocale,
|
|
71
85
|
messages = _ref.messages,
|
|
86
|
+
uiLocales = _ref.uiLocales,
|
|
87
|
+
_ref$localeLoading = _ref.localeLoading,
|
|
88
|
+
localeLoading = _ref$localeLoading === void 0 ? null : _ref$localeLoading,
|
|
89
|
+
onLocaleError = _ref.onLocaleError,
|
|
72
90
|
resProps = _objectWithoutProperties(_ref, _excluded);
|
|
73
91
|
var _useState = useState(defaultLocale),
|
|
74
92
|
_useState2 = _slicedToArray(_useState, 2),
|
|
75
93
|
locale = _useState2[0],
|
|
76
94
|
setLocale = _useState2[1];
|
|
77
|
-
var currentLocale =
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
95
|
+
var currentLocale = normalizeLocale(locale);
|
|
96
|
+
var _useState3 = useState(null),
|
|
97
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
98
|
+
ready = _useState4[0],
|
|
99
|
+
setReady = _useState4[1];
|
|
100
|
+
// Inline uiLocales/onLocaleError from callers must not rebuild the runtime on every render.
|
|
101
|
+
var onLocaleErrorRef = useRef(onLocaleError);
|
|
102
|
+
onLocaleErrorRef.current = onLocaleError;
|
|
103
|
+
var uiLocalesRef = useRef(uiLocales);
|
|
104
|
+
uiLocalesRef.current = uiLocales;
|
|
105
|
+
var uiLocalesKey = JSON.stringify(uiLocales && uiLocales[currentLocale]) || '';
|
|
87
106
|
useEffect(function () {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (currentLocale === 'en_US') {
|
|
92
|
-
ANTD3_LOCALE_MAP[currentLocale].Empty.description = 'No data';
|
|
107
|
+
var cancelled = false;
|
|
108
|
+
function register() {
|
|
109
|
+
return _register.apply(this, arguments);
|
|
93
110
|
}
|
|
94
|
-
|
|
111
|
+
function _register() {
|
|
112
|
+
_register = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
113
|
+
var bundled, dictionary, runtime, fallbackLocale, intl, _t;
|
|
114
|
+
return _regenerator().w(function (_context) {
|
|
115
|
+
while (1) switch (_context.p = _context.n) {
|
|
116
|
+
case 0:
|
|
117
|
+
_context.p = 0;
|
|
118
|
+
if (isSupportedLocale(currentLocale)) {
|
|
119
|
+
_context.n = 1;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
throw new Error("Unsupported UI locale: ".concat(currentLocale));
|
|
123
|
+
case 1:
|
|
124
|
+
_context.n = 2;
|
|
125
|
+
return loadMessages(currentLocale);
|
|
126
|
+
case 2:
|
|
127
|
+
bundled = _context.v;
|
|
128
|
+
dictionary = _objectSpread(_objectSpread({}, bundled), uiLocalesRef.current && uiLocalesRef.current[currentLocale]);
|
|
129
|
+
_context.n = 3;
|
|
130
|
+
return createRuntime(currentLocale, dictionary);
|
|
131
|
+
case 3:
|
|
132
|
+
runtime = _context.v;
|
|
133
|
+
if (!cancelled) {
|
|
134
|
+
moment.locale(MOMENT_MAP[currentLocale]);
|
|
135
|
+
setReady(_objectSpread(_objectSpread({}, runtime), {}, {
|
|
136
|
+
rawLocale: locale,
|
|
137
|
+
dictionary: dictionary
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
_context.n = 6;
|
|
141
|
+
break;
|
|
142
|
+
case 4:
|
|
143
|
+
_context.p = 4;
|
|
144
|
+
_t = _context.v;
|
|
145
|
+
if (!cancelled) {
|
|
146
|
+
_context.n = 5;
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
return _context.a(2);
|
|
150
|
+
case 5:
|
|
151
|
+
if (onLocaleErrorRef.current) onLocaleErrorRef.current(_t);
|
|
152
|
+
// Degrade to the bundled synchronous instance instead of crashing the app.
|
|
153
|
+
fallbackLocale = isSupportedLocale(currentLocale) ? currentLocale : 'zh_CN';
|
|
154
|
+
intl = getFallbackIntl(fallbackLocale);
|
|
155
|
+
moment.locale(MOMENT_MAP[fallbackLocale]);
|
|
156
|
+
setReady({
|
|
157
|
+
locale: fallbackLocale,
|
|
158
|
+
intl: intl,
|
|
159
|
+
antd: createAntdMessages(intl),
|
|
160
|
+
rawLocale: currentLocale === fallbackLocale ? locale : fallbackLocale,
|
|
161
|
+
dictionary: {}
|
|
162
|
+
});
|
|
163
|
+
case 6:
|
|
164
|
+
return _context.a(2);
|
|
165
|
+
}
|
|
166
|
+
}, _callee, null, [[0, 4]]);
|
|
167
|
+
}));
|
|
168
|
+
return _register.apply(this, arguments);
|
|
169
|
+
}
|
|
170
|
+
register();
|
|
171
|
+
return function () {
|
|
172
|
+
cancelled = true;
|
|
173
|
+
};
|
|
174
|
+
}, [locale, currentLocale, uiLocalesKey]);
|
|
175
|
+
if (!ready) return localeLoading;
|
|
176
|
+
// Keep the committed language while loading the next one. No child remount or mixed-language frame.
|
|
177
|
+
var committedLocale = ready.locale;
|
|
178
|
+
var antd3Locale = mergeAntdLocale(defaultAntdMessages.Antd3, ready.antd.Antd3, ANTD3_LOCALE_MAP[committedLocale]);
|
|
179
|
+
var antd4Locale = mergeAntdLocale(defaultAntdMessages.Antd4, ready.antd.Antd4, ANTD4_LOCALE_MAP[committedLocale]);
|
|
180
|
+
if (committedLocale === 'zh_HK') {
|
|
181
|
+
[antd3Locale, antd4Locale].forEach(function (config) {
|
|
182
|
+
['DatePicker', 'Calendar'].forEach(function (name) {
|
|
183
|
+
if (config[name] && config[name].lang) config[name].lang.locale = 'zh_HK';
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
}
|
|
95
187
|
var configProps = _objectSpread({
|
|
96
|
-
locale:
|
|
188
|
+
locale: antd3Locale,
|
|
97
189
|
autoInsertSpaceInButton: false
|
|
98
190
|
}, resProps);
|
|
99
|
-
return /*#__PURE__*/React.createElement(Provider, {
|
|
191
|
+
return /*#__PURE__*/React.createElement(intlContext.Provider, {
|
|
100
192
|
value: {
|
|
101
|
-
locale:
|
|
193
|
+
locale: ready.rawLocale,
|
|
102
194
|
setLocale: setLocale,
|
|
103
|
-
locales: locales
|
|
195
|
+
locales: locales,
|
|
196
|
+
intl: ready.intl,
|
|
197
|
+
dictionary: ready.dictionary,
|
|
198
|
+
dateLocale: antd4Locale.DatePicker
|
|
104
199
|
}
|
|
105
200
|
}, /*#__PURE__*/React.createElement(_ConfigProvider, configProps, /*#__PURE__*/React.createElement(Antd4ConfigProvider, _extends({}, configProps, {
|
|
106
|
-
locale:
|
|
201
|
+
locale: antd4Locale
|
|
107
202
|
}), /*#__PURE__*/React.createElement(IntlProvider, {
|
|
108
|
-
locale: I18N_MAP[
|
|
109
|
-
messages: messages ? messages : (
|
|
203
|
+
locale: I18N_MAP[committedLocale],
|
|
204
|
+
messages: messages !== undefined ? messages : (_ref2 = locales[ready.rawLocale] || locales[committedLocale]) === null || _ref2 === void 0 ? void 0 : _ref2.messages
|
|
110
205
|
}, children))));
|
|
111
206
|
};
|
|
112
207
|
export default AllProvider;
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import _Select from "@chaoswise/ui/lib/Select";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import useLocale from './useLocale';
|
|
4
|
+
|
|
5
|
+
// Fixed language names/keys, not translated UI messages.
|
|
6
|
+
/* cw-i18n-disable */
|
|
4
7
|
var LANG_LIST = [{
|
|
5
8
|
label: '简体中文',
|
|
6
9
|
value: 'zh_CN'
|
|
7
10
|
}, {
|
|
8
|
-
label: '
|
|
11
|
+
label: '繁體中文(台灣)',
|
|
9
12
|
value: 'zh_TW'
|
|
13
|
+
}, {
|
|
14
|
+
label: '繁體中文(香港)',
|
|
15
|
+
value: 'zh_HK'
|
|
10
16
|
}, {
|
|
11
17
|
label: 'English',
|
|
12
18
|
value: 'en_US'
|
|
13
19
|
}];
|
|
20
|
+
/* cw-i18n-enable */
|
|
21
|
+
|
|
14
22
|
var Switch = function Switch(_ref) {
|
|
15
23
|
var render = _ref.render;
|
|
16
24
|
var _useLocale = useLocale(),
|
|
@@ -31,7 +39,7 @@ var Switch = function Switch(_ref) {
|
|
|
31
39
|
/*#__PURE__*/
|
|
32
40
|
// <Button onClick={toggleLocal}>语言切换</Button>
|
|
33
41
|
React.createElement(_Select, {
|
|
34
|
-
|
|
42
|
+
value: locale,
|
|
35
43
|
style: {
|
|
36
44
|
width: 100
|
|
37
45
|
},
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { intlContext } from '../ConfigProvider/context';
|
|
2
3
|
import zhLocale from '../Antd4/date-picker/locale/zh_CN';
|
|
3
4
|
import enLocale from '../Antd4/date-picker/locale/en_US';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import twLocale from '../Antd4/date-picker/locale/zh_TW';
|
|
6
|
+
import jaLocale from '../Antd4/date-picker/locale/ja_JP';
|
|
7
|
+
import { normalizeLocale } from '../locales/runtime';
|
|
8
|
+
var localeMap = {
|
|
9
|
+
zh_CN: zhLocale,
|
|
10
|
+
en_US: enLocale,
|
|
11
|
+
zh_TW: twLocale,
|
|
12
|
+
zh_HK: twLocale,
|
|
13
|
+
ja_JP: jaLocale
|
|
7
14
|
};
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
locale =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
export default function useLocale() {
|
|
16
|
+
var _useContext = useContext(intlContext),
|
|
17
|
+
locale = _useContext.locale,
|
|
18
|
+
dateLocale = _useContext.dateLocale;
|
|
19
|
+
return dateLocale || localeMap[normalizeLocale(locale)] || zhLocale;
|
|
20
|
+
}
|
|
@@ -2,11 +2,9 @@ import "@chaoswise/ui/lib/Button/index.less";
|
|
|
2
2
|
import _Button from "@chaoswise/ui/lib/Button";
|
|
3
3
|
import "@chaoswise/ui/lib/Tooltip/index.less";
|
|
4
4
|
import _Tooltip from "@chaoswise/ui/lib/Tooltip";
|
|
5
|
-
import
|
|
5
|
+
import useIntl from '../../useIntl';
|
|
6
6
|
import React from "react";
|
|
7
7
|
import classnames from "classnames";
|
|
8
|
-
import langConfig from '../locale';
|
|
9
|
-
import { formatMessage } from "../../utils";
|
|
10
8
|
export default function ExtraFooter(_ref) {
|
|
11
9
|
var firstFewArr = _ref.firstFewArr,
|
|
12
10
|
moreArr = _ref.moreArr,
|
|
@@ -27,8 +25,7 @@ export default function ExtraFooter(_ref) {
|
|
|
27
25
|
quickOverlayStyle = _ref.quickOverlayStyle,
|
|
28
26
|
quickMoreItemClassName = _ref.quickMoreItemClassName,
|
|
29
27
|
quickMoreItemStyle = _ref.quickMoreItemStyle;
|
|
30
|
-
var
|
|
31
|
-
localeObj = _useLocale.langObj;
|
|
28
|
+
var intl = useIntl();
|
|
32
29
|
//渲染快速选择每一项
|
|
33
30
|
var renderItem = function renderItem(data) {
|
|
34
31
|
return /*#__PURE__*/React.createElement(React.Fragment, null, data.map(function (item) {
|
|
@@ -69,17 +66,17 @@ export default function ExtraFooter(_ref) {
|
|
|
69
66
|
}, /*#__PURE__*/React.createElement("span", {
|
|
70
67
|
className: classnames("cw-presetRange-more", quickMoreItemClassName),
|
|
71
68
|
style: quickMoreItemStyle
|
|
72
|
-
},
|
|
69
|
+
}, intl.get("a30db643-5238-42bc-bc5e-98a9d0c7df51").d("更多"))))) : null, showOperation ? /*#__PURE__*/React.createElement("div", {
|
|
73
70
|
className: "cw-rangePicker-operation"
|
|
74
71
|
}, /*#__PURE__*/React.createElement(_Button, {
|
|
75
72
|
className: "cw-operation-cancel",
|
|
76
73
|
onClick: onCancel,
|
|
77
74
|
size: "small"
|
|
78
|
-
},
|
|
75
|
+
}, intl.get("04a57125-d7d3-4559-9e88-cf91124095a4").d("取消")), /*#__PURE__*/React.createElement(_Button, {
|
|
79
76
|
type: "primary",
|
|
80
77
|
className: "cw-operation-confirm",
|
|
81
78
|
size: "small",
|
|
82
79
|
disabled: disabledConfirm,
|
|
83
80
|
onClick: disabledConfirm ? function () {} : onOk
|
|
84
|
-
},
|
|
81
|
+
}, intl.get("4253417c-d699-4eed-8c75-34d2a8b18a68").d("确定"))) : null);
|
|
85
82
|
}
|