@logicflow/extension 2.2.0-alpha.5 → 2.2.0-alpha.7

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 (61) hide show
  1. package/.turbo/turbo-build.log +7 -7
  2. package/CHANGELOG.md +15 -0
  3. package/dist/index.min.js +1 -1
  4. package/dist/index.min.js.map +1 -1
  5. package/es/bpmn-elements-adapter/json2xml.d.ts +2 -1
  6. package/es/bpmn-elements-adapter/json2xml.js +18 -4
  7. package/es/bpmn-elements-adapter/xml2json.js +2 -7
  8. package/es/components/control/index.js +3 -3
  9. package/es/index.d.ts +1 -0
  10. package/es/index.js +2 -0
  11. package/es/materials/curved-edge/index.js +41 -25
  12. package/es/pool/LaneModel.d.ts +90 -0
  13. package/es/pool/LaneModel.js +252 -0
  14. package/es/pool/LaneView.d.ts +40 -0
  15. package/es/pool/LaneView.js +202 -0
  16. package/es/pool/PoolModel.d.ts +120 -0
  17. package/es/pool/PoolModel.js +586 -0
  18. package/es/pool/PoolView.d.ts +17 -0
  19. package/es/pool/PoolView.js +76 -0
  20. package/es/pool/constant.d.ts +15 -0
  21. package/es/pool/constant.js +17 -0
  22. package/es/pool/index.d.ts +89 -0
  23. package/es/pool/index.js +524 -0
  24. package/es/pool/utils.d.ts +19 -0
  25. package/es/pool/utils.js +33 -0
  26. package/lib/bpmn-elements-adapter/json2xml.d.ts +2 -1
  27. package/lib/bpmn-elements-adapter/json2xml.js +19 -4
  28. package/lib/bpmn-elements-adapter/xml2json.js +2 -7
  29. package/lib/components/control/index.js +3 -3
  30. package/lib/index.d.ts +1 -0
  31. package/lib/index.js +2 -0
  32. package/lib/materials/curved-edge/index.js +41 -25
  33. package/lib/pool/LaneModel.d.ts +90 -0
  34. package/lib/pool/LaneModel.js +255 -0
  35. package/lib/pool/LaneView.d.ts +40 -0
  36. package/lib/pool/LaneView.js +205 -0
  37. package/lib/pool/PoolModel.d.ts +120 -0
  38. package/lib/pool/PoolModel.js +589 -0
  39. package/lib/pool/PoolView.d.ts +17 -0
  40. package/lib/pool/PoolView.js +79 -0
  41. package/lib/pool/constant.d.ts +15 -0
  42. package/lib/pool/constant.js +20 -0
  43. package/lib/pool/index.d.ts +89 -0
  44. package/lib/pool/index.js +527 -0
  45. package/lib/pool/utils.d.ts +19 -0
  46. package/lib/pool/utils.js +38 -0
  47. package/package.json +5 -5
  48. package/src/bpmn-elements-adapter/json2xml.ts +18 -4
  49. package/src/bpmn-elements-adapter/xml2json.ts +2 -8
  50. package/src/components/control/index.ts +3 -3
  51. package/src/dynamic-group/index.ts +0 -1
  52. package/src/index.ts +2 -0
  53. package/src/materials/curved-edge/index.ts +47 -30
  54. package/src/pool/LaneModel.ts +226 -0
  55. package/src/pool/LaneView.ts +220 -0
  56. package/src/pool/PoolModel.ts +631 -0
  57. package/src/pool/PoolView.ts +75 -0
  58. package/src/pool/constant.ts +19 -0
  59. package/src/pool/index.ts +621 -0
  60. package/src/pool/utils.ts +46 -0
  61. package/stats.html +1 -1
@@ -1,3 +1,4 @@
1
1
  declare function handleAttributes(obj: any): any;
2
+ declare function escapeXml(text: string): string;
2
3
  declare function lfJson2Xml(obj: any): string;
3
- export { lfJson2Xml, handleAttributes };
4
+ export { lfJson2Xml, handleAttributes, escapeXml };
@@ -21,6 +21,17 @@ function handleAttributes(obj) {
21
21
  }
22
22
  return obj;
23
23
  }
24
+ function escapeXml(text) {
25
+ if (text == null)
26
+ return '';
27
+ return text
28
+ .toString()
29
+ .replace(/&/g, '&')
30
+ .replace(/</g, '&lt;')
31
+ .replace(/>/g, '&gt;')
32
+ .replace(/"/g, '&quot;')
33
+ .replace(/'/g, '&apos;');
34
+ }
24
35
  function getAttributes(obj) {
25
36
  var tmp = obj;
26
37
  try {
@@ -31,7 +42,7 @@ function getAttributes(obj) {
31
42
  catch (error) {
32
43
  tmp = JSON.stringify(handleAttributes(obj)).replace(/"/g, "'");
33
44
  }
34
- return tmp;
45
+ return escapeXml(String(tmp));
35
46
  }
36
47
  var tn = '\t\n';
37
48
  // @see issue https://github.com/didi/LogicFlow/issues/718, refactoring of function toXml
@@ -41,8 +52,11 @@ function toXml(obj, name, depth) {
41
52
  var prefix = tn + frontSpace;
42
53
  if (name === '-json')
43
54
  return '';
55
+ if (obj !== 0 && obj !== false && !obj) {
56
+ return "".concat(prefix, "<").concat(name, " />");
57
+ }
44
58
  if (name === '#text') {
45
- return prefix + obj;
59
+ return prefix + escapeXml(String(obj));
46
60
  }
47
61
  if (name === '#cdata-section') {
48
62
  return "".concat(prefix, "<![CDATA[").concat(obj, "]]>");
@@ -70,7 +84,7 @@ function toXml(obj, name, depth) {
70
84
  attributes_1 + (children_1 !== '' ? ">".concat(children_1).concat(prefix, "</").concat(name, ">") : ' />');
71
85
  }
72
86
  else {
73
- str += "".concat(prefix, "<").concat(name, ">").concat(obj.toString(), "</").concat(name, ">");
87
+ str += "".concat(prefix, "<").concat(name, ">").concat(escapeXml(String(obj)), "</").concat(name, ">");
74
88
  }
75
89
  return str;
76
90
  }
@@ -81,4 +95,4 @@ function lfJson2Xml(obj) {
81
95
  }
82
96
  return xmlStr;
83
97
  }
84
- export { lfJson2Xml, handleAttributes };
98
+ export { lfJson2Xml, handleAttributes, escapeXml };
@@ -5,6 +5,7 @@
5
5
  /* eslint-disable func-names */
6
6
  // @ts-nocheck
7
7
  import { has } from 'lodash-es';
8
+ import { escapeXml } from './json2xml';
8
9
  // ========================================================================
9
10
  // XML.ObjTree -- XML source code from/to JavaScript object like E4X
10
11
  // ========================================================================
@@ -295,13 +296,7 @@ XML.ObjTree.prototype.scalar_to_xml = function (name, text) {
295
296
  return "<".concat(name, ">").concat(this.xml_escape(text), "</").concat(name, ">\n");
296
297
  };
297
298
  // method: xml_escape( text )
298
- XML.ObjTree.prototype.xml_escape = function (text) {
299
- return text
300
- .replace(/&/g, '&')
301
- .replace(/</g, '<')
302
- .replace(/>/g, '>')
303
- .replace(/"/g, '"');
304
- };
299
+ XML.ObjTree.prototype.xml_escape = escapeXml;
305
300
  /*
306
301
  // ========================================================================
307
302
 
@@ -132,14 +132,14 @@ var Control = /** @class */ (function () {
132
132
  else {
133
133
  itemContainer.append(icon);
134
134
  }
135
- switch (item.text) {
136
- case '上一步':
135
+ switch (item.key) {
136
+ case 'undo':
137
137
  _this.lf.on('history:change', function (_a) {
138
138
  var undoAble = _a.data.undoAble;
139
139
  itemContainer.className = undoAble ? NORMAL : DISABLED;
140
140
  });
141
141
  break;
142
- case '下一步':
142
+ case 'redo':
143
143
  _this.lf.on('history:change', function (_a) {
144
144
  var redoAble = _a.data.redoAble;
145
145
  itemContainer.className = redoAble ? NORMAL : DISABLED;
package/es/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from './bpmn-elements-adapter';
5
5
  export * from './bpmn-adapter/xml2json';
6
6
  export * from './bpmn-adapter/json2xml';
7
7
  export * from './turbo-adapter';
8
+ export * from './pool';
8
9
  export * from './dynamic-group';
9
10
  export * from './insert-node-in-polyline';
10
11
  export * from './tools/label';
package/es/index.js CHANGED
@@ -7,6 +7,8 @@ export * from './bpmn-adapter/xml2json';
7
7
  export * from './bpmn-adapter/json2xml';
8
8
  // Adapter
9
9
  export * from './turbo-adapter';
10
+ // 泳道相关
11
+ export * from './pool';
10
12
  // 新版 Group
11
13
  export * from './dynamic-group';
12
14
  // 折线上动态插入节点
@@ -127,38 +127,54 @@ function getMidPoints(cur, key, orientation, radius) {
127
127
  return [];
128
128
  }
129
129
  }
130
- function getPartialPath(prev, cur, next, radius) {
130
+ /**
131
+ * 生成局部路径片段(包含圆角)
132
+ * - 输入为上一个顶点、当前拐点、下一个顶点,计算方向组合并选择圆弧象限
133
+ * - 将圆角半径限制在相邻两段长度的一半以内,避免过度弯曲
134
+ * @param prevPoint 上一个顶点
135
+ * @param cornerPoint 当前拐点(圆角所在拐点)
136
+ * @param nextPoint 下一个顶点
137
+ * @param cornerRadius 圆角半径上限
138
+ * @returns 局部 path 字符串(包含 L/Q 操作)
139
+ */
140
+ function getPartialPath(prevPoint, cornerPoint, nextPoint, cornerRadius) {
131
141
  var _a;
132
- // 定义误差容错变量
133
- var tolerance = 1;
134
- var dir1 = '';
135
- var dir2 = '';
136
- if (Math.abs(prev[0] - cur[0]) <= tolerance) {
137
- // 垂直方向
138
- dir1 = prev[1] > cur[1] ? 't' : 'b';
139
- }
140
- else if (Math.abs(prev[1] - cur[1]) <= tolerance) {
141
- // 水平方向
142
- dir1 = prev[0] > cur[0] ? 'l' : 'r';
143
- }
144
- if (Math.abs(cur[0] - next[0]) <= tolerance) {
145
- dir2 = cur[1] > next[1] ? 't' : 'b';
146
- }
147
- else if (Math.abs(cur[1] - next[1]) <= tolerance) {
148
- dir2 = cur[0] > next[0] ? 'l' : 'r';
149
- }
150
- var r = Math.min(Math.hypot(cur[0] - prev[0], cur[1] - prev[1]) / 2, Math.hypot(next[0] - cur[0], next[1] - cur[1]) / 2, radius) || (1 / 5) * radius;
142
+ // 轴对齐容差(像素),用于消除微小误差
143
+ var epsilon = 1;
144
+ var resolveDir = function (a, b) {
145
+ var dx = b[0] - a[0];
146
+ var dy = b[1] - a[1];
147
+ var adx = Math.abs(dx);
148
+ var ady = Math.abs(dy);
149
+ if (ady <= epsilon && adx > epsilon) {
150
+ return dx < 0 ? 'l' : 'r';
151
+ }
152
+ if (adx <= epsilon && ady > epsilon) {
153
+ return dy < 0 ? 't' : 'b';
154
+ }
155
+ if (adx <= epsilon && ady <= epsilon) {
156
+ return '';
157
+ }
158
+ // 非严格对齐时,选择更接近的轴
159
+ return adx < ady ? (dx < 0 ? 'l' : 'r') : dy < 0 ? 't' : 'b';
160
+ };
161
+ var dir1 = resolveDir(prevPoint, cornerPoint);
162
+ var dir2 = resolveDir(cornerPoint, nextPoint);
163
+ var r = Math.min(Math.hypot(cornerPoint[0] - prevPoint[0], cornerPoint[1] - prevPoint[1]) /
164
+ 2, Math.hypot(nextPoint[0] - cornerPoint[0], nextPoint[1] - cornerPoint[1]) /
165
+ 2, cornerRadius) || (1 / 5) * cornerRadius;
151
166
  var key = "".concat(dir1).concat(dir2);
152
167
  var orientation = directionMap[key] || '-';
153
- var path = "L ".concat(prev[0], " ").concat(prev[1]);
168
+ var path = '';
154
169
  if (orientation === '-') {
155
- path += "L ".concat(cur[0], " ").concat(cur[1], " L ").concat(next[0], " ").concat(next[1]);
170
+ // 仅移动到当前拐点,由下一次迭代决定如何从拐点继续(直线或圆角)
171
+ path += "L ".concat(cornerPoint[0], " ").concat(cornerPoint[1]);
156
172
  }
157
173
  else {
158
- var _b = __read(getMidPoints(cur, key, orientation, r), 2), mid1 = _b[0], mid2 = _b[1];
174
+ var _b = __read(getMidPoints(cornerPoint, key, orientation, r), 2), mid1 = _b[0], mid2 = _b[1];
159
175
  if (mid1 && mid2) {
160
- path += "L ".concat(mid1[0], " ").concat(mid1[1], " Q ").concat(cur[0], " ").concat(cur[1], " ").concat(mid2[0], " ").concat(mid2[1]);
161
- _a = __read(mid2, 2), cur[0] = _a[0], cur[1] = _a[1];
176
+ path += "L ".concat(mid1[0], " ").concat(mid1[1], " Q ").concat(cornerPoint[0], " ").concat(cornerPoint[1], " ").concat(mid2[0], " ").concat(mid2[1]);
177
+ _a = __read(mid2, 2), cornerPoint[0] = _a[0], cornerPoint[1] = _a[1];
162
178
  }
163
179
  }
164
180
  return path;
@@ -0,0 +1,90 @@
1
+ /**
2
+ * 基于DynamicGroup重新实现的泳道节点组件
3
+ * 继承DynamicGroupNodeModel和DynamicGroupNode,提供泳道特定功能
4
+ */
5
+ import LogicFlow from '@logicflow/core';
6
+ import { DynamicGroupNodeModel } from '../dynamic-group';
7
+ export declare class LaneModel extends DynamicGroupNodeModel {
8
+ readonly isLane: boolean;
9
+ defaultZIndex: number;
10
+ initNodeData(data: LogicFlow.NodeConfig): void;
11
+ setAttributes(): void;
12
+ setZIndex(zIndex: number): void;
13
+ /**
14
+ * 重写折叠方法 - 泳道不支持折叠
15
+ */
16
+ toggleCollapse(): void;
17
+ /**
18
+ * 获取所属泳池ID
19
+ */
20
+ getPoolId(): string | null;
21
+ /**
22
+ * 获取所属泳池模型
23
+ */
24
+ getPoolModel(): any;
25
+ /**
26
+ * 动态修改泳道属性
27
+ */
28
+ changeAttribute({ width, height, x, y }: any): void;
29
+ /**
30
+ * 重写获取数据方法,添加泳道特定属性
31
+ */
32
+ getData(): LogicFlow.NodeData;
33
+ /**
34
+ * 重写 isAllowAppendIn,禁止 Lane 嵌套
35
+ */
36
+ isAllowAppendIn(nodeData: LogicFlow.NodeData): boolean;
37
+ /**
38
+ * 获取需要移动的节点
39
+ * @param groupModel
40
+ */
41
+ getNodesInGroup(groupModel: DynamicGroupNodeModel): string[];
42
+ getNodeStyle(): {
43
+ [x: string]: unknown;
44
+ fill?: string | undefined;
45
+ stroke?: string | undefined;
46
+ strokeWidth?: number | undefined;
47
+ radius?: number | undefined;
48
+ rx?: number | undefined;
49
+ ry?: number | undefined;
50
+ width?: number | undefined;
51
+ height?: number | undefined;
52
+ path?: string | undefined;
53
+ };
54
+ /**
55
+ * 获取文本样式
56
+ */
57
+ getTextStyle(): {
58
+ [x: string]: unknown;
59
+ fill?: string | undefined;
60
+ stroke?: string | undefined;
61
+ strokeWidth?: number | undefined;
62
+ radius?: number | undefined;
63
+ rx?: number | undefined;
64
+ ry?: number | undefined;
65
+ width?: number | undefined;
66
+ height?: number | undefined;
67
+ path?: string | undefined;
68
+ overflowMode?: "default" | "autoWrap" | "ellipsis" | undefined;
69
+ textWidth?: number | undefined; /**
70
+ * 获取子泳道
71
+ */
72
+ background?: LogicFlow.CommonTheme | undefined;
73
+ wrapPadding?: string | undefined;
74
+ color?: string | undefined;
75
+ fontSize: number;
76
+ lineHeight?: number | undefined;
77
+ textAnchor?: "middle" | "start" | "end" | undefined;
78
+ dominantBaseline?: "middle" | "central" | "auto" | "text-bottom" | "alphabetic" | "ideographic" | "mathematical" | "hanging" | "text-top" | undefined;
79
+ };
80
+ /**
81
+ * 获取子泳道
82
+ */
83
+ getSubNodes(): any[];
84
+ /**
85
+ * 初始化文本位置 - 根据布局方向设置文本位置
86
+ */
87
+ updateTextPosition(): void;
88
+ }
89
+ declare const _default: null;
90
+ export default _default;
@@ -0,0 +1,252 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ var __assign = (this && this.__assign) || function () {
17
+ __assign = Object.assign || function(t) {
18
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
19
+ s = arguments[i];
20
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
+ t[p] = s[p];
22
+ }
23
+ return t;
24
+ };
25
+ return __assign.apply(this, arguments);
26
+ };
27
+ var __read = (this && this.__read) || function (o, n) {
28
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
29
+ if (!m) return o;
30
+ var i = m.call(o), r, ar = [], e;
31
+ try {
32
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
33
+ }
34
+ catch (error) { e = { error: error }; }
35
+ finally {
36
+ try {
37
+ if (r && !r.done && (m = i["return"])) m.call(i);
38
+ }
39
+ finally { if (e) throw e.error; }
40
+ }
41
+ return ar;
42
+ };
43
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
44
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
45
+ if (ar || !(i in from)) {
46
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
47
+ ar[i] = from[i];
48
+ }
49
+ }
50
+ return to.concat(ar || Array.prototype.slice.call(from));
51
+ };
52
+ import { DynamicGroupNodeModel } from '../dynamic-group';
53
+ import { forEach } from 'lodash-es';
54
+ import { laneConfig } from './constant';
55
+ var LaneModel = /** @class */ (function (_super) {
56
+ __extends(LaneModel, _super);
57
+ function LaneModel() {
58
+ var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
59
+ _this.isLane = true;
60
+ _this.defaultZIndex = -1;
61
+ return _this;
62
+ }
63
+ LaneModel.prototype.initNodeData = function (data) {
64
+ var _a;
65
+ _super.prototype.initNodeData.call(this, data);
66
+ // 泳道特定配置
67
+ this.width = data.width || laneConfig.defaultWidth;
68
+ this.height = data.height || laneConfig.defaultHeight;
69
+ this.draggable = true; // 允许拖拽(实际拖拽逻辑由泳池控制)
70
+ this.resizable = true; // 允许调整大小
71
+ this.rotatable = false; // 禁止旋转
72
+ // 设置泳道层级
73
+ // 如果传入了zIndex,使用传入的值,否则默认为2
74
+ // 泳道层级应该比所属泳池高,确保显示在泳池上方
75
+ this.defaultZIndex = data.zIndex || -1;
76
+ this.setZIndex(this.defaultZIndex);
77
+ this.autoToFront = true;
78
+ this.text.editable = true;
79
+ this.style.stroke = '#000';
80
+ this.style.strokeWidth = 1;
81
+ // 泳道属性配置
82
+ this.properties = __assign(__assign({}, this.properties), { processRef: '', panels: ['processRef'], direction: ((_a = data.properties) === null || _a === void 0 ? void 0 : _a.direction) || 'vertical' });
83
+ // 设置折叠尺寸(泳道不支持折叠,设置为与正常尺寸相同)
84
+ this.collapsedWidth = this.width;
85
+ this.collapsedHeight = this.height;
86
+ this.expandWidth = this.width;
87
+ this.expandHeight = this.height;
88
+ };
89
+ LaneModel.prototype.setAttributes = function () {
90
+ _super.prototype.setAttributes.call(this);
91
+ this.updateTextPosition();
92
+ };
93
+ LaneModel.prototype.setZIndex = function (zIndex) {
94
+ this.zIndex = Math.min(zIndex, this.defaultZIndex) || this.defaultZIndex;
95
+ };
96
+ /**
97
+ * 重写折叠方法 - 泳道不支持折叠
98
+ */
99
+ LaneModel.prototype.toggleCollapse = function () {
100
+ // 泳道不支持折叠功能,保持展开状态
101
+ this.isCollapsed = false;
102
+ this.setProperties({ isCollapsed: false });
103
+ };
104
+ /**
105
+ * 获取所属泳池ID
106
+ */
107
+ LaneModel.prototype.getPoolId = function () {
108
+ var _this = this;
109
+ try {
110
+ // 检查graphModel是否存在
111
+ if (!this.graphModel) {
112
+ console.warn('GraphModel is not available');
113
+ return null;
114
+ }
115
+ // 安全地获取泳池ID
116
+ var poolModel = this.graphModel.nodes.find(function (node) {
117
+ return node.children && node.children.has(_this.id);
118
+ });
119
+ return (poolModel === null || poolModel === void 0 ? void 0 : poolModel.id) || null;
120
+ }
121
+ catch (error) {
122
+ console.error('Error getting pool ID:', error);
123
+ return null;
124
+ }
125
+ };
126
+ /**
127
+ * 获取所属泳池模型
128
+ */
129
+ LaneModel.prototype.getPoolModel = function () {
130
+ try {
131
+ var poolId = this.getPoolId();
132
+ if (!poolId) {
133
+ return null;
134
+ }
135
+ // 检查graphModel是否存在
136
+ if (!this.graphModel) {
137
+ console.warn('GraphModel is not available for getting pool model');
138
+ return null;
139
+ }
140
+ var poolModel = this.graphModel.getNodeModelById(poolId);
141
+ return poolModel || null;
142
+ }
143
+ catch (error) {
144
+ console.error('Error getting pool model:', error);
145
+ return null;
146
+ }
147
+ };
148
+ /**
149
+ * 动态修改泳道属性
150
+ */
151
+ LaneModel.prototype.changeAttribute = function (_a) {
152
+ var width = _a.width, height = _a.height, x = _a.x, y = _a.y;
153
+ if (width)
154
+ this.width = width; // 更新宽度
155
+ if (height)
156
+ this.height = height; // 更新高度
157
+ if (x)
158
+ this.x = x; // 更新X坐标
159
+ if (y)
160
+ this.y = y; // 更新Y坐标
161
+ };
162
+ /**
163
+ * 重写获取数据方法,添加泳道特定属性
164
+ */
165
+ LaneModel.prototype.getData = function () {
166
+ var data = _super.prototype.getData.call(this);
167
+ // const poolModel = this.getPoolModel()
168
+ return __assign(__assign({}, data), { properties: __assign(__assign({}, data.properties), { width: this.width, height: this.height, processRef: this.properties.processRef, direction: this.properties.direction }) });
169
+ };
170
+ /**
171
+ * 重写 isAllowAppendIn,禁止 Lane 嵌套
172
+ */
173
+ LaneModel.prototype.isAllowAppendIn = function (nodeData) {
174
+ // 禁止 Lane 节点被添加到 Lane 中
175
+ return String(nodeData.type) !== 'lane';
176
+ };
177
+ /**
178
+ * 获取需要移动的节点
179
+ * @param groupModel
180
+ */
181
+ LaneModel.prototype.getNodesInGroup = function (groupModel) {
182
+ var _this = this;
183
+ var nodeIds = [];
184
+ var parent = groupModel.properties.parent, isDragging = groupModel.isDragging;
185
+ if (isDragging && parent) {
186
+ nodeIds.push(parent);
187
+ }
188
+ forEach(Array.from(groupModel.children), function (nodeId) {
189
+ var nodeModel = _this.graphModel.getNodeModelById(nodeId);
190
+ // 只有非 Lane 类型的节点才会被带动
191
+ if (nodeModel &&
192
+ !nodeModel.isDragging &&
193
+ String(nodeModel.type) !== 'lane') {
194
+ nodeIds.push(nodeId);
195
+ }
196
+ });
197
+ return nodeIds;
198
+ };
199
+ LaneModel.prototype.getNodeStyle = function () {
200
+ var style = _super.prototype.getNodeStyle.call(this);
201
+ style.strokeWidth = 2;
202
+ return style;
203
+ };
204
+ /**
205
+ * 获取文本样式
206
+ */
207
+ LaneModel.prototype.getTextStyle = function () {
208
+ var _a = this.properties.isHorizontal, isHorizontal = _a === void 0 ? false : _a;
209
+ var style = _super.prototype.getTextStyle.call(this);
210
+ style.overflowMode = 'ellipsis';
211
+ style.strokeWidth = 2;
212
+ style.textWidth = isHorizontal ? this.height : this.width;
213
+ style.textHeight = isHorizontal ? this.width : this.height;
214
+ if (isHorizontal) {
215
+ style.transform = 'rotate(-90deg)';
216
+ style.textAlign = 'center';
217
+ }
218
+ return style;
219
+ };
220
+ /**
221
+ * 获取子泳道
222
+ */
223
+ LaneModel.prototype.getSubNodes = function () {
224
+ var _this = this;
225
+ var children = [];
226
+ Array.from(this.children).forEach(function (childId) {
227
+ var childModel = _this.graphModel.getNodeModelById(childId);
228
+ if (childModel) {
229
+ children.push(childModel);
230
+ }
231
+ });
232
+ return children;
233
+ };
234
+ /**
235
+ * 初始化文本位置 - 根据布局方向设置文本位置
236
+ */
237
+ LaneModel.prototype.updateTextPosition = function () {
238
+ if (this.properties.isHorizontal) {
239
+ // 横向泳池:文本显示在左侧标题区域
240
+ this.text.x = this.x - this.width / 2 + laneConfig.titleSize / 2;
241
+ this.text.y = this.y;
242
+ }
243
+ else {
244
+ // 纵向泳池:文本显示在顶部标题区域
245
+ this.text.x = this.x;
246
+ this.text.y = this.y - this.height / 2 + laneConfig.titleSize / 2;
247
+ }
248
+ };
249
+ return LaneModel;
250
+ }(DynamicGroupNodeModel));
251
+ export { LaneModel };
252
+ export default null;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * 基于DynamicGroup重新实现的泳道节点组件
3
+ * 继承DynamicGroupNodeModel和DynamicGroupNode,提供泳道特定功能
4
+ */
5
+ import { h } from '@logicflow/core';
6
+ import { DynamicGroupNode } from '../dynamic-group';
7
+ export declare class LaneView extends DynamicGroupNode {
8
+ getAppendAreaShape(): h.JSX.Element | null;
9
+ getShape(): import("preact").VNode<import("preact").ClassAttributes<HTMLElement>>;
10
+ /**
11
+ * 获取操作图标
12
+ */
13
+ getOperateIcons(): (import("preact").VNode<import("preact").ClassAttributes<HTMLElement> & {
14
+ cursor: string;
15
+ onClick: () => void;
16
+ }> | import("preact").VNode<import("preact").ClassAttributes<HTMLElement> & {
17
+ cursor: string;
18
+ onClick: () => void;
19
+ width: number;
20
+ height: number;
21
+ transform: string;
22
+ }>)[];
23
+ addBeforeLaneIcon(isHorizontal: boolean, callback: () => void): import("preact").VNode<import("preact").ClassAttributes<HTMLElement> & {
24
+ cursor: string;
25
+ onClick: () => void;
26
+ }>;
27
+ addAfterLaneIcon(isHorizontal: boolean, callback: () => void): import("preact").VNode<import("preact").ClassAttributes<HTMLElement> & {
28
+ cursor: string;
29
+ onClick: () => void;
30
+ }>;
31
+ deleteLaneIcon(callback: () => void): import("preact").VNode<import("preact").ClassAttributes<HTMLElement> & {
32
+ cursor: string;
33
+ onClick: () => void;
34
+ width: number;
35
+ height: number;
36
+ transform: string;
37
+ }>;
38
+ }
39
+ declare const _default: null;
40
+ export default _default;