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

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 (126) hide show
  1. package/README.md +4 -0
  2. package/es/AppContext/Sync.d.ts +6 -0
  3. package/es/AppContext/Sync.js +47 -0
  4. package/es/AppContext/index.d.ts +10 -0
  5. package/es/AppContext/index.js +117 -0
  6. package/es/AppContext/interface.d.ts +29 -0
  7. package/es/AppContext/static.d.ts +6 -0
  8. package/es/AppContext/static.js +6 -0
  9. package/es/Config/index.d.ts +4 -0
  10. package/es/Config/index.js +23 -0
  11. package/es/Config/interface.d.ts +39 -0
  12. package/es/Config/utils.d.ts +11 -0
  13. package/es/{DagInitialRequest/index.js → Config/utils.js} +39 -62
  14. package/es/ConfigContext/index.d.ts +6 -0
  15. package/es/ConfigContext/index.js +3 -0
  16. package/es/InitialConfig/index.d.ts +5 -7
  17. package/es/InitialConfig/index.js +11 -42
  18. package/es/InitialConfig/utils.d.ts +15 -0
  19. package/es/InitialConfig/utils.js +40 -305
  20. package/es/InitialRequest/index.d.ts +5 -11
  21. package/es/InitialRequest/index.js +50 -67
  22. package/es/InitialRequest/utils.d.ts +8 -0
  23. package/es/InitialRequest/utils.js +28 -567
  24. package/es/Service/http.d.ts +4 -0
  25. package/es/Service/http.js +152 -0
  26. package/es/Service/index.d.ts +3 -0
  27. package/es/Service/index.js +14 -0
  28. package/es/Service/interface.d.ts +28 -0
  29. package/es/Service/logger.d.ts +3 -0
  30. package/es/Service/logger.js +13 -0
  31. package/es/Service/middleware.d.ts +5 -0
  32. package/es/Service/middleware.js +15 -0
  33. package/es/Service/utils.d.ts +3 -0
  34. package/es/Service/utils.js +11 -0
  35. package/es/WorkerFlow/Demo.js +1 -0
  36. package/es/WorkerFlow/Form/Condition.js +4 -5
  37. package/es/WorkerFlow/Form/GroupList.d.ts +2 -1
  38. package/es/WorkerFlow/Form/GroupList.js +3 -2
  39. package/es/WorkerFlow/Form/GroupSelectModalContent.js +4 -2
  40. package/es/WorkerFlow/Nodes/TitleElement.js +13 -6
  41. package/es/WorkerFlow/index.js +36 -7
  42. package/es/index.d.ts +4 -8
  43. package/es/index.js +4 -8
  44. package/package.json +2 -2
  45. package/es/AppLayout/AppHeader/index.css +0 -4
  46. package/es/AppLayout/AppHeader/index.d.ts +0 -18
  47. package/es/AppLayout/AppHeader/index.js +0 -41
  48. package/es/AppLayout/AppHorizontalMenu/MenuEmptyBox.d.ts +0 -1
  49. package/es/AppLayout/AppHorizontalMenu/MenuEmptyBox.js +0 -10
  50. package/es/AppLayout/AppHorizontalMenu/SubGroup.d.ts +0 -9
  51. package/es/AppLayout/AppHorizontalMenu/SubGroup.js +0 -57
  52. package/es/AppLayout/AppHorizontalMenu/index.css +0 -152
  53. package/es/AppLayout/AppHorizontalMenu/index.d.ts +0 -13
  54. package/es/AppLayout/AppHorizontalMenu/index.js +0 -230
  55. package/es/AppLayout/AppInlineMenu/SubGroup.d.ts +0 -9
  56. package/es/AppLayout/AppInlineMenu/SubGroup.js +0 -34
  57. package/es/AppLayout/AppInlineMenu/index.css +0 -110
  58. package/es/AppLayout/AppInlineMenu/index.d.ts +0 -12
  59. package/es/AppLayout/AppInlineMenu/index.js +0 -194
  60. package/es/AppLayout/AppLogo/index.css +0 -74
  61. package/es/AppLayout/AppLogo/index.d.ts +0 -13
  62. package/es/AppLayout/AppLogo/index.js +0 -100
  63. package/es/AppLayout/AppTools/index.css +0 -0
  64. package/es/AppLayout/AppTools/index.d.ts +0 -8
  65. package/es/AppLayout/AppTools/index.js +0 -10
  66. package/es/AppLayout/FunctionPreview/index.css +0 -128
  67. package/es/AppLayout/FunctionPreview/index.d.ts +0 -22
  68. package/es/AppLayout/FunctionPreview/index.js +0 -218
  69. package/es/AppLayout/Header/ListenceRoute.d.ts +0 -5
  70. package/es/AppLayout/Header/ListenceRoute.js +0 -28
  71. package/es/AppLayout/Header/ModifyPassword/index.d.ts +0 -6
  72. package/es/AppLayout/Header/ModifyPassword/index.js +0 -201
  73. package/es/AppLayout/Header/ModifyUserAvatar/index.css +0 -25
  74. package/es/AppLayout/Header/ModifyUserAvatar/index.d.ts +0 -10
  75. package/es/AppLayout/Header/ModifyUserAvatar/index.js +0 -97
  76. package/es/AppLayout/Header/NotifyAlarm.js +0 -122
  77. package/es/AppLayout/Header/ThemeTools.js +0 -69
  78. package/es/AppLayout/Header/Tools.d.ts +0 -11
  79. package/es/AppLayout/Header/Tools.js +0 -86
  80. package/es/AppLayout/Header/ToolsItem.d.ts +0 -1
  81. package/es/AppLayout/Header/ToolsItem.js +0 -12
  82. package/es/AppLayout/Header/UserAction.d.ts +0 -10
  83. package/es/AppLayout/Header/UserAction.js +0 -224
  84. package/es/AppLayout/Header/index.css +0 -136
  85. package/es/AppLayout/Header/index.d.ts +0 -9
  86. package/es/AppLayout/Header/index.js +0 -36
  87. package/es/AppLayout/index.css +0 -21
  88. package/es/AppLayout/index.d.ts +0 -12
  89. package/es/AppLayout/index.js +0 -38
  90. package/es/AppLayout/service/index.js +0 -174
  91. package/es/AppLayout/service/prefix.js +0 -4
  92. package/es/AppLayout/service/url.js +0 -35
  93. package/es/AppLayout/utils/menu.js +0 -24
  94. package/es/AppLayout/utils.d.ts +0 -4
  95. package/es/AppLayout/utils.js +0 -112
  96. package/es/DagInitialConfig/index.css +0 -0
  97. package/es/DagInitialConfig/index.d.ts +0 -10
  98. package/es/DagInitialConfig/index.js +0 -70
  99. package/es/DagInitialConfig/utils.js +0 -185
  100. package/es/DagInitialRequest/index.css +0 -0
  101. package/es/DagInitialRequest/index.d.ts +0 -10
  102. package/es/DagInitialRequest/utils.js +0 -573
  103. package/es/FormContent/index.css +0 -27
  104. package/es/FormContent/index.d.ts +0 -19
  105. package/es/FormContent/index.js +0 -58
  106. package/es/OrgTree/index.css +0 -39
  107. package/es/OrgTree/index.d.ts +0 -16
  108. package/es/OrgTree/index.js +0 -176
  109. package/es/OrgUserTree/demo.d.ts +0 -2
  110. package/es/OrgUserTree/demo.js +0 -20
  111. package/es/OrgUserTree/index.css +0 -31
  112. package/es/OrgUserTree/index.d.ts +0 -28
  113. package/es/OrgUserTree/index.js +0 -131
  114. package/es/PlaceTree/demo.d.ts +0 -2
  115. package/es/PlaceTree/demo.js +0 -20
  116. package/es/PlaceTree/index.css +0 -40
  117. package/es/PlaceTree/index.d.ts +0 -26
  118. package/es/PlaceTree/index.js +0 -174
  119. package/es/Upload/AntUpload/index.css +0 -22
  120. package/es/Upload/AntUpload/index.d.ts +0 -19
  121. package/es/Upload/AntUpload/index.js +0 -226
  122. package/es/Upload/UploadChildren/index.css +0 -28
  123. package/es/Upload/UploadChildren/index.js +0 -26
  124. package/es/Upload/index.css +0 -0
  125. package/es/Upload/index.d.ts +0 -9
  126. package/es/Upload/index.js +0 -7
package/README.md CHANGED
@@ -25,3 +25,7 @@ Build library via `father-build`,
25
25
  ```bash
26
26
  $ npm run build
27
27
  ```
28
+
29
+ ### Changlog
30
+
31
+ - 1.0.48 修复工作流 bug
@@ -0,0 +1,6 @@
1
+ import { AppContextInterface } from './interface';
2
+ interface ISyncProps {
3
+ stateChange: (options: AppContextInterface) => void;
4
+ }
5
+ declare function Sync({ stateChange }: ISyncProps): JSX.Element;
6
+ export default Sync;
@@ -0,0 +1,47 @@
1
+ import _SocketEmitter from "@cloud-app-dev/utils/es/SocketEmitter";
2
+ import React, { useEffect } from 'react';
3
+ import { _LOGIN_STATUS_EVENT_CHANGE_, _OPERATION_EVENT_CHANGE_, _USER_EVENT_CHANGE_ } from './static';
4
+
5
+ function Sync(_ref) {
6
+ var stateChange = _ref.stateChange;
7
+
8
+ /**
9
+ * @description 用户微应用之间的状态同步
10
+ */
11
+ useEffect(function () {
12
+ var userFn = function userFn(user) {
13
+ return stateChange({
14
+ user: user
15
+ });
16
+ };
17
+
18
+ var operationFn = function operationFn(operation) {
19
+ return stateChange({
20
+ operation: operation
21
+ });
22
+ };
23
+
24
+ var statusFn = function statusFn(status) {
25
+ return stateChange({
26
+ loginStatus: status
27
+ });
28
+ };
29
+
30
+ _SocketEmitter.on(_USER_EVENT_CHANGE_, userFn);
31
+
32
+ _SocketEmitter.on(_OPERATION_EVENT_CHANGE_, operationFn);
33
+
34
+ _SocketEmitter.on(_LOGIN_STATUS_EVENT_CHANGE_, statusFn);
35
+
36
+ return function () {
37
+ _SocketEmitter.off(_USER_EVENT_CHANGE_, userFn);
38
+
39
+ _SocketEmitter.off(_OPERATION_EVENT_CHANGE_, operationFn);
40
+
41
+ _SocketEmitter.off(_LOGIN_STATUS_EVENT_CHANGE_, statusFn);
42
+ };
43
+ }, []);
44
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
45
+ }
46
+
47
+ export default Sync;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { AppContextInterface } from './interface';
3
+ declare function Provider({ children }: {
4
+ children?: React.ReactNode;
5
+ }): JSX.Element;
6
+ declare const _default: {
7
+ Provider: typeof Provider;
8
+ Context: React.Context<AppContextInterface>;
9
+ };
10
+ export default _default;
@@ -0,0 +1,117 @@
1
+ import _SocketEmitter from "@cloud-app-dev/utils/es/SocketEmitter";
2
+ import _nextTick from "@cloud-app-dev/utils/es/nextTick";
3
+ import _cache from "@cloud-app-dev/utils/es/cache";
4
+
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+
7
+ 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."); }
8
+
9
+ 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); }
10
+
11
+ 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; }
12
+
13
+ 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; }
14
+
15
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
+
17
+ import React, { useCallback, useMemo, useState } from 'react';
18
+ import Sync from './Sync';
19
+ import * as Static from './static';
20
+ var _USER_SESSION_ = Static._USER_SESSION_,
21
+ _OPERATION_SESSION_ = Static._OPERATION_SESSION_,
22
+ _LOGIN_STATUS_SESSION_ = Static._LOGIN_STATUS_SESSION_,
23
+ _USER_EVENT_CHANGE_ = Static._USER_EVENT_CHANGE_,
24
+ _OPERATION_EVENT_CHANGE_ = Static._OPERATION_EVENT_CHANGE_,
25
+ _LOGIN_STATUS_EVENT_CHANGE_ = Static._LOGIN_STATUS_EVENT_CHANGE_;
26
+ var Context = /*#__PURE__*/React.createContext(null);
27
+
28
+ function Provider(_ref) {
29
+ var children = _ref.children;
30
+
31
+ var _useState = useState({
32
+ user: _cache.getCache(_USER_SESSION_, 'session') || {},
33
+ operation: _cache.getCache(_OPERATION_SESSION_, 'session') || {},
34
+ loginStatus: _cache.getCache(_LOGIN_STATUS_SESSION_, 'session') || false
35
+ }),
36
+ _useState2 = _slicedToArray(_useState, 2),
37
+ state = _useState2[0],
38
+ setState = _useState2[1];
39
+
40
+ function updateUser() {
41
+ var user = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
42
+ var newUser = Object.assign(Object.assign({}, state.user), user);
43
+ setState(function (old) {
44
+ return Object.assign(Object.assign({}, old), {
45
+ user: newUser
46
+ });
47
+ });
48
+
49
+ _nextTick(function () {
50
+ _SocketEmitter.emit(_USER_EVENT_CHANGE_, newUser);
51
+
52
+ _cache.setCache(_USER_SESSION_, newUser, 'session');
53
+
54
+ console.warn('AppContext updateUser is run !', user);
55
+ });
56
+ }
57
+
58
+ function updateOperation() {
59
+ var operation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
60
+ var newOperation = Object.assign(Object.assign({}, state.operation), operation);
61
+ setState(function (old) {
62
+ return Object.assign(Object.assign({}, old), {
63
+ operation: newOperation
64
+ });
65
+ });
66
+
67
+ _nextTick(function () {
68
+ _SocketEmitter.emit(_OPERATION_EVENT_CHANGE_, newOperation);
69
+
70
+ _cache.setCache(_OPERATION_SESSION_, newOperation, 'session');
71
+
72
+ console.warn('AppContext updateOperation is run !', operation);
73
+ });
74
+ }
75
+
76
+ function updateLoginStatus(status) {
77
+ setState(function (old) {
78
+ return Object.assign(Object.assign({}, old), {
79
+ loginStatus: status
80
+ });
81
+ });
82
+
83
+ _nextTick(function () {
84
+ _SocketEmitter.emit(_LOGIN_STATUS_EVENT_CHANGE_, status);
85
+
86
+ _cache.setCache(_LOGIN_STATUS_SESSION_, status, 'session');
87
+
88
+ console.warn('AppContext updateLoginStatus is run !', status);
89
+ });
90
+ }
91
+
92
+ var stateChange = useCallback(function (options) {
93
+ return setState(function (old) {
94
+ return Object.assign(Object.assign({}, old), options);
95
+ });
96
+ }, []);
97
+ var providerValue = useMemo(function () {
98
+ return {
99
+ user: state.user,
100
+ operation: state.operation,
101
+ loginStatus: state.loginStatus,
102
+ updateUser: updateUser,
103
+ updateOperation: updateOperation,
104
+ updateLoginStatus: updateLoginStatus
105
+ };
106
+ }, [state.user, state.operation, state.loginStatus]);
107
+ return /*#__PURE__*/React.createElement(Context.Provider, {
108
+ value: providerValue
109
+ }, children, /*#__PURE__*/React.createElement(Sync, {
110
+ stateChange: stateChange
111
+ }));
112
+ }
113
+
114
+ export default {
115
+ Provider: Provider,
116
+ Context: Context
117
+ };
@@ -0,0 +1,29 @@
1
+ export type UserInfoType = {
2
+ acceptAgreement: boolean;
3
+ id: string;
4
+ idCardNotNull: false;
5
+ lockTime: string;
6
+ loginName: string;
7
+ operationCenterId: string;
8
+ organizationId: string;
9
+ organizationName: string;
10
+ phoneNum: string;
11
+ realName: string;
12
+ roleIds: string[];
13
+ userAvatarUrl?: string;
14
+ userGrade: string;
15
+ userSource: string;
16
+ userType: string;
17
+ validState: string;
18
+ };
19
+
20
+ export type OperationInfoType = {};
21
+
22
+ export interface AppContextInterface {
23
+ user: UserInfoType;
24
+ operation: OperationInfoType;
25
+ loginStatus: boolean;
26
+ updateUser: (user: UserInfoType) => void;
27
+ updateOperation: (user: OperationInfoType) => void;
28
+ updateLoginStatus: (status: boolean) => void;
29
+ }
@@ -0,0 +1,6 @@
1
+ export declare const _USER_EVENT_CHANGE_ = "_USER_EVENT_CHANGE_";
2
+ export declare const _OPERATION_EVENT_CHANGE_ = "_OPERATION_EVENT_CHANGE_";
3
+ export declare const _LOGIN_STATUS_EVENT_CHANGE_ = "_LOGIN_STATUS_EVENT_CHANGE_";
4
+ export declare const _USER_SESSION_ = "_USER_SESSION_";
5
+ export declare const _OPERATION_SESSION_ = "_OPERATION_SESSION_";
6
+ export declare const _LOGIN_STATUS_SESSION_ = "_LOGIN_STATUS_SESSION_";
@@ -0,0 +1,6 @@
1
+ export var _USER_EVENT_CHANGE_ = '_USER_EVENT_CHANGE_';
2
+ export var _OPERATION_EVENT_CHANGE_ = '_OPERATION_EVENT_CHANGE_';
3
+ export var _LOGIN_STATUS_EVENT_CHANGE_ = '_LOGIN_STATUS_EVENT_CHANGE_';
4
+ export var _USER_SESSION_ = '_USER_SESSION_';
5
+ export var _OPERATION_SESSION_ = '_OPERATION_SESSION_';
6
+ export var _LOGIN_STATUS_SESSION_ = '_LOGIN_STATUS_SESSION_';
@@ -0,0 +1,4 @@
1
+ import { ConfigJOSN } from './interface';
2
+ declare const Config: ConfigJOSN;
3
+ declare const LMConfig: typeof Config;
4
+ export default LMConfig;
@@ -0,0 +1,23 @@
1
+ import produce from 'immer';
2
+ var Config = {
3
+ app: produce([], function () {}),
4
+ bs: produce({}, function () {}),
5
+ feature: produce([], function () {}),
6
+ pFeature: produce([], function () {}),
7
+ registerConfig: function registerConfig(key, conf) {
8
+ Config[key] = produce(Config.AppConfig, function (draft) {
9
+ draft = conf;
10
+ });
11
+ }
12
+ };
13
+
14
+ var LMConfig = function () {
15
+ if (window['_CONFIG_']) {
16
+ return window['_CONFIG_'];
17
+ } else {
18
+ window['_CONFIG_'] = Config;
19
+ return Config;
20
+ }
21
+ }();
22
+
23
+ export default LMConfig;
@@ -0,0 +1,39 @@
1
+ export type AppItemType = {
2
+ id: string;
3
+ routerPrefix: string;
4
+ version: string;
5
+ status: 0 | 1 | 2; //App状态1:正常,2:下架,0:删除,微应用下架或者删除时对应的功能项全部停用
6
+ resource: string[]; //App对应脚本静态资源文件路径[js,css]
7
+ icon: string;
8
+ name: string;
9
+ ext?: any;
10
+ };
11
+
12
+ export type FeatureItemType = {
13
+ id: string;
14
+ appId: string;
15
+ name: string;
16
+ status: 0 | 1 | 2; //功能项状态1,正常,2,停用,0删除,当App更新了版后是可能出现功能项缩减的情况
17
+ type: 1 | 2 | 3; //功能类型1:实际菜单,2:权限,3:虚拟分组
18
+ interfaceCodes: string[];
19
+ icon: string;
20
+ routerUrl: string;
21
+ sort: number;
22
+ };
23
+
24
+ export type BSConfigType = {
25
+ systemLogo: string;
26
+ systemName: string;
27
+ icp: string[];
28
+ openSocket: boolean;
29
+ chromeDownloadUrl: string;
30
+ };
31
+
32
+ export type ConfigJOSN = {
33
+ app: AppItemType[];
34
+ feature: FeatureItemType[];
35
+ pFeature: FeatureItemType[];
36
+ bs: BSConfigType;
37
+ registerConfig: (key: string, conf: { [key: string]: any }) => void;
38
+ [key: string]: any;
39
+ };
@@ -0,0 +1,11 @@
1
+ import { ConfigJOSN } from './interface';
2
+ export declare function formartThemeConfig(options: ConfigJOSN): {
3
+ [x: string]: any;
4
+ app: import("./interface").AppItemType[];
5
+ feature: import("./interface").FeatureItemType[];
6
+ pFeature: import("./interface").FeatureItemType[];
7
+ bs: import("./interface").BSConfigType;
8
+ registerConfig: (key: string, conf: {
9
+ [key: string]: any;
10
+ }) => void;
11
+ };
@@ -1,77 +1,54 @@
1
- import _Store from "@cloud-app-dev/basic-components/es/Store";
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ 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; }
6
+
7
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
2
8
 
3
9
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
10
 
5
11
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
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
+
7
15
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
16
 
9
17
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
18
 
11
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
19
+ 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; }
12
20
 
13
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
21
+ var style = document.createElement('style');
22
+ var isInit = false;
23
+ export function formartThemeConfig(options) {
24
+ var _ref;
14
25
 
15
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
26
+ var tplStr = ':root{<content>}';
27
+ var data = Object.assign({}, options);
28
+ data.vars = {};
29
+ data.style = {};
16
30
 
17
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
31
+ var attrArr = (_ref = []).concat.apply(_ref, _toConsumableArray(Object.values(options.vars)));
18
32
 
19
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
33
+ style.innerHTML = tplStr.replace('<content>', attrArr.reduce(function (a, b) {
34
+ var _b$split = b.split(':'),
35
+ _b$split2 = _slicedToArray(_b$split, 2),
36
+ key = _b$split2[0],
37
+ value = _b$split2[1];
20
38
 
21
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
39
+ return a + "--".concat(key, ":").concat(value, ";\n");
40
+ }, ''));
41
+
42
+ if (!isInit) {
43
+ isInit = true;
44
+ document.head.appendChild(style);
45
+ }
46
+
47
+ if (options.style) {
48
+ Object.keys(options.style).forEach(function (k) {
49
+ data.style[k] = options.style[k];
50
+ });
51
+ }
22
52
 
23
- import React, { useState, useEffect } from 'react';
24
- import { initialization, authFormat } from './utils';
25
- import "./index.css";
26
- var _BASE_DATA_INIT = false;
27
-
28
- function InitialRequest(_ref) {
29
- var children = _ref.children,
30
- Spin = _ref.Spin;
31
-
32
- var _useState = useState(false),
33
- _useState2 = _slicedToArray(_useState, 2),
34
- isInit = _useState2[0],
35
- setIsInit = _useState2[1];
36
-
37
- useEffect(function () {
38
- if (_BASE_DATA_INIT) {
39
- setIsInit(true);
40
- return;
41
- }
42
-
43
- initialization().then(function (res) {
44
- var userPrivileges = res.userPrivileges,
45
- allPrivileges = res.allPrivileges,
46
- centerPrivileges = res.centerPrivileges,
47
- centerInfo = res.centerInfo,
48
- systemInfo = res.systemInfo,
49
- userInfo = res.userInfo;
50
- var userRoles = (userPrivileges.data || []).map(function (item) {
51
- return item.functionCodes;
52
- }).flat();
53
-
54
- _Store.app.updateUserInfo(userInfo);
55
-
56
- _Store.app.updateAppInfo(centerInfo.data);
57
-
58
- _Store.app.updateSystemConfig(systemInfo.data);
59
-
60
- var userAuth = [].concat(authFormat(userRoles, centerPrivileges.data, userInfo.userType));
61
- var globalAuth = [].concat(authFormat([], allPrivileges.data, userInfo.userType));
62
-
63
- _Store.auth.initAuthData([].concat(_toConsumableArray(userAuth), _toConsumableArray(globalAuth)));
64
-
65
- _BASE_DATA_INIT = true;
66
- }).then(function () {
67
- return setIsInit(true);
68
- }).catch(function (e) {
69
- return console.error('接口初始化失败!', e);
70
- }); // eslint-disable-next-line react-hooks/exhaustive-deps
71
- }, []);
72
- return isInit ? children : Spin ? /*#__PURE__*/React.createElement(Spin, {
73
- spinning: true
74
- }) : null;
75
- }
76
-
77
- export default InitialRequest;
53
+ return data;
54
+ }
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export interface IConfigContextProps {
3
+ root: HTMLElement;
4
+ }
5
+ declare const ConfigContext: React.Context<IConfigContextProps>;
6
+ export default ConfigContext;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ var ConfigContext = /*#__PURE__*/React.createContext(null);
3
+ export default ConfigContext;
@@ -1,10 +1,8 @@
1
- import * as React from 'react';
2
-
1
+ import React from 'react';
3
2
  export interface InitialConfigProps {
4
- children: (isUpdate: boolean) => React.ReactNode;
5
- mode?: 'local' | 'server';
3
+ children?: React.ReactNode;
4
+ Spin?: React.ReactNode;
5
+ Update?: React.ReactNode;
6
6
  }
7
-
8
- declare const InitialConfig: React.StatelessComponent<InitialConfig>;
9
-
7
+ declare function InitialConfig({ children, Spin, Update }: InitialConfigProps): JSX.Element;
10
8
  export default InitialConfig;
@@ -1,4 +1,3 @@
1
- import _Store from "@cloud-app-dev/basic-components/es/Store";
2
1
  import _Config from "@cloud-app-dev/basic-components/es/Config";
3
2
  import _Dict from "@cloud-app-dev/basic-components/es/Dict";
4
3
 
@@ -15,12 +14,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
15
14
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
15
 
17
16
  import React, { useState, useEffect } from 'react';
18
- import { formatAppConfig, querySystemConfig, queryThemeConfig, queryMapConfig, queryMicroApplicationList, querySystemUpdate, queryLogoConfig, queryZenMapConfig, queryZenMap3DConfig } from './utils';
17
+ import { querySystemConfig, queryMicroApplicationList, querySystemUpdate } from './utils';
19
18
 
20
19
  function InitialConfig(_ref) {
21
20
  var children = _ref.children,
22
- _ref$mode = _ref.mode,
23
- mode = _ref$mode === void 0 ? 'server' : _ref$mode;
21
+ Spin = _ref.Spin,
22
+ Update = _ref.Update;
24
23
 
25
24
  var _useState = useState({
26
25
  isInit: false,
@@ -33,38 +32,15 @@ function InitialConfig(_ref) {
33
32
  _Dict.useTypeCodes();
34
33
 
35
34
  useEffect(function () {
36
- Promise.all([querySystemConfig(mode), queryMapConfig(mode), queryThemeConfig(mode), queryMicroApplicationList(mode), queryLogoConfig(), queryZenMapConfig(), queryZenMap3DConfig(), querySystemUpdate()]).then(function (res) {
37
- var _themeConfig$style, _themeConfig$style2;
38
-
39
- var _res = _slicedToArray(res, 8),
40
- BSConfig = _res[0],
41
- LMapConfig = _res[1],
42
- themeConfig = _res[2],
43
- AppConfig = _res[3],
44
- LogConfig = _res[4],
45
- ZenMapConfig = _res[5],
46
- ZenMap3DConfig = _res[6],
47
- SystemConfig = _res[7];
35
+ Promise.all([querySystemConfig(), queryMicroApplicationList(), querySystemUpdate()]).then(function (_ref2) {
36
+ var _ref3 = _slicedToArray(_ref2, 3),
37
+ BSConfig = _ref3[0],
38
+ AppConfig = _ref3[1],
39
+ SystemConfig = _ref3[2];
48
40
 
49
41
  _Config.registerBSConfig(BSConfig);
50
42
 
51
- _Config.registerLMapConfig(LMapConfig);
52
-
53
- _Config.registerAppConfig(formatAppConfig(AppConfig));
54
-
55
- _Config.registerThemeConfig(themeConfig);
56
-
57
- _Config.registerLogConfig(LogConfig);
58
-
59
- _Config.registerCustomConfig({
60
- ZenMap: ZenMapConfig,
61
- ZenMap3D: ZenMap3DConfig
62
- });
63
-
64
- _Store.app.updateThemeStyle({
65
- menuStyle: (_themeConfig$style = themeConfig.style) === null || _themeConfig$style === void 0 ? void 0 : _themeConfig$style.menuStyle,
66
- tabType: !!((_themeConfig$style2 = themeConfig.style) === null || _themeConfig$style2 === void 0 ? void 0 : _themeConfig$style2.tabStyle)
67
- });
43
+ _Config.registerAppConfig(AppConfig);
68
44
 
69
45
  setState(function () {
70
46
  return {
@@ -72,16 +48,9 @@ function InitialConfig(_ref) {
72
48
  isInit: true
73
49
  };
74
50
  });
75
- }); // eslint-disable-next-line react-hooks/exhaustive-deps
51
+ });
76
52
  }, []);
77
- var isInit = state.isInit,
78
- isUpdate = state.isUpdate;
79
-
80
- if (!isInit) {
81
- return null;
82
- }
83
-
84
- return /*#__PURE__*/React.createElement(React.Fragment, null, children(isUpdate));
53
+ return /*#__PURE__*/React.createElement(React.Fragment, null, state.isInit ? state.isUpdate ? Update : children : Spin);
85
54
  }
86
55
 
87
56
  export default InitialConfig;
@@ -0,0 +1,15 @@
1
+ /**
2
+ *
3
+ * @description 获取系统配置
4
+ */
5
+ export declare function querySystemConfig(): Promise<any>;
6
+ /**
7
+ *
8
+ * @description 获取所有微应用配置
9
+ */
10
+ export declare function queryMicroApplicationList(): Promise<any>;
11
+ /**
12
+ *
13
+ * @description 获取平台升级状态
14
+ */
15
+ export declare function querySystemUpdate(): Promise<any>;