@gct-paas/core 0.0.1-dev.27 → 0.0.1-dev.28

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.
@@ -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
- * @returns {*} {Promise<LoadPluginResult>}
83
+ * @param {IObject[]} configs 界面用到的插件集合
84
+ * @returns {*} {Promise<void>}
75
85
  */
76
- static loadMobilePlugin(app: App, kit?: string[]): Promise<LoadPluginResult>;
86
+ static loadMobilePlugin(app: App, configs?: IObject[]): Promise<void>;
77
87
  /**
78
- * 加载绘制态网页端端插件包
88
+ * 加载设计态网页端插件包
79
89
  *
80
90
  * @static
81
91
  * @param {App} app
92
+ * @param {IObject[]} configs 界面用到的插件集合
82
93
  * @returns {*} {Promise<LoadPluginResult>}
83
94
  */
84
- static loadWebPlugin(app: App, kit?: string[]): Promise<LoadPluginResult>;
95
+ static loadWebPlugin(app: App, configs?: IObject[]): Promise<LoadPluginResult>;
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,54 +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((config) => {
176
+ const plugins = config.plugins;
177
+ plugins.forEach((plugin) => {
178
+ const module = moduleMap[plugin.key];
179
+ if (platform === Platform.WEB) {
180
+ _gct.register.designer.web.register(
181
+ plugin.key,
182
+ () => new module.default()
183
+ );
184
+ } else {
185
+ _gct.register.designer.mobile.register(
186
+ plugin.key,
187
+ () => new module.default()
188
+ );
189
+ }
190
+ });
191
+ });
192
+ } catch (error) {
193
+ console.error(error);
194
+ }
195
+ }
196
+ /**
197
+ * 加载设计态移动端插件包
166
198
  *
167
199
  * @static
168
200
  * @param {App} app
169
- * @returns {*} {Promise<LoadPluginResult>}
201
+ * @param {IObject[]} configs 界面用到的插件集合
202
+ * @returns {*} {Promise<void>}
170
203
  */
171
- static async loadMobilePlugin(app, kit = []) {
204
+ static async loadMobilePlugin(app, configs = []) {
172
205
  try {
173
- const result = await this.loadPlugin(
174
- PluginModeEnum.MOBILE,
175
- Platform.MOBILE,
176
- kit
177
- );
178
- const [configs, moduleMap] = result;
206
+ const moduleMap = await this.loadPlugins(PluginModeEnum.MOBILE, configs);
179
207
  configs.forEach((config) => {
180
208
  const plugins = config.plugins;
181
209
  plugins.forEach((plugin) => {
182
210
  app.use(moduleMap[plugin.key].default);
183
211
  });
184
212
  });
185
- return result;
186
213
  } catch (error) {
187
214
  console.error(error);
188
215
  }
189
- return [[], {}];
190
216
  }
191
217
  /**
192
- * 加载绘制态网页端端插件包
218
+ * 加载设计态网页端插件包
193
219
  *
194
220
  * @static
195
221
  * @param {App} app
222
+ * @param {IObject[]} configs 界面用到的插件集合
196
223
  * @returns {*} {Promise<LoadPluginResult>}
197
224
  */
198
- static async loadWebPlugin(app, kit = []) {
225
+ static async loadWebPlugin(app, configs = []) {
199
226
  try {
200
- const result = await this.loadPlugin(
201
- PluginModeEnum.WEB,
202
- Platform.WEB,
203
- kit
204
- );
205
- const [configs, moduleMap] = result;
227
+ const moduleMap = await this.loadPlugins(PluginModeEnum.WEB, configs);
206
228
  configs.forEach((config) => {
207
229
  const plugins = config.plugins;
208
230
  plugins.forEach((plugin) => {
209
231
  app.use(moduleMap[plugin.key].default);
210
232
  });
211
233
  });
212
- return result;
213
234
  } catch (error) {
214
235
  console.error(error);
215
236
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/core",
3
- "version": "0.0.1-dev.27",
3
+ "version": "0.0.1-dev.28",
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.27",
60
- "@gct-paas/cli": "0.0.1-dev.27",
59
+ "@gct-paas/build": "0.0.1-dev.28",
60
+ "@gct-paas/cli": "0.0.1-dev.28",
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": "cb595953f2d72e28c5e4a4b515969075140c61df"
68
+ "gitHead": "1b551a067c28edb19d38da02baf56eb648784185"
69
69
  }