@cloud-app-dev/vidc 3.1.15 → 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 +35 -68
  121. package/es/ScreenPlayer/LiveTools.js +24 -37
  122. package/es/ScreenPlayer/PlayerWithExt.js +43 -78
  123. package/es/ScreenPlayer/RatePick.js +1 -3
  124. package/es/ScreenPlayer/Record.js +52 -123
  125. package/es/ScreenPlayer/RecordTools.js +32 -53
  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 +10 -46
  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 +14 -14
@@ -2,21 +2,18 @@ import _useThrottleFn2 from "ahooks/es/useThrottleFn";
2
2
  import moment from 'moment';
3
3
  import React, { useMemo, useRef } from 'react';
4
4
  import useTimeSlider from './useTimeSlider';
5
-
6
5
  function SegmentTimeLine(_ref) {
7
6
  var begin = _ref.begin,
8
- segments = _ref.segments,
9
- onTimeChange = _ref.onTimeChange,
10
- timeMode = _ref.timeMode,
11
- updateState = _ref.updateState,
12
- currentTime = _ref.currentTime;
7
+ segments = _ref.segments,
8
+ onTimeChange = _ref.onTimeChange,
9
+ timeMode = _ref.timeMode,
10
+ updateState = _ref.updateState,
11
+ currentTime = _ref.currentTime;
13
12
  var ref = useRef();
14
-
15
13
  var _useThrottleFn = _useThrottleFn2(onTimeChange, {
16
- wait: 300
17
- }),
18
- run = _useThrottleFn.run;
19
-
14
+ wait: 300
15
+ }),
16
+ run = _useThrottleFn.run;
20
17
  var time = useMemo(function () {
21
18
  return begin !== null && begin !== void 0 ? begin : moment().set({
22
19
  hours: 0,
@@ -42,5 +39,4 @@ function SegmentTimeLine(_ref) {
42
39
  ref: ref
43
40
  }));
44
41
  }
45
-
46
42
  export default SegmentTimeLine;
@@ -2,10 +2,9 @@ import "antd/lib/select/style";
2
2
  import _Select from "antd/lib/select";
3
3
  import React from 'react';
4
4
  import { TimeModeLibs } from './utils';
5
-
6
5
  function TimeMode(_ref) {
7
6
  var timeMode = _ref.timeMode,
8
- onChange = _ref.onChange;
7
+ onChange = _ref.onChange;
9
8
  return /*#__PURE__*/React.createElement(_Select, {
10
9
  value: timeMode,
11
10
  onChange: onChange,
@@ -25,5 +24,4 @@ function TimeMode(_ref) {
25
24
  }, item.name), "\u5C0F\u65F6");
26
25
  }));
27
26
  }
28
-
29
27
  export default TimeMode;
@@ -5,38 +5,28 @@ import _InputNumber from "antd/lib/input-number";
5
5
  import "antd/lib/popover/style";
6
6
  import _Popover from "antd/lib/popover";
7
7
  import _useUpdateEffect from "ahooks/es/useUpdateEffect";
8
-
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
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; }
16
-
17
12
  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
-
19
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
-
21
14
  import React, { useMemo, useState } from 'react';
22
15
  import moment from 'moment';
23
-
24
16
  function TimeSelect(_ref) {
25
17
  var time = _ref.time,
26
- onChange = _ref.onChange;
27
-
18
+ onChange = _ref.onChange;
28
19
  var _useState = useState(function () {
29
- var m = time ? moment(time) : moment().set({
30
- hours: 0,
31
- minutes: 0,
32
- seconds: 0
33
- });
34
- return [m.hours(), m.minutes(), m.seconds()];
35
- }),
36
- _useState2 = _slicedToArray(_useState, 2),
37
- values = _useState2[0],
38
- setValues = _useState2[1];
39
-
20
+ var m = time ? moment(time) : moment().set({
21
+ hours: 0,
22
+ minutes: 0,
23
+ seconds: 0
24
+ });
25
+ return [m.hours(), m.minutes(), m.seconds()];
26
+ }),
27
+ _useState2 = _slicedToArray(_useState, 2),
28
+ values = _useState2[0],
29
+ setValues = _useState2[1];
40
30
  var timeStr = useMemo(function () {
41
31
  var m = time ? moment(time) : moment().set({
42
32
  hours: 0,
@@ -45,7 +35,6 @@ function TimeSelect(_ref) {
45
35
  });
46
36
  return m.format('HH:mm:ss');
47
37
  }, [time]);
48
-
49
38
  var onChangeTime = function onChangeTime() {
50
39
  var m = time ? moment(time) : moment().set({
51
40
  hours: 0,
@@ -59,7 +48,6 @@ function TimeSelect(_ref) {
59
48
  }).valueOf();
60
49
  onChange && onChange(newTime);
61
50
  };
62
-
63
51
  _useUpdateEffect(function () {
64
52
  var m = time ? moment(time) : moment().set({
65
53
  hours: 0,
@@ -68,11 +56,9 @@ function TimeSelect(_ref) {
68
56
  });
69
57
  setValues([m.hours(), m.minutes(), m.seconds()]);
70
58
  }, [time]);
71
-
72
59
  var formatter = function formatter(value) {
73
60
  return String(value).length === 1 ? "0".concat(value) : value + '';
74
61
  };
75
-
76
62
  return /*#__PURE__*/React.createElement(_Popover, {
77
63
  content: /*#__PURE__*/React.createElement("div", {
78
64
  className: "player-time-select"
@@ -124,5 +110,4 @@ function TimeSelect(_ref) {
124
110
  className: "player-record-time"
125
111
  }, timeStr));
126
112
  }
127
-
128
113
  export default TimeSelect;
@@ -5,10 +5,12 @@ import LivePlayer from './Live';
5
5
  var list = [{
6
6
  url: 'https://jxsr-api.antelopecloud.cn/cloud/v2/live/538505715.m3u8?client_token=538505715_0_1662689284_b3fa3a25322233281b05384cfd11dc9d',
7
7
  type: 'hls'
8
- } // { url: 'https://6a75ef89-1-server.antelopecloud.cn/flv_live?app=live&token=542446501_3356491776_1693535295_37062417b87df4be7dd5c02b01d87248', type: 'flv' },
8
+ }
9
+ // { url: 'https://6a75ef89-1-server.antelopecloud.cn/flv_live?app=live&token=542446501_3356491776_1693535295_37062417b87df4be7dd5c02b01d87248', type: 'flv' },
9
10
  // { url: 'https://6a75ef90-1-server.antelopecloud.cn/flv_live?app=live&token=542453821_3356491776_1693535323_3a90f54c141b9a246d5679678ebafe90', type: 'flv' },
10
11
  // { url: 'https://6a75ef90-6-server.antelopecloud.cn/flv_live?app=live&token=542449206_3356491776_1693535342_803846974f04eb02e8115d10432d062f', type: 'flv' },
11
12
  ];
13
+
12
14
  export default function App() {
13
15
  return /*#__PURE__*/React.createElement(_ConfigProvider, {
14
16
  prefixCls: "cloudapp"
@@ -2,43 +2,27 @@ import "antd/lib/date-picker/style";
2
2
  import _DatePicker from "antd/lib/date-picker";
3
3
  import "antd/lib/config-provider/style";
4
4
  import _ConfigProvider from "antd/lib/config-provider";
5
-
6
5
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
7
-
8
6
  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."); }
9
-
10
7
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
11
-
12
8
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
13
-
14
9
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15
-
16
10
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
17
-
18
11
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
19
-
20
12
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
21
-
22
13
  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; }
23
-
24
14
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
25
-
26
15
  import { __rest } from "tslib";
27
16
  import React, { useMemo, useState } from 'react';
28
17
  import RecordPlayer from './Record';
29
18
  import moment from 'moment';
30
19
  import { completionSegments } from './utils';
31
20
  var cids = ['538509097', '539172446'];
32
-
33
21
  var query = function query(_a) {
34
22
  var cid = _a.cid,
35
- date = _a.date,
36
- recordType = _a.recordType,
37
- props = __rest(_a, ["cid", "date", "recordType"]); // return new Promise((reslove) => {
38
- // setTimeout(() => reslove([]), 2000);
39
- // });
40
-
41
-
23
+ date = _a.date,
24
+ recordType = _a.recordType,
25
+ props = __rest(_a, ["cid", "date", "recordType"]);
42
26
  var json = {
43
27
  code: 0,
44
28
  codeRemark: '操作成功',
@@ -63,25 +47,7 @@ var query = function query(_a) {
63
47
  hours: 23,
64
48
  minutes: 59,
65
49
  seconds: 59
66
- }).unix(); // const promise =
67
- // recordType === 2
68
- // ? Service.http({
69
- // url: '/api/staticResource/v1/localRecord/url',
70
- // data: { cid, beginTime, endTime },
71
- // method: 'post',
72
- // headers: {
73
- // Authorization: token,
74
- // },
75
- // }).then((res) => res.data.map((v: any) => ({ url: v.play_url, beginTime: v.begin, endTime: v.end })))
76
- // : Service.http({
77
- // url: `/api/staticResource/v2/video/queryHistoryAddress?Authorization=${token}`,
78
- // data: { cid, beginTime, endTime, mediaType: 'hls' },
79
- // method: 'post',
80
- // headers: {
81
- // Authorization: token,
82
- // },
83
- // }).then((res) => res.data);
84
-
50
+ }).unix();
85
51
  var promise = Promise.resolve(json.data.map(function (v) {
86
52
  return {
87
53
  url: v.play_url,
@@ -102,16 +68,14 @@ var query = function query(_a) {
102
68
  return Promise.reject();
103
69
  });
104
70
  };
105
-
106
71
  export default function App() {
107
72
  var _useState = useState({
108
- list: [],
109
- idx: 0
110
- }),
111
- _useState2 = _slicedToArray(_useState, 2),
112
- state = _useState2[0],
113
- setState = _useState2[1];
114
-
73
+ list: [],
74
+ idx: 0
75
+ }),
76
+ _useState2 = _slicedToArray(_useState, 2),
77
+ state = _useState2[0],
78
+ setState = _useState2[1];
115
79
  var value = useMemo(function () {
116
80
  return state.list[state.idx] ? moment(state.list[state.idx].date).set({
117
81
  hour: 0,
@@ -1,104 +1,71 @@
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 _useAsyncEffect from "ahooks/es/useAsyncEffect";
4
3
  import _useMemoizedFn from "ahooks/es/useMemoizedFn";
5
4
  import _usePrevious from "ahooks/es/usePrevious";
6
-
7
5
  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; }
8
-
9
6
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
10
-
11
7
  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."); }
12
-
13
8
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
14
-
15
9
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
16
-
17
10
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
18
-
19
11
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
20
-
21
12
  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."); }
22
-
23
13
  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); }
24
-
25
14
  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; }
26
-
27
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; }
28
-
29
16
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
30
-
31
17
  import { __awaiter } from "tslib";
32
18
  import { differenceBy, orderBy, uniqBy } from 'lodash-es';
33
19
  import { useMemo, useState } from 'react';
34
20
  import { differenceWithIndexs, FILTER_KEY } from './utils';
35
-
36
21
  function useRecordList(list, queryRecord, options) {
37
22
  var _this = this;
38
-
39
23
  var _useState = useState({
40
- cidSegments: []
41
- }),
42
- _useState2 = _slicedToArray(_useState, 2),
43
- state = _useState2[0],
44
- setState = _useState2[1];
45
-
24
+ cidSegments: []
25
+ }),
26
+ _useState2 = _slicedToArray(_useState, 2),
27
+ state = _useState2[0],
28
+ setState = _useState2[1];
46
29
  var listKey = useMemo(function () {
47
30
  return list.map(function (v) {
48
31
  var _a, _b;
49
-
50
32
  return v ? "".concat(v.cid, "|").concat(v.date, "|").concat((_b = (_a = v.segments) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) : FILTER_KEY;
51
33
  }).join('-');
52
34
  }, [list]);
53
-
54
35
  var prevListKey = _usePrevious(listKey);
55
-
56
36
  var loaddingCallback = _useMemoizedFn(options.loaddingCallback);
57
-
58
37
  var errorCallback = _useMemoizedFn(options.errorCallback);
59
-
60
38
  _useAsyncEffect(function () {
61
39
  return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
62
40
  var diffIndexs, arr, _iterator, _step, dif, index, item, record, segments, _segments, _segments2, _segments3;
63
-
64
41
  return _regeneratorRuntime().wrap(function _callee$(_context) {
65
42
  while (1) {
66
43
  switch (_context.prev = _context.next) {
67
44
  case 0:
68
45
  diffIndexs = differenceWithIndexs(listKey ? listKey.split('-') : [], prevListKey ? prevListKey.split('-') : []);
69
-
70
46
  if (!(diffIndexs.length === 0)) {
71
47
  _context.next = 3;
72
48
  break;
73
49
  }
74
-
75
50
  return _context.abrupt("return");
76
-
77
51
  case 3:
78
52
  arr = []; // 存在披露更新的情况
79
-
80
53
  _iterator = _createForOfIteratorHelper(diffIndexs);
81
54
  _context.prev = 5;
82
-
83
55
  _iterator.s();
84
-
85
56
  case 7:
86
57
  if ((_step = _iterator.n()).done) {
87
58
  _context.next = 52;
88
59
  break;
89
60
  }
90
-
91
61
  dif = _step.value;
92
62
  index = dif.idx;
93
63
  item = list[index]; // 当前外部传入的对象
94
-
95
64
  record = state.cidSegments[index]; //当前转换的播放对象
96
-
97
65
  if (item) {
98
66
  _context.next = 16;
99
67
  break;
100
68
  }
101
-
102
69
  // 这里可能原来是空,也可能是外部删除
103
70
  arr.push({
104
71
  idx: index,
@@ -107,31 +74,25 @@ function useRecordList(list, queryRecord, options) {
107
74
  });
108
75
  _context.next = 50;
109
76
  break;
110
-
111
77
  case 16:
112
78
  if (item.cid && item.date) {
113
79
  _context.next = 18;
114
80
  break;
115
81
  }
116
-
117
82
  return _context.abrupt("continue", 50);
118
-
119
83
  case 18:
120
84
  _context.prev = 18;
121
85
  loaddingCallback(index, true);
122
-
123
86
  if (record) {
124
87
  _context.next = 27;
125
88
  break;
126
89
  }
127
-
128
90
  _context.next = 23;
129
91
  return queryRecord(Object.assign(Object.assign({}, item), {
130
92
  cid: item.cid,
131
93
  date: item.date,
132
94
  recordType: item.recordType
133
95
  }));
134
-
135
96
  case 23:
136
97
  segments = _context.sent;
137
98
  arr.push({
@@ -141,20 +102,17 @@ function useRecordList(list, queryRecord, options) {
141
102
  });
142
103
  _context.next = 42;
143
104
  break;
144
-
145
105
  case 27:
146
106
  if (!(record.cid !== item.cid || record.recordType !== item.recordType)) {
147
107
  _context.next = 34;
148
108
  break;
149
109
  }
150
-
151
110
  _context.next = 30;
152
111
  return queryRecord(Object.assign(Object.assign({}, item), {
153
112
  cid: item.cid,
154
113
  date: item.date,
155
114
  recordType: item.recordType
156
115
  }));
157
-
158
116
  case 30:
159
117
  _segments = _context.sent;
160
118
  arr.push({
@@ -164,20 +122,17 @@ function useRecordList(list, queryRecord, options) {
164
122
  });
165
123
  _context.next = 42;
166
124
  break;
167
-
168
125
  case 34:
169
126
  if (!(record.date !== item.date)) {
170
127
  _context.next = 41;
171
128
  break;
172
129
  }
173
-
174
130
  _context.next = 37;
175
131
  return queryRecord(Object.assign(Object.assign({}, item), {
176
132
  cid: item.cid,
177
133
  date: item.date,
178
134
  recordType: item.recordType
179
135
  }));
180
-
181
136
  case 37:
182
137
  _segments2 = _context.sent;
183
138
  arr.push({
@@ -187,7 +142,6 @@ function useRecordList(list, queryRecord, options) {
187
142
  });
188
143
  _context.next = 42;
189
144
  break;
190
-
191
145
  case 41:
192
146
  if (Array.isArray(item.segments) && item.segments.length > 0) {
193
147
  // 时间轴更新
@@ -200,52 +154,40 @@ function useRecordList(list, queryRecord, options) {
200
154
  } else {
201
155
  console.debug('无变化!跳过~');
202
156
  }
203
-
204
157
  case 42:
205
158
  loaddingCallback(index, false);
206
159
  _context.next = 50;
207
160
  break;
208
-
209
161
  case 45:
210
162
  _context.prev = 45;
211
163
  _context.t0 = _context["catch"](18);
212
164
  console.error(_context.t0);
213
165
  errorCallback(index);
214
166
  loaddingCallback(index, false);
215
-
216
167
  case 50:
217
168
  _context.next = 7;
218
169
  break;
219
-
220
170
  case 52:
221
171
  _context.next = 57;
222
172
  break;
223
-
224
173
  case 54:
225
174
  _context.prev = 54;
226
175
  _context.t1 = _context["catch"](5);
227
-
228
176
  _iterator.e(_context.t1);
229
-
230
177
  case 57:
231
178
  _context.prev = 57;
232
-
233
179
  _iterator.f();
234
-
235
180
  return _context.finish(57);
236
-
237
181
  case 60:
238
182
  setState(function (old) {
239
183
  var flag = false; //标记是否更新
240
-
241
184
  var cidSegments = state.cidSegments;
242
185
  arr.forEach(function (_ref) {
243
186
  var type = _ref.type,
244
- segments = _ref.segments,
245
- idx = _ref.idx;
187
+ segments = _ref.segments,
188
+ idx = _ref.idx;
246
189
  var index = idx;
247
190
  var item = list[index];
248
-
249
191
  switch (type) {
250
192
  case 'add':
251
193
  // 这里重置播放对象
@@ -260,20 +202,17 @@ function useRecordList(list, queryRecord, options) {
260
202
  segments: orderBy(uniqBy(arr1, 'id'), 'beginTime', 'asc')
261
203
  });
262
204
  break;
263
-
264
205
  case 'delete':
265
206
  // 这里一是保持无播放对象,二是删除当前播放对象
266
207
  flag = true;
267
208
  cidSegments[index] = undefined;
268
209
  break;
269
-
270
210
  case 'modify':
271
211
  // 这里属于相同的播放对象,需要追加播放片断
272
212
  flag = true;
273
213
  cidSegments[index].date = item.date;
274
214
  cidSegments[index].recordType = item.recordType;
275
215
  var dif = differenceBy(cidSegments[index].segments, segments, 'beginTime');
276
-
277
216
  if (dif.length === 0) {
278
217
  flag = false;
279
218
  } else {
@@ -286,7 +225,6 @@ function useRecordList(list, queryRecord, options) {
286
225
  arr2 = uniqBy(arr2, 'id');
287
226
  cidSegments[index].segments = orderBy(arr2, 'beginTime', 'asc');
288
227
  }
289
-
290
228
  break;
291
229
  }
292
230
  });
@@ -294,7 +232,6 @@ function useRecordList(list, queryRecord, options) {
294
232
  cidSegments: flag ? _toConsumableArray(cidSegments) : cidSegments
295
233
  });
296
234
  });
297
-
298
235
  case 61:
299
236
  case "end":
300
237
  return _context.stop();
@@ -303,8 +240,6 @@ function useRecordList(list, queryRecord, options) {
303
240
  }, _callee, null, [[5, 54, 57, 60], [18, 45]]);
304
241
  }));
305
242
  }, [list, listKey, prevListKey]);
306
-
307
243
  return state.cidSegments;
308
244
  }
309
-
310
245
  export default useRecordList;