@ibiz-template/runtime 0.1.29 → 0.1.31
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 +145 -39
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/out/config/global-config.js +1 -1
- package/out/controller/common/control/control.controller.d.ts +18 -0
- package/out/controller/common/control/control.controller.d.ts.map +1 -1
- package/out/controller/common/control/control.controller.js +29 -1
- package/out/controller/control/dashboard/portlet/index.d.ts +1 -0
- package/out/controller/control/dashboard/portlet/index.d.ts.map +1 -1
- package/out/controller/control/dashboard/portlet/index.js +1 -0
- package/out/controller/control/dashboard/portlet/menu-portlet/index.d.ts +2 -0
- package/out/controller/control/dashboard/portlet/menu-portlet/index.d.ts.map +1 -0
- package/out/controller/control/dashboard/portlet/menu-portlet/index.js +1 -0
- package/out/controller/control/dashboard/portlet/menu-portlet/menu-portlet.controller.d.ts +5 -0
- package/out/controller/control/dashboard/portlet/menu-portlet/menu-portlet.controller.d.ts.map +1 -0
- package/out/controller/control/dashboard/portlet/menu-portlet/menu-portlet.controller.js +3 -0
- package/out/controller/control/exp-bar/exp-bar.controller.d.ts +10 -0
- package/out/controller/control/exp-bar/exp-bar.controller.d.ts.map +1 -1
- package/out/controller/control/exp-bar/exp-bar.controller.js +29 -2
- package/out/controller/control/exp-bar/tree-exp-bar.controller.d.ts.map +1 -1
- package/out/controller/control/exp-bar/tree-exp-bar.controller.js +1 -1
- package/out/controller/control/tab-exp-panel/tab-exp-panel.controller.d.ts +10 -0
- package/out/controller/control/tab-exp-panel/tab-exp-panel.controller.d.ts.map +1 -1
- package/out/controller/control/tab-exp-panel/tab-exp-panel.controller.js +19 -0
- package/out/controller/control/tree/tree.controller.d.ts +9 -1
- package/out/controller/control/tree/tree.controller.d.ts.map +1 -1
- package/out/controller/control/tree/tree.controller.js +46 -25
- package/out/interface/common/i-global-config/i-global-view-config.d.ts +5 -3
- package/out/interface/common/i-global-config/i-global-view-config.d.ts.map +1 -1
- package/out/interface/controller/common/i-nav-view-msg/i-nav-view-msg.d.ts +9 -0
- package/out/interface/controller/common/i-nav-view-msg/i-nav-view-msg.d.ts.map +1 -1
- package/out/service/app-data-entity/app-data-entity.d.ts.map +1 -1
- package/out/service/app-data-entity/app-data-entity.js +4 -0
- package/out/service/service/entity/method/method-renturn.d.ts.map +1 -1
- package/out/service/service/entity/method/method-renturn.js +4 -0
- package/out/ui-action/provider/ui-action-provider-base.js +1 -1
- package/package.json +5 -5
- package/src/config/global-config.ts +1 -1
- package/src/controller/common/control/control.controller.ts +31 -2
- package/src/controller/control/dashboard/portlet/index.ts +1 -0
- package/src/controller/control/dashboard/portlet/menu-portlet/index.ts +1 -0
- package/src/controller/control/dashboard/portlet/menu-portlet/menu-portlet.controller.ts +4 -0
- package/src/controller/control/exp-bar/exp-bar.controller.ts +30 -2
- package/src/controller/control/exp-bar/tree-exp-bar.controller.ts +1 -0
- package/src/controller/control/tab-exp-panel/tab-exp-panel.controller.ts +20 -0
- package/src/controller/control/tree/tree.controller.ts +51 -24
- package/src/interface/common/i-global-config/i-global-view-config.ts +5 -3
- package/src/interface/controller/common/i-nav-view-msg/i-nav-view-msg.ts +10 -0
- package/src/service/app-data-entity/app-data-entity.ts +5 -0
- package/src/service/service/entity/method/method-renturn.ts +4 -0
- package/src/ui-action/provider/ui-action-provider-base.ts +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IControl, IControlLogic, IViewLayoutPanel } from '@ibiz/model-core';
|
|
2
2
|
import { NoticeError } from '@ibiz-template/core';
|
|
3
3
|
import { isNil } from 'ramda';
|
|
4
|
+
import { notNilEmpty } from 'qx-util';
|
|
4
5
|
import { BaseController } from '..';
|
|
5
6
|
import { CTX } from '../../ctx';
|
|
6
7
|
import {
|
|
@@ -19,7 +20,7 @@ import {
|
|
|
19
20
|
} from '../../../interface';
|
|
20
21
|
import { ControlLogicScheduler } from '../../../logic-scheduler';
|
|
21
22
|
import { getControlProvider } from '../../../register';
|
|
22
|
-
import { ScriptFactory } from '../../../utils';
|
|
23
|
+
import { convertNavData, ScriptFactory } from '../../../utils';
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* 部件控制器
|
|
@@ -63,6 +64,16 @@ export class ControlController<
|
|
|
63
64
|
|
|
64
65
|
layoutPanel?: IViewLayoutPanelController;
|
|
65
66
|
|
|
67
|
+
/**
|
|
68
|
+
* 部件参数
|
|
69
|
+
*
|
|
70
|
+
* @author zk
|
|
71
|
+
* @date 2023-09-26 03:09:21
|
|
72
|
+
* @type {IData}
|
|
73
|
+
* @memberof ControlController
|
|
74
|
+
*/
|
|
75
|
+
controlParams: IData = {};
|
|
76
|
+
|
|
66
77
|
/**
|
|
67
78
|
* 子适配器
|
|
68
79
|
* @author lxm
|
|
@@ -130,7 +141,8 @@ export class ControlController<
|
|
|
130
141
|
const provider = await getControlProvider(this.controlPanel);
|
|
131
142
|
this.providers[this.controlPanel.name!] = provider!;
|
|
132
143
|
}
|
|
133
|
-
|
|
144
|
+
// 处理上下文和导航参数
|
|
145
|
+
this.handleControlParams();
|
|
134
146
|
// 部件逻辑初始化
|
|
135
147
|
this.initControlScheduler(this.model.controlLogics);
|
|
136
148
|
}
|
|
@@ -222,6 +234,23 @@ export class ControlController<
|
|
|
222
234
|
}
|
|
223
235
|
}
|
|
224
236
|
|
|
237
|
+
/**
|
|
238
|
+
* 部件参数解析
|
|
239
|
+
*
|
|
240
|
+
* @author zk
|
|
241
|
+
* @date 2023-09-27 07:09:08
|
|
242
|
+
* @protected
|
|
243
|
+
* @memberof ControlController
|
|
244
|
+
*/
|
|
245
|
+
protected handleControlParams(): void {
|
|
246
|
+
const { ctrlParams } = this.model.controlParam!;
|
|
247
|
+
let params = {};
|
|
248
|
+
if (notNilEmpty(ctrlParams)) {
|
|
249
|
+
params = convertNavData(ctrlParams!, this.params, this.context);
|
|
250
|
+
}
|
|
251
|
+
Object.assign(this.controlParams, params);
|
|
252
|
+
}
|
|
253
|
+
|
|
225
254
|
/**
|
|
226
255
|
* 初始化部件逻辑调度器
|
|
227
256
|
* @author lxm
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './menu-portlet.controller';
|
|
@@ -152,6 +152,25 @@ export class ExpBarControlController<
|
|
|
152
152
|
return control;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
+
/**
|
|
156
|
+
* 是否缓存
|
|
157
|
+
*
|
|
158
|
+
* @author zk
|
|
159
|
+
* @date 2023-09-27 09:09:59
|
|
160
|
+
* @readonly
|
|
161
|
+
* @type {boolean}
|
|
162
|
+
* @memberof ExpBarControlController
|
|
163
|
+
*/
|
|
164
|
+
get isCache(): boolean {
|
|
165
|
+
if (this.controlParams.expcache === 'CACHE') {
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
if (this.controlParams.expcache === 'NO_CACHE') {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
return ibiz.config.view.expCacheMode.includes(this.model.controlType!);
|
|
172
|
+
}
|
|
173
|
+
|
|
155
174
|
/**
|
|
156
175
|
* 创建完成
|
|
157
176
|
*
|
|
@@ -274,7 +293,10 @@ export class ExpBarControlController<
|
|
|
274
293
|
}
|
|
275
294
|
// 此时不需要导航占位push路由,只要有个key触发绘制下级视图就行。
|
|
276
295
|
this._evt.emit('onNavViewChange', {
|
|
277
|
-
navViewMsg: {
|
|
296
|
+
navViewMsg: {
|
|
297
|
+
key: this.state.srfnav,
|
|
298
|
+
isCache: this.isCache,
|
|
299
|
+
},
|
|
278
300
|
context: this.context,
|
|
279
301
|
});
|
|
280
302
|
} else if (selectItem) {
|
|
@@ -297,7 +319,12 @@ export class ExpBarControlController<
|
|
|
297
319
|
if (!data) {
|
|
298
320
|
// 导航视图传空让他导航占位绘制空界面
|
|
299
321
|
this.state.srfnav = '';
|
|
300
|
-
this._evt.emit('onNavViewChange', {
|
|
322
|
+
this._evt.emit('onNavViewChange', {
|
|
323
|
+
navViewMsg: {
|
|
324
|
+
key: '',
|
|
325
|
+
isCache: this.isCache,
|
|
326
|
+
},
|
|
327
|
+
});
|
|
301
328
|
return;
|
|
302
329
|
}
|
|
303
330
|
// 默认选中并激活第一项
|
|
@@ -401,6 +428,7 @@ export class ExpBarControlController<
|
|
|
401
428
|
context: result.context,
|
|
402
429
|
params: result.params,
|
|
403
430
|
viewId: viewModelId,
|
|
431
|
+
isCache: this.isCache,
|
|
404
432
|
};
|
|
405
433
|
}
|
|
406
434
|
|
|
@@ -38,6 +38,25 @@ export class TabExpPanelController
|
|
|
38
38
|
*/
|
|
39
39
|
isShowIcon = false;
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* 是否缓存
|
|
43
|
+
*
|
|
44
|
+
* @author zk
|
|
45
|
+
* @date 2023-09-27 09:09:59
|
|
46
|
+
* @readonly
|
|
47
|
+
* @type {boolean}
|
|
48
|
+
* @memberof ExpBarControlController
|
|
49
|
+
*/
|
|
50
|
+
get isCache(): boolean {
|
|
51
|
+
if (this.controlParams.expcache === 'CACHE') {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
if (this.controlParams.expcache === 'NO_CACHE') {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return ibiz.config.view.expCacheMode.includes(this.model.controlType!);
|
|
58
|
+
}
|
|
59
|
+
|
|
41
60
|
/**
|
|
42
61
|
* 初始化state的属性
|
|
43
62
|
*
|
|
@@ -235,6 +254,7 @@ export class TabExpPanelController
|
|
|
235
254
|
context,
|
|
236
255
|
params,
|
|
237
256
|
viewId: tabViewPanel.embeddedAppDEViewId,
|
|
257
|
+
isCache: this.isCache,
|
|
238
258
|
};
|
|
239
259
|
}
|
|
240
260
|
}
|
|
@@ -40,11 +40,15 @@ export class TreeController
|
|
|
40
40
|
super.initState();
|
|
41
41
|
// 根节点初始化
|
|
42
42
|
this.state.defaultExpandedKeys = [];
|
|
43
|
+
this.state.expandedKeys = [];
|
|
43
44
|
this.state.size = 0;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
protected async onCreated(): Promise<void> {
|
|
47
48
|
await super.onCreated();
|
|
49
|
+
|
|
50
|
+
this.state.expandedKeys = [...this.state.defaultExpandedKeys];
|
|
51
|
+
|
|
48
52
|
this.service = new TreeService(this.model);
|
|
49
53
|
await this.service.init(this.context);
|
|
50
54
|
|
|
@@ -74,8 +78,17 @@ export class TreeController
|
|
|
74
78
|
*/
|
|
75
79
|
async load(args: MDCtrlLoadParams = {}): Promise<ITreeNodeData[]> {
|
|
76
80
|
const isInitialLoad = args.isInitialLoad === true;
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
if (isInitialLoad) {
|
|
82
|
+
await this.startLoading();
|
|
83
|
+
}
|
|
84
|
+
let nodes;
|
|
85
|
+
try {
|
|
86
|
+
nodes = await this.loadNodes();
|
|
87
|
+
} finally {
|
|
88
|
+
if (isInitialLoad) {
|
|
89
|
+
await this.endLoading();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
79
92
|
await this.afterLoad(args, nodes);
|
|
80
93
|
this.state.isLoaded = true;
|
|
81
94
|
await this.evt.emit('onLoadSuccess', {
|
|
@@ -95,24 +108,15 @@ export class TreeController
|
|
|
95
108
|
async loadNodes(parentNode?: ITreeNodeData): Promise<ITreeNodeData[]> {
|
|
96
109
|
const params = await this.getFetchParams();
|
|
97
110
|
const hasQuery = !!params.query;
|
|
98
|
-
const defaultExpandedKeys = !parentNode
|
|
99
|
-
? this.state.defaultExpandedKeys
|
|
100
|
-
: undefined;
|
|
101
111
|
|
|
102
112
|
// 请求服务获取子节点数据
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
hasQuery,
|
|
111
|
-
defaultExpandedKeys,
|
|
112
|
-
})) || [];
|
|
113
|
-
} finally {
|
|
114
|
-
await this.endLoading();
|
|
115
|
-
}
|
|
113
|
+
const nodes =
|
|
114
|
+
(await this.service.fetchChildNodes(parentNode, {
|
|
115
|
+
context: this.context.clone(),
|
|
116
|
+
params,
|
|
117
|
+
hasQuery,
|
|
118
|
+
defaultExpandedKeys: this.state.expandedKeys,
|
|
119
|
+
})) || [];
|
|
116
120
|
|
|
117
121
|
// 有父节点绑定到父节点数据上,无父节点替换rootNodes
|
|
118
122
|
if (parentNode) {
|
|
@@ -130,6 +134,8 @@ export class TreeController
|
|
|
130
134
|
},
|
|
131
135
|
);
|
|
132
136
|
|
|
137
|
+
this.state.expandedKeys = this.calcExpandedKeys(nodes);
|
|
138
|
+
|
|
133
139
|
return nodes;
|
|
134
140
|
}
|
|
135
141
|
|
|
@@ -164,6 +170,25 @@ export class TreeController
|
|
|
164
170
|
}
|
|
165
171
|
}
|
|
166
172
|
|
|
173
|
+
/**
|
|
174
|
+
* 树节点数据变更事件处理
|
|
175
|
+
* @author lxm
|
|
176
|
+
* @date 2023-09-28 01:48:05
|
|
177
|
+
* @param {ITreeNodeData} nodeData
|
|
178
|
+
* @param {boolean} isExpand true为展开,false为折叠
|
|
179
|
+
*/
|
|
180
|
+
onExpandChange(nodeData: ITreeNodeData, isExpand: boolean): void {
|
|
181
|
+
const hasKey = this.state.expandedKeys.includes(nodeData.id);
|
|
182
|
+
if (isExpand && !hasKey) {
|
|
183
|
+
this.state.expandedKeys.push(nodeData.id);
|
|
184
|
+
} else if (!isExpand && hasKey) {
|
|
185
|
+
const index = this.state.expandedKeys.indexOf(nodeData.id);
|
|
186
|
+
if (index !== -1) {
|
|
187
|
+
this.state.expandedKeys.splice(index, 1);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
167
192
|
/**
|
|
168
193
|
* 树节点双击事件
|
|
169
194
|
* @author lxm
|
|
@@ -266,7 +291,7 @@ export class TreeController
|
|
|
266
291
|
}
|
|
267
292
|
|
|
268
293
|
/**
|
|
269
|
-
* 计算展开节点集合
|
|
294
|
+
* 计算展开节点集合(根据加载的子节点计算所有的展开节点标识集合)
|
|
270
295
|
* @author lxm
|
|
271
296
|
* @date 2023-08-09 05:19:36
|
|
272
297
|
* @param {ITreeNodeData[]} nodes
|
|
@@ -274,16 +299,18 @@ export class TreeController
|
|
|
274
299
|
* @return {*} {string[]}
|
|
275
300
|
*/
|
|
276
301
|
calcExpandedKeys(nodes: ITreeNodeData[]): string[] {
|
|
277
|
-
|
|
302
|
+
// 用户操作的添加的要保留
|
|
303
|
+
let expandedKeys: string[] = [...this.state.expandedKeys];
|
|
304
|
+
|
|
305
|
+
// 计算加载回来的里面带的默认展开
|
|
278
306
|
recursiveIterate({ children: nodes }, (node: ITreeNodeData) => {
|
|
279
307
|
if (node.children?.length) {
|
|
280
308
|
expandedKeys.push(node.id);
|
|
281
309
|
}
|
|
282
310
|
});
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
311
|
+
|
|
312
|
+
// 去重
|
|
313
|
+
expandedKeys = Array.from(new Set(expandedKeys));
|
|
287
314
|
return expandedKeys;
|
|
288
315
|
}
|
|
289
316
|
|
|
@@ -20,11 +20,13 @@ export interface IGlobalViewConfig {
|
|
|
20
20
|
enableDataInfoBar: boolean;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* 用于控制全局哪些导航部件启用缓存,全大写。TABEXPPANEL:GRIDEXPBAR: - :分隔每个导航部件的缓存开关,必须用:结尾,如:TABEXPPANEL:开启表格导航部件缓存,GRIDEXPBAR:开启分页导航部件缓存
|
|
24
24
|
*
|
|
25
|
+
* @default 'TABEXPPANEL:'
|
|
26
|
+
* @description 判断时将使用 `部件类型:` 的方式进行判断,如:TABEXPPANEL:,表示开启表格导航视图的缓存
|
|
25
27
|
* @author chitanda
|
|
26
28
|
* @date 2023-09-15 12:09:09
|
|
27
|
-
* @type {
|
|
29
|
+
* @type {string}
|
|
28
30
|
*/
|
|
29
|
-
|
|
31
|
+
expCacheMode: string;
|
|
30
32
|
}
|
|
@@ -205,6 +205,11 @@ export class AppDataEntity implements IDataEntity {
|
|
|
205
205
|
* @return {*} {unknown}
|
|
206
206
|
*/
|
|
207
207
|
protected convertVal(value: unknown, dataType: number | undefined): unknown {
|
|
208
|
+
// 空值不转换
|
|
209
|
+
if (value == null) {
|
|
210
|
+
return value;
|
|
211
|
+
}
|
|
212
|
+
|
|
208
213
|
// 没有数据类型的给原值
|
|
209
214
|
if (isNil(dataType)) {
|
|
210
215
|
return value;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IAppDataEntity, IAppDEMethod } from '@ibiz/model-core';
|
|
2
|
+
import { isNilOrEmpty } from 'qx-util';
|
|
2
3
|
import { MethodDto } from '../../../dto/method.dto';
|
|
3
4
|
import { AppDataEntity } from '../../../app-data-entity/app-data-entity';
|
|
4
5
|
import { findModelChild } from '../../../../model';
|
|
@@ -58,6 +59,9 @@ export class MethodReturn {
|
|
|
58
59
|
const items = await this.dto.sets(context, [data]);
|
|
59
60
|
return items[0];
|
|
60
61
|
}
|
|
62
|
+
if (isNilOrEmpty(data)) {
|
|
63
|
+
data = {};
|
|
64
|
+
}
|
|
61
65
|
return new AppDataEntity(this.entity, data);
|
|
62
66
|
}
|
|
63
67
|
}
|
|
@@ -116,7 +116,7 @@ export abstract class UIActionProviderBase implements IUIActionProvider {
|
|
|
116
116
|
): Promise<boolean> {
|
|
117
117
|
const confirmMsg = this.calcMessage('confirm', action, args);
|
|
118
118
|
if (action.enableConfirm && confirmMsg) {
|
|
119
|
-
return ibiz.
|
|
119
|
+
return ibiz.confirm.warning({ title: '操作确认', desc: confirmMsg });
|
|
120
120
|
}
|
|
121
121
|
return true;
|
|
122
122
|
}
|