@ibiz-template/runtime 0.1.27 → 0.1.28
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 +206 -98
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/out/controller/control/data-view/data-view.controller.d.ts.map +1 -1
- package/out/controller/control/data-view/data-view.controller.js +5 -4
- package/out/controller/control/panel/panel/panel-item.controller.d.ts +34 -2
- package/out/controller/control/panel/panel/panel-item.controller.d.ts.map +1 -1
- package/out/controller/control/panel/panel/panel-item.controller.js +84 -5
- package/out/controller/control/panel/panel/panel.controller.d.ts +2 -1
- package/out/controller/control/panel/panel/panel.controller.d.ts.map +1 -1
- package/out/controller/control/panel/panel/panel.controller.js +11 -1
- package/out/controller/control/toolbar/toolbar.controllerr.d.ts.map +1 -1
- package/out/controller/control/toolbar/toolbar.controllerr.js +33 -21
- package/out/interface/controller/controller/control/panel-item/i-panel-item.controller.d.ts +2 -2
- package/out/interface/controller/controller/control/panel-item/i-panel-item.controller.d.ts.map +1 -1
- package/out/logic-scheduler/trigger/item-dyna-logic-trigger.d.ts.map +1 -1
- package/out/logic-scheduler/trigger/item-dyna-logic-trigger.js +4 -1
- package/out/service/service/entity/method/method.d.ts.map +1 -1
- package/out/service/service/entity/method/method.js +2 -2
- package/out/service/utils/dynamic-code-list/dynamic-code-list.js +4 -4
- package/out/utils/wf-helper/wf-helper.js +2 -2
- package/package.json +3 -3
- package/src/controller/control/data-view/data-view.controller.ts +5 -4
- package/src/controller/control/panel/panel/panel-item.controller.ts +105 -5
- package/src/controller/control/panel/panel/panel.controller.ts +17 -1
- package/src/controller/control/toolbar/toolbar.controllerr.ts +40 -24
- package/src/interface/controller/controller/control/panel-item/i-panel-item.controller.ts +2 -2
- package/src/logic-scheduler/trigger/item-dyna-logic-trigger.ts +5 -1
- package/src/service/service/entity/method/method.ts +5 -2
- package/src/service/utils/dynamic-code-list/dynamic-code-list.ts +4 -4
- package/src/utils/wf-helper/wf-helper.ts +2 -2
|
@@ -133,10 +133,15 @@ export class PanelItemController<T extends IPanelItem = IPanelItem>
|
|
|
133
133
|
* @date 2022-09-20 18:09:56
|
|
134
134
|
* @param {string[]} names
|
|
135
135
|
*/
|
|
136
|
-
dataChangeNotify(names: string[]): void {
|
|
136
|
+
async dataChangeNotify(names: string[]): Promise<void> {
|
|
137
137
|
// 计算动态控制逻辑
|
|
138
138
|
this.calcDynamicLogic(names);
|
|
139
139
|
|
|
140
|
+
// 计算显示,禁用,必填状态
|
|
141
|
+
this.calcItemDisabled(this.data);
|
|
142
|
+
this.calcItemVisible(this.data);
|
|
143
|
+
this.calcItemRequired(this.data);
|
|
144
|
+
|
|
140
145
|
// 计算动态样式表
|
|
141
146
|
this.calcDynaClass(this.data);
|
|
142
147
|
}
|
|
@@ -147,14 +152,109 @@ export class PanelItemController<T extends IPanelItem = IPanelItem>
|
|
|
147
152
|
* @author lxm
|
|
148
153
|
* @date 2022-09-20 18:09:07
|
|
149
154
|
*/
|
|
150
|
-
panelStateNotify(_state: PanelNotifyState): void {
|
|
155
|
+
async panelStateNotify(_state: PanelNotifyState): Promise<void> {
|
|
151
156
|
// 计算动态控制逻辑
|
|
152
157
|
this.calcDynamicLogic([], true);
|
|
153
158
|
|
|
159
|
+
// 计算显示,禁用,必填状态
|
|
160
|
+
this.calcItemDisabled(this.data);
|
|
161
|
+
this.calcItemVisible(this.data);
|
|
162
|
+
this.calcItemRequired(this.data);
|
|
163
|
+
|
|
154
164
|
// 计算动态样式表
|
|
155
165
|
this.calcDynaClass(this.data);
|
|
156
166
|
}
|
|
157
167
|
|
|
168
|
+
/**
|
|
169
|
+
* 计算项的禁用状态
|
|
170
|
+
* @author lxm
|
|
171
|
+
* @date 2023-06-26 06:19:00
|
|
172
|
+
* @param {IData} data
|
|
173
|
+
*/
|
|
174
|
+
calcItemDisabled(data: IData): void {
|
|
175
|
+
let enable = !this.dynaLogicResult.disabled;
|
|
176
|
+
|
|
177
|
+
// 上层计算为启用时计算预定义项启用逻辑
|
|
178
|
+
if (enable && this.panel.scheduler) {
|
|
179
|
+
const itemEnable = this.panel.scheduler.triggerItemEnable(
|
|
180
|
+
this.model.id!,
|
|
181
|
+
{
|
|
182
|
+
data: [data],
|
|
183
|
+
},
|
|
184
|
+
);
|
|
185
|
+
if (itemEnable !== undefined) {
|
|
186
|
+
enable = itemEnable;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// 修改state
|
|
191
|
+
this.state.disabled = !enable;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* 计算项的显示状态
|
|
196
|
+
* @author lxm
|
|
197
|
+
* @date 2023-06-26 06:19:00
|
|
198
|
+
* @param {IData} data
|
|
199
|
+
*/
|
|
200
|
+
calcItemVisible(data: IData): void {
|
|
201
|
+
let { visible } = this.dynaLogicResult;
|
|
202
|
+
|
|
203
|
+
// 上层计算为显示时计算预定义项显示逻辑
|
|
204
|
+
if (visible && this.panel.scheduler) {
|
|
205
|
+
const itemVIsible = this.panel.scheduler.triggerItemVisible(
|
|
206
|
+
this.model.id!,
|
|
207
|
+
{
|
|
208
|
+
data: [data],
|
|
209
|
+
},
|
|
210
|
+
);
|
|
211
|
+
if (itemVIsible !== undefined) {
|
|
212
|
+
visible = itemVIsible;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// 修改state
|
|
217
|
+
this.state.visible = visible;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* 计算项的必填状态
|
|
222
|
+
* @author lxm
|
|
223
|
+
* @date 2023-06-26 06:19:00
|
|
224
|
+
* @param {IData} data
|
|
225
|
+
*/
|
|
226
|
+
calcItemRequired(data: IData): void {
|
|
227
|
+
let allowEmpty = !this.dynaLogicResult.required;
|
|
228
|
+
|
|
229
|
+
// 上层计算为启用时计算预定义项启用逻辑
|
|
230
|
+
if (allowEmpty && this.panel.scheduler) {
|
|
231
|
+
const itemAllowEmpty = this.panel.scheduler.triggerItemBlank(
|
|
232
|
+
this.model.id!,
|
|
233
|
+
{
|
|
234
|
+
data: [data],
|
|
235
|
+
},
|
|
236
|
+
);
|
|
237
|
+
if (itemAllowEmpty !== undefined) {
|
|
238
|
+
allowEmpty = itemAllowEmpty;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// 修改state
|
|
243
|
+
this.state.required = !allowEmpty;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* 动态逻辑结果
|
|
248
|
+
* @author lxm
|
|
249
|
+
* @date 2023-09-21 03:36:37
|
|
250
|
+
* @protected
|
|
251
|
+
*/
|
|
252
|
+
protected dynaLogicResult = {
|
|
253
|
+
visible: true,
|
|
254
|
+
disabled: false,
|
|
255
|
+
required: false,
|
|
256
|
+
};
|
|
257
|
+
|
|
158
258
|
/**
|
|
159
259
|
* 计算动态逻辑
|
|
160
260
|
*
|
|
@@ -182,15 +282,15 @@ export class PanelItemController<T extends IPanelItem = IPanelItem>
|
|
|
182
282
|
switch (logic.logicCat) {
|
|
183
283
|
// 动态空输入,不满足则必填
|
|
184
284
|
case 'ITEMBLANK':
|
|
185
|
-
this.
|
|
285
|
+
this.dynaLogicResult.required = !ok;
|
|
186
286
|
break;
|
|
187
287
|
// 动态启用,满足则启用
|
|
188
288
|
case 'ITEMENABLE':
|
|
189
|
-
this.
|
|
289
|
+
this.dynaLogicResult.disabled = !ok;
|
|
190
290
|
break;
|
|
191
291
|
// 动态显示,满足则显示
|
|
192
292
|
case 'PANELVISIBLE':
|
|
193
|
-
this.
|
|
293
|
+
this.dynaLogicResult.visible = ok;
|
|
194
294
|
break;
|
|
195
295
|
default:
|
|
196
296
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */
|
|
2
|
-
import { RuntimeError } from '@ibiz-template/core';
|
|
2
|
+
import { recursiveIterate, RuntimeError } from '@ibiz-template/core';
|
|
3
3
|
import {
|
|
4
|
+
IControlLogic,
|
|
4
5
|
IPanel,
|
|
5
6
|
IPanelContainer,
|
|
6
7
|
IPanelItem,
|
|
@@ -268,4 +269,19 @@ export class PanelController<
|
|
|
268
269
|
this.state.data[name] = value;
|
|
269
270
|
this.dataChangeNotify([name]);
|
|
270
271
|
}
|
|
272
|
+
|
|
273
|
+
protected initControlScheduler(logics: IControlLogic[] = []): void {
|
|
274
|
+
const actualLogics = [...logics];
|
|
275
|
+
// 遍历所有的项,如果有逻辑的话加入
|
|
276
|
+
recursiveIterate(
|
|
277
|
+
this.model,
|
|
278
|
+
(item: IPanelItem) => {
|
|
279
|
+
if (item.controlLogics) {
|
|
280
|
+
actualLogics.push(...item.controlLogics);
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
{ childrenFields: ['rootPanelItems', 'panelItems', 'panelTabPages'] },
|
|
284
|
+
);
|
|
285
|
+
super.initControlScheduler(actualLogics);
|
|
286
|
+
}
|
|
271
287
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { recursiveIterate } from '@ibiz-template/core';
|
|
1
|
+
import { recursiveIterate, RuntimeError } from '@ibiz-template/core';
|
|
2
2
|
import {
|
|
3
3
|
IDEToolbar,
|
|
4
4
|
IDEToolbarItem,
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
IExtraButton,
|
|
14
14
|
IButtonState,
|
|
15
15
|
} from '../../../interface';
|
|
16
|
+
import { getUIActionById } from '../../../model';
|
|
16
17
|
import { ControlVO } from '../../../service';
|
|
17
18
|
import { UIActionUtil } from '../../../ui-action';
|
|
18
19
|
import { ControlController } from '../../common';
|
|
@@ -69,15 +70,35 @@ export class ToolbarController<
|
|
|
69
70
|
// 执行界面行为
|
|
70
71
|
if (item.itemType === 'DEUIACTION') {
|
|
71
72
|
const actionId = (item as IDETBUIActionItem).uiactionId;
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
const uiAction = await getUIActionById(actionId!);
|
|
74
|
+
if (!uiAction) {
|
|
75
|
+
throw new RuntimeError(`没有找到界面行为模型${actionId}`);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// 是否过程中启用loading
|
|
79
|
+
const enableLoading =
|
|
80
|
+
['SYS', 'BACKEND', 'WFBACKEND'].includes(uiAction.uiactionMode!) &&
|
|
81
|
+
uiAction.showBusyIndicator !== false;
|
|
82
|
+
|
|
83
|
+
if (enableLoading) {
|
|
84
|
+
this.state.buttonsState.setLoading(item.id!);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
const res = await this.ctx.view.call(ViewCallTag.GET_DATA);
|
|
89
|
+
const data = res || [];
|
|
90
|
+
const args = this.getEventArgs();
|
|
91
|
+
args.params = Object.assign(param, args.params);
|
|
92
|
+
await UIActionUtil.execAndResolved(actionId!, {
|
|
93
|
+
...args,
|
|
94
|
+
data,
|
|
95
|
+
event,
|
|
96
|
+
});
|
|
97
|
+
} finally {
|
|
98
|
+
if (enableLoading) {
|
|
99
|
+
this.state.buttonsState.setLoading('');
|
|
100
|
+
}
|
|
101
|
+
}
|
|
81
102
|
}
|
|
82
103
|
}
|
|
83
104
|
|
|
@@ -122,21 +143,16 @@ export class ToolbarController<
|
|
|
122
143
|
event: MouseEvent,
|
|
123
144
|
params?: IData,
|
|
124
145
|
): Promise<void> {
|
|
125
|
-
this.state.buttonsState.setLoading(item.id!);
|
|
126
146
|
const isExtra = (item as IExtraButton).buttonType === 'extra';
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
await this.doUIAction(item, event, params);
|
|
137
|
-
}
|
|
138
|
-
} finally {
|
|
139
|
-
this.state.buttonsState.setLoading('');
|
|
147
|
+
await this._evt.emit('onClick', {
|
|
148
|
+
event,
|
|
149
|
+
eventArg: item.id!,
|
|
150
|
+
buttonType: isExtra ? 'extra' : 'deuiaction',
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// 工具栏才走界面行为
|
|
154
|
+
if (!isExtra) {
|
|
155
|
+
await this.doUIAction(item, event, params);
|
|
140
156
|
}
|
|
141
157
|
}
|
|
142
158
|
|
|
@@ -43,7 +43,7 @@ export interface IPanelItemController {
|
|
|
43
43
|
* @date 2022-09-20 18:09:56
|
|
44
44
|
* @param {string[]} names
|
|
45
45
|
*/
|
|
46
|
-
dataChangeNotify(names: string[]): void
|
|
46
|
+
dataChangeNotify(names: string[]): Promise<void>;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* 面板状态变更通知
|
|
@@ -51,5 +51,5 @@ export interface IPanelItemController {
|
|
|
51
51
|
* @author lxm
|
|
52
52
|
* @date 2022-09-20 18:09:07
|
|
53
53
|
*/
|
|
54
|
-
panelStateNotify(
|
|
54
|
+
panelStateNotify(state: PanelNotifyState): Promise<void>;
|
|
55
55
|
}
|
|
@@ -39,7 +39,11 @@ export class ItemDynaLogicTrigger extends LogicTrigger {
|
|
|
39
39
|
|
|
40
40
|
match(matchParams: ITriggerMatchParams): boolean {
|
|
41
41
|
const superResult = super.match(matchParams);
|
|
42
|
-
return
|
|
42
|
+
return (
|
|
43
|
+
superResult &&
|
|
44
|
+
// 忽略大小写匹配
|
|
45
|
+
matchParams.itemName?.toLowerCase() === this.logic.itemName?.toLowerCase()
|
|
46
|
+
);
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
execute(executeParams: IUILogicParams): boolean {
|
|
@@ -115,7 +115,7 @@ export abstract class Method {
|
|
|
115
115
|
);
|
|
116
116
|
break;
|
|
117
117
|
case 'GET':
|
|
118
|
-
res = await this.app.net.get(`${path}/${methodName}`, data);
|
|
118
|
+
res = await this.app.net.get(`${path}/${methodName}`, data || params);
|
|
119
119
|
break;
|
|
120
120
|
case 'PUT': {
|
|
121
121
|
res = await this.app.net.put(
|
|
@@ -125,7 +125,10 @@ export abstract class Method {
|
|
|
125
125
|
break;
|
|
126
126
|
}
|
|
127
127
|
case 'DELETE':
|
|
128
|
-
res = await this.app.net.delete(
|
|
128
|
+
res = await this.app.net.delete(
|
|
129
|
+
`${path}/${methodName}`,
|
|
130
|
+
data || params,
|
|
131
|
+
);
|
|
129
132
|
break;
|
|
130
133
|
default:
|
|
131
134
|
if (requestMethod) {
|
|
@@ -158,11 +158,11 @@ export class DynamicCodeListCache {
|
|
|
158
158
|
): Promise<CodeListItem[]> {
|
|
159
159
|
const app = ibiz.hub.getApp(context.srfappid);
|
|
160
160
|
// *预定义加载
|
|
161
|
+
// 特殊处理,避免预置代码表加载不全
|
|
162
|
+
if (!params.size) {
|
|
163
|
+
params = { ...params, size: 10000 };
|
|
164
|
+
}
|
|
161
165
|
if (this.isPredefined) {
|
|
162
|
-
// 特殊处理,避免预置代码表加载不全
|
|
163
|
-
if (!params.size) {
|
|
164
|
-
params = { ...params, size: 10000 };
|
|
165
|
-
}
|
|
166
166
|
const res = await app.net.get(
|
|
167
167
|
`/dictionaries/codelist/${this.codeList.codeName}`,
|
|
168
168
|
params,
|
|
@@ -34,8 +34,8 @@ export function getWFSubmitViewId(
|
|
|
34
34
|
const key = type
|
|
35
35
|
? `WFUTILACTION@${type.toUpperCase()}`
|
|
36
36
|
: `WFACTION@${ibiz.env.isMob ? sequenceflowmobview : sequenceflowview}`;
|
|
37
|
-
const submitViewRef = appViewRefs
|
|
38
|
-
return viewRef.name
|
|
37
|
+
const submitViewRef = appViewRefs?.find(viewRef => {
|
|
38
|
+
return viewRef.name!.indexOf(key) !== -1;
|
|
39
39
|
});
|
|
40
40
|
return submitViewRef?.refAppViewId;
|
|
41
41
|
}
|