@ibiz-template/runtime 0.5.7-alpha.4 → 0.5.7-alpha.6
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 +317 -194
- package/dist/index.system.min.js +1 -1
- package/out/controller/control/calendar/calendar.service.d.ts.map +1 -1
- package/out/controller/control/calendar/calendar.service.js +7 -1
- package/out/controller/control/search-bar/entity-schema.d.ts +1 -2
- package/out/controller/control/search-bar/entity-schema.d.ts.map +1 -1
- package/out/controller/control/search-bar/entity-schema.js +2 -2
- package/out/controller/control/search-bar/index.d.ts +2 -0
- package/out/controller/control/search-bar/index.d.ts.map +1 -1
- package/out/controller/control/search-bar/index.js +2 -0
- package/out/controller/control/search-bar/search-bar-filter.controller.d.ts +5 -6
- package/out/controller/control/search-bar/search-bar-filter.controller.d.ts.map +1 -1
- package/out/controller/control/search-bar/search-bar-filter.controller.js +6 -9
- package/out/controller/control/search-bar/search-bar.controller.d.ts +1 -24
- package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
- package/out/controller/control/search-bar/search-bar.controller.js +11 -88
- package/out/controller/control/search-bar/use-searchcond.d.ts +33 -0
- package/out/controller/control/search-bar/use-searchcond.d.ts.map +1 -0
- package/out/controller/control/search-bar/use-searchcond.js +91 -0
- package/out/controller/notification/internal-message.controller.d.ts +7 -0
- package/out/controller/notification/internal-message.controller.d.ts.map +1 -1
- package/out/controller/notification/internal-message.controller.js +17 -0
- package/out/engine/md-view.engine.d.ts +28 -0
- package/out/engine/md-view.engine.d.ts.map +1 -1
- package/out/engine/md-view.engine.js +53 -11
- package/out/engine/view-base.engine.d.ts +38 -0
- package/out/engine/view-base.engine.d.ts.map +1 -1
- package/out/engine/view-base.engine.js +99 -53
- package/out/interface/common/i-drawer-options/i-drawer-options.d.ts +2 -2
- package/out/interface/common/i-modal-options/i-modal-options.d.ts +2 -2
- package/out/interface/common/i-popover-options/i-popover-options.d.ts +10 -10
- package/out/interface/common/i-popover-options/i-popover-options.d.ts.map +1 -1
- package/out/interface/util/i-notification-util/i-notification-util.d.ts +7 -0
- package/out/interface/util/i-notification-util/i-notification-util.d.ts.map +1 -1
- package/out/service/service/auth/v7-auth.service.d.ts +8 -0
- package/out/service/service/auth/v7-auth.service.d.ts.map +1 -1
- package/out/service/service/auth/v7-auth.service.js +15 -0
- package/package.json +5 -5
- package/src/controller/control/calendar/calendar.service.ts +8 -2
- package/src/controller/control/search-bar/entity-schema.ts +4 -4
- package/src/controller/control/search-bar/index.ts +2 -0
- package/src/controller/control/search-bar/search-bar-filter.controller.ts +15 -10
- package/src/controller/control/search-bar/search-bar.controller.ts +24 -98
- package/src/controller/control/search-bar/use-searchcond.ts +100 -0
- package/src/controller/notification/internal-message.controller.ts +20 -1
- package/src/engine/md-view.engine.ts +59 -11
- package/src/engine/view-base.engine.ts +108 -51
- package/src/interface/common/i-drawer-options/i-drawer-options.ts +2 -2
- package/src/interface/common/i-modal-options/i-modal-options.ts +2 -2
- package/src/interface/common/i-popover-options/i-popover-options.ts +10 -10
- package/src/interface/util/i-notification-util/i-notification-util.ts +8 -0
- package/src/service/service/auth/v7-auth.service.ts +16 -1
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
RuntimeError,
|
|
3
|
-
mergeInLeft,
|
|
4
|
-
recursiveIterate,
|
|
5
|
-
} from '@ibiz-template/core';
|
|
1
|
+
import { mergeInLeft } from '@ibiz-template/core';
|
|
6
2
|
import { IAppDataEntity, ISearchBar, ISearchBarFilter } from '@ibiz/model-core';
|
|
7
|
-
import { clone
|
|
3
|
+
import { clone } from 'ramda';
|
|
8
4
|
import {
|
|
9
5
|
ISearchBarState,
|
|
10
6
|
ISearchBarEvent,
|
|
11
7
|
ISearchBarController,
|
|
12
|
-
IFilterNode,
|
|
13
8
|
IBackendSearchBarGroup,
|
|
14
9
|
IGridController,
|
|
15
10
|
} from '../../../interface';
|
|
@@ -19,6 +14,11 @@ import { SearchBarFilterController } from './search-bar-filter.controller';
|
|
|
19
14
|
import { SearchBarService } from './search-bar.service';
|
|
20
15
|
import { getEntitySchema } from '../../utils';
|
|
21
16
|
import { calcFilterModelBySchema } from './entity-schema';
|
|
17
|
+
import {
|
|
18
|
+
calcSearchConds,
|
|
19
|
+
getOriginFilterNodes,
|
|
20
|
+
parseFilters,
|
|
21
|
+
} from './use-searchcond';
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* 搜索栏控制器
|
|
@@ -106,7 +106,7 @@ export class SearchBarController
|
|
|
106
106
|
* @author lxm
|
|
107
107
|
* @date 2024-01-05 10:10:37
|
|
108
108
|
*/
|
|
109
|
-
addSchemaFilters =
|
|
109
|
+
addSchemaFilters = true;
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
112
|
* 表格控制器
|
|
@@ -184,7 +184,11 @@ export class SearchBarController
|
|
|
184
184
|
if (!json) {
|
|
185
185
|
return;
|
|
186
186
|
}
|
|
187
|
-
const addSearchBarFilters = await calcFilterModelBySchema(
|
|
187
|
+
const addSearchBarFilters = await calcFilterModelBySchema(
|
|
188
|
+
json,
|
|
189
|
+
this.model.appDataEntityId!,
|
|
190
|
+
this.model.appId,
|
|
191
|
+
);
|
|
188
192
|
|
|
189
193
|
const mergeFilters: ISearchBarFilter[] = [];
|
|
190
194
|
this.model.searchBarFilters?.forEach(filter => {
|
|
@@ -304,7 +308,7 @@ export class SearchBarController
|
|
|
304
308
|
* @date 2023-10-16 03:52:44
|
|
305
309
|
*/
|
|
306
310
|
resetFilter(): void {
|
|
307
|
-
this.state.filterNodes =
|
|
311
|
+
this.state.filterNodes = getOriginFilterNodes();
|
|
308
312
|
this.evt.emit('onSearch', undefined);
|
|
309
313
|
}
|
|
310
314
|
|
|
@@ -318,7 +322,12 @@ export class SearchBarController
|
|
|
318
322
|
protected async initSearchBarFilters(): Promise<void> {
|
|
319
323
|
if (this.searchBarFilters?.length) {
|
|
320
324
|
this.searchBarFilters.forEach(item => {
|
|
321
|
-
const filterController = new SearchBarFilterController(
|
|
325
|
+
const filterController = new SearchBarFilterController(
|
|
326
|
+
item,
|
|
327
|
+
this.appDataEntity,
|
|
328
|
+
this.context,
|
|
329
|
+
this.params,
|
|
330
|
+
);
|
|
322
331
|
this.filterControllers.push(filterController);
|
|
323
332
|
});
|
|
324
333
|
await Promise.all(
|
|
@@ -337,91 +346,8 @@ export class SearchBarController
|
|
|
337
346
|
if (!this.enableFilter) {
|
|
338
347
|
return;
|
|
339
348
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
recursiveIterate(this.state.filterNodes[0], (node: IFilterNode) => {
|
|
343
|
-
if (node.leaf) {
|
|
344
|
-
if (node.field && node.valueOP && !isNil(node.value)) {
|
|
345
|
-
hasFilter = true;
|
|
346
|
-
} else {
|
|
347
|
-
// 如果过滤项不给
|
|
348
|
-
hasError = true;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
if (hasFilter && !hasError) {
|
|
353
|
-
const filter = [this.formatFilters(this.state.filterNodes[0])];
|
|
354
|
-
return filter;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* 格式化过滤项 (后续如果修改这里的逻辑记得把下方的反推函数parseFilters也跟着修改!)
|
|
360
|
-
* @author lxm
|
|
361
|
-
* @date 2023-10-16 03:45:41
|
|
362
|
-
* @param {IFilterNode} node
|
|
363
|
-
* @return {*} {IData}
|
|
364
|
-
*/
|
|
365
|
-
formatFilters(node: IFilterNode): IData {
|
|
366
|
-
if (!node.leaf) {
|
|
367
|
-
return {
|
|
368
|
-
condtype: 'GROUP',
|
|
369
|
-
condop: node.logicType,
|
|
370
|
-
bnotmode: false,
|
|
371
|
-
searchconds: node.children.map(item => this.formatFilters(item)),
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
return {
|
|
376
|
-
condtype: 'DEFIELD',
|
|
377
|
-
fieldname: node.field,
|
|
378
|
-
condop: node.valueOP,
|
|
379
|
-
value: node.value,
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
/**
|
|
384
|
-
* 根据格式化后的过滤项反推出过滤项树节点数据集合
|
|
385
|
-
* @param {IData} data
|
|
386
|
-
* @return {*}
|
|
387
|
-
* @author: zhujiamin
|
|
388
|
-
* @Date: 2023-12-28 09:47:45
|
|
389
|
-
*/
|
|
390
|
-
parseFilters(data: IData): IFilterNode {
|
|
391
|
-
if (data.condtype === 'GROUP') {
|
|
392
|
-
return {
|
|
393
|
-
leaf: false,
|
|
394
|
-
logicType: data.condop === 'AND' ? 'AND' : 'OR',
|
|
395
|
-
children: (data.searchconds || []).map((item: IData) =>
|
|
396
|
-
this.parseFilters(item),
|
|
397
|
-
),
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
if (data.condtype === 'DEFIELD') {
|
|
401
|
-
return {
|
|
402
|
-
leaf: true,
|
|
403
|
-
field: data.fieldname || null,
|
|
404
|
-
valueOP: data.condop || null,
|
|
405
|
-
value: data.value || null,
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
|
-
throw new RuntimeError(`无效的condtype:${data.condtype}`);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
/**
|
|
412
|
-
* 获取初始过滤项树节点数据集合
|
|
413
|
-
* @return {*}
|
|
414
|
-
* @author: zhujiamin
|
|
415
|
-
* @Date: 2023-12-21 17:29:47
|
|
416
|
-
*/
|
|
417
|
-
protected getOriginFilterNodes(): IFilterNode[] {
|
|
418
|
-
return [
|
|
419
|
-
{
|
|
420
|
-
leaf: false,
|
|
421
|
-
logicType: 'AND',
|
|
422
|
-
children: [{ leaf: true, field: null, valueOP: null, value: null }],
|
|
423
|
-
},
|
|
424
|
-
];
|
|
349
|
+
const searchconds = calcSearchConds(this.state.filterNodes);
|
|
350
|
+
return searchconds;
|
|
425
351
|
}
|
|
426
352
|
|
|
427
353
|
/**
|
|
@@ -611,11 +537,11 @@ export class SearchBarController
|
|
|
611
537
|
) {
|
|
612
538
|
// 根据后台标准的searchconds计算出 前端回显的树形结构FilterNodes
|
|
613
539
|
const filterNodes = groupItem.searchGroupData.searchconds.map(item =>
|
|
614
|
-
|
|
540
|
+
parseFilters(item),
|
|
615
541
|
);
|
|
616
542
|
this.state.filterNodes = filterNodes;
|
|
617
543
|
} else {
|
|
618
|
-
this.state.filterNodes =
|
|
544
|
+
this.state.filterNodes = getOriginFilterNodes();
|
|
619
545
|
}
|
|
620
546
|
if (this.grid && groupItem && groupItem.searchGroupData) {
|
|
621
547
|
this.grid.setGroupParams(groupItem.searchGroupData);
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { RuntimeError, recursiveIterate } from '@ibiz-template/core';
|
|
2
|
+
import { isNil } from 'ramda';
|
|
3
|
+
import { IFilterNode } from '../../../interface';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 获取初始过滤项树节点数据集合
|
|
7
|
+
* @return {*}
|
|
8
|
+
* @author: zhujiamin
|
|
9
|
+
* @Date: 2023-12-21 17:29:47
|
|
10
|
+
*/
|
|
11
|
+
export function getOriginFilterNodes(): IFilterNode[] {
|
|
12
|
+
return [
|
|
13
|
+
{
|
|
14
|
+
leaf: false,
|
|
15
|
+
logicType: 'AND',
|
|
16
|
+
children: [{ leaf: true, field: null, valueOP: null, value: null }],
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 格式化过滤项 (后续如果修改这里的逻辑记得把下方的反推函数parseFilters也跟着修改!)
|
|
23
|
+
* @author lxm
|
|
24
|
+
* @date 2023-10-16 03:45:41
|
|
25
|
+
* @param {IFilterNode} node
|
|
26
|
+
* @return {*} {IData}
|
|
27
|
+
*/
|
|
28
|
+
export function formatFilters(node: IFilterNode): IData {
|
|
29
|
+
if (!node.leaf) {
|
|
30
|
+
return {
|
|
31
|
+
condtype: 'GROUP',
|
|
32
|
+
condop: node.logicType,
|
|
33
|
+
bnotmode: false,
|
|
34
|
+
searchconds: node.children.map(item => formatFilters(item)),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
condtype: 'DEFIELD',
|
|
40
|
+
fieldname: node.field,
|
|
41
|
+
condop: node.valueOP,
|
|
42
|
+
value: node.value,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 根据格式化后的过滤项反推出过滤项树节点数据集合
|
|
48
|
+
* @param {IData} data
|
|
49
|
+
* @return {*}
|
|
50
|
+
* @author: zhujiamin
|
|
51
|
+
* @Date: 2023-12-28 09:47:45
|
|
52
|
+
*/
|
|
53
|
+
export function parseFilters(data: IData): IFilterNode {
|
|
54
|
+
if (data.condtype === 'GROUP') {
|
|
55
|
+
return {
|
|
56
|
+
leaf: false,
|
|
57
|
+
logicType: data.condop === 'AND' ? 'AND' : 'OR',
|
|
58
|
+
children: (data.searchconds || []).map((item: IData) =>
|
|
59
|
+
parseFilters(item),
|
|
60
|
+
),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
if (data.condtype === 'DEFIELD') {
|
|
64
|
+
return {
|
|
65
|
+
leaf: true,
|
|
66
|
+
field: data.fieldname || null,
|
|
67
|
+
valueOP: data.condop || null,
|
|
68
|
+
value: data.value || null,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
throw new RuntimeError(`无效的condtype:${data.condtype}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 根据filterNodes计算出SearchConds
|
|
76
|
+
* @param {IData} data
|
|
77
|
+
* @return {*}
|
|
78
|
+
* @author: zhujiamin
|
|
79
|
+
* @Date: 2023-12-28 09:47:45
|
|
80
|
+
*/
|
|
81
|
+
export function calcSearchConds(
|
|
82
|
+
filterNodes: IFilterNode[],
|
|
83
|
+
): IData[] | undefined {
|
|
84
|
+
let hasFilter = false; // 是否有过滤项
|
|
85
|
+
let hasError = false; // 是否有过滤项格式不正确
|
|
86
|
+
recursiveIterate(filterNodes[0], (node: IFilterNode) => {
|
|
87
|
+
if (node.leaf) {
|
|
88
|
+
if (node.field && node.valueOP && !isNil(node.value)) {
|
|
89
|
+
hasFilter = true;
|
|
90
|
+
} else {
|
|
91
|
+
// 如果过滤项不给
|
|
92
|
+
hasError = true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
if (hasFilter && !hasError) {
|
|
97
|
+
const filter = [formatFilters(filterNodes[0])];
|
|
98
|
+
return filter;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IInternalMessage } from '@ibiz-template/core';
|
|
1
|
+
import { IInternalMessage, IPortalMessage } from '@ibiz-template/core';
|
|
2
2
|
import { QXEvent } from 'qx-util';
|
|
3
3
|
import {
|
|
4
4
|
IInternalMessageController,
|
|
@@ -27,6 +27,7 @@ export class InternalMessageController implements IInternalMessageController {
|
|
|
27
27
|
|
|
28
28
|
async init(): Promise<void> {
|
|
29
29
|
this.load();
|
|
30
|
+
this.listenMqtt();
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
async load(): Promise<void> {
|
|
@@ -61,4 +62,22 @@ export class InternalMessageController implements IInternalMessageController {
|
|
|
61
62
|
}
|
|
62
63
|
this.evt.emit('dataChange');
|
|
63
64
|
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 监听mqtt消息
|
|
68
|
+
* @author lxm
|
|
69
|
+
* @date 2024-01-30 01:53:44
|
|
70
|
+
* @protected
|
|
71
|
+
*/
|
|
72
|
+
protected listenMqtt(): void {
|
|
73
|
+
ibiz.mc.command.internalMessage.on(async (msg: IPortalMessage) => {
|
|
74
|
+
ibiz.log.debug('mqtt internalMessage: ', msg);
|
|
75
|
+
if (msg.subtype !== 'INTERNALMESSAGE') {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// todo 目前会有一种情况,不带data,弹右下角消息提示
|
|
80
|
+
ibiz.notification.info({ desc: msg.content, position: 'bottom-right' });
|
|
81
|
+
});
|
|
82
|
+
}
|
|
64
83
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RuntimeModelError } from '@ibiz-template/core';
|
|
2
|
-
import { IAppDEMultiDataView } from '@ibiz/model-core';
|
|
2
|
+
import { IAppDEMultiDataView, ISearchBar } from '@ibiz/model-core';
|
|
3
3
|
import { clone } from 'ramda';
|
|
4
4
|
import { SysUIActionTag, ViewCallTag } from '../constant';
|
|
5
5
|
import { ViewController } from '../controller';
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
EventBase,
|
|
15
15
|
IUIActionResult,
|
|
16
16
|
} from '../interface';
|
|
17
|
-
import { calcDeCodeNameById } from '../model';
|
|
17
|
+
import { calcDeCodeNameById, getControl } from '../model';
|
|
18
18
|
import { ViewEngineBase } from './view-base.engine';
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -398,18 +398,46 @@ export class MDViewEngine extends ViewEngineBase {
|
|
|
398
398
|
this.newData(Object.assign(args, { copyMode: true }));
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
+
/**
|
|
402
|
+
* 计算头部显示
|
|
403
|
+
*
|
|
404
|
+
* @author zk
|
|
405
|
+
* @date 2024-01-29 05:01:30
|
|
406
|
+
* @protected
|
|
407
|
+
* @return {*} {boolean}
|
|
408
|
+
* @memberof MDViewEngine
|
|
409
|
+
*/
|
|
401
410
|
protected calcViewHeaderVisible(): boolean {
|
|
402
|
-
|
|
411
|
+
const showHeader = super.calcViewHeaderVisible();
|
|
403
412
|
// 搜索栏
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
413
|
+
const visible = this.calcViewSearchBarVisible();
|
|
414
|
+
return visible || showHeader;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* 计算搜索栏显示
|
|
419
|
+
*
|
|
420
|
+
* @author zk
|
|
421
|
+
* @date 2024-01-29 05:01:36
|
|
422
|
+
* @protected
|
|
423
|
+
* @return {*} {boolean}
|
|
424
|
+
* @memberof MDViewEngine
|
|
425
|
+
*/
|
|
426
|
+
protected calcViewSearchBarVisible(): boolean {
|
|
427
|
+
const { model } = this.view;
|
|
428
|
+
// 搜索栏
|
|
429
|
+
|
|
430
|
+
const has: boolean = this.isExistAndInLayout('searchbar');
|
|
431
|
+
if (!has) {
|
|
432
|
+
return has;
|
|
411
433
|
}
|
|
412
|
-
|
|
434
|
+
const searchBar: ISearchBar = getControl(model, 'searchbar')!;
|
|
435
|
+
const visible = !!(
|
|
436
|
+
searchBar.enableQuickSearch ||
|
|
437
|
+
searchBar.enableGroup ||
|
|
438
|
+
searchBar.enableFilter === true
|
|
439
|
+
);
|
|
440
|
+
return visible;
|
|
413
441
|
}
|
|
414
442
|
|
|
415
443
|
/**
|
|
@@ -427,4 +455,24 @@ export class MDViewEngine extends ViewEngineBase {
|
|
|
427
455
|
}
|
|
428
456
|
}
|
|
429
457
|
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* 计算移除的模型名称
|
|
461
|
+
*
|
|
462
|
+
* @author zk
|
|
463
|
+
* @date 2024-01-29 03:01:42
|
|
464
|
+
* @return {*} {string[]}
|
|
465
|
+
* @memberof MDViewEngine
|
|
466
|
+
*/
|
|
467
|
+
calcRemoveLayoutModel(): string[] {
|
|
468
|
+
const { model } = this.view;
|
|
469
|
+
const names = super.calcRemoveLayoutModel();
|
|
470
|
+
if (!getControl(model, 'searchform')) {
|
|
471
|
+
names.push('searchform');
|
|
472
|
+
}
|
|
473
|
+
if (!this.calcViewSearchBarVisible()) {
|
|
474
|
+
names.push('view_searchbar');
|
|
475
|
+
}
|
|
476
|
+
return names;
|
|
477
|
+
}
|
|
430
478
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { RuntimeError } from '@ibiz-template/core';
|
|
1
|
+
import { RuntimeError, findRecursiveChild } from '@ibiz-template/core';
|
|
2
|
+
import { IPanel, IPanelContainer } from '@ibiz/model-core';
|
|
2
3
|
import { ViewCallTag } from '../constant';
|
|
3
4
|
import {
|
|
4
5
|
IViewController,
|
|
@@ -6,6 +7,7 @@ import {
|
|
|
6
7
|
IViewLayoutPanelController,
|
|
7
8
|
} from '../interface';
|
|
8
9
|
import { IViewEngine } from '../interface/engine';
|
|
10
|
+
import { getControl } from '../model';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* 视图引擎基类
|
|
@@ -88,31 +90,90 @@ export class ViewEngineBase implements IViewEngine {
|
|
|
88
90
|
async onCreated(): Promise<void> {
|
|
89
91
|
const { childNames } = this.view;
|
|
90
92
|
childNames.push('captionbar', 'toolbar');
|
|
93
|
+
this.calcDynamicLayout();
|
|
91
94
|
}
|
|
92
95
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
/**
|
|
97
|
+
* 计算动态布局模型
|
|
98
|
+
*
|
|
99
|
+
* @author zk
|
|
100
|
+
* @date 2024-01-29 02:01:47
|
|
101
|
+
* @memberof ViewEngineBase
|
|
102
|
+
*/
|
|
103
|
+
protected calcDynamicLayout(): void {
|
|
104
|
+
const names = this.calcRemoveLayoutModel();
|
|
105
|
+
ibiz.log.debug(`${this.view.model.codeName}删除模型:${names.join(';')}`);
|
|
106
|
+
this.removeLayoutModel(names);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* 计算移除的模型名称
|
|
111
|
+
*
|
|
112
|
+
* @author zk
|
|
113
|
+
* @date 2024-01-29 02:01:21
|
|
114
|
+
* @return {*} {string[]}
|
|
115
|
+
* @memberof ViewEngineBase
|
|
116
|
+
*/
|
|
117
|
+
protected calcRemoveLayoutModel(): string[] {
|
|
118
|
+
const { model } = this.view;
|
|
119
|
+
const names = [];
|
|
97
120
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
121
|
+
if (model.showCaptionBar === false) {
|
|
122
|
+
names.push('view_captionbar');
|
|
123
|
+
}
|
|
124
|
+
if (!getControl(model, 'toolbar')) {
|
|
125
|
+
names.push('view_toolbar', 'toolbar');
|
|
126
|
+
}
|
|
127
|
+
const toolBarList = ['lefttoolbar', 'righttoolbar', 'footertoolbar'];
|
|
128
|
+
toolBarList.forEach(name => {
|
|
129
|
+
if (!getControl(model, name)) {
|
|
130
|
+
names.push(name);
|
|
103
131
|
}
|
|
132
|
+
});
|
|
133
|
+
if (!this.calcViewHeaderVisible()) {
|
|
134
|
+
names.push('view_header');
|
|
135
|
+
}
|
|
136
|
+
if (!this.calcViewFooterVisible()) {
|
|
137
|
+
names.push('view_footer');
|
|
104
138
|
}
|
|
139
|
+
return names;
|
|
140
|
+
}
|
|
105
141
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
142
|
+
/**
|
|
143
|
+
* 删除布局模型
|
|
144
|
+
*
|
|
145
|
+
* @author zk
|
|
146
|
+
* @date 2024-01-29 02:01:29
|
|
147
|
+
* @param {string[]} names
|
|
148
|
+
* @param {(IPanelContainer | undefined)} [container=this.view.model.viewLayoutPanel]
|
|
149
|
+
* @return {*} {void}
|
|
150
|
+
* @memberof ViewEngineBase
|
|
151
|
+
*/
|
|
152
|
+
private removeLayoutModel(
|
|
153
|
+
names: string[],
|
|
154
|
+
container: IPanelContainer | undefined = this.view.model.viewLayoutPanel,
|
|
155
|
+
): void {
|
|
156
|
+
if (!container) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const items =
|
|
160
|
+
(container as IPanel)!.rootPanelItems || container.panelItems || [];
|
|
161
|
+
const index = items.findIndex(item => names.includes(item.id!));
|
|
162
|
+
if (index !== -1) {
|
|
163
|
+
items.splice(index, 1);
|
|
115
164
|
}
|
|
165
|
+
// 过滤深层的子成员
|
|
166
|
+
items.forEach(item => {
|
|
167
|
+
if (item.itemType === 'CONTAINER') {
|
|
168
|
+
this.removeLayoutModel(names, item);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
async onMounted(): Promise<void> {
|
|
174
|
+
// 子类重写
|
|
175
|
+
const { model, childNames } = this.view;
|
|
176
|
+
ibiz.log.debug(`${model.id}的子组件:${childNames.join(';')}都已mounted`);
|
|
116
177
|
}
|
|
117
178
|
|
|
118
179
|
async onDestroyed(): Promise<void> {
|
|
@@ -159,49 +220,46 @@ export class ViewEngineBase implements IViewEngine {
|
|
|
159
220
|
const { model } = this.view;
|
|
160
221
|
|
|
161
222
|
// 标题栏
|
|
162
|
-
if (model.showCaptionBar
|
|
163
|
-
// 隐藏标题栏容器
|
|
164
|
-
const controller = this.viewLayoutPanel?.panelItems.view_captionbar;
|
|
165
|
-
if (controller) {
|
|
166
|
-
controller.state.visible = false;
|
|
167
|
-
}
|
|
168
|
-
} else {
|
|
223
|
+
if (model.showCaptionBar) {
|
|
169
224
|
showHeader = true;
|
|
170
225
|
}
|
|
171
|
-
|
|
172
226
|
if (ibiz.env.isMob) {
|
|
173
|
-
if (
|
|
174
|
-
// 隐藏左工具栏
|
|
175
|
-
const controller = this.viewLayoutPanel?.panelItems.lefttoolbar;
|
|
176
|
-
if (controller) {
|
|
177
|
-
controller.state.visible = false;
|
|
178
|
-
}
|
|
179
|
-
} else {
|
|
227
|
+
if (this.isExistAndInLayout('lefttoolbar')) {
|
|
180
228
|
showHeader = true;
|
|
181
229
|
}
|
|
182
230
|
|
|
183
|
-
if (
|
|
184
|
-
// 隐藏右工具栏
|
|
185
|
-
const controller = this.viewLayoutPanel?.panelItems.righttoolbar;
|
|
186
|
-
if (controller) {
|
|
187
|
-
controller.state.visible = false;
|
|
188
|
-
}
|
|
189
|
-
} else {
|
|
231
|
+
if (this.isExistAndInLayout('righttoolbar')) {
|
|
190
232
|
showHeader = true;
|
|
191
233
|
}
|
|
192
|
-
} else if (
|
|
193
|
-
// 隐藏工具栏容器
|
|
194
|
-
const controller = this.viewLayoutPanel?.panelItems.view_toolbar;
|
|
195
|
-
if (controller) {
|
|
196
|
-
controller.state.visible = false;
|
|
197
|
-
}
|
|
198
|
-
} else {
|
|
234
|
+
} else if (this.isExistAndInLayout('toolbar')) {
|
|
199
235
|
showHeader = true;
|
|
200
236
|
}
|
|
201
|
-
|
|
202
237
|
return showHeader;
|
|
203
238
|
}
|
|
204
239
|
|
|
240
|
+
/**
|
|
241
|
+
* 是否存在模型 并且 布局中有占位
|
|
242
|
+
*
|
|
243
|
+
* @author zk
|
|
244
|
+
* @date 2024-01-30 11:01:33
|
|
245
|
+
* @param {string} name
|
|
246
|
+
* @return {*} {(IData | undefined)}
|
|
247
|
+
* @memberof ViewEngineBase
|
|
248
|
+
*/
|
|
249
|
+
isExistAndInLayout(name: string): boolean {
|
|
250
|
+
const layout = this.view.model.viewLayoutPanel;
|
|
251
|
+
if (!layout) {
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
const ins = findRecursiveChild(layout, name, {
|
|
255
|
+
compareField: 'id',
|
|
256
|
+
childrenFields: ['panelItems', 'rootPanelItems'],
|
|
257
|
+
});
|
|
258
|
+
const { model } = this.view;
|
|
259
|
+
const has = getControl(model, name);
|
|
260
|
+
return !!(ins && has);
|
|
261
|
+
}
|
|
262
|
+
|
|
205
263
|
/**
|
|
206
264
|
* 计算底部的显示与否
|
|
207
265
|
* @author lxm
|
|
@@ -213,10 +271,9 @@ export class ViewEngineBase implements IViewEngine {
|
|
|
213
271
|
let showFooter: boolean = false;
|
|
214
272
|
|
|
215
273
|
// 工具栏
|
|
216
|
-
if (this.
|
|
274
|
+
if (this.isExistAndInLayout('footertoolbar')) {
|
|
217
275
|
showFooter = true;
|
|
218
276
|
}
|
|
219
|
-
|
|
220
277
|
return showFooter;
|
|
221
278
|
}
|
|
222
279
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface IDrawerOptions {
|
|
2
2
|
/**
|
|
3
3
|
* 抽屉宽度
|
|
4
|
-
*
|
|
4
|
+
* 左、右方向时可用。0-100的时候算百分比,100以上算像素px
|
|
5
5
|
*
|
|
6
6
|
* @author lxm
|
|
7
7
|
* @date 2022-09-12 20:09:20
|
|
@@ -10,7 +10,7 @@ export interface IDrawerOptions {
|
|
|
10
10
|
width?: number;
|
|
11
11
|
/**
|
|
12
12
|
* 抽屉高度
|
|
13
|
-
*
|
|
13
|
+
* 上、下方向时可用。0-100的时候算百分比,100以上算像素px
|
|
14
14
|
*
|
|
15
15
|
* @author lxm
|
|
16
16
|
* @date 2022-09-12 20:09:22
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export interface IModalOptions {
|
|
2
2
|
/**
|
|
3
|
-
* 宽度
|
|
3
|
+
* 宽度 数字0-100的时候算百分比,100以上算像素px,字符串原样设置
|
|
4
4
|
*
|
|
5
5
|
* @author lxm
|
|
6
6
|
* @date 2022-09-12 20:09:20
|
|
@@ -8,7 +8,7 @@ export interface IModalOptions {
|
|
|
8
8
|
*/
|
|
9
9
|
width?: string | number;
|
|
10
10
|
/**
|
|
11
|
-
* 高度
|
|
11
|
+
* 高度 数字0-100的时候算百分比,100以上算像素px,字符串原样设置
|
|
12
12
|
*
|
|
13
13
|
* @author lxm
|
|
14
14
|
* @date 2022-09-12 20:09:22
|
|
@@ -32,21 +32,21 @@ interface AxesOffsets {
|
|
|
32
32
|
*/
|
|
33
33
|
export interface IPopoverOptions<O = unknown> {
|
|
34
34
|
/**
|
|
35
|
-
* 宽度
|
|
35
|
+
* 宽度 数字0-100的时候算百分比,100以上算像素px,字符串原样设置
|
|
36
36
|
*
|
|
37
|
-
* @author
|
|
38
|
-
* @date 2022-
|
|
39
|
-
* @type {string}
|
|
37
|
+
* @author lxm
|
|
38
|
+
* @date 2022-09-12 20:09:20
|
|
39
|
+
* @type {string | number}
|
|
40
40
|
*/
|
|
41
|
-
width?: string;
|
|
41
|
+
width?: string | number;
|
|
42
42
|
/**
|
|
43
|
-
* 高度
|
|
43
|
+
* 高度 数字0-100的时候算百分比,100以上算像素px,字符串原样设置
|
|
44
44
|
*
|
|
45
|
-
* @author
|
|
46
|
-
* @date 2022-
|
|
47
|
-
* @type {string}
|
|
45
|
+
* @author lxm
|
|
46
|
+
* @date 2022-09-12 20:09:22
|
|
47
|
+
* @type {string | number}
|
|
48
48
|
*/
|
|
49
|
-
height?: string;
|
|
49
|
+
height?: string | number;
|
|
50
50
|
/**
|
|
51
51
|
* 展示方向
|
|
52
52
|
*
|