@cloud-app-dev/vidc 3.1.15 → 3.1.17
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/es/Api/index.js +0 -23
- package/es/AppContext/Sync.js +1 -15
- package/es/AppContext/index.js +21 -52
- package/es/AppContext/static.js +0 -7
- package/es/Auth/index.js +2 -5
- package/es/AutoExit/index.js +1 -5
- package/es/Box/BetweenBox/index.js +6 -8
- package/es/Box/InfoBox/index.js +6 -8
- package/es/Box/TwoColumnBox/index.js +8 -18
- package/es/Box/deps/grid-factory.js +0 -12
- package/es/Box/index.js +4 -6
- package/es/CheckGroupFixed/index.js +19 -34
- package/es/Config/index.js +0 -4
- package/es/Config/utils.js +3 -18
- package/es/ConfigContext/index.js +1 -3
- package/es/CustomRenderSelect/index.js +13 -29
- package/es/DisableMark/index.js +2 -2
- package/es/DomMove/index.js +24 -37
- package/es/DomMove/utils.js +3 -8
- package/es/Drag/DragAndDropItem.js +19 -37
- package/es/Drag/DropItem.js +5 -15
- package/es/Drawer/Demo.js +3 -17
- package/es/Drawer/Footer.js +3 -5
- package/es/Drawer/index.js +28 -50
- package/es/ErrorFallback/index.js +1 -3
- package/es/FullScreen/index.js +8 -18
- package/es/HightLevel/index.js +1 -5
- package/es/IconFont/index.js +5 -11
- package/es/ImageView/index.js +8 -20
- package/es/Input/index.js +14 -27
- package/es/InstanceHistory/index.js +0 -2
- package/es/LabelValue/index.js +8 -10
- package/es/List/DynamicGridList/Demo.js +0 -11
- package/es/List/DynamicGridList/index.js +16 -25
- package/es/List/DynamicList/index.js +23 -38
- package/es/List/GridList/Demo.js +3 -16
- package/es/List/GridList/hook.js +34 -65
- package/es/List/GridList/utils.js +0 -1
- package/es/List/VList/index.js +10 -20
- package/es/List/VList/utils.js +2 -3
- package/es/List/index.js +5 -7
- package/es/LoaderApp/index.js +5 -22
- package/es/LoaderApp/loader.js +5 -13
- package/es/LoaderApp/sandbox.back.js +16 -81
- package/es/LoaderApp/sandbox.js +8 -22
- package/es/LoaderApp/utils.js +20 -49
- package/es/LoaderScript/index.js +8 -19
- package/es/LoaderScript/utils.js +0 -51
- package/es/Map/BasicMap/AMapInstance.js +0 -10
- package/es/Map/BasicMap/LeafletInstance.js +11 -20
- package/es/Map/BasicMap/index.js +6 -28
- package/es/Map/ClusterLayer/hook.js +10 -32
- package/es/Map/ClusterLayer/index.js +2 -6
- package/es/Map/Config/index.js +8 -21
- package/es/Map/Config/utils.js +0 -6
- package/es/Map/Context/index.js +2 -22
- package/es/Map/FindPio/index.js +0 -2
- package/es/Map/InfoWindow/MakerLikeWindow.js +9 -28
- package/es/Map/InfoWindow/demo.js +5 -22
- package/es/Map/InfoWindow/index.js +13 -29
- package/es/Map/LevelCenter/DragMarker/index.js +5 -9
- package/es/Map/LevelCenter/demo.js +6 -16
- package/es/Map/LevelCenter/index.js +8 -15
- package/es/Map/LoaderMap/index.js +10 -10
- package/es/Map/MapDrawSelect/demo.js +12 -23
- package/es/Map/MapDrawSelect/index.js +14 -21
- package/es/Map/MouseTool/index.js +16 -26
- package/es/Map/MouseTool/useMouseTools.js +6 -29
- package/es/Map/ResetTools/index.js +4 -8
- package/es/Map/SinglePoint/index.js +6 -13
- package/es/Map/hook/useMapEvent.js +3 -7
- package/es/Map/hook/useMapType.js +1 -2
- package/es/Map/useMarker/index.js +10 -24
- package/es/Map/withMap/index.js +0 -2
- package/es/Modal/index.d.ts +1 -1
- package/es/Modal/index.js +29 -50
- package/es/Picture/component/DefaultRects/RectInfo.js +11 -25
- package/es/Picture/component/DefaultRects/index.js +3 -5
- package/es/Picture/component/DrawRect/index.js +6 -8
- package/es/Picture/component/RectMenu/index.js +10 -16
- package/es/Picture/component/RectMenu/utils.js +3 -6
- package/es/Picture/component/Tools/index.js +6 -8
- package/es/Picture/component/WheelScale/index.js +3 -6
- package/es/Picture/dragBound.js +4 -17
- package/es/Picture/index.js +46 -87
- package/es/Picture/loadCaptureRectImage.js +10 -26
- package/es/Picture/useDraw.js +20 -39
- package/es/Picture/utils.js +2 -11
- package/es/Player/api/index.js +14 -78
- package/es/Player/context.js +1 -2
- package/es/Player/contraller_bar/bar.js +5 -9
- package/es/Player/contraller_bar/contraller_event.js +5 -23
- package/es/Player/contraller_bar/index.js +7 -9
- package/es/Player/contraller_bar/left_bar.js +15 -27
- package/es/Player/contraller_bar/right_bar.js +7 -18
- package/es/Player/contraller_bar/time.js +6 -16
- package/es/Player/contraller_bar/useBarStatus.js +5 -16
- package/es/Player/contraller_bar/volume.js +6 -26
- package/es/Player/demo.js +59 -75
- package/es/Player/event/errorEvent.js +14 -39
- package/es/Player/event/eventName.js +1 -1
- package/es/Player/event/index.js +19 -53
- package/es/Player/fps_play.js +10 -27
- package/es/Player/frontend_player.js +10 -19
- package/es/Player/frontend_timeline.js +25 -47
- package/es/Player/iconfont.js +2 -5
- package/es/Player/live_heart.js +2 -14
- package/es/Player/message.js +9 -29
- package/es/Player/segment_player.js +39 -77
- package/es/Player/segment_timeline.js +42 -68
- package/es/Player/single_player.js +64 -87
- package/es/Player/style/iconfont.js +10 -17
- package/es/Player/timeline.js +11 -28
- package/es/Player/util.js +0 -21
- package/es/PlayerExt/demo.js +11 -21
- package/es/PlayerExt/index.js +18 -43
- package/es/Progress/index.js +3 -15
- package/es/ROI/demo.js +0 -2
- package/es/ROI/index.js +15 -22
- package/es/ScreenPlayer/Live.js +35 -68
- package/es/ScreenPlayer/LiveTools.js +24 -37
- package/es/ScreenPlayer/PlayerWithExt.js +43 -78
- package/es/ScreenPlayer/RatePick.js +1 -3
- package/es/ScreenPlayer/Record.js +52 -123
- package/es/ScreenPlayer/RecordTools.js +32 -53
- package/es/ScreenPlayer/ScreenSelect.js +1 -3
- package/es/ScreenPlayer/SegmentTimeLine.js +8 -12
- package/es/ScreenPlayer/TimeMode.js +1 -3
- package/es/ScreenPlayer/TimeSelect.js +11 -26
- package/es/ScreenPlayer/demo.js +3 -1
- package/es/ScreenPlayer/demo2.js +10 -46
- package/es/ScreenPlayer/useRecordList.js +7 -72
- package/es/ScreenPlayer/useTimeSlider.js +40 -132
- package/es/ScreenPlayer/useVideoFit.js +5 -18
- package/es/ScreenPlayer/utils.js +0 -8
- package/es/Service/fetch-adapter.js +2 -37
- package/es/Service/http.js +8 -27
- package/es/TableLayout/index.js +3 -7
- package/es/ThemeAntd/demo.js +0 -2
- package/es/Timeout/index.js +10 -26
- package/es/Tree/demo.js +0 -2
- package/es/Tree/index.js +14 -21
- package/es/useDrawROI/index.js +51 -105
- package/es/useEventEmitterHandle/index.js +2 -6
- package/es/useFullscreen/demo.js +6 -16
- package/es/useFullscreen/index.js +5 -25
- package/es/useHistory/index.js +0 -2
- package/es/useInfiniteScroll/index.js +14 -39
- package/es/useRafInterval/index.js +2 -26
- package/es/useSimpleState/index.js +5 -16
- package/es/useVirtualList/index.js +19 -57
- package/es/utils.js +0 -28
- package/package.json +14 -14
package/es/Map/BasicMap/index.js
CHANGED
|
@@ -1,25 +1,14 @@
|
|
|
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
|
-
|
|
3
2
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
-
|
|
5
3
|
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
4
|
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
5
|
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
6
|
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
7
|
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
8
|
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
9
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
-
|
|
19
10
|
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
11
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
-
|
|
23
12
|
import React from 'react';
|
|
24
13
|
import LoaderMap from '../LoaderMap';
|
|
25
14
|
import { Provider } from '../Context';
|
|
@@ -29,29 +18,22 @@ import Config from '../Config';
|
|
|
29
18
|
import { withErrorBoundary } from 'react-error-boundary';
|
|
30
19
|
import { errorBoundaryOptions } from '../../ErrorFallback';
|
|
31
20
|
import "./index.css";
|
|
32
|
-
|
|
33
21
|
var Map = /*#__PURE__*/function (_React$Component) {
|
|
34
22
|
_inherits(Map, _React$Component);
|
|
35
|
-
|
|
36
23
|
var _super = _createSuper(Map);
|
|
37
|
-
|
|
38
24
|
function Map() {
|
|
39
25
|
var _this;
|
|
40
|
-
|
|
41
26
|
_classCallCheck(this, Map);
|
|
42
|
-
|
|
43
27
|
_this = _super.apply(this, arguments);
|
|
44
28
|
_this.domRef = /*#__PURE__*/React.createRef();
|
|
45
29
|
return _this;
|
|
46
30
|
}
|
|
47
|
-
|
|
48
31
|
_createClass(Map, [{
|
|
49
32
|
key: "componentDidMount",
|
|
50
33
|
value: function componentDidMount() {
|
|
51
34
|
if (!this.domRef.current) {
|
|
52
35
|
return;
|
|
53
36
|
}
|
|
54
|
-
|
|
55
37
|
var mapOptions = this.props.config;
|
|
56
38
|
var instance = this.props.isL ? LeafletInstance : AMapInstance;
|
|
57
39
|
this.mapInstance = new instance(this.domRef.current, mapOptions);
|
|
@@ -67,10 +49,10 @@ var Map = /*#__PURE__*/function (_React$Component) {
|
|
|
67
49
|
key: "render",
|
|
68
50
|
value: function render() {
|
|
69
51
|
var _this$props = this.props,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
52
|
+
children = _this$props.children,
|
|
53
|
+
_this$props$className = _this$props.className,
|
|
54
|
+
className = _this$props$className === void 0 ? '' : _this$props$className,
|
|
55
|
+
glaobalKey = _this$props.glaobalKey;
|
|
74
56
|
return /*#__PURE__*/React.createElement(Provider, {
|
|
75
57
|
value: {
|
|
76
58
|
instance: this.mapInstance,
|
|
@@ -83,22 +65,18 @@ var Map = /*#__PURE__*/function (_React$Component) {
|
|
|
83
65
|
}), this.mapInstance && children));
|
|
84
66
|
}
|
|
85
67
|
}]);
|
|
86
|
-
|
|
87
68
|
return Map;
|
|
88
69
|
}(React.Component);
|
|
89
|
-
|
|
90
70
|
var MapViewType = withErrorBoundary(Map, errorBoundaryOptions);
|
|
91
71
|
var MapView = MapViewType;
|
|
92
|
-
|
|
93
72
|
function WithLoaderMap(_ref) {
|
|
94
73
|
var MAP_GLABAL_KEY = _ref.MAP_GLABAL_KEY,
|
|
95
|
-
|
|
96
|
-
|
|
74
|
+
children = _ref.children,
|
|
75
|
+
className = _ref.className;
|
|
97
76
|
return /*#__PURE__*/React.createElement(LoaderMap, {
|
|
98
77
|
MAP_GLABAL_KEY: MAP_GLABAL_KEY
|
|
99
78
|
}, /*#__PURE__*/React.createElement(Config, null, /*#__PURE__*/React.createElement(MapView, {
|
|
100
79
|
className: className
|
|
101
80
|
}, children)));
|
|
102
81
|
}
|
|
103
|
-
|
|
104
82
|
export default WithLoaderMap;
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import _useUnmount from "ahooks/es/useUnmount";
|
|
2
2
|
import _useUpdate from "ahooks/es/useUpdate";
|
|
3
|
-
|
|
4
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
|
-
|
|
6
4
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
-
|
|
8
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); }
|
|
9
|
-
|
|
10
6
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
11
|
-
|
|
12
7
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
13
|
-
|
|
14
8
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
-
|
|
16
9
|
/// <reference path="../AMap.d.ts" />
|
|
17
10
|
import { useContext, useEffect, useRef, useState } from 'react';
|
|
18
11
|
import useMapType from '../hook/useMapType';
|
|
@@ -29,12 +22,9 @@ var clusterOptions = {
|
|
|
29
22
|
};
|
|
30
23
|
export function useMarkerCluster(onPointClick) {
|
|
31
24
|
var _useContext = useContext(mapContext),
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
instance = _useContext.instance;
|
|
34
26
|
var type = useMapType();
|
|
35
|
-
|
|
36
27
|
var update = _useUpdate();
|
|
37
|
-
|
|
38
28
|
var clusterRef = useRef(null);
|
|
39
29
|
useEffect(function () {
|
|
40
30
|
if (type.leaflet) {
|
|
@@ -43,7 +33,6 @@ export function useMarkerCluster(onPointClick) {
|
|
|
43
33
|
clusterGroup.addTo(instance.map);
|
|
44
34
|
clusterRef.current = clusterGroup;
|
|
45
35
|
}
|
|
46
|
-
|
|
47
36
|
if (type.AMap) {
|
|
48
37
|
AMap.plugin(['AMap.MarkerCluster'], function () {
|
|
49
38
|
var cluster = new AMap.MarkerCluster(instance.map, [], {
|
|
@@ -63,47 +52,39 @@ export function useMarkerCluster(onPointClick) {
|
|
|
63
52
|
if (e.clusterData.length === 1) {
|
|
64
53
|
return;
|
|
65
54
|
}
|
|
66
|
-
|
|
67
55
|
var lnglat = e === null || e === void 0 ? void 0 : e.lnglat;
|
|
68
56
|
lnglat && instance.setZoomAndCenter(instance.getZoom() + 1, lnglat);
|
|
69
57
|
});
|
|
70
58
|
clusterRef.current = cluster;
|
|
71
59
|
});
|
|
72
60
|
}
|
|
73
|
-
|
|
74
|
-
|
|
61
|
+
update();
|
|
62
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
63
|
}, []);
|
|
76
|
-
|
|
77
64
|
_useUnmount(function () {
|
|
78
65
|
try {
|
|
79
66
|
instance.map.remove(clusterRef.current);
|
|
80
67
|
} catch (_) {}
|
|
81
68
|
});
|
|
82
|
-
|
|
83
69
|
return clusterRef.current;
|
|
84
70
|
}
|
|
85
71
|
export function useMarkers(points) {
|
|
86
72
|
var type = useMapType();
|
|
87
73
|
var L = window.L;
|
|
88
|
-
|
|
89
74
|
var _useState = useState({
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
75
|
+
markers: []
|
|
76
|
+
}),
|
|
77
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
78
|
+
state = _useState2[0],
|
|
79
|
+
setState = _useState2[1];
|
|
96
80
|
useEffect(function () {
|
|
97
81
|
if (!points) {
|
|
98
82
|
return;
|
|
99
83
|
}
|
|
100
|
-
|
|
101
84
|
var arr = [];
|
|
102
|
-
|
|
103
85
|
if (type.leaflet) {
|
|
104
86
|
for (var i = 0, l = points.length; i < l; i++) {
|
|
105
87
|
var point = points[i];
|
|
106
|
-
|
|
107
88
|
if (point && point.latitude && point.longitude) {
|
|
108
89
|
var marker = new L.Marker(L.latLng(point.latitude, point.longitude), {
|
|
109
90
|
icon: createMapCenterIcon()
|
|
@@ -116,25 +97,22 @@ export function useMarkers(points) {
|
|
|
116
97
|
}
|
|
117
98
|
}
|
|
118
99
|
}
|
|
119
|
-
|
|
120
100
|
if (type.AMap) {
|
|
121
101
|
for (var _i2 = 0, _l = points.length; _i2 < _l; _i2++) {
|
|
122
102
|
var _point = points[_i2];
|
|
123
|
-
|
|
124
103
|
if (_point && _point.latitude && _point.longitude) {
|
|
125
104
|
var _marker = Object.assign({
|
|
126
105
|
lnglat: new AMap.LngLat(_point.longitude, _point.latitude),
|
|
127
106
|
weight: 1
|
|
128
107
|
}, _point);
|
|
129
|
-
|
|
130
108
|
arr.push(_marker);
|
|
131
109
|
}
|
|
132
110
|
}
|
|
133
111
|
}
|
|
134
|
-
|
|
135
112
|
setState({
|
|
136
113
|
markers: arr
|
|
137
|
-
});
|
|
114
|
+
});
|
|
115
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
138
116
|
}, [points]);
|
|
139
117
|
return state.markers;
|
|
140
118
|
}
|
|
@@ -3,11 +3,10 @@ import React, { useEffect } from 'react';
|
|
|
3
3
|
import { useMarkerCluster, useMarkers } from './hook';
|
|
4
4
|
import useMapType from '../hook/useMapType';
|
|
5
5
|
import "./index.css";
|
|
6
|
-
|
|
7
6
|
function ClusterLayer(_ref) {
|
|
8
7
|
var points = _ref.points,
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
onPointClick = _ref.onPointClick,
|
|
9
|
+
children = _ref.children;
|
|
11
10
|
var type = useMapType();
|
|
12
11
|
var cluster = useMarkerCluster(onPointClick);
|
|
13
12
|
var markers = useMarkers(points);
|
|
@@ -15,12 +14,10 @@ function ClusterLayer(_ref) {
|
|
|
15
14
|
if (!cluster) {
|
|
16
15
|
return;
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
if (type.leaflet) {
|
|
20
18
|
cluster.clearLayers();
|
|
21
19
|
cluster.addLayers(markers);
|
|
22
20
|
}
|
|
23
|
-
|
|
24
21
|
if (type.AMap) {
|
|
25
22
|
cluster.setData([]);
|
|
26
23
|
cluster.setData(markers);
|
|
@@ -28,5 +25,4 @@ function ClusterLayer(_ref) {
|
|
|
28
25
|
}, [cluster, markers, type.AMap, type.leaflet]);
|
|
29
26
|
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
30
27
|
}
|
|
31
|
-
|
|
32
28
|
export default ClusterLayer;
|
package/es/Map/Config/index.js
CHANGED
|
@@ -1,34 +1,24 @@
|
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
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
|
-
|
|
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
|
-
|
|
7
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; }
|
|
8
|
-
|
|
9
5
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
-
|
|
11
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
7
|
import { __rest } from "tslib";
|
|
14
8
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
15
9
|
import { queryMapConfig } from './utils';
|
|
16
|
-
|
|
17
10
|
function Config(_a) {
|
|
18
11
|
var children = _a.children,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
MAP_GLABAL_KEY = _a.MAP_GLABAL_KEY,
|
|
13
|
+
props = __rest(_a, ["children", "MAP_GLABAL_KEY"]);
|
|
22
14
|
var _useState = useState(),
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
+
config = _useState2[0],
|
|
17
|
+
setConfig = _useState2[1];
|
|
27
18
|
var _useState3 = useState(false),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
20
|
+
isInit = _useState4[0],
|
|
21
|
+
setInit = _useState4[1];
|
|
32
22
|
var extProps = useMemo(function () {
|
|
33
23
|
return config ? {
|
|
34
24
|
config: config
|
|
@@ -39,14 +29,11 @@ function Config(_a) {
|
|
|
39
29
|
return setInit(true);
|
|
40
30
|
});
|
|
41
31
|
}, [MAP_GLABAL_KEY]);
|
|
42
|
-
|
|
43
32
|
if (!isInit) {
|
|
44
33
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
45
34
|
}
|
|
46
|
-
|
|
47
35
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.cloneElement(children, Object.assign(Object.assign(Object.assign({}, props), extProps), {
|
|
48
36
|
MAP_GLABAL_KEY: MAP_GLABAL_KEY
|
|
49
37
|
})));
|
|
50
38
|
}
|
|
51
|
-
|
|
52
39
|
export default Config;
|
package/es/Map/Config/utils.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
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
|
-
|
|
3
2
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
4
|
-
|
|
5
3
|
import { __awaiter } from "tslib";
|
|
6
4
|
var localconfig = {
|
|
7
5
|
url: 'http://webrd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}',
|
|
@@ -24,12 +22,10 @@ export function queryMapConfig(type) {
|
|
|
24
22
|
switch (_context.prev = _context.next) {
|
|
25
23
|
case 0:
|
|
26
24
|
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
|
-
|
|
28
25
|
if (!(type === 'L')) {
|
|
29
26
|
_context.next = 3;
|
|
30
27
|
break;
|
|
31
28
|
}
|
|
32
|
-
|
|
33
29
|
return _context.abrupt("return", {
|
|
34
30
|
url: url,
|
|
35
31
|
crs: crs,
|
|
@@ -44,7 +40,6 @@ export function queryMapConfig(type) {
|
|
|
44
40
|
minZoom: minZoom,
|
|
45
41
|
distance: distance
|
|
46
42
|
});
|
|
47
|
-
|
|
48
43
|
case 3:
|
|
49
44
|
return _context.abrupt("return", {
|
|
50
45
|
crs: crs,
|
|
@@ -57,7 +52,6 @@ export function queryMapConfig(type) {
|
|
|
57
52
|
maxBounds: maxBounds,
|
|
58
53
|
amapStyle: amapStyle
|
|
59
54
|
});
|
|
60
|
-
|
|
61
55
|
case 4:
|
|
62
56
|
case "end":
|
|
63
57
|
return _context.stop();
|
package/es/Map/Context/index.js
CHANGED
|
@@ -1,50 +1,33 @@
|
|
|
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
|
-
|
|
3
2
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
-
|
|
5
3
|
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
4
|
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
5
|
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
6
|
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
7
|
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
8
|
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
9
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
-
|
|
19
10
|
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
11
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
-
|
|
23
12
|
import { __rest } from "tslib";
|
|
24
13
|
import React from 'react';
|
|
25
14
|
export var mapContext = /*#__PURE__*/React.createContext(null);
|
|
26
15
|
export var Provider = mapContext.Provider;
|
|
27
16
|
export var Consumer = mapContext.Consumer;
|
|
28
|
-
|
|
29
17
|
function map(Component) {
|
|
30
18
|
var MapWithComponent = /*#__PURE__*/function (_React$Component) {
|
|
31
19
|
_inherits(MapWithComponent, _React$Component);
|
|
32
|
-
|
|
33
20
|
var _super = _createSuper(MapWithComponent);
|
|
34
|
-
|
|
35
21
|
function MapWithComponent() {
|
|
36
22
|
_classCallCheck(this, MapWithComponent);
|
|
37
|
-
|
|
38
23
|
return _super.apply(this, arguments);
|
|
39
24
|
}
|
|
40
|
-
|
|
41
25
|
_createClass(MapWithComponent, [{
|
|
42
26
|
key: "render",
|
|
43
27
|
value: function render() {
|
|
44
28
|
var _a = this.props,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
29
|
+
forwardRef = _a.forwardRef,
|
|
30
|
+
props = __rest(_a, ["forwardRef"]);
|
|
48
31
|
return /*#__PURE__*/React.createElement(Consumer, null, function (context) {
|
|
49
32
|
return /*#__PURE__*/React.createElement(Component, Object.assign({}, props, context, {
|
|
50
33
|
ref: forwardRef
|
|
@@ -52,15 +35,12 @@ function map(Component) {
|
|
|
52
35
|
});
|
|
53
36
|
}
|
|
54
37
|
}]);
|
|
55
|
-
|
|
56
38
|
return MapWithComponent;
|
|
57
39
|
}(React.Component);
|
|
58
|
-
|
|
59
40
|
return /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
60
41
|
return /*#__PURE__*/React.createElement(MapWithComponent, Object.assign({}, props, {
|
|
61
42
|
forwardRef: ref
|
|
62
43
|
}));
|
|
63
44
|
});
|
|
64
45
|
}
|
|
65
|
-
|
|
66
46
|
export default map;
|
package/es/Map/FindPio/index.js
CHANGED
|
@@ -2,7 +2,6 @@ import "antd/lib/select/style";
|
|
|
2
2
|
import _Select from "antd/lib/select";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import "./index.css";
|
|
5
|
-
|
|
6
5
|
function FindPio() {
|
|
7
6
|
return /*#__PURE__*/React.createElement(_Select, {
|
|
8
7
|
className: "map-find-pio",
|
|
@@ -12,5 +11,4 @@ function FindPio() {
|
|
|
12
11
|
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57"
|
|
13
12
|
});
|
|
14
13
|
}
|
|
15
|
-
|
|
16
14
|
export default FindPio;
|
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
import _useUnmount from "ahooks/es/useUnmount";
|
|
2
|
-
|
|
3
2
|
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
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; } }
|
|
6
|
-
|
|
7
4
|
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
5
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
10
|
-
|
|
11
6
|
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
7
|
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
8
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
16
|
-
|
|
17
9
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
18
|
-
|
|
19
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
20
|
-
|
|
21
11
|
/// <reference path="../AMap.d.ts" />
|
|
22
12
|
import React, { useContext, useEffect, useRef } from 'react';
|
|
23
13
|
import ReactDOM from 'react-dom';
|
|
@@ -26,23 +16,20 @@ import useMapType from '../hook/useMapType';
|
|
|
26
16
|
var maxIndex = 20;
|
|
27
17
|
export default function MakerLikeWindow(_ref) {
|
|
28
18
|
var children = _ref.children,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
visible = _ref.visible,
|
|
20
|
+
center = _ref.center,
|
|
21
|
+
width = _ref.width,
|
|
22
|
+
height = _ref.height;
|
|
34
23
|
var _useContext = useContext(mapContext),
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
instance = _useContext.instance;
|
|
37
25
|
var domref = useRef(null);
|
|
38
26
|
var markerRef = useRef(null);
|
|
39
27
|
var type = useMapType();
|
|
40
28
|
useEffect(function () {
|
|
41
29
|
if (!instance.map) {
|
|
42
30
|
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
31
|
+
}
|
|
32
|
+
// leaflet下还未实现
|
|
46
33
|
if (type.AMap && !markerRef.current) {
|
|
47
34
|
var marker = new AMap.Marker({
|
|
48
35
|
content: domref.current,
|
|
@@ -54,7 +41,6 @@ export default function MakerLikeWindow(_ref) {
|
|
|
54
41
|
markerRef.current = marker;
|
|
55
42
|
marker.on('click', function () {
|
|
56
43
|
maxIndex++;
|
|
57
|
-
|
|
58
44
|
if (marker.getzIndex() !== maxIndex) {
|
|
59
45
|
marker.setzIndex(maxIndex);
|
|
60
46
|
}
|
|
@@ -63,14 +49,11 @@ export default function MakerLikeWindow(_ref) {
|
|
|
63
49
|
}, [instance.map, visible, center]);
|
|
64
50
|
useEffect(function () {
|
|
65
51
|
var marker = markerRef.current;
|
|
66
|
-
|
|
67
52
|
if (!marker || !center) {
|
|
68
53
|
return undefined;
|
|
69
54
|
}
|
|
70
|
-
|
|
71
55
|
if (type.AMap) {
|
|
72
56
|
var lnglat = _construct(AMap.LngLat, _toConsumableArray(center));
|
|
73
|
-
|
|
74
57
|
if (visible) {
|
|
75
58
|
marker.setPosition(lnglat);
|
|
76
59
|
marker.setContent(domref.current);
|
|
@@ -82,17 +65,15 @@ export default function MakerLikeWindow(_ref) {
|
|
|
82
65
|
instance.map.remove(markerRef.current);
|
|
83
66
|
markerRef.current = null;
|
|
84
67
|
}
|
|
85
|
-
}
|
|
86
|
-
|
|
68
|
+
}
|
|
69
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
87
70
|
}, [visible, center, instance.map]);
|
|
88
|
-
|
|
89
71
|
_useUnmount(function () {
|
|
90
72
|
try {
|
|
91
73
|
instance.map.remove(markerRef.current);
|
|
92
74
|
markerRef.current = null;
|
|
93
75
|
} catch (_) {}
|
|
94
76
|
});
|
|
95
|
-
|
|
96
77
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
97
78
|
ref: domref,
|
|
98
79
|
style: {
|
|
@@ -1,45 +1,32 @@
|
|
|
1
1
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
|
|
3
2
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
3
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
-
|
|
7
4
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
|
-
|
|
9
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
-
|
|
11
6
|
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."); }
|
|
12
|
-
|
|
13
7
|
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
8
|
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; }
|
|
16
|
-
|
|
17
9
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
18
|
-
|
|
19
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
-
|
|
21
11
|
import React, { useState } from 'react';
|
|
22
12
|
import Map from '../BasicMap';
|
|
23
13
|
import ClusterLayer from '../ClusterLayer';
|
|
24
14
|
import InfoWindow from './MakerLikeWindow';
|
|
25
15
|
import deviceList from '../points.json';
|
|
26
16
|
import Player from '../../Player';
|
|
27
|
-
|
|
28
17
|
var App = function App() {
|
|
29
18
|
var _useState = useState([]),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
state = _useState2[0],
|
|
21
|
+
setState = _useState2[1];
|
|
34
22
|
var addDeviceInfoWindow = function addDeviceInfoWindow(item) {
|
|
35
23
|
var longitude = item.longitude,
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
latitude = item.latitude,
|
|
25
|
+
cid = item.cid;
|
|
38
26
|
var arr = state;
|
|
39
27
|
var index = arr.findIndex(function (v) {
|
|
40
28
|
return v.cid === cid;
|
|
41
29
|
});
|
|
42
|
-
|
|
43
30
|
if (index === -1) {
|
|
44
31
|
arr.push({
|
|
45
32
|
visible: true,
|
|
@@ -48,14 +35,11 @@ var App = function App() {
|
|
|
48
35
|
url: 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'
|
|
49
36
|
});
|
|
50
37
|
}
|
|
51
|
-
|
|
52
38
|
if (index > -1 && !arr[index].visible) {
|
|
53
39
|
arr[index].visible = true;
|
|
54
40
|
}
|
|
55
|
-
|
|
56
41
|
setState(_toConsumableArray(arr));
|
|
57
42
|
};
|
|
58
|
-
|
|
59
43
|
return /*#__PURE__*/React.createElement("div", {
|
|
60
44
|
style: {
|
|
61
45
|
width: '100%',
|
|
@@ -79,5 +63,4 @@ var App = function App() {
|
|
|
79
63
|
}));
|
|
80
64
|
})));
|
|
81
65
|
};
|
|
82
|
-
|
|
83
66
|
export default App;
|