@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.
Files changed (120) hide show
  1. package/lib/BasicLayout/index.js +8 -3
  2. package/lib/BasicLayout/locale/index.js +9 -4
  3. package/lib/BasicLayout/locale/zh_TW.js +4 -0
  4. package/lib/CWCascader/Cascader/index.js +1 -2
  5. package/lib/CWCascader/rc-cascader/OptionList/Checkbox.js +1 -2
  6. package/lib/CWCascader/rc-cascader/OptionList/Column.js +1 -2
  7. package/lib/CWCascader/rc-cascader/OptionList/index.js +3 -3
  8. package/lib/CWCascader/rc-cascader/hooks/useSearchOptions.js +1 -2
  9. package/lib/CWMessage/MessageContent/TabList/index.js +6 -15
  10. package/lib/CWMessage/MessageContent/index.js +13 -9
  11. package/lib/CWMessage/locale/en_US.js +4 -1
  12. package/lib/CWMessage/locale/index.js +10 -11
  13. package/lib/CWMessage/locale/zh_CN.js +4 -1
  14. package/lib/CWMessage/locale/zh_TW.js +6 -0
  15. package/lib/CWRangePicker/DropdownMenu/MoreHistoryList/index.js +7 -8
  16. package/lib/CWRangePicker/DropdownMenu/MoreTimeList/index.js +6 -15
  17. package/lib/CWRangePicker/DropdownMenu/index.js +10 -9
  18. package/lib/CWRangePicker/Refresh/index.js +7 -8
  19. package/lib/CWRangePicker/TimeSpan/index.js +10 -17
  20. package/lib/CWRangePicker/index.js +26 -16
  21. package/lib/CWRangePicker/locale/en_US.js +2 -9
  22. package/lib/CWRangePicker/locale/index.js +10 -11
  23. package/lib/CWRangePicker/locale/zh_CN.js +2 -9
  24. package/lib/CWRangePicker/locale/zh_TW.js +29 -0
  25. package/lib/CWRangePicker/utils/index.js +7 -4
  26. package/lib/CWSelect/antd-select.js +1 -2
  27. package/lib/CWSelect/index.js +7 -9
  28. package/lib/CWSelect/locale/index.js +10 -11
  29. package/lib/CWSelect/locale/zh_TW.js +4 -0
  30. package/lib/CWTable/EditLine.js +8 -9
  31. package/lib/CWTable/Filter.js +6 -7
  32. package/lib/CWTable/locale/index.js +10 -11
  33. package/lib/CWTable/locale/zh_TW.js +6 -0
  34. package/lib/CWTree/index.js +6 -7
  35. package/lib/CWTree/index.less +5 -0
  36. package/lib/CWTree/locale/index.js +10 -11
  37. package/lib/CWTree/locale/zh_TW.js +3 -0
  38. package/lib/CWUpload/locale/en_US.js +0 -8
  39. package/lib/CWUpload/locale/index.js +10 -11
  40. package/lib/CWUpload/locale/zh_TW.js +6 -0
  41. package/lib/CWUpload/upload/Dragger.js +6 -7
  42. package/lib/CWUpload/upload/Upload.js +4 -6
  43. package/lib/CWUpload/upload/UploadList.js +15 -18
  44. package/lib/Checkbox/Checkbox.js +1 -2
  45. package/lib/ColorPicker/index.js +7 -10
  46. package/lib/ColorPicker/locale/index.js +10 -11
  47. package/lib/ColorPicker/locale/zh_TW.js +4 -0
  48. package/lib/ConfigProvider/ConfigProvider.js +14 -7
  49. package/lib/ConfigProvider/Switch.js +29 -11
  50. package/lib/DateRangePicker/components/ExtraQuickFooter.js +24 -20
  51. package/lib/DateRangePicker/locale/index.js +10 -11
  52. package/lib/DateRangePicker/locale/zh_TW.js +5 -0
  53. package/lib/DropdownDatePicker/DropdownMenu/MoreTimeList/index.js +6 -7
  54. package/lib/DropdownDatePicker/DropdownMenu/index.js +7 -8
  55. package/lib/DropdownDatePicker/index.js +8 -7
  56. package/lib/DropdownDatePicker/locale/index.js +10 -11
  57. package/lib/DropdownDatePicker/locale/zh_TW.js +21 -0
  58. package/lib/DropdownDatePicker/utils/index.js +4 -2
  59. package/lib/Empty/index.js +6 -7
  60. package/lib/Empty/locale/index.js +10 -11
  61. package/lib/Empty/locale/zh_TW.js +3 -0
  62. package/lib/Exception/index.js +12 -13
  63. package/lib/Exception/locale/en_US.js +3 -1
  64. package/lib/Exception/locale/index.js +10 -11
  65. package/lib/Exception/locale/zh_CN.js +3 -1
  66. package/lib/Exception/locale/zh_TW.js +9 -0
  67. package/lib/FilterDropDown/DragList.js +33 -37
  68. package/lib/FilterDropDown/assets/DragSvg.js +33 -0
  69. package/lib/FilterDropDown/index.js +21 -15
  70. package/lib/FilterDropDown/index.less +8 -0
  71. package/lib/FilterDropDown/locale/index.js +10 -11
  72. package/lib/FilterDropDown/locale/zh_TW.js +3 -0
  73. package/lib/Header/UserSetting/index.js +14 -2
  74. package/lib/IconSelect/components/CustomImg/index.js +11 -12
  75. package/lib/IconSelect/components/SearchIcon/index.js +10 -8
  76. package/lib/IconSelect/index.js +7 -8
  77. package/lib/IconSelect/locale/index.js +10 -11
  78. package/lib/IconSelect/locale/zh_TW.js +11 -0
  79. package/lib/Input/InputComponent.js +1 -2
  80. package/lib/Joyride/List.js +8 -9
  81. package/lib/Joyride/index.js +21 -22
  82. package/lib/Joyride/locale/index.js +10 -11
  83. package/lib/Joyride/locale/zh_TW.js +25 -0
  84. package/lib/Pagination/index.js +21 -18
  85. package/lib/Pagination/locale/en_US.js +4 -10
  86. package/lib/Pagination/locale/index.js +10 -11
  87. package/lib/Pagination/locale/zh_CN.js +6 -13
  88. package/lib/Pagination/locale/zh_TW.js +8 -0
  89. package/lib/Progress/index.js +6 -15
  90. package/lib/Progress/locale/en_US.js +1 -1
  91. package/lib/Progress/locale/index.js +10 -11
  92. package/lib/Progress/locale/zh_CN.js +1 -1
  93. package/lib/Progress/locale/zh_TW.js +3 -0
  94. package/lib/QuickTransfer/DragList.js +6 -7
  95. package/lib/QuickTransfer/index.js +9 -10
  96. package/lib/QuickTransfer/locale/index.js +10 -11
  97. package/lib/QuickTransfer/locale/zh_TW.js +8 -0
  98. package/lib/Radio/Group.js +1 -2
  99. package/lib/Radio/Radio.js +1 -2
  100. package/lib/RangePicker/components/ExtraTimeFooter.js +6 -13
  101. package/lib/RangePicker/locale/index.js +10 -11
  102. package/lib/RangePicker/locale/zh_TW.js +5 -0
  103. package/lib/SearchBar/index.js +9 -10
  104. package/lib/SearchBar/locale/index.js +10 -11
  105. package/lib/SearchBar/locale/zh_CN.js +0 -8
  106. package/lib/SearchBar/locale/zh_TW.js +6 -0
  107. package/lib/SingleSpa/singleSpa/single-spa.dev.js +1 -2
  108. package/lib/TreeList/index.js +1 -2
  109. package/lib/TreeSelect111/index.js +6 -15
  110. package/lib/TreeSelect111/locale/index.js +10 -11
  111. package/lib/TreeSelect111/locale/zh_TW.js +3 -0
  112. package/lib/WangEditor/index.js +13 -7
  113. package/lib/WangEditor/locale/index.js +60 -29
  114. package/lib/Watermark/index.js +0 -2
  115. package/lib/message/index.js +2 -3
  116. package/lib/utils/index.js +11 -0
  117. package/package.json +2 -2
  118. package/lib/FilterDropDown/drag.svg +0 -17
  119. package/lib/QuickTransfer/CheckList.js +0 -54
  120. 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 _ConfigProvider from "@chaoswise/ui/lib/ConfigProvider";
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 _ConfigProvider$useLo = _ConfigProvider.useLocale(),
57
- _ConfigProvider$useLo2 = _ConfigProvider$useLo.locale,
58
- locale = _ConfigProvider$useLo2 === void 0 ? "zh" : _ConfigProvider$useLo2;
59
- var localeObj = getLocale(locale);
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.recover
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 zhCN from './zh_CN.js';
2
- import enUS from './en_US.js';
3
- export var getLocale = function getLocale(locale) {
4
- switch (locale) {
5
- case 'zh':
6
- return zhCN;
7
- case 'en':
8
- return enUS;
9
- default:
10
- return zhCN;
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
- if (locale == "zh") {
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] : "zh";
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,
@@ -1,4 +1,4 @@
1
- import _ConfigProvider from "@chaoswise/ui/lib/ConfigProvider";
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 _ConfigProvider$useLo = _ConfigProvider.useLocale(),
22
- _ConfigProvider$useLo2 = _ConfigProvider$useLo.locale,
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.nodata), props.children && /*#__PURE__*/React.createElement("div", {
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 zhCN from './zh_CN.js';
2
- import enUS from './en_US.js';
3
- export var getLocale = function getLocale(locale) {
4
- switch (locale) {
5
- case 'zh':
6
- return zhCN;
7
- case 'en':
8
- return enUS;
9
- default:
10
- return zhCN;
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,3 @@
1
+ export default {
2
+ nodata: '暫無數據'
3
+ };
@@ -1,8 +1,9 @@
1
- import _ConfigProvider from "@chaoswise/ui/lib/ConfigProvider";
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 { getLocale } from "./locale";
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 _ConfigProvider$useLo = _ConfigProvider.useLocale(),
22
- _ConfigProvider$useLo2 = _ConfigProvider$useLo.locale,
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: "".concat(localeObj["404"])
31
+ text: formatMessage(localeObj["404"])
33
32
  },
34
33
  500: {
35
34
  title: "500",
36
- text: "".concat(localeObj["500"])
35
+ text: formatMessage(localeObj["500"])
37
36
  },
38
37
  loadFail: {
39
- title: locale == "zh" ? "加载失败" : "Load failed",
40
- text: "".concat(localeObj["loadFail"])
38
+ title: formatMessage(localeObj["loadFailTitle"]),
39
+ text: formatMessage(localeObj["loadFail"])
41
40
  },
42
41
  incompatible: {
43
- title: locale == "zh" ? "浏览器不兼容" : "Browser incompatible",
44
- text: "".concat(localeObj["incompatible"])
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 zhCN from './zh_CN.js';
2
- import enUS from './en_US.js';
3
- export var getLocale = function getLocale(locale) {
4
- switch (locale) {
5
- case 'zh':
6
- return zhCN;
7
- case 'en':
8
- return enUS;
9
- default:
10
- return zhCN;
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
  };
@@ -3,5 +3,7 @@ export default {
3
3
  404: '页面走丢了,平台正在找回页面',
4
4
  500: '服务器无法跟上您的脚步,平台正在紧急抢修',
5
5
  loadFail: '出错了,平台正在紧急抢修',
6
- incompatible: '浏览器版本过低,为避免可能存在的安全隐患,推荐升级一下浏览器'
6
+ incompatible: '浏览器版本过低,为避免可能存在的安全隐患,推荐升级一下浏览器',
7
+ loadFailTitle: "加载失败",
8
+ incompatibleTitle: "浏览器不兼容"
7
9
  };
@@ -0,0 +1,9 @@
1
+ export default {
2
+ 403: '抱歉無權訪問此頁面/內容',
3
+ 404: '頁面走丟了,平臺正在找回頁面',
4
+ 500: '服務器無法跟上您的腳步,平臺正在緊急搶修',
5
+ loadFail: '出錯了,平臺正在緊急搶修',
6
+ incompatible: '瀏覽器版本過低,爲避免可能存在的安全隱患,推薦升級一下瀏覽器',
7
+ loadFailTitle: "加載失敗",
8
+ incompatibleTitle: "瀏覽器不兼容"
9
+ };
@@ -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, useState } from 'react';
14
- import { useDrag, useDrop } from 'react-dnd';
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: 'child',
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: 'child',
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 _ConfigProvider from "@chaoswise/ui/lib/ConfigProvider";
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 { getLocale } from "./locale";
26
- import useConfigContext from '../useConfigContext';
27
- import ShowSvgIcon from './assets/ShowSvgIcon';
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 _ConfigProvider$useLo = _ConfigProvider.useLocale(),
70
- _ConfigProvider$useLo2 = _ConfigProvider$useLo.locale,
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 = 'fixed';
180
+ style.position = "fixed";
179
181
  style.top = XY.y;
180
182
  style.lef = XY.x;
181
- style.right = 'initial';
182
- style.bottom = 'initial';
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 zhCN from './zh_CN.js';
2
- import enUS from './en_US.js';
3
- export var getLocale = function getLocale(locale) {
4
- switch (locale) {
5
- case 'zh':
6
- return zhCN;
7
- case 'en':
8
- return enUS;
9
- default:
10
- return zhCN;
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,3 @@
1
+ export default {
2
+ selectAll: '全選'
3
+ };