@ibiz-template/model-helper 0.1.28 → 0.1.29

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.
@@ -0,0 +1,2 @@
1
+ export declare const PSSysApp: IModel;
2
+ //# sourceMappingURL=PSSYSAPP.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PSSYSAPP.d.ts","sourceRoot":"","sources":["../../src/model/PSSYSAPP.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,EAAE,MAWtB,CAAC"}
@@ -0,0 +1,12 @@
1
+ export const PSSysApp = {
2
+ getAllPSAppDEUIActions: {
3
+ New: {
4
+ refreshMode: 1,
5
+ reloadData: true,
6
+ showBusyIndicator: true,
7
+ },
8
+ Save: {
9
+ showBusyIndicator: false,
10
+ },
11
+ },
12
+ };
@@ -58,6 +58,15 @@ export declare class ModelUtil {
58
58
  * @return {*} {Promise<void>}
59
59
  */
60
60
  init(): Promise<void>;
61
+ /**
62
+ * 特殊处理应用模型
63
+ *
64
+ * @author chitanda
65
+ * @date 2023-09-21 15:09:07
66
+ * @protected
67
+ * @return {*} {Promise<void>}
68
+ */
69
+ protected specialHandling(): Promise<void>;
61
70
  /**
62
71
  * 获取应用模型
63
72
  *
@@ -1 +1 @@
1
- {"version":3,"file":"model-util.d.ts","sourceRoot":"","sources":["../src/model-util.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,eAAe,EAAE,MAAM,SAAS,CAAC;AAEtD;;;;;;;GAOG;AACH,qBAAa,SAAS;IAyClB,SAAS,CAAC,KAAK,EAAE,MAAM;IACvB,SAAS,CAAC,QAAQ,EAAE,MAAM;IAC1B,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC;IAC/C,SAAS,CAAC,GAAG,EAAE,OAAO;IACtB,SAAS,CAAC,UAAU,EAAE,OAAO;IA5C/B;;;;;;;OAOG;IACH,SAAS,CAAC,UAA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;;;;OAQG;IACG,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAenD;;;;;;;OAOG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAarD;;;;;;;OAOG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUjD;;;;;;;OAOG;IACG,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAgBlD;;;;;;;OAOG;IACH,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAmB5C;;;;;;;;OAQG;IACH,SAAS,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAMhD;;;;;;;;OAQG;IACH,SAAS,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;CAKpD"}
package/out/model-util.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { calcUniqueTag } from '@ibiz/rt-model-api';
2
- import { formatPath, ServicePathUtil } from './utils';
2
+ import { formatPath, mergeModel, ServicePathUtil } from './utils';
3
+ import { PSSysApp } from './model/PSSYSAPP';
3
4
  /**
4
5
  * 全动模型处理工具类,每个App一个实例
5
6
  *
@@ -44,6 +45,7 @@ export class ModelUtil {
44
45
  */
45
46
  async init() {
46
47
  await this.getAppModel();
48
+ await this.specialHandling();
47
49
  // 填充缓存模型
48
50
  {
49
51
  const { cache } = this.appModel;
@@ -89,6 +91,18 @@ export class ModelUtil {
89
91
  ibiz.env.isEnableMultiLan = false;
90
92
  }
91
93
  }
94
+ /**
95
+ * 特殊处理应用模型
96
+ *
97
+ * @author chitanda
98
+ * @date 2023-09-21 15:09:07
99
+ * @protected
100
+ * @return {*} {Promise<void>}
101
+ */
102
+ async specialHandling() {
103
+ // 特殊处理预置全局界面行为,附加一些特殊的模板预置模型
104
+ mergeModel(this.appModel.getAllPSAppDEUIActions, PSSysApp.getAllPSAppDEUIActions, 'codeName');
105
+ }
92
106
  /**
93
107
  * 获取应用模型
94
108
  *
@@ -1,4 +1,5 @@
1
+ export { formatPath } from './format-path/format-path';
2
+ export { mergeModel } from './merge-model/merge-model';
1
3
  export { plural, pluralLower } from './plural/plural';
2
4
  export { ServicePathDeep, ServicePathItem, ServicePathUtil, } from './service-path-util/service-path-util';
3
- export { formatPath } from './format-path/format-path';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACL,eAAe,EACf,eAAe,EACf,eAAe,GAChB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACL,eAAe,EACf,eAAe,EACf,eAAe,GAChB,MAAM,uCAAuC,CAAC"}
@@ -1,3 +1,4 @@
1
+ export { formatPath } from './format-path/format-path';
2
+ export { mergeModel } from './merge-model/merge-model';
1
3
  export { plural, pluralLower } from './plural/plural';
2
4
  export { ServicePathUtil, } from './service-path-util/service-path-util';
3
- export { formatPath } from './format-path/format-path';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 将预置的模型合并到当前模型中
3
+ *
4
+ * @author chitanda
5
+ * @date 2023-09-22 10:09:10
6
+ * @export
7
+ * @param {IModel[]} models
8
+ * @param {IModel} m
9
+ * @param {string} tag
10
+ */
11
+ export declare function mergeModel(models: IModel[], m: IModel, tag: string): void;
12
+ //# sourceMappingURL=merge-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge-model.d.ts","sourceRoot":"","sources":["../../../src/utils/merge-model/merge-model.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAOzE"}
@@ -0,0 +1,19 @@
1
+ import { mergeDeepLeft } from 'ramda';
2
+ /**
3
+ * 将预置的模型合并到当前模型中
4
+ *
5
+ * @author chitanda
6
+ * @date 2023-09-22 10:09:10
7
+ * @export
8
+ * @param {IModel[]} models
9
+ * @param {IModel} m
10
+ * @param {string} tag
11
+ */
12
+ export function mergeModel(models, m, tag) {
13
+ models.forEach(model => {
14
+ const item = m[model[tag]];
15
+ if (item) {
16
+ Object.assign(model, mergeDeepLeft(model, item));
17
+ }
18
+ });
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/model-helper",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "控制器包",
5
5
  "main": "out/index.js",
6
6
  "types": "out/index.d.ts",
@@ -30,15 +30,18 @@
30
30
  "license": "MIT",
31
31
  "dependencies": {
32
32
  "@ibiz/model-core": "^0.0.18",
33
- "@ibiz/rt-model-api": "^0.1.19",
34
- "pluralize": "^8.0.0"
33
+ "@ibiz/rt-model-api": "^0.1.20",
34
+ "pluralize": "^8.0.0",
35
+ "ramda": "^0.29.0"
35
36
  },
36
37
  "devDependencies": {
37
- "@ibiz-template/runtime": "^0.1.28",
38
- "@types/pluralize": "^0.0.30"
38
+ "@ibiz-template/runtime": "^0.1.29",
39
+ "@types/pluralize": "^0.0.31",
40
+ "@types/ramda": "^0.29.4"
39
41
  },
40
42
  "peerDependencies": {
41
- "@ibiz-template/runtime": "^0.1.0"
43
+ "@ibiz-template/runtime": "^0.1.0",
44
+ "ramda": "^0.29.0"
42
45
  },
43
- "gitHead": "143f856b53d9767d9ce655551148ab6d6abd2482"
46
+ "gitHead": "ad1df38edba37a696e639c986b12087f72ead394"
44
47
  }
@@ -0,0 +1,12 @@
1
+ export const PSSysApp: IModel = {
2
+ getAllPSAppDEUIActions: {
3
+ New: {
4
+ refreshMode: 1,
5
+ reloadData: true,
6
+ showBusyIndicator: true,
7
+ },
8
+ Save: {
9
+ showBusyIndicator: false,
10
+ },
11
+ },
12
+ };
package/src/model-util.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { calcUniqueTag } from '@ibiz/rt-model-api';
2
2
  import { IAppDERS } from '@ibiz/model-core';
3
- import { formatPath, ServicePathUtil } from './utils';
3
+ import { formatPath, mergeModel, ServicePathUtil } from './utils';
4
+ import { PSSysApp } from './model/PSSYSAPP';
4
5
 
5
6
  /**
6
7
  * 全动模型处理工具类,每个App一个实例
@@ -67,6 +68,7 @@ export class ModelUtil {
67
68
  */
68
69
  async init(): Promise<void> {
69
70
  await this.getAppModel();
71
+ await this.specialHandling();
70
72
  // 填充缓存模型
71
73
  {
72
74
  const { cache } = this.appModel;
@@ -116,6 +118,23 @@ export class ModelUtil {
116
118
  }
117
119
  }
118
120
 
121
+ /**
122
+ * 特殊处理应用模型
123
+ *
124
+ * @author chitanda
125
+ * @date 2023-09-21 15:09:07
126
+ * @protected
127
+ * @return {*} {Promise<void>}
128
+ */
129
+ protected async specialHandling(): Promise<void> {
130
+ // 特殊处理预置全局界面行为,附加一些特殊的模板预置模型
131
+ mergeModel(
132
+ this.appModel.getAllPSAppDEUIActions,
133
+ PSSysApp.getAllPSAppDEUIActions,
134
+ 'codeName',
135
+ );
136
+ }
137
+
119
138
  /**
120
139
  * 获取应用模型
121
140
  *
@@ -1,7 +1,8 @@
1
+ export { formatPath } from './format-path/format-path';
2
+ export { mergeModel } from './merge-model/merge-model';
1
3
  export { plural, pluralLower } from './plural/plural';
2
4
  export {
3
5
  ServicePathDeep,
4
6
  ServicePathItem,
5
7
  ServicePathUtil,
6
8
  } from './service-path-util/service-path-util';
7
- export { formatPath } from './format-path/format-path';
@@ -0,0 +1,20 @@
1
+ import { mergeDeepLeft } from 'ramda';
2
+
3
+ /**
4
+ * 将预置的模型合并到当前模型中
5
+ *
6
+ * @author chitanda
7
+ * @date 2023-09-22 10:09:10
8
+ * @export
9
+ * @param {IModel[]} models
10
+ * @param {IModel} m
11
+ * @param {string} tag
12
+ */
13
+ export function mergeModel(models: IModel[], m: IModel, tag: string): void {
14
+ models.forEach(model => {
15
+ const item = m[model[tag]];
16
+ if (item) {
17
+ Object.assign(model, mergeDeepLeft(model, item));
18
+ }
19
+ });
20
+ }