@cloud-app-dev/vidc 2.0.0-alpha.6 → 2.0.0-alpha.7
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/Config/index.js +5 -1
- package/es/Config/interface.d.ts +10 -2
- package/es/Config/utils.d.ts +2 -18
- package/es/Config/utils.js +1 -10
- package/es/InitialRequest/index.js +14 -8
- package/es/InitialRequest/utils.d.ts +3 -3
- package/es/InitialRequest/utils.js +23 -41
- package/package.json +1 -1
package/es/Config/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import produce from 'immer';
|
|
2
|
+
import { formartThemeConfig } from './utils';
|
|
2
3
|
var Config = {
|
|
3
4
|
app: produce({}, function () {}),
|
|
4
5
|
bs: produce({}, function () {}),
|
|
@@ -29,8 +30,11 @@ var Config = {
|
|
|
29
30
|
},
|
|
30
31
|
registerThemeConfig: function registerThemeConfig(theme) {
|
|
31
32
|
Config.theme = produce(Config.theme, function (draft) {
|
|
32
|
-
draft = theme;
|
|
33
|
+
draft = formartThemeConfig(theme);
|
|
33
34
|
});
|
|
35
|
+
},
|
|
36
|
+
getThemeVarValue: function getThemeVarValue(themeKey) {
|
|
37
|
+
return getComputedStyle(document.querySelector(':root')).getPropertyValue("--".concat(themeKey));
|
|
34
38
|
}
|
|
35
39
|
};
|
|
36
40
|
|
package/es/Config/interface.d.ts
CHANGED
|
@@ -31,6 +31,14 @@ export type BSConfigType = {
|
|
|
31
31
|
chromeDownloadUrl: string;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
export type ThemeInfoType = {
|
|
35
|
+
vars: { [key: string]: string[] };
|
|
36
|
+
style: {
|
|
37
|
+
menuType: 'inline' | 'horizontal';
|
|
38
|
+
hasTab: boolean;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
|
|
34
42
|
export type ConfigKey = 'app' | 'feature' | 'pFeature' | 'bs';
|
|
35
43
|
|
|
36
44
|
export type ConfigJOSN = {
|
|
@@ -38,12 +46,12 @@ export type ConfigJOSN = {
|
|
|
38
46
|
feature: FeatureItemType[];
|
|
39
47
|
pFeature: FeatureItemType[];
|
|
40
48
|
bs: BSConfigType;
|
|
41
|
-
theme:
|
|
49
|
+
theme: ThemeInfoType;
|
|
42
50
|
registerAppConfig: (conf: AppItemType[]) => void;
|
|
43
51
|
registerFeatrue: (conf: FeatureItemType[]) => void;
|
|
44
52
|
registerBSConfig: (conf: BSConfigType) => void;
|
|
45
53
|
registerPlatformFeature: (conf: FeatureItemType[]) => void;
|
|
46
|
-
registerThemeConfig: (conf:
|
|
54
|
+
registerThemeConfig: (conf: ThemeInfoType) => void;
|
|
47
55
|
|
|
48
56
|
[key: string]: any;
|
|
49
57
|
};
|
package/es/Config/utils.d.ts
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function formartThemeConfig(options:
|
|
3
|
-
[x: string]: any;
|
|
4
|
-
app: {
|
|
5
|
-
[key: string]: import("./interface").AppItemType;
|
|
6
|
-
};
|
|
7
|
-
feature: import("./interface").FeatureItemType[];
|
|
8
|
-
pFeature: import("./interface").FeatureItemType[];
|
|
9
|
-
bs: import("./interface").BSConfigType;
|
|
10
|
-
theme: any;
|
|
11
|
-
registerAppConfig: (conf: import("./interface").AppItemType[]) => void;
|
|
12
|
-
registerFeatrue: (conf: import("./interface").FeatureItemType[]) => void;
|
|
13
|
-
registerBSConfig: (conf: import("./interface").BSConfigType) => void;
|
|
14
|
-
registerPlatformFeature: (conf: import("./interface").FeatureItemType[]) => void;
|
|
15
|
-
registerThemeConfig: (conf: {
|
|
16
|
-
[key: string]: any;
|
|
17
|
-
}) => void;
|
|
18
|
-
};
|
|
1
|
+
import { ThemeInfoType } from './interface';
|
|
2
|
+
export declare function formartThemeConfig(options: ThemeInfoType): ThemeInfoType;
|
package/es/Config/utils.js
CHANGED
|
@@ -24,9 +24,6 @@ export function formartThemeConfig(options) {
|
|
|
24
24
|
var _ref;
|
|
25
25
|
|
|
26
26
|
var tplStr = ':root{<content>}';
|
|
27
|
-
var data = Object.assign({}, options);
|
|
28
|
-
data.vars = {};
|
|
29
|
-
data.style = {};
|
|
30
27
|
|
|
31
28
|
var attrArr = (_ref = []).concat.apply(_ref, _toConsumableArray(Object.values(options.vars)));
|
|
32
29
|
|
|
@@ -44,11 +41,5 @@ export function formartThemeConfig(options) {
|
|
|
44
41
|
document.head.appendChild(style);
|
|
45
42
|
}
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
Object.keys(options.style).forEach(function (k) {
|
|
49
|
-
data.style[k] = options.style[k];
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return data;
|
|
44
|
+
return options;
|
|
54
45
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _nextTick from "@cloud-app-dev/utils/es/nextTick";
|
|
2
|
+
|
|
1
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
4
|
|
|
3
5
|
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."); }
|
|
@@ -40,7 +42,7 @@ function InitialRequest(_ref) {
|
|
|
40
42
|
|
|
41
43
|
var init = function init() {
|
|
42
44
|
return __awaiter(_this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
43
|
-
var _yield$initialization,
|
|
45
|
+
var _yield$initialization, userFeatures, operationInfo, systemFeatures, userInfo;
|
|
44
46
|
|
|
45
47
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
46
48
|
while (1) {
|
|
@@ -51,15 +53,19 @@ function InitialRequest(_ref) {
|
|
|
51
53
|
|
|
52
54
|
case 2:
|
|
53
55
|
_yield$initialization = _context.sent;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
userFeatures = _yield$initialization.userFeatures;
|
|
57
|
+
operationInfo = _yield$initialization.operationInfo;
|
|
58
|
+
systemFeatures = _yield$initialization.systemFeatures;
|
|
57
59
|
userInfo = _yield$initialization.userInfo;
|
|
58
60
|
updateUser(userInfo);
|
|
59
|
-
updateOperation(
|
|
60
|
-
Config.registerFeatrue(
|
|
61
|
-
Config.registerPlatformFeature(
|
|
62
|
-
|
|
61
|
+
updateOperation(operationInfo);
|
|
62
|
+
Config.registerFeatrue(userFeatures);
|
|
63
|
+
Config.registerPlatformFeature(systemFeatures);
|
|
64
|
+
|
|
65
|
+
_nextTick(function () {
|
|
66
|
+
return setIsInit(true);
|
|
67
|
+
});
|
|
68
|
+
|
|
63
69
|
_BASE_DATA_INIT = true;
|
|
64
70
|
|
|
65
71
|
case 13:
|
|
@@ -2,7 +2,7 @@ import { UserInfoType, OperationInfoType } from '../AppContext/interface';
|
|
|
2
2
|
import { FeatureItemType } from '../Config/interface';
|
|
3
3
|
export declare function initialization(): Promise<{
|
|
4
4
|
userInfo: UserInfoType;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
userFeatures: FeatureItemType[];
|
|
6
|
+
systemFeatures: FeatureItemType[];
|
|
7
|
+
operationInfo: OperationInfoType;
|
|
8
8
|
}>;
|
|
@@ -29,8 +29,10 @@ function catchPromise(fn) {
|
|
|
29
29
|
|
|
30
30
|
var method = 'post';
|
|
31
31
|
export function initialization() {
|
|
32
|
+
var _a;
|
|
33
|
+
|
|
32
34
|
return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
33
|
-
var headers, result, userInfo, userId, operationCenterId, data, data2, centerUrl, centerInfo, themeInfo, themeConfig,
|
|
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;
|
|
34
36
|
|
|
35
37
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
36
38
|
while (1) {
|
|
@@ -43,8 +45,7 @@ export function initialization() {
|
|
|
43
45
|
return Service.$http({
|
|
44
46
|
url: '/api/user/v1/getUserByToken',
|
|
45
47
|
method: method,
|
|
46
|
-
headers: headers
|
|
47
|
-
requestId: 'getUserInfo'
|
|
48
|
+
headers: headers
|
|
48
49
|
});
|
|
49
50
|
|
|
50
51
|
case 3:
|
|
@@ -64,50 +65,31 @@ export function initialization() {
|
|
|
64
65
|
data: data2,
|
|
65
66
|
method: method,
|
|
66
67
|
url: centerUrl,
|
|
67
|
-
headers: headers
|
|
68
|
-
requestId: 'operationCenterInfo'
|
|
68
|
+
headers: headers
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
case 12:
|
|
72
72
|
centerInfo = _context.sent;
|
|
73
73
|
_context.next = 15;
|
|
74
74
|
return Service.$http({
|
|
75
|
-
url:
|
|
75
|
+
url: '/api/system/config/type',
|
|
76
|
+
data: {
|
|
77
|
+
type: 'theme',
|
|
78
|
+
systemId: operationCenterId
|
|
79
|
+
}
|
|
76
80
|
});
|
|
77
81
|
|
|
78
82
|
case 15:
|
|
79
83
|
themeInfo = _context.sent;
|
|
80
|
-
themeConfig = themeInfo.data ||
|
|
84
|
+
themeConfig = (_a = themeInfo === null || themeInfo === void 0 ? void 0 : themeInfo.data) === null || _a === void 0 ? void 0 : _a.content;
|
|
81
85
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (!themeId) {
|
|
85
|
-
_context.next = 24;
|
|
86
|
-
break;
|
|
86
|
+
if (themeConfig) {
|
|
87
|
+
Config.registerThemeConfig(themeConfig);
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
themeUrl = "/api/micro/configure/v1/queryConfigureByConfigureId/".concat(themeId);
|
|
90
|
-
_context.next = 22;
|
|
91
|
-
return Service.$http({
|
|
92
|
-
data: data2,
|
|
93
|
-
method: 'get',
|
|
94
|
-
url: themeUrl,
|
|
95
|
-
headers: headers
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
case 22:
|
|
99
|
-
themeRes = _context.sent;
|
|
100
|
-
|
|
101
|
-
try {
|
|
102
|
-
Config.registerThemeConfig(themeRes.data);
|
|
103
|
-
} catch (e) {
|
|
104
|
-
console.error(e);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
case 24:
|
|
108
90
|
userPrivilegesUrl = "/api/user/role/v1/queryUserRoles/".concat(userId);
|
|
109
|
-
|
|
110
|
-
_context.next =
|
|
91
|
+
systemFeatureUrl = "/api/system/".concat(operationCenterId, "/list");
|
|
92
|
+
_context.next = 22;
|
|
111
93
|
return Promise.all([catchPromise(Service.$http({
|
|
112
94
|
data: data,
|
|
113
95
|
method: method,
|
|
@@ -116,29 +98,29 @@ export function initialization() {
|
|
|
116
98
|
})), catchPromise(Service.$http({
|
|
117
99
|
data: data2,
|
|
118
100
|
method: 'get',
|
|
119
|
-
url:
|
|
101
|
+
url: systemFeatureUrl,
|
|
120
102
|
headers: headers
|
|
121
103
|
}))]);
|
|
122
104
|
|
|
123
|
-
case
|
|
105
|
+
case 22:
|
|
124
106
|
_yield$Promise$all = _context.sent;
|
|
125
107
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
126
108
|
_yield$Promise$all2$ = _yield$Promise$all2[0];
|
|
127
|
-
|
|
109
|
+
userFeatures = _yield$Promise$all2$ === void 0 ? {
|
|
128
110
|
data: []
|
|
129
111
|
} : _yield$Promise$all2$;
|
|
130
112
|
_yield$Promise$all2$2 = _yield$Promise$all2[1];
|
|
131
|
-
|
|
113
|
+
systemFeatures = _yield$Promise$all2$2 === void 0 ? {
|
|
132
114
|
data: []
|
|
133
115
|
} : _yield$Promise$all2$2;
|
|
134
116
|
return _context.abrupt("return", {
|
|
135
117
|
userInfo: userInfo,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
118
|
+
userFeatures: userFeatures.data,
|
|
119
|
+
systemFeatures: systemFeatures.data,
|
|
120
|
+
operationInfo: centerInfo.data
|
|
139
121
|
});
|
|
140
122
|
|
|
141
|
-
case
|
|
123
|
+
case 29:
|
|
142
124
|
case "end":
|
|
143
125
|
return _context.stop();
|
|
144
126
|
}
|