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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (339) hide show
  1. package/.eslintignore +1 -3
  2. package/.eslintrc +3 -0
  3. package/.prettierignore +1 -0
  4. package/.umirc.ts +74 -74
  5. package/es/AppContext/Sync.d.ts +3 -2
  6. package/es/AppContext/Sync.js +11 -2
  7. package/es/AppContext/index.js +63 -9
  8. package/es/AppContext/interface.d.ts +10 -1
  9. package/es/AppContext/static.d.ts +2 -0
  10. package/es/AppContext/static.js +5 -1
  11. package/es/Box/InfoBox/index.css +5 -6
  12. package/es/Box/TwoColumnBox/index.css +17 -24
  13. package/es/Box/TwoColumnBox/index.js +1 -4
  14. package/es/Box/index.css +1 -1
  15. package/es/Config/interface.d.ts +2 -1
  16. package/es/ConfigContext/index.d.ts +1 -1
  17. package/es/DomMove/demo.d.ts +2 -0
  18. package/es/DomMove/demo.js +16 -0
  19. package/es/DomMove/index.d.ts +16 -0
  20. package/es/DomMove/index.js +145 -0
  21. package/es/DomMove/utils.d.ts +8 -0
  22. package/es/{Picture/component/MoveContent → DomMove}/utils.js +19 -0
  23. package/es/Drawer/index.d.ts +2 -2
  24. package/es/Drawer/interface.d.ts +4 -174
  25. package/es/ErrorBoundary/index.d.ts +18 -0
  26. package/es/ErrorBoundary/index.js +84 -0
  27. package/es/List/DynamicGridList/Demo.js +40 -27
  28. package/es/List/DynamicGridList/index.d.ts +19 -18
  29. package/es/List/DynamicGridList/index.js +36 -36
  30. package/es/List/DynamicList/index.css +15 -0
  31. package/es/List/DynamicList/index.d.ts +14 -0
  32. package/es/List/DynamicList/index.js +105 -0
  33. package/es/List/DynamicList/interface.d.ts +19 -0
  34. package/es/List/DynamicList/utils.d.ts +4 -0
  35. package/es/List/DynamicList/utils.js +6 -0
  36. package/es/List/GridList/Demo.js +27 -4
  37. package/es/List/GridList/index.css +1 -0
  38. package/es/List/GridList/index.d.ts +2 -2
  39. package/es/List/GridList/index.js +8 -12
  40. package/es/List/GridList/interface.d.ts +1 -1
  41. package/es/List/VList/index.js +2 -3
  42. package/es/List/index.css +3 -55
  43. package/es/List/index.d.ts +5 -6
  44. package/es/List/index.js +15 -154
  45. package/es/List/interface.d.ts +3 -61
  46. package/es/LoaderApp/index.d.ts +1 -1
  47. package/es/LoaderApp/index.js +27 -46
  48. package/es/LoaderApp/interface.d.ts +3 -0
  49. package/es/LoaderApp/loader.d.ts +6 -7
  50. package/es/LoaderApp/loader.js +20 -30
  51. package/es/LoaderApp/sandbox.back.d.ts +18 -0
  52. package/es/LoaderApp/sandbox.back.js +356 -0
  53. package/es/LoaderApp/sandbox.d.ts +12 -0
  54. package/es/LoaderApp/sandbox.js +110 -0
  55. package/es/LoaderApp/utils.d.ts +5 -1
  56. package/es/LoaderApp/utils.js +98 -2
  57. package/es/Map/AMap.d.ts +1572 -0
  58. package/es/Map/BasicMap/AMapInstance.d.ts +15 -0
  59. package/es/Map/BasicMap/AMapInstance.js +66 -0
  60. package/es/Map/BasicMap/LeafletInstance.d.ts +15 -0
  61. package/es/Map/BasicMap/LeafletInstance.js +98 -0
  62. package/es/Map/BasicMap/index.css +24 -0
  63. package/es/Map/BasicMap/index.d.ts +9 -0
  64. package/es/Map/BasicMap/index.js +108 -0
  65. package/es/Map/ClusterLayer/hook.d.ts +5 -0
  66. package/es/Map/ClusterLayer/hook.js +144 -0
  67. package/es/Map/ClusterLayer/index.css +26 -0
  68. package/es/Map/ClusterLayer/index.d.ts +5 -0
  69. package/es/Map/ClusterLayer/index.js +31 -0
  70. package/es/Map/ClusterLayer/props.d.ts +8 -0
  71. package/es/Map/Config/index.d.ts +7 -0
  72. package/es/{InitialConfig → Map/Config}/index.js +35 -36
  73. package/es/Map/Config/utils.d.ts +2 -0
  74. package/es/{List/DynamicDeviceList → Map/Config}/utils.js +48 -45
  75. package/es/Map/Context/index.d.ts +11 -0
  76. package/es/Map/Context/index.js +66 -0
  77. package/es/Map/FindPio/index.css +7 -0
  78. package/es/Map/FindPio/index.d.ts +4 -0
  79. package/es/Map/FindPio/index.js +16 -0
  80. package/es/{WorkerFlow/Demo.d.ts → Map/InfoWindow/demo.d.ts} +0 -0
  81. package/es/{List/DynamicDeviceList/Demo.js → Map/InfoWindow/demo.js} +27 -25
  82. package/es/Map/InfoWindow/index.d.ts +8 -0
  83. package/es/Map/InfoWindow/index.js +74 -0
  84. package/es/Map/LevelCenter/DragMarker/index.d.ts +12 -0
  85. package/es/Map/LevelCenter/DragMarker/index.js +48 -0
  86. package/es/{List/DeviceList → Map/LevelCenter}/index.css +0 -0
  87. package/es/Map/LevelCenter/index.d.ts +13 -0
  88. package/es/Map/LevelCenter/index.js +42 -0
  89. package/es/Map/LoaderMap/index.d.ts +12 -0
  90. package/es/Map/LoaderMap/index.js +58 -0
  91. package/es/Map/ResetTools/index.css +32 -0
  92. package/es/Map/ResetTools/index.d.ts +9 -0
  93. package/es/Map/ResetTools/index.js +61 -0
  94. package/es/Map/SinglePoint/Marker/index.d.ts +7 -0
  95. package/es/Map/SinglePoint/Marker/index.js +29 -0
  96. package/es/Map/SinglePoint/icon/Place_icon_OnLine_Hover.svg +15 -0
  97. package/es/Map/SinglePoint/icon/Place_icon_OnLine_Normal.svg +15 -0
  98. package/es/Map/SinglePoint/icon/Place_icon_OutLine_Hover.svg +15 -0
  99. package/es/Map/SinglePoint/icon/Place_icon_OutLine_Normal.svg +15 -0
  100. package/es/Map/SinglePoint/index.css +29 -0
  101. package/es/Map/SinglePoint/index.d.ts +7 -0
  102. package/es/Map/SinglePoint/index.js +32 -0
  103. package/es/Map/hook/useMapType.d.ts +4 -0
  104. package/es/Map/hook/useMapType.js +13 -0
  105. package/es/Map/icon.d.ts +2 -0
  106. package/es/Map/icon.js +10 -0
  107. package/es/Map/index.d.ts +23 -0
  108. package/es/Map/index.js +25 -0
  109. package/es/Map/interface.d.ts +55 -0
  110. package/es/Map/points.json +61247 -0
  111. package/es/{Picture/component/MoveContent → Map/useMarker}/index.css +0 -0
  112. package/es/Map/useMarker/index.d.ts +11 -0
  113. package/es/{WorkerFlow/Form/FormAuth.js → Map/useMarker/index.js} +57 -80
  114. package/es/Map/withMap/index.d.ts +2 -0
  115. package/es/Map/withMap/index.js +12 -0
  116. package/es/Modal/index.css +1 -1
  117. package/es/Modal/index.d.ts +7 -7
  118. package/es/Picture/index.d.ts +1 -1
  119. package/es/Picture/index.js +2 -2
  120. package/es/Player/api/index.d.ts +1 -0
  121. package/es/Player/api/index.js +7 -1
  122. package/es/Player/demo.js +13 -21
  123. package/es/Player/event/index.js +5 -1
  124. package/es/Player/frontend_player.d.ts +1 -1
  125. package/es/Player/frontend_player.js +20 -13
  126. package/es/Player/frontend_timeline.d.ts +1 -1
  127. package/es/Player/live_heart.js +45 -12
  128. package/es/Player/message.js +23 -12
  129. package/es/Player/player.d.ts +31 -7
  130. package/es/Player/segment_player.d.ts +1 -1
  131. package/es/Player/segment_player.js +30 -18
  132. package/es/Player/segment_timeline.js +6 -6
  133. package/es/Player/single_player.js +50 -9
  134. package/es/Player/timeline.js +8 -6
  135. package/es/Player/util.d.ts +2 -1
  136. package/es/Player/util.js +4 -1
  137. package/es/PlayerExt/index.css +2 -2
  138. package/es/PlayerExt/index.d.ts +3 -1
  139. package/es/PlayerExt/index.js +19 -5
  140. package/es/ScreenPlayer/Live.d.ts +5 -0
  141. package/es/ScreenPlayer/Live.js +109 -0
  142. package/es/ScreenPlayer/LiveTools.d.ts +15 -0
  143. package/es/ScreenPlayer/LiveTools.js +95 -0
  144. package/es/ScreenPlayer/PlayerWithExt.d.ts +22 -0
  145. package/es/ScreenPlayer/PlayerWithExt.js +169 -0
  146. package/es/ScreenPlayer/Record.d.ts +5 -0
  147. package/es/{WorkerFlow/index.js → ScreenPlayer/Record.js} +290 -273
  148. package/es/ScreenPlayer/RecordTools.d.ts +17 -0
  149. package/es/ScreenPlayer/RecordTools.js +102 -0
  150. package/es/ScreenPlayer/SegmentTimeLine.d.ts +10 -0
  151. package/es/ScreenPlayer/SegmentTimeLine.js +40 -0
  152. package/es/ScreenPlayer/TimeSlider.d.ts +127 -0
  153. package/es/ScreenPlayer/TimeSlider.js +528 -0
  154. package/es/ScreenPlayer/demo.d.ts +2 -0
  155. package/es/ScreenPlayer/demo.js +25 -0
  156. package/es/ScreenPlayer/demo2.d.ts +2 -0
  157. package/es/ScreenPlayer/demo2.js +153 -0
  158. package/es/ScreenPlayer/index.css +50 -0
  159. package/es/ScreenPlayer/index.d.ts +6 -0
  160. package/es/ScreenPlayer/index.js +7 -0
  161. package/es/ScreenPlayer/interface.d.ts +81 -0
  162. package/es/ScreenPlayer/useRecordList.d.ts +3 -0
  163. package/es/{WorkerFlow/Form/UserAndGroupSelect.js → ScreenPlayer/useRecordList.js} +173 -176
  164. package/es/ScreenPlayer/useVideoFit.d.ts +5 -0
  165. package/es/{Tree/BaseTree/demo.js → ScreenPlayer/useVideoFit.js} +30 -55
  166. package/es/ScreenPlayer/utils.d.ts +25 -0
  167. package/es/ScreenPlayer/utils.js +84 -0
  168. package/es/ThemeAntd/index.css +58 -58
  169. package/es/ThemeAntd/style/button.css +1 -1
  170. package/es/ThemeAntd/style/checkbox.css +8 -8
  171. package/es/ThemeAntd/style/input.css +13 -13
  172. package/es/ThemeAntd/style/pagination.css +5 -5
  173. package/es/ThemeAntd/style/picker.css +11 -11
  174. package/es/ThemeAntd/style/popover.css +1 -1
  175. package/es/ThemeAntd/style/radio.css +4 -4
  176. package/es/ThemeAntd/style/scrollbar.css +3 -3
  177. package/es/ThemeAntd/style/select.css +11 -11
  178. package/es/ThemeAntd/style/table.css +1 -1
  179. package/es/Tree/demo.js +9 -12
  180. package/es/Tree/index.css +55 -29
  181. package/es/Tree/index.d.ts +20 -19
  182. package/es/Tree/index.js +70 -185
  183. package/es/index.d.ts +7 -9
  184. package/es/index.js +7 -9
  185. package/es/useInfiniteScroll/index.d.ts +16 -0
  186. package/es/{useHttp → useInfiniteScroll}/index.js +79 -43
  187. package/es/useVirtualList/index.d.ts +13 -0
  188. package/es/useVirtualList/index.js +175 -0
  189. package/es/withErrorBoundary/index.d.ts +8 -0
  190. package/es/withErrorBoundary/index.js +43 -0
  191. package/package.json +19 -21
  192. package/test.js +48 -0
  193. package/es/DeviceIcon/icon.d.ts +0 -9
  194. package/es/DeviceIcon/icon.js +0 -138
  195. package/es/DeviceIcon/index.css +0 -8
  196. package/es/DeviceIcon/index.d.ts +0 -14
  197. package/es/DeviceIcon/index.js +0 -37
  198. package/es/DeviceSelect/TreeType.d.ts +0 -7
  199. package/es/DeviceSelect/TreeType.js +0 -36
  200. package/es/DeviceSelect/demo.d.ts +0 -3
  201. package/es/DeviceSelect/demo.js +0 -22
  202. package/es/DeviceSelect/index.css +0 -11
  203. package/es/DeviceSelect/index.d.ts +0 -13
  204. package/es/DeviceSelect/index.js +0 -191
  205. package/es/Dict/cache.d.ts +0 -3
  206. package/es/Dict/cache.js +0 -21
  207. package/es/Dict/device.d.ts +0 -28
  208. package/es/Dict/device.js +0 -117
  209. package/es/Dict/hook.d.ts +0 -3
  210. package/es/Dict/hook.js +0 -98
  211. package/es/Dict/index.d.ts +0 -9
  212. package/es/Dict/index.js +0 -10
  213. package/es/Dict/interface.d.ts +0 -16
  214. package/es/Dict/utils.d.ts +0 -10
  215. package/es/Dict/utils.js +0 -44
  216. package/es/InitialConfig/index.d.ts +0 -8
  217. package/es/InitialConfig/utils.d.ts +0 -20
  218. package/es/InitialConfig/utils.js +0 -110
  219. package/es/InitialRequest/index.d.ts +0 -9
  220. package/es/InitialRequest/index.js +0 -97
  221. package/es/InitialRequest/utils.d.ts +0 -10
  222. package/es/InitialRequest/utils.js +0 -116
  223. package/es/List/CheckExt.d.ts +0 -9
  224. package/es/List/CheckExt.js +0 -36
  225. package/es/List/DeviceList/index.d.ts +0 -11
  226. package/es/List/DeviceList/index.js +0 -50
  227. package/es/List/DynamicDeviceList/Demo.d.ts +0 -3
  228. package/es/List/DynamicDeviceList/index.css +0 -39
  229. package/es/List/DynamicDeviceList/index.d.ts +0 -12
  230. package/es/List/DynamicDeviceList/index.js +0 -205
  231. package/es/List/DynamicDeviceList/interface.d.ts +0 -37
  232. package/es/List/DynamicDeviceList/utils.d.ts +0 -16
  233. package/es/List/ListExt/index.css +0 -3
  234. package/es/List/ListExt/index.d.ts +0 -19
  235. package/es/List/ListExt/index.js +0 -44
  236. package/es/Picture/component/MoveContent/index.d.ts +0 -39
  237. package/es/Picture/component/MoveContent/index.js +0 -244
  238. package/es/Picture/component/MoveContent/utils.d.ts +0 -4
  239. package/es/Title/index.css +0 -25
  240. package/es/Title/index.d.ts +0 -12
  241. package/es/Title/index.js +0 -30
  242. package/es/Tree/BaseTree/demo.d.ts +0 -3
  243. package/es/Tree/BaseTree/index.css +0 -64
  244. package/es/Tree/BaseTree/index.d.ts +0 -24
  245. package/es/Tree/BaseTree/index.js +0 -83
  246. package/es/UserSelect/demo.d.ts +0 -3
  247. package/es/UserSelect/demo.js +0 -21
  248. package/es/UserSelect/index.css +0 -16
  249. package/es/UserSelect/index.d.ts +0 -18
  250. package/es/UserSelect/index.js +0 -194
  251. package/es/WorkerFlow/Demo.js +0 -57
  252. package/es/WorkerFlow/Form/Approver.d.ts +0 -10
  253. package/es/WorkerFlow/Form/Approver.js +0 -33
  254. package/es/WorkerFlow/Form/Condition.d.ts +0 -11
  255. package/es/WorkerFlow/Form/Condition.js +0 -235
  256. package/es/WorkerFlow/Form/EmptyUserSet.d.ts +0 -8
  257. package/es/WorkerFlow/Form/EmptyUserSet.js +0 -137
  258. package/es/WorkerFlow/Form/FormAuth.d.ts +0 -8
  259. package/es/WorkerFlow/Form/GroupList.d.ts +0 -12
  260. package/es/WorkerFlow/Form/GroupList.js +0 -44
  261. package/es/WorkerFlow/Form/GroupSelect.d.ts +0 -8
  262. package/es/WorkerFlow/Form/GroupSelect.js +0 -167
  263. package/es/WorkerFlow/Form/GroupSelectModalContent.d.ts +0 -6
  264. package/es/WorkerFlow/Form/GroupSelectModalContent.js +0 -177
  265. package/es/WorkerFlow/Form/Handle.d.ts +0 -10
  266. package/es/WorkerFlow/Form/Handle.js +0 -33
  267. package/es/WorkerFlow/Form/LevelGroupSelect.d.ts +0 -12
  268. package/es/WorkerFlow/Form/LevelGroupSelect.js +0 -208
  269. package/es/WorkerFlow/Form/Notifier.d.ts +0 -8
  270. package/es/WorkerFlow/Form/Notifier.js +0 -16
  271. package/es/WorkerFlow/Form/UserAndGroupSelect.d.ts +0 -8
  272. package/es/WorkerFlow/Form/UserSelect.d.ts +0 -8
  273. package/es/WorkerFlow/Form/UserSelect.js +0 -150
  274. package/es/WorkerFlow/Form/UserSelectModalContent.d.ts +0 -6
  275. package/es/WorkerFlow/Form/UserSelectModalContent.js +0 -166
  276. package/es/WorkerFlow/Form/UserSet.d.ts +0 -14
  277. package/es/WorkerFlow/Form/UserSet.js +0 -308
  278. package/es/WorkerFlow/Form/UsersHandleType.d.ts +0 -7
  279. package/es/WorkerFlow/Form/UsersHandleType.js +0 -32
  280. package/es/WorkerFlow/Form/utils.d.ts +0 -3
  281. package/es/WorkerFlow/Form/utils.js +0 -47
  282. package/es/WorkerFlow/Nodes/Add.d.ts +0 -7
  283. package/es/WorkerFlow/Nodes/Add.js +0 -97
  284. package/es/WorkerFlow/Nodes/AddOption.d.ts +0 -10
  285. package/es/WorkerFlow/Nodes/AddOption.js +0 -23
  286. package/es/WorkerFlow/Nodes/AddOptionList.d.ts +0 -8
  287. package/es/WorkerFlow/Nodes/AddOptionList.js +0 -46
  288. package/es/WorkerFlow/Nodes/Approver.d.ts +0 -11
  289. package/es/WorkerFlow/Nodes/Approver.js +0 -53
  290. package/es/WorkerFlow/Nodes/Condition.d.ts +0 -10
  291. package/es/WorkerFlow/Nodes/Condition.js +0 -140
  292. package/es/WorkerFlow/Nodes/Constants.d.ts +0 -35
  293. package/es/WorkerFlow/Nodes/Constants.js +0 -150
  294. package/es/WorkerFlow/Nodes/End.d.ts +0 -7
  295. package/es/WorkerFlow/Nodes/End.js +0 -16
  296. package/es/WorkerFlow/Nodes/Handle.d.ts +0 -11
  297. package/es/WorkerFlow/Nodes/Handle.js +0 -52
  298. package/es/WorkerFlow/Nodes/Node.d.ts +0 -8
  299. package/es/WorkerFlow/Nodes/Node.js +0 -26
  300. package/es/WorkerFlow/Nodes/Notifier.d.ts +0 -11
  301. package/es/WorkerFlow/Nodes/Notifier.js +0 -52
  302. package/es/WorkerFlow/Nodes/Render.d.ts +0 -8
  303. package/es/WorkerFlow/Nodes/Render.js +0 -16
  304. package/es/WorkerFlow/Nodes/Start.d.ts +0 -12
  305. package/es/WorkerFlow/Nodes/Start.js +0 -26
  306. package/es/WorkerFlow/Nodes/TitleElement.d.ts +0 -10
  307. package/es/WorkerFlow/Nodes/TitleElement.js +0 -127
  308. package/es/WorkerFlow/Nodes/Wrap.d.ts +0 -13
  309. package/es/WorkerFlow/Nodes/Wrap.js +0 -35
  310. package/es/WorkerFlow/OperatorContext.d.ts +0 -4
  311. package/es/WorkerFlow/OperatorContext.js +0 -3
  312. package/es/WorkerFlow/Tools.d.ts +0 -8
  313. package/es/WorkerFlow/Tools.js +0 -78
  314. package/es/WorkerFlow/XML/CanvasTag.d.ts +0 -3
  315. package/es/WorkerFlow/XML/CanvasTag.js +0 -142
  316. package/es/WorkerFlow/XML/EndEvent.d.ts +0 -1
  317. package/es/WorkerFlow/XML/EndEvent.js +0 -14
  318. package/es/WorkerFlow/XML/ExclusiveGateway.d.ts +0 -9
  319. package/es/WorkerFlow/XML/ExclusiveGateway.js +0 -101
  320. package/es/WorkerFlow/XML/Root.d.ts +0 -1
  321. package/es/WorkerFlow/XML/Root.js +0 -5
  322. package/es/WorkerFlow/XML/StartEvent.d.ts +0 -5
  323. package/es/WorkerFlow/XML/StartEvent.js +0 -28
  324. package/es/WorkerFlow/XML/UserTask.d.ts +0 -5
  325. package/es/WorkerFlow/XML/UserTask.js +0 -93
  326. package/es/WorkerFlow/XML/index.d.ts +0 -4
  327. package/es/WorkerFlow/XML/index.js +0 -100
  328. package/es/WorkerFlow/XML/utils.d.ts +0 -6
  329. package/es/WorkerFlow/XML/utils.js +0 -97
  330. package/es/WorkerFlow/data.json +0 -83
  331. package/es/WorkerFlow/index.css +0 -779
  332. package/es/WorkerFlow/index.d.ts +0 -13
  333. package/es/WorkerFlow/interface.d.ts +0 -93
  334. package/es/WorkerFlow/template.d.ts +0 -2
  335. package/es/WorkerFlow/template.js +0 -17
  336. package/es/WorkerFlow/utils.d.ts +0 -7
  337. package/es/WorkerFlow/utils.js +0 -197
  338. package/es/useHttp/index.d.ts +0 -8
  339. package/pnpm-lock.yaml +0 -13650
package/es/List/index.js CHANGED
@@ -1,169 +1,29 @@
1
- import _isEqual from "@cloud-app-dev/utils/es/isEqual";
2
-
3
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
-
5
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
-
7
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
-
9
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
-
11
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
-
13
- 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."); }
14
-
15
- 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); }
16
-
17
- 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; }
18
-
19
- 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; }
20
-
21
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
-
23
- import React, { useCallback, useEffect, useMemo, useState } from 'react';
24
- import VList from './VList';
25
- import { RenderItem } from './renderItem';
26
- import CheckExt from './CheckExt';
27
- import DeviceList from './DeviceList';
28
- import ListExt from './ListExt';
29
- import DynamicDeviceList from './DynamicDeviceList';
1
+ import React from 'react';
2
+ import DynamicList from './DynamicList';
30
3
  import GridList from './GridList';
31
4
  import DynamicGridList from './DynamicGridList';
5
+ import VList from './VList';
32
6
  import "./index.css";
33
7
 
34
8
  function List(props) {
35
9
  var className = props.className,
36
10
  style = props.style,
37
- CustomRender = props.CustomRender,
38
- itemNameKey = props.itemNameKey,
39
- activeKey = props.activeKey,
40
- checkExt = props.checkExt,
41
- onChecked = props.onChecked,
11
+ renderItem = props.renderItem,
42
12
  list = props.list,
43
- checkedKeys = props.checkedKeys,
44
- itemKey = props.itemKey,
45
- defaultCheckedIds = props.defaultCheckedIds,
46
13
  rowHeight = props.rowHeight,
47
- renderHeader = props.renderHeader;
48
-
49
- var _useState = useState({
50
- checkedKeys: defaultCheckedIds || checkedKeys || []
51
- }),
52
- _useState2 = _slicedToArray(_useState, 2),
53
- state = _useState2[0],
54
- setState = _useState2[1];
55
-
56
- var checkable = useMemo(function () {
57
- return !!onChecked;
58
- }, []);
59
- /**
60
- * 列表选中处理
61
- */
62
-
63
- var onCheckedAction = useCallback(function (e) {
64
- var ids = state.checkedKeys || [];
65
- var id = e.target.value;
66
- var flag = e.target.checked;
67
-
68
- if (flag) {
69
- ids.push(id);
70
- } else {
71
- ids = ids.filter(function (v) {
72
- return v !== id;
73
- });
74
- }
75
-
76
- setState(function (old) {
77
- return Object.assign(Object.assign({}, old), {
78
- checkedKeys: _toConsumableArray(ids)
79
- });
80
- });
81
- onChecked && onChecked(ids);
82
- }, // eslint-disable-next-line react-hooks/exhaustive-deps
83
- [state.checkedKeys]);
84
- /**
85
- * 列表渲染
86
- */
87
-
88
- var renderRow = useCallback(function (data, index) {
89
- var options = Object.assign(Object.assign({}, state), {
90
- item: data,
91
- onChecked: onCheckedAction,
92
- checkable: !!onChecked,
93
- index: index,
94
- style: style,
95
- keywords: props.keywords,
96
- whatIcon: props.whatIcon,
97
- renderItemExt: props.renderItemExt,
98
- onClickItem: props.onClickItem,
99
- onMouseOutItem: props.onMouseOutItem,
100
- onMouseOverItem: props.onMouseOverItem,
101
- itemKey: itemKey,
102
- itemNameKey: itemNameKey,
103
- activeKey: activeKey
104
- });
105
- var ItemRender = CustomRender ? CustomRender : RenderItem;
106
- return /*#__PURE__*/React.createElement(ItemRender, Object.assign({
107
- key: index
108
- }, options));
109
- }, // eslint-disable-next-line react-hooks/exhaustive-deps
110
- [list, state, onChecked, CustomRender, activeKey]);
111
- /**
112
- * 列表全选处理
113
- */
114
-
115
- var onCheck = useCallback(function () {
116
- var ids = list.map(function (v) {
117
- return v[itemKey];
118
- });
119
- setState(function (old) {
120
- return Object.assign(Object.assign({}, old), {
121
- checkedKeys: _toConsumableArray(ids)
122
- });
123
- });
124
- props.onChecked && props.onChecked(ids); // eslint-disable-next-line react-hooks/exhaustive-deps
125
- }, [itemKey, list]);
126
- /**
127
- * 列表取消
128
- */
129
-
130
- var onCancel = useCallback(function () {
131
- setState(function (old) {
132
- return Object.assign(Object.assign({}, old), {
133
- checkedKeys: []
134
- });
135
- });
136
- props.onChecked && props.onChecked([]); // eslint-disable-next-line react-hooks/exhaustive-deps
137
- }, [itemKey, list]);
138
- /**
139
- * 同步选中更新
140
- */
141
-
142
- useEffect(function () {
143
- if (props.checkedKeys && !_isEqual(props.checkedKeys, state.checkedKeys)) {
144
- setState(function (old) {
145
- return Object.assign(Object.assign({}, old), {
146
- checkedKeys: props.checkedKeys
147
- });
148
- });
149
- } // eslint-disable-next-line react-hooks/exhaustive-deps
150
-
151
- }, [props.checkedKeys]);
14
+ renderHeaderExt = props.renderHeaderExt;
152
15
  return /*#__PURE__*/React.createElement("div", {
153
- className: "lm-c-check-list-wrapper ".concat(className),
16
+ className: "lm-c-list-wrapper ".concat(className),
154
17
  style: style
155
- }, renderHeader && renderHeader(), checkExt, checkable && /*#__PURE__*/React.createElement(CheckExt, {
156
- selectCount: state.checkedKeys.length,
157
- count: list.length,
158
- onCheck: onCheck,
159
- onCancel: onCancel
160
- }), /*#__PURE__*/React.createElement("div", {
18
+ }, /*#__PURE__*/React.createElement("div", {
19
+ className: "lm-c-list-header"
20
+ }, renderHeaderExt()), /*#__PURE__*/React.createElement("div", {
161
21
  className: "lm-c-base-list-layout"
162
22
  }, /*#__PURE__*/React.createElement(VList, {
163
23
  className: "lm-c-virtual-layout",
164
24
  data: list,
165
25
  rowHeight: rowHeight || 30,
166
- renderItem: renderRow
26
+ renderItem: renderItem
167
27
  })));
168
28
  }
169
29
 
@@ -171,12 +31,13 @@ List.defaultProps = {
171
31
  className: '',
172
32
  list: [],
173
33
  itemKey: 'id',
174
- itemNameKey: 'name'
34
+ itemNameKey: 'name',
35
+ renderHeaderExt: function renderHeaderExt() {
36
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
37
+ }
175
38
  };
176
39
  List.VList = VList;
177
- List.DeviceList = DeviceList;
178
- List.ListExt = ListExt;
179
- List.DynamicDeviceList = DynamicDeviceList;
40
+ List.DynamicList = DynamicList;
180
41
  List.GridList = GridList;
181
42
  List.DynamicGridList = DynamicGridList;
182
43
  export default List;
@@ -1,4 +1,4 @@
1
- export interface CheckListProps<T> {
1
+ export interface ListProps<T> {
2
2
  /**
3
3
  * @description 列表数据
4
4
  * @default []
@@ -21,67 +21,9 @@ export interface CheckListProps<T> {
21
21
  * @description 列表自定义渲染
22
22
  * @default -
23
23
  */
24
- CustomRender?: () => JSX.Element;
25
-
26
- /**
27
- * @description 列表渲染key字段
28
- * @default id
29
- */
30
- itemKey?: string;
31
-
32
- /**
33
- * @description 列表渲染label字段
34
- * @default name
35
- */
36
- itemNameKey?: string;
37
-
38
- /**
39
- * @description 激活列表key
40
- * @default -
41
- */
42
- activeKey?: string;
43
-
44
- /**
45
- * @description 列表拓展内容
46
- * @default -
47
- */
48
- checkExt?: React.ReactNode;
49
-
50
- /**
51
- * @description 选中事件,影响是否有checkbox
52
- * @default -
53
- */
54
- onChecked?: (ids: Array<string>) => void;
55
-
56
- /**
57
- * @description 选中的key
58
- * @default []
59
- */
60
- checkedKeys?: string[];
61
-
62
- /**
63
- * @description 默认选中的key
64
- * @default []
65
- */
66
- defaultCheckedIds?: string[];
67
-
68
- /**
69
- * @description 高亮关键字
70
- * @default -
71
- */
72
- keywords?: string;
24
+ renderItem: (item: T, index: number) => JSX.Element;
73
25
 
74
26
  rowHeight?: number;
75
27
 
76
- whatIcon?: (item: T) => JSX.Element;
77
-
78
- renderItemExt?: (item: T) => JSX.Element;
79
-
80
- onClickItem?: (item: T) => void;
81
-
82
- onMouseOutItem?: (item: T) => void;
83
-
84
- onMouseOverItem?: (item: T) => void;
85
-
86
- renderHeader?: () => JSX.Element;
28
+ renderHeaderExt?: () => JSX.Element;
87
29
  }
@@ -16,7 +16,7 @@ interface ILoaderAppProps {
16
16
  };
17
17
  /**
18
18
  * @description 微应用加载容器样式
19
- * @default -
19
+ * @default
20
20
  */
21
21
  style?: React.CSSProperties;
22
22
  }
@@ -1,26 +1,14 @@
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
3
  import _useUnmount from "ahooks/es/useUnmount";
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";
6
7
 
7
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; }
8
9
 
9
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
-
11
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
-
13
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
-
15
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
16
-
17
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
18
-
19
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
-
21
10
  import { __awaiter } from "tslib";
22
- import React, { useRef, useState, useMemo } from 'react';
23
- import { getMicroConfig } from './utils';
11
+ import React, { useRef, useMemo } from 'react';
24
12
  import LoaderModule from './loader';
25
13
  import "./index.css";
26
14
 
@@ -32,21 +20,15 @@ function LoaderApp(_ref) {
32
20
  style = _ref.style;
33
21
  var domRef = useRef(null);
34
22
  var styleRef = useRef(null);
35
- var loadedAppRef = useRef(null);
23
+ var loadedAppRef = useRef();
36
24
  var id = useMemo(function () {
37
25
  return _uuid();
38
26
  }, []);
39
-
40
- var _useState = useState('empty'),
41
- _useState2 = _slicedToArray(_useState, 2),
42
- status = _useState2[0],
43
- setStatus = _useState2[1];
27
+ var statusRef = useRef();
44
28
 
45
29
  _useMount(function () {
46
- var config = getMicroConfig(appConfig, appProps, domRef.current);
47
-
48
- if (!config) {
49
- console.error('微应用不存在', 'config ->', appConfig, 'appProps ->', appProps);
30
+ if (!appConfig) {
31
+ console.error('微应用不存在', 'appConfig ->', appConfig, 'appProps ->', appProps);
50
32
  return undefined;
51
33
  }
52
34
 
@@ -58,15 +40,10 @@ function LoaderApp(_ref) {
58
40
  var props = Object.assign(Object.assign({}, appProps), {
59
41
  container: domRef.current
60
42
  });
61
- var routerPrefix = config.routerPrefix;
62
-
63
- var _appConfig$resource = _slicedToArray(appConfig.resource, 2),
64
- script = _appConfig$resource[0],
65
- style = _appConfig$resource[1];
66
-
43
+ var routerPrefix = appConfig.routerPrefix,
44
+ html = appConfig.html;
67
45
  var options = {
68
- script: script,
69
- style: style,
46
+ html: html,
70
47
  name: routerPrefix,
71
48
  prefix: ".".concat(routerPrefix, "-").concat(id),
72
49
  styleNode: styleRef.current
@@ -77,25 +54,25 @@ function LoaderApp(_ref) {
77
54
  while (1) {
78
55
  switch (_context.prev = _context.next) {
79
56
  case 0:
80
- loadedAppRef.current = mod;
81
-
82
- if (!status) {
83
- _context.next = 4;
84
- break;
85
- }
57
+ loadedAppRef.current = mod; // 沙箱销毁方法
86
58
 
87
- _context.next = 4;
59
+ _context.next = 3;
88
60
  return mod.bootstrap(props);
89
61
 
90
- case 4:
91
- setStatus('bootstrap');
92
- _context.next = 7;
62
+ case 3:
63
+ _nextTick(function () {
64
+ return statusRef.current = 'bootstrap';
65
+ });
66
+
67
+ _context.next = 6;
93
68
  return mod.mount(props);
94
69
 
95
- case 7:
96
- setStatus('mount');
70
+ case 6:
71
+ _nextTick(function () {
72
+ return statusRef.current = 'mounted';
73
+ });
97
74
 
98
- case 8:
75
+ case 7:
99
76
  case "end":
100
77
  return _context.stop();
101
78
  }
@@ -112,7 +89,11 @@ function LoaderApp(_ref) {
112
89
  container: domRef.current
113
90
  });
114
91
  app.unmount(props);
115
- setStatus('unmount');
92
+
93
+ _nextTick(function () {
94
+ return statusRef.current = 'unmount';
95
+ });
96
+
116
97
  loadedAppRef.current = null;
117
98
  }
118
99
  });
@@ -3,4 +3,7 @@ export interface AppInstance {
3
3
  mount: (props: any) => Promise<any>;
4
4
  unmount: (props: any) => Promise<any>;
5
5
  update: (props: any) => Promise<any>;
6
+ unmountDev?: (props: any) => Promise<any>;
6
7
  }
8
+
9
+
@@ -1,20 +1,19 @@
1
1
  import { AppInstance } from './interface';
2
- interface createScopedCssText {
2
+ interface createScopedCssTextProps {
3
3
  styleNode: HTMLStyleElement;
4
4
  prefix: string;
5
5
  }
6
- export declare function createScopedCssText({ styleNode, prefix }: createScopedCssText): string;
6
+ export declare function createScopedCssText({ styleNode, prefix }: createScopedCssTextProps): string;
7
7
  interface ILoaderStyleProps {
8
- style: string;
8
+ cssText: string;
9
9
  prefix: string;
10
10
  styleNode: HTMLStyleElement;
11
11
  }
12
- export declare function LoaderStyle({ style, prefix, styleNode }: ILoaderStyleProps): Promise<void>;
12
+ export declare function LoaderStyle({ cssText, prefix, styleNode }: ILoaderStyleProps): Promise<void>;
13
13
  interface ILoaderModuleProps {
14
- script: string;
15
- style: string;
16
14
  prefix: string;
17
15
  styleNode: HTMLStyleElement;
16
+ html: string;
18
17
  }
19
- export default function LoaderModule({ script, style, prefix, styleNode }: ILoaderModuleProps): Promise<AppInstance>;
18
+ export default function LoaderModule({ prefix, styleNode, html }: ILoaderModuleProps): Promise<AppInstance>;
20
19
  export {};
@@ -3,8 +3,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3
3
  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; }
4
4
 
5
5
  import { __awaiter } from "tslib";
6
- import { arrayify, fetchStyle, rewrite } from './utils';
7
- var _global = window;
6
+ import { arrayify, rewrite, importHTML } from './utils';
8
7
  export function createScopedCssText(_ref) {
9
8
  var styleNode = _ref.styleNode,
10
9
  prefix = _ref.prefix;
@@ -16,35 +15,23 @@ export function createScopedCssText(_ref) {
16
15
  return rewrite(rules, prefix);
17
16
  }
18
17
  export function LoaderStyle(_ref2) {
19
- var style = _ref2.style,
18
+ var cssText = _ref2.cssText,
20
19
  prefix = _ref2.prefix,
21
20
  styleNode = _ref2.styleNode;
22
21
  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
23
- var cssText, textNode, scopeCssText;
22
+ var scopeCssText;
24
23
  return _regeneratorRuntime().wrap(function _callee$(_context) {
25
24
  while (1) {
26
25
  switch (_context.prev = _context.next) {
27
26
  case 0:
28
- if (!style) {
29
- _context.next = 9;
30
- break;
31
- }
32
-
33
- _context.next = 3;
34
- return fetchStyle(style);
35
-
36
- case 3:
37
- cssText = _context.sent;
38
- textNode = document.createTextNode(cssText || '');
39
- styleNode.appendChild(textNode);
27
+ styleNode.innerHTML = cssText;
40
28
  scopeCssText = createScopedCssText({
41
29
  prefix: prefix,
42
30
  styleNode: styleNode
43
31
  });
44
32
  styleNode.textContent = scopeCssText;
45
- textNode.remove();
46
33
 
47
- case 9:
34
+ case 3:
48
35
  case "end":
49
36
  return _context.stop();
50
37
  }
@@ -53,30 +40,33 @@ export function LoaderStyle(_ref2) {
53
40
  }));
54
41
  }
55
42
  export default function LoaderModule(_ref3) {
56
- var script = _ref3.script,
57
- style = _ref3.style,
58
- prefix = _ref3.prefix,
59
- styleNode = _ref3.styleNode;
43
+ var prefix = _ref3.prefix,
44
+ styleNode = _ref3.styleNode,
45
+ html = _ref3.html;
60
46
  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
47
+ var cssText, exports, result;
61
48
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
62
49
  while (1) {
63
50
  switch (_context2.prev = _context2.next) {
64
51
  case 0:
65
52
  _context2.next = 2;
53
+ return importHTML(html);
54
+
55
+ case 2:
56
+ result = _context2.sent;
57
+ cssText = result.cssTexts.join(' ');
58
+ exports = result.appInstance;
59
+ _context2.next = 7;
66
60
  return LoaderStyle({
67
- style: style,
61
+ cssText: cssText,
68
62
  prefix: prefix,
69
63
  styleNode: styleNode
70
64
  });
71
65
 
72
- case 2:
73
- _context2.next = 4;
74
- return _global.System.import(script);
75
-
76
- case 4:
77
- return _context2.abrupt("return", _context2.sent);
66
+ case 7:
67
+ return _context2.abrupt("return", exports);
78
68
 
79
- case 5:
69
+ case 8:
80
70
  case "end":
81
71
  return _context2.stop();
82
72
  }
@@ -0,0 +1,18 @@
1
+ declare type FakeWindow = Window & Record<PropertyKey, any>;
2
+ declare class Sandbox {
3
+ fakeWindow: FakeWindow;
4
+ proxy: Window;
5
+ updateKeys: Set<unknown>;
6
+ listenerMap: Map<string, EventListenerOrEventListenerObject[]>;
7
+ timeoutList: number[];
8
+ intervalList: number[];
9
+ originKeys: string[];
10
+ showlog: boolean;
11
+ hasDisposed: boolean;
12
+ constructor(showlog?: boolean);
13
+ execScript(scriptText: string): void;
14
+ showWindowKeys(): string[];
15
+ preview(): void;
16
+ dispose(): void;
17
+ }
18
+ export default Sandbox;