@cloud-app-dev/vidc 2.2.0-alpha.7 → 3.0.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/.eslintignore +1 -3
- package/.eslintrc +3 -0
- package/.prettierignore +1 -0
- package/.umirc.ts +74 -74
- package/es/AppContext/Sync.d.ts +3 -2
- package/es/AppContext/Sync.js +11 -2
- package/es/AppContext/index.js +63 -9
- package/es/AppContext/interface.d.ts +10 -1
- package/es/AppContext/static.d.ts +2 -0
- package/es/AppContext/static.js +5 -1
- package/es/Box/InfoBox/index.css +5 -6
- package/es/Box/TwoColumnBox/index.css +17 -24
- package/es/Box/TwoColumnBox/index.js +1 -4
- package/es/Box/index.css +1 -1
- package/es/Config/interface.d.ts +2 -1
- package/es/ConfigContext/index.d.ts +1 -1
- package/es/DomMove/demo.d.ts +2 -0
- package/es/DomMove/demo.js +16 -0
- package/es/DomMove/index.d.ts +16 -0
- package/es/DomMove/index.js +145 -0
- package/es/DomMove/utils.d.ts +8 -0
- package/es/{Picture/component/MoveContent → DomMove}/utils.js +19 -0
- package/es/Drawer/index.d.ts +2 -2
- package/es/Drawer/interface.d.ts +4 -174
- package/es/ErrorBoundary/index.d.ts +18 -0
- package/es/ErrorBoundary/index.js +84 -0
- package/es/List/DynamicGridList/Demo.js +40 -27
- package/es/List/DynamicGridList/index.d.ts +19 -18
- package/es/List/DynamicGridList/index.js +36 -36
- package/es/List/DynamicList/index.css +15 -0
- package/es/List/DynamicList/index.d.ts +14 -0
- package/es/List/DynamicList/index.js +105 -0
- package/es/List/DynamicList/interface.d.ts +19 -0
- package/es/List/DynamicList/utils.d.ts +4 -0
- package/es/List/DynamicList/utils.js +6 -0
- package/es/List/GridList/Demo.js +27 -4
- package/es/List/GridList/index.css +1 -0
- package/es/List/GridList/index.d.ts +2 -2
- package/es/List/GridList/index.js +8 -12
- package/es/List/GridList/interface.d.ts +1 -1
- package/es/List/VList/index.js +2 -3
- package/es/List/index.css +3 -55
- package/es/List/index.d.ts +5 -6
- package/es/List/index.js +15 -154
- package/es/List/interface.d.ts +3 -61
- package/es/LoaderApp/index.d.ts +1 -1
- package/es/LoaderApp/index.js +27 -46
- package/es/LoaderApp/interface.d.ts +3 -0
- package/es/LoaderApp/loader.d.ts +6 -7
- package/es/LoaderApp/loader.js +20 -30
- package/es/LoaderApp/sandbox.back.d.ts +18 -0
- package/es/LoaderApp/sandbox.back.js +356 -0
- package/es/LoaderApp/sandbox.d.ts +12 -0
- package/es/LoaderApp/sandbox.js +110 -0
- package/es/LoaderApp/utils.d.ts +5 -1
- package/es/LoaderApp/utils.js +98 -2
- package/es/Map/AMap.d.ts +1572 -0
- package/es/Map/BasicMap/AMapInstance.d.ts +15 -0
- package/es/Map/BasicMap/AMapInstance.js +66 -0
- package/es/Map/BasicMap/LeafletInstance.d.ts +15 -0
- package/es/Map/BasicMap/LeafletInstance.js +98 -0
- package/es/Map/BasicMap/index.css +24 -0
- package/es/Map/BasicMap/index.d.ts +9 -0
- package/es/Map/BasicMap/index.js +108 -0
- package/es/Map/ClusterLayer/hook.d.ts +5 -0
- package/es/Map/ClusterLayer/hook.js +144 -0
- package/es/Map/ClusterLayer/index.css +26 -0
- package/es/Map/ClusterLayer/index.d.ts +5 -0
- package/es/Map/ClusterLayer/index.js +31 -0
- package/es/Map/ClusterLayer/props.d.ts +8 -0
- package/es/Map/Config/index.d.ts +7 -0
- package/es/{InitialConfig → Map/Config}/index.js +35 -36
- package/es/Map/Config/utils.d.ts +2 -0
- package/es/{List/DynamicDeviceList → Map/Config}/utils.js +48 -45
- package/es/Map/Context/index.d.ts +11 -0
- package/es/Map/Context/index.js +66 -0
- package/es/Map/FindPio/index.css +7 -0
- package/es/Map/FindPio/index.d.ts +4 -0
- package/es/Map/FindPio/index.js +16 -0
- package/es/{WorkerFlow/Demo.d.ts → Map/InfoWindow/demo.d.ts} +0 -0
- package/es/{List/DynamicDeviceList/Demo.js → Map/InfoWindow/demo.js} +27 -25
- package/es/Map/InfoWindow/index.d.ts +8 -0
- package/es/Map/InfoWindow/index.js +74 -0
- package/es/Map/LevelCenter/DragMarker/index.d.ts +12 -0
- package/es/Map/LevelCenter/DragMarker/index.js +48 -0
- package/es/{List/DeviceList → Map/LevelCenter}/index.css +0 -0
- package/es/Map/LevelCenter/index.d.ts +13 -0
- package/es/Map/LevelCenter/index.js +42 -0
- package/es/Map/LoaderMap/index.d.ts +12 -0
- package/es/Map/LoaderMap/index.js +58 -0
- package/es/Map/ResetTools/index.css +32 -0
- package/es/Map/ResetTools/index.d.ts +9 -0
- package/es/Map/ResetTools/index.js +61 -0
- package/es/Map/SinglePoint/Marker/index.d.ts +7 -0
- package/es/Map/SinglePoint/Marker/index.js +29 -0
- package/es/Map/SinglePoint/icon/Place_icon_OnLine_Hover.svg +15 -0
- package/es/Map/SinglePoint/icon/Place_icon_OnLine_Normal.svg +15 -0
- package/es/Map/SinglePoint/icon/Place_icon_OutLine_Hover.svg +15 -0
- package/es/Map/SinglePoint/icon/Place_icon_OutLine_Normal.svg +15 -0
- package/es/Map/SinglePoint/index.css +29 -0
- package/es/Map/SinglePoint/index.d.ts +7 -0
- package/es/Map/SinglePoint/index.js +32 -0
- package/es/Map/hook/useMapType.d.ts +4 -0
- package/es/Map/hook/useMapType.js +13 -0
- package/es/Map/icon.d.ts +2 -0
- package/es/Map/icon.js +10 -0
- package/es/Map/index.d.ts +23 -0
- package/es/Map/index.js +25 -0
- package/es/Map/interface.d.ts +55 -0
- package/es/Map/points.json +61247 -0
- package/es/{Picture/component/MoveContent → Map/useMarker}/index.css +0 -0
- package/es/Map/useMarker/index.d.ts +11 -0
- package/es/{WorkerFlow/Form/FormAuth.js → Map/useMarker/index.js} +57 -80
- package/es/Map/withMap/index.d.ts +2 -0
- package/es/Map/withMap/index.js +12 -0
- package/es/Modal/index.css +1 -1
- package/es/Modal/index.d.ts +7 -7
- package/es/Picture/index.d.ts +1 -1
- package/es/Picture/index.js +2 -2
- package/es/Player/api/index.d.ts +1 -0
- package/es/Player/api/index.js +7 -1
- package/es/Player/demo.js +13 -21
- package/es/Player/event/index.js +5 -1
- package/es/Player/frontend_player.d.ts +1 -1
- package/es/Player/frontend_player.js +20 -13
- package/es/Player/frontend_timeline.d.ts +1 -1
- package/es/Player/live_heart.js +45 -12
- package/es/Player/message.js +23 -12
- package/es/Player/player.d.ts +31 -7
- package/es/Player/segment_player.d.ts +1 -1
- package/es/Player/segment_player.js +30 -18
- package/es/Player/segment_timeline.js +6 -6
- package/es/Player/single_player.js +50 -9
- package/es/Player/timeline.js +8 -6
- package/es/Player/util.d.ts +2 -1
- package/es/Player/util.js +4 -1
- package/es/PlayerExt/index.css +2 -2
- package/es/PlayerExt/index.d.ts +3 -1
- package/es/PlayerExt/index.js +19 -5
- package/es/ScreenPlayer/Live.d.ts +5 -0
- package/es/ScreenPlayer/Live.js +109 -0
- package/es/ScreenPlayer/LiveTools.d.ts +15 -0
- package/es/ScreenPlayer/LiveTools.js +95 -0
- package/es/ScreenPlayer/PlayerWithExt.d.ts +22 -0
- package/es/ScreenPlayer/PlayerWithExt.js +169 -0
- package/es/ScreenPlayer/Record.d.ts +5 -0
- package/es/{WorkerFlow/index.js → ScreenPlayer/Record.js} +290 -273
- package/es/ScreenPlayer/RecordTools.d.ts +17 -0
- package/es/ScreenPlayer/RecordTools.js +102 -0
- package/es/ScreenPlayer/SegmentTimeLine.d.ts +10 -0
- package/es/ScreenPlayer/SegmentTimeLine.js +40 -0
- package/es/ScreenPlayer/TimeSlider.d.ts +127 -0
- package/es/ScreenPlayer/TimeSlider.js +528 -0
- package/es/ScreenPlayer/demo.d.ts +2 -0
- package/es/ScreenPlayer/demo.js +25 -0
- package/es/ScreenPlayer/demo2.d.ts +2 -0
- package/es/ScreenPlayer/demo2.js +153 -0
- package/es/ScreenPlayer/index.css +50 -0
- package/es/ScreenPlayer/index.d.ts +6 -0
- package/es/ScreenPlayer/index.js +7 -0
- package/es/ScreenPlayer/interface.d.ts +81 -0
- package/es/ScreenPlayer/useRecordList.d.ts +3 -0
- package/es/{WorkerFlow/Form/UserAndGroupSelect.js → ScreenPlayer/useRecordList.js} +173 -176
- package/es/ScreenPlayer/useVideoFit.d.ts +5 -0
- package/es/{Tree/BaseTree/demo.js → ScreenPlayer/useVideoFit.js} +30 -55
- package/es/ScreenPlayer/utils.d.ts +25 -0
- package/es/ScreenPlayer/utils.js +84 -0
- package/es/ThemeAntd/index.css +58 -58
- package/es/ThemeAntd/style/button.css +1 -1
- package/es/ThemeAntd/style/checkbox.css +8 -8
- package/es/ThemeAntd/style/input.css +13 -13
- package/es/ThemeAntd/style/pagination.css +5 -5
- package/es/ThemeAntd/style/picker.css +11 -11
- package/es/ThemeAntd/style/popover.css +1 -1
- package/es/ThemeAntd/style/radio.css +4 -4
- package/es/ThemeAntd/style/scrollbar.css +3 -3
- package/es/ThemeAntd/style/select.css +11 -11
- package/es/ThemeAntd/style/table.css +1 -1
- package/es/Tree/demo.js +9 -12
- package/es/Tree/index.css +55 -29
- package/es/Tree/index.d.ts +20 -19
- package/es/Tree/index.js +70 -185
- package/es/index.d.ts +7 -9
- package/es/index.js +7 -9
- package/es/useInfiniteScroll/index.d.ts +16 -0
- package/es/{useHttp → useInfiniteScroll}/index.js +79 -43
- package/es/useVirtualList/index.d.ts +13 -0
- package/es/useVirtualList/index.js +175 -0
- package/es/withErrorBoundary/index.d.ts +8 -0
- package/es/withErrorBoundary/index.js +43 -0
- package/package.json +19 -21
- package/test.js +48 -0
- package/es/DeviceIcon/icon.d.ts +0 -9
- package/es/DeviceIcon/icon.js +0 -138
- package/es/DeviceIcon/index.css +0 -8
- package/es/DeviceIcon/index.d.ts +0 -14
- package/es/DeviceIcon/index.js +0 -37
- package/es/DeviceSelect/TreeType.d.ts +0 -7
- package/es/DeviceSelect/TreeType.js +0 -36
- package/es/DeviceSelect/demo.d.ts +0 -3
- package/es/DeviceSelect/demo.js +0 -22
- package/es/DeviceSelect/index.css +0 -11
- package/es/DeviceSelect/index.d.ts +0 -13
- package/es/DeviceSelect/index.js +0 -191
- package/es/Dict/cache.d.ts +0 -3
- package/es/Dict/cache.js +0 -21
- package/es/Dict/device.d.ts +0 -28
- package/es/Dict/device.js +0 -117
- package/es/Dict/hook.d.ts +0 -3
- package/es/Dict/hook.js +0 -98
- package/es/Dict/index.d.ts +0 -9
- package/es/Dict/index.js +0 -10
- package/es/Dict/interface.d.ts +0 -16
- package/es/Dict/utils.d.ts +0 -10
- package/es/Dict/utils.js +0 -44
- package/es/InitialConfig/index.d.ts +0 -8
- package/es/InitialConfig/utils.d.ts +0 -20
- package/es/InitialConfig/utils.js +0 -110
- package/es/InitialRequest/index.d.ts +0 -9
- package/es/InitialRequest/index.js +0 -97
- package/es/InitialRequest/utils.d.ts +0 -10
- package/es/InitialRequest/utils.js +0 -116
- package/es/List/CheckExt.d.ts +0 -9
- package/es/List/CheckExt.js +0 -36
- package/es/List/DeviceList/index.d.ts +0 -11
- package/es/List/DeviceList/index.js +0 -50
- package/es/List/DynamicDeviceList/Demo.d.ts +0 -3
- package/es/List/DynamicDeviceList/index.css +0 -39
- package/es/List/DynamicDeviceList/index.d.ts +0 -12
- package/es/List/DynamicDeviceList/index.js +0 -205
- package/es/List/DynamicDeviceList/interface.d.ts +0 -37
- package/es/List/DynamicDeviceList/utils.d.ts +0 -16
- package/es/List/ListExt/index.css +0 -3
- package/es/List/ListExt/index.d.ts +0 -19
- package/es/List/ListExt/index.js +0 -44
- package/es/Picture/component/MoveContent/index.d.ts +0 -39
- package/es/Picture/component/MoveContent/index.js +0 -244
- package/es/Picture/component/MoveContent/utils.d.ts +0 -4
- package/es/Title/index.css +0 -25
- package/es/Title/index.d.ts +0 -12
- package/es/Title/index.js +0 -30
- package/es/Tree/BaseTree/demo.d.ts +0 -3
- package/es/Tree/BaseTree/index.css +0 -64
- package/es/Tree/BaseTree/index.d.ts +0 -24
- package/es/Tree/BaseTree/index.js +0 -83
- package/es/UserSelect/demo.d.ts +0 -3
- package/es/UserSelect/demo.js +0 -21
- package/es/UserSelect/index.css +0 -16
- package/es/UserSelect/index.d.ts +0 -18
- package/es/UserSelect/index.js +0 -194
- package/es/WorkerFlow/Demo.js +0 -57
- package/es/WorkerFlow/Form/Approver.d.ts +0 -10
- package/es/WorkerFlow/Form/Approver.js +0 -33
- package/es/WorkerFlow/Form/Condition.d.ts +0 -11
- package/es/WorkerFlow/Form/Condition.js +0 -235
- package/es/WorkerFlow/Form/EmptyUserSet.d.ts +0 -8
- package/es/WorkerFlow/Form/EmptyUserSet.js +0 -137
- package/es/WorkerFlow/Form/FormAuth.d.ts +0 -8
- package/es/WorkerFlow/Form/GroupList.d.ts +0 -12
- package/es/WorkerFlow/Form/GroupList.js +0 -44
- package/es/WorkerFlow/Form/GroupSelect.d.ts +0 -8
- package/es/WorkerFlow/Form/GroupSelect.js +0 -167
- package/es/WorkerFlow/Form/GroupSelectModalContent.d.ts +0 -6
- package/es/WorkerFlow/Form/GroupSelectModalContent.js +0 -177
- package/es/WorkerFlow/Form/Handle.d.ts +0 -10
- package/es/WorkerFlow/Form/Handle.js +0 -33
- package/es/WorkerFlow/Form/LevelGroupSelect.d.ts +0 -12
- package/es/WorkerFlow/Form/LevelGroupSelect.js +0 -208
- package/es/WorkerFlow/Form/Notifier.d.ts +0 -8
- package/es/WorkerFlow/Form/Notifier.js +0 -16
- package/es/WorkerFlow/Form/UserAndGroupSelect.d.ts +0 -8
- package/es/WorkerFlow/Form/UserSelect.d.ts +0 -8
- package/es/WorkerFlow/Form/UserSelect.js +0 -150
- package/es/WorkerFlow/Form/UserSelectModalContent.d.ts +0 -6
- package/es/WorkerFlow/Form/UserSelectModalContent.js +0 -166
- package/es/WorkerFlow/Form/UserSet.d.ts +0 -14
- package/es/WorkerFlow/Form/UserSet.js +0 -308
- package/es/WorkerFlow/Form/UsersHandleType.d.ts +0 -7
- package/es/WorkerFlow/Form/UsersHandleType.js +0 -32
- package/es/WorkerFlow/Form/utils.d.ts +0 -3
- package/es/WorkerFlow/Form/utils.js +0 -47
- package/es/WorkerFlow/Nodes/Add.d.ts +0 -7
- package/es/WorkerFlow/Nodes/Add.js +0 -97
- package/es/WorkerFlow/Nodes/AddOption.d.ts +0 -10
- package/es/WorkerFlow/Nodes/AddOption.js +0 -23
- package/es/WorkerFlow/Nodes/AddOptionList.d.ts +0 -8
- package/es/WorkerFlow/Nodes/AddOptionList.js +0 -46
- package/es/WorkerFlow/Nodes/Approver.d.ts +0 -11
- package/es/WorkerFlow/Nodes/Approver.js +0 -53
- package/es/WorkerFlow/Nodes/Condition.d.ts +0 -10
- package/es/WorkerFlow/Nodes/Condition.js +0 -140
- package/es/WorkerFlow/Nodes/Constants.d.ts +0 -35
- package/es/WorkerFlow/Nodes/Constants.js +0 -150
- package/es/WorkerFlow/Nodes/End.d.ts +0 -7
- package/es/WorkerFlow/Nodes/End.js +0 -16
- package/es/WorkerFlow/Nodes/Handle.d.ts +0 -11
- package/es/WorkerFlow/Nodes/Handle.js +0 -52
- package/es/WorkerFlow/Nodes/Node.d.ts +0 -8
- package/es/WorkerFlow/Nodes/Node.js +0 -26
- package/es/WorkerFlow/Nodes/Notifier.d.ts +0 -11
- package/es/WorkerFlow/Nodes/Notifier.js +0 -52
- package/es/WorkerFlow/Nodes/Render.d.ts +0 -8
- package/es/WorkerFlow/Nodes/Render.js +0 -16
- package/es/WorkerFlow/Nodes/Start.d.ts +0 -12
- package/es/WorkerFlow/Nodes/Start.js +0 -26
- package/es/WorkerFlow/Nodes/TitleElement.d.ts +0 -10
- package/es/WorkerFlow/Nodes/TitleElement.js +0 -127
- package/es/WorkerFlow/Nodes/Wrap.d.ts +0 -13
- package/es/WorkerFlow/Nodes/Wrap.js +0 -35
- package/es/WorkerFlow/OperatorContext.d.ts +0 -4
- package/es/WorkerFlow/OperatorContext.js +0 -3
- package/es/WorkerFlow/Tools.d.ts +0 -8
- package/es/WorkerFlow/Tools.js +0 -78
- package/es/WorkerFlow/XML/CanvasTag.d.ts +0 -3
- package/es/WorkerFlow/XML/CanvasTag.js +0 -142
- package/es/WorkerFlow/XML/EndEvent.d.ts +0 -1
- package/es/WorkerFlow/XML/EndEvent.js +0 -14
- package/es/WorkerFlow/XML/ExclusiveGateway.d.ts +0 -9
- package/es/WorkerFlow/XML/ExclusiveGateway.js +0 -101
- package/es/WorkerFlow/XML/Root.d.ts +0 -1
- package/es/WorkerFlow/XML/Root.js +0 -5
- package/es/WorkerFlow/XML/StartEvent.d.ts +0 -5
- package/es/WorkerFlow/XML/StartEvent.js +0 -28
- package/es/WorkerFlow/XML/UserTask.d.ts +0 -5
- package/es/WorkerFlow/XML/UserTask.js +0 -93
- package/es/WorkerFlow/XML/index.d.ts +0 -4
- package/es/WorkerFlow/XML/index.js +0 -100
- package/es/WorkerFlow/XML/utils.d.ts +0 -6
- package/es/WorkerFlow/XML/utils.js +0 -97
- package/es/WorkerFlow/data.json +0 -83
- package/es/WorkerFlow/index.css +0 -779
- package/es/WorkerFlow/index.d.ts +0 -13
- package/es/WorkerFlow/interface.d.ts +0 -93
- package/es/WorkerFlow/template.d.ts +0 -2
- package/es/WorkerFlow/template.js +0 -17
- package/es/WorkerFlow/utils.d.ts +0 -7
- package/es/WorkerFlow/utils.js +0 -197
- package/es/useHttp/index.d.ts +0 -8
- package/pnpm-lock.yaml +0 -13650
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import _useEventListener from "ahooks/es/useEventListener";
|
|
2
|
+
import _useUpdate from "ahooks/es/useUpdate";
|
|
3
|
+
import _useSize from "ahooks/es/useSize";
|
|
4
|
+
import React, { useEffect, useImperativeHandle, useRef } from 'react';
|
|
5
|
+
import { getPosition, getMouseXY } from './utils';
|
|
6
|
+
|
|
7
|
+
function DomMove(_ref) {
|
|
8
|
+
var onDrag = _ref.onDrag,
|
|
9
|
+
position = _ref.position,
|
|
10
|
+
className = _ref.className,
|
|
11
|
+
size = _ref.size,
|
|
12
|
+
children = _ref.children,
|
|
13
|
+
onDragChange = _ref.onDragChange,
|
|
14
|
+
onDragEnd = _ref.onDragEnd,
|
|
15
|
+
forwordRef = _ref.forwordRef;
|
|
16
|
+
var dragRef = useRef(null);
|
|
17
|
+
var ref = useRef({
|
|
18
|
+
position: {
|
|
19
|
+
x: 0,
|
|
20
|
+
y: 0
|
|
21
|
+
},
|
|
22
|
+
DA: {
|
|
23
|
+
x: 0,
|
|
24
|
+
y: 0
|
|
25
|
+
},
|
|
26
|
+
isDrag: false,
|
|
27
|
+
deviation: {
|
|
28
|
+
offsetX: 0,
|
|
29
|
+
offsetY: 0,
|
|
30
|
+
width: 0,
|
|
31
|
+
height: 0
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
var reSize = _useSize(dragRef) || {};
|
|
35
|
+
|
|
36
|
+
var update = _useUpdate();
|
|
37
|
+
|
|
38
|
+
var updatePosition = function updatePosition(_ref2) {
|
|
39
|
+
var x = _ref2.x,
|
|
40
|
+
y = _ref2.y;
|
|
41
|
+
ref.current.position = {
|
|
42
|
+
x: x,
|
|
43
|
+
y: y
|
|
44
|
+
};
|
|
45
|
+
update();
|
|
46
|
+
onDragChange && onDragChange({
|
|
47
|
+
x: x,
|
|
48
|
+
y: y
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
useEffect(function () {
|
|
53
|
+
var offset = getPosition(dragRef === null || dragRef === void 0 ? void 0 : dragRef.current);
|
|
54
|
+
ref.current.deviation = {
|
|
55
|
+
offsetX: offset.left,
|
|
56
|
+
offsetY: offset.top,
|
|
57
|
+
width: reSize.width,
|
|
58
|
+
height: reSize.height
|
|
59
|
+
};
|
|
60
|
+
}, [reSize.width, reSize.height]);
|
|
61
|
+
useImperativeHandle(forwordRef, function () {
|
|
62
|
+
return {
|
|
63
|
+
updatePosition: updatePosition
|
|
64
|
+
};
|
|
65
|
+
}, []);
|
|
66
|
+
|
|
67
|
+
_useEventListener('mousemove', function (event) {
|
|
68
|
+
if (ref.current.isDrag) {
|
|
69
|
+
// let maxX, maxY;
|
|
70
|
+
var moveX, moveY;
|
|
71
|
+
|
|
72
|
+
var _getMouseXY = getMouseXY(event),
|
|
73
|
+
_x = _getMouseXY.x,
|
|
74
|
+
_y = _getMouseXY.y;
|
|
75
|
+
|
|
76
|
+
moveX = _x - ref.current.deviation.offsetX;
|
|
77
|
+
moveY = _y - ref.current.deviation.offsetY; // 计算可移动位置的大小, 保证元素不会超过可移动范围
|
|
78
|
+
// maxX = document.documentElement.clientWidth - this.deviation.width;
|
|
79
|
+
// maxY = document.documentElement.clientHeight - this.deviation.height;
|
|
80
|
+
// min方法保证不会超过右边界,max保证不会超过左边界
|
|
81
|
+
// moveX = Math.min(Math.max(0, moveX), maxX);
|
|
82
|
+
// moveY = Math.min(Math.max(0, moveY), maxY);
|
|
83
|
+
|
|
84
|
+
var _position = {
|
|
85
|
+
x: moveX,
|
|
86
|
+
y: moveY
|
|
87
|
+
};
|
|
88
|
+
onDrag ? onDrag(event, _position) : updatePosition(_position);
|
|
89
|
+
}
|
|
90
|
+
}, {
|
|
91
|
+
target: document.body
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
_useEventListener('mouseup', function (event) {
|
|
95
|
+
ref.current.isDrag = false;
|
|
96
|
+
onDragEnd && onDragEnd(event, ref.current.position);
|
|
97
|
+
}, {
|
|
98
|
+
target: document.body
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
_useEventListener('mousedown', function (event) {
|
|
102
|
+
var _getMouseXY2 = getMouseXY(event),
|
|
103
|
+
x = _getMouseXY2.x,
|
|
104
|
+
y = _getMouseXY2.y;
|
|
105
|
+
|
|
106
|
+
ref.current.deviation.offsetX = x - ref.current.position.x;
|
|
107
|
+
ref.current.deviation.offsetY = y - ref.current.position.y;
|
|
108
|
+
ref.current.isDrag = true;
|
|
109
|
+
}, {
|
|
110
|
+
target: dragRef
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
var _ref3 = onDrag ? {
|
|
114
|
+
x: position.x,
|
|
115
|
+
y: position.y
|
|
116
|
+
} : {
|
|
117
|
+
x: ref.current.position.x,
|
|
118
|
+
y: ref.current.position.y
|
|
119
|
+
},
|
|
120
|
+
x = _ref3.x,
|
|
121
|
+
y = _ref3.y;
|
|
122
|
+
|
|
123
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
124
|
+
ref: dragRef,
|
|
125
|
+
className: "drag-move-Content ".concat(className),
|
|
126
|
+
style: {
|
|
127
|
+
transform: "translate(".concat(x, "px,").concat(y, "px)"),
|
|
128
|
+
width: size.width,
|
|
129
|
+
height: size.height
|
|
130
|
+
}
|
|
131
|
+
}, children);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
DomMove.defaultProps = {
|
|
135
|
+
className: '',
|
|
136
|
+
size: {
|
|
137
|
+
width: '100%',
|
|
138
|
+
height: '100%'
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
export default /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
142
|
+
return /*#__PURE__*/React.createElement(DomMove, Object.assign({}, props, {
|
|
143
|
+
forwordRef: ref
|
|
144
|
+
}));
|
|
145
|
+
});
|
|
@@ -16,4 +16,23 @@ export function getPosition(obj) {
|
|
|
16
16
|
left: l,
|
|
17
17
|
top: t
|
|
18
18
|
};
|
|
19
|
+
} // 函数用于获取鼠标的位置
|
|
20
|
+
|
|
21
|
+
export function getMouseXY(e) {
|
|
22
|
+
var x = 0,
|
|
23
|
+
y = 0;
|
|
24
|
+
e = e || window.event;
|
|
25
|
+
|
|
26
|
+
if (e.pageX) {
|
|
27
|
+
x = e.pageX;
|
|
28
|
+
y = e.pageY;
|
|
29
|
+
} else {
|
|
30
|
+
x = e.clientX + document.body.scrollLeft - document.body.clientLeft;
|
|
31
|
+
y = e.clientY + document.body.scrollTop - document.body.clientTop;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
x: x,
|
|
36
|
+
y: y
|
|
37
|
+
};
|
|
19
38
|
}
|
package/es/Drawer/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IDrawerProps } from './interface';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import './index.less';
|
|
4
|
-
declare function Drawer({ style, getContainer, onClose, className, onOk, cancelText, okText, children, ...props }:
|
|
4
|
+
declare function Drawer({ style, getContainer, onClose, className, onOk, cancelText, okText, children, ...props }: IDrawerProps): JSX.Element;
|
|
5
5
|
declare namespace Drawer {
|
|
6
6
|
var defaultProps: {
|
|
7
7
|
getContainer: boolean;
|
package/es/Drawer/interface.d.ts
CHANGED
|
@@ -1,180 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare type EventType = React.KeyboardEvent<HTMLDivElement> | React.MouseEvent<HTMLDivElement | HTMLButtonElement>;
|
|
3
|
-
declare type getContainerFunc = () => HTMLElement;
|
|
4
|
-
declare const PlacementTypes: ['top', 'right', 'bottom', 'left'];
|
|
5
|
-
declare type placementType = typeof PlacementTypes[number];
|
|
6
|
-
export interface PushState {
|
|
7
|
-
distance: string | number;
|
|
8
|
-
}
|
|
9
|
-
export interface DrawerProps {
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
/**
|
|
12
|
-
* @description 是否显示右上角的关闭按钮
|
|
13
|
-
* @default true
|
|
14
|
-
*/
|
|
15
|
-
closable?: boolean;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @description 自定义关闭图标
|
|
19
|
-
* @default <CloseOutlined />
|
|
20
|
-
*/
|
|
21
|
-
closeIcon?: React.ReactNode;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @description 关闭时销毁 Drawer 里的子元素
|
|
25
|
-
* @default false
|
|
26
|
-
*/
|
|
27
|
-
destroyOnClose?: boolean;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @description 预渲染 Drawer 内元素
|
|
31
|
-
* @default false
|
|
32
|
-
*/
|
|
33
|
-
forceRender?: boolean;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @description 指定 Drawer 挂载的 HTML 节点, false 为挂载在当前 dom
|
|
37
|
-
* @default body
|
|
38
|
-
* @type HTMLElement | () => HTMLElement | Selectors | false
|
|
39
|
-
*/
|
|
40
|
-
getContainer?: string | HTMLElement | getContainerFunc | false;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @description 点击蒙层是否允许关闭
|
|
44
|
-
* @default true
|
|
45
|
-
*/
|
|
46
|
-
maskClosable?: boolean;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @description 是否展示遮罩
|
|
50
|
-
* @default true
|
|
51
|
-
*/
|
|
52
|
-
mask?: boolean;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @description 遮罩样式
|
|
56
|
-
* @default -
|
|
57
|
-
*/
|
|
58
|
-
maskStyle?: React.CSSProperties;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @description 可用于设置 Drawer 最外层容器的样式,和 drawerStyle 的区别是作用节点包括 mask
|
|
62
|
-
* @default -
|
|
63
|
-
*/
|
|
64
|
-
style?: React.CSSProperties;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* @description 用于设置 Drawer 弹出层的样式
|
|
68
|
-
* @default -
|
|
69
|
-
*/
|
|
70
|
-
drawerStyle?: React.CSSProperties;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* @description 用于设置 Drawer 头部的样式
|
|
74
|
-
* @default -
|
|
75
|
-
*/
|
|
76
|
-
headerStyle?: React.CSSProperties;
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* @description 可用于设置 Drawer 内容部分的样式
|
|
80
|
-
* @default -
|
|
81
|
-
*/
|
|
82
|
-
bodyStyle?: React.CSSProperties;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* @description 标题
|
|
86
|
-
* @default -
|
|
87
|
-
*/
|
|
88
|
-
title?: React.ReactNode;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* @description Drawer 是否可见
|
|
92
|
-
* @default -
|
|
93
|
-
*/
|
|
94
|
-
visible?: boolean;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* @description 宽度
|
|
98
|
-
* @default 256
|
|
99
|
-
*/
|
|
100
|
-
width?: number | string;
|
|
1
|
+
import type { DrawerProps } from 'antd';
|
|
101
2
|
|
|
102
|
-
|
|
103
|
-
* @description 高度
|
|
104
|
-
* @default 256
|
|
105
|
-
*/
|
|
106
|
-
height?: number | string;
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* @description 设置 Drawer 的 z-index
|
|
110
|
-
* @default 1000
|
|
111
|
-
*/
|
|
112
|
-
zIndex?: number;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* @description 用于设置多层 Drawer 的推动行为
|
|
116
|
-
* @type boolean | { distance: string | number }
|
|
117
|
-
* @default { distance: 180 }
|
|
118
|
-
*/
|
|
119
|
-
push?: boolean | PushState;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* @description 抽屉的方向
|
|
123
|
-
* @default right
|
|
124
|
-
*/
|
|
125
|
-
placement?: 'top' | 'right' | 'bottom' | 'left';
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* @description 点击遮罩层或右上角叉或取消按钮的回调
|
|
129
|
-
* @default -
|
|
130
|
-
*/
|
|
131
|
-
onClose?: (e: EventType) => void;
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* @description 点击footer下的确定按钮
|
|
135
|
-
* @default -
|
|
136
|
-
*/
|
|
137
|
-
onOk?: (e: EventType) => void;
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* @description 切换抽屉时动画结束后的回调
|
|
141
|
-
* @default -
|
|
142
|
-
*/
|
|
143
|
-
afterVisibleChange?: (visible: boolean) => void;
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* @description 对话框外层容器的类名
|
|
147
|
-
* @default -
|
|
148
|
-
*/
|
|
149
|
-
className?: string;
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* @description 是否支持键盘 esc 关闭
|
|
153
|
-
* @default true
|
|
154
|
-
*/
|
|
155
|
-
keyboard?: boolean;
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* @description 抽屉的页脚 可以设为 footer={null}
|
|
159
|
-
* @type ReactNode
|
|
160
|
-
* @default (确定取消按钮)
|
|
161
|
-
*/
|
|
162
|
-
footer?: React.ReactNode | false;
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* @description 抽屉页脚部件的样式
|
|
166
|
-
* @default -
|
|
167
|
-
* @type CSSProperties
|
|
168
|
-
*/
|
|
169
|
-
footerStyle?: React.CSSProperties;
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* @description 取消按钮文本
|
|
173
|
-
* @default 取消
|
|
174
|
-
* @type string
|
|
175
|
-
*/
|
|
3
|
+
export interface IDrawerProps extends DrawerProps {
|
|
176
4
|
cancelText?: string;
|
|
177
5
|
|
|
6
|
+
onOk?: (e: any) => void;
|
|
7
|
+
|
|
178
8
|
/**
|
|
179
9
|
* @description 确认按钮文本
|
|
180
10
|
* @default 确定
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { Component, ErrorInfo } from 'react';
|
|
2
|
+
export declare type IErrorBoundaryProps = {
|
|
3
|
+
fallback?: (() => JSX.Element) | React.ReactNode;
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
};
|
|
6
|
+
declare type State = {
|
|
7
|
+
error: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare class ErrorBoundary extends Component<IErrorBoundaryProps, State> {
|
|
10
|
+
state: State;
|
|
11
|
+
static defaultProps: {
|
|
12
|
+
fallback: () => JSX.Element;
|
|
13
|
+
};
|
|
14
|
+
static getDerivedStateFromError(error: Error): State;
|
|
15
|
+
componentDidCatch(error: Error, info: ErrorInfo): void;
|
|
16
|
+
render(): string | number | boolean | JSX.Element | React.ReactFragment;
|
|
17
|
+
}
|
|
18
|
+
export default ErrorBoundary;
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
+
|
|
5
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
6
|
+
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
+
|
|
9
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
10
|
+
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
+
|
|
13
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
+
|
|
15
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
16
|
+
|
|
17
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
+
|
|
19
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
|
+
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
+
|
|
23
|
+
import React, { Component } from 'react';
|
|
24
|
+
|
|
25
|
+
var ErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
26
|
+
_inherits(ErrorBoundary, _Component);
|
|
27
|
+
|
|
28
|
+
var _super = _createSuper(ErrorBoundary);
|
|
29
|
+
|
|
30
|
+
function ErrorBoundary() {
|
|
31
|
+
var _this;
|
|
32
|
+
|
|
33
|
+
_classCallCheck(this, ErrorBoundary);
|
|
34
|
+
|
|
35
|
+
_this = _super.apply(this, arguments);
|
|
36
|
+
_this.state = {
|
|
37
|
+
error: false
|
|
38
|
+
};
|
|
39
|
+
return _this;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
_createClass(ErrorBoundary, [{
|
|
43
|
+
key: "componentDidCatch",
|
|
44
|
+
value: function componentDidCatch(error, info) {
|
|
45
|
+
console.error('ErrorBoundary:', error, info);
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
48
|
+
key: "render",
|
|
49
|
+
value: function render() {
|
|
50
|
+
var error = this.state.error;
|
|
51
|
+
var _this$props = this.props,
|
|
52
|
+
children = _this$props.children,
|
|
53
|
+
fallback = _this$props.fallback;
|
|
54
|
+
|
|
55
|
+
if (error) {
|
|
56
|
+
if ( /*#__PURE__*/React.isValidElement(fallback)) {
|
|
57
|
+
return fallback;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (typeof fallback === 'function') {
|
|
61
|
+
return fallback();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return children;
|
|
66
|
+
}
|
|
67
|
+
}], [{
|
|
68
|
+
key: "getDerivedStateFromError",
|
|
69
|
+
value: function getDerivedStateFromError(error) {
|
|
70
|
+
return {
|
|
71
|
+
error: true
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}]);
|
|
75
|
+
|
|
76
|
+
return ErrorBoundary;
|
|
77
|
+
}(Component);
|
|
78
|
+
|
|
79
|
+
ErrorBoundary.defaultProps = {
|
|
80
|
+
fallback: function fallback() {
|
|
81
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
export default ErrorBoundary;
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
|
|
3
|
+
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
|
+
|
|
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
|
+
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
|
|
11
|
+
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; }
|
|
12
|
+
|
|
1
13
|
import React from 'react';
|
|
2
14
|
import GridList from './index';
|
|
3
15
|
|
|
@@ -5,33 +17,36 @@ function random(low, high) {
|
|
|
5
17
|
return Math.floor(Math.random() * high) + low;
|
|
6
18
|
}
|
|
7
19
|
|
|
8
|
-
var IMAGES =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
20
|
+
var IMAGES = function IMAGES() {
|
|
21
|
+
return Array.from({
|
|
22
|
+
length: 20
|
|
23
|
+
}, function (_, index) {
|
|
24
|
+
var width = 300;
|
|
25
|
+
var height = random(200, 300);
|
|
26
|
+
return {
|
|
27
|
+
url: "https://picsum.photos/id/".concat(index + 1, "/").concat(width, "/").concat(height, ".jpg"),
|
|
28
|
+
width: width,
|
|
29
|
+
height: height
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
};
|
|
19
33
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
}
|
|
34
|
+
function loadPage() {
|
|
35
|
+
var d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
36
|
+
var resultData = IMAGES();
|
|
37
|
+
d.page ? d.page++ : d.page = 1;
|
|
38
|
+
d.list ? d.list = [].concat(_toConsumableArray(d.list), _toConsumableArray(resultData)) : d.list = resultData;
|
|
39
|
+
return new Promise(function (resolve) {
|
|
40
|
+
setTimeout(function () {
|
|
41
|
+
return resolve(d);
|
|
42
|
+
}, 500);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
30
45
|
|
|
46
|
+
var App = function App() {
|
|
31
47
|
return /*#__PURE__*/React.createElement("div", {
|
|
32
48
|
style: {
|
|
33
|
-
height:
|
|
34
|
-
overflow: 'auto'
|
|
49
|
+
height: 400
|
|
35
50
|
}
|
|
36
51
|
}, /*#__PURE__*/React.createElement(GridList, {
|
|
37
52
|
itemKey: "url",
|
|
@@ -52,6 +67,7 @@ var App = function App() {
|
|
|
52
67
|
}
|
|
53
68
|
}, /*#__PURE__*/React.createElement("img", {
|
|
54
69
|
src: image.url,
|
|
70
|
+
alt: "",
|
|
55
71
|
style: {
|
|
56
72
|
objectFit: 'cover',
|
|
57
73
|
display: 'block',
|
|
@@ -60,10 +76,7 @@ var App = function App() {
|
|
|
60
76
|
}
|
|
61
77
|
})), /*#__PURE__*/React.createElement("p", null, "\u6807\u9898"), /*#__PURE__*/React.createElement("p", null, "\u63CF\u8FF0"));
|
|
62
78
|
},
|
|
63
|
-
|
|
64
|
-
isNoMore: function isNoMore() {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
79
|
+
loadPage: loadPage
|
|
67
80
|
}));
|
|
68
81
|
};
|
|
69
82
|
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { GridListCell } from '../GridList/interface';
|
|
3
|
+
import { TData } from '../../useInfiniteScroll';
|
|
2
4
|
export interface IDynamicGridListProps<T> {
|
|
3
|
-
itemKey: string;
|
|
4
5
|
itemHeight?: number;
|
|
5
|
-
itemWidth?: number;
|
|
6
|
-
loadNextPage: (d: IDynamicGridListResult<T>) => Promise<IDynamicGridListResult<T>>;
|
|
7
|
-
reloadDep?: any;
|
|
8
|
-
isNoMore: (d: any) => boolean;
|
|
9
|
-
renderItem: (item: T) => React.ReactNode;
|
|
10
6
|
className?: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
/**
|
|
8
|
+
* 重载条件
|
|
9
|
+
*/
|
|
10
|
+
reloadDeps?: any[];
|
|
11
|
+
/**
|
|
12
|
+
* render列表
|
|
13
|
+
* @param options
|
|
14
|
+
*/
|
|
15
|
+
renderItem: (item: T, cell: GridListCell<T>) => React.ReactNode;
|
|
16
|
+
loadPage(d: TData<T>): Promise<TData<T>>;
|
|
17
|
+
itemWidth?: number;
|
|
18
|
+
itemKey: string;
|
|
19
|
+
getGridGap?: (...args: any) => number;
|
|
20
|
+
isNoMore?: (data: TData<T>) => boolean;
|
|
21
|
+
threshold?: number;
|
|
16
22
|
}
|
|
17
|
-
declare function DynamicGridList<T>({
|
|
23
|
+
declare function DynamicGridList<T>({ renderItem, itemHeight, itemKey, itemWidth, reloadDeps, getGridGap, loadPage, isNoMore, threshold, ...props }: IDynamicGridListProps<T>): JSX.Element;
|
|
18
24
|
declare namespace DynamicGridList {
|
|
19
|
-
var defaultProps:
|
|
20
|
-
itemWidth: number;
|
|
21
|
-
itemHeight: number;
|
|
22
|
-
className: string;
|
|
23
|
-
getGridGap: () => number;
|
|
24
|
-
};
|
|
25
|
+
var defaultProps: any;
|
|
25
26
|
}
|
|
26
27
|
export default DynamicGridList;
|