@chaoswise/ui 2.5.7 → 2.5.9
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 +1 -1
- package/lib/Ace/ace.js +5 -6
- package/lib/Ace/diff.js +6 -7
- package/lib/Ace/split.js +5 -6
- package/lib/AdaptiveLayout/index.js +1 -1
- package/lib/Antd/Drawer.js +1 -1
- package/lib/Antd4Form/FieldList.js +1 -1
- package/lib/Antd4Form/FormItem.js +1 -1
- package/lib/Antd4Form/FormItemChildren.js +3 -4
- package/lib/Antd4Form/useForm.js +1 -1
- package/lib/BasicLayout/Breadcrumb.js +1 -1
- package/lib/BasicLayout/Sider.js +1 -1
- package/lib/CWCascader/Cascader/index.js +1 -1
- package/lib/CWCascader/rc-cascader/OptionList/Checkbox.js +1 -1
- package/lib/CWCascader/rc-cascader/OptionList/Column.js +2 -2
- package/lib/CWCascader/rc-cascader/OptionList/index.js +1 -1
- package/lib/CWCascader/rc-cascader/hooks/useEntities.js +1 -1
- package/lib/CWCascader/rc-cascader/hooks/useSearchConfig.js +1 -1
- package/lib/CWCascader/rc-cascader/hooks/useSearchOptions.js +1 -1
- package/lib/CWMessage/MessageContent/TabList/index.js +2 -2
- package/lib/CWMessage/MessageContent/index.js +2 -2
- package/lib/CWMessage/index.js +2 -2
- package/lib/CWRangePicker/DropdownMenu/index.js +1 -1
- package/lib/CWRangePicker/Refresh/index.js +1 -1
- package/lib/CWRangePicker/index.js +1 -1
- package/lib/CWRangePicker/utils/index.js +1 -1
- package/lib/CWSelect/antd-select.js +6 -7
- package/lib/CWSelect/index.js +4 -3
- package/lib/CWTable/CWTable.js +26 -20
- package/lib/CWTable/EditLine.js +1 -1
- package/lib/CWTable/FormTable.js +1 -1
- package/lib/CWTable/header.js +40 -6
- package/lib/CWTable/index.js +7 -2
- package/lib/CWTable/index.less +1 -1
- package/lib/CWTree/index.js +1 -1
- package/lib/CWTree/index.less +3 -3
- package/lib/CWTree/utils/index.js +1 -1
- package/lib/CWUpload/upload/DragList.js +1 -1
- package/lib/CWUpload/upload/Upload.js +3 -4
- package/lib/CWUpload/upload/UploadList.js +3 -4
- package/lib/Checkbox/Checkbox.js +9 -10
- package/lib/Checkbox/Group.js +11 -12
- package/lib/ColorPicker/SketchPicker/components/common/Alpha.js +8 -9
- package/lib/ColorPicker/SketchPicker/components/common/Checkboard.js +1 -1
- package/lib/ColorPicker/SketchPicker/components/common/ColorWrap.js +6 -7
- package/lib/ColorPicker/SketchPicker/components/common/EditableInput.js +11 -12
- package/lib/ColorPicker/SketchPicker/components/common/Hue.js +7 -8
- package/lib/ColorPicker/SketchPicker/components/common/Saturation.js +7 -8
- package/lib/ColorPicker/SketchPicker/components/common/Swatch.js +1 -1
- package/lib/ColorPicker/SketchPicker/components/sketch/index.js +1 -1
- package/lib/ColorPicker/SketchPicker/helpers/interaction.js +7 -8
- package/lib/ColorPicker/index.js +9 -5
- package/lib/ColorPicker/index.less +1 -1
- package/lib/ConfigProvider/ConfigProvider.js +1 -1
- package/lib/CustomScrollBar/index.js +1 -1
- package/lib/DateRangePicker/components/ExtraTimeFooter.js +1 -1
- package/lib/Documentation/Tocify.js +2 -3
- package/lib/Documentation/index.js +1 -1
- package/lib/Drawer/index.js +1 -1
- package/lib/DropdownDatePicker/DropdownMenu/index.js +1 -1
- package/lib/DropdownDatePicker/index.js +1 -1
- package/lib/DropdownDatePicker/utils/index.js +1 -1
- package/lib/EchartsArea/index.js +1 -1
- package/lib/EchartsBar/index.js +1 -1
- package/lib/EchartsBase/index.js +1 -1
- package/lib/EchartsLine/index.js +1 -1
- package/lib/ErrorBoundary/history.js +3 -5
- package/lib/ErrorBoundary/index.js +11 -9
- package/lib/FilterDropDown/DragList.js +10 -5
- package/lib/FilterDropDown/index.js +16 -7
- package/lib/FilterDropDown/index.less +0 -1
- package/lib/Flow/components/PluginWrapper.js +1 -1
- package/lib/Flow/layouts/callChain.js +1 -1
- package/lib/Flow/plugins/CommandLifeCycle.js +2 -3
- package/lib/Flow/plugins/InitSideBarPlugin.js +2 -3
- package/lib/Flow/plugins/InitToolBarPlugin.js +2 -3
- package/lib/Form/FormItem.js +1 -1
- package/lib/FormItemWrapper/index.js +1 -1
- package/lib/Formily/FieldList/index.js +1 -1
- package/lib/Formily/FormItem/index.js +1 -1
- package/lib/Formily/MegaLayout/index.js +1 -1
- package/lib/Formily/subscribeFields/index.js +1 -1
- package/lib/GlobalTabs/index.js +1 -1
- package/lib/Header/CommonIcon.js +1 -1
- package/lib/Header/UserSetting/utils.js +1 -1
- package/lib/IconSelect/components/CustomImg/index.less +5 -3
- package/lib/IconSelect/locale/en_US.js +1 -1
- package/lib/Input/InputComponent.js +1 -1
- package/lib/IntersectionInput/index.js +1 -1
- package/lib/Joyride/index.js +1 -1
- package/lib/LayoutBreadcrumb/index.js +1 -1
- package/lib/LazyLoadingTreeSelect/index.js +1 -1
- package/lib/Menu/menu/MenuItem.js +3 -4
- package/lib/Menu/menu/SubMenu.js +3 -4
- package/lib/Menu/menu/index.js +5 -7
- package/lib/Modal/Modal.js +8 -9
- package/lib/Modal/custom-backup/entiretyDrag.js +1 -1
- package/lib/Modal/index.js +1 -1
- package/lib/ModuleFederation/ErrorBoundary/index.js +3 -4
- package/lib/ModuleFederation/react-dynamic-remote-component/RemoteComponent.js +2 -2
- package/lib/ModuleFederation/react-dynamic-remote-component/load-module.js +1 -1
- package/lib/Pagination/index.js +1 -1
- package/lib/QuickRangePicker/index.js +1 -1
- package/lib/QuickTransfer/DragList.js +1 -1
- package/lib/QuickTransfer/index.js +1 -1
- package/lib/QuickTransfer/utils.js +1 -1
- package/lib/Radio/Group.js +8 -9
- package/lib/Radio/Radio.js +10 -11
- package/lib/RangePicker/components/ExtraTimeFooter.js +1 -1
- package/lib/ReactSelect/customStyles.js +1 -1
- package/lib/ReactSelect/index.js +1 -1
- package/lib/SearchBar/index.js +1 -1
- package/lib/SelectBackup/index.js +1 -1
- package/lib/SiderMenu/Item.js +3 -4
- package/lib/SiderMenu/index.js +1 -1
- package/lib/SimplePagination/index.js +1 -1
- package/lib/SingleSpa/hooks/useErrorHandle.js +1 -1
- package/lib/SingleSpa/index.js +2 -2
- package/lib/SingleSpa/singleSpa/single-spa.dev.js +1 -1
- package/lib/Tabs/index.js +1 -1
- package/lib/ThemeProvider/main.js +1 -1
- package/lib/TimeRangeSlider/Refresh/index.js +1 -1
- package/lib/TimeRangeSlider/TimeRangeSliderCmp/assets/Limit.js +126 -0
- package/lib/TimeRangeSlider/TimeRangeSliderCmp/assets/Limit.svg +50 -0
- package/lib/TimeRangeSlider/TimeRangeSliderCmp/components/BottomSlider/BottomPlaceholder.js +27 -10
- package/lib/TimeRangeSlider/TimeRangeSliderCmp/components/BottomSlider/index.js +4 -2
- package/lib/TimeRangeSlider/TimeRangeSliderCmp/components/BottomSlider/index.less +28 -8
- package/lib/TimeRangeSlider/TimeRangeSliderCmp/components/TopSlider/TopDateProcess.js +2 -6
- package/lib/TimeRangeSlider/TimeRangeSliderCmp/components/TopSlider/TopPlaceholder.js +24 -4
- package/lib/TimeRangeSlider/TimeRangeSliderCmp/components/TopSlider/index.less +31 -16
- package/lib/TimeRangeSlider/TimeRangeSliderCmp/hooks/useMouse.js +162 -87
- package/lib/TimeRangeSlider/TimeRangeSliderCmp/index.js +4 -6
- package/lib/TimeRangeSlider/TimeRangeSliderCmp/utils/index.js +29 -1
- package/lib/TimeRangeSlider/index.js +88 -12
- package/lib/TimeRangeSlider/index.less +4 -2
- package/lib/TimeRangeSlider/locale/en_US.js +2 -0
- package/lib/TimeRangeSlider/locale/zh_CN.js +2 -0
- package/lib/TimeRangeSlider/locale/zh_TW.js +2 -0
- package/lib/TimeRangeSlider/utils/index.js +26 -1
- package/lib/TooltipText/index.less +1 -0
- package/lib/TreeList/index.js +1 -1
- package/lib/TreeSelect111/index.js +1 -1
- package/lib/TreeSelect111/utils/index.js +1 -1
- package/lib/message/index.js +1 -1
- package/lib/noticeManager/globalState.js +2 -3
- package/lib/portalNoticeManager/usePortalDispatchNotice.js +1 -1
- package/lib/useLocale/index.js +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import "@chaoswise/ui/lib/Tooltip/index.less";
|
|
2
2
|
import _Tooltip from "@chaoswise/ui/lib/Tooltip";
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
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."); }
|
|
5
|
+
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); }
|
|
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
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
3
9
|
import React, { useMemo } from "react";
|
|
10
|
+
import { computeTimeSpan } from "../../utils/index";
|
|
4
11
|
import LimitAreaSvg from "../../assets/LimitAreaSvg";
|
|
12
|
+
import Limit from "../../assets/Limit";
|
|
5
13
|
import classnames from "classnames";
|
|
6
14
|
var BottomPlaceholder = function BottomPlaceholder(props) {
|
|
7
15
|
var timeSliderWidth = props.timeSliderWidth,
|
|
@@ -13,10 +21,16 @@ var BottomPlaceholder = function BottomPlaceholder(props) {
|
|
|
13
21
|
bottomSliderHoverInfo = props.bottomSliderHoverInfo,
|
|
14
22
|
bottomSliderDragStatus = props.bottomSliderDragStatus,
|
|
15
23
|
isHoverBottomWrapper = props.isHoverBottomWrapper,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
beginDrawMouseDown = props.beginDrawMouseDown,
|
|
25
|
+
visible = props.visible;
|
|
26
|
+
var _useMemo = useMemo(function () {
|
|
27
|
+
var isHasTooltipTimeDate = Array.isArray(bottomSliderInfo.date) && bottomSliderInfo.date.length === 2;
|
|
28
|
+
var timeSpan = isHasTooltipTimeDate ? computeTimeSpan(bottomSliderInfo.date) : "";
|
|
29
|
+
return [isHasTooltipTimeDate, timeSpan];
|
|
30
|
+
}, [bottomSliderInfo]),
|
|
31
|
+
_useMemo2 = _slicedToArray(_useMemo, 2),
|
|
32
|
+
isHasTooltipTimeDate = _useMemo2[0],
|
|
33
|
+
timeSpan = _useMemo2[1];
|
|
20
34
|
var isHasHoverTooltipTimeDate = useMemo(function () {
|
|
21
35
|
return Array.isArray(bottomSliderHoverInfo.date) && bottomSliderHoverInfo.date.length === 2;
|
|
22
36
|
}, [bottomSliderHoverInfo]);
|
|
@@ -26,11 +40,14 @@ var BottomPlaceholder = function BottomPlaceholder(props) {
|
|
|
26
40
|
},
|
|
27
41
|
className: "time-range-slider-bottom-clone-wrapper",
|
|
28
42
|
onClick: clickBottomWrapper,
|
|
29
|
-
ref: TimeRangeSliderBottomWrapperRef
|
|
43
|
+
ref: TimeRangeSliderBottomWrapperRef,
|
|
44
|
+
onMouseDown: beginDrawMouseDown
|
|
30
45
|
}, /*#__PURE__*/React.createElement(_Tooltip, {
|
|
31
|
-
overlayClassName: "time-range-area-limit-slider-tooltip-wrapper",
|
|
32
|
-
|
|
33
|
-
|
|
46
|
+
overlayClassName: classnames("time-range-area-limit-slider-tooltip-wrapper", {
|
|
47
|
+
"time-range-area-limit-slider-tooltip-wrapper-custom": !(bottomSliderDragStatus && isHoverBottomWrapper)
|
|
48
|
+
}),
|
|
49
|
+
title: /*#__PURE__*/React.createElement("span", null, bottomSliderDragStatus && isHoverBottomWrapper ? /*#__PURE__*/React.createElement(React.Fragment, null, bottomSliderInfo.date[0].format("YYYY/MM/DD HH:mm:ss"), " -", " ", bottomSliderInfo.date[1].format("YYYY/MM/DD HH:mm:ss")) : timeSpan),
|
|
50
|
+
visible: visible && isHasTooltipTimeDate
|
|
34
51
|
}, /*#__PURE__*/React.createElement("div", {
|
|
35
52
|
style: {
|
|
36
53
|
width: bottomSliderInfo.width,
|
|
@@ -49,12 +66,12 @@ var BottomPlaceholder = function BottomPlaceholder(props) {
|
|
|
49
66
|
onMouseDown: function onMouseDown(e) {
|
|
50
67
|
return beginMouseDown(e, "bottom", "left");
|
|
51
68
|
}
|
|
52
|
-
}, /*#__PURE__*/React.createElement(
|
|
69
|
+
}, /*#__PURE__*/React.createElement(Limit, null)), /*#__PURE__*/React.createElement("div", {
|
|
53
70
|
className: classnames("time-range-area-limit-slider-bottom-resize", "time-range-area-limit-slider-bottom-resize-right"),
|
|
54
71
|
onMouseDown: function onMouseDown(e) {
|
|
55
72
|
return beginMouseDown(e, "bottom", "right");
|
|
56
73
|
}
|
|
57
|
-
}, /*#__PURE__*/React.createElement(
|
|
74
|
+
}, /*#__PURE__*/React.createElement(Limit, null)))), isHoverBottomWrapper && !bottomSliderDragStatus && /*#__PURE__*/React.createElement(_Tooltip, {
|
|
58
75
|
overlayClassName: "time-range-area-limit-slider-tooltip-wrapper",
|
|
59
76
|
title: isHasHoverTooltipTimeDate && /*#__PURE__*/React.createElement(React.Fragment, null, bottomSliderHoverInfo.date[0].format("YYYY/MM/DD HH:mm:ss"), " -", " ", bottomSliderHoverInfo.date[1].format("YYYY/MM/DD HH:mm:ss")),
|
|
60
77
|
visible: !bottomSliderDragStatus
|
|
@@ -13,7 +13,8 @@ var Index = function Index(props) {
|
|
|
13
13
|
bottomSliderHoverInfo = props.bottomSliderHoverInfo,
|
|
14
14
|
bottomSliderDragStatus = props.bottomSliderDragStatus,
|
|
15
15
|
isHoverBottomWrapper = props.isHoverBottomWrapper,
|
|
16
|
-
|
|
16
|
+
beginDrawMouseDown = props.beginDrawMouseDown,
|
|
17
|
+
visible = props.visible;
|
|
17
18
|
return /*#__PURE__*/React.createElement("div", {
|
|
18
19
|
className: "time-range-slider-bottom-wrapper",
|
|
19
20
|
style: {
|
|
@@ -32,7 +33,8 @@ var Index = function Index(props) {
|
|
|
32
33
|
bottomSliderHoverInfo: bottomSliderHoverInfo,
|
|
33
34
|
bottomSliderDragStatus: bottomSliderDragStatus,
|
|
34
35
|
isHoverBottomWrapper: isHoverBottomWrapper,
|
|
35
|
-
|
|
36
|
+
beginDrawMouseDown: beginDrawMouseDown,
|
|
37
|
+
visible: visible
|
|
36
38
|
}));
|
|
37
39
|
};
|
|
38
40
|
export default Index;
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
right: -20px;
|
|
21
21
|
z-index: 2;
|
|
22
22
|
color: @text-color-secondary;
|
|
23
|
+
user-select: none;
|
|
23
24
|
|
|
24
25
|
}
|
|
25
26
|
|
|
@@ -28,6 +29,7 @@
|
|
|
28
29
|
border-left: @border-width-base @border-style-base @border-color-base;
|
|
29
30
|
right: -0.5px;
|
|
30
31
|
height: 12px;
|
|
32
|
+
user-select: none;
|
|
31
33
|
|
|
32
34
|
&.time-range-single-slider-bottom-cut-line-bottom {
|
|
33
35
|
bottom: 0;
|
|
@@ -45,6 +47,7 @@
|
|
|
45
47
|
right: -20px;
|
|
46
48
|
z-index: 2;
|
|
47
49
|
color: @text-color-secondary;
|
|
50
|
+
user-select: none;
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
|
|
@@ -70,15 +73,15 @@
|
|
|
70
73
|
|
|
71
74
|
.time-range-area-limit-slider-bottom-resize {
|
|
72
75
|
position: absolute;
|
|
73
|
-
left: -
|
|
74
|
-
width:
|
|
75
|
-
height:
|
|
76
|
-
top:
|
|
76
|
+
left: -3px;
|
|
77
|
+
width: 5px;
|
|
78
|
+
height: 22px;
|
|
79
|
+
top: 12px;
|
|
77
80
|
cursor: ew-resize;
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
.time-range-area-limit-slider-bottom-resize-right {
|
|
81
|
-
right: -
|
|
84
|
+
right: -3px;
|
|
82
85
|
left: auto;
|
|
83
86
|
transform: rotateY(180deg);
|
|
84
87
|
}
|
|
@@ -87,8 +90,7 @@
|
|
|
87
90
|
.time-range-area-limit-slider-bottom-hover-wrapper {
|
|
88
91
|
position: absolute;
|
|
89
92
|
z-index: 1;
|
|
90
|
-
background-color:
|
|
91
|
-
opacity: 0.1;
|
|
93
|
+
background-color: rgba(24, 144, 255, 0.1);
|
|
92
94
|
|
|
93
95
|
&::before {
|
|
94
96
|
content: '';
|
|
@@ -98,7 +100,7 @@
|
|
|
98
100
|
left: calc((100% - 1px) /2);
|
|
99
101
|
width: 1px;
|
|
100
102
|
height: 100%;
|
|
101
|
-
background-color:
|
|
103
|
+
background-color: @text-color-show;
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
106
|
}
|
|
@@ -107,6 +109,24 @@
|
|
|
107
109
|
.time-range-area-limit-slider-tooltip-wrapper {
|
|
108
110
|
max-width: 500px;
|
|
109
111
|
|
|
112
|
+
&.time-range-area-limit-slider-tooltip-wrapper-custom {
|
|
113
|
+
padding-bottom: 0;
|
|
114
|
+
.@{ant-prefix}-tooltip-content {
|
|
115
|
+
background-color: transparent !important;
|
|
116
|
+
box-shadow: none !important;
|
|
117
|
+
padding: 2px 0;
|
|
118
|
+
.@{ant-prefix}-tooltip-arrow {
|
|
119
|
+
display: none;
|
|
120
|
+
}
|
|
121
|
+
.@{ant-prefix}-tooltip-inner {
|
|
122
|
+
background-color: transparent !important;
|
|
123
|
+
color: #4e91d1;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
pointer-events: none;
|
|
110
130
|
.@{ant-prefix}-tooltip-inner {
|
|
111
131
|
white-space: nowrap !important;
|
|
112
132
|
}
|
|
@@ -24,13 +24,9 @@ var TopDateProcess = function TopDateProcess(props) {
|
|
|
24
24
|
width: width
|
|
25
25
|
},
|
|
26
26
|
key: index
|
|
27
|
-
},
|
|
28
|
-
className: "time-range-single-slider-YYYY"
|
|
29
|
-
}, YYYY), oddIndex && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
30
|
-
className: "time-range-single-slider-cut-line-MM-DD"
|
|
31
|
-
}, "|"), /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
}, oddIndex && /*#__PURE__*/React.createElement("div", {
|
|
32
28
|
className: "time-range-single-slider-MM-DD"
|
|
33
|
-
}, MM_DD))
|
|
29
|
+
}, MM_DD));
|
|
34
30
|
});
|
|
35
31
|
};
|
|
36
32
|
export default TopDateProcess;
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import "@chaoswise/ui/lib/Tooltip/index.less";
|
|
2
2
|
import _Tooltip from "@chaoswise/ui/lib/Tooltip";
|
|
3
3
|
import _Icon from "@chaoswise/ui/lib/Icon";
|
|
4
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
|
+
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."); }
|
|
6
|
+
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); }
|
|
7
|
+
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; }
|
|
8
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
9
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
4
10
|
import React, { useMemo } from "react";
|
|
11
|
+
function getClosestDay(date) {
|
|
12
|
+
var _date = _slicedToArray(date, 2),
|
|
13
|
+
startTime = _date[0],
|
|
14
|
+
endTime = _date[1];
|
|
15
|
+
var closestDay = startTime.clone().add(endTime.diff(startTime) / 2, "milliseconds");
|
|
16
|
+
return closestDay.format("MM/DD");
|
|
17
|
+
}
|
|
5
18
|
var TopPlaceholder = function TopPlaceholder(props) {
|
|
6
19
|
var TimeRangeAreaLimitSlider = props.TimeRangeAreaLimitSlider,
|
|
7
20
|
topSliderInfo = props.topSliderInfo,
|
|
@@ -10,9 +23,14 @@ var TopPlaceholder = function TopPlaceholder(props) {
|
|
|
10
23
|
beginMouseDown = props.beginMouseDown;
|
|
11
24
|
var days = timeBoundary.days;
|
|
12
25
|
var singleWidth = timeSliderWidth / days;
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
26
|
+
var _useMemo = useMemo(function () {
|
|
27
|
+
var isHasTooltipDate = Array.isArray(topSliderInfo.date) && topSliderInfo.date.length === 2;
|
|
28
|
+
var closeToDateInfo = isHasTooltipDate ? getClosestDay(topSliderInfo.date) : "";
|
|
29
|
+
return [isHasTooltipDate, closeToDateInfo];
|
|
30
|
+
}, [topSliderInfo]),
|
|
31
|
+
_useMemo2 = _slicedToArray(_useMemo, 2),
|
|
32
|
+
isHasTooltipDate = _useMemo2[0],
|
|
33
|
+
closeToDateInfo = _useMemo2[1];
|
|
16
34
|
return /*#__PURE__*/React.createElement("div", {
|
|
17
35
|
style: {
|
|
18
36
|
width: singleWidth,
|
|
@@ -31,6 +49,8 @@ var TopPlaceholder = function TopPlaceholder(props) {
|
|
|
31
49
|
}, /*#__PURE__*/React.createElement(_Icon, {
|
|
32
50
|
className: "time-range-slider-top-placeholder-inner",
|
|
33
51
|
type: "down"
|
|
34
|
-
})
|
|
52
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: "time-range-slider-top-placeholder-date-info"
|
|
54
|
+
}, closeToDateInfo))));
|
|
35
55
|
};
|
|
36
56
|
export default TopPlaceholder;
|
|
@@ -4,34 +4,43 @@
|
|
|
4
4
|
height: 28px;
|
|
5
5
|
background-color: @disabled-bg;
|
|
6
6
|
position: relative;
|
|
7
|
-
margin-bottom:
|
|
7
|
+
margin-bottom: 40px;
|
|
8
8
|
|
|
9
9
|
.time-range-single-slider {
|
|
10
10
|
position: relative;
|
|
11
11
|
height: 100%;
|
|
12
12
|
color: @text-color-secondary;
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
align-items: center;
|
|
13
16
|
|
|
14
|
-
&.time-range-single-odd-slider {
|
|
15
|
-
background-color: fade(@white, 60%);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.time-range-single-slider-YYYY,
|
|
19
17
|
.time-range-single-slider-MM-DD {
|
|
20
|
-
|
|
18
|
+
font-size: 12px;
|
|
21
19
|
height: 20px;
|
|
22
20
|
line-height: 20px;
|
|
23
|
-
width: 40px;
|
|
24
|
-
text-align: center;
|
|
25
|
-
left: -20px;
|
|
26
21
|
}
|
|
27
22
|
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
&.time-range-single-odd-slider {
|
|
24
|
+
// background-color: fade(@white, 60%);
|
|
30
25
|
}
|
|
31
26
|
|
|
32
|
-
.time-range-single-slider-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
// .time-range-single-slider-YYYY,
|
|
28
|
+
// .time-range-single-slider-MM-DD {
|
|
29
|
+
// position: absolute;
|
|
30
|
+
// height: 20px;
|
|
31
|
+
// line-height: 20px;
|
|
32
|
+
// width: 40px;
|
|
33
|
+
// text-align: center;
|
|
34
|
+
// left: -20px;
|
|
35
|
+
// }
|
|
36
|
+
|
|
37
|
+
// .time-range-single-slider-YYYY {
|
|
38
|
+
// top: -24px;
|
|
39
|
+
// }
|
|
40
|
+
|
|
41
|
+
// .time-range-single-slider-MM-DD {
|
|
42
|
+
// top: 32px;
|
|
43
|
+
// }
|
|
35
44
|
|
|
36
45
|
.time-range-single-slider-cut-line-MM-DD {
|
|
37
46
|
position: absolute;
|
|
@@ -56,10 +65,16 @@
|
|
|
56
65
|
width: 100%;
|
|
57
66
|
height: 100%;
|
|
58
67
|
position: relative;
|
|
68
|
+
display: flex;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
align-items: center;
|
|
59
71
|
border: @border-width-base @border-style-base @primary-color;
|
|
60
72
|
border-radius: 2px;
|
|
61
73
|
background-color: @component-background;
|
|
62
|
-
|
|
74
|
+
.time-range-slider-top-placeholder-date-info{
|
|
75
|
+
font-size: 12px;
|
|
76
|
+
color: @primary-color
|
|
77
|
+
}
|
|
63
78
|
.time-range-slider-top-placeholder-inner {
|
|
64
79
|
position: absolute;
|
|
65
80
|
color: @primary-color !important;
|
|
@@ -2,7 +2,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
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
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i :
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
8
|
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."); }
|
|
@@ -22,9 +22,6 @@ var useMouse = function useMouse(_ref) {
|
|
|
22
22
|
timeSliderWidth = _ref.timeSliderWidth,
|
|
23
23
|
visible = _ref.visible,
|
|
24
24
|
inputRef = _ref.inputRef,
|
|
25
|
-
TimeRangeSliderWrapperRef = _ref.TimeRangeSliderWrapperRef,
|
|
26
|
-
TimeRangeAreaLimitSlider = _ref.TimeRangeAreaLimitSlider,
|
|
27
|
-
TimeRangeAreaLimitBottomSlider = _ref.TimeRangeAreaLimitBottomSlider,
|
|
28
25
|
recordDate = _ref.recordDate,
|
|
29
26
|
TimeRangeSliderBottomWrapperRef = _ref.TimeRangeSliderBottomWrapperRef;
|
|
30
27
|
var min = timeBoundary.min,
|
|
@@ -44,7 +41,7 @@ var useMouse = function useMouse(_ref) {
|
|
|
44
41
|
var _useState5 = useState({
|
|
45
42
|
width: 0,
|
|
46
43
|
left: 0,
|
|
47
|
-
|
|
44
|
+
date: [],
|
|
48
45
|
canDrag: true
|
|
49
46
|
}),
|
|
50
47
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
@@ -53,7 +50,7 @@ var useMouse = function useMouse(_ref) {
|
|
|
53
50
|
var _useState7 = useState({
|
|
54
51
|
width: 0,
|
|
55
52
|
left: 0,
|
|
56
|
-
|
|
53
|
+
date: []
|
|
57
54
|
}),
|
|
58
55
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
59
56
|
bottomSliderHoverInfo = _useState8[0],
|
|
@@ -73,16 +70,24 @@ var useMouse = function useMouse(_ref) {
|
|
|
73
70
|
// 记录左右拖拽信息
|
|
74
71
|
initialWidth: 0,
|
|
75
72
|
// 记录初始宽度
|
|
76
|
-
|
|
73
|
+
initialMouseX: 0,
|
|
74
|
+
// 记录鼠标按下时的位置
|
|
75
|
+
initialLeft: 0,
|
|
76
|
+
cutOutInfo: {
|
|
77
|
+
canCutOut: false,
|
|
78
|
+
initialPosition: 0
|
|
79
|
+
}
|
|
77
80
|
});
|
|
78
81
|
var bottomSliderInfoRef = useRef({
|
|
79
82
|
width: 0,
|
|
80
83
|
left: 0,
|
|
81
|
-
|
|
84
|
+
date: [],
|
|
82
85
|
canDrag: true
|
|
83
86
|
});
|
|
84
87
|
var isHoverBottomWrapper = useHover(TimeRangeSliderBottomWrapperRef);
|
|
85
|
-
var
|
|
88
|
+
var millisecondsOfTheDay = moment.duration(1, "days").valueOf(); // 一天的毫秒数 86400000
|
|
89
|
+
var minWidth = min / millisecondsOfTheDay * timeSliderWidth;
|
|
90
|
+
var maxWidth = max / millisecondsOfTheDay * timeSliderWidth;
|
|
86
91
|
useEffect(function () {
|
|
87
92
|
document.addEventListener("mousemove", move);
|
|
88
93
|
document.addEventListener("mouseup", endMove);
|
|
@@ -132,6 +137,119 @@ var useMouse = function useMouse(_ref) {
|
|
|
132
137
|
}, [recordDate, recordTimeDateWrapper]);
|
|
133
138
|
var resStartLeftDate = currentMomentRef.current.clone().subtract(1, "days");
|
|
134
139
|
var resStartLeftDatePosition = getPositionInfoByDateInfo(resStartLeftDate, timeSliderWidth, currentMomentRef.current, days);
|
|
140
|
+
/**
|
|
141
|
+
* 顶部滑块拖拽中
|
|
142
|
+
* @param {*} e
|
|
143
|
+
*/
|
|
144
|
+
var topSliderMove = function topSliderMove(e) {
|
|
145
|
+
var _dragableRef$current = dragableRef.current,
|
|
146
|
+
initialMouseX = _dragableRef$current.initialMouseX,
|
|
147
|
+
initialLeft = _dragableRef$current.initialLeft;
|
|
148
|
+
// 计算当前偏移量
|
|
149
|
+
var offset = e.clientX - initialMouseX;
|
|
150
|
+
var left = Number(initialLeft + offset);
|
|
151
|
+
if (left < 0) {
|
|
152
|
+
left = 0;
|
|
153
|
+
} else if (left > resStartLeftDatePosition) {
|
|
154
|
+
left = resStartLeftDatePosition;
|
|
155
|
+
}
|
|
156
|
+
var _getDateInfoByPositio = getDateInfoByPositionInfo(left, timeSliderWidth, currentMomentRef.current, days),
|
|
157
|
+
startDate = _getDateInfoByPositio.startDate,
|
|
158
|
+
endDate = _getDateInfoByPositio.endDate;
|
|
159
|
+
var newRecordEndTimeDateWrapper = [startDate, endDate];
|
|
160
|
+
recordEndTimeDateWrapper.current = newRecordEndTimeDateWrapper;
|
|
161
|
+
setTopSliderInfo({
|
|
162
|
+
left: left,
|
|
163
|
+
date: newRecordEndTimeDateWrapper
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* 底部滑块拖拽中
|
|
168
|
+
* @param {*} e
|
|
169
|
+
*/
|
|
170
|
+
var bottomSliderMove = function bottomSliderMove(e) {
|
|
171
|
+
var _dragableRef$current2 = dragableRef.current,
|
|
172
|
+
initialMouseX = _dragableRef$current2.initialMouseX,
|
|
173
|
+
resizePosition = _dragableRef$current2.resizePosition,
|
|
174
|
+
initialWidth = _dragableRef$current2.initialWidth,
|
|
175
|
+
initialLeft = _dragableRef$current2.initialLeft;
|
|
176
|
+
// 计算当前偏移量
|
|
177
|
+
var offset = e.clientX - initialMouseX;
|
|
178
|
+
var width = initialWidth;
|
|
179
|
+
var left = initialLeft;
|
|
180
|
+
var canDrag = true;
|
|
181
|
+
if (!resizePosition) {
|
|
182
|
+
left = Number(initialLeft + offset);
|
|
183
|
+
} else if (resizePosition === "left") {
|
|
184
|
+
width = Number(initialWidth - offset);
|
|
185
|
+
left = Number(initialLeft + offset);
|
|
186
|
+
if (width < minWidth) {
|
|
187
|
+
width = minWidth;
|
|
188
|
+
left = Number(bottomSliderInfoRef.current.left + bottomSliderInfoRef.current.width - minWidth);
|
|
189
|
+
canDrag = false;
|
|
190
|
+
} else if (width > maxWidth) {
|
|
191
|
+
width = maxWidth;
|
|
192
|
+
left = Number(bottomSliderInfoRef.current.left + bottomSliderInfoRef.current.width - maxWidth);
|
|
193
|
+
canDrag = false;
|
|
194
|
+
}
|
|
195
|
+
} else {
|
|
196
|
+
width = Number(initialWidth + offset);
|
|
197
|
+
if (width < minWidth) {
|
|
198
|
+
width = minWidth;
|
|
199
|
+
canDrag = false;
|
|
200
|
+
} else if (width > maxWidth) {
|
|
201
|
+
width = maxWidth;
|
|
202
|
+
canDrag = false;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
var date = getTimeDateInfoByPositionInfo(left, width, timeSliderWidth, currentMomentRef.current, recordEndTimeDateWrapper.current, days);
|
|
206
|
+
var startDate = currentMomentRef.current.clone().subtract(days, "days");
|
|
207
|
+
var isSameOrAfterStart = isSameOrAfter(date.startDate, startDate);
|
|
208
|
+
var isSameOrAfterEnd = isSameOrAfter(currentMomentRef.current, date.endDate);
|
|
209
|
+
if (!isSameOrAfterStart || !isSameOrAfterEnd) return;
|
|
210
|
+
var newTimeDate = [date.startDate, date.endDate];
|
|
211
|
+
setBottomSliderInfo(function (pre) {
|
|
212
|
+
return _objectSpread(_objectSpread({}, pre), {}, {
|
|
213
|
+
width: width,
|
|
214
|
+
left: left,
|
|
215
|
+
date: newTimeDate,
|
|
216
|
+
canDrag: canDrag
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* 底部滑块截取拖拽中:创建新滑块并移动
|
|
222
|
+
* @param {*} e
|
|
223
|
+
*/
|
|
224
|
+
var bottomSliderCutOutMove = function bottomSliderCutOutMove(e) {
|
|
225
|
+
var initialPosition = dragableRef.current.cutOutInfo.initialPosition;
|
|
226
|
+
setBottomSliderDragStatus(true);
|
|
227
|
+
var movePosition = getOffsetLeft(e, TimeRangeSliderBottomWrapperRef);
|
|
228
|
+
var offset = movePosition - initialPosition;
|
|
229
|
+
if (Math.abs(offset) > 0) {
|
|
230
|
+
if (Math.abs(offset) >= minWidth && Math.abs(offset) <= maxWidth) {
|
|
231
|
+
var resInitialPosition = initialPosition; // 初始定位left
|
|
232
|
+
var resWidth = Math.abs(offset); // width
|
|
233
|
+
if (offset < 0) {
|
|
234
|
+
resInitialPosition = movePosition;
|
|
235
|
+
}
|
|
236
|
+
var date = getTimeDateInfoByPositionInfo(resInitialPosition, resWidth, timeSliderWidth, currentMomentRef.current, recordEndTimeDateWrapper.current, days);
|
|
237
|
+
var startDate = currentMomentRef.current.clone().subtract(days, "days");
|
|
238
|
+
var isSameOrAfterStart = isSameOrAfter(date.startDate, startDate);
|
|
239
|
+
var isSameOrAfterEnd = isSameOrAfter(currentMomentRef.current, date.endDate);
|
|
240
|
+
if (!isSameOrAfterStart || !isSameOrAfterEnd) return;
|
|
241
|
+
var newTimeDate = [date.startDate, date.endDate];
|
|
242
|
+
setBottomSliderInfo(function (pre) {
|
|
243
|
+
return _objectSpread(_objectSpread({}, pre), {}, {
|
|
244
|
+
width: resWidth,
|
|
245
|
+
left: resInitialPosition,
|
|
246
|
+
date: newTimeDate,
|
|
247
|
+
canDrag: true
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
};
|
|
135
253
|
/**
|
|
136
254
|
* 拖拽中
|
|
137
255
|
* @param {*} e : 事件对象
|
|
@@ -148,80 +266,22 @@ var useMouse = function useMouse(_ref) {
|
|
|
148
266
|
width: hoverWidth,
|
|
149
267
|
date: hoverTimeDate
|
|
150
268
|
});
|
|
269
|
+
var canCutOut = dragableRef.current.cutOutInfo.canCutOut;
|
|
151
270
|
isHandleClickRef.current = e.buttons !== 1; // e.buttons === 1 为鼠标左键按下
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
271
|
+
if (canCutOut && !isHandleClickRef.current) {
|
|
272
|
+
// 截取
|
|
273
|
+
bottomSliderCutOutMove(e);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
var _dragableRef$current3 = dragableRef.current,
|
|
277
|
+
status = _dragableRef$current3.status,
|
|
278
|
+
position = _dragableRef$current3.position;
|
|
158
279
|
if (!status) return;
|
|
159
|
-
var TimeRangeSliderWrapper = TimeRangeSliderWrapperRef.current;
|
|
160
|
-
var TimeRangeAreaLimitSliderDom = TimeRangeAreaLimitSlider.current;
|
|
161
|
-
// 计算当前偏移量
|
|
162
|
-
var newLeft = e.clientX - beginX;
|
|
163
280
|
if (position === "top") {
|
|
164
|
-
|
|
165
|
-
if (newLeft > resStartLeftDatePosition) {
|
|
166
|
-
newLeft = resStartLeftDatePosition;
|
|
167
|
-
}
|
|
168
|
-
var _getDateInfoByPositio = getDateInfoByPositionInfo(newLeft, timeSliderWidth, currentMomentRef.current, days),
|
|
169
|
-
startDate = _getDateInfoByPositio.startDate,
|
|
170
|
-
endDate = _getDateInfoByPositio.endDate;
|
|
171
|
-
var newRecordEndTimeDateWrapper = [startDate, endDate];
|
|
172
|
-
recordEndTimeDateWrapper.current = newRecordEndTimeDateWrapper;
|
|
173
|
-
setTopSliderInfo({
|
|
174
|
-
left: newLeft,
|
|
175
|
-
date: newRecordEndTimeDateWrapper
|
|
176
|
-
});
|
|
177
|
-
}
|
|
281
|
+
topSliderMove(e);
|
|
178
282
|
}
|
|
179
283
|
if (position === "bottom") {
|
|
180
|
-
|
|
181
|
-
var _left = bottomSliderInfoRef.current.left;
|
|
182
|
-
var millisecondsOfTheDay = moment.duration(1, "days").valueOf(); // 一天的毫秒数 86400000
|
|
183
|
-
var minWidth = min / millisecondsOfTheDay * timeSliderWidth;
|
|
184
|
-
var maxWidth = max / millisecondsOfTheDay * timeSliderWidth;
|
|
185
|
-
var canDrag = true;
|
|
186
|
-
if (!resizePosition) {
|
|
187
|
-
_left = newLeft;
|
|
188
|
-
} else if (resizePosition === "left") {
|
|
189
|
-
var diffLeft = _left - newLeft;
|
|
190
|
-
width = Number(width + diffLeft);
|
|
191
|
-
_left = newLeft;
|
|
192
|
-
if (width < minWidth) {
|
|
193
|
-
width = minWidth;
|
|
194
|
-
_left = Number(bottomSliderInfoRef.current.left + bottomSliderInfoRef.current.width - minWidth);
|
|
195
|
-
canDrag = false;
|
|
196
|
-
} else if (width > maxWidth) {
|
|
197
|
-
width = maxWidth;
|
|
198
|
-
_left = Number(bottomSliderInfoRef.current.left + bottomSliderInfoRef.current.width - maxWidth);
|
|
199
|
-
canDrag = false;
|
|
200
|
-
}
|
|
201
|
-
} else {
|
|
202
|
-
width = Number(initialWidth + newLeft);
|
|
203
|
-
if (width < minWidth) {
|
|
204
|
-
width = minWidth;
|
|
205
|
-
canDrag = false;
|
|
206
|
-
} else if (width > maxWidth) {
|
|
207
|
-
width = maxWidth;
|
|
208
|
-
canDrag = false;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
var date = getTimeDateInfoByPositionInfo(_left, width, timeSliderWidth, currentMomentRef.current, recordEndTimeDateWrapper.current, days);
|
|
212
|
-
var _startDate = currentMomentRef.current.clone().subtract(days, "days");
|
|
213
|
-
var isSameOrAfterStart = isSameOrAfter(date.startDate, _startDate);
|
|
214
|
-
var isSameOrAfterEnd = isSameOrAfter(currentMomentRef.current, date.endDate);
|
|
215
|
-
if (!isSameOrAfterStart || !isSameOrAfterEnd) return;
|
|
216
|
-
var newTimeDate = [date.startDate, date.endDate];
|
|
217
|
-
setBottomSliderInfo(function (pre) {
|
|
218
|
-
return _objectSpread(_objectSpread({}, pre), {}, {
|
|
219
|
-
width: width,
|
|
220
|
-
left: _left,
|
|
221
|
-
date: newTimeDate,
|
|
222
|
-
canDrag: canDrag
|
|
223
|
-
});
|
|
224
|
-
});
|
|
284
|
+
bottomSliderMove(e);
|
|
225
285
|
}
|
|
226
286
|
};
|
|
227
287
|
/**
|
|
@@ -246,7 +306,12 @@ var useMouse = function useMouse(_ref) {
|
|
|
246
306
|
position: undefined,
|
|
247
307
|
initialWidth: 0,
|
|
248
308
|
resizePosition: undefined,
|
|
249
|
-
|
|
309
|
+
initialMouseX: 0,
|
|
310
|
+
initialLeft: 0,
|
|
311
|
+
cutOutInfo: {
|
|
312
|
+
canCutOut: false,
|
|
313
|
+
initialPosition: 0
|
|
314
|
+
}
|
|
250
315
|
});
|
|
251
316
|
setBottomSliderInfo(function (pre) {
|
|
252
317
|
return _objectSpread(_objectSpread({}, pre), {}, {
|
|
@@ -263,13 +328,10 @@ var useMouse = function useMouse(_ref) {
|
|
|
263
328
|
var beginMouseDown = function beginMouseDown(e, position, resizePosition) {
|
|
264
329
|
e.stopPropagation();
|
|
265
330
|
e.preventDefault();
|
|
266
|
-
var TimeRangeAreaLimitSliderDom = TimeRangeAreaLimitSlider.current;
|
|
267
|
-
var TimeRangeAreaLimitBottomSliderDom = TimeRangeAreaLimitBottomSlider.current;
|
|
268
331
|
var X = e.clientX;
|
|
332
|
+
var initialLeft = bottomSliderInfo.left;
|
|
269
333
|
if (position === "top") {
|
|
270
|
-
|
|
271
|
-
} else if (position === "bottom" && resizePosition !== "right") {
|
|
272
|
-
X = e.clientX - TimeRangeAreaLimitBottomSliderDom.offsetLeft;
|
|
334
|
+
initialLeft = topSliderInfo.left;
|
|
273
335
|
}
|
|
274
336
|
var status = true;
|
|
275
337
|
setBottomSliderDragStatus(status);
|
|
@@ -278,9 +340,10 @@ var useMouse = function useMouse(_ref) {
|
|
|
278
340
|
position: position,
|
|
279
341
|
resizePosition: resizePosition,
|
|
280
342
|
// 左右拖拽
|
|
281
|
-
initialWidth:
|
|
343
|
+
initialWidth: bottomSliderInfo.width,
|
|
282
344
|
// 左右拖拽
|
|
283
|
-
|
|
345
|
+
initialMouseX: X,
|
|
346
|
+
initialLeft: initialLeft
|
|
284
347
|
});
|
|
285
348
|
};
|
|
286
349
|
/**
|
|
@@ -309,6 +372,18 @@ var useMouse = function useMouse(_ref) {
|
|
|
309
372
|
});
|
|
310
373
|
onChange(returnValue);
|
|
311
374
|
};
|
|
375
|
+
var beginDrawMouseDown = function beginDrawMouseDown(e) {
|
|
376
|
+
e.stopPropagation();
|
|
377
|
+
e.preventDefault();
|
|
378
|
+
var initialPosition = getOffsetLeft(e, TimeRangeSliderBottomWrapperRef);
|
|
379
|
+
dragableRef.current = _objectSpread(_objectSpread({}, dragableRef.current), {}, {
|
|
380
|
+
position: "bottom",
|
|
381
|
+
cutOutInfo: {
|
|
382
|
+
canCutOut: true,
|
|
383
|
+
initialPosition: initialPosition
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
};
|
|
312
387
|
return {
|
|
313
388
|
topSliderInfo: topSliderInfo,
|
|
314
389
|
bottomSliderInfo: bottomSliderInfo,
|
|
@@ -319,7 +394,7 @@ var useMouse = function useMouse(_ref) {
|
|
|
319
394
|
bottomSliderHoverInfo: bottomSliderHoverInfo,
|
|
320
395
|
bottomSliderDragStatus: bottomSliderDragStatus,
|
|
321
396
|
isHoverBottomWrapper: isHoverBottomWrapper,
|
|
322
|
-
|
|
397
|
+
beginDrawMouseDown: beginDrawMouseDown
|
|
323
398
|
};
|
|
324
399
|
};
|
|
325
400
|
export default useMouse;
|