@cloud-app-dev/vidc 2.0.0-alpha.1 → 2.0.0-alpha.13

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 (277) hide show
  1. package/.umirc.ts +2 -3
  2. package/es/Api/index.d.ts +3 -4
  3. package/es/Api/index.js +7 -8
  4. package/es/AppRedirect/index.css +0 -0
  5. package/es/AppRedirect/index.d.ts +16 -0
  6. package/es/AppRedirect/index.js +34 -0
  7. package/es/AppRoute/index.d.ts +10 -0
  8. package/es/AppRoute/index.js +115 -0
  9. package/es/AppRoute/interface.d.ts +8 -0
  10. package/es/Auth/index.d.ts +8 -0
  11. package/es/Auth/index.js +17 -0
  12. package/es/AutoExit/index.js +15 -10
  13. package/es/Box/BetweenBox/index.css +5 -0
  14. package/es/Box/BetweenBox/index.d.ts +12 -0
  15. package/es/Box/BetweenBox/index.js +24 -0
  16. package/es/Box/InfoBox/index.css +23 -0
  17. package/es/Box/InfoBox/index.d.ts +12 -0
  18. package/es/Box/InfoBox/index.js +26 -0
  19. package/es/Box/TwoColumnBox/index.css +77 -0
  20. package/es/Box/TwoColumnBox/index.d.ts +10 -0
  21. package/es/Box/TwoColumnBox/index.js +50 -0
  22. package/es/Box/deps/content-grid.d.ts +9 -0
  23. package/es/Box/deps/content-grid.js +9 -0
  24. package/es/Box/deps/grid-factory.d.ts +10 -0
  25. package/es/Box/deps/grid-factory.js +72 -0
  26. package/es/Box/deps/simple-grid.d.ts +9 -0
  27. package/es/Box/deps/simple-grid.js +8 -0
  28. package/es/Box/index.css +9 -0
  29. package/es/Box/index.d.ts +14 -0
  30. package/es/Box/index.js +28 -0
  31. package/es/CheckGroupFixed/index.css +49 -0
  32. package/es/CheckGroupFixed/index.d.ts +17 -0
  33. package/es/CheckGroupFixed/index.js +148 -0
  34. package/es/Config/index.js +63 -6
  35. package/es/Config/interface.d.ts +30 -5
  36. package/es/Config/utils.d.ts +2 -11
  37. package/es/Config/utils.js +1 -12
  38. package/es/ConfigContext/index.d.ts +3 -0
  39. package/es/DeviceIcon/icon.js +5 -5
  40. package/es/DeviceIcon/index.js +2 -2
  41. package/es/DeviceSelect/TreeType.d.ts +6 -0
  42. package/es/DeviceSelect/TreeType.js +36 -0
  43. package/es/DeviceSelect/demo.js +2 -2
  44. package/es/DeviceSelect/index.css +6 -1
  45. package/es/DeviceSelect/index.d.ts +5 -0
  46. package/es/DeviceSelect/index.js +22 -53
  47. package/es/Dict/cache.d.ts +3 -0
  48. package/es/Dict/cache.js +21 -0
  49. package/es/Dict/desc.d.ts +64 -0
  50. package/es/Dict/desc.js +162 -0
  51. package/es/Dict/device.d.ts +28 -0
  52. package/es/Dict/device.js +117 -0
  53. package/es/Dict/hook.d.ts +4 -0
  54. package/es/Dict/hook.js +114 -0
  55. package/es/Dict/index.d.ts +13 -0
  56. package/es/Dict/index.js +14 -0
  57. package/es/Dict/interface.d.ts +16 -0
  58. package/es/Dict/utils.d.ts +11 -0
  59. package/es/Dict/utils.js +51 -0
  60. package/es/Drag/DragAndDropItem.d.ts +4 -0
  61. package/es/Drag/DragAndDropItem.js +145 -0
  62. package/es/Drag/DropItem.d.ts +4 -0
  63. package/es/Drag/DropItem.js +54 -0
  64. package/es/Drag/index.css +0 -0
  65. package/es/Drag/index.d.ts +7 -0
  66. package/es/Drag/index.js +7 -0
  67. package/es/Drag/interface.d.ts +16 -0
  68. package/es/Drawer/Demo.d.ts +3 -0
  69. package/es/Drawer/Demo.js +52 -0
  70. package/es/Drawer/Footer.d.ts +4 -0
  71. package/es/Drawer/Footer.js +26 -0
  72. package/es/Drawer/index.css +39 -0
  73. package/es/Drawer/index.d.ts +12 -0
  74. package/es/Drawer/index.js +41 -0
  75. package/es/Drawer/interface.d.ts +191 -0
  76. package/es/FullScreen/index.css +16 -0
  77. package/es/FullScreen/index.d.ts +10 -0
  78. package/es/FullScreen/index.js +68 -0
  79. package/es/HightLevel/index.css +3 -0
  80. package/es/HightLevel/index.d.ts +9 -0
  81. package/es/HightLevel/index.js +23 -0
  82. package/es/IconFont/index.d.ts +12 -0
  83. package/es/IconFont/index.js +57 -0
  84. package/es/ImageView/index.css +6 -0
  85. package/es/ImageView/index.d.ts +17 -0
  86. package/es/ImageView/index.js +58 -0
  87. package/es/InitialConfig/index.js +7 -11
  88. package/es/InitialConfig/utils.d.ts +1 -1
  89. package/es/InitialConfig/utils.js +8 -31
  90. package/es/InitialRequest/index.d.ts +1 -1
  91. package/es/InitialRequest/index.js +19 -11
  92. package/es/InitialRequest/utils.d.ts +5 -4
  93. package/es/InitialRequest/utils.js +58 -94
  94. package/es/Input/index.css +8 -0
  95. package/es/Input/index.d.ts +18 -0
  96. package/es/Input/index.js +76 -0
  97. package/es/LabelValue/index.css +18 -0
  98. package/es/LabelValue/index.d.ts +23 -0
  99. package/es/LabelValue/index.js +32 -0
  100. package/es/{DynamicDeviceList → List}/CheckExt.d.ts +0 -0
  101. package/es/{DynamicDeviceList → List}/CheckExt.js +4 -4
  102. package/es/List/DeviceList/index.css +0 -0
  103. package/es/List/DeviceList/index.d.ts +11 -0
  104. package/es/{DeviceList → List/DeviceList}/index.js +8 -20
  105. package/es/{DynamicDeviceList → List/DynamicDeviceList}/Demo.d.ts +0 -0
  106. package/es/List/DynamicDeviceList/Demo.js +54 -0
  107. package/es/{DynamicDeviceList → List/DynamicDeviceList}/index.css +5 -17
  108. package/es/List/DynamicDeviceList/index.d.ts +11 -0
  109. package/es/List/DynamicDeviceList/index.js +205 -0
  110. package/es/List/DynamicDeviceList/interface.d.ts +37 -0
  111. package/es/List/DynamicDeviceList/utils.d.ts +16 -0
  112. package/es/List/DynamicDeviceList/utils.js +61 -0
  113. package/es/List/DynamicGridList/Demo.d.ts +2 -0
  114. package/es/List/DynamicGridList/Demo.js +70 -0
  115. package/es/List/DynamicGridList/index.d.ts +26 -0
  116. package/es/List/DynamicGridList/index.js +73 -0
  117. package/es/List/GridList/Demo.d.ts +2 -0
  118. package/es/List/GridList/Demo.js +91 -0
  119. package/es/List/GridList/hook.d.ts +13 -0
  120. package/es/List/GridList/hook.js +301 -0
  121. package/es/List/GridList/index.css +7 -0
  122. package/es/List/GridList/index.d.ts +15 -0
  123. package/es/List/GridList/index.js +47 -0
  124. package/es/List/GridList/interface.d.ts +59 -0
  125. package/es/List/GridList/utils.d.ts +9 -0
  126. package/es/List/GridList/utils.js +43 -0
  127. package/es/List/ListExt/index.css +3 -0
  128. package/es/List/ListExt/index.d.ts +19 -0
  129. package/es/List/ListExt/index.js +44 -0
  130. package/es/List/VList/index.css +6 -0
  131. package/es/List/VList/index.d.ts +18 -0
  132. package/es/List/VList/index.js +51 -0
  133. package/es/List/VList/utils.d.ts +14 -0
  134. package/es/List/VList/utils.js +17 -0
  135. package/es/List/index.css +60 -5
  136. package/es/List/index.d.ts +10 -13
  137. package/es/List/index.js +170 -36
  138. package/es/List/interface.d.ts +87 -0
  139. package/es/List/renderItem.d.ts +20 -0
  140. package/es/List/renderItem.js +71 -0
  141. package/es/LoaderApp/index.css +3 -0
  142. package/es/LoaderApp/index.d.ts +31 -0
  143. package/es/LoaderApp/index.js +135 -0
  144. package/es/LoaderApp/interface.d.ts +6 -0
  145. package/es/LoaderApp/loader.d.ts +20 -0
  146. package/es/LoaderApp/loader.js +86 -0
  147. package/es/LoaderApp/utils.d.ts +13 -0
  148. package/es/LoaderApp/utils.js +121 -0
  149. package/es/LoaderScript/index.d.ts +26 -0
  150. package/es/LoaderScript/index.js +127 -0
  151. package/es/LoaderScript/interface.d.ts +26 -0
  152. package/es/LoaderScript/utils.d.ts +12 -0
  153. package/es/LoaderScript/utils.js +133 -0
  154. package/es/Modal/index.css +43 -0
  155. package/es/Modal/index.d.ts +17 -0
  156. package/es/Modal/index.js +34 -0
  157. package/es/Modal/interface.d.ts +339 -0
  158. package/es/Picture/component/DefaultRects/RectInfo.d.ts +7 -0
  159. package/es/Picture/component/DefaultRects/RectInfo.js +94 -0
  160. package/es/Picture/component/DefaultRects/index.css +247 -0
  161. package/es/Picture/component/DefaultRects/index.d.ts +12 -0
  162. package/es/Picture/component/DefaultRects/index.js +47 -0
  163. package/es/Picture/component/DefaultRects/utils.d.ts +2 -0
  164. package/es/Picture/component/DefaultRects/utils.js +11 -0
  165. package/es/Picture/component/DrawRect/index.css +8 -0
  166. package/es/Picture/component/DrawRect/index.d.ts +14 -0
  167. package/es/Picture/component/DrawRect/index.js +41 -0
  168. package/es/Picture/component/MoveContent/index.css +0 -0
  169. package/es/Picture/component/MoveContent/index.d.ts +39 -0
  170. package/es/Picture/component/MoveContent/index.js +240 -0
  171. package/es/Picture/component/MoveContent/utils.d.ts +4 -0
  172. package/es/Picture/component/MoveContent/utils.js +19 -0
  173. package/es/Picture/component/RectMenu/index.css +31 -0
  174. package/es/Picture/component/RectMenu/index.d.ts +13 -0
  175. package/es/Picture/component/RectMenu/index.js +81 -0
  176. package/es/Picture/component/RectMenu/utils.d.ts +12 -0
  177. package/es/Picture/component/RectMenu/utils.js +22 -0
  178. package/es/Picture/component/Tools/index.css +42 -0
  179. package/es/Picture/component/Tools/index.d.ts +13 -0
  180. package/es/Picture/component/Tools/index.js +83 -0
  181. package/es/Picture/component/WheelScale/index.d.ts +6 -0
  182. package/es/Picture/component/WheelScale/index.js +29 -0
  183. package/es/Picture/dragBound.d.ts +5 -0
  184. package/es/Picture/dragBound.js +77 -0
  185. package/es/Picture/index.css +12 -0
  186. package/es/Picture/index.d.ts +16 -0
  187. package/es/Picture/index.js +344 -0
  188. package/es/Picture/interface.d.ts +67 -0
  189. package/es/Picture/loadCaptureRectImage.d.ts +8 -0
  190. package/es/Picture/loadCaptureRectImage.js +119 -0
  191. package/es/Picture/useDraw.d.ts +1 -0
  192. package/es/Picture/useDraw.js +136 -0
  193. package/es/Picture/utils.d.ts +22 -0
  194. package/es/Picture/utils.js +90 -0
  195. package/es/Progress/index.css +20 -0
  196. package/es/Progress/index.d.ts +11 -0
  197. package/es/Progress/index.js +68 -0
  198. package/es/RefDrawer/index.js +4 -5
  199. package/es/RefModal/index.js +4 -5
  200. package/es/Service/http.d.ts +1 -1
  201. package/es/Service/http.js +2 -25
  202. package/es/TableLayout/index.css +4 -0
  203. package/es/TableLayout/index.d.ts +13 -0
  204. package/es/TableLayout/index.js +33 -0
  205. package/es/ThemeAntd/index.css +501 -0
  206. package/es/ThemeAntd/index.d.ts +7 -0
  207. package/es/ThemeAntd/index.js +6 -0
  208. package/es/ThemeAntd/style/button.css +46 -0
  209. package/es/ThemeAntd/style/checkbox.css +64 -0
  210. package/es/ThemeAntd/style/form.css +10 -0
  211. package/es/ThemeAntd/style/input.css +58 -0
  212. package/es/ThemeAntd/style/pagination.css +44 -0
  213. package/es/ThemeAntd/style/picker.css +86 -0
  214. package/es/ThemeAntd/style/popover.css +3 -0
  215. package/es/ThemeAntd/style/radio.css +71 -0
  216. package/es/ThemeAntd/style/scrollbar.css +19 -0
  217. package/es/ThemeAntd/style/select.css +57 -0
  218. package/es/ThemeAntd/style/table.css +36 -0
  219. package/es/ThemeAntd/style/tree.css +4 -0
  220. package/es/{TreeTitle → Title}/index.css +5 -5
  221. package/es/{TreeTitle → Title}/index.d.ts +2 -2
  222. package/es/{TreeTitle → Title}/index.js +9 -6
  223. package/es/{TreeMode → Tree/BaseTree}/demo.d.ts +0 -0
  224. package/es/Tree/BaseTree/demo.js +69 -0
  225. package/es/Tree/BaseTree/index.css +64 -0
  226. package/es/Tree/BaseTree/index.d.ts +24 -0
  227. package/es/Tree/BaseTree/index.js +83 -0
  228. package/es/Tree/demo.d.ts +2 -0
  229. package/es/{TreeMode → Tree}/demo.js +0 -0
  230. package/es/{TreeMode → Tree}/index.css +1 -1
  231. package/es/{TreeMode → Tree}/index.d.ts +1 -1
  232. package/es/{TreeMode → Tree}/index.js +9 -12
  233. package/es/UserSelect/index.d.ts +3 -3
  234. package/es/UserSelect/index.js +18 -15
  235. package/es/WorkerFlow/Form/Condition.js +6 -8
  236. package/es/WorkerFlow/Form/EmptyUserSet.js +4 -6
  237. package/es/WorkerFlow/Form/FormAuth.js +3 -3
  238. package/es/WorkerFlow/Form/GroupList.js +2 -2
  239. package/es/WorkerFlow/Form/GroupSelect.js +4 -6
  240. package/es/WorkerFlow/Form/GroupSelectModalContent.js +8 -7
  241. package/es/WorkerFlow/Form/LevelGroupSelect.js +5 -7
  242. package/es/WorkerFlow/Form/UserAndGroupSelect.js +4 -6
  243. package/es/WorkerFlow/Form/UserSelect.js +4 -6
  244. package/es/WorkerFlow/Form/UserSelectModalContent.js +8 -6
  245. package/es/WorkerFlow/Form/UserSet.js +3 -3
  246. package/es/WorkerFlow/Nodes/Add.js +2 -3
  247. package/es/WorkerFlow/Nodes/AddOption.js +2 -2
  248. package/es/WorkerFlow/Nodes/Approver.js +2 -2
  249. package/es/WorkerFlow/Nodes/Condition.js +2 -2
  250. package/es/WorkerFlow/Nodes/Handle.js +2 -2
  251. package/es/WorkerFlow/Nodes/Notifier.js +2 -2
  252. package/es/WorkerFlow/Nodes/TitleElement.js +70 -36
  253. package/es/WorkerFlow/index.css +9 -3
  254. package/es/WorkerFlow/index.js +3 -3
  255. package/es/WorkerFlow/utils.js +2 -2
  256. package/es/core.d.ts +27 -0
  257. package/es/index.d.ts +27 -4
  258. package/es/index.js +27 -4
  259. package/es/useDrawer/index.d.ts +14 -0
  260. package/es/useDrawer/index.js +91 -0
  261. package/es/useHttp/index.d.ts +8 -0
  262. package/es/useHttp/index.js +78 -0
  263. package/es/useModal/index.d.ts +14 -0
  264. package/es/useModal/index.js +93 -0
  265. package/es/useNavigate/index.css +0 -0
  266. package/es/useNavigate/index.d.ts +4 -0
  267. package/es/useNavigate/index.js +14 -0
  268. package/es/utils.d.ts +11 -0
  269. package/es/utils.js +68 -1
  270. package/package.json +10 -8
  271. package/es/DeviceList/index.css +0 -32
  272. package/es/DeviceList/index.d.ts +0 -14
  273. package/es/DynamicDeviceList/Demo.js +0 -17
  274. package/es/DynamicDeviceList/index.d.ts +0 -35
  275. package/es/DynamicDeviceList/index.js +0 -224
  276. package/es/DynamicDeviceList/utils.d.ts +0 -2
  277. package/es/DynamicDeviceList/utils.js +0 -15
@@ -0,0 +1,11 @@
1
+ import { IDynamicDeviceListProps } from './interface';
2
+ import './index.less';
3
+ declare function DynamicDeviceList({ onClick, checkedKeys, defaultCheckedIds, onChecked, params, title, onKeywordChange, limit, itemHeight }: IDynamicDeviceListProps): JSX.Element;
4
+ declare namespace DynamicDeviceList {
5
+ var defaultProps: {
6
+ limit: number;
7
+ itemHeight: number;
8
+ params: {};
9
+ };
10
+ }
11
+ export default DynamicDeviceList;
@@ -0,0 +1,205 @@
1
+ import "antd/lib/skeleton/style";
2
+ import _Skeleton from "antd/lib/skeleton";
3
+ import "antd/lib/checkbox/style";
4
+ import _Checkbox from "antd/lib/checkbox";
5
+ import _useMemoizedFn from "ahooks/es/useMemoizedFn";
6
+ import _useUpdateEffect from "ahooks/es/useUpdateEffect";
7
+ import _useVirtualList3 from "ahooks/es/useVirtualList";
8
+ import _useInfiniteScroll2 from "ahooks/es/useInfiniteScroll";
9
+
10
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
11
+
12
+ 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."); }
13
+
14
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
15
+
16
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
17
+
18
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
19
+
20
+ 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."); }
21
+
22
+ 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); }
23
+
24
+ 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; }
25
+
26
+ 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; }
27
+
28
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
29
+
30
+ import React, { useCallback, useMemo, useRef, useState } from 'react';
31
+ import DeviceIcon from '../../DeviceIcon';
32
+ import Title from '../../Title';
33
+ import CheckExt from '../CheckExt';
34
+ import { loadNextPage, LIMIT, skeletonList } from './utils';
35
+ import "./index.css";
36
+
37
+ function DynamicDeviceList(_ref) {
38
+ var onClick = _ref.onClick,
39
+ checkedKeys = _ref.checkedKeys,
40
+ defaultCheckedIds = _ref.defaultCheckedIds,
41
+ onChecked = _ref.onChecked,
42
+ params = _ref.params,
43
+ title = _ref.title,
44
+ onKeywordChange = _ref.onKeywordChange,
45
+ limit = _ref.limit,
46
+ itemHeight = _ref.itemHeight;
47
+
48
+ var _useState = useState({
49
+ checkedKeys: defaultCheckedIds || checkedKeys || []
50
+ }),
51
+ _useState2 = _slicedToArray(_useState, 2),
52
+ state = _useState2[0],
53
+ setState = _useState2[1];
54
+
55
+ var containerRef = useRef();
56
+ var wrapperRef = useRef();
57
+
58
+ var _useInfiniteScroll = _useInfiniteScroll2(function (d) {
59
+ return loadNextPage(d, limit, params);
60
+ }, {
61
+ target: containerRef,
62
+ threshold: 50,
63
+ isNoMore: function isNoMore(d) {
64
+ var _a;
65
+
66
+ return ((_a = d === null || d === void 0 ? void 0 : d.list) === null || _a === void 0 ? void 0 : _a.length) >= (d === null || d === void 0 ? void 0 : d.count);
67
+ },
68
+ reloadDeps: [params.placeIds, params.buzGroupId]
69
+ }),
70
+ data = _useInfiniteScroll.data,
71
+ loadingMore = _useInfiniteScroll.loadingMore,
72
+ noMore = _useInfiniteScroll.noMore;
73
+
74
+ var isSkeleton = useMemo(function () {
75
+ return !noMore && loadingMore;
76
+ }, [noMore, loadingMore]);
77
+ var dataList = useMemo(function () {
78
+ return data ? (data === null || data === void 0 ? void 0 : data.list) || [] : [];
79
+ }, [data]);
80
+
81
+ var _useVirtualList = _useVirtualList3(dataList, {
82
+ containerTarget: containerRef,
83
+ wrapperTarget: wrapperRef,
84
+ itemHeight: itemHeight,
85
+ overscan: 10
86
+ }),
87
+ _useVirtualList2 = _slicedToArray(_useVirtualList, 2),
88
+ list = _useVirtualList2[0],
89
+ scrollTo = _useVirtualList2[1];
90
+ /**
91
+ * 列表选中处理
92
+ */
93
+
94
+
95
+ var onCheckedAction = useCallback(function (item) {
96
+ var ids = state.checkedKeys || [];
97
+ var id = item.cid;
98
+ var checked = !ids.includes(item.cid);
99
+
100
+ if (checked) {
101
+ ids.push(id);
102
+ } else {
103
+ ids = ids.filter(function (v) {
104
+ return v !== id;
105
+ });
106
+ }
107
+
108
+ setState(function (old) {
109
+ return Object.assign(Object.assign({}, old), {
110
+ checkedKeys: _toConsumableArray(ids)
111
+ });
112
+ });
113
+ onChecked && onChecked(ids, [item], checked);
114
+ }, // eslint-disable-next-line react-hooks/exhaustive-deps
115
+ [state.checkedKeys]);
116
+
117
+ _useUpdateEffect(function () {
118
+ return scrollTo(0);
119
+ }, [params.placeIds, params.buzGroupId]);
120
+
121
+ var onSelectAll = _useMemoizedFn(function () {
122
+ var ids = dataList.map(function (v) {
123
+ return v.cid;
124
+ });
125
+ setState(function (old) {
126
+ return Object.assign(Object.assign({}, old), {
127
+ checkedKeys: ids
128
+ });
129
+ });
130
+ onChecked && onChecked(ids, dataList, true);
131
+ });
132
+
133
+ var onCancelAll = function onCancelAll() {
134
+ setState(function (old) {
135
+ return Object.assign(Object.assign({}, old), {
136
+ checkedKeys: []
137
+ });
138
+ });
139
+ onChecked && onChecked([], [], false);
140
+ };
141
+
142
+ return /*#__PURE__*/React.createElement("div", {
143
+ className: "zenview-c-dynamic-device-list-layout"
144
+ }, /*#__PURE__*/React.createElement(Title, {
145
+ title: title,
146
+ onChange: onKeywordChange,
147
+ inputPlaceholder: "\u8BF7\u8F93\u5165\u8BBE\u5907\u540D\u79F0"
148
+ }), onChecked && /*#__PURE__*/React.createElement(CheckExt, {
149
+ count: data === null || data === void 0 ? void 0 : data.count,
150
+ selectCount: state.checkedKeys.length,
151
+ onCancel: onCancelAll,
152
+ onCheck: onSelectAll
153
+ }), /*#__PURE__*/React.createElement("div", {
154
+ className: "zenview-c-dynamic-device-box",
155
+ ref: containerRef
156
+ }, /*#__PURE__*/React.createElement("div", {
157
+ ref: wrapperRef
158
+ }, list.map(function (item) {
159
+ return /*#__PURE__*/React.createElement("div", {
160
+ key: item.index,
161
+ className: "device-item-box ".concat(state.checkedKeys.includes(item.data.cid) ? 'device-item-selected' : '')
162
+ }, onChecked ? /*#__PURE__*/React.createElement(_Checkbox, {
163
+ className: "device-name device-checkbox-name",
164
+ checked: state.checkedKeys.includes(item.data.cid),
165
+ value: item.data.cid,
166
+ onClick: function onClick() {
167
+ return onCheckedAction(item.data);
168
+ }
169
+ }, /*#__PURE__*/React.createElement(DeviceIcon, {
170
+ type: item.data.deviceType,
171
+ status: item.data.deviceStatus
172
+ }), /*#__PURE__*/React.createElement("span", {
173
+ title: item.data.deviceName
174
+ }, item.data.deviceName)) : /*#__PURE__*/React.createElement("span", {
175
+ className: "device-name",
176
+ onClick: onClick ? function () {
177
+ return onClick(item);
178
+ } : undefined
179
+ }, /*#__PURE__*/React.createElement(DeviceIcon, {
180
+ type: item.data.deviceType,
181
+ status: item.data.deviceStatus
182
+ }), /*#__PURE__*/React.createElement("span", {
183
+ title: item.data.deviceName
184
+ }, item.data.deviceName)));
185
+ })), isSkeleton && skeletonList.map(function (_, index) {
186
+ return /*#__PURE__*/React.createElement("div", {
187
+ key: index,
188
+ style: {
189
+ padding: '0 10px'
190
+ },
191
+ className: "dynamic-list-item"
192
+ }, /*#__PURE__*/React.createElement(_Skeleton, {
193
+ paragraph: false,
194
+ loading: true,
195
+ active: true
196
+ }));
197
+ })));
198
+ }
199
+
200
+ DynamicDeviceList.defaultProps = {
201
+ limit: LIMIT,
202
+ itemHeight: 40,
203
+ params: {}
204
+ };
205
+ export default DynamicDeviceList;
@@ -0,0 +1,37 @@
1
+ export interface IDynamicDeviceListProps {
2
+ /**
3
+ * @description 列表点击事件
4
+ */
5
+ onClick?: (item: DeviceItemType) => void;
6
+
7
+ /**
8
+ * @description 选中设备cid集合
9
+ */
10
+ checkedKeys?: string[];
11
+
12
+ /**
13
+ * @description 传入onSelect列表默认渲染为checkbox模式
14
+ */
15
+ onChecked?: (ids: string[], list: DeviceItemType[], checked: boolean) => void;
16
+
17
+ /**
18
+ * @description 传入queryList需要的参数,例如业务树ID,场所id等,分页参数除外
19
+ */
20
+ params?: { [key: string]: any };
21
+
22
+ title?: string;
23
+
24
+ onKeywordChange?: (v: string) => void;
25
+
26
+ defaultCheckedIds?: string[];
27
+
28
+ limit?: number;
29
+
30
+ itemHeight?: number;
31
+ }
32
+
33
+ export interface IDynamicDeviceListResult<T> {
34
+ list: T[];
35
+ offset: number;
36
+ [key: string]: any;
37
+ }
@@ -0,0 +1,16 @@
1
+ import { DeviceItemType, HttpPageResult2 } from '../../core';
2
+ import { IDynamicDeviceListResult } from './interface';
3
+ export declare function queryDeviceList(params?: any): Promise<HttpPageResult2<DeviceItemType>>;
4
+ export declare const LIMIT = 30;
5
+ /**
6
+ * @desc 懒加载方法
7
+ */
8
+ export declare const loadNextPage: (d?: IDynamicDeviceListResult<DeviceItemType>, defaultLimit?: number, params?: any) => Promise<{
9
+ list: DeviceItemType[];
10
+ count: number;
11
+ offset: number;
12
+ limit: number;
13
+ }>;
14
+ export declare const skeletonList: {
15
+ skeleton: boolean;
16
+ }[];
@@ -0,0 +1,61 @@
1
+ import { __awaiter } from "tslib";
2
+ import Service from '../../Service';
3
+ import { getHeader } from '../../utils';
4
+ export function queryDeviceList() {
5
+ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
+ return Service.$http({
7
+ method: 'post',
8
+ url: '/api/udm-api/device/queryList',
9
+ requestId: 'queryDeviceList',
10
+ headers: getHeader(),
11
+ data: Object.assign(Object.assign({}, params), {
12
+ includeSubOrganizations: 1,
13
+ isPagination: true
14
+ })
15
+ });
16
+ }
17
+ export var LIMIT = 30;
18
+ /**
19
+ * @desc 懒加载方法
20
+ */
21
+
22
+ export var loadNextPage = function loadNextPage(d, defaultLimit) {
23
+ var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
24
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
25
+ var _ref, offset, limit, pageLimit, pageOffset, res;
26
+
27
+ return regeneratorRuntime.wrap(function _callee$(_context) {
28
+ while (1) {
29
+ switch (_context.prev = _context.next) {
30
+ case 0:
31
+ _ref = d || {}, offset = _ref.offset, limit = _ref.limit;
32
+ pageLimit = typeof limit === 'number' ? limit : defaultLimit || LIMIT;
33
+ pageOffset = typeof offset === 'number' ? offset + pageLimit : 0;
34
+ _context.next = 5;
35
+ return queryDeviceList(Object.assign({
36
+ offset: pageOffset,
37
+ limit: pageLimit
38
+ }, params));
39
+
40
+ case 5:
41
+ res = _context.sent;
42
+ return _context.abrupt("return", {
43
+ list: res.data || [],
44
+ count: res.totalCount,
45
+ offset: pageOffset,
46
+ limit: pageLimit
47
+ });
48
+
49
+ case 7:
50
+ case "end":
51
+ return _context.stop();
52
+ }
53
+ }
54
+ }, _callee);
55
+ }));
56
+ };
57
+ export var skeletonList = Array.from(new Array(LIMIT)).map(function () {
58
+ return {
59
+ skeleton: true
60
+ };
61
+ });
@@ -0,0 +1,2 @@
1
+ declare const App: () => JSX.Element;
2
+ export default App;
@@ -0,0 +1,70 @@
1
+ import React from 'react';
2
+ import GridList from './index';
3
+
4
+ function random(low, high) {
5
+ return Math.floor(Math.random() * high) + low;
6
+ }
7
+
8
+ var IMAGES = Array.from({
9
+ length: 60
10
+ }, function (_, index) {
11
+ var width = 300;
12
+ var height = random(200, 300);
13
+ return {
14
+ url: "https://picsum.photos/id/".concat(index + 1, "/").concat(width, "/").concat(height, ".jpg"),
15
+ width: width,
16
+ height: height
17
+ };
18
+ });
19
+
20
+ var App = function App() {
21
+ function loadNextPage(d) {
22
+ return new Promise(function (resolve) {
23
+ setTimeout(function () {
24
+ resolve({
25
+ list: IMAGES
26
+ });
27
+ });
28
+ });
29
+ }
30
+
31
+ return /*#__PURE__*/React.createElement("div", {
32
+ style: {
33
+ height: 800,
34
+ overflow: 'auto'
35
+ }
36
+ }, /*#__PURE__*/React.createElement(GridList, {
37
+ itemKey: "url",
38
+ itemHeight: 300,
39
+ itemWidth: 250,
40
+ renderItem: function renderItem(image) {
41
+ return /*#__PURE__*/React.createElement("div", {
42
+ style: {
43
+ border: '1px solid gray',
44
+ height: '100%',
45
+ display: 'flex',
46
+ flexDirection: 'column'
47
+ }
48
+ }, /*#__PURE__*/React.createElement("div", {
49
+ style: {
50
+ flex: 1,
51
+ overflow: 'hidden'
52
+ }
53
+ }, /*#__PURE__*/React.createElement("img", {
54
+ src: image.url,
55
+ style: {
56
+ objectFit: 'cover',
57
+ display: 'block',
58
+ width: '100%',
59
+ height: '100%'
60
+ }
61
+ })), /*#__PURE__*/React.createElement("p", null, "\u6807\u9898"), /*#__PURE__*/React.createElement("p", null, "\u63CF\u8FF0"));
62
+ },
63
+ loadNextPage: loadNextPage,
64
+ isNoMore: function isNoMore() {
65
+ return false;
66
+ }
67
+ }));
68
+ };
69
+
70
+ export default App;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ export interface IDynamicGridListProps<T> {
3
+ itemKey: string;
4
+ itemHeight?: number;
5
+ itemWidth?: number;
6
+ loadNextPage: (d: IDynamicGridListResult<T>) => Promise<IDynamicGridListResult<T>>;
7
+ reloadDep?: any;
8
+ isNoMore: (d: any) => boolean;
9
+ renderItem: (item: T) => React.ReactNode;
10
+ className?: string;
11
+ getGridGap?: (elementWidth: number, windowHeight: number) => number;
12
+ }
13
+ export interface IDynamicGridListResult<T> {
14
+ list: T[];
15
+ [key: string]: any;
16
+ }
17
+ declare function DynamicGridList<T>({ itemKey, itemHeight, itemWidth, loadNextPage, reloadDep, isNoMore, renderItem, className, getGridGap }: IDynamicGridListProps<T>): JSX.Element;
18
+ declare namespace DynamicGridList {
19
+ var defaultProps: {
20
+ itemWidth: number;
21
+ itemHeight: number;
22
+ className: string;
23
+ getGridGap: () => number;
24
+ };
25
+ }
26
+ export default DynamicGridList;
@@ -0,0 +1,73 @@
1
+ import _useUpdateEffect from "ahooks/es/useUpdateEffect";
2
+ import _useInfiniteScroll2 from "ahooks/es/useInfiniteScroll";
3
+ import React, { useRef } from 'react';
4
+ import GridList from '../GridList';
5
+
6
+ function DynamicGridList(_ref) {
7
+ var itemKey = _ref.itemKey,
8
+ itemHeight = _ref.itemHeight,
9
+ itemWidth = _ref.itemWidth,
10
+ loadNextPage = _ref.loadNextPage,
11
+ reloadDep = _ref.reloadDep,
12
+ isNoMore = _ref.isNoMore,
13
+ renderItem = _ref.renderItem,
14
+ className = _ref.className,
15
+ getGridGap = _ref.getGridGap;
16
+ var containerRef = useRef(null);
17
+
18
+ var _useInfiniteScroll = _useInfiniteScroll2(function (d) {
19
+ return loadNextPage(d);
20
+ }, {
21
+ target: containerRef,
22
+ threshold: 50,
23
+ isNoMore: isNoMore,
24
+ reloadDeps: [reloadDep]
25
+ }),
26
+ data = _useInfiniteScroll.data;
27
+
28
+ function getItemData(data) {
29
+ return {
30
+ key: data[itemKey],
31
+ height: itemHeight,
32
+ width: itemWidth
33
+ };
34
+ }
35
+
36
+ function getColumnCount(elementWidth, gridGap) {
37
+ return Math.floor((elementWidth + gridGap) / (itemWidth + gridGap));
38
+ }
39
+
40
+ function getWindowMargin(windowHeight) {
41
+ return Math.round(windowHeight * 1.5);
42
+ }
43
+
44
+ _useUpdateEffect(function () {
45
+ var _a;
46
+
47
+ return (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
48
+ left: 0,
49
+ top: 0
50
+ });
51
+ }, [reloadDep]);
52
+
53
+ return /*#__PURE__*/React.createElement(GridList, {
54
+ className: "cloudapp-dynamic-grid-list ".concat(className),
55
+ items: (data === null || data === void 0 ? void 0 : data.list) || [],
56
+ ref: containerRef,
57
+ getItemData: getItemData,
58
+ getColumnCount: getColumnCount,
59
+ getWindowMargin: getWindowMargin,
60
+ renderItem: renderItem,
61
+ getGridGap: getGridGap
62
+ });
63
+ }
64
+
65
+ DynamicGridList.defaultProps = {
66
+ itemWidth: 250,
67
+ itemHeight: 300,
68
+ className: '',
69
+ getGridGap: function getGridGap() {
70
+ return 20;
71
+ }
72
+ };
73
+ export default DynamicGridList;
@@ -0,0 +1,2 @@
1
+ declare const App: () => JSX.Element;
2
+ export default App;
@@ -0,0 +1,91 @@
1
+ import React from 'react';
2
+ import GridList from './index';
3
+ var ITEM_WIDTH = 300;
4
+
5
+ function getGridGap(elementWidth, windowHeight) {
6
+ if (elementWidth > 720 && windowHeight > 480) {
7
+ return 20;
8
+ } else {
9
+ return 10;
10
+ }
11
+ }
12
+
13
+ function getColumnCount(elementWidth, gridGap) {
14
+ return Math.floor((elementWidth + gridGap) / (ITEM_WIDTH + gridGap));
15
+ }
16
+
17
+ function getWindowMargin(windowHeight) {
18
+ return Math.round(windowHeight * 1.5);
19
+ }
20
+
21
+ function getItemData(image, columnWidth) {
22
+ return {
23
+ key: image.url,
24
+ height: 400,
25
+ width: 300
26
+ };
27
+ }
28
+
29
+ function ImageGridList(props) {
30
+ return /*#__PURE__*/React.createElement(GridList, {
31
+ items: props.images,
32
+ getGridGap: getGridGap,
33
+ getColumnCount: getColumnCount,
34
+ getWindowMargin: getWindowMargin,
35
+ getItemData: getItemData,
36
+ fixedColumnWidth: props.fixed ? ITEM_WIDTH : null,
37
+ renderItem: function renderItem(image) {
38
+ return /*#__PURE__*/React.createElement("div", {
39
+ style: {
40
+ border: '1px solid gray',
41
+ height: '100%',
42
+ display: 'flex',
43
+ flexDirection: 'column'
44
+ }
45
+ }, /*#__PURE__*/React.createElement("div", {
46
+ style: {
47
+ flex: 1,
48
+ overflow: 'hidden'
49
+ }
50
+ }, /*#__PURE__*/React.createElement("img", {
51
+ src: image.url,
52
+ style: {
53
+ objectFit: 'cover',
54
+ display: 'block',
55
+ width: '100%',
56
+ height: '100%'
57
+ }
58
+ })), /*#__PURE__*/React.createElement("p", null, "\u6807\u9898"), /*#__PURE__*/React.createElement("p", null, "\u63CF\u8FF0"));
59
+ }
60
+ });
61
+ }
62
+
63
+ function random(low, high) {
64
+ return Math.floor(Math.random() * high) + low;
65
+ }
66
+
67
+ var IMAGES = Array.from({
68
+ length: 10000
69
+ }, function (_, index) {
70
+ var width = 300;
71
+ var height = random(200, 300);
72
+ return {
73
+ url: "https://picsum.photos/id/".concat(index + 1, "/").concat(width, "/").concat(height, ".jpg"),
74
+ width: width,
75
+ height: height
76
+ };
77
+ });
78
+
79
+ var App = function App() {
80
+ return /*#__PURE__*/React.createElement("div", {
81
+ style: {
82
+ height: 800,
83
+ overflow: 'auto'
84
+ }
85
+ }, /*#__PURE__*/React.createElement(ImageGridList, {
86
+ images: IMAGES,
87
+ fixed: false
88
+ }));
89
+ };
90
+
91
+ export default App;
@@ -0,0 +1,13 @@
1
+ import { RefObject } from 'react';
2
+ import { GridListProps } from '.';
3
+ import { ConstRef, ElementScroll, ElementSize, GridListConfigData, GridListContainerData, GridListLayoutData, GridListRenderData } from './interface';
4
+ export declare function useConstRef<T>(value: T): ConstRef<T>;
5
+ export declare function useWindowSize(): ElementSize;
6
+ export declare function useElementSize(ref: RefObject<Element>): ElementSize | null;
7
+ export declare function useWindowScroll(): ElementScroll;
8
+ export declare function useElementWindowOffset(ref: RefObject<HTMLElement>): number;
9
+ export declare function useIntersecting(ref: RefObject<HTMLElement>, rootMargin: string): boolean;
10
+ export declare function useGridListContainerData(ref: RefObject<HTMLElement>): GridListContainerData;
11
+ export declare function useGridListConfigData<P>(containerData: GridListContainerData, props: GridListProps<P>): GridListConfigData<P> | null;
12
+ export declare function useGridListLayoutData<P>(configData: GridListConfigData<P> | null): GridListLayoutData<P> | null;
13
+ export declare function useGridListRenderData<P>(containerData: GridListContainerData, configData: GridListConfigData<P> | null, layoutData: GridListLayoutData<P> | null): GridListRenderData<P> | null;