@chaoswise/ui 2.3.0 → 2.3.2

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 (53) hide show
  1. package/lib/Button/index.js +0 -8
  2. package/lib/CWCascader/index.js +56 -1
  3. package/lib/CWCascader/index.less +22 -0
  4. package/lib/CWCascader/rc-cascader/Cascader.js +45 -21
  5. package/lib/CWCascader/rc-cascader/OptionList/Column.js +115 -48
  6. package/lib/CWCascader/rc-cascader/OptionList/index.js +11 -5
  7. package/lib/CWCascader/rc-cascader/OptionList/useKeyboard.js +64 -68
  8. package/lib/CWCascader/rc-cascader/hooks/useDisplayValues.js +45 -16
  9. package/lib/CWCascader/rc-cascader/hooks/useEntities.js +0 -8
  10. package/lib/CWCascader/rc-cascader/utils/treeUtil.js +45 -1
  11. package/lib/CWRangePicker/DropdownMenu/MoreTimeList/index.js +0 -1
  12. package/lib/CWRangePicker/DropdownMenu/index.js +5 -32
  13. package/lib/CWRangePicker/DropdownMenu/index.less +11 -7
  14. package/lib/CWRangePicker/Refresh/index.js +32 -16
  15. package/lib/CWRangePicker/TimeSpan/index.js +11 -11
  16. package/lib/CWRangePicker/index.js +105 -64
  17. package/lib/CWRangePicker/locale/en_US.js +2 -1
  18. package/lib/CWRangePicker/locale/zh_CN.js +2 -1
  19. package/lib/CWRangePicker/utils/index.js +10 -4
  20. package/lib/CWSelect/index.js +4 -4
  21. package/lib/CWSelect/index.less +1 -1
  22. package/lib/Cascader/index.less +24 -2
  23. package/lib/DropdownDatePicker/DropdownMenu/MoreTimeList/index.js +46 -0
  24. package/lib/DropdownDatePicker/DropdownMenu/MoreTimeList/index.less +14 -0
  25. package/lib/DropdownDatePicker/DropdownMenu/index.js +126 -0
  26. package/lib/DropdownDatePicker/DropdownMenu/index.less +68 -0
  27. package/lib/DropdownDatePicker/assets/Calendar2.js +15 -0
  28. package/lib/DropdownDatePicker/assets/Recover.js +18 -0
  29. package/lib/DropdownDatePicker/assets/live.js +19 -0
  30. package/lib/DropdownDatePicker/assets/more.js +23 -0
  31. package/lib/DropdownDatePicker/index.js +357 -0
  32. package/lib/DropdownDatePicker/index.less +34 -0
  33. package/lib/DropdownDatePicker/locale/en_US.js +21 -0
  34. package/lib/DropdownDatePicker/locale/index.js +12 -0
  35. package/lib/DropdownDatePicker/locale/zh_CN.js +21 -0
  36. package/lib/DropdownDatePicker/utils/index.js +251 -0
  37. package/lib/InputNumber/index.js +15 -11
  38. package/lib/ModuleFederation/ErrorBoundary/index.js +54 -0
  39. package/lib/ModuleFederation/index.js +10 -0
  40. package/lib/ModuleFederation/react-dynamic-remote-component/RemoteComponent.js +185 -0
  41. package/lib/ModuleFederation/react-dynamic-remote-component/attach-script.js +42 -0
  42. package/lib/ModuleFederation/react-dynamic-remote-component/index.js +1 -0
  43. package/lib/ModuleFederation/react-dynamic-remote-component/load-module.js +44 -0
  44. package/lib/ModuleFederation/react-dynamic-remote-component/loading-script.js +35 -0
  45. package/lib/ModuleFederation/react-dynamic-remote-component/suspend.js +28 -0
  46. package/lib/ModuleFederation/react-dynamic-remote-component/utils.js +7 -0
  47. package/lib/QuickTransfer/locale/index.js +1 -4
  48. package/lib/QuickTransfer/locale/zh_CN.js +0 -8
  49. package/lib/RangePicker/components/ExtraTimeFooter.js +8 -2
  50. package/lib/RangePicker/index.js +5 -0
  51. package/lib/RangePicker/index.less +22 -7
  52. package/lib/SimplePagination/index.js +1 -1
  53. package/package.json +3 -2
@@ -102,74 +102,70 @@ export default (function (ref, options, fieldNames, activeValueCells, setActiveV
102
102
  return {
103
103
  // scrollTo: treeRef.current?.scrollTo,
104
104
  onKeyDown: function onKeyDown(event) {
105
- var which = event.which;
106
- switch (which) {
107
- // >>> Arrow keys
108
- case KeyCode.UP:
109
- case KeyCode.DOWN:
110
- {
111
- var offset = 0;
112
- if (which === KeyCode.UP) {
113
- offset = -1;
114
- } else if (which === KeyCode.DOWN) {
115
- offset = 1;
116
- }
117
- if (offset !== 0) {
118
- offsetActiveOption(offset);
119
- }
120
- break;
121
- }
122
- case KeyCode.LEFT:
123
- {
124
- if (rtl) {
125
- nextColumn();
126
- } else {
127
- prevColumn();
128
- }
129
- break;
130
- }
131
- case KeyCode.RIGHT:
132
- {
133
- if (rtl) {
134
- prevColumn();
135
- } else {
136
- nextColumn();
137
- }
138
- break;
139
- }
140
- case KeyCode.BACKSPACE:
141
- {
142
- if (!searchValue) {
143
- prevColumn();
144
- }
145
- break;
146
- }
147
- // >>> Select
148
- case KeyCode.ENTER:
149
- {
150
- if (validActiveValueCells.length) {
151
- var option = lastActiveOptions[lastActiveIndex];
152
- // Search option should revert back of origin options
153
- var originOptions = (option === null || option === void 0 ? void 0 : option[SEARCH_MARK]) || [];
154
- if (originOptions.length) {
155
- onKeyBoardSelect(originOptions.map(function (opt) {
156
- return opt[fieldNames.value];
157
- }), originOptions[originOptions.length - 1]);
158
- } else {
159
- onKeyBoardSelect(validActiveValueCells, lastActiveOptions[lastActiveIndex]);
160
- }
161
- }
162
- break;
163
- }
164
- // >>> Close
165
- case KeyCode.ESC:
166
- {
167
- toggleOpen(false);
168
- if (open) {
169
- event.stopPropagation();
170
- }
171
- }
172
- }
105
+ // const { which } = event;
106
+ // switch (which) {
107
+ // // >>> Arrow keys
108
+ // case KeyCode.UP:
109
+ // case KeyCode.DOWN: {
110
+ // let offset = 0;
111
+ // if (which === KeyCode.UP) {
112
+ // offset = -1;
113
+ // }
114
+ // else if (which === KeyCode.DOWN) {
115
+ // offset = 1;
116
+ // }
117
+ // if (offset !== 0) {
118
+ // offsetActiveOption(offset);
119
+ // }
120
+ // break;
121
+ // }
122
+ // case KeyCode.LEFT: {
123
+ // if (rtl) {
124
+ // nextColumn();
125
+ // }
126
+ // else {
127
+ // prevColumn();
128
+ // }
129
+ // break;
130
+ // }
131
+ // case KeyCode.RIGHT: {
132
+ // if (rtl) {
133
+ // prevColumn();
134
+ // }
135
+ // else {
136
+ // nextColumn();
137
+ // }
138
+ // break;
139
+ // }
140
+ // case KeyCode.BACKSPACE: {
141
+ // if (!searchValue) {
142
+ // prevColumn();
143
+ // }
144
+ // break;
145
+ // }
146
+ // // >>> Select
147
+ // case KeyCode.ENTER: {
148
+ // if (validActiveValueCells.length) {
149
+ // const option = lastActiveOptions[lastActiveIndex];
150
+ // // Search option should revert back of origin options
151
+ // const originOptions = option?.[SEARCH_MARK] || [];
152
+ // if (originOptions.length) {
153
+ // onKeyBoardSelect(originOptions.map(opt => opt[fieldNames.value]), originOptions[originOptions.length - 1]);
154
+ // }
155
+ // else {
156
+ // onKeyBoardSelect(validActiveValueCells, lastActiveOptions[lastActiveIndex]);
157
+ // }
158
+ // }
159
+ // break;
160
+ // }
161
+ // // >>> Close
162
+ // case KeyCode.ESC: {
163
+ // toggleOpen(false);
164
+ // if (open) {
165
+ // event.stopPropagation();
166
+ // }
167
+ // }
168
+ // }
173
169
  },
174
170
  onKeyUp: function onKeyUp() {}
175
171
  };
@@ -5,18 +5,18 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
5
5
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
6
  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; }
7
7
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
8
- import { toPathOptions } from '../utils/treeUtil';
9
- import * as React from 'react';
10
- import { toPathKey } from '../utils/commonUtil';
11
- export default (function (rawValues, options, fieldNames, multiple, displayRender) {
8
+ import { toPathOptions } from "../utils/treeUtil";
9
+ import * as React from "react";
10
+ import { toPathKey } from "../utils/commonUtil";
11
+ export default (function (rawValues, options, fieldNames, multiple, displayRender, labelInValueOption) {
12
12
  return React.useMemo(function () {
13
13
  var mergedDisplayRender = displayRender ||
14
14
  // Default displayRender
15
15
  function (labels) {
16
16
  var mergedLabels = multiple ? labels.slice(-1) : labels;
17
- var SPLIT = ' / ';
17
+ var SPLIT = " / ";
18
18
  if (mergedLabels.every(function (label) {
19
- return ['string', 'number'].includes(_typeof(label));
19
+ return ["string", "number"].includes(_typeof(label));
20
20
  })) {
21
21
  return mergedLabels.join(SPLIT);
22
22
  }
@@ -34,15 +34,44 @@ export default (function (rawValues, options, fieldNames, multiple, displayRende
34
34
  return rawValues.map(function (valueCells) {
35
35
  var _valueOptions, _valueOptions$option;
36
36
  var valueOptions = toPathOptions(valueCells, options, fieldNames);
37
- var label = mergedDisplayRender(valueOptions.map(function (_ref) {
38
- var _option$fieldNames$la;
39
- var option = _ref.option,
40
- value = _ref.value;
41
- return (_option$fieldNames$la = option === null || option === void 0 ? void 0 : option[fieldNames.label]) !== null && _option$fieldNames$la !== void 0 ? _option$fieldNames$la : value;
42
- }), valueOptions.map(function (_ref2) {
43
- var option = _ref2.option;
44
- return option;
45
- }));
37
+ var isBackEndQuery = false;
38
+ if (valueOptions.length && (valueOptions[valueOptions.length - 1].index === -1 || valueOptions[valueOptions.length - 1].index === undefined)) {
39
+ var findItem = labelInValueOption.find(function (item) {
40
+ return item.value == valueCells;
41
+ });
42
+ if (findItem) {
43
+ isBackEndQuery = true;
44
+ valueOptions[valueOptions.length - 1].option = {
45
+ value: valueOptions[valueOptions.length - 1].value,
46
+ label: findItem.label
47
+ };
48
+ }
49
+ }
50
+ var label;
51
+ if (isBackEndQuery) {
52
+ label = mergedDisplayRender(valueOptions.map(function (_ref) {
53
+ var option = _ref.option,
54
+ value = _ref.value;
55
+ return option === null || option === void 0 ? void 0 : option[fieldNames.label];
56
+ }).filter(Boolean), valueOptions.map(function (_ref2) {
57
+ var option = _ref2.option,
58
+ value = _ref2.value;
59
+ return option !== null && option !== void 0 ? option : {
60
+ label: undefined,
61
+ value: value
62
+ };
63
+ }));
64
+ } else {
65
+ label = mergedDisplayRender(valueOptions.map(function (_ref3) {
66
+ var _option$fieldNames$la;
67
+ var option = _ref3.option,
68
+ value = _ref3.value;
69
+ return (_option$fieldNames$la = option === null || option === void 0 ? void 0 : option[fieldNames.label]) !== null && _option$fieldNames$la !== void 0 ? _option$fieldNames$la : value;
70
+ }), valueOptions.map(function (_ref4) {
71
+ var option = _ref4.option;
72
+ return option;
73
+ }));
74
+ }
46
75
  var value = toPathKey(valueCells);
47
76
  return {
48
77
  label: label,
@@ -52,5 +81,5 @@ export default (function (rawValues, options, fieldNames, multiple, displayRende
52
81
  disabled: (_valueOptions = valueOptions[valueOptions.length - 1]) === null || _valueOptions === void 0 ? void 0 : (_valueOptions$option = _valueOptions.option) === null || _valueOptions$option === void 0 ? void 0 : _valueOptions$option.disabled
53
82
  };
54
83
  });
55
- }, [rawValues, options, fieldNames, displayRender, multiple]);
84
+ }, [rawValues, options, fieldNames, displayRender, multiple, labelInValueOption]);
56
85
  });
@@ -4,14 +4,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  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; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
- /*
8
- * @Author: andrew.qiao andrew.qiao@cloudwise.com
9
- * @Date: 2023-05-30 06:35:28
10
- * @LastEditors: andrew.qiao andrew.qiao@cloudwise.com
11
- * @LastEditTime: 2023-05-30 06:48:47
12
- * @FilePath: /change_01/aops_web_commons/packages/ui/components/Cascaders copy/rc-cascader/hooks/useEntities.js
13
- * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
14
- */
15
7
  import * as React from 'react';
16
8
  import { convertDataToEntities } from 'rc-cascader/node_modules/rc-tree/lib/utils/treeUtil';
17
9
  import { VALUE_SPLIT } from '../utils/commonUtil';
@@ -1,4 +1,4 @@
1
- import { SHOW_CHILD } from './commonUtil';
1
+ import { SHOW_CHILD } from "./commonUtil";
2
2
  export function formatStrategyValues(pathKeys, getKeyPathEntities, showCheckedStrategy) {
3
3
  var valueSet = new Set(pathKeys);
4
4
  var keyPathEntities = getKeyPathEntities();
@@ -13,8 +13,11 @@ export function formatStrategyValues(pathKeys, getKeyPathEntities, showCheckedSt
13
13
  }
14
14
  export function toPathOptions(valueCells, options, fieldNames) {
15
15
  var stringMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
16
+ var labelInValue = arguments.length > 4 ? arguments[4] : undefined;
17
+ var labelInValueOption = arguments.length > 5 ? arguments[5] : undefined;
16
18
  var currentList = options;
17
19
  var valueOptions = [];
20
+ var isHit = true;
18
21
  var _loop = function _loop() {
19
22
  var _currentList, _currentList2, _foundOption$fieldNam;
20
23
  var valueCell = valueCells[i];
@@ -23,6 +26,9 @@ export function toPathOptions(valueCells, options, fieldNames) {
23
26
  return stringMode ? String(val) === String(valueCell) : val === valueCell;
24
27
  });
25
28
  var foundOption = foundIndex !== -1 ? (_currentList2 = currentList) === null || _currentList2 === void 0 ? void 0 : _currentList2[foundIndex] : null;
29
+ if (foundIndex === -1) {
30
+ isHit = false;
31
+ }
26
32
  valueOptions.push({
27
33
  value: (_foundOption$fieldNam = foundOption === null || foundOption === void 0 ? void 0 : foundOption[fieldNames.value]) !== null && _foundOption$fieldNam !== void 0 ? _foundOption$fieldNam : valueCell,
28
34
  index: foundIndex,
@@ -33,5 +39,43 @@ export function toPathOptions(valueCells, options, fieldNames) {
33
39
  for (var i = 0; i < valueCells.length; i += 1) {
34
40
  _loop();
35
41
  }
42
+ if (!isHit && labelInValue) {
43
+ var findOption = labelInValueOption.find(function (item) {
44
+ return item.value === valueCells;
45
+ });
46
+ if (findOption) {
47
+ valueOptions = [{
48
+ option: {
49
+ value: findOption.value,
50
+ label: findOption.label,
51
+ backEndQuery: true
52
+ }
53
+ }];
54
+ }
55
+ }
36
56
  return valueOptions;
57
+ }
58
+ export function toValueAndLabel(valueOptions) {
59
+ var triggerValues = [];
60
+ valueOptions.forEach(function (item) {
61
+ var isBackEndQuery = item.some(function (i) {
62
+ return i.backEndQuery;
63
+ });
64
+ if (isBackEndQuery) {
65
+ triggerValues.push({
66
+ label: item[0].label,
67
+ value: item[0].value
68
+ });
69
+ } else {
70
+ var value = [];
71
+ item.forEach(function (i) {
72
+ value.push(i.value);
73
+ });
74
+ triggerValues.push({
75
+ label: item[item.length - 1].label,
76
+ value: value
77
+ });
78
+ }
79
+ });
80
+ return triggerValues;
37
81
  }
@@ -14,7 +14,6 @@ import _ConfigProvider from "@chaoswise/ui/lib/ConfigProvider";
14
14
  import React from "react";
15
15
  import classnames from "classnames";
16
16
  import { getLocale } from "../../locale";
17
- import _ from "lodash";
18
17
  import "./index.less";
19
18
  var MoreTimeList = function MoreTimeList(props) {
20
19
  var regroupDataSource = props.regroupDataSource,
@@ -32,7 +32,6 @@ import MoreSvg from "../assets/more";
32
32
  import MoreTimeList from "./MoreTimeList";
33
33
  import MoreHistoryList from "./MoreHistoryList";
34
34
  import { judgeType, funcValueChangeArrayValue, getCorrectValue, getHistoryInfo } from "../utils";
35
- import _ from "lodash";
36
35
  import "./index.less";
37
36
  var DropdownMenu = function DropdownMenu(props) {
38
37
  var dataSource = props.dataSource,
@@ -47,9 +46,7 @@ var DropdownMenu = function DropdownMenu(props) {
47
46
  setIsFocus = props.setIsFocus,
48
47
  historyList = props.historyList,
49
48
  setHistoryList = props.setHistoryList,
50
- format = props.format,
51
- setIsAutoRefresh = props.setIsAutoRefresh,
52
- refreshOption = props.refreshOption;
49
+ format = props.format;
53
50
  var _ConfigProvider$useLo = _ConfigProvider.useLocale(),
54
51
  _ConfigProvider$useLo2 = _ConfigProvider$useLo.locale,
55
52
  locale = _ConfigProvider$useLo2 === void 0 ? "zh" : _ConfigProvider$useLo2;
@@ -64,8 +61,6 @@ var DropdownMenu = function DropdownMenu(props) {
64
61
  showDefaultHistoryCount = _menuOption$showDefau2 === void 0 ? 5 : _menuOption$showDefau2,
65
62
  _menuOption$moreHisto = menuOption.moreHistoryDropdownPosition,
66
63
  moreHistoryDropdownPosition = _menuOption$moreHisto === void 0 ? "left" : _menuOption$moreHisto;
67
- var _refreshOption$onAuto = refreshOption.onAutoRefreshChange,
68
- onAutoRefreshChange = _refreshOption$onAuto === void 0 ? function () {} : _refreshOption$onAuto;
69
64
  // 点击Menu.Item中切换选项列表
70
65
  var onClickItem = function onClickItem(item) {
71
66
  var timeDomain = recordDateValue.timeDomain,
@@ -81,17 +76,6 @@ var DropdownMenu = function DropdownMenu(props) {
81
76
  value: funcValueChangeArrayValue(values)
82
77
  });
83
78
  returnValue = getCorrectValue(returnValue, item.key);
84
- var _judgeType = judgeType(returnValue),
85
- _judgeType2 = _slicedToArray(_judgeType, 1),
86
- isRule = _judgeType2[0];
87
- if (!isRule && !returnValue.value) {
88
- setIsAutoRefresh(function (pre) {
89
- if (!pre) {
90
- onAutoRefreshChange(true);
91
- }
92
- return true;
93
- });
94
- }
95
79
  onChange(returnValue);
96
80
  var _getHistoryInfo = getHistoryInfo(returnValue, historyList, locale, format),
97
81
  _getHistoryInfo2 = _slicedToArray(_getHistoryInfo, 2),
@@ -123,17 +107,6 @@ var DropdownMenu = function DropdownMenu(props) {
123
107
  value: funcValueChangeArrayValue(values)
124
108
  });
125
109
  returnValue = getCorrectValue(returnValue, timeDomain);
126
- var _judgeType3 = judgeType(returnValue),
127
- _judgeType4 = _slicedToArray(_judgeType3, 1),
128
- isRule = _judgeType4[0];
129
- if (!isRule && !returnValue.value) {
130
- setIsAutoRefresh(function (pre) {
131
- if (!pre) {
132
- onAutoRefreshChange(true);
133
- }
134
- return true;
135
- });
136
- }
137
110
  onChange(returnValue);
138
111
  if (!_value) {
139
112
  setRecordDateValue(returnValue);
@@ -158,9 +131,9 @@ var DropdownMenu = function DropdownMenu(props) {
158
131
  className: classnames("cw-dropdown-menu-wrapper")
159
132
  }, dataSource === null || dataSource === void 0 ? void 0 : dataSource.slice(0, showDefaultCount).map(function (item) {
160
133
  var values = item.value;
161
- var _judgeType5 = judgeType(item),
162
- _judgeType6 = _slicedToArray(_judgeType5, 1),
163
- isRule = _judgeType6[0];
134
+ var _judgeType = judgeType(item),
135
+ _judgeType2 = _slicedToArray(_judgeType, 1),
136
+ isRule = _judgeType2[0];
164
137
  var isHasDate = true;
165
138
  if (!isRule && !values) {
166
139
  isHasDate = false;
@@ -190,7 +163,7 @@ var DropdownMenu = function DropdownMenu(props) {
190
163
  "cw-dropdown-menu-more-wrapper-left": moreItemDropdownPosition === "left"
191
164
  }),
192
165
  getPopupContainer: function getPopupContainer(triggerNode) {
193
- return triggerNode.parentNode;
166
+ return triggerNode;
194
167
  }
195
168
  }, /*#__PURE__*/React.createElement("div", {
196
169
  className: classnames("cw-dropdown-menu-_item", "cw-dropdown-menu-item-more")
@@ -26,7 +26,7 @@
26
26
  color: @text-color;
27
27
  font-weight: normal;
28
28
  font-size: @dropdown-font-size;
29
- line-height: @dropdown-line-height;
29
+ line-height: 22px; // 整体32px的高度
30
30
 
31
31
  .cw-range-picker-menu-item-calendar {
32
32
  width: 14px;
@@ -46,19 +46,22 @@
46
46
  }
47
47
 
48
48
  .cw-dropdown-menu-item-more {
49
+ position: relative;
49
50
  justify-content: space-between;
50
-
51
+ overflow: visible;
51
52
  }
52
53
 
53
54
 
54
55
  .cw-dropdown-menu-more-wrapper {
55
56
  width: 384px;
56
- top: 0 !important;
57
- left: 362px !important;
57
+ top: auto !important;
58
+ bottom: -32px !important;
59
+ left: calc(100% + 2px) !important;
58
60
  box-shadow: @box-shadow-base;
59
61
 
60
62
  &.cw-dropdown-menu-more-wrapper-left {
61
- left: -386px !important;
63
+ right: calc(100% + 2px) !important;
64
+ left: auto !important;
62
65
  }
63
66
  }
64
67
  .cw-dropdown-menu-history-outer-wrapper{
@@ -102,10 +105,11 @@
102
105
  .cw-dropdown-menu-history-more-wrapper {
103
106
  width: 384px;
104
107
  top: 0 !important;
105
- left: 362px !important;
108
+ left: calc(100% + 2px) !important;
106
109
  box-shadow: @box-shadow-base;
107
110
  &.cw-dropdown-menu-history-more-wrapper-left {
108
- left: -386px !important;
111
+ right: calc(100% + 2px) !important;
112
+ left: auto !important;
109
113
  }
110
114
  }
111
115
  }
@@ -12,6 +12,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
12
12
  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; }
13
13
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
14
14
  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); }
15
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
16
+ 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."); }
17
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
18
+ 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; }
19
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
20
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
21
  /*
16
22
  * @Author: andrew.qiao andrew.qiao@cloudwise.com
17
23
  * @Date: 2022-09-05 09:23:24
@@ -25,7 +31,7 @@ import classnames from "classnames";
25
31
  import Refresh1Svg from "../assets/Refresh1";
26
32
  import Refresh2Svg from "../assets/Refresh2";
27
33
  import Refresh3Svg from "../assets/Refresh3";
28
- import { getUnit, getChangeUnitDate, funcValueChangeArrayValue, getTimeSpanFromValue, computedRecentlyValue } from "../utils";
34
+ import { getChangeUnitDate, funcValueChangeArrayValue, getTimeSpanFromValue, computedRecentlyValue, judgeType } from "../utils";
29
35
  import { getLocale } from "../locale";
30
36
  import "./index.less";
31
37
  var Refresh = /*#__PURE__*/forwardRef(function (props, ref) {
@@ -37,7 +43,9 @@ var Refresh = /*#__PURE__*/forwardRef(function (props, ref) {
37
43
  setIsAutoRefresh = props.setIsAutoRefresh,
38
44
  refreshOption = props.refreshOption,
39
45
  isHasDate = props.isHasDate,
40
- setBackTooltipVisible = props.setBackTooltipVisible;
46
+ setBackTooltipVisible = props.setBackTooltipVisible,
47
+ enableAutoRefresh = props.enableAutoRefresh,
48
+ isClickAutoRefresh = props.isClickAutoRefresh;
41
49
  var _refreshOption$onAuto = refreshOption.onAutoRefreshChange,
42
50
  onAutoRefreshChange = _refreshOption$onAuto === void 0 ? function () {} : _refreshOption$onAuto,
43
51
  _refreshOption$onClic = refreshOption.onClickRefresh,
@@ -56,14 +64,14 @@ var Refresh = /*#__PURE__*/forwardRef(function (props, ref) {
56
64
  var localeObj = getLocale(locale);
57
65
  // 手动刷新
58
66
  var onRefresh = function onRefresh() {
59
- var values = recordDateValue.value,
60
- key = recordDateValue.key;
61
- var _getUnit = getUnit(key),
62
- isRule = _getUnit.isRule,
63
- captureUnit = _getUnit.captureUnit;
67
+ var values = recordDateValue.value;
68
+ var _judgeType = judgeType(recordDateValue),
69
+ _judgeType2 = _slicedToArray(_judgeType, 2),
70
+ isRule = _judgeType2[0],
71
+ captureUnit = _judgeType2[1];
64
72
  var returnValue = _objectSpread({}, recordDateValue);
65
73
  values = funcValueChangeArrayValue(values);
66
- if (isAutoRefresh) {
74
+ if (enableAutoRefresh) {
67
75
  if (values) {
68
76
  returnValue = _objectSpread(_objectSpread({}, returnValue), {}, {
69
77
  value: computedRecentlyValue(values)
@@ -81,24 +89,32 @@ var Refresh = /*#__PURE__*/forwardRef(function (props, ref) {
81
89
  var onAutoRefresh = function onAutoRefresh() {
82
90
  setBackTooltipVisible(false);
83
91
  onClickAutoRefresh(!isAutoRefresh);
92
+ isClickAutoRefresh.current = true;
84
93
  if (isHasDate) {
85
94
  var values = recordDateValue.value,
86
95
  key = recordDateValue.key,
87
96
  rest = _objectWithoutProperties(recordDateValue, _excluded);
88
- var _getUnit2 = getUnit(key),
89
- isRule = _getUnit2.isRule,
90
- captureUnit = _getUnit2.captureUnit;
97
+ var _judgeType3 = judgeType(recordDateValue),
98
+ _judgeType4 = _slicedToArray(_judgeType3, 2),
99
+ isRule = _judgeType4[0],
100
+ captureUnit = _judgeType4[1];
91
101
  values = funcValueChangeArrayValue(values);
92
102
  var finalRecordDateValue = {
93
103
  isRecently: false
94
104
  };
95
- if (!isAutoRefresh) {
105
+ if (!enableAutoRefresh) {
96
106
  if (values) {
97
107
  values = computedRecentlyValue(values);
98
108
  finalRecordDateValue = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, finalRecordDateValue), rest), getTimeSpanFromValue(values)), {}, {
99
109
  isRecently: true
100
110
  });
101
111
  }
112
+ if (isRule) {
113
+ values = getChangeUnitDate(captureUnit[0], captureUnit[1]);
114
+ finalRecordDateValue = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, finalRecordDateValue), rest), getTimeSpanFromValue(values)), {}, {
115
+ isRecently: true
116
+ });
117
+ }
102
118
  } else {
103
119
  if (values) {
104
120
  finalRecordDateValue = _objectSpread(_objectSpread({}, finalRecordDateValue), {}, {
@@ -116,11 +132,11 @@ var Refresh = /*#__PURE__*/forwardRef(function (props, ref) {
116
132
  setRecordDateValue(finalRecordDateValue);
117
133
  }
118
134
  } else {
119
- onChange(recordDateValue);
135
+ onAutoRefreshChange(!enableAutoRefresh);
120
136
  setIsAutoRefresh(function (pre) {
121
- onAutoRefreshChange(!pre);
122
137
  return !pre;
123
138
  });
139
+ onChange(recordDateValue);
124
140
  if (!value) {
125
141
  setRecordDateValue(recordDateValue);
126
142
  }
@@ -145,9 +161,9 @@ var Refresh = /*#__PURE__*/forwardRef(function (props, ref) {
145
161
  onClick: onAutoRefresh,
146
162
  disabled: isDisabledAutoRefresh,
147
163
  className: classnames({
148
- "cw-range-picker-auto-refresh-wrapper": isAutoRefresh
164
+ "cw-range-picker-auto-refresh-wrapper": enableAutoRefresh
149
165
  })
150
- }, isAutoRefresh ? /*#__PURE__*/React.createElement(Refresh3Svg, {
166
+ }, enableAutoRefresh ? /*#__PURE__*/React.createElement(Refresh3Svg, {
151
167
  className: "cw-range-picker-auto-refresh"
152
168
  }) : /*#__PURE__*/React.createElement(Refresh2Svg, null))));
153
169
  });
@@ -25,20 +25,17 @@ var TimeSpan = function TimeSpan(props) {
25
25
  onRecover = props.onRecover,
26
26
  timeSpanOption = props.timeSpanOption,
27
27
  isAutoRefresh = props.isAutoRefresh,
28
- setIsAutoRefresh = props.setIsAutoRefresh,
29
- refreshOption = props.refreshOption,
30
28
  forwardTooltipVisible = props.forwardTooltipVisible,
31
29
  setForwardTooltipVisible = props.setForwardTooltipVisible,
32
30
  backTooltipVisible = props.backTooltipVisible,
33
31
  setBackTooltipVisible = props.setBackTooltipVisible,
34
32
  expandTooltipVisible = props.expandTooltipVisible,
35
- setExpandTooltipVisible = props.setExpandTooltipVisible;
33
+ setExpandTooltipVisible = props.setExpandTooltipVisible,
34
+ isRightDisabled = props.isRightDisabled;
36
35
  var _ConfigProvider$useLo = _ConfigProvider.useLocale(),
37
36
  _ConfigProvider$useLo2 = _ConfigProvider$useLo.locale,
38
37
  locale = _ConfigProvider$useLo2 === void 0 ? "zh" : _ConfigProvider$useLo2;
39
38
  var localeObj = getLocale(locale);
40
- var _refreshOption$onAuto = refreshOption.onAutoRefreshChange,
41
- onAutoRefreshChange = _refreshOption$onAuto === void 0 ? function () {} : _refreshOption$onAuto;
42
39
  var _timeSpanOption$showF = timeSpanOption.showForwardBtn,
43
40
  showForwardBtn = _timeSpanOption$showF === void 0 ? true : _timeSpanOption$showF,
44
41
  _timeSpanOption$showB = timeSpanOption.showBackwardBtn,
@@ -46,7 +43,10 @@ var TimeSpan = function TimeSpan(props) {
46
43
  _timeSpanOption$showE = timeSpanOption.showEnlargeBtn,
47
44
  showEnlargeBtn = _timeSpanOption$showE === void 0 ? true : _timeSpanOption$showE,
48
45
  _timeSpanOption$toolt = timeSpanOption.tooltipTitleCustom,
49
- tooltipTitleCustom = _timeSpanOption$toolt === void 0 ? {} : _timeSpanOption$toolt;
46
+ tooltipTitleCustom = _timeSpanOption$toolt === void 0 ? {} : _timeSpanOption$toolt,
47
+ forwardIcon = timeSpanOption.forwardIcon,
48
+ backIcon = timeSpanOption.backIcon,
49
+ expandIcon = timeSpanOption.expandIcon;
50
50
  var _tooltipTitleCustom$f = tooltipTitleCustom.forwardTitle,
51
51
  forwardTitle = _tooltipTitleCustom$f === void 0 ? localeObj["forwardSmooth"] : _tooltipTitleCustom$f,
52
52
  _tooltipTitleCustom$b = tooltipTitleCustom.backTitle,
@@ -77,7 +77,7 @@ var TimeSpan = function TimeSpan(props) {
77
77
  },
78
78
  visible: forwardTooltipVisible
79
79
  }, showForwardBtn && /*#__PURE__*/React.createElement(_Button, {
80
- icon: "caret-left",
80
+ icon: forwardIcon ? forwardIcon : "caret-left",
81
81
  onClick: function onClick() {
82
82
  onChangeTimeSpan("left");
83
83
  },
@@ -87,16 +87,16 @@ var TimeSpan = function TimeSpan(props) {
87
87
  }
88
88
  })), /*#__PURE__*/React.createElement(_Tooltip, {
89
89
  title: backTitle,
90
- visible: isAutoRefresh ? false : backTooltipVisible,
90
+ visible: isRightDisabled ? false : backTooltipVisible,
91
91
  onVisibleChange: function onVisibleChange(visible) {
92
92
  setBackTooltipVisible(visible);
93
93
  }
94
94
  }, showBackwardBtn && /*#__PURE__*/React.createElement(_Button, {
95
- icon: "caret-right",
95
+ icon: backIcon ? backIcon : "caret-right",
96
96
  onClick: function onClick() {
97
97
  onChangeTimeSpan("right");
98
98
  },
99
- disabled: isAutoRefresh
99
+ disabled: isRightDisabled
100
100
  })), showEnlargeBtn && /*#__PURE__*/React.createElement(_Tooltip, {
101
101
  title: expandTitle,
102
102
  onVisibleChange: function onVisibleChange(visible) {
@@ -104,7 +104,7 @@ var TimeSpan = function TimeSpan(props) {
104
104
  },
105
105
  visible: expandTooltipVisible
106
106
  }, /*#__PURE__*/React.createElement(_Button, {
107
- icon: "zoom-out",
107
+ icon: expandIcon ? expandIcon : "zoom-out",
108
108
  onClick: function onClick() {
109
109
  onChangeTimeSpan("even");
110
110
  },