@ibiz-template/runtime 0.0.1-alpha.32 → 0.0.1-alpha.34

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 (101) hide show
  1. package/dist/system/index.system.js +1 -1
  2. package/out/index.d.ts +1 -1
  3. package/out/index.d.ts.map +1 -1
  4. package/out/index.js +1 -1
  5. package/out/install.d.ts.map +1 -1
  6. package/out/install.js +3 -0
  7. package/out/interface/i-ui-action-handler/i-ui-action-handler.d.ts +27 -0
  8. package/out/interface/i-ui-action-handler/i-ui-action-handler.d.ts.map +1 -0
  9. package/out/interface/i-ui-action-handler/i-ui-action-handler.js +1 -0
  10. package/out/interface/index.d.ts +3 -1
  11. package/out/interface/index.d.ts.map +1 -1
  12. package/out/interface/index.js +2 -1
  13. package/out/interface/provider/i-ui-action-provider.d.ts +20 -0
  14. package/out/interface/provider/i-ui-action-provider.d.ts.map +1 -0
  15. package/out/interface/provider/i-ui-action-provider.js +1 -0
  16. package/out/interface/provider/index.d.ts +2 -0
  17. package/out/interface/provider/index.d.ts.map +1 -0
  18. package/out/interface/provider/index.js +1 -0
  19. package/out/interface/register/i-ui-action-register.d.ts +15 -0
  20. package/out/interface/register/i-ui-action-register.d.ts.map +1 -0
  21. package/out/interface/register/i-ui-action-register.js +1 -0
  22. package/out/interface/register/index.d.ts +3 -0
  23. package/out/interface/register/index.d.ts.map +1 -0
  24. package/out/interface/register/index.js +2 -0
  25. package/out/provider/index.d.ts +2 -0
  26. package/out/provider/index.d.ts.map +1 -0
  27. package/out/provider/index.js +1 -0
  28. package/out/provider/ui-action/backend-ui-action-provider.d.ts +15 -0
  29. package/out/provider/ui-action/backend-ui-action-provider.d.ts.map +1 -0
  30. package/out/provider/ui-action/backend-ui-action-provider.js +18 -0
  31. package/out/provider/ui-action/common-sys-ui-action-provider.d.ts +15 -0
  32. package/out/provider/ui-action/common-sys-ui-action-provider.d.ts.map +1 -0
  33. package/out/provider/ui-action/common-sys-ui-action-provider.js +18 -0
  34. package/out/provider/ui-action/front-ui-action-provider.d.ts +15 -0
  35. package/out/provider/ui-action/front-ui-action-provider.d.ts.map +1 -0
  36. package/out/provider/ui-action/front-ui-action-provider.js +18 -0
  37. package/out/provider/ui-action/index.d.ts +13 -0
  38. package/out/provider/ui-action/index.d.ts.map +1 -0
  39. package/out/provider/ui-action/index.js +44 -0
  40. package/out/register/index.d.ts +2 -0
  41. package/out/register/index.d.ts.map +1 -1
  42. package/out/register/index.js +2 -0
  43. package/out/register/register-center.d.ts +9 -0
  44. package/out/register/register-center.d.ts.map +1 -1
  45. package/out/register/register-center.js +11 -0
  46. package/out/register/ui-action-register.d.ts +17 -0
  47. package/out/register/ui-action-register.d.ts.map +1 -0
  48. package/out/register/ui-action-register.js +41 -0
  49. package/out/utils/app-de-ui-action-util/app-de-ui-action-util.d.ts +0 -59
  50. package/out/utils/app-de-ui-action-util/app-de-ui-action-util.d.ts.map +1 -1
  51. package/out/utils/app-de-ui-action-util/app-de-ui-action-util.js +3 -251
  52. package/out/utils/app-de-ui-action-util/handler/backend-ui-action-handler.d.ts +17 -0
  53. package/out/utils/app-de-ui-action-util/handler/backend-ui-action-handler.d.ts.map +1 -0
  54. package/out/utils/app-de-ui-action-util/handler/backend-ui-action-handler.js +23 -0
  55. package/out/utils/app-de-ui-action-util/handler/common-sys-ui-action-handler.d.ts +17 -0
  56. package/out/utils/app-de-ui-action-util/handler/common-sys-ui-action-handler.d.ts.map +1 -0
  57. package/out/utils/app-de-ui-action-util/handler/common-sys-ui-action-handler.js +89 -0
  58. package/out/utils/app-de-ui-action-util/handler/front-ui-action-handler.d.ts +17 -0
  59. package/out/utils/app-de-ui-action-util/handler/front-ui-action-handler.d.ts.map +1 -0
  60. package/out/utils/app-de-ui-action-util/handler/front-ui-action-handler.js +22 -0
  61. package/out/utils/app-de-ui-action-util/handler/index.d.ts +5 -0
  62. package/out/utils/app-de-ui-action-util/handler/index.d.ts.map +1 -0
  63. package/out/utils/app-de-ui-action-util/handler/index.js +4 -0
  64. package/out/utils/app-de-ui-action-util/handler/ui-action-handler.d.ts +82 -0
  65. package/out/utils/app-de-ui-action-util/handler/ui-action-handler.d.ts.map +1 -0
  66. package/out/utils/app-de-ui-action-util/handler/ui-action-handler.js +143 -0
  67. package/out/utils/app-de-ui-action-util/index.d.ts +3 -0
  68. package/out/utils/app-de-ui-action-util/index.d.ts.map +1 -0
  69. package/out/utils/app-de-ui-action-util/index.js +2 -0
  70. package/out/utils/index.d.ts +1 -1
  71. package/out/utils/index.d.ts.map +1 -1
  72. package/out/utils/index.js +1 -1
  73. package/out/utils/open-redirect-view/open-redirect-view.d.ts +6 -5
  74. package/out/utils/open-redirect-view/open-redirect-view.d.ts.map +1 -1
  75. package/out/utils/open-redirect-view/open-redirect-view.js +30 -40
  76. package/package.json +7 -9
  77. package/src/index.ts +1 -1
  78. package/src/install.ts +3 -0
  79. package/src/interface/i-ui-action-handler/i-ui-action-handler.ts +33 -0
  80. package/src/interface/index.ts +3 -1
  81. package/src/interface/provider/i-ui-action-provider.ts +20 -0
  82. package/src/interface/provider/index.ts +1 -0
  83. package/src/interface/register/i-ui-action-register.ts +15 -0
  84. package/src/interface/register/index.ts +2 -0
  85. package/src/provider/index.ts +1 -0
  86. package/src/provider/ui-action/backend-ui-action-provider.ts +22 -0
  87. package/src/provider/ui-action/common-sys-ui-action-provider.ts +22 -0
  88. package/src/provider/ui-action/front-ui-action-provider.ts +22 -0
  89. package/src/provider/ui-action/index.ts +50 -0
  90. package/src/register/index.ts +2 -0
  91. package/src/register/register-center.ts +12 -1
  92. package/src/register/ui-action-register.ts +48 -0
  93. package/src/utils/app-de-ui-action-util/app-de-ui-action-util.ts +4 -336
  94. package/src/utils/app-de-ui-action-util/handler/backend-ui-action-handler.ts +32 -0
  95. package/src/utils/app-de-ui-action-util/handler/common-sys-ui-action-handler.ts +109 -0
  96. package/src/utils/app-de-ui-action-util/handler/front-ui-action-handler.ts +39 -0
  97. package/src/utils/app-de-ui-action-util/handler/index.ts +4 -0
  98. package/src/utils/app-de-ui-action-util/handler/ui-action-handler.ts +215 -0
  99. package/src/utils/app-de-ui-action-util/index.ts +2 -0
  100. package/src/utils/index.ts +1 -1
  101. package/src/utils/open-redirect-view/open-redirect-view.ts +31 -38
@@ -0,0 +1,143 @@
1
+ import { IBizContext, RuntimeError } from '@ibiz-template/core';
2
+ import { notNilEmpty } from 'qx-util';
3
+ import { convertNavData } from '../../nav-params/nav-params';
4
+ import { AppDEUIActionUtil } from '../app-de-ui-action-util';
5
+ /**
6
+ * 界面行为处理器基类
7
+ *
8
+ * @author lxm
9
+ * @date 2022-10-25 14:10:31
10
+ * @export
11
+ * @class UIActionHandler
12
+ */
13
+ export class UIActionHandler {
14
+ async exec(action, context, data, params, opts) {
15
+ // **用户操作确认**
16
+ if (!(await this.isConfirm(action))) {
17
+ return {};
18
+ }
19
+ const { neuron } = opts;
20
+ const result = {
21
+ refresh: action.reloadData,
22
+ closeView: action.closeEditView,
23
+ };
24
+ // 执行不同类型的界面行为独有逻辑,并且合并result
25
+ const _result = await this.execAction(action, context, data, params, opts);
26
+ Object.assign(result, _result);
27
+ await this.doNextAction(action, context, data, params, opts);
28
+ await this.handleResult(result, neuron);
29
+ return result;
30
+ }
31
+ /**
32
+ * 用户操作确认
33
+ *
34
+ * @author lxm
35
+ * @date 2022-10-25 14:10:55
36
+ * @param {IPSAppDEUIAction} action 界面行为模型
37
+ * @returns {*} {Promise<boolean>}
38
+ */
39
+ async isConfirm(action) {
40
+ if (action.enableConfirm && action.confirmMsg) {
41
+ return ibiz.modal.confirm({ title: action.confirmMsg });
42
+ }
43
+ return true;
44
+ }
45
+ /**
46
+ * 执行后续界面行为
47
+ *
48
+ * @author lxm
49
+ * @date 2022-10-25 15:10:54
50
+ * @param {IPSAppDEUIAction} action
51
+ * @param {IBizContext} context
52
+ * @param {(IData[] | null)} data
53
+ * @param {IParams} params
54
+ * @param {(IData | undefined)} [opts]
55
+ * @returns {*} {Promise<void>}
56
+ */
57
+ async doNextAction(action, context, data, params, opts) {
58
+ const nextAction = action.getNextPSUIAction();
59
+ if (nextAction) {
60
+ await AppDEUIActionUtil.exec(nextAction, context, data, params, opts);
61
+ }
62
+ }
63
+ /**
64
+ * 处理结果(刷新和关闭视图)
65
+ *
66
+ * @author lxm
67
+ * @date 2022-10-25 14:10:11
68
+ * @param {IUIActionResult} result
69
+ * @param {IData} neuron
70
+ */
71
+ async handleResult(result, neuron) {
72
+ // *关闭引用视图,关闭后不再执行刷新
73
+ if (result.closeView) {
74
+ if (!neuron.call.closeView) {
75
+ throw new RuntimeError(`该视图不存在关闭视图能力`);
76
+ }
77
+ await neuron.call.closeView();
78
+ return;
79
+ }
80
+ // *刷新引用视图
81
+ if (result.refresh) {
82
+ if (!neuron.call.refresh) {
83
+ throw new RuntimeError(`该视图不存在刷新能力`);
84
+ }
85
+ await neuron.call.refresh();
86
+ }
87
+ }
88
+ /**
89
+ * 参数处理(根据数据目标和数据参数,导航参数)
90
+ *
91
+ * @author lxm
92
+ * @date 2022-08-29 17:08:00
93
+ * @protected
94
+ * @static
95
+ * @param {IPSAppDEUIAction} action 界面行为
96
+ * @param {IBizContext} context 上下文
97
+ * @param {(IData[] | null)} data 数据集合
98
+ * @param {IParams} params 视图参数
99
+ * @returns {*} {Promise<{
100
+ * resultContext: IBizContext; 处理后的上下文
101
+ * resultData: IData[]; 处理后的数据集合
102
+ * resultParams: IParams; 处理后的视图参数
103
+ * }>}
104
+ */
105
+ static async handleParams(action, context, data, params) {
106
+ let resultData = data || [];
107
+ // 数据目标不支持提示
108
+ if (['SINGLEDATA', 'MULTIDATA', 'MULTIKEY'].indexOf(action.actionTarget) !==
109
+ -1) {
110
+ throw new Error(`数据类型${action.actionTarget}暂未支持,请配置无数据或单项数据主键`);
111
+ }
112
+ // 数据目标为无数据时,清空数据
113
+ if (action.actionTarget === 'NONE') {
114
+ resultData = [];
115
+ }
116
+ // 处理上下文导航参数
117
+ let tempContext = {};
118
+ const navContexts = action.getPSNavigateContexts() || [];
119
+ // 单项数据主键时,在导航参数开头加一个主键的导航参数,可以被配置的同名导航参数覆盖。
120
+ const appDataEntity = action.getPSAppDataEntity();
121
+ if (appDataEntity && action.actionTarget === 'SINGLEKEY') {
122
+ await (appDataEntity === null || appDataEntity === void 0 ? void 0 : appDataEntity.fill(true));
123
+ const appDeName = appDataEntity.codeName.toLowerCase();
124
+ const { valueItem } = action;
125
+ navContexts.unshift({
126
+ key: appDeName,
127
+ value: valueItem || 'srfkey',
128
+ rawValue: false,
129
+ });
130
+ }
131
+ if (notNilEmpty(navContexts)) {
132
+ tempContext = convertNavData(navContexts, context, params, (data === null || data === void 0 ? void 0 : data[0]) || {});
133
+ }
134
+ const resultContext = new IBizContext(tempContext, context);
135
+ // 处理导航视图参数
136
+ let resultParams = {};
137
+ const navParams = action.getPSNavigateParams();
138
+ if (notNilEmpty(navParams)) {
139
+ resultParams = convertNavData(navParams, context, params, (data === null || data === void 0 ? void 0 : data[0]) || {});
140
+ }
141
+ return { resultContext, resultData, resultParams };
142
+ }
143
+ }
@@ -0,0 +1,3 @@
1
+ export * from './handler';
2
+ export * from './app-de-ui-action-util';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/app-de-ui-action-util/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './handler';
2
+ export * from './app-de-ui-action-util';
@@ -1,4 +1,4 @@
1
- export { AppDEUIActionUtil } from './app-de-ui-action-util/app-de-ui-action-util';
2
1
  export * from './nav-params/nav-params';
2
+ export * from './app-de-ui-action-util';
3
3
  export { openRedirectView } from './open-redirect-view/open-redirect-view';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC"}
@@ -1,3 +1,3 @@
1
- export { AppDEUIActionUtil } from './app-de-ui-action-util/app-de-ui-action-util';
2
1
  export * from './nav-params/nav-params';
2
+ export * from './app-de-ui-action-util';
3
3
  export { openRedirectView } from './open-redirect-view/open-redirect-view';
@@ -31,12 +31,13 @@ export declare function openDERedirectView(appView: IPSAppDERedirectView, contex
31
31
  * 计算重定向标识
32
32
  *
33
33
  * @author chitanda
34
- * @date 2022-09-28 16:09:47
34
+ * @date 2022-10-25 16:10:48
35
35
  * @export
36
- * @param {IPSAppDERedirectView} rdView
37
- * @param {boolean} isWf
38
- * @param {IData} data
36
+ * @param {IPSAppDataEntity} entity 重定向视图所在应用实体
37
+ * @param {IPSAppDERedirectView} rdView 重定向视图
38
+ * @param {string} wfStep 流程步骤
39
+ * @param {IData} data 当前数据
39
40
  * @return {*} {Promise<string>}
40
41
  */
41
- export declare function calcDERdTag(entity: IPSAppDataEntity, rdView: IPSAppDERedirectView, isWf: boolean, data: IData): Promise<string>;
42
+ export declare function calcDERdTag(entity: IPSAppDataEntity, rdView: IPSAppDERedirectView, wfStep: string, data: IData): Promise<string>;
42
43
  //# sourceMappingURL=open-redirect-view.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"open-redirect-view.d.ts","sourceRoot":"","sources":["../../../src/utils/open-redirect-view/open-redirect-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAEL,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAEnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,GAAE,WAA+B,EACxC,MAAM,GAAE,OAAY,EACpB,IAAI,GAAE,KAAK,EAAO,GACjB,OAAO,CAAC,UAAU,CAAC,CAarB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,oBAAoB,EAC7B,OAAO,GAAE,WAA+B,EACxC,MAAM,GAAE,OAAY,EACpB,IAAI,GAAE,KAAK,EAAO,GACjB,OAAO,CAAC,UAAU,CAAC,CA2ErB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,oBAAoB,EAC5B,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,KAAK,GACV,OAAO,CAAC,MAAM,CAAC,CAgCjB"}
1
+ {"version":3,"file":"open-redirect-view.d.ts","sourceRoot":"","sources":["../../../src/utils/open-redirect-view/open-redirect-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAEL,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAEnB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,GAAE,WAA+B,EACxC,MAAM,GAAE,OAAY,EACpB,IAAI,GAAE,KAAK,EAAO,GACjB,OAAO,CAAC,UAAU,CAAC,CAarB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,oBAAoB,EAC7B,OAAO,GAAE,WAA+B,EACxC,MAAM,GAAE,OAAY,EACpB,IAAI,GAAE,KAAK,EAAO,GACjB,OAAO,CAAC,UAAU,CAAC,CAgErB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,KAAK,GACV,OAAO,CAAC,MAAM,CAAC,CAkCjB"}
@@ -1,5 +1,6 @@
1
1
  import { IBizContext } from '@ibiz-template/core';
2
2
  import { DefectModelError, UnsupportedModelError, } from '@ibiz-template/model';
3
+ import { isNilOrEmpty, notNilEmpty } from 'qx-util';
3
4
  import { OpenAppViewCommand } from '../../command';
4
5
  import { convertNavData } from '../nav-params/nav-params';
5
6
  /**
@@ -66,25 +67,14 @@ export async function openDERedirectView(appView, context = new IBizContext(), p
66
67
  return { ok: false, data: [] };
67
68
  }
68
69
  }
69
- // 根据参数中是否给了 srfwf 来判断是否为工作流
70
- const isWf = !!params.srfwf;
71
- const rdTag = await calcDERdTag(entity, appView, isWf, curData);
72
- // 用于查找实际重定向视图的标识,根据不同重定向类型后续做不同处理
73
- let findRdTag = rdTag;
74
- if (isWf) {
75
- findRdTag = `${rdTag.split(':')[0]}:${params.srfwf.toUpperCase()}`;
76
- }
70
+ const rdTag = await calcDERdTag(entity, appView, params.srfwf, curData);
71
+ // 拼接当前重定向视图所在应用实体名称为前缀
72
+ const deRdTag = `${entity.name.toUpperCase()}:${rdTag}`;
77
73
  // 所有重定向引用视图
78
74
  const allRefViews = appView.getRedirectPSAppViewRefs();
79
- let refView = allRefViews === null || allRefViews === void 0 ? void 0 : allRefViews.find(view => {
80
- return view.name === findRdTag;
75
+ const refView = allRefViews === null || allRefViews === void 0 ? void 0 : allRefViews.find(view => {
76
+ return view.name === deRdTag || view.name === rdTag;
81
77
  });
82
- if (!refView) {
83
- findRdTag = `${rdTag.split(':')[0]}`;
84
- refView = allRefViews === null || allRefViews === void 0 ? void 0 : allRefViews.find(view => {
85
- return view.name === findRdTag;
86
- });
87
- }
88
78
  if (refView) {
89
79
  const view = refView.getRefPSAppView();
90
80
  if (view) {
@@ -103,47 +93,47 @@ export async function openDERedirectView(appView, context = new IBizContext(), p
103
93
  * 计算重定向标识
104
94
  *
105
95
  * @author chitanda
106
- * @date 2022-09-28 16:09:47
96
+ * @date 2022-10-25 16:10:48
107
97
  * @export
108
- * @param {IPSAppDERedirectView} rdView
109
- * @param {boolean} isWf
110
- * @param {IData} data
98
+ * @param {IPSAppDataEntity} entity 重定向视图所在应用实体
99
+ * @param {IPSAppDERedirectView} rdView 重定向视图
100
+ * @param {string} wfStep 流程步骤
101
+ * @param {IData} data 当前数据
111
102
  * @return {*} {Promise<string>}
112
103
  */
113
- export async function calcDERdTag(entity, rdView, isWf, data) {
114
- const multiFormField = entity.getFormTypePSAppDEField();
115
- const indexTypeField = entity.getIndexTypePSAppDEField();
116
- // 重定向视图标识
104
+ export async function calcDERdTag(entity, rdView, wfStep, data) {
117
105
  let rdTag = '';
118
- // 重定向视图类别属性
106
+ // 重定向视图自定义类别属性
119
107
  const typeField = rdView.getTypePSAppDEField();
120
108
  // 自定义重定向
121
109
  if (typeField) {
122
110
  const value = data[typeField.codeName.toLowerCase()];
123
- if (value) {
124
- return value;
111
+ if (notNilEmpty(value)) {
112
+ return `RDITEM:${value}`;
125
113
  }
126
114
  }
127
- let typeValue = '';
128
- if (multiFormField) {
129
- typeValue = data[multiFormField.codeName.toLowerCase()];
115
+ // 如果流程步骤存在,按照工作流优先
116
+ if (notNilEmpty(wfStep)) {
117
+ return `EDITVIEW:${wfStep.toUpperCase()}`;
130
118
  }
131
- else if (indexTypeField) {
119
+ let typeValue = '';
120
+ // 从索引属性获取重定向视图类型
121
+ const indexTypeField = entity.getIndexTypePSAppDEField();
122
+ if (indexTypeField) {
132
123
  typeValue = data[indexTypeField.codeName.toLowerCase()];
133
124
  }
134
- if (typeValue) {
135
- if (isWf) {
136
- rdTag = `WFEDITVIEW:${typeValue}`;
137
- }
138
- else {
139
- rdTag = `EDITVIEW:${typeValue}`;
125
+ if (isNilOrEmpty(typeValue)) {
126
+ // 从多表单属性判断重定向视图类型
127
+ const multiFormField = entity.getFormTypePSAppDEField();
128
+ if (multiFormField) {
129
+ typeValue = data[multiFormField.codeName.toLowerCase()];
140
130
  }
141
131
  }
142
- else if (isWf) {
143
- rdTag = `WFEDITVIEW:`;
132
+ if (notNilEmpty(typeValue)) {
133
+ rdTag = `EDITVIEW:${typeValue}`;
144
134
  }
145
135
  else {
146
- rdTag = `EDITVIEW:`;
136
+ rdTag = `EDITVIEW`;
147
137
  }
148
138
  return rdTag;
149
139
  }
package/package.json CHANGED
@@ -1,13 +1,11 @@
1
1
  {
2
2
  "name": "@ibiz-template/runtime",
3
- "version": "0.0.1-alpha.32",
3
+ "version": "0.0.1-alpha.34",
4
4
  "description": "控制器包",
5
5
  "type": "module",
6
6
  "main": "out/index.js",
7
7
  "types": "out/index.d.ts",
8
- "exports": {
9
- "system": "./dist/system/index.system.js"
10
- },
8
+ "system": "./dist/system/index.system.js",
11
9
  "repository": {
12
10
  "type": "git",
13
11
  "url": "https://gitee.com/iBizModeling/ibiz-template.git"
@@ -30,12 +28,12 @@
30
28
  "author": "chitanda",
31
29
  "license": "MIT",
32
30
  "dependencies": {
33
- "@ibiz-template/command": "^0.0.1-alpha.32"
31
+ "@ibiz-template/command": "^0.0.1-alpha.33"
34
32
  },
35
33
  "devDependencies": {
36
- "@ibiz-template/core": "^0.0.1-alpha.32",
37
- "@ibiz-template/model": "^0.0.1-alpha.32",
38
- "@ibiz-template/service": "^0.0.1-alpha.32",
34
+ "@ibiz-template/core": "^0.0.1-alpha.34",
35
+ "@ibiz-template/model": "^0.0.1-alpha.34",
36
+ "@ibiz-template/service": "^0.0.1-alpha.34",
39
37
  "@types/systemjs": "^6.1.1",
40
38
  "qx-util": "0.4.3"
41
39
  },
@@ -45,5 +43,5 @@
45
43
  "@ibiz-template/service": "^0.0.1-alpha.2",
46
44
  "qx-util": "^0.4.1"
47
45
  },
48
- "gitHead": "810108ae44074a1ff8fe4366ec2ca5f421737627"
46
+ "gitHead": "6939c8852468dbe9b514f26d1ed28ad04802a09f"
49
47
  }
package/src/index.ts CHANGED
@@ -4,7 +4,7 @@ export { install } from './install';
4
4
  export * from './command';
5
5
  export * from './constant';
6
6
  export * from './interface';
7
- export { RegisterCenter } from './register/register-center';
7
+ export * from './provider';
8
8
  export * from './register';
9
9
  export * from './utils';
10
10
  export * from './view-logic';
package/src/install.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { commands } from '@ibiz-template/command';
2
2
  import { RegisterCenter } from './register/register-center';
3
3
  import { installCommand } from './command';
4
+ import { presetUIActionProvider } from './provider';
4
5
 
5
6
  /**
6
7
  * 安装运行时
@@ -17,4 +18,6 @@ export function install(): void {
17
18
  ibiz.register = new RegisterCenter();
18
19
  // 安装默认指令
19
20
  installCommand();
21
+ // 注册预置的界面行为适配器
22
+ presetUIActionProvider();
20
23
  }
@@ -0,0 +1,33 @@
1
+ import { IBizContext } from '@ibiz-template/core';
2
+ import { IPSAppDEUIAction } from '@ibiz-template/model';
3
+ import { IUIActionResult } from '../i-ui-action-result/i-ui-action-result';
4
+
5
+ /**
6
+ * 界面行为处理器接口
7
+ *
8
+ * @author lxm
9
+ * @date 2022-10-25 14:10:59
10
+ * @export
11
+ * @interface IUIActionHandler
12
+ */
13
+ export interface IUIActionHandler {
14
+ /**
15
+ * 执行界面行为
16
+ *
17
+ * @author lxm
18
+ * @date 2022-10-25 14:10:15
19
+ * @param {IPSAppDEUIAction} action 界面行为模型
20
+ * @param {IBizContext} context 上下文
21
+ * @param {(IData[] | null)} data 数据集合
22
+ * @param {IParams} params 视图参数
23
+ * @param {IData} [opts] 额外参数
24
+ * @returns {*} {Promise<IUIActionResult>}
25
+ */
26
+ exec(
27
+ action: IPSAppDEUIAction,
28
+ context: IBizContext,
29
+ data: IData[] | null,
30
+ params: IParams,
31
+ opts?: IData,
32
+ ): Promise<IUIActionResult>;
33
+ }
@@ -2,5 +2,7 @@ export { IModal } from './i-modal/i-modal';
2
2
  export { IModalData } from './i-modal-data/i-modal-data';
3
3
  export { IPluginFactory } from './i-plugin-factory/i-plugin-factory';
4
4
  export { IUIActionResult } from './i-ui-action-result/i-ui-action-result';
5
+ export { IUIActionHandler } from './i-ui-action-handler/i-ui-action-handler';
5
6
  export * from './util';
6
- export * from './register/i-register';
7
+ export * from './provider';
8
+ export * from './register';
@@ -0,0 +1,20 @@
1
+ import { IUIActionHandler } from '../i-ui-action-handler/i-ui-action-handler';
2
+
3
+ /**
4
+ * 界面行为适配器的接口
5
+ *
6
+ * @author lxm
7
+ * @date 2022-10-25 13:10:45
8
+ * @export
9
+ * @interface IUIActionProvider
10
+ */
11
+ export interface IUIActionProvider {
12
+ /**
13
+ * 获取界面行为处理器
14
+ *
15
+ * @author lxm
16
+ * @date 2022-10-25 15:10:52
17
+ * @returns {*} {Promise<IUIActionHandler>}
18
+ */
19
+ getHandler(): Promise<IUIActionHandler>;
20
+ }
@@ -0,0 +1 @@
1
+ export * from './i-ui-action-provider';
@@ -0,0 +1,15 @@
1
+ import { IPSAppUIAction } from '@ibiz-template/model';
2
+ import { IUIActionProvider } from '../provider';
3
+ import { IRegister } from './i-register';
4
+
5
+ export interface IUIActionRegister extends IRegister<IUIActionProvider> {
6
+ /**
7
+ * 获取适配器
8
+ *
9
+ * @author lxm
10
+ * @date 2022-09-20 00:09:57
11
+ * @param {IPSAppUIAction} model 界面行为模型
12
+ * @returns {*} {(IEditorProvider)}
13
+ */
14
+ get(model: IPSAppUIAction): Promise<IUIActionProvider>;
15
+ }
@@ -0,0 +1,2 @@
1
+ export * from './i-register';
2
+ export * from './i-ui-action-register';
@@ -0,0 +1 @@
1
+ export * from './ui-action';
@@ -0,0 +1,22 @@
1
+ import { IUIActionHandler, IUIActionProvider } from '../../interface';
2
+ import { BackendUIActionHandler } from '../../utils';
3
+
4
+ /**
5
+ * 后台调用界面行为适配器
6
+ *
7
+ * @author lxm
8
+ * @date 2022-10-25 15:10:51
9
+ * @export
10
+ * @class BackendUIActionProvider
11
+ * @implements {IUIActionProvider}
12
+ */
13
+ export class BackendUIActionProvider implements IUIActionProvider {
14
+ private handler?: IUIActionHandler;
15
+
16
+ async getHandler(): Promise<IUIActionHandler> {
17
+ if (!this.handler) {
18
+ this.handler = new BackendUIActionHandler();
19
+ }
20
+ return this.handler;
21
+ }
22
+ }
@@ -0,0 +1,22 @@
1
+ import { IUIActionHandler, IUIActionProvider } from '../../interface';
2
+ import { CommonSysUIActionHandler } from '../../utils';
3
+
4
+ /**
5
+ * 常用系统预置界面行为适配器
6
+ *
7
+ * @author lxm
8
+ * @date 2022-10-25 15:10:51
9
+ * @export
10
+ * @class CommonSysUIActionProvider
11
+ * @implements {IUIActionProvider}
12
+ */
13
+ export class CommonSysUIActionProvider implements IUIActionProvider {
14
+ private handler?: IUIActionHandler;
15
+
16
+ async getHandler(): Promise<IUIActionHandler> {
17
+ if (!this.handler) {
18
+ this.handler = new CommonSysUIActionHandler();
19
+ }
20
+ return this.handler;
21
+ }
22
+ }
@@ -0,0 +1,22 @@
1
+ import { IUIActionHandler, IUIActionProvider } from '../../interface';
2
+ import { FrontUIActionHandler } from '../../utils';
3
+
4
+ /**
5
+ * 前台调用界面行为适配器
6
+ *
7
+ * @author lxm
8
+ * @date 2022-10-25 15:10:51
9
+ * @export
10
+ * @class FrontUIActionProvider
11
+ * @implements {IUIActionProvider}
12
+ */
13
+ export class FrontUIActionProvider implements IUIActionProvider {
14
+ private handler?: IUIActionHandler;
15
+
16
+ async getHandler(): Promise<IUIActionHandler> {
17
+ if (!this.handler) {
18
+ this.handler = new FrontUIActionHandler();
19
+ }
20
+ return this.handler;
21
+ }
22
+ }
@@ -0,0 +1,50 @@
1
+ import { BackendUIActionProvider } from './backend-ui-action-provider';
2
+ import { CommonSysUIActionProvider } from './common-sys-ui-action-provider';
3
+ import { FrontUIActionProvider } from './front-ui-action-provider';
4
+
5
+ /**
6
+ * 预置默认的界面行为适配器
7
+ *
8
+ * @author lxm
9
+ * @date 2022-09-19 22:09:50
10
+ * @export
11
+ */
12
+ export function presetUIActionProvider(): void {
13
+ const { uiAction } = ibiz.register;
14
+ if (!uiAction) {
15
+ return;
16
+ }
17
+ // *前台调用
18
+ uiAction.register('FRONT', new FrontUIActionProvider());
19
+ // *后台调用
20
+ uiAction.register('BACKEND', new BackendUIActionProvider());
21
+ // *系统预置界面行为
22
+ // 打开新建数据视图
23
+ uiAction.register('SYS_New', new CommonSysUIActionProvider());
24
+ // 打开新建数据视图
25
+ uiAction.register('SYS_New', new CommonSysUIActionProvider());
26
+ // 打开编辑数据视图
27
+ uiAction.register('SYS_Edit', new CommonSysUIActionProvider());
28
+ // 保存
29
+ uiAction.register('SYS_Save', new CommonSysUIActionProvider());
30
+ uiAction.register('SYS_SaveAndExit', new CommonSysUIActionProvider());
31
+ uiAction.register('SYS_SaveRow', new CommonSysUIActionProvider());
32
+ uiAction.register('SYS_SaveAndNew', new CommonSysUIActionProvider());
33
+ // 删除
34
+ uiAction.register('SYS_Remove', new CommonSysUIActionProvider());
35
+ uiAction.register('SYS_RemoveAndExit', new CommonSysUIActionProvider());
36
+ uiAction.register('SYS_NewRow', new CommonSysUIActionProvider());
37
+ // 工作流
38
+ uiAction.register('SYS_SaveAndStart', new CommonSysUIActionProvider());
39
+ uiAction.register('SYS_ViewWFStep', new CommonSysUIActionProvider());
40
+ // 其他
41
+ uiAction.register('SYS_ToggleFilter', new CommonSysUIActionProvider());
42
+ uiAction.register('SYS_Exit', new CommonSysUIActionProvider());
43
+ uiAction.register('SYS_Refresh', new CommonSysUIActionProvider());
44
+ }
45
+
46
+ export {
47
+ FrontUIActionProvider,
48
+ CommonSysUIActionProvider,
49
+ BackendUIActionProvider,
50
+ };
@@ -1 +1,3 @@
1
+ export * from './register-center';
1
2
  export * from './register-base';
3
+ export * from './ui-action-register';
@@ -1,3 +1,5 @@
1
+ import { UIActionRegister } from './ui-action-register';
2
+
1
3
  /**
2
4
  * 注册中心
3
5
  *
@@ -6,4 +8,13 @@
6
8
  * @export
7
9
  * @class Register
8
10
  */
9
- export class RegisterCenter {}
11
+ export class RegisterCenter {
12
+ /**
13
+ * 界面行为注册器
14
+ *
15
+ * @author lxm
16
+ * @date 2022-10-25 15:10:39
17
+ * @type {UIActionRegister}
18
+ */
19
+ uiAction: UIActionRegister = new UIActionRegister();
20
+ }