@ibiz-template/runtime 0.5.0-beta.0 → 0.5.0-beta.2

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.
Files changed (80) hide show
  1. package/dist/index.esm.js +372 -556
  2. package/dist/index.system.min.js +2 -2
  3. package/out/controller/common/control/md-control.controller.d.ts +21 -1
  4. package/out/controller/common/control/md-control.controller.d.ts.map +1 -1
  5. package/out/controller/common/control/md-control.controller.js +31 -0
  6. package/out/controller/control/form/edit-form/edit-form.controller.d.ts.map +1 -1
  7. package/out/controller/control/form/edit-form/edit-form.controller.js +2 -1
  8. package/out/controller/control/gantt/gantt.controller.d.ts +6 -189
  9. package/out/controller/control/gantt/gantt.controller.d.ts.map +1 -1
  10. package/out/controller/control/gantt/gantt.controller.js +6 -412
  11. package/out/controller/control/gantt/gantt.service.d.ts +2 -2
  12. package/out/controller/control/gantt/gantt.service.d.ts.map +1 -1
  13. package/out/controller/control/gantt/gantt.service.js +5 -5
  14. package/out/controller/control/list/list.controller.d.ts +1 -30
  15. package/out/controller/control/list/list.controller.d.ts.map +1 -1
  16. package/out/controller/control/list/list.controller.js +0 -41
  17. package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
  18. package/out/controller/control/search-bar/search-bar.controller.js +48 -4
  19. package/out/controller/control/search-bar/search-bar.service.d.ts +24 -0
  20. package/out/controller/control/search-bar/search-bar.service.d.ts.map +1 -1
  21. package/out/controller/control/search-bar/search-bar.service.js +62 -16
  22. package/out/interface/controller/event/control/i-gantt.event.d.ts +2 -44
  23. package/out/interface/controller/event/control/i-gantt.event.d.ts.map +1 -1
  24. package/out/interface/controller/state/control/i-gantt.state.d.ts +2 -41
  25. package/out/interface/controller/state/control/i-gantt.state.d.ts.map +1 -1
  26. package/out/interface/controller/state/control/i-search-bar.state.d.ts +8 -1
  27. package/out/interface/controller/state/control/i-search-bar.state.d.ts.map +1 -1
  28. package/out/interface/service/i-parent-config/i-parent-config.d.ts +67 -0
  29. package/out/interface/service/i-parent-config/i-parent-config.d.ts.map +1 -0
  30. package/out/interface/service/i-parent-config/i-parent-config.js +1 -0
  31. package/out/interface/service/index.d.ts +1 -0
  32. package/out/interface/service/index.d.ts.map +1 -1
  33. package/out/interface/service/service/i-auth.service.d.ts +17 -0
  34. package/out/interface/service/service/i-auth.service.d.ts.map +1 -1
  35. package/out/service/dto/method.dto.d.ts +21 -1
  36. package/out/service/dto/method.dto.d.ts.map +1 -1
  37. package/out/service/dto/method.dto.js +65 -3
  38. package/out/service/service/auth/v7-auth.service.d.ts +2 -0
  39. package/out/service/service/auth/v7-auth.service.d.ts.map +1 -1
  40. package/out/service/service/auth/v7-auth.service.js +15 -0
  41. package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts +0 -1
  42. package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts.map +1 -1
  43. package/out/service/vo/gantt-node-data/gantt-data-set-node-data.js +1 -2
  44. package/out/service/vo/gantt-node-data/gantt-node-data-util.d.ts +0 -7
  45. package/out/service/vo/gantt-node-data/gantt-node-data-util.d.ts.map +1 -1
  46. package/out/service/vo/gantt-node-data/gantt-node-data-util.js +0 -18
  47. package/out/ui-action/provider/ui-action-provider-base.d.ts +10 -0
  48. package/out/ui-action/provider/ui-action-provider-base.d.ts.map +1 -1
  49. package/out/ui-action/provider/ui-action-provider-base.js +20 -9
  50. package/out/utils/index.d.ts +1 -1
  51. package/out/utils/index.d.ts.map +1 -1
  52. package/out/utils/index.js +1 -1
  53. package/out/utils/open-redirect-view/open-redirect-view.d.ts +25 -1
  54. package/out/utils/open-redirect-view/open-redirect-view.d.ts.map +1 -1
  55. package/out/utils/open-redirect-view/open-redirect-view.js +72 -31
  56. package/out/utils/ui-domain/ui-domain.d.ts +28 -0
  57. package/out/utils/ui-domain/ui-domain.d.ts.map +1 -1
  58. package/out/utils/ui-domain/ui-domain.js +40 -0
  59. package/package.json +6 -6
  60. package/src/controller/common/control/md-control.controller.ts +43 -0
  61. package/src/controller/control/form/edit-form/edit-form.controller.ts +2 -1
  62. package/src/controller/control/gantt/gantt.controller.ts +7 -492
  63. package/src/controller/control/gantt/gantt.service.ts +5 -5
  64. package/src/controller/control/list/list.controller.ts +0 -54
  65. package/src/controller/control/search-bar/search-bar.controller.ts +63 -10
  66. package/src/controller/control/search-bar/search-bar.service.ts +70 -16
  67. package/src/interface/controller/event/control/i-gantt.event.ts +2 -38
  68. package/src/interface/controller/state/control/i-gantt.state.ts +2 -47
  69. package/src/interface/controller/state/control/i-search-bar.state.ts +9 -1
  70. package/src/interface/service/i-parent-config/i-parent-config.ts +66 -0
  71. package/src/interface/service/index.ts +1 -0
  72. package/src/interface/service/service/i-auth.service.ts +19 -0
  73. package/src/service/dto/method.dto.ts +80 -3
  74. package/src/service/service/auth/v7-auth.service.ts +15 -0
  75. package/src/service/vo/gantt-node-data/gantt-data-set-node-data.ts +1 -4
  76. package/src/service/vo/gantt-node-data/gantt-node-data-util.ts +0 -21
  77. package/src/ui-action/provider/ui-action-provider-base.ts +34 -15
  78. package/src/utils/index.ts +1 -0
  79. package/src/utils/open-redirect-view/open-redirect-view.ts +93 -38
  80. package/src/utils/ui-domain/ui-domain.ts +44 -0
@@ -31,7 +31,6 @@ export abstract class UIActionProviderBase implements IUIActionProvider {
31
31
  action: IAppDEUIAction,
32
32
  args: IUILogicParams,
33
33
  ): Promise<IUIActionResult> {
34
- const { context, params, data } = args;
35
34
  const result: IUIActionResult = {
36
35
  refresh: action.reloadData,
37
36
  refreshMode: action.refreshMode,
@@ -61,13 +60,20 @@ export abstract class UIActionProviderBase implements IUIActionProvider {
61
60
  return this.returnError(result);
62
61
  }
63
62
 
63
+ // ** 界面行为执行之后,执行界面逻辑
64
+ if (action.uilogicAttachMode === 'AFTER') {
65
+ if (!appDEUILogicId) {
66
+ throw new RuntimeModelError(action, '没有配置实体界面逻辑');
67
+ }
68
+ await execUILogic(
69
+ appDEUILogicId,
70
+ appDataEntityId!,
71
+ this.mergeArgsByResult(args, result),
72
+ );
73
+ }
74
+
64
75
  // ** 后续界面行为
65
- const nextActionParams = {
66
- ...args,
67
- context: result.nextContext || context,
68
- data: result.data || data,
69
- params: result.nextParams || params,
70
- };
76
+ const nextActionParams = this.mergeArgsByResult(args, result);
71
77
  if (action.closeEditView) {
72
78
  // 关闭视图的情况下,不等待后续界面行为
73
79
  this.doNextAction(action, nextActionParams, action.appId);
@@ -85,17 +91,30 @@ export abstract class UIActionProviderBase implements IUIActionProvider {
85
91
  }
86
92
  }
87
93
 
88
- // ** 界面行为执行之后,执行界面逻辑
89
- if (action.uilogicAttachMode === 'AFTER') {
90
- if (!appDEUILogicId) {
91
- throw new RuntimeModelError(action, '没有配置实体界面逻辑');
92
- }
93
- await execUILogic(appDEUILogicId, appDataEntityId!, args);
94
- }
95
-
96
94
  return result;
97
95
  }
98
96
 
97
+ /**
98
+ * 根据界面行为逻辑返回值,合并参数获得后续逻辑要用的参数
99
+ * @author lxm
100
+ * @date 2023-12-25 02:42:23
101
+ * @protected
102
+ * @param {IUILogicParams} args 当前环境的参数
103
+ * @param {IUIActionResult} result 上一次逻辑执行的结果
104
+ * @return {*} {IUILogicParams}
105
+ */
106
+ protected mergeArgsByResult(
107
+ args: IUILogicParams,
108
+ result: IUIActionResult,
109
+ ): IUILogicParams {
110
+ return {
111
+ ...args,
112
+ context: result.nextContext || args.context,
113
+ data: result.data || args.data,
114
+ params: result.nextParams || args.params,
115
+ };
116
+ }
117
+
99
118
  /**
100
119
  * 有错误和取消时对result做的处理
101
120
  * @author lxm
@@ -4,6 +4,7 @@ export * from './nav-params/nav-params';
4
4
  export {
5
5
  toLocalOpenWFRedirectView,
6
6
  openRedirectView,
7
+ getDERedirectToView,
7
8
  } from './open-redirect-view/open-redirect-view';
8
9
  export * from './verify';
9
10
  export { LayoutPanelUtil } from './layout-panel-util/layout-panel-util';
@@ -12,6 +12,13 @@ import { OpenAppViewCommand } from '../../command';
12
12
  import { convertNavData } from '../nav-params/nav-params';
13
13
  import { calcDeCodeNameById, findFieldById } from '../../model';
14
14
 
15
+ type ToViewParams = {
16
+ context: IContext;
17
+ params: IParams;
18
+ opts: IOpenViewOptions;
19
+ viewId: string;
20
+ };
21
+
15
22
  /**
16
23
  * 打开重定向视图
17
24
  *
@@ -53,7 +60,7 @@ export async function toLocalOpenWFRedirectView(
53
60
  context: IContext,
54
61
  linkUrl: string,
55
62
  opts: IOpenViewOptions = {},
56
- ): Promise<void> {
63
+ ): Promise<ToViewParams> {
57
64
  const i = linkUrl.lastIndexOf('?');
58
65
  const queryStr: string = decodeURIComponent(
59
66
  linkUrl.substring(i + 1, linkUrl.length),
@@ -98,33 +105,32 @@ export async function toLocalOpenWFRedirectView(
98
105
  context.srfprocessinstanceid = params.srfprocessinstanceid;
99
106
  delete params.srfprocessinstanceid;
100
107
  }
101
- await ibiz.commands.execute(
102
- OpenAppViewCommand.TAG,
103
- deRdView.id,
108
+
109
+ return {
104
110
  context,
105
111
  params,
106
112
  opts,
107
- );
113
+ viewId: deRdView.id!,
114
+ };
108
115
  }
109
116
 
110
117
  /**
111
- * 打开实体重定向视图
112
- *
113
- * @author chitanda
114
- * @date 2022-09-28 16:09:15
118
+ * 获取处理后的重定向视图最终要跳转视图的相关信息
119
+ * @author lxm
120
+ * @date 2023-12-26 11:16:02
115
121
  * @export
116
122
  * @param {IAppDERedirectView} appView
117
- * @param {IContext}
123
+ * @param {IContext} context
118
124
  * @param {IParams} [params={}]
119
- * @param {IData[]} [data=[]]
120
- * @return {*} {Promise<IModalData>}
125
+ * @param {IOpenViewOptions} [opts={}]
126
+ * @return {*} {(Promise<({ type: 'view' } & ToViewParams) | { type: 'url'; url: string }>)}
121
127
  */
122
- export async function openDERedirectView(
128
+ export async function getDERedirectToView(
123
129
  appView: IAppDERedirectView,
124
130
  context: IContext,
125
131
  params: IParams = {},
126
132
  opts: IOpenViewOptions = {},
127
- ): Promise<IModalData> {
133
+ ): Promise<({ type: 'view' } & ToViewParams) | { type: 'url'; url: string }> {
128
134
  // 计算重定向视图上下文参数转换
129
135
  const navContext = appView.appViewNavContexts || [];
130
136
  const navContextData = convertNavData(navContext, params, context);
@@ -163,20 +169,17 @@ export async function openDERedirectView(
163
169
  }
164
170
 
165
171
  if (linkUrl.startsWith('http://') || linkUrl.startsWith('https://')) {
166
- return new Promise(resolve => {
167
- const newWindow = window.open(linkUrl, '_blank');
168
- if (newWindow) {
169
- (newWindow as IData).callback = (): void => {
170
- resolve({ ok: true, data: [] });
171
- };
172
- }
173
- });
172
+ return { type: 'url', url: linkUrl };
174
173
  }
175
174
  if (linkUrl.startsWith('appredirectview?')) {
176
- await toLocalOpenWFRedirectView(context, linkUrl, opts);
177
- return { ok: true, data: [] };
175
+ const toView = await toLocalOpenWFRedirectView(
176
+ context,
177
+ linkUrl,
178
+ opts,
179
+ );
180
+ return { type: 'view', ...toView };
178
181
  }
179
- return { ok: false, data: [] };
182
+ throw new RuntimeError(`未支持的linkUrl格式:${linkUrl}`);
180
183
  }
181
184
  }
182
185
  } finally {
@@ -191,8 +194,14 @@ export async function openDERedirectView(
191
194
  // 拼接当前重定向视图所在应用实体名称为前缀
192
195
  const deRdTag = `${entity.name!.toUpperCase()}:${rdTag}`;
193
196
  // 所有重定向引用视图
194
- const allRefViews = appView.redirectAppViewRefs;
195
- const refView = allRefViews?.find(view => {
197
+ const allRefViews = [];
198
+ if (appView.redirectAppViewRefs) {
199
+ allRefViews.push(...appView.redirectAppViewRefs);
200
+ }
201
+ if (appView.appViewRefs) {
202
+ allRefViews.push(...appView.appViewRefs);
203
+ }
204
+ const refView = allRefViews.find(view => {
196
205
  const matchKey = view.name || view.id;
197
206
  // 特殊补充 wfRdTag 匹配,子流程应用特殊模式
198
207
  return matchKey === deRdTag || matchKey === rdTag || matchKey === wfRdTag;
@@ -200,19 +209,15 @@ export async function openDERedirectView(
200
209
  if (refView) {
201
210
  const viewId = refView.refAppViewId;
202
211
  if (viewId) {
203
- const result = await ibiz.commands.execute(
204
- OpenAppViewCommand.TAG,
212
+ return {
213
+ type: 'view',
205
214
  viewId,
206
215
  context,
207
216
  params,
208
- { ...opts, data: [curData] },
209
- );
210
- if (result) {
211
- return result;
212
- }
213
- } else {
214
- throw new RuntimeModelError(refView, `未配置实际引用视图`);
217
+ opts: { ...opts, data: [curData] },
218
+ };
215
219
  }
220
+ throw new RuntimeModelError(refView, `未配置实际引用视图`);
216
221
  } else {
217
222
  ibiz.log.error(
218
223
  '重定向视图引用有:',
@@ -227,7 +232,56 @@ export async function openDERedirectView(
227
232
  `未找到重定向标识[${rdTag}]或[${deRdTag}]或工作流[${wfRdTag}]对应视图`,
228
233
  );
229
234
  }
230
- return { ok: true, data: [] };
235
+ }
236
+
237
+ /**
238
+ * 打开实体重定向视图
239
+ *
240
+ * @author chitanda
241
+ * @date 2022-09-28 16:09:15
242
+ * @export
243
+ * @param {IAppDERedirectView} appView
244
+ * @param {IContext}
245
+ * @param {IParams} [params={}]
246
+ * @param {IData[]} [data=[]]
247
+ * @return {*} {Promise<IModalData>}
248
+ */
249
+ export async function openDERedirectView(
250
+ appView: IAppDERedirectView,
251
+ context: IContext,
252
+ params: IParams = {},
253
+ opts: IOpenViewOptions = {},
254
+ ): Promise<IModalData> {
255
+ let toView: ({ type: 'view' } & ToViewParams) | { type: 'url'; url: string };
256
+ try {
257
+ toView = await getDERedirectToView(appView, context, params, opts);
258
+ } catch (error) {
259
+ ibiz.log.error(error);
260
+ return { ok: false, data: [] };
261
+ }
262
+
263
+ // 返回路径,则用window打开
264
+ if (toView.type === 'url') {
265
+ const openUrl = toView.url;
266
+ return new Promise(resolve => {
267
+ const newWindow = window.open(openUrl, '_blank');
268
+ if (newWindow) {
269
+ (newWindow as IData).callback = (): void => {
270
+ resolve({ ok: true, data: [] });
271
+ };
272
+ }
273
+ });
274
+ }
275
+
276
+ // 返回视图相关信息,则打开视图
277
+ const result = await ibiz.commands.execute(
278
+ OpenAppViewCommand.TAG,
279
+ toView.viewId,
280
+ toView.context,
281
+ toView.params,
282
+ toView.opts,
283
+ );
284
+ return result || { ok: true, data: [] };
231
285
  }
232
286
 
233
287
  /**
@@ -256,7 +310,8 @@ export async function calcDERdTag(
256
310
  const { codeName } = findFieldById(entity, typeFieldId)!;
257
311
  const value = data[codeName!.toLowerCase()];
258
312
  if (notNilEmpty(value)) {
259
- return `${value}`;
313
+ // 因为平台发布出来的标识全都是大写,所以这里也全部转大写
314
+ return `${value.toUpperCase()}`;
260
315
  }
261
316
  ibiz.log.warn(
262
317
  `重定向视图[${rdView.name}]自定义类别属性[${typeFieldId}]值为空`,
@@ -1,4 +1,5 @@
1
1
  import { createUUID } from 'qx-util';
2
+ import { IParentConfig } from '../../interface';
2
3
 
3
4
  /**
4
5
  * 界面域
@@ -18,6 +19,16 @@ export class UIDomain {
18
19
  */
19
20
  readonly id: string;
20
21
 
22
+ /**
23
+ * DTO 父子关系映射
24
+ *
25
+ * @author chitanda
26
+ * @date 2023-12-26 15:12:13
27
+ * @protected
28
+ * @type {Map<string, IParentConfig[]>}
29
+ */
30
+ protected rsMap: Map<string, IParentConfig[]> = new Map();
31
+
21
32
  /**
22
33
  * Creates an instance of UIDomain.
23
34
  *
@@ -34,6 +45,37 @@ export class UIDomain {
34
45
  }
35
46
  }
36
47
 
48
+ /**
49
+ * 设置当前界面域下,指定实体的相关父关系以及属性。在 DTO 包解析时设置此参数,销毁时清空
50
+ *
51
+ * @author chitanda
52
+ * @date 2023-12-26 15:12:31
53
+ * @param {string} entity
54
+ * @param {IParentConfig} config
55
+ */
56
+ setDERConfig(deCodeName: string, config: IParentConfig): void {
57
+ if (!this.rsMap.has(deCodeName)) {
58
+ this.rsMap.set(deCodeName, []);
59
+ }
60
+ const arr = this.rsMap.get(deCodeName)!;
61
+ arr.push(config);
62
+ }
63
+
64
+ /**
65
+ * 获取当前界面域下,具体实体的关系(在数据加载完成之后才有值)
66
+ *
67
+ * @author chitanda
68
+ * @date 2023-12-26 16:12:07
69
+ * @param {string} deCodeName
70
+ * @return {*} {IParentConfig[]}
71
+ */
72
+ getDERConfig(deCodeName: string): IParentConfig[] {
73
+ if (this.rsMap.has(deCodeName)) {
74
+ return this.rsMap.get(deCodeName)!;
75
+ }
76
+ return [];
77
+ }
78
+
37
79
  /**
38
80
  * 界面域销毁
39
81
  *
@@ -41,6 +83,8 @@ export class UIDomain {
41
83
  * @date 2023-12-22 15:12:49
42
84
  */
43
85
  destroy(): void {
86
+ // 清空当前域下的父子关系映射
87
+ this.rsMap.clear();
44
88
  const apps = ibiz.hub.getAllApps();
45
89
  apps.forEach(app => {
46
90
  app.deService.reset({