@cloud-app-dev/vidc 2.3.0 → 3.0.2

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 (319) hide show
  1. package/.umirc.ts +2 -2
  2. package/es/Config/interface.d.ts +2 -1
  3. package/es/DomMove/demo.d.ts +2 -0
  4. package/es/DomMove/demo.js +16 -0
  5. package/es/DomMove/index.d.ts +16 -0
  6. package/es/DomMove/index.js +145 -0
  7. package/es/DomMove/utils.d.ts +8 -0
  8. package/es/{Picture/component/MoveContent → DomMove}/utils.js +19 -0
  9. package/es/Drawer/index.d.ts +2 -2
  10. package/es/Drawer/interface.d.ts +4 -174
  11. package/es/ErrorBoundary/index.d.ts +18 -0
  12. package/es/ErrorBoundary/index.js +79 -0
  13. package/es/List/DynamicGridList/Demo.js +40 -27
  14. package/es/List/DynamicGridList/index.d.ts +20 -29
  15. package/es/List/DynamicGridList/index.js +40 -63
  16. package/es/List/DynamicList/index.css +15 -0
  17. package/es/List/DynamicList/index.d.ts +14 -0
  18. package/es/List/DynamicList/index.js +105 -0
  19. package/es/List/DynamicList/interface.d.ts +19 -0
  20. package/es/List/DynamicList/utils.d.ts +4 -0
  21. package/es/List/DynamicList/utils.js +6 -0
  22. package/es/List/GridList/Demo.js +27 -4
  23. package/es/List/GridList/index.css +1 -0
  24. package/es/List/GridList/index.d.ts +2 -2
  25. package/es/List/GridList/index.js +8 -12
  26. package/es/List/GridList/interface.d.ts +1 -1
  27. package/es/List/VList/index.js +2 -3
  28. package/es/List/index.css +2 -54
  29. package/es/List/index.d.ts +6 -7
  30. package/es/List/index.js +14 -153
  31. package/es/List/interface.d.ts +3 -61
  32. package/es/LoaderApp/index.d.ts +1 -1
  33. package/es/LoaderApp/index.js +27 -46
  34. package/es/LoaderApp/interface.d.ts +3 -0
  35. package/es/LoaderApp/loader.d.ts +6 -7
  36. package/es/LoaderApp/loader.js +20 -30
  37. package/es/LoaderApp/sandbox.back.d.ts +18 -0
  38. package/es/LoaderApp/sandbox.back.js +356 -0
  39. package/es/LoaderApp/sandbox.d.ts +12 -0
  40. package/es/LoaderApp/sandbox.js +110 -0
  41. package/es/LoaderApp/utils.d.ts +5 -1
  42. package/es/LoaderApp/utils.js +98 -2
  43. package/es/Map/AMap.d.ts +1572 -0
  44. package/es/Map/BasicMap/AMapInstance.d.ts +15 -0
  45. package/es/Map/BasicMap/AMapInstance.js +66 -0
  46. package/es/Map/BasicMap/LeafletInstance.d.ts +15 -0
  47. package/es/Map/BasicMap/LeafletInstance.js +98 -0
  48. package/es/Map/BasicMap/index.css +24 -0
  49. package/es/Map/BasicMap/index.d.ts +9 -0
  50. package/es/Map/BasicMap/index.js +103 -0
  51. package/es/Map/ClusterLayer/hook.d.ts +5 -0
  52. package/es/Map/ClusterLayer/hook.js +144 -0
  53. package/es/Map/ClusterLayer/index.css +26 -0
  54. package/es/Map/ClusterLayer/index.d.ts +5 -0
  55. package/es/Map/ClusterLayer/index.js +31 -0
  56. package/es/Map/ClusterLayer/props.d.ts +8 -0
  57. package/es/Map/Config/index.d.ts +7 -0
  58. package/es/{InitialConfig → Map/Config}/index.js +35 -36
  59. package/es/Map/Config/utils.d.ts +2 -0
  60. package/es/{List/DynamicDeviceList → Map/Config}/utils.js +48 -45
  61. package/es/Map/Context/index.d.ts +11 -0
  62. package/es/Map/Context/index.js +66 -0
  63. package/es/Map/FindPio/index.css +7 -0
  64. package/es/Map/FindPio/index.d.ts +4 -0
  65. package/es/Map/FindPio/index.js +16 -0
  66. package/es/{WorkerFlow/Demo.d.ts → Map/InfoWindow/demo.d.ts} +0 -0
  67. package/es/{List/DynamicDeviceList/Demo.js → Map/InfoWindow/demo.js} +27 -25
  68. package/es/Map/InfoWindow/index.d.ts +8 -0
  69. package/es/Map/InfoWindow/index.js +74 -0
  70. package/es/Map/LevelCenter/DragMarker/index.d.ts +12 -0
  71. package/es/Map/LevelCenter/DragMarker/index.js +48 -0
  72. package/es/{List/DeviceList → Map/LevelCenter}/index.css +0 -0
  73. package/es/Map/LevelCenter/index.d.ts +13 -0
  74. package/es/Map/LevelCenter/index.js +42 -0
  75. package/es/Map/LoaderMap/index.d.ts +12 -0
  76. package/es/Map/LoaderMap/index.js +58 -0
  77. package/es/Map/ResetTools/index.css +32 -0
  78. package/es/Map/ResetTools/index.d.ts +9 -0
  79. package/es/Map/ResetTools/index.js +61 -0
  80. package/es/Map/SinglePoint/Marker/index.d.ts +7 -0
  81. package/es/Map/SinglePoint/Marker/index.js +29 -0
  82. package/es/Map/SinglePoint/icon/Place_icon_OnLine_Hover.svg +15 -0
  83. package/es/Map/SinglePoint/icon/Place_icon_OnLine_Normal.svg +15 -0
  84. package/es/Map/SinglePoint/icon/Place_icon_OutLine_Hover.svg +15 -0
  85. package/es/Map/SinglePoint/icon/Place_icon_OutLine_Normal.svg +15 -0
  86. package/es/Map/SinglePoint/index.css +29 -0
  87. package/es/Map/SinglePoint/index.d.ts +7 -0
  88. package/es/Map/SinglePoint/index.js +32 -0
  89. package/es/Map/hook/useMapType.d.ts +4 -0
  90. package/es/Map/hook/useMapType.js +13 -0
  91. package/es/Map/icon.d.ts +2 -0
  92. package/es/Map/icon.js +10 -0
  93. package/es/Map/index.d.ts +23 -0
  94. package/es/Map/index.js +25 -0
  95. package/es/Map/interface.d.ts +55 -0
  96. package/es/Map/points.json +61247 -0
  97. package/es/{Picture/component/MoveContent → Map/useMarker}/index.css +0 -0
  98. package/es/Map/useMarker/index.d.ts +11 -0
  99. package/es/{WorkerFlow/Form/FormAuth.js → Map/useMarker/index.js} +57 -80
  100. package/es/Map/withMap/index.d.ts +2 -0
  101. package/es/Map/withMap/index.js +12 -0
  102. package/es/Modal/index.js +7 -5
  103. package/es/Picture/component/RectMenu/index.d.ts +1 -1
  104. package/es/Picture/index.d.ts +1 -1
  105. package/es/Picture/index.js +2 -2
  106. package/es/Player/api/index.d.ts +2 -8
  107. package/es/Player/api/index.js +29 -35
  108. package/es/Player/contraller_bar/left_bar.js +2 -2
  109. package/es/Player/contraller_bar/right_bar.d.ts +1 -1
  110. package/es/Player/contraller_bar/right_bar.js +13 -27
  111. package/es/Player/demo.js +21 -24
  112. package/es/Player/event/index.js +5 -1
  113. package/es/Player/frontend_player.d.ts +2 -3
  114. package/es/Player/frontend_player.js +35 -52
  115. package/es/Player/frontend_timeline.d.ts +3 -2
  116. package/es/Player/frontend_timeline.js +20 -9
  117. package/es/Player/live_heart.js +45 -12
  118. package/es/Player/message.js +23 -12
  119. package/es/Player/player.d.ts +29 -7
  120. package/es/Player/segment_player.d.ts +1 -1
  121. package/es/Player/segment_player.js +50 -39
  122. package/es/Player/segment_timeline.js +14 -13
  123. package/es/Player/single_player.js +59 -14
  124. package/es/Player/timeline.js +8 -6
  125. package/es/Player/util.d.ts +4 -25
  126. package/es/Player/util.js +47 -55
  127. package/es/PlayerExt/index.css +2 -2
  128. package/es/PlayerExt/index.d.ts +3 -1
  129. package/es/PlayerExt/index.js +19 -5
  130. package/es/ScreenPlayer/Live.d.ts +5 -0
  131. package/es/ScreenPlayer/Live.js +109 -0
  132. package/es/ScreenPlayer/LiveTools.d.ts +15 -0
  133. package/es/ScreenPlayer/LiveTools.js +95 -0
  134. package/es/ScreenPlayer/PlayerWithExt.d.ts +22 -0
  135. package/es/ScreenPlayer/PlayerWithExt.js +156 -0
  136. package/es/ScreenPlayer/Record.d.ts +5 -0
  137. package/es/{WorkerFlow/index.js → ScreenPlayer/Record.js} +286 -273
  138. package/es/ScreenPlayer/RecordTools.d.ts +17 -0
  139. package/es/ScreenPlayer/RecordTools.js +102 -0
  140. package/es/ScreenPlayer/SegmentTimeLine.d.ts +10 -0
  141. package/es/ScreenPlayer/SegmentTimeLine.js +40 -0
  142. package/es/ScreenPlayer/TimeSlider.d.ts +127 -0
  143. package/es/ScreenPlayer/TimeSlider.js +530 -0
  144. package/es/ScreenPlayer/demo.d.ts +2 -0
  145. package/es/ScreenPlayer/demo.js +25 -0
  146. package/es/ScreenPlayer/demo2.d.ts +2 -0
  147. package/es/ScreenPlayer/demo2.js +153 -0
  148. package/es/ScreenPlayer/index.css +49 -0
  149. package/es/ScreenPlayer/index.d.ts +5 -0
  150. package/es/ScreenPlayer/index.js +8 -0
  151. package/es/ScreenPlayer/interface.d.ts +81 -0
  152. package/es/ScreenPlayer/useRecordList.d.ts +3 -0
  153. package/es/{WorkerFlow/Form/UserAndGroupSelect.js → ScreenPlayer/useRecordList.js} +173 -176
  154. package/es/ScreenPlayer/useVideoFit.d.ts +5 -0
  155. package/es/ScreenPlayer/useVideoFit.js +46 -0
  156. package/es/ScreenPlayer/utils.d.ts +25 -0
  157. package/es/ScreenPlayer/utils.js +84 -0
  158. package/es/Timeout/index.d.ts +33 -0
  159. package/es/Timeout/index.js +83 -0
  160. package/es/Tree/demo.js +9 -12
  161. package/es/Tree/index.css +55 -29
  162. package/es/Tree/index.d.ts +20 -19
  163. package/es/Tree/index.js +70 -185
  164. package/es/index.d.ts +8 -9
  165. package/es/index.js +8 -9
  166. package/es/useInfiniteScroll/index.d.ts +16 -0
  167. package/es/{useHttp → useInfiniteScroll}/index.js +79 -43
  168. package/es/useVirtualList/index.d.ts +13 -0
  169. package/es/useVirtualList/index.js +175 -0
  170. package/es/withErrorBoundary/index.d.ts +9 -0
  171. package/es/withErrorBoundary/index.js +45 -0
  172. package/package.json +18 -21
  173. package/release-build.sh +44 -0
  174. package/test.js +48 -0
  175. package/es/DeviceIcon/icon.d.ts +0 -9
  176. package/es/DeviceIcon/icon.js +0 -138
  177. package/es/DeviceIcon/index.css +0 -8
  178. package/es/DeviceIcon/index.d.ts +0 -14
  179. package/es/DeviceIcon/index.js +0 -37
  180. package/es/DeviceSelect/TreeType.d.ts +0 -7
  181. package/es/DeviceSelect/TreeType.js +0 -36
  182. package/es/DeviceSelect/demo.d.ts +0 -3
  183. package/es/DeviceSelect/demo.js +0 -22
  184. package/es/DeviceSelect/index.css +0 -11
  185. package/es/DeviceSelect/index.d.ts +0 -13
  186. package/es/DeviceSelect/index.js +0 -191
  187. package/es/Dict/cache.d.ts +0 -3
  188. package/es/Dict/cache.js +0 -21
  189. package/es/Dict/device.d.ts +0 -28
  190. package/es/Dict/device.js +0 -117
  191. package/es/Dict/hook.d.ts +0 -3
  192. package/es/Dict/hook.js +0 -98
  193. package/es/Dict/index.d.ts +0 -9
  194. package/es/Dict/index.js +0 -10
  195. package/es/Dict/interface.d.ts +0 -16
  196. package/es/Dict/utils.d.ts +0 -10
  197. package/es/Dict/utils.js +0 -44
  198. package/es/InitialConfig/index.d.ts +0 -8
  199. package/es/InitialConfig/utils.d.ts +0 -20
  200. package/es/InitialConfig/utils.js +0 -110
  201. package/es/InitialRequest/index.d.ts +0 -9
  202. package/es/InitialRequest/index.js +0 -97
  203. package/es/InitialRequest/utils.d.ts +0 -10
  204. package/es/InitialRequest/utils.js +0 -116
  205. package/es/List/CheckExt.d.ts +0 -9
  206. package/es/List/CheckExt.js +0 -36
  207. package/es/List/DeviceList/index.d.ts +0 -11
  208. package/es/List/DeviceList/index.js +0 -50
  209. package/es/List/DynamicDeviceList/Demo.d.ts +0 -3
  210. package/es/List/DynamicDeviceList/index.css +0 -39
  211. package/es/List/DynamicDeviceList/index.d.ts +0 -12
  212. package/es/List/DynamicDeviceList/index.js +0 -205
  213. package/es/List/DynamicDeviceList/interface.d.ts +0 -37
  214. package/es/List/DynamicDeviceList/utils.d.ts +0 -16
  215. package/es/List/ListExt/index.css +0 -3
  216. package/es/List/ListExt/index.d.ts +0 -19
  217. package/es/List/ListExt/index.js +0 -44
  218. package/es/Picture/component/MoveContent/index.d.ts +0 -39
  219. package/es/Picture/component/MoveContent/index.js +0 -244
  220. package/es/Picture/component/MoveContent/utils.d.ts +0 -4
  221. package/es/Title/index.css +0 -25
  222. package/es/Title/index.d.ts +0 -12
  223. package/es/Title/index.js +0 -30
  224. package/es/Tree/BaseTree/index.css +0 -64
  225. package/es/Tree/BaseTree/index.d.ts +0 -24
  226. package/es/Tree/BaseTree/index.js +0 -83
  227. package/es/UserSelect/demo.d.ts +0 -3
  228. package/es/UserSelect/demo.js +0 -21
  229. package/es/UserSelect/index.css +0 -16
  230. package/es/UserSelect/index.d.ts +0 -18
  231. package/es/UserSelect/index.js +0 -194
  232. package/es/WorkerFlow/Demo.js +0 -57
  233. package/es/WorkerFlow/Form/Approver.d.ts +0 -10
  234. package/es/WorkerFlow/Form/Approver.js +0 -33
  235. package/es/WorkerFlow/Form/Condition.d.ts +0 -11
  236. package/es/WorkerFlow/Form/Condition.js +0 -235
  237. package/es/WorkerFlow/Form/EmptyUserSet.d.ts +0 -8
  238. package/es/WorkerFlow/Form/EmptyUserSet.js +0 -137
  239. package/es/WorkerFlow/Form/FormAuth.d.ts +0 -8
  240. package/es/WorkerFlow/Form/GroupList.d.ts +0 -12
  241. package/es/WorkerFlow/Form/GroupList.js +0 -44
  242. package/es/WorkerFlow/Form/GroupSelect.d.ts +0 -8
  243. package/es/WorkerFlow/Form/GroupSelect.js +0 -167
  244. package/es/WorkerFlow/Form/GroupSelectModalContent.d.ts +0 -6
  245. package/es/WorkerFlow/Form/GroupSelectModalContent.js +0 -177
  246. package/es/WorkerFlow/Form/Handle.d.ts +0 -10
  247. package/es/WorkerFlow/Form/Handle.js +0 -33
  248. package/es/WorkerFlow/Form/LevelGroupSelect.d.ts +0 -12
  249. package/es/WorkerFlow/Form/LevelGroupSelect.js +0 -208
  250. package/es/WorkerFlow/Form/Notifier.d.ts +0 -8
  251. package/es/WorkerFlow/Form/Notifier.js +0 -16
  252. package/es/WorkerFlow/Form/UserAndGroupSelect.d.ts +0 -8
  253. package/es/WorkerFlow/Form/UserSelect.d.ts +0 -8
  254. package/es/WorkerFlow/Form/UserSelect.js +0 -150
  255. package/es/WorkerFlow/Form/UserSelectModalContent.d.ts +0 -6
  256. package/es/WorkerFlow/Form/UserSelectModalContent.js +0 -166
  257. package/es/WorkerFlow/Form/UserSet.d.ts +0 -14
  258. package/es/WorkerFlow/Form/UserSet.js +0 -308
  259. package/es/WorkerFlow/Form/UsersHandleType.d.ts +0 -7
  260. package/es/WorkerFlow/Form/UsersHandleType.js +0 -32
  261. package/es/WorkerFlow/Form/utils.d.ts +0 -3
  262. package/es/WorkerFlow/Form/utils.js +0 -47
  263. package/es/WorkerFlow/Nodes/Add.d.ts +0 -7
  264. package/es/WorkerFlow/Nodes/Add.js +0 -98
  265. package/es/WorkerFlow/Nodes/AddOption.d.ts +0 -10
  266. package/es/WorkerFlow/Nodes/AddOption.js +0 -23
  267. package/es/WorkerFlow/Nodes/AddOptionList.d.ts +0 -8
  268. package/es/WorkerFlow/Nodes/AddOptionList.js +0 -46
  269. package/es/WorkerFlow/Nodes/Approver.d.ts +0 -11
  270. package/es/WorkerFlow/Nodes/Approver.js +0 -53
  271. package/es/WorkerFlow/Nodes/Condition.d.ts +0 -10
  272. package/es/WorkerFlow/Nodes/Condition.js +0 -140
  273. package/es/WorkerFlow/Nodes/Constants.d.ts +0 -35
  274. package/es/WorkerFlow/Nodes/Constants.js +0 -150
  275. package/es/WorkerFlow/Nodes/End.d.ts +0 -7
  276. package/es/WorkerFlow/Nodes/End.js +0 -16
  277. package/es/WorkerFlow/Nodes/Handle.d.ts +0 -11
  278. package/es/WorkerFlow/Nodes/Handle.js +0 -52
  279. package/es/WorkerFlow/Nodes/Node.d.ts +0 -8
  280. package/es/WorkerFlow/Nodes/Node.js +0 -26
  281. package/es/WorkerFlow/Nodes/Notifier.d.ts +0 -11
  282. package/es/WorkerFlow/Nodes/Notifier.js +0 -52
  283. package/es/WorkerFlow/Nodes/Render.d.ts +0 -8
  284. package/es/WorkerFlow/Nodes/Render.js +0 -16
  285. package/es/WorkerFlow/Nodes/Start.d.ts +0 -12
  286. package/es/WorkerFlow/Nodes/Start.js +0 -26
  287. package/es/WorkerFlow/Nodes/TitleElement.d.ts +0 -10
  288. package/es/WorkerFlow/Nodes/TitleElement.js +0 -127
  289. package/es/WorkerFlow/Nodes/Wrap.d.ts +0 -13
  290. package/es/WorkerFlow/Nodes/Wrap.js +0 -35
  291. package/es/WorkerFlow/OperatorContext.d.ts +0 -4
  292. package/es/WorkerFlow/OperatorContext.js +0 -3
  293. package/es/WorkerFlow/Tools.d.ts +0 -8
  294. package/es/WorkerFlow/Tools.js +0 -78
  295. package/es/WorkerFlow/XML/CanvasTag.d.ts +0 -3
  296. package/es/WorkerFlow/XML/CanvasTag.js +0 -142
  297. package/es/WorkerFlow/XML/EndEvent.d.ts +0 -1
  298. package/es/WorkerFlow/XML/EndEvent.js +0 -14
  299. package/es/WorkerFlow/XML/ExclusiveGateway.d.ts +0 -9
  300. package/es/WorkerFlow/XML/ExclusiveGateway.js +0 -101
  301. package/es/WorkerFlow/XML/Root.d.ts +0 -1
  302. package/es/WorkerFlow/XML/Root.js +0 -5
  303. package/es/WorkerFlow/XML/StartEvent.d.ts +0 -5
  304. package/es/WorkerFlow/XML/StartEvent.js +0 -28
  305. package/es/WorkerFlow/XML/UserTask.d.ts +0 -5
  306. package/es/WorkerFlow/XML/UserTask.js +0 -93
  307. package/es/WorkerFlow/XML/index.d.ts +0 -4
  308. package/es/WorkerFlow/XML/index.js +0 -100
  309. package/es/WorkerFlow/XML/utils.d.ts +0 -6
  310. package/es/WorkerFlow/XML/utils.js +0 -97
  311. package/es/WorkerFlow/data.json +0 -83
  312. package/es/WorkerFlow/index.css +0 -779
  313. package/es/WorkerFlow/index.d.ts +0 -13
  314. package/es/WorkerFlow/interface.d.ts +0 -93
  315. package/es/WorkerFlow/template.d.ts +0 -2
  316. package/es/WorkerFlow/template.js +0 -17
  317. package/es/WorkerFlow/utils.d.ts +0 -14
  318. package/es/WorkerFlow/utils.js +0 -212
  319. package/es/useHttp/index.d.ts +0 -8
@@ -0,0 +1,530 @@
1
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2
+
3
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
4
+
5
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
6
+
7
+ import moment from 'moment';
8
+ var currentColor = '#FF000A';
9
+ var normalLineColor = '#ffffff';
10
+ var hoverLineColor = '#319BFF';
11
+ var minPerStep = [1, 2, 5, 10, 15, 20, 30, 60, 120, 180, 240, 360, 720, 1440];
12
+ var minStepSize = 20;
13
+
14
+ var TimeSlider = /*#__PURE__*/function () {
15
+ function TimeSlider(canvas, options) {
16
+ var _this = this;
17
+
18
+ _classCallCheck(this, TimeSlider);
19
+
20
+ var _a, _b, _c, _d; //min/格
21
+
22
+
23
+ this.minutes_per_step = minPerStep; //刻度间最小宽度,单位px
24
+
25
+ this.graduation_step = minStepSize; //时间轴显示24小时
26
+
27
+ this.hours_per_ruler = 24; // 当前刻度开始
28
+
29
+ this.start_timestamp = new Date().getTime() - 12 * 60 * 60 * 1000;
30
+ this.distance_between_gtitle = 80;
31
+ this.zoom = 24; ////拖动mousedown标记
32
+
33
+ this.g_isMousedown = false; //拖动mousemove标记
34
+
35
+ this.g_isMousemove = false; //选中当前时间
36
+
37
+ this.current_timestamp = new Date().getTime();
38
+ this.timecell = [];
39
+ this.domLeft = 0;
40
+ /**
41
+ * 拖动/点击 mousedown事件
42
+ */
43
+
44
+ this.mousedownFunc = function (e) {
45
+ _this.g_isMousedown = true;
46
+ _this.g_mousedownCursor = _this.get_cursor_x_position(e); //记住mousedown的位置
47
+
48
+ document.addEventListener('mousemove', _this.mousemoveFunc);
49
+ document.addEventListener('mouseup', _this.mouseupFunc2);
50
+ };
51
+ /**
52
+ * 鼠标移出隐藏时间 mouseout事件
53
+ * @param {*} e
54
+ */
55
+
56
+
57
+ this.mouseoutFunc = function () {
58
+ _this.clearCanvas();
59
+
60
+ _this.init(_this.start_timestamp, _this.timecell, true);
61
+ };
62
+ /**
63
+ * 拖动/鼠标hover显示 mousemove事件
64
+ */
65
+
66
+
67
+ this.mousemoveFunc = function (e) {
68
+ if (_this.g_isMousedown) {
69
+ var pos_x = _this.get_cursor_x_position(e);
70
+
71
+ var px_per_ms = _this.canvansW / (_this.hours_per_ruler * 60 * 60 * 1000); // px/ms
72
+
73
+ _this.clearCanvas();
74
+
75
+ var diff_x = pos_x - _this.g_mousedownCursor;
76
+ _this.start_timestamp = _this.start_timestamp - Math.round(diff_x / px_per_ms);
77
+
78
+ _this.init(_this.start_timestamp, _this.timecell, true);
79
+
80
+ _this.g_isMousemove = true;
81
+ _this.g_mousedownCursor = pos_x;
82
+ }
83
+ };
84
+ /**
85
+ * 拖动/鼠标hover显示
86
+ */
87
+
88
+
89
+ this.mousemoveFunc2 = function (e) {
90
+ if (!_this.g_isMousedown) {
91
+ var pos_x = _this.get_cursor_x_position(e);
92
+
93
+ var px_per_ms = _this.canvansW / (_this.hours_per_ruler * 60 * 60 * 1000); // px/ms
94
+
95
+ _this.clearCanvas();
96
+
97
+ var time = _this.start_timestamp + pos_x / px_per_ms;
98
+
99
+ _this.init(_this.start_timestamp, _this.timecell, true);
100
+
101
+ _this.drawLine(pos_x, 20, pos_x, _this.canVansH, hoverLineColor, 1);
102
+
103
+ _this.ctx.fillStyle = hoverLineColor;
104
+ _this.ctx.font = "10px Arial";
105
+
106
+ _this.ctx.fillText(_this.changeTime(time), pos_x - 50, 12);
107
+ }
108
+ };
109
+ /**
110
+ * 拖动/点击 mouseup事件
111
+ */
112
+
113
+
114
+ this.mouseupFunc = function (e) {
115
+ if (_this.g_isMousemove) {
116
+ //拖动 事件
117
+ _this.g_isMousemove = false;
118
+ _this.g_isMousedown = false; // this.returnTime = this.start_timestamp + (this.hours_per_ruler * 3600 * 1000) / 2;
119
+ } else {
120
+ // click 事件
121
+ _this.g_isMousedown = false;
122
+
123
+ var posx = _this.get_cursor_x_position(e); //鼠标距离 px
124
+
125
+
126
+ var ms_per_px = _this.zoom * 3600 * 1000 / _this.canvansW; // ms/px
127
+
128
+ var current_timestamp = _this.start_timestamp + posx * ms_per_px;
129
+
130
+ var timecellItem = _this.timecell.find(function (v) {
131
+ return current_timestamp >= v.beginTime && current_timestamp < v.endTime;
132
+ });
133
+
134
+ if (timecellItem && !timecellItem.url) {
135
+ // 无录像轴 不让点击
136
+ return;
137
+ }
138
+
139
+ _this.current_timestamp = _this.start_timestamp + posx * ms_per_px;
140
+
141
+ _this.set_time_to_middle(_this.current_timestamp);
142
+
143
+ _this.options.onTimeChange && _this.options.onTimeChange(_this.current_timestamp);
144
+ }
145
+
146
+ document.removeEventListener('mousemove', _this.mousemoveFunc);
147
+ };
148
+ /**
149
+ * 拖动/点击 mouseup事件
150
+ */
151
+
152
+
153
+ this.mouseupFunc2 = function () {
154
+ if (_this.g_isMousemove) {
155
+ //拖动 事件
156
+ _this.g_isMousemove = false;
157
+ _this.g_isMousedown = false; // this.returnTime = this.start_timestamp + (this.hours_per_ruler * 3600 * 1000) / 2;
158
+ }
159
+
160
+ document.removeEventListener('mousemove', _this.mousemoveFunc);
161
+ document.removeEventListener('mouseup', _this.mouseupFunc2);
162
+ };
163
+ /**
164
+ * 滚轮放大缩小,以时间轴中心为准 mousewheel事件
165
+ */
166
+
167
+
168
+ this.mousewheelFunc = function (event) {
169
+ if (event && event.preventDefault) {
170
+ event.preventDefault();
171
+ } else {
172
+ window.event.returnValue = false;
173
+ return;
174
+ }
175
+
176
+ var e = window.event || event;
177
+ var delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail));
178
+ var middle_time = _this.start_timestamp + _this.hours_per_ruler * 3600 * 1000 / 2; //ms 记住当前中间的时间
179
+
180
+ if (delta < 0) {
181
+ _this.zoom = _this.zoom + 4;
182
+
183
+ if (_this.zoom >= 24) {
184
+ _this.zoom = 24; //放大最大24小时
185
+ }
186
+
187
+ _this.hours_per_ruler = _this.zoom;
188
+ } else if (delta > 0) {
189
+ // 放大
190
+ _this.zoom = _this.zoom - 4;
191
+
192
+ if (_this.zoom <= 1) {
193
+ _this.zoom = 1; //缩小最小1小时
194
+ }
195
+
196
+ _this.hours_per_ruler = _this.zoom;
197
+ }
198
+
199
+ _this.clearCanvas();
200
+
201
+ _this.start_timestamp = middle_time - _this.hours_per_ruler * 3600 * 1000 / 2; //start_timestamp = 当前中间的时间 - zoom/2
202
+
203
+ _this.init(_this.start_timestamp, _this.timecell, true);
204
+ };
205
+ /**
206
+ * 获取鼠标posx
207
+ * @param {*} e
208
+ */
209
+
210
+
211
+ this.get_cursor_x_position = function (e) {
212
+ var posx = 0;
213
+
214
+ if (!e) {
215
+ e = window.event;
216
+ }
217
+
218
+ if (e.pageX || e.pageY) {
219
+ posx = e.pageX - _this.domLeft;
220
+ } else if (e.clientX || e.clientY) {
221
+ posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
222
+ }
223
+
224
+ return posx;
225
+ };
226
+
227
+ var _canvas$getBoundingCl = canvas.getBoundingClientRect(),
228
+ left = _canvas$getBoundingCl.left;
229
+
230
+ this.canvas = canvas;
231
+ this.options = options;
232
+ this.canvansW = this.canvas.width = this.canvas.clientWidth;
233
+ this.canVansH = this.canvas.height = this.canvas.clientHeight;
234
+ this.hours_per_ruler = (_a = this.options.hours_per_ruler) !== null && _a !== void 0 ? _a : this.hours_per_ruler;
235
+ this.start_timestamp = (_b = this.options.start_timestamp) !== null && _b !== void 0 ? _b : this.start_timestamp;
236
+ this.current_timestamp = (_c = this.options.current_timestamp) !== null && _c !== void 0 ? _c : this.current_timestamp;
237
+ this.timecell = (_d = this.options.timecell) !== null && _d !== void 0 ? _d : this.timecell;
238
+ this.domLeft = left;
239
+ this.init(this.start_timestamp, this.timecell, false);
240
+ }
241
+
242
+ _createClass(TimeSlider, [{
243
+ key: "ctx",
244
+ get: function get() {
245
+ var _a;
246
+
247
+ return (_a = this.canvas) === null || _a === void 0 ? void 0 : _a.getContext('2d');
248
+ }
249
+ }, {
250
+ key: "init",
251
+ value: function init(start_timestamp, timecell, redrawFlag) {
252
+ this.timecell = timecell;
253
+ this.start_timestamp = start_timestamp;
254
+ this.drawCellBg();
255
+ this.add_cells(timecell);
256
+ this.add_graduations(start_timestamp);
257
+
258
+ if (!redrawFlag) {
259
+ //只有第一次进入才需要添加事件
260
+ this.add_events();
261
+ }
262
+
263
+ this.drawCurrentLine();
264
+ }
265
+ }, {
266
+ key: "drawCurrentLine",
267
+ value: function drawCurrentLine() {
268
+ var time = this.current_timestamp;
269
+ var range = [this.start_timestamp, this.start_timestamp + this.hours_per_ruler * 3600 * 1000];
270
+
271
+ if (time < range[0] || time > range[1]) {
272
+ return;
273
+ }
274
+
275
+ var ms_current = time - this.start_timestamp;
276
+ var px_per_ms = this.canvansW / (this.hours_per_ruler * 60 * 60 * 1000); // px/ms
277
+
278
+ var left = px_per_ms * ms_current;
279
+ this.ctx.fillStyle = '#ffffff';
280
+ this.ctx.font = '12px Arial';
281
+ this.ctx.fillText(this.changeTime(time), left - 64, 14);
282
+ this.drawLine(left, 20, left, this.canVansH, currentColor, 2); //中间当前点线
283
+ }
284
+ }, {
285
+ key: "drawCellBg",
286
+ value: function drawCellBg() {// this.ctx.fillStyle = canvasbg;
287
+ // this.ctx.fillRect(0, 0, this.canvansW, 15);
288
+ }
289
+ }, {
290
+ key: "get_line_sizes",
291
+ value: function get_line_sizes(start_timestamp) {
292
+ var px_per_min = this.canvansW / (this.hours_per_ruler * 60); // px/min
293
+
294
+ var px_per_ms = this.canvansW / (this.hours_per_ruler * 60 * 60 * 1000); // px/ms
295
+
296
+ var px_per_step = this.graduation_step; // px/格 默认最小值20px
297
+
298
+ var min_per_step = px_per_step / px_per_min; // min/格
299
+
300
+ for (var i = 0; i < this.minutes_per_step.length; i++) {
301
+ if (min_per_step <= this.minutes_per_step[i]) {
302
+ //让每格时间在minutes_per_step规定的范围内
303
+ min_per_step = this.minutes_per_step[i];
304
+ px_per_step = px_per_min * min_per_step;
305
+ break;
306
+ }
307
+ }
308
+
309
+ var medium_step = 30;
310
+
311
+ for (var _i = 0; _i < this.minutes_per_step.length; _i++) {
312
+ if (this.distance_between_gtitle / px_per_min <= this.minutes_per_step[_i]) {
313
+ medium_step = this.minutes_per_step[_i];
314
+ break;
315
+ }
316
+ }
317
+
318
+ var num_steps = this.canvansW / px_per_step; //总格数
319
+
320
+ var ms_offset = this.ms_to_next_step(start_timestamp, min_per_step * 60 * 1000); //开始的偏移时间 ms
321
+
322
+ var px_offset = ms_offset * px_per_ms; //开始的偏移距离 px
323
+
324
+ var ms_per_step = px_per_step / px_per_ms; // ms/step
325
+
326
+ return {
327
+ num_steps: num_steps,
328
+ px_offset: px_offset,
329
+ ms_per_step: ms_per_step,
330
+ px_per_step: px_per_step,
331
+ min_per_step: min_per_step,
332
+ medium_step: medium_step,
333
+ ms_offset: ms_offset,
334
+ px_per_ms: px_per_ms
335
+ };
336
+ }
337
+ }, {
338
+ key: "add_graduations",
339
+ value: function add_graduations(start_timestamp) {
340
+ var _this$get_line_sizes = this.get_line_sizes(start_timestamp),
341
+ num_steps = _this$get_line_sizes.num_steps,
342
+ px_offset = _this$get_line_sizes.px_offset,
343
+ px_per_step = _this$get_line_sizes.px_per_step,
344
+ ms_per_step = _this$get_line_sizes.ms_per_step,
345
+ medium_step = _this$get_line_sizes.medium_step,
346
+ ms_offset = _this$get_line_sizes.ms_offset;
347
+
348
+ var graduation_left, graduation_time, lineH;
349
+
350
+ for (var i = 0; i < num_steps; i++) {
351
+ graduation_left = px_offset + i * px_per_step; // 距离=开始的偏移距离+格数*px/格
352
+
353
+ graduation_time = start_timestamp + ms_offset + i * ms_per_step; //时间=左侧开始时间+偏移时间+格数*ms/格
354
+
355
+ var date = new Date(graduation_time);
356
+
357
+ if (date.getUTCHours() === 0 && date.getUTCMinutes() === 0) {
358
+ lineH = 10;
359
+ var big_date = this.graduation_title(date);
360
+ this.ctx.fillStyle = normalLineColor;
361
+ this.ctx.font = "10px Arial";
362
+ this.ctx.fillText(big_date, graduation_left - 12, 30);
363
+ } else if (graduation_time / (60 * 1000) % medium_step === 0) {
364
+ lineH = 10;
365
+ var middle_date = this.graduation_title(date);
366
+ this.ctx.fillStyle = normalLineColor;
367
+ this.ctx.font = "10px Arial";
368
+ this.ctx.fillText(middle_date, graduation_left - (middle_date.length > 5 ? 24 : 12), 30);
369
+ } else {
370
+ lineH = 5;
371
+ }
372
+
373
+ this.drawLine(graduation_left, this.canVansH - lineH, graduation_left, this.canVansH, normalLineColor, 2);
374
+ }
375
+ }
376
+ }, {
377
+ key: "ms_to_next_step",
378
+ value: function ms_to_next_step(timestamp, step) {
379
+ var remainder = timestamp % step;
380
+ return remainder ? step - remainder : 0;
381
+ }
382
+ /**
383
+ * 返回时间轴上刻度的时间
384
+ * @param {*} datetime new Date 格式
385
+ */
386
+
387
+ }, {
388
+ key: "graduation_title",
389
+ value: function graduation_title(datetime) {
390
+ var h = datetime.getHours();
391
+ var m = datetime.getMinutes();
392
+ var s = datetime.getMilliseconds();
393
+
394
+ if (h === 0 && m === 0 && s === 0) {
395
+ return moment(datetime).format('YYYY.MM.DD');
396
+ }
397
+
398
+ return moment(datetime).format('HH:mm');
399
+ }
400
+ /**
401
+ * 绘制线
402
+ * @param {*} beginX
403
+ * @param {*} beginY
404
+ * @param {*} endX
405
+ * @param {*} endY
406
+ * @param {*} color
407
+ * @param {*} width
408
+ */
409
+
410
+ }, {
411
+ key: "drawLine",
412
+ value: function drawLine(beginX, beginY, endX, endY, color, width) {
413
+ this.ctx.beginPath();
414
+ this.ctx.moveTo(beginX, beginY);
415
+ this.ctx.lineTo(endX, endY);
416
+ this.ctx.strokeStyle = color;
417
+ this.ctx.lineWidth = width;
418
+ this.ctx.stroke();
419
+ }
420
+ /**
421
+ * 添加录像段
422
+ * @param {*} cells 录像数组
423
+ */
424
+
425
+ }, {
426
+ key: "add_cells",
427
+ value: function add_cells(cells) {
428
+ var _this2 = this;
429
+
430
+ cells.forEach(function (cell) {
431
+ return _this2.draw_cell(cell);
432
+ });
433
+ }
434
+ /**
435
+ * 绘制录像块
436
+ * @param {*} cell cell包括beginTime ms;endTime ms;style
437
+ */
438
+
439
+ }, {
440
+ key: "draw_cell",
441
+ value: function draw_cell(cell) {
442
+ var _a;
443
+
444
+ var px_per_ms = this.canvansW / (this.hours_per_ruler * 60 * 60 * 1000); // px/ms
445
+
446
+ var beginX = (cell.beginTime - this.start_timestamp) * px_per_ms;
447
+ var cell_width = (cell.endTime - cell.beginTime) * px_per_ms;
448
+ this.ctx.fillStyle = cell.url ? ((_a = cell.style) === null || _a === void 0 ? void 0 : _a.background) || hoverLineColor : '#242C3D';
449
+ this.ctx.fillRect(beginX, this.canVansH - 10, cell_width + 1, this.canVansH);
450
+ }
451
+ /**·
452
+ * 时间轴事件
453
+ */
454
+
455
+ }, {
456
+ key: "add_events",
457
+ value: function add_events() {
458
+ this.canvas.addEventListener('mousewheel', this.mousewheelFunc);
459
+ this.canvas.addEventListener('mousedown', this.mousedownFunc);
460
+ this.canvas.addEventListener('mousemove', this.mousemoveFunc2);
461
+ this.canvas.addEventListener('mouseup', this.mouseupFunc);
462
+ this.canvas.addEventListener('mouseout', this.mouseoutFunc);
463
+ }
464
+ }, {
465
+ key: "remove_events",
466
+ value: function remove_events() {
467
+ this.canvas.removeEventListener('mousewheel', this.mousewheelFunc);
468
+ this.canvas.removeEventListener('mousedown', this.mousedownFunc);
469
+ this.canvas.removeEventListener('mousemove', this.mousemoveFunc2);
470
+ this.canvas.removeEventListener('mouseup', this.mouseupFunc);
471
+ this.canvas.removeEventListener('mouseout', this.mouseoutFunc);
472
+ }
473
+ }, {
474
+ key: "destory",
475
+ value: function destory() {
476
+ this.remove_events();
477
+ this.canvas = null;
478
+ this.options = null;
479
+ this.timecell = null;
480
+ }
481
+ /**
482
+ * 返回 2018-01-01 10:00:00 格式时间
483
+ * @param {*} time
484
+ */
485
+
486
+ }, {
487
+ key: "changeTime",
488
+ value: function changeTime(time) {
489
+ return moment(time).format('YYYY-MM-DD HH:mm:ss');
490
+ }
491
+ /**
492
+ * 设置时间,让这个时间点跳到中间红线处
493
+ * @param {*} time 单位ms
494
+ */
495
+
496
+ }, {
497
+ key: "set_time_to_middle",
498
+ value: function set_time_to_middle(time) {
499
+ this.clearCanvas();
500
+ this.start_timestamp = time - this.hours_per_ruler * 60 * 60 * 1000 / 2;
501
+ this.init(this.start_timestamp, this.timecell, true);
502
+ }
503
+ /**
504
+ * 返回点击或者拖动的时间点
505
+ */
506
+
507
+ }, {
508
+ key: "returnMouseupTime",
509
+ value: function returnMouseupTime(callback) {
510
+ if (this.current_timestamp != null) {
511
+ if (callback) {
512
+ callback(this.current_timestamp);
513
+ }
514
+ }
515
+ }
516
+ /**
517
+ * 清除canvas 每次重新绘制需要先清除
518
+ */
519
+
520
+ }, {
521
+ key: "clearCanvas",
522
+ value: function clearCanvas() {
523
+ this.ctx.clearRect(0, 0, 1500, 150);
524
+ }
525
+ }]);
526
+
527
+ return TimeSlider;
528
+ }();
529
+
530
+ export { TimeSlider as default };
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export default function (): JSX.Element;
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import LivePlayer from './Live';
3
+ var list = [{
4
+ url: 'https://6a75ef90-6-server.antelopecloud.cn/flv_live?app=live&token=542449336_3356491776_1691734783_0e329cf89f3333a17ccaf8533466a577',
5
+ type: 'flv'
6
+ }, {
7
+ url: 'https://6a75ef90-2-server.antelopecloud.cn/flv_live?app=live&token=542453242_3356491776_1691734590_6fb5b57fd5095ff2e6ff331fe605a593',
8
+ type: 'flv'
9
+ }, {
10
+ url: 'https://6a75ef90-2-server.antelopecloud.cn/flv_live?app=live&token=542453302_3356491776_1691735024_3bb73732b5e0a857b70248a179804801',
11
+ type: 'flv'
12
+ }, {
13
+ url: 'https://6a75ef90-0-server.antelopecloud.cn/flv_live?app=live&token=557997490_3356491776_1691725056_86b4dd8105fea7b1180408a63d17b37b',
14
+ type: 'flv'
15
+ }];
16
+ export default function () {
17
+ return /*#__PURE__*/React.createElement("div", {
18
+ style: {
19
+ width: 1200,
20
+ height: 800
21
+ }
22
+ }, /*#__PURE__*/React.createElement(LivePlayer, {
23
+ list: list
24
+ }));
25
+ }
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export default function App(): JSX.Element;