@ibiz-template/model-helper 0.7.6 → 0.7.7
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.js +936 -792
- package/dist/index.system.min.js +1 -1
- package/out/model-helper.d.ts.map +1 -1
- package/out/model-helper.js +36 -22
- package/out/utils/index.d.ts +1 -0
- package/out/utils/index.d.ts.map +1 -1
- package/out/utils/index.js +1 -0
- package/out/utils/merge-model/merge-app-menu.d.ts +6 -7
- package/out/utils/merge-model/merge-app-menu.d.ts.map +1 -1
- package/out/utils/merge-model/merge-app-menu.js +1 -25
- package/out/utils/merge-model/merge-de-drcontrol.d.ts +12 -0
- package/out/utils/merge-model/merge-de-drcontrol.d.ts.map +1 -0
- package/out/utils/merge-model/merge-de-drcontrol.js +48 -0
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-helper.d.ts","sourceRoot":"","sources":["../src/model-helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,UAAU,
|
|
1
|
+
{"version":3,"file":"model-helper.d.ts","sourceRoot":"","sources":["../src/model-helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,UAAU,EAEX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC;;;;;;;GAOG;AACH,qBAAa,WAAW;IAgCpB,SAAS,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC;IACtE,SAAS,CAAC,YAAY,EAAE,MAAM;IAC9B,SAAS,CAAC,UAAU,EAAE,OAAO;IAjC/B,SAAS,CAAC,GAAG,YAAm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AAG,IAAI;IAqCtD;;;;;;;;OAQG;IACG,eAAe,CACnB,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GACvB,OAAO,CAAC,QAAQ,CAAC;IAOpB;;;;;;;;;OASG;IACG,gBAAgB,CACpB,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,OAAO,EAChB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,QAAQ,CAAC;IAUpB;;;;;;;;OAQG;IACG,YAAY,CAChB,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GACvB,OAAO,CAAC,OAAO,CAAC;IAKnB;;;;;;;;OAQG;IACH,SAAS,CAAC,YAAY,CACpB,OAAO,GAAE,OAAO,GAAG,MAA0B,GAC5C,SAAS;IAQZ;;;;;;;;OAQG;IACH,SAAS,CAAC,SAAS,CAAC,IAAI,GAAE,OAAO,GAAG,MAA0B,GAAG,MAAM;CASxE"}
|
package/out/model-helper.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DSLHelper } from '@ibiz/rt-model-api';
|
|
2
2
|
import { ModelUtil } from './model-util';
|
|
3
3
|
import { ModelLoader } from './model-loader';
|
|
4
|
-
import { mergeAppMenu, plural } from './utils';
|
|
4
|
+
import { mergeAppMenu, mergeDEDrControl, plural } from './utils';
|
|
5
5
|
/**
|
|
6
6
|
* 模型加载工具类
|
|
7
7
|
*
|
|
@@ -146,12 +146,20 @@ export class ModelHelper {
|
|
|
146
146
|
*/
|
|
147
147
|
async initSubApp(app, subApp, sourceSubApp) {
|
|
148
148
|
this.subAppRefs.push(subApp);
|
|
149
|
-
|
|
149
|
+
// 设置视图到hub中
|
|
150
|
+
const viewIds = subApp.appViewIds || [];
|
|
150
151
|
const views = sourceSubApp.getAllPSAppViews || [];
|
|
151
|
-
|
|
152
|
+
viewIds.forEach((id, index) => {
|
|
152
153
|
const view = views[index];
|
|
153
154
|
ibiz.hub.setAppView(id, subApp.id, view.priority);
|
|
154
155
|
});
|
|
156
|
+
// 设置DrCtrl到hub中
|
|
157
|
+
const drCtrlIds = subApp.dedrcontrolIds || [];
|
|
158
|
+
const drCtrls = this.dsl.controls(sourceSubApp.getAllPSDEDRControls || []);
|
|
159
|
+
drCtrlIds.forEach((id, index) => {
|
|
160
|
+
const drCtrl = drCtrls[index];
|
|
161
|
+
ibiz.hub.registerSubAppDrControls(subApp.id || ibiz.env.appId, drCtrl);
|
|
162
|
+
});
|
|
155
163
|
}
|
|
156
164
|
/**
|
|
157
165
|
* 获取应用模型
|
|
@@ -219,26 +227,32 @@ export class ModelHelper {
|
|
|
219
227
|
* @param {IAppView} view
|
|
220
228
|
*/
|
|
221
229
|
calcAppViewSubAppModel(view) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
230
|
+
var _a;
|
|
231
|
+
const controls = view.controls
|
|
232
|
+
? view.controls
|
|
233
|
+
: (_a = view.viewLayoutPanel) === null || _a === void 0 ? void 0 : _a.controls;
|
|
234
|
+
// 合并菜单
|
|
235
|
+
const dstAppMenu = view.viewType === 'APPINDEXVIEW' &&
|
|
236
|
+
(controls === null || controls === void 0 ? void 0 : controls.find(item => {
|
|
237
|
+
return item.controlType === 'APPMENU';
|
|
238
|
+
}));
|
|
239
|
+
if (dstAppMenu) {
|
|
240
|
+
for (let i = 0; i < this.subAppRefs.length; i++) {
|
|
241
|
+
const srcAppMenu = this.subAppRefs[i].appMenuModel;
|
|
242
|
+
if (srcAppMenu) {
|
|
243
|
+
mergeAppMenu(dstAppMenu, srcAppMenu);
|
|
244
|
+
}
|
|
231
245
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
246
|
+
}
|
|
247
|
+
// 合并DrCtrl
|
|
248
|
+
const dstDRCtrl = controls === null || controls === void 0 ? void 0 : controls.find(item => {
|
|
249
|
+
return item.controlType === 'DRBAR' || item.controlType === 'DRTAB';
|
|
250
|
+
});
|
|
251
|
+
if (dstDRCtrl) {
|
|
252
|
+
for (let i = 0; i < this.subAppRefs.length; i++) {
|
|
253
|
+
const srcDRCtrl = ibiz.hub.getSubAppDrControl(dstDRCtrl.uniqueTag, this.subAppRefs[i].appId);
|
|
254
|
+
if (srcDRCtrl) {
|
|
255
|
+
mergeDEDrControl(dstDRCtrl, srcDRCtrl);
|
|
242
256
|
}
|
|
243
257
|
}
|
|
244
258
|
}
|
package/out/utils/index.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export { mergeModel } from './merge-model/merge-model';
|
|
|
3
3
|
export { plural, pluralLower } from './plural/plural';
|
|
4
4
|
export { ServicePathDeep, ServicePathItem, ServicePathUtil, } from './service-path-util/service-path-util';
|
|
5
5
|
export { mergeAppMenu } from './merge-model/merge-app-menu';
|
|
6
|
+
export { mergeDEDrControl } from './merge-model/merge-de-drcontrol';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
package/out/utils/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACL,eAAe,EACf,eAAe,EACf,eAAe,GAChB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACL,eAAe,EACf,eAAe,EACf,eAAe,GAChB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC"}
|
package/out/utils/index.js
CHANGED
|
@@ -3,3 +3,4 @@ export { mergeModel } from './merge-model/merge-model';
|
|
|
3
3
|
export { plural, pluralLower } from './plural/plural';
|
|
4
4
|
export { ServicePathUtil, } from './service-path-util/service-path-util';
|
|
5
5
|
export { mergeAppMenu } from './merge-model/merge-app-menu';
|
|
6
|
+
export { mergeDEDrControl } from './merge-model/merge-de-drcontrol';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { IAppMenuModel
|
|
1
|
+
import { IAppMenuModel } from '@ibiz/model-core';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* 合并主菜单和子菜单
|
|
4
4
|
* @author lxm
|
|
5
|
-
* @date 2023-12-07
|
|
6
|
-
* @
|
|
7
|
-
* @param {IAppMenuModel}
|
|
8
|
-
* @param {ISubAppRef[]} subAppRefs
|
|
5
|
+
* @date 2023-12-07 03:15:54
|
|
6
|
+
* @param {IAppMenuModel} main
|
|
7
|
+
* @param {IAppMenuModel} sub
|
|
9
8
|
*/
|
|
10
|
-
export declare function mergeAppMenu(
|
|
9
|
+
export declare function mergeAppMenu(main: IAppMenuModel, sub: IAppMenuModel): void;
|
|
11
10
|
//# sourceMappingURL=merge-app-menu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-app-menu.d.ts","sourceRoot":"","sources":["../../../src/utils/merge-model/merge-app-menu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"merge-app-menu.d.ts","sourceRoot":"","sources":["../../../src/utils/merge-model/merge-app-menu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAiC/D;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CAe1E"}
|
|
@@ -40,7 +40,7 @@ function mergeMenuItem(mainItem, subItem) {
|
|
|
40
40
|
* @param {IAppMenuModel} main
|
|
41
41
|
* @param {IAppMenuModel} sub
|
|
42
42
|
*/
|
|
43
|
-
function
|
|
43
|
+
export function mergeAppMenu(main, sub) {
|
|
44
44
|
var _a;
|
|
45
45
|
const addItems = [];
|
|
46
46
|
(_a = sub.appMenuItems) === null || _a === void 0 ? void 0 : _a.forEach(item => {
|
|
@@ -58,27 +58,3 @@ function mergeMenu(main, sub) {
|
|
|
58
58
|
}
|
|
59
59
|
main.appMenuItems.push(...addItems);
|
|
60
60
|
}
|
|
61
|
-
/**
|
|
62
|
-
* 合并主应用首页菜单
|
|
63
|
-
* @author lxm
|
|
64
|
-
* @date 2023-12-07 02:26:57
|
|
65
|
-
* @export
|
|
66
|
-
* @param {IAppMenuModel} mainMenu
|
|
67
|
-
* @param {ISubAppRef[]} subAppRefs
|
|
68
|
-
*/
|
|
69
|
-
export function mergeAppMenu(mainMenu, subAppRefs) {
|
|
70
|
-
const subMenus = [];
|
|
71
|
-
subAppRefs.forEach(sub => {
|
|
72
|
-
var _a, _b;
|
|
73
|
-
if ((_b = (_a = sub.appMenuModel) === null || _a === void 0 ? void 0 : _a.appMenuItems) === null || _b === void 0 ? void 0 : _b.length) {
|
|
74
|
-
subMenus.push(sub.appMenuModel);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
if (subMenus.length === 0) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
// 依次合并主应用菜单和子应用菜单
|
|
81
|
-
subMenus.forEach(subMenu => {
|
|
82
|
-
mergeMenu(mainMenu, subMenu);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 合并DrCtrl控件
|
|
3
|
+
*
|
|
4
|
+
* @author tony001
|
|
5
|
+
* @date 2024-04-29 19:04:44
|
|
6
|
+
* @export
|
|
7
|
+
* @param {IModel} dstDRCtrl
|
|
8
|
+
* @param {IModel} srcDRCtrl
|
|
9
|
+
* @return {*} {void}
|
|
10
|
+
*/
|
|
11
|
+
export declare function mergeDEDrControl(dstDRCtrl: IModel, srcDRCtrl: IModel): void;
|
|
12
|
+
//# sourceMappingURL=merge-de-drcontrol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-de-drcontrol.d.ts","sourceRoot":"","sources":["../../../src/utils/merge-model/merge-de-drcontrol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAsC3E"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 合并DrCtrl控件
|
|
3
|
+
*
|
|
4
|
+
* @author tony001
|
|
5
|
+
* @date 2024-04-29 19:04:44
|
|
6
|
+
* @export
|
|
7
|
+
* @param {IModel} dstDRCtrl
|
|
8
|
+
* @param {IModel} srcDRCtrl
|
|
9
|
+
* @return {*} {void}
|
|
10
|
+
*/
|
|
11
|
+
export function mergeDEDrControl(dstDRCtrl, srcDRCtrl) {
|
|
12
|
+
if (!srcDRCtrl) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
// 合并分组(相同name替换,没有则附加)
|
|
16
|
+
if (srcDRCtrl.dedrbarGroups) {
|
|
17
|
+
srcDRCtrl.dedrbarGroups.forEach((item1) => {
|
|
18
|
+
var _a;
|
|
19
|
+
let index = 0;
|
|
20
|
+
const result = (_a = dstDRCtrl.dedrbarGroups) === null || _a === void 0 ? void 0 : _a.find((item2, index2) => {
|
|
21
|
+
index = index2;
|
|
22
|
+
return item1.name === item2.name;
|
|
23
|
+
});
|
|
24
|
+
if (result) {
|
|
25
|
+
dstDRCtrl.dedrbarGroups[index] = item1;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
dstDRCtrl.dedrbarGroups.push(item1);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
// 合并分组项(相同id替换,没有则附加)
|
|
33
|
+
if (srcDRCtrl.dedrctrlItems) {
|
|
34
|
+
srcDRCtrl.dedrctrlItems.forEach((item1) => {
|
|
35
|
+
let index = 0;
|
|
36
|
+
const result = dstDRCtrl.dedrctrlItems.find((item2, index2) => {
|
|
37
|
+
index = index2;
|
|
38
|
+
return item1.id === item2.id;
|
|
39
|
+
});
|
|
40
|
+
if (result) {
|
|
41
|
+
dstDRCtrl.dedrctrlItems[index] = item1;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
dstDRCtrl.dedrctrlItems.push(item1);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/model-helper",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.7",
|
|
4
4
|
"description": "控制器包",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"types": "out/index.d.ts",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
"author": "chitanda",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@ibiz/model-core": "^0.1.
|
|
36
|
-
"@ibiz/rt-model-api": "^0.2.
|
|
35
|
+
"@ibiz/model-core": "^0.1.23",
|
|
36
|
+
"@ibiz/rt-model-api": "^0.2.13",
|
|
37
37
|
"pluralize": "^8.0.0",
|
|
38
38
|
"ramda": "^0.29.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@ibiz-template/runtime": "^0.7.
|
|
41
|
+
"@ibiz-template/runtime": "^0.7.7",
|
|
42
42
|
"@types/pluralize": "^0.0.33",
|
|
43
43
|
"@types/ramda": "^0.29.10"
|
|
44
44
|
},
|