@cloud-app-dev/vidc 4.0.15 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dumirc.ts +2 -18
- package/.eslintrc.js +3 -0
- package/.fatherrc.ts +0 -7
- package/es/AppContext/Sync.d.ts +1 -2
- package/es/AppContext/index.d.ts +10 -3
- package/es/AppContext/index.js +14 -4
- package/es/AppContext/interface.d.ts +1 -0
- package/es/CheckGroupFixed/demo.d.ts +1 -2
- package/es/CheckGroupFixed/demo.js +7 -12
- package/es/CheckGroupFixed/index.d.ts +7 -3
- package/es/CheckGroupFixed/index.js +9 -9
- package/es/CheckGroupFixed/style.d.ts +6 -0
- package/es/CheckGroupFixed/style.js +9 -0
- package/es/Config/index.js +1 -1
- package/es/CustomRenderSelect/index.d.ts +3 -2
- package/es/CustomRenderSelect/index.js +13 -10
- package/es/DBTools/index.js +1 -2
- package/es/DisableMark/index.d.ts +1 -2
- package/es/DisableMark/index.js +5 -2
- package/es/DomMove/demo.d.ts +1 -2
- package/es/DomMove/demo.js +0 -1
- package/es/DomMove/index.js +7 -8
- package/es/DynamicGridList/demo.d.ts +2 -0
- package/es/DynamicGridList/index.d.ts +1 -1
- package/es/DynamicGridList/index.js +3 -3
- package/es/DynamicList/demo.d.ts +1 -2
- package/es/DynamicList/demo.js +14 -19
- package/es/DynamicList/index.d.ts +1 -2
- package/es/DynamicList/index.js +10 -8
- package/es/ErrorFallback/index.d.ts +1 -2
- package/es/EventTools/index.d.ts +1 -1
- package/es/GridList/demo.d.ts +2 -0
- package/es/GridList/{Demo.js → demo.js} +1 -1
- package/es/GridList/hook.js +2 -2
- package/es/GridList/index.d.ts +0 -1
- package/es/GridList/index.js +5 -2
- package/es/HightLevel/index.d.ts +1 -2
- package/es/HightLevel/index.js +2 -3
- package/es/IconFont/index.d.ts +1 -1
- package/es/LabelValue/index.d.ts +1 -2
- package/es/LabelValue/index.js +5 -2
- package/es/List/demo.d.ts +1 -2
- package/es/List/demo.js +1 -2
- package/es/List/index.d.ts +2 -3
- package/es/List/index.js +25 -17
- package/es/ListWithSizeAnimate/demo.d.ts +1 -2
- package/es/ListWithSizeAnimate/index.d.ts +0 -1
- package/es/ListWithSizeAnimate/index.js +19 -10
- package/es/LoaderScript/index.d.ts +1 -1
- package/es/Picture/component/DefaultRects/RectInfo.d.ts +1 -2
- package/es/Picture/component/DefaultRects/RectInfo.js +6 -4
- package/es/Picture/component/DefaultRects/index.d.ts +1 -3
- package/es/Picture/component/DefaultRects/index.js +5 -5
- package/es/Picture/component/DefaultRects/style.d.ts +10 -0
- package/es/Picture/component/DefaultRects/style.js +28 -0
- package/es/Picture/component/DrawRect/index.d.ts +1 -3
- package/es/Picture/component/DrawRect/index.js +6 -3
- package/es/Picture/component/RectMenu/index.d.ts +1 -3
- package/es/Picture/component/RectMenu/index.js +13 -8
- package/es/Picture/component/Tools/index.d.ts +1 -2
- package/es/Picture/component/Tools/index.js +21 -9
- package/es/Picture/component/Tools/style.d.ts +2 -0
- package/es/Picture/component/Tools/style.js +5 -0
- package/es/Picture/component/WheelScale/index.d.ts +1 -2
- package/es/Picture/demo.d.ts +1 -2
- package/es/Picture/demo.js +1 -1
- package/es/Picture/index.d.ts +1 -3
- package/es/Picture/index.js +21 -19
- package/es/Picture/useDraw.js +4 -4
- package/es/Player/api/index.d.ts +1 -1
- package/es/Player/api/index.js +44 -18
- package/es/Player/context.d.ts +1 -1
- package/es/Player/contraller_bar/bar.d.ts +1 -1
- package/es/Player/contraller_bar/bar.js +5 -1
- package/es/Player/contraller_bar/contraller_event.d.ts +1 -1
- package/es/Player/contraller_bar/contraller_event.js +4 -5
- package/es/Player/contraller_bar/index.d.ts +1 -2
- package/es/Player/contraller_bar/index.js +8 -2
- package/es/Player/contraller_bar/left_bar.d.ts +1 -1
- package/es/Player/contraller_bar/left_bar.js +12 -3
- package/es/Player/contraller_bar/right_bar.d.ts +1 -1
- package/es/Player/contraller_bar/right_bar.js +1 -2
- package/es/Player/contraller_bar/time.d.ts +1 -2
- package/es/Player/contraller_bar/time.js +5 -2
- package/es/Player/contraller_bar/volume.d.ts +1 -2
- package/es/Player/contraller_bar/volume.js +11 -6
- package/es/Player/demo.d.ts +1 -2
- package/es/Player/demo.js +41 -29
- package/es/Player/empty.d.ts +1 -2
- package/es/Player/empty.js +0 -1
- package/es/Player/event/index.d.ts +1 -1
- package/es/Player/event/index.js +4 -3
- package/es/Player/fps_play.d.ts +1 -2
- package/es/Player/fps_play.js +6 -2
- package/es/Player/frontend_player.d.ts +1 -2
- package/es/Player/frontend_player.js +4 -5
- package/es/Player/frontend_timeline.d.ts +1 -3
- package/es/Player/frontend_timeline.js +16 -8
- package/es/Player/iconfont.d.ts +1 -2
- package/es/Player/iconfont.js +1 -2
- package/es/Player/live_heart.js +8 -9
- package/es/Player/message.d.ts +2 -4
- package/es/Player/message.js +16 -7
- package/es/Player/player.d.ts +2 -0
- package/es/Player/segment_player.d.ts +1 -2
- package/es/Player/segment_player.js +4 -5
- package/es/Player/segment_timeline.d.ts +1 -3
- package/es/Player/segment_timeline.js +19 -9
- package/es/Player/single_player.d.ts +0 -1
- package/es/Player/single_player.js +18 -15
- package/es/Player/timeline.d.ts +5 -3
- package/es/Player/timeline.js +10 -4
- package/es/Player/util.d.ts +2 -2
- package/es/Player/util.js +2 -2
- package/es/PlayerExt/demo.d.ts +1 -2
- package/es/PlayerExt/demo.js +3 -3
- package/es/PlayerExt/index.d.ts +1 -2
- package/es/PlayerExt/index.js +10 -5
- package/es/Progress/index.d.ts +1 -3
- package/es/Progress/index.js +7 -3
- package/es/ROI/demo.d.ts +1 -2
- package/es/ROI/demo.js +1 -2
- package/es/ROI/index.d.ts +1 -2
- package/es/ROI/index.js +17 -7
- package/es/RefDrawer/Footer.d.ts +1 -1
- package/es/RefDrawer/index.d.ts +1 -1
- package/es/RefDrawer/index.js +2 -2
- package/es/RefModal/demo.d.ts +1 -2
- package/es/RefModal/index.d.ts +1 -1
- package/es/RefModal/index.js +2 -2
- package/es/ScreenPlayer/Live.d.ts +1 -3
- package/es/ScreenPlayer/Live.js +10 -11
- package/es/ScreenPlayer/LiveTools.d.ts +5 -1
- package/es/ScreenPlayer/LiveTools.js +14 -9
- package/es/ScreenPlayer/PlayerWithExt.d.ts +3 -3
- package/es/ScreenPlayer/PlayerWithExt.js +14 -13
- package/es/ScreenPlayer/RatePick.d.ts +1 -2
- package/es/ScreenPlayer/RatePick.js +9 -4
- package/es/ScreenPlayer/Record.d.ts +1 -3
- package/es/ScreenPlayer/Record.js +27 -22
- package/es/ScreenPlayer/RecordTools.d.ts +1 -1
- package/es/ScreenPlayer/RecordTools.js +11 -13
- package/es/ScreenPlayer/ScreenSelect.d.ts +1 -2
- package/es/ScreenPlayer/ScreenSelect.js +11 -3
- package/es/ScreenPlayer/SegmentTimeLine.d.ts +1 -2
- package/es/ScreenPlayer/SegmentTimeLine.js +12 -6
- package/es/ScreenPlayer/TimeMode.d.ts +1 -2
- package/es/ScreenPlayer/TimeMode.js +7 -3
- package/es/ScreenPlayer/TimeSelect.d.ts +1 -2
- package/es/ScreenPlayer/TimeSelect.js +10 -5
- package/es/ScreenPlayer/containerStyle.d.ts +13 -0
- package/es/ScreenPlayer/containerStyle.js +32 -0
- package/es/ScreenPlayer/demo.d.ts +1 -2
- package/es/ScreenPlayer/demo.js +8 -13
- package/es/ScreenPlayer/demo2.d.ts +1 -2
- package/es/ScreenPlayer/demo2.js +112 -116
- package/es/ScreenPlayer/index.d.ts +2 -2
- package/es/ScreenPlayer/useTimeSlider.d.ts +2 -2
- package/es/ScreenPlayer/useTimeSlider.js +16 -15
- package/es/ScreenPlayer/useVideoFit.js +2 -2
- package/es/SocketEmitter/eventEmitter.d.ts +1 -1
- package/es/TableLayout/index.d.ts +1 -2
- package/es/TableLayout/index.js +7 -4
- package/es/Timeout/index.d.ts +1 -2
- package/es/Timeout/index.js +4 -5
- package/es/cache/index.d.ts +1 -1
- package/es/cache/index.js +21 -21
- package/es/index.d.ts +3 -11
- package/es/index.js +3 -11
- package/es/likeGo/index.d.ts +2 -0
- package/es/{Map/Config/utils.js → likeGo/index.js} +15 -49
- package/es/likeGoSync/index.d.ts +2 -0
- package/es/likeGoSync/index.js +10 -0
- package/es/logger/index.d.ts +4 -4
- package/es/nextTick/index.d.ts +1 -1
- package/es/nextTick/index.js +2 -6
- package/es/recorder/demo.d.ts +2 -0
- package/es/recorder/demo.js +200 -0
- package/es/recorder/index.d.ts +294 -0
- package/es/recorder/index.js +991 -0
- package/es/useDrawROI/index.js +8 -12
- package/es/useEventEmitterHandle/index.js +2 -2
- package/es/useInfiniteScroll/index.d.ts +1 -1
- package/es/useInfiniteScroll/index.js +8 -7
- package/es/useRafInterval/index.js +2 -2
- package/es/useSimpleState/index.js +3 -4
- package/es/useVirtualList/index.d.ts +1 -1
- package/es/useVirtualList/index.js +5 -8
- package/es/utils.d.ts +4 -4
- package/es/utils.js +1 -30
- package/es/uuid/index.d.ts +2 -1
- package/es/uuid/index.js +3 -12
- package/package.json +36 -37
- package/release-build.sh +3 -2
- package/scripts/{entry.js → entry.mjs} +4 -6
- package/{icon-fix.js → scripts/icon-fix.mjs} +4 -3
- package/tsconfig.json +1 -1
- package/es/Auth/index.d.ts +0 -8
- package/es/Auth/index.js +0 -18
- package/es/AutoExit/index.d.ts +0 -6
- package/es/AutoExit/index.js +0 -23
- package/es/CheckGroupFixed/index.less +0 -53
- package/es/ConfigContext/index.d.ts +0 -22
- package/es/ConfigContext/index.js +0 -25
- package/es/CustomRenderSelect/index.less +0 -25
- package/es/DisableMark/index.less +0 -9
- package/es/DynamicGridList/Demo.d.ts +0 -3
- package/es/DynamicList/index.less +0 -17
- package/es/FullScreen/index.d.ts +0 -22
- package/es/FullScreen/index.js +0 -36
- package/es/FullScreen/index.less +0 -18
- package/es/GridList/Demo.d.ts +0 -3
- package/es/GridList/index.less +0 -8
- package/es/HightLevel/index.less +0 -3
- package/es/ImageView/index.d.ts +0 -17
- package/es/ImageView/index.js +0 -58
- package/es/ImageView/index.less +0 -11
- package/es/LabelPlayer/111.png +0 -0
- package/es/LabelPlayer/demo.d.ts +0 -2
- package/es/LabelPlayer/demo.js +0 -123
- package/es/LabelPlayer/index.d.ts +0 -21
- package/es/LabelPlayer/index.js +0 -169
- package/es/LabelPlayer/index.less +0 -24
- package/es/LabelValue/index.less +0 -23
- package/es/List/index.less +0 -13
- package/es/ListWithSizeAnimate/index.less +0 -23
- package/es/Map/AMap.d.ts +0 -7109
- package/es/Map/BasicMap/AMapInstance.d.ts +0 -19
- package/es/Map/BasicMap/AMapInstance.js +0 -98
- package/es/Map/BasicMap/LeafletInstance.d.ts +0 -18
- package/es/Map/BasicMap/LeafletInstance.js +0 -111
- package/es/Map/BasicMap/index.d.ts +0 -9
- package/es/Map/BasicMap/index.js +0 -98
- package/es/Map/BasicMap/index.less +0 -29
- package/es/Map/ClusterLayer/demo.d.ts +0 -3
- package/es/Map/ClusterLayer/demo.js +0 -22
- package/es/Map/ClusterLayer/hook.d.ts +0 -5
- package/es/Map/ClusterLayer/hook.js +0 -124
- package/es/Map/ClusterLayer/index.d.ts +0 -6
- package/es/Map/ClusterLayer/index.js +0 -32
- package/es/Map/ClusterLayer/index.less +0 -29
- package/es/Map/ClusterLayer/props.d.ts +0 -8
- package/es/Map/Config/index.d.ts +0 -9
- package/es/Map/Config/index.js +0 -52
- package/es/Map/Config/utils.d.ts +0 -2
- package/es/Map/Context/index.d.ts +0 -11
- package/es/Map/Context/index.js +0 -56
- package/es/Map/FindPio/index.d.ts +0 -4
- package/es/Map/FindPio/index.js +0 -14
- package/es/Map/FindPio/index.less +0 -7
- package/es/Map/InfoWindow/MakerLikeWindow.d.ts +0 -4
- package/es/Map/InfoWindow/MakerLikeWindow.js +0 -113
- package/es/Map/InfoWindow/demo.d.ts +0 -3
- package/es/Map/InfoWindow/demo.js +0 -76
- package/es/Map/InfoWindow/index.d.ts +0 -11
- package/es/Map/InfoWindow/index.js +0 -67
- package/es/Map/LevelCenter/DragMarker/index.d.ts +0 -10
- package/es/Map/LevelCenter/DragMarker/index.js +0 -44
- package/es/Map/LevelCenter/demo.d.ts +0 -3
- package/es/Map/LevelCenter/demo.js +0 -46
- package/es/Map/LevelCenter/index.d.ts +0 -15
- package/es/Map/LevelCenter/index.js +0 -71
- package/es/Map/LoaderMap/index.d.ts +0 -12
- package/es/Map/LoaderMap/index.js +0 -71
- package/es/Map/MapDrawSelect/demo.d.ts +0 -3
- package/es/Map/MapDrawSelect/demo.js +0 -79
- package/es/Map/MapDrawSelect/index.d.ts +0 -15
- package/es/Map/MapDrawSelect/index.js +0 -62
- package/es/Map/MouseTool/index.d.ts +0 -10
- package/es/Map/MouseTool/index.js +0 -44
- package/es/Map/MouseTool/useMouseTools.d.ts +0 -7
- package/es/Map/MouseTool/useMouseTools.js +0 -83
- package/es/Map/ResetTools/index.d.ts +0 -10
- package/es/Map/ResetTools/index.js +0 -67
- package/es/Map/ResetTools/index.less +0 -39
- package/es/Map/SinglePoint/demo.d.ts +0 -3
- package/es/Map/SinglePoint/demo.js +0 -16
- package/es/Map/SinglePoint/index.d.ts +0 -27
- package/es/Map/SinglePoint/index.js +0 -57
- package/es/Map/SinglePoint/index.less +0 -41
- package/es/Map/hook/useMapEvent.d.ts +0 -2
- package/es/Map/hook/useMapEvent.js +0 -19
- package/es/Map/hook/useMapType.d.ts +0 -4
- package/es/Map/hook/useMapType.js +0 -12
- package/es/Map/icon.d.ts +0 -2
- package/es/Map/icon.js +0 -10
- package/es/Map/index.d.ts +0 -24
- package/es/Map/index.js +0 -25
- package/es/Map/interface.d.ts +0 -74
- package/es/Map/points.d.ts +0 -74
- package/es/Map/points.js +0 -1
- package/es/Map/useMarker/index.d.ts +0 -10
- package/es/Map/useMarker/index.js +0 -71
- package/es/Map/withMap/index.d.ts +0 -3
- package/es/Map/withMap/index.js +0 -18
- package/es/Picture/component/DefaultRects/index.less +0 -211
- package/es/Picture/component/DrawRect/index.less +0 -8
- package/es/Picture/component/RectMenu/index.less +0 -36
- package/es/Picture/component/Tools/index.less +0 -49
- package/es/Picture/index.less +0 -20
- package/es/Player/style/bar.less +0 -43
- package/es/Player/style/index.less +0 -34
- package/es/Player/style/message.less +0 -56
- package/es/Player/style/slider.less +0 -106
- package/es/Player/style/timeline.less +0 -116
- package/es/Player/style/volume.less +0 -24
- package/es/PlayerExt/index.less +0 -10
- package/es/Progress/index.less +0 -21
- package/es/ROI/index.less +0 -33
- package/es/ScreenPlayer/index.less +0 -335
- package/es/TableLayout/index.less +0 -4
- package/es/ThemeAntd/demo.d.ts +0 -4
- package/es/ThemeAntd/demo.js +0 -129
- package/es/ThemeAntd/demo.less +0 -20
- package/es/ThemeAntd/index.d.ts +0 -7
- package/es/ThemeAntd/index.js +0 -23
- package/es/ThemeAntd/index.less +0 -4
- package/es/VList/index.d.ts +0 -11
- package/es/VList/index.js +0 -42
- package/es/VList/index.less +0 -6
- package/es/VList/utils.d.ts +0 -14
- package/es/VList/utils.js +0 -17
- package/es/bigNumberTransformCN/index.d.ts +0 -5
- package/es/bigNumberTransformCN/index.js +0 -60
- package/es/useFullscreen/demo.d.ts +0 -2
- package/es/useFullscreen/demo.js +0 -48
- package/es/useFullscreen/index.d.ts +0 -12
- package/es/useFullscreen/index.js +0 -76
- /package/es/DynamicGridList/{Demo.js → demo.js} +0 -0
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/// <reference path="../AMap.d.ts" />
|
|
2
|
-
import { IMapInstance, IMapOptions } from '../interface';
|
|
3
|
-
declare class AMapInstance implements IMapInstance {
|
|
4
|
-
map: AMap.Map;
|
|
5
|
-
config: IMapOptions;
|
|
6
|
-
mapContainer: HTMLDivElement;
|
|
7
|
-
constructor(ele: HTMLDivElement, config: IMapOptions);
|
|
8
|
-
createMap(): void;
|
|
9
|
-
destoryMap(): void;
|
|
10
|
-
mapReset(): void;
|
|
11
|
-
setZoom(zoom: number): void;
|
|
12
|
-
getZoom(): number;
|
|
13
|
-
setCenter(center: [number, number]): void;
|
|
14
|
-
setZoomAndCenter(zoom: number, center: [number, number]): void;
|
|
15
|
-
on(type: string, fn: (e: any) => void): void;
|
|
16
|
-
off(type: string, fn: (e: any) => void): void;
|
|
17
|
-
setCursor(cursor: string): void;
|
|
18
|
-
}
|
|
19
|
-
export default AMapInstance;
|
|
@@ -1,98 +0,0 @@
|
|
|
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
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
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, _toPropertyKey(descriptor.key), descriptor); } }
|
|
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; }
|
|
5
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
-
/// <reference path="../AMap.d.ts" />
|
|
9
|
-
var AMapInstance = /*#__PURE__*/function () {
|
|
10
|
-
function AMapInstance(ele, config) {
|
|
11
|
-
_classCallCheck(this, AMapInstance);
|
|
12
|
-
_defineProperty(this, "map", void 0);
|
|
13
|
-
_defineProperty(this, "config", void 0);
|
|
14
|
-
_defineProperty(this, "mapContainer", void 0);
|
|
15
|
-
this.mapContainer = ele;
|
|
16
|
-
this.config = config;
|
|
17
|
-
this.createMap();
|
|
18
|
-
}
|
|
19
|
-
_createClass(AMapInstance, [{
|
|
20
|
-
key: "createMap",
|
|
21
|
-
value: function createMap() {
|
|
22
|
-
var _this$config$amapStyl,
|
|
23
|
-
_this = this;
|
|
24
|
-
this.map = new AMap.Map(this.mapContainer, {
|
|
25
|
-
viewMode: '3D',
|
|
26
|
-
// 默认使用 2D 模式,如果希望使用带有俯仰角的 3D 模式,请设置 viewMode: '3D',
|
|
27
|
-
zoom: this.config.zoom,
|
|
28
|
-
//初始化地图层级
|
|
29
|
-
center: this.config.center,
|
|
30
|
-
//初始化地图中心点
|
|
31
|
-
rotateEnable: true,
|
|
32
|
-
pitchEnable: true,
|
|
33
|
-
pitch: 50,
|
|
34
|
-
rotation: -15,
|
|
35
|
-
zooms: [2, 20],
|
|
36
|
-
resizeEnable: true,
|
|
37
|
-
//是否监控地图容器尺寸变化
|
|
38
|
-
mapStyle: "amap://styles/".concat((_this$config$amapStyl = this.config.amapStyle) !== null && _this$config$amapStyl !== void 0 ? _this$config$amapStyl : 'normal')
|
|
39
|
-
});
|
|
40
|
-
AMap.plugin(['AMap.ControlBar'], function () {
|
|
41
|
-
var controlBar = new AMap.ControlBar({
|
|
42
|
-
position: {
|
|
43
|
-
right: '10px',
|
|
44
|
-
top: '10px'
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
_this.map.addControl(controlBar);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}, {
|
|
51
|
-
key: "destoryMap",
|
|
52
|
-
value: function destoryMap() {
|
|
53
|
-
this.map.destroy();
|
|
54
|
-
}
|
|
55
|
-
}, {
|
|
56
|
-
key: "mapReset",
|
|
57
|
-
value: function mapReset() {
|
|
58
|
-
this.setZoomAndCenter(this.config.zoom, this.config.center);
|
|
59
|
-
}
|
|
60
|
-
}, {
|
|
61
|
-
key: "setZoom",
|
|
62
|
-
value: function setZoom(zoom) {
|
|
63
|
-
this.map.setZoom(zoom);
|
|
64
|
-
}
|
|
65
|
-
}, {
|
|
66
|
-
key: "getZoom",
|
|
67
|
-
value: function getZoom() {
|
|
68
|
-
return this.map.getZoom();
|
|
69
|
-
}
|
|
70
|
-
}, {
|
|
71
|
-
key: "setCenter",
|
|
72
|
-
value: function setCenter(center) {
|
|
73
|
-
this.map.setCenter(center);
|
|
74
|
-
}
|
|
75
|
-
}, {
|
|
76
|
-
key: "setZoomAndCenter",
|
|
77
|
-
value: function setZoomAndCenter(zoom, center) {
|
|
78
|
-
this.map.setZoomAndCenter(zoom, center);
|
|
79
|
-
}
|
|
80
|
-
}, {
|
|
81
|
-
key: "on",
|
|
82
|
-
value: function on(type, fn) {
|
|
83
|
-
this.map.on(type, fn);
|
|
84
|
-
}
|
|
85
|
-
}, {
|
|
86
|
-
key: "off",
|
|
87
|
-
value: function off(type, fn) {
|
|
88
|
-
this.map.off(type, fn);
|
|
89
|
-
}
|
|
90
|
-
}, {
|
|
91
|
-
key: "setCursor",
|
|
92
|
-
value: function setCursor(cursor) {
|
|
93
|
-
this.map.setDefaultCursor(cursor);
|
|
94
|
-
}
|
|
95
|
-
}]);
|
|
96
|
-
return AMapInstance;
|
|
97
|
-
}();
|
|
98
|
-
export default AMapInstance;
|
|
@@ -1,18 +0,0 @@
|
|
|
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): void;
|
|
12
|
-
setCenter(center: [number, number] | LatLng): void;
|
|
13
|
-
getZoom(): number;
|
|
14
|
-
on(type: string, fn: (event: any) => void): void;
|
|
15
|
-
off(type: string, fn: (event: any) => void): void;
|
|
16
|
-
setCursor(cursor: string): void;
|
|
17
|
-
}
|
|
18
|
-
export default LeafletInstance;
|
|
@@ -1,111 +0,0 @@
|
|
|
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
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
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, _toPropertyKey(descriptor.key), descriptor); } }
|
|
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; }
|
|
5
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
-
var LeafletInstance = /*#__PURE__*/function () {
|
|
9
|
-
function LeafletInstance(ele, config) {
|
|
10
|
-
_classCallCheck(this, LeafletInstance);
|
|
11
|
-
_defineProperty(this, "map", void 0);
|
|
12
|
-
_defineProperty(this, "config", void 0);
|
|
13
|
-
_defineProperty(this, "mapContainer", void 0);
|
|
14
|
-
this.mapContainer = ele;
|
|
15
|
-
this.config = config;
|
|
16
|
-
}
|
|
17
|
-
_createClass(LeafletInstance, [{
|
|
18
|
-
key: "createMap",
|
|
19
|
-
value: function createMap() {
|
|
20
|
-
var L = window.L;
|
|
21
|
-
var _this$config = this.config,
|
|
22
|
-
bounds = _this$config.maxBounds,
|
|
23
|
-
maxZoom = _this$config.maxZoom,
|
|
24
|
-
minZoom = _this$config.minZoom,
|
|
25
|
-
crsStr = _this$config.crs,
|
|
26
|
-
url = _this$config.url,
|
|
27
|
-
zoomOffset = _this$config.zoomOffset,
|
|
28
|
-
center = _this$config.center,
|
|
29
|
-
zoom = _this$config.zoom,
|
|
30
|
-
subdomains = _this$config.subdomains;
|
|
31
|
-
var layers = [L.tileLayer(url, {
|
|
32
|
-
maxZoom: maxZoom,
|
|
33
|
-
minZoom: minZoom,
|
|
34
|
-
zoomOffset: zoomOffset,
|
|
35
|
-
detectRetina: false,
|
|
36
|
-
subdomains: subdomains
|
|
37
|
-
})];
|
|
38
|
-
var maxBounds = bounds ? L.latLngBounds(bounds[0], bounds[1]) : undefined;
|
|
39
|
-
var crs = crsStr ? L.CRS[crsStr] : undefined;
|
|
40
|
-
var mapOptions = {
|
|
41
|
-
layers: layers,
|
|
42
|
-
zoomControl: false,
|
|
43
|
-
attributionControl: false,
|
|
44
|
-
center: center,
|
|
45
|
-
maxZoom: maxZoom,
|
|
46
|
-
minZoom: minZoom,
|
|
47
|
-
zoom: zoom,
|
|
48
|
-
maxBounds: maxBounds,
|
|
49
|
-
crs: crs
|
|
50
|
-
};
|
|
51
|
-
this.map = L.map(this.mapContainer, mapOptions);
|
|
52
|
-
}
|
|
53
|
-
}, {
|
|
54
|
-
key: "destoryMap",
|
|
55
|
-
value: function destoryMap() {
|
|
56
|
-
this.map.remove();
|
|
57
|
-
}
|
|
58
|
-
}, {
|
|
59
|
-
key: "setZoomAndCenter",
|
|
60
|
-
value: function setZoomAndCenter(zoom, center) {
|
|
61
|
-
var L = window.L;
|
|
62
|
-
var latlng;
|
|
63
|
-
if (Array.isArray(center)) {
|
|
64
|
-
latlng = center[1] < center[0] ? L.latLng(center[1], center[0]) : L.latLng(center);
|
|
65
|
-
} else {
|
|
66
|
-
latlng = center;
|
|
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
|
-
this.map.setZoom(zoom);
|
|
82
|
-
}
|
|
83
|
-
}, {
|
|
84
|
-
key: "setCenter",
|
|
85
|
-
value: function setCenter(center) {
|
|
86
|
-
this.map.setCenter(center);
|
|
87
|
-
}
|
|
88
|
-
}, {
|
|
89
|
-
key: "getZoom",
|
|
90
|
-
value: function getZoom() {
|
|
91
|
-
return this.map.getZoom();
|
|
92
|
-
}
|
|
93
|
-
}, {
|
|
94
|
-
key: "on",
|
|
95
|
-
value: function on(type, fn) {
|
|
96
|
-
this.map.on(type, fn);
|
|
97
|
-
}
|
|
98
|
-
}, {
|
|
99
|
-
key: "off",
|
|
100
|
-
value: function off(type, fn) {
|
|
101
|
-
this.map.off(type, fn);
|
|
102
|
-
}
|
|
103
|
-
}, {
|
|
104
|
-
key: "setCursor",
|
|
105
|
-
value: function setCursor(cursor) {
|
|
106
|
-
this.map.setDefaultCursor(cursor);
|
|
107
|
-
}
|
|
108
|
-
}]);
|
|
109
|
-
return LeafletInstance;
|
|
110
|
-
}();
|
|
111
|
-
export default LeafletInstance;
|
|
@@ -1,9 +0,0 @@
|
|
|
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;
|
package/es/Map/BasicMap/index.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
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
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
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, _toPropertyKey(descriptor.key), descriptor); } }
|
|
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; }
|
|
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); }
|
|
6
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
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); }; }
|
|
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); }
|
|
9
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
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; } }
|
|
11
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
12
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
15
|
-
import React from 'react';
|
|
16
|
-
import { withErrorBoundary } from 'react-error-boundary';
|
|
17
|
-
import { errorBoundaryOptions } from "../../ErrorFallback";
|
|
18
|
-
import Config from "../Config";
|
|
19
|
-
import { Provider } from "../Context";
|
|
20
|
-
import LoaderMap from "../LoaderMap";
|
|
21
|
-
import AMapInstance from "./AMapInstance";
|
|
22
|
-
import "./index.less";
|
|
23
|
-
import LeafletInstance from "./LeafletInstance";
|
|
24
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
-
var Map = /*#__PURE__*/function (_React$Component) {
|
|
27
|
-
_inherits(Map, _React$Component);
|
|
28
|
-
var _super = _createSuper(Map);
|
|
29
|
-
function Map() {
|
|
30
|
-
var _this;
|
|
31
|
-
_classCallCheck(this, Map);
|
|
32
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
33
|
-
args[_key] = arguments[_key];
|
|
34
|
-
}
|
|
35
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
36
|
-
_defineProperty(_assertThisInitialized(_this), "domRef", /*#__PURE__*/React.createRef());
|
|
37
|
-
_defineProperty(_assertThisInitialized(_this), "mapInstance", void 0);
|
|
38
|
-
return _this;
|
|
39
|
-
}
|
|
40
|
-
_createClass(Map, [{
|
|
41
|
-
key: "componentDidMount",
|
|
42
|
-
value: function componentDidMount() {
|
|
43
|
-
if (!this.domRef.current) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
var mapOptions = this.props.config;
|
|
47
|
-
var instance = this.props.isL ? LeafletInstance : AMapInstance;
|
|
48
|
-
this.mapInstance = new instance(this.domRef.current, mapOptions);
|
|
49
|
-
this.mapInstance.createMap();
|
|
50
|
-
this.forceUpdate();
|
|
51
|
-
}
|
|
52
|
-
}, {
|
|
53
|
-
key: "componentWillUnmount",
|
|
54
|
-
value: function componentWillUnmount() {
|
|
55
|
-
var _this$mapInstance;
|
|
56
|
-
(_this$mapInstance = this.mapInstance) === null || _this$mapInstance === void 0 ? void 0 : _this$mapInstance.destoryMap();
|
|
57
|
-
}
|
|
58
|
-
}, {
|
|
59
|
-
key: "render",
|
|
60
|
-
value: function render() {
|
|
61
|
-
var _this$props = this.props,
|
|
62
|
-
children = _this$props.children,
|
|
63
|
-
_this$props$className = _this$props.className,
|
|
64
|
-
className = _this$props$className === void 0 ? '' : _this$props$className,
|
|
65
|
-
glaobalKey = _this$props.glaobalKey;
|
|
66
|
-
return /*#__PURE__*/_jsx(Provider, {
|
|
67
|
-
value: {
|
|
68
|
-
instance: this.mapInstance,
|
|
69
|
-
glaobalKey: glaobalKey
|
|
70
|
-
},
|
|
71
|
-
children: /*#__PURE__*/_jsxs("div", {
|
|
72
|
-
className: "c-map-container ".concat(className),
|
|
73
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
74
|
-
ref: this.domRef
|
|
75
|
-
}), this.mapInstance && children]
|
|
76
|
-
})
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}]);
|
|
80
|
-
return Map;
|
|
81
|
-
}(React.Component);
|
|
82
|
-
var MapViewType = withErrorBoundary(Map, errorBoundaryOptions);
|
|
83
|
-
var MapView = MapViewType;
|
|
84
|
-
function WithLoaderMap(_ref) {
|
|
85
|
-
var MAP_GLABAL_KEY = _ref.MAP_GLABAL_KEY,
|
|
86
|
-
children = _ref.children,
|
|
87
|
-
className = _ref.className;
|
|
88
|
-
return /*#__PURE__*/_jsx(LoaderMap, {
|
|
89
|
-
MAP_GLABAL_KEY: MAP_GLABAL_KEY,
|
|
90
|
-
children: /*#__PURE__*/_jsx(Config, {
|
|
91
|
-
children: /*#__PURE__*/_jsx(MapView, {
|
|
92
|
-
className: className,
|
|
93
|
-
children: children
|
|
94
|
-
})
|
|
95
|
-
})
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
export default WithLoaderMap;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
.c-map-container {
|
|
2
|
-
position: relative;
|
|
3
|
-
width: 100%;
|
|
4
|
-
height: 100%;
|
|
5
|
-
|
|
6
|
-
.amap-container {
|
|
7
|
-
width: 100%;
|
|
8
|
-
height: 100%;
|
|
9
|
-
|
|
10
|
-
.amap-logo {
|
|
11
|
-
display: none !important;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.amap-copyright {
|
|
15
|
-
display: none !important;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.leaflet-container {
|
|
20
|
-
z-index: 1;
|
|
21
|
-
width: 100%;
|
|
22
|
-
height: 100%;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.leaflet-div-icon {
|
|
26
|
-
background-color: transparent;
|
|
27
|
-
border: none;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Map from "../BasicMap";
|
|
3
|
-
import deviceList from "../points";
|
|
4
|
-
import ClusterLayer from "./index";
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
var App = function App() {
|
|
7
|
-
return /*#__PURE__*/_jsx("div", {
|
|
8
|
-
style: {
|
|
9
|
-
width: '100%',
|
|
10
|
-
height: 800
|
|
11
|
-
},
|
|
12
|
-
children: /*#__PURE__*/_jsx(Map, {
|
|
13
|
-
children: /*#__PURE__*/_jsx(ClusterLayer, {
|
|
14
|
-
points: deviceList,
|
|
15
|
-
onPointClick: function onPointClick(point) {
|
|
16
|
-
return alert(point.deviceName);
|
|
17
|
-
}
|
|
18
|
-
})
|
|
19
|
-
})
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
export default App;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/// <reference path="../AMap.d.ts" />
|
|
2
|
-
import { MapPoint, Marker, LClusterInterface } from '../interface';
|
|
3
|
-
import './index.less';
|
|
4
|
-
export declare function useMarkerCluster(onPointClick?: (point: MapPoint) => void): (LClusterInterface & AMap.MarkerCluster) | null;
|
|
5
|
-
export declare function useMarkers(points?: MapPoint[]): Marker[];
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
import _useUnmount from "ahooks/es/useUnmount";
|
|
3
|
-
import _useUpdate from "ahooks/es/useUpdate";
|
|
4
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
9
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
-
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."); }
|
|
11
|
-
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); }
|
|
12
|
-
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; }
|
|
13
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
14
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
-
/// <reference path="../AMap.d.ts" />
|
|
16
|
-
import { useContext, useEffect, useRef, useState } from 'react';
|
|
17
|
-
import useMapType from "../hook/useMapType";
|
|
18
|
-
import { mapContext } from "../Context";
|
|
19
|
-
import { createMapCenterIcon } from "../icon";
|
|
20
|
-
import "./index.less";
|
|
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
|
-
var type = useMapType();
|
|
33
|
-
var update = _useUpdate();
|
|
34
|
-
var clusterRef = useRef(null);
|
|
35
|
-
useEffect(function () {
|
|
36
|
-
if (type.leaflet) {
|
|
37
|
-
var L = window.L;
|
|
38
|
-
var clusterGroup = L.markerClusterGroup(clusterOptions);
|
|
39
|
-
clusterGroup.addTo(instance.map);
|
|
40
|
-
clusterRef.current = clusterGroup;
|
|
41
|
-
}
|
|
42
|
-
if (type.AMap) {
|
|
43
|
-
AMap.plugin(['AMap.MarkerCluster'], function () {
|
|
44
|
-
var cluster = new AMap.MarkerCluster(instance.map, [], {
|
|
45
|
-
gridSize: 40,
|
|
46
|
-
renderMarker: function renderMarker(context) {
|
|
47
|
-
var data = context.data[0];
|
|
48
|
-
context.marker.setLabel({
|
|
49
|
-
content: data.deviceName,
|
|
50
|
-
direction: 'top'
|
|
51
|
-
});
|
|
52
|
-
onPointClick && context.marker.on('click', function () {
|
|
53
|
-
return onPointClick(data);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
cluster.on('click', function (e) {
|
|
58
|
-
if (e.clusterData.length === 1) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
var lnglat = e === null || e === void 0 ? void 0 : e.lnglat;
|
|
62
|
-
lnglat && instance.setZoomAndCenter(instance.getZoom() + 1, lnglat);
|
|
63
|
-
});
|
|
64
|
-
clusterRef.current = cluster;
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
update();
|
|
68
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
|
-
}, []);
|
|
70
|
-
_useUnmount(function () {
|
|
71
|
-
try {
|
|
72
|
-
instance.map.remove(clusterRef.current);
|
|
73
|
-
} catch (_) {}
|
|
74
|
-
});
|
|
75
|
-
return clusterRef.current;
|
|
76
|
-
}
|
|
77
|
-
export function useMarkers(points) {
|
|
78
|
-
var type = useMapType();
|
|
79
|
-
var L = window.L;
|
|
80
|
-
var _useState = useState({
|
|
81
|
-
markers: []
|
|
82
|
-
}),
|
|
83
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
84
|
-
state = _useState2[0],
|
|
85
|
-
setState = _useState2[1];
|
|
86
|
-
useEffect(function () {
|
|
87
|
-
if (!points) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
var arr = [];
|
|
91
|
-
if (type.leaflet) {
|
|
92
|
-
for (var i = 0, l = points.length; i < l; i++) {
|
|
93
|
-
var _point = points[i];
|
|
94
|
-
if (_point && _point.latitude && _point.longitude) {
|
|
95
|
-
var marker = new L.Marker(L.latLng(_point.latitude, _point.longitude), {
|
|
96
|
-
icon: createMapCenterIcon()
|
|
97
|
-
});
|
|
98
|
-
marker.bindTooltip(_point.deviceName, {
|
|
99
|
-
direction: 'top',
|
|
100
|
-
offset: [0, -30]
|
|
101
|
-
});
|
|
102
|
-
arr.push(marker);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
if (type.AMap) {
|
|
107
|
-
for (var _i2 = 0, _l = points.length; _i2 < _l; _i2++) {
|
|
108
|
-
var _point2 = points[_i2];
|
|
109
|
-
if (_point2 && _point2.latitude && _point2.longitude) {
|
|
110
|
-
var _marker = _objectSpread({
|
|
111
|
-
lnglat: new AMap.LngLat(_point2.longitude, _point2.latitude),
|
|
112
|
-
weight: 1
|
|
113
|
-
}, _point2);
|
|
114
|
-
arr.push(_marker);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
setState({
|
|
119
|
-
markers: arr
|
|
120
|
-
});
|
|
121
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
122
|
-
}, [points]);
|
|
123
|
-
return state.markers;
|
|
124
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/// <reference path="../AMap.d.ts" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
|
-
import { IClusterLayerProps } from './props';
|
|
4
|
-
import './index.less';
|
|
5
|
-
declare function ClusterLayer({ points, onPointClick, children }: IClusterLayerProps): JSX.Element;
|
|
6
|
-
export default ClusterLayer;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/// <reference path="../AMap.d.ts" />
|
|
2
|
-
import React, { useEffect } from 'react';
|
|
3
|
-
import { useMarkerCluster, useMarkers } from "./hook";
|
|
4
|
-
import useMapType from "../hook/useMapType";
|
|
5
|
-
import "./index.less";
|
|
6
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
function ClusterLayer(_ref) {
|
|
9
|
-
var points = _ref.points,
|
|
10
|
-
onPointClick = _ref.onPointClick,
|
|
11
|
-
children = _ref.children;
|
|
12
|
-
var type = useMapType();
|
|
13
|
-
var cluster = useMarkerCluster(onPointClick);
|
|
14
|
-
var markers = useMarkers(points);
|
|
15
|
-
useEffect(function () {
|
|
16
|
-
if (!cluster) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (type.leaflet) {
|
|
20
|
-
cluster.clearLayers();
|
|
21
|
-
cluster.addLayers(markers);
|
|
22
|
-
}
|
|
23
|
-
if (type.AMap) {
|
|
24
|
-
cluster.setData([]);
|
|
25
|
-
cluster.setData(markers);
|
|
26
|
-
}
|
|
27
|
-
}, [cluster, markers, type.AMap, type.leaflet]);
|
|
28
|
-
return /*#__PURE__*/_jsx(_Fragment, {
|
|
29
|
-
children: children
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
export default ClusterLayer;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
.c-cluster-marker-layout {
|
|
2
|
-
position: relative;
|
|
3
|
-
display: flex;
|
|
4
|
-
width: 35px;
|
|
5
|
-
height: 35px;
|
|
6
|
-
justify-content: center;
|
|
7
|
-
align-items: center;
|
|
8
|
-
|
|
9
|
-
& > div {
|
|
10
|
-
display: flex;
|
|
11
|
-
width: 28px;
|
|
12
|
-
height: 28px;
|
|
13
|
-
line-height: 28px;
|
|
14
|
-
text-align: center;
|
|
15
|
-
border-radius: 50%;
|
|
16
|
-
justify-content: center;
|
|
17
|
-
align-items: center;
|
|
18
|
-
box-shadow: 0 0 4px 0 rgb(0 0 0 / 30%);
|
|
19
|
-
|
|
20
|
-
.anticon {
|
|
21
|
-
font-size: 17px;
|
|
22
|
-
color: #fff;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.c-cluster-div-icon {
|
|
28
|
-
background: unset;
|
|
29
|
-
}
|
package/es/Map/Config/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { customConfigProps } from '../interface';
|
|
3
|
-
interface IConfigProps {
|
|
4
|
-
children: React.ReactElement;
|
|
5
|
-
MAP_GLABAL_KEY?: 'L' | 'AMap';
|
|
6
|
-
customConfig?: customConfigProps;
|
|
7
|
-
}
|
|
8
|
-
declare function Config({ children, MAP_GLABAL_KEY, customConfig, ...props }: IConfigProps): JSX.Element;
|
|
9
|
-
export default Config;
|