@ibiz-template/model-helper 0.7.41-alpha.30 → 0.7.41-alpha.31

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.
@@ -1,3 +1,10 @@
1
1
  import { IUIActionGroup } from '@ibiz/model-core';
2
+ /**
3
+ * 合并两个界面行为组
4
+ *
5
+ * @param dst 目标界面行为组,用于接收合并结果
6
+ * @param src 源界面行为组,提供要合并的数据
7
+ * @returns 无返回值,直接修改目标对象
8
+ */
2
9
  export declare function mergeAppDEUIActionGroup(dst: IUIActionGroup | undefined, src: IUIActionGroup | undefined): void;
3
10
  //# sourceMappingURL=merge-app-uiaction-group.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"merge-app-uiaction-group.d.ts","sourceRoot":"","sources":["../../../src/utils/merge-model/merge-app-uiaction-group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAwB,MAAM,kBAAkB,CAAC;AAExE,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,cAAc,GAAG,SAAS,EAC/B,GAAG,EAAE,cAAc,GAAG,SAAS,GAC9B,IAAI,CAaN"}
1
+ {"version":3,"file":"merge-app-uiaction-group.d.ts","sourceRoot":"","sources":["../../../src/utils/merge-model/merge-app-uiaction-group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAwB,MAAM,kBAAkB,CAAC;AAwBxE;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,cAAc,GAAG,SAAS,EAC/B,GAAG,EAAE,cAAc,GAAG,SAAS,GAC9B,IAAI,CAiDN"}
@@ -1,14 +1,66 @@
1
+ // dynamic_overlay:before|after|replace|delete:detailid
2
+ /**
3
+ * 解析动态覆盖标签字符串,提取位置信息和目标ID
4
+ *
5
+ * @param tag - 要解析的标签字符串,格式应为 "dynamic_overlay:position:targetId"
6
+ * @returns 如果解析成功,返回包含position和targetId的对象;否则返回null
7
+ */
8
+ function parseDynamicOverlay(tag) {
9
+ if (!tag) {
10
+ return null;
11
+ }
12
+ const match = tag.match(/^dynamic_overlay:(before|after|replace|delete):(.+)$/);
13
+ if (match) {
14
+ return { position: match[1], targetId: match[2] };
15
+ }
16
+ return null;
17
+ }
18
+ /**
19
+ * 合并两个界面行为组
20
+ *
21
+ * @param dst 目标界面行为组,用于接收合并结果
22
+ * @param src 源界面行为组,提供要合并的数据
23
+ * @returns 无返回值,直接修改目标对象
24
+ */
1
25
  export function mergeAppDEUIActionGroup(dst, src) {
2
26
  if (!dst || !src) {
3
27
  return;
4
28
  }
5
- // 合并界面行为组项
29
+ // 合并界面行为组项,根据界面行为组成员用户标记(格式如:dynamic_overlay:before|after|replace|delete:detailid)进行合并,如格式不满足则添加到末尾,如没有用户标记,则直接添加到末尾
6
30
  if (src.uiactionGroupDetails) {
7
31
  if (!dst.uiactionGroupDetails) {
8
32
  dst.uiactionGroupDetails = [];
9
33
  }
10
34
  src.uiactionGroupDetails.forEach((item) => {
11
- dst.uiactionGroupDetails.push(item);
35
+ const overlayInfo = parseDynamicOverlay(item.userTag);
36
+ if (overlayInfo && overlayInfo.position && overlayInfo.targetId) {
37
+ const targetIndex = dst.uiactionGroupDetails.findIndex((x) => x.id === overlayInfo.targetId);
38
+ if (targetIndex !== -1) {
39
+ switch (overlayInfo.position) {
40
+ case 'before':
41
+ dst.uiactionGroupDetails.splice(targetIndex, 0, item);
42
+ break;
43
+ case 'after':
44
+ dst.uiactionGroupDetails.splice(targetIndex + 1, 0, item);
45
+ break;
46
+ case 'replace':
47
+ dst.uiactionGroupDetails[targetIndex] = item;
48
+ break;
49
+ case 'delete':
50
+ dst.uiactionGroupDetails.splice(targetIndex, 1);
51
+ break;
52
+ default:
53
+ dst.uiactionGroupDetails.push(item);
54
+ break;
55
+ }
56
+ }
57
+ else {
58
+ dst.uiactionGroupDetails.push(item);
59
+ }
60
+ }
61
+ else {
62
+ dst.uiactionGroupDetails.push(item);
63
+ }
12
64
  });
13
65
  }
14
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/model-helper",
3
- "version": "0.7.41-alpha.30",
3
+ "version": "0.7.41-alpha.31",
4
4
  "description": "模型辅助库",
5
5
  "main": "out/index.js",
6
6
  "types": "out/index.d.ts",
@@ -37,7 +37,7 @@
37
37
  "ramda": "^0.29.1"
38
38
  },
39
39
  "devDependencies": {
40
- "@ibiz-template/runtime": "^0.7.41-alpha.30",
40
+ "@ibiz-template/runtime": "^0.7.41-alpha.31",
41
41
  "@types/pluralize": "^0.0.33",
42
42
  "@types/ramda": "^0.29.10"
43
43
  },
@@ -45,5 +45,5 @@
45
45
  "@ibiz-template/runtime": "^0.6.0",
46
46
  "ramda": "^0.29.0"
47
47
  },
48
- "gitHead": "027b8b5d3efb41c540f00138b90d8389eb3f34fa"
48
+ "gitHead": "b9939f9f79918d85b8bdd444d5bcc2042e9321c1"
49
49
  }