@gct-paas/core 0.0.1-dev.27 → 0.0.1-dev.29
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.min.cjs +1 -1
- package/dist/index.system.min.js +1 -1
- package/es/register/designer-register/designer-register.d.ts +2 -2
- package/es/register/designer-register/designer-register.mjs +2 -2
- package/es/utils/plugin-pkg-util/plugin-pkg-util.d.ts +17 -6
- package/es/utils/plugin-pkg-util/plugin-pkg-util.mjs +52 -35
- package/package.json +4 -4
|
@@ -15,8 +15,8 @@ export declare class DesignerRegister {
|
|
|
15
15
|
protected map: Map<string, () => IDesignerProvider>;
|
|
16
16
|
private providers;
|
|
17
17
|
readonly hooks: {
|
|
18
|
-
register: SyncSeriesHook<IDesignerProvider, null>;
|
|
19
|
-
unregister: SyncSeriesHook<IDesignerProvider, null>;
|
|
18
|
+
register: SyncSeriesHook<[string, IDesignerProvider], null>;
|
|
19
|
+
unregister: SyncSeriesHook<[string, IDesignerProvider], null>;
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
22
|
* 设计器项适配器注册
|
|
@@ -24,7 +24,7 @@ class DesignerRegister {
|
|
|
24
24
|
this.map.set(tag, provider);
|
|
25
25
|
const instance = provider();
|
|
26
26
|
this.providers.set(tag, instance);
|
|
27
|
-
this.hooks.register.callSync(null, instance);
|
|
27
|
+
this.hooks.register.callSync(null, tag, instance);
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* 设计器项适配器注销
|
|
@@ -35,7 +35,7 @@ class DesignerRegister {
|
|
|
35
35
|
this.map.delete(tag);
|
|
36
36
|
const instance = this.providers.get(tag);
|
|
37
37
|
if (instance) {
|
|
38
|
-
this.hooks.unregister.callSync(null, instance);
|
|
38
|
+
this.hooks.unregister.callSync(null, tag, instance);
|
|
39
39
|
this.providers.delete(tag);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -67,19 +67,30 @@ export declare class PluginPgkUtil {
|
|
|
67
67
|
*/
|
|
68
68
|
static loadDesignPlugin(_app: App, platform: Platform, kit?: string[]): Promise<LoadPluginResult>;
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
70
|
+
* 加载设计态中,已经被从配置中移除的插件
|
|
71
|
+
*
|
|
72
|
+
* @static
|
|
73
|
+
* @param {Platform} platform
|
|
74
|
+
* @param {IObject[]} configs
|
|
75
|
+
* @returns {*} {Promise<void>}
|
|
76
|
+
*/
|
|
77
|
+
static loadDesignDeletedPlugins(platform: Platform, configs?: IObject[]): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* 加载设计态移动端插件包
|
|
71
80
|
*
|
|
72
81
|
* @static
|
|
73
82
|
* @param {App} app
|
|
74
|
-
* @
|
|
83
|
+
* @param {IObject[]} configs 界面用到的插件集合
|
|
84
|
+
* @returns {*} {Promise<void>}
|
|
75
85
|
*/
|
|
76
|
-
static loadMobilePlugin(
|
|
86
|
+
static loadMobilePlugin(configs?: IObject[]): Promise<void>;
|
|
77
87
|
/**
|
|
78
|
-
*
|
|
88
|
+
* 加载设计态网页端插件包
|
|
79
89
|
*
|
|
80
90
|
* @static
|
|
81
91
|
* @param {App} app
|
|
82
|
-
* @
|
|
92
|
+
* @param {IObject[]} configs 界面用到的插件集合
|
|
93
|
+
* @returns {*} {Promise<void>}
|
|
83
94
|
*/
|
|
84
|
-
static loadWebPlugin(
|
|
95
|
+
static loadWebPlugin(configs?: IObject[]): Promise<void>;
|
|
85
96
|
}
|
|
@@ -60,17 +60,17 @@ class PluginPgkUtil {
|
|
|
60
60
|
* @param {IStyleIMportMap[]} plugins
|
|
61
61
|
* @returns {*} {Promise<System.Module[]>}
|
|
62
62
|
*/
|
|
63
|
-
static async loadPlugins(mode, configs) {
|
|
63
|
+
static async loadPlugins(mode, configs = []) {
|
|
64
64
|
const moduleMap = {};
|
|
65
65
|
if (configs.length > 0) {
|
|
66
66
|
const plugins = configs.map((plugin) => {
|
|
67
67
|
const baseUrl = path.join(PLUGIN_BASE_URL, plugin.url, "dist");
|
|
68
68
|
return {
|
|
69
69
|
imports: {
|
|
70
|
-
[plugin.key]: `${baseUrl}/${mode}.system.min.js`
|
|
70
|
+
[plugin.key]: `${baseUrl}/${mode}.system.min.js?version=${plugin.version}`
|
|
71
71
|
},
|
|
72
72
|
styles: {
|
|
73
|
-
[plugin.key]: `${baseUrl}/${mode}.min.css`
|
|
73
|
+
[plugin.key]: `${baseUrl}/${mode}.min.css?version=${plugin.version}`
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
});
|
|
@@ -162,58 +162,75 @@ class PluginPgkUtil {
|
|
|
162
162
|
return [[], {}];
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
165
|
-
*
|
|
165
|
+
* 加载设计态中,已经被从配置中移除的插件
|
|
166
|
+
*
|
|
167
|
+
* @static
|
|
168
|
+
* @param {Platform} platform
|
|
169
|
+
* @param {IObject[]} configs
|
|
170
|
+
* @returns {*} {Promise<void>}
|
|
171
|
+
*/
|
|
172
|
+
static async loadDesignDeletedPlugins(platform, configs = []) {
|
|
173
|
+
try {
|
|
174
|
+
const moduleMap = await this.loadPlugins(PluginModeEnum.DESIGN, configs);
|
|
175
|
+
configs.forEach((plugin) => {
|
|
176
|
+
const module = moduleMap[plugin.key];
|
|
177
|
+
if (platform === Platform.WEB) {
|
|
178
|
+
_gct.register.designer.web.register(
|
|
179
|
+
plugin.key,
|
|
180
|
+
() => new module.default()
|
|
181
|
+
);
|
|
182
|
+
} else {
|
|
183
|
+
_gct.register.designer.mobile.register(
|
|
184
|
+
plugin.key,
|
|
185
|
+
() => new module.default()
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
} catch (error) {
|
|
190
|
+
console.error(error);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* 加载设计态移动端插件包
|
|
166
195
|
*
|
|
167
196
|
* @static
|
|
168
197
|
* @param {App} app
|
|
169
|
-
* @
|
|
198
|
+
* @param {IObject[]} configs 界面用到的插件集合
|
|
199
|
+
* @returns {*} {Promise<void>}
|
|
170
200
|
*/
|
|
171
|
-
static async loadMobilePlugin(
|
|
201
|
+
static async loadMobilePlugin(configs = []) {
|
|
172
202
|
try {
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
configs.forEach((config) => {
|
|
180
|
-
const plugins = config.plugins;
|
|
181
|
-
plugins.forEach((plugin) => {
|
|
182
|
-
app.use(moduleMap[plugin.key].default);
|
|
183
|
-
});
|
|
203
|
+
const moduleMap = await this.loadPlugins(PluginModeEnum.MOBILE, configs);
|
|
204
|
+
configs.forEach((plugin) => {
|
|
205
|
+
_gct.register.render.mobile.register(
|
|
206
|
+
plugin.key,
|
|
207
|
+
moduleMap[plugin.key].default
|
|
208
|
+
);
|
|
184
209
|
});
|
|
185
|
-
return result;
|
|
186
210
|
} catch (error) {
|
|
187
211
|
console.error(error);
|
|
188
212
|
}
|
|
189
|
-
return [[], {}];
|
|
190
213
|
}
|
|
191
214
|
/**
|
|
192
|
-
*
|
|
215
|
+
* 加载设计态网页端插件包
|
|
193
216
|
*
|
|
194
217
|
* @static
|
|
195
218
|
* @param {App} app
|
|
196
|
-
* @
|
|
219
|
+
* @param {IObject[]} configs 界面用到的插件集合
|
|
220
|
+
* @returns {*} {Promise<void>}
|
|
197
221
|
*/
|
|
198
|
-
static async loadWebPlugin(
|
|
222
|
+
static async loadWebPlugin(configs = []) {
|
|
199
223
|
try {
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
configs.forEach((config) => {
|
|
207
|
-
const plugins = config.plugins;
|
|
208
|
-
plugins.forEach((plugin) => {
|
|
209
|
-
app.use(moduleMap[plugin.key].default);
|
|
210
|
-
});
|
|
224
|
+
const moduleMap = await this.loadPlugins(PluginModeEnum.WEB, configs);
|
|
225
|
+
configs.forEach((plugin) => {
|
|
226
|
+
_gct.register.render.web.register(
|
|
227
|
+
plugin.key,
|
|
228
|
+
moduleMap[plugin.key].default
|
|
229
|
+
);
|
|
211
230
|
});
|
|
212
|
-
return result;
|
|
213
231
|
} catch (error) {
|
|
214
232
|
console.error(error);
|
|
215
233
|
}
|
|
216
|
-
return [[], {}];
|
|
217
234
|
}
|
|
218
235
|
}
|
|
219
236
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/core",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.29",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "paas 平台核心包",
|
|
6
6
|
"main": "dist/index.min.cjs",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"vue-i18n": "9.6.5"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@gct-paas/build": "0.0.1-dev.
|
|
60
|
-
"@gct-paas/cli": "0.0.1-dev.
|
|
59
|
+
"@gct-paas/build": "0.0.1-dev.29",
|
|
60
|
+
"@gct-paas/cli": "0.0.1-dev.29",
|
|
61
61
|
"@types/path-browserify": "^1.0.3",
|
|
62
62
|
"@types/qs": "^6.9.18",
|
|
63
63
|
"fs-extra": "^11.3.0"
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"vue": "^3.x"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "884374c8d6a2997b5138ac65d12e8dd2672cbcfa"
|
|
69
69
|
}
|