@cloud-app-dev/vidc 3.1.16 → 3.1.17

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 (153) hide show
  1. package/es/Api/index.js +0 -23
  2. package/es/AppContext/Sync.js +1 -15
  3. package/es/AppContext/index.js +21 -52
  4. package/es/AppContext/static.js +0 -7
  5. package/es/Auth/index.js +2 -5
  6. package/es/AutoExit/index.js +1 -5
  7. package/es/Box/BetweenBox/index.js +6 -8
  8. package/es/Box/InfoBox/index.js +6 -8
  9. package/es/Box/TwoColumnBox/index.js +8 -18
  10. package/es/Box/deps/grid-factory.js +0 -12
  11. package/es/Box/index.js +4 -6
  12. package/es/CheckGroupFixed/index.js +19 -34
  13. package/es/Config/index.js +0 -4
  14. package/es/Config/utils.js +3 -18
  15. package/es/ConfigContext/index.js +1 -3
  16. package/es/CustomRenderSelect/index.js +13 -29
  17. package/es/DisableMark/index.js +2 -2
  18. package/es/DomMove/index.js +24 -37
  19. package/es/DomMove/utils.js +3 -8
  20. package/es/Drag/DragAndDropItem.js +19 -37
  21. package/es/Drag/DropItem.js +5 -15
  22. package/es/Drawer/Demo.js +3 -17
  23. package/es/Drawer/Footer.js +3 -5
  24. package/es/Drawer/index.js +28 -50
  25. package/es/ErrorFallback/index.js +1 -3
  26. package/es/FullScreen/index.js +8 -18
  27. package/es/HightLevel/index.js +1 -5
  28. package/es/IconFont/index.js +5 -11
  29. package/es/ImageView/index.js +8 -20
  30. package/es/Input/index.js +14 -27
  31. package/es/InstanceHistory/index.js +0 -2
  32. package/es/LabelValue/index.js +8 -10
  33. package/es/List/DynamicGridList/Demo.js +0 -11
  34. package/es/List/DynamicGridList/index.js +16 -25
  35. package/es/List/DynamicList/index.js +23 -38
  36. package/es/List/GridList/Demo.js +3 -16
  37. package/es/List/GridList/hook.js +34 -65
  38. package/es/List/GridList/utils.js +0 -1
  39. package/es/List/VList/index.js +10 -20
  40. package/es/List/VList/utils.js +2 -3
  41. package/es/List/index.js +5 -7
  42. package/es/LoaderApp/index.js +5 -22
  43. package/es/LoaderApp/loader.js +5 -13
  44. package/es/LoaderApp/sandbox.back.js +16 -81
  45. package/es/LoaderApp/sandbox.js +8 -22
  46. package/es/LoaderApp/utils.js +20 -49
  47. package/es/LoaderScript/index.js +8 -19
  48. package/es/LoaderScript/utils.js +0 -51
  49. package/es/Map/BasicMap/AMapInstance.js +0 -10
  50. package/es/Map/BasicMap/LeafletInstance.js +11 -20
  51. package/es/Map/BasicMap/index.js +6 -28
  52. package/es/Map/ClusterLayer/hook.js +10 -32
  53. package/es/Map/ClusterLayer/index.js +2 -6
  54. package/es/Map/Config/index.js +8 -21
  55. package/es/Map/Config/utils.js +0 -6
  56. package/es/Map/Context/index.js +2 -22
  57. package/es/Map/FindPio/index.js +0 -2
  58. package/es/Map/InfoWindow/MakerLikeWindow.js +9 -28
  59. package/es/Map/InfoWindow/demo.js +5 -22
  60. package/es/Map/InfoWindow/index.js +13 -29
  61. package/es/Map/LevelCenter/DragMarker/index.js +5 -9
  62. package/es/Map/LevelCenter/demo.js +6 -16
  63. package/es/Map/LevelCenter/index.js +8 -15
  64. package/es/Map/LoaderMap/index.js +10 -10
  65. package/es/Map/MapDrawSelect/demo.js +12 -23
  66. package/es/Map/MapDrawSelect/index.js +14 -21
  67. package/es/Map/MouseTool/index.js +16 -26
  68. package/es/Map/MouseTool/useMouseTools.js +6 -29
  69. package/es/Map/ResetTools/index.js +4 -8
  70. package/es/Map/SinglePoint/index.js +6 -13
  71. package/es/Map/hook/useMapEvent.js +3 -7
  72. package/es/Map/hook/useMapType.js +1 -2
  73. package/es/Map/useMarker/index.js +10 -24
  74. package/es/Map/withMap/index.js +0 -2
  75. package/es/Modal/index.d.ts +1 -1
  76. package/es/Modal/index.js +29 -50
  77. package/es/Picture/component/DefaultRects/RectInfo.js +11 -25
  78. package/es/Picture/component/DefaultRects/index.js +3 -5
  79. package/es/Picture/component/DrawRect/index.js +6 -8
  80. package/es/Picture/component/RectMenu/index.js +10 -16
  81. package/es/Picture/component/RectMenu/utils.js +3 -6
  82. package/es/Picture/component/Tools/index.js +6 -8
  83. package/es/Picture/component/WheelScale/index.js +3 -6
  84. package/es/Picture/dragBound.js +4 -17
  85. package/es/Picture/index.js +46 -87
  86. package/es/Picture/loadCaptureRectImage.js +10 -26
  87. package/es/Picture/useDraw.js +20 -39
  88. package/es/Picture/utils.js +2 -11
  89. package/es/Player/api/index.js +14 -78
  90. package/es/Player/context.js +1 -2
  91. package/es/Player/contraller_bar/bar.js +5 -9
  92. package/es/Player/contraller_bar/contraller_event.js +5 -23
  93. package/es/Player/contraller_bar/index.js +7 -9
  94. package/es/Player/contraller_bar/left_bar.js +15 -27
  95. package/es/Player/contraller_bar/right_bar.js +7 -18
  96. package/es/Player/contraller_bar/time.js +6 -16
  97. package/es/Player/contraller_bar/useBarStatus.js +5 -16
  98. package/es/Player/contraller_bar/volume.js +6 -26
  99. package/es/Player/demo.js +59 -75
  100. package/es/Player/event/errorEvent.js +14 -39
  101. package/es/Player/event/eventName.js +1 -1
  102. package/es/Player/event/index.js +19 -53
  103. package/es/Player/fps_play.js +10 -27
  104. package/es/Player/frontend_player.js +10 -19
  105. package/es/Player/frontend_timeline.js +25 -47
  106. package/es/Player/iconfont.js +2 -5
  107. package/es/Player/live_heart.js +2 -14
  108. package/es/Player/message.js +9 -29
  109. package/es/Player/segment_player.js +39 -77
  110. package/es/Player/segment_timeline.js +42 -68
  111. package/es/Player/single_player.js +64 -87
  112. package/es/Player/style/iconfont.js +10 -17
  113. package/es/Player/timeline.js +11 -28
  114. package/es/Player/util.js +0 -21
  115. package/es/PlayerExt/demo.js +11 -21
  116. package/es/PlayerExt/index.js +18 -43
  117. package/es/Progress/index.js +3 -15
  118. package/es/ROI/demo.js +0 -2
  119. package/es/ROI/index.js +15 -22
  120. package/es/ScreenPlayer/Live.js +34 -67
  121. package/es/ScreenPlayer/LiveTools.js +21 -38
  122. package/es/ScreenPlayer/PlayerWithExt.js +43 -78
  123. package/es/ScreenPlayer/RatePick.js +1 -3
  124. package/es/ScreenPlayer/Record.js +50 -121
  125. package/es/ScreenPlayer/RecordTools.js +32 -54
  126. package/es/ScreenPlayer/ScreenSelect.js +1 -3
  127. package/es/ScreenPlayer/SegmentTimeLine.js +8 -12
  128. package/es/ScreenPlayer/TimeMode.js +1 -3
  129. package/es/ScreenPlayer/TimeSelect.js +11 -26
  130. package/es/ScreenPlayer/demo.js +3 -1
  131. package/es/ScreenPlayer/demo2.js +9 -24
  132. package/es/ScreenPlayer/useRecordList.js +7 -72
  133. package/es/ScreenPlayer/useTimeSlider.js +40 -132
  134. package/es/ScreenPlayer/useVideoFit.js +5 -18
  135. package/es/ScreenPlayer/utils.js +0 -8
  136. package/es/Service/fetch-adapter.js +2 -37
  137. package/es/Service/http.js +8 -27
  138. package/es/TableLayout/index.js +3 -7
  139. package/es/ThemeAntd/demo.js +0 -2
  140. package/es/Timeout/index.js +10 -26
  141. package/es/Tree/demo.js +0 -2
  142. package/es/Tree/index.js +14 -21
  143. package/es/useDrawROI/index.js +51 -105
  144. package/es/useEventEmitterHandle/index.js +2 -6
  145. package/es/useFullscreen/demo.js +6 -16
  146. package/es/useFullscreen/index.js +5 -25
  147. package/es/useHistory/index.js +0 -2
  148. package/es/useInfiniteScroll/index.js +14 -39
  149. package/es/useRafInterval/index.js +2 -26
  150. package/es/useSimpleState/index.js +5 -16
  151. package/es/useVirtualList/index.js +19 -57
  152. package/es/utils.js +0 -28
  153. package/package.json +1 -1
@@ -1,79 +1,55 @@
1
1
  import _useLatest from "ahooks/es/useLatest";
2
-
3
2
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
-
5
3
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
-
7
4
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
-
9
5
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
10
-
11
6
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12
-
13
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; }
14
-
15
8
  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); }
16
-
17
9
  import { useCallback, useEffect, useRef } from 'react';
18
10
  import { isNumber } from 'lodash-es';
19
-
20
11
  var setRafInterval = function setRafInterval(callback) {
21
12
  var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
22
-
23
13
  if ((typeof requestAnimationFrame === "undefined" ? "undefined" : _typeof(requestAnimationFrame)) === (typeof undefined === "undefined" ? "undefined" : _typeof(undefined))) {
24
14
  return {
25
15
  id: setInterval(callback, delay)
26
16
  };
27
17
  }
28
-
29
18
  var start = new Date().getTime();
30
19
  var handle = {
31
20
  id: 0
32
21
  };
33
-
34
22
  var loop = function loop() {
35
23
  var current = new Date().getTime();
36
-
37
24
  if (current - start >= delay) {
38
25
  callback();
39
26
  start = new Date().getTime();
40
27
  }
41
-
42
28
  handle.id = requestAnimationFrame(loop);
43
29
  };
44
-
45
30
  handle.id = requestAnimationFrame(loop);
46
31
  return handle;
47
32
  };
48
-
49
33
  function cancelAnimationFrameIsNotDefined(t) {
50
34
  return (typeof cancelAnimationFrame === "undefined" ? "undefined" : _typeof(cancelAnimationFrame)) === (typeof undefined === "undefined" ? "undefined" : _typeof(undefined));
51
35
  }
52
-
53
36
  var clearRafInterval = function clearRafInterval(handle) {
54
37
  if (cancelAnimationFrameIsNotDefined(handle.id)) {
55
38
  return clearInterval(handle.id);
56
39
  }
57
-
58
40
  cancelAnimationFrame(handle.id);
59
41
  };
60
-
61
42
  function useRafInterval(fn, delay, options) {
62
43
  var _a;
63
-
64
44
  var immediate = options === null || options === void 0 ? void 0 : options.immediate;
65
45
  var deps = (_a = options === null || options === void 0 ? void 0 : options.deps) !== null && _a !== void 0 ? _a : [];
66
-
67
46
  var fnRef = _useLatest(fn);
68
-
69
47
  var timerRef = useRef();
70
48
  useEffect(function () {
71
49
  if (!isNumber(delay) || delay < 0) return undefined;
72
-
73
50
  if (immediate) {
74
51
  fnRef.current();
75
52
  }
76
-
77
53
  timerRef.current = setRafInterval(function () {
78
54
  fnRef.current();
79
55
  }, delay);
@@ -81,7 +57,8 @@ function useRafInterval(fn, delay, options) {
81
57
  if (timerRef.current) {
82
58
  clearRafInterval(timerRef.current);
83
59
  }
84
- }; // eslint-disable-next-line react-hooks/exhaustive-deps
60
+ };
61
+ // eslint-disable-next-line react-hooks/exhaustive-deps
85
62
  }, [delay].concat(_toConsumableArray(deps)));
86
63
  var clear = useCallback(function () {
87
64
  if (timerRef.current) {
@@ -90,5 +67,4 @@ function useRafInterval(fn, delay, options) {
90
67
  }, []);
91
68
  return clear;
92
69
  }
93
-
94
70
  export default useRafInterval;
@@ -1,34 +1,24 @@
1
1
  import _useMemoizedFn from "ahooks/es/useMemoizedFn";
2
2
  import _useSafeState3 from "ahooks/es/useSafeState";
3
-
4
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5
-
6
4
  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."); }
7
-
8
5
  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); }
9
-
10
6
  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
-
12
7
  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; }
13
-
14
8
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
-
16
9
  import { isFunction, isObjectLike } from 'lodash-es';
17
10
  import { useMemo } from 'react';
18
-
19
11
  function useSimpleState(s) {
20
12
  var _useSafeState = _useSafeState3(s),
21
- _useSafeState2 = _slicedToArray(_useSafeState, 2),
22
- state = _useSafeState2[0],
23
- setState = _useSafeState2[1];
24
-
13
+ _useSafeState2 = _slicedToArray(_useSafeState, 2),
14
+ state = _useSafeState2[0],
15
+ setState = _useSafeState2[1];
25
16
  var stateChange = _useMemoizedFn(function (d) {
26
17
  return setState(function (old) {
27
18
  return Object.assign(Object.assign({}, old), d);
28
19
  });
29
- }); // eslint-disable-next-line react-hooks/exhaustive-deps
30
-
31
-
20
+ });
21
+ // eslint-disable-next-line react-hooks/exhaustive-deps
32
22
  var isObject = useMemo(function () {
33
23
  return isObjectLike(s) || isFunction(s);
34
24
  }, []);
@@ -37,5 +27,4 @@ function useSimpleState(s) {
37
27
  }, [isObject, setState, state, stateChange]);
38
28
  return result;
39
29
  }
40
-
41
30
  export default useSimpleState;
@@ -2,134 +2,103 @@ import _useMemoizedFn from "ahooks/es/useMemoizedFn";
2
2
  import _useEventListener from "ahooks/es/useEventListener";
3
3
  import _useSize from "ahooks/es/useSize";
4
4
  import _useLatest from "ahooks/es/useLatest";
5
-
6
5
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
-
8
6
  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
-
10
7
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
-
12
8
  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
-
14
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; }
15
-
16
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
-
18
11
  import { useEffect, useMemo, useState, useRef, useLayoutEffect } from 'react';
19
12
  import { getTargetElement } from 'ahooks/es/utils/domTarget';
20
13
  import { isNumber } from 'ahooks/es/utils';
21
-
22
14
  var useVirtualList = function useVirtualList(list, options) {
23
15
  var containerTarget = options.containerTarget,
24
- wrapperTarget = options.wrapperTarget,
25
- itemHeight = options.itemHeight,
26
- _options$overscan = options.overscan,
27
- overscan = _options$overscan === void 0 ? 5 : _options$overscan;
28
-
16
+ wrapperTarget = options.wrapperTarget,
17
+ itemHeight = options.itemHeight,
18
+ _options$overscan = options.overscan,
19
+ overscan = _options$overscan === void 0 ? 5 : _options$overscan;
29
20
  var itemHeightRef = _useLatest(itemHeight);
30
-
31
21
  var size = _useSize(containerTarget);
32
-
33
22
  var scrollTriggerByScrollToFunc = useRef(false);
34
-
35
23
  var _useState = useState([]),
36
- _useState2 = _slicedToArray(_useState, 2),
37
- targetList = _useState2[0],
38
- setTargetList = _useState2[1];
39
-
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ targetList = _useState2[0],
26
+ setTargetList = _useState2[1];
40
27
  var _useState3 = useState(0),
41
- _useState4 = _slicedToArray(_useState3, 2),
42
- offsetTop = _useState4[0],
43
- setOffsetTop = _useState4[1];
44
-
28
+ _useState4 = _slicedToArray(_useState3, 2),
29
+ offsetTop = _useState4[0],
30
+ setOffsetTop = _useState4[1];
45
31
  var getVisibleCount = function getVisibleCount(containerHeight, fromIndex) {
46
32
  if (isNumber(itemHeightRef.current)) {
47
33
  return Math.ceil(containerHeight / itemHeightRef.current);
48
34
  }
49
-
50
35
  var sum = 0;
51
36
  var endIndex = 0;
52
-
53
37
  for (var i = fromIndex; i < list.length; i++) {
54
38
  var height = itemHeightRef.current(i, list[i]);
55
39
  sum += height;
56
40
  endIndex = i;
57
-
58
41
  if (sum >= containerHeight) {
59
42
  break;
60
43
  }
61
44
  }
62
-
63
45
  return endIndex - fromIndex;
64
46
  };
65
-
66
47
  var getOffset = function getOffset(scrollTop) {
67
48
  if (isNumber(itemHeightRef.current)) {
68
49
  return Math.floor(scrollTop / itemHeightRef.current) + 1;
69
50
  }
70
-
71
51
  var sum = 0;
72
52
  var offset = 0;
73
-
74
53
  for (var i = 0; i < list.length; i++) {
75
54
  var height = itemHeightRef.current(i, list[i]);
76
55
  sum += height;
77
-
78
56
  if (sum >= scrollTop) {
79
57
  offset = i;
80
58
  break;
81
59
  }
82
60
  }
83
-
84
61
  return offset + 1;
85
- }; // 获取上部高度
86
-
87
-
62
+ };
63
+ // 获取上部高度
88
64
  var getDistanceTop = function getDistanceTop(index) {
89
65
  if (isNumber(itemHeightRef.current)) {
90
66
  var _height = index * itemHeightRef.current;
91
-
92
67
  return _height;
93
68
  }
94
-
95
69
  var height = list.slice(0, index).reduce(function (sum, _, i) {
96
70
  return sum + itemHeightRef.current(i, list[i]);
97
71
  }, 0);
98
72
  return height;
99
73
  };
100
-
101
74
  var totalHeight = useMemo(function () {
102
75
  if (isNumber(itemHeightRef.current)) {
103
76
  return list.length * itemHeightRef.current;
104
77
  }
105
-
106
78
  return list.reduce(function (sum, _, index) {
107
79
  return sum + itemHeightRef.current(index, list[index]);
108
- }, 0); // eslint-disable-next-line react-hooks/exhaustive-deps
80
+ }, 0);
81
+ // eslint-disable-next-line react-hooks/exhaustive-deps
109
82
  }, [list]);
110
83
  useLayoutEffect(function () {
111
84
  var wrapper = getTargetElement(wrapperTarget);
112
85
  wrapper.style.height = totalHeight - offsetTop + 'px';
113
86
  wrapper.style.marginTop = offsetTop + 'px';
114
87
  }, [totalHeight, wrapperTarget, offsetTop]);
115
-
116
88
  var calculateRange = function calculateRange() {
117
89
  var container = getTargetElement(containerTarget);
118
90
  var wrapper = getTargetElement(wrapperTarget);
119
-
120
91
  if (container && wrapper) {
121
92
  var scrollTop = container.scrollTop,
122
- clientHeight = container.clientHeight;
93
+ clientHeight = container.clientHeight;
123
94
  var offset = getOffset(scrollTop);
124
95
  var visibleCount = getVisibleCount(clientHeight, offset);
125
96
  var start = Math.max(0, offset - overscan);
126
97
  var end = Math.min(list.length, offset + visibleCount + overscan);
127
-
128
98
  var _offsetTop = getDistanceTop(start);
129
-
130
- setOffsetTop(_offsetTop); // wrapper.style.height = totalHeight - offsetTop + 'px';
99
+ setOffsetTop(_offsetTop);
100
+ // wrapper.style.height = totalHeight - offsetTop + 'px';
131
101
  // wrapper.style.marginTop = offsetTop + 'px';
132
-
133
102
  setTargetList(list.slice(start, end).map(function (ele, index) {
134
103
  return {
135
104
  data: ele,
@@ -138,38 +107,31 @@ var useVirtualList = function useVirtualList(list, options) {
138
107
  }));
139
108
  }
140
109
  };
141
-
142
110
  useEffect(function () {
143
111
  if (!(size === null || size === void 0 ? void 0 : size.width) || !(size === null || size === void 0 ? void 0 : size.height)) {
144
112
  return;
145
113
  }
146
-
147
- calculateRange(); // eslint-disable-next-line react-hooks/exhaustive-deps
114
+ calculateRange();
115
+ // eslint-disable-next-line react-hooks/exhaustive-deps
148
116
  }, [size === null || size === void 0 ? void 0 : size.width, size === null || size === void 0 ? void 0 : size.height, list]);
149
-
150
117
  _useEventListener('scroll', function (e) {
151
118
  if (scrollTriggerByScrollToFunc.current) {
152
119
  scrollTriggerByScrollToFunc.current = false;
153
120
  return;
154
121
  }
155
-
156
122
  e.preventDefault();
157
123
  calculateRange();
158
124
  }, {
159
125
  target: containerTarget
160
126
  });
161
-
162
127
  var scrollTo = function scrollTo(index) {
163
128
  var container = getTargetElement(containerTarget);
164
-
165
129
  if (container) {
166
130
  scrollTriggerByScrollToFunc.current = true;
167
131
  container.scrollTop = getDistanceTop(index);
168
132
  calculateRange();
169
133
  }
170
134
  };
171
-
172
135
  return [targetList, _useMemoizedFn(scrollTo)];
173
136
  };
174
-
175
137
  export default useVirtualList;
package/es/utils.js CHANGED
@@ -1,9 +1,6 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
-
3
2
  import _cache from "@cloud-app-dev/utils/es/cache";
4
-
5
3
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
6
-
7
4
  import { __awaiter } from "tslib";
8
5
  export var getHeader = function getHeader() {
9
6
  return {
@@ -13,25 +10,20 @@ export var getHeader = function getHeader() {
13
10
  /**
14
11
  * @desc 根据id获取所有父级
15
12
  */
16
-
17
13
  export function getParentListById(id) {
18
14
  var orgList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
19
15
  var list = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
20
16
  var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'id';
21
17
  var pkey = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'parentId';
22
-
23
18
  for (var i = 0, len = orgList.length; i < len; i++) {
24
19
  var item = orgList[i];
25
-
26
20
  if (item[key] === id) {
27
21
  list.push(item);
28
-
29
22
  if (item[pkey]) {
30
23
  getParentListById(item[pkey], orgList, list, key, pkey);
31
24
  }
32
25
  }
33
26
  }
34
-
35
27
  return list;
36
28
  }
37
29
  /**
@@ -39,7 +31,6 @@ export function getParentListById(id) {
39
31
  * @param {string} orgId
40
32
  * @param {Array} ids = []
41
33
  */
42
-
43
34
  export function getPlaceCodesWithParent(areaCode) {
44
35
  var list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
45
36
  var areaCodes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
@@ -48,19 +39,15 @@ export function getPlaceCodesWithParent(areaCode) {
48
39
  var info = list.find(function (v) {
49
40
  return v[key] === areaCode;
50
41
  });
51
-
52
42
  if (info === null || info === void 0 ? void 0 : info.pcodes) {
53
43
  return info.pcodes.reverse();
54
44
  }
55
-
56
45
  if (info) {
57
46
  areaCodes.push(areaCode);
58
-
59
47
  if (info[pkey] && info[pkey] * 1 !== 0) {
60
48
  getPlaceCodesWithParent(info.parentCode, areaCodes, list, key, pkey);
61
49
  }
62
50
  }
63
-
64
51
  return areaCodes;
65
52
  }
66
53
  export function nextTick(cb) {
@@ -76,16 +63,13 @@ export function tryCatch(resolveFn) {
76
63
  _context.prev = 0;
77
64
  _context.next = 3;
78
65
  return resolveFn();
79
-
80
66
  case 3:
81
67
  _context.next = 8;
82
68
  break;
83
-
84
69
  case 5:
85
70
  _context.prev = 5;
86
71
  _context.t0 = _context["catch"](0);
87
72
  rejectFn(_context.t0);
88
-
89
73
  case 8:
90
74
  case "end":
91
75
  return _context.stop();
@@ -98,9 +82,7 @@ export function getTargetElement(target, defaultElement) {
98
82
  if (!target) {
99
83
  return defaultElement;
100
84
  }
101
-
102
85
  var targetElement;
103
-
104
86
  if (typeof target === 'function') {
105
87
  targetElement = target();
106
88
  } else if ('current' in target) {
@@ -108,40 +90,30 @@ export function getTargetElement(target, defaultElement) {
108
90
  } else {
109
91
  targetElement = target;
110
92
  }
111
-
112
93
  return targetElement;
113
94
  }
114
-
115
95
  var getScrollTop = function getScrollTop(el) {
116
96
  if (el === document || el === document.body) {
117
97
  return Math.max(window.pageYOffset, document.documentElement.scrollTop, document.body.scrollTop);
118
98
  }
119
-
120
99
  return el.scrollTop;
121
100
  };
122
-
123
101
  var getScrollHeight = function getScrollHeight(el) {
124
102
  return el.scrollHeight || Math.max(document.documentElement.scrollHeight, document.body.scrollHeight);
125
103
  };
126
-
127
104
  var getClientHeight = function getClientHeight(el) {
128
105
  return el.clientHeight || Math.max(document.documentElement.clientHeight, document.body.clientHeight);
129
106
  };
130
-
131
107
  var getEleScrollHeight = function getEleScrollHeight(el) {
132
108
  if (el === document || el === document.body) {
133
109
  return Math.max(window.pageYOffset, document.documentElement.scrollTop, document.body.scrollTop);
134
110
  }
135
-
136
111
  var top = 0;
137
112
  var dom = el;
138
-
139
113
  while (dom) {
140
114
  top += dom.scrollTop;
141
115
  dom = dom.parentElement;
142
116
  }
143
-
144
117
  return top;
145
118
  };
146
-
147
119
  export { getScrollTop, getScrollHeight, getClientHeight, getEleScrollHeight };
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.1.16",
5
+ "version": "3.1.17",
6
6
  "main": "es/index.js",
7
7
  "module": "es/index.js",
8
8
  "typings": "es/index.d.ts",