@cloud-app-dev/vidc 3.2.11 → 3.2.14

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 (347) hide show
  1. package/.dumirc.ts +71 -0
  2. package/.editorconfig +0 -3
  3. package/.eslintrc.js +3 -0
  4. package/.fatherrc.ts +19 -0
  5. package/.husky/commit-msg +5 -0
  6. package/.husky/pre-commit +4 -0
  7. package/.prettierrc.js +16 -0
  8. package/README.md +14 -26
  9. package/es/Api/index.js +100 -30
  10. package/es/AppContext/Sync.js +19 -3
  11. package/es/AppContext/index.js +86 -42
  12. package/es/AppContext/static.js +7 -0
  13. package/es/Auth/index.js +11 -4
  14. package/es/AutoExit/index.js +11 -3
  15. package/es/Box/BetweenBox/index.js +19 -10
  16. package/es/Box/BetweenBox/{index.css → index.less} +0 -0
  17. package/es/Box/InfoBox/index.js +24 -18
  18. package/es/Box/InfoBox/index.less +22 -0
  19. package/es/Box/TwoColumnBox/index.js +42 -25
  20. package/es/Box/TwoColumnBox/index.less +70 -0
  21. package/es/Box/deps/grid-factory.d.ts +2 -2
  22. package/es/Box/deps/grid-factory.js +12 -0
  23. package/es/Box/index.js +29 -16
  24. package/es/Box/{index.css → index.less} +5 -4
  25. package/es/CheckGroupFixed/demo.d.ts +3 -0
  26. package/es/CheckGroupFixed/demo.js +28 -0
  27. package/es/CheckGroupFixed/index.js +117 -82
  28. package/es/CheckGroupFixed/index.less +50 -0
  29. package/es/Config/index.js +5 -1
  30. package/es/Config/utils.js +18 -3
  31. package/es/ConfigContext/index.js +8 -4
  32. package/es/CustomRenderSelect/index.js +71 -36
  33. package/es/CustomRenderSelect/index.less +25 -0
  34. package/es/DisableMark/index.js +14 -11
  35. package/es/DisableMark/{index.css → index.less} +0 -0
  36. package/es/DomMove/demo.js +14 -10
  37. package/es/DomMove/index.js +52 -30
  38. package/es/DomMove/utils.js +8 -3
  39. package/es/Drag/DragAndDropItem.js +44 -20
  40. package/es/Drag/DropItem.js +22 -6
  41. package/es/Drag/index.js +2 -2
  42. package/es/Drag/{index.css → index.less} +0 -0
  43. package/es/Drawer/Footer.js +22 -15
  44. package/es/Drawer/{Demo.d.ts → demo.d.ts} +0 -0
  45. package/es/Drawer/demo.js +109 -0
  46. package/es/Drawer/index.js +98 -60
  47. package/es/Drawer/index.less +42 -0
  48. package/es/ErrorFallback/index.js +23 -14
  49. package/es/FrontendPlayer/index.js +1 -1
  50. package/es/FullScreen/index.js +30 -17
  51. package/es/FullScreen/index.less +16 -0
  52. package/es/HightLevel/index.js +11 -4
  53. package/es/HightLevel/{index.css → index.less} +0 -0
  54. package/es/IconFont/index.js +39 -18
  55. package/es/ImageView/index.js +37 -13
  56. package/es/ImageView/index.less +10 -0
  57. package/es/Input/demo.d.ts +3 -0
  58. package/es/Input/demo.js +16 -0
  59. package/es/Input/index.js +46 -22
  60. package/es/Input/index.less +12 -0
  61. package/es/InstanceHistory/index.js +2 -0
  62. package/es/LabelValue/index.js +25 -18
  63. package/es/LabelValue/index.less +20 -0
  64. package/es/List/DynamicGridList/Demo.d.ts +1 -0
  65. package/es/List/DynamicGridList/Demo.js +52 -32
  66. package/es/List/DynamicGridList/index.d.ts +3 -3
  67. package/es/List/DynamicGridList/index.js +41 -26
  68. package/es/List/DynamicList/index.js +76 -56
  69. package/es/List/DynamicList/index.less +15 -0
  70. package/es/List/GridList/Demo.d.ts +1 -0
  71. package/es/List/GridList/Demo.js +60 -38
  72. package/es/List/GridList/hook.d.ts +1 -1
  73. package/es/List/GridList/hook.js +66 -35
  74. package/es/List/GridList/index.js +33 -29
  75. package/es/List/GridList/{index.css → index.less} +0 -0
  76. package/es/List/GridList/utils.d.ts +2 -2
  77. package/es/List/GridList/utils.js +1 -0
  78. package/es/List/VList/index.d.ts +1 -1
  79. package/es/List/VList/index.js +32 -19
  80. package/es/List/VList/{index.css → index.less} +0 -0
  81. package/es/List/VList/utils.d.ts +2 -2
  82. package/es/List/VList/utils.js +8 -6
  83. package/es/List/demo.d.ts +3 -0
  84. package/es/List/demo.js +26 -0
  85. package/es/List/index.d.ts +1 -1
  86. package/es/List/index.js +31 -23
  87. package/es/List/{index.css → index.less} +5 -4
  88. package/es/ListWithSizeAnimate/demo.d.ts +2 -0
  89. package/es/ListWithSizeAnimate/demo.js +19 -0
  90. package/es/ListWithSizeAnimate/index.d.ts +9 -0
  91. package/es/ListWithSizeAnimate/index.js +71 -0
  92. package/es/ListWithSizeAnimate/index.less +13 -0
  93. package/es/LoaderApp/index.js +59 -25
  94. package/es/LoaderApp/{index.css → index.less} +0 -0
  95. package/es/LoaderApp/loader.js +40 -23
  96. package/es/LoaderApp/sandbox.back.js +101 -24
  97. package/es/LoaderApp/sandbox.js +26 -9
  98. package/es/LoaderApp/utils.d.ts +1 -1
  99. package/es/LoaderApp/utils.js +68 -25
  100. package/es/LoaderScript/index.js +25 -10
  101. package/es/LoaderScript/utils.js +151 -87
  102. package/es/Map/BasicMap/AMapInstance.d.ts +1 -1
  103. package/es/Map/BasicMap/AMapInstance.js +25 -3
  104. package/es/Map/BasicMap/LeafletInstance.js +28 -11
  105. package/es/Map/BasicMap/index.js +67 -27
  106. package/es/Map/BasicMap/index.less +24 -0
  107. package/es/Map/ClusterLayer/hook.d.ts +2 -2
  108. package/es/Map/ClusterLayer/hook.js +51 -23
  109. package/es/Map/ClusterLayer/index.d.ts +1 -1
  110. package/es/Map/ClusterLayer/index.js +14 -6
  111. package/es/Map/ClusterLayer/index.less +27 -0
  112. package/es/Map/Config/index.js +44 -16
  113. package/es/Map/Config/utils.js +17 -3
  114. package/es/Map/Context/index.js +43 -9
  115. package/es/Map/FindPio/index.js +5 -2
  116. package/es/Map/FindPio/{index.css → index.less} +0 -0
  117. package/es/Map/InfoWindow/MakerLikeWindow.d.ts +1 -1
  118. package/es/Map/InfoWindow/MakerLikeWindow.js +41 -18
  119. package/es/Map/InfoWindow/demo.d.ts +1 -0
  120. package/es/Map/InfoWindow/demo.js +51 -29
  121. package/es/Map/InfoWindow/index.d.ts +1 -1
  122. package/es/Map/InfoWindow/index.js +39 -18
  123. package/es/Map/LevelCenter/DragMarker/index.js +16 -10
  124. package/es/Map/LevelCenter/demo.d.ts +1 -0
  125. package/es/Map/LevelCenter/demo.js +41 -22
  126. package/es/Map/LevelCenter/index.js +41 -29
  127. package/es/Map/LevelCenter/index.less +2 -0
  128. package/es/Map/LoaderMap/index.js +38 -22
  129. package/es/Map/MapDrawSelect/demo.d.ts +1 -0
  130. package/es/Map/MapDrawSelect/demo.js +65 -46
  131. package/es/Map/MapDrawSelect/index.js +43 -31
  132. package/es/Map/MapDrawSelect/index.less +2 -0
  133. package/es/Map/MouseTool/index.js +32 -18
  134. package/es/Map/MouseTool/useMouseTools.js +37 -8
  135. package/es/Map/ResetTools/index.js +58 -44
  136. package/es/Map/ResetTools/index.less +35 -0
  137. package/es/Map/SinglePoint/index.js +39 -27
  138. package/es/Map/SinglePoint/index.less +41 -0
  139. package/es/Map/hook/useMapEvent.js +8 -4
  140. package/es/Map/hook/useMapType.js +3 -2
  141. package/es/Map/index.d.ts +1 -0
  142. package/es/Map/index.js +11 -11
  143. package/es/Map/useMarker/index.d.ts +1 -1
  144. package/es/Map/useMarker/index.js +33 -13
  145. package/es/Map/{LevelCenter/index.css → useMarker/index.less} +0 -0
  146. package/es/Map/withMap/index.d.ts +1 -0
  147. package/es/Map/withMap/index.js +14 -4
  148. package/es/Modal/demo.d.ts +3 -0
  149. package/es/Modal/demo.js +106 -0
  150. package/es/Modal/index.js +94 -57
  151. package/es/Modal/index.less +45 -0
  152. package/es/Picture/component/DefaultRects/RectInfo.js +59 -37
  153. package/es/Picture/component/DefaultRects/index.js +46 -32
  154. package/es/Picture/component/DefaultRects/index.less +188 -0
  155. package/es/Picture/component/DrawRect/index.js +37 -24
  156. package/es/Picture/component/DrawRect/{index.css → index.less} +0 -0
  157. package/es/Picture/component/RectMenu/index.js +35 -26
  158. package/es/Picture/component/RectMenu/index.less +31 -0
  159. package/es/Picture/component/RectMenu/utils.js +6 -3
  160. package/es/Picture/component/Tools/index.js +91 -69
  161. package/es/Picture/component/Tools/index.less +43 -0
  162. package/es/Picture/component/WheelScale/index.js +9 -4
  163. package/es/Picture/demo.js +14 -11
  164. package/es/Picture/dragBound.d.ts +1 -1
  165. package/es/Picture/dragBound.js +17 -4
  166. package/es/Picture/index.d.ts +2 -2
  167. package/es/Picture/index.js +201 -137
  168. package/es/Picture/index.less +14 -0
  169. package/es/Picture/interface.d.ts +0 -6
  170. package/es/Picture/loadCaptureRectImage.d.ts +1 -1
  171. package/es/Picture/loadCaptureRectImage.js +39 -14
  172. package/es/Picture/useDraw.js +40 -20
  173. package/es/Picture/utils.d.ts +9 -9
  174. package/es/Picture/utils.js +18 -3
  175. package/es/Player/api/index.d.ts +3 -3
  176. package/es/Player/api/index.js +117 -82
  177. package/es/Player/context.js +21 -7
  178. package/es/Player/contraller_bar/bar.d.ts +1 -1
  179. package/es/Player/contraller_bar/bar.js +28 -10
  180. package/es/Player/contraller_bar/contraller_event.js +34 -12
  181. package/es/Player/contraller_bar/index.js +30 -22
  182. package/es/Player/contraller_bar/left_bar.js +62 -39
  183. package/es/Player/contraller_bar/right_bar.js +34 -18
  184. package/es/Player/contraller_bar/time.js +19 -8
  185. package/es/Player/contraller_bar/useBarStatus.js +29 -11
  186. package/es/Player/contraller_bar/volume.d.ts +1 -1
  187. package/es/Player/contraller_bar/volume.js +43 -21
  188. package/es/Player/demo.d.ts +1 -0
  189. package/es/Player/demo.js +258 -215
  190. package/es/Player/event/errorEvent.js +41 -16
  191. package/es/Player/event/eventName.js +12 -1
  192. package/es/Player/event/index.js +66 -24
  193. package/es/Player/fps_play.js +33 -15
  194. package/es/Player/frontend_player.js +42 -20
  195. package/es/Player/frontend_timeline.js +95 -55
  196. package/es/Player/iconfont.js +23 -8
  197. package/es/Player/index.js +1 -1
  198. package/es/Player/live_heart.js +15 -3
  199. package/es/Player/message.js +68 -37
  200. package/es/Player/segment_player.js +113 -62
  201. package/es/Player/segment_timeline.js +145 -97
  202. package/es/Player/single_player.js +153 -111
  203. package/es/Player/style/bar.less +39 -0
  204. package/es/Player/style/iconfont.js +17 -10
  205. package/es/Player/style/index.less +30 -0
  206. package/es/Player/style/message.less +50 -0
  207. package/es/Player/style/slider.less +103 -0
  208. package/es/Player/style/timeline.less +106 -0
  209. package/es/Player/style/volume.less +21 -0
  210. package/es/Player/timeline.d.ts +1 -1
  211. package/es/Player/timeline.js +59 -32
  212. package/es/Player/util.js +46 -7
  213. package/es/PlayerExt/demo.d.ts +1 -0
  214. package/es/PlayerExt/demo.js +145 -112
  215. package/es/PlayerExt/index.d.ts +2 -2
  216. package/es/PlayerExt/index.js +139 -87
  217. package/es/PlayerExt/{index.css → index.less} +0 -0
  218. package/es/Progress/index.js +18 -5
  219. package/es/Progress/index.less +20 -0
  220. package/es/ROI/demo.d.ts +1 -0
  221. package/es/ROI/demo.js +12 -8
  222. package/es/ROI/index.js +45 -35
  223. package/es/ROI/index.less +29 -0
  224. package/es/ScreenPlayer/Live.d.ts +2 -2
  225. package/es/ScreenPlayer/Live.js +172 -109
  226. package/es/ScreenPlayer/LiveTools.d.ts +2 -2
  227. package/es/ScreenPlayer/LiveTools.js +156 -116
  228. package/es/ScreenPlayer/PlayerWithExt.d.ts +2 -2
  229. package/es/ScreenPlayer/PlayerWithExt.js +172 -115
  230. package/es/ScreenPlayer/RatePick.js +35 -22
  231. package/es/ScreenPlayer/Record.d.ts +1 -1
  232. package/es/ScreenPlayer/Record.js +307 -192
  233. package/es/ScreenPlayer/RecordTools.d.ts +2 -2
  234. package/es/ScreenPlayer/RecordTools.js +201 -149
  235. package/es/ScreenPlayer/ScreenSelect.js +37 -28
  236. package/es/ScreenPlayer/SegmentTimeLine.d.ts +1 -1
  237. package/es/ScreenPlayer/SegmentTimeLine.js +24 -17
  238. package/es/ScreenPlayer/TimeMode.js +22 -16
  239. package/es/ScreenPlayer/TimeSelect.js +86 -65
  240. package/es/ScreenPlayer/demo.js +16 -18
  241. package/es/ScreenPlayer/demo2.js +193 -178
  242. package/es/ScreenPlayer/index.d.ts +1 -0
  243. package/es/ScreenPlayer/index.js +3 -3
  244. package/es/ScreenPlayer/index.less +178 -0
  245. package/es/ScreenPlayer/interface.d.ts +2 -2
  246. package/es/ScreenPlayer/useTimeSlider.d.ts +8 -8
  247. package/es/ScreenPlayer/useTimeSlider.js +167 -60
  248. package/es/ScreenPlayer/useVideoFit.d.ts +1 -1
  249. package/es/ScreenPlayer/useVideoFit.js +18 -5
  250. package/es/ScreenPlayer/utils.d.ts +1 -1
  251. package/es/ScreenPlayer/utils.js +10 -1
  252. package/es/SegmentPlayer/index.js +1 -1
  253. package/es/Service/fetch-adapter.d.ts +1 -1
  254. package/es/Service/fetch-adapter.js +48 -5
  255. package/es/Service/http.js +46 -16
  256. package/es/Service/index.js +2 -2
  257. package/es/TableLayout/index.js +18 -12
  258. package/es/TableLayout/{index.css → index.less} +0 -0
  259. package/es/ThemeAntd/demo.d.ts +1 -0
  260. package/es/ThemeAntd/demo.js +126 -76
  261. package/es/ThemeAntd/{demo.css → demo.less} +4 -3
  262. package/es/ThemeAntd/index.js +6 -2
  263. package/es/ThemeAntd/index.less +16 -0
  264. package/es/ThemeAntd/style/button.less +67 -0
  265. package/es/ThemeAntd/style/checkbox.less +72 -0
  266. package/es/ThemeAntd/style/form.less +12 -0
  267. package/es/ThemeAntd/style/input.less +83 -0
  268. package/es/ThemeAntd/style/pagination.less +95 -0
  269. package/es/ThemeAntd/style/picker.less +106 -0
  270. package/es/ThemeAntd/style/popover.less +5 -0
  271. package/es/ThemeAntd/style/radio.less +87 -0
  272. package/es/ThemeAntd/style/{scrollbar.css → scrollbar.less} +4 -2
  273. package/es/ThemeAntd/style/select.less +81 -0
  274. package/es/ThemeAntd/style/table.less +57 -0
  275. package/es/ThemeAntd/style/tree.less +18 -0
  276. package/es/Timeout/index.js +36 -12
  277. package/es/Tree/demo.js +26 -21
  278. package/es/Tree/index.js +51 -30
  279. package/es/Tree/index.less +59 -0
  280. package/es/index.d.ts +1 -0
  281. package/es/index.js +48 -47
  282. package/es/useDrawROI/index.js +130 -65
  283. package/es/useEventEmitterHandle/index.js +6 -2
  284. package/es/useFullscreen/demo.js +44 -27
  285. package/es/useFullscreen/index.js +30 -8
  286. package/es/useHistory/index.js +3 -1
  287. package/es/useInfiniteScroll/index.js +50 -19
  288. package/es/useRafInterval/index.js +28 -4
  289. package/es/useSimpleState/index.js +23 -6
  290. package/es/useVirtualList/index.js +58 -20
  291. package/es/utils.d.ts +1 -1
  292. package/es/utils.js +53 -14
  293. package/package.json +37 -32
  294. package/tsconfig.json +8 -32
  295. package/.eslintrc +0 -4
  296. package/.fatherrc.js +0 -25
  297. package/.prettierrc +0 -11
  298. package/.umirc.ts +0 -55
  299. package/clear-cache.sh +0 -4
  300. package/es/Box/InfoBox/index.css +0 -22
  301. package/es/Box/TwoColumnBox/index.css +0 -70
  302. package/es/CheckGroupFixed/index.css +0 -49
  303. package/es/CustomRenderSelect/index.css +0 -20
  304. package/es/Drawer/Demo.js +0 -59
  305. package/es/Drawer/index.css +0 -40
  306. package/es/FullScreen/index.css +0 -16
  307. package/es/ImageView/index.css +0 -10
  308. package/es/Input/index.css +0 -8
  309. package/es/LabelValue/index.css +0 -18
  310. package/es/List/DynamicList/index.css +0 -15
  311. package/es/Map/BasicMap/index.css +0 -24
  312. package/es/Map/ClusterLayer/index.css +0 -26
  313. package/es/Map/MapDrawSelect/index.css +0 -0
  314. package/es/Map/ResetTools/index.css +0 -32
  315. package/es/Map/SinglePoint/icon/Place_icon_OnLine_Hover.svg +0 -15
  316. package/es/Map/SinglePoint/icon/Place_icon_OnLine_Normal.svg +0 -15
  317. package/es/Map/SinglePoint/icon/Place_icon_OutLine_Hover.svg +0 -15
  318. package/es/Map/SinglePoint/icon/Place_icon_OutLine_Normal.svg +0 -15
  319. package/es/Map/SinglePoint/index.css +0 -29
  320. package/es/Map/useMarker/index.css +0 -0
  321. package/es/Modal/index.css +0 -43
  322. package/es/Picture/component/DefaultRects/index.css +0 -247
  323. package/es/Picture/component/RectMenu/index.css +0 -31
  324. package/es/Picture/component/Tools/index.css +0 -42
  325. package/es/Picture/index.css +0 -12
  326. package/es/Player/style/bar.css +0 -38
  327. package/es/Player/style/index.css +0 -30
  328. package/es/Player/style/message.css +0 -49
  329. package/es/Player/style/slider.css +0 -96
  330. package/es/Player/style/timeline.css +0 -99
  331. package/es/Player/style/volume.css +0 -19
  332. package/es/Progress/index.css +0 -20
  333. package/es/ROI/index.css +0 -29
  334. package/es/ScreenPlayer/index.css +0 -166
  335. package/es/ThemeAntd/index.css +0 -620
  336. package/es/ThemeAntd/style/button.css +0 -55
  337. package/es/ThemeAntd/style/checkbox.css +0 -64
  338. package/es/ThemeAntd/style/form.css +0 -10
  339. package/es/ThemeAntd/style/input.css +0 -68
  340. package/es/ThemeAntd/style/pagination.css +0 -82
  341. package/es/ThemeAntd/style/picker.css +0 -98
  342. package/es/ThemeAntd/style/popover.css +0 -3
  343. package/es/ThemeAntd/style/radio.css +0 -80
  344. package/es/ThemeAntd/style/select.css +0 -76
  345. package/es/ThemeAntd/style/table.css +0 -46
  346. package/es/ThemeAntd/style/tree.css +0 -16
  347. package/es/Tree/index.css +0 -64
@@ -30,6 +30,7 @@ export function getColumnWidth(columnCount, gridGap, elementWidth) {
30
30
  if (columnCount === null || gridGap === null || elementWidth === null) {
31
31
  return null;
32
32
  }
33
+
33
34
  var totalGapSpace = (columnCount - 1) * gridGap;
34
35
  var columnWidth = Math.round((elementWidth - totalGapSpace) / columnCount);
35
36
  return columnWidth;
@@ -13,7 +13,7 @@ declare namespace VList {
13
13
  className: string;
14
14
  rowHeight: number;
15
15
  overscan: number;
16
- data: any[];
16
+ data: never[];
17
17
  };
18
18
  }
19
19
  export default VList;
@@ -1,36 +1,49 @@
1
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
2
3
  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."); }
4
+
3
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
+
4
7
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
+
5
9
  function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
6
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
7
13
  import React, { useRef } from 'react';
8
- import useVirtualList from '../../useVirtualList';
9
- import "./index.css";
14
+ import useVirtualList from "../../useVirtualList";
15
+ import "./index.less";
16
+ import { jsx as _jsx } from "react/jsx-runtime";
17
+
10
18
  function VList(_ref) {
11
19
  var className = _ref.className,
12
- rowHeight = _ref.rowHeight,
13
- data = _ref.data,
14
- renderItem = _ref.renderItem;
20
+ rowHeight = _ref.rowHeight,
21
+ data = _ref.data,
22
+ renderItem = _ref.renderItem;
15
23
  var containerRef = useRef();
16
24
  var wrapperRef = useRef();
25
+
17
26
  var _useVirtualList = useVirtualList(data, {
18
- containerTarget: containerRef,
19
- wrapperTarget: wrapperRef,
20
- itemHeight: rowHeight,
21
- overscan: 10
22
- }),
23
- _useVirtualList2 = _slicedToArray(_useVirtualList, 1),
24
- list = _useVirtualList2[0];
25
- return /*#__PURE__*/React.createElement("div", {
27
+ containerTarget: containerRef,
28
+ wrapperTarget: wrapperRef,
29
+ itemHeight: rowHeight,
30
+ overscan: 10
31
+ }),
32
+ _useVirtualList2 = _slicedToArray(_useVirtualList, 1),
33
+ list = _useVirtualList2[0];
34
+
35
+ return /*#__PURE__*/_jsx("div", {
26
36
  className: "vidc-simple-list-layout ".concat(className),
27
- ref: containerRef
28
- }, /*#__PURE__*/React.createElement("div", {
29
- ref: wrapperRef
30
- }, list.map(function (ele) {
31
- return renderItem(ele.data, ele.index);
32
- })));
37
+ ref: containerRef,
38
+ children: /*#__PURE__*/_jsx("div", {
39
+ ref: wrapperRef,
40
+ children: list.map(function (ele) {
41
+ return renderItem(ele.data, ele.index);
42
+ })
43
+ })
44
+ });
33
45
  }
46
+
34
47
  VList.defaultProps = {
35
48
  className: '',
36
49
  rowHeight: 30,
File without changes
@@ -6,9 +6,9 @@ export declare function renderRowItem(rowRenderer?: ({ data, index, style }: {
6
6
  }) => JSX.Element, renderItem?: (item: any, index: number) => JSX.Element, data?: any[]): (({ data, index, style }: {
7
7
  data: any;
8
8
  index: number;
9
- style?: React.CSSProperties;
9
+ style?: React.CSSProperties | undefined;
10
10
  }) => JSX.Element) | (({ key, index, style }: {
11
11
  key: Key;
12
12
  index: number;
13
- style?: React.CSSProperties;
13
+ style?: React.CSSProperties | undefined;
14
14
  }) => JSX.Element);
@@ -1,16 +1,18 @@
1
1
  import React from 'react';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
2
3
  export function renderRowItem(rowRenderer, renderItem, data) {
3
4
  if (rowRenderer) {
4
5
  return rowRenderer;
5
6
  }
7
+
6
8
  return function (_ref) {
7
9
  var key = _ref.key,
8
- index = _ref.index,
9
- style = _ref.style;
10
+ index = _ref.index,
11
+ style = _ref.style;
10
12
  var item = data[index];
11
- return /*#__PURE__*/React.createElement("div", {
12
- key: key,
13
- style: style
14
- }, renderItem(item, index));
13
+ return /*#__PURE__*/_jsx("div", {
14
+ style: style,
15
+ children: renderItem(item, index)
16
+ }, key);
15
17
  };
16
18
  }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const _default: () => JSX.Element;
3
+ export default _default;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import List from "./index";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ var defaultList = Array.from(new Array(10000)).map(function (_, i) {
5
+ return {
6
+ name: "\u6211\u662F\u5217\u8868".concat(i),
7
+ id: i
8
+ };
9
+ });
10
+ export default (function () {
11
+ return /*#__PURE__*/_jsx("div", {
12
+ style: {
13
+ width: 300,
14
+ height: 600,
15
+ border: '1px solid #000'
16
+ },
17
+ children: /*#__PURE__*/_jsx(List, {
18
+ list: defaultList,
19
+ renderItem: function renderItem(item) {
20
+ return /*#__PURE__*/_jsx("div", {
21
+ children: item.name
22
+ }, item.id);
23
+ }
24
+ })
25
+ });
26
+ });
@@ -5,7 +5,7 @@ declare function List<T>(props: ListProps<T>): JSX.Element;
5
5
  declare namespace List {
6
6
  var defaultProps: {
7
7
  className: string;
8
- list: any[];
8
+ list: never[];
9
9
  itemKey: string;
10
10
  itemNameKey: string;
11
11
  renderHeaderExt: () => JSX.Element;
package/es/List/index.js CHANGED
@@ -1,37 +1,45 @@
1
1
  import React from 'react';
2
- import DynamicList from './DynamicList';
3
- import GridList from './GridList';
4
- import DynamicGridList from './DynamicGridList';
5
- import VList from './VList';
6
- import "./index.css";
2
+ import DynamicList from "./DynamicList";
3
+ import GridList from "./GridList";
4
+ import DynamicGridList from "./DynamicGridList";
5
+ import VList from "./VList";
6
+ import "./index.less";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { jsxs as _jsxs } from "react/jsx-runtime";
9
+ import { Fragment as _Fragment } from "react/jsx-runtime";
10
+
7
11
  function List(props) {
8
12
  var className = props.className,
9
- style = props.style,
10
- renderItem = props.renderItem,
11
- list = props.list,
12
- rowHeight = props.rowHeight,
13
- renderHeaderExt = props.renderHeaderExt;
14
- return /*#__PURE__*/React.createElement("div", {
13
+ style = props.style,
14
+ renderItem = props.renderItem,
15
+ list = props.list,
16
+ rowHeight = props.rowHeight,
17
+ renderHeaderExt = props.renderHeaderExt;
18
+ return /*#__PURE__*/_jsxs("div", {
15
19
  className: "lm-c-list-wrapper ".concat(className),
16
- style: style
17
- }, /*#__PURE__*/React.createElement("div", {
18
- className: "lm-c-list-header"
19
- }, renderHeaderExt()), /*#__PURE__*/React.createElement("div", {
20
- className: "lm-c-base-list-layout"
21
- }, /*#__PURE__*/React.createElement(VList, {
22
- className: "lm-c-virtual-layout",
23
- data: list,
24
- rowHeight: rowHeight || 30,
25
- renderItem: renderItem
26
- })));
20
+ style: style,
21
+ children: [/*#__PURE__*/_jsx("div", {
22
+ className: "lm-c-list-header",
23
+ children: renderHeaderExt()
24
+ }), /*#__PURE__*/_jsx("div", {
25
+ className: "lm-c-base-list-layout",
26
+ children: /*#__PURE__*/_jsx(VList, {
27
+ className: "lm-c-virtual-layout",
28
+ data: list,
29
+ rowHeight: rowHeight || 30,
30
+ renderItem: renderItem
31
+ })
32
+ })]
33
+ });
27
34
  }
35
+
28
36
  List.defaultProps = {
29
37
  className: '',
30
38
  list: [],
31
39
  itemKey: 'id',
32
40
  itemNameKey: 'name',
33
41
  renderHeaderExt: function renderHeaderExt() {
34
- return /*#__PURE__*/React.createElement(React.Fragment, null);
42
+ return /*#__PURE__*/_jsx(_Fragment, {});
35
43
  }
36
44
  };
37
45
  List.VList = VList;
@@ -5,8 +5,9 @@
5
5
  height: 100%;
6
6
  cursor: auto;
7
7
  border: 1px solid var(--gray2);
8
- }
9
- .lm-c-list-wrapper .lm-c-base-list-layout {
10
- flex: 1;
11
- overflow: hidden;
8
+
9
+ .lm-c-base-list-layout {
10
+ flex: 1;
11
+ overflow: hidden;
12
+ }
12
13
  }
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export default function App(): JSX.Element;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import ListWithSizeAnimate from "./index";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ export default function App() {
5
+ return /*#__PURE__*/_jsx("div", {
6
+ style: {
7
+ width: '100%',
8
+ height: 800
9
+ },
10
+ children: /*#__PURE__*/_jsx(ListWithSizeAnimate, {
11
+ headerSize: 400,
12
+ children: /*#__PURE__*/_jsx("div", {
13
+ style: {
14
+ height: 800
15
+ }
16
+ })
17
+ })
18
+ });
19
+ }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface IListWithSizeAnimateProps {
4
+ headerSize: number;
5
+ children?: React.ReactNode;
6
+ header?: React.ReactNode;
7
+ }
8
+ declare function ListWithSizeAnimate({ headerSize, children, header }: IListWithSizeAnimateProps): JSX.Element;
9
+ export default ListWithSizeAnimate;
@@ -0,0 +1,71 @@
1
+ import _useEventListener from "ahooks/es/useEventListener";
2
+
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+
5
+ 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."); }
6
+
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+
9
+ 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; }
10
+
11
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
12
+
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+
15
+ import React, { useMemo, useRef } from 'react';
16
+ import useSimpleState from "../useSimpleState";
17
+ import "./index.less";
18
+ import { jsx as _jsx } from "react/jsx-runtime";
19
+ import { jsxs as _jsxs } from "react/jsx-runtime";
20
+
21
+ function ListWithSizeAnimate(_ref) {
22
+ var headerSize = _ref.headerSize,
23
+ children = _ref.children,
24
+ header = _ref.header;
25
+
26
+ var _useSimpleState = useSimpleState({
27
+ open: true
28
+ }),
29
+ _useSimpleState2 = _slicedToArray(_useSimpleState, 2),
30
+ state = _useSimpleState2[0],
31
+ updateState = _useSimpleState2[1];
32
+
33
+ var ref = useRef(null);
34
+ var headerHeight = useMemo(function () {
35
+ return state.open ? headerSize : 0;
36
+ }, [state.open]);
37
+ var contentHeight = useMemo(function () {
38
+ return "calc(100% - ".concat(headerHeight, "px)");
39
+ }, [headerHeight]);
40
+
41
+ _useEventListener('wheel', function (event) {
42
+ updateState({
43
+ open: event.deltaY < 0
44
+ });
45
+ }, {
46
+ target: ref
47
+ });
48
+
49
+ return /*#__PURE__*/_jsxs("div", {
50
+ className: "list-with-size-animate-layout",
51
+ ref: ref,
52
+ children: [/*#__PURE__*/_jsx("div", {
53
+ className: "list-animate-header",
54
+ style: {
55
+ height: headerHeight
56
+ },
57
+ children: /*#__PURE__*/_jsx("div", {
58
+ className: "list-animate-header-content",
59
+ children: header
60
+ })
61
+ }), /*#__PURE__*/_jsx("div", {
62
+ className: "list-animate-content",
63
+ style: {
64
+ height: contentHeight
65
+ },
66
+ children: children
67
+ })]
68
+ });
69
+ }
70
+
71
+ export default ListWithSizeAnimate;
@@ -0,0 +1,13 @@
1
+ .list-with-size-animate-layout {
2
+ height: 100%;
3
+ width: 100%;
4
+ overflow: hidden;
5
+ .list-animate-header {
6
+ background-color: gray;
7
+ transition: height 0.3s;
8
+ }
9
+ .list-animate-content {
10
+ background-color: blue;
11
+ overflow: hidden;
12
+ }
13
+ }
@@ -1,18 +1,32 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+
2
3
  import _useUnmount from "ahooks/es/useUnmount";
3
4
  import _nextTick from "@cloud-app-dev/utils/es/nextTick";
4
5
  import _useMount from "ahooks/es/useMount";
5
6
  import _uuid from "@cloud-app-dev/utils/es/uuid";
7
+
6
8
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
7
- import { __awaiter } from "tslib";
9
+
10
+ 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); } }
11
+
12
+ 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); }); }; }
13
+
14
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
+
16
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
+
18
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
+
8
20
  import React, { useRef, useMemo } from 'react';
9
- import LoaderModule from './loader';
10
- import "./index.css";
21
+ import LoaderModule from "./loader";
22
+ import "./index.less";
23
+ import { jsx as _jsx } from "react/jsx-runtime";
24
+ import { jsxs as _jsxs } from "react/jsx-runtime";
25
+
11
26
  function LoaderApp(_ref) {
12
- var _this = this;
13
27
  var appConfig = _ref.appConfig,
14
- appProps = _ref.appProps,
15
- style = _ref.style;
28
+ appProps = _ref.appProps,
29
+ style = _ref.style;
16
30
  var domRef = useRef(null);
17
31
  var styleRef = useRef(null);
18
32
  var loadedAppRef = useRef();
@@ -20,46 +34,54 @@ function LoaderApp(_ref) {
20
34
  return _uuid();
21
35
  }, []);
22
36
  var statusRef = useRef();
37
+
23
38
  _useMount(function () {
24
39
  if (!appConfig) {
25
40
  console.error('微应用不存在', 'appConfig ->', appConfig, 'appProps ->', appProps);
26
41
  return undefined;
27
42
  }
43
+
28
44
  if (!domRef.current || !styleRef.current) {
29
45
  console.error('LoaderApp组件未正常初始化!', 'config ->', appConfig, 'appProps ->', appProps);
30
46
  return undefined;
31
47
  }
32
- var props = Object.assign(Object.assign({}, appProps), {
48
+
49
+ var props = _objectSpread(_objectSpread({}, appProps), {}, {
33
50
  container: domRef.current
34
51
  });
52
+
35
53
  var routerPrefix = appConfig.routerPrefix,
36
- html = appConfig.html;
54
+ html = appConfig.html;
37
55
  var options = {
38
56
  html: html,
39
57
  name: routerPrefix,
40
58
  prefix: ".".concat(routerPrefix, "-").concat(id),
41
59
  styleNode: styleRef.current
42
60
  };
43
- LoaderModule(options).then(function (mod) {
44
- return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
61
+ LoaderModule(options).then( /*#__PURE__*/function () {
62
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(mod) {
45
63
  return _regeneratorRuntime().wrap(function _callee$(_context) {
46
64
  while (1) {
47
65
  switch (_context.prev = _context.next) {
48
66
  case 0:
49
- loadedAppRef.current = mod;
50
- // 沙箱销毁方法
67
+ loadedAppRef.current = mod; // 沙箱销毁方法
68
+
51
69
  _context.next = 3;
52
70
  return mod.bootstrap(props);
71
+
53
72
  case 3:
54
73
  _nextTick(function () {
55
74
  return statusRef.current = 'bootstrap';
56
75
  });
76
+
57
77
  _context.next = 6;
58
78
  return mod.mount(props);
79
+
59
80
  case 6:
60
81
  _nextTick(function () {
61
82
  return statusRef.current = 'mounted';
62
83
  });
84
+
63
85
  case 7:
64
86
  case "end":
65
87
  return _context.stop();
@@ -67,35 +89,47 @@ function LoaderApp(_ref) {
67
89
  }
68
90
  }, _callee);
69
91
  }));
70
- });
92
+
93
+ return function (_x) {
94
+ return _ref2.apply(this, arguments);
95
+ };
96
+ }());
71
97
  });
98
+
72
99
  _useUnmount(function () {
73
100
  if (loadedAppRef.current) {
74
101
  var app = loadedAppRef.current;
75
- var props = Object.assign(Object.assign({}, appProps), {
102
+
103
+ var props = _objectSpread(_objectSpread({}, appProps), {}, {
76
104
  container: domRef.current
77
105
  });
106
+
78
107
  app.unmount(props);
108
+
79
109
  _nextTick(function () {
80
110
  return statusRef.current = 'unmount';
81
111
  });
112
+
82
113
  loadedAppRef.current = null;
83
114
  }
84
115
  });
85
- return /*#__PURE__*/React.createElement("main", {
116
+
117
+ return /*#__PURE__*/_jsxs("main", {
86
118
  ref: domRef,
87
119
  className: "loaded-app-layout ".concat(appConfig.routerPrefix, "-").concat(id),
88
- style: style
89
- }, /*#__PURE__*/React.createElement("style", {
90
- ref: styleRef
91
- }), /*#__PURE__*/React.createElement("div", {
92
- id: appConfig.routerPrefix,
93
- style: {
94
- width: '100%',
95
- height: '100%'
96
- }
97
- }));
120
+ style: style,
121
+ children: [/*#__PURE__*/_jsx("style", {
122
+ ref: styleRef
123
+ }), /*#__PURE__*/_jsx("div", {
124
+ id: appConfig.routerPrefix,
125
+ style: {
126
+ width: '100%',
127
+ height: '100%'
128
+ }
129
+ })]
130
+ });
98
131
  }
132
+
99
133
  LoaderApp.defaultProps = {
100
134
  appConfig: {},
101
135
  appProps: {},
File without changes