@logicflow/core 2.2.0 → 2.2.1
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.
- package/dist/index.css +3 -2
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/LogicFlow.d.ts +9 -0
- package/es/LogicFlow.js +0 -1
- package/es/constant/index.d.ts +1 -1
- package/es/constant/index.js +1 -1
- package/es/constant/theme.d.ts +136 -0
- package/es/constant/theme.js +680 -0
- package/es/index.css +3 -2
- package/es/model/GraphModel.d.ts +10 -2
- package/es/model/GraphModel.js +48 -14
- package/es/model/TransformModel.js +9 -9
- package/es/model/edge/BaseEdgeModel.js +7 -2
- package/es/model/edge/PolylineEdgeModel.d.ts +7 -0
- package/es/model/edge/PolylineEdgeModel.js +136 -7
- package/es/model/node/BaseNodeModel.d.ts +12 -1
- package/es/model/node/BaseNodeModel.js +9 -2
- package/es/model/node/HtmlNodeModel.d.ts +12 -0
- package/es/model/node/HtmlNodeModel.js +19 -0
- package/es/model/node/PolygonNodeModel.js +3 -3
- package/es/options.d.ts +4 -2
- package/es/style/index.css +3 -2
- package/es/style/index.less +3 -2
- package/es/style/raw.d.ts +1 -1
- package/es/style/raw.js +1 -1
- package/es/tool/MultipleSelectTool.js +10 -5
- package/es/util/drag.js +0 -1
- package/es/util/edge.d.ts +40 -1
- package/es/util/edge.js +43 -9
- package/es/util/geometry.d.ts +8 -0
- package/es/util/geometry.js +79 -0
- package/es/util/theme.d.ts +2 -65
- package/es/util/theme.js +4 -281
- package/es/view/Anchor.d.ts +1 -0
- package/es/view/Anchor.js +24 -21
- package/es/view/Control.d.ts +5 -0
- package/es/view/Control.js +44 -57
- package/es/view/edge/BaseEdge.js +9 -0
- package/es/view/edge/PolylineEdge.js +13 -2
- package/es/view/node/BaseNode.d.ts +1 -0
- package/es/view/node/BaseNode.js +23 -11
- package/es/view/node/HtmlNode.js +2 -4
- package/es/view/overlay/CanvasOverlay.js +5 -2
- package/es/view/overlay/Grid.d.ts +12 -1
- package/es/view/overlay/Grid.js +85 -23
- package/es/view/overlay/OutlineOverlay.d.ts +1 -0
- package/es/view/overlay/OutlineOverlay.js +18 -17
- package/es/view/overlay/gridConfig.d.ts +46 -0
- package/es/view/overlay/gridConfig.js +99 -0
- package/es/view/shape/Polygon.d.ts +0 -7
- package/es/view/shape/Polygon.js +12 -43
- package/lib/LogicFlow.d.ts +9 -0
- package/lib/LogicFlow.js +0 -1
- package/lib/constant/index.d.ts +1 -1
- package/lib/constant/index.js +16 -2
- package/lib/constant/theme.d.ts +136 -0
- package/lib/constant/theme.js +683 -0
- package/lib/index.css +3 -2
- package/lib/model/GraphModel.d.ts +10 -2
- package/lib/model/GraphModel.js +49 -15
- package/lib/model/TransformModel.js +9 -9
- package/lib/model/edge/BaseEdgeModel.js +7 -2
- package/lib/model/edge/PolylineEdgeModel.d.ts +7 -0
- package/lib/model/edge/PolylineEdgeModel.js +136 -7
- package/lib/model/node/BaseNodeModel.d.ts +12 -1
- package/lib/model/node/BaseNodeModel.js +9 -2
- package/lib/model/node/HtmlNodeModel.d.ts +12 -0
- package/lib/model/node/HtmlNodeModel.js +19 -0
- package/lib/model/node/PolygonNodeModel.js +3 -3
- package/lib/options.d.ts +4 -2
- package/lib/style/index.css +3 -2
- package/lib/style/index.less +3 -2
- package/lib/style/raw.d.ts +1 -1
- package/lib/style/raw.js +1 -1
- package/lib/tool/MultipleSelectTool.js +10 -5
- package/lib/util/drag.js +0 -1
- package/lib/util/edge.d.ts +40 -1
- package/lib/util/edge.js +43 -9
- package/lib/util/geometry.d.ts +8 -0
- package/lib/util/geometry.js +81 -1
- package/lib/util/theme.d.ts +2 -65
- package/lib/util/theme.js +15 -292
- package/lib/view/Anchor.d.ts +1 -0
- package/lib/view/Anchor.js +24 -21
- package/lib/view/Control.d.ts +5 -0
- package/lib/view/Control.js +44 -57
- package/lib/view/edge/BaseEdge.js +9 -0
- package/lib/view/edge/PolylineEdge.js +13 -2
- package/lib/view/node/BaseNode.d.ts +1 -0
- package/lib/view/node/BaseNode.js +22 -10
- package/lib/view/node/HtmlNode.js +1 -3
- package/lib/view/overlay/CanvasOverlay.js +5 -2
- package/lib/view/overlay/Grid.d.ts +12 -1
- package/lib/view/overlay/Grid.js +83 -21
- package/lib/view/overlay/OutlineOverlay.d.ts +1 -0
- package/lib/view/overlay/OutlineOverlay.js +18 -17
- package/lib/view/overlay/gridConfig.d.ts +46 -0
- package/lib/view/overlay/gridConfig.js +104 -0
- package/lib/view/shape/Polygon.d.ts +0 -7
- package/lib/view/shape/Polygon.js +13 -45
- package/package.json +6 -1
- package/.turbo/turbo-build$colon$dev.log +0 -10
- package/.turbo/turbo-build.log +0 -33
- package/CHANGELOG.md +0 -1849
- package/__tests__/algorithm/egde.test.ts +0 -131
- package/__tests__/algorithm/index.test.ts +0 -74
- package/__tests__/algorithm/outline.test.ts +0 -43
- package/__tests__/bugs/1545-spec.test.ts +0 -42
- package/__tests__/event/event.test.ts +0 -22
- package/__tests__/history/history.test.ts +0 -28
- package/__tests__/logicflow.test.ts +0 -575
- package/__tests__/model/graphmodel.test.ts +0 -87
- package/__tests__/util/compatible.test.ts +0 -48
- package/__tests__/util/edge.test.ts +0 -224
- package/__tests__/util/geometry.test.ts +0 -14
- package/__tests__/util/graph.test.ts +0 -16
- package/__tests__/util/matrix.test.ts +0 -41
- package/__tests__/util/node.test.ts +0 -68
- package/__tests__/util/sampling.test.ts +0 -12
- package/__tests__/util/vector.test.ts +0 -50
- package/__tests__/util/zIndex.test.ts +0 -10
- package/src/LogicFlow.tsx +0 -2008
- package/src/algorithm/edge.ts +0 -67
- package/src/algorithm/index.ts +0 -70
- package/src/algorithm/outline.ts +0 -77
- package/src/algorithm/rotate.ts +0 -55
- package/src/common/drag.ts +0 -219
- package/src/common/history.ts +0 -108
- package/src/common/index.ts +0 -6
- package/src/common/keyboard.ts +0 -108
- package/src/common/matrix.ts +0 -122
- package/src/common/vector.ts +0 -93
- package/src/constant/index.ts +0 -179
- package/src/event/event.md +0 -66
- package/src/event/eventArgs.ts +0 -643
- package/src/event/eventEmitter.ts +0 -156
- package/src/history/index.ts +0 -119
- package/src/index.less +0 -1
- package/src/index.ts +0 -26
- package/src/keyboard/index.ts +0 -112
- package/src/keyboard/shortcut.ts +0 -200
- package/src/model/BaseModel.ts +0 -250
- package/src/model/EditConfigModel.ts +0 -334
- package/src/model/GraphModel.ts +0 -1788
- package/src/model/NestedTransformModel.ts +0 -121
- package/src/model/SnaplineModel.ts +0 -256
- package/src/model/TransformModel.ts +0 -258
- package/src/model/edge/BaseEdgeModel.ts +0 -777
- package/src/model/edge/BezierEdgeModel.ts +0 -197
- package/src/model/edge/LineEdgeModel.ts +0 -36
- package/src/model/edge/PolylineEdgeModel.ts +0 -672
- package/src/model/edge/index.ts +0 -4
- package/src/model/index.ts +0 -9
- package/src/model/node/BaseNodeModel.ts +0 -949
- package/src/model/node/CircleNodeModel.ts +0 -91
- package/src/model/node/DiamondNodeModel.ts +0 -132
- package/src/model/node/EllipseNodeModel.ts +0 -98
- package/src/model/node/HtmlNodeModel.ts +0 -50
- package/src/model/node/PolygonNodeModel.ts +0 -150
- package/src/model/node/RectNodeModel.ts +0 -69
- package/src/model/node/TextNodeModel.ts +0 -54
- package/src/model/node/index.ts +0 -8
- package/src/options.ts +0 -145
- package/src/style/index.less +0 -261
- package/src/style/raw.ts +0 -220
- package/src/tool/MultipleSelectTool.tsx +0 -132
- package/src/tool/TextEditTool.tsx +0 -193
- package/src/tool/index.ts +0 -101
- package/src/typings.d.ts +0 -5
- package/src/util/animation.ts +0 -29
- package/src/util/browser.ts +0 -4
- package/src/util/compatible.ts +0 -15
- package/src/util/drag.ts +0 -220
- package/src/util/edge.ts +0 -1060
- package/src/util/geometry.ts +0 -55
- package/src/util/graph.ts +0 -46
- package/src/util/index.ts +0 -17
- package/src/util/matrix.ts +0 -129
- package/src/util/mobx.ts +0 -23
- package/src/util/node.ts +0 -543
- package/src/util/raf.ts +0 -28
- package/src/util/resize.ts +0 -606
- package/src/util/sampling.ts +0 -85
- package/src/util/theme.ts +0 -375
- package/src/util/uuid.ts +0 -26
- package/src/util/vector.ts +0 -93
- package/src/util/zIndex.ts +0 -6
- package/src/view/Anchor.tsx +0 -445
- package/src/view/Control.tsx +0 -512
- package/src/view/Graph.tsx +0 -141
- package/src/view/Rotate.tsx +0 -113
- package/src/view/behavior/dnd.ts +0 -162
- package/src/view/behavior/index.ts +0 -2
- package/src/view/behavior/snapline.ts +0 -16
- package/src/view/edge/AdjustPoint.tsx +0 -425
- package/src/view/edge/Arrow.tsx +0 -54
- package/src/view/edge/BaseEdge.tsx +0 -650
- package/src/view/edge/BezierEdge.tsx +0 -101
- package/src/view/edge/LineEdge.tsx +0 -81
- package/src/view/edge/PolylineEdge.tsx +0 -299
- package/src/view/edge/index.ts +0 -6
- package/src/view/index.ts +0 -8
- package/src/view/node/BaseNode.tsx +0 -571
- package/src/view/node/CircleNode.tsx +0 -21
- package/src/view/node/DiamondNode.tsx +0 -24
- package/src/view/node/EllipseNode.tsx +0 -22
- package/src/view/node/HtmlNode.tsx +0 -95
- package/src/view/node/PolygonNode.tsx +0 -28
- package/src/view/node/RectNode.tsx +0 -30
- package/src/view/node/TextNode.tsx +0 -39
- package/src/view/node/index.ts +0 -8
- package/src/view/overlay/BackgroundOverlay.tsx +0 -34
- package/src/view/overlay/BezierAdjustOverlay.tsx +0 -150
- package/src/view/overlay/CanvasOverlay.tsx +0 -288
- package/src/view/overlay/Grid.tsx +0 -162
- package/src/view/overlay/ModificationOverlay.tsx +0 -31
- package/src/view/overlay/OutlineOverlay.tsx +0 -170
- package/src/view/overlay/SnaplineOverlay.tsx +0 -44
- package/src/view/overlay/ToolOverlay.tsx +0 -65
- package/src/view/overlay/getTransformHoc.tsx +0 -50
- package/src/view/overlay/index.ts +0 -8
- package/src/view/shape/Circle.tsx +0 -41
- package/src/view/shape/Ellipse.tsx +0 -42
- package/src/view/shape/Line.tsx +0 -39
- package/src/view/shape/Path.tsx +0 -22
- package/src/view/shape/Polygon.tsx +0 -91
- package/src/view/shape/Polyline.tsx +0 -31
- package/src/view/shape/Rect.tsx +0 -44
- package/src/view/shape/Text.tsx +0 -169
- package/src/view/shape/index.ts +0 -8
- package/src/view/text/BaseText.tsx +0 -134
- package/src/view/text/LineText.tsx +0 -168
- package/src/view/text/index.ts +0 -2
- package/stats.html +0 -4842
- package/tsconfig.json +0 -18
|
@@ -17,7 +17,8 @@ export declare class GraphModel {
|
|
|
17
17
|
width: number;
|
|
18
18
|
height: number;
|
|
19
19
|
theme: LogicFlow.Theme;
|
|
20
|
-
|
|
20
|
+
themeMode: LogicFlow.ThemeMode | string;
|
|
21
|
+
customStyles: LogicFlow.Theme;
|
|
21
22
|
grid: Grid.GridOptions;
|
|
22
23
|
readonly eventCenter: EventEmitter;
|
|
23
24
|
readonly modelMap: Map<string, LogicFlow.GraphElementCtor>;
|
|
@@ -30,6 +31,7 @@ export declare class GraphModel {
|
|
|
30
31
|
animation?: boolean | LFOptions.AnimationConfig;
|
|
31
32
|
idGenerator?: (type?: string) => string | undefined;
|
|
32
33
|
edgeGenerator: LFOptions.Definition['edgeGenerator'];
|
|
34
|
+
customTargetAnchor?: LFOptions.Definition['customTargetAnchor'];
|
|
33
35
|
nodeModelMap: Map<string, BaseNodeModel>;
|
|
34
36
|
edgeModelMap: Map<string, BaseEdgeModel>;
|
|
35
37
|
elementsModelMap: Map<string, BaseNodeModel | BaseEdgeModel>;
|
|
@@ -403,7 +405,7 @@ export declare class GraphModel {
|
|
|
403
405
|
* 设置主题
|
|
404
406
|
* todo docs link
|
|
405
407
|
*/
|
|
406
|
-
setTheme(style: Partial<LogicFlow.Theme>, themeMode?:
|
|
408
|
+
setTheme(style: Partial<LogicFlow.Theme>, themeMode?: LogicFlow.ThemeMode | string): void;
|
|
407
409
|
/**
|
|
408
410
|
* 设置主题
|
|
409
411
|
* todo docs link
|
|
@@ -418,6 +420,7 @@ export declare class GraphModel {
|
|
|
418
420
|
diamond: LogicFlow.CommonTheme;
|
|
419
421
|
ellipse: LogicFlow.CommonTheme;
|
|
420
422
|
polygon: LogicFlow.CommonTheme;
|
|
423
|
+
html: LogicFlow.CommonTheme;
|
|
421
424
|
line: LogicFlow.CommonTheme;
|
|
422
425
|
polyline: LogicFlow.CommonTheme;
|
|
423
426
|
bezier: LogicFlow.EdgeBezierTheme;
|
|
@@ -432,8 +435,13 @@ export declare class GraphModel {
|
|
|
432
435
|
rotateControl: LogicFlow.CommonTheme;
|
|
433
436
|
resizeControl: LogicFlow.CommonTheme;
|
|
434
437
|
resizeOutline: LogicFlow.CommonTheme;
|
|
438
|
+
multiSelect?: {
|
|
439
|
+
xPadding?: number | undefined;
|
|
440
|
+
yPadding?: number | undefined;
|
|
441
|
+
} | undefined;
|
|
435
442
|
edgeAdjust: LogicFlow.CommonTheme;
|
|
436
443
|
outline: LogicFlow.OutlineTheme;
|
|
444
|
+
edgeOutline: LogicFlow.OutlineTheme;
|
|
437
445
|
edgeAnimation: LogicFlow.EdgeAnimation;
|
|
438
446
|
};
|
|
439
447
|
/**
|
package/lib/model/GraphModel.js
CHANGED
|
@@ -69,6 +69,7 @@ var GraphModel = /** @class */ (function () {
|
|
|
69
69
|
function GraphModel(options) {
|
|
70
70
|
var _this = this;
|
|
71
71
|
var _a, _b;
|
|
72
|
+
this.themeMode = 'default';
|
|
72
73
|
// 维护所有节点和边类型对应的 model
|
|
73
74
|
this.modelMap = new Map();
|
|
74
75
|
// Remind:用于记录当前画布上所有节点和边的 model 的 Map
|
|
@@ -102,7 +103,10 @@ var GraphModel = /** @class */ (function () {
|
|
|
102
103
|
// 控制是否开启局部渲染
|
|
103
104
|
this.partial = false;
|
|
104
105
|
this.waitCleanEffects = [];
|
|
105
|
-
var container = options.container, partial = options.partial, _c = options.background, background = _c === void 0 ? {} : _c, grid = options.grid, idGenerator = options.idGenerator, edgeGenerator = options.edgeGenerator, animation = options.animation, customTrajectory = options.customTrajectory;
|
|
106
|
+
var container = options.container, partial = options.partial, _c = options.background, background = _c === void 0 ? {} : _c, grid = options.grid, idGenerator = options.idGenerator, edgeGenerator = options.edgeGenerator, animation = options.animation, customTrajectory = options.customTrajectory, customTargetAnchor = options.customTargetAnchor;
|
|
107
|
+
this.themeMode = options.themeMode || 'default';
|
|
108
|
+
var initialGrid = constant_1.gridModeMap[this.themeMode] || constant_1.gridModeMap['default'];
|
|
109
|
+
var initialBackground = constant_1.backgroundModeMap[this.themeMode] || constant_1.backgroundModeMap['default'];
|
|
106
110
|
this.rootEl = container;
|
|
107
111
|
this.partial = !!partial;
|
|
108
112
|
this.background = background;
|
|
@@ -111,11 +115,14 @@ var GraphModel = /** @class */ (function () {
|
|
|
111
115
|
// TODO:需要让用户设置成 0 吗?后面可以讨论一下
|
|
112
116
|
this.gridSize = grid.size || 1; // 默认 gridSize 设置为 1
|
|
113
117
|
}
|
|
114
|
-
this.customStyles = options.style || {};
|
|
115
|
-
this.grid = overlay_1.Grid.getGridOptions(grid !== null && grid !== void 0 ? grid : false);
|
|
118
|
+
this.customStyles = (options.style || {});
|
|
116
119
|
this.theme = (0, util_1.setupTheme)(options.style, options.themeMode);
|
|
120
|
+
this.grid = overlay_1.Grid.getGridOptions((0, lodash_es_1.assign)({}, initialGrid, grid));
|
|
117
121
|
this.theme.grid = (0, lodash_es_1.cloneDeep)(this.grid);
|
|
118
|
-
|
|
122
|
+
if (background) {
|
|
123
|
+
this.background = (0, lodash_es_1.cloneDeep)((0, lodash_es_1.assign)({}, initialBackground, background));
|
|
124
|
+
this.theme.background = (0, lodash_es_1.cloneDeep)((0, lodash_es_1.assign)({}, initialBackground, background));
|
|
125
|
+
}
|
|
119
126
|
this.edgeType = options.edgeType || 'polyline';
|
|
120
127
|
this.animation = (0, util_1.setupAnimation)(animation);
|
|
121
128
|
this.overlapMode = options.overlapMode || constant_1.OverlapMode.DEFAULT;
|
|
@@ -130,6 +137,10 @@ var GraphModel = /** @class */ (function () {
|
|
|
130
137
|
for (var entries_1 = __values(entries), entries_1_1 = entries_1.next(); !entries_1_1.done; entries_1_1 = entries_1.next()) {
|
|
131
138
|
var entry = entries_1_1.value;
|
|
132
139
|
if (entry.target === _this.rootEl) {
|
|
140
|
+
// 检查元素是否仍在DOM中
|
|
141
|
+
var isElementInDOM = document.body.contains(_this.rootEl);
|
|
142
|
+
if (!isElementInDOM)
|
|
143
|
+
return;
|
|
133
144
|
_this.resize();
|
|
134
145
|
_this.eventCenter.emit('graph:resize', {
|
|
135
146
|
target: _this.rootEl,
|
|
@@ -157,6 +168,7 @@ var GraphModel = /** @class */ (function () {
|
|
|
157
168
|
this.idGenerator = idGenerator;
|
|
158
169
|
this.edgeGenerator = (0, util_1.createEdgeGenerator)(this, edgeGenerator);
|
|
159
170
|
this.customTrajectory = customTrajectory;
|
|
171
|
+
this.customTargetAnchor = customTargetAnchor;
|
|
160
172
|
}
|
|
161
173
|
Object.defineProperty(GraphModel.prototype, "nodesMap", {
|
|
162
174
|
get: function () {
|
|
@@ -497,7 +509,7 @@ var GraphModel = /** @class */ (function () {
|
|
|
497
509
|
edgeDragging = true;
|
|
498
510
|
break;
|
|
499
511
|
}
|
|
500
|
-
|
|
512
|
+
if (!edgeMode.virtual) {
|
|
501
513
|
edges.push(edgeMode.getHistoryData());
|
|
502
514
|
}
|
|
503
515
|
}
|
|
@@ -1337,11 +1349,12 @@ var GraphModel = /** @class */ (function () {
|
|
|
1337
1349
|
GraphModel.prototype.setTheme = function (style, themeMode) {
|
|
1338
1350
|
var _a;
|
|
1339
1351
|
if (themeMode) {
|
|
1352
|
+
this.themeMode = themeMode;
|
|
1340
1353
|
// 修改背景颜色
|
|
1341
|
-
|
|
1342
|
-
this.updateBackgroundOptions(__assign(__assign({}, (typeof this.background === 'object' ? this.background : {})),
|
|
1343
|
-
|
|
1344
|
-
this.updateGridOptions(overlay_1.Grid.getGridOptions(__assign(__assign({}, this.grid),
|
|
1354
|
+
constant_1.backgroundModeMap[themeMode] &&
|
|
1355
|
+
this.updateBackgroundOptions(__assign(__assign({}, (typeof this.background === 'object' ? this.background : {})), constant_1.backgroundModeMap[themeMode]));
|
|
1356
|
+
constant_1.gridModeMap[themeMode] &&
|
|
1357
|
+
this.updateGridOptions(overlay_1.Grid.getGridOptions(__assign(__assign({}, this.grid), constant_1.gridModeMap[themeMode])));
|
|
1345
1358
|
}
|
|
1346
1359
|
if (style.background) {
|
|
1347
1360
|
this.updateBackgroundOptions(style.background);
|
|
@@ -1389,12 +1402,30 @@ var GraphModel = /** @class */ (function () {
|
|
|
1389
1402
|
* 重新设置画布的宽高
|
|
1390
1403
|
*/
|
|
1391
1404
|
GraphModel.prototype.resize = function (width, height) {
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1405
|
+
// 检查当前实例是否已被销毁或rootEl不存在
|
|
1406
|
+
if (!this.rootEl)
|
|
1407
|
+
return;
|
|
1408
|
+
// 检查元素是否仍在DOM中
|
|
1409
|
+
var isElementInDOM = document.body.contains(this.rootEl);
|
|
1410
|
+
if (!isElementInDOM)
|
|
1411
|
+
return;
|
|
1412
|
+
// 检查元素是否可见
|
|
1413
|
+
var isVisible = this.rootEl.offsetParent !== null;
|
|
1414
|
+
if (!isVisible)
|
|
1415
|
+
return;
|
|
1416
|
+
try {
|
|
1417
|
+
this.width = width !== null && width !== void 0 ? width : this.rootEl.getBoundingClientRect().width;
|
|
1418
|
+
this.isContainerWidth = (0, lodash_es_1.isNil)(width);
|
|
1419
|
+
this.height = height !== null && height !== void 0 ? height : this.rootEl.getBoundingClientRect().height;
|
|
1420
|
+
this.isContainerHeight = (0, lodash_es_1.isNil)(height);
|
|
1421
|
+
// 只有在元素可见且应该有宽高的情况下才显示警告
|
|
1422
|
+
if (isVisible && (!this.width || !this.height)) {
|
|
1423
|
+
console.warn('渲染画布的时候无法获取画布宽高,请确认在container已挂载到DOM。@see https://github.com/didi/LogicFlow/issues/675');
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
catch (error) {
|
|
1427
|
+
// 捕获可能的DOM操作错误
|
|
1428
|
+
console.warn('获取画布宽高时发生错误:', error);
|
|
1398
1429
|
}
|
|
1399
1430
|
};
|
|
1400
1431
|
/**
|
|
@@ -1534,6 +1565,9 @@ var GraphModel = /** @class */ (function () {
|
|
|
1534
1565
|
__decorate([
|
|
1535
1566
|
mobx_1.observable
|
|
1536
1567
|
], GraphModel.prototype, "theme", void 0);
|
|
1568
|
+
__decorate([
|
|
1569
|
+
mobx_1.observable
|
|
1570
|
+
], GraphModel.prototype, "themeMode", void 0);
|
|
1537
1571
|
__decorate([
|
|
1538
1572
|
mobx_1.observable
|
|
1539
1573
|
], GraphModel.prototype, "grid", void 0);
|
|
@@ -33,15 +33,15 @@ var translateLimitsMap = {
|
|
|
33
33
|
};
|
|
34
34
|
var TransformModel = /** @class */ (function () {
|
|
35
35
|
function TransformModel(eventCenter, options) {
|
|
36
|
-
this.MINI_SCALE_SIZE = 0.2;
|
|
37
|
-
this.MAX_SCALE_SIZE = 16;
|
|
38
|
-
this.SCALE_X = 1;
|
|
39
|
-
this.SKEW_Y = 0;
|
|
40
|
-
this.SKEW_X = 0;
|
|
41
|
-
this.SCALE_Y = 1;
|
|
42
|
-
this.TRANSLATE_X = 0;
|
|
43
|
-
this.TRANSLATE_Y = 0;
|
|
44
|
-
this.ZOOM_SIZE = 0.04;
|
|
36
|
+
this.MINI_SCALE_SIZE = 0.2; // 缩小的最小值
|
|
37
|
+
this.MAX_SCALE_SIZE = 16; // 放大的最大值
|
|
38
|
+
this.SCALE_X = 1; // x轴缩放比例
|
|
39
|
+
this.SKEW_Y = 0; // y轴倾斜角度
|
|
40
|
+
this.SKEW_X = 0; // x轴倾斜角度
|
|
41
|
+
this.SCALE_Y = 1; // y轴缩放比例
|
|
42
|
+
this.TRANSLATE_X = 0; // x轴平移距离
|
|
43
|
+
this.TRANSLATE_Y = 0; // y轴平移距离
|
|
44
|
+
this.ZOOM_SIZE = 0.04; // 缩放比例变化量
|
|
45
45
|
// 限制画布可移动区域
|
|
46
46
|
this.translateLimitMinX = -Infinity;
|
|
47
47
|
this.translateLimitMinY = -Infinity;
|
|
@@ -195,8 +195,13 @@ var BaseEdgeModel = /** @class */ (function () {
|
|
|
195
195
|
*/
|
|
196
196
|
BaseEdgeModel.prototype.getOutlineStyle = function () {
|
|
197
197
|
var graphModel = this.graphModel;
|
|
198
|
-
var
|
|
199
|
-
|
|
198
|
+
var edgeOutline = graphModel.theme.edgeOutline;
|
|
199
|
+
var attributes = __assign({}, edgeOutline);
|
|
200
|
+
if (this.isHovered) {
|
|
201
|
+
var hoverStyle = edgeOutline.hover || {};
|
|
202
|
+
attributes = __assign(__assign({}, attributes), hoverStyle);
|
|
203
|
+
}
|
|
204
|
+
return (0, lodash_es_1.cloneDeep)(attributes);
|
|
200
205
|
};
|
|
201
206
|
/**
|
|
202
207
|
* 重新自定义文本位置
|
|
@@ -12,6 +12,13 @@ export declare class PolylineEdgeModel extends BaseEdgeModel {
|
|
|
12
12
|
offset?: number;
|
|
13
13
|
dbClickPosition?: Point;
|
|
14
14
|
initEdgeData(data: LogicFlow.EdgeConfig): void;
|
|
15
|
+
setAttributes(): void;
|
|
16
|
+
orthogonalizePath(points: Point[]): Point[];
|
|
17
|
+
/**
|
|
18
|
+
* 计算默认 offset:箭头与折线重叠长度 + 5
|
|
19
|
+
* 重叠长度采用箭头样式中的 offset(沿边方向的长度)
|
|
20
|
+
*/
|
|
21
|
+
private getDefaultOffset;
|
|
15
22
|
getEdgeStyle(): {
|
|
16
23
|
[x: string]: unknown;
|
|
17
24
|
fill?: string | undefined;
|
|
@@ -72,12 +72,139 @@ var PolylineEdgeModel = /** @class */ (function (_super) {
|
|
|
72
72
|
return _this;
|
|
73
73
|
}
|
|
74
74
|
PolylineEdgeModel.prototype.initEdgeData = function (data) {
|
|
75
|
-
|
|
75
|
+
var providedOffset = (0, lodash_es_1.get)(data, 'properties.offset');
|
|
76
|
+
// 当用户未传入 offset 时,按“箭头与折线重叠长度 + 5”作为默认值
|
|
77
|
+
// 其中“重叠长度”采用箭头样式中的 offset(沿边方向的长度)
|
|
78
|
+
this.offset =
|
|
79
|
+
typeof providedOffset === 'number'
|
|
80
|
+
? providedOffset
|
|
81
|
+
: this.getDefaultOffset();
|
|
76
82
|
if (data.pointsList) {
|
|
77
|
-
|
|
83
|
+
var corrected = this.orthogonalizePath(data.pointsList);
|
|
84
|
+
data.pointsList = corrected;
|
|
85
|
+
this.pointsList = corrected;
|
|
78
86
|
}
|
|
79
87
|
_super.prototype.initEdgeData.call(this, data);
|
|
80
88
|
};
|
|
89
|
+
PolylineEdgeModel.prototype.setAttributes = function () {
|
|
90
|
+
var newOffset = this.properties.offset;
|
|
91
|
+
if (newOffset && newOffset !== this.offset) {
|
|
92
|
+
this.offset = newOffset;
|
|
93
|
+
this.updatePoints();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
PolylineEdgeModel.prototype.orthogonalizePath = function (points) {
|
|
97
|
+
// 输入非法或不足两点时直接返回副本
|
|
98
|
+
if (!Array.isArray(points) || points.length < 2) {
|
|
99
|
+
return points;
|
|
100
|
+
}
|
|
101
|
+
// pushUnique: 向数组中添加唯一点,避免重复
|
|
102
|
+
var pushUnique = function (arr, p) {
|
|
103
|
+
var last = arr[arr.length - 1];
|
|
104
|
+
if (!last || last.x !== p.x || last.y !== p.y) {
|
|
105
|
+
arr.push({ x: p.x, y: p.y });
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
// isAxisAligned: 检查两点是否在同一条轴上
|
|
109
|
+
var isAxisAligned = function (a, b) { return a.x === b.x || a.y === b.y; };
|
|
110
|
+
// manhattanDistance: 计算两点在曼哈顿距离上的距离
|
|
111
|
+
var manhattanDistance = function (a, b) {
|
|
112
|
+
return Math.abs(a.x - b.x) + Math.abs(a.y - b.y);
|
|
113
|
+
};
|
|
114
|
+
// 1) 生成严格正交路径,尽量延续前一段方向以减少折点
|
|
115
|
+
var orthogonal = [];
|
|
116
|
+
pushUnique(orthogonal, points[0]);
|
|
117
|
+
// previousDirection: 记录前一段的方向,用于判断当前段的PreferredCorner
|
|
118
|
+
var previousDirection;
|
|
119
|
+
// 遍历所有点对,生成正交路径
|
|
120
|
+
for (var i = 0; i < points.length - 1; i++) {
|
|
121
|
+
var current = orthogonal[orthogonal.length - 1];
|
|
122
|
+
var next = points[i + 1];
|
|
123
|
+
if (!current || !next)
|
|
124
|
+
continue;
|
|
125
|
+
if (isAxisAligned(current, next)) {
|
|
126
|
+
pushUnique(orthogonal, next);
|
|
127
|
+
previousDirection =
|
|
128
|
+
current.x === next.x
|
|
129
|
+
? constant_1.SegmentDirection.VERTICAL
|
|
130
|
+
: constant_1.SegmentDirection.HORIZONTAL;
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
var cornerHV = { x: next.x, y: current.y };
|
|
134
|
+
var cornerVH = { x: current.x, y: next.y };
|
|
135
|
+
// 根据前一段的方向,优先选择能延续该方向的拐角点,以减少折点数量;
|
|
136
|
+
// 若前一段为垂直方向,则优先选择垂直-水平拐角(cornerVH);
|
|
137
|
+
// 若前一段为水平方向,则优先选择水平-垂直拐角(cornerHV);
|
|
138
|
+
// 若前一段无方向(初始情况),则比较两个拐角的曼哈顿距离,选更近者。
|
|
139
|
+
var preferredCorner = previousDirection === constant_1.SegmentDirection.VERTICAL
|
|
140
|
+
? cornerVH
|
|
141
|
+
: previousDirection === constant_1.SegmentDirection.HORIZONTAL
|
|
142
|
+
? cornerHV
|
|
143
|
+
: manhattanDistance(current, cornerHV) <=
|
|
144
|
+
manhattanDistance(current, cornerVH)
|
|
145
|
+
? cornerHV
|
|
146
|
+
: cornerVH;
|
|
147
|
+
if (preferredCorner.x !== current.x || preferredCorner.y !== current.y) {
|
|
148
|
+
pushUnique(orthogonal, preferredCorner);
|
|
149
|
+
}
|
|
150
|
+
pushUnique(orthogonal, next);
|
|
151
|
+
var a = orthogonal[orthogonal.length - 2];
|
|
152
|
+
var b = orthogonal[orthogonal.length - 1];
|
|
153
|
+
previousDirection =
|
|
154
|
+
a && b
|
|
155
|
+
? a.x === b.x
|
|
156
|
+
? constant_1.SegmentDirection.VERTICAL
|
|
157
|
+
: constant_1.SegmentDirection.HORIZONTAL
|
|
158
|
+
: previousDirection;
|
|
159
|
+
}
|
|
160
|
+
// 2) 去除冗余共线中间点
|
|
161
|
+
var simplified = [];
|
|
162
|
+
for (var i = 0; i < orthogonal.length; i++) {
|
|
163
|
+
var prev = orthogonal[i - 1];
|
|
164
|
+
var curr = orthogonal[i];
|
|
165
|
+
var next = orthogonal[i + 1];
|
|
166
|
+
// 如果当前点与前一个点和后一个点在同一条水平线或垂直线上,则跳过该点,去除冗余的共线中间点
|
|
167
|
+
if (prev &&
|
|
168
|
+
curr &&
|
|
169
|
+
next &&
|
|
170
|
+
((prev.x === curr.x && curr.x === next.x) || // 水平共线
|
|
171
|
+
(prev.y === curr.y && curr.y === next.y)) // 垂直共线
|
|
172
|
+
) {
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
pushUnique(simplified, curr);
|
|
176
|
+
}
|
|
177
|
+
// 3) 保留原始起点与终点位置
|
|
178
|
+
if (simplified.length >= 2) {
|
|
179
|
+
simplified[0] = { x: points[0].x, y: points[0].y };
|
|
180
|
+
simplified[simplified.length - 1] = {
|
|
181
|
+
x: points[points.length - 1].x,
|
|
182
|
+
y: points[points.length - 1].y,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
// 4) 结果校验:任意相邻段都必须为水平/垂直;失败则退化为起止两点
|
|
186
|
+
var isOrthogonal = simplified.length < 2 ||
|
|
187
|
+
simplified.every(function (_, idx, arr) {
|
|
188
|
+
if (idx === 0)
|
|
189
|
+
return true;
|
|
190
|
+
return isAxisAligned(arr[idx - 1], arr[idx]);
|
|
191
|
+
});
|
|
192
|
+
return isOrthogonal
|
|
193
|
+
? simplified
|
|
194
|
+
: [
|
|
195
|
+
{ x: points[0].x, y: points[0].y },
|
|
196
|
+
{ x: points[points.length - 1].x, y: points[points.length - 1].y },
|
|
197
|
+
];
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* 计算默认 offset:箭头与折线重叠长度 + 5
|
|
201
|
+
* 重叠长度采用箭头样式中的 offset(沿边方向的长度)
|
|
202
|
+
*/
|
|
203
|
+
PolylineEdgeModel.prototype.getDefaultOffset = function () {
|
|
204
|
+
var arrowStyle = this.getArrowStyle();
|
|
205
|
+
var arrowOverlap = typeof arrowStyle.offset === 'number' ? arrowStyle.offset : 0;
|
|
206
|
+
return arrowOverlap + 5;
|
|
207
|
+
};
|
|
81
208
|
PolylineEdgeModel.prototype.getEdgeStyle = function () {
|
|
82
209
|
var polyline = this.graphModel.theme.polyline;
|
|
83
210
|
var style = _super.prototype.getEdgeStyle.call(this);
|
|
@@ -289,7 +416,7 @@ var PolylineEdgeModel = /** @class */ (function (_super) {
|
|
|
289
416
|
return list;
|
|
290
417
|
};
|
|
291
418
|
PolylineEdgeModel.prototype.updatePath = function (pointList) {
|
|
292
|
-
this.pointsList = pointList;
|
|
419
|
+
this.pointsList = this.orthogonalizePath(pointList);
|
|
293
420
|
this.points = this.getPath(this.pointsList);
|
|
294
421
|
};
|
|
295
422
|
PolylineEdgeModel.prototype.getData = function () {
|
|
@@ -324,8 +451,10 @@ var PolylineEdgeModel = /** @class */ (function (_super) {
|
|
|
324
451
|
x: this.endPoint.x,
|
|
325
452
|
y: this.endPoint.y,
|
|
326
453
|
}, this.sourceNode, this.targetNode, this.offset || 0);
|
|
327
|
-
this.pointsList = pointsList;
|
|
328
|
-
this.points = pointsList
|
|
454
|
+
this.pointsList = this.orthogonalizePath(pointsList);
|
|
455
|
+
this.points = this.pointsList
|
|
456
|
+
.map(function (point) { return "".concat(point.x, ",").concat(point.y); })
|
|
457
|
+
.join(' ');
|
|
329
458
|
};
|
|
330
459
|
PolylineEdgeModel.prototype.updateStartPoint = function (anchor) {
|
|
331
460
|
this.startPoint = Object.assign({}, anchor);
|
|
@@ -547,13 +676,13 @@ var PolylineEdgeModel = /** @class */ (function (_super) {
|
|
|
547
676
|
// 起终点拖拽调整过程中,进行折线路径更新
|
|
548
677
|
PolylineEdgeModel.prototype.updateAfterAdjustStartAndEnd = function (_a) {
|
|
549
678
|
var startPoint = _a.startPoint, endPoint = _a.endPoint, sourceNode = _a.sourceNode, targetNode = _a.targetNode;
|
|
550
|
-
this.pointsList = (0, util_1.getPolylinePoints)({
|
|
679
|
+
this.pointsList = this.orthogonalizePath((0, util_1.getPolylinePoints)({
|
|
551
680
|
x: startPoint.x,
|
|
552
681
|
y: startPoint.y,
|
|
553
682
|
}, {
|
|
554
683
|
x: endPoint.x,
|
|
555
684
|
y: endPoint.y,
|
|
556
|
-
}, sourceNode, targetNode, this.offset || 0);
|
|
685
|
+
}, sourceNode, targetNode, this.offset || 0));
|
|
557
686
|
this.initPoints();
|
|
558
687
|
};
|
|
559
688
|
__decorate([
|
|
@@ -185,7 +185,18 @@ export declare class BaseNodeModel<P extends PropertiesType = PropertiesType> im
|
|
|
185
185
|
* 获取当前节点缩放控制节点的样式
|
|
186
186
|
*/
|
|
187
187
|
getResizeControlStyle(): LogicFlow.CommonTheme;
|
|
188
|
-
getResizeOutlineStyle():
|
|
188
|
+
getResizeOutlineStyle(): {
|
|
189
|
+
[x: string]: unknown;
|
|
190
|
+
fill?: string | undefined;
|
|
191
|
+
stroke?: string | undefined;
|
|
192
|
+
strokeWidth?: number | undefined;
|
|
193
|
+
radius?: number | undefined;
|
|
194
|
+
rx?: number | undefined;
|
|
195
|
+
ry?: number | undefined;
|
|
196
|
+
width?: number | undefined;
|
|
197
|
+
height?: number | undefined;
|
|
198
|
+
path?: string | undefined;
|
|
199
|
+
};
|
|
189
200
|
/**
|
|
190
201
|
* @overridable 支持重写
|
|
191
202
|
* 获取当前节点锚点样式
|
|
@@ -382,7 +382,12 @@ var BaseNodeModel = /** @class */ (function () {
|
|
|
382
382
|
};
|
|
383
383
|
BaseNodeModel.prototype.getResizeOutlineStyle = function () {
|
|
384
384
|
var resizeOutline = this.graphModel.theme.resizeOutline;
|
|
385
|
-
|
|
385
|
+
var attributes = __assign({}, resizeOutline);
|
|
386
|
+
if (this.isHovered) {
|
|
387
|
+
var hoverStyle = resizeOutline.hover || {};
|
|
388
|
+
attributes = __assign(__assign({}, attributes), hoverStyle);
|
|
389
|
+
}
|
|
390
|
+
return (0, lodash_es_1.cloneDeep)(attributes);
|
|
386
391
|
};
|
|
387
392
|
/**
|
|
388
393
|
* @overridable 支持重写
|
|
@@ -552,7 +557,9 @@ var BaseNodeModel = /** @class */ (function () {
|
|
|
552
557
|
* 手动连接边到节点时,需要连接的锚点
|
|
553
558
|
*/
|
|
554
559
|
BaseNodeModel.prototype.getTargetAnchor = function (position) {
|
|
555
|
-
|
|
560
|
+
var _a;
|
|
561
|
+
var customTargetAnchor = this.graphModel.customTargetAnchor;
|
|
562
|
+
return ((_a = customTargetAnchor === null || customTargetAnchor === void 0 ? void 0 : customTargetAnchor(this, position)) !== null && _a !== void 0 ? _a : (0, util_1.getClosestAnchor)(position, this));
|
|
556
563
|
};
|
|
557
564
|
/**
|
|
558
565
|
* 获取节点BBox
|
|
@@ -16,5 +16,17 @@ export declare class HtmlNodeModel<P extends IHtmlNodeProperties = IHtmlNodeProp
|
|
|
16
16
|
constructor(data: LogicFlow.NodeConfig<P>, graphModel: GraphModel);
|
|
17
17
|
setAttributes(): void;
|
|
18
18
|
getDefaultAnchor(): AnchorConfig[];
|
|
19
|
+
getNodeStyle(): {
|
|
20
|
+
[x: string]: unknown;
|
|
21
|
+
fill?: string | undefined;
|
|
22
|
+
stroke?: string | undefined;
|
|
23
|
+
strokeWidth?: number | undefined;
|
|
24
|
+
radius?: number | undefined;
|
|
25
|
+
rx?: number | undefined;
|
|
26
|
+
ry?: number | undefined;
|
|
27
|
+
width?: number | undefined;
|
|
28
|
+
height?: number | undefined;
|
|
29
|
+
path?: string | undefined;
|
|
30
|
+
};
|
|
19
31
|
}
|
|
20
32
|
export default HtmlNodeModel;
|
|
@@ -14,11 +14,23 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
17
28
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
30
|
};
|
|
20
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
32
|
exports.HtmlNodeModel = void 0;
|
|
33
|
+
var lodash_es_1 = require("lodash-es");
|
|
22
34
|
var BaseNodeModel_1 = __importDefault(require("./BaseNodeModel"));
|
|
23
35
|
var constant_1 = require("../../constant");
|
|
24
36
|
var HtmlNodeModel = /** @class */ (function (_super) {
|
|
@@ -48,6 +60,13 @@ var HtmlNodeModel = /** @class */ (function (_super) {
|
|
|
48
60
|
{ x: x - width / 2, y: y, id: "".concat(this.id, "_3") },
|
|
49
61
|
];
|
|
50
62
|
};
|
|
63
|
+
HtmlNodeModel.prototype.getNodeStyle = function () {
|
|
64
|
+
var style = _super.prototype.getNodeStyle.call(this);
|
|
65
|
+
var _a = this.graphModel.theme, baseNode = _a.baseNode, html = _a.html;
|
|
66
|
+
var _b = this.properties.style, customStyle = _b === void 0 ? {} : _b;
|
|
67
|
+
var finalStyle = __assign(__assign(__assign(__assign({}, style), (0, lodash_es_1.cloneDeep)(baseNode)), (0, lodash_es_1.cloneDeep)(html)), (0, lodash_es_1.cloneDeep)(customStyle));
|
|
68
|
+
return finalStyle;
|
|
69
|
+
};
|
|
51
70
|
return HtmlNodeModel;
|
|
52
71
|
}(BaseNodeModel_1.default));
|
|
53
72
|
exports.HtmlNodeModel = HtmlNodeModel;
|
|
@@ -94,9 +94,9 @@ var PolygonNodeModel = /** @class */ (function (_super) {
|
|
|
94
94
|
};
|
|
95
95
|
PolygonNodeModel.prototype.getNodeStyle = function () {
|
|
96
96
|
var style = _super.prototype.getNodeStyle.call(this);
|
|
97
|
-
var
|
|
98
|
-
var
|
|
99
|
-
return __assign(__assign(__assign({}, style), (0, lodash_es_1.cloneDeep)(polygon)), (0, lodash_es_1.cloneDeep)(customStyle));
|
|
97
|
+
var _a = this.graphModel, polygon = _a.theme.polygon, customPolygon = _a.customStyles.polygon;
|
|
98
|
+
var _b = this.properties.style, customStyle = _b === void 0 ? {} : _b;
|
|
99
|
+
return __assign(__assign(__assign(__assign({}, style), (0, lodash_es_1.cloneDeep)(polygon)), (0, lodash_es_1.cloneDeep)(customPolygon)), (0, lodash_es_1.cloneDeep)(customStyle));
|
|
100
100
|
};
|
|
101
101
|
Object.defineProperty(PolygonNodeModel.prototype, "pointsPosition", {
|
|
102
102
|
/**
|
package/lib/options.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TransformModel } from './model';
|
|
1
|
+
import type { TransformModel, BaseNodeModel, Model } from './model';
|
|
2
2
|
import { createElement as h } from 'preact/compat';
|
|
3
3
|
import LogicFlow from './LogicFlow';
|
|
4
4
|
import { KeyboardDef } from './keyboard';
|
|
@@ -21,6 +21,7 @@ export declare namespace Options {
|
|
|
21
21
|
edge: boolean;
|
|
22
22
|
};
|
|
23
23
|
type EdgeGeneratorType = (sourceNode: LogicFlow.NodeData, targetNode: LogicFlow.NodeData, currentEdge?: Partial<LogicFlow.EdgeConfig>) => any;
|
|
24
|
+
type customTargetAnchorType = (nodeModel: BaseNodeModel, position: LogicFlow.Point) => Model.AnchorInfo | undefined;
|
|
24
25
|
interface CustomAnchorLineProps {
|
|
25
26
|
sourcePoint: LogicFlow.Point;
|
|
26
27
|
targetPoint: LogicFlow.Point;
|
|
@@ -67,8 +68,9 @@ export declare namespace Options {
|
|
|
67
68
|
disabledTools?: string[];
|
|
68
69
|
idGenerator?: (type?: string) => string;
|
|
69
70
|
edgeGenerator?: EdgeGeneratorType;
|
|
71
|
+
customTargetAnchor?: customTargetAnchorType;
|
|
70
72
|
customTrajectory?: (props: CustomAnchorLineProps) => h.JSX.Element;
|
|
71
|
-
themeMode?:
|
|
73
|
+
themeMode?: LogicFlow.ThemeMode;
|
|
72
74
|
parentTransform?: TransformModel;
|
|
73
75
|
[key: string]: unknown;
|
|
74
76
|
}
|
package/lib/style/index.css
CHANGED
|
@@ -177,8 +177,9 @@
|
|
|
177
177
|
}
|
|
178
178
|
.lf-multiple-select {
|
|
179
179
|
position: absolute;
|
|
180
|
-
border: 2px dashed #
|
|
181
|
-
|
|
180
|
+
border: 2px dashed #4271dfcc;
|
|
181
|
+
border-radius: 12px;
|
|
182
|
+
box-shadow: 0 0 3px 0 #4271df80;
|
|
182
183
|
cursor: move;
|
|
183
184
|
}
|
|
184
185
|
.lf-edge-adjust-point {
|
package/lib/style/index.less
CHANGED
|
@@ -215,8 +215,9 @@
|
|
|
215
215
|
|
|
216
216
|
.lf-multiple-select {
|
|
217
217
|
position: absolute;
|
|
218
|
-
border: 2px dashed #
|
|
219
|
-
|
|
218
|
+
border: 2px dashed #4271dfcc;
|
|
219
|
+
border-radius: 12px;
|
|
220
|
+
box-shadow: 0 0 3px 0 #4271df80;
|
|
220
221
|
cursor: move;
|
|
221
222
|
}
|
|
222
223
|
|
package/lib/style/raw.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auto generated file, do not modify it!
|
|
3
3
|
*/
|
|
4
|
-
export declare const content = ".lf-graph {\n position: relative;\n z-index: 0;\n width: 100%;\n height: 100%;\n background: #fff;\n user-select: none;\n}\n.lf-element-text {\n cursor: text;\n}\n.lf-text-disabled {\n pointer-events: none;\n}\n.lf-text-draggable {\n cursor: move;\n}\n*:focus {\n outline: none;\n}\n.lf-node-anchor {\n cursor: crosshair;\n}\n.lf-node-anchor-hover {\n visibility: hidden;\n}\n.lf-anchor:hover .lf-node-anchor-hover {\n visibility: visible;\n}\n.lf-edge.pointer-none {\n pointer-events: none;\n}\n.lf-edge-append {\n cursor: pointer;\n}\n.lf-edge-animation {\n stroke-dashoffset: 100%;\n animation: lf_animate_dash 5s linear infinite;\n}\n@keyframes lf_animate_dash {\n to {\n stroke-dashoffset: 0;\n }\n}\n/* node */\n.lf-node-not-allow {\n cursor: not-allowed;\n}\n.lf-polyline-append-ns-resize {\n cursor: ns-resize;\n}\n.lf-polyline-append-ew-resize {\n cursor: ew-resize;\n}\n.lf-dragging {\n cursor: move;\n}\n.lf-dragging .lf-element-text {\n cursor: move;\n}\n.lf-draggable {\n cursor: default;\n}\n.lf-bezier-adjust-anchor {\n cursor: pointer;\n}\n/* background */\n.lf-background,\n.lf-grid {\n position: absolute;\n inset: 0;\n z-index: -1;\n}\n.lf-background-area {\n width: 100%;\n height: 100%;\n}\n/* html-overlay */\n.lf-html-overlay {\n position: absolute;\n inset: 0;\n z-index: 1;\n overflow: hidden;\n user-select: none;\n pointer-events: none;\n}\n.lf-html-overlay__transform > * {\n pointer-events: all;\n}\n.lf-text-editable {\n pointer-events: all;\n}\n.lf-text-input {\n position: absolute;\n box-sizing: border-box;\n min-width: 100px;\n min-height: 20px;\n padding: 5px;\n line-height: 1.2;\n white-space: pre;\n text-align: center;\n background: #fff;\n border: 1px solid #edefed;\n border-radius: 3px;\n outline: none;\n transform: translate(-50%, -50%);\n resize: none;\n}\n.lf-get-text-height {\n display: inline-block;\n box-sizing: border-box;\n word-break: break-all;\n /* \u4E3A\u4E86\u8DDF\u8F93\u5165\u6548\u679C\u4FDD\u6301\u4E00\u81F4\uFF0C\u8BBE\u7F6E\u900F\u660E\u8FB9\u6846\u5360\u4F4D */\n border: 1px solid transparent;\n}\n.lf-node-text-auto-wrap {\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n /* border: 1px solid transparent; */\n}\n.lf-node-text-auto-wrap-content {\n width: 100%;\n line-height: 1.2;\n text-align: center;\n word-break: break-all;\n background: transparent;\n}\n.lf-node-text-ellipsis-content {\n width: 100%;\n line-height: 1.2;\n white-space: nowrap;\n text-align: center;\n background: transparent;\n /* overflow: hidden;\n text-overflow: ellipsis; */\n}\n.lf-node-text-ellipsis-content > div {\n overflow: hidden;\n text-overflow: ellipsis;\n}\n/* tool-overlay */\n.lf-tool-overlay {\n position: absolute;\n inset: 0;\n z-index: 2;\n overflow: hidden;\n pointer-events: none;\n}\n.lf-tool-overlay > * {\n pointer-events: all;\n}\n/* modification-overlay */\n.modification-overlay {\n position: absolute;\n inset: 0;\n z-index: 1;\n overflow: hidden;\n pointer-events: none;\n}\n.modification-overlay > * {\n pointer-events: all;\n}\n.lf-outline,\n.lf-snapline {\n pointer-events: none;\n}\n.lf-keyboard-tips {\n float: right;\n}\n.lf-node-select-decorate {\n position: absolute;\n border: 1px dashed #343435;\n transform: translate(-50%, -50%);\n pointer-events: none;\n}\n.lf-multiple-select {\n position: absolute;\n border: 2px dashed #
|
|
4
|
+
export declare const content = ".lf-graph {\n position: relative;\n z-index: 0;\n width: 100%;\n height: 100%;\n background: #fff;\n user-select: none;\n}\n.lf-element-text {\n cursor: text;\n}\n.lf-text-disabled {\n pointer-events: none;\n}\n.lf-text-draggable {\n cursor: move;\n}\n*:focus {\n outline: none;\n}\n.lf-node-anchor {\n cursor: crosshair;\n}\n.lf-node-anchor-hover {\n visibility: hidden;\n}\n.lf-anchor:hover .lf-node-anchor-hover {\n visibility: visible;\n}\n.lf-edge.pointer-none {\n pointer-events: none;\n}\n.lf-edge-append {\n cursor: pointer;\n}\n.lf-edge-animation {\n stroke-dashoffset: 100%;\n animation: lf_animate_dash 5s linear infinite;\n}\n@keyframes lf_animate_dash {\n to {\n stroke-dashoffset: 0;\n }\n}\n/* node */\n.lf-node-not-allow {\n cursor: not-allowed;\n}\n.lf-polyline-append-ns-resize {\n cursor: ns-resize;\n}\n.lf-polyline-append-ew-resize {\n cursor: ew-resize;\n}\n.lf-dragging {\n cursor: move;\n}\n.lf-dragging .lf-element-text {\n cursor: move;\n}\n.lf-draggable {\n cursor: default;\n}\n.lf-bezier-adjust-anchor {\n cursor: pointer;\n}\n/* background */\n.lf-background,\n.lf-grid {\n position: absolute;\n inset: 0;\n z-index: -1;\n}\n.lf-background-area {\n width: 100%;\n height: 100%;\n}\n/* html-overlay */\n.lf-html-overlay {\n position: absolute;\n inset: 0;\n z-index: 1;\n overflow: hidden;\n user-select: none;\n pointer-events: none;\n}\n.lf-html-overlay__transform > * {\n pointer-events: all;\n}\n.lf-text-editable {\n pointer-events: all;\n}\n.lf-text-input {\n position: absolute;\n box-sizing: border-box;\n min-width: 100px;\n min-height: 20px;\n padding: 5px;\n line-height: 1.2;\n white-space: pre;\n text-align: center;\n background: #fff;\n border: 1px solid #edefed;\n border-radius: 3px;\n outline: none;\n transform: translate(-50%, -50%);\n resize: none;\n}\n.lf-get-text-height {\n display: inline-block;\n box-sizing: border-box;\n word-break: break-all;\n /* \u4E3A\u4E86\u8DDF\u8F93\u5165\u6548\u679C\u4FDD\u6301\u4E00\u81F4\uFF0C\u8BBE\u7F6E\u900F\u660E\u8FB9\u6846\u5360\u4F4D */\n border: 1px solid transparent;\n}\n.lf-node-text-auto-wrap {\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n /* border: 1px solid transparent; */\n}\n.lf-node-text-auto-wrap-content {\n width: 100%;\n line-height: 1.2;\n text-align: center;\n word-break: break-all;\n background: transparent;\n}\n.lf-node-text-ellipsis-content {\n width: 100%;\n line-height: 1.2;\n white-space: nowrap;\n text-align: center;\n background: transparent;\n /* overflow: hidden;\n text-overflow: ellipsis; */\n}\n.lf-node-text-ellipsis-content > div {\n overflow: hidden;\n text-overflow: ellipsis;\n}\n/* tool-overlay */\n.lf-tool-overlay {\n position: absolute;\n inset: 0;\n z-index: 2;\n overflow: hidden;\n pointer-events: none;\n}\n.lf-tool-overlay > * {\n pointer-events: all;\n}\n/* modification-overlay */\n.modification-overlay {\n position: absolute;\n inset: 0;\n z-index: 1;\n overflow: hidden;\n pointer-events: none;\n}\n.modification-overlay > * {\n pointer-events: all;\n}\n.lf-outline,\n.lf-snapline {\n pointer-events: none;\n}\n.lf-keyboard-tips {\n float: right;\n}\n.lf-node-select-decorate {\n position: absolute;\n border: 1px dashed #343435;\n transform: translate(-50%, -50%);\n pointer-events: none;\n}\n.lf-multiple-select {\n position: absolute;\n border: 2px dashed #4271dfcc;\n border-radius: 12px;\n box-shadow: 0 0 3px 0 #4271df80;\n cursor: move;\n}\n.lf-edge-adjust-point {\n cursor: move;\n}\n.lf-rotate-control {\n cursor: grabbing;\n}\n.lf-resize-control-nw {\n cursor: nw-resize;\n}\n.lf-resize-control-n {\n cursor: n-resize;\n}\n.lf-resize-control-ne {\n cursor: ne-resize;\n}\n.lf-resize-control-e {\n cursor: e-resize;\n}\n.lf-resize-control-se {\n cursor: se-resize;\n}\n.lf-resize-control-s {\n cursor: s-resize;\n}\n.lf-resize-control-sw {\n cursor: sw-resize;\n}\n.lf-resize-control-w {\n cursor: w-resize;\n}\n";
|
package/lib/style/raw.js
CHANGED
|
@@ -5,4 +5,4 @@ exports.content = void 0;
|
|
|
5
5
|
/**
|
|
6
6
|
* Auto generated file, do not modify it!
|
|
7
7
|
*/
|
|
8
|
-
exports.content = ".lf-graph {\n position: relative;\n z-index: 0;\n width: 100%;\n height: 100%;\n background: #fff;\n user-select: none;\n}\n.lf-element-text {\n cursor: text;\n}\n.lf-text-disabled {\n pointer-events: none;\n}\n.lf-text-draggable {\n cursor: move;\n}\n*:focus {\n outline: none;\n}\n.lf-node-anchor {\n cursor: crosshair;\n}\n.lf-node-anchor-hover {\n visibility: hidden;\n}\n.lf-anchor:hover .lf-node-anchor-hover {\n visibility: visible;\n}\n.lf-edge.pointer-none {\n pointer-events: none;\n}\n.lf-edge-append {\n cursor: pointer;\n}\n.lf-edge-animation {\n stroke-dashoffset: 100%;\n animation: lf_animate_dash 5s linear infinite;\n}\n@keyframes lf_animate_dash {\n to {\n stroke-dashoffset: 0;\n }\n}\n/* node */\n.lf-node-not-allow {\n cursor: not-allowed;\n}\n.lf-polyline-append-ns-resize {\n cursor: ns-resize;\n}\n.lf-polyline-append-ew-resize {\n cursor: ew-resize;\n}\n.lf-dragging {\n cursor: move;\n}\n.lf-dragging .lf-element-text {\n cursor: move;\n}\n.lf-draggable {\n cursor: default;\n}\n.lf-bezier-adjust-anchor {\n cursor: pointer;\n}\n/* background */\n.lf-background,\n.lf-grid {\n position: absolute;\n inset: 0;\n z-index: -1;\n}\n.lf-background-area {\n width: 100%;\n height: 100%;\n}\n/* html-overlay */\n.lf-html-overlay {\n position: absolute;\n inset: 0;\n z-index: 1;\n overflow: hidden;\n user-select: none;\n pointer-events: none;\n}\n.lf-html-overlay__transform > * {\n pointer-events: all;\n}\n.lf-text-editable {\n pointer-events: all;\n}\n.lf-text-input {\n position: absolute;\n box-sizing: border-box;\n min-width: 100px;\n min-height: 20px;\n padding: 5px;\n line-height: 1.2;\n white-space: pre;\n text-align: center;\n background: #fff;\n border: 1px solid #edefed;\n border-radius: 3px;\n outline: none;\n transform: translate(-50%, -50%);\n resize: none;\n}\n.lf-get-text-height {\n display: inline-block;\n box-sizing: border-box;\n word-break: break-all;\n /* \u4E3A\u4E86\u8DDF\u8F93\u5165\u6548\u679C\u4FDD\u6301\u4E00\u81F4\uFF0C\u8BBE\u7F6E\u900F\u660E\u8FB9\u6846\u5360\u4F4D */\n border: 1px solid transparent;\n}\n.lf-node-text-auto-wrap {\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n /* border: 1px solid transparent; */\n}\n.lf-node-text-auto-wrap-content {\n width: 100%;\n line-height: 1.2;\n text-align: center;\n word-break: break-all;\n background: transparent;\n}\n.lf-node-text-ellipsis-content {\n width: 100%;\n line-height: 1.2;\n white-space: nowrap;\n text-align: center;\n background: transparent;\n /* overflow: hidden;\n text-overflow: ellipsis; */\n}\n.lf-node-text-ellipsis-content > div {\n overflow: hidden;\n text-overflow: ellipsis;\n}\n/* tool-overlay */\n.lf-tool-overlay {\n position: absolute;\n inset: 0;\n z-index: 2;\n overflow: hidden;\n pointer-events: none;\n}\n.lf-tool-overlay > * {\n pointer-events: all;\n}\n/* modification-overlay */\n.modification-overlay {\n position: absolute;\n inset: 0;\n z-index: 1;\n overflow: hidden;\n pointer-events: none;\n}\n.modification-overlay > * {\n pointer-events: all;\n}\n.lf-outline,\n.lf-snapline {\n pointer-events: none;\n}\n.lf-keyboard-tips {\n float: right;\n}\n.lf-node-select-decorate {\n position: absolute;\n border: 1px dashed #343435;\n transform: translate(-50%, -50%);\n pointer-events: none;\n}\n.lf-multiple-select {\n position: absolute;\n border: 2px dashed #
|
|
8
|
+
exports.content = ".lf-graph {\n position: relative;\n z-index: 0;\n width: 100%;\n height: 100%;\n background: #fff;\n user-select: none;\n}\n.lf-element-text {\n cursor: text;\n}\n.lf-text-disabled {\n pointer-events: none;\n}\n.lf-text-draggable {\n cursor: move;\n}\n*:focus {\n outline: none;\n}\n.lf-node-anchor {\n cursor: crosshair;\n}\n.lf-node-anchor-hover {\n visibility: hidden;\n}\n.lf-anchor:hover .lf-node-anchor-hover {\n visibility: visible;\n}\n.lf-edge.pointer-none {\n pointer-events: none;\n}\n.lf-edge-append {\n cursor: pointer;\n}\n.lf-edge-animation {\n stroke-dashoffset: 100%;\n animation: lf_animate_dash 5s linear infinite;\n}\n@keyframes lf_animate_dash {\n to {\n stroke-dashoffset: 0;\n }\n}\n/* node */\n.lf-node-not-allow {\n cursor: not-allowed;\n}\n.lf-polyline-append-ns-resize {\n cursor: ns-resize;\n}\n.lf-polyline-append-ew-resize {\n cursor: ew-resize;\n}\n.lf-dragging {\n cursor: move;\n}\n.lf-dragging .lf-element-text {\n cursor: move;\n}\n.lf-draggable {\n cursor: default;\n}\n.lf-bezier-adjust-anchor {\n cursor: pointer;\n}\n/* background */\n.lf-background,\n.lf-grid {\n position: absolute;\n inset: 0;\n z-index: -1;\n}\n.lf-background-area {\n width: 100%;\n height: 100%;\n}\n/* html-overlay */\n.lf-html-overlay {\n position: absolute;\n inset: 0;\n z-index: 1;\n overflow: hidden;\n user-select: none;\n pointer-events: none;\n}\n.lf-html-overlay__transform > * {\n pointer-events: all;\n}\n.lf-text-editable {\n pointer-events: all;\n}\n.lf-text-input {\n position: absolute;\n box-sizing: border-box;\n min-width: 100px;\n min-height: 20px;\n padding: 5px;\n line-height: 1.2;\n white-space: pre;\n text-align: center;\n background: #fff;\n border: 1px solid #edefed;\n border-radius: 3px;\n outline: none;\n transform: translate(-50%, -50%);\n resize: none;\n}\n.lf-get-text-height {\n display: inline-block;\n box-sizing: border-box;\n word-break: break-all;\n /* \u4E3A\u4E86\u8DDF\u8F93\u5165\u6548\u679C\u4FDD\u6301\u4E00\u81F4\uFF0C\u8BBE\u7F6E\u900F\u660E\u8FB9\u6846\u5360\u4F4D */\n border: 1px solid transparent;\n}\n.lf-node-text-auto-wrap {\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n /* border: 1px solid transparent; */\n}\n.lf-node-text-auto-wrap-content {\n width: 100%;\n line-height: 1.2;\n text-align: center;\n word-break: break-all;\n background: transparent;\n}\n.lf-node-text-ellipsis-content {\n width: 100%;\n line-height: 1.2;\n white-space: nowrap;\n text-align: center;\n background: transparent;\n /* overflow: hidden;\n text-overflow: ellipsis; */\n}\n.lf-node-text-ellipsis-content > div {\n overflow: hidden;\n text-overflow: ellipsis;\n}\n/* tool-overlay */\n.lf-tool-overlay {\n position: absolute;\n inset: 0;\n z-index: 2;\n overflow: hidden;\n pointer-events: none;\n}\n.lf-tool-overlay > * {\n pointer-events: all;\n}\n/* modification-overlay */\n.modification-overlay {\n position: absolute;\n inset: 0;\n z-index: 1;\n overflow: hidden;\n pointer-events: none;\n}\n.modification-overlay > * {\n pointer-events: all;\n}\n.lf-outline,\n.lf-snapline {\n pointer-events: none;\n}\n.lf-keyboard-tips {\n float: right;\n}\n.lf-node-select-decorate {\n position: absolute;\n border: 1px dashed #343435;\n transform: translate(-50%, -50%);\n pointer-events: none;\n}\n.lf-multiple-select {\n position: absolute;\n border: 2px dashed #4271dfcc;\n border-radius: 12px;\n box-shadow: 0 0 3px 0 #4271df80;\n cursor: move;\n}\n.lf-edge-adjust-point {\n cursor: move;\n}\n.lf-rotate-control {\n cursor: grabbing;\n}\n.lf-resize-control-nw {\n cursor: nw-resize;\n}\n.lf-resize-control-n {\n cursor: n-resize;\n}\n.lf-resize-control-ne {\n cursor: ne-resize;\n}\n.lf-resize-control-e {\n cursor: e-resize;\n}\n.lf-resize-control-se {\n cursor: se-resize;\n}\n.lf-resize-control-s {\n cursor: s-resize;\n}\n.lf-resize-control-sw {\n cursor: sw-resize;\n}\n.lf-resize-control-w {\n cursor: w-resize;\n}\n";
|