@cloud-app-dev/vidc 2.2.0-alpha.7 → 3.0.0

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 (339) hide show
  1. package/.eslintignore +1 -3
  2. package/.eslintrc +3 -0
  3. package/.prettierignore +1 -0
  4. package/.umirc.ts +74 -74
  5. package/es/AppContext/Sync.d.ts +3 -2
  6. package/es/AppContext/Sync.js +11 -2
  7. package/es/AppContext/index.js +63 -9
  8. package/es/AppContext/interface.d.ts +10 -1
  9. package/es/AppContext/static.d.ts +2 -0
  10. package/es/AppContext/static.js +5 -1
  11. package/es/Box/InfoBox/index.css +5 -6
  12. package/es/Box/TwoColumnBox/index.css +17 -24
  13. package/es/Box/TwoColumnBox/index.js +1 -4
  14. package/es/Box/index.css +1 -1
  15. package/es/Config/interface.d.ts +2 -1
  16. package/es/ConfigContext/index.d.ts +1 -1
  17. package/es/DomMove/demo.d.ts +2 -0
  18. package/es/DomMove/demo.js +16 -0
  19. package/es/DomMove/index.d.ts +16 -0
  20. package/es/DomMove/index.js +145 -0
  21. package/es/DomMove/utils.d.ts +8 -0
  22. package/es/{Picture/component/MoveContent → DomMove}/utils.js +19 -0
  23. package/es/Drawer/index.d.ts +2 -2
  24. package/es/Drawer/interface.d.ts +4 -174
  25. package/es/ErrorBoundary/index.d.ts +18 -0
  26. package/es/ErrorBoundary/index.js +84 -0
  27. package/es/List/DynamicGridList/Demo.js +40 -27
  28. package/es/List/DynamicGridList/index.d.ts +19 -18
  29. package/es/List/DynamicGridList/index.js +36 -36
  30. package/es/List/DynamicList/index.css +15 -0
  31. package/es/List/DynamicList/index.d.ts +14 -0
  32. package/es/List/DynamicList/index.js +105 -0
  33. package/es/List/DynamicList/interface.d.ts +19 -0
  34. package/es/List/DynamicList/utils.d.ts +4 -0
  35. package/es/List/DynamicList/utils.js +6 -0
  36. package/es/List/GridList/Demo.js +27 -4
  37. package/es/List/GridList/index.css +1 -0
  38. package/es/List/GridList/index.d.ts +2 -2
  39. package/es/List/GridList/index.js +8 -12
  40. package/es/List/GridList/interface.d.ts +1 -1
  41. package/es/List/VList/index.js +2 -3
  42. package/es/List/index.css +3 -55
  43. package/es/List/index.d.ts +5 -6
  44. package/es/List/index.js +15 -154
  45. package/es/List/interface.d.ts +3 -61
  46. package/es/LoaderApp/index.d.ts +1 -1
  47. package/es/LoaderApp/index.js +27 -46
  48. package/es/LoaderApp/interface.d.ts +3 -0
  49. package/es/LoaderApp/loader.d.ts +6 -7
  50. package/es/LoaderApp/loader.js +20 -30
  51. package/es/LoaderApp/sandbox.back.d.ts +18 -0
  52. package/es/LoaderApp/sandbox.back.js +356 -0
  53. package/es/LoaderApp/sandbox.d.ts +12 -0
  54. package/es/LoaderApp/sandbox.js +110 -0
  55. package/es/LoaderApp/utils.d.ts +5 -1
  56. package/es/LoaderApp/utils.js +98 -2
  57. package/es/Map/AMap.d.ts +1572 -0
  58. package/es/Map/BasicMap/AMapInstance.d.ts +15 -0
  59. package/es/Map/BasicMap/AMapInstance.js +66 -0
  60. package/es/Map/BasicMap/LeafletInstance.d.ts +15 -0
  61. package/es/Map/BasicMap/LeafletInstance.js +98 -0
  62. package/es/Map/BasicMap/index.css +24 -0
  63. package/es/Map/BasicMap/index.d.ts +9 -0
  64. package/es/Map/BasicMap/index.js +108 -0
  65. package/es/Map/ClusterLayer/hook.d.ts +5 -0
  66. package/es/Map/ClusterLayer/hook.js +144 -0
  67. package/es/Map/ClusterLayer/index.css +26 -0
  68. package/es/Map/ClusterLayer/index.d.ts +5 -0
  69. package/es/Map/ClusterLayer/index.js +31 -0
  70. package/es/Map/ClusterLayer/props.d.ts +8 -0
  71. package/es/Map/Config/index.d.ts +7 -0
  72. package/es/{InitialConfig → Map/Config}/index.js +35 -36
  73. package/es/Map/Config/utils.d.ts +2 -0
  74. package/es/{List/DynamicDeviceList → Map/Config}/utils.js +48 -45
  75. package/es/Map/Context/index.d.ts +11 -0
  76. package/es/Map/Context/index.js +66 -0
  77. package/es/Map/FindPio/index.css +7 -0
  78. package/es/Map/FindPio/index.d.ts +4 -0
  79. package/es/Map/FindPio/index.js +16 -0
  80. package/es/{WorkerFlow/Demo.d.ts → Map/InfoWindow/demo.d.ts} +0 -0
  81. package/es/{List/DynamicDeviceList/Demo.js → Map/InfoWindow/demo.js} +27 -25
  82. package/es/Map/InfoWindow/index.d.ts +8 -0
  83. package/es/Map/InfoWindow/index.js +74 -0
  84. package/es/Map/LevelCenter/DragMarker/index.d.ts +12 -0
  85. package/es/Map/LevelCenter/DragMarker/index.js +48 -0
  86. package/es/{List/DeviceList → Map/LevelCenter}/index.css +0 -0
  87. package/es/Map/LevelCenter/index.d.ts +13 -0
  88. package/es/Map/LevelCenter/index.js +42 -0
  89. package/es/Map/LoaderMap/index.d.ts +12 -0
  90. package/es/Map/LoaderMap/index.js +58 -0
  91. package/es/Map/ResetTools/index.css +32 -0
  92. package/es/Map/ResetTools/index.d.ts +9 -0
  93. package/es/Map/ResetTools/index.js +61 -0
  94. package/es/Map/SinglePoint/Marker/index.d.ts +7 -0
  95. package/es/Map/SinglePoint/Marker/index.js +29 -0
  96. package/es/Map/SinglePoint/icon/Place_icon_OnLine_Hover.svg +15 -0
  97. package/es/Map/SinglePoint/icon/Place_icon_OnLine_Normal.svg +15 -0
  98. package/es/Map/SinglePoint/icon/Place_icon_OutLine_Hover.svg +15 -0
  99. package/es/Map/SinglePoint/icon/Place_icon_OutLine_Normal.svg +15 -0
  100. package/es/Map/SinglePoint/index.css +29 -0
  101. package/es/Map/SinglePoint/index.d.ts +7 -0
  102. package/es/Map/SinglePoint/index.js +32 -0
  103. package/es/Map/hook/useMapType.d.ts +4 -0
  104. package/es/Map/hook/useMapType.js +13 -0
  105. package/es/Map/icon.d.ts +2 -0
  106. package/es/Map/icon.js +10 -0
  107. package/es/Map/index.d.ts +23 -0
  108. package/es/Map/index.js +25 -0
  109. package/es/Map/interface.d.ts +55 -0
  110. package/es/Map/points.json +61247 -0
  111. package/es/{Picture/component/MoveContent → Map/useMarker}/index.css +0 -0
  112. package/es/Map/useMarker/index.d.ts +11 -0
  113. package/es/{WorkerFlow/Form/FormAuth.js → Map/useMarker/index.js} +57 -80
  114. package/es/Map/withMap/index.d.ts +2 -0
  115. package/es/Map/withMap/index.js +12 -0
  116. package/es/Modal/index.css +1 -1
  117. package/es/Modal/index.d.ts +7 -7
  118. package/es/Picture/index.d.ts +1 -1
  119. package/es/Picture/index.js +2 -2
  120. package/es/Player/api/index.d.ts +1 -0
  121. package/es/Player/api/index.js +7 -1
  122. package/es/Player/demo.js +13 -21
  123. package/es/Player/event/index.js +5 -1
  124. package/es/Player/frontend_player.d.ts +1 -1
  125. package/es/Player/frontend_player.js +20 -13
  126. package/es/Player/frontend_timeline.d.ts +1 -1
  127. package/es/Player/live_heart.js +45 -12
  128. package/es/Player/message.js +23 -12
  129. package/es/Player/player.d.ts +31 -7
  130. package/es/Player/segment_player.d.ts +1 -1
  131. package/es/Player/segment_player.js +30 -18
  132. package/es/Player/segment_timeline.js +6 -6
  133. package/es/Player/single_player.js +50 -9
  134. package/es/Player/timeline.js +8 -6
  135. package/es/Player/util.d.ts +2 -1
  136. package/es/Player/util.js +4 -1
  137. package/es/PlayerExt/index.css +2 -2
  138. package/es/PlayerExt/index.d.ts +3 -1
  139. package/es/PlayerExt/index.js +19 -5
  140. package/es/ScreenPlayer/Live.d.ts +5 -0
  141. package/es/ScreenPlayer/Live.js +109 -0
  142. package/es/ScreenPlayer/LiveTools.d.ts +15 -0
  143. package/es/ScreenPlayer/LiveTools.js +95 -0
  144. package/es/ScreenPlayer/PlayerWithExt.d.ts +22 -0
  145. package/es/ScreenPlayer/PlayerWithExt.js +169 -0
  146. package/es/ScreenPlayer/Record.d.ts +5 -0
  147. package/es/{WorkerFlow/index.js → ScreenPlayer/Record.js} +290 -273
  148. package/es/ScreenPlayer/RecordTools.d.ts +17 -0
  149. package/es/ScreenPlayer/RecordTools.js +102 -0
  150. package/es/ScreenPlayer/SegmentTimeLine.d.ts +10 -0
  151. package/es/ScreenPlayer/SegmentTimeLine.js +40 -0
  152. package/es/ScreenPlayer/TimeSlider.d.ts +127 -0
  153. package/es/ScreenPlayer/TimeSlider.js +528 -0
  154. package/es/ScreenPlayer/demo.d.ts +2 -0
  155. package/es/ScreenPlayer/demo.js +25 -0
  156. package/es/ScreenPlayer/demo2.d.ts +2 -0
  157. package/es/ScreenPlayer/demo2.js +153 -0
  158. package/es/ScreenPlayer/index.css +50 -0
  159. package/es/ScreenPlayer/index.d.ts +6 -0
  160. package/es/ScreenPlayer/index.js +7 -0
  161. package/es/ScreenPlayer/interface.d.ts +81 -0
  162. package/es/ScreenPlayer/useRecordList.d.ts +3 -0
  163. package/es/{WorkerFlow/Form/UserAndGroupSelect.js → ScreenPlayer/useRecordList.js} +173 -176
  164. package/es/ScreenPlayer/useVideoFit.d.ts +5 -0
  165. package/es/{Tree/BaseTree/demo.js → ScreenPlayer/useVideoFit.js} +30 -55
  166. package/es/ScreenPlayer/utils.d.ts +25 -0
  167. package/es/ScreenPlayer/utils.js +84 -0
  168. package/es/ThemeAntd/index.css +58 -58
  169. package/es/ThemeAntd/style/button.css +1 -1
  170. package/es/ThemeAntd/style/checkbox.css +8 -8
  171. package/es/ThemeAntd/style/input.css +13 -13
  172. package/es/ThemeAntd/style/pagination.css +5 -5
  173. package/es/ThemeAntd/style/picker.css +11 -11
  174. package/es/ThemeAntd/style/popover.css +1 -1
  175. package/es/ThemeAntd/style/radio.css +4 -4
  176. package/es/ThemeAntd/style/scrollbar.css +3 -3
  177. package/es/ThemeAntd/style/select.css +11 -11
  178. package/es/ThemeAntd/style/table.css +1 -1
  179. package/es/Tree/demo.js +9 -12
  180. package/es/Tree/index.css +55 -29
  181. package/es/Tree/index.d.ts +20 -19
  182. package/es/Tree/index.js +70 -185
  183. package/es/index.d.ts +7 -9
  184. package/es/index.js +7 -9
  185. package/es/useInfiniteScroll/index.d.ts +16 -0
  186. package/es/{useHttp → useInfiniteScroll}/index.js +79 -43
  187. package/es/useVirtualList/index.d.ts +13 -0
  188. package/es/useVirtualList/index.js +175 -0
  189. package/es/withErrorBoundary/index.d.ts +8 -0
  190. package/es/withErrorBoundary/index.js +43 -0
  191. package/package.json +19 -21
  192. package/test.js +48 -0
  193. package/es/DeviceIcon/icon.d.ts +0 -9
  194. package/es/DeviceIcon/icon.js +0 -138
  195. package/es/DeviceIcon/index.css +0 -8
  196. package/es/DeviceIcon/index.d.ts +0 -14
  197. package/es/DeviceIcon/index.js +0 -37
  198. package/es/DeviceSelect/TreeType.d.ts +0 -7
  199. package/es/DeviceSelect/TreeType.js +0 -36
  200. package/es/DeviceSelect/demo.d.ts +0 -3
  201. package/es/DeviceSelect/demo.js +0 -22
  202. package/es/DeviceSelect/index.css +0 -11
  203. package/es/DeviceSelect/index.d.ts +0 -13
  204. package/es/DeviceSelect/index.js +0 -191
  205. package/es/Dict/cache.d.ts +0 -3
  206. package/es/Dict/cache.js +0 -21
  207. package/es/Dict/device.d.ts +0 -28
  208. package/es/Dict/device.js +0 -117
  209. package/es/Dict/hook.d.ts +0 -3
  210. package/es/Dict/hook.js +0 -98
  211. package/es/Dict/index.d.ts +0 -9
  212. package/es/Dict/index.js +0 -10
  213. package/es/Dict/interface.d.ts +0 -16
  214. package/es/Dict/utils.d.ts +0 -10
  215. package/es/Dict/utils.js +0 -44
  216. package/es/InitialConfig/index.d.ts +0 -8
  217. package/es/InitialConfig/utils.d.ts +0 -20
  218. package/es/InitialConfig/utils.js +0 -110
  219. package/es/InitialRequest/index.d.ts +0 -9
  220. package/es/InitialRequest/index.js +0 -97
  221. package/es/InitialRequest/utils.d.ts +0 -10
  222. package/es/InitialRequest/utils.js +0 -116
  223. package/es/List/CheckExt.d.ts +0 -9
  224. package/es/List/CheckExt.js +0 -36
  225. package/es/List/DeviceList/index.d.ts +0 -11
  226. package/es/List/DeviceList/index.js +0 -50
  227. package/es/List/DynamicDeviceList/Demo.d.ts +0 -3
  228. package/es/List/DynamicDeviceList/index.css +0 -39
  229. package/es/List/DynamicDeviceList/index.d.ts +0 -12
  230. package/es/List/DynamicDeviceList/index.js +0 -205
  231. package/es/List/DynamicDeviceList/interface.d.ts +0 -37
  232. package/es/List/DynamicDeviceList/utils.d.ts +0 -16
  233. package/es/List/ListExt/index.css +0 -3
  234. package/es/List/ListExt/index.d.ts +0 -19
  235. package/es/List/ListExt/index.js +0 -44
  236. package/es/Picture/component/MoveContent/index.d.ts +0 -39
  237. package/es/Picture/component/MoveContent/index.js +0 -244
  238. package/es/Picture/component/MoveContent/utils.d.ts +0 -4
  239. package/es/Title/index.css +0 -25
  240. package/es/Title/index.d.ts +0 -12
  241. package/es/Title/index.js +0 -30
  242. package/es/Tree/BaseTree/demo.d.ts +0 -3
  243. package/es/Tree/BaseTree/index.css +0 -64
  244. package/es/Tree/BaseTree/index.d.ts +0 -24
  245. package/es/Tree/BaseTree/index.js +0 -83
  246. package/es/UserSelect/demo.d.ts +0 -3
  247. package/es/UserSelect/demo.js +0 -21
  248. package/es/UserSelect/index.css +0 -16
  249. package/es/UserSelect/index.d.ts +0 -18
  250. package/es/UserSelect/index.js +0 -194
  251. package/es/WorkerFlow/Demo.js +0 -57
  252. package/es/WorkerFlow/Form/Approver.d.ts +0 -10
  253. package/es/WorkerFlow/Form/Approver.js +0 -33
  254. package/es/WorkerFlow/Form/Condition.d.ts +0 -11
  255. package/es/WorkerFlow/Form/Condition.js +0 -235
  256. package/es/WorkerFlow/Form/EmptyUserSet.d.ts +0 -8
  257. package/es/WorkerFlow/Form/EmptyUserSet.js +0 -137
  258. package/es/WorkerFlow/Form/FormAuth.d.ts +0 -8
  259. package/es/WorkerFlow/Form/GroupList.d.ts +0 -12
  260. package/es/WorkerFlow/Form/GroupList.js +0 -44
  261. package/es/WorkerFlow/Form/GroupSelect.d.ts +0 -8
  262. package/es/WorkerFlow/Form/GroupSelect.js +0 -167
  263. package/es/WorkerFlow/Form/GroupSelectModalContent.d.ts +0 -6
  264. package/es/WorkerFlow/Form/GroupSelectModalContent.js +0 -177
  265. package/es/WorkerFlow/Form/Handle.d.ts +0 -10
  266. package/es/WorkerFlow/Form/Handle.js +0 -33
  267. package/es/WorkerFlow/Form/LevelGroupSelect.d.ts +0 -12
  268. package/es/WorkerFlow/Form/LevelGroupSelect.js +0 -208
  269. package/es/WorkerFlow/Form/Notifier.d.ts +0 -8
  270. package/es/WorkerFlow/Form/Notifier.js +0 -16
  271. package/es/WorkerFlow/Form/UserAndGroupSelect.d.ts +0 -8
  272. package/es/WorkerFlow/Form/UserSelect.d.ts +0 -8
  273. package/es/WorkerFlow/Form/UserSelect.js +0 -150
  274. package/es/WorkerFlow/Form/UserSelectModalContent.d.ts +0 -6
  275. package/es/WorkerFlow/Form/UserSelectModalContent.js +0 -166
  276. package/es/WorkerFlow/Form/UserSet.d.ts +0 -14
  277. package/es/WorkerFlow/Form/UserSet.js +0 -308
  278. package/es/WorkerFlow/Form/UsersHandleType.d.ts +0 -7
  279. package/es/WorkerFlow/Form/UsersHandleType.js +0 -32
  280. package/es/WorkerFlow/Form/utils.d.ts +0 -3
  281. package/es/WorkerFlow/Form/utils.js +0 -47
  282. package/es/WorkerFlow/Nodes/Add.d.ts +0 -7
  283. package/es/WorkerFlow/Nodes/Add.js +0 -97
  284. package/es/WorkerFlow/Nodes/AddOption.d.ts +0 -10
  285. package/es/WorkerFlow/Nodes/AddOption.js +0 -23
  286. package/es/WorkerFlow/Nodes/AddOptionList.d.ts +0 -8
  287. package/es/WorkerFlow/Nodes/AddOptionList.js +0 -46
  288. package/es/WorkerFlow/Nodes/Approver.d.ts +0 -11
  289. package/es/WorkerFlow/Nodes/Approver.js +0 -53
  290. package/es/WorkerFlow/Nodes/Condition.d.ts +0 -10
  291. package/es/WorkerFlow/Nodes/Condition.js +0 -140
  292. package/es/WorkerFlow/Nodes/Constants.d.ts +0 -35
  293. package/es/WorkerFlow/Nodes/Constants.js +0 -150
  294. package/es/WorkerFlow/Nodes/End.d.ts +0 -7
  295. package/es/WorkerFlow/Nodes/End.js +0 -16
  296. package/es/WorkerFlow/Nodes/Handle.d.ts +0 -11
  297. package/es/WorkerFlow/Nodes/Handle.js +0 -52
  298. package/es/WorkerFlow/Nodes/Node.d.ts +0 -8
  299. package/es/WorkerFlow/Nodes/Node.js +0 -26
  300. package/es/WorkerFlow/Nodes/Notifier.d.ts +0 -11
  301. package/es/WorkerFlow/Nodes/Notifier.js +0 -52
  302. package/es/WorkerFlow/Nodes/Render.d.ts +0 -8
  303. package/es/WorkerFlow/Nodes/Render.js +0 -16
  304. package/es/WorkerFlow/Nodes/Start.d.ts +0 -12
  305. package/es/WorkerFlow/Nodes/Start.js +0 -26
  306. package/es/WorkerFlow/Nodes/TitleElement.d.ts +0 -10
  307. package/es/WorkerFlow/Nodes/TitleElement.js +0 -127
  308. package/es/WorkerFlow/Nodes/Wrap.d.ts +0 -13
  309. package/es/WorkerFlow/Nodes/Wrap.js +0 -35
  310. package/es/WorkerFlow/OperatorContext.d.ts +0 -4
  311. package/es/WorkerFlow/OperatorContext.js +0 -3
  312. package/es/WorkerFlow/Tools.d.ts +0 -8
  313. package/es/WorkerFlow/Tools.js +0 -78
  314. package/es/WorkerFlow/XML/CanvasTag.d.ts +0 -3
  315. package/es/WorkerFlow/XML/CanvasTag.js +0 -142
  316. package/es/WorkerFlow/XML/EndEvent.d.ts +0 -1
  317. package/es/WorkerFlow/XML/EndEvent.js +0 -14
  318. package/es/WorkerFlow/XML/ExclusiveGateway.d.ts +0 -9
  319. package/es/WorkerFlow/XML/ExclusiveGateway.js +0 -101
  320. package/es/WorkerFlow/XML/Root.d.ts +0 -1
  321. package/es/WorkerFlow/XML/Root.js +0 -5
  322. package/es/WorkerFlow/XML/StartEvent.d.ts +0 -5
  323. package/es/WorkerFlow/XML/StartEvent.js +0 -28
  324. package/es/WorkerFlow/XML/UserTask.d.ts +0 -5
  325. package/es/WorkerFlow/XML/UserTask.js +0 -93
  326. package/es/WorkerFlow/XML/index.d.ts +0 -4
  327. package/es/WorkerFlow/XML/index.js +0 -100
  328. package/es/WorkerFlow/XML/utils.d.ts +0 -6
  329. package/es/WorkerFlow/XML/utils.js +0 -97
  330. package/es/WorkerFlow/data.json +0 -83
  331. package/es/WorkerFlow/index.css +0 -779
  332. package/es/WorkerFlow/index.d.ts +0 -13
  333. package/es/WorkerFlow/interface.d.ts +0 -93
  334. package/es/WorkerFlow/template.d.ts +0 -2
  335. package/es/WorkerFlow/template.js +0 -17
  336. package/es/WorkerFlow/utils.d.ts +0 -7
  337. package/es/WorkerFlow/utils.js +0 -197
  338. package/es/useHttp/index.d.ts +0 -8
  339. package/pnpm-lock.yaml +0 -13650
@@ -0,0 +1,145 @@
1
+ import _useEventListener from "ahooks/es/useEventListener";
2
+ import _useUpdate from "ahooks/es/useUpdate";
3
+ import _useSize from "ahooks/es/useSize";
4
+ import React, { useEffect, useImperativeHandle, useRef } from 'react';
5
+ import { getPosition, getMouseXY } from './utils';
6
+
7
+ function DomMove(_ref) {
8
+ var onDrag = _ref.onDrag,
9
+ position = _ref.position,
10
+ className = _ref.className,
11
+ size = _ref.size,
12
+ children = _ref.children,
13
+ onDragChange = _ref.onDragChange,
14
+ onDragEnd = _ref.onDragEnd,
15
+ forwordRef = _ref.forwordRef;
16
+ var dragRef = useRef(null);
17
+ var ref = useRef({
18
+ position: {
19
+ x: 0,
20
+ y: 0
21
+ },
22
+ DA: {
23
+ x: 0,
24
+ y: 0
25
+ },
26
+ isDrag: false,
27
+ deviation: {
28
+ offsetX: 0,
29
+ offsetY: 0,
30
+ width: 0,
31
+ height: 0
32
+ }
33
+ });
34
+ var reSize = _useSize(dragRef) || {};
35
+
36
+ var update = _useUpdate();
37
+
38
+ var updatePosition = function updatePosition(_ref2) {
39
+ var x = _ref2.x,
40
+ y = _ref2.y;
41
+ ref.current.position = {
42
+ x: x,
43
+ y: y
44
+ };
45
+ update();
46
+ onDragChange && onDragChange({
47
+ x: x,
48
+ y: y
49
+ });
50
+ };
51
+
52
+ useEffect(function () {
53
+ var offset = getPosition(dragRef === null || dragRef === void 0 ? void 0 : dragRef.current);
54
+ ref.current.deviation = {
55
+ offsetX: offset.left,
56
+ offsetY: offset.top,
57
+ width: reSize.width,
58
+ height: reSize.height
59
+ };
60
+ }, [reSize.width, reSize.height]);
61
+ useImperativeHandle(forwordRef, function () {
62
+ return {
63
+ updatePosition: updatePosition
64
+ };
65
+ }, []);
66
+
67
+ _useEventListener('mousemove', function (event) {
68
+ if (ref.current.isDrag) {
69
+ // let maxX, maxY;
70
+ var moveX, moveY;
71
+
72
+ var _getMouseXY = getMouseXY(event),
73
+ _x = _getMouseXY.x,
74
+ _y = _getMouseXY.y;
75
+
76
+ moveX = _x - ref.current.deviation.offsetX;
77
+ moveY = _y - ref.current.deviation.offsetY; // 计算可移动位置的大小, 保证元素不会超过可移动范围
78
+ // maxX = document.documentElement.clientWidth - this.deviation.width;
79
+ // maxY = document.documentElement.clientHeight - this.deviation.height;
80
+ // min方法保证不会超过右边界,max保证不会超过左边界
81
+ // moveX = Math.min(Math.max(0, moveX), maxX);
82
+ // moveY = Math.min(Math.max(0, moveY), maxY);
83
+
84
+ var _position = {
85
+ x: moveX,
86
+ y: moveY
87
+ };
88
+ onDrag ? onDrag(event, _position) : updatePosition(_position);
89
+ }
90
+ }, {
91
+ target: document.body
92
+ });
93
+
94
+ _useEventListener('mouseup', function (event) {
95
+ ref.current.isDrag = false;
96
+ onDragEnd && onDragEnd(event, ref.current.position);
97
+ }, {
98
+ target: document.body
99
+ });
100
+
101
+ _useEventListener('mousedown', function (event) {
102
+ var _getMouseXY2 = getMouseXY(event),
103
+ x = _getMouseXY2.x,
104
+ y = _getMouseXY2.y;
105
+
106
+ ref.current.deviation.offsetX = x - ref.current.position.x;
107
+ ref.current.deviation.offsetY = y - ref.current.position.y;
108
+ ref.current.isDrag = true;
109
+ }, {
110
+ target: dragRef
111
+ });
112
+
113
+ var _ref3 = onDrag ? {
114
+ x: position.x,
115
+ y: position.y
116
+ } : {
117
+ x: ref.current.position.x,
118
+ y: ref.current.position.y
119
+ },
120
+ x = _ref3.x,
121
+ y = _ref3.y;
122
+
123
+ return /*#__PURE__*/React.createElement("div", {
124
+ ref: dragRef,
125
+ className: "drag-move-Content ".concat(className),
126
+ style: {
127
+ transform: "translate(".concat(x, "px,").concat(y, "px)"),
128
+ width: size.width,
129
+ height: size.height
130
+ }
131
+ }, children);
132
+ }
133
+
134
+ DomMove.defaultProps = {
135
+ className: '',
136
+ size: {
137
+ width: '100%',
138
+ height: '100%'
139
+ }
140
+ };
141
+ export default /*#__PURE__*/React.forwardRef(function (props, ref) {
142
+ return /*#__PURE__*/React.createElement(DomMove, Object.assign({}, props, {
143
+ forwordRef: ref
144
+ }));
145
+ });
@@ -0,0 +1,8 @@
1
+ export declare function getPosition(obj: any): {
2
+ left: any;
3
+ top: any;
4
+ };
5
+ export declare function getMouseXY(e: MouseEvent): {
6
+ x: number;
7
+ y: number;
8
+ };
@@ -16,4 +16,23 @@ export function getPosition(obj) {
16
16
  left: l,
17
17
  top: t
18
18
  };
19
+ } // 函数用于获取鼠标的位置
20
+
21
+ export function getMouseXY(e) {
22
+ var x = 0,
23
+ y = 0;
24
+ e = e || window.event;
25
+
26
+ if (e.pageX) {
27
+ x = e.pageX;
28
+ y = e.pageY;
29
+ } else {
30
+ x = e.clientX + document.body.scrollLeft - document.body.clientLeft;
31
+ y = e.clientY + document.body.scrollTop - document.body.clientTop;
32
+ }
33
+
34
+ return {
35
+ x: x,
36
+ y: y
37
+ };
19
38
  }
@@ -1,7 +1,7 @@
1
- import { DrawerProps } from './interface';
1
+ import { IDrawerProps } from './interface';
2
2
  import React from 'react';
3
3
  import './index.less';
4
- declare function Drawer({ style, getContainer, onClose, className, onOk, cancelText, okText, children, ...props }: DrawerProps): JSX.Element;
4
+ declare function Drawer({ style, getContainer, onClose, className, onOk, cancelText, okText, children, ...props }: IDrawerProps): JSX.Element;
5
5
  declare namespace Drawer {
6
6
  var defaultProps: {
7
7
  getContainer: boolean;
@@ -1,180 +1,10 @@
1
- import * as React from 'react';
2
- declare type EventType = React.KeyboardEvent<HTMLDivElement> | React.MouseEvent<HTMLDivElement | HTMLButtonElement>;
3
- declare type getContainerFunc = () => HTMLElement;
4
- declare const PlacementTypes: ['top', 'right', 'bottom', 'left'];
5
- declare type placementType = typeof PlacementTypes[number];
6
- export interface PushState {
7
- distance: string | number;
8
- }
9
- export interface DrawerProps {
10
- children?: React.ReactNode;
11
- /**
12
- * @description 是否显示右上角的关闭按钮
13
- * @default true
14
- */
15
- closable?: boolean;
16
-
17
- /**
18
- * @description 自定义关闭图标
19
- * @default <CloseOutlined />
20
- */
21
- closeIcon?: React.ReactNode;
22
-
23
- /**
24
- * @description 关闭时销毁 Drawer 里的子元素
25
- * @default false
26
- */
27
- destroyOnClose?: boolean;
28
-
29
- /**
30
- * @description 预渲染 Drawer 内元素
31
- * @default false
32
- */
33
- forceRender?: boolean;
34
-
35
- /**
36
- * @description 指定 Drawer 挂载的 HTML 节点, false 为挂载在当前 dom
37
- * @default body
38
- * @type HTMLElement | () => HTMLElement | Selectors | false
39
- */
40
- getContainer?: string | HTMLElement | getContainerFunc | false;
41
-
42
- /**
43
- * @description 点击蒙层是否允许关闭
44
- * @default true
45
- */
46
- maskClosable?: boolean;
47
-
48
- /**
49
- * @description 是否展示遮罩
50
- * @default true
51
- */
52
- mask?: boolean;
53
-
54
- /**
55
- * @description 遮罩样式
56
- * @default -
57
- */
58
- maskStyle?: React.CSSProperties;
59
-
60
- /**
61
- * @description 可用于设置 Drawer 最外层容器的样式,和 drawerStyle 的区别是作用节点包括 mask
62
- * @default -
63
- */
64
- style?: React.CSSProperties;
65
-
66
- /**
67
- * @description 用于设置 Drawer 弹出层的样式
68
- * @default -
69
- */
70
- drawerStyle?: React.CSSProperties;
71
-
72
- /**
73
- * @description 用于设置 Drawer 头部的样式
74
- * @default -
75
- */
76
- headerStyle?: React.CSSProperties;
77
-
78
- /**
79
- * @description 可用于设置 Drawer 内容部分的样式
80
- * @default -
81
- */
82
- bodyStyle?: React.CSSProperties;
83
-
84
- /**
85
- * @description 标题
86
- * @default -
87
- */
88
- title?: React.ReactNode;
89
-
90
- /**
91
- * @description Drawer 是否可见
92
- * @default -
93
- */
94
- visible?: boolean;
95
-
96
- /**
97
- * @description 宽度
98
- * @default 256
99
- */
100
- width?: number | string;
1
+ import type { DrawerProps } from 'antd';
101
2
 
102
- /**
103
- * @description 高度
104
- * @default 256
105
- */
106
- height?: number | string;
107
-
108
- /**
109
- * @description 设置 Drawer 的 z-index
110
- * @default 1000
111
- */
112
- zIndex?: number;
113
-
114
- /**
115
- * @description 用于设置多层 Drawer 的推动行为
116
- * @type boolean | { distance: string | number }
117
- * @default { distance: 180 }
118
- */
119
- push?: boolean | PushState;
120
-
121
- /**
122
- * @description 抽屉的方向
123
- * @default right
124
- */
125
- placement?: 'top' | 'right' | 'bottom' | 'left';
126
-
127
- /**
128
- * @description 点击遮罩层或右上角叉或取消按钮的回调
129
- * @default -
130
- */
131
- onClose?: (e: EventType) => void;
132
-
133
- /**
134
- * @description 点击footer下的确定按钮
135
- * @default -
136
- */
137
- onOk?: (e: EventType) => void;
138
-
139
- /**
140
- * @description 切换抽屉时动画结束后的回调
141
- * @default -
142
- */
143
- afterVisibleChange?: (visible: boolean) => void;
144
-
145
- /**
146
- * @description 对话框外层容器的类名
147
- * @default -
148
- */
149
- className?: string;
150
-
151
- /**
152
- * @description 是否支持键盘 esc 关闭
153
- * @default true
154
- */
155
- keyboard?: boolean;
156
-
157
- /**
158
- * @description 抽屉的页脚 可以设为 footer={null}
159
- * @type ReactNode
160
- * @default (确定取消按钮)
161
- */
162
- footer?: React.ReactNode | false;
163
-
164
- /**
165
- * @description 抽屉页脚部件的样式
166
- * @default -
167
- * @type CSSProperties
168
- */
169
- footerStyle?: React.CSSProperties;
170
-
171
- /**
172
- * @description 取消按钮文本
173
- * @default 取消
174
- * @type string
175
- */
3
+ export interface IDrawerProps extends DrawerProps {
176
4
  cancelText?: string;
177
5
 
6
+ onOk?: (e: any) => void;
7
+
178
8
  /**
179
9
  * @description 确认按钮文本
180
10
  * @default 确定
@@ -0,0 +1,18 @@
1
+ import React, { Component, ErrorInfo } from 'react';
2
+ export declare type IErrorBoundaryProps = {
3
+ fallback?: (() => JSX.Element) | React.ReactNode;
4
+ children?: React.ReactNode;
5
+ };
6
+ declare type State = {
7
+ error: boolean;
8
+ };
9
+ declare class ErrorBoundary extends Component<IErrorBoundaryProps, State> {
10
+ state: State;
11
+ static defaultProps: {
12
+ fallback: () => JSX.Element;
13
+ };
14
+ static getDerivedStateFromError(error: Error): State;
15
+ componentDidCatch(error: Error, info: ErrorInfo): void;
16
+ render(): string | number | boolean | JSX.Element | React.ReactFragment;
17
+ }
18
+ export default ErrorBoundary;
@@ -0,0 +1,84 @@
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
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
+
5
+ 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); } }
6
+
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+
9
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
10
+
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
+
13
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
+
15
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
16
+
17
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
18
+
19
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
20
+
21
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
22
+
23
+ import React, { Component } from 'react';
24
+
25
+ var ErrorBoundary = /*#__PURE__*/function (_Component) {
26
+ _inherits(ErrorBoundary, _Component);
27
+
28
+ var _super = _createSuper(ErrorBoundary);
29
+
30
+ function ErrorBoundary() {
31
+ var _this;
32
+
33
+ _classCallCheck(this, ErrorBoundary);
34
+
35
+ _this = _super.apply(this, arguments);
36
+ _this.state = {
37
+ error: false
38
+ };
39
+ return _this;
40
+ }
41
+
42
+ _createClass(ErrorBoundary, [{
43
+ key: "componentDidCatch",
44
+ value: function componentDidCatch(error, info) {
45
+ console.error('ErrorBoundary:', error, info);
46
+ }
47
+ }, {
48
+ key: "render",
49
+ value: function render() {
50
+ var error = this.state.error;
51
+ var _this$props = this.props,
52
+ children = _this$props.children,
53
+ fallback = _this$props.fallback;
54
+
55
+ if (error) {
56
+ if ( /*#__PURE__*/React.isValidElement(fallback)) {
57
+ return fallback;
58
+ }
59
+
60
+ if (typeof fallback === 'function') {
61
+ return fallback();
62
+ }
63
+ }
64
+
65
+ return children;
66
+ }
67
+ }], [{
68
+ key: "getDerivedStateFromError",
69
+ value: function getDerivedStateFromError(error) {
70
+ return {
71
+ error: true
72
+ };
73
+ }
74
+ }]);
75
+
76
+ return ErrorBoundary;
77
+ }(Component);
78
+
79
+ ErrorBoundary.defaultProps = {
80
+ fallback: function fallback() {
81
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
82
+ }
83
+ };
84
+ export default ErrorBoundary;
@@ -1,3 +1,15 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+
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."); }
4
+
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); }
6
+
7
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
+
9
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
+
11
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
12
+
1
13
  import React from 'react';
2
14
  import GridList from './index';
3
15
 
@@ -5,33 +17,36 @@ function random(low, high) {
5
17
  return Math.floor(Math.random() * high) + low;
6
18
  }
7
19
 
8
- var IMAGES = Array.from({
9
- length: 60
10
- }, function (_, index) {
11
- var width = 300;
12
- var height = random(200, 300);
13
- return {
14
- url: "https://picsum.photos/id/".concat(index + 1, "/").concat(width, "/").concat(height, ".jpg"),
15
- width: width,
16
- height: height
17
- };
18
- });
20
+ var IMAGES = function IMAGES() {
21
+ return Array.from({
22
+ length: 20
23
+ }, function (_, index) {
24
+ var width = 300;
25
+ var height = random(200, 300);
26
+ return {
27
+ url: "https://picsum.photos/id/".concat(index + 1, "/").concat(width, "/").concat(height, ".jpg"),
28
+ width: width,
29
+ height: height
30
+ };
31
+ });
32
+ };
19
33
 
20
- var App = function App() {
21
- function loadNextPage(d) {
22
- return new Promise(function (resolve) {
23
- setTimeout(function () {
24
- resolve({
25
- list: IMAGES
26
- });
27
- });
28
- });
29
- }
34
+ function loadPage() {
35
+ var d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
36
+ var resultData = IMAGES();
37
+ d.page ? d.page++ : d.page = 1;
38
+ d.list ? d.list = [].concat(_toConsumableArray(d.list), _toConsumableArray(resultData)) : d.list = resultData;
39
+ return new Promise(function (resolve) {
40
+ setTimeout(function () {
41
+ return resolve(d);
42
+ }, 500);
43
+ });
44
+ }
30
45
 
46
+ var App = function App() {
31
47
  return /*#__PURE__*/React.createElement("div", {
32
48
  style: {
33
- height: 800,
34
- overflow: 'auto'
49
+ height: 400
35
50
  }
36
51
  }, /*#__PURE__*/React.createElement(GridList, {
37
52
  itemKey: "url",
@@ -52,6 +67,7 @@ var App = function App() {
52
67
  }
53
68
  }, /*#__PURE__*/React.createElement("img", {
54
69
  src: image.url,
70
+ alt: "",
55
71
  style: {
56
72
  objectFit: 'cover',
57
73
  display: 'block',
@@ -60,10 +76,7 @@ var App = function App() {
60
76
  }
61
77
  })), /*#__PURE__*/React.createElement("p", null, "\u6807\u9898"), /*#__PURE__*/React.createElement("p", null, "\u63CF\u8FF0"));
62
78
  },
63
- loadNextPage: loadNextPage,
64
- isNoMore: function isNoMore() {
65
- return false;
66
- }
79
+ loadPage: loadPage
67
80
  }));
68
81
  };
69
82
 
@@ -1,26 +1,27 @@
1
1
  import React from 'react';
2
+ import { GridListCell } from '../GridList/interface';
3
+ import { TData } from '../../useInfiniteScroll';
2
4
  export interface IDynamicGridListProps<T> {
3
- itemKey: string;
4
5
  itemHeight?: number;
5
- itemWidth?: number;
6
- loadNextPage: (d: IDynamicGridListResult<T>) => Promise<IDynamicGridListResult<T>>;
7
- reloadDep?: any;
8
- isNoMore: (d: any) => boolean;
9
- renderItem: (item: T) => React.ReactNode;
10
6
  className?: string;
11
- getGridGap?: (elementWidth: number, windowHeight: number) => number;
12
- }
13
- export interface IDynamicGridListResult<T> {
14
- list: T[];
15
- [key: string]: any;
7
+ /**
8
+ * 重载条件
9
+ */
10
+ reloadDeps?: any[];
11
+ /**
12
+ * render列表
13
+ * @param options
14
+ */
15
+ renderItem: (item: T, cell: GridListCell<T>) => React.ReactNode;
16
+ loadPage(d: TData<T>): Promise<TData<T>>;
17
+ itemWidth?: number;
18
+ itemKey: string;
19
+ getGridGap?: (...args: any) => number;
20
+ isNoMore?: (data: TData<T>) => boolean;
21
+ threshold?: number;
16
22
  }
17
- declare function DynamicGridList<T>({ itemKey, itemHeight, itemWidth, loadNextPage, reloadDep, isNoMore, renderItem, className, getGridGap }: IDynamicGridListProps<T>): JSX.Element;
23
+ declare function DynamicGridList<T>({ renderItem, itemHeight, itemKey, itemWidth, reloadDeps, getGridGap, loadPage, isNoMore, threshold, ...props }: IDynamicGridListProps<T>): JSX.Element;
18
24
  declare namespace DynamicGridList {
19
- var defaultProps: {
20
- itemWidth: number;
21
- itemHeight: number;
22
- className: string;
23
- getGridGap: () => number;
24
- };
25
+ var defaultProps: any;
25
26
  }
26
27
  export default DynamicGridList;