@cloud-app-dev/vidc 4.0.20 → 4.0.22

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.
Files changed (234) hide show
  1. package/es/AppContext/Sync.js +42 -0
  2. package/es/AppContext/index.js +141 -0
  3. package/es/AppContext/interface.d.ts +41 -0
  4. package/es/AppContext/static.js +9 -0
  5. package/es/Auth/index.js +14 -0
  6. package/es/AutoExit/index.js +19 -0
  7. package/es/CheckGroupFixed/demo.js +22 -0
  8. package/es/CheckGroupFixed/index.js +140 -0
  9. package/es/CheckGroupFixed/index.less +56 -0
  10. package/es/Config/index.js +77 -0
  11. package/es/Config/interface.d.ts +65 -0
  12. package/es/Config/utils.js +33 -0
  13. package/es/ConfigContext/index.js +21 -0
  14. package/es/CustomRenderSelect/index.js +72 -0
  15. package/es/CustomRenderSelect/index.less +25 -0
  16. package/es/DBTools/index.js +336 -0
  17. package/es/DisableMark/index.js +19 -0
  18. package/es/DisableMark/index.less +9 -0
  19. package/es/DomMove/demo.js +16 -0
  20. package/es/DomMove/index.js +139 -0
  21. package/es/DomMove/utils.js +32 -0
  22. package/es/Drag/DragAndDropItem.js +133 -0
  23. package/es/Drag/DropItem.js +50 -0
  24. package/es/Drag/index.d.ts +9 -0
  25. package/es/Drag/index.js +7 -0
  26. package/es/Drag/interface.d.ts +16 -0
  27. package/es/DynamicGridList/Demo.js +77 -0
  28. package/es/DynamicGridList/index.js +67 -0
  29. package/es/DynamicList/demo.js +44 -0
  30. package/es/DynamicList/index.js +86 -0
  31. package/es/DynamicList/index.less +17 -0
  32. package/es/DynamicList/interface.d.ts +19 -0
  33. package/es/DynamicList/utils.js +6 -0
  34. package/es/ErrorFallback/index.js +31 -0
  35. package/es/ErrorFallback/inerface.d.ts +48 -0
  36. package/es/EventTools/index.js +12 -0
  37. package/es/FrontendPlayer/index.js +2 -0
  38. package/es/FullScreen/index.js +33 -0
  39. package/es/FullScreen/index.less +18 -0
  40. package/es/GridList/Demo.js +80 -0
  41. package/es/GridList/data.js +609 -0
  42. package/es/GridList/hook.js +270 -0
  43. package/es/GridList/index.js +44 -0
  44. package/es/GridList/index.less +8 -0
  45. package/es/GridList/interface.d.ts +59 -0
  46. package/es/GridList/utils.js +42 -0
  47. package/es/HightLevel/index.js +18 -0
  48. package/es/HightLevel/index.less +3 -0
  49. package/es/IconFont/index.js +54 -0
  50. package/es/ImageView/index.js +51 -0
  51. package/es/ImageView/index.less +11 -0
  52. package/es/InstanceHistory/index.js +7 -0
  53. package/es/LabelPlayer/111.png +0 -0
  54. package/es/LabelPlayer/demo.js +115 -0
  55. package/es/LabelPlayer/index.js +160 -0
  56. package/es/LabelPlayer/index.less +24 -0
  57. package/es/LabelValue/index.js +27 -0
  58. package/es/LabelValue/index.less +23 -0
  59. package/es/List/demo.js +23 -0
  60. package/es/List/index.js +28 -0
  61. package/es/List/index.less +20 -0
  62. package/es/ListWithSizeAnimate/demo.js +98 -0
  63. package/es/ListWithSizeAnimate/index.js +85 -0
  64. package/es/ListWithSizeAnimate/index.less +23 -0
  65. package/es/LoaderScript/index.js +34 -0
  66. package/es/LoaderScript/utils.js +179 -0
  67. package/es/Map/AMap.d.ts +7109 -0
  68. package/es/Map/BasicMap/AMapInstance.js +98 -0
  69. package/es/Map/BasicMap/LeafletInstance.js +111 -0
  70. package/es/Map/BasicMap/index.js +90 -0
  71. package/es/Map/BasicMap/index.less +29 -0
  72. package/es/Map/ClusterLayer/demo.js +18 -0
  73. package/es/Map/ClusterLayer/hook.js +123 -0
  74. package/es/Map/ClusterLayer/index.js +28 -0
  75. package/es/Map/ClusterLayer/index.less +29 -0
  76. package/es/Map/ClusterLayer/props.d.ts +8 -0
  77. package/es/Map/Config/index.js +48 -0
  78. package/es/Map/Config/utils.js +65 -0
  79. package/es/Map/Context/index.js +51 -0
  80. package/es/Map/FindPio/index.js +13 -0
  81. package/es/Map/FindPio/index.less +7 -0
  82. package/es/Map/InfoWindow/MakerLikeWindow.js +108 -0
  83. package/es/Map/InfoWindow/demo.js +70 -0
  84. package/es/Map/InfoWindow/index.js +62 -0
  85. package/es/Map/LevelCenter/DragMarker/index.js +42 -0
  86. package/es/Map/LevelCenter/demo.js +38 -0
  87. package/es/Map/LevelCenter/index.js +66 -0
  88. package/es/Map/LoaderMap/index.js +62 -0
  89. package/es/Map/MapDrawSelect/demo.js +71 -0
  90. package/es/Map/MapDrawSelect/index.js +56 -0
  91. package/es/Map/MouseTool/index.js +40 -0
  92. package/es/Map/MouseTool/useMouseTools.js +83 -0
  93. package/es/Map/ResetTools/index.js +57 -0
  94. package/es/Map/ResetTools/index.less +39 -0
  95. package/es/Map/SinglePoint/demo.js +14 -0
  96. package/es/Map/SinglePoint/index.js +52 -0
  97. package/es/Map/SinglePoint/index.less +41 -0
  98. package/es/Map/hook/useMapEvent.js +19 -0
  99. package/es/Map/hook/useMapType.js +12 -0
  100. package/es/Map/icon.js +10 -0
  101. package/es/Map/index.js +25 -0
  102. package/es/Map/interface.d.ts +74 -0
  103. package/es/Map/points.js +1 -0
  104. package/es/Map/useMarker/index.js +71 -0
  105. package/es/Map/withMap/index.js +10 -0
  106. package/es/Picture/component/DefaultRects/RectInfo.js +80 -0
  107. package/es/Picture/component/DefaultRects/index.js +52 -0
  108. package/es/Picture/component/DefaultRects/index.less +211 -0
  109. package/es/Picture/component/DefaultRects/utils.js +11 -0
  110. package/es/Picture/component/DrawRect/index.js +46 -0
  111. package/es/Picture/component/DrawRect/index.less +8 -0
  112. package/es/Picture/component/RectMenu/index.js +76 -0
  113. package/es/Picture/component/RectMenu/index.less +36 -0
  114. package/es/Picture/component/RectMenu/utils.js +19 -0
  115. package/es/Picture/component/Tools/index.js +73 -0
  116. package/es/Picture/component/Tools/index.less +49 -0
  117. package/es/Picture/component/WheelScale/index.js +27 -0
  118. package/es/Picture/demo.js +105 -0
  119. package/es/Picture/index.js +341 -0
  120. package/es/Picture/index.less +20 -0
  121. package/es/Picture/interface.d.ts +196 -0
  122. package/es/Picture/loadCaptureRectImage.js +99 -0
  123. package/es/Picture/useDraw.js +103 -0
  124. package/es/Picture/utils.js +143 -0
  125. package/es/Player/api/index.js +309 -0
  126. package/es/Player/context.js +24 -0
  127. package/es/Player/contraller_bar/bar.js +20 -0
  128. package/es/Player/contraller_bar/contraller_event.js +48 -0
  129. package/es/Player/contraller_bar/index.js +27 -0
  130. package/es/Player/contraller_bar/left_bar.js +83 -0
  131. package/es/Player/contraller_bar/right_bar.js +32 -0
  132. package/es/Player/contraller_bar/time.js +19 -0
  133. package/es/Player/contraller_bar/useBarStatus.js +43 -0
  134. package/es/Player/contraller_bar/volume.js +62 -0
  135. package/es/Player/demo.js +266 -0
  136. package/es/Player/empty.js +4 -0
  137. package/es/Player/event/errorEvent.js +88 -0
  138. package/es/Player/event/eventName.js +29 -0
  139. package/es/Player/event/index.js +205 -0
  140. package/es/Player/fps_play.js +83 -0
  141. package/es/Player/frontend_player.js +64 -0
  142. package/es/Player/frontend_timeline.js +132 -0
  143. package/es/Player/iconfont.js +16 -0
  144. package/es/Player/index.js +2 -0
  145. package/es/Player/live_heart.js +45 -0
  146. package/es/Player/message.js +133 -0
  147. package/es/Player/player.d.ts +233 -0
  148. package/es/Player/segment_player.js +228 -0
  149. package/es/Player/segment_timeline.js +173 -0
  150. package/es/Player/single_player.js +262 -0
  151. package/es/Player/style/bar.less +43 -0
  152. package/es/Player/style/iconfont.js +43 -0
  153. package/es/Player/style/index.less +34 -0
  154. package/es/Player/style/message.less +56 -0
  155. package/es/Player/style/slider.less +106 -0
  156. package/es/Player/style/timeline.less +117 -0
  157. package/es/Player/style/volume.less +24 -0
  158. package/es/Player/timeline.js +95 -0
  159. package/es/Player/util.js +189 -0
  160. package/es/PlayerExt/demo.js +154 -0
  161. package/es/PlayerExt/index.js +188 -0
  162. package/es/PlayerExt/index.less +10 -0
  163. package/es/Progress/index.d.ts +9 -0
  164. package/es/Progress/index.js +53 -0
  165. package/es/Progress/index.less +21 -0
  166. package/es/ROI/demo.js +16 -0
  167. package/es/ROI/index.js +54 -0
  168. package/es/ROI/index.less +33 -0
  169. package/es/RefDrawer/Footer.js +22 -0
  170. package/es/RefDrawer/demo.js +18 -0
  171. package/es/RefDrawer/index.js +71 -0
  172. package/es/RefModal/demo.js +18 -0
  173. package/es/RefModal/index.js +70 -0
  174. package/es/ScreenPlayer/Live.js +212 -0
  175. package/es/ScreenPlayer/LiveTools.js +151 -0
  176. package/es/ScreenPlayer/PlayerWithExt.js +231 -0
  177. package/es/ScreenPlayer/RatePick.js +29 -0
  178. package/es/ScreenPlayer/Record.js +442 -0
  179. package/es/ScreenPlayer/RecordTools.js +169 -0
  180. package/es/ScreenPlayer/ScreenSelect.js +46 -0
  181. package/es/ScreenPlayer/SegmentTimeLine.js +36 -0
  182. package/es/ScreenPlayer/TimeMode.js +26 -0
  183. package/es/ScreenPlayer/TimeSelect.js +88 -0
  184. package/es/ScreenPlayer/demo.js +21 -0
  185. package/es/ScreenPlayer/demo2.js +194 -0
  186. package/es/ScreenPlayer/index.js +9 -0
  187. package/es/ScreenPlayer/index.less +335 -0
  188. package/es/ScreenPlayer/interface.d.ts +216 -0
  189. package/es/ScreenPlayer/useTimeSlider.js +456 -0
  190. package/es/ScreenPlayer/useVideoFit.js +35 -0
  191. package/es/ScreenPlayer/utils.js +85 -0
  192. package/es/SegmentPlayer/index.js +2 -0
  193. package/es/Service/http.js +133 -0
  194. package/es/Service/index.js +11 -0
  195. package/es/Service/interface.d.ts +23 -0
  196. package/es/Service/middleware.js +22 -0
  197. package/es/SocketEmitter/eventEmitter.js +88 -0
  198. package/es/SocketEmitter/index.js +125 -0
  199. package/es/SocketEmitter/interface.d.ts +4 -0
  200. package/es/TableLayout/index.js +27 -0
  201. package/es/TableLayout/index.less +4 -0
  202. package/es/ThemeAntd/demo.js +81 -0
  203. package/es/ThemeAntd/demo.less +20 -0
  204. package/es/ThemeAntd/index.js +21 -0
  205. package/es/ThemeAntd/index.less +4 -0
  206. package/es/Timeout/index.js +65 -0
  207. package/es/bigNumberTransformCN/index.js +58 -0
  208. package/es/cache/index.js +94 -0
  209. package/es/copy/index.js +9 -0
  210. package/es/core.d.ts +0 -0
  211. package/es/getThemeStyle/index.js +5 -0
  212. package/es/index.js +62 -0
  213. package/es/likeGo/index.js +31 -0
  214. package/es/likeGoSync/index.js +10 -0
  215. package/es/logger/index.js +30 -0
  216. package/es/nextTick/index.js +3 -0
  217. package/es/recorder/demo.js +181 -0
  218. package/es/recorder/index.js +992 -0
  219. package/es/submidstr/index.js +14 -0
  220. package/es/treeHelper/index.js +188 -0
  221. package/es/typings.d.ts +2 -0
  222. package/es/useDrawROI/index.js +318 -0
  223. package/es/useEventEmitterHandle/index.js +17 -0
  224. package/es/useFullscreen/demo.js +43 -0
  225. package/es/useFullscreen/index.js +76 -0
  226. package/es/useHistory/index.js +9 -0
  227. package/es/useHistory/interface.d.ts +3 -0
  228. package/es/useInfiniteScroll/index.js +102 -0
  229. package/es/useRafInterval/index.js +70 -0
  230. package/es/useSimpleState/index.js +35 -0
  231. package/es/useVirtualList/index.js +136 -0
  232. package/es/utils.js +46 -0
  233. package/es/uuid/index.js +19 -0
  234. package/package.json +2 -3
@@ -0,0 +1,98 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
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;
@@ -0,0 +1,111 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
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;
@@ -0,0 +1,90 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
14
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
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
+ var Map = /*#__PURE__*/function (_React$Component) {
25
+ _inherits(Map, _React$Component);
26
+ var _super = _createSuper(Map);
27
+ function Map() {
28
+ var _this;
29
+ _classCallCheck(this, Map);
30
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
31
+ args[_key] = arguments[_key];
32
+ }
33
+ _this = _super.call.apply(_super, [this].concat(args));
34
+ _defineProperty(_assertThisInitialized(_this), "domRef", /*#__PURE__*/React.createRef());
35
+ _defineProperty(_assertThisInitialized(_this), "mapInstance", void 0);
36
+ return _this;
37
+ }
38
+ _createClass(Map, [{
39
+ key: "componentDidMount",
40
+ value: function componentDidMount() {
41
+ if (!this.domRef.current) {
42
+ return;
43
+ }
44
+ var mapOptions = this.props.config;
45
+ var instance = this.props.isL ? LeafletInstance : AMapInstance;
46
+ this.mapInstance = new instance(this.domRef.current, mapOptions);
47
+ this.mapInstance.createMap();
48
+ this.forceUpdate();
49
+ }
50
+ }, {
51
+ key: "componentWillUnmount",
52
+ value: function componentWillUnmount() {
53
+ var _this$mapInstance;
54
+ (_this$mapInstance = this.mapInstance) === null || _this$mapInstance === void 0 || _this$mapInstance.destoryMap();
55
+ }
56
+ }, {
57
+ key: "render",
58
+ value: function render() {
59
+ var _this$props = this.props,
60
+ children = _this$props.children,
61
+ _this$props$className = _this$props.className,
62
+ className = _this$props$className === void 0 ? '' : _this$props$className,
63
+ glaobalKey = _this$props.glaobalKey;
64
+ return /*#__PURE__*/React.createElement(Provider, {
65
+ value: {
66
+ instance: this.mapInstance,
67
+ glaobalKey: glaobalKey
68
+ }
69
+ }, /*#__PURE__*/React.createElement("div", {
70
+ className: "c-map-container ".concat(className)
71
+ }, /*#__PURE__*/React.createElement("div", {
72
+ ref: this.domRef
73
+ }), this.mapInstance && children));
74
+ }
75
+ }]);
76
+ return Map;
77
+ }(React.Component);
78
+ var MapViewType = withErrorBoundary(Map, errorBoundaryOptions);
79
+ var MapView = MapViewType;
80
+ function WithLoaderMap(_ref) {
81
+ var MAP_GLABAL_KEY = _ref.MAP_GLABAL_KEY,
82
+ children = _ref.children,
83
+ className = _ref.className;
84
+ return /*#__PURE__*/React.createElement(LoaderMap, {
85
+ MAP_GLABAL_KEY: MAP_GLABAL_KEY
86
+ }, /*#__PURE__*/React.createElement(Config, null, /*#__PURE__*/React.createElement(MapView, {
87
+ className: className
88
+ }, children)));
89
+ }
90
+ export default WithLoaderMap;
@@ -0,0 +1,29 @@
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
+ }
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import Map from "../BasicMap";
3
+ import deviceList from "../points";
4
+ import ClusterLayer from "./index";
5
+ var App = function App() {
6
+ return /*#__PURE__*/React.createElement("div", {
7
+ style: {
8
+ width: '100%',
9
+ height: 800
10
+ }
11
+ }, /*#__PURE__*/React.createElement(Map, null, /*#__PURE__*/React.createElement(ClusterLayer, {
12
+ points: deviceList,
13
+ onPointClick: function onPointClick(point) {
14
+ return alert(point.deviceName);
15
+ }
16
+ })));
17
+ };
18
+ export default App;
@@ -0,0 +1,123 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ 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; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ 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."); }
9
+ 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); }
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; }
11
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ /// <reference path="../AMap.d.ts" />
14
+ import { useContext, useEffect, useRef, useState } from 'react';
15
+ import useMapType from "../hook/useMapType";
16
+ import { useUnmount, useUpdate } from 'ahooks';
17
+ import { mapContext } from "../Context";
18
+ import { createMapCenterIcon } from "../icon";
19
+ import "./index.less";
20
+ var clusterOptions = {
21
+ showCoverageOnHover: false,
22
+ maxClusterRadius: 80,
23
+ spiderfyOnMaxZoom: false,
24
+ removeOutsideVisibleBounds: true,
25
+ chunkedLoading: true,
26
+ zoomToBoundsOnClick: false
27
+ };
28
+ export function useMarkerCluster(onPointClick) {
29
+ var _useContext = useContext(mapContext),
30
+ instance = _useContext.instance;
31
+ var type = useMapType();
32
+ var update = useUpdate();
33
+ var clusterRef = useRef(null);
34
+ useEffect(function () {
35
+ if (type.leaflet) {
36
+ var L = window.L;
37
+ var clusterGroup = L.markerClusterGroup(clusterOptions);
38
+ clusterGroup.addTo(instance.map);
39
+ clusterRef.current = clusterGroup;
40
+ }
41
+ if (type.AMap) {
42
+ AMap.plugin(['AMap.MarkerCluster'], function () {
43
+ var cluster = new AMap.MarkerCluster(instance.map, [], {
44
+ gridSize: 40,
45
+ renderMarker: function renderMarker(context) {
46
+ var data = context.data[0];
47
+ context.marker.setLabel({
48
+ content: data.deviceName,
49
+ direction: 'top'
50
+ });
51
+ onPointClick && context.marker.on('click', function () {
52
+ return onPointClick(data);
53
+ });
54
+ }
55
+ });
56
+ cluster.on('click', function (e) {
57
+ if (e.clusterData.length === 1) {
58
+ return;
59
+ }
60
+ var lnglat = e === null || e === void 0 ? void 0 : e.lnglat;
61
+ lnglat && instance.setZoomAndCenter(instance.getZoom() + 1, lnglat);
62
+ });
63
+ clusterRef.current = cluster;
64
+ });
65
+ }
66
+ update();
67
+ // eslint-disable-next-line react-hooks/exhaustive-deps
68
+ }, []);
69
+ useUnmount(function () {
70
+ try {
71
+ instance.map.remove(clusterRef.current);
72
+ } catch (_) {}
73
+ });
74
+ return clusterRef.current;
75
+ }
76
+ export function useMarkers(points) {
77
+ var type = useMapType();
78
+ var L = window.L;
79
+ var _useState = useState({
80
+ markers: []
81
+ }),
82
+ _useState2 = _slicedToArray(_useState, 2),
83
+ state = _useState2[0],
84
+ setState = _useState2[1];
85
+ useEffect(function () {
86
+ if (!points) {
87
+ return;
88
+ }
89
+ var arr = [];
90
+ if (type.leaflet) {
91
+ for (var i = 0, l = points.length; i < l; i++) {
92
+ var _point = points[i];
93
+ if (_point && _point.latitude && _point.longitude) {
94
+ var marker = new L.Marker(L.latLng(_point.latitude, _point.longitude), {
95
+ icon: createMapCenterIcon()
96
+ });
97
+ marker.bindTooltip(_point.deviceName, {
98
+ direction: 'top',
99
+ offset: [0, -30]
100
+ });
101
+ arr.push(marker);
102
+ }
103
+ }
104
+ }
105
+ if (type.AMap) {
106
+ for (var _i = 0, _l = points.length; _i < _l; _i++) {
107
+ var _point2 = points[_i];
108
+ if (_point2 && _point2.latitude && _point2.longitude) {
109
+ var _marker = _objectSpread({
110
+ lnglat: new AMap.LngLat(_point2.longitude, _point2.latitude),
111
+ weight: 1
112
+ }, _point2);
113
+ arr.push(_marker);
114
+ }
115
+ }
116
+ }
117
+ setState({
118
+ markers: arr
119
+ });
120
+ // eslint-disable-next-line react-hooks/exhaustive-deps
121
+ }, [points]);
122
+ return state.markers;
123
+ }
@@ -0,0 +1,28 @@
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
+ 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
+ if (type.leaflet) {
18
+ cluster.clearLayers();
19
+ cluster.addLayers(markers);
20
+ }
21
+ if (type.AMap) {
22
+ cluster.setData([]);
23
+ cluster.setData(markers);
24
+ }
25
+ }, [cluster, markers, type.AMap, type.leaflet]);
26
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
27
+ }
28
+ export default ClusterLayer;
@@ -0,0 +1,29 @@
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
+ }
@@ -0,0 +1,8 @@
1
+ import { MapPoint } from '../interface';
2
+
3
+ export interface IClusterLayerProps {
4
+ points?: MapPoint[];
5
+
6
+ onPointClick?: (point: MapPoint) => void;
7
+ children?: React.ReactNode;
8
+ }
@@ -0,0 +1,48 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["children", "MAP_GLABAL_KEY", "customConfig"];
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
+ 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."); }
10
+ 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); }
11
+ 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; }
12
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
15
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
16
+ import React, { useEffect, useMemo, useState } from 'react';
17
+ import { queryMapConfig } from "./utils";
18
+ function Config(_ref) {
19
+ var children = _ref.children,
20
+ MAP_GLABAL_KEY = _ref.MAP_GLABAL_KEY,
21
+ customConfig = _ref.customConfig,
22
+ props = _objectWithoutProperties(_ref, _excluded);
23
+ var _useState = useState(),
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ config = _useState2[0],
26
+ setConfig = _useState2[1];
27
+ var _useState3 = useState(false),
28
+ _useState4 = _slicedToArray(_useState3, 2),
29
+ isInit = _useState4[0],
30
+ setInit = _useState4[1];
31
+ var extProps = useMemo(function () {
32
+ return config ? {
33
+ config: config
34
+ } : {};
35
+ }, [config]);
36
+ useEffect(function () {
37
+ queryMapConfig(MAP_GLABAL_KEY, customConfig).then(setConfig).then(function () {
38
+ return setInit(true);
39
+ });
40
+ }, [MAP_GLABAL_KEY]);
41
+ if (!isInit) {
42
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
43
+ }
44
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread(_objectSpread({}, props), extProps), {}, {
45
+ MAP_GLABAL_KEY: MAP_GLABAL_KEY
46
+ })));
47
+ }
48
+ export default Config;