@chaoswise/ui 2.3.3 → 2.3.5

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.
@@ -115,13 +115,13 @@ function AbreastLayout(_ref) {
115
115
  onResizeStart: function onResizeStart() {
116
116
  var _rest$onResizeStart;
117
117
  setResizable(true);
118
- rest === null || rest === void 0 ? void 0 : (_rest$onResizeStart = rest.onResizeStart) === null || _rest$onResizeStart === void 0 ? void 0 : _rest$onResizeStart.call(rest);
118
+ rest === null || rest === void 0 || (_rest$onResizeStart = rest.onResizeStart) === null || _rest$onResizeStart === void 0 ? void 0 : _rest$onResizeStart.call(rest);
119
119
  },
120
120
  onResizeStop: function onResizeStop(e, direction, ref, d) {
121
121
  var _rest$onResizeStop;
122
122
  setLeftNavigationWidth(Number.parseInt(leftNavigationWidth) + d.width);
123
123
  setResizable(false);
124
- rest === null || rest === void 0 ? void 0 : (_rest$onResizeStop = rest.onResizeStop) === null || _rest$onResizeStop === void 0 ? void 0 : _rest$onResizeStop.call(rest);
124
+ rest === null || rest === void 0 || (_rest$onResizeStop = rest.onResizeStop) === null || _rest$onResizeStop === void 0 ? void 0 : _rest$onResizeStop.call(rest);
125
125
  },
126
126
  enable: _objectSpread({
127
127
  top: false,
@@ -26,7 +26,7 @@ import Column, { FIX_LABEL } from './Column';
26
26
  import useActive from './useActive';
27
27
  import useKeyboard from './useKeyboard';
28
28
  var RefOptionList = /*#__PURE__*/React.forwardRef(function (props, ref) {
29
- var _optionColumns$, _optionColumns$$optio, _ref3, _classNames;
29
+ var _optionColumns$, _ref3, _classNames;
30
30
  var _useBaseProps = useBaseProps(),
31
31
  prefixCls = _useBaseProps.prefixCls,
32
32
  multiple = _useBaseProps.multiple,
@@ -181,7 +181,7 @@ var RefOptionList = /*#__PURE__*/React.forwardRef(function (props, ref) {
181
181
  }, [activeValueCells]);
182
182
  // ========================== Render ==========================
183
183
  // >>>>> Empty
184
- var isEmpty = !((_optionColumns$ = optionColumns[0]) !== null && _optionColumns$ !== void 0 && (_optionColumns$$optio = _optionColumns$.options) !== null && _optionColumns$$optio !== void 0 && _optionColumns$$optio.length);
184
+ var isEmpty = !((_optionColumns$ = optionColumns[0]) !== null && _optionColumns$ !== void 0 && (_optionColumns$ = _optionColumns$.options) !== null && _optionColumns$ !== void 0 && _optionColumns$.length);
185
185
  var emptyList = [(_ref3 = {}, _defineProperty(_ref3, fieldNames.value, '__EMPTY__'), _defineProperty(_ref3, FIX_LABEL, notFoundContent), _defineProperty(_ref3, "disabled", true), _ref3)];
186
186
  var columnProps = _objectSpread(_objectSpread({}, props), {}, {
187
187
  multiple: !isEmpty && multiple,
@@ -32,7 +32,7 @@ export default (function (rawValues, options, fieldNames, multiple, displayRende
32
32
  }, []);
33
33
  };
34
34
  return rawValues.map(function (valueCells) {
35
- var _valueOptions, _valueOptions$option;
35
+ var _valueOptions;
36
36
  var valueOptions = toPathOptions(valueCells, options, fieldNames);
37
37
  var isBackEndQuery = false;
38
38
  if (valueOptions.length && (valueOptions[valueOptions.length - 1].index === -1 || valueOptions[valueOptions.length - 1].index === undefined)) {
@@ -78,7 +78,7 @@ export default (function (rawValues, options, fieldNames, multiple, displayRende
78
78
  value: value,
79
79
  key: value,
80
80
  valueCells: valueCells,
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
81
+ disabled: (_valueOptions = valueOptions[valueOptions.length - 1]) === null || _valueOptions === void 0 || (_valueOptions = _valueOptions.option) === null || _valueOptions === void 0 ? void 0 : _valueOptions.disabled
82
82
  };
83
83
  });
84
84
  }, [rawValues, options, fieldNames, displayRender, multiple, labelInValueOption]);
@@ -58,7 +58,9 @@ function Message(props) {
58
58
  requestOption = _props$requestOption === void 0 ? {} : _props$requestOption,
59
59
  closable = props.closable,
60
60
  _props$strongMessageO = props.strongMessageOption,
61
- strongMessageOption = _props$strongMessageO === void 0 ? {} : _props$strongMessageO;
61
+ strongMessageOption = _props$strongMessageO === void 0 ? {} : _props$strongMessageO,
62
+ _props$onSocketChange = props.onSocketChange,
63
+ onSocketChange = _props$onSocketChange === void 0 ? function () {} : _props$onSocketChange;
62
64
  var _useConfigContext = _useConfigContext2(),
63
65
  getPrefixCls = _useConfigContext.getPrefixCls;
64
66
  var prefixCls = getPrefixCls();
@@ -244,6 +246,7 @@ function Message(props) {
244
246
  case 0:
245
247
  _JSON$parse = JSON.parse(data), _JSON$parse$count$tot = _JSON$parse.count.total, total = _JSON$parse$count$tot === void 0 ? 0 : _JSON$parse$count$tot, message = _JSON$parse.message;
246
248
  setMessageTotal(total);
249
+ onSocketChange(JSON.parse(data));
247
250
  if (message) {
248
251
  noticeMessage = message.noticeMessage;
249
252
  if (noticeMessage) {
@@ -256,7 +259,7 @@ function Message(props) {
256
259
  }
257
260
  }
258
261
  }
259
- case 3:
262
+ case 4:
260
263
  case "end":
261
264
  return _context3.stop();
262
265
  }
@@ -46,11 +46,14 @@ var DropdownMenu = function DropdownMenu(props) {
46
46
  setIsFocus = props.setIsFocus,
47
47
  historyList = props.historyList,
48
48
  setHistoryList = props.setHistoryList,
49
- format = props.format;
49
+ format = props.format,
50
+ timeSpanOption = props.timeSpanOption;
50
51
  var _ConfigProvider$useLo = _ConfigProvider.useLocale(),
51
52
  _ConfigProvider$useLo2 = _ConfigProvider$useLo.locale,
52
53
  locale = _ConfigProvider$useLo2 === void 0 ? "zh" : _ConfigProvider$useLo2;
53
54
  var localeObj = getLocale(locale);
55
+ var _timeSpanOption$timeS = timeSpanOption.timeSpanBoundary,
56
+ timeSpanBoundary = _timeSpanOption$timeS === void 0 ? 94608000 : _timeSpanOption$timeS;
54
57
  var _menuOption$showCalen = menuOption.showCalendar,
55
58
  showCalendar = _menuOption$showCalen === void 0 ? true : _menuOption$showCalen,
56
59
  _menuOption$showHisto = menuOption.showHistoryList,
@@ -77,13 +80,13 @@ var DropdownMenu = function DropdownMenu(props) {
77
80
  });
78
81
  returnValue = getCorrectValue(returnValue, item.key);
79
82
  onChange(returnValue);
80
- var _getHistoryInfo = getHistoryInfo(returnValue, historyList, locale, format),
83
+ var _getHistoryInfo = getHistoryInfo(returnValue, historyList, locale, format, timeSpanBoundary),
81
84
  _getHistoryInfo2 = _slicedToArray(_getHistoryInfo, 2),
82
85
  isRepeat = _getHistoryInfo2[0],
83
86
  historyValue = _getHistoryInfo2[1];
84
87
  if (!isRepeat) {
85
88
  setHistoryList(function (pre) {
86
- return [].concat(_toConsumableArray(pre), [historyValue]);
89
+ return [historyValue].concat(_toConsumableArray(pre));
87
90
  });
88
91
  }
89
92
  if (!_value) {
@@ -18,14 +18,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
18
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
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
20
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
- /*
22
- * @Author: andrew.qiao andrew.qiao@cloudwise.com
23
- * @Date: 2022-09-05 09:23:24
24
- * @LastEditors: andrew.qiao andrew.qiao@cloudwise.com
25
- * @LastEditTime: 2023-03-30 18:18:34
26
- * @FilePath: /change_01/aops_web_commons/packages/ui/components/CWRangePicker1/Refresh/index.js
27
- * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
28
- */
29
21
  import React, { forwardRef, useImperativeHandle } from "react";
30
22
  import classnames from "classnames";
31
23
  import Refresh1Svg from "../assets/Refresh1";
@@ -42,9 +34,9 @@ var Refresh = /*#__PURE__*/forwardRef(function (props, ref) {
42
34
  setIsAutoRefresh = props.setIsAutoRefresh,
43
35
  refreshOption = props.refreshOption,
44
36
  isHasDate = props.isHasDate,
45
- setBackTooltipVisible = props.setBackTooltipVisible,
46
37
  enableAutoRefresh = props.enableAutoRefresh,
47
- isClickAutoRefresh = props.isClickAutoRefresh;
38
+ isClickAutoRefresh = props.isClickAutoRefresh,
39
+ timeSpanOption = props.timeSpanOption;
48
40
  var _refreshOption$onAuto = refreshOption.onAutoRefreshChange,
49
41
  onAutoRefreshChange = _refreshOption$onAuto === void 0 ? function () {} : _refreshOption$onAuto,
50
42
  _refreshOption$onClic = refreshOption.onClickRefresh,
@@ -57,6 +49,8 @@ var Refresh = /*#__PURE__*/forwardRef(function (props, ref) {
57
49
  showAutoRefresh = _refreshOption$showAu === void 0 ? true : _refreshOption$showAu,
58
50
  _refreshOption$showRe = refreshOption.showRefresh,
59
51
  showRefresh = _refreshOption$showRe === void 0 ? true : _refreshOption$showRe;
52
+ var _timeSpanOption$timeS = timeSpanOption.timeSpanBoundary,
53
+ timeSpanBoundary = _timeSpanOption$timeS === void 0 ? 94608000 : _timeSpanOption$timeS;
60
54
  var _ConfigProvider$useLo = _ConfigProvider.useLocale(),
61
55
  _ConfigProvider$useLo2 = _ConfigProvider$useLo.locale,
62
56
  locale = _ConfigProvider$useLo2 === void 0 ? "zh" : _ConfigProvider$useLo2;
@@ -76,7 +70,7 @@ var Refresh = /*#__PURE__*/forwardRef(function (props, ref) {
76
70
  value: computedRecentlyValue(values)
77
71
  });
78
72
  }
79
- if (isRule) {
73
+ if (isRule && !values) {
80
74
  returnValue = _objectSpread(_objectSpread({}, recordDateValue), {}, {
81
75
  value: getChangeUnitDate(captureUnit[0], captureUnit[1])
82
76
  });
@@ -86,7 +80,6 @@ var Refresh = /*#__PURE__*/forwardRef(function (props, ref) {
86
80
  };
87
81
  // 自动刷新
88
82
  var onAutoRefresh = function onAutoRefresh() {
89
- setBackTooltipVisible(false);
90
83
  onClickAutoRefresh(!enableAutoRefresh);
91
84
  isClickAutoRefresh.current = true;
92
85
  if (isHasDate) {
@@ -104,13 +97,13 @@ var Refresh = /*#__PURE__*/forwardRef(function (props, ref) {
104
97
  if (!enableAutoRefresh) {
105
98
  if (values) {
106
99
  values = computedRecentlyValue(values);
107
- finalRecordDateValue = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, finalRecordDateValue), rest), getTimeSpanFromValue(values)), {}, {
100
+ finalRecordDateValue = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, finalRecordDateValue), rest), getTimeSpanFromValue(values, timeSpanBoundary)), {}, {
108
101
  isRecently: true
109
102
  });
110
103
  }
111
- if (isRule) {
104
+ if (isRule && !values) {
112
105
  values = getChangeUnitDate(captureUnit[0], captureUnit[1]);
113
- finalRecordDateValue = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, finalRecordDateValue), rest), getTimeSpanFromValue(values)), {}, {
106
+ finalRecordDateValue = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, finalRecordDateValue), rest), getTimeSpanFromValue(values, timeSpanBoundary)), {}, {
114
107
  isRecently: true
115
108
  });
116
109
  }
@@ -120,7 +113,7 @@ var Refresh = /*#__PURE__*/forwardRef(function (props, ref) {
120
113
  value: computedRecentlyValue(values)
121
114
  });
122
115
  }
123
- if (isRule) {
116
+ if (isRule && !values) {
124
117
  finalRecordDateValue = _objectSpread(_objectSpread({}, finalRecordDateValue), {}, {
125
118
  value: getChangeUnitDate(captureUnit[0], captureUnit[1])
126
119
  });
@@ -1,8 +1,8 @@
1
1
  import "@chaoswise/ui/lib/Tooltip/index.less";
2
2
  import _Tooltip from "@chaoswise/ui/lib/Tooltip";
3
+ import _ConfigProvider from "@chaoswise/ui/lib/ConfigProvider";
3
4
  import "@chaoswise/ui/lib/Button/index.less";
4
5
  import _Button from "@chaoswise/ui/lib/Button";
5
- import _ConfigProvider from "@chaoswise/ui/lib/ConfigProvider";
6
6
  /*
7
7
  * @Author: andrew.qiao andrew.qiao@cloudwise.com
8
8
  * @Date: 2022-08-11 18:23:40
@@ -15,22 +15,17 @@ import React from "react";
15
15
  import { getChangeDate } from "../utils";
16
16
  import { getLocale } from "../locale";
17
17
  import "./index.less";
18
+ _Button.__ANT_BUTTON = true;
18
19
  var TimeSpan = function TimeSpan(props) {
19
20
  var onChange = props.onChange,
20
- growSize = props.growSize,
21
21
  recordDateValue = props.recordDateValue,
22
22
  setRecordDateValue = props.setRecordDateValue,
23
23
  _value = props.value,
24
24
  isHasDate = props.isHasDate,
25
25
  onRecover = props.onRecover,
26
26
  timeSpanOption = props.timeSpanOption,
27
- forwardTooltipVisible = props.forwardTooltipVisible,
28
- setForwardTooltipVisible = props.setForwardTooltipVisible,
29
- backTooltipVisible = props.backTooltipVisible,
30
- setBackTooltipVisible = props.setBackTooltipVisible,
31
- expandTooltipVisible = props.expandTooltipVisible,
32
- setExpandTooltipVisible = props.setExpandTooltipVisible,
33
- isRightDisabled = props.isRightDisabled;
27
+ isRightDisabled = props.isRightDisabled,
28
+ isDisabledEnlargeBtn = props.isDisabledEnlargeBtn;
34
29
  var _ConfigProvider$useLo = _ConfigProvider.useLocale(),
35
30
  _ConfigProvider$useLo2 = _ConfigProvider$useLo.locale,
36
31
  locale = _ConfigProvider$useLo2 === void 0 ? "zh" : _ConfigProvider$useLo2;
@@ -45,15 +40,19 @@ var TimeSpan = function TimeSpan(props) {
45
40
  tooltipTitleCustom = _timeSpanOption$toolt === void 0 ? {} : _timeSpanOption$toolt,
46
41
  forwardIcon = timeSpanOption.forwardIcon,
47
42
  backIcon = timeSpanOption.backIcon,
48
- expandIcon = timeSpanOption.expandIcon;
43
+ expandIcon = timeSpanOption.expandIcon,
44
+ _timeSpanOption$growS = timeSpanOption.growSize,
45
+ growSize = _timeSpanOption$growS === void 0 ? 3 : _timeSpanOption$growS,
46
+ _timeSpanOption$timeS = timeSpanOption.timeSpanBoundary,
47
+ timeSpanBoundary = _timeSpanOption$timeS === void 0 ? 94608000 : _timeSpanOption$timeS;
49
48
  var _tooltipTitleCustom$f = tooltipTitleCustom.forwardTitle,
50
49
  forwardTitle = _tooltipTitleCustom$f === void 0 ? localeObj["forwardSmooth"] : _tooltipTitleCustom$f,
51
50
  _tooltipTitleCustom$b = tooltipTitleCustom.backTitle,
52
51
  backTitle = _tooltipTitleCustom$b === void 0 ? localeObj["backSmooth"] : _tooltipTitleCustom$b,
53
52
  _tooltipTitleCustom$e = tooltipTitleCustom.expandTitle,
54
- expandTitle = _tooltipTitleCustom$e === void 0 ? localeObj["ExpandSpan"] : _tooltipTitleCustom$e;
53
+ expandTitle = _tooltipTitleCustom$e === void 0 ? localeObj["ExpandSpan"].replace('{span}', "".concat(growSize)) : _tooltipTitleCustom$e;
55
54
  var onChangeTimeSpan = function onChangeTimeSpan(direction) {
56
- var _getChangeDate = getChangeDate(recordDateValue, direction, growSize),
55
+ var _getChangeDate = getChangeDate(recordDateValue, direction, growSize, timeSpanBoundary),
57
56
  value = _getChangeDate.value,
58
57
  isInvalidDate = _getChangeDate.isInvalidDate,
59
58
  switchInitial = _getChangeDate.switchInitial;
@@ -70,26 +69,14 @@ var TimeSpan = function TimeSpan(props) {
70
69
  return isHasDate && showTimeSpan && /*#__PURE__*/React.createElement(_Button.Group, {
71
70
  className: "cw-range-picker-time-span-wrapper"
72
71
  }, /*#__PURE__*/React.createElement(_Tooltip, {
73
- title: forwardTitle,
74
- onVisibleChange: function onVisibleChange(visible) {
75
- setForwardTooltipVisible(visible);
76
- },
77
- visible: forwardTooltipVisible
72
+ title: forwardTitle
78
73
  }, showForwardBtn && /*#__PURE__*/React.createElement(_Button, {
79
74
  icon: forwardIcon ? forwardIcon : "caret-left",
80
75
  onClick: function onClick() {
81
76
  onChangeTimeSpan("left");
82
- },
83
- onMouseOver: function onMouseOver() {
84
- setForwardTooltipVisible(true);
85
- setBackTooltipVisible(false);
86
77
  }
87
78
  })), /*#__PURE__*/React.createElement(_Tooltip, {
88
- title: backTitle,
89
- visible: isRightDisabled ? false : backTooltipVisible,
90
- onVisibleChange: function onVisibleChange(visible) {
91
- setBackTooltipVisible(visible);
92
- }
79
+ title: backTitle
93
80
  }, showBackwardBtn && /*#__PURE__*/React.createElement(_Button, {
94
81
  icon: backIcon ? backIcon : "caret-right",
95
82
  onClick: function onClick() {
@@ -97,19 +84,13 @@ var TimeSpan = function TimeSpan(props) {
97
84
  },
98
85
  disabled: isRightDisabled
99
86
  })), showEnlargeBtn && /*#__PURE__*/React.createElement(_Tooltip, {
100
- title: expandTitle,
101
- onVisibleChange: function onVisibleChange(visible) {
102
- setExpandTooltipVisible(visible);
103
- },
104
- visible: expandTooltipVisible
87
+ title: expandTitle
105
88
  }, /*#__PURE__*/React.createElement(_Button, {
106
- icon: expandIcon ? expandIcon : "zoom-out",
89
+ icon: expandIcon ? expandIcon : "zoom-in",
107
90
  onClick: function onClick() {
108
91
  onChangeTimeSpan("even");
109
92
  },
110
- onMouseOver: function onMouseOver() {
111
- setExpandTooltipVisible(true);
112
- }
93
+ disabled: isDisabledEnlargeBtn
113
94
  })));
114
95
  };
115
96
  export default TimeSpan;
@@ -41,7 +41,7 @@ import Refresh from "./Refresh";
41
41
  import CalendarSvg from "./assets/Calendar";
42
42
  import LiveSvg from "./assets/live";
43
43
  import RecoverSvg from "./assets/Recover";
44
- import { regroupDataSourceFn, echoInputValue, getUnit, judgeType, getChangeUnitDate, isInvalidDate, range, funcValueChangeArrayValue, getCorrectValue, getHistoryInfo, getFinalDateOption, getTruthDateCount, isAfterDate, isSameDate } from "./utils";
44
+ import { regroupDataSourceFn, echoInputValue, getUnit, judgeType, getChangeUnitDate, isInvalidDate, range, funcValueChangeArrayValue, getCorrectValue, getHistoryInfo, getFinalDateOption, getTruthDateCount, isAfterDate, isSameDate, isExceedMaxTimeSpan, getYears, computedRecentlyValue } from "./utils";
45
45
  import _ from "lodash";
46
46
  import moment from "moment";
47
47
  import "./index.less";
@@ -55,8 +55,6 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
55
55
  _onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
56
56
  _props$onInitChange = props.onInitChange,
57
57
  _onInitChange = _props$onInitChange === void 0 ? function () {} : _props$onInitChange,
58
- _props$growSize = props.growSize,
59
- growSize = _props$growSize === void 0 ? 3 : _props$growSize,
60
58
  _props$tipTooltipOpti = props.tipTooltipOption,
61
59
  tipTooltipOption = _props$tipTooltipOpti === void 0 ? {} : _props$tipTooltipOpti,
62
60
  _props$menuOption = props.menuOption,
@@ -71,7 +69,9 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
71
69
  _props$format = props.format,
72
70
  format = _props$format === void 0 ? "YYYY/MM/DD HH:mm:ss" : _props$format,
73
71
  forceRenderTitle = props.forceRenderTitle,
74
- open = props.open;
72
+ open = props.open,
73
+ _props$rangePickerFor = props.rangePickerFormat,
74
+ rangePickerFormat = _props$rangePickerFor === void 0 ? "YYYY/MM/DD" : _props$rangePickerFor;
75
75
  var _ConfigProvider$useLo = _ConfigProvider.useLocale(),
76
76
  _ConfigProvider$useLo2 = _ConfigProvider$useLo.locale,
77
77
  locale = _ConfigProvider$useLo2 === void 0 ? "zh" : _ConfigProvider$useLo2;
@@ -87,6 +87,8 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
87
87
  showAutoRefresh = _refreshOption$showAu === void 0 ? true : _refreshOption$showAu,
88
88
  _refreshOption$isRece = refreshOption.isRecentlyOpenRefresh,
89
89
  isRecentlyOpenRefresh = _refreshOption$isRece === void 0 ? true : _refreshOption$isRece;
90
+ var _timeSpanOption$timeS = timeSpanOption.timeSpanBoundary,
91
+ timeSpanBoundary = _timeSpanOption$timeS === void 0 ? 94608000 : _timeSpanOption$timeS;
90
92
  var _menuOption$showCalen = menuOption.showCalendar,
91
93
  showCalendar = _menuOption$showCalen === void 0 ? true : _menuOption$showCalen,
92
94
  _menuOption$exceedSho = menuOption.exceedShowInMore,
@@ -137,19 +139,6 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
137
139
  _useState14 = _slicedToArray(_useState13, 2),
138
140
  historyList = _useState14[0],
139
141
  setHistoryList = _useState14[1];
140
- // 启用禁用状态Button切换导致Tooltip异常特殊处理
141
- var _useState15 = useState(false),
142
- _useState16 = _slicedToArray(_useState15, 2),
143
- forwardTooltipVisible = _useState16[0],
144
- setForwardTooltipVisible = _useState16[1];
145
- var _useState17 = useState(false),
146
- _useState18 = _slicedToArray(_useState17, 2),
147
- backTooltipVisible = _useState18[0],
148
- setBackTooltipVisible = _useState18[1];
149
- var _useState19 = useState(false),
150
- _useState20 = _slicedToArray(_useState19, 2),
151
- expandTooltipVisible = _useState20[0],
152
- setExpandTooltipVisible = _useState20[1];
153
142
  // 特殊时间选择器外壳容器
154
143
  var calendarRef = useRef(null);
155
144
  // 定时器计数
@@ -160,10 +149,10 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
160
149
  var inputRef = useRef(null);
161
150
  // 含有刷新组件暴露的方法
162
151
  var refreshRef = useRef(null);
163
- var _useState21 = useState([]),
164
- _useState22 = _slicedToArray(_useState21, 2),
165
- rangePickerValue = _useState22[0],
166
- setRangePickerValue = _useState22[1];
152
+ var _useState15 = useState([]),
153
+ _useState16 = _slicedToArray(_useState15, 2),
154
+ rangePickerValue = _useState16[0],
155
+ setRangePickerValue = _useState16[1];
167
156
  // 组件内部方法抛出
168
157
  useImperativeHandle(ref, function () {
169
158
  var _refreshRef$current;
@@ -221,24 +210,27 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
221
210
  }, [openAutoRefresh, isAutoRefresh]);
222
211
  // 输入框回显
223
212
  useEffect(function () {
224
- setInputValue(echoInputValue(recordDateValue, isFocus, locale, format, forceRenderTitle, enableAutoRefresh));
225
- }, [recordDateValue, isFocus, locale, format, forceRenderTitle, enableAutoRefresh]);
213
+ setInputValue(echoInputValue(recordDateValue, isFocus, locale, format, forceRenderTitle, enableAutoRefresh, timeSpanBoundary));
214
+ }, [recordDateValue, isFocus, locale, format, forceRenderTitle, enableAutoRefresh, timeSpanBoundary]);
226
215
  useEffect(function () {
227
216
  var _judgeType3 = judgeType(recordDateValue),
228
217
  _judgeType4 = _slicedToArray(_judgeType3, 1),
229
218
  isRule = _judgeType4[0];
230
219
  var isHasDate = !isRule && !recordDateValue.value ? false : true;
231
- var _isAutoRefresh = false;
220
+ var _isAutoRefresh = enableAutoRefresh;
232
221
  if (isHasDate) {
233
222
  if (!isRecentlyOpenRefresh) {
234
223
  if (!isRule) {
235
224
  if (enableAutoRefresh) {
236
225
  onAutoRefreshChange(false);
226
+ _isAutoRefresh = false;
237
227
  }
238
228
  } else {
239
229
  if (isRule && isClickAutoRefresh.current) {
240
- onAutoRefreshChange(true);
241
- _isAutoRefresh = true;
230
+ if (!enableAutoRefresh) {
231
+ onAutoRefreshChange(true);
232
+ _isAutoRefresh = true;
233
+ }
242
234
  }
243
235
  }
244
236
  isClickAutoRefresh.current = false;
@@ -251,6 +243,7 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
251
243
  } else {
252
244
  if (enableAutoRefresh) {
253
245
  onAutoRefreshChange(false);
246
+ _isAutoRefresh = false;
254
247
  }
255
248
  }
256
249
  }
@@ -268,11 +261,18 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
268
261
  recordUnit = _judgeType6[2];
269
262
  if (enableAutoRefresh && isRule && showAutoRefresh) {
270
263
  timeRef.current = setInterval(function () {
264
+ var _values = [];
265
+ if (values) {
266
+ _values = computedRecentlyValue(values);
267
+ if (!values) {
268
+ _values = getChangeUnitDate(captureUnit[0], captureUnit[1]);
269
+ }
270
+ }
271
271
  var newValue = _objectSpread(_objectSpread({}, recordDateValue), {}, {
272
272
  timeDomain: recordUnit,
273
273
  number: captureUnit[0],
274
274
  unit: captureUnit[1] === "mo" ? "M" : captureUnit[1],
275
- value: getChangeUnitDate(captureUnit[0], captureUnit[1]),
275
+ value: _values,
276
276
  isRecently: true
277
277
  });
278
278
  onAutoRefresh(newValue);
@@ -298,19 +298,27 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
298
298
  values = funcValueChangeArrayValue(values);
299
299
  var isHasDate = true;
300
300
  var isRightDisabled = false;
301
+ var isDisabledEnlargeBtn = false;
302
+ var years = getYears(timeSpanBoundary);
301
303
  if (isRule) {
302
304
  isRightDisabled = true;
303
- values = getChangeUnitDate(captureUnit[0], captureUnit[1]);
305
+ if (!values) {
306
+ values = getChangeUnitDate(captureUnit[0], captureUnit[1]);
307
+ }
308
+ if (captureUnit[1] === "y" && Number(captureUnit[0]) >= years) {
309
+ isDisabledEnlargeBtn = true;
310
+ }
304
311
  }
305
312
  if (!isRule && !values) {
306
313
  isHasDate = false;
307
314
  }
308
- return [isHasDate, values, isRightDisabled];
309
- }, [recordDateValue]),
310
- _useMemo2 = _slicedToArray(_useMemo, 3),
315
+ return [isHasDate, values, isRightDisabled, isDisabledEnlargeBtn];
316
+ }, [recordDateValue, timeSpanBoundary]),
317
+ _useMemo2 = _slicedToArray(_useMemo, 4),
311
318
  isHasDate = _useMemo2[0],
312
319
  _defaultValue = _useMemo2[1],
313
- isRightDisabled = _useMemo2[2];
320
+ isRightDisabled = _useMemo2[2],
321
+ isDisabledEnlargeBtn = _useMemo2[3];
314
322
  // 点击空白处日历切换
315
323
  useEffect(function () {
316
324
  document.addEventListener("click", clickBody);
@@ -431,15 +439,20 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
431
439
  var isInvalidDate_ = isInvalidDate(returnValue.value);
432
440
  if (!isInvalidDate_) {
433
441
  // message.success(localeObj["fit-the-input-format"]);
442
+ var passValue = returnValue.value;
443
+ if (isExceedMaxTimeSpan(passValue, timeSpanBoundary)) {
444
+ _message.error(localeObj["the-maximum-time-span-is-exceeded"]);
445
+ return;
446
+ }
434
447
  _onChange(returnValue);
435
448
  setIsFocus(false);
436
- var _getHistoryInfo = getHistoryInfo(returnValue, historyList, locale, format),
449
+ var _getHistoryInfo = getHistoryInfo(returnValue, historyList, locale, format, timeSpanBoundary),
437
450
  _getHistoryInfo2 = _slicedToArray(_getHistoryInfo, 2),
438
451
  isRepeat = _getHistoryInfo2[0],
439
452
  historyValue = _getHistoryInfo2[1];
440
453
  if (!isRepeat) {
441
454
  setHistoryList(function (pre) {
442
- return [].concat(_toConsumableArray(pre), [historyValue]);
455
+ return [historyValue].concat(_toConsumableArray(pre));
443
456
  });
444
457
  }
445
458
  if (!value) {
@@ -456,15 +469,20 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
456
469
  var _returnValue = getCorrectValue({
457
470
  value: _dateValue2
458
471
  });
472
+ var _passValue = _returnValue.value;
473
+ if (isExceedMaxTimeSpan(_passValue, timeSpanBoundary)) {
474
+ _message.error(localeObj["the-maximum-time-span-is-exceeded"]);
475
+ return;
476
+ }
459
477
  _onChange(_returnValue);
460
478
  setIsFocus(false);
461
- var _getHistoryInfo3 = getHistoryInfo(_returnValue, historyList, locale, format),
479
+ var _getHistoryInfo3 = getHistoryInfo(_returnValue, historyList, locale, format, timeSpanBoundary),
462
480
  _getHistoryInfo4 = _slicedToArray(_getHistoryInfo3, 2),
463
481
  _isRepeat = _getHistoryInfo4[0],
464
482
  _historyValue = _getHistoryInfo4[1];
465
483
  if (!_isRepeat) {
466
484
  setHistoryList(function (pre) {
467
- return [].concat(_toConsumableArray(pre), [_historyValue]);
485
+ return [_historyValue].concat(_toConsumableArray(pre));
468
486
  });
469
487
  }
470
488
  if (!value) {
@@ -484,7 +502,8 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
484
502
  isAutoRefresh: isAutoRefresh,
485
503
  setIsAutoRefresh: setIsAutoRefresh,
486
504
  refreshOption: refreshOption,
487
- enableAutoRefresh: enableAutoRefresh
505
+ enableAutoRefresh: enableAutoRefresh,
506
+ timeSpanOption: timeSpanOption
488
507
  };
489
508
  var dropdownMenuProps = _objectSpread(_objectSpread({}, commonProps), {}, {
490
509
  dataSource: dataSource,
@@ -499,21 +518,13 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
499
518
  });
500
519
  var timeSpanProps = _objectSpread(_objectSpread({}, commonProps), {}, {
501
520
  dataSource: dataSource,
502
- growSize: growSize,
503
521
  isHasDate: isHasDate,
504
522
  onRecover: onRecover,
505
- timeSpanOption: timeSpanOption,
506
- forwardTooltipVisible: forwardTooltipVisible,
507
- setForwardTooltipVisible: setForwardTooltipVisible,
508
- backTooltipVisible: backTooltipVisible,
509
- setBackTooltipVisible: setBackTooltipVisible,
510
- expandTooltipVisible: expandTooltipVisible,
511
- setExpandTooltipVisible: setExpandTooltipVisible,
512
- isRightDisabled: isRightDisabled
523
+ isRightDisabled: isRightDisabled,
524
+ isDisabledEnlargeBtn: isDisabledEnlargeBtn
513
525
  });
514
526
  var refreshProps = _objectSpread(_objectSpread({}, commonProps), {}, {
515
527
  isHasDate: isHasDate,
516
- setBackTooltipVisible: setBackTooltipVisible,
517
528
  isClickAutoRefresh: isClickAutoRefresh
518
529
  });
519
530
  return /*#__PURE__*/React.createElement("div", {
@@ -528,7 +539,7 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
528
539
  return getPopupContainerCalendar ? getPopupContainerCalendar(triggerNode) : triggerNode;
529
540
  },
530
541
  dropdownClassName: classnames(dropdownCalendarClassName),
531
- format: format,
542
+ format: rangePickerFormat,
532
543
  allowClear: false,
533
544
  onChange: function onChange(_value, mode) {
534
545
  setIsCalendar(false);
@@ -548,14 +559,18 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
548
559
  _message.error(localeObj["the-selected-time-does-not-meet-the-rule-limit"]);
549
560
  return;
550
561
  }
562
+ if (isExceedMaxTimeSpan(resValue, timeSpanBoundary)) {
563
+ _message.error(localeObj["the-maximum-time-span-is-exceeded"]);
564
+ return;
565
+ }
551
566
  _onChange(_values2);
552
- var _getHistoryInfo5 = getHistoryInfo(_values2, historyList, locale, format),
567
+ var _getHistoryInfo5 = getHistoryInfo(_values2, historyList, locale, format, timeSpanBoundary),
553
568
  _getHistoryInfo6 = _slicedToArray(_getHistoryInfo5, 2),
554
569
  isRepeat = _getHistoryInfo6[0],
555
570
  historyValue = _getHistoryInfo6[1];
556
571
  if (!isRepeat) {
557
572
  setHistoryList(function (pre) {
558
- return [].concat(_toConsumableArray(pre), [historyValue]);
573
+ return [historyValue].concat(_toConsumableArray(pre));
559
574
  });
560
575
  }
561
576
  if (!value) {
@@ -613,31 +628,23 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
613
628
  data0 = _ref2[0],
614
629
  data1 = _ref2[1];
615
630
  var range = info.range;
616
- var _ref3 = rangePickerValue || [],
617
- _ref4 = _slicedToArray(_ref3, 2),
618
- value0 = _ref4[0],
619
- value1 = _ref4[1];
620
631
  if (range === "start" && data0) {
621
- if (value0) {
622
- data0 = moment(data0).set({
623
- "hour": 0,
624
- "minute": 0,
625
- "second": 0,
626
- "millisecond": 0
627
- });
628
- }
632
+ data0 = moment(data0).set({
633
+ "hour": 0,
634
+ "minute": 0,
635
+ "second": 0,
636
+ "millisecond": 0
637
+ });
629
638
  }
630
639
  if (range === "end" && data1) {
631
- if (value1 && !moment(value1).isSame(data1, "day")) {
632
- data1 = moment(data1).set({
633
- "hour": 23,
634
- "minute": 59,
635
- "second": 59,
636
- "millisecond": 0
637
- });
638
- if (moment().isSame(data1, "day")) {
639
- data1 = moment();
640
- }
640
+ data1 = moment(data1).set({
641
+ "hour": 23,
642
+ "minute": 59,
643
+ "second": 59,
644
+ "millisecond": 0
645
+ });
646
+ if (moment().isSame(data1, "day")) {
647
+ data1 = moment();
641
648
  }
642
649
  }
643
650
  setRangePickerValue([data0, data1]);
@@ -677,8 +684,8 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
677
684
  });
678
685
  CWRangePicker.defaultProps = {
679
686
  moreItemDropdownPosition: "left",
680
- growSize: 3,
681
- format: "YYYY/MM/DD HH:mm:ss"
687
+ format: "YYYY/MM/DD HH:mm:ss",
688
+ rangePickerFormat: "YYYY/MM/DD"
682
689
  };
683
690
  CWRangePicker.propTypes = {
684
691
  /**
@@ -705,10 +712,6 @@ CWRangePicker.propTypes = {
705
712
  * 初始时间数据进入时间返回的回调(*主要针对于最近时间)
706
713
  */
707
714
  onInitChange: PropTypes.func,
708
- /**
709
- * 时间跨度的比例,>=2,默认为3
710
- */
711
- growSize: PropTypes.number,
712
715
  /**
713
716
  * 提示信息TooltipOption
714
717
  */
@@ -760,6 +763,10 @@ CWRangePicker.propTypes = {
760
763
  /**
761
764
  * 下拉菜单日历模式的className属性
762
765
  */
763
- dropdownCalendarClassName: PropTypes.string
766
+ dropdownCalendarClassName: PropTypes.string,
767
+ /**
768
+ * 日历选择模式format展示
769
+ */
770
+ rangePickerFormat: PropTypes.string
764
771
  };
765
772
  export default CWRangePicker;