@chaoswise/ui 2.3.17 → 2.4.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/index.js +8 -3
- package/lib/BasicLayout/locale/index.js +9 -4
- package/lib/BasicLayout/locale/zh_TW.js +4 -0
- package/lib/CWCascader/Cascader/index.js +1 -2
- package/lib/CWCascader/rc-cascader/OptionList/Checkbox.js +1 -2
- package/lib/CWCascader/rc-cascader/OptionList/Column.js +1 -2
- package/lib/CWCascader/rc-cascader/OptionList/index.js +3 -3
- package/lib/CWCascader/rc-cascader/hooks/useSearchOptions.js +1 -2
- package/lib/CWMessage/MessageContent/TabList/index.js +6 -15
- package/lib/CWMessage/MessageContent/index.js +13 -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/antd-select.js +1 -2
- 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/index.less +5 -0
- 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/Upload.js +4 -6
- package/lib/CWUpload/upload/UploadList.js +15 -18
- package/lib/Checkbox/Checkbox.js +1 -2
- 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 +14 -7
- 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/DragList.js +33 -37
- package/lib/FilterDropDown/assets/DragSvg.js +33 -0
- package/lib/FilterDropDown/index.js +21 -15
- package/lib/FilterDropDown/index.less +8 -0
- 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/Input/InputComponent.js +1 -2
- 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/Radio/Group.js +1 -2
- package/lib/Radio/Radio.js +1 -2
- 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/SingleSpa/singleSpa/single-spa.dev.js +1 -2
- package/lib/TreeList/index.js +1 -2
- 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/Watermark/index.js +0 -2
- package/lib/message/index.js +2 -3
- package/lib/utils/index.js +11 -0
- package/package.json +2 -2
- package/lib/FilterDropDown/drag.svg +0 -17
- package/lib/QuickTransfer/CheckList.js +0 -54
- package/lib/QuickTransfer/TopicList.js +0 -153
|
@@ -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
|
};
|
package/lib/Exception/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _useLocale2 from "@chaoswise/ui/lib/useLocale";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
|
-
import
|
|
5
|
+
import langConfig from './locale';
|
|
6
|
+
import { formatMessage } from "../utils";
|
|
6
7
|
import ErrorImg from "./images/error.svg";
|
|
7
8
|
import "./index.less";
|
|
8
9
|
/**
|
|
@@ -18,30 +19,28 @@ function Exception(_ref) {
|
|
|
18
19
|
children = _ref.children,
|
|
19
20
|
errorTitle = _ref.errorTitle,
|
|
20
21
|
errorText = _ref.errorText;
|
|
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
|
var ExceptionType = {
|
|
26
25
|
403: {
|
|
27
26
|
title: "403",
|
|
28
|
-
text: localeObj["403"]
|
|
27
|
+
text: formatMessage(localeObj["403"])
|
|
29
28
|
},
|
|
30
29
|
404: {
|
|
31
30
|
title: "404",
|
|
32
|
-
text:
|
|
31
|
+
text: formatMessage(localeObj["404"])
|
|
33
32
|
},
|
|
34
33
|
500: {
|
|
35
34
|
title: "500",
|
|
36
|
-
text:
|
|
35
|
+
text: formatMessage(localeObj["500"])
|
|
37
36
|
},
|
|
38
37
|
loadFail: {
|
|
39
|
-
title:
|
|
40
|
-
text:
|
|
38
|
+
title: formatMessage(localeObj["loadFailTitle"]),
|
|
39
|
+
text: formatMessage(localeObj["loadFail"])
|
|
41
40
|
},
|
|
42
41
|
incompatible: {
|
|
43
|
-
title:
|
|
44
|
-
text:
|
|
42
|
+
title: formatMessage(localeObj["incompatibleTitle"]),
|
|
43
|
+
text: formatMessage(localeObj["incompatible"])
|
|
45
44
|
}
|
|
46
45
|
};
|
|
47
46
|
var currentException = ExceptionType[type] ? ExceptionType[type] : ExceptionType["500"];
|
|
@@ -3,5 +3,7 @@ export default {
|
|
|
3
3
|
404: 'The page is lost and the platform is retrieving it',
|
|
4
4
|
500: 'The server can‘t keep up. The platform is under urgent repair',
|
|
5
5
|
loadFail: 'Something went wrong. The platform is under urgent repair',
|
|
6
|
-
incompatible: 'The browser version is too early. We recommended that upgrade the browser to avoid potential security risks'
|
|
6
|
+
incompatible: 'The browser version is too early. We recommended that upgrade the browser to avoid potential security risks',
|
|
7
|
+
loadFailTitle: "Load failed",
|
|
8
|
+
incompatibleTitle: "Browser incompatible"
|
|
7
9
|
};
|
|
@@ -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,8 +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); }
|
|
1
2
|
import "@chaoswise/ui/lib/Checkbox/index.less";
|
|
2
3
|
import _Checkbox from "@chaoswise/ui/lib/Checkbox";
|
|
3
4
|
import "@chaoswise/ui/lib/Tooltip/index.less";
|
|
4
5
|
import _Tooltip from "@chaoswise/ui/lib/Tooltip";
|
|
5
6
|
import _Icon from "@chaoswise/ui/lib/Antd/Icon";
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
6
10
|
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); }
|
|
7
11
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
12
|
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."); }
|
|
@@ -10,16 +14,19 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
14
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
15
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import React, { useRef
|
|
14
|
-
import { useDrag, useDrop } from
|
|
17
|
+
import React, { useRef } from "react";
|
|
18
|
+
import { useDrag, useDrop } from "react-dnd";
|
|
19
|
+
import DragSvg from "./assets/DragSvg";
|
|
20
|
+
import classnames from "classnames";
|
|
15
21
|
function DragList(_ref) {
|
|
16
22
|
var option = _ref.option,
|
|
17
23
|
index = _ref.index,
|
|
18
|
-
moveList = _ref.moveList
|
|
24
|
+
moveList = _ref.moveList,
|
|
25
|
+
isHoverSwitching = _ref.isHoverSwitching;
|
|
19
26
|
var dragRef = useRef(null);
|
|
20
27
|
var _useDrag = useDrag({
|
|
21
28
|
item: {
|
|
22
|
-
type:
|
|
29
|
+
type: "child",
|
|
23
30
|
option: option,
|
|
24
31
|
index: index
|
|
25
32
|
}
|
|
@@ -27,8 +34,9 @@ function DragList(_ref) {
|
|
|
27
34
|
_useDrag2 = _slicedToArray(_useDrag, 2),
|
|
28
35
|
drag = _useDrag2[1];
|
|
29
36
|
var _useDrop = useDrop({
|
|
30
|
-
accept:
|
|
37
|
+
accept: "child",
|
|
31
38
|
hover: function hover(item, monitor) {
|
|
39
|
+
if (!isHoverSwitching) return;
|
|
32
40
|
//拖拽目标的Index
|
|
33
41
|
var dragIndex = item.index;
|
|
34
42
|
//放置目标Index
|
|
@@ -56,41 +64,29 @@ function DragList(_ref) {
|
|
|
56
64
|
}
|
|
57
65
|
moveList(dragIndex, hoverIndex); //调用方法完成交换
|
|
58
66
|
item.index = hoverIndex; //重新赋值index,否则会出现无限交换情况
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
collect: function collect(monitor) {
|
|
70
|
+
var _ref2 = monitor.getItem() || {},
|
|
71
|
+
dragIndex = _ref2.index;
|
|
72
|
+
if (dragIndex === index) {
|
|
73
|
+
return {};
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
isOver: monitor.isOver(),
|
|
77
|
+
dropClassName: dragIndex < index ? "drop-over-downward" : "drop-over-upward"
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
drop: function drop(item) {
|
|
81
|
+
if (isHoverSwitching) return;
|
|
82
|
+
moveList(item.index, index);
|
|
59
83
|
}
|
|
60
84
|
}),
|
|
61
85
|
_useDrop2 = _slicedToArray(_useDrop, 2),
|
|
86
|
+
_useDrop2$ = _useDrop2[0],
|
|
87
|
+
isOver = _useDrop2$.isOver,
|
|
88
|
+
dropClassName = _useDrop2$.dropClassName,
|
|
62
89
|
drop = _useDrop2[1];
|
|
63
|
-
var DragSvg = function DragSvg() {
|
|
64
|
-
return /*#__PURE__*/React.createElement("svg", {
|
|
65
|
-
width: "7px",
|
|
66
|
-
height: "12px",
|
|
67
|
-
viewBox: "0 0 7 12",
|
|
68
|
-
version: "1.1",
|
|
69
|
-
fill: "currentColor"
|
|
70
|
-
}, /*#__PURE__*/React.createElement("title", null, "\u5F62\u72B6"), /*#__PURE__*/React.createElement("g", {
|
|
71
|
-
id: "\u9875\u9762-1",
|
|
72
|
-
stroke: "none",
|
|
73
|
-
strokeWidth: "1"
|
|
74
|
-
}, /*#__PURE__*/React.createElement("g", {
|
|
75
|
-
id: "4.2\u8BF7\u6C42\u5217\u8868\u4E0B\u94BB-\u2014\u5FEB\u7167\u8BF7\u6C42\u5217\u8868\u9875",
|
|
76
|
-
transform: "translate(-1368.000000, -705.000000)"
|
|
77
|
-
}, /*#__PURE__*/React.createElement("g", {
|
|
78
|
-
id: "\u7F16\u7EC4-11",
|
|
79
|
-
transform: "translate(232.000000, 554.000000)"
|
|
80
|
-
}, /*#__PURE__*/React.createElement("g", {
|
|
81
|
-
id: "\u9ED8\u8BA4",
|
|
82
|
-
transform: "translate(857.000000, 10.000000)"
|
|
83
|
-
}, /*#__PURE__*/React.createElement("g", {
|
|
84
|
-
id: "\u6E90\u5217\u8868",
|
|
85
|
-
transform: "translate(143.000000, 34.000000)"
|
|
86
|
-
}, /*#__PURE__*/React.createElement("g", {
|
|
87
|
-
id: "\u62D6\u62FD\u5907\u4EFD-3",
|
|
88
|
-
transform: "translate(132.000000, 105.000000)"
|
|
89
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
90
|
-
d: "M9.91111111,2 C9.37777778,2 8.97777778,2.4 8.97777778,2.93333333 C8.97777778,3.46666666 9.42222222,3.86666667 9.91111111,3.86666667 C10.4444444,3.86666667 10.8444444,3.46666667 10.8444444,2.93333333 C10.8888889,2.4 10.4444444,2 9.91111111,2 Z M9.91111111,6.71111111 C9.37777778,6.71111111 8.97777778,7.11111111 8.97777778,7.64444444 C8.97777778,8.17777777 9.42222222,8.57777778 9.91111111,8.57777778 C10.4444444,8.57777778 10.8444444,8.17777778 10.8444444,7.64444444 C10.8888889,7.11111111 10.4444444,6.71111111 9.91111111,6.71111111 Z M9.91111111,11.4222222 C9.37777778,11.4222222 8.97777778,11.8222222 8.97777778,12.3555556 C8.97777778,12.8888889 9.42222222,13.2888889 9.91111111,13.2888889 C10.4444444,13.2888889 10.8444444,12.8888889 10.8444444,12.3555556 C10.8888889,11.8222222 10.4444444,11.4222222 9.91111111,11.4222222 C9.42222222,11.4222222 9.91111111,11.4222222 9.91111111,11.4222222 Z M5.82222222,2 C5.33333333,2 4.88888889,2.4 4.88888889,2.93333333 C4.88888889,3.46666666 5.33333333,3.86666667 5.82222222,3.86666667 C6.35555555,3.86666667 6.75555555,3.46666667 6.75555556,2.93333333 C6.8,2.4 6.35555556,2 5.82222222,2 Z M5.82222222,6.71111111 C5.28888889,6.71111111 4.88888889,7.11111111 4.88888889,7.64444444 C4.88888889,8.17777777 5.33333333,8.57777778 5.82222222,8.57777778 C6.35555555,8.57777778 6.75555555,8.17777778 6.75555556,7.64444444 C6.8,7.11111111 6.35555556,6.71111111 5.82222222,6.71111111 Z M5.82222222,11.4222222 C5.28888889,11.4222222 4.88888889,11.8222222 4.88888889,12.3555556 C4.88888889,12.8888889 5.33333333,13.2888889 5.82222222,13.2888889 C6.35555555,13.2888889 6.75555555,12.8888889 6.75555556,12.3555556 C6.8,11.8222222 6.35555556,11.4222222 5.82222222,11.4222222 Z",
|
|
91
|
-
id: "\u5F62\u72B6"
|
|
92
|
-
}))))))));
|
|
93
|
-
};
|
|
94
90
|
var DragIcon = function DragIcon(props) {
|
|
95
91
|
return /*#__PURE__*/React.createElement(_Icon, _extends({
|
|
96
92
|
component: DragSvg
|
|
@@ -99,7 +95,7 @@ function DragList(_ref) {
|
|
|
99
95
|
return /*#__PURE__*/React.createElement("div", {
|
|
100
96
|
key: option.id,
|
|
101
97
|
ref: drag(drop(dragRef)),
|
|
102
|
-
className: "cw-checkbox-container"
|
|
98
|
+
className: classnames("cw-checkbox-container", _defineProperty({}, dropClassName, isOver && !isHoverSwitching))
|
|
103
99
|
}, /*#__PURE__*/React.createElement(_Checkbox, {
|
|
104
100
|
value: option.id,
|
|
105
101
|
className: "cw-checkbox-ellipsis",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
var DragSvg = function DragSvg() {
|
|
3
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
4
|
+
width: "7px",
|
|
5
|
+
height: "12px",
|
|
6
|
+
viewBox: "0 0 7 12",
|
|
7
|
+
version: "1.1",
|
|
8
|
+
fill: "currentColor"
|
|
9
|
+
}, /*#__PURE__*/React.createElement("title", null, "\u5F62\u72B6"), /*#__PURE__*/React.createElement("g", {
|
|
10
|
+
id: "\u9875\u9762-1",
|
|
11
|
+
stroke: "none",
|
|
12
|
+
strokeWidth: "1"
|
|
13
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
14
|
+
id: "4.2\u8BF7\u6C42\u5217\u8868\u4E0B\u94BB-\u2014\u5FEB\u7167\u8BF7\u6C42\u5217\u8868\u9875",
|
|
15
|
+
transform: "translate(-1368.000000, -705.000000)"
|
|
16
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
17
|
+
id: "\u7F16\u7EC4-11",
|
|
18
|
+
transform: "translate(232.000000, 554.000000)"
|
|
19
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
20
|
+
id: "\u9ED8\u8BA4",
|
|
21
|
+
transform: "translate(857.000000, 10.000000)"
|
|
22
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
23
|
+
id: "\u6E90\u5217\u8868",
|
|
24
|
+
transform: "translate(143.000000, 34.000000)"
|
|
25
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
26
|
+
id: "\u62D6\u62FD\u5907\u4EFD-3",
|
|
27
|
+
transform: "translate(132.000000, 105.000000)"
|
|
28
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
29
|
+
d: "M9.91111111,2 C9.37777778,2 8.97777778,2.4 8.97777778,2.93333333 C8.97777778,3.46666666 9.42222222,3.86666667 9.91111111,3.86666667 C10.4444444,3.86666667 10.8444444,3.46666667 10.8444444,2.93333333 C10.8888889,2.4 10.4444444,2 9.91111111,2 Z M9.91111111,6.71111111 C9.37777778,6.71111111 8.97777778,7.11111111 8.97777778,7.64444444 C8.97777778,8.17777777 9.42222222,8.57777778 9.91111111,8.57777778 C10.4444444,8.57777778 10.8444444,8.17777778 10.8444444,7.64444444 C10.8888889,7.11111111 10.4444444,6.71111111 9.91111111,6.71111111 Z M9.91111111,11.4222222 C9.37777778,11.4222222 8.97777778,11.8222222 8.97777778,12.3555556 C8.97777778,12.8888889 9.42222222,13.2888889 9.91111111,13.2888889 C10.4444444,13.2888889 10.8444444,12.8888889 10.8444444,12.3555556 C10.8888889,11.8222222 10.4444444,11.4222222 9.91111111,11.4222222 C9.42222222,11.4222222 9.91111111,11.4222222 9.91111111,11.4222222 Z M5.82222222,2 C5.33333333,2 4.88888889,2.4 4.88888889,2.93333333 C4.88888889,3.46666666 5.33333333,3.86666667 5.82222222,3.86666667 C6.35555555,3.86666667 6.75555555,3.46666667 6.75555556,2.93333333 C6.8,2.4 6.35555556,2 5.82222222,2 Z M5.82222222,6.71111111 C5.28888889,6.71111111 4.88888889,7.11111111 4.88888889,7.64444444 C4.88888889,8.17777777 5.33333333,8.57777778 5.82222222,8.57777778 C6.35555555,8.57777778 6.75555555,8.17777778 6.75555556,7.64444444 C6.8,7.11111111 6.35555556,6.71111111 5.82222222,6.71111111 Z M5.82222222,11.4222222 C5.28888889,11.4222222 4.88888889,11.8222222 4.88888889,12.3555556 C4.88888889,12.8888889 5.33333333,13.2888889 5.82222222,13.2888889 C6.35555555,13.2888889 6.75555555,12.8888889 6.75555556,12.3555556 C6.8,11.8222222 6.35555556,11.4222222 5.82222222,11.4222222 Z",
|
|
30
|
+
id: "\u5F62\u72B6"
|
|
31
|
+
}))))))));
|
|
32
|
+
};
|
|
33
|
+
export default DragSvg;
|
|
@@ -3,7 +3,7 @@ import _Button from "@chaoswise/ui/lib/Button";
|
|
|
3
3
|
import _Row from "@chaoswise/ui/lib/Antd/Row";
|
|
4
4
|
import "@chaoswise/ui/lib/Tooltip/index.less";
|
|
5
5
|
import _Tooltip from "@chaoswise/ui/lib/Tooltip";
|
|
6
|
-
import
|
|
6
|
+
import _useLocale2 from "@chaoswise/ui/lib/useLocale";
|
|
7
7
|
import "@chaoswise/ui/lib/Checkbox/index.less";
|
|
8
8
|
import _Checkbox from "@chaoswise/ui/lib/Checkbox";
|
|
9
9
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
@@ -22,9 +22,10 @@ import classnames from "classnames";
|
|
|
22
22
|
import PropTypes from "prop-types";
|
|
23
23
|
import { HTML5Backend } from "react-dnd-html5-backend";
|
|
24
24
|
import { DndProvider } from "react-dnd";
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
25
|
+
import useConfigContext from "../useConfigContext";
|
|
26
|
+
import ShowSvgIcon from "./assets/ShowSvgIcon";
|
|
27
|
+
import langConfig from './locale';
|
|
28
|
+
import { formatMessage } from "../utils";
|
|
28
29
|
import "./index.less";
|
|
29
30
|
var CheckboxGroup = _Checkbox.Group;
|
|
30
31
|
function FilterDropDown(props) {
|
|
@@ -45,7 +46,9 @@ function FilterDropDown(props) {
|
|
|
45
46
|
dropdownClassName = props.dropdownClassName,
|
|
46
47
|
_props$isShowSelectAl = props.isShowSelectAll,
|
|
47
48
|
isShowSelectAll = _props$isShowSelectAl === void 0 ? true : _props$isShowSelectAl,
|
|
48
|
-
fixed = props.fixed
|
|
49
|
+
fixed = props.fixed,
|
|
50
|
+
_props$isHoverSwitchi = props.isHoverSwitching,
|
|
51
|
+
isHoverSwitching = _props$isHoverSwitchi === void 0 ? true : _props$isHoverSwitchi;
|
|
49
52
|
var addRef = useRef(null);
|
|
50
53
|
var _useState = useState({
|
|
51
54
|
x: 0,
|
|
@@ -66,10 +69,8 @@ function FilterDropDown(props) {
|
|
|
66
69
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
67
70
|
filterOptions = _useState8[0],
|
|
68
71
|
setFilterOptions = _useState8[1];
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
locale = _ConfigProvider$useLo2 === void 0 ? "zh" : _ConfigProvider$useLo2;
|
|
72
|
-
var localeObj = getLocale(locale);
|
|
72
|
+
var _useLocale = _useLocale2(langConfig),
|
|
73
|
+
localeObj = _useLocale.langObj;
|
|
73
74
|
var _useConfigContext = useConfigContext(),
|
|
74
75
|
getPrefixCls = _useConfigContext.getPrefixCls;
|
|
75
76
|
var prefixCls = getPrefixCls();
|
|
@@ -137,7 +138,8 @@ function FilterDropDown(props) {
|
|
|
137
138
|
option: option,
|
|
138
139
|
index: index,
|
|
139
140
|
moveList: moveList,
|
|
140
|
-
checkedList: _checkedList
|
|
141
|
+
checkedList: _checkedList,
|
|
142
|
+
isHoverSwitching: isHoverSwitching
|
|
141
143
|
}));
|
|
142
144
|
} else {
|
|
143
145
|
checkOptions.push( /*#__PURE__*/React.createElement("div", {
|
|
@@ -175,11 +177,11 @@ function FilterDropDown(props) {
|
|
|
175
177
|
var renderDropdown = function renderDropdown() {
|
|
176
178
|
var style = {};
|
|
177
179
|
if (fixed) {
|
|
178
|
-
style.position =
|
|
180
|
+
style.position = "fixed";
|
|
179
181
|
style.top = XY.y;
|
|
180
182
|
style.lef = XY.x;
|
|
181
|
-
style.right =
|
|
182
|
-
style.bottom =
|
|
183
|
+
style.right = "initial";
|
|
184
|
+
style.bottom = "initial";
|
|
183
185
|
}
|
|
184
186
|
return /*#__PURE__*/React.createElement("div", {
|
|
185
187
|
className: classnames("cw-dropdown-content", dropdownClassName),
|
|
@@ -192,7 +194,7 @@ function FilterDropDown(props) {
|
|
|
192
194
|
className: "cw-dropdown-select-all",
|
|
193
195
|
indeterminate: _checkedList.length !== filterOptions.length && !!_checkedList.length,
|
|
194
196
|
checked: _checkedList.length === filterOptions.length
|
|
195
|
-
}, localeObj["selectAll"], "(", _checkedList.length, "/", filterOptions.length, ")"), /*#__PURE__*/React.createElement(CheckboxGroup, {
|
|
197
|
+
}, formatMessage(localeObj["selectAll"]), "(", _checkedList.length, "/", filterOptions.length, ")"), /*#__PURE__*/React.createElement(CheckboxGroup, {
|
|
196
198
|
value: _checkedList,
|
|
197
199
|
onChange: onChange
|
|
198
200
|
}, /*#__PURE__*/React.createElement(_Row, null, setCheckOptions())));
|
|
@@ -258,6 +260,10 @@ FilterDropDown.propTypes = {
|
|
|
258
260
|
/**
|
|
259
261
|
* 是否fixed定位
|
|
260
262
|
*/
|
|
261
|
-
fixed: PropTypes.bool
|
|
263
|
+
fixed: PropTypes.bool,
|
|
264
|
+
/**
|
|
265
|
+
* 开启拖拽后的交互模式,默认为true(true为悬停即交换,false为鼠标松开再交换)
|
|
266
|
+
*/
|
|
267
|
+
isHoverSwitching: PropTypes.bool
|
|
262
268
|
};
|
|
263
269
|
export default FilterDropDown;
|
|
@@ -31,6 +31,14 @@
|
|
|
31
31
|
padding: 6px 10px;
|
|
32
32
|
align-items: center;
|
|
33
33
|
cursor: move;
|
|
34
|
+
&.drop-over-downward{
|
|
35
|
+
border-bottom: @border-width-base dashed @primary-color;
|
|
36
|
+
padding-bottom: 5px;
|
|
37
|
+
}
|
|
38
|
+
&.drop-over-upward{
|
|
39
|
+
border-top: @border-width-base dashed @primary-color;
|
|
40
|
+
padding-top: 5px;
|
|
41
|
+
}
|
|
34
42
|
&:hover{
|
|
35
43
|
background-color: @primary-1;
|
|
36
44
|
}
|
|
@@ -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
|
};
|