@cloud-app-dev/vidc 2.0.0-alpha.0 → 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.
- package/es/AppContext/index.js +7 -1
- package/es/Config/index.d.ts +4 -0
- package/es/Config/index.js +23 -0
- package/es/Config/interface.d.ts +39 -0
- package/es/Config/utils.d.ts +11 -0
- package/es/Config/utils.js +54 -0
- package/es/ConfigContext/index.d.ts +6 -0
- package/es/ConfigContext/index.js +3 -0
- package/es/InitialConfig/index.d.ts +5 -7
- package/es/InitialConfig/index.js +11 -42
- package/es/InitialConfig/utils.d.ts +15 -0
- package/es/InitialConfig/utils.js +40 -305
- package/es/InitialRequest/index.d.ts +5 -11
- package/es/InitialRequest/index.js +50 -67
- package/es/InitialRequest/utils.d.ts +8 -0
- package/es/InitialRequest/utils.js +28 -567
- package/es/Service/http.d.ts +4 -0
- package/es/Service/http.js +152 -0
- package/es/Service/index.d.ts +3 -0
- package/es/Service/index.js +14 -0
- package/es/Service/interface.d.ts +28 -0
- package/es/Service/logger.d.ts +3 -0
- package/es/Service/logger.js +13 -0
- package/es/Service/middleware.d.ts +5 -0
- package/es/Service/middleware.js +15 -0
- package/es/Service/utils.d.ts +3 -0
- package/es/Service/utils.js +11 -0
- package/es/index.d.ts +3 -0
- package/es/index.js +3 -0
- package/package.json +1 -1
package/es/AppContext/index.js
CHANGED
|
@@ -16,7 +16,13 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
16
16
|
|
|
17
17
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
18
18
|
import Sync from './Sync';
|
|
19
|
-
import
|
|
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_;
|
|
20
26
|
var Context = /*#__PURE__*/React.createContext(null);
|
|
21
27
|
|
|
22
28
|
function Provider(_ref) {
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
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; }
|
|
8
|
+
|
|
9
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
10
|
+
|
|
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."); }
|
|
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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
16
|
+
|
|
17
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
18
|
+
|
|
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; }
|
|
20
|
+
|
|
21
|
+
var style = document.createElement('style');
|
|
22
|
+
var isInit = false;
|
|
23
|
+
export function formartThemeConfig(options) {
|
|
24
|
+
var _ref;
|
|
25
|
+
|
|
26
|
+
var tplStr = ':root{<content>}';
|
|
27
|
+
var data = Object.assign({}, options);
|
|
28
|
+
data.vars = {};
|
|
29
|
+
data.style = {};
|
|
30
|
+
|
|
31
|
+
var attrArr = (_ref = []).concat.apply(_ref, _toConsumableArray(Object.values(options.vars)));
|
|
32
|
+
|
|
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];
|
|
38
|
+
|
|
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
|
+
}
|
|
52
|
+
|
|
53
|
+
return data;
|
|
54
|
+
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
3
2
|
export interface InitialConfigProps {
|
|
4
|
-
|
|
5
|
-
|
|
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 {
|
|
17
|
+
import { querySystemConfig, queryMicroApplicationList, querySystemUpdate } from './utils';
|
|
19
18
|
|
|
20
19
|
function InitialConfig(_ref) {
|
|
21
20
|
var children = _ref.children,
|
|
22
|
-
|
|
23
|
-
|
|
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(
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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.
|
|
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
|
-
});
|
|
51
|
+
});
|
|
76
52
|
}, []);
|
|
77
|
-
|
|
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>;
|