@ibiz-template/runtime 0.0.1-alpha.2 → 0.0.1-alpha.21

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 (55) hide show
  1. package/dist/system/index-de65cfae.system.js +1 -0
  2. package/out/command/app/open-app-view/open-app-view.d.ts +0 -11
  3. package/out/command/app/open-app-view/open-app-view.d.ts.map +1 -1
  4. package/out/command/app/open-app-view/open-app-view.js +6 -15
  5. package/out/index.d.ts +1 -0
  6. package/out/index.d.ts.map +1 -1
  7. package/out/index.js +1 -0
  8. package/out/install.d.ts.map +1 -1
  9. package/out/install.js +3 -0
  10. package/out/interface/index.d.ts +3 -0
  11. package/out/interface/index.d.ts.map +1 -1
  12. package/out/interface/index.js +3 -0
  13. package/out/interface/provider/i-editor-provider.d.ts +38 -0
  14. package/out/interface/provider/i-editor-provider.d.ts.map +1 -0
  15. package/out/interface/provider/i-editor-provider.js +1 -0
  16. package/out/interface/register/i-editor-register.d.ts +23 -0
  17. package/out/interface/register/i-editor-register.d.ts.map +1 -0
  18. package/out/interface/register/i-editor-register.js +1 -0
  19. package/out/interface/register/i-register.d.ts +38 -0
  20. package/out/interface/register/i-register.d.ts.map +1 -0
  21. package/out/interface/register/i-register.js +1 -0
  22. package/out/interface/util/i-loading-util/i-loading-util.d.ts +14 -0
  23. package/out/interface/util/i-loading-util/i-loading-util.d.ts.map +1 -1
  24. package/out/register/register.d.ts +20 -0
  25. package/out/register/register.d.ts.map +1 -0
  26. package/out/register/register.js +10 -0
  27. package/out/types.d.ts +9 -0
  28. package/out/types.d.ts.map +1 -1
  29. package/out/utils/app-de-ui-action-util/app-de-ui-action-util.d.ts +11 -10
  30. package/out/utils/app-de-ui-action-util/app-de-ui-action-util.d.ts.map +1 -1
  31. package/out/utils/app-de-ui-action-util/app-de-ui-action-util.js +52 -31
  32. package/out/utils/index.d.ts +1 -0
  33. package/out/utils/index.d.ts.map +1 -1
  34. package/out/utils/index.js +1 -0
  35. package/out/utils/open-redirect-view/open-redirect-view.d.ts +42 -0
  36. package/out/utils/open-redirect-view/open-redirect-view.d.ts.map +1 -0
  37. package/out/utils/open-redirect-view/open-redirect-view.js +149 -0
  38. package/out/view-logic/view-logic.d.ts +7 -6
  39. package/out/view-logic/view-logic.d.ts.map +1 -1
  40. package/out/view-logic/view-logic.js +20 -10
  41. package/package.json +20 -10
  42. package/src/command/app/open-app-view/open-app-view.ts +12 -26
  43. package/src/index.ts +1 -0
  44. package/src/install.ts +3 -0
  45. package/src/interface/index.ts +3 -0
  46. package/src/interface/provider/i-editor-provider.ts +44 -0
  47. package/src/interface/register/i-editor-register.ts +23 -0
  48. package/src/interface/register/i-register.ts +40 -0
  49. package/src/interface/util/i-loading-util/i-loading-util.ts +14 -0
  50. package/src/register/register.ts +20 -0
  51. package/src/types.ts +10 -0
  52. package/src/utils/app-de-ui-action-util/app-de-ui-action-util.ts +64 -41
  53. package/src/utils/index.ts +1 -0
  54. package/src/utils/open-redirect-view/open-redirect-view.ts +187 -0
  55. package/src/view-logic/view-logic.ts +31 -14
@@ -1,6 +1,7 @@
1
1
  import { IBizContext } from '@ibiz-template/core';
2
- import { IPSAppView } from '@ibiz-template/model';
2
+ import { IPSAppRedirectView, IPSAppView } from '@ibiz-template/model';
3
3
  import { IModalData } from '../../../interface';
4
+ import { openRedirectView } from '../../../utils';
4
5
 
5
6
  /**
6
7
  * 打开应用视图
@@ -36,7 +37,12 @@ export class OpenAppViewCommand {
36
37
  ): Promise<IModalData | void> {
37
38
  await appView.fill(true);
38
39
  if (appView.redirectView) {
39
- return this.openRedirectView(appView);
40
+ return openRedirectView(
41
+ appView as IPSAppRedirectView,
42
+ context,
43
+ params,
44
+ _opts.data,
45
+ );
40
46
  }
41
47
  const { openMode = 'INDEXVIEWTAB' } = appView;
42
48
  switch (openMode) {
@@ -50,7 +56,10 @@ export class OpenAppViewCommand {
50
56
  throw new Error('未支持的视图打开模式: POPUPAPP');
51
57
  case 'POPOVER':
52
58
  return this.openPopover(appView, context, params);
53
- case 'DRAWER':
59
+ case 'DRAWER_LEFT':
60
+ case 'DRAWER_RIGHT':
61
+ case 'DRAWER_TOP':
62
+ case 'DRAWER_BOTTOM':
54
63
  return this.openDrawer(appView, context, params);
55
64
  case 'USER':
56
65
  return this.openUserCustom(appView, context, params);
@@ -59,29 +68,6 @@ export class OpenAppViewCommand {
59
68
  }
60
69
  }
61
70
 
62
- /**
63
- * 打开重定向视图
64
- *
65
- * @author chitanda
66
- * @date 2022-07-25 20:07:24
67
- * @protected
68
- * @param {IPSAppView} appView
69
- * @param {IBizContext} [context]
70
- * @param {IParams} [params={}]
71
- */
72
- protected openRedirectView(
73
- appView: IPSAppView,
74
- context?: IBizContext,
75
- params: IParams = {},
76
- ): void {
77
- console.log(
78
- 'OpenAppViewCommand.openRedirectView',
79
- appView,
80
- context,
81
- params,
82
- );
83
- }
84
-
85
71
  /**
86
72
  * 首页导航模式打开
87
73
  *
package/src/index.ts CHANGED
@@ -4,5 +4,6 @@ export { install } from './install';
4
4
  export * from './command';
5
5
  export * from './constant';
6
6
  export * from './interface';
7
+ export * from './register/register';
7
8
  export * from './utils';
8
9
  export * from './view-logic';
package/src/install.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { commands } from '@ibiz-template/command';
2
+ import { Register } from './register/register';
2
3
  import { installCommand } from './command';
3
4
 
4
5
  /**
@@ -12,6 +13,8 @@ export function install(): void {
12
13
  const { ibiz } = window;
13
14
  // 挂载指令控制器
14
15
  ibiz.commands = commands;
16
+ // 挂载注册中心
17
+ ibiz.register = new Register();
15
18
  // 安装默认指令
16
19
  installCommand();
17
20
  }
@@ -2,3 +2,6 @@ export { IModal } from './i-modal/i-modal';
2
2
  export { IModalData } from './i-modal-data/i-modal-data';
3
3
  export { IUIActionResult } from './i-ui-action-result/i-ui-action-result';
4
4
  export * from './util';
5
+ export * from './provider/i-editor-provider';
6
+ export * from './register/i-register';
7
+ export * from './register/i-editor-register';
@@ -0,0 +1,44 @@
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
+ }
@@ -0,0 +1,23 @@
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
+ *
8
+ * @author lxm
9
+ * @date 2022-09-19 19:09:14
10
+ * @export
11
+ * @interface IRegister
12
+ */
13
+ export interface IEditorRegister extends IRegister<IEditorProvider> {
14
+ /**
15
+ * 获取适配器
16
+ *
17
+ * @author lxm
18
+ * @date 2022-09-20 00:09:57
19
+ * @param {EditorModel} model 编辑器模型
20
+ * @returns {*} {(IEditorProvider | undefined)}
21
+ */
22
+ getByModel(model: EditorModel): IEditorProvider | undefined;
23
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * 注册器接口
3
+ *
4
+ * @author lxm
5
+ * @date 2022-09-19 19:09:14
6
+ * @export
7
+ * @interface IRegister
8
+ */
9
+ export interface IRegister<T> {
10
+ providers: Map<string, T>;
11
+
12
+ /**
13
+ * 注册适配器
14
+ *
15
+ * @author lxm
16
+ * @date 2022-09-19 19:09:48
17
+ * @param {string} key
18
+ * @param {T} provider
19
+ */
20
+ register(key: string, provider: T): void;
21
+
22
+ /**
23
+ * 注销适配器
24
+ *
25
+ * @author lxm
26
+ * @date 2022-09-19 19:09:59
27
+ * @param {string} key
28
+ */
29
+ unRegister(key: string): void;
30
+
31
+ /**
32
+ * 获取适配器
33
+ *
34
+ * @author lxm
35
+ * @date 2022-09-19 19:09:13
36
+ * @param {string} key
37
+ * @returns {*} {T}
38
+ */
39
+ get(key: string): T | undefined;
40
+ }
@@ -22,4 +22,18 @@ export interface ILoadingUtil {
22
22
  * @date 2022-08-17 17:08:48
23
23
  */
24
24
  hide(): void;
25
+ /**
26
+ * 显示顶部全局加载动画
27
+ *
28
+ * @author chitanda
29
+ * @date 2022-10-08 16:10:18
30
+ */
31
+ showRedirect(): void;
32
+ /**
33
+ * 隐藏顶部全局加载动画
34
+ *
35
+ * @author chitanda
36
+ * @date 2022-10-08 16:10:29
37
+ */
38
+ hideRedirect(): void;
25
39
  }
@@ -0,0 +1,20 @@
1
+ import { IEditorRegister } from '../interface';
2
+
3
+ /**
4
+ * 注册中心
5
+ *
6
+ * @author lxm
7
+ * @date 2022-09-19 19:09:10
8
+ * @export
9
+ * @class Register
10
+ */
11
+ export class Register {
12
+ /**
13
+ * 编辑器注册器
14
+ *
15
+ * @author lxm
16
+ * @date 2022-09-19 22:09:08
17
+ * @type {IEditorRegister}
18
+ */
19
+ editorRegister!: IEditorRegister;
20
+ }
package/src/types.ts CHANGED
@@ -7,6 +7,7 @@ import {
7
7
  IModalUtil,
8
8
  ILoadingUtil,
9
9
  } from './interface';
10
+ import { Register } from './register/register';
10
11
 
11
12
  declare module '@ibiz-template/core' {
12
13
  interface IBizSys {
@@ -62,5 +63,14 @@ declare module '@ibiz-template/core' {
62
63
  * @type {IOpenViewUtil}
63
64
  */
64
65
  openView: IOpenViewUtil;
66
+
67
+ /**
68
+ * 注册中心
69
+ *
70
+ * @author lxm
71
+ * @date 2022-09-19 19:09:23
72
+ * @type {Register}
73
+ */
74
+ register: Register;
65
75
  }
66
76
  }
@@ -1,4 +1,9 @@
1
- import { IPSAppDEUIAction, IPSNavigateContext } from '@ibiz-template/model';
1
+ import { IBizContext } from '@ibiz-template/core';
2
+ import {
3
+ IPSAppDEUIAction,
4
+ IPSNavigateContext,
5
+ UnsupportedModelError,
6
+ } from '@ibiz-template/model';
2
7
  import { notNilEmpty } from 'qx-util';
3
8
  import { OpenAppViewCommand } from '../../command';
4
9
  import { IUIActionResult } from '../../interface';
@@ -20,7 +25,7 @@ export class AppDEUIActionUtil {
20
25
  * @date 2022-08-29 15:08:47
21
26
  * @static
22
27
  * @param {IPSAppDEUIAction} action
23
- * @param {IContext} context
28
+ * @param {IBizContext} context
24
29
  * @param {(IData | null)} data
25
30
  * @param {IParams} [params]
26
31
  * @param {IData} [opts]
@@ -28,18 +33,17 @@ export class AppDEUIActionUtil {
28
33
  */
29
34
  static async exec(
30
35
  action: IPSAppDEUIAction,
31
- context: IContext,
36
+ context: IBizContext,
32
37
  data: IData[] | null,
33
38
  params: IParams,
34
39
  opts?: IData,
35
40
  ): Promise<IUIActionResult> {
36
- console.log(action);
37
41
  // **用户操作确认**
38
42
  if (action.enableConfirm && action.confirmMsg) {
39
43
  // todo 用户操作确认
40
44
  }
41
45
 
42
- const { intercom } = opts!;
46
+ const { neuron } = opts!;
43
47
  const result: IUIActionResult = {
44
48
  refresh: action.reloadData,
45
49
  closeView: action.closeEditView,
@@ -85,18 +89,18 @@ export class AppDEUIActionUtil {
85
89
 
86
90
  // *刷新引用视图
87
91
  if (result.refresh) {
88
- if (!intercom.call.refresh) {
92
+ if (!neuron.call.refresh) {
89
93
  throw new Error(`该视图不存在刷新能力`);
90
94
  }
91
- await intercom.call.refresh();
95
+ await neuron.call.refresh();
92
96
  }
93
97
 
94
98
  // *关闭引用视图
95
99
  if (result.closeView) {
96
- if (!intercom.call.closeView) {
100
+ if (!neuron.call.closeView) {
97
101
  throw new Error(`该视图不存在关闭视图能力`);
98
102
  }
99
- await intercom.call.closeView();
103
+ await neuron.call.closeView();
100
104
  }
101
105
 
102
106
  return result;
@@ -110,22 +114,22 @@ export class AppDEUIActionUtil {
110
114
  * @protected
111
115
  * @static
112
116
  * @param {IPSAppDEUIAction} action 界面行为
113
- * @param {IContext} context 上下文
117
+ * @param {IBizContext} context 上下文
114
118
  * @param {(IData[] | null)} data 数据集合
115
119
  * @param {IParams} params 视图参数
116
120
  * @returns {*} {Promise<{
117
- * resultContext: IContext; 处理后的上下文
121
+ * resultContext: IBizContext; 处理后的上下文
118
122
  * resultData: IData[]; 处理后的数据集合
119
123
  * resultParams: IParams; 处理后的视图参数
120
124
  * }>}
121
125
  */
122
126
  protected static async handleParams(
123
127
  action: IPSAppDEUIAction,
124
- context: IContext,
128
+ context: IBizContext,
125
129
  data: IData[] | null,
126
130
  params: IParams,
127
131
  ): Promise<{
128
- resultContext: IContext;
132
+ resultContext: IBizContext;
129
133
  resultData: IData[];
130
134
  resultParams: IParams;
131
135
  }> {
@@ -146,7 +150,7 @@ export class AppDEUIActionUtil {
146
150
  }
147
151
 
148
152
  // 处理上下文导航参数
149
- let resultContext: IData = {};
153
+ let tempContext = {};
150
154
  const navContexts = action.getPSNavigateContexts() || [];
151
155
 
152
156
  // 单项数据主键时,在导航参数开头加一个主键的导航参数,可以被配置的同名导航参数覆盖。
@@ -163,13 +167,15 @@ export class AppDEUIActionUtil {
163
167
  }
164
168
 
165
169
  if (notNilEmpty(navContexts)) {
166
- resultContext = convertNavData(
170
+ tempContext = convertNavData(
167
171
  navContexts!,
168
172
  context,
169
173
  params,
170
174
  data?.[0] || {},
171
175
  );
172
176
  }
177
+ const resultContext = new IBizContext(tempContext, context);
178
+
173
179
  // 处理导航视图参数
174
180
  let resultParams: IData = {};
175
181
  const navParams = action.getPSNavigateParams();
@@ -198,7 +204,7 @@ export class AppDEUIActionUtil {
198
204
  data: IData[] | null,
199
205
  opts?: IData,
200
206
  ): Promise<IUIActionResult> {
201
- const { intercom, event } = opts!;
207
+ const { neuron, event } = opts!;
202
208
  const { uIActionTag } = action;
203
209
  const result: IUIActionResult = {};
204
210
 
@@ -213,64 +219,81 @@ export class AppDEUIActionUtil {
213
219
  'Import',
214
220
  ].indexOf(uIActionTag) !== -1
215
221
  ) {
216
- console.log(`${uIActionTag}暂未支持`);
217
- return result;
222
+ throw new UnsupportedModelError(action, `${uIActionTag}暂未支持`);
218
223
  }
219
224
 
220
225
  // 打开新建数据视图
221
226
  if (uIActionTag === 'New') {
222
- if (!intercom.call.newData) {
227
+ if (!neuron.call.newData) {
223
228
  throw new Error(`该视图不存在newData能力`);
224
229
  }
225
- await intercom.call.newData(event);
230
+ await neuron.call.newData(event);
226
231
  }
227
- // 打开新建数据视图
232
+ // 打开编辑数据视图
228
233
  if (uIActionTag === 'Edit') {
229
- if (!intercom.call.openData) {
234
+ if (!neuron.call.openData) {
230
235
  throw new Error(`该视图不存在openData能力`);
231
236
  }
232
- await intercom.call.openData(data?.[0], event);
237
+ await neuron.call.openData(data?.[0], event);
233
238
  }
234
239
 
235
240
  // 保存能力
236
- const saveTags = ['SaveAndExit', 'Save', 'SaveAndStart', 'SaveRow'];
241
+ const saveTags = ['SaveAndExit', 'Save', 'SaveRow'];
237
242
  if (saveTags.indexOf(uIActionTag) !== -1) {
238
- if (!intercom.call.save) {
243
+ if (!neuron.call.save) {
239
244
  throw new Error(`该视图不存在save能力`);
240
245
  }
241
- await intercom.call.save();
246
+ await neuron.call.save();
242
247
  }
243
248
 
244
249
  // 保存并新建
245
250
  if (uIActionTag === 'SaveAndNew') {
246
- if (!intercom.call.saveAndNew) {
251
+ if (!neuron.call.saveAndNew) {
247
252
  throw new Error(`该视图不存在saveAndNew能力`);
248
253
  }
249
- await intercom.call.saveAndNew();
254
+ await neuron.call.saveAndNew();
250
255
  }
251
256
 
252
257
  // 删除能力
253
258
  if (uIActionTag === 'Remove' || uIActionTag === 'RemoveAndExit') {
254
- if (!intercom.call.remove) {
259
+ if (!neuron.call.remove) {
255
260
  throw new Error(`该视图不存在remove能力`);
256
261
  }
257
- await intercom.call.remove();
262
+ await neuron.call.remove();
258
263
  }
259
264
 
260
265
  // 新建行能力
261
266
  if (uIActionTag === 'NewRow') {
262
- if (!intercom.call.newRow) {
267
+ if (!neuron.call.newRow) {
263
268
  throw new Error(`该视图不存在newRow能力`);
264
269
  }
265
- await intercom.call.newRow();
270
+ await neuron.call.newRow();
271
+ }
272
+
273
+ // 切换搜索表单能力
274
+ if (uIActionTag === 'ToggleFilter') {
275
+ if (!neuron.call.toggleFilter) {
276
+ throw new Error(`该视图不存在ToggleFilter能力`);
277
+ }
278
+ neuron.call.toggleFilter();
279
+ }
280
+
281
+ // 工作流相关
282
+ if (uIActionTag === 'SaveAndStart') {
283
+ if (!neuron.call.wfStart) {
284
+ throw new Error(`该视图不存在SaveAndStart能力`);
285
+ }
286
+ await neuron.call.wfStart();
287
+ }
288
+ if (uIActionTag === 'ViewWFStep') {
289
+ if (!neuron.call.wfSubmit) {
290
+ throw new Error(`该视图不存在ViewWFStep能力`);
291
+ }
292
+ await neuron.call.wfSubmit();
266
293
  }
267
294
 
268
295
  // 需要关闭视图的
269
- if (
270
- ['SaveAndExit', 'Exit', 'SaveAndStart', 'RemoveAndExit'].indexOf(
271
- uIActionTag,
272
- ) !== -1
273
- ) {
296
+ if (['SaveAndExit', 'Exit', 'RemoveAndExit'].indexOf(uIActionTag) !== -1) {
274
297
  result.closeView = true;
275
298
  }
276
299
 
@@ -288,7 +311,7 @@ export class AppDEUIActionUtil {
288
311
  * @date 2022-08-29 15:08:51
289
312
  * @static
290
313
  * @param {IPSAppDEUIAction} action
291
- * @param {IContext} context
314
+ * @param {IBizContext} context
292
315
  * @param {(IData[] | null)} data
293
316
  * @param {IParams} params
294
317
  * @param {IData} [opts]
@@ -296,7 +319,7 @@ export class AppDEUIActionUtil {
296
319
  */
297
320
  static async executeFrontUIAction(
298
321
  action: IPSAppDEUIAction,
299
- context: IContext,
322
+ context: IBizContext,
300
323
  _data: IData[] | null,
301
324
  params: IParams,
302
325
  opts?: IData,
@@ -324,14 +347,14 @@ export class AppDEUIActionUtil {
324
347
  * @date 2022-08-28 20:08:35
325
348
  * @export
326
349
  * @param {IPSAppDEUIAction} action
327
- * @param {IContext} context
350
+ * @param {IBizContext} context
328
351
  * @param {IData[]} data
329
352
  * @param {IParams} params
330
353
  * @returns {*} {Promise<IUIActionResult>}
331
354
  */
332
355
  static async executeBackEndUIAction(
333
356
  action: IPSAppDEUIAction,
334
- context: IContext,
357
+ context: IBizContext,
335
358
  _data: IData[],
336
359
  params: IParams,
337
360
  ): Promise<IUIActionResult> {
@@ -1,2 +1,3 @@
1
1
  export { AppDEUIActionUtil } from './app-de-ui-action-util/app-de-ui-action-util';
2
2
  export * from './nav-params/nav-params';
3
+ export { openRedirectView } from './open-redirect-view/open-redirect-view';