@ibiz-template/full-code-template 0.7.41-alpha.2 → 0.7.41-alpha.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/full-code-template",
3
- "version": "0.7.41-alpha.2",
3
+ "version": "0.7.41-alpha.3",
4
4
  "description": "vue3全代码模版包,根据包内容生成项目代码。",
5
5
  "bin": {
6
6
  "code-generator": "src/index.js"
@@ -16,7 +16,7 @@
16
16
  "author": "ibiz",
17
17
  "license": "MIT",
18
18
  "dependencies": {
19
- "@ibizlab/cli": "^0.2.25",
19
+ "@ibizlab/cli": "^0.2.26",
20
20
  "commander": "^12.0.0",
21
21
  "prettier": "^3.2.5"
22
22
  }
package/src/index.js CHANGED
@@ -33,5 +33,6 @@ execSync(
33
33
  `${binPath}/ibizlab pub -m ${modelPath} -t ${templatePath} -o ${outputPath}/src/publish --app ${app} && ${binPath}/prettier --ignore-path '' '${outputPath}/src/publish/**/*.(ts|vue|tsx)' -w`,
34
34
  );
35
35
  copyFiles(`${outputPath}/src/publish/app`, `${outputPath}/public/static/app`);
36
+ fs.rmSync(`${outputPath}/src/publish/app`, { recursive: true, force: true }); // 递归删除目录及其内容
36
37
 
37
38
  console.log(`发布模板成功,模型路径:${modelPath},发布应用代码标识:${app},模板路径:${templatePath},输出路径:${outputPath}/src/publish`);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ibiz-template/full-code-template",
3
3
  "private": true,
4
- "version": "0.7.41-alpha.2",
4
+ "version": "0.7.41-alpha.3",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -60,7 +60,7 @@
60
60
  "devDependencies": {
61
61
  "@commitlint/cli": "^17.8.0",
62
62
  "@commitlint/config-conventional": "^17.8.0",
63
- "@ibizlab/cli": "^0.2.25",
63
+ "@ibizlab/cli": "^0.2.26",
64
64
  "@types/lodash-es": "^4.17.10",
65
65
  "@types/node": "^20.8.7",
66
66
  "@types/nprogress": "^0.2.2",
@@ -131,8 +131,8 @@ devDependencies:
131
131
  specifier: ^17.8.0
132
132
  version: 17.8.0
133
133
  '@ibizlab/cli':
134
- specifier: ^0.2.25
135
- version: 0.2.25(@ibizlab/model@0.2.15)
134
+ specifier: ^0.2.26
135
+ version: 0.2.26(@ibizlab/model@0.2.15)
136
136
  '@types/lodash-es':
137
137
  specifier: ^4.17.10
138
138
  version: 4.17.10
@@ -4221,11 +4221,11 @@ packages:
4221
4221
  /@ibiz/rt-model-api@0.2.73:
4222
4222
  resolution: {integrity: sha512-lrJzvrwqeXGuGcE+3WML4O4d2oty+cD35cA7XdTtNVX9XrmJdpYmSAGb2s2BKuNxrrIsfiJJhKblKLdwGywMwA==}
4223
4223
 
4224
- /@ibizlab/cli@0.2.25(@ibizlab/model@0.2.15):
4225
- resolution: {integrity: sha512-lKLU+i0VRmBJjVU9JmBru3gRAwn5e7uloa3zEfgnwOlc3IldWlALqJ+0SDE27Ou6MPXY3ll14GP2Beh+1OtF8Q==}
4224
+ /@ibizlab/cli@0.2.26(@ibizlab/model@0.2.15):
4225
+ resolution: {integrity: sha512-2+Ea35ziD7B0xub4ND89ln5VAWzA1sKi1/OWGVAzgF2QQ1LyWbw+DNMdw11PJb+dum4lH2ElAw++Awbj3sZB1g==}
4226
4226
  hasBin: true
4227
4227
  dependencies:
4228
- '@ibizlab/template': 0.2.25(@ibizlab/model@0.2.15)
4228
+ '@ibizlab/template': 0.2.26(@ibizlab/model@0.2.15)
4229
4229
  chalk: 4.1.2
4230
4230
  commander: 11.1.0
4231
4231
  fs-extra: 11.2.0
@@ -4272,8 +4272,8 @@ packages:
4272
4272
  tapable: 2.2.1
4273
4273
  dev: true
4274
4274
 
4275
- /@ibizlab/template-model@0.2.25(@ibizlab/model@0.2.15):
4276
- resolution: {integrity: sha512-nhMfcMN5zAUhQ6zHUYPmq4xNu7n2Ki/gfE512GNWfI+8pwx/RYIGXp3tROZnV38jTybDy3JQWb8spR5J2pxaFQ==}
4275
+ /@ibizlab/template-model@0.2.26(@ibizlab/model@0.2.15):
4276
+ resolution: {integrity: sha512-hhBOpE2fXUkAIIhbzaGjMO73NJtCFfYIhpfoEK72dRTQL7QCExTEspDVK4Ks2wyMiDpJz5Zk/jqqkbF7W5yCBQ==}
4277
4277
  peerDependencies:
4278
4278
  '@ibizlab/model': ^0.2.15
4279
4279
  dependencies:
@@ -4286,8 +4286,8 @@ packages:
4286
4286
  qx-util: 0.4.8
4287
4287
  dev: true
4288
4288
 
4289
- /@ibizlab/template@0.2.25(@ibizlab/model@0.2.15):
4290
- resolution: {integrity: sha512-ooqiCGKxs4WV5LuwFvgle+0r+H/0iHiG8t6e3qsZurvifImxp1PZsR2wqFfrAggArcmtvN4An0UFxyO/VunArQ==}
4289
+ /@ibizlab/template@0.2.26(@ibizlab/model@0.2.15):
4290
+ resolution: {integrity: sha512-lnhNNyWbdLNJUxJMfIPyQXq8pGWfi5Ib2/l19TV9B/keMB3TutIkuVJ6RQfexdo3LhojHA2vSdc6zUeNJaIgdw==}
4291
4291
  peerDependencies:
4292
4292
  '@ibizlab/model': ^0.2.14
4293
4293
  dependencies:
@@ -4295,7 +4295,7 @@ packages:
4295
4295
  '@ibizlab/template-core': 0.2.2
4296
4296
  '@ibizlab/template-generator': 0.2.4
4297
4297
  '@ibizlab/template-handlebars': 0.2.4
4298
- '@ibizlab/template-model': 0.2.25(@ibizlab/model@0.2.15)
4298
+ '@ibizlab/template-model': 0.2.26(@ibizlab/model@0.2.15)
4299
4299
  chokidar: 3.6.0
4300
4300
  fs-extra: 11.2.0
4301
4301
  qx-util: 0.4.8
@@ -25,8 +25,11 @@ export const IBizViewShell = defineComponent({
25
25
  // 初始化方法
26
26
  const init = async (): Promise<void> => {
27
27
  const viewId = props.modelData ? props.modelData.id! : props.viewId!;
28
- viewComponent.value = await getAppViewComponent(viewId);
29
28
  viewModel.value = await ibiz.hub.getAppView(viewId);
29
+ viewComponent.value = await getAppViewComponent(
30
+ viewId,
31
+ viewModel.value.appId,
32
+ );
30
33
  if (!viewComponent.value) {
31
34
  errMsg.value = `未找到${viewId}对应的视图组件`;
32
35
  }
@@ -15,6 +15,7 @@ import {
15
15
  ModelLoaderProvider,
16
16
  } from '@ibiz-template/runtime';
17
17
  import { kebabCase } from 'lodash-es';
18
+ import { clone } from 'ramda';
18
19
  import {
19
20
  getAppDataEntityModel,
20
21
  getAppViewModel,
@@ -154,12 +155,14 @@ export class ModelLoader implements ModelLoaderProvider {
154
155
  }
155
156
  });
156
157
  // 子应用模型相关处理
157
- const microApps = ibiz.hub.microAppConfigCenter.getMicroApps();
158
- if (microApps && microApps.length > 0) {
159
- for (let i = 0; i < microApps.length; i++) {
160
- const microApp = microApps[i];
161
- // eslint-disable-next-line no-await-in-loop
162
- await this.initSubApp(appService, microApp);
158
+ if (!appId || appId === ibiz.env.appId) {
159
+ const microApps = ibiz.hub.microAppConfigCenter.getMicroApps();
160
+ if (microApps && microApps.length > 0) {
161
+ for (let i = 0; i < microApps.length; i++) {
162
+ const microApp = microApps[i];
163
+ // eslint-disable-next-line no-await-in-loop
164
+ await this.initSubApp(appService, microApp);
165
+ }
163
166
  }
164
167
  }
165
168
  return true;
@@ -205,6 +208,8 @@ export class ModelLoader implements ModelLoaderProvider {
205
208
  app: IAppService,
206
209
  microAppConfig: IMicroAppConfig,
207
210
  ): Promise<void> {
211
+ const targetSubAppRef = await this.getSubAppRef(microAppConfig.name);
212
+ if (targetSubAppRef) return;
208
213
  const res = await ibiz.net.axios({
209
214
  method: 'get',
210
215
  headers: { 'Access-Control-Allow-Origin': '*' },
@@ -215,7 +220,12 @@ export class ModelLoader implements ModelLoaderProvider {
215
220
  const subApp = this.dsl.subAppRef(sourceSubApp);
216
221
  subApp.appId = microAppConfig.name;
217
222
  subApp.serviceId = microAppConfig?.baseUrl;
218
- this.subAppRefs.push(subApp as ISubAppRef);
223
+ if (subApp.appMenuModel) {
224
+ this.deepFillSubAppId(subApp.appMenuModel, microAppConfig.name);
225
+ }
226
+ if (!targetSubAppRef) {
227
+ this.subAppRefs.push(subApp as ISubAppRef);
228
+ }
219
229
  // 设置视图到hub中
220
230
  const views = sourceSubApp.getAllPSAppViews || [];
221
231
  views.forEach((view: IModel) => {
@@ -234,6 +244,7 @@ export class ModelLoader implements ModelLoaderProvider {
234
244
  sourceSubApp.getAllPSDEDRControls || [],
235
245
  );
236
246
  drCtrls.forEach((drCtrl: IModel) => {
247
+ this.deepFillSubAppId(drCtrl, microAppConfig.name);
237
248
  ibiz.hub.registerSubAppDrControls(
238
249
  microAppConfig.name || ibiz.env.appId,
239
250
  drCtrl,
@@ -374,17 +385,17 @@ export class ModelLoader implements ModelLoaderProvider {
374
385
  */
375
386
  async getAppView(appId: string, codeName: string): Promise<IAppView> {
376
387
  if (appId === ibiz.env.appId) {
377
- const dsl = await getAppViewModel(codeName);
388
+ const viewModel = await getAppViewModel(codeName);
389
+ const dsl = clone(viewModel);
378
390
  this.deepFillSubAppId(dsl, appId);
379
391
  this.calcAppViewSubAppModel(dsl);
380
392
  return dsl;
381
393
  }
382
394
  const microAppConfig = ibiz.hub.microAppConfigCenter.getMicroApp(appId);
383
395
  const module = await System.import(
384
- `${microAppConfig!.entry}/static/js/model/views/${codeName.replaceAll(
385
- '_',
386
- '-',
387
- )}-legacy.js`,
396
+ `${microAppConfig!.entry}/static/js/model/views/${kebabCase(
397
+ codeName,
398
+ ).toLowerCase()}-legacy.js`,
388
399
  );
389
400
  this.deepFillSubAppId(module.default, appId);
390
401
  return module.default;
@@ -403,9 +414,9 @@ export class ModelLoader implements ModelLoaderProvider {
403
414
  }
404
415
  const microAppConfig = ibiz.hub.microAppConfigCenter.getMicroApp(appId);
405
416
  const module = await System.import(
406
- `${microAppConfig!.entry}/static/js/model/entities/${id
407
- .split('.')[1]
408
- .replaceAll('_', '-')}-legacy.js`,
417
+ `${microAppConfig!.entry}/static/js/model/entities/${
418
+ id.indexOf('.') !== -1 ? kebabCase(id.split('.')[1]).toLowerCase() : id
419
+ }-legacy.js`,
409
420
  );
410
421
  this.deepFillSubAppId(module.default, appId);
411
422
  return module.default;
@@ -11,10 +11,13 @@ function calcAppViewId(tag: string): string {
11
11
  return id;
12
12
  }
13
13
 
14
- export async function getAppViewComponent(name: string): Promise<Component> {
15
- const _name = calcAppViewId(name).toLowerCase();
16
- // 子应用视图
17
- if (name.split('.')[0] !== ibiz.env.appId.split('__')[1]) {
14
+ export async function getAppViewComponent(
15
+ name: string,
16
+ appId: string,
17
+ ): Promise<Component> {
18
+ const _name = calcAppViewId(name).toLowerCase();
19
+ // 子应用视图
20
+ if (appId !== ibiz.env.appId) {
18
21
  return defineAsyncComponent(
19
22
  () => import('../../components/sub-app-view/sub-app-view.vue'),
20
23
  );