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

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 (54) hide show
  1. package/out/command/app/open-app-view/open-app-view.d.ts +0 -11
  2. package/out/command/app/open-app-view/open-app-view.d.ts.map +1 -1
  3. package/out/command/app/open-app-view/open-app-view.js +6 -15
  4. package/out/index.d.ts +1 -0
  5. package/out/index.d.ts.map +1 -1
  6. package/out/index.js +1 -0
  7. package/out/install.d.ts.map +1 -1
  8. package/out/install.js +3 -0
  9. package/out/interface/index.d.ts +3 -0
  10. package/out/interface/index.d.ts.map +1 -1
  11. package/out/interface/index.js +3 -0
  12. package/out/interface/provider/i-editor-provider.d.ts +38 -0
  13. package/out/interface/provider/i-editor-provider.d.ts.map +1 -0
  14. package/out/interface/provider/i-editor-provider.js +1 -0
  15. package/out/interface/register/i-editor-register.d.ts +23 -0
  16. package/out/interface/register/i-editor-register.d.ts.map +1 -0
  17. package/out/interface/register/i-editor-register.js +1 -0
  18. package/out/interface/register/i-register.d.ts +38 -0
  19. package/out/interface/register/i-register.d.ts.map +1 -0
  20. package/out/interface/register/i-register.js +1 -0
  21. package/out/interface/util/i-loading-util/i-loading-util.d.ts +14 -0
  22. package/out/interface/util/i-loading-util/i-loading-util.d.ts.map +1 -1
  23. package/out/register/register.d.ts +20 -0
  24. package/out/register/register.d.ts.map +1 -0
  25. package/out/register/register.js +10 -0
  26. package/out/types.d.ts +9 -0
  27. package/out/types.d.ts.map +1 -1
  28. package/out/utils/app-de-ui-action-util/app-de-ui-action-util.d.ts +11 -10
  29. package/out/utils/app-de-ui-action-util/app-de-ui-action-util.d.ts.map +1 -1
  30. package/out/utils/app-de-ui-action-util/app-de-ui-action-util.js +52 -31
  31. package/out/utils/index.d.ts +1 -0
  32. package/out/utils/index.d.ts.map +1 -1
  33. package/out/utils/index.js +1 -0
  34. package/out/utils/open-redirect-view/open-redirect-view.d.ts +42 -0
  35. package/out/utils/open-redirect-view/open-redirect-view.d.ts.map +1 -0
  36. package/out/utils/open-redirect-view/open-redirect-view.js +149 -0
  37. package/out/view-logic/view-logic.d.ts +7 -6
  38. package/out/view-logic/view-logic.d.ts.map +1 -1
  39. package/out/view-logic/view-logic.js +20 -10
  40. package/package.json +15 -8
  41. package/src/command/app/open-app-view/open-app-view.ts +12 -26
  42. package/src/index.ts +1 -0
  43. package/src/install.ts +3 -0
  44. package/src/interface/index.ts +3 -0
  45. package/src/interface/provider/i-editor-provider.ts +44 -0
  46. package/src/interface/register/i-editor-register.ts +23 -0
  47. package/src/interface/register/i-register.ts +40 -0
  48. package/src/interface/util/i-loading-util/i-loading-util.ts +14 -0
  49. package/src/register/register.ts +20 -0
  50. package/src/types.ts +10 -0
  51. package/src/utils/app-de-ui-action-util/app-de-ui-action-util.ts +64 -41
  52. package/src/utils/index.ts +1 -0
  53. package/src/utils/open-redirect-view/open-redirect-view.ts +187 -0
  54. package/src/view-logic/view-logic.ts +31 -14
@@ -0,0 +1,42 @@
1
+ import { IBizContext } from '@ibiz-template/core';
2
+ import { IPSAppDataEntity, IPSAppDERedirectView, IPSAppRedirectView } from '@ibiz-template/model';
3
+ import { IModalData } from '../../interface';
4
+ /**
5
+ * 打开重定向视图
6
+ *
7
+ * @author chitanda
8
+ * @date 2022-09-28 16:09:13
9
+ * @export
10
+ * @param {IPSAppRedirectView} appView 应用重定向视图
11
+ * @param {IBizContext} [context=new IBizContext()]
12
+ * @param {IParams} [params={}]
13
+ * @param {IData} [data={}]
14
+ * @return {*} {Promise<IModalData>}
15
+ */
16
+ export declare function openRedirectView(appView: IPSAppRedirectView, context?: IBizContext, params?: IParams, data?: IData[]): Promise<IModalData>;
17
+ /**
18
+ * 打开实体重定向视图
19
+ *
20
+ * @author chitanda
21
+ * @date 2022-09-28 16:09:15
22
+ * @export
23
+ * @param {IPSAppDERedirectView} appView
24
+ * @param {IBizContext} [context=new IBizContext()]
25
+ * @param {IParams} [params={}]
26
+ * @param {IData[]} [data=[]]
27
+ * @return {*} {Promise<IModalData>}
28
+ */
29
+ export declare function openDERedirectView(appView: IPSAppDERedirectView, context?: IBizContext, params?: IParams, data?: IData[]): Promise<IModalData>;
30
+ /**
31
+ * 计算重定向标识
32
+ *
33
+ * @author chitanda
34
+ * @date 2022-09-28 16:09:47
35
+ * @export
36
+ * @param {IPSAppDERedirectView} rdView
37
+ * @param {boolean} isWf
38
+ * @param {IData} data
39
+ * @return {*} {Promise<string>}
40
+ */
41
+ export declare function calcDERdTag(entity: IPSAppDataEntity, rdView: IPSAppDERedirectView, isWf: boolean, data: IData): Promise<string>;
42
+ //# sourceMappingURL=open-redirect-view.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,149 @@
1
+ import { IBizContext } from '@ibiz-template/core';
2
+ import { DefectModelError, UnsupportedModelError, } from '@ibiz-template/model';
3
+ import { OpenAppViewCommand } from '../../command';
4
+ import { convertNavData } from '../nav-params/nav-params';
5
+ /**
6
+ * 打开重定向视图
7
+ *
8
+ * @author chitanda
9
+ * @date 2022-09-28 16:09:13
10
+ * @export
11
+ * @param {IPSAppRedirectView} appView 应用重定向视图
12
+ * @param {IBizContext} [context=new IBizContext()]
13
+ * @param {IParams} [params={}]
14
+ * @param {IData} [data={}]
15
+ * @return {*} {Promise<IModalData>}
16
+ */
17
+ export async function openRedirectView(appView, context = new IBizContext(), params = {}, data = []) {
18
+ if (appView.instanceof('app.view.IPSAppDERedirectView')) {
19
+ return openDERedirectView(appView, context, params, data);
20
+ }
21
+ throw new UnsupportedModelError(appView, `未支持的重定向视图类型: ${appView.viewType}`);
22
+ }
23
+ /**
24
+ * 打开实体重定向视图
25
+ *
26
+ * @author chitanda
27
+ * @date 2022-09-28 16:09:15
28
+ * @export
29
+ * @param {IPSAppDERedirectView} appView
30
+ * @param {IBizContext} [context=new IBizContext()]
31
+ * @param {IParams} [params={}]
32
+ * @param {IData[]} [data=[]]
33
+ * @return {*} {Promise<IModalData>}
34
+ */
35
+ export async function openDERedirectView(appView, context = new IBizContext(), params = {}, data = []) {
36
+ // 计算重定向视图上下文参数转换
37
+ const navContext = appView.getPSAppViewNavContexts() || [];
38
+ const navContextData = convertNavData(navContext, context, params);
39
+ context = new IBizContext(navContextData, context);
40
+ // 计算重定向视图视图参数转换
41
+ const navParams = appView.getPSAppViewNavParams() || [];
42
+ const navParamsData = convertNavData(navParams, context, params);
43
+ Object.assign(params, navParamsData);
44
+ // 重定向视图对应应用实体
45
+ const entity = appView.getPSAppDataEntity();
46
+ await entity.fill(true);
47
+ const key = entity.codeName.toLowerCase();
48
+ let curData = data[0] || {};
49
+ // 将数据主键转换到上下文当中
50
+ context[key] = curData[key] || context[key] || params[key];
51
+ // 实体重定向视图获取数据行为
52
+ const action = appView.getGetDataPSAppDEAction();
53
+ const service = await ibiz.entityService.getService(entity.codeName);
54
+ ibiz.loading.showRedirect();
55
+ // 获取数据,未配置行为时,默认走 Get 行为
56
+ const res = await service.exec(action ? action.codeName : 'Get', context, params);
57
+ ibiz.loading.hideRedirect();
58
+ if (res.ok) {
59
+ curData = res.data;
60
+ const linkUrl = curData.linkurl;
61
+ if (linkUrl) {
62
+ if (linkUrl.startsWith('http://') || linkUrl.startsWith('https://')) {
63
+ window.open(linkUrl, '_blank');
64
+ return { ok: true, data: [] };
65
+ }
66
+ return { ok: false, data: [] };
67
+ }
68
+ }
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
+ }
77
+ // 所有重定向引用视图
78
+ const allRefViews = appView.getRedirectPSAppViewRefs();
79
+ let refView = allRefViews === null || allRefViews === void 0 ? void 0 : allRefViews.find(view => {
80
+ return view.name === findRdTag;
81
+ });
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
+ if (refView) {
89
+ const view = refView.getRefPSAppView();
90
+ if (view) {
91
+ const result = await ibiz.commands.execute(OpenAppViewCommand.TAG, view, context, params, { data: [curData] });
92
+ if (result) {
93
+ return result;
94
+ }
95
+ }
96
+ else {
97
+ throw new DefectModelError(refView, `未配置实际引用视图`);
98
+ }
99
+ }
100
+ return { ok: true, data: [] };
101
+ }
102
+ /**
103
+ * 计算重定向标识
104
+ *
105
+ * @author chitanda
106
+ * @date 2022-09-28 16:09:47
107
+ * @export
108
+ * @param {IPSAppDERedirectView} rdView
109
+ * @param {boolean} isWf
110
+ * @param {IData} data
111
+ * @return {*} {Promise<string>}
112
+ */
113
+ export async function calcDERdTag(entity, rdView, isWf, data) {
114
+ const multiFormField = entity.getFormTypePSAppDEField();
115
+ const indexTypeField = entity.getIndexTypePSAppDEField();
116
+ // 重定向视图标识
117
+ let rdTag = '';
118
+ // 重定向视图类别属性
119
+ const typeField = rdView.getTypePSAppDEField();
120
+ // 自定义重定向
121
+ if (typeField) {
122
+ const value = data[typeField.codeName.toLowerCase()];
123
+ if (value) {
124
+ return value;
125
+ }
126
+ }
127
+ let typeValue = '';
128
+ if (multiFormField) {
129
+ typeValue = data[multiFormField.codeName.toLowerCase()];
130
+ }
131
+ else if (indexTypeField) {
132
+ typeValue = data[indexTypeField.codeName.toLowerCase()];
133
+ }
134
+ if (typeValue) {
135
+ if (isWf) {
136
+ rdTag = `WFEDITVIEW:${typeValue}`;
137
+ }
138
+ else {
139
+ rdTag = `EDITVIEW:${typeValue}`;
140
+ }
141
+ }
142
+ else if (isWf) {
143
+ rdTag = `WFEDITVIEW:`;
144
+ }
145
+ else {
146
+ rdTag = `EDITVIEW:`;
147
+ }
148
+ return rdTag;
149
+ }
@@ -1,3 +1,4 @@
1
+ import { IBizContext } from '@ibiz-template/core';
1
2
  import { IPSAppUINewDataLogic, IPSAppUIOpenDataLogic, IPSAppViewLogic } from '@ibiz-template/model';
2
3
  import { IUIActionResult } from '../interface';
3
4
  /**
@@ -7,12 +8,12 @@ import { IUIActionResult } from '../interface';
7
8
  * @date 2022-08-22 09:08:40
8
9
  * @export
9
10
  * @param {IPSAppViewLogic} viewLogic 视图逻辑模型对象
10
- * @param {IContext} context 上下文参数
11
+ * @param {IBizContext} context 上下文参数
11
12
  * @param {IParams} params 视图参数
12
13
  * @param {(IData | null)} data 数据集合
13
14
  * @param {IData} [opts] 额外参数,event是js原生事件
14
15
  */
15
- export declare function executeViewLogic(viewLogic: IPSAppViewLogic, context: IContext, data: IData[] | null, params: IParams, opts?: IData): Promise<IUIActionResult>;
16
+ export declare function executeViewLogic(viewLogic: IPSAppViewLogic, context: IBizContext, data: IData[] | null, params: IParams, opts?: IData): Promise<IUIActionResult>;
16
17
  /**
17
18
  * 执行应用预置界面逻辑opendata
18
19
  *
@@ -20,12 +21,12 @@ export declare function executeViewLogic(viewLogic: IPSAppViewLogic, context: IC
20
21
  * @date 2022-08-22 14:08:03
21
22
  * @export
22
23
  * @param {IPSAppUIOpenDataLogic} appUILogic 应用预置界面逻辑opendata模型对象
23
- * @param {IContext} context 上下文参数
24
+ * @param {IBizContext} context 上下文参数
24
25
  * @param {(IData | null)} data 数据集合
25
26
  * @param {IParams} params 视图参数
26
27
  * @param {IData} [opts] 额外参数,event是js原生事件
27
28
  */
28
- export declare function executeOpenDataAppUILogic(appUILogic: IPSAppUIOpenDataLogic, context: IContext, data: IData[] | null, params: IParams, opts?: IData): Promise<IUIActionResult>;
29
+ export declare function executeOpenDataAppUILogic(appUILogic: IPSAppUIOpenDataLogic, context: IBizContext, data: IData[] | null, params: IParams, opts?: IData): Promise<IUIActionResult>;
29
30
  /**
30
31
  * 执行应用预置界面逻辑newdata
31
32
  *
@@ -33,10 +34,10 @@ export declare function executeOpenDataAppUILogic(appUILogic: IPSAppUIOpenDataLo
33
34
  * @date 2022-08-22 14:08:03
34
35
  * @export
35
36
  * @param {IPSAppUINewDataLogic} appUILogic 应用预置界面逻辑newdata模型对象
36
- * @param {IContext} context 上下文参数
37
+ * @param {IBizContext} context 上下文参数
37
38
  * @param {(IData | null)} data 数据集合
38
39
  * @param {IParams} params 视图参数
39
40
  * @param {IData} [opts] 额外参数,event是js原生事件
40
41
  */
41
- export declare function executeNewDataAppUILogic(appUILogic: IPSAppUINewDataLogic, context: IContext, data: IData[] | null, params: IParams, opts?: IData): Promise<IUIActionResult>;
42
+ export declare function executeNewDataAppUILogic(appUILogic: IPSAppUINewDataLogic, context: IBizContext, data: IData[] | null, params: IParams, opts?: IData): Promise<IUIActionResult>;
42
43
  //# sourceMappingURL=view-logic.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"view-logic.d.ts","sourceRoot":"","sources":["../../src/view-logic/view-logic.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EAEhB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,eAAe,EAC1B,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EACpB,MAAM,EAAE,OAAO,EACf,IAAI,GAAE,KAAU,GACf,OAAO,CAAC,eAAe,CAAC,CA8B1B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,qBAAqB,EACjC,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EACpB,MAAM,EAAE,OAAO,EACf,IAAI,GAAE,KAAU,GACf,OAAO,CAAC,eAAe,CAAC,CA4C1B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,wBAAwB,CAC5C,UAAU,EAAE,oBAAoB,EAChC,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EACpB,MAAM,EAAE,OAAO,EACf,IAAI,GAAE,KAAU,GACf,OAAO,CAAC,eAAe,CAAC,CA2C1B"}
1
+ {"version":3,"file":"view-logic.d.ts","sourceRoot":"","sources":["../../src/view-logic/view-logic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAIL,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EAEhB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,eAAe,EAC1B,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EACpB,MAAM,EAAE,OAAO,EACf,IAAI,GAAE,KAAU,GACf,OAAO,CAAC,eAAe,CAAC,CA8B1B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,qBAAqB,EACjC,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EACpB,MAAM,EAAE,OAAO,EACf,IAAI,GAAE,KAAU,GACf,OAAO,CAAC,eAAe,CAAC,CAoD1B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,wBAAwB,CAC5C,UAAU,EAAE,oBAAoB,EAChC,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EACpB,MAAM,EAAE,OAAO,EACf,IAAI,GAAE,KAAU,GACf,OAAO,CAAC,eAAe,CAAC,CAmD1B"}
@@ -1,3 +1,4 @@
1
+ import { IBizContext } from '@ibiz-template/core';
1
2
  import { notNilEmpty } from 'qx-util';
2
3
  import { AppEntityModel, getPSUIActionByModelObject, } from '@ibiz-template/model';
3
4
  import { OpenAppViewCommand } from '../command';
@@ -9,7 +10,7 @@ import { AppDEUIActionUtil, convertNavData } from '../utils';
9
10
  * @date 2022-08-22 09:08:40
10
11
  * @export
11
12
  * @param {IPSAppViewLogic} viewLogic 视图逻辑模型对象
12
- * @param {IContext} context 上下文参数
13
+ * @param {IBizContext} context 上下文参数
13
14
  * @param {IParams} params 视图参数
14
15
  * @param {(IData | null)} data 数据集合
15
16
  * @param {IData} [opts] 额外参数,event是js原生事件
@@ -19,7 +20,7 @@ export async function executeViewLogic(viewLogic, context, data, params, opts =
19
20
  // 执行打开数据界面逻辑
20
21
  return executeOpenDataAppUILogic(viewLogic.getPSAppUILogic(), context, data, params, opts);
21
22
  }
22
- if (viewLogic.name === 'newdata') {
23
+ if (viewLogic.name === 'newdata' && viewLogic.getPSAppUILogic()) {
23
24
  // 执行新建数据逻辑
24
25
  return executeNewDataAppUILogic(viewLogic.getPSAppUILogic(), context, data, params, opts);
25
26
  }
@@ -37,7 +38,7 @@ export async function executeViewLogic(viewLogic, context, data, params, opts =
37
38
  * @date 2022-08-22 14:08:03
38
39
  * @export
39
40
  * @param {IPSAppUIOpenDataLogic} appUILogic 应用预置界面逻辑opendata模型对象
40
- * @param {IContext} context 上下文参数
41
+ * @param {IBizContext} context 上下文参数
41
42
  * @param {(IData | null)} data 数据集合
42
43
  * @param {IParams} params 视图参数
43
44
  * @param {IData} [opts] 额外参数,event是js原生事件
@@ -57,7 +58,6 @@ export async function executeOpenDataAppUILogic(appUILogic, context, data, param
57
58
  const appDataEntity = new AppEntityModel(openView.getPSAppDataEntity());
58
59
  await appDataEntity.init();
59
60
  // 处理导航参数
60
- let tempContext = {};
61
61
  // 处理上下文导航参数
62
62
  const navContexts = openViewRef.getPSNavigateContexts() || [];
63
63
  // 默认添加主键的上下文导航参数
@@ -69,7 +69,7 @@ export async function executeOpenDataAppUILogic(appUILogic, context, data, param
69
69
  rawValue: false,
70
70
  });
71
71
  }
72
- tempContext = convertNavData(navContexts, context, params, data[0]);
72
+ const tempContext = new IBizContext(convertNavData(navContexts, context, params, data[0]), context);
73
73
  // 处理导航视图参数
74
74
  let tempParams = {};
75
75
  const navParams = openViewRef.getPSNavigateParams();
@@ -77,7 +77,11 @@ export async function executeOpenDataAppUILogic(appUILogic, context, data, param
77
77
  tempParams = convertNavData(navParams, params, context, data[0]);
78
78
  }
79
79
  // 打开视图
80
- return ibiz.commands.execute(OpenAppViewCommand.TAG, openView, tempContext, tempParams, opts);
80
+ await ibiz.commands.execute(OpenAppViewCommand.TAG, openView, tempContext, tempParams, opts);
81
+ // 刷新上一个视图
82
+ const { neuron } = opts;
83
+ neuron.call.refresh();
84
+ return {};
81
85
  }
82
86
  /**
83
87
  * 执行应用预置界面逻辑newdata
@@ -86,7 +90,7 @@ export async function executeOpenDataAppUILogic(appUILogic, context, data, param
86
90
  * @date 2022-08-22 14:08:03
87
91
  * @export
88
92
  * @param {IPSAppUINewDataLogic} appUILogic 应用预置界面逻辑newdata模型对象
89
- * @param {IContext} context 上下文参数
93
+ * @param {IBizContext} context 上下文参数
90
94
  * @param {(IData | null)} data 数据集合
91
95
  * @param {IParams} params 视图参数
92
96
  * @param {IData} [opts] 额外参数,event是js原生事件
@@ -110,12 +114,14 @@ export async function executeNewDataAppUILogic(appUILogic, context, data, params
110
114
  if (notNilEmpty(navContexts)) {
111
115
  tempContext = convertNavData(navContexts, context, params, _data);
112
116
  }
117
+ tempContext = new IBizContext(tempContext, context);
118
+ // 删除上下文内的主键
119
+ delete tempContext[appDataEntity.deName.toLowerCase()];
120
+ tempContext[appDataEntity.deName.toLowerCase()] = undefined;
113
121
  const navParams = newViewRef.getPSNavigateParams();
114
122
  if (notNilEmpty(navParams)) {
115
123
  tempParams = convertNavData(navParams, params, context, _data);
116
124
  }
117
- // 删除上下文内的主键
118
- delete tempContext[appDataEntity.deName.toLowerCase()];
119
125
  // todo 拷贝
120
126
  if (appUILogic.enableWizardAdd) {
121
127
  // todo 向导添加
@@ -127,5 +133,9 @@ export async function executeNewDataAppUILogic(appUILogic, context, data, params
127
133
  // todo 只支持批添加
128
134
  }
129
135
  // 打开视图
130
- return ibiz.commands.execute(OpenAppViewCommand.TAG, newView, tempContext, tempParams, opts);
136
+ await ibiz.commands.execute(OpenAppViewCommand.TAG, newView, tempContext, tempParams, opts);
137
+ // 刷新上一个视图
138
+ const { neuron } = opts;
139
+ neuron.call.refresh();
140
+ return {};
131
141
  }
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "@ibiz-template/runtime",
3
- "version": "0.0.1-alpha.2",
3
+ "version": "0.0.1-alpha.20",
4
4
  "description": "控制器包",
5
5
  "main": "out/index.js",
6
6
  "types": "out/index.d.ts",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://gitee.com/iBizModeling/ibiz-template.git"
10
+ },
7
11
  "files": [
8
12
  "out",
9
13
  "src"
@@ -20,16 +24,19 @@
20
24
  "author": "chitanda",
21
25
  "license": "MIT",
22
26
  "dependencies": {
23
- "@ibiz-template/command": "^0.0.1-alpha.2",
24
- "@ibiz-template/core": "^0.0.1-alpha.2",
25
- "@ibiz-template/model": "^0.0.1-alpha.2",
26
- "@ibiz-template/service": "^0.0.1-alpha.2"
27
+ "@ibiz-template/command": "^0.0.1-alpha.13"
27
28
  },
28
29
  "devDependencies": {
29
- "qx-util": "^0.4.0"
30
+ "@ibiz-template/core": "^0.0.1-alpha.17",
31
+ "@ibiz-template/model": "^0.0.1-alpha.17",
32
+ "@ibiz-template/service": "^0.0.1-alpha.19",
33
+ "qx-util": "^0.4.1"
30
34
  },
31
35
  "peerDependencies": {
32
- "qx-util": "^0.4.0"
36
+ "@ibiz-template/core": "^0.0.1-alpha.2",
37
+ "@ibiz-template/model": "^0.0.1-alpha.2",
38
+ "@ibiz-template/service": "^0.0.1-alpha.2",
39
+ "qx-util": "^0.4.1"
33
40
  },
34
- "gitHead": "03023d73d45b9dc3b6156e996c196ce6705d31cd"
41
+ "gitHead": "20168eb52e77d34f85e86cf06f28a085a980ef12"
35
42
  }
@@ -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
  }