@chaoswise/ui 2.3.4 → 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.
- package/lib/AbreastLayout/index.js +2 -2
- package/lib/CWCascader/rc-cascader/OptionList/index.js +2 -2
- package/lib/CWCascader/rc-cascader/hooks/useDisplayValues.js +2 -2
- package/lib/CWMessage/index.js +5 -2
- package/lib/CWRangePicker/DropdownMenu/index.js +6 -3
- package/lib/CWRangePicker/Refresh/index.js +9 -16
- package/lib/CWRangePicker/TimeSpan/index.js +16 -35
- package/lib/CWRangePicker/index.js +54 -50
- package/lib/CWRangePicker/locale/en_US.js +3 -2
- package/lib/CWRangePicker/locale/zh_CN.js +3 -2
- package/lib/CWRangePicker/utils/index.js +69 -34
- package/lib/CWSelect/DragTag/index.js +52 -0
- package/lib/CWSelect/Tag.js +3 -11
- package/lib/CWSelect/index.js +8 -45
- package/lib/CWTable/EditLine.js +1 -1
- package/lib/CWTree/index.js +11 -6
- package/lib/Input/InputComponent.js +2 -2
- package/lib/Pagination/index.js +9 -3
- package/lib/QuickTransfer/CheckList.js +1 -1
- package/lib/QuickTransfer/NoDrag.js +1 -1
- package/lib/QuickTransfer/NotDragList.js +4 -5
- package/lib/QuickTransfer/TopicList.js +3 -3
- package/lib/QuickTransfer/index.js +7 -2
- package/lib/QuickTransfer/utils.js +21 -4
- package/lib/SearchBar/index.js +2 -2
- package/lib/SingleSpa/index.js +2 -2
- package/lib/ThemeProvider/utils.js +1 -1
- package/lib/WangEditor/wangEditor.js +2 -2
- package/package.json +2 -2
|
@@ -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
|
|
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
|
|
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$,
|
|
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
|
|
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
|
|
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
|
|
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]);
|
package/lib/CWMessage/index.js
CHANGED
|
@@ -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
|
|
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)
|
|
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
|
-
|
|
28
|
-
|
|
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-
|
|
89
|
+
icon: expandIcon ? expandIcon : "zoom-in",
|
|
107
90
|
onClick: function onClick() {
|
|
108
91
|
onChangeTimeSpan("even");
|
|
109
92
|
},
|
|
110
|
-
|
|
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,
|
|
@@ -89,6 +87,8 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
89
87
|
showAutoRefresh = _refreshOption$showAu === void 0 ? true : _refreshOption$showAu,
|
|
90
88
|
_refreshOption$isRece = refreshOption.isRecentlyOpenRefresh,
|
|
91
89
|
isRecentlyOpenRefresh = _refreshOption$isRece === void 0 ? true : _refreshOption$isRece;
|
|
90
|
+
var _timeSpanOption$timeS = timeSpanOption.timeSpanBoundary,
|
|
91
|
+
timeSpanBoundary = _timeSpanOption$timeS === void 0 ? 94608000 : _timeSpanOption$timeS;
|
|
92
92
|
var _menuOption$showCalen = menuOption.showCalendar,
|
|
93
93
|
showCalendar = _menuOption$showCalen === void 0 ? true : _menuOption$showCalen,
|
|
94
94
|
_menuOption$exceedSho = menuOption.exceedShowInMore,
|
|
@@ -139,19 +139,6 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
139
139
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
140
140
|
historyList = _useState14[0],
|
|
141
141
|
setHistoryList = _useState14[1];
|
|
142
|
-
// 启用禁用状态Button切换导致Tooltip异常特殊处理
|
|
143
|
-
var _useState15 = useState(false),
|
|
144
|
-
_useState16 = _slicedToArray(_useState15, 2),
|
|
145
|
-
forwardTooltipVisible = _useState16[0],
|
|
146
|
-
setForwardTooltipVisible = _useState16[1];
|
|
147
|
-
var _useState17 = useState(false),
|
|
148
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
|
149
|
-
backTooltipVisible = _useState18[0],
|
|
150
|
-
setBackTooltipVisible = _useState18[1];
|
|
151
|
-
var _useState19 = useState(false),
|
|
152
|
-
_useState20 = _slicedToArray(_useState19, 2),
|
|
153
|
-
expandTooltipVisible = _useState20[0],
|
|
154
|
-
setExpandTooltipVisible = _useState20[1];
|
|
155
142
|
// 特殊时间选择器外壳容器
|
|
156
143
|
var calendarRef = useRef(null);
|
|
157
144
|
// 定时器计数
|
|
@@ -162,10 +149,10 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
162
149
|
var inputRef = useRef(null);
|
|
163
150
|
// 含有刷新组件暴露的方法
|
|
164
151
|
var refreshRef = useRef(null);
|
|
165
|
-
var
|
|
166
|
-
|
|
167
|
-
rangePickerValue =
|
|
168
|
-
setRangePickerValue =
|
|
152
|
+
var _useState15 = useState([]),
|
|
153
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
154
|
+
rangePickerValue = _useState16[0],
|
|
155
|
+
setRangePickerValue = _useState16[1];
|
|
169
156
|
// 组件内部方法抛出
|
|
170
157
|
useImperativeHandle(ref, function () {
|
|
171
158
|
var _refreshRef$current;
|
|
@@ -223,8 +210,8 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
223
210
|
}, [openAutoRefresh, isAutoRefresh]);
|
|
224
211
|
// 输入框回显
|
|
225
212
|
useEffect(function () {
|
|
226
|
-
setInputValue(echoInputValue(recordDateValue, isFocus, locale, format, forceRenderTitle, enableAutoRefresh));
|
|
227
|
-
}, [recordDateValue, isFocus, locale, format, forceRenderTitle, enableAutoRefresh]);
|
|
213
|
+
setInputValue(echoInputValue(recordDateValue, isFocus, locale, format, forceRenderTitle, enableAutoRefresh, timeSpanBoundary));
|
|
214
|
+
}, [recordDateValue, isFocus, locale, format, forceRenderTitle, enableAutoRefresh, timeSpanBoundary]);
|
|
228
215
|
useEffect(function () {
|
|
229
216
|
var _judgeType3 = judgeType(recordDateValue),
|
|
230
217
|
_judgeType4 = _slicedToArray(_judgeType3, 1),
|
|
@@ -274,11 +261,18 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
274
261
|
recordUnit = _judgeType6[2];
|
|
275
262
|
if (enableAutoRefresh && isRule && showAutoRefresh) {
|
|
276
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
|
+
}
|
|
277
271
|
var newValue = _objectSpread(_objectSpread({}, recordDateValue), {}, {
|
|
278
272
|
timeDomain: recordUnit,
|
|
279
273
|
number: captureUnit[0],
|
|
280
274
|
unit: captureUnit[1] === "mo" ? "M" : captureUnit[1],
|
|
281
|
-
value:
|
|
275
|
+
value: _values,
|
|
282
276
|
isRecently: true
|
|
283
277
|
});
|
|
284
278
|
onAutoRefresh(newValue);
|
|
@@ -304,19 +298,27 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
304
298
|
values = funcValueChangeArrayValue(values);
|
|
305
299
|
var isHasDate = true;
|
|
306
300
|
var isRightDisabled = false;
|
|
301
|
+
var isDisabledEnlargeBtn = false;
|
|
302
|
+
var years = getYears(timeSpanBoundary);
|
|
307
303
|
if (isRule) {
|
|
308
304
|
isRightDisabled = true;
|
|
309
|
-
|
|
305
|
+
if (!values) {
|
|
306
|
+
values = getChangeUnitDate(captureUnit[0], captureUnit[1]);
|
|
307
|
+
}
|
|
308
|
+
if (captureUnit[1] === "y" && Number(captureUnit[0]) >= years) {
|
|
309
|
+
isDisabledEnlargeBtn = true;
|
|
310
|
+
}
|
|
310
311
|
}
|
|
311
312
|
if (!isRule && !values) {
|
|
312
313
|
isHasDate = false;
|
|
313
314
|
}
|
|
314
|
-
return [isHasDate, values, isRightDisabled];
|
|
315
|
-
}, [recordDateValue]),
|
|
316
|
-
_useMemo2 = _slicedToArray(_useMemo,
|
|
315
|
+
return [isHasDate, values, isRightDisabled, isDisabledEnlargeBtn];
|
|
316
|
+
}, [recordDateValue, timeSpanBoundary]),
|
|
317
|
+
_useMemo2 = _slicedToArray(_useMemo, 4),
|
|
317
318
|
isHasDate = _useMemo2[0],
|
|
318
319
|
_defaultValue = _useMemo2[1],
|
|
319
|
-
isRightDisabled = _useMemo2[2]
|
|
320
|
+
isRightDisabled = _useMemo2[2],
|
|
321
|
+
isDisabledEnlargeBtn = _useMemo2[3];
|
|
320
322
|
// 点击空白处日历切换
|
|
321
323
|
useEffect(function () {
|
|
322
324
|
document.addEventListener("click", clickBody);
|
|
@@ -437,15 +439,20 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
437
439
|
var isInvalidDate_ = isInvalidDate(returnValue.value);
|
|
438
440
|
if (!isInvalidDate_) {
|
|
439
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
|
+
}
|
|
440
447
|
_onChange(returnValue);
|
|
441
448
|
setIsFocus(false);
|
|
442
|
-
var _getHistoryInfo = getHistoryInfo(returnValue, historyList, locale, format),
|
|
449
|
+
var _getHistoryInfo = getHistoryInfo(returnValue, historyList, locale, format, timeSpanBoundary),
|
|
443
450
|
_getHistoryInfo2 = _slicedToArray(_getHistoryInfo, 2),
|
|
444
451
|
isRepeat = _getHistoryInfo2[0],
|
|
445
452
|
historyValue = _getHistoryInfo2[1];
|
|
446
453
|
if (!isRepeat) {
|
|
447
454
|
setHistoryList(function (pre) {
|
|
448
|
-
return [].concat(_toConsumableArray(pre)
|
|
455
|
+
return [historyValue].concat(_toConsumableArray(pre));
|
|
449
456
|
});
|
|
450
457
|
}
|
|
451
458
|
if (!value) {
|
|
@@ -462,15 +469,20 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
462
469
|
var _returnValue = getCorrectValue({
|
|
463
470
|
value: _dateValue2
|
|
464
471
|
});
|
|
472
|
+
var _passValue = _returnValue.value;
|
|
473
|
+
if (isExceedMaxTimeSpan(_passValue, timeSpanBoundary)) {
|
|
474
|
+
_message.error(localeObj["the-maximum-time-span-is-exceeded"]);
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
465
477
|
_onChange(_returnValue);
|
|
466
478
|
setIsFocus(false);
|
|
467
|
-
var _getHistoryInfo3 = getHistoryInfo(_returnValue, historyList, locale, format),
|
|
479
|
+
var _getHistoryInfo3 = getHistoryInfo(_returnValue, historyList, locale, format, timeSpanBoundary),
|
|
468
480
|
_getHistoryInfo4 = _slicedToArray(_getHistoryInfo3, 2),
|
|
469
481
|
_isRepeat = _getHistoryInfo4[0],
|
|
470
482
|
_historyValue = _getHistoryInfo4[1];
|
|
471
483
|
if (!_isRepeat) {
|
|
472
484
|
setHistoryList(function (pre) {
|
|
473
|
-
return [].concat(_toConsumableArray(pre)
|
|
485
|
+
return [_historyValue].concat(_toConsumableArray(pre));
|
|
474
486
|
});
|
|
475
487
|
}
|
|
476
488
|
if (!value) {
|
|
@@ -490,7 +502,8 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
490
502
|
isAutoRefresh: isAutoRefresh,
|
|
491
503
|
setIsAutoRefresh: setIsAutoRefresh,
|
|
492
504
|
refreshOption: refreshOption,
|
|
493
|
-
enableAutoRefresh: enableAutoRefresh
|
|
505
|
+
enableAutoRefresh: enableAutoRefresh,
|
|
506
|
+
timeSpanOption: timeSpanOption
|
|
494
507
|
};
|
|
495
508
|
var dropdownMenuProps = _objectSpread(_objectSpread({}, commonProps), {}, {
|
|
496
509
|
dataSource: dataSource,
|
|
@@ -505,21 +518,13 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
505
518
|
});
|
|
506
519
|
var timeSpanProps = _objectSpread(_objectSpread({}, commonProps), {}, {
|
|
507
520
|
dataSource: dataSource,
|
|
508
|
-
growSize: growSize,
|
|
509
521
|
isHasDate: isHasDate,
|
|
510
522
|
onRecover: onRecover,
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
setForwardTooltipVisible: setForwardTooltipVisible,
|
|
514
|
-
backTooltipVisible: backTooltipVisible,
|
|
515
|
-
setBackTooltipVisible: setBackTooltipVisible,
|
|
516
|
-
expandTooltipVisible: expandTooltipVisible,
|
|
517
|
-
setExpandTooltipVisible: setExpandTooltipVisible,
|
|
518
|
-
isRightDisabled: isRightDisabled
|
|
523
|
+
isRightDisabled: isRightDisabled,
|
|
524
|
+
isDisabledEnlargeBtn: isDisabledEnlargeBtn
|
|
519
525
|
});
|
|
520
526
|
var refreshProps = _objectSpread(_objectSpread({}, commonProps), {}, {
|
|
521
527
|
isHasDate: isHasDate,
|
|
522
|
-
setBackTooltipVisible: setBackTooltipVisible,
|
|
523
528
|
isClickAutoRefresh: isClickAutoRefresh
|
|
524
529
|
});
|
|
525
530
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -554,14 +559,18 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
554
559
|
_message.error(localeObj["the-selected-time-does-not-meet-the-rule-limit"]);
|
|
555
560
|
return;
|
|
556
561
|
}
|
|
562
|
+
if (isExceedMaxTimeSpan(resValue, timeSpanBoundary)) {
|
|
563
|
+
_message.error(localeObj["the-maximum-time-span-is-exceeded"]);
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
557
566
|
_onChange(_values2);
|
|
558
|
-
var _getHistoryInfo5 = getHistoryInfo(_values2, historyList, locale, format),
|
|
567
|
+
var _getHistoryInfo5 = getHistoryInfo(_values2, historyList, locale, format, timeSpanBoundary),
|
|
559
568
|
_getHistoryInfo6 = _slicedToArray(_getHistoryInfo5, 2),
|
|
560
569
|
isRepeat = _getHistoryInfo6[0],
|
|
561
570
|
historyValue = _getHistoryInfo6[1];
|
|
562
571
|
if (!isRepeat) {
|
|
563
572
|
setHistoryList(function (pre) {
|
|
564
|
-
return [].concat(_toConsumableArray(pre)
|
|
573
|
+
return [historyValue].concat(_toConsumableArray(pre));
|
|
565
574
|
});
|
|
566
575
|
}
|
|
567
576
|
if (!value) {
|
|
@@ -675,7 +684,6 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
675
684
|
});
|
|
676
685
|
CWRangePicker.defaultProps = {
|
|
677
686
|
moreItemDropdownPosition: "left",
|
|
678
|
-
growSize: 3,
|
|
679
687
|
format: "YYYY/MM/DD HH:mm:ss",
|
|
680
688
|
rangePickerFormat: "YYYY/MM/DD"
|
|
681
689
|
};
|
|
@@ -704,10 +712,6 @@ CWRangePicker.propTypes = {
|
|
|
704
712
|
* 初始时间数据进入时间返回的回调(*主要针对于最近时间)
|
|
705
713
|
*/
|
|
706
714
|
onInitChange: PropTypes.func,
|
|
707
|
-
/**
|
|
708
|
-
* 时间跨度的比例,>=2,默认为3
|
|
709
|
-
*/
|
|
710
|
-
growSize: PropTypes.number,
|
|
711
715
|
/**
|
|
712
716
|
* 提示信息TooltipOption
|
|
713
717
|
*/
|
|
@@ -10,7 +10,7 @@ export default {
|
|
|
10
10
|
recover: "Restore default",
|
|
11
11
|
forwardSmooth: "Forward smooth",
|
|
12
12
|
backSmooth: "Back smooth",
|
|
13
|
-
ExpandSpan: "
|
|
13
|
+
ExpandSpan: "Increase the time span by {span} times",
|
|
14
14
|
refresh: "Refresh",
|
|
15
15
|
autoRefresh: "Auto refresh",
|
|
16
16
|
s: "Second",
|
|
@@ -31,5 +31,6 @@ export default {
|
|
|
31
31
|
"enter manually": "You can manually enter a query statement in the following format",
|
|
32
32
|
"fit-the-input-format": "Fit the input format",
|
|
33
33
|
"does-not-match-the-input-format": "Does not match the input format",
|
|
34
|
-
"the-selected-time-does-not-meet-the-rule-limit": "If the selected time is the same or exceeds the current time, select another time"
|
|
34
|
+
"the-selected-time-does-not-meet-the-rule-limit": "If the selected time is the same or exceeds the current time, select another time",
|
|
35
|
+
"the-maximum-time-span-is-exceeded": "The maximum time span is exceeded, please re-enter"
|
|
35
36
|
};
|
|
@@ -10,7 +10,7 @@ export default {
|
|
|
10
10
|
recover: "恢复默认值",
|
|
11
11
|
forwardSmooth: "向前平滑",
|
|
12
12
|
backSmooth: "向后平滑",
|
|
13
|
-
ExpandSpan: "
|
|
13
|
+
ExpandSpan: "按{span}倍增加时间跨度",
|
|
14
14
|
refresh: "刷新",
|
|
15
15
|
autoRefresh: "自动刷新",
|
|
16
16
|
s: "秒",
|
|
@@ -31,5 +31,6 @@ export default {
|
|
|
31
31
|
"enter manually": "可根据以下类型,按查询语句格式手动输入",
|
|
32
32
|
"fit-the-input-format": "符合输入格式",
|
|
33
33
|
"does-not-match-the-input-format": "不符合输入格式,请重新输入",
|
|
34
|
-
"the-selected-time-does-not-meet-the-rule-limit": "选择的时间二者相同或者某一时间超过当前时间,请重新选择"
|
|
34
|
+
"the-selected-time-does-not-meet-the-rule-limit": "选择的时间二者相同或者某一时间超过当前时间,请重新选择",
|
|
35
|
+
"the-maximum-time-span-is-exceeded": "超过了限制的最大时间跨度,请重新输入"
|
|
35
36
|
};
|