@cloud-app-dev/vidc 3.0.3 → 3.0.6
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/.umirc.ts +12 -7
- package/es/DisableMark/index.css +9 -0
- package/es/DisableMark/index.d.ts +8 -0
- package/es/DisableMark/index.js +10 -0
- package/es/Drawer/index.css +1 -0
- package/es/Map/AMap.d.ts +6841 -1308
- package/es/Map/BasicMap/AMapInstance.d.ts +4 -3
- package/es/Map/BasicMap/AMapInstance.js +18 -3
- package/es/Map/BasicMap/LeafletInstance.d.ts +3 -3
- package/es/Map/ClusterLayer/hook.d.ts +4 -4
- package/es/Map/ClusterLayer/hook.js +20 -24
- package/es/Map/ClusterLayer/index.d.ts +1 -0
- package/es/Map/ClusterLayer/index.js +1 -0
- package/es/Map/Config/utils.js +2 -2
- package/es/Map/InfoWindow/MakerLikeWindow.d.ts +4 -0
- package/es/Map/InfoWindow/MakerLikeWindow.js +103 -0
- package/es/Map/InfoWindow/demo.js +48 -21
- package/es/Map/InfoWindow/index.d.ts +7 -5
- package/es/Map/InfoWindow/index.js +7 -6
- package/es/Map/interface.d.ts +1 -1
- package/es/Map/useMarker/index.d.ts +2 -2
- package/es/Map/useMarker/index.js +3 -19
- package/es/Player/api/index.js +0 -1
- package/es/Player/demo.js +4 -3
- package/es/Player/event/errorEvent.js +3 -8
- package/es/Player/iconfont.d.ts +1 -1
- package/es/Player/iconfont.js +1 -1
- package/es/Player/live_heart.js +7 -32
- package/es/Player/single_player.js +6 -1
- package/es/Player/style/iconfont.ttf +0 -0
- package/es/Player/style/iconfont.woff +0 -0
- package/es/Player/style/iconfont.woff2 +0 -0
- package/es/ScreenPlayer/Live.d.ts +1 -1
- package/es/ScreenPlayer/Live.js +22 -4
- package/es/ScreenPlayer/LiveTools.d.ts +5 -1
- package/es/ScreenPlayer/LiveTools.js +87 -43
- package/es/ScreenPlayer/PlayerWithExt.js +29 -4
- package/es/ScreenPlayer/Record.d.ts +1 -1
- package/es/ScreenPlayer/Record.js +27 -8
- package/es/ScreenPlayer/RecordTools.d.ts +5 -1
- package/es/ScreenPlayer/RecordTools.js +103 -46
- package/es/ScreenPlayer/ScreenSelect.d.ts +7 -0
- package/es/ScreenPlayer/ScreenSelect.js +28 -0
- package/es/ScreenPlayer/SegmentTimeLine.d.ts +1 -2
- package/es/ScreenPlayer/SegmentTimeLine.js +9 -6
- package/es/ScreenPlayer/TimeSelect.d.ts +7 -0
- package/es/ScreenPlayer/TimeSelect.js +129 -0
- package/es/ScreenPlayer/demo.d.ts +1 -1
- package/es/ScreenPlayer/demo.js +9 -4
- package/es/ScreenPlayer/demo2.js +1 -1
- package/es/ScreenPlayer/index.css +62 -4
- package/es/ScreenPlayer/interface.d.ts +27 -0
- package/es/Timeout/index.d.ts +8 -9
- package/es/Timeout/index.js +17 -23
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="src/map/amap" />
|
|
2
|
+
import { IMapInstance, IMapOptions } from '../interface';
|
|
2
3
|
declare class AMapInstance implements IMapInstance {
|
|
3
|
-
map: Map;
|
|
4
|
+
map: AMap.Map;
|
|
4
5
|
config: IMapOptions;
|
|
5
6
|
mapContainer: HTMLDivElement;
|
|
6
7
|
constructor(ele: HTMLDivElement, config: IMapOptions);
|
|
@@ -8,7 +9,7 @@ declare class AMapInstance implements IMapInstance {
|
|
|
8
9
|
destoryMap(): void;
|
|
9
10
|
mapReset(): void;
|
|
10
11
|
setZoom(zoom: number): void;
|
|
11
|
-
getZoom():
|
|
12
|
+
getZoom(): number;
|
|
12
13
|
setCenter(center: [number, number]): void;
|
|
13
14
|
setZoomAndCenter(zoom: number, center: [number, number]): void;
|
|
14
15
|
}
|
|
@@ -16,17 +16,32 @@ var AMapInstance = /*#__PURE__*/function () {
|
|
|
16
16
|
_createClass(AMapInstance, [{
|
|
17
17
|
key: "createMap",
|
|
18
18
|
value: function createMap() {
|
|
19
|
+
var _this = this;
|
|
20
|
+
|
|
19
21
|
var _a;
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
this.map = new _global.AMap.Map(this.mapContainer, {
|
|
23
|
+
this.map = new AMap.Map(this.mapContainer, {
|
|
23
24
|
viewMode: '3D',
|
|
24
25
|
zoom: this.config.zoom,
|
|
25
26
|
center: this.config.center,
|
|
26
|
-
|
|
27
|
+
rotateEnable: true,
|
|
28
|
+
pitchEnable: true,
|
|
29
|
+
pitch: 50,
|
|
30
|
+
rotation: -15,
|
|
31
|
+
zooms: [2, 20],
|
|
27
32
|
resizeEnable: true,
|
|
28
33
|
mapStyle: "amap://styles/".concat((_a = this.config.amapStyle) !== null && _a !== void 0 ? _a : 'normal')
|
|
29
34
|
});
|
|
35
|
+
AMap.plugin(['AMap.ControlBar'], function () {
|
|
36
|
+
var controlBar = new AMap.ControlBar({
|
|
37
|
+
position: {
|
|
38
|
+
right: '10px',
|
|
39
|
+
top: '10px'
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
_this.map.addControl(controlBar);
|
|
44
|
+
});
|
|
30
45
|
}
|
|
31
46
|
}, {
|
|
32
47
|
key: "destoryMap",
|
|
@@ -8,8 +8,8 @@ declare class LeafletInstance implements IMapInstance {
|
|
|
8
8
|
destoryMap(): void;
|
|
9
9
|
setZoomAndCenter(zoom: number, center: [number, number] | LatLng): void;
|
|
10
10
|
mapReset(): void;
|
|
11
|
-
setZoom(zoom: number):
|
|
12
|
-
setCenter(center: [number, number] | LatLng):
|
|
13
|
-
getZoom():
|
|
11
|
+
setZoom(zoom: number): Map;
|
|
12
|
+
setCenter(center: [number, number] | LatLng): void;
|
|
13
|
+
getZoom(): number;
|
|
14
14
|
}
|
|
15
15
|
export default LeafletInstance;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
/// <reference types="src/map/amap" />
|
|
2
|
+
import { MapPoint, Marker, LClusterInterface } from '../interface';
|
|
3
3
|
import './index.less';
|
|
4
|
-
export declare function useMarkerCluster(onPointClick?: (point: MapPoint) => void): LClusterInterface &
|
|
5
|
-
export declare function useMarkers(points?: MapPoint[]):
|
|
4
|
+
export declare function useMarkerCluster(onPointClick?: (point: MapPoint) => void): LClusterInterface & AMap.MarkerCluster;
|
|
5
|
+
export declare function useMarkers(points?: MapPoint[]): Marker[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _useUnmount from "ahooks/es/useUnmount";
|
|
1
2
|
import _useUpdate from "ahooks/es/useUpdate";
|
|
2
3
|
|
|
3
4
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -12,12 +13,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
12
13
|
|
|
13
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
15
|
|
|
16
|
+
/// <reference path="../AMap.d.ts" />
|
|
15
17
|
import { useContext, useEffect, useRef, useState } from 'react';
|
|
16
18
|
import useMapType from '../hook/useMapType';
|
|
17
19
|
import { mapContext } from '../Context';
|
|
18
20
|
import { createMapCenterIcon } from '../icon';
|
|
19
21
|
import "./index.css";
|
|
20
|
-
var _global = window;
|
|
21
22
|
var clusterOptions = {
|
|
22
23
|
showCoverageOnHover: false,
|
|
23
24
|
maxClusterRadius: 80,
|
|
@@ -44,24 +45,19 @@ export function useMarkerCluster(onPointClick) {
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
if (type.AMap) {
|
|
47
|
-
|
|
48
|
-
var data = context.data[0];
|
|
49
|
-
context.marker.setLabel({
|
|
50
|
-
content: data.deviceName,
|
|
51
|
-
direction: 'top',
|
|
52
|
-
offset: [0, -2]
|
|
53
|
-
});
|
|
54
|
-
onPointClick && context.marker.on('click', function () {
|
|
55
|
-
return onPointClick(data);
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
instance.map.plugin(['AMap.MarkerCluster'], function () {
|
|
60
|
-
var AMap = _global.AMap;
|
|
48
|
+
AMap.plugin(['AMap.MarkerCluster'], function () {
|
|
61
49
|
var cluster = new AMap.MarkerCluster(instance.map, [], {
|
|
62
50
|
gridSize: 40,
|
|
63
|
-
renderMarker: renderMarker
|
|
64
|
-
|
|
51
|
+
renderMarker: function renderMarker(context) {
|
|
52
|
+
var data = context.data[0];
|
|
53
|
+
context.marker.setLabel({
|
|
54
|
+
content: data.deviceName,
|
|
55
|
+
direction: 'top'
|
|
56
|
+
});
|
|
57
|
+
onPointClick && context.marker.on('click', function () {
|
|
58
|
+
return onPointClick(data);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
65
61
|
});
|
|
66
62
|
cluster.on('click', function (e) {
|
|
67
63
|
if (e.clusterData.length === 1) {
|
|
@@ -77,11 +73,13 @@ export function useMarkerCluster(onPointClick) {
|
|
|
77
73
|
|
|
78
74
|
update(); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
79
75
|
}, []);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
76
|
+
|
|
77
|
+
_useUnmount(function () {
|
|
78
|
+
try {
|
|
79
|
+
instance.map.remove(clusterRef.current);
|
|
80
|
+
} catch (_) {}
|
|
81
|
+
});
|
|
82
|
+
|
|
85
83
|
return clusterRef.current;
|
|
86
84
|
}
|
|
87
85
|
export function useMarkers(points) {
|
|
@@ -120,8 +118,6 @@ export function useMarkers(points) {
|
|
|
120
118
|
}
|
|
121
119
|
|
|
122
120
|
if (type.AMap) {
|
|
123
|
-
var AMap = _global.AMap;
|
|
124
|
-
|
|
125
121
|
for (var _i2 = 0, _l = points.length; _i2 < _l; _i2++) {
|
|
126
122
|
var _point = points[_i2];
|
|
127
123
|
|
package/es/Map/Config/utils.js
CHANGED
|
@@ -10,7 +10,7 @@ var localconfig = {
|
|
|
10
10
|
center: [118.767413, 32.041544],
|
|
11
11
|
maxZoom: 18,
|
|
12
12
|
minZoom: 3,
|
|
13
|
-
zoom:
|
|
13
|
+
zoom: 16,
|
|
14
14
|
zoomOffset: 0,
|
|
15
15
|
distance: 50,
|
|
16
16
|
amapStyle: 'normal',
|
|
@@ -25,7 +25,7 @@ export function queryMapConfig(type) {
|
|
|
25
25
|
case 0:
|
|
26
26
|
url = localconfig.url, crs = localconfig.crs, maxBounds = localconfig.maxBounds, subdomains = localconfig.subdomains, zoom = localconfig.zoom, zoomOffset = localconfig.zoomOffset, center = localconfig.center, maxZoom = localconfig.maxZoom, minZoom = localconfig.minZoom, distance = localconfig.distance, amapStyle = localconfig.amapStyle;
|
|
27
27
|
|
|
28
|
-
if (!(type
|
|
28
|
+
if (!(type === 'L')) {
|
|
29
29
|
_context.next = 3;
|
|
30
30
|
break;
|
|
31
31
|
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import _useUnmount from "ahooks/es/useUnmount";
|
|
2
|
+
|
|
3
|
+
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
4
|
+
|
|
5
|
+
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; } }
|
|
6
|
+
|
|
7
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
8
|
+
|
|
9
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
10
|
+
|
|
11
|
+
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."); }
|
|
12
|
+
|
|
13
|
+
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); }
|
|
14
|
+
|
|
15
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
16
|
+
|
|
17
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
18
|
+
|
|
19
|
+
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; }
|
|
20
|
+
|
|
21
|
+
/// <reference path="../AMap.d.ts" />
|
|
22
|
+
import React, { useContext, useEffect, useRef } from 'react';
|
|
23
|
+
import ReactDOM from 'react-dom';
|
|
24
|
+
import { mapContext } from '../Context';
|
|
25
|
+
import useMapType from '../hook/useMapType';
|
|
26
|
+
var maxIndex = 20;
|
|
27
|
+
export default function MakerLikeWindow(_ref) {
|
|
28
|
+
var children = _ref.children,
|
|
29
|
+
visible = _ref.visible,
|
|
30
|
+
center = _ref.center,
|
|
31
|
+
width = _ref.width,
|
|
32
|
+
height = _ref.height;
|
|
33
|
+
|
|
34
|
+
var _useContext = useContext(mapContext),
|
|
35
|
+
instance = _useContext.instance;
|
|
36
|
+
|
|
37
|
+
var domref = useRef(null);
|
|
38
|
+
var markerRef = useRef(null);
|
|
39
|
+
var type = useMapType();
|
|
40
|
+
useEffect(function () {
|
|
41
|
+
if (!instance.map) {
|
|
42
|
+
return;
|
|
43
|
+
} // leaflet下还未实现
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
if (type.AMap && !markerRef.current) {
|
|
47
|
+
var marker = new AMap.Marker({
|
|
48
|
+
content: domref.current,
|
|
49
|
+
visible: false,
|
|
50
|
+
zIndex: maxIndex,
|
|
51
|
+
map: instance.map,
|
|
52
|
+
offset: [-width * 0.5, -height - 32]
|
|
53
|
+
});
|
|
54
|
+
markerRef.current = marker;
|
|
55
|
+
marker.on('click', function () {
|
|
56
|
+
maxIndex++;
|
|
57
|
+
|
|
58
|
+
if (marker.getzIndex() !== maxIndex) {
|
|
59
|
+
marker.setzIndex(maxIndex);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}, [instance.map, visible, center]);
|
|
64
|
+
useEffect(function () {
|
|
65
|
+
var marker = markerRef.current;
|
|
66
|
+
|
|
67
|
+
if (!marker || !center) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (type.AMap) {
|
|
72
|
+
var lnglat = _construct(AMap.LngLat, _toConsumableArray(center));
|
|
73
|
+
|
|
74
|
+
if (visible) {
|
|
75
|
+
marker.setPosition(lnglat);
|
|
76
|
+
marker.setContent(domref.current);
|
|
77
|
+
ReactDOM.render(children, domref.current);
|
|
78
|
+
marker.show();
|
|
79
|
+
} else {
|
|
80
|
+
marker.hide();
|
|
81
|
+
ReactDOM.unmountComponentAtNode(domref.current);
|
|
82
|
+
instance.map.remove(markerRef.current);
|
|
83
|
+
markerRef.current = null;
|
|
84
|
+
}
|
|
85
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
86
|
+
|
|
87
|
+
}, [visible, center, instance.map]);
|
|
88
|
+
|
|
89
|
+
_useUnmount(function () {
|
|
90
|
+
try {
|
|
91
|
+
instance.map.remove(markerRef.current);
|
|
92
|
+
markerRef.current = null;
|
|
93
|
+
} catch (_) {}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
ref: domref,
|
|
98
|
+
style: {
|
|
99
|
+
width: width,
|
|
100
|
+
height: height
|
|
101
|
+
}
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
@@ -1,3 +1,11 @@
|
|
|
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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
|
|
7
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
|
+
|
|
1
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
10
|
|
|
3
11
|
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."); }
|
|
@@ -13,19 +21,41 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
21
|
import React, { useState } from 'react';
|
|
14
22
|
import Map from '../BasicMap';
|
|
15
23
|
import ClusterLayer from '../ClusterLayer';
|
|
16
|
-
import InfoWindow from '
|
|
24
|
+
import InfoWindow from './MakerLikeWindow';
|
|
17
25
|
import deviceList from '../points.json';
|
|
18
26
|
import Player from '../../Player';
|
|
19
27
|
|
|
20
28
|
var App = function App() {
|
|
21
|
-
var _useState = useState(
|
|
22
|
-
visible: false,
|
|
23
|
-
center: undefined
|
|
24
|
-
}),
|
|
29
|
+
var _useState = useState([]),
|
|
25
30
|
_useState2 = _slicedToArray(_useState, 2),
|
|
26
31
|
state = _useState2[0],
|
|
27
32
|
setState = _useState2[1];
|
|
28
33
|
|
|
34
|
+
var addDeviceInfoWindow = function addDeviceInfoWindow(item) {
|
|
35
|
+
var longitude = item.longitude,
|
|
36
|
+
latitude = item.latitude,
|
|
37
|
+
cid = item.cid;
|
|
38
|
+
var arr = state;
|
|
39
|
+
var index = arr.findIndex(function (v) {
|
|
40
|
+
return v.cid === cid;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (index === -1) {
|
|
44
|
+
arr.push({
|
|
45
|
+
visible: true,
|
|
46
|
+
center: [longitude, latitude],
|
|
47
|
+
cid: cid,
|
|
48
|
+
url: 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (index > -1 && !arr[index].visible) {
|
|
53
|
+
arr[index].visible = true;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
setState(_toConsumableArray(arr));
|
|
57
|
+
};
|
|
58
|
+
|
|
29
59
|
return /*#__PURE__*/React.createElement("div", {
|
|
30
60
|
style: {
|
|
31
61
|
width: '100%',
|
|
@@ -34,23 +64,20 @@ var App = function App() {
|
|
|
34
64
|
}, /*#__PURE__*/React.createElement(Map, null, /*#__PURE__*/React.createElement(ClusterLayer, {
|
|
35
65
|
points: deviceList,
|
|
36
66
|
onPointClick: function onPointClick(point) {
|
|
37
|
-
return
|
|
38
|
-
return Object.assign(Object.assign({}, old), {
|
|
39
|
-
visible: true,
|
|
40
|
-
center: [point.longitude, point.latitude]
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}), /*#__PURE__*/React.createElement(InfoWindow, {
|
|
45
|
-
visible: state.visible,
|
|
46
|
-
center: state.center
|
|
47
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
48
|
-
style: {
|
|
49
|
-
width: 560,
|
|
50
|
-
height: 360,
|
|
51
|
-
background: '#fff'
|
|
67
|
+
return addDeviceInfoWindow(point);
|
|
52
68
|
}
|
|
53
|
-
},
|
|
69
|
+
}), state.map(function (item) {
|
|
70
|
+
return /*#__PURE__*/React.createElement(InfoWindow, {
|
|
71
|
+
visible: item.visible,
|
|
72
|
+
center: item.center,
|
|
73
|
+
key: item.cid,
|
|
74
|
+
width: 200,
|
|
75
|
+
height: 100
|
|
76
|
+
}, /*#__PURE__*/React.createElement(Player, {
|
|
77
|
+
url: item.url,
|
|
78
|
+
hideContrallerBar: true
|
|
79
|
+
}));
|
|
80
|
+
})));
|
|
54
81
|
};
|
|
55
82
|
|
|
56
83
|
export default App;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/// <reference types="src/map/amap" />
|
|
3
|
+
export interface InfoWindowProps {
|
|
4
|
+
children: JSX.Element;
|
|
4
5
|
visible?: boolean;
|
|
5
6
|
center?: [number, number];
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
6
9
|
}
|
|
7
|
-
export default function InfoWindow({ children, visible, center }: InfoWindowProps): JSX.Element;
|
|
8
|
-
export {};
|
|
10
|
+
export default function InfoWindow({ children, visible, center, width, height }: InfoWindowProps): JSX.Element;
|
|
@@ -16,15 +16,17 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
16
16
|
|
|
17
17
|
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; }
|
|
18
18
|
|
|
19
|
+
/// <reference path="../AMap.d.ts" />
|
|
19
20
|
import React, { useContext, useEffect, useRef } from 'react';
|
|
20
21
|
import ReactDOM from 'react-dom';
|
|
21
22
|
import { mapContext } from '../Context';
|
|
22
23
|
import useMapType from '../hook/useMapType';
|
|
23
|
-
var _global = window;
|
|
24
24
|
export default function InfoWindow(_ref) {
|
|
25
25
|
var children = _ref.children,
|
|
26
26
|
visible = _ref.visible,
|
|
27
|
-
center = _ref.center
|
|
27
|
+
center = _ref.center,
|
|
28
|
+
width = _ref.width,
|
|
29
|
+
height = _ref.height;
|
|
28
30
|
|
|
29
31
|
var _useContext = useContext(mapContext),
|
|
30
32
|
instance = _useContext.instance;
|
|
@@ -39,9 +41,8 @@ export default function InfoWindow(_ref) {
|
|
|
39
41
|
|
|
40
42
|
|
|
41
43
|
if (type.AMap && !infoWindowRef.current) {
|
|
42
|
-
var AMap = _global.AMap;
|
|
43
44
|
var infoWindow = new AMap.InfoWindow({
|
|
44
|
-
|
|
45
|
+
size: [width, height],
|
|
45
46
|
content: domref.current,
|
|
46
47
|
autoMove: false,
|
|
47
48
|
offset: [0, -32]
|
|
@@ -58,11 +59,11 @@ export default function InfoWindow(_ref) {
|
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
if (type.AMap) {
|
|
61
|
-
var
|
|
62
|
+
var map = instance.map;
|
|
62
63
|
|
|
63
64
|
var lnglat = _construct(AMap.LngLat, _toConsumableArray(center));
|
|
64
65
|
|
|
65
|
-
|
|
66
|
+
map.setCenter(lnglat); // eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
66
67
|
|
|
67
68
|
visible ? !infoWindow.getIsOpen() ? (infoWindow.close(), infoWindow.open(instance.map, lnglat)) : infoWindow.open(instance.map, lnglat) : infoWindow.close();
|
|
68
69
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
package/es/Map/interface.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
/// <reference types="src/map/amap" />
|
|
1
2
|
import { Map } from '../interface';
|
|
2
|
-
import { AMap as AMapType } from '../AMap';
|
|
3
3
|
import './index.less';
|
|
4
4
|
export interface IUseMarkerProps {
|
|
5
5
|
map: Map;
|
|
6
6
|
center: [number, number];
|
|
7
7
|
createIcon: (options?: any) => any;
|
|
8
|
-
options?:
|
|
8
|
+
options?: AMap.MarkerOptions;
|
|
9
9
|
}
|
|
10
10
|
declare function useMarker({ map, center, createIcon, options }: IUseMarkerProps): any;
|
|
11
11
|
export default useMarker;
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
2
|
-
|
|
3
|
-
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; } }
|
|
4
|
-
|
|
5
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
6
|
-
|
|
7
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
-
|
|
9
|
-
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."); }
|
|
10
|
-
|
|
11
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
|
-
|
|
13
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
14
|
-
|
|
15
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
2
|
|
|
17
3
|
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."); }
|
|
@@ -24,10 +10,10 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
24
10
|
|
|
25
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
12
|
|
|
13
|
+
/// <reference path="../AMap.d.ts" />
|
|
27
14
|
import { useEffect, useRef, useState } from 'react';
|
|
28
15
|
import useMapType from '../hook/useMapType';
|
|
29
16
|
import "./index.css";
|
|
30
|
-
var _global = window;
|
|
31
17
|
|
|
32
18
|
function useMarker(_ref) {
|
|
33
19
|
var map = _ref.map,
|
|
@@ -70,13 +56,11 @@ function useMarker(_ref) {
|
|
|
70
56
|
}
|
|
71
57
|
|
|
72
58
|
if (type.AMap) {
|
|
73
|
-
var AMap = _global.AMap;
|
|
74
|
-
|
|
75
59
|
if (inMap.current) {
|
|
76
|
-
state.marker.setPosition(
|
|
60
|
+
state.marker.setPosition(center);
|
|
77
61
|
} else {
|
|
78
62
|
var _marker = new AMap.Marker(Object.assign({
|
|
79
|
-
position:
|
|
63
|
+
position: center
|
|
80
64
|
}, options));
|
|
81
65
|
|
|
82
66
|
map.add(_marker);
|
package/es/Player/api/index.js
CHANGED
package/es/Player/demo.js
CHANGED
|
@@ -118,7 +118,8 @@ function Demo1() {
|
|
|
118
118
|
}, "\u64AD\u653E")), /*#__PURE__*/React.createElement(Player, {
|
|
119
119
|
type: state.type,
|
|
120
120
|
url: state.url,
|
|
121
|
-
isLive: !!state.isLive
|
|
121
|
+
isLive: !!state.isLive,
|
|
122
|
+
customTimeLine: state.isLive ? /*#__PURE__*/React.createElement(React.Fragment, null) : undefined
|
|
122
123
|
}));
|
|
123
124
|
}
|
|
124
125
|
|
|
@@ -199,8 +200,8 @@ function Demo3() {
|
|
|
199
200
|
var _useState5 = useState({
|
|
200
201
|
url: 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4',
|
|
201
202
|
tempUrl: '',
|
|
202
|
-
begin:
|
|
203
|
-
end:
|
|
203
|
+
begin: 1652889636000,
|
|
204
|
+
end: 1652890200000
|
|
204
205
|
}),
|
|
205
206
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
206
207
|
state = _useState6[0],
|
|
@@ -78,17 +78,12 @@ function ErrorEvent(_ref) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
event.on(EventName.ERROR, errorHandle);
|
|
81
|
+
event.on(EventName.CLEAR_ERROR_TIMER, clearErrorTimer);
|
|
81
82
|
event.addEventListener('error', errorHandle); //获取video状态清除错误状态
|
|
82
83
|
|
|
83
84
|
event.addEventListener('canplay', reloadSuccess);
|
|
84
85
|
return function () {
|
|
85
|
-
//
|
|
86
|
-
// if (flv) {
|
|
87
|
-
// flv.off(flvjs.Events.ERROR, errorHandle);
|
|
88
|
-
// }
|
|
89
|
-
// if (hls) {
|
|
90
|
-
// hls.off(Hls.Events.ERROR, errorHandle);
|
|
91
|
-
// }
|
|
86
|
+
// flv, hls事件不用主动销毁,库内部自己处理
|
|
92
87
|
event.off(EventName.ERROR, errorHandle);
|
|
93
88
|
event.removeEventListener('error', errorHandle);
|
|
94
89
|
event.removeEventListener('canplay', reloadSuccess);
|
|
@@ -112,7 +107,7 @@ function ErrorEvent(_ref) {
|
|
|
112
107
|
}, 2 * 1000);
|
|
113
108
|
return function () {
|
|
114
109
|
clearTimeout(reloadTimer.current);
|
|
115
|
-
};
|
|
110
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
116
111
|
}, [errorTimer, api, event, flv, hls]);
|
|
117
112
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
118
113
|
}
|
package/es/Player/iconfont.d.ts
CHANGED