@gct-paas/core 0.1.5-dev.2 → 0.1.5-dev.4

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.
@@ -3,39 +3,22 @@ import { SysConfigResponse } from '@gct-paas/api/platform';
3
3
  * 平台配置 Store
4
4
  */
5
5
  export declare const usePlatformConfigStore: import('pinia').StoreDefinition<"platform-config", Pick<{
6
- projectSetting: {};
7
- setProjectConfig: (config: {}) => void;
6
+ basicSetting: import('@gct-paas/api/platform').PlatformBaseConfig;
7
+ setBasicSetting: (data: SysConfigResponse, transfer?: boolean) => void;
8
+ postBasicSetting: () => Promise<string>;
8
9
  deploySetting: {
9
10
  deployMode: import('./enums').DeployModeEnum;
10
11
  };
11
12
  setDeploySetting: (data: SysConfigResponse) => void;
12
13
  isIndependentApp: import('vue').ComputedRef<boolean>;
13
- watermarkSetting: {
14
- openWatermark: boolean;
15
- watermarkContent: string;
16
- fontSize: number;
17
- color: string;
18
- verticalAlign: string;
19
- textAlign: string;
20
- text: string;
21
- transparent: number;
22
- width: number;
23
- height: number;
24
- };
25
- postWatermarkSetting: () => Promise<void>;
26
- setWatermarkSetting: (data: SysConfigResponse) => void;
27
- themeSetting: import('./interfaces').IThemeSetting;
28
- setThemeSetting: (data: SysConfigResponse) => void;
29
- postThemeSetting: () => Promise<void>;
30
- menuCollapsed: import('vue').Ref<boolean, boolean>;
31
- toggleMenuCollapsed: () => void;
32
- menuCollapsedWidth: number;
33
- menuWidthRange: number[];
34
- themeColors: string[];
35
- securitySetting: import('@gct-paas/api/platform').SecurityConfig;
36
- postSecuritySetting: () => Promise<void>;
37
- setSecuritySetting: (data: SysConfigResponse) => void;
38
- getSignWay: () => "LOGIN" | "SIGN" | "DOMAIN";
14
+ loginSetting: import('@gct-paas/api/platform').AuthConfig;
15
+ postLoginSetting: () => Promise<void>;
16
+ setLoginSetting: (config: SysConfigResponse | undefined) => void;
17
+ loginModeAuthTypes: import('vue').Ref<string[], string[]>;
18
+ openIDOAuthAuthTypes: import('vue').Ref<string[], string[]>;
19
+ sysLoginSort: import('vue').Ref<IObject[], IObject[]>;
20
+ openIDOAuthAuthSort: import('vue').Ref<IObject[], IObject[]>;
21
+ loginModeConfig: Map<string, IObject>;
39
22
  orgSetting: import('@gct-paas/api/platform').OrgConfig;
40
23
  setOrgSetting: (data: SysConfigResponse) => void;
41
24
  postOrgSetting: () => Promise<void>;
@@ -62,27 +45,18 @@ export declare const usePlatformConfigStore: import('pinia').StoreDefinition<"pl
62
45
  label: string;
63
46
  value: string;
64
47
  }[]>;
65
- loginSetting: import('@gct-paas/api/platform').AuthConfig;
66
- postLoginSetting: () => Promise<void>;
67
- setLoginSetting: (config: SysConfigResponse | undefined) => void;
68
- loginModeAuthTypes: import('vue').Ref<string[], string[]>;
69
- openIDOAuthAuthTypes: import('vue').Ref<string[], string[]>;
70
- sysLoginSort: import('vue').Ref<IObject[], IObject[]>;
71
- openIDOAuthAuthSort: import('vue').Ref<IObject[], IObject[]>;
72
- loginModeConfig: Map<string, IObject>;
73
- basicSetting: import('@gct-paas/api/platform').PlatformBaseConfig;
74
- setBasicSetting: (data: SysConfigResponse, transfer?: boolean) => void;
75
- postBasicSetting: () => Promise<string>;
76
- init: () => Promise<void>;
77
- renderInit: () => Promise<void>;
78
- }, "projectSetting" | "deploySetting" | "watermarkSetting" | "themeSetting" | "menuCollapsed" | "menuCollapsedWidth" | "menuWidthRange" | "themeColors" | "securitySetting" | "orgSetting" | "relationFields" | "relationFiledsCopy" | "loginSetting" | "loginModeAuthTypes" | "openIDOAuthAuthTypes" | "sysLoginSort" | "openIDOAuthAuthSort" | "loginModeConfig" | "basicSetting">, Pick<{
79
- projectSetting: {};
80
- setProjectConfig: (config: {}) => void;
81
- deploySetting: {
82
- deployMode: import('./enums').DeployModeEnum;
83
- };
84
- setDeploySetting: (data: SysConfigResponse) => void;
85
- isIndependentApp: import('vue').ComputedRef<boolean>;
48
+ securitySetting: import('@gct-paas/api/platform').SecurityConfig;
49
+ postSecuritySetting: () => Promise<void>;
50
+ setSecuritySetting: (data: SysConfigResponse) => void;
51
+ getSignWay: () => "DOMAIN" | "LOGIN" | "SIGN";
52
+ themeSetting: import('./interfaces').IThemeSetting;
53
+ setThemeSetting: (data: SysConfigResponse) => void;
54
+ postThemeSetting: () => Promise<void>;
55
+ menuCollapsed: import('vue').Ref<boolean, boolean>;
56
+ toggleMenuCollapsed: () => void;
57
+ menuCollapsedWidth: number;
58
+ menuWidthRange: number[];
59
+ themeColors: string[];
86
60
  watermarkSetting: {
87
61
  openWatermark: boolean;
88
62
  watermarkContent: string;
@@ -97,18 +71,27 @@ export declare const usePlatformConfigStore: import('pinia').StoreDefinition<"pl
97
71
  };
98
72
  postWatermarkSetting: () => Promise<void>;
99
73
  setWatermarkSetting: (data: SysConfigResponse) => void;
100
- themeSetting: import('./interfaces').IThemeSetting;
101
- setThemeSetting: (data: SysConfigResponse) => void;
102
- postThemeSetting: () => Promise<void>;
103
- menuCollapsed: import('vue').Ref<boolean, boolean>;
104
- toggleMenuCollapsed: () => void;
105
- menuCollapsedWidth: number;
106
- menuWidthRange: number[];
107
- themeColors: string[];
108
- securitySetting: import('@gct-paas/api/platform').SecurityConfig;
109
- postSecuritySetting: () => Promise<void>;
110
- setSecuritySetting: (data: SysConfigResponse) => void;
111
- getSignWay: () => "LOGIN" | "SIGN" | "DOMAIN";
74
+ projectSetting: {};
75
+ setProjectConfig: (config: {}) => void;
76
+ init: () => Promise<void>;
77
+ renderInit: () => Promise<void>;
78
+ }, "basicSetting" | "deploySetting" | "loginModeAuthTypes" | "loginModeConfig" | "loginSetting" | "menuCollapsed" | "menuCollapsedWidth" | "menuWidthRange" | "openIDOAuthAuthSort" | "openIDOAuthAuthTypes" | "orgSetting" | "projectSetting" | "relationFields" | "relationFiledsCopy" | "securitySetting" | "sysLoginSort" | "themeColors" | "themeSetting" | "watermarkSetting">, Pick<{
79
+ basicSetting: import('@gct-paas/api/platform').PlatformBaseConfig;
80
+ setBasicSetting: (data: SysConfigResponse, transfer?: boolean) => void;
81
+ postBasicSetting: () => Promise<string>;
82
+ deploySetting: {
83
+ deployMode: import('./enums').DeployModeEnum;
84
+ };
85
+ setDeploySetting: (data: SysConfigResponse) => void;
86
+ isIndependentApp: import('vue').ComputedRef<boolean>;
87
+ loginSetting: import('@gct-paas/api/platform').AuthConfig;
88
+ postLoginSetting: () => Promise<void>;
89
+ setLoginSetting: (config: SysConfigResponse | undefined) => void;
90
+ loginModeAuthTypes: import('vue').Ref<string[], string[]>;
91
+ openIDOAuthAuthTypes: import('vue').Ref<string[], string[]>;
92
+ sysLoginSort: import('vue').Ref<IObject[], IObject[]>;
93
+ openIDOAuthAuthSort: import('vue').Ref<IObject[], IObject[]>;
94
+ loginModeConfig: Map<string, IObject>;
112
95
  orgSetting: import('@gct-paas/api/platform').OrgConfig;
113
96
  setOrgSetting: (data: SysConfigResponse) => void;
114
97
  postOrgSetting: () => Promise<void>;
@@ -135,27 +118,18 @@ export declare const usePlatformConfigStore: import('pinia').StoreDefinition<"pl
135
118
  label: string;
136
119
  value: string;
137
120
  }[]>;
138
- loginSetting: import('@gct-paas/api/platform').AuthConfig;
139
- postLoginSetting: () => Promise<void>;
140
- setLoginSetting: (config: SysConfigResponse | undefined) => void;
141
- loginModeAuthTypes: import('vue').Ref<string[], string[]>;
142
- openIDOAuthAuthTypes: import('vue').Ref<string[], string[]>;
143
- sysLoginSort: import('vue').Ref<IObject[], IObject[]>;
144
- openIDOAuthAuthSort: import('vue').Ref<IObject[], IObject[]>;
145
- loginModeConfig: Map<string, IObject>;
146
- basicSetting: import('@gct-paas/api/platform').PlatformBaseConfig;
147
- setBasicSetting: (data: SysConfigResponse, transfer?: boolean) => void;
148
- postBasicSetting: () => Promise<string>;
149
- init: () => Promise<void>;
150
- renderInit: () => Promise<void>;
151
- }, "isIndependentApp">, Pick<{
152
- projectSetting: {};
153
- setProjectConfig: (config: {}) => void;
154
- deploySetting: {
155
- deployMode: import('./enums').DeployModeEnum;
156
- };
157
- setDeploySetting: (data: SysConfigResponse) => void;
158
- isIndependentApp: import('vue').ComputedRef<boolean>;
121
+ securitySetting: import('@gct-paas/api/platform').SecurityConfig;
122
+ postSecuritySetting: () => Promise<void>;
123
+ setSecuritySetting: (data: SysConfigResponse) => void;
124
+ getSignWay: () => "DOMAIN" | "LOGIN" | "SIGN";
125
+ themeSetting: import('./interfaces').IThemeSetting;
126
+ setThemeSetting: (data: SysConfigResponse) => void;
127
+ postThemeSetting: () => Promise<void>;
128
+ menuCollapsed: import('vue').Ref<boolean, boolean>;
129
+ toggleMenuCollapsed: () => void;
130
+ menuCollapsedWidth: number;
131
+ menuWidthRange: number[];
132
+ themeColors: string[];
159
133
  watermarkSetting: {
160
134
  openWatermark: boolean;
161
135
  watermarkContent: string;
@@ -170,18 +144,27 @@ export declare const usePlatformConfigStore: import('pinia').StoreDefinition<"pl
170
144
  };
171
145
  postWatermarkSetting: () => Promise<void>;
172
146
  setWatermarkSetting: (data: SysConfigResponse) => void;
173
- themeSetting: import('./interfaces').IThemeSetting;
174
- setThemeSetting: (data: SysConfigResponse) => void;
175
- postThemeSetting: () => Promise<void>;
176
- menuCollapsed: import('vue').Ref<boolean, boolean>;
177
- toggleMenuCollapsed: () => void;
178
- menuCollapsedWidth: number;
179
- menuWidthRange: number[];
180
- themeColors: string[];
181
- securitySetting: import('@gct-paas/api/platform').SecurityConfig;
182
- postSecuritySetting: () => Promise<void>;
183
- setSecuritySetting: (data: SysConfigResponse) => void;
184
- getSignWay: () => "LOGIN" | "SIGN" | "DOMAIN";
147
+ projectSetting: {};
148
+ setProjectConfig: (config: {}) => void;
149
+ init: () => Promise<void>;
150
+ renderInit: () => Promise<void>;
151
+ }, "isIndependentApp">, Pick<{
152
+ basicSetting: import('@gct-paas/api/platform').PlatformBaseConfig;
153
+ setBasicSetting: (data: SysConfigResponse, transfer?: boolean) => void;
154
+ postBasicSetting: () => Promise<string>;
155
+ deploySetting: {
156
+ deployMode: import('./enums').DeployModeEnum;
157
+ };
158
+ setDeploySetting: (data: SysConfigResponse) => void;
159
+ isIndependentApp: import('vue').ComputedRef<boolean>;
160
+ loginSetting: import('@gct-paas/api/platform').AuthConfig;
161
+ postLoginSetting: () => Promise<void>;
162
+ setLoginSetting: (config: SysConfigResponse | undefined) => void;
163
+ loginModeAuthTypes: import('vue').Ref<string[], string[]>;
164
+ openIDOAuthAuthTypes: import('vue').Ref<string[], string[]>;
165
+ sysLoginSort: import('vue').Ref<IObject[], IObject[]>;
166
+ openIDOAuthAuthSort: import('vue').Ref<IObject[], IObject[]>;
167
+ loginModeConfig: Map<string, IObject>;
185
168
  orgSetting: import('@gct-paas/api/platform').OrgConfig;
186
169
  setOrgSetting: (data: SysConfigResponse) => void;
187
170
  postOrgSetting: () => Promise<void>;
@@ -208,18 +191,35 @@ export declare const usePlatformConfigStore: import('pinia').StoreDefinition<"pl
208
191
  label: string;
209
192
  value: string;
210
193
  }[]>;
211
- loginSetting: import('@gct-paas/api/platform').AuthConfig;
212
- postLoginSetting: () => Promise<void>;
213
- setLoginSetting: (config: SysConfigResponse | undefined) => void;
214
- loginModeAuthTypes: import('vue').Ref<string[], string[]>;
215
- openIDOAuthAuthTypes: import('vue').Ref<string[], string[]>;
216
- sysLoginSort: import('vue').Ref<IObject[], IObject[]>;
217
- openIDOAuthAuthSort: import('vue').Ref<IObject[], IObject[]>;
218
- loginModeConfig: Map<string, IObject>;
219
- basicSetting: import('@gct-paas/api/platform').PlatformBaseConfig;
220
- setBasicSetting: (data: SysConfigResponse, transfer?: boolean) => void;
221
- postBasicSetting: () => Promise<string>;
194
+ securitySetting: import('@gct-paas/api/platform').SecurityConfig;
195
+ postSecuritySetting: () => Promise<void>;
196
+ setSecuritySetting: (data: SysConfigResponse) => void;
197
+ getSignWay: () => "DOMAIN" | "LOGIN" | "SIGN";
198
+ themeSetting: import('./interfaces').IThemeSetting;
199
+ setThemeSetting: (data: SysConfigResponse) => void;
200
+ postThemeSetting: () => Promise<void>;
201
+ menuCollapsed: import('vue').Ref<boolean, boolean>;
202
+ toggleMenuCollapsed: () => void;
203
+ menuCollapsedWidth: number;
204
+ menuWidthRange: number[];
205
+ themeColors: string[];
206
+ watermarkSetting: {
207
+ openWatermark: boolean;
208
+ watermarkContent: string;
209
+ fontSize: number;
210
+ color: string;
211
+ verticalAlign: string;
212
+ textAlign: string;
213
+ text: string;
214
+ transparent: number;
215
+ width: number;
216
+ height: number;
217
+ };
218
+ postWatermarkSetting: () => Promise<void>;
219
+ setWatermarkSetting: (data: SysConfigResponse) => void;
220
+ projectSetting: {};
221
+ setProjectConfig: (config: {}) => void;
222
222
  init: () => Promise<void>;
223
223
  renderInit: () => Promise<void>;
224
- }, "setProjectConfig" | "setDeploySetting" | "postWatermarkSetting" | "setWatermarkSetting" | "setThemeSetting" | "postThemeSetting" | "toggleMenuCollapsed" | "postSecuritySetting" | "setSecuritySetting" | "getSignWay" | "setOrgSetting" | "postOrgSetting" | "postLoginSetting" | "setLoginSetting" | "setBasicSetting" | "postBasicSetting" | "init" | "renderInit">>;
224
+ }, "getSignWay" | "init" | "postBasicSetting" | "postLoginSetting" | "postOrgSetting" | "postSecuritySetting" | "postThemeSetting" | "postWatermarkSetting" | "renderInit" | "setBasicSetting" | "setDeploySetting" | "setLoginSetting" | "setOrgSetting" | "setProjectConfig" | "setSecuritySetting" | "setThemeSetting" | "setWatermarkSetting" | "toggleMenuCollapsed">>;
225
225
  export type IPlatformConfigStore = ReturnType<typeof usePlatformConfigStore>;
@@ -8,5 +8,5 @@ export declare function useSecuritySetting(isPlatform?: boolean): {
8
8
  securitySetting: SecurityConfig;
9
9
  postSecuritySetting: () => Promise<void>;
10
10
  setSecuritySetting: (data: SysConfigResponse) => void;
11
- getSignWay: () => "LOGIN" | "SIGN" | "DOMAIN";
11
+ getSignWay: () => "DOMAIN" | "LOGIN" | "SIGN";
12
12
  };
@@ -1,9 +1,7 @@
1
1
  import { UserOfTenantDTO } from '@gct-paas/api/platform';
2
- export declare const useTenantStore: import('pinia').StoreDefinition<"tenant", {
3
- tenantId: string;
4
- tenantUserInfo: {};
5
- tenantUserPermissions: {};
6
- }, {}, {
7
- setTenant(tenantId: string): void;
8
- getTenantUserInfoAction(): Promise<UserOfTenantDTO | undefined>;
9
- }>;
2
+ import { tenantState } from '../types/tenant';
3
+ export declare const useTenantStore: import('pinia').StoreDefinition<"tenant", tenantState, {
4
+ getTenantUserInfoAction(state: {
5
+ tenantUserInfo: Record<string, UserOfTenantDTO>;
6
+ } & import('pinia').PiniaCustomStateProperties<tenantState>): () => Promise<UserOfTenantDTO>;
7
+ }, {}>;
@@ -1,22 +1,20 @@
1
+ import { getTenant } from "../../../utils/tools/tools.mjs";
2
+ import "../../../utils/index.mjs";
1
3
  import { defineStore } from "pinia";
2
4
  //#region src/modules/user-stores/store/tenant.store.ts
3
5
  var useTenantStore = defineStore("tenant", {
4
- state: () => ({
5
- tenantId: "",
6
- tenantUserInfo: {},
7
- tenantUserPermissions: {}
8
- }),
9
- actions: {
10
- setTenant(tenantId) {
11
- this.tenantId = tenantId;
12
- },
13
- async getTenantUserInfoAction() {
14
- if (!this.tenantId) return;
6
+ state: () => ({ tenantUserInfo: {} }),
7
+ getters: { getTenantUserInfoAction(state) {
8
+ return async () => {
9
+ const tenantId = getTenant();
10
+ if (!tenantId) return Promise.reject(null);
11
+ if (state.tenantUserInfo[tenantId]) return state.tenantUserInfo[tenantId];
15
12
  const info = await _api.platform.tenant.getUserInfo();
16
- this.tenantUserInfo = info;
13
+ state.tenantUserInfo[tenantId] = info;
17
14
  return info;
18
- }
19
- }
15
+ };
16
+ } },
17
+ actions: {}
20
18
  });
21
19
  //#endregion
22
20
  export { useTenantStore };
@@ -1 +1,7 @@
1
- export {};
1
+ import { UserOfTenantDTO } from '@gct-paas/api/platform';
2
+ /**
3
+ * 租户信息
4
+ */
5
+ export interface tenantState {
6
+ tenantUserInfo: Record<string, UserOfTenantDTO>;
7
+ }
package/es/setup-app.mjs CHANGED
@@ -17,6 +17,7 @@ async function setupApp(_app) {
17
17
  HttpUtil.use(interceptors);
18
18
  await _gct.init();
19
19
  const token = getToken();
20
+ console.log("setupApp", token);
20
21
  if (token) await useUserStore().getUserInfoAction(token);
21
22
  await usePlatformConfigStore().init();
22
23
  }
@@ -22,6 +22,9 @@ var useGlobalStore = defineStore("global-store", {
22
22
  }
23
23
  },
24
24
  actions: {
25
+ async setContext(ctx = {}) {
26
+ Object.assign(this.context, ctx);
27
+ },
25
28
  async init() {
26
29
  const paramStr = location.pathname.split("/")[2];
27
30
  if (paramStr) {
@@ -15,8 +15,8 @@ export declare function downloadByOnlineUrl(url: string, filename: string, mime?
15
15
  */
16
16
  export declare function downloadByBase64(buf: string, filename: string, mime?: string, bom?: BlobPart): void;
17
17
  export declare function uploaderFiles({ multiple, accept }?: {
18
- multiple?: boolean | undefined;
19
18
  accept?: string | undefined;
19
+ multiple?: boolean | undefined;
20
20
  }): Promise<File[]>;
21
21
  /**
22
22
  * Download according to the background interface file stream
@@ -1,3 +1,3 @@
1
1
  import { UploadTypeEnum } from '../../enums';
2
2
  export declare const sizeParser: (size: number) => string;
3
- export declare const typeParser: (fileName: string) => "attachment" | "img" | UploadTypeEnum.JPG | UploadTypeEnum.JPEG | UploadTypeEnum.PNG | UploadTypeEnum.BMP | UploadTypeEnum.DOCX | UploadTypeEnum.XLSX | UploadTypeEnum.DOC | UploadTypeEnum.MP4 | UploadTypeEnum.AVI | UploadTypeEnum.PPT | UploadTypeEnum.GIF | "MP4" | "PDF" | "ssl";
3
+ export declare const typeParser: (fileName: string) => "MP4" | "PDF" | "attachment" | "img" | "ssl" | UploadTypeEnum.JPG | UploadTypeEnum.JPEG | UploadTypeEnum.PNG | UploadTypeEnum.BMP | UploadTypeEnum.DOCX | UploadTypeEnum.XLSX | UploadTypeEnum.DOC | UploadTypeEnum.MP4 | UploadTypeEnum.AVI | UploadTypeEnum.PPT | UploadTypeEnum.GIF;
@@ -1,6 +1,5 @@
1
1
  import { PluginModeEnum } from '../../enums';
2
- import { IKitInfo } from '../../interface';
3
- import { App } from 'vue';
2
+ import { IPluginKitModule } from '../../interface';
4
3
  /**
5
4
  * 用于加载套件包的工具类
6
5
  *
@@ -8,25 +7,47 @@ import { App } from 'vue';
8
7
  * @class KitPkgUtil
9
8
  */
10
9
  export declare class KitPkgUtil {
11
- protected static readonly KIT_PKG_BASE_PATH = "/kits";
12
- protected static cache: Map<string, IKitInfo>;
10
+ protected static readonly KIT_PKG_BASE_PATH = "/plugin-kit";
13
11
  protected static joinPaths(...paths: string[]): string;
14
12
  /**
15
- * 加载套件包配置
13
+ * 加载套件包,返回套件包入口实例
16
14
  *
17
15
  * @static
18
16
  * @param {string} kit
19
- * @return {*} {(Promise<IKitInfo | undefined>)}
17
+ * @param {PluginModeEnum} mode
18
+ * @return {*} {(Promise<IPluginKitModule | null>)}
20
19
  */
21
- static loadKitPkgInfo(kit: string): Promise<IKitInfo | undefined>;
20
+ static loadKit(kit: string, mode: PluginModeEnum): Promise<IPluginKitModule | null>;
22
21
  /**
23
- * 加载套件包内的插件
22
+ * 加载设计模式套件包
24
23
  *
25
24
  * @static
26
- * @param {App} app
27
- * @param {(string | string[])} kit
28
- * @param {PluginModeEnum} mode
29
- * @return {*} {Promise<void>}
25
+ * @param {string} kit
26
+ * @return {*} {(Promise<IPluginKitModule | null>)}
27
+ */
28
+ static loadDesign(kit: string): Promise<IPluginKitModule | null>;
29
+ /**
30
+ * 加载移动端绘制模式套件包
31
+ *
32
+ * @static
33
+ * @param {string} kit
34
+ * @return {*} {(Promise<IPluginKitModule | null>)}
35
+ */
36
+ static loadMobile(kit: string): Promise<IPluginKitModule | null>;
37
+ /**
38
+ * 加载平板端绘制模式套件包
39
+ *
40
+ * @static
41
+ * @param {string} kit
42
+ * @return {*} {(Promise<IPluginKitModule | null>)}
43
+ */
44
+ static loadPad(kit: string): Promise<IPluginKitModule | null>;
45
+ /**
46
+ * 加载网页端绘制模式套件包
47
+ *
48
+ * @static
49
+ * @param {string} kit
50
+ * @return {*} {(Promise<IPluginKitModule | null>)}
30
51
  */
31
- static loadKits(app: App, kit: string | string[], mode: PluginModeEnum): Promise<void>;
52
+ static loadWeb(kit: string): Promise<IPluginKitModule | null>;
32
53
  }
@@ -1,3 +1,5 @@
1
+ import { PluginModeEnum } from "../../enums/plugin-enum.mjs";
2
+ import "../../enums/index.mjs";
1
3
  //#region src/utils/kit-pkg-util/kit-pkg-util.ts
2
4
  /**
3
5
  * 用于加载套件包的工具类
@@ -6,8 +8,7 @@
6
8
  * @class KitPkgUtil
7
9
  */
8
10
  var KitPkgUtil = class {
9
- static KIT_PKG_BASE_PATH = "/kits";
10
- static cache = /* @__PURE__ */ new Map();
11
+ static KIT_PKG_BASE_PATH = "/plugin-kit";
11
12
  static joinPaths(...paths) {
12
13
  return paths.filter((p) => p && p.length > 0).map((p, index) => {
13
14
  let normalized = p;
@@ -17,56 +18,66 @@ var KitPkgUtil = class {
17
18
  }).join("/");
18
19
  }
19
20
  /**
20
- * 加载套件包配置
21
+ * 加载套件包,返回套件包入口实例
21
22
  *
22
23
  * @static
23
24
  * @param {string} kit
24
- * @return {*} {(Promise<IKitInfo | undefined>)}
25
+ * @param {PluginModeEnum} mode
26
+ * @return {*} {(Promise<IPluginKitModule | null>)}
25
27
  */
26
- static async loadKitPkgInfo(kit) {
27
- if (this.cache.has(kit)) return this.cache.get(kit);
28
+ static async loadKit(kit, mode) {
29
+ const loaderUrl = this.joinPaths(this.KIT_PKG_BASE_PATH, kit, mode, `loader.esm.min.js`);
28
30
  try {
29
- const url = this.joinPaths(this.KIT_PKG_BASE_PATH, kit.toUpperCase(), "kit-info.json");
30
- const response = await fetch(url);
31
- if (!response.ok) throw new Error(`Failed to load kit package from ${url}`);
32
- const config = await response.json();
33
- this.cache.set(kit, config);
34
- return config;
31
+ const module = await import(
32
+ /* @vite-ignore */
33
+ loaderUrl
34
+ );
35
+ if (module && module.default) return module.default;
36
+ else console.warn(`Kit ${kit} does not export a default function`);
35
37
  } catch (error) {
36
- console.error(`Error loading kit package ${kit}:`, error);
38
+ console.error(`Error loading kit ${kit} from ${loaderUrl}:`, error);
37
39
  }
40
+ return null;
38
41
  }
39
42
  /**
40
- * 加载套件包内的插件
43
+ * 加载设计模式套件包
41
44
  *
42
45
  * @static
43
- * @param {App} app
44
- * @param {(string | string[])} kit
45
- * @param {PluginModeEnum} mode
46
- * @return {*} {Promise<void>}
46
+ * @param {string} kit
47
+ * @return {*} {(Promise<IPluginKitModule | null>)}
47
48
  */
48
- static async loadKits(app, kit, mode) {
49
- const kits = Array.isArray(kit) ? kit : [kit];
50
- for (const k of kits) {
51
- if (this.cache.has(k)) {
52
- console.warn(`Kit package ${k} is already loaded, skipping.`);
53
- return;
54
- }
55
- const config = await this.loadKitPkgInfo(k);
56
- if (config) {
57
- const loaderUrl = this.joinPaths(this.KIT_PKG_BASE_PATH, config.kit.toUpperCase(), mode, `loader.esm.min.js?version=${config.version || "0.0.0"}`);
58
- try {
59
- const module = await import(
60
- /* @vite-ignore */
61
- loaderUrl
62
- );
63
- if (module && module.default) app.use(module.default);
64
- else console.warn(`Kit ${config.kit} does not export a default function`);
65
- } catch (error) {
66
- console.error(`Error loading kit ${config.kit} from ${loaderUrl}:`, error);
67
- }
68
- }
69
- }
49
+ static loadDesign(kit) {
50
+ return this.loadKit(kit, PluginModeEnum.DESIGN);
51
+ }
52
+ /**
53
+ * 加载移动端绘制模式套件包
54
+ *
55
+ * @static
56
+ * @param {string} kit
57
+ * @return {*} {(Promise<IPluginKitModule | null>)}
58
+ */
59
+ static loadMobile(kit) {
60
+ return this.loadKit(kit, PluginModeEnum.MOBILE);
61
+ }
62
+ /**
63
+ * 加载平板端绘制模式套件包
64
+ *
65
+ * @static
66
+ * @param {string} kit
67
+ * @return {*} {(Promise<IPluginKitModule | null>)}
68
+ */
69
+ static loadPad(kit) {
70
+ return this.loadKit(kit, PluginModeEnum.PAD);
71
+ }
72
+ /**
73
+ * 加载网页端绘制模式套件包
74
+ *
75
+ * @static
76
+ * @param {string} kit
77
+ * @return {*} {(Promise<IPluginKitModule | null>)}
78
+ */
79
+ static loadWeb(kit) {
80
+ return this.loadKit(kit, PluginModeEnum.WEB);
70
81
  }
71
82
  };
72
83
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { PluginModeEnum, Platform } from '../../enums';
2
2
  import { PluginTenant } from '@gct-paas/api/platform';
3
- export type IModuleMap = Record<string, System.Module>;
3
+ export type IModuleMap = Record<string, IObject>;
4
4
  export type LoadPluginResult = [PluginTenant[], IModuleMap];
5
5
  /**
6
6
  * 插件包处理工具类
@@ -28,7 +28,7 @@ export declare class PluginPgkUtil {
28
28
  *
29
29
  * @static
30
30
  */
31
- static readonly module: Map<string, System.Module>;
31
+ static readonly module: Map<string, IObject>;
32
32
  protected static joinPaths(...paths: string[]): string;
33
33
  /**
34
34
  * 加载插件包配置
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/core",
3
- "version": "0.1.5-dev.2",
3
+ "version": "0.1.5-dev.4",
4
4
  "type": "module",
5
5
  "description": "paas 平台核心包",
6
6
  "loader": "dist/index.esm.min.js",
@@ -30,23 +30,9 @@
30
30
  },
31
31
  "license": "MIT",
32
32
  "author": "gct",
33
- "scripts": {
34
- "dev": "cross-env NODE_ENV=development vite build --watch --config vite.dev.config.ts",
35
- "es:build": "vite build --config vite.dev.config.ts",
36
- "build": "npm run lint && vite build --config vite.dev.config.ts && vite build --config vite.config.ts",
37
- "lint": "eslint src/",
38
- "test": "vitest",
39
- "test:run": "vitest run",
40
- "test:coverage": "vitest run --coverage",
41
- "publish:next": "npm run build && npm publish --access public --tag=next --registry=https://registry.npmjs.org/",
42
- "publish:dev": "npm run build && npm publish --access public --tag=dev --registry=https://registry.npmjs.org/",
43
- "publish:alpha": "npm run build && npm publish --access public --tag=alpha --registry=https://registry.npmjs.org/",
44
- "publish:beta": "npm run build && npm publish --access public --tag=beta --registry=https://registry.npmjs.org/",
45
- "publish:npm": "npm run build && npm publish --access public --registry=https://registry.npmjs.org/"
46
- },
47
33
  "dependencies": {
48
34
  "@fingerprintjs/fingerprintjs": "^5.1.0",
49
- "@gct-paas/api": "^0.1.3",
35
+ "@gct-paas/api": "0.1.4-dev.0",
50
36
  "@module-federation/runtime": "^2.2.3",
51
37
  "@vueuse/core": "^14.1.0",
52
38
  "async-validator": "^4.2.5",
@@ -71,10 +57,23 @@
71
57
  "playwright": "^1.58.0"
72
58
  },
73
59
  "peerDependencies": {
74
- "@gct-paas/api": "^0.1.3",
60
+ "@gct-paas/api": "0.1.4-dev.0",
75
61
  "vue": ">=3",
76
62
  "vue-i18n": ">=11",
77
63
  "vue-router": ">=4"
78
64
  },
79
- "gitHead": "d31b0686f336fec88dca4ed977ae15fd87f185cc"
80
- }
65
+ "scripts": {
66
+ "dev": "cross-env NODE_ENV=development vite build --watch --config vite.dev.config.ts",
67
+ "es:build": "vite build --config vite.dev.config.ts",
68
+ "build": "npm run lint && vue-tsc --noEmit && vite build --config vite.dev.config.ts && vite build --config vite.config.ts",
69
+ "lint": "eslint src/",
70
+ "test": "vitest",
71
+ "test:run": "vitest run",
72
+ "test:coverage": "vitest run --coverage",
73
+ "publish:next": "npm run build && npm publish --access public --tag=next --registry=https://registry.npmjs.org/",
74
+ "publish:dev": "npm run build && npm publish --access public --tag=dev --registry=https://registry.npmjs.org/",
75
+ "publish:alpha": "npm run build && npm publish --access public --tag=alpha --registry=https://registry.npmjs.org/",
76
+ "publish:beta": "npm run build && npm publish --access public --tag=beta --registry=https://registry.npmjs.org/",
77
+ "publish:npm": "npm run build && npm publish --access public --registry=https://registry.npmjs.org/"
78
+ }
79
+ }