@ibiz-template/runtime 0.1.12 → 0.1.13

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 (60) hide show
  1. package/dist/index.esm.js +5843 -61
  2. package/dist/index.system.min.js +1 -1
  3. package/dist/index.system.min.js.map +1 -1
  4. package/out/controller/common/editor/editor.controller.d.ts +1 -1
  5. package/out/controller/common/editor/editor.controller.d.ts.map +1 -1
  6. package/out/controller/common/editor/editor.controller.js +2 -4
  7. package/out/controller/control/chart/chart.controller.js +1 -1
  8. package/out/controller/control/chart/generator/base-series-generator.d.ts.map +1 -1
  9. package/out/controller/control/chart/generator/base-series-generator.js +5 -4
  10. package/out/controller/control/chart/generator/chart-options-generator.d.ts +25 -1
  11. package/out/controller/control/chart/generator/chart-options-generator.d.ts.map +1 -1
  12. package/out/controller/control/chart/generator/chart-options-generator.js +24 -1
  13. package/out/controller/control/form/edit-form/edit-form.controller.d.ts.map +1 -1
  14. package/out/controller/control/form/edit-form/edit-form.controller.js +1 -2
  15. package/out/controller/control/grid/grid/grid.controller.d.ts +8 -0
  16. package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
  17. package/out/controller/control/grid/grid/grid.controller.js +20 -8
  18. package/out/global/global-util/global-util.d.ts +8 -1
  19. package/out/global/global-util/global-util.d.ts.map +1 -1
  20. package/out/global/global-util/global-util.js +8 -1
  21. package/out/hub/config/app-view-config-service.d.ts.map +1 -1
  22. package/out/hub/config/app-view-config-service.js +1 -0
  23. package/out/interface/common/i-app-view-config-service/i-app-view-config-service.d.ts +4 -0
  24. package/out/interface/common/i-app-view-config-service/i-app-view-config-service.d.ts.map +1 -1
  25. package/out/service/service/entity/method/method.d.ts.map +1 -1
  26. package/out/service/service/entity/method/method.js +4 -4
  27. package/out/service/utils/index.d.ts +0 -1
  28. package/out/service/utils/index.d.ts.map +1 -1
  29. package/out/service/utils/index.js +0 -1
  30. package/out/ui-action/provider/backend-ui-action-provider.d.ts.map +1 -1
  31. package/out/ui-action/provider/backend-ui-action-provider.js +2 -3
  32. package/out/utils/handlebars/handlebars.d.ts +50 -0
  33. package/out/utils/handlebars/handlebars.d.ts.map +1 -0
  34. package/out/utils/handlebars/handlebars.js +64 -0
  35. package/out/utils/index.d.ts +1 -0
  36. package/out/utils/index.d.ts.map +1 -1
  37. package/out/utils/index.js +1 -0
  38. package/out/utils/text-util/text-util.d.ts +9 -0
  39. package/out/utils/text-util/text-util.d.ts.map +1 -1
  40. package/out/utils/text-util/text-util.js +11 -0
  41. package/package.json +5 -3
  42. package/src/controller/common/editor/editor.controller.ts +3 -6
  43. package/src/controller/control/chart/chart.controller.ts +1 -1
  44. package/src/controller/control/chart/generator/base-series-generator.ts +5 -3
  45. package/src/controller/control/chart/generator/chart-options-generator.ts +35 -1
  46. package/src/controller/control/form/edit-form/edit-form.controller.ts +1 -3
  47. package/src/controller/control/grid/grid/grid.controller.ts +25 -7
  48. package/src/global/global-util/global-util.ts +9 -1
  49. package/src/hub/config/app-view-config-service.ts +1 -0
  50. package/src/interface/common/i-app-view-config-service/i-app-view-config-service.ts +4 -0
  51. package/src/service/service/entity/method/method.ts +4 -8
  52. package/src/service/utils/index.ts +0 -1
  53. package/src/ui-action/provider/backend-ui-action-provider.ts +2 -3
  54. package/src/utils/handlebars/handlebars.ts +70 -0
  55. package/src/utils/index.ts +1 -0
  56. package/src/utils/text-util/text-util.ts +12 -0
  57. package/out/service/utils/route-context/route-context.d.ts +0 -20
  58. package/out/service/utils/route-context/route-context.d.ts.map +0 -1
  59. package/out/service/utils/route-context/route-context.js +0 -71
  60. package/src/service/utils/route-context/route-context.ts +0 -75
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/runtime",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "控制器包",
5
5
  "type": "module",
6
6
  "main": "out/index.js",
@@ -29,7 +29,7 @@
29
29
  "author": "chitanda",
30
30
  "license": "MIT",
31
31
  "devDependencies": {
32
- "@ibiz-template/core": "^0.1.12",
32
+ "@ibiz-template/core": "^0.1.13",
33
33
  "@ibiz/model-core": "^0.0.15",
34
34
  "@types/path-browserify": "^1.0.0",
35
35
  "@types/qs": "^6.9.7",
@@ -37,6 +37,7 @@
37
37
  "async-validator": "^4.2.5",
38
38
  "dayjs": "^1.11.9",
39
39
  "echarts": "^5.4.3",
40
+ "handlebars": "^4.7.8",
40
41
  "lodash-es": "^4.17.21",
41
42
  "path-browserify": "^1.0.1",
42
43
  "qs": "^6.11.2",
@@ -49,11 +50,12 @@
49
50
  "async-validator": "^4.2.5",
50
51
  "dayjs": "^1.11.7",
51
52
  "echarts": "^5.4.3",
53
+ "handlebars": "^4.7.8",
52
54
  "lodash-es": "^4.17.21",
53
55
  "path-browserify": "^1.0.1",
54
56
  "qs": "^6.11.0",
55
57
  "qx-util": "^0.4.8",
56
58
  "ramda": "^0.29.0"
57
59
  },
58
- "gitHead": "980e348c7fa465d0a62e655991c1bb816fca100a"
60
+ "gitHead": "609d58f98989f485823ff7be7ecedf4956d7fad2"
59
61
  }
@@ -110,7 +110,7 @@ export class EditorController<T extends IEditor = IEditor>
110
110
  }
111
111
  if (this.model.editorParams) {
112
112
  Object.keys(this.model.editorParams).forEach(key => {
113
- this.editorParams[key.toLowerCase()] = this.model.editorParams![key];
113
+ this.editorParams[key] = this.model.editorParams![key];
114
114
  });
115
115
  }
116
116
  }
@@ -126,21 +126,18 @@ export class EditorController<T extends IEditor = IEditor>
126
126
  data: IData,
127
127
  context: IContext,
128
128
  params: IParams,
129
- ): { context: IContext; params: IParams } {
129
+ ): { context: IData; params: IParams } {
130
130
  const { navigateContexts, navigateParams } = this
131
131
  .model as INavigateParamContainer;
132
132
  let selfContext = {};
133
133
  if (navigateContexts && data) {
134
134
  selfContext = convertNavData(navigateContexts!, context, params, data);
135
135
  }
136
- const _context = Object.assign(context.clone(), selfContext);
137
-
138
136
  let selfParams = {};
139
137
  if (navigateParams && data) {
140
138
  selfParams = convertNavData(navigateParams!, context, params, data);
141
139
  }
142
- const _params: IParams = { ...params, ...selfParams };
143
- return { context: _context, params: _params };
140
+ return { context: selfContext, params: selfParams };
144
141
  }
145
142
 
146
143
  /**
@@ -45,7 +45,7 @@ export class ChartController
45
45
  this.service = new ChartService(this.model);
46
46
  await this.service.init(this.context);
47
47
  this.generator = new ChartOptionsGenerator(this.model);
48
- await this.generator.loadCodeList(this.context, this.params);
48
+ await this.generator.init(this.context, this.params);
49
49
 
50
50
  // 监听resize调整图表大小
51
51
  window.addEventListener('resize', this.resizeChart);
@@ -147,9 +147,11 @@ export class BaseSeriesGenerator<T extends IDEChartSeries = IDEChartSeries> {
147
147
  if (!model.valueField) {
148
148
  throw new RuntimeModelError(model, '缺少值属性配置');
149
149
  }
150
- this.catalogField = model.catalogField!.toLowerCase();
151
- this.valueField = model.valueField!.toLowerCase();
152
- this.groupField = model.seriesField?.toLowerCase();
150
+ this.catalogField = chartGenerator.getFieldKey(model.catalogField);
151
+ this.valueField = chartGenerator.getFieldKey(model.valueField);
152
+ this.groupField = model.seriesField
153
+ ? chartGenerator.getFieldKey(model.seriesField)
154
+ : undefined;
153
155
 
154
156
  const { chartXAxisId, chartYAxisId } = (chartSeriesEncode ||
155
157
  {}) as IChartSeriesCSCartesian2DEncode;
@@ -6,6 +6,7 @@ import type {
6
6
  ECElementEvent,
7
7
  } from 'echarts';
8
8
  import {
9
+ IAppDataEntity,
9
10
  IChartXAxis,
10
11
  IChartYAxis,
11
12
  IDEChart,
@@ -54,6 +55,14 @@ export function parseUserParams(userParams: Record<string, string>): IData {
54
55
  }
55
56
 
56
57
  export class ChartOptionsGenerator {
58
+ /**
59
+ * 实体模型
60
+ * @author lxm
61
+ * @date 2023-08-29 06:39:01
62
+ * @type {IAppDataEntity}
63
+ */
64
+ entity!: IAppDataEntity;
65
+
57
66
  /**
58
67
  * 根据模型配置算出来的静态echarts配置
59
68
  * @author lxm
@@ -106,7 +115,6 @@ export class ChartOptionsGenerator {
106
115
  codeListMap: Map<string, Readonly<CodeListItem[]>> = new Map();
107
116
 
108
117
  constructor(private model: IDEChart) {
109
- this.initSeriesGenerators();
110
118
  const {
111
119
  dechartTitle,
112
120
  dechartLegend,
@@ -256,6 +264,32 @@ export class ChartOptionsGenerator {
256
264
  return AxisOption;
257
265
  }
258
266
 
267
+ /**
268
+ * 初始化
269
+ * @author lxm
270
+ * @date 2023-08-29 06:34:04
271
+ * @param {IContext} context
272
+ * @param {IParams} params
273
+ * @return {*} {Promise<void>}
274
+ */
275
+ async init(context: IContext, params: IParams): Promise<void> {
276
+ await this.loadCodeList(context, params);
277
+ this.entity = await ibiz.hub.getAppDataEntity(this.model.appDataEntityId!);
278
+ this.initSeriesGenerators();
279
+ }
280
+
281
+ /**
282
+ * 找到实体属性的codeName小写
283
+ * @author lxm
284
+ * @date 2023-08-29 06:42:06
285
+ * @param {string} fieldName 属性的name
286
+ * @return {*} {string}
287
+ */
288
+ getFieldKey(fieldName: string): string {
289
+ const find = this.entity.appDEFields!.find(item => item.name === fieldName);
290
+ return find ? find.codeName!.toLowerCase() : fieldName.toLowerCase();
291
+ }
292
+
259
293
  /**
260
294
  * 加载代码表,
261
295
  * - 如果已经加载过会清空缓存重新加载
@@ -83,9 +83,7 @@ export class EditFormController
83
83
  await this.endLoading();
84
84
  }
85
85
 
86
- // !getDraft的时候不替换,进行合并,空值不覆盖
87
- mergeInLeft(this.data, res.data);
88
-
86
+ this.state.data = res.data;
89
87
  // 处理后台导致的新建默认值丢失
90
88
  mergeDefaultInLeft(this.data, params);
91
89
 
@@ -3,6 +3,7 @@ import {
3
3
  awaitTimeout,
4
4
  debounceAndAsyncMerge,
5
5
  HttpResponse,
6
+ recursiveIterate,
6
7
  RuntimeError,
7
8
  RuntimeModelError,
8
9
  } from '@ibiz-template/core';
@@ -186,6 +187,7 @@ export class GridController
186
187
 
187
188
  this.service = new GridService(this.model);
188
189
  await this.service.init(this.context);
190
+ this.initColumnStates();
189
191
  await this.initGridColumns();
190
192
 
191
193
  // !数据变更通知防抖,且合并参数,如果有同一批触发不同行的值变更则该方法需要重写
@@ -528,13 +530,6 @@ export class GridController
528
530
  // 初始化表格列控制器
529
531
  const controller = await provider.createController(column, this);
530
532
  this.columns[column.codeName!] = controller as GridColumnController;
531
- if (column.columnType !== 'GROUPGRIDCOLUMN') {
532
- this.state.columnStates.push({
533
- key: column.codeName!,
534
- caption: column.caption!,
535
- hidden: !!column.hideDefault,
536
- });
537
- }
538
533
  // 分类存放控制器
539
534
  if (column.columnType === 'DEFGRIDCOLUMN') {
540
535
  this.fieldColumns[column.codeName!] =
@@ -556,6 +551,29 @@ export class GridController
556
551
  }
557
552
  }
558
553
 
554
+ /**
555
+ * 初始化表格列状态
556
+ * @author lxm
557
+ * @date 2023-08-28 02:53:12
558
+ * @protected
559
+ * @return {*} {Promise<void>}
560
+ */
561
+ protected initColumnStates(): void {
562
+ recursiveIterate(
563
+ this.model,
564
+ (column: IDEGridColumn) => {
565
+ if (column.columnType !== 'GROUPGRIDCOLUMN') {
566
+ this.state.columnStates.push({
567
+ key: column.codeName!,
568
+ caption: column.caption!,
569
+ hidden: !!column.hideDefault,
570
+ });
571
+ }
572
+ },
573
+ { childrenFields: ['degridColumns'] },
574
+ );
575
+ }
576
+
559
577
  /**
560
578
  * 初始化表格属性列,操作列,编辑项控制器
561
579
  *
@@ -1,5 +1,5 @@
1
1
  import { IExportExcelUtil } from '../../interface';
2
- import { TextUtil, LayoutPanelUtil } from '../../utils';
2
+ import { TextUtil, LayoutPanelUtil, HandlebarsUtil } from '../../utils';
3
3
 
4
4
  /**
5
5
  * 全局工具方法或对象
@@ -26,6 +26,14 @@ export class GlobalUtil {
26
26
  */
27
27
  readonly text = new TextUtil();
28
28
 
29
+ /**
30
+ * handlebars 工具
31
+ *
32
+ * @author chitanda
33
+ * @date 2023-08-28 23:08:59
34
+ */
35
+ readonly hbs = new HandlebarsUtil();
36
+
29
37
  /**
30
38
  * 获取导出Excel工具类对象
31
39
  * @author lxm
@@ -24,6 +24,7 @@ export class AppViewConfigService implements IAppViewConfigService {
24
24
  id: model.id!,
25
25
  codeName: model.codeName!,
26
26
  openMode: model.openMode!,
27
+ viewType: model.viewType!,
27
28
  width: model.width,
28
29
  height: model.height,
29
30
  appDataEntityId: model.appDataEntityId,
@@ -18,6 +18,10 @@ export interface IViewConfig {
18
18
  * 打开方式
19
19
  */
20
20
  openMode: string;
21
+ /**
22
+ * 视图类型
23
+ */
24
+ viewType: string;
21
25
  /**
22
26
  * 宽度
23
27
  */
@@ -121,20 +121,16 @@ export abstract class Method {
121
121
  let res: HttpResponse | null = null;
122
122
  switch (requestMethod) {
123
123
  case 'POST':
124
- res = await this.app.net.post(`${path}/${methodName}`, data, params);
124
+ res = await this.app.net.post(`${path}/${methodName}`, data);
125
125
  break;
126
126
  case 'GET':
127
- res = await this.app.net.get(`${path}/${methodName}`, data, params);
127
+ res = await this.app.net.get(`${path}/${methodName}`, params);
128
128
  break;
129
129
  case 'PUT':
130
- res = await this.app.net.put(`${path}/${methodName}`, data, params);
130
+ res = await this.app.net.put(`${path}/${methodName}`, data);
131
131
  break;
132
132
  case 'DELETE':
133
- res = await this.app.net.delete(
134
- `${path}/${methodName}`,
135
- data,
136
- params,
137
- );
133
+ res = await this.app.net.delete(`${path}/${methodName}`, params);
138
134
  break;
139
135
  default:
140
136
  if (requestMethod) {
@@ -4,5 +4,4 @@ export { DEDQCondUtil } from './de-dq-cond-util/de-dq-cond-util';
4
4
  export { DynamicCodeListCache } from './dynamic-code-list/dynamic-code-list';
5
5
  export { DECache } from './de-cache/de-cache';
6
6
  export { getMatchResPath, calcResPath } from './res-path/res-path';
7
- export { calcRouteContext } from './route-context/route-context';
8
7
  export { SearchFilter } from './search-filter/search-filter';
@@ -33,7 +33,6 @@ export class BackendUIActionProvider extends UIActionProviderBase {
33
33
  data,
34
34
  params,
35
35
  );
36
- const tempParams = { ...params, ...resultParams };
37
36
 
38
37
  // 如果有打开视图,打开视图,并把返回的数据作为子实体数据
39
38
  const frontPSAppView = action.frontAppViewId;
@@ -71,7 +70,7 @@ export class BackendUIActionProvider extends UIActionProviderBase {
71
70
  methodName,
72
71
  resultContext,
73
72
  isMultiData ? _data : _data[0],
74
- tempParams,
73
+ resultParams,
75
74
  );
76
75
 
77
76
  // 适配界面行为成功提示信息
@@ -81,7 +80,7 @@ export class BackendUIActionProvider extends UIActionProviderBase {
81
80
  Object.assign(actionResult, {
82
81
  data: isArray(res.data) ? res.data : [res.data],
83
82
  nextContext: resultContext,
84
- nextParams: tempParams,
83
+ nextParams: resultParams,
85
84
  });
86
85
 
87
86
  return actionResult;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * handlebars 渲染工具类
3
+ *
4
+ * @author chitanda
5
+ * @date 2023-08-28 17:08:13
6
+ * @export
7
+ * @class HandlebarsUtil
8
+ */
9
+ export class HandlebarsUtil {
10
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ protected hsb: any;
12
+
13
+ /**
14
+ * handlebars 是否已经初始化
15
+ *
16
+ * @author chitanda
17
+ * @date 2023-08-28 18:08:01
18
+ * @readonly
19
+ * @type {boolean}
20
+ */
21
+ get isInit(): boolean {
22
+ return !!this.hsb;
23
+ }
24
+
25
+ /**
26
+ * 异步加载,初始化 handlebars
27
+ *
28
+ * @author chitanda
29
+ * @date 2023-08-28 17:08:24
30
+ * @return {*} {Promise<void>}
31
+ */
32
+ async init(): Promise<void> {
33
+ this.hsb = await import('handlebars');
34
+ }
35
+
36
+ /**
37
+ * 异步绘制模板,返回渲染后的字符串
38
+ *
39
+ * @author chitanda
40
+ * @date 2023-08-28 18:08:10
41
+ * @param {string} template
42
+ * @param {IData} data
43
+ * @return {*} {Promise<string>}
44
+ */
45
+ async render(template: string, data: IData): Promise<string> {
46
+ if (!this.hsb) {
47
+ await this.init();
48
+ }
49
+ const tmp = this.hsb.compile(template);
50
+ return tmp(data);
51
+ }
52
+
53
+ /**
54
+ * 同步绘制模板,返回渲染后的字符串
55
+ *
56
+ * @description 需要自己保证 handlebars 已经加载
57
+ * @author chitanda
58
+ * @date 2023-08-28 18:08:14
59
+ * @param {string} template
60
+ * @param {IData} data
61
+ * @return {*} {string}
62
+ */
63
+ syncRender(template: string, data: IData): string {
64
+ if (!this.hsb) {
65
+ throw new Error('handlebars not init');
66
+ }
67
+ const tmp = this.hsb.compile(template);
68
+ return tmp(data);
69
+ }
70
+ }
@@ -1,3 +1,4 @@
1
+ export { HandlebarsUtil } from './handlebars/handlebars';
1
2
  export { calcNavParams } from './nav-params/calc-nav-params';
2
3
  export * from './nav-params/nav-params';
3
4
  export {
@@ -19,4 +19,16 @@ export class TextUtil {
19
19
  format(value: string, _code: string): string {
20
20
  return value;
21
21
  }
22
+
23
+ /**
24
+ * 拷贝文本
25
+ *
26
+ * @author zhanghengfeng
27
+ * @date 2023-08-28 14:08:57
28
+ * @param {string} value
29
+ * @return {*} {Promise<void>}
30
+ */
31
+ async copy(value: string): Promise<void> {
32
+ return navigator.clipboard.writeText(value);
33
+ }
22
34
  }
@@ -1,20 +0,0 @@
1
- import { IAppView } from '@ibiz/model-core';
2
- /**
3
- * 计算资源上下文时,需要排除自身实体codeName的视图(导航类视图和多数据视图)
4
- * @return {*}
5
- * @author: zhujiamin
6
- * @Date: 2023-02-20 15:45:46
7
- */
8
- export declare const excludeViewTypes: string[];
9
- /**
10
- * 计算放置到路径中的资源上下文参数
11
- *
12
- * @author chitanda
13
- * @date 2023-01-10 14:01:51
14
- * @export
15
- * @param {IParams} context
16
- * @param {ServicePathItem[][]} pathItems
17
- * @return {*} {Record<string, unknown>}
18
- */
19
- export declare function calcRouteContext(_appView?: IAppView): Record<string, unknown>;
20
- //# sourceMappingURL=route-context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"route-context.d.ts","sourceRoot":"","sources":["../../../../src/service/utils/route-context/route-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,EAYpC,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAG9B,QAAQ,CAAC,EAAE,QAAQ,GAClB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAqCzB"}
@@ -1,71 +0,0 @@
1
- import { ViewType } from '../../../constant';
2
- /**
3
- * 计算资源上下文时,需要排除自身实体codeName的视图(导航类视图和多数据视图)
4
- * @return {*}
5
- * @author: zhujiamin
6
- * @Date: 2023-02-20 15:45:46
7
- */
8
- export const excludeViewTypes = [
9
- ViewType.DE_GRID_VIEW,
10
- ViewType.DE_GRID_EXP_VIEW,
11
- ViewType.DE_LIST_VIEW,
12
- ViewType.DE_LIST_EXP_VIEW,
13
- ViewType.DE_DATA_VIEW,
14
- ViewType.DE_DATAVIEW_EXP_VIEW,
15
- ViewType.DE_CALENDAR_VIEW,
16
- ViewType.DE_CALENDAR_EXP_VIEW,
17
- ViewType.DE_CHART_VIEW,
18
- ViewType.DE_CHART_EXP_VIEW,
19
- ViewType.DE_KANBAN_VIEW,
20
- ];
21
- /**
22
- * 计算放置到路径中的资源上下文参数
23
- *
24
- * @author chitanda
25
- * @date 2023-01-10 14:01:51
26
- * @export
27
- * @param {IParams} context
28
- * @param {ServicePathItem[][]} pathItems
29
- * @return {*} {Record<string, unknown>}
30
- */
31
- export function calcRouteContext(
32
- // context: IParams,
33
- // pathItems: ServicePathItem[][],
34
- _appView) {
35
- let paths = [];
36
- // pathItems.forEach(items => {
37
- // const values: string[][] = [];
38
- // for (let i = 0; i < items.length; i++) {
39
- // const arr: string[] = [];
40
- // const item = items[i];
41
- // if (
42
- // appView &&
43
- // appView.viewType &&
44
- // excludeViewTypes.includes(appView.viewType)
45
- // ) {
46
- // // 排除导航类视图和多数据视图自身
47
- // const deName = appView.getPSAppDataEntity()?.codeName.toLowerCase();
48
- // if (deName === item.name) {
49
- // return;
50
- // }
51
- // }
52
- // const val = context[item.lower];
53
- // if (val) {
54
- // arr.push(item.lower);
55
- // arr.push(val);
56
- // values.push(arr);
57
- // }
58
- // }
59
- // paths.push(values);
60
- // });
61
- paths = paths.sort((a, b) => b.length - a.length);
62
- const [pathArr] = paths;
63
- if (pathArr) {
64
- const obj = {};
65
- pathArr.forEach(([key, val]) => {
66
- obj[key] = val;
67
- });
68
- return obj;
69
- }
70
- return {};
71
- }
@@ -1,75 +0,0 @@
1
- import { IAppView } from '@ibiz/model-core';
2
- import { ViewType } from '../../../constant';
3
-
4
- /**
5
- * 计算资源上下文时,需要排除自身实体codeName的视图(导航类视图和多数据视图)
6
- * @return {*}
7
- * @author: zhujiamin
8
- * @Date: 2023-02-20 15:45:46
9
- */
10
- export const excludeViewTypes: string[] = [
11
- ViewType.DE_GRID_VIEW,
12
- ViewType.DE_GRID_EXP_VIEW,
13
- ViewType.DE_LIST_VIEW,
14
- ViewType.DE_LIST_EXP_VIEW,
15
- ViewType.DE_DATA_VIEW,
16
- ViewType.DE_DATAVIEW_EXP_VIEW,
17
- ViewType.DE_CALENDAR_VIEW,
18
- ViewType.DE_CALENDAR_EXP_VIEW,
19
- ViewType.DE_CHART_VIEW,
20
- ViewType.DE_CHART_EXP_VIEW,
21
- ViewType.DE_KANBAN_VIEW,
22
- ];
23
-
24
- /**
25
- * 计算放置到路径中的资源上下文参数
26
- *
27
- * @author chitanda
28
- * @date 2023-01-10 14:01:51
29
- * @export
30
- * @param {IParams} context
31
- * @param {ServicePathItem[][]} pathItems
32
- * @return {*} {Record<string, unknown>}
33
- */
34
- export function calcRouteContext(
35
- // context: IParams,
36
- // pathItems: ServicePathItem[][],
37
- _appView?: IAppView,
38
- ): Record<string, unknown> {
39
- let paths: string[][][] = [];
40
- // pathItems.forEach(items => {
41
- // const values: string[][] = [];
42
- // for (let i = 0; i < items.length; i++) {
43
- // const arr: string[] = [];
44
- // const item = items[i];
45
- // if (
46
- // appView &&
47
- // appView.viewType &&
48
- // excludeViewTypes.includes(appView.viewType)
49
- // ) {
50
- // // 排除导航类视图和多数据视图自身
51
- // const deName = appView.getPSAppDataEntity()?.codeName.toLowerCase();
52
- // if (deName === item.name) {
53
- // return;
54
- // }
55
- // }
56
- // const val = context[item.lower];
57
- // if (val) {
58
- // arr.push(item.lower);
59
- // arr.push(val);
60
- // values.push(arr);
61
- // }
62
- // }
63
- // paths.push(values);
64
- // });
65
- paths = paths.sort((a, b) => b.length - a.length);
66
- const [pathArr] = paths;
67
- if (pathArr) {
68
- const obj: Record<string, unknown> = {};
69
- pathArr.forEach(([key, val]) => {
70
- obj[key] = val;
71
- });
72
- return obj;
73
- }
74
- return {};
75
- }