@ibiz-template/runtime 0.5.0-beta.3 → 0.5.0-beta.5
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 +1254 -714
- package/dist/index.system.min.js +1 -4
- package/out/controller/common/control/md-control.controller.d.ts +10 -0
- package/out/controller/common/control/md-control.controller.d.ts.map +1 -1
- package/out/controller/common/control/md-control.controller.js +37 -0
- package/out/controller/control/app-menu/app-menu.controller.d.ts +34 -1
- package/out/controller/control/app-menu/app-menu.controller.d.ts.map +1 -1
- package/out/controller/control/app-menu/app-menu.controller.js +47 -5
- package/out/controller/control/data-view/data-view.controller.d.ts +8 -7
- package/out/controller/control/data-view/data-view.controller.d.ts.map +1 -1
- package/out/controller/control/data-view/data-view.controller.js +9 -21
- package/out/controller/control/form/edit-form/edit-form.controller.d.ts +20 -0
- package/out/controller/control/form/edit-form/edit-form.controller.d.ts.map +1 -1
- package/out/controller/control/form/edit-form/edit-form.controller.js +53 -8
- package/out/controller/control/gantt/gantt.controller.d.ts.map +1 -1
- package/out/controller/control/gantt/gantt.controller.js +3 -3
- package/out/controller/control/grid/grid/entity-schema.d.ts +16 -0
- package/out/controller/control/grid/grid/entity-schema.d.ts.map +1 -0
- package/out/controller/control/grid/grid/entity-schema.js +81 -0
- package/out/controller/control/grid/grid/grid.controller.d.ts +24 -0
- package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
- package/out/controller/control/grid/grid/grid.controller.js +59 -15
- package/out/controller/control/grid/grid/grid.service.js +1 -1
- package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.js +1 -1
- package/out/controller/control/list/list.controller.d.ts +8 -7
- package/out/controller/control/list/list.controller.d.ts.map +1 -1
- package/out/controller/control/list/list.controller.js +9 -21
- package/out/controller/control/md-ctrl/md-ctrl.controller.d.ts +0 -9
- package/out/controller/control/md-ctrl/md-ctrl.controller.d.ts.map +1 -1
- package/out/controller/control/md-ctrl/md-ctrl.controller.js +0 -23
- package/out/controller/control/search-bar/entity-schema.d.ts +13 -0
- package/out/controller/control/search-bar/entity-schema.d.ts.map +1 -0
- package/out/controller/control/search-bar/entity-schema.js +151 -0
- package/out/controller/control/search-bar/search-bar-filter.controller.d.ts +9 -0
- 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 +26 -6
- package/out/controller/control/search-bar/search-bar.controller.d.ts +38 -2
- package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
- package/out/controller/control/search-bar/search-bar.controller.js +89 -19
- package/out/controller/control/tree/tree.controller.d.ts +13 -5
- package/out/controller/control/tree/tree.controller.d.ts.map +1 -1
- package/out/controller/control/tree/tree.controller.js +39 -22
- package/out/controller/control/tree-grid-ex/tree-grid-ex.controller.d.ts.map +1 -1
- package/out/controller/control/tree-grid-ex/tree-grid-ex.controller.js +2 -1
- package/out/controller/utils/index.d.ts +1 -0
- package/out/controller/utils/index.d.ts.map +1 -1
- package/out/controller/utils/index.js +1 -0
- package/out/controller/utils/jsonschema/entity.d.ts +11 -0
- package/out/controller/utils/jsonschema/entity.d.ts.map +1 -0
- package/out/controller/utils/jsonschema/entity.js +16 -0
- package/out/controller/utils/jsonschema/index.d.ts +2 -0
- package/out/controller/utils/jsonschema/index.d.ts.map +1 -0
- package/out/controller/utils/jsonschema/index.js +1 -0
- package/out/global/global-util/global-util.d.ts +1 -2
- package/out/global/global-util/global-util.d.ts.map +1 -1
- package/out/global/global-util/global-util.js +1 -2
- package/out/interface/controller/state/control/i-search-bar.state.d.ts +1 -5
- package/out/interface/controller/state/control/i-search-bar.state.d.ts.map +1 -1
- package/out/interface/provider/i-app-menu-item.provider.d.ts +31 -0
- package/out/interface/provider/i-app-menu-item.provider.d.ts.map +1 -0
- package/out/interface/provider/i-app-menu-item.provider.js +1 -0
- package/out/interface/provider/index.d.ts +1 -0
- package/out/interface/provider/index.d.ts.map +1 -1
- package/out/register/helper/app-menu-item-register.d.ts +25 -0
- package/out/register/helper/app-menu-item-register.d.ts.map +1 -0
- package/out/register/helper/app-menu-item-register.js +52 -0
- package/out/register/helper/index.d.ts +1 -0
- package/out/register/helper/index.d.ts.map +1 -1
- package/out/register/helper/index.js +1 -0
- package/out/service/de-service-util.js +1 -1
- package/out/service/service/entity/method/de-action.d.ts +11 -0
- package/out/service/service/entity/method/de-action.d.ts.map +1 -1
- package/out/service/service/entity/method/de-action.js +31 -4
- package/out/service/utils/de-cache/de-cache.d.ts.map +1 -1
- package/out/service/utils/de-cache/de-cache.js +3 -0
- 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/open-redirect-view/open-redirect-view.d.ts +17 -4
- package/out/utils/open-redirect-view/open-redirect-view.d.ts.map +1 -1
- package/out/utils/open-redirect-view/open-redirect-view.js +20 -4
- package/package.json +6 -6
- package/src/controller/common/control/md-control.controller.ts +46 -0
- package/src/controller/control/app-menu/app-menu.controller.ts +64 -6
- package/src/controller/control/data-view/data-view.controller.ts +12 -19
- package/src/controller/control/form/edit-form/edit-form.controller.ts +51 -7
- package/src/controller/control/gantt/gantt.controller.ts +3 -3
- package/src/controller/control/grid/grid/entity-schema.ts +105 -0
- package/src/controller/control/grid/grid/grid.controller.ts +77 -13
- package/src/controller/control/grid/grid/grid.service.ts +1 -1
- package/src/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.ts +1 -1
- package/src/controller/control/list/list.controller.ts +12 -19
- package/src/controller/control/md-ctrl/md-ctrl.controller.ts +0 -22
- package/src/controller/control/search-bar/entity-schema.ts +178 -0
- package/src/controller/control/search-bar/search-bar-filter.controller.ts +32 -9
- package/src/controller/control/search-bar/search-bar.controller.ts +114 -20
- package/src/controller/control/tree/tree.controller.ts +62 -26
- package/src/controller/control/tree-grid-ex/tree-grid-ex.controller.ts +2 -2
- package/src/controller/utils/index.ts +1 -0
- package/src/controller/utils/jsonschema/entity.ts +19 -0
- package/src/controller/utils/jsonschema/index.ts +1 -0
- package/src/global/global-util/global-util.ts +1 -3
- package/src/interface/controller/state/control/i-search-bar.state.ts +1 -6
- package/src/interface/provider/i-app-menu-item.provider.ts +40 -0
- package/src/interface/provider/index.ts +1 -0
- package/src/register/helper/app-menu-item-register.ts +65 -0
- package/src/register/helper/index.ts +1 -0
- package/src/service/de-service-util.ts +1 -1
- package/src/service/service/entity/method/de-action.ts +44 -4
- package/src/service/utils/de-cache/de-cache.ts +3 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/open-redirect-view/open-redirect-view.ts +31 -4
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
RuntimeError,
|
|
3
|
+
mergeInLeft,
|
|
4
|
+
recursiveIterate,
|
|
5
|
+
} from '@ibiz-template/core';
|
|
6
|
+
import { IAppDataEntity, ISearchBar, ISearchBarFilter } from '@ibiz/model-core';
|
|
3
7
|
import { isNil } from 'ramda';
|
|
4
8
|
import {
|
|
5
9
|
ISearchBarState,
|
|
@@ -13,6 +17,8 @@ import { convertNavData, ScriptFactory } from '../../../utils';
|
|
|
13
17
|
import { ControlController } from '../../common';
|
|
14
18
|
import { SearchBarFilterController } from './search-bar-filter.controller';
|
|
15
19
|
import { SearchBarService } from './search-bar.service';
|
|
20
|
+
import { getEntitySchema } from '../../utils';
|
|
21
|
+
import { calcFilterModelBySchema } from './entity-schema';
|
|
16
22
|
|
|
17
23
|
/**
|
|
18
24
|
* 搜索栏控制器
|
|
@@ -67,6 +73,22 @@ export class SearchBarController
|
|
|
67
73
|
*/
|
|
68
74
|
isBackendSearchGroup = this.model.searchBarStyle === 'SEARCHBAR2';
|
|
69
75
|
|
|
76
|
+
/**
|
|
77
|
+
* 启用自定义过滤项
|
|
78
|
+
* @author lxm
|
|
79
|
+
* @date 2023-12-29 04:15:34
|
|
80
|
+
* @type {boolean}
|
|
81
|
+
*/
|
|
82
|
+
enableFilter: boolean = this.model.enableFilter === true;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* 最终使用的searchBarFilters
|
|
86
|
+
* @author lxm
|
|
87
|
+
* @date 2023-12-29 06:55:13
|
|
88
|
+
* @type {ISearchBarFilter[]}
|
|
89
|
+
*/
|
|
90
|
+
searchBarFilters!: ISearchBarFilter[];
|
|
91
|
+
|
|
70
92
|
/**
|
|
71
93
|
* 表格控制器
|
|
72
94
|
* @return {*}
|
|
@@ -89,16 +111,24 @@ export class SearchBarController
|
|
|
89
111
|
super.initState();
|
|
90
112
|
this.state.query = '';
|
|
91
113
|
this.state.selectedGroupItem = null;
|
|
114
|
+
this.state.searchBarGroups = [];
|
|
115
|
+
this.state.selectedSearchGroupItem = null;
|
|
116
|
+
this.initFilterState();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* 初始化Filter相关的属性
|
|
121
|
+
* @author lxm
|
|
122
|
+
* @date 2023-12-29 04:18:02
|
|
123
|
+
* @protected
|
|
124
|
+
*/
|
|
125
|
+
protected initFilterState(): void {
|
|
126
|
+
this.resetFilter();
|
|
92
127
|
this.state.visible = !!(
|
|
93
128
|
this.model.enableQuickSearch ||
|
|
94
129
|
this.model.enableGroup ||
|
|
95
|
-
this.
|
|
130
|
+
this.enableFilter
|
|
96
131
|
);
|
|
97
|
-
if (this.model.enableFilter) {
|
|
98
|
-
this.resetFilter();
|
|
99
|
-
}
|
|
100
|
-
this.state.searchBarGroups = [];
|
|
101
|
-
this.state.selectedSearchGroupItem = null;
|
|
102
132
|
}
|
|
103
133
|
|
|
104
134
|
protected async onCreated(): Promise<void> {
|
|
@@ -119,10 +149,44 @@ export class SearchBarController
|
|
|
119
149
|
await this.service.init(this.context);
|
|
120
150
|
}
|
|
121
151
|
|
|
152
|
+
await this.initByEntitySchema();
|
|
122
153
|
await this.initSearchBarFilters();
|
|
123
154
|
await this.initSearBarGroups();
|
|
124
155
|
}
|
|
125
156
|
|
|
157
|
+
/**
|
|
158
|
+
* 根据实体jsonschema初始化
|
|
159
|
+
* @author lxm
|
|
160
|
+
* @date 2023-12-29 04:21:31
|
|
161
|
+
* @return {*} {Promise<void>}
|
|
162
|
+
*/
|
|
163
|
+
async initByEntitySchema(): Promise<void> {
|
|
164
|
+
this.enableFilter = true;
|
|
165
|
+
const json = await getEntitySchema(this.appDataEntity.id!, this.context);
|
|
166
|
+
if (!json) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const addSearchBarFilters = calcFilterModelBySchema(json, this);
|
|
170
|
+
|
|
171
|
+
const mergeFilters: ISearchBarFilter[] = [];
|
|
172
|
+
this.model.searchBarFilters?.forEach(filter => {
|
|
173
|
+
const findindex = addSearchBarFilters.findIndex(
|
|
174
|
+
item =>
|
|
175
|
+
item.appDEFieldId === filter.appDEFieldId &&
|
|
176
|
+
(filter.defsearchMode?.valueOP
|
|
177
|
+
? item.defsearchMode!.valueOP === filter.defsearchMode.valueOP
|
|
178
|
+
: true),
|
|
179
|
+
);
|
|
180
|
+
if (findindex === -1) {
|
|
181
|
+
mergeFilters.push(filter);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
addSearchBarFilters.push(...mergeFilters);
|
|
186
|
+
|
|
187
|
+
this.searchBarFilters = addSearchBarFilters;
|
|
188
|
+
}
|
|
189
|
+
|
|
126
190
|
/**
|
|
127
191
|
* 计算快速搜索的占位
|
|
128
192
|
* @author lxm
|
|
@@ -229,8 +293,8 @@ export class SearchBarController
|
|
|
229
293
|
* @return {*} {Promise<void>}
|
|
230
294
|
*/
|
|
231
295
|
protected async initSearchBarFilters(): Promise<void> {
|
|
232
|
-
if (this.
|
|
233
|
-
this.
|
|
296
|
+
if (this.searchBarFilters?.length) {
|
|
297
|
+
this.searchBarFilters.forEach(item => {
|
|
234
298
|
const filterController = new SearchBarFilterController(item, this);
|
|
235
299
|
this.filterControllers.push(filterController);
|
|
236
300
|
});
|
|
@@ -269,7 +333,7 @@ export class SearchBarController
|
|
|
269
333
|
}
|
|
270
334
|
|
|
271
335
|
/**
|
|
272
|
-
* 格式化过滤项
|
|
336
|
+
* 格式化过滤项 (后续如果修改这里的逻辑记得把下方的反推函数parseFilters也跟着修改!)
|
|
273
337
|
* @author lxm
|
|
274
338
|
* @date 2023-10-16 03:45:41
|
|
275
339
|
* @param {IFilterNode} node
|
|
@@ -293,6 +357,34 @@ export class SearchBarController
|
|
|
293
357
|
};
|
|
294
358
|
}
|
|
295
359
|
|
|
360
|
+
/**
|
|
361
|
+
* 根据格式化后的过滤项反推出过滤项树节点数据集合
|
|
362
|
+
* @param {IData} data
|
|
363
|
+
* @return {*}
|
|
364
|
+
* @author: zhujiamin
|
|
365
|
+
* @Date: 2023-12-28 09:47:45
|
|
366
|
+
*/
|
|
367
|
+
parseFilters(data: IData): IFilterNode {
|
|
368
|
+
if (data.condtype === 'GROUP') {
|
|
369
|
+
return {
|
|
370
|
+
leaf: false,
|
|
371
|
+
logicType: data.condop === 'AND' ? 'AND' : 'OR',
|
|
372
|
+
children: (data.searchconds || []).map((item: IData) =>
|
|
373
|
+
this.parseFilters(item),
|
|
374
|
+
),
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
if (data.condtype === 'DEFIELD') {
|
|
378
|
+
return {
|
|
379
|
+
leaf: true,
|
|
380
|
+
field: data.fieldname || null,
|
|
381
|
+
valueOP: data.condop || null,
|
|
382
|
+
value: data.value || null,
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
throw new RuntimeError(`无效的condtype:${data.condtype}`);
|
|
386
|
+
}
|
|
387
|
+
|
|
296
388
|
/**
|
|
297
389
|
* 获取初始过滤项树节点数据集合
|
|
298
390
|
* @return {*}
|
|
@@ -340,10 +432,6 @@ export class SearchBarController
|
|
|
340
432
|
tempGroup.searchGroupData.columnstates =
|
|
341
433
|
tempData.theme_model.columnstates;
|
|
342
434
|
}
|
|
343
|
-
if (tempData.theme_model.filternodes) {
|
|
344
|
-
tempGroup.searchGroupData.filternodes =
|
|
345
|
-
tempData.theme_model.filternodes;
|
|
346
|
-
}
|
|
347
435
|
if (tempData.theme_model.searchconds) {
|
|
348
436
|
tempGroup.searchGroupData.searchconds =
|
|
349
437
|
tempData.theme_model.searchconds;
|
|
@@ -353,7 +441,7 @@ export class SearchBarController
|
|
|
353
441
|
tempGroup.show = tempData.valid_flag === '1';
|
|
354
442
|
}
|
|
355
443
|
} catch (error) {
|
|
356
|
-
ibiz.log.error(error);
|
|
444
|
+
ibiz.log.error(`${item.data}非标准JSON格式:`, error);
|
|
357
445
|
}
|
|
358
446
|
}
|
|
359
447
|
return tempGroup;
|
|
@@ -411,11 +499,9 @@ export class SearchBarController
|
|
|
411
499
|
if (this.grid && this.state.selectedSearchGroupItem) {
|
|
412
500
|
const filters = this.calcFilters();
|
|
413
501
|
const saveParams = {
|
|
414
|
-
filternodes: this.state.filterNodes,
|
|
415
502
|
searchconds: filters,
|
|
416
503
|
sort: this.grid.state.sortQuery,
|
|
417
504
|
columnstates: this.grid.state.columnStates,
|
|
418
|
-
show: this.state.selectedSearchGroupItem.show,
|
|
419
505
|
};
|
|
420
506
|
// 根据是否保存过决定是更新还是新建
|
|
421
507
|
if (this.state.selectedSearchGroupItem.saved) {
|
|
@@ -459,8 +545,16 @@ export class SearchBarController
|
|
|
459
545
|
groupItem.show = true;
|
|
460
546
|
}
|
|
461
547
|
}
|
|
462
|
-
if (
|
|
463
|
-
|
|
548
|
+
if (
|
|
549
|
+
groupItem.searchGroupData &&
|
|
550
|
+
groupItem.searchGroupData.searchconds &&
|
|
551
|
+
groupItem.searchGroupData.searchconds.length > 0
|
|
552
|
+
) {
|
|
553
|
+
// 根据后台标准的searchconds计算出 前端回显的树形结构FilterNodes
|
|
554
|
+
const filterNodes = groupItem.searchGroupData.searchconds.map(item =>
|
|
555
|
+
this.parseFilters(item),
|
|
556
|
+
);
|
|
557
|
+
this.state.filterNodes = filterNodes;
|
|
464
558
|
} else {
|
|
465
559
|
this.state.filterNodes = this.getOriginFilterNodes();
|
|
466
560
|
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from '@ibiz-template/core';
|
|
7
7
|
import {
|
|
8
8
|
IDETBUIActionItem,
|
|
9
|
+
IDEToolbarItem,
|
|
9
10
|
IDETree,
|
|
10
11
|
IDETreeDataSetNode,
|
|
11
12
|
IDETreeNode,
|
|
@@ -21,11 +22,7 @@ import { UIActionUtil } from '../../../ui-action';
|
|
|
21
22
|
import { MDControlController } from '../../common';
|
|
22
23
|
import { ContextMenuController } from '../context-menu';
|
|
23
24
|
import { TreeService } from './tree.service';
|
|
24
|
-
import {
|
|
25
|
-
calcDeCodeNameById,
|
|
26
|
-
getChildNodeRSs,
|
|
27
|
-
getUIActionItemsByActionLevel,
|
|
28
|
-
} from '../../../model';
|
|
25
|
+
import { calcDeCodeNameById, getChildNodeRSs } from '../../../model';
|
|
29
26
|
import { ControllerEvent } from '../../utils';
|
|
30
27
|
|
|
31
28
|
export type DropNodeRS = {
|
|
@@ -81,11 +78,19 @@ export class TreeController<
|
|
|
81
78
|
dropNodeRss = new Map<string, DropNodeRS[]>();
|
|
82
79
|
|
|
83
80
|
/**
|
|
84
|
-
*
|
|
81
|
+
* 节点上下文解析后信息`
|
|
85
82
|
* @author lxm
|
|
86
|
-
* @date 2023-12-
|
|
83
|
+
* @date 2023-12-29 10:38:37
|
|
87
84
|
*/
|
|
88
|
-
|
|
85
|
+
contextMenuInfos: {
|
|
86
|
+
[p: string]: {
|
|
87
|
+
/**
|
|
88
|
+
* 上下文菜单里第一个行为级别为常用操作的项
|
|
89
|
+
*/
|
|
90
|
+
clickTBUIActionItem?: IDETBUIActionItem;
|
|
91
|
+
onlyOneActionItem: boolean;
|
|
92
|
+
};
|
|
93
|
+
} = {};
|
|
89
94
|
|
|
90
95
|
protected initState(): void {
|
|
91
96
|
super.initState();
|
|
@@ -208,11 +213,29 @@ export class TreeController<
|
|
|
208
213
|
*/
|
|
209
214
|
protected initNodeClickTBUIActionItem(): void {
|
|
210
215
|
this.model.detreeNodes?.forEach(node => {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
+
const contextMenu = node.decontextMenu;
|
|
217
|
+
if (contextMenu?.detoolbarItems?.length) {
|
|
218
|
+
let itemNum = 0;
|
|
219
|
+
const items: IDETBUIActionItem[] = [];
|
|
220
|
+
|
|
221
|
+
recursiveIterate(
|
|
222
|
+
contextMenu,
|
|
223
|
+
(item: IDEToolbarItem) => {
|
|
224
|
+
if (item.itemType === 'DEUIACTION') {
|
|
225
|
+
itemNum += 1;
|
|
226
|
+
const uiItem = item as IDETBUIActionItem;
|
|
227
|
+
if (uiItem.actionLevel === 200) {
|
|
228
|
+
items.push(uiItem);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
{ childrenFields: ['detoolbarItems'] },
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
this.contextMenuInfos[node.id!] = {
|
|
236
|
+
onlyOneActionItem: itemNum === 1,
|
|
237
|
+
clickTBUIActionItem: items[0],
|
|
238
|
+
};
|
|
216
239
|
}
|
|
217
240
|
});
|
|
218
241
|
}
|
|
@@ -325,9 +348,15 @@ export class TreeController<
|
|
|
325
348
|
event: MouseEvent,
|
|
326
349
|
): Promise<void> {
|
|
327
350
|
// 节点有配置常用操作的上下文菜单时,触发界面行为,后续逻辑都不走
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
351
|
+
const clickActionItem =
|
|
352
|
+
this.contextMenuInfos[nodeData.nodeId]?.clickTBUIActionItem;
|
|
353
|
+
if (clickActionItem) {
|
|
354
|
+
return this.doUIAction(
|
|
355
|
+
clickActionItem.uiactionId!,
|
|
356
|
+
nodeData,
|
|
357
|
+
event,
|
|
358
|
+
clickActionItem.appId,
|
|
359
|
+
);
|
|
331
360
|
}
|
|
332
361
|
|
|
333
362
|
// 导航的时候,没有导航视图的时候,节点后续点击逻辑都不走,也不选中
|
|
@@ -632,16 +661,23 @@ export class TreeController<
|
|
|
632
661
|
);
|
|
633
662
|
}
|
|
634
663
|
// * 前后的情况
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
);
|
|
664
|
+
|
|
665
|
+
// 父相同的情况下,就是排序,看当前节点是否能排序
|
|
666
|
+
if (draggingNode.parent?.id === dropNode.parent?.id) {
|
|
667
|
+
const currentNodeModel = this.getNodeModel(dropNode.nodeId)!;
|
|
668
|
+
return currentNodeModel?.allowOrder === true;
|
|
641
669
|
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
670
|
+
|
|
671
|
+
// 没有父就是根节点,根节点没有上层关系,无法换父
|
|
672
|
+
if (!dropNode.parent) {
|
|
673
|
+
return false;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
// 父不一样的时候需要判断能否移入到对方的父节点内
|
|
677
|
+
return !!this.findDropNodeRS(
|
|
678
|
+
dropNode.parent!.nodeId!,
|
|
679
|
+
draggingNodeModel.appDataEntityId!,
|
|
680
|
+
);
|
|
645
681
|
}
|
|
646
682
|
|
|
647
683
|
/**
|
|
@@ -688,7 +724,7 @@ export class TreeController<
|
|
|
688
724
|
const modifiedNodeDatas: ITreeNodeData[] = [];
|
|
689
725
|
const draggingNodeModel = this.getNodeModel(draggingNode.nodeId)!;
|
|
690
726
|
const dropInNode = dropType === 'inner' ? dropNode : dropNode.parent!;
|
|
691
|
-
const isChangedParent = dropNode
|
|
727
|
+
const isChangedParent = dropNode?.id !== draggingNode.parent?.id;
|
|
692
728
|
let orderNodeModel = this.getNodeModel(dropNode.nodeId)!;
|
|
693
729
|
|
|
694
730
|
// * 处理切换父节点
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
ITreeNodeData,
|
|
10
10
|
} from '../../../interface';
|
|
11
11
|
import { getTreeGridExColumnProvider } from '../../../register';
|
|
12
|
-
|
|
13
12
|
import { TreeGridExService } from './tree-grid-ex.service';
|
|
14
13
|
import { TreeController } from '../tree/tree.controller';
|
|
15
14
|
import {
|
|
@@ -103,14 +102,15 @@ export class TreeGridExController<
|
|
|
103
102
|
protected initState(): void {
|
|
104
103
|
super.initState();
|
|
105
104
|
this.state.columnStates = [];
|
|
105
|
+
this.state.rootNodes = [];
|
|
106
106
|
this.state.rows = {};
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
protected async onCreated(): Promise<void> {
|
|
110
110
|
await super.onCreated();
|
|
111
111
|
|
|
112
|
-
this.initColumnStates();
|
|
113
112
|
await this.initGridColumns();
|
|
113
|
+
this.initColumnStates();
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
protected async initService(): Promise<void> {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取实体的jsonschema
|
|
3
|
+
* @author lxm
|
|
4
|
+
* @date 2023-12-29 04:03:58
|
|
5
|
+
* @export
|
|
6
|
+
* @param {string} entityId
|
|
7
|
+
* @param {IContext} context
|
|
8
|
+
* @return {*} {Promise<IData>}
|
|
9
|
+
*/
|
|
10
|
+
export async function getEntitySchema(
|
|
11
|
+
entityId: string,
|
|
12
|
+
context: IContext,
|
|
13
|
+
): Promise<IData> {
|
|
14
|
+
const app = ibiz.hub.getApp(context.srfappid);
|
|
15
|
+
const entity = await ibiz.hub.getAppDataEntity(entityId, context.srfappid);
|
|
16
|
+
const url = `/jsonschema/${entity.name}`;
|
|
17
|
+
const res = await app.net.get(url);
|
|
18
|
+
return res.data;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './entity';
|
|
@@ -140,15 +140,10 @@ export interface ISearchGroupData {
|
|
|
140
140
|
*/
|
|
141
141
|
columnstates?: Array<IColumnState>;
|
|
142
142
|
|
|
143
|
-
/**
|
|
144
|
-
* 过滤项树节点数据集合
|
|
145
|
-
*/
|
|
146
|
-
filternodes?: Array<IFilterNode>;
|
|
147
|
-
|
|
148
143
|
/**
|
|
149
144
|
* 自定义搜索条件
|
|
150
145
|
*/
|
|
151
|
-
searchconds?: IData;
|
|
146
|
+
searchconds?: IData[];
|
|
152
147
|
|
|
153
148
|
/**
|
|
154
149
|
* 表格排序查询条件
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { IAppMenuItem } from '@ibiz/model-core';
|
|
2
|
+
import { IAppMenuController } from '../controller';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 应用菜单项适配器的接口
|
|
6
|
+
*
|
|
7
|
+
* @author lxm
|
|
8
|
+
* @date 2022-10-25 13:10:45
|
|
9
|
+
* @export
|
|
10
|
+
* @interface IAppMenuItemProvider
|
|
11
|
+
*/
|
|
12
|
+
export interface IAppMenuItemProvider {
|
|
13
|
+
/**
|
|
14
|
+
* 执行界面行为
|
|
15
|
+
* @author lxm
|
|
16
|
+
* @date 2023-05-08 09:55:06
|
|
17
|
+
* @param {IAppDEUIAction} action
|
|
18
|
+
* @param {IUILogicParams} params
|
|
19
|
+
* @return {*} {Promise<IUIActionResult>}
|
|
20
|
+
*/
|
|
21
|
+
onClick?(
|
|
22
|
+
menuItem: IAppMenuItem,
|
|
23
|
+
event: MouseEvent,
|
|
24
|
+
AppMenuController: IAppMenuController,
|
|
25
|
+
): Promise<void>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 绘制菜单项文本
|
|
29
|
+
* @author lxm
|
|
30
|
+
* @date 2023-12-29 03:05:22
|
|
31
|
+
* @param {IAppMenuItem} menuItem
|
|
32
|
+
* @param {IAppMenuController} AppMenuController
|
|
33
|
+
* @return {*} {*}
|
|
34
|
+
*/
|
|
35
|
+
renderText?(
|
|
36
|
+
menuItem: IAppMenuItem,
|
|
37
|
+
AppMenuController: IAppMenuController,
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
+
): any;
|
|
40
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { IAppMenuItem } from '@ibiz/model-core';
|
|
2
|
+
import { getPluginRegisterKey } from './common-register';
|
|
3
|
+
import { IAppMenuItemProvider } from '../../interface';
|
|
4
|
+
|
|
5
|
+
/** 应用菜单项适配器前缀 */
|
|
6
|
+
export const APPMENUITEM_PROVIDER_PREFIX = 'APPMENUITEM';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 注册应用菜单项适配器
|
|
10
|
+
*
|
|
11
|
+
* @author lxm
|
|
12
|
+
* @date 2023-05-06 09:14:16
|
|
13
|
+
* @export
|
|
14
|
+
* @param {string} key
|
|
15
|
+
* @param {() => IAppMenuItemProvider} callback 生成界面行为适配器的回调
|
|
16
|
+
*/
|
|
17
|
+
export function registerAppMenuItemProvider(
|
|
18
|
+
key: string,
|
|
19
|
+
callback: () => IAppMenuItemProvider,
|
|
20
|
+
): void {
|
|
21
|
+
ibiz.register.register(`${APPMENUITEM_PROVIDER_PREFIX}_${key}`, callback);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function getProvider(key: string): IAppMenuItemProvider | undefined {
|
|
25
|
+
return ibiz.register.get(
|
|
26
|
+
`${APPMENUITEM_PROVIDER_PREFIX}_${key}`,
|
|
27
|
+
) as IAppMenuItemProvider;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 获取应用菜单项适配器
|
|
32
|
+
*
|
|
33
|
+
* @author chitanda
|
|
34
|
+
* @date 2023-11-01 17:11:43
|
|
35
|
+
* @export
|
|
36
|
+
* @param {IAppMenuItem} model
|
|
37
|
+
* @return {*} {Promise<IAppMenuItemProvider>}
|
|
38
|
+
*/
|
|
39
|
+
export async function getAppMenuItemProvider(
|
|
40
|
+
model: IAppMenuItem,
|
|
41
|
+
): Promise<IAppMenuItemProvider | undefined> {
|
|
42
|
+
let provider: IAppMenuItemProvider | undefined;
|
|
43
|
+
const { sysPFPluginId, appId, itemType } = model as Required<IAppMenuItem>;
|
|
44
|
+
|
|
45
|
+
// 找插件适配器
|
|
46
|
+
if (sysPFPluginId) {
|
|
47
|
+
const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId);
|
|
48
|
+
if (pluginKey) {
|
|
49
|
+
provider = getProvider(pluginKey);
|
|
50
|
+
}
|
|
51
|
+
if (!provider) {
|
|
52
|
+
ibiz.log.error(`找不到应用菜单项插件${pluginKey}对应的适配器`);
|
|
53
|
+
} else {
|
|
54
|
+
return provider;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 找应用菜单项类型
|
|
59
|
+
provider = getProvider(itemType);
|
|
60
|
+
if (!provider) {
|
|
61
|
+
ibiz.log.error(`找不到应用菜单项类型${itemType}对应的适配器`);
|
|
62
|
+
} else {
|
|
63
|
+
return provider;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -71,7 +71,7 @@ export class DEServiceUtil {
|
|
|
71
71
|
* @return {*} {Promise<IAppDEService>}
|
|
72
72
|
*/
|
|
73
73
|
async getService(context: IContext, id: string): Promise<IAppDEService> {
|
|
74
|
-
const sandboxId = context.srfsessionid;
|
|
74
|
+
const sandboxId = context.srfsessionid || 'applocation';
|
|
75
75
|
if (!this.cache.has(sandboxId)) {
|
|
76
76
|
this.cache.set(sandboxId, new Map());
|
|
77
77
|
}
|
|
@@ -279,10 +279,16 @@ export class DEActionMethod extends Method {
|
|
|
279
279
|
let resultData: IDataEntity | IDataEntity[];
|
|
280
280
|
if (isArray(addData)) {
|
|
281
281
|
resultData = await Promise.all(
|
|
282
|
-
addData.map(
|
|
282
|
+
addData.map(
|
|
283
|
+
item =>
|
|
284
|
+
this.service.local.add(context, this.attach(context, item))!,
|
|
285
|
+
),
|
|
283
286
|
);
|
|
284
287
|
} else {
|
|
285
|
-
resultData = await this.service.local.add(
|
|
288
|
+
resultData = await this.service.local.add(
|
|
289
|
+
context,
|
|
290
|
+
this.attach(context, addData),
|
|
291
|
+
)!;
|
|
286
292
|
}
|
|
287
293
|
return new HttpResponse(resultData);
|
|
288
294
|
} catch (err) {
|
|
@@ -364,10 +370,16 @@ export class DEActionMethod extends Method {
|
|
|
364
370
|
let resultData: IDataEntity | IDataEntity[];
|
|
365
371
|
if (isArray(updateData)) {
|
|
366
372
|
resultData = await Promise.all(
|
|
367
|
-
updateData.map(
|
|
373
|
+
updateData.map(
|
|
374
|
+
item =>
|
|
375
|
+
this.service.local.update(context, this.attach(context, item))!,
|
|
376
|
+
),
|
|
368
377
|
);
|
|
369
378
|
} else {
|
|
370
|
-
resultData = await this.service.local.update(
|
|
379
|
+
resultData = await this.service.local.update(
|
|
380
|
+
context,
|
|
381
|
+
this.attach(context, updateData),
|
|
382
|
+
)!;
|
|
371
383
|
}
|
|
372
384
|
if (resultData) {
|
|
373
385
|
return new HttpResponse(resultData);
|
|
@@ -434,4 +446,32 @@ export class DEActionMethod extends Method {
|
|
|
434
446
|
// }
|
|
435
447
|
return new HttpResponse(true);
|
|
436
448
|
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* 在新建、更新时,根据界面域下的关系,自动填充相关父属性
|
|
452
|
+
*
|
|
453
|
+
* @author chitanda
|
|
454
|
+
* @date 2024-01-02 15:01:30
|
|
455
|
+
* @protected
|
|
456
|
+
* @param {IContext} context
|
|
457
|
+
* @param {IDataEntity} data
|
|
458
|
+
* @return {*} {IDataEntity}
|
|
459
|
+
*/
|
|
460
|
+
protected attach(context: IContext, data: IDataEntity): IDataEntity {
|
|
461
|
+
const sandboxId = context.srfsessionid;
|
|
462
|
+
const uiDomain = ibiz.uiDomainManager.get(sandboxId);
|
|
463
|
+
const configs = uiDomain.getDERConfig(this.entity.id!);
|
|
464
|
+
if (configs.length > 0) {
|
|
465
|
+
configs.forEach(config => {
|
|
466
|
+
const { majorDECodeName, pickupDEFName } = config;
|
|
467
|
+
const majorLowerCodeName = majorDECodeName.toLowerCase();
|
|
468
|
+
const pickupLowerDEFName = pickupDEFName.toLowerCase();
|
|
469
|
+
const majorkey = context[majorLowerCodeName];
|
|
470
|
+
if (majorkey) {
|
|
471
|
+
data[pickupLowerDEFName] = majorkey;
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
return data;
|
|
476
|
+
}
|
|
437
477
|
}
|
package/src/utils/index.ts
CHANGED