@ibiz-template/runtime 0.0.1-alpha.8 → 0.0.1-beta.1

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 (183) hide show
  1. package/dist/system/index.system.js +1 -0
  2. package/out/command/app/app-func/app-func.js +3 -3
  3. package/out/command/app/open-app-view/open-app-view.d.ts +2 -13
  4. package/out/command/app/open-app-view/open-app-view.d.ts.map +1 -1
  5. package/out/command/app/open-app-view/open-app-view.js +6 -18
  6. package/out/index.d.ts +3 -1
  7. package/out/index.d.ts.map +1 -1
  8. package/out/index.js +3 -1
  9. package/out/install.d.ts.map +1 -1
  10. package/out/install.js +5 -2
  11. package/out/interface/i-drawer-options/i-drawer-options.d.ts +29 -0
  12. package/out/interface/i-drawer-options/i-drawer-options.d.ts.map +1 -0
  13. package/out/interface/{provider/i-editor-provider.js → i-drawer-options/i-drawer-options.js} +0 -0
  14. package/out/interface/i-modal-data/i-modal-data.d.ts +1 -1
  15. package/out/interface/i-modal-data/i-modal-data.d.ts.map +1 -1
  16. package/out/interface/i-modal-options/i-modal-options.d.ts +35 -0
  17. package/out/interface/i-modal-options/i-modal-options.d.ts.map +1 -0
  18. package/out/interface/{register/i-editor-register.js → i-modal-options/i-modal-options.js} +0 -0
  19. package/out/interface/i-plugin-factory/i-plugin-factory.d.ts +39 -0
  20. package/out/interface/i-plugin-factory/i-plugin-factory.d.ts.map +1 -0
  21. package/out/interface/i-plugin-factory/i-plugin-factory.js +1 -0
  22. package/out/interface/i-popover-options/i-popover-options.d.ts +84 -0
  23. package/out/interface/i-popover-options/i-popover-options.d.ts.map +1 -0
  24. package/out/interface/i-popover-options/i-popover-options.js +1 -0
  25. package/out/interface/i-ui-action-handler/i-ui-action-handler.d.ts +27 -0
  26. package/out/interface/i-ui-action-handler/i-ui-action-handler.d.ts.map +1 -0
  27. package/out/interface/i-ui-action-handler/i-ui-action-handler.js +1 -0
  28. package/out/interface/index.d.ts +7 -3
  29. package/out/interface/index.d.ts.map +1 -1
  30. package/out/interface/index.js +2 -3
  31. package/out/interface/provider/i-ui-action-provider.d.ts +20 -0
  32. package/out/interface/provider/i-ui-action-provider.d.ts.map +1 -0
  33. package/out/interface/provider/i-ui-action-provider.js +1 -0
  34. package/out/interface/provider/index.d.ts +2 -0
  35. package/out/interface/provider/index.d.ts.map +1 -0
  36. package/out/interface/provider/index.js +1 -0
  37. package/out/interface/register/i-register.d.ts +8 -1
  38. package/out/interface/register/i-register.d.ts.map +1 -1
  39. package/out/interface/register/i-ui-action-register.d.ts +15 -0
  40. package/out/interface/register/i-ui-action-register.d.ts.map +1 -0
  41. package/out/interface/register/i-ui-action-register.js +1 -0
  42. package/out/interface/register/index.d.ts +3 -0
  43. package/out/interface/register/index.d.ts.map +1 -0
  44. package/out/interface/register/index.js +2 -0
  45. package/out/interface/util/i-loading-util/i-loading-util.d.ts +14 -0
  46. package/out/interface/util/i-loading-util/i-loading-util.d.ts.map +1 -1
  47. package/out/interface/util/i-open-view-util/i-open-view-util.d.ts +1 -1
  48. package/out/interface/util/i-open-view-util/i-open-view-util.d.ts.map +1 -1
  49. package/out/interface/util/i-overlay-container/i-overlay-container.d.ts +37 -0
  50. package/out/interface/util/i-overlay-container/i-overlay-container.d.ts.map +1 -0
  51. package/out/interface/util/i-overlay-container/i-overlay-container.js +1 -0
  52. package/out/interface/util/i-overlay-controller/i-overlay-controller.d.ts +86 -0
  53. package/out/interface/util/i-overlay-controller/i-overlay-controller.d.ts.map +1 -0
  54. package/out/interface/util/i-overlay-controller/i-overlay-controller.js +1 -0
  55. package/out/interface/util/i-overlay-popover-container/i-overlay-popover-container.d.ts +23 -0
  56. package/out/interface/util/i-overlay-popover-container/i-overlay-popover-container.d.ts.map +1 -0
  57. package/out/interface/util/i-overlay-popover-container/i-overlay-popover-container.js +1 -0
  58. package/out/interface/util/index.d.ts +3 -0
  59. package/out/interface/util/index.d.ts.map +1 -1
  60. package/out/plugin/index.d.ts +3 -0
  61. package/out/plugin/index.d.ts.map +1 -0
  62. package/out/plugin/index.js +2 -0
  63. package/out/plugin/plugin-static-resource/plugin-static-resource.d.ts +37 -0
  64. package/out/plugin/plugin-static-resource/plugin-static-resource.d.ts.map +1 -0
  65. package/out/plugin/plugin-static-resource/plugin-static-resource.js +31 -0
  66. package/out/plugin/remote-plugin-item/remote-plugin-item.d.ts +102 -0
  67. package/out/plugin/remote-plugin-item/remote-plugin-item.d.ts.map +1 -0
  68. package/out/plugin/remote-plugin-item/remote-plugin-item.js +22 -0
  69. package/out/provider/index.d.ts +2 -0
  70. package/out/provider/index.d.ts.map +1 -0
  71. package/out/provider/index.js +1 -0
  72. package/out/provider/ui-action/backend-ui-action-provider.d.ts +15 -0
  73. package/out/provider/ui-action/backend-ui-action-provider.d.ts.map +1 -0
  74. package/out/provider/ui-action/backend-ui-action-provider.js +18 -0
  75. package/out/provider/ui-action/common-sys-ui-action-provider.d.ts +15 -0
  76. package/out/provider/ui-action/common-sys-ui-action-provider.d.ts.map +1 -0
  77. package/out/provider/ui-action/common-sys-ui-action-provider.js +18 -0
  78. package/out/provider/ui-action/front-ui-action-provider.d.ts +15 -0
  79. package/out/provider/ui-action/front-ui-action-provider.d.ts.map +1 -0
  80. package/out/provider/ui-action/front-ui-action-provider.js +18 -0
  81. package/out/provider/ui-action/index.d.ts +13 -0
  82. package/out/provider/ui-action/index.d.ts.map +1 -0
  83. package/out/provider/ui-action/index.js +44 -0
  84. package/out/register/index.d.ts +4 -0
  85. package/out/register/index.d.ts.map +1 -0
  86. package/out/register/index.js +3 -0
  87. package/out/register/register-base.d.ts +18 -0
  88. package/out/register/register-base.d.ts.map +1 -0
  89. package/out/register/register-base.js +24 -0
  90. package/out/register/register-center.d.ts +20 -0
  91. package/out/register/register-center.d.ts.map +1 -0
  92. package/out/register/register-center.js +21 -0
  93. package/out/register/ui-action-register.d.ts +17 -0
  94. package/out/register/ui-action-register.d.ts.map +1 -0
  95. package/out/register/ui-action-register.js +41 -0
  96. package/out/types.d.ts +19 -3
  97. package/out/types.d.ts.map +1 -1
  98. package/out/utils/app-de-ui-action-util/app-de-ui-action-util.d.ts +3 -61
  99. package/out/utils/app-de-ui-action-util/app-de-ui-action-util.d.ts.map +1 -1
  100. package/out/utils/app-de-ui-action-util/app-de-ui-action-util.js +4 -241
  101. package/out/utils/app-de-ui-action-util/handler/backend-ui-action-handler.d.ts +17 -0
  102. package/out/utils/app-de-ui-action-util/handler/backend-ui-action-handler.d.ts.map +1 -0
  103. package/out/utils/app-de-ui-action-util/handler/backend-ui-action-handler.js +28 -0
  104. package/out/utils/app-de-ui-action-util/handler/common-sys-ui-action-handler.d.ts +17 -0
  105. package/out/utils/app-de-ui-action-util/handler/common-sys-ui-action-handler.d.ts.map +1 -0
  106. package/out/utils/app-de-ui-action-util/handler/common-sys-ui-action-handler.js +103 -0
  107. package/out/utils/app-de-ui-action-util/handler/front-ui-action-handler.d.ts +17 -0
  108. package/out/utils/app-de-ui-action-util/handler/front-ui-action-handler.d.ts.map +1 -0
  109. package/out/utils/app-de-ui-action-util/handler/front-ui-action-handler.js +24 -0
  110. package/out/utils/app-de-ui-action-util/handler/index.d.ts +5 -0
  111. package/out/utils/app-de-ui-action-util/handler/index.d.ts.map +1 -0
  112. package/out/utils/app-de-ui-action-util/handler/index.js +4 -0
  113. package/out/utils/app-de-ui-action-util/handler/ui-action-handler.d.ts +82 -0
  114. package/out/utils/app-de-ui-action-util/handler/ui-action-handler.d.ts.map +1 -0
  115. package/out/utils/app-de-ui-action-util/handler/ui-action-handler.js +143 -0
  116. package/out/utils/app-de-ui-action-util/index.d.ts +3 -0
  117. package/out/utils/app-de-ui-action-util/index.d.ts.map +1 -0
  118. package/out/utils/app-de-ui-action-util/index.js +2 -0
  119. package/out/utils/index.d.ts +2 -1
  120. package/out/utils/index.d.ts.map +1 -1
  121. package/out/utils/index.js +2 -1
  122. package/out/utils/open-redirect-view/open-redirect-view.d.ts +43 -0
  123. package/out/utils/open-redirect-view/open-redirect-view.d.ts.map +1 -0
  124. package/out/utils/open-redirect-view/open-redirect-view.js +139 -0
  125. package/out/view-logic/view-logic.d.ts +7 -6
  126. package/out/view-logic/view-logic.d.ts.map +1 -1
  127. package/out/view-logic/view-logic.js +19 -13
  128. package/package.json +22 -12
  129. package/src/command/app/app-func/app-func.ts +3 -3
  130. package/src/command/app/open-app-view/open-app-view.ts +12 -28
  131. package/src/index.ts +3 -1
  132. package/src/install.ts +5 -2
  133. package/src/interface/i-drawer-options/i-drawer-options.ts +28 -0
  134. package/src/interface/i-modal-data/i-modal-data.ts +1 -1
  135. package/src/interface/i-modal-options/i-modal-options.ts +35 -0
  136. package/src/interface/i-plugin-factory/i-plugin-factory.ts +39 -0
  137. package/src/interface/i-popover-options/i-popover-options.ts +85 -0
  138. package/src/interface/i-ui-action-handler/i-ui-action-handler.ts +33 -0
  139. package/src/interface/index.ts +10 -3
  140. package/src/interface/provider/i-ui-action-provider.ts +20 -0
  141. package/src/interface/provider/index.ts +1 -0
  142. package/src/interface/register/i-register.ts +8 -1
  143. package/src/interface/register/i-ui-action-register.ts +15 -0
  144. package/src/interface/register/index.ts +2 -0
  145. package/src/interface/util/i-loading-util/i-loading-util.ts +14 -0
  146. package/src/interface/util/i-open-view-util/i-open-view-util.ts +1 -0
  147. package/src/interface/util/i-overlay-container/i-overlay-container.ts +38 -0
  148. package/src/interface/util/i-overlay-controller/i-overlay-controller.ts +116 -0
  149. package/src/interface/util/i-overlay-popover-container/i-overlay-popover-container.ts +23 -0
  150. package/src/interface/util/index.ts +3 -0
  151. package/src/plugin/index.ts +5 -0
  152. package/src/plugin/plugin-static-resource/plugin-static-resource.ts +42 -0
  153. package/src/plugin/remote-plugin-item/remote-plugin-item.ts +107 -0
  154. package/src/provider/index.ts +1 -0
  155. package/src/provider/ui-action/backend-ui-action-provider.ts +22 -0
  156. package/src/provider/ui-action/common-sys-ui-action-provider.ts +22 -0
  157. package/src/provider/ui-action/front-ui-action-provider.ts +22 -0
  158. package/src/provider/ui-action/index.ts +50 -0
  159. package/src/register/index.ts +3 -0
  160. package/src/register/register-base.ts +27 -0
  161. package/src/register/register-center.ts +20 -0
  162. package/src/register/ui-action-register.ts +48 -0
  163. package/src/types.ts +20 -3
  164. package/src/utils/app-de-ui-action-util/app-de-ui-action-util.ts +6 -330
  165. package/src/utils/app-de-ui-action-util/handler/backend-ui-action-handler.ts +43 -0
  166. package/src/utils/app-de-ui-action-util/handler/common-sys-ui-action-handler.ts +125 -0
  167. package/src/utils/app-de-ui-action-util/handler/front-ui-action-handler.ts +46 -0
  168. package/src/utils/app-de-ui-action-util/handler/index.ts +4 -0
  169. package/src/utils/app-de-ui-action-util/handler/ui-action-handler.ts +215 -0
  170. package/src/utils/app-de-ui-action-util/index.ts +2 -0
  171. package/src/utils/index.ts +2 -1
  172. package/src/utils/open-redirect-view/open-redirect-view.ts +180 -0
  173. package/src/view-logic/view-logic.ts +30 -17
  174. package/out/interface/provider/i-editor-provider.d.ts +0 -38
  175. package/out/interface/provider/i-editor-provider.d.ts.map +0 -1
  176. package/out/interface/register/i-editor-register.d.ts +0 -23
  177. package/out/interface/register/i-editor-register.d.ts.map +0 -1
  178. package/out/register/register.d.ts +0 -20
  179. package/out/register/register.d.ts.map +0 -1
  180. package/out/register/register.js +0 -10
  181. package/src/interface/provider/i-editor-provider.ts +0 -44
  182. package/src/interface/register/i-editor-register.ts +0 -23
  183. package/src/register/register.ts +0 -20
@@ -0,0 +1,215 @@
1
+ import { IBizContext, RuntimeError } from '@ibiz-template/core';
2
+ import { IPSAppDEUIAction, IPSNavigateContext } from '@ibiz-template/model';
3
+ import { notNilEmpty } from 'qx-util';
4
+ import { IUIActionHandler, IUIActionResult } from '../../../interface';
5
+ import { convertNavData } from '../../nav-params/nav-params';
6
+ import { AppDEUIActionUtil } from '../app-de-ui-action-util';
7
+
8
+ /**
9
+ * 界面行为处理器基类
10
+ *
11
+ * @author lxm
12
+ * @date 2022-10-25 14:10:31
13
+ * @export
14
+ * @class UIActionHandler
15
+ */
16
+ export abstract class UIActionHandler implements IUIActionHandler {
17
+ async exec(
18
+ action: IPSAppDEUIAction,
19
+ context: IBizContext,
20
+ data: IData[] | null,
21
+ params: IParams,
22
+ opts?: IData | undefined,
23
+ ): Promise<IUIActionResult> {
24
+ // **用户操作确认**
25
+ if (!(await this.isConfirm(action))) {
26
+ return {};
27
+ }
28
+
29
+ const { neuron } = opts!;
30
+ const result: IUIActionResult = {
31
+ refresh: action.reloadData,
32
+ closeView: action.closeEditView,
33
+ };
34
+
35
+ // 执行不同类型的界面行为独有逻辑,并且合并result
36
+ const _result = await this.execAction(action, context, data, params, opts);
37
+ Object.assign(result, _result);
38
+
39
+ await this.doNextAction(action, context, data, params, opts);
40
+ await this.handleResult(result, neuron);
41
+ return result;
42
+ }
43
+
44
+ /**
45
+ * 用户操作确认
46
+ *
47
+ * @author lxm
48
+ * @date 2022-10-25 14:10:55
49
+ * @param {IPSAppDEUIAction} action 界面行为模型
50
+ * @returns {*} {Promise<boolean>}
51
+ */
52
+ async isConfirm(action: IPSAppDEUIAction): Promise<boolean> {
53
+ if (action.enableConfirm && action.confirmMsg) {
54
+ return ibiz.modal.confirm({ title: action.confirmMsg });
55
+ }
56
+ return true;
57
+ }
58
+
59
+ /**
60
+ * 执行具体界面行为的独有逻辑(子类重写)
61
+ *
62
+ * @author lxm
63
+ * @date 2022-10-25 15:10:03
64
+ * @abstract
65
+ * @param {IPSAppDEUIAction} action
66
+ * @param {IBizContext} context
67
+ * @param {(IData[] | null)} data
68
+ * @param {IParams} params
69
+ * @param {(IData | undefined)} [opts]
70
+ * @returns {*} {Promise<IUIActionResult>}
71
+ */
72
+ abstract execAction(
73
+ action: IPSAppDEUIAction,
74
+ context: IBizContext,
75
+ data: IData[] | null,
76
+ params: IParams,
77
+ opts?: IData | undefined,
78
+ ): Promise<IUIActionResult>;
79
+
80
+ /**
81
+ * 执行后续界面行为
82
+ *
83
+ * @author lxm
84
+ * @date 2022-10-25 15:10:54
85
+ * @param {IPSAppDEUIAction} action
86
+ * @param {IBizContext} context
87
+ * @param {(IData[] | null)} data
88
+ * @param {IParams} params
89
+ * @param {(IData | undefined)} [opts]
90
+ * @returns {*} {Promise<void>}
91
+ */
92
+ async doNextAction(
93
+ action: IPSAppDEUIAction,
94
+ context: IBizContext,
95
+ data: IData[] | null,
96
+ params: IParams,
97
+ opts?: IData | undefined,
98
+ ): Promise<void> {
99
+ const nextAction = action.getNextPSUIAction() as IPSAppDEUIAction;
100
+ if (nextAction) {
101
+ await AppDEUIActionUtil.exec(nextAction, context, data, params, opts);
102
+ }
103
+ }
104
+
105
+ /**
106
+ * 处理结果(刷新和关闭视图)
107
+ *
108
+ * @author lxm
109
+ * @date 2022-10-25 14:10:11
110
+ * @param {IUIActionResult} result
111
+ * @param {IData} neuron
112
+ */
113
+ async handleResult(result: IUIActionResult, neuron: IData): Promise<void> {
114
+ // *关闭引用视图,关闭后不再执行刷新
115
+ if (result.closeView) {
116
+ if (!neuron.call.closeView) {
117
+ throw new RuntimeError(`该视图不存在关闭视图能力`);
118
+ }
119
+ await neuron.call.closeView();
120
+ return;
121
+ }
122
+
123
+ // *刷新引用视图
124
+ if (result.refresh) {
125
+ if (!neuron.call.refresh) {
126
+ throw new RuntimeError(`该视图不存在刷新能力`);
127
+ }
128
+ await neuron.call.refresh();
129
+ }
130
+ }
131
+
132
+ /**
133
+ * 参数处理(根据数据目标和数据参数,导航参数)
134
+ *
135
+ * @author lxm
136
+ * @date 2022-08-29 17:08:00
137
+ * @protected
138
+ * @static
139
+ * @param {IPSAppDEUIAction} action 界面行为
140
+ * @param {IBizContext} context 上下文
141
+ * @param {(IData[] | null)} data 数据集合
142
+ * @param {IParams} params 视图参数
143
+ * @returns {*} {Promise<{
144
+ * resultContext: IBizContext; 处理后的上下文
145
+ * resultData: IData[]; 处理后的数据集合
146
+ * resultParams: IParams; 处理后的视图参数
147
+ * }>}
148
+ */
149
+ protected async handleParams(
150
+ action: IPSAppDEUIAction,
151
+ context: IBizContext,
152
+ data: IData[] | null,
153
+ params: IParams,
154
+ ): Promise<{
155
+ resultContext: IBizContext;
156
+ resultData: IData[];
157
+ resultParams: IParams;
158
+ }> {
159
+ let resultData = data || [];
160
+ // 数据目标不支持提示
161
+ if (
162
+ ['SINGLEDATA', 'MULTIDATA', 'MULTIKEY'].indexOf(action.actionTarget) !==
163
+ -1
164
+ ) {
165
+ throw new Error(
166
+ `数据类型${action.actionTarget}暂未支持,请配置无数据或单项数据主键`,
167
+ );
168
+ }
169
+
170
+ // 数据目标为无数据时,清空数据
171
+ if (action.actionTarget === 'NONE') {
172
+ resultData = [];
173
+ }
174
+
175
+ // 处理上下文导航参数
176
+ let tempContext = {};
177
+ const navContexts = action.getPSNavigateContexts() || [];
178
+
179
+ // 单项数据主键时,在导航参数开头加一个主键的导航参数,可以被配置的同名导航参数覆盖。
180
+ const appDataEntity = action.getPSAppDataEntity();
181
+ if (appDataEntity && action.actionTarget === 'SINGLEKEY') {
182
+ await appDataEntity?.fill(true);
183
+ const appDeName = appDataEntity.codeName.toLowerCase();
184
+ const { valueItem } = action;
185
+ navContexts.unshift({
186
+ key: appDeName,
187
+ value: valueItem || 'srfkey',
188
+ rawValue: false,
189
+ } as IPSNavigateContext);
190
+ }
191
+
192
+ if (notNilEmpty(navContexts)) {
193
+ tempContext = convertNavData(
194
+ navContexts!,
195
+ context,
196
+ params,
197
+ data?.[0] || {},
198
+ );
199
+ }
200
+ const resultContext = new IBizContext(tempContext, context);
201
+
202
+ // 处理导航视图参数
203
+ let resultParams: IData = {};
204
+ const navParams = action.getPSNavigateParams();
205
+ if (notNilEmpty(navParams)) {
206
+ resultParams = convertNavData(
207
+ navParams!,
208
+ context,
209
+ params,
210
+ data?.[0] || {},
211
+ );
212
+ }
213
+ return { resultContext, resultData, resultParams };
214
+ }
215
+ }
@@ -0,0 +1,2 @@
1
+ export * from './handler';
2
+ export * from './app-de-ui-action-util';
@@ -1,2 +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
+ export { openRedirectView } from './open-redirect-view/open-redirect-view';
@@ -0,0 +1,180 @@
1
+ import { IBizContext } from '@ibiz-template/core';
2
+ import {
3
+ DefectModelError,
4
+ IPSAppDataEntity,
5
+ IPSAppDERedirectView,
6
+ IPSAppRedirectView,
7
+ UnsupportedModelError,
8
+ } from '@ibiz-template/model';
9
+ import { isNilOrEmpty, notNilEmpty } from 'qx-util';
10
+ import { OpenAppViewCommand } from '../../command';
11
+ import { IModalData } from '../../interface';
12
+ import { convertNavData } from '../nav-params/nav-params';
13
+
14
+ /**
15
+ * 打开重定向视图
16
+ *
17
+ * @author chitanda
18
+ * @date 2022-09-28 16:09:13
19
+ * @export
20
+ * @param {IPSAppRedirectView} appView 应用重定向视图
21
+ * @param {IBizContext} [context=new IBizContext()]
22
+ * @param {IParams} [params={}]
23
+ * @param {IData} [data={}]
24
+ * @return {*} {Promise<IModalData>}
25
+ */
26
+ export async function openRedirectView(
27
+ appView: IPSAppRedirectView,
28
+ context: IBizContext = new IBizContext(),
29
+ params: IParams = {},
30
+ data: IData[] = [],
31
+ ): Promise<IModalData> {
32
+ if (appView.instanceof('app.view.IPSAppDERedirectView')) {
33
+ return openDERedirectView(
34
+ appView as IPSAppDERedirectView,
35
+ context,
36
+ params,
37
+ data,
38
+ );
39
+ }
40
+ throw new UnsupportedModelError(
41
+ appView,
42
+ `未支持的重定向视图类型: ${appView.viewType}`,
43
+ );
44
+ }
45
+
46
+ /**
47
+ * 打开实体重定向视图
48
+ *
49
+ * @author chitanda
50
+ * @date 2022-09-28 16:09:15
51
+ * @export
52
+ * @param {IPSAppDERedirectView} appView
53
+ * @param {IBizContext} [context=new IBizContext()]
54
+ * @param {IParams} [params={}]
55
+ * @param {IData[]} [data=[]]
56
+ * @return {*} {Promise<IModalData>}
57
+ */
58
+ export async function openDERedirectView(
59
+ appView: IPSAppDERedirectView,
60
+ context: IBizContext = new IBizContext(),
61
+ params: IParams = {},
62
+ data: IData[] = [],
63
+ ): Promise<IModalData> {
64
+ // 计算重定向视图上下文参数转换
65
+ const navContext = appView.getPSAppViewNavContexts() || [];
66
+ const navContextData = convertNavData(navContext, context, params);
67
+ context = new IBizContext(navContextData, context);
68
+ // 计算重定向视图视图参数转换
69
+ const navParams = appView.getPSAppViewNavParams() || [];
70
+ const navParamsData = convertNavData(navParams, context, params);
71
+ Object.assign(params, navParamsData);
72
+ // 重定向视图对应应用实体
73
+ const entity = appView.getPSAppDataEntity()!;
74
+ await entity.fill(true);
75
+ const key = entity.codeName.toLowerCase();
76
+ let curData: IData = data[0] || {};
77
+ // 将数据主键转换到上下文当中
78
+ context[key] = curData[key] || context[key] || params[key];
79
+ // 实体重定向视图获取数据行为
80
+ const action = appView.getGetDataPSAppDEAction();
81
+ const service = await ibiz.entityService.getService(entity.codeName);
82
+ ibiz.loading.showRedirect();
83
+ // 获取数据,未配置行为时,默认走 Get 行为
84
+ const res = await service.exec(
85
+ action ? action.codeName : 'Get',
86
+ context,
87
+ params,
88
+ );
89
+ ibiz.loading.hideRedirect();
90
+ if (res.ok) {
91
+ curData = res.data;
92
+ const linkUrl: string = curData.linkurl;
93
+ if (linkUrl) {
94
+ if (linkUrl.startsWith('http://') || linkUrl.startsWith('https://')) {
95
+ window.open(linkUrl, '_blank');
96
+ return { ok: true, data: [] };
97
+ }
98
+ return { ok: false, data: [] };
99
+ }
100
+ }
101
+ const rdTag = await calcDERdTag(entity, appView, params.srfwf, curData);
102
+ // 拼接当前重定向视图所在应用实体名称为前缀
103
+ const deRdTag = `${entity.name.toUpperCase()}:${rdTag}`;
104
+ // 所有重定向引用视图
105
+ const allRefViews = appView.getRedirectPSAppViewRefs();
106
+ const refView = allRefViews?.find(view => {
107
+ return view.name === deRdTag || view.name === rdTag;
108
+ });
109
+ if (refView) {
110
+ const view = refView.getRefPSAppView();
111
+ if (view) {
112
+ const result = await ibiz.commands.execute(
113
+ OpenAppViewCommand.TAG,
114
+ view,
115
+ context,
116
+ params,
117
+ { data: [curData] },
118
+ );
119
+ if (result) {
120
+ return result;
121
+ }
122
+ } else {
123
+ throw new DefectModelError(refView, `未配置实际引用视图`);
124
+ }
125
+ }
126
+ return { ok: true, data: [] };
127
+ }
128
+
129
+ /**
130
+ * 计算重定向标识
131
+ *
132
+ * @author chitanda
133
+ * @date 2022-10-25 16:10:48
134
+ * @export
135
+ * @param {IPSAppDataEntity} entity 重定向视图所在应用实体
136
+ * @param {IPSAppDERedirectView} rdView 重定向视图
137
+ * @param {string} wfStep 流程步骤
138
+ * @param {IData} data 当前数据
139
+ * @return {*} {Promise<string>}
140
+ */
141
+ export async function calcDERdTag(
142
+ entity: IPSAppDataEntity,
143
+ rdView: IPSAppDERedirectView,
144
+ wfStep: string,
145
+ data: IData,
146
+ ): Promise<string> {
147
+ let rdTag = '';
148
+ // 重定向视图自定义类别属性
149
+ const typeField = rdView.getTypePSAppDEField();
150
+ // 自定义重定向
151
+ if (typeField) {
152
+ const value = data[typeField.codeName.toLowerCase()];
153
+ if (notNilEmpty(value)) {
154
+ return value;
155
+ }
156
+ }
157
+ // 如果流程步骤存在,按照工作流优先
158
+ if (notNilEmpty(wfStep)) {
159
+ return `EDITVIEW:${wfStep.toUpperCase()}`;
160
+ }
161
+ let typeValue = '';
162
+ // 从索引属性获取重定向视图类型
163
+ const indexTypeField = entity.getIndexTypePSAppDEField();
164
+ if (indexTypeField) {
165
+ typeValue = data[indexTypeField.codeName.toLowerCase()];
166
+ }
167
+ if (isNilOrEmpty(typeValue)) {
168
+ // 从多表单属性判断重定向视图类型
169
+ const multiFormField = entity.getFormTypePSAppDEField();
170
+ if (multiFormField) {
171
+ typeValue = data[multiFormField.codeName.toLowerCase()];
172
+ }
173
+ }
174
+ if (notNilEmpty(typeValue)) {
175
+ rdTag = `EDITVIEW:${typeValue}`;
176
+ } else {
177
+ rdTag = `EDITVIEW`;
178
+ }
179
+ return rdTag;
180
+ }
@@ -20,14 +20,14 @@ import { AppDEUIActionUtil, convertNavData } from '../utils';
20
20
  * @date 2022-08-22 09:08:40
21
21
  * @export
22
22
  * @param {IPSAppViewLogic} viewLogic 视图逻辑模型对象
23
- * @param {IContext} context 上下文参数
23
+ * @param {IBizContext} context 上下文参数
24
24
  * @param {IParams} params 视图参数
25
25
  * @param {(IData | null)} data 数据集合
26
26
  * @param {IData} [opts] 额外参数,event是js原生事件
27
27
  */
28
28
  export async function executeViewLogic(
29
29
  viewLogic: IPSAppViewLogic,
30
- context: IContext,
30
+ context: IBizContext,
31
31
  data: IData[] | null,
32
32
  params: IParams,
33
33
  opts: IData = {},
@@ -42,7 +42,7 @@ export async function executeViewLogic(
42
42
  opts,
43
43
  );
44
44
  }
45
- if (viewLogic.name === 'newdata') {
45
+ if (viewLogic.name === 'newdata' && viewLogic.getPSAppUILogic()) {
46
46
  // 执行新建数据逻辑
47
47
  return executeNewDataAppUILogic(
48
48
  viewLogic.getPSAppUILogic() as IPSAppUINewDataLogic,
@@ -70,14 +70,14 @@ export async function executeViewLogic(
70
70
  * @date 2022-08-22 14:08:03
71
71
  * @export
72
72
  * @param {IPSAppUIOpenDataLogic} appUILogic 应用预置界面逻辑opendata模型对象
73
- * @param {IContext} context 上下文参数
73
+ * @param {IBizContext} context 上下文参数
74
74
  * @param {(IData | null)} data 数据集合
75
75
  * @param {IParams} params 视图参数
76
76
  * @param {IData} [opts] 额外参数,event是js原生事件
77
77
  */
78
78
  export async function executeOpenDataAppUILogic(
79
79
  appUILogic: IPSAppUIOpenDataLogic,
80
- context: IContext,
80
+ context: IBizContext,
81
81
  data: IData[] | null,
82
82
  params: IParams,
83
83
  opts: IData = {},
@@ -95,7 +95,6 @@ export async function executeOpenDataAppUILogic(
95
95
  await appDataEntity.init();
96
96
 
97
97
  // 处理导航参数
98
- let tempContext: IData = {};
99
98
  // 处理上下文导航参数
100
99
  const navContexts: IPSNavigateParam[] =
101
100
  openViewRef.getPSNavigateContexts() || [];
@@ -108,8 +107,10 @@ export async function executeOpenDataAppUILogic(
108
107
  rawValue: false,
109
108
  } as IPSNavigateParam);
110
109
  }
111
- tempContext = convertNavData(navContexts!, context, params, data[0]);
112
- tempContext = new IBizContext(tempContext, context);
110
+ const tempContext = new IBizContext(
111
+ convertNavData(navContexts!, context, params, data[0]),
112
+ context,
113
+ );
113
114
 
114
115
  // 处理导航视图参数
115
116
  let tempParams: IData = {};
@@ -119,13 +120,19 @@ export async function executeOpenDataAppUILogic(
119
120
  }
120
121
 
121
122
  // 打开视图
122
- return ibiz.commands.execute(
123
+ await ibiz.commands.execute(
123
124
  OpenAppViewCommand.TAG,
124
125
  openView,
125
126
  tempContext,
126
127
  tempParams,
127
128
  opts,
128
129
  );
130
+
131
+ // 刷新上一个视图
132
+ const { neuron } = opts!;
133
+ neuron.call.refresh();
134
+
135
+ return {};
129
136
  }
130
137
 
131
138
  /**
@@ -135,14 +142,14 @@ export async function executeOpenDataAppUILogic(
135
142
  * @date 2022-08-22 14:08:03
136
143
  * @export
137
144
  * @param {IPSAppUINewDataLogic} appUILogic 应用预置界面逻辑newdata模型对象
138
- * @param {IContext} context 上下文参数
145
+ * @param {IBizContext} context 上下文参数
139
146
  * @param {(IData | null)} data 数据集合
140
147
  * @param {IParams} params 视图参数
141
148
  * @param {IData} [opts] 额外参数,event是js原生事件
142
149
  */
143
150
  export async function executeNewDataAppUILogic(
144
151
  appUILogic: IPSAppUINewDataLogic,
145
- context: IContext,
152
+ context: IBizContext,
146
153
  data: IData[] | null,
147
154
  params: IParams,
148
155
  opts: IData = {},
@@ -164,16 +171,16 @@ export async function executeNewDataAppUILogic(
164
171
  if (notNilEmpty(navContexts)) {
165
172
  tempContext = convertNavData(navContexts!, context, params, _data);
166
173
  }
167
- const navParams = newViewRef.getPSNavigateParams();
168
- if (notNilEmpty(navParams)) {
169
- tempParams = convertNavData(navParams!, params, context, _data);
170
- }
171
174
  tempContext = new IBizContext(tempContext, context);
172
-
173
175
  // 删除上下文内的主键
174
176
  delete tempContext[appDataEntity.deName.toLowerCase()];
175
177
  tempContext[appDataEntity.deName.toLowerCase()] = undefined;
176
178
 
179
+ const navParams = newViewRef.getPSNavigateParams();
180
+ if (notNilEmpty(navParams)) {
181
+ tempParams = convertNavData(navParams!, params, context, _data);
182
+ }
183
+
177
184
  // todo 拷贝
178
185
  if (appUILogic.enableWizardAdd) {
179
186
  // todo 向导添加
@@ -184,11 +191,17 @@ export async function executeNewDataAppUILogic(
184
191
  }
185
192
 
186
193
  // 打开视图
187
- return ibiz.commands.execute(
194
+ await ibiz.commands.execute(
188
195
  OpenAppViewCommand.TAG,
189
196
  newView,
190
197
  tempContext,
191
198
  tempParams,
192
199
  opts,
193
200
  );
201
+
202
+ // 刷新上一个视图
203
+ const { neuron } = opts!;
204
+ neuron.call.refresh();
205
+
206
+ return {};
194
207
  }
@@ -1,38 +0,0 @@
1
- import { EditorModel } from '@ibiz-template/model';
2
- /**
3
- * 编辑器适配器的接口
4
- *
5
- * @author lxm
6
- * @date 2022-09-19 19:09:10
7
- * @export
8
- * @interface IProvider
9
- */
10
- export interface IEditorProvider<T extends unknown = unknown> {
11
- /**
12
- * 表单编辑器组件名称
13
- *
14
- * @author lxm
15
- * @date 2022-09-20 10:09:50
16
- * @type {string}
17
- */
18
- formEditor: string;
19
- /**
20
- * 表格编辑器组件名称
21
- *
22
- * @author lxm
23
- * @date 2022-09-20 10:09:08
24
- * @type {string}
25
- */
26
- rowEditor: string;
27
- /**
28
- * 创建编辑器控制器
29
- *
30
- * @author lxm
31
- * @date 2022-09-20 10:09:57
32
- * @param {EditorModel} editorModel 编辑器模型
33
- * @param {unknown} parentController 父控制器
34
- * @returns {*} {Promise<T>}
35
- */
36
- createController(editorModel: EditorModel, parentController: unknown): Promise<T>;
37
- }
38
- //# sourceMappingURL=i-editor-provider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"i-editor-provider.d.ts","sourceRoot":"","sources":["../../../src/interface/provider/i-editor-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO;IAC1D;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;;;OAQG;IACH,gBAAgB,CACd,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,OAAO,GACxB,OAAO,CAAC,CAAC,CAAC,CAAC;CACf"}
@@ -1,23 +0,0 @@
1
- import { EditorModel } from '@ibiz-template/model';
2
- import { IEditorProvider } from '../provider/i-editor-provider';
3
- import { IRegister } from './i-register';
4
- /**
5
- * 注册器接口
6
- *
7
- * @author lxm
8
- * @date 2022-09-19 19:09:14
9
- * @export
10
- * @interface IRegister
11
- */
12
- export interface IEditorRegister extends IRegister<IEditorProvider> {
13
- /**
14
- * 获取适配器
15
- *
16
- * @author lxm
17
- * @date 2022-09-20 00:09:57
18
- * @param {EditorModel} model 编辑器模型
19
- * @returns {*} {(IEditorProvider | undefined)}
20
- */
21
- getByModel(model: EditorModel): IEditorProvider | undefined;
22
- }
23
- //# sourceMappingURL=i-editor-register.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"i-editor-register.d.ts","sourceRoot":"","sources":["../../../src/interface/register/i-editor-register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;;;;;;GAOG;AACH,MAAM,WAAW,eAAgB,SAAQ,SAAS,CAAC,eAAe,CAAC;IACjE;;;;;;;OAOG;IACH,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,eAAe,GAAG,SAAS,CAAC;CAC7D"}
@@ -1,20 +0,0 @@
1
- import { IEditorRegister } from '../interface';
2
- /**
3
- * 注册中心
4
- *
5
- * @author lxm
6
- * @date 2022-09-19 19:09:10
7
- * @export
8
- * @class Register
9
- */
10
- export declare class Register {
11
- /**
12
- * 编辑器注册器
13
- *
14
- * @author lxm
15
- * @date 2022-09-19 22:09:08
16
- * @type {IEditorRegister}
17
- */
18
- editorRegister: IEditorRegister;
19
- }
20
- //# sourceMappingURL=register.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/register/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C;;;;;;;GAOG;AACH,qBAAa,QAAQ;IACnB;;;;;;OAMG;IACH,cAAc,EAAG,eAAe,CAAC;CAClC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * 注册中心
3
- *
4
- * @author lxm
5
- * @date 2022-09-19 19:09:10
6
- * @export
7
- * @class Register
8
- */
9
- export class Register {
10
- }
@@ -1,44 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-unnecessary-type-constraint */
2
- import { EditorModel } from '@ibiz-template/model';
3
-
4
- /**
5
- * 编辑器适配器的接口
6
- *
7
- * @author lxm
8
- * @date 2022-09-19 19:09:10
9
- * @export
10
- * @interface IProvider
11
- */
12
- export interface IEditorProvider<T extends unknown = unknown> {
13
- /**
14
- * 表单编辑器组件名称
15
- *
16
- * @author lxm
17
- * @date 2022-09-20 10:09:50
18
- * @type {string}
19
- */
20
- formEditor: string;
21
-
22
- /**
23
- * 表格编辑器组件名称
24
- *
25
- * @author lxm
26
- * @date 2022-09-20 10:09:08
27
- * @type {string}
28
- */
29
- rowEditor: string;
30
-
31
- /**
32
- * 创建编辑器控制器
33
- *
34
- * @author lxm
35
- * @date 2022-09-20 10:09:57
36
- * @param {EditorModel} editorModel 编辑器模型
37
- * @param {unknown} parentController 父控制器
38
- * @returns {*} {Promise<T>}
39
- */
40
- createController(
41
- editorModel: EditorModel,
42
- parentController: unknown,
43
- ): Promise<T>;
44
- }