@ibiz-template/runtime 0.7.41-alpha.145 → 0.7.41-alpha.146
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 +55 -0
- package/dist/index.system.min.js +1 -1
- package/out/utils/layout-panel-util/layout-panel-util.d.ts +17 -1
- package/out/utils/layout-panel-util/layout-panel-util.d.ts.map +1 -1
- package/out/utils/layout-panel-util/layout-panel-util.js +49 -0
- package/package.json +2 -2
- package/src/utils/layout-panel-util/layout-panel-util.ts +66 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IAppView, IViewLayoutPanel, IAppIndexView } from '@ibiz/model-core';
|
|
1
|
+
import { IAppView, IViewLayoutPanel, IAppIndexView, IPanelItem } from '@ibiz/model-core';
|
|
2
2
|
/**
|
|
3
3
|
* 布局面板工具类
|
|
4
4
|
*
|
|
@@ -79,5 +79,21 @@ export declare class LayoutPanelUtil {
|
|
|
79
79
|
* @memberof LayoutPanelUtil
|
|
80
80
|
*/
|
|
81
81
|
protected calcDEMedViewLayoutTag(viewModel: IAppView): string;
|
|
82
|
+
/**
|
|
83
|
+
* @description 递归查找指定标识的面板项
|
|
84
|
+
* @protected
|
|
85
|
+
* @param {IPanelItem[]} items
|
|
86
|
+
* @param {string} id
|
|
87
|
+
* @returns {*} {(IPanelItem | undefined)}
|
|
88
|
+
* @memberof LayoutPanelUtil
|
|
89
|
+
*/
|
|
90
|
+
protected findPanelItem(items: IPanelItem[], id: string): IPanelItem | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* @description 替换简单列表部件占位
|
|
93
|
+
* @protected
|
|
94
|
+
* @param {IAppView} viewModel
|
|
95
|
+
* @memberof LayoutPanelUtil
|
|
96
|
+
*/
|
|
97
|
+
protected replaceSimpleList(viewModel: IAppView): void;
|
|
82
98
|
}
|
|
83
99
|
//# sourceMappingURL=layout-panel-util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-panel-util.d.ts","sourceRoot":"","sources":["../../../src/utils/layout-panel-util/layout-panel-util.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,aAAa,
|
|
1
|
+
{"version":3,"file":"layout-panel-util.d.ts","sourceRoot":"","sources":["../../../src/utils/layout-panel-util/layout-panel-util.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,aAAa,EAIb,UAAU,EAEX,MAAM,kBAAkB,CAAC;AAI1B;;;;;;;GAOG;AACH,qBAAa,eAAe;IAC1B;;;;;;;OAOG;IACH,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAa;IAE3D;;;;;;;OAOG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAIpD;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAI9C;;;;;;;OAOG;IACH,IAAI,CAAC,SAAS,EAAE,QAAQ,GAAG,QAAQ;IAuCnC;;;;;;;;OAQG;IACH,SAAS,CAAC,aAAa,CAAC,SAAS,EAAE,QAAQ,GAAG,MAAM;IAgBpD;;;;;;OAMG;IACH,SAAS,CAAC,uBAAuB,CAAC,SAAS,EAAE,QAAQ,GAAG,MAAM;IAS9D;;;;;;;;OAQG;IACH,SAAS,CAAC,sBAAsB,CAAC,SAAS,EAAE,aAAa,GAAG,MAAM;IA+BlE;;;;;;OAMG;IACH,SAAS,CAAC,sBAAsB,CAAC,SAAS,EAAE,QAAQ,GAAG,MAAM;IAY7D;;;;;;;OAOG;IACH,SAAS,CAAC,aAAa,CACrB,KAAK,EAAE,UAAU,EAAE,EACnB,EAAE,EAAE,MAAM,GACT,UAAU,GAAG,SAAS;IAiBzB;;;;;OAKG;IACH,SAAS,CAAC,iBAAiB,CAAC,SAAS,EAAE,QAAQ,GAAG,IAAI;CAqBvD"}
|
|
@@ -76,6 +76,9 @@ export class LayoutPanelUtil {
|
|
|
76
76
|
layout.controls = viewModel.controls;
|
|
77
77
|
delete viewModel.controls;
|
|
78
78
|
}
|
|
79
|
+
if (['DEMPICKUPVIEW', 'DEMPICKUPVIEW2', 'DEMOBMPICKUPVIEW'].includes(viewModel.viewType)) {
|
|
80
|
+
this.replaceSimpleList(viewModel);
|
|
81
|
+
}
|
|
79
82
|
}
|
|
80
83
|
}
|
|
81
84
|
return viewModel;
|
|
@@ -172,4 +175,50 @@ export class LayoutPanelUtil {
|
|
|
172
175
|
}
|
|
173
176
|
return `${viewType}_${viewStyle}`;
|
|
174
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* @description 递归查找指定标识的面板项
|
|
180
|
+
* @protected
|
|
181
|
+
* @param {IPanelItem[]} items
|
|
182
|
+
* @param {string} id
|
|
183
|
+
* @returns {*} {(IPanelItem | undefined)}
|
|
184
|
+
* @memberof LayoutPanelUtil
|
|
185
|
+
*/
|
|
186
|
+
findPanelItem(items, id) {
|
|
187
|
+
for (let i = 0; i < items.length; i++) {
|
|
188
|
+
const item = items[i];
|
|
189
|
+
if (item.id === id) {
|
|
190
|
+
return item;
|
|
191
|
+
}
|
|
192
|
+
const children = item.panelItems;
|
|
193
|
+
if (children === null || children === void 0 ? void 0 : children.length) {
|
|
194
|
+
const result = this.findPanelItem(children, id);
|
|
195
|
+
if (result) {
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return undefined;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* @description 替换简单列表部件占位
|
|
204
|
+
* @protected
|
|
205
|
+
* @param {IAppView} viewModel
|
|
206
|
+
* @memberof LayoutPanelUtil
|
|
207
|
+
*/
|
|
208
|
+
replaceSimpleList(viewModel) {
|
|
209
|
+
const layout = viewModel.viewLayoutPanel;
|
|
210
|
+
const { controls = [] } = layout;
|
|
211
|
+
const simpleListControl = controls.find(control => control.name === 'simplelist');
|
|
212
|
+
// 当simplelist部件不存在时替换为面板项
|
|
213
|
+
if (!simpleListControl) {
|
|
214
|
+
const simpleListItem = this.findPanelItem(layout.rootPanelItems, 'simplelist');
|
|
215
|
+
if (simpleListItem) {
|
|
216
|
+
simpleListItem.itemType = 'RAWITEM';
|
|
217
|
+
simpleListItem.rawItem = {
|
|
218
|
+
predefinedType: 'SIMPLELIST',
|
|
219
|
+
appId: simpleListItem.appId,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
175
224
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/runtime",
|
|
3
|
-
"version": "0.7.41-alpha.
|
|
3
|
+
"version": "0.7.41-alpha.146",
|
|
4
4
|
"description": "运行时逻辑库",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "out/index.js",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"qx-util": "^0.4.8",
|
|
71
71
|
"ramda": "^0.29.0"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "7cc5be2deacb8a66432f97138b3f47ffd9284f34"
|
|
74
74
|
}
|
|
@@ -4,6 +4,9 @@ import {
|
|
|
4
4
|
IAppIndexView,
|
|
5
5
|
IAppDETabExplorerView,
|
|
6
6
|
IDEMultiEditViewPanel,
|
|
7
|
+
IPanelContainer,
|
|
8
|
+
IPanelItem,
|
|
9
|
+
IPanelRawItem,
|
|
7
10
|
} from '@ibiz/model-core';
|
|
8
11
|
import { clone } from 'ramda';
|
|
9
12
|
import { getControl } from '../../model';
|
|
@@ -85,6 +88,13 @@ export class LayoutPanelUtil {
|
|
|
85
88
|
layout.controls = viewModel.controls;
|
|
86
89
|
delete viewModel.controls;
|
|
87
90
|
}
|
|
91
|
+
if (
|
|
92
|
+
['DEMPICKUPVIEW', 'DEMPICKUPVIEW2', 'DEMOBMPICKUPVIEW'].includes(
|
|
93
|
+
viewModel.viewType!,
|
|
94
|
+
)
|
|
95
|
+
) {
|
|
96
|
+
this.replaceSimpleList(viewModel);
|
|
97
|
+
}
|
|
88
98
|
}
|
|
89
99
|
}
|
|
90
100
|
return viewModel;
|
|
@@ -189,4 +199,60 @@ export class LayoutPanelUtil {
|
|
|
189
199
|
}
|
|
190
200
|
return `${viewType}_${viewStyle}`;
|
|
191
201
|
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* @description 递归查找指定标识的面板项
|
|
205
|
+
* @protected
|
|
206
|
+
* @param {IPanelItem[]} items
|
|
207
|
+
* @param {string} id
|
|
208
|
+
* @returns {*} {(IPanelItem | undefined)}
|
|
209
|
+
* @memberof LayoutPanelUtil
|
|
210
|
+
*/
|
|
211
|
+
protected findPanelItem(
|
|
212
|
+
items: IPanelItem[],
|
|
213
|
+
id: string,
|
|
214
|
+
): IPanelItem | undefined {
|
|
215
|
+
for (let i = 0; i < items.length; i++) {
|
|
216
|
+
const item = items[i];
|
|
217
|
+
if (item.id === id) {
|
|
218
|
+
return item;
|
|
219
|
+
}
|
|
220
|
+
const children = (item as IPanelContainer).panelItems;
|
|
221
|
+
if (children?.length) {
|
|
222
|
+
const result = this.findPanelItem(children, id);
|
|
223
|
+
if (result) {
|
|
224
|
+
return result;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return undefined;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @description 替换简单列表部件占位
|
|
233
|
+
* @protected
|
|
234
|
+
* @param {IAppView} viewModel
|
|
235
|
+
* @memberof LayoutPanelUtil
|
|
236
|
+
*/
|
|
237
|
+
protected replaceSimpleList(viewModel: IAppView): void {
|
|
238
|
+
const layout = viewModel.viewLayoutPanel!;
|
|
239
|
+
const { controls = [] } = layout;
|
|
240
|
+
const simpleListControl = controls.find(
|
|
241
|
+
control => control.name === 'simplelist',
|
|
242
|
+
);
|
|
243
|
+
// 当simplelist部件不存在时替换为面板项
|
|
244
|
+
if (!simpleListControl) {
|
|
245
|
+
const simpleListItem = this.findPanelItem(
|
|
246
|
+
layout.rootPanelItems!,
|
|
247
|
+
'simplelist',
|
|
248
|
+
);
|
|
249
|
+
if (simpleListItem) {
|
|
250
|
+
simpleListItem.itemType = 'RAWITEM';
|
|
251
|
+
(simpleListItem as IPanelRawItem).rawItem = {
|
|
252
|
+
predefinedType: 'SIMPLELIST',
|
|
253
|
+
appId: simpleListItem.appId,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
192
258
|
}
|