@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
@@ -1,13 +1,3 @@
1
- import _IconFont from "@cloud-app-dev/basic-components/es/IconFont";
2
- import "antd/lib/menu/style";
3
- import _Menu from "antd/lib/menu";
4
- import "antd/lib/dropdown/style";
5
- import _Dropdown from "antd/lib/dropdown";
6
- import "antd/lib/col/style";
7
- import _Col from "antd/lib/col";
8
- import "antd/lib/row/style";
9
- import _Row from "antd/lib/row";
10
-
11
1
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
12
2
 
13
3
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -29,10 +19,11 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
29
19
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
30
20
 
31
21
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
32
- import TreeMode from '../TreeMode';
33
- import DynamicDeviceList from '../DynamicDeviceList';
34
- import DeviceList from '../DeviceList';
35
- import { uniq, uniqBy } from 'lodash';
22
+ import TreeMode from '../Tree';
23
+ import DynamicDeviceList from '../List/DynamicDeviceList';
24
+ import DeviceList from '../List/DeviceList';
25
+ import { uniq, uniqBy } from 'lodash-es';
26
+ import TreeType from './TreeType';
36
27
  import "./index.css";
37
28
 
38
29
  function DeviceSelect(_ref) {
@@ -162,61 +153,39 @@ function DeviceSelect(_ref) {
162
153
  var treeSelectedKeys = useMemo(function () {
163
154
  return state.mode === 'Bz' ? [state.buzGroupId] : [state.areaCode];
164
155
  }, [state.mode, state.buzGroupId, state.areaCode]);
165
- return /*#__PURE__*/React.createElement(_Row, {
156
+ return /*#__PURE__*/React.createElement("div", {
166
157
  className: "vidc-device-select-layout"
167
- }, /*#__PURE__*/React.createElement(_Col, {
168
- span: 7
169
158
  }, /*#__PURE__*/React.createElement(TreeMode, {
170
- key: state.mode,
171
159
  mode: state.mode,
172
160
  inputPlaceholder: "\u8BF7\u8F93\u5165\u540D\u79F0",
173
161
  onSelect: onSelectTree,
174
162
  selectedKeys: treeSelectedKeys,
175
- title: /*#__PURE__*/React.createElement(_Dropdown, {
176
- overlay: /*#__PURE__*/React.createElement(_Menu, {
177
- onClick: function onClick(info) {
178
- return setState(function (old) {
179
- return Object.assign(Object.assign({}, old), {
180
- mode: info.key
181
- });
163
+ title: /*#__PURE__*/React.createElement(TreeType, {
164
+ mode: state.mode,
165
+ onChange: function onChange(mode) {
166
+ return setState(function (old) {
167
+ return Object.assign(Object.assign({}, old), {
168
+ mode: mode
182
169
  });
183
- }
184
- }, /*#__PURE__*/React.createElement(_Menu.Item, {
185
- style: {
186
- fontSize: 12
187
- },
188
- key: "Bz"
189
- }, "\u8BBE\u5907\u4E1A\u52A1\u6811"), /*#__PURE__*/React.createElement(_Menu.Item, {
190
- style: {
191
- fontSize: 12
192
- },
193
- key: "Place"
194
- }, "\u884C\u653F\u533A\u5212"))
195
- }, /*#__PURE__*/React.createElement("span", null, state.mode === 'Place' ? '行政区划' : '设备业务树', " ", /*#__PURE__*/React.createElement(_IconFont, {
196
- style: {
197
- position: 'relative',
198
- top: 1
199
- },
200
- type: "icon-S_Arrow_BigDown"
201
- })))
202
- })), /*#__PURE__*/React.createElement(_Col, {
203
- span: 8
204
- }, /*#__PURE__*/React.createElement(DynamicDeviceList, {
170
+ });
171
+ }
172
+ })
173
+ }), /*#__PURE__*/React.createElement(DynamicDeviceList, {
205
174
  title: "\u8BBE\u5907\u5217\u8868",
206
175
  onChecked: onCheked1,
176
+ key: state.mode,
207
177
  checkedKeys: state.tempSelectIds,
208
178
  params: listParams
209
- })), /*#__PURE__*/React.createElement(_Col, {
210
- span: 1
211
- }), /*#__PURE__*/React.createElement(_Col, {
212
- span: 8
213
- }, /*#__PURE__*/React.createElement(DeviceList, {
179
+ }), /*#__PURE__*/React.createElement(DeviceList, {
214
180
  itemKey: "cid",
215
181
  deviceList: state.selectDevices || [],
216
182
  onChecked: onCheked2,
217
183
  checkedKeys: state.selectIds,
218
184
  title: "\u5DF2\u9009\u8BBE\u5907\u5217\u8868"
219
- })));
185
+ }));
220
186
  }
221
187
 
188
+ DeviceSelect.defaultProps = {
189
+ className: ''
190
+ };
222
191
  export default DeviceSelect;
@@ -0,0 +1,3 @@
1
+ import { CacheDictType } from './interface';
2
+ declare const LMDict: CacheDictType;
3
+ export default LMDict;
@@ -0,0 +1,21 @@
1
+ import produce from 'immer';
2
+ var dictMap = {
3
+ data: produce({}, function () {}),
4
+ updateDictMap: function updateDictMap(key, value) {
5
+ this.data = produce(this.data, function (draft) {
6
+ draft[key] = value;
7
+ });
8
+ }
9
+ };
10
+ var _global = window;
11
+
12
+ var LMDict = function () {
13
+ if (_global._LM_DICT_) {
14
+ return _global._LM_DICT_;
15
+ } else {
16
+ _global._LM_DICT_ = dictMap;
17
+ return dictMap;
18
+ }
19
+ }();
20
+
21
+ export default LMDict;
@@ -0,0 +1,64 @@
1
+ import React from 'react';
2
+ import { DictItem } from './interface';
3
+ export declare function withDict(codes?: any[], isWebVisible?: boolean): (Component: any) => (props: any) => JSX.Element;
4
+ export declare function withTypeCodes(Component: any): {
5
+ new (props: any): {
6
+ componentDidMount(): void;
7
+ render(): JSX.Element;
8
+ context: any;
9
+ setState<K extends "typeCodes" | "isInit">(state: {
10
+ typeCodes: DictItem[];
11
+ isInit: boolean;
12
+ } | ((prevState: Readonly<{
13
+ typeCodes: DictItem[];
14
+ isInit: boolean;
15
+ }>, props: Readonly<any>) => {
16
+ typeCodes: DictItem[];
17
+ isInit: boolean;
18
+ } | Pick<{
19
+ typeCodes: DictItem[];
20
+ isInit: boolean;
21
+ }, K>) | Pick<{
22
+ typeCodes: DictItem[];
23
+ isInit: boolean;
24
+ }, K>, callback?: () => void): void;
25
+ forceUpdate(callback?: () => void): void;
26
+ readonly props: Readonly<any> & Readonly<{
27
+ children?: React.ReactNode;
28
+ }>;
29
+ state: Readonly<{
30
+ typeCodes: DictItem[];
31
+ isInit: boolean;
32
+ }>;
33
+ refs: {
34
+ [key: string]: React.ReactInstance;
35
+ };
36
+ shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<{
37
+ typeCodes: DictItem[];
38
+ isInit: boolean;
39
+ }>, nextContext: any): boolean;
40
+ componentWillUnmount?(): void;
41
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
42
+ getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<{
43
+ typeCodes: DictItem[];
44
+ isInit: boolean;
45
+ }>): any;
46
+ componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<{
47
+ typeCodes: DictItem[];
48
+ isInit: boolean;
49
+ }>, snapshot?: any): void;
50
+ componentWillMount?(): void;
51
+ UNSAFE_componentWillMount?(): void;
52
+ componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
53
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
54
+ componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<{
55
+ typeCodes: DictItem[];
56
+ isInit: boolean;
57
+ }>, nextContext: any): void;
58
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<{
59
+ typeCodes: DictItem[];
60
+ isInit: boolean;
61
+ }>, nextContext: any): void;
62
+ };
63
+ contextType?: React.Context<any>;
64
+ };
@@ -0,0 +1,162 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
+
3
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
+
5
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
6
+
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
8
+
9
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
10
+
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
+
13
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
+
15
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
16
+
17
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
18
+
19
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
20
+
21
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
22
+
23
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
24
+
25
+ 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."); }
26
+
27
+ 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); }
28
+
29
+ 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; }
30
+
31
+ 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; }
32
+
33
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
34
+
35
+ import React, { useRef, useState, useEffect } from 'react';
36
+ import { queryByTypeCodes, queryTypeCodes, formartItemTextExt } from './utils';
37
+ import LMDict from './cache';
38
+ export function withDict() {
39
+ var codes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
40
+ var isWebVisible = arguments.length > 1 ? arguments[1] : undefined;
41
+ return function (Component) {
42
+ return function (props) {
43
+ var isInitRef = useRef(false);
44
+
45
+ var _useState = useState(function () {
46
+ var map = {};
47
+ codes.forEach(function (code) {
48
+ if (LMDict.data[code]) {
49
+ map[code] = LMDict.data[code];
50
+ } else {
51
+ map[code] = [];
52
+ }
53
+ });
54
+ return map;
55
+ }),
56
+ _useState2 = _slicedToArray(_useState, 2),
57
+ dictMap = _useState2[0],
58
+ setDictMap = _useState2[1];
59
+
60
+ useEffect(function () {
61
+ var nocacheCodes = codes.filter(function (v) {
62
+ return !LMDict.data[v];
63
+ });
64
+
65
+ if (nocacheCodes.length === 0) {
66
+ isInitRef.current = true;
67
+ setDictMap(function (old) {
68
+ return Object.assign({}, old);
69
+ });
70
+ return;
71
+ }
72
+
73
+ queryByTypeCodes(nocacheCodes, isWebVisible).then(function (res) {
74
+ isInitRef.current = true;
75
+ var data = res.data;
76
+ data.forEach(function (item) {
77
+ item.label = item.name;
78
+ item.value = item.code;
79
+ item = Object.assign(Object.assign({}, item), formartItemTextExt(item.extText));
80
+ });
81
+ setDictMap(function (old) {
82
+ nocacheCodes.forEach(function (code) {
83
+ var itemCodes = data.filter(function (v1) {
84
+ return +v1.typeCode === +code;
85
+ });
86
+ old[code] = itemCodes;
87
+ LMDict.updateDictMap(code, itemCodes);
88
+ });
89
+ return Object.assign({}, old);
90
+ });
91
+ });
92
+ }, []);
93
+
94
+ if (!isInitRef.current) {
95
+ return null;
96
+ }
97
+
98
+ return /*#__PURE__*/React.createElement(Component, Object.assign({}, props, {
99
+ dictMap: dictMap
100
+ }));
101
+ };
102
+ };
103
+ }
104
+ export function withTypeCodes(Component) {
105
+ return /*#__PURE__*/function (_React$Component) {
106
+ _inherits(withTypeCodesComponent, _React$Component);
107
+
108
+ var _super = _createSuper(withTypeCodesComponent);
109
+
110
+ function withTypeCodesComponent(props) {
111
+ var _this;
112
+
113
+ _classCallCheck(this, withTypeCodesComponent);
114
+
115
+ _this = _super.call(this, props);
116
+ _this.state = {
117
+ typeCodes: LMDict.data['typeCodes'] || [],
118
+ isInit: false
119
+ };
120
+ return _this;
121
+ }
122
+
123
+ _createClass(withTypeCodesComponent, [{
124
+ key: "componentDidMount",
125
+ value: function componentDidMount() {
126
+ var _this2 = this;
127
+
128
+ if (!LMDict.data['typeCodes']) {
129
+ queryTypeCodes().then(function (res) {
130
+ LMDict.updateDictMap('typeCodes', res);
131
+
132
+ _this2.setState({
133
+ typeCodes: res,
134
+ isInit: true
135
+ });
136
+ }).catch(function () {
137
+ _this2.setState({
138
+ typeCodes: [],
139
+ isInit: true
140
+ });
141
+ });
142
+ } else this.setState({
143
+ typeCodes: LMDict.data['typeCodes'],
144
+ isInit: true
145
+ });
146
+ }
147
+ }, {
148
+ key: "render",
149
+ value: function render() {
150
+ if (!this.state.isInit) {
151
+ return null;
152
+ }
153
+
154
+ return /*#__PURE__*/React.createElement(Component, Object.assign({}, this.props, {
155
+ typeCodes: this.state.typeCodes
156
+ }));
157
+ }
158
+ }]);
159
+
160
+ return withTypeCodesComponent;
161
+ }(React.Component);
162
+ }
@@ -0,0 +1,28 @@
1
+ import { DictItem } from './interface';
2
+ export declare const ptjk: DictItem;
3
+ export declare const rlzp: DictItem;
4
+ export declare const zpj: DictItem;
5
+ export declare const clzpj: DictItem;
6
+ export declare const qmbzpj: DictItem;
7
+ export declare const ydjc: DictItem;
8
+ export declare const qtzp: DictItem;
9
+ export declare const znxj: DictItem;
10
+ export declare const qj: DictItem;
11
+ export declare const db: DictItem;
12
+ export declare const qt: DictItem;
13
+ export declare const dz: DictItem;
14
+ export declare const wgsb: DictItem;
15
+ export declare const xfs: DictItem;
16
+ export declare const znjg: DictItem;
17
+ export declare const wifi: DictItem;
18
+ export declare const mj: DictItem;
19
+ export declare const hw: DictItem;
20
+ export declare const yg: DictItem;
21
+ export declare const deviceStatus: DictItem[];
22
+ export declare const deviceLocation: DictItem[];
23
+ export declare const deviceLocationzWithoutAll: DictItem[];
24
+ export declare const cameraType: DictItem[];
25
+ export declare const cameraDeviceType: DictItem[];
26
+ export declare const cameraAndSoldierType: DictItem[];
27
+ export declare const deviceAndMjType: DictItem[];
28
+ export declare const deviceType: DictItem[];
@@ -0,0 +1,117 @@
1
+ var all = {
2
+ value: '-1',
3
+ label: '全部'
4
+ }; //摄像机状态
5
+
6
+ var on = {
7
+ value: '1',
8
+ label: '在线'
9
+ };
10
+ var off = {
11
+ value: '0',
12
+ label: '离线'
13
+ }; //经纬度状态
14
+
15
+ var noSet = {
16
+ value: '0',
17
+ label: '未设置'
18
+ };
19
+ var isSet = {
20
+ value: '1',
21
+ label: '已设置'
22
+ }; //摄像机类别
23
+
24
+ export var ptjk = {
25
+ value: '119651',
26
+ label: '普通监控'
27
+ };
28
+ export var rlzp = {
29
+ value: '119652',
30
+ label: '人脸抓拍机'
31
+ };
32
+ export var zpj = {
33
+ value: '119653',
34
+ label: '人像抓拍机'
35
+ };
36
+ export var clzpj = {
37
+ value: '119654',
38
+ label: '车辆抓拍机'
39
+ };
40
+ export var qmbzpj = {
41
+ value: '119655',
42
+ label: '全目标抓拍机'
43
+ };
44
+ export var ydjc = {
45
+ value: '119656',
46
+ label: '移动监测'
47
+ };
48
+ export var qtzp = {
49
+ value: '119657',
50
+ label: '其他'
51
+ }; //设备类型
52
+
53
+ export var znxj = {
54
+ value: '100604',
55
+ label: '智能枪机'
56
+ };
57
+ export var qj = {
58
+ value: '100602',
59
+ label: '球机'
60
+ };
61
+ export var db = {
62
+ value: '100605',
63
+ label: '单兵'
64
+ };
65
+ export var qt = {
66
+ value: '100601',
67
+ label: '其他摄像机'
68
+ };
69
+ export var dz = {
70
+ value: '100607',
71
+ label: '道闸'
72
+ };
73
+ export var wgsb = {
74
+ value: '100606',
75
+ label: '网关设备'
76
+ };
77
+ export var xfs = {
78
+ value: '100612',
79
+ label: '消防栓'
80
+ };
81
+ export var znjg = {
82
+ value: '100614',
83
+ label: '智能井盖'
84
+ }; //wifi
85
+
86
+ export var wifi = {
87
+ value: '100611',
88
+ label: 'WI-FI'
89
+ }; //门禁
90
+
91
+ export var mj = {
92
+ value: '103501,103502',
93
+ label: '门禁'
94
+ }; //闸机
95
+ // export const zj = {value: "103407", label: "闸机"}as DictItem
96
+ //红外传感器
97
+
98
+ export var hw = {
99
+ value: '100609',
100
+ label: '红外传感器'
101
+ }; //烟感传感器
102
+
103
+ export var yg = {
104
+ value: '100610',
105
+ label: '烟感传感器'
106
+ };
107
+ export var deviceStatus = [all, on, off];
108
+ export var deviceLocation = [all, noSet, isSet];
109
+ export var deviceLocationzWithoutAll = [noSet, isSet];
110
+ export var cameraType = [all, ptjk, rlzp, zpj, clzpj, qmbzpj, ydjc, qtzp];
111
+ export var cameraDeviceType = [all, znxj, qj, db, qt]; //摄像机+单兵
112
+
113
+ export var cameraAndSoldierType = [all, znxj, qj, db, qt]; //摄像机(无单兵)+门禁
114
+
115
+ export var deviceAndMjType = [all, znxj, qj, wifi, mj, wgsb, dz, xfs, znjg, qt]; //所有设备类型
116
+
117
+ export var deviceType = [all, znxj, qj, db, wifi, mj, wgsb, dz, xfs, znjg, qt, hw, yg];
@@ -0,0 +1,4 @@
1
+ import { DictItem } from './interface';
2
+ export declare function useDict(typeCode: string | number): DictItem[];
3
+ export declare function useTypeCodes(): DictItem[];
4
+ export declare function useDicts(typeCodes?: any[], isWebVisible?: boolean): DictItem[][];
@@ -0,0 +1,114 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+
7
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8
+
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
+ import { useMemo, useState, useEffect } from 'react';
22
+ import { queryByTypeCode, queryByTypeCodes, queryTypeCodes, formartItemTextExt } from './utils';
23
+ import LMDict from './cache';
24
+ export function useDict(typeCode) {
25
+ var _useState = useState(LMDict.data[typeCode] || []),
26
+ _useState2 = _slicedToArray(_useState, 2),
27
+ codes = _useState2[0],
28
+ setCodes = _useState2[1];
29
+
30
+ useEffect(function () {
31
+ if (typeCode && !LMDict.data[typeCode]) {
32
+ queryByTypeCode(typeCode).then(function (res) {
33
+ var data = res.data || [];
34
+ data.forEach(function (item) {
35
+ item.label = item.name;
36
+ item.value = item.code;
37
+ item = Object.assign(Object.assign({}, item), formartItemTextExt(item.extText));
38
+ });
39
+ LMDict.updateDictMap(typeCode, data);
40
+ setCodes(data);
41
+ });
42
+ } else {
43
+ setCodes(function (old) {
44
+ return old.length > 0 ? old : LMDict.data[typeCode] || [];
45
+ });
46
+ }
47
+ }, [typeCode]);
48
+ return codes;
49
+ }
50
+ export function useTypeCodes() {
51
+ var _useState3 = useState(LMDict.data['typeCodes'] || []),
52
+ _useState4 = _slicedToArray(_useState3, 2),
53
+ typeCodes = _useState4[0],
54
+ setTypeCodes = _useState4[1];
55
+
56
+ useEffect(function () {
57
+ if (!LMDict.data['typeCodes']) {
58
+ queryTypeCodes().then(function (res) {
59
+ setTypeCodes(res);
60
+ LMDict.updateDictMap('typeCode', res);
61
+ });
62
+ }
63
+ }, []);
64
+ return typeCodes;
65
+ }
66
+ export function useDicts() {
67
+ var typeCodes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
68
+ var isWebVisible = arguments.length > 1 ? arguments[1] : undefined;
69
+ var typeStr = useMemo(function () {
70
+ return typeCodes.toString();
71
+ }, [typeCodes]);
72
+
73
+ var _useState5 = useState(function () {
74
+ return typeCodes.map(function (v) {
75
+ return LMDict.data[v] ? LMDict.data[v] : [];
76
+ });
77
+ }),
78
+ _useState6 = _slicedToArray(_useState5, 2),
79
+ dicts = _useState6[0],
80
+ setDicts = _useState6[1];
81
+
82
+ useEffect(function () {
83
+ var codes = typeCodes.filter(function (v) {
84
+ return !LMDict.data[v];
85
+ });
86
+
87
+ if (codes.length === 0) {
88
+ return;
89
+ }
90
+
91
+ queryByTypeCodes(codes, isWebVisible).then(function (res) {
92
+ var data = res.data;
93
+ data.forEach(function (item) {
94
+ item.label = item.name;
95
+ item.value = item.code;
96
+ item = Object.assign(Object.assign({}, item), formartItemTextExt(item.extText));
97
+ });
98
+ setDicts(function (old) {
99
+ codes.forEach(function (code) {
100
+ var itemCodes = data.filter(function (v1) {
101
+ return +v1.typeCode === +code;
102
+ });
103
+ var index = typeCodes.findIndex(function (v) {
104
+ return v === code;
105
+ });
106
+ old[index] = itemCodes;
107
+ LMDict.updateDictMap(code, itemCodes);
108
+ });
109
+ return _toConsumableArray(old);
110
+ });
111
+ }); // eslint-disable-next-line react-hooks/exhaustive-deps
112
+ }, [typeStr]);
113
+ return dicts;
114
+ }
@@ -0,0 +1,13 @@
1
+ import * as device from './device';
2
+ import { useDict, useDicts, useTypeCodes } from './hook';
3
+ import { withDict, withTypeCodes } from './desc';
4
+ declare const Dict: {
5
+ useDict: typeof useDict;
6
+ useDicts: typeof useDicts;
7
+ device: typeof device;
8
+ cacheMap: import("./interface").CacheDictType;
9
+ withDict: typeof withDict;
10
+ useTypeCodes: typeof useTypeCodes;
11
+ withTypeCodes: typeof withTypeCodes;
12
+ };
13
+ export default Dict;
@@ -0,0 +1,14 @@
1
+ import LMDict from './cache';
2
+ import * as device from './device';
3
+ import { useDict, useDicts, useTypeCodes } from './hook';
4
+ import { withDict, withTypeCodes } from './desc';
5
+ var Dict = {
6
+ useDict: useDict,
7
+ useDicts: useDicts,
8
+ device: device,
9
+ cacheMap: LMDict,
10
+ withDict: withDict,
11
+ useTypeCodes: useTypeCodes,
12
+ withTypeCodes: withTypeCodes
13
+ };
14
+ export default Dict;
@@ -0,0 +1,16 @@
1
+ export interface DictItem {
2
+ label: string;
3
+ code: string;
4
+ id: string;
5
+ value: any;
6
+ name: string;
7
+ extText?: string;
8
+ typeCode?: string;
9
+ disabled?: boolean;
10
+ icon?: string;
11
+ }
12
+
13
+ export interface CacheDictType {
14
+ data: { [key: string]: DictItem[] };
15
+ updateDictMap: (key: any, valuse: DictItem[]) => void;
16
+ }