@cloud-app-dev/vidc 2.3.0 → 3.0.2
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 +2 -2
- package/es/Config/interface.d.ts +2 -1
- package/es/DomMove/demo.d.ts +2 -0
- package/es/DomMove/demo.js +16 -0
- package/es/DomMove/index.d.ts +16 -0
- package/es/DomMove/index.js +145 -0
- package/es/DomMove/utils.d.ts +8 -0
- package/es/{Picture/component/MoveContent → DomMove}/utils.js +19 -0
- package/es/Drawer/index.d.ts +2 -2
- package/es/Drawer/interface.d.ts +4 -174
- package/es/ErrorBoundary/index.d.ts +18 -0
- package/es/ErrorBoundary/index.js +79 -0
- package/es/List/DynamicGridList/Demo.js +40 -27
- package/es/List/DynamicGridList/index.d.ts +20 -29
- package/es/List/DynamicGridList/index.js +40 -63
- package/es/List/DynamicList/index.css +15 -0
- package/es/List/DynamicList/index.d.ts +14 -0
- package/es/List/DynamicList/index.js +105 -0
- package/es/List/DynamicList/interface.d.ts +19 -0
- package/es/List/DynamicList/utils.d.ts +4 -0
- package/es/List/DynamicList/utils.js +6 -0
- package/es/List/GridList/Demo.js +27 -4
- package/es/List/GridList/index.css +1 -0
- package/es/List/GridList/index.d.ts +2 -2
- package/es/List/GridList/index.js +8 -12
- package/es/List/GridList/interface.d.ts +1 -1
- package/es/List/VList/index.js +2 -3
- package/es/List/index.css +2 -54
- package/es/List/index.d.ts +6 -7
- package/es/List/index.js +14 -153
- package/es/List/interface.d.ts +3 -61
- package/es/LoaderApp/index.d.ts +1 -1
- package/es/LoaderApp/index.js +27 -46
- package/es/LoaderApp/interface.d.ts +3 -0
- package/es/LoaderApp/loader.d.ts +6 -7
- package/es/LoaderApp/loader.js +20 -30
- package/es/LoaderApp/sandbox.back.d.ts +18 -0
- package/es/LoaderApp/sandbox.back.js +356 -0
- package/es/LoaderApp/sandbox.d.ts +12 -0
- package/es/LoaderApp/sandbox.js +110 -0
- package/es/LoaderApp/utils.d.ts +5 -1
- package/es/LoaderApp/utils.js +98 -2
- package/es/Map/AMap.d.ts +1572 -0
- package/es/Map/BasicMap/AMapInstance.d.ts +15 -0
- package/es/Map/BasicMap/AMapInstance.js +66 -0
- package/es/Map/BasicMap/LeafletInstance.d.ts +15 -0
- package/es/Map/BasicMap/LeafletInstance.js +98 -0
- package/es/Map/BasicMap/index.css +24 -0
- package/es/Map/BasicMap/index.d.ts +9 -0
- package/es/Map/BasicMap/index.js +103 -0
- package/es/Map/ClusterLayer/hook.d.ts +5 -0
- package/es/Map/ClusterLayer/hook.js +144 -0
- package/es/Map/ClusterLayer/index.css +26 -0
- package/es/Map/ClusterLayer/index.d.ts +5 -0
- package/es/Map/ClusterLayer/index.js +31 -0
- package/es/Map/ClusterLayer/props.d.ts +8 -0
- package/es/Map/Config/index.d.ts +7 -0
- package/es/{InitialConfig → Map/Config}/index.js +35 -36
- package/es/Map/Config/utils.d.ts +2 -0
- package/es/{List/DynamicDeviceList → Map/Config}/utils.js +48 -45
- package/es/Map/Context/index.d.ts +11 -0
- package/es/Map/Context/index.js +66 -0
- package/es/Map/FindPio/index.css +7 -0
- package/es/Map/FindPio/index.d.ts +4 -0
- package/es/Map/FindPio/index.js +16 -0
- package/es/{WorkerFlow/Demo.d.ts → Map/InfoWindow/demo.d.ts} +0 -0
- package/es/{List/DynamicDeviceList/Demo.js → Map/InfoWindow/demo.js} +27 -25
- package/es/Map/InfoWindow/index.d.ts +8 -0
- package/es/Map/InfoWindow/index.js +74 -0
- package/es/Map/LevelCenter/DragMarker/index.d.ts +12 -0
- package/es/Map/LevelCenter/DragMarker/index.js +48 -0
- package/es/{List/DeviceList → Map/LevelCenter}/index.css +0 -0
- package/es/Map/LevelCenter/index.d.ts +13 -0
- package/es/Map/LevelCenter/index.js +42 -0
- package/es/Map/LoaderMap/index.d.ts +12 -0
- package/es/Map/LoaderMap/index.js +58 -0
- package/es/Map/ResetTools/index.css +32 -0
- package/es/Map/ResetTools/index.d.ts +9 -0
- package/es/Map/ResetTools/index.js +61 -0
- package/es/Map/SinglePoint/Marker/index.d.ts +7 -0
- package/es/Map/SinglePoint/Marker/index.js +29 -0
- package/es/Map/SinglePoint/icon/Place_icon_OnLine_Hover.svg +15 -0
- package/es/Map/SinglePoint/icon/Place_icon_OnLine_Normal.svg +15 -0
- package/es/Map/SinglePoint/icon/Place_icon_OutLine_Hover.svg +15 -0
- package/es/Map/SinglePoint/icon/Place_icon_OutLine_Normal.svg +15 -0
- package/es/Map/SinglePoint/index.css +29 -0
- package/es/Map/SinglePoint/index.d.ts +7 -0
- package/es/Map/SinglePoint/index.js +32 -0
- package/es/Map/hook/useMapType.d.ts +4 -0
- package/es/Map/hook/useMapType.js +13 -0
- package/es/Map/icon.d.ts +2 -0
- package/es/Map/icon.js +10 -0
- package/es/Map/index.d.ts +23 -0
- package/es/Map/index.js +25 -0
- package/es/Map/interface.d.ts +55 -0
- package/es/Map/points.json +61247 -0
- package/es/{Picture/component/MoveContent → Map/useMarker}/index.css +0 -0
- package/es/Map/useMarker/index.d.ts +11 -0
- package/es/{WorkerFlow/Form/FormAuth.js → Map/useMarker/index.js} +57 -80
- package/es/Map/withMap/index.d.ts +2 -0
- package/es/Map/withMap/index.js +12 -0
- package/es/Modal/index.js +7 -5
- package/es/Picture/component/RectMenu/index.d.ts +1 -1
- package/es/Picture/index.d.ts +1 -1
- package/es/Picture/index.js +2 -2
- package/es/Player/api/index.d.ts +2 -8
- package/es/Player/api/index.js +29 -35
- package/es/Player/contraller_bar/left_bar.js +2 -2
- package/es/Player/contraller_bar/right_bar.d.ts +1 -1
- package/es/Player/contraller_bar/right_bar.js +13 -27
- package/es/Player/demo.js +21 -24
- package/es/Player/event/index.js +5 -1
- package/es/Player/frontend_player.d.ts +2 -3
- package/es/Player/frontend_player.js +35 -52
- package/es/Player/frontend_timeline.d.ts +3 -2
- package/es/Player/frontend_timeline.js +20 -9
- package/es/Player/live_heart.js +45 -12
- package/es/Player/message.js +23 -12
- package/es/Player/player.d.ts +29 -7
- package/es/Player/segment_player.d.ts +1 -1
- package/es/Player/segment_player.js +50 -39
- package/es/Player/segment_timeline.js +14 -13
- package/es/Player/single_player.js +59 -14
- package/es/Player/timeline.js +8 -6
- package/es/Player/util.d.ts +4 -25
- package/es/Player/util.js +47 -55
- package/es/PlayerExt/index.css +2 -2
- package/es/PlayerExt/index.d.ts +3 -1
- package/es/PlayerExt/index.js +19 -5
- package/es/ScreenPlayer/Live.d.ts +5 -0
- package/es/ScreenPlayer/Live.js +109 -0
- package/es/ScreenPlayer/LiveTools.d.ts +15 -0
- package/es/ScreenPlayer/LiveTools.js +95 -0
- package/es/ScreenPlayer/PlayerWithExt.d.ts +22 -0
- package/es/ScreenPlayer/PlayerWithExt.js +156 -0
- package/es/ScreenPlayer/Record.d.ts +5 -0
- package/es/{WorkerFlow/index.js → ScreenPlayer/Record.js} +286 -273
- package/es/ScreenPlayer/RecordTools.d.ts +17 -0
- package/es/ScreenPlayer/RecordTools.js +102 -0
- package/es/ScreenPlayer/SegmentTimeLine.d.ts +10 -0
- package/es/ScreenPlayer/SegmentTimeLine.js +40 -0
- package/es/ScreenPlayer/TimeSlider.d.ts +127 -0
- package/es/ScreenPlayer/TimeSlider.js +530 -0
- package/es/ScreenPlayer/demo.d.ts +2 -0
- package/es/ScreenPlayer/demo.js +25 -0
- package/es/ScreenPlayer/demo2.d.ts +2 -0
- package/es/ScreenPlayer/demo2.js +153 -0
- package/es/ScreenPlayer/index.css +49 -0
- package/es/ScreenPlayer/index.d.ts +5 -0
- package/es/ScreenPlayer/index.js +8 -0
- package/es/ScreenPlayer/interface.d.ts +81 -0
- package/es/ScreenPlayer/useRecordList.d.ts +3 -0
- package/es/{WorkerFlow/Form/UserAndGroupSelect.js → ScreenPlayer/useRecordList.js} +173 -176
- package/es/ScreenPlayer/useVideoFit.d.ts +5 -0
- package/es/ScreenPlayer/useVideoFit.js +46 -0
- package/es/ScreenPlayer/utils.d.ts +25 -0
- package/es/ScreenPlayer/utils.js +84 -0
- package/es/Timeout/index.d.ts +33 -0
- package/es/Timeout/index.js +83 -0
- package/es/Tree/demo.js +9 -12
- package/es/Tree/index.css +55 -29
- package/es/Tree/index.d.ts +20 -19
- package/es/Tree/index.js +70 -185
- package/es/index.d.ts +8 -9
- package/es/index.js +8 -9
- package/es/useInfiniteScroll/index.d.ts +16 -0
- package/es/{useHttp → useInfiniteScroll}/index.js +79 -43
- package/es/useVirtualList/index.d.ts +13 -0
- package/es/useVirtualList/index.js +175 -0
- package/es/withErrorBoundary/index.d.ts +9 -0
- package/es/withErrorBoundary/index.js +45 -0
- package/package.json +18 -21
- package/release-build.sh +44 -0
- package/test.js +48 -0
- package/es/DeviceIcon/icon.d.ts +0 -9
- package/es/DeviceIcon/icon.js +0 -138
- package/es/DeviceIcon/index.css +0 -8
- package/es/DeviceIcon/index.d.ts +0 -14
- package/es/DeviceIcon/index.js +0 -37
- package/es/DeviceSelect/TreeType.d.ts +0 -7
- package/es/DeviceSelect/TreeType.js +0 -36
- package/es/DeviceSelect/demo.d.ts +0 -3
- package/es/DeviceSelect/demo.js +0 -22
- package/es/DeviceSelect/index.css +0 -11
- package/es/DeviceSelect/index.d.ts +0 -13
- package/es/DeviceSelect/index.js +0 -191
- package/es/Dict/cache.d.ts +0 -3
- package/es/Dict/cache.js +0 -21
- package/es/Dict/device.d.ts +0 -28
- package/es/Dict/device.js +0 -117
- package/es/Dict/hook.d.ts +0 -3
- package/es/Dict/hook.js +0 -98
- package/es/Dict/index.d.ts +0 -9
- package/es/Dict/index.js +0 -10
- package/es/Dict/interface.d.ts +0 -16
- package/es/Dict/utils.d.ts +0 -10
- package/es/Dict/utils.js +0 -44
- package/es/InitialConfig/index.d.ts +0 -8
- package/es/InitialConfig/utils.d.ts +0 -20
- package/es/InitialConfig/utils.js +0 -110
- package/es/InitialRequest/index.d.ts +0 -9
- package/es/InitialRequest/index.js +0 -97
- package/es/InitialRequest/utils.d.ts +0 -10
- package/es/InitialRequest/utils.js +0 -116
- package/es/List/CheckExt.d.ts +0 -9
- package/es/List/CheckExt.js +0 -36
- package/es/List/DeviceList/index.d.ts +0 -11
- package/es/List/DeviceList/index.js +0 -50
- package/es/List/DynamicDeviceList/Demo.d.ts +0 -3
- package/es/List/DynamicDeviceList/index.css +0 -39
- package/es/List/DynamicDeviceList/index.d.ts +0 -12
- package/es/List/DynamicDeviceList/index.js +0 -205
- package/es/List/DynamicDeviceList/interface.d.ts +0 -37
- package/es/List/DynamicDeviceList/utils.d.ts +0 -16
- package/es/List/ListExt/index.css +0 -3
- package/es/List/ListExt/index.d.ts +0 -19
- package/es/List/ListExt/index.js +0 -44
- package/es/Picture/component/MoveContent/index.d.ts +0 -39
- package/es/Picture/component/MoveContent/index.js +0 -244
- package/es/Picture/component/MoveContent/utils.d.ts +0 -4
- package/es/Title/index.css +0 -25
- package/es/Title/index.d.ts +0 -12
- package/es/Title/index.js +0 -30
- package/es/Tree/BaseTree/index.css +0 -64
- package/es/Tree/BaseTree/index.d.ts +0 -24
- package/es/Tree/BaseTree/index.js +0 -83
- package/es/UserSelect/demo.d.ts +0 -3
- package/es/UserSelect/demo.js +0 -21
- package/es/UserSelect/index.css +0 -16
- package/es/UserSelect/index.d.ts +0 -18
- package/es/UserSelect/index.js +0 -194
- package/es/WorkerFlow/Demo.js +0 -57
- package/es/WorkerFlow/Form/Approver.d.ts +0 -10
- package/es/WorkerFlow/Form/Approver.js +0 -33
- package/es/WorkerFlow/Form/Condition.d.ts +0 -11
- package/es/WorkerFlow/Form/Condition.js +0 -235
- package/es/WorkerFlow/Form/EmptyUserSet.d.ts +0 -8
- package/es/WorkerFlow/Form/EmptyUserSet.js +0 -137
- package/es/WorkerFlow/Form/FormAuth.d.ts +0 -8
- package/es/WorkerFlow/Form/GroupList.d.ts +0 -12
- package/es/WorkerFlow/Form/GroupList.js +0 -44
- package/es/WorkerFlow/Form/GroupSelect.d.ts +0 -8
- package/es/WorkerFlow/Form/GroupSelect.js +0 -167
- package/es/WorkerFlow/Form/GroupSelectModalContent.d.ts +0 -6
- package/es/WorkerFlow/Form/GroupSelectModalContent.js +0 -177
- package/es/WorkerFlow/Form/Handle.d.ts +0 -10
- package/es/WorkerFlow/Form/Handle.js +0 -33
- package/es/WorkerFlow/Form/LevelGroupSelect.d.ts +0 -12
- package/es/WorkerFlow/Form/LevelGroupSelect.js +0 -208
- package/es/WorkerFlow/Form/Notifier.d.ts +0 -8
- package/es/WorkerFlow/Form/Notifier.js +0 -16
- package/es/WorkerFlow/Form/UserAndGroupSelect.d.ts +0 -8
- package/es/WorkerFlow/Form/UserSelect.d.ts +0 -8
- package/es/WorkerFlow/Form/UserSelect.js +0 -150
- package/es/WorkerFlow/Form/UserSelectModalContent.d.ts +0 -6
- package/es/WorkerFlow/Form/UserSelectModalContent.js +0 -166
- package/es/WorkerFlow/Form/UserSet.d.ts +0 -14
- package/es/WorkerFlow/Form/UserSet.js +0 -308
- package/es/WorkerFlow/Form/UsersHandleType.d.ts +0 -7
- package/es/WorkerFlow/Form/UsersHandleType.js +0 -32
- package/es/WorkerFlow/Form/utils.d.ts +0 -3
- package/es/WorkerFlow/Form/utils.js +0 -47
- package/es/WorkerFlow/Nodes/Add.d.ts +0 -7
- package/es/WorkerFlow/Nodes/Add.js +0 -98
- package/es/WorkerFlow/Nodes/AddOption.d.ts +0 -10
- package/es/WorkerFlow/Nodes/AddOption.js +0 -23
- package/es/WorkerFlow/Nodes/AddOptionList.d.ts +0 -8
- package/es/WorkerFlow/Nodes/AddOptionList.js +0 -46
- package/es/WorkerFlow/Nodes/Approver.d.ts +0 -11
- package/es/WorkerFlow/Nodes/Approver.js +0 -53
- package/es/WorkerFlow/Nodes/Condition.d.ts +0 -10
- package/es/WorkerFlow/Nodes/Condition.js +0 -140
- package/es/WorkerFlow/Nodes/Constants.d.ts +0 -35
- package/es/WorkerFlow/Nodes/Constants.js +0 -150
- package/es/WorkerFlow/Nodes/End.d.ts +0 -7
- package/es/WorkerFlow/Nodes/End.js +0 -16
- package/es/WorkerFlow/Nodes/Handle.d.ts +0 -11
- package/es/WorkerFlow/Nodes/Handle.js +0 -52
- package/es/WorkerFlow/Nodes/Node.d.ts +0 -8
- package/es/WorkerFlow/Nodes/Node.js +0 -26
- package/es/WorkerFlow/Nodes/Notifier.d.ts +0 -11
- package/es/WorkerFlow/Nodes/Notifier.js +0 -52
- package/es/WorkerFlow/Nodes/Render.d.ts +0 -8
- package/es/WorkerFlow/Nodes/Render.js +0 -16
- package/es/WorkerFlow/Nodes/Start.d.ts +0 -12
- package/es/WorkerFlow/Nodes/Start.js +0 -26
- package/es/WorkerFlow/Nodes/TitleElement.d.ts +0 -10
- package/es/WorkerFlow/Nodes/TitleElement.js +0 -127
- package/es/WorkerFlow/Nodes/Wrap.d.ts +0 -13
- package/es/WorkerFlow/Nodes/Wrap.js +0 -35
- package/es/WorkerFlow/OperatorContext.d.ts +0 -4
- package/es/WorkerFlow/OperatorContext.js +0 -3
- package/es/WorkerFlow/Tools.d.ts +0 -8
- package/es/WorkerFlow/Tools.js +0 -78
- package/es/WorkerFlow/XML/CanvasTag.d.ts +0 -3
- package/es/WorkerFlow/XML/CanvasTag.js +0 -142
- package/es/WorkerFlow/XML/EndEvent.d.ts +0 -1
- package/es/WorkerFlow/XML/EndEvent.js +0 -14
- package/es/WorkerFlow/XML/ExclusiveGateway.d.ts +0 -9
- package/es/WorkerFlow/XML/ExclusiveGateway.js +0 -101
- package/es/WorkerFlow/XML/Root.d.ts +0 -1
- package/es/WorkerFlow/XML/Root.js +0 -5
- package/es/WorkerFlow/XML/StartEvent.d.ts +0 -5
- package/es/WorkerFlow/XML/StartEvent.js +0 -28
- package/es/WorkerFlow/XML/UserTask.d.ts +0 -5
- package/es/WorkerFlow/XML/UserTask.js +0 -93
- package/es/WorkerFlow/XML/index.d.ts +0 -4
- package/es/WorkerFlow/XML/index.js +0 -100
- package/es/WorkerFlow/XML/utils.d.ts +0 -6
- package/es/WorkerFlow/XML/utils.js +0 -97
- package/es/WorkerFlow/data.json +0 -83
- package/es/WorkerFlow/index.css +0 -779
- package/es/WorkerFlow/index.d.ts +0 -13
- package/es/WorkerFlow/interface.d.ts +0 -93
- package/es/WorkerFlow/template.d.ts +0 -2
- package/es/WorkerFlow/template.js +0 -17
- package/es/WorkerFlow/utils.d.ts +0 -14
- package/es/WorkerFlow/utils.js +0 -212
- package/es/useHttp/index.d.ts +0 -8
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Map, IMapInstance, IMapOptions } from '../interface';
|
|
2
|
+
declare class AMapInstance implements IMapInstance {
|
|
3
|
+
map: Map;
|
|
4
|
+
config: IMapOptions;
|
|
5
|
+
mapContainer: HTMLDivElement;
|
|
6
|
+
constructor(ele: HTMLDivElement, config: IMapOptions);
|
|
7
|
+
createMap(): void;
|
|
8
|
+
destoryMap(): void;
|
|
9
|
+
mapReset(): void;
|
|
10
|
+
setZoom(zoom: number): void;
|
|
11
|
+
getZoom(): any;
|
|
12
|
+
setCenter(center: [number, number]): void;
|
|
13
|
+
setZoomAndCenter(zoom: number, center: [number, number]): void;
|
|
14
|
+
}
|
|
15
|
+
export default AMapInstance;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2
|
+
|
|
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); } }
|
|
4
|
+
|
|
5
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
6
|
+
|
|
7
|
+
var AMapInstance = /*#__PURE__*/function () {
|
|
8
|
+
function AMapInstance(ele, config) {
|
|
9
|
+
_classCallCheck(this, AMapInstance);
|
|
10
|
+
|
|
11
|
+
this.mapContainer = ele;
|
|
12
|
+
this.config = config;
|
|
13
|
+
this.createMap();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
_createClass(AMapInstance, [{
|
|
17
|
+
key: "createMap",
|
|
18
|
+
value: function createMap() {
|
|
19
|
+
var _a;
|
|
20
|
+
|
|
21
|
+
var _global = window;
|
|
22
|
+
this.map = new _global.AMap.Map(this.mapContainer, {
|
|
23
|
+
viewMode: '3D',
|
|
24
|
+
zoom: this.config.zoom,
|
|
25
|
+
center: this.config.center,
|
|
26
|
+
pitch: 72,
|
|
27
|
+
resizeEnable: true,
|
|
28
|
+
mapStyle: "amap://styles/".concat((_a = this.config.amapStyle) !== null && _a !== void 0 ? _a : 'normal')
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}, {
|
|
32
|
+
key: "destoryMap",
|
|
33
|
+
value: function destoryMap() {
|
|
34
|
+
this.map.destroy();
|
|
35
|
+
}
|
|
36
|
+
}, {
|
|
37
|
+
key: "mapReset",
|
|
38
|
+
value: function mapReset() {
|
|
39
|
+
this.setZoomAndCenter(this.config.zoom, this.config.center);
|
|
40
|
+
}
|
|
41
|
+
}, {
|
|
42
|
+
key: "setZoom",
|
|
43
|
+
value: function setZoom(zoom) {
|
|
44
|
+
this.map.setZoom(zoom);
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "getZoom",
|
|
48
|
+
value: function getZoom() {
|
|
49
|
+
return this.map.getZoom();
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
key: "setCenter",
|
|
53
|
+
value: function setCenter(center) {
|
|
54
|
+
return this.map.setCenter(center);
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
key: "setZoomAndCenter",
|
|
58
|
+
value: function setZoomAndCenter(zoom, center) {
|
|
59
|
+
this.map.setZoomAndCenter(zoom, center);
|
|
60
|
+
}
|
|
61
|
+
}]);
|
|
62
|
+
|
|
63
|
+
return AMapInstance;
|
|
64
|
+
}();
|
|
65
|
+
|
|
66
|
+
export default AMapInstance;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IMapInstance, IMapOptions, Map, LatLng } from '../interface';
|
|
2
|
+
declare class LeafletInstance implements IMapInstance {
|
|
3
|
+
map: Map;
|
|
4
|
+
config: IMapOptions;
|
|
5
|
+
mapContainer: HTMLDivElement;
|
|
6
|
+
constructor(ele: HTMLDivElement, config: IMapOptions);
|
|
7
|
+
createMap(): void;
|
|
8
|
+
destoryMap(): void;
|
|
9
|
+
setZoomAndCenter(zoom: number, center: [number, number] | LatLng): void;
|
|
10
|
+
mapReset(): void;
|
|
11
|
+
setZoom(zoom: number): any;
|
|
12
|
+
setCenter(center: [number, number] | LatLng): any;
|
|
13
|
+
getZoom(): any;
|
|
14
|
+
}
|
|
15
|
+
export default LeafletInstance;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2
|
+
|
|
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); } }
|
|
4
|
+
|
|
5
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
6
|
+
|
|
7
|
+
var LeafletInstance = /*#__PURE__*/function () {
|
|
8
|
+
function LeafletInstance(ele, config) {
|
|
9
|
+
_classCallCheck(this, LeafletInstance);
|
|
10
|
+
|
|
11
|
+
this.mapContainer = ele;
|
|
12
|
+
this.config = config;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
_createClass(LeafletInstance, [{
|
|
16
|
+
key: "createMap",
|
|
17
|
+
value: function createMap() {
|
|
18
|
+
var L = window.L;
|
|
19
|
+
var _this$config = this.config,
|
|
20
|
+
bounds = _this$config.maxBounds,
|
|
21
|
+
maxZoom = _this$config.maxZoom,
|
|
22
|
+
minZoom = _this$config.minZoom,
|
|
23
|
+
crsStr = _this$config.crs,
|
|
24
|
+
url = _this$config.url,
|
|
25
|
+
zoomOffset = _this$config.zoomOffset,
|
|
26
|
+
center = _this$config.center,
|
|
27
|
+
zoom = _this$config.zoom,
|
|
28
|
+
subdomains = _this$config.subdomains;
|
|
29
|
+
var layers = [L.tileLayer(url, {
|
|
30
|
+
maxZoom: maxZoom,
|
|
31
|
+
minZoom: minZoom,
|
|
32
|
+
zoomOffset: zoomOffset,
|
|
33
|
+
detectRetina: false,
|
|
34
|
+
subdomains: subdomains
|
|
35
|
+
})];
|
|
36
|
+
var maxBounds = bounds ? L.latLngBounds(bounds[0], bounds[1]) : undefined;
|
|
37
|
+
var crs = crsStr ? L.CRS[crsStr] : undefined;
|
|
38
|
+
var mapOptions = {
|
|
39
|
+
layers: layers,
|
|
40
|
+
zoomControl: false,
|
|
41
|
+
attributionControl: false,
|
|
42
|
+
center: center,
|
|
43
|
+
maxZoom: maxZoom,
|
|
44
|
+
minZoom: minZoom,
|
|
45
|
+
zoom: zoom,
|
|
46
|
+
maxBounds: maxBounds,
|
|
47
|
+
crs: crs
|
|
48
|
+
};
|
|
49
|
+
this.map = L.map(this.mapContainer, mapOptions);
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
key: "destoryMap",
|
|
53
|
+
value: function destoryMap() {
|
|
54
|
+
this.map.remove();
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
key: "setZoomAndCenter",
|
|
58
|
+
value: function setZoomAndCenter(zoom, center) {
|
|
59
|
+
var L = window.L;
|
|
60
|
+
var latlng;
|
|
61
|
+
|
|
62
|
+
if (Array.isArray(center)) {
|
|
63
|
+
latlng = center[1] < center[0] ? L.latLng(center[1], center[0]) : L.latLng(center);
|
|
64
|
+
} else {
|
|
65
|
+
latlng = center;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
this.map.setView(latlng, zoom);
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "mapReset",
|
|
72
|
+
value: function mapReset() {
|
|
73
|
+
var _this$config2 = this.config,
|
|
74
|
+
center = _this$config2.center,
|
|
75
|
+
zoom = _this$config2.zoom;
|
|
76
|
+
this.setZoomAndCenter(zoom, center);
|
|
77
|
+
}
|
|
78
|
+
}, {
|
|
79
|
+
key: "setZoom",
|
|
80
|
+
value: function setZoom(zoom) {
|
|
81
|
+
return this.map.setZoom(zoom);
|
|
82
|
+
}
|
|
83
|
+
}, {
|
|
84
|
+
key: "setCenter",
|
|
85
|
+
value: function setCenter(center) {
|
|
86
|
+
return this.map.setCenter(center);
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
key: "getZoom",
|
|
90
|
+
value: function getZoom() {
|
|
91
|
+
return this.map.getZoom();
|
|
92
|
+
}
|
|
93
|
+
}]);
|
|
94
|
+
|
|
95
|
+
return LeafletInstance;
|
|
96
|
+
}();
|
|
97
|
+
|
|
98
|
+
export default LeafletInstance;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.c-map-container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
position: relative;
|
|
5
|
+
}
|
|
6
|
+
.c-map-container .amap-container {
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100%;
|
|
9
|
+
}
|
|
10
|
+
.c-map-container .amap-container .amap-logo {
|
|
11
|
+
display: none !important;
|
|
12
|
+
}
|
|
13
|
+
.c-map-container .amap-container .amap-copyright {
|
|
14
|
+
display: none !important;
|
|
15
|
+
}
|
|
16
|
+
.c-map-container .leaflet-container {
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 100%;
|
|
19
|
+
z-index: 1;
|
|
20
|
+
}
|
|
21
|
+
.c-map-container .leaflet-div-icon {
|
|
22
|
+
border: none;
|
|
23
|
+
background-color: transparent;
|
|
24
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
interface IWithLoaderMapProps {
|
|
4
|
+
MAP_GLABAL_KEY?: 'L' | 'AMap';
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
declare function WithLoaderMap({ MAP_GLABAL_KEY, children, className }: IWithLoaderMapProps): JSX.Element;
|
|
9
|
+
export default WithLoaderMap;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
+
|
|
5
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
6
|
+
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
+
|
|
9
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
10
|
+
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
+
|
|
13
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
+
|
|
15
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
16
|
+
|
|
17
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
+
|
|
19
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
|
+
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
+
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import LoaderMap from '../LoaderMap';
|
|
25
|
+
import { Provider } from '../Context';
|
|
26
|
+
import LeafletInstance from './LeafletInstance';
|
|
27
|
+
import AMapInstance from './AMapInstance';
|
|
28
|
+
import Config from '../Config';
|
|
29
|
+
import withErrorBoundary from '../../withErrorBoundary';
|
|
30
|
+
import "./index.css";
|
|
31
|
+
|
|
32
|
+
var Map = /*#__PURE__*/function (_React$Component) {
|
|
33
|
+
_inherits(Map, _React$Component);
|
|
34
|
+
|
|
35
|
+
var _super = _createSuper(Map);
|
|
36
|
+
|
|
37
|
+
function Map() {
|
|
38
|
+
var _this;
|
|
39
|
+
|
|
40
|
+
_classCallCheck(this, Map);
|
|
41
|
+
|
|
42
|
+
_this = _super.apply(this, arguments);
|
|
43
|
+
_this.domRef = /*#__PURE__*/React.createRef();
|
|
44
|
+
return _this;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
_createClass(Map, [{
|
|
48
|
+
key: "componentDidMount",
|
|
49
|
+
value: function componentDidMount() {
|
|
50
|
+
if (!this.domRef.current) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
var mapOptions = this.props.config;
|
|
55
|
+
var instance = this.props.isL ? LeafletInstance : AMapInstance;
|
|
56
|
+
this.mapInstance = new instance(this.domRef.current, mapOptions);
|
|
57
|
+
this.mapInstance.createMap();
|
|
58
|
+
this.forceUpdate();
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "componentWillUnmount",
|
|
62
|
+
value: function componentWillUnmount() {
|
|
63
|
+
this.mapInstance.destoryMap();
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
key: "render",
|
|
67
|
+
value: function render() {
|
|
68
|
+
var _this$props = this.props,
|
|
69
|
+
children = _this$props.children,
|
|
70
|
+
_this$props$className = _this$props.className,
|
|
71
|
+
className = _this$props$className === void 0 ? '' : _this$props$className,
|
|
72
|
+
glaobalKey = _this$props.glaobalKey;
|
|
73
|
+
return /*#__PURE__*/React.createElement(Provider, {
|
|
74
|
+
value: {
|
|
75
|
+
instance: this.mapInstance,
|
|
76
|
+
glaobalKey: glaobalKey
|
|
77
|
+
}
|
|
78
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
className: "c-map-container ".concat(className)
|
|
80
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
81
|
+
ref: this.domRef
|
|
82
|
+
}), this.mapInstance && children));
|
|
83
|
+
}
|
|
84
|
+
}]);
|
|
85
|
+
|
|
86
|
+
return Map;
|
|
87
|
+
}(React.Component);
|
|
88
|
+
|
|
89
|
+
var MapViewType = withErrorBoundary(Map);
|
|
90
|
+
var MapView = MapViewType;
|
|
91
|
+
|
|
92
|
+
function WithLoaderMap(_ref) {
|
|
93
|
+
var MAP_GLABAL_KEY = _ref.MAP_GLABAL_KEY,
|
|
94
|
+
children = _ref.children,
|
|
95
|
+
className = _ref.className;
|
|
96
|
+
return /*#__PURE__*/React.createElement(LoaderMap, {
|
|
97
|
+
MAP_GLABAL_KEY: MAP_GLABAL_KEY
|
|
98
|
+
}, /*#__PURE__*/React.createElement(Config, null, /*#__PURE__*/React.createElement(MapView, {
|
|
99
|
+
className: className
|
|
100
|
+
}, children)));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export default WithLoaderMap;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MapPoint, LClusterInterface } from '../interface';
|
|
2
|
+
import { AMap as AMapType } from '../AMap';
|
|
3
|
+
import './index.less';
|
|
4
|
+
export declare function useMarkerCluster(onPointClick?: (point: MapPoint) => void): LClusterInterface & AMapType.MarkerCluster;
|
|
5
|
+
export declare function useMarkers(points?: MapPoint[]): any[];
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import _useUpdate from "ahooks/es/useUpdate";
|
|
2
|
+
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
|
|
5
|
+
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."); }
|
|
6
|
+
|
|
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); }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
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; }
|
|
12
|
+
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
|
|
15
|
+
import { useContext, useEffect, useRef, useState } from 'react';
|
|
16
|
+
import useMapType from '../hook/useMapType';
|
|
17
|
+
import { mapContext } from '../Context';
|
|
18
|
+
import { createMapCenterIcon } from '../icon';
|
|
19
|
+
import "./index.css";
|
|
20
|
+
var _global = window;
|
|
21
|
+
var clusterOptions = {
|
|
22
|
+
showCoverageOnHover: false,
|
|
23
|
+
maxClusterRadius: 80,
|
|
24
|
+
spiderfyOnMaxZoom: false,
|
|
25
|
+
removeOutsideVisibleBounds: true,
|
|
26
|
+
chunkedLoading: true,
|
|
27
|
+
zoomToBoundsOnClick: false
|
|
28
|
+
};
|
|
29
|
+
export function useMarkerCluster(onPointClick) {
|
|
30
|
+
var _useContext = useContext(mapContext),
|
|
31
|
+
instance = _useContext.instance;
|
|
32
|
+
|
|
33
|
+
var type = useMapType();
|
|
34
|
+
|
|
35
|
+
var update = _useUpdate();
|
|
36
|
+
|
|
37
|
+
var clusterRef = useRef(null);
|
|
38
|
+
useEffect(function () {
|
|
39
|
+
if (type.leaflet) {
|
|
40
|
+
var L = window.L;
|
|
41
|
+
var clusterGroup = L.markerClusterGroup(clusterOptions);
|
|
42
|
+
clusterGroup.addTo(instance.map);
|
|
43
|
+
clusterRef.current = clusterGroup;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (type.AMap) {
|
|
47
|
+
var renderMarker = function renderMarker(context) {
|
|
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;
|
|
61
|
+
var cluster = new AMap.MarkerCluster(instance.map, [], {
|
|
62
|
+
gridSize: 40,
|
|
63
|
+
renderMarker: renderMarker,
|
|
64
|
+
clusterByZoomChange: true
|
|
65
|
+
});
|
|
66
|
+
cluster.on('click', function (e) {
|
|
67
|
+
if (e.clusterData.length === 1) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
var lnglat = e === null || e === void 0 ? void 0 : e.lnglat;
|
|
72
|
+
lnglat && instance.setZoomAndCenter(instance.getZoom() + 1, lnglat);
|
|
73
|
+
});
|
|
74
|
+
clusterRef.current = cluster;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
update(); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
79
|
+
}, []);
|
|
80
|
+
useEffect(function () {
|
|
81
|
+
return function () {
|
|
82
|
+
return clusterRef.current && clusterRef.current.remove && clusterRef.current.remove();
|
|
83
|
+
};
|
|
84
|
+
}, []);
|
|
85
|
+
return clusterRef.current;
|
|
86
|
+
}
|
|
87
|
+
export function useMarkers(points) {
|
|
88
|
+
var type = useMapType();
|
|
89
|
+
var L = window.L;
|
|
90
|
+
|
|
91
|
+
var _useState = useState({
|
|
92
|
+
markers: []
|
|
93
|
+
}),
|
|
94
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
95
|
+
state = _useState2[0],
|
|
96
|
+
setState = _useState2[1];
|
|
97
|
+
|
|
98
|
+
useEffect(function () {
|
|
99
|
+
if (!points) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
var arr = [];
|
|
104
|
+
|
|
105
|
+
if (type.leaflet) {
|
|
106
|
+
for (var i = 0, l = points.length; i < l; i++) {
|
|
107
|
+
var point = points[i];
|
|
108
|
+
|
|
109
|
+
if (point && point.latitude && point.longitude) {
|
|
110
|
+
var marker = new L.Marker(L.latLng(point.latitude, point.longitude), {
|
|
111
|
+
icon: createMapCenterIcon()
|
|
112
|
+
});
|
|
113
|
+
marker.bindTooltip(point.deviceName, {
|
|
114
|
+
direction: 'top',
|
|
115
|
+
offset: [0, -30]
|
|
116
|
+
});
|
|
117
|
+
arr.push(marker);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (type.AMap) {
|
|
123
|
+
var AMap = _global.AMap;
|
|
124
|
+
|
|
125
|
+
for (var _i2 = 0, _l = points.length; _i2 < _l; _i2++) {
|
|
126
|
+
var _point = points[_i2];
|
|
127
|
+
|
|
128
|
+
if (_point && _point.latitude && _point.longitude) {
|
|
129
|
+
var _marker = Object.assign({
|
|
130
|
+
lnglat: new AMap.LngLat(_point.longitude, _point.latitude),
|
|
131
|
+
weight: 1
|
|
132
|
+
}, _point);
|
|
133
|
+
|
|
134
|
+
arr.push(_marker);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
setState({
|
|
140
|
+
markers: arr
|
|
141
|
+
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
142
|
+
}, [points]);
|
|
143
|
+
return state.markers;
|
|
144
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.c-cluster-marker-layout {
|
|
2
|
+
width: 35px;
|
|
3
|
+
height: 35px;
|
|
4
|
+
display: flex;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
align-items: center;
|
|
7
|
+
position: relative;
|
|
8
|
+
}
|
|
9
|
+
.c-cluster-marker-layout > div {
|
|
10
|
+
width: 28px;
|
|
11
|
+
height: 28px;
|
|
12
|
+
border-radius: 50%;
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
align-items: center;
|
|
16
|
+
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.3);
|
|
17
|
+
text-align: center;
|
|
18
|
+
line-height: 28px;
|
|
19
|
+
}
|
|
20
|
+
.c-cluster-marker-layout > div .anticon {
|
|
21
|
+
font-size: 17px;
|
|
22
|
+
color: #fff;
|
|
23
|
+
}
|
|
24
|
+
.c-cluster-div-icon {
|
|
25
|
+
background: unset;
|
|
26
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { useMarkerCluster, useMarkers } from './hook';
|
|
3
|
+
import useMapType from '../hook/useMapType';
|
|
4
|
+
import "./index.css";
|
|
5
|
+
|
|
6
|
+
function ClusterLayer(_ref) {
|
|
7
|
+
var points = _ref.points,
|
|
8
|
+
onPointClick = _ref.onPointClick,
|
|
9
|
+
children = _ref.children;
|
|
10
|
+
var type = useMapType();
|
|
11
|
+
var cluster = useMarkerCluster(onPointClick);
|
|
12
|
+
var markers = useMarkers(points);
|
|
13
|
+
useEffect(function () {
|
|
14
|
+
if (!cluster) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (type.leaflet) {
|
|
19
|
+
cluster.clearLayers();
|
|
20
|
+
cluster.addLayers(markers);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (type.AMap) {
|
|
24
|
+
cluster.setData([]);
|
|
25
|
+
cluster.setData(markers);
|
|
26
|
+
}
|
|
27
|
+
}, [markers]);
|
|
28
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default ClusterLayer;
|
|
@@ -10,44 +10,43 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
10
10
|
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
12
|
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
function
|
|
18
|
-
var children =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var _useState = useState({
|
|
23
|
-
isInit: false,
|
|
24
|
-
isUpdate: false
|
|
25
|
-
}),
|
|
26
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
-
state = _useState2[0],
|
|
28
|
-
setState = _useState2[1];
|
|
13
|
+
import { __rest } from "tslib";
|
|
14
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
15
|
+
import { queryMapConfig } from './utils';
|
|
16
|
+
|
|
17
|
+
function Config(_a) {
|
|
18
|
+
var children = _a.children,
|
|
19
|
+
MAP_GLABAL_KEY = _a.MAP_GLABAL_KEY,
|
|
20
|
+
props = __rest(_a, ["children", "MAP_GLABAL_KEY"]);
|
|
29
21
|
|
|
22
|
+
var _useState = useState(),
|
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
+
config = _useState2[0],
|
|
25
|
+
setConfig = _useState2[1];
|
|
26
|
+
|
|
27
|
+
var _useState3 = useState(false),
|
|
28
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
29
|
+
isInit = _useState4[0],
|
|
30
|
+
setInit = _useState4[1];
|
|
31
|
+
|
|
32
|
+
var extProps = useMemo(function () {
|
|
33
|
+
return config ? {
|
|
34
|
+
config: config
|
|
35
|
+
} : {};
|
|
36
|
+
}, [config]);
|
|
30
37
|
useEffect(function () {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var _ref3 = _slicedToArray(_ref2, 4),
|
|
34
|
-
BSConfig = _ref3[0],
|
|
35
|
-
AppConfig = _ref3[1],
|
|
36
|
-
SystemConfig = _ref3[2],
|
|
37
|
-
ThemeConfig = _ref3[3];
|
|
38
|
-
|
|
39
|
-
Config.registerBSConfig(BSConfig);
|
|
40
|
-
Config.registerAppConfig(AppConfig);
|
|
41
|
-
Config.registerThemeConfig(ThemeConfig.content);
|
|
42
|
-
setState(function () {
|
|
43
|
-
return {
|
|
44
|
-
isUpdate: SystemConfig.isUpdate,
|
|
45
|
-
isInit: true
|
|
46
|
-
};
|
|
47
|
-
});
|
|
38
|
+
queryMapConfig(MAP_GLABAL_KEY).then(setConfig).then(function () {
|
|
39
|
+
return setInit(true);
|
|
48
40
|
});
|
|
49
|
-
}, []);
|
|
50
|
-
|
|
41
|
+
}, [MAP_GLABAL_KEY]);
|
|
42
|
+
|
|
43
|
+
if (!isInit) {
|
|
44
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.cloneElement(children, Object.assign(Object.assign(Object.assign({}, props), extProps), {
|
|
48
|
+
MAP_GLABAL_KEY: MAP_GLABAL_KEY
|
|
49
|
+
})));
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
export default
|
|
52
|
+
export default Config;
|