@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
package/es/model/GraphModel.d.ts
CHANGED
|
@@ -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/es/model/GraphModel.js
CHANGED
|
@@ -51,11 +51,11 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
51
51
|
}
|
|
52
52
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
53
53
|
};
|
|
54
|
-
import { find, forEach, map, merge, isBoolean, debounce, cloneDeep, isNil, } from 'lodash-es';
|
|
54
|
+
import { assign, find, forEach, map, merge, isBoolean, debounce, cloneDeep, isNil, } from 'lodash-es';
|
|
55
55
|
import { action, computed, observable } from 'mobx';
|
|
56
56
|
import { EditConfigModel, } from '.';
|
|
57
|
-
import { DEFAULT_VISIBLE_SPACE, ELEMENT_MAX_Z_INDEX, ElementState, ElementType, EventType, ModelType, OverlapMode, TextMode, } from '../constant';
|
|
58
|
-
import { createEdgeGenerator, createUuid, formatData, getClosestPointOfPolyline, getMinIndex, getNodeAnchorPosition, getNodeBBox, getZIndex, isPointInArea, setupAnimation, setupTheme, snapToGrid, updateTheme,
|
|
57
|
+
import { DEFAULT_VISIBLE_SPACE, ELEMENT_MAX_Z_INDEX, ElementState, ElementType, EventType, ModelType, OverlapMode, TextMode, backgroundModeMap, gridModeMap, } from '../constant';
|
|
58
|
+
import { createEdgeGenerator, createUuid, formatData, getClosestPointOfPolyline, getMinIndex, getNodeAnchorPosition, getNodeBBox, getZIndex, isPointInArea, setupAnimation, setupTheme, snapToGrid, updateTheme, } from '../util';
|
|
59
59
|
import EventEmitter from '../event/eventEmitter';
|
|
60
60
|
import { Grid } from '../view/overlay';
|
|
61
61
|
import NestedTransformModel from './NestedTransformModel';
|
|
@@ -63,6 +63,7 @@ var GraphModel = /** @class */ (function () {
|
|
|
63
63
|
function GraphModel(options) {
|
|
64
64
|
var _this = this;
|
|
65
65
|
var _a, _b;
|
|
66
|
+
this.themeMode = 'default';
|
|
66
67
|
// 维护所有节点和边类型对应的 model
|
|
67
68
|
this.modelMap = new Map();
|
|
68
69
|
// Remind:用于记录当前画布上所有节点和边的 model 的 Map
|
|
@@ -96,7 +97,10 @@ var GraphModel = /** @class */ (function () {
|
|
|
96
97
|
// 控制是否开启局部渲染
|
|
97
98
|
this.partial = false;
|
|
98
99
|
this.waitCleanEffects = [];
|
|
99
|
-
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;
|
|
100
|
+
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;
|
|
101
|
+
this.themeMode = options.themeMode || 'default';
|
|
102
|
+
var initialGrid = gridModeMap[this.themeMode] || gridModeMap['default'];
|
|
103
|
+
var initialBackground = backgroundModeMap[this.themeMode] || backgroundModeMap['default'];
|
|
100
104
|
this.rootEl = container;
|
|
101
105
|
this.partial = !!partial;
|
|
102
106
|
this.background = background;
|
|
@@ -105,11 +109,14 @@ var GraphModel = /** @class */ (function () {
|
|
|
105
109
|
// TODO:需要让用户设置成 0 吗?后面可以讨论一下
|
|
106
110
|
this.gridSize = grid.size || 1; // 默认 gridSize 设置为 1
|
|
107
111
|
}
|
|
108
|
-
this.customStyles = options.style || {};
|
|
109
|
-
this.grid = Grid.getGridOptions(grid !== null && grid !== void 0 ? grid : false);
|
|
112
|
+
this.customStyles = (options.style || {});
|
|
110
113
|
this.theme = setupTheme(options.style, options.themeMode);
|
|
114
|
+
this.grid = Grid.getGridOptions(assign({}, initialGrid, grid));
|
|
111
115
|
this.theme.grid = cloneDeep(this.grid);
|
|
112
|
-
|
|
116
|
+
if (background) {
|
|
117
|
+
this.background = cloneDeep(assign({}, initialBackground, background));
|
|
118
|
+
this.theme.background = cloneDeep(assign({}, initialBackground, background));
|
|
119
|
+
}
|
|
113
120
|
this.edgeType = options.edgeType || 'polyline';
|
|
114
121
|
this.animation = setupAnimation(animation);
|
|
115
122
|
this.overlapMode = options.overlapMode || OverlapMode.DEFAULT;
|
|
@@ -124,6 +131,10 @@ var GraphModel = /** @class */ (function () {
|
|
|
124
131
|
for (var entries_1 = __values(entries), entries_1_1 = entries_1.next(); !entries_1_1.done; entries_1_1 = entries_1.next()) {
|
|
125
132
|
var entry = entries_1_1.value;
|
|
126
133
|
if (entry.target === _this.rootEl) {
|
|
134
|
+
// 检查元素是否仍在DOM中
|
|
135
|
+
var isElementInDOM = document.body.contains(_this.rootEl);
|
|
136
|
+
if (!isElementInDOM)
|
|
137
|
+
return;
|
|
127
138
|
_this.resize();
|
|
128
139
|
_this.eventCenter.emit('graph:resize', {
|
|
129
140
|
target: _this.rootEl,
|
|
@@ -151,6 +162,7 @@ var GraphModel = /** @class */ (function () {
|
|
|
151
162
|
this.idGenerator = idGenerator;
|
|
152
163
|
this.edgeGenerator = createEdgeGenerator(this, edgeGenerator);
|
|
153
164
|
this.customTrajectory = customTrajectory;
|
|
165
|
+
this.customTargetAnchor = customTargetAnchor;
|
|
154
166
|
}
|
|
155
167
|
Object.defineProperty(GraphModel.prototype, "nodesMap", {
|
|
156
168
|
get: function () {
|
|
@@ -491,7 +503,7 @@ var GraphModel = /** @class */ (function () {
|
|
|
491
503
|
edgeDragging = true;
|
|
492
504
|
break;
|
|
493
505
|
}
|
|
494
|
-
|
|
506
|
+
if (!edgeMode.virtual) {
|
|
495
507
|
edges.push(edgeMode.getHistoryData());
|
|
496
508
|
}
|
|
497
509
|
}
|
|
@@ -1331,6 +1343,7 @@ var GraphModel = /** @class */ (function () {
|
|
|
1331
1343
|
GraphModel.prototype.setTheme = function (style, themeMode) {
|
|
1332
1344
|
var _a;
|
|
1333
1345
|
if (themeMode) {
|
|
1346
|
+
this.themeMode = themeMode;
|
|
1334
1347
|
// 修改背景颜色
|
|
1335
1348
|
backgroundModeMap[themeMode] &&
|
|
1336
1349
|
this.updateBackgroundOptions(__assign(__assign({}, (typeof this.background === 'object' ? this.background : {})), backgroundModeMap[themeMode]));
|
|
@@ -1383,12 +1396,30 @@ var GraphModel = /** @class */ (function () {
|
|
|
1383
1396
|
* 重新设置画布的宽高
|
|
1384
1397
|
*/
|
|
1385
1398
|
GraphModel.prototype.resize = function (width, height) {
|
|
1386
|
-
|
|
1387
|
-
this.
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1399
|
+
// 检查当前实例是否已被销毁或rootEl不存在
|
|
1400
|
+
if (!this.rootEl)
|
|
1401
|
+
return;
|
|
1402
|
+
// 检查元素是否仍在DOM中
|
|
1403
|
+
var isElementInDOM = document.body.contains(this.rootEl);
|
|
1404
|
+
if (!isElementInDOM)
|
|
1405
|
+
return;
|
|
1406
|
+
// 检查元素是否可见
|
|
1407
|
+
var isVisible = this.rootEl.offsetParent !== null;
|
|
1408
|
+
if (!isVisible)
|
|
1409
|
+
return;
|
|
1410
|
+
try {
|
|
1411
|
+
this.width = width !== null && width !== void 0 ? width : this.rootEl.getBoundingClientRect().width;
|
|
1412
|
+
this.isContainerWidth = isNil(width);
|
|
1413
|
+
this.height = height !== null && height !== void 0 ? height : this.rootEl.getBoundingClientRect().height;
|
|
1414
|
+
this.isContainerHeight = isNil(height);
|
|
1415
|
+
// 只有在元素可见且应该有宽高的情况下才显示警告
|
|
1416
|
+
if (isVisible && (!this.width || !this.height)) {
|
|
1417
|
+
console.warn('渲染画布的时候无法获取画布宽高,请确认在container已挂载到DOM。@see https://github.com/didi/LogicFlow/issues/675');
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
catch (error) {
|
|
1421
|
+
// 捕获可能的DOM操作错误
|
|
1422
|
+
console.warn('获取画布宽高时发生错误:', error);
|
|
1392
1423
|
}
|
|
1393
1424
|
};
|
|
1394
1425
|
/**
|
|
@@ -1528,6 +1559,9 @@ var GraphModel = /** @class */ (function () {
|
|
|
1528
1559
|
__decorate([
|
|
1529
1560
|
observable
|
|
1530
1561
|
], GraphModel.prototype, "theme", void 0);
|
|
1562
|
+
__decorate([
|
|
1563
|
+
observable
|
|
1564
|
+
], GraphModel.prototype, "themeMode", void 0);
|
|
1531
1565
|
__decorate([
|
|
1532
1566
|
observable
|
|
1533
1567
|
], GraphModel.prototype, "grid", void 0);
|
|
@@ -30,15 +30,15 @@ var translateLimitsMap = {
|
|
|
30
30
|
};
|
|
31
31
|
var TransformModel = /** @class */ (function () {
|
|
32
32
|
function TransformModel(eventCenter, options) {
|
|
33
|
-
this.MINI_SCALE_SIZE = 0.2;
|
|
34
|
-
this.MAX_SCALE_SIZE = 16;
|
|
35
|
-
this.SCALE_X = 1;
|
|
36
|
-
this.SKEW_Y = 0;
|
|
37
|
-
this.SKEW_X = 0;
|
|
38
|
-
this.SCALE_Y = 1;
|
|
39
|
-
this.TRANSLATE_X = 0;
|
|
40
|
-
this.TRANSLATE_Y = 0;
|
|
41
|
-
this.ZOOM_SIZE = 0.04;
|
|
33
|
+
this.MINI_SCALE_SIZE = 0.2; // 缩小的最小值
|
|
34
|
+
this.MAX_SCALE_SIZE = 16; // 放大的最大值
|
|
35
|
+
this.SCALE_X = 1; // x轴缩放比例
|
|
36
|
+
this.SKEW_Y = 0; // y轴倾斜角度
|
|
37
|
+
this.SKEW_X = 0; // x轴倾斜角度
|
|
38
|
+
this.SCALE_Y = 1; // y轴缩放比例
|
|
39
|
+
this.TRANSLATE_X = 0; // x轴平移距离
|
|
40
|
+
this.TRANSLATE_Y = 0; // y轴平移距离
|
|
41
|
+
this.ZOOM_SIZE = 0.04; // 缩放比例变化量
|
|
42
42
|
// 限制画布可移动区域
|
|
43
43
|
this.translateLimitMinX = -Infinity;
|
|
44
44
|
this.translateLimitMinY = -Infinity;
|
|
@@ -192,8 +192,13 @@ var BaseEdgeModel = /** @class */ (function () {
|
|
|
192
192
|
*/
|
|
193
193
|
BaseEdgeModel.prototype.getOutlineStyle = function () {
|
|
194
194
|
var graphModel = this.graphModel;
|
|
195
|
-
var
|
|
196
|
-
|
|
195
|
+
var edgeOutline = graphModel.theme.edgeOutline;
|
|
196
|
+
var attributes = __assign({}, edgeOutline);
|
|
197
|
+
if (this.isHovered) {
|
|
198
|
+
var hoverStyle = edgeOutline.hover || {};
|
|
199
|
+
attributes = __assign(__assign({}, attributes), hoverStyle);
|
|
200
|
+
}
|
|
201
|
+
return cloneDeep(attributes);
|
|
197
202
|
};
|
|
198
203
|
/**
|
|
199
204
|
* 重新自定义文本位置
|
|
@@ -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;
|
|
@@ -69,12 +69,139 @@ var PolylineEdgeModel = /** @class */ (function (_super) {
|
|
|
69
69
|
return _this;
|
|
70
70
|
}
|
|
71
71
|
PolylineEdgeModel.prototype.initEdgeData = function (data) {
|
|
72
|
-
|
|
72
|
+
var providedOffset = get(data, 'properties.offset');
|
|
73
|
+
// 当用户未传入 offset 时,按“箭头与折线重叠长度 + 5”作为默认值
|
|
74
|
+
// 其中“重叠长度”采用箭头样式中的 offset(沿边方向的长度)
|
|
75
|
+
this.offset =
|
|
76
|
+
typeof providedOffset === 'number'
|
|
77
|
+
? providedOffset
|
|
78
|
+
: this.getDefaultOffset();
|
|
73
79
|
if (data.pointsList) {
|
|
74
|
-
|
|
80
|
+
var corrected = this.orthogonalizePath(data.pointsList);
|
|
81
|
+
data.pointsList = corrected;
|
|
82
|
+
this.pointsList = corrected;
|
|
75
83
|
}
|
|
76
84
|
_super.prototype.initEdgeData.call(this, data);
|
|
77
85
|
};
|
|
86
|
+
PolylineEdgeModel.prototype.setAttributes = function () {
|
|
87
|
+
var newOffset = this.properties.offset;
|
|
88
|
+
if (newOffset && newOffset !== this.offset) {
|
|
89
|
+
this.offset = newOffset;
|
|
90
|
+
this.updatePoints();
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
PolylineEdgeModel.prototype.orthogonalizePath = function (points) {
|
|
94
|
+
// 输入非法或不足两点时直接返回副本
|
|
95
|
+
if (!Array.isArray(points) || points.length < 2) {
|
|
96
|
+
return points;
|
|
97
|
+
}
|
|
98
|
+
// pushUnique: 向数组中添加唯一点,避免重复
|
|
99
|
+
var pushUnique = function (arr, p) {
|
|
100
|
+
var last = arr[arr.length - 1];
|
|
101
|
+
if (!last || last.x !== p.x || last.y !== p.y) {
|
|
102
|
+
arr.push({ x: p.x, y: p.y });
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
// isAxisAligned: 检查两点是否在同一条轴上
|
|
106
|
+
var isAxisAligned = function (a, b) { return a.x === b.x || a.y === b.y; };
|
|
107
|
+
// manhattanDistance: 计算两点在曼哈顿距离上的距离
|
|
108
|
+
var manhattanDistance = function (a, b) {
|
|
109
|
+
return Math.abs(a.x - b.x) + Math.abs(a.y - b.y);
|
|
110
|
+
};
|
|
111
|
+
// 1) 生成严格正交路径,尽量延续前一段方向以减少折点
|
|
112
|
+
var orthogonal = [];
|
|
113
|
+
pushUnique(orthogonal, points[0]);
|
|
114
|
+
// previousDirection: 记录前一段的方向,用于判断当前段的PreferredCorner
|
|
115
|
+
var previousDirection;
|
|
116
|
+
// 遍历所有点对,生成正交路径
|
|
117
|
+
for (var i = 0; i < points.length - 1; i++) {
|
|
118
|
+
var current = orthogonal[orthogonal.length - 1];
|
|
119
|
+
var next = points[i + 1];
|
|
120
|
+
if (!current || !next)
|
|
121
|
+
continue;
|
|
122
|
+
if (isAxisAligned(current, next)) {
|
|
123
|
+
pushUnique(orthogonal, next);
|
|
124
|
+
previousDirection =
|
|
125
|
+
current.x === next.x
|
|
126
|
+
? SegmentDirection.VERTICAL
|
|
127
|
+
: SegmentDirection.HORIZONTAL;
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
var cornerHV = { x: next.x, y: current.y };
|
|
131
|
+
var cornerVH = { x: current.x, y: next.y };
|
|
132
|
+
// 根据前一段的方向,优先选择能延续该方向的拐角点,以减少折点数量;
|
|
133
|
+
// 若前一段为垂直方向,则优先选择垂直-水平拐角(cornerVH);
|
|
134
|
+
// 若前一段为水平方向,则优先选择水平-垂直拐角(cornerHV);
|
|
135
|
+
// 若前一段无方向(初始情况),则比较两个拐角的曼哈顿距离,选更近者。
|
|
136
|
+
var preferredCorner = previousDirection === SegmentDirection.VERTICAL
|
|
137
|
+
? cornerVH
|
|
138
|
+
: previousDirection === SegmentDirection.HORIZONTAL
|
|
139
|
+
? cornerHV
|
|
140
|
+
: manhattanDistance(current, cornerHV) <=
|
|
141
|
+
manhattanDistance(current, cornerVH)
|
|
142
|
+
? cornerHV
|
|
143
|
+
: cornerVH;
|
|
144
|
+
if (preferredCorner.x !== current.x || preferredCorner.y !== current.y) {
|
|
145
|
+
pushUnique(orthogonal, preferredCorner);
|
|
146
|
+
}
|
|
147
|
+
pushUnique(orthogonal, next);
|
|
148
|
+
var a = orthogonal[orthogonal.length - 2];
|
|
149
|
+
var b = orthogonal[orthogonal.length - 1];
|
|
150
|
+
previousDirection =
|
|
151
|
+
a && b
|
|
152
|
+
? a.x === b.x
|
|
153
|
+
? SegmentDirection.VERTICAL
|
|
154
|
+
: SegmentDirection.HORIZONTAL
|
|
155
|
+
: previousDirection;
|
|
156
|
+
}
|
|
157
|
+
// 2) 去除冗余共线中间点
|
|
158
|
+
var simplified = [];
|
|
159
|
+
for (var i = 0; i < orthogonal.length; i++) {
|
|
160
|
+
var prev = orthogonal[i - 1];
|
|
161
|
+
var curr = orthogonal[i];
|
|
162
|
+
var next = orthogonal[i + 1];
|
|
163
|
+
// 如果当前点与前一个点和后一个点在同一条水平线或垂直线上,则跳过该点,去除冗余的共线中间点
|
|
164
|
+
if (prev &&
|
|
165
|
+
curr &&
|
|
166
|
+
next &&
|
|
167
|
+
((prev.x === curr.x && curr.x === next.x) || // 水平共线
|
|
168
|
+
(prev.y === curr.y && curr.y === next.y)) // 垂直共线
|
|
169
|
+
) {
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
pushUnique(simplified, curr);
|
|
173
|
+
}
|
|
174
|
+
// 3) 保留原始起点与终点位置
|
|
175
|
+
if (simplified.length >= 2) {
|
|
176
|
+
simplified[0] = { x: points[0].x, y: points[0].y };
|
|
177
|
+
simplified[simplified.length - 1] = {
|
|
178
|
+
x: points[points.length - 1].x,
|
|
179
|
+
y: points[points.length - 1].y,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
// 4) 结果校验:任意相邻段都必须为水平/垂直;失败则退化为起止两点
|
|
183
|
+
var isOrthogonal = simplified.length < 2 ||
|
|
184
|
+
simplified.every(function (_, idx, arr) {
|
|
185
|
+
if (idx === 0)
|
|
186
|
+
return true;
|
|
187
|
+
return isAxisAligned(arr[idx - 1], arr[idx]);
|
|
188
|
+
});
|
|
189
|
+
return isOrthogonal
|
|
190
|
+
? simplified
|
|
191
|
+
: [
|
|
192
|
+
{ x: points[0].x, y: points[0].y },
|
|
193
|
+
{ x: points[points.length - 1].x, y: points[points.length - 1].y },
|
|
194
|
+
];
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* 计算默认 offset:箭头与折线重叠长度 + 5
|
|
198
|
+
* 重叠长度采用箭头样式中的 offset(沿边方向的长度)
|
|
199
|
+
*/
|
|
200
|
+
PolylineEdgeModel.prototype.getDefaultOffset = function () {
|
|
201
|
+
var arrowStyle = this.getArrowStyle();
|
|
202
|
+
var arrowOverlap = typeof arrowStyle.offset === 'number' ? arrowStyle.offset : 0;
|
|
203
|
+
return arrowOverlap + 5;
|
|
204
|
+
};
|
|
78
205
|
PolylineEdgeModel.prototype.getEdgeStyle = function () {
|
|
79
206
|
var polyline = this.graphModel.theme.polyline;
|
|
80
207
|
var style = _super.prototype.getEdgeStyle.call(this);
|
|
@@ -286,7 +413,7 @@ var PolylineEdgeModel = /** @class */ (function (_super) {
|
|
|
286
413
|
return list;
|
|
287
414
|
};
|
|
288
415
|
PolylineEdgeModel.prototype.updatePath = function (pointList) {
|
|
289
|
-
this.pointsList = pointList;
|
|
416
|
+
this.pointsList = this.orthogonalizePath(pointList);
|
|
290
417
|
this.points = this.getPath(this.pointsList);
|
|
291
418
|
};
|
|
292
419
|
PolylineEdgeModel.prototype.getData = function () {
|
|
@@ -321,8 +448,10 @@ var PolylineEdgeModel = /** @class */ (function (_super) {
|
|
|
321
448
|
x: this.endPoint.x,
|
|
322
449
|
y: this.endPoint.y,
|
|
323
450
|
}, this.sourceNode, this.targetNode, this.offset || 0);
|
|
324
|
-
this.pointsList = pointsList;
|
|
325
|
-
this.points = pointsList
|
|
451
|
+
this.pointsList = this.orthogonalizePath(pointsList);
|
|
452
|
+
this.points = this.pointsList
|
|
453
|
+
.map(function (point) { return "".concat(point.x, ",").concat(point.y); })
|
|
454
|
+
.join(' ');
|
|
326
455
|
};
|
|
327
456
|
PolylineEdgeModel.prototype.updateStartPoint = function (anchor) {
|
|
328
457
|
this.startPoint = Object.assign({}, anchor);
|
|
@@ -544,13 +673,13 @@ var PolylineEdgeModel = /** @class */ (function (_super) {
|
|
|
544
673
|
// 起终点拖拽调整过程中,进行折线路径更新
|
|
545
674
|
PolylineEdgeModel.prototype.updateAfterAdjustStartAndEnd = function (_a) {
|
|
546
675
|
var startPoint = _a.startPoint, endPoint = _a.endPoint, sourceNode = _a.sourceNode, targetNode = _a.targetNode;
|
|
547
|
-
this.pointsList = getPolylinePoints({
|
|
676
|
+
this.pointsList = this.orthogonalizePath(getPolylinePoints({
|
|
548
677
|
x: startPoint.x,
|
|
549
678
|
y: startPoint.y,
|
|
550
679
|
}, {
|
|
551
680
|
x: endPoint.x,
|
|
552
681
|
y: endPoint.y,
|
|
553
|
-
}, sourceNode, targetNode, this.offset || 0);
|
|
682
|
+
}, sourceNode, targetNode, this.offset || 0));
|
|
554
683
|
this.initPoints();
|
|
555
684
|
};
|
|
556
685
|
__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
|
* 获取当前节点锚点样式
|
|
@@ -379,7 +379,12 @@ var BaseNodeModel = /** @class */ (function () {
|
|
|
379
379
|
};
|
|
380
380
|
BaseNodeModel.prototype.getResizeOutlineStyle = function () {
|
|
381
381
|
var resizeOutline = this.graphModel.theme.resizeOutline;
|
|
382
|
-
|
|
382
|
+
var attributes = __assign({}, resizeOutline);
|
|
383
|
+
if (this.isHovered) {
|
|
384
|
+
var hoverStyle = resizeOutline.hover || {};
|
|
385
|
+
attributes = __assign(__assign({}, attributes), hoverStyle);
|
|
386
|
+
}
|
|
387
|
+
return cloneDeep(attributes);
|
|
383
388
|
};
|
|
384
389
|
/**
|
|
385
390
|
* @overridable 支持重写
|
|
@@ -549,7 +554,9 @@ var BaseNodeModel = /** @class */ (function () {
|
|
|
549
554
|
* 手动连接边到节点时,需要连接的锚点
|
|
550
555
|
*/
|
|
551
556
|
BaseNodeModel.prototype.getTargetAnchor = function (position) {
|
|
552
|
-
|
|
557
|
+
var _a;
|
|
558
|
+
var customTargetAnchor = this.graphModel.customTargetAnchor;
|
|
559
|
+
return ((_a = customTargetAnchor === null || customTargetAnchor === void 0 ? void 0 : customTargetAnchor(this, position)) !== null && _a !== void 0 ? _a : getClosestAnchor(position, this));
|
|
553
560
|
};
|
|
554
561
|
/**
|
|
555
562
|
* 获取节点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;
|
|
@@ -13,6 +13,18 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
13
13
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
14
|
};
|
|
15
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
|
+
import { cloneDeep } from 'lodash-es';
|
|
16
28
|
import BaseNodeModel from './BaseNodeModel';
|
|
17
29
|
import { ModelType } from '../../constant';
|
|
18
30
|
var HtmlNodeModel = /** @class */ (function (_super) {
|
|
@@ -42,6 +54,13 @@ var HtmlNodeModel = /** @class */ (function (_super) {
|
|
|
42
54
|
{ x: x - width / 2, y: y, id: "".concat(this.id, "_3") },
|
|
43
55
|
];
|
|
44
56
|
};
|
|
57
|
+
HtmlNodeModel.prototype.getNodeStyle = function () {
|
|
58
|
+
var style = _super.prototype.getNodeStyle.call(this);
|
|
59
|
+
var _a = this.graphModel.theme, baseNode = _a.baseNode, html = _a.html;
|
|
60
|
+
var _b = this.properties.style, customStyle = _b === void 0 ? {} : _b;
|
|
61
|
+
var finalStyle = __assign(__assign(__assign(__assign({}, style), cloneDeep(baseNode)), cloneDeep(html)), cloneDeep(customStyle));
|
|
62
|
+
return finalStyle;
|
|
63
|
+
};
|
|
45
64
|
return HtmlNodeModel;
|
|
46
65
|
}(BaseNodeModel));
|
|
47
66
|
export { HtmlNodeModel };
|
|
@@ -88,9 +88,9 @@ var PolygonNodeModel = /** @class */ (function (_super) {
|
|
|
88
88
|
};
|
|
89
89
|
PolygonNodeModel.prototype.getNodeStyle = function () {
|
|
90
90
|
var style = _super.prototype.getNodeStyle.call(this);
|
|
91
|
-
var
|
|
92
|
-
var
|
|
93
|
-
return __assign(__assign(__assign({}, style), cloneDeep(polygon)), cloneDeep(customStyle));
|
|
91
|
+
var _a = this.graphModel, polygon = _a.theme.polygon, customPolygon = _a.customStyles.polygon;
|
|
92
|
+
var _b = this.properties.style, customStyle = _b === void 0 ? {} : _b;
|
|
93
|
+
return __assign(__assign(__assign(__assign({}, style), cloneDeep(polygon)), cloneDeep(customPolygon)), cloneDeep(customStyle));
|
|
94
94
|
};
|
|
95
95
|
Object.defineProperty(PolygonNodeModel.prototype, "pointsPosition", {
|
|
96
96
|
/**
|
package/es/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/es/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/es/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/es/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/es/style/raw.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Auto generated file, do not modify it!
|
|
4
4
|
*/
|
|
5
|
-
export var 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 #
|
|
5
|
+
export var 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";
|