@cloud-app-dev/vidc 4.0.7 → 4.0.9

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 (119) hide show
  1. package/.dumirc.ts +0 -10
  2. package/.fatherrc.ts +1 -4
  3. package/es/AppContext/Sync.js +10 -24
  4. package/es/AppContext/index.js +19 -19
  5. package/es/AppContext/static.js +0 -6
  6. package/es/Auth/index.js +2 -5
  7. package/es/AutoExit/index.js +2 -2
  8. package/es/CheckGroupFixed/demo.js +0 -2
  9. package/es/CheckGroupFixed/index.js +25 -42
  10. package/es/CustomRenderSelect/index.js +2 -2
  11. package/es/DisableMark/index.js +2 -2
  12. package/es/DomMove/index.js +31 -42
  13. package/es/DomMove/utils.js +3 -8
  14. package/es/Drag/DragAndDropItem.js +28 -45
  15. package/es/Drag/DropItem.js +11 -21
  16. package/es/DynamicGridList/Demo.js +1 -13
  17. package/es/DynamicList/demo.js +1 -10
  18. package/es/DynamicList/index.js +27 -41
  19. package/es/ErrorFallback/index.js +1 -3
  20. package/es/EventTools/index.d.ts +3 -0
  21. package/es/EventTools/index.js +12 -0
  22. package/es/GridList/Demo.js +5 -18
  23. package/es/GridList/utils.js +0 -1
  24. package/es/HightLevel/index.js +1 -5
  25. package/es/IconFont/index.js +9 -18
  26. package/es/InstanceHistory/index.js +0 -2
  27. package/es/ListWithSizeAnimate/index.js +15 -31
  28. package/es/LoaderScript/index.js +10 -21
  29. package/es/LoaderScript/utils.js +2 -2
  30. package/es/Map/BasicMap/AMapInstance.js +6 -16
  31. package/es/Map/BasicMap/LeafletInstance.js +16 -26
  32. package/es/Map/ClusterLayer/hook.js +16 -38
  33. package/es/Map/ClusterLayer/index.js +2 -6
  34. package/es/Map/Context/index.js +6 -30
  35. package/es/Map/FindPio/index.js +0 -2
  36. package/es/Map/LevelCenter/DragMarker/index.js +6 -9
  37. package/es/Map/LevelCenter/demo.js +12 -21
  38. package/es/Map/LevelCenter/index.js +8 -14
  39. package/es/Map/LoaderMap/index.js +14 -17
  40. package/es/Map/MapDrawSelect/demo.js +14 -25
  41. package/es/Map/MapDrawSelect/index.js +14 -20
  42. package/es/Map/MouseTool/index.js +17 -27
  43. package/es/Map/MouseTool/useMouseTools.js +12 -35
  44. package/es/Map/ResetTools/index.js +4 -8
  45. package/es/Map/SinglePoint/index.js +6 -13
  46. package/es/Map/hook/useMapEvent.js +3 -7
  47. package/es/Map/hook/useMapType.js +1 -2
  48. package/es/Map/useMarker/index.js +17 -30
  49. package/es/Map/withMap/index.js +4 -6
  50. package/es/Picture/component/DefaultRects/RectInfo.js +13 -27
  51. package/es/Picture/component/DefaultRects/index.js +7 -10
  52. package/es/Picture/component/DrawRect/index.js +10 -13
  53. package/es/Picture/component/RectMenu/index.js +10 -15
  54. package/es/Picture/component/RectMenu/utils.js +3 -6
  55. package/es/Picture/component/WheelScale/index.js +3 -5
  56. package/es/Picture/loadCaptureRectImage.js +42 -61
  57. package/es/Picture/useDraw.js +23 -39
  58. package/es/Player/api/index.js +2 -2
  59. package/es/Player/context.js +5 -9
  60. package/es/Player/contraller_bar/bar.js +9 -16
  61. package/es/Player/contraller_bar/contraller_event.js +7 -25
  62. package/es/Player/contraller_bar/index.js +7 -9
  63. package/es/Player/contraller_bar/left_bar.js +17 -29
  64. package/es/Player/contraller_bar/time.js +5 -14
  65. package/es/Player/contraller_bar/useBarStatus.js +12 -24
  66. package/es/Player/contraller_bar/volume.js +9 -29
  67. package/es/Player/event/eventName.js +1 -1
  68. package/es/Player/event/index.js +28 -63
  69. package/es/Player/frontend_player.js +16 -27
  70. package/es/Player/iconfont.js +6 -12
  71. package/es/Player/live_heart.js +2 -18
  72. package/es/Player/message.js +15 -35
  73. package/es/Player/segment_player.js +48 -86
  74. package/es/Player/single_player.js +1 -1
  75. package/es/Player/timeline.js +19 -41
  76. package/es/PlayerExt/demo.js +15 -25
  77. package/es/PlayerExt/index.js +29 -51
  78. package/es/ROI/demo.js +0 -2
  79. package/es/ScreenPlayer/RatePick.js +8 -10
  80. package/es/ScreenPlayer/Record.js +11 -32
  81. package/es/ScreenPlayer/TimeMode.js +1 -3
  82. package/es/ScreenPlayer/useTimeSlider.js +3 -3
  83. package/es/ScreenPlayer/useVideoFit.js +8 -21
  84. package/es/SocketEmitter/eventEmitter.d.ts +27 -0
  85. package/es/SocketEmitter/eventEmitter.js +87 -0
  86. package/es/SocketEmitter/index.d.ts +24 -0
  87. package/es/SocketEmitter/index.js +125 -0
  88. package/es/SocketEmitter/interface.d.ts +4 -0
  89. package/es/ThemeAntd/demo.js +0 -2
  90. package/es/VList/utils.js +2 -3
  91. package/es/bigNumberTransformCN/index.d.ts +5 -0
  92. package/es/bigNumberTransformCN/index.js +60 -0
  93. package/es/cache/index.d.ts +34 -0
  94. package/es/cache/index.js +94 -0
  95. package/es/copy/index.d.ts +1 -0
  96. package/es/copy/index.js +9 -0
  97. package/es/getThemeStyle/index.d.ts +2 -0
  98. package/es/getThemeStyle/index.js +5 -0
  99. package/es/index.d.ts +11 -0
  100. package/es/index.js +12 -1
  101. package/es/logger/index.d.ts +7 -0
  102. package/es/logger/index.js +30 -0
  103. package/es/nextTick/index.d.ts +1 -0
  104. package/es/nextTick/index.js +7 -0
  105. package/es/submidstr/index.d.ts +5 -0
  106. package/es/submidstr/index.js +14 -0
  107. package/es/treeHelper/index.d.ts +11 -0
  108. package/es/treeHelper/index.js +173 -0
  109. package/es/useEventEmitterHandle/index.js +5 -9
  110. package/es/useFullscreen/demo.js +8 -18
  111. package/es/useFullscreen/index.js +7 -28
  112. package/es/useHistory/index.js +0 -2
  113. package/es/useRafInterval/index.js +3 -27
  114. package/es/useSimpleState/index.js +11 -22
  115. package/es/useVirtualList/index.js +21 -57
  116. package/es/utils.js +2 -2
  117. package/es/uuid/index.d.ts +4 -0
  118. package/es/uuid/index.js +15 -0
  119. package/package.json +4 -5
@@ -5,15 +5,12 @@ import { createMapCenterIcon } from "../../icon";
5
5
  import useMapType from "../../hook/useMapType";
6
6
  import { Fragment as _Fragment } from "react/jsx-runtime";
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
-
9
8
  function DragMarker(_ref) {
10
9
  var center = _ref.center,
11
- title = _ref.title,
12
- onChange = _ref.onChange;
13
-
10
+ title = _ref.title,
11
+ onChange = _ref.onChange;
14
12
  var _useContext = useContext(mapContext),
15
- instance = _useContext.instance;
16
-
13
+ instance = _useContext.instance;
17
14
  var type = useMapType();
18
15
  var marker = useMarker({
19
16
  map: instance.map,
@@ -28,14 +25,15 @@ function DragMarker(_ref) {
28
25
  if (!marker) {
29
26
  return;
30
27
  }
31
-
32
28
  marker.on('dragend', function (e) {
33
29
  var latlng = type.leaflet ? e.target.getLatLng() : e.target.getPosition();
34
30
  instance.setCenter(latlng);
35
31
  onChange === null || onChange === void 0 ? void 0 : onChange({
36
32
  center: [latlng.getLng(), latlng.getLat()]
37
33
  });
38
- }); // instance.map.on('moveend', () => {
34
+ });
35
+
36
+ // instance.map.on('moveend', () => {
39
37
  // const latlng = (type.leaflet ? marker.getLatLng() : marker.getPosition()) as LatLng;
40
38
  // onChange?.({ center: [latlng.getLng(), latlng.getLat()] });
41
39
  // });
@@ -43,5 +41,4 @@ function DragMarker(_ref) {
43
41
  }, [marker]);
44
42
  return /*#__PURE__*/_jsx(_Fragment, {});
45
43
  }
46
-
47
44
  export default DragMarker;
@@ -1,36 +1,28 @@
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); }
1
2
  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; }
2
-
3
3
  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; }
4
-
5
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
-
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ 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); }
7
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
-
9
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."); }
10
-
11
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); }
12
-
13
- 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; }
14
-
15
- 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; }
16
-
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(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; } }
17
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
-
19
13
  import React, { useEffect, useState } from 'react';
20
14
  import LevelCenter from "./index";
21
15
  import deviceList from "../points.json";
22
16
  import { ConfigProvider } from 'antd';
23
17
  import { jsx as _jsx } from "react/jsx-runtime";
24
-
25
18
  var App = function App() {
26
19
  var _useState = useState({
27
- center: [113, 30],
28
- zoom: 10
29
- }),
30
- _useState2 = _slicedToArray(_useState, 2),
31
- state = _useState2[0],
32
- setState = _useState2[1];
33
-
20
+ center: [113, 30],
21
+ zoom: 10
22
+ }),
23
+ _useState2 = _slicedToArray(_useState, 2),
24
+ state = _useState2[0],
25
+ setState = _useState2[1];
34
26
  useEffect(function () {
35
27
  console.log(state);
36
28
  }, [state]);
@@ -51,5 +43,4 @@ var App = function App() {
51
43
  })
52
44
  });
53
45
  };
54
-
55
46
  export default App;
@@ -9,37 +9,32 @@ import DragMarker from "./DragMarker";
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  import { Fragment as _Fragment } from "react/jsx-runtime";
11
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
-
13
12
  function LevelCenter(_ref) {
14
13
  var center = _ref.center,
15
- zoom = _ref.zoom,
16
- points = _ref.points,
17
- onLevelCenterChange = _ref.onLevelCenterChange,
18
- enableClick = _ref.enableClick,
19
- children = _ref.children;
20
-
14
+ zoom = _ref.zoom,
15
+ points = _ref.points,
16
+ onLevelCenterChange = _ref.onLevelCenterChange,
17
+ enableClick = _ref.enableClick,
18
+ children = _ref.children;
21
19
  var _useContext = useContext(mapContext),
22
- instance = _useContext.instance;
23
-
20
+ instance = _useContext.instance;
24
21
  var defaultCenter = useMemo(function () {
25
22
  return center || instance.config.center;
26
23
  }, [center, instance]);
27
24
  var defaultZoom = useMemo(function () {
28
25
  return zoom || instance.config.zoom;
29
- }, [zoom, instance]); // eslint-disable-next-line react-hooks/exhaustive-deps
26
+ }, [zoom, instance]);
30
27
 
28
+ // eslint-disable-next-line react-hooks/exhaustive-deps
31
29
  var mapRest = useCallback(function () {
32
30
  return instance.setZoomAndCenter(defaultZoom, defaultCenter);
33
31
  }, [defaultZoom, defaultCenter]);
34
-
35
32
  _useMount(function () {
36
33
  if (enableClick) {
37
34
  instance.setCursor('pointer');
38
35
  }
39
-
40
36
  mapRest();
41
37
  });
42
-
43
38
  useMapEvent('click', function (event) {
44
39
  if (enableClick) {
45
40
  var _center = [event.lnglat.lng, event.lnglat.lat];
@@ -73,5 +68,4 @@ function LevelCenter(_ref) {
73
68
  }), children]
74
69
  });
75
70
  }
76
-
77
71
  export default withMap(LevelCenter, 'lv-center-map-container');
@@ -1,15 +1,12 @@
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); }
1
2
  var _excluded = ["children", "MAP_GLABAL_KEY"];
2
-
3
3
  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; }
4
-
5
4
  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
-
7
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
-
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); }
9
8
  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; }
10
-
11
9
  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; }
12
-
13
10
  import React, { useMemo } from 'react';
14
11
  import Config from "../../Config";
15
12
  import LoaderScript from "../../LoaderScript";
@@ -17,33 +14,34 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
17
14
  import { jsx as _jsx } from "react/jsx-runtime";
18
15
  var L_SCRIPTS = [{
19
16
  scripts: ['https://cdn.bootcdn.net/ajax/libs/leaflet/1.8.0/leaflet.min.js'],
20
- styles: ['https://cdn.bootcdn.net/ajax/libs/leaflet/1.8.0/leaflet.min.css'] // scripts: ['/statics/libs/map/leaflet/leaflet.min.js'],
17
+ styles: ['https://cdn.bootcdn.net/ajax/libs/leaflet/1.8.0/leaflet.min.css']
18
+ // scripts: ['/statics/libs/map/leaflet/leaflet.min.js'],
21
19
  // styles: ['/statics/libs/map/leaflet/leaflet.min.css'],
22
-
23
20
  }, {
24
- scripts: ['https://cdn.bootcdn.net/ajax/libs/leaflet.markercluster/1.5.3/leaflet.markercluster.min.js' // '/statics/libs/map/leaflet/echarts-leaflet.js'
21
+ scripts: ['https://cdn.bootcdn.net/ajax/libs/leaflet.markercluster/1.5.3/leaflet.markercluster.min.js'
22
+ // '/statics/libs/map/leaflet/echarts-leaflet.js'
25
23
  // '/statics/libs/map/leaflet/leaflet.markercluster.js'
26
24
  ],
27
- styles: ['https://cdn.bootcdn.net/ajax/libs/leaflet.markercluster/1.5.3/MarkerCluster.min.css', 'https://cdn.bootcdn.net/ajax/libs/leaflet.markercluster/1.5.3/MarkerCluster.Default.min.css' // '/statics/libs/map/leaflet/MarkerCluster.css'
25
+
26
+ styles: ['https://cdn.bootcdn.net/ajax/libs/leaflet.markercluster/1.5.3/MarkerCluster.min.css', 'https://cdn.bootcdn.net/ajax/libs/leaflet.markercluster/1.5.3/MarkerCluster.Default.min.css'
27
+ // '/statics/libs/map/leaflet/MarkerCluster.css'
28
28
  // '/statics/libs/map/leaflet/MarkerCluster.Default.css'
29
29
  ]
30
30
  }];
31
+
31
32
  var AMAP_SCRIPTS = [{
32
33
  scripts: ['https://webapi.amap.com/maps?v=2.0&key=2232e46c0b578b711e6e9851cb92dbfe']
33
34
  }];
34
-
35
35
  function EmptyParent(_ref) {
36
36
  var children = _ref.children;
37
37
  return /*#__PURE__*/_jsx(_Fragment, {
38
38
  children: children
39
39
  });
40
40
  }
41
-
42
41
  function LoaderMap(_ref2) {
43
42
  var children = _ref2.children,
44
- MAP_GLABAL_KEY = _ref2.MAP_GLABAL_KEY,
45
- props = _objectWithoutProperties(_ref2, _excluded);
46
-
43
+ MAP_GLABAL_KEY = _ref2.MAP_GLABAL_KEY,
44
+ props = _objectWithoutProperties(_ref2, _excluded);
47
45
  var glaobalKey = useMemo(function () {
48
46
  return MAP_GLABAL_KEY ? MAP_GLABAL_KEY : Config.BSConfig.MAP_GLABAL_KEY || 'L';
49
47
  }, [MAP_GLABAL_KEY]);
@@ -67,7 +65,6 @@ function LoaderMap(_ref2) {
67
65
  }))
68
66
  });
69
67
  }
70
-
71
68
  LoaderMap.defaultProps = {
72
69
  MAP_GLABAL_KEY: 'AMap'
73
70
  };
@@ -1,40 +1,30 @@
1
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
-
3
2
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
-
5
3
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
-
7
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
-
9
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
-
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ 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; } }
11
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
-
13
7
  import React, { useEffect, useState } from 'react';
14
8
  import MapDrawSelect from "./index";
15
9
  import deviceList from "../points.json";
16
10
  import { jsx as _jsx } from "react/jsx-runtime";
17
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
18
-
19
12
  var App = function App() {
20
13
  var _useState = useState([]),
21
- _useState2 = _slicedToArray(_useState, 2),
22
- points = _useState2[0],
23
- setPoints = _useState2[1];
24
-
14
+ _useState2 = _slicedToArray(_useState, 2),
15
+ points = _useState2[0],
16
+ setPoints = _useState2[1];
25
17
  var _useState3 = useState(),
26
- _useState4 = _slicedToArray(_useState3, 2),
27
- type = _useState4[0],
28
- setType = _useState4[1];
29
-
18
+ _useState4 = _slicedToArray(_useState3, 2),
19
+ type = _useState4[0],
20
+ setType = _useState4[1];
30
21
  var _useState5 = useState({
31
- zoom: null,
32
- center: null
33
- }),
34
- _useState6 = _slicedToArray(_useState5, 2),
35
- state = _useState6[0],
36
- setState = _useState6[1];
37
-
22
+ zoom: null,
23
+ center: null
24
+ }),
25
+ _useState6 = _slicedToArray(_useState5, 2),
26
+ state = _useState6[0],
27
+ setState = _useState6[1];
38
28
  useEffect(function () {
39
29
  setTimeout(function () {
40
30
  setPoints(deviceList);
@@ -86,5 +76,4 @@ var App = function App() {
86
76
  })
87
77
  });
88
78
  };
89
-
90
79
  export default App;
@@ -9,42 +9,37 @@ import withMap from "../withMap";
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  import { Fragment as _Fragment } from "react/jsx-runtime";
11
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
-
13
12
  function MapDrawSelect(_ref) {
14
13
  var center = _ref.center,
15
- zoom = _ref.zoom,
16
- points = _ref.points,
17
- children = _ref.children,
18
- drawUi = _ref.drawUi,
19
- drawType = _ref.drawType,
20
- selectCenter = _ref.selectCenter,
21
- drawEnd = _ref.drawEnd,
22
- onPointClick = _ref.onPointClick;
23
-
14
+ zoom = _ref.zoom,
15
+ points = _ref.points,
16
+ children = _ref.children,
17
+ drawUi = _ref.drawUi,
18
+ drawType = _ref.drawType,
19
+ selectCenter = _ref.selectCenter,
20
+ drawEnd = _ref.drawEnd,
21
+ onPointClick = _ref.onPointClick;
24
22
  var _useContext = useContext(mapContext),
25
- instance = _useContext.instance; // eslint-disable-next-line react-hooks/exhaustive-deps
26
-
27
-
23
+ instance = _useContext.instance;
24
+ // eslint-disable-next-line react-hooks/exhaustive-deps
28
25
  var defaultCenter = useMemo(function () {
29
26
  return center || instance.config.center;
30
- }, [center]); // eslint-disable-next-line react-hooks/exhaustive-deps
31
-
27
+ }, [center]);
28
+ // eslint-disable-next-line react-hooks/exhaustive-deps
32
29
  var defaultZoom = useMemo(function () {
33
30
  return zoom || instance.config.zoom;
34
- }, [zoom]); // eslint-disable-next-line react-hooks/exhaustive-deps
31
+ }, [zoom]);
35
32
 
33
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36
34
  var mapRest = useCallback(function () {
37
35
  return instance.setZoomAndCenter(defaultZoom, defaultCenter);
38
36
  }, [defaultZoom, defaultCenter]);
39
-
40
37
  _useMount(function () {
41
38
  return mapRest();
42
39
  });
43
-
44
40
  _useUpdateEffect(function () {
45
41
  return instance.setZoomAndCenter(defaultZoom, defaultCenter);
46
42
  }, [defaultZoom, defaultCenter]);
47
-
48
43
  useEffect(function () {
49
44
  if (selectCenter) {
50
45
  instance.setZoomAndCenter(defaultZoom, selectCenter);
@@ -64,5 +59,4 @@ function MapDrawSelect(_ref) {
64
59
  }), children]
65
60
  });
66
61
  }
67
-
68
62
  export default withMap(MapDrawSelect, 'map-draw-select-container');
@@ -1,54 +1,44 @@
1
1
  import _useUpdateEffect from "ahooks/es/useUpdateEffect";
2
- import _nextTick from "@cloud-app-dev/utils/es/nextTick";
3
2
  import React from 'react';
3
+ import nextTick from "../../nextTick";
4
4
  import useMouseTools from "./useMouseTools";
5
5
  import { Fragment as _Fragment } from "react/jsx-runtime";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
-
8
7
  function MouseTool(_ref) {
9
8
  var ui = _ref.ui,
10
- drawType = _ref.drawType,
11
- _ref$points = _ref.points,
12
- points = _ref$points === void 0 ? [] : _ref$points,
13
- drawEnd = _ref.drawEnd;
14
-
9
+ drawType = _ref.drawType,
10
+ _ref$points = _ref.points,
11
+ points = _ref$points === void 0 ? [] : _ref$points,
12
+ drawEnd = _ref.drawEnd;
15
13
  var _useMouseTools = useMouseTools(function (obj) {
16
- var selectPoints = [];
17
-
18
- for (var i = 0; i < points.length; i++) {
19
- var item = points[i];
20
-
21
- if (item.longitude && item.latitude && obj.contains([item.longitude, item.latitude])) {
22
- selectPoints.push(item);
14
+ var selectPoints = [];
15
+ for (var i = 0; i < points.length; i++) {
16
+ var item = points[i];
17
+ if (item.longitude && item.latitude && obj.contains([item.longitude, item.latitude])) {
18
+ selectPoints.push(item);
19
+ }
23
20
  }
24
- }
25
-
26
- _nextTick(function () {
27
- return drawEnd === null || drawEnd === void 0 ? void 0 : drawEnd(selectPoints);
28
- });
29
- }),
30
- draw = _useMouseTools.draw,
31
- close = _useMouseTools.close;
32
-
21
+ nextTick(function () {
22
+ return drawEnd === null || drawEnd === void 0 ? void 0 : drawEnd(selectPoints);
23
+ });
24
+ }),
25
+ draw = _useMouseTools.draw,
26
+ close = _useMouseTools.close;
33
27
  _useUpdateEffect(function () {
34
28
  switch (drawType) {
35
29
  case 'clear':
36
30
  close(true);
37
31
  break;
38
-
39
32
  case 'close':
40
33
  close();
41
34
  break;
42
-
43
35
  default:
44
36
  draw(drawType);
45
37
  break;
46
38
  }
47
39
  }, [drawType]);
48
-
49
40
  return /*#__PURE__*/_jsx(_Fragment, {
50
41
  children: ui
51
42
  });
52
43
  }
53
-
54
44
  export default MouseTool;
@@ -1,40 +1,29 @@
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); }
1
2
  import _useMount from "ahooks/es/useMount";
2
-
3
3
  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; }
4
-
5
4
  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
-
7
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
-
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); }
9
8
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
-
11
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."); }
12
-
13
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); }
14
-
15
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
16
-
17
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
18
-
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(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; } }
19
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
-
21
14
  import { useContext, useEffect, useRef, useState } from 'react';
22
15
  import { mapContext } from "../Context";
23
-
24
16
  function useMouseTools(onDrawEnd) {
25
17
  var _useState = useState({
26
- focusKey: Date.now()
27
- }),
28
- _useState2 = _slicedToArray(_useState, 2),
29
- state = _useState2[0],
30
- setState = _useState2[1];
31
-
18
+ focusKey: Date.now()
19
+ }),
20
+ _useState2 = _slicedToArray(_useState, 2),
21
+ state = _useState2[0],
22
+ setState = _useState2[1];
32
23
  var _useContext = useContext(mapContext),
33
- instance = _useContext.instance;
34
-
24
+ instance = _useContext.instance;
35
25
  var overlayersRef = useRef([]);
36
26
  var mouseRef = useRef(null);
37
-
38
27
  _useMount(function () {
39
28
  var map = instance.map;
40
29
  AMap.plugin(['AMap.MouseTool'], function () {
@@ -46,61 +35,49 @@ function useMouseTools(onDrawEnd) {
46
35
  });
47
36
  });
48
37
  });
49
-
50
38
  useEffect(function () {
51
39
  if (!mouseRef.current) {
52
40
  return undefined;
53
41
  }
54
-
55
42
  var fn = function fn(e) {
56
43
  overlayersRef.current.push(e.obj);
57
44
  onDrawEnd === null || onDrawEnd === void 0 ? void 0 : onDrawEnd(e.obj);
58
45
  };
59
-
60
46
  mouseRef.current.on('draw', fn);
61
47
  return function () {
62
48
  mouseRef.current.off('draw', fn);
63
49
  };
64
50
  }, [onDrawEnd, state.focusKey]);
65
-
66
51
  var draw = function draw(type) {
67
52
  if (!mouseRef.current) {
68
53
  return;
69
54
  }
70
-
71
55
  switch (type) {
72
56
  case 'rect':
73
57
  mouseRef.current.rectangle();
74
58
  break;
75
-
76
59
  case 'polygon':
77
60
  mouseRef.current.polygon();
78
61
  break;
79
-
80
62
  case 'circle':
81
63
  mouseRef.current.circle();
82
64
  }
83
65
  };
84
-
85
66
  var clear = function clear(objs) {
86
67
  objs.forEach(function (obj) {
87
68
  instance.map.remove(obj);
88
69
  });
89
70
  };
90
-
91
71
  var close = function close(ifClear) {
92
72
  if (!mouseRef.current) {
93
73
  return;
94
74
  }
95
-
96
75
  mouseRef.current.close(ifClear);
97
76
  };
98
-
99
77
  return {
100
78
  clear: clear,
101
79
  draw: draw,
102
80
  close: close
103
81
  };
104
82
  }
105
-
106
83
  export default useMouseTools;
@@ -6,16 +6,13 @@ import "../../Player/style/iconfont";
6
6
  import "./index.less";
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
-
10
9
  function ResetTools(_ref) {
11
10
  var onMapReset = _ref.onMapReset,
12
- onMapZoom = _ref.onMapZoom,
13
- _ref$className = _ref.className,
14
- className = _ref$className === void 0 ? '' : _ref$className;
15
-
11
+ onMapZoom = _ref.onMapZoom,
12
+ _ref$className = _ref.className,
13
+ className = _ref$className === void 0 ? '' : _ref$className;
16
14
  var _useContext = useContext(mapContext),
17
- instance = _useContext.instance;
18
-
15
+ instance = _useContext.instance;
19
16
  var mapReset = useCallback(function () {
20
17
  return onMapReset ? onMapReset() : instance.mapReset();
21
18
  }, []);
@@ -67,5 +64,4 @@ function ResetTools(_ref) {
67
64
  })]
68
65
  });
69
66
  }
70
-
71
67
  export default ResetTools;
@@ -10,30 +10,24 @@ import "./index.less";
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
  import { Fragment as _Fragment } from "react/jsx-runtime";
12
12
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
-
14
13
  function SinglePoint(_ref) {
15
14
  var center = _ref.center,
16
- points = _ref.points,
17
- onCenterChange = _ref.onCenterChange,
18
- enableClick = _ref.enableClick,
19
- title = _ref.title,
20
- children = _ref.children;
21
-
15
+ points = _ref.points,
16
+ onCenterChange = _ref.onCenterChange,
17
+ enableClick = _ref.enableClick,
18
+ title = _ref.title,
19
+ children = _ref.children;
22
20
  var _useContext = useContext(mapContext),
23
- instance = _useContext.instance;
24
-
21
+ instance = _useContext.instance;
25
22
  var mapRest = useCallback(function () {
26
23
  return instance.setZoomAndCenter(instance.config.zoom, center !== null && center !== void 0 ? center : instance.config.center);
27
24
  }, [center, instance]);
28
-
29
25
  _useMount(function () {
30
26
  if (enableClick) {
31
27
  instance.setCursor('pointer');
32
28
  }
33
-
34
29
  mapRest();
35
30
  });
36
-
37
31
  useMapEvent('click', function (event) {
38
32
  if (enableClick) {
39
33
  var _center = [event.lnglat.lng, event.lnglat.lat];
@@ -60,5 +54,4 @@ function SinglePoint(_ref) {
60
54
  }), children]
61
55
  });
62
56
  }
63
-
64
57
  export default withMap(SinglePoint, 'single-point-map-container');
@@ -1,23 +1,19 @@
1
1
  import _useLatest from "ahooks/es/useLatest";
2
2
  import { useContext, useEffect } from 'react';
3
3
  import { mapContext } from "../Context";
4
-
5
4
  function useMapEvent(type, fn) {
6
5
  var fnRef = _useLatest(fn);
7
-
8
6
  var _useContext = useContext(mapContext),
9
- instance = _useContext.instance;
10
-
7
+ instance = _useContext.instance;
11
8
  useEffect(function () {
12
9
  var eventAction = function eventAction(event) {
13
10
  fnRef.current(event);
14
11
  };
15
-
16
12
  instance.on(type, eventAction);
17
13
  return function () {
18
14
  return instance.off(type, eventAction);
19
- }; // eslint-disable-next-line react-hooks/exhaustive-deps
15
+ };
16
+ // eslint-disable-next-line react-hooks/exhaustive-deps
20
17
  }, [instance, type]);
21
18
  }
22
-
23
19
  export default useMapEvent;