@cloud-app-dev/vidc 4.0.15 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dumirc.ts +2 -18
- package/.eslintrc.js +3 -0
- package/.fatherrc.ts +0 -7
- package/es/AppContext/Sync.d.ts +1 -2
- package/es/AppContext/index.d.ts +10 -3
- package/es/AppContext/index.js +14 -4
- package/es/AppContext/interface.d.ts +1 -0
- package/es/CheckGroupFixed/demo.d.ts +1 -2
- package/es/CheckGroupFixed/demo.js +7 -12
- package/es/CheckGroupFixed/index.d.ts +7 -3
- package/es/CheckGroupFixed/index.js +9 -9
- package/es/CheckGroupFixed/style.d.ts +6 -0
- package/es/CheckGroupFixed/style.js +9 -0
- package/es/Config/index.js +1 -1
- package/es/CustomRenderSelect/index.d.ts +3 -2
- package/es/CustomRenderSelect/index.js +13 -10
- package/es/DBTools/index.js +1 -2
- package/es/DisableMark/index.d.ts +1 -2
- package/es/DisableMark/index.js +5 -2
- package/es/DomMove/demo.d.ts +1 -2
- package/es/DomMove/demo.js +0 -1
- package/es/DomMove/index.js +7 -8
- package/es/DynamicGridList/demo.d.ts +2 -0
- package/es/DynamicGridList/index.d.ts +1 -1
- package/es/DynamicGridList/index.js +3 -3
- package/es/DynamicList/demo.d.ts +1 -2
- package/es/DynamicList/demo.js +14 -19
- package/es/DynamicList/index.d.ts +1 -2
- package/es/DynamicList/index.js +10 -8
- package/es/ErrorFallback/index.d.ts +1 -2
- package/es/EventTools/index.d.ts +1 -1
- package/es/GridList/demo.d.ts +2 -0
- package/es/GridList/{Demo.js → demo.js} +1 -1
- package/es/GridList/hook.js +2 -2
- package/es/GridList/index.d.ts +0 -1
- package/es/GridList/index.js +5 -2
- package/es/HightLevel/index.d.ts +1 -2
- package/es/HightLevel/index.js +2 -3
- package/es/IconFont/index.d.ts +1 -1
- package/es/LabelValue/index.d.ts +1 -2
- package/es/LabelValue/index.js +5 -2
- package/es/List/demo.d.ts +1 -2
- package/es/List/demo.js +1 -2
- package/es/List/index.d.ts +2 -3
- package/es/List/index.js +25 -17
- package/es/ListWithSizeAnimate/demo.d.ts +1 -2
- package/es/ListWithSizeAnimate/index.d.ts +0 -1
- package/es/ListWithSizeAnimate/index.js +19 -10
- package/es/LoaderScript/index.d.ts +1 -1
- package/es/Picture/component/DefaultRects/RectInfo.d.ts +1 -2
- package/es/Picture/component/DefaultRects/RectInfo.js +6 -4
- package/es/Picture/component/DefaultRects/index.d.ts +1 -3
- package/es/Picture/component/DefaultRects/index.js +5 -5
- package/es/Picture/component/DefaultRects/style.d.ts +10 -0
- package/es/Picture/component/DefaultRects/style.js +28 -0
- package/es/Picture/component/DrawRect/index.d.ts +1 -3
- package/es/Picture/component/DrawRect/index.js +6 -3
- package/es/Picture/component/RectMenu/index.d.ts +1 -3
- package/es/Picture/component/RectMenu/index.js +13 -8
- package/es/Picture/component/Tools/index.d.ts +1 -2
- package/es/Picture/component/Tools/index.js +21 -9
- package/es/Picture/component/Tools/style.d.ts +2 -0
- package/es/Picture/component/Tools/style.js +5 -0
- package/es/Picture/component/WheelScale/index.d.ts +1 -2
- package/es/Picture/demo.d.ts +1 -2
- package/es/Picture/demo.js +1 -1
- package/es/Picture/index.d.ts +1 -3
- package/es/Picture/index.js +21 -19
- package/es/Picture/useDraw.js +4 -4
- package/es/Player/api/index.d.ts +1 -1
- package/es/Player/api/index.js +44 -18
- package/es/Player/context.d.ts +1 -1
- package/es/Player/contraller_bar/bar.d.ts +1 -1
- package/es/Player/contraller_bar/bar.js +5 -1
- package/es/Player/contraller_bar/contraller_event.d.ts +1 -1
- package/es/Player/contraller_bar/contraller_event.js +4 -5
- package/es/Player/contraller_bar/index.d.ts +1 -2
- package/es/Player/contraller_bar/index.js +8 -2
- package/es/Player/contraller_bar/left_bar.d.ts +1 -1
- package/es/Player/contraller_bar/left_bar.js +12 -3
- package/es/Player/contraller_bar/right_bar.d.ts +1 -1
- package/es/Player/contraller_bar/right_bar.js +1 -2
- package/es/Player/contraller_bar/time.d.ts +1 -2
- package/es/Player/contraller_bar/time.js +5 -2
- package/es/Player/contraller_bar/volume.d.ts +1 -2
- package/es/Player/contraller_bar/volume.js +11 -6
- package/es/Player/demo.d.ts +1 -2
- package/es/Player/demo.js +41 -29
- package/es/Player/empty.d.ts +1 -2
- package/es/Player/empty.js +0 -1
- package/es/Player/event/index.d.ts +1 -1
- package/es/Player/event/index.js +4 -3
- package/es/Player/fps_play.d.ts +1 -2
- package/es/Player/fps_play.js +6 -2
- package/es/Player/frontend_player.d.ts +1 -2
- package/es/Player/frontend_player.js +4 -5
- package/es/Player/frontend_timeline.d.ts +1 -3
- package/es/Player/frontend_timeline.js +16 -8
- package/es/Player/iconfont.d.ts +1 -2
- package/es/Player/iconfont.js +1 -2
- package/es/Player/live_heart.js +8 -9
- package/es/Player/message.d.ts +2 -4
- package/es/Player/message.js +16 -7
- package/es/Player/player.d.ts +2 -0
- package/es/Player/segment_player.d.ts +1 -2
- package/es/Player/segment_player.js +4 -5
- package/es/Player/segment_timeline.d.ts +1 -3
- package/es/Player/segment_timeline.js +19 -9
- package/es/Player/single_player.d.ts +0 -1
- package/es/Player/single_player.js +18 -15
- package/es/Player/timeline.d.ts +5 -3
- package/es/Player/timeline.js +10 -4
- package/es/Player/util.d.ts +2 -2
- package/es/Player/util.js +2 -2
- package/es/PlayerExt/demo.d.ts +1 -2
- package/es/PlayerExt/demo.js +3 -3
- package/es/PlayerExt/index.d.ts +1 -2
- package/es/PlayerExt/index.js +10 -5
- package/es/Progress/index.d.ts +1 -3
- package/es/Progress/index.js +7 -3
- package/es/ROI/demo.d.ts +1 -2
- package/es/ROI/demo.js +1 -2
- package/es/ROI/index.d.ts +1 -2
- package/es/ROI/index.js +17 -7
- package/es/RefDrawer/Footer.d.ts +1 -1
- package/es/RefDrawer/index.d.ts +1 -1
- package/es/RefDrawer/index.js +2 -2
- package/es/RefModal/demo.d.ts +1 -2
- package/es/RefModal/index.d.ts +1 -1
- package/es/RefModal/index.js +2 -2
- package/es/ScreenPlayer/Live.d.ts +1 -3
- package/es/ScreenPlayer/Live.js +10 -11
- package/es/ScreenPlayer/LiveTools.d.ts +5 -1
- package/es/ScreenPlayer/LiveTools.js +14 -9
- package/es/ScreenPlayer/PlayerWithExt.d.ts +3 -3
- package/es/ScreenPlayer/PlayerWithExt.js +14 -13
- package/es/ScreenPlayer/RatePick.d.ts +1 -2
- package/es/ScreenPlayer/RatePick.js +9 -4
- package/es/ScreenPlayer/Record.d.ts +1 -3
- package/es/ScreenPlayer/Record.js +27 -22
- package/es/ScreenPlayer/RecordTools.d.ts +1 -1
- package/es/ScreenPlayer/RecordTools.js +11 -13
- package/es/ScreenPlayer/ScreenSelect.d.ts +1 -2
- package/es/ScreenPlayer/ScreenSelect.js +11 -3
- package/es/ScreenPlayer/SegmentTimeLine.d.ts +1 -2
- package/es/ScreenPlayer/SegmentTimeLine.js +12 -6
- package/es/ScreenPlayer/TimeMode.d.ts +1 -2
- package/es/ScreenPlayer/TimeMode.js +7 -3
- package/es/ScreenPlayer/TimeSelect.d.ts +1 -2
- package/es/ScreenPlayer/TimeSelect.js +10 -5
- package/es/ScreenPlayer/containerStyle.d.ts +13 -0
- package/es/ScreenPlayer/containerStyle.js +32 -0
- package/es/ScreenPlayer/demo.d.ts +1 -2
- package/es/ScreenPlayer/demo.js +8 -13
- package/es/ScreenPlayer/demo2.d.ts +1 -2
- package/es/ScreenPlayer/demo2.js +112 -116
- package/es/ScreenPlayer/index.d.ts +2 -2
- package/es/ScreenPlayer/useTimeSlider.d.ts +2 -2
- package/es/ScreenPlayer/useTimeSlider.js +16 -15
- package/es/ScreenPlayer/useVideoFit.js +2 -2
- package/es/SocketEmitter/eventEmitter.d.ts +1 -1
- package/es/TableLayout/index.d.ts +1 -2
- package/es/TableLayout/index.js +7 -4
- package/es/Timeout/index.d.ts +1 -2
- package/es/Timeout/index.js +4 -5
- package/es/cache/index.d.ts +1 -1
- package/es/cache/index.js +21 -21
- package/es/index.d.ts +3 -11
- package/es/index.js +3 -11
- package/es/likeGo/index.d.ts +2 -0
- package/es/{Map/Config/utils.js → likeGo/index.js} +15 -49
- package/es/likeGoSync/index.d.ts +2 -0
- package/es/likeGoSync/index.js +10 -0
- package/es/logger/index.d.ts +4 -4
- package/es/nextTick/index.d.ts +1 -1
- package/es/nextTick/index.js +2 -6
- package/es/recorder/demo.d.ts +2 -0
- package/es/recorder/demo.js +200 -0
- package/es/recorder/index.d.ts +294 -0
- package/es/recorder/index.js +991 -0
- package/es/useDrawROI/index.js +8 -12
- package/es/useEventEmitterHandle/index.js +2 -2
- package/es/useInfiniteScroll/index.d.ts +1 -1
- package/es/useInfiniteScroll/index.js +8 -7
- package/es/useRafInterval/index.js +2 -2
- package/es/useSimpleState/index.js +3 -4
- package/es/useVirtualList/index.d.ts +1 -1
- package/es/useVirtualList/index.js +5 -8
- package/es/utils.d.ts +4 -4
- package/es/utils.js +1 -30
- package/es/uuid/index.d.ts +2 -1
- package/es/uuid/index.js +3 -12
- package/package.json +36 -37
- package/release-build.sh +3 -2
- package/scripts/{entry.js → entry.mjs} +4 -6
- package/{icon-fix.js → scripts/icon-fix.mjs} +4 -3
- package/tsconfig.json +1 -1
- package/es/Auth/index.d.ts +0 -8
- package/es/Auth/index.js +0 -18
- package/es/AutoExit/index.d.ts +0 -6
- package/es/AutoExit/index.js +0 -23
- package/es/CheckGroupFixed/index.less +0 -53
- package/es/ConfigContext/index.d.ts +0 -22
- package/es/ConfigContext/index.js +0 -25
- package/es/CustomRenderSelect/index.less +0 -25
- package/es/DisableMark/index.less +0 -9
- package/es/DynamicGridList/Demo.d.ts +0 -3
- package/es/DynamicList/index.less +0 -17
- package/es/FullScreen/index.d.ts +0 -22
- package/es/FullScreen/index.js +0 -36
- package/es/FullScreen/index.less +0 -18
- package/es/GridList/Demo.d.ts +0 -3
- package/es/GridList/index.less +0 -8
- package/es/HightLevel/index.less +0 -3
- package/es/ImageView/index.d.ts +0 -17
- package/es/ImageView/index.js +0 -58
- package/es/ImageView/index.less +0 -11
- package/es/LabelPlayer/111.png +0 -0
- package/es/LabelPlayer/demo.d.ts +0 -2
- package/es/LabelPlayer/demo.js +0 -123
- package/es/LabelPlayer/index.d.ts +0 -21
- package/es/LabelPlayer/index.js +0 -169
- package/es/LabelPlayer/index.less +0 -24
- package/es/LabelValue/index.less +0 -23
- package/es/List/index.less +0 -13
- package/es/ListWithSizeAnimate/index.less +0 -23
- package/es/Map/AMap.d.ts +0 -7109
- package/es/Map/BasicMap/AMapInstance.d.ts +0 -19
- package/es/Map/BasicMap/AMapInstance.js +0 -98
- package/es/Map/BasicMap/LeafletInstance.d.ts +0 -18
- package/es/Map/BasicMap/LeafletInstance.js +0 -111
- package/es/Map/BasicMap/index.d.ts +0 -9
- package/es/Map/BasicMap/index.js +0 -98
- package/es/Map/BasicMap/index.less +0 -29
- package/es/Map/ClusterLayer/demo.d.ts +0 -3
- package/es/Map/ClusterLayer/demo.js +0 -22
- package/es/Map/ClusterLayer/hook.d.ts +0 -5
- package/es/Map/ClusterLayer/hook.js +0 -124
- package/es/Map/ClusterLayer/index.d.ts +0 -6
- package/es/Map/ClusterLayer/index.js +0 -32
- package/es/Map/ClusterLayer/index.less +0 -29
- package/es/Map/ClusterLayer/props.d.ts +0 -8
- package/es/Map/Config/index.d.ts +0 -9
- package/es/Map/Config/index.js +0 -52
- package/es/Map/Config/utils.d.ts +0 -2
- package/es/Map/Context/index.d.ts +0 -11
- package/es/Map/Context/index.js +0 -56
- package/es/Map/FindPio/index.d.ts +0 -4
- package/es/Map/FindPio/index.js +0 -14
- package/es/Map/FindPio/index.less +0 -7
- package/es/Map/InfoWindow/MakerLikeWindow.d.ts +0 -4
- package/es/Map/InfoWindow/MakerLikeWindow.js +0 -113
- package/es/Map/InfoWindow/demo.d.ts +0 -3
- package/es/Map/InfoWindow/demo.js +0 -76
- package/es/Map/InfoWindow/index.d.ts +0 -11
- package/es/Map/InfoWindow/index.js +0 -67
- package/es/Map/LevelCenter/DragMarker/index.d.ts +0 -10
- package/es/Map/LevelCenter/DragMarker/index.js +0 -44
- package/es/Map/LevelCenter/demo.d.ts +0 -3
- package/es/Map/LevelCenter/demo.js +0 -46
- package/es/Map/LevelCenter/index.d.ts +0 -15
- package/es/Map/LevelCenter/index.js +0 -71
- package/es/Map/LoaderMap/index.d.ts +0 -12
- package/es/Map/LoaderMap/index.js +0 -71
- package/es/Map/MapDrawSelect/demo.d.ts +0 -3
- package/es/Map/MapDrawSelect/demo.js +0 -79
- package/es/Map/MapDrawSelect/index.d.ts +0 -15
- package/es/Map/MapDrawSelect/index.js +0 -62
- package/es/Map/MouseTool/index.d.ts +0 -10
- package/es/Map/MouseTool/index.js +0 -44
- package/es/Map/MouseTool/useMouseTools.d.ts +0 -7
- package/es/Map/MouseTool/useMouseTools.js +0 -83
- package/es/Map/ResetTools/index.d.ts +0 -10
- package/es/Map/ResetTools/index.js +0 -67
- package/es/Map/ResetTools/index.less +0 -39
- package/es/Map/SinglePoint/demo.d.ts +0 -3
- package/es/Map/SinglePoint/demo.js +0 -16
- package/es/Map/SinglePoint/index.d.ts +0 -27
- package/es/Map/SinglePoint/index.js +0 -57
- package/es/Map/SinglePoint/index.less +0 -41
- package/es/Map/hook/useMapEvent.d.ts +0 -2
- package/es/Map/hook/useMapEvent.js +0 -19
- package/es/Map/hook/useMapType.d.ts +0 -4
- package/es/Map/hook/useMapType.js +0 -12
- package/es/Map/icon.d.ts +0 -2
- package/es/Map/icon.js +0 -10
- package/es/Map/index.d.ts +0 -24
- package/es/Map/index.js +0 -25
- package/es/Map/interface.d.ts +0 -74
- package/es/Map/points.d.ts +0 -74
- package/es/Map/points.js +0 -1
- package/es/Map/useMarker/index.d.ts +0 -10
- package/es/Map/useMarker/index.js +0 -71
- package/es/Map/withMap/index.d.ts +0 -3
- package/es/Map/withMap/index.js +0 -18
- package/es/Picture/component/DefaultRects/index.less +0 -211
- package/es/Picture/component/DrawRect/index.less +0 -8
- package/es/Picture/component/RectMenu/index.less +0 -36
- package/es/Picture/component/Tools/index.less +0 -49
- package/es/Picture/index.less +0 -20
- package/es/Player/style/bar.less +0 -43
- package/es/Player/style/index.less +0 -34
- package/es/Player/style/message.less +0 -56
- package/es/Player/style/slider.less +0 -106
- package/es/Player/style/timeline.less +0 -116
- package/es/Player/style/volume.less +0 -24
- package/es/PlayerExt/index.less +0 -10
- package/es/Progress/index.less +0 -21
- package/es/ROI/index.less +0 -33
- package/es/ScreenPlayer/index.less +0 -335
- package/es/TableLayout/index.less +0 -4
- package/es/ThemeAntd/demo.d.ts +0 -4
- package/es/ThemeAntd/demo.js +0 -129
- package/es/ThemeAntd/demo.less +0 -20
- package/es/ThemeAntd/index.d.ts +0 -7
- package/es/ThemeAntd/index.js +0 -23
- package/es/ThemeAntd/index.less +0 -4
- package/es/VList/index.d.ts +0 -11
- package/es/VList/index.js +0 -42
- package/es/VList/index.less +0 -6
- package/es/VList/utils.d.ts +0 -14
- package/es/VList/utils.js +0 -17
- package/es/bigNumberTransformCN/index.d.ts +0 -5
- package/es/bigNumberTransformCN/index.js +0 -60
- package/es/useFullscreen/demo.d.ts +0 -2
- package/es/useFullscreen/demo.js +0 -48
- package/es/useFullscreen/index.d.ts +0 -12
- package/es/useFullscreen/index.js +0 -76
- /package/es/DynamicGridList/{Demo.js → demo.js} +0 -0
package/es/useDrawROI/index.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
import _useEventListener from "ahooks/es/useEventListener";
|
|
3
|
-
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
4
|
-
import _usePrevious from "ahooks/es/usePrevious";
|
|
5
|
-
import _useSize from "ahooks/es/useSize";
|
|
6
|
-
import _useLatest from "ahooks/es/useLatest";
|
|
7
2
|
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
|
8
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
9
4
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -23,6 +18,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
23
18
|
import booleanDisjoint from '@turf/boolean-disjoint';
|
|
24
19
|
import { lineString } from '@turf/helpers';
|
|
25
20
|
import lineToPolygon from '@turf/line-to-polygon';
|
|
21
|
+
import { useEventListener, useLatest, usePrevious, useSize, useUpdateEffect } from 'ahooks';
|
|
26
22
|
import { getTargetElement } from 'ahooks/lib/utils/domTarget';
|
|
27
23
|
import { useEffect, useMemo } from 'react';
|
|
28
24
|
import { useHotkeys } from 'react-hotkeys-hook';
|
|
@@ -41,9 +37,9 @@ function useDrawROI(target, _ref) {
|
|
|
41
37
|
state = _useSimpleState2[0],
|
|
42
38
|
updateState = _useSimpleState2[1],
|
|
43
39
|
setState = _useSimpleState2[2];
|
|
44
|
-
var isOpenRef =
|
|
45
|
-
var size =
|
|
46
|
-
var oldSize =
|
|
40
|
+
var isOpenRef = useLatest(state.isOpen);
|
|
41
|
+
var size = useSize(target);
|
|
42
|
+
var oldSize = usePrevious(size);
|
|
47
43
|
useEffect(function () {
|
|
48
44
|
if (!(size !== null && size !== void 0 && size.width)) {
|
|
49
45
|
return;
|
|
@@ -69,14 +65,14 @@ function useDrawROI(target, _ref) {
|
|
|
69
65
|
});
|
|
70
66
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
71
67
|
}, [size === null || size === void 0 ? void 0 : size.height, size === null || size === void 0 ? void 0 : size.width]);
|
|
72
|
-
|
|
68
|
+
useUpdateEffect(function () {
|
|
73
69
|
if (state.saveArea.length === 0 && defaultAreas && defaultAreas.length > 0) {
|
|
74
70
|
updateState({
|
|
75
71
|
saveArea: defaultAreas
|
|
76
72
|
});
|
|
77
73
|
}
|
|
78
74
|
}, [defaultAreas, state.saveArea]);
|
|
79
|
-
|
|
75
|
+
useEventListener('click', function (event) {
|
|
80
76
|
if (!isOpenRef.current) {
|
|
81
77
|
return;
|
|
82
78
|
}
|
|
@@ -101,7 +97,7 @@ function useDrawROI(target, _ref) {
|
|
|
101
97
|
}, {
|
|
102
98
|
target: target
|
|
103
99
|
});
|
|
104
|
-
|
|
100
|
+
useEventListener('dblclick', function (event) {
|
|
105
101
|
var p_x = event.offsetX;
|
|
106
102
|
var p_y = event.offsetY;
|
|
107
103
|
setState(function (old) {
|
|
@@ -131,7 +127,7 @@ function useDrawROI(target, _ref) {
|
|
|
131
127
|
}, {
|
|
132
128
|
target: target
|
|
133
129
|
});
|
|
134
|
-
|
|
130
|
+
useEventListener('mousemove', function (event) {
|
|
135
131
|
if (!isOpenRef.current || state.pos.length === 0) {
|
|
136
132
|
return;
|
|
137
133
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useLatest } from 'ahooks';
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
import SocketEmitter from "../SocketEmitter";
|
|
4
4
|
function useEventEmitterHandle(eventName, handle) {
|
|
5
|
-
var handlerRef =
|
|
5
|
+
var handlerRef = useLatest(handle);
|
|
6
6
|
useEffect(function () {
|
|
7
7
|
var eventListener = function eventListener(event) {
|
|
8
8
|
return handlerRef.current(event);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
3
|
-
import _useEventListener from "ahooks/es/useEventListener";
|
|
4
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
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; }
|
|
@@ -12,6 +10,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
12
10
|
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; }
|
|
13
11
|
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; } }
|
|
14
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { useDebounceFn, useEventListener, useUpdateEffect } from 'ahooks';
|
|
15
14
|
import { getTargetElement } from 'ahooks/es/utils/domTarget';
|
|
16
15
|
import { getClientHeight, getScrollHeight, getScrollTop } from 'ahooks/es/utils/rect';
|
|
17
16
|
import { useEffect, useMemo, useState } from 'react';
|
|
@@ -62,7 +61,7 @@ function useInfiniteScroll(fetcher, options) {
|
|
|
62
61
|
useEffect(function () {
|
|
63
62
|
return loadMore(true);
|
|
64
63
|
}, reloadDeps ? reloadDeps : [reloadDeps]);
|
|
65
|
-
var scrollMethod = function
|
|
64
|
+
var scrollMethod = useDebounceFn(function () {
|
|
66
65
|
var el = getTargetElement(target);
|
|
67
66
|
if (!el) {
|
|
68
67
|
return;
|
|
@@ -73,16 +72,18 @@ function useInfiniteScroll(fetcher, options) {
|
|
|
73
72
|
if (scrollHeight - scrollTop <= clientHeight + (threshold || 50)) {
|
|
74
73
|
loadMore();
|
|
75
74
|
}
|
|
76
|
-
}
|
|
77
|
-
|
|
75
|
+
}, {
|
|
76
|
+
wait: 100
|
|
77
|
+
});
|
|
78
|
+
useEventListener('scroll', function () {
|
|
78
79
|
if (state.loadding) {
|
|
79
80
|
return;
|
|
80
81
|
}
|
|
81
|
-
scrollMethod();
|
|
82
|
+
scrollMethod.run();
|
|
82
83
|
}, {
|
|
83
84
|
target: target
|
|
84
85
|
});
|
|
85
|
-
|
|
86
|
+
useUpdateEffect(function () {
|
|
86
87
|
var el = getTargetElement(target);
|
|
87
88
|
if (!el) {
|
|
88
89
|
return;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _useLatest from "ahooks/es/useLatest";
|
|
2
1
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
2
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
3
|
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,6 +6,7 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
7
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; }
|
|
8
7
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
9
8
|
import { useCallback, useEffect, useRef } from 'react';
|
|
9
|
+
import { useLatest } from 'ahooks';
|
|
10
10
|
import { isNumber } from 'lodash-es';
|
|
11
11
|
var setRafInterval = function setRafInterval(callback) {
|
|
12
12
|
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
@@ -43,7 +43,7 @@ function useRafInterval(fn, delay, options) {
|
|
|
43
43
|
var _options$deps;
|
|
44
44
|
var immediate = options === null || options === void 0 ? void 0 : options.immediate;
|
|
45
45
|
var deps = (_options$deps = options === null || options === void 0 ? void 0 : options.deps) !== null && _options$deps !== void 0 ? _options$deps : [];
|
|
46
|
-
var fnRef =
|
|
46
|
+
var fnRef = useLatest(fn);
|
|
47
47
|
var timerRef = useRef();
|
|
48
48
|
useEffect(function () {
|
|
49
49
|
if (!isNumber(delay) || delay < 0) return undefined;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
import _useMemoizedFn from "ahooks/es/useMemoizedFn";
|
|
3
|
-
import _useSafeState3 from "ahooks/es/useSafeState";
|
|
4
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
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; }
|
|
@@ -12,14 +10,15 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
12
10
|
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; }
|
|
13
11
|
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; } }
|
|
14
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { useMemoizedFn, useSafeState } from 'ahooks';
|
|
15
14
|
import { isFunction, isObjectLike } from 'lodash-es';
|
|
16
15
|
import { useMemo } from 'react';
|
|
17
16
|
function useSimpleState(s) {
|
|
18
|
-
var _useSafeState =
|
|
17
|
+
var _useSafeState = useSafeState(s),
|
|
19
18
|
_useSafeState2 = _slicedToArray(_useSafeState, 2),
|
|
20
19
|
state = _useSafeState2[0],
|
|
21
20
|
setState = _useSafeState2[1];
|
|
22
|
-
var stateChange =
|
|
21
|
+
var stateChange = useMemoizedFn(function (d) {
|
|
23
22
|
return setState(function (old) {
|
|
24
23
|
return _objectSpread(_objectSpread({}, old), d);
|
|
25
24
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BasicTarget } from 'ahooks/es/utils/domTarget';
|
|
2
|
-
|
|
2
|
+
type ItemHeight<T> = (index: number, data: T) => number;
|
|
3
3
|
export interface Options<T> {
|
|
4
4
|
containerTarget: BasicTarget;
|
|
5
5
|
wrapperTarget: BasicTarget;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import _useMemoizedFn from "ahooks/es/useMemoizedFn";
|
|
2
|
-
import _useEventListener from "ahooks/es/useEventListener";
|
|
3
|
-
import _useSize from "ahooks/es/useSize";
|
|
4
|
-
import _useLatest from "ahooks/es/useLatest";
|
|
5
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
2
|
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."); }
|
|
7
3
|
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); }
|
|
@@ -9,6 +5,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
9
5
|
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; } }
|
|
10
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
7
|
import { useEffect, useMemo, useState, useRef, useLayoutEffect } from 'react';
|
|
8
|
+
import { useEventListener, useLatest, useMemoizedFn, useSize } from 'ahooks';
|
|
12
9
|
import { getTargetElement } from 'ahooks/es/utils/domTarget';
|
|
13
10
|
import { isNumber } from 'ahooks/es/utils';
|
|
14
11
|
var useVirtualList = function useVirtualList(list, options) {
|
|
@@ -17,8 +14,8 @@ var useVirtualList = function useVirtualList(list, options) {
|
|
|
17
14
|
itemHeight = options.itemHeight,
|
|
18
15
|
_options$overscan = options.overscan,
|
|
19
16
|
overscan = _options$overscan === void 0 ? 5 : _options$overscan;
|
|
20
|
-
var itemHeightRef =
|
|
21
|
-
var size =
|
|
17
|
+
var itemHeightRef = useLatest(itemHeight);
|
|
18
|
+
var size = useSize(containerTarget);
|
|
22
19
|
var scrollTriggerByScrollToFunc = useRef(false);
|
|
23
20
|
var _useState = useState([]),
|
|
24
21
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -116,7 +113,7 @@ var useVirtualList = function useVirtualList(list, options) {
|
|
|
116
113
|
calculateRange();
|
|
117
114
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
118
115
|
}, [size === null || size === void 0 ? void 0 : size.width, size === null || size === void 0 ? void 0 : size.height, list]);
|
|
119
|
-
|
|
116
|
+
useEventListener('scroll', function (e) {
|
|
120
117
|
if (scrollTriggerByScrollToFunc.current) {
|
|
121
118
|
scrollTriggerByScrollToFunc.current = false;
|
|
122
119
|
return;
|
|
@@ -134,6 +131,6 @@ var useVirtualList = function useVirtualList(list, options) {
|
|
|
134
131
|
calculateRange();
|
|
135
132
|
}
|
|
136
133
|
};
|
|
137
|
-
return [targetList,
|
|
134
|
+
return [targetList, useMemoizedFn(scrollTo)];
|
|
138
135
|
};
|
|
139
136
|
export default useVirtualList;
|
package/es/utils.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { MutableRefObject } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import likeGo from './likeGo';
|
|
3
|
+
type TargetValue<T> = T | undefined | null;
|
|
4
|
+
type TargetType = HTMLElement | Element | Window | Document;
|
|
5
|
+
export type BasicTarget<T extends TargetType = Element> = (() => TargetValue<T>) | TargetValue<T> | MutableRefObject<TargetValue<T>>;
|
|
5
6
|
export declare function getTargetElement<T extends TargetType>(target: BasicTarget<T>, defaultElement?: T): TargetValue<T>;
|
|
6
7
|
declare const getScrollTop: (el: Document | Element) => number;
|
|
7
8
|
declare const getScrollHeight: (el: Document | Element) => number;
|
|
@@ -10,5 +11,4 @@ declare const getEleScrollHeight: (el: Document | Element) => number;
|
|
|
10
11
|
export declare const getHeader: () => {
|
|
11
12
|
Authorization: any;
|
|
12
13
|
};
|
|
13
|
-
declare function likeGo<T, S>(fn: () => Promise<T>): Promise<[T, S]>;
|
|
14
14
|
export { getScrollTop, getScrollHeight, getClientHeight, getEleScrollHeight, likeGo };
|
package/es/utils.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
3
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
1
|
import cache from "./cache";
|
|
2
|
+
import likeGo from "./likeGo";
|
|
6
3
|
export function getTargetElement(target, defaultElement) {
|
|
7
4
|
if (!target) {
|
|
8
5
|
return defaultElement;
|
|
@@ -46,30 +43,4 @@ export var getHeader = function getHeader() {
|
|
|
46
43
|
Authorization: cache.getCache('token', 'session')
|
|
47
44
|
};
|
|
48
45
|
};
|
|
49
|
-
function likeGo(_x) {
|
|
50
|
-
return _likeGo.apply(this, arguments);
|
|
51
|
-
}
|
|
52
|
-
function _likeGo() {
|
|
53
|
-
_likeGo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(fn) {
|
|
54
|
-
var result;
|
|
55
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
56
|
-
while (1) switch (_context.prev = _context.next) {
|
|
57
|
-
case 0:
|
|
58
|
-
result = [];
|
|
59
|
-
_context.next = 3;
|
|
60
|
-
return fn().then(function (res) {
|
|
61
|
-
result[0] = res;
|
|
62
|
-
}).catch(function (err) {
|
|
63
|
-
result[1] = err;
|
|
64
|
-
});
|
|
65
|
-
case 3:
|
|
66
|
-
return _context.abrupt("return", result);
|
|
67
|
-
case 4:
|
|
68
|
-
case "end":
|
|
69
|
-
return _context.stop();
|
|
70
|
-
}
|
|
71
|
-
}, _callee);
|
|
72
|
-
}));
|
|
73
|
-
return _likeGo.apply(this, arguments);
|
|
74
|
-
}
|
|
75
46
|
export { getScrollTop, getScrollHeight, getClientHeight, getEleScrollHeight, likeGo };
|
package/es/uuid/index.d.ts
CHANGED
package/es/uuid/index.js
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
+
import { v4 as uuid } from 'uuid';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* 生成UUID
|
|
3
5
|
*/
|
|
4
|
-
export default
|
|
5
|
-
var s = [];
|
|
6
|
-
var hexDigits = '0123456789abcdef';
|
|
7
|
-
for (var i = 0; i < 36; i++) {
|
|
8
|
-
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
|
|
9
|
-
}
|
|
10
|
-
s[14] = '4';
|
|
11
|
-
s[19] = hexDigits.substr(s[19] & 0x3 | 0x8, 1);
|
|
12
|
-
s[8] = s[13] = s[18] = s[23] = '-';
|
|
13
|
-
var uuidStr = s.join('');
|
|
14
|
-
return uuidStr;
|
|
15
|
-
}
|
|
6
|
+
export default uuid;
|
package/package.json
CHANGED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@cloud-app-dev/vidc",
|
|
4
4
|
"description": "Video Image Data Componennts",
|
|
5
|
-
"version": "4.0
|
|
5
|
+
"version": "4.1.0",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"docs:deploy": "gh-pages -d docs-dist",
|
|
8
|
-
"build": "
|
|
8
|
+
"build": "father build",
|
|
9
9
|
"deploy": "npm run docs:build && npm run docs:deploy",
|
|
10
|
-
"entry": "node ./scripts/entry.js",
|
|
11
10
|
"start": "npm run dev",
|
|
12
11
|
"dev": "dumi dev",
|
|
13
12
|
"build:watch": "father dev",
|
|
@@ -45,51 +44,51 @@
|
|
|
45
44
|
]
|
|
46
45
|
},
|
|
47
46
|
"dependencies": {
|
|
48
|
-
"@cloud-app-dev/mpegts.js": "^1.7.
|
|
47
|
+
"@cloud-app-dev/mpegts.js": "^1.7.3",
|
|
48
|
+
"@emotion/css": "^11.11.2",
|
|
49
49
|
"@turf/boolean-disjoint": "^6.5.0",
|
|
50
50
|
"@turf/helpers": "^6.5.0",
|
|
51
51
|
"@turf/line-to-polygon": "^6.5.0",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
52
|
+
"@types/js-cookie": "^3.0.3",
|
|
53
|
+
"@types/uuid": "^9.0.1",
|
|
54
|
+
"axios": "^1.4.0",
|
|
55
|
+
"dayjs": "^1.11.9",
|
|
55
56
|
"db.js": "^0.15.0",
|
|
56
57
|
"history": "^5.3.0",
|
|
57
|
-
"hls.js": "^1.4.
|
|
58
|
-
"immer": "^
|
|
59
|
-
"js-cookie": "^
|
|
58
|
+
"hls.js": "^1.4.10",
|
|
59
|
+
"immer": "^10.0.2",
|
|
60
|
+
"js-cookie": "^3.0.5",
|
|
60
61
|
"lodash-es": "^4.17.21",
|
|
61
|
-
"react-error-boundary": "^
|
|
62
|
-
"react-hotkeys-hook": "^4.
|
|
63
|
-
"
|
|
64
|
-
"
|
|
62
|
+
"react-error-boundary": "^4.0.10",
|
|
63
|
+
"react-hotkeys-hook": "^4.4.1",
|
|
64
|
+
"socket.io-client": "2.5.0",
|
|
65
|
+
"uuid": "^9.0.0"
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
67
|
-
"@commitlint/cli": "^17.
|
|
68
|
-
"@commitlint/config-conventional": "^17.
|
|
68
|
+
"@commitlint/cli": "^17.6.5",
|
|
69
|
+
"@commitlint/config-conventional": "^17.6.5",
|
|
69
70
|
"@types/db.js": "^0.14.7",
|
|
70
|
-
"@types/leaflet": "^1.9.
|
|
71
|
-
"@types/lodash-es": "^4.17.
|
|
72
|
-
"@types/node": "^18.
|
|
73
|
-
"@types/react": "^18.
|
|
74
|
-
"@types/react-dom": "^18.
|
|
75
|
-
"@
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"prettier": "^2.
|
|
87
|
-
"prettier-plugin-organize-imports": "^3.0.0",
|
|
88
|
-
"prettier-plugin-packagejson": "^2.2.18",
|
|
71
|
+
"@types/leaflet": "^1.9.3",
|
|
72
|
+
"@types/lodash-es": "^4.17.7",
|
|
73
|
+
"@types/node": "^18.16.16",
|
|
74
|
+
"@types/react": "^18.2.9",
|
|
75
|
+
"@types/react-dom": "^18.2.4",
|
|
76
|
+
"@umijs/lint": "^4.0.70",
|
|
77
|
+
"antd": "^5.7.3",
|
|
78
|
+
"ahooks": "^3.7.7",
|
|
79
|
+
"dumi": "^2.2.4",
|
|
80
|
+
"eslint": "^8.44.0",
|
|
81
|
+
"father": "^4.3.0",
|
|
82
|
+
"gh-pages": "^5.0.0",
|
|
83
|
+
"husky": "^8.0.3",
|
|
84
|
+
"lint-staged": "^13.2.3",
|
|
85
|
+
"prettier": "^3.0.0",
|
|
86
|
+
"prettier-plugin-organize-imports": "^3.2.2",
|
|
87
|
+
"prettier-plugin-packagejson": "^2.4.5",
|
|
89
88
|
"react": "^18.2.0",
|
|
90
89
|
"react-dom": "^18.2.0",
|
|
91
|
-
"stylelint": "^14.
|
|
92
|
-
"stylelint-config-prettier": "^9.0.
|
|
90
|
+
"stylelint": "^14.16.1",
|
|
91
|
+
"stylelint-config-prettier": "^9.0.5",
|
|
93
92
|
"stylelint-config-standard": "^29.0.0",
|
|
94
93
|
"stylelint-order": "^5.0.0"
|
|
95
94
|
}
|
package/release-build.sh
CHANGED
|
@@ -27,7 +27,6 @@ else
|
|
|
27
27
|
exit 1
|
|
28
28
|
fi
|
|
29
29
|
|
|
30
|
-
nrm use npm
|
|
31
30
|
npm publish
|
|
32
31
|
if [ $? -eq 0 ]; then
|
|
33
32
|
echo "publish success!"
|
|
@@ -36,9 +35,11 @@ else
|
|
|
36
35
|
exit 1
|
|
37
36
|
fi
|
|
38
37
|
|
|
38
|
+
npm version patch
|
|
39
|
+
|
|
39
40
|
git add .
|
|
40
41
|
|
|
41
|
-
git commit -m "新版本构建发布"
|
|
42
|
+
git commit -m "feat: 新版本构建发布"
|
|
42
43
|
|
|
43
44
|
git pull
|
|
44
45
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
3
|
const componentDir = 'src';
|
|
4
4
|
const cModuleNames = fs.readdirSync(path.resolve(componentDir));
|
|
5
5
|
|
|
6
|
-
function
|
|
6
|
+
(function main() {
|
|
7
7
|
let entryText = '';
|
|
8
8
|
let dtsText = '';
|
|
9
9
|
cModuleNames.forEach((name) => {
|
|
@@ -13,8 +13,6 @@ function run() {
|
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
fs.writeFileSync(path.resolve('src/index.ts'), entryText);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
run();
|
|
16
|
+
})();
|
|
19
17
|
|
|
20
18
|
console.log('================== entry is init! ===================');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
3
|
|
|
4
|
+
const filepath = process.argv[2] ?? './src/Player/style/iconfont.js';
|
|
4
5
|
function readFile(path) {
|
|
5
6
|
return new Promise((resolve, reject) => {
|
|
6
7
|
fs.readFile(path, 'utf8', function (err, data) {
|
|
@@ -19,7 +20,7 @@ function writeFile(path, data) {
|
|
|
19
20
|
|
|
20
21
|
async function run() {
|
|
21
22
|
try {
|
|
22
|
-
const url = path.resolve(
|
|
23
|
+
const url = path.resolve(process.cwd(), filepath);
|
|
23
24
|
const str = await readFile(url);
|
|
24
25
|
const newStr = str.replace(/fill="\S+"/g, '');
|
|
25
26
|
await writeFile(url, newStr);
|
package/tsconfig.json
CHANGED
package/es/Auth/index.d.ts
DELETED
package/es/Auth/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
import Config from "../Config";
|
|
3
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
function Auth(_ref) {
|
|
6
|
-
var featureId = _ref.featureId,
|
|
7
|
-
noAuthContent = _ref.noAuthContent,
|
|
8
|
-
children = _ref.children;
|
|
9
|
-
var action = useMemo(function () {
|
|
10
|
-
return !!Config.feature.find(function (v) {
|
|
11
|
-
return v === featureId;
|
|
12
|
-
});
|
|
13
|
-
}, [featureId]); //获取按钮权限
|
|
14
|
-
return /*#__PURE__*/_jsx(_Fragment, {
|
|
15
|
-
children: !action ? noAuthContent ? noAuthContent : null : children
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
export default Auth;
|
package/es/AutoExit/index.d.ts
DELETED
package/es/AutoExit/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React, { useContext, useEffect } from 'react';
|
|
2
|
-
import AppContext from "../AppContext";
|
|
3
|
-
import nextTick from "../nextTick";
|
|
4
|
-
import useHistory from "../useHistory";
|
|
5
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
function AutoExit(_ref) {
|
|
8
|
-
var children = _ref.children;
|
|
9
|
-
var _useContext = useContext(AppContext.Context),
|
|
10
|
-
loginStatus = _useContext.loginStatus;
|
|
11
|
-
var history = useHistory();
|
|
12
|
-
useEffect(function () {
|
|
13
|
-
if (!loginStatus) {
|
|
14
|
-
nextTick(function () {
|
|
15
|
-
return history.replace('/login');
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}, [loginStatus]);
|
|
19
|
-
return /*#__PURE__*/_jsx(_Fragment, {
|
|
20
|
-
children: loginStatus ? children : null
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
export default AutoExit;
|