@cloud-app-dev/vidc 2.0.0-alpha.7 → 2.1.0-alpha.10

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 (206) hide show
  1. package/.fatherrc.js +11 -4
  2. package/.umirc.ts +1 -1
  3. package/es/Api/index.js +7 -7
  4. package/es/AppRedirect/index.d.ts +1 -1
  5. package/es/AppRedirect/index.js +7 -12
  6. package/es/AppRouter/index.d.ts +8 -0
  7. package/es/AppRouter/index.js +17 -0
  8. package/es/Auth/index.js +1 -1
  9. package/es/AutoExit/index.js +12 -10
  10. package/es/{ContentBox → Box}/BetweenBox/index.css +0 -0
  11. package/es/{ContentBox → Box}/BetweenBox/index.d.ts +0 -0
  12. package/es/{ContentBox → Box}/BetweenBox/index.js +0 -0
  13. package/es/{ContentBox → Box}/InfoBox/index.css +0 -0
  14. package/es/{ContentBox → Box}/InfoBox/index.d.ts +0 -0
  15. package/es/{ContentBox → Box}/InfoBox/index.js +0 -0
  16. package/es/{ContentBox → Box}/TwoColumnBox/index.css +0 -0
  17. package/es/{ContentBox → Box}/TwoColumnBox/index.d.ts +0 -0
  18. package/es/{ContentBox → Box}/TwoColumnBox/index.js +0 -0
  19. package/es/{ContentBox → Box}/deps/content-grid.d.ts +0 -0
  20. package/es/{ContentBox → Box}/deps/content-grid.js +0 -0
  21. package/es/{ContentBox → Box}/deps/grid-factory.d.ts +0 -0
  22. package/es/{ContentBox → Box}/deps/grid-factory.js +0 -0
  23. package/es/{ContentBox → Box}/deps/simple-grid.d.ts +0 -0
  24. package/es/{ContentBox → Box}/deps/simple-grid.js +0 -0
  25. package/es/{ContentBox → Box}/index.css +0 -0
  26. package/es/{ContentBox → Box}/index.d.ts +3 -3
  27. package/es/{ContentBox → Box}/index.js +5 -5
  28. package/es/CheckGroupFixed/index.js +4 -2
  29. package/es/Config/index.js +44 -14
  30. package/es/Config/interface.d.ts +12 -5
  31. package/es/Config/utils.d.ts +1 -1
  32. package/es/Config/utils.js +1 -3
  33. package/es/ConfigContext/index.d.ts +15 -2
  34. package/es/ConfigContext/index.js +25 -3
  35. package/es/DeviceSelect/TreeType.d.ts +6 -0
  36. package/es/DeviceSelect/TreeType.js +36 -0
  37. package/es/DeviceSelect/demo.js +2 -2
  38. package/es/DeviceSelect/index.css +6 -1
  39. package/es/DeviceSelect/index.d.ts +5 -0
  40. package/es/DeviceSelect/index.js +21 -52
  41. package/es/Dict/hook.d.ts +0 -1
  42. package/es/Dict/hook.js +5 -21
  43. package/es/Dict/index.d.ts +1 -5
  44. package/es/Dict/index.js +2 -6
  45. package/es/Dict/utils.d.ts +0 -1
  46. package/es/Dict/utils.js +2 -9
  47. package/es/IconFont/index.d.ts +0 -1
  48. package/es/IconFont/index.js +12 -13
  49. package/es/InitialConfig/index.js +7 -6
  50. package/es/InitialConfig/utils.d.ts +5 -0
  51. package/es/InitialConfig/utils.js +33 -6
  52. package/es/InitialRequest/index.d.ts +3 -1
  53. package/es/InitialRequest/index.js +20 -16
  54. package/es/InitialRequest/utils.d.ts +6 -4
  55. package/es/InitialRequest/utils.js +52 -70
  56. package/es/Input/index.js +3 -2
  57. package/es/InstanceHistory/index.d.ts +3 -0
  58. package/es/InstanceHistory/index.js +9 -0
  59. package/es/List/CheckExt.d.ts +3 -5
  60. package/es/List/CheckExt.js +21 -13
  61. package/es/{AppRoute → List/DeviceList}/index.css +0 -0
  62. package/es/List/DeviceList/index.d.ts +11 -0
  63. package/es/{DeviceList → List/DeviceList}/index.js +6 -18
  64. package/es/{DynamicDeviceList → List/DynamicDeviceList}/Demo.d.ts +0 -0
  65. package/es/{DynamicList/demo.js → List/DynamicDeviceList/Demo.js} +25 -42
  66. package/es/{DynamicDeviceList → List/DynamicDeviceList}/index.css +5 -17
  67. package/es/List/DynamicDeviceList/index.d.ts +11 -0
  68. package/es/List/DynamicDeviceList/index.js +205 -0
  69. package/es/List/DynamicDeviceList/interface.d.ts +37 -0
  70. package/es/List/DynamicDeviceList/utils.d.ts +16 -0
  71. package/es/List/DynamicDeviceList/utils.js +61 -0
  72. package/es/{DynamicList/demo.d.ts → List/DynamicGridList/Demo.d.ts} +0 -0
  73. package/es/List/DynamicGridList/Demo.js +70 -0
  74. package/es/List/DynamicGridList/index.d.ts +26 -0
  75. package/es/List/DynamicGridList/index.js +73 -0
  76. package/es/List/GridList/Demo.d.ts +2 -0
  77. package/es/List/GridList/Demo.js +91 -0
  78. package/es/List/GridList/hook.d.ts +13 -0
  79. package/es/List/GridList/hook.js +301 -0
  80. package/es/List/GridList/index.css +7 -0
  81. package/es/List/GridList/index.d.ts +15 -0
  82. package/es/List/GridList/index.js +47 -0
  83. package/es/List/GridList/interface.d.ts +59 -0
  84. package/es/List/GridList/utils.d.ts +9 -0
  85. package/es/List/GridList/utils.js +43 -0
  86. package/es/List/ListExt/index.css +3 -0
  87. package/es/{ListExt → List/ListExt}/index.d.ts +1 -1
  88. package/es/{ListExt → List/ListExt}/index.js +3 -3
  89. package/es/List/VList/index.css +6 -0
  90. package/es/List/VList/index.d.ts +18 -0
  91. package/es/List/VList/index.js +51 -0
  92. package/es/List/VList/utils.d.ts +14 -0
  93. package/es/{VList → List/VList}/utils.js +0 -0
  94. package/es/List/index.css +11 -12
  95. package/es/List/index.d.ts +5 -70
  96. package/es/List/index.js +32 -24
  97. package/es/List/interface.d.ts +87 -0
  98. package/es/List/renderItem.d.ts +1 -1
  99. package/es/List/renderItem.js +13 -10
  100. package/es/LoaderApp/index.d.ts +1 -1
  101. package/es/LoaderApp/index.js +39 -35
  102. package/es/LoaderApp/loader.js +2 -6
  103. package/es/LoaderApp/utils.d.ts +3 -1
  104. package/es/LoaderApp/utils.js +43 -3
  105. package/es/LoaderScript/index.js +7 -89
  106. package/es/LoaderScript/utils.d.ts +2 -0
  107. package/es/LoaderScript/utils.js +170 -33
  108. package/es/Picture/component/MoveContent/index.js +3 -3
  109. package/es/RefDrawer/index.js +1 -1
  110. package/es/RefModal/index.js +1 -1
  111. package/es/Service/http.d.ts +6 -4
  112. package/es/Service/http.js +20 -22
  113. package/es/Service/index.d.ts +3 -3
  114. package/es/Service/index.js +7 -11
  115. package/es/Service/interface.d.ts +5 -11
  116. package/es/Service/middleware.d.ts +1 -1
  117. package/es/Service/middleware.js +1 -1
  118. package/es/TableLayout/index.d.ts +3 -0
  119. package/es/TableLayout/index.js +14 -45
  120. package/es/{TreeTitle → Title}/index.css +5 -5
  121. package/es/{TreeTitle → Title}/index.d.ts +2 -2
  122. package/es/{TreeTitle → Title}/index.js +7 -4
  123. package/es/{TreeMode → Tree/BaseTree}/demo.d.ts +0 -0
  124. package/es/Tree/BaseTree/demo.js +69 -0
  125. package/es/Tree/BaseTree/index.css +64 -0
  126. package/es/Tree/BaseTree/index.d.ts +24 -0
  127. package/es/Tree/BaseTree/index.js +83 -0
  128. package/es/Tree/demo.js +19 -56
  129. package/es/Tree/index.css +29 -55
  130. package/es/Tree/index.d.ts +19 -20
  131. package/es/Tree/index.js +185 -70
  132. package/es/UserSelect/index.js +6 -4
  133. package/es/WorkerFlow/Form/Condition.js +2 -4
  134. package/es/WorkerFlow/Form/EmptyUserSet.js +2 -4
  135. package/es/WorkerFlow/Form/FormAuth.js +2 -2
  136. package/es/WorkerFlow/Form/GroupList.js +2 -2
  137. package/es/WorkerFlow/Form/GroupSelect.js +2 -4
  138. package/es/WorkerFlow/Form/GroupSelectModalContent.js +1 -1
  139. package/es/WorkerFlow/Form/LevelGroupSelect.js +3 -5
  140. package/es/WorkerFlow/Form/UserAndGroupSelect.js +2 -4
  141. package/es/WorkerFlow/Form/UserSelect.js +2 -4
  142. package/es/WorkerFlow/Form/UserSelectModalContent.js +3 -3
  143. package/es/WorkerFlow/Form/UserSet.js +2 -2
  144. package/es/WorkerFlow/Nodes/TitleElement.js +71 -34
  145. package/es/WorkerFlow/index.css +9 -3
  146. package/es/WorkerFlow/index.js +13 -8
  147. package/es/WorkerFlow/utils.js +2 -2
  148. package/es/index.d.ts +4 -11
  149. package/es/index.js +4 -11
  150. package/es/useDrawer/index.d.ts +1 -1
  151. package/es/useDrawer/index.js +3 -2
  152. package/es/useHistory/index.d.ts +2 -2
  153. package/es/useHistory/index.js +3 -6
  154. package/es/useHttp/index.js +1 -1
  155. package/es/useModal/index.d.ts +1 -1
  156. package/es/useModal/index.js +3 -2
  157. package/es/utils.d.ts +9 -0
  158. package/es/utils.js +36 -1
  159. package/package.json +10 -12
  160. package/tsconfig.json +1 -1
  161. package/es/AppRoute/Render.d.ts +0 -23
  162. package/es/AppRoute/Render.js +0 -111
  163. package/es/AppRoute/Rendered.d.ts +0 -4
  164. package/es/AppRoute/Rendered.js +0 -11
  165. package/es/AppRoute/index.d.ts +0 -14
  166. package/es/AppRoute/index.js +0 -106
  167. package/es/AppRoute/interface.d.ts +0 -18
  168. package/es/AppRoute/utils.d.ts +0 -1
  169. package/es/AppRoute/utils.js +0 -28
  170. package/es/DeviceList/index.css +0 -32
  171. package/es/DeviceList/index.d.ts +0 -14
  172. package/es/Dict/desc.d.ts +0 -64
  173. package/es/Dict/desc.js +0 -162
  174. package/es/DynamicDeviceList/CheckExt.d.ts +0 -8
  175. package/es/DynamicDeviceList/CheckExt.js +0 -36
  176. package/es/DynamicDeviceList/Demo.js +0 -17
  177. package/es/DynamicDeviceList/index.d.ts +0 -35
  178. package/es/DynamicDeviceList/index.js +0 -224
  179. package/es/DynamicDeviceList/utils.d.ts +0 -2
  180. package/es/DynamicDeviceList/utils.js +0 -15
  181. package/es/DynamicList/index.css +0 -7
  182. package/es/DynamicList/index.d.ts +0 -31
  183. package/es/DynamicList/index.js +0 -132
  184. package/es/IconFont/index.css +0 -0
  185. package/es/List/utils.d.ts +0 -5
  186. package/es/List/utils.js +0 -18
  187. package/es/ListExt/index.css +0 -9
  188. package/es/ScrollList/index.css +0 -73
  189. package/es/ScrollList/index.d.ts +0 -24
  190. package/es/ScrollList/index.js +0 -261
  191. package/es/ScrollList/utils.js +0 -84
  192. package/es/Service/logger.d.ts +0 -3
  193. package/es/Service/logger.js +0 -13
  194. package/es/Service/utils.d.ts +0 -3
  195. package/es/Service/utils.js +0 -11
  196. package/es/TreeMode/demo.js +0 -32
  197. package/es/TreeMode/index.css +0 -38
  198. package/es/TreeMode/index.d.ts +0 -23
  199. package/es/TreeMode/index.js +0 -201
  200. package/es/VList/index.css +0 -4
  201. package/es/VList/index.d.ts +0 -16
  202. package/es/VList/index.js +0 -56
  203. package/es/VList/utils.d.ts +0 -10
  204. package/es/useChangeEffect/index.d.ts +0 -3
  205. package/es/useChangeEffect/index.js +0 -32
  206. package/es/useHistory/index.css +0 -0
@@ -1,12 +1,3 @@
1
- import "antd/lib/menu/style";
2
- import _Menu from "antd/lib/menu";
3
- import "antd/lib/dropdown/style";
4
- import _Dropdown from "antd/lib/dropdown";
5
- import "antd/lib/col/style";
6
- import _Col from "antd/lib/col";
7
- import "antd/lib/row/style";
8
- import _Row from "antd/lib/row";
9
-
10
1
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
11
2
 
12
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."); }
@@ -28,11 +19,11 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
28
19
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
29
20
 
30
21
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
31
- import TreeMode from '../TreeMode';
32
- import DynamicDeviceList from '../DynamicDeviceList';
33
- import DeviceList from '../DeviceList';
22
+ import TreeMode from '../Tree';
23
+ import DynamicDeviceList from '../List/DynamicDeviceList';
24
+ import DeviceList from '../List/DeviceList';
34
25
  import { uniq, uniqBy } from 'lodash';
35
- import IconFont from '../IconFont';
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;
package/es/Dict/hook.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  import { DictItem } from './interface';
2
2
  export declare function useDict(typeCode: string | number): DictItem[];
3
- export declare function useTypeCodes(): DictItem[];
4
3
  export declare function useDicts(typeCodes?: any[], isWebVisible?: boolean): DictItem[][];
package/es/Dict/hook.js CHANGED
@@ -19,7 +19,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
19
19
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
20
 
21
21
  import { useMemo, useState, useEffect } from 'react';
22
- import { queryByTypeCode, queryByTypeCodes, queryTypeCodes, formartItemTextExt } from './utils';
22
+ import { queryByTypeCode, queryByTypeCodes, formartItemTextExt } from './utils';
23
23
  import LMDict from './cache';
24
24
  export function useDict(typeCode) {
25
25
  var _useState = useState(LMDict.data[typeCode] || []),
@@ -47,22 +47,6 @@ export function useDict(typeCode) {
47
47
  }, [typeCode]);
48
48
  return codes;
49
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
50
  export function useDicts() {
67
51
  var typeCodes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
68
52
  var isWebVisible = arguments.length > 1 ? arguments[1] : undefined;
@@ -70,14 +54,14 @@ export function useDicts() {
70
54
  return typeCodes.toString();
71
55
  }, [typeCodes]);
72
56
 
73
- var _useState5 = useState(function () {
57
+ var _useState3 = useState(function () {
74
58
  return typeCodes.map(function (v) {
75
59
  return LMDict.data[v] ? LMDict.data[v] : [];
76
60
  });
77
61
  }),
78
- _useState6 = _slicedToArray(_useState5, 2),
79
- dicts = _useState6[0],
80
- setDicts = _useState6[1];
62
+ _useState4 = _slicedToArray(_useState3, 2),
63
+ dicts = _useState4[0],
64
+ setDicts = _useState4[1];
81
65
 
82
66
  useEffect(function () {
83
67
  var codes = typeCodes.filter(function (v) {
@@ -1,13 +1,9 @@
1
1
  import * as device from './device';
2
- import { useDict, useDicts, useTypeCodes } from './hook';
3
- import { withDict, withTypeCodes } from './desc';
2
+ import { useDict, useDicts } from './hook';
4
3
  declare const Dict: {
5
4
  useDict: typeof useDict;
6
5
  useDicts: typeof useDicts;
7
6
  device: typeof device;
8
7
  cacheMap: import("./interface").CacheDictType;
9
- withDict: typeof withDict;
10
- useTypeCodes: typeof useTypeCodes;
11
- withTypeCodes: typeof withTypeCodes;
12
8
  };
13
9
  export default Dict;
package/es/Dict/index.js CHANGED
@@ -1,14 +1,10 @@
1
1
  import LMDict from './cache';
2
2
  import * as device from './device';
3
- import { useDict, useDicts, useTypeCodes } from './hook';
4
- import { withDict, withTypeCodes } from './desc';
3
+ import { useDict, useDicts } from './hook';
5
4
  var Dict = {
6
5
  useDict: useDict,
7
6
  useDicts: useDicts,
8
7
  device: device,
9
- cacheMap: LMDict,
10
- withDict: withDict,
11
- useTypeCodes: useTypeCodes,
12
- withTypeCodes: withTypeCodes
8
+ cacheMap: LMDict
13
9
  };
14
10
  export default Dict;
@@ -5,7 +5,6 @@ export declare function queryByTypeCode(typeCode: any): Promise<{
5
5
  export declare function queryByTypeCodes(typeCodes?: any[], isWebVisible?: boolean): Promise<{
6
6
  data: DictItem[];
7
7
  }>;
8
- export declare function queryTypeCodes(): Promise<DictItem[]>;
9
8
  export declare function formartItemTextExt(text: string): {
10
9
  [key: string]: any;
11
10
  };
package/es/Dict/utils.js CHANGED
@@ -4,7 +4,7 @@ export function queryByTypeCode(typeCode) {
4
4
  var headers = {
5
5
  Authorization: _cache.getCache('token', 'session')
6
6
  };
7
- return Service.$http({
7
+ return Service.http({
8
8
  url: "/api/dictionary/v1/queryByTypeCode/".concat(typeCode),
9
9
  method: 'get',
10
10
  requestId: 'queryByTypeCode',
@@ -18,7 +18,7 @@ export function queryByTypeCodes() {
18
18
  var headers = {
19
19
  Authorization: _cache.getCache('token', 'session')
20
20
  };
21
- return Service.$http({
21
+ return Service.http({
22
22
  url: "/api/dictionary/v1/queryDictionaryListByCondition",
23
23
  method: 'post',
24
24
  requestId: 'queryByTypeCode',
@@ -29,13 +29,6 @@ export function queryByTypeCodes() {
29
29
  }
30
30
  });
31
31
  }
32
- export function queryTypeCodes() {
33
- return Service.$http({
34
- url: "/micro-apps/micro-dep-librarys/config/typeCodes.json",
35
- method: 'get',
36
- requestId: 'queryTypeCodes'
37
- });
38
- }
39
32
  export function formartItemTextExt(text) {
40
33
  var ext = {};
41
34
 
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import './index.less';
3
2
  interface IconFontProps extends React.HTMLAttributes<HTMLSpanElement> {
4
3
  type?: string;
5
4
  className?: string;
@@ -1,20 +1,9 @@
1
- import _SocketEmitter from "@cloud-app-dev/utils/es/SocketEmitter";
2
1
  import { __rest } from "tslib";
3
2
  import React from 'react';
4
- import "./index.css";
5
3
  var global = window;
6
4
 
7
- function registerIconFont(scriptUrl) {
8
- if (!global._ICON_IS_INIT_) {
9
- global._ICON_SCRIPT_URL = scriptUrl;
10
- global._ICON_IS_INIT_ = true;
11
- loadScript(scriptUrl).then(function () {
12
- _SocketEmitter.emit('update-iconfont', null);
13
- }).catch(function (e) {
14
- console.error(e);
15
- global._ICON_IS_INIT_ = false;
16
- });
17
- }
5
+ if (!global._ICON_SCRIPT_URL) {
6
+ global._ICON_SCRIPT_URL = {};
18
7
  }
19
8
 
20
9
  function loadScript(url) {
@@ -31,6 +20,16 @@ function loadScript(url) {
31
20
  });
32
21
  }
33
22
 
23
+ function registerIconFont(scriptUrl) {
24
+ if (!global._ICON_SCRIPT_URL[scriptUrl]) {
25
+ global._ICON_SCRIPT_URL[scriptUrl] = true;
26
+ loadScript(scriptUrl).catch(function (e) {
27
+ global._ICON_SCRIPT_URL[scriptUrl] = false;
28
+ console.error(e);
29
+ });
30
+ }
31
+ }
32
+
34
33
  function IconFont(_a) {
35
34
  var type = _a.type,
36
35
  _a$className = _a.className,
@@ -11,9 +11,8 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
11
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
 
13
13
  import React, { useState, useEffect } from 'react';
14
- import Dict from '../Dict';
15
14
  import Config from '../Config';
16
- import { queryBSConfig, queryMicroApplicationList, querySystemUpdate } from './utils';
15
+ import { queryBSConfig, queryMicroApplicationList, querySystemUpdate, queryDefaultTheme } from './utils';
17
16
 
18
17
  function InitialConfig(_ref) {
19
18
  var children = _ref.children,
@@ -28,16 +27,18 @@ function InitialConfig(_ref) {
28
27
  state = _useState2[0],
29
28
  setState = _useState2[1];
30
29
 
31
- Dict.useTypeCodes();
32
30
  useEffect(function () {
33
- Promise.all([queryBSConfig(), queryMicroApplicationList(), querySystemUpdate()]).then(function (_ref2) {
34
- var _ref3 = _slicedToArray(_ref2, 3),
31
+ var arr = [queryBSConfig(), queryMicroApplicationList(), querySystemUpdate(), queryDefaultTheme()];
32
+ Promise.all(arr).then(function (_ref2) {
33
+ var _ref3 = _slicedToArray(_ref2, 4),
35
34
  BSConfig = _ref3[0],
36
35
  AppConfig = _ref3[1],
37
- SystemConfig = _ref3[2];
36
+ SystemConfig = _ref3[2],
37
+ ThemeConfig = _ref3[3];
38
38
 
39
39
  Config.registerBSConfig(BSConfig);
40
40
  Config.registerAppConfig(AppConfig);
41
+ Config.registerThemeConfig(ThemeConfig.content);
41
42
  setState(function () {
42
43
  return {
43
44
  isUpdate: SystemConfig.isUpdate,
@@ -13,3 +13,8 @@ export declare function queryMicroApplicationList(): Promise<any>;
13
13
  * @description 获取平台升级状态
14
14
  */
15
15
  export declare function querySystemUpdate(): Promise<any>;
16
+ /**
17
+ *
18
+ * @description 获取平台配色
19
+ */
20
+ export declare function queryDefaultTheme(): Promise<any>;
@@ -12,8 +12,8 @@ export function queryBSConfig() {
12
12
  switch (_context.prev = _context.next) {
13
13
  case 0:
14
14
  _context.next = 2;
15
- return Service.$http({
16
- url: '/api/system/config/web'
15
+ return Service.http({
16
+ url: "/statics/config/web.conf.json?".concat(Date.now())
17
17
  });
18
18
 
19
19
  case 2:
@@ -39,8 +39,8 @@ export function queryMicroApplicationList() {
39
39
  switch (_context2.prev = _context2.next) {
40
40
  case 0:
41
41
  _context2.next = 2;
42
- return Service.$http({
43
- url: "/api/app/list"
42
+ return Service.http({
43
+ url: "/statics/config/app.conf.json?".concat(Date.now())
44
44
  });
45
45
 
46
46
  case 2:
@@ -65,8 +65,8 @@ export function querySystemUpdate() {
65
65
  while (1) {
66
66
  switch (_context3.prev = _context3.next) {
67
67
  case 0:
68
- return _context3.abrupt("return", Service.$http({
69
- url: "/api/system/config/updateStatus?".concat(Date.now())
68
+ return _context3.abrupt("return", Service.http({
69
+ url: "/statics/config/update.status.conf.json?".concat(Date.now())
70
70
  }));
71
71
 
72
72
  case 1:
@@ -76,4 +76,31 @@ export function querySystemUpdate() {
76
76
  }
77
77
  }, _callee3);
78
78
  }));
79
+ }
80
+ /**
81
+ *
82
+ * @description 获取平台配色
83
+ */
84
+
85
+ export function queryDefaultTheme() {
86
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
87
+ return regeneratorRuntime.wrap(function _callee4$(_context4) {
88
+ while (1) {
89
+ switch (_context4.prev = _context4.next) {
90
+ case 0:
91
+ _context4.next = 2;
92
+ return Service.http({
93
+ url: "/statics/config/theme.info.json?".concat(Date.now())
94
+ });
95
+
96
+ case 2:
97
+ return _context4.abrupt("return", _context4.sent.data);
98
+
99
+ case 3:
100
+ case "end":
101
+ return _context4.stop();
102
+ }
103
+ }
104
+ }, _callee4);
105
+ }));
79
106
  }
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
+ import { InitDataType } from './utils';
2
3
  interface IInitialRequestProps {
3
4
  children: React.ReactNode;
4
5
  Spin?: React.ReactNode;
6
+ customInitialization?: () => Promise<InitDataType>;
5
7
  }
6
- declare function InitialRequest({ children, Spin }: IInitialRequestProps): JSX.Element;
8
+ declare function InitialRequest({ children, Spin, customInitialization }: IInitialRequestProps): JSX.Element;
7
9
  export default InitialRequest;
@@ -23,7 +23,8 @@ function InitialRequest(_ref) {
23
23
  var _this = this;
24
24
 
25
25
  var children = _ref.children,
26
- Spin = _ref.Spin;
26
+ Spin = _ref.Spin,
27
+ customInitialization = _ref.customInitialization;
27
28
 
28
29
  var _useContext = useContext(AppContext.Context),
29
30
  updateUser = _useContext.updateUser,
@@ -42,25 +43,28 @@ function InitialRequest(_ref) {
42
43
 
43
44
  var init = function init() {
44
45
  return __awaiter(_this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
45
- var _yield$initialization, userFeatures, operationInfo, systemFeatures, userInfo;
46
+ var fetchInitData, _yield$fetchInitData, userFeatures, operationInfo, systemFeatures, userInfo, themeConfig;
46
47
 
47
48
  return regeneratorRuntime.wrap(function _callee$(_context) {
48
49
  while (1) {
49
50
  switch (_context.prev = _context.next) {
50
51
  case 0:
51
- _context.next = 2;
52
- return initialization();
53
-
54
- case 2:
55
- _yield$initialization = _context.sent;
56
- userFeatures = _yield$initialization.userFeatures;
57
- operationInfo = _yield$initialization.operationInfo;
58
- systemFeatures = _yield$initialization.systemFeatures;
59
- userInfo = _yield$initialization.userInfo;
60
- updateUser(userInfo);
61
- updateOperation(operationInfo);
62
- Config.registerFeatrue(userFeatures);
63
- Config.registerPlatformFeature(systemFeatures);
52
+ fetchInitData = customInitialization || initialization;
53
+ _context.next = 3;
54
+ return fetchInitData();
55
+
56
+ case 3:
57
+ _yield$fetchInitData = _context.sent;
58
+ userFeatures = _yield$fetchInitData.userFeatures;
59
+ operationInfo = _yield$fetchInitData.operationInfo;
60
+ systemFeatures = _yield$fetchInitData.systemFeatures;
61
+ userInfo = _yield$fetchInitData.userInfo;
62
+ themeConfig = _yield$fetchInitData.themeConfig;
63
+ userInfo && updateUser(userInfo);
64
+ operationInfo && updateOperation(operationInfo);
65
+ userFeatures && Config.registerFeatrueIds(userFeatures);
66
+ systemFeatures && Config.registerPlatformFeature(systemFeatures);
67
+ themeConfig && Config.registerThemeConfig(themeConfig);
64
68
 
65
69
  _nextTick(function () {
66
70
  return setIsInit(true);
@@ -68,7 +72,7 @@ function InitialRequest(_ref) {
68
72
 
69
73
  _BASE_DATA_INIT = true;
70
74
 
71
- case 13:
75
+ case 16:
72
76
  case "end":
73
77
  return _context.stop();
74
78
  }
@@ -1,8 +1,10 @@
1
1
  import { UserInfoType, OperationInfoType } from '../AppContext/interface';
2
- import { FeatureItemType } from '../Config/interface';
3
- export declare function initialization(): Promise<{
2
+ import { FeatureItemType, ThemeInfoType } from '../Config/interface';
3
+ export declare type InitDataType = {
4
4
  userInfo: UserInfoType;
5
- userFeatures: FeatureItemType[];
5
+ userFeatures: string[];
6
6
  systemFeatures: FeatureItemType[];
7
7
  operationInfo: OperationInfoType;
8
- }>;
8
+ themeConfig: ThemeInfoType;
9
+ };
10
+ export declare function initialization(): Promise<InitDataType>;
@@ -13,26 +13,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
13
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
14
 
15
15
  import { __awaiter } from "tslib";
16
- import Config from '../Config';
17
16
  import Service from '../Service';
18
-
19
- function catchPromise(fn) {
20
- return new Promise(function (resolve) {
21
- fn.then(function (res) {
22
- return resolve(res);
23
- }, function (err) {
24
- console.error(err);
25
- resolve(null);
26
- });
27
- });
28
- }
29
-
30
- var method = 'post';
31
17
  export function initialization() {
32
18
  var _a;
33
19
 
34
20
  return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
35
- var headers, result, userInfo, userId, operationCenterId, data, data2, centerUrl, centerInfo, themeInfo, themeConfig, userPrivilegesUrl, systemFeatureUrl, _yield$Promise$all, _yield$Promise$all2, _yield$Promise$all2$, userFeatures, _yield$Promise$all2$2, systemFeatures;
21
+ var headers, result, userInfo, userId, systemId, centerUrl, userPrivilegesUrl, systemFeatureUrl, themeConfigUrl, _yield$Promise$all, _yield$Promise$all2, _yield$Promise$all2$, centerInfo, userFeaturesRes, _yield$Promise$all2$2, systemFeatures, _yield$Promise$all2$3, themeInfo, featureIds;
36
22
 
37
23
  return regeneratorRuntime.wrap(function _callee$(_context) {
38
24
  while (1) {
@@ -42,9 +28,9 @@ export function initialization() {
42
28
  Authorization: _cache.getCache('token', 'session')
43
29
  };
44
30
  _context.next = 3;
45
- return Service.$http({
31
+ return Service.http({
46
32
  url: '/api/user/v1/getUserByToken',
47
- method: method,
33
+ method: 'post',
48
34
  headers: headers
49
35
  });
50
36
 
@@ -52,75 +38,71 @@ export function initialization() {
52
38
  result = _context.sent;
53
39
  userInfo = result.data;
54
40
  userId = userInfo.id;
55
- operationCenterId = userInfo.operationCenterId;
56
- data = {
57
- id: userId
58
- };
59
- data2 = {
60
- id: operationCenterId
61
- };
62
- centerUrl = "/api/user/operationCenter/v1/operationCenters/".concat(operationCenterId);
63
- _context.next = 12;
64
- return Service.$http({
65
- data: data2,
66
- method: method,
41
+ systemId = userInfo.operationCenterId;
42
+ centerUrl = "/api/user/operationCenter/v1/operationCenters/".concat(systemId);
43
+ userPrivilegesUrl = "/api/user/role/v1/queryUserRoles/".concat(userId);
44
+ systemFeatureUrl = "/api/micro-app-service/feature/v1/system/list/".concat(systemId);
45
+ themeConfigUrl = '/api/micro-app-service/config/v1/default';
46
+ _context.next = 13;
47
+ return Promise.all([Service.http({
67
48
  url: centerUrl,
68
- headers: headers
69
- });
70
-
71
- case 12:
72
- centerInfo = _context.sent;
73
- _context.next = 15;
74
- return Service.$http({
75
- url: '/api/system/config/type',
49
+ headers: headers,
76
50
  data: {
77
- type: 'theme',
78
- systemId: operationCenterId
79
- }
80
- });
81
-
82
- case 15:
83
- themeInfo = _context.sent;
84
- themeConfig = (_a = themeInfo === null || themeInfo === void 0 ? void 0 : themeInfo.data) === null || _a === void 0 ? void 0 : _a.content;
85
-
86
- if (themeConfig) {
87
- Config.registerThemeConfig(themeConfig);
88
- }
89
-
90
- userPrivilegesUrl = "/api/user/role/v1/queryUserRoles/".concat(userId);
91
- systemFeatureUrl = "/api/system/".concat(operationCenterId, "/list");
92
- _context.next = 22;
93
- return Promise.all([catchPromise(Service.$http({
94
- data: data,
95
- method: method,
51
+ id: systemId
52
+ },
53
+ method: 'post'
54
+ }), Service.http({
96
55
  url: userPrivilegesUrl,
97
- headers: headers
98
- })), catchPromise(Service.$http({
99
- data: data2,
100
- method: 'get',
56
+ headers: headers,
57
+ data: {
58
+ id: userId
59
+ },
60
+ method: 'post'
61
+ }), Service.http({
101
62
  url: systemFeatureUrl,
102
- headers: headers
103
- }))]);
63
+ headers: headers,
64
+ data: {
65
+ id: systemId
66
+ },
67
+ method: 'get'
68
+ }), Service.http({
69
+ url: themeConfigUrl,
70
+ headers: headers,
71
+ data: {
72
+ type: 2,
73
+ systemId: systemId
74
+ },
75
+ method: 'post'
76
+ })]);
104
77
 
105
- case 22:
78
+ case 13:
106
79
  _yield$Promise$all = _context.sent;
107
- _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
80
+ _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 4);
108
81
  _yield$Promise$all2$ = _yield$Promise$all2[0];
109
- userFeatures = _yield$Promise$all2$ === void 0 ? {
110
- data: []
82
+ centerInfo = _yield$Promise$all2$ === void 0 ? {
83
+ data: {}
111
84
  } : _yield$Promise$all2$;
112
- _yield$Promise$all2$2 = _yield$Promise$all2[1];
85
+ userFeaturesRes = _yield$Promise$all2[1];
86
+ _yield$Promise$all2$2 = _yield$Promise$all2[2];
113
87
  systemFeatures = _yield$Promise$all2$2 === void 0 ? {
114
88
  data: []
115
89
  } : _yield$Promise$all2$2;
90
+ _yield$Promise$all2$3 = _yield$Promise$all2[3];
91
+ themeInfo = _yield$Promise$all2$3 === void 0 ? {
92
+ data: {}
93
+ } : _yield$Promise$all2$3;
94
+ featureIds = (userFeaturesRes.data || []).map(function (v) {
95
+ return v.functionCodes;
96
+ }).flat();
116
97
  return _context.abrupt("return", {
117
98
  userInfo: userInfo,
118
- userFeatures: userFeatures.data,
99
+ userFeatures: featureIds,
119
100
  systemFeatures: systemFeatures.data,
120
- operationInfo: centerInfo.data
101
+ operationInfo: centerInfo.data,
102
+ themeConfig: ((_a = themeInfo === null || themeInfo === void 0 ? void 0 : themeInfo.data) === null || _a === void 0 ? void 0 : _a.info) || {}
121
103
  });
122
104
 
123
- case 29:
105
+ case 24:
124
106
  case "end":
125
107
  return _context.stop();
126
108
  }