@cloud-app-dev/vidc 4.0.19 → 4.0.21

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 (410) hide show
  1. package/es/AppContext/Sync.d.ts +8 -0
  2. package/es/AppContext/Sync.js +42 -0
  3. package/es/AppContext/index.d.ts +10 -0
  4. package/es/AppContext/index.js +141 -0
  5. package/es/AppContext/interface.d.ts +41 -0
  6. package/es/AppContext/static.d.ts +8 -0
  7. package/es/AppContext/static.js +9 -0
  8. package/es/Auth/index.d.ts +8 -0
  9. package/es/Auth/index.js +14 -0
  10. package/es/AutoExit/index.d.ts +6 -0
  11. package/es/AutoExit/index.js +19 -0
  12. package/es/CheckGroupFixed/demo.d.ts +3 -0
  13. package/es/CheckGroupFixed/demo.js +22 -0
  14. package/es/CheckGroupFixed/index.d.ts +24 -0
  15. package/es/CheckGroupFixed/index.js +140 -0
  16. package/es/CheckGroupFixed/index.less +56 -0
  17. package/es/Config/index.d.ts +4 -0
  18. package/es/Config/index.js +77 -0
  19. package/es/Config/interface.d.ts +65 -0
  20. package/es/Config/utils.d.ts +4 -0
  21. package/es/Config/utils.js +33 -0
  22. package/es/ConfigContext/index.d.ts +17 -0
  23. package/es/ConfigContext/index.js +21 -0
  24. package/es/CustomRenderSelect/index.d.ts +12 -0
  25. package/es/CustomRenderSelect/index.js +73 -0
  26. package/es/CustomRenderSelect/index.less +25 -0
  27. package/es/DBTools/index.d.ts +25 -0
  28. package/es/DBTools/index.js +336 -0
  29. package/es/DisableMark/index.d.ts +9 -0
  30. package/es/DisableMark/index.js +19 -0
  31. package/es/DisableMark/index.less +9 -0
  32. package/es/DomMove/demo.d.ts +2 -0
  33. package/es/DomMove/demo.js +16 -0
  34. package/es/DomMove/index.d.ts +16 -0
  35. package/es/DomMove/index.js +139 -0
  36. package/es/DomMove/utils.d.ts +8 -0
  37. package/es/DomMove/utils.js +32 -0
  38. package/es/Drag/DragAndDropItem.d.ts +4 -0
  39. package/es/Drag/DragAndDropItem.js +134 -0
  40. package/es/Drag/DropItem.d.ts +4 -0
  41. package/es/Drag/DropItem.js +50 -0
  42. package/es/Drag/index.d.ts +7 -0
  43. package/es/Drag/index.js +7 -0
  44. package/es/Drag/interface.d.ts +16 -0
  45. package/es/DynamicGridList/Demo.d.ts +3 -0
  46. package/es/DynamicGridList/Demo.js +77 -0
  47. package/es/DynamicGridList/index.d.ts +24 -0
  48. package/es/DynamicGridList/index.js +67 -0
  49. package/es/DynamicList/demo.d.ts +2 -0
  50. package/es/DynamicList/demo.js +44 -0
  51. package/es/DynamicList/index.d.ts +22 -0
  52. package/es/DynamicList/index.js +86 -0
  53. package/es/DynamicList/index.less +17 -0
  54. package/es/DynamicList/interface.d.ts +19 -0
  55. package/es/DynamicList/utils.d.ts +4 -0
  56. package/es/DynamicList/utils.js +6 -0
  57. package/es/ErrorFallback/index.d.ts +9 -0
  58. package/es/ErrorFallback/index.js +31 -0
  59. package/es/ErrorFallback/inerface.d.ts +48 -0
  60. package/es/EventTools/index.d.ts +3 -0
  61. package/es/EventTools/index.js +12 -0
  62. package/es/FrontendPlayer/index.d.ts +4 -0
  63. package/es/FrontendPlayer/index.js +2 -0
  64. package/es/FullScreen/index.d.ts +22 -0
  65. package/es/FullScreen/index.js +33 -0
  66. package/es/FullScreen/index.less +18 -0
  67. package/es/GridList/Demo.d.ts +3 -0
  68. package/es/GridList/Demo.js +80 -0
  69. package/es/GridList/data.d.ts +16 -0
  70. package/es/GridList/data.js +609 -0
  71. package/es/GridList/hook.d.ts +13 -0
  72. package/es/GridList/hook.js +270 -0
  73. package/es/GridList/index.d.ts +15 -0
  74. package/es/GridList/index.js +44 -0
  75. package/es/GridList/index.less +8 -0
  76. package/es/GridList/interface.d.ts +59 -0
  77. package/es/GridList/utils.d.ts +9 -0
  78. package/es/GridList/utils.js +42 -0
  79. package/es/HightLevel/index.d.ts +9 -0
  80. package/es/HightLevel/index.js +18 -0
  81. package/es/HightLevel/index.less +3 -0
  82. package/es/IconFont/index.d.ts +12 -0
  83. package/es/IconFont/index.js +54 -0
  84. package/es/ImageView/index.d.ts +20 -0
  85. package/es/ImageView/index.js +51 -0
  86. package/es/ImageView/index.less +11 -0
  87. package/es/InstanceHistory/index.d.ts +3 -0
  88. package/es/InstanceHistory/index.js +7 -0
  89. package/es/LabelPlayer/111.png +0 -0
  90. package/es/LabelPlayer/demo.d.ts +2 -0
  91. package/es/LabelPlayer/demo.js +115 -0
  92. package/es/LabelPlayer/index.d.ts +21 -0
  93. package/es/LabelPlayer/index.js +160 -0
  94. package/es/LabelPlayer/index.less +24 -0
  95. package/es/LabelValue/index.d.ts +15 -0
  96. package/es/LabelValue/index.js +27 -0
  97. package/es/LabelValue/index.less +23 -0
  98. package/es/List/demo.d.ts +3 -0
  99. package/es/List/demo.js +23 -0
  100. package/es/List/index.d.ts +28 -0
  101. package/es/List/index.js +28 -0
  102. package/es/List/index.less +20 -0
  103. package/es/ListWithSizeAnimate/demo.d.ts +2 -0
  104. package/es/ListWithSizeAnimate/demo.js +98 -0
  105. package/es/ListWithSizeAnimate/index.d.ts +14 -0
  106. package/es/ListWithSizeAnimate/index.js +85 -0
  107. package/es/ListWithSizeAnimate/index.less +23 -0
  108. package/es/LoaderScript/index.d.ts +47 -0
  109. package/es/LoaderScript/index.js +34 -0
  110. package/es/LoaderScript/utils.d.ts +13 -0
  111. package/es/LoaderScript/utils.js +179 -0
  112. package/es/Map/AMap.d.ts +7109 -0
  113. package/es/Map/BasicMap/AMapInstance.d.ts +19 -0
  114. package/es/Map/BasicMap/AMapInstance.js +98 -0
  115. package/es/Map/BasicMap/LeafletInstance.d.ts +18 -0
  116. package/es/Map/BasicMap/LeafletInstance.js +111 -0
  117. package/es/Map/BasicMap/index.d.ts +9 -0
  118. package/es/Map/BasicMap/index.js +90 -0
  119. package/es/Map/BasicMap/index.less +29 -0
  120. package/es/Map/ClusterLayer/demo.d.ts +3 -0
  121. package/es/Map/ClusterLayer/demo.js +18 -0
  122. package/es/Map/ClusterLayer/hook.d.ts +5 -0
  123. package/es/Map/ClusterLayer/hook.js +123 -0
  124. package/es/Map/ClusterLayer/index.d.ts +6 -0
  125. package/es/Map/ClusterLayer/index.js +28 -0
  126. package/es/Map/ClusterLayer/index.less +29 -0
  127. package/es/Map/ClusterLayer/props.d.ts +8 -0
  128. package/es/Map/Config/index.d.ts +9 -0
  129. package/es/Map/Config/index.js +48 -0
  130. package/es/Map/Config/utils.d.ts +2 -0
  131. package/es/Map/Config/utils.js +65 -0
  132. package/es/Map/Context/index.d.ts +11 -0
  133. package/es/Map/Context/index.js +51 -0
  134. package/es/Map/FindPio/index.d.ts +4 -0
  135. package/es/Map/FindPio/index.js +13 -0
  136. package/es/Map/FindPio/index.less +7 -0
  137. package/es/Map/InfoWindow/MakerLikeWindow.d.ts +4 -0
  138. package/es/Map/InfoWindow/MakerLikeWindow.js +112 -0
  139. package/es/Map/InfoWindow/demo.d.ts +3 -0
  140. package/es/Map/InfoWindow/demo.js +70 -0
  141. package/es/Map/InfoWindow/index.d.ts +11 -0
  142. package/es/Map/InfoWindow/index.js +66 -0
  143. package/es/Map/LevelCenter/DragMarker/index.d.ts +10 -0
  144. package/es/Map/LevelCenter/DragMarker/index.js +42 -0
  145. package/es/Map/LevelCenter/demo.d.ts +3 -0
  146. package/es/Map/LevelCenter/demo.js +38 -0
  147. package/es/Map/LevelCenter/index.d.ts +15 -0
  148. package/es/Map/LevelCenter/index.js +66 -0
  149. package/es/Map/LoaderMap/index.d.ts +7 -0
  150. package/es/Map/LoaderMap/index.js +62 -0
  151. package/es/Map/MapDrawSelect/demo.d.ts +3 -0
  152. package/es/Map/MapDrawSelect/demo.js +71 -0
  153. package/es/Map/MapDrawSelect/index.d.ts +15 -0
  154. package/es/Map/MapDrawSelect/index.js +56 -0
  155. package/es/Map/MouseTool/index.d.ts +10 -0
  156. package/es/Map/MouseTool/index.js +40 -0
  157. package/es/Map/MouseTool/useMouseTools.d.ts +7 -0
  158. package/es/Map/MouseTool/useMouseTools.js +83 -0
  159. package/es/Map/ResetTools/index.d.ts +10 -0
  160. package/es/Map/ResetTools/index.js +57 -0
  161. package/es/Map/ResetTools/index.less +39 -0
  162. package/es/Map/SinglePoint/demo.d.ts +3 -0
  163. package/es/Map/SinglePoint/demo.js +14 -0
  164. package/es/Map/SinglePoint/index.d.ts +27 -0
  165. package/es/Map/SinglePoint/index.js +52 -0
  166. package/es/Map/SinglePoint/index.less +41 -0
  167. package/es/Map/hook/useMapEvent.d.ts +2 -0
  168. package/es/Map/hook/useMapEvent.js +19 -0
  169. package/es/Map/hook/useMapType.d.ts +4 -0
  170. package/es/Map/hook/useMapType.js +12 -0
  171. package/es/Map/icon.d.ts +2 -0
  172. package/es/Map/icon.js +10 -0
  173. package/es/Map/index.d.ts +24 -0
  174. package/es/Map/index.js +25 -0
  175. package/es/Map/interface.d.ts +74 -0
  176. package/es/Map/points.d.ts +50 -0
  177. package/es/Map/points.js +1 -0
  178. package/es/Map/useMarker/index.d.ts +10 -0
  179. package/es/Map/useMarker/index.js +71 -0
  180. package/es/Map/withMap/index.d.ts +3 -0
  181. package/es/Map/withMap/index.js +10 -0
  182. package/es/Picture/component/DefaultRects/RectInfo.d.ts +8 -0
  183. package/es/Picture/component/DefaultRects/RectInfo.js +80 -0
  184. package/es/Picture/component/DefaultRects/index.d.ts +13 -0
  185. package/es/Picture/component/DefaultRects/index.js +52 -0
  186. package/es/Picture/component/DefaultRects/index.less +211 -0
  187. package/es/Picture/component/DefaultRects/utils.d.ts +2 -0
  188. package/es/Picture/component/DefaultRects/utils.js +11 -0
  189. package/es/Picture/component/DrawRect/index.d.ts +13 -0
  190. package/es/Picture/component/DrawRect/index.js +46 -0
  191. package/es/Picture/component/DrawRect/index.less +8 -0
  192. package/es/Picture/component/RectMenu/index.d.ts +12 -0
  193. package/es/Picture/component/RectMenu/index.js +76 -0
  194. package/es/Picture/component/RectMenu/index.less +36 -0
  195. package/es/Picture/component/RectMenu/utils.d.ts +12 -0
  196. package/es/Picture/component/RectMenu/utils.js +19 -0
  197. package/es/Picture/component/Tools/index.d.ts +12 -0
  198. package/es/Picture/component/Tools/index.js +73 -0
  199. package/es/Picture/component/Tools/index.less +49 -0
  200. package/es/Picture/component/WheelScale/index.d.ts +7 -0
  201. package/es/Picture/component/WheelScale/index.js +27 -0
  202. package/es/Picture/demo.d.ts +2 -0
  203. package/es/Picture/demo.js +105 -0
  204. package/es/Picture/index.d.ts +5 -0
  205. package/es/Picture/index.js +341 -0
  206. package/es/Picture/index.less +20 -0
  207. package/es/Picture/interface.d.ts +196 -0
  208. package/es/Picture/loadCaptureRectImage.d.ts +3 -0
  209. package/es/Picture/loadCaptureRectImage.js +99 -0
  210. package/es/Picture/useDraw.d.ts +1 -0
  211. package/es/Picture/useDraw.js +103 -0
  212. package/es/Picture/utils.d.ts +26 -0
  213. package/es/Picture/utils.js +143 -0
  214. package/es/Player/api/index.d.ts +68 -0
  215. package/es/Player/api/index.js +309 -0
  216. package/es/Player/context.d.ts +17 -0
  217. package/es/Player/context.js +24 -0
  218. package/es/Player/contraller_bar/bar.d.ts +8 -0
  219. package/es/Player/contraller_bar/bar.js +20 -0
  220. package/es/Player/contraller_bar/contraller_event.d.ts +6 -0
  221. package/es/Player/contraller_bar/contraller_event.js +50 -0
  222. package/es/Player/contraller_bar/index.d.ts +14 -0
  223. package/es/Player/contraller_bar/index.js +27 -0
  224. package/es/Player/contraller_bar/left_bar.d.ts +10 -0
  225. package/es/Player/contraller_bar/left_bar.js +83 -0
  226. package/es/Player/contraller_bar/right_bar.d.ts +8 -0
  227. package/es/Player/contraller_bar/right_bar.js +32 -0
  228. package/es/Player/contraller_bar/time.d.ts +3 -0
  229. package/es/Player/contraller_bar/time.js +19 -0
  230. package/es/Player/contraller_bar/useBarStatus.d.ts +2 -0
  231. package/es/Player/contraller_bar/useBarStatus.js +43 -0
  232. package/es/Player/contraller_bar/volume.d.ts +9 -0
  233. package/es/Player/contraller_bar/volume.js +62 -0
  234. package/es/Player/demo.d.ts +3 -0
  235. package/es/Player/demo.js +266 -0
  236. package/es/Player/empty.d.ts +2 -0
  237. package/es/Player/empty.js +4 -0
  238. package/es/Player/event/errorEvent.d.ts +14 -0
  239. package/es/Player/event/errorEvent.js +88 -0
  240. package/es/Player/event/eventName.d.ts +18 -0
  241. package/es/Player/event/eventName.js +29 -0
  242. package/es/Player/event/index.d.ts +24 -0
  243. package/es/Player/event/index.js +205 -0
  244. package/es/Player/fps_play.d.ts +11 -0
  245. package/es/Player/fps_play.js +83 -0
  246. package/es/Player/frontend_player.d.ts +8 -0
  247. package/es/Player/frontend_player.js +64 -0
  248. package/es/Player/frontend_timeline.d.ts +10 -0
  249. package/es/Player/frontend_timeline.js +132 -0
  250. package/es/Player/iconfont.d.ts +5 -0
  251. package/es/Player/iconfont.js +16 -0
  252. package/es/Player/index.d.ts +2 -0
  253. package/es/Player/index.js +2 -0
  254. package/es/Player/live_heart.d.ts +8 -0
  255. package/es/Player/live_heart.js +45 -0
  256. package/es/Player/message.d.ts +5 -0
  257. package/es/Player/message.js +137 -0
  258. package/es/Player/player.d.ts +233 -0
  259. package/es/Player/segment_player.d.ts +9 -0
  260. package/es/Player/segment_player.js +228 -0
  261. package/es/Player/segment_timeline.d.ts +12 -0
  262. package/es/Player/segment_timeline.js +173 -0
  263. package/es/Player/single_player.d.ts +5 -0
  264. package/es/Player/single_player.js +262 -0
  265. package/es/Player/style/bar.less +43 -0
  266. package/es/Player/style/iconfont.js +43 -0
  267. package/es/Player/style/index.less +34 -0
  268. package/es/Player/style/message.less +56 -0
  269. package/es/Player/style/slider.less +106 -0
  270. package/es/Player/style/timeline.less +117 -0
  271. package/es/Player/style/volume.less +24 -0
  272. package/es/Player/timeline.d.ts +5 -0
  273. package/es/Player/timeline.js +95 -0
  274. package/es/Player/util.d.ts +43 -0
  275. package/es/Player/util.js +189 -0
  276. package/es/PlayerExt/demo.d.ts +3 -0
  277. package/es/PlayerExt/demo.js +154 -0
  278. package/es/PlayerExt/index.d.ts +48 -0
  279. package/es/PlayerExt/index.js +188 -0
  280. package/es/PlayerExt/index.less +10 -0
  281. package/es/Progress/index.d.ts +7 -0
  282. package/es/Progress/index.js +53 -0
  283. package/es/Progress/index.less +21 -0
  284. package/es/ROI/demo.d.ts +3 -0
  285. package/es/ROI/demo.js +16 -0
  286. package/es/ROI/index.d.ts +33 -0
  287. package/es/ROI/index.js +54 -0
  288. package/es/ROI/index.less +33 -0
  289. package/es/RefDrawer/Footer.d.ts +9 -0
  290. package/es/RefDrawer/Footer.js +22 -0
  291. package/es/RefDrawer/demo.d.ts +3 -0
  292. package/es/RefDrawer/demo.js +18 -0
  293. package/es/RefDrawer/index.d.ts +26 -0
  294. package/es/RefDrawer/index.js +71 -0
  295. package/es/RefModal/demo.d.ts +3 -0
  296. package/es/RefModal/demo.js +18 -0
  297. package/es/RefModal/index.d.ts +17 -0
  298. package/es/RefModal/index.js +70 -0
  299. package/es/ScreenPlayer/Live.d.ts +5 -0
  300. package/es/ScreenPlayer/Live.js +212 -0
  301. package/es/ScreenPlayer/LiveTools.d.ts +29 -0
  302. package/es/ScreenPlayer/LiveTools.js +151 -0
  303. package/es/ScreenPlayer/PlayerWithExt.d.ts +34 -0
  304. package/es/ScreenPlayer/PlayerWithExt.js +231 -0
  305. package/es/ScreenPlayer/RatePick.d.ts +8 -0
  306. package/es/ScreenPlayer/RatePick.js +29 -0
  307. package/es/ScreenPlayer/Record.d.ts +10 -0
  308. package/es/ScreenPlayer/Record.js +442 -0
  309. package/es/ScreenPlayer/RecordTools.d.ts +38 -0
  310. package/es/ScreenPlayer/RecordTools.js +197 -0
  311. package/es/ScreenPlayer/ScreenSelect.d.ts +7 -0
  312. package/es/ScreenPlayer/ScreenSelect.js +46 -0
  313. package/es/ScreenPlayer/SegmentTimeLine.d.ts +17 -0
  314. package/es/ScreenPlayer/SegmentTimeLine.js +36 -0
  315. package/es/ScreenPlayer/TimeMode.d.ts +7 -0
  316. package/es/ScreenPlayer/TimeMode.js +26 -0
  317. package/es/ScreenPlayer/TimeSelect.d.ts +7 -0
  318. package/es/ScreenPlayer/TimeSelect.js +88 -0
  319. package/es/ScreenPlayer/demo.d.ts +2 -0
  320. package/es/ScreenPlayer/demo.js +21 -0
  321. package/es/ScreenPlayer/demo2.d.ts +2 -0
  322. package/es/ScreenPlayer/demo2.js +194 -0
  323. package/es/ScreenPlayer/index.d.ts +6 -0
  324. package/es/ScreenPlayer/index.js +9 -0
  325. package/es/ScreenPlayer/index.less +335 -0
  326. package/es/ScreenPlayer/interface.d.ts +216 -0
  327. package/es/ScreenPlayer/useTimeSlider.d.ts +25 -0
  328. package/es/ScreenPlayer/useTimeSlider.js +451 -0
  329. package/es/ScreenPlayer/useVideoFit.d.ts +5 -0
  330. package/es/ScreenPlayer/useVideoFit.js +35 -0
  331. package/es/ScreenPlayer/utils.d.ts +17 -0
  332. package/es/ScreenPlayer/utils.js +85 -0
  333. package/es/SegmentPlayer/index.d.ts +2 -0
  334. package/es/SegmentPlayer/index.js +2 -0
  335. package/es/Service/http.d.ts +6 -0
  336. package/es/Service/http.js +133 -0
  337. package/es/Service/index.d.ts +3 -0
  338. package/es/Service/index.js +11 -0
  339. package/es/Service/interface.d.ts +23 -0
  340. package/es/Service/middleware.d.ts +8 -0
  341. package/es/Service/middleware.js +22 -0
  342. package/es/SocketEmitter/eventEmitter.d.ts +27 -0
  343. package/es/SocketEmitter/eventEmitter.js +88 -0
  344. package/es/SocketEmitter/index.d.ts +24 -0
  345. package/es/SocketEmitter/index.js +125 -0
  346. package/es/SocketEmitter/interface.d.ts +4 -0
  347. package/es/TableLayout/index.d.ts +10 -0
  348. package/es/TableLayout/index.js +27 -0
  349. package/es/TableLayout/index.less +4 -0
  350. package/es/ThemeAntd/demo.d.ts +4 -0
  351. package/es/ThemeAntd/demo.js +81 -0
  352. package/es/ThemeAntd/demo.less +20 -0
  353. package/es/ThemeAntd/index.d.ts +7 -0
  354. package/es/ThemeAntd/index.js +21 -0
  355. package/es/ThemeAntd/index.less +4 -0
  356. package/es/Timeout/index.d.ts +26 -0
  357. package/es/Timeout/index.js +65 -0
  358. package/es/bigNumberTransformCN/index.d.ts +5 -0
  359. package/es/bigNumberTransformCN/index.js +58 -0
  360. package/es/cache/index.d.ts +34 -0
  361. package/es/cache/index.js +94 -0
  362. package/es/copy/index.d.ts +1 -0
  363. package/es/copy/index.js +9 -0
  364. package/es/core.d.ts +0 -0
  365. package/es/getThemeStyle/index.d.ts +2 -0
  366. package/es/getThemeStyle/index.js +5 -0
  367. package/es/index.d.ts +62 -0
  368. package/es/index.js +62 -0
  369. package/es/likeGo/index.d.ts +2 -0
  370. package/es/likeGo/index.js +31 -0
  371. package/es/likeGoSync/index.d.ts +2 -0
  372. package/es/likeGoSync/index.js +10 -0
  373. package/es/logger/index.d.ts +7 -0
  374. package/es/logger/index.js +30 -0
  375. package/es/nextTick/index.d.ts +1 -0
  376. package/es/nextTick/index.js +3 -0
  377. package/es/recorder/demo.d.ts +3 -0
  378. package/es/recorder/demo.js +181 -0
  379. package/es/recorder/index.d.ts +294 -0
  380. package/es/recorder/index.js +992 -0
  381. package/es/submidstr/index.d.ts +5 -0
  382. package/es/submidstr/index.js +14 -0
  383. package/es/treeHelper/index.d.ts +11 -0
  384. package/es/treeHelper/index.js +188 -0
  385. package/es/typings.d.ts +2 -0
  386. package/es/useDrawROI/index.d.ts +16 -0
  387. package/es/useDrawROI/index.js +318 -0
  388. package/es/useEventEmitterHandle/index.d.ts +2 -0
  389. package/es/useEventEmitterHandle/index.js +17 -0
  390. package/es/useFullscreen/demo.d.ts +2 -0
  391. package/es/useFullscreen/demo.js +43 -0
  392. package/es/useFullscreen/index.d.ts +12 -0
  393. package/es/useFullscreen/index.js +76 -0
  394. package/es/useHistory/index.d.ts +3 -0
  395. package/es/useHistory/index.js +9 -0
  396. package/es/useHistory/interface.d.ts +3 -0
  397. package/es/useInfiniteScroll/index.d.ts +16 -0
  398. package/es/useInfiniteScroll/index.js +102 -0
  399. package/es/useRafInterval/index.d.ts +5 -0
  400. package/es/useRafInterval/index.js +71 -0
  401. package/es/useSimpleState/index.d.ts +3 -0
  402. package/es/useSimpleState/index.js +35 -0
  403. package/es/useVirtualList/index.d.ts +13 -0
  404. package/es/useVirtualList/index.js +136 -0
  405. package/es/utils.d.ts +14 -0
  406. package/es/utils.js +46 -0
  407. package/es/uuid/index.d.ts +5 -0
  408. package/es/uuid/index.js +6 -0
  409. package/package.json +1 -1
  410. package/tsconfig.json +1 -1
@@ -0,0 +1,341 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["className", "width", "height", "minHeight", "disabledDrag", "imagePath", "rects", "isOpenSelect", "disabledDrawMenu", "menus", "hasTool", "fullScreenEle"];
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
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."); }
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); }
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
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
15
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
16
+ import { useMemoizedFn, useSize, useUpdateEffect, useUpdateLayoutEffect } from 'ahooks';
17
+ import React, { useEffect, useMemo, useRef } from 'react';
18
+ import DomMove from "../DomMove";
19
+ import useSimpleState from "../useSimpleState";
20
+ import DefaultRects from "./component/DefaultRects";
21
+ import DrawRect from "./component/DrawRect";
22
+ import Tools from "./component/Tools";
23
+ import WheelScale from "./component/WheelScale";
24
+ import { getRectImagePath } from "./loadCaptureRectImage";
25
+ import useDraw from "./useDraw";
26
+ import { computedRectScale, customContextMenu, getImgSize } from "./utils";
27
+ import "./index.less";
28
+ function Picture(_ref) {
29
+ var _layoutRef$current;
30
+ var _ref$className = _ref.className,
31
+ className = _ref$className === void 0 ? '' : _ref$className,
32
+ _ref$width = _ref.width,
33
+ width = _ref$width === void 0 ? '100%' : _ref$width,
34
+ _ref$height = _ref.height,
35
+ height = _ref$height === void 0 ? '100%' : _ref$height,
36
+ _ref$minHeight = _ref.minHeight,
37
+ minHeight = _ref$minHeight === void 0 ? 300 : _ref$minHeight,
38
+ _ref$disabledDrag = _ref.disabledDrag,
39
+ disabledDrag = _ref$disabledDrag === void 0 ? false : _ref$disabledDrag,
40
+ imagePath = _ref.imagePath,
41
+ _ref$rects = _ref.rects,
42
+ rects = _ref$rects === void 0 ? [] : _ref$rects,
43
+ _ref$isOpenSelect = _ref.isOpenSelect,
44
+ isOpenSelect = _ref$isOpenSelect === void 0 ? false : _ref$isOpenSelect,
45
+ _ref$disabledDrawMenu = _ref.disabledDrawMenu,
46
+ disabledDrawMenu = _ref$disabledDrawMenu === void 0 ? false : _ref$disabledDrawMenu,
47
+ _ref$menus = _ref.menus,
48
+ menus = _ref$menus === void 0 ? [] : _ref$menus,
49
+ _ref$hasTool = _ref.hasTool,
50
+ hasTool = _ref$hasTool === void 0 ? true : _ref$hasTool,
51
+ fullScreenEle = _ref.fullScreenEle,
52
+ props = _objectWithoutProperties(_ref, _excluded);
53
+ var _useMemo = useMemo(function () {
54
+ return props;
55
+ }, [props]),
56
+ imgDownload = _useMemo.imgDownload,
57
+ onClickRect = _useMemo.onClickRect,
58
+ onMenuClick = _useMemo.onMenuClick,
59
+ children = _useMemo.children;
60
+ var _useSimpleState = useSimpleState({
61
+ x: 0,
62
+ y: 0,
63
+ rotate: 0,
64
+ scale: 1,
65
+ baseXOrY: 'x',
66
+ forceUpdateKey: Date.now(),
67
+ loadedTime: 0,
68
+ fullScreenStatus: false,
69
+ localUrl: '',
70
+ offset: [0, 0],
71
+ size: ['auto', 'auto']
72
+ }),
73
+ _useSimpleState2 = _slicedToArray(_useSimpleState, 3),
74
+ state = _useSimpleState2[0],
75
+ updateState = _useSimpleState2[1],
76
+ setState = _useSimpleState2[2];
77
+ var layoutRef = useRef(null);
78
+ var moveActionRef = useRef(null);
79
+ var domImgRef = useRef(null);
80
+ var size = useSize(layoutRef);
81
+ useEffect(function () {
82
+ if (!imagePath) {
83
+ return undefined;
84
+ }
85
+ var localUrl;
86
+ fetch(imagePath).then(function (res) {
87
+ return res.blob();
88
+ }).then(function (blob) {
89
+ localUrl = URL.createObjectURL(blob);
90
+ updateState({
91
+ localUrl: localUrl
92
+ });
93
+ }).catch(function (e) {
94
+ console.error(e);
95
+ });
96
+ return function () {
97
+ return URL.revokeObjectURL(localUrl);
98
+ };
99
+ }, [imagePath]);
100
+
101
+ // draw hooks
102
+ var _useDraw = useDraw((_layoutRef$current = layoutRef.current) === null || _layoutRef$current === void 0 ? void 0 : _layoutRef$current.querySelector('.picture-overlay'), isOpenSelect),
103
+ _useDraw2 = _slicedToArray(_useDraw, 2),
104
+ selectArea = _useDraw2[0],
105
+ isEnd = _useDraw2[1];
106
+
107
+ // init loaded
108
+ var loadImageSuccess = useMemoizedFn(function () {
109
+ if (!state.localUrl || !layoutRef.current || !domImgRef.current) {
110
+ return;
111
+ }
112
+ var _getImgSize = getImgSize(layoutRef.current, domImgRef.current),
113
+ x = _getImgSize.x,
114
+ y = _getImgSize.y,
115
+ size = _getImgSize.size,
116
+ baseXOrY = _getImgSize.baseXOrY;
117
+ var moveObj = moveActionRef.current;
118
+ moveObj.updatePosition({
119
+ x: x,
120
+ y: y
121
+ });
122
+ setState(function (old) {
123
+ return _objectSpread(_objectSpread({}, old), {}, {
124
+ x: x,
125
+ y: y,
126
+ offset: [x, y],
127
+ baseXOrY: baseXOrY,
128
+ size: size,
129
+ loadedTime: Date.now()
130
+ });
131
+ });
132
+ });
133
+
134
+ // 更新重绘
135
+ useUpdateLayoutEffect(function () {
136
+ loadImageSuccess();
137
+ }, [size]);
138
+
139
+ // 更新重绘
140
+ useUpdateLayoutEffect(function () {
141
+ // Rects重新计算
142
+ updateState({
143
+ forceUpdateKey: Date.now()
144
+ });
145
+ }, [state.loadedTime]);
146
+
147
+ /**
148
+ * 设置图片缩放
149
+ */
150
+ var setScale = useMemoizedFn(function (changeValue) {
151
+ var currentValue = state.scale;
152
+ if (currentValue === 3 && changeValue > 0) {
153
+ return;
154
+ }
155
+ if (currentValue === 1 && changeValue < 0) {
156
+ return;
157
+ }
158
+ var scale = currentValue + changeValue;
159
+ if (scale > 3) {
160
+ scale = 3;
161
+ }
162
+ if (scale < 1) {
163
+ scale = 1;
164
+ }
165
+ setState(function (old) {
166
+ return _objectSpread(_objectSpread({}, old), {}, {
167
+ scale: scale
168
+ });
169
+ });
170
+ });
171
+
172
+ /**
173
+ * 设置图谱旋转
174
+ */
175
+ var setRotate = useMemoizedFn(function (changeValue) {
176
+ var currentValue = state.rotate;
177
+ setState(function (old) {
178
+ return _objectSpread(_objectSpread({}, old), {}, {
179
+ rotate: currentValue + changeValue
180
+ });
181
+ });
182
+ });
183
+
184
+ /**
185
+ * 重置图片位置
186
+ */
187
+ var resetPicture = useMemoizedFn(function (event) {
188
+ event.stopPropagation();
189
+ var moveObj = moveActionRef.current;
190
+ setState(function (old) {
191
+ return _objectSpread(_objectSpread({}, old), {}, {
192
+ scale: 1,
193
+ rotate: 0
194
+ });
195
+ });
196
+ moveObj.updatePosition({
197
+ x: state.offset[0],
198
+ y: state.offset[1]
199
+ });
200
+ });
201
+
202
+ /**
203
+ * 拖拽更新位置
204
+ */
205
+ var onDragChange = useMemoizedFn(function (_ref2) {
206
+ var x = _ref2.x,
207
+ y = _ref2.y;
208
+ return setState(function (old) {
209
+ return _objectSpread(_objectSpread({}, old), {}, {
210
+ x: x,
211
+ y: y
212
+ });
213
+ });
214
+ });
215
+
216
+ /**
217
+ * 拖拽结束更新位置,计算边界
218
+ */
219
+ var onDragEnd = useMemoizedFn(function (_, currrentPosition) {
220
+ if (!layoutRef.current || !domImgRef.current) {
221
+ return undefined;
222
+ }
223
+ var _ref3 = size || {
224
+ width: 0,
225
+ height: 0
226
+ },
227
+ width = _ref3.width,
228
+ height = _ref3.height;
229
+ var imgw = domImgRef.current.width * state.scale;
230
+ var imgh = domImgRef.current.height * state.scale;
231
+ var scaleW = imgw - domImgRef.current.width;
232
+ var scaleH = imgh - domImgRef.current.height;
233
+
234
+ // 校验x,y范围,超出回弹
235
+ var maxX = imgw < width ? width - imgw + scaleW / 2 : scaleW / 2;
236
+ var maxY = imgh < height ? height - imgh + scaleH / 2 : scaleH / 2;
237
+ var minX = imgw < width ? scaleW / 2 : -(imgw - width) / 2 + state.offset[0];
238
+ var minY = imgh < height ? scaleH / 2 : -(imgh - height) / 2 + state.offset[1];
239
+ var x = currrentPosition.x > maxX ? maxX : currrentPosition.x < minX ? minX : currrentPosition.x;
240
+ var y = currrentPosition.y > maxY ? maxY : currrentPosition.y < minY ? minY : currrentPosition.y;
241
+ var moveObj = moveActionRef.current;
242
+ moveObj.updatePosition({
243
+ x: x,
244
+ y: y
245
+ });
246
+ });
247
+
248
+ /**
249
+ * 获取结构化的小图(base64)
250
+ */
251
+ var getRectImage = useMemoizedFn(function (rect) {
252
+ return getRectImagePath(domImgRef.current, rect);
253
+ });
254
+
255
+ // eslint-disable-next-line react-hooks/exhaustive-deps
256
+ var scaleRects = useMemo(function () {
257
+ return computedRectScale({
258
+ domImg: domImgRef.current,
259
+ rects: rects !== null && rects !== void 0 ? rects : []
260
+ });
261
+ }, [rects, state.forceUpdateKey]);
262
+ var isEmpty = useMemo(function () {
263
+ return selectArea.includes(0);
264
+ }, [selectArea]);
265
+ var renderOptions = {
266
+ isEnd: isEnd,
267
+ isOpenSelect: isOpenSelect,
268
+ selectArea: selectArea,
269
+ getRectImage: getRectImage,
270
+ containerEle: layoutRef.current
271
+ };
272
+ useUpdateEffect(function () {
273
+ if (isOpenSelect) {
274
+ var moveObj = moveActionRef.current;
275
+ moveObj.updatePosition({
276
+ x: state.offset[0],
277
+ y: state.offset[1]
278
+ });
279
+ updateState({
280
+ scale: 1,
281
+ rotate: 0,
282
+ x: state.offset[0],
283
+ y: state.offset[1]
284
+ });
285
+ }
286
+ }, [isOpenSelect]);
287
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
288
+ className: "picture-view-layout ".concat(className),
289
+ style: {
290
+ width: width,
291
+ height: height,
292
+ minHeight: minHeight
293
+ },
294
+ ref: layoutRef,
295
+ onContextMenu: customContextMenu
296
+ }, /*#__PURE__*/React.createElement(DomMove, {
297
+ className: "picture-move-layout",
298
+ disabled: isOpenSelect || disabledDrag,
299
+ ref: moveActionRef,
300
+ onDragChange: onDragChange,
301
+ onDragEnd: onDragEnd
302
+ }, /*#__PURE__*/React.createElement("div", {
303
+ className: "picture-overlay",
304
+ style: {
305
+ transform: "scale(".concat(state.scale, ") rotate(").concat(state.rotate, "deg)")
306
+ }
307
+ }, /*#__PURE__*/React.createElement("img", {
308
+ ref: domImgRef,
309
+ draggable: false,
310
+ src: state.localUrl,
311
+ style: {
312
+ width: state.size[0],
313
+ height: state.size[1]
314
+ },
315
+ "data-src": imagePath,
316
+ onLoad: loadImageSuccess
317
+ }), !isEmpty ? /*#__PURE__*/React.createElement(DrawRect, {
318
+ rect: selectArea,
319
+ onMenuClick: onMenuClick,
320
+ getRectImage: getRectImage,
321
+ menus: menus !== null && menus !== void 0 ? menus : [],
322
+ canRenderMenu: isEnd && !disabledDrawMenu && menus && menus.length > 0,
323
+ containerDom: layoutRef.current
324
+ }) : !isOpenSelect ? /*#__PURE__*/React.createElement(DefaultRects, {
325
+ rects: scaleRects,
326
+ onClickRect: onClickRect,
327
+ getRectImage: getRectImage,
328
+ containerDom: layoutRef.current
329
+ }) : null)), hasTool && /*#__PURE__*/React.createElement(Tools, {
330
+ setScale: setScale,
331
+ setRotate: setRotate,
332
+ scale: state.scale,
333
+ containerEle: fullScreenEle !== null && fullScreenEle !== void 0 ? fullScreenEle : layoutRef.current,
334
+ resetPicture: resetPicture,
335
+ imgDownload: imgDownload
336
+ }), /*#__PURE__*/React.createElement(WheelScale, {
337
+ setScale: setScale,
338
+ dom: layoutRef.current
339
+ })), children === null || children === void 0 ? void 0 : children(renderOptions));
340
+ }
341
+ export default Picture;
@@ -0,0 +1,20 @@
1
+ .picture-view-layout {
2
+ position: relative;
3
+ min-height: 300px;
4
+ overflow: hidden;
5
+ user-select: none;
6
+
7
+ .picture-move-layout {
8
+ & > div {
9
+ width: max-content;
10
+ height: max-content;
11
+ transition: all .3s;
12
+ overflow: hidden;
13
+
14
+ img {
15
+ max-width: 100%;
16
+ max-height: 100%;
17
+ }
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,196 @@
1
+ export type MenuRectType = {
2
+ /**
3
+ * 路由地址
4
+ */
5
+ pathname: string;
6
+
7
+ /**
8
+ * 标题
9
+ */
10
+ title: string;
11
+
12
+ /**
13
+ * 图标
14
+ */
15
+ icon: string;
16
+
17
+ /**
18
+ * 内部属性,忽略
19
+ */
20
+ base64?: string;
21
+ };
22
+
23
+ export type TagItemType = {
24
+ /**
25
+ * 标签值 code
26
+ */
27
+ value: string;
28
+
29
+ /**
30
+ * 标签对应文本
31
+ */
32
+ label: string;
33
+
34
+ /**
35
+ * 标签图标
36
+ */
37
+ icon: string;
38
+
39
+ /**
40
+ *标签title属性
41
+ */
42
+ titleAttr?: string;
43
+ };
44
+
45
+ export type ImageType = 'face' | 'body' | 'nonVehicle' | 'vehicle' | 'thing';
46
+
47
+ export type RectType = {
48
+ /**
49
+ * 矩形框坐标 [left,top,width,height]
50
+ */
51
+ rect: Array<number>;
52
+ /**
53
+ * 'face' | 'body' | 'nonVehicle' | 'vehicle' | 'thing'
54
+ */
55
+ type: ImageType;
56
+
57
+ /**
58
+ * 矩形是否需要扩大,根据类型扩大计算公式
59
+ */
60
+ needExpand?: boolean;
61
+
62
+ /**
63
+ * 图片id
64
+ */
65
+ imgId?: string;
66
+
67
+ /**
68
+ * 矩形面积,通过面积控制矩形层级
69
+ */
70
+ area?: number;
71
+
72
+ /**
73
+ * 矩形中对象对应的标签
74
+ */
75
+ tags?: TagItemType[];
76
+
77
+ /**
78
+ * 小图的地址
79
+ */
80
+ imgUrl?: string;
81
+
82
+ /**
83
+ * 是否默认
84
+ */
85
+ isDefault?: boolean;
86
+
87
+ /**
88
+ * 重复标记
89
+ */
90
+ dupId?: string;
91
+
92
+ /**
93
+ * 低质量标记
94
+ */
95
+ lowQuality?: boolean;
96
+
97
+ /**
98
+ * 内部属性,忽略
99
+ */
100
+ base64?: string;
101
+ };
102
+
103
+ export type PositionType = {
104
+ x: number;
105
+ y: number;
106
+ };
107
+
108
+ export type DeviationType = {
109
+ offsetX: number;
110
+ offsetY: number;
111
+ width: number | string;
112
+ height: number | string;
113
+ };
114
+
115
+ export type SizeType = {
116
+ width: number | string;
117
+ height: number | string;
118
+ };
119
+
120
+ export interface IPictureProps {
121
+ /**
122
+ * 容器类名
123
+ */
124
+ className?: string;
125
+
126
+ /**
127
+ * 容器宽度
128
+ */
129
+ width?: number | string;
130
+
131
+ /**
132
+ * 容器高度
133
+ */
134
+ height?: number | string;
135
+
136
+ /**
137
+ * 容器最小高度
138
+ */
139
+ minHeight?: number | string;
140
+
141
+ /**
142
+ * 禁止拓展状态
143
+ */
144
+ disabledDrag?: boolean;
145
+
146
+ /**
147
+ * 图片地址
148
+ */
149
+ imagePath: string;
150
+
151
+ /**
152
+ * 目标框的对象
153
+ */
154
+ rects?: RectType[];
155
+
156
+ /**
157
+ * 开启自定义框选
158
+ */
159
+ isOpenSelect?: boolean;
160
+
161
+ /**
162
+ * 禁止框选 后的菜单项
163
+ */
164
+ disabledDrawMenu?: boolean;
165
+
166
+ /**
167
+ * 框选 后的菜单项
168
+ */
169
+ menus?: MenuRectType[];
170
+
171
+ /**
172
+ * 图片下载
173
+ */
174
+ imgDownload?: () => void;
175
+
176
+ /**
177
+ * 点击框事件
178
+ */
179
+ onClickRect?: (item: RectType) => void;
180
+
181
+ /**
182
+ * 菜单点击事件
183
+ */
184
+ onMenuClick?: (item: MenuRectType) => void;
185
+ children?: (option: any) => void;
186
+
187
+ /**
188
+ * 显示工具栏
189
+ */
190
+ hasTool?: boolean;
191
+
192
+ /**
193
+ * 全屏的dom节点
194
+ */
195
+ fullScreenEle?: Element;
196
+ }
@@ -0,0 +1,3 @@
1
+ import { ImageType } from './interface';
2
+ export declare function loadCaptureRectImage(image: HTMLImageElement, rect: number[], imageType: ImageType): Promise<string>;
3
+ export declare function getRectImagePath(image: HTMLImageElement, rect: number[]): string;
@@ -0,0 +1,99 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ 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 e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
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
+ 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; }
7
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
10
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
11
+ import { getCaptureRect } from "./utils";
12
+ export function loadCaptureRectImage(_x, _x2, _x3) {
13
+ return _loadCaptureRectImage.apply(this, arguments);
14
+ }
15
+ function _loadCaptureRectImage() {
16
+ _loadCaptureRectImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(image, rect, imageType) {
17
+ var _getCaptureRect, _getCaptureRect2, x, y, w, h, canvas, ctx, url;
18
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
19
+ while (1) switch (_context.prev = _context.next) {
20
+ case 0:
21
+ if (image) {
22
+ _context.next = 2;
23
+ break;
24
+ }
25
+ throw Error('image is HTMLImgElement');
26
+ case 2:
27
+ _getCaptureRect = getCaptureRect(rect, imageType), _getCaptureRect2 = _slicedToArray(_getCaptureRect, 4), x = _getCaptureRect2[0], y = _getCaptureRect2[1], w = _getCaptureRect2[2], h = _getCaptureRect2[3];
28
+ canvas = document.createElement('canvas');
29
+ ctx = canvas.getContext('2d');
30
+ canvas.width = image.width;
31
+ canvas.height = image.height;
32
+ ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
33
+ ctx.beginPath();
34
+ ctx.strokeStyle = 'red';
35
+ ctx.lineWidth = 3;
36
+ ctx.strokeRect(x, y, w, h);
37
+ url = canvas.toDataURL();
38
+ setTimeout(function () {
39
+ canvas.remove();
40
+ canvas = null;
41
+ ctx = null;
42
+ }, 500);
43
+ return _context.abrupt("return", url);
44
+ case 15:
45
+ case "end":
46
+ return _context.stop();
47
+ }
48
+ }, _callee);
49
+ }));
50
+ return _loadCaptureRectImage.apply(this, arguments);
51
+ }
52
+ export function getRectImagePath(image, rect) {
53
+ var _rect = _slicedToArray(rect, 4),
54
+ x = _rect[0],
55
+ y = _rect[1],
56
+ w = _rect[2],
57
+ h = _rect[3];
58
+ var naturalWidth = image.naturalWidth,
59
+ naturalHeight = image.naturalHeight,
60
+ width = image.width,
61
+ height = image.height;
62
+ var sourceSize = {
63
+ width: naturalWidth,
64
+ height: naturalHeight,
65
+ cwidth: width,
66
+ cheight: height,
67
+ wScale: naturalWidth / width,
68
+ hScale: naturalHeight / height
69
+ };
70
+ var area = [x * sourceSize.wScale, y * sourceSize.hScale, w * sourceSize.wScale, h * sourceSize.hScale];
71
+ var fullCanvas = document.createElement('canvas');
72
+ var fullCtx = fullCanvas.getContext('2d');
73
+ fullCanvas.width = naturalWidth;
74
+ fullCanvas.height = naturalHeight;
75
+ fullCtx.save();
76
+ // fullCtx.transform;
77
+ // document.body.appendChild(fullCanvas);
78
+ fullCtx.translate(naturalWidth / 2, naturalHeight / 2);
79
+ fullCtx.drawImage(image, -naturalWidth / 2, -naturalHeight / 2, naturalWidth, naturalHeight);
80
+ fullCtx.restore();
81
+ var imageData = fullCtx.getImageData(area[0], area[1], area[2], area[3]);
82
+ var tempCanvas = document.createElement('canvas');
83
+ var tempCtx = tempCanvas.getContext('2d');
84
+ tempCanvas.width = area[2];
85
+ tempCanvas.height = area[3];
86
+ // document.body.appendChild(tempCanvas);
87
+ tempCtx.putImageData(imageData, 0, 0);
88
+ var dataUrl = tempCanvas.toDataURL();
89
+ setTimeout(function () {
90
+ fullCanvas.remove();
91
+ tempCanvas.remove();
92
+ fullCanvas = null;
93
+ tempCanvas = null;
94
+ tempCtx = null;
95
+ fullCtx = null;
96
+ imageData = null;
97
+ }, 100);
98
+ return dataUrl;
99
+ }
@@ -0,0 +1 @@
1
+ export default function useDraw(dom: HTMLElement, open?: boolean): [number[], boolean];