@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
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { MenuRectType } from '../../../Picture/interface';
|
|
3
|
-
import './index.less';
|
|
4
2
|
interface IRectMenuProps {
|
|
5
3
|
x: number;
|
|
6
4
|
y: number;
|
|
@@ -8,5 +6,5 @@ interface IRectMenuProps {
|
|
|
8
6
|
containerDom: HTMLDivElement;
|
|
9
7
|
onMenuClick: (options: MenuRectType) => void;
|
|
10
8
|
}
|
|
11
|
-
declare function RectMenu({ x, y, menus, containerDom, onMenuClick }: IRectMenuProps): JSX.Element;
|
|
9
|
+
declare function RectMenu({ x, y, menus, containerDom, onMenuClick }: IRectMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
12
10
|
export default RectMenu;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
var _templateObject, _templateObject2;
|
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
+
import { css } from '@emotion/css';
|
|
4
|
+
import { useMemoizedFn } from 'ahooks';
|
|
5
|
+
import React, { useEffect, useMemo, useRef } from 'react';
|
|
2
6
|
import IconFont from "../../../IconFont";
|
|
3
7
|
import { computedMenuPosition } from "./utils";
|
|
4
|
-
import "./index.less";
|
|
5
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
10
|
var MENU_WIDTH = 110;
|
|
8
11
|
var MENU_HEIGHT = 30;
|
|
12
|
+
var selectRectMenuLayoutCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n width: 105px;\n overflow: hidden;\n font-size: var(--fs-small);\n"])));
|
|
13
|
+
var menuActionItemCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: 4px 10px;\n margin-bottom: 4px;\n color: rgb(0 0 0 / 65%);\n white-space: nowrap;\n background: #fff;\n border-radius: 15px;\n box-shadow: 0 0 2px rgb(0 0 0 / 20%);\n .anticon {\n padding-right: 2px;\n font-size: 16px;\n color: #89b;\n }\n &:hover {\n color: #fff;\n cursor: pointer;\n background: #fa0;\n .anticon {\n color: #fff;\n }\n }\n &:last-child {\n margin-bottom: 0;\n }\n"])));
|
|
9
14
|
function RectMenu(_ref) {
|
|
10
15
|
var x = _ref.x,
|
|
11
16
|
y = _ref.y,
|
|
@@ -32,9 +37,9 @@ function RectMenu(_ref) {
|
|
|
32
37
|
});
|
|
33
38
|
}, [height, size, width, x, y]);
|
|
34
39
|
var domRef = useRef(null);
|
|
35
|
-
var handleCancelB =
|
|
40
|
+
var handleCancelB = useMemoizedFn(function (e) {
|
|
36
41
|
return e.stopPropagation();
|
|
37
|
-
}
|
|
42
|
+
});
|
|
38
43
|
|
|
39
44
|
//防止click事件冒泡到查看器
|
|
40
45
|
useEffect(function () {
|
|
@@ -52,12 +57,12 @@ function RectMenu(_ref) {
|
|
|
52
57
|
}
|
|
53
58
|
};
|
|
54
59
|
}, [handleCancelB]);
|
|
55
|
-
var onClickMenu =
|
|
60
|
+
var onClickMenu = useMemoizedFn(function (e, item) {
|
|
56
61
|
e.stopPropagation();
|
|
57
62
|
onMenuClick === null || onMenuClick === void 0 ? void 0 : onMenuClick(item);
|
|
58
|
-
}
|
|
63
|
+
});
|
|
59
64
|
return /*#__PURE__*/_jsx("div", {
|
|
60
|
-
className:
|
|
65
|
+
className: selectRectMenuLayoutCss,
|
|
61
66
|
style: {
|
|
62
67
|
left: position.x,
|
|
63
68
|
top: position.y
|
|
@@ -65,7 +70,7 @@ function RectMenu(_ref) {
|
|
|
65
70
|
ref: domRef,
|
|
66
71
|
children: menus.map(function (v) {
|
|
67
72
|
return /*#__PURE__*/_jsxs("div", {
|
|
68
|
-
className:
|
|
73
|
+
className: menuActionItemCss,
|
|
69
74
|
onClick: function onClick(e) {
|
|
70
75
|
return onClickMenu(e, v);
|
|
71
76
|
},
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import './index.less';
|
|
3
2
|
interface IToolsProps {
|
|
4
3
|
scale: number;
|
|
5
4
|
imgDownload?: () => void;
|
|
@@ -8,5 +7,5 @@ interface IToolsProps {
|
|
|
8
7
|
containerEle: HTMLDivElement;
|
|
9
8
|
resetPicture: (event: React.MouseEvent) => void;
|
|
10
9
|
}
|
|
11
|
-
declare function Tools({ scale, imgDownload, setScale, setRotate, containerEle, resetPicture }: IToolsProps): JSX.Element;
|
|
10
|
+
declare function Tools({ scale, imgDownload, setScale, setRotate, containerEle, resetPicture }: IToolsProps): import("react/jsx-runtime").JSX.Element;
|
|
12
11
|
export default Tools;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
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."); }
|
|
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); }
|
|
4
|
+
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; }
|
|
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { useFullscreen } from 'ahooks';
|
|
1
8
|
import { Tooltip } from 'antd';
|
|
2
9
|
import React from 'react';
|
|
3
|
-
import FullScreen from "../../../FullScreen";
|
|
4
10
|
import IconFont from "../../../Player/iconfont";
|
|
5
|
-
import "./
|
|
11
|
+
import { pictureActionsCss, pictureToolsCss } from "./style";
|
|
6
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
14
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -13,9 +19,13 @@ function Tools(_ref) {
|
|
|
13
19
|
setRotate = _ref.setRotate,
|
|
14
20
|
containerEle = _ref.containerEle,
|
|
15
21
|
resetPicture = _ref.resetPicture;
|
|
22
|
+
var _useFullscreen = useFullscreen(containerEle),
|
|
23
|
+
_useFullscreen2 = _slicedToArray(_useFullscreen, 2),
|
|
24
|
+
isFullscreen = _useFullscreen2[0],
|
|
25
|
+
toggleFullscreen = _useFullscreen2[1].toggleFullscreen;
|
|
16
26
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
17
27
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
18
|
-
className:
|
|
28
|
+
className: pictureToolsCss,
|
|
19
29
|
children: [/*#__PURE__*/_jsx(Tooltip, {
|
|
20
30
|
placement: "left",
|
|
21
31
|
title: "\u590D\u4F4D",
|
|
@@ -73,18 +83,20 @@ function Tools(_ref) {
|
|
|
73
83
|
})
|
|
74
84
|
})]
|
|
75
85
|
}), /*#__PURE__*/_jsxs("div", {
|
|
76
|
-
className:
|
|
86
|
+
className: pictureActionsCss,
|
|
77
87
|
children: [imgDownload && /*#__PURE__*/_jsx("div", {
|
|
78
88
|
onClick: imgDownload,
|
|
79
89
|
children: /*#__PURE__*/_jsx(IconFont, {
|
|
80
90
|
type: "lm-player-S_Edit_LoadDown"
|
|
81
91
|
})
|
|
82
92
|
}), /*#__PURE__*/_jsx("div", {
|
|
83
|
-
children: /*#__PURE__*/_jsx(
|
|
84
|
-
className: "footer_window",
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
93
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
94
|
+
className: "className=\"footer_window",
|
|
95
|
+
onClick: toggleFullscreen,
|
|
96
|
+
children: /*#__PURE__*/_jsx(IconFont, {
|
|
97
|
+
className: "defualt-fullscreen-icon icon-primary",
|
|
98
|
+
type: !isFullscreen ? 'lm-player-S_View_ScreenViewFull' : 'lm-player-S_View_ScreenViewExit'
|
|
99
|
+
})
|
|
88
100
|
})
|
|
89
101
|
})]
|
|
90
102
|
})]
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var _templateObject, _templateObject2;
|
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
+
import { css } from '@emotion/css';
|
|
4
|
+
export var pictureToolsCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n right: 10px;\n bottom: 10px;\n background: #fff;\n box-shadow: 0 2px 5px 0 rgb(0 0 0 / 30%);\n &.actions-change-rotate {\n bottom: 150px;\n }\n & > div {\n width: 30px;\n height: 25px;\n line-height: 25px;\n text-align: center;\n cursor: pointer;\n\n &.disabled {\n color: #999;\n cursor: not-allowed;\n\n .anticon {\n color: #999;\n }\n }\n }\n"])));
|
|
5
|
+
export var pictureActionsCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n top: 8px;\n right: 8px;\n & > div {\n float: left;\n width: 28px;\n height: 28px;\n margin-left: 4px;\n line-height: 28px;\n text-align: center;\n cursor: pointer;\n background: #fff;\n }\n\n .tools-screen-layer .anticon {\n padding-right: 0;\n }\n"])));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
interface IWheelScaleProps {
|
|
3
2
|
dom: HTMLElement;
|
|
4
3
|
setScale: (scale: number) => void;
|
|
5
4
|
}
|
|
6
|
-
declare function WheelScale({ dom, setScale }: IWheelScaleProps): JSX.Element;
|
|
5
|
+
declare function WheelScale({ dom, setScale }: IWheelScaleProps): import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
export default WheelScale;
|
package/es/Picture/demo.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function App(): JSX.Element;
|
|
1
|
+
export default function App(): import("react/jsx-runtime").JSX.Element;
|
package/es/Picture/demo.js
CHANGED
|
@@ -5,7 +5,6 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5
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; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { Button, ConfigProvider, Modal } from 'antd';
|
|
8
|
-
import React from 'react';
|
|
9
8
|
import Picture from '.';
|
|
10
9
|
import { useSimpleState } from '..';
|
|
11
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -80,6 +79,7 @@ export default function App() {
|
|
|
80
79
|
},
|
|
81
80
|
width: 844,
|
|
82
81
|
destroyOnClose: true,
|
|
82
|
+
forceRender: true,
|
|
83
83
|
children: /*#__PURE__*/_jsx("div", {
|
|
84
84
|
style: {
|
|
85
85
|
width: 800,
|
package/es/Picture/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { IPictureProps } from './interface';
|
|
3
|
-
import
|
|
4
|
-
declare function Picture({ className, width, height, minHeight, disabledDrag, imagePath, rects, isOpenSelect, disabledDrawMenu, menus, hasTool, fullScreenEle, ...props }: IPictureProps): JSX.Element;
|
|
2
|
+
declare function Picture({ className, width, height, minHeight, disabledDrag, imagePath, rects, isOpenSelect, disabledDrawMenu, menus, hasTool, fullScreenEle, ...props }: IPictureProps): import("react/jsx-runtime").JSX.Element;
|
|
5
3
|
declare namespace Picture {
|
|
6
4
|
var defaultProps: {
|
|
7
5
|
width: string;
|
package/es/Picture/index.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
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 _useUpdateLayoutEffect from "ahooks/es/useUpdateLayoutEffect";
|
|
4
|
-
import _useMemoizedFn from "ahooks/es/useMemoizedFn";
|
|
5
|
-
import _useSize from "ahooks/es/useSize";
|
|
6
2
|
var _excluded = ["className", "width", "height", "minHeight", "disabledDrag", "imagePath", "rects", "isOpenSelect", "disabledDrawMenu", "menus", "hasTool", "fullScreenEle"];
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
7
4
|
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; }
|
|
8
5
|
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; }
|
|
9
6
|
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; }
|
|
@@ -17,6 +14,9 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
17
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
15
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
19
16
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
17
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
18
|
+
import { css } from '@emotion/css';
|
|
19
|
+
import { useMemoizedFn, useSize, useUpdateEffect, useUpdateLayoutEffect } from 'ahooks';
|
|
20
20
|
import React, { useEffect, useMemo, useRef } from 'react';
|
|
21
21
|
import DomMove from "../DomMove";
|
|
22
22
|
import useSimpleState from "../useSimpleState";
|
|
@@ -27,10 +27,12 @@ import WheelScale from "./component/WheelScale";
|
|
|
27
27
|
import { getRectImagePath } from "./loadCaptureRectImage";
|
|
28
28
|
import useDraw from "./useDraw";
|
|
29
29
|
import { computedRectScale, customContextMenu, getImgSize } from "./utils";
|
|
30
|
-
import "./index.less";
|
|
31
30
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
32
31
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
33
32
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
33
|
+
var pictureViewLayout = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n min-height: 300px;\n overflow: hidden;\n user-select: none;\n"])));
|
|
34
|
+
var pictureMoveLayoutDiv = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: max-content;\n height: max-content;\n transition: all 0.3s;\n overflow: hidden;\n"])));
|
|
35
|
+
var pictureMoveLayoutImg = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n max-width: 100%;\n max-height: 100%;\n"])));
|
|
34
36
|
function Picture(_ref) {
|
|
35
37
|
var _layoutRef$current;
|
|
36
38
|
var className = _ref.className,
|
|
@@ -73,7 +75,7 @@ function Picture(_ref) {
|
|
|
73
75
|
var layoutRef = useRef(null);
|
|
74
76
|
var moveActionRef = useRef(null);
|
|
75
77
|
var domImgRef = useRef(null);
|
|
76
|
-
var size =
|
|
78
|
+
var size = useSize(layoutRef);
|
|
77
79
|
useEffect(function () {
|
|
78
80
|
if (!imagePath) {
|
|
79
81
|
return undefined;
|
|
@@ -101,7 +103,7 @@ function Picture(_ref) {
|
|
|
101
103
|
isEnd = _useDraw2[1];
|
|
102
104
|
|
|
103
105
|
// init loaded
|
|
104
|
-
var loadImageSuccess =
|
|
106
|
+
var loadImageSuccess = useMemoizedFn(function () {
|
|
105
107
|
if (!state.localUrl || !layoutRef.current || !domImgRef.current) {
|
|
106
108
|
return;
|
|
107
109
|
}
|
|
@@ -128,12 +130,12 @@ function Picture(_ref) {
|
|
|
128
130
|
});
|
|
129
131
|
|
|
130
132
|
// 更新重绘
|
|
131
|
-
|
|
133
|
+
useUpdateLayoutEffect(function () {
|
|
132
134
|
loadImageSuccess();
|
|
133
135
|
}, [size]);
|
|
134
136
|
|
|
135
137
|
// 更新重绘
|
|
136
|
-
|
|
138
|
+
useUpdateLayoutEffect(function () {
|
|
137
139
|
// Rects重新计算
|
|
138
140
|
updateState({
|
|
139
141
|
forceUpdateKey: Date.now()
|
|
@@ -143,7 +145,7 @@ function Picture(_ref) {
|
|
|
143
145
|
/**
|
|
144
146
|
* 设置图片缩放
|
|
145
147
|
*/
|
|
146
|
-
var setScale =
|
|
148
|
+
var setScale = useMemoizedFn(function (changeValue) {
|
|
147
149
|
var currentValue = state.scale;
|
|
148
150
|
if (currentValue === 3 && changeValue > 0) {
|
|
149
151
|
return;
|
|
@@ -168,7 +170,7 @@ function Picture(_ref) {
|
|
|
168
170
|
/**
|
|
169
171
|
* 设置图谱旋转
|
|
170
172
|
*/
|
|
171
|
-
var setRotate =
|
|
173
|
+
var setRotate = useMemoizedFn(function (changeValue) {
|
|
172
174
|
var currentValue = state.rotate;
|
|
173
175
|
setState(function (old) {
|
|
174
176
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
@@ -180,7 +182,7 @@ function Picture(_ref) {
|
|
|
180
182
|
/**
|
|
181
183
|
* 重置图片位置
|
|
182
184
|
*/
|
|
183
|
-
var resetPicture =
|
|
185
|
+
var resetPicture = useMemoizedFn(function (event) {
|
|
184
186
|
event.stopPropagation();
|
|
185
187
|
var moveObj = moveActionRef.current;
|
|
186
188
|
setState(function (old) {
|
|
@@ -198,7 +200,7 @@ function Picture(_ref) {
|
|
|
198
200
|
/**
|
|
199
201
|
* 拖拽更新位置
|
|
200
202
|
*/
|
|
201
|
-
var onDragChange =
|
|
203
|
+
var onDragChange = useMemoizedFn(function (_ref2) {
|
|
202
204
|
var x = _ref2.x,
|
|
203
205
|
y = _ref2.y;
|
|
204
206
|
return setState(function (old) {
|
|
@@ -212,7 +214,7 @@ function Picture(_ref) {
|
|
|
212
214
|
/**
|
|
213
215
|
* 拖拽结束更新位置,计算边界
|
|
214
216
|
*/
|
|
215
|
-
var onDragEnd =
|
|
217
|
+
var onDragEnd = useMemoizedFn(function (_, currrentPosition) {
|
|
216
218
|
if (!layoutRef.current || !domImgRef.current) {
|
|
217
219
|
return undefined;
|
|
218
220
|
}
|
|
@@ -244,7 +246,7 @@ function Picture(_ref) {
|
|
|
244
246
|
/**
|
|
245
247
|
* 获取结构化的小图(base64)
|
|
246
248
|
*/
|
|
247
|
-
var getRectImage =
|
|
249
|
+
var getRectImage = useMemoizedFn(function (rect) {
|
|
248
250
|
return getRectImagePath(domImgRef.current, rect);
|
|
249
251
|
});
|
|
250
252
|
|
|
@@ -265,7 +267,7 @@ function Picture(_ref) {
|
|
|
265
267
|
getRectImage: getRectImage,
|
|
266
268
|
containerEle: layoutRef.current
|
|
267
269
|
};
|
|
268
|
-
|
|
270
|
+
useUpdateEffect(function () {
|
|
269
271
|
if (isOpenSelect) {
|
|
270
272
|
var moveObj = moveActionRef.current;
|
|
271
273
|
moveObj.updatePosition({
|
|
@@ -282,7 +284,7 @@ function Picture(_ref) {
|
|
|
282
284
|
}, [isOpenSelect]);
|
|
283
285
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
284
286
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
285
|
-
className: "
|
|
287
|
+
className: "".concat(pictureViewLayout, " ").concat(className),
|
|
286
288
|
style: {
|
|
287
289
|
width: width,
|
|
288
290
|
height: height,
|
|
@@ -291,18 +293,18 @@ function Picture(_ref) {
|
|
|
291
293
|
ref: layoutRef,
|
|
292
294
|
onContextMenu: customContextMenu,
|
|
293
295
|
children: [/*#__PURE__*/_jsx(DomMove, {
|
|
294
|
-
className: "picture-move-layout",
|
|
295
296
|
disabled: isOpenSelect || disabledDrag,
|
|
296
297
|
ref: moveActionRef,
|
|
297
298
|
onDragChange: onDragChange,
|
|
298
299
|
onDragEnd: onDragEnd,
|
|
299
300
|
children: /*#__PURE__*/_jsxs("div", {
|
|
300
|
-
className: "picture-overlay",
|
|
301
|
+
className: "picture-overlay ".concat(pictureMoveLayoutDiv),
|
|
301
302
|
style: {
|
|
302
303
|
transform: "scale(".concat(state.scale, ") rotate(").concat(state.rotate, "deg)")
|
|
303
304
|
},
|
|
304
305
|
children: [/*#__PURE__*/_jsx("img", {
|
|
305
306
|
ref: domImgRef,
|
|
307
|
+
className: pictureMoveLayoutImg,
|
|
306
308
|
draggable: false,
|
|
307
309
|
src: state.localUrl,
|
|
308
310
|
style: {
|
package/es/Picture/useDraw.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import _useEventListener from "ahooks/es/useEventListener";
|
|
2
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
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."); }
|
|
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); }
|
|
5
4
|
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; }
|
|
6
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; } }
|
|
7
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { useEventListener } from 'ahooks';
|
|
8
8
|
import { useCallback, useRef, useState } from 'react';
|
|
9
9
|
export default function useDraw(dom, open) {
|
|
10
10
|
var _useState = useState({
|
|
@@ -74,7 +74,7 @@ export default function useDraw(dom, open) {
|
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
}, [dom]);
|
|
77
|
-
|
|
77
|
+
useEventListener('mousedown', function (event) {
|
|
78
78
|
if (open) {
|
|
79
79
|
selectOptionsRef.current.startSelect = true;
|
|
80
80
|
selectOptionsRef.current.start = [event.clientX, event.clientY];
|
|
@@ -82,7 +82,7 @@ export default function useDraw(dom, open) {
|
|
|
82
82
|
}, {
|
|
83
83
|
target: dom
|
|
84
84
|
});
|
|
85
|
-
|
|
85
|
+
useEventListener('mousemove', function (event) {
|
|
86
86
|
if (selectOptionsRef.current.startSelect) {
|
|
87
87
|
selectOptionsRef.current.end = [event.clientX, event.clientY];
|
|
88
88
|
drawSelectRact(false);
|
|
@@ -90,7 +90,7 @@ export default function useDraw(dom, open) {
|
|
|
90
90
|
}, {
|
|
91
91
|
target: dom
|
|
92
92
|
});
|
|
93
|
-
|
|
93
|
+
useEventListener('mouseup', function (event) {
|
|
94
94
|
if (selectOptionsRef.current.startSelect) {
|
|
95
95
|
selectOptionsRef.current.startSelect = false;
|
|
96
96
|
selectOptionsRef.current.end = [event.clientX, event.clientY];
|
package/es/Player/api/index.d.ts
CHANGED
package/es/Player/api/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _useMemoizedFn from "ahooks/es/useMemoizedFn";
|
|
2
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); }
|
|
3
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; }
|
|
4
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; }
|
|
@@ -17,6 +16,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
17
16
|
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; }
|
|
18
17
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
19
18
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
|
+
import { useMemoizedFn } from 'ahooks';
|
|
20
20
|
import { useEffect, useMemo, useState } from 'react';
|
|
21
21
|
import nextTick from "../../nextTick";
|
|
22
22
|
import { likeGo } from "../../utils";
|
|
@@ -44,6 +44,10 @@ var Api = /*#__PURE__*/function () {
|
|
|
44
44
|
var _this$video2;
|
|
45
45
|
(_this$video2 = _this.video) === null || _this$video2 === void 0 ? void 0 : _this$video2.pause();
|
|
46
46
|
});
|
|
47
|
+
/**
|
|
48
|
+
* 设置currentTime实现seek
|
|
49
|
+
* @param {*} seconds
|
|
50
|
+
*/
|
|
47
51
|
_defineProperty(this, "seekTo", function (seconds) {
|
|
48
52
|
if (_this.video) {
|
|
49
53
|
_this.video.currentTime = seconds;
|
|
@@ -68,20 +72,33 @@ var Api = /*#__PURE__*/function () {
|
|
|
68
72
|
_this.video.muted = false;
|
|
69
73
|
}
|
|
70
74
|
});
|
|
75
|
+
/**
|
|
76
|
+
* 开启画中画功能
|
|
77
|
+
*/
|
|
71
78
|
_defineProperty(this, "requestPictureInPicture", function () {
|
|
72
79
|
var _this$video4;
|
|
73
80
|
(_this$video4 = _this.video) === null || _this$video4 === void 0 ? void 0 : _this$video4.requestPictureInPicture();
|
|
74
81
|
});
|
|
82
|
+
/**
|
|
83
|
+
* 关闭画中画功能
|
|
84
|
+
*/
|
|
75
85
|
_defineProperty(this, "exitPictureInPicture", function () {
|
|
76
86
|
if (document.exitPictureInPicture && document.pictureInPictureElement === _this.video) {
|
|
77
87
|
document.exitPictureInPicture();
|
|
78
88
|
}
|
|
79
89
|
});
|
|
90
|
+
/**
|
|
91
|
+
* 设置播放速率
|
|
92
|
+
* @param {*} rate
|
|
93
|
+
*/
|
|
80
94
|
_defineProperty(this, "setPlaybackRate", function (rate) {
|
|
81
95
|
if (_this.video) {
|
|
82
96
|
_this.video.playbackRate = rate;
|
|
83
97
|
}
|
|
84
98
|
});
|
|
99
|
+
/**
|
|
100
|
+
* 获取视频总时长
|
|
101
|
+
*/
|
|
85
102
|
_defineProperty(this, "getDuration", function () {
|
|
86
103
|
var _ref2 = _this.video || {},
|
|
87
104
|
duration = _ref2.duration,
|
|
@@ -91,14 +108,23 @@ var Api = /*#__PURE__*/function () {
|
|
|
91
108
|
}
|
|
92
109
|
return duration !== null && duration !== void 0 ? duration : 0;
|
|
93
110
|
});
|
|
111
|
+
/**
|
|
112
|
+
* 获取当前播放时间
|
|
113
|
+
*/
|
|
94
114
|
_defineProperty(this, "getCurrentTime", function () {
|
|
95
115
|
var _this$video$currentTi, _this$video5;
|
|
96
116
|
return (_this$video$currentTi = (_this$video5 = _this.video) === null || _this$video5 === void 0 ? void 0 : _this$video5.currentTime) !== null && _this$video$currentTi !== void 0 ? _this$video$currentTi : 0;
|
|
97
117
|
});
|
|
118
|
+
/**
|
|
119
|
+
* 获取缓存时间
|
|
120
|
+
*/
|
|
98
121
|
_defineProperty(this, "getSecondsLoaded", function () {
|
|
99
122
|
var _this$getBufferedTime;
|
|
100
123
|
return (_this$getBufferedTime = _this.getBufferedTime()[1]) !== null && _this$getBufferedTime !== void 0 ? _this$getBufferedTime : 0;
|
|
101
124
|
});
|
|
125
|
+
/**
|
|
126
|
+
* 获取当前视频缓存的起止时间
|
|
127
|
+
*/
|
|
102
128
|
_defineProperty(this, "getBufferedTime", function () {
|
|
103
129
|
var _buffered$end, _buffered$start, _this$getDuration;
|
|
104
130
|
var _ref3 = _this.video || {},
|
|
@@ -114,6 +140,9 @@ var Api = /*#__PURE__*/function () {
|
|
|
114
140
|
}
|
|
115
141
|
return [start, end];
|
|
116
142
|
});
|
|
143
|
+
/**
|
|
144
|
+
* 视频截屏方法
|
|
145
|
+
*/
|
|
117
146
|
_defineProperty(this, "snapshot", function () {
|
|
118
147
|
var _this$video$videoWidt, _this$video6, _this$video$videoHeig, _this$video7, _ctx;
|
|
119
148
|
var canvas = document.createElement('canvas');
|
|
@@ -155,11 +184,6 @@ var Api = /*#__PURE__*/function () {
|
|
|
155
184
|
var _this$video9;
|
|
156
185
|
return (_this$video9 = this.video) === null || _this$video9 === void 0 ? void 0 : _this$video9.muted;
|
|
157
186
|
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* 设置currentTime实现seek
|
|
161
|
-
* @param {*} seconds
|
|
162
|
-
*/
|
|
163
187
|
}]);
|
|
164
188
|
return Api;
|
|
165
189
|
}();
|
|
@@ -194,17 +218,19 @@ export function useTypeAndPlay(url, type, isLive, container, segments, flvConfig
|
|
|
194
218
|
video === null || video === void 0 ? void 0 : video.setAttribute('src', url !== null && url !== void 0 ? url : '');
|
|
195
219
|
break;
|
|
196
220
|
}
|
|
197
|
-
(video
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
221
|
+
if (video !== null && video !== void 0 && video.paused) {
|
|
222
|
+
likeGo( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
223
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
224
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
225
|
+
case 0:
|
|
226
|
+
return _context2.abrupt("return", video === null || video === void 0 ? void 0 : video.play());
|
|
227
|
+
case 1:
|
|
228
|
+
case "end":
|
|
229
|
+
return _context2.stop();
|
|
230
|
+
}
|
|
231
|
+
}, _callee2);
|
|
232
|
+
})));
|
|
233
|
+
}
|
|
208
234
|
setState(options);
|
|
209
235
|
return function () {
|
|
210
236
|
if (options.flv) {
|
|
@@ -262,7 +288,7 @@ export function usePlayerApi(url, type, isLive, container, segments, flvConfig,
|
|
|
262
288
|
};
|
|
263
289
|
}, [forceKey]);
|
|
264
290
|
var typePlay = useTypeAndPlay(url, type, isLive, container, segments, config.flvConfig, config.hlsConfig);
|
|
265
|
-
var rePlay =
|
|
291
|
+
var rePlay = useMemoizedFn(function () {
|
|
266
292
|
return setForceKey(Date.now());
|
|
267
293
|
});
|
|
268
294
|
useEffect(function () {
|
package/es/Player/context.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface IPlayerContextProps {
|
|
|
13
13
|
children: React.ReactNode;
|
|
14
14
|
}
|
|
15
15
|
export declare const Context: React.Context<Omit<IPlayerContextProps, "children">>;
|
|
16
|
-
export declare function Provider({ children, ...props }: IPlayerContextProps): JSX.Element;
|
|
16
|
+
export declare function Provider({ children, ...props }: IPlayerContextProps): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
export declare namespace Provider {
|
|
18
18
|
var defaultProps: {
|
|
19
19
|
getContainer: () => HTMLElement;
|
|
@@ -4,5 +4,5 @@ interface IBarProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
|
4
4
|
className?: string;
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
}
|
|
7
|
-
declare function Bar({ visibel, className, children, ...props }: IBarProps): JSX.Element | null;
|
|
7
|
+
declare function Bar({ visibel, className, children, ...props }: IBarProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
8
|
export default Bar;
|
|
@@ -1,5 +1,6 @@
|
|
|
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
2
|
var _excluded = ["visibel", "className", "children"];
|
|
3
|
+
var _templateObject;
|
|
3
4
|
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; }
|
|
4
5
|
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; }
|
|
5
6
|
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; }
|
|
@@ -7,8 +8,11 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
7
8
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
9
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
12
|
+
import { css } from '@emotion/css';
|
|
10
13
|
import React from 'react';
|
|
11
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
var contrallerBarItem = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n float: left;\n width: 28px;\n height: 28px;\n justify-content: center;\n align-items: center;\n .anticon {\n cursor: pointer;\n &:hover {\n color: var(--primary);\n }\n }\n"])));
|
|
12
16
|
function Bar(_ref) {
|
|
13
17
|
var _ref$visibel = _ref.visibel,
|
|
14
18
|
visibel = _ref$visibel === void 0 ? true : _ref$visibel,
|
|
@@ -20,7 +24,7 @@ function Bar(_ref) {
|
|
|
20
24
|
return null;
|
|
21
25
|
}
|
|
22
26
|
return /*#__PURE__*/_jsx("span", _objectSpread(_objectSpread({
|
|
23
|
-
className: "
|
|
27
|
+
className: "".concat(contrallerBarItem, " ").concat(className)
|
|
24
28
|
}, props), {}, {
|
|
25
29
|
children: children
|
|
26
30
|
}));
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
interface IContrallerEventProps {
|
|
3
3
|
children?: React.ReactNode;
|
|
4
4
|
}
|
|
5
|
-
declare function ContrallerEvent({ children }: IContrallerEventProps): JSX.Element;
|
|
5
|
+
declare function ContrallerEvent({ children }: IContrallerEventProps): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export default ContrallerEvent;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import _useEventListener from "ahooks/es/useEventListener";
|
|
2
|
-
import _useMount from "ahooks/es/useMount";
|
|
3
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
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."); }
|
|
5
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); }
|
|
6
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
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; } }
|
|
8
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { useEventListener, useMount } from 'ahooks';
|
|
9
8
|
import React, { useContext, useRef, useState } from 'react';
|
|
10
9
|
import { Context } from "../context";
|
|
11
10
|
import EventName from "../event/eventName";
|
|
@@ -33,13 +32,13 @@ function ContrallerEvent(_ref) {
|
|
|
33
32
|
event === null || event === void 0 ? void 0 : event.emit(EventName.HIDE_CONTRALLER);
|
|
34
33
|
}, 3 * 1000);
|
|
35
34
|
};
|
|
36
|
-
|
|
35
|
+
useMount(function () {
|
|
37
36
|
return hideContraller();
|
|
38
37
|
});
|
|
39
|
-
|
|
38
|
+
useEventListener('mouseenter', showContraller, {
|
|
40
39
|
target: container
|
|
41
40
|
});
|
|
42
|
-
|
|
41
|
+
useEventListener('mouseleave', hideContraller, {
|
|
43
42
|
target: container
|
|
44
43
|
});
|
|
45
44
|
return /*#__PURE__*/_jsx(_Fragment, {
|