@gct-paas/core 0.1.4-dev.11 → 0.1.4-dev.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.
- package/dist/index.esm.min.js +4522 -0
- package/es/constants/core.mjs +5 -4
- package/es/constants/default-date-type/default-date-type.mjs +73 -21
- package/es/constants/editor-register/editor-register.mjs +17 -5
- package/es/constants/expression-type/BuiltOperators.mjs +152 -147
- package/es/constants/expression-type/FunctionKeys.mjs +75 -79
- package/es/constants/expression-type/editor.mjs +10 -3
- package/es/constants/expression-type/function.mjs +602 -613
- package/es/constants/expression-type/index.mjs +111 -113
- package/es/constants/expression-type/modeCfg.mjs +256 -263
- package/es/constants/expression-type/variable.mjs +43 -39
- package/es/constants/form-container-type/form-container-type.mjs +17 -5
- package/es/constants/index.d.ts +1 -0
- package/es/constants/index.mjs +31 -10
- package/es/constants/page-designer/model.mjs +15 -5
- package/es/constants/page-designer/regex.d.ts +2 -0
- package/es/constants/page-designer/regex.mjs +5 -0
- package/es/create-app-vue.mjs +15 -9
- package/es/enums/app-designer/index.d.ts +19 -0
- package/es/enums/app-designer/index.mjs +131 -63
- package/es/enums/appEnum.mjs +681 -360
- package/es/enums/appStateEnum.mjs +17 -10
- package/es/enums/authActionEnum.mjs +63 -51
- package/es/enums/breakpointEnum.mjs +27 -26
- package/es/enums/cacheEnum.mjs +22 -21
- package/es/enums/designEnum.mjs +110 -71
- package/es/enums/developer-center/integration.mjs +7 -6
- package/es/enums/exceptionEnum.mjs +21 -17
- package/es/enums/expressionEnum.d.ts +1 -1
- package/es/enums/expressionEnum.mjs +81 -74
- package/es/enums/globalEnum.mjs +59 -36
- package/es/enums/httpEnum.mjs +71 -61
- package/es/enums/index.mjs +44 -14
- package/es/enums/menuEnum.mjs +42 -38
- package/es/enums/page-designer/designer.mjs +403 -407
- package/es/enums/page-designer/index.d.ts +1 -0
- package/es/enums/page-designer/index.mjs +5 -0
- package/es/enums/page-designer/layout.d.ts +12 -0
- package/es/enums/page-designer/layout.mjs +17 -0
- package/es/enums/page-designer/panel.mjs +341 -213
- package/es/enums/page-designer/toolkit.mjs +13 -12
- package/es/enums/page-designer/widget.mjs +425 -338
- package/es/enums/pageEnum.mjs +14 -13
- package/es/enums/plugin-enum.mjs +23 -7
- package/es/enums/processEnum.mjs +95 -60
- package/es/enums/roleEnum.mjs +7 -6
- package/es/enums/sizeEnum.d.ts +18 -0
- package/es/enums/sizeEnum.mjs +28 -8
- package/es/global/gct/gct.mjs +84 -96
- package/es/global/index.mjs +1 -0
- package/es/hooks/index.mjs +4 -0
- package/es/hooks/use-app-inst/use-app-inst.mjs +11 -5
- package/es/hooks/use-modal/use-modal.mjs +16 -10
- package/es/hooks/use-sub-app-utils/use-sub-app-utils.mjs +43 -23
- package/es/hooks/useCopyToClipboard.mjs +50 -50
- package/es/index.mjs +125 -114
- package/es/interface/i-pinia-state/i-global-state.d.ts +0 -11
- package/es/locale/index.mjs +50 -57
- package/es/modules/env-manager/env-manager.const.mjs +16 -8
- package/es/modules/env-manager/env-manager.d.ts +2 -0
- package/es/modules/env-manager/env-manager.interface.d.ts +2 -0
- package/es/modules/env-manager/env-manager.interface.mjs +14 -7
- package/es/modules/env-manager/env-manager.mjs +108 -107
- package/es/modules/error-handler/error-handler.const.mjs +11 -16
- package/es/modules/error-handler/error-strategy.mjs +199 -175
- package/es/modules/error-handler/index.mjs +120 -106
- package/es/modules/mqtt/constants/mqtt.const.mjs +21 -24
- package/es/modules/mqtt/enums/mqtt-status.enum.mjs +23 -9
- package/es/modules/mqtt/index.mjs +4 -0
- package/es/modules/mqtt/mqtt-client.mjs +228 -261
- package/es/modules/mqtt/mqtt-manager.mjs +117 -77
- package/es/modules/platform-config/constants/index.mjs +4 -0
- package/es/modules/platform-config/constants/login.const.mjs +48 -45
- package/es/modules/platform-config/constants/org.const.mjs +57 -52
- package/es/modules/platform-config/constants/theme.const.mjs +11 -4
- package/es/modules/platform-config/constants/watermark.const.mjs +17 -12
- package/es/modules/platform-config/enums/deploy.enum.mjs +13 -6
- package/es/modules/platform-config/enums/login.enum.mjs +29 -15
- package/es/modules/platform-config/enums/platform.enum.mjs +16 -13
- package/es/modules/platform-config/index.mjs +9 -0
- package/es/modules/platform-config/store.mjs +68 -79
- package/es/modules/platform-config/useBasicSetting.mjs +47 -35
- package/es/modules/platform-config/useDeploySetting.mjs +29 -21
- package/es/modules/platform-config/useLoginSetting.mjs +151 -173
- package/es/modules/platform-config/useOrgSetting.mjs +63 -62
- package/es/modules/platform-config/useProjectSetting.mjs +14 -6
- package/es/modules/platform-config/useSecuritySetting.mjs +68 -56
- package/es/modules/platform-config/useThemeSetting.mjs +78 -59
- package/es/modules/platform-config/useWatermarkSetting.mjs +37 -23
- package/es/modules/user-stores/index.mjs +3 -0
- package/es/modules/user-stores/store/permission.store.mjs +27 -36
- package/es/modules/user-stores/store/tenant.store.mjs +20 -22
- package/es/modules/user-stores/store/user.store.mjs +94 -117
- package/es/router/index.mjs +25 -28
- package/es/setup-app.mjs +23 -39
- package/es/state/global-pinia-state/global-pinia-state.d.ts +0 -6
- package/es/state/global-pinia-state/global-pinia-state.mjs +43 -71
- package/es/state/index.mjs +1 -0
- package/es/store/global-store.mjs +50 -72
- package/es/store/index.mjs +25 -19
- package/es/types/index.d.ts +7 -0
- package/es/utils/axios/interceptors.mjs +21 -17
- package/es/utils/cache-adapter/cache-adapter.mjs +61 -56
- package/es/utils/css-loader/css-loader.d.ts +36 -0
- package/es/utils/css-loader/css-loader.mjs +82 -0
- package/es/utils/design/design.mjs +18 -12
- package/es/utils/deviceFingerprint.mjs +77 -63
- package/es/utils/dictionary/dictionary.mjs +142 -145
- package/es/utils/file/base64Conver.mjs +35 -30
- package/es/utils/file/download.mjs +94 -98
- package/es/utils/file/parser.d.ts +3 -0
- package/es/utils/file/parser.mjs +29 -0
- package/es/utils/i18n/index.mjs +14 -3
- package/es/utils/index.d.ts +3 -1
- package/es/utils/index.mjs +32 -0
- package/es/utils/is-sort-filed/is-sort-filed.mjs +42 -37
- package/es/utils/linked-list/linked-list.mjs +115 -118
- package/es/utils/linked-node/linked-node.mjs +41 -31
- package/es/utils/lowcode/utils.mjs +13 -18
- package/es/utils/lowcode/validate.mjs +20 -26
- package/es/utils/mitt/mitt.mjs +4 -4
- package/es/utils/model-loader/model-loader.mjs +280 -325
- package/es/utils/namespace/namespace.mjs +178 -164
- package/es/utils/openUtil/index.mjs +2 -0
- package/es/utils/openUtil/modal/modal.mjs +72 -79
- package/es/utils/openUtil/overlay-container/overlay-container.mjs +144 -138
- package/es/utils/permission.mjs +33 -37
- package/es/utils/plugin-static-resource/plugin-static-resource.mjs +46 -42
- package/es/utils/style/index.mjs +94 -138
- package/es/utils/tools/tools.mjs +86 -54
- package/es/utils/treeHelper/treeHelper.mjs +205 -233
- package/es/utils/uploader/uploader.mjs +81 -115
- package/es/utils/useUUid.mjs +79 -87
- package/es/utils/util.mjs +55 -35
- package/es/utils/uuid/uuid.d.ts +2 -0
- package/es/utils/uuid/uuid.mjs +33 -43
- package/es/utils/validate.mjs +15 -19
- package/es/utils/value-helper/value-helper.mjs +113 -98
- package/package.json +9 -18
- package/dist/index.esm.min.mjs +0 -18322
- package/dist/index.min.cjs +0 -393
- package/dist/index.system.min.js +0 -393
|
@@ -1,123 +1,100 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
{}
|
|
67
|
-
);
|
|
68
|
-
return info;
|
|
69
|
-
},
|
|
70
|
-
/**单应用登录 */
|
|
71
|
-
async afterLoginSingleApp() {
|
|
72
|
-
},
|
|
73
|
-
/**登录后逻辑 */
|
|
74
|
-
async afterLoginAction() {
|
|
75
|
-
if (!getToken) return null;
|
|
76
|
-
},
|
|
77
|
-
async logout() {
|
|
78
|
-
await doLogout();
|
|
79
|
-
},
|
|
80
|
-
async setUserInfo(info) {
|
|
81
|
-
this.userInfo = {
|
|
82
|
-
...info,
|
|
83
|
-
minioDomain: "/minio"
|
|
84
|
-
};
|
|
85
|
-
this.lastUpdateTime = (/* @__PURE__ */ new Date()).getTime();
|
|
86
|
-
_gct.store.userInfo = this.userInfo;
|
|
87
|
-
},
|
|
88
|
-
async updateUserInfo(data) {
|
|
89
|
-
const info = { ...this.userInfo, ...data };
|
|
90
|
-
this.setUserInfo(info);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
1
|
+
import { getToken, setToken } from "../../../utils/tools/tools.mjs";
|
|
2
|
+
import { getDeviceFingerprint, getPageIdentification } from "../../../utils/deviceFingerprint.mjs";
|
|
3
|
+
import "../../../utils/index.mjs";
|
|
4
|
+
import { defineStore } from "pinia";
|
|
5
|
+
//#region src/modules/user-stores/store/user.store.ts
|
|
6
|
+
var useUserStore = defineStore("user", {
|
|
7
|
+
state: () => ({
|
|
8
|
+
userInfo: {},
|
|
9
|
+
roleList: [],
|
|
10
|
+
sessionTimeout: false,
|
|
11
|
+
lastUpdateTime: 0,
|
|
12
|
+
userPermissions: {}
|
|
13
|
+
}),
|
|
14
|
+
getters: {
|
|
15
|
+
getUserInfo(state) {
|
|
16
|
+
return state.userInfo;
|
|
17
|
+
},
|
|
18
|
+
getUserPermissions(state) {
|
|
19
|
+
return state.userPermissions;
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
actions: {
|
|
23
|
+
async login(config, { hasError } = {}) {
|
|
24
|
+
try {
|
|
25
|
+
const { token, signWay } = await loginApi(config, hasError);
|
|
26
|
+
sessionStorage.setItem("signWay", signWay);
|
|
27
|
+
setToken(token);
|
|
28
|
+
return this.afterLoginAction();
|
|
29
|
+
} catch (error) {
|
|
30
|
+
return Promise.reject(error);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
async getUserInfoAction(Token) {
|
|
34
|
+
if (!getToken && !Token) return null;
|
|
35
|
+
const info = await _api.platform.user.getInfo({ headers: { Token } });
|
|
36
|
+
this.setUserInfo(info);
|
|
37
|
+
this.userPermissions = (info?.platformManagerPermissions ?? []).reduce((map, item) => {
|
|
38
|
+
map[item] = true;
|
|
39
|
+
return map;
|
|
40
|
+
}, {});
|
|
41
|
+
return info;
|
|
42
|
+
},
|
|
43
|
+
async afterLoginSingleApp() {},
|
|
44
|
+
async afterLoginAction() {
|
|
45
|
+
if (!getToken) return null;
|
|
46
|
+
},
|
|
47
|
+
async logout() {
|
|
48
|
+
await doLogout();
|
|
49
|
+
},
|
|
50
|
+
async setUserInfo(info) {
|
|
51
|
+
this.userInfo = {
|
|
52
|
+
...info,
|
|
53
|
+
minioDomain: "/minio"
|
|
54
|
+
};
|
|
55
|
+
this.lastUpdateTime = (/* @__PURE__ */ new Date()).getTime();
|
|
56
|
+
_gct.store.userInfo = this.userInfo;
|
|
57
|
+
},
|
|
58
|
+
async updateUserInfo(data) {
|
|
59
|
+
const info = {
|
|
60
|
+
...this.userInfo,
|
|
61
|
+
...data
|
|
62
|
+
};
|
|
63
|
+
this.setUserInfo(info);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
93
66
|
});
|
|
67
|
+
/**
|
|
68
|
+
* 登录
|
|
69
|
+
* @param params
|
|
70
|
+
* @param param1
|
|
71
|
+
* @returns
|
|
72
|
+
*/
|
|
94
73
|
async function loginApi(params, { hasError = true } = {}) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
return data;
|
|
74
|
+
const fingerprint = await getDeviceFingerprint();
|
|
75
|
+
return await _api.platform.login.postSign(params, { headers: {
|
|
76
|
+
browser: fingerprint,
|
|
77
|
+
"Auth-Code": params.authCode,
|
|
78
|
+
hasError
|
|
79
|
+
} });
|
|
104
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* 登出
|
|
83
|
+
*/
|
|
105
84
|
async function doLogout() {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
});
|
|
85
|
+
const session = sessionStorage.getItem("currentPlatOrAppId");
|
|
86
|
+
const env = _gct.env.getEnv();
|
|
87
|
+
const fingerprint = await getDeviceFingerprint();
|
|
88
|
+
const params = {
|
|
89
|
+
appId: session && JSON.parse(session).appId,
|
|
90
|
+
platform: session && JSON.parse(session).type,
|
|
91
|
+
env
|
|
92
|
+
};
|
|
93
|
+
const pageIdentification = getPageIdentification();
|
|
94
|
+
await _api.platform.login.getSignOut(params, { headers: {
|
|
95
|
+
browser: fingerprint,
|
|
96
|
+
pagetag: pageIdentification
|
|
97
|
+
} });
|
|
121
98
|
}
|
|
122
|
-
|
|
99
|
+
//#endregion
|
|
123
100
|
export { useUserStore };
|
package/es/router/index.mjs
CHANGED
|
@@ -1,31 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
await this.router.replace(this.router.currentRoute.value.fullPath);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
1
|
+
import "vue";
|
|
2
|
+
import { createRouter, createWebHashHistory } from "vue-router";
|
|
3
|
+
//#region src/router/index.ts
|
|
4
|
+
var routes = [];
|
|
5
|
+
var RouterUtil = class {
|
|
6
|
+
router;
|
|
7
|
+
constructor() {
|
|
8
|
+
this.router = createRouter({
|
|
9
|
+
history: createWebHashHistory(),
|
|
10
|
+
routes
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 添加路由
|
|
15
|
+
* @param route 添加路由记录
|
|
16
|
+
* @description 将单个或多个路由记录添加到路由器中
|
|
17
|
+
*/
|
|
18
|
+
async add(route) {
|
|
19
|
+
if (Array.isArray(route)) route.forEach((r) => this.add(r));
|
|
20
|
+
else this.router.addRoute(route);
|
|
21
|
+
await this.router.replace(this.router.currentRoute.value.fullPath);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
27
24
|
function setupRouter(app) {
|
|
28
|
-
|
|
25
|
+
app.use(_gct.router);
|
|
29
26
|
}
|
|
30
|
-
|
|
27
|
+
//#endregion
|
|
31
28
|
export { RouterUtil, setupRouter };
|
package/es/setup-app.mjs
CHANGED
|
@@ -1,42 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import './utils/uuid/uuid.mjs';
|
|
18
|
-
import { interceptors } from './utils/axios/interceptors.mjs';
|
|
19
|
-
import '@fingerprintjs/fingerprintjs';
|
|
20
|
-
import './utils/useUUid.mjs';
|
|
21
|
-
import 'dayjs';
|
|
22
|
-
import './utils/permission.mjs';
|
|
23
|
-
import './modules/platform-config/constants/login.const.mjs';
|
|
24
|
-
import { usePlatformConfigStore } from './modules/platform-config/store.mjs';
|
|
25
|
-
import { useUserStore } from './modules/user-stores/store/user.store.mjs';
|
|
26
|
-
import './modules/user-stores/store/tenant.store.mjs';
|
|
27
|
-
import './modules/user-stores/store/permission.store.mjs';
|
|
28
|
-
|
|
1
|
+
import { getToken } from "./utils/tools/tools.mjs";
|
|
2
|
+
import { interceptors } from "./utils/axios/interceptors.mjs";
|
|
3
|
+
import "./utils/index.mjs";
|
|
4
|
+
import { setupErrorHandler } from "./modules/error-handler/index.mjs";
|
|
5
|
+
import { usePlatformConfigStore } from "./modules/platform-config/store.mjs";
|
|
6
|
+
import "./modules/platform-config/index.mjs";
|
|
7
|
+
import { useUserStore } from "./modules/user-stores/store/user.store.mjs";
|
|
8
|
+
import "./modules/user-stores/index.mjs";
|
|
9
|
+
import { HttpUtil } from "@gct-paas/api";
|
|
10
|
+
//#region src/setup-app.ts
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @param {App} app
|
|
16
|
+
*/
|
|
29
17
|
async function setupApp(app) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
await userStore.getUserInfoAction(token);
|
|
37
|
-
}
|
|
38
|
-
const platformStore = usePlatformConfigStore();
|
|
39
|
-
await platformStore.init();
|
|
18
|
+
await setupErrorHandler(app);
|
|
19
|
+
HttpUtil.use(interceptors);
|
|
20
|
+
await _gct.init();
|
|
21
|
+
const token = getToken();
|
|
22
|
+
if (token) await useUserStore().getUserInfoAction(token);
|
|
23
|
+
await usePlatformConfigStore().init();
|
|
40
24
|
}
|
|
41
|
-
|
|
25
|
+
//#endregion
|
|
42
26
|
export { setupApp };
|
|
@@ -1,72 +1,44 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Platform } from
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
// */
|
|
45
|
-
// tenantId: string = '';
|
|
46
|
-
/**
|
|
47
|
-
* 多语言
|
|
48
|
-
*
|
|
49
|
-
* @type {string}
|
|
50
|
-
*/
|
|
51
|
-
lang = "zh-CN";
|
|
52
|
-
/**
|
|
53
|
-
* 应用信息, todo: 等 api 包完成后,实际类型从 api 导入
|
|
54
|
-
*
|
|
55
|
-
* @type {IObject}
|
|
56
|
-
*/
|
|
57
|
-
// appInfo: IObject = {};
|
|
58
|
-
// /**
|
|
59
|
-
// * 用户信息
|
|
60
|
-
// *
|
|
61
|
-
// * @type {IObject}
|
|
62
|
-
// */
|
|
63
|
-
// userInfo: IObject = {};
|
|
64
|
-
/**
|
|
65
|
-
* 用户信息
|
|
66
|
-
*
|
|
67
|
-
* @type {IObject}
|
|
68
|
-
*/
|
|
69
|
-
// tenantUserInfo: IObject = {};
|
|
70
|
-
}
|
|
71
|
-
|
|
1
|
+
import { ProjectName } from "../../enums/appEnum.mjs";
|
|
2
|
+
import { Platform } from "../../enums/page-designer/widget.mjs";
|
|
3
|
+
import "../../enums/index.mjs";
|
|
4
|
+
//#region src/state/global-pinia-state/global-pinia-state.ts
|
|
5
|
+
/**
|
|
6
|
+
* 全局pinia状态
|
|
7
|
+
*
|
|
8
|
+
* @export
|
|
9
|
+
* @class GlobalPiniaState
|
|
10
|
+
* @implements {IGlobalState}
|
|
11
|
+
*/
|
|
12
|
+
var GlobalPiniaState = class {
|
|
13
|
+
context = {
|
|
14
|
+
aid: "",
|
|
15
|
+
bid: "",
|
|
16
|
+
pid: "",
|
|
17
|
+
platform: Platform.WEB
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
*运行时全局函数
|
|
21
|
+
* @type {'--'}
|
|
22
|
+
*/
|
|
23
|
+
globalSetting = { emptyDisplay: "--" };
|
|
24
|
+
/**
|
|
25
|
+
* 应用信息
|
|
26
|
+
*
|
|
27
|
+
* @type {IObject}
|
|
28
|
+
*/
|
|
29
|
+
appInfo = {};
|
|
30
|
+
/**
|
|
31
|
+
* 用户信息
|
|
32
|
+
*
|
|
33
|
+
* @type {IObject}
|
|
34
|
+
*/
|
|
35
|
+
userInfo = {};
|
|
36
|
+
/**
|
|
37
|
+
* 当前访问项目名称
|
|
38
|
+
*
|
|
39
|
+
* @type {ProjectName}
|
|
40
|
+
*/
|
|
41
|
+
projectName = ProjectName.PORTAL;
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
72
44
|
export { GlobalPiniaState };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./global-pinia-state/global-pinia-state.mjs";
|
|
@@ -1,74 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
async loadAppInfo() {
|
|
54
|
-
const res = await _api.apaas.designerCommon.getGetApp();
|
|
55
|
-
this.appInfo = res;
|
|
56
|
-
},
|
|
57
|
-
/**加載运行时全局常量显示 */
|
|
58
|
-
async loadEmptySetting() {
|
|
59
|
-
const { value } = await _gct.api.apaas.basicConfig.getDetail({
|
|
60
|
-
configEnum: PlatformSettingEnum.GLOBAL
|
|
61
|
-
});
|
|
62
|
-
if (!value) return;
|
|
63
|
-
Object.assign(this.globalSetting, JSON.parse(value));
|
|
64
|
-
},
|
|
65
|
-
setProjectName(name) {
|
|
66
|
-
this.projectName = name;
|
|
67
|
-
},
|
|
68
|
-
setLang(lang) {
|
|
69
|
-
this.lang = lang;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
1
|
+
import { PlatformSettingEnum, nullDisplayEnum } from "../enums/globalEnum.mjs";
|
|
2
|
+
import "../enums/index.mjs";
|
|
3
|
+
import { GlobalPiniaState } from "../state/global-pinia-state/global-pinia-state.mjs";
|
|
4
|
+
import "../state/index.mjs";
|
|
5
|
+
import { parseMatrixParams } from "../utils/tools/tools.mjs";
|
|
6
|
+
import "../utils/index.mjs";
|
|
7
|
+
import { defineStore } from "pinia";
|
|
8
|
+
//#region src/store/global-store.ts
|
|
9
|
+
var useGlobalStore = defineStore("global-store", {
|
|
10
|
+
state() {
|
|
11
|
+
return new GlobalPiniaState();
|
|
12
|
+
},
|
|
13
|
+
getters: {
|
|
14
|
+
getProjectName() {
|
|
15
|
+
return this.projectName;
|
|
16
|
+
},
|
|
17
|
+
geLang() {
|
|
18
|
+
return this.lang;
|
|
19
|
+
},
|
|
20
|
+
getAppInfo() {
|
|
21
|
+
return this.appInfo;
|
|
22
|
+
},
|
|
23
|
+
getEmptyDisplay() {
|
|
24
|
+
return nullDisplayEnum[this.globalSetting.emptyDisplay];
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
actions: {
|
|
28
|
+
async init() {
|
|
29
|
+
const paramStr = location.pathname.split("/")[2];
|
|
30
|
+
if (paramStr) {
|
|
31
|
+
const params = parseMatrixParams(paramStr);
|
|
32
|
+
if (params) this.context = params;
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
async loadAppInfo() {
|
|
36
|
+
this.appInfo = await _api.apaas.designerCommon.getGetApp();
|
|
37
|
+
},
|
|
38
|
+
async loadEmptySetting() {
|
|
39
|
+
const { value } = await _gct.api.apaas.basicConfig.getDetail({ configEnum: PlatformSettingEnum.GLOBAL });
|
|
40
|
+
if (!value) return;
|
|
41
|
+
Object.assign(this.globalSetting, JSON.parse(value));
|
|
42
|
+
},
|
|
43
|
+
setProjectName(name) {
|
|
44
|
+
this.projectName = name;
|
|
45
|
+
},
|
|
46
|
+
setLang(lang) {
|
|
47
|
+
this.lang = lang;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
72
50
|
});
|
|
73
|
-
|
|
51
|
+
//#endregion
|
|
74
52
|
export { useGlobalStore };
|
package/es/store/index.mjs
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { useGlobalStore } from "./global-store.mjs";
|
|
2
|
+
import { createPinia, setActivePinia } from "pinia";
|
|
3
|
+
//#region src/store/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* 全局的状态管理工具类
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @class GlobalStore
|
|
9
|
+
*/
|
|
10
|
+
var GlobalStoreUtil = class {
|
|
11
|
+
/**
|
|
12
|
+
* 全局唯一实例
|
|
13
|
+
*/
|
|
14
|
+
pinia = createPinia();
|
|
15
|
+
/**
|
|
16
|
+
* 全局状态管理实例
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
store;
|
|
20
|
+
constructor() {
|
|
21
|
+
setActivePinia(this.pinia);
|
|
22
|
+
this.store = useGlobalStore();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
20
26
|
export { GlobalStoreUtil };
|
package/es/types/index.d.ts
CHANGED
|
@@ -60,6 +60,13 @@ declare global {
|
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
type PartialByKeys<T, K extends keyof T> = {
|
|
64
|
+
[P in K]?: T[P];
|
|
65
|
+
} & Pick<T, Exclude<keyof T, K>>;
|
|
66
|
+
type RequiredByKeys<T, K extends keyof T> = {
|
|
67
|
+
[P in K]: T[P];
|
|
68
|
+
} & Pick<T, Exclude<keyof T, K>>;
|
|
69
|
+
|
|
63
70
|
/**
|
|
64
71
|
* 任意参数对象
|
|
65
72
|
*
|