@cloud-app-dev/vidc 3.0.26 → 3.0.28

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.
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import type { IDynamicListProps } from './interface';
3
3
  import './index.less';
4
- declare function DynamicDeviceList<T>({ renderItem, itemHeight, itemClassName, reloadDeps, loadPage }: IDynamicListProps<T>): JSX.Element;
5
- declare namespace DynamicDeviceList {
4
+ declare function DynamicList<T>({ renderItem, itemHeight, itemClassName, reloadDeps, loadPage }: IDynamicListProps<T>): JSX.Element;
5
+ declare namespace DynamicList {
6
6
  var defaultProps: {
7
7
  limit: number;
8
8
  itemHeight: number;
@@ -11,4 +11,4 @@ declare namespace DynamicDeviceList {
11
11
  itemClassName: string;
12
12
  };
13
13
  }
14
- export default DynamicDeviceList;
14
+ export default DynamicList;
@@ -20,7 +20,7 @@ import { LIMIT, skeletonList } from './utils';
20
20
  import useInfiniteScroll from '../../useInfiniteScroll';
21
21
  import "./index.css";
22
22
 
23
- function DynamicDeviceList(_ref) {
23
+ function DynamicList(_ref) {
24
24
  var renderItem = _ref.renderItem,
25
25
  itemHeight = _ref.itemHeight,
26
26
  itemClassName = _ref.itemClassName,
@@ -95,11 +95,11 @@ function DynamicDeviceList(_ref) {
95
95
  })));
96
96
  }
97
97
 
98
- DynamicDeviceList.defaultProps = {
98
+ DynamicList.defaultProps = {
99
99
  limit: LIMIT,
100
100
  itemHeight: 40,
101
101
  params: {},
102
102
  itemKey: 'id',
103
103
  itemClassName: ''
104
104
  };
105
- export default DynamicDeviceList;
105
+ export default DynamicList;
@@ -4,6 +4,7 @@ export interface IDragMarkerProps {
4
4
  onChange?: (options: {
5
5
  center: [number, number];
6
6
  }) => void;
7
+ title?: string;
7
8
  }
8
- declare function DragMarker({ center, onChange }: IDragMarkerProps): JSX.Element;
9
+ declare function DragMarker({ center, title, onChange }: IDragMarkerProps): JSX.Element;
9
10
  export default DragMarker;
@@ -6,6 +6,7 @@ import useMapType from '../../hook/useMapType';
6
6
 
7
7
  function DragMarker(_ref) {
8
8
  var center = _ref.center,
9
+ title = _ref.title,
9
10
  onChange = _ref.onChange;
10
11
 
11
12
  var _useContext = useContext(mapContext),
@@ -17,7 +18,8 @@ function DragMarker(_ref) {
17
18
  center: center,
18
19
  createIcon: createMapCenterIcon,
19
20
  options: {
20
- draggable: true
21
+ draggable: true,
22
+ title: title
21
23
  }
22
24
  });
23
25
  useEffect(function () {
@@ -10,23 +10,33 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
10
10
 
11
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
 
13
- import React, { useState } from 'react';
13
+ import React, { useEffect, useState } from 'react';
14
14
  import MapDrawSelect from './index';
15
15
  import deviceList from '../points.json';
16
16
 
17
17
  var App = function App() {
18
- var _useState = useState(),
18
+ var _useState = useState([]),
19
19
  _useState2 = _slicedToArray(_useState, 2),
20
- type = _useState2[0],
21
- setType = _useState2[1];
20
+ points = _useState2[0],
21
+ setPoints = _useState2[1];
22
22
 
23
+ var _useState3 = useState(),
24
+ _useState4 = _slicedToArray(_useState3, 2),
25
+ type = _useState4[0],
26
+ setType = _useState4[1];
27
+
28
+ useEffect(function () {
29
+ setTimeout(function () {
30
+ return setPoints(deviceList);
31
+ }, 5000);
32
+ }, []);
23
33
  return /*#__PURE__*/React.createElement("div", {
24
34
  style: {
25
35
  width: '100%',
26
36
  height: 800
27
37
  }
28
38
  }, /*#__PURE__*/React.createElement(MapDrawSelect, {
29
- points: deviceList,
39
+ points: points,
30
40
  drawEnd: console.log,
31
41
  drawType: type,
32
42
  drawUi: /*#__PURE__*/React.createElement("div", {
@@ -8,6 +8,7 @@ export interface IMapDrawSelectProps {
8
8
  children?: React.ReactNode;
9
9
  drawUi?: React.ReactNode;
10
10
  drawType?: DrawType | 'clear' | 'close';
11
+ selectCenter?: [number, number];
11
12
  drawEnd?: (points: MapPoint[]) => void;
12
13
  onPointClick?: (point: MapPoint) => void;
13
14
  }
@@ -1,5 +1,5 @@
1
1
  import _useMount from "ahooks/es/useMount";
2
- import React, { useCallback, useContext, useMemo } from 'react';
2
+ import React, { useCallback, useContext, useEffect, useMemo } from 'react';
3
3
  import ClusterLayer from '../ClusterLayer';
4
4
  import ResetTools from '../ResetTools';
5
5
  import withMap from '../withMap';
@@ -14,6 +14,7 @@ function MapDrawSelect(_ref) {
14
14
  children = _ref.children,
15
15
  drawUi = _ref.drawUi,
16
16
  drawType = _ref.drawType,
17
+ selectCenter = _ref.selectCenter,
17
18
  drawEnd = _ref.drawEnd,
18
19
  onPointClick = _ref.onPointClick;
19
20
 
@@ -35,6 +36,11 @@ function MapDrawSelect(_ref) {
35
36
  return mapRest();
36
37
  });
37
38
 
39
+ useEffect(function () {
40
+ if (selectCenter) {
41
+ instance.setZoomAndCenter(defaultZoom, selectCenter);
42
+ }
43
+ }, [defaultZoom, instance, selectCenter]);
38
44
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ClusterLayer, {
39
45
  points: points,
40
46
  onPointClick: onPointClick
@@ -1,5 +1,5 @@
1
1
  import _useMount from "ahooks/es/useMount";
2
- import { useContext, useRef } from 'react';
2
+ import { useContext, useEffect, useRef } from 'react';
3
3
  import { mapContext } from '../Context';
4
4
 
5
5
  function useMouseTools(onDrawEnd) {
@@ -13,13 +13,21 @@ function useMouseTools(onDrawEnd) {
13
13
  var map = instance.map;
14
14
  AMap.plugin(['AMap.MouseTool'], function () {
15
15
  mouseRef.current = new AMap.MouseTool(map);
16
- mouseRef.current.on('draw', function (e) {
17
- overlayersRef.current.push(e.obj);
18
- onDrawEnd === null || onDrawEnd === void 0 ? void 0 : onDrawEnd(e.obj);
19
- });
20
16
  });
21
17
  });
22
18
 
19
+ useEffect(function () {
20
+ var fn = function fn(e) {
21
+ overlayersRef.current.push(e.obj);
22
+ onDrawEnd === null || onDrawEnd === void 0 ? void 0 : onDrawEnd(e.obj);
23
+ };
24
+
25
+ mouseRef.current.on('draw', fn);
26
+ return function () {
27
+ mouseRef.current.off('draw', fn);
28
+ };
29
+ }, [onDrawEnd]);
30
+
23
31
  var draw = function draw(type) {
24
32
  if (!mouseRef.current) {
25
33
  return;
@@ -2,9 +2,22 @@ import React from 'react';
2
2
  import { MapPoint } from '../interface';
3
3
  import './index.less';
4
4
  export interface ISinglePlayerProps {
5
+ /**
6
+ * 点位经纬度
7
+ */
5
8
  center?: [number, number];
9
+ /**
10
+ * 展示标题
11
+ */
12
+ title?: string;
6
13
  points: MapPoint[];
14
+ /**
15
+ * 开启点击设置
16
+ */
7
17
  enableClick?: boolean;
18
+ /**
19
+ * 中心点变化
20
+ */
8
21
  onCenterChange?: (options: {
9
22
  center: [number, number];
10
23
  }) => void;
@@ -13,14 +13,15 @@ function SinglePoint(_ref) {
13
13
  points = _ref.points,
14
14
  onCenterChange = _ref.onCenterChange,
15
15
  enableClick = _ref.enableClick,
16
+ title = _ref.title,
16
17
  children = _ref.children;
17
18
 
18
19
  var _useContext = useContext(mapContext),
19
20
  instance = _useContext.instance;
20
21
 
21
22
  var mapRest = useCallback(function () {
22
- return instance.setZoomAndCenter(instance.config.zoom, instance.config.center);
23
- }, [instance]);
23
+ return instance.setZoomAndCenter(instance.config.zoom, center !== null && center !== void 0 ? center : instance.config.center);
24
+ }, [center, instance]);
24
25
 
25
26
  _useMount(function () {
26
27
  if (enableClick) {
@@ -44,6 +45,7 @@ function SinglePoint(_ref) {
44
45
  }), /*#__PURE__*/React.createElement(ResetTools, {
45
46
  onMapReset: mapRest
46
47
  }), /*#__PURE__*/React.createElement(DragMarker, {
48
+ title: title,
47
49
  center: center,
48
50
  onChange: function onChange(_ref2) {
49
51
  var center = _ref2.center;
@@ -39,7 +39,9 @@ function useInfiniteScroll(fetcher, options) {
39
39
  }, [state.data]);
40
40
 
41
41
  var loadMore = function loadMore(flag) {
42
- if (noMore) {
42
+ var _a;
43
+
44
+ if (!flag && ((_a = isNoMore === null || isNoMore === void 0 ? void 0 : isNoMore(state.data)) !== null && _a !== void 0 ? _a : false)) {
43
45
  return;
44
46
  }
45
47
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "private": false,
3
3
  "name": "@cloud-app-dev/vidc",
4
4
  "description": "Video Image Data Componennts",
5
- "version": "3.0.26",
5
+ "version": "3.0.28",
6
6
  "scripts": {
7
7
  "start": "dumi dev",
8
8
  "docs:build": "dumi build",